diff --git a/cuda_toolkit/bin/FrameViewKMD.sys b/cuda_toolkit/bin/FrameViewKMD.sys new file mode 100644 index 0000000000000000000000000000000000000000..c98fb07a54061d55b3e8cac236a48feb879f200c Binary files /dev/null and b/cuda_toolkit/bin/FrameViewKMD.sys differ diff --git a/cuda_toolkit/bin/FvSDK_x64.dll b/cuda_toolkit/bin/FvSDK_x64.dll new file mode 100644 index 0000000000000000000000000000000000000000..95b2cee5ea8b463db568b29cfb475a628a8dda97 Binary files /dev/null and b/cuda_toolkit/bin/FvSDK_x64.dll differ diff --git a/cuda_toolkit/bin/FvSDK_x86.dll b/cuda_toolkit/bin/FvSDK_x86.dll new file mode 100644 index 0000000000000000000000000000000000000000..3f3de8b9f22b37a612cd7863c8e130340050f635 Binary files /dev/null and b/cuda_toolkit/bin/FvSDK_x86.dll differ diff --git a/cuda_toolkit/bin/__nvcc_device_query.exe b/cuda_toolkit/bin/__nvcc_device_query.exe new file mode 100644 index 0000000000000000000000000000000000000000..161fe496f4ea9aaa7514c7885061619437f8635f Binary files /dev/null and b/cuda_toolkit/bin/__nvcc_device_query.exe differ diff --git a/cuda_toolkit/bin/ant b/cuda_toolkit/bin/ant new file mode 100644 index 0000000000000000000000000000000000000000..b5ed5be6a8fe3a08d26dea53ea0fb3f5fab45e3f --- /dev/null +++ b/cuda_toolkit/bin/ant @@ -0,0 +1,336 @@ +#! /bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Extract launch and ant arguments, (see details below). +ant_exec_args= +no_config=false +use_jikes_default=false +ant_exec_debug=false +show_help=false +for arg in "$@" ; do + if [ "$arg" = "--noconfig" ] ; then + no_config=true + elif [ "$arg" = "--usejikes" ] ; then + use_jikes_default=true + elif [ "$arg" = "--execdebug" ] ; then + ant_exec_debug=true + elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then + show_help=true + ant_exec_args="$ant_exec_args -h" + else + if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then + show_help=true + fi + ant_exec_args="$ant_exec_args \"$arg\"" + fi +done + +# Source/default ant configuration +if $no_config ; then + rpm_mode=false + usejikes=$use_jikes_default +else + # load system-wide ant configuration (ONLY if ANT_HOME has NOT been set) + if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then + if [ -f "/etc/ant.conf" ] ; then + . /etc/ant.conf + fi + fi + + # load user ant configuration + if [ -f "$HOME/.ant/ant.conf" ] ; then + . $HOME/.ant/ant.conf + fi + if [ -f "$HOME/.antrc" ] ; then + . "$HOME/.antrc" + fi + + # provide default configuration values + if [ -z "$rpm_mode" ] ; then + rpm_mode=false + fi + if [ -z "$usejikes" ] ; then + usejikes=$use_jikes_default + fi +fi + +# Setup Java environment in rpm mode +if $rpm_mode ; then + if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions + set_jvm + set_javacmd + fi +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false; +case "`uname`" in + CYGWIN*) cygwin=true ;; + Darwin*) darwin=true + if [ -z "$JAVA_HOME" ] ; then + if [ -x '/usr/libexec/java_home' ] ; then + JAVA_HOME=`/usr/libexec/java_home` + elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then + JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + fi + ;; + MINGW*) mingw=true ;; +esac + +if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then + ## resolve links - $0 may be a link to ant's home + PRG="$0" + progname=`basename "$0"` + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi + done + + ANT_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ANT_HOME=`cd "$ANT_HOME" > /dev/null && pwd` +fi + +# For Cygwin and Mingw, ensure paths are in UNIX format before +# anything is touched +if $cygwin ; then + [ -n "$ANT_HOME" ] && + ANT_HOME=`cygpath --unix "$ANT_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi +if $mingw ; then + [ -n "$ANT_HOME" ] && + ANT_HOME="`(cd "$ANT_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +# set ANT_LIB location +ANT_LIB="${ANT_HOME}/lib" + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + JAVACMD="$JAVA_HOME/jre/sh/java" + elif [ -x "$JAVA_HOME/jre/bin/java" ] ; then + JAVACMD="$JAVA_HOME/jre/bin/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD=`which java 2> /dev/null ` + if [ -z "$JAVACMD" ] ; then + JAVACMD=java + fi + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." + echo " We cannot execute $JAVACMD" + exit 1 +fi + +# Build local classpath using just the launcher in non-rpm mode or +# use the Jpackage helper in rpm mode with basic and default jars +# specified in the ant.conf configuration. Because the launcher is +# used, libraries linked in ANT_HOME/lib will also be included, but this +# is discouraged as it is not java-version safe. A user should +# request optional jars and their dependencies via the OPT_JAR_LIST +# variable +if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then + LOCALCLASSPATH="$(/usr/bin/build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis)" + + # If no optional jars have been specified then build the default list + if [ -z "$OPT_JAR_LIST" ] ; then + for file in /etc/ant.d/*; do + if [ -f "$file" ]; then + case "$file" in + *~) ;; + *#*) ;; + *.rpmsave) ;; + *.rpmnew) ;; + *) + for dep in `cat "$file"`; do + OPT_JAR_LIST="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep" + done + esac + fi + done + fi + + # If the user requested to try to add some other jars to the classpath + if [ -n "$OPT_JAR_LIST" ] ; then + _OPTCLASSPATH="$(/usr/bin/build-classpath $OPT_JAR_LIST 2> /dev/null)" + if [ -n "$_OPTCLASSPATH" ] ; then + LOCALCLASSPATH="$LOCALCLASSPATH:$_OPTCLASSPATH" + fi + fi + + # Explicitly add javac path to classpath, assume JAVA_HOME set + # properly in rpm mode + if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then + LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar" + fi + if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then + LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip" + fi + + # if CLASSPATH_OVERRIDE env var is set, LOCALCLASSPATH will be + # user CLASSPATH first and ant-found jars after. + # In that case, the user CLASSPATH will override ant-found jars + # + # if CLASSPATH_OVERRIDE is not set, we'll have the normal behaviour + # with ant-found jars first and user CLASSPATH after + if [ -n "$CLASSPATH" ] ; then + # merge local and specified classpath + if [ -z "$LOCALCLASSPATH" ] ; then + LOCALCLASSPATH="$CLASSPATH" + elif [ -n "$CLASSPATH_OVERRIDE" ] ; then + LOCALCLASSPATH="$CLASSPATH:$LOCALCLASSPATH" + else + LOCALCLASSPATH="$LOCALCLASSPATH:$CLASSPATH" + fi + + # remove class path from launcher -cp option + CLASSPATH="" + fi +else + # not using rpm_mode; use launcher to determine classpaths + if [ -z "$LOCALCLASSPATH" ] ; then + LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar + else + LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH + fi +fi + +if [ -n "$JAVA_HOME" ] ; then + # OSX hack to make Ant work with jikes + if $darwin ; then + OSXHACK="${JAVA_HOME}/../Classes" + if [ -d "${OSXHACK}" ] ; then + for i in "${OSXHACK}"/*.jar + do + JIKESPATH="$JIKESPATH:$i" + done + fi + fi +fi + +# Allow Jikes support (off by default) +if $usejikes; then + ANT_OPTS="$ANT_OPTS -Dbuild.compiler=jikes" +fi + +# For Cygwin, switch paths to appropriate format before running java +# For PATHs convert to unix format first, then to windows format to ensure +# both formats are supported. Probably this will fail on directories with ; +# in the name in the path. Let's assume that paths containing ; are more +# rare than windows style paths on cygwin. +if $cygwin; then + if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then + format=mixed + else + format=windows + fi + [ -n "$ANT_HOME" ] && ANT_HOME=`cygpath --$format "$ANT_HOME"` + ANT_LIB=`cygpath --$format "$ANT_LIB"` + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --$format "$JAVA_HOME"` + LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"` + LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"` + if [ -n "$CLASSPATH" ] ; then + CP_TEMP=`cygpath --path --unix "$CLASSPATH"` + CLASSPATH=`cygpath --path --$format "$CP_TEMP"` + fi + CYGHOME=`cygpath --$format "$HOME"` +fi + +# Show script help if requested +if $show_help ; then + echo $0 '[script options] [options] [target [target2 [target3] ..]]' + echo 'Script Options:' + echo ' --help, --h print this message and ant help' + echo ' --noconfig suppress sourcing of /etc/ant.conf,' + echo ' $HOME/.ant/ant.conf, and $HOME/.antrc' + echo ' configuration files' + echo ' --usejikes enable use of jikes by default, unless' + echo ' set explicitly in configuration files' + echo ' --execdebug print ant exec line generated by this' + echo ' launch script' + echo ' ' +fi +# add a second backslash to variables terminated by a backslash under cygwin +if $cygwin; then + case "$ANT_HOME" in + *\\ ) + ANT_HOME="$ANT_HOME\\" + ;; + esac + case "$CYGHOME" in + *\\ ) + CYGHOME="$CYGHOME\\" + ;; + esac + case "$JIKESPATH" in + *\\ ) + JIKESPATH="$JIKESPATH\\" + ;; + esac + case "$LOCALCLASSPATH" in + *\\ ) + LOCALCLASSPATH="$LOCALCLASSPATH\\" + ;; + esac + case "$CLASSPATH" in + *\\ ) + CLASSPATH="$CLASSPATH\\" + ;; + esac +fi +# Execute ant using eval/exec to preserve spaces in paths, +# java options, and ant args +ant_sys_opts= +if [ -n "$CYGHOME" ]; then + if [ -n "$JIKESPATH" ]; then + ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\" -Dcygwin.user.home=\"$CYGHOME\"" + else + ant_sys_opts="-Dcygwin.user.home=\"$CYGHOME\"" + fi +else + if [ -n "$JIKESPATH" ]; then + ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\"" + fi +fi +ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\"" +if $ant_exec_debug ; then + echo $ant_exec_command $ant_exec_args +fi +eval $ant_exec_command "$ant_exec_args" diff --git a/cuda_toolkit/bin/ant.bat b/cuda_toolkit/bin/ant.bat new file mode 100644 index 0000000000000000000000000000000000000000..9f18b82a4442bb4e9f54776ca5c2ed0787790165 --- /dev/null +++ b/cuda_toolkit/bin/ant.bat @@ -0,0 +1,218 @@ +@echo off + +REM Licensed to the Apache Software Foundation (ASF) under one or more +REM contributor license agreements. See the NOTICE file distributed with +REM this work for additional information regarding copyright ownership. +REM The ASF licenses this file to You under the Apache License, Version 2.0 +REM (the "License"); you may not use this file except in compliance with +REM the License. You may obtain a copy of the License at +REM +REM http://www.apache.org/licenses/LICENSE-2.0 +REM +REM Unless required by applicable law or agreed to in writing, software +REM distributed under the License is distributed on an "AS IS" BASIS, +REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +REM See the License for the specific language governing permissions and +REM limitations under the License. + +REM This is an inordinately troublesome piece of code, particularly because it +REM tries to work on both Win9x and WinNT-based systems. If we could abandon '9x +REM support, things would be much easier, but sadly, it is not yet time. +REM Be cautious about editing this, and only add WinNT specific stuff in code that +REM only runs on WinNT. + +if "%HOME%"=="" goto homeDrivePathPre +if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat" + +:homeDrivePathPre +if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePre +if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePre +if exist "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat" + +:userProfilePre +if "%USERPROFILE%"=="" goto alpha +if "%USERPROFILE%"=="%HOME%" goto alpha +if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto alpha +if exist "%USERPROFILE%\antrc_pre.bat" call "%USERPROFILE%\antrc_pre.bat" + +:alpha + +if "%OS%"=="Windows_NT" @setlocal +if "%OS%"=="WINNT" @setlocal + +if "%ANT_HOME%"=="" goto setDefaultAntHome + +:stripAntHome +if not _%ANT_HOME:~-1%==_\ goto checkClasspath +set ANT_HOME=%ANT_HOME:~0,-1% +goto stripAntHome + +:setDefaultAntHome +rem %~dp0 is expanded pathname of the current script under NT +set ANT_HOME=%~dp0.. + +:checkClasspath +set _USE_CLASSPATH=yes +rem CLASSPATH must not be used if it is equal to "" +if "%CLASSPATH%"=="""" set _USE_CLASSPATH=no +if "%CLASSPATH%"=="" set _USE_CLASSPATH=no + +rem Slurp the command line arguments. This loop allows for an unlimited number +rem of arguments (up to the command line limit, anyway). +set ANT_CMD_LINE_ARGS= +:setupArgs +if ""%1""=="""" goto doneStart +if ""%1""==""-noclasspath"" goto clearclasspath +set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1 +shift +goto setupArgs + +rem here is there is a -noclasspath in the options +:clearclasspath +set _USE_CLASSPATH=no +shift +goto setupArgs + +rem This label provides a place for the argument list loop to break out +rem and for NT handling to skip to. + +:doneStart + +if "%_USE_CLASSPATH%"=="no" goto findAntHome + +:stripClasspath +if not _%CLASSPATH:~-1%==_\ goto findAntHome +set CLASSPATH=%CLASSPATH:~0,-1% +goto stripClasspath + +:findAntHome +rem find ANT_HOME if it does not exist due to either an invalid value passed +rem by the user or the %0 problem on Windows 9x +if exist "%ANT_HOME%\lib\ant.jar" goto checkJava + +rem check for ant in Program Files +if not exist "%ProgramFiles%\ant" goto checkSystemDrive +set ANT_HOME=%ProgramFiles%\ant +goto checkJava + +:checkSystemDrive +rem check for ant in root directory of system drive +if not exist %SystemDrive%\ant\lib\ant.jar goto checkCDrive +set ANT_HOME=%SystemDrive%\ant +goto checkJava + +:checkCDrive +rem check for ant in C:\ant for Win9X users +if not exist C:\ant\lib\ant.jar goto noAntHome +set ANT_HOME=C:\ant +goto checkJava + +:noAntHome +echo ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME. +goto end + +:checkJava +set _JAVACMD=%JAVACMD% + +if "%JAVA_HOME%" == "" goto noJavaHome +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome +if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe +goto checkJikes + +:noJavaHome +if "%_JAVACMD%" == "" set _JAVACMD=java.exe + +:checkJikes +if not "%JIKESPATH%"=="" goto runAntWithJikes + +:runAnt +if "%_USE_CLASSPATH%"=="no" goto runAntNoClasspath +:runAntWithClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% +rem Check the error code of the Ant build +if not "%OS%"=="Windows_NT" goto onError +set ANT_ERROR=%ERRORLEVEL% +goto end + +:runAntNoClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% +rem Check the error code of the Ant build +if not "%OS%"=="Windows_NT" goto onError +set ANT_ERROR=%ERRORLEVEL% +goto end + +:runAntWithJikes + +if not _%JIKESPATH:~-1%==_\ goto checkJikesAndClasspath +set JIKESPATH=%JIKESPATH:~0,-1% +goto runAntWithJikes + +:checkJikesAndClasspath + +if "%_USE_CLASSPATH%"=="no" goto runAntWithJikesNoClasspath + +:runAntWithJikesAndClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% +rem Check the error code of the Ant build +if not "%OS%"=="Windows_NT" goto onError +set ANT_ERROR=%ERRORLEVEL% +goto end + +:runAntWithJikesNoClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% +rem Check the error code of the Ant build +if not "%OS%"=="Windows_NT" goto onError +set ANT_ERROR=%ERRORLEVEL% +goto end + +:onError +rem Windows 9x way of checking the error code. It matches via brute force. +for %%i in (1 10 100) do set err%%i= +for %%i in (0 1 2) do if errorlevel %%i00 set err100=%%i +if %err100%==2 goto onError200 +if %err100%==0 set err100= +for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%%i0 set err10=%%i +if "%err100%"=="" if %err10%==0 set err10= +:onError1 +for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%err10%%%i set err1=%%i +goto onErrorEnd +:onError200 +for %%i in (0 1 2 3 4 5) do if errorlevel 2%%i0 set err10=%%i +if err10==5 for %%i in (0 1 2 3 4 5) do if errorlevel 25%%i set err1=%%i +if not err10==5 goto onError1 +:onErrorEnd +set ANT_ERROR=%err100%%err10%%err1% +for %%i in (1 10 100) do set err%%i= + +:end +rem bug ID 32069: resetting an undefined env variable changes the errorlevel. +if not "%_JAVACMD%"=="" set _JAVACMD= +if not "%_ANT_CMD_LINE_ARGS%"=="" set ANT_CMD_LINE_ARGS= + +if "%ANT_ERROR%"=="0" goto mainEnd + +goto omega + +:mainEnd + +rem If there were no errors, we run the post script. +if "%OS%"=="Windows_NT" @endlocal +if "%OS%"=="WINNT" @endlocal + +if "%HOME%"=="" goto homeDrivePathPost +if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat" + +:homeDrivePathPost +if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePost +if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePost +if exist "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat" + +:userProfilePost +if "%USERPROFILE%"=="" goto omega +if "%USERPROFILE%"=="%HOME%" goto omega +if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto omega +if exist "%USERPROFILE%\antrc_post.bat" call "%USERPROFILE%\antrc_post.bat" + +:omega + +exit /b %ANT_ERROR% diff --git a/cuda_toolkit/bin/ant.cmd b/cuda_toolkit/bin/ant.cmd new file mode 100644 index 0000000000000000000000000000000000000000..70665c003c6dfee7bfaae7ecaed5163ce9879c26 --- /dev/null +++ b/cuda_toolkit/bin/ant.cmd @@ -0,0 +1,93 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Run ant +*/ + +'@echo off' +parse arg mode envarg '::' antarg + +if mode\='.' & mode\='..' & mode\='/' then do + envarg = mode envarg + mode = '' +end + +if antarg = '' then do + antarg = envarg + envarg = '' +end + +x = setlocal() + +env="OS2ENVIRONMENT" +antenv = _getenv_('antenv') +if _testenv_() = 0 then interpret 'call "' || antenv || '"' '"' || envarg || '"' + +if mode = '' then mode = _getenv_('ANT_MODE' '..') +if mode \= '/' then do + runrc = _getenv_('runrc') + antrc = _getenv_('antrc' 'antrc.cmd') + if mode = '..' then mode = '-r' + else mode = '' + interpret 'call "' || runrc || '"' antrc '"' || mode || '"' +end + +if _testenv_() = 0 then do + say 'Ant environment is not set properly' + x = endlocal() + exit 16 +end + +settings = '-Dant.home=' || ANT_HOME '-Djava.home=' || JAVA_HOME + +java = _getenv_('javacmd' 'java') +opts = value('ANT_OPTS',,env) +args = value('ANT_ARGS',,env) +lcp = value('LOCALCLASSPATH',,env) +cp = value('CLASSPATH',,env) +if value('ANT_USE_CP',,env) \= '' then do + if lcp \= '' & right(lcp, 1) \= ';' then lcp = lcp || ';' + lcp = lcp || cp + 'SET CLASSPATH=' +end +if lcp\='' then lcp = '-classpath' lcp + +cmd = java opts lcp '-jar' ANT_HOME ||'\lib\ant-launcher.jar' settings args antarg +launcher = stream(ANT_HOME ||'\lib\ant-launcher.jar', 'C', 'query exists') +if launcher = '' then entry = 'org.apache.tools.ant.Main' +else entry = 'org.apache.tools.ant.launch.Launcher' +java opts lcp entry settings args antarg + +x = endlocal() + +return rc + +_testenv_: procedure expose env ANT_HOME JAVA_HOME +ANT_HOME = value('ANT_HOME',,env) +if ANT_HOME = '' then return 0 +JAVA_HOME = value('JAVA_HOME',,env) +if JAVA_HOME = '' then return 0 +cp = translate(value('CLASSPATH',,env)) +if pos(translate(ANT_HOME), cp) = 0 then return 0 +if pos(translate(JAVA_HOME), cp) = 0 then return 0 +return 1 + +_getenv_: procedure expose env +parse arg envar default +if default = '' then default = envar +var = value(translate(envar),,env) +if var = '' then var = default +return var diff --git a/cuda_toolkit/bin/antRun b/cuda_toolkit/bin/antRun new file mode 100644 index 0000000000000000000000000000000000000000..8110f86efea38ba5fcd0ed57b2af883155d341a8 --- /dev/null +++ b/cuda_toolkit/bin/antRun @@ -0,0 +1,24 @@ +#! /bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Args: DIR command +cd "$1" +CMD="$2" +shift +shift + +exec "$CMD" "$@" diff --git a/cuda_toolkit/bin/antRun.bat b/cuda_toolkit/bin/antRun.bat new file mode 100644 index 0000000000000000000000000000000000000000..c7d90f03e7303465ca6d2c24dd23a2221932378a --- /dev/null +++ b/cuda_toolkit/bin/antRun.bat @@ -0,0 +1,50 @@ +@echo off + +REM Licensed to the Apache Software Foundation (ASF) under one or more +REM contributor license agreements. See the NOTICE file distributed with +REM this work for additional information regarding copyright ownership. +REM The ASF licenses this file to You under the Apache License, Version 2.0 +REM (the "License"); you may not use this file except in compliance with +REM the License. You may obtain a copy of the License at +REM +REM http://www.apache.org/licenses/LICENSE-2.0 +REM +REM Unless required by applicable law or agreed to in writing, software +REM distributed under the License is distributed on an "AS IS" BASIS, +REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +REM See the License for the specific language governing permissions and +REM limitations under the License. + +if "%OS%"=="Windows_NT" @setlocal +if "%OS%"=="WINNT" @setlocal + +if ""%1""=="""" goto runCommand + +rem Change drive and directory to %1 +if "%OS%"=="Windows_NT" goto nt_cd +if "%OS%"=="WINNT" goto nt_cd +cd ""%1"" +goto end_cd +:nt_cd +cd /d ""%1"" +:end_cd +shift + +rem Slurp the command line arguments. This loop allows for an unlimited number +rem of arguments (up to the command line limit, anyway). +set ANT_RUN_CMD=%1 +if ""%1""=="""" goto runCommand +shift +:loop +if ""%1""=="""" goto runCommand +set ANT_RUN_CMD=%ANT_RUN_CMD% %1 +shift +goto loop + +:runCommand +rem echo %ANT_RUN_CMD% +%ANT_RUN_CMD% + +if "%OS%"=="Windows_NT" @endlocal +if "%OS%"=="WINNT" @endlocal + diff --git a/cuda_toolkit/bin/antRun.pl b/cuda_toolkit/bin/antRun.pl new file mode 100644 index 0000000000000000000000000000000000000000..dbea10f2a8a649f36c5890a761f261439ff07f7b --- /dev/null +++ b/cuda_toolkit/bin/antRun.pl @@ -0,0 +1,66 @@ +#!/usr/bin/perl +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +####################################################################### +# +# antRun.pl +# +# wrapper script for invoking commands on a platform with Perl installed +# this is akin to antRun.bat, and antRun the SH script +# +# created: 2001-10-18 +# author: Jeff Tulley jtulley@novell.com +####################################################################### +#be fussy about variables +use strict; + +#turn warnings on during dev; generates a few spurious uninitialised var access warnings +#use warnings; + +#and set $debug to 1 to turn on trace info (currently unused) +my $debug=1; + +####################################################################### +# change drive and directory to "%1" +my $ANT_RUN_CMD = @ARGV[0]; + +# assign current run command to "%2" +chdir (@ARGV[0]) || die "Can't cd to $ARGV[0]: $!\n"; +if ($^O eq "NetWare") { + # There is a bug in Perl 5 on NetWare, where chdir does not + # do anything. On NetWare, the following path-prefixed form should + # always work. (afaict) + $ANT_RUN_CMD .= "/".@ARGV[1]; +} +else { + $ANT_RUN_CMD = @ARGV[1]; +} + +# dispose of the first two arguments, leaving only the command's args. +shift; +shift; + +# run the command +my $returnValue = system $ANT_RUN_CMD, @ARGV; +if ($returnValue eq 0) { + exit 0; +} +else { + # only 0 and 1 are widely recognized as exit values + # so change the exit value to 1 + exit 1; +} diff --git a/cuda_toolkit/bin/antenv.cmd b/cuda_toolkit/bin/antenv.cmd new file mode 100644 index 0000000000000000000000000000000000000000..046026657b2b62a31b4e0a8dfcfc8e69794fce15 --- /dev/null +++ b/cuda_toolkit/bin/antenv.cmd @@ -0,0 +1,98 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +'@echo off' +call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs" +call SysLoadFuncs + +/* Prepare the parameters for later use */ +parse arg argv +mode = '' +args = '' +opts = '' +cp = '' +lcp = '' + +do i = 1 to words(argv) + param = word(argv, i) + select + when param='-lcp' then mode = 'l' + when param='-cp' | param='-classpath' then mode = 'c' + when abbrev('-opts', param, 4) then mode = 'o' + when abbrev('-args', param, 4) then mode = 'a' + otherwise + select + when mode = 'a' then args = space(args param, 1) + when mode = 'c' then cp = space(cp param, 1) + when mode = 'l' then lcp = space(lcp param, 1) + when mode = 'o' then opts = space(opts param, 1) + otherwise + say 'Option' param 'ignored' + end + end +end + +env="OS2ENVIRONMENT" +antconf = _getenv_('antconf' 'antconf.cmd') +runrc = _getenv_('runrc') +interpret 'call "' || runrc || '"' '"' || antconf || '"' 'ETC' +ANT_HOME = value('ANT_HOME',,env) +JAVA_HOME = value('JAVA_HOME',,env) +classpath = value('CLASSPATH',,env) +classes = stream(JAVA_HOME || "\lib\classes.zip", "C", "QUERY EXISTS") +if classes \= '' then classpath = prepend(classpath classes) +classes = stream(JAVA_HOME || "\lib\tools.jar", "C", "QUERY EXISTS") +if classes \= '' then classpath = prepend(classpath classes) + +classpath = prepend(classpath ANT_HOME || '\lib\ant-launcher.jar') +'SET CLASSPATH=' || classpath + +/* Setting classpathes, options and arguments */ +envset = _getenv_('envset') +if cp\='' then interpret 'call "' || envset || '"' '"; CLASSPATH"' '"' || cp || '"' +if lcp\='' then interpret 'call "' || envset || '"' '"; LOCALCLASSPATH"' '"' || lcp || '"' +if opts\='' then interpret 'call "' || envset || '"' '"-D ANT_OPTS"' '"' || opts || '"' +if args\='' then interpret 'call "' || envset || '"' '"ANT_ARGS"' '"' || args || '"' + +exit 0 + +addpath: procedure +parse arg path elem +if elem = '' then do + if path\='' & right(path, 1)\=';' then path = path || ';' + return path +end +if substr(path, length(path)) = ';' then glue = '' +else glue = ';' +if pos(translate(elem), translate(path)) = 0 then path = path || glue || elem || ';' +return path + +prepend: procedure +parse arg path elem +if elem = '' then do + if path\='' & right(path, 1)\=';' then path = path || ';' + return path +end +if pos(translate(elem), translate(path)) = 0 then path = elem || ';' || path +return path + +_getenv_: procedure expose env +parse arg envar default +if default = '' then default = envar +var = value(translate(envar),,env) +if var = '' then var = default +return var diff --git a/cuda_toolkit/bin/complete-ant-cmd.pl b/cuda_toolkit/bin/complete-ant-cmd.pl new file mode 100644 index 0000000000000000000000000000000000000000..e7b5c0c7b51a41f7764bcb17f0e147d2b7c5073d --- /dev/null +++ b/cuda_toolkit/bin/complete-ant-cmd.pl @@ -0,0 +1,114 @@ +#!/usr/bin/perl +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# A script to allow Bash or Z-Shell to complete an Ant command-line. +# +# To install for Bash 2.0 or better, add the following to ~/.bashrc: +# +# complete -C complete-ant-cmd.pl ant build.sh +# +# To install for Z-Shell 2.5 or better, add the following to ~/.zshrc: +# +# function ant_complete () { +# local args_line args +# read -l args_line +# set -A args $args_line +# set -A reply $(COMP_LINE=$args_line complete-ant-cmd.pl ${args[1]} $1) +# } +# compctl -K ant_complete ant build.sh +# +# @author Mike Williams + +my $cmdLine = $ENV{'COMP_LINE'}; +my $antCmd = $ARGV[0]; +my $word = $ARGV[1]; + +my @completions; +if ($word =~ /^-/) { + list( restrict( $word, getArguments() )); +} elsif ($cmdLine =~ /-(f|buildfile)\s+\S*$/) { + list( getBuildFiles($word) ); +} else { + list( restrict( $word, getTargets() )); +} + +exit(0); + +sub list { + for (@_) { + print "$_\n"; + } +} + +sub restrict { + my ($word, @completions) = @_; + grep( /^\Q$word\E/, @completions ); +} + +sub getArguments { + qw(-buildfile -debug -emacs -f -find -help -listener -logfile + -logger -projecthelp -quiet -verbose -version); +} + + +sub getBuildFiles { + my ($word) = @_; + grep( /\.xml$/, glob( "$word*" )); +} + +sub getTargets { + + # Look for build-file + my $buildFile = 'build.xml'; + if ($cmdLine =~ /-(f|buildfile)\s+(\S+)/) { + $buildFile = $2; + } + return () unless (-f $buildFile); + + # Run "ant -projecthelp" to list targets. Keep a cache of results in a + # cache-file. + my $cacheFile = $buildFile; + $cacheFile =~ s|(.*/)?(.*)|${1}.ant-targets-${2}|; + if ((!-e $cacheFile) || (-z $cacheFile) || (-M $buildFile) < (-M $cacheFile)) { + open( CACHE, '>'.$cacheFile ) || die "can\'t write $cacheFile: $!\n"; + open( HELP, "$antCmd -projecthelp -f '$buildFile'|" ) || return(); + my %targets; + while( ) { + if (/^\s+(\S+)/) { + $targets{$1}++; + } + } + my @targets = sort keys %targets; + for (@targets) { print CACHE "$_\n"; } + return @targets; + } + + # Read the target-cache + open( CACHE, $cacheFile ) || die "can\'t read $cacheFile: $!\n"; + my @targets; + while () { + chop; + s/\r$//; # for Cygwin + push( @targets, $_ ); + } + close( CACHE ); + @targets; + +} + + + diff --git a/cuda_toolkit/bin/compute-sanitizer.bat b/cuda_toolkit/bin/compute-sanitizer.bat new file mode 100644 index 0000000000000000000000000000000000000000..dde321ce75b313c4ded0afa760d3cf063906df06 --- /dev/null +++ b/cuda_toolkit/bin/compute-sanitizer.bat @@ -0,0 +1,2 @@ +@echo off +"%~dp0\..\compute-sanitizer\compute-sanitizer.exe" %* diff --git a/cuda_toolkit/bin/envset.cmd b/cuda_toolkit/bin/envset.cmd new file mode 100644 index 0000000000000000000000000000000000000000..3149be4ce41033e9150e69fe8c794c364a8cefe0 --- /dev/null +++ b/cuda_toolkit/bin/envset.cmd @@ -0,0 +1,131 @@ +/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +SET environment variables +First optional parameter: + ; parameters are considered parts of a path variable, semicolons are + appended to each element if not already present + -D parameters are properties for Java or Makefile etc., -D will be + prepended and the parameters will be separated by a space + =D the same as above but equal sign is not required + , parameters should be comma separated in the environment variable + - parameters should be separated by the next parameter + Other values mean that the first parameter is missing and the environment + variable will be set to the space separated parameters + +Second parameter: name of the environment variable + +Next parameters: values +; implies that the equal sign is considered a part of the parameter and is +not interpreted + +-D requires parameters in the form name=value. If the equal sign is not found, +the parameters are changed to name=expanded_name + +Other options have optional equal sign. If it is found, only the part after +the equal sign will be oprionally expanded. + +If the parameter is the minus sign, the next parameter will not be expanded. +If the parameter is a single dot, it will be replaced with the value of the +environment variable as it existed before envset was invoked. + +For other parameters the batch looks for the environment variable with the +same name (in uppercase). If it is found, it forms the expanded_name. If +the environment variable with such a name does not exist, the expanded_name +will hold the parameter name without case conversion. +*/ + +parse arg mode envar args + +equal = 0 +sep = ' ' + +/* Parse command line parameters */ +select + when mode='-' then do + sep = envar + parse var args envar args + end + when mode=';' then do + sep = '' + equal = -1 + end + when mode='-D' then equal = 1 + when mode='=D' then mode = '-D' + when mode=',' then sep = ',' +otherwise + args = envar args + envar = mode + mode = '' +end + +env = 'OS2ENVIRONMENT' +envar = translate(envar) +orig = value(envar,,env) +newval = '' +expand = 1 + +/* for each parameter... */ +do i = 1 to words(args) + if expand > 0 & word(args, i) = '-' then expand = 0 + else call addval word(args, i) +end + +/* Optionally enclose path variable by quotes */ +if mode = ';' & pos(' ', newval) > 0 then newval = '"' || newval || '"' + +/* Set the new value, 'SET' cannot be used since it does not allow '=' */ +x = value(envar, newval, env) +exit 0 + +addval: procedure expose sep equal orig expand newval mode env +parse arg var + +if var = '.' then expvar = orig +else do + if equal >= 0 then do + parse var var name '=' val + if val = '' then var = name + else var = val + end + if expand = 0 then expvar = var + else expvar = value(translate(var),,env) + if expvar = '' then expvar = var + if equal >= 0 then do + if val = '' then do + parse var expvar key '=' val + if val <> '' then name = key + else do + if equal > 0 then val = key + else name = key + end + end + else val = expvar + if pos(' ', val) > 0 | pos('=', val) > 0 then val = '"' || val || '"' + if val = '' then expvar = name + else expvar = name || '=' || val + end + if mode = '-D' then expvar = '-D' || expvar + if mode = ';' then do + if right(expvar, 1) <> ';' then expvar = expvar || ';' + end +end + +if newval = '' then newval = expvar +else newval = newval || sep || expvar +expand = 1 +return diff --git a/cuda_toolkit/bin/lcp.bat b/cuda_toolkit/bin/lcp.bat new file mode 100644 index 0000000000000000000000000000000000000000..dc7e9bf531f2c51fcb719474f6e42ada017c6dc1 --- /dev/null +++ b/cuda_toolkit/bin/lcp.bat @@ -0,0 +1,31 @@ +REM +REM Licensed to the Apache Software Foundation (ASF) under one or more +REM contributor license agreements. See the NOTICE file distributed with +REM this work for additional information regarding copyright ownership. +REM The ASF licenses this file to You under the Apache License, Version 2.0 +REM (the "License"); you may not use this file except in compliance with +REM the License. You may obtain a copy of the License at +REM +REM http://www.apache.org/licenses/LICENSE-2.0 +REM +REM Unless required by applicable law or agreed to in writing, software +REM distributed under the License is distributed on an "AS IS" BASIS, +REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +REM See the License for the specific language governing permissions and +REM limitations under the License. +REM +REM + +set _CLASSPATHCOMPONENT=%1 +if ""%1""=="""" goto gotAllArgs +shift + +:argCheck +if ""%1""=="""" goto gotAllArgs +set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1 +shift +goto argCheck + +:gotAllArgs +set LOCALCLASSPATH=%LOCALCLASSPATH%;%_CLASSPATHCOMPONENT% + diff --git a/cuda_toolkit/bin/mouseLut.json b/cuda_toolkit/bin/mouseLut.json new file mode 100644 index 0000000000000000000000000000000000000000..20bc02a9cb7733250c4bfb8a1c02406d5ba7f9df --- /dev/null +++ b/cuda_toolkit/bin/mouseLut.json @@ -0,0 +1,1732 @@ +{ + "db": [ + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 16889, + "avgLmbLatencyUs": 16889, + "make": "Microsoft", + "mode": "none", + "model": "Basic Optical Mouse 2.0", + "perClickLatency": false, + "pid": "00cb", + "polledActuation": false, + "reportExtension": false, + "revision": "0100", + "vid": "045e" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 39752, + "avgLmbLatencyUs": 39752, + "make": "Microsoft", + "mode": "none", + "model": "Optical Mouse 200", + "perClickLatency": false, + "pid": "0797", + "polledActuation": false, + "reportExtension": false, + "revision": "0200", + "vid": "045e" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4125, + "avgLmbLatencyUs": 4125, + "make": "Alienware", + "mode": "none", + "model": "AW610M (wired)", + "perClickLatency": true, + "pid": "4e9d", + "polledActuation": false, + "reportExtension": false, + "revision": "0308", + "vid": "0461" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4543, + "avgLmbLatencyUs": 4543, + "make": "Alienware", + "mode": "none", + "model": "AW610M (wireless)", + "perClickLatency": true, + "pid": "4ec0", + "polledActuation": false, + "reportExtension": false, + "revision": "0303", + "vid": "0461" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1843, + "avgLmbLatencyUs": 1843, + "make": "Logitech G", + "mode": "wireless", + "model": "PRO X SUPERLIGHT (wireless)", + "perClickLatency": false, + "pid": "4093", + "polledActuation": false, + "reportExtension": true, + "revision": "0000", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2919, + "avgLmbLatencyUs": 2919, + "make": "Logitech G", + "mode": "none", + "model": "G403", + "perClickLatency": false, + "pid": "c083", + "polledActuation": false, + "reportExtension": false, + "revision": "0801", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 3179, + "avgLmbLatencyUs": 3179, + "make": "Logitech G", + "mode": "none", + "model": "G203", + "perClickLatency": false, + "pid": "c084", + "polledActuation": false, + "reportExtension": false, + "revision": "0703", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 3025, + "avgLmbLatencyUs": 3025, + "make": "Logitech G", + "mode": "none", + "model": "PRO", + "perClickLatency": false, + "pid": "c085", + "polledActuation": false, + "reportExtension": false, + "revision": "1002", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2562, + "avgLmbLatencyUs": 2562, + "make": "Logitech G", + "mode": "none", + "model": "PRO Wireless Ghost White (wired), PRO Wireless Easter Pink (wired), PRO Wireless Black (wired)", + "perClickLatency": false, + "pid": "c088", + "polledActuation": false, + "reportExtension": false, + "revision": "1502", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2523, + "avgLmbLatencyUs": 2537, + "make": "Logitech G", + "mode": "none", + "model": "PRO Wireless Ghost White (wired), PRO Wireless Easter Pink (wired), PRO Wireless Black (wired)", + "perClickLatency": true, + "pid": "c088", + "polledActuation": false, + "reportExtension": false, + "revision": "1510", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2497, + "avgLmbLatencyUs": 2497, + "make": "Logitech G", + "mode": "none", + "model": "G502", + "perClickLatency": false, + "pid": "c08b", + "polledActuation": false, + "reportExtension": false, + "revision": "2702", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2554, + "avgLmbLatencyUs": 2554, + "make": "Logitech G", + "mode": "none", + "model": "PRO", + "perClickLatency": false, + "pid": "c08c", + "polledActuation": false, + "reportExtension": false, + "revision": "2801", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2527, + "avgLmbLatencyUs": 2527, + "make": "Logitech G", + "mode": "none", + "model": "502 Lightspeed (wired)", + "perClickLatency": false, + "pid": "c08d", + "polledActuation": false, + "reportExtension": false, + "revision": "1700", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2809, + "avgLmbLatencyUs": 2809, + "make": "Logitech G", + "mode": "none", + "model": "MX518", + "perClickLatency": false, + "pid": "c08e", + "polledActuation": false, + "reportExtension": false, + "revision": "4000", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2562, + "avgLmbLatencyUs": 2562, + "make": "Logitech G", + "mode": "none", + "model": "403 Hero", + "perClickLatency": false, + "pid": "c08f", + "polledActuation": false, + "reportExtension": false, + "revision": "4501", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2537, + "avgLmbLatencyUs": 2537, + "make": "Logitech G", + "mode": "none", + "model": "703 Lightspeed (wired)", + "perClickLatency": false, + "pid": "c090", + "polledActuation": false, + "reportExtension": false, + "revision": "2202", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2516, + "avgLmbLatencyUs": 2516, + "make": "Logitech G", + "mode": "none", + "model": "903 Lightspeed (wired)", + "perClickLatency": false, + "pid": "c091", + "polledActuation": false, + "reportExtension": false, + "revision": "2301", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 808, + "avgLmbLatencyUs": 808, + "make": "Logitech G", + "mode": "none", + "model": "PRO X SUPERLIGHT (wired)", + "perClickLatency": true, + "pid": "c094", + "polledActuation": false, + "reportExtension": false, + "revision": "2500", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 831, + "avgLmbLatencyUs": 831, + "make": "Logitech", + "mode": "none", + "model": "G PRO X SUPERLIGHT", + "perClickLatency": true, + "pid": "c094", + "polledActuation": false, + "reportExtension": false, + "revision": "2501", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 834, + "avgLmbLatencyUs": 834, + "make": "Logitech", + "mode": "none", + "model": "G303 SHROUD EDITION", + "perClickLatency": true, + "pid": "c097", + "polledActuation": false, + "reportExtension": false, + "revision": "2900", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1169, + "avgLmbLatencyUs": 1169, + "make": "Logitech", + "mode": "none", + "model": "G303 SHROUD EDITION", + "perClickLatency": false, + "pid": "c547", + "polledActuation": false, + "reportExtension": false, + "revision": "0402", + "vid": "046d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 7237, + "avgLmbLatencyUs": 7658, + "make": "Zowie", + "mode": "none", + "model": "EC2-B Divina Edition, EC2-B, S2 Divina, EC2 Tyloo Edition, S1 Divina", + "perClickLatency": false, + "pid": "8001", + "polledActuation": false, + "reportExtension": false, + "revision": "0020", + "vid": "04a5" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 6132, + "avgLmbLatencyUs": 6595, + "make": "Finalmouse", + "mode": "none", + "model": "Ultralight Phantom, Air58 Ninja CBB, Ultralight 2 Cape Town, Ninja Air58 CBR", + "perClickLatency": false, + "pid": "ad50", + "polledActuation": false, + "reportExtension": false, + "revision": "0100", + "vid": "04d9" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 8380, + "avgLmbLatencyUs": 8380, + "make": "HyperX", + "mode": "none", + "model": "Pulsefire FPS", + "perClickLatency": false, + "pid": "16bc", + "polledActuation": false, + "reportExtension": false, + "revision": "0007", + "vid": "0951" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 5748, + "avgLmbLatencyUs": 5748, + "make": "HyperX", + "mode": "none", + "model": "PulseFire Haste", + "perClickLatency": true, + "pid": "1727", + "polledActuation": false, + "reportExtension": false, + "revision": "0110", + "vid": "0951" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1309, + "avgLmbLatencyUs": 1309, + "make": "ASUS", + "mode": "none", + "model": "ROG Chakram (wired)", + "perClickLatency": true, + "pid": "18e3", + "polledActuation": false, + "reportExtension": false, + "revision": "0131", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2115, + "avgLmbLatencyUs": 2115, + "make": "ASUS", + "mode": "none", + "model": "ROG Chakram (wired)", + "perClickLatency": false, + "pid": "18e3", + "polledActuation": false, + "reportExtension": false, + "revision": "0928", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2440, + "avgLmbLatencyUs": 2440, + "make": "ASUS", + "mode": "none", + "model": "ROG Chakram (wireless)", + "perClickLatency": false, + "pid": "18e5", + "polledActuation": false, + "reportExtension": true, + "revision": "0131", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2993, + "avgLmbLatencyUs": 2993, + "make": "ASUS", + "mode": "none", + "model": "ROG Chakram (wireless)", + "perClickLatency": false, + "pid": "18e5", + "polledActuation": false, + "reportExtension": true, + "revision": "0930", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 616, + "avgLmbLatencyUs": 616, + "make": "ASUS", + "mode": "none", + "model": "ROG Chakram Core", + "perClickLatency": true, + "pid": "1958", + "polledActuation": false, + "reportExtension": false, + "revision": "0108", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 659, + "avgLmbLatencyUs": 659, + "make": "ASUS", + "mode": "none", + "model": "ROG Keris", + "perClickLatency": true, + "pid": "195c", + "polledActuation": false, + "reportExtension": false, + "revision": "0108", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1250, + "avgLmbLatencyUs": 1250, + "make": "ASUS", + "mode": "none", + "model": "ROG Keris Wireless (wired)", + "perClickLatency": true, + "pid": "195e", + "polledActuation": false, + "reportExtension": false, + "revision": "0113", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2252, + "avgLmbLatencyUs": 2252, + "make": "ASUS", + "mode": "none", + "model": "ROG Keris Wireless", + "perClickLatency": false, + "pid": "1960", + "polledActuation": false, + "reportExtension": true, + "revision": "0203", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1409, + "avgLmbLatencyUs": 1409, + "make": "ASUS", + "mode": "none", + "model": "ROG Spatha X (Wired)", + "perClickLatency": true, + "pid": "1977", + "polledActuation": false, + "reportExtension": false, + "revision": "0117", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 9213, + "avgLmbLatencyUs": 9213, + "make": "ASUS", + "mode": "none", + "model": "ROG Spatha X (Wireless)", + "perClickLatency": false, + "pid": "1979", + "polledActuation": false, + "reportExtension": false, + "revision": "0119", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 626, + "avgLmbLatencyUs": 626, + "make": "ASUS", + "mode": "none", + "model": "ROG Gladius III ", + "perClickLatency": true, + "pid": "197b", + "polledActuation": false, + "reportExtension": false, + "revision": "0116", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1394, + "avgLmbLatencyUs": 1394, + "make": "ASUS", + "mode": "none", + "model": "ROG Gladius III Wireless (Wired)", + "perClickLatency": true, + "pid": "197d", + "polledActuation": false, + "reportExtension": false, + "revision": "0120", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 3194, + "avgLmbLatencyUs": 3194, + "make": "ASUS", + "mode": "none", + "model": "ROG Gladius III Wireless (Wireless)", + "perClickLatency": false, + "pid": "197f", + "polledActuation": false, + "reportExtension": false, + "revision": "0121", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 181, + "avgLmbLatencyUs": 181, + "make": "Asus", + "mode": "none", + "model": "ROG Chakram X", + "perClickLatency": true, + "pid": "1a18", + "polledActuation": false, + "reportExtension": false, + "revision": "0211", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 8482, + "avgLmbLatencyUs": 8482, + "make": "Asus", + "mode": "none", + "model": "ROG Chakram X", + "perClickLatency": false, + "pid": "1a1a", + "polledActuation": false, + "reportExtension": false, + "revision": "0110", + "vid": "0b05" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 18801, + "avgLmbLatencyUs": 18801, + "make": "MSI", + "mode": "none", + "model": "Clutch GM08", + "perClickLatency": false, + "pid": "0d08", + "polledActuation": false, + "reportExtension": false, + "revision": "0100", + "vid": "0db0" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1710, + "avgLmbLatencyUs": 1710, + "make": "MSI", + "mode": "none", + "model": "GM11", + "perClickLatency": false, + "pid": "0d11", + "polledActuation": false, + "reportExtension": false, + "revision": "0309", + "vid": "0db0" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 10781, + "avgLmbLatencyUs": 10781, + "make": "MSI", + "mode": "none", + "model": "Clutch GM20 Elite", + "perClickLatency": false, + "pid": "0d2e", + "polledActuation": false, + "reportExtension": false, + "revision": "0108", + "vid": "0db0" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 8416, + "avgLmbLatencyUs": 8416, + "make": "MSI", + "mode": "none", + "model": "Clutch GM30", + "perClickLatency": false, + "pid": "0d30", + "polledActuation": false, + "reportExtension": false, + "revision": "0210", + "vid": "0db0" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4348, + "avgLmbLatencyUs": 4348, + "make": "MSI", + "mode": "none", + "model": "GM41", + "perClickLatency": true, + "pid": "0d41", + "polledActuation": false, + "reportExtension": false, + "revision": "0210", + "vid": "0db0" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4191, + "avgLmbLatencyUs": 4191, + "make": "MSI", + "mode": "none", + "model": "Clutch GM41 Lightweight Wireless (wired)", + "perClickLatency": true, + "pid": "0d4b", + "polledActuation": false, + "reportExtension": false, + "revision": "0091", + "vid": "0db0" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4080, + "avgLmbLatencyUs": 4080, + "make": "MSI", + "mode": "none", + "model": "Clutch GM41 Lightweight Wireless (wired)", + "perClickLatency": true, + "pid": "0d4b", + "polledActuation": false, + "reportExtension": false, + "revision": "0092", + "vid": "0db0" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4354, + "avgLmbLatencyUs": 4354, + "make": "MSI", + "mode": "none", + "model": "Clutch GM41 Lightweight Wireless (wireless)", + "perClickLatency": true, + "pid": "0d4c", + "polledActuation": false, + "reportExtension": false, + "revision": "0091", + "vid": "0db0" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4533, + "avgLmbLatencyUs": 4533, + "make": "MSI", + "mode": "none", + "model": "Clutch GM41 Lightweight Wireless (wireless)", + "perClickLatency": true, + "pid": "0d4c", + "polledActuation": false, + "reportExtension": false, + "revision": "0092", + "vid": "0db0" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 13592, + "avgLmbLatencyUs": 13592, + "make": "MSI", + "mode": "none", + "model": "Clutch GM50", + "perClickLatency": false, + "pid": "0d50", + "polledActuation": false, + "reportExtension": false, + "revision": "0132", + "vid": "0db0" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 8790, + "avgLmbLatencyUs": 8790, + "make": "SteelSeries", + "mode": "none", + "model": "Rival 300", + "perClickLatency": false, + "pid": "1710", + "polledActuation": false, + "reportExtension": false, + "revision": "0024", + "vid": "1038" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 8542, + "avgLmbLatencyUs": 8542, + "make": "Steelseries", + "mode": "none", + "model": "Rival 600", + "perClickLatency": false, + "pid": "1724", + "polledActuation": false, + "reportExtension": false, + "revision": "0233", + "vid": "1038" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 5123, + "avgLmbLatencyUs": 5123, + "make": "SteelSeries", + "mode": "none", + "model": "Rival 3", + "perClickLatency": true, + "pid": "184c", + "polledActuation": false, + "reportExtension": false, + "revision": "0025", + "vid": "1038" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 3108, + "avgLmbLatencyUs": 3108, + "make": "SteelSeries", + "mode": "none", + "model": "Rival 3", + "perClickLatency": true, + "pid": "eeee", + "polledActuation": false, + "reportExtension": false, + "revision": "00ee", + "vid": "1038" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 0, + "avgLmbLatencyUs": 0, + "make": "NVIDIA LUT Version", + "mode": "none", + "model": "v1.0.6 4-26-2022", + "perClickLatency": true, + "pid": "0000", + "polledActuation": true, + "reportExtension": true, + "revision": "0000", + "vid": "10de" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 10150, + "avgLmbLatencyUs": 10150, + "make": "Razer", + "mode": "none", + "model": "Deathadder Elite", + "perClickLatency": false, + "pid": "005c", + "polledActuation": false, + "reportExtension": false, + "revision": "0200", + "vid": "1532" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 841, + "avgLmbLatencyUs": 841, + "make": "Razer", + "mode": "none", + "model": "Viper Ultimate (Wired)", + "perClickLatency": true, + "pid": "007a", + "polledActuation": false, + "reportExtension": false, + "revision": "0100", + "vid": "1532" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1400, + "avgLmbLatencyUs": 1400, + "make": "Razer", + "mode": "none", + "model": "Deathadder V2 Pro (wired)", + "perClickLatency": true, + "pid": "007c", + "polledActuation": false, + "reportExtension": false, + "revision": "0100", + "vid": "1532" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1587, + "avgLmbLatencyUs": 1587, + "make": "Razer", + "mode": "none", + "model": "Deathadder V2 Pro (wireless)", + "perClickLatency": false, + "pid": "007d", + "polledActuation": false, + "reportExtension": false, + "revision": "0100", + "vid": "1532" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2905, + "avgLmbLatencyUs": 2905, + "make": "Razer", + "mode": "none", + "model": "Viper Ultimate (Wireless)", + "perClickLatency": false, + "pid": "007e", + "polledActuation": false, + "reportExtension": false, + "revision": "0200", + "vid": "1532" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 710, + "avgLmbLatencyUs": 710, + "make": "Razer", + "mode": "none", + "model": "DeathAdder V2", + "perClickLatency": true, + "pid": "0084", + "polledActuation": false, + "reportExtension": false, + "revision": "0200", + "vid": "1532" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 926, + "avgLmbLatencyUs": 926, + "make": "Razer", + "mode": "none", + "model": "Basilisk Ultimate (Wired)", + "perClickLatency": true, + "pid": "0086", + "polledActuation": false, + "reportExtension": false, + "revision": "0100", + "vid": "1532" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2530, + "avgLmbLatencyUs": 2530, + "make": "Razer", + "mode": "none", + "model": "Basilisk Ultimate (Wireless)", + "perClickLatency": false, + "pid": "0088", + "polledActuation": false, + "reportExtension": false, + "revision": "0200", + "vid": "1532" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 844, + "avgLmbLatencyUs": 844, + "make": "Razer", + "mode": "none", + "model": "VIPER MINI", + "perClickLatency": false, + "pid": "008a", + "polledActuation": false, + "reportExtension": false, + "revision": "0200", + "vid": "1532" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 724, + "avgLmbLatencyUs": 724, + "make": "Razer", + "mode": "none", + "model": "NAGA X", + "perClickLatency": false, + "pid": "0096", + "polledActuation": false, + "reportExtension": false, + "revision": "0200", + "vid": "1532" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 10067, + "avgLmbLatencyUs": 10364, + "make": "Zowie", + "mode": "none", + "model": "EC1-A White, EC1-A, EC2-A, FK1, FK2 White, FK2, ZA12, EC1-B", + "perClickLatency": false, + "pid": "0001", + "polledActuation": false, + "reportExtension": false, + "revision": "0001", + "vid": "1af3" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1367, + "avgLmbLatencyUs": 1367, + "make": "CORSAIR", + "mode": "none", + "model": "M65 RGB ELITE", + "perClickLatency": true, + "pid": "1b5a", + "polledActuation": false, + "reportExtension": false, + "revision": "0341", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1368, + "avgLmbLatencyUs": 1368, + "make": "CORSAIR", + "mode": "none", + "model": "NIGHTSWORD RGB", + "perClickLatency": true, + "pid": "1b5c", + "polledActuation": false, + "reportExtension": false, + "revision": "0341", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 573, + "avgLmbLatencyUs": 573, + "make": "Corsair", + "mode": "none", + "model": "CHAMPION SERIES SABRE RGB PRO", + "perClickLatency": true, + "pid": "1b79", + "polledActuation": false, + "reportExtension": false, + "revision": "0109", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 609, + "avgLmbLatencyUs": 609, + "make": "Corsair", + "mode": "none", + "model": "CHAMPION SERIES SABRE PRO", + "perClickLatency": true, + "pid": "1b7a", + "polledActuation": false, + "reportExtension": false, + "revision": "0109", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 648, + "avgLmbLatencyUs": 648, + "make": "Corsair", + "mode": "none", + "model": "Dark Core RGB PRO SE (wired)", + "perClickLatency": true, + "pid": "1b7e", + "polledActuation": false, + "reportExtension": false, + "revision": "0207", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 715, + "avgLmbLatencyUs": 715, + "make": "Corsair", + "mode": "none", + "model": "Dark Core RGB PRO SE (wired)", + "perClickLatency": true, + "pid": "1b7e", + "polledActuation": false, + "reportExtension": false, + "revision": "0500", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1220, + "avgLmbLatencyUs": 1220, + "make": "Corsair", + "mode": "none", + "model": "Dark Core RGB PRO SE (wireless)", + "perClickLatency": true, + "pid": "1b7f", + "polledActuation": false, + "reportExtension": false, + "revision": "0204", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1186, + "avgLmbLatencyUs": 1186, + "make": "Corsair", + "mode": "none", + "model": "Dark Core RGB PRO SE (wireless)", + "perClickLatency": true, + "pid": "1b7f", + "polledActuation": false, + "reportExtension": false, + "revision": "0500", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 648, + "avgLmbLatencyUs": 648, + "make": "Corsair", + "mode": "none", + "model": "Dark Core RGB Pro (wired)", + "perClickLatency": true, + "pid": "1b80", + "polledActuation": false, + "reportExtension": false, + "revision": "0207", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 713, + "avgLmbLatencyUs": 713, + "make": "Corsair", + "mode": "none", + "model": "Dark Core RGB Pro (wired)", + "perClickLatency": true, + "pid": "1b80", + "polledActuation": false, + "reportExtension": false, + "revision": "0500", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1202, + "avgLmbLatencyUs": 1202, + "make": "Corsair", + "mode": "none", + "model": "Dark Core RGB Pro (wireless)", + "perClickLatency": true, + "pid": "1b81", + "polledActuation": false, + "reportExtension": false, + "revision": "0204", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1169, + "avgLmbLatencyUs": 1169, + "make": "Corsair", + "mode": "none", + "model": "Dark Core RGB Pro (wireless)", + "perClickLatency": true, + "pid": "1b81", + "polledActuation": false, + "reportExtension": false, + "revision": "0500", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1394, + "avgLmbLatencyUs": 1394, + "make": "Corsair", + "mode": "none", + "model": "KATAR PRO Wireless", + "perClickLatency": true, + "pid": "1b94", + "polledActuation": false, + "reportExtension": false, + "revision": "0201", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 887, + "avgLmbLatencyUs": 887, + "make": "Corsair", + "mode": "none", + "model": "KATAR PRO XT", + "perClickLatency": true, + "pid": "1bac", + "polledActuation": false, + "reportExtension": false, + "revision": "0105", + "vid": "1b1c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1273, + "avgLmbLatencyUs": 1273, + "make": "ROCCAT", + "mode": "none", + "model": "Kone Pro", + "perClickLatency": true, + "pid": "2c88", + "polledActuation": false, + "reportExtension": false, + "revision": "0117", + "vid": "1e7d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1398, + "avgLmbLatencyUs": 1398, + "make": "ROCCAT", + "mode": "none", + "model": "Kone XP", + "perClickLatency": true, + "pid": "2c8b", + "polledActuation": false, + "reportExtension": false, + "revision": "0108", + "vid": "1e7d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2895, + "avgLmbLatencyUs": 2895, + "make": "ROCCAT", + "mode": "none", + "model": "Kone Pro Air (Wireless)", + "perClickLatency": false, + "pid": "2c8e", + "polledActuation": false, + "reportExtension": false, + "revision": "0417", + "vid": "1e7d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1231, + "avgLmbLatencyUs": 1231, + "make": "ROCCAT", + "mode": "none", + "model": "Kone Pro Air (Wired)", + "perClickLatency": true, + "pid": "2c92", + "polledActuation": false, + "reportExtension": false, + "revision": "0430", + "vid": "1e7d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 5821, + "avgLmbLatencyUs": 5821, + "make": "Roccat", + "mode": "none", + "model": "Burst Pro Air", + "perClickLatency": true, + "pid": "2cab", + "polledActuation": false, + "reportExtension": false, + "revision": "0043", + "vid": "1e7d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1446, + "avgLmbLatencyUs": 1446, + "make": "ROCCAT", + "mode": "none", + "model": "Burst Pro", + "perClickLatency": true, + "pid": "2de1", + "polledActuation": false, + "reportExtension": false, + "revision": "0111", + "vid": "1e7d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1295, + "avgLmbLatencyUs": 1295, + "make": "Roccat", + "mode": "none", + "model": "Kone XP", + "perClickLatency": true, + "pid": "2de6", + "polledActuation": false, + "reportExtension": false, + "revision": "0101", + "vid": "1e7d" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 13461, + "avgLmbLatencyUs": 13461, + "make": "Glorious", + "mode": "none", + "model": "Model O", + "perClickLatency": false, + "pid": "0036", + "polledActuation": false, + "reportExtension": false, + "revision": "0100", + "vid": "258a" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4802, + "avgLmbLatencyUs": 4802, + "make": "AOC", + "mode": "none", + "model": "GM510", + "perClickLatency": true, + "pid": "006d", + "polledActuation": false, + "reportExtension": false, + "revision": "0114", + "vid": "258a" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 5267, + "avgLmbLatencyUs": 5267, + "make": "AOC", + "mode": "none", + "model": "GM510", + "perClickLatency": true, + "pid": "006d", + "polledActuation": false, + "reportExtension": false, + "revision": "0115", + "vid": "258a" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4606, + "avgLmbLatencyUs": 4606, + "make": "AOC", + "mode": "none", + "model": "AGM 600", + "perClickLatency": true, + "pid": "0081", + "polledActuation": false, + "reportExtension": false, + "revision": "0000", + "vid": "258a" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 7623, + "avgLmbLatencyUs": 7623, + "make": "Zowie", + "mode": "none", + "model": "ZA13", + "perClickLatency": false, + "pid": "0001", + "polledActuation": false, + "reportExtension": false, + "revision": "0002", + "vid": "3057" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 655, + "avgLmbLatencyUs": 655, + "make": "EVGA", + "mode": "none", + "model": "X17", + "perClickLatency": true, + "pid": "240d", + "polledActuation": false, + "reportExtension": false, + "revision": "a168", + "vid": "3842" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 685, + "avgLmbLatencyUs": 685, + "make": "EVGA", + "mode": "none", + "model": "X15", + "perClickLatency": true, + "pid": "2415", + "polledActuation": false, + "reportExtension": false, + "revision": "a124", + "vid": "3842" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2305, + "avgLmbLatencyUs": 2305, + "make": "EVGA", + "mode": "none", + "model": "X12", + "perClickLatency": true, + "pid": "2422", + "polledActuation": false, + "reportExtension": false, + "revision": "a177", + "vid": "3842" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 16580, + "avgLmbLatencyUs": 16580, + "make": "Acer", + "mode": "none", + "model": "Predator Cestus 350 (wired)", + "perClickLatency": true, + "pid": "1172", + "polledActuation": false, + "reportExtension": false, + "revision": "0121", + "vid": "3938" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1576, + "avgLmbLatencyUs": 1576, + "make": "Acer", + "mode": "none", + "model": "Predator Cestus 350 (wired)", + "perClickLatency": true, + "pid": "1172", + "polledActuation": false, + "reportExtension": false, + "revision": "0122", + "vid": "3938" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 16560, + "avgLmbLatencyUs": 16560, + "make": "Acer", + "mode": "none", + "model": "AOPEN Fire Legend GM310", + "perClickLatency": true, + "pid": "1176", + "polledActuation": false, + "reportExtension": false, + "revision": "0104", + "vid": "3938" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 5241, + "avgLmbLatencyUs": 5241, + "make": "AOC", + "mode": "none", + "model": "GM500", + "perClickLatency": true, + "pid": "1179", + "polledActuation": false, + "reportExtension": false, + "revision": "0202", + "vid": "3938" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 16916, + "avgLmbLatencyUs": 16916, + "make": "Acer", + "mode": "none", + "model": "Predator Cestus 330", + "perClickLatency": true, + "pid": "1184", + "polledActuation": false, + "reportExtension": false, + "revision": "0101", + "vid": "3938" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 1576, + "avgLmbLatencyUs": 1576, + "make": "Acer", + "mode": "none", + "model": "Predator Cestus 330", + "perClickLatency": true, + "pid": "1184", + "polledActuation": false, + "reportExtension": false, + "revision": "0109", + "vid": "3938" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 17589, + "avgLmbLatencyUs": 17589, + "make": "Acer", + "mode": "none", + "model": "Predator Cestus 350", + "perClickLatency": false, + "pid": "1218", + "polledActuation": false, + "reportExtension": false, + "revision": "0107", + "vid": "3938" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 2001, + "avgLmbLatencyUs": 2001, + "make": "Alienware", + "mode": "none", + "model": "720M", + "perClickLatency": true, + "pid": "3028", + "polledActuation": false, + "reportExtension": false, + "revision": "0219", + "vid": "413c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4265, + "avgLmbLatencyUs": 4265, + "make": "Alienware", + "mode": "none", + "model": "720M", + "perClickLatency": true, + "pid": "3029", + "polledActuation": false, + "reportExtension": false, + "revision": "0209", + "vid": "413c" + }, + { + "actuationDetectionDurationUs": 0, + "adjustedAvgLmbLatencyUs": 4881, + "avgLmbLatencyUs": 4881, + "make": "Alienware", + "mode": "none", + "model": "AW320M", + "perClickLatency": true, + "pid": "302a", + "polledActuation": false, + "reportExtension": false, + "revision": "0031", + "vid": "413c" + } + ], + "signature": [ + 116, + 199, + 223, + 205, + 23, + 140, + 185, + 27, + 56, + 15, + 215, + 3, + 29, + 227, + 183, + 128, + 143, + 112, + 246, + 113, + 38, + 201, + 172, + 110, + 13, + 55, + 98, + 241, + 233, + 116, + 133, + 74, + 189, + 189, + 207, + 250, + 108, + 34, + 56, + 116, + 254, + 0, + 156, + 51, + 51, + 221, + 48, + 173, + 5, + 98, + 132, + 97, + 255, + 220, + 91, + 40, + 57, + 36, + 199, + 177, + 90, + 125, + 82, + 221, + 2, + 174, + 19, + 237, + 214, + 133, + 102, + 217, + 216, + 152, + 114, + 185, + 170, + 79, + 222, + 15, + 219, + 72, + 144, + 166, + 227, + 23, + 187, + 200, + 191, + 240, + 195, + 197, + 110, + 115, + 151, + 105, + 185, + 87, + 52, + 146, + 130, + 241, + 100, + 74, + 232, + 105, + 200, + 221, + 247, + 190, + 178, + 192, + 189, + 238, + 192, + 179, + 93, + 140, + 78, + 231, + 154, + 128, + 221, + 64, + 166, + 242, + 134, + 173, + 33, + 39, + 49, + 131, + 70, + 211, + 141, + 164, + 57, + 249, + 64, + 182, + 252, + 46, + 239, + 191, + 148, + 139, + 44, + 49, + 7, + 31, + 189, + 78, + 44, + 236, + 107, + 168, + 163, + 115, + 17, + 54, + 165, + 158, + 132, + 146, + 127, + 0, + 197, + 111, + 75, + 114, + 165, + 237, + 121, + 222, + 178, + 81, + 114, + 136, + 200, + 204, + 51, + 36, + 169, + 181, + 13, + 238, + 234, + 142, + 226, + 146, + 26, + 163, + 103, + 174, + 36, + 214, + 135, + 41, + 68, + 122, + 196, + 241, + 86, + 223, + 212, + 104, + 164, + 133, + 167, + 236, + 197, + 0, + 236, + 103, + 0, + 11, + 128, + 127, + 190, + 215, + 189, + 254, + 248, + 240, + 93, + 140, + 196, + 2, + 34, + 34, + 104, + 12, + 232, + 181, + 163, + 47, + 178, + 60, + 231, + 232, + 66, + 50, + 239, + 24, + 16, + 32, + 242, + 247, + 33, + 16, + 198, + 12, + 169, + 199, + 52, + 29 + ] +} diff --git a/cuda_toolkit/bin/nvcc.profile b/cuda_toolkit/bin/nvcc.profile new file mode 100644 index 0000000000000000000000000000000000000000..d6ac58d6e024d8d9b4716beb898fc9e3024a81c5 --- /dev/null +++ b/cuda_toolkit/bin/nvcc.profile @@ -0,0 +1,13 @@ + +TOP = $(_HERE_)/.. + +NVVMIR_LIBRARY_DIR = $(TOP)/$(_NVVM_BRANCH_)/libdevice + +PATH += $(TOP)/$(_NVVM_BRANCH_)/bin;$(_HERE_);$(TOP)/lib; + +INCLUDES += "-I$(TOP)/include" $(_SPACE_) + +LIBRARIES =+ $(_SPACE_) "/LIBPATH:$(TOP)/lib/$(_WIN_PLATFORM_)" + +CUDAFE_FLAGS += +PTXAS_FLAGS += diff --git a/cuda_toolkit/bin/nvvp.bat b/cuda_toolkit/bin/nvvp.bat new file mode 100644 index 0000000000000000000000000000000000000000..b8210d50cbe9076da29be6430b8024a5ef2c80bf --- /dev/null +++ b/cuda_toolkit/bin/nvvp.bat @@ -0,0 +1,5 @@ +@echo off +setlocal + setx PATH "%~dp0\..\extras\CUPTI\lib64;%PATH%" + start "" "%~dp0\..\libnvvp\nvvp.exe" %* +endlocal diff --git a/cuda_toolkit/bin/runant.pl b/cuda_toolkit/bin/runant.pl new file mode 100644 index 0000000000000000000000000000000000000000..5f8307ac33ccfac00b9086a8a7e04010ad91e9b8 --- /dev/null +++ b/cuda_toolkit/bin/runant.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +####################################################################### +# +# runant.pl +# +# wrapper script for invoking ant in a platform with Perl installed +# this may include cgi-bin invocation, which is considered somewhat daft. +# (slo: that should be a separate file which can be derived from this +# and returns the XML formatted output) +# +# the code is not totally portable due to classpath and directory splitting +# issues. oops. (NB, use File::Spec::Functions will help and the code is +# structured for the catfile() call, but because of perl version funnies +# the code is not included. +# +# created: 2000-8-24 +# author: Steve Loughran steve_l@sourceforge.net +####################################################################### +# +# Assumptions: +# +# - the "java" executable/script is on the command path +# - ANT_HOME has been set +# - target platform uses ":" as classpath separator or perl indicates it is dos/win32 +# - target platform uses "/" as directory separator. + +#be fussy about variables +use strict; + +#platform specifics (disabled) +#use File::Spec::Functions; + +#turn warnings on during dev; generates a few spurious uninitialised var access warnings +#use warnings; + +#and set $debug to 1 to turn on trace info +my $debug=1; + +####################################################################### +# +# check to make sure environment is setup +# + +my $HOME = $ENV{ANT_HOME}; +if ($HOME eq "") + { + die "\n\nANT_HOME *MUST* be set!\n\n"; + } + +my $JAVACMD = $ENV{JAVACMD}; +$JAVACMD = "java" if $JAVACMD eq ""; + +my $onnetware = 0; +if ($^O eq "NetWare") +{ + $onnetware = 1; +} + +my $oncygwin = ($^O eq "cygwin"); + +#ISSUE: what java wants to split up classpath varies from platform to platform +#and perl is not too hot at hinting which box it is on. +#here I assume ":" 'cept on win32, dos, and netware. Add extra tests here as needed. +my $s=":"; +if(($^O eq "MSWin32") || ($^O eq "dos") || ($^O eq "cygwin") || + ($onnetware == 1)) + { + $s=";"; + } + +#build up standard classpath +my $localpath = "$HOME/lib/ant-launcher.jar"; +#set JVM options and Ant arguments, if any +my @ANT_OPTS=split(" ", $ENV{ANT_OPTS}); +my @ANT_ARGS=split(" ", $ENV{ANT_ARGS}); + +#jikes +if($ENV{JIKESPATH} ne "") + { + push @ANT_OPTS, "-Djikes.class.path=$ENV{JIKESPATH}"; + } + +#construct arguments to java +my @ARGS; +push @ARGS, @ANT_OPTS; + +my $CYGHOME = ""; + +my $classpath=$ENV{CLASSPATH}; +if ($oncygwin == 1) { + $localpath = `cygpath --path --windows $localpath`; + chomp ($localpath); + if (! $classpath eq "") + { + $classpath = `cygpath --path --windows "$classpath"`; + chomp ($classpath); + } + $HOME = `cygpath --path --windows $HOME`; + chomp ($HOME); + $CYGHOME = `cygpath --path --windows $ENV{HOME}`; + chomp ($CYGHOME); +} +push @ARGS, "-classpath", "$localpath"; +push @ARGS, "-Dant.home=$HOME"; +if ( ! $CYGHOME eq "" ) +{ + push @ARGS, "-Dcygwin.user.home=\"$CYGHOME\"" +} +push @ARGS, "org.apache.tools.ant.launch.Launcher", @ANT_ARGS; +push @ARGS, @ARGV; +if (! $classpath eq "") +{ + if ($onnetware == 1) + { + # make classpath literally $CLASSPATH + # this is to avoid pushing us over the 512 character limit + # even skip the ; - that is already in $localpath + push @ARGS, "-lib", "\$CLASSPATH"; + } + else + { + push @ARGS, "-lib", "$classpath"; + } +} +print "\n $JAVACMD @ARGS\n\n" if ($debug); + +my $returnValue = system $JAVACMD, @ARGS; +if ($returnValue eq 0) + { + exit 0; + } +else + { + # only 0 and 1 are widely recognized as exit values + # so change the exit value to 1 + exit 1; + } diff --git a/cuda_toolkit/bin/runant.py b/cuda_toolkit/bin/runant.py new file mode 100644 index 0000000000000000000000000000000000000000..9488a93127b8624462e3d611db1b9099de704654 --- /dev/null +++ b/cuda_toolkit/bin/runant.py @@ -0,0 +1,102 @@ +#!/usr/bin/python +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +""" + + runant.py + + This script is a translation of the runant.pl written by Steve Loughran. + It runs ant with/out arguments, it should be quite portable (thanks to + the python os library) + This script has been tested with Python2.0/Win2K + + created: 2001-04-11 + author: Pierre Dittgen pierre.dittgen@criltelecom.com + + Assumptions: + + - the "java" executable/script is on the command path +""" +import os, os.path, string, sys + +# Change it to 1 to get extra debug information +debug = 0 + +####################################################################### + +# If ANT_HOME is not set default to script's parent directory +if os.environ.has_key('ANT_HOME'): + ANT_HOME = os.environ['ANT_HOME'] +else: + ANT_HOME = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))) + +# set ANT_LIB location +ANT_LIB = os.path.join(ANT_HOME, 'lib') + +# set JAVACMD (check variables JAVACMD and JAVA_HOME) +JAVACMD = None +if not os.environ.has_key('JAVACMD'): + if os.environ.has_key('JAVA_HOME'): + if not os.path.exists(os.environ['JAVA_HOME']): + print "Warning: JAVA_HOME is not defined correctly." + else: + JAVACMD = os.path.join(os.environ['JAVA_HOME'], 'bin', 'java') + else: + print "Warning: JAVA_HOME not set." +else: + JAVACMD = os.environ['JAVACMD'] +if not JAVACMD: + JAVACMD = 'java' + +launcher_jar = os.path.join(ANT_LIB, 'ant-launcher.jar') +if not os.path.exists(launcher_jar): + print 'Warning: Unable to locate ant-launcher.jar. Expected to find it in %s' % \ + ANT_LIB + +# Build up standard classpath (LOCALCLASSPATH) +LOCALCLASSPATH = launcher_jar +if os.environ.has_key('LOCALCLASSPATH'): + LOCALCLASSPATH += os.pathsep + os.environ['LOCALCLASSPATH'] + +ANT_OPTS = "" +if os.environ.has_key('ANT_OPTS'): + ANT_OPTS = os.environ['ANT_OPTS'] + +OPTS = "" +if os.environ.has_key('JIKESPATH'): + OPTS = '-Djikes.class.path=\"%s\"' % os.environ['JIKESPATH'] + +ANT_ARGS = "" +if os.environ.has_key('ANT_ARGS'): + ANT_ARGS = os.environ['ANT_ARGS'] + +CLASSPATH = "" +if os.environ.has_key('CLASSPATH'): + CLASSPATH = "-lib " + os.environ['CLASSPATH'] + +# Builds the commandline +cmdline = ('%s %s -classpath %s -Dant.home=%s %s ' + \ + 'org.apache.tools.ant.launch.Launcher %s %s %s') \ + % (JAVACMD, ANT_OPTS, LOCALCLASSPATH, ANT_HOME, OPTS, ANT_ARGS, \ + CLASSPATH, string.join(sys.argv[1:], ' ')) + +if debug: + print '\n%s\n\n' % (cmdline) +sys.stdout.flush() + +# Run the biniou! +os.system(cmdline) diff --git a/cuda_toolkit/bin/runrc.cmd b/cuda_toolkit/bin/runrc.cmd new file mode 100644 index 0000000000000000000000000000000000000000..34b4f5d59e5023fbb34c99a6cebc9ff00cc3c772 --- /dev/null +++ b/cuda_toolkit/bin/runrc.cmd @@ -0,0 +1,60 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Run RC file, name is in the first arg, second arg is either PATH + ENV or -r or nothing +*/ + +parse arg name path rest + +if name = '' then do + say 'RC file name is missing' + exit 1 +end + +if rest \= '' then do + say 'Too many parameters' + exit 1 +end + +call runit name path +exit 0 + +runit: procedure +parse arg name path dir + +if path \= '' & path \= '-r' then do + dir = value(translate(path),,'OS2ENVIRONMENT') + if dir = '' then return + dir = translate(dir, '\', '/') /* change UNIX-like path to OS/2 */ +end + +if dir = '' then dir = directory() + +if path = '-r' then do /* recursive call */ + subdir = filespec('path', dir) + if subdir \= '\' then do + subdir = left(subdir, length(subdir)-1) + call runit name path filespec('drive', dir) || subdir + end +end + +/* Look for the file and run it */ +if right(dir, 1) \= '\' then dir = dir || '\' +rcfile = stream(dir || name, 'c', 'query exists') +if rcfile \= '' then interpret 'call "' || rcfile || '"' + +return diff --git a/cuda_toolkit/compute-sanitizer/LICENSE b/cuda_toolkit/compute-sanitizer/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..6622367aff6567f25c18f500137a36caf101ea50 --- /dev/null +++ b/cuda_toolkit/compute-sanitizer/LICENSE @@ -0,0 +1,1632 @@ +End User License Agreement +-------------------------- + +NVIDIA Software License Agreement and CUDA Supplement to +Software License Agreement. + +The CUDA Toolkit End User License Agreement applies to the +NVIDIA CUDA Toolkit, the NVIDIA CUDA Samples, the NVIDIA +Display Driver, NVIDIA Nsight tools (Visual Studio Edition), +and the associated documentation on CUDA APIs, programming +model and development tools. If you do not agree with the +terms and conditions of the license agreement, then do not +download or use the software. + +Last updated: January 12, 2024. + + +Preface +------- + +The Software License Agreement in Chapter 1 and the Supplement +in Chapter 2 contain license terms and conditions that govern +the use of NVIDIA toolkit. By accepting this agreement, you +agree to comply with all the terms and conditions applicable +to the product(s) included herein. + + +NVIDIA Driver + + +Description + +This package contains the operating system driver and +fundamental system software components for NVIDIA GPUs. + + +NVIDIA CUDA Toolkit + + +Description + +The NVIDIA CUDA Toolkit provides command-line and graphical +tools for building, debugging and optimizing the performance +of applications accelerated by NVIDIA GPUs, runtime and math +libraries, and documentation including programming guides, +user manuals, and API references. + + +Default Install Location of CUDA Toolkit + +Windows platform: + +%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v#.# + +Linux platform: + +/usr/local/cuda-#.# + +Mac platform: + +/Developer/NVIDIA/CUDA-#.# + + +NVIDIA CUDA Samples + + +Description + +CUDA Samples are now located in +https://github.com/nvidia/cuda-samples, which includes +instructions for obtaining, building, and running the samples. +They are no longer included in the CUDA toolkit. + + +NVIDIA Nsight Visual Studio Edition (Windows only) + + +Description + +NVIDIA Nsight Development Platform, Visual Studio Edition is a +development environment integrated into Microsoft Visual +Studio that provides tools for debugging, profiling, analyzing +and optimizing your GPU computing and graphics applications. + + +Default Install Location of Nsight Visual Studio Edition + +Windows platform: + +%ProgramFiles(x86)%\NVIDIA Corporation\Nsight Visual Studio Edition #.# + + +1. License Agreement for NVIDIA Software Development Kits +--------------------------------------------------------- + + +Important Notice—Read before downloading, installing, +copying or using the licensed software: +------------------------------------------------------- + +This license agreement, including exhibits attached +("Agreementâ€) is a legal agreement between you and NVIDIA +Corporation ("NVIDIA") and governs your use of a NVIDIA +software development kit (“SDKâ€). + +Each SDK has its own set of software and materials, but here +is a description of the types of items that may be included in +a SDK: source code, header files, APIs, data sets and assets +(examples include images, textures, models, scenes, videos, +native API input/output files), binary software, sample code, +libraries, utility programs, programming code and +documentation. + +This Agreement can be accepted only by an adult of legal age +of majority in the country in which the SDK is used. + +If you are entering into this Agreement on behalf of a company +or other legal entity, you represent that you have the legal +authority to bind the entity to this Agreement, in which case +“you†will mean the entity you represent. + +If you don’t have the required age or authority to accept +this Agreement, or if you don’t accept all the terms and +conditions of this Agreement, do not download, install or use +the SDK. + +You agree to use the SDK only for purposes that are permitted +by (a) this Agreement, and (b) any applicable law, regulation +or generally accepted practices or guidelines in the relevant +jurisdictions. + + +1.1. License + + +1.1.1. License Grant + +Subject to the terms of this Agreement, NVIDIA hereby grants +you a non-exclusive, non-transferable license, without the +right to sublicense (except as expressly provided in this +Agreement) to: + + 1. Install and use the SDK, + + 2. Modify and create derivative works of sample source code + delivered in the SDK, and + + 3. Distribute those portions of the SDK that are identified + in this Agreement as distributable, as incorporated in + object code format into a software application that meets + the distribution requirements indicated in this Agreement. + + +1.1.2. Distribution Requirements + +These are the distribution requirements for you to exercise +the distribution grant: + + 1. Your application must have material additional + functionality, beyond the included portions of the SDK. + + 2. The distributable portions of the SDK shall only be + accessed by your application. + + 3. The following notice shall be included in modifications + and derivative works of sample source code distributed: + “This software contains source code provided by NVIDIA + Corporation.†+ + 4. Unless a developer tool is identified in this Agreement + as distributable, it is delivered for your internal use + only. + + 5. The terms under which you distribute your application + must be consistent with the terms of this Agreement, + including (without limitation) terms relating to the + license grant and license restrictions and protection of + NVIDIA’s intellectual property rights. Additionally, you + agree that you will protect the privacy, security and + legal rights of your application users. + + 6. You agree to notify NVIDIA in writing of any known or + suspected distribution or use of the SDK not in compliance + with the requirements of this Agreement, and to enforce + the terms of your agreements with respect to distributed + SDK. + + +1.1.3. Authorized Users + +You may allow employees and contractors of your entity or of +your subsidiary(ies) to access and use the SDK from your +secure network to perform work on your behalf. + +If you are an academic institution you may allow users +enrolled or employed by the academic institution to access and +use the SDK from your secure network. + +You are responsible for the compliance with the terms of this +Agreement by your authorized users. If you become aware that +your authorized users didn’t follow the terms of this +Agreement, you agree to take reasonable steps to resolve the +non-compliance and prevent new occurrences. + + +1.1.4. Pre-Release SDK + +The SDK versions identified as alpha, beta, preview or +otherwise as pre-release, may not be fully functional, may +contain errors or design flaws, and may have reduced or +different security, privacy, accessibility, availability, and +reliability standards relative to commercial versions of +NVIDIA software and materials. Use of a pre-release SDK may +result in unexpected results, loss of data, project delays or +other unpredictable damage or loss. + +You may use a pre-release SDK at your own risk, understanding +that pre-release SDKs are not intended for use in production +or business-critical systems. + +NVIDIA may choose not to make available a commercial version +of any pre-release SDK. NVIDIA may also choose to abandon +development and terminate the availability of a pre-release +SDK at any time without liability. + + +1.1.5. Updates + +NVIDIA may, at its option, make available patches, workarounds +or other updates to this SDK. Unless the updates are provided +with their separate governing terms, they are deemed part of +the SDK licensed to you as provided in this Agreement. You +agree that the form and content of the SDK that NVIDIA +provides may change without prior notice to you. While NVIDIA +generally maintains compatibility between versions, NVIDIA may +in some cases make changes that introduce incompatibilities in +future versions of the SDK. + + +1.1.6. Components Under Other Licenses + +The SDK may come bundled with, or otherwise include or be +distributed with, NVIDIA or third-party components with +separate legal notices or terms as may be described in +proprietary notices accompanying the SDK. If and to the extent +there is a conflict between the terms in this Agreement and +the license terms associated with the component, the license +terms associated with the components control only to the +extent necessary to resolve the conflict. + +Subject to the other terms of this Agreement, you may use the +SDK to develop and test applications released under Open +Source Initiative (OSI) approved open source software +licenses. + + +1.1.7. Reservation of Rights + +NVIDIA reserves all rights, title, and interest in and to the +SDK, not expressly granted to you under this Agreement. + + +1.2. Limitations + +The following license limitations apply to your use of the +SDK: + + 1. You may not reverse engineer, decompile or disassemble, + or remove copyright or other proprietary notices from any + portion of the SDK or copies of the SDK. + + 2. Except as expressly provided in this Agreement, you may + not copy, sell, rent, sublicense, transfer, distribute, + modify, or create derivative works of any portion of the + SDK. For clarity, you may not distribute or sublicense the + SDK as a stand-alone product. + + 3. Unless you have an agreement with NVIDIA for this + purpose, you may not indicate that an application created + with the SDK is sponsored or endorsed by NVIDIA. + + 4. You may not bypass, disable, or circumvent any + encryption, security, digital rights management or + authentication mechanism in the SDK. + + 5. You may not use the SDK in any manner that would cause it + to become subject to an open source software license. As + examples, licenses that require as a condition of use, + modification, and/or distribution that the SDK be: + + a. Disclosed or distributed in source code form; + + b. Licensed for the purpose of making derivative works; + or + + c. Redistributable at no charge. + + 6. You acknowledge that the SDK as delivered is not tested + or certified by NVIDIA for use in connection with the + design, construction, maintenance, and/or operation of any + system where the use or failure of such system could + result in a situation that threatens the safety of human + life or results in catastrophic damages (each, a "Critical + Application"). Examples of Critical Applications include + use in avionics, navigation, autonomous vehicle + applications, ai solutions for automotive products, + military, medical, life support or other life critical + applications. NVIDIA shall not be liable to you or any + third party, in whole or in part, for any claims or + damages arising from such uses. You are solely responsible + for ensuring that any product or service developed with + the SDK as a whole includes sufficient features to comply + with all applicable legal and regulatory standards and + requirements. + + 7. You agree to defend, indemnify and hold harmless NVIDIA + and its affiliates, and their respective employees, + contractors, agents, officers and directors, from and + against any and all claims, damages, obligations, losses, + liabilities, costs or debt, fines, restitutions and + expenses (including but not limited to attorney’s fees + and costs incident to establishing the right of + indemnification) arising out of or related to products or + services that use the SDK in or for Critical Applications, + and for use of the SDK outside of the scope of this + Agreement or not in compliance with its terms. + + 8. You may not reverse engineer, decompile or disassemble + any portion of the output generated using SDK elements for + the purpose of translating such output artifacts to target + a non-NVIDIA platform. + + +1.3. Ownership + + 1. NVIDIA or its licensors hold all rights, title and + interest in and to the SDK and its modifications and + derivative works, including their respective intellectual + property rights, subject to your rights under Section + 1.3.2. This SDK may include software and materials from + NVIDIA’s licensors, and these licensors are intended + third party beneficiaries that may enforce this Agreement + with respect to their intellectual property rights. + + 2. You hold all rights, title and interest in and to your + applications and your derivative works of the sample + source code delivered in the SDK, including their + respective intellectual property rights, subject to + NVIDIA’s rights under Section 1.3.1. + + 3. You may, but don’t have to, provide to NVIDIA + suggestions, feature requests or other feedback regarding + the SDK, including possible enhancements or modifications + to the SDK. For any feedback that you voluntarily provide, + you hereby grant NVIDIA and its affiliates a perpetual, + non-exclusive, worldwide, irrevocable license to use, + reproduce, modify, license, sublicense (through multiple + tiers of sublicensees), and distribute (through multiple + tiers of distributors) it without the payment of any + royalties or fees to you. NVIDIA will use feedback at its + choice. NVIDIA is constantly looking for ways to improve + its products, so you may send feedback to NVIDIA through + the developer portal at https://developer.nvidia.com. + + +1.4. No Warranties + +THE SDK IS PROVIDED BY NVIDIA “AS IS†AND “WITH ALL +FAULTS.†TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND +ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND +OR NATURE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, +BUT NOT LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, OR THE +ABSENCE OF ANY DEFECTS THEREIN, WHETHER LATENT OR PATENT. NO +WARRANTY IS MADE ON THE BASIS OF TRADE USAGE, COURSE OF +DEALING OR COURSE OF TRADE. + + +1.5. Limitation of Liability + +TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS +AFFILIATES SHALL NOT BE LIABLE FOR ANY (I) SPECIAL, INCIDENTAL, +PUNITIVE OR CONSEQUENTIAL DAMAGES, OR (II) DAMAGES FOR (A) ANY +LOST PROFITS, LOSS OF USE, LOSS OF DATA OR LOSS OF GOODWILL, +OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF +OR IN CONNECTION WITH THIS AGREEMENT OR THE USE OR PERFORMANCE +OF THE SDK, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED +UPON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING +NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR +THEORY OF LIABILITY. IN NO EVENT WILL NVIDIA’S AND ITS AFFILIATES +TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THIS +AGREEMENT EXCEED US$10.00. THE NATURE OF THE LIABILITY OR THE +NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR EXTEND THIS +LIMIT. + +These exclusions and limitations of liability shall apply +regardless if NVIDIA or its affiliates have been advised of +the possibility of such damages, and regardless of whether a +remedy fails its essential purpose. These exclusions and +limitations of liability form an essential basis of the +bargain between the parties, and, absent any of these +exclusions or limitations of liability, the provisions of this +Agreement, including, without limitation, the economic terms, +would be substantially different. + + +1.6. Termination + + 1. This Agreement will continue to apply until terminated by + either you or NVIDIA as described below. + + 2. If you want to terminate this Agreement, you may do so by + stopping to use the SDK. + + 3. NVIDIA may, at any time, terminate this Agreement if: + + a. (i) you fail to comply with any term of this + Agreement and the non-compliance is not fixed within + thirty (30) days following notice from NVIDIA (or + immediately if you violate NVIDIA’s intellectual + property rights); + + b. (ii) you commence or participate in any legal + proceeding against NVIDIA with respect to the SDK; or + + c. (iii) NVIDIA decides to no longer provide the SDK in + a country or, in NVIDIA’s sole discretion, the + continued use of it is no longer commercially viable. + + 4. Upon any termination of this Agreement, you agree to + promptly discontinue use of the SDK and destroy all copies + in your possession or control. Your prior distributions in + accordance with this Agreement are not affected by the + termination of this Agreement. Upon written request, you + will certify in writing that you have complied with your + commitments under this section. Upon any termination of + this Agreement all provisions survive except for the + license grant provisions. + + +1.7. General + +If you wish to assign this Agreement or your rights and +obligations, including by merger, consolidation, dissolution +or operation of law, contact NVIDIA to ask for permission. Any +attempted assignment not approved by NVIDIA in writing shall +be void and of no effect. NVIDIA may assign, delegate or +transfer this Agreement and its rights and obligations, and if +to a non-affiliate you will be notified. + +You agree to cooperate with NVIDIA and provide reasonably +requested information to verify your compliance with this +Agreement. + +This Agreement will be governed in all respects by the laws of +the United States and of the State of Delaware, without regard to the +conflicts of laws principles. The United Nations Convention on +Contracts for the International Sale of Goods is specifically +disclaimed. You agree to all terms of this Agreement in the +English language. + +The state or federal courts residing in Santa Clara County, +California shall have exclusive jurisdiction over any dispute +or claim arising out of this Agreement. Notwithstanding this, +you agree that NVIDIA shall still be allowed to apply for +injunctive remedies or an equivalent type of urgent legal +relief in any jurisdiction. + +If any court of competent jurisdiction determines that any +provision of this Agreement is illegal, invalid or +unenforceable, such provision will be construed as limited to +the extent necessary to be consistent with and fully +enforceable under the law and the remaining provisions will +remain in full force and effect. Unless otherwise specified, +remedies are cumulative. + +Each party acknowledges and agrees that the other is an +independent contractor in the performance of this Agreement. + +The SDK has been developed entirely at private expense and is +“commercial items†consisting of “commercial computer +software†and “commercial computer software +documentation†provided with RESTRICTED RIGHTS. Use, +duplication or disclosure by the U.S. Government or a U.S. +Government subcontractor is subject to the restrictions in +this Agreement pursuant to DFARS 227.7202-3(a) or as set forth +in subparagraphs (c)(1) and (2) of the Commercial Computer +Software - Restricted Rights clause at FAR 52.227-19, as +applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas +Expressway, Santa Clara, CA 95051. + +The SDK is subject to United States export laws and +regulations. You agree that you will not ship, transfer or +export the SDK into any country, or use the SDK in any manner, +prohibited by the United States Bureau of Industry and +Security or economic sanctions regulations administered by the +U.S. Department of Treasury’s Office of Foreign Assets +Control (OFAC), or any applicable export laws, restrictions or +regulations. These laws include restrictions on destinations, +end users and end use. By accepting this Agreement, you +confirm that you are not located in a country currently +embargoed by the U.S. or otherwise prohibited from receiving +the SDK under U.S. law. + +Any notice delivered by NVIDIA to you under this Agreement +will be delivered via mail, email or fax. You agree that any +notices that NVIDIA sends you electronically will satisfy any +legal communication requirements. Please direct your legal +notices or other correspondence to NVIDIA Corporation, 2788 +San Tomas Expressway, Santa Clara, California 95051, United +States of America, Attention: Legal Department. + +This Agreement and any exhibits incorporated into this +Agreement constitute the entire agreement of the parties with +respect to the subject matter of this Agreement and supersede +all prior negotiations or documentation exchanged between the +parties relating to this SDK license. Any additional and/or +conflicting terms on documents issued by you are null, void, +and invalid. Any amendment or waiver under this Agreement +shall be in writing and signed by representatives of both +parties. + + +2. CUDA Toolkit Supplement to Software License Agreement for +NVIDIA Software Development Kits +------------------------------------------------------------ + +The terms in this supplement govern your use of the NVIDIA +CUDA Toolkit SDK under the terms of your license agreement +(“Agreementâ€) as modified by this supplement. Capitalized +terms used but not defined below have the meaning assigned to +them in the Agreement. + +This supplement is an exhibit to the Agreement and is +incorporated as an integral part of the Agreement. In the +event of conflict between the terms in this supplement and the +terms in the Agreement, the terms in this supplement govern. + + +2.1. License Scope + +The SDK is licensed for you to develop applications only for +use in systems with NVIDIA GPUs. + + +2.2. Distribution + +The portions of the SDK that are distributable under the +Agreement are listed in Attachment A. + + +2.3. Operating Systems + +Those portions of the SDK designed exclusively for use on the +Linux or FreeBSD operating systems, or other operating systems +derived from the source code to these operating systems, may +be copied and redistributed for use in accordance with this +Agreement, provided that the object code files are not +modified in any way (except for unzipping of compressed +files). + + +2.4. Audio and Video Encoders and Decoders + +You acknowledge and agree that it is your sole responsibility +to obtain any additional third-party licenses required to +make, have made, use, have used, sell, import, and offer for +sale your products or services that include or incorporate any +third-party software and content relating to audio and/or +video encoders and decoders from, including but not limited +to, Microsoft, Thomson, Fraunhofer IIS, Sisvel S.p.A., +MPEG-LA, and Coding Technologies. NVIDIA does not grant to you +under this Agreement any necessary patent or other rights with +respect to any audio and/or video encoders and decoders. + + +2.5. Licensing + +If the distribution terms in this Agreement are not suitable +for your organization, or for any questions regarding this +Agreement, please contact NVIDIA at +nvidia-compute-license-questions@nvidia.com. + + +2.6. Attachment A + +The following CUDA Toolkit files may be distributed with +applications developed by you, including certain +variations of these files that have version number or +architecture specific information embedded in the file name - +as an example only, for release version 9.0 of the 64-bit +Windows software, the file cudart64_90.dll is redistributable. + +Component + +CUDA Runtime + +Windows + +cudart.dll, cudart_static.lib, cudadevrt.lib + +Mac OSX + +libcudart.dylib, libcudart_static.a, libcudadevrt.a + +Linux + +libcudart.so, libcudart_static.a, libcudadevrt.a + +Android + +libcudart.so, libcudart_static.a, libcudadevrt.a + +Component + +CUDA FFT Library + +Windows + +cufft.dll, cufftw.dll, cufft.lib, cufftw.lib + +Mac OSX + +libcufft.dylib, libcufft_static.a, libcufftw.dylib, +libcufftw_static.a + +Linux + +libcufft.so, libcufft_static.a, libcufftw.so, +libcufftw_static.a + +Android + +libcufft.so, libcufft_static.a, libcufftw.so, +libcufftw_static.a + +Component + +CUDA BLAS Library + +Windows + +cublas.dll, cublasLt.dll + +Mac OSX + +libcublas.dylib, libcublasLt.dylib, libcublas_static.a, +libcublasLt_static.a + +Linux + +libcublas.so, libcublasLt.so, libcublas_static.a, +libcublasLt_static.a + +Android + +libcublas.so, libcublasLt.so, libcublas_static.a, +libcublasLt_static.a + +Component + +NVIDIA "Drop-in" BLAS Library + +Windows + +nvblas.dll + +Mac OSX + +libnvblas.dylib + +Linux + +libnvblas.so + +Component + +CUDA Sparse Matrix Library + +Windows + +cusparse.dll, cusparse.lib + +Mac OSX + +libcusparse.dylib, libcusparse_static.a + +Linux + +libcusparse.so, libcusparse_static.a + +Android + +libcusparse.so, libcusparse_static.a + +Component + +CUDA Linear Solver Library + +Windows + +cusolver.dll, cusolver.lib + +Mac OSX + +libcusolver.dylib, libcusolver_static.a + +Linux + +libcusolver.so, libcusolver_static.a + +Android + +libcusolver.so, libcusolver_static.a + +Component + +CUDA Random Number Generation Library + +Windows + +curand.dll, curand.lib + +Mac OSX + +libcurand.dylib, libcurand_static.a + +Linux + +libcurand.so, libcurand_static.a + +Android + +libcurand.so, libcurand_static.a + +Component + +NVIDIA Performance Primitives Library + +Windows + +nppc.dll, nppc.lib, nppial.dll, nppial.lib, nppicc.dll, +nppicc.lib, nppicom.dll, nppicom.lib, nppidei.dll, +nppidei.lib, nppif.dll, nppif.lib, nppig.dll, nppig.lib, +nppim.dll, nppim.lib, nppist.dll, nppist.lib, nppisu.dll, +nppisu.lib, nppitc.dll, nppitc.lib, npps.dll, npps.lib + +Mac OSX + +libnppc.dylib, libnppc_static.a, libnppial.dylib, +libnppial_static.a, libnppicc.dylib, libnppicc_static.a, +libnppicom.dylib, libnppicom_static.a, libnppidei.dylib, +libnppidei_static.a, libnppif.dylib, libnppif_static.a, +libnppig.dylib, libnppig_static.a, libnppim.dylib, +libnppisu_static.a, libnppitc.dylib, libnppitc_static.a, +libnpps.dylib, libnpps_static.a + +Linux + +libnppc.so, libnppc_static.a, libnppial.so, +libnppial_static.a, libnppicc.so, libnppicc_static.a, +libnppicom.so, libnppicom_static.a, libnppidei.so, +libnppidei_static.a, libnppif.so, libnppif_static.a +libnppig.so, libnppig_static.a, libnppim.so, +libnppim_static.a, libnppist.so, libnppist_static.a, +libnppisu.so, libnppisu_static.a, libnppitc.so +libnppitc_static.a, libnpps.so, libnpps_static.a + +Android + +libnppc.so, libnppc_static.a, libnppial.so, +libnppial_static.a, libnppicc.so, libnppicc_static.a, +libnppicom.so, libnppicom_static.a, libnppidei.so, +libnppidei_static.a, libnppif.so, libnppif_static.a +libnppig.so, libnppig_static.a, libnppim.so, +libnppim_static.a, libnppist.so, libnppist_static.a, +libnppisu.so, libnppisu_static.a, libnppitc.so +libnppitc_static.a, libnpps.so, libnpps_static.a + +Component + +NVIDIA JPEG Library + +Windows + +nvjpeg.lib, nvjpeg.dll + +Linux + +libnvjpeg.so, libnvjpeg_static.a + +Component + +Internal common library required for statically linking to +cuBLAS, cuSPARSE, cuFFT, cuRAND, nvJPEG and NPP + +Mac OSX + +libculibos.a + +Linux + +libculibos.a + +Component + +NVIDIA Runtime Compilation Library and Header + +All + +nvrtc.h + +Windows + +nvrtc.dll, nvrtc-builtins.dll + +Mac OSX + +libnvrtc.dylib, libnvrtc-builtins.dylib + +Linux + +libnvrtc.so, libnvrtc-builtins.so, libnvrtc_static.a, libnvrtx-builtins_static.a + +Component + +NVIDIA Optimizing Compiler Library + +Windows + +nvvm.dll + +Mac OSX + +libnvvm.dylib + +Linux + +libnvvm.so + +Component + +NVIDIA JIT Linking Library + +Windows + +libnvJitLink.dll, libnvJitLink.lib + +Linux + +libnvJitLink.so, libnvJitLink_static.a + +Component + +NVIDIA Common Device Math Functions Library + +Windows + +libdevice.10.bc + +Mac OSX + +libdevice.10.bc + +Linux + +libdevice.10.bc + +Component + +CUDA Occupancy Calculation Header Library + +All + +cuda_occupancy.h + +Component + +CUDA Half Precision Headers + +All + +cuda_fp16.h, cuda_fp16.hpp + +Component + +CUDA Profiling Tools Interface (CUPTI) Library + +Windows + +cupti.dll + +Mac OSX + +libcupti.dylib + +Linux + +libcupti.so + +Component + +NVIDIA Tools Extension Library + +Windows + +nvToolsExt.dll, nvToolsExt.lib + +Mac OSX + +libnvToolsExt.dylib + +Linux + +libnvToolsExt.so + +Component + +NVIDIA CUDA Driver Libraries + +Linux + +libcuda.so, libnvidia-ptxjitcompiler.so, libnvptxcompiler_static.a + +Component + +NVIDIA CUDA File IO Libraries and Header + +All + +cufile.h + +Linux + +libcufile.so, libcufile_rdma.so, libcufile_static.a, +libcufile_rdma_static.a + +In addition to the rights above, for parties that are +developing software intended solely for use on Jetson +development kits or Jetson modules, and running Linux for +Tegra software, the following shall apply: + + * The SDK may be distributed in its entirety, as provided by + NVIDIA, and without separation of its components, for you + and/or your licensees to create software development kits + for use only on the Jetson platform and running Linux for + Tegra software. + + +2.7. Attachment B + + +Additional Licensing Obligations + +The following third party components included in the SOFTWARE +are licensed to Licensee pursuant to the following terms and +conditions: + + 1. Licensee's use of the GDB third party component is + subject to the terms and conditions of GNU GPL v3: + + This product includes copyrighted third-party software licensed + under the terms of the GNU General Public License v3 ("GPL v3"). + All third-party software packages are copyright by their respective + authors. GPL v3 terms and conditions are hereby incorporated into + the Agreement by this reference: http://www.gnu.org/licenses/gpl.txt + + Consistent with these licensing requirements, the software + listed below is provided under the terms of the specified + open source software licenses. To obtain source code for + software provided under licenses that require + redistribution of source code, including the GNU General + Public License (GPL) and GNU Lesser General Public License + (LGPL), contact oss-requests@nvidia.com. This offer is + valid for a period of three (3) years from the date of the + distribution of this product by NVIDIA CORPORATION. + + Component License + CUDA-GDB GPL v3 + + 2. Licensee represents and warrants that any and all third + party licensing and/or royalty payment obligations in + connection with Licensee's use of the H.264 video codecs + are solely the responsibility of Licensee. + + 3. Licensee's use of the Thrust library is subject to the + terms and conditions of the Apache License Version 2.0. + All third-party software packages are copyright by their + respective authors. Apache License Version 2.0 terms and + conditions are hereby incorporated into the Agreement by + this reference. + http://www.apache.org/licenses/LICENSE-2.0.html + + In addition, Licensee acknowledges the following notice: + Thrust includes source code from the Boost Iterator, + Tuple, System, and Random Number libraries. + + Boost Software License - Version 1.0 - August 17th, 2003 + . . . . + + Permission is hereby granted, free of charge, to any person or + organization obtaining a copy of the software and accompanying + documentation covered by this license (the "Software") to use, + reproduce, display, distribute, execute, and transmit the Software, + and to prepare derivative works of the Software, and to permit + third-parties to whom the Software is furnished to do so, all + subject to the following: + + The copyright notices in the Software and this entire statement, + including the above license grant, this restriction and the following + disclaimer, must be included in all copies of the Software, in whole + or in part, and all derivative works of the Software, unless such + copies or derivative works are solely in the form of machine-executable + object code generated by a source language processor. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND + NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR + OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + 4. Licensee's use of the LLVM third party component is + subject to the following terms and conditions: + + ====================================================== + LLVM Release License + ====================================================== + University of Illinois/NCSA + Open Source License + + Copyright (c) 2003-2010 University of Illinois at Urbana-Champaign. + All rights reserved. + + Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal with the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at Urbana- + Champaign, nor the names of its contributors may be used to endorse or + promote products derived from this Software without specific prior + written permission. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS WITH THE SOFTWARE. + + 5. Licensee's use of the PCRE third party component is + subject to the following terms and conditions: + + ------------ + PCRE LICENCE + ------------ + PCRE is a library of functions to support regular expressions whose syntax + and semantics are as close as possible to those of the Perl 5 language. + Release 8 of PCRE is distributed under the terms of the "BSD" licence, as + specified below. The documentation for PCRE, supplied in the "doc" + directory, is distributed under the same terms as the software itself. The + basic library functions are written in C and are freestanding. Also + included in the distribution is a set of C++ wrapper functions, and a just- + in-time compiler that can be used to optimize pattern matching. These are + both optional features that can be omitted when the library is built. + + THE BASIC LIBRARY FUNCTIONS + --------------------------- + Written by: Philip Hazel + Email local part: ph10 + Email domain: cam.ac.uk + University of Cambridge Computing Service, + Cambridge, England. + Copyright (c) 1997-2012 University of Cambridge + All rights reserved. + + PCRE JUST-IN-TIME COMPILATION SUPPORT + ------------------------------------- + Written by: Zoltan Herczeg + Email local part: hzmester + Emain domain: freemail.hu + Copyright(c) 2010-2012 Zoltan Herczeg + All rights reserved. + + STACK-LESS JUST-IN-TIME COMPILER + -------------------------------- + Written by: Zoltan Herczeg + Email local part: hzmester + Emain domain: freemail.hu + Copyright(c) 2009-2012 Zoltan Herczeg + All rights reserved. + + THE C++ WRAPPER FUNCTIONS + ------------------------- + Contributed by: Google Inc. + Copyright (c) 2007-2012, Google Inc. + All rights reserved. + + THE "BSD" LICENCE + ----------------- + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the University of Cambridge nor the name of Google + Inc. nor the names of their contributors may be used to endorse or + promote products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + 6. Some of the cuBLAS library routines were written by or + derived from code written by Vasily Volkov and are subject + to the Modified Berkeley Software Distribution License as + follows: + + Copyright (c) 2007-2009, Regents of the University of California + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of the University of California, Berkeley nor + the names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + 7. Some of the cuBLAS library routines were written by or + derived from code written by Davide Barbieri and are + subject to the Modified Berkeley Software Distribution + License as follows: + + Copyright (c) 2008-2009 Davide Barbieri @ University of Rome Tor Vergata. + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + 8. Some of the cuBLAS library routines were derived from + code developed by the University of Tennessee and are + subject to the Modified Berkeley Software Distribution + License as follows: + + Copyright (c) 2010 The University of Tennessee. + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer listed in this license in the documentation and/or + other materials provided with the distribution. + * Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 9. Some of the cuBLAS library routines were written by or + derived from code written by Jonathan Hogg and are subject + to the Modified Berkeley Software Distribution License as + follows: + + Copyright (c) 2012, The Science and Technology Facilities Council (STFC). + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of the STFC nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE STFC BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 10. Some of the cuBLAS library routines were written by or + derived from code written by Ahmad M. Abdelfattah, David + Keyes, and Hatem Ltaief, and are subject to the Apache + License, Version 2.0, as follows: + + -- (C) Copyright 2013 King Abdullah University of Science and Technology + Authors: + Ahmad Abdelfattah (ahmad.ahmad@kaust.edu.sa) + David Keyes (david.keyes@kaust.edu.sa) + Hatem Ltaief (hatem.ltaief@kaust.edu.sa) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the King Abdullah University of Science and + Technology nor the names of its contributors may be used to endorse + or promote products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE + + 11. Some of the cuSPARSE library routines were written by or + derived from code written by Li-Wen Chang and are subject + to the NCSA Open Source License as follows: + + Copyright (c) 2012, University of Illinois. + + All rights reserved. + + Developed by: IMPACT Group, University of Illinois, http://impact.crhc.illinois.edu + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal with the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimers in the documentation and/or other materials provided + with the distribution. + * Neither the names of IMPACT Group, University of Illinois, nor + the names of its contributors may be used to endorse or promote + products derived from this Software without specific prior + written permission. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE + SOFTWARE. + + 12. Some of the cuRAND library routines were written by or + derived from code written by Mutsuo Saito and Makoto + Matsumoto and are subject to the following license: + + Copyright (c) 2009, 2010 Mutsuo Saito, Makoto Matsumoto and Hiroshima + University. All rights reserved. + + Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima + University and University of Tokyo. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of the Hiroshima University nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 13. Some of the cuRAND library routines were derived from + code developed by D. E. Shaw Research and are subject to + the following license: + + Copyright 2010-2011, D. E. Shaw Research. + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions, and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of D. E. Shaw Research nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 14. Some of the Math library routines were written by or + derived from code developed by Norbert Juffa and are + subject to the following license: + + Copyright (c) 2015-2017, Norbert Juffa + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 15. Licensee's use of the lz4 third party component is + subject to the following terms and conditions: + + Copyright (C) 2011-2013, Yann Collet. + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 16. The NPP library uses code from the Boost Math Toolkit, + and is subject to the following license: + + Boost Software License - Version 1.0 - August 17th, 2003 + . . . . + + Permission is hereby granted, free of charge, to any person or + organization obtaining a copy of the software and accompanying + documentation covered by this license (the "Software") to use, + reproduce, display, distribute, execute, and transmit the Software, + and to prepare derivative works of the Software, and to permit + third-parties to whom the Software is furnished to do so, all + subject to the following: + + The copyright notices in the Software and this entire statement, + including the above license grant, this restriction and the following + disclaimer, must be included in all copies of the Software, in whole + or in part, and all derivative works of the Software, unless such + copies or derivative works are solely in the form of machine-executable + object code generated by a source language processor. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND + NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR + OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + 17. Portions of the Nsight Eclipse Edition is subject to the + following license: + + The Eclipse Foundation makes available all content in this plug-in + ("Content"). Unless otherwise indicated below, the Content is provided + to you under the terms and conditions of the Eclipse Public License + Version 1.0 ("EPL"). A copy of the EPL is available at http:// + www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program" + will mean the Content. + + If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may apply to your + use of any object code in the Content. Check the Redistributor's + license that was provided with the Content. If no such license exists, + contact the Redistributor. Unless otherwise indicated below, the terms + and conditions of the EPL still apply to any source code in the + Content and such source code may be obtained at http://www.eclipse.org. + + 18. Some of the cuBLAS library routines uses code from + OpenAI, which is subject to the following license: + + License URL + https://github.com/openai/openai-gemm/blob/master/LICENSE + + License Text + The MIT License + + Copyright (c) 2016 OpenAI (http://openai.com), 2016 Google Inc. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + 19. Licensee's use of the Visual Studio Setup Configuration + Samples is subject to the following license: + + The MIT License (MIT) + Copyright (C) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + 20. Licensee's use of linmath.h header for CPU functions for + GL vector/matrix operations from lunarG is subject to the + Apache License Version 2.0. + + 21. The DX12-CUDA sample uses the d3dx12.h header, which is + subject to the MIT license. + + 22. Components of the driver and compiler used for binary management, including + nvFatBin, nvcc, and cuobjdump, use the Zstandard library which is subject to + the following license: + + BSD License + + For Zstandard software + + Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Facebook, nor Meta, nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + OF SUCH DAMAGE. + +----------------- diff --git a/cuda_toolkit/include/__assert b/cuda_toolkit/include/__assert new file mode 100644 index 0000000000000000000000000000000000000000..2e378d0912010cb93968e7a16c79f03b96c615f5 --- /dev/null +++ b/cuda_toolkit/include/__assert @@ -0,0 +1,70 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___ASSERT +#define _LIBCUDACXX___ASSERT + +#ifndef __cuda_std__ +#include <__config> +#endif // __cuda_std__ + +#include "__verbose_abort" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// This is for backwards compatibility with code that might have been enabling +// assertions through the Debug mode previously. +// TODO: In LLVM 16, make it an error to define _LIBCUDACXX_DEBUG +#if defined(_LIBCUDACXX_DEBUG) +# ifndef _LIBCUDACXX_ENABLE_ASSERTIONS +# define _LIBCUDACXX_ENABLE_ASSERTIONS 1 +# endif +#endif + +// Automatically enable assertions when the debug mode is enabled. +#if defined(_LIBCUDACXX_ENABLE_DEBUG_MODE) +# ifndef _LIBCUDACXX_ENABLE_ASSERTIONS +# define _LIBCUDACXX_ENABLE_ASSERTIONS 1 +# endif +#endif + +#ifndef _LIBCUDACXX_ENABLE_ASSERTIONS +# define _LIBCUDACXX_ENABLE_ASSERTIONS _LIBCUDACXX_ENABLE_ASSERTIONS_DEFAULT +#endif + +#if _LIBCUDACXX_ENABLE_ASSERTIONS != 0 && _LIBCUDACXX_ENABLE_ASSERTIONS != 1 +# error "_LIBCUDACXX_ENABLE_ASSERTIONS must be set to 0 or 1" +#endif + +#if _LIBCUDACXX_ENABLE_ASSERTIONS +# define _LIBCUDACXX_ASSERT(expression, message) \ + (_CCCL_DIAG_PUSH \ + _CCCL_DIAG_SUPPRESS_CLANG("-Wassume") \ + __builtin_expect(static_cast(expression), 1) ? \ + (void)0 : \ + ::_CUDA_VSTD::__libcpp_verbose_abort("%s:%d: assertion %s failed: %s", __FILE__, __LINE__, #expression, message) + _CCCL_DIAG_POP) +#elif 0 // !defined(_LIBCUDACXX_ASSERTIONS_DISABLE_ASSUME) && __has_builtin(__builtin_assume) +# define _LIBCUDACXX_ASSERT(expression, message) \ + (_CCCL_DIAG_PUSH \ + _CCCL_DIAG_SUPPRESS_CLANG("-Wassume") \ + __builtin_assume(static_cast(expression)) \ + _CCCL_DIAG_POP) +#else +# define _LIBCUDACXX_ASSERT(expression, message) ((void)0) +#endif + +#endif // _LIBCUDACXX___ASSERT diff --git a/cuda_toolkit/include/__availability b/cuda_toolkit/include/__availability new file mode 100644 index 0000000000000000000000000000000000000000..1331d6600259ed47ee51b0dade2466e9c608372e --- /dev/null +++ b/cuda_toolkit/include/__availability @@ -0,0 +1,306 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___AVAILABILITY +#define _LIBCUDACXX___AVAILABILITY + +#ifndef __cuda_std__ +#include <__config> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// Libc++ is shipped by various vendors. In particular, it is used as a system +// library on macOS, iOS and other Apple platforms. In order for users to be +// able to compile a binary that is intended to be deployed to an older version +// of a platform, Clang provides availability attributes [1]. These attributes +// can be placed on declarations and are used to describe the life cycle of a +// symbol in the library. +// +// The main goal is to ensure a compile-time error if a symbol that hasn't been +// introduced in a previously released library is used in a program that targets +// that previously released library. Normally, this would be a load-time error +// when one tries to launch the program against the older library. +// +// For example, the filesystem library was introduced in the dylib in macOS 10.15. +// If a user compiles on a macOS 10.15 host but targets macOS 10.13 with their +// program, the compiler would normally not complain (because the required +// declarations are in the headers), but the dynamic loader would fail to find +// the symbols when actually trying to launch the program on macOS 10.13. To +// turn this into a compile-time issue instead, declarations are annotated with +// when they were introduced, and the compiler can produce a diagnostic if the +// program references something that isn't available on the deployment target. +// +// This mechanism is general in nature, and any vendor can add their markup to +// the library (see below). Whenever a new feature is added that requires support +// in the shared library, a macro should be added below to mark this feature +// as unavailable. When vendors decide to ship the feature as part of their +// shared library, they can update the markup appropriately. +// +// Furthermore, many features in the standard library have corresponding +// feature-test macros. When a feature is made unavailable on some deployment +// target, a macro should be defined to signal that it is unavailable. That +// macro can then be picked up when feature-test macros are generated (see +// generate_feature_test_macro_components.py) to make sure that feature-test +// macros don't announce a feature as being implemented if it has been marked +// as unavailable. +// +// Note that this mechanism is disabled by default in the "upstream" libc++. +// Availability annotations are only meaningful when shipping libc++ inside +// a platform (i.e. as a system library), and so vendors that want them should +// turn those annotations on at CMake configuration time. +// +// [1]: https://clang.llvm.org/docs/AttributeReference.html#availability + + +// For backwards compatibility, allow users to define _LIBCUDACXX_DISABLE_AVAILABILITY +// for a while. +#if defined(_LIBCUDACXX_DISABLE_AVAILABILITY) +# if !defined(_LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) +# define _LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS +# endif +#endif + +// Availability markup is disabled when building the library, or when the compiler +// doesn't support the proper attributes. +#if defined(_LIBCUDACXX_BUILDING_LIBRARY) || \ + defined(_LIBCXXABI_BUILDING_LIBRARY) || \ + !__has_feature(attribute_availability_with_strict) || \ + !__has_feature(attribute_availability_in_templates) || \ + !__has_extension(pragma_clang_attribute_external_declaration) +# if !defined(_LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) +# define _LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS +# endif +#endif + +#if defined(_LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) + + // This controls the availability of std::shared_mutex and std::shared_timed_mutex, + // which were added to the dylib later. +# define _LIBCUDACXX_AVAILABILITY_SHARED_MUTEX +// # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex +// # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex + + // These macros control the availability of std::bad_optional_access and + // other exception types. These were put in the shared library to prevent + // code bloat from every user program defining the vtable for these exception + // types. + // + // Note that when exceptions are disabled, the methods that normally throw + // these exceptions can be used even on older deployment targets, but those + // methods will abort instead of throwing. +# define _LIBCUDACXX_AVAILABILITY_BAD_OPTIONAL_ACCESS +# define _LIBCUDACXX_AVAILABILITY_BAD_VARIANT_ACCESS +# define _LIBCUDACXX_AVAILABILITY_BAD_ANY_CAST + + // This controls the availability of std::uncaught_exceptions(). +# define _LIBCUDACXX_AVAILABILITY_UNCAUGHT_EXCEPTIONS + + // This controls the availability of the sized version of ::operator delete, + // ::operator delete[], and their align_val_t variants, which were all added + // in C++17, and hence not present in early dylibs. +# define _LIBCUDACXX_AVAILABILITY_SIZED_NEW_DELETE + + // This controls the availability of the std::future_error exception. + // + // Note that when exceptions are disabled, the methods that normally throw + // std::future_error can be used even on older deployment targets, but those + // methods will abort instead of throwing. +# define _LIBCUDACXX_AVAILABILITY_FUTURE_ERROR + + // This controls the availability of std::type_info's vtable. + // I can't imagine how using std::type_info can work at all if + // this isn't supported. +# define _LIBCUDACXX_AVAILABILITY_TYPEINFO_VTABLE + + // This controls the availability of std::locale::category members + // (e.g. std::locale::collate), which are defined in the dylib. +# define _LIBCUDACXX_AVAILABILITY_LOCALE_CATEGORY + + // This controls the availability of atomic operations on std::shared_ptr + // (e.g. `std::atomic_store(std::shared_ptr)`), which require a shared + // lock table located in the dylib. +# define _LIBCUDACXX_AVAILABILITY_ATOMIC_SHARED_PTR + + // These macros control the availability of all parts of that + // depend on something in the dylib. +# define _LIBCUDACXX_AVAILABILITY_FILESYSTEM +# define _LIBCUDACXX_AVAILABILITY_FILESYSTEM_PUSH +# define _LIBCUDACXX_AVAILABILITY_FILESYSTEM_POP +// # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem + + // This controls the availability of floating-point std::to_chars functions. + // These overloads were added later than the integer overloads. +# define _LIBCUDACXX_AVAILABILITY_TO_CHARS_FLOATING_POINT + + // This controls the availability of the C++20 synchronization library, + // which requires shared library support for various operations + // (see libcxx/src/atomic.cpp). This includes , , + // , and notification functions on std::atomic. +# define _LIBCUDACXX_AVAILABILITY_SYNC +// # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait +// # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier +// # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_latch +// # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore + + // This controls the availability of the C++20 format library. + // The library is in development and not ABI stable yet. P2216 is + // retroactively accepted in C++20. This paper contains ABI breaking + // changes. +# define _LIBCUDACXX_AVAILABILITY_FORMAT +// # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_format + + // This controls whether the default verbose termination function is + // provided by the library. + // + // Note that when users provide their own custom function, it doesn't + // matter whether the dylib provides a default function, and the + // availability markup can actually give a false positive diagnostic + // (it will think that no function is provided, when in reality the + // user has provided their own). + // + // Users can pass -D_LIBCUDACXX_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED + // to the compiler to tell the library not to define its own verbose abort. + // Note that defining this macro but failing to define a custom function + // will lead to a load-time error on back-deployment targets, so it should + // be avoided. +// # define _LIBCUDACXX_HAS_NO_VERBOSE_ABORT_IN_LIBRARY + +#elif defined(__APPLE__) + +# define _LIBCUDACXX_AVAILABILITY_SHARED_MUTEX \ + __attribute__((availability(macos,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000) +# define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex +# define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex +# endif + + // Note: bad_optional_access & friends were not introduced in the matching + // macOS and iOS versions, so the version mismatch between macOS and others + // is intended. +# define _LIBCUDACXX_AVAILABILITY_BAD_OPTIONAL_ACCESS \ + __attribute__((availability(macos,strict,introduced=10.13))) \ + __attribute__((availability(ios,strict,introduced=12.0))) \ + __attribute__((availability(tvos,strict,introduced=12.0))) \ + __attribute__((availability(watchos,strict,introduced=5.0))) +# define _LIBCUDACXX_AVAILABILITY_BAD_VARIANT_ACCESS \ + _LIBCUDACXX_AVAILABILITY_BAD_OPTIONAL_ACCESS +# define _LIBCUDACXX_AVAILABILITY_BAD_ANY_CAST \ + _LIBCUDACXX_AVAILABILITY_BAD_OPTIONAL_ACCESS + +# define _LIBCUDACXX_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ + __attribute__((availability(macos,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) + +# define _LIBCUDACXX_AVAILABILITY_SIZED_NEW_DELETE \ + __attribute__((availability(macos,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) + +# define _LIBCUDACXX_AVAILABILITY_FUTURE_ERROR \ + __attribute__((availability(ios,strict,introduced=6.0))) + +# define _LIBCUDACXX_AVAILABILITY_TYPEINFO_VTABLE \ + __attribute__((availability(macos,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) + +# define _LIBCUDACXX_AVAILABILITY_LOCALE_CATEGORY \ + __attribute__((availability(macos,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) + +# define _LIBCUDACXX_AVAILABILITY_ATOMIC_SHARED_PTR \ + __attribute__((availability(macos,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) + +# define _LIBCUDACXX_AVAILABILITY_FILESYSTEM \ + __attribute__((availability(macos,strict,introduced=10.15))) \ + __attribute__((availability(ios,strict,introduced=13.0))) \ + __attribute__((availability(tvos,strict,introduced=13.0))) \ + __attribute__((availability(watchos,strict,introduced=6.0))) +# define _LIBCUDACXX_AVAILABILITY_FILESYSTEM_PUSH \ + _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))") +# define _LIBCUDACXX_AVAILABILITY_FILESYSTEM_POP \ + _Pragma("clang attribute pop") \ + _Pragma("clang attribute pop") \ + _Pragma("clang attribute pop") \ + _Pragma("clang attribute pop") +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000) +# define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem +# endif + +# define _LIBCUDACXX_AVAILABILITY_TO_CHARS_FLOATING_POINT \ + __attribute__((unavailable)) + +# define _LIBCUDACXX_AVAILABILITY_SYNC \ + __attribute__((availability(macos,strict,introduced=11.0))) \ + __attribute__((availability(ios,strict,introduced=14.0))) \ + __attribute__((availability(tvos,strict,introduced=14.0))) \ + __attribute__((availability(watchos,strict,introduced=7.0))) +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000) +# define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait +# define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier +# define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_latch +# define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore +# endif + +# define _LIBCUDACXX_AVAILABILITY_FORMAT \ + __attribute__((unavailable)) +# define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_format + +# define _LIBCUDACXX_HAS_NO_VERBOSE_ABORT_IN_LIBRARY + +#else + +// ...New vendors can add availability markup here... + +# error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!" + +#endif + +// Define availability attributes that depend on _LIBCUDACXX_NO_EXCEPTIONS. +// Those are defined in terms of the availability attributes above, and +// should not be vendor-specific. +#if defined(_LIBCUDACXX_NO_EXCEPTIONS) +# define _LIBCUDACXX_AVAILABILITY_FUTURE +# define _LIBCUDACXX_AVAILABILITY_THROW_BAD_ANY_CAST +# define _LIBCUDACXX_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS +# define _LIBCUDACXX_AVAILABILITY_THROW_BAD_VARIANT_ACCESS +#else +# define _LIBCUDACXX_AVAILABILITY_FUTURE _LIBCUDACXX_AVAILABILITY_FUTURE_ERROR +# define _LIBCUDACXX_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCUDACXX_AVAILABILITY_BAD_ANY_CAST +# define _LIBCUDACXX_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCUDACXX_AVAILABILITY_BAD_OPTIONAL_ACCESS +# define _LIBCUDACXX_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCUDACXX_AVAILABILITY_BAD_VARIANT_ACCESS +#endif + +#endif // _LIBCUDACXX___AVAILABILITY diff --git a/cuda_toolkit/include/__bit_reference b/cuda_toolkit/include/__bit_reference new file mode 100644 index 0000000000000000000000000000000000000000..14377c0b1bc2a5e837dd13d65a858b4612265713 --- /dev/null +++ b/cuda_toolkit/include/__bit_reference @@ -0,0 +1,1293 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___BIT_REFERENCE +#define _LIBCUDACXX___BIT_REFERENCE + +#include <__config> +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template class __bit_iterator; +template class __bit_const_reference; + +template +struct __has_storage_type +{ + static const bool value = false; +}; + +template ::value> +class __bit_reference +{ + typedef typename _Cp::__storage_type __storage_type; + typedef typename _Cp::__storage_pointer __storage_pointer; + + __storage_pointer __seg_; + __storage_type __mask_; + + friend typename _Cp::__self; + + friend class __bit_const_reference<_Cp>; + friend class __bit_iterator<_Cp, false>; +public: + _LIBCUDACXX_INLINE_VISIBILITY + __bit_reference(const __bit_reference&) = default; + + _LIBCUDACXX_INLINE_VISIBILITY operator bool() const noexcept + {return static_cast(*__seg_ & __mask_);} + _LIBCUDACXX_INLINE_VISIBILITY bool operator ~() const noexcept + {return !static_cast(*this);} + + _LIBCUDACXX_INLINE_VISIBILITY + __bit_reference& operator=(bool __x) noexcept + { + if (__x) + *__seg_ |= __mask_; + else + *__seg_ &= ~__mask_; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __bit_reference& operator=(const __bit_reference& __x) noexcept + {return operator=(static_cast(__x));} + + _LIBCUDACXX_INLINE_VISIBILITY void flip() noexcept {*__seg_ ^= __mask_;} + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const noexcept + {return __bit_iterator<_Cp, false>(__seg_, static_cast(__libcpp_ctz(__mask_)));} +private: + _LIBCUDACXX_INLINE_VISIBILITY + __bit_reference(__storage_pointer __s, __storage_type __m) noexcept + : __seg_(__s), __mask_(__m) {} +}; + +template +class __bit_reference<_Cp, false> +{ +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) noexcept +{ + bool __t = __x; + __x = __y; + __y = __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) noexcept +{ + bool __t = __x; + __x = __y; + __y = __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(__bit_reference<_Cp> __x, bool& __y) noexcept +{ + bool __t = __x; + __x = __y; + __y = __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(bool& __x, __bit_reference<_Cp> __y) noexcept +{ + bool __t = __x; + __x = __y; + __y = __t; +} + +template +class __bit_const_reference +{ + typedef typename _Cp::__storage_type __storage_type; + typedef typename _Cp::__const_storage_pointer __storage_pointer; + + __storage_pointer __seg_; + __storage_type __mask_; + + friend typename _Cp::__self; + friend class __bit_iterator<_Cp, true>; +public: + _LIBCUDACXX_INLINE_VISIBILITY + __bit_const_reference(const __bit_const_reference&) = default; + + _LIBCUDACXX_INLINE_VISIBILITY + __bit_const_reference(const __bit_reference<_Cp>& __x) noexcept + : __seg_(__x.__seg_), __mask_(__x.__mask_) {} + + _LIBCUDACXX_INLINE_VISIBILITY constexpr operator bool() const noexcept + {return static_cast(*__seg_ & __mask_);} + + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const noexcept + {return __bit_iterator<_Cp, true>(__seg_, static_cast(__libcpp_ctz(__mask_)));} +private: + _LIBCUDACXX_INLINE_VISIBILITY + constexpr + __bit_const_reference(__storage_pointer __s, __storage_type __m) noexcept + : __seg_(__s), __mask_(__m) {} + + __bit_const_reference& operator=(const __bit_const_reference&) = delete; +}; + +// find + +template +__bit_iterator<_Cp, _IsConst> +__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, _IsConst> _It; + typedef typename _It::__storage_type __storage_type; + static const int __bits_per_word = _It::__bits_per_word; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __storage_type __b = *__first.__seg_ & __m; + if (__b) + return _It(__first.__seg_, static_cast(_CUDA_VSTD::__libcpp_ctz(__b))); + if (__n == __dn) + return __first + __n; + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) + if (*__first.__seg_) + return _It(__first.__seg_, static_cast(_CUDA_VSTD::__libcpp_ctz(*__first.__seg_))); + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = *__first.__seg_ & __m; + if (__b) + return _It(__first.__seg_, static_cast(_CUDA_VSTD::__libcpp_ctz(__b))); + } + return _It(__first.__seg_, static_cast(__n)); +} + +template +__bit_iterator<_Cp, _IsConst> +__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, _IsConst> _It; + typedef typename _It::__storage_type __storage_type; + const int __bits_per_word = _It::__bits_per_word; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __storage_type __b = ~*__first.__seg_ & __m; + if (__b) + return _It(__first.__seg_, static_cast(_CUDA_VSTD::__libcpp_ctz(__b))); + if (__n == __dn) + return __first + __n; + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) + { + __storage_type __b = ~*__first.__seg_; + if (__b) + return _It(__first.__seg_, static_cast(_CUDA_VSTD::__libcpp_ctz(__b))); + } + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = ~*__first.__seg_ & __m; + if (__b) + return _It(__first.__seg_, static_cast(_CUDA_VSTD::__libcpp_ctz(__b))); + } + return _It(__first.__seg_, static_cast(__n)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__bit_iterator<_Cp, _IsConst> +find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) +{ + if (static_cast(__value_)) + return __find_bool_true(__first, static_cast(__last - __first)); + return __find_bool_false(__first, static_cast(__last - __first)); +} + +// count + +template +typename __bit_iterator<_Cp, _IsConst>::difference_type +__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, _IsConst> _It; + typedef typename _It::__storage_type __storage_type; + typedef typename _It::difference_type difference_type; + const int __bits_per_word = _It::__bits_per_word; + difference_type __r = 0; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __r = _CUDA_VSTD::__libcpp_popcount(*__first.__seg_ & __m); + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) + __r += _CUDA_VSTD::__libcpp_popcount(*__first.__seg_); + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __r += _CUDA_VSTD::__libcpp_popcount(*__first.__seg_ & __m); + } + return __r; +} + +template +typename __bit_iterator<_Cp, _IsConst>::difference_type +__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, _IsConst> _It; + typedef typename _It::__storage_type __storage_type; + typedef typename _It::difference_type difference_type; + const int __bits_per_word = _It::__bits_per_word; + difference_type __r = 0; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __r = _CUDA_VSTD::__libcpp_popcount(~*__first.__seg_ & __m); + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) + __r += _CUDA_VSTD::__libcpp_popcount(~*__first.__seg_); + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __r += _CUDA_VSTD::__libcpp_popcount(~*__first.__seg_ & __m); + } + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename __bit_iterator<_Cp, _IsConst>::difference_type +count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) +{ + if (static_cast(__value_)) + return __count_bool_true(__first, static_cast(__last - __first)); + return __count_bool_false(__first, static_cast(__last - __first)); +} + +// fill_n + +template +void +__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, false> _It; + typedef typename _It::__storage_type __storage_type; + const int __bits_per_word = _It::__bits_per_word; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + *__first.__seg_ &= ~__m; + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + __storage_type __nw = __n / __bits_per_word; + _CUDA_VSTD::memset(_CUDA_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type)); + __n -= __nw * __bits_per_word; + // do last partial word + if (__n > 0) + { + __first.__seg_ += __nw; + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + *__first.__seg_ &= ~__m; + } +} + +template +void +__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) +{ + typedef __bit_iterator<_Cp, false> _It; + typedef typename _It::__storage_type __storage_type; + const int __bits_per_word = _It::__bits_per_word; + // do first partial word + if (__first.__ctz_ != 0) + { + __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); + __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n); + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + *__first.__seg_ |= __m; + __n -= __dn; + ++__first.__seg_; + } + // do middle whole words + __storage_type __nw = __n / __bits_per_word; + _CUDA_VSTD::memset(_CUDA_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type)); + __n -= __nw * __bits_per_word; + // do last partial word + if (__n > 0) + { + __first.__seg_ += __nw; + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + *__first.__seg_ |= __m; + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_) +{ + if (__n > 0) + { + if (__value_) + __fill_n_true(__first, __n); + else + __fill_n_false(__first, __n); + } +} + +// fill + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_) +{ + _CUDA_VSTD::fill_n(__first, static_cast(__last - __first), __value_); +} + +// copy + +template +__bit_iterator<_Cp, false> +__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) +{ + typedef __bit_iterator<_Cp, _IsConst> _In; + typedef typename _In::difference_type difference_type; + typedef typename _In::__storage_type __storage_type; + const int __bits_per_word = _In::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__first.__ctz_ != 0) + { + unsigned __clz = __bits_per_word - __first.__ctz_; + difference_type __dn = _CUDA_VSTD::min(static_cast(__clz), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn)); + __storage_type __b = *__first.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b; + __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__dn + __result.__ctz_) % __bits_per_word); + ++__first.__seg_; + // __first.__ctz_ = 0; + } + // __first.__ctz_ == 0; + // do middle words + __storage_type __nw = __n / __bits_per_word; + _CUDA_VSTD::memmove(_CUDA_VSTD::__to_raw_pointer(__result.__seg_), + _CUDA_VSTD::__to_raw_pointer(__first.__seg_), + __nw * sizeof(__storage_type)); + __n -= __nw * __bits_per_word; + __result.__seg_ += __nw; + // do last word + if (__n > 0) + { + __first.__seg_ += __nw; + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = *__first.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b; + __result.__ctz_ = static_cast(__n); + } + } + return __result; +} + +template +__bit_iterator<_Cp, false> +__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) +{ + typedef __bit_iterator<_Cp, _IsConst> _In; + typedef typename _In::difference_type difference_type; + typedef typename _In::__storage_type __storage_type; + static const int __bits_per_word = _In::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__first.__ctz_ != 0) + { + unsigned __clz_f = __bits_per_word - __first.__ctz_; + difference_type __dn = _CUDA_VSTD::min(static_cast(__clz_f), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __storage_type __b = *__first.__seg_ & __m; + unsigned __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __ddn = _CUDA_VSTD::min<__storage_type>(__dn, __clz_r); + __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); + *__result.__seg_ &= ~__m; + if (__result.__ctz_ > __first.__ctz_) + *__result.__seg_ |= __b << (__result.__ctz_ - __first.__ctz_); + else + *__result.__seg_ |= __b >> (__first.__ctz_ - __result.__ctz_); + __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__ddn + __result.__ctz_) % __bits_per_word); + __dn -= __ddn; + if (__dn > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __dn); + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b >> (__first.__ctz_ + __ddn); + __result.__ctz_ = static_cast(__dn); + } + ++__first.__seg_; + // __first.__ctz_ = 0; + } + // __first.__ctz_ == 0; + // do middle words + unsigned __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __m = ~__storage_type(0) << __result.__ctz_; + for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) + { + __storage_type __b = *__first.__seg_; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b << __result.__ctz_; + ++__result.__seg_; + *__result.__seg_ &= __m; + *__result.__seg_ |= __b >> __clz_r; + } + // do last word + if (__n > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = *__first.__seg_ & __m; + __storage_type __dn = _CUDA_VSTD::min(__n, static_cast(__clz_r)); + __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn)); + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b << __result.__ctz_; + __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__dn + __result.__ctz_) % __bits_per_word); + __n -= __dn; + if (__n > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __n); + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b >> __dn; + __result.__ctz_ = static_cast(__n); + } + } + } + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__bit_iterator<_Cp, false> +copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) +{ + if (__first.__ctz_ == __result.__ctz_) + return __copy_aligned(__first, __last, __result); + return __copy_unaligned(__first, __last, __result); +} + +// copy_backward + +template +__bit_iterator<_Cp, false> +__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) +{ + typedef __bit_iterator<_Cp, _IsConst> _In; + typedef typename _In::difference_type difference_type; + typedef typename _In::__storage_type __storage_type; + const int __bits_per_word = _In::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__last.__ctz_ != 0) + { + difference_type __dn = _CUDA_VSTD::min(static_cast(__last.__ctz_), __n); + __n -= __dn; + unsigned __clz = __bits_per_word - __last.__ctz_; + __storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz); + __storage_type __b = *__last.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b; + __result.__ctz_ = static_cast(((-__dn & (__bits_per_word - 1)) + + __result.__ctz_) % __bits_per_word); + // __last.__ctz_ = 0 + } + // __last.__ctz_ == 0 || __n == 0 + // __result.__ctz_ == 0 || __n == 0 + // do middle words + __storage_type __nw = __n / __bits_per_word; + __result.__seg_ -= __nw; + __last.__seg_ -= __nw; + _CUDA_VSTD::memmove(_CUDA_VSTD::__to_raw_pointer(__result.__seg_), + _CUDA_VSTD::__to_raw_pointer(__last.__seg_), + __nw * sizeof(__storage_type)); + __n -= __nw * __bits_per_word; + // do last word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) << (__bits_per_word - __n); + __storage_type __b = *--__last.__seg_ & __m; + *--__result.__seg_ &= ~__m; + *__result.__seg_ |= __b; + __result.__ctz_ = static_cast(-__n & (__bits_per_word - 1)); + } + } + return __result; +} + +template +__bit_iterator<_Cp, false> +__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, + __bit_iterator<_Cp, false> __result) +{ + typedef __bit_iterator<_Cp, _IsConst> _In; + typedef typename _In::difference_type difference_type; + typedef typename _In::__storage_type __storage_type; + const int __bits_per_word = _In::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__last.__ctz_ != 0) + { + difference_type __dn = _CUDA_VSTD::min(static_cast(__last.__ctz_), __n); + __n -= __dn; + unsigned __clz_l = __bits_per_word - __last.__ctz_; + __storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_l); + __storage_type __b = *__last.__seg_ & __m; + unsigned __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __ddn = _CUDA_VSTD::min(__dn, static_cast(__result.__ctz_)); + if (__ddn > 0) + { + __m = (~__storage_type(0) << (__result.__ctz_ - __ddn)) & (~__storage_type(0) >> __clz_r); + *__result.__seg_ &= ~__m; + if (__result.__ctz_ > __last.__ctz_) + *__result.__seg_ |= __b << (__result.__ctz_ - __last.__ctz_); + else + *__result.__seg_ |= __b >> (__last.__ctz_ - __result.__ctz_); + __result.__ctz_ = static_cast(((-__ddn & (__bits_per_word - 1)) + + __result.__ctz_) % __bits_per_word); + __dn -= __ddn; + } + if (__dn > 0) + { + // __result.__ctz_ == 0 + --__result.__seg_; + __result.__ctz_ = static_cast(-__dn & (__bits_per_word - 1)); + __m = ~__storage_type(0) << __result.__ctz_; + *__result.__seg_ &= ~__m; + __last.__ctz_ -= __dn + __ddn; + *__result.__seg_ |= __b << (__result.__ctz_ - __last.__ctz_); + } + // __last.__ctz_ = 0 + } + // __last.__ctz_ == 0 || __n == 0 + // __result.__ctz_ != 0 || __n == 0 + // do middle words + unsigned __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __m = ~__storage_type(0) >> __clz_r; + for (; __n >= __bits_per_word; __n -= __bits_per_word) + { + __storage_type __b = *--__last.__seg_; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b >> __clz_r; + *--__result.__seg_ &= __m; + *__result.__seg_ |= __b << __result.__ctz_; + } + // do last word + if (__n > 0) + { + __m = ~__storage_type(0) << (__bits_per_word - __n); + __storage_type __b = *--__last.__seg_ & __m; + __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __dn = _CUDA_VSTD::min(__n, static_cast(__result.__ctz_)); + __m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r); + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b >> (__bits_per_word - __result.__ctz_); + __result.__ctz_ = static_cast(((-__dn & (__bits_per_word - 1)) + + __result.__ctz_) % __bits_per_word); + __n -= __dn; + if (__n > 0) + { + // __result.__ctz_ == 0 + --__result.__seg_; + __result.__ctz_ = static_cast(-__n & (__bits_per_word - 1)); + __m = ~__storage_type(0) << __result.__ctz_; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b << (__result.__ctz_ - (__bits_per_word - __n - __dn)); + } + } + } + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__bit_iterator<_Cp, false> +copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) +{ + if (__last.__ctz_ == __result.__ctz_) + return __copy_backward_aligned(__first, __last, __result); + return __copy_backward_unaligned(__first, __last, __result); +} + +// move + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__bit_iterator<_Cp, false> +move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) +{ + return _CUDA_VSTD::copy(__first, __last, __result); +} + +// move_backward + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__bit_iterator<_Cp, false> +move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) +{ + return _CUDA_VSTD::copy_backward(__first, __last, __result); +} + +// swap_ranges + +template +__bit_iterator<__C2, false> +__swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last, + __bit_iterator<__C2, false> __result) +{ + typedef __bit_iterator<__C1, false> _I1; + typedef typename _I1::difference_type difference_type; + typedef typename _I1::__storage_type __storage_type; + const int __bits_per_word = _I1::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__first.__ctz_ != 0) + { + unsigned __clz = __bits_per_word - __first.__ctz_; + difference_type __dn = _CUDA_VSTD::min(static_cast(__clz), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn)); + __storage_type __b1 = *__first.__seg_ & __m; + *__first.__seg_ &= ~__m; + __storage_type __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b1; + *__first.__seg_ |= __b2; + __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__dn + __result.__ctz_) % __bits_per_word); + ++__first.__seg_; + // __first.__ctz_ = 0; + } + // __first.__ctz_ == 0; + // do middle words + for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_, ++__result.__seg_) + swap(*__first.__seg_, *__result.__seg_); + // do last word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b1 = *__first.__seg_ & __m; + *__first.__seg_ &= ~__m; + __storage_type __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b1; + *__first.__seg_ |= __b2; + __result.__ctz_ = static_cast(__n); + } + } + return __result; +} + +template +__bit_iterator<__C2, false> +__swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last, + __bit_iterator<__C2, false> __result) +{ + typedef __bit_iterator<__C1, false> _I1; + typedef typename _I1::difference_type difference_type; + typedef typename _I1::__storage_type __storage_type; + const int __bits_per_word = _I1::__bits_per_word; + difference_type __n = __last - __first; + if (__n > 0) + { + // do first word + if (__first.__ctz_ != 0) + { + unsigned __clz_f = __bits_per_word - __first.__ctz_; + difference_type __dn = _CUDA_VSTD::min(static_cast(__clz_f), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __storage_type __b1 = *__first.__seg_ & __m; + *__first.__seg_ &= ~__m; + unsigned __clz_r = __bits_per_word - __result.__ctz_; + __storage_type __ddn = _CUDA_VSTD::min<__storage_type>(__dn, __clz_r); + __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); + __storage_type __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + if (__result.__ctz_ > __first.__ctz_) + { + unsigned __s = __result.__ctz_ - __first.__ctz_; + *__result.__seg_ |= __b1 << __s; + *__first.__seg_ |= __b2 >> __s; + } + else + { + unsigned __s = __first.__ctz_ - __result.__ctz_; + *__result.__seg_ |= __b1 >> __s; + *__first.__seg_ |= __b2 << __s; + } + __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__ddn + __result.__ctz_) % __bits_per_word); + __dn -= __ddn; + if (__dn > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __dn); + __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + unsigned __s = __first.__ctz_ + __ddn; + *__result.__seg_ |= __b1 >> __s; + *__first.__seg_ |= __b2 << __s; + __result.__ctz_ = static_cast(__dn); + } + ++__first.__seg_; + // __first.__ctz_ = 0; + } + // __first.__ctz_ == 0; + // do middle words + __storage_type __m = ~__storage_type(0) << __result.__ctz_; + unsigned __clz_r = __bits_per_word - __result.__ctz_; + for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) + { + __storage_type __b1 = *__first.__seg_; + __storage_type __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b1 << __result.__ctz_; + *__first.__seg_ = __b2 >> __result.__ctz_; + ++__result.__seg_; + __b2 = *__result.__seg_ & ~__m; + *__result.__seg_ &= __m; + *__result.__seg_ |= __b1 >> __clz_r; + *__first.__seg_ |= __b2 << __clz_r; + } + // do last word + if (__n > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b1 = *__first.__seg_ & __m; + *__first.__seg_ &= ~__m; + __storage_type __dn = _CUDA_VSTD::min<__storage_type>(__n, __clz_r); + __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn)); + __storage_type __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b1 << __result.__ctz_; + *__first.__seg_ |= __b2 >> __result.__ctz_; + __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; + __result.__ctz_ = static_cast((__dn + __result.__ctz_) % __bits_per_word); + __n -= __dn; + if (__n > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __n); + __b2 = *__result.__seg_ & __m; + *__result.__seg_ &= ~__m; + *__result.__seg_ |= __b1 >> __dn; + *__first.__seg_ |= __b2 << __dn; + __result.__ctz_ = static_cast(__n); + } + } + } + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__bit_iterator<__C2, false> +swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1, + __bit_iterator<__C2, false> __first2) +{ + if (__first1.__ctz_ == __first2.__ctz_) + return __swap_ranges_aligned(__first1, __last1, __first2); + return __swap_ranges_unaligned(__first1, __last1, __first2); +} + +// rotate + +template +struct __bit_array +{ + typedef typename _Cp::difference_type difference_type; + typedef typename _Cp::__storage_type __storage_type; + typedef typename _Cp::__storage_pointer __storage_pointer; + typedef typename _Cp::iterator iterator; + static const unsigned __bits_per_word = _Cp::__bits_per_word; + static const unsigned _Np = 4; + + difference_type __size_; + __storage_type __word_[_Np]; + + _LIBCUDACXX_INLINE_VISIBILITY static difference_type capacity() + {return static_cast(_Np * __bits_per_word);} + _LIBCUDACXX_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {} + _LIBCUDACXX_INLINE_VISIBILITY iterator begin() + { + return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0); + } + _LIBCUDACXX_INLINE_VISIBILITY iterator end() + { + return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word, + static_cast(__size_ % __bits_per_word)); + } +}; + +template +__bit_iterator<_Cp, false> +rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last) +{ + typedef __bit_iterator<_Cp, false> _I1; + typedef typename _I1::difference_type difference_type; + difference_type __d1 = __middle - __first; + difference_type __d2 = __last - __middle; + _I1 __r = __first + __d2; + while (__d1 != 0 && __d2 != 0) + { + if (__d1 <= __d2) + { + if (__d1 <= __bit_array<_Cp>::capacity()) + { + __bit_array<_Cp> __b(__d1); + _CUDA_VSTD::copy(__first, __middle, __b.begin()); + _CUDA_VSTD::copy(__b.begin(), __b.end(), _CUDA_VSTD::copy(__middle, __last, __first)); + break; + } + else + { + __bit_iterator<_Cp, false> __mp = _CUDA_VSTD::swap_ranges(__first, __middle, __middle); + __first = __middle; + __middle = __mp; + __d2 -= __d1; + } + } + else + { + if (__d2 <= __bit_array<_Cp>::capacity()) + { + __bit_array<_Cp> __b(__d2); + _CUDA_VSTD::copy(__middle, __last, __b.begin()); + _CUDA_VSTD::copy_backward(__b.begin(), __b.end(), _CUDA_VSTD::copy_backward(__first, __middle, __last)); + break; + } + else + { + __bit_iterator<_Cp, false> __mp = __first + __d2; + _CUDA_VSTD::swap_ranges(__first, __mp, __middle); + __first = __mp; + __d1 -= __d2; + } + } + } + return __r; +} + +// equal + +template +bool +__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, + __bit_iterator<_Cp, _IC2> __first2) +{ + typedef __bit_iterator<_Cp, _IC1> _It; + typedef typename _It::difference_type difference_type; + typedef typename _It::__storage_type __storage_type; + static const int __bits_per_word = _It::__bits_per_word; + difference_type __n = __last1 - __first1; + if (__n > 0) + { + // do first word + if (__first1.__ctz_ != 0) + { + unsigned __clz_f = __bits_per_word - __first1.__ctz_; + difference_type __dn = _CUDA_VSTD::min(static_cast(__clz_f), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); + __storage_type __b = *__first1.__seg_ & __m; + unsigned __clz_r = __bits_per_word - __first2.__ctz_; + __storage_type __ddn = _CUDA_VSTD::min<__storage_type>(__dn, __clz_r); + __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); + if (__first2.__ctz_ > __first1.__ctz_) + { + if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_))) + return false; + } + else + { + if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_))) + return false; + } + __first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word; + __first2.__ctz_ = static_cast((__ddn + __first2.__ctz_) % __bits_per_word); + __dn -= __ddn; + if (__dn > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __dn); + if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ + __ddn))) + return false; + __first2.__ctz_ = static_cast(__dn); + } + ++__first1.__seg_; + // __first1.__ctz_ = 0; + } + // __first1.__ctz_ == 0; + // do middle words + unsigned __clz_r = __bits_per_word - __first2.__ctz_; + __storage_type __m = ~__storage_type(0) << __first2.__ctz_; + for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first1.__seg_) + { + __storage_type __b = *__first1.__seg_; + if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_)) + return false; + ++__first2.__seg_; + if ((*__first2.__seg_ & ~__m) != (__b >> __clz_r)) + return false; + } + // do last word + if (__n > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = *__first1.__seg_ & __m; + __storage_type __dn = _CUDA_VSTD::min(__n, static_cast(__clz_r)); + __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn)); + if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_)) + return false; + __first2.__seg_ += (__dn + __first2.__ctz_) / __bits_per_word; + __first2.__ctz_ = static_cast((__dn + __first2.__ctz_) % __bits_per_word); + __n -= __dn; + if (__n > 0) + { + __m = ~__storage_type(0) >> (__bits_per_word - __n); + if ((*__first2.__seg_ & __m) != (__b >> __dn)) + return false; + } + } + } + return true; +} + +template +bool +__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, + __bit_iterator<_Cp, _IC2> __first2) +{ + typedef __bit_iterator<_Cp, _IC1> _It; + typedef typename _It::difference_type difference_type; + typedef typename _It::__storage_type __storage_type; + static const int __bits_per_word = _It::__bits_per_word; + difference_type __n = __last1 - __first1; + if (__n > 0) + { + // do first word + if (__first1.__ctz_ != 0) + { + unsigned __clz = __bits_per_word - __first1.__ctz_; + difference_type __dn = _CUDA_VSTD::min(static_cast(__clz), __n); + __n -= __dn; + __storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz - __dn)); + if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m)) + return false; + ++__first2.__seg_; + ++__first1.__seg_; + // __first1.__ctz_ = 0; + // __first2.__ctz_ = 0; + } + // __first1.__ctz_ == 0; + // __first2.__ctz_ == 0; + // do middle words + for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first1.__seg_, ++__first2.__seg_) + if (*__first2.__seg_ != *__first1.__seg_) + return false; + // do last word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m)) + return false; + } + } + return true; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2) +{ + if (__first1.__ctz_ == __first2.__ctz_) + return __equal_aligned(__first1, __last1, __first2); + return __equal_unaligned(__first1, __last1, __first2); +} + +template +class __bit_iterator +{ +public: + typedef typename _Cp::difference_type difference_type; + typedef bool value_type; + typedef __bit_iterator pointer; + typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference; + typedef random_access_iterator_tag iterator_category; + +private: + typedef typename _Cp::__storage_type __storage_type; + typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer, + typename _Cp::__storage_pointer>::type __storage_pointer; + static const unsigned __bits_per_word = _Cp::__bits_per_word; + + __storage_pointer __seg_; + unsigned __ctz_; + +public: + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator() noexcept +#if _LIBCUDACXX_STD_VER > 11 + : __seg_(nullptr), __ctz_(0) +#endif + {} + // avoid re-declaring a copy constructor for the non-const version. + using __type_for_copy_to_const = + _If<_IsConst, __bit_iterator<_Cp, false>, struct __private_nat>; + + _LIBCUDACXX_INLINE_VISIBILITY + __bit_iterator(const __type_for_copy_to_const& __it) noexcept + : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} + + _LIBCUDACXX_INLINE_VISIBILITY reference operator*() const noexcept + {return reference(__seg_, __storage_type(1) << __ctz_);} + + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator& operator++() + { + if (__ctz_ != __bits_per_word-1) + ++__ctz_; + else + { + __ctz_ = 0; + ++__seg_; + } + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator operator++(int) + { + __bit_iterator __tmp = *this; + ++(*this); + return __tmp; + } + + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator& operator--() + { + if (__ctz_ != 0) + --__ctz_; + else + { + __ctz_ = __bits_per_word - 1; + --__seg_; + } + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator operator--(int) + { + __bit_iterator __tmp = *this; + --(*this); + return __tmp; + } + + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator& operator+=(difference_type __n) + { + if (__n >= 0) + __seg_ += (__n + __ctz_) / __bits_per_word; + else + __seg_ += static_cast(__n - __bits_per_word + __ctz_ + 1) + / static_cast(__bits_per_word); + __n &= (__bits_per_word - 1); + __ctz_ = static_cast((__n + __ctz_) % __bits_per_word); + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator& operator-=(difference_type __n) + { + return *this += -__n; + } + + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator operator+(difference_type __n) const + { + __bit_iterator __t(*this); + __t += __n; + return __t; + } + + _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator operator-(difference_type __n) const + { + __bit_iterator __t(*this); + __t -= __n; + return __t; + } + + _LIBCUDACXX_INLINE_VISIBILITY + friend __bit_iterator operator+(difference_type __n, const __bit_iterator& __it) {return __it + __n;} + + _LIBCUDACXX_INLINE_VISIBILITY + friend difference_type operator-(const __bit_iterator& __x, const __bit_iterator& __y) + {return (__x.__seg_ - __y.__seg_) * __bits_per_word + __x.__ctz_ - __y.__ctz_;} + + _LIBCUDACXX_INLINE_VISIBILITY reference operator[](difference_type __n) const {return *(*this + __n);} + + _LIBCUDACXX_INLINE_VISIBILITY friend bool operator==(const __bit_iterator& __x, const __bit_iterator& __y) + {return __x.__seg_ == __y.__seg_ && __x.__ctz_ == __y.__ctz_;} + + _LIBCUDACXX_INLINE_VISIBILITY friend bool operator!=(const __bit_iterator& __x, const __bit_iterator& __y) + {return !(__x == __y);} + + _LIBCUDACXX_INLINE_VISIBILITY friend bool operator<(const __bit_iterator& __x, const __bit_iterator& __y) + {return __x.__seg_ < __y.__seg_ || (__x.__seg_ == __y.__seg_ && __x.__ctz_ < __y.__ctz_);} + + _LIBCUDACXX_INLINE_VISIBILITY friend bool operator>(const __bit_iterator& __x, const __bit_iterator& __y) + {return __y < __x;} + + _LIBCUDACXX_INLINE_VISIBILITY friend bool operator<=(const __bit_iterator& __x, const __bit_iterator& __y) + {return !(__y < __x);} + + _LIBCUDACXX_INLINE_VISIBILITY friend bool operator>=(const __bit_iterator& __x, const __bit_iterator& __y) + {return !(__x < __y);} + +private: + _LIBCUDACXX_INLINE_VISIBILITY + __bit_iterator(__storage_pointer __s, unsigned __ctz) noexcept + : __seg_(__s), __ctz_(__ctz) {} + + friend typename _Cp::__self; + + friend class __bit_reference<_Cp>; + friend class __bit_const_reference<_Cp>; + friend class __bit_iterator<_Cp, true>; + template friend struct __bit_array; + template friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); + template friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); + template friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first, + __bit_iterator<_Dp, _IC> __last, + __bit_iterator<_Dp, false> __result); + template friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>, + __bit_iterator<__C1, false>, + __bit_iterator<__C2, false>); + template friend __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false>, + __bit_iterator<__C1, false>, + __bit_iterator<__C2, false>); + template friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>, + __bit_iterator<__C1, false>, + __bit_iterator<__C2, false>); + template friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>, + __bit_iterator<_Dp, false>, + __bit_iterator<_Dp, false>); + template friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>, + __bit_iterator<_Dp, _IC1>, + __bit_iterator<_Dp, _IC2>); + template friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>, + __bit_iterator<_Dp, _IC1>, + __bit_iterator<_Dp, _IC2>); + template friend bool equal(__bit_iterator<_Dp, _IC1>, + __bit_iterator<_Dp, _IC1>, + __bit_iterator<_Dp, _IC2>); + template friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>, + typename _Dp::size_type); + template friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>, + typename _Dp::size_type); + template friend typename __bit_iterator<_Dp, _IC>::difference_type + __count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); + template friend typename __bit_iterator<_Dp, _IC>::difference_type + __count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); +}; + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX___BIT_REFERENCE diff --git a/cuda_toolkit/include/__bsd_locale_defaults.h b/cuda_toolkit/include/__bsd_locale_defaults.h new file mode 100644 index 0000000000000000000000000000000000000000..128c049b38be04b5a246a80b1d82cd3fc195329b --- /dev/null +++ b/cuda_toolkit/include/__bsd_locale_defaults.h @@ -0,0 +1,40 @@ +// -*- C++ -*- +//===---------------------- __bsd_locale_defaults.h -----------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// The BSDs have lots of *_l functions. We don't want to define those symbols +// on other platforms though, for fear of conflicts with user code. So here, +// we will define the mapping from an internal macro to the real BSD symbol. +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_BSD_LOCALE_DEFAULTS_H +#define _LIBCUDACXX_BSD_LOCALE_DEFAULTS_H + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#define __libcpp_mb_cur_max_l(loc) MB_CUR_MAX_L(loc) +#define __libcpp_btowc_l(ch, loc) btowc_l(ch, loc) +#define __libcpp_wctob_l(wch, loc) wctob_l(wch, loc) +#define __libcpp_wcsnrtombs_l(dst, src, nwc, len, ps, loc) wcsnrtombs_l(dst, src, nwc, len, ps, loc) +#define __libcpp_wcrtomb_l(src, wc, ps, loc) wcrtomb_l(src, wc, ps, loc) +#define __libcpp_mbsnrtowcs_l(dst, src, nms, len, ps, loc) mbsnrtowcs_l(dst, src, nms, len, ps, loc) +#define __libcpp_mbrtowc_l(pwc, s, n, ps, l) mbrtowc_l(pwc, s, n, ps, l) +#define __libcpp_mbtowc_l(pwc, pmb, max, l) mbtowc_l(pwc, pmb, max, l) +#define __libcpp_mbrlen_l(s, n, ps, l) mbrlen_l(s, n, ps, l) +#define __libcpp_localeconv_l(l) localeconv_l(l) +#define __libcpp_mbsrtowcs_l(dest, src, len, ps, l) mbsrtowcs_l(dest, src, len, ps, l) +#define __libcpp_snprintf_l(...) snprintf_l(__VA_ARGS__) +#define __libcpp_asprintf_l(...) asprintf_l(__VA_ARGS__) +#define __libcpp_sscanf_l(...) sscanf_l(__VA_ARGS__) + +#endif // _LIBCUDACXX_BSD_LOCALE_DEFAULTS_H diff --git a/cuda_toolkit/include/__bsd_locale_fallbacks.h b/cuda_toolkit/include/__bsd_locale_fallbacks.h new file mode 100644 index 0000000000000000000000000000000000000000..a52324f0db1f86cca77f42316900a8933c1c9859 --- /dev/null +++ b/cuda_toolkit/include/__bsd_locale_fallbacks.h @@ -0,0 +1,143 @@ +// -*- C++ -*- +//===---------------------- __bsd_locale_fallbacks.h ----------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// The BSDs have lots of *_l functions. This file provides reimplementations +// of those functions for non-BSD platforms. +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_BSD_LOCALE_FALLBACKS_DEFAULTS_H +#define _LIBCUDACXX_BSD_LOCALE_FALLBACKS_DEFAULTS_H + +#include +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +inline _LIBCUDACXX_INLINE_VISIBILITY +decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return MB_CUR_MAX; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +wint_t __libcpp_btowc_l(int __c, locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return btowc(__c); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +int __libcpp_wctob_l(wint_t __c, locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return wctob(__c); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +size_t __libcpp_wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc, + size_t __len, mbstate_t *__ps, locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return wcsnrtombs(__dest, __src, __nwc, __len, __ps); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +size_t __libcpp_wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return wcrtomb(__s, __wc, __ps); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +size_t __libcpp_mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms, + size_t __len, mbstate_t *__ps, locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return mbsnrtowcs(__dest, __src, __nms, __len, __ps); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +size_t __libcpp_mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n, + mbstate_t *__ps, locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return mbrtowc(__pwc, __s, __n, __ps); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +int __libcpp_mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return mbtowc(__pwc, __pmb, __max); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +size_t __libcpp_mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return mbrlen(__s, __n, __ps); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +lconv *__libcpp_localeconv_l(locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return localeconv(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len, + mbstate_t *__ps, locale_t __l) +{ + __libcpp_locale_guard __current(__l); + return mbsrtowcs(__dest, __src, __len, __ps); +} + +inline +int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) { + va_list __va; + va_start(__va, __format); + __libcpp_locale_guard __current(__l); + int __res = vsnprintf(__s, __n, __format, __va); + va_end(__va); + return __res; +} + +inline +int __libcpp_asprintf_l(char **__s, locale_t __l, const char *__format, ...) { + va_list __va; + va_start(__va, __format); + __libcpp_locale_guard __current(__l); + int __res = vasprintf(__s, __format, __va); + va_end(__va); + return __res; +} + +inline +int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { + va_list __va; + va_start(__va, __format); + __libcpp_locale_guard __current(__l); + int __res = vsscanf(__s, __format, __va); + va_end(__va); + return __res; +} + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_BSD_LOCALE_FALLBACKS_DEFAULTS_H diff --git a/cuda_toolkit/include/__cccl_config b/cuda_toolkit/include/__cccl_config new file mode 100644 index 0000000000000000000000000000000000000000..c1d2a381a581873a48fc0471fc715439056cbbf2 --- /dev/null +++ b/cuda_toolkit/include/__cccl_config @@ -0,0 +1,194 @@ +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef __CCCL_CONFIG +#define __CCCL_CONFIG + +// Determine the host compiler +#if defined(__INTEL_LLVM_COMPILER) +# define _CCCL_COMPILER_ICC_LLVM +#elif defined(__INTEL_COMPILER) +# define _CCCL_COMPILER_ICC +#elif defined(__NVCOMPILER) +# define _CCCL_COMPILER_NVHPC +#elif defined(__clang__) +# define _CCCL_COMPILER_CLANG +#elif defined(__GNUC__) +# define _CCCL_COMPILER_GCC +#elif defined(_MSC_VER) +# define _CCCL_COMPILER_MSVC +#elif defined(__IBMCPP__) +# define _CCCL_COMPILER_IBM +#elif defined(__CUDACC_RTC__) +# define _CCCL_COMPILER_NVRTC +#endif + +// Convenient shortcut to determine which version of MSVC we are dealing with +#if defined(_CCCL_COMPILER_MSVC) +# if _MSC_VER < 1917 +# define _CCCL_COMPILER_MSVC_2017 +# elif _MSC_VER < 1930 +# define _CCCL_COMPILER_MSVC_2019 +# else // _MSC_VER < 1940 +# define _CCCL_COMPILER_MSVC_2022 +# endif // _MSC_VER < 1940 +#endif // _CCCL_COMPILER_MSVC + +// Determine the cuda compiler +#if defined(__NVCC__) +# define _CCCL_CUDA_COMPILER_NVCC +#elif defined(_NVHPC_CUDA) +# define _CCCL_CUDA_COMPILER_NVHPC +#elif defined(__CUDA__) && defined(_CCCL_COMPILER_CLANG) +# define _CCCL_CUDA_COMPILER_CLANG +#endif + +// Shorthand to check whether there is a cuda compiler available +#if defined(_CCCL_CUDA_COMPILER_NVCC) || defined(_CCCL_CUDA_COMPILER_NVHPC) || defined(_CCCL_CUDA_COMPILER_CLANG) \ + || defined(_CCCL_COMPILER_NVRTC) +# define _CCCL_CUDA_COMPILER +#endif // cuda compiler available + +// Enforce that cccl headers are treated as system headers +#if defined(_CCCL_COMPILER_GCC) || defined(_CCCL_COMPILER_NVHPC) || defined(_CCCL_COMPILER_ICC) \ + || defined(_CCCL_COMPILER_ICC_LLVM) +# define _CCCL_FORCE_SYSTEM_HEADER_GCC +#elif defined(_CCCL_COMPILER_CLANG) +# define _CCCL_FORCE_SYSTEM_HEADER_CLANG +#elif defined(_CCCL_COMPILER_MSVC) +# define _CCCL_FORCE_SYSTEM_HEADER_MSVC +#endif // other compilers + +// Potentially enable that cccl headers are treated as system headers +#if !defined(_CCCL_NO_SYSTEM_HEADER) \ + && !(defined(_CCCL_COMPILER_MSVC) && defined(_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING)) \ + && !defined(_CCCL_COMPILER_NVRTC) && !defined(_LIBCUDACXX_DISABLE_PRAGMA_GCC_SYSTEM_HEADER) +# if defined(_CCCL_COMPILER_GCC) || defined(_CCCL_COMPILER_NVHPC) || defined(_CCCL_COMPILER_ICC) \ + || defined(_CCCL_COMPILER_ICC_LLVM) +# define _CCCL_IMPLICIT_SYSTEM_HEADER_GCC +# elif defined(_CCCL_COMPILER_CLANG) +# define _CCCL_IMPLICIT_SYSTEM_HEADER_CLANG +# elif defined(_CCCL_COMPILER_MSVC) +# define _CCCL_IMPLICIT_SYSTEM_HEADER_MSVC +# endif // other compilers +#endif // Use system header + +// Potentially silence all warnings from this header +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// Enable us to selectively silence host compiler warnings +#define _CCCL_TOSTRING2(_STR) #_STR +#define _CCCL_TOSTRING(_STR) _CCCL_TOSTRING2(_STR) +#ifdef _CCCL_COMPILER_CLANG +# define _CCCL_DIAG_PUSH _Pragma("clang diagnostic push") +# define _CCCL_DIAG_POP _Pragma("clang diagnostic pop") +# define _CCCL_DIAG_SUPPRESS_CLANG(str) _Pragma(_CCCL_TOSTRING(clang diagnostic ignored str)) +# define _CCCL_DIAG_SUPPRESS_GCC(str) +# define _CCCL_DIAG_SUPPRESS_NVHPC(str) +# define _CCCL_DIAG_SUPPRESS_MSVC(str) +#elif defined(_CCCL_COMPILER_GCC) +# define _CCCL_DIAG_PUSH _Pragma("GCC diagnostic push") +# define _CCCL_DIAG_POP _Pragma("GCC diagnostic pop") +# define _CCCL_DIAG_SUPPRESS_CLANG(str) +# define _CCCL_DIAG_SUPPRESS_GCC(str) _Pragma(_CCCL_TOSTRING(GCC diagnostic ignored str)) +# define _CCCL_DIAG_SUPPRESS_NVHPC(str) +# define _CCCL_DIAG_SUPPRESS_MSVC(str) +#elif defined(_CCCL_COMPILER_NVHPC) +# define _CCCL_DIAG_PUSH _Pragma("diagnostic push") +# define _CCCL_DIAG_POP _Pragma("diagnostic pop") +# define _CCCL_DIAG_SUPPRESS_CLANG(str) +# define _CCCL_DIAG_SUPPRESS_GCC(str) +# define _CCCL_DIAG_SUPPRESS_NVHPC(str) _Pragma(_CCCL_TOSTRING(diag_suppress str)) +# define _CCCL_DIAG_SUPPRESS_MSVC(str) +#elif defined(_CCCL_COMPILER_MSVC) +# define _CCCL_DIAG_PUSH __pragma(warning(push)) +# define _CCCL_DIAG_POP __pragma(warning(pop)) +# define _CCCL_DIAG_SUPPRESS_CLANG(str) +# define _CCCL_DIAG_SUPPRESS_GCC(str) +# define _CCCL_DIAG_SUPPRESS_NVHPC(str) +# define _CCCL_DIAG_SUPPRESS_MSVC(str) __pragma(warning(disable : str)) +#else +# define _CCCL_DIAG_PUSH +# define _CCCL_DIAG_POP +# define _CCCL_DIAG_SUPPRESS_CLANG(str) +# define _CCCL_DIAG_SUPPRESS_GCC(str) +# define _CCCL_DIAG_SUPPRESS_NVHPC(str) +# define _CCCL_DIAG_SUPPRESS_MSVC(str) +#endif + +// Convenient shortcuts to silence common warnings +#if defined(_CCCL_COMPILER_CLANG) +# define _CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH \ + _CCCL_DIAG_PUSH \ + _CCCL_DIAG_SUPPRESS_CLANG("-Wdeprecated") \ + _CCCL_DIAG_SUPPRESS_CLANG("-Wdeprecated-declarations") +# define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP _CCCL_DIAG_POP +#elif defined(_CCCL_COMPILER_GCC) +# define _CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH \ + _CCCL_DIAG_PUSH \ + _CCCL_DIAG_SUPPRESS_GCC("-Wdeprecated") \ + _CCCL_DIAG_SUPPRESS_GCC("-Wdeprecated-declarations") +# define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP _CCCL_DIAG_POP +#elif defined(_CCCL_COMPILER_MSVC) +# define _CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH \ + _CCCL_DIAG_PUSH \ + _CCCL_DIAG_SUPPRESS_MSVC(4996) +# define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP _CCCL_DIAG_POP +#else // !_CCCL_COMPILER_CLANG && !_CCCL_COMPILER_GCC +# define _CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH +# define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP +#endif // !_CCCL_COMPILER_CLANG && !_CCCL_COMPILER_GCC + +// Enable us to selectively silence cuda compiler warnings +#if defined(__CUDACC__) +# if !defined(_CCCL_CUDA_COMPILER_CLANG) +# define _CCCL_NV_DIAG_SUPPRESS(_WARNING) +# define _CCCL_NV_DIAG_DEFAULT(_WARNING) +# elif defined(__NVCC_DIAG_PRAGMA_SUPPORT__) +# if defined(_CCCL_COMPILER_MSVC) +# define _CCCL_NV_DIAG_SUPPRESS(_WARNING) __pragma(_CCCL_TOSTRING(nv_diag_suppress _WARNING)) +# define _CCCL_NV_DIAG_DEFAULT(_WARNING) __pragma(_CCCL_TOSTRING(nv_diag_default _WARNING)) +# else // ^^^ _CCCL_COMPILER_MSVC ^^^ / vvv !_CCCL_COMPILER_MSVC vvv +# define _CCCL_NV_DIAG_SUPPRESS(_WARNING) \ + _Pragma(_CCCL_TOSTRING(nv_diagnostic push)) _Pragma(_CCCL_TOSTRING(nv_diag_suppress _WARNING)) +# define _CCCL_NV_DIAG_DEFAULT(_WARNING) _Pragma(_CCCL_TOSTRING(nv_diagnostic pop)) +# endif // !_CCCL_COMPILER_MSVC +# elif defined(_CCCL_COMPILER_NVHPC) +# define _CCCL_NV_DIAG_SUPPRESS(_WARNING) \ + _Pragma(_CCCL_TOSTRING(diagnostic push)) _Pragma(_CCCL_TOSTRING(diag_suppress _WARNING)) +# define _CCCL_NV_DIAG_DEFAULT(_WARNING) _Pragma(_CCCL_TOSTRING(diagnostic pop)) +# else // ^^^ __NVCC_DIAG_PRAGMA_SUPPORT__ ^^^ / vvv !__NVCC_DIAG_PRAGMA_SUPPORT__ vvv +# if defined(_CCCL_COMPILER_MSVC_2017) // MSVC 2017 has issues with restoring the warning +# define _CCCL_NV_DIAG_SUPPRESS(_WARNING) __pragma(_CCCL_TOSTRING(diag_suppress _WARNING)) +# define _CCCL_NV_DIAG_DEFAULT(_WARNING) +# elif defined(_CCCL_COMPILER_MSVC) +# define _CCCL_NV_DIAG_SUPPRESS(_WARNING) __pragma(_CCCL_TOSTRING(diag_suppress _WARNING)) +# define _CCCL_NV_DIAG_DEFAULT(_WARNING) __pragma(_CCCL_TOSTRING(diag_default _WARNING)) +# else // ^^^ _CCCL_COMPILER_MSVC ^^^ / vvv !_CCCL_COMPILER_MSVC vvv +# define _CCCL_NV_DIAG_SUPPRESS(_WARNING) _Pragma(_CCCL_TOSTRING(diag_suppress _WARNING)) +# define _CCCL_NV_DIAG_DEFAULT(_WARNING) _Pragma(_CCCL_TOSTRING(diag_default _WARNING)) +# endif // !_CCCL_COMPILER_MSVC +# endif // !__NVCC_DIAG_PRAGMA_SUPPORT__ +#else // ^^^ __CUDACC__ ^^^ / vvv !__CUDACC__ vvv +# define _CCCL_NV_DIAG_SUPPRESS(_WARNING) +# define _CCCL_NV_DIAG_DEFAULT(_WARNING) +#endif // other compilers + +#include "__cccl/ptx_isa.h" +#include "__cccl/version.h" +#include "__cccl/visibility.h" + +#endif // __CCCL_CONFIG diff --git a/cuda_toolkit/include/__config b/cuda_toolkit/include/__config new file mode 100644 index 0000000000000000000000000000000000000000..7c04dc13eec71d441aa4a28a3cb3b9d40db3f3b5 --- /dev/null +++ b/cuda_toolkit/include/__config @@ -0,0 +1,2250 @@ +// -*- C++ -*- +//===--------------------------- __config ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CONFIG +#define _LIBCUDACXX_CONFIG + +#include "__cccl_config" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#if defined(__INTEL_LLVM_COMPILER) +# define _LIBCUDACXX_COMPILER_ICC_LLVM +#elif defined(__INTEL_COMPILER) +# define _LIBCUDACXX_COMPILER_ICC +#elif defined(__NVCOMPILER) +# define _LIBCUDACXX_COMPILER_NVHPC +#elif defined(__clang__) +# define _LIBCUDACXX_COMPILER_CLANG +# ifndef __apple_build_version__ +# define _LIBCUDACXX_CLANG_VER (__clang_major__ * 100 + __clang_minor__) +# endif +#elif defined(__GNUC__) +# define _LIBCUDACXX_COMPILER_GCC +#elif defined(_MSC_VER) +# define _LIBCUDACXX_COMPILER_MSVC +#elif defined(__IBMCPP__) +# define _LIBCUDACXX_COMPILER_IBM +#elif defined(__CUDACC_RTC__) +# define _LIBCUDACXX_COMPILER_NVRTC +#endif + +#if defined(_LIBCUDACXX_COMPILER_MSVC) +#if _MSC_VER < 1917 +#define _LIBCUDACXX_COMPILER_MSVC_2017 +#elif _MSC_VER < 1930 +#define _LIBCUDACXX_COMPILER_MSVC_2019 +#else +#define _LIBCUDACXX_COMPILER_MSVC_2022 +#endif +#endif // defined(_LIBCUDACXX_COMPILER_MSVC) + +#if defined(__NVCC__) +// This is not mutually exclusive with other compilers, as NVCC uses a host +// compiler. +# define _LIBCUDACXX_COMPILER_NVCC +#elif defined(_NVHPC_CUDA) +# define _LIBCUDACXX_COMPILER_NVHPC_CUDA +#elif defined(__CUDA__) && defined(_LIBCUDACXX_COMPILER_CLANG) +# define _LIBCUDACXX_COMPILER_CLANG_CUDA +#endif + +#ifdef __CUDACC__ +# define _LIBCUDACXX_CUDACC +# define _LIBCUDACXX_CUDACC_VER_MAJOR __CUDACC_VER_MAJOR__ +# define _LIBCUDACXX_CUDACC_VER_MINOR __CUDACC_VER_MINOR__ +# define _LIBCUDACXX_CUDACC_VER_BUILD __CUDACC_VER_BUILD__ +# define _LIBCUDACXX_CUDACC_VER \ + _LIBCUDACXX_CUDACC_VER_MAJOR * 100000 + _LIBCUDACXX_CUDACC_VER_MINOR * 1000 + \ + _LIBCUDACXX_CUDACC_VER_BUILD + +// TODO: Determine if this is necessary, I don't know why we automatically include this in +# if defined(__clang__) || defined(__FLT16_MANT_DIG__) +# include +# endif +#endif + +// Some convenience macros to filter CUDACC versions +#if defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1102000 +#define _LIBCUDACXX_CUDACC_BELOW_11_2 +#endif // defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1102000 +#if defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1103000 +#define _LIBCUDACXX_CUDACC_BELOW_11_3 +#endif // defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1103000 +#if defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1108000 +#define _LIBCUDACXX_CUDACC_BELOW_11_8 +#endif // defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1108000 +#if defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1203000 +#define _LIBCUDACXX_CUDACC_BELOW_12_3 +#endif // defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1203000 + +#if defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_HAS_PRAGMA_MSVC_WARNING +# if !defined(_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING) +# define _LIBCUDACXX_USE_PRAGMA_MSVC_WARNING +# endif // !_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING +#endif // _LIBCUDACXX_COMPILER_MSVC + +#ifdef __cplusplus + +// __config may be included in `extern "C"` contexts, switch back to include +extern "C++" { +#include +} + +#ifdef __GNUC__ +# define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) +#else +# define _GNUC_VER 0 +#endif + +#define _LIBCUDACXX_VERSION 10000 + +#ifndef _LIBCUDACXX_ABI_VERSION +# define _LIBCUDACXX_ABI_VERSION 1 +#endif + +#ifndef _LIBCUDACXX_STD_VER +# if defined(_MSC_VER) +# if _MSVC_LANG <= 201103L +# define _LIBCUDACXX_STD_VER 11 +# elif _MSVC_LANG <= 201402L +# define _LIBCUDACXX_STD_VER 14 +# elif _MSVC_LANG <= 201703L +# define _LIBCUDACXX_STD_VER 17 +# elif _MSVC_LANG <= 202002L +# define _LIBCUDACXX_STD_VER 20 +# else +# define _LIBCUDACXX_STD_VER 23 // current year, or date of c++2b ratification +# endif +# else +# if __cplusplus <= 201103L +# define _LIBCUDACXX_STD_VER 11 +# elif __cplusplus <= 201402L +# define _LIBCUDACXX_STD_VER 14 +# elif __cplusplus <= 201703L +# define _LIBCUDACXX_STD_VER 17 +# elif __cplusplus <= 202002L +# define _LIBCUDACXX_STD_VER 20 +# else +# define _LIBCUDACXX_STD_VER 23 // current year, or date of c++2b ratification +# endif +# endif +#endif // _LIBCUDACXX_STD_VER + +#if _LIBCUDACXX_STD_VER < 11 +# error libcu++ requires C++11 or later +#endif + +#if (defined(_LIBCUDACXX_COMPILER_NVHPC) && defined(__linux__)) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) + #define __ELF__ +#endif + +#if defined(__ELF__) +# define _LIBCUDACXX_OBJECT_FORMAT_ELF 1 +#elif defined(__MACH__) +# define _LIBCUDACXX_OBJECT_FORMAT_MACHO 1 +#elif defined(_WIN32) +# define _LIBCUDACXX_OBJECT_FORMAT_COFF 1 +#elif defined(__wasm__) +# define _LIBCUDACXX_OBJECT_FORMAT_WASM 1 +#else +# error Unknown object file format +#endif + +#if defined(_LIBCUDACXX_ABI_UNSTABLE) || _LIBCUDACXX_ABI_VERSION >= 2 || defined(__cuda_std__) +// Change short string representation so that string data starts at offset 0, +// improving its alignment in some cases. +# define _LIBCUDACXX_ABI_ALTERNATE_STRING_LAYOUT +// Fix deque iterator type in order to support incomplete types. +# define _LIBCUDACXX_ABI_INCOMPLETE_TYPES_IN_DEQUE +// Fix undefined behavior in how std::list stores its linked nodes. +# define _LIBCUDACXX_ABI_LIST_REMOVE_NODE_POINTER_UB +// Fix undefined behavior in how __tree stores its end and parent nodes. +# define _LIBCUDACXX_ABI_TREE_REMOVE_NODE_POINTER_UB +// Fix undefined behavior in how __hash_table stores its pointer types. +# define _LIBCUDACXX_ABI_FIX_UNORDERED_NODE_POINTER_UB +# define _LIBCUDACXX_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCUDACXX_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE +// Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr +// provided under the alternate keyword __nullptr, which changes the mangling +// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. +# define _LIBCUDACXX_ABI_ALWAYS_USE_CXX11_NULLPTR +// Define the `pointer_safety` enum as a C++11 strongly typed enumeration +// instead of as a class simulating an enum. If this option is enabled +// `pointer_safety` and `get_pointer_safety()` will no longer be available +// in C++03. +# define _LIBCUDACXX_ABI_POINTER_SAFETY_ENUM_TYPE +// Define a key function for `bad_function_call` in the library, to centralize +// its vtable and typeinfo to libc++ rather than having all other libraries +// using that class define their own copies. +# define _LIBCUDACXX_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +// Enable optimized version of __do_get_(un)signed which avoids redundant copies. +# define _LIBCUDACXX_ABI_OPTIMIZED_LOCALE_NUM_GET +// Use the smallest possible integer type to represent the index of the variant. +// Previously libc++ used "unsigned int" exclusively. +# define _LIBCUDACXX_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION +// Unstable attempt to provide a more optimized std::function +# define _LIBCUDACXX_ABI_OPTIMIZED_FUNCTION +// All the regex constants must be distinct and nonzero. +# define _LIBCUDACXX_ABI_REGEX_CONSTANTS_NONZERO +#elif _LIBCUDACXX_ABI_VERSION == 1 +# if !defined(_LIBCUDACXX_OBJECT_FORMAT_COFF) +// Enable compiling copies of now inline methods into the dylib to support +// applications compiled against older libraries. This is unnecessary with +// COFF dllexport semantics, since dllexport forces a non-inline definition +// of inline functions to be emitted anyway. Our own non-inline copy would +// conflict with the dllexport-emitted copy, so we disable it. +# define _LIBCUDACXX_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS +# endif +#endif + +#ifndef __has_attribute +#define __has_attribute(__x) 0 +#endif + +#ifndef __has_builtin +#define __has_builtin(__x) 0 +#endif + +#ifndef __has_extension +#define __has_extension(__x) 0 +#endif + +#ifndef __has_feature +#define __has_feature(__x) 0 +#endif + +#ifndef __has_cpp_attribute +#define __has_cpp_attribute(__x) 0 +#endif + +// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by +// the compiler and '1' otherwise. +#ifndef __is_identifier +#define __is_identifier(__x) 1 +#endif + +#ifndef __has_declspec_attribute +#define __has_declspec_attribute(__x) 0 +#endif + +#define __has_keyword(__x) !(__is_identifier(__x)) + +#ifndef __has_include +#define __has_include(...) 0 +#endif + +#if !defined(_LIBCUDACXX_COMPILER_NVCC) && !defined(_LIBCUDACXX_COMPILER_NVRTC) +// If NVCC is not being used can safely use `long double` without warnings +# define _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE +// NVCC does not have a way of silencing non '_' prefixed UDLs +# define _LIBCUDACXX_HAS_STL_LITERALS +#endif + +#if defined(_LIBCUDACXX_COMPILER_GCC) && __cplusplus < 201103L +#error "libc++ does not support using GCC with C++03. Please enable C++11" +#endif + +// FIXME: ABI detection should be done via compiler builtin macros. This +// is just a placeholder until Clang implements such macros. For now assume +// that Windows compilers pretending to be MSVC++ target the Microsoft ABI, +// and allow the user to explicitly specify the ABI to handle cases where this +// heuristic falls short. +#if defined(_LIBCUDACXX_ABI_FORCE_ITANIUM) && defined(_LIBCUDACXX_ABI_FORCE_MICROSOFT) +# error "Only one of _LIBCUDACXX_ABI_FORCE_ITANIUM and _LIBCUDACXX_ABI_FORCE_MICROSOFT can be defined" +#elif defined(_LIBCUDACXX_ABI_FORCE_ITANIUM) +# define _LIBCUDACXX_ABI_ITANIUM +#elif defined(_LIBCUDACXX_ABI_FORCE_MICROSOFT) +# define _LIBCUDACXX_ABI_MICROSOFT +#else +# if defined(_WIN32) && defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_ABI_MICROSOFT +# else +# define _LIBCUDACXX_ABI_ITANIUM +# endif +#endif + +#if defined(_LIBCUDACXX_ABI_MICROSOFT) && !defined(_LIBCUDACXX_NO_VCRUNTIME) +# define _LIBCUDACXX_ABI_VCRUNTIME +#endif + +// Need to detect which libc we're using if we're on Linux. +#if defined(__linux__) +# include +# if defined(__GLIBC_PREREQ) +# define _LIBCUDACXX_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) +# else +# define _LIBCUDACXX_GLIBC_PREREQ(a, b) 0 +# endif // defined(__GLIBC_PREREQ) +#endif // defined(__linux__) + +#ifdef __LITTLE_ENDIAN__ +# if __LITTLE_ENDIAN__ +# define _LIBCUDACXX_LITTLE_ENDIAN +# endif // __LITTLE_ENDIAN__ +#endif // __LITTLE_ENDIAN__ + +#ifdef __BIG_ENDIAN__ +# if __BIG_ENDIAN__ +# define _LIBCUDACXX_BIG_ENDIAN +# endif // __BIG_ENDIAN__ +#endif // __BIG_ENDIAN__ + +#ifdef __BYTE_ORDER__ +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define _LIBCUDACXX_LITTLE_ENDIAN +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define _LIBCUDACXX_BIG_ENDIAN +# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#endif // __BYTE_ORDER__ + +#ifdef __FreeBSD__ +# include +# if _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCUDACXX_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCUDACXX_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# ifndef __LONG_LONG_SUPPORTED +# define _LIBCUDACXX_HAS_NO_LONG_LONG +# endif // __LONG_LONG_SUPPORTED +#endif // __FreeBSD__ + +#ifdef __NetBSD__ +# include +# if _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCUDACXX_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCUDACXX_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCUDACXX_HAS_QUICK_EXIT +#endif // __NetBSD__ + +#if defined(_WIN32) +# define _LIBCUDACXX_WIN32API +# define _LIBCUDACXX_LITTLE_ENDIAN +# define _LIBCUDACXX_SHORT_WCHAR 1 +// Both MinGW and native MSVC provide a "MSVC"-like environment +# define _LIBCUDACXX_MSVCRT_LIKE +// If mingw not explicitly detected, assume using MS C runtime only if +// a MS compatibility version is specified. +# if defined(_LIBCUDACXX_COMPILER_MSVC) && !defined(__MINGW32__) +# define _LIBCUDACXX_MSVCRT // Using Microsoft's C Runtime library +# endif +# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__)) +# define _LIBCUDACXX_HAS_BITSCAN64 +# endif +# define _LIBCUDACXX_HAS_OPEN_WITH_WCHAR +# if defined(_LIBCUDACXX_MSVCRT) +# define _LIBCUDACXX_HAS_QUICK_EXIT +# endif + +// Some CRT APIs are unavailable to store apps +# if defined(WINAPI_FAMILY) +# include +# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ + (!defined(WINAPI_PARTITION_SYSTEM) || \ + !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) +# define _LIBCUDACXX_WINDOWS_STORE_APP +# endif +# endif +#endif // defined(_WIN32) + +#ifdef __sun__ +# include +# ifdef _LITTLE_ENDIAN +# define _LIBCUDACXX_LITTLE_ENDIAN +# else +# define _LIBCUDACXX_BIG_ENDIAN +# endif +#endif // __sun__ + +#if defined(__CloudABI__) + // Certain architectures provide arc4random(). Prefer using + // arc4random() over /dev/{u,}random to make it possible to obtain + // random data even when using sandboxing mechanisms such as chroots, + // Capsicum, etc. +# define _LIBCUDACXX_USING_ARC4_RANDOM +#elif defined(__Fuchsia__) || defined(__wasi__) +# define _LIBCUDACXX_USING_GETENTROPY +#elif defined(__native_client__) + // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, + // including accesses to the special files under /dev. C++11's + // std::random_device is instead exposed through a NaCl syscall. +# define _LIBCUDACXX_USING_NACL_RANDOM +#elif defined(_LIBCUDACXX_WIN32API) +# define _LIBCUDACXX_USING_WIN32_RANDOM +#else +# define _LIBCUDACXX_USING_DEV_RANDOM +#endif + +#ifndef _LIBCUDACXX_LITTLE_ENDIAN +#if defined(_LIBCUDACXX_COMPILER_NVRTC) +# define _LIBCUDACXX_LITTLE_ENDIAN +#endif +#endif // _LIBCUDACXX_LITTLE_ENDIAN + +#if !defined(_LIBCUDACXX_LITTLE_ENDIAN) && !defined(_LIBCUDACXX_BIG_ENDIAN) +# include +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define _LIBCUDACXX_LITTLE_ENDIAN +# elif __BYTE_ORDER == __BIG_ENDIAN +# define _LIBCUDACXX_BIG_ENDIAN +# else // __BYTE_ORDER == __BIG_ENDIAN +# error unable to determine endian +# endif +#endif // !defined(_LIBCUDACXX_LITTLE_ENDIAN) && !defined(_LIBCUDACXX_BIG_ENDIAN) + +#if __has_attribute(__no_sanitize__) && !defined(_LIBCUDACXX_COMPILER_GCC) +# define _LIBCUDACXX_NO_CFI __attribute__((__no_sanitize__("cfi"))) +#else +# define _LIBCUDACXX_NO_CFI +#endif + +#if (defined(__ISO_C_VISIBLE) && __ISO_C_VISIBLE >= 2011) || __cplusplus >= 201103L +# if defined(__FreeBSD__) +# define _LIBCUDACXX_HAS_QUICK_EXIT +# define _LIBCUDACXX_HAS_C11_FEATURES +# elif defined(__Fuchsia__) || defined(__wasi__) +# define _LIBCUDACXX_HAS_QUICK_EXIT +# define _LIBCUDACXX_HAS_TIMESPEC_GET +# define _LIBCUDACXX_HAS_C11_FEATURES +# elif defined(__linux__) +# if !defined(_LIBCUDACXX_HAS_MUSL_LIBC) +# if _LIBCUDACXX_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) +# define _LIBCUDACXX_HAS_QUICK_EXIT +# endif +# if _LIBCUDACXX_GLIBC_PREREQ(2, 17) +# define _LIBCUDACXX_HAS_C11_FEATURES +# define _LIBCUDACXX_HAS_TIMESPEC_GET +# endif +# else // defined(_LIBCUDACXX_HAS_MUSL_LIBC) +# define _LIBCUDACXX_HAS_QUICK_EXIT +# define _LIBCUDACXX_HAS_TIMESPEC_GET +# define _LIBCUDACXX_HAS_C11_FEATURES +# endif +# endif // __linux__ +#endif + +#if defined(_LIBCUDACXX_COMPILER_NVRTC) +# define __alignof(x) alignof(x) +#endif // _LIBCUDACXX_COMPILER_NVRTC + +#if defined(_LIBCUDACXX_COMPILER_MSVC) +# define __alignof__ __alignof +#endif + +#define _LIBCUDACXX_ALIGNOF(_Tp) alignof(_Tp) +#define _LIBCUDACXX_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) + +#if defined(_LIBCUDACXX_COMPILER_MSVC) +# define _ALIGNAS_TYPE(x) alignas(x) +# define _ALIGNAS(x) __declspec(align(x)) +#elif __has_feature(cxx_alignas) +# define _ALIGNAS_TYPE(x) alignas(x) +# define _ALIGNAS(x) alignas(x) +#else +# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCUDACXX_ALIGNOF(x)))) +# define _ALIGNAS(x) __attribute__((__aligned__(x))) +#endif // !_LIBCUDACXX_COMPILER_MSVC && !__has_feature(cxx_alignas) + +// This is wrapped in __CUDA_ARCH__ to prevent error: "ignoring '#pragma unroll' +// [-Werror=unknown-pragmas]" +#if defined(__CUDA_ARCH__) +#if defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_PRAGMA_UNROLL(_N) __pragma(_LIBCUDACXX_TOSTRING(unroll _N)) +#else // ^^^ _LIBCUDACXX_COMPILER_MSVC ^^^ / vvv !_LIBCUDACXX_COMPILER_MSVC vvv +# define _LIBCUDACXX_PRAGMA_UNROLL(_N) _Pragma(_LIBCUDACXX_TOSTRING(unroll _N)) +#endif // !_LIBCUDACXX_COMPILER_MSVC +#else // ^^^ _LIBCUDACXX_CUDACC ^^^ / vvv !_LIBCUDACXX_CUDACCvvv +# define _LIBCUDACXX_PRAGMA_UNROLL(_N) +#endif // !__CUDA_ARCH__ + +#if defined(_LIBCUDACXX_COMPILER_MSVC) +#define _LIBCUDACXX_ALWAYS_INLINE __forceinline +#else +#define _LIBCUDACXX_ALWAYS_INLINE __attribute__ ((__always_inline__)) +#endif // !_LIBCUDACXX_COMPILER_MSVC + +#if defined(__cuda_std__) +#define _LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE(size, ptr) (size <= 8) +#elif defined(_LIBCUDACXX_COMPILER_CLANG) || defined(_LIBCUDACXX_COMPILER_GCC) +#define _LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE(...) __atomic_always_lock_free(__VA_ARGS__) +#endif // __cuda_std__ + +// https://bugs.llvm.org/show_bug.cgi?id=44517 +#define __check_builtin(__x) (__has_builtin(__##__x) || \ + __has_keyword(__##__x) || \ + __has_feature(__x)) + +// We work around old clang versions (before clang-10) not supporting __has_builtin via __check_builtin +// We work around old intel versions (before 2021.3) not supporting __has_builtin via __check_builtin +// We work around old nvhpc versions (before 2022.11) not supporting __has_builtin via __check_builtin +// MSVC needs manual handling, has no real way of checking builtins so all is manual +// GCC needs manual handling, before gcc-10 as that finally supports __has_builtin + +#if __check_builtin(array_rank) +#define _LIBCUDACXX_ARRAY_RANK(...) __array_rank(__VA_ARGS__) +#endif // __check_builtin(array_rank) + +// nvhpc has a bug where it supports __builtin_addressof but does not mark it via __check_builtin +#if __check_builtin(builtin_addressof) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 700) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVHPC) +#define _LIBCUDACXX_ADDRESSOF(...) __builtin_addressof(__VA_ARGS__) +#endif // __check_builtin(builtin_addressof) + +#if __check_builtin(builtin_bit_cast) \ + || (defined(_LIBCUDACXX_COMPILER_MSVC) && _MSC_VER > 1925) +#define _LIBCUDACXX_BIT_CAST(...) __builtin_bit_cast(__VA_ARGS__) +#endif // __check_builtin(builtin_bit_cast) + +#if __check_builtin(builtin_is_constant_evaluated) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 900) \ + || (defined(_LIBCUDACXX_COMPILER_MSVC) && _MSC_VER > 1924 && !defined(_LIBCUDACXX_CUDACC_BELOW_11_3)) +#define _LIBCUDACXX_IS_CONSTANT_EVALUATED(...) __builtin_is_constant_evaluated(__VA_ARGS__) +#endif // __check_builtin(builtin_is_constant_evaluated) + +// NVCC and NVRTC in C++11 mode freaks out about `__builtin_is_constant_evaluated`. +#if _LIBCUDACXX_STD_VER < 14 \ + && (defined(_LIBCUDACXX_COMPILER_NVCC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || defined(_LIBCUDACXX_COMPILER_NVHPC)) +#undef _LIBCUDACXX_IS_CONSTANT_EVALUATED +#endif // _LIBCUDACXX_STD_VER < 14 && defined(_LIBCUDACXX_COMPILER_NVCC) + +#if __check_builtin(builtin_launder) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 700) +#define _LIBCUDACXX_LAUNDER(...) __builtin_launder(__VA_ARGS__) +#endif // __check_builtin(builtin_launder) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(decay) +#define _LIBCUDACXX_DECAY(...) __decay(__VA_ARGS__) +#endif // __check_builtin(decay) + +#if __check_builtin(has_nothrow_assign) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_HAS_NOTHROW_ASSIGN(...) __has_nothrow_assign(__VA_ARGS__) +#endif // __check_builtin(has_nothrow_assign) + +#if __check_builtin(has_nothrow_constructor) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_HAS_NOTHROW_CONSTRUCTOR(...) __has_nothrow_constructor(__VA_ARGS__) +#endif // __check_builtin(has_nothrow_constructor) + +#if __check_builtin(has_nothrow_copy) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_HAS_NOTHROW_COPY(...) __has_nothrow_copy(__VA_ARGS__) +#endif // __check_builtin(has_nothrow_copy) + +#if __check_builtin(has_trivial_constructor) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_HAS_TRIVIAL_CONSTRUCTOR(...) __has_trivial_constructor(__VA_ARGS__) +#endif // __check_builtin(has_trivial_constructor) + +#if __check_builtin(has_trivial_destructor) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_HAS_TRIVIAL_DESTRUCTOR(...) __has_trivial_destructor(__VA_ARGS__) +#endif // __check_builtin(has_trivial_destructor) + +#if __check_builtin(has_unique_object_representations) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 700) +#define _LIBCUDACXX_HAS_UNIQUE_OBJECT_REPRESENTATIONS(...) __has_unique_object_representations(__VA_ARGS__) +#endif // __check_builtin(has_unique_object_representations) + +#if __check_builtin(has_virtual_destructor) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_HAS_VIRTUAL_DESTRUCTOR(...) __has_virtual_destructor(__VA_ARGS__) +#endif // __check_builtin(has_virtual_destructor) + +#if __check_builtin(is_aggregate) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 700) \ + || (defined(_LIBCUDACXX_COMPILER_MSVC) && _MSC_VER > 1914) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_AGGREGATE(...) __is_aggregate(__VA_ARGS__) +#endif // __check_builtin(is_aggregate) + +#if __check_builtin(is_array) +#define _LIBCUDACXX_IS_ARRAY(...) __is_array(__VA_ARGS__) +#endif // __check_builtin(is_array) + +// TODO: Clang incorrectly reports that __is_array is true for T[0]. +// Re-enable the branch once https://llvm.org/PR54705 is fixed. +#ifndef _LIBCUDACXX_USE_IS_ARRAY_FALLBACK +#if defined(_LIBCUDACXX_COMPILER_CLANG) +#define _LIBCUDACXX_USE_IS_ARRAY_FALLBACK +#endif // _LIBCUDACXX_COMPILER_CLANG +#endif // !_LIBCUDACXX_USE_IS_ARRAY_FALLBACK + +#if __check_builtin(is_assignable) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) +#define _LIBCUDACXX_IS_ASSIGNABLE(...) __is_assignable(__VA_ARGS__) +#endif // __check_builtin(is_assignable) + +#if __check_builtin(is_base_of) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_BASE_OF(...) __is_base_of(__VA_ARGS__) +#endif // __check_builtin(is_base_of) + +#if __check_builtin(is_class) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_CLASS(...) __is_class(__VA_ARGS__) +#endif // __check_builtin(is_class) + +#if __check_builtin(is_constructible) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 800) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_CONSTRUCTIBLE(...) __is_constructible(__VA_ARGS__) +#endif // __check_builtin(is_constructible) + +#if __check_builtin(is_convertible_to) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_CONVERTIBLE_TO(...) __is_convertible_to(__VA_ARGS__) +#endif // __check_builtin(is_convertible_to) + +#if __check_builtin(is_destructible) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) +#define _LIBCUDACXX_IS_DESTRUCTIBLE(...) __is_destructible(__VA_ARGS__) +#endif // __check_builtin(is_destructible) + +#if __check_builtin(is_empty) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_EMPTY(...) __is_empty(__VA_ARGS__) +#endif // __check_builtin(is_empty) + +#if __check_builtin(is_enum) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_ENUM(...) __is_enum(__VA_ARGS__) +#endif // __check_builtin(is_enum) + +#if __check_builtin(is_final) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 407) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_FINAL(...) __is_final(__VA_ARGS__) +#endif // __check_builtin(is_final) + +#if __check_builtin(is_function) \ + && !defined(_LIBCUDACXX_COMPILER_NVCC) +#define _LIBCUDACXX_IS_FUNCTION(...) __is_function(__VA_ARGS__) +#endif // __check_builtin(is_function) + +#if __check_builtin(is_literal_type) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 406) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_LITERAL(...) __is_literal_type(__VA_ARGS__) +#endif // __check_builtin(is_literal_type) + +#if __check_builtin(is_lvalue_reference) +#define _LIBCUDACXX_IS_LVALUE_REFERENCE(...) __is_lvalue_reference(__VA_ARGS__) +#endif // __check_builtin(is_lvalue_reference) + +#ifndef _LIBCUDACXX_USE_IS_LVALUE_REFERENCE_FALLBACK +#if defined(_LIBCUDACXX_CUDACC_BELOW_11_3) +#define _LIBCUDACXX_USE_IS_LVALUE_REFERENCE_FALLBACK +#endif // nvcc < 11.3 +#endif // !_LIBCUDACXX_USE_IS_LVALUE_REFERENCE_FALLBACK + +#if __check_builtin(is_nothrow_assignable) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_NOTHROW_ASSIGNABLE(...) __is_nothrow_assignable(__VA_ARGS__) +#endif // __check_builtin(is_nothrow_assignable) + +#if __check_builtin(is_nothrow_constructible) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_NOTHROW_CONSTRUCTIBLE(...) __is_nothrow_constructible(__VA_ARGS__) +#endif // __check_builtin(is_nothrow_constructible) + +#if __check_builtin(is_nothrow_destructible) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_NOTHROW_DESTRUCTIBLE(...) __is_nothrow_destructible(__VA_ARGS__) +#endif // __check_builtin(is_nothrow_destructible) + +#if __check_builtin(is_object) +#define _LIBCUDACXX_IS_OBJECT(...) __is_object(__VA_ARGS__) +#endif // __check_builtin(is_object) + +#ifndef _LIBCUDACXX_USE_IS_OBJECT_FALLBACK +#if defined(_LIBCUDACXX_CUDACC_BELOW_11_3) +#define _LIBCUDACXX_USE_IS_OBJECT_FALLBACK +#endif // nvcc < 11.3 +#endif // !_LIBCUDACXX_USE_IS_OBJECT_FALLBACK + +#if __check_builtin(is_pod) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_POD(...) __is_pod(__VA_ARGS__) +#endif // __check_builtin(is_pod) + +// libstdc++ defines this as a function, breaking functionality +#if 0 // __check_builtin(is_pointer) +#define _LIBCUDACXX_IS_POINTER(...) __is_pointer(__VA_ARGS__) +#endif // __check_builtin(is_pointer) + +#if __check_builtin(is_polymorphic) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_POLYMORPHIC(...) __is_polymorphic(__VA_ARGS__) +#endif // __check_builtin(is_polymorphic) + +#if __check_builtin(is_reference) +#define _LIBCUDACXX_IS_REFERENCE(...) __is_reference(__VA_ARGS__) +#endif // __check_builtin(is_reference) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(is_referenceable) +#define _LIBCUDACXX_IS_REFERENCEABLE(...) __is_referenceable(__VA_ARGS__) +#endif // __check_builtin(is_referenceable) + +#if __check_builtin(is_rvalue_reference) +#define _LIBCUDACXX_IS_RVALUE_REFERENCE(...) __is_rvalue_reference(__VA_ARGS__) +#endif // __check_builtin(is_rvalue_reference) + +#if __check_builtin(is_same) \ + && !defined(_LIBCUDACXX_COMPILER_NVCC) +#define _LIBCUDACXX_IS_SAME(...) __is_same(__VA_ARGS__) +#endif // __check_builtin(is_same) + +// libstdc++ defines this as a function, breaking functionality +#if 0 // __check_builtin(is_scalar) +#define _LIBCUDACXX_IS_SCALAR(...) __is_scalar(__VA_ARGS__) +#endif // __check_builtin(is_scalar) + +// libstdc++ defines this as a function, breaking functionality +#if 0 // __check_builtin(is_signed) +#define _LIBCUDACXX_IS_SIGNED(...) __is_signed(__VA_ARGS__) +#endif // __check_builtin(is_signed) + +#if __check_builtin(is_standard_layout) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 407) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_STANDARD_LAYOUT(...) __is_standard_layout(__VA_ARGS__) +#endif // __check_builtin(is_standard_layout) + +#if __check_builtin(is_trivial) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 405) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_TRIVIAL(...) __is_trivial(__VA_ARGS__) +#endif // __check_builtin(is_trivial) + +#if __check_builtin(is_trivially_assignable) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 501) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_TRIVIALLY_ASSIGNABLE(...) __is_trivially_assignable(__VA_ARGS__) +#endif // __check_builtin(is_trivially_assignable) + +#if __check_builtin(is_trivially_constructible) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 501) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_TRIVIALLY_CONSTRUCTIBLE(...) __is_trivially_constructible(__VA_ARGS__) +#endif // __check_builtin(is_trivially_constructible) + +#if __check_builtin(is_trivially_copyable) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 501) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_TRIVIALLY_COPYABLE(...) __is_trivially_copyable(__VA_ARGS__) +#endif // __check_builtin(is_trivially_copyable) + +#if __check_builtin(is_trivially_destructible) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) +#define _LIBCUDACXX_IS_TRIVIALLY_DESTRUCTIBLE(...) __is_trivially_destructible(__VA_ARGS__) +#endif // __check_builtin(is_trivially_destructible) + +#if __check_builtin(is_union) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_IS_UNION(...) __is_union(__VA_ARGS__) +#endif // __check_builtin(is_union) + +#if __check_builtin(is_unsigned) +#define _LIBCUDACXX_IS_UNSIGNED(...) __is_unsigned(__VA_ARGS__) +#endif // __check_builtin(is_unsigned) + +#ifndef _LIBCUDACXX_USE_IS_UNSIGNED_FALLBACK +#if defined(_LIBCUDACXX_CUDACC_BELOW_11_3) +#define _LIBCUDACXX_USE_IS_UNSIGNED_FALLBACK +#endif // nvcc < 11.3 +#endif // !_LIBCUDACXX_USE_IS_UNSIGNED_FALLBACK + +// libstdc++ defines this as a function, breaking functionality +#if 0 // __check_builtin(is_void) +#define _LIBCUDACXX_IS_VOID(...) __is_void(__VA_ARGS__) +#endif // __check_builtin(is_void) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(make_signed) +#define _LIBCUDACXX_MAKE_SIGNED(...) __make_signed(__VA_ARGS__) +#endif // __check_builtin(make_signed) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(make_unsigned) +#define _LIBCUDACXX_MAKE_UNSIGNED(...) __make_unsigned(__VA_ARGS__) +#endif // __check_builtin(make_unsigned) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(remove_all_extents) +#define _LIBCUDACXX_REMOVE_ALL_EXTENTS(...) __remove_all_extents(__VA_ARGS__) +#endif // __check_builtin(remove_all_extents) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(remove_const) +#define _LIBCUDACXX_REMOVE_CONST(...) __remove_const(__VA_ARGS__) +#endif // __check_builtin(remove_const) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(remove_cv) +#define _LIBCUDACXX_REMOVE_CV(...) __remove_cv(__VA_ARGS__) +#endif // __check_builtin(remove_cv) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(remove_cvref) +#define _LIBCUDACXX_REMOVE_CVREF(...) __remove_cvref(__VA_ARGS__) +#endif // __check_builtin(remove_cvref) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(remove_extent) +#define _LIBCUDACXX_REMOVE_EXTENT(...) __remove_extent(__VA_ARGS__) +#endif // __check_builtin(remove_extent) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(remove_pointer) +#define _LIBCUDACXX_REMOVE_POINTER(...) __remove_pointer(__VA_ARGS__) +#endif // __check_builtin(remove_pointer) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(remove_reference_t) +#define _LIBCUDACXX_REMOVE_REFERENCE_T(...) __remove_reference_t(__VA_ARGS__) +#endif // __check_builtin(remove_reference_t) + +// Disabled due to libstdc++ conflict +#if 0 // __check_builtin(remove_volatile) +#define _LIBCUDACXX_REMOVE_VOLATILE(...) __remove_volatile(__VA_ARGS__) +#endif // __check_builtin(remove_volatile) + +#if __check_builtin(underlying_type) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 407) \ + || defined(_LIBCUDACXX_COMPILER_MSVC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) +#define _LIBCUDACXX_UNDERLYING_TYPE(...) __underlying_type(__VA_ARGS__) +#endif // __check_builtin(underlying_type) + +#define _LIBCUDACXX_TOSTRING2(_STR) #_STR +#define _LIBCUDACXX_TOSTRING(_STR) _LIBCUDACXX_TOSTRING2(_STR) +#if defined(_LIBCUDACXX_CUDACC) && !defined(_LIBCUDACXX_COMPILER_CLANG_CUDA) +# if defined(__NVCC_DIAG_PRAGMA_SUPPORT__) +# if defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) __pragma(_LIBCUDACXX_TOSTRING(nv_diag_suppress _WARNING)) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) __pragma(_LIBCUDACXX_TOSTRING(nv_diag_default _WARNING)) +# else // ^^^ MSVC ^^^ / vvv not MSVC +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) \ + _Pragma(_LIBCUDACXX_TOSTRING(nv_diagnostic push)) \ + _Pragma(_LIBCUDACXX_TOSTRING(nv_diag_suppress _WARNING)) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(nv_diagnostic pop)) +# endif // not MSVC +# elif defined(_LIBCUDACXX_COMPILER_NVHPC) +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) \ + _Pragma(_LIBCUDACXX_TOSTRING(diagnostic push)) \ + _Pragma(_LIBCUDACXX_TOSTRING(diag_suppress _WARNING)) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(diagnostic pop)) +# else // _LIBCUDACXX_CUDACC_BELOW_11_3 +# if defined(_LIBCUDACXX_COMPILER_MSVC_2017) // MSVC 2017 has issues with restoring the warning +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) __pragma(_LIBCUDACXX_TOSTRING(diag_suppress _WARNING)) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) +# elif defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) __pragma(_LIBCUDACXX_TOSTRING(diag_suppress _WARNING)) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) __pragma(_LIBCUDACXX_TOSTRING(diag_default _WARNING)) +# else // ^^^ MSVC ^^^ / vvv not MSVC +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(diag_suppress _WARNING)) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(diag_default _WARNING)) +# endif // not MSVC +# endif // !__NVCC_DIAG_PRAGMA_SUPPORT__ +#else // ^^^ _LIBCUDACXX_CUDACC ^^^ / vvv other compiler vvv +# define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) +# define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) +#endif // other compilers + +#if defined(_LIBCUDACXX_COMPILER_CLANG) + +// _LIBCUDACXX_ALTERNATE_STRING_LAYOUT is an old name for +// _LIBCUDACXX_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. +#if defined(_LIBCUDACXX_ALTERNATE_STRING_LAYOUT) +#define _LIBCUDACXX_ABI_ALTERNATE_STRING_LAYOUT +#endif + +#if __cplusplus < 201103L +typedef __char16_t char16_t; +typedef __char32_t char32_t; +#endif + +#if !(__has_feature(cxx_strong_enums)) +#define _LIBCUDACXX_HAS_NO_STRONG_ENUMS +#endif + +#if !(__has_feature(cxx_lambdas)) +#define _LIBCUDACXX_HAS_NO_LAMBDAS +#endif + +#if !(__has_feature(cxx_nullptr)) +# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCUDACXX_ABI_ALWAYS_USE_CXX11_NULLPTR) +# define nullptr __nullptr +# else +# define _LIBCUDACXX_HAS_NO_NULLPTR +# endif +#endif + +#if !(__has_feature(cxx_rvalue_references)) +#define _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +#endif + +#if !(__has_feature(cxx_auto_type)) +#define _LIBCUDACXX_HAS_NO_AUTO_TYPE +#endif + +#if !(__has_feature(cxx_variadic_templates)) +#define _LIBCUDACXX_HAS_NO_VARIADICS +#endif + +#if !(__has_feature(cxx_generalized_initializers)) +#define _LIBCUDACXX_HAS_NO_GENERALIZED_INITIALIZERS +#endif + +// Objective-C++ features (opt-in) +#if __has_feature(objc_arc) +#define _LIBCUDACXX_HAS_OBJC_ARC +#endif + +#if __has_feature(objc_arc_weak) +#define _LIBCUDACXX_HAS_OBJC_ARC_WEAK +#endif + +#if !(__has_feature(cxx_relaxed_constexpr)) +#define _LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR +#endif + +#if !(__has_feature(cxx_variable_templates)) +#define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES +#endif + +#if !(__has_feature(cxx_noexcept)) +#define _LIBCUDACXX_HAS_NO_NOEXCEPT +#endif + +// Allow for build-time disabling of unsigned integer sanitization +#if !defined(_LIBCUDACXX_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize) +#define _LIBCUDACXX_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) +#endif + +#define _LIBCUDACXX_DISABLE_EXTENSION_WARNING __extension__ + +#elif defined(_LIBCUDACXX_COMPILER_GCC) + +#ifndef _LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK +// FIXME: GCC 8.0 supports this trait, but it has a bug. +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91592 +// https://godbolt.org/z/IljfIw +#define _LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK +#endif // _LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK + +// Determine if GCC supports relaxed constexpr +#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L +#define _LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR +#endif + +// GCC 5 supports variable templates +#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L +#define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES +#endif + +#if _GNUC_VER < 600 +#define _LIBCUDACXX_GCC_MATH_IN_STD +#endif + +// NVCC cannot properly handle some deductions occuring within NOEXCEPT +// C++17 mode causes reference instatiation errors in tuple +#if (_GNUC_VER >= 702 && _GNUC_VER <= 805) +#if defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_STD_VER == 17 +#define _LIBCUDACXX_NO_TUPLE_NOEXCEPT +#endif +#endif + +#define _LIBCUDACXX_DISABLE_EXTENSION_WARNING __extension__ + +#elif defined(_LIBCUDACXX_COMPILER_MSVC) + +#define _LIBCUDACXX_WARNING(x) __pragma(message(__FILE__ "(" _LIBCUDACXX_TOSTRING(__LINE__) ") : warning note: " x)) + +// https://github.com/microsoft/STL/blob/master/stl/inc/yvals_core.h#L353 +// warning C4100: 'quack': unreferenced formal parameter +// warning C4127: conditional expression is constant +// warning C4180: qualifier applied to function type has no meaning; ignored +// warning C4197: 'purr': top-level volatile in cast is ignored +// warning C4324: 'roar': structure was padded due to alignment specifier +// warning C4455: literal suffix identifiers that do not start with an underscore are reserved +// warning C4503: 'hum': decorated name length exceeded, name was truncated +// warning C4522: 'woof' : multiple assignment operators specified +// warning C4668: 'meow' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' +// warning C4800: 'boo': forcing value to bool 'true' or 'false' (performance warning) +// warning C4996: 'meow': was declared deprecated +#define _LIBCUDACXX_MSVC_DISABLED_WARNINGS \ + 4100 \ + 4127 \ + 4180 \ + 4197 \ + 4296 \ + 4324 \ + 4455 \ + 4503 \ + 4522 \ + 4668 \ + 4800 \ + 4996 \ + /**/ + +#if _MSC_VER < 1900 +#error "MSVC versions prior to Visual Studio 2015 are not supported" +#endif + +// MSVC implemented P0030R1 in 15.7, only available under C++17 +#if _MSC_VER < 1914 +#define _LIBCUDACXX_NO_HOST_CPP17_HYPOT +#endif + +#if _MSC_VER < 1920 +#define _LIBCUDACXX_HAS_NO_NOEXCEPT_SFINAE +#define _LIBCUDACXX_HAS_NO_LOGICAL_METAFUNCTION_ALIASES +#endif + +// MSVC exposed __iso_volatile intrinsics beginning on 1924 for x86 +#if _MSC_VER < 1924 + #define _LIBCUDACXX_MSVC_HAS_NO_ISO_INTRIN +#endif + +#if _LIBCUDACXX_STD_VER < 14 +#define _LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR +#define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES +#endif + +#define _LIBCUDACXX_WEAK + +#define _LIBCUDACXX_HAS_NO_VECTOR_EXTENSION + +#define _LIBCUDACXX_DISABLE_EXTENSION_WARNING + +#elif defined(_LIBCUDACXX_COMPILER_IBM) + +#define _ATTRIBUTE(x) __attribute__((x)) + +#define _LIBCUDACXX_HAS_NO_UNICODE_CHARS +#define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES + +#if defined(_AIX) +#define __MULTILOCALE_API +#endif + +#define _LIBCUDACXX_HAS_NO_VECTOR_EXTENSION + +#elif defined(_LIBCUDACXX_COMPILER_NVRTC) || defined(_LIBCUDACXX_COMPILER_NVHPC) + +#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L +#define _LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR +#endif + +#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L +#define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES +#endif + +#define _LIBCUDACXX_DISABLE_EXTENSION_WARNING + +#endif // _LIBCUDACXX_COMPILER_[CLANG|GCC|MSVC|IBM|NVRTC] + +#if defined(_LIBCUDACXX_COMPILER_NVHPC) && !defined(__cuda_std__) +// Forcefully disable visibility controls when used as the standard library with NVC++. +// TODO: reevaluate. +#define _LIBCUDACXX_HIDE_FROM_ABI +#ifndef _LIBCUDACXX_DISABLE_EXTERN_TEMPLATE +#define _LIBCUDACXX_DISABLE_EXTERN_TEMPLATE +#endif +#endif + +#ifndef _LIBCUDACXX_FREESTANDING +#if defined(__cuda_std__) \ + || !defined(__STDC_HOSTED__) +# define _LIBCUDACXX_FREESTANDING +#endif +#endif // !_LIBCUDACXX_FREESTANDING + +#ifndef _LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_COMPILER_NVHPC) && !defined(__cuda_std__)) +# define _LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS +#endif +#endif // _LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS + +#ifndef _LIBCUDACXX_HAS_CUDA_ATOMIC_EXT +#if defined(__cuda_std__) +# define _LIBCUDACXX_HAS_CUDA_ATOMIC_EXT +#endif +#endif // _LIBCUDACXX_HAS_CUDA_ATOMIC_EXT + +#ifndef _LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP +#if defined(__cuda_std__) +# define _LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP +#endif +#endif // _LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP + +#ifndef _LIBCUDACXX_HAS_NO_ASAN +#if defined(_LIBCUDACXX_COMPILER_GCC) +# if !defined(__SANITIZE_ADDRESS__) +# define _LIBCUDACXX_HAS_NO_ASAN +# endif // !__SANITIZE_ADDRESS__ +#elif defined(_LIBCUDACXX_COMPILER_CLANG) +# if !__has_feature(address_sanitizer) +# define _LIBCUDACXX_HAS_NO_ASAN +# endif // !__has_feature(address_sanitizer) +#else +# define _LIBCUDACXX_HAS_NO_ASAN +#endif // _LIBCUDACXX_COMPILER[MSVC|IBM|NVHPC|NVRTC] +#endif // _LIBCUDACXX_HAS_NO_ASAN + +#ifndef _LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS +#if defined(__cuda_std__) \ + || (defined(_LIBCUDACXX_COMPILER_CLANG) && _LIBCUDACXX_CLANG_VER < 800) +# define _LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS +#endif // __cuda_std__ +#endif // _LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS + +#ifndef _LIBCUDACXX_HAS_NO_INT128 +#if defined(_LIBCUDACXX_COMPILER_MSVC) \ + || (defined(_LIBCUDACXX_COMPILER_NVRTC) && !defined(__CUDACC_RTC_INT128__)) \ + || (defined(_LIBCUDACXX_COMPILER_NVCC) && (_LIBCUDACXX_CUDACC_VER < 1105000)) \ + || !defined(__SIZEOF_INT128__) +# define _LIBCUDACXX_HAS_NO_INT128 +#endif +#endif // !_LIBCUDACXX_HAS_NO_INT128 + +#ifndef _LIBCUDACXX_HAS_NO_LONG_DOUBLE +#if defined(_LIBCUDACXX_CUDACC) +# define _LIBCUDACXX_HAS_NO_LONG_DOUBLE +#endif +#endif // _LIBCUDACXX_HAS_NO_LONG_DOUBLE + +#ifndef _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS +#if __has_cpp_attribute(msvc::no_unique_address) +// MSVC implements [[no_unique_address]] as a silent no-op currently. +// (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.) +// However, MSVC implements [[msvc::no_unique_address]] which does what +// [[no_unique_address]] is supposed to do, in general. + +// Clang-cl does not yet (14.0) implement either [[no_unique_address]] or +// [[msvc::no_unique_address]] though. If/when it does implement +// [[msvc::no_unique_address]], this should be preferred though. +# define _LIBCUDACXX_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] +#elif defined(_LIBCUDACXX_CUDACC_BELOW_11_3) \ + || (__has_cpp_attribute(no_unique_address) < 201803L) +# define _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS +# define _LIBCUDACXX_NO_UNIQUE_ADDRESS +#elif __has_cpp_attribute(no_unique_address) +# define _LIBCUDACXX_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else +# define _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS +# define _LIBCUDACXX_NO_UNIQUE_ADDRESS +// Note that this can be replaced by #error as soon as clang-cl +// implements msvc::no_unique_address, since there should be no C++20 +// compiler that doesn't support one of the two attributes at that point. +// We generally don't want to use this macro outside of C++20-only code, +// because using it conditionally in one language version only would make +// the ABI inconsistent. +#endif +#endif // _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS + +#ifndef _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK +#if defined(__cuda_std__) +# define _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK +#endif +#endif // _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK + +#ifndef _LIBCUDACXX_HAS_NO_PLATFORM_WAIT +#if defined(__cuda_std__) +# define _LIBCUDACXX_HAS_NO_PLATFORM_WAIT +#endif +#endif // _LIBCUDACXX_HAS_NO_PLATFORM_WAIT + +#ifndef _LIBCUDACXX_HAS_NO_PRAGMA_PUSH_POP_MACRO +#if (defined(_LIBCUDACXX_COMPILER_MSVC) && _MSC_VER < 1920) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || defined(_LIBCUDACXX_COMPILER_IBM) +#define _LIBCUDACXX_HAS_NO_PRAGMA_PUSH_POP_MACRO +#endif +#endif // _LIBCUDACXX_HAS_NO_PRAGMA_PUSH_POP_MACRO + +#ifndef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE +#if defined(__cuda_std__) +# define _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE +#endif +#endif // _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE + +#ifndef _LIBCUDACXX_HAS_NO_TREE_BARRIER +#if defined(__cuda_std__) +# define _LIBCUDACXX_HAS_NO_TREE_BARRIER +#endif +#endif // _LIBCUDACXX_HAS_NO_TREE_BARRIER + +#ifndef _LIBCUDACXX_HAS_NO_WCHAR_H +#if defined(__cuda_std__) +# define _LIBCUDACXX_HAS_NO_WCHAR_H +#endif +#endif // _LIBCUDACXX_HAS_NO_WCHAR_H + +#ifndef _LIBCUDACXX_NO_EXCEPTIONS +#if defined(__cuda_std__) \ + || (defined(_LIBCUDACXX_COMPILER_CLANG) && !(__has_feature(cxx_exceptions))) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && !__EXCEPTIONS) +# define _LIBCUDACXX_NO_EXCEPTIONS +#endif +#endif // !_LIBCUDACXX_NO_EXCEPTIONS + +// Try to find out if RTTI is disabled. +// g++ and cl.exe have RTTI on by default and define a macro when it is. +#ifndef _LIBCUDACXX_NO_RTTI +#if defined(__cuda_std__) \ + || (defined(_LIBCUDACXX_COMPILER_CLANG) && !(__has_feature(cxx_rtti))) \ + || (defined(_LIBCUDACXX_COMPILER_GCC) && !defined(__GXX_RTTI)) \ + || (defined(_LIBCUDACXX_COMPILER_MSVC) && !defined(_CPPRTTI)) +# define _LIBCUDACXX_NO_RTTI +#endif +#endif // !_LIBCUDACXX_NO_RTTI + +#ifndef _LIBCUDACXX_NODEBUG_TYPE +#if defined(__cuda_std__) +# define _LIBCUDACXX_NODEBUG_TYPE +#elif __has_attribute(__nodebug__) \ + && (defined(_LIBCUDACXX_COMPILER_CLANG) && _LIBCUDACXX_CLANG_VER >= 1210) +# define _LIBCUDACXX_NODEBUG_TYPE __attribute__((nodebug)) +#else +# define _LIBCUDACXX_NODEBUG_TYPE +#endif +#endif // !_LIBCUDACXX_NODEBUG_TYPE + +#if defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_NORETURN __declspec(noreturn) +#elif __has_feature(cxx_attributes) +# define _LIBCUDACXX_NORETURN [[noreturn]] +#else +# define _LIBCUDACXX_NORETURN __attribute__ ((noreturn)) +#endif + +#if defined(_LIBCUDACXX_OBJECT_FORMAT_COFF) + +#ifdef _DLL +# define _LIBCUDACXX_CRT_FUNC __declspec(dllimport) +#else +# define _LIBCUDACXX_CRT_FUNC +#endif + +#if defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCUDACXX_DLL_VIS +# define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCUDACXX_OVERRIDABLE_FUNC_VIS +# define _LIBCUDACXX_EXPORTED_FROM_ABI +#elif defined(_LIBCUDACXX_BUILDING_LIBRARY) +# define _LIBCUDACXX_DLL_VIS __declspec(dllexport) +# if defined(__MINGW32__) +# define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS _LIBCUDACXX_DLL_VIS +# define _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS +# else +# define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCUDACXX_DLL_VIS +# endif +# define _LIBCUDACXX_OVERRIDABLE_FUNC_VIS _LIBCUDACXX_DLL_VIS +# define _LIBCUDACXX_EXPORTED_FROM_ABI __declspec(dllexport) +#else +# define _LIBCUDACXX_DLL_VIS __declspec(dllimport) +# define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS _LIBCUDACXX_DLL_VIS +# define _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCUDACXX_OVERRIDABLE_FUNC_VIS +# define _LIBCUDACXX_EXPORTED_FROM_ABI __declspec(dllimport) +#endif + +#define _LIBCUDACXX_TYPE_VIS _LIBCUDACXX_DLL_VIS +#define _LIBCUDACXX_FUNC_VIS _LIBCUDACXX_DLL_VIS +#define _LIBCUDACXX_EXCEPTION_ABI _LIBCUDACXX_DLL_VIS +#define _LIBCUDACXX_HIDDEN +#define _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +#define _LIBCUDACXX_TEMPLATE_VIS +#define _LIBCUDACXX_ENUM_VIS + +#endif // defined(_LIBCUDACXX_OBJECT_FORMAT_COFF) + +#ifndef _LIBCUDACXX_HIDDEN +# if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCUDACXX_HIDDEN __attribute__ ((__visibility__("hidden"))) +# else +# define _LIBCUDACXX_HIDDEN +# endif +#endif + +#ifndef _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) +// The inline should be removed once PR32114 is resolved +# define _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCUDACXX_HIDDEN +# else +# define _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# endif +#endif + +#ifndef _LIBCUDACXX_FUNC_VIS +# if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCUDACXX_FUNC_VIS __attribute__ ((__visibility__("default"))) +# else +# define _LIBCUDACXX_FUNC_VIS +# endif +#endif + +#ifndef _LIBCUDACXX_TYPE_VIS +# if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCUDACXX_TYPE_VIS __attribute__ ((__visibility__("default"))) +# else +# define _LIBCUDACXX_TYPE_VIS +# endif +#endif + +#ifndef _LIBCUDACXX_TEMPLATE_VIS +# if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) +# if __has_attribute(__type_visibility__) +# define _LIBCUDACXX_TEMPLATE_VIS __attribute__ ((__type_visibility__("default"))) +# else +# define _LIBCUDACXX_TEMPLATE_VIS __attribute__ ((__visibility__("default"))) +# endif +# else +# define _LIBCUDACXX_TEMPLATE_VIS +# endif +#endif + +#ifndef _LIBCUDACXX_EXPORTED_FROM_ABI +# if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCUDACXX_EXPORTED_FROM_ABI __attribute__((__visibility__("default"))) +# else +# define _LIBCUDACXX_EXPORTED_FROM_ABI +# endif +#endif + +#ifndef _LIBCUDACXX_OVERRIDABLE_FUNC_VIS +#define _LIBCUDACXX_OVERRIDABLE_FUNC_VIS _LIBCUDACXX_FUNC_VIS +#endif + +#ifndef _LIBCUDACXX_EXCEPTION_ABI +# if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCUDACXX_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) +# else +# define _LIBCUDACXX_EXCEPTION_ABI +# endif +#endif + +#ifndef _LIBCUDACXX_ENUM_VIS +# if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) +# define _LIBCUDACXX_ENUM_VIS __attribute__ ((__type_visibility__("default"))) +# else +# define _LIBCUDACXX_ENUM_VIS +# endif +#endif + +#ifndef _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS +# if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) +# define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default"))) +# else +# define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS +# endif +#endif + +#ifndef _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS +#define _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS +#endif + +#if __has_attribute(internal_linkage) +# define _LIBCUDACXX_INTERNAL_LINKAGE __attribute__ ((internal_linkage)) +#else +# define _LIBCUDACXX_INTERNAL_LINKAGE _LIBCUDACXX_ALWAYS_INLINE +#endif + +#if __has_attribute(exclude_from_explicit_instantiation) +# define _LIBCUDACXX_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__ ((__exclude_from_explicit_instantiation__)) +#else + // Try to approximate the effect of exclude_from_explicit_instantiation + // (which is that entities are not assumed to be provided by explicit + // template instantiations in the dylib) by always inlining those entities. +# define _LIBCUDACXX_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCUDACXX_ALWAYS_INLINE +#endif + +#ifndef _LIBCUDACXX_HIDE_FROM_ABI_PER_TU +# ifndef _LIBCUDACXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT +# define _LIBCUDACXX_HIDE_FROM_ABI_PER_TU 0 +# else +# define _LIBCUDACXX_HIDE_FROM_ABI_PER_TU 1 +# endif +#endif + +#ifndef _LIBCUDACXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT +# ifdef _LIBCUDACXX_OBJECT_FORMAT_COFF // Windows binaries can't merge typeinfos. +# define _LIBCUDACXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT 0 +#else +// TODO: This isn't strictly correct on ELF platforms due to llvm.org/PR37398 +// And we should consider defaulting to OFF. +# define _LIBCUDACXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT 1 +#endif +#endif + +#ifndef _LIBCUDACXX_HIDE_FROM_ABI +# if _LIBCUDACXX_HIDE_FROM_ABI_PER_TU +# define _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_HIDDEN _LIBCUDACXX_INTERNAL_LINKAGE +# else +# define _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_HIDDEN _LIBCUDACXX_EXCLUDE_FROM_EXPLICIT_INSTANTIATION +# endif +#endif + +#ifdef _LIBCUDACXX_BUILDING_LIBRARY +# if _LIBCUDACXX_ABI_VERSION > 1 +# define _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 _LIBCUDACXX_HIDE_FROM_ABI +# else +# define _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 +# endif +#else +# define _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 _LIBCUDACXX_HIDE_FROM_ABI +#endif + +#ifdef _LIBCUDACXX_CUDACC +# define _LIBCUDACXX_HOST __host__ +# define _LIBCUDACXX_DEVICE __device__ +# define _LIBCUDACXX_HOST_DEVICE __host__ __device__ +# define _LIBCUDACXX_FORCE_INLINE __forceinline__ +#else // ^^^ _LIBCUDACXX_CUDACC ^^^ / vvv !_LIBCUDACXX_CUDACC +# define _LIBCUDACXX_HOST +# define _LIBCUDACXX_DEVICE +# define _LIBCUDACXX_HOST_DEVICE +# define _LIBCUDACXX_FORCE_INLINE +#endif // !_LIBCUDACXX_CUDACC + +// Just so we can migrate to the new macros gradually. + +#ifdef __cuda_std__ +# define _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_HOST_DEVICE +#else +# define _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_HIDE_FROM_ABI +#endif // __cuda_std__ + +#define _LIBCUDACXX_CONCAT1(_LIBCUDACXX_X,_LIBCUDACXX_Y) _LIBCUDACXX_X##_LIBCUDACXX_Y +#define _LIBCUDACXX_CONCAT(_LIBCUDACXX_X,_LIBCUDACXX_Y) _LIBCUDACXX_CONCAT1(_LIBCUDACXX_X,_LIBCUDACXX_Y) + +#ifndef _LIBCUDACXX_ABI_NAMESPACE +#ifdef __cuda_std__ +# define _LIBCUDACXX_ABI_NAMESPACE _LIBCUDACXX_CONCAT(__,_LIBCUDACXX_CUDA_ABI_VERSION) +#else +# define _LIBCUDACXX_ABI_NAMESPACE _LIBCUDACXX_CONCAT(__,_LIBCUDACXX_ABI_VERSION) +#endif // __cuda_std__ +#endif // _LIBCUDACXX_ABI_NAMESPACE + +#ifdef __cuda_std__ +# define _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION namespace cuda { namespace std { +# define _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION } } +# define _CUDA_VSTD ::cuda::std::_LIBCUDACXX_ABI_NAMESPACE +# define _CUDA_VRANGES ::cuda::std::ranges::_LIBCUDACXX_ABI_NAMESPACE +#else +# define _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION namespace std { +# define _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION } +# define _CUDA_VSTD ::std::_LIBCUDACXX_ABI_NAMESPACE +# define _CUDA_VRANGES ::std::ranges::_LIBCUDACXX_ABI_NAMESPACE +#endif + +#ifdef __cuda_std__ +#define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA namespace cuda { inline namespace _LIBCUDACXX_ABI_NAMESPACE { +#define _LIBCUDACXX_END_NAMESPACE_CUDA } } +#define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_DEVICE namespace cuda { namespace device { inline namespace _LIBCUDACXX_ABI_NAMESPACE { +#define _LIBCUDACXX_END_NAMESPACE_CUDA_DEVICE } } } +#define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_PTX namespace cuda { namespace ptx { inline namespace _LIBCUDACXX_ABI_NAMESPACE { +#define _LIBCUDACXX_END_NAMESPACE_CUDA_PTX } } } +#define _CUDA_VPTX ::cuda::ptx::_LIBCUDACXX_ABI_NAMESPACE +#define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_DEVICE_EXPERIMENTAL namespace cuda { namespace device { namespace experimental { inline namespace _LIBCUDACXX_ABI_NAMESPACE { +#define _LIBCUDACXX_END_NAMESPACE_CUDA_DEVICE_EXPERIMENTAL } } } } +#endif + +// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect. +#define _LIBCUDACXX_BEGIN_NAMESPACE_STD _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION inline namespace _LIBCUDACXX_ABI_NAMESPACE { +#define _LIBCUDACXX_END_NAMESPACE_STD } _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION + +#ifndef __cuda_std__ +_LIBCUDACXX_BEGIN_NAMESPACE_STD _LIBCUDACXX_END_NAMESPACE_STD +#endif + +#define _LIBCUDACXX_BEGIN_NAMESPACE_RANGES _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION namespace ranges { inline namespace _LIBCUDACXX_ABI_NAMESPACE { +#define _LIBCUDACXX_END_NAMESPACE_RANGES } } _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION + +#if !defined(__cuda_std__) +_LIBCUDACXX_BEGIN_NAMESPACE_RANGES _LIBCUDACXX_END_NAMESPACE_RANGES +#endif + +#if _LIBCUDACXX_STD_VER > 17 +#define _LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI inline namespace __cxx20 { +#else +#define _LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI inline namespace __cxx17 { +#endif +#define _LIBCUDACXX_END_NAMESPACE_RANGES_ABI } + +#define _LIBCUDACXX_BEGIN_NAMESPACE_CPO(_CPO) namespace _CPO { _LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI +#define _LIBCUDACXX_END_NAMESPACE_CPO } } + +#if _LIBCUDACXX_STD_VER >= 17 +#define _LIBCUDACXX_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCUDACXX_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { +#else +#define _LIBCUDACXX_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCUDACXX_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { +#endif + +#define _LIBCUDACXX_END_NAMESPACE_FILESYSTEM \ + _LIBCUDACXX_END_NAMESPACE_STD } } + +#define _CUDA_VSTD_FS _CUDA_VSTD::__fs::filesystem + +#ifndef _LIBCUDACXX_PREFERRED_OVERLOAD +# if __has_attribute(__enable_if__) +# define _LIBCUDACXX_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, ""))) +# endif +#endif + +#ifdef _LIBCUDACXX_HAS_NO_UNICODE_CHARS +typedef unsigned short char16_t; +typedef unsigned int char32_t; +#endif // _LIBCUDACXX_HAS_NO_UNICODE_CHARS + +#if defined(_LIBCUDACXX_COMPILER_GCC) \ + || defined(_LIBCUDACXX_COMPILER_CLANG) +# define _LIBCUDACXX_NOALIAS __attribute__((__malloc__)) +#else +# define _LIBCUDACXX_NOALIAS +#endif + +#if __has_feature(cxx_explicit_conversions) \ + || defined(_LIBCUDACXX_COMPILER_IBM) \ + || defined(_LIBCUDACXX_COMPILER_GCC) \ + || defined(_LIBCUDACXX_COMPILER_CLANG) +# define _LIBCUDACXX_EXPLICIT explicit +#else +# define _LIBCUDACXX_EXPLICIT +#endif + +#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete) +#define _LIBCUDACXX_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE +#endif + +#ifdef _LIBCUDACXX_HAS_NO_STRONG_ENUMS +# define _LIBCUDACXX_DECLARE_STRONG_ENUM(x) struct _LIBCUDACXX_TYPE_VIS x { enum __lx +# define _LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(x) \ + __lx __v_; \ + _LIBCUDACXX_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \ + _LIBCUDACXX_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ + _LIBCUDACXX_INLINE_VISIBILITY operator int() const {return __v_;} \ + }; +#else // _LIBCUDACXX_HAS_NO_STRONG_ENUMS +# define _LIBCUDACXX_DECLARE_STRONG_ENUM(x) enum class _LIBCUDACXX_ENUM_VIS x +# define _LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(x) +#endif // _LIBCUDACXX_HAS_NO_STRONG_ENUMS + +#ifdef _LIBCUDACXX_DEBUG +# if _LIBCUDACXX_DEBUG == 0 +# define _LIBCUDACXX_DEBUG_LEVEL 1 +# elif _LIBCUDACXX_DEBUG == 1 +# define _LIBCUDACXX_DEBUG_LEVEL 2 +# else +# error Supported values for _LIBCUDACXX_DEBUG are 0 and 1 +# endif +# if !defined(_LIBCUDACXX_BUILDING_LIBRARY) +# define _LIBCUDACXX_EXTERN_TEMPLATE(...) +# endif +#endif + +#ifdef _LIBCUDACXX_DISABLE_EXTERN_TEMPLATE +#define _LIBCUDACXX_EXTERN_TEMPLATE(...) +#define _LIBCUDACXX_EXTERN_TEMPLATE2(...) +#endif + +#ifndef _LIBCUDACXX_EXTERN_TEMPLATE +#define _LIBCUDACXX_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; +#endif + +#ifndef _LIBCUDACXX_EXTERN_TEMPLATE2 +#define _LIBCUDACXX_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__; +#endif + +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCUDACXX_MSVCRT_LIKE) || \ + defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__) +#define _LIBCUDACXX_LOCALE__L_EXTENSIONS 1 +#endif + +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) +// Most unix variants have catopen. These are the specific ones that don't. +# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) +# define _LIBCUDACXX_HAS_CATOPEN 1 +# endif +#endif + +#ifdef __FreeBSD__ +#define _DECLARE_C99_LDBL_MATH 1 +#endif + +#if defined(_LIBCUDACXX_ABI_MICROSOFT) && !defined(_LIBCUDACXX_NO_VCRUNTIME) +# define _LIBCUDACXX_DEFER_NEW_TO_VCRUNTIME +#endif + +// If we are getting operator new from the MSVC CRT, then allocation overloads +// for align_val_t were added in 19.12, aka VS 2017 version 15.3. +#if defined(_LIBCUDACXX_MSVCRT) && defined(_LIBCUDACXX_COMPILER_MSVC) && _MSC_VER < 1912 +# define _LIBCUDACXX_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +#elif defined(_LIBCUDACXX_ABI_VCRUNTIME) && !defined(__cpp_aligned_new) + // We're deferring to Microsoft's STL to provide aligned new et al. We don't + // have it unless the language feature test macro is defined. +# define _LIBCUDACXX_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +#endif + +#if defined(__APPLE__) +# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ + defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) +# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# endif +#endif // defined(__APPLE__) + +#if !defined(_LIBCUDACXX_HAS_NO_ALIGNED_ALLOCATION) && \ + (defined(_LIBCUDACXX_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || \ + (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)) +# define _LIBCUDACXX_HAS_NO_ALIGNED_ALLOCATION +#endif + +#if defined(__APPLE__) || defined(__FreeBSD__) +#define _LIBCUDACXX_HAS_DEFAULTRUNELOCALE +#endif + +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) +#define _LIBCUDACXX_WCTYPE_IS_MASK +#endif + +#if _LIBCUDACXX_STD_VER <= 17 || !defined(__cpp_char8_t) +#define _LIBCUDACXX_NO_HAS_CHAR8_T +#endif + +// Deprecation macros. +// +// Deprecations warnings are always enabled, except when users explicitly opt-out +// by defining _LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS. +// NVCC 11.1 and 11.2 are broken with the deprecated attribute, so disable it +#if !defined(_LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS) \ + && !defined(_LIBCUDACXX_CUDACC_BELOW_11_3) +# if __has_attribute(deprecated) +# define _LIBCUDACXX_DEPRECATED __attribute__ ((deprecated)) +# elif _LIBCUDACXX_STD_VER > 11 +# define _LIBCUDACXX_DEPRECATED [[deprecated]] +# else +# define _LIBCUDACXX_DEPRECATED +# endif +#else +# define _LIBCUDACXX_DEPRECATED +#endif + +#define _LIBCUDACXX_DEPRECATED_IN_CXX11 _LIBCUDACXX_DEPRECATED + +#if _LIBCUDACXX_STD_VER >= 14 +# define _LIBCUDACXX_DEPRECATED_IN_CXX14 _LIBCUDACXX_DEPRECATED +#else +# define _LIBCUDACXX_DEPRECATED_IN_CXX14 +#endif + +#if _LIBCUDACXX_STD_VER >= 17 +# define _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_DEPRECATED +#else +# define _LIBCUDACXX_DEPRECATED_IN_CXX17 +#endif + +#if _LIBCUDACXX_STD_VER <= 11 +# define _LIBCUDACXX_EXPLICIT_AFTER_CXX11 +#else +# define _LIBCUDACXX_EXPLICIT_AFTER_CXX11 explicit +#endif + +#if _LIBCUDACXX_STD_VER > 11 && !defined(_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR) +# define _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 constexpr +#else +# define _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +#endif + +#if _LIBCUDACXX_STD_VER > 14 && !defined(_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR) +# define _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 constexpr +#else +# define _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +#endif + +#if _LIBCUDACXX_STD_VER > 17 && !defined(_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR) +# define _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 constexpr +#else +# define _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +#endif + +// Macros to enter and leave a state where deprecation warnings are suppressed. +#if defined(_LIBCUDACXX_COMPILER_CLANG) || defined(_LIBCUDACXX_COMPILER_GCC) +# define _LIBCUDACXX_SUPPRESS_DEPRECATED_PUSH \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +# define _LIBCUDACXX_SUPPRESS_DEPRECATED_POP \ + _Pragma("GCC diagnostic pop") +#else +# define _LIBCUDACXX_SUPPRESS_DEPRECATED_PUSH +# define _LIBCUDACXX_SUPPRESS_DEPRECATED_POP +#endif + +// The _LIBCUDACXX_NODISCARD_ATTRIBUTE should only be used to define other +// NODISCARD macros to the correct attribute. +#if __has_cpp_attribute(nodiscard) || (defined(_LIBCUDACXX_COMPILER_MSVC) && _LIBCUDACXX_STD_VER > 14) +# define _LIBCUDACXX_NODISCARD_ATTRIBUTE [[nodiscard]] +#elif defined(_LIBCUDACXX_COMPILER_CLANG) +# define _LIBCUDACXX_NODISCARD_ATTRIBUTE [[clang::warn_unused_result]] +#else +// We can't use GCC's [[gnu::warn_unused_result]] and +// __attribute__((warn_unused_result)), because GCC does not silence them via +// (void) cast. +# define _LIBCUDACXX_NODISCARD_ATTRIBUTE +#endif + +// NVCC below 11.3 does not support nodiscard on friend functions +// It always fails with clang +#if defined(_LIBCUDACXX_CUDACC_BELOW_11_3) \ + || defined(_LIBCUDACXX_COMPILER_CLANG) +# define _LIBCUDACXX_NODISCARD_FRIEND friend +#else // ^^^ _LIBCUDACXX_CUDACC_BELOW_11_3 ^^^ / vvv !_LIBCUDACXX_CUDACC_BELOW_11_3 vvv +# define _LIBCUDACXX_NODISCARD_FRIEND _LIBCUDACXX_NODISCARD_ATTRIBUTE friend +#endif // !_LIBCUDACXX_CUDACC_BELOW_11_3 && !_LIBCUDACXX_COMPILER_CLANG + +// _LIBCUDACXX_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not +// specified as such as an extension. +#if defined(_LIBCUDACXX_ENABLE_NODISCARD) && !defined(_LIBCUDACXX_DISABLE_NODISCARD_EXT) +# define _LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_NODISCARD_ATTRIBUTE +#else +# define _LIBCUDACXX_NODISCARD_EXT +#endif + +#if !defined(_LIBCUDACXX_DISABLE_NODISCARD_AFTER_CXX17) && \ + (_LIBCUDACXX_STD_VER > 17 || defined(_LIBCUDACXX_ENABLE_NODISCARD)) +# define _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_NODISCARD_ATTRIBUTE +#else +# define _LIBCUDACXX_NODISCARD_AFTER_CXX17 +#endif + +#if _LIBCUDACXX_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L) +# define _LIBCUDACXX_INLINE_VAR inline +#else +# define _LIBCUDACXX_INLINE_VAR +#endif + +#ifdef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +# define _LIBCUDACXX_EXPLICIT_MOVE(x) _CUDA_VSTD::move(x) +#else +# define _LIBCUDACXX_EXPLICIT_MOVE(x) (x) +#endif + +#ifndef _LIBCUDACXX_CONSTEXPR_IF_NODEBUG +#if defined(_LIBCUDACXX_DEBUG) || defined(_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR) +#define _LIBCUDACXX_CONSTEXPR_IF_NODEBUG +#else +#define _LIBCUDACXX_CONSTEXPR_IF_NODEBUG _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +#endif +#endif + +#if __has_attribute(no_destroy) +# define _LIBCUDACXX_NO_DESTROY __attribute__((__no_destroy__)) +#else +# define _LIBCUDACXX_NO_DESTROY +#endif + +#ifndef _LIBCUDACXX_HAS_NO_ASAN +extern "C" _LIBCUDACXX_FUNC_VIS void __sanitizer_annotate_contiguous_container( + const void *, const void *, const void *, const void *); +#endif + +#ifndef _LIBCUDACXX_WEAK +#define _LIBCUDACXX_WEAK __attribute__((__weak__)) +#endif + +// Redefine some macros for internal use +#if defined(__cuda_std__) +# undef _LIBCUDACXX_FUNC_VIS +# define _LIBCUDACXX_FUNC_VIS _LIBCUDACXX_INLINE_VISIBILITY +# undef _LIBCUDACXX_TYPE_VIS +# define _LIBCUDACXX_TYPE_VIS +#endif // __cuda_std__ + +// Thread API +#ifndef _LIBCUDACXX_HAS_THREAD_API_EXTERNAL +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || defined(__EMSCRIPTEN__) +# define _LIBCUDACXX_HAS_THREAD_API_EXTERNAL +#endif +#endif // _LIBCUDACXX_HAS_THREAD_API_EXTERNAL + +#ifndef _LIBCUDACXX_HAS_THREAD_API_CUDA +#if defined(__cuda_std__) \ + && (defined(__CUDA_ARCH__) || defined(__EMSCRIPTEN__)) +# define _LIBCUDACXX_HAS_THREAD_API_CUDA +#endif // __cuda_std__ +#endif // _LIBCUDACXX_HAS_THREAD_API_CUDA + +#ifndef _LIBCUDACXX_HAS_THREAD_API_WIN32 +#if defined(_LIBCUDACXX_COMPILER_MSVC) \ + && !defined(_LIBCUDACXX_HAS_THREAD_API_CUDA) +# define _LIBCUDACXX_HAS_THREAD_API_WIN32 +#endif +#endif // _LIBCUDACXX_HAS_THREAD_API_WIN32 + +#if !defined(_LIBCUDACXX_HAS_NO_THREADS) \ + && !defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) \ + && !defined(_LIBCUDACXX_HAS_THREAD_API_WIN32) \ + && !defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL) +# if defined(__FreeBSD__) || \ + defined(__Fuchsia__) || \ + defined(__wasi__) || \ + defined(__NetBSD__) || \ + defined(__linux__) || \ + defined(__GNU__) || \ + defined(__APPLE__) || \ + defined(__CloudABI__) || \ + defined(__sun__) || \ + (defined(__MINGW32__) && __has_include()) +# define _LIBCUDACXX_HAS_THREAD_API_PTHREAD +# elif defined(_LIBCUDACXX_WIN32API) +# define _LIBCUDACXX_HAS_THREAD_API_WIN32 +# else +# define _LIBCUDACXX_UNSUPPORTED_THREAD_API +# endif // _LIBCUDACXX_HAS_THREAD_API +#endif // _LIBCUDACXX_HAS_NO_THREADS + +#if defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) +#if defined(__ANDROID__) && __ANDROID_API__ >= 30 +#define _LIBCUDACXX_HAS_COND_CLOCKWAIT +#elif defined(_LIBCUDACXX_GLIBC_PREREQ) +#if _LIBCUDACXX_GLIBC_PREREQ(2, 30) +#define _LIBCUDACXX_HAS_COND_CLOCKWAIT +#endif +#endif +#endif + +#if defined(_LIBCUDACXX_HAS_NO_THREADS) && defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) +#error _LIBCUDACXX_HAS_THREAD_API_PTHREAD may only be defined when \ + _LIBCUDACXX_HAS_NO_THREADS is not defined. +#endif + +#if defined(_LIBCUDACXX_HAS_NO_THREADS) && defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL) +#error _LIBCUDACXX_HAS_THREAD_API_EXTERNAL may not be defined when \ + _LIBCUDACXX_HAS_NO_THREADS is defined. +#endif + +#if defined(__STDCPP_THREADS__) && defined(_LIBCUDACXX_HAS_NO_THREADS) +#error _LIBCUDACXX_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set. +#endif + +#if !defined(_LIBCUDACXX_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__) +#define __STDCPP_THREADS__ 1 +#endif + +// The glibc and Bionic implementation of pthreads implements +// pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32 +// mutexes have no destroy mechanism. +// +// This optimization can't be performed on Apple platforms, where +// pthread_mutex_destroy can allow the kernel to release resources. +// See https://llvm.org/D64298 for details. +// +// TODO(EricWF): Enable this optimization on Bionic after speaking to their +// respective stakeholders. +#if (defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \ + || defined(_LIBCUDACXX_HAS_THREAD_API_WIN32) +# define _LIBCUDACXX_HAS_TRIVIAL_MUTEX_DESTRUCTION +#endif + +// Destroying a condvar is a nop on Windows. +// +// This optimization can't be performed on Apple platforms, where +// pthread_cond_destroy can allow the kernel to release resources. +// See https://llvm.org/D64298 for details. +// +// TODO(EricWF): This is potentially true for some pthread implementations +// as well. +#if defined(_LIBCUDACXX_HAS_THREAD_API_WIN32) +# define _LIBCUDACXX_HAS_TRIVIAL_CONDVAR_DESTRUCTION +#endif + +// Systems that use capability-based security (FreeBSD with Capsicum, +// Nuxi CloudABI) may only provide local filesystem access (using *at()). +// Functions like open(), rename(), unlink() and stat() should not be +// used, as they attempt to access the global filesystem namespace. +#ifdef __CloudABI__ +#define _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +#endif + +// CloudABI is intended for running networked services. Processes do not +// have standard input and output channels. +#ifdef __CloudABI__ +#define _LIBCUDACXX_HAS_NO_STDIN +#define _LIBCUDACXX_HAS_NO_STDOUT +#endif + +// Some systems do not provide gets() in their C library, for security reasons. +#ifndef _LIBCUDACXX_C_HAS_NO_GETS +# if defined(_LIBCUDACXX_MSVCRT) || (defined(__FreeBSD__) && __FreeBSD__ >= 13) +# define _LIBCUDACXX_C_HAS_NO_GETS +# endif +#endif + +#if defined(__BIONIC__) || defined(__CloudABI__) || \ + defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCUDACXX_HAS_MUSL_LIBC) +#define _LIBCUDACXX_PROVIDES_DEFAULT_RUNE_TABLE +#endif + +// Thread-unsafe functions such as strtok() and localtime() +// are not available. +#ifdef __CloudABI__ +#define _LIBCUDACXX_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS +#endif + +// TODO: Support C11 Atomics? +// #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) +// # define _LIBCUDACXX_HAS_C_ATOMIC_IMP +#if defined(_LIBCUDACXX_COMPILER_ICC) +# define _LIBCUDACXX_HAS_GCC_ATOMIC_IMP +#elif defined(_LIBCUDACXX_COMPILER_CLANG) +# define _LIBCUDACXX_HAS_GCC_ATOMIC_IMP +#elif defined(_LIBCUDACXX_COMPILER_GCC) +# define _LIBCUDACXX_HAS_GCC_ATOMIC_IMP +#elif defined(_LIBCUDACXX_COMPILER_NVHPC) +# define _LIBCUDACXX_HAS_GCC_ATOMIC_IMP +#elif defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_HAS_MSVC_ATOMIC_IMPL +#endif + +// CUDA Atomics supersede host atomics in order to insert the host/device dispatch layer +#if defined(_LIBCUDACXX_COMPILER_NVCC) || defined(_LIBCUDACXX_COMPILER_NVRTC) || defined(_LIBCUDACXX_COMPILER_NVHPC) || defined(_LIBCUDACXX_CUDACC) +# define _LIBCUDACXX_HAS_CUDA_ATOMIC_IMPL +#endif + +#if (!defined(_LIBCUDACXX_HAS_C_ATOMIC_IMP) && \ + !defined(_LIBCUDACXX_HAS_GCC_ATOMIC_IMP) && \ + !defined(_LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP)) \ + || defined(_LIBCUDACXX_HAS_NO_THREADS) +# define _LIBCUDACXX_HAS_NO_ATOMIC_HEADER +#else +# ifdef __cuda_std__ +# undef _LIBCUDACXX_ATOMIC_FLAG_TYPE +# define _LIBCUDACXX_ATOMIC_FLAG_TYPE int +# endif +# ifndef _LIBCUDACXX_ATOMIC_FLAG_TYPE +# define _LIBCUDACXX_ATOMIC_FLAG_TYPE bool +# endif +# ifdef _LIBCUDACXX_FREESTANDING +# define _LIBCUDACXX_ATOMIC_ONLY_USE_BUILTINS +# endif +#endif + +#ifndef _LIBCUDACXX_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#define _LIBCUDACXX_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#endif + +#if defined(_LIBCUDACXX_ENABLE_THREAD_SAFETY_ANNOTATIONS) +# if defined(_LIBCUDACXX_COMPILER_CLANG) && __has_attribute(acquire_capability) +// Work around the attribute handling in clang. When both __declspec and +// __attribute__ are present, the processing goes awry preventing the definition +// of the types. +# if !defined(_LIBCUDACXX_OBJECT_FORMAT_COFF) +# define _LIBCUDACXX_HAS_THREAD_SAFETY_ANNOTATIONS +# endif +# endif +#endif + +#if __has_attribute(require_constant_initialization) +# define _LIBCUDACXX_SAFE_STATIC __attribute__((__require_constant_initialization__)) +#else +# define _LIBCUDACXX_SAFE_STATIC +#endif + +#if !defined(_LIBCUDACXX_HAS_NO_OFF_T_FUNCTIONS) +# if defined(_LIBCUDACXX_MSVCRT) || defined(_NEWLIB_VERSION) +# define _LIBCUDACXX_HAS_NO_OFF_T_FUNCTIONS +# endif +#endif + +#if __has_attribute(diagnose_if) && !defined(_LIBCUDACXX_DISABLE_ADDITIONAL_DIAGNOSTICS) +# define _LIBCUDACXX_DIAGNOSE_WARNING(...) \ + __attribute__((diagnose_if(__VA_ARGS__, "warning"))) +# define _LIBCUDACXX_DIAGNOSE_ERROR(...) \ + __attribute__((diagnose_if(__VA_ARGS__, "error"))) +#else +# define _LIBCUDACXX_DIAGNOSE_WARNING(...) +# define _LIBCUDACXX_DIAGNOSE_ERROR(...) +#endif + +// Use a function like macro to imply that it must be followed by a semicolon +#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) +# define _LIBCUDACXX_FALLTHROUGH() [[fallthrough]] +#elif defined(_LIBCUDACXX_COMPILER_NVRTC) +# define _LIBCUDACXX_FALLTHROUGH() ((void)0) +#elif __has_cpp_attribute(clang::fallthrough) +# define _LIBCUDACXX_FALLTHROUGH() [[clang::fallthrough]] +#elif defined(_LIBCUDACXX_COMPILER_NVHPC) +# define _LIBCUDACXX_FALLTHROUGH() +#elif __has_attribute(fallthough) || _GNUC_VER >= 700 +# define _LIBCUDACXX_FALLTHROUGH() __attribute__((__fallthrough__)) +#else +# define _LIBCUDACXX_FALLTHROUGH() ((void)0) +#endif + +#if __has_attribute(__nodebug__) +#define _LIBCUDACXX_NODEBUG __attribute__((__nodebug__)) +#else +#define _LIBCUDACXX_NODEBUG +#endif + +# if __has_attribute(__preferred_name__) +# define _LIBCUDACXX_PREFERRED_NAME(x) __attribute__((__preferred_name__(x))) +# else +# define _LIBCUDACXX_PREFERRED_NAME(x) +# endif + +#if defined(_LIBCUDACXX_ABI_MICROSOFT) && \ + (defined(_LIBCUDACXX_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) +# define _LIBCUDACXX_DECLSPEC_EMPTY_BASES __declspec(empty_bases) +#else +# define _LIBCUDACXX_DECLSPEC_EMPTY_BASES +#endif + +#if defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_FEATURES) +#define _LIBCUDACXX_ENABLE_CXX17_REMOVED_AUTO_PTR +#define _LIBCUDACXX_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS +#define _LIBCUDACXX_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE +#define _LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS +#endif // _LIBCUDACXX_ENABLE_CXX17_REMOVED_FEATURES + +#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611 +#define _LIBCUDACXX_HAS_NO_DEDUCTION_GUIDES +#endif + +#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L +#define _LIBCUDACXX_HAS_NO_COROUTINES +#endif + +// We need `is_constant_evaluated` for clang and gcc. MSVC also needs extensive rework +#if !defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) +#define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS +#elif defined(__CUDACC_RTC__) +#define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS +#elif defined(_MSC_VER) +#define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS +#elif defined(_LIBCUDACXX_CUDACC_BELOW_11_8) +#define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS +#endif + +// FIXME: Correct this macro when either (A) a feature test macro for the +// spaceship operator is provided, or (B) a compiler provides a complete +// implementation. +#define _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR + +#define _LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS + +// The stream API was dropped and re-added in the dylib shipped on macOS +// and iOS. We can only assume the dylib to provide these definitions for +// macosx >= 10.9 and ios >= 7.0. Otherwise, the definitions are available +// from the headers, but not from the dylib. Explicit instantiation +// declarations for streams exist conditionally to this; if we provide +// an explicit instantiation declaration and we try to deploy to a dylib +// that does not provide those symbols, we'll get a load-time error. +#if !defined(_LIBCUDACXX_BUILDING_LIBRARY) && \ + ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000)) +# define _LIBCUDACXX_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB +#endif + +#if defined(_LIBCUDACXX_HAS_NO_PRAGMA_PUSH_POP_MACRO) +# define _LIBCUDACXX_PUSH_MACROS +# define _LIBCUDACXX_POP_MACROS +#else + // Don't warn about macro conflicts when we can restore them at the + // end of the header. +# ifndef _LIBCUDACXX_DISABLE_MACRO_CONFLICT_WARNINGS +# define _LIBCUDACXX_DISABLE_MACRO_CONFLICT_WARNINGS +# endif +# if defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_PUSH_MACROS \ + __pragma(push_macro("min")) \ + __pragma(push_macro("max")) +# define _LIBCUDACXX_POP_MACROS \ + __pragma(pop_macro("min")) \ + __pragma(pop_macro("max")) +# else +# define _LIBCUDACXX_PUSH_MACROS \ + _Pragma("push_macro(\"min\")") \ + _Pragma("push_macro(\"max\")") +# define _LIBCUDACXX_POP_MACROS \ + _Pragma("pop_macro(\"min\")") \ + _Pragma("pop_macro(\"max\")") +# endif +#endif // defined(_LIBCUDACXX_HAS_NO_PRAGMA_PUSH_POP_MACRO) + +#if !defined(_LIBCUDACXX_NO_AUTO_LINK) && !defined(__cuda_std__) +# if defined(_LIBCUDACXX_ABI_MICROSOFT) && !defined(_LIBCUDACXX_BUILDING_LIBRARY) +# if defined(_DLL) +# pragma comment(lib, "c++.lib") +# else +# pragma comment(lib, "libc++.lib") +# endif +# endif // defined(_LIBCUDACXX_ABI_MICROSOFT) && !defined(_LIBCUDACXX_BUILDING_LIBRARY) +#endif // !defined(_LIBCUDACXX_NO_AUTO_LINK) + +#define _LIBCUDACXX_UNUSED_VAR(x) ((void)(x)) + +// Configures the fopen close-on-exec mode character, if any. This string will +// be appended to any mode string used by fstream for fopen/fdopen. +// +// Not all platforms support this, but it helps avoid fd-leaks on platforms that +// do. +#if defined(__BIONIC__) +# define _LIBCUDACXX_FOPEN_CLOEXEC_MODE "e" +#else +# define _LIBCUDACXX_FOPEN_CLOEXEC_MODE +#endif + +# if __has_attribute(__format__) +// The attribute uses 1-based indices for ordinary and static member functions. +// The attribute uses 2-based indices for non-static member functions. +# define _LIBCUDACXX_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \ + __attribute__((__format__(archetype, format_string_index, first_format_arg_index))) +# else +# define _LIBCUDACXX_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) /* nothing */ +# endif + +#ifndef _LIBCUDACXX_SYS_CLOCK_DURATION +#if defined(__cuda_std__) +# define _LIBCUDACXX_SYS_CLOCK_DURATION nanoseconds +#else +# define _LIBCUDACXX_SYS_CLOCK_DURATION microseconds +#endif +#endif // _LIBCUDACXX_SYS_CLOCK_DURATION + +// There are a handful of public standard library types that are intended to +// support CTAD but don't need any explicit deduction guides to do so. This +// macro is used to mark them as such, which suppresses the +// '-Wctad-maybe-unsupported' compiler warning when CTAD is used in user code +// with these classes. +#if (!defined(_LIBCUDACXX_COMPILER_GCC) || __GNUC__ > 6) \ + && _LIBCUDACXX_STD_VER >= 17 +# define _LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \ + template \ + _ClassName(typename _Tag::__allow_ctad...) -> _ClassName<_Tag...> +#else +# define _LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") +#endif + +#if (defined(__CUDACC_VER_MAJOR__) && __CUDACC_VER_MAJOR__ <= 11) \ + && (defined(__CUDACC_VER_MINOR__) && __CUDACC_VER_MINOR__ <= 2) +# define _LIBCUDACXX_CONSTEXPR_GLOBAL const +#else +# define _LIBCUDACXX_CONSTEXPR_GLOBAL constexpr +#endif + +#if defined(__CUDA_ARCH__) +# define _LIBCUDACXX_CPO_ACCESSIBILITY _LIBCUDACXX_DEVICE _LIBCUDACXX_CONSTEXPR_GLOBAL +#else +# define _LIBCUDACXX_CPO_ACCESSIBILITY _LIBCUDACXX_INLINE_VAR constexpr +#endif + +#if _LIBCUDACXX_STD_VER > 14 +# define _LIBCUDACXX_TRAIT(__TRAIT, ...) __TRAIT##_v<__VA_ARGS__> +#else +# define _LIBCUDACXX_TRAIT(__TRAIT, ...) __TRAIT<__VA_ARGS__>::value +#endif + +// Older nvcc do not handle the constraint of `construct_at` in earlier std modes +// So to preserve our performance optimization we default to the unconstrained +// `__construct_at` and only in C++20 use `construct_at` +#if _LIBCUDACXX_STD_VER > 17 +# define _LIBCUDACXX_CONSTRUCT_AT(_LOCATION, ...) \ + _CUDA_VSTD::construct_at(_CUDA_VSTD::addressof(_LOCATION), __VA_ARGS__) +#else +# define _LIBCUDACXX_CONSTRUCT_AT(_LOCATION, ...) \ + _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(_LOCATION), __VA_ARGS__) +#endif + +#if !defined(_LIBCUDACXX_DISABLE_EXEC_CHECK) +#if defined(_LIBCUDACXX_CUDACC) \ + && !defined(_LIBCUDACXX_COMPILER_NVRTC) \ + && !defined(_LIBCUDACXX_COMPILER_NVHPC_CUDA) \ + && !defined(_LIBCUDACXX_COMPILER_CLANG_CUDA) +# if defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_DISABLE_EXEC_CHECK __pragma("nv_exec_check_disable") +# else // ^^^ _LIBCUDACXX_COMPILER_MSVC ^^^ / vvv !_LIBCUDACXX_COMPILER_MSVC vvv +# define _LIBCUDACXX_DISABLE_EXEC_CHECK _Pragma("nv_exec_check_disable") +# endif // !_LIBCUDACXX_COMPILER_MSVC +#else // ^^^ !NVRTC && !NVHPC-cuda && !clang-cuda ^^^ / vvv NVRTC || NVHPC-cuda || clang-cuda vvv +# define _LIBCUDACXX_DISABLE_EXEC_CHECK +#endif // NVRTC || NVHPC-cuda || clang-cuda +#endif // !_LIBCUDACXX_DISABLE_EXEC_CHECK + +#define _LIBCUDACXX_HAS_NO_INCOMPLETE_RANGES + +#endif // __cplusplus + +#endif // _LIBCUDACXX_CONFIG diff --git a/cuda_toolkit/include/__config_site.in b/cuda_toolkit/include/__config_site.in new file mode 100644 index 0000000000000000000000000000000000000000..ab65c9554b0b4b5697cb3baeff154a784328ea8c --- /dev/null +++ b/cuda_toolkit/include/__config_site.in @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CONFIG_SITE +#define _LIBCUDACXX_CONFIG_SITE + +#cmakedefine _LIBCUDACXX_ABI_VERSION @_LIBCUDACXX_ABI_VERSION@ +#cmakedefine _LIBCUDACXX_ABI_UNSTABLE +#cmakedefine _LIBCUDACXX_ABI_FORCE_ITANIUM +#cmakedefine _LIBCUDACXX_ABI_FORCE_MICROSOFT +#cmakedefine _LIBCUDACXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT +#cmakedefine _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +#cmakedefine _LIBCUDACXX_HAS_NO_STDIN +#cmakedefine _LIBCUDACXX_HAS_NO_STDOUT +#cmakedefine _LIBCUDACXX_HAS_NO_THREADS +#cmakedefine _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK +#cmakedefine _LIBCUDACXX_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS +#cmakedefine _LIBCUDACXX_HAS_MUSL_LIBC +#cmakedefine _LIBCUDACXX_HAS_THREAD_API_PTHREAD +#cmakedefine _LIBCUDACXX_HAS_THREAD_API_EXTERNAL +#cmakedefine _LIBCUDACXX_HAS_THREAD_API_WIN32 +#cmakedefine _LIBCUDACXX_HAS_THREAD_LIBRARY_EXTERNAL +#cmakedefine _LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS +#cmakedefine _LIBCUDACXX_NO_VCRUNTIME +#cmakedefine01 _LIBCUDACXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT +#cmakedefine _LIBCUDACXX_ABI_NAMESPACE @_LIBCUDACXX_ABI_NAMESPACE@ +#cmakedefine _LIBCUDACXX_HAS_PARALLEL_ALGORITHMS + +@_LIBCUDACXX_ABI_DEFINES@ + +#endif // _LIBCUDACXX_CONFIG_SITE diff --git a/cuda_toolkit/include/__debug b/cuda_toolkit/include/__debug new file mode 100644 index 0000000000000000000000000000000000000000..30d5f9b2843f1b933ed392fa845028ab250ce961 --- /dev/null +++ b/cuda_toolkit/include/__debug @@ -0,0 +1,279 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___DEBUG +#define _LIBCUDACXX___DEBUG + +#ifndef __cuda_std__ +#include <__config> +#endif //__cuda_std__ + +#include "__assert" +#include "__type_traits/is_constant_evaluated.h" +#include "cstddef" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#if defined(_LIBCUDACXX_ENABLE_DEBUG_MODE) && !defined(_LIBCUDACXX_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY) +# define _LIBCUDACXX_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY +#endif + +#if defined(_LIBCUDACXX_ENABLE_DEBUG_MODE) && !defined(_LIBCUDACXX_DEBUG_ITERATOR_BOUNDS_CHECKING) +# define _LIBCUDACXX_DEBUG_ITERATOR_BOUNDS_CHECKING +#endif + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE +# define _LIBCUDACXX_DEBUG_ASSERT(x, m) _LIBCUDACXX_ASSERT(::std::__libcpp_is_constant_evaluated() || (x), m) +#else +# define _LIBCUDACXX_DEBUG_ASSERT(x, m) ((void)0) +#endif + +#if defined(_LIBCUDACXX_ENABLE_DEBUG_MODE) || defined(_LIBCUDACXX_BUILDING_LIBRARY) + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +struct _LIBCUDACXX_TYPE_VIS __c_node; + +struct _LIBCUDACXX_TYPE_VIS __i_node +{ + void* __i_; + __i_node* __next_; + __c_node* __c_; + + __i_node(const __i_node&) = delete; + __i_node& operator=(const __i_node&) = delete; + + _LIBCUDACXX_INLINE_VISIBILITY + __i_node(void* __i, __i_node* __next, __c_node* __c) + : __i_(__i), __next_(__next), __c_(__c) {} + ~__i_node(); +}; + +struct _LIBCUDACXX_TYPE_VIS __c_node +{ + void* __c_; + __c_node* __next_; + __i_node** beg_; + __i_node** end_; + __i_node** cap_; + + __c_node(const __c_node&) = delete; + __c_node& operator=(const __c_node&) = delete; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __c_node(void* __c, __c_node* __next) + : __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {} + virtual ~__c_node(); + + virtual bool __dereferenceable(const void*) const = 0; + virtual bool __decrementable(const void*) const = 0; + virtual bool __addable(const void*, ptrdiff_t) const = 0; + virtual bool __subscriptable(const void*, ptrdiff_t) const = 0; + + void __add(__i_node* __i); + _LIBCUDACXX_HIDDEN void __remove(__i_node* __i); +}; + +template +struct _C_node + : public __c_node +{ + explicit _C_node(void* __c, __c_node* __n) + : __c_node(__c, __n) {} + + bool __dereferenceable(const void*) const override; + bool __decrementable(const void*) const override; + bool __addable(const void*, ptrdiff_t) const override; + bool __subscriptable(const void*, ptrdiff_t) const override; +}; + +template +inline bool +_C_node<_Cont>::__dereferenceable(const void* __i) const +{ + typedef typename _Cont::const_iterator iterator; + const iterator* __j = static_cast(__i); + _Cont* _Cp = static_cast<_Cont*>(__c_); + return _Cp->__dereferenceable(__j); +} + +template +inline bool +_C_node<_Cont>::__decrementable(const void* __i) const +{ + typedef typename _Cont::const_iterator iterator; + const iterator* __j = static_cast(__i); + _Cont* _Cp = static_cast<_Cont*>(__c_); + return _Cp->__decrementable(__j); +} + +template +inline bool +_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const +{ + typedef typename _Cont::const_iterator iterator; + const iterator* __j = static_cast(__i); + _Cont* _Cp = static_cast<_Cont*>(__c_); + return _Cp->__addable(__j, __n); +} + +template +inline bool +_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const +{ + typedef typename _Cont::const_iterator iterator; + const iterator* __j = static_cast(__i); + _Cont* _Cp = static_cast<_Cont*>(__c_); + return _Cp->__subscriptable(__j, __n); +} + +class _LIBCUDACXX_TYPE_VIS __libcpp_db +{ + __c_node** __cbeg_; + __c_node** __cend_; + size_t __csz_; + __i_node** __ibeg_; + __i_node** __iend_; + size_t __isz_; + + explicit __libcpp_db(); +public: + __libcpp_db(const __libcpp_db&) = delete; + __libcpp_db& operator=(const __libcpp_db&) = delete; + + ~__libcpp_db(); + + class __db_c_iterator; + class __db_c_const_iterator; + class __db_i_iterator; + class __db_i_const_iterator; + + __db_c_const_iterator __c_end() const; + __db_i_const_iterator __i_end() const; + + typedef __c_node*(_InsertConstruct)(void*, void*, __c_node*); + + template + _LIBCUDACXX_INLINE_VISIBILITY static __c_node* __create_C_node(void *__mem, void *__c, __c_node *__next) { + return ::new (__mem) _C_node<_Cont>(__c, __next); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + void __insert_c(_Cont* __c) + { + __insert_c(static_cast(__c), &__create_C_node<_Cont>); + } + + void __insert_i(void* __i); + void __insert_c(void* __c, _InsertConstruct* __fn); + void __erase_c(void* __c); + + void __insert_ic(void* __i, const void* __c); + void __iterator_copy(void* __i, const void* __i0); + void __erase_i(void* __i); + + void* __find_c_from_i(void* __i) const; + void __invalidate_all(void* __c); + __c_node* __find_c_and_lock(void* __c) const; + __c_node* __find_c(void* __c) const; + void unlock() const; + + void swap(void* __c1, void* __c2); + + + bool __dereferenceable(const void* __i) const; + bool __decrementable(const void* __i) const; + bool __addable(const void* __i, ptrdiff_t __n) const; + bool __subscriptable(const void* __i, ptrdiff_t __n) const; + bool __less_than_comparable(const void* __i, const void* __j) const; +private: + _LIBCUDACXX_HIDDEN + __i_node* __insert_iterator(void* __i); + _LIBCUDACXX_HIDDEN + __i_node* __find_iterator(const void* __i) const; + + friend _LIBCUDACXX_FUNC_VIS __libcpp_db* __get_db(); +}; + +_LIBCUDACXX_FUNC_VIS __libcpp_db* __get_db(); +_LIBCUDACXX_FUNC_VIS const __libcpp_db* __get_const_db(); + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // defined(_LIBCUDACXX_ENABLE_DEBUG_MODE) || defined(_LIBCUDACXX_BUILDING_LIBRARY) + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_c(_Tp* __c) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + if (!__libcpp_is_constant_evaluated()) + __get_db()->__insert_c(__c); +#else + (void)(__c); +#endif +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_i(_Tp* __i) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + if (!__libcpp_is_constant_evaluated()) + __get_db()->__insert_i(__i); +#else + (void)(__i); +#endif +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 inline void __debug_db_erase_c(_Tp* __c) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + if (!__libcpp_is_constant_evaluated()) + __get_db()->__erase_c(__c); +#else + (void)(__c); +#endif +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 inline void __debug_db_swap(_Tp* __lhs, _Tp* __rhs) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + if (!__libcpp_is_constant_evaluated()) + __get_db()->swap(__lhs, __rhs); +#else + (void)(__lhs); + (void)(__rhs); +#endif +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 inline void __debug_db_invalidate_all(_Tp* __c) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + if (!__libcpp_is_constant_evaluated()) + __get_db()->__invalidate_all(__c); +#else + (void)(__c); +#endif +} + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX___DEBUG diff --git a/cuda_toolkit/include/__errc b/cuda_toolkit/include/__errc new file mode 100644 index 0000000000000000000000000000000000000000..f58e63e436e3ae811cc6fa7d86488d91b4ac3ee3 --- /dev/null +++ b/cuda_toolkit/include/__errc @@ -0,0 +1,221 @@ +// -*- C++ -*- +//===---------------------------- __errc ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___ERRC +#define _LIBCUDACXX___ERRC + +/* + system_error synopsis + +namespace std +{ + +enum class errc +{ + address_family_not_supported, // EAFNOSUPPORT + address_in_use, // EADDRINUSE + address_not_available, // EADDRNOTAVAIL + already_connected, // EISCONN + argument_list_too_long, // E2BIG + argument_out_of_domain, // EDOM + bad_address, // EFAULT + bad_file_descriptor, // EBADF + bad_message, // EBADMSG + broken_pipe, // EPIPE + connection_aborted, // ECONNABORTED + connection_already_in_progress, // EALREADY + connection_refused, // ECONNREFUSED + connection_reset, // ECONNRESET + cross_device_link, // EXDEV + destination_address_required, // EDESTADDRREQ + device_or_resource_busy, // EBUSY + directory_not_empty, // ENOTEMPTY + executable_format_error, // ENOEXEC + file_exists, // EEXIST + file_too_large, // EFBIG + filename_too_long, // ENAMETOOLONG + function_not_supported, // ENOSYS + host_unreachable, // EHOSTUNREACH + identifier_removed, // EIDRM + illegal_byte_sequence, // EILSEQ + inappropriate_io_control_operation, // ENOTTY + interrupted, // EINTR + invalid_argument, // EINVAL + invalid_seek, // ESPIPE + io_error, // EIO + is_a_directory, // EISDIR + message_size, // EMSGSIZE + network_down, // ENETDOWN + network_reset, // ENETRESET + network_unreachable, // ENETUNREACH + no_buffer_space, // ENOBUFS + no_child_process, // ECHILD + no_link, // ENOLINK + no_lock_available, // ENOLCK + no_message_available, // ENODATA + no_message, // ENOMSG + no_protocol_option, // ENOPROTOOPT + no_space_on_device, // ENOSPC + no_stream_resources, // ENOSR + no_such_device_or_address, // ENXIO + no_such_device, // ENODEV + no_such_file_or_directory, // ENOENT + no_such_process, // ESRCH + not_a_directory, // ENOTDIR + not_a_socket, // ENOTSOCK + not_a_stream, // ENOSTR + not_connected, // ENOTCONN + not_enough_memory, // ENOMEM + not_supported, // ENOTSUP + operation_canceled, // ECANCELED + operation_in_progress, // EINPROGRESS + operation_not_permitted, // EPERM + operation_not_supported, // EOPNOTSUPP + operation_would_block, // EWOULDBLOCK + owner_dead, // EOWNERDEAD + permission_denied, // EACCES + protocol_error, // EPROTO + protocol_not_supported, // EPROTONOSUPPORT + read_only_file_system, // EROFS + resource_deadlock_would_occur, // EDEADLK + resource_unavailable_try_again, // EAGAIN + result_out_of_range, // ERANGE + state_not_recoverable, // ENOTRECOVERABLE + stream_timeout, // ETIME + text_file_busy, // ETXTBSY + timed_out, // ETIMEDOUT + too_many_files_open_in_system, // ENFILE + too_many_files_open, // EMFILE + too_many_links, // EMLINK + too_many_symbolic_link_levels, // ELOOP + value_too_large, // EOVERFLOW + wrong_protocol_type // EPROTOTYPE +}; + +*/ + +#include <__config> +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +// Some error codes are not present on all platforms, so we provide equivalents +// for them: + +//enum class errc +_LIBCUDACXX_DECLARE_STRONG_ENUM(errc) +{ + address_family_not_supported = EAFNOSUPPORT, + address_in_use = EADDRINUSE, + address_not_available = EADDRNOTAVAIL, + already_connected = EISCONN, + argument_list_too_long = E2BIG, + argument_out_of_domain = EDOM, + bad_address = EFAULT, + bad_file_descriptor = EBADF, + bad_message = EBADMSG, + broken_pipe = EPIPE, + connection_aborted = ECONNABORTED, + connection_already_in_progress = EALREADY, + connection_refused = ECONNREFUSED, + connection_reset = ECONNRESET, + cross_device_link = EXDEV, + destination_address_required = EDESTADDRREQ, + device_or_resource_busy = EBUSY, + directory_not_empty = ENOTEMPTY, + executable_format_error = ENOEXEC, + file_exists = EEXIST, + file_too_large = EFBIG, + filename_too_long = ENAMETOOLONG, + function_not_supported = ENOSYS, + host_unreachable = EHOSTUNREACH, + identifier_removed = EIDRM, + illegal_byte_sequence = EILSEQ, + inappropriate_io_control_operation = ENOTTY, + interrupted = EINTR, + invalid_argument = EINVAL, + invalid_seek = ESPIPE, + io_error = EIO, + is_a_directory = EISDIR, + message_size = EMSGSIZE, + network_down = ENETDOWN, + network_reset = ENETRESET, + network_unreachable = ENETUNREACH, + no_buffer_space = ENOBUFS, + no_child_process = ECHILD, + no_link = ENOLINK, + no_lock_available = ENOLCK, +#ifdef ENODATA + no_message_available = ENODATA, +#else + no_message_available = ENOMSG, +#endif + no_message = ENOMSG, + no_protocol_option = ENOPROTOOPT, + no_space_on_device = ENOSPC, +#ifdef ENOSR + no_stream_resources = ENOSR, +#else + no_stream_resources = ENOMEM, +#endif + no_such_device_or_address = ENXIO, + no_such_device = ENODEV, + no_such_file_or_directory = ENOENT, + no_such_process = ESRCH, + not_a_directory = ENOTDIR, + not_a_socket = ENOTSOCK, +#ifdef ENOSTR + not_a_stream = ENOSTR, +#else + not_a_stream = EINVAL, +#endif + not_connected = ENOTCONN, + not_enough_memory = ENOMEM, + not_supported = ENOTSUP, + operation_canceled = ECANCELED, + operation_in_progress = EINPROGRESS, + operation_not_permitted = EPERM, + operation_not_supported = EOPNOTSUPP, + operation_would_block = EWOULDBLOCK, + owner_dead = EOWNERDEAD, + permission_denied = EACCES, + protocol_error = EPROTO, + protocol_not_supported = EPROTONOSUPPORT, + read_only_file_system = EROFS, + resource_deadlock_would_occur = EDEADLK, + resource_unavailable_try_again = EAGAIN, + result_out_of_range = ERANGE, + state_not_recoverable = ENOTRECOVERABLE, +#ifdef ETIME + stream_timeout = ETIME, +#else + stream_timeout = ETIMEDOUT, +#endif + text_file_busy = ETXTBSY, + timed_out = ETIMEDOUT, + too_many_files_open_in_system = ENFILE, + too_many_files_open = EMFILE, + too_many_links = EMLINK, + too_many_symbolic_link_levels = ELOOP, + value_too_large = EOVERFLOW, + wrong_protocol_type = EPROTOTYPE +}; +_LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(errc) + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX___ERRC diff --git a/cuda_toolkit/include/__functional_base b/cuda_toolkit/include/__functional_base new file mode 100644 index 0000000000000000000000000000000000000000..b3a3b064adb0afbcd1b0f1f58946fcc7553cb1cf --- /dev/null +++ b/cuda_toolkit/include/__functional_base @@ -0,0 +1,138 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_FUNCTIONAL_BASE +#define _LIBCUDACXX_FUNCTIONAL_BASE + +#ifndef __cuda_std__ +#include <__config> +#include +#include +#include +#endif // __cuda_std__ + +#include "__functional/binary_function.h" +#include "__functional/operations.h" +#include "__functional/reference_wrapper.h" +#include "__functional/unary_function.h" +#include "__functional/weak_result_type.h" +#include "__type_traits/integral_constant.h" +#include "__type_traits/is_constructible.h" +#include "__type_traits/is_convertible.h" +#include "__type_traits/remove_cvref.h" +#include "__utility/forward.h" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +// allocator_arg_t + +struct _LIBCUDACXX_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; }; + +#if defined(_LIBCUDACXX_BUILDING_LIBRARY) +extern _LIBCUDACXX_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg; +#else +/* _LIBCUDACXX_INLINE_VAR */ constexpr allocator_arg_t allocator_arg = allocator_arg_t(); +#endif + +// uses_allocator + +template +struct __has_allocator_type +{ +private: + struct __two {char __lx; char __lxx;}; + template _LIBCUDACXX_INLINE_VISIBILITY static __two __test(...); + template _LIBCUDACXX_INLINE_VISIBILITY static char __test(typename _Up::allocator_type* = 0); +public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; +}; + +template ::value> +struct __uses_allocator + : public integral_constant::value> +{ +}; + +template +struct __uses_allocator<_Tp, _Alloc, false> + : public false_type +{ +}; + +template +struct _LIBCUDACXX_TEMPLATE_VIS uses_allocator + : public __uses_allocator<_Tp, _Alloc> +{ +}; + +#if _LIBCUDACXX_STD_VER > 14 +template +_LIBCUDACXX_INLINE_VAR constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value; +#endif + +// allocator construction + +template +struct __uses_alloc_ctor_imp +{ + typedef _LIBCUDACXX_NODEBUG_TYPE __remove_cvref_t<_Alloc> _RawAlloc; + static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value; + static const bool __ic = + is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; + static const int value = __ua ? 2 - __ic : 0; +}; + +template +struct __uses_alloc_ctor + : integral_constant::value> + {}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void __user_alloc_construct_impl (integral_constant, _Tp *__storage, const _Allocator &, _Args &&... __args ) +{ + new (__storage) _Tp (_CUDA_VSTD::forward<_Args>(__args)...); +} + +// FIXME: This should have a version which takes a non-const alloc. +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void __user_alloc_construct_impl (integral_constant, _Tp *__storage, const _Allocator &__a, _Args &&... __args ) +{ + new (__storage) _Tp (allocator_arg, __a, _CUDA_VSTD::forward<_Args>(__args)...); +} + +// FIXME: This should have a version which takes a non-const alloc. +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void __user_alloc_construct_impl (integral_constant, _Tp *__storage, const _Allocator &__a, _Args &&... __args ) +{ + new (__storage) _Tp (_CUDA_VSTD::forward<_Args>(__args)..., __a); +} + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif // __cuda_std__ + +#endif // _LIBCUDACXX_FUNCTIONAL_BASE diff --git a/cuda_toolkit/include/__hash_table b/cuda_toolkit/include/__hash_table new file mode 100644 index 0000000000000000000000000000000000000000..fe07ded537471e6b8093984d8ea4731d7259646a --- /dev/null +++ b/cuda_toolkit/include/__hash_table @@ -0,0 +1,2806 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX__HASH_TABLE +#define _LIBCUDACXX__HASH_TABLE + +#include <__config> +#include +#include +#include +#include +#include +#include +#include + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__debug" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template +struct __hash_value_type; + +template +struct __is_hash_value_type_imp : false_type {}; + +template +struct __is_hash_value_type_imp<__hash_value_type<_Key, _Value>> : true_type {}; + +template +struct __is_hash_value_type : false_type {}; + +template +struct __is_hash_value_type<_One> : __is_hash_value_type_imp<__remove_cvref_t<_One>> {}; + +_LIBCUDACXX_FUNC_VIS +size_t __next_prime(size_t __n); + +template +struct __hash_node_base +{ + typedef typename pointer_traits<_NodePtr>::element_type __node_type; + typedef __hash_node_base __first_node; + typedef typename __rebind_pointer<_NodePtr, __first_node>::type __node_base_pointer; + typedef _NodePtr __node_pointer; + +#if defined(_LIBCUDACXX_ABI_FIX_UNORDERED_NODE_POINTER_UB) + typedef __node_base_pointer __next_pointer; +#else + typedef typename conditional< + is_pointer<__node_pointer>::value, + __node_base_pointer, + __node_pointer>::type __next_pointer; +#endif + + __next_pointer __next_; + + _LIBCUDACXX_INLINE_VISIBILITY + __next_pointer __ptr() noexcept { + return static_cast<__next_pointer>( + pointer_traits<__node_base_pointer>::pointer_to(*this)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __node_pointer __upcast() noexcept { + return static_cast<__node_pointer>( + pointer_traits<__node_base_pointer>::pointer_to(*this)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + size_t __hash() const noexcept { + return static_cast<__node_type const&>(*this).__hash_; + } + + _LIBCUDACXX_INLINE_VISIBILITY __hash_node_base() noexcept : __next_(nullptr) {} +}; + +template +struct __hash_node + : public __hash_node_base + < + typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, _VoidPtr> >::type + > +{ + typedef _Tp __node_value_type; + + size_t __hash_; + __node_value_type __value_; +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +__is_hash_power2(size_t __bc) +{ + return __bc > 2 && !(__bc & (__bc - 1)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +size_t +__constrain_hash(size_t __h, size_t __bc) +{ + return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : + (__h < __bc ? __h : __h % __bc); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +size_t +__next_hash_pow2(size_t __n) +{ + return __n < 2 ? __n : (size_t(1) << (std::numeric_limits::digits - __libcpp_clz(__n-1))); +} + + +template class __hash_table; + +template class _LIBCUDACXX_TEMPLATE_VIS __hash_iterator; +template class _LIBCUDACXX_TEMPLATE_VIS __hash_const_iterator; +template class _LIBCUDACXX_TEMPLATE_VIS __hash_local_iterator; +template class _LIBCUDACXX_TEMPLATE_VIS __hash_const_local_iterator; +template class _LIBCUDACXX_TEMPLATE_VIS __hash_map_iterator; +template class _LIBCUDACXX_TEMPLATE_VIS __hash_map_const_iterator; + +template +struct __hash_key_value_types { + static_assert(!is_reference<_Tp>::value && !is_const<_Tp>::value, ""); + typedef _Tp key_type; + typedef _Tp __node_value_type; + typedef _Tp __container_value_type; + static const bool __is_map = false; + + _LIBCUDACXX_INLINE_VISIBILITY + static key_type const& __get_key(_Tp const& __v) { + return __v; + } + _LIBCUDACXX_INLINE_VISIBILITY + static __container_value_type const& __get_value(__node_value_type const& __v) { + return __v; + } + _LIBCUDACXX_INLINE_VISIBILITY + static __container_value_type* __get_ptr(__node_value_type& __n) { + return _CUDA_VSTD::addressof(__n); + } + _LIBCUDACXX_INLINE_VISIBILITY + static __container_value_type&& __move(__node_value_type& __v) { + return _CUDA_VSTD::move(__v); + } +}; + +template +struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > { + typedef _Key key_type; + typedef _Tp mapped_type; + typedef __hash_value_type<_Key, _Tp> __node_value_type; + typedef pair __container_value_type; + typedef __container_value_type __map_value_type; + static const bool __is_map = true; + + _LIBCUDACXX_INLINE_VISIBILITY + static key_type const& __get_key(__container_value_type const& __v) { + return __v.first; + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + static typename enable_if<__is_same_uncvref<_Up, __node_value_type>::value, + __container_value_type const&>::type + __get_value(_Up& __t) { + return __t.__get_value(); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + static typename enable_if<__is_same_uncvref<_Up, __container_value_type>::value, + __container_value_type const&>::type + __get_value(_Up& __t) { + return __t; + } + + _LIBCUDACXX_INLINE_VISIBILITY + static __container_value_type* __get_ptr(__node_value_type& __n) { + return _CUDA_VSTD::addressof(__n.__get_value()); + } + _LIBCUDACXX_INLINE_VISIBILITY + static pair __move(__node_value_type& __v) { + return __v.__move(); + } +}; + +template , + bool = _KVTypes::__is_map> +struct __hash_map_pointer_types {}; + +template +struct __hash_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> { + typedef typename _KVTypes::__map_value_type _Mv; + typedef typename __rebind_pointer<_AllocPtr, _Mv>::type + __map_value_type_pointer; + typedef typename __rebind_pointer<_AllocPtr, const _Mv>::type + __const_map_value_type_pointer; +}; + +template ::element_type> +struct __hash_node_types; + +template +struct __hash_node_types<_NodePtr, __hash_node<_Tp, _VoidPtr> > + : public __hash_key_value_types<_Tp>, __hash_map_pointer_types<_Tp, _VoidPtr> + +{ + typedef __hash_key_value_types<_Tp> __base; + +public: + typedef ptrdiff_t difference_type; + typedef size_t size_type; + + typedef typename __rebind_pointer<_NodePtr, void>::type __void_pointer; + + typedef typename pointer_traits<_NodePtr>::element_type __node_type; + typedef _NodePtr __node_pointer; + + typedef __hash_node_base<__node_pointer> __node_base_type; + typedef typename __rebind_pointer<_NodePtr, __node_base_type>::type + __node_base_pointer; + + typedef typename __node_base_type::__next_pointer __next_pointer; + + typedef _Tp __node_value_type; + typedef typename __rebind_pointer<_VoidPtr, __node_value_type>::type + __node_value_type_pointer; + typedef typename __rebind_pointer<_VoidPtr, const __node_value_type>::type + __const_node_value_type_pointer; + +private: + static_assert(!is_const<__node_type>::value, + "_NodePtr should never be a pointer to const"); + static_assert((is_same::element_type, void>::value), + "_VoidPtr does not point to unqualified void type"); + static_assert((is_same::type, + _NodePtr>::value), "_VoidPtr does not rebind to _NodePtr."); +}; + +template +struct __hash_node_types_from_iterator; +template +struct __hash_node_types_from_iterator<__hash_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {}; +template +struct __hash_node_types_from_iterator<__hash_const_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {}; +template +struct __hash_node_types_from_iterator<__hash_local_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {}; +template +struct __hash_node_types_from_iterator<__hash_const_local_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {}; + + +template +struct __make_hash_node_types { + typedef __hash_node<_NodeValueTp, _VoidPtr> _NodeTp; + typedef typename __rebind_pointer<_VoidPtr, _NodeTp>::type _NodePtr; + typedef __hash_node_types<_NodePtr> type; +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __hash_iterator +{ + typedef __hash_node_types<_NodePtr> _NodeTypes; + typedef _NodePtr __node_pointer; + typedef typename _NodeTypes::__next_pointer __next_pointer; + + __next_pointer __node_; + +public: + typedef forward_iterator_tag iterator_category; + typedef typename _NodeTypes::__node_value_type value_type; + typedef typename _NodeTypes::difference_type difference_type; + typedef value_type& reference; + typedef typename _NodeTypes::__node_value_type_pointer pointer; + + _LIBCUDACXX_INLINE_VISIBILITY __hash_iterator() noexcept : __node_(nullptr) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_DEBUG_MODE(__get_db()->__insert_i(this)); +#endif + } + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + __hash_iterator(const __hash_iterator& __i) + : __node_(__i.__node_) + { + __get_db()->__iterator_copy(this, &__i); + } + + _LIBCUDACXX_INLINE_VISIBILITY + ~__hash_iterator() + { + __get_db()->__erase_i(this); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_iterator& operator=(const __hash_iterator& __i) + { + if (this != &__i) + { + __get_db()->__iterator_copy(this, &__i); + __node_ = __i.__node_; + } + return *this; + } +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable unordered container iterator"); + return __node_->__upcast()->__value_; + } + + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable unordered container iterator"); + return pointer_traits::pointer_to(__node_->__upcast()->__value_); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_iterator& operator++() { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to increment non-incrementable unordered container iterator"); + __node_ = __node_->__next_; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_iterator operator++(int) + { + __hash_iterator __t(*this); + ++(*this); + return __t; + } + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __hash_iterator& __x, const __hash_iterator& __y) + { + return __x.__node_ == __y.__node_; + } + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y) + {return !(__x == __y);} + +private: +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + __hash_iterator(__next_pointer __node, const void* __c) noexcept + : __node_(__node) + { + __get_db()->__insert_ic(this, __c); + } +#else + _LIBCUDACXX_INLINE_VISIBILITY + __hash_iterator(__next_pointer __node) noexcept + : __node_(__node) + {} +#endif + template friend class __hash_table; + template friend class _LIBCUDACXX_TEMPLATE_VIS __hash_const_iterator; + template friend class _LIBCUDACXX_TEMPLATE_VIS __hash_map_iterator; + template friend class _LIBCUDACXX_TEMPLATE_VIS unordered_map; + template friend class _LIBCUDACXX_TEMPLATE_VIS unordered_multimap; +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __hash_const_iterator +{ + static_assert(!is_const::element_type>::value, ""); + typedef __hash_node_types<_NodePtr> _NodeTypes; + typedef _NodePtr __node_pointer; + typedef typename _NodeTypes::__next_pointer __next_pointer; + + __next_pointer __node_; + +public: + typedef __hash_iterator<_NodePtr> __non_const_iterator; + + typedef forward_iterator_tag iterator_category; + typedef typename _NodeTypes::__node_value_type value_type; + typedef typename _NodeTypes::difference_type difference_type; + typedef const value_type& reference; + typedef typename _NodeTypes::__const_node_value_type_pointer pointer; + + + _LIBCUDACXX_INLINE_VISIBILITY __hash_const_iterator() noexcept : __node_(nullptr) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_DEBUG_MODE(__get_db()->__insert_i(this)); +#endif + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_iterator(const __non_const_iterator& __x) noexcept + : __node_(__x.__node_) + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x)); +#endif + } + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_iterator(const __hash_const_iterator& __i) + : __node_(__i.__node_) + { + __get_db()->__iterator_copy(this, &__i); + } + + _LIBCUDACXX_INLINE_VISIBILITY + ~__hash_const_iterator() + { + __get_db()->__erase_i(this); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_iterator& operator=(const __hash_const_iterator& __i) + { + if (this != &__i) + { + __get_db()->__iterator_copy(this, &__i); + __node_ = __i.__node_; + } + return *this; + } +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable unordered container const_iterator"); + return __node_->__upcast()->__value_; + } + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable unordered container const_iterator"); + return pointer_traits::pointer_to(__node_->__upcast()->__value_); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_iterator& operator++() { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to increment non-incrementable unordered container const_iterator"); + __node_ = __node_->__next_; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_iterator operator++(int) + { + __hash_const_iterator __t(*this); + ++(*this); + return __t; + } + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y) + { + return __x.__node_ == __y.__node_; + } + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y) + {return !(__x == __y);} + +private: +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_iterator(__next_pointer __node, const void* __c) noexcept + : __node_(__node) + { + __get_db()->__insert_ic(this, __c); + } +#else + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_iterator(__next_pointer __node) noexcept + : __node_(__node) + {} +#endif + template friend class __hash_table; + template friend class _LIBCUDACXX_TEMPLATE_VIS __hash_map_const_iterator; + template friend class _LIBCUDACXX_TEMPLATE_VIS unordered_map; + template friend class _LIBCUDACXX_TEMPLATE_VIS unordered_multimap; +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __hash_local_iterator +{ + typedef __hash_node_types<_NodePtr> _NodeTypes; + typedef _NodePtr __node_pointer; + typedef typename _NodeTypes::__next_pointer __next_pointer; + + __next_pointer __node_; + size_t __bucket_; + size_t __bucket_count_; + +public: + typedef forward_iterator_tag iterator_category; + typedef typename _NodeTypes::__node_value_type value_type; + typedef typename _NodeTypes::difference_type difference_type; + typedef value_type& reference; + typedef typename _NodeTypes::__node_value_type_pointer pointer; + + _LIBCUDACXX_INLINE_VISIBILITY __hash_local_iterator() noexcept : __node_(nullptr) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_DEBUG_MODE(__get_db()->__insert_i(this)); +#endif + } + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + __hash_local_iterator(const __hash_local_iterator& __i) + : __node_(__i.__node_), + __bucket_(__i.__bucket_), + __bucket_count_(__i.__bucket_count_) + { + __get_db()->__iterator_copy(this, &__i); + } + + _LIBCUDACXX_INLINE_VISIBILITY + ~__hash_local_iterator() + { + __get_db()->__erase_i(this); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_local_iterator& operator=(const __hash_local_iterator& __i) + { + if (this != &__i) + { + __get_db()->__iterator_copy(this, &__i); + __node_ = __i.__node_; + __bucket_ = __i.__bucket_; + __bucket_count_ = __i.__bucket_count_; + } + return *this; + } +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable unordered container local_iterator"); + return __node_->__upcast()->__value_; + } + + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable unordered container local_iterator"); + return pointer_traits::pointer_to(__node_->__upcast()->__value_); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_local_iterator& operator++() { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to increment non-incrementable unordered container local_iterator"); + __node_ = __node_->__next_; + if (__node_ != nullptr && __constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_) + __node_ = nullptr; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_local_iterator operator++(int) + { + __hash_local_iterator __t(*this); + ++(*this); + return __t; + } + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y) + { + return __x.__node_ == __y.__node_; + } + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y) + {return !(__x == __y);} + +private: +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + __hash_local_iterator(__next_pointer __node, size_t __bucket, + size_t __bucket_count, const void* __c) noexcept + : __node_(__node), + __bucket_(__bucket), + __bucket_count_(__bucket_count) + { + __get_db()->__insert_ic(this, __c); + if (__node_ != nullptr) + __node_ = __node_->__next_; + } +#else + _LIBCUDACXX_INLINE_VISIBILITY + __hash_local_iterator(__next_pointer __node, size_t __bucket, + size_t __bucket_count) noexcept + : __node_(__node), + __bucket_(__bucket), + __bucket_count_(__bucket_count) + { + if (__node_ != nullptr) + __node_ = __node_->__next_; + } +#endif + template friend class __hash_table; + template friend class _LIBCUDACXX_TEMPLATE_VIS __hash_const_local_iterator; + template friend class _LIBCUDACXX_TEMPLATE_VIS __hash_map_iterator; +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __hash_const_local_iterator +{ + typedef __hash_node_types<_ConstNodePtr> _NodeTypes; + typedef _ConstNodePtr __node_pointer; + typedef typename _NodeTypes::__next_pointer __next_pointer; + + __next_pointer __node_; + size_t __bucket_; + size_t __bucket_count_; + + typedef pointer_traits<__node_pointer> __pointer_traits; + typedef typename __pointer_traits::element_type __node; + typedef __remove_const_t<__node> __non_const_node; + typedef typename __rebind_pointer<__node_pointer, __non_const_node>::type + __non_const_node_pointer; +public: + typedef __hash_local_iterator<__non_const_node_pointer> + __non_const_iterator; + + typedef forward_iterator_tag iterator_category; + typedef typename _NodeTypes::__node_value_type value_type; + typedef typename _NodeTypes::difference_type difference_type; + typedef const value_type& reference; + typedef typename _NodeTypes::__const_node_value_type_pointer pointer; + + + _LIBCUDACXX_INLINE_VISIBILITY __hash_const_local_iterator() noexcept : __node_(nullptr) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_DEBUG_MODE(__get_db()->__insert_i(this)); +#endif + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_local_iterator(const __non_const_iterator& __x) noexcept + : __node_(__x.__node_), + __bucket_(__x.__bucket_), + __bucket_count_(__x.__bucket_count_) + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x)); +#endif + } + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_local_iterator(const __hash_const_local_iterator& __i) + : __node_(__i.__node_), + __bucket_(__i.__bucket_), + __bucket_count_(__i.__bucket_count_) + { + __get_db()->__iterator_copy(this, &__i); + } + + _LIBCUDACXX_INLINE_VISIBILITY + ~__hash_const_local_iterator() + { + __get_db()->__erase_i(this); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_local_iterator& operator=(const __hash_const_local_iterator& __i) + { + if (this != &__i) + { + __get_db()->__iterator_copy(this, &__i); + __node_ = __i.__node_; + __bucket_ = __i.__bucket_; + __bucket_count_ = __i.__bucket_count_; + } + return *this; + } +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); + return __node_->__upcast()->__value_; + } + + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable unordered container const_local_iterator"); + return pointer_traits::pointer_to(__node_->__upcast()->__value_); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_local_iterator& operator++() { + _LIBCUDACXX_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to increment non-incrementable unordered container const_local_iterator"); + __node_ = __node_->__next_; + if (__node_ != nullptr && __constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_) + __node_ = nullptr; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_local_iterator operator++(int) + { + __hash_const_local_iterator __t(*this); + ++(*this); + return __t; + } + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y) + { + return __x.__node_ == __y.__node_; + } + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y) + {return !(__x == __y);} + +private: +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_local_iterator(__next_pointer __node, size_t __bucket, + size_t __bucket_count, const void* __c) noexcept + : __node_(__node), + __bucket_(__bucket), + __bucket_count_(__bucket_count) + { + __get_db()->__insert_ic(this, __c); + if (__node_ != nullptr) + __node_ = __node_->__next_; + } +#else + _LIBCUDACXX_INLINE_VISIBILITY + __hash_const_local_iterator(__next_pointer __node, size_t __bucket, + size_t __bucket_count) noexcept + : __node_(__node), + __bucket_(__bucket), + __bucket_count_(__bucket_count) + { + if (__node_ != nullptr) + __node_ = __node_->__next_; + } +#endif + template friend class __hash_table; + template friend class _LIBCUDACXX_TEMPLATE_VIS __hash_map_const_iterator; +}; + +template +class __bucket_list_deallocator +{ + typedef _Alloc allocator_type; + typedef allocator_traits __alloc_traits; + typedef typename __alloc_traits::size_type size_type; + + __compressed_pair __data_; +public: + typedef typename __alloc_traits::pointer pointer; + + _LIBCUDACXX_INLINE_VISIBILITY + __bucket_list_deallocator() + noexcept(is_nothrow_default_constructible::value) + : __data_(0) {} + + _LIBCUDACXX_INLINE_VISIBILITY + __bucket_list_deallocator(const allocator_type& __a, size_type __size) + noexcept(is_nothrow_copy_constructible::value) + : __data_(__size, __a) {} + + _LIBCUDACXX_INLINE_VISIBILITY + __bucket_list_deallocator(__bucket_list_deallocator&& __x) + noexcept(is_nothrow_move_constructible::value) + : __data_(_CUDA_VSTD::move(__x.__data_)) + { + __x.size() = 0; + } + + _LIBCUDACXX_INLINE_VISIBILITY + size_type& size() noexcept {return __data_.first();} + _LIBCUDACXX_INLINE_VISIBILITY + size_type size() const noexcept {return __data_.first();} + + _LIBCUDACXX_INLINE_VISIBILITY + allocator_type& __alloc() noexcept {return __data_.second();} + _LIBCUDACXX_INLINE_VISIBILITY + const allocator_type& __alloc() const noexcept {return __data_.second();} + + _LIBCUDACXX_INLINE_VISIBILITY + void operator()(pointer __p) noexcept + { + __alloc_traits::deallocate(__alloc(), __p, size()); + } +}; + +template class __hash_map_node_destructor; + +template +class __hash_node_destructor +{ + typedef _Alloc allocator_type; + typedef allocator_traits __alloc_traits; + +public: + typedef typename __alloc_traits::pointer pointer; +private: + typedef __hash_node_types _NodeTypes; + + allocator_type& __na_; + +public: + bool __value_constructed; + + __hash_node_destructor(__hash_node_destructor const&) = default; + __hash_node_destructor& operator=(const __hash_node_destructor&) = delete; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __hash_node_destructor(allocator_type& __na, + bool __constructed = false) noexcept + : __na_(__na), + __value_constructed(__constructed) + {} + + _LIBCUDACXX_INLINE_VISIBILITY + void operator()(pointer __p) noexcept + { + if (__value_constructed) + __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__value_)); + if (__p) + __alloc_traits::deallocate(__na_, __p, 1); + } + + template friend class __hash_map_node_destructor; +}; + +#if _LIBCUDACXX_STD_VER > 14 +template +struct __generic_container_node_destructor; + +template +struct __generic_container_node_destructor<__hash_node<_Tp, _VoidPtr>, _Alloc> + : __hash_node_destructor<_Alloc> +{ + using __hash_node_destructor<_Alloc>::__hash_node_destructor; +}; +#endif + +template +struct __enforce_unordered_container_requirements { + static_assert(__check_hash_requirements<_Key, _Hash>::value, + "the specified hash does not meet the Hash requirements"); + static_assert(is_copy_constructible<_Equal>::value, + "the specified comparator is required to be copy constructible"); + typedef int type; +}; + +template + _LIBCUDACXX_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value, + "the specified comparator type does not provide a viable const call operator") + _LIBCUDACXX_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value, + "the specified hash functor does not provide a viable const call operator") +typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type +__diagnose_unordered_container_requirements(int); + +// This dummy overload is used so that the compiler won't emit a spurious +// "no matching function for call to __diagnose_unordered_xxx" diagnostic +// when the overload above causes a hard error. +template +int __diagnose_unordered_container_requirements(void*); + +template +class __hash_table +{ +public: + typedef _Tp value_type; + typedef _Hash hasher; + typedef _Equal key_equal; + typedef _Alloc allocator_type; + +private: + typedef allocator_traits __alloc_traits; + typedef typename + __make_hash_node_types::type + _NodeTypes; +public: + + typedef typename _NodeTypes::__node_value_type __node_value_type; + typedef typename _NodeTypes::__container_value_type __container_value_type; + typedef typename _NodeTypes::key_type key_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename __alloc_traits::pointer pointer; + typedef typename __alloc_traits::const_pointer const_pointer; +#ifndef _LIBCUDACXX_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE + typedef typename __alloc_traits::size_type size_type; +#else + typedef typename _NodeTypes::size_type size_type; +#endif + typedef typename _NodeTypes::difference_type difference_type; +public: + // Create __node + + typedef typename _NodeTypes::__node_type __node; + typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; + typedef allocator_traits<__node_allocator> __node_traits; + typedef typename _NodeTypes::__void_pointer __void_pointer; + typedef typename _NodeTypes::__node_pointer __node_pointer; + typedef typename _NodeTypes::__node_pointer __node_const_pointer; + typedef typename _NodeTypes::__node_base_type __first_node; + typedef typename _NodeTypes::__node_base_pointer __node_base_pointer; + typedef typename _NodeTypes::__next_pointer __next_pointer; + +private: + // check for sane allocator pointer rebinding semantics. Rebinding the + // allocator for a new pointer type should be exactly the same as rebinding + // the pointer using 'pointer_traits'. + static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value), + "Allocator does not rebind pointers in a sane manner."); + typedef typename __rebind_alloc_helper<__node_traits, __first_node>::type + __node_base_allocator; + typedef allocator_traits<__node_base_allocator> __node_base_traits; + static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value), + "Allocator does not rebind pointers in a sane manner."); + +private: + + typedef typename __rebind_alloc_helper<__node_traits, __next_pointer>::type __pointer_allocator; + typedef __bucket_list_deallocator<__pointer_allocator> __bucket_list_deleter; + typedef unique_ptr<__next_pointer[], __bucket_list_deleter> __bucket_list; + typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits; + typedef typename __bucket_list_deleter::pointer __node_pointer_pointer; + + // --- Member data begin --- + __bucket_list __bucket_list_; + __compressed_pair<__first_node, __node_allocator> __p1_; + __compressed_pair __p2_; + __compressed_pair __p3_; + // --- Member data end --- + + _LIBCUDACXX_INLINE_VISIBILITY + size_type& size() noexcept {return __p2_.first();} +public: + _LIBCUDACXX_INLINE_VISIBILITY + size_type size() const noexcept {return __p2_.first();} + + _LIBCUDACXX_INLINE_VISIBILITY + hasher& hash_function() noexcept {return __p2_.second();} + _LIBCUDACXX_INLINE_VISIBILITY + const hasher& hash_function() const noexcept {return __p2_.second();} + + _LIBCUDACXX_INLINE_VISIBILITY + float& max_load_factor() noexcept {return __p3_.first();} + _LIBCUDACXX_INLINE_VISIBILITY + float max_load_factor() const noexcept {return __p3_.first();} + + _LIBCUDACXX_INLINE_VISIBILITY + key_equal& key_eq() noexcept {return __p3_.second();} + _LIBCUDACXX_INLINE_VISIBILITY + const key_equal& key_eq() const noexcept {return __p3_.second();} + + _LIBCUDACXX_INLINE_VISIBILITY + __node_allocator& __node_alloc() noexcept {return __p1_.second();} + _LIBCUDACXX_INLINE_VISIBILITY + const __node_allocator& __node_alloc() const noexcept + {return __p1_.second();} + +public: + typedef __hash_iterator<__node_pointer> iterator; + typedef __hash_const_iterator<__node_pointer> const_iterator; + typedef __hash_local_iterator<__node_pointer> local_iterator; + typedef __hash_const_local_iterator<__node_pointer> const_local_iterator; + + _LIBCUDACXX_INLINE_VISIBILITY + __hash_table() + noexcept( + is_nothrow_default_constructible<__bucket_list>::value && + is_nothrow_default_constructible<__first_node>::value && + is_nothrow_default_constructible<__node_allocator>::value && + is_nothrow_default_constructible::value && + is_nothrow_default_constructible::value); + _LIBCUDACXX_INLINE_VISIBILITY + __hash_table(const hasher& __hf, const key_equal& __eql); + __hash_table(const hasher& __hf, const key_equal& __eql, + const allocator_type& __a); + explicit __hash_table(const allocator_type& __a); + __hash_table(const __hash_table& __u); + __hash_table(const __hash_table& __u, const allocator_type& __a); + __hash_table(__hash_table&& __u) + noexcept( + is_nothrow_move_constructible<__bucket_list>::value && + is_nothrow_move_constructible<__first_node>::value && + is_nothrow_move_constructible<__node_allocator>::value && + is_nothrow_move_constructible::value && + is_nothrow_move_constructible::value); + __hash_table(__hash_table&& __u, const allocator_type& __a); + ~__hash_table(); + + __hash_table& operator=(const __hash_table& __u); + _LIBCUDACXX_INLINE_VISIBILITY + __hash_table& operator=(__hash_table&& __u) + noexcept( + __node_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable<__node_allocator>::value && + is_nothrow_move_assignable::value && + is_nothrow_move_assignable::value); + template + void __assign_unique(_InputIterator __first, _InputIterator __last); + template + void __assign_multi(_InputIterator __first, _InputIterator __last); + + _LIBCUDACXX_INLINE_VISIBILITY + size_type max_size() const noexcept + { + return std::min( + __node_traits::max_size(__node_alloc()), + numeric_limits::max() + ); + } + +private: + _LIBCUDACXX_INLINE_VISIBILITY + __next_pointer __node_insert_multi_prepare(size_t __cp_hash, + value_type& __cp_val); + _LIBCUDACXX_INLINE_VISIBILITY + void __node_insert_multi_perform(__node_pointer __cp, + __next_pointer __pn) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + __next_pointer __node_insert_unique_prepare(size_t __nd_hash, + value_type& __nd_val); + _LIBCUDACXX_INLINE_VISIBILITY + void __node_insert_unique_perform(__node_pointer __ptr) noexcept; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + pair __node_insert_unique(__node_pointer __nd); + _LIBCUDACXX_INLINE_VISIBILITY + iterator __node_insert_multi(__node_pointer __nd); + _LIBCUDACXX_INLINE_VISIBILITY + iterator __node_insert_multi(const_iterator __p, + __node_pointer __nd); + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair __emplace_unique_key_args(_Key const& __k, _Args&&... __args); + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair __emplace_unique_impl(_Args&&... __args); + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair __emplace_unique(_Pp&& __x) { + return __emplace_unique_extract_key(_CUDA_VSTD::forward<_Pp>(__x), + __can_extract_key<_Pp, key_type>()); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if< + __can_extract_map_key<_First, key_type, __container_value_type>::value, + pair + >::type __emplace_unique(_First&& __f, _Second&& __s) { + return __emplace_unique_key_args(__f, _CUDA_VSTD::forward<_First>(__f), + _CUDA_VSTD::forward<_Second>(__s)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair __emplace_unique(_Args&&... __args) { + return __emplace_unique_impl(_CUDA_VSTD::forward<_Args>(__args)...); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair + __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) { + return __emplace_unique_impl(_CUDA_VSTD::forward<_Pp>(__x)); + } + template + _LIBCUDACXX_INLINE_VISIBILITY + pair + __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) { + return __emplace_unique_key_args(__x, _CUDA_VSTD::forward<_Pp>(__x)); + } + template + _LIBCUDACXX_INLINE_VISIBILITY + pair + __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) { + return __emplace_unique_key_args(__x.first, _CUDA_VSTD::forward<_Pp>(__x)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __emplace_multi(_Args&&... __args); + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args); + + + _LIBCUDACXX_INLINE_VISIBILITY + pair + __insert_unique(__container_value_type&& __x) { + return __emplace_unique_key_args(_NodeTypes::__get_key(__x), _CUDA_VSTD::move(__x)); + } + + template ::value + >::type> + _LIBCUDACXX_INLINE_VISIBILITY + pair __insert_unique(_Pp&& __x) { + return __emplace_unique(_CUDA_VSTD::forward<_Pp>(__x)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __insert_multi(_Pp&& __x) { + return __emplace_multi(_CUDA_VSTD::forward<_Pp>(__x)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __insert_multi(const_iterator __p, _Pp&& __x) { + return __emplace_hint_multi(__p, _CUDA_VSTD::forward<_Pp>(__x)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + pair __insert_unique(const __container_value_type& __x) { + return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x); + } + +#if _LIBCUDACXX_STD_VER > 14 + template + _LIBCUDACXX_INLINE_VISIBILITY + _InsertReturnType __node_handle_insert_unique(_NodeHandle&& __nh); + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __node_handle_insert_unique(const_iterator __hint, + _NodeHandle&& __nh); + template + _LIBCUDACXX_INLINE_VISIBILITY + void __node_handle_merge_unique(_Table& __source); + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __node_handle_insert_multi(_NodeHandle&& __nh); + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh); + template + _LIBCUDACXX_INLINE_VISIBILITY + void __node_handle_merge_multi(_Table& __source); + + template + _LIBCUDACXX_INLINE_VISIBILITY + _NodeHandle __node_handle_extract(key_type const& __key); + template + _LIBCUDACXX_INLINE_VISIBILITY + _NodeHandle __node_handle_extract(const_iterator __it); +#endif + + void clear() noexcept; + void rehash(size_type __n); + _LIBCUDACXX_INLINE_VISIBILITY void reserve(size_type __n) + {rehash(static_cast(ceil(__n / max_load_factor())));} + + _LIBCUDACXX_INLINE_VISIBILITY + size_type bucket_count() const noexcept + { + return __bucket_list_.get_deleter().size(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator begin() noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + iterator end() noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator begin() const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator end() const noexcept; + + template + _LIBCUDACXX_INLINE_VISIBILITY + size_type bucket(const _Key& __k) const + { + _LIBCUDACXX_ASSERT(bucket_count() > 0, + "unordered container::bucket(key) called when bucket_count() == 0"); + return __constrain_hash(hash_function()(__k), bucket_count()); + } + + template + iterator find(const _Key& __x); + template + const_iterator find(const _Key& __x) const; + + typedef __hash_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; + + iterator erase(const_iterator __p); + iterator erase(const_iterator __first, const_iterator __last); + template + size_type __erase_unique(const _Key& __k); + template + size_type __erase_multi(const _Key& __k); + __node_holder remove(const_iterator __p) noexcept; + + template + _LIBCUDACXX_INLINE_VISIBILITY + size_type __count_unique(const _Key& __k) const; + template + size_type __count_multi(const _Key& __k) const; + + template + pair + __equal_range_unique(const _Key& __k); + template + pair + __equal_range_unique(const _Key& __k) const; + + template + pair + __equal_range_multi(const _Key& __k); + template + pair + __equal_range_multi(const _Key& __k) const; + + void swap(__hash_table& __u) +#if _LIBCUDACXX_STD_VER <= 11 + noexcept( + __is_nothrow_swappable::value && __is_nothrow_swappable::value + && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value + || __is_nothrow_swappable<__pointer_allocator>::value) + && (!__node_traits::propagate_on_container_swap::value + || __is_nothrow_swappable<__node_allocator>::value) + ); +#else + noexcept(__is_nothrow_swappable::value && __is_nothrow_swappable::value); +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + size_type max_bucket_count() const noexcept + {return max_size(); } + size_type bucket_size(size_type __n) const; + _LIBCUDACXX_INLINE_VISIBILITY float load_factor() const noexcept + { + size_type __bc = bucket_count(); + return __bc != 0 ? (float)size() / __bc : 0.f; + } + _LIBCUDACXX_INLINE_VISIBILITY void max_load_factor(float __mlf) noexcept + { + _LIBCUDACXX_ASSERT(__mlf > 0, + "unordered container::max_load_factor(lf) called with lf <= 0"); + max_load_factor() = _CUDA_VSTD::max(__mlf, load_factor()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + local_iterator + begin(size_type __n) + { + _LIBCUDACXX_ASSERT(__n < bucket_count(), + "unordered container::begin(n) called with n >= bucket_count()"); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return local_iterator(__bucket_list_[__n], __n, bucket_count(), this); +#else + return local_iterator(__bucket_list_[__n], __n, bucket_count()); +#endif + } + + _LIBCUDACXX_INLINE_VISIBILITY + local_iterator + end(size_type __n) + { + _LIBCUDACXX_ASSERT(__n < bucket_count(), + "unordered container::end(n) called with n >= bucket_count()"); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return local_iterator(nullptr, __n, bucket_count(), this); +#else + return local_iterator(nullptr, __n, bucket_count()); +#endif + } + + _LIBCUDACXX_INLINE_VISIBILITY + const_local_iterator + cbegin(size_type __n) const + { + _LIBCUDACXX_ASSERT(__n < bucket_count(), + "unordered container::cbegin(n) called with n >= bucket_count()"); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this); +#else + return const_local_iterator(__bucket_list_[__n], __n, bucket_count()); +#endif + } + + _LIBCUDACXX_INLINE_VISIBILITY + const_local_iterator + cend(size_type __n) const + { + _LIBCUDACXX_ASSERT(__n < bucket_count(), + "unordered container::cend(n) called with n >= bucket_count()"); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return const_local_iterator(nullptr, __n, bucket_count(), this); +#else + return const_local_iterator(nullptr, __n, bucket_count()); +#endif + } + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + + bool __dereferenceable(const const_iterator* __i) const; + bool __decrementable(const const_iterator* __i) const; + bool __addable(const const_iterator* __i, ptrdiff_t __n) const; + bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; + +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + +private: + void __rehash(size_type __n); + + template + __node_holder __construct_node(_Args&& ...__args); + + template + __node_holder __construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest); + + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __hash_table& __u) + {__copy_assign_alloc(__u, integral_constant());} + void __copy_assign_alloc(const __hash_table& __u, true_type); + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __hash_table&, false_type) {} + + void __move_assign(__hash_table& __u, false_type); + void __move_assign(__hash_table& __u, true_type) + noexcept( + is_nothrow_move_assignable<__node_allocator>::value && + is_nothrow_move_assignable::value && + is_nothrow_move_assignable::value); + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__hash_table& __u) + noexcept( + !__node_traits::propagate_on_container_move_assignment::value || + (is_nothrow_move_assignable<__pointer_allocator>::value && + is_nothrow_move_assignable<__node_allocator>::value)) + {__move_assign_alloc(__u, integral_constant());} + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__hash_table& __u, true_type) + noexcept( + is_nothrow_move_assignable<__pointer_allocator>::value && + is_nothrow_move_assignable<__node_allocator>::value) + { + __bucket_list_.get_deleter().__alloc() = + _CUDA_VSTD::move(__u.__bucket_list_.get_deleter().__alloc()); + __node_alloc() = _CUDA_VSTD::move(__u.__node_alloc()); + } + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__hash_table&, false_type) noexcept {} + + void __deallocate_node(__next_pointer __np) noexcept; + __next_pointer __detach() noexcept; + + template friend class _LIBCUDACXX_TEMPLATE_VIS unordered_map; + template friend class _LIBCUDACXX_TEMPLATE_VIS unordered_multimap; +}; + +template +inline +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table() + noexcept( + is_nothrow_default_constructible<__bucket_list>::value && + is_nothrow_default_constructible<__first_node>::value && + is_nothrow_default_constructible<__node_allocator>::value && + is_nothrow_default_constructible::value && + is_nothrow_default_constructible::value) + : __p2_(0), + __p3_(1.0f) +{ +} + +template +inline +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, + const key_equal& __eql) + : __bucket_list_(nullptr, __bucket_list_deleter()), + __p1_(), + __p2_(0, __hf), + __p3_(1.0f, __eql) +{ +} + +template +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, + const key_equal& __eql, + const allocator_type& __a) + : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), + __p1_(__second_tag(), __node_allocator(__a)), + __p2_(0, __hf), + __p3_(1.0f, __eql) +{ +} + +template +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a) + : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), + __p1_(__second_tag(), __node_allocator(__a)), + __p2_(0), + __p3_(1.0f) +{ +} + +template +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u) + : __bucket_list_(nullptr, + __bucket_list_deleter(allocator_traits<__pointer_allocator>:: + select_on_container_copy_construction( + __u.__bucket_list_.get_deleter().__alloc()), 0)), + __p1_(__second_tag(), allocator_traits<__node_allocator>:: + select_on_container_copy_construction(__u.__node_alloc())), + __p2_(0, __u.hash_function()), + __p3_(__u.__p3_) +{ +} + +template +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u, + const allocator_type& __a) + : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), + __p1_(__second_tag(), __node_allocator(__a)), + __p2_(0, __u.hash_function()), + __p3_(__u.__p3_) +{ +} + +template +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u) + noexcept( + is_nothrow_move_constructible<__bucket_list>::value && + is_nothrow_move_constructible<__first_node>::value && + is_nothrow_move_constructible<__node_allocator>::value && + is_nothrow_move_constructible::value && + is_nothrow_move_constructible::value) + : __bucket_list_(_CUDA_VSTD::move(__u.__bucket_list_)), + __p1_(_CUDA_VSTD::move(__u.__p1_)), + __p2_(_CUDA_VSTD::move(__u.__p2_)), + __p3_(_CUDA_VSTD::move(__u.__p3_)) +{ + if (size() > 0) + { + __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = + __p1_.first().__ptr(); + __u.__p1_.first().__next_ = nullptr; + __u.size() = 0; + } +} + +template +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, + const allocator_type& __a) + : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), + __p1_(__second_tag(), __node_allocator(__a)), + __p2_(0, _CUDA_VSTD::move(__u.hash_function())), + __p3_(_CUDA_VSTD::move(__u.__p3_)) +{ + if (__a == allocator_type(__u.__node_alloc())) + { + __bucket_list_.reset(__u.__bucket_list_.release()); + __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size(); + __u.__bucket_list_.get_deleter().size() = 0; + if (__u.size() > 0) + { + __p1_.first().__next_ = __u.__p1_.first().__next_; + __u.__p1_.first().__next_ = nullptr; + __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = + __p1_.first().__ptr(); + size() = __u.size(); + __u.size() = 0; + } + } +} + +template +__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() +{ + __deallocate_node(__p1_.first().__next_); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__erase_c(this); +#endif +} + +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__copy_assign_alloc( + const __hash_table& __u, true_type) +{ + if (__node_alloc() != __u.__node_alloc()) + { + clear(); + __bucket_list_.reset(); + __bucket_list_.get_deleter().size() = 0; + } + __bucket_list_.get_deleter().__alloc() = __u.__bucket_list_.get_deleter().__alloc(); + __node_alloc() = __u.__node_alloc(); +} + +template +__hash_table<_Tp, _Hash, _Equal, _Alloc>& +__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __u) +{ + if (this != &__u) + { + __copy_assign_alloc(__u); + hash_function() = __u.hash_function(); + key_eq() = __u.key_eq(); + max_load_factor() = __u.max_load_factor(); + __assign_multi(__u.begin(), __u.end()); + } + return *this; +} + +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np) + noexcept +{ + __node_allocator& __na = __node_alloc(); + while (__np != nullptr) + { + __next_pointer __next = __np->__next_; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __p = __c->end_; __p != __c->beg_; ) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__node_ == __np) + { + (*__p)->__c_ = nullptr; + if (--__c->end_ != __p) + memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif + __node_pointer __real_np = __np->__upcast(); + __node_traits::destroy(__na, _NodeTypes::__get_ptr(__real_np->__value_)); + __node_traits::deallocate(__na, __real_np, 1); + __np = __next; + } +} + +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() noexcept +{ + size_type __bc = bucket_count(); + for (size_type __i = 0; __i < __bc; ++__i) + __bucket_list_[__i] = nullptr; + size() = 0; + __next_pointer __cache = __p1_.first().__next_; + __p1_.first().__next_ = nullptr; + return __cache; +} + +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign( + __hash_table& __u, true_type) + noexcept( + is_nothrow_move_assignable<__node_allocator>::value && + is_nothrow_move_assignable::value && + is_nothrow_move_assignable::value) +{ + clear(); + __bucket_list_.reset(__u.__bucket_list_.release()); + __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size(); + __u.__bucket_list_.get_deleter().size() = 0; + __move_assign_alloc(__u); + size() = __u.size(); + hash_function() = _CUDA_VSTD::move(__u.hash_function()); + max_load_factor() = __u.max_load_factor(); + key_eq() = _CUDA_VSTD::move(__u.key_eq()); + __p1_.first().__next_ = __u.__p1_.first().__next_; + if (size() > 0) + { + __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = + __p1_.first().__ptr(); + __u.__p1_.first().__next_ = nullptr; + __u.size() = 0; + } +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->swap(this, &__u); +#endif +} + +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign( + __hash_table& __u, false_type) +{ + if (__node_alloc() == __u.__node_alloc()) + __move_assign(__u, true_type()); + else + { + hash_function() = _CUDA_VSTD::move(__u.hash_function()); + key_eq() = _CUDA_VSTD::move(__u.key_eq()); + max_load_factor() = __u.max_load_factor(); + if (bucket_count() != 0) + { + __next_pointer __cache = __detach(); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + const_iterator __i = __u.begin(); + while (__cache != nullptr && __u.size() != 0) + { + __cache->__upcast()->__value_ = + _CUDA_VSTD::move(__u.remove(__i++)->__value_); + __next_pointer __next = __cache->__next_; + __node_insert_multi(__cache->__upcast()); + __cache = __next; + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __deallocate_node(__cache); + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __deallocate_node(__cache); + } + const_iterator __i = __u.begin(); + while (__u.size() != 0) + { + __node_holder __h = __construct_node(_NodeTypes::__move(__u.remove(__i++)->__value_)); + __node_insert_multi(__h.get()); + __h.release(); + } + } +} + +template +inline +__hash_table<_Tp, _Hash, _Equal, _Alloc>& +__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u) + noexcept( + __node_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable<__node_allocator>::value && + is_nothrow_move_assignable::value && + is_nothrow_move_assignable::value) +{ + __move_assign(__u, integral_constant()); + return *this; +} + +template +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first, + _InputIterator __last) +{ + typedef iterator_traits<_InputIterator> _ITraits; + typedef typename _ITraits::value_type _ItValueType; + static_assert((is_same<_ItValueType, __container_value_type>::value), + "__assign_unique may only be called with the containers value type"); + + if (bucket_count() != 0) + { + __next_pointer __cache = __detach(); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (; __cache != nullptr && __first != __last; ++__first) + { + __cache->__upcast()->__value_ = *__first; + __next_pointer __next = __cache->__next_; + __node_insert_unique(__cache->__upcast()); + __cache = __next; + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __deallocate_node(__cache); + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __deallocate_node(__cache); + } + for (; __first != __last; ++__first) + __insert_unique(*__first); +} + +template +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first, + _InputIterator __last) +{ + typedef iterator_traits<_InputIterator> _ITraits; + typedef typename _ITraits::value_type _ItValueType; + static_assert((is_same<_ItValueType, __container_value_type>::value || + is_same<_ItValueType, __node_value_type>::value), + "__assign_multi may only be called with the containers value type" + " or the nodes value type"); + if (bucket_count() != 0) + { + __next_pointer __cache = __detach(); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (; __cache != nullptr && __first != __last; ++__first) + { + __cache->__upcast()->__value_ = *__first; + __next_pointer __next = __cache->__next_; + __node_insert_multi(__cache->__upcast()); + __cache = __next; + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __deallocate_node(__cache); + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __deallocate_node(__cache); + } + for (; __first != __last; ++__first) + __insert_multi(_NodeTypes::__get_value(*__first)); +} + +template +inline +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() noexcept +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(__p1_.first().__next_, this); +#else + return iterator(__p1_.first().__next_); +#endif +} + +template +inline +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() noexcept +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(nullptr, this); +#else + return iterator(nullptr); +#endif +} + +template +inline +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const noexcept +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return const_iterator(__p1_.first().__next_, this); +#else + return const_iterator(__p1_.first().__next_); +#endif +} + +template +inline +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const noexcept +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return const_iterator(nullptr, this); +#else + return const_iterator(nullptr); +#endif +} + +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() noexcept +{ + if (size() > 0) + { + __deallocate_node(__p1_.first().__next_); + __p1_.first().__next_ = nullptr; + size_type __bc = bucket_count(); + for (size_type __i = 0; __i < __bc; ++__i) + __bucket_list_[__i] = nullptr; + size() = 0; + } +} + + +// Prepare the container for an insertion of the value __value with the hash +// __hash. This does a lookup into the container to see if __value is already +// present, and performs a rehash if necessary. Returns a pointer to the +// existing element if it exists, otherwise nullptr. +// +// Note that this function does forward exceptions if key_eq() throws, and never +// mutates __value or actually inserts into the map. +template +_LIBCUDACXX_INLINE_VISIBILITY +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare( + size_t __hash, value_type& __value) +{ + size_type __bc = bucket_count(); + + if (__bc != 0) + { + size_t __chash = __constrain_hash(__hash, __bc); + __next_pointer __ndptr = __bucket_list_[__chash]; + if (__ndptr != nullptr) + { + for (__ndptr = __ndptr->__next_; __ndptr != nullptr && + __constrain_hash(__ndptr->__hash(), __bc) == __chash; + __ndptr = __ndptr->__next_) + { + if (key_eq()(__ndptr->__upcast()->__value_, __value)) + return __ndptr; + } + } + } + if (size()+1 > __bc * max_load_factor() || __bc == 0) + { + rehash(_CUDA_VSTD::max(2 * __bc + !__is_hash_power2(__bc), + size_type(ceil(float(size() + 1) / max_load_factor())))); + } + return nullptr; +} + +// Insert the node __nd into the container by pushing it into the right bucket, +// and updating size(). Assumes that __nd->__hash is up-to-date, and that +// rehashing has already occurred and that no element with the same key exists +// in the map. +template +_LIBCUDACXX_INLINE_VISIBILITY +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform( + __node_pointer __nd) noexcept +{ + size_type __bc = bucket_count(); + size_t __chash = __constrain_hash(__nd->__hash(), __bc); + // insert_after __bucket_list_[__chash], or __first_node if bucket is null + __next_pointer __pn = __bucket_list_[__chash]; + if (__pn == nullptr) + { + __pn =__p1_.first().__ptr(); + __nd->__next_ = __pn->__next_; + __pn->__next_ = __nd->__ptr(); + // fix up __bucket_list_ + __bucket_list_[__chash] = __pn; + if (__nd->__next_ != nullptr) + __bucket_list_[__constrain_hash(__nd->__next_->__hash(), __bc)] = __nd->__ptr(); + } + else + { + __nd->__next_ = __pn->__next_; + __pn->__next_ = __nd->__ptr(); + } + ++size(); +} + +template +pair::iterator, bool> +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __nd) +{ + __nd->__hash_ = hash_function()(__nd->__value_); + __next_pointer __existing_node = + __node_insert_unique_prepare(__nd->__hash(), __nd->__value_); + + // Insert the node, unless it already exists in the container. + bool __inserted = false; + if (__existing_node == nullptr) + { + __node_insert_unique_perform(__nd); + __existing_node = __nd->__ptr(); + __inserted = true; + } +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return pair(iterator(__existing_node, this), __inserted); +#else + return pair(iterator(__existing_node), __inserted); +#endif +} + +// Prepare the container for an insertion of the value __cp_val with the hash +// __cp_hash. This does a lookup into the container to see if __cp_value is +// already present, and performs a rehash if necessary. Returns a pointer to the +// last occurance of __cp_val in the map. +// +// Note that this function does forward exceptions if key_eq() throws, and never +// mutates __value or actually inserts into the map. +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare( + size_t __cp_hash, value_type& __cp_val) +{ + size_type __bc = bucket_count(); + if (size()+1 > __bc * max_load_factor() || __bc == 0) + { + rehash(_CUDA_VSTD::max(2 * __bc + !__is_hash_power2(__bc), + size_type(ceil(float(size() + 1) / max_load_factor())))); + __bc = bucket_count(); + } + size_t __chash = __constrain_hash(__cp_hash, __bc); + __next_pointer __pn = __bucket_list_[__chash]; + if (__pn != nullptr) + { + for (bool __found = false; __pn->__next_ != nullptr && + __constrain_hash(__pn->__next_->__hash(), __bc) == __chash; + __pn = __pn->__next_) + { + // __found key_eq() action + // false false loop + // true true loop + // false true set __found to true + // true false break + if (__found != (__pn->__next_->__hash() == __cp_hash && + key_eq()(__pn->__next_->__upcast()->__value_, __cp_val))) + { + if (!__found) + __found = true; + else + break; + } + } + } + return __pn; +} + +// Insert the node __cp into the container after __pn (which is the last node in +// the bucket that compares equal to __cp). Rehashing, and checking for +// uniqueness has already been performed (in __node_insert_multi_prepare), so +// all we need to do is update the bucket and size(). Assumes that __cp->__hash +// is up-to-date. +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform( + __node_pointer __cp, __next_pointer __pn) noexcept +{ + size_type __bc = bucket_count(); + size_t __chash = __constrain_hash(__cp->__hash_, __bc); + if (__pn == nullptr) + { + __pn =__p1_.first().__ptr(); + __cp->__next_ = __pn->__next_; + __pn->__next_ = __cp->__ptr(); + // fix up __bucket_list_ + __bucket_list_[__chash] = __pn; + if (__cp->__next_ != nullptr) + __bucket_list_[__constrain_hash(__cp->__next_->__hash(), __bc)] + = __cp->__ptr(); + } + else + { + __cp->__next_ = __pn->__next_; + __pn->__next_ = __cp->__ptr(); + if (__cp->__next_ != nullptr) + { + size_t __nhash = __constrain_hash(__cp->__next_->__hash(), __bc); + if (__nhash != __chash) + __bucket_list_[__nhash] = __cp->__ptr(); + } + } + ++size(); +} + + +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __cp) +{ + __cp->__hash_ = hash_function()(__cp->__value_); + __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__value_); + __node_insert_multi_perform(__cp, __pn); + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(__cp->__ptr(), this); +#else + return iterator(__cp->__ptr()); +#endif +} + +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi( + const_iterator __p, __node_pointer __cp) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered container::emplace_hint(const_iterator, args...) called with an iterator not" + " referring to this unordered container"); +#endif + if (__p != end() && key_eq()(*__p, __cp->__value_)) + { + __next_pointer __np = __p.__node_; + __cp->__hash_ = __np->__hash(); + size_type __bc = bucket_count(); + if (size()+1 > __bc * max_load_factor() || __bc == 0) + { + rehash(_CUDA_VSTD::max(2 * __bc + !__is_hash_power2(__bc), + size_type(ceil(float(size() + 1) / max_load_factor())))); + __bc = bucket_count(); + } + size_t __chash = __constrain_hash(__cp->__hash_, __bc); + __next_pointer __pp = __bucket_list_[__chash]; + while (__pp->__next_ != __np) + __pp = __pp->__next_; + __cp->__next_ = __np; + __pp->__next_ = static_cast<__next_pointer>(__cp); + ++size(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(static_cast<__next_pointer>(__cp), this); +#else + return iterator(static_cast<__next_pointer>(__cp)); +#endif + } + return __node_insert_multi(__cp); +} + + + +template +template +pair::iterator, bool> +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) +{ + + size_t __hash = hash_function()(__k); + size_type __bc = bucket_count(); + bool __inserted = false; + __next_pointer __nd; + size_t __chash; + if (__bc != 0) + { + __chash = __constrain_hash(__hash, __bc); + __nd = __bucket_list_[__chash]; + if (__nd != nullptr) + { + for (__nd = __nd->__next_; __nd != nullptr && + (__nd->__hash() == __hash || __constrain_hash(__nd->__hash(), __bc) == __chash); + __nd = __nd->__next_) + { + if (key_eq()(__nd->__upcast()->__value_, __k)) + goto __done; + } + } + } + { + __node_holder __h = __construct_node_hash(__hash, _CUDA_VSTD::forward<_Args>(__args)...); + + if (size()+1 > __bc * max_load_factor() || __bc == 0) + { + rehash(_CUDA_VSTD::max(2 * __bc + !__is_hash_power2(__bc), + size_type(ceil(float(size() + 1) / max_load_factor())))); + __bc = bucket_count(); + __chash = __constrain_hash(__hash, __bc); + } + // insert_after __bucket_list_[__chash], or __first_node if bucket is null + __next_pointer __pn = __bucket_list_[__chash]; + if (__pn == nullptr) + { + __pn = __p1_.first().__ptr(); + __h->__next_ = __pn->__next_; + __pn->__next_ = __h.get()->__ptr(); + // fix up __bucket_list_ + __bucket_list_[__chash] = __pn; + if (__h->__next_ != nullptr) + __bucket_list_[__constrain_hash(__h->__next_->__hash(), __bc)] + = __h.get()->__ptr(); + } + else + { + __h->__next_ = __pn->__next_; + __pn->__next_ = static_cast<__next_pointer>(__h.get()); + } + __nd = static_cast<__next_pointer>(__h.release()); + // increment size + ++size(); + __inserted = true; + } +__done: +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return pair(iterator(__nd, this), __inserted); +#else + return pair(iterator(__nd), __inserted); +#endif +} + +template +template +pair::iterator, bool> +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_impl(_Args&&... __args) +{ + __node_holder __h = __construct_node(_CUDA_VSTD::forward<_Args>(__args)...); + pair __r = __node_insert_unique(__h.get()); + if (__r.second) + __h.release(); + return __r; +} + +template +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_multi(_Args&&... __args) +{ + __node_holder __h = __construct_node(_CUDA_VSTD::forward<_Args>(__args)...); + iterator __r = __node_insert_multi(__h.get()); + __h.release(); + return __r; +} + +template +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi( + const_iterator __p, _Args&&... __args) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered container::emplace_hint(const_iterator, args...) called with an iterator not" + " referring to this unordered container"); +#endif + __node_holder __h = __construct_node(_CUDA_VSTD::forward<_Args>(__args)...); + iterator __r = __node_insert_multi(__p, __h.get()); + __h.release(); + return __r; +} + +#if _LIBCUDACXX_STD_VER > 14 +template +template +_LIBCUDACXX_INLINE_VISIBILITY +_InsertReturnType +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique( + _NodeHandle&& __nh) +{ + if (__nh.empty()) + return _InsertReturnType{end(), false, _NodeHandle()}; + pair __result = __node_insert_unique(__nh.__ptr_); + if (__result.second) + __nh.__release_ptr(); + return _InsertReturnType{__result.first, __result.second, _CUDA_VSTD::move(__nh)}; +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique( + const_iterator, _NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + pair __result = __node_insert_unique(__nh.__ptr_); + if (__result.second) + __nh.__release_ptr(); + return __result.first; +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +_NodeHandle +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract( + key_type const& __key) +{ + iterator __i = find(__key); + if (__i == end()) + return _NodeHandle(); + return __node_handle_extract<_NodeHandle>(__i); +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +_NodeHandle +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract( + const_iterator __p) +{ + allocator_type __alloc(__node_alloc()); + return _NodeHandle(remove(__p).release(), __alloc); +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_unique( + _Table& __source) +{ + static_assert(is_same<__node, typename _Table::__node>::value, ""); + + for (typename _Table::iterator __it = __source.begin(); + __it != __source.end();) + { + __node_pointer __src_ptr = __it.__node_->__upcast(); + size_t __hash = hash_function()(__src_ptr->__value_); + __next_pointer __existing_node = + __node_insert_unique_prepare(__hash, __src_ptr->__value_); + auto __prev_iter = __it++; + if (__existing_node == nullptr) + { + (void)__source.remove(__prev_iter).release(); + __src_ptr->__hash_ = __hash; + __node_insert_unique_perform(__src_ptr); + } + } +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi( + _NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + iterator __result = __node_insert_multi(__nh.__ptr_); + __nh.__release_ptr(); + return __result; +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi( + const_iterator __hint, _NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + iterator __result = __node_insert_multi(__hint, __nh.__ptr_); + __nh.__release_ptr(); + return __result; +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_multi( + _Table& __source) +{ + static_assert(is_same::value, ""); + + for (typename _Table::iterator __it = __source.begin(); + __it != __source.end();) + { + __node_pointer __src_ptr = __it.__node_->__upcast(); + size_t __src_hash = hash_function()(__src_ptr->__value_); + __next_pointer __pn = + __node_insert_multi_prepare(__src_hash, __src_ptr->__value_); + (void)__source.remove(__it++).release(); + __src_ptr->__hash_ = __src_hash; + __node_insert_multi_perform(__src_ptr, __pn); + } +} +#endif // _LIBCUDACXX_STD_VER > 14 + +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n) +_LIBCUDACXX_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +{ + if (__n == 1) + __n = 2; + else if (__n & (__n - 1)) + __n = __next_prime(__n); + size_type __bc = bucket_count(); + if (__n > __bc) + __rehash(__n); + else if (__n < __bc) + { + __n = _CUDA_VSTD::max + ( + __n, + __is_hash_power2(__bc) ? __next_hash_pow2(size_t(ceil(float(size()) / max_load_factor()))) : + __next_prime(size_t(ceil(float(size()) / max_load_factor()))) + ); + if (__n < __bc) + __rehash(__n); + } +} + +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__invalidate_all(this); +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc(); + __bucket_list_.reset(__nbc > 0 ? + __pointer_alloc_traits::allocate(__npa, __nbc) : nullptr); + __bucket_list_.get_deleter().size() = __nbc; + if (__nbc > 0) + { + for (size_type __i = 0; __i < __nbc; ++__i) + __bucket_list_[__i] = nullptr; + __next_pointer __pp = __p1_.first().__ptr(); + __next_pointer __cp = __pp->__next_; + if (__cp != nullptr) + { + size_type __chash = __constrain_hash(__cp->__hash(), __nbc); + __bucket_list_[__chash] = __pp; + size_type __phash = __chash; + for (__pp = __cp, void(), __cp = __cp->__next_; __cp != nullptr; + __cp = __pp->__next_) + { + __chash = __constrain_hash(__cp->__hash(), __nbc); + if (__chash == __phash) + __pp = __cp; + else + { + if (__bucket_list_[__chash] == nullptr) + { + __bucket_list_[__chash] = __pp; + __pp = __cp; + __phash = __chash; + } + else + { + __next_pointer __np = __cp; + for (; __np->__next_ != nullptr && + key_eq()(__cp->__upcast()->__value_, + __np->__next_->__upcast()->__value_); + __np = __np->__next_) + ; + __pp->__next_ = __np->__next_; + __np->__next_ = __bucket_list_[__chash]->__next_; + __bucket_list_[__chash]->__next_ = __cp; + + } + } + } + } + } +} + +template +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) +{ + size_t __hash = hash_function()(__k); + size_type __bc = bucket_count(); + if (__bc != 0) + { + size_t __chash = __constrain_hash(__hash, __bc); + __next_pointer __nd = __bucket_list_[__chash]; + if (__nd != nullptr) + { + for (__nd = __nd->__next_; __nd != nullptr && + (__nd->__hash() == __hash + || __constrain_hash(__nd->__hash(), __bc) == __chash); + __nd = __nd->__next_) + { + if ((__nd->__hash() == __hash) + && key_eq()(__nd->__upcast()->__value_, __k)) +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(__nd, this); +#else + return iterator(__nd); +#endif + } + } + } + return end(); +} + +template +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const +{ + size_t __hash = hash_function()(__k); + size_type __bc = bucket_count(); + if (__bc != 0) + { + size_t __chash = __constrain_hash(__hash, __bc); + __next_pointer __nd = __bucket_list_[__chash]; + if (__nd != nullptr) + { + for (__nd = __nd->__next_; __nd != nullptr && + (__hash == __nd->__hash() + || __constrain_hash(__nd->__hash(), __bc) == __chash); + __nd = __nd->__next_) + { + if ((__nd->__hash() == __hash) + && key_eq()(__nd->__upcast()->__value_, __k)) +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return const_iterator(__nd, this); +#else + return const_iterator(__nd); +#endif + } + } + + } + return end(); +} + +template +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args) +{ + static_assert(!__is_hash_value_type<_Args...>::value, + "Construct cannot be called with a hash value type"); + __node_allocator& __na = __node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), _CUDA_VSTD::forward<_Args>(__args)...); + __h.get_deleter().__value_constructed = true; + __h->__hash_ = hash_function()(__h->__value_); + __h->__next_ = nullptr; + return __h; +} + +template +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash( + size_t __hash, _First&& __f, _Rest&& ...__rest) +{ + static_assert(!__is_hash_value_type<_First, _Rest...>::value, + "Construct cannot be called with a hash value type"); + __node_allocator& __na = __node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), + _CUDA_VSTD::forward<_First>(__f), + _CUDA_VSTD::forward<_Rest>(__rest)...); + __h.get_deleter().__value_constructed = true; + __h->__hash_ = __hash; + __h->__next_ = nullptr; + return __h; +} + +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p) +{ + __next_pointer __np = __p.__node_; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered container erase(iterator) called with an iterator not" + " referring to this container"); + _LIBCUDACXX_ASSERT(__p != end(), + "unordered container erase(iterator) called with a non-dereferenceable iterator"); + iterator __r(__np, this); +#else + iterator __r(__np); +#endif + ++__r; + remove(__p); + return __r; +} + +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator +__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first, + const_iterator __last) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this, + "unodered container::erase(iterator, iterator) called with an iterator not" + " referring to this unodered container"); + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__last) == this, + "unodered container::erase(iterator, iterator) called with an iterator not" + " referring to this unodered container"); +#endif + for (const_iterator __p = __first; __first != __last; __p = __first) + { + ++__first; + erase(__p); + } + __next_pointer __np = __last.__node_; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator (__np, this); +#else + return iterator (__np); +#endif +} + +template +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_unique(const _Key& __k) +{ + iterator __i = find(__k); + if (__i == end()) + return 0; + erase(__i); + return 1; +} + +template +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_multi(const _Key& __k) +{ + size_type __r = 0; + iterator __i = find(__k); + if (__i != end()) + { + iterator __e = end(); + do + { + erase(__i++); + ++__r; + } while (__i != __e && key_eq()(*__i, __k)); + } + return __r; +} + +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder +__hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) noexcept +{ + // current node + __next_pointer __cn = __p.__node_; + size_type __bc = bucket_count(); + size_t __chash = __constrain_hash(__cn->__hash(), __bc); + // find previous node + __next_pointer __pn = __bucket_list_[__chash]; + for (; __pn->__next_ != __cn; __pn = __pn->__next_) + ; + // Fix up __bucket_list_ + // if __pn is not in same bucket (before begin is not in same bucket) && + // if __cn->__next_ is not in same bucket (nullptr is not in same bucket) + if (__pn == __p1_.first().__ptr() + || __constrain_hash(__pn->__hash(), __bc) != __chash) + { + if (__cn->__next_ == nullptr + || __constrain_hash(__cn->__next_->__hash(), __bc) != __chash) + __bucket_list_[__chash] = nullptr; + } + // if __cn->__next_ is not in same bucket (nullptr is in same bucket) + if (__cn->__next_ != nullptr) + { + size_t __nhash = __constrain_hash(__cn->__next_->__hash(), __bc); + if (__nhash != __chash) + __bucket_list_[__nhash] = __pn; + } + // remove __cn + __pn->__next_ = __cn->__next_; + __cn->__next_ = nullptr; + --size(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __dp = __c->end_; __dp != __c->beg_; ) + { + --__dp; + iterator* __i = static_cast((*__dp)->__i_); + if (__i->__node_ == __cn) + { + (*__dp)->__c_ = nullptr; + if (--__c->end_ != __dp) + memmove(__dp, __dp+1, (__c->end_ - __dp)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif + return __node_holder(__cn->__upcast(), _Dp(__node_alloc(), true)); +} + +template +template +inline +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const +{ + return static_cast(find(__k) != end()); +} + +template +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_multi(const _Key& __k) const +{ + size_type __r = 0; + const_iterator __i = find(__k); + if (__i != end()) + { + const_iterator __e = end(); + do + { + ++__i; + ++__r; + } while (__i != __e && key_eq()(*__i, __k)); + } + return __r; +} + +template +template +pair::iterator, + typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator> +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique( + const _Key& __k) +{ + iterator __i = find(__k); + iterator __j = __i; + if (__i != end()) + ++__j; + return pair(__i, __j); +} + +template +template +pair::const_iterator, + typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator> +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique( + const _Key& __k) const +{ + const_iterator __i = find(__k); + const_iterator __j = __i; + if (__i != end()) + ++__j; + return pair(__i, __j); +} + +template +template +pair::iterator, + typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator> +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi( + const _Key& __k) +{ + iterator __i = find(__k); + iterator __j = __i; + if (__i != end()) + { + iterator __e = end(); + do + { + ++__j; + } while (__j != __e && key_eq()(*__j, __k)); + } + return pair(__i, __j); +} + +template +template +pair::const_iterator, + typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator> +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi( + const _Key& __k) const +{ + const_iterator __i = find(__k); + const_iterator __j = __i; + if (__i != end()) + { + const_iterator __e = end(); + do + { + ++__j; + } while (__j != __e && key_eq()(*__j, __k)); + } + return pair(__i, __j); +} + +template +void +__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u) +#if _LIBCUDACXX_STD_VER <= 11 + noexcept( + __is_nothrow_swappable::value && __is_nothrow_swappable::value + && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value + || __is_nothrow_swappable<__pointer_allocator>::value) + && (!__node_traits::propagate_on_container_swap::value + || __is_nothrow_swappable<__node_allocator>::value) + ) +#else + noexcept(__is_nothrow_swappable::value && __is_nothrow_swappable::value) +#endif +{ + _LIBCUDACXX_ASSERT(__node_traits::propagate_on_container_swap::value || + this->__node_alloc() == __u.__node_alloc(), + "list::swap: Either propagate_on_container_swap must be true" + " or the allocators must compare equal"); + { + __node_pointer_pointer __npp = __bucket_list_.release(); + __bucket_list_.reset(__u.__bucket_list_.release()); + __u.__bucket_list_.reset(__npp); + } + _CUDA_VSTD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size()); + __swap_allocator(__bucket_list_.get_deleter().__alloc(), + __u.__bucket_list_.get_deleter().__alloc()); + __swap_allocator(__node_alloc(), __u.__node_alloc()); + _CUDA_VSTD::swap(__p1_.first().__next_, __u.__p1_.first().__next_); + __p2_.swap(__u.__p2_); + __p3_.swap(__u.__p3_); + if (size() > 0) + __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = + __p1_.first().__ptr(); + if (__u.size() > 0) + __u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] = + __u.__p1_.first().__ptr(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->swap(this, &__u); +#endif +} + +template +typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type +__hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const +{ + _LIBCUDACXX_ASSERT(__n < bucket_count(), + "unordered container::bucket_size(n) called with n >= bucket_count()"); + __next_pointer __np = __bucket_list_[__n]; + size_type __bc = bucket_count(); + size_type __r = 0; + if (__np != nullptr) + { + for (__np = __np->__next_; __np != nullptr && + __constrain_hash(__np->__hash(), __bc) == __n; + __np = __np->__next_, ++__r) + ; + } + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x, + __hash_table<_Tp, _Hash, _Equal, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) +{ + __x.swap(__y); +} + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + +template +bool +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__dereferenceable(const const_iterator* __i) const +{ + return __i->__node_ != nullptr; +} + +template +bool +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__decrementable(const const_iterator*) const +{ + return false; +} + +template +bool +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__addable(const const_iterator*, ptrdiff_t) const +{ + return false; +} + +template +bool +__hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const +{ + return false; +} + +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX__HASH_TABLE diff --git a/cuda_toolkit/include/__libcpp_version b/cuda_toolkit/include/__libcpp_version new file mode 100644 index 0000000000000000000000000000000000000000..5caff40c4a0ce4ed0dcb3aa983da623641af1b06 --- /dev/null +++ b/cuda_toolkit/include/__libcpp_version @@ -0,0 +1 @@ +10000 diff --git a/cuda_toolkit/include/__locale b/cuda_toolkit/include/__locale new file mode 100644 index 0000000000000000000000000000000000000000..17773f6bce705a7b18ffd49eca624f72f5ca2a94 --- /dev/null +++ b/cuda_toolkit/include/__locale @@ -0,0 +1,1557 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___LOCALE +#define _LIBCUDACXX___LOCALE + +#include <__config> +#include +#include +#include +#include +#include +#include +#include +#if defined(_LIBCUDACXX_MSVCRT_LIKE) +# include +# include +#elif defined(_AIX) +# include +#elif defined(__ANDROID__) +# include +#elif defined(__sun__) +# include +# include +#elif defined(_NEWLIB_VERSION) +# include +#elif (defined(__APPLE__) || defined(__FreeBSD__) \ + || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) +# include +#elif defined(__Fuchsia__) +# include +#elif defined(__wasi__) +// WASI libc uses musl's locales support. +# include +#elif defined(_LIBCUDACXX_HAS_MUSL_LIBC) +# include +#endif + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCUDACXX_LOCALE__L_EXTENSIONS) +struct __libcpp_locale_guard { + _LIBCUDACXX_INLINE_VISIBILITY + __libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + ~__libcpp_locale_guard() { + if (__old_loc_) + uselocale(__old_loc_); + } + + locale_t __old_loc_; +private: + __libcpp_locale_guard(__libcpp_locale_guard const&); + __libcpp_locale_guard& operator=(__libcpp_locale_guard const&); +}; +#elif defined(_LIBCUDACXX_MSVCRT_LIKE) +struct __libcpp_locale_guard { + __libcpp_locale_guard(locale_t __l) : + __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) { + // Setting the locale can be expensive even when the locale given is + // already the current locale, so do an explicit check to see if the + // current locale is already the one we want. + const char* __lc = __setlocale(nullptr); + // If every category is the same, the locale string will simply be the + // locale name, otherwise it will be a semicolon-separated string listing + // each category. In the second case, we know at least one category won't + // be what we want, so we only have to check the first case. + if (strcmp(__l.__get_locale(), __lc) != 0) { + __locale_all = _strdup(__lc); + if (__locale_all == nullptr) + __throw_bad_alloc(); + __setlocale(__l.__get_locale()); + } + } + ~__libcpp_locale_guard() { + // The CRT documentation doesn't explicitly say, but setlocale() does the + // right thing when given a semicolon-separated list of locale settings + // for the different categories in the same format as returned by + // setlocale(LC_ALL, nullptr). + if (__locale_all != nullptr) { + __setlocale(__locale_all); + free(__locale_all); + } + _configthreadlocale(__status); + } + static const char* __setlocale(const char* __locale) { + const char* __new_locale = setlocale(LC_ALL, __locale); + if (__new_locale == nullptr) + __throw_bad_alloc(); + return __new_locale; + } + int __status; + char* __locale_all = nullptr; +}; +#endif + + +class _LIBCUDACXX_TYPE_VIS locale; + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +has_facet(const locale&) noexcept; + +template +_LIBCUDACXX_INLINE_VISIBILITY +const _Facet& +use_facet(const locale&); + +class _LIBCUDACXX_TYPE_VIS locale +{ +public: + // types: + class _LIBCUDACXX_TYPE_VIS facet; + class _LIBCUDACXX_TYPE_VIS id; + + typedef int category; + _LIBCUDACXX_AVAILABILITY_LOCALE_CATEGORY + static const category // values assigned here are for exposition only + none = 0, + collate = LC_COLLATE_MASK, + ctype = LC_CTYPE_MASK, + monetary = LC_MONETARY_MASK, + numeric = LC_NUMERIC_MASK, + time = LC_TIME_MASK, + messages = LC_MESSAGES_MASK, + all = collate | ctype | monetary | numeric | time | messages; + + // construct/copy/destroy: + locale() noexcept; + locale(const locale&) noexcept; + explicit locale(const char*); + explicit locale(const string&); + locale(const locale&, const char*, category); + locale(const locale&, const string&, category); + template + _LIBCUDACXX_INLINE_VISIBILITY locale(const locale&, _Facet*); + locale(const locale&, const locale&, category); + + ~locale(); + + const locale& operator=(const locale&) noexcept; + + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + locale combine(const locale&) const; + + // locale operations: + string name() const; + bool operator==(const locale&) const; + bool operator!=(const locale& __y) const {return !(*this == __y);} + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + bool operator()(const basic_string<_CharT, _Traits, _Allocator>&, + const basic_string<_CharT, _Traits, _Allocator>&) const; + + // global locale objects: + static locale global(const locale&); + static const locale& classic(); + +private: + class __imp; + __imp* __locale_; + + void __install_ctor(const locale&, facet*, long); + static locale& __global(); + bool has_facet(id&) const; + const facet* use_facet(id&) const; + + template friend bool has_facet(const locale&) noexcept; + template friend const _Facet& use_facet(const locale&); +}; + +class _LIBCUDACXX_TYPE_VIS locale::facet + : public __shared_count +{ +protected: + _LIBCUDACXX_INLINE_VISIBILITY + explicit facet(size_t __refs = 0) + : __shared_count(static_cast(__refs)-1) {} + + virtual ~facet(); + +// facet(const facet&) = delete; // effectively done in __shared_count +// void operator=(const facet&) = delete; +private: + virtual void __on_zero_shared() noexcept; +}; + +class _LIBCUDACXX_TYPE_VIS locale::id +{ + once_flag __flag_; + int32_t __id_; + + static int32_t __next_id; +public: + _LIBCUDACXX_INLINE_VISIBILITY constexpr id() :__id_(0) {} +private: + void __init(); + void operator=(const id&); // = delete; + id(const id&); // = delete; +public: // only needed for tests + long __get(); + + friend class locale; + friend class locale::__imp; +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +locale::locale(const locale& __other, _Facet* __f) +{ + __install_ctor(__other, __f, __f ? __f->id.__get() : 0); +} + +template +locale +locale::combine(const locale& __other) const +{ + if (!_CUDA_VSTD::has_facet<_Facet>(__other)) + __throw_runtime_error("locale::combine: locale missing facet"); + + return locale(*this, &const_cast<_Facet&>(_CUDA_VSTD::use_facet<_Facet>(__other))); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +has_facet(const locale& __l) noexcept +{ + return __l.has_facet(_Facet::id); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +const _Facet& +use_facet(const locale& __l) +{ + return static_cast(*__l.use_facet(_Facet::id)); +} + +// template class collate; + +template +class _LIBCUDACXX_TEMPLATE_VIS collate + : public locale::facet +{ +public: + typedef _CharT char_type; + typedef basic_string string_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit collate(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + int compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const + { + return do_compare(__lo1, __hi1, __lo2, __hi2); + } + + // FIXME(EricWF): The _LIBCUDACXX_ALWAYS_INLINE is needed on Windows to work + // around a dllimport bug that expects an external instantiation. + _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_ALWAYS_INLINE + string_type transform(const char_type* __lo, const char_type* __hi) const + { + return do_transform(__lo, __hi); + } + + _LIBCUDACXX_INLINE_VISIBILITY + long hash(const char_type* __lo, const char_type* __hi) const + { + return do_hash(__lo, __hi); + } + + static locale::id id; + +protected: + ~collate(); + virtual int do_compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const; + virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const + {return string_type(__lo, __hi);} + virtual long do_hash(const char_type* __lo, const char_type* __hi) const; +}; + +template locale::id collate<_CharT>::id; + +template +collate<_CharT>::~collate() +{ +} + +template +int +collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const +{ + for (; __lo2 != __hi2; ++__lo1, ++__lo2) + { + if (__lo1 == __hi1 || *__lo1 < *__lo2) + return -1; + if (*__lo2 < *__lo1) + return 1; + } + return __lo1 != __hi1; +} + +template +long +collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const +{ + size_t __h = 0; + const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8; + const size_t __mask = size_t(0xF) << (__sr + 4); + for(const char_type* __p = __lo; __p != __hi; ++__p) + { + __h = (__h << 4) + static_cast(*__p); + size_t __g = __h & __mask; + __h ^= __g | (__g >> __sr); + } + return static_cast(__h); +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS collate) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS collate) + +// template class collate_byname; + +template class _LIBCUDACXX_TEMPLATE_VIS collate_byname; + +template <> +class _LIBCUDACXX_TYPE_VIS collate_byname + : public collate +{ + locale_t __l; +public: + typedef char char_type; + typedef basic_string string_type; + + explicit collate_byname(const char* __n, size_t __refs = 0); + explicit collate_byname(const string& __n, size_t __refs = 0); + +protected: + ~collate_byname(); + virtual int do_compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const; + virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; +}; + +template <> +class _LIBCUDACXX_TYPE_VIS collate_byname + : public collate +{ + locale_t __l; +public: + typedef wchar_t char_type; + typedef basic_string string_type; + + explicit collate_byname(const char* __n, size_t __refs = 0); + explicit collate_byname(const string& __n, size_t __refs = 0); + +protected: + ~collate_byname(); + + virtual int do_compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const; + virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; +}; + +template +bool +locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x, + const basic_string<_CharT, _Traits, _Allocator>& __y) const +{ + return _CUDA_VSTD::use_facet<_CUDA_VSTD::collate<_CharT> >(*this).compare( + __x.data(), __x.data() + __x.size(), + __y.data(), __y.data() + __y.size()) < 0; +} + +// template class ctype + +class _LIBCUDACXX_TYPE_VIS ctype_base +{ +public: +#if defined(__GLIBC__) + typedef unsigned short mask; + static const mask space = _ISspace; + static const mask print = _ISprint; + static const mask cntrl = _IScntrl; + static const mask upper = _ISupper; + static const mask lower = _ISlower; + static const mask alpha = _ISalpha; + static const mask digit = _ISdigit; + static const mask punct = _ISpunct; + static const mask xdigit = _ISxdigit; + static const mask blank = _ISblank; +#if defined(__mips__) + static const mask __regex_word = static_cast(_ISbit(15)); +#else + static const mask __regex_word = 0x80; +#endif +#elif defined(_LIBCUDACXX_MSVCRT_LIKE) + typedef unsigned short mask; + static const mask space = _SPACE; + static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT; + static const mask cntrl = _CONTROL; + static const mask upper = _UPPER; + static const mask lower = _LOWER; + static const mask alpha = _ALPHA; + static const mask digit = _DIGIT; + static const mask punct = _PUNCT; + static const mask xdigit = _HEX; + static const mask blank = _BLANK; + static const mask __regex_word = 0x80; +# define _LIBCUDACXX_CTYPE_MASK_IS_COMPOSITE_PRINT +#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) +# ifdef __APPLE__ + typedef __uint32_t mask; +# elif defined(__FreeBSD__) + typedef unsigned long mask; +# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__) + typedef unsigned short mask; +# endif + static const mask space = _CTYPE_S; + static const mask print = _CTYPE_R; + static const mask cntrl = _CTYPE_C; + static const mask upper = _CTYPE_U; + static const mask lower = _CTYPE_L; + static const mask alpha = _CTYPE_A; + static const mask digit = _CTYPE_D; + static const mask punct = _CTYPE_P; + static const mask xdigit = _CTYPE_X; + +# if defined(__NetBSD__) + static const mask blank = _CTYPE_BL; + // NetBSD defines classes up to 0x2000 + // see sys/ctype_bits.h, _CTYPE_Q + static const mask __regex_word = 0x8000; +# else + static const mask blank = _CTYPE_B; + static const mask __regex_word = 0x80; +# endif +#elif defined(__sun__) || defined(_AIX) + typedef unsigned int mask; + static const mask space = _ISSPACE; + static const mask print = _ISPRINT; + static const mask cntrl = _ISCNTRL; + static const mask upper = _ISUPPER; + static const mask lower = _ISLOWER; + static const mask alpha = _ISALPHA; + static const mask digit = _ISDIGIT; + static const mask punct = _ISPUNCT; + static const mask xdigit = _ISXDIGIT; + static const mask blank = _ISBLANK; + static const mask __regex_word = 0x80; +#elif defined(_NEWLIB_VERSION) + // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h. + typedef char mask; + static const mask space = _S; + static const mask print = _P | _U | _L | _N | _B; + static const mask cntrl = _C; + static const mask upper = _U; + static const mask lower = _L; + static const mask alpha = _U | _L; + static const mask digit = _N; + static const mask punct = _P; + static const mask xdigit = _X | _N; + static const mask blank = _B; + static const mask __regex_word = 0x80; +# define _LIBCUDACXX_CTYPE_MASK_IS_COMPOSITE_PRINT +# define _LIBCUDACXX_CTYPE_MASK_IS_COMPOSITE_ALPHA +# define _LIBCUDACXX_CTYPE_MASK_IS_COMPOSITE_XDIGIT +#else + typedef unsigned long mask; + static const mask space = 1<<0; + static const mask print = 1<<1; + static const mask cntrl = 1<<2; + static const mask upper = 1<<3; + static const mask lower = 1<<4; + static const mask alpha = 1<<5; + static const mask digit = 1<<6; + static const mask punct = 1<<7; + static const mask xdigit = 1<<8; + static const mask blank = 1<<9; + static const mask __regex_word = 1<<10; +#endif + static const mask alnum = alpha | digit; + static const mask graph = alnum | punct; + + _LIBCUDACXX_INLINE_VISIBILITY ctype_base() {} +}; + +template class _LIBCUDACXX_TEMPLATE_VIS ctype; + +template <> +class _LIBCUDACXX_TYPE_VIS ctype + : public locale::facet, + public ctype_base +{ +public: + typedef wchar_t char_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit ctype(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + bool is(mask __m, char_type __c) const + { + return do_is(__m, __c); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const + { + return do_is(__low, __high, __vec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const + { + return do_scan_is(__m, __low, __high); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const + { + return do_scan_not(__m, __low, __high); + } + + _LIBCUDACXX_INLINE_VISIBILITY + char_type toupper(char_type __c) const + { + return do_toupper(__c); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* toupper(char_type* __low, const char_type* __high) const + { + return do_toupper(__low, __high); + } + + _LIBCUDACXX_INLINE_VISIBILITY + char_type tolower(char_type __c) const + { + return do_tolower(__c); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* tolower(char_type* __low, const char_type* __high) const + { + return do_tolower(__low, __high); + } + + _LIBCUDACXX_INLINE_VISIBILITY + char_type widen(char __c) const + { + return do_widen(__c); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char* widen(const char* __low, const char* __high, char_type* __to) const + { + return do_widen(__low, __high, __to); + } + + _LIBCUDACXX_INLINE_VISIBILITY + char narrow(char_type __c, char __dfault) const + { + return do_narrow(__c, __dfault); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const + { + return do_narrow(__low, __high, __dfault, __to); + } + + static locale::id id; + +protected: + ~ctype(); + virtual bool do_is(mask __m, char_type __c) const; + virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; + virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; + virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; + virtual char_type do_toupper(char_type) const; + virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; + virtual char_type do_tolower(char_type) const; + virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; + virtual char_type do_widen(char) const; + virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; + virtual char do_narrow(char_type, char __dfault) const; + virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; +}; + +template <> +class _LIBCUDACXX_TYPE_VIS ctype + : public locale::facet, public ctype_base +{ + const mask* __tab_; + bool __del_; +public: + typedef char char_type; + + explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0); + + _LIBCUDACXX_INLINE_VISIBILITY + bool is(mask __m, char_type __c) const + { + return isascii(__c) ? (__tab_[static_cast(__c)] & __m) !=0 : false; + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const + { + for (; __low != __high; ++__low, ++__vec) + *__vec = isascii(*__low) ? __tab_[static_cast(*__low)] : 0; + return __low; + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const + { + for (; __low != __high; ++__low) + if (isascii(*__low) && (__tab_[static_cast(*__low)] & __m)) + break; + return __low; + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const + { + for (; __low != __high; ++__low) + if (!(isascii(*__low) && (__tab_[static_cast(*__low)] & __m))) + break; + return __low; + } + + _LIBCUDACXX_INLINE_VISIBILITY + char_type toupper(char_type __c) const + { + return do_toupper(__c); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* toupper(char_type* __low, const char_type* __high) const + { + return do_toupper(__low, __high); + } + + _LIBCUDACXX_INLINE_VISIBILITY + char_type tolower(char_type __c) const + { + return do_tolower(__c); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char_type* tolower(char_type* __low, const char_type* __high) const + { + return do_tolower(__low, __high); + } + + _LIBCUDACXX_INLINE_VISIBILITY + char_type widen(char __c) const + { + return do_widen(__c); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char* widen(const char* __low, const char* __high, char_type* __to) const + { + return do_widen(__low, __high, __to); + } + + _LIBCUDACXX_INLINE_VISIBILITY + char narrow(char_type __c, char __dfault) const + { + return do_narrow(__c, __dfault); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const + { + return do_narrow(__low, __high, __dfault, __to); + } + + static locale::id id; + +#ifdef _CACHED_RUNES + static const size_t table_size = _CACHED_RUNES; +#else + static const size_t table_size = 256; // FIXME: Don't hardcode this. +#endif + _LIBCUDACXX_INLINE_VISIBILITY const mask* table() const noexcept {return __tab_;} + static const mask* classic_table() noexcept; +#if defined(__GLIBC__) || defined(__EMSCRIPTEN__) + static const int* __classic_upper_table() noexcept; + static const int* __classic_lower_table() noexcept; +#endif +#if defined(__NetBSD__) + static const short* __classic_upper_table() noexcept; + static const short* __classic_lower_table() noexcept; +#endif + +protected: + ~ctype(); + virtual char_type do_toupper(char_type __c) const; + virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; + virtual char_type do_tolower(char_type __c) const; + virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; + virtual char_type do_widen(char __c) const; + virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const; + virtual char do_narrow(char_type __c, char __dfault) const; + virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const; +}; + +// template class ctype_byname; + +template class _LIBCUDACXX_TEMPLATE_VIS ctype_byname; + +template <> +class _LIBCUDACXX_TYPE_VIS ctype_byname + : public ctype +{ + locale_t __l; + +public: + explicit ctype_byname(const char*, size_t = 0); + explicit ctype_byname(const string&, size_t = 0); + +protected: + ~ctype_byname(); + virtual char_type do_toupper(char_type) const; + virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; + virtual char_type do_tolower(char_type) const; + virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; +}; + +template <> +class _LIBCUDACXX_TYPE_VIS ctype_byname + : public ctype +{ + locale_t __l; + +public: + explicit ctype_byname(const char*, size_t = 0); + explicit ctype_byname(const string&, size_t = 0); + +protected: + ~ctype_byname(); + virtual bool do_is(mask __m, char_type __c) const; + virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; + virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; + virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; + virtual char_type do_toupper(char_type) const; + virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; + virtual char_type do_tolower(char_type) const; + virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; + virtual char_type do_widen(char) const; + virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; + virtual char do_narrow(char_type, char __dfault) const; + virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isspace(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::space, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isprint(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::print, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +iscntrl(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::cntrl, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isupper(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::upper, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +islower(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::lower, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isalpha(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::alpha, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isdigit(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::digit, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +ispunct(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::punct, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isxdigit(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::xdigit, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isalnum(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::alnum, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isgraph(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).is(ctype_base::graph, __c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_CharT +toupper(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).toupper(__c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_CharT +tolower(_CharT __c, const locale& __loc) +{ + return use_facet >(__loc).tolower(__c); +} + +// codecvt_base + +class _LIBCUDACXX_TYPE_VIS codecvt_base +{ +public: + _LIBCUDACXX_INLINE_VISIBILITY codecvt_base() {} + enum result {ok, partial, error, noconv}; +}; + +// template class codecvt; + +template class _LIBCUDACXX_TEMPLATE_VIS codecvt; + +// template <> class codecvt + +template <> +class _LIBCUDACXX_TYPE_VIS codecvt + : public locale::facet, + public codecvt_base +{ +public: + typedef char intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + result out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const + { + return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + result unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const + { + return do_unshift(__st, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + result in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const + { + return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int encoding() const noexcept + { + return do_encoding(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool always_noconv() const noexcept + { + return do_always_noconv(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const + { + return do_length(__st, __frm, __end, __mx); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int max_length() const noexcept + { + return do_max_length(); + } + + static locale::id id; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt(const char*, size_t __refs = 0) + : locale::facet(__refs) {} + + ~codecvt(); + + virtual result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const noexcept; + virtual bool do_always_noconv() const noexcept; + virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const; + virtual int do_max_length() const noexcept; +}; + +// template <> class codecvt + +template <> +class _LIBCUDACXX_TYPE_VIS codecvt + : public locale::facet, + public codecvt_base +{ + locale_t __l; +public: + typedef wchar_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + explicit codecvt(size_t __refs = 0); + + _LIBCUDACXX_INLINE_VISIBILITY + result out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const + { + return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + result unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const + { + return do_unshift(__st, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + result in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const + { + return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int encoding() const noexcept + { + return do_encoding(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool always_noconv() const noexcept + { + return do_always_noconv(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const + { + return do_length(__st, __frm, __end, __mx); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int max_length() const noexcept + { + return do_max_length(); + } + + static locale::id id; + +protected: + explicit codecvt(const char*, size_t __refs = 0); + + ~codecvt(); + + virtual result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const noexcept; + virtual bool do_always_noconv() const noexcept; + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; + virtual int do_max_length() const noexcept; +}; + +// template <> class codecvt + +template <> +class _LIBCUDACXX_TYPE_VIS codecvt + : public locale::facet, + public codecvt_base +{ +public: + typedef char16_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + result out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const + { + return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + result unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const + { + return do_unshift(__st, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + result in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const + { + return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int encoding() const noexcept + { + return do_encoding(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool always_noconv() const noexcept + { + return do_always_noconv(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const + { + return do_length(__st, __frm, __end, __mx); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int max_length() const noexcept + { + return do_max_length(); + } + + static locale::id id; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt(const char*, size_t __refs = 0) + : locale::facet(__refs) {} + + ~codecvt(); + + virtual result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const noexcept; + virtual bool do_always_noconv() const noexcept; + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; + virtual int do_max_length() const noexcept; +}; + +// template <> class codecvt + +template <> +class _LIBCUDACXX_TYPE_VIS codecvt + : public locale::facet, + public codecvt_base +{ +public: + typedef char32_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + result out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const + { + return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + result unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const + { + return do_unshift(__st, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + result in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const + { + return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int encoding() const noexcept + { + return do_encoding(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool always_noconv() const noexcept + { + return do_always_noconv(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const + { + return do_length(__st, __frm, __end, __mx); + } + + _LIBCUDACXX_INLINE_VISIBILITY + int max_length() const noexcept + { + return do_max_length(); + } + + static locale::id id; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt(const char*, size_t __refs = 0) + : locale::facet(__refs) {} + + ~codecvt(); + + virtual result do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const noexcept; + virtual bool do_always_noconv() const noexcept; + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; + virtual int do_max_length() const noexcept; +}; + +// template class codecvt_byname + +template +class _LIBCUDACXX_TEMPLATE_VIS codecvt_byname + : public codecvt<_InternT, _ExternT, _StateT> +{ +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt_byname(const char* __nm, size_t __refs = 0) + : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt_byname(const string& __nm, size_t __refs = 0) + : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {} +protected: + ~codecvt_byname(); +}; + +template +codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() +{ +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) + +template +struct __narrow_to_utf8 +{ + template + _OutputIterator + operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const; +}; + +template <> +struct __narrow_to_utf8<8> +{ + template + _LIBCUDACXX_INLINE_VISIBILITY + _OutputIterator + operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const + { + for (; __wb < __we; ++__wb, ++__s) + *__s = *__wb; + return __s; + } +}; + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS __narrow_to_utf8<16> + : public codecvt +{ + _LIBCUDACXX_INLINE_VISIBILITY + __narrow_to_utf8() : codecvt(1) {} + + _LIBCUDACXX_EXPORTED_FROM_ABI ~__narrow_to_utf8(); + + template + _LIBCUDACXX_INLINE_VISIBILITY + _OutputIterator + operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const + { + result __r = ok; + mbstate_t __mb; + while (__wb < __we && __r != error) + { + const int __sz = 32; + char __buf[__sz]; + char* __bn; + const char16_t* __wn = (const char16_t*)__wb; + __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn, + __buf, __buf+__sz, __bn); + if (__r == codecvt_base::error || __wn == (const char16_t*)__wb) + __throw_runtime_error("locale not supported"); + for (const char* __p = __buf; __p < __bn; ++__p, ++__s) + *__s = *__p; + __wb = (const _CharT*)__wn; + } + return __s; + } +}; + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS __narrow_to_utf8<32> + : public codecvt +{ + _LIBCUDACXX_INLINE_VISIBILITY + __narrow_to_utf8() : codecvt(1) {} + + _LIBCUDACXX_EXPORTED_FROM_ABI ~__narrow_to_utf8(); + + template + _LIBCUDACXX_INLINE_VISIBILITY + _OutputIterator + operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const + { + result __r = ok; + mbstate_t __mb; + while (__wb < __we && __r != error) + { + const int __sz = 32; + char __buf[__sz]; + char* __bn; + const char32_t* __wn = (const char32_t*)__wb; + __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn, + __buf, __buf+__sz, __bn); + if (__r == codecvt_base::error || __wn == (const char32_t*)__wb) + __throw_runtime_error("locale not supported"); + for (const char* __p = __buf; __p < __bn; ++__p, ++__s) + *__s = *__p; + __wb = (const _CharT*)__wn; + } + return __s; + } +}; + +template +struct __widen_from_utf8 +{ + template + _OutputIterator + operator()(_OutputIterator __s, const char* __nb, const char* __ne) const; +}; + +template <> +struct __widen_from_utf8<8> +{ + template + _LIBCUDACXX_INLINE_VISIBILITY + _OutputIterator + operator()(_OutputIterator __s, const char* __nb, const char* __ne) const + { + for (; __nb < __ne; ++__nb, ++__s) + *__s = *__nb; + return __s; + } +}; + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS __widen_from_utf8<16> + : public codecvt +{ + _LIBCUDACXX_INLINE_VISIBILITY + __widen_from_utf8() : codecvt(1) {} + + _LIBCUDACXX_EXPORTED_FROM_ABI ~__widen_from_utf8(); + + template + _LIBCUDACXX_INLINE_VISIBILITY + _OutputIterator + operator()(_OutputIterator __s, const char* __nb, const char* __ne) const + { + result __r = ok; + mbstate_t __mb; + while (__nb < __ne && __r != error) + { + const int __sz = 32; + char16_t __buf[__sz]; + char16_t* __bn; + const char* __nn = __nb; + __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn, + __buf, __buf+__sz, __bn); + if (__r == codecvt_base::error || __nn == __nb) + __throw_runtime_error("locale not supported"); + for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s) + *__s = (wchar_t)*__p; + __nb = __nn; + } + return __s; + } +}; + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS __widen_from_utf8<32> + : public codecvt +{ + _LIBCUDACXX_INLINE_VISIBILITY + __widen_from_utf8() : codecvt(1) {} + + _LIBCUDACXX_EXPORTED_FROM_ABI ~__widen_from_utf8(); + + template + _LIBCUDACXX_INLINE_VISIBILITY + _OutputIterator + operator()(_OutputIterator __s, const char* __nb, const char* __ne) const + { + result __r = ok; + mbstate_t __mb; + while (__nb < __ne && __r != error) + { + const int __sz = 32; + char32_t __buf[__sz]; + char32_t* __bn; + const char* __nn = __nb; + __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn, + __buf, __buf+__sz, __bn); + if (__r == codecvt_base::error || __nn == __nb) + __throw_runtime_error("locale not supported"); + for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s) + *__s = (wchar_t)*__p; + __nb = __nn; + } + return __s; + } +}; + +// template class numpunct + +template class _LIBCUDACXX_TEMPLATE_VIS numpunct; + +template <> +class _LIBCUDACXX_TYPE_VIS numpunct + : public locale::facet +{ +public: + typedef char char_type; + typedef basic_string string_type; + + explicit numpunct(size_t __refs = 0); + + _LIBCUDACXX_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();} + _LIBCUDACXX_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();} + _LIBCUDACXX_INLINE_VISIBILITY string grouping() const {return do_grouping();} + _LIBCUDACXX_INLINE_VISIBILITY string_type truename() const {return do_truename();} + _LIBCUDACXX_INLINE_VISIBILITY string_type falsename() const {return do_falsename();} + + static locale::id id; + +protected: + ~numpunct(); + virtual char_type do_decimal_point() const; + virtual char_type do_thousands_sep() const; + virtual string do_grouping() const; + virtual string_type do_truename() const; + virtual string_type do_falsename() const; + + char_type __decimal_point_; + char_type __thousands_sep_; + string __grouping_; +}; + +template <> +class _LIBCUDACXX_TYPE_VIS numpunct + : public locale::facet +{ +public: + typedef wchar_t char_type; + typedef basic_string string_type; + + explicit numpunct(size_t __refs = 0); + + _LIBCUDACXX_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();} + _LIBCUDACXX_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();} + _LIBCUDACXX_INLINE_VISIBILITY string grouping() const {return do_grouping();} + _LIBCUDACXX_INLINE_VISIBILITY string_type truename() const {return do_truename();} + _LIBCUDACXX_INLINE_VISIBILITY string_type falsename() const {return do_falsename();} + + static locale::id id; + +protected: + ~numpunct(); + virtual char_type do_decimal_point() const; + virtual char_type do_thousands_sep() const; + virtual string do_grouping() const; + virtual string_type do_truename() const; + virtual string_type do_falsename() const; + + char_type __decimal_point_; + char_type __thousands_sep_; + string __grouping_; +}; + +// template class numpunct_byname + +template class _LIBCUDACXX_TEMPLATE_VIS numpunct_byname; + +template <> +class _LIBCUDACXX_TYPE_VIS numpunct_byname +: public numpunct +{ +public: + typedef char char_type; + typedef basic_string string_type; + + explicit numpunct_byname(const char* __nm, size_t __refs = 0); + explicit numpunct_byname(const string& __nm, size_t __refs = 0); + +protected: + ~numpunct_byname(); + +private: + void __init(const char*); +}; + +template <> +class _LIBCUDACXX_TYPE_VIS numpunct_byname +: public numpunct +{ +public: + typedef wchar_t char_type; + typedef basic_string string_type; + + explicit numpunct_byname(const char* __nm, size_t __refs = 0); + explicit numpunct_byname(const string& __nm, size_t __refs = 0); + +protected: + ~numpunct_byname(); + +private: + void __init(const char*); +}; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX___LOCALE diff --git a/cuda_toolkit/include/__mutex_base b/cuda_toolkit/include/__mutex_base new file mode 100644 index 0000000000000000000000000000000000000000..99c1602f9b4dc7269f45c537fd8d43ef570d6d35 --- /dev/null +++ b/cuda_toolkit/include/__mutex_base @@ -0,0 +1,542 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___MUTEX_BASE +#define _LIBCUDACXX___MUTEX_BASE + +#include <__config> +#include +#include +#include <__threading_support> + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#ifndef _LIBCUDACXX_HAS_NO_THREADS + +#ifndef _LIBCUDACXX_THREAD_SAFETY_ANNOTATION +# ifdef _LIBCUDACXX_HAS_THREAD_SAFETY_ANNOTATIONS +# define _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(x) __attribute__((x)) +# else +# define _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(x) +# endif +#endif // _LIBCUDACXX_THREAD_SAFETY_ANNOTATION + + +class _LIBCUDACXX_TYPE_VIS _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex +{ + __libcpp_mutex_t __m_ = _LIBCUDACXX_MUTEX_INITIALIZER; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + constexpr mutex() = default; + + mutex(const mutex&) = delete; + mutex& operator=(const mutex&) = delete; + +#if defined(_LIBCUDACXX_HAS_TRIVIAL_MUTEX_DESTRUCTION) + ~mutex() = default; +#else + ~mutex() noexcept; +#endif + + void lock() _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(acquire_capability()); + bool try_lock() noexcept _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(try_acquire_capability(true)); + void unlock() noexcept _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(release_capability()); + + typedef __libcpp_mutex_t* native_handle_type; + _LIBCUDACXX_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} +}; + +static_assert(is_nothrow_default_constructible::value, + "the default constructor for std::mutex must be nothrow"); + +struct _LIBCUDACXX_TYPE_VIS defer_lock_t { explicit defer_lock_t() = default; }; +struct _LIBCUDACXX_TYPE_VIS try_to_lock_t { explicit try_to_lock_t() = default; }; +struct _LIBCUDACXX_TYPE_VIS adopt_lock_t { explicit adopt_lock_t() = default; }; + +#if defined(_LIBCUDACXX_BUILDING_LIBRARY) + +extern _LIBCUDACXX_EXPORTED_FROM_ABI const defer_lock_t defer_lock; +extern _LIBCUDACXX_EXPORTED_FROM_ABI const try_to_lock_t try_to_lock; +extern _LIBCUDACXX_EXPORTED_FROM_ABI const adopt_lock_t adopt_lock; + +#else + +/* _LIBCUDACXX_INLINE_VAR */ constexpr defer_lock_t defer_lock = defer_lock_t(); +/* _LIBCUDACXX_INLINE_VAR */ constexpr try_to_lock_t try_to_lock = try_to_lock_t(); +/* _LIBCUDACXX_INLINE_VAR */ constexpr adopt_lock_t adopt_lock = adopt_lock_t(); + +#endif + +template +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(scoped_lockable) +lock_guard +{ +public: + typedef _Mutex mutex_type; + +private: + mutex_type& __m_; +public: + + _LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY + explicit lock_guard(mutex_type& __m) _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) + : __m_(__m) {__m_.lock();} + + _LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY + lock_guard(mutex_type& __m, adopt_lock_t) _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) + : __m_(__m) {} + _LIBCUDACXX_INLINE_VISIBILITY + ~lock_guard() _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();} + +private: + lock_guard(lock_guard const&) = delete; + lock_guard& operator=(lock_guard const&) = delete; +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS unique_lock +{ +public: + typedef _Mutex mutex_type; + +private: + mutex_type* __m_; + bool __owns_; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + unique_lock() noexcept : __m_(nullptr), __owns_(false) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit unique_lock(mutex_type& __m) + : __m_(_CUDA_VSTD::addressof(__m)), __owns_(true) {__m_->lock();} + _LIBCUDACXX_INLINE_VISIBILITY + unique_lock(mutex_type& __m, defer_lock_t) noexcept + : __m_(_CUDA_VSTD::addressof(__m)), __owns_(false) {} + _LIBCUDACXX_INLINE_VISIBILITY + unique_lock(mutex_type& __m, try_to_lock_t) + : __m_(_CUDA_VSTD::addressof(__m)), __owns_(__m.try_lock()) {} + _LIBCUDACXX_INLINE_VISIBILITY + unique_lock(mutex_type& __m, adopt_lock_t) + : __m_(_CUDA_VSTD::addressof(__m)), __owns_(true) {} + template + _LIBCUDACXX_INLINE_VISIBILITY + unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t) + : __m_(_CUDA_VSTD::addressof(__m)), __owns_(__m.try_lock_until(__t)) {} + template + _LIBCUDACXX_INLINE_VISIBILITY + unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d) + : __m_(_CUDA_VSTD::addressof(__m)), __owns_(__m.try_lock_for(__d)) {} + _LIBCUDACXX_INLINE_VISIBILITY + ~unique_lock() + { + if (__owns_) + __m_->unlock(); + } + +private: + unique_lock(unique_lock const&); // = delete; + unique_lock& operator=(unique_lock const&); // = delete; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + unique_lock(unique_lock&& __u) noexcept + : __m_(__u.__m_), __owns_(__u.__owns_) + {__u.__m_ = nullptr; __u.__owns_ = false;} + _LIBCUDACXX_INLINE_VISIBILITY + unique_lock& operator=(unique_lock&& __u) noexcept + { + if (__owns_) + __m_->unlock(); + __m_ = __u.__m_; + __owns_ = __u.__owns_; + __u.__m_ = nullptr; + __u.__owns_ = false; + return *this; + } + + void lock(); + bool try_lock(); + + template + bool try_lock_for(const chrono::duration<_Rep, _Period>& __d); + template + bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); + + void unlock(); + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(unique_lock& __u) noexcept + { + _CUDA_VSTD::swap(__m_, __u.__m_); + _CUDA_VSTD::swap(__owns_, __u.__owns_); + } + _LIBCUDACXX_INLINE_VISIBILITY + mutex_type* release() noexcept + { + mutex_type* __m = __m_; + __m_ = nullptr; + __owns_ = false; + return __m; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool owns_lock() const noexcept {return __owns_;} + _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_EXPLICIT + operator bool () const noexcept {return __owns_;} + _LIBCUDACXX_INLINE_VISIBILITY + mutex_type* mutex() const noexcept {return __m_;} +}; + +template +void +unique_lock<_Mutex>::lock() +{ + if (__m_ == nullptr) + __throw_system_error(EPERM, "unique_lock::lock: references null mutex"); + if (__owns_) + __throw_system_error(EDEADLK, "unique_lock::lock: already locked"); + __m_->lock(); + __owns_ = true; +} + +template +bool +unique_lock<_Mutex>::try_lock() +{ + if (__m_ == nullptr) + __throw_system_error(EPERM, "unique_lock::try_lock: references null mutex"); + if (__owns_) + __throw_system_error(EDEADLK, "unique_lock::try_lock: already locked"); + __owns_ = __m_->try_lock(); + return __owns_; +} + +template +template +bool +unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) +{ + if (__m_ == nullptr) + __throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex"); + if (__owns_) + __throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked"); + __owns_ = __m_->try_lock_for(__d); + return __owns_; +} + +template +template +bool +unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) +{ + if (__m_ == nullptr) + __throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex"); + if (__owns_) + __throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked"); + __owns_ = __m_->try_lock_until(__t); + return __owns_; +} + +template +void +unique_lock<_Mutex>::unlock() +{ + if (!__owns_) + __throw_system_error(EPERM, "unique_lock::unlock: not locked"); + __m_->unlock(); + __owns_ = false; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) noexcept + {__x.swap(__y);} + +//enum class cv_status +_LIBCUDACXX_DECLARE_STRONG_ENUM(cv_status) +{ + no_timeout, + timeout +}; +_LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(cv_status) + +class _LIBCUDACXX_TYPE_VIS condition_variable +{ + __libcpp_condvar_t __cv_ = _LIBCUDACXX_CONDVAR_INITIALIZER; +public: + _LIBCUDACXX_INLINE_VISIBILITY + constexpr condition_variable() noexcept = default; + +#ifdef _LIBCUDACXX_HAS_TRIVIAL_CONDVAR_DESTRUCTION + ~condition_variable() = default; +#else + ~condition_variable(); +#endif + + condition_variable(const condition_variable&) = delete; + condition_variable& operator=(const condition_variable&) = delete; + + void notify_one() noexcept; + void notify_all() noexcept; + + void wait(unique_lock& __lk) noexcept; + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + void wait(unique_lock& __lk, _Predicate __pred); + + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + cv_status + wait_until(unique_lock& __lk, + const chrono::time_point<_Clock, _Duration>& __t); + + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + bool + wait_until(unique_lock& __lk, + const chrono::time_point<_Clock, _Duration>& __t, + _Predicate __pred); + + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + cv_status + wait_for(unique_lock& __lk, + const chrono::duration<_Rep, _Period>& __d); + + template + bool + _LIBCUDACXX_INLINE_VISIBILITY + wait_for(unique_lock& __lk, + const chrono::duration<_Rep, _Period>& __d, + _Predicate __pred); + + typedef __libcpp_condvar_t* native_handle_type; + _LIBCUDACXX_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;} + +private: + void __do_timed_wait(unique_lock& __lk, + chrono::time_point) noexcept; +#if defined(_LIBCUDACXX_HAS_COND_CLOCKWAIT) + void __do_timed_wait(unique_lock& __lk, + chrono::time_point) noexcept; +#endif + template + void __do_timed_wait(unique_lock& __lk, + chrono::time_point<_Clock, chrono::nanoseconds>) noexcept; +}; +#endif // !_LIBCUDACXX_HAS_NO_THREADS + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename enable_if +< + is_floating_point<_Rep>::value, + chrono::nanoseconds +>::type +__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) +{ + using namespace chrono; + using __ratio = ratio_divide<_Period, nano>; + using __ns_rep = nanoseconds::rep; + _Rep __result_float = __d.count() * __ratio::num / __ratio::den; + + _Rep __result_max = numeric_limits<__ns_rep>::max(); + if (__result_float >= __result_max) { + return nanoseconds::max(); + } + + _Rep __result_min = numeric_limits<__ns_rep>::min(); + if (__result_float <= __result_min) { + return nanoseconds::min(); + } + + return nanoseconds(static_cast<__ns_rep>(__result_float)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename enable_if +< + !is_floating_point<_Rep>::value, + chrono::nanoseconds +>::type +__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) +{ + using namespace chrono; + if (__d.count() == 0) { + return nanoseconds(0); + } + + using __ratio = ratio_divide<_Period, nano>; + using __ns_rep = nanoseconds::rep; + __ns_rep __result_max = std::numeric_limits<__ns_rep>::max(); + if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) { + return nanoseconds::max(); + } + + __ns_rep __result_min = std::numeric_limits<__ns_rep>::min(); + if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) { + return nanoseconds::min(); + } + + __ns_rep __result = __d.count() * __ratio::num / __ratio::den; + if (__result == 0) { + return nanoseconds(1); + } + + return nanoseconds(__result); +} + +#ifndef _LIBCUDACXX_HAS_NO_THREADS +template +void +condition_variable::wait(unique_lock& __lk, _Predicate __pred) +{ + while (!__pred()) + wait(__lk); +} + +template +cv_status +condition_variable::wait_until(unique_lock& __lk, + const chrono::time_point<_Clock, _Duration>& __t) +{ + using namespace chrono; + using __clock_tp_ns = time_point<_Clock, nanoseconds>; + + typename _Clock::time_point __now = _Clock::now(); + if (__t <= __now) + return cv_status::timeout; + + __clock_tp_ns __t_ns = __clock_tp_ns(__safe_nanosecond_cast(__t.time_since_epoch())); + + __do_timed_wait(__lk, __t_ns); + return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout; +} + +template +bool +condition_variable::wait_until(unique_lock& __lk, + const chrono::time_point<_Clock, _Duration>& __t, + _Predicate __pred) +{ + while (!__pred()) + { + if (wait_until(__lk, __t) == cv_status::timeout) + return __pred(); + } + return true; +} + +template +cv_status +condition_variable::wait_for(unique_lock& __lk, + const chrono::duration<_Rep, _Period>& __d) +{ + using namespace chrono; + if (__d <= __d.zero()) + return cv_status::timeout; + using __ns_rep = nanoseconds::rep; + steady_clock::time_point __c_now = steady_clock::now(); + +#if defined(_LIBCUDACXX_HAS_COND_CLOCKWAIT) + using __clock_tp_ns = time_point; + __ns_rep __now_count_ns = __safe_nanosecond_cast(__c_now.time_since_epoch()).count(); +#else + using __clock_tp_ns = time_point; + __ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count(); +#endif + + __ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count(); + + if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) { + __do_timed_wait(__lk, __clock_tp_ns::max()); + } else { + __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count))); + } + + return steady_clock::now() - __c_now < __d ? cv_status::no_timeout : + cv_status::timeout; +} + +template +inline +bool +condition_variable::wait_for(unique_lock& __lk, + const chrono::duration<_Rep, _Period>& __d, + _Predicate __pred) +{ + return wait_until(__lk, chrono::steady_clock::now() + __d, + _CUDA_VSTD::move(__pred)); +} + +#if defined(_LIBCUDACXX_HAS_COND_CLOCKWAIT) +inline +void +condition_variable::__do_timed_wait(unique_lock& __lk, + chrono::time_point __tp) noexcept +{ + using namespace chrono; + if (!__lk.owns_lock()) + __throw_system_error(EPERM, + "condition_variable::timed wait: mutex not locked"); + nanoseconds __d = __tp.time_since_epoch(); + timespec __ts; + seconds __s = duration_cast(__d); + using __ts_sec = decltype(__ts.tv_sec); + const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max(); + if (__s.count() < __ts_sec_max) + { + __ts.tv_sec = static_cast<__ts_sec>(__s.count()); + __ts.tv_nsec = (__d - __s).count(); + } + else + { + __ts.tv_sec = __ts_sec_max; + __ts.tv_nsec = giga::num - 1; + } + int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts); + if (__ec != 0 && __ec != ETIMEDOUT) + __throw_system_error(__ec, "condition_variable timed_wait failed"); +} +#endif // _LIBCUDACXX_HAS_COND_CLOCKWAIT + +template +inline +void +condition_variable::__do_timed_wait(unique_lock& __lk, + chrono::time_point<_Clock, chrono::nanoseconds> __tp) noexcept +{ + wait_for(__lk, __tp - _Clock::now()); +} + +#endif // !_LIBCUDACXX_HAS_NO_THREADS + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX___MUTEX_BASE diff --git a/cuda_toolkit/include/__node_handle b/cuda_toolkit/include/__node_handle new file mode 100644 index 0000000000000000000000000000000000000000..e345da5f6fcabe88cb20a5b5efeae5ed911f5e88 --- /dev/null +++ b/cuda_toolkit/include/__node_handle @@ -0,0 +1,213 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___NODE_HANDLE +#define _LIBCUDACXX___NODE_HANDLE + +#include <__config> +#include "__assert" // all public C++ headers provide the assertion handler +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#if _LIBCUDACXX_STD_VER > 14 + +// Specialized in __tree & __hash_table for their _NodeType. +template +struct __generic_container_node_destructor; + +template class _MapOrSetSpecifics> +class _LIBCUDACXX_TEMPLATE_VIS __basic_node_handle + : public _MapOrSetSpecifics< + _NodeType, + __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>> +{ + template + friend class __tree; + template + friend class __hash_table; + friend struct _MapOrSetSpecifics< + _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>; + + typedef allocator_traits<_Alloc> __alloc_traits; + typedef typename __rebind_pointer::type + __node_pointer_type; + +public: + typedef _Alloc allocator_type; + +private: + __node_pointer_type __ptr_ = nullptr; + optional __alloc_; + + _LIBCUDACXX_INLINE_VISIBILITY + void __release_ptr() + { + __ptr_ = nullptr; + __alloc_ = _CUDA_VSTD::nullopt; + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __destroy_node_pointer() + { + if (__ptr_ != nullptr) + { + typedef typename __allocator_traits_rebind< + allocator_type, _NodeType>::type __node_alloc_type; + __node_alloc_type __alloc(*__alloc_); + __generic_container_node_destructor<_NodeType, __node_alloc_type>( + __alloc, true)(__ptr_); + __ptr_ = nullptr; + } + } + + _LIBCUDACXX_INLINE_VISIBILITY + __basic_node_handle(__node_pointer_type __ptr, + allocator_type const& __alloc) + : __ptr_(__ptr), __alloc_(__alloc) + { + } + +public: + _LIBCUDACXX_INLINE_VISIBILITY + __basic_node_handle() = default; + + _LIBCUDACXX_INLINE_VISIBILITY + __basic_node_handle(__basic_node_handle&& __other) noexcept + : __ptr_(__other.__ptr_), + __alloc_(_CUDA_VSTD::move(__other.__alloc_)) + { + __other.__ptr_ = nullptr; + __other.__alloc_ = _CUDA_VSTD::nullopt; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __basic_node_handle& operator=(__basic_node_handle&& __other) + { + _LIBCUDACXX_ASSERT( + __alloc_ == _CUDA_VSTD::nullopt || + __alloc_traits::propagate_on_container_move_assignment::value || + __alloc_ == __other.__alloc_, + "node_type with incompatible allocator passed to " + "node_type::operator=(node_type&&)"); + + __destroy_node_pointer(); + __ptr_ = __other.__ptr_; + + if (__alloc_traits::propagate_on_container_move_assignment::value || + __alloc_ == _CUDA_VSTD::nullopt) + __alloc_ = _CUDA_VSTD::move(__other.__alloc_); + + __other.__ptr_ = nullptr; + __other.__alloc_ = _CUDA_VSTD::nullopt; + + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + allocator_type get_allocator() const { return *__alloc_; } + + _LIBCUDACXX_INLINE_VISIBILITY + explicit operator bool() const { return __ptr_ != nullptr; } + + _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY + bool empty() const { return __ptr_ == nullptr; } + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(__basic_node_handle& __other) noexcept( + __alloc_traits::propagate_on_container_swap::value || + __alloc_traits::is_always_equal::value) + { + using _CUDA_VSTD::swap; + swap(__ptr_, __other.__ptr_); + if (__alloc_traits::propagate_on_container_swap::value || + __alloc_ == _CUDA_VSTD::nullopt || __other.__alloc_ == _CUDA_VSTD::nullopt) + swap(__alloc_, __other.__alloc_); + } + + _LIBCUDACXX_INLINE_VISIBILITY + friend void swap(__basic_node_handle& __a, __basic_node_handle& __b) + noexcept(noexcept(__a.swap(__b))) { __a.swap(__b); } + + _LIBCUDACXX_INLINE_VISIBILITY + ~__basic_node_handle() + { + __destroy_node_pointer(); + } +}; + +template +struct __set_node_handle_specifics +{ + typedef typename _NodeType::__node_value_type value_type; + + _LIBCUDACXX_INLINE_VISIBILITY + value_type& value() const + { + return static_cast<_Derived const*>(this)->__ptr_->__value_; + } +}; + +template +struct __map_node_handle_specifics +{ + typedef typename _NodeType::__node_value_type::key_type key_type; + typedef typename _NodeType::__node_value_type::mapped_type mapped_type; + + _LIBCUDACXX_INLINE_VISIBILITY + key_type& key() const + { + return static_cast<_Derived const*>(this)-> + __ptr_->__value_.__ref().first; + } + + _LIBCUDACXX_INLINE_VISIBILITY + mapped_type& mapped() const + { + return static_cast<_Derived const*>(this)-> + __ptr_->__value_.__ref().second; + } +}; + +template +using __set_node_handle = + __basic_node_handle< _NodeType, _Alloc, __set_node_handle_specifics>; + +template +using __map_node_handle = + __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>; + +template +struct _LIBCUDACXX_TEMPLATE_VIS __insert_return_type +{ + _Iterator position; + bool inserted; + _NodeType node; +}; + +#endif // _LIBCUDACXX_STD_VER > 14 + +_LIBCUDACXX_END_NAMESPACE_STD +_LIBCUDACXX_POP_MACROS + +#endif diff --git a/cuda_toolkit/include/__nullptr b/cuda_toolkit/include/__nullptr new file mode 100644 index 0000000000000000000000000000000000000000..93af48c9a309b4f6f4394ad61150769bb9aa09fb --- /dev/null +++ b/cuda_toolkit/include/__nullptr @@ -0,0 +1,65 @@ +// -*- C++ -*- +//===--------------------------- __nullptr --------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_NULLPTR +#define _LIBCUDACXX_NULLPTR + +#include <__config> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#ifdef _LIBCUDACXX_HAS_NO_NULLPTR + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +struct _LIBCUDACXX_TEMPLATE_VIS nullptr_t +{ + void* __lx; + + struct __nat {int __for_bool_;}; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr nullptr_t() : __lx(0) {} + _LIBCUDACXX_INLINE_VISIBILITY constexpr nullptr_t(int __nat::*) : __lx(0) {} + + _LIBCUDACXX_INLINE_VISIBILITY constexpr operator int __nat::*() const {return 0;} + + template + _LIBCUDACXX_INLINE_VISIBILITY constexpr + operator _Tp* () const {return 0;} + + template + _LIBCUDACXX_INLINE_VISIBILITY + operator _Tp _Up::* () const {return 0;} + + friend _LIBCUDACXX_INLINE_VISIBILITY constexpr bool operator==(nullptr_t, nullptr_t) {return true;} + friend _LIBCUDACXX_INLINE_VISIBILITY constexpr bool operator!=(nullptr_t, nullptr_t) {return false;} +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY constexpr nullptr_t __get_nullptr_t() {return nullptr_t(0);} + +#define nullptr _CUDA_VSTD::__get_nullptr_t() + +_LIBCUDACXX_END_NAMESPACE_STD + +#else // _LIBCUDACXX_HAS_NO_NULLPTR + +namespace std +{ + typedef decltype(nullptr) nullptr_t; +} + +#endif // _LIBCUDACXX_HAS_NO_NULLPTR + +#endif // _LIBCUDACXX_NULLPTR diff --git a/cuda_toolkit/include/__pragma_pop b/cuda_toolkit/include/__pragma_pop new file mode 100644 index 0000000000000000000000000000000000000000..27a9a68b4e602ed989631ee2b8f7383c6a79d1c7 --- /dev/null +++ b/cuda_toolkit/include/__pragma_pop @@ -0,0 +1,16 @@ +// -*- C++ -*- +//===---------------------------- chrono ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#if defined(_LIBCUDACXX_USE_PRAGMA_MSVC_WARNING) + #pragma warning(pop) +#endif + +#if defined(_LIBCUDACXX_POP_MACROS) + _LIBCUDACXX_POP_MACROS +#endif diff --git a/cuda_toolkit/include/__pragma_push b/cuda_toolkit/include/__pragma_push new file mode 100644 index 0000000000000000000000000000000000000000..9b4ee9619377e4ecd1a02eeea3af40afad5ebf0b --- /dev/null +++ b/cuda_toolkit/include/__pragma_push @@ -0,0 +1,25 @@ +// -*- C++ -*- +//===---------------------------- chrono ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifdef _LIBCUDACXX_IMPLICIT_SYSTEM_HEADER + #pragma GCC system_header +#endif + +#if defined(_LIBCUDACXX_USE_PRAGMA_MSVC_WARNING) + #pragma warning(push) + #pragma warning(disable : _LIBCUDACXX_MSVC_DISABLED_WARNINGS) +#endif + +#if defined(_LIBCUDACXX_PUSH_MACROS) + _LIBCUDACXX_PUSH_MACROS +#endif + +#ifndef __cuda_std__ +#include <__undef_macros> +#endif diff --git a/cuda_toolkit/include/__split_buffer b/cuda_toolkit/include/__split_buffer new file mode 100644 index 0000000000000000000000000000000000000000..65d00e438b7ef1b2bf46065f9b263e3103c18189 --- /dev/null +++ b/cuda_toolkit/include/__split_buffer @@ -0,0 +1,632 @@ +// -*- C++ -*- +#ifndef _LIBCUDACXX_SPLIT_BUFFER +#define _LIBCUDACXX_SPLIT_BUFFER + +#include <__config> +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template +class __split_buffer_common +{ +protected: + void __throw_length_error() const; + void __throw_out_of_range() const; +}; + +template > +struct __split_buffer + : private __split_buffer_common +{ +private: + __split_buffer(const __split_buffer&); + __split_buffer& operator=(const __split_buffer&); +public: + typedef _Tp value_type; + typedef _Allocator allocator_type; + typedef __libcpp_remove_reference_t __alloc_rr; + typedef allocator_traits<__alloc_rr> __alloc_traits; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename __alloc_traits::size_type size_type; + typedef typename __alloc_traits::difference_type difference_type; + typedef typename __alloc_traits::pointer pointer; + typedef typename __alloc_traits::const_pointer const_pointer; + typedef pointer iterator; + typedef const_pointer const_iterator; + + pointer __first_; + pointer __begin_; + pointer __end_; + __compressed_pair __end_cap_; + + typedef __add_lvalue_reference_t __alloc_ref; + typedef __add_lvalue_reference_t __alloc_const_ref; + + _LIBCUDACXX_INLINE_VISIBILITY __alloc_rr& __alloc() noexcept {return __end_cap_.second();} + _LIBCUDACXX_INLINE_VISIBILITY const __alloc_rr& __alloc() const noexcept {return __end_cap_.second();} + _LIBCUDACXX_INLINE_VISIBILITY pointer& __end_cap() noexcept {return __end_cap_.first();} + _LIBCUDACXX_INLINE_VISIBILITY const pointer& __end_cap() const noexcept {return __end_cap_.first();} + + _LIBCUDACXX_INLINE_VISIBILITY + __split_buffer() + noexcept(is_nothrow_default_constructible::value); + _LIBCUDACXX_INLINE_VISIBILITY + explicit __split_buffer(__alloc_rr& __a); + _LIBCUDACXX_INLINE_VISIBILITY + explicit __split_buffer(const __alloc_rr& __a); + __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); + ~__split_buffer(); + + __split_buffer(__split_buffer&& __c) + noexcept(is_nothrow_move_constructible::value); + __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); + __split_buffer& operator=(__split_buffer&& __c) + noexcept((__alloc_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value) || + !__alloc_traits::propagate_on_container_move_assignment::value); + + _LIBCUDACXX_INLINE_VISIBILITY iterator begin() noexcept {return __begin_;} + _LIBCUDACXX_INLINE_VISIBILITY const_iterator begin() const noexcept {return __begin_;} + _LIBCUDACXX_INLINE_VISIBILITY iterator end() noexcept {return __end_;} + _LIBCUDACXX_INLINE_VISIBILITY const_iterator end() const noexcept {return __end_;} + + _LIBCUDACXX_INLINE_VISIBILITY + void clear() noexcept + {__destruct_at_end(__begin_);} + _LIBCUDACXX_INLINE_VISIBILITY size_type size() const {return static_cast(__end_ - __begin_);} + _LIBCUDACXX_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;} + _LIBCUDACXX_INLINE_VISIBILITY size_type capacity() const {return static_cast(__end_cap() - __first_);} + _LIBCUDACXX_INLINE_VISIBILITY size_type __front_spare() const {return static_cast(__begin_ - __first_);} + _LIBCUDACXX_INLINE_VISIBILITY size_type __back_spare() const {return static_cast(__end_cap() - __end_);} + + _LIBCUDACXX_INLINE_VISIBILITY reference front() {return *__begin_;} + _LIBCUDACXX_INLINE_VISIBILITY const_reference front() const {return *__begin_;} + _LIBCUDACXX_INLINE_VISIBILITY reference back() {return *(__end_ - 1);} + _LIBCUDACXX_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);} + + void reserve(size_type __n); + void shrink_to_fit() noexcept; + void push_front(const_reference __x); + _LIBCUDACXX_INLINE_VISIBILITY void push_back(const_reference __x); + void push_front(value_type&& __x); + void push_back(value_type&& __x); + template + void emplace_back(_Args&&... __args); + + _LIBCUDACXX_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);} + _LIBCUDACXX_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);} + + void __construct_at_end(size_type __n); + void __construct_at_end(size_type __n, const_reference __x); + template + typename enable_if + < + __is_cpp17_input_iterator<_InputIter>::value && + !__is_cpp17_forward_iterator<_InputIter>::value, + void + >::type + __construct_at_end(_InputIter __first, _InputIter __last); + template + typename enable_if + < + __is_cpp17_forward_iterator<_ForwardIterator>::value, + void + >::type + __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); + + _LIBCUDACXX_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin) + {__destruct_at_begin(__new_begin, is_trivially_destructible());} + _LIBCUDACXX_INLINE_VISIBILITY + void __destruct_at_begin(pointer __new_begin, false_type); + _LIBCUDACXX_INLINE_VISIBILITY + void __destruct_at_begin(pointer __new_begin, true_type); + + _LIBCUDACXX_INLINE_VISIBILITY + void __destruct_at_end(pointer __new_last) noexcept + {__destruct_at_end(__new_last, false_type());} + _LIBCUDACXX_INLINE_VISIBILITY + void __destruct_at_end(pointer __new_last, false_type) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + void __destruct_at_end(pointer __new_last, true_type) noexcept; + + void swap(__split_buffer& __x) + noexcept(!__alloc_traits::propagate_on_container_swap::value|| + __is_nothrow_swappable<__alloc_rr>::value); + + bool __invariants() const; + +private: + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__split_buffer& __c, true_type) + noexcept(is_nothrow_move_assignable::value) + { + __alloc() = _CUDA_VSTD::move(__c.__alloc()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__split_buffer&, false_type) noexcept + {} + + struct _ConstructTransaction { + explicit _ConstructTransaction(pointer* __p, size_type __n) noexcept + : __pos_(*__p), __end_(*__p + __n), __dest_(__p) { + } + ~_ConstructTransaction() { + *__dest_ = __pos_; + } + pointer __pos_; + const pointer __end_; + private: + pointer *__dest_; + }; +}; + +template +bool +__split_buffer<_Tp, _Allocator>::__invariants() const +{ + if (__first_ == nullptr) + { + if (__begin_ != nullptr) + return false; + if (__end_ != nullptr) + return false; + if (__end_cap() != nullptr) + return false; + } + else + { + if (__begin_ < __first_) + return false; + if (__end_ < __begin_) + return false; + if (__end_cap() < __end_) + return false; + } + return true; +} + +// Default constructs __n objects starting at __end_ +// throws if construction throws +// Precondition: __n > 0 +// Precondition: size() + __n <= capacity() +// Postcondition: size() == size() + __n +template +void +__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) +{ + _ConstructTransaction __tx(&this->__end_, __n); + for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { + __alloc_traits::construct(this->__alloc(), _CUDA_VSTD::__to_raw_pointer(__tx.__pos_)); + } +} + +// Copy constructs __n objects starting at __end_ from __x +// throws if construction throws +// Precondition: __n > 0 +// Precondition: size() + __n <= capacity() +// Postcondition: size() == old size() + __n +// Postcondition: [i] == __x for all i in [size() - __n, __n) +template +void +__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) +{ + _ConstructTransaction __tx(&this->__end_, __n); + for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { + __alloc_traits::construct(this->__alloc(), + _CUDA_VSTD::__to_raw_pointer(__tx.__pos_), __x); + } +} + +template +template +typename enable_if +< + __is_cpp17_input_iterator<_InputIter>::value && + !__is_cpp17_forward_iterator<_InputIter>::value, + void +>::type +__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last) +{ + __alloc_rr& __a = this->__alloc(); + for (; __first != __last; ++__first) + { + if (__end_ == __end_cap()) + { + size_type __old_cap = __end_cap() - __first_; + size_type __new_cap = _CUDA_VSTD::max(2 * __old_cap, 8); + __split_buffer __buf(__new_cap, 0, __a); + for (pointer __p = __begin_; __p != __end_; ++__p, (void)++__buf.__end_) + __alloc_traits::construct(__buf.__alloc(), + _CUDA_VSTD::__to_raw_pointer(__buf.__end_), _CUDA_VSTD::move(*__p)); + swap(__buf); + } + __alloc_traits::construct(__a, _CUDA_VSTD::__to_raw_pointer(this->__end_), *__first); + ++this->__end_; + } +} + +template +template +typename enable_if +< + __is_cpp17_forward_iterator<_ForwardIterator>::value, + void +>::type +__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) +{ + _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last)); + for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__first) { + __alloc_traits::construct(this->__alloc(), + _CUDA_VSTD::__to_raw_pointer(__tx.__pos_), *__first); + } +} + +template +inline +void +__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) +{ + while (__begin_ != __new_begin) + __alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++)); +} + +template +inline +void +__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type) +{ + __begin_ = __new_begin; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) noexcept +{ + while (__new_last != __end_) + __alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) noexcept +{ + __end_ = __new_last; +} + +template +__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a) + : __end_cap_(nullptr, __a) +{ + __first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr; + __begin_ = __end_ = __first_ + __start; + __end_cap() = __first_ + __cap; +} + +template +inline +__split_buffer<_Tp, _Allocator>::__split_buffer() + noexcept(is_nothrow_default_constructible::value) + : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr) +{ +} + +template +inline +__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a) + : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) +{ +} + +template +inline +__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a) + : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) +{ +} + +template +__split_buffer<_Tp, _Allocator>::~__split_buffer() +{ + clear(); + if (__first_) + __alloc_traits::deallocate(__alloc(), __first_, capacity()); +} + +template +__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) + noexcept(is_nothrow_move_constructible::value) + : __first_(_CUDA_VSTD::move(__c.__first_)), + __begin_(_CUDA_VSTD::move(__c.__begin_)), + __end_(_CUDA_VSTD::move(__c.__end_)), + __end_cap_(_CUDA_VSTD::move(__c.__end_cap_)) +{ + __c.__first_ = nullptr; + __c.__begin_ = nullptr; + __c.__end_ = nullptr; + __c.__end_cap() = nullptr; +} + +template +__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a) + : __end_cap_(__second_tag(), __a) +{ + if (__a == __c.__alloc()) + { + __first_ = __c.__first_; + __begin_ = __c.__begin_; + __end_ = __c.__end_; + __end_cap() = __c.__end_cap(); + __c.__first_ = nullptr; + __c.__begin_ = nullptr; + __c.__end_ = nullptr; + __c.__end_cap() = nullptr; + } + else + { + size_type __cap = __c.size(); + __first_ = __alloc_traits::allocate(__alloc(), __cap); + __begin_ = __end_ = __first_; + __end_cap() = __first_ + __cap; + typedef move_iterator _Ip; + __construct_at_end(_Ip(__c.begin()), _Ip(__c.end())); + } +} + +template +__split_buffer<_Tp, _Allocator>& +__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) + noexcept((__alloc_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value) || + !__alloc_traits::propagate_on_container_move_assignment::value) +{ + clear(); + shrink_to_fit(); + __first_ = __c.__first_; + __begin_ = __c.__begin_; + __end_ = __c.__end_; + __end_cap() = __c.__end_cap(); + __move_assign_alloc(__c, + integral_constant()); + __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr; + return *this; +} + +template +void +__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x) + noexcept(!__alloc_traits::propagate_on_container_swap::value|| + __is_nothrow_swappable<__alloc_rr>::value) +{ + _CUDA_VSTD::swap(__first_, __x.__first_); + _CUDA_VSTD::swap(__begin_, __x.__begin_); + _CUDA_VSTD::swap(__end_, __x.__end_); + _CUDA_VSTD::swap(__end_cap(), __x.__end_cap()); + __swap_allocator(__alloc(), __x.__alloc()); +} + +template +void +__split_buffer<_Tp, _Allocator>::reserve(size_type __n) +{ + if (__n < capacity()) + { + __split_buffer __t(__n, 0, __alloc()); + __t.__construct_at_end(move_iterator(__begin_), + move_iterator(__end_)); + _CUDA_VSTD::swap(__first_, __t.__first_); + _CUDA_VSTD::swap(__begin_, __t.__begin_); + _CUDA_VSTD::swap(__end_, __t.__end_); + _CUDA_VSTD::swap(__end_cap(), __t.__end_cap()); + } +} + +template +void +__split_buffer<_Tp, _Allocator>::shrink_to_fit() noexcept +{ + if (capacity() > size()) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __split_buffer __t(size(), 0, __alloc()); + __t.__construct_at_end(move_iterator(__begin_), + move_iterator(__end_)); + __t.__end_ = __t.__begin_ + (__end_ - __begin_); + _CUDA_VSTD::swap(__first_, __t.__first_); + _CUDA_VSTD::swap(__begin_, __t.__begin_); + _CUDA_VSTD::swap(__end_, __t.__end_); + _CUDA_VSTD::swap(__end_cap(), __t.__end_cap()); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + } +} + +template +void +__split_buffer<_Tp, _Allocator>::push_front(const_reference __x) +{ + if (__begin_ == __first_) + { + if (__end_ < __end_cap()) + { + difference_type __d = __end_cap() - __end_; + __d = (__d + 1) / 2; + __begin_ = _CUDA_VSTD::move_backward(__begin_, __end_, __end_ + __d); + __end_ += __d; + } + else + { + size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); + __split_buffer __t(__c, (__c + 3) / 4, __alloc()); + __t.__construct_at_end(move_iterator(__begin_), + move_iterator(__end_)); + _CUDA_VSTD::swap(__first_, __t.__first_); + _CUDA_VSTD::swap(__begin_, __t.__begin_); + _CUDA_VSTD::swap(__end_, __t.__end_); + _CUDA_VSTD::swap(__end_cap(), __t.__end_cap()); + } + } + __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__begin_-1), __x); + --__begin_; +} + +template +void +__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) +{ + if (__begin_ == __first_) + { + if (__end_ < __end_cap()) + { + difference_type __d = __end_cap() - __end_; + __d = (__d + 1) / 2; + __begin_ = _CUDA_VSTD::move_backward(__begin_, __end_, __end_ + __d); + __end_ += __d; + } + else + { + size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); + __split_buffer __t(__c, (__c + 3) / 4, __alloc()); + __t.__construct_at_end(move_iterator(__begin_), + move_iterator(__end_)); + _CUDA_VSTD::swap(__first_, __t.__first_); + _CUDA_VSTD::swap(__begin_, __t.__begin_); + _CUDA_VSTD::swap(__end_, __t.__end_); + _CUDA_VSTD::swap(__end_cap(), __t.__end_cap()); + } + } + __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__begin_-1), + _CUDA_VSTD::move(__x)); + --__begin_; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +__split_buffer<_Tp, _Allocator>::push_back(const_reference __x) +{ + if (__end_ == __end_cap()) + { + if (__begin_ > __first_) + { + difference_type __d = __begin_ - __first_; + __d = (__d + 1) / 2; + __end_ = _CUDA_VSTD::move(__begin_, __end_, __begin_ - __d); + __begin_ -= __d; + } + else + { + size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); + __split_buffer __t(__c, __c / 4, __alloc()); + __t.__construct_at_end(move_iterator(__begin_), + move_iterator(__end_)); + _CUDA_VSTD::swap(__first_, __t.__first_); + _CUDA_VSTD::swap(__begin_, __t.__begin_); + _CUDA_VSTD::swap(__end_, __t.__end_); + _CUDA_VSTD::swap(__end_cap(), __t.__end_cap()); + } + } + __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__end_), __x); + ++__end_; +} + +template +void +__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) +{ + if (__end_ == __end_cap()) + { + if (__begin_ > __first_) + { + difference_type __d = __begin_ - __first_; + __d = (__d + 1) / 2; + __end_ = _CUDA_VSTD::move(__begin_, __end_, __begin_ - __d); + __begin_ -= __d; + } + else + { + size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); + __split_buffer __t(__c, __c / 4, __alloc()); + __t.__construct_at_end(move_iterator(__begin_), + move_iterator(__end_)); + _CUDA_VSTD::swap(__first_, __t.__first_); + _CUDA_VSTD::swap(__begin_, __t.__begin_); + _CUDA_VSTD::swap(__end_, __t.__end_); + _CUDA_VSTD::swap(__end_cap(), __t.__end_cap()); + } + } + __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__end_), + _CUDA_VSTD::move(__x)); + ++__end_; +} + +template +template +void +__split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) +{ + if (__end_ == __end_cap()) + { + if (__begin_ > __first_) + { + difference_type __d = __begin_ - __first_; + __d = (__d + 1) / 2; + __end_ = _CUDA_VSTD::move(__begin_, __end_, __begin_ - __d); + __begin_ -= __d; + } + else + { + size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); + __split_buffer __t(__c, __c / 4, __alloc()); + __t.__construct_at_end(move_iterator(__begin_), + move_iterator(__end_)); + _CUDA_VSTD::swap(__first_, __t.__first_); + _CUDA_VSTD::swap(__begin_, __t.__begin_); + _CUDA_VSTD::swap(__end_, __t.__end_); + _CUDA_VSTD::swap(__end_cap(), __t.__end_cap()); + } + } + __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__end_), + _CUDA_VSTD::forward<_Args>(__args)...); + ++__end_; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y) + noexcept(noexcept(__x.swap(__y))) +{ + __x.swap(__y); +} + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX_SPLIT_BUFFER diff --git a/cuda_toolkit/include/__sso_allocator b/cuda_toolkit/include/__sso_allocator new file mode 100644 index 0000000000000000000000000000000000000000..db18209baf9740448f7b03edac4d2c4e5894d23d --- /dev/null +++ b/cuda_toolkit/include/__sso_allocator @@ -0,0 +1,80 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___SSO_ALLOCATOR +#define _LIBCUDACXX___SSO_ALLOCATOR + +#include <__config> +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template class _LIBCUDACXX_HIDDEN __sso_allocator; + +template +class _LIBCUDACXX_HIDDEN __sso_allocator +{ +public: + typedef const void* const_pointer; + typedef void value_type; +}; + +template +class _LIBCUDACXX_HIDDEN __sso_allocator +{ + typename aligned_storage::type buf_; + bool __allocated_; +public: + typedef size_t size_type; + typedef _Tp* pointer; + typedef _Tp value_type; + + _LIBCUDACXX_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {} + _LIBCUDACXX_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {} + template _LIBCUDACXX_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw() + : __allocated_(false) {} +private: + __sso_allocator& operator=(const __sso_allocator&); +public: + _LIBCUDACXX_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator::const_pointer = 0) + { + if (!__allocated_ && __n <= _Np) + { + __allocated_ = true; + return (pointer)&buf_; + } + return static_cast(_CUDA_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp))); + } + _LIBCUDACXX_INLINE_VISIBILITY void deallocate(pointer __p, size_type __n) + { + if (__p == (pointer)&buf_) + __allocated_ = false; + else + _CUDA_VSTD::__libcpp_deallocate(__p, __n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp)); + } + _LIBCUDACXX_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);} + + _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;} + _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;} +}; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX___SSO_ALLOCATOR diff --git a/cuda_toolkit/include/__std_stream b/cuda_toolkit/include/__std_stream new file mode 100644 index 0000000000000000000000000000000000000000..10239250ed526705bf6776f9714855bfd95f732d --- /dev/null +++ b/cuda_toolkit/include/__std_stream @@ -0,0 +1,365 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___STD_STREAM +#define _LIBCUDACXX___STD_STREAM + +#include <__config> +#include +#include +#include <__locale> +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +static const int __limit = 8; + +// __stdinbuf + +template +class _LIBCUDACXX_HIDDEN __stdinbuf + : public basic_streambuf<_CharT, char_traits<_CharT> > +{ +public: + typedef _CharT char_type; + typedef char_traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + typedef typename traits_type::state_type state_type; + + __stdinbuf(FILE* __fp, state_type* __st); + +protected: + virtual int_type underflow(); + virtual int_type uflow(); + virtual int_type pbackfail(int_type __c = traits_type::eof()); + virtual void imbue(const locale& __loc); + +private: + + FILE* __file_; + const codecvt* __cv_; + state_type* __st_; + int __encoding_; + int_type __last_consumed_; + bool __last_consumed_is_next_; + bool __always_noconv_; + + __stdinbuf(const __stdinbuf&); + __stdinbuf& operator=(const __stdinbuf&); + + int_type __getchar(bool __consume); +}; + +template +__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st) + : __file_(__fp), + __st_(__st), + __last_consumed_(traits_type::eof()), + __last_consumed_is_next_(false) +{ + imbue(this->getloc()); +} + +template +void +__stdinbuf<_CharT>::imbue(const locale& __loc) +{ + __cv_ = &use_facet >(__loc); + __encoding_ = __cv_->encoding(); + __always_noconv_ = __cv_->always_noconv(); + if (__encoding_ > __limit) + __throw_runtime_error("unsupported locale for standard input"); +} + +template +typename __stdinbuf<_CharT>::int_type +__stdinbuf<_CharT>::underflow() +{ + return __getchar(false); +} + +template +typename __stdinbuf<_CharT>::int_type +__stdinbuf<_CharT>::uflow() +{ + return __getchar(true); +} + +template +typename __stdinbuf<_CharT>::int_type +__stdinbuf<_CharT>::__getchar(bool __consume) +{ + if (__last_consumed_is_next_) + { + int_type __result = __last_consumed_; + if (__consume) + { + __last_consumed_ = traits_type::eof(); + __last_consumed_is_next_ = false; + } + return __result; + } + char __extbuf[__limit]; + int __nread = _CUDA_VSTD::max(1, __encoding_); + for (int __i = 0; __i < __nread; ++__i) + { + int __c = getc(__file_); + if (__c == EOF) + return traits_type::eof(); + __extbuf[__i] = static_cast(__c); + } + char_type __1buf; + if (__always_noconv_) + __1buf = static_cast(__extbuf[0]); + else + { + const char* __enxt; + char_type* __inxt; + codecvt_base::result __r; + do + { + state_type __sv_st = *__st_; + __r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt, + &__1buf, &__1buf + 1, __inxt); + switch (__r) + { + case _CUDA_VSTD::codecvt_base::ok: + break; + case codecvt_base::partial: + *__st_ = __sv_st; + if (__nread == sizeof(__extbuf)) + return traits_type::eof(); + { + int __c = getc(__file_); + if (__c == EOF) + return traits_type::eof(); + __extbuf[__nread] = static_cast(__c); + } + ++__nread; + break; + case codecvt_base::error: + return traits_type::eof(); + case _CUDA_VSTD::codecvt_base::noconv: + __1buf = static_cast(__extbuf[0]); + break; + } + } while (__r == _CUDA_VSTD::codecvt_base::partial); + } + if (!__consume) + { + for (int __i = __nread; __i > 0;) + { + if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF) + return traits_type::eof(); + } + } + else + __last_consumed_ = traits_type::to_int_type(__1buf); + return traits_type::to_int_type(__1buf); +} + +template +typename __stdinbuf<_CharT>::int_type +__stdinbuf<_CharT>::pbackfail(int_type __c) +{ + if (traits_type::eq_int_type(__c, traits_type::eof())) + { + if (!__last_consumed_is_next_) + { + __c = __last_consumed_; + __last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_, + traits_type::eof()); + } + return __c; + } + if (__last_consumed_is_next_) + { + char __extbuf[__limit]; + char* __enxt; + const char_type __ci = traits_type::to_char_type(__last_consumed_); + const char_type* __inxt; + switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt, + __extbuf, __extbuf + sizeof(__extbuf), __enxt)) + { + case _CUDA_VSTD::codecvt_base::ok: + break; + case _CUDA_VSTD::codecvt_base::noconv: + __extbuf[0] = static_cast(__last_consumed_); + __enxt = __extbuf + 1; + break; + case codecvt_base::partial: + case codecvt_base::error: + return traits_type::eof(); + } + while (__enxt > __extbuf) + if (ungetc(*--__enxt, __file_) == EOF) + return traits_type::eof(); + } + __last_consumed_ = __c; + __last_consumed_is_next_ = true; + return __c; +} + +// __stdoutbuf + +template +class _LIBCUDACXX_HIDDEN __stdoutbuf + : public basic_streambuf<_CharT, char_traits<_CharT> > +{ +public: + typedef _CharT char_type; + typedef char_traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + typedef typename traits_type::state_type state_type; + + __stdoutbuf(FILE* __fp, state_type* __st); + +protected: + virtual int_type overflow (int_type __c = traits_type::eof()); + virtual streamsize xsputn(const char_type* __s, streamsize __n); + virtual int sync(); + virtual void imbue(const locale& __loc); + +private: + FILE* __file_; + const codecvt* __cv_; + state_type* __st_; + bool __always_noconv_; + + __stdoutbuf(const __stdoutbuf&); + __stdoutbuf& operator=(const __stdoutbuf&); +}; + +template +__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st) + : __file_(__fp), + __cv_(&use_facet >(this->getloc())), + __st_(__st), + __always_noconv_(__cv_->always_noconv()) +{ +} + +template +typename __stdoutbuf<_CharT>::int_type +__stdoutbuf<_CharT>::overflow(int_type __c) +{ + char __extbuf[__limit]; + char_type __1buf; + if (!traits_type::eq_int_type(__c, traits_type::eof())) + { + __1buf = traits_type::to_char_type(__c); + if (__always_noconv_) + { + if (fwrite(&__1buf, sizeof(char_type), 1, __file_) != 1) + return traits_type::eof(); + } + else + { + char* __extbe = __extbuf; + codecvt_base::result __r; + char_type* pbase = &__1buf; + char_type* pptr = pbase + 1; + do + { + const char_type* __e; + __r = __cv_->out(*__st_, pbase, pptr, __e, + __extbuf, + __extbuf + sizeof(__extbuf), + __extbe); + if (__e == pbase) + return traits_type::eof(); + if (__r == codecvt_base::noconv) + { + if (fwrite(pbase, 1, 1, __file_) != 1) + return traits_type::eof(); + } + else if (__r == codecvt_base::ok || __r == codecvt_base::partial) + { + size_t __nmemb = static_cast(__extbe - __extbuf); + if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb) + return traits_type::eof(); + if (__r == codecvt_base::partial) + { + pbase = const_cast(__e); + } + } + else + return traits_type::eof(); + } while (__r == codecvt_base::partial); + } + } + return traits_type::not_eof(__c); +} + +template +streamsize +__stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n) +{ + if (__always_noconv_) + return fwrite(__s, sizeof(char_type), __n, __file_); + streamsize __i = 0; + for (; __i < __n; ++__i, ++__s) + if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof()) + break; + return __i; +} + +template +int +__stdoutbuf<_CharT>::sync() +{ + char __extbuf[__limit]; + codecvt_base::result __r; + do + { + char* __extbe; + __r = __cv_->unshift(*__st_, __extbuf, + __extbuf + sizeof(__extbuf), + __extbe); + size_t __nmemb = static_cast(__extbe - __extbuf); + if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb) + return -1; + } while (__r == codecvt_base::partial); + if (__r == codecvt_base::error) + return -1; + if (fflush(__file_)) + return -1; + return 0; +} + +template +void +__stdoutbuf<_CharT>::imbue(const locale& __loc) +{ + sync(); + __cv_ = &use_facet >(__loc); + __always_noconv_ = __cv_->always_noconv(); +} + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX___STD_STREAM diff --git a/cuda_toolkit/include/__string b/cuda_toolkit/include/__string new file mode 100644 index 0000000000000000000000000000000000000000..474d5809ad1dfa09ebfce066995d832bf6128b62 --- /dev/null +++ b/cuda_toolkit/include/__string @@ -0,0 +1,990 @@ +// -*- C++ -*- +//===-------------------------- __string ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___STRING +#define _LIBCUDACXX___STRING + +/* + string synopsis + +namespace std +{ + +template +struct char_traits +{ + typedef charT char_type; + typedef ... int_type; + typedef streamoff off_type; + typedef streampos pos_type; + typedef mbstate_t state_type; + + static constexpr void assign(char_type& c1, const char_type& c2) noexcept; + static constexpr bool eq(char_type c1, char_type c2) noexcept; + static constexpr bool lt(char_type c1, char_type c2) noexcept; + + static constexpr int compare(const char_type* s1, const char_type* s2, size_t n); + static constexpr size_t length(const char_type* s); + static constexpr const char_type* + find(const char_type* s, size_t n, const char_type& a); + static char_type* move(char_type* s1, const char_type* s2, size_t n); + static char_type* copy(char_type* s1, const char_type* s2, size_t n); + static char_type* assign(char_type* s, size_t n, char_type a); + + static constexpr int_type not_eof(int_type c) noexcept; + static constexpr char_type to_char_type(int_type c) noexcept; + static constexpr int_type to_int_type(char_type c) noexcept; + static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept; + static constexpr int_type eof() noexcept; +}; + +template <> struct char_traits; +template <> struct char_traits; +template <> struct char_traits; // c++20 + +} // std + +*/ + +#include <__config> +#include // for search and min +#include // For EOF. +#include // for __murmur2_or_cityhash + +#include "__assert" // all public C++ headers provide the assertion handler +#include <__debug> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + +#include "__fwd/string.h" + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +// char_traits + +template +struct _LIBCUDACXX_TEMPLATE_VIS char_traits +{ + typedef _CharT char_type; + typedef int int_type; + typedef streamoff off_type; + typedef streampos pos_type; + typedef mbstate_t state_type; + + static inline void _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} + static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept + {return __c1 < __c2;} + + static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + int compare(const char_type* __s1, const char_type* __s2, size_t __n); + _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + size_t length(const char_type* __s); + _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const char_type* find(const char_type* __s, size_t __n, const char_type& __a); + static char_type* move(char_type* __s1, const char_type* __s2, size_t __n); + _LIBCUDACXX_INLINE_VISIBILITY + static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); + _LIBCUDACXX_INLINE_VISIBILITY + static char_type* assign(char_type* __s, size_t __n, char_type __a); + + static inline constexpr int_type not_eof(int_type __c) noexcept + {return eq_int_type(__c, eof()) ? ~eof() : __c;} + static inline constexpr char_type to_char_type(int_type __c) noexcept + {return char_type(__c);} + static inline constexpr int_type to_int_type(char_type __c) noexcept + {return int_type(__c);} + static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr int_type eof() noexcept + {return int_type(EOF);} +}; + +template +_LIBCUDACXX_CONSTEXPR_AFTER_CXX14 int +char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n) +{ + for (; __n; --__n, ++__s1, ++__s2) + { + if (lt(*__s1, *__s2)) + return -1; + if (lt(*__s2, *__s1)) + return 1; + } + return 0; +} + +template +inline +_LIBCUDACXX_CONSTEXPR_AFTER_CXX14 size_t +char_traits<_CharT>::length(const char_type* __s) +{ + size_t __len = 0; + for (; !eq(*__s, char_type(0)); ++__s) + ++__len; + return __len; +} + +template +inline +_LIBCUDACXX_CONSTEXPR_AFTER_CXX14 const _CharT* +char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a) +{ + for (; __n; --__n) + { + if (eq(*__s, __a)) + return __s; + ++__s; + } + return 0; +} + +template +_CharT* +char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) +{ + char_type* __r = __s1; + if (__s1 < __s2) + { + for (; __n; --__n, ++__s1, ++__s2) + assign(*__s1, *__s2); + } + else if (__s2 < __s1) + { + __s1 += __n; + __s2 += __n; + for (; __n; --__n) + assign(*--__s1, *--__s2); + } + return __r; +} + +template +inline +_CharT* +char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) +{ + _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + char_type* __r = __s1; + for (; __n; --__n, ++__s1, ++__s2) + assign(*__s1, *__s2); + return __r; +} + +template +inline +_CharT* +char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) +{ + char_type* __r = __s; + for (; __n; --__n, ++__s) + assign(*__s, __a); + return __r; +} + +// char_traits + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS char_traits +{ + typedef char char_type; + typedef int int_type; + typedef streamoff off_type; + typedef streampos pos_type; + typedef mbstate_t state_type; + + static inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} + static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept + {return (unsigned char)__c1 < (unsigned char)__c2;} + + static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept; + static inline size_t _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + length(const char_type* __s) noexcept {return __builtin_strlen(__s);} + static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept; + static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept + {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);} + static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept + { + _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); + } + static inline char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept + {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);} + + static inline constexpr int_type not_eof(int_type __c) noexcept + {return eq_int_type(__c, eof()) ? ~eof() : __c;} + static inline constexpr char_type to_char_type(int_type __c) noexcept + {return char_type(__c);} + static inline constexpr int_type to_int_type(char_type __c) noexcept + {return int_type((unsigned char)__c);} + static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr int_type eof() noexcept + {return int_type(EOF);} +}; + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +int +char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept +{ + if (__n == 0) + return 0; +#if __has_feature(cxx_constexpr_string_builtins) + return __builtin_memcmp(__s1, __s2, __n); +#elif _LIBCUDACXX_STD_VER <= 14 + return memcmp(__s1, __s2, __n); +#else + for (; __n; --__n, ++__s1, ++__s2) + { + if (lt(*__s1, *__s2)) + return -1; + if (lt(*__s2, *__s1)) + return 1; + } + return 0; +#endif +} + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +const char* +char_traits::find(const char_type* __s, size_t __n, const char_type& __a) noexcept +{ + if (__n == 0) + return nullptr; +#if __has_feature(cxx_constexpr_string_builtins) + return __builtin_char_memchr(__s, to_int_type(__a), __n); +#elif _LIBCUDACXX_STD_VER <= 14 + return (const char_type*) memchr(__s, to_int_type(__a), __n); +#else + for (; __n; --__n) + { + if (eq(*__s, __a)) + return __s; + ++__s; + } + return nullptr; +#endif +} + + +// char_traits + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS char_traits +{ + typedef wchar_t char_type; + typedef wint_t int_type; + typedef streamoff off_type; + typedef streampos pos_type; + typedef mbstate_t state_type; + + static inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} + static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept + {return __c1 < __c2;} + + static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept; + static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + size_t length(const char_type* __s) noexcept; + static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept; + static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept + {return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);} + static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept + { + _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + return __n == 0 ? __s1 : (char_type*)wmemcpy(__s1, __s2, __n); + } + static inline char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept + {return __n == 0 ? __s : (char_type*)wmemset(__s, __a, __n);} + + static inline constexpr int_type not_eof(int_type __c) noexcept + {return eq_int_type(__c, eof()) ? ~eof() : __c;} + static inline constexpr char_type to_char_type(int_type __c) noexcept + {return char_type(__c);} + static inline constexpr int_type to_int_type(char_type __c) noexcept + {return int_type(__c);} + static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr int_type eof() noexcept + {return int_type(WEOF);} +}; + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +int +char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept +{ + if (__n == 0) + return 0; +#if __has_feature(cxx_constexpr_string_builtins) + return __builtin_wmemcmp(__s1, __s2, __n); +#elif _LIBCUDACXX_STD_VER <= 14 + return wmemcmp(__s1, __s2, __n); +#else + for (; __n; --__n, ++__s1, ++__s2) + { + if (lt(*__s1, *__s2)) + return -1; + if (lt(*__s2, *__s1)) + return 1; + } + return 0; +#endif +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr size_t __char_traits_length_checked(const typename _Traits::char_type* __s) noexcept { +#if _LIBCUDACXX_DEBUG_LEVEL >= 1 + return __s ? _Traits::length(__s) : (_CUDA_VSTD::__libcpp_debug_function(_CUDA_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0); +#else + return _Traits::length(__s); +#endif +} + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +size_t +char_traits::length(const char_type* __s) noexcept +{ +#if __has_feature(cxx_constexpr_string_builtins) + return __builtin_wcslen(__s); +#elif _LIBCUDACXX_STD_VER <= 14 + return wcslen(__s); +#else + size_t __len = 0; + for (; !eq(*__s, char_type(0)); ++__s) + ++__len; + return __len; +#endif +} + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +const wchar_t* +char_traits::find(const char_type* __s, size_t __n, const char_type& __a) noexcept +{ + if (__n == 0) + return nullptr; +#if __has_feature(cxx_constexpr_string_builtins) + return __builtin_wmemchr(__s, __a, __n); +#elif _LIBCUDACXX_STD_VER <= 14 + return wmemchr(__s, __a, __n); +#else + for (; __n; --__n) + { + if (eq(*__s, __a)) + return __s; + ++__s; + } + return nullptr; +#endif +} + + +#ifndef _LIBCUDACXX_NO_HAS_CHAR8_T + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS char_traits +{ + typedef char8_t char_type; + typedef unsigned int int_type; + typedef streamoff off_type; + typedef u8streampos pos_type; + typedef mbstate_t state_type; + + static inline constexpr void assign(char_type& __c1, const char_type& __c2) noexcept + {__c1 = __c2;} + static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept + {return __c1 < __c2;} + + static constexpr + int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept; + + static constexpr + size_t length(const char_type* __s) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY static constexpr + const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept; + + static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept + {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);} + + static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept + { + _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); + } + + static char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept + {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);} + + static inline constexpr int_type not_eof(int_type __c) noexcept + {return eq_int_type(__c, eof()) ? ~eof() : __c;} + static inline constexpr char_type to_char_type(int_type __c) noexcept + {return char_type(__c);} + static inline constexpr int_type to_int_type(char_type __c) noexcept + {return int_type(__c);} + static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr int_type eof() noexcept + {return int_type(EOF);} +}; + +// TODO use '__builtin_strlen' if it ever supports char8_t ?? +inline constexpr +size_t +char_traits::length(const char_type* __s) noexcept +{ + size_t __len = 0; + for (; !eq(*__s, char_type(0)); ++__s) + ++__len; + return __len; +} + +inline constexpr +int +char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept +{ +#if __has_feature(cxx_constexpr_string_builtins) + return __builtin_memcmp(__s1, __s2, __n); +#else + for (; __n; --__n, ++__s1, ++__s2) + { + if (lt(*__s1, *__s2)) + return -1; + if (lt(*__s2, *__s1)) + return 1; + } + return 0; +#endif +} + +// TODO use '__builtin_char_memchr' if it ever supports char8_t ?? +inline constexpr +const char8_t* +char_traits::find(const char_type* __s, size_t __n, const char_type& __a) noexcept +{ + for (; __n; --__n) + { + if (eq(*__s, __a)) + return __s; + ++__s; + } + return 0; +} + +#endif // #_LIBCUDACXX_NO_HAS_CHAR8_T + +#ifndef _LIBCUDACXX_HAS_NO_UNICODE_CHARS + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS char_traits +{ + typedef char16_t char_type; + typedef uint_least16_t int_type; + typedef streamoff off_type; + typedef u16streampos pos_type; + typedef mbstate_t state_type; + + static inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} + static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept + {return __c1 < __c2;} + + _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + size_t length(const char_type* __s) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + static char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept; + + static inline constexpr int_type not_eof(int_type __c) noexcept + {return eq_int_type(__c, eof()) ? ~eof() : __c;} + static inline constexpr char_type to_char_type(int_type __c) noexcept + {return char_type(__c);} + static inline constexpr int_type to_int_type(char_type __c) noexcept + {return int_type(__c);} + static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr int_type eof() noexcept + {return int_type(0xFFFF);} +}; + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +int +char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept +{ + for (; __n; --__n, ++__s1, ++__s2) + { + if (lt(*__s1, *__s2)) + return -1; + if (lt(*__s2, *__s1)) + return 1; + } + return 0; +} + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +size_t +char_traits::length(const char_type* __s) noexcept +{ + size_t __len = 0; + for (; !eq(*__s, char_type(0)); ++__s) + ++__len; + return __len; +} + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +const char16_t* +char_traits::find(const char_type* __s, size_t __n, const char_type& __a) noexcept +{ + for (; __n; --__n) + { + if (eq(*__s, __a)) + return __s; + ++__s; + } + return 0; +} + +inline +char16_t* +char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) noexcept +{ + char_type* __r = __s1; + if (__s1 < __s2) + { + for (; __n; --__n, ++__s1, ++__s2) + assign(*__s1, *__s2); + } + else if (__s2 < __s1) + { + __s1 += __n; + __s2 += __n; + for (; __n; --__n) + assign(*--__s1, *--__s2); + } + return __r; +} + +inline +char16_t* +char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept +{ + _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + char_type* __r = __s1; + for (; __n; --__n, ++__s1, ++__s2) + assign(*__s1, *__s2); + return __r; +} + +inline +char16_t* +char_traits::assign(char_type* __s, size_t __n, char_type __a) noexcept +{ + char_type* __r = __s; + for (; __n; --__n, ++__s) + assign(*__s, __a); + return __r; +} + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS char_traits +{ + typedef char32_t char_type; + typedef uint_least32_t int_type; + typedef streamoff off_type; + typedef u32streampos pos_type; + typedef mbstate_t state_type; + + static inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} + static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept + {return __c1 < __c2;} + + _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + size_t length(const char_type* __s) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + static char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept; + + static inline constexpr int_type not_eof(int_type __c) noexcept + {return eq_int_type(__c, eof()) ? ~eof() : __c;} + static inline constexpr char_type to_char_type(int_type __c) noexcept + {return char_type(__c);} + static inline constexpr int_type to_int_type(char_type __c) noexcept + {return int_type(__c);} + static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept + {return __c1 == __c2;} + static inline constexpr int_type eof() noexcept + {return int_type(0xFFFFFFFF);} +}; + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +int +char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept +{ + for (; __n; --__n, ++__s1, ++__s2) + { + if (lt(*__s1, *__s2)) + return -1; + if (lt(*__s2, *__s1)) + return 1; + } + return 0; +} + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +size_t +char_traits::length(const char_type* __s) noexcept +{ + size_t __len = 0; + for (; !eq(*__s, char_type(0)); ++__s) + ++__len; + return __len; +} + +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +const char32_t* +char_traits::find(const char_type* __s, size_t __n, const char_type& __a) noexcept +{ + for (; __n; --__n) + { + if (eq(*__s, __a)) + return __s; + ++__s; + } + return 0; +} + +inline +char32_t* +char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) noexcept +{ + char_type* __r = __s1; + if (__s1 < __s2) + { + for (; __n; --__n, ++__s1, ++__s2) + assign(*__s1, *__s2); + } + else if (__s2 < __s1) + { + __s1 += __n; + __s2 += __n; + for (; __n; --__n) + assign(*--__s1, *--__s2); + } + return __r; +} + +inline +char32_t* +char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept +{ + _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + char_type* __r = __s1; + for (; __n; --__n, ++__s1, ++__s2) + assign(*__s1, *__s2); + return __r; +} + +inline +char32_t* +char_traits::assign(char_type* __s, size_t __n, char_type __a) noexcept +{ + char_type* __r = __s; + for (; __n; --__n, ++__s) + assign(*__s, __a); + return __r; +} + +#endif // _LIBCUDACXX_HAS_NO_UNICODE_CHARS + +// helper fns for basic_string and string_view + +// __str_find +template +inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY +__str_find(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) noexcept +{ + if (__pos >= __sz) + return __npos; + const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c); + if (__r == 0) + return __npos; + return static_cast<_SizeT>(__r - __p); +} + +template +inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 const _CharT * +__search_substring(const _CharT *__first1, const _CharT *__last1, + const _CharT *__first2, const _CharT *__last2) { + // Take advantage of knowing source and pattern lengths. + // Stop short when source is smaller than pattern. + const ptrdiff_t __len2 = __last2 - __first2; + if (__len2 == 0) + return __first1; + + ptrdiff_t __len1 = __last1 - __first1; + if (__len1 < __len2) + return __last1; + + // First element of __first2 is loop invariant. + _CharT __f2 = *__first2; + while (true) { + __len1 = __last1 - __first1; + // Check whether __first1 still has at least __len2 bytes. + if (__len1 < __len2) + return __last1; + + // Find __f2 the first byte matching in __first1. + __first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2); + if (__first1 == 0) + return __last1; + + // It is faster to compare from the first byte of __first1 even if we + // already know that it matches the first byte of __first2: this is because + // __first2 is most likely aligned, as it is user's "pattern" string, and + // __first1 + 1 is most likely not aligned, as the match is in the middle of + // the string. + if (_Traits::compare(__first1, __first2, __len2) == 0) + return __first1; + + ++__first1; + } +} + +template +inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY +__str_find(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept +{ + if (__pos > __sz) + return __npos; + + if (__n == 0) // There is nothing to search, just return __pos. + return __pos; + + const _CharT *__r = __search_substring<_CharT, _Traits>( + __p + __pos, __p + __sz, __s, __s + __n); + + if (__r == __p + __sz) + return __npos; + return static_cast<_SizeT>(__r - __p); +} + + +// __str_rfind + +template +inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY +__str_rfind(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) noexcept +{ + if (__sz < 1) + return __npos; + if (__pos < __sz) + ++__pos; + else + __pos = __sz; + for (const _CharT* __ps = __p + __pos; __ps != __p;) + { + if (_Traits::eq(*--__ps, __c)) + return static_cast<_SizeT>(__ps - __p); + } + return __npos; +} + +template +inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY +__str_rfind(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept +{ + __pos = _CUDA_VSTD::min(__pos, __sz); + if (__n < __sz - __pos) + __pos += __n; + else + __pos = __sz; + const _CharT* __r = _CUDA_VSTD::__find_end( + __p, __p + __pos, __s, __s + __n, _Traits::eq, + random_access_iterator_tag(), random_access_iterator_tag()); + if (__n > 0 && __r == __p + __pos) + return __npos; + return static_cast<_SizeT>(__r - __p); +} + +// __str_find_first_of +template +inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY +__str_find_first_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept +{ + if (__pos >= __sz || __n == 0) + return __npos; + const _CharT* __r = _CUDA_VSTD::__find_first_of_ce + (__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq ); + if (__r == __p + __sz) + return __npos; + return static_cast<_SizeT>(__r - __p); +} + + +// __str_find_last_of +template +inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY +__str_find_last_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept + { + if (__n != 0) + { + if (__pos < __sz) + ++__pos; + else + __pos = __sz; + for (const _CharT* __ps = __p + __pos; __ps != __p;) + { + const _CharT* __r = _Traits::find(__s, __n, *--__ps); + if (__r) + return static_cast<_SizeT>(__ps - __p); + } + } + return __npos; +} + + +// __str_find_first_not_of +template +inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY +__str_find_first_not_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept +{ + if (__pos < __sz) + { + const _CharT* __pe = __p + __sz; + for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) + if (_Traits::find(__s, __n, *__ps) == 0) + return static_cast<_SizeT>(__ps - __p); + } + return __npos; +} + + +template +inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY +__str_find_first_not_of(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) noexcept +{ + if (__pos < __sz) + { + const _CharT* __pe = __p + __sz; + for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) + if (!_Traits::eq(*__ps, __c)) + return static_cast<_SizeT>(__ps - __p); + } + return __npos; +} + + +// __str_find_last_not_of +template +inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY +__str_find_last_not_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept +{ + if (__pos < __sz) + ++__pos; + else + __pos = __sz; + for (const _CharT* __ps = __p + __pos; __ps != __p;) + if (_Traits::find(__s, __n, *--__ps) == 0) + return static_cast<_SizeT>(__ps - __p); + return __npos; +} + + +template +inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY +__str_find_last_not_of(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) noexcept +{ + if (__pos < __sz) + ++__pos; + else + __pos = __sz; + for (const _CharT* __ps = __p + __pos; __ps != __p;) + if (!_Traits::eq(*--__ps, __c)) + return static_cast<_SizeT>(__ps - __p); + return __npos; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +size_t __do_string_hash(_Ptr __p, _Ptr __e) +{ + typedef typename iterator_traits<_Ptr>::value_type value_type; + return __murmur2_or_cityhash()(__p, (__e-__p)*sizeof(value_type)); +} + +template > +struct __quoted_output_proxy +{ + _Iter __first; + _Iter __last; + _CharT __delim; + _CharT __escape; + + __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e) + : __first(__f), __last(__l), __delim(__d), __escape(__e) {} + // This would be a nice place for a string_ref +}; + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX___STRING diff --git a/cuda_toolkit/include/__threading_support b/cuda_toolkit/include/__threading_support new file mode 100644 index 0000000000000000000000000000000000000000..90f4f95c6074925f6038335f71e1add341d879b9 --- /dev/null +++ b/cuda_toolkit/include/__threading_support @@ -0,0 +1,795 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_THREADING_SUPPORT +#define _LIBCUDACXX_THREADING_SUPPORT + +#ifndef __cuda_std__ +#include <__config> +#include +#else +#include "__cuda/atomic_prelude.h" +#endif // __cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__functional/hash.h" +#include "chrono" +#include "climits" +#include "iosfwd" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#if defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL) +# ifndef __cuda_std__ +# include <__external_threading> +# else +# define _LIBCUDACXX_THREAD_ABI_VISIBILITY inline _LIBCUDACXX_INLINE_VISIBILITY +# endif +#elif !defined(_LIBCUDACXX_HAS_NO_THREADS) + +#if defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) +# include +# include +# include +# if defined(__APPLE__) +# include +# endif +# if defined(__linux__) +# include +# include +# include +# endif +#endif + +#if defined(_LIBCUDACXX_HAS_THREAD_API_WIN32) +# include +# include +#endif + +#if defined(_LIBCUDACXX_HAS_THREAD_LIBRARY_EXTERNAL) || \ + defined(_LIBCUDACXX_BUILDING_THREAD_LIBRARY_EXTERNAL) +#define _LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_FUNC_VIS +#else +#define _LIBCUDACXX_THREAD_ABI_VISIBILITY inline _LIBCUDACXX_INLINE_VISIBILITY +#endif + +#if defined(__FreeBSD__) && defined(_LIBCUDACXX_COMPILER_CLANG) && __has_attribute(no_thread_safety_analysis) +#define _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis)) +#else +#define _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS +#endif + +typedef ::timespec __libcpp_timespec_t; +#endif // !defined(_LIBCUDACXX_HAS_NO_THREADS) + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCUDACXX_HAS_NO_THREADS) + +#define _LIBCUDACXX_POLLING_COUNT 16 + +_LIBCUDACXX_INLINE_VISIBILITY +inline void __libcpp_thread_yield_processor() +{ +#if defined(__aarch64__) +# define __LIBCUDACXX_ASM_THREAD_YIELD (asm volatile ("yield" :::);) +#elif defined(__x86_64__) +# define __LIBCUDACXX_ASM_THREAD_YIELD (asm volatile ("pause" :::);) +#elif defined (__powerpc__) +# define __LIBCUDACXX_ASM_THREAD_YIELD (asm volatile ("or 27,27,27":::);) +#else +# define __LIBCUDACXX_ASM_THREAD_YIELD (;) +#endif + NV_IF_TARGET( + NV_IS_HOST, + __LIBCUDACXX_ASM_THREAD_YIELD + ) +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +void __libcpp_thread_yield(); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +void __libcpp_thread_sleep_for(chrono::nanoseconds __ns); + +template +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_thread_poll_with_backoff(_Fn && __f, chrono::nanoseconds __max = chrono::nanoseconds::zero()); + +#if defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) +// Mutex +typedef pthread_mutex_t __libcpp_mutex_t; +#define _LIBCUDACXX_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER + +typedef pthread_mutex_t __libcpp_recursive_mutex_t; + +// Condition Variable +typedef pthread_cond_t __libcpp_condvar_t; +#define _LIBCUDACXX_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER + +// Semaphore +#if defined(__APPLE__) +typedef dispatch_semaphore_t __libcpp_semaphore_t; +# define _LIBCUDACXX_SEMAPHORE_MAX numeric_limits::max() +#else +typedef sem_t __libcpp_semaphore_t; +# define _LIBCUDACXX_SEMAPHORE_MAX SEM_VALUE_MAX +#endif + +// Execute once +typedef pthread_once_t __libcpp_exec_once_flag; +#define _LIBCUDACXX_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT + +// Thread id +typedef pthread_t __libcpp_thread_id; + +// Thread +#define _LIBCUDACXX_NULL_THREAD 0U + +typedef pthread_t __libcpp_thread_t; + +// Thread Local Storage +typedef pthread_key_t __libcpp_tls_key; + +#define _LIBCUDACXX_TLS_DESTRUCTOR_CC +#elif !defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL) +// Mutex +typedef void* __libcpp_mutex_t; +#define _LIBCUDACXX_MUTEX_INITIALIZER 0 + +#if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__) +typedef void* __libcpp_recursive_mutex_t[6]; +#elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__) +typedef void* __libcpp_recursive_mutex_t[5]; +#else +# error Unsupported architecture +#endif + +// Condition Variable +typedef void* __libcpp_condvar_t; +#define _LIBCUDACXX_CONDVAR_INITIALIZER 0 + +// Semaphore +typedef void* __libcpp_semaphore_t; + +// Execute Once +typedef void* __libcpp_exec_once_flag; +#define _LIBCUDACXX_EXEC_ONCE_INITIALIZER 0 + +// Thread ID +typedef long __libcpp_thread_id; + +// Thread +#define _LIBCUDACXX_NULL_THREAD 0U + +typedef void* __libcpp_thread_t; + +// Thread Local Storage +typedef long __libcpp_tls_key; + +#define _LIBCUDACXX_TLS_DESTRUCTOR_CC __stdcall +#endif // !defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) && !defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL) + +#if !defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL) + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +__libcpp_timespec_t __libcpp_to_timespec(const chrono::nanoseconds& __ns); + +// Mutex +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS +int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS +bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS +int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS +int __libcpp_mutex_lock(__libcpp_mutex_t *__m); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS +bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS +int __libcpp_mutex_unlock(__libcpp_mutex_t *__m); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_mutex_destroy(__libcpp_mutex_t *__m); + +// Condition variable +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_condvar_signal(__libcpp_condvar_t* __cv); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS +int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS +int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m, + __libcpp_timespec_t *__ts); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv); + +// Semaphore +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_semaphore_init(__libcpp_semaphore_t* __sem, int __init); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_semaphore_destroy(__libcpp_semaphore_t* __sem); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_semaphore_post(__libcpp_semaphore_t* __sem); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_semaphore_wait(__libcpp_semaphore_t* __sem); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_semaphore_wait_timed(__libcpp_semaphore_t* __sem, chrono::nanoseconds const& __ns); + +// Execute once +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_execute_once(__libcpp_exec_once_flag *flag, + void (*init_routine)()); + +// Thread id +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2); + +// Thread +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_thread_isnull(const __libcpp_thread_t *__t); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *), + void *__arg); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +__libcpp_thread_id __libcpp_thread_get_current_id(); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_thread_join(__libcpp_thread_t *__t); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_thread_detach(__libcpp_thread_t *__t); + +// Thread local storage +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_tls_create(__libcpp_tls_key* __key, + void(_LIBCUDACXX_TLS_DESTRUCTOR_CC* __at_exit)(void*)); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +void *__libcpp_tls_get(__libcpp_tls_key __key); + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_tls_set(__libcpp_tls_key __key, void *__p); + +#endif // !defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL) + +#if !defined(_LIBCUDACXX_HAS_THREAD_LIBRARY_EXTERNAL) || defined(_LIBCUDACXX_BUILDING_THREAD_LIBRARY_EXTERNAL) + +#if defined(_LIBCUDACXX_HAS_THREAD_API_CUDA) + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +void __libcpp_thread_yield() {} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +void __libcpp_thread_sleep_for(chrono::nanoseconds __ns) +{ + NV_IF_TARGET( + NV_IS_DEVICE, ( + auto const __step = __ns.count(); + assert(__step < numeric_limits::max()); + asm volatile("nanosleep.u32 %0;"::"r"((unsigned)__step):); + ) + ) +} + +#elif defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +__libcpp_timespec_t __libcpp_to_timespec(const chrono::nanoseconds& __ns) +{ + using namespace chrono; + seconds __s = duration_cast(__ns); + __libcpp_timespec_t __ts; + typedef decltype(__ts.tv_sec) ts_sec; + constexpr ts_sec __ts_sec_max = numeric_limits::max(); + + if (__s.count() < __ts_sec_max) + { + __ts.tv_sec = static_cast(__s.count()); + __ts.tv_nsec = static_cast((__ns - __s).count()); + } + else + { + __ts.tv_sec = __ts_sec_max; + __ts.tv_nsec = 999999999; // (10^9 - 1) + } + return __ts; +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m) +{ + pthread_mutexattr_t attr; + int __ec = pthread_mutexattr_init(&attr); + if (__ec) + return __ec; + __ec = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + if (__ec) { + pthread_mutexattr_destroy(&attr); + return __ec; + } + __ec = pthread_mutex_init(__m, &attr); + if (__ec) { + pthread_mutexattr_destroy(&attr); + return __ec; + } + __ec = pthread_mutexattr_destroy(&attr); + if (__ec) { + pthread_mutex_destroy(__m); + return __ec; + } + return 0; +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m) +{ + return pthread_mutex_lock(__m); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m) +{ + return pthread_mutex_trylock(__m) == 0; +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_recursive_mutex_unlock(__libcpp_mutex_t *__m) +{ + return pthread_mutex_unlock(__m); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m) +{ + return pthread_mutex_destroy(__m); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_mutex_lock(__libcpp_mutex_t *__m) +{ + return pthread_mutex_lock(__m); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m) +{ + return pthread_mutex_trylock(__m) == 0; +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_mutex_unlock(__libcpp_mutex_t *__m) +{ + return pthread_mutex_unlock(__m); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_mutex_destroy(__libcpp_mutex_t *__m) +{ + return pthread_mutex_destroy(__m); +} + +// Condition Variable +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_condvar_signal(__libcpp_condvar_t *__cv) +{ + return pthread_cond_signal(__cv); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv) +{ + return pthread_cond_broadcast(__cv); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m) +{ + return pthread_cond_wait(__cv, __m); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m, + __libcpp_timespec_t *__ts) +{ + return pthread_cond_timedwait(__cv, __m, __ts); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv) +{ + return pthread_cond_destroy(__cv); +} + +// Semaphore +#if defined(__APPLE__) + +bool __libcpp_semaphore_init(__libcpp_semaphore_t* __sem, int __init) +{ + return (*__sem = dispatch_semaphore_create(__init)) != NULL; +} + +bool __libcpp_semaphore_destroy(__libcpp_semaphore_t* __sem) +{ + dispatch_release(*__sem); + return true; +} + +bool __libcpp_semaphore_post(__libcpp_semaphore_t* __sem) +{ + dispatch_semaphore_signal(*__sem); + return true; +} + +bool __libcpp_semaphore_wait(__libcpp_semaphore_t* __sem) +{ + return dispatch_semaphore_wait(*__sem, DISPATCH_TIME_FOREVER) == 0; +} + +bool __libcpp_semaphore_wait_timed(__libcpp_semaphore_t* __sem, chrono::nanoseconds const& __ns) +{ + return dispatch_semaphore_wait(*__sem, dispatch_time(DISPATCH_TIME_NOW, __ns.count())) == 0; +} + +#else + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_semaphore_init(__libcpp_semaphore_t* __sem, int __init) +{ + return sem_init(__sem, 0, __init) == 0; +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_semaphore_destroy(__libcpp_semaphore_t* __sem) +{ + return sem_destroy(__sem) == 0; +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_semaphore_post(__libcpp_semaphore_t* __sem) +{ + return sem_post(__sem) == 0; +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_semaphore_wait(__libcpp_semaphore_t* __sem) +{ + return sem_wait(__sem) == 0; +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_semaphore_wait_timed(__libcpp_semaphore_t* __sem, chrono::nanoseconds const& __ns) +{ + __libcpp_timespec_t __ts = __libcpp_to_timespec(__ns); + return sem_timedwait(__sem, &__ts) == 0; +} + +#endif //__APPLE__ + +// Execute once +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_execute_once(__libcpp_exec_once_flag *flag, void (*init_routine)()) +{ + return pthread_once(flag, init_routine); +} + +// Thread id +// Returns non-zero if the thread ids are equal, otherwise 0 +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2) +{ + return pthread_equal(t1, t2) != 0; +} + +// Returns non-zero if t1 < t2, otherwise 0 +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2) +{ + return t1 < t2; +} + +// Thread +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) +{ + return *__t == 0; +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *), + void *__arg) +{ + return pthread_create(__t, 0, __func, __arg); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +__libcpp_thread_id __libcpp_thread_get_current_id() +{ + return pthread_self(); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t) +{ + return *__t; +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_thread_join(__libcpp_thread_t *__t) +{ + return pthread_join(*__t, 0); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_thread_detach(__libcpp_thread_t *__t) +{ + return pthread_detach(*__t); +} + +// Thread local storage +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *)) +{ + return pthread_key_create(__key, __at_exit); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +void *__libcpp_tls_get(__libcpp_tls_key __key) +{ + return pthread_getspecific(__key); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +int __libcpp_tls_set(__libcpp_tls_key __key, void *__p) +{ + return pthread_setspecific(__key, __p); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +void __libcpp_thread_yield() +{ + sched_yield(); +} + +_LIBCUDACXX_THREAD_ABI_VISIBILITY +void __libcpp_thread_sleep_for(chrono::nanoseconds __ns) +{ + __libcpp_timespec_t __ts = __libcpp_to_timespec(__ns); + while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR); +} + +#if defined(__linux__) && !defined(_LIBCUDACXX_HAS_NO_PLATFORM_WAIT) + +#define _LIBCUDACXX_HAS_PLATFORM_WAIT + +typedef int __libcpp_platform_wait_t; + +template +struct __libcpp_platform_wait_uses_type { + enum { __value = is_same<__remove_cv_t<_Tp>, __libcpp_platform_wait_t>::value }; +}; + +template ::__value, int>::type = 1> +void __libcpp_platform_wait(_Tp const* ptr, _Tp val, void const* timeout) { + syscall(SYS_futex, ptr, FUTEX_WAIT_PRIVATE, val, timeout, 0, 0); +} + +template ::__value, int>::type = 1> +void __libcpp_platform_wake(_Tp const* ptr, bool all) { + syscall(SYS_futex, ptr, FUTEX_WAKE_PRIVATE, all ? INT_MAX : 1, 0, 0, 0); +} + +#endif // defined(__linux__) && !defined(_LIBCUDACXX_HAS_NO_PLATFORM_WAIT) + +#elif defined(_LIBCUDACXX_HAS_THREAD_API_WIN32) + +void __libcpp_thread_yield() +{ + SwitchToThread(); +} + +void __libcpp_thread_sleep_for(chrono::nanoseconds __ns) +{ + using namespace chrono; + // round-up to the nearest milisecond + milliseconds __ms = + duration_cast(__ns + chrono::nanoseconds(999999)); + Sleep(static_cast(__ms.count())); +} + +#endif // defined(_LIBCUDACXX_HAS_THREAD_API_WIN32) + +#endif // !defined(_LIBCUDACXX_HAS_THREAD_LIBRARY_EXTERNAL) || defined(_LIBCUDACXX_BUILDING_THREAD_LIBRARY_EXTERNAL) + +template +_LIBCUDACXX_THREAD_ABI_VISIBILITY +bool __libcpp_thread_poll_with_backoff(_Fn && __f, chrono::nanoseconds __max) +{ + chrono::high_resolution_clock::time_point const __start = chrono::high_resolution_clock::now(); + for(int __count = 0;;) { + if(__f()) + return true; + if(__count < _LIBCUDACXX_POLLING_COUNT) { + if(__count > (_LIBCUDACXX_POLLING_COUNT >> 1)) + __libcpp_thread_yield_processor(); + __count += 1; + continue; + } + chrono::high_resolution_clock::duration const __elapsed = chrono::high_resolution_clock::now() - __start; + if(__max != chrono::nanoseconds::zero() && + __max < __elapsed) + return false; + chrono::nanoseconds const __step = __elapsed / 4; + if(__step >= chrono::milliseconds(1)) + __libcpp_thread_sleep_for(chrono::milliseconds(1)); + else if(__step >= chrono::microseconds(10)) + __libcpp_thread_sleep_for(__step); + else + __libcpp_thread_yield(); + } +} + +#ifndef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE + +struct alignas(64) __libcpp_contention_t { +#if defined(_LIBCUDACXX_HAS_PLATFORM_WAIT) + ptrdiff_t __waiters = 0; + __libcpp_platform_wait_t __version = 0; +#else + ptrdiff_t __credit = 0; + __libcpp_mutex_t __mutex = _LIBCUDACXX_MUTEX_INITIALIZER; + __libcpp_condvar_t __condvar = _LIBCUDACXX_CONDVAR_INITIALIZER; +#endif +}; + +_LIBCUDACXX_FUNC_VIS +__libcpp_contention_t * __libcpp_contention_state(void const volatile * p) noexcept; + +#endif // _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE + +#if !defined(_LIBCUDACXX_HAS_NO_TREE_BARRIER) && !defined(_LIBCUDACXX_HAS_NO_THREAD_FAVORITE_BARRIER_INDEX) + +_LIBCUDACXX_EXPORTED_FROM_ABI +extern thread_local ptrdiff_t __libcpp_thread_favorite_barrier_index; + +#endif + +#ifndef __cuda_std__ + +class _LIBCUDACXX_TYPE_VIS thread; +class _LIBCUDACXX_TYPE_VIS __thread_id; + +namespace this_thread +{ + +_LIBCUDACXX_INLINE_VISIBILITY __thread_id get_id() noexcept; + +} // this_thread + +template<> struct hash<__thread_id>; + +class _LIBCUDACXX_TEMPLATE_VIS __thread_id +{ + // FIXME: pthread_t is a pointer on Darwin but a long on Linux. + // NULL is the no-thread value on Darwin. Someone needs to check + // on other platforms. We assume 0 works everywhere for now. + __libcpp_thread_id __id_; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + __thread_id() noexcept : __id_(0) {} + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(__thread_id __x, __thread_id __y) noexcept + { // don't pass id==0 to underlying routines + if (__x.__id_ == 0) return __y.__id_ == 0; + if (__y.__id_ == 0) return false; + return __libcpp_thread_id_equal(__x.__id_, __y.__id_); + } + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(__thread_id __x, __thread_id __y) noexcept + {return !(__x == __y);} + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator< (__thread_id __x, __thread_id __y) noexcept + { // id==0 is always less than any other thread_id + if (__x.__id_ == 0) return __y.__id_ != 0; + if (__y.__id_ == 0) return false; + return __libcpp_thread_id_less(__x.__id_, __y.__id_); + } + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator<=(__thread_id __x, __thread_id __y) noexcept + {return !(__y < __x);} + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator> (__thread_id __x, __thread_id __y) noexcept + {return __y < __x ;} + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator>=(__thread_id __x, __thread_id __y) noexcept + {return !(__x < __y);} + + _LIBCUDACXX_INLINE_VISIBILITY + void __reset() { __id_ = 0; } + +#ifndef __cuda_std__ + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id); +#endif + +private: + _LIBCUDACXX_INLINE_VISIBILITY + __thread_id(__libcpp_thread_id __id) : __id_(__id) {} + + friend __thread_id this_thread::get_id() noexcept; + friend class _LIBCUDACXX_TYPE_VIS thread; + friend struct _LIBCUDACXX_TEMPLATE_VIS hash<__thread_id>; +}; + +namespace this_thread +{ + +inline _LIBCUDACXX_INLINE_VISIBILITY +__thread_id +get_id() noexcept +{ + return __libcpp_thread_get_current_id(); +} + +} // this_thread + +#endif // __cuda_std__ + +#endif // !_LIBCUDACXX_HAS_NO_THREADS + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif + +#endif // _LIBCUDACXX_THREADING_SUPPORT diff --git a/cuda_toolkit/include/__tree b/cuda_toolkit/include/__tree new file mode 100644 index 0000000000000000000000000000000000000000..d875c8d78c84d76336be5cfe613d4363fd8a71f3 --- /dev/null +++ b/cuda_toolkit/include/__tree @@ -0,0 +1,2747 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___TREE +#define _LIBCUDACXX___TREE + +#include <__config> +#include +#include +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#if defined(_LIBCUDACXX_COMPILER_GCC) // gcc.gnu.org/PR37804 +template class _LIBCUDACXX_TEMPLATE_VIS map; +template class _LIBCUDACXX_TEMPLATE_VIS multimap; +template class _LIBCUDACXX_TEMPLATE_VIS set; +template class _LIBCUDACXX_TEMPLATE_VIS multiset; +#endif // _LIBCUDACXX_COMPILER_GCC + +template class __tree; +template + class _LIBCUDACXX_TEMPLATE_VIS __tree_iterator; +template + class _LIBCUDACXX_TEMPLATE_VIS __tree_const_iterator; + +template class __tree_end_node; +template class __tree_node_base; +template class __tree_node; + +template +struct __value_type; + +template class __map_node_destructor; +template class _LIBCUDACXX_TEMPLATE_VIS __map_iterator; +template class _LIBCUDACXX_TEMPLATE_VIS __map_const_iterator; + +/* + +_NodePtr algorithms + +The algorithms taking _NodePtr are red black tree algorithms. Those +algorithms taking a parameter named __root should assume that __root +points to a proper red black tree (unless otherwise specified). + +Each algorithm herein assumes that __root->__parent_ points to a non-null +structure which has a member __left_ which points back to __root. No other +member is read or written to at __root->__parent_. + +__root->__parent_ will be referred to below (in comments only) as end_node. +end_node->__left_ is an externably accessible lvalue for __root, and can be +changed by node insertion and removal (without explicit reference to end_node). + +All nodes (with the exception of end_node), even the node referred to as +__root, have a non-null __parent_ field. + +*/ + +// Returns: true if __x is a left child of its parent, else false +// Precondition: __x != nullptr. +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +__tree_is_left_child(_NodePtr __x) noexcept +{ + return __x == __x->__parent_->__left_; +} + +// Determines if the subtree rooted at __x is a proper red black subtree. If +// __x is a proper subtree, returns the black height (null counts as 1). If +// __x is an improper subtree, returns 0. +template +unsigned +__tree_sub_invariant(_NodePtr __x) +{ + if (__x == nullptr) + return 1; + // parent consistency checked by caller + // check __x->__left_ consistency + if (__x->__left_ != nullptr && __x->__left_->__parent_ != __x) + return 0; + // check __x->__right_ consistency + if (__x->__right_ != nullptr && __x->__right_->__parent_ != __x) + return 0; + // check __x->__left_ != __x->__right_ unless both are nullptr + if (__x->__left_ == __x->__right_ && __x->__left_ != nullptr) + return 0; + // If this is red, neither child can be red + if (!__x->__is_black_) + { + if (__x->__left_ && !__x->__left_->__is_black_) + return 0; + if (__x->__right_ && !__x->__right_->__is_black_) + return 0; + } + unsigned __h = __tree_sub_invariant(__x->__left_); + if (__h == 0) + return 0; // invalid left subtree + if (__h != __tree_sub_invariant(__x->__right_)) + return 0; // invalid or different height right subtree + return __h + __x->__is_black_; // return black height of this node +} + +// Determines if the red black tree rooted at __root is a proper red black tree. +// __root == nullptr is a proper tree. Returns true is __root is a proper +// red black tree, else returns false. +template +bool +__tree_invariant(_NodePtr __root) +{ + if (__root == nullptr) + return true; + // check __x->__parent_ consistency + if (__root->__parent_ == nullptr) + return false; + if (!__tree_is_left_child(__root)) + return false; + // root must be black + if (!__root->__is_black_) + return false; + // do normal node checks + return __tree_sub_invariant(__root) != 0; +} + +// Returns: pointer to the left-most node under __x. +// Precondition: __x != nullptr. +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_NodePtr +__tree_min(_NodePtr __x) noexcept +{ + while (__x->__left_ != nullptr) + __x = __x->__left_; + return __x; +} + +// Returns: pointer to the right-most node under __x. +// Precondition: __x != nullptr. +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_NodePtr +__tree_max(_NodePtr __x) noexcept +{ + while (__x->__right_ != nullptr) + __x = __x->__right_; + return __x; +} + +// Returns: pointer to the next in-order node after __x. +// Precondition: __x != nullptr. +template +_NodePtr +__tree_next(_NodePtr __x) noexcept +{ + if (__x->__right_ != nullptr) + return __tree_min(__x->__right_); + while (!__tree_is_left_child(__x)) + __x = __x->__parent_unsafe(); + return __x->__parent_unsafe(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_EndNodePtr +__tree_next_iter(_NodePtr __x) noexcept +{ + if (__x->__right_ != nullptr) + return static_cast<_EndNodePtr>(__tree_min(__x->__right_)); + while (!__tree_is_left_child(__x)) + __x = __x->__parent_unsafe(); + return static_cast<_EndNodePtr>(__x->__parent_); +} + +// Returns: pointer to the previous in-order node before __x. +// Precondition: __x != nullptr. +// Note: __x may be the end node. +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_NodePtr +__tree_prev_iter(_EndNodePtr __x) noexcept +{ + if (__x->__left_ != nullptr) + return __tree_max(__x->__left_); + _NodePtr __xx = static_cast<_NodePtr>(__x); + while (__tree_is_left_child(__xx)) + __xx = __xx->__parent_unsafe(); + return __xx->__parent_unsafe(); +} + +// Returns: pointer to a node which has no children +// Precondition: __x != nullptr. +template +_NodePtr +__tree_leaf(_NodePtr __x) noexcept +{ + while (true) + { + if (__x->__left_ != nullptr) + { + __x = __x->__left_; + continue; + } + if (__x->__right_ != nullptr) + { + __x = __x->__right_; + continue; + } + break; + } + return __x; +} + +// Effects: Makes __x->__right_ the subtree root with __x as its left child +// while preserving in-order order. +// Precondition: __x->__right_ != nullptr +template +void +__tree_left_rotate(_NodePtr __x) noexcept +{ + _NodePtr __y = __x->__right_; + __x->__right_ = __y->__left_; + if (__x->__right_ != nullptr) + __x->__right_->__set_parent(__x); + __y->__parent_ = __x->__parent_; + if (__tree_is_left_child(__x)) + __x->__parent_->__left_ = __y; + else + __x->__parent_unsafe()->__right_ = __y; + __y->__left_ = __x; + __x->__set_parent(__y); +} + +// Effects: Makes __x->__left_ the subtree root with __x as its right child +// while preserving in-order order. +// Precondition: __x->__left_ != nullptr +template +void +__tree_right_rotate(_NodePtr __x) noexcept +{ + _NodePtr __y = __x->__left_; + __x->__left_ = __y->__right_; + if (__x->__left_ != nullptr) + __x->__left_->__set_parent(__x); + __y->__parent_ = __x->__parent_; + if (__tree_is_left_child(__x)) + __x->__parent_->__left_ = __y; + else + __x->__parent_unsafe()->__right_ = __y; + __y->__right_ = __x; + __x->__set_parent(__y); +} + +// Effects: Rebalances __root after attaching __x to a leaf. +// Precondition: __root != nulptr && __x != nullptr. +// __x has no children. +// __x == __root or == a direct or indirect child of __root. +// If __x were to be unlinked from __root (setting __root to +// nullptr if __root == __x), __tree_invariant(__root) == true. +// Postcondition: __tree_invariant(end_node->__left_) == true. end_node->__left_ +// may be different than the value passed in as __root. +template +void +__tree_balance_after_insert(_NodePtr __root, _NodePtr __x) noexcept +{ + __x->__is_black_ = __x == __root; + while (__x != __root && !__x->__parent_unsafe()->__is_black_) + { + // __x->__parent_ != __root because __x->__parent_->__is_black == false + if (__tree_is_left_child(__x->__parent_unsafe())) + { + _NodePtr __y = __x->__parent_unsafe()->__parent_unsafe()->__right_; + if (__y != nullptr && !__y->__is_black_) + { + __x = __x->__parent_unsafe(); + __x->__is_black_ = true; + __x = __x->__parent_unsafe(); + __x->__is_black_ = __x == __root; + __y->__is_black_ = true; + } + else + { + if (!__tree_is_left_child(__x)) + { + __x = __x->__parent_unsafe(); + __tree_left_rotate(__x); + } + __x = __x->__parent_unsafe(); + __x->__is_black_ = true; + __x = __x->__parent_unsafe(); + __x->__is_black_ = false; + __tree_right_rotate(__x); + break; + } + } + else + { + _NodePtr __y = __x->__parent_unsafe()->__parent_->__left_; + if (__y != nullptr && !__y->__is_black_) + { + __x = __x->__parent_unsafe(); + __x->__is_black_ = true; + __x = __x->__parent_unsafe(); + __x->__is_black_ = __x == __root; + __y->__is_black_ = true; + } + else + { + if (__tree_is_left_child(__x)) + { + __x = __x->__parent_unsafe(); + __tree_right_rotate(__x); + } + __x = __x->__parent_unsafe(); + __x->__is_black_ = true; + __x = __x->__parent_unsafe(); + __x->__is_black_ = false; + __tree_left_rotate(__x); + break; + } + } + } +} + +// Precondition: __root != nullptr && __z != nullptr. +// __tree_invariant(__root) == true. +// __z == __root or == a direct or indirect child of __root. +// Effects: unlinks __z from the tree rooted at __root, rebalancing as needed. +// Postcondition: __tree_invariant(end_node->__left_) == true && end_node->__left_ +// nor any of its children refer to __z. end_node->__left_ +// may be different than the value passed in as __root. +template +void +__tree_remove(_NodePtr __root, _NodePtr __z) noexcept +{ + // __z will be removed from the tree. Client still needs to destruct/deallocate it + // __y is either __z, or if __z has two children, __tree_next(__z). + // __y will have at most one child. + // __y will be the initial hole in the tree (make the hole at a leaf) + _NodePtr __y = (__z->__left_ == nullptr || __z->__right_ == nullptr) ? + __z : __tree_next(__z); + // __x is __y's possibly null single child + _NodePtr __x = __y->__left_ != nullptr ? __y->__left_ : __y->__right_; + // __w is __x's possibly null uncle (will become __x's sibling) + _NodePtr __w = nullptr; + // link __x to __y's parent, and find __w + if (__x != nullptr) + __x->__parent_ = __y->__parent_; + if (__tree_is_left_child(__y)) + { + __y->__parent_->__left_ = __x; + if (__y != __root) + __w = __y->__parent_unsafe()->__right_; + else + __root = __x; // __w == nullptr + } + else + { + __y->__parent_unsafe()->__right_ = __x; + // __y can't be root if it is a right child + __w = __y->__parent_->__left_; + } + bool __removed_black = __y->__is_black_; + // If we didn't remove __z, do so now by splicing in __y for __z, + // but copy __z's color. This does not impact __x or __w. + if (__y != __z) + { + // __z->__left_ != nulptr but __z->__right_ might == __x == nullptr + __y->__parent_ = __z->__parent_; + if (__tree_is_left_child(__z)) + __y->__parent_->__left_ = __y; + else + __y->__parent_unsafe()->__right_ = __y; + __y->__left_ = __z->__left_; + __y->__left_->__set_parent(__y); + __y->__right_ = __z->__right_; + if (__y->__right_ != nullptr) + __y->__right_->__set_parent(__y); + __y->__is_black_ = __z->__is_black_; + if (__root == __z) + __root = __y; + } + // There is no need to rebalance if we removed a red, or if we removed + // the last node. + if (__removed_black && __root != nullptr) + { + // Rebalance: + // __x has an implicit black color (transferred from the removed __y) + // associated with it, no matter what its color is. + // If __x is __root (in which case it can't be null), it is supposed + // to be black anyway, and if it is doubly black, then the double + // can just be ignored. + // If __x is red (in which case it can't be null), then it can absorb + // the implicit black just by setting its color to black. + // Since __y was black and only had one child (which __x points to), __x + // is either red with no children, else null, otherwise __y would have + // different black heights under left and right pointers. + // if (__x == __root || __x != nullptr && !__x->__is_black_) + if (__x != nullptr) + __x->__is_black_ = true; + else + { + // Else __x isn't root, and is "doubly black", even though it may + // be null. __w can not be null here, else the parent would + // see a black height >= 2 on the __x side and a black height + // of 1 on the __w side (__w must be a non-null black or a red + // with a non-null black child). + while (true) + { + if (!__tree_is_left_child(__w)) // if x is left child + { + if (!__w->__is_black_) + { + __w->__is_black_ = true; + __w->__parent_unsafe()->__is_black_ = false; + __tree_left_rotate(__w->__parent_unsafe()); + // __x is still valid + // reset __root only if necessary + if (__root == __w->__left_) + __root = __w; + // reset sibling, and it still can't be null + __w = __w->__left_->__right_; + } + // __w->__is_black_ is now true, __w may have null children + if ((__w->__left_ == nullptr || __w->__left_->__is_black_) && + (__w->__right_ == nullptr || __w->__right_->__is_black_)) + { + __w->__is_black_ = false; + __x = __w->__parent_unsafe(); + // __x can no longer be null + if (__x == __root || !__x->__is_black_) + { + __x->__is_black_ = true; + break; + } + // reset sibling, and it still can't be null + __w = __tree_is_left_child(__x) ? + __x->__parent_unsafe()->__right_ : + __x->__parent_->__left_; + // continue; + } + else // __w has a red child + { + if (__w->__right_ == nullptr || __w->__right_->__is_black_) + { + // __w left child is non-null and red + __w->__left_->__is_black_ = true; + __w->__is_black_ = false; + __tree_right_rotate(__w); + // __w is known not to be root, so root hasn't changed + // reset sibling, and it still can't be null + __w = __w->__parent_unsafe(); + } + // __w has a right red child, left child may be null + __w->__is_black_ = __w->__parent_unsafe()->__is_black_; + __w->__parent_unsafe()->__is_black_ = true; + __w->__right_->__is_black_ = true; + __tree_left_rotate(__w->__parent_unsafe()); + break; + } + } + else + { + if (!__w->__is_black_) + { + __w->__is_black_ = true; + __w->__parent_unsafe()->__is_black_ = false; + __tree_right_rotate(__w->__parent_unsafe()); + // __x is still valid + // reset __root only if necessary + if (__root == __w->__right_) + __root = __w; + // reset sibling, and it still can't be null + __w = __w->__right_->__left_; + } + // __w->__is_black_ is now true, __w may have null children + if ((__w->__left_ == nullptr || __w->__left_->__is_black_) && + (__w->__right_ == nullptr || __w->__right_->__is_black_)) + { + __w->__is_black_ = false; + __x = __w->__parent_unsafe(); + // __x can no longer be null + if (!__x->__is_black_ || __x == __root) + { + __x->__is_black_ = true; + break; + } + // reset sibling, and it still can't be null + __w = __tree_is_left_child(__x) ? + __x->__parent_unsafe()->__right_ : + __x->__parent_->__left_; + // continue; + } + else // __w has a red child + { + if (__w->__left_ == nullptr || __w->__left_->__is_black_) + { + // __w right child is non-null and red + __w->__right_->__is_black_ = true; + __w->__is_black_ = false; + __tree_left_rotate(__w); + // __w is known not to be root, so root hasn't changed + // reset sibling, and it still can't be null + __w = __w->__parent_unsafe(); + } + // __w has a left red child, right child may be null + __w->__is_black_ = __w->__parent_unsafe()->__is_black_; + __w->__parent_unsafe()->__is_black_ = true; + __w->__left_->__is_black_ = true; + __tree_right_rotate(__w->__parent_unsafe()); + break; + } + } + } + } + } +} + +// node traits + + +template +struct __is_tree_value_type_imp : false_type {}; + +template +struct __is_tree_value_type_imp<__value_type<_Key, _Value>> : true_type {}; + +template +struct __is_tree_value_type : false_type {}; + +template +struct __is_tree_value_type<_One> : __is_tree_value_type_imp<__remove_cvref_t<_One>> {}; + +template +struct __tree_key_value_types { + typedef _Tp key_type; + typedef _Tp __node_value_type; + typedef _Tp __container_value_type; + static const bool __is_map = false; + + _LIBCUDACXX_INLINE_VISIBILITY + static key_type const& __get_key(_Tp const& __v) { + return __v; + } + _LIBCUDACXX_INLINE_VISIBILITY + static __container_value_type const& __get_value(__node_value_type const& __v) { + return __v; + } + _LIBCUDACXX_INLINE_VISIBILITY + static __container_value_type* __get_ptr(__node_value_type& __n) { + return _CUDA_VSTD::addressof(__n); + } + _LIBCUDACXX_INLINE_VISIBILITY + static __container_value_type&& __move(__node_value_type& __v) { + return _CUDA_VSTD::move(__v); + } +}; + +template +struct __tree_key_value_types<__value_type<_Key, _Tp> > { + typedef _Key key_type; + typedef _Tp mapped_type; + typedef __value_type<_Key, _Tp> __node_value_type; + typedef pair __container_value_type; + typedef __container_value_type __map_value_type; + static const bool __is_map = true; + + _LIBCUDACXX_INLINE_VISIBILITY + static key_type const& + __get_key(__node_value_type const& __t) { + return __t.__get_value().first; + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + static typename enable_if<__is_same_uncvref<_Up, __container_value_type>::value, + key_type const&>::type + __get_key(_Up& __t) { + return __t.first; + } + + _LIBCUDACXX_INLINE_VISIBILITY + static __container_value_type const& + __get_value(__node_value_type const& __t) { + return __t.__get_value(); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + static typename enable_if<__is_same_uncvref<_Up, __container_value_type>::value, + __container_value_type const&>::type + __get_value(_Up& __t) { + return __t; + } + + _LIBCUDACXX_INLINE_VISIBILITY + static __container_value_type* __get_ptr(__node_value_type& __n) { + return _CUDA_VSTD::addressof(__n.__get_value()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + static pair __move(__node_value_type& __v) { + return __v.__move(); + } +}; + +template +struct __tree_node_base_types { + typedef _VoidPtr __void_pointer; + + typedef __tree_node_base<__void_pointer> __node_base_type; + typedef typename __rebind_pointer<_VoidPtr, __node_base_type>::type + __node_base_pointer; + + typedef __tree_end_node<__node_base_pointer> __end_node_type; + typedef typename __rebind_pointer<_VoidPtr, __end_node_type>::type + __end_node_pointer; +#if defined(_LIBCUDACXX_ABI_TREE_REMOVE_NODE_POINTER_UB) + typedef __end_node_pointer __parent_pointer; +#else + typedef typename conditional< + is_pointer<__end_node_pointer>::value, + __end_node_pointer, + __node_base_pointer>::type __parent_pointer; +#endif + +private: + static_assert((is_same::element_type, void>::value), + "_VoidPtr does not point to unqualified void type"); +}; + +template , + bool = _KVTypes::__is_map> +struct __tree_map_pointer_types {}; + +template +struct __tree_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> { + typedef typename _KVTypes::__map_value_type _Mv; + typedef typename __rebind_pointer<_AllocPtr, _Mv>::type + __map_value_type_pointer; + typedef typename __rebind_pointer<_AllocPtr, const _Mv>::type + __const_map_value_type_pointer; +}; + +template ::element_type> +struct __tree_node_types; + +template +struct __tree_node_types<_NodePtr, __tree_node<_Tp, _VoidPtr> > + : public __tree_node_base_types<_VoidPtr>, + __tree_key_value_types<_Tp>, + __tree_map_pointer_types<_Tp, _VoidPtr> +{ + typedef __tree_node_base_types<_VoidPtr> __base; + typedef __tree_key_value_types<_Tp> __key_base; + typedef __tree_map_pointer_types<_Tp, _VoidPtr> __map_pointer_base; +public: + + typedef typename pointer_traits<_NodePtr>::element_type __node_type; + typedef _NodePtr __node_pointer; + + typedef _Tp __node_value_type; + typedef typename __rebind_pointer<_VoidPtr, __node_value_type>::type + __node_value_type_pointer; + typedef typename __rebind_pointer<_VoidPtr, const __node_value_type>::type + __const_node_value_type_pointer; +#if defined(_LIBCUDACXX_ABI_TREE_REMOVE_NODE_POINTER_UB) + typedef typename __base::__end_node_pointer __iter_pointer; +#else + typedef typename conditional< + is_pointer<__node_pointer>::value, + typename __base::__end_node_pointer, + __node_pointer>::type __iter_pointer; +#endif +private: + static_assert(!is_const<__node_type>::value, + "_NodePtr should never be a pointer to const"); + static_assert((is_same::type, + _NodePtr>::value), "_VoidPtr does not rebind to _NodePtr."); +}; + +template +struct __make_tree_node_types { + typedef typename __rebind_pointer<_VoidPtr, __tree_node<_ValueTp, _VoidPtr> >::type + _NodePtr; + typedef __tree_node_types<_NodePtr> type; +}; + +// node + +template +class __tree_end_node +{ +public: + typedef _Pointer pointer; + pointer __left_; + + _LIBCUDACXX_INLINE_VISIBILITY + __tree_end_node() noexcept : __left_() {} +}; + +template +class __tree_node_base + : public __tree_node_base_types<_VoidPtr>::__end_node_type +{ + typedef __tree_node_base_types<_VoidPtr> _NodeBaseTypes; + +public: + typedef typename _NodeBaseTypes::__node_base_pointer pointer; + typedef typename _NodeBaseTypes::__parent_pointer __parent_pointer; + + pointer __right_; + __parent_pointer __parent_; + bool __is_black_; + + _LIBCUDACXX_INLINE_VISIBILITY + pointer __parent_unsafe() const { return static_cast(__parent_);} + + _LIBCUDACXX_INLINE_VISIBILITY + void __set_parent(pointer __p) { + __parent_ = static_cast<__parent_pointer>(__p); + } + +private: + ~__tree_node_base() = delete; + __tree_node_base(__tree_node_base const&) = delete; + __tree_node_base& operator=(__tree_node_base const&) = delete; +}; + +template +class __tree_node + : public __tree_node_base<_VoidPtr> +{ +public: + typedef _Tp __node_value_type; + + __node_value_type __value_; + +private: + ~__tree_node() = delete; + __tree_node(__tree_node const&) = delete; + __tree_node& operator=(__tree_node const&) = delete; +}; + + +template +class __tree_node_destructor +{ + typedef _Allocator allocator_type; + typedef allocator_traits __alloc_traits; + +public: + typedef typename __alloc_traits::pointer pointer; +private: + typedef __tree_node_types _NodeTypes; + allocator_type& __na_; + +public: + bool __value_constructed; + + __tree_node_destructor(const __tree_node_destructor &) = default; + __tree_node_destructor& operator=(const __tree_node_destructor&) = delete; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __tree_node_destructor(allocator_type& __na, bool __val = false) noexcept + : __na_(__na), + __value_constructed(__val) + {} + + _LIBCUDACXX_INLINE_VISIBILITY + void operator()(pointer __p) noexcept + { + if (__value_constructed) + __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__value_)); + if (__p) + __alloc_traits::deallocate(__na_, __p, 1); + } + + template friend class __map_node_destructor; +}; + +#if _LIBCUDACXX_STD_VER > 14 +template +struct __generic_container_node_destructor; +template +struct __generic_container_node_destructor<__tree_node<_Tp, _VoidPtr>, _Alloc> + : __tree_node_destructor<_Alloc> +{ + using __tree_node_destructor<_Alloc>::__tree_node_destructor; +}; +#endif + +template +class _LIBCUDACXX_TEMPLATE_VIS __tree_iterator +{ + typedef __tree_node_types<_NodePtr> _NodeTypes; + typedef _NodePtr __node_pointer; + typedef typename _NodeTypes::__node_base_pointer __node_base_pointer; + typedef typename _NodeTypes::__end_node_pointer __end_node_pointer; + typedef typename _NodeTypes::__iter_pointer __iter_pointer; + typedef pointer_traits<__node_pointer> __pointer_traits; + + __iter_pointer __ptr_; + +public: + typedef bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _DiffType difference_type; + typedef value_type& reference; + typedef typename _NodeTypes::__node_value_type_pointer pointer; + + _LIBCUDACXX_INLINE_VISIBILITY __tree_iterator() noexcept +#if _LIBCUDACXX_STD_VER > 11 + : __ptr_(nullptr) +#endif + {} + + _LIBCUDACXX_INLINE_VISIBILITY reference operator*() const + {return __get_np()->__value_;} + _LIBCUDACXX_INLINE_VISIBILITY pointer operator->() const + {return pointer_traits::pointer_to(__get_np()->__value_);} + + _LIBCUDACXX_INLINE_VISIBILITY + __tree_iterator& operator++() { + __ptr_ = static_cast<__iter_pointer>( + __tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_))); + return *this; + } + _LIBCUDACXX_INLINE_VISIBILITY + __tree_iterator operator++(int) + {__tree_iterator __t(*this); ++(*this); return __t;} + + _LIBCUDACXX_INLINE_VISIBILITY + __tree_iterator& operator--() { + __ptr_ = static_cast<__iter_pointer>(__tree_prev_iter<__node_base_pointer>( + static_cast<__end_node_pointer>(__ptr_))); + return *this; + } + _LIBCUDACXX_INLINE_VISIBILITY + __tree_iterator operator--(int) + {__tree_iterator __t(*this); --(*this); return __t;} + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __tree_iterator& __x, const __tree_iterator& __y) + {return __x.__ptr_ == __y.__ptr_;} + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y) + {return !(__x == __y);} + +private: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __tree_iterator(__node_pointer __p) noexcept : __ptr_(__p) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit __tree_iterator(__end_node_pointer __p) noexcept : __ptr_(__p) {} + _LIBCUDACXX_INLINE_VISIBILITY + __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); } + template friend class __tree; + template friend class _LIBCUDACXX_TEMPLATE_VIS __tree_const_iterator; + template friend class _LIBCUDACXX_TEMPLATE_VIS __map_iterator; + template friend class _LIBCUDACXX_TEMPLATE_VIS map; + template friend class _LIBCUDACXX_TEMPLATE_VIS multimap; + template friend class _LIBCUDACXX_TEMPLATE_VIS set; + template friend class _LIBCUDACXX_TEMPLATE_VIS multiset; +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __tree_const_iterator +{ + typedef __tree_node_types<_NodePtr> _NodeTypes; + typedef typename _NodeTypes::__node_pointer __node_pointer; + typedef typename _NodeTypes::__node_base_pointer __node_base_pointer; + typedef typename _NodeTypes::__end_node_pointer __end_node_pointer; + typedef typename _NodeTypes::__iter_pointer __iter_pointer; + typedef pointer_traits<__node_pointer> __pointer_traits; + + __iter_pointer __ptr_; + +public: + typedef bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _DiffType difference_type; + typedef const value_type& reference; + typedef typename _NodeTypes::__const_node_value_type_pointer pointer; + + _LIBCUDACXX_INLINE_VISIBILITY __tree_const_iterator() noexcept +#if _LIBCUDACXX_STD_VER > 11 + : __ptr_(nullptr) +#endif + {} + +private: + typedef __tree_iterator + __non_const_iterator; +public: + _LIBCUDACXX_INLINE_VISIBILITY + __tree_const_iterator(__non_const_iterator __p) noexcept + : __ptr_(__p.__ptr_) {} + + _LIBCUDACXX_INLINE_VISIBILITY reference operator*() const + {return __get_np()->__value_;} + _LIBCUDACXX_INLINE_VISIBILITY pointer operator->() const + {return pointer_traits::pointer_to(__get_np()->__value_);} + + _LIBCUDACXX_INLINE_VISIBILITY + __tree_const_iterator& operator++() { + __ptr_ = static_cast<__iter_pointer>( + __tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_))); + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __tree_const_iterator operator++(int) + {__tree_const_iterator __t(*this); ++(*this); return __t;} + + _LIBCUDACXX_INLINE_VISIBILITY + __tree_const_iterator& operator--() { + __ptr_ = static_cast<__iter_pointer>(__tree_prev_iter<__node_base_pointer>( + static_cast<__end_node_pointer>(__ptr_))); + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __tree_const_iterator operator--(int) + {__tree_const_iterator __t(*this); --(*this); return __t;} + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y) + {return __x.__ptr_ == __y.__ptr_;} + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y) + {return !(__x == __y);} + +private: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __tree_const_iterator(__node_pointer __p) noexcept + : __ptr_(__p) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit __tree_const_iterator(__end_node_pointer __p) noexcept + : __ptr_(__p) {} + _LIBCUDACXX_INLINE_VISIBILITY + __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); } + + template friend class __tree; + template friend class _LIBCUDACXX_TEMPLATE_VIS map; + template friend class _LIBCUDACXX_TEMPLATE_VIS multimap; + template friend class _LIBCUDACXX_TEMPLATE_VIS set; + template friend class _LIBCUDACXX_TEMPLATE_VIS multiset; + template friend class _LIBCUDACXX_TEMPLATE_VIS __map_const_iterator; + +}; + +template + _LIBCUDACXX_DIAGNOSE_WARNING(!std::__invokable<_Compare const&, _Tp const&, _Tp const&>::value, + "the specified comparator type does not provide a viable const call operator") +int __diagnose_non_const_comparator(); + +template +class __tree +{ +public: + typedef _Tp value_type; + typedef _Compare value_compare; + typedef _Allocator allocator_type; + +private: + typedef allocator_traits __alloc_traits; + typedef typename __make_tree_node_types::type + _NodeTypes; + typedef typename _NodeTypes::key_type key_type; +public: + typedef typename _NodeTypes::__node_value_type __node_value_type; + typedef typename _NodeTypes::__container_value_type __container_value_type; + + typedef typename __alloc_traits::pointer pointer; + typedef typename __alloc_traits::const_pointer const_pointer; + typedef typename __alloc_traits::size_type size_type; + typedef typename __alloc_traits::difference_type difference_type; + +public: + typedef typename _NodeTypes::__void_pointer __void_pointer; + + typedef typename _NodeTypes::__node_type __node; + typedef typename _NodeTypes::__node_pointer __node_pointer; + + typedef typename _NodeTypes::__node_base_type __node_base; + typedef typename _NodeTypes::__node_base_pointer __node_base_pointer; + + typedef typename _NodeTypes::__end_node_type __end_node_t; + typedef typename _NodeTypes::__end_node_pointer __end_node_ptr; + + typedef typename _NodeTypes::__parent_pointer __parent_pointer; + typedef typename _NodeTypes::__iter_pointer __iter_pointer; + + typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; + typedef allocator_traits<__node_allocator> __node_traits; + +private: + // check for sane allocator pointer rebinding semantics. Rebinding the + // allocator for a new pointer type should be exactly the same as rebinding + // the pointer using 'pointer_traits'. + static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value), + "Allocator does not rebind pointers in a sane manner."); + typedef typename __rebind_alloc_helper<__node_traits, __node_base>::type + __node_base_allocator; + typedef allocator_traits<__node_base_allocator> __node_base_traits; + static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value), + "Allocator does not rebind pointers in a sane manner."); + +private: + __iter_pointer __begin_node_; + __compressed_pair<__end_node_t, __node_allocator> __pair1_; + __compressed_pair __pair3_; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + __iter_pointer __end_node() noexcept + { + return static_cast<__iter_pointer>( + pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first()) + ); + } + _LIBCUDACXX_INLINE_VISIBILITY + __iter_pointer __end_node() const noexcept + { + return static_cast<__iter_pointer>( + pointer_traits<__end_node_ptr>::pointer_to( + const_cast<__end_node_t&>(__pair1_.first()) + ) + ); + } + _LIBCUDACXX_INLINE_VISIBILITY + __node_allocator& __node_alloc() noexcept {return __pair1_.second();} +private: + _LIBCUDACXX_INLINE_VISIBILITY + const __node_allocator& __node_alloc() const noexcept + {return __pair1_.second();} + _LIBCUDACXX_INLINE_VISIBILITY + __iter_pointer& __begin_node() noexcept {return __begin_node_;} + _LIBCUDACXX_INLINE_VISIBILITY + const __iter_pointer& __begin_node() const noexcept {return __begin_node_;} +public: + _LIBCUDACXX_INLINE_VISIBILITY + allocator_type __alloc() const noexcept + {return allocator_type(__node_alloc());} +private: + _LIBCUDACXX_INLINE_VISIBILITY + size_type& size() noexcept {return __pair3_.first();} +public: + _LIBCUDACXX_INLINE_VISIBILITY + const size_type& size() const noexcept {return __pair3_.first();} + _LIBCUDACXX_INLINE_VISIBILITY + value_compare& value_comp() noexcept {return __pair3_.second();} + _LIBCUDACXX_INLINE_VISIBILITY + const value_compare& value_comp() const noexcept + {return __pair3_.second();} +public: + + _LIBCUDACXX_INLINE_VISIBILITY + __node_pointer __root() const noexcept + {return static_cast<__node_pointer>(__end_node()->__left_);} + + __node_base_pointer* __root_ptr() const noexcept { + return _CUDA_VSTD::addressof(__end_node()->__left_); + } + + typedef __tree_iterator iterator; + typedef __tree_const_iterator const_iterator; + + explicit __tree(const value_compare& __comp) + noexcept( + is_nothrow_default_constructible<__node_allocator>::value && + is_nothrow_copy_constructible::value); + explicit __tree(const allocator_type& __a); + __tree(const value_compare& __comp, const allocator_type& __a); + __tree(const __tree& __t); + __tree& operator=(const __tree& __t); + template + void __assign_unique(_ForwardIterator __first, _ForwardIterator __last); + template + void __assign_multi(_InputIterator __first, _InputIterator __last); + __tree(__tree&& __t) + noexcept( + is_nothrow_move_constructible<__node_allocator>::value && + is_nothrow_move_constructible::value); + __tree(__tree&& __t, const allocator_type& __a); + __tree& operator=(__tree&& __t) + noexcept( + __node_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value && + is_nothrow_move_assignable<__node_allocator>::value); + + ~__tree(); + + _LIBCUDACXX_INLINE_VISIBILITY + iterator begin() noexcept {return iterator(__begin_node());} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator begin() const noexcept {return const_iterator(__begin_node());} + _LIBCUDACXX_INLINE_VISIBILITY + iterator end() noexcept {return iterator(__end_node());} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator end() const noexcept {return const_iterator(__end_node());} + + _LIBCUDACXX_INLINE_VISIBILITY + size_type max_size() const noexcept + {return std::min( + __node_traits::max_size(__node_alloc()), + numeric_limits::max());} + + void clear() noexcept; + + void swap(__tree& __t) +#if _LIBCUDACXX_STD_VER <= 11 + noexcept( + __is_nothrow_swappable::value + && (!__node_traits::propagate_on_container_swap::value || + __is_nothrow_swappable<__node_allocator>::value) + ); +#else + noexcept(__is_nothrow_swappable::value); +#endif + + template + pair + __emplace_unique_key_args(_Key const&, _Args&&... __args); + template + iterator + __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...); + + template + pair __emplace_unique_impl(_Args&&... __args); + + template + iterator __emplace_hint_unique_impl(const_iterator __p, _Args&&... __args); + + template + iterator __emplace_multi(_Args&&... __args); + + template + iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args); + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair __emplace_unique(_Pp&& __x) { + return __emplace_unique_extract_key(_CUDA_VSTD::forward<_Pp>(__x), + __can_extract_key<_Pp, key_type>()); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if< + __can_extract_map_key<_First, key_type, __container_value_type>::value, + pair + >::type __emplace_unique(_First&& __f, _Second&& __s) { + return __emplace_unique_key_args(__f, _CUDA_VSTD::forward<_First>(__f), + _CUDA_VSTD::forward<_Second>(__s)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair __emplace_unique(_Args&&... __args) { + return __emplace_unique_impl(_CUDA_VSTD::forward<_Args>(__args)...); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair + __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) { + return __emplace_unique_impl(_CUDA_VSTD::forward<_Pp>(__x)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair + __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) { + return __emplace_unique_key_args(__x, _CUDA_VSTD::forward<_Pp>(__x)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair + __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) { + return __emplace_unique_key_args(__x.first, _CUDA_VSTD::forward<_Pp>(__x)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __emplace_hint_unique(const_iterator __p, _Pp&& __x) { + return __emplace_hint_unique_extract_key(__p, _CUDA_VSTD::forward<_Pp>(__x), + __can_extract_key<_Pp, key_type>()); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if< + __can_extract_map_key<_First, key_type, __container_value_type>::value, + iterator + >::type __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) { + return __emplace_hint_unique_key_args(__p, __f, + _CUDA_VSTD::forward<_First>(__f), + _CUDA_VSTD::forward<_Second>(__s)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __emplace_hint_unique(const_iterator __p, _Args&&... __args) { + return __emplace_hint_unique_impl(__p, _CUDA_VSTD::forward<_Args>(__args)...); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator + __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_fail_tag) { + return __emplace_hint_unique_impl(__p, _CUDA_VSTD::forward<_Pp>(__x)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator + __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_self_tag) { + return __emplace_hint_unique_key_args(__p, __x, _CUDA_VSTD::forward<_Pp>(__x)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator + __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_first_tag) { + return __emplace_hint_unique_key_args(__p, __x.first, _CUDA_VSTD::forward<_Pp>(__x)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + pair __insert_unique(const __container_value_type& __v) { + return __emplace_unique_key_args(_NodeTypes::__get_key(__v), __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator __insert_unique(const_iterator __p, const __container_value_type& __v) { + return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + pair __insert_unique(__container_value_type&& __v) { + return __emplace_unique_key_args(_NodeTypes::__get_key(__v), _CUDA_VSTD::move(__v)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator __insert_unique(const_iterator __p, __container_value_type&& __v) { + return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), _CUDA_VSTD::move(__v)); + } + + template , + __container_value_type + >::value + >::type> + _LIBCUDACXX_INLINE_VISIBILITY + pair __insert_unique(_Vp&& __v) { + return __emplace_unique(_CUDA_VSTD::forward<_Vp>(__v)); + } + + template , + __container_value_type + >::value + >::type> + _LIBCUDACXX_INLINE_VISIBILITY + iterator __insert_unique(const_iterator __p, _Vp&& __v) { + return __emplace_hint_unique(__p, _CUDA_VSTD::forward<_Vp>(__v)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator __insert_multi(__container_value_type&& __v) { + return __emplace_multi(_CUDA_VSTD::move(__v)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator __insert_multi(const_iterator __p, __container_value_type&& __v) { + return __emplace_hint_multi(__p, _CUDA_VSTD::move(__v)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __insert_multi(_Vp&& __v) { + return __emplace_multi(_CUDA_VSTD::forward<_Vp>(__v)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __insert_multi(const_iterator __p, _Vp&& __v) { + return __emplace_hint_multi(__p, _CUDA_VSTD::forward<_Vp>(__v)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + pair __node_assign_unique(const __container_value_type& __v, __node_pointer __dest); + + _LIBCUDACXX_INLINE_VISIBILITY + iterator __node_insert_multi(__node_pointer __nd); + _LIBCUDACXX_INLINE_VISIBILITY + iterator __node_insert_multi(const_iterator __p, __node_pointer __nd); + + + _LIBCUDACXX_INLINE_VISIBILITY iterator + __remove_node_pointer(__node_pointer) noexcept; + +#if _LIBCUDACXX_STD_VER > 14 + template + _LIBCUDACXX_INLINE_VISIBILITY + _InsertReturnType __node_handle_insert_unique(_NodeHandle&&); + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __node_handle_insert_unique(const_iterator, _NodeHandle&&); + template + _LIBCUDACXX_INLINE_VISIBILITY + void __node_handle_merge_unique(_Tree& __source); + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __node_handle_insert_multi(_NodeHandle&&); + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator __node_handle_insert_multi(const_iterator, _NodeHandle&&); + template + _LIBCUDACXX_INLINE_VISIBILITY + void __node_handle_merge_multi(_Tree& __source); + + + template + _LIBCUDACXX_INLINE_VISIBILITY + _NodeHandle __node_handle_extract(key_type const&); + template + _LIBCUDACXX_INLINE_VISIBILITY + _NodeHandle __node_handle_extract(const_iterator); +#endif + + iterator erase(const_iterator __p); + iterator erase(const_iterator __f, const_iterator __l); + template + size_type __erase_unique(const _Key& __k); + template + size_type __erase_multi(const _Key& __k); + + void __insert_node_at(__parent_pointer __parent, + __node_base_pointer& __child, + __node_base_pointer __new_node) noexcept; + + template + iterator find(const _Key& __v); + template + const_iterator find(const _Key& __v) const; + + template + size_type __count_unique(const _Key& __k) const; + template + size_type __count_multi(const _Key& __k) const; + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator lower_bound(const _Key& __v) + {return __lower_bound(__v, __root(), __end_node());} + template + iterator __lower_bound(const _Key& __v, + __node_pointer __root, + __iter_pointer __result); + template + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator lower_bound(const _Key& __v) const + {return __lower_bound(__v, __root(), __end_node());} + template + const_iterator __lower_bound(const _Key& __v, + __node_pointer __root, + __iter_pointer __result) const; + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator upper_bound(const _Key& __v) + {return __upper_bound(__v, __root(), __end_node());} + template + iterator __upper_bound(const _Key& __v, + __node_pointer __root, + __iter_pointer __result); + template + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator upper_bound(const _Key& __v) const + {return __upper_bound(__v, __root(), __end_node());} + template + const_iterator __upper_bound(const _Key& __v, + __node_pointer __root, + __iter_pointer __result) const; + template + pair + __equal_range_unique(const _Key& __k); + template + pair + __equal_range_unique(const _Key& __k) const; + + template + pair + __equal_range_multi(const _Key& __k); + template + pair + __equal_range_multi(const _Key& __k) const; + + typedef __tree_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; + + __node_holder remove(const_iterator __p) noexcept; +private: + __node_base_pointer& + __find_leaf_low(__parent_pointer& __parent, const key_type& __v); + __node_base_pointer& + __find_leaf_high(__parent_pointer& __parent, const key_type& __v); + __node_base_pointer& + __find_leaf(const_iterator __hint, + __parent_pointer& __parent, const key_type& __v); + // FIXME: Make this function const qualified. Unfortunetly doing so + // breaks existing code which uses non-const callable comparators. + template + __node_base_pointer& + __find_equal(__parent_pointer& __parent, const _Key& __v); + template + _LIBCUDACXX_INLINE_VISIBILITY __node_base_pointer& + __find_equal(__parent_pointer& __parent, const _Key& __v) const { + return const_cast<__tree*>(this)->__find_equal(__parent, __v); + } + template + __node_base_pointer& + __find_equal(const_iterator __hint, __parent_pointer& __parent, + __node_base_pointer& __dummy, + const _Key& __v); + + template + __node_holder __construct_node(_Args&& ...__args); + + void destroy(__node_pointer __nd) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __tree& __t) + {__copy_assign_alloc(__t, integral_constant());} + + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __tree& __t, true_type) + { + if (__node_alloc() != __t.__node_alloc()) + clear(); + __node_alloc() = __t.__node_alloc(); + } + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __tree&, false_type) {} + + void __move_assign(__tree& __t, false_type); + void __move_assign(__tree& __t, true_type) + noexcept(is_nothrow_move_assignable::value && + is_nothrow_move_assignable<__node_allocator>::value); + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__tree& __t) + noexcept( + !__node_traits::propagate_on_container_move_assignment::value || + is_nothrow_move_assignable<__node_allocator>::value) + {__move_assign_alloc(__t, integral_constant());} + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__tree& __t, true_type) + noexcept(is_nothrow_move_assignable<__node_allocator>::value) + {__node_alloc() = _CUDA_VSTD::move(__t.__node_alloc());} + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__tree&, false_type) noexcept {} + + struct _DetachedTreeCache { + _LIBCUDACXX_INLINE_VISIBILITY + explicit _DetachedTreeCache(__tree *__t) noexcept : __t_(__t), + __cache_root_(__detach_from_tree(__t)) { + __advance(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __node_pointer __get() const noexcept { + return __cache_elem_; + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __advance() noexcept { + __cache_elem_ = __cache_root_; + if (__cache_root_) { + __cache_root_ = __detach_next(__cache_root_); + } + } + + _LIBCUDACXX_INLINE_VISIBILITY + ~_DetachedTreeCache() { + __t_->destroy(__cache_elem_); + if (__cache_root_) { + while (__cache_root_->__parent_ != nullptr) + __cache_root_ = static_cast<__node_pointer>(__cache_root_->__parent_); + __t_->destroy(__cache_root_); + } + } + + _DetachedTreeCache(_DetachedTreeCache const&) = delete; + _DetachedTreeCache& operator=(_DetachedTreeCache const&) = delete; + + private: + _LIBCUDACXX_INLINE_VISIBILITY + static __node_pointer __detach_from_tree(__tree *__t) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + static __node_pointer __detach_next(__node_pointer) noexcept; + + __tree *__t_; + __node_pointer __cache_root_; + __node_pointer __cache_elem_; + }; + + + template friend class _LIBCUDACXX_TEMPLATE_VIS map; + template friend class _LIBCUDACXX_TEMPLATE_VIS multimap; +}; + +template +__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) + noexcept( + is_nothrow_default_constructible<__node_allocator>::value && + is_nothrow_copy_constructible::value) + : __pair3_(0, __comp) +{ + __begin_node() = __end_node(); +} + +template +__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a) + : __begin_node_(__iter_pointer()), + __pair1_(__second_tag(), __node_allocator(__a)), + __pair3_(0) +{ + __begin_node() = __end_node(); +} + +template +__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp, + const allocator_type& __a) + : __begin_node_(__iter_pointer()), + __pair1_(__second_tag(), __node_allocator(__a)), + __pair3_(0, __comp) +{ + __begin_node() = __end_node(); +} + +// Precondition: size() != 0 +template +typename __tree<_Tp, _Compare, _Allocator>::__node_pointer +__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree *__t) noexcept +{ + __node_pointer __cache = static_cast<__node_pointer>(__t->__begin_node()); + __t->__begin_node() = __t->__end_node(); + __t->__end_node()->__left_->__parent_ = nullptr; + __t->__end_node()->__left_ = nullptr; + __t->size() = 0; + // __cache->__left_ == nullptr + if (__cache->__right_ != nullptr) + __cache = static_cast<__node_pointer>(__cache->__right_); + // __cache->__left_ == nullptr + // __cache->__right_ == nullptr + return __cache; +} + +// Precondition: __cache != nullptr +// __cache->left_ == nullptr +// __cache->right_ == nullptr +// This is no longer a red-black tree +template +typename __tree<_Tp, _Compare, _Allocator>::__node_pointer +__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_pointer __cache) noexcept +{ + if (__cache->__parent_ == nullptr) + return nullptr; + if (__tree_is_left_child(static_cast<__node_base_pointer>(__cache))) + { + __cache->__parent_->__left_ = nullptr; + __cache = static_cast<__node_pointer>(__cache->__parent_); + if (__cache->__right_ == nullptr) + return __cache; + return static_cast<__node_pointer>(__tree_leaf(__cache->__right_)); + } + // __cache is right child + __cache->__parent_unsafe()->__right_ = nullptr; + __cache = static_cast<__node_pointer>(__cache->__parent_); + if (__cache->__left_ == nullptr) + return __cache; + return static_cast<__node_pointer>(__tree_leaf(__cache->__left_)); +} + +template +__tree<_Tp, _Compare, _Allocator>& +__tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) +{ + if (this != &__t) + { + value_comp() = __t.value_comp(); + __copy_assign_alloc(__t); + __assign_multi(__t.begin(), __t.end()); + } + return *this; +} + +template +template +void +__tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last) +{ + typedef iterator_traits<_ForwardIterator> _ITraits; + typedef typename _ITraits::value_type _ItValueType; + static_assert((is_same<_ItValueType, __container_value_type>::value), + "__assign_unique may only be called with the containers value type"); + static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, + "__assign_unique requires a forward iterator"); + if (size() != 0) + { + _DetachedTreeCache __cache(this); + for (; __cache.__get() != nullptr && __first != __last; ++__first) { + if (__node_assign_unique(*__first, __cache.__get()).second) + __cache.__advance(); + } + } + for (; __first != __last; ++__first) + __insert_unique(*__first); +} + +template +template +void +__tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _InputIterator __last) +{ + typedef iterator_traits<_InputIterator> _ITraits; + typedef typename _ITraits::value_type _ItValueType; + static_assert((is_same<_ItValueType, __container_value_type>::value || + is_same<_ItValueType, __node_value_type>::value), + "__assign_multi may only be called with the containers value type" + " or the nodes value type"); + if (size() != 0) + { + _DetachedTreeCache __cache(this); + for (; __cache.__get() && __first != __last; ++__first) { + __cache.__get()->__value_ = *__first; + __node_insert_multi(__cache.__get()); + __cache.__advance(); + } + } + for (; __first != __last; ++__first) + __insert_multi(_NodeTypes::__get_value(*__first)); +} + +template +__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) + : __begin_node_(__iter_pointer()), + __pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())), + __pair3_(0, __t.value_comp()) +{ + __begin_node() = __end_node(); +} + +template +__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) + noexcept( + is_nothrow_move_constructible<__node_allocator>::value && + is_nothrow_move_constructible::value) + : __begin_node_(_CUDA_VSTD::move(__t.__begin_node_)), + __pair1_(_CUDA_VSTD::move(__t.__pair1_)), + __pair3_(_CUDA_VSTD::move(__t.__pair3_)) +{ + if (size() == 0) + __begin_node() = __end_node(); + else + { + __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node()); + __t.__begin_node() = __t.__end_node(); + __t.__end_node()->__left_ = nullptr; + __t.size() = 0; + } +} + +template +__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a) + : __pair1_(__second_tag(), __node_allocator(__a)), + __pair3_(0, _CUDA_VSTD::move(__t.value_comp())) +{ + if (__a == __t.__alloc()) + { + if (__t.size() == 0) + __begin_node() = __end_node(); + else + { + __begin_node() = __t.__begin_node(); + __end_node()->__left_ = __t.__end_node()->__left_; + __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node()); + size() = __t.size(); + __t.__begin_node() = __t.__end_node(); + __t.__end_node()->__left_ = nullptr; + __t.size() = 0; + } + } + else + { + __begin_node() = __end_node(); + } +} + +template +void +__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) + noexcept(is_nothrow_move_assignable::value && + is_nothrow_move_assignable<__node_allocator>::value) +{ + destroy(static_cast<__node_pointer>(__end_node()->__left_)); + __begin_node_ = __t.__begin_node_; + __pair1_.first() = __t.__pair1_.first(); + __move_assign_alloc(__t); + __pair3_ = _CUDA_VSTD::move(__t.__pair3_); + if (size() == 0) + __begin_node() = __end_node(); + else + { + __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node()); + __t.__begin_node() = __t.__end_node(); + __t.__end_node()->__left_ = nullptr; + __t.size() = 0; + } +} + +template +void +__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) +{ + if (__node_alloc() == __t.__node_alloc()) + __move_assign(__t, true_type()); + else + { + value_comp() = _CUDA_VSTD::move(__t.value_comp()); + const_iterator __e = end(); + if (size() != 0) + { + _DetachedTreeCache __cache(this); + while (__cache.__get() != nullptr && __t.size() != 0) { + __cache.__get()->__value_ = _CUDA_VSTD::move(__t.remove(__t.begin())->__value_); + __node_insert_multi(__cache.__get()); + __cache.__advance(); + } + } + while (__t.size() != 0) + __insert_multi(__e, _NodeTypes::__move(__t.remove(__t.begin())->__value_)); + } +} + +template +__tree<_Tp, _Compare, _Allocator>& +__tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t) + noexcept( + __node_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value && + is_nothrow_move_assignable<__node_allocator>::value) + +{ + __move_assign(__t, integral_constant()); + return *this; +} + +template +__tree<_Tp, _Compare, _Allocator>::~__tree() +{ + static_assert((is_copy_constructible::value), + "Comparator must be copy-constructible."); + destroy(__root()); +} + +template +void +__tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) noexcept +{ + if (__nd != nullptr) + { + destroy(static_cast<__node_pointer>(__nd->__left_)); + destroy(static_cast<__node_pointer>(__nd->__right_)); + __node_allocator& __na = __node_alloc(); + __node_traits::destroy(__na, _NodeTypes::__get_ptr(__nd->__value_)); + __node_traits::deallocate(__na, __nd, 1); + } +} + +template +void +__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) +#if _LIBCUDACXX_STD_VER <= 11 + noexcept( + __is_nothrow_swappable::value + && (!__node_traits::propagate_on_container_swap::value || + __is_nothrow_swappable<__node_allocator>::value) + ) +#else + noexcept(__is_nothrow_swappable::value) +#endif +{ + using _CUDA_VSTD::swap; + swap(__begin_node_, __t.__begin_node_); + swap(__pair1_.first(), __t.__pair1_.first()); + __swap_allocator(__node_alloc(), __t.__node_alloc()); + __pair3_.swap(__t.__pair3_); + if (size() == 0) + __begin_node() = __end_node(); + else + __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node()); + if (__t.size() == 0) + __t.__begin_node() = __t.__end_node(); + else + __t.__end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__t.__end_node()); +} + +template +void +__tree<_Tp, _Compare, _Allocator>::clear() noexcept +{ + destroy(__root()); + size() = 0; + __begin_node() = __end_node(); + __end_node()->__left_ = nullptr; +} + +// Find lower_bound place to insert +// Set __parent to parent of null leaf +// Return reference to null leaf +template +typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& +__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__parent_pointer& __parent, + const key_type& __v) +{ + __node_pointer __nd = __root(); + if (__nd != nullptr) + { + while (true) + { + if (value_comp()(__nd->__value_, __v)) + { + if (__nd->__right_ != nullptr) + __nd = static_cast<__node_pointer>(__nd->__right_); + else + { + __parent = static_cast<__parent_pointer>(__nd); + return __nd->__right_; + } + } + else + { + if (__nd->__left_ != nullptr) + __nd = static_cast<__node_pointer>(__nd->__left_); + else + { + __parent = static_cast<__parent_pointer>(__nd); + return __parent->__left_; + } + } + } + } + __parent = static_cast<__parent_pointer>(__end_node()); + return __parent->__left_; +} + +// Find upper_bound place to insert +// Set __parent to parent of null leaf +// Return reference to null leaf +template +typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& +__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__parent_pointer& __parent, + const key_type& __v) +{ + __node_pointer __nd = __root(); + if (__nd != nullptr) + { + while (true) + { + if (value_comp()(__v, __nd->__value_)) + { + if (__nd->__left_ != nullptr) + __nd = static_cast<__node_pointer>(__nd->__left_); + else + { + __parent = static_cast<__parent_pointer>(__nd); + return __parent->__left_; + } + } + else + { + if (__nd->__right_ != nullptr) + __nd = static_cast<__node_pointer>(__nd->__right_); + else + { + __parent = static_cast<__parent_pointer>(__nd); + return __nd->__right_; + } + } + } + } + __parent = static_cast<__parent_pointer>(__end_node()); + return __parent->__left_; +} + +// Find leaf place to insert closest to __hint +// First check prior to __hint. +// Next check after __hint. +// Next do O(log N) search. +// Set __parent to parent of null leaf +// Return reference to null leaf +template +typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& +__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint, + __parent_pointer& __parent, + const key_type& __v) +{ + if (__hint == end() || !value_comp()(*__hint, __v)) // check before + { + // __v <= *__hint + const_iterator __prior = __hint; + if (__prior == begin() || !value_comp()(__v, *--__prior)) + { + // *prev(__hint) <= __v <= *__hint + if (__hint.__ptr_->__left_ == nullptr) + { + __parent = static_cast<__parent_pointer>(__hint.__ptr_); + return __parent->__left_; + } + else + { + __parent = static_cast<__parent_pointer>(__prior.__ptr_); + return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_; + } + } + // __v < *prev(__hint) + return __find_leaf_high(__parent, __v); + } + // else __v > *__hint + return __find_leaf_low(__parent, __v); +} + +// Find place to insert if __v doesn't exist +// Set __parent to parent of null leaf +// Return reference to null leaf +// If __v exists, set parent to node of __v and return reference to node of __v +template +template +typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& +__tree<_Tp, _Compare, _Allocator>::__find_equal(__parent_pointer& __parent, + const _Key& __v) +{ + __node_pointer __nd = __root(); + __node_base_pointer* __nd_ptr = __root_ptr(); + if (__nd != nullptr) + { + while (true) + { + if (value_comp()(__v, __nd->__value_)) + { + if (__nd->__left_ != nullptr) { + __nd_ptr = _CUDA_VSTD::addressof(__nd->__left_); + __nd = static_cast<__node_pointer>(__nd->__left_); + } else { + __parent = static_cast<__parent_pointer>(__nd); + return __parent->__left_; + } + } + else if (value_comp()(__nd->__value_, __v)) + { + if (__nd->__right_ != nullptr) { + __nd_ptr = _CUDA_VSTD::addressof(__nd->__right_); + __nd = static_cast<__node_pointer>(__nd->__right_); + } else { + __parent = static_cast<__parent_pointer>(__nd); + return __nd->__right_; + } + } + else + { + __parent = static_cast<__parent_pointer>(__nd); + return *__nd_ptr; + } + } + } + __parent = static_cast<__parent_pointer>(__end_node()); + return __parent->__left_; +} + +// Find place to insert if __v doesn't exist +// First check prior to __hint. +// Next check after __hint. +// Next do O(log N) search. +// Set __parent to parent of null leaf +// Return reference to null leaf +// If __v exists, set parent to node of __v and return reference to node of __v +template +template +typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& +__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, + __parent_pointer& __parent, + __node_base_pointer& __dummy, + const _Key& __v) +{ + if (__hint == end() || value_comp()(__v, *__hint)) // check before + { + // __v < *__hint + const_iterator __prior = __hint; + if (__prior == begin() || value_comp()(*--__prior, __v)) + { + // *prev(__hint) < __v < *__hint + if (__hint.__ptr_->__left_ == nullptr) + { + __parent = static_cast<__parent_pointer>(__hint.__ptr_); + return __parent->__left_; + } + else + { + __parent = static_cast<__parent_pointer>(__prior.__ptr_); + return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_; + } + } + // __v <= *prev(__hint) + return __find_equal(__parent, __v); + } + else if (value_comp()(*__hint, __v)) // check after + { + // *__hint < __v + const_iterator __next = _CUDA_VSTD::next(__hint); + if (__next == end() || value_comp()(__v, *__next)) + { + // *__hint < __v < *_CUDA_VSTD::next(__hint) + if (__hint.__get_np()->__right_ == nullptr) + { + __parent = static_cast<__parent_pointer>(__hint.__ptr_); + return static_cast<__node_base_pointer>(__hint.__ptr_)->__right_; + } + else + { + __parent = static_cast<__parent_pointer>(__next.__ptr_); + return __parent->__left_; + } + } + // *next(__hint) <= __v + return __find_equal(__parent, __v); + } + // else __v == *__hint + __parent = static_cast<__parent_pointer>(__hint.__ptr_); + __dummy = static_cast<__node_base_pointer>(__hint.__ptr_); + return __dummy; +} + +template +void __tree<_Tp, _Compare, _Allocator>::__insert_node_at( + __parent_pointer __parent, __node_base_pointer& __child, + __node_base_pointer __new_node) noexcept +{ + __new_node->__left_ = nullptr; + __new_node->__right_ = nullptr; + __new_node->__parent_ = __parent; + // __new_node->__is_black_ is initialized in __tree_balance_after_insert + __child = __new_node; + if (__begin_node()->__left_ != nullptr) + __begin_node() = static_cast<__iter_pointer>(__begin_node()->__left_); + __tree_balance_after_insert(__end_node()->__left_, __child); + ++size(); +} + +template +template +pair::iterator, bool> +__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) +{ + __parent_pointer __parent; + __node_base_pointer& __child = __find_equal(__parent, __k); + __node_pointer __r = static_cast<__node_pointer>(__child); + bool __inserted = false; + if (__child == nullptr) + { + __node_holder __h = __construct_node(_CUDA_VSTD::forward<_Args>(__args)...); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); + __r = __h.release(); + __inserted = true; + } + return pair(iterator(__r), __inserted); +} + + +template +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args( + const_iterator __p, _Key const& __k, _Args&&... __args) +{ + __parent_pointer __parent; + __node_base_pointer __dummy; + __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k); + __node_pointer __r = static_cast<__node_pointer>(__child); + if (__child == nullptr) + { + __node_holder __h = __construct_node(_CUDA_VSTD::forward<_Args>(__args)...); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); + __r = __h.release(); + } + return iterator(__r); +} + + +template +template +typename __tree<_Tp, _Compare, _Allocator>::__node_holder +__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args) +{ + static_assert(!__is_tree_value_type<_Args...>::value, + "Cannot construct from __value_type"); + __node_allocator& __na = __node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), _CUDA_VSTD::forward<_Args>(__args)...); + __h.get_deleter().__value_constructed = true; + return __h; +} + + +template +template +pair::iterator, bool> +__tree<_Tp, _Compare, _Allocator>::__emplace_unique_impl(_Args&&... __args) +{ + __node_holder __h = __construct_node(_CUDA_VSTD::forward<_Args>(__args)...); + __parent_pointer __parent; + __node_base_pointer& __child = __find_equal(__parent, __h->__value_); + __node_pointer __r = static_cast<__node_pointer>(__child); + bool __inserted = false; + if (__child == nullptr) + { + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); + __r = __h.release(); + __inserted = true; + } + return pair(iterator(__r), __inserted); +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_impl(const_iterator __p, _Args&&... __args) +{ + __node_holder __h = __construct_node(_CUDA_VSTD::forward<_Args>(__args)...); + __parent_pointer __parent; + __node_base_pointer __dummy; + __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __h->__value_); + __node_pointer __r = static_cast<__node_pointer>(__child); + if (__child == nullptr) + { + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); + __r = __h.release(); + } + return iterator(__r); +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) +{ + __node_holder __h = __construct_node(_CUDA_VSTD::forward<_Args>(__args)...); + __parent_pointer __parent; + __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__h->__value_)); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); + return iterator(static_cast<__node_pointer>(__h.release())); +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, + _Args&&... __args) +{ + __node_holder __h = __construct_node(_CUDA_VSTD::forward<_Args>(__args)...); + __parent_pointer __parent; + __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__h->__value_)); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); + return iterator(static_cast<__node_pointer>(__h.release())); +} + +template +pair::iterator, bool> +__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd) +{ + __parent_pointer __parent; + __node_base_pointer& __child = __find_equal(__parent, _NodeTypes::__get_key(__v)); + __node_pointer __r = static_cast<__node_pointer>(__child); + bool __inserted = false; + if (__child == nullptr) + { + __nd->__value_ = __v; + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd)); + __r = __nd; + __inserted = true; + } + return pair(iterator(__r), __inserted); +} + + +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd) +{ + __parent_pointer __parent; + __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__nd->__value_)); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd)); + return iterator(__nd); +} + +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p, + __node_pointer __nd) +{ + __parent_pointer __parent; + __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__nd->__value_)); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd)); + return iterator(__nd); +} + +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) noexcept +{ + iterator __r(__ptr); + ++__r; + if (__begin_node() == __ptr) + __begin_node() = __r.__ptr_; + --size(); + __tree_remove(__end_node()->__left_, + static_cast<__node_base_pointer>(__ptr)); + return __r; +} + +#if _LIBCUDACXX_STD_VER > 14 +template +template +_LIBCUDACXX_INLINE_VISIBILITY +_InsertReturnType +__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique( + _NodeHandle&& __nh) +{ + if (__nh.empty()) + return _InsertReturnType{end(), false, _NodeHandle()}; + + __node_pointer __ptr = __nh.__ptr_; + __parent_pointer __parent; + __node_base_pointer& __child = __find_equal(__parent, + __ptr->__value_); + if (__child != nullptr) + return _InsertReturnType{ + iterator(static_cast<__node_pointer>(__child)), + false, _CUDA_VSTD::move(__nh)}; + + __insert_node_at(__parent, __child, + static_cast<__node_base_pointer>(__ptr)); + __nh.__release_ptr(); + return _InsertReturnType{iterator(__ptr), true, _NodeHandle()}; +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique( + const_iterator __hint, _NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + + __node_pointer __ptr = __nh.__ptr_; + __parent_pointer __parent; + __node_base_pointer __dummy; + __node_base_pointer& __child = __find_equal(__hint, __parent, __dummy, + __ptr->__value_); + __node_pointer __r = static_cast<__node_pointer>(__child); + if (__child == nullptr) + { + __insert_node_at(__parent, __child, + static_cast<__node_base_pointer>(__ptr)); + __r = __ptr; + __nh.__release_ptr(); + } + return iterator(__r); +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +_NodeHandle +__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key) +{ + iterator __it = find(__key); + if (__it == end()) + return _NodeHandle(); + return __node_handle_extract<_NodeHandle>(__it); +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +_NodeHandle +__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) +{ + __node_pointer __np = __p.__get_np(); + __remove_node_pointer(__np); + return _NodeHandle(__np, __alloc()); +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +void +__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(_Tree& __source) +{ + static_assert(is_same::value, ""); + + for (typename _Tree::iterator __i = __source.begin(); + __i != __source.end();) + { + __node_pointer __src_ptr = __i.__get_np(); + __parent_pointer __parent; + __node_base_pointer& __child = + __find_equal(__parent, _NodeTypes::__get_key(__src_ptr->__value_)); + ++__i; + if (__child != nullptr) + continue; + __source.__remove_node_pointer(__src_ptr); + __insert_node_at(__parent, __child, + static_cast<__node_base_pointer>(__src_ptr)); + } +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + __node_pointer __ptr = __nh.__ptr_; + __parent_pointer __parent; + __node_base_pointer& __child = __find_leaf_high( + __parent, _NodeTypes::__get_key(__ptr->__value_)); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr)); + __nh.__release_ptr(); + return iterator(__ptr); +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi( + const_iterator __hint, _NodeHandle&& __nh) +{ + if (__nh.empty()) + return end(); + + __node_pointer __ptr = __nh.__ptr_; + __parent_pointer __parent; + __node_base_pointer& __child = __find_leaf(__hint, __parent, + _NodeTypes::__get_key(__ptr->__value_)); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr)); + __nh.__release_ptr(); + return iterator(__ptr); +} + +template +template +_LIBCUDACXX_INLINE_VISIBILITY +void +__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(_Tree& __source) +{ + static_assert(is_same::value, ""); + + for (typename _Tree::iterator __i = __source.begin(); + __i != __source.end();) + { + __node_pointer __src_ptr = __i.__get_np(); + __parent_pointer __parent; + __node_base_pointer& __child = __find_leaf_high( + __parent, _NodeTypes::__get_key(__src_ptr->__value_)); + ++__i; + __source.__remove_node_pointer(__src_ptr); + __insert_node_at(__parent, __child, + static_cast<__node_base_pointer>(__src_ptr)); + } +} + +#endif // _LIBCUDACXX_STD_VER > 14 + +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) +{ + __node_pointer __np = __p.__get_np(); + iterator __r = __remove_node_pointer(__np); + __node_allocator& __na = __node_alloc(); + __node_traits::destroy(__na, _NodeTypes::__get_ptr( + const_cast<__node_value_type&>(*__p))); + __node_traits::deallocate(__na, __np, 1); + return __r; +} + +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l) +{ + while (__f != __l) + __f = erase(__f); + return iterator(__l.__ptr_); +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::size_type +__tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) +{ + iterator __i = find(__k); + if (__i == end()) + return 0; + erase(__i); + return 1; +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::size_type +__tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) +{ + pair __p = __equal_range_multi(__k); + size_type __r = 0; + for (; __p.first != __p.second; ++__r) + __p.first = erase(__p.first); + return __r; +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) +{ + iterator __p = __lower_bound(__v, __root(), __end_node()); + if (__p != end() && !value_comp()(__v, *__p)) + return __p; + return end(); +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::const_iterator +__tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) const +{ + const_iterator __p = __lower_bound(__v, __root(), __end_node()); + if (__p != end() && !value_comp()(__v, *__p)) + return __p; + return end(); +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::size_type +__tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const +{ + __node_pointer __rt = __root(); + while (__rt != nullptr) + { + if (value_comp()(__k, __rt->__value_)) + { + __rt = static_cast<__node_pointer>(__rt->__left_); + } + else if (value_comp()(__rt->__value_, __k)) + __rt = static_cast<__node_pointer>(__rt->__right_); + else + return 1; + } + return 0; +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::size_type +__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const +{ + __iter_pointer __result = __end_node(); + __node_pointer __rt = __root(); + while (__rt != nullptr) + { + if (value_comp()(__k, __rt->__value_)) + { + __result = static_cast<__iter_pointer>(__rt); + __rt = static_cast<__node_pointer>(__rt->__left_); + } + else if (value_comp()(__rt->__value_, __k)) + __rt = static_cast<__node_pointer>(__rt->__right_); + else + return _CUDA_VSTD::distance( + __lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)), + __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result) + ); + } + return 0; +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, + __node_pointer __root, + __iter_pointer __result) +{ + while (__root != nullptr) + { + if (!value_comp()(__root->__value_, __v)) + { + __result = static_cast<__iter_pointer>(__root); + __root = static_cast<__node_pointer>(__root->__left_); + } + else + __root = static_cast<__node_pointer>(__root->__right_); + } + return iterator(__result); +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::const_iterator +__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, + __node_pointer __root, + __iter_pointer __result) const +{ + while (__root != nullptr) + { + if (!value_comp()(__root->__value_, __v)) + { + __result = static_cast<__iter_pointer>(__root); + __root = static_cast<__node_pointer>(__root->__left_); + } + else + __root = static_cast<__node_pointer>(__root->__right_); + } + return const_iterator(__result); +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, + __node_pointer __root, + __iter_pointer __result) +{ + while (__root != nullptr) + { + if (value_comp()(__v, __root->__value_)) + { + __result = static_cast<__iter_pointer>(__root); + __root = static_cast<__node_pointer>(__root->__left_); + } + else + __root = static_cast<__node_pointer>(__root->__right_); + } + return iterator(__result); +} + +template +template +typename __tree<_Tp, _Compare, _Allocator>::const_iterator +__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, + __node_pointer __root, + __iter_pointer __result) const +{ + while (__root != nullptr) + { + if (value_comp()(__v, __root->__value_)) + { + __result = static_cast<__iter_pointer>(__root); + __root = static_cast<__node_pointer>(__root->__left_); + } + else + __root = static_cast<__node_pointer>(__root->__right_); + } + return const_iterator(__result); +} + +template +template +pair::iterator, + typename __tree<_Tp, _Compare, _Allocator>::iterator> +__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) +{ + typedef pair _Pp; + __iter_pointer __result = __end_node(); + __node_pointer __rt = __root(); + while (__rt != nullptr) + { + if (value_comp()(__k, __rt->__value_)) + { + __result = static_cast<__iter_pointer>(__rt); + __rt = static_cast<__node_pointer>(__rt->__left_); + } + else if (value_comp()(__rt->__value_, __k)) + __rt = static_cast<__node_pointer>(__rt->__right_); + else + return _Pp(iterator(__rt), + iterator( + __rt->__right_ != nullptr ? + static_cast<__iter_pointer>(__tree_min(__rt->__right_)) + : __result)); + } + return _Pp(iterator(__result), iterator(__result)); +} + +template +template +pair::const_iterator, + typename __tree<_Tp, _Compare, _Allocator>::const_iterator> +__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const +{ + typedef pair _Pp; + __iter_pointer __result = __end_node(); + __node_pointer __rt = __root(); + while (__rt != nullptr) + { + if (value_comp()(__k, __rt->__value_)) + { + __result = static_cast<__iter_pointer>(__rt); + __rt = static_cast<__node_pointer>(__rt->__left_); + } + else if (value_comp()(__rt->__value_, __k)) + __rt = static_cast<__node_pointer>(__rt->__right_); + else + return _Pp(const_iterator(__rt), + const_iterator( + __rt->__right_ != nullptr ? + static_cast<__iter_pointer>(__tree_min(__rt->__right_)) + : __result)); + } + return _Pp(const_iterator(__result), const_iterator(__result)); +} + +template +template +pair::iterator, + typename __tree<_Tp, _Compare, _Allocator>::iterator> +__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) +{ + typedef pair _Pp; + __iter_pointer __result = __end_node(); + __node_pointer __rt = __root(); + while (__rt != nullptr) + { + if (value_comp()(__k, __rt->__value_)) + { + __result = static_cast<__iter_pointer>(__rt); + __rt = static_cast<__node_pointer>(__rt->__left_); + } + else if (value_comp()(__rt->__value_, __k)) + __rt = static_cast<__node_pointer>(__rt->__right_); + else + return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)), + __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result)); + } + return _Pp(iterator(__result), iterator(__result)); +} + +template +template +pair::const_iterator, + typename __tree<_Tp, _Compare, _Allocator>::const_iterator> +__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const +{ + typedef pair _Pp; + __iter_pointer __result = __end_node(); + __node_pointer __rt = __root(); + while (__rt != nullptr) + { + if (value_comp()(__k, __rt->__value_)) + { + __result = static_cast<__iter_pointer>(__rt); + __rt = static_cast<__node_pointer>(__rt->__left_); + } + else if (value_comp()(__rt->__value_, __k)) + __rt = static_cast<__node_pointer>(__rt->__right_); + else + return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)), + __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result)); + } + return _Pp(const_iterator(__result), const_iterator(__result)); +} + +template +typename __tree<_Tp, _Compare, _Allocator>::__node_holder +__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) noexcept +{ + __node_pointer __np = __p.__get_np(); + if (__begin_node() == __p.__ptr_) + { + if (__np->__right_ != nullptr) + __begin_node() = static_cast<__iter_pointer>(__np->__right_); + else + __begin_node() = static_cast<__iter_pointer>(__np->__parent_); + } + --size(); + __tree_remove(__end_node()->__left_, + static_cast<__node_base_pointer>(__np)); + return __node_holder(__np, _Dp(__node_alloc(), true)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(__tree<_Tp, _Compare, _Allocator>& __x, + __tree<_Tp, _Compare, _Allocator>& __y) + noexcept(noexcept(__x.swap(__y))) +{ + __x.swap(__y); +} + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX___TREE diff --git a/cuda_toolkit/include/__undef_macros b/cuda_toolkit/include/__undef_macros new file mode 100644 index 0000000000000000000000000000000000000000..37594493df25343addd991683deb77b4d30dbad9 --- /dev/null +++ b/cuda_toolkit/include/__undef_macros @@ -0,0 +1,33 @@ +// -*- C++ -*- +//===------------------------ __undef_macros ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + + +#ifdef min +#if !defined(_LIBCUDACXX_DISABLE_MACRO_CONFLICT_WARNINGS) +#if defined(_LIBCUDACXX_WARNING) +_LIBCUDACXX_WARNING("macro min is incompatible with C++. Try #define NOMINMAX " + "before any Windows header. #undefing min") +#else +#warning: macro min is incompatible with C++. #undefing min +#endif +#endif +#undef min +#endif + +#ifdef max +#if !defined(_LIBCUDACXX_DISABLE_MACRO_CONFLICT_WARNINGS) +#if defined(_LIBCUDACXX_WARNING) +_LIBCUDACXX_WARNING("macro max is incompatible with C++. Try #define NOMINMAX " + "before any Windows header. #undefing max") +#else +#warning: macro max is incompatible with C++. #undefing max +#endif +#endif +#undef max +#endif diff --git a/cuda_toolkit/include/__verbose_abort b/cuda_toolkit/include/__verbose_abort new file mode 100644 index 0000000000000000000000000000000000000000..9d4256a5b2ce825303a294e9837cd86b4712c126 --- /dev/null +++ b/cuda_toolkit/include/__verbose_abort @@ -0,0 +1,59 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX___VERBOSE_ABORT +#define _LIBCUDACXX___VERBOSE_ABORT + +#ifndef __cuda_std__ +#include <__config> +#endif // __cuda_std__ + +#include "__availability" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// Provide a default implementation of __libcpp_verbose_abort if we know that neither the built +// library nor the user is providing one. Otherwise, just declare it and use the one from the +// built library or the one provided by the user. +// +// We can't provide a great implementation because it needs to be pretty much +// dependency-free (this is included everywhere else in the library). +#if defined(_LIBCUDACXX_HAS_NO_VERBOSE_ABORT_IN_LIBRARY) && !defined(_LIBCUDACXX_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED) + +extern "C" void abort(); + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +_LIBCUDACXX_NORETURN _LIBCUDACXX_ATTRIBUTE_FORMAT(__printf__, 1, 2) _LIBCUDACXX_HIDE_FROM_ABI inline +void __libcpp_verbose_abort(const char *, ...) { + ::abort(); + __builtin_unreachable(); // never reached, but needed to tell the compiler that the function never returns +} + +_LIBCUDACXX_END_NAMESPACE_STD + +#else + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +_LIBCUDACXX_NORETURN _LIBCUDACXX_OVERRIDABLE_FUNC_VIS _LIBCUDACXX_ATTRIBUTE_FORMAT(__printf__, 1, 2) +void __libcpp_verbose_abort(const char *__format, ...); + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif + +#endif // _LIBCUDACXX___VERBOSE_ABORT diff --git a/cuda_toolkit/include/algorithm b/cuda_toolkit/include/algorithm new file mode 100644 index 0000000000000000000000000000000000000000..b9e86d1e454bd4b649bca605c0d84c315f512e6a --- /dev/null +++ b/cuda_toolkit/include/algorithm @@ -0,0 +1,5766 @@ +// -*- C++ -*- +//===-------------------------- algorithm ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_ALGORITHM +#define _LIBCUDACXX_ALGORITHM + +/* + algorithm synopsis + +#include + +namespace std +{ + +template + constexpr bool // constexpr in C++20 + all_of(InputIterator first, InputIterator last, Predicate pred); + +template + constexpr bool // constexpr in C++20 + any_of(InputIterator first, InputIterator last, Predicate pred); + +template + constexpr bool // constexpr in C++20 + none_of(InputIterator first, InputIterator last, Predicate pred); + +template + constexpr Function // constexpr in C++20 + for_each(InputIterator first, InputIterator last, Function f); + +template + constexpr InputIterator // constexpr in C++20 + for_each_n(InputIterator first, Size n, Function f); // C++17 + +template + constexpr InputIterator // constexpr in C++20 + find(InputIterator first, InputIterator last, const T& value); + +template + constexpr InputIterator // constexpr in C++20 + find_if(InputIterator first, InputIterator last, Predicate pred); + +template + InputIterator // constexpr in C++20 + find_if_not(InputIterator first, InputIterator last, Predicate pred); + +template + ForwardIterator1 // constexpr in C++20 + find_end(ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2); + +template + ForwardIterator1 // constexpr in C++20 + find_end(ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); + +template + constexpr ForwardIterator1 // constexpr in C++20 + find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2); + +template + constexpr ForwardIterator1 // constexpr in C++20 + find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); + +template + constexpr ForwardIterator // constexpr in C++20 + adjacent_find(ForwardIterator first, ForwardIterator last); + +template + constexpr ForwardIterator // constexpr in C++20 + adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); + +template + constexpr typename iterator_traits::difference_type // constexpr in C++20 + count(InputIterator first, InputIterator last, const T& value); + +template + constexpr typename iterator_traits::difference_type // constexpr in C++20 + count_if(InputIterator first, InputIterator last, Predicate pred); + +template + constexpr pair // constexpr in C++20 + mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); + +template + constexpr pair // constexpr in C++20 + mismatch(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2); // **C++14** + +template + constexpr pair // constexpr in C++20 + mismatch(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, BinaryPredicate pred); + +template + constexpr pair // constexpr in C++20 + mismatch(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + BinaryPredicate pred); // **C++14** + +template + constexpr bool // constexpr in C++20 + equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2); + +template + constexpr bool // constexpr in C++20 + equal(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2); // **C++14** + +template + constexpr bool // constexpr in C++20 + equal(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, BinaryPredicate pred); + +template + constexpr bool // constexpr in C++20 + equal(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + BinaryPredicate pred); // **C++14** + +template + constexpr bool // constexpr in C++20 + is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2); + +template + constexpr bool // constexpr in C++20 + is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2); // **C++14** + +template + constexpr bool // constexpr in C++20 + is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, BinaryPredicate pred); + +template + constexpr bool // constexpr in C++20 + is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + BinaryPredicate pred); // **C++14** + +template + constexpr ForwardIterator1 // constexpr in C++20 + search(ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2); + +template + constexpr ForwardIterator1 // constexpr in C++20 + search(ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); + +template + constexpr ForwardIterator // constexpr in C++20 + search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value); + +template + constexpr ForwardIterator // constexpr in C++20 + search_n(ForwardIterator first, ForwardIterator last, + Size count, const T& value, BinaryPredicate pred); + +template + OutputIterator + copy(InputIterator first, InputIterator last, OutputIterator result); + +template + OutputIterator + copy_if(InputIterator first, InputIterator last, + OutputIterator result, Predicate pred); + +template + OutputIterator + copy_n(InputIterator first, Size n, OutputIterator result); + +template + BidirectionalIterator2 + copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, + BidirectionalIterator2 result); + +template + ForwardIterator2 + swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); + +template + void + iter_swap(ForwardIterator1 a, ForwardIterator2 b); + +template + constexpr OutputIterator // constexpr in C++20 + transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op); + +template + constexpr OutputIterator // constexpr in C++20 + transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, + OutputIterator result, BinaryOperation binary_op); + +template + constexpr void // constexpr in C++20 + replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value); + +template + constexpr void // constexpr in C++20 + replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value); + +template + constexpr OutputIterator // constexpr in C++20 + replace_copy(InputIterator first, InputIterator last, OutputIterator result, + const T& old_value, const T& new_value); + +template + constexpr OutputIterator // constexpr in C++20 + replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value); + +template + constexpr void // constexpr in C++20 + fill(ForwardIterator first, ForwardIterator last, const T& value); + +template + constexpr OutputIterator // constexpr in C++20 + fill_n(OutputIterator first, Size n, const T& value); + +template + constexpr void // constexpr in C++20 + generate(ForwardIterator first, ForwardIterator last, Generator gen); + +template + constexpr OutputIterator // constexpr in C++20 + generate_n(OutputIterator first, Size n, Generator gen); + +template + constexpr ForwardIterator // constexpr in C++20 + remove(ForwardIterator first, ForwardIterator last, const T& value); + +template + constexpr ForwardIterator // constexpr in C++20 + remove_if(ForwardIterator first, ForwardIterator last, Predicate pred); + +template + constexpr OutputIterator // constexpr in C++20 + remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value); + +template + constexpr OutputIterator // constexpr in C++20 + remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred); + +template + ForwardIterator + unique(ForwardIterator first, ForwardIterator last); + +template + ForwardIterator + unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); + +template + OutputIterator + unique_copy(InputIterator first, InputIterator last, OutputIterator result); + +template + OutputIterator + unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred); + +template + void + reverse(BidirectionalIterator first, BidirectionalIterator last); + +template + constexpr OutputIterator // constexpr in C++20 + reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result); + +template + ForwardIterator + rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last); + +template + OutputIterator + rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result); + +template + void + random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17 + +template + void + random_shuffle(RandomAccessIterator first, RandomAccessIterator last, + RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17 + +template + SampleIterator sample(PopulationIterator first, PopulationIterator last, + SampleIterator out, Distance n, + UniformRandomBitGenerator&& g); // C++17 + +template + void shuffle(RandomAccessIterator first, RandomAccessIterator last, + UniformRandomNumberGenerator&& g); + +template + constexpr bool // constexpr in C++20 + is_partitioned(InputIterator first, InputIterator last, Predicate pred); + +template + ForwardIterator + partition(ForwardIterator first, ForwardIterator last, Predicate pred); + +template + constexpr pair // constexpr in C++20 + partition_copy(InputIterator first, InputIterator last, + OutputIterator1 out_true, OutputIterator2 out_false, + Predicate pred); + +template + ForwardIterator + stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred); + +template + constexpr ForwardIterator // constexpr in C++20 + partition_point(ForwardIterator first, ForwardIterator last, Predicate pred); + +template + constexpr bool // constexpr in C++20 + is_sorted(ForwardIterator first, ForwardIterator last); + +template + bool + is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); + +template + constexpr ForwardIterator // constexpr in C++20 + is_sorted_until(ForwardIterator first, ForwardIterator last); + +template + constexpr ForwardIterator // constexpr in C++20 + is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp); + +template + void + sort(RandomAccessIterator first, RandomAccessIterator last); + +template + void + sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + +template + void + stable_sort(RandomAccessIterator first, RandomAccessIterator last); + +template + void + stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + +template + void + partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last); + +template + void + partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp); + +template + RandomAccessIterator + partial_sort_copy(InputIterator first, InputIterator last, + RandomAccessIterator result_first, RandomAccessIterator result_last); + +template + RandomAccessIterator + partial_sort_copy(InputIterator first, InputIterator last, + RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp); + +template + void + nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last); + +template + void + nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp); + +template + constexpr ForwardIterator // constexpr in C++20 + lower_bound(ForwardIterator first, ForwardIterator last, const T& value); + +template + constexpr ForwardIterator // constexpr in C++20 + lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); + +template + constexpr ForwardIterator // constexpr in C++20 + upper_bound(ForwardIterator first, ForwardIterator last, const T& value); + +template + constexpr ForwardIterator // constexpr in C++20 + upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); + +template + constexpr pair // constexpr in C++20 + equal_range(ForwardIterator first, ForwardIterator last, const T& value); + +template + constexpr pair // constexpr in C++20 + equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); + +template + constexpr bool // constexpr in C++20 + binary_search(ForwardIterator first, ForwardIterator last, const T& value); + +template + constexpr bool // constexpr in C++20 + binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); + +template + OutputIterator + merge(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, OutputIterator result); + +template + OutputIterator + merge(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); + +template + void + inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last); + +template + void + inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp); + +template + constexpr bool // constexpr in C++20 + includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); + +template + constexpr bool // constexpr in C++20 + includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp); + +template + OutputIterator + set_union(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, OutputIterator result); + +template + OutputIterator + set_union(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); + +template + constexpr OutputIterator // constexpr in C++20 + set_intersection(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, OutputIterator result); + +template + constexpr OutputIterator // constexpr in C++20 + set_intersection(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); + +template + OutputIterator + set_difference(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, OutputIterator result); + +template + OutputIterator + set_difference(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); + +template + OutputIterator + set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, OutputIterator result); + +template + OutputIterator + set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); + +template + void + push_heap(RandomAccessIterator first, RandomAccessIterator last); + +template + void + push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + +template + void + pop_heap(RandomAccessIterator first, RandomAccessIterator last); + +template + void + pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + +template + void + make_heap(RandomAccessIterator first, RandomAccessIterator last); + +template + void + make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + +template + void + sort_heap(RandomAccessIterator first, RandomAccessIterator last); + +template + void + sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + +template + constexpr bool // constexpr in C++20 + is_heap(RandomAccessIterator first, RandomAccessiterator last); + +template + constexpr bool // constexpr in C++20 + is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp); + +template + constexpr RandomAccessIterator // constexpr in C++20 + is_heap_until(RandomAccessIterator first, RandomAccessiterator last); + +template + constexpr RandomAccessIterator // constexpr in C++20 + is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp); + +template + ForwardIterator + min_element(ForwardIterator first, ForwardIterator last); // constexpr in C++14 + +template + ForwardIterator + min_element(ForwardIterator first, ForwardIterator last, Compare comp); // constexpr in C++14 + +template + const T& + min(const T& a, const T& b); // constexpr in C++14 + +template + const T& + min(const T& a, const T& b, Compare comp); // constexpr in C++14 + +template + T + min(::std::initializer_list t); // constexpr in C++14 + +template + T + min(::std::initializer_list t, Compare comp); // constexpr in C++14 + +template + constexpr const T& clamp( const T& v, const T& lo, const T& hi ); // C++17 + +template + constexpr const T& clamp( const T& v, const T& lo, const T& hi, Compare comp ); // C++17 + +template + ForwardIterator + max_element(ForwardIterator first, ForwardIterator last); // constexpr in C++14 + +template + ForwardIterator + max_element(ForwardIterator first, ForwardIterator last, Compare comp); // constexpr in C++14 + +template + const T& + max(const T& a, const T& b); // constexpr in C++14 + +template + const T& + max(const T& a, const T& b, Compare comp); // constexpr in C++14 + +template + T + max(::std::initializer_list t); // constexpr in C++14 + +template + T + max(::std::initializer_list t, Compare comp); // constexpr in C++14 + +template + pair + minmax_element(ForwardIterator first, ForwardIterator last); // constexpr in C++14 + +template + pair + minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); // constexpr in C++14 + +template + pair + minmax(const T& a, const T& b); // constexpr in C++14 + +template + pair + minmax(const T& a, const T& b, Compare comp); // constexpr in C++14 + +template + pair + minmax(::std::initializer_list t); // constexpr in C++14 + +template + pair + minmax(::std::initializer_list t, Compare comp); // constexpr in C++14 + +template + constexpr bool // constexpr in C++20 + lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2); + +template + constexpr bool // constexpr in C++20 + lexicographical_compare(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, Compare comp); + +template + bool + next_permutation(BidirectionalIterator first, BidirectionalIterator last); + +template + bool + next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); + +template + bool + prev_permutation(BidirectionalIterator first, BidirectionalIterator last); + +template + bool + prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); + +} // std + +*/ +#ifndef __cuda_std__ +#include <__config> +#include +#include +#endif // __cuda_std__ + +#include "__algorithm/swap_ranges.h" +#include "__assert" // all public C++ headers provide the assertion handler +#include "__debug" +#include "__iterator/distance.h" +#include "__iterator/iterator_traits.h" +#include "__iterator/move_iterator.h" +#include "__iterator/next.h" +#include "__iterator/prev.h" +#include "__iterator/reverse_iterator.h" +#include "__iterator/wrap_iter.h" +#include "__type_traits/common_type.h" +#include "__type_traits/enable_if.h" +#include "__type_traits/is_integral.h" +#include "__type_traits/is_same.h" +#include "__type_traits/is_trivially_copy_assignable.h" +#include "__type_traits/make_unsigned.h" +#include "__type_traits/remove_const.h" +#include "bit" +#include "cstddef" +#include "functional" +#include "initializer_list" +#include "type_traits" +#include "version" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +// I'd like to replace these with _CUDA_VSTD::equal_to, but can't because: +// * That only works with C++14 and later, and +// * We haven't included here. +template +struct __equal_to +{ + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 bool operator()(const _T1& __x, const _T2& __y) const {return __x == __y;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 bool operator()(const _T2& __x, const _T1& __y) const {return __x == __y;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 bool operator()(const _T2& __x, const _T2& __y) const {return __x == __y;} +}; + +template +struct __equal_to<_T1, _T1> +{ + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} +}; + +template +struct __equal_to +{ + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} +}; + +template +struct __equal_to<_T1, const _T1> +{ + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} +}; + +template +struct __less +{ + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T2& __y) const {return __x < __y;} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T2& __x, const _T1& __y) const {return __x < __y;} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T2& __x, const _T2& __y) const {return __x < __y;} +}; + +template +struct __less<_T1, _T1> +{ + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} +}; + +template +struct __less +{ + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} +}; + +template +struct __less<_T1, const _T1> +{ + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} +}; + +#ifndef __cuda_std__ + +template +class __invert // invert the sense of a comparison +{ +private: + _Predicate __p_; +public: + _LIBCUDACXX_INLINE_VISIBILITY __invert() {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __invert(_Predicate __p) : __p_(__p) {} + + template + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()(const _T1& __x) {return !__p_(__x);} + + template + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()(const _T1& __x, const _T2& __y) {return __p_(__y, __x);} +}; + +// Perform division by two quickly for positive integers (llvm.org/PR39129) + +template +_LIBCUDACXX_INLINE_VISIBILITY constexpr +__enable_if_t +< + is_integral<_Integral>::value, + _Integral +> +__half_positive(_Integral __value) +{ + return static_cast<_Integral>(static_cast<__make_unsigned_t<_Integral>>(__value) / 2); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY constexpr +__enable_if_t +< + !is_integral<_Tp>::value, + _Tp +> +__half_positive(_Tp __value) +{ + return __value / 2; +} + +#ifdef _LIBCUDACXX_DEBUG + +template +struct __debug_less +{ + _Compare &__comp_; + _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 + __debug_less(_Compare& __c) : __comp_(__c) {} + + template + _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 + bool operator()(const _Tp& __x, const _Up& __y) + { + bool __r = __comp_(__x, __y); + if (__r) + __do_compare_assert(0, __y, __x); + return __r; + } + + template + _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 + bool operator()(_Tp& __x, _Up& __y) + { + bool __r = __comp_(__x, __y); + if (__r) + __do_compare_assert(0, __y, __x); + return __r; + } + + template + _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 + inline _LIBCUDACXX_INLINE_VISIBILITY + decltype((void)_CUDA_VSTD::declval<_Compare&>()( + _CUDA_VSTD::declval<_LHS &>(), _CUDA_VSTD::declval<_RHS &>())) + __do_compare_assert(int, _LHS & __l, _RHS & __r) { + _LIBCUDACXX_ASSERT(!__comp_(__l, __r), + "Comparator does not induce a strict weak ordering"); + } + + template + _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 + inline _LIBCUDACXX_INLINE_VISIBILITY + void __do_compare_assert(long, _LHS &, _RHS &) {} +}; + +#endif // _LIBCUDACXX_DEBUG + +#endif // __cuda_std__ + +template +struct __comp_ref_type { + // Pass the comparator by lvalue reference. Or in debug mode, using a + // debugging wrapper that stores a reference. +#ifndef _LIBCUDACXX_DEBUG + typedef __add_lvalue_reference_t<_Comp> type; +#else + typedef __debug_less<_Comp> type; +#endif +}; + +#ifndef __cuda_std__ +// all_of + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) +{ + for (; __first != __last; ++__first) + if (!__pred(*__first)) + return false; + return true; +} + +// any_of + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) +{ + for (; __first != __last; ++__first) + if (__pred(*__first)) + return true; + return false; +} + +// none_of + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) +{ + for (; __first != __last; ++__first) + if (__pred(*__first)) + return false; + return true; +} + +// for_each + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_Function +for_each(_InputIterator __first, _InputIterator __last, _Function __f) +{ + for (; __first != __last; ++__first) + __f(*__first); + return __f; +} + +#if _LIBCUDACXX_STD_VER > 14 +// for_each_n + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_InputIterator +for_each_n(_InputIterator __first, _Size __orig_n, _Function __f) +{ + typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; + _IntegralSize __n = __orig_n; + while (__n > 0) + { + __f(*__first); + ++__first; + --__n; + } + return __first; +} +#endif + +// find + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_InputIterator +find(_InputIterator __first, _InputIterator __last, const _Tp& __value_) +{ + for (; __first != __last; ++__first) + if (*__first == __value_) + break; + return __first; +} + +// find_if + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_InputIterator +find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) +{ + for (; __first != __last; ++__first) + if (__pred(*__first)) + break; + return __first; +} + +// find_if_not + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_InputIterator +find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) +{ + for (; __first != __last; ++__first) + if (!__pred(*__first)) + break; + return __first; +} + +// find_end + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 +__find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred, + forward_iterator_tag, forward_iterator_tag) +{ + // modeled after search algorithm + _ForwardIterator1 __r = __last1; // __last1 is the "default" answer + if (__first2 == __last2) + return __r; + while (true) + { + while (true) + { + if (__first1 == __last1) // if source exhausted return last correct answer + return __r; // (or __last1 if never found) + if (__pred(*__first1, *__first2)) + break; + ++__first1; + } + // *__first1 matches *__first2, now match elements after here + _ForwardIterator1 __m1 = __first1; + _ForwardIterator2 __m2 = __first2; + while (true) + { + if (++__m2 == __last2) + { // Pattern exhaused, record answer and search for another one + __r = __first1; + ++__first1; + break; + } + if (++__m1 == __last1) // Source exhausted, return last answer + return __r; + if (!__pred(*__m1, *__m2)) // mismatch, restart with a new __first + { + ++__first1; + break; + } // else there is a match, check next elements + } + } +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _BidirectionalIterator1 +__find_end(_BidirectionalIterator1 __first1, _BidirectionalIterator1 __last1, + _BidirectionalIterator2 __first2, _BidirectionalIterator2 __last2, _BinaryPredicate __pred, + bidirectional_iterator_tag, bidirectional_iterator_tag) +{ + // modeled after search algorithm (in reverse) + if (__first2 == __last2) + return __last1; // Everything matches an empty sequence + _BidirectionalIterator1 __l1 = __last1; + _BidirectionalIterator2 __l2 = __last2; + --__l2; + while (true) + { + // Find last element in sequence 1 that matchs *(__last2-1), with a mininum of loop checks + while (true) + { + if (__first1 == __l1) // return __last1 if no element matches *__first2 + return __last1; + if (__pred(*--__l1, *__l2)) + break; + } + // *__l1 matches *__l2, now match elements before here + _BidirectionalIterator1 __m1 = __l1; + _BidirectionalIterator2 __m2 = __l2; + while (true) + { + if (__m2 == __first2) // If pattern exhausted, __m1 is the answer (works for 1 element pattern) + return __m1; + if (__m1 == __first1) // Otherwise if source exhaused, pattern not found + return __last1; + if (!__pred(*--__m1, *--__m2)) // if there is a mismatch, restart with a new __l1 + { + break; + } // else there is a match, check next elements + } + } +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1 +__find_end(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, + _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred, + random_access_iterator_tag, random_access_iterator_tag) +{ + // Take advantage of knowing source and pattern lengths. Stop short when source is smaller than pattern + typename iterator_traits<_RandomAccessIterator2>::difference_type __len2 = __last2 - __first2; + if (__len2 == 0) + return __last1; + typename iterator_traits<_RandomAccessIterator1>::difference_type __len1 = __last1 - __first1; + if (__len1 < __len2) + return __last1; + const _RandomAccessIterator1 __s = __first1 + (__len2 - 1); // End of pattern match can't go before here + _RandomAccessIterator1 __l1 = __last1; + _RandomAccessIterator2 __l2 = __last2; + --__l2; + while (true) + { + while (true) + { + if (__s == __l1) + return __last1; + if (__pred(*--__l1, *__l2)) + break; + } + _RandomAccessIterator1 __m1 = __l1; + _RandomAccessIterator2 __m2 = __l2; + while (true) + { + if (__m2 == __first2) + return __m1; + // no need to check range on __m1 because __s guarantees we have enough source + if (!__pred(*--__m1, *--__m2)) + { + break; + } + } + } +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator1 +find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) +{ + return _CUDA_VSTD::__find_end<__add_lvalue_reference_t<_BinaryPredicate>> + (__first1, __last1, __first2, __last2, __pred, + typename iterator_traits<_ForwardIterator1>::iterator_category(), + typename iterator_traits<_ForwardIterator2>::iterator_category()); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator1 +find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2) +{ + typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; + typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; + return _CUDA_VSTD::find_end(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); +} + +// find_first_of + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _ForwardIterator1 +__find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) +{ + for (; __first1 != __last1; ++__first1) + for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j) + if (__pred(*__first1, *__j)) + return __first1; + return __last1; +} + + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator1 +find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) +{ + return _CUDA_VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator1 +find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2) +{ + typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; + typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; + return _CUDA_VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); +} + +// adjacent_find + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator +adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) +{ + if (__first != __last) + { + _ForwardIterator __i = __first; + while (++__i != __last) + { + if (__pred(*__first, *__i)) + return __first; + __first = __i; + } + } + return __last; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator +adjacent_find(_ForwardIterator __first, _ForwardIterator __last) +{ + typedef typename iterator_traits<_ForwardIterator>::value_type __v; + return _CUDA_VSTD::adjacent_find(__first, __last, __equal_to<__v>()); +} + +// count + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +typename iterator_traits<_InputIterator>::difference_type +count(_InputIterator __first, _InputIterator __last, const _Tp& __value_) +{ + typename iterator_traits<_InputIterator>::difference_type __r(0); + for (; __first != __last; ++__first) + if (*__first == __value_) + ++__r; + return __r; +} + +// count_if + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +typename iterator_traits<_InputIterator>::difference_type +count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) +{ + typename iterator_traits<_InputIterator>::difference_type __r(0); + for (; __first != __last; ++__first) + if (__pred(*__first)) + ++__r; + return __r; +} + +// mismatch + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +pair<_InputIterator1, _InputIterator2> +mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _BinaryPredicate __pred) +{ + for (; __first1 != __last1; ++__first1, (void) ++__first2) + if (!__pred(*__first1, *__first2)) + break; + return pair<_InputIterator1, _InputIterator2>(__first1, __first2); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +pair<_InputIterator1, _InputIterator2> +mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) +{ + typedef typename iterator_traits<_InputIterator1>::value_type __v1; + typedef typename iterator_traits<_InputIterator2>::value_type __v2; + return _CUDA_VSTD::mismatch(__first1, __last1, __first2, __equal_to<__v1, __v2>()); +} + +#if _LIBCUDACXX_STD_VER > 11 +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +pair<_InputIterator1, _InputIterator2> +mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _BinaryPredicate __pred) +{ + for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2) + if (!__pred(*__first1, *__first2)) + break; + return pair<_InputIterator1, _InputIterator2>(__first1, __first2); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +pair<_InputIterator1, _InputIterator2> +mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2) +{ + typedef typename iterator_traits<_InputIterator1>::value_type __v1; + typedef typename iterator_traits<_InputIterator2>::value_type __v2; + return _CUDA_VSTD::mismatch(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); +} +#endif + +#endif //__cuda_std__ +// equal + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) +{ + for (; __first1 != __last1; ++__first1, (void) ++__first2) + if (!__pred(*__first1, *__first2)) + return false; + return true; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) +{ + typedef typename iterator_traits<_InputIterator1>::value_type __v1; + typedef typename iterator_traits<_InputIterator2>::value_type __v2; + return _CUDA_VSTD::equal(__first1, __last1, __first2, __equal_to<__v1, __v2>()); +} + +#if _LIBCUDACXX_STD_VER > 11 +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +__equal(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred, + input_iterator_tag, input_iterator_tag ) +{ + for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2) + if (!__pred(*__first1, *__first2)) + return false; + return __first1 == __last1 && __first2 == __last2; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +__equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, + _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred, + random_access_iterator_tag, random_access_iterator_tag ) +{ + if ( _CUDA_VSTD::distance(__first1, __last1) != _CUDA_VSTD::distance(__first2, __last2)) + return false; + return _CUDA_VSTD::equal<_RandomAccessIterator1, _RandomAccessIterator2, + __add_lvalue_reference_t<_BinaryPredicate>> + (__first1, __last1, __first2, __pred ); +} + +template +_LIBCUDACXX_NODISCARD_EXT +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +inline bool +equal(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred ) +{ + return _CUDA_VSTD::__equal<__add_lvalue_reference_t<_BinaryPredicate>> + (__first1, __last1, __first2, __last2, __pred, + typename iterator_traits<_InputIterator1>::iterator_category(), + typename iterator_traits<_InputIterator2>::iterator_category()); +} + +template +_LIBCUDACXX_NODISCARD_EXT +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +inline bool +equal(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2) +{ + typedef typename iterator_traits<_InputIterator1>::value_type __v1; + typedef typename iterator_traits<_InputIterator2>::value_type __v2; + return _CUDA_VSTD::__equal(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>(), + typename iterator_traits<_InputIterator1>::iterator_category(), + typename iterator_traits<_InputIterator2>::iterator_category()); +} +#endif + +#ifndef __cuda_std__ +// is_permutation + +template +_LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _BinaryPredicate __pred) +{ +// shorten sequences as much as possible by lopping of any equal prefix + for (; __first1 != __last1; ++__first1, (void) ++__first2) + if (!__pred(*__first1, *__first2)) + break; + if (__first1 == __last1) + return true; + +// __first1 != __last1 && *__first1 != *__first2 + typedef typename iterator_traits<_ForwardIterator1>::difference_type _Diff1; + _Diff1 __l1 = _CUDA_VSTD::distance(__first1, __last1); + if (__l1 == _Diff1(1)) + return false; + _ForwardIterator2 __last2 = _CUDA_VSTD::next(__first2, __l1); + // For each element in [f1, l1) see if there are the same number of + // equal elements in [f2, l2) + for (_ForwardIterator1 __i = __first1; __i != __last1; ++__i) + { + // Have we already counted the number of *__i in [f1, l1)? + _ForwardIterator1 __match = __first1; + for (; __match != __i; ++__match) + if (__pred(*__match, *__i)) + break; + if (__match == __i) { + // Count number of *__i in [f2, l2) + _Diff1 __c2 = 0; + for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j) + if (__pred(*__i, *__j)) + ++__c2; + if (__c2 == 0) + return false; + // Count number of *__i in [__i, l1) (we can start with 1) + _Diff1 __c1 = 1; + for (_ForwardIterator1 __j = _CUDA_VSTD::next(__i); __j != __last1; ++__j) + if (__pred(*__i, *__j)) + ++__c1; + if (__c1 != __c2) + return false; + } + } + return true; +} + +template +_LIBCUDACXX_NODISCARD_EXT +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +inline bool +is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2) +{ + typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; + typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; + return _CUDA_VSTD::is_permutation(__first1, __last1, __first2, __equal_to<__v1, __v2>()); +} + +#if _LIBCUDACXX_STD_VER > 11 +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +__is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, + _BinaryPredicate __pred, + forward_iterator_tag, forward_iterator_tag ) +{ +// shorten sequences as much as possible by lopping of any equal prefix + for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2) + if (!__pred(*__first1, *__first2)) + break; + if (__first1 == __last1) + return __first2 == __last2; + else if (__first2 == __last2) + return false; + + typedef typename iterator_traits<_ForwardIterator1>::difference_type _Diff1; + _Diff1 __l1 = _CUDA_VSTD::distance(__first1, __last1); + + typedef typename iterator_traits<_ForwardIterator2>::difference_type _Diff2; + _Diff2 __l2 = _CUDA_VSTD::distance(__first2, __last2); + if (__l1 != __l2) + return false; + + // For each element in [f1, l1) see if there are the same number of + // equal elements in [f2, l2) + for (_ForwardIterator1 __i = __first1; __i != __last1; ++__i) + { + // Have we already counted the number of *__i in [f1, l1)? + _ForwardIterator1 __match = __first1; + for (; __match != __i; ++__match) + if (__pred(*__match, *__i)) + break; + if (__match == __i) { + // Count number of *__i in [f2, l2) + _Diff1 __c2 = 0; + for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j) + if (__pred(*__i, *__j)) + ++__c2; + if (__c2 == 0) + return false; + // Count number of *__i in [__i, l1) (we can start with 1) + _Diff1 __c1 = 1; + for (_ForwardIterator1 __j = _CUDA_VSTD::next(__i); __j != __last1; ++__j) + if (__pred(*__i, *__j)) + ++__c1; + if (__c1 != __c2) + return false; + } + } + return true; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +__is_permutation(_RandomAccessIterator1 __first1, _RandomAccessIterator2 __last1, + _RandomAccessIterator1 __first2, _RandomAccessIterator2 __last2, + _BinaryPredicate __pred, + random_access_iterator_tag, random_access_iterator_tag ) +{ + if ( _CUDA_VSTD::distance(__first1, __last1) != _CUDA_VSTD::distance(__first2, __last2)) + return false; + return _CUDA_VSTD::is_permutation<_RandomAccessIterator1, _RandomAccessIterator2, + __add_lvalue_reference_t<_BinaryPredicate>> + (__first1, __last1, __first2, __pred ); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, + _BinaryPredicate __pred ) +{ + return _CUDA_VSTD::__is_permutation<__add_lvalue_reference_t<_BinaryPredicate>> + (__first1, __last1, __first2, __last2, __pred, + typename iterator_traits<_ForwardIterator1>::iterator_category(), + typename iterator_traits<_ForwardIterator2>::iterator_category()); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2) +{ + typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; + typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; + return _CUDA_VSTD::__is_permutation(__first1, __last1, __first2, __last2, + __equal_to<__v1, __v2>(), + typename iterator_traits<_ForwardIterator1>::iterator_category(), + typename iterator_traits<_ForwardIterator2>::iterator_category()); +} +#endif + +// search +// __search is in + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator1 +search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) +{ + return _CUDA_VSTD::__search<__add_lvalue_reference_t<_BinaryPredicate>> + (__first1, __last1, __first2, __last2, __pred, + typename iterator_traits<_ForwardIterator1>::iterator_category(), + typename iterator_traits<_ForwardIterator2>::iterator_category()) + .first; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator1 +search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2) +{ + typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; + typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; + return _CUDA_VSTD::search(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); +} + + +#if _LIBCUDACXX_STD_VER > 14 +template +_LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s) +{ return __s(__f, __l).first; } +#endif + +// search_n + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _ForwardIterator +__search_n(_ForwardIterator __first, _ForwardIterator __last, + _Size __count, const _Tp& __value_, _BinaryPredicate __pred, forward_iterator_tag) +{ + if (__count <= 0) + return __first; + while (true) + { + // Find first element in sequence that matchs __value_, with a mininum of loop checks + while (true) + { + if (__first == __last) // return __last if no element matches __value_ + return __last; + if (__pred(*__first, __value_)) + break; + ++__first; + } + // *__first matches __value_, now match elements after here + _ForwardIterator __m = __first; + _Size __c(0); + while (true) + { + if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern) + return __first; + if (++__m == __last) // Otherwise if source exhaused, pattern not found + return __last; + if (!__pred(*__m, __value_)) // if there is a mismatch, restart with a new __first + { + __first = __m; + ++__first; + break; + } // else there is a match, check next elements + } + } +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator +__search_n(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Size __count, const _Tp& __value_, _BinaryPredicate __pred, random_access_iterator_tag) +{ + if (__count <= 0) + return __first; + _Size __len = static_cast<_Size>(__last - __first); + if (__len < __count) + return __last; + const _RandomAccessIterator __s = __last - (__count - 1); // Start of pattern match can't go beyond here + while (true) + { + // Find first element in sequence that matchs __value_, with a mininum of loop checks + while (true) + { + if (__first >= __s) // return __last if no element matches __value_ + return __last; + if (__pred(*__first, __value_)) + break; + ++__first; + } + // *__first matches __value_, now match elements after here + _RandomAccessIterator __m = __first; + _Size __c(0); + while (true) + { + if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern) + return __first; + ++__m; // no need to check range on __m because __s guarantees we have enough source + if (!__pred(*__m, __value_)) // if there is a mismatch, restart with a new __first + { + __first = __m; + ++__first; + break; + } // else there is a match, check next elements + } + } +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator +search_n(_ForwardIterator __first, _ForwardIterator __last, + _Size __count, const _Tp& __value_, _BinaryPredicate __pred) +{ + return _CUDA_VSTD::__search_n<__add_lvalue_reference_t<_BinaryPredicate>> + (__first, __last, __convert_to_integral(__count), __value_, __pred, + typename iterator_traits<_ForwardIterator>::iterator_category()); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator +search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_) +{ + typedef typename iterator_traits<_ForwardIterator>::value_type __v; + return _CUDA_VSTD::search_n(__first, __last, __convert_to_integral(__count), + __value_, __equal_to<__v, _Tp>()); +} + +// copy +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_Iter +__unwrap_iter(_Iter __i) +{ + return __i; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_trivially_copy_assignable<_Tp>::value, + _Tp* +> +__unwrap_iter(move_iterator<_Tp*> __i) +{ + return __i.base(); +} + +#if _LIBCUDACXX_DEBUG_LEVEL < 2 + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_IF_NODEBUG +__enable_if_t +< + is_trivially_copy_assignable<_Tp>::value, + _Tp* +> +__unwrap_iter(__wrap_iter<_Tp*> __i) +{ + return __i.base(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_IF_NODEBUG +__enable_if_t +< + is_trivially_copy_assignable<_Tp>::value, + const _Tp* +> +__unwrap_iter(__wrap_iter __i) +{ + return __i.base(); +} + +#else + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_IF_NODEBUG +__enable_if_t +< + is_trivially_copy_assignable<_Tp>::value, + __wrap_iter<_Tp*> +> +__unwrap_iter(__wrap_iter<_Tp*> __i) +{ + return __i; +} + +#endif // _LIBCUDACXX_DEBUG_LEVEL < 2 + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +__copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) +{ + for (; __first != __last; ++__first, (void) ++__result) + *__result = *__first; + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_same<__remove_const_t<_Tp>, _Up>::value && + is_trivially_copy_assignable<_Up>::value, + _Up* +> +__copy(_Tp* __first, _Tp* __last, _Up* __result) +{ + const size_t __n = static_cast(__last - __first); + if (__n > 0) + _CUDA_VSTD::memmove(__result, __first, __n * sizeof(_Up)); + return __result + __n; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) +{ + return _CUDA_VSTD::__copy(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); +} + +// copy_backward + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +__copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) +{ + while (__first != __last) + *--__result = *--__last; + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_same<__remove_const_t<_Tp>, _Up>::value && + is_trivially_copy_assignable<_Up>::value, + _Up* +> +__copy_backward(_Tp* __first, _Tp* __last, _Up* __result) +{ + const size_t __n = static_cast(__last - __first); + if (__n > 0) + { + __result -= __n; + _CUDA_VSTD::memmove(__result, __first, __n * sizeof(_Up)); + } + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_BidirectionalIterator2 +copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, + _BidirectionalIterator2 __result) +{ + return _CUDA_VSTD::__copy_backward(__unwrap_iter(__first), + __unwrap_iter(__last), + __unwrap_iter(__result)); +} + +// copy_if + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +copy_if(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Predicate __pred) +{ + for (; __first != __last; ++__first) + { + if (__pred(*__first)) + { + *__result = *__first; + ++__result; + } + } + return __result; +} + +// copy_n + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + __is_cpp17_input_iterator<_InputIterator>::value && + !__is_cpp17_random_access_iterator<_InputIterator>::value, + _OutputIterator +> +copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) +{ + typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; + _IntegralSize __n = __orig_n; + if (__n > 0) + { + *__result = *__first; + ++__result; + for (--__n; __n > 0; --__n) + { + ++__first; + *__result = *__first; + ++__result; + } + } + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + __is_cpp17_random_access_iterator<_InputIterator>::value, + _OutputIterator +> +copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) +{ + typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; + _IntegralSize __n = __orig_n; + return _CUDA_VSTD::copy(__first, __first + __n, __result); +} + +// move + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +__move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) +{ + for (; __first != __last; ++__first, (void) ++__result) + *__result = _CUDA_VSTD::move(*__first); + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_same<__remove_const_t<_Tp>, _Up>::value && + is_trivially_copy_assignable<_Up>::value, + _Up* +> +__move(_Tp* __first, _Tp* __last, _Up* __result) +{ + const size_t __n = static_cast(__last - __first); + if (__n > 0) + _CUDA_VSTD::memmove(__result, __first, __n * sizeof(_Up)); + return __result + __n; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) +{ + return _CUDA_VSTD::__move(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); +} + +// move_backward + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +__move_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result) +{ + while (__first != __last) + *--__result = _CUDA_VSTD::move(*--__last); + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_same<__remove_const_t<_Tp>, _Up>::value && + is_trivially_copy_assignable<_Up>::value, + _Up* +> +__move_backward(_Tp* __first, _Tp* __last, _Up* __result) +{ + const size_t __n = static_cast(__last - __first); + if (__n > 0) + { + __result -= __n; + _CUDA_VSTD::memmove(__result, __first, __n * sizeof(_Up)); + } + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_BidirectionalIterator2 +move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, + _BidirectionalIterator2 __result) +{ + return _CUDA_VSTD::__move_backward(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); +} + +// iter_swap + +// moved to for better swap / noexcept support + +// transform + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op) +{ + for (; __first != __last; ++__first, (void) ++__result) + *__result = __op(*__first); + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +transform(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, + _OutputIterator __result, _BinaryOperation __binary_op) +{ + for (; __first1 != __last1; ++__first1, (void) ++__first2, ++__result) + *__result = __binary_op(*__first1, *__first2); + return __result; +} + +// replace + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +void +replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value, const _Tp& __new_value) +{ + for (; __first != __last; ++__first) + if (*__first == __old_value) + *__first = __new_value; +} + +// replace_if + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +void +replace_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp& __new_value) +{ + for (; __first != __last; ++__first) + if (__pred(*__first)) + *__first = __new_value; +} + +// replace_copy + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +replace_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, + const _Tp& __old_value, const _Tp& __new_value) +{ + for (; __first != __last; ++__first, (void) ++__result) + if (*__first == __old_value) + *__result = __new_value; + else + *__result = *__first; + return __result; +} + +// replace_copy_if + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +inline _OutputIterator +replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, + _Predicate __pred, const _Tp& __new_value) +{ + for (; __first != __last; ++__first, (void) ++__result) + if (__pred(*__first)) + *__result = __new_value; + else + *__result = *__first; + return __result; +} + +// fill_n +#endif // __cuda_std__ + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +inline _OutputIterator +__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_) +{ + for (; __n > 0; ++__first, (void) --__n) + *__first = __value_; + return __first; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +inline _OutputIterator +fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_) +{ + return _CUDA_VSTD::__fill_n(__first, __convert_to_integral(__n), __value_); +} + +// fill + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +void +__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, forward_iterator_tag) +{ + for (; __first != __last; ++__first) + *__first = __value_; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +void +__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value_, random_access_iterator_tag) +{ + _CUDA_VSTD::fill_n(__first, __last - __first, __value_); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +void +fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) +{ + _CUDA_VSTD::__fill(__first, __last, __value_, typename iterator_traits<_ForwardIterator>::iterator_category()); +} + +#ifndef __cuda_std__ +// generate + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +void +generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen) +{ + for (; __first != __last; ++__first) + *__first = __gen(); +} + +// generate_n + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen) +{ + typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; + _IntegralSize __n = __orig_n; + for (; __n > 0; ++__first, (void) --__n) + *__first = __gen(); + return __first; +} + +// remove + +template +_LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _ForwardIterator +remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) +{ + __first = _CUDA_VSTD::find(__first, __last, __value_); + if (__first != __last) + { + _ForwardIterator __i = __first; + while (++__i != __last) + { + if (!(*__i == __value_)) + { + *__first = _CUDA_VSTD::move(*__i); + ++__first; + } + } + } + return __first; +} + +// remove_if + +template +_LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _ForwardIterator +remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) +{ + __first = _CUDA_VSTD::find_if<_ForwardIterator, __add_lvalue_reference_t<_Predicate>> + (__first, __last, __pred); + if (__first != __last) + { + _ForwardIterator __i = __first; + while (++__i != __last) + { + if (!__pred(*__i)) + { + *__first = _CUDA_VSTD::move(*__i); + ++__first; + } + } + } + return __first; +} + +// remove_copy + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value_) +{ + for (; __first != __last; ++__first) + { + if (!(*__first == __value_)) + { + *__result = *__first; + ++__result; + } + } + return __result; +} + +// remove_copy_if + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) +{ + for (; __first != __last; ++__first) + { + if (!__pred(*__first)) + { + *__result = *__first; + ++__result; + } + } + return __result; +} + +// unique + +template +_LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _ForwardIterator +unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) +{ + __first = _CUDA_VSTD::adjacent_find<_ForwardIterator, __add_lvalue_reference_t<_BinaryPredicate>> + (__first, __last, __pred); + if (__first != __last) + { + // ... a a ? ... + // f i + _ForwardIterator __i = __first; + for (++__i; ++__i != __last;) + if (!__pred(*__first, *__i)) + *++__first = _CUDA_VSTD::move(*__i); + ++__first; + } + return __first; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator +unique(_ForwardIterator __first, _ForwardIterator __last) +{ + typedef typename iterator_traits<_ForwardIterator>::value_type __v; + return _CUDA_VSTD::unique(__first, __last, __equal_to<__v>()); +} + +// unique_copy + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _OutputIterator +__unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __pred, + input_iterator_tag, output_iterator_tag) +{ + if (__first != __last) + { + typename iterator_traits<_InputIterator>::value_type __t(*__first); + *__result = __t; + ++__result; + while (++__first != __last) + { + if (!__pred(__t, *__first)) + { + __t = *__first; + *__result = __t; + ++__result; + } + } + } + return __result; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _OutputIterator +__unique_copy(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result, _BinaryPredicate __pred, + forward_iterator_tag, output_iterator_tag) +{ + if (__first != __last) + { + _ForwardIterator __i = __first; + *__result = *__i; + ++__result; + while (++__first != __last) + { + if (!__pred(*__i, *__first)) + { + *__result = *__first; + ++__result; + __i = __first; + } + } + } + return __result; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _ForwardIterator +__unique_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _BinaryPredicate __pred, + input_iterator_tag, forward_iterator_tag) +{ + if (__first != __last) + { + *__result = *__first; + while (++__first != __last) + if (!__pred(*__result, *__first)) + *++__result = *__first; + ++__result; + } + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __pred) +{ + return _CUDA_VSTD::__unique_copy<__add_lvalue_reference_t<_BinaryPredicate>> + (__first, __last, __result, __pred, + typename iterator_traits<_InputIterator>::iterator_category(), + typename iterator_traits<_OutputIterator>::iterator_category()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) +{ + typedef typename iterator_traits<_InputIterator>::value_type __v; + return _CUDA_VSTD::unique_copy(__first, __last, __result, __equal_to<__v>()); +} + +// reverse + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +__reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirectional_iterator_tag) +{ + while (__first != __last) + { + if (__first == --__last) + break; + _CUDA_VSTD::iter_swap(__first, __last); + ++__first; + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +__reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag) +{ + if (__first != __last) + for (; __first < --__last; ++__first) + _CUDA_VSTD::iter_swap(__first, __last); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) +{ + _CUDA_VSTD::__reverse(__first, __last, typename iterator_traits<_BidirectionalIterator>::iterator_category()); +} + +// reverse_copy + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) +{ + for (; __first != __last; ++__result) + *__result = *--__last; + return __result; +} + +// rotate + +template +_LIBCUDACXX_INLINE_VISIBILITY +_ForwardIterator +__rotate_left(_ForwardIterator __first, _ForwardIterator __last) +{ + typedef typename iterator_traits<_ForwardIterator>::value_type value_type; + value_type __tmp = _CUDA_VSTD::move(*__first); + _ForwardIterator __lm1 = _CUDA_VSTD::move(_CUDA_VSTD::next(__first), __last, __first); + *__lm1 = _CUDA_VSTD::move(__tmp); + return __lm1; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_BidirectionalIterator +__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) +{ + typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; + _BidirectionalIterator __lm1 = _CUDA_VSTD::prev(__last); + value_type __tmp = _CUDA_VSTD::move(*__lm1); + _BidirectionalIterator __fp1 = _CUDA_VSTD::move_backward(__first, __lm1, __last); + *__first = _CUDA_VSTD::move(__tmp); + return __fp1; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_ForwardIterator +__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) +{ + _ForwardIterator __i = __middle; + while (true) + { + swap(*__first, *__i); + ++__first; + if (++__i == __last) + break; + if (__first == __middle) + __middle = __i; + } + _ForwardIterator __r = __first; + if (__first != __middle) + { + __i = __middle; + while (true) + { + swap(*__first, *__i); + ++__first; + if (++__i == __last) + { + if (__first == __middle) + break; + __i = __middle; + } + else if (__first == __middle) + __middle = __i; + } + } + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_Integral +__algo_gcd(_Integral __x, _Integral __y) +{ + do + { + _Integral __t = __x % __y; + __x = __y; + __y = __t; + } while (__y); + return __x; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_RandomAccessIterator +__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) +{ + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; + + const difference_type __m1 = __middle - __first; + const difference_type __m2 = __last - __middle; + if (__m1 == __m2) + { + _CUDA_VSTD::swap_ranges(__first, __middle, __middle); + return __middle; + } + const difference_type __g = _CUDA_VSTD::__algo_gcd(__m1, __m2); + for (_RandomAccessIterator __p = __first + __g; __p != __first;) + { + value_type __t(_CUDA_VSTD::move(*--__p)); + _RandomAccessIterator __p1 = __p; + _RandomAccessIterator __p2 = __p1 + __m1; + do + { + *__p1 = _CUDA_VSTD::move(*__p2); + __p1 = __p2; + const difference_type __d = __last - __p2; + if (__m1 < __d) + __p2 += __m1; + else + __p2 = __first + (__m1 - __d); + } while (__p2 != __p); + *__p1 = _CUDA_VSTD::move(__t); + } + return __first + __m2; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_ForwardIterator +__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, + _CUDA_VSTD::forward_iterator_tag) +{ + typedef typename _CUDA_VSTD::iterator_traits<_ForwardIterator>::value_type value_type; + if (_CUDA_VSTD::is_trivially_move_assignable::value) + { + if (_CUDA_VSTD::next(__first) == __middle) + return _CUDA_VSTD::__rotate_left(__first, __last); + } + return _CUDA_VSTD::__rotate_forward(__first, __middle, __last); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_BidirectionalIterator +__rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, + _CUDA_VSTD::bidirectional_iterator_tag) +{ + typedef typename _CUDA_VSTD::iterator_traits<_BidirectionalIterator>::value_type value_type; + if (_CUDA_VSTD::is_trivially_move_assignable::value) + { + if (_CUDA_VSTD::next(__first) == __middle) + return _CUDA_VSTD::__rotate_left(__first, __last); + if (_CUDA_VSTD::next(__middle) == __last) + return _CUDA_VSTD::__rotate_right(__first, __last); + } + return _CUDA_VSTD::__rotate_forward(__first, __middle, __last); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_RandomAccessIterator +__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, + _CUDA_VSTD::random_access_iterator_tag) +{ + typedef typename _CUDA_VSTD::iterator_traits<_RandomAccessIterator>::value_type value_type; + if (_CUDA_VSTD::is_trivially_move_assignable::value) + { + if (_CUDA_VSTD::next(__first) == __middle) + return _CUDA_VSTD::__rotate_left(__first, __last); + if (_CUDA_VSTD::next(__middle) == __last) + return _CUDA_VSTD::__rotate_right(__first, __last); + return _CUDA_VSTD::__rotate_gcd(__first, __middle, __last); + } + return _CUDA_VSTD::__rotate_forward(__first, __middle, __last); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_ForwardIterator +rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) +{ + if (__first == __middle) + return __last; + if (__middle == __last) + return __first; + return _CUDA_VSTD::__rotate(__first, __middle, __last, + typename _CUDA_VSTD::iterator_traits<_ForwardIterator>::iterator_category()); +} + +// rotate_copy + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result) +{ + return _CUDA_VSTD::copy(__first, __middle, _CUDA_VSTD::copy(__middle, __last, __result)); +} + +#endif // __cuda_std__ +// min_element + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_ForwardIterator +min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +{ + static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, + "std::min_element requires a ForwardIterator"); + if (__first != __last) + { + _ForwardIterator __i = __first; + while (++__i != __last) + if (__comp(*__i, *__first)) + __first = __i; + } + return __first; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_ForwardIterator +min_element(_ForwardIterator __first, _ForwardIterator __last) +{ + return _CUDA_VSTD::min_element(__first, __last, + __less::value_type>()); +} + +// min + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +const _Tp& +min(const _Tp& __a, const _Tp& __b, _Compare __comp) +{ + return __comp(__b, __a) ? __b : __a; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +const _Tp& +min(const _Tp& __a, const _Tp& __b) +{ + return _CUDA_VSTD::min(__a, __b, __less<_Tp>()); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_Tp +min(::std::initializer_list<_Tp> __t, _Compare __comp) +{ + return *_CUDA_VSTD::min_element(__t.begin(), __t.end(), __comp); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_Tp +min(::std::initializer_list<_Tp> __t) +{ + return *_CUDA_VSTD::min_element(__t.begin(), __t.end(), __less<_Tp>()); +} + +// max_element + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_ForwardIterator +max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +{ + static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, + "std::max_element requires a ForwardIterator"); + if (__first != __last) + { + _ForwardIterator __i = __first; + while (++__i != __last) + if (__comp(*__first, *__i)) + __first = __i; + } + return __first; +} + + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_ForwardIterator +max_element(_ForwardIterator __first, _ForwardIterator __last) +{ + return _CUDA_VSTD::max_element(__first, __last, + __less::value_type>()); +} + +// max + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +const _Tp& +max(const _Tp& __a, const _Tp& __b, _Compare __comp) +{ + return __comp(__a, __b) ? __b : __a; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +const _Tp& +max(const _Tp& __a, const _Tp& __b) +{ + return _CUDA_VSTD::max(__a, __b, __less<_Tp>()); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_Tp +max(::std::initializer_list<_Tp> __t, _Compare __comp) +{ + return *_CUDA_VSTD::max_element(__t.begin(), __t.end(), __comp); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_Tp +max(::std::initializer_list<_Tp> __t) +{ + return *_CUDA_VSTD::max_element(__t.begin(), __t.end(), __less<_Tp>()); +} + +#if _LIBCUDACXX_STD_VER > 14 +// clamp +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY constexpr +const _Tp& +clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp) +{ + _LIBCUDACXX_ASSERT(!__comp(__hi, __lo), "Bad bounds passed to std::clamp"); + return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v; + +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY constexpr +const _Tp& +clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi) +{ + return _CUDA_VSTD::clamp(__v, __lo, __hi, __less<_Tp>()); +} +#endif + +// minmax_element + +template +_LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +std::pair<_ForwardIterator, _ForwardIterator> +minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +{ + static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, + "std::minmax_element requires a ForwardIterator"); + std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first); + if (__first != __last) + { + if (++__first != __last) + { + if (__comp(*__first, *__result.first)) + __result.first = __first; + else + __result.second = __first; + while (++__first != __last) + { + _ForwardIterator __i = __first; + if (++__first == __last) + { + if (__comp(*__i, *__result.first)) + __result.first = __i; + else if (!__comp(*__i, *__result.second)) + __result.second = __i; + break; + } + else + { + if (__comp(*__first, *__i)) + { + if (__comp(*__first, *__result.first)) + __result.first = __first; + if (!__comp(*__i, *__result.second)) + __result.second = __i; + } + else + { + if (__comp(*__i, *__result.first)) + __result.first = __i; + if (!__comp(*__first, *__result.second)) + __result.second = __first; + } + } + } + } + } + return __result; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +std::pair<_ForwardIterator, _ForwardIterator> +minmax_element(_ForwardIterator __first, _ForwardIterator __last) +{ + return _CUDA_VSTD::minmax_element(__first, __last, + __less::value_type>()); +} + +// minmax + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +pair +minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) +{ + return __comp(__b, __a) ? pair(__b, __a) : + pair(__a, __b); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +pair +minmax(const _Tp& __a, const _Tp& __b) +{ + return _CUDA_VSTD::minmax(__a, __b, __less<_Tp>()); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +pair<_Tp, _Tp> +minmax(::std::initializer_list<_Tp> __t, _Compare __comp) +{ + typedef typename ::std::initializer_list<_Tp>::const_iterator _Iter; + _Iter __first = __t.begin(); + _Iter __last = __t.end(); + std::pair<_Tp, _Tp> __result(*__first, *__first); + + ++__first; + if (__t.size() % 2 == 0) + { + if (__comp(*__first, __result.first)) + __result.first = *__first; + else + __result.second = *__first; + ++__first; + } + + while (__first != __last) + { + _Tp __prev = *__first++; + if (__comp(*__first, __prev)) { + if ( __comp(*__first, __result.first)) __result.first = *__first; + if (!__comp(__prev, __result.second)) __result.second = __prev; + } + else { + if ( __comp(__prev, __result.first)) __result.first = __prev; + if (!__comp(*__first, __result.second)) __result.second = *__first; + } + + __first++; + } + return __result; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +pair<_Tp, _Tp> +minmax(::std::initializer_list<_Tp> __t) +{ + return _CUDA_VSTD::minmax(__t, __less<_Tp>()); +} + +#ifndef __cuda_std__ + +// random_shuffle + +// __independent_bits_engine + +template +struct __log2_imp +{ + static const size_t value = _Xp & ((unsigned long long)(1) << _Rp) ? _Rp + : __log2_imp<_Xp, _Rp - 1>::value; +}; + +template +struct __log2_imp<_Xp, 0> +{ + static const size_t value = 0; +}; + +template +struct __log2_imp<0, _Rp> +{ + static const size_t value = _Rp + 1; +}; + +template +struct __log2 +{ + static const size_t value = __log2_imp<_Xp, + sizeof(_UIntType) * __CHAR_BIT__ - 1>::value; +}; + +template +class __independent_bits_engine +{ +public: + // types + typedef _UIntType result_type; + +private: + typedef typename _Engine::result_type _Engine_result_type; + typedef __conditional_t + < + sizeof(_Engine_result_type) <= sizeof(result_type), + result_type, + _Engine_result_type + > _Working_result_type; + + _Engine& __e_; + size_t __w_; + size_t __w0_; + size_t __n_; + size_t __n0_; + _Working_result_type __y0_; + _Working_result_type __y1_; + _Engine_result_type __mask0_; + _Engine_result_type __mask1_; + + static constexpr _Working_result_type _Rp = + _Engine::max() - _Engine::min() + _Working_result_type(1); + static constexpr size_t __m = __log2<_Working_result_type, _Rp>::value; + static constexpr size_t _WDt = numeric_limits<_Working_result_type>::digits; + static constexpr size_t _EDt = numeric_limits<_Engine_result_type>::digits; + +public: + // constructors and seeding functions + __independent_bits_engine(_Engine& __e, size_t __w); + + // generating functions + result_type operator()() {return __eval(integral_constant());} + +private: + result_type __eval(false_type); + result_type __eval(true_type); +}; + +template +__independent_bits_engine<_Engine, _UIntType> + ::__independent_bits_engine(_Engine& __e, size_t __w) + : __e_(__e), + __w_(__w) +{ + __n_ = __w_ / __m + (__w_ % __m != 0); + __w0_ = __w_ / __n_; + if (_Rp == 0) + __y0_ = _Rp; + else if (__w0_ < _WDt) + __y0_ = (_Rp >> __w0_) << __w0_; + else + __y0_ = 0; + if (_Rp - __y0_ > __y0_ / __n_) + { + ++__n_; + __w0_ = __w_ / __n_; + if (__w0_ < _WDt) + __y0_ = (_Rp >> __w0_) << __w0_; + else + __y0_ = 0; + } + __n0_ = __n_ - __w_ % __n_; + if (__w0_ < _WDt - 1) + __y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1); + else + __y1_ = 0; + __mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) : + _Engine_result_type(0); + __mask1_ = __w0_ < _EDt - 1 ? + _Engine_result_type(~0) >> (_EDt - (__w0_ + 1)) : + _Engine_result_type(~0); +} + +template +inline +_UIntType +__independent_bits_engine<_Engine, _UIntType>::__eval(false_type) +{ + return static_cast(__e_() & __mask0_); +} + +template +_UIntType +__independent_bits_engine<_Engine, _UIntType>::__eval(true_type) +{ + const size_t _WRt = numeric_limits::digits; + result_type _Sp = 0; + for (size_t __k = 0; __k < __n0_; ++__k) + { + _Engine_result_type __u; + do + { + __u = __e_() - _Engine::min(); + } while (__u >= __y0_); + if (__w0_ < _WRt) + _Sp <<= __w0_; + else + _Sp = 0; + _Sp += __u & __mask0_; + } + for (size_t __k = __n0_; __k < __n_; ++__k) + { + _Engine_result_type __u; + do + { + __u = __e_() - _Engine::min(); + } while (__u >= __y1_); + if (__w0_ < _WRt - 1) + _Sp <<= __w0_ + 1; + else + _Sp = 0; + _Sp += __u & __mask1_; + } + return _Sp; +} + +// uniform_int_distribution + +template +class uniform_int_distribution +{ +public: + // types + typedef _IntType result_type; + + class param_type + { + result_type __a_; + result_type __b_; + public: + typedef uniform_int_distribution distribution_type; + + explicit param_type(result_type __a = 0, + result_type __b = numeric_limits::max()) + : __a_(__a), __b_(__b) {} + + result_type a() const {return __a_;} + result_type b() const {return __b_;} + + friend bool operator==(const param_type& __x, const param_type& __y) + {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} + friend bool operator!=(const param_type& __x, const param_type& __y) + {return !(__x == __y);} + }; + +private: + param_type __p_; + +public: + // constructors and reset functions + explicit uniform_int_distribution(result_type __a = 0, + result_type __b = numeric_limits::max()) + : __p_(param_type(__a, __b)) {} + explicit uniform_int_distribution(const param_type& __p) : __p_(__p) {} + void reset() {} + + // generating functions + template result_type operator()(_URNG& __g) + {return (*this)(__g, __p_);} + template result_type operator()(_URNG& __g, const param_type& __p); + + // property functions + result_type a() const {return __p_.a();} + result_type b() const {return __p_.b();} + + param_type param() const {return __p_;} + void param(const param_type& __p) {__p_ = __p;} + + result_type min() const {return a();} + result_type max() const {return b();} + + friend bool operator==(const uniform_int_distribution& __x, + const uniform_int_distribution& __y) + {return __x.__p_ == __y.__p_;} + friend bool operator!=(const uniform_int_distribution& __x, + const uniform_int_distribution& __y) + {return !(__x == __y);} +}; + +template +template +typename uniform_int_distribution<_IntType>::result_type +uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p) +_LIBCUDACXX_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +{ + typedef __conditional_t _UIntType; + const _UIntType _Rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1); + if (_Rp == 1) + return __p.a(); + const size_t _Dt = numeric_limits<_UIntType>::digits; + typedef __independent_bits_engine<_URNG, _UIntType> _Eng; + if (_Rp == 0) + return static_cast(_Eng(__g, _Dt)()); + size_t __w = _Dt - __libcpp_clz(_Rp) - 1; + if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0) + ++__w; + _Eng __e(__g, __w); + _UIntType __u; + do + { + __u = __e(); + } while (__u >= _Rp); + return static_cast(__u + __p.a()); +} + +#if _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) \ + || defined(_LIBCUDACXX_BUILDING_LIBRARY) +class _LIBCUDACXX_TYPE_VIS __rs_default; + +_LIBCUDACXX_FUNC_VIS __rs_default __rs_get(); + +class _LIBCUDACXX_TYPE_VIS __rs_default +{ + static unsigned __c_; + + __rs_default(); +public: + typedef uint_fast32_t result_type; + + static const result_type _Min = 0; + static const result_type _Max = 0xFFFFFFFF; + + __rs_default(const __rs_default&); + ~__rs_default(); + + result_type operator()(); + + static constexpr result_type min() {return _Min;} + static constexpr result_type max() {return _Max;} + + friend _LIBCUDACXX_FUNC_VIS __rs_default __rs_get(); +}; + +_LIBCUDACXX_FUNC_VIS __rs_default __rs_get(); + +template +_LIBCUDACXX_DEPRECATED_IN_CXX14 void +random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + typedef uniform_int_distribution _Dp; + typedef typename _Dp::param_type _Pp; + difference_type __d = __last - __first; + if (__d > 1) + { + _Dp __uid; + __rs_default __g = __rs_get(); + for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d) + { + difference_type __i = __uid(__g, _Pp(0, __d)); + if (__i != difference_type(0)) + swap(*__first, *(__first + __i)); + } + } +} + +template +_LIBCUDACXX_DEPRECATED_IN_CXX14 void +random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, + _RandomNumberGenerator&& __rand) +{ + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + difference_type __d = __last - __first; + if (__d > 1) + { + for (--__last; __first < __last; ++__first, (void) --__d) + { + difference_type __i = __rand(__d); + if (__i != difference_type(0)) + swap(*__first, *(__first + __i)); + } + } +} +#endif + +template +_LIBCUDACXX_INLINE_VISIBILITY +_SampleIterator __sample(_PopulationIterator __first, + _PopulationIterator __last, _SampleIterator __output_iter, + _Distance __n, + _UniformRandomNumberGenerator & __g, + input_iterator_tag) { + + _Distance __k = 0; + for (; __first != __last && __k < __n; ++__first, (void) ++__k) + __output_iter[__k] = *__first; + _Distance __sz = __k; + for (; __first != __last; ++__first, (void) ++__k) { + _Distance __r = _CUDA_VSTD::uniform_int_distribution<_Distance>(0, __k)(__g); + if (__r < __sz) + __output_iter[__r] = *__first; + } + return __output_iter + _CUDA_VSTD::min(__n, __k); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_SampleIterator __sample(_PopulationIterator __first, + _PopulationIterator __last, _SampleIterator __output_iter, + _Distance __n, + _UniformRandomNumberGenerator& __g, + forward_iterator_tag) { + _Distance __unsampled_sz = _CUDA_VSTD::distance(__first, __last); + for (__n = _CUDA_VSTD::min(__n, __unsampled_sz); __n != 0; ++__first) { + _Distance __r = + _CUDA_VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g); + if (__r < __n) { + *__output_iter++ = *__first; + --__n; + } + } + return __output_iter; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_SampleIterator __sample(_PopulationIterator __first, + _PopulationIterator __last, _SampleIterator __output_iter, + _Distance __n, _UniformRandomNumberGenerator& __g) { + typedef typename iterator_traits<_PopulationIterator>::iterator_category + _PopCategory; + typedef typename iterator_traits<_PopulationIterator>::difference_type + _Difference; + static_assert(__is_cpp17_forward_iterator<_PopulationIterator>::value || + __is_cpp17_random_access_iterator<_SampleIterator>::value, + "SampleIterator must meet the requirements of RandomAccessIterator"); + typedef typename common_type<_Distance, _Difference>::type _CommonType; + _LIBCUDACXX_ASSERT(__n >= 0, "N must be a positive number."); + return _CUDA_VSTD::__sample( + __first, __last, __output_iter, _CommonType(__n), + __g, _PopCategory()); +} + +#if _LIBCUDACXX_STD_VER > 14 +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_SampleIterator sample(_PopulationIterator __first, + _PopulationIterator __last, _SampleIterator __output_iter, + _Distance __n, _UniformRandomNumberGenerator&& __g) { + return _CUDA_VSTD::__sample(__first, __last, __output_iter, __n, __g); +} +#endif // _LIBCUDACXX_STD_VER > 14 + +template +_LIBCUDACXX_INLINE_VISIBILITY + void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, + _UniformRandomNumberGenerator&& __g) +{ + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + typedef uniform_int_distribution _Dp; + typedef typename _Dp::param_type _Pp; + difference_type __d = __last - __first; + if (__d > 1) + { + _Dp __uid; + for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d) + { + difference_type __i = __uid(__g, _Pp(0, __d)); + if (__i != difference_type(0)) + swap(*__first, *(__first + __i)); + } + } +} + +template +_LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) +{ + for (; __first != __last; ++__first) + if (!__pred(*__first)) + break; + if ( __first == __last ) + return true; + ++__first; + for (; __first != __last; ++__first) + if (__pred(*__first)) + return false; + return true; +} + +// partition + +template +_LIBCUDACXX_INLINE_VISIBILITY +_ForwardIterator +__partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_tag) +{ + while (true) + { + if (__first == __last) + return __first; + if (!__pred(*__first)) + break; + ++__first; + } + for (_ForwardIterator __p = __first; ++__p != __last;) + { + if (__pred(*__p)) + { + swap(*__first, *__p); + ++__first; + } + } + return __first; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_BidirectionalIterator +__partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, + bidirectional_iterator_tag) +{ + while (true) + { + while (true) + { + if (__first == __last) + return __first; + if (!__pred(*__first)) + break; + ++__first; + } + do + { + if (__first == --__last) + return __first; + } while (!__pred(*__last)); + swap(*__first, *__last); + ++__first; + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_ForwardIterator +partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) +{ + return _CUDA_VSTD::__partition<__add_lvalue_reference_t<_Predicate>> + (__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category()); +} + +// partition_copy + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 pair<_OutputIterator1, _OutputIterator2> +partition_copy(_InputIterator __first, _InputIterator __last, + _OutputIterator1 __out_true, _OutputIterator2 __out_false, + _Predicate __pred) +{ + for (; __first != __last; ++__first) + { + if (__pred(*__first)) + { + *__out_true = *__first; + ++__out_true; + } + else + { + *__out_false = *__first; + ++__out_false; + } + } + return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false); +} + +// partition_point + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _ForwardIterator +partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) +{ + typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; + difference_type __len = _CUDA_VSTD::distance(__first, __last); + while (__len != 0) + { + difference_type __l2 = _CUDA_VSTD::__half_positive(__len); + _ForwardIterator __m = __first; + _CUDA_VSTD::advance(__m, __l2); + if (__pred(*__m)) + { + __first = ++__m; + __len -= __l2 + 1; + } + else + __len = __l2; + } + return __first; +} + +// stable_partition + +template +_LIBCUDACXX_HOST_DEVICE +_ForwardIterator +__stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, + _Distance __len, _Pair __p, forward_iterator_tag __fit) +{ + // *__first is known to be false + // __len >= 1 + if (__len == 1) + return __first; + if (__len == 2) + { + _ForwardIterator __m = __first; + if (__pred(*++__m)) + { + swap(*__first, *__m); + return __m; + } + return __first; + } + if (__len <= __p.second) + { // The buffer is big enough to use + typedef typename iterator_traits<_ForwardIterator>::value_type value_type; + __destruct_n __d(0); + unique_ptr __h(__p.first, __d); + // Move the falses into the temporary buffer, and the trues to the front of the line + // Update __first to always point to the end of the trues + value_type* __t = __p.first; + ::new(__t) value_type(_CUDA_VSTD::move(*__first)); + __d.__incr((value_type*)0); + ++__t; + _ForwardIterator __i = __first; + while (++__i != __last) + { + if (__pred(*__i)) + { + *__first = _CUDA_VSTD::move(*__i); + ++__first; + } + else + { + ::new(__t) value_type(_CUDA_VSTD::move(*__i)); + __d.__incr((value_type*)0); + ++__t; + } + } + // All trues now at start of range, all falses in buffer + // Move falses back into range, but don't mess up __first which points to first false + __i = __first; + for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i) + *__i = _CUDA_VSTD::move(*__t2); + // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer + return __first; + } + // Else not enough buffer, do in place + // __len >= 3 + _ForwardIterator __m = __first; + _Distance __len2 = __len / 2; // __len2 >= 2 + _CUDA_VSTD::advance(__m, __len2); + // recurse on [__first, __m), *__first know to be false + // F????????????????? + // f m l + typedef __add_lvalue_reference_t<_Predicate> _PredRef; + _ForwardIterator __first_false = __stable_partition<_PredRef>(__first, __m, __pred, __len2, __p, __fit); + // TTTFFFFF?????????? + // f ff m l + // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true + _ForwardIterator __m1 = __m; + _ForwardIterator __second_false = __last; + _Distance __len_half = __len - __len2; + while (__pred(*__m1)) + { + if (++__m1 == __last) + goto __second_half_done; + --__len_half; + } + // TTTFFFFFTTTF?????? + // f ff m m1 l + __second_false = __stable_partition<_PredRef>(__m1, __last, __pred, __len_half, __p, __fit); +__second_half_done: + // TTTFFFFFTTTTTFFFFF + // f ff m sf l + return _CUDA_VSTD::rotate(__first_false, __m, __second_false); + // TTTTTTTTFFFFFFFFFF + // | +} + +struct __return_temporary_buffer +{ + template + _LIBCUDACXX_INLINE_VISIBILITY void operator()(_Tp* __p) const {_CUDA_VSTD::return_temporary_buffer(__p);} +}; + +template +_LIBCUDACXX_HOST_DEVICE +_ForwardIterator +__stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, + forward_iterator_tag) +{ + const unsigned __alloc_limit = 3; // might want to make this a function of trivial assignment + // Either prove all true and return __first or point to first false + while (true) + { + if (__first == __last) + return __first; + if (!__pred(*__first)) + break; + ++__first; + } + // We now have a reduced range [__first, __last) + // *__first is known to be false + typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; + typedef typename iterator_traits<_ForwardIterator>::value_type value_type; + difference_type __len = _CUDA_VSTD::distance(__first, __last); + pair __p(0, 0); + unique_ptr __h; + if (__len >= __alloc_limit) + { + __p = _CUDA_VSTD::get_temporary_buffer(__len); + __h.reset(__p.first); + } + return __stable_partition<__add_lvalue_reference_t<_Predicate>> + (__first, __last, __pred, __len, __p, forward_iterator_tag()); +} + +template +_LIBCUDACXX_HOST_DEVICE +_BidirectionalIterator +__stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, + _Distance __len, _Pair __p, bidirectional_iterator_tag __bit) +{ + // *__first is known to be false + // *__last is known to be true + // __len >= 2 + if (__len == 2) + { + swap(*__first, *__last); + return __last; + } + if (__len == 3) + { + _BidirectionalIterator __m = __first; + if (__pred(*++__m)) + { + swap(*__first, *__m); + swap(*__m, *__last); + return __last; + } + swap(*__m, *__last); + swap(*__first, *__m); + return __m; + } + if (__len <= __p.second) + { // The buffer is big enough to use + typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; + __destruct_n __d(0); + unique_ptr __h(__p.first, __d); + // Move the falses into the temporary buffer, and the trues to the front of the line + // Update __first to always point to the end of the trues + value_type* __t = __p.first; + ::new(__t) value_type(_CUDA_VSTD::move(*__first)); + __d.__incr((value_type*)0); + ++__t; + _BidirectionalIterator __i = __first; + while (++__i != __last) + { + if (__pred(*__i)) + { + *__first = _CUDA_VSTD::move(*__i); + ++__first; + } + else + { + ::new(__t) value_type(_CUDA_VSTD::move(*__i)); + __d.__incr((value_type*)0); + ++__t; + } + } + // move *__last, known to be true + *__first = _CUDA_VSTD::move(*__i); + __i = ++__first; + // All trues now at start of range, all falses in buffer + // Move falses back into range, but don't mess up __first which points to first false + for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i) + *__i = _CUDA_VSTD::move(*__t2); + // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer + return __first; + } + // Else not enough buffer, do in place + // __len >= 4 + _BidirectionalIterator __m = __first; + _Distance __len2 = __len / 2; // __len2 >= 2 + _CUDA_VSTD::advance(__m, __len2); + // recurse on [__first, __m-1], except reduce __m-1 until *(__m-1) is true, *__first know to be false + // F????????????????T + // f m l + _BidirectionalIterator __m1 = __m; + _BidirectionalIterator __first_false = __first; + _Distance __len_half = __len2; + while (!__pred(*--__m1)) + { + if (__m1 == __first) + goto __first_half_done; + --__len_half; + } + // F???TFFF?????????T + // f m1 m l + typedef __add_lvalue_reference_t<_Predicate> _PredRef; + __first_false = __stable_partition<_PredRef>(__first, __m1, __pred, __len_half, __p, __bit); +__first_half_done: + // TTTFFFFF?????????T + // f ff m l + // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true + __m1 = __m; + _BidirectionalIterator __second_false = __last; + ++__second_false; + __len_half = __len - __len2; + while (__pred(*__m1)) + { + if (++__m1 == __last) + goto __second_half_done; + --__len_half; + } + // TTTFFFFFTTTF?????T + // f ff m m1 l + __second_false = __stable_partition<_PredRef>(__m1, __last, __pred, __len_half, __p, __bit); +__second_half_done: + // TTTFFFFFTTTTTFFFFF + // f ff m sf l + return _CUDA_VSTD::rotate(__first_false, __m, __second_false); + // TTTTTTTTFFFFFFFFFF + // | +} + +template +_LIBCUDACXX_HOST_DEVICE +_BidirectionalIterator +__stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, + bidirectional_iterator_tag) +{ + typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type; + typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; + const difference_type __alloc_limit = 4; // might want to make this a function of trivial assignment + // Either prove all true and return __first or point to first false + while (true) + { + if (__first == __last) + return __first; + if (!__pred(*__first)) + break; + ++__first; + } + // __first points to first false, everything prior to __first is already set. + // Either prove [__first, __last) is all false and return __first, or point __last to last true + do + { + if (__first == --__last) + return __first; + } while (!__pred(*__last)); + // We now have a reduced range [__first, __last] + // *__first is known to be false + // *__last is known to be true + // __len >= 2 + difference_type __len = _CUDA_VSTD::distance(__first, __last) + 1; + pair __p(0, 0); + unique_ptr __h; + if (__len >= __alloc_limit) + { + __p = _CUDA_VSTD::get_temporary_buffer(__len); + __h.reset(__p.first); + } + return __stable_partition<__add_lvalue_reference_t<_Predicate>> + (__first, __last, __pred, __len, __p, bidirectional_iterator_tag()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_ForwardIterator +stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) +{ + return __stable_partition<__add_lvalue_reference_t<_Predicate>> + (__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category()); +} + +// is_sorted_until + +template +_LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _ForwardIterator +is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +{ + if (__first != __last) + { + _ForwardIterator __i = __first; + while (++__i != __last) + { + if (__comp(*__i, *__first)) + return __i; + __first = __i; + } + } + return __last; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator +is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) +{ + return _CUDA_VSTD::is_sorted_until(__first, __last, __less::value_type>()); +} + +// is_sorted + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +{ + return _CUDA_VSTD::is_sorted_until(__first, __last, __comp) == __last; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +is_sorted(_ForwardIterator __first, _ForwardIterator __last) +{ + return _CUDA_VSTD::is_sorted(__first, __last, __less::value_type>()); +} + +// sort + +// stable, 2-3 compares, 0-2 swaps + +template +_LIBCUDACXX_HOST_DEVICE +unsigned +__sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z, _Compare __c) +{ + unsigned __r = 0; + if (!__c(*__y, *__x)) // if x <= y + { + if (!__c(*__z, *__y)) // if y <= z + return __r; // x <= y && y <= z + // x <= y && y > z + swap(*__y, *__z); // x <= z && y < z + __r = 1; + if (__c(*__y, *__x)) // if x > y + { + swap(*__x, *__y); // x < y && y <= z + __r = 2; + } + return __r; // x <= y && y < z + } + if (__c(*__z, *__y)) // x > y, if y > z + { + swap(*__x, *__z); // x < y && y < z + __r = 1; + return __r; + } + swap(*__x, *__y); // x > y && y <= z + __r = 1; // x < y && x <= z + if (__c(*__z, *__y)) // if y > z + { + swap(*__y, *__z); // x <= y && y < z + __r = 2; + } + return __r; +} // x <= y && y <= z + +// stable, 3-6 compares, 0-5 swaps + +template +_LIBCUDACXX_HOST_DEVICE +unsigned +__sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, + _ForwardIterator __x4, _Compare __c) +{ + unsigned __r = __sort3<_Compare>(__x1, __x2, __x3, __c); + if (__c(*__x4, *__x3)) + { + swap(*__x3, *__x4); + ++__r; + if (__c(*__x3, *__x2)) + { + swap(*__x2, *__x3); + ++__r; + if (__c(*__x2, *__x1)) + { + swap(*__x1, *__x2); + ++__r; + } + } + } + return __r; +} + +// stable, 4-10 compares, 0-9 swaps + +template +_LIBCUDACXX_HIDDEN +_LIBCUDACXX_HOST_DEVICE +unsigned +__sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, + _ForwardIterator __x4, _ForwardIterator __x5, _Compare __c) +{ + unsigned __r = __sort4<_Compare>(__x1, __x2, __x3, __x4, __c); + if (__c(*__x5, *__x4)) + { + swap(*__x4, *__x5); + ++__r; + if (__c(*__x4, *__x3)) + { + swap(*__x3, *__x4); + ++__r; + if (__c(*__x3, *__x2)) + { + swap(*__x2, *__x3); + ++__r; + if (__c(*__x2, *__x1)) + { + swap(*__x1, *__x2); + ++__r; + } + } + } + } + return __r; +} + +// Assumes size > 0 +template +_LIBCUDACXX_HOST_DEVICE +void +__selection_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp) +{ + _BirdirectionalIterator __lm1 = __last; + for (--__lm1; __first != __lm1; ++__first) + { + _BirdirectionalIterator __i = _CUDA_VSTD::min_element<_BirdirectionalIterator, + __add_lvalue_reference_t<_Compare>> + (__first, __last, __comp); + if (__i != __first) + swap(*__first, *__i); + } +} + +template +_LIBCUDACXX_HOST_DEVICE +void +__insertion_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp) +{ + typedef typename iterator_traits<_BirdirectionalIterator>::value_type value_type; + if (__first != __last) + { + _BirdirectionalIterator __i = __first; + for (++__i; __i != __last; ++__i) + { + _BirdirectionalIterator __j = __i; + value_type __t(_CUDA_VSTD::move(*__j)); + for (_BirdirectionalIterator __k = __i; __k != __first && __comp(__t, *--__k); --__j) + *__j = _CUDA_VSTD::move(*__k); + *__j = _CUDA_VSTD::move(__t); + } + } +} + +template +_LIBCUDACXX_HOST_DEVICE +void +__insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; + _RandomAccessIterator __j = __first+2; + __sort3<_Compare>(__first, __first+1, __j, __comp); + for (_RandomAccessIterator __i = __j+1; __i != __last; ++__i) + { + if (__comp(*__i, *__j)) + { + value_type __t(_CUDA_VSTD::move(*__i)); + _RandomAccessIterator __k = __j; + __j = __i; + do + { + *__j = _CUDA_VSTD::move(*__k); + __j = __k; + } while (__j != __first && __comp(__t, *--__k)); + *__j = _CUDA_VSTD::move(__t); + } + __j = __i; + } +} + +template +_LIBCUDACXX_HOST_DEVICE +bool +__insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + switch (__last - __first) + { + case 0: + case 1: + return true; + case 2: + if (__comp(*--__last, *__first)) + swap(*__first, *__last); + return true; + case 3: + _CUDA_VSTD::__sort3<_Compare>(__first, __first+1, --__last, __comp); + return true; + case 4: + _CUDA_VSTD::__sort4<_Compare>(__first, __first+1, __first+2, --__last, __comp); + return true; + case 5: + _CUDA_VSTD::__sort5<_Compare>(__first, __first+1, __first+2, __first+3, --__last, __comp); + return true; + } + typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; + _RandomAccessIterator __j = __first+2; + __sort3<_Compare>(__first, __first+1, __j, __comp); + const unsigned __limit = 8; + unsigned __count = 0; + for (_RandomAccessIterator __i = __j+1; __i != __last; ++__i) + { + if (__comp(*__i, *__j)) + { + value_type __t(_CUDA_VSTD::move(*__i)); + _RandomAccessIterator __k = __j; + __j = __i; + do + { + *__j = _CUDA_VSTD::move(*__k); + __j = __k; + } while (__j != __first && __comp(__t, *--__k)); + *__j = _CUDA_VSTD::move(__t); + if (++__count == __limit) + return ++__i == __last; + } + __j = __i; + } + return true; +} + +template +_LIBCUDACXX_HOST_DEVICE +void +__insertion_sort_move(_BirdirectionalIterator __first1, _BirdirectionalIterator __last1, + typename iterator_traits<_BirdirectionalIterator>::value_type* __first2, _Compare __comp) +{ + typedef typename iterator_traits<_BirdirectionalIterator>::value_type value_type; + if (__first1 != __last1) + { + __destruct_n __d(0); + unique_ptr __h(__first2, __d); + value_type* __last2 = __first2; + ::new(__last2) value_type(_CUDA_VSTD::move(*__first1)); + __d.__incr((value_type*)0); + for (++__last2; ++__first1 != __last1; ++__last2) + { + value_type* __j2 = __last2; + value_type* __i2 = __j2; + if (__comp(*__first1, *--__i2)) + { + ::new(__j2) value_type(_CUDA_VSTD::move(*__i2)); + __d.__incr((value_type*)0); + for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2) + *__j2 = _CUDA_VSTD::move(*__i2); + *__j2 = _CUDA_VSTD::move(*__first1); + } + else + { + ::new(__j2) value_type(_CUDA_VSTD::move(*__first1)); + __d.__incr((value_type*)0); + } + } + __h.release(); + } +} + +template +_LIBCUDACXX_HOST_DEVICE +void +__sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + // _Compare is known to be a reference type + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; + const difference_type __limit = is_trivially_copy_constructible::value && + is_trivially_copy_assignable::value ? 30 : 6; + while (true) + { + __restart: + difference_type __len = __last - __first; + switch (__len) + { + case 0: + case 1: + return; + case 2: + if (__comp(*--__last, *__first)) + swap(*__first, *__last); + return; + case 3: + _CUDA_VSTD::__sort3<_Compare>(__first, __first+1, --__last, __comp); + return; + case 4: + _CUDA_VSTD::__sort4<_Compare>(__first, __first+1, __first+2, --__last, __comp); + return; + case 5: + _CUDA_VSTD::__sort5<_Compare>(__first, __first+1, __first+2, __first+3, --__last, __comp); + return; + } + if (__len <= __limit) + { + _CUDA_VSTD::__insertion_sort_3<_Compare>(__first, __last, __comp); + return; + } + // __len > 5 + _RandomAccessIterator __m = __first; + _RandomAccessIterator __lm1 = __last; + --__lm1; + unsigned __n_swaps; + { + difference_type __delta; + if (__len >= 1000) + { + __delta = __len/2; + __m += __delta; + __delta /= 2; + __n_swaps = _CUDA_VSTD::__sort5<_Compare>(__first, __first + __delta, __m, __m+__delta, __lm1, __comp); + } + else + { + __delta = __len/2; + __m += __delta; + __n_swaps = _CUDA_VSTD::__sort3<_Compare>(__first, __m, __lm1, __comp); + } + } + // *__m is median + // partition [__first, __m) < *__m and *__m <= [__m, __last) + // (this inhibits tossing elements equivalent to __m around unnecessarily) + _RandomAccessIterator __i = __first; + _RandomAccessIterator __j = __lm1; + // j points beyond range to be tested, *__m is known to be <= *__lm1 + // The search going up is known to be guarded but the search coming down isn't. + // Prime the downward search with a guard. + if (!__comp(*__i, *__m)) // if *__first == *__m + { + // *__first == *__m, *__first doesn't go in first part + // manually guard downward moving __j against __i + while (true) + { + if (__i == --__j) + { + // *__first == *__m, *__m <= all other elements + // Parition instead into [__first, __i) == *__first and *__first < [__i, __last) + ++__i; // __first + 1 + __j = __last; + if (!__comp(*__first, *--__j)) // we need a guard if *__first == *(__last-1) + { + while (true) + { + if (__i == __j) + return; // [__first, __last) all equivalent elements + if (__comp(*__first, *__i)) + { + swap(*__i, *__j); + ++__n_swaps; + ++__i; + break; + } + ++__i; + } + } + // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1 + if (__i == __j) + return; + while (true) + { + while (!__comp(*__first, *__i)) + ++__i; + while (__comp(*__first, *--__j)) + ; + if (__i >= __j) + break; + swap(*__i, *__j); + ++__n_swaps; + ++__i; + } + // [__first, __i) == *__first and *__first < [__i, __last) + // The first part is sorted, sort the secod part + // _CUDA_VSTD::__sort<_Compare>(__i, __last, __comp); + __first = __i; + goto __restart; + } + if (__comp(*__j, *__m)) + { + swap(*__i, *__j); + ++__n_swaps; + break; // found guard for downward moving __j, now use unguarded partition + } + } + } + // It is known that *__i < *__m + ++__i; + // j points beyond range to be tested, *__m is known to be <= *__lm1 + // if not yet partitioned... + if (__i < __j) + { + // known that *(__i - 1) < *__m + // known that __i <= __m + while (true) + { + // __m still guards upward moving __i + while (__comp(*__i, *__m)) + ++__i; + // It is now known that a guard exists for downward moving __j + while (!__comp(*--__j, *__m)) + ; + if (__i > __j) + break; + swap(*__i, *__j); + ++__n_swaps; + // It is known that __m != __j + // If __m just moved, follow it + if (__m == __i) + __m = __j; + ++__i; + } + } + // [__first, __i) < *__m and *__m <= [__i, __last) + if (__i != __m && __comp(*__m, *__i)) + { + swap(*__i, *__m); + ++__n_swaps; + } + // [__first, __i) < *__i and *__i <= [__i+1, __last) + // If we were given a perfect partition, see if insertion sort is quick... + if (__n_swaps == 0) + { + bool __fs = _CUDA_VSTD::__insertion_sort_incomplete<_Compare>(__first, __i, __comp); + if (_CUDA_VSTD::__insertion_sort_incomplete<_Compare>(__i+1, __last, __comp)) + { + if (__fs) + return; + __last = __i; + continue; + } + else + { + if (__fs) + { + __first = ++__i; + continue; + } + } + } + // sort smaller range with recursive call and larger with tail recursion elimination + if (__i - __first < __last - __i) + { + _CUDA_VSTD::__sort<_Compare>(__first, __i, __comp); + // _CUDA_VSTD::__sort<_Compare>(__i+1, __last, __comp); + __first = ++__i; + } + else + { + _CUDA_VSTD::__sort<_Compare>(__i+1, __last, __comp); + // _CUDA_VSTD::__sort<_Compare>(__first, __i, __comp); + __last = __i; + } + } +} + +// This forwarder keeps the top call and the recursive calls using the same instantiation, forcing a reference _Compare +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + _CUDA_VSTD::__sort<_Comp_ref>(__first, __last, _Comp_ref(__comp)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +sort(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + _CUDA_VSTD::sort(__first, __last, __less::value_type>()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +sort(_Tp** __first, _Tp** __last) +{ + _CUDA_VSTD::sort((size_t*)__first, (size_t*)__last, __less{}); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last) +{ + _CUDA_VSTD::sort(__first.base(), __last.base()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp) +{ + typedef __add_lvalue_reference_t<_Compare> _Comp_ref; + _CUDA_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp); +} + +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, char*>(char*, char*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, signed*>(signed*, signed*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned char*>(unsigned char*, unsigned char*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, short*>(short*, short*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned short*>(unsigned short*, unsigned short*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, int*>(int*, int*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned*>(unsigned*, unsigned*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, long*>(long*, long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned long*>(unsigned long*, unsigned long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, long long*>(long long*, long long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned long long*>(unsigned long long*, unsigned long long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, float*>(float*, float*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, double*>(double*, double*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, long double*>(long double*, long double*, __less&)) + +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, char*>(char*, char*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, signed char*>(signed char*, signed char*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned char*>(unsigned char*, unsigned char*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, short*>(short*, short*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned short*>(unsigned short*, unsigned short*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, int*>(int*, int*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned*>(unsigned*, unsigned*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, long*>(long*, long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned long*>(unsigned long*, unsigned long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, long long*>(long long*, long long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned long long*>(unsigned long long*, unsigned long long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, float*>(float*, float*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, double*>(double*, double*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, long double*>(long double*, long double*, __less&)) + +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS unsigned __sort5<__less&, long double*>(long double*, long double*, long double*, long double*, long double*, __less&)) + +// lower_bound + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _ForwardIterator +__lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) +{ + typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; + difference_type __len = _CUDA_VSTD::distance(__first, __last); + while (__len != 0) + { + difference_type __l2 = _CUDA_VSTD::__half_positive(__len); + _ForwardIterator __m = __first; + _CUDA_VSTD::advance(__m, __l2); + if (__comp(*__m, __value_)) + { + __first = ++__m; + __len -= __l2 + 1; + } + else + __len = __l2; + } + return __first; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator +lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) +{ + typedef __add_lvalue_reference_t<_Compare> _Comp_ref; + return __lower_bound<_Comp_ref>(__first, __last, __value_, __comp); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator +lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) +{ + return _CUDA_VSTD::lower_bound(__first, __last, __value_, + __less{}); +} + +// upper_bound + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _ForwardIterator +__upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) +{ + typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; + difference_type __len = _CUDA_VSTD::distance(__first, __last); + while (__len != 0) + { + difference_type __l2 = _CUDA_VSTD::__half_positive(__len); + _ForwardIterator __m = __first; + _CUDA_VSTD::advance(__m, __l2); + if (__comp(__value_, *__m)) + __len = __l2; + else + { + __first = ++__m; + __len -= __l2 + 1; + } + } + return __first; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator +upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) +{ + typedef __add_lvalue_reference_t<_Compare> _Comp_ref; + return __upper_bound<_Comp_ref>(__first, __last, __value_, __comp); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_ForwardIterator +upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) +{ + return _CUDA_VSTD::upper_bound(__first, __last, __value_, + __less{}); +} + +// equal_range + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator> +__equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) +{ + typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; + difference_type __len = _CUDA_VSTD::distance(__first, __last); + while (__len != 0) + { + difference_type __l2 = _CUDA_VSTD::__half_positive(__len); + _ForwardIterator __m = __first; + _CUDA_VSTD::advance(__m, __l2); + if (__comp(*__m, __value_)) + { + __first = ++__m; + __len -= __l2 + 1; + } + else if (__comp(__value_, *__m)) + { + __last = __m; + __len = __l2; + } + else + { + _ForwardIterator __mp1 = __m; + return pair<_ForwardIterator, _ForwardIterator> + ( + __lower_bound<_Compare>(__first, __m, __value_, __comp), + __upper_bound<_Compare>(++__mp1, __last, __value_, __comp) + ); + } + } + return pair<_ForwardIterator, _ForwardIterator>(__first, __first); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +pair<_ForwardIterator, _ForwardIterator> +equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __equal_range<_Comp_ref>(__first, __last, __value_, __comp); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +pair<_ForwardIterator, _ForwardIterator> +equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) +{ + return _CUDA_VSTD::equal_range(__first, __last, __value_, + __less{}); +} + +// binary_search + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) +{ + __first = __lower_bound<_Compare>(__first, __last, __value_, __comp); + return __first != __last && !__comp(__value_, *__first); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __binary_search<_Comp_ref>(__first, __last, __value_, __comp); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) +{ + return _CUDA_VSTD::binary_search(__first, __last, __value_, + __less{}); +} + +// merge + +template +_LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +__merge(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) +{ + for (; __first1 != __last1; ++__result) + { + if (__first2 == __last2) + return _CUDA_VSTD::copy(__first1, __last1, __result); + if (__comp(*__first2, *__first1)) + { + *__result = *__first2; + ++__first2; + } + else + { + *__result = *__first1; + ++__first1; + } + } + return _CUDA_VSTD::copy(__first2, __last2, __result); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +merge(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return _CUDA_VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +merge(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) +{ + typedef typename iterator_traits<_InputIterator1>::value_type __v1; + typedef typename iterator_traits<_InputIterator2>::value_type __v2; + return _CUDA_VSTD::merge(__first1, __last1, __first2, __last2, __result, __less{}); +} + +// inplace_merge + +template +_LIBCUDACXX_HOST_DEVICE +void __half_inplace_merge(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) +{ + for (; __first1 != __last1; ++__result) + { + if (__first2 == __last2) + { + _CUDA_VSTD::move(__first1, __last1, __result); + return; + } + + if (__comp(*__first2, *__first1)) + { + *__result = _CUDA_VSTD::move(*__first2); + ++__first2; + } + else + { + *__result = _CUDA_VSTD::move(*__first1); + ++__first1; + } + } + // __first2 through __last2 are already in the right spot. +} + +template +_LIBCUDACXX_HOST_DEVICE +void +__buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, + _Compare __comp, typename iterator_traits<_BidirectionalIterator>::difference_type __len1, + typename iterator_traits<_BidirectionalIterator>::difference_type __len2, + typename iterator_traits<_BidirectionalIterator>::value_type* __buff) +{ + typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; + __destruct_n __d(0); + unique_ptr __h2(__buff, __d); + if (__len1 <= __len2) + { + value_type* __p = __buff; + for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p) + ::new(__p) value_type(_CUDA_VSTD::move(*__i)); + __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp); + } + else + { + value_type* __p = __buff; + for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p) + ::new(__p) value_type(_CUDA_VSTD::move(*__i)); + typedef reverse_iterator<_BidirectionalIterator> _RBi; + typedef reverse_iterator _Rv; + __half_inplace_merge(_Rv(__p), _Rv(__buff), + _RBi(__middle), _RBi(__first), + _RBi(__last), __invert<_Compare>(__comp)); + } +} + +template +_LIBCUDACXX_HOST_DEVICE +void +__inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, + _Compare __comp, typename iterator_traits<_BidirectionalIterator>::difference_type __len1, + typename iterator_traits<_BidirectionalIterator>::difference_type __len2, + typename iterator_traits<_BidirectionalIterator>::value_type* __buff, ptrdiff_t __buff_size) +{ + typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type; + while (true) + { + // if __middle == __last, we're done + if (__len2 == 0) + return; + if (__len1 <= __buff_size || __len2 <= __buff_size) + return __buffered_inplace_merge<_Compare> + (__first, __middle, __last, __comp, __len1, __len2, __buff); + // shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0 + for (; true; ++__first, (void) --__len1) + { + if (__len1 == 0) + return; + if (__comp(*__middle, *__first)) + break; + } + // __first < __middle < __last + // *__first > *__middle + // partition [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last) such that + // all elements in: + // [__first, __m1) <= [__middle, __m2) + // [__middle, __m2) < [__m1, __middle) + // [__m1, __middle) <= [__m2, __last) + // and __m1 or __m2 is in the middle of its range + _BidirectionalIterator __m1; // "median" of [__first, __middle) + _BidirectionalIterator __m2; // "median" of [__middle, __last) + difference_type __len11; // distance(__first, __m1) + difference_type __len21; // distance(__middle, __m2) + // binary search smaller range + if (__len1 < __len2) + { // __len >= 1, __len2 >= 2 + __len21 = __len2 / 2; + __m2 = __middle; + _CUDA_VSTD::advance(__m2, __len21); + __m1 = __upper_bound<_Compare>(__first, __middle, *__m2, __comp); + __len11 = _CUDA_VSTD::distance(__first, __m1); + } + else + { + if (__len1 == 1) + { // __len1 >= __len2 && __len2 > 0, therefore __len2 == 1 + // It is known *__first > *__middle + swap(*__first, *__middle); + return; + } + // __len1 >= 2, __len2 >= 1 + __len11 = __len1 / 2; + __m1 = __first; + _CUDA_VSTD::advance(__m1, __len11); + __m2 = __lower_bound<_Compare>(__middle, __last, *__m1, __comp); + __len21 = _CUDA_VSTD::distance(__middle, __m2); + } + difference_type __len12 = __len1 - __len11; // distance(__m1, __middle) + difference_type __len22 = __len2 - __len21; // distance(__m2, __last) + // [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last) + // swap middle two partitions + __middle = _CUDA_VSTD::rotate(__m1, __middle, __m2); + // __len12 and __len21 now have swapped meanings + // merge smaller range with recurisve call and larger with tail recursion elimination + if (__len11 + __len21 < __len12 + __len22) + { + __inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size); +// __inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size); + __first = __middle; + __middle = __m2; + __len1 = __len12; + __len2 = __len22; + } + else + { + __inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size); +// __inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size); + __last = __middle; + __middle = __m1; + __len1 = __len11; + __len2 = __len21; + } + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, + _Compare __comp) +{ + typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; + typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type; + difference_type __len1 = _CUDA_VSTD::distance(__first, __middle); + difference_type __len2 = _CUDA_VSTD::distance(__middle, __last); + difference_type __buf_size = _CUDA_VSTD::min(__len1, __len2); + pair __buf = _CUDA_VSTD::get_temporary_buffer(__buf_size); + unique_ptr __h(__buf.first); + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return _CUDA_VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2, + __buf.first, __buf.second); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last) +{ + _CUDA_VSTD::inplace_merge(__first, __middle, __last, + __less{}); +} + +// stable_sort + +template +_LIBCUDACXX_HOST_DEVICE +void +__merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + typename iterator_traits<_InputIterator1>::value_type* __result, _Compare __comp) +{ + typedef typename iterator_traits<_InputIterator1>::value_type value_type; + __destruct_n __d(0); + unique_ptr __h(__result, __d); + for (; true; ++__result) + { + if (__first1 == __last1) + { + for (; __first2 != __last2; ++__first2, ++__result, (void) __d.__incr((value_type*)0)) + ::new (__result) value_type(_CUDA_VSTD::move(*__first2)); + __h.release(); + return; + } + if (__first2 == __last2) + { + for (; __first1 != __last1; ++__first1, ++__result, (void) __d.__incr((value_type*)0)) + ::new (__result) value_type(_CUDA_VSTD::move(*__first1)); + __h.release(); + return; + } + if (__comp(*__first2, *__first1)) + { + ::new (__result) value_type(_CUDA_VSTD::move(*__first2)); + __d.__incr((value_type*)0); + ++__first2; + } + else + { + ::new (__result) value_type(_CUDA_VSTD::move(*__first1)); + __d.__incr((value_type*)0); + ++__first1; + } + } +} + +template +_LIBCUDACXX_HOST_DEVICE +void +__merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) +{ + for (; __first1 != __last1; ++__result) + { + if (__first2 == __last2) + { + for (; __first1 != __last1; ++__first1, (void) ++__result) + *__result = _CUDA_VSTD::move(*__first1); + return; + } + if (__comp(*__first2, *__first1)) + { + *__result = _CUDA_VSTD::move(*__first2); + ++__first2; + } + else + { + *__result = _CUDA_VSTD::move(*__first1); + ++__first1; + } + } + for (; __first2 != __last2; ++__first2, (void) ++__result) + *__result = _CUDA_VSTD::move(*__first2); +} + +template +_LIBCUDACXX_HOST_DEVICE +void +__stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, + typename iterator_traits<_RandomAccessIterator>::difference_type __len, + typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size); + +template +_LIBCUDACXX_HOST_DEVICE +void +__stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1, _Compare __comp, + typename iterator_traits<_RandomAccessIterator>::difference_type __len, + typename iterator_traits<_RandomAccessIterator>::value_type* __first2) +{ + typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; + switch (__len) + { + case 0: + return; + case 1: + ::new(__first2) value_type(_CUDA_VSTD::move(*__first1)); + return; + case 2: + __destruct_n __d(0); + unique_ptr __h2(__first2, __d); + if (__comp(*--__last1, *__first1)) + { + ::new(__first2) value_type(_CUDA_VSTD::move(*__last1)); + __d.__incr((value_type*)0); + ++__first2; + ::new(__first2) value_type(_CUDA_VSTD::move(*__first1)); + } + else + { + ::new(__first2) value_type(_CUDA_VSTD::move(*__first1)); + __d.__incr((value_type*)0); + ++__first2; + ::new(__first2) value_type(_CUDA_VSTD::move(*__last1)); + } + __h2.release(); + return; + } + if (__len <= 8) + { + __insertion_sort_move<_Compare>(__first1, __last1, __first2, __comp); + return; + } + typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2; + _RandomAccessIterator __m = __first1 + __l2; + __stable_sort<_Compare>(__first1, __m, __comp, __l2, __first2, __l2); + __stable_sort<_Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2); + __merge_move_construct<_Compare>(__first1, __m, __m, __last1, __first2, __comp); +} + +template +struct __stable_sort_switch +{ + static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value; +}; + +template +_LIBCUDACXX_HOST_DEVICE +void +__stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, + typename iterator_traits<_RandomAccessIterator>::difference_type __len, + typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size) +{ + typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + switch (__len) + { + case 0: + case 1: + return; + case 2: + if (__comp(*--__last, *__first)) + swap(*__first, *__last); + return; + } + if (__len <= static_cast(__stable_sort_switch::value)) + { + __insertion_sort<_Compare>(__first, __last, __comp); + return; + } + typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2; + _RandomAccessIterator __m = __first + __l2; + if (__len <= __buff_size) + { + __destruct_n __d(0); + unique_ptr __h2(__buff, __d); + __stable_sort_move<_Compare>(__first, __m, __comp, __l2, __buff); + __d.__set(__l2, (value_type*)0); + __stable_sort_move<_Compare>(__m, __last, __comp, __len - __l2, __buff + __l2); + __d.__set(__len, (value_type*)0); + __merge_move_assign<_Compare>(__buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp); +// __merge<_Compare>(move_iterator(__buff), +// move_iterator(__buff + __l2), +// move_iterator<_RandomAccessIterator>(__buff + __l2), +// move_iterator<_RandomAccessIterator>(__buff + __len), +// __first, __comp); + return; + } + __stable_sort<_Compare>(__first, __m, __comp, __l2, __buff, __buff_size); + __stable_sort<_Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size); + __inplace_merge<_Compare>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + difference_type __len = __last - __first; + pair __buf(0, 0); + unique_ptr __h; + if (__len > static_cast(__stable_sort_switch::value)) + { + __buf = _CUDA_VSTD::get_temporary_buffer(__len); + __h.reset(__buf.first); + } + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + __stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + _CUDA_VSTD::stable_sort(__first, __last, __less::value_type>()); +} + +// is_heap_until + +template +_LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator +is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename _CUDA_VSTD::iterator_traits<_RandomAccessIterator>::difference_type difference_type; + difference_type __len = __last - __first; + difference_type __p = 0; + difference_type __c = 1; + _RandomAccessIterator __pp = __first; + while (__c < __len) + { + _RandomAccessIterator __cp = __first + __c; + if (__comp(*__pp, *__cp)) + return __cp; + ++__c; + ++__cp; + if (__c == __len) + return __last; + if (__comp(*__pp, *__cp)) + return __cp; + ++__p; + ++__pp; + __c = 2 * __p + 1; + } + return __last; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_RandomAccessIterator +is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + return _CUDA_VSTD::is_heap_until(__first, __last, __less::value_type>()); +} + +// is_heap + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + return _CUDA_VSTD::is_heap_until(__first, __last, __comp) == __last; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + return _CUDA_VSTD::is_heap(__first, __last, __less::value_type>()); +} + +// push_heap + +template +_LIBCUDACXX_HOST_DEVICE +void +__sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, + typename iterator_traits<_RandomAccessIterator>::difference_type __len) +{ + typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; + if (__len > 1) + { + __len = (__len - 2) / 2; + _RandomAccessIterator __ptr = __first + __len; + if (__comp(*__ptr, *--__last)) + { + value_type __t(_CUDA_VSTD::move(*__last)); + do + { + *__last = _CUDA_VSTD::move(*__ptr); + __last = __ptr; + if (__len == 0) + break; + __len = (__len - 1) / 2; + __ptr = __first + __len; + } while (__comp(*__ptr, __t)); + *__last = _CUDA_VSTD::move(__t); + } + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + __sift_up<_Comp_ref>(__first, __last, __comp, __last - __first); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + _CUDA_VSTD::push_heap(__first, __last, __less::value_type>()); +} + +// pop_heap + +template +_LIBCUDACXX_HOST_DEVICE +void +__sift_down(_RandomAccessIterator __first, _RandomAccessIterator /*__last*/, + _Compare __comp, + typename iterator_traits<_RandomAccessIterator>::difference_type __len, + _RandomAccessIterator __start) +{ + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; + // left-child of __start is at 2 * __start + 1 + // right-child of __start is at 2 * __start + 2 + difference_type __child = __start - __first; + + if (__len < 2 || (__len - 2) / 2 < __child) + return; + + __child = 2 * __child + 1; + _RandomAccessIterator __child_i = __first + __child; + + if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + 1))) { + // right-child exists and is greater than left-child + ++__child_i; + ++__child; + } + + // check if we are in heap-order + if (__comp(*__child_i, *__start)) + // we are, __start is larger than it's largest child + return; + + value_type __top(_CUDA_VSTD::move(*__start)); + do + { + // we are not in heap-order, swap the parent with it's largest child + *__start = _CUDA_VSTD::move(*__child_i); + __start = __child_i; + + if ((__len - 2) / 2 < __child) + break; + + // recompute the child based off of the updated parent + __child = 2 * __child + 1; + __child_i = __first + __child; + + if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + 1))) { + // right-child exists and is greater than left-child + ++__child_i; + ++__child; + } + + // check if we are in heap-order + } while (!__comp(*__child_i, __top)); + *__start = _CUDA_VSTD::move(__top); +} + +template +inline _LIBCUDACXX_HOST_DEVICE +void +__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, + typename iterator_traits<_RandomAccessIterator>::difference_type __len) +{ + if (__len > 1) + { + swap(*__first, *--__last); + __sift_down<_Compare>(__first, __last, __comp, __len - 1, __first); + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + __pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + _CUDA_VSTD::pop_heap(__first, __last, __less::value_type>()); +} + +// make_heap + +template +_LIBCUDACXX_INLINE_VISIBILITY +void +__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + difference_type __n = __last - __first; + if (__n > 1) + { + // start from the first parent, there is no need to consider children + for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start) + { + __sift_down<_Compare>(__first, __last, __comp, __n, __first + __start); + } + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + __make_heap<_Comp_ref>(__first, __last, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + _CUDA_VSTD::make_heap(__first, __last, __less::value_type>()); +} + +// sort_heap + +template +_LIBCUDACXX_HOST_DEVICE +void +__sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n) + __pop_heap<_Compare>(__first, __last, __comp, __n); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + __sort_heap<_Comp_ref>(__first, __last, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + _CUDA_VSTD::sort_heap(__first, __last, __less::value_type>()); +} + +// partial_sort + +template +_LIBCUDACXX_HOST_DEVICE +void +__partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, + _Compare __comp) +{ + __make_heap<_Compare>(__first, __middle, __comp); + typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first; + for (_RandomAccessIterator __i = __middle; __i != __last; ++__i) + { + if (__comp(*__i, *__first)) + { + swap(*__i, *__first); + __sift_down<_Compare>(__first, __middle, __comp, __len, __first); + } + } + __sort_heap<_Compare>(__first, __middle, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, + _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + __partial_sort<_Comp_ref>(__first, __middle, __last, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) +{ + _CUDA_VSTD::partial_sort(__first, __middle, __last, + __less::value_type>()); +} + +// partial_sort_copy + +template +_LIBCUDACXX_HOST_DEVICE +_RandomAccessIterator +__partial_sort_copy(_InputIterator __first, _InputIterator __last, + _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp) +{ + _RandomAccessIterator __r = __result_first; + if (__r != __result_last) + { + for (; __first != __last && __r != __result_last; ++__first, (void) ++__r) + *__r = *__first; + __make_heap<_Compare>(__result_first, __r, __comp); + typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first; + for (; __first != __last; ++__first) + if (__comp(*__first, *__result_first)) + { + *__result_first = *__first; + __sift_down<_Compare>(__result_first, __r, __comp, __len, __result_first); + } + __sort_heap<_Compare>(__result_first, __r, __comp); + } + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_RandomAccessIterator +partial_sort_copy(_InputIterator __first, _InputIterator __last, + _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_RandomAccessIterator +partial_sort_copy(_InputIterator __first, _InputIterator __last, + _RandomAccessIterator __result_first, _RandomAccessIterator __result_last) +{ + return _CUDA_VSTD::partial_sort_copy(__first, __last, __result_first, __result_last, + __less::value_type>()); +} + +// nth_element + +template +_LIBCUDACXX_HOST_DEVICE +void +__nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) +{ + // _Compare is known to be a reference type + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + const difference_type __limit = 7; + while (true) + { + __restart: + if (__nth == __last) + return; + difference_type __len = __last - __first; + switch (__len) + { + case 0: + case 1: + return; + case 2: + if (__comp(*--__last, *__first)) + swap(*__first, *__last); + return; + case 3: + { + _RandomAccessIterator __m = __first; + _CUDA_VSTD::__sort3<_Compare>(__first, ++__m, --__last, __comp); + return; + } + } + if (__len <= __limit) + { + __selection_sort<_Compare>(__first, __last, __comp); + return; + } + // __len > __limit >= 3 + _RandomAccessIterator __m = __first + __len/2; + _RandomAccessIterator __lm1 = __last; + unsigned __n_swaps = _CUDA_VSTD::__sort3<_Compare>(__first, __m, --__lm1, __comp); + // *__m is median + // partition [__first, __m) < *__m and *__m <= [__m, __last) + // (this inhibits tossing elements equivalent to __m around unnecessarily) + _RandomAccessIterator __i = __first; + _RandomAccessIterator __j = __lm1; + // j points beyond range to be tested, *__lm1 is known to be <= *__m + // The search going up is known to be guarded but the search coming down isn't. + // Prime the downward search with a guard. + if (!__comp(*__i, *__m)) // if *__first == *__m + { + // *__first == *__m, *__first doesn't go in first part + // manually guard downward moving __j against __i + while (true) + { + if (__i == --__j) + { + // *__first == *__m, *__m <= all other elements + // Parition instead into [__first, __i) == *__first and *__first < [__i, __last) + ++__i; // __first + 1 + __j = __last; + if (!__comp(*__first, *--__j)) // we need a guard if *__first == *(__last-1) + { + while (true) + { + if (__i == __j) + return; // [__first, __last) all equivalent elements + if (__comp(*__first, *__i)) + { + swap(*__i, *__j); + ++__n_swaps; + ++__i; + break; + } + ++__i; + } + } + // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1 + if (__i == __j) + return; + while (true) + { + while (!__comp(*__first, *__i)) + ++__i; + while (__comp(*__first, *--__j)) + ; + if (__i >= __j) + break; + swap(*__i, *__j); + ++__n_swaps; + ++__i; + } + // [__first, __i) == *__first and *__first < [__i, __last) + // The first part is sorted, + if (__nth < __i) + return; + // __nth_element the secod part + // __nth_element<_Compare>(__i, __nth, __last, __comp); + __first = __i; + goto __restart; + } + if (__comp(*__j, *__m)) + { + swap(*__i, *__j); + ++__n_swaps; + break; // found guard for downward moving __j, now use unguarded partition + } + } + } + ++__i; + // j points beyond range to be tested, *__lm1 is known to be <= *__m + // if not yet partitioned... + if (__i < __j) + { + // known that *(__i - 1) < *__m + while (true) + { + // __m still guards upward moving __i + while (__comp(*__i, *__m)) + ++__i; + // It is now known that a guard exists for downward moving __j + while (!__comp(*--__j, *__m)) + ; + if (__i >= __j) + break; + swap(*__i, *__j); + ++__n_swaps; + // It is known that __m != __j + // If __m just moved, follow it + if (__m == __i) + __m = __j; + ++__i; + } + } + // [__first, __i) < *__m and *__m <= [__i, __last) + if (__i != __m && __comp(*__m, *__i)) + { + swap(*__i, *__m); + ++__n_swaps; + } + // [__first, __i) < *__i and *__i <= [__i+1, __last) + if (__nth == __i) + return; + if (__n_swaps == 0) + { + // We were given a perfectly partitioned sequence. Coincidence? + if (__nth < __i) + { + // Check for [__first, __i) already sorted + __j = __m = __first; + while (++__j != __i) + { + if (__comp(*__j, *__m)) + // not yet sorted, so sort + goto not_sorted; + __m = __j; + } + // [__first, __i) sorted + return; + } + else + { + // Check for [__i, __last) already sorted + __j = __m = __i; + while (++__j != __last) + { + if (__comp(*__j, *__m)) + // not yet sorted, so sort + goto not_sorted; + __m = __j; + } + // [__i, __last) sorted + return; + } + } +not_sorted: + // __nth_element on range containing __nth + if (__nth < __i) + { + // __nth_element<_Compare>(__first, __nth, __i, __comp); + __last = __i; + } + else + { + // __nth_element<_Compare>(__i+1, __nth, __last, __comp); + __first = ++__i; + } + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + __nth_element<_Comp_ref>(__first, __nth, __last, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last) +{ + _CUDA_VSTD::nth_element(__first, __nth, __last, __less::value_type>()); +} + +// includes + +template +_LIBCUDACXX_HOST_DEVICE +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +__includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, + _Compare __comp) +{ + for (; __first2 != __last2; ++__first1) + { + if (__first1 == __last1 || __comp(*__first2, *__first1)) + return false; + if (!__comp(*__first1, *__first2)) + ++__first2; + } + return true; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, + _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) +{ + return _CUDA_VSTD::includes(__first1, __last1, __first2, __last2, + __less::value_type, + typename iterator_traits<_InputIterator2>::value_type>()); +} + +// set_union + +template +_LIBCUDACXX_HOST_DEVICE +_OutputIterator +__set_union(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) +{ + for (; __first1 != __last1; ++__result) + { + if (__first2 == __last2) + return _CUDA_VSTD::copy(__first1, __last1, __result); + if (__comp(*__first2, *__first1)) + { + *__result = *__first2; + ++__first2; + } + else + { + if (!__comp(*__first1, *__first2)) + ++__first2; + *__result = *__first1; + ++__first1; + } + } + return _CUDA_VSTD::copy(__first2, __last2, __result); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +set_union(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +set_union(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) +{ + return _CUDA_VSTD::set_union(__first1, __last1, __first2, __last2, __result, + __less::value_type, + typename iterator_traits<_InputIterator2>::value_type>()); +} + +// set_intersection + +template +_LIBCUDACXX_HOST_DEVICE +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 _OutputIterator +__set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) +{ + while (__first1 != __last1 && __first2 != __last2) + { + if (__comp(*__first1, *__first2)) + ++__first1; + else + { + if (!__comp(*__first2, *__first1)) + { + *__result = *__first1; + ++__result; + ++__first1; + } + ++__first2; + } + } + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +_OutputIterator +set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) +{ + return _CUDA_VSTD::set_intersection(__first1, __last1, __first2, __last2, __result, + __less::value_type, + typename iterator_traits<_InputIterator2>::value_type>()); +} + +// set_difference + +template +_LIBCUDACXX_HOST_DEVICE +_OutputIterator +__set_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) +{ + while (__first1 != __last1) + { + if (__first2 == __last2) + return _CUDA_VSTD::copy(__first1, __last1, __result); + if (__comp(*__first1, *__first2)) + { + *__result = *__first1; + ++__result; + ++__first1; + } + else + { + if (!__comp(*__first2, *__first1)) + ++__first1; + ++__first2; + } + } + return __result; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +set_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +set_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) +{ + return _CUDA_VSTD::set_difference(__first1, __last1, __first2, __last2, __result, + __less::value_type, + typename iterator_traits<_InputIterator2>::value_type>()); +} + +// set_symmetric_difference + +template +_LIBCUDACXX_HOST_DEVICE +_OutputIterator +__set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) +{ + while (__first1 != __last1) + { + if (__first2 == __last2) + return _CUDA_VSTD::copy(__first1, __last1, __result); + if (__comp(*__first1, *__first2)) + { + *__result = *__first1; + ++__result; + ++__first1; + } + else + { + if (__comp(*__first2, *__first1)) + { + *__result = *__first2; + ++__result; + } + else + ++__first1; + ++__first2; + } + } + return _CUDA_VSTD::copy(__first2, __last2, __result); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_OutputIterator +set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) +{ + return _CUDA_VSTD::set_symmetric_difference(__first1, __last1, __first2, __last2, __result, + __less::value_type, + typename iterator_traits<_InputIterator2>::value_type>()); +} + +// lexicographical_compare +#endif // __cuda_std__ + +template +_LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +__lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) +{ + for (; __first2 != __last2; ++__first1, (void) ++__first2) + { + if (__first1 == __last1 || __comp(*__first1, *__first2)) + return true; + if (__comp(*__first2, *__first1)) + return false; + } + return false; +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp); +} + +template +_LIBCUDACXX_NODISCARD_EXT inline +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 +bool +lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2) +{ + return _CUDA_VSTD::lexicographical_compare(__first1, __last1, __first2, __last2, + __less::value_type, + typename iterator_traits<_InputIterator2>::value_type>()); +} + +#ifndef __cuda_std__ +// next_permutation + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) +{ + _BidirectionalIterator __i = __last; + if (__first == __last || __first == --__i) + return false; + while (true) + { + _BidirectionalIterator __ip1 = __i; + if (__comp(*--__i, *__ip1)) + { + _BidirectionalIterator __j = __last; + while (!__comp(*__i, *--__j)) + ; + swap(*__i, *__j); + _CUDA_VSTD::reverse(__ip1, __last); + return true; + } + if (__i == __first) + { + _CUDA_VSTD::reverse(__first, __last); + return false; + } + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __next_permutation<_Comp_ref>(__first, __last, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) +{ + return _CUDA_VSTD::next_permutation(__first, __last, + __less{}); +} + +// prev_permutation + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) +{ + _BidirectionalIterator __i = __last; + if (__first == __last || __first == --__i) + return false; + while (true) + { + _BidirectionalIterator __ip1 = __i; + if (__comp(*__ip1, *--__i)) + { + _BidirectionalIterator __j = __last; + while (!__comp(*--__j, *__i)) + ; + swap(*__i, *__j); + _CUDA_VSTD::reverse(__ip1, __last); + return true; + } + if (__i == __first) + { + _CUDA_VSTD::reverse(__first, __last); + return false; + } + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) +{ + typedef typename __comp_ref_type<_Compare>::type _Comp_ref; + return __prev_permutation<_Comp_ref>(__first, __last, __comp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) +{ + return _CUDA_VSTD::prev_permutation(__first, __last, + __less{}); +} + +#endif +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +_LIBCUDACXX_POP_MACROS +#endif + +#if defined(_LIBCUDACXX_HAS_PARALLEL_ALGORITHMS) && _LIBCUDACXX_STD_VER >= 17 +# include <__pstl_algorithm> +#endif + +#endif // _LIBCUDACXX_ALGORITHM diff --git a/cuda_toolkit/include/any b/cuda_toolkit/include/any new file mode 100644 index 0000000000000000000000000000000000000000..4d8ed625ad12ff55b326e59b65bda55a89c73b5a --- /dev/null +++ b/cuda_toolkit/include/any @@ -0,0 +1,675 @@ +// -*- C++ -*- +//===------------------------------ any -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_ANY +#define _LIBCUDACXX_ANY + +/* + any synopsis + +namespace std { + + class bad_any_cast : public bad_cast + { + public: + virtual const char* what() const noexcept; + }; + + class any + { + public: + + // 6.3.1 any construct/destruct + any() noexcept; + + any(const any& other); + any(any&& other) noexcept; + + template + any(ValueType&& value); + + ~any(); + + // 6.3.2 any assignments + any& operator=(const any& rhs); + any& operator=(any&& rhs) noexcept; + + template + any& operator=(ValueType&& rhs); + + // 6.3.3 any modifiers + template + decay_t& emplace(Args&&... args); + template + decay_t& emplace(initializer_list, Args&&...); + void reset() noexcept; + void swap(any& rhs) noexcept; + + // 6.3.4 any observers + bool has_value() const noexcept; + const type_info& type() const noexcept; + }; + + // 6.4 Non-member functions + void swap(any& x, any& y) noexcept; + + template + any make_any(Args&& ...args); + template + any make_any(initializer_list, Args&& ...args); + + template + ValueType any_cast(const any& operand); + template + ValueType any_cast(any& operand); + template + ValueType any_cast(any&& operand); + + template + const ValueType* any_cast(const any* operand) noexcept; + template + ValueType* any_cast(any* operand) noexcept; + +} // namespace std + +*/ + +#include +#include +#include +#include +#include +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +namespace std { +class _LIBCUDACXX_EXCEPTION_ABI _LIBCUDACXX_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast +{ +public: + virtual const char* what() const noexcept; +}; +} // namespace std + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#if _LIBCUDACXX_STD_VER > 14 + +_LIBCUDACXX_NORETURN inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_AVAILABILITY_THROW_BAD_ANY_CAST +void __throw_bad_any_cast() +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + throw bad_any_cast(); +#else + _CUDA_VSTD::abort(); +#endif +} + +// Forward declarations +class _LIBCUDACXX_TEMPLATE_VIS any; + +template +_LIBCUDACXX_INLINE_VISIBILITY +add_pointer_t> +any_cast(any const *) noexcept; + +template +_LIBCUDACXX_INLINE_VISIBILITY +add_pointer_t<_ValueType> any_cast(any *) noexcept; + +namespace __any_imp +{ + using _Buffer = aligned_storage_t<3*sizeof(void*), alignment_of::value>; + + template + using _IsSmallObject = integral_constant::value + % alignment_of<_Tp>::value == 0 + && is_nothrow_move_constructible<_Tp>::value + >; + + enum class _Action { + _Destroy, + _Copy, + _Move, + _Get, + _TypeInfo + }; + + template struct _SmallHandler; + template struct _LargeHandler; + + template + struct _LIBCUDACXX_TEMPLATE_VIS __unique_typeinfo { static constexpr int __id = 0; }; + template constexpr int __unique_typeinfo<_Tp>::__id; + + template + inline _LIBCUDACXX_INLINE_VISIBILITY + constexpr const void* __get_fallback_typeid() { + return &__unique_typeinfo>::__id; + } + + template + inline _LIBCUDACXX_INLINE_VISIBILITY + bool __compare_typeid(type_info const* __id, const void* __fallback_id) + { +#if !defined(_LIBCUDACXX_NO_RTTI) + if (__id && *__id == typeid(_Tp)) + return true; +#endif + if (!__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>()) + return true; + return false; + } + + template + using _Handler = conditional_t< + _IsSmallObject<_Tp>::value, _SmallHandler<_Tp>, _LargeHandler<_Tp>>; + +} // namespace __any_imp + +class _LIBCUDACXX_TEMPLATE_VIS any +{ +public: + // construct/destruct + _LIBCUDACXX_INLINE_VISIBILITY + constexpr any() noexcept : __h(nullptr) {} + + _LIBCUDACXX_INLINE_VISIBILITY + any(any const & __other) : __h(nullptr) + { + if (__other.__h) __other.__call(_Action::_Copy, this); + } + + _LIBCUDACXX_INLINE_VISIBILITY + any(any && __other) noexcept : __h(nullptr) + { + if (__other.__h) __other.__call(_Action::_Move, this); + } + + template < + class _ValueType + , class _Tp = decay_t<_ValueType> + , class = enable_if_t< + !is_same<_Tp, any>::value && + !__is_inplace_type<_ValueType>::value && + is_copy_constructible<_Tp>::value> + > + _LIBCUDACXX_INLINE_VISIBILITY + any(_ValueType && __value); + + template , + class = enable_if_t< + is_constructible<_Tp, _Args...>::value && + is_copy_constructible<_Tp>::value + > + > + _LIBCUDACXX_INLINE_VISIBILITY + explicit any(in_place_type_t<_ValueType>, _Args&&... __args); + + template , + class = enable_if_t< + is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value && + is_copy_constructible<_Tp>::value> + > + _LIBCUDACXX_INLINE_VISIBILITY + explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args); + + _LIBCUDACXX_INLINE_VISIBILITY + ~any() { this->reset(); } + + // assignments + _LIBCUDACXX_INLINE_VISIBILITY + any & operator=(any const & __rhs) { + any(__rhs).swap(*this); + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + any & operator=(any && __rhs) noexcept { + any(_CUDA_VSTD::move(__rhs)).swap(*this); + return *this; + } + + template < + class _ValueType + , class _Tp = decay_t<_ValueType> + , class = enable_if_t< + !is_same<_Tp, any>::value + && is_copy_constructible<_Tp>::value> + > + _LIBCUDACXX_INLINE_VISIBILITY + any & operator=(_ValueType && __rhs); + + template , + class = enable_if_t< + is_constructible<_Tp, _Args...>::value && + is_copy_constructible<_Tp>::value> + > + _LIBCUDACXX_INLINE_VISIBILITY + _Tp& emplace(_Args&&... args); + + template , + class = enable_if_t< + is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value && + is_copy_constructible<_Tp>::value> + > + _LIBCUDACXX_INLINE_VISIBILITY + _Tp& emplace(initializer_list<_Up>, _Args&&...); + + // 6.3.3 any modifiers + _LIBCUDACXX_INLINE_VISIBILITY + void reset() noexcept { if (__h) this->__call(_Action::_Destroy); } + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(any & __rhs) noexcept; + + // 6.3.4 any observers + _LIBCUDACXX_INLINE_VISIBILITY + bool has_value() const noexcept { return __h != nullptr; } + +#if !defined(_LIBCUDACXX_NO_RTTI) + _LIBCUDACXX_INLINE_VISIBILITY + const type_info & type() const noexcept { + if (__h) { + return *static_cast(this->__call(_Action::_TypeInfo)); + } else { + return typeid(void); + } + } +#endif + +private: + typedef __any_imp::_Action _Action; + using _HandleFuncPtr = void* (*)(_Action, any const *, any *, const type_info *, + const void* __fallback_info); + + union _Storage { + constexpr _Storage() : __ptr(nullptr) {} + void * __ptr; + __any_imp::_Buffer __buf; + }; + + _LIBCUDACXX_INLINE_VISIBILITY + void * __call(_Action __a, any * __other = nullptr, + type_info const * __info = nullptr, + const void* __fallback_info = nullptr) const + { + return __h(__a, this, __other, __info, __fallback_info); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void * __call(_Action __a, any * __other = nullptr, + type_info const * __info = nullptr, + const void* __fallback_info = nullptr) + { + return __h(__a, this, __other, __info, __fallback_info); + } + + template + friend struct __any_imp::_SmallHandler; + template + friend struct __any_imp::_LargeHandler; + + template + friend add_pointer_t> + any_cast(any const *) noexcept; + + template + friend add_pointer_t<_ValueType> + any_cast(any *) noexcept; + + _HandleFuncPtr __h = nullptr; + _Storage __s; +}; + +namespace __any_imp +{ + template + struct _LIBCUDACXX_TEMPLATE_VIS _SmallHandler + { + _LIBCUDACXX_INLINE_VISIBILITY + static void* __handle(_Action __act, any const * __this, any * __other, + type_info const * __info, const void* __fallback_info) + { + switch (__act) + { + case _Action::_Destroy: + __destroy(const_cast(*__this)); + return nullptr; + case _Action::_Copy: + __copy(*__this, *__other); + return nullptr; + case _Action::_Move: + __move(const_cast(*__this), *__other); + return nullptr; + case _Action::_Get: + return __get(const_cast(*__this), __info, __fallback_info); + case _Action::_TypeInfo: + return __type_info(); + } + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + static _Tp& __create(any & __dest, _Args&&... __args) { + _Tp* __ret = ::new (static_cast(&__dest.__s.__buf)) _Tp(_CUDA_VSTD::forward<_Args>(__args)...); + __dest.__h = &_SmallHandler::__handle; + return *__ret; + } + + private: + _LIBCUDACXX_INLINE_VISIBILITY + static void __destroy(any & __this) { + _Tp & __value = *static_cast<_Tp *>(static_cast(&__this.__s.__buf)); + __value.~_Tp(); + __this.__h = nullptr; + } + + _LIBCUDACXX_INLINE_VISIBILITY + static void __copy(any const & __this, any & __dest) { + _SmallHandler::__create(__dest, *static_cast<_Tp const *>( + static_cast(&__this.__s.__buf))); + } + + _LIBCUDACXX_INLINE_VISIBILITY + static void __move(any & __this, any & __dest) { + _SmallHandler::__create(__dest, _CUDA_VSTD::move( + *static_cast<_Tp*>(static_cast(&__this.__s.__buf)))); + __destroy(__this); + } + + _LIBCUDACXX_INLINE_VISIBILITY + static void* __get(any & __this, + type_info const * __info, + const void* __fallback_id) + { + if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_id)) + return static_cast(&__this.__s.__buf); + return nullptr; + } + + _LIBCUDACXX_INLINE_VISIBILITY + static void* __type_info() + { +#if !defined(_LIBCUDACXX_NO_RTTI) + return const_cast(static_cast(&typeid(_Tp))); +#else + return nullptr; +#endif + } + }; + + template + struct _LIBCUDACXX_TEMPLATE_VIS _LargeHandler + { + _LIBCUDACXX_INLINE_VISIBILITY + static void* __handle(_Action __act, any const * __this, + any * __other, type_info const * __info, + void const* __fallback_info) + { + switch (__act) + { + case _Action::_Destroy: + __destroy(const_cast(*__this)); + return nullptr; + case _Action::_Copy: + __copy(*__this, *__other); + return nullptr; + case _Action::_Move: + __move(const_cast(*__this), *__other); + return nullptr; + case _Action::_Get: + return __get(const_cast(*__this), __info, __fallback_info); + case _Action::_TypeInfo: + return __type_info(); + } + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + static _Tp& __create(any & __dest, _Args&&... __args) { + typedef allocator<_Tp> _Alloc; + typedef __allocator_destructor<_Alloc> _Dp; + _Alloc __a; + unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); + _Tp* __ret = ::new ((void*)__hold.get()) _Tp(_CUDA_VSTD::forward<_Args>(__args)...); + __dest.__s.__ptr = __hold.release(); + __dest.__h = &_LargeHandler::__handle; + return *__ret; + } + + private: + + _LIBCUDACXX_INLINE_VISIBILITY + static void __destroy(any & __this){ + delete static_cast<_Tp*>(__this.__s.__ptr); + __this.__h = nullptr; + } + + _LIBCUDACXX_INLINE_VISIBILITY + static void __copy(any const & __this, any & __dest) { + _LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + static void __move(any & __this, any & __dest) { + __dest.__s.__ptr = __this.__s.__ptr; + __dest.__h = &_LargeHandler::__handle; + __this.__h = nullptr; + } + + _LIBCUDACXX_INLINE_VISIBILITY + static void* __get(any & __this, type_info const * __info, + void const* __fallback_info) + { + if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_info)) + return static_cast(__this.__s.__ptr); + return nullptr; + + } + + _LIBCUDACXX_INLINE_VISIBILITY + static void* __type_info() + { +#if !defined(_LIBCUDACXX_NO_RTTI) + return const_cast(static_cast(&typeid(_Tp))); +#else + return nullptr; +#endif + } + }; + +} // namespace __any_imp + + +template +any::any(_ValueType && __v) : __h(nullptr) +{ + __any_imp::_Handler<_Tp>::__create(*this, _CUDA_VSTD::forward<_ValueType>(__v)); +} + +template +any::any(in_place_type_t<_ValueType>, _Args&&... __args) { + __any_imp::_Handler<_Tp>::__create(*this, _CUDA_VSTD::forward<_Args>(__args)...); +} + +template +any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) { + __any_imp::_Handler<_Tp>::__create(*this, __il, _CUDA_VSTD::forward<_Args>(__args)...); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +any & any::operator=(_ValueType && __v) +{ + any(_CUDA_VSTD::forward<_ValueType>(__v)).swap(*this); + return *this; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_Tp& any::emplace(_Args&&... __args) { + reset(); + return __any_imp::_Handler<_Tp>::__create(*this, _CUDA_VSTD::forward<_Args>(__args)...); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) { + reset(); + return __any_imp::_Handler<_Tp>::__create(*this, __il, _CUDA_VSTD::forward<_Args>(__args)...); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void any::swap(any & __rhs) noexcept +{ + if (this == &__rhs) + return; + if (__h && __rhs.__h) { + any __tmp; + __rhs.__call(_Action::_Move, &__tmp); + this->__call(_Action::_Move, &__rhs); + __tmp.__call(_Action::_Move, this); + } + else if (__h) { + this->__call(_Action::_Move, &__rhs); + } + else if (__rhs.__h) { + __rhs.__call(_Action::_Move, this); + } +} + +// 6.4 Non-member functions + +inline _LIBCUDACXX_INLINE_VISIBILITY +void swap(any & __lhs, any & __rhs) noexcept +{ + __lhs.swap(__rhs); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +any make_any(_Args&&... __args) { + return any(in_place_type<_Tp>, _CUDA_VSTD::forward<_Args>(__args)...); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +any make_any(initializer_list<_Up> __il, _Args&&... __args) { + return any(in_place_type<_Tp>, __il, _CUDA_VSTD::forward<_Args>(__args)...); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_AVAILABILITY_THROW_BAD_ANY_CAST +_ValueType any_cast(any const & __v) +{ + using _RawValueType = __remove_cvref_t<_ValueType>; + static_assert(is_constructible<_ValueType, _RawValueType const &>::value, + "ValueType is required to be a const lvalue reference " + "or a CopyConstructible type"); + auto __tmp = _CUDA_VSTD::any_cast>(&__v); + if (__tmp == nullptr) + __throw_bad_any_cast(); + return static_cast<_ValueType>(*__tmp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_AVAILABILITY_THROW_BAD_ANY_CAST +_ValueType any_cast(any & __v) +{ + using _RawValueType = __remove_cvref_t<_ValueType>; + static_assert(is_constructible<_ValueType, _RawValueType &>::value, + "ValueType is required to be an lvalue reference " + "or a CopyConstructible type"); + auto __tmp = _CUDA_VSTD::any_cast<_RawValueType>(&__v); + if (__tmp == nullptr) + __throw_bad_any_cast(); + return static_cast<_ValueType>(*__tmp); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_AVAILABILITY_THROW_BAD_ANY_CAST +_ValueType any_cast(any && __v) +{ + using _RawValueType = __remove_cvref_t<_ValueType>; + static_assert(is_constructible<_ValueType, _RawValueType>::value, + "ValueType is required to be an rvalue reference " + "or a CopyConstructible type"); + auto __tmp = _CUDA_VSTD::any_cast<_RawValueType>(&__v); + if (__tmp == nullptr) + __throw_bad_any_cast(); + return static_cast<_ValueType>(_CUDA_VSTD::move(*__tmp)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +add_pointer_t> +any_cast(any const * __any) noexcept +{ + static_assert(!is_reference<_ValueType>::value, + "_ValueType may not be a reference."); + return _CUDA_VSTD::any_cast<_ValueType>(const_cast(__any)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_RetType __pointer_or_func_cast(void* __p, /*IsFunction*/false_type) noexcept { + return static_cast<_RetType>(__p); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_RetType __pointer_or_func_cast(void*, /*IsFunction*/true_type) noexcept { + return nullptr; +} + +template +add_pointer_t<_ValueType> +any_cast(any * __any) noexcept +{ + using __any_imp::_Action; + static_assert(!is_reference<_ValueType>::value, + "_ValueType may not be a reference."); + typedef typename add_pointer<_ValueType>::type _ReturnType; + if (__any && __any->__h) { + void *__p = __any->__call(_Action::_Get, nullptr, +#if !defined(_LIBCUDACXX_NO_RTTI) + &typeid(_ValueType), +#else + nullptr, +#endif + __any_imp::__get_fallback_typeid<_ValueType>()); + return _CUDA_VSTD::__pointer_or_func_cast<_ReturnType>( + __p, is_function<_ValueType>{}); + } + return nullptr; +} + +#endif // _LIBCUDACXX_STD_VER > 14 + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_ANY diff --git a/cuda_toolkit/include/array b/cuda_toolkit/include/array new file mode 100644 index 0000000000000000000000000000000000000000..597388a2430362dd1d73ac4b5133d8ed20e2fb00 --- /dev/null +++ b/cuda_toolkit/include/array @@ -0,0 +1,516 @@ +// -*- C++ -*- +//===---------------------------- array -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_ARRAY +#define _LIBCUDACXX_ARRAY + +/* + array synopsis + +namespace std +{ +template +struct array +{ + // types: + typedef T & reference; + typedef const T & const_reference; + typedef implementation defined iterator; + typedef implementation defined const_iterator; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // No explicit construct/copy/destroy for aggregate type + void fill(const T& u); + void swap(array& a) noexcept(is_nothrow_swappable_v); + + // iterators: + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; + + reverse_iterator rbegin() noexcept; + const_reverse_iterator rbegin() const noexcept; + reverse_iterator rend() noexcept; + const_reverse_iterator rend() const noexcept; + + const_iterator cbegin() const noexcept; + const_iterator cend() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator crend() const noexcept; + + // capacity: + constexpr size_type size() const noexcept; + constexpr size_type max_size() const noexcept; + constexpr bool empty() const noexcept; + + // element access: + reference operator[](size_type n); + const_reference operator[](size_type n) const; // constexpr in C++14 + const_reference at(size_type n) const; // constexpr in C++14 + reference at(size_type n); + + reference front(); + const_reference front() const; // constexpr in C++14 + reference back(); + const_reference back() const; // constexpr in C++14 + + T* data() noexcept; + const T* data() const noexcept; +}; + + template + array(T, U...) -> array; + +template + bool operator==(const array& x, const array& y); +template + bool operator!=(const array& x, const array& y); +template + bool operator<(const array& x, const array& y); +template + bool operator>(const array& x, const array& y); +template + bool operator<=(const array& x, const array& y); +template + bool operator>=(const array& x, const array& y); + +template + void swap(array& x, array& y) noexcept(noexcept(x.swap(y))); // C++17 + +template struct tuple_size; +template struct tuple_element; +template struct tuple_size>; +template struct tuple_element>; +template T& get(array&) noexcept; // constexpr in C++14 +template const T& get(const array&) noexcept; // constexpr in C++14 +template T&& get(array&&) noexcept; // constexpr in C++14 +template const T&& get(const array&&) noexcept; // constexpr in C++14 + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#endif // __cuda_std__ + +#include "__algorithm/swap_ranges.h" +#include "__assert" // all public C++ headers provide the assertion handler +#include "__debug" +#include "__iterator/reverse_iterator.h" +#include "__tuple_dir/sfinae_helpers.h" +#include "__tuple_dir/structured_bindings.h" +#include "__type_traits/conditional.h" +#include "__type_traits/enable_if.h" +#include "__type_traits/is_const.h" +#include "__type_traits/is_same.h" +#include "__type_traits/is_swappable.h" +#include "__utility/integer_sequence.h" +#include "__utility/move.h" +#include "__utility/unreachable.h" +#include "algorithm" +#include "cstdint" +#include "cstdlib" +#include "limits" +#include "stdexcept" +#include "type_traits" +#include "version" + +// standard-mandated includes +#include "version" + +// [iterator.range] +#include "__iterator/access.h" +#include "__iterator/data.h" +#include "__iterator/empty.h" +#include "__iterator/reverse_access.h" +#include "__iterator/size.h" + +// [array.syn] +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR +#include +#endif +#include "initializer_list" + +// [tuple.helper] +#include "__tuple_dir/tuple_element.h" +#include "__tuple_dir/tuple_size.h" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + + +template +struct _LIBCUDACXX_TEMPLATE_VIS array +{ + // types: + typedef array __self; + typedef _Tp value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* iterator; + typedef const value_type* const_iterator; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _CUDA_VSTD::reverse_iterator const_reverse_iterator; + typedef _CUDA_VSTD::reverse_iterator reverse_iterator; + + _Tp __elems_[_Size]; + + // No explicit construct/copy/destroy for aggregate type + _LIBCUDACXX_INLINE_VISIBILITY void fill(const value_type& __u) { + _CUDA_VSTD::fill_n(__elems_, _Size, __u); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(array& __a) noexcept(__is_nothrow_swappable<_Tp>::value) { + _CUDA_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_); + } + + // iterators: + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + iterator begin() noexcept {return iterator(data());} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const_iterator begin() const noexcept {return const_iterator(data());} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + iterator end() noexcept {return iterator(data() + _Size);} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const_iterator end() const noexcept {return const_iterator(data() + _Size);} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + reverse_iterator rbegin() noexcept {return reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + reverse_iterator rend() noexcept {return reverse_iterator(begin());} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const_iterator cbegin() const noexcept {return begin();} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const_iterator cend() const noexcept {return end();} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const_reverse_iterator crbegin() const noexcept {return rbegin();} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const_reverse_iterator crend() const noexcept {return rend();} + + // capacity: + _LIBCUDACXX_INLINE_VISIBILITY + constexpr size_type size() const noexcept {return _Size;} + _LIBCUDACXX_INLINE_VISIBILITY + constexpr size_type max_size() const noexcept {return _Size;} + _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY + constexpr bool empty() const noexcept {return false; } + + // element access: + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + reference operator[](size_type __n) noexcept {return __elems_[__n];} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + const_reference operator[](size_type __n) const noexcept {return __elems_[__n];} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 reference at(size_type __n); + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const; + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 reference front() noexcept {return __elems_[0];} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 const_reference front() const noexcept {return __elems_[0];} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 reference back() noexcept {return __elems_[_Size - 1];} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 const_reference back() const noexcept {return __elems_[_Size - 1];} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + value_type* data() noexcept {return __elems_;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 + const value_type* data() const noexcept {return __elems_;} +}; + + +template +_LIBCUDACXX_CONSTEXPR_AFTER_CXX14 +typename array<_Tp, _Size>::reference +array<_Tp, _Size>::at(size_type __n) +{ + if (__n >= _Size) + __throw_out_of_range("array::at"); + + return __elems_[__n]; +} + +template +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +typename array<_Tp, _Size>::const_reference +array<_Tp, _Size>::at(size_type __n) const +{ + if (__n >= _Size) + __throw_out_of_range("array::at"); + return __elems_[__n]; +} + +template +struct _LIBCUDACXX_TEMPLATE_VIS array<_Tp, 0> +{ + // types: + typedef array __self; + typedef _Tp value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* iterator; + typedef const value_type* const_iterator; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _CUDA_VSTD::reverse_iterator const_reverse_iterator; + typedef _CUDA_VSTD::reverse_iterator reverse_iterator; + + typedef __conditional_t::value, const char, + char> _CharType; + + struct _ArrayInStructT { _Tp __data_[1]; }; + _ALIGNAS_TYPE(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)]; + + // No explicit construct/copy/destroy for aggregate type + _LIBCUDACXX_INLINE_VISIBILITY void fill(const value_type&) { + static_assert(!is_const<_Tp>::value, + "cannot fill zero-sized array of type 'const T'"); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(array&) noexcept { + static_assert(!is_const<_Tp>::value, + "cannot swap zero-sized array of type 'const T'"); + } + + // iterators: + _LIBCUDACXX_INLINE_VISIBILITY + iterator begin() noexcept {return iterator(data());} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator begin() const noexcept {return const_iterator(data());} + _LIBCUDACXX_INLINE_VISIBILITY + iterator end() noexcept {return iterator(data());} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator end() const noexcept {return const_iterator(data());} + + _LIBCUDACXX_INLINE_VISIBILITY + reverse_iterator rbegin() noexcept {return reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY + reverse_iterator rend() noexcept {return reverse_iterator(begin());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} + + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cbegin() const noexcept {return begin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cend() const noexcept {return end();} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator crbegin() const noexcept {return rbegin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator crend() const noexcept {return rend();} + + // capacity: + _LIBCUDACXX_INLINE_VISIBILITY + constexpr size_type size() const noexcept {return 0; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr size_type max_size() const noexcept {return 0;} + _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY + constexpr bool empty() const noexcept {return true;} + + // element access: + _LIBCUDACXX_INLINE_VISIBILITY + reference operator[](size_type) noexcept { + _LIBCUDACXX_ASSERT(false, "cannot call array::operator[] on a zero-sized array"); + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + const_reference operator[](size_type) const noexcept { + _LIBCUDACXX_ASSERT(false, "cannot call array::operator[] on a zero-sized array"); + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + reference at(size_type) { + __throw_out_of_range("array::at"); + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const_reference at(size_type) const { + __throw_out_of_range("array::at"); + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + reference front() noexcept { + _LIBCUDACXX_ASSERT(false, "cannot call array::front() on a zero-sized array"); + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const_reference front() const noexcept { + _LIBCUDACXX_ASSERT(false, "cannot call array::front() on a zero-sized array"); + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + reference back() noexcept { + _LIBCUDACXX_ASSERT(false, "cannot call array::back() on a zero-sized array"); + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const_reference back() const noexcept { + _LIBCUDACXX_ASSERT(false, "cannot call array::back() on a zero-sized array"); + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + value_type* data() noexcept {return reinterpret_cast(__elems_);} + _LIBCUDACXX_INLINE_VISIBILITY + const value_type* data() const noexcept {return reinterpret_cast(__elems_);} +}; + + +#ifndef _LIBCUDACXX_HAS_NO_DEDUCTION_GUIDES +template && ...), void> + > +_LIBCUDACXX_HOST_DEVICE array(_Tp, _Args...) -> array<_Tp, 1 + sizeof...(_Args)>; +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) +{ + return _CUDA_VSTD::equal(__x.begin(), __x.end(), __y.begin()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) +{ + return !(__x == __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) +{ + return _CUDA_VSTD::lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) +{ + return __y < __x; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) +{ + return !(__y < __x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX17 bool +operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) +{ + return !(__x < __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + _Size == 0 || + __is_swappable<_Tp>::value, + void +> +swap(array<_Tp, _Size>& __x, array<_Tp, _Size>& __y) + noexcept(noexcept(__x.swap(__y))) +{ + __x.swap(__y); +} + +template +struct _LIBCUDACXX_TEMPLATE_VIS tuple_size > + : public integral_constant {}; + +template +struct _LIBCUDACXX_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> > +{ + static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)"); + typedef _Tp type; +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_Tp& +get(array<_Tp, _Size>& __a) noexcept +{ + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)"); + return __a.__elems_[_Ip]; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +const _Tp& +get(const array<_Tp, _Size>& __a) noexcept +{ + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)"); + return __a.__elems_[_Ip]; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_Tp&& +get(array<_Tp, _Size>&& __a) noexcept +{ + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)"); + return _CUDA_VSTD::move(__a.__elems_[_Ip]); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +const _Tp&& +get(const array<_Tp, _Size>&& __a) noexcept +{ + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)"); + return _CUDA_VSTD::move(__a.__elems_[_Ip]); +} + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_ARRAY diff --git a/cuda_toolkit/include/atomic b/cuda_toolkit/include/atomic new file mode 100644 index 0000000000000000000000000000000000000000..ecf51441a98213f75b39bbf44af6d534830f91d9 --- /dev/null +++ b/cuda_toolkit/include/atomic @@ -0,0 +1,2870 @@ +// -*- C++ -*- +//===--------------------------- atomic -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_ATOMIC +#define _LIBCUDACXX_ATOMIC + +/* + atomic synopsis + +namespace std +{ + +// feature test macro + +#define __cpp_lib_atomic_is_always_lock_free // as specified by SG10 + + // order and consistency + + enum memory_order: unspecified // enum class in C++20 + { + relaxed, + consume, // load-consume + acquire, // load-acquire + release, // store-release + acq_rel, // store-release load-acquire + seq_cst // store-release load-acquire + }; + + inline constexpr auto memory_order_relaxed = memory_order::relaxed; + inline constexpr auto memory_order_consume = memory_order::consume; + inline constexpr auto memory_order_acquire = memory_order::acquire; + inline constexpr auto memory_order_release = memory_order::release; + inline constexpr auto memory_order_acq_rel = memory_order::acq_rel; + inline constexpr auto memory_order_seq_cst = memory_order::seq_cst; + +template T kill_dependency(T y) noexcept; + +// lock-free property + +#define ATOMIC_BOOL_LOCK_FREE unspecified +#define ATOMIC_CHAR_LOCK_FREE unspecified +#define ATOMIC_CHAR16_T_LOCK_FREE unspecified +#define ATOMIC_CHAR32_T_LOCK_FREE unspecified +#define ATOMIC_WCHAR_T_LOCK_FREE unspecified +#define ATOMIC_SHORT_LOCK_FREE unspecified +#define ATOMIC_INT_LOCK_FREE unspecified +#define ATOMIC_LONG_LOCK_FREE unspecified +#define ATOMIC_LLONG_LOCK_FREE unspecified +#define ATOMIC_POINTER_LOCK_FREE unspecified + +// flag type and operations + +typedef struct atomic_flag +{ + bool test_and_set(memory_order m = memory_order_seq_cst) volatile noexcept; + bool test_and_set(memory_order m = memory_order_seq_cst) noexcept; + void clear(memory_order m = memory_order_seq_cst) volatile noexcept; + void clear(memory_order m = memory_order_seq_cst) noexcept; + atomic_flag() noexcept = default; + atomic_flag(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) volatile = delete; +} atomic_flag; + +bool + atomic_flag_test_and_set(volatile atomic_flag* obj) noexcept; + +bool + atomic_flag_test_and_set(atomic_flag* obj) noexcept; + +bool + atomic_flag_test_and_set_explicit(volatile atomic_flag* obj, + memory_order m) noexcept; + +bool + atomic_flag_test_and_set_explicit(atomic_flag* obj, memory_order m) noexcept; + +void + atomic_flag_clear(volatile atomic_flag* obj) noexcept; + +void + atomic_flag_clear(atomic_flag* obj) noexcept; + +void + atomic_flag_clear_explicit(volatile atomic_flag* obj, memory_order m) noexcept; + +void + atomic_flag_clear_explicit(atomic_flag* obj, memory_order m) noexcept; + +#define ATOMIC_FLAG_INIT see below +#define ATOMIC_VAR_INIT(value) see below + +template +struct atomic +{ + static constexpr bool is_always_lock_free; + bool is_lock_free() const volatile noexcept; + bool is_lock_free() const noexcept; + void store(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; + void store(T desr, memory_order m = memory_order_seq_cst) noexcept; + T load(memory_order m = memory_order_seq_cst) const volatile noexcept; + T load(memory_order m = memory_order_seq_cst) const noexcept; + operator T() const volatile noexcept; + operator T() const noexcept; + T exchange(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; + T exchange(T desr, memory_order m = memory_order_seq_cst) noexcept; + bool compare_exchange_weak(T& expc, T desr, + memory_order s, memory_order f) volatile noexcept; + bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f) noexcept; + bool compare_exchange_strong(T& expc, T desr, + memory_order s, memory_order f) volatile noexcept; + bool compare_exchange_strong(T& expc, T desr, + memory_order s, memory_order f) noexcept; + bool compare_exchange_weak(T& expc, T desr, + memory_order m = memory_order_seq_cst) volatile noexcept; + bool compare_exchange_weak(T& expc, T desr, + memory_order m = memory_order_seq_cst) noexcept; + bool compare_exchange_strong(T& expc, T desr, + memory_order m = memory_order_seq_cst) volatile noexcept; + bool compare_exchange_strong(T& expc, T desr, + memory_order m = memory_order_seq_cst) noexcept; + + atomic() noexcept = default; + constexpr atomic(T desr) noexcept; + atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; + atomic& operator=(const atomic&) volatile = delete; + T operator=(T) volatile noexcept; + T operator=(T) noexcept; +}; + +template <> +struct atomic +{ + static constexpr bool is_always_lock_free; + bool is_lock_free() const volatile noexcept; + bool is_lock_free() const noexcept; + void store(integral desr, memory_order m = memory_order_seq_cst) volatile noexcept; + void store(integral desr, memory_order m = memory_order_seq_cst) noexcept; + integral load(memory_order m = memory_order_seq_cst) const volatile noexcept; + integral load(memory_order m = memory_order_seq_cst) const noexcept; + operator integral() const volatile noexcept; + operator integral() const noexcept; + integral exchange(integral desr, + memory_order m = memory_order_seq_cst) volatile noexcept; + integral exchange(integral desr, memory_order m = memory_order_seq_cst) noexcept; + bool compare_exchange_weak(integral& expc, integral desr, + memory_order s, memory_order f) volatile noexcept; + bool compare_exchange_weak(integral& expc, integral desr, + memory_order s, memory_order f) noexcept; + bool compare_exchange_strong(integral& expc, integral desr, + memory_order s, memory_order f) volatile noexcept; + bool compare_exchange_strong(integral& expc, integral desr, + memory_order s, memory_order f) noexcept; + bool compare_exchange_weak(integral& expc, integral desr, + memory_order m = memory_order_seq_cst) volatile noexcept; + bool compare_exchange_weak(integral& expc, integral desr, + memory_order m = memory_order_seq_cst) noexcept; + bool compare_exchange_strong(integral& expc, integral desr, + memory_order m = memory_order_seq_cst) volatile noexcept; + bool compare_exchange_strong(integral& expc, integral desr, + memory_order m = memory_order_seq_cst) noexcept; + + integral + fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; + integral fetch_add(integral op, memory_order m = memory_order_seq_cst) noexcept; + integral + fetch_sub(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; + integral fetch_sub(integral op, memory_order m = memory_order_seq_cst) noexcept; + integral + fetch_and(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; + integral fetch_and(integral op, memory_order m = memory_order_seq_cst) noexcept; + integral + fetch_or(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; + integral fetch_or(integral op, memory_order m = memory_order_seq_cst) noexcept; + integral + fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; + integral fetch_xor(integral op, memory_order m = memory_order_seq_cst) noexcept; + + atomic() noexcept = default; + constexpr atomic(integral desr) noexcept; + atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; + atomic& operator=(const atomic&) volatile = delete; + integral operator=(integral desr) volatile noexcept; + integral operator=(integral desr) noexcept; + + integral operator++(int) volatile noexcept; + integral operator++(int) noexcept; + integral operator--(int) volatile noexcept; + integral operator--(int) noexcept; + integral operator++() volatile noexcept; + integral operator++() noexcept; + integral operator--() volatile noexcept; + integral operator--() noexcept; + integral operator+=(integral op) volatile noexcept; + integral operator+=(integral op) noexcept; + integral operator-=(integral op) volatile noexcept; + integral operator-=(integral op) noexcept; + integral operator&=(integral op) volatile noexcept; + integral operator&=(integral op) noexcept; + integral operator|=(integral op) volatile noexcept; + integral operator|=(integral op) noexcept; + integral operator^=(integral op) volatile noexcept; + integral operator^=(integral op) noexcept; +}; + +template +struct atomic +{ + static constexpr bool is_always_lock_free; + bool is_lock_free() const volatile noexcept; + bool is_lock_free() const noexcept; + void store(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept; + void store(T* desr, memory_order m = memory_order_seq_cst) noexcept; + T* load(memory_order m = memory_order_seq_cst) const volatile noexcept; + T* load(memory_order m = memory_order_seq_cst) const noexcept; + operator T*() const volatile noexcept; + operator T*() const noexcept; + T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept; + T* exchange(T* desr, memory_order m = memory_order_seq_cst) noexcept; + bool compare_exchange_weak(T*& expc, T* desr, + memory_order s, memory_order f) volatile noexcept; + bool compare_exchange_weak(T*& expc, T* desr, + memory_order s, memory_order f) noexcept; + bool compare_exchange_strong(T*& expc, T* desr, + memory_order s, memory_order f) volatile noexcept; + bool compare_exchange_strong(T*& expc, T* desr, + memory_order s, memory_order f) noexcept; + bool compare_exchange_weak(T*& expc, T* desr, + memory_order m = memory_order_seq_cst) volatile noexcept; + bool compare_exchange_weak(T*& expc, T* desr, + memory_order m = memory_order_seq_cst) noexcept; + bool compare_exchange_strong(T*& expc, T* desr, + memory_order m = memory_order_seq_cst) volatile noexcept; + bool compare_exchange_strong(T*& expc, T* desr, + memory_order m = memory_order_seq_cst) noexcept; + T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile noexcept; + T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) noexcept; + T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile noexcept; + T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) noexcept; + + atomic() noexcept = default; + constexpr atomic(T* desr) noexcept; + atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; + atomic& operator=(const atomic&) volatile = delete; + + T* operator=(T*) volatile noexcept; + T* operator=(T*) noexcept; + T* operator++(int) volatile noexcept; + T* operator++(int) noexcept; + T* operator--(int) volatile noexcept; + T* operator--(int) noexcept; + T* operator++() volatile noexcept; + T* operator++() noexcept; + T* operator--() volatile noexcept; + T* operator--() noexcept; + T* operator+=(ptrdiff_t op) volatile noexcept; + T* operator+=(ptrdiff_t op) noexcept; + T* operator-=(ptrdiff_t op) volatile noexcept; + T* operator-=(ptrdiff_t op) noexcept; +}; + + +template + bool + atomic_is_lock_free(const volatile atomic* obj) noexcept; + +template + bool + atomic_is_lock_free(const atomic* obj) noexcept; + +template + void + atomic_init(volatile atomic* obj, T desr) noexcept; + +template + void + atomic_init(atomic* obj, T desr) noexcept; + +template + void + atomic_store(volatile atomic* obj, T desr) noexcept; + +template + void + atomic_store(atomic* obj, T desr) noexcept; + +template + void + atomic_store_explicit(volatile atomic* obj, T desr, memory_order m) noexcept; + +template + void + atomic_store_explicit(atomic* obj, T desr, memory_order m) noexcept; + +template + T + atomic_load(const volatile atomic* obj) noexcept; + +template + T + atomic_load(const atomic* obj) noexcept; + +template + T + atomic_load_explicit(const volatile atomic* obj, memory_order m) noexcept; + +template + T + atomic_load_explicit(const atomic* obj, memory_order m) noexcept; + +template + T + atomic_exchange(volatile atomic* obj, T desr) noexcept; + +template + T + atomic_exchange(atomic* obj, T desr) noexcept; + +template + T + atomic_exchange_explicit(volatile atomic* obj, T desr, memory_order m) noexcept; + +template + T + atomic_exchange_explicit(atomic* obj, T desr, memory_order m) noexcept; + +template + bool + atomic_compare_exchange_weak(volatile atomic* obj, T* expc, T desr) noexcept; + +template + bool + atomic_compare_exchange_weak(atomic* obj, T* expc, T desr) noexcept; + +template + bool + atomic_compare_exchange_strong(volatile atomic* obj, T* expc, T desr) noexcept; + +template + bool + atomic_compare_exchange_strong(atomic* obj, T* expc, T desr) noexcept; + +template + bool + atomic_compare_exchange_weak_explicit(volatile atomic* obj, T* expc, + T desr, + memory_order s, memory_order f) noexcept; + +template + bool + atomic_compare_exchange_weak_explicit(atomic* obj, T* expc, T desr, + memory_order s, memory_order f) noexcept; + +template + bool + atomic_compare_exchange_strong_explicit(volatile atomic* obj, + T* expc, T desr, + memory_order s, memory_order f) noexcept; + +template + bool + atomic_compare_exchange_strong_explicit(atomic* obj, T* expc, + T desr, + memory_order s, memory_order f) noexcept; + +template + Integral + atomic_fetch_add(volatile atomic* obj, Integral op) noexcept; + +template + Integral + atomic_fetch_add(atomic* obj, Integral op) noexcept; + +template + Integral + atomic_fetch_add_explicit(volatile atomic* obj, Integral op, + memory_order m) noexcept; +template + Integral + atomic_fetch_add_explicit(atomic* obj, Integral op, + memory_order m) noexcept; +template + Integral + atomic_fetch_sub(volatile atomic* obj, Integral op) noexcept; + +template + Integral + atomic_fetch_sub(atomic* obj, Integral op) noexcept; + +template + Integral + atomic_fetch_sub_explicit(volatile atomic* obj, Integral op, + memory_order m) noexcept; +template + Integral + atomic_fetch_sub_explicit(atomic* obj, Integral op, + memory_order m) noexcept; +template + Integral + atomic_fetch_and(volatile atomic* obj, Integral op) noexcept; + +template + Integral + atomic_fetch_and(atomic* obj, Integral op) noexcept; + +template + Integral + atomic_fetch_and_explicit(volatile atomic* obj, Integral op, + memory_order m) noexcept; +template + Integral + atomic_fetch_and_explicit(atomic* obj, Integral op, + memory_order m) noexcept; +template + Integral + atomic_fetch_or(volatile atomic* obj, Integral op) noexcept; + +template + Integral + atomic_fetch_or(atomic* obj, Integral op) noexcept; + +template + Integral + atomic_fetch_or_explicit(volatile atomic* obj, Integral op, + memory_order m) noexcept; +template + Integral + atomic_fetch_or_explicit(atomic* obj, Integral op, + memory_order m) noexcept; +template + Integral + atomic_fetch_xor(volatile atomic* obj, Integral op) noexcept; + +template + Integral + atomic_fetch_xor(atomic* obj, Integral op) noexcept; + +template + Integral + atomic_fetch_xor_explicit(volatile atomic* obj, Integral op, + memory_order m) noexcept; +template + Integral + atomic_fetch_xor_explicit(atomic* obj, Integral op, + memory_order m) noexcept; + +template + T* + atomic_fetch_add(volatile atomic* obj, ptrdiff_t op) noexcept; + +template + T* + atomic_fetch_add(atomic* obj, ptrdiff_t op) noexcept; + +template + T* + atomic_fetch_add_explicit(volatile atomic* obj, ptrdiff_t op, + memory_order m) noexcept; +template + T* + atomic_fetch_add_explicit(atomic* obj, ptrdiff_t op, memory_order m) noexcept; + +template + T* + atomic_fetch_sub(volatile atomic* obj, ptrdiff_t op) noexcept; + +template + T* + atomic_fetch_sub(atomic* obj, ptrdiff_t op) noexcept; + +template + T* + atomic_fetch_sub_explicit(volatile atomic* obj, ptrdiff_t op, + memory_order m) noexcept; +template + T* + atomic_fetch_sub_explicit(atomic* obj, ptrdiff_t op, memory_order m) noexcept; + +// Atomics for standard typedef types + +typedef atomic atomic_bool; +typedef atomic atomic_char; +typedef atomic atomic_schar; +typedef atomic atomic_uchar; +typedef atomic atomic_short; +typedef atomic atomic_ushort; +typedef atomic atomic_int; +typedef atomic atomic_uint; +typedef atomic atomic_long; +typedef atomic atomic_ulong; +typedef atomic atomic_llong; +typedef atomic atomic_ullong; +typedef atomic atomic_char16_t; +typedef atomic atomic_char32_t; +typedef atomic atomic_wchar_t; + +typedef atomic atomic_int_least8_t; +typedef atomic atomic_uint_least8_t; +typedef atomic atomic_int_least16_t; +typedef atomic atomic_uint_least16_t; +typedef atomic atomic_int_least32_t; +typedef atomic atomic_uint_least32_t; +typedef atomic atomic_int_least64_t; +typedef atomic atomic_uint_least64_t; + +typedef atomic atomic_int_fast8_t; +typedef atomic atomic_uint_fast8_t; +typedef atomic atomic_int_fast16_t; +typedef atomic atomic_uint_fast16_t; +typedef atomic atomic_int_fast32_t; +typedef atomic atomic_uint_fast32_t; +typedef atomic atomic_int_fast64_t; +typedef atomic atomic_uint_fast64_t; + +typedef atomic atomic_int8_t; +typedef atomic atomic_uint8_t; +typedef atomic atomic_int16_t; +typedef atomic atomic_uint16_t; +typedef atomic atomic_int32_t; +typedef atomic atomic_uint32_t; +typedef atomic atomic_int64_t; +typedef atomic atomic_uint64_t; + +typedef atomic atomic_intptr_t; +typedef atomic atomic_uintptr_t; +typedef atomic atomic_size_t; +typedef atomic atomic_ptrdiff_t; +typedef atomic atomic_intmax_t; +typedef atomic atomic_uintmax_t; + +// fences + +void atomic_thread_fence(memory_order m) noexcept; +void atomic_signal_fence(memory_order m) noexcept; + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#include +#endif // __cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__debug" +#include "__threading_support" +#include "__type_traits/conditional.h" +#include "__type_traits/enable_if.h" +#include "__type_traits/is_assignable.h" +#include "__type_traits/is_floating_point.h" +#include "__type_traits/is_integral.h" +#include "__type_traits/is_same.h" +#include "__type_traits/is_trivially_copyable.h" +#include "__type_traits/underlying_type.h" +#include "__utility/forward.h" +#include "cstddef" +#include "cstdint" +#include "type_traits" +#include "version" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#ifdef _LIBCUDACXX_HAS_NO_THREADS +# error is not supported on this single threaded system +#endif +#ifdef _LIBCUDACXX_HAS_NO_ATOMIC_HEADER +# error is not implemented +#endif +#ifdef _LIBCUDACXX_UNSUPPORTED_THREAD_API +# error " is not supported on this system" +#endif +#ifdef kill_dependency +# error C++ standard library is incompatible with +#endif + +#define _LIBCUDACXX_CHECK_STORE_MEMORY_ORDER(__m) \ + _LIBCUDACXX_DIAGNOSE_WARNING(__m == memory_order_consume || \ + __m == memory_order_acquire || \ + __m == memory_order_acq_rel, \ + "memory order argument to atomic operation is invalid") + +#define _LIBCUDACXX_CHECK_LOAD_MEMORY_ORDER(__m) \ + _LIBCUDACXX_DIAGNOSE_WARNING(__m == memory_order_release || \ + __m == memory_order_acq_rel, \ + "memory order argument to atomic operation is invalid") + +#define _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \ + _LIBCUDACXX_DIAGNOSE_WARNING(__f == memory_order_release || \ + __f == memory_order_acq_rel, \ + "memory order argument to atomic operation is invalid") + +#if defined(_LIBCUDACXX_HAS_MSVC_ATOMIC_IMPL) +# include +#endif + +#if !defined(_LIBCUDACXX_COMPILER_NVRTC) +# include +#endif + +#if !defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) && !defined(__GCC_ATOMIC_BOOL_LOCK_FREE) +#define ATOMIC_BOOL_LOCK_FREE 2 +#define ATOMIC_CHAR_LOCK_FREE 2 +#define ATOMIC_CHAR16_T_LOCK_FREE 2 +#define ATOMIC_CHAR32_T_LOCK_FREE 2 +#define ATOMIC_WCHAR_T_LOCK_FREE 2 +#define ATOMIC_SHORT_LOCK_FREE 2 +#define ATOMIC_INT_LOCK_FREE 2 +#define ATOMIC_LONG_LOCK_FREE 2 +#define ATOMIC_LLONG_LOCK_FREE 2 +#define ATOMIC_POINTER_LOCK_FREE 2 +#endif //!defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) && !defined(__GCC_ATOMIC_BOOL_LOCK_FREE) + +#ifndef __ATOMIC_RELAXED +#define __ATOMIC_RELAXED 0 +#define __ATOMIC_CONSUME 1 +#define __ATOMIC_ACQUIRE 2 +#define __ATOMIC_RELEASE 3 +#define __ATOMIC_ACQ_REL 4 +#define __ATOMIC_SEQ_CST 5 +#endif //__ATOMIC_RELAXED + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +// Figure out what the underlying type for `memory_order` would be if it were +// declared as an unscoped enum (accounting for -fshort-enums). Use this result +// to pin the underlying type in C++20. +enum __legacy_memory_order { + __mo_relaxed, + __mo_consume, + __mo_acquire, + __mo_release, + __mo_acq_rel, + __mo_seq_cst +}; + +typedef underlying_type<__legacy_memory_order>::type __memory_order_underlying_t; + +#if _LIBCUDACXX_STD_VER > 17 + +enum class memory_order : __memory_order_underlying_t { + relaxed = __mo_relaxed, + consume = __mo_consume, + acquire = __mo_acquire, + release = __mo_release, + acq_rel = __mo_acq_rel, + seq_cst = __mo_seq_cst +}; + +inline constexpr auto memory_order_relaxed = memory_order::relaxed; +inline constexpr auto memory_order_consume = memory_order::consume; +inline constexpr auto memory_order_acquire = memory_order::acquire; +inline constexpr auto memory_order_release = memory_order::release; +inline constexpr auto memory_order_acq_rel = memory_order::acq_rel; +inline constexpr auto memory_order_seq_cst = memory_order::seq_cst; + +#else + +typedef enum memory_order { + memory_order_relaxed = __mo_relaxed, + memory_order_consume = __mo_consume, + memory_order_acquire = __mo_acquire, + memory_order_release = __mo_release, + memory_order_acq_rel = __mo_acq_rel, + memory_order_seq_cst = __mo_seq_cst, +} memory_order; + +#endif // _LIBCUDACXX_STD_VER > 17 + +template _LIBCUDACXX_INLINE_VISIBILITY +bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) { +#if defined(_LIBCUDACXX_COMPILER_NVCC) \ + || defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || defined(_LIBCUDACXX_COMPILER_CLANG_CUDA) + return __lhs == __rhs; +#else + return memcmp(&__lhs, &__rhs, sizeof(_Tp)) == 0; +#endif +} + +static_assert((is_same::type, __memory_order_underlying_t>::value), + "unexpected underlying type for std::memory_order"); + +#if defined(_LIBCUDACXX_HAS_GCC_ATOMIC_IMP) || \ + defined(_LIBCUDACXX_ATOMIC_ONLY_USE_BUILTINS) + +// [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because +// the default operator= in an object is not volatile, a byte-by-byte copy +// is required. +template _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t::value> +__cxx_atomic_assign_volatile(_Tp& __a_value, _Tv const& __val) { + __a_value = __val; +} +template _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t::value> +__cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& __val) { + volatile char* __to = reinterpret_cast(&__a_value); + volatile char* __end = __to + sizeof(_Tp); + volatile const char* __from = reinterpret_cast(&__val); + while (__to != __end) + *__to++ = *__from++; +} + +#endif + +// Headers are wrapped like so: (cuda::std::|std::)detail +namespace __detail { +#if defined(_LIBCUDACXX_HAS_CUDA_ATOMIC_EXT) +# include "support/atomic/atomic_scopes.h" +#endif + +#if defined(_LIBCUDACXX_HAS_CUDA_ATOMIC_IMPL) +# include "support/atomic/atomic_cuda.h" +#elif defined(_LIBCUDACXX_HAS_MSVC_ATOMIC_IMPL) +# include "support/atomic/atomic_msvc.h" +#elif defined(_LIBCUDACXX_HAS_GCC_ATOMIC_IMP) +# include "support/atomic/atomic_gcc.h" +#elif defined(_LIBCUDACXX_HAS_C_ATOMIC_IMP) +// TODO: Maybe support C11 atomics? +// #include "support/atomic/atomic_c11.h" +#endif // _LIBCUDACXX_HAS_GCC_ATOMIC_IMP, _LIBCUDACXX_HAS_C_ATOMIC_IMP +} + +using __detail::__cxx_atomic_base_impl; +using __detail::__cxx_atomic_ref_base_impl; +using __detail::__cxx_atomic_thread_fence; +using __detail::__cxx_atomic_signal_fence; +using __detail::__cxx_atomic_load; +using __detail::__cxx_atomic_store; +using __detail::__cxx_atomic_exchange; +using __detail::__cxx_atomic_compare_exchange_weak; +using __detail::__cxx_atomic_compare_exchange_strong; +using __detail::__cxx_atomic_fetch_add; +using __detail::__cxx_atomic_fetch_sub; +using __detail::__cxx_atomic_fetch_or; +using __detail::__cxx_atomic_fetch_and; +using __detail::__cxx_atomic_fetch_xor; + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp kill_dependency(_Tp __y) noexcept +{ + return __y; +} + +#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) +# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE +# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE +#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE) +# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#endif + +#ifdef _LIBCUDACXX_ATOMIC_ONLY_USE_BUILTINS + +template +struct __cxx_atomic_lock_impl { + + _LIBCUDACXX_INLINE_VISIBILITY + __cxx_atomic_lock_impl() noexcept + : __a_value(), __a_lock(0) {} + _LIBCUDACXX_INLINE_VISIBILITY constexpr explicit + __cxx_atomic_lock_impl(_Tp value) noexcept + : __a_value(value), __a_lock(0) {} + + _Tp __a_value; + mutable __cxx_atomic_base_impl<_LIBCUDACXX_ATOMIC_FLAG_TYPE, _Sco> __a_lock; + + _LIBCUDACXX_INLINE_VISIBILITY void __lock() const volatile { + while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCUDACXX_ATOMIC_FLAG_TYPE(true), memory_order_acquire)) + /*spin*/; + } + _LIBCUDACXX_INLINE_VISIBILITY void __lock() const { + while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCUDACXX_ATOMIC_FLAG_TYPE(true), memory_order_acquire)) + /*spin*/; + } + _LIBCUDACXX_INLINE_VISIBILITY void __unlock() const volatile { + __cxx_atomic_store(&__a_lock, _LIBCUDACXX_ATOMIC_FLAG_TYPE(false), memory_order_release); + } + _LIBCUDACXX_INLINE_VISIBILITY void __unlock() const { + __cxx_atomic_store(&__a_lock, _LIBCUDACXX_ATOMIC_FLAG_TYPE(false), memory_order_release); + } + _LIBCUDACXX_INLINE_VISIBILITY _Tp __read() const volatile { + __lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a_value); + __unlock(); + return __old; + } + _LIBCUDACXX_INLINE_VISIBILITY _Tp __read() const { + __lock(); + _Tp __old = __a_value; + __unlock(); + return __old; + } +}; + +template +_LIBCUDACXX_INLINE_VISIBILITY +void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, _Tp __val) { + __cxx_atomic_assign_volatile(__a->__a_value, __val); +} +template +_LIBCUDACXX_INLINE_VISIBILITY +void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp, _Sco>* __a, _Tp __val) { + __a->__a_value = __val; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, _Tp __val, memory_order) { + __a->__lock(); + __cxx_atomic_assign_volatile(__a->__a_value, __val); + __a->__unlock(); +} +template +_LIBCUDACXX_INLINE_VISIBILITY +void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp, _Sco>* __a, _Tp __val, memory_order) { + __a->__lock(); + __a->__a_value = __val; + __a->__unlock(); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, memory_order) { + return __a->__read(); +} +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp, _Sco>* __a, memory_order) { + return __a->__read(); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, _Tp __value, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, __value); + __a->__unlock(); + return __old; +} +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp, _Sco>* __a, _Tp __value, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value = __value; + __a->__unlock(); + return __old; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Tp* __expected, _Tp __value, memory_order, memory_order) { + __a->__lock(); + _Tp __temp; + __cxx_atomic_assign_volatile(__temp, __a->__a_value); + bool __ret = __temp == *__expected; + if(__ret) + __cxx_atomic_assign_volatile(__a->__a_value, __value); + else + __cxx_atomic_assign_volatile(*__expected, __a->__a_value); + __a->__unlock(); + return __ret; +} +template +_LIBCUDACXX_INLINE_VISIBILITY +bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Tp* __expected, _Tp __value, memory_order, memory_order) { + __a->__lock(); + bool __ret = __a->__a_value == *__expected; + if(__ret) + __a->__a_value = __value; + else + *__expected = __a->__a_value; + __a->__unlock(); + return __ret; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Tp* __expected, _Tp __value, memory_order, memory_order) { + __a->__lock(); + _Tp __temp; + __cxx_atomic_assign_volatile(__temp, __a->__a_value); + bool __ret = __temp == *__expected; + if(__ret) + __cxx_atomic_assign_volatile(__a->__a_value, __value); + else + __cxx_atomic_assign_volatile(*__expected, __a->__a_value); + __a->__unlock(); + return __ret; +} +template +_LIBCUDACXX_INLINE_VISIBILITY +bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Tp* __expected, _Tp __value, memory_order, memory_order) { + __a->__lock(); + bool __ret = __a->__a_value == *__expected; + if(__ret) + __a->__a_value = __value; + else + *__expected = __a->__a_value; + __a->__unlock(); + return __ret; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Td __delta, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old + __delta)); + __a->__unlock(); + return __old; +} +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Td __delta, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value += __delta; + __a->__unlock(); + return __old; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp* __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*, _Sco>* __a, + ptrdiff_t __delta, memory_order) { + __a->__lock(); + _Tp* __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, __old + __delta); + __a->__unlock(); + return __old; +} +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*, _Sco>* __a, + ptrdiff_t __delta, memory_order) { + __a->__lock(); + _Tp* __old = __a->__a_value; + __a->__a_value += __delta; + __a->__unlock(); + return __old; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Td __delta, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old - __delta)); + __a->__unlock(); + return __old; +} +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Td __delta, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value -= __delta; + __a->__unlock(); + return __old; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old & __pattern)); + __a->__unlock(); + return __old; +} +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value &= __pattern; + __a->__unlock(); + return __old; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old | __pattern)); + __a->__unlock(); + return __old; +} +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value |= __pattern; + __a->__unlock(); + return __old; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old ^ __pattern)); + __a->__unlock(); + return __old; +} +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp, _Sco>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value ^= __pattern; + __a->__unlock(); + return __old; +} + +#if defined(_LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE) + +template struct __cxx_is_always_lock_free { + enum { __value = _LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE(sizeof(_Tp), 0) }; }; + +#else + +template struct __cxx_is_always_lock_free { + enum { __value = sizeof(_Tp) <= 8 }; }; + +#endif // defined(_LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE) + +template +struct __cxx_atomic_impl_conditional { + using type = __conditional_t<__cxx_is_always_lock_free<_Tp>::__value, + __cxx_atomic_base_impl<_Tp, _Sco>, + __cxx_atomic_lock_impl<_Tp, _Sco> >; +}; + +template ::type > +#else +template > +#endif //_LIBCUDACXX_ATOMIC_ONLY_USE_BUILTINS +struct __cxx_atomic_impl : public _Base { + __cxx_atomic_impl() noexcept = default; + _LIBCUDACXX_INLINE_VISIBILITY constexpr explicit __cxx_atomic_impl(_Tp value) noexcept + : _Base(value) {} +}; + + +template +_LIBCUDACXX_INLINE_VISIBILITY +__cxx_atomic_impl<_Tp, _Sco>* __cxx_atomic_rebind(_Tp* __inst) { + static_assert(sizeof(__cxx_atomic_impl<_Tp, _Sco>) == sizeof(_Tp),""); + static_assert(alignof(__cxx_atomic_impl<_Tp, _Sco>) == alignof(_Tp),""); + return (__cxx_atomic_impl<_Tp, _Sco>*)__inst; +} + +template +using __cxx_atomic_ref_impl = __cxx_atomic_ref_base_impl<_Tp, _Sco>; + +#ifdef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE + +template , int _Sco = _Ty::__sco> +struct __cxx_atomic_poll_tester { + _Ty const volatile* __a; + _Tp __val; + memory_order __order; + + _LIBCUDACXX_INLINE_VISIBILITY __cxx_atomic_poll_tester(_Ty const volatile* __a_, _Tp __val_, memory_order __order_) + : __a(__a_) + , __val(__val_) + , __order(__order_) + {} + + _LIBCUDACXX_INLINE_VISIBILITY bool operator()() const { + return !(__cxx_atomic_load(__a, __order) == __val); + } +}; + +template , int _Sco = _Ty::__sco> +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_try_wait_slow_fallback(_Ty const volatile* __a, _Tp __val, memory_order __order) { + __libcpp_thread_poll_with_backoff(__cxx_atomic_poll_tester<_Ty>(__a, __val, __order)); +} + +#endif + +#ifdef _LIBCUDACXX_HAS_PLATFORM_WAIT + +template ::__value, int> = 1> +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp, _Sco> const volatile* __a) { +#ifndef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE + auto * const __c = __libcpp_contention_state(__a); + __cxx_atomic_fetch_add(__cxx_atomic_rebind<_Sco>(&__c->__version), (__libcpp_platform_wait_t)1, memory_order_relaxed); + __cxx_atomic_thread_fence(memory_order_seq_cst); + if (0 != __cxx_atomic_exchange(__cxx_atomic_rebind<_Sco>(&__c->__waiters), (ptrdiff_t)0, memory_order_relaxed)) + __libcpp_platform_wake(&__c->__version, true); +#endif +} +template ::__value, int> = 1> +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp, _Sco> const volatile* __a) { + __cxx_atomic_notify_all(__a); +} +template , int _Sco = _Ty::__sco, __enable_if_t::__value, int> = 1> +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_try_wait_slow(_Ty const volatile* __a, _Tp const __val, memory_order __order) { +#ifndef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE + auto * const __c = __libcpp_contention_state(__a); + __cxx_atomic_store(__cxx_atomic_rebind<_Sco>(&__c->__waiters), (ptrdiff_t)1, memory_order_relaxed); + __cxx_atomic_thread_fence(memory_order_seq_cst); + auto const __version = __cxx_atomic_load(__cxx_atomic_rebind<_Sco>(&__c->__version), memory_order_relaxed); + if (!__cxx_nonatomic_compare_equal(__cxx_atomic_load(__a, __order), __val)) + return; + if(sizeof(__libcpp_platform_wait_t) < 8) { + constexpr timespec __timeout = { 2, 0 }; // Hedge on rare 'int version' aliasing. + __libcpp_platform_wait(&__c->__version, __version, &__timeout); + } + else + __libcpp_platform_wait(&__c->__version, __version, nullptr); +#else + __cxx_atomic_try_wait_slow_fallback(__a, __val, __order); +#endif // _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE +} + +template ::__value, int> = 1> +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_try_wait_slow(__cxx_atomic_impl<_Tp, _Sco> const volatile* __a, _Tp __val, memory_order) { +#ifndef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE + auto * const __c = __libcpp_contention_state(__a); + __cxx_atomic_fetch_add(__cxx_atomic_rebind<_Sco>(&__c->__waiters), (ptrdiff_t)1, memory_order_relaxed); + __cxx_atomic_thread_fence(memory_order_seq_cst); +#endif + __libcpp_platform_wait((_Tp*)__a, __val, nullptr); +#ifndef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE + __cxx_atomic_fetch_sub(__cxx_atomic_rebind<_Sco>(&__c->__waiters), (ptrdiff_t)1, memory_order_relaxed); +#endif +} +template ::__value, int> = 1> +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp, _Sco> const volatile* __a) { +#ifndef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE + auto * const __c = __libcpp_contention_state(__a); + __cxx_atomic_thread_fence(memory_order_seq_cst); + if (0 != __cxx_atomic_load(__cxx_atomic_rebind<_Sco>(&__c->__waiters), memory_order_relaxed)) +#endif + __libcpp_platform_wake((_Tp*)__a, true); +} +template ::__value, int> = 1> +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp, _Sco> const volatile* __a) { +#ifndef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE + auto * const __c = __libcpp_contention_state(__a); + __cxx_atomic_thread_fence(memory_order_seq_cst); + if (0 != __cxx_atomic_load(__cxx_atomic_rebind<_Sco>(&__c->__waiters), memory_order_relaxed)) +#endif + __libcpp_platform_wake((_Tp*)__a, false); +} + +#elif !defined(_LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE) + +template +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp, _Sco> const volatile* __a) { + auto * const __c = __libcpp_contention_state(__a); + __cxx_atomic_thread_fence(memory_order_seq_cst); + if(0 == __cxx_atomic_load(__cxx_atomic_rebind<_Sco>(&__c->__credit), memory_order_relaxed)) + return; + if(0 != __cxx_atomic_exchange(__cxx_atomic_rebind<_Sco>(&__c->__credit), (ptrdiff_t)0, memory_order_relaxed)) { + __libcpp_mutex_lock(&__c->__mutex); + __libcpp_mutex_unlock(&__c->__mutex); + __libcpp_condvar_broadcast(&__c->__condvar); + } +} +template +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp, _Sco> const volatile* __a) { + __cxx_atomic_notify_all(__a); +} +template +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_try_wait_slow(__cxx_atomic_impl<_Tp, _Sco> const volatile* __a, _Tp const __val, memory_order __order) { + auto * const __c = __libcpp_contention_state(__a); + __libcpp_mutex_lock(&__c->__mutex); + __cxx_atomic_store(__cxx_atomic_rebind<_Sco>(&__c->__credit), (ptrdiff_t)1, memory_order_relaxed); + __cxx_atomic_thread_fence(memory_order_seq_cst); + if (__cxx_nonatomic_compare_equal(__cxx_atomic_load(__a, __order), __val)) + __libcpp_condvar_wait(&__c->__condvar, &__c->__mutex); + __libcpp_mutex_unlock(&__c->__mutex); +} + +#else + +template +struct __atomic_wait_and_notify_supported +#if defined(__CUDA_MINIMUM_ARCH__) && __CUDA_MINIMUM_ARCH__ < 700 + : false_type +#else + : true_type +#endif +{}; + +template > +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_try_wait_slow(_Ty const volatile* __a, _Tp __val, memory_order __order) { + static_assert(__atomic_wait_and_notify_supported<_Tp>::value, "atomic wait operations are unsupported on Pascal"); + __cxx_atomic_try_wait_slow_fallback(__a, __val, __order); +} + +template > +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_notify_one(_Ty const volatile*) { + static_assert(__atomic_wait_and_notify_supported<_Tp>::value, "atomic notify-one operations are unsupported on Pascal"); +} + +template > +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_notify_all(_Ty const volatile*) { + static_assert(__atomic_wait_and_notify_supported<_Tp>::value, "atomic notify-all operations are unsupported on Pascal"); +} + +#endif // _LIBCUDACXX_HAS_PLATFORM_WAIT || !defined(_LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE) + +template > +_LIBCUDACXX_INLINE_VISIBILITY void __cxx_atomic_wait(_Ty const volatile* __a, _Tp const __val, memory_order __order) { + for(int __i = 0; __i < _LIBCUDACXX_POLLING_COUNT; ++__i) { + if(!__cxx_nonatomic_compare_equal(__cxx_atomic_load(__a, __order), __val)) + return; + if(__i < 12) + __libcpp_thread_yield_processor(); + else + __libcpp_thread_yield(); + } + while(__cxx_nonatomic_compare_equal(__cxx_atomic_load(__a, __order), __val)) + __cxx_atomic_try_wait_slow(__a, __val, __order); +} + +template +struct __atomic_base_storage { + mutable _Storage __a_; + + __atomic_base_storage() = default; + __atomic_base_storage(const __atomic_base_storage&) = default; + __atomic_base_storage(__atomic_base_storage&&) = default; + + __atomic_base_storage& operator=(const __atomic_base_storage&) = default; + __atomic_base_storage& operator=(__atomic_base_storage&&) = default; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __atomic_base_storage(_Storage&& __a) noexcept : __a_(_CUDA_VSTD::forward<_Storage>(__a)) {} +}; + +template +struct __atomic_base_core : public __atomic_base_storage<_Tp, _Storage>{ + __atomic_base_core() = default; + __atomic_base_core(const __atomic_base_core&) = delete; + __atomic_base_core(__atomic_base_core&&) = delete; + + __atomic_base_core& operator=(const __atomic_base_core&) = delete; + __atomic_base_core& operator=(__atomic_base_core&&) = delete; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __atomic_base_core(_Storage&& __a) noexcept : __atomic_base_storage<_Tp, _Storage>(_CUDA_VSTD::forward<_Storage>(__a)) {} + +#if defined(_LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE) + static constexpr bool is_always_lock_free = _LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE(sizeof(_Tp), 0); +#endif // defined(_LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE) + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_lock_free() const volatile noexcept + {return _LIBCUDACXX_ATOMIC_IS_LOCK_FREE(sizeof(_Tp));} + _LIBCUDACXX_INLINE_VISIBILITY + bool is_lock_free() const noexcept + {return static_cast<__atomic_base_core const volatile*>(this)->is_lock_free();} + _LIBCUDACXX_INLINE_VISIBILITY + + void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile noexcept + _LIBCUDACXX_CHECK_STORE_MEMORY_ORDER(__m) + {__cxx_atomic_store(&this->__a_, __d, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + void store(_Tp __d, memory_order __m = memory_order_seq_cst) noexcept + _LIBCUDACXX_CHECK_STORE_MEMORY_ORDER(__m) + {__cxx_atomic_store(&this->__a_, __d, __m);} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp load(memory_order __m = memory_order_seq_cst) const volatile noexcept + _LIBCUDACXX_CHECK_LOAD_MEMORY_ORDER(__m) + {return __cxx_atomic_load(&this->__a_, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp load(memory_order __m = memory_order_seq_cst) const noexcept + _LIBCUDACXX_CHECK_LOAD_MEMORY_ORDER(__m) + {return __cxx_atomic_load(&this->__a_, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + operator _Tp() const volatile noexcept {return load();} + _LIBCUDACXX_INLINE_VISIBILITY + operator _Tp() const noexcept {return load();} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile noexcept + {return __cxx_atomic_exchange(&this->__a_, __d, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) noexcept + {return __cxx_atomic_exchange(&this->__a_, __d, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_weak(_Tp& __e, _Tp __d, + memory_order __s, memory_order __f) volatile noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) + {return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __s, __f);} + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_weak(_Tp& __e, _Tp __d, + memory_order __s, memory_order __f) noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) + {return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __s, __f);} + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_strong(_Tp& __e, _Tp __d, + memory_order __s, memory_order __f) volatile noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) + {return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __s, __f);} + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_strong(_Tp& __e, _Tp __d, + memory_order __s, memory_order __f) noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) + {return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __s, __f);} + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_weak(_Tp& __e, _Tp __d, + memory_order __m = memory_order_seq_cst) volatile noexcept { + if (memory_order_acq_rel == __m) + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, memory_order_acquire); + else if (memory_order_release == __m) + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, memory_order_relaxed); + else + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, __m); + } + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_weak(_Tp& __e, _Tp __d, + memory_order __m = memory_order_seq_cst) noexcept { + if(memory_order_acq_rel == __m) + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, memory_order_acquire); + else if(memory_order_release == __m) + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, memory_order_relaxed); + else + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, __m); + } + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_strong(_Tp& __e, _Tp __d, + memory_order __m = memory_order_seq_cst) volatile noexcept { + if (memory_order_acq_rel == __m) + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, memory_order_acquire); + else if (memory_order_release == __m) + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, memory_order_relaxed); + else + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, __m); + } + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_strong(_Tp& __e, _Tp __d, + memory_order __m = memory_order_seq_cst) noexcept { + if (memory_order_acq_rel == __m) + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, memory_order_acquire); + else if (memory_order_release == __m) + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, memory_order_relaxed); + else + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, __m); + } + + _LIBCUDACXX_INLINE_VISIBILITY void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const volatile noexcept + {__cxx_atomic_wait(&this->__a_, __v, __m);} + _LIBCUDACXX_INLINE_VISIBILITY void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const noexcept + {__cxx_atomic_wait(&this->__a_, __v, __m);} + _LIBCUDACXX_INLINE_VISIBILITY void notify_one() volatile noexcept + {__cxx_atomic_notify_one(&this->__a_);} + _LIBCUDACXX_INLINE_VISIBILITY void notify_one() noexcept + {__cxx_atomic_notify_one(&this->__a_);} + _LIBCUDACXX_INLINE_VISIBILITY void notify_all() volatile noexcept + {__cxx_atomic_notify_all(&this->__a_);} + _LIBCUDACXX_INLINE_VISIBILITY void notify_all() noexcept + {__cxx_atomic_notify_all(&this->__a_);} +}; + +template +struct __atomic_base_core<_Tp, true, _Storage> : public __atomic_base_storage<_Tp, _Storage>{ + __atomic_base_core() = default; + __atomic_base_core(const __atomic_base_core&) = default; + __atomic_base_core(__atomic_base_core&&) = default; + + __atomic_base_core& operator=(const __atomic_base_core&) = default; + __atomic_base_core& operator=(__atomic_base_core&&) = default; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __atomic_base_core(_Storage&& __a) noexcept : __atomic_base_storage<_Tp, _Storage>(_CUDA_VSTD::forward<_Storage>(__a)) {} + +#if defined(_LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE) + static constexpr bool is_always_lock_free = _LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE(sizeof(_Tp), 0); +#endif // defined(_LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE) + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_lock_free() const volatile noexcept + {return _LIBCUDACXX_ATOMIC_IS_LOCK_FREE(sizeof(_Tp));} + _LIBCUDACXX_INLINE_VISIBILITY + bool is_lock_free() const noexcept + {return static_cast<__atomic_base_core const volatile*>(this)->is_lock_free();} + _LIBCUDACXX_INLINE_VISIBILITY + + void store(_Tp __d, memory_order __m = memory_order_seq_cst) const volatile noexcept + _LIBCUDACXX_CHECK_STORE_MEMORY_ORDER(__m) + {__cxx_atomic_store(&this->__a_, __d, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + void store(_Tp __d, memory_order __m = memory_order_seq_cst) const noexcept + _LIBCUDACXX_CHECK_STORE_MEMORY_ORDER(__m) + {__cxx_atomic_store(&this->__a_, __d, __m);} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp load(memory_order __m = memory_order_seq_cst) const volatile noexcept + _LIBCUDACXX_CHECK_LOAD_MEMORY_ORDER(__m) + {return __cxx_atomic_load(&this->__a_, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp load(memory_order __m = memory_order_seq_cst) const noexcept + _LIBCUDACXX_CHECK_LOAD_MEMORY_ORDER(__m) + {return __cxx_atomic_load(&this->__a_, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + operator _Tp() const volatile noexcept {return load();} + _LIBCUDACXX_INLINE_VISIBILITY + operator _Tp() const noexcept {return load();} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) const volatile noexcept + {return __cxx_atomic_exchange(&this->__a_, __d, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) const noexcept + {return __cxx_atomic_exchange(&this->__a_, __d, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_weak(_Tp& __e, _Tp __d, + memory_order __s, memory_order __f) const volatile noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) + {return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __s, __f);} + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_weak(_Tp& __e, _Tp __d, + memory_order __s, memory_order __f) const noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) + {return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __s, __f);} + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_strong(_Tp& __e, _Tp __d, + memory_order __s, memory_order __f) const volatile noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) + {return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __s, __f);} + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_strong(_Tp& __e, _Tp __d, + memory_order __s, memory_order __f) const noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) + {return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __s, __f);} + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_weak(_Tp& __e, _Tp __d, + memory_order __m = memory_order_seq_cst) const volatile noexcept { + if (memory_order_acq_rel == __m) + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, memory_order_acquire); + else if (memory_order_release == __m) + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, memory_order_relaxed); + else + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, __m); + } + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_weak(_Tp& __e, _Tp __d, + memory_order __m = memory_order_seq_cst) const noexcept { + if(memory_order_acq_rel == __m) + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, memory_order_acquire); + else if(memory_order_release == __m) + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, memory_order_relaxed); + else + return __cxx_atomic_compare_exchange_weak(&this->__a_, &__e, __d, __m, __m); + } + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_strong(_Tp& __e, _Tp __d, + memory_order __m = memory_order_seq_cst) const volatile noexcept { + if (memory_order_acq_rel == __m) + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, memory_order_acquire); + else if (memory_order_release == __m) + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, memory_order_relaxed); + else + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, __m); + } + _LIBCUDACXX_INLINE_VISIBILITY + bool compare_exchange_strong(_Tp& __e, _Tp __d, + memory_order __m = memory_order_seq_cst) const noexcept { + if (memory_order_acq_rel == __m) + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, memory_order_acquire); + else if (memory_order_release == __m) + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, memory_order_relaxed); + else + return __cxx_atomic_compare_exchange_strong(&this->__a_, &__e, __d, __m, __m); + } + + _LIBCUDACXX_INLINE_VISIBILITY void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const volatile noexcept + {__cxx_atomic_wait(&this->__a_, __v, __m);} + _LIBCUDACXX_INLINE_VISIBILITY void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const noexcept + {__cxx_atomic_wait(&this->__a_, __v, __m);} + _LIBCUDACXX_INLINE_VISIBILITY void notify_one() const volatile noexcept + {__cxx_atomic_notify_one(&this->__a_);} + _LIBCUDACXX_INLINE_VISIBILITY void notify_one() const noexcept + {__cxx_atomic_notify_one(&this->__a_);} + _LIBCUDACXX_INLINE_VISIBILITY void notify_all() const volatile noexcept + {__cxx_atomic_notify_all(&this->__a_);} + _LIBCUDACXX_INLINE_VISIBILITY void notify_all() const noexcept + {__cxx_atomic_notify_all(&this->__a_);} +}; + +template +struct __atomic_base_arithmetic : public __atomic_base_core<_Tp, _Cq, _Storage> { + __atomic_base_arithmetic() = default; + __atomic_base_arithmetic(const __atomic_base_arithmetic&) = delete; + __atomic_base_arithmetic(__atomic_base_arithmetic&&) = delete; + + __atomic_base_arithmetic& operator=(const __atomic_base_arithmetic&) = delete; + __atomic_base_arithmetic& operator=(__atomic_base_arithmetic&&) = delete; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __atomic_base_arithmetic(_Storage&& __a) noexcept : __atomic_base_core<_Tp, _Cq, _Storage>(_CUDA_VSTD::forward<_Storage>(__a)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept + {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept + {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept + {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept + {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator++(int) volatile noexcept {return fetch_add(_Tp(1));} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator++(int) noexcept {return fetch_add(_Tp(1));} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator--(int) volatile noexcept {return fetch_sub(_Tp(1));} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator--(int) noexcept {return fetch_sub(_Tp(1));} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator++() volatile noexcept {return fetch_add(_Tp(1)) + _Tp(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator++() noexcept {return fetch_add(_Tp(1)) + _Tp(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator--() volatile noexcept {return fetch_sub(_Tp(1)) - _Tp(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator--() noexcept {return fetch_sub(_Tp(1)) - _Tp(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator+=(_Tp __op) volatile noexcept {return fetch_add(__op) + __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator+=(_Tp __op) noexcept {return fetch_add(__op) + __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator-=(_Tp __op) volatile noexcept {return fetch_sub(__op) - __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator-=(_Tp __op) noexcept {return fetch_sub(__op) - __op;} +}; + +template +struct __atomic_base_arithmetic<_Tp, true, _Storage> : public __atomic_base_core<_Tp, true, _Storage> { + __atomic_base_arithmetic() = default; + __atomic_base_arithmetic(const __atomic_base_arithmetic&) = default; + __atomic_base_arithmetic(__atomic_base_arithmetic&&) = default; + + __atomic_base_arithmetic& operator=(const __atomic_base_arithmetic&) = default; + __atomic_base_arithmetic& operator=(__atomic_base_arithmetic&&) = default; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __atomic_base_arithmetic(_Storage&& __a) noexcept : __atomic_base_core<_Tp, true, _Storage>(_CUDA_VSTD::forward<_Storage>(__a)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) const volatile noexcept + {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) const noexcept + {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) const volatile noexcept + {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) const noexcept + {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator++(int) const volatile noexcept {return fetch_add(_Tp(1));} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator++(int) const noexcept {return fetch_add(_Tp(1));} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator--(int) const volatile noexcept {return fetch_sub(_Tp(1));} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator--(int) const noexcept {return fetch_sub(_Tp(1));} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator++() const volatile noexcept {return fetch_add(_Tp(1)) + _Tp(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator++() const noexcept {return fetch_add(_Tp(1)) + _Tp(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator--() const volatile noexcept {return fetch_sub(_Tp(1)) - _Tp(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator--() const noexcept {return fetch_sub(_Tp(1)) - _Tp(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator+=(_Tp __op) const volatile noexcept {return fetch_add(__op) + __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator+=(_Tp __op) const noexcept {return fetch_add(__op) + __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator-=(_Tp __op) const volatile noexcept {return fetch_sub(__op) - __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator-=(_Tp __op) const noexcept {return fetch_sub(__op) - __op;} +}; + +template +struct __atomic_base_bitwise : public __atomic_base_arithmetic<_Tp, _Cq, _Storage> { + __atomic_base_bitwise() = default; + __atomic_base_bitwise(const __atomic_base_bitwise&) = delete; + __atomic_base_bitwise(__atomic_base_bitwise&&) = delete; + + __atomic_base_bitwise& operator=(const __atomic_base_bitwise&) = delete; + __atomic_base_bitwise& operator=(__atomic_base_bitwise&&) = delete; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __atomic_base_bitwise(_Storage&& __a) noexcept : __atomic_base_arithmetic<_Tp, _Cq, _Storage>(_CUDA_VSTD::forward<_Storage>(__a)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept + {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept + {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept + {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept + {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept + {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept + {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator&=(_Tp __op) volatile noexcept {return fetch_and(__op) & __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator&=(_Tp __op) noexcept {return fetch_and(__op) & __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator|=(_Tp __op) volatile noexcept {return fetch_or(__op) | __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator|=(_Tp __op) noexcept {return fetch_or(__op) | __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator^=(_Tp __op) volatile noexcept {return fetch_xor(__op) ^ __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator^=(_Tp __op) noexcept {return fetch_xor(__op) ^ __op;} +}; + +template +struct __atomic_base_bitwise<_Tp, true, _Storage> : public __atomic_base_arithmetic<_Tp, true, _Storage> { + __atomic_base_bitwise() = default; + __atomic_base_bitwise(const __atomic_base_bitwise&) = default; + __atomic_base_bitwise(__atomic_base_bitwise&&) = default; + + __atomic_base_bitwise& operator=(const __atomic_base_bitwise&) = default; + __atomic_base_bitwise& operator=(__atomic_base_bitwise&&) = default; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __atomic_base_bitwise(_Storage&& __a) noexcept : __atomic_base_arithmetic<_Tp, true, _Storage>(_CUDA_VSTD::forward<_Storage>(__a)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) const volatile noexcept + {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) const noexcept + {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) const volatile noexcept + {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) const noexcept + {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) const volatile noexcept + {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) const noexcept + {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator&=(_Tp __op) const volatile noexcept {return fetch_and(__op) & __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator&=(_Tp __op) const noexcept {return fetch_and(__op) & __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator|=(_Tp __op) const volatile noexcept {return fetch_or(__op) | __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator|=(_Tp __op) const noexcept {return fetch_or(__op) | __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator^=(_Tp __op) const volatile noexcept {return fetch_xor(__op) ^ __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator^=(_Tp __op) const noexcept {return fetch_xor(__op) ^ __op;} +}; + +template +using __atomic_select_base = __conditional_t::value, + __atomic_base_arithmetic<_Tp, _Cq, _Storage>, + __conditional_t::value, + __atomic_base_bitwise<_Tp, _Cq, _Storage>, + __atomic_base_core<_Tp, _Cq, _Storage> >>; + +template >> +struct __atomic_base : public _Base { + __atomic_base() = default; + __atomic_base(const __atomic_base&) = delete; + __atomic_base(__atomic_base&&) = delete; + + __atomic_base& operator=(const __atomic_base&) = delete; + __atomic_base& operator=(__atomic_base&&) = delete; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __atomic_base(const _Tp& __a) noexcept : + _Base(__cxx_atomic_impl<_Tp, _Sco>(__a)) {} +}; + +template >> +struct __atomic_base_ref : public _Base { + __atomic_base_ref() = default; + __atomic_base_ref(const __atomic_base_ref&) = default; + __atomic_base_ref(__atomic_base_ref&&) = default; + + __atomic_base_ref& operator=(const __atomic_base_ref&) = default; + __atomic_base_ref& operator=(__atomic_base_ref&&) = default; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr + __atomic_base_ref(_Tp& __a) noexcept : + _Base(__cxx_atomic_ref_impl<_Tp, _Sco>(__a)) {} +}; + +#if defined(_LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE) +template +constexpr bool __atomic_base_core<_Tp, _Cq, _Storage>::is_always_lock_free; +#endif + +// atomic +template +struct atomic + : public __atomic_base<_Tp> +{ + typedef __atomic_base<_Tp> __base; + using value_type = _Tp; + + atomic() noexcept = default; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr atomic(_Tp __d) noexcept : __base(__d) {} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator=(_Tp __d) volatile noexcept + {__base::store(__d); return __d;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator=(_Tp __d) noexcept + {__base::store(__d); return __d;} +}; + +// atomic + +template +struct atomic<_Tp*> + : public __atomic_base<_Tp*> +{ + typedef __atomic_base<_Tp*> __base; + using value_type = _Tp*; + + atomic() noexcept = default; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr atomic(_Tp* __d) noexcept : __base(__d) {} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator=(_Tp* __d) volatile noexcept + {__base::store(__d); return __d;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator=(_Tp* __d) noexcept + {__base::store(__d); return __d;} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) + volatile noexcept + {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) + noexcept + {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) + volatile noexcept + {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) + noexcept + {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator++(int) volatile noexcept {return fetch_add(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator++(int) noexcept {return fetch_add(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator--(int) volatile noexcept {return fetch_sub(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator--(int) noexcept {return fetch_sub(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator++() volatile noexcept {return fetch_add(1) + 1;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator++() noexcept {return fetch_add(1) + 1;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator--() volatile noexcept {return fetch_sub(1) - 1;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator--() noexcept {return fetch_sub(1) - 1;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator+=(ptrdiff_t __op) volatile noexcept {return fetch_add(__op) + __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator+=(ptrdiff_t __op) noexcept {return fetch_add(__op) + __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator-=(ptrdiff_t __op) volatile noexcept {return fetch_sub(__op) - __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator-=(ptrdiff_t __op) noexcept {return fetch_sub(__op) - __op;} +}; + +// atomic_ref + +template + struct atomic_ref + : public __atomic_base_ref<_Tp> +{ + typedef __atomic_base_ref<_Tp> __base; + using value_type = _Tp; + + static constexpr size_t required_alignment = sizeof(_Tp); + + static constexpr bool is_always_lock_free = sizeof(_Tp) <= 8; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit atomic_ref(_Tp& __ref) : __base(__ref) {} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator=(_Tp __v) const noexcept {__base::store(__v); return __v;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp operator=(_Tp __v) const volatile noexcept {__base::store(__v); return __v;} +}; + +// atomic_ref + +template + struct atomic_ref<_Tp*> + : public __atomic_base_ref<_Tp*> +{ + typedef __atomic_base_ref<_Tp*> __base; + using value_type = _Tp*; + + static constexpr size_t required_alignment = sizeof(_Tp*); + + static constexpr bool is_always_lock_free = sizeof(_Tp*) <= 8; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit atomic_ref(_Tp*& __ref) : __base(__ref) {} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator=(_Tp* __v) const noexcept {__base::store(__v); return __v;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator=(_Tp* __v) const volatile noexcept {__base::store(__v); return __v;} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) + const volatile noexcept + {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) + const noexcept + {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) + const volatile noexcept + {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) + const noexcept + {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} + + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator++(int) const volatile noexcept {return fetch_add(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator++(int) const noexcept {return fetch_add(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator--(int) const volatile noexcept {return fetch_sub(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator--(int) const noexcept {return fetch_sub(1);} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator++() const volatile noexcept {return fetch_add(1) + 1;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator++() const noexcept {return fetch_add(1) + 1;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator--() const volatile noexcept {return fetch_sub(1) - 1;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator--() const noexcept {return fetch_sub(1) - 1;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator+=(ptrdiff_t __op) const volatile noexcept {return fetch_add(__op) + __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator+=(ptrdiff_t __op) const noexcept {return fetch_add(__op) + __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator-=(ptrdiff_t __op) const volatile noexcept {return fetch_sub(__op) - __op;} + _LIBCUDACXX_INLINE_VISIBILITY + _Tp* operator-=(ptrdiff_t __op) const noexcept {return fetch_sub(__op) - __op;} +}; + +// atomic_is_lock_free + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_is_lock_free(const volatile atomic<_Tp>* __o) noexcept +{ + return __o->is_lock_free(); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_is_lock_free(const atomic<_Tp>* __o) noexcept +{ + return __o->is_lock_free(); +} + +// atomic_init + +template +_LIBCUDACXX_INLINE_VISIBILITY +void +atomic_init(volatile atomic<_Tp>* __o, _Tp __d) noexcept +{ + __cxx_atomic_init(&__o->__a_, __d); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +void +atomic_init(atomic<_Tp>* __o, _Tp __d) noexcept +{ + __cxx_atomic_init(&__o->__a_, __d); +} + +// atomic_store + +template +_LIBCUDACXX_INLINE_VISIBILITY +void +atomic_store(volatile atomic<_Tp>* __o, _Tp __d) noexcept +{ + __o->store(__d); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +void +atomic_store(atomic<_Tp>* __o, _Tp __d) noexcept +{ + __o->store(__d); +} + +// atomic_store_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +void +atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) noexcept + _LIBCUDACXX_CHECK_STORE_MEMORY_ORDER(__m) +{ + __o->store(__d, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +void +atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) noexcept + _LIBCUDACXX_CHECK_STORE_MEMORY_ORDER(__m) +{ + __o->store(__d, __m); +} + +// atomic_load + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp +atomic_load(const volatile atomic<_Tp>* __o) noexcept +{ + return __o->load(); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp +atomic_load(const atomic<_Tp>* __o) noexcept +{ + return __o->load(); +} + +// atomic_load_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp +atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) noexcept + _LIBCUDACXX_CHECK_LOAD_MEMORY_ORDER(__m) +{ + return __o->load(__m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp +atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) noexcept + _LIBCUDACXX_CHECK_LOAD_MEMORY_ORDER(__m) +{ + return __o->load(__m); +} + +// atomic_exchange + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp +atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) noexcept +{ + return __o->exchange(__d); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp +atomic_exchange(atomic<_Tp>* __o, _Tp __d) noexcept +{ + return __o->exchange(__d); +} + +// atomic_exchange_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp +atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) noexcept +{ + return __o->exchange(__d, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp +atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) noexcept +{ + return __o->exchange(__d, __m); +} + +// atomic_compare_exchange_weak + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) noexcept +{ + return __o->compare_exchange_weak(*__e, __d); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) noexcept +{ + return __o->compare_exchange_weak(*__e, __d); +} + +// atomic_compare_exchange_strong + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) noexcept +{ + return __o->compare_exchange_strong(*__e, __d); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) noexcept +{ + return __o->compare_exchange_strong(*__e, __d); +} + +// atomic_compare_exchange_weak_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e, + _Tp __d, + memory_order __s, memory_order __f) noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) +{ + return __o->compare_exchange_weak(*__e, __d, __s, __f); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d, + memory_order __s, memory_order __f) noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) +{ + return __o->compare_exchange_weak(*__e, __d, __s, __f); +} + +// atomic_compare_exchange_strong_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o, + _Tp* __e, _Tp __d, + memory_order __s, memory_order __f) noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) +{ + return __o->compare_exchange_strong(*__e, __d, __s, __f); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e, + _Tp __d, + memory_order __s, memory_order __f) noexcept + _LIBCUDACXX_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) +{ + return __o->compare_exchange_strong(*__e, __d, __s, __f); +} + +// atomic_wait + +template +_LIBCUDACXX_INLINE_VISIBILITY +void atomic_wait(const volatile atomic<_Tp>* __o, + typename atomic<_Tp>::value_type __v) noexcept +{ + return __o->wait(__v); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +void atomic_wait(const atomic<_Tp>* __o, + typename atomic<_Tp>::value_type __v) noexcept +{ + return __o->wait(__v); +} + +// atomic_wait_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +void atomic_wait_explicit(const volatile atomic<_Tp>* __o, + typename atomic<_Tp>::value_type __v, + memory_order __m) noexcept + _LIBCUDACXX_CHECK_LOAD_MEMORY_ORDER(__m) +{ + return __o->wait(__v, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +void atomic_wait_explicit(const atomic<_Tp>* __o, + typename atomic<_Tp>::value_type __v, + memory_order __m) noexcept + _LIBCUDACXX_CHECK_LOAD_MEMORY_ORDER(__m) +{ + return __o->wait(__v, __m); +} + +// atomic_notify_one + +template +_LIBCUDACXX_INLINE_VISIBILITY +void atomic_notify_one(volatile atomic<_Tp>* __o) noexcept +{ + __o->notify_one(); +} +template +_LIBCUDACXX_INLINE_VISIBILITY +void atomic_notify_one(atomic<_Tp>* __o) noexcept +{ + __o->notify_one(); +} + +// atomic_notify_one + +template +_LIBCUDACXX_INLINE_VISIBILITY +void atomic_notify_all(volatile atomic<_Tp>* __o) noexcept +{ + __o->notify_all(); +} +template +_LIBCUDACXX_INLINE_VISIBILITY +void atomic_notify_all(atomic<_Tp>* __o) noexcept +{ + __o->notify_all(); +} + +// atomic_fetch_add + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + (is_integral<_Tp>::value && !is_same<_Tp, bool>::value) || is_floating_point<_Tp>::value, + _Tp +> +atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) noexcept +{ + return __o->fetch_add(__op); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + (is_integral<_Tp>::value && !is_same<_Tp, bool>::value) || is_floating_point<_Tp>::value, + _Tp +> +atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) noexcept +{ + return __o->fetch_add(__op); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp* +atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) noexcept +{ + return __o->fetch_add(__op); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp* +atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) noexcept +{ + return __o->fetch_add(__op); +} + +// atomic_fetch_add_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + (is_integral<_Tp>::value && !is_same<_Tp, bool>::value) || is_floating_point<_Tp>::value, + _Tp +> +atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept +{ + return __o->fetch_add(__op, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + (is_integral<_Tp>::value && !is_same<_Tp, bool>::value) || is_floating_point<_Tp>::value, + _Tp +> +atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept +{ + return __o->fetch_add(__op, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp* +atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, + memory_order __m) noexcept +{ + return __o->fetch_add(__op, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp* +atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) noexcept +{ + return __o->fetch_add(__op, __m); +} + +// atomic_fetch_sub + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + (is_integral<_Tp>::value && !is_same<_Tp, bool>::value) || is_floating_point<_Tp>::value, + _Tp +> +atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) noexcept +{ + return __o->fetch_sub(__op); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + (is_integral<_Tp>::value && !is_same<_Tp, bool>::value) || is_floating_point<_Tp>::value, + _Tp +> +atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) noexcept +{ + return __o->fetch_sub(__op); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp* +atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) noexcept +{ + return __o->fetch_sub(__op); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp* +atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) noexcept +{ + return __o->fetch_sub(__op); +} + +// atomic_fetch_sub_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + (is_integral<_Tp>::value && !is_same<_Tp, bool>::value) || is_floating_point<_Tp>::value, + _Tp +> +atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept +{ + return __o->fetch_sub(__op, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + (is_integral<_Tp>::value && !is_same<_Tp, bool>::value) || is_floating_point<_Tp>::value, + _Tp +> +atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept +{ + return __o->fetch_sub(__op, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp* +atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, + memory_order __m) noexcept +{ + return __o->fetch_sub(__op, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp* +atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) noexcept +{ + return __o->fetch_sub(__op, __m); +} + +// atomic_fetch_and + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) noexcept +{ + return __o->fetch_and(__op); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) noexcept +{ + return __o->fetch_and(__op); +} + +// atomic_fetch_and_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept +{ + return __o->fetch_and(__op, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept +{ + return __o->fetch_and(__op, __m); +} + +// atomic_fetch_or + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) noexcept +{ + return __o->fetch_or(__op); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) noexcept +{ + return __o->fetch_or(__op); +} + +// atomic_fetch_or_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept +{ + return __o->fetch_or(__op, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept +{ + return __o->fetch_or(__op, __m); +} + +// atomic_fetch_xor + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) noexcept +{ + return __o->fetch_xor(__op); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) noexcept +{ + return __o->fetch_xor(__op); +} + +// atomic_fetch_xor_explicit + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept +{ + return __o->fetch_xor(__op, __m); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +> +atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept +{ + return __o->fetch_xor(__op, __m); +} + +// flag type and operations + +typedef struct atomic_flag +{ + __cxx_atomic_impl<_LIBCUDACXX_ATOMIC_FLAG_TYPE, 0> __a_; + + _LIBCUDACXX_INLINE_VISIBILITY + bool test(memory_order __m = memory_order_seq_cst) const volatile noexcept + {return _LIBCUDACXX_ATOMIC_FLAG_TYPE(true)==__cxx_atomic_load(&__a_, __m);} + _LIBCUDACXX_INLINE_VISIBILITY + bool test(memory_order __m = memory_order_seq_cst) const noexcept + {return _LIBCUDACXX_ATOMIC_FLAG_TYPE(true)==__cxx_atomic_load(&__a_, __m);} + + _LIBCUDACXX_INLINE_VISIBILITY + bool test_and_set(memory_order __m = memory_order_seq_cst) volatile noexcept + {return __cxx_atomic_exchange(&__a_, _LIBCUDACXX_ATOMIC_FLAG_TYPE(true), __m);} + _LIBCUDACXX_INLINE_VISIBILITY + bool test_and_set(memory_order __m = memory_order_seq_cst) noexcept + {return __cxx_atomic_exchange(&__a_, _LIBCUDACXX_ATOMIC_FLAG_TYPE(true), __m);} + _LIBCUDACXX_INLINE_VISIBILITY + void clear(memory_order __m = memory_order_seq_cst) volatile noexcept + {__cxx_atomic_store(&__a_, _LIBCUDACXX_ATOMIC_FLAG_TYPE(false), __m);} + _LIBCUDACXX_INLINE_VISIBILITY + void clear(memory_order __m = memory_order_seq_cst) noexcept + {__cxx_atomic_store(&__a_, _LIBCUDACXX_ATOMIC_FLAG_TYPE(false), __m);} + +#if !defined(__CUDA_MINIMUM_ARCH__) || __CUDA_MINIMUM_ARCH__ >= 700 + _LIBCUDACXX_INLINE_VISIBILITY + void wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile noexcept + {__cxx_atomic_wait(&__a_, _LIBCUDACXX_ATOMIC_FLAG_TYPE(__v), __m);} + _LIBCUDACXX_INLINE_VISIBILITY + void wait(bool __v, memory_order __m = memory_order_seq_cst) const noexcept + {__cxx_atomic_wait(&__a_, _LIBCUDACXX_ATOMIC_FLAG_TYPE(__v), __m);} + _LIBCUDACXX_INLINE_VISIBILITY + void notify_one() volatile noexcept + {__cxx_atomic_notify_one(&__a_);} + _LIBCUDACXX_INLINE_VISIBILITY + void notify_one() noexcept + {__cxx_atomic_notify_one(&__a_);} + _LIBCUDACXX_INLINE_VISIBILITY + void notify_all() volatile noexcept + {__cxx_atomic_notify_all(&__a_);} + _LIBCUDACXX_INLINE_VISIBILITY + void notify_all() noexcept + {__cxx_atomic_notify_all(&__a_);} +#endif + + atomic_flag() noexcept = default; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr + atomic_flag(bool __b) noexcept : __a_(__b) {} // EXTENSION + + atomic_flag(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) volatile = delete; +} atomic_flag; + + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_flag_test(const volatile atomic_flag* __o) noexcept +{ + return __o->test(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_flag_test(const atomic_flag* __o) noexcept +{ + return __o->test(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_flag_test_explicit(const volatile atomic_flag* __o, memory_order __m) noexcept +{ + return __o->test(__m); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_flag_test_explicit(const atomic_flag* __o, memory_order __m) noexcept +{ + return __o->test(__m); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_flag_test_and_set(volatile atomic_flag* __o) noexcept +{ + return __o->test_and_set(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_flag_test_and_set(atomic_flag* __o) noexcept +{ + return __o->test_and_set(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) noexcept +{ + return __o->test_and_set(__m); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) noexcept +{ + return __o->test_and_set(__m); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_clear(volatile atomic_flag* __o) noexcept +{ + __o->clear(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_clear(atomic_flag* __o) noexcept +{ + __o->clear(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) noexcept +{ + __o->clear(__m); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) noexcept +{ + __o->clear(__m); +} + +#if !defined(__CUDA_MINIMUM_ARCH__) || __CUDA_MINIMUM_ARCH__ >= 700 + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_wait(const volatile atomic_flag* __o, bool __v) noexcept +{ + __o->wait(__v); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_wait(const atomic_flag* __o, bool __v) noexcept +{ + __o->wait(__v); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_wait_explicit(const volatile atomic_flag* __o, + bool __v, memory_order __m) noexcept +{ + __o->wait(__v, __m); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_wait_explicit(const atomic_flag* __o, + bool __v, memory_order __m) noexcept +{ + __o->wait(__v, __m); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_notify_one(volatile atomic_flag* __o) noexcept +{ + __o->notify_one(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_notify_one(atomic_flag* __o) noexcept +{ + __o->notify_one(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_notify_all(volatile atomic_flag* __o) noexcept +{ + __o->notify_all(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_flag_notify_all(atomic_flag* __o) noexcept +{ + __o->notify_all(); +} + +#endif + +// fences + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_thread_fence(memory_order __m) noexcept +{ + __cxx_atomic_thread_fence(__m); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +atomic_signal_fence(memory_order __m) noexcept +{ + __cxx_atomic_signal_fence(__m); +} + +// Atomics for standard typedef types + +typedef atomic atomic_bool; +typedef atomic atomic_char; +typedef atomic atomic_schar; +typedef atomic atomic_uchar; +typedef atomic atomic_short; +typedef atomic atomic_ushort; +typedef atomic atomic_int; +typedef atomic atomic_uint; +typedef atomic atomic_long; +typedef atomic atomic_ulong; +typedef atomic atomic_llong; +typedef atomic atomic_ullong; +typedef atomic atomic_char16_t; +typedef atomic atomic_char32_t; +typedef atomic atomic_wchar_t; + +typedef atomic atomic_int_least8_t; +typedef atomic atomic_uint_least8_t; +typedef atomic atomic_int_least16_t; +typedef atomic atomic_uint_least16_t; +typedef atomic atomic_int_least32_t; +typedef atomic atomic_uint_least32_t; +typedef atomic atomic_int_least64_t; +typedef atomic atomic_uint_least64_t; + +typedef atomic atomic_int_fast8_t; +typedef atomic atomic_uint_fast8_t; +typedef atomic atomic_int_fast16_t; +typedef atomic atomic_uint_fast16_t; +typedef atomic atomic_int_fast32_t; +typedef atomic atomic_uint_fast32_t; +typedef atomic atomic_int_fast64_t; +typedef atomic atomic_uint_fast64_t; + +typedef atomic< int8_t> atomic_int8_t; +typedef atomic atomic_uint8_t; +typedef atomic< int16_t> atomic_int16_t; +typedef atomic atomic_uint16_t; +typedef atomic< int32_t> atomic_int32_t; +typedef atomic atomic_uint32_t; +typedef atomic< int64_t> atomic_int64_t; +typedef atomic atomic_uint64_t; + +typedef atomic atomic_intptr_t; +typedef atomic atomic_uintptr_t; +typedef atomic atomic_size_t; +typedef atomic atomic_ptrdiff_t; +typedef atomic atomic_intmax_t; +typedef atomic atomic_uintmax_t; + +static_assert(ATOMIC_INT_LOCK_FREE, "This library assumes atomic is lock-free."); + +typedef atomic atomic_signed_lock_free; +typedef atomic atomic_unsigned_lock_free; + +#define ATOMIC_FLAG_INIT {false} +#define ATOMIC_VAR_INIT(__v) {__v} + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#else +#include "__cuda/atomic.h" +#endif // __cuda_std__ + +#endif // _LIBCUDACXX_ATOMIC diff --git a/cuda_toolkit/include/barrier b/cuda_toolkit/include/barrier new file mode 100644 index 0000000000000000000000000000000000000000..dc3476f9ff00095d1bce825a57273675f88da209 --- /dev/null +++ b/cuda_toolkit/include/barrier @@ -0,0 +1,487 @@ +// -*- C++ -*- +//===--------------------------- barrier ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_BARRIER +#define _LIBCUDACXX_BARRIER + +/* + barrier synopsis + +namespace std +{ + + template + class barrier + { + public: + using arrival_token = see below; + + constexpr explicit barrier(ptrdiff_t phase_count, + CompletionFunction f = CompletionFunction()); + ~barrier(); + + barrier(const barrier&) = delete; + barrier& operator=(const barrier&) = delete; + + [[nodiscard]] arrival_token arrive(ptrdiff_t update = 1); + void wait(arrival_token&& arrival) const; + + void arrive_and_wait(); + void arrive_and_drop(); + + private: + CompletionFunction __completion; // exposition only + }; + +} + +*/ + +#ifndef __cuda_std__ +#include <__config> +#ifndef _LIBCUDACXX_HAS_NO_TREE_BARRIER +# include +# include +#endif +#else +#ifndef _LIBCUDACXX_COMPILER_NVRTC +#include +#endif // _LIBCUDACXX_COMPILER_NVRTC +#endif // __cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__debug" +#include "atomic" +#include "chrono" +#include "cstddef" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#ifdef _LIBCUDACXX_HAS_NO_THREADS +# error is not supported on this single threaded system +#endif + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +struct __empty_completion +{ + inline _LIBCUDACXX_INLINE_VISIBILITY + void operator()() noexcept { } +}; + +#ifndef _LIBCUDACXX_HAS_NO_TREE_BARRIER + +template +class alignas(64) __barrier_base { + + ptrdiff_t __expected; + __atomic_base __expected_adjustment; + _CompletionF __completion; + + using __phase_t = uint8_t; + __atomic_base<__phase_t, _Sco> __phase; + + struct alignas(64) __state_t + { + struct { + __atomic_base<__phase_t, _Sco> __phase = ATOMIC_VAR_INIT(0); + } __tickets[64]; + }; + ::std::vector<__state_t> __state; + + inline _LIBCUDACXX_INLINE_VISIBILITY + bool __arrive(__phase_t const __old_phase) + { + __phase_t const __half_step = __old_phase + 1, __full_step = __old_phase + 2; +#ifndef _LIBCUDACXX_HAS_NO_THREAD_FAVORITE_BARRIER_INDEX + ptrdiff_t __current = __libcpp_thread_favorite_barrier_index, +#else + ptrdiff_t __current = 0, +#endif + __current_expected = __expected, + __last_node = (__current_expected >> 1); + for(size_t __round = 0;; ++__round) { + _LIBCUDACXX_ASSERT(__round <= 63, ""); + if(__current_expected == 1) + return true; + for(;;++__current) { +#ifndef _LIBCUDACXX_HAS_NO_THREAD_FAVORITE_BARRIER_INDEX + if(0 == __round) { + if(__current >= __current_expected) + __current = 0; + __libcpp_thread_favorite_barrier_index = __current; + } +#endif + _LIBCUDACXX_ASSERT(__current <= __last_node, ""); + __phase_t expect = __old_phase; + if(__current == __last_node && (__current_expected & 1)) + { + if(__state[__current].__tickets[__round].__phase.compare_exchange_strong(expect, __full_step, memory_order_acq_rel)) + break; // I'm 1 in 1, go to next __round + _LIBCUDACXX_ASSERT(expect == __full_step, ""); + } + else if(__state[__current].__tickets[__round].__phase.compare_exchange_strong(expect, __half_step, memory_order_acq_rel)) + { + return false; // I'm 1 in 2, done with arrival + } + else if(expect == __half_step) + { + if(__state[__current].__tickets[__round].__phase.compare_exchange_strong(expect, __full_step, memory_order_acq_rel)) + break; // I'm 2 in 2, go to next __round + _LIBCUDACXX_ASSERT(expect == __full_step, ""); + } + _LIBCUDACXX_ASSERT(__round == 0 && expect == __full_step, ""); + } + __current_expected = (__current_expected >> 1) + (__current_expected & 1); + __current &= ~( 1 << __round ); + __last_node &= ~( 1 << __round ); + } + } + +public: + using arrival_token = __phase_t; + + inline _LIBCUDACXX_INLINE_VISIBILITY + __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF()) + : __expected(__expected), __expected_adjustment(0), __completion(__completion), + __phase(0), __state((__expected+1) >> 1) + { + _LIBCUDACXX_ASSERT(__expected >= 0, ""); + } + + inline _LIBCUDACXX_INLINE_VISIBILITY + ~__barrier_base() = default; + + __barrier_base(__barrier_base const&) = delete; + __barrier_base& operator=(__barrier_base const&) = delete; + + _LIBCUDACXX_NODISCARD_ATTRIBUTE inline _LIBCUDACXX_INLINE_VISIBILITY + arrival_token arrive(ptrdiff_t update = 1) + { + _LIBCUDACXX_ASSERT(update > 0, ""); + auto __old_phase = __phase.load(memory_order_relaxed); + for(; update; --update) + if(__arrive(__old_phase)) { + __completion(); + __expected += __expected_adjustment.load(memory_order_relaxed); + __expected_adjustment.store(0, memory_order_relaxed); + __phase.store(__old_phase + 2, memory_order_release); + } + return __old_phase; + } + inline _LIBCUDACXX_INLINE_VISIBILITY + void wait(arrival_token&& __old_phase) const + { + __libcpp_thread_poll_with_backoff([=]() -> bool { + return __phase.load(memory_order_acquire) != __old_phase; + }); + } + inline _LIBCUDACXX_INLINE_VISIBILITY + void arrive_and_wait() + { + wait(arrive()); + } + inline _LIBCUDACXX_INLINE_VISIBILITY + void arrive_and_drop() + { + __expected_adjustment.fetch_sub(1, memory_order_relaxed); + (void)arrive(); + } +}; + +#else + +# if _LIBCUDACXX_CUDA_ABI_VERSION < 3 +# define _LIBCUDACXX_BARRIER_ALIGNMENTS alignas(64) +# else +# define _LIBCUDACXX_BARRIER_ALIGNMENTS +# endif + +template +class __barrier_poll_tester_phase { + _Barrier const* __this; + typename _Barrier::arrival_token __phase; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + __barrier_poll_tester_phase(_Barrier const* __this_, + typename _Barrier::arrival_token&& __phase_) + : __this(__this_) + , __phase(_CUDA_VSTD::move(__phase_)) + {} + + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()() const + { + return __this->__try_wait(__phase); + } +}; + +template +class __barrier_poll_tester_parity { + _Barrier const* __this; + bool __parity; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + __barrier_poll_tester_parity(_Barrier const* __this_, bool __parity_) + : __this(__this_) + , __parity(__parity_) + {} + + inline _LIBCUDACXX_INLINE_VISIBILITY + bool operator()() const + { + return __this->__try_wait_parity(__parity); + } +}; + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool __call_try_wait(const _Barrier& __b, typename _Barrier::arrival_token&& __phase) +{ + return __b.__try_wait(_CUDA_VSTD::move(__phase)); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool __call_try_wait_parity(const _Barrier& __b, bool __parity) +{ + return __b.__try_wait_parity(__parity); +} + + +template +class __barrier_base { + + _LIBCUDACXX_BARRIER_ALIGNMENTS __atomic_base __expected, __arrived; + _LIBCUDACXX_BARRIER_ALIGNMENTS _CompletionF __completion; + _LIBCUDACXX_BARRIER_ALIGNMENTS __atomic_base __phase; + +public: + using arrival_token = bool; + +private: + template + friend class __barrier_poll_tester_phase; + template + friend class __barrier_poll_tester_parity; + template + _LIBCUDACXX_INLINE_VISIBILITY + friend bool __call_try_wait(const _Barrier& __b, + typename _Barrier::arrival_token&& __phase); + template + _LIBCUDACXX_INLINE_VISIBILITY + friend bool __call_try_wait_parity(const _Barrier& __b, bool __parity); + + _LIBCUDACXX_INLINE_VISIBILITY + bool __try_wait(arrival_token __old) const + { + return __phase.load(memory_order_acquire) != __old; + } + _LIBCUDACXX_INLINE_VISIBILITY + bool __try_wait_parity(bool __parity) const + { + return __try_wait(__parity); + } + +public: + __barrier_base() = default; + + _LIBCUDACXX_INLINE_VISIBILITY + __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF()) + : __expected(__expected), __arrived(__expected), __completion(__completion), __phase(false) + { + } + + ~__barrier_base() = default; + + __barrier_base(__barrier_base const&) = delete; + __barrier_base& operator=(__barrier_base const&) = delete; + + _LIBCUDACXX_NODISCARD_ATTRIBUTE _LIBCUDACXX_INLINE_VISIBILITY + arrival_token arrive(ptrdiff_t __update = 1) + { + auto const __old_phase = __phase.load(memory_order_relaxed); + auto const __result = __arrived.fetch_sub(__update, memory_order_acq_rel) - __update; + auto const __new_expected = __expected.load(memory_order_relaxed); + + _LIBCUDACXX_DEBUG_ASSERT(__result >= 0, ""); + + if(0 == __result) { + __completion(); + __arrived.store(__new_expected, memory_order_relaxed); + __phase.store(!__old_phase, memory_order_release); + __cxx_atomic_notify_all(&__phase.__a_); + } + return __old_phase; + } + _LIBCUDACXX_INLINE_VISIBILITY + void wait(arrival_token&& __old_phase) const + { + __phase.wait(__old_phase, memory_order_acquire); + } + _LIBCUDACXX_INLINE_VISIBILITY + void arrive_and_wait() + { + wait(arrive()); + } + _LIBCUDACXX_INLINE_VISIBILITY + void arrive_and_drop() + { + __expected.fetch_sub(1, memory_order_relaxed); + (void)arrive(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + static constexpr ptrdiff_t max() noexcept + { + return numeric_limits::max(); + } +}; + +template +class __barrier_base<__empty_completion, _Sco> { + + static constexpr uint64_t __expected_unit = 1ull; + static constexpr uint64_t __arrived_unit = 1ull << 32; + static constexpr uint64_t __expected_mask = __arrived_unit - 1; + static constexpr uint64_t __phase_bit = 1ull << 63; + static constexpr uint64_t __arrived_mask = (__phase_bit - 1) & ~__expected_mask; + + _LIBCUDACXX_BARRIER_ALIGNMENTS __atomic_base __phase_arrived_expected; + +public: + using arrival_token = uint64_t; + +private: + template + friend class __barrier_poll_tester_phase; + template + friend class __barrier_poll_tester_parity; + template + _LIBCUDACXX_INLINE_VISIBILITY + friend bool __call_try_wait(const _Barrier& __b, + typename _Barrier::arrival_token&& __phase); + template + _LIBCUDACXX_INLINE_VISIBILITY + friend bool __call_try_wait_parity(const _Barrier& __b, bool __parity); + + static _LIBCUDACXX_INLINE_VISIBILITY constexpr + uint64_t __init(ptrdiff_t __count) noexcept + { +#if _LIBCUDACXX_STD_VER > 11 + // This debug assert is not supported in C++11 due to resulting in a + // multi-statement constexpr function. + _LIBCUDACXX_DEBUG_ASSERT(__count >= 0, "Count must be non-negative."); +#endif // _LIBCUDACXX_STD_VER > 11 + return (((1u << 31) - __count) << 32) + | ((1u << 31) - __count); + } + _LIBCUDACXX_INLINE_VISIBILITY + bool __try_wait_phase(uint64_t __phase) const + { + uint64_t const __current = __phase_arrived_expected.load(memory_order_acquire); + return ((__current & __phase_bit) != __phase); + } + _LIBCUDACXX_INLINE_VISIBILITY + bool __try_wait(arrival_token __old) const + { + return __try_wait_phase(__old & __phase_bit); + } + _LIBCUDACXX_INLINE_VISIBILITY + bool __try_wait_parity(bool __parity) const + { + return __try_wait_phase(__parity ? __phase_bit : 0); + } + +public: + __barrier_base() = default; + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + __barrier_base(ptrdiff_t __count, __empty_completion = __empty_completion()) + : __phase_arrived_expected(__init(__count)) { + _LIBCUDACXX_DEBUG_ASSERT(__count >= 0, ""); + } + + ~__barrier_base() = default; + + __barrier_base(__barrier_base const&) = delete; + __barrier_base& operator=(__barrier_base const&) = delete; + + _LIBCUDACXX_NODISCARD_ATTRIBUTE inline _LIBCUDACXX_INLINE_VISIBILITY + arrival_token arrive(ptrdiff_t __update = 1) + { + auto const __inc = __arrived_unit * __update; + auto const __old = __phase_arrived_expected.fetch_add(__inc, memory_order_acq_rel); + if((__old ^ (__old + __inc)) & __phase_bit) { + __phase_arrived_expected.fetch_add((__old & __expected_mask) << 32, memory_order_relaxed); + __phase_arrived_expected.notify_all(); + } + return __old & __phase_bit; + } + _LIBCUDACXX_INLINE_VISIBILITY + void wait(arrival_token&& __phase) const + { + __libcpp_thread_poll_with_backoff(__barrier_poll_tester_phase<__barrier_base>(this, _CUDA_VSTD::move(__phase))); + } + _LIBCUDACXX_INLINE_VISIBILITY + void wait_parity(bool __parity) const + { + __libcpp_thread_poll_with_backoff(__barrier_poll_tester_parity<__barrier_base>(this, __parity)); + } + _LIBCUDACXX_INLINE_VISIBILITY + void arrive_and_wait() + { + wait(arrive()); + } + _LIBCUDACXX_INLINE_VISIBILITY + void arrive_and_drop() + { + __phase_arrived_expected.fetch_add(__expected_unit, memory_order_relaxed); + (void)arrive(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + static constexpr ptrdiff_t max() noexcept + { + return numeric_limits::max(); + } +}; + +#endif //_LIBCUDACXX_HAS_NO_TREE_BARRIER + +template +class barrier : public __barrier_base<_CompletionF> { +public: + _LIBCUDACXX_INLINE_VISIBILITY constexpr + barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF()) + : __barrier_base<_CompletionF>(__count, __completion) { + } +}; + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#else +#include "__cuda/barrier.h" +#endif // __cuda_std__ + +#endif //_LIBCUDACXX_BARRIER diff --git a/cuda_toolkit/include/bit b/cuda_toolkit/include/bit new file mode 100644 index 0000000000000000000000000000000000000000..8c9e0486b74900705be541e9f34d2b1b7bee5f12 --- /dev/null +++ b/cuda_toolkit/include/bit @@ -0,0 +1,884 @@ +// -*- C++ -*- +//===------------------------------ bit ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===---------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_BIT +#define _LIBCUDACXX_BIT + +/* + bit synopsis + +namespace std { + + template + constexpr bool has_single_bit(T x) noexcept; // C++20 + template + constexpr T bit_ceil(T x); // C++20 + template + constexpr T bit_floor(T x) noexcept; // C++20 + template + constexpr T bit_width(T x) noexcept; // C++20 + + // 23.20.2, rotating + template + constexpr T rotl(T x, unsigned int s) noexcept; // C++20 + template + constexpr T rotr(T x, unsigned int s) noexcept; // C++20 + + // 23.20.3, counting + template + constexpr int countl_zero(T x) noexcept; // C++20 + template + constexpr int countl_one(T x) noexcept; // C++20 + template + constexpr int countr_zero(T x) noexcept; // C++20 + template + constexpr int countr_one(T x) noexcept; // C++20 + template + constexpr int popcount(T x) noexcept; // C++20 + + // 20.15.9, endian + enum class endian { + little = see below, // C++20 + big = see below, // C++20 + native = see below // C++20 +}; + +} // namespace std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#include <__debug> +#endif // __cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "cstdint" +#include "limits" +#include "type_traits" +#include "version" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif //__cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#if defined(_LIBCUDACXX_COMPILER_MSVC) +#include +#endif // _LIBCUDACXX_COMPILER_MSVC + +#if defined(_LIBCUDACXX_COMPILER_IBM) +#include "support/ibm/support.h" +#endif // _LIBCUDACXX_COMPILER_IBM + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#define _LIBCUDACXX_BIT_CONSTEXPR constexpr + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_ctz2(uint64_t __x, int __c) noexcept { + return (__x & 0x1) ? __c : __c + 1; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_ctz4(uint64_t __x, int __c) noexcept { + return __binary_ctz2( + __x >> 2*!(__x & 0x3), + __c + 2*!(__x & 0x3)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_ctz8(uint64_t __x, int __c) noexcept { + return __binary_ctz4( + __x >> 4*!(__x & 0x0F), + __c + 4*!(__x & 0x0F)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_ctz16(uint64_t __x, int __c) noexcept { + return __binary_ctz8( + __x >> 8*!(__x & 0x00FF), + __c + 8*!(__x & 0x00FF)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_ctz32(uint64_t __x, int __c) noexcept { + return __binary_ctz16( + __x >> 16*!(__x & 0x0000FFFF), + __c + 16*!(__x & 0x0000FFFF)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_ctz64(uint64_t __x) noexcept { + return __binary_ctz32( + __x >> 32*!(__x & 0x00000000FFFFFFFF), + 32*!(__x & 0x00000000FFFFFFFF)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_clz2(uint64_t __x, int __c) { + return !!(~__x & 0x2) ^ __c; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_clz4(uint64_t __x, int __c) { + return __binary_clz2( + __x >> 2*!!(__x & 0xC), + __c + 2*!(__x & 0xC)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_clz8(uint64_t __x, int __c) { + return __binary_clz4( + __x >> 4*!!(__x & 0xF0), + __c + 4*!(__x & 0xF0)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_clz16(uint64_t __x, int __c) { + return __binary_clz8( + __x >> 8*!!(__x & 0xFF00), + __c + 8*!(__x & 0xFF00)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_clz32(uint64_t __x, int __c) { + return __binary_clz16( + __x >> 16*!!(__x & 0xFFFF0000), + __c + 16*!(__x & 0xFFFF0000)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __binary_clz64(uint64_t __x) { + return __binary_clz32( + __x >> 32*!!(__x & 0xFFFFFFFF00000000), + 32*!(__x & 0xFFFFFFFF00000000)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __fallback_popc8(uint64_t __x) { + return static_cast((__x * 0x0101010101010101) >> 56); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __fallback_popc16(uint64_t __x) { + return __fallback_popc8( + (__x + (__x >> 4)) & 0x0f0f0f0f0f0f0f0f); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __fallback_popc32(uint64_t __x) { + return __fallback_popc16( + (__x & 0x3333333333333333) + ((__x >> 2) & 0x3333333333333333)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __fallback_popc64(uint64_t __x) { + return __fallback_popc32( + __x - ((__x >> 1) & 0x5555555555555555)); +} + +#ifndef _LIBCUDACXX_COMPILER_MSVC + +inline _LIBCUDACXX_INLINE_VISIBILITY constexpr +int __libcpp_ctz(unsigned __x) noexcept { +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_CUDACC_BELOW_11_3)) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + if (!__libcpp_is_constant_evaluated()) { + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return (!__x) ? sizeof(unsigned) * 8 : __ffs(__x) - 1; + ), ( + return __builtin_ctz(__x); + )) + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + + return __binary_ctz32(static_cast(__x), 0); +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + return __builtin_ctz(__x); +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __libcpp_ctz(unsigned long __x) noexcept { +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_CUDACC_BELOW_11_3)) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + if (!__libcpp_is_constant_evaluated()) { + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return (!__x) ? sizeof(unsigned long) * 8 : __ffsll(__x) - 1; + ), ( + return __builtin_ctzl(__x); + )) + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + + return __binary_ctz64(static_cast(__x)); +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + return __builtin_ctzl(__x); +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __libcpp_ctz(unsigned long long __x) noexcept { +// For whatever reason __builtin_ctzll does not compile although it should +#if 1 //def _LIBCUDACXX_COMPILER_NVRTC +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + if (!__libcpp_is_constant_evaluated()) { + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return (!__x) ? sizeof(unsigned long long) * 8 : __ffsll(__x) - 1; + ), ( + return __builtin_ctzll(__x); + )) + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + + return __binary_ctz64(static_cast(__x)); +#else // 0 + return __builtin_ctzll(__x); +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __libcpp_clz(unsigned __x) noexcept { +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_CUDACC_BELOW_11_3)) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + if (!__libcpp_is_constant_evaluated()) { + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __clz(__x); + ), ( + return __builtin_clz(__x); + )) + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + return __binary_clz32(static_cast(__x), 0); +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + return __builtin_clz(__x); +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __libcpp_clz(unsigned long __x) noexcept { +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_CUDACC_BELOW_11_3)) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + if (!__libcpp_is_constant_evaluated()) { + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __clzll(__x); + ), ( + return __builtin_clzl(__x); + )) + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + + return __binary_clz64(static_cast(__x)); +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + return __builtin_clzl(__x); +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __libcpp_clz(unsigned long long __x) noexcept { +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_CUDACC_BELOW_11_3)) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + if (!__libcpp_is_constant_evaluated()) { + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __clzll(__x); + ), ( + return __builtin_clzll(__x); + )) + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + + return __binary_clz64(static_cast(__x)); +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + return __builtin_clzll(__x); +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __libcpp_popcount(unsigned __x) noexcept { +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_CUDACC_BELOW_11_3)) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + if (!__libcpp_is_constant_evaluated()) { + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __popc(__x); + ), ( + return __builtin_popcount(__x); + )) + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + + return __fallback_popc64(static_cast(__x)); +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + return __builtin_popcount(__x); +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __libcpp_popcount(unsigned long __x) noexcept { +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_CUDACC_BELOW_11_3)) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + if (!__libcpp_is_constant_evaluated()) { + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __popcll(__x); + ), ( + return __builtin_popcountl(__x); + )) + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + + return __fallback_popc64(static_cast(__x)); +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + return __builtin_popcountl(__x); +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 +} + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __libcpp_popcount(unsigned long long __x) noexcept { +#if defined(_LIBCUDACXX_COMPILER_NVRTC) \ + || (defined(_LIBCUDACXX_CUDACC_BELOW_11_3)) +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + if (!__libcpp_is_constant_evaluated()) { + NV_IF_ELSE_TARGET(NV_IS_DEVICE, ( + return __popcll(__x); + ), ( + return __builtin_popcountll(__x); + )) + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && (_LIBCUDACXX_STD_VER >= 14) + + return __fallback_popc64(static_cast(__x)); +#else // ^^^ _LIBCUDACXX_COMPILER_NVRTC || nvcc < 11.3 ^^^ / vvv !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 vvv + return __builtin_popcountll(__x); +#endif // !_LIBCUDACXX_COMPILER_NVRTC || nvcc >= 11.3 +} + +#else // _LIBCUDACXX_COMPILER_MSVC + +// Precondition: __x != 0 +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr int __libcpp_ctz(unsigned __x) { + static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); + static_assert(sizeof(unsigned long) == 4, ""); +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(__CUDA_ARCH__) + if (!__libcpp_is_constant_evaluated()) { + unsigned long __where = 0; + if (_BitScanForward(&__where, __x)) + return static_cast(__where); + return 32; + } +#endif // _LIBCUDACXX_IS_CONSTANT_EVALUATED && !defined(__CUDA_ARCH__) + + return __binary_ctz32(static_cast(__x), 0); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr int __libcpp_ctz(unsigned long __x) { + static_assert(sizeof(unsigned long) == sizeof(unsigned), ""); + return __libcpp_ctz(static_cast(__x)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr int __libcpp_ctz(unsigned long long __x) { +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(__CUDA_ARCH__) + if (!__libcpp_is_constant_evaluated()) { + unsigned long __where = 0; +# if defined(_LIBCUDACXX_HAS_BITSCAN64) && (defined(_M_AMD64) || defined(__x86_64__)) + if (_BitScanForward64(&__where, __x)) + return static_cast(__where); +# else + // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls. + if (_BitScanForward(&__where, static_cast(__x))) + return static_cast(__where); + if (_BitScanForward(&__where, static_cast(__x >> 32))) + return static_cast(__where + 32); +# endif + return 64; + } +#endif // _LIBCUDACXX_IS_CONSTANT_EVALUATED && !defined(__CUDA_ARCH__) + + return __binary_ctz64(__x); +} + +// Precondition: __x != 0 +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr int __libcpp_clz(unsigned __x) { + static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); + static_assert(sizeof(unsigned long) == 4, ""); +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(__CUDA_ARCH__) + if (!__libcpp_is_constant_evaluated()) { + unsigned long __where = 0; + if (_BitScanReverse(&__where, __x)) + return static_cast(31 - __where); + return 32; // Undefined Behavior. + } +#endif // _LIBCUDACXX_IS_CONSTANT_EVALUATED && !defined(__CUDA_ARCH__) + + return __binary_clz32(static_cast(__x), 0); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr int __libcpp_clz(unsigned long __x) { + static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); + return __libcpp_clz(static_cast(__x)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr int __libcpp_clz(unsigned long long __x) { +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(__CUDA_ARCH__) + if (!__libcpp_is_constant_evaluated()) { + unsigned long __where = 0; +# if defined(_LIBCUDACXX_HAS_BITSCAN64) + if (_BitScanReverse64(&__where, __x)) + return static_cast(63 - __where); +# else + // Win32 doesn't have _BitScanReverse64 so emulate it with two 32 bit calls. + if (_BitScanReverse(&__where, static_cast(__x >> 32))) + return static_cast(63 - (__where + 32)); + if (_BitScanReverse(&__where, static_cast(__x))) + return static_cast(63 - __where); +# endif + return 64; // Undefined Behavior. + } +#endif // _LIBCUDACXX_IS_CONSTANT_EVALUATED && !defined(__CUDA_ARCH__) + + return __binary_clz64(static_cast(__x)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr int __libcpp_popcount(unsigned __x) { + static_assert(sizeof(unsigned) == 4, ""); +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(__CUDA_ARCH__) + if (!__libcpp_is_constant_evaluated()) { + return static_cast(__popcnt(__x)); + } +#endif // _LIBCUDACXX_IS_CONSTANT_EVALUATED && !defined(__CUDA_ARCH__) + + return __fallback_popc64(static_cast(__x)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr int __libcpp_popcount(unsigned long __x) { + static_assert(sizeof(unsigned long) == 4, ""); +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(__CUDA_ARCH__) + if (!__libcpp_is_constant_evaluated()) { + return static_cast(__popcnt(__x)); + } +#endif // _LIBCUDACXX_IS_CONSTANT_EVALUATED && !defined(__CUDA_ARCH__) + + return __fallback_popc64(static_cast(__x)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr int __libcpp_popcount(unsigned long long __x) { + static_assert(sizeof(unsigned long long) == 8, ""); +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(__CUDA_ARCH__) + if (!__libcpp_is_constant_evaluated()) { + return static_cast(__popcnt64(__x)); + } +#endif // _LIBCUDACXX_IS_CONSTANT_EVALUATED && !defined(__CUDA_ARCH__ + + return __fallback_popc64(static_cast(__x)); +} + +#endif // _LIBCUDACXX_COMPILER_MSVC + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +_Tp __rotl(_Tp __t, unsigned int __cnt) noexcept +{ + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotl requires unsigned"); + using __nlt = numeric_limits<_Tp>; + + return ((__cnt % __nlt::digits) == 0) ? + __t : + (__t << (__cnt % __nlt::digits)) | (__t >> (__nlt::digits - (__cnt % __nlt::digits))); +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +_Tp __rotr(_Tp __t, unsigned int __cnt) noexcept +{ + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotr requires unsigned"); + using __nlt = numeric_limits<_Tp>; + + return ((__cnt % __nlt::digits) == 0) ? + __t : + (__t >> (__cnt % __nlt::digits)) | (__t << (__nlt::digits - (__cnt % __nlt::digits))); +} + +// Forward decl for recursive use in split word operations +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __countr_zero(_Tp __t) noexcept; + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t __countr_zero_dispatch(_Tp __t) noexcept +{ + return __libcpp_ctz(static_cast(__t)); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t __countr_zero_dispatch(_Tp __t) noexcept +{ + return __libcpp_ctz(static_cast(__t)); +} + +template +struct __countr_zero_rsh_impl { + static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR + int __short_circuit(_Tp __t, int __cur, int __count) { + // Stops processing early if non-zero + return (__cur == numeric_limits::digits) ? + __countr_zero_rsh_impl<_Tp, _St-1>::__count(__t, __cur + __count) : + __cur + __count; + } + + static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR + int __count(_Tp __t, int __count) { + return __short_circuit( + __t >> numeric_limits::digits, + __countr_zero(static_cast(__t)), + __count); + } +}; + +template +struct __countr_zero_rsh_impl<_Tp, 1> { + static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR + int __count(_Tp __t, int __count) { + return __count + __countr_zero(static_cast(__t)); + } +}; + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<(sizeof(_Tp) > sizeof(unsigned long long)), int> __countr_zero_dispatch(_Tp __t) noexcept +{ return __countr_zero_rsh_impl<_Tp>::__count(__t, 0); } + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __countr_zero(_Tp __t) noexcept +{ + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countr_zero requires unsigned"); + + return __t ? __countr_zero_dispatch(__t) : numeric_limits<_Tp>::digits; +} + +// Forward decl for recursive use in split word operations +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __countl_zero(_Tp __t) noexcept; + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t __countl_zero_dispatch(_Tp __t) noexcept +{ + return __libcpp_clz(static_cast(__t)) + - (numeric_limits::digits - numeric_limits<_Tp>::digits); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t __countl_zero_dispatch(_Tp __t) noexcept +{ + return __libcpp_clz(static_cast(__t)) + - (numeric_limits::digits - numeric_limits<_Tp>::digits); +} + +template +struct __countl_zero_rotl_impl { + static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR + int __short_circuit(_Tp __t, int __cur) { + // This stops processing early if the current word is not empty + return (__cur == numeric_limits::digits) ? + __cur + __countl_zero_rotl_impl<_Tp, _St-1>::__count(__t) : + __cur; + } + + static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR + int __countl_iter(_Tp __t) { + // After rotating pass result of clz to another step for processing + return __short_circuit( + __t, + __countl_zero(static_cast(__t))); + } + + static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR + int __count(_Tp __t) { + return __countl_iter( + __rotl(__t, numeric_limits::digits)); + } +}; + +template +struct __countl_zero_rotl_impl<_Tp, 1> { + static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR + int __count(_Tp __t) { + return __countl_zero(static_cast(__rotl(__t, numeric_limits::digits))); + } +}; + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<(sizeof(_Tp) > sizeof(unsigned long long)), int> __countl_zero_dispatch(_Tp __t) noexcept +{ return __countl_zero_rotl_impl<_Tp>::__count(__t); } + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __countl_zero(_Tp __t) noexcept +{ + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires unsigned"); + return __t ? __countl_zero_dispatch(__t) : numeric_limits<_Tp>::digits; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __countl_one(_Tp __t) noexcept +{ + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_one requires unsigned"); + return __t != numeric_limits<_Tp>::max() + ? __countl_zero(static_cast<_Tp>(~__t)) + : numeric_limits<_Tp>::digits; +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __countr_one(_Tp __t) noexcept +{ + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countr_one requires unsigned"); + return __t != numeric_limits<_Tp>::max() + ? __countr_zero(static_cast<_Tp>(~__t)) + : numeric_limits<_Tp>::digits; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t __popcount_dispatch(_Tp __t) noexcept +{ return __libcpp_popcount(static_cast(__t)); } + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t __popcount_dispatch(_Tp __t) noexcept +{ return __libcpp_popcount(static_cast(__t)); } + +template +struct __popcount_rsh_impl { + static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR + int __count(_Tp __t) { + return __popcount_rsh_impl<_Tp, _St-1>::__count( + __t >> numeric_limits::digits) + + __libcpp_popcount(static_cast(__t)); + } +}; + +template +struct __popcount_rsh_impl<_Tp, 1> { + static _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR + int __count(_Tp __t) { + return __libcpp_popcount(static_cast(__t)); + } +}; + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<(sizeof(_Tp) > sizeof(unsigned long long)), int> __popcount_dispatch(_Tp __t) noexcept +{ return __popcount_rsh_impl<_Tp>::__count(__t); } + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +int __popcount(_Tp __t) noexcept +{ + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__libcpp_popcount requires unsigned"); + + return __popcount_dispatch(__t); +} + + +// integral log base 2 +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +unsigned __bit_log2(_Tp __t) noexcept +{ + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__bit_log2 requires unsigned"); + return std::numeric_limits<_Tp>::digits - 1 - __countl_zero(__t); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +bool __has_single_bit(_Tp __t) noexcept +{ + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__has_single_bit requires unsigned"); + return __t != 0 && (((__t & (__t - 1)) == 0)); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t= sizeof(unsigned), _Tp> +__ceil2(_Tp __t) noexcept +{ + // const unsigned __n = numeric_limits<_Tp>::digits - countl_zero((_Tp)(__t - 1u)); + // _LIBCUDACXX_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to ceil2"); + return _Tp{1} << (numeric_limits<_Tp>::digits - __countl_zero((_Tp)(__t - 1u))); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t +__ceil2(_Tp __t) noexcept +{ + // const unsigned __n = numeric_limits<_Tp>::digits - countl_zero((_Tp)(__t - 1u)); + // _LIBCUDACXX_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to ceil2"); + + // const unsigned __extra = numeric_limits::digits - numeric_limits<_Tp>::digits; + // const unsigned __retVal = 1u << (__n + __extra); + return (_Tp) + ((1u << ((numeric_limits<_Tp>::digits - __countl_zero((_Tp)(__t - 1u))) + (numeric_limits::digits - numeric_limits<_Tp>::digits))) >> + (numeric_limits::digits - numeric_limits<_Tp>::digits)); +} + + +#if (_LIBCUDACXX_STD_VER > 17) || defined(__cuda_std__) + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp> +rotl(_Tp __t, unsigned int __cnt) noexcept +{ + return __rotl(__t, __cnt); +} + + +// rotr +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp> +rotr(_Tp __t, unsigned int __cnt) noexcept +{ + return __rotr(__t, __cnt); +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> +countl_zero(_Tp __t) noexcept +{ + return __countl_zero(__t); +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> +countl_one(_Tp __t) noexcept +{ + return __countl_one(__t); +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> +countr_zero(_Tp __t) noexcept +{ + return __countr_zero(__t); +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> +countr_one(_Tp __t) noexcept +{ + return __countr_one(__t); +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> +popcount(_Tp __t) noexcept +{ + return __popcount(__t); +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY constexpr +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, bool> +has_single_bit(_Tp __t) noexcept +{ + return __has_single_bit(__t); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp> +bit_floor(_Tp __t) noexcept +{ + return __t == 0 ? 0 : static_cast<_Tp>(_Tp{1} << __bit_log2(__t)); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp> +bit_ceil(_Tp __t) noexcept +{ + return (__t < 2) ? 1 : static_cast<_Tp>(__ceil2(__t)); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR +__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp> +bit_width(_Tp __t) noexcept +{ + return __t == 0 ? 0 : static_cast<_Tp>(__bit_log2(__t) + 1); +} + + +enum class endian +{ + little = 0xDEAD, + big = 0xFACE, +#if defined(_LIBCUDACXX_LITTLE_ENDIAN) + native = little +#elif defined(_LIBCUDACXX_BIG_ENDIAN) + native = big +#else + native = 0xCAFE +#endif +}; + +#endif // _LIBCUDACXX_STD_VER > 17 + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif // __cuda_std__ + +#endif // _LIBCUDACXX_BIT diff --git a/cuda_toolkit/include/bitset b/cuda_toolkit/include/bitset new file mode 100644 index 0000000000000000000000000000000000000000..c475bfb7d9f45c8addf7544d84a779ee4f16342c --- /dev/null +++ b/cuda_toolkit/include/bitset @@ -0,0 +1,1060 @@ +// -*- C++ -*- +//===---------------------------- bitset ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_BITSET +#define _LIBCUDACXX_BITSET + +/* + bitset synopsis + +namespace std +{ + +namespace std { + +template +class bitset +{ +public: + // bit reference: + class reference + { + friend class bitset; + reference() noexcept; + public: + ~reference() noexcept; + reference& operator=(bool x) noexcept; // for b[i] = x; + reference& operator=(const reference&) noexcept; // for b[i] = b[j]; + bool operator~() const noexcept; // flips the bit + operator bool() const noexcept; // for x = b[i]; + reference& flip() noexcept; // for b[i].flip(); + }; + + // 23.3.5.1 constructors: + constexpr bitset() noexcept; + constexpr bitset(unsigned long long val) noexcept; + template + explicit bitset(const charT* str, + typename basic_string::size_type n = basic_string::npos, + charT zero = charT('0'), charT one = charT('1')); + template + explicit bitset(const basic_string& str, + typename basic_string::size_type pos = 0, + typename basic_string::size_type n = + basic_string::npos, + charT zero = charT('0'), charT one = charT('1')); + + // 23.3.5.2 bitset operations: + bitset& operator&=(const bitset& rhs) noexcept; + bitset& operator|=(const bitset& rhs) noexcept; + bitset& operator^=(const bitset& rhs) noexcept; + bitset& operator<<=(size_t pos) noexcept; + bitset& operator>>=(size_t pos) noexcept; + bitset& set() noexcept; + bitset& set(size_t pos, bool val = true); + bitset& reset() noexcept; + bitset& reset(size_t pos); + bitset operator~() const noexcept; + bitset& flip() noexcept; + bitset& flip(size_t pos); + + // element access: + constexpr bool operator[](size_t pos) const; // for b[i]; + reference operator[](size_t pos); // for b[i]; + unsigned long to_ulong() const; + unsigned long long to_ullong() const; + template + basic_string to_string(charT zero = charT('0'), charT one = charT('1')) const; + template + basic_string > to_string(charT zero = charT('0'), charT one = charT('1')) const; + template + basic_string, allocator > to_string(charT zero = charT('0'), charT one = charT('1')) const; + basic_string, allocator > to_string(char zero = '0', char one = '1') const; + size_t count() const noexcept; + constexpr size_t size() const noexcept; + bool operator==(const bitset& rhs) const noexcept; + bool operator!=(const bitset& rhs) const noexcept; + bool test(size_t pos) const; + bool all() const noexcept; + bool any() const noexcept; + bool none() const noexcept; + bitset operator<<(size_t pos) const noexcept; + bitset operator>>(size_t pos) const noexcept; +}; + +// 23.3.5.3 bitset operators: +template +bitset operator&(const bitset&, const bitset&) noexcept; + +template +bitset operator|(const bitset&, const bitset&) noexcept; + +template +bitset operator^(const bitset&, const bitset&) noexcept; + +template +basic_istream& +operator>>(basic_istream& is, bitset& x); + +template +basic_ostream& +operator<<(basic_ostream& os, const bitset& x); + +template struct hash>; + +} // std + +*/ + +#include <__config> +#include <__bit_reference> +#include +#include +#include +#include +#include +#include <__functional_base> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template +class __bitset; + +template +struct __has_storage_type<__bitset<_N_words, _Size> > +{ + static const bool value = true; +}; + +template +class __bitset +{ +public: + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef size_type __storage_type; +protected: + typedef __bitset __self; + typedef __storage_type* __storage_pointer; + typedef const __storage_type* __const_storage_pointer; + static const unsigned __bits_per_word = static_cast(sizeof(__storage_type) * CHAR_BIT); + + friend class __bit_reference<__bitset>; + friend class __bit_const_reference<__bitset>; + friend class __bit_iterator<__bitset, false>; + friend class __bit_iterator<__bitset, true>; + friend struct __bit_array<__bitset>; + + __storage_type __first_[_N_words]; + + typedef __bit_reference<__bitset> reference; + typedef __bit_const_reference<__bitset> const_reference; + typedef __bit_iterator<__bitset, false> iterator; + typedef __bit_iterator<__bitset, true> const_iterator; + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr __bitset() noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr __bitset(unsigned long long __v) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY reference __make_ref(size_t __pos) noexcept + {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} + _LIBCUDACXX_INLINE_VISIBILITY constexpr const_reference __make_ref(size_t __pos) const noexcept + {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} + _LIBCUDACXX_INLINE_VISIBILITY iterator __make_iter(size_t __pos) noexcept + {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} + _LIBCUDACXX_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const noexcept + {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} + + _LIBCUDACXX_INLINE_VISIBILITY + void operator&=(const __bitset& __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + void operator|=(const __bitset& __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + void operator^=(const __bitset& __v) noexcept; + + void flip() noexcept; + _LIBCUDACXX_INLINE_VISIBILITY unsigned long to_ulong() const + {return to_ulong(integral_constant());} + _LIBCUDACXX_INLINE_VISIBILITY unsigned long long to_ullong() const + {return to_ullong(integral_constant());} + + bool all() const noexcept; + bool any() const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + size_t __hash_code() const noexcept; +private: + unsigned long to_ulong(false_type) const; + _LIBCUDACXX_INLINE_VISIBILITY + unsigned long to_ulong(true_type) const; + unsigned long long to_ullong(false_type) const; + _LIBCUDACXX_INLINE_VISIBILITY + unsigned long long to_ullong(true_type) const; + _LIBCUDACXX_INLINE_VISIBILITY + unsigned long long to_ullong(true_type, false_type) const; + unsigned long long to_ullong(true_type, true_type) const; +}; + +template +inline constexpr +__bitset<_N_words, _Size>::__bitset() noexcept + : __first_{0} +{} + +template +inline +constexpr +__bitset<_N_words, _Size>::__bitset(unsigned long long __v) noexcept +#if __SIZEOF_SIZE_T__ == 8 + : __first_{__v} +#elif __SIZEOF_SIZE_T__ == 4 + : __first_{static_cast<__storage_type>(__v), + _Size >= 2 * __bits_per_word ? static_cast<__storage_type>(__v >> __bits_per_word) + : static_cast<__storage_type>((__v >> __bits_per_word) & (__storage_type(1) << (_Size - __bits_per_word)) - 1)} +#else +#error This constructor has not been ported to this platform +#endif +{} + +template +inline +void +__bitset<_N_words, _Size>::operator&=(const __bitset& __v) noexcept +{ + for (size_type __i = 0; __i < _N_words; ++__i) + __first_[__i] &= __v.__first_[__i]; +} + +template +inline +void +__bitset<_N_words, _Size>::operator|=(const __bitset& __v) noexcept +{ + for (size_type __i = 0; __i < _N_words; ++__i) + __first_[__i] |= __v.__first_[__i]; +} + +template +inline +void +__bitset<_N_words, _Size>::operator^=(const __bitset& __v) noexcept +{ + for (size_type __i = 0; __i < _N_words; ++__i) + __first_[__i] ^= __v.__first_[__i]; +} + +template +void +__bitset<_N_words, _Size>::flip() noexcept +{ + // do middle whole words + size_type __n = _Size; + __storage_pointer __p = __first_; + for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) + *__p = ~*__p; + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = *__p & __m; + *__p &= ~__m; + *__p |= ~__b & __m; + } +} + +template +unsigned long +__bitset<_N_words, _Size>::to_ulong(false_type) const +{ + const_iterator __e = __make_iter(_Size); + const_iterator __i = _CUDA_VSTD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true); + if (__i != __e) + __throw_overflow_error("bitset to_ulong overflow error"); + + return __first_[0]; +} + +template +inline +unsigned long +__bitset<_N_words, _Size>::to_ulong(true_type) const +{ + return __first_[0]; +} + +template +unsigned long long +__bitset<_N_words, _Size>::to_ullong(false_type) const +{ + const_iterator __e = __make_iter(_Size); + const_iterator __i = _CUDA_VSTD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true); + if (__i != __e) + __throw_overflow_error("bitset to_ullong overflow error"); + + return to_ullong(true_type()); +} + +template +inline +unsigned long long +__bitset<_N_words, _Size>::to_ullong(true_type) const +{ + return to_ullong(true_type(), integral_constant()); +} + +template +inline +unsigned long long +__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const +{ + return __first_[0]; +} + +template +unsigned long long +__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const +{ + unsigned long long __r = __first_[0]; + for (std::size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i) + __r |= static_cast(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT); + return __r; +} + +template +bool +__bitset<_N_words, _Size>::all() const noexcept +{ + // do middle whole words + size_type __n = _Size; + __const_storage_pointer __p = __first_; + for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) + if (~*__p) + return false; + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + if (~*__p & __m) + return false; + } + return true; +} + +template +bool +__bitset<_N_words, _Size>::any() const noexcept +{ + // do middle whole words + size_type __n = _Size; + __const_storage_pointer __p = __first_; + for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) + if (*__p) + return true; + // do last partial word + if (__n > 0) + { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + if (*__p & __m) + return true; + } + return false; +} + +template +inline +size_t +__bitset<_N_words, _Size>::__hash_code() const noexcept +{ + size_t __h = 0; + for (size_type __i = 0; __i < _N_words; ++__i) + __h ^= __first_[__i]; + return __h; +} + +template +class __bitset<1, _Size> +{ +public: + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef size_type __storage_type; +protected: + typedef __bitset __self; + typedef __storage_type* __storage_pointer; + typedef const __storage_type* __const_storage_pointer; + static const unsigned __bits_per_word = static_cast(sizeof(__storage_type) * CHAR_BIT); + + friend class __bit_reference<__bitset>; + friend class __bit_const_reference<__bitset>; + friend class __bit_iterator<__bitset, false>; + friend class __bit_iterator<__bitset, true>; + friend struct __bit_array<__bitset>; + + __storage_type __first_; + + typedef __bit_reference<__bitset> reference; + typedef __bit_const_reference<__bitset> const_reference; + typedef __bit_iterator<__bitset, false> iterator; + typedef __bit_iterator<__bitset, true> const_iterator; + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr __bitset() noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr __bitset(unsigned long long __v) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY reference __make_ref(size_t __pos) noexcept + {return reference(&__first_, __storage_type(1) << __pos);} + _LIBCUDACXX_INLINE_VISIBILITY constexpr const_reference __make_ref(size_t __pos) const noexcept + {return const_reference(&__first_, __storage_type(1) << __pos);} + _LIBCUDACXX_INLINE_VISIBILITY iterator __make_iter(size_t __pos) noexcept + {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} + _LIBCUDACXX_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const noexcept + {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} + + _LIBCUDACXX_INLINE_VISIBILITY + void operator&=(const __bitset& __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + void operator|=(const __bitset& __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + void operator^=(const __bitset& __v) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + void flip() noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + unsigned long to_ulong() const; + _LIBCUDACXX_INLINE_VISIBILITY + unsigned long long to_ullong() const; + + _LIBCUDACXX_INLINE_VISIBILITY + bool all() const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + bool any() const noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + size_t __hash_code() const noexcept; +}; + +template +inline constexpr +__bitset<1, _Size>::__bitset() noexcept + : __first_(0) +{ +} + +template +inline constexpr +__bitset<1, _Size>::__bitset(unsigned long long __v) noexcept + : __first_( + _Size == __bits_per_word ? static_cast<__storage_type>(__v) + : static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1) + ) +{ +} + +template +inline +void +__bitset<1, _Size>::operator&=(const __bitset& __v) noexcept +{ + __first_ &= __v.__first_; +} + +template +inline +void +__bitset<1, _Size>::operator|=(const __bitset& __v) noexcept +{ + __first_ |= __v.__first_; +} + +template +inline +void +__bitset<1, _Size>::operator^=(const __bitset& __v) noexcept +{ + __first_ ^= __v.__first_; +} + +template +inline +void +__bitset<1, _Size>::flip() noexcept +{ + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); + __first_ = ~__first_; + __first_ &= __m; +} + +template +inline +unsigned long +__bitset<1, _Size>::to_ulong() const +{ + return __first_; +} + +template +inline +unsigned long long +__bitset<1, _Size>::to_ullong() const +{ + return __first_; +} + +template +inline +bool +__bitset<1, _Size>::all() const noexcept +{ + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); + return !(~__first_ & __m); +} + +template +inline +bool +__bitset<1, _Size>::any() const noexcept +{ + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); + return __first_ & __m; +} + +template +inline +size_t +__bitset<1, _Size>::__hash_code() const noexcept +{ + return __first_; +} + +template <> +class __bitset<0, 0> +{ +public: + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef size_type __storage_type; +protected: + typedef __bitset __self; + typedef __storage_type* __storage_pointer; + typedef const __storage_type* __const_storage_pointer; + static const unsigned __bits_per_word = static_cast(sizeof(__storage_type) * CHAR_BIT); + + friend class __bit_reference<__bitset>; + friend class __bit_const_reference<__bitset>; + friend class __bit_iterator<__bitset, false>; + friend class __bit_iterator<__bitset, true>; + friend struct __bit_array<__bitset>; + + typedef __bit_reference<__bitset> reference; + typedef __bit_const_reference<__bitset> const_reference; + typedef __bit_iterator<__bitset, false> iterator; + typedef __bit_iterator<__bitset, true> const_iterator; + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr __bitset() noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr __bitset(unsigned long long) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY reference __make_ref(size_t) noexcept + {return reference(0, 1);} + _LIBCUDACXX_INLINE_VISIBILITY constexpr const_reference __make_ref(size_t) const noexcept + {return const_reference(0, 1);} + _LIBCUDACXX_INLINE_VISIBILITY iterator __make_iter(size_t) noexcept + {return iterator(0, 0);} + _LIBCUDACXX_INLINE_VISIBILITY const_iterator __make_iter(size_t) const noexcept + {return const_iterator(0, 0);} + + _LIBCUDACXX_INLINE_VISIBILITY void operator&=(const __bitset&) noexcept {} + _LIBCUDACXX_INLINE_VISIBILITY void operator|=(const __bitset&) noexcept {} + _LIBCUDACXX_INLINE_VISIBILITY void operator^=(const __bitset&) noexcept {} + + _LIBCUDACXX_INLINE_VISIBILITY void flip() noexcept {} + + _LIBCUDACXX_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;} + _LIBCUDACXX_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;} + + _LIBCUDACXX_INLINE_VISIBILITY bool all() const noexcept {return true;} + _LIBCUDACXX_INLINE_VISIBILITY bool any() const noexcept {return false;} + + _LIBCUDACXX_INLINE_VISIBILITY size_t __hash_code() const noexcept {return 0;} +}; + +inline +constexpr +__bitset<0, 0>::__bitset() noexcept +{ +} + +inline +constexpr +__bitset<0, 0>::__bitset(unsigned long long) noexcept +{ +} + +template class _LIBCUDACXX_TEMPLATE_VIS bitset; +template struct hash >; + +template +class _LIBCUDACXX_TEMPLATE_VIS bitset + : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size> +{ +public: + static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1; + typedef __bitset<__n_words, _Size> base; + +public: + typedef typename base::reference reference; + typedef typename base::const_reference const_reference; + + // 23.3.5.1 constructors: + _LIBCUDACXX_INLINE_VISIBILITY constexpr bitset() noexcept {} + _LIBCUDACXX_INLINE_VISIBILITY constexpr + bitset(unsigned long long __v) noexcept : base(__v) {} + template::value> > + explicit bitset(const _CharT* __str, + typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos, + _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); + template + explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, + typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0, + typename basic_string<_CharT,_Traits,_Allocator>::size_type __n = + (basic_string<_CharT,_Traits,_Allocator>::npos), + _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); + + // 23.3.5.2 bitset operations: + _LIBCUDACXX_INLINE_VISIBILITY + bitset& operator&=(const bitset& __rhs) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + bitset& operator|=(const bitset& __rhs) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + bitset& operator^=(const bitset& __rhs) noexcept; + bitset& operator<<=(size_t __pos) noexcept; + bitset& operator>>=(size_t __pos) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + bitset& set() noexcept; + bitset& set(size_t __pos, bool __val = true); + _LIBCUDACXX_INLINE_VISIBILITY + bitset& reset() noexcept; + bitset& reset(size_t __pos); + _LIBCUDACXX_INLINE_VISIBILITY + bitset operator~() const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + bitset& flip() noexcept; + bitset& flip(size_t __pos); + + // element access: + _LIBCUDACXX_INLINE_VISIBILITY constexpr + const_reference operator[](size_t __p) const {return base::__make_ref(__p);} + _LIBCUDACXX_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);} + _LIBCUDACXX_INLINE_VISIBILITY + unsigned long to_ulong() const; + _LIBCUDACXX_INLINE_VISIBILITY + unsigned long long to_ullong() const; + template + basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'), + _CharT __one = _CharT('1')) const; + template + _LIBCUDACXX_INLINE_VISIBILITY + basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), + _CharT __one = _CharT('1')) const; + template + _LIBCUDACXX_INLINE_VISIBILITY + basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), + _CharT __one = _CharT('1')) const; + _LIBCUDACXX_INLINE_VISIBILITY + basic_string, allocator > to_string(char __zero = '0', + char __one = '1') const; + _LIBCUDACXX_INLINE_VISIBILITY + size_t count() const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY constexpr size_t size() const noexcept {return _Size;} + _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const bitset& __rhs) const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const bitset& __rhs) const noexcept; + bool test(size_t __pos) const; + _LIBCUDACXX_INLINE_VISIBILITY + bool all() const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + bool any() const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY bool none() const noexcept {return !any();} + _LIBCUDACXX_INLINE_VISIBILITY + bitset operator<<(size_t __pos) const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + bitset operator>>(size_t __pos) const noexcept; + +private: + + _LIBCUDACXX_INLINE_VISIBILITY + size_t __hash_code() const noexcept {return base::__hash_code();} + + friend struct hash; +}; + +template +template +bitset<_Size>::bitset(const _CharT* __str, + typename basic_string<_CharT>::size_type __n, + _CharT __zero, _CharT __one) +{ + size_t __rlen = _CUDA_VSTD::min(__n, char_traits<_CharT>::length(__str)); + for (size_t __i = 0; __i < __rlen; ++__i) + if (__str[__i] != __zero && __str[__i] != __one) + __throw_invalid_argument("bitset string ctor has invalid argument"); + + size_t _Mp = _CUDA_VSTD::min(__rlen, _Size); + size_t __i = 0; + for (; __i < _Mp; ++__i) + { + _CharT __c = __str[_Mp - 1 - __i]; + if (__c == __zero) + (*this)[__i] = false; + else + (*this)[__i] = true; + } + _CUDA_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false); +} + +template +template +bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, + typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos, + typename basic_string<_CharT,_Traits,_Allocator>::size_type __n, + _CharT __zero, _CharT __one) +{ + if (__pos > __str.size()) + __throw_out_of_range("bitset string pos out of range"); + + size_t __rlen = _CUDA_VSTD::min(__n, __str.size() - __pos); + for (size_t __i = __pos; __i < __pos + __rlen; ++__i) + if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one)) + __throw_invalid_argument("bitset string ctor has invalid argument"); + + size_t _Mp = _CUDA_VSTD::min(__rlen, _Size); + size_t __i = 0; + for (; __i < _Mp; ++__i) + { + _CharT __c = __str[__pos + _Mp - 1 - __i]; + if (_Traits::eq(__c, __zero)) + (*this)[__i] = false; + else + (*this)[__i] = true; + } + _CUDA_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false); +} + +template +inline +bitset<_Size>& +bitset<_Size>::operator&=(const bitset& __rhs) noexcept +{ + base::operator&=(__rhs); + return *this; +} + +template +inline +bitset<_Size>& +bitset<_Size>::operator|=(const bitset& __rhs) noexcept +{ + base::operator|=(__rhs); + return *this; +} + +template +inline +bitset<_Size>& +bitset<_Size>::operator^=(const bitset& __rhs) noexcept +{ + base::operator^=(__rhs); + return *this; +} + +template +bitset<_Size>& +bitset<_Size>::operator<<=(size_t __pos) noexcept +{ + __pos = _CUDA_VSTD::min(__pos, _Size); + _CUDA_VSTD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size)); + _CUDA_VSTD::fill_n(base::__make_iter(0), __pos, false); + return *this; +} + +template +bitset<_Size>& +bitset<_Size>::operator>>=(size_t __pos) noexcept +{ + __pos = _CUDA_VSTD::min(__pos, _Size); + _CUDA_VSTD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0)); + _CUDA_VSTD::fill_n(base::__make_iter(_Size - __pos), __pos, false); + return *this; +} + +template +inline +bitset<_Size>& +bitset<_Size>::set() noexcept +{ + _CUDA_VSTD::fill_n(base::__make_iter(0), _Size, true); + return *this; +} + +template +bitset<_Size>& +bitset<_Size>::set(size_t __pos, bool __val) +{ + if (__pos >= _Size) + __throw_out_of_range("bitset set argument out of range"); + + (*this)[__pos] = __val; + return *this; +} + +template +inline +bitset<_Size>& +bitset<_Size>::reset() noexcept +{ + _CUDA_VSTD::fill_n(base::__make_iter(0), _Size, false); + return *this; +} + +template +bitset<_Size>& +bitset<_Size>::reset(size_t __pos) +{ + if (__pos >= _Size) + __throw_out_of_range("bitset reset argument out of range"); + + (*this)[__pos] = false; + return *this; +} + +template +inline +bitset<_Size> +bitset<_Size>::operator~() const noexcept +{ + bitset __x(*this); + __x.flip(); + return __x; +} + +template +inline +bitset<_Size>& +bitset<_Size>::flip() noexcept +{ + base::flip(); + return *this; +} + +template +bitset<_Size>& +bitset<_Size>::flip(size_t __pos) +{ + if (__pos >= _Size) + __throw_out_of_range("bitset flip argument out of range"); + + reference r = base::__make_ref(__pos); + r = ~r; + return *this; +} + +template +inline +unsigned long +bitset<_Size>::to_ulong() const +{ + return base::to_ulong(); +} + +template +inline +unsigned long long +bitset<_Size>::to_ullong() const +{ + return base::to_ullong(); +} + +template +template +basic_string<_CharT, _Traits, _Allocator> +bitset<_Size>::to_string(_CharT __zero, _CharT __one) const +{ + basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero); + for (size_t __i = 0; __i < _Size; ++__i) + { + if ((*this)[__i]) + __r[_Size - 1 - __i] = __one; + } + return __r; +} + +template +template +inline +basic_string<_CharT, _Traits, allocator<_CharT> > +bitset<_Size>::to_string(_CharT __zero, _CharT __one) const +{ + return to_string<_CharT, _Traits, allocator<_CharT> >(__zero, __one); +} + +template +template +inline +basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > +bitset<_Size>::to_string(_CharT __zero, _CharT __one) const +{ + return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(__zero, __one); +} + +template +inline +basic_string, allocator > +bitset<_Size>::to_string(char __zero, char __one) const +{ + return to_string, allocator >(__zero, __one); +} + +template +inline +size_t +bitset<_Size>::count() const noexcept +{ + return static_cast(__count_bool_true(base::__make_iter(0), _Size)); +} + +template +inline +bool +bitset<_Size>::operator==(const bitset& __rhs) const noexcept +{ + return _CUDA_VSTD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0)); +} + +template +inline +bool +bitset<_Size>::operator!=(const bitset& __rhs) const noexcept +{ + return !(*this == __rhs); +} + +template +bool +bitset<_Size>::test(size_t __pos) const +{ + if (__pos >= _Size) + __throw_out_of_range("bitset test argument out of range"); + + return (*this)[__pos]; +} + +template +inline +bool +bitset<_Size>::all() const noexcept +{ + return base::all(); +} + +template +inline +bool +bitset<_Size>::any() const noexcept +{ + return base::any(); +} + +template +inline +bitset<_Size> +bitset<_Size>::operator<<(size_t __pos) const noexcept +{ + bitset __r = *this; + __r <<= __pos; + return __r; +} + +template +inline +bitset<_Size> +bitset<_Size>::operator>>(size_t __pos) const noexcept +{ + bitset __r = *this; + __r >>= __pos; + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bitset<_Size> +operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) noexcept +{ + bitset<_Size> __r = __x; + __r &= __y; + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bitset<_Size> +operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) noexcept +{ + bitset<_Size> __r = __x; + __r |= __y; + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bitset<_Size> +operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) noexcept +{ + bitset<_Size> __r = __x; + __r ^= __y; + return __r; +} + +template +struct _LIBCUDACXX_TEMPLATE_VIS hash > + : public __unary_function, size_t> +{ + _LIBCUDACXX_INLINE_VISIBILITY + size_t operator()(const bitset<_Size>& __bs) const noexcept + {return __bs.__hash_code();} +}; + +template +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x); + +template +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x); + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX_BITSET diff --git a/cuda_toolkit/include/builtin_types.h b/cuda_toolkit/include/builtin_types.h new file mode 100644 index 0000000000000000000000000000000000000000..c32d1a1ae05dec10410e129295ba95e52af918c5 --- /dev/null +++ b/cuda_toolkit/include/builtin_types.h @@ -0,0 +1,64 @@ +/* + * Copyright 1993-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#include "device_types.h" +#if !defined(__CUDACC_RTC__) +#define EXCLUDE_FROM_RTC +#include "driver_types.h" +#undef EXCLUDE_FROM_RTC +#endif /* !__CUDACC_RTC__ */ +#include "surface_types.h" +#include "texture_types.h" +#include "vector_types.h" diff --git a/cuda_toolkit/include/cassert b/cuda_toolkit/include/cassert new file mode 100644 index 0000000000000000000000000000000000000000..c53166525a29787bebdb37b93ff1953217c21ac9 --- /dev/null +++ b/cuda_toolkit/include/cassert @@ -0,0 +1,32 @@ +// -*- C++ -*- +//===-------------------------- cassert -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +/* + cassert synopsis + +Macros: + + assert + +*/ + +#ifndef __cuda_std__ +#include <__config> +#include <__pragma_push> +#include +#include <__pragma_pop> + +#else + +#ifndef _LIBCUDACXX_COMPILER_NVRTC +#include +#include +#endif //_LIBCUDACXX_COMPILER_NVRTC + +#endif // __cuda_std__ diff --git a/cuda_toolkit/include/ccomplex b/cuda_toolkit/include/ccomplex new file mode 100644 index 0000000000000000000000000000000000000000..fca1dcf1edb54fedce3c6adf21348381c9f744d6 --- /dev/null +++ b/cuda_toolkit/include/ccomplex @@ -0,0 +1,32 @@ +// -*- C++ -*- +//===--------------------------- ccomplex ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CCOMPLEX +#define _LIBCUDACXX_CCOMPLEX + +/* + ccomplex synopsis + +#include + +*/ + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// hh 080623 Created + +#endif // _LIBCUDACXX_CCOMPLEX diff --git a/cuda_toolkit/include/cctype b/cuda_toolkit/include/cctype new file mode 100644 index 0000000000000000000000000000000000000000..9c5d4ed617fea8563fcc28a7cb99eccf0439af8c --- /dev/null +++ b/cuda_toolkit/include/cctype @@ -0,0 +1,124 @@ +// -*- C++ -*- +//===---------------------------- cctype ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CCTYPE +#define _LIBCUDACXX_CCTYPE + +/* + cctype synopsis + +namespace std +{ + +int isalnum(int c); +int isalpha(int c); +int isblank(int c); // C99 +int iscntrl(int c); +int isdigit(int c); +int isgraph(int c); +int islower(int c); +int isprint(int c); +int ispunct(int c); +int isspace(int c); +int isupper(int c); +int isxdigit(int c); +int tolower(int c); +int toupper(int c); + +} // std +*/ + +#include <__config> +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#ifdef isalnum +#undef isalnum +#endif + +#ifdef isalpha +#undef isalpha +#endif + +#ifdef isblank +#undef isblank +#endif + +#ifdef iscntrl +#undef iscntrl +#endif + +#ifdef isdigit +#undef isdigit +#endif + +#ifdef isgraph +#undef isgraph +#endif + +#ifdef islower +#undef islower +#endif + +#ifdef isprint +#undef isprint +#endif + +#ifdef ispunct +#undef ispunct +#endif + +#ifdef isspace +#undef isspace +#endif + +#ifdef isupper +#undef isupper +#endif + +#ifdef isxdigit +#undef isxdigit +#endif + +#ifdef tolower +#undef tolower +#endif + +#ifdef toupper +#undef toupper +#endif + + +using ::isalnum; +using ::isalpha; +using ::isblank; +using ::iscntrl; +using ::isdigit; +using ::isgraph; +using ::islower; +using ::isprint; +using ::ispunct; +using ::isspace; +using ::isupper; +using ::isxdigit; +using ::tolower; +using ::toupper; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_CCTYPE diff --git a/cuda_toolkit/include/cerrno b/cuda_toolkit/include/cerrno new file mode 100644 index 0000000000000000000000000000000000000000..1345525a81a91225aff5eb72b5aea1181fa01cb6 --- /dev/null +++ b/cuda_toolkit/include/cerrno @@ -0,0 +1,36 @@ +// -*- C++ -*- +//===-------------------------- cerrno ------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CERRNO +#define _LIBCUDACXX_CERRNO + +/* + cerrno synopsis + +Macros: + + EDOM + EILSEQ // C99 + ERANGE + errno + +*/ + +#include <__config> +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#endif // _LIBCUDACXX_CERRNO diff --git a/cuda_toolkit/include/cfenv b/cuda_toolkit/include/cfenv new file mode 100644 index 0000000000000000000000000000000000000000..ee1c97ea4f9529018a8d13260d4ef338c9800e6a --- /dev/null +++ b/cuda_toolkit/include/cfenv @@ -0,0 +1,85 @@ +// -*- C++ -*- +//===---------------------------- cfenv -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CFENV +#define _LIBCUDACXX_CFENV + +/* + cfenv synopsis + +This entire header is C99 / C++0X + +Macros: + + FE_DIVBYZERO + FE_INEXACT + FE_INVALID + FE_OVERFLOW + FE_UNDERFLOW + FE_ALL_EXCEPT + FE_DOWNWARD + FE_TONEAREST + FE_TOWARDZERO + FE_UPWARD + FE_DFL_ENV + +namespace std +{ + +Types: + + fenv_t + fexcept_t + +int feclearexcept(int excepts); +int fegetexceptflag(fexcept_t* flagp, int excepts); +int feraiseexcept(int excepts); +int fesetexceptflag(const fexcept_t* flagp, int excepts); +int fetestexcept(int excepts); +int fegetround(); +int fesetround(int round); +int fegetenv(fenv_t* envp); +int feholdexcept(fenv_t* envp); +int fesetenv(const fenv_t* envp); +int feupdateenv(const fenv_t* envp); + +} // std +*/ + +#include <__config> +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::fenv_t; +using ::fexcept_t; + +using ::feclearexcept; +using ::fegetexceptflag; +using ::feraiseexcept; +using ::fesetexceptflag; +using ::fetestexcept; +using ::fegetround; +using ::fesetround; +using ::fegetenv; +using ::feholdexcept; +using ::fesetenv; +using ::feupdateenv; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_CFENV diff --git a/cuda_toolkit/include/cfloat b/cuda_toolkit/include/cfloat new file mode 100644 index 0000000000000000000000000000000000000000..d27eef3616beb6c607ff3ffa807869b1d6d32c5d --- /dev/null +++ b/cuda_toolkit/include/cfloat @@ -0,0 +1,84 @@ +// -*- C++ -*- +//===--------------------------- cfloat -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CFLOAT +#define _LIBCUDACXX_CFLOAT + +/* + cfloat synopsis + +Macros: + + FLT_ROUNDS + FLT_EVAL_METHOD // C99 + FLT_RADIX + + FLT_HAS_SUBNORM // C11 + DBL_HAS_SUBNORM // C11 + LDBL_HAS_SUBNORM // C11 + + FLT_MANT_DIG + DBL_MANT_DIG + LDBL_MANT_DIG + + DECIMAL_DIG // C99 + FLT_DECIMAL_DIG // C11 + DBL_DECIMAL_DIG // C11 + LDBL_DECIMAL_DIG // C11 + + FLT_DIG + DBL_DIG + LDBL_DIG + + FLT_MIN_EXP + DBL_MIN_EXP + LDBL_MIN_EXP + + FLT_MIN_10_EXP + DBL_MIN_10_EXP + LDBL_MIN_10_EXP + + FLT_MAX_EXP + DBL_MAX_EXP + LDBL_MAX_EXP + + FLT_MAX_10_EXP + DBL_MAX_10_EXP + LDBL_MAX_10_EXP + + FLT_MAX + DBL_MAX + LDBL_MAX + + FLT_EPSILON + DBL_EPSILON + LDBL_EPSILON + + FLT_MIN + DBL_MIN + LDBL_MIN + + FLT_TRUE_MIN // C11 + DBL_TRUE_MIN // C11 + LDBL_TRUE_MIN // C11 +*/ + +#ifndef __cuda_std__ +#include <__config> +#include <__pragma_push> +#include +#include <__pragma_pop> +#else +#ifndef _LIBCUDACXX_COMPILER_NVRTC +#include +#include +#endif // _LIBCUDACXX_COMPILER_NVRTC +#endif // !__cuda_std__ + +#endif // _LIBCUDACXX_CFLOAT diff --git a/cuda_toolkit/include/channel_descriptor.h b/cuda_toolkit/include/channel_descriptor.h new file mode 100644 index 0000000000000000000000000000000000000000..fbd685b64e6b36739b8adec26c5c73bafe38dc9f --- /dev/null +++ b/cuda_toolkit/include/channel_descriptor.h @@ -0,0 +1,588 @@ +/* + * Copyright 1993-2012 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CHANNEL_DESCRIPTOR_H__) +#define __CHANNEL_DESCRIPTOR_H__ + +#if defined(__cplusplus) + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#include "cuda_runtime_api.h" + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +/** + * \addtogroup CUDART_HIGHLEVEL + * + * @{ + */ + +/** + * \brief \hl Returns a channel descriptor using the specified format + * + * Returns a channel descriptor with format \p f and number of bits of each + * component \p x, \p y, \p z, and \p w. The ::cudaChannelFormatDesc is + * defined as: + * \code + struct cudaChannelFormatDesc { + int x, y, z, w; + enum cudaChannelFormatKind f; + }; + * \endcode + * + * where ::cudaChannelFormatKind is one of ::cudaChannelFormatKindSigned, + * ::cudaChannelFormatKindUnsigned, cudaChannelFormatKindFloat, + * ::cudaChannelFormatKindSignedNormalized8X1, ::cudaChannelFormatKindSignedNormalized8X2, + * ::cudaChannelFormatKindSignedNormalized8X4, + * ::cudaChannelFormatKindUnsignedNormalized8X1, ::cudaChannelFormatKindUnsignedNormalized8X2, + * ::cudaChannelFormatKindUnsignedNormalized8X4, + * ::cudaChannelFormatKindSignedNormalized16X1, ::cudaChannelFormatKindSignedNormalized16X2, + * ::cudaChannelFormatKindSignedNormalized16X4, + * ::cudaChannelFormatKindUnsignedNormalized16X1, ::cudaChannelFormatKindUnsignedNormalized16X2, + * ::cudaChannelFormatKindUnsignedNormalized16X4 + * or ::cudaChannelFormatKindNV12. + * + * The format is specified by the template specialization. + * + * The template function specializes for the following scalar types: + * char, signed char, unsigned char, short, unsigned short, int, unsigned int, long, unsigned long, and float. + * The template function specializes for the following vector types: + * char{1|2|4}, uchar{1|2|4}, short{1|2|4}, ushort{1|2|4}, int{1|2|4}, uint{1|2|4}, long{1|2|4}, ulong{1|2|4}, float{1|2|4}. + * The template function specializes for following cudaChannelFormatKind enum values: + * ::cudaChannelFormatKind{Uns|S}ignedNormalized{8|16}X{1|2|4}, and ::cudaChannelFormatKindNV12. + * + * Invoking the function on a type without a specialization defaults to creating a channel format of kind ::cudaChannelFormatKindNone + * + * \return + * Channel descriptor with format \p f + * + * \sa \ref ::cudaCreateChannelDesc(int,int,int,int,cudaChannelFormatKind) "cudaCreateChannelDesc (Low level)", + * ::cudaGetChannelDesc, + */ +template __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(0, 0, 0, 0, cudaChannelFormatKindNone); +} + +static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf(void) +{ + int e = (int)sizeof(unsigned short) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat); +} + +static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf1(void) +{ + int e = (int)sizeof(unsigned short) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat); +} + +static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf2(void) +{ + int e = (int)sizeof(unsigned short) * 8; + + return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindFloat); +} + +static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf4(void) +{ + int e = (int)sizeof(unsigned short) * 8; + + return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindFloat); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(char) * 8; + +#if defined(_CHAR_UNSIGNED) || defined(__CHAR_UNSIGNED__) + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned); +#else /* _CHAR_UNSIGNED || __CHAR_UNSIGNED__ */ + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned); +#endif /* _CHAR_UNSIGNED || __CHAR_UNSIGNED__ */ +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(signed char) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned char) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(signed char) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned char) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(signed char) * 8; + + return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned char) * 8; + + return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(signed char) * 8; + + return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned char) * 8; + + return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(short) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned short) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(short) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned short) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(short) * 8; + + return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned short) * 8; + + return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(short) * 8; + + return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned short) * 8; + + return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(int) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned int) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(int) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned int) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(int) * 8; + + return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned int) * 8; + + return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(int) * 8; + + return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned int) * 8; + + return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned); +} + +#if !defined(__LP64__) + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(long) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned long) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(long) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned long) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(long) * 8; + + return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned long) * 8; + + return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(long) * 8; + + return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(unsigned long) * 8; + + return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned); +} + +#endif /* !__LP64__ */ + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(float) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(float) * 8; + + return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(float) * 8; + + return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindFloat); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + int e = (int)sizeof(float) * 8; + + return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindFloat); +} + +static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescNV12(void) +{ + int e = (int)sizeof(char) * 8; + + return cudaCreateChannelDesc(e, e, e, 0, cudaChannelFormatKindNV12); +} + +template __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(0, 0, 0, 0, cudaChannelFormatKindNone); +} + +/* Signed 8-bit normalized integer formats */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindSignedNormalized8X1); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindSignedNormalized8X2); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindSignedNormalized8X4); +} + +/* Unsigned 8-bit normalized integer formats */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindUnsignedNormalized8X1); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindUnsignedNormalized8X2); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedNormalized8X4); +} + +/* Signed 16-bit normalized integer formats */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(16, 0, 0, 0, cudaChannelFormatKindSignedNormalized16X1); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(16, 16, 0, 0, cudaChannelFormatKindSignedNormalized16X2); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(16, 16, 16, 16, cudaChannelFormatKindSignedNormalized16X4); +} + +/* Unsigned 16-bit normalized integer formats */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(16, 0, 0, 0, cudaChannelFormatKindUnsignedNormalized16X1); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(16, 16, 0, 0, cudaChannelFormatKindUnsignedNormalized16X2); +} + +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(16, 16, 16, 16, cudaChannelFormatKindUnsignedNormalized16X4); +} + +/* NV12 format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 0, cudaChannelFormatKindNV12); +} + +/* BC1 format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed1); +} + +/* BC1sRGB format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed1SRGB); +} + +/* BC2 format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed2); +} + +/* BC2sRGB format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed2SRGB); +} + +/* BC3 format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed3); +} + +/* BC3sRGB format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed3SRGB); +} + +/* BC4 unsigned format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindUnsignedBlockCompressed4); +} + +/* BC4 signed format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindSignedBlockCompressed4); +} + +/* BC5 unsigned format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindUnsignedBlockCompressed5); +} + +/* BC5 signed format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindSignedBlockCompressed5); +} + +/* BC6H unsigned format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(16, 16, 16, 0, cudaChannelFormatKindUnsignedBlockCompressed6H); +} + +/* BC6H signed format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(16, 16, 16, 0, cudaChannelFormatKindSignedBlockCompressed6H); +} + +/* BC7 format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed7); +} + +/* BC7sRGB format */ +template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void) +{ + return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed7SRGB); +} + +#endif /* __cplusplus */ + +/** @} */ +/** @} */ /* END CUDART_TEXTURE_HL */ + +#endif /* !__CHANNEL_DESCRIPTOR_H__ */ diff --git a/cuda_toolkit/include/charconv b/cuda_toolkit/include/charconv new file mode 100644 index 0000000000000000000000000000000000000000..432d996d24e1e82db029f774ade6ed8906844e04 --- /dev/null +++ b/cuda_toolkit/include/charconv @@ -0,0 +1,616 @@ +// -*- C++ -*- +//===------------------------------ charconv ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CHARCONV +#define _LIBCUDACXX_CHARCONV + +/* + charconv synopsis + +namespace std { + + // floating-point format for primitive numerical conversion + enum class chars_format { + scientific = unspecified, + fixed = unspecified, + hex = unspecified, + general = fixed | scientific + }; + + // 23.20.2, primitive numerical output conversion + struct to_chars_result { + char* ptr; + errc ec; + }; + + to_chars_result to_chars(char* first, char* last, see below value, + int base = 10); + + to_chars_result to_chars(char* first, char* last, float value); + to_chars_result to_chars(char* first, char* last, double value); + to_chars_result to_chars(char* first, char* last, long double value); + + to_chars_result to_chars(char* first, char* last, float value, + chars_format fmt); + to_chars_result to_chars(char* first, char* last, double value, + chars_format fmt); + to_chars_result to_chars(char* first, char* last, long double value, + chars_format fmt); + + to_chars_result to_chars(char* first, char* last, float value, + chars_format fmt, int precision); + to_chars_result to_chars(char* first, char* last, double value, + chars_format fmt, int precision); + to_chars_result to_chars(char* first, char* last, long double value, + chars_format fmt, int precision); + + // 23.20.3, primitive numerical input conversion + struct from_chars_result { + const char* ptr; + errc ec; + }; + + from_chars_result from_chars(const char* first, const char* last, + see below& value, int base = 10); + + from_chars_result from_chars(const char* first, const char* last, + float& value, + chars_format fmt = chars_format::general); + from_chars_result from_chars(const char* first, const char* last, + double& value, + chars_format fmt = chars_format::general); + from_chars_result from_chars(const char* first, const char* last, + long double& value, + chars_format fmt = chars_format::general); + +} // namespace std + +*/ + +#include <__errc> +#include +#include +#include +#include +#include + +#include <__debug> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +namespace __itoa { +_LIBCUDACXX_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer); +_LIBCUDACXX_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer); +} + +enum class _LIBCUDACXX_ENUM_VIS chars_format +{ + scientific = 0x1, + fixed = 0x2, + hex = 0x4, + general = fixed | scientific +}; + +struct _LIBCUDACXX_TYPE_VIS to_chars_result +{ + char* ptr; + errc ec; +}; + +struct _LIBCUDACXX_TYPE_VIS from_chars_result +{ + const char* ptr; + errc ec; +}; + +void to_chars(char*, char*, bool, int = 10) = delete; +void from_chars(const char*, const char*, bool, int = 10) = delete; + +namespace __itoa +{ + +static constexpr uint64_t __pow10_64[] = { + UINT64_C(0), + UINT64_C(10), + UINT64_C(100), + UINT64_C(1000), + UINT64_C(10000), + UINT64_C(100000), + UINT64_C(1000000), + UINT64_C(10000000), + UINT64_C(100000000), + UINT64_C(1000000000), + UINT64_C(10000000000), + UINT64_C(100000000000), + UINT64_C(1000000000000), + UINT64_C(10000000000000), + UINT64_C(100000000000000), + UINT64_C(1000000000000000), + UINT64_C(10000000000000000), + UINT64_C(100000000000000000), + UINT64_C(1000000000000000000), + UINT64_C(10000000000000000000), +}; + +static constexpr uint32_t __pow10_32[] = { + UINT32_C(0), UINT32_C(10), UINT32_C(100), + UINT32_C(1000), UINT32_C(10000), UINT32_C(100000), + UINT32_C(1000000), UINT32_C(10000000), UINT32_C(100000000), + UINT32_C(1000000000), +}; + +template +struct _LIBCUDACXX_HIDDEN __traits_base +{ + using type = uint64_t; + +#if !defined(_LIBCUDACXX_COMPILER_MSVC) + static _LIBCUDACXX_INLINE_VISIBILITY int __width(_Tp __v) + { + auto __t = (64 - __builtin_clzll(__v | 1)) * 1233 >> 12; + return __t - (__v < __pow10_64[__t]) + 1; + } +#endif + + static _LIBCUDACXX_INLINE_VISIBILITY char* __convert(_Tp __v, char* __p) + { + return __u64toa(__v, __p); + } + + static _LIBCUDACXX_INLINE_VISIBILITY decltype(__pow10_64)& __pow() { return __pow10_64; } +}; + +template +struct _LIBCUDACXX_HIDDEN + __traits_base<_Tp, decltype(void(uint32_t{declval<_Tp>()}))> +{ + using type = uint32_t; + +#if !defined(_LIBCUDACXX_COMPILER_MSVC) + static _LIBCUDACXX_INLINE_VISIBILITY int __width(_Tp __v) + { + auto __t = (32 - __builtin_clz(__v | 1)) * 1233 >> 12; + return __t - (__v < __pow10_32[__t]) + 1; + } +#endif + + static _LIBCUDACXX_INLINE_VISIBILITY char* __convert(_Tp __v, char* __p) + { + return __u32toa(__v, __p); + } + + static _LIBCUDACXX_INLINE_VISIBILITY decltype(__pow10_32)& __pow() { return __pow10_32; } +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY bool +__mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r) +{ + auto __c = __a * __b; + __r = __c; + return __c > (numeric_limits::max)(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY bool +__mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r) +{ + auto __c = __a * __b; + __r = __c; + return __c > (numeric_limits::max)(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY bool +__mul_overflowed(_Tp __a, _Tp __b, _Tp& __r) +{ + static_assert(is_unsigned<_Tp>::value, ""); +#if !defined(_LIBCUDACXX_COMPILER_MSVC) && !defined(_LIBCUDACXX_COMPILER_NVHPC) + return __builtin_mul_overflow(__a, __b, &__r); +#else + bool __did = __b && ((numeric_limits<_Tp>::max)() / __b) < __a; + __r = __a * __b; + return __did; +#endif +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY bool +__mul_overflowed(_Tp __a, _Up __b, _Tp& __r) +{ + return __mul_overflowed(__a, static_cast<_Tp>(__b), __r); +} + +template +struct _LIBCUDACXX_HIDDEN __traits : __traits_base<_Tp> +{ + static constexpr int digits = numeric_limits<_Tp>::digits10 + 1; + using __traits_base<_Tp>::__pow; + using typename __traits_base<_Tp>::type; + + // precondition: at least one non-zero character available + static _LIBCUDACXX_INLINE_VISIBILITY char const* + __read(char const* __p, char const* __ep, type& __a, type& __b) + { + type __cprod[digits]; + int __j = digits - 1; + int __i = digits; + do + { + if (!('0' <= *__p && *__p <= '9')) + break; + __cprod[--__i] = *__p++ - '0'; + } while (__p != __ep && __i != 0); + + __a = __inner_product(__cprod + __i + 1, __cprod + __j, __pow() + 1, + __cprod[__i]); + if (__mul_overflowed(__cprod[__j], __pow()[__j - __i], __b)) + --__p; + return __p; + } + + template + static _LIBCUDACXX_INLINE_VISIBILITY _Up + __inner_product(_It1 __first1, _It1 __last1, _It2 __first2, _Up __init) + { + for (; __first1 < __last1; ++__first1, ++__first2) + __init = __init + *__first1 * *__first2; + return __init; + } +}; + +} // namespace __itoa + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _Tp +__complement(_Tp __x) +{ + static_assert(is_unsigned<_Tp>::value, "cast to unsigned first"); + return _Tp(~__x + 1); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY typename make_unsigned<_Tp>::type +__to_unsigned(_Tp __x) +{ + return static_cast::type>(__x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY to_chars_result +__to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) +{ + auto __x = __to_unsigned(__value); + if (__value < 0 && __first != __last) + { + *__first++ = '-'; + __x = __complement(__x); + } + + return __to_chars_itoa(__first, __last, __x, false_type()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY to_chars_result +__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) +{ + using __tx = __itoa::__traits<_Tp>; + auto __diff = __last - __first; + +#if !defined(_LIBCUDACXX_COMPILER_MSVC) + if (__tx::digits <= __diff || __tx::__width(__value) <= __diff) + return {__tx::__convert(__value, __first), errc(0)}; + else + return {__last, errc::value_too_large}; +#else + if (__tx::digits <= __diff) + return {__tx::__convert(__value, __first), {}}; + else + { + char __buf[__tx::digits]; + auto __p = __tx::__convert(__value, __buf); + auto __len = __p - __buf; + if (__len <= __diff) + { + memcpy(__first, __buf, __len); + return {__first + __len, {}}; + } + else + return {__last, errc::value_too_large}; + } +#endif +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY to_chars_result +__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, + true_type) +{ + auto __x = __to_unsigned(__value); + if (__value < 0 && __first != __last) + { + *__first++ = '-'; + __x = __complement(__x); + } + + return __to_chars_integral(__first, __last, __x, __base, false_type()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY to_chars_result +__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, + false_type) +{ + if (__base == 10) + return __to_chars_itoa(__first, __last, __value, false_type()); + + auto __p = __last; + while (__p != __first) + { + auto __c = __value % __base; + __value /= __base; + *--__p = "0123456789abcdefghijklmnopqrstuvwxyz"[__c]; + if (__value == 0) + break; + } + + auto __len = __last - __p; + if (__value != 0 || !__len) + return {__last, errc::value_too_large}; + else + { + memmove(__first, __p, __len); + return {__first + __len, {}}; + } +} + +template ::value, int>::type = 0> +inline _LIBCUDACXX_INLINE_VISIBILITY to_chars_result +to_chars(char* __first, char* __last, _Tp __value) +{ + return __to_chars_itoa(__first, __last, __value, is_signed<_Tp>()); +} + +template ::value, int>::type = 0> +inline _LIBCUDACXX_INLINE_VISIBILITY to_chars_result +to_chars(char* __first, char* __last, _Tp __value, int __base) +{ + _LIBCUDACXX_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]"); + return __to_chars_integral(__first, __last, __value, __base, + is_signed<_Tp>()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY from_chars_result +__sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) +{ + using __tl = numeric_limits<_Tp>; + decltype(__to_unsigned(__value)) __x; + + bool __neg = (__first != __last && *__first == '-'); + auto __r = __f(__neg ? __first + 1 : __first, __last, __x, __args...); + switch (__r.ec) + { + case errc::invalid_argument: + return {__first, __r.ec}; + case errc::result_out_of_range: + return __r; + default: + break; + } + + if (__neg) + { + if (__x <= __complement(__to_unsigned(__tl::min()))) + { + __x = __complement(__x); + memcpy(&__value, &__x, sizeof(__x)); + return __r; + } + } + else + { + if (__x <= (__tl::max)()) + { + __value = __x; + return __r; + } + } + + return {__r.ptr, errc::result_out_of_range}; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY bool +__in_pattern(_Tp __c) +{ + return '0' <= __c && __c <= '9'; +} + +struct _LIBCUDACXX_HIDDEN __in_pattern_result +{ + bool __ok; + int __val; + + explicit _LIBCUDACXX_INLINE_VISIBILITY operator bool() const { return __ok; } +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY __in_pattern_result +__in_pattern(_Tp __c, int __base) +{ + if (__base <= 10) + return {'0' <= __c && __c < '0' + __base, __c - '0'}; + else if (__in_pattern(__c)) + return {true, __c - '0'}; + else if ('a' <= __c && __c < 'a' + __base - 10) + return {true, __c - 'a' + 10}; + else + return {'A' <= __c && __c < 'A' + __base - 10, __c - 'A' + 10}; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY from_chars_result +__subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, + _Ts... __args) +{ + auto __find_non_zero = [](_It __first, _It __last) { + for (; __first != __last; ++__first) + if (*__first != '0') + break; + return __first; + }; + + auto __p = __find_non_zero(__first, __last); + if (__p == __last || !__in_pattern(*__p, __args...)) + { + if (__p == __first) + return {__first, errc::invalid_argument}; + else + { + __value = 0; + return {__p, {}}; + } + } + + auto __r = __f(__p, __last, __value, __args...); + if (__r.ec == errc::result_out_of_range) + { + for (; __r.ptr != __last; ++__r.ptr) + { + if (!__in_pattern(*__r.ptr, __args...)) + break; + } + } + + return __r; +} + +template ::value, int>::type = 0> +inline _LIBCUDACXX_INLINE_VISIBILITY from_chars_result +__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) +{ + using __tx = __itoa::__traits<_Tp>; + using __output_type = typename __tx::type; + + return __subject_seq_combinator( + __first, __last, __value, + [](const char* __first, const char* __last, + _Tp& __value) -> from_chars_result { + __output_type __a, __b; + auto __p = __tx::__read(__first, __last, __a, __b); + if (__p == __last || !__in_pattern(*__p)) + { + __output_type __m = (numeric_limits<_Tp>::max)(); + if (__m >= __a && __m - __a >= __b) + { + __value = __a + __b; + return {__p, {}}; + } + } + return {__p, errc::result_out_of_range}; + }); +} + +template ::value, int>::type = 0> +inline _LIBCUDACXX_INLINE_VISIBILITY from_chars_result +__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) +{ + using __t = decltype(__to_unsigned(__value)); + return __sign_combinator(__first, __last, __value, __from_chars_atoi<__t>); +} + +template ::value, int>::type = 0> +inline _LIBCUDACXX_INLINE_VISIBILITY from_chars_result +__from_chars_integral(const char* __first, const char* __last, _Tp& __value, + int __base) +{ + if (__base == 10) + return __from_chars_atoi(__first, __last, __value); + + return __subject_seq_combinator( + __first, __last, __value, + [](const char* __p, const char* __last, _Tp& __value, + int __base) -> from_chars_result { + using __tl = numeric_limits<_Tp>; + auto __digits = __tl::digits / log2f(float(__base)); + _Tp __a = __in_pattern(*__p++, __base).__val, __b = 0; + + for (int __i = 1; __p != __last; ++__i, ++__p) + { + if (auto __c = __in_pattern(*__p, __base)) + { + if (__i < __digits - 1) + __a = __a * __base + __c.__val; + else + { + if (!__itoa::__mul_overflowed(__a, __base, __a)) + ++__p; + __b = __c.__val; + break; + } + } + else + break; + } + + if (__p == __last || !__in_pattern(*__p, __base)) + { + if ((__tl::max)() - __a >= __b) + { + __value = __a + __b; + return {__p, {}}; + } + } + return {__p, errc::result_out_of_range}; + }, + __base); +} + +template ::value, int>::type = 0> +inline _LIBCUDACXX_INLINE_VISIBILITY from_chars_result +__from_chars_integral(const char* __first, const char* __last, _Tp& __value, + int __base) +{ + using __t = decltype(__to_unsigned(__value)); + return __sign_combinator(__first, __last, __value, + __from_chars_integral<__t>, __base); +} + +template ::value, int>::type = 0> +inline _LIBCUDACXX_INLINE_VISIBILITY from_chars_result +from_chars(const char* __first, const char* __last, _Tp& __value) +{ + return __from_chars_atoi(__first, __last, __value); +} + +template ::value, int>::type = 0> +inline _LIBCUDACXX_INLINE_VISIBILITY from_chars_result +from_chars(const char* __first, const char* __last, _Tp& __value, int __base) +{ + _LIBCUDACXX_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]"); + return __from_chars_integral(__first, __last, __value, __base); +} + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX_CHARCONV diff --git a/cuda_toolkit/include/chrono b/cuda_toolkit/include/chrono new file mode 100644 index 0000000000000000000000000000000000000000..71f47b9fe725b3a6e195fa82c3117ad056218da9 --- /dev/null +++ b/cuda_toolkit/include/chrono @@ -0,0 +1,3362 @@ +// -*- C++ -*- +//===---------------------------- chrono ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CHRONO +#define _LIBCUDACXX_CHRONO + +/* + chrono synopsis + +namespace std +{ +namespace chrono +{ + +template +constexpr +ToDuration +duration_cast(const duration& fd); + +template struct treat_as_floating_point : is_floating_point {}; + +template inline constexpr bool treat_as_floating_point_v + = treat_as_floating_point::value; // C++17 + +template +struct duration_values +{ +public: + static constexpr Rep zero(); // noexcept in C++20 + static constexpr Rep max(); // noexcept in C++20 + static constexpr Rep min(); // noexcept in C++20 +}; + +// duration + +template > +class duration +{ + static_assert(!__is_duration::value, "A duration representation can not be a duration"); + static_assert(__is_ratio::value, "Second template parameter of duration must be a std::ratio"); + static_assert(Period::num > 0, "duration period must be positive"); +public: + typedef Rep rep; + typedef typename _Period::type period; + + constexpr duration() = default; + template + constexpr explicit duration(const Rep2& r, + typename enable_if + < + is_convertible::value && + (treat_as_floating_point::value || + !treat_as_floating_point::value && !treat_as_floating_point::value) + >::type* = 0); + + // conversions + template + constexpr duration(const duration& d, + typename enable_if + < + treat_as_floating_point::value || + ratio_divide::type::den == 1 + >::type* = 0); + + // observer + + constexpr rep count() const; + + // arithmetic + + constexpr common_type::type operator+() const; + constexpr common_type::type operator-() const; + constexpr duration& operator++(); // constexpr in C++17 + constexpr duration operator++(int); // constexpr in C++17 + constexpr duration& operator--(); // constexpr in C++17 + constexpr duration operator--(int); // constexpr in C++17 + + constexpr duration& operator+=(const duration& d); // constexpr in C++17 + constexpr duration& operator-=(const duration& d); // constexpr in C++17 + + duration& operator*=(const rep& rhs); // constexpr in C++17 + duration& operator/=(const rep& rhs); // constexpr in C++17 + duration& operator%=(const rep& rhs); // constexpr in C++17 + duration& operator%=(const duration& rhs); // constexpr in C++17 + + // special values + + static constexpr duration zero(); // noexcept in C++20 + static constexpr duration min(); // noexcept in C++20 + static constexpr duration max(); // noexcept in C++20 +}; + +typedef duration nanoseconds; +typedef duration microseconds; +typedef duration milliseconds; +typedef duration seconds; +typedef duration< long, ratio< 60> > minutes; +typedef duration< long, ratio<3600> > hours; + +template +class time_point +{ +public: + typedef Clock clock; + typedef Duration duration; + typedef typename duration::rep rep; + typedef typename duration::period period; +private: + duration d_; // exposition only + +public: + time_point(); // has value "epoch" // constexpr in C++14 + explicit time_point(const duration& d); // same as time_point() + d // constexpr in C++14 + + // conversions + template + time_point(const time_point& t); // constexpr in C++14 + + // observer + + duration time_since_epoch() const; // constexpr in C++14 + + // arithmetic + + time_point& operator+=(const duration& d); // constexpr in C++17 + time_point& operator-=(const duration& d); // constexpr in C++17 + + // special values + + static constexpr time_point min(); // noexcept in C++20 + static constexpr time_point max(); // noexcept in C++20 +}; + +} // chrono + +// common_type traits +template + struct common_type, chrono::duration>; + +template + struct common_type, chrono::time_point>; + +namespace chrono { + + +template struct is_clock; // C++20 +template inline constexpr bool is_clock_v = is_clock::value; // C++20 + + +// duration arithmetic +template + constexpr + typename common_type, duration>::type + operator+(const duration& lhs, const duration& rhs); +template + constexpr + typename common_type, duration>::type + operator-(const duration& lhs, const duration& rhs); +template + constexpr + duration::type, Period> + operator*(const duration& d, const Rep2& s); +template + constexpr + duration::type, Period> + operator*(const Rep1& s, const duration& d); +template + constexpr + duration::type, Period> + operator/(const duration& d, const Rep2& s); +template + constexpr + typename common_type::type + operator/(const duration& lhs, const duration& rhs); + +// duration comparisons +template + constexpr + bool operator==(const duration& lhs, const duration& rhs); +template + constexpr + bool operator!=(const duration& lhs, const duration& rhs); +template + constexpr + bool operator< (const duration& lhs, const duration& rhs); +template + constexpr + bool operator<=(const duration& lhs, const duration& rhs); +template + constexpr + bool operator> (const duration& lhs, const duration& rhs); +template + constexpr + bool operator>=(const duration& lhs, const duration& rhs); + +// duration_cast +template + ToDuration duration_cast(const duration& d); + +template + constexpr ToDuration floor(const duration& d); // C++17 +template + constexpr ToDuration ceil(const duration& d); // C++17 +template + constexpr ToDuration round(const duration& d); // C++17 + +// duration I/O is elsewhere + +// time_point arithmetic (all constexpr in C++14) +template + time_point>::type> + operator+(const time_point& lhs, const duration& rhs); +template + time_point, Duration2>::type> + operator+(const duration& lhs, const time_point& rhs); +template + time_point>::type> + operator-(const time_point& lhs, const duration& rhs); +template + typename common_type::type + operator-(const time_point& lhs, const time_point& rhs); + +// time_point comparisons (all constexpr in C++14) +template + bool operator==(const time_point& lhs, const time_point& rhs); +template + bool operator!=(const time_point& lhs, const time_point& rhs); +template + bool operator< (const time_point& lhs, const time_point& rhs); +template + bool operator<=(const time_point& lhs, const time_point& rhs); +template + bool operator> (const time_point& lhs, const time_point& rhs); +template + bool operator>=(const time_point& lhs, const time_point& rhs); + +// time_point_cast (constexpr in C++14) + +template + time_point time_point_cast(const time_point& t); + +template + constexpr time_point + floor(const time_point& tp); // C++17 + +template + constexpr time_point + ceil(const time_point& tp); // C++17 + +template + constexpr time_point + round(const time_point& tp); // C++17 + +template + constexpr duration abs(duration d); // C++17 + +// Clocks + +class system_clock +{ +public: + typedef microseconds duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point time_point; + static const bool is_steady = false; // constexpr in C++14 + + static time_point now() noexcept; + static time_t to_time_t (const time_point& __t) noexcept; + static time_point from_time_t(time_t __t) noexcept; +}; + +template + using sys_time = time_point; // C++20 +using sys_seconds = sys_time; // C++20 +using sys_days = sys_time; // C++20 + +class utc_clock; // C++20 + +template + using utc_time = time_point; // C++20 +using utc_seconds = utc_time; // C++20 + +class tai_clock; // C++20 + +template + using tai_time = time_point; // C++20 +using tai_seconds = tai_time; // C++20 + +class file_clock; // C++20 + +template + using file_time = time_point; // C++20 + +class steady_clock +{ +public: + typedef nanoseconds duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point time_point; + static const bool is_steady = true; // constexpr in C++14 + + static time_point now() noexcept; +}; + +typedef steady_clock high_resolution_clock; + +// 25.7.8, local time // C++20 +struct local_t {}; +template + using local_time = time_point; +using local_seconds = local_time; +using local_days = local_time; + +// 25.7.9, time_point conversions template // C++20 +struct clock_time_conversion; + +template + auto clock_cast(const time_point& t); + +// 25.8.2, class last_spec // C++20 +struct last_spec; + +// 25.8.3, class day // C++20 + +class day; +constexpr bool operator==(const day& x, const day& y) noexcept; +constexpr bool operator!=(const day& x, const day& y) noexcept; +constexpr bool operator< (const day& x, const day& y) noexcept; +constexpr bool operator> (const day& x, const day& y) noexcept; +constexpr bool operator<=(const day& x, const day& y) noexcept; +constexpr bool operator>=(const day& x, const day& y) noexcept; +constexpr day operator+(const day& x, const days& y) noexcept; +constexpr day operator+(const days& x, const day& y) noexcept; +constexpr day operator-(const day& x, const days& y) noexcept; +constexpr days operator-(const day& x, const day& y) noexcept; + +// 25.8.4, class month // C++20 +class month; +constexpr bool operator==(const month& x, const month& y) noexcept; +constexpr bool operator!=(const month& x, const month& y) noexcept; +constexpr bool operator< (const month& x, const month& y) noexcept; +constexpr bool operator> (const month& x, const month& y) noexcept; +constexpr bool operator<=(const month& x, const month& y) noexcept; +constexpr bool operator>=(const month& x, const month& y) noexcept; +constexpr month operator+(const month& x, const months& y) noexcept; +constexpr month operator+(const months& x, const month& y) noexcept; +constexpr month operator-(const month& x, const months& y) noexcept; +constexpr months operator-(const month& x, const month& y) noexcept; + +// 25.8.5, class year // C++20 +class year; +constexpr bool operator==(const year& x, const year& y) noexcept; +constexpr bool operator!=(const year& x, const year& y) noexcept; +constexpr bool operator< (const year& x, const year& y) noexcept; +constexpr bool operator> (const year& x, const year& y) noexcept; +constexpr bool operator<=(const year& x, const year& y) noexcept; +constexpr bool operator>=(const year& x, const year& y) noexcept; +constexpr year operator+(const year& x, const years& y) noexcept; +constexpr year operator+(const years& x, const year& y) noexcept; +constexpr year operator-(const year& x, const years& y) noexcept; +constexpr years operator-(const year& x, const year& y) noexcept; + +// 25.8.6, class weekday // C++20 +class weekday; + +constexpr bool operator==(const weekday& x, const weekday& y) noexcept; +constexpr bool operator!=(const weekday& x, const weekday& y) noexcept; +constexpr weekday operator+(const weekday& x, const days& y) noexcept; +constexpr weekday operator+(const days& x, const weekday& y) noexcept; +constexpr weekday operator-(const weekday& x, const days& y) noexcept; +constexpr days operator-(const weekday& x, const weekday& y) noexcept; + +// 25.8.7, class weekday_indexed // C++20 + +class weekday_indexed; +constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept; +constexpr bool operator!=(const weekday_indexed& x, const weekday_indexed& y) noexcept; + +// 25.8.8, class weekday_last // C++20 +class weekday_last; + +constexpr bool operator==(const weekday_last& x, const weekday_last& y) noexcept; +constexpr bool operator!=(const weekday_last& x, const weekday_last& y) noexcept; + +// 25.8.9, class month_day // C++20 +class month_day; + +constexpr bool operator==(const month_day& x, const month_day& y) noexcept; +constexpr bool operator!=(const month_day& x, const month_day& y) noexcept; +constexpr bool operator< (const month_day& x, const month_day& y) noexcept; +constexpr bool operator> (const month_day& x, const month_day& y) noexcept; +constexpr bool operator<=(const month_day& x, const month_day& y) noexcept; +constexpr bool operator>=(const month_day& x, const month_day& y) noexcept; + + +// 25.8.10, class month_day_last // C++20 +class month_day_last; + +constexpr bool operator==(const month_day_last& x, const month_day_last& y) noexcept; +constexpr bool operator!=(const month_day_last& x, const month_day_last& y) noexcept; +constexpr bool operator< (const month_day_last& x, const month_day_last& y) noexcept; +constexpr bool operator> (const month_day_last& x, const month_day_last& y) noexcept; +constexpr bool operator<=(const month_day_last& x, const month_day_last& y) noexcept; +constexpr bool operator>=(const month_day_last& x, const month_day_last& y) noexcept; + +// 25.8.11, class month_weekday // C++20 +class month_weekday; + +constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept; +constexpr bool operator!=(const month_weekday& x, const month_weekday& y) noexcept; + +// 25.8.12, class month_weekday_last // C++20 +class month_weekday_last; + +constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept; +constexpr bool operator!=(const month_weekday_last& x, const month_weekday_last& y) noexcept; + + +// 25.8.13, class year_month // C++20 +class year_month; + +constexpr bool operator==(const year_month& x, const year_month& y) noexcept; +constexpr bool operator!=(const year_month& x, const year_month& y) noexcept; +constexpr bool operator< (const year_month& x, const year_month& y) noexcept; +constexpr bool operator> (const year_month& x, const year_month& y) noexcept; +constexpr bool operator<=(const year_month& x, const year_month& y) noexcept; +constexpr bool operator>=(const year_month& x, const year_month& y) noexcept; + +constexpr year_month operator+(const year_month& ym, const months& dm) noexcept; +constexpr year_month operator+(const months& dm, const year_month& ym) noexcept; +constexpr year_month operator-(const year_month& ym, const months& dm) noexcept; +constexpr months operator-(const year_month& x, const year_month& y) noexcept; +constexpr year_month operator+(const year_month& ym, const years& dy) noexcept; +constexpr year_month operator+(const years& dy, const year_month& ym) noexcept; +constexpr year_month operator-(const year_month& ym, const years& dy) noexcept; + +// 25.8.14, class year_month_day class // C++20 +year_month_day; + +constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept; +constexpr bool operator!=(const year_month_day& x, const year_month_day& y) noexcept; +constexpr bool operator< (const year_month_day& x, const year_month_day& y) noexcept; +constexpr bool operator> (const year_month_day& x, const year_month_day& y) noexcept; +constexpr bool operator<=(const year_month_day& x, const year_month_day& y) noexcept; +constexpr bool operator>=(const year_month_day& x, const year_month_day& y) noexcept; + +constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept; +constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept; +constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept; +constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept; +constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept; +constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept; + + +// 25.8.15, class year_month_day_last // C++20 +class year_month_day_last; + +constexpr bool operator==(const year_month_day_last& x, + const year_month_day_last& y) noexcept; +constexpr bool operator!=(const year_month_day_last& x, + const year_month_day_last& y) noexcept; +constexpr bool operator< (const year_month_day_last& x, + const year_month_day_last& y) noexcept; +constexpr bool operator> (const year_month_day_last& x, + const year_month_day_last& y) noexcept; +constexpr bool operator<=(const year_month_day_last& x, + const year_month_day_last& y) noexcept; +constexpr bool operator>=(const year_month_day_last& x, + const year_month_day_last& y) noexcept; + +constexpr year_month_day_last + operator+(const year_month_day_last& ymdl, const months& dm) noexcept; +constexpr year_month_day_last + operator+(const months& dm, const year_month_day_last& ymdl) noexcept; +constexpr year_month_day_last + operator+(const year_month_day_last& ymdl, const years& dy) noexcept; +constexpr year_month_day_last + operator+(const years& dy, const year_month_day_last& ymdl) noexcept; +constexpr year_month_day_last + operator-(const year_month_day_last& ymdl, const months& dm) noexcept; +constexpr year_month_day_last + operator-(const year_month_day_last& ymdl, const years& dy) noexcept; + +// 25.8.16, class year_month_weekday // C++20 +class year_month_weekday; + +constexpr bool operator==(const year_month_weekday& x, + const year_month_weekday& y) noexcept; +constexpr bool operator!=(const year_month_weekday& x, + const year_month_weekday& y) noexcept; + +constexpr year_month_weekday + operator+(const year_month_weekday& ymwd, const months& dm) noexcept; +constexpr year_month_weekday + operator+(const months& dm, const year_month_weekday& ymwd) noexcept; +constexpr year_month_weekday + operator+(const year_month_weekday& ymwd, const years& dy) noexcept; +constexpr year_month_weekday + operator+(const years& dy, const year_month_weekday& ymwd) noexcept; +constexpr year_month_weekday + operator-(const year_month_weekday& ymwd, const months& dm) noexcept; +constexpr year_month_weekday + operator-(const year_month_weekday& ymwd, const years& dy) noexcept; + +// 25.8.17, class year_month_weekday_last // C++20 +class year_month_weekday_last; + +constexpr bool operator==(const year_month_weekday_last& x, + const year_month_weekday_last& y) noexcept; +constexpr bool operator!=(const year_month_weekday_last& x, + const year_month_weekday_last& y) noexcept; +constexpr year_month_weekday_last + operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept; +constexpr year_month_weekday_last + operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept; +constexpr year_month_weekday_last + operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept; +constexpr year_month_weekday_last + operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept; +constexpr year_month_weekday_last + operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept; +constexpr year_month_weekday_last + operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept; + +// 25.8.18, civil calendar conventional syntax operators // C++20 +constexpr year_month + operator/(const year& y, const month& m) noexcept; +constexpr year_month + operator/(const year& y, int m) noexcept; +constexpr month_day + operator/(const month& m, const day& d) noexcept; +constexpr month_day + operator/(const month& m, int d) noexcept; +constexpr month_day + operator/(int m, const day& d) noexcept; +constexpr month_day + operator/(const day& d, const month& m) noexcept; +constexpr month_day + operator/(const day& d, int m) noexcept; +constexpr month_day_last + operator/(const month& m, last_spec) noexcept; +constexpr month_day_last + operator/(int m, last_spec) noexcept; +constexpr month_day_last + operator/(last_spec, const month& m) noexcept; +constexpr month_day_last + operator/(last_spec, int m) noexcept; +constexpr month_weekday + operator/(const month& m, const weekday_indexed& wdi) noexcept; +constexpr month_weekday + operator/(int m, const weekday_indexed& wdi) noexcept; +constexpr month_weekday + operator/(const weekday_indexed& wdi, const month& m) noexcept; +constexpr month_weekday + operator/(const weekday_indexed& wdi, int m) noexcept; +constexpr month_weekday_last + operator/(const month& m, const weekday_last& wdl) noexcept; +constexpr month_weekday_last + operator/(int m, const weekday_last& wdl) noexcept; +constexpr month_weekday_last + operator/(const weekday_last& wdl, const month& m) noexcept; +constexpr month_weekday_last + operator/(const weekday_last& wdl, int m) noexcept; +constexpr year_month_day + operator/(const year_month& ym, const day& d) noexcept; +constexpr year_month_day + operator/(const year_month& ym, int d) noexcept; +constexpr year_month_day + operator/(const year& y, const month_day& md) noexcept; +constexpr year_month_day + operator/(int y, const month_day& md) noexcept; +constexpr year_month_day + operator/(const month_day& md, const year& y) noexcept; +constexpr year_month_day + operator/(const month_day& md, int y) noexcept; +constexpr year_month_day_last + operator/(const year_month& ym, last_spec) noexcept; +constexpr year_month_day_last + operator/(const year& y, const month_day_last& mdl) noexcept; +constexpr year_month_day_last + operator/(int y, const month_day_last& mdl) noexcept; +constexpr year_month_day_last + operator/(const month_day_last& mdl, const year& y) noexcept; +constexpr year_month_day_last + operator/(const month_day_last& mdl, int y) noexcept; +constexpr year_month_weekday + operator/(const year_month& ym, const weekday_indexed& wdi) noexcept; +constexpr year_month_weekday + operator/(const year& y, const month_weekday& mwd) noexcept; +constexpr year_month_weekday + operator/(int y, const month_weekday& mwd) noexcept; +constexpr year_month_weekday + operator/(const month_weekday& mwd, const year& y) noexcept; +constexpr year_month_weekday + operator/(const month_weekday& mwd, int y) noexcept; +constexpr year_month_weekday_last + operator/(const year_month& ym, const weekday_last& wdl) noexcept; +constexpr year_month_weekday_last + operator/(const year& y, const month_weekday_last& mwdl) noexcept; +constexpr year_month_weekday_last + operator/(int y, const month_weekday_last& mwdl) noexcept; +constexpr year_month_weekday_last + operator/(const month_weekday_last& mwdl, const year& y) noexcept; +constexpr year_month_weekday_last + operator/(const month_weekday_last& mwdl, int y) noexcept; + +// 26.9, class template hh_mm_ss +template +class hh_mm_ss +{ + bool is_neg; // exposition only + chrono::hours h; // exposition only + chrono::minutes m; // exposition only + chrono::seconds s; // exposition only + precision ss; // exposition only + +public: + static unsigned constexpr fractional_width = see below; + using precision = see below; + + constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {} + constexpr explicit hh_mm_ss(Duration d) noexcept; + + constexpr bool is_negative() const noexcept; + constexpr chrono::hours hours() const noexcept; + constexpr chrono::minutes minutes() const noexcept; + constexpr chrono::seconds seconds() const noexcept; + constexpr precision subseconds() const noexcept; + + constexpr explicit operator precision() const noexcept; + constexpr precision to_duration() const noexcept; +}; + +template + basic_ostream& + operator<<(basic_ostream& os, hh_mm_ss const& hms); + +// 26.10, 12/24 hour functions +constexpr bool is_am(hours const& h) noexcept; +constexpr bool is_pm(hours const& h) noexcept; +constexpr hours make12(const hours& h) noexcept; +constexpr hours make24(const hours& h, bool is_pm) noexcept; + + +// 25.10.2, time zone database // C++20 +struct tzdb; +class tzdb_list; + +// 25.10.2.3, time zone database access // C++20 +const tzdb& get_tzdb(); +tzdb_list& get_tzdb_list(); +const time_zone* locate_zone(string_view tz_name); +const time_zone* current_zone(); + +// 25.10.2.4, remote time zone database support // C++20 +const tzdb& reload_tzdb(); +string remote_version(); + +// 25.10.3, exception classes // C++20 +class nonexistent_local_time; +class ambiguous_local_time; + +// 25.10.4, information classes // C++20 +struct sys_info; +struct local_info; + +// 25.10.5, class time_zone // C++20 +enum class choose {earliest, latest}; +class time_zone; +bool operator==(const time_zone& x, const time_zone& y) noexcept; +bool operator!=(const time_zone& x, const time_zone& y) noexcept; +bool operator<(const time_zone& x, const time_zone& y) noexcept; +bool operator>(const time_zone& x, const time_zone& y) noexcept; +bool operator<=(const time_zone& x, const time_zone& y) noexcept; +bool operator>=(const time_zone& x, const time_zone& y) noexcept; + +// 25.10.6, class template zoned_traits // C++20 +template struct zoned_traits; + +// 25.10.7, class template zoned_time // C++20 +template class zoned_time; +using zoned_seconds = zoned_time; + +template + bool operator==(const zoned_time& x, + const zoned_time& y); +template + bool operator!=(const zoned_time& x, + const zoned_time& y); + +// 25.10.8, leap second support // C++20 +class leap; + +bool operator==(const leap& x, const leap& y); +bool operator!=(const leap& x, const leap& y); +bool operator< (const leap& x, const leap& y); +bool operator> (const leap& x, const leap& y); +bool operator<=(const leap& x, const leap& y); +bool operator>=(const leap& x, const leap& y); +template + bool operator==(const leap& x, const sys_time& y); +template + bool operator==(const sys_time& x, const leap& y); +template + bool operator!=(const leap& x, const sys_time& y); +template + bool operator!=(const sys_time& x, const leap& y); +template + bool operator< (const leap& x, const sys_time& y); +template + bool operator< (const sys_time& x, const leap& y); +template + bool operator> (const leap& x, const sys_time& y); +template + bool operator> (const sys_time& x, const leap& y); +template + bool operator<=(const leap& x, const sys_time& y); +template + bool operator<=(const sys_time& x, const leap& y); +template + bool operator>=(const leap& x, const sys_time& y); +template + bool operator>=(const sys_time& x, const leap& y); + +// 25.10.9, class link // C++20 +class link; +bool operator==(const link& x, const link& y); +bool operator!=(const link& x, const link& y); +bool operator< (const link& x, const link& y); +bool operator> (const link& x, const link& y); +bool operator<=(const link& x, const link& y); +bool operator>=(const link& x, const link& y); + +// 25.11, formatting // C++20 +template + basic_string + format(const charT* fmt, const Streamable& s); + +template + basic_string + format(const locale& loc, const charT* fmt, const Streamable& s); + +template + basic_string + format(const basic_string& fmt, const Streamable& s); + +template + basic_string + format(const locale& loc, const basic_string& fmt, + const Streamable& s); + +// 25.12, parsing // C++20 +template +unspecified + parse(const basic_string& format, Parsable& tp); + +template +unspecified + parse(const basic_string& format, Parsable& tp, + basic_string& abbrev); + +template +unspecified + parse(const basic_string& format, Parsable& tp, + minutes& offset); + +template +unspecified + parse(const basic_string& format, Parsable& tp, + basic_string& abbrev, minutes& offset); + +// calendrical constants +inline constexpr last_spec last{}; // C++20 +inline constexpr chrono::weekday Sunday{0}; // C++20 +inline constexpr chrono::weekday Monday{1}; // C++20 +inline constexpr chrono::weekday Tuesday{2}; // C++20 +inline constexpr chrono::weekday Wednesday{3}; // C++20 +inline constexpr chrono::weekday Thursday{4}; // C++20 +inline constexpr chrono::weekday Friday{5}; // C++20 +inline constexpr chrono::weekday Saturday{6}; // C++20 + +inline constexpr chrono::month January{1}; // C++20 +inline constexpr chrono::month February{2}; // C++20 +inline constexpr chrono::month March{3}; // C++20 +inline constexpr chrono::month April{4}; // C++20 +inline constexpr chrono::month May{5}; // C++20 +inline constexpr chrono::month June{6}; // C++20 +inline constexpr chrono::month July{7}; // C++20 +inline constexpr chrono::month August{8}; // C++20 +inline constexpr chrono::month September{9}; // C++20 +inline constexpr chrono::month October{10}; // C++20 +inline constexpr chrono::month November{11}; // C++20 +inline constexpr chrono::month December{12}; // C++20 +} // chrono + +inline namespace literals { + inline namespace chrono_literals { +constexpr chrono::hours operator ""h(unsigned long long); // C++14 +constexpr chrono::duration> operator ""h(long double); // C++14 +constexpr chrono::minutes operator ""min(unsigned long long); // C++14 +constexpr chrono::duration> operator ""min(long double); // C++14 +constexpr chrono::seconds operator ""s(unsigned long long); // C++14 +constexpr chrono::duration operator ""s(long double); // C++14 +constexpr chrono::milliseconds operator ""ms(unsigned long long); // C++14 +constexpr chrono::duration operator ""ms(long double); // C++14 +constexpr chrono::microseconds operator ""us(unsigned long long); // C++14 +constexpr chrono::duration operator ""us(long double); // C++14 +constexpr chrono::nanoseconds operator ""ns(unsigned long long); // C++14 +constexpr chrono::duration operator ""ns(long double); // C++14 +constexpr chrono::day operator ""d(unsigned long long d) noexcept; // C++20 +constexpr chrono::year operator ""y(unsigned long long y) noexcept; // C++20 +} // chrono_literals +} // literals + +} // std +*/ + +#include "__cccl_config" +#ifndef __cuda_std__ +#include <__config> +#else +#ifndef _LIBCUDACXX_COMPILER_NVRTC +#include +#endif // _LIBCUDACXX_COMPILER_NVRTC +#endif // __cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__type_traits/common_type.h" +#include "__type_traits/enable_if.h" +#include "__type_traits/integral_constant.h" +#include "__type_traits/is_convertible.h" +#include "__type_traits/is_floating_point.h" +#include "ctime" +#include "limits" +#include "ratio" + +// standard-mandated includes +// TODO: Fix CPOs in split H/D compilation or inform users of what may happen +// #include "concepts" +#include "version" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// Silence NVCC warnings `long double` arising from chrono floating pointer +// user-defined literals which are defined in terms of `long double`. + +// FIXME: There is currently no way to disable this diagnostic in a fine-grained +// fashion; if you include this header, the diagnostic will be suppressed +// throughout the translation unit. The alternative is loosing (conforming) +// chrono user-defined literals; this seems like the lesser of two evils, so... +_LIBCUDACXX_NV_DIAG_SUPPRESS(cuda_demote_unsupported_floating_point) + +_LIBCUDACXX_BEGIN_NAMESPACE_FILESYSTEM +struct _FilesystemClock; +_LIBCUDACXX_END_NAMESPACE_FILESYSTEM + +# if _LIBCUDACXX_CUDA_ABI_VERSION > 3 +# define _LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T double +# else +# define _LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T long double +# endif + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +namespace chrono +{ + +template > class _LIBCUDACXX_TEMPLATE_VIS duration; + +template +struct __is_duration : false_type {}; + +template +struct __is_duration > : true_type {}; + +template +struct __is_duration > : true_type {}; + +template +struct __is_duration > : true_type {}; + +template +struct __is_duration > : true_type {}; + +} // chrono + +template +struct _LIBCUDACXX_TEMPLATE_VIS common_type, + chrono::duration<_Rep2, _Period2> > +{ + typedef chrono::duration::type, + typename __ratio_gcd<_Period1, _Period2>::type> type; +}; + +namespace chrono { + +// duration_cast + +template ::type, + bool = _Period::num == 1, + bool = _Period::den == 1> +struct __duration_cast; + +template +struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> +{ + _LIBCUDACXX_INLINE_VISIBILITY constexpr + _ToDuration operator()(const _FromDuration& __fd) const + { + return _ToDuration(static_cast(__fd.count())); + } +}; + +template +struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> +{ + _LIBCUDACXX_INLINE_VISIBILITY constexpr + _ToDuration operator()(const _FromDuration& __fd) const + { + typedef typename common_type::type _Ct; + return _ToDuration(static_cast( + static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den))); + } +}; + +template +struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> +{ + _LIBCUDACXX_INLINE_VISIBILITY constexpr + _ToDuration operator()(const _FromDuration& __fd) const + { + typedef typename common_type::type _Ct; + return _ToDuration(static_cast( + static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num))); + } +}; + +template +struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> +{ + _LIBCUDACXX_INLINE_VISIBILITY constexpr + _ToDuration operator()(const _FromDuration& __fd) const + { + typedef typename common_type::type _Ct; + return _ToDuration(static_cast( + static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num) + / static_cast<_Ct>(_Period::den))); + } +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr +__enable_if_t +< + __is_duration<_ToDuration>::value, + _ToDuration +> +duration_cast(const duration<_Rep, _Period>& __fd) +{ + return __duration_cast, _ToDuration>()(__fd); +} + +template +struct _LIBCUDACXX_TEMPLATE_VIS treat_as_floating_point : is_floating_point<_Rep> {}; + +#if _LIBCUDACXX_STD_VER > 11 && !defined(_LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES) +template +_LIBCUDACXX_INLINE_VAR constexpr bool treat_as_floating_point_v + = treat_as_floating_point<_Rep>::value; +#endif // _LIBCUDACXX_STD_VER > 11 && !defined(_LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES) + +template +struct _LIBCUDACXX_TEMPLATE_VIS duration_values +{ +public: + _LIBCUDACXX_INLINE_VISIBILITY static constexpr _Rep zero() noexcept {return _Rep(0);} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr _Rep max() noexcept {return numeric_limits<_Rep>::max();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr _Rep min() noexcept {return numeric_limits<_Rep>::lowest();} +}; + +#if _LIBCUDACXX_STD_VER > 11 +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +__enable_if_t +< + __is_duration<_ToDuration>::value, + _ToDuration +> +floor(const duration<_Rep, _Period>& __d) +{ + _ToDuration __t = duration_cast<_ToDuration>(__d); + if (__t > __d) + __t = __t - _ToDuration{1}; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +__enable_if_t +< + __is_duration<_ToDuration>::value, + _ToDuration +> +ceil(const duration<_Rep, _Period>& __d) +{ + _ToDuration __t = duration_cast<_ToDuration>(__d); + if (__t < __d) + __t = __t + _ToDuration{1}; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +__enable_if_t +< + __is_duration<_ToDuration>::value, + _ToDuration +> +round(const duration<_Rep, _Period>& __d) +{ + _ToDuration __lower = floor<_ToDuration>(__d); + _ToDuration __upper = __lower + _ToDuration{1}; + auto __lowerDiff = __d - __lower; + auto __upperDiff = __upper - __d; + if (__lowerDiff < __upperDiff) + return __lower; + if (__lowerDiff > __upperDiff) + return __upper; + return __lower.count() & 1 ? __upper : __lower; +} +#endif // _LIBCUDACXX_STD_VER > 11 + +// duration + +template +class _LIBCUDACXX_TEMPLATE_VIS duration +{ + static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration"); + static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio"); + static_assert(_Period::num > 0, "duration period must be positive"); + + template + struct __no_overflow + { + private: + static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; + static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; + static const intmax_t __n1 = _R1::num / __gcd_n1_n2; + static const intmax_t __d1 = _R1::den / __gcd_d1_d2; + static const intmax_t __n2 = _R2::num / __gcd_n1_n2; + static const intmax_t __d2 = _R2::den / __gcd_d1_d2; + static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1); + + template + struct __mul // __overflow == false + { + static const intmax_t value = _Xp * _Yp; + }; + + template + struct __mul<_Xp, _Yp, true> + { + static const intmax_t value = 1; + }; + + public: + static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1); + typedef ratio<__mul<__n1, __d2, !value>::value, + __mul<__n2, __d1, !value>::value> type; + }; + +public: + typedef _Rep rep; + typedef typename _Period::type period; +private: + rep __rep_; +public: + + constexpr duration() = default; + + template + _LIBCUDACXX_INLINE_VISIBILITY constexpr + explicit duration(const _Rep2& __r, + __enable_if_t + < + is_convertible<_Rep2, rep>::value && + (treat_as_floating_point::value || + !treat_as_floating_point<_Rep2>::value) + >* = 0) + : __rep_(static_cast(__r)) {} + + // conversions + template + _LIBCUDACXX_INLINE_VISIBILITY constexpr + duration(const duration<_Rep2, _Period2>& __d, + __enable_if_t + < + __no_overflow<_Period2, period>::value && ( + treat_as_floating_point::value || + (__no_overflow<_Period2, period>::type::den == 1 && + !treat_as_floating_point<_Rep2>::value)) + >* = 0) + : __rep_(_CUDA_VSTD::chrono::duration_cast(__d).count()) {} + + // observer + + _LIBCUDACXX_INLINE_VISIBILITY constexpr rep count() const {return __rep_;} + + // arithmetic + + _LIBCUDACXX_INLINE_VISIBILITY constexpr typename common_type::type operator+() const {return typename common_type::type(*this);} + _LIBCUDACXX_INLINE_VISIBILITY constexpr typename common_type::type operator-() const {return typename common_type::type(-__rep_);} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 duration& operator++() {++__rep_; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 duration operator++(int) {return duration(__rep_++);} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 duration& operator--() {--__rep_; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 duration operator--(int) {return duration(__rep_--);} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 duration& operator*=(const rep& rhs) {__rep_ *= rhs; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 duration& operator/=(const rep& rhs) {__rep_ /= rhs; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 duration& operator%=(const rep& rhs) {__rep_ %= rhs; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 duration& operator%=(const duration& rhs) {__rep_ %= rhs.count(); return *this;} + + // special values + + _LIBCUDACXX_INLINE_VISIBILITY static constexpr duration zero() noexcept {return duration(duration_values::zero());} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr duration min() noexcept {return duration(duration_values::min());} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr duration max() noexcept {return duration(duration_values::max());} +}; + +typedef duration nanoseconds; +typedef duration microseconds; +typedef duration milliseconds; +typedef duration seconds; +typedef duration< long, ratio< 60> > minutes; +typedef duration< long, ratio<3600> > hours; +#if _LIBCUDACXX_STD_VER > 11 +typedef duration< int, ratio_multiply, hours::period>> days; +typedef duration< int, ratio_multiply, days::period>> weeks; +typedef duration< int, ratio_multiply, days::period>> years; +typedef duration< int, ratio_divide>> months; +#endif // _LIBCUDACXX_STD_VER > 11 +// Duration == + +template +struct __duration_eq +{ + _LIBCUDACXX_INLINE_VISIBILITY constexpr + bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const + { + typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; + return _Ct(__lhs).count() == _Ct(__rhs).count(); + } +}; + +template +struct __duration_eq<_LhsDuration, _LhsDuration> +{ + _LIBCUDACXX_INLINE_VISIBILITY constexpr + bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const + {return __lhs.count() == __rhs.count();} +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr bool +operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + return __duration_eq, duration<_Rep2, _Period2> >()(__lhs, __rhs); +} + +// Duration != + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr bool +operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + return !(__lhs == __rhs); +} + +// Duration < + +template +struct __duration_lt +{ + _LIBCUDACXX_INLINE_VISIBILITY constexpr + bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const + { + typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; + return _Ct(__lhs).count() < _Ct(__rhs).count(); + } +}; + +template +struct __duration_lt<_LhsDuration, _LhsDuration> +{ + _LIBCUDACXX_INLINE_VISIBILITY constexpr + bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const + {return __lhs.count() < __rhs.count();} +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr bool +operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + return __duration_lt, duration<_Rep2, _Period2> >()(__lhs, __rhs); +} + +// Duration > + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr bool +operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + return __rhs < __lhs; +} + +// Duration <= + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr bool +operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + return !(__rhs < __lhs); +} + +// Duration >= + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr bool +operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + return !(__lhs < __rhs); +} + +// Duration + + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr +typename common_type, duration<_Rep2, _Period2> >::type +operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + typedef typename common_type, duration<_Rep2, _Period2> >::type _Cd; + return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count()); +} + +// Duration - + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr +typename common_type, duration<_Rep2, _Period2> >::type +operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + typedef typename common_type, duration<_Rep2, _Period2> >::type _Cd; + return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count()); +} + +// Duration * + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr +__enable_if_t +< + is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, + duration::type, _Period> +> +operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) +{ + typedef typename common_type<_Rep1, _Rep2>::type _Cr; + typedef duration<_Cr, _Period> _Cd; + return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr +__enable_if_t +< + is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value, + duration::type, _Period> +> +operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) +{ + return __d * __s; +} + +// Duration / + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr +__enable_if_t +< + !__is_duration<_Rep2>::value && + is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, + duration::type, _Period> +> +operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) +{ + typedef typename common_type<_Rep1, _Rep2>::type _Cr; + typedef duration<_Cr, _Period> _Cd; + return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr +typename common_type<_Rep1, _Rep2>::type +operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + typedef typename common_type, duration<_Rep2, _Period2> >::type _Ct; + return _Ct(__lhs).count() / _Ct(__rhs).count(); +} + +// Duration % + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr +__enable_if_t +< + !__is_duration<_Rep2>::value && + is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, + duration::type, _Period> +> +operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) +{ + typedef typename common_type<_Rep1, _Rep2>::type _Cr; + typedef duration<_Cr, _Period> _Cd; + return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr +typename common_type, duration<_Rep2, _Period2> >::type +operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + typedef typename common_type<_Rep1, _Rep2>::type _Cr; + typedef typename common_type, duration<_Rep2, _Period2> >::type _Cd; + return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count())); +} + +////////////////////////////////////////////////////////// +///////////////////// time_point ///////////////////////// +////////////////////////////////////////////////////////// + +template +class _LIBCUDACXX_TEMPLATE_VIS time_point +{ + static_assert(__is_duration<_Duration>::value, + "Second template parameter of time_point must be a std::chrono::duration"); +public: + typedef _Clock clock; + typedef _Duration duration; + typedef typename duration::rep rep; + typedef typename duration::period period; +private: + duration __d_; + +public: + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 time_point() : __d_(duration::zero()) {} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 explicit time_point(const duration& __d) : __d_(__d) {} + + // conversions + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + time_point(const time_point& t, + __enable_if_t + < + is_convertible<_Duration2, duration>::value + >* = 0) + : __d_(t.time_since_epoch()) {} + + // observer + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 duration time_since_epoch() const {return __d_;} + + // arithmetic + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 time_point& operator+=(const duration& __d) {__d_ += __d; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;} + + // special values + + _LIBCUDACXX_INLINE_VISIBILITY static constexpr time_point min() noexcept {return time_point(duration::min());} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr time_point max() noexcept {return time_point(duration::max());} +}; + +} // chrono + +template +struct _LIBCUDACXX_TEMPLATE_VIS common_type, + chrono::time_point<_Clock, _Duration2> > +{ + typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type; +}; + +namespace chrono { + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +time_point<_Clock, _ToDuration> +time_point_cast(const time_point<_Clock, _Duration>& __t) +{ + return time_point<_Clock, _ToDuration>(_CUDA_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch())); +} + +#if _LIBCUDACXX_STD_VER > 11 +template +inline _LIBCUDACXX_INLINE_VISIBILITY constexpr +__enable_if_t +< + __is_duration<_ToDuration>::value, + time_point<_Clock, _ToDuration> +> +floor(const time_point<_Clock, _Duration>& __t) +{ + return time_point<_Clock, _ToDuration>{floor<_ToDuration>(__t.time_since_epoch())}; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY constexpr +__enable_if_t +< + __is_duration<_ToDuration>::value, + time_point<_Clock, _ToDuration> +> +ceil(const time_point<_Clock, _Duration>& __t) +{ + return time_point<_Clock, _ToDuration>{ceil<_ToDuration>(__t.time_since_epoch())}; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY constexpr +__enable_if_t +< + __is_duration<_ToDuration>::value, + time_point<_Clock, _ToDuration> +> +round(const time_point<_Clock, _Duration>& __t) +{ + return time_point<_Clock, _ToDuration>{round<_ToDuration>(__t.time_since_epoch())}; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY constexpr +__enable_if_t +< + numeric_limits<_Rep>::is_signed, + duration<_Rep, _Period> +> +abs(duration<_Rep, _Period> __d) +{ + return __d >= __d.zero() ? +__d : -__d; +} +#endif // _LIBCUDACXX_STD_VER > 11 + +// time_point == + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) +{ + return __lhs.time_since_epoch() == __rhs.time_since_epoch(); +} + +// time_point != + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) +{ + return !(__lhs == __rhs); +} + +// time_point < + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) +{ + return __lhs.time_since_epoch() < __rhs.time_since_epoch(); +} + +// time_point > + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) +{ + return __rhs < __lhs; +} + +// time_point <= + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) +{ + return !(__rhs < __lhs); +} + +// time_point >= + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) +{ + return !(__lhs < __rhs); +} + +// time_point operator+(time_point x, duration y); + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> +operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr; + return _Tr (__lhs.time_since_epoch() + __rhs); +} + +// time_point operator+(duration x, time_point y); + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +time_point<_Clock, typename common_type, _Duration2>::type> +operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) +{ + return __rhs + __lhs; +} + +// time_point operator-(time_point x, duration y); + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> +operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) +{ + typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Ret; + return _Ret(__lhs.time_since_epoch() -__rhs); +} + +// duration operator-(time_point x, time_point y); + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +typename common_type<_Duration1, _Duration2>::type +operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) +{ + return __lhs.time_since_epoch() - __rhs.time_since_epoch(); +} + +////////////////////////////////////////////////////////// +/////////////////////// clocks /////////////////////////// +////////////////////////////////////////////////////////// +class _LIBCUDACXX_TYPE_VIS system_clock +{ +public: + typedef _LIBCUDACXX_SYS_CLOCK_DURATION duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point time_point; + static _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 const bool is_steady = false; + + _LIBCUDACXX_HOST_DEVICE + static time_point now() noexcept; + _LIBCUDACXX_HOST_DEVICE + static time_t to_time_t (const time_point& __t) noexcept; + _LIBCUDACXX_HOST_DEVICE + static time_point from_time_t(time_t __t) noexcept; +}; + +#ifndef _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK +class _LIBCUDACXX_TYPE_VIS steady_clock +{ +public: + typedef nanoseconds duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point time_point; + static _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 const bool is_steady = true; + + static time_point now() noexcept; +}; + +typedef steady_clock high_resolution_clock; +#else +typedef system_clock high_resolution_clock; +#endif + +#if _LIBCUDACXX_STD_VER > 11 + +// [time.clock.file], type file_clock +using file_clock = _CUDA_VSTD_FS::_FilesystemClock; + +template +using file_time = time_point; + + +template +using sys_time = time_point; +using sys_seconds = sys_time; +using sys_days = sys_time; + +struct local_t {}; +template +using local_time = time_point; +using local_seconds = local_time; +using local_days = local_time; + +struct last_spec { explicit last_spec() = default; }; + +class day { +private: + unsigned char __d; +public: + day() = default; + _LIBCUDACXX_INLINE_VISIBILITY + explicit inline constexpr day(unsigned __val) noexcept : __d(static_cast(__val)) {} + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr day& operator++() noexcept { ++__d; return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr day operator++(int) noexcept { day __tmp = *this; ++(*this); return __tmp; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr day& operator--() noexcept { --__d; return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr day operator--(int) noexcept { day __tmp = *this; --(*this); return __tmp; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr day& operator+=(const days& __dd) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr day& operator-=(const days& __dd) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + explicit inline constexpr operator unsigned() const noexcept { return __d; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept { return __d >= 1 && __d <= 31; } + }; + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const day& __lhs, const day& __rhs) noexcept +{ return static_cast(__lhs) == static_cast(__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const day& __lhs, const day& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator< (const day& __lhs, const day& __rhs) noexcept +{ return static_cast(__lhs) < static_cast(__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator> (const day& __lhs, const day& __rhs) noexcept +{ return __rhs < __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator<=(const day& __lhs, const day& __rhs) noexcept +{ return !(__rhs < __lhs);} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator>=(const day& __lhs, const day& __rhs) noexcept +{ return !(__lhs < __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +day operator+ (const day& __lhs, const days& __rhs) noexcept +{ return day(static_cast(__lhs) + static_cast(__rhs.count())); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +day operator+ (const days& __lhs, const day& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +day operator- (const day& __lhs, const days& __rhs) noexcept +{ return __lhs + -__rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +days operator-(const day& __lhs, const day& __rhs) noexcept +{ return days(static_cast(static_cast(__lhs)) - + static_cast(static_cast(__rhs))); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr day& day::operator+=(const days& __dd) noexcept +{ *this = *this + __dd; return *this; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr day& day::operator-=(const days& __dd) noexcept +{ *this = *this - __dd; return *this; } + + +class month { +private: + unsigned char __m; +public: + month() = default; + _LIBCUDACXX_INLINE_VISIBILITY + explicit inline constexpr month(unsigned __val) noexcept : __m(static_cast(__val)) {} + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr month& operator++() noexcept { ++__m; return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr month operator++(int) noexcept { month __tmp = *this; ++(*this); return __tmp; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr month& operator--() noexcept { --__m; return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr month operator--(int) noexcept { month __tmp = *this; --(*this); return __tmp; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr month& operator+=(const months& __m1) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr month& operator-=(const months& __m1) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + explicit inline constexpr operator unsigned() const noexcept { return __m; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept { return __m >= 1 && __m <= 12; } +}; + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const month& __lhs, const month& __rhs) noexcept +{ return static_cast(__lhs) == static_cast(__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const month& __lhs, const month& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator< (const month& __lhs, const month& __rhs) noexcept +{ return static_cast(__lhs) < static_cast(__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator> (const month& __lhs, const month& __rhs) noexcept +{ return __rhs < __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator<=(const month& __lhs, const month& __rhs) noexcept +{ return !(__rhs < __lhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator>=(const month& __lhs, const month& __rhs) noexcept +{ return !(__lhs < __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month operator+ (const month& __lhs, const months& __rhs) noexcept +{ + auto const __mu = static_cast(static_cast(__lhs)) + (__rhs.count() - 1); + auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12; + return month{static_cast(__mu - __yr * 12 + 1)}; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month operator+ (const months& __lhs, const month& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month operator- (const month& __lhs, const months& __rhs) noexcept +{ return __lhs + -__rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +months operator-(const month& __lhs, const month& __rhs) noexcept +{ + auto const __dm = static_cast(__lhs) - static_cast(__rhs); + return months(__dm <= 11 ? __dm : __dm + 12); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr month& month::operator+=(const months& __dm) noexcept +{ *this = *this + __dm; return *this; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr month& month::operator-=(const months& __dm) noexcept +{ *this = *this - __dm; return *this; } + + +class year { +private: + short __y; +public: + year() = default; + _LIBCUDACXX_INLINE_VISIBILITY + explicit inline constexpr year(int __val) noexcept : __y(static_cast(__val)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year& operator++() noexcept { ++__y; return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year operator++(int) noexcept { year __tmp = *this; ++(*this); return __tmp; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year& operator--() noexcept { --__y; return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year operator--(int) noexcept { year __tmp = *this; --(*this); return __tmp; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year& operator+=(const years& __dy) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year& operator-=(const years& __dy) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year operator+() const noexcept { return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year operator-() const noexcept { return year{-__y}; } + + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool is_leap() const noexcept { return __y % 4 == 0 && (__y % 100 != 0 || __y % 400 == 0); } + _LIBCUDACXX_INLINE_VISIBILITY + explicit inline constexpr operator int() const noexcept { return __y; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr bool ok() const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + static inline constexpr year min() noexcept { return year{-32767}; } + _LIBCUDACXX_INLINE_VISIBILITY + static inline constexpr year max() noexcept { return year{ 32767}; } +}; + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const year& __lhs, const year& __rhs) noexcept +{ return static_cast(__lhs) == static_cast(__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const year& __lhs, const year& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator< (const year& __lhs, const year& __rhs) noexcept +{ return static_cast(__lhs) < static_cast(__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator> (const year& __lhs, const year& __rhs) noexcept +{ return __rhs < __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator<=(const year& __lhs, const year& __rhs) noexcept +{ return !(__rhs < __lhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator>=(const year& __lhs, const year& __rhs) noexcept +{ return !(__lhs < __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year operator+ (const year& __lhs, const years& __rhs) noexcept +{ return year(static_cast(__lhs) + __rhs.count()); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year operator+ (const years& __lhs, const year& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year operator- (const year& __lhs, const years& __rhs) noexcept +{ return __lhs + -__rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +years operator-(const year& __lhs, const year& __rhs) noexcept +{ return years{static_cast(__lhs) - static_cast(__rhs)}; } + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year& year::operator+=(const years& __dy) noexcept +{ *this = *this + __dy; return *this; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year& year::operator-=(const years& __dy) noexcept +{ *this = *this - __dy; return *this; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr bool year::ok() const noexcept +{ return static_cast(min()) <= __y && __y <= static_cast(max()); } + +class weekday_indexed; +class weekday_last; + +class weekday { +private: + unsigned char __wd; +public: + weekday() = default; + _LIBCUDACXX_INLINE_VISIBILITY + inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast(__val == 7 ? 0 : __val)) {} + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr weekday(const sys_days& __sysd) noexcept + : __wd(__weekday_from_days(__sysd.time_since_epoch().count())) {} + _LIBCUDACXX_INLINE_VISIBILITY + inline explicit constexpr weekday(const local_days& __locd) noexcept + : __wd(__weekday_from_days(__locd.time_since_epoch().count())) {} + + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr weekday& operator++() noexcept { __wd = (__wd == 6 ? 0 : __wd + 1); return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr weekday operator++(int) noexcept { weekday __tmp = *this; ++(*this); return __tmp; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr weekday& operator--() noexcept { __wd = (__wd == 0 ? 6 : __wd - 1); return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr weekday& operator+=(const days& __dd) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr weekday& operator-=(const days& __dd) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr unsigned c_encoding() const noexcept { return __wd; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr unsigned iso_encoding() const noexcept { return __wd == 0u ? 7 : __wd; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept { return __wd <= 6; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr weekday_indexed operator[](unsigned __index) const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr weekday_last operator[](last_spec) const noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + static constexpr unsigned char __weekday_from_days(int __days) noexcept; +}; + + +// https://howardhinnant.github.io/date_algorithms.html#weekday_from_days +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +unsigned char weekday::__weekday_from_days(int __days) noexcept +{ + return static_cast( + static_cast(__days >= -4 ? (__days+4) % 7 : (__days+5) % 7 + 6) + ); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept +{ return __lhs.c_encoding() == __rhs.c_encoding(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator< (const weekday& __lhs, const weekday& __rhs) noexcept +{ return __lhs.c_encoding() < __rhs.c_encoding(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept +{ return __rhs < __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator<=(const weekday& __lhs, const weekday& __rhs) noexcept +{ return !(__rhs < __lhs);} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept +{ return !(__lhs < __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept +{ + auto const __mu = static_cast(__lhs.c_encoding()) + __rhs.count(); + auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7; + return weekday{static_cast(__mu - __yr * 7)}; +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr weekday operator+(const days& __lhs, const weekday& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept +{ return __lhs + -__rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept +{ + // casts are required to work around nvcc bug 3145483 + const int __wdu = static_cast(__lhs.c_encoding()) - static_cast(__rhs.c_encoding()); + const int __wk = (__wdu >= 0 ? __wdu : __wdu-6) / 7; + return days{__wdu - __wk * 7}; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr weekday& weekday::operator+=(const days& __dd) noexcept +{ *this = *this + __dd; return *this; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr weekday& weekday::operator-=(const days& __dd) noexcept +{ *this = *this - __dd; return *this; } + + +class weekday_indexed { +private: + _CUDA_VSTD::chrono::weekday __wd; + unsigned char __idx; +public: + weekday_indexed() = default; + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr weekday_indexed(const _CUDA_VSTD::chrono::weekday& __wdval, unsigned __idxval) noexcept + : __wd{__wdval}, __idx(static_cast(__idxval)) {} + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr _CUDA_VSTD::chrono::weekday weekday() const noexcept { return __wd; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr unsigned index() const noexcept { return __idx; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept { return __wd.ok() && __idx >= 1 && __idx <= 5; } +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noexcept +{ return __lhs.weekday() == __rhs.weekday() && __lhs.index() == __rhs.index(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noexcept +{ return !(__lhs == __rhs); } + + +class weekday_last { +private: + _CUDA_VSTD::chrono::weekday __wd; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr weekday_last(const _CUDA_VSTD::chrono::weekday& __val) noexcept + : __wd{__val} {} + _LIBCUDACXX_INLINE_VISIBILITY + constexpr _CUDA_VSTD::chrono::weekday weekday() const noexcept { return __wd; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr bool ok() const noexcept { return __wd.ok(); } +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept +{ return __lhs.weekday() == __rhs.weekday(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const weekday_last& __lhs, const weekday_last& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +weekday_indexed weekday::operator[](unsigned __index) const noexcept { return weekday_indexed{*this, __index}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +weekday_last weekday::operator[](last_spec) const noexcept { return weekday_last{*this}; } + + +_LIBCUDACXX_INLINE_VAR constexpr last_spec last{}; +_LIBCUDACXX_INLINE_VAR constexpr weekday Sunday{0}; +_LIBCUDACXX_INLINE_VAR constexpr weekday Monday{1}; +_LIBCUDACXX_INLINE_VAR constexpr weekday Tuesday{2}; +_LIBCUDACXX_INLINE_VAR constexpr weekday Wednesday{3}; +_LIBCUDACXX_INLINE_VAR constexpr weekday Thursday{4}; +_LIBCUDACXX_INLINE_VAR constexpr weekday Friday{5}; +_LIBCUDACXX_INLINE_VAR constexpr weekday Saturday{6}; + +_LIBCUDACXX_INLINE_VAR constexpr month January{1}; +_LIBCUDACXX_INLINE_VAR constexpr month February{2}; +_LIBCUDACXX_INLINE_VAR constexpr month March{3}; +_LIBCUDACXX_INLINE_VAR constexpr month April{4}; +_LIBCUDACXX_INLINE_VAR constexpr month May{5}; +_LIBCUDACXX_INLINE_VAR constexpr month June{6}; +_LIBCUDACXX_INLINE_VAR constexpr month July{7}; +_LIBCUDACXX_INLINE_VAR constexpr month August{8}; +_LIBCUDACXX_INLINE_VAR constexpr month September{9}; +_LIBCUDACXX_INLINE_VAR constexpr month October{10}; +_LIBCUDACXX_INLINE_VAR constexpr month November{11}; +_LIBCUDACXX_INLINE_VAR constexpr month December{12}; + + +class month_day { +private: + chrono::month __m; + chrono::day __d; +public: + month_day() = default; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept + : __m{__mval}, __d{__dval} {} + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::month month() const noexcept { return __m; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::day day() const noexcept { return __d; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr bool ok() const noexcept; +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool month_day::ok() const noexcept +{ + if (!__m.ok()) return false; + const unsigned __dval = static_cast(__d); + if (__dval < 1 || __dval > 31) return false; + if (__dval <= 29) return true; +// Now we've got either 30 or 31 + const unsigned __mval = static_cast(__m); + if (__mval == 2) return false; + if (__mval == 4 || __mval == 6 || __mval == 9 || __mval == 11) + return __dval == 30; + return true; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const month_day& __lhs, const month_day& __rhs) noexcept +{ return __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const month_day& __lhs, const month_day& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_day operator/(const month& __lhs, const day& __rhs) noexcept +{ return month_day{__lhs, __rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr +month_day operator/(const day& __lhs, const month& __rhs) noexcept +{ return __rhs / __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_day operator/(const month& __lhs, int __rhs) noexcept +{ return __lhs / day(__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr +month_day operator/(int __lhs, const day& __rhs) noexcept +{ return month(__lhs) / __rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr +month_day operator/(const day& __lhs, int __rhs) noexcept +{ return month(__rhs) / __lhs; } + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator< (const month_day& __lhs, const month_day& __rhs) noexcept +{ return __lhs.month() != __rhs.month() ? __lhs.month() < __rhs.month() : __lhs.day() < __rhs.day(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator> (const month_day& __lhs, const month_day& __rhs) noexcept +{ return __rhs < __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator<=(const month_day& __lhs, const month_day& __rhs) noexcept +{ return !(__rhs < __lhs);} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator>=(const month_day& __lhs, const month_day& __rhs) noexcept +{ return !(__lhs < __rhs); } + + + +class month_day_last { +private: + chrono::month __m; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr month_day_last(const chrono::month& __val) noexcept + : __m{__val} {} + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::month month() const noexcept { return __m; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept { return __m.ok(); } +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const month_day_last& __lhs, const month_day_last& __rhs) noexcept +{ return __lhs.month() == __rhs.month(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const month_day_last& __lhs, const month_day_last& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator< (const month_day_last& __lhs, const month_day_last& __rhs) noexcept +{ return __lhs.month() < __rhs.month(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator> (const month_day_last& __lhs, const month_day_last& __rhs) noexcept +{ return __rhs < __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator<=(const month_day_last& __lhs, const month_day_last& __rhs) noexcept +{ return !(__rhs < __lhs);} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator>=(const month_day_last& __lhs, const month_day_last& __rhs) noexcept +{ return !(__lhs < __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_day_last operator/(const month& __lhs, last_spec) noexcept +{ return month_day_last{__lhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_day_last operator/(last_spec, const month& __rhs) noexcept +{ return month_day_last{__rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_day_last operator/(int __lhs, last_spec) noexcept +{ return month_day_last{month(__lhs)}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_day_last operator/(last_spec, int __rhs) noexcept +{ return month_day_last{month(__rhs)}; } + + +class month_weekday { +private: + chrono::month __m; + chrono::weekday_indexed __wdi; +public: + month_weekday() = default; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr month_weekday(const chrono::month& __mval, const chrono::weekday_indexed& __wdival) noexcept + : __m{__mval}, __wdi{__wdival} {} + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::month month() const noexcept { return __m; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept { return __m.ok() && __wdi.ok(); } +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept +{ return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const month_weekday& __lhs, const month_weekday& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_weekday operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept +{ return month_weekday{__lhs, __rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept +{ return month_weekday{month(__lhs), __rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_weekday operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept +{ return month_weekday{__rhs, __lhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept +{ return month_weekday{month(__rhs), __lhs}; } + + +class month_weekday_last { + chrono::month __m; + chrono::weekday_last __wdl; + public: + _LIBCUDACXX_INLINE_VISIBILITY + constexpr month_weekday_last(const chrono::month& __mval, const chrono::weekday_last& __wdlval) noexcept + : __m{__mval}, __wdl{__wdlval} {} + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::month month() const noexcept { return __m; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept { return __m.ok() && __wdl.ok(); } +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept +{ return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept +{ return !(__lhs == __rhs); } + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_weekday_last operator/(const month& __lhs, const weekday_last& __rhs) noexcept +{ return month_weekday_last{__lhs, __rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept +{ return month_weekday_last{month(__lhs), __rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_weekday_last operator/(const weekday_last& __lhs, const month& __rhs) noexcept +{ return month_weekday_last{__rhs, __lhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept +{ return month_weekday_last{month(__rhs), __lhs}; } + + +class year_month { + chrono::year __y; + chrono::month __m; +public: + year_month() = default; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept + : __y{__yval}, __m{__mval} {} + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::year year() const noexcept { return __y; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::month month() const noexcept { return __m; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year_month& operator+=(const months& __dm) noexcept { this->__m += __dm; return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year_month& operator-=(const months& __dm) noexcept { this->__m -= __dm; return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year_month& operator+=(const years& __dy) noexcept { this->__y += __dy; return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year_month& operator-=(const years& __dy) noexcept { this->__y -= __dy; return *this; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok(); } +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month operator/(const year& __y, const month& __m) noexcept { return year_month{__y, __m}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month operator/(const year& __y, int __m) noexcept { return year_month{__y, month(__m)}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const year_month& __lhs, const year_month& __rhs) noexcept +{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const year_month& __lhs, const year_month& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator< (const year_month& __lhs, const year_month& __rhs) noexcept +{ return __lhs.year() != __rhs.year() ? __lhs.year() < __rhs.year() : __lhs.month() < __rhs.month(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator> (const year_month& __lhs, const year_month& __rhs) noexcept +{ return __rhs < __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator<=(const year_month& __lhs, const year_month& __rhs) noexcept +{ return !(__rhs < __lhs);} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator>=(const year_month& __lhs, const year_month& __rhs) noexcept +{ return !(__lhs < __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr year_month operator+(const year_month& __lhs, const months& __rhs) noexcept +{ + int __dmi = static_cast(static_cast(__lhs.month())) - 1 + __rhs.count(); + const int __dy = (__dmi >= 0 ? __dmi : __dmi-11) / 12; + __dmi = __dmi - __dy * 12 + 1; + return (__lhs.year() + years(__dy)) / month(static_cast(__dmi)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr year_month operator+(const months& __lhs, const year_month& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr year_month operator+(const year_month& __lhs, const years& __rhs) noexcept +{ return (__lhs.year() + __rhs) / __lhs.month(); } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr year_month operator+(const years& __lhs, const year_month& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr months operator-(const year_month& __lhs, const year_month& __rhs) noexcept +{ return (__lhs.year() - __rhs.year()) + months(static_cast(__lhs.month()) - static_cast(__rhs.month())); } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr year_month operator-(const year_month& __lhs, const months& __rhs) noexcept +{ return __lhs + -__rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr year_month operator-(const year_month& __lhs, const years& __rhs) noexcept +{ return __lhs + -__rhs; } + +class year_month_day_last; + +class year_month_day { +private: + chrono::year __y; + chrono::month __m; + chrono::day __d; +public: + year_month_day() = default; + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year_month_day( + const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept + : __y{__yval}, __m{__mval}, __d{__dval} {} + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_day(const year_month_day_last& __ymdl) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr year_month_day(const sys_days& __sysd) noexcept + : year_month_day(__from_days(__sysd.time_since_epoch())) {} + _LIBCUDACXX_INLINE_VISIBILITY + inline explicit constexpr year_month_day(const local_days& __locd) noexcept + : year_month_day(__from_days(__locd.time_since_epoch())) {} + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_day& operator+=(const months& __dm) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_day& operator-=(const months& __dm) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_day& operator+=(const years& __dy) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_day& operator-=(const years& __dy) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::year year() const noexcept { return __y; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::month month() const noexcept { return __m; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::day day() const noexcept { return __d; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } + _LIBCUDACXX_INLINE_VISIBILITY + inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr bool ok() const noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + static constexpr year_month_day __from_days(days __d) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr days __to_days() const noexcept; +}; + + +// https://howardhinnant.github.io/date_algorithms.html#civil_from_days +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day +year_month_day::__from_days(days __d) noexcept +{ + static_assert(std::numeric_limits::digits >= 18, ""); + static_assert(std::numeric_limits::digits >= 20 , ""); + const int __z = __d.count() + 719468; + const int __era = (__z >= 0 ? __z : __z - 146096) / 146097; + const unsigned __doe = static_cast(__z - __era * 146097); // [0, 146096] + const unsigned __yoe = (__doe - __doe/1460 + __doe/36524 - __doe/146096) / 365; // [0, 399] + const int __yr = static_cast(__yoe) + __era * 400; + const unsigned __doy = __doe - (365 * __yoe + __yoe/4 - __yoe/100); // [0, 365] + const unsigned __mp = (5 * __doy + 2)/153; // [0, 11] + const unsigned __dy = __doy - (153 * __mp + 2)/5 + 1; // [1, 31] + const unsigned __mth = __mp + static_cast(__mp < 10 ? 3 : -9); // [1, 12] + return year_month_day{chrono::year{__yr + (__mth <= 2)}, chrono::month{__mth}, chrono::day{__dy}}; +} + +// https://howardhinnant.github.io/date_algorithms.html#days_from_civil +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr days year_month_day::__to_days() const noexcept +{ + static_assert(std::numeric_limits::digits >= 18, ""); + static_assert(std::numeric_limits::digits >= 20 , ""); + + // nvcc doesn't allow ODR using constexpr globals. Therefore, + // make a temporary initialized from the global + auto constexpr __Feb = February; + const int __yr = static_cast(__y) - (__m <= __Feb); + const unsigned __mth = static_cast(__m); + const unsigned __dy = static_cast(__d); + + const int __era = (__yr >= 0 ? __yr : __yr - 399) / 400; + const unsigned __yoe = static_cast(__yr - __era * 400); // [0, 399] + const unsigned __doy = static_cast( + (153 * (__mth + static_cast(__mth > 2 ? -3 : 9)) + 2) / 5 + __dy-1); // [0, 365] + const unsigned __doe = __yoe * 365 + __yoe/4 - __yoe/100 + __doy; // [0, 146096] + return days{__era * 146097 + static_cast(__doe) - 719468}; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const year_month_day& __lhs, const year_month_day& __rhs) noexcept +{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const year_month_day& __lhs, const year_month_day& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator< (const year_month_day& __lhs, const year_month_day& __rhs) noexcept +{ + if (__lhs.year() < __rhs.year()) return true; + if (__lhs.year() > __rhs.year()) return false; + if (__lhs.month() < __rhs.month()) return true; + if (__lhs.month() > __rhs.month()) return false; + return __lhs.day() < __rhs.day(); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator> (const year_month_day& __lhs, const year_month_day& __rhs) noexcept +{ return __rhs < __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator<=(const year_month_day& __lhs, const year_month_day& __rhs) noexcept +{ return !(__rhs < __lhs);} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator>=(const year_month_day& __lhs, const year_month_day& __rhs) noexcept +{ return !(__lhs < __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator/(const year_month& __lhs, const day& __rhs) noexcept +{ return year_month_day{__lhs.year(), __lhs.month(), __rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator/(const year_month& __lhs, int __rhs) noexcept +{ return __lhs / day(__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator/(const year& __lhs, const month_day& __rhs) noexcept +{ return __lhs / __rhs.month() / __rhs.day(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator/(int __lhs, const month_day& __rhs) noexcept +{ return year(__lhs) / __rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator/(const month_day& __lhs, const year& __rhs) noexcept +{ return __rhs / __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator/(const month_day& __lhs, int __rhs) noexcept +{ return year(__rhs) / __lhs; } + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator+(const year_month_day& __lhs, const months& __rhs) noexcept +{ return (__lhs.year()/__lhs.month() + __rhs)/__lhs.day(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator+(const months& __lhs, const year_month_day& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator-(const year_month_day& __lhs, const months& __rhs) noexcept +{ return __lhs + -__rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator+(const year_month_day& __lhs, const years& __rhs) noexcept +{ return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator+(const years& __lhs, const year_month_day& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day operator-(const year_month_day& __lhs, const years& __rhs) noexcept +{ return __lhs + -__rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day& year_month_day::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day& year_month_day::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; } + +class year_month_day_last { +private: + chrono::year __y; + chrono::month_day_last __mdl; +public: + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_day_last(const year& __yval, const month_day_last& __mdlval) noexcept + : __y{__yval}, __mdl{__mdlval} {} + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_day_last& operator+=(const months& __m) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_day_last& operator-=(const months& __m) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_day_last& operator+=(const years& __y) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_day_last& operator-=(const years& __y) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::year year() const noexcept { return __y; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::month month() const noexcept { return __mdl.month(); } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::day day() const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr operator sys_days() const noexcept { return sys_days{year()/month()/day()}; } + _LIBCUDACXX_INLINE_VISIBILITY + inline explicit constexpr operator local_days() const noexcept { return local_days{year()/month()/day()}; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept { return __y.ok() && __mdl.ok(); } +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +chrono::day year_month_day_last::day() const noexcept +{ + constexpr chrono::day __d[] = + { + chrono::day(31), chrono::day(28), chrono::day(31), + chrono::day(30), chrono::day(31), chrono::day(30), + chrono::day(31), chrono::day(31), chrono::day(30), + chrono::day(31), chrono::day(30), chrono::day(31) + }; + + // nvcc doesn't allow ODR using constexpr globals. Therefore, + // make a temporary initialized from the global + auto constexpr __Feb = February; + return month() != __Feb || !__y.is_leap() ? + __d[static_cast(month()) - 1] : chrono::day{29}; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept +{ return __lhs.year() == __rhs.year() && __lhs.month_day_last() == __rhs.month_day_last(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator< (const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept +{ + if (__lhs.year() < __rhs.year()) return true; + if (__lhs.year() > __rhs.year()) return false; + return __lhs.month_day_last() < __rhs.month_day_last(); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator> (const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept +{ return __rhs < __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator<=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept +{ return !(__rhs < __lhs);} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator>=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept +{ return !(__lhs < __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day_last operator/(const year_month& __lhs, last_spec) noexcept +{ return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day_last operator/(const year& __lhs, const month_day_last& __rhs) noexcept +{ return year_month_day_last{__lhs, __rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day_last operator/(int __lhs, const month_day_last& __rhs) noexcept +{ return year_month_day_last{year{__lhs}, __rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day_last operator/(const month_day_last& __lhs, const year& __rhs) noexcept +{ return __rhs / __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day_last operator/(const month_day_last& __lhs, int __rhs) noexcept +{ return year{__rhs} / __lhs; } + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day_last operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept +{ return (__lhs.year() / __lhs.month() + __rhs) / last; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day_last operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day_last operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept +{ return __lhs + (-__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day_last operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept +{ return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day_last operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_day_last operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept +{ return __lhs + (-__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day_last& year_month_day_last::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day_last& year_month_day_last::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day_last& year_month_day_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day_last& year_month_day_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept + : __y{__ymdl.year()}, __m{__ymdl.month()}, __d{__ymdl.day()} {} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr bool year_month_day::ok() const noexcept +{ + if (!__y.ok() || !__m.ok()) return false; + return chrono::day{1} <= __d && __d <= (__y / __m / last).day(); +} + +class year_month_weekday { + chrono::year __y; + chrono::month __m; + chrono::weekday_indexed __wdi; +public: + year_month_weekday() = default; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday(const chrono::year& __yval, const chrono::month& __mval, + const chrono::weekday_indexed& __wdival) noexcept + : __y{__yval}, __m{__mval}, __wdi{__wdival} {} + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday(const sys_days& __sysd) noexcept + : year_month_weekday(__from_days(__sysd.time_since_epoch())) {} + _LIBCUDACXX_INLINE_VISIBILITY + inline explicit constexpr year_month_weekday(const local_days& __locd) noexcept + : year_month_weekday(__from_days(__locd.time_since_epoch())) {} + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday& operator+=(const months& m) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday& operator-=(const months& m) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday& operator+=(const years& y) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday& operator-=(const years& y) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::year year() const noexcept { return __y; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::month month() const noexcept { return __m; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::weekday weekday() const noexcept { return __wdi.weekday(); } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr unsigned index() const noexcept { return __wdi.index(); } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi; } + + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } + _LIBCUDACXX_INLINE_VISIBILITY + inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept + { + if (!__y.ok() || !__m.ok() || !__wdi.ok()) return false; + // TODO: make sure it's a valid date + return true; + } + + _LIBCUDACXX_INLINE_VISIBILITY + static constexpr year_month_weekday __from_days(days __d) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr days __to_days() const noexcept; +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday year_month_weekday::__from_days(days __d) noexcept +{ + const sys_days __sysd{__d}; + const chrono::weekday __wd = chrono::weekday(__sysd); + const year_month_day __ymd = year_month_day(__sysd); + return year_month_weekday{__ymd.year(), __ymd.month(), + __wd[(static_cast(__ymd.day())-1)/7+1]}; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +days year_month_weekday::__to_days() const noexcept +{ + const sys_days __sysd = sys_days(__y/__m/1); + return (__sysd + (__wdi.weekday() - chrono::weekday(__sysd) + days{(__wdi.index()-1)*7})) + .time_since_epoch(); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noexcept +{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noexcept +{ return !(__lhs == __rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept +{ return year_month_weekday{__lhs.year(), __lhs.month(), __rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator/(const year& __lhs, const month_weekday& __rhs) noexcept +{ return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator/(int __lhs, const month_weekday& __rhs) noexcept +{ return year(__lhs) / __rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator/(const month_weekday& __lhs, const year& __rhs) noexcept +{ return __rhs / __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator/(const month_weekday& __lhs, int __rhs) noexcept +{ return year(__rhs) / __lhs; } + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept +{ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept +{ return __lhs + (-__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept +{ return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept +{ return __lhs + (-__rhs); } + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_weekday& year_month_weekday::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_weekday& year_month_weekday::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; } + +class year_month_weekday_last { +private: + chrono::year __y; + chrono::month __m; + chrono::weekday_last __wdl; +public: + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday_last(const chrono::year& __yval, const chrono::month& __mval, + const chrono::weekday_last& __wdlval) noexcept + : __y{__yval}, __m{__mval}, __wdl{__wdlval} {} + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday_last& operator+=(const months& __dm) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday_last& operator-=(const months& __dm) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::year year() const noexcept { return __y; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::month month() const noexcept { return __m; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::weekday weekday() const noexcept { return __wdl.weekday(); } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; } + _LIBCUDACXX_INLINE_VISIBILITY + inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; } + _LIBCUDACXX_INLINE_VISIBILITY + inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok() && __wdl.ok(); } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr days __to_days() const noexcept; + +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +days year_month_weekday_last::__to_days() const noexcept +{ + const sys_days __last = sys_days{__y/__m/last}; + return (__last - (chrono::weekday{__last} - __wdl.weekday())).time_since_epoch(); + +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last& __rhs) noexcept +{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +bool operator!=(const year_month_weekday_last& __lhs, const year_month_weekday_last& __rhs) noexcept +{ return !(__lhs == __rhs); } + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept +{ return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept +{ return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator/(int __lhs, const month_weekday_last& __rhs) noexcept +{ return year(__lhs) / __rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept +{ return __rhs / __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator/(const month_weekday_last& __lhs, int __rhs) noexcept +{ return year(__rhs) / __lhs; } + + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept +{ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last(); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept +{ return __lhs + (-__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept +{ return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()}; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept +{ return __rhs + __lhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr +year_month_weekday_last operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept +{ return __lhs + (-__rhs); } + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; } +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; } + +_LIBCUDACXX_NODISCARD_ATTRIBUTE inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr unsigned __hh_mm_ss_width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0) +{ + if (__n >= 2 && __d != 0 && __w < 19) + return 1 + __hh_mm_ss_width(__n, __d % __n * 10, __w+1); + return 0; +} + +template +class hh_mm_ss +{ +private: + static_assert(__is_duration<_Duration>::value, "template parameter of hh_mm_ss must be a std::chrono::duration"); + using __CommonType = typename common_type<_Duration, chrono::seconds>::type; + + _LIBCUDACXX_INLINE_VISIBILITY + static constexpr uint64_t __pow10(unsigned __exp) + { + uint64_t __ret = 1; + for (unsigned __i = 0; __i < __exp; ++__i) + __ret *= 10U; + return __ret; + } +public: + static unsigned constexpr fractional_width = __hh_mm_ss_width(__CommonType::period::den) < 19 ? + __hh_mm_ss_width(__CommonType::period::den) : 6u; + using precision = duration>; + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {} + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr explicit hh_mm_ss(_Duration __d) noexcept : + __is_neg(__d < _Duration(0)), + __h(duration_cast (abs(__d))), + __m(duration_cast(abs(__d) - hours())), + __s(duration_cast(abs(__d) - hours() - minutes())), + __f(duration_cast (abs(__d) - hours() - minutes() - seconds())) + {} + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr bool is_negative() const noexcept { return __is_neg; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::hours hours() const noexcept { return __h; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::minutes minutes() const noexcept { return __m; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::seconds seconds() const noexcept { return __s; } + _LIBCUDACXX_INLINE_VISIBILITY + constexpr precision subseconds() const noexcept { return __f; } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr precision to_duration() const noexcept + { + auto __dur = __h + __m + __s + __f; + return __is_neg ? -__dur : __dur; + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr explicit operator precision() const noexcept { return to_duration(); } + +private: + bool __is_neg; + chrono::hours __h; + chrono::minutes __m; + chrono::seconds __s; + precision __f; +}; + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool is_am(const hours& __h) noexcept { return __h >= hours( 0) && __h < hours(12); } +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool is_pm(const hours& __h) noexcept { return __h >= hours(12) && __h < hours(24); } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr hours make12(const hours& __h) noexcept +{ + if (__h == hours( 0)) return hours(12); + else if (__h <= hours(12)) return __h; + else return __h - hours(12); +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr hours make24(const hours& __h, bool __is_pm) noexcept +{ + if (__is_pm) + return __h == hours(12) ? __h : __h + hours(12); + else + return __h == hours(12) ? hours(0) : __h; +} +#endif // _LIBCUDACXX_STD_VER > 11 +} // chrono +#if _LIBCUDACXX_STD_VER > 11 + +// GCC 5 and 6 warn (and then error) on us using the standard reserved UDL names, +// but have no way of disabling that. Use the system_header pragma on those GCC versions +// for the remainder of this file, even if it has been requested to disable the pragma +// earlier. +#if defined(_LIBCUDACXX_COMPILER_GCC) && (__GNUC__ == 5 || __GNUC__ == 6) +#pragma GCC system_header +#endif + +_CCCL_DIAG_PUSH +_CCCL_DIAG_SUPPRESS_GCC("-Wliteral-suffix") +_CCCL_DIAG_SUPPRESS_CLANG("-Wuser-defined-literals") +_CCCL_DIAG_SUPPRESS_MSVC(4455) +// Suffixes for duration literals [time.duration.literals] +inline namespace literals +{ + inline namespace chrono_literals + { + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::hours operator""h(unsigned long long __h) + { + return chrono::hours(static_cast(__h)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T, ratio<3600,1>> operator""h(long double __h) + { + return chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T, ratio<3600,1>>(__h); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::minutes operator""min(unsigned long long __m) + { + return chrono::minutes(static_cast(__m)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T, ratio<60,1>> operator""min(long double __m) + { + return chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T, ratio<60,1>> (__m); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::seconds operator""s(unsigned long long __s) + { + return chrono::seconds(static_cast(__s)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T> operator""s(long double __s) + { + return chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T> (__s); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::milliseconds operator""ms(unsigned long long __ms) + { + return chrono::milliseconds(static_cast(__ms)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T, milli> operator""ms(long double __ms) + { + return chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T, milli>(__ms); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::microseconds operator""us(unsigned long long __us) + { + return chrono::microseconds(static_cast(__us)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T, micro> operator""us(long double __us) + { + return chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T, micro> (__us); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) + { + return chrono::nanoseconds(static_cast(__ns)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T, nano> operator""ns(long double __ns) + { + return chrono::duration<_LIBCUDACXX_CHRONO_LITERAL_INTERNAL_T, nano> (__ns); + } + +#if _LIBCUDACXX_STD_VER > 17 && !defined(_LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS) + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::day operator""d(unsigned long long __d) noexcept + { + return chrono::day(static_cast(__d)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr chrono::year operator""y(unsigned long long __y) noexcept + { + return chrono::year(static_cast(__y)); + } +#endif //_LIBCUDACXX_STD_VER > 17 && !defined(_LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS) +}} + +_CCCL_DIAG_POP + +namespace chrono { // hoist the literals into namespace std::chrono + using namespace literals::chrono_literals; +} + +#endif // _LIBCUDACXX_STD_VER > 11 + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ + +_LIBCUDACXX_BEGIN_NAMESPACE_FILESYSTEM +struct _FilesystemClock { +#if !defined(_LIBCUDACXX_HAS_NO_INT128) + typedef __int128_t rep; + typedef nano period; +#else + typedef long long rep; + typedef nano period; +#endif + + typedef chrono::duration duration; + typedef chrono::time_point<_FilesystemClock> time_point; + + _LIBCUDACXX_EXPORTED_FROM_ABI + static _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 const bool is_steady = false; + + _LIBCUDACXX_AVAILABILITY_FILESYSTEM _LIBCUDACXX_FUNC_VIS static time_point now() noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + static time_t to_time_t(const time_point& __t) noexcept { + typedef chrono::duration __secs; + return time_t( + chrono::duration_cast<__secs>(__t.time_since_epoch()).count()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + static time_point from_time_t(time_t __t) noexcept { + typedef chrono::duration __secs; + return time_point(__secs(__t)); + } +}; +_LIBCUDACXX_END_NAMESPACE_FILESYSTEM +#endif // __cuda_std__ + +_LIBCUDACXX_NV_DIAG_DEFAULT(cuda_demote_unsupported_floating_point) + +#ifndef __cuda_std__ +#include <__pragma_pop> +#else +#include "__cuda/chrono.h" +#endif // __cuda_std__ + +#endif // _LIBCUDACXX_CHRONO diff --git a/cuda_toolkit/include/cinttypes b/cuda_toolkit/include/cinttypes new file mode 100644 index 0000000000000000000000000000000000000000..e653519672c4f4fdb8d462638f20eec8d5eb09c1 --- /dev/null +++ b/cuda_toolkit/include/cinttypes @@ -0,0 +1,262 @@ +// -*- C++ -*- +//===--------------------------- cinttypes --------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CINTTYPES +#define _LIBCUDACXX_CINTTYPES + +/* + cinttypes synopsis + +This entire header is C99 / C++0X + +#include // includes + +Macros: + + PRId8 + PRId16 + PRId32 + PRId64 + + PRIdLEAST8 + PRIdLEAST16 + PRIdLEAST32 + PRIdLEAST64 + + PRIdFAST8 + PRIdFAST16 + PRIdFAST32 + PRIdFAST64 + + PRIdMAX + PRIdPTR + + PRIi8 + PRIi16 + PRIi32 + PRIi64 + + PRIiLEAST8 + PRIiLEAST16 + PRIiLEAST32 + PRIiLEAST64 + + PRIiFAST8 + PRIiFAST16 + PRIiFAST32 + PRIiFAST64 + + PRIiMAX + PRIiPTR + + PRIo8 + PRIo16 + PRIo32 + PRIo64 + + PRIoLEAST8 + PRIoLEAST16 + PRIoLEAST32 + PRIoLEAST64 + + PRIoFAST8 + PRIoFAST16 + PRIoFAST32 + PRIoFAST64 + + PRIoMAX + PRIoPTR + + PRIu8 + PRIu16 + PRIu32 + PRIu64 + + PRIuLEAST8 + PRIuLEAST16 + PRIuLEAST32 + PRIuLEAST64 + + PRIuFAST8 + PRIuFAST16 + PRIuFAST32 + PRIuFAST64 + + PRIuMAX + PRIuPTR + + PRIx8 + PRIx16 + PRIx32 + PRIx64 + + PRIxLEAST8 + PRIxLEAST16 + PRIxLEAST32 + PRIxLEAST64 + + PRIxFAST8 + PRIxFAST16 + PRIxFAST32 + PRIxFAST64 + + PRIxMAX + PRIxPTR + + PRIX8 + PRIX16 + PRIX32 + PRIX64 + + PRIXLEAST8 + PRIXLEAST16 + PRIXLEAST32 + PRIXLEAST64 + + PRIXFAST8 + PRIXFAST16 + PRIXFAST32 + PRIXFAST64 + + PRIXMAX + PRIXPTR + + SCNd8 + SCNd16 + SCNd32 + SCNd64 + + SCNdLEAST8 + SCNdLEAST16 + SCNdLEAST32 + SCNdLEAST64 + + SCNdFAST8 + SCNdFAST16 + SCNdFAST32 + SCNdFAST64 + + SCNdMAX + SCNdPTR + + SCNi8 + SCNi16 + SCNi32 + SCNi64 + + SCNiLEAST8 + SCNiLEAST16 + SCNiLEAST32 + SCNiLEAST64 + + SCNiFAST8 + SCNiFAST16 + SCNiFAST32 + SCNiFAST64 + + SCNiMAX + SCNiPTR + + SCNo8 + SCNo16 + SCNo32 + SCNo64 + + SCNoLEAST8 + SCNoLEAST16 + SCNoLEAST32 + SCNoLEAST64 + + SCNoFAST8 + SCNoFAST16 + SCNoFAST32 + SCNoFAST64 + + SCNoMAX + SCNoPTR + + SCNu8 + SCNu16 + SCNu32 + SCNu64 + + SCNuLEAST8 + SCNuLEAST16 + SCNuLEAST32 + SCNuLEAST64 + + SCNuFAST8 + SCNuFAST16 + SCNuFAST32 + SCNuFAST64 + + SCNuMAX + SCNuPTR + + SCNx8 + SCNx16 + SCNx32 + SCNx64 + + SCNxLEAST8 + SCNxLEAST16 + SCNxLEAST32 + SCNxLEAST64 + + SCNxFAST8 + SCNxFAST16 + SCNxFAST32 + SCNxFAST64 + + SCNxMAX + SCNxPTR + +namespace std +{ + +Types: + + imaxdiv_t + +intmax_t imaxabs(intmax_t j); +imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom); +intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base); +uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base); +intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); +uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); + +} // std +*/ + +#include <__config> +#include + +#include "cstdint" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using::imaxdiv_t; +using::imaxabs; +using::imaxdiv; +using::strtoimax; +using::strtoumax; +using::wcstoimax; +using::wcstoumax; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_CINTTYPES diff --git a/cuda_toolkit/include/ciso646 b/cuda_toolkit/include/ciso646 new file mode 100644 index 0000000000000000000000000000000000000000..40beccb215b48ae2d667baba7a3a27464bd2b406 --- /dev/null +++ b/cuda_toolkit/include/ciso646 @@ -0,0 +1,24 @@ +// -*- C++ -*- +//===--------------------------- ciso646 ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CISO646 +#define _LIBCUDACXX_CISO646 + +/* + ciso646 synopsis + +*/ + +#ifndef __cuda_std__ +#include <__config> +#include <__pragma_push> +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_CISO646 diff --git a/cuda_toolkit/include/climits b/cuda_toolkit/include/climits new file mode 100644 index 0000000000000000000000000000000000000000..2a12d6ac2696e385f813d7cfbdb72b3f7b5b9614 --- /dev/null +++ b/cuda_toolkit/include/climits @@ -0,0 +1,79 @@ +// -*- C++ -*- +//===--------------------------- climits ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CLIMITS +#define _LIBCUDACXX_CLIMITS + +/* + climits synopsis + +Macros: + + CHAR_BIT + SCHAR_MIN + SCHAR_MAX + UCHAR_MAX + CHAR_MIN + CHAR_MAX + MB_LEN_MAX + SHRT_MIN + SHRT_MAX + USHRT_MAX + INT_MIN + INT_MAX + UINT_MAX + LONG_MIN + LONG_MAX + ULONG_MAX + LLONG_MIN // C99 + LLONG_MAX // C99 + ULLONG_MAX // C99 + +*/ + +#ifndef __cuda_std__ +#include <__config> +#else +#include "__cuda/climits_prelude.h" +#endif //__cuda_std__ + +#ifndef __cuda_std__ +#include +#include <__pragma_push> +#endif //__cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#if defined(_LIBCUDACXX_COMPILER_MSVC) +#include "support/win32/limits_msvc_win32.h" +#endif // _LIBCUDACXX_MSVCRT + +#if defined(_LIBCUDACXX_COMPILER_IBM) +#include "support/ibm/limits.h" +#endif // _LIBCUDACXX_COMPILER_IBM + +// ICC defines __CHAR_BIT__ by default +// accept that, but assert it is what we expect +#ifdef __CHAR_BIT__ + static_assert(__CHAR_BIT__ == 8, ""); +#else + #define __CHAR_BIT__ 8 +#endif + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_CLIMITS diff --git a/cuda_toolkit/include/clocale b/cuda_toolkit/include/clocale new file mode 100644 index 0000000000000000000000000000000000000000..45baa98b3803873f1206f48472d1c84db5497224 --- /dev/null +++ b/cuda_toolkit/include/clocale @@ -0,0 +1,58 @@ +// -*- C++ -*- +//===--------------------------- clocale ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CLOCALE +#define _LIBCUDACXX_CLOCALE + +/* + clocale synopsis + +Macros: + + LC_ALL + LC_COLLATE + LC_CTYPE + LC_MONETARY + LC_NUMERIC + LC_TIME + NULL + +namespace std +{ + +struct lconv; +char* setlocale(int category, const char* locale); +lconv* localeconv(); + +} // std + +*/ + +#include <__config> +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::lconv; +#ifndef _LIBCUDACXX_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS +using ::setlocale; +#endif +using ::localeconv; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_CLOCALE diff --git a/cuda_toolkit/include/cmath b/cuda_toolkit/include/cmath new file mode 100644 index 0000000000000000000000000000000000000000..422f2f19dcfd8a8c7da2afd3df5d604616ce7571 --- /dev/null +++ b/cuda_toolkit/include/cmath @@ -0,0 +1,981 @@ +// -*- C++ -*- +//===---------------------------- cmath -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CMATH +#define _LIBCUDACXX_CMATH + +/* + cmath synopsis + +Macros: + + HUGE_VAL + HUGE_VALF // C99 + HUGE_VALL // C99 + INFINITY // C99 + NAN // C99 + FP_INFINITE // C99 + FP_NAN // C99 + FP_NORMAL // C99 + FP_SUBNORMAL // C99 + FP_ZERO // C99 + FP_FAST_FMA // C99 + FP_FAST_FMAF // C99 + FP_FAST_FMAL // C99 + FP_ILOGB0 // C99 + FP_ILOGBNAN // C99 + MATH_ERRNO // C99 + MATH_ERREXCEPT // C99 + math_errhandling // C99 + +namespace std +{ + +Types: + + float_t // C99 + double_t // C99 + +// C90 + +floating_point abs(floating_point x); + +floating_point acos (arithmetic x); +float acosf(float x); +long double acosl(long double x); + +floating_point asin (arithmetic x); +float asinf(float x); +long double asinl(long double x); + +floating_point atan (arithmetic x); +float atanf(float x); +long double atanl(long double x); + +floating_point atan2 (arithmetic y, arithmetic x); +float atan2f(float y, float x); +long double atan2l(long double y, long double x); + +floating_point ceil (arithmetic x); +float ceilf(float x); +long double ceill(long double x); + +floating_point cos (arithmetic x); +float cosf(float x); +long double cosl(long double x); + +floating_point cosh (arithmetic x); +float coshf(float x); +long double coshl(long double x); + +floating_point exp (arithmetic x); +float expf(float x); +long double expl(long double x); + +floating_point fabs (arithmetic x); +float fabsf(float x); +long double fabsl(long double x); + +floating_point floor (arithmetic x); +float floorf(float x); +long double floorl(long double x); + +floating_point fmod (arithmetic x, arithmetic y); +float fmodf(float x, float y); +long double fmodl(long double x, long double y); + +floating_point frexp (arithmetic value, int* exp); +float frexpf(float value, int* exp); +long double frexpl(long double value, int* exp); + +floating_point ldexp (arithmetic value, int exp); +float ldexpf(float value, int exp); +long double ldexpl(long double value, int exp); + +floating_point log (arithmetic x); +float logf(float x); +long double logl(long double x); + +floating_point log10 (arithmetic x); +float log10f(float x); +long double log10l(long double x); + +floating_point modf (floating_point value, floating_point* iptr); +float modff(float value, float* iptr); +long double modfl(long double value, long double* iptr); + +floating_point pow (arithmetic x, arithmetic y); +float powf(float x, float y); +long double powl(long double x, long double y); + +floating_point sin (arithmetic x); +float sinf(float x); +long double sinl(long double x); + +floating_point sinh (arithmetic x); +float sinhf(float x); +long double sinhl(long double x); + +floating_point sqrt (arithmetic x); +float sqrtf(float x); +long double sqrtl(long double x); + +floating_point tan (arithmetic x); +float tanf(float x); +long double tanl(long double x); + +floating_point tanh (arithmetic x); +float tanhf(float x); +long double tanhl(long double x); + +// C99 + +bool signbit(arithmetic x); + +int fpclassify(arithmetic x); + +bool isfinite(arithmetic x); +bool isinf(arithmetic x); +bool isnan(arithmetic x); +bool isnormal(arithmetic x); + +bool isgreater(arithmetic x, arithmetic y); +bool isgreaterequal(arithmetic x, arithmetic y); +bool isless(arithmetic x, arithmetic y); +bool islessequal(arithmetic x, arithmetic y); +bool islessgreater(arithmetic x, arithmetic y); +bool isunordered(arithmetic x, arithmetic y); + +floating_point acosh (arithmetic x); +float acoshf(float x); +long double acoshl(long double x); + +floating_point asinh (arithmetic x); +float asinhf(float x); +long double asinhl(long double x); + +floating_point atanh (arithmetic x); +float atanhf(float x); +long double atanhl(long double x); + +floating_point cbrt (arithmetic x); +float cbrtf(float x); +long double cbrtl(long double x); + +floating_point copysign (arithmetic x, arithmetic y); +float copysignf(float x, float y); +long double copysignl(long double x, long double y); + +floating_point erf (arithmetic x); +float erff(float x); +long double erfl(long double x); + +floating_point erfc (arithmetic x); +float erfcf(float x); +long double erfcl(long double x); + +floating_point exp2 (arithmetic x); +float exp2f(float x); +long double exp2l(long double x); + +floating_point expm1 (arithmetic x); +float expm1f(float x); +long double expm1l(long double x); + +floating_point fdim (arithmetic x, arithmetic y); +float fdimf(float x, float y); +long double fdiml(long double x, long double y); + +floating_point fma (arithmetic x, arithmetic y, arithmetic z); +float fmaf(float x, float y, float z); +long double fmal(long double x, long double y, long double z); + +floating_point fmax (arithmetic x, arithmetic y); +float fmaxf(float x, float y); +long double fmaxl(long double x, long double y); + +floating_point fmin (arithmetic x, arithmetic y); +float fminf(float x, float y); +long double fminl(long double x, long double y); + +floating_point hypot (arithmetic x, arithmetic y); +float hypotf(float x, float y); +long double hypotl(long double x, long double y); + +double hypot(double x, double y, double z); // C++17 +float hypot(float x, float y, float z); // C++17 +long double hypot(long double x, long double y, long double z); // C++17 + +int ilogb (arithmetic x); +int ilogbf(float x); +int ilogbl(long double x); + +floating_point lgamma (arithmetic x); +float lgammaf(float x); +long double lgammal(long double x); + +long long llrint (arithmetic x); +long long llrintf(float x); +long long llrintl(long double x); + +long long llround (arithmetic x); +long long llroundf(float x); +long long llroundl(long double x); + +floating_point log1p (arithmetic x); +float log1pf(float x); +long double log1pl(long double x); + +floating_point log2 (arithmetic x); +float log2f(float x); +long double log2l(long double x); + +floating_point logb (arithmetic x); +float logbf(float x); +long double logbl(long double x); + +long lrint (arithmetic x); +long lrintf(float x); +long lrintl(long double x); + +long lround (arithmetic x); +long lroundf(float x); +long lroundl(long double x); + +double nan (const char* str); +float nanf(const char* str); +long double nanl(const char* str); + +floating_point nearbyint (arithmetic x); +float nearbyintf(float x); +long double nearbyintl(long double x); + +floating_point nextafter (arithmetic x, arithmetic y); +float nextafterf(float x, float y); +long double nextafterl(long double x, long double y); + +floating_point nexttoward (arithmetic x, long double y); +float nexttowardf(float x, long double y); +long double nexttowardl(long double x, long double y); + +floating_point remainder (arithmetic x, arithmetic y); +float remainderf(float x, float y); +long double remainderl(long double x, long double y); + +floating_point remquo (arithmetic x, arithmetic y, int* pquo); +float remquof(float x, float y, int* pquo); +long double remquol(long double x, long double y, int* pquo); + +floating_point rint (arithmetic x); +float rintf(float x); +long double rintl(long double x); + +floating_point round (arithmetic x); +float roundf(float x); +long double roundl(long double x); + +floating_point scalbln (arithmetic x, long ex); +float scalblnf(float x, long ex); +long double scalblnl(long double x, long ex); + +floating_point scalbn (arithmetic x, int ex); +float scalbnf(float x, int ex); +long double scalbnl(long double x, int ex); + +floating_point tgamma (arithmetic x); +float tgammaf(float x); +long double tgammal(long double x); + +floating_point trunc (arithmetic x); +float truncf(float x); +long double truncl(long double x); + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#endif // __cuda_std__ + +#if !defined(__CUDACC_RTC__) || !defined(__cuda_std__) +#include +#endif + +#if defined(__cuda_std__) && defined(_LIBCUDACXX_COMPILER_NVHPC) +#include +#endif + +#include "limits" +#include "type_traits" +#include "version" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#ifdef _LIBCUDACXX_COMPILER_NVRTC +#include "climits" +#define INFINITY __builtin_huge_val() +#define NAN __builtin_nan() +#endif + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::signbit; +using ::isfinite; +using ::isinf; +using ::isnan; + +using ::acos; +using ::acosf; +using ::asin; +using ::asinf; +using ::atan; +using ::atanf; +using ::atan2; +using ::atan2f; +using ::ceil; +using ::ceilf; +using ::cos; +using ::cosf; +using ::cosh; +using ::coshf; + +using ::exp; +using ::expf; + +using ::pow; +using ::powf; + +using ::sin; +using ::sinf; +using ::sinh; +using ::sinhf; + +using ::sqrt; +using ::sqrtf; +using ::tan; +using ::tanf; + +using ::tanh; +using ::tanhf; + +using ::acosh; +using ::acoshf; +using ::asinh; +using ::asinhf; +using ::atanh; +using ::atanhf; + +using ::log; +using ::logf; + +using ::hypot; +using ::hypotf; + +#ifndef _AIX +using ::abs; +#endif + +#ifndef _LIBCUDACXX_COMPILER_NVRTC + +using ::fpclassify; +using ::isnormal; +using ::isgreater; +using ::isgreaterequal; +using ::isless; +using ::islessequal; +using ::islessgreater; + +using ::isunordered; + +using ::float_t; +using ::double_t; + +using ::fabs; +using ::fabsf; +using ::floor; +using ::floorf; + +using ::fmod; +using ::fmodf; + +using ::frexp; +using ::frexpf; +using ::ldexp; +using ::ldexpf; + +using ::log; +using ::logf; + +using ::log10; +using ::log10f; +using ::modf; +using ::modff; + +using ::pow; +using ::powf; + +using ::sin; +using ::sinf; +using ::sinh; +using ::sinhf; + +using ::sqrt; +using ::sqrtf; +using ::tan; +using ::tanf; + +using ::tanh; +using ::tanhf; + +using ::acosh; +using ::acoshf; +using ::asinh; +using ::asinhf; +using ::atanh; +using ::atanhf; +using ::cbrt; +using ::cbrtf; + +using ::copysign; +using ::copysignf; + +using ::erf; +using ::erff; +using ::erfc; +using ::erfcf; +using ::exp2; +using ::exp2f; +using ::expm1; +using ::expm1f; +using ::fdim; +using ::fdimf; +using ::fmaf; +using ::fma; +using ::fmax; +using ::fmaxf; +using ::fmin; +using ::fminf; +using ::ilogb; +using ::ilogbf; +using ::lgamma; +using ::lgammaf; +using ::llrint; +using ::llrintf; +using ::llround; +using ::llroundf; +using ::log1p; +using ::log1pf; +using ::log2; +using ::log2f; +using ::logb; +using ::logbf; +using ::lrint; +using ::lrintf; +using ::lround; +using ::lroundf; + +using ::nan; +using ::nanf; + +using ::nearbyint; +using ::nearbyintf; +using ::nextafter; +using ::nextafterf; +using ::nexttoward; +using ::nexttowardf; +using ::remainder; +using ::remainderf; +using ::remquo; +using ::remquof; +using ::rint; +using ::rintf; +using ::round; +using ::roundf; +using ::scalbln; +using ::scalblnf; +using ::scalbn; +using ::scalbnf; +using ::tgamma; +using ::tgammaf; +using ::trunc; +using ::truncf; + +using ::acosl; +using ::asinl; +using ::atanl; +using ::atan2l; +using ::ceill; +using ::cosl; +using ::coshl; +using ::expl; +using ::fabsl; +using ::floorl; +using ::fmodl; +using ::frexpl; +using ::ldexpl; +using ::logl; +using ::log10l; +using ::modfl; +using ::powl; +using ::sinl; +using ::sinhl; +using ::sqrtl; +using ::tanl; + +using ::tanhl; +using ::acoshl; +using ::asinhl; +using ::atanhl; +using ::cbrtl; + +using ::copysignl; + +using ::erfl; +using ::erfcl; +using ::exp2l; +using ::expm1l; +using ::fdiml; +using ::fmal; +using ::fmaxl; +using ::fminl; +using ::hypotl; +using ::ilogbl; +using ::lgammal; +using ::llrintl; +using ::llroundl; +using ::log1pl; +using ::log2l; +using ::logbl; +using ::lrintl; +using ::lroundl; +using ::nanl; +using ::nearbyintl; +using ::nextafterl; +using ::nexttowardl; +using ::remainderl; +using ::remquol; +using ::rintl; +using ::roundl; +using ::scalblnl; +using ::scalbnl; +using ::tgammal; +using ::truncl; + +#endif // _LIBCUDACXX_COMPILER_NVRTC + +#if _LIBCUDACXX_STD_VER > 14 && !defined(__cuda_std__) +inline _LIBCUDACXX_INLINE_VISIBILITY float hypot( float x, float y, float z ) { return sqrt(x*x + y*y + z*z); } +inline _LIBCUDACXX_INLINE_VISIBILITY double hypot( double x, double y, double z ) { return sqrt(x*x + y*y + z*z); } +#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE +inline _LIBCUDACXX_INLINE_VISIBILITY long double hypot( long double x, long double y, long double z ) { return sqrt(x*x + y*y + z*z); } +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_arithmetic<_A1>::value && + is_arithmetic<_A2>::value && + is_arithmetic<_A3>::value, + __promote<_A1, _A2, _A3> +> +hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) noexcept +{ + typedef typename __promote<_A1, _A2, _A3>::type __result_type; + static_assert((!(is_same<_A1, __result_type>::value && + is_same<_A2, __result_type>::value && + is_same<_A3, __result_type>::value)), ""); + return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); +} +#endif + +#ifndef _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS +#define _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +#else +#define _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX +#endif // _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS + +template +_LIBCUDACXX_INLINE_VISIBILITY +constexpr __enable_if_t::value, bool> +__constexpr_isnan(_A1 __lcpp_x) noexcept +{ +#if defined(_LIBCUDACXX_CUDACC_BELOW_11_8) + return __isnan(__lcpp_x); +#elif __has_builtin(__builtin_isnan) + return __builtin_isnan(__lcpp_x); +#else + return isnan(__lcpp_x); +#endif +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +constexpr __enable_if_t::value, bool> +__constexpr_isnan(_A1 __lcpp_x) noexcept +{ + return isnan(__lcpp_x); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +constexpr __enable_if_t::value, bool> +__constexpr_isinf(_A1 __lcpp_x) noexcept +{ +#if defined(_LIBCUDACXX_CUDACC_BELOW_11_8) + return __isinf(__lcpp_x); +#elif __has_builtin(__builtin_isinf) + return __builtin_isinf(__lcpp_x); +#else + return isinf(__lcpp_x); +#endif +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +constexpr __enable_if_t::value, bool> +__constexpr_isinf(_A1 __lcpp_x) noexcept +{ + return isinf(__lcpp_x); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +constexpr __enable_if_t::value, bool> +__constexpr_isfinite(_A1 __lcpp_x) noexcept +{ +#if defined(_LIBCUDACXX_CUDACC_BELOW_11_8) + return !__isinf(__lcpp_x) && !__isnan(__lcpp_x); +#elif __has_builtin(__builtin_isfinite) + return __builtin_isfinite(__lcpp_x); +#else + return isfinite(__lcpp_x); +#endif +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +constexpr __enable_if_t::value, bool> +__constexpr_isfinite(_A1 __lcpp_x) noexcept +{ + return isfinite(__lcpp_x); +} + +#if defined(_MSC_VER) || defined(__CUDACC_RTC__) || defined(_LIBCUDACXX_COMPILER_CLANG_CUDA) +template +_LIBCUDACXX_INLINE_VISIBILITY +_A1 __constexpr_copysign(_A1 __x, _A1 __y) noexcept +{ + return copysign(__x, __y); +} +#else +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 float __constexpr_copysign(float __x, float __y) noexcept { + return __builtin_copysignf(__x, __y); +} + +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 double __constexpr_copysign(double __x, double __y) noexcept { + return __builtin_copysign(__x, __y); +} + +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 long double __constexpr_copysign(long double __x, long double __y) noexcept { + return __builtin_copysignl(__x, __y); +} + +template +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 typename __enable_if_t::value && is_arithmetic<_A2>::value, + __promote<_A1, _A2> >::type + __constexpr_copysign(_A1 __x, _A2 __y) noexcept { + typedef typename __promote<_A1, _A2>::type __result_type; + static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), ""); + return __builtin_copysign((__result_type)__x, (__result_type)__y); +} +#endif // !_MSC_VER + +#if defined(_MSC_VER) || defined(__CUDACC_RTC__) || defined(_LIBCUDACXX_COMPILER_CLANG_CUDA) +template +_LIBCUDACXX_INLINE_VISIBILITY +_A1 __constexpr_fabs(_A1 __x) noexcept +{ + return fabs(__x); +} +#else +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 float __constexpr_fabs(float __x) noexcept { + return __builtin_fabsf(__x); +} + +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 double __constexpr_fabs(double __x) noexcept { + return __builtin_fabs(__x); +} + +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 long double __constexpr_fabs(long double __x) noexcept { + return __builtin_fabsl(__x); +} + +template ::value, int> = 0> +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 double __constexpr_fabs(_Tp __x) noexcept { + return __builtin_fabs(static_cast(__x)); +} +#endif // !_MSC_VER + +#if defined(_MSC_VER) || defined(__CUDACC_RTC__) || defined(_LIBCUDACXX_COMPILER_CLANG_CUDA) +template +_LIBCUDACXX_INLINE_VISIBILITY +_A1 __constexpr_fmax(_A1 __x, _A1 __y) noexcept +{ + return fmax(__x, __y); +} +#else +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX float __constexpr_fmax(float __x, float __y) noexcept { +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(_LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS) + if (_LIBCUDACXX_IS_CONSTANT_EVALUATED()) { + if (__constexpr_isnan(__x)) + return __y; + if (__constexpr_isnan(__y)) + return __x; + return __x < __y ? __y : __x; + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) + return __builtin_fmaxf(__x, __y); +} + +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX double __constexpr_fmax(double __x, double __y) noexcept { +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(_LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS) + if (_LIBCUDACXX_IS_CONSTANT_EVALUATED()) { + if (__constexpr_isnan(__x)) + return __y; + if (__constexpr_isnan(__y)) + return __x; + return __x < __y ? __y : __x; + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) + return __builtin_fmax(__x, __y); +} + +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX long double __constexpr_fmax(long double __x, long double __y) noexcept { +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(_LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS) + if (_LIBCUDACXX_IS_CONSTANT_EVALUATED()) { + if (__constexpr_isnan(__x)) + return __y; + if (__constexpr_isnan(__y)) + return __x; + return __x < __y ? __y : __x; + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) + return __builtin_fmax(__x, __y); +} + +template ::value && is_arithmetic<_Up>::value, int> = 0> +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX typename __promote<_Tp, _Up>::type +__constexpr_fmax(_Tp __x, _Up __y) noexcept { + using __result_type = typename __promote<_Tp, _Up>::type; + return _CUDA_VSTD::__constexpr_fmax(static_cast<__result_type>(__x), static_cast<__result_type>(__y)); +} +#endif // !_MSC_VER + +#if defined(_MSC_VER) || defined(__CUDACC_RTC__) || defined(_LIBCUDACXX_COMPILER_CLANG_CUDA) +template +_LIBCUDACXX_INLINE_VISIBILITY +_A1 __constexpr_logb(_A1 __x) +{ + return logb(__x); +} +#else +template +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX _Tp __constexpr_logb(_Tp __x) { +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(_LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS) + if (_LIBCUDACXX_IS_CONSTANT_EVALUATED()) { + if (__x == _Tp(0)) { + // raise FE_DIVBYZERO + return -numeric_limits<_Tp>::infinity(); + } + + if (__constexpr_isinf(__x)) + return numeric_limits<_Tp>::infinity(); + + if (__constexpr_isnan(__x)) + return numeric_limits<_Tp>::quiet_NaN(); + + __x = __constexpr_fabs(__x); + unsigned long long __exp = 0; + while (__x >= numeric_limits<_Tp>::radix) { + __x /= numeric_limits<_Tp>::radix; + __exp += 1; + } + return _Tp(__exp); + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) + return __builtin_logb(__x); +} +#endif // !_MSVC + +#if defined(_MSC_VER) || defined(__CUDACC_RTC__) || defined(_LIBCUDACXX_COMPILER_CLANG_CUDA) +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_Tp __constexpr_scalbn(_Tp __x, int __i) { + return static_cast<_Tp>(scalbn(static_cast(__x), __i)); +} + +template <> +inline _LIBCUDACXX_INLINE_VISIBILITY +float __constexpr_scalbn(float __x, int __i) { + return scalbnf(__x, __i); +} + +template <> +inline _LIBCUDACXX_INLINE_VISIBILITY +double __constexpr_scalbn(double __x, int __i) { + return scalbn(__x, __i); +} + +#ifndef _LIBCUDACXX_HAS_NO_LONG_DOUBLE +template <> +inline _LIBCUDACXX_INLINE_VISIBILITY +long double __constexpr_scalbn(long double __x, int __i) { + return scalbnl(__x, __i); +} +#endif // _LIBCUDACXX_HAS_NO_LONG_DOUBLE +#else +template +inline _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX _Tp __constexpr_scalbn(_Tp __x, int __exp) { +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) && !defined(_LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS) + if (_LIBCUDACXX_IS_CONSTANT_EVALUATED()) { + if (__x == _Tp(0)) + return __x; + + if (__constexpr_isinf(__x)) + return __x; + + if (__exp == _Tp(0)) + return __x; + + if (__constexpr_isnan(__x)) + return numeric_limits<_Tp>::quiet_NaN(); + + _Tp __mult(1); + if (__exp > 0) { + __mult = numeric_limits<_Tp>::radix; + --__exp; + } else { + ++__exp; + __exp = -__exp; + __mult /= numeric_limits<_Tp>::radix; + } + + while (__exp > 0) { + if (!(__exp & 1)) { + __mult *= __mult; + __exp >>= 1; + } else { + __x *= __mult; + --__exp; + } + } + return __x; + } +#endif // defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) + return __builtin_scalbn(__x, __exp); +} +#endif // !_MSC_VER + +#if _LIBCUDACXX_STD_VER > 17 +template +_LIBCUDACXX_INLINE_VISIBILITY +constexpr _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept { + if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0)) + return __t * __b + (1 - __t) * __a; + + if (__t == 1) return __b; + const _Fp __x = __a + __t * (__b - __a); + if (__t > 1 == __b > __a) + return __b < __x ? __x : __b; + else + return __x < __b ? __x : __b; +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr float +lerp(float __a, float __b, float __t) noexcept { return __lerp(__a, __b, __t); } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr double +lerp(double __a, double __b, double __t) noexcept { return __lerp(__a, __b, __t); } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr long double +lerp(long double __a, long double __b, long double __t) noexcept { return __lerp(__a, __b, __t); } + +#endif // _LIBCUDACXX_STD_VER > 17 + +template ::digits > numeric_limits<_IntT>::digits), + int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)> +_LIBCUDACXX_INLINE_VISIBILITY +constexpr _IntT __max_representable_int_for_float() noexcept { + static_assert(is_floating_point<_FloatT>::value, "must be a floating point type"); + static_assert(is_integral<_IntT>::value, "must be an integral type"); + static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix"); +#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE + static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value + || _IsSame<_FloatT,long double>::value), "unsupported floating point type"); +#else + static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value), + "unsupported floating point type"); +#endif + return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits); +} + +// Convert a floating point number to the specified integral type after +// clamping to the integral types representable range. +// +// The behavior is undefined if `__r` is NaN. +template +_LIBCUDACXX_INLINE_VISIBILITY +_IntT __clamp_to_integral(_RealT __r) noexcept { + using _Lim = _CUDA_VSTD::numeric_limits<_IntT>; + const _IntT _MaxVal = _CUDA_VSTD::__max_representable_int_for_float<_IntT, _RealT>(); + if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) { + return _Lim::max(); + } else if (__r <= _Lim::lowest()) { + return _Lim::min(); + } + return static_cast<_IntT>(__r); +} + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif // __cuda_std__ + +#endif // _LIBCUDACXX_CMATH diff --git a/cuda_toolkit/include/codecvt b/cuda_toolkit/include/codecvt new file mode 100644 index 0000000000000000000000000000000000000000..b8a4dfa66d6ad76bcce172793b3c34c266b2ae09 --- /dev/null +++ b/cuda_toolkit/include/codecvt @@ -0,0 +1,553 @@ +// -*- C++ -*- +//===-------------------------- codecvt -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CODECVT +#define _LIBCUDACXX_CODECVT + +/* + codecvt synopsis + +namespace std +{ + +enum codecvt_mode +{ + consume_header = 4, + generate_header = 2, + little_endian = 1 +}; + +template +class codecvt_utf8 + : public codecvt +{ + explicit codecvt_utf8(size_t refs = 0); + ~codecvt_utf8(); +}; + +template +class codecvt_utf16 + : public codecvt +{ + explicit codecvt_utf16(size_t refs = 0); + ~codecvt_utf16(); +}; + +template +class codecvt_utf8_utf16 + : public codecvt +{ + explicit codecvt_utf8_utf16(size_t refs = 0); + ~codecvt_utf8_utf16(); +}; + +} // std + +*/ + +#include <__config> +#include <__locale> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +enum codecvt_mode +{ + consume_header = 4, + generate_header = 2, + little_endian = 1 +}; + +// codecvt_utf8 + +template class __codecvt_utf8; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf8 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef wchar_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf8 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef char16_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf8 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef char32_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS codecvt_utf8 + : public __codecvt_utf8<_Elem> +{ +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt_utf8(size_t __refs = 0) + : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {} + + _LIBCUDACXX_INLINE_VISIBILITY + ~codecvt_utf8() {} +}; + +// codecvt_utf16 + +template class __codecvt_utf16; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf16 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef wchar_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf16 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef wchar_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf16 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef char16_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf16 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef char16_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf16 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef char32_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf16 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef char32_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS codecvt_utf16 + : public __codecvt_utf16<_Elem, _Mode & little_endian> +{ +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt_utf16(size_t __refs = 0) + : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {} + + _LIBCUDACXX_INLINE_VISIBILITY + ~codecvt_utf16() {} +}; + +// codecvt_utf8_utf16 + +template class __codecvt_utf8_utf16; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf8_utf16 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef wchar_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf8_utf16 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef char32_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template <> +class _LIBCUDACXX_TYPE_VIS __codecvt_utf8_utf16 + : public codecvt +{ + unsigned long _Maxcode_; + codecvt_mode _Mode_; +public: + typedef char16_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode, + codecvt_mode _Mode) + : codecvt(__refs), _Maxcode_(_Maxcode), + _Mode_(_Mode) {} +protected: + virtual result + do_out(state_type& __st, + const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual result + do_in(state_type& __st, + const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, + intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; + virtual result + do_unshift(state_type& __st, + extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; + virtual int do_encoding() const throw(); + virtual bool do_always_noconv() const throw(); + virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, + size_t __mx) const; + virtual int do_max_length() const throw(); +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS codecvt_utf8_utf16 + : public __codecvt_utf8_utf16<_Elem> +{ +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit codecvt_utf8_utf16(size_t __refs = 0) + : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {} + + _LIBCUDACXX_INLINE_VISIBILITY + ~codecvt_utf8_utf16() {} +}; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_CODECVT diff --git a/cuda_toolkit/include/common_functions.h b/cuda_toolkit/include/common_functions.h new file mode 100644 index 0000000000000000000000000000000000000000..d8c9f298f881566751c02f3f6bb2965fbced72ad --- /dev/null +++ b/cuda_toolkit/include/common_functions.h @@ -0,0 +1,65 @@ +/* + * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__) +#if defined(_MSC_VER) +#pragma message("common_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.") +#else +#warning "common_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead." +#endif +#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_COMMON_FUNCTIONS_H_WRAPPER__ +#endif + +#include "crt/common_functions.h" + +#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_COMMON_FUNCTIONS_H_WRAPPER__) +#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_COMMON_FUNCTIONS_H_WRAPPER__ +#endif diff --git a/cuda_toolkit/include/compare b/cuda_toolkit/include/compare new file mode 100644 index 0000000000000000000000000000000000000000..b76f7d52019f309ff39e511043fb65d290af3dfa --- /dev/null +++ b/cuda_toolkit/include/compare @@ -0,0 +1,682 @@ +// -*- C++ -*- +//===-------------------------- compare -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_COMPARE +#define _LIBCUDACXX_COMPARE + +/* + compare synopsis + +namespace std { + // [cmp.categories], comparison category types + class weak_equality; + class strong_equality; + class partial_ordering; + class weak_ordering; + class strong_ordering; + + // named comparison functions + constexpr bool is_eq (weak_equality cmp) noexcept { return cmp == 0; } + constexpr bool is_neq (weak_equality cmp) noexcept { return cmp != 0; } + constexpr bool is_lt (partial_ordering cmp) noexcept { return cmp < 0; } + constexpr bool is_lteq(partial_ordering cmp) noexcept { return cmp <= 0; } + constexpr bool is_gt (partial_ordering cmp) noexcept { return cmp > 0; } + constexpr bool is_gteq(partial_ordering cmp) noexcept { return cmp >= 0; } + + // [cmp.common], common comparison category type + template + struct common_comparison_category { + using type = see below; + }; + template + using common_comparison_category_t = typename common_comparison_category::type; + + // [cmp.alg], comparison algorithms + template constexpr strong_ordering strong_order(const T& a, const T& b); + template constexpr weak_ordering weak_order(const T& a, const T& b); + template constexpr partial_ordering partial_order(const T& a, const T& b); + template constexpr strong_equality strong_equal(const T& a, const T& b); + template constexpr weak_equality weak_equal(const T& a, const T& b); +} +*/ + +#include <__config> +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#if _LIBCUDACXX_STD_VER > 17 + +// exposition only +enum class _LIBCUDACXX_ENUM_VIS _EqResult : unsigned char { + __zero = 0, + __equal = __zero, + __equiv = __equal, + __nonequal = 1, + __nonequiv = __nonequal +}; + +enum class _LIBCUDACXX_ENUM_VIS _OrdResult : signed char { + __less = -1, + __greater = 1 +}; + +enum class _LIBCUDACXX_ENUM_VIS _NCmpResult : signed char { + __unordered = -127 +}; + +struct _CmpUnspecifiedType; +using _CmpUnspecifiedParam = void (_CmpUnspecifiedType::*)(); + +class weak_equality { + _LIBCUDACXX_INLINE_VISIBILITY + constexpr explicit weak_equality(_EqResult __val) noexcept : __value_(__val) {} + +public: + static const weak_equality equivalent; + static const weak_equality nonequivalent; + + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator==(weak_equality __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, weak_equality __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator!=(weak_equality __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, weak_equality __v) noexcept; + +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr weak_equality operator<=>(weak_equality __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr weak_equality operator<=>(_CmpUnspecifiedParam, weak_equality __v) noexcept; +#endif + +private: + _EqResult __value_; +}; + +_LIBCUDACXX_INLINE_VAR constexpr weak_equality weak_equality::equivalent(_EqResult::__equiv); +_LIBCUDACXX_INLINE_VAR constexpr weak_equality weak_equality::nonequivalent(_EqResult::__nonequiv); + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr bool operator==(weak_equality __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ == _EqResult::__zero; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr bool operator==(_CmpUnspecifiedParam, weak_equality __v) noexcept { + return __v.__value_ == _EqResult::__zero; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr bool operator!=(weak_equality __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ != _EqResult::__zero; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr bool operator!=(_CmpUnspecifiedParam, weak_equality __v) noexcept { + return __v.__value_ != _EqResult::__zero; +} + +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr weak_equality operator<=>(weak_equality __v, _CmpUnspecifiedParam) noexcept { + return __v; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr weak_equality operator<=>(_CmpUnspecifiedParam, weak_equality __v) noexcept { + return __v; +} +#endif + +class strong_equality { + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr strong_equality(_EqResult __val) noexcept : __value_(__val) {} + +public: + static const strong_equality equal; + static const strong_equality nonequal; + static const strong_equality equivalent; + static const strong_equality nonequivalent; + + // conversion + _LIBCUDACXX_INLINE_VISIBILITY constexpr operator weak_equality() const noexcept { + return __value_ == _EqResult::__zero ? weak_equality::equivalent + : weak_equality::nonequivalent; + } + + // comparisons + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator==(strong_equality __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator!=(strong_equality __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, strong_equality __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, strong_equality __v) noexcept; + +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr strong_equality operator<=>(strong_equality __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr strong_equality operator<=>(_CmpUnspecifiedParam, strong_equality __v) noexcept; +#endif +private: + _EqResult __value_; +}; + +_LIBCUDACXX_INLINE_VAR constexpr strong_equality strong_equality::equal(_EqResult::__equal); +_LIBCUDACXX_INLINE_VAR constexpr strong_equality strong_equality::nonequal(_EqResult::__nonequal); +_LIBCUDACXX_INLINE_VAR constexpr strong_equality strong_equality::equivalent(_EqResult::__equiv); +_LIBCUDACXX_INLINE_VAR constexpr strong_equality strong_equality::nonequivalent(_EqResult::__nonequiv); + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator==(strong_equality __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ == _EqResult::__zero; +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator==(_CmpUnspecifiedParam, strong_equality __v) noexcept { + return __v.__value_ == _EqResult::__zero; +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator!=(strong_equality __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ != _EqResult::__zero; +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator!=(_CmpUnspecifiedParam, strong_equality __v) noexcept { + return __v.__value_ != _EqResult::__zero; +} + +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR +_LIBCUDACXX_INLINE_VISIBILITY +constexpr strong_equality operator<=>(strong_equality __v, _CmpUnspecifiedParam) noexcept { + return __v; +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr strong_equality operator<=>(_CmpUnspecifiedParam, strong_equality __v) noexcept { + return __v; +} +#endif // _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR + +class partial_ordering { + using _ValueT = signed char; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr partial_ordering(_EqResult __v) noexcept + : __value_(_ValueT(__v)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr partial_ordering(_OrdResult __v) noexcept + : __value_(_ValueT(__v)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr partial_ordering(_NCmpResult __v) noexcept + : __value_(_ValueT(__v)) {} + + constexpr bool __is_ordered() const noexcept { + return __value_ != _ValueT(_NCmpResult::__unordered); + } +public: + // valid values + static const partial_ordering less; + static const partial_ordering equivalent; + static const partial_ordering greater; + static const partial_ordering unordered; + + // conversion + constexpr operator weak_equality() const noexcept { + return __value_ == 0 ? weak_equality::equivalent : weak_equality::nonequivalent; + } + + // comparisons + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator!=(partial_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator< (partial_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator> (partial_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, partial_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, partial_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator< (_CmpUnspecifiedParam, partial_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator> (_CmpUnspecifiedParam, partial_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept; + +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr partial_ordering operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr partial_ordering operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept; +#endif + +private: + _ValueT __value_; +}; + +_LIBCUDACXX_INLINE_VAR constexpr partial_ordering partial_ordering::less(_OrdResult::__less); +_LIBCUDACXX_INLINE_VAR constexpr partial_ordering partial_ordering::equivalent(_EqResult::__equiv); +_LIBCUDACXX_INLINE_VAR constexpr partial_ordering partial_ordering::greater(_OrdResult::__greater); +_LIBCUDACXX_INLINE_VAR constexpr partial_ordering partial_ordering::unordered(_NCmpResult ::__unordered); + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__is_ordered() && __v.__value_ == 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator< (partial_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__is_ordered() && __v.__value_ < 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__is_ordered() && __v.__value_ <= 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator> (partial_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__is_ordered() && __v.__value_ > 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__is_ordered() && __v.__value_ >= 0; +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator==(_CmpUnspecifiedParam, partial_ordering __v) noexcept { + return __v.__is_ordered() && 0 == __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator< (_CmpUnspecifiedParam, partial_ordering __v) noexcept { + return __v.__is_ordered() && 0 < __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept { + return __v.__is_ordered() && 0 <= __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator> (_CmpUnspecifiedParam, partial_ordering __v) noexcept { + return __v.__is_ordered() && 0 > __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept { + return __v.__is_ordered() && 0 >= __v.__value_; +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator!=(partial_ordering __v, _CmpUnspecifiedParam) noexcept { + return !__v.__is_ordered() || __v.__value_ != 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator!=(_CmpUnspecifiedParam, partial_ordering __v) noexcept { + return !__v.__is_ordered() || __v.__value_ != 0; +} + +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR +_LIBCUDACXX_INLINE_VISIBILITY +constexpr partial_ordering operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr partial_ordering operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept { + return __v < 0 ? partial_ordering::greater : (__v > 0 ? partial_ordering::less : __v); +} +#endif // _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR + +class weak_ordering { + using _ValueT = signed char; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr weak_ordering(_EqResult __v) noexcept : __value_(_ValueT(__v)) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr weak_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {} + +public: + static const weak_ordering less; + static const weak_ordering equivalent; + static const weak_ordering greater; + + // conversions + _LIBCUDACXX_INLINE_VISIBILITY + constexpr operator weak_equality() const noexcept { + return __value_ == 0 ? weak_equality::equivalent + : weak_equality::nonequivalent; + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr operator partial_ordering() const noexcept { + return __value_ == 0 ? partial_ordering::equivalent + : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater); + } + + // comparisons + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator!=(weak_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator< (weak_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator> (weak_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, weak_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, weak_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator< (_CmpUnspecifiedParam, weak_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator> (_CmpUnspecifiedParam, weak_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept; + +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept; +#endif + +private: + _ValueT __value_; +}; + +_LIBCUDACXX_INLINE_VAR constexpr weak_ordering weak_ordering::less(_OrdResult::__less); +_LIBCUDACXX_INLINE_VAR constexpr weak_ordering weak_ordering::equivalent(_EqResult::__equiv); +_LIBCUDACXX_INLINE_VAR constexpr weak_ordering weak_ordering::greater(_OrdResult::__greater); + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ == 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator!=(weak_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ != 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator< (weak_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ < 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ <= 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator> (weak_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ > 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ >= 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator==(_CmpUnspecifiedParam, weak_ordering __v) noexcept { + return 0 == __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator!=(_CmpUnspecifiedParam, weak_ordering __v) noexcept { + return 0 != __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator< (_CmpUnspecifiedParam, weak_ordering __v) noexcept { + return 0 < __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept { + return 0 <= __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator> (_CmpUnspecifiedParam, weak_ordering __v) noexcept { + return 0 > __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept { + return 0 >= __v.__value_; +} + +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR +_LIBCUDACXX_INLINE_VISIBILITY +constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept { + return __v < 0 ? weak_ordering::greater : (__v > 0 ? weak_ordering::less : __v); +} +#endif // _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR + +class strong_ordering { + using _ValueT = signed char; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr strong_ordering(_EqResult __v) noexcept : __value_(_ValueT(__v)) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr strong_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {} + +public: + static const strong_ordering less; + static const strong_ordering equal; + static const strong_ordering equivalent; + static const strong_ordering greater; + + // conversions + _LIBCUDACXX_INLINE_VISIBILITY + constexpr operator weak_equality() const noexcept { + return __value_ == 0 ? weak_equality::equivalent + : weak_equality::nonequivalent; + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr operator strong_equality() const noexcept { + return __value_ == 0 ? strong_equality::equal + : strong_equality::nonequal; + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr operator partial_ordering() const noexcept { + return __value_ == 0 ? partial_ordering::equivalent + : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater); + } + + _LIBCUDACXX_INLINE_VISIBILITY + constexpr operator weak_ordering() const noexcept { + return __value_ == 0 ? weak_ordering::equivalent + : (__value_ < 0 ? weak_ordering::less : weak_ordering::greater); + } + + // comparisons + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator!=(strong_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator< (strong_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator> (strong_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, strong_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, strong_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator< (_CmpUnspecifiedParam, strong_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator> (_CmpUnspecifiedParam, strong_ordering __v) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept; + +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr strong_ordering operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY friend constexpr strong_ordering operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept; +#endif + +private: + _ValueT __value_; +}; + +_LIBCUDACXX_INLINE_VAR constexpr strong_ordering strong_ordering::less(_OrdResult::__less); +_LIBCUDACXX_INLINE_VAR constexpr strong_ordering strong_ordering::equal(_EqResult::__equal); +_LIBCUDACXX_INLINE_VAR constexpr strong_ordering strong_ordering::equivalent(_EqResult::__equiv); +_LIBCUDACXX_INLINE_VAR constexpr strong_ordering strong_ordering::greater(_OrdResult::__greater); + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ == 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator!=(strong_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ != 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator< (strong_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ < 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ <= 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator> (strong_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ > 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v.__value_ >= 0; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator==(_CmpUnspecifiedParam, strong_ordering __v) noexcept { + return 0 == __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator!=(_CmpUnspecifiedParam, strong_ordering __v) noexcept { + return 0 != __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator< (_CmpUnspecifiedParam, strong_ordering __v) noexcept { + return 0 < __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept { + return 0 <= __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator> (_CmpUnspecifiedParam, strong_ordering __v) noexcept { + return 0 > __v.__value_; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept { + return 0 >= __v.__value_; +} + +#ifndef _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR +_LIBCUDACXX_INLINE_VISIBILITY +constexpr strong_ordering operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept { + return __v; +} +_LIBCUDACXX_INLINE_VISIBILITY +constexpr strong_ordering operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept { + return __v < 0 ? strong_ordering::greater : (__v > 0 ? strong_ordering::less : __v); +} +#endif // _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR + +// named comparison functions +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool is_eq(weak_equality __cmp) noexcept { return __cmp == 0; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool is_neq(weak_equality __cmp) noexcept { return __cmp != 0; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool is_lt(partial_ordering __cmp) noexcept { return __cmp < 0; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool is_lteq(partial_ordering __cmp) noexcept { return __cmp <= 0; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool is_gt(partial_ordering __cmp) noexcept { return __cmp > 0; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr bool is_gteq(partial_ordering __cmp) noexcept { return __cmp >= 0; } + +namespace __comp_detail { + +enum _ClassifyCompCategory : unsigned{ + _None, + _WeakEq, + _StrongEq, + _PartialOrd, + _WeakOrd, + _StrongOrd, + _CCC_Size +}; + +template +_LIBCUDACXX_INLINE_VISIBILITY +constexpr _ClassifyCompCategory __type_to_enum() noexcept { + if (is_same_v<_Tp, weak_equality>) + return _WeakEq; + if (is_same_v<_Tp, strong_equality>) + return _StrongEq; + if (is_same_v<_Tp, partial_ordering>) + return _PartialOrd; + if (is_same_v<_Tp, weak_ordering>) + return _WeakOrd; + if (is_same_v<_Tp, strong_ordering>) + return _StrongOrd; + return _None; +} + +template +constexpr _ClassifyCompCategory +__compute_comp_type(std::array<_ClassifyCompCategory, _Size> __types) { + std::array __seen = {}; + for (auto __type : __types) + ++__seen[__type]; + if (__seen[_None]) + return _None; + if (__seen[_WeakEq]) + return _WeakEq; + if (__seen[_StrongEq] && (__seen[_PartialOrd] || __seen[_WeakOrd])) + return _WeakEq; + if (__seen[_StrongEq]) + return _StrongEq; + if (__seen[_PartialOrd]) + return _PartialOrd; + if (__seen[_WeakOrd]) + return _WeakOrd; + return _StrongOrd; +} + +template +constexpr auto __get_comp_type() { + using _CCC = _ClassifyCompCategory; + constexpr array<_CCC, sizeof...(_Ts)> __type_kinds{{__comp_detail::__type_to_enum<_Ts>()...}}; + constexpr _CCC _Cat = sizeof...(_Ts) == 0 ? _StrongOrd + : __compute_comp_type(__type_kinds); + if constexpr (_Cat == _None) + return void(); + else if constexpr (_Cat == _WeakEq) + return weak_equality::equivalent; + else if constexpr (_Cat == _StrongEq) + return strong_equality::equivalent; + else if constexpr (_Cat == _PartialOrd) + return partial_ordering::equivalent; + else if constexpr (_Cat == _WeakOrd) + return weak_ordering::equivalent; + else if constexpr (_Cat == _StrongOrd) + return strong_ordering::equivalent; + else + static_assert(_Cat != _Cat, "unhandled case"); +} +} // namespace __comp_detail + +// [cmp.common], common comparison category type +template +struct _LIBCUDACXX_TEMPLATE_VIS common_comparison_category { + using type = decltype(__comp_detail::__get_comp_type<_Ts...>()); +}; + +template +using common_comparison_category_t = typename common_comparison_category<_Ts...>::type; + +// [cmp.alg], comparison algorithms +// TODO: unimplemented +template constexpr strong_ordering strong_order(const _Tp& __lhs, const _Tp& __rhs); +template constexpr weak_ordering weak_order(const _Tp& __lhs, const _Tp& __rhs); +template constexpr partial_ordering partial_order(const _Tp& __lhs, const _Tp& __rhs); +template constexpr strong_equality strong_equal(const _Tp& __lhs, const _Tp& __rhs); +template constexpr weak_equality weak_equal(const _Tp& __lhs, const _Tp& __rhs); + +#endif // _LIBCUDACXX_STD_VER > 17 + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_COMPARE diff --git a/cuda_toolkit/include/complex b/cuda_toolkit/include/complex new file mode 100644 index 0000000000000000000000000000000000000000..96c857a1da6fd65da1c1d7b64131da6f9c61e112 --- /dev/null +++ b/cuda_toolkit/include/complex @@ -0,0 +1,1924 @@ +// -*- C++ -*- +//===--------------------------- complex ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_COMPLEX +#define _LIBCUDACXX_COMPLEX + +/* + complex synopsis + +namespace std +{ + +template +class complex +{ +public: + typedef T value_type; + + complex(const T& re = T(), const T& im = T()); // constexpr in C++14 + complex(const complex&); // constexpr in C++14 + template complex(const complex&); // constexpr in C++14 + + T real() const; // constexpr in C++14 + T imag() const; // constexpr in C++14 + + void real(T); // constexpr in C++20 + void imag(T); // constexpr in C++20 + + complex& operator= (const T&); // constexpr in C++20 + complex& operator+=(const T&); // constexpr in C++20 + complex& operator-=(const T&); // constexpr in C++20 + complex& operator*=(const T&); // constexpr in C++20 + complex& operator/=(const T&); // constexpr in C++20 + + complex& operator=(const complex&); // constexpr in C++20 + template complex& operator= (const complex&); // constexpr in C++20 + template complex& operator+=(const complex&); // constexpr in C++20 + template complex& operator-=(const complex&); // constexpr in C++20 + template complex& operator*=(const complex&); // constexpr in C++20 + template complex& operator/=(const complex&); // constexpr in C++20 +}; + +template<> +class complex +{ +public: + typedef float value_type; + + constexpr complex(float re = 0.0f, float im = 0.0f); + explicit constexpr complex(const complex&); + explicit constexpr complex(const complex&); + + constexpr float real() const; + void real(float); // constexpr in C++20 + constexpr float imag() const; + void imag(float); // constexpr in C++20 + + complex& operator= (float); // constexpr in C++20 + complex& operator+=(float); // constexpr in C++20 + complex& operator-=(float); // constexpr in C++20 + complex& operator*=(float); // constexpr in C++20 + complex& operator/=(float); // constexpr in C++20 + + complex& operator=(const complex&); // constexpr in C++20 + template complex& operator= (const complex&); // constexpr in C++20 + template complex& operator+=(const complex&); // constexpr in C++20 + template complex& operator-=(const complex&); // constexpr in C++20 + template complex& operator*=(const complex&); // constexpr in C++20 + template complex& operator/=(const complex&); // constexpr in C++20 +}; + +template<> +class complex +{ +public: + typedef double value_type; + + constexpr complex(double re = 0.0, double im = 0.0); + constexpr complex(const complex&); + explicit constexpr complex(const complex&); + + constexpr double real() const; + void real(double); // constexpr in C++20 + constexpr double imag() const; + void imag(double); // constexpr in C++20 + + complex& operator= (double); // constexpr in C++20 + complex& operator+=(double); // constexpr in C++20 + complex& operator-=(double); // constexpr in C++20 + complex& operator*=(double); // constexpr in C++20 + complex& operator/=(double); // constexpr in C++20 + complex& operator=(const complex&); // constexpr in C++20 + + template complex& operator= (const complex&); // constexpr in C++20 + template complex& operator+=(const complex&); // constexpr in C++20 + template complex& operator-=(const complex&); // constexpr in C++20 + template complex& operator*=(const complex&); // constexpr in C++20 + template complex& operator/=(const complex&); // constexpr in C++20 +}; + +template<> +class complex +{ +public: + typedef long double value_type; + + constexpr complex(long double re = 0.0L, long double im = 0.0L); + constexpr complex(const complex&); + constexpr complex(const complex&); + + constexpr long double real() const; + void real(long double); // constexpr in C++20 + constexpr long double imag() const; + void imag(long double); // constexpr in C++20 + + complex& operator=(const complex&); // constexpr in C++20 + complex& operator= (long double); // constexpr in C++20 + complex& operator+=(long double); // constexpr in C++20 + complex& operator-=(long double); // constexpr in C++20 + complex& operator*=(long double); // constexpr in C++20 + complex& operator/=(long double); // constexpr in C++20 + + template complex& operator= (const complex&); // constexpr in C++20 + template complex& operator+=(const complex&); // constexpr in C++20 + template complex& operator-=(const complex&); // constexpr in C++20 + template complex& operator*=(const complex&); // constexpr in C++20 + template complex& operator/=(const complex&); // constexpr in C++20 +}; + +// 26.3.6 operators: +template complex operator+(const complex&, const complex&); // constexpr in C++20 +template complex operator+(const complex&, const T&); // constexpr in C++20 +template complex operator+(const T&, const complex&); // constexpr in C++20 +template complex operator-(const complex&, const complex&); // constexpr in C++20 +template complex operator-(const complex&, const T&); // constexpr in C++20 +template complex operator-(const T&, const complex&); // constexpr in C++20 +template complex operator*(const complex&, const complex&); // constexpr in C++20 +template complex operator*(const complex&, const T&); // constexpr in C++20 +template complex operator*(const T&, const complex&); // constexpr in C++20 +template complex operator/(const complex&, const complex&); // constexpr in C++20 +template complex operator/(const complex&, const T&); // constexpr in C++20 +template complex operator/(const T&, const complex&); // constexpr in C++20 +template complex operator+(const complex&); // constexpr in C++20 +template complex operator-(const complex&); // constexpr in C++20 +template bool operator==(const complex&, const complex&); // constexpr in C++14 +template bool operator==(const complex&, const T&); // constexpr in C++14 +template bool operator==(const T&, const complex&); // constexpr in C++14 +template bool operator!=(const complex&, const complex&); // constexpr in C++14 +template bool operator!=(const complex&, const T&); // constexpr in C++14 +template bool operator!=(const T&, const complex&); // constexpr in C++14 + +template + basic_istream& + operator>>(basic_istream&, complex&); +template + basic_ostream& + operator<<(basic_ostream&, const complex&); + +// 26.3.7 values: + +template T real(const complex&); // constexpr in C++14 + long double real(long double); // constexpr in C++14 + double real(double); // constexpr in C++14 +template double real(T); // constexpr in C++14 + float real(float); // constexpr in C++14 + +template T imag(const complex&); // constexpr in C++14 + long double imag(long double); // constexpr in C++14 + double imag(double); // constexpr in C++14 +template double imag(T); // constexpr in C++14 + float imag(float); // constexpr in C++14 + +template T abs(const complex&); + +template T arg(const complex&); + long double arg(long double); + double arg(double); +template double arg(T); + float arg(float); + +template T norm(const complex&); // constexpr in C++20 + long double norm(long double); // constexpr in C++20 + double norm(double); // constexpr in C++20 +template double norm(T); // constexpr in C++20 + float norm(float); // constexpr in C++20 + +template complex conj(const complex&); // constexpr in C++20 + complex conj(long double); // constexpr in C++20 + complex conj(double); // constexpr in C++20 +template complex conj(T); // constexpr in C++20 + complex conj(float); // constexpr in C++20 + +template complex proj(const complex&); + complex proj(long double); + complex proj(double); +template complex proj(T); + complex proj(float); + +template complex polar(const T&, const T& = T()); + +// 26.3.8 transcendentals: +template complex acos(const complex&); +template complex asin(const complex&); +template complex atan(const complex&); +template complex acosh(const complex&); +template complex asinh(const complex&); +template complex atanh(const complex&); +template complex cos (const complex&); +template complex cosh (const complex&); +template complex exp (const complex&); +template complex log (const complex&); +template complex log10(const complex&); + +template complex pow(const complex&, const T&); +template complex pow(const complex&, const complex&); +template complex pow(const T&, const complex&); + +template complex sin (const complex&); +template complex sinh (const complex&); +template complex sqrt (const complex&); +template complex tan (const complex&); +template complex tanh (const complex&); + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#include +#endif // __cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__type_traits/enable_if.h" +#include "__type_traits/is_arithmetic.h" +#include "__type_traits/is_floating_point.h" +#include "__type_traits/is_integral.h" +#include "__type_traits/is_same.h" +#include "__type_traits/promote.h" +#include "climits" +#include "cmath" +#include "cstdint" +#include "type_traits" +#include "version" + +#if !defined(_LIBCUDACXX_HAS_NO_LOCALIZATION) \ + && !defined(_LIBCUDACXX_COMPILER_NVRTC) +#include // for std::basic_ostringstream +#endif // !_LIBCUDACXX_HAS_NO_LOCALIZATION && !_LIBCUDACXX_COMPILER_NVRTC + +// Compatability helpers for thrust to convert between `std::complex` and `cuda::std::complex` +#if defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) +#include + +#define _LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__c) reinterpret_cast(__c)[0] +#define _LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__c) reinterpret_cast(__c)[1] +#endif // defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +# if _LIBCUDACXX_CUDA_ABI_VERSION > 3 +# define _LIBCUDACXX_COMPLEX_ALIGNAS(V) _ALIGNAS(V) +# else +# define _LIBCUDACXX_COMPLEX_ALIGNAS(V) +# endif + +#ifdef LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_OPERATIONS +# ifndef LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_MULTIPLICATION +# define LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_MULTIPLICATION +# endif // LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_MULTIPLICATION +# ifndef LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_DIVISION +# define LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_DIVISION +# endif // LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_DIVISION +#endif // LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_OPERATIONS + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_COMPLEX_ALIGNAS(2*sizeof(_Tp)) complex; + +template _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX +complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w); + +template _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX +complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y); + +template +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_COMPLEX_ALIGNAS(2*sizeof(_Tp)) complex +{ +public: + typedef _Tp value_type; +private: + value_type __re_; + value_type __im_; +public: + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex(const value_type& __re = value_type(), const value_type& __im = value_type()) + : __re_(__re), __im_(__im) {} + template _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex(const complex<_Xp>& __c) + : __re_(__c.real()), __im_(__c.imag()) {} + +#if defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + template + _LIBCUDACXX_INLINE_VISIBILITY + complex(const ::std::complex<_Up>& __other) + : __re_(_LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__other)), __im_(_LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__other)) + {} + + template + _LIBCUDACXX_INLINE_VISIBILITY + complex& operator=(const ::std::complex<_Up>& __other) { + __re_ = _LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__other); + __im_ = _LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__other); + return *this; + } + + _LIBCUDACXX_HOST _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + operator ::std::complex<_Tp>() const { return { __re_, __im_ }; } +#endif // defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 value_type real() const {return __re_;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 value_type imag() const {return __im_;} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 void real(value_type __re) {__re_ = __re;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 void imag(value_type __im) {__im_ = __im;} + +#if defined(__cuda_std__) + // Those additional volatile overloads are meant to help with reductions in thrust + _LIBCUDACXX_INLINE_VISIBILITY value_type real() const volatile {return __re_;} + _LIBCUDACXX_INLINE_VISIBILITY value_type imag() const volatile {return __im_;} + + _LIBCUDACXX_INLINE_VISIBILITY void real(value_type __re) volatile {__re_ = __re;} + _LIBCUDACXX_INLINE_VISIBILITY void imag(value_type __im) volatile {__im_ = __im;} +#endif // defined(__cuda_std__) + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator= (const value_type& __re) {__re_ = __re; __im_ = value_type(); return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator+=(const value_type& __re) {__re_ += __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator/=(const value_type& __re) {__re_ /= __re; __im_ /= __re; return *this;} + + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator= (const complex<_Xp>& __c) + { + __re_ = __c.real(); + __im_ = __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator+=(const complex<_Xp>& __c) + { + __re_ += __c.real(); + __im_ += __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator-=(const complex<_Xp>& __c) + { + __re_ -= __c.real(); + __im_ -= __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator*=(const complex<_Xp>& __c) + { + *this = *this * complex(__c.real(), __c.imag()); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator/=(const complex<_Xp>& __c) + { + *this = *this / complex(__c.real(), __c.imag()); + return *this; + } +}; + +template<> class complex; +#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE +template<> class complex; +#endif // _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE + +template<> +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_COMPLEX_ALIGNAS(2*sizeof(float)) complex +{ + float __re_; + float __im_; +public: + typedef float value_type; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr complex(float __re = 0.0f, float __im = 0.0f) + : __re_(__re), __im_(__im) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr complex(const complex& __c); +#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr complex(const complex& __c); +#endif // _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE + +#if defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + template + _LIBCUDACXX_INLINE_VISIBILITY + complex(const ::std::complex<_Up>& __other) + : __re_(_LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__other)), __im_(_LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__other)) + {} + + template + _LIBCUDACXX_INLINE_VISIBILITY + complex& operator=(const ::std::complex<_Up>& __other) { + __re_ = _LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__other); + __im_ = _LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__other); + return *this; + } + + _LIBCUDACXX_HOST _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + operator ::std::complex() const { return { __re_, __im_ }; } +#endif // defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + + _LIBCUDACXX_INLINE_VISIBILITY constexpr float real() const {return __re_;} + _LIBCUDACXX_INLINE_VISIBILITY constexpr float imag() const {return __im_;} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 void real(value_type __re) {__re_ = __re;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 void imag(value_type __im) {__im_ = __im;} + +#if defined(__cuda_std__) + // Those additional volatile overloads are meant to help with reductions in thrust + _LIBCUDACXX_INLINE_VISIBILITY float real() const volatile {return __re_;} + _LIBCUDACXX_INLINE_VISIBILITY float imag() const volatile {return __im_;} + + _LIBCUDACXX_INLINE_VISIBILITY void real(value_type __re) volatile {__re_ = __re;} + _LIBCUDACXX_INLINE_VISIBILITY void imag(value_type __im) volatile {__im_ = __im;} +#endif // defined(__cuda_std__) + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator= (float __re) { __re_ = __re; __im_ = value_type(); return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator+=(float __re) {__re_ += __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator-=(float __re) {__re_ -= __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator/=(float __re) {__re_ /= __re; __im_ /= __re; return *this;} + + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator= (const complex<_Xp>& __c) + { + __re_ = __c.real(); + __im_ = __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator+=(const complex<_Xp>& __c) + { + __re_ += __c.real(); + __im_ += __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator-=(const complex<_Xp>& __c) + { + __re_ -= __c.real(); + __im_ -= __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator*=(const complex<_Xp>& __c) + { + *this = *this * complex(__c.real(), __c.imag()); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator/=(const complex<_Xp>& __c) + { + *this = *this / complex(__c.real(), __c.imag()); + return *this; + } +}; + +template<> +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_COMPLEX_ALIGNAS(2*sizeof(double)) complex +{ + double __re_; + double __im_; +public: + typedef double value_type; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr complex(double __re = 0.0, double __im = 0.0) + : __re_(__re), __im_(__im) {} + _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex(const complex& __c); + +#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE + _LIBCUDACXX_INLINE_VISIBILITY + explicit constexpr complex(const complex& __c); +#endif //_LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE + +#if defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + template + _LIBCUDACXX_INLINE_VISIBILITY + complex(const ::std::complex<_Up>& __other) + : __re_(_LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__other)), __im_(_LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__other)) + {} + + template + _LIBCUDACXX_INLINE_VISIBILITY + complex& operator=(const ::std::complex<_Up>& __other) { + __re_ = _LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__other); + __im_ = _LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__other); + return *this; + } + + _LIBCUDACXX_HOST _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + operator ::std::complex() const { return { __re_, __im_ }; } +#endif // defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + + _LIBCUDACXX_INLINE_VISIBILITY constexpr double real() const {return __re_;} + _LIBCUDACXX_INLINE_VISIBILITY constexpr double imag() const {return __im_;} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 void real(value_type __re) {__re_ = __re;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 void imag(value_type __im) {__im_ = __im;} + +#if defined(__cuda_std__) + // Those additional volatile overloads are meant to help with reductions in thrust + _LIBCUDACXX_INLINE_VISIBILITY double real() const volatile {return __re_;} + _LIBCUDACXX_INLINE_VISIBILITY double imag() const volatile {return __im_;} + + _LIBCUDACXX_INLINE_VISIBILITY void real(value_type __re) volatile {__re_ = __re;} + _LIBCUDACXX_INLINE_VISIBILITY void imag(value_type __im) volatile {__im_ = __im;} +#endif // defined(__cuda_std__) + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator= (double __re) {__re_ = __re; __im_ = value_type(); return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator+=(double __re) {__re_ += __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator-=(double __re) {__re_ -= __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator/=(double __re) {__re_ /= __re; __im_ /= __re; return *this;} + + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator= (const complex<_Xp>& __c) + { + __re_ = __c.real(); + __im_ = __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator+=(const complex<_Xp>& __c) + { + __re_ += __c.real(); + __im_ += __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator-=(const complex<_Xp>& __c) + { + __re_ -= __c.real(); + __im_ -= __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator*=(const complex<_Xp>& __c) + { + *this = *this * complex(__c.real(), __c.imag()); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator/=(const complex<_Xp>& __c) + { + *this = *this / complex(__c.real(), __c.imag()); + return *this; + } +}; + +#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE +template<> +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_COMPLEX_ALIGNAS(2*sizeof(long double)) complex +{ + long double __re_; + long double __im_; +public: + typedef long double value_type; + + _LIBCUDACXX_INLINE_VISIBILITY constexpr complex(long double __re = 0.0L, long double __im = 0.0L) + : __re_(__re), __im_(__im) {} + _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex(const complex& __c); + _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex(const complex& __c); + +#if defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + template + _LIBCUDACXX_INLINE_VISIBILITY + complex(const ::std::complex<_Up>& __other) + : __re_(_LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__other)), __im_(_LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__other)) + {} + + template + _LIBCUDACXX_INLINE_VISIBILITY + complex& operator=(const ::std::complex<_Up>& __other) { + __re_ = _LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__other); + __im_ = _LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__other); + return *this; + } + + _LIBCUDACXX_HOST _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + operator ::std::complex() const { return { __re_, __im_ }; } +#endif // defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + + _LIBCUDACXX_INLINE_VISIBILITY constexpr long double real() const {return __re_;} + _LIBCUDACXX_INLINE_VISIBILITY constexpr long double imag() const {return __im_;} + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 void real(value_type __re) {__re_ = __re;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 void imag(value_type __im) {__im_ = __im;} + +#if defined(__cuda_std__) + // Those additional volatile overloads are meant to help with reductions in thrust + _LIBCUDACXX_INLINE_VISIBILITY long double real() const volatile {return __re_;} + _LIBCUDACXX_INLINE_VISIBILITY long double imag() const volatile {return __im_;} + + _LIBCUDACXX_INLINE_VISIBILITY void real(value_type __re) volatile {__re_ = __re;} + _LIBCUDACXX_INLINE_VISIBILITY void imag(value_type __im) volatile {__im_ = __im;} +#endif // defined(__cuda_std__) + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator= (long double __re) {__re_ = __re; __im_ = value_type(); return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator+=(long double __re) {__re_ += __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator-=(long double __re) {__re_ -= __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + complex& operator/=(long double __re) {__re_ /= __re; __im_ /= __re; return *this;} + + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator= (const complex<_Xp>& __c) + { + __re_ = __c.real(); + __im_ = __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator+=(const complex<_Xp>& __c) + { + __re_ += __c.real(); + __im_ += __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator-=(const complex<_Xp>& __c) + { + __re_ -= __c.real(); + __im_ -= __c.imag(); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator*=(const complex<_Xp>& __c) + { + *this = *this * complex(__c.real(), __c.imag()); + return *this; + } + template + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 complex& operator/=(const complex<_Xp>& __c) + { + *this = *this / complex(__c.real(), __c.imag()); + return *this; + } +}; +#endif // _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE + +#if defined(_LIBCUDACXX_USE_PRAGMA_MSVC_WARNING) + // MSVC complains about narrowing conversions on these copy constructors regardless if they are used + #pragma warning(push) + #pragma warning(disable : 4244) +#endif + +inline constexpr +complex::complex(const complex& __c) + : __re_(__c.real()), __im_(__c.imag()) {} + +inline constexpr +complex::complex(const complex& __c) + : __re_(__c.real()), __im_(__c.imag()) {} + +#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE +inline constexpr +complex::complex(const complex& __c) + : __re_(__c.real()), __im_(__c.imag()) {} + +inline constexpr +complex::complex(const complex& __c) + : __re_(__c.real()), __im_(__c.imag()) {} + +inline constexpr +complex::complex(const complex& __c) + : __re_(__c.real()), __im_(__c.imag()) {} + +inline constexpr +complex::complex(const complex& __c) + : __re_(__c.real()), __im_(__c.imag()) {} +#endif // _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE + +#if defined(_LIBCUDACXX_USE_PRAGMA_MSVC_WARNING) + #pragma warning(pop) +#endif + +// 26.3.6 operators: + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) +{ + complex<_Tp> __t(__x); + __t += __y; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator+(const complex<_Tp>& __x, const _Tp& __y) +{ + complex<_Tp> __t(__x); + __t += __y; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator+(const _Tp& __x, const complex<_Tp>& __y) +{ + complex<_Tp> __t(__y); + __t += __x; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) +{ + complex<_Tp> __t(__x); + __t -= __y; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator-(const complex<_Tp>& __x, const _Tp& __y) +{ + complex<_Tp> __t(__x); + __t -= __y; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator-(const _Tp& __x, const complex<_Tp>& __y) +{ + complex<_Tp> __t(-__y); + __t += __x; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX +complex<_Tp> +operator*(const complex<_Tp>& __z, const complex<_Tp>& __w) +{ + _Tp __a = __z.real(); + _Tp __b = __z.imag(); + _Tp __c = __w.real(); + _Tp __d = __w.imag(); + +#if _LIBCUDACXX_STD_VER > 11 && defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) + // Avoid floating point operations that are invalid during constant evaluation + if (__libcpp_is_constant_evaluated()) { + bool __z_zero = __a == _Tp(0) && __b == _Tp(0); + bool __w_zero = __c == _Tp(0) && __d == _Tp(0); + bool __z_inf = _CUDA_VSTD::__constexpr_isinf(__a) || _CUDA_VSTD::__constexpr_isinf(__b); + bool __w_inf = _CUDA_VSTD::__constexpr_isinf(__c) || _CUDA_VSTD::__constexpr_isinf(__d); + bool __z_nan = !__z_inf && ( + (_CUDA_VSTD::__constexpr_isnan(__a) && _CUDA_VSTD::__constexpr_isnan(__b)) + || (_CUDA_VSTD::__constexpr_isnan(__a) && __b == _Tp(0)) + || (__a == _Tp(0) && _CUDA_VSTD::__constexpr_isnan(__b)) + ); + bool __w_nan = !__w_inf && ( + (_CUDA_VSTD::__constexpr_isnan(__c) && _CUDA_VSTD::__constexpr_isnan(__d)) + || (_CUDA_VSTD::__constexpr_isnan(__c) && __d == _Tp(0)) + || (__c == _Tp(0) && _CUDA_VSTD::__constexpr_isnan(__d)) + ); + if (__z_nan || __w_nan) { + return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); + } + if (__z_inf || __w_inf) { + if (__z_zero || __w_zero) { + return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); + } + return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity())); + } + bool __z_nonzero_nan = !__z_inf && !__z_nan && (_CUDA_VSTD::__constexpr_isnan(__a) || _CUDA_VSTD::__constexpr_isnan(__b)); + bool __w_nonzero_nan = !__w_inf && !__w_nan && (_CUDA_VSTD::__constexpr_isnan(__c) || _CUDA_VSTD::__constexpr_isnan(__d)); + if (__z_nonzero_nan || __w_nonzero_nan) { + return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); + } + } +#endif // _LIBCUDACXX_STD_VER > 11 && defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) + + _Tp __ac = __a * __c; + _Tp __bd = __b * __d; + _Tp __ad = __a * __d; + _Tp __bc = __b * __c; + _Tp __x = __ac - __bd; + _Tp __y = __ad + __bc; +#ifndef LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_MULTIPLICATION + if (_CUDA_VSTD::__constexpr_isnan(__x) && _CUDA_VSTD::__constexpr_isnan(__y)) + { + bool __recalc = false; + if (_CUDA_VSTD::__constexpr_isinf(__a) || _CUDA_VSTD::__constexpr_isinf(__b)) + { + __a = _CUDA_VSTD::__constexpr_copysign(_CUDA_VSTD::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a); + __b = _CUDA_VSTD::__constexpr_copysign(_CUDA_VSTD::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b); + if (_CUDA_VSTD::__constexpr_isnan(__c)) + __c = _CUDA_VSTD::__constexpr_copysign(_Tp(0), __c); + if (_CUDA_VSTD::__constexpr_isnan(__d)) + __d = _CUDA_VSTD::__constexpr_copysign(_Tp(0), __d); + __recalc = true; + } + if (_CUDA_VSTD::__constexpr_isinf(__c) || _CUDA_VSTD::__constexpr_isinf(__d)) + { + __c = _CUDA_VSTD::__constexpr_copysign(_CUDA_VSTD::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c); + __d = _CUDA_VSTD::__constexpr_copysign(_CUDA_VSTD::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d); + if (_CUDA_VSTD::__constexpr_isnan(__a)) + __a = _CUDA_VSTD::__constexpr_copysign(_Tp(0), __a); + if (_CUDA_VSTD::__constexpr_isnan(__b)) + __b = _CUDA_VSTD::__constexpr_copysign(_Tp(0), __b); + __recalc = true; + } + if (!__recalc && (_CUDA_VSTD::__constexpr_isinf(__ac) || _CUDA_VSTD::__constexpr_isinf(__bd) || + _CUDA_VSTD::__constexpr_isinf(__ad) || _CUDA_VSTD::__constexpr_isinf(__bc))) + { + if (_CUDA_VSTD::__constexpr_isnan(__a)) + __a = _CUDA_VSTD::__constexpr_copysign(_Tp(0), __a); + if (_CUDA_VSTD::__constexpr_isnan(__b)) + __b = _CUDA_VSTD::__constexpr_copysign(_Tp(0), __b); + if (_CUDA_VSTD::__constexpr_isnan(__c)) + __c = _CUDA_VSTD::__constexpr_copysign(_Tp(0), __c); + if (_CUDA_VSTD::__constexpr_isnan(__d)) + __d = _CUDA_VSTD::__constexpr_copysign(_Tp(0), __d); + __recalc = true; + } + if (__recalc) + { + __x = _Tp(INFINITY) * (__a * __c - __b * __d); + __y = _Tp(INFINITY) * (__a * __d + __b * __c); + } + } +#endif // LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_MULTIPLICATION + return complex<_Tp>(__x, __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator*(const complex<_Tp>& __x, const _Tp& __y) +{ + complex<_Tp> __t(__x); + __t *= __y; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator*(const _Tp& __x, const complex<_Tp>& __y) +{ + complex<_Tp> __t(__y); + __t *= __x; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11_COMPLEX +complex<_Tp> +operator/(const complex<_Tp>& __z, const complex<_Tp>& __w) +{ + int __ilogbw = 0; + _Tp __a = __z.real(); + _Tp __b = __z.imag(); + _Tp __c = __w.real(); + _Tp __d = __w.imag(); + _Tp __logbw = _CUDA_VSTD::__constexpr_logb(_CUDA_VSTD::__constexpr_fmax(_CUDA_VSTD::__constexpr_fabs(__c), _CUDA_VSTD::__constexpr_fabs(__d))); + if (_CUDA_VSTD::__constexpr_isfinite(__logbw)) + { + __ilogbw = static_cast(__logbw); + __c = _CUDA_VSTD::__constexpr_scalbn(__c, -__ilogbw); + __d = _CUDA_VSTD::__constexpr_scalbn(__d, -__ilogbw); + } + +#if _LIBCUDACXX_STD_VER > 11 && defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) + // Avoid floating point operations that are invalid during constant evaluation + if (__libcpp_is_constant_evaluated()) { + bool __z_zero = __a == _Tp(0) && __b == _Tp(0); + bool __w_zero = __c == _Tp(0) && __d == _Tp(0); + bool __z_inf = _CUDA_VSTD::__constexpr_isinf(__a) || _CUDA_VSTD::__constexpr_isinf(__b); + bool __w_inf = _CUDA_VSTD::__constexpr_isinf(__c) || _CUDA_VSTD::__constexpr_isinf(__d); + bool __z_nan = !__z_inf && ( + (_CUDA_VSTD::__constexpr_isnan(__a) && _CUDA_VSTD::__constexpr_isnan(__b)) + || (_CUDA_VSTD::__constexpr_isnan(__a) && __b == _Tp(0)) + || (__a == _Tp(0) && _CUDA_VSTD::__constexpr_isnan(__b)) + ); + bool __w_nan = !__w_inf && ( + (_CUDA_VSTD::__constexpr_isnan(__c) && _CUDA_VSTD::__constexpr_isnan(__d)) + || (_CUDA_VSTD::__constexpr_isnan(__c) && __d == _Tp(0)) + || (__c == _Tp(0) && _CUDA_VSTD::__constexpr_isnan(__d)) + ); + if ((__z_nan || __w_nan) || (__z_inf && __w_inf)) { + return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); + } + bool __z_nonzero_nan = !__z_inf && !__z_nan && (_CUDA_VSTD::__constexpr_isnan(__a) || _CUDA_VSTD::__constexpr_isnan(__b)); + bool __w_nonzero_nan = !__w_inf && !__w_nan && (_CUDA_VSTD::__constexpr_isnan(__c) || _CUDA_VSTD::__constexpr_isnan(__d)); + if (__z_nonzero_nan || __w_nonzero_nan) { + if (__w_zero) { + return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity())); + } + return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); + } + if (__w_inf) { + return complex<_Tp>(_Tp(0), _Tp(0)); + } + if (__z_inf) { + return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity())); + } + if (__w_zero) { + if (__z_zero) { + return complex<_Tp>(_Tp(numeric_limits<_Tp>::quiet_NaN()), _Tp(0)); + } + return complex<_Tp>(_Tp(numeric_limits<_Tp>::infinity()), _Tp(numeric_limits<_Tp>::infinity())); + } + } +#endif // _LIBCUDACXX_STD_VER > 11 && defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) + + _Tp __denom = __c * __c + __d * __d; + _Tp __x = _CUDA_VSTD::__constexpr_scalbn((__a * __c + __b * __d) / __denom, -__ilogbw); + _Tp __y = _CUDA_VSTD::__constexpr_scalbn((__b * __c - __a * __d) / __denom, -__ilogbw); +#ifndef LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_DIVISION + if (_CUDA_VSTD::__constexpr_isnan(__x) && _CUDA_VSTD::__constexpr_isnan(__y)) + { + if ((__denom == _Tp(0)) && (!_CUDA_VSTD::__constexpr_isnan(__a) || !_CUDA_VSTD::__constexpr_isnan(__b))) + { + __x = _CUDA_VSTD::__constexpr_copysign(_Tp(INFINITY), __c) * __a; + __y = _CUDA_VSTD::__constexpr_copysign(_Tp(INFINITY), __c) * __b; + } else if ((_CUDA_VSTD::__constexpr_isinf(__a) || _CUDA_VSTD::__constexpr_isinf(__b)) && _CUDA_VSTD::__constexpr_isfinite(__c) && + _CUDA_VSTD::__constexpr_isfinite(__d)) { + __a = _CUDA_VSTD::__constexpr_copysign(_CUDA_VSTD::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a); + __b = _CUDA_VSTD::__constexpr_copysign(_CUDA_VSTD::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b); + __x = _Tp(INFINITY) * (__a * __c + __b * __d); + __y = _Tp(INFINITY) * (__b * __c - __a * __d); + } else if (_CUDA_VSTD::__constexpr_isinf(__logbw) && __logbw > _Tp(0) && _CUDA_VSTD::__constexpr_isfinite(__a) && + _CUDA_VSTD::__constexpr_isfinite(__b)) { + __c = _CUDA_VSTD::__constexpr_copysign(_CUDA_VSTD::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c); + __d = _CUDA_VSTD::__constexpr_copysign(_CUDA_VSTD::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d); + __x = _Tp(0) * (__a * __c + __b * __d); + __y = _Tp(0) * (__b * __c - __a * __d); + } + } +#endif // LIBCUDACXX_ENABLE_SIMPLIFIED_COMPLEX_DIVISION + return complex<_Tp>(__x, __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator/(const complex<_Tp>& __x, const _Tp& __y) +{ + return complex<_Tp>(__x.real() / __y, __x.imag() / __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator/(const _Tp& __x, const complex<_Tp>& __y) +{ + complex<_Tp> __t(__x); + __t /= __y; + return __t; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator+(const complex<_Tp>& __x) +{ + return __x; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +operator-(const complex<_Tp>& __x) +{ + return complex<_Tp>(-__x.real(), -__x.imag()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) +{ + return __x.real() == __y.real() && __x.imag() == __y.imag(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator==(const complex<_Tp>& __x, const _Tp& __y) +{ + return __x.real() == __y && __x.imag() == 0; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator==(const _Tp& __x, const complex<_Tp>& __y) +{ + return __x == __y.real() && 0 == __y.imag(); +} + +#if defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator==(const complex<_Tp>& __x, const ::std::complex<_Up>& __y) { + return __x.real() == _LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__y) + && __x.imag() == _LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator==(const ::std::complex<_Up>& __x, const complex<_Tp>& __y) { + return __y.real() == _LIBCUDACXX_ACCESS_STD_COMPLEX_REAL(__x) + && __y.imag() == _LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG(__x); +} +#endif // defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) +{ + return !(__x == __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator!=(const complex<_Tp>& __x, const _Tp& __y) +{ + return !(__x == __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator!=(const _Tp& __x, const complex<_Tp>& __y) +{ + return !(__x == __y); +} + +#if defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator!=(const complex<_Tp>& __x, const ::std::complex<_Up>& __y) { + return !(__x == __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +bool +operator!=(const ::std::complex<_Up>& __x, const complex<_Tp>& __y) { + return !(__x == __y); +} +#endif // defined(__cuda_std__) && !defined(_LIBCUDACXX_COMPILER_NVRTC) + +// 26.3.7 values: + +template ::value, + bool = is_floating_point<_Tp>::value + > +struct __libcpp_complex_overload_traits {}; + +// Integral Types +template +struct __libcpp_complex_overload_traits<_Tp, true, false> +{ + typedef double _ValueType; + typedef complex _ComplexType; +}; + +// Floating point types +template +struct __libcpp_complex_overload_traits<_Tp, false, true> +{ + typedef _Tp _ValueType; + typedef complex<_Tp> _ComplexType; +}; + +// real + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_Tp +real(const complex<_Tp>& __c) +{ + return __c.real(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +typename __libcpp_complex_overload_traits<_Tp>::_ValueType +real(_Tp __re) +{ + return __re; +} + +// imag + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_Tp +imag(const complex<_Tp>& __c) +{ + return __c.imag(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +typename __libcpp_complex_overload_traits<_Tp>::_ValueType +imag(_Tp) +{ + return 0; +} + +// abs + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_Tp +abs(const complex<_Tp>& __c) +{ + return _CUDA_VSTD::hypot(__c.real(), __c.imag()); +} + +// arg + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_Tp +arg(const complex<_Tp>& __c) +{ + return _CUDA_VSTD::atan2(__c.imag(), __c.real()); +} + +#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t< + is_same<_Tp, long double>::value, + long double +> +arg(_Tp __re) +{ + return _CUDA_VSTD::atan2l(0.L, __re); +} +#endif // _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value || is_same<_Tp, double>::value, + double +> +arg(_Tp __re) +{ + // integrals need to be promoted to double + return _CUDA_VSTD::atan2(0., static_cast(__re)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t< + is_same<_Tp, float>::value, + float +> +arg(_Tp __re) +{ + return _CUDA_VSTD::atan2f(0.F, __re); +} + +// norm + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +_Tp +norm(const complex<_Tp>& __c) +{ + if (_CUDA_VSTD::__constexpr_isinf(__c.real())) + return _CUDA_VSTD::abs(__c.real()); + if (_CUDA_VSTD::__constexpr_isinf(__c.imag())) + return _CUDA_VSTD::abs(__c.imag()); + return __c.real() * __c.real() + __c.imag() * __c.imag(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +typename __libcpp_complex_overload_traits<_Tp>::_ValueType +norm(_Tp __re) +{ + typedef typename __libcpp_complex_overload_traits<_Tp>::_ValueType _ValueType; + return static_cast<_ValueType>(__re) * __re; +} + +// conj + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +complex<_Tp> +conj(const complex<_Tp>& __c) +{ + return complex<_Tp>(__c.real(), -__c.imag()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +typename __libcpp_complex_overload_traits<_Tp>::_ComplexType +conj(_Tp __re) +{ + typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType; + return _ComplexType(__re); +} + + + +// proj + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +complex<_Tp> +proj(const complex<_Tp>& __c) +{ + complex<_Tp> __r = __c; + if (_CUDA_VSTD::__constexpr_isinf(__c.real()) || _CUDA_VSTD::__constexpr_isinf(__c.imag())) + __r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag())); + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_floating_point<_Tp>::value, + typename __libcpp_complex_overload_traits<_Tp>::_ComplexType +> +proj(_Tp __re) +{ + if (_CUDA_VSTD::__constexpr_isinf(__re)) + __re = _CUDA_VSTD::abs(__re); + return complex<_Tp>(__re); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_integral<_Tp>::value, + typename __libcpp_complex_overload_traits<_Tp>::_ComplexType +> +proj(_Tp __re) +{ + typedef typename __libcpp_complex_overload_traits<_Tp>::_ComplexType _ComplexType; + return _ComplexType(__re); +} + +// polar + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +polar(const _Tp& __rho, const _Tp& __theta = _Tp()) +{ + if (_CUDA_VSTD::__constexpr_isnan(__rho) || _CUDA_VSTD::signbit(__rho)) + return complex<_Tp>(_Tp(NAN), _Tp(NAN)); + if (_CUDA_VSTD::__constexpr_isnan(__theta)) + { + if (_CUDA_VSTD::__constexpr_isinf(__rho)) + return complex<_Tp>(__rho, __theta); + return complex<_Tp>(__theta, __theta); + } + if (_CUDA_VSTD::__constexpr_isinf(__theta)) + { + if (_CUDA_VSTD::__constexpr_isinf(__rho)) + return complex<_Tp>(__rho, _Tp(NAN)); + return complex<_Tp>(_Tp(NAN), _Tp(NAN)); + } + _Tp __x = __rho * _CUDA_VSTD::cos(__theta); + if (_CUDA_VSTD::__constexpr_isnan(__x)) + __x = 0; + _Tp __y = __rho * _CUDA_VSTD::sin(__theta); + if (_CUDA_VSTD::__constexpr_isnan(__y)) + __y = 0; + return complex<_Tp>(__x, __y); +} + +// log + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +complex<_Tp> +log(const complex<_Tp>& __x) +{ + return complex<_Tp>(_CUDA_VSTD::log(_CUDA_VSTD::abs(__x)), _CUDA_VSTD::arg(__x)); +} + +// log10 + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +complex<_Tp> +log10(const complex<_Tp>& __x) +{ + return _CUDA_VSTD::log(__x) / _CUDA_VSTD::log(_Tp(10)); +} + +// sqrt + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +sqrt(const complex<_Tp>& __x) +{ + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + return complex<_Tp>(_Tp(INFINITY), __x.imag()); + if (_CUDA_VSTD::__constexpr_isinf(__x.real())) + { + if (__x.real() > _Tp(0)) + return complex<_Tp>(__x.real(), _CUDA_VSTD::__constexpr_isnan(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag())); + return complex<_Tp>(_CUDA_VSTD::__constexpr_isnan(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag())); + } + return _CUDA_VSTD::polar(_CUDA_VSTD::sqrt(_CUDA_VSTD::abs(__x)), _CUDA_VSTD::arg(__x) / _Tp(2)); +} + +// exp + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +exp(const complex<_Tp>& __x) +{ + _Tp __i = __x.imag(); + if (__i == 0) { + return complex<_Tp>(_CUDA_VSTD::exp(__x.real()), copysign(_Tp(0), __x.imag())); + } + if (_CUDA_VSTD::__constexpr_isinf(__x.real())) + { + if (__x.real() < _Tp(0)) + { + if (!_CUDA_VSTD::__constexpr_isfinite(__i)) + __i = _Tp(1); + } + else if (__i == 0 || !_CUDA_VSTD::__constexpr_isfinite(__i)) + { + if (_CUDA_VSTD::__constexpr_isinf(__i)) + __i = _Tp(NAN); + return complex<_Tp>(__x.real(), __i); + } + } + _Tp __e = _CUDA_VSTD::exp(__x.real()); + return complex<_Tp>(__e * _CUDA_VSTD::cos(__i), __e * _CUDA_VSTD::sin(__i)); +} + +// pow + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +complex<_Tp> +pow(const complex<_Tp>& __x, const complex<_Tp>& __y) +{ + return _CUDA_VSTD::exp(__y * _CUDA_VSTD::log(__x)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +complex::type> +pow(const complex<_Tp>& __x, const complex<_Up>& __y) +{ + typedef complex::type> result_type; + return _CUDA_VSTD::pow(result_type(__x), result_type(__y)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_arithmetic<_Up>::value, + complex::type> +> +pow(const complex<_Tp>& __x, const _Up& __y) +{ + typedef complex::type> result_type; + return _CUDA_VSTD::pow(result_type(__x), result_type(__y)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__enable_if_t +< + is_arithmetic<_Tp>::value, + complex::type> +> +pow(const _Tp& __x, const complex<_Up>& __y) +{ + typedef complex::type> result_type; + return _CUDA_VSTD::pow(result_type(__x), result_type(__y)); +} + +// __sqr, computes pow(x, 2) + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +complex<_Tp> +__sqr(const complex<_Tp>& __x) +{ + return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()), + _Tp(2) * __x.real() * __x.imag()); +} + +// asinh + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +asinh(const complex<_Tp>& __x) +{ + const _Tp __pi(static_cast<_Tp>(atan2(+0., -0.))); + if (_CUDA_VSTD::__constexpr_isinf(__x.real())) + { + if (_CUDA_VSTD::__constexpr_isnan(__x.imag())) + return __x; + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); + return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); + } + if (_CUDA_VSTD::__constexpr_isnan(__x.real())) + { + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + return complex<_Tp>(__x.imag(), __x.real()); + if (__x.imag() == 0) + return __x; + return complex<_Tp>(__x.real(), __x.real()); + } + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag())); + complex<_Tp> __z = _CUDA_VSTD::log(__x + _CUDA_VSTD::sqrt(_CUDA_VSTD::__sqr(__x) + _Tp(1))); + return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag())); +} + +// acosh + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +acosh(const complex<_Tp>& __x) +{ + const _Tp __pi(static_cast<_Tp>(atan2(+0., -0.))); + if (_CUDA_VSTD::__constexpr_isinf(__x.real())) + { + if (_CUDA_VSTD::__constexpr_isnan(__x.imag())) + return complex<_Tp>(_CUDA_VSTD::abs(__x.real()), __x.imag()); + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + { + if (__x.real() > 0) + return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); + else + return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag())); + } + if (__x.real() < 0) + return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag())); + return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); + } + if (_CUDA_VSTD::__constexpr_isnan(__x.real())) + { + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + return complex<_Tp>(_CUDA_VSTD::abs(__x.imag()), __x.real()); + return complex<_Tp>(__x.real(), __x.real()); + } + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + return complex<_Tp>(_CUDA_VSTD::abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag())); + complex<_Tp> __z = _CUDA_VSTD::log(__x + _CUDA_VSTD::sqrt(_CUDA_VSTD::__sqr(__x) - _Tp(1))); + return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag())); +} + +// atanh + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +atanh(const complex<_Tp>& __x) +{ + const _Tp __pi(static_cast<_Tp>(atan2(+0., -0.))); + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + { + return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag())); + } + if (_CUDA_VSTD::__constexpr_isnan(__x.imag())) + { + if (_CUDA_VSTD::__constexpr_isinf(__x.real()) || __x.real() == 0) + return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag()); + return complex<_Tp>(__x.imag(), __x.imag()); + } + if (_CUDA_VSTD::__constexpr_isnan(__x.real())) + { + return complex<_Tp>(__x.real(), __x.real()); + } + if (_CUDA_VSTD::__constexpr_isinf(__x.real())) + { + return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag())); + } + if (_CUDA_VSTD::abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) + { + return complex<_Tp>(copysign(_Tp(INFINITY), __x.real()), copysign(_Tp(0), __x.imag())); + } + complex<_Tp> __z = _CUDA_VSTD::log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2); + return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag())); +} + +// sinh + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +sinh(const complex<_Tp>& __x) +{ + if (_CUDA_VSTD::__constexpr_isinf(__x.real()) && !_CUDA_VSTD::__constexpr_isfinite(__x.imag())) + return complex<_Tp>(__x.real(), _Tp(NAN)); + if (__x.real() == 0 && !_CUDA_VSTD::__constexpr_isfinite(__x.imag())) + return complex<_Tp>(__x.real(), _Tp(NAN)); + if (__x.imag() == 0 && !_CUDA_VSTD::__constexpr_isfinite(__x.real())) + return __x; + return complex<_Tp>(_CUDA_VSTD::sinh(__x.real()) * _CUDA_VSTD::cos(__x.imag()), _CUDA_VSTD::cosh(__x.real()) * _CUDA_VSTD::sin(__x.imag())); +} + +// cosh + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +cosh(const complex<_Tp>& __x) +{ + if (_CUDA_VSTD::__constexpr_isinf(__x.real()) && !_CUDA_VSTD::__constexpr_isfinite(__x.imag())) + return complex<_Tp>(_CUDA_VSTD::abs(__x.real()), _Tp(NAN)); + if (__x.real() == 0 && !_CUDA_VSTD::__constexpr_isfinite(__x.imag())) + return complex<_Tp>(_Tp(NAN), __x.real()); + if (__x.real() == 0 && __x.imag() == 0) + return complex<_Tp>(_Tp(1), __x.imag()); + if (__x.imag() == 0 && !_CUDA_VSTD::__constexpr_isfinite(__x.real())) + return complex<_Tp>(_CUDA_VSTD::abs(__x.real()), __x.imag()); + return complex<_Tp>(_CUDA_VSTD::cosh(__x.real()) * _CUDA_VSTD::cos(__x.imag()), _CUDA_VSTD::sinh(__x.real()) * _CUDA_VSTD::sin(__x.imag())); +} + +// tanh + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +tanh(const complex<_Tp>& __x) +{ + if (_CUDA_VSTD::__constexpr_isinf(__x.real())) + { + if (!_CUDA_VSTD::__constexpr_isfinite(__x.imag())) + return complex<_Tp>(copysign(_Tp(1), __x.real()), _Tp(0)); + return complex<_Tp>(copysign(_Tp(1), __x.real()), copysign(_Tp(0), _CUDA_VSTD::sin(_Tp(2) * __x.imag()))); + } + if (_CUDA_VSTD::__constexpr_isnan(__x.real()) && __x.imag() == 0) + return __x; + _Tp __2r(_Tp(2) * __x.real()); + _Tp __2i(_Tp(2) * __x.imag()); + _Tp __d(_CUDA_VSTD::cosh(__2r) + _CUDA_VSTD::cos(__2i)); + _Tp __2rsh(_CUDA_VSTD::sinh(__2r)); + if (_CUDA_VSTD::__constexpr_isinf(__2rsh) && _CUDA_VSTD::__constexpr_isinf(__d)) + return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1), + __2i > _Tp(0) ? _Tp(0) : _Tp(-0.)); + return complex<_Tp>(__2rsh/__d, _CUDA_VSTD::sin(__2i)/__d); +} + +// asin + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +asin(const complex<_Tp>& __x) +{ + complex<_Tp> __z = _CUDA_VSTD::asinh(complex<_Tp>(-__x.imag(), __x.real())); + return complex<_Tp>(__z.imag(), -__z.real()); +} + +// acos + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +acos(const complex<_Tp>& __x) +{ + const _Tp __pi(static_cast<_Tp>(atan2(+0., -0.))); + if (_CUDA_VSTD::__constexpr_isinf(__x.real())) + { + if (_CUDA_VSTD::__constexpr_isnan(__x.imag())) + return complex<_Tp>(__x.imag(), __x.real()); + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + { + if (__x.real() < _Tp(0)) + return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag()); + return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag()); + } + if (__x.real() < _Tp(0)) + return complex<_Tp>(__pi, _CUDA_VSTD::signbit(__x.imag()) ? -__x.real() : __x.real()); + return complex<_Tp>(_Tp(0), _CUDA_VSTD::signbit(__x.imag()) ? __x.real() : -__x.real()); + } + if (_CUDA_VSTD::__constexpr_isnan(__x.real())) + { + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + return complex<_Tp>(__x.real(), -__x.imag()); + return complex<_Tp>(__x.real(), __x.real()); + } + if (_CUDA_VSTD::__constexpr_isinf(__x.imag())) + return complex<_Tp>(__pi/_Tp(2), -__x.imag()); + if (__x.real() == 0 && (__x.imag() == 0 || _CUDA_VSTD::isnan(__x.imag()))) + return complex<_Tp>(__pi/_Tp(2), -__x.imag()); + complex<_Tp> __z = _CUDA_VSTD::log(__x + _CUDA_VSTD::sqrt(_CUDA_VSTD::__sqr(__x) - _Tp(1))); + if (_CUDA_VSTD::signbit(__x.imag())) + return complex<_Tp>(_CUDA_VSTD::abs(__z.imag()), _CUDA_VSTD::abs(__z.real())); + return complex<_Tp>(_CUDA_VSTD::abs(__z.imag()), -_CUDA_VSTD::abs(__z.real())); +} + +// atan + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +atan(const complex<_Tp>& __x) +{ + complex<_Tp> __z = _CUDA_VSTD::atanh(complex<_Tp>(-__x.imag(), __x.real())); + return complex<_Tp>(__z.imag(), -__z.real()); +} + +// sin + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +sin(const complex<_Tp>& __x) +{ + complex<_Tp> __z = _CUDA_VSTD::sinh(complex<_Tp>(-__x.imag(), __x.real())); + return complex<_Tp>(__z.imag(), -__z.real()); +} + +// cos + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +complex<_Tp> +cos(const complex<_Tp>& __x) +{ + return _CUDA_VSTD::cosh(complex<_Tp>(-__x.imag(), __x.real())); +} + +// tan + +template +_LIBCUDACXX_INLINE_VISIBILITY complex<_Tp> +tan(const complex<_Tp>& __x) +{ + complex<_Tp> __z = _CUDA_VSTD::tanh(complex<_Tp>(-__x.imag(), __x.real())); + return complex<_Tp>(__z.imag(), -__z.real()); +} + +#ifndef __cuda_std__ +#if !defined(_LIBCUDACXX_HAS_NO_LOCALIZATION) +template +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) +{ + if (__is.good()) + { + _CUDA_VSTD::ws(__is); + if (__is.peek() == _CharT('(')) + { + __is.get(); + _Tp __r; + __is >> __r; + if (!__is.fail()) + { + _CUDA_VSTD::ws(__is); + _CharT __c = __is.peek(); + if (__c == _CharT(',')) + { + __is.get(); + _Tp __i; + __is >> __i; + if (!__is.fail()) + { + _CUDA_VSTD::ws(__is); + __c = __is.peek(); + if (__c == _CharT(')')) + { + __is.get(); + __x = complex<_Tp>(__r, __i); + } + else + __is.setstate(__is.failbit); + } + else + __is.setstate(__is.failbit); + } + else if (__c == _CharT(')')) + { + __is.get(); + __x = complex<_Tp>(__r, _Tp(0)); + } + else + __is.setstate(__is.failbit); + } + else + __is.setstate(__is.failbit); + } + else + { + _Tp __r; + __is >> __r; + if (!__is.fail()) + __x = complex<_Tp>(__r, _Tp(0)); + else + __is.setstate(__is.failbit); + } + } + else + __is.setstate(__is.failbit); + return __is; +} + +template +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) +{ + basic_ostringstream<_CharT, _Traits> __s; + __s.flags(__os.flags()); + __s.imbue(__os.getloc()); + __s.precision(__os.precision()); + __s << '(' << __x.real() << ',' << __x.imag() << ')'; + return __os << __s.str(); +} +#endif // !_LIBCUDACXX_HAS_NO_LOCALIZATION +#else // ^^^ !__cuda_std__ ^^^ / vvv __cuda_std__ +#ifndef _LIBCUDACXX_COMPILER_NVRTC +template +::std::basic_ostream& operator<<(::std::basic_ostream& os, const complex& z) +{ + os << '(' << z.real() << ',' << z.imag() << ')'; + return os; +} + +template +::std::basic_istream& +operator>>(::std::basic_istream& is, complex& z) +{ + ValueType re, im; + + charT ch; + is >> ch; + + if(ch == '(') + { + is >> re >> ch; + if (ch == ',') + { + is >> im >> ch; + if (ch == ')') + { + z = complex(re, im); + } + else + { + is.setstate(::std::ios_base::failbit); + } + } + else if (ch == ')') + { + z = re; + } + else + { + is.setstate(::std::ios_base::failbit); + } + } + else + { + is.putback(ch); + is >> re; + z = re; + } + return is; +} +#endif // _LIBCUDACXX_COMPILER_NVRTC +#endif // __cuda_std__ + +#if _LIBCUDACXX_STD_VER > 11 && defined(_LIBCUDACXX_HAS_STL_LITERALS) +// Literal suffix for complex number literals [complex.literals] + +_CCCL_DIAG_PUSH +_CCCL_DIAG_SUPPRESS_GCC("-Wliteral-suffix") +_CCCL_DIAG_SUPPRESS_CLANG("-Wuser-defined-literals") +_CCCL_DIAG_SUPPRESS_MSVC(4455) + +inline namespace literals +{ + inline namespace complex_literals + { +#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE + _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex operator""il(long double __im) + { + return { 0.0l, __im }; + } + + _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex operator""il(unsigned long long __im) + { + return { 0.0l, static_cast(__im) }; + } + + _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex operator""i(long double __im) + { + return { 0.0, static_cast(__im) }; + } + + _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex operator""i(unsigned long long __im) + { + return { 0.0, static_cast(__im) }; + } + + + _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex operator""if(long double __im) + { + return { 0.0f, static_cast(__im) }; + } + + _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex operator""if(unsigned long long __im) + { + return { 0.0f, static_cast(__im) }; + } +#else + _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex operator""i(double __im) + { + return { 0.0, static_cast(__im) }; + } + + _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex operator""i(unsigned long long __im) + { + return { 0.0, static_cast(__im) }; + } + + _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex operator""if(double __im) + { + return { 0.0f, static_cast(__im) }; + } + + _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY + constexpr complex operator""if(unsigned long long __im) + { + return { 0.0f, static_cast(__im) }; + } +#endif + } // namespace complex_literals +} // namespace literals + +_CCCL_DIAG_POP + +#endif + +_LIBCUDACXX_END_NAMESPACE_STD + +#undef _LIBCUDACXX_ACCESS_STD_COMPLEX_REAL +#undef _LIBCUDACXX_ACCESS_STD_COMPLEX_IMAG + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_COMPLEX diff --git a/cuda_toolkit/include/complex.h b/cuda_toolkit/include/complex.h new file mode 100644 index 0000000000000000000000000000000000000000..c49a404d52b397a99c77c3852a04179fde2a7363 --- /dev/null +++ b/cuda_toolkit/include/complex.h @@ -0,0 +1,40 @@ +// -*- C++ -*- +//===--------------------------- complex.h --------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_COMPLEX_H +#define _LIBCUDACXX_COMPLEX_H + +/* + complex.h synopsis + +#include + +*/ + +#include <__config> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#ifdef __cplusplus + +#include + +#else // __cplusplus + +#include_next + +#endif // __cplusplus + +#endif // _LIBCUDACXX_COMPLEX_H diff --git a/cuda_toolkit/include/concepts b/cuda_toolkit/include/concepts new file mode 100644 index 0000000000000000000000000000000000000000..63ad38c098052b19705ee3934b2f6eea4f46e7ac --- /dev/null +++ b/cuda_toolkit/include/concepts @@ -0,0 +1,173 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CONCEPTS +#define _LIBCUDACXX_CONCEPTS + +/* + concepts synopsis +namespace std { + // [concepts.lang], language-related concepts + // [concept.same], concept same_as + template + concept same_as = see below; + + // [concept.derived], concept derived_from + template + concept derived_from = see below; + + // [concept.convertible], concept convertible_to + template + concept convertible_to = see below; + + // [concept.commonref], concept common_reference_with + template + concept common_reference_with = see below; + + // [concept.common], concept common_with + template + concept common_with = see below; + + // [concepts.arithmetic], arithmetic concepts + template + concept integral = see below; + template + concept signed_integral = see below; + template + concept unsigned_integral = see below; + template + concept floating_point = see below; + + // [concept.assignable], concept assignable_from + template + concept assignable_from = see below; + + // [concept.swappable], concept swappable + namespace ranges { + inline namespace unspecified { + inline constexpr unspecified swap = unspecified; + } + } + template + concept swappable = see below; + template + concept swappable_with = see below; + + // [concept.destructible], concept destructible + template + concept destructible = see below; + + // [concept.constructible], concept constructible_from + template + concept constructible_from = see below; + + // [concept.default.init], concept default_initializable + template + concept default_initializable = see below; + + // [concept.moveconstructible], concept move_constructible + template + concept move_constructible = see below; + + // [concept.copyconstructible], concept copy_constructible + template + concept copy_constructible = see below; + + // [concept.equalitycomparable], concept equality_comparable + template + concept equality_comparable = see below; + template + concept equality_comparable_with = see below; + + // [concept.totallyordered], concept totally_ordered + template + concept totally_ordered = see below; + template + concept totally_ordered_with = see below; + + // [concepts.object], object concepts + template + concept movable = see below; + template + concept copyable = see below; + template + concept semiregular = see below; + template + concept regular = see below; + + // [concepts.callable], callable concepts + // [concept.invocable], concept invocable + template + concept invocable = see below; + + // [concept.regularinvocable], concept regular_invocable + template + concept regular_invocable = see below; + + // [concept.predicate], concept predicate + template + concept predicate = see below; + + // [concept.relation], concept relation + template + concept relation = see below; + + // [concept.equiv], concept equivalence_relation + template + concept equivalence_relation = see below; + + // [concept.strictweakorder], concept strict_weak_order + template + concept strict_weak_order = see below; +} + +*/ + +#ifndef __cuda_std__ +#include <__config> +#endif // __cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__concepts/__concept_macros.h" +#include "__concepts/_One_of.h" +#include "__concepts/arithmetic.h" +#include "__concepts/assignable.h" +#include "__concepts/boolean_testable.h" +#include "__concepts/class_or_enum.h" +#include "__concepts/common_reference_with.h" +#include "__concepts/common_with.h" +#include "__concepts/constructible.h" +#include "__concepts/convertible_to.h" +#include "__concepts/copyable.h" +#include "__concepts/derived_from.h" +#include "__concepts/destructible.h" +#include "__concepts/different_from.h" +#include "__concepts/equality_comparable.h" +#include "__concepts/invocable.h" +#include "__concepts/movable.h" +#include "__concepts/predicate.h" +#include "__concepts/regular.h" +#include "__concepts/relation.h" +#include "__concepts/same_as.h" +#include "__concepts/semiregular.h" +#include "__concepts/swappable.h" +#include "__concepts/totally_ordered.h" + +#include "version" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#endif // _LIBCUDACXX_CONCEPTS diff --git a/cuda_toolkit/include/condition_variable b/cuda_toolkit/include/condition_variable new file mode 100644 index 0000000000000000000000000000000000000000..b7a25e87eccd4bd29d7c1f0a23c701ce2273c430 --- /dev/null +++ b/cuda_toolkit/include/condition_variable @@ -0,0 +1,272 @@ +// -*- C++ -*- +//===---------------------- condition_variable ----------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CONDITION_VARIABLE +#define _LIBCUDACXX_CONDITION_VARIABLE + +/* + condition_variable synopsis + +namespace std +{ + +enum class cv_status { no_timeout, timeout }; + +class condition_variable +{ +public: + condition_variable(); + ~condition_variable(); + + condition_variable(const condition_variable&) = delete; + condition_variable& operator=(const condition_variable&) = delete; + + void notify_one() noexcept; + void notify_all() noexcept; + + void wait(unique_lock& lock); + template + void wait(unique_lock& lock, Predicate pred); + + template + cv_status + wait_until(unique_lock& lock, + const chrono::time_point& abs_time); + + template + bool + wait_until(unique_lock& lock, + const chrono::time_point& abs_time, + Predicate pred); + + template + cv_status + wait_for(unique_lock& lock, + const chrono::duration& rel_time); + + template + bool + wait_for(unique_lock& lock, + const chrono::duration& rel_time, + Predicate pred); + + typedef pthread_cond_t* native_handle_type; + native_handle_type native_handle(); +}; + +void notify_all_at_thread_exit(condition_variable& cond, unique_lock lk); + +class condition_variable_any +{ +public: + condition_variable_any(); + ~condition_variable_any(); + + condition_variable_any(const condition_variable_any&) = delete; + condition_variable_any& operator=(const condition_variable_any&) = delete; + + void notify_one() noexcept; + void notify_all() noexcept; + + template + void wait(Lock& lock); + template + void wait(Lock& lock, Predicate pred); + + template + cv_status + wait_until(Lock& lock, + const chrono::time_point& abs_time); + + template + bool + wait_until(Lock& lock, + const chrono::time_point& abs_time, + Predicate pred); + + template + cv_status + wait_for(Lock& lock, + const chrono::duration& rel_time); + + template + bool + wait_for(Lock& lock, + const chrono::duration& rel_time, + Predicate pred); +}; + +} // std + +*/ + +#include <__config> +#include <__mutex_base> +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#ifndef _LIBCUDACXX_HAS_NO_THREADS + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +class _LIBCUDACXX_TYPE_VIS condition_variable_any +{ + condition_variable __cv_; + shared_ptr __mut_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + condition_variable_any(); + + _LIBCUDACXX_INLINE_VISIBILITY + void notify_one() noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + void notify_all() noexcept; + + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + void wait(_Lock& __lock); + template + _LIBCUDACXX_INLINE_VISIBILITY + void wait(_Lock& __lock, _Predicate __pred); + + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + cv_status + wait_until(_Lock& __lock, + const chrono::time_point<_Clock, _Duration>& __t); + + template + bool + _LIBCUDACXX_INLINE_VISIBILITY + wait_until(_Lock& __lock, + const chrono::time_point<_Clock, _Duration>& __t, + _Predicate __pred); + + template + cv_status + _LIBCUDACXX_INLINE_VISIBILITY + wait_for(_Lock& __lock, + const chrono::duration<_Rep, _Period>& __d); + + template + bool + _LIBCUDACXX_INLINE_VISIBILITY + wait_for(_Lock& __lock, + const chrono::duration<_Rep, _Period>& __d, + _Predicate __pred); +}; + +inline +condition_variable_any::condition_variable_any() + : __mut_(make_shared()) {} + +inline +void +condition_variable_any::notify_one() noexcept +{ + {lock_guard __lx(*__mut_);} + __cv_.notify_one(); +} + +inline +void +condition_variable_any::notify_all() noexcept +{ + {lock_guard __lx(*__mut_);} + __cv_.notify_all(); +} + +struct __lock_external +{ + template + void operator()(_Lock* __m) {__m->lock();} +}; + +template +void +condition_variable_any::wait(_Lock& __lock) +{ + shared_ptr __mut = __mut_; + unique_lock __lk(*__mut); + __lock.unlock(); + unique_ptr<_Lock, __lock_external> __lxx(&__lock); + lock_guard > __lx(__lk, adopt_lock); + __cv_.wait(__lk); +} // __mut_.unlock(), __lock.lock() + +template +inline +void +condition_variable_any::wait(_Lock& __lock, _Predicate __pred) +{ + while (!__pred()) + wait(__lock); +} + +template +cv_status +condition_variable_any::wait_until(_Lock& __lock, + const chrono::time_point<_Clock, _Duration>& __t) +{ + shared_ptr __mut = __mut_; + unique_lock __lk(*__mut); + __lock.unlock(); + unique_ptr<_Lock, __lock_external> __lxx(&__lock); + lock_guard > __lx(__lk, adopt_lock); + return __cv_.wait_until(__lk, __t); +} // __mut_.unlock(), __lock.lock() + +template +inline +bool +condition_variable_any::wait_until(_Lock& __lock, + const chrono::time_point<_Clock, _Duration>& __t, + _Predicate __pred) +{ + while (!__pred()) + if (wait_until(__lock, __t) == cv_status::timeout) + return __pred(); + return true; +} + +template +inline +cv_status +condition_variable_any::wait_for(_Lock& __lock, + const chrono::duration<_Rep, _Period>& __d) +{ + return wait_until(__lock, chrono::steady_clock::now() + __d); +} + +template +inline +bool +condition_variable_any::wait_for(_Lock& __lock, + const chrono::duration<_Rep, _Period>& __d, + _Predicate __pred) +{ + return wait_until(__lock, chrono::steady_clock::now() + __d, + _CUDA_VSTD::move(__pred)); +} + +_LIBCUDACXX_FUNC_VIS +void notify_all_at_thread_exit(condition_variable& cond, unique_lock lk); + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // !_LIBCUDACXX_HAS_NO_THREADS + +#endif // _LIBCUDACXX_CONDITION_VARIABLE diff --git a/cuda_toolkit/include/cooperative_groups.h b/cuda_toolkit/include/cooperative_groups.h new file mode 100644 index 0000000000000000000000000000000000000000..f7a7d26238bf3cf7c4a60934d7549078e1df1889 --- /dev/null +++ b/cuda_toolkit/include/cooperative_groups.h @@ -0,0 +1,1730 @@ +/* + * Copyright 1993-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef _COOPERATIVE_GROUPS_H_ +#define _COOPERATIVE_GROUPS_H_ + +#if defined(__cplusplus) && defined(__CUDACC__) + +#include "cooperative_groups/details/info.h" +#include "cooperative_groups/details/driver_abi.h" +#include "cooperative_groups/details/helpers.h" +#include "cooperative_groups/details/memory.h" + +#if defined(_CG_HAS_STL_ATOMICS) +#include +#define _CG_THREAD_SCOPE(scope) _CG_STATIC_CONST_DECL cuda::thread_scope thread_scope = scope; +#else +#define _CG_THREAD_SCOPE(scope) +#endif + +_CG_BEGIN_NAMESPACE + +namespace details { + _CG_CONST_DECL unsigned int coalesced_group_id = 1; + _CG_CONST_DECL unsigned int multi_grid_group_id = 2; + _CG_CONST_DECL unsigned int grid_group_id = 3; + _CG_CONST_DECL unsigned int thread_block_id = 4; + _CG_CONST_DECL unsigned int multi_tile_group_id = 5; + _CG_CONST_DECL unsigned int cluster_group_id = 6; +} + +/** + * class thread_group; + * + * Generic thread group type, into which all groups are convertible. + * It acts as a container for all storage necessary for the derived groups, + * and will dispatch the API calls to the correct derived group. This means + * that all derived groups must implement the same interface as thread_group. + */ +class thread_group +{ +protected: + struct group_data { + unsigned int _unused : 1; + unsigned int type : 7, : 0; + }; + + struct gg_data { + details::grid_workspace *gridWs; + }; + +#if defined(_CG_CPP11_FEATURES) && defined(_CG_ABI_EXPERIMENTAL) + struct mg_data { + unsigned long long _unused : 1; + unsigned long long type : 7; + unsigned long long handle : 56; + const details::multi_grid::multi_grid_functions *functions; + }; +#endif + + struct tg_data { + unsigned int is_tiled : 1; + unsigned int type : 7; + unsigned int size : 24; + // packed to 4b + unsigned int metaGroupSize : 16; + unsigned int metaGroupRank : 16; + // packed to 8b + unsigned int mask; + // packed to 12b + unsigned int _res; + }; + + friend _CG_QUALIFIER thread_group tiled_partition(const thread_group& parent, unsigned int tilesz); + friend class thread_block; + + union __align__(8) { + group_data group; + tg_data coalesced; + gg_data grid; +#if defined(_CG_CPP11_FEATURES) && defined(_CG_ABI_EXPERIMENTAL) + mg_data multi_grid; +#endif + } _data; + + _CG_QUALIFIER thread_group operator=(const thread_group& src); + + _CG_QUALIFIER thread_group(unsigned int type) { + _data.group.type = type; + _data.group._unused = false; + } + +#ifdef _CG_CPP11_FEATURES + static_assert(sizeof(tg_data) <= 16, "Failed size check"); + static_assert(sizeof(gg_data) <= 16, "Failed size check"); +# ifdef _CG_ABI_EXPERIMENTAL + static_assert(sizeof(mg_data) <= 16, "Failed size check"); +# endif +#endif + +public: + _CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_device) + + _CG_QUALIFIER unsigned long long size() const; + _CG_QUALIFIER unsigned long long num_threads() const; + _CG_QUALIFIER unsigned long long thread_rank() const; + _CG_QUALIFIER void sync() const; + _CG_QUALIFIER unsigned int get_type() const { + return _data.group.type; + } + +}; + +template +struct thread_group_base : public thread_group { + _CG_QUALIFIER thread_group_base() : thread_group(TyId) {} + _CG_STATIC_CONST_DECL unsigned int id = TyId; +}; + +#if defined(_CG_HAS_MULTI_GRID_GROUP) + +/** + * class multi_grid_group; + * + * Threads within this this group are guaranteed to be co-resident on the + * same system, on multiple devices within the same launched kernels. + * To use this group, the kernel must have been launched with + * cuLaunchCooperativeKernelMultiDevice (or the CUDA Runtime equivalent), + * and the device must support it (queryable device attribute). + * + * Constructed via this_multi_grid(); + */ + + +# if defined(_CG_CPP11_FEATURES) && defined(_CG_ABI_EXPERIMENTAL) +class multi_grid_group; + +// Multi grid group requires these functions to be templated to prevent ptxas from trying to use CG syscalls +template +__device__ _CG_DEPRECATED multi_grid_group this_multi_grid(); + +class multi_grid_group : public thread_group_base +{ +private: + template + _CG_QUALIFIER multi_grid_group() { + _data.multi_grid.functions = details::multi_grid::load_grid_intrinsics(); + _data.multi_grid.handle = _data.multi_grid.functions->get_intrinsic_handle(); + } + + friend multi_grid_group this_multi_grid(); + +public: + _CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_system) + + _CG_QUALIFIER bool is_valid() const { + return (_data.multi_grid.handle != 0); + } + + _CG_QUALIFIER void sync() const { + if (!is_valid()) { + _CG_ABORT(); + } + _data.multi_grid.functions->sync(_data.multi_grid.handle); + } + + _CG_QUALIFIER unsigned long long num_threads() const { + _CG_ASSERT(is_valid()); + return _data.multi_grid.functions->size(_data.multi_grid.handle); + } + + _CG_QUALIFIER unsigned long long size() const { + return num_threads(); + } + + _CG_QUALIFIER unsigned long long thread_rank() const { + _CG_ASSERT(is_valid()); + return _data.multi_grid.functions->thread_rank(_data.multi_grid.handle); + } + + _CG_QUALIFIER unsigned int grid_rank() const { + _CG_ASSERT(is_valid()); + return (_data.multi_grid.functions->grid_rank(_data.multi_grid.handle)); + } + + _CG_QUALIFIER unsigned int num_grids() const { + _CG_ASSERT(is_valid()); + return (_data.multi_grid.functions->num_grids(_data.multi_grid.handle)); + } +}; +# else +class multi_grid_group +{ +private: + unsigned long long _handle; + unsigned int _size; + unsigned int _rank; + + friend _CG_QUALIFIER multi_grid_group this_multi_grid(); + + _CG_QUALIFIER multi_grid_group() { + _handle = details::multi_grid::get_intrinsic_handle(); + _size = details::multi_grid::size(_handle); + _rank = details::multi_grid::thread_rank(_handle); + } + +public: + _CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_system) + + _CG_QUALIFIER _CG_DEPRECATED bool is_valid() const { + return (_handle != 0); + } + + _CG_QUALIFIER _CG_DEPRECATED void sync() const { + if (!is_valid()) { + _CG_ABORT(); + } + details::multi_grid::sync(_handle); + } + + _CG_QUALIFIER _CG_DEPRECATED unsigned long long num_threads() const { + _CG_ASSERT(is_valid()); + return _size; + } + + _CG_QUALIFIER _CG_DEPRECATED unsigned long long size() const { + return num_threads(); + } + + _CG_QUALIFIER _CG_DEPRECATED unsigned long long thread_rank() const { + _CG_ASSERT(is_valid()); + return _rank; + } + + _CG_QUALIFIER _CG_DEPRECATED unsigned int grid_rank() const { + _CG_ASSERT(is_valid()); + return (details::multi_grid::grid_rank(_handle)); + } + + _CG_QUALIFIER _CG_DEPRECATED unsigned int num_grids() const { + _CG_ASSERT(is_valid()); + return (details::multi_grid::num_grids(_handle)); + } +}; +# endif + +/** + * multi_grid_group this_multi_grid() + * + * Constructs a multi_grid_group + */ +# if defined(_CG_CPP11_FEATURES) && defined(_CG_ABI_EXPERIMENTAL) +template +__device__ +#else +_CG_QUALIFIER +# endif +_CG_DEPRECATED +multi_grid_group this_multi_grid() +{ + return multi_grid_group(); +} +#endif + +/** + * class grid_group; + * + * Threads within this this group are guaranteed to be co-resident on the + * same device within the same launched kernel. To use this group, the kernel + * must have been launched with cuLaunchCooperativeKernel (or the CUDA Runtime equivalent), + * and the device must support it (queryable device attribute). + * + * Constructed via this_grid(); + */ +class grid_group : public thread_group_base +{ + _CG_STATIC_CONST_DECL unsigned int _group_id = details::grid_group_id; + friend _CG_QUALIFIER grid_group this_grid(); + +private: + _CG_QUALIFIER grid_group(details::grid_workspace *gridWs) { + _data.grid.gridWs = gridWs; + } + + public: + _CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_device) + + _CG_QUALIFIER bool is_valid() const { + return (_data.grid.gridWs != NULL); + } + + _CG_QUALIFIER void sync() const { + if (!is_valid()) { + _CG_ABORT(); + } + details::grid::sync(&_data.grid.gridWs->barrier); + } + +#if defined(_CG_CPP11_FEATURES) + using arrival_token = unsigned int; + + _CG_QUALIFIER arrival_token barrier_arrive() const { + if (!is_valid()) { + _CG_ABORT(); + } + return details::grid::barrier_arrive(&_data.grid.gridWs->barrier); + } + + _CG_QUALIFIER void barrier_wait(arrival_token&& token) const { + details::grid::barrier_wait(token, &_data.grid.gridWs->barrier); + } +#endif + + _CG_STATIC_QUALIFIER unsigned long long size() { + return details::grid::size(); + } + + _CG_STATIC_QUALIFIER dim3 group_dim() { + return details::grid::grid_dim(); + } + + _CG_STATIC_QUALIFIER dim3 dim_threads() { + return details::grid::dim_threads(); + } + + _CG_STATIC_QUALIFIER unsigned long long num_threads() { + return details::grid::num_threads(); + } + + _CG_STATIC_QUALIFIER dim3 thread_index() { + return details::grid::thread_index(); + } + + _CG_STATIC_QUALIFIER unsigned long long thread_rank() { + return details::grid::thread_rank(); + } + + _CG_STATIC_QUALIFIER dim3 dim_blocks() { + return details::grid::dim_blocks(); + } + + _CG_STATIC_QUALIFIER unsigned long long num_blocks() { + return details::grid::num_blocks(); + } + + _CG_STATIC_QUALIFIER dim3 block_index() { + return details::grid::block_index(); + } + + _CG_STATIC_QUALIFIER unsigned long long block_rank() { + return details::grid::block_rank(); + } + +# if defined(_CG_HAS_CLUSTER_GROUP) + _CG_STATIC_QUALIFIER dim3 dim_clusters() { + return details::grid::dim_clusters(); + } + + _CG_STATIC_QUALIFIER unsigned long long num_clusters() { + return details::grid::num_clusters(); + } + + _CG_STATIC_QUALIFIER dim3 cluster_index() { + return details::grid::cluster_index(); + } + + _CG_STATIC_QUALIFIER unsigned long long cluster_rank() { + return details::grid::cluster_rank(); + } +# endif +}; + +_CG_QUALIFIER grid_group this_grid() { + // Load a workspace from the driver + grid_group gg(details::get_grid_workspace()); +#ifdef _CG_DEBUG + // *all* threads must be available to synchronize + gg.sync(); +#endif // _CG_DEBUG + return gg; +} + +#if defined(_CG_HAS_CLUSTER_GROUP) +/** + * class cluster_group + * + * Every GPU kernel is executed by a grid of thread blocks. A grid can be evenly + * divided along all dimensions to form groups of blocks, each group of which is + * a block cluster. Clustered grids are subject to various restrictions and + * limitations. Primarily, a cluster consists of at most 8 blocks by default + * (although the user is allowed to opt-in to non-standard sizes,) and clustered + * grids are subject to additional occupancy limitations due to per-cluster + * hardware resource consumption. In exchange, a block cluster is guaranteed to + * be a cooperative group, with access to all cooperative group capabilities, as + * well as cluster specific capabilities and accelerations. A cluster_group + * represents a block cluster. + * + * Constructed via this_cluster_group(); + */ +class cluster_group : public thread_group_base +{ + // Friends + friend _CG_QUALIFIER cluster_group this_cluster(); + + // Disable constructor + _CG_QUALIFIER cluster_group() + { + } + + public: + //_CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_cluster) + + using arrival_token = struct {}; + + // Functionality exposed by the group + _CG_STATIC_QUALIFIER void sync() + { + return details::cluster::sync(); + } + + _CG_STATIC_QUALIFIER arrival_token barrier_arrive() + { + details::cluster::barrier_arrive(); + return arrival_token(); + } + + _CG_STATIC_QUALIFIER void barrier_wait() + { + return details::cluster::barrier_wait(); + } + + _CG_STATIC_QUALIFIER void barrier_wait(arrival_token&&) + { + return details::cluster::barrier_wait(); + } + + _CG_STATIC_QUALIFIER unsigned int query_shared_rank(const void *addr) + { + return details::cluster::query_shared_rank(addr); + } + + template + _CG_STATIC_QUALIFIER T* map_shared_rank(T *addr, int rank) + { + return details::cluster::map_shared_rank(addr, rank); + } + + _CG_STATIC_QUALIFIER dim3 block_index() + { + return details::cluster::block_index(); + } + + _CG_STATIC_QUALIFIER unsigned int block_rank() + { + return details::cluster::block_rank(); + } + + _CG_STATIC_QUALIFIER dim3 thread_index() + { + return details::cluster::thread_index(); + } + + _CG_STATIC_QUALIFIER unsigned int thread_rank() + { + return details::cluster::thread_rank(); + } + + _CG_STATIC_QUALIFIER dim3 dim_blocks() + { + return details::cluster::dim_blocks(); + } + + _CG_STATIC_QUALIFIER unsigned int num_blocks() + { + return details::cluster::num_blocks(); + } + + _CG_STATIC_QUALIFIER dim3 dim_threads() + { + return details::cluster::dim_threads(); + } + + _CG_STATIC_QUALIFIER unsigned int num_threads() + { + return details::cluster::num_threads(); + } + + // Legacy aliases + _CG_STATIC_QUALIFIER unsigned int size() + { + return num_threads(); + } +}; + +/* + * cluster_group this_cluster() + * + * Constructs a cluster_group + */ +_CG_QUALIFIER cluster_group this_cluster() +{ + cluster_group cg; +#ifdef _CG_DEBUG + cg.sync(); +#endif + return cg; +} +#endif + +#if defined(_CG_CPP11_FEATURES) +class thread_block; +template +_CG_QUALIFIER thread_block this_thread_block(block_tile_memory& scratch); +#endif + +/** + * class thread_block + * + * Every GPU kernel is executed by a grid of thread blocks, and threads within + * each block are guaranteed to reside on the same streaming multiprocessor. + * A thread_block represents a thread block whose dimensions are not known until runtime. + * + * Constructed via this_thread_block(); + */ +class thread_block : public thread_group_base +{ + // Friends + friend _CG_QUALIFIER thread_block this_thread_block(); + friend _CG_QUALIFIER thread_group tiled_partition(const thread_group& parent, unsigned int tilesz); + friend _CG_QUALIFIER thread_group tiled_partition(const thread_block& parent, unsigned int tilesz); + +#if defined(_CG_CPP11_FEATURES) + template + friend _CG_QUALIFIER thread_block this_thread_block(block_tile_memory& scratch); + template + friend class __static_size_multi_warp_tile_base; + + details::multi_warp_scratch* const tile_memory; + + template + _CG_QUALIFIER thread_block(block_tile_memory& scratch) : + tile_memory(details::get_scratch_ptr(&scratch)) { +#ifdef _CG_DEBUG + if (num_threads() > MaxBlockSize) { + details::abort(); + } +#endif +#if !defined(_CG_HAS_RESERVED_SHARED) + tile_memory->init_barriers(thread_rank()); + sync(); +#endif + } +#endif + + // Disable constructor + _CG_QUALIFIER thread_block() +#if defined(_CG_CPP11_FEATURES) + : tile_memory(details::get_scratch_ptr(NULL)) +#endif + { } + + // Internal Use + _CG_QUALIFIER thread_group _get_tiled_threads(unsigned int tilesz) const { + const bool pow2_tilesz = ((tilesz & (tilesz - 1)) == 0); + + // Invalid, immediately fail + if (tilesz == 0 || (tilesz > 32) || !pow2_tilesz) { + details::abort(); + return (thread_block()); + } + + unsigned int mask; + unsigned int base_offset = thread_rank() & (~(tilesz - 1)); + unsigned int masklength = min((unsigned int)size() - base_offset, tilesz); + + mask = (unsigned int)(-1) >> (32 - masklength); + mask <<= (details::laneid() & ~(tilesz - 1)); + thread_group tile = thread_group(details::coalesced_group_id); + tile._data.coalesced.mask = mask; + tile._data.coalesced.size = __popc(mask); + tile._data.coalesced.metaGroupSize = (details::cta::size() + tilesz - 1) / tilesz; + tile._data.coalesced.metaGroupRank = details::cta::thread_rank() / tilesz; + tile._data.coalesced.is_tiled = true; + return (tile); + } + + public: + _CG_STATIC_CONST_DECL unsigned int _group_id = details::thread_block_id; + _CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_block) + + _CG_STATIC_QUALIFIER void sync() { + details::cta::sync(); + } + +#if defined(_CG_CPP11_FEATURES) + struct arrival_token {}; + + _CG_QUALIFIER arrival_token barrier_arrive() const { + return arrival_token(); + } + + _CG_QUALIFIER void barrier_wait(arrival_token&&) const { + details::cta::sync(); + } +#endif + + _CG_STATIC_QUALIFIER unsigned int size() { + return details::cta::size(); + } + + _CG_STATIC_QUALIFIER unsigned int thread_rank() { + return details::cta::thread_rank(); + } + + // Additional functionality exposed by the group + _CG_STATIC_QUALIFIER dim3 group_index() { + return details::cta::group_index(); + } + + _CG_STATIC_QUALIFIER dim3 thread_index() { + return details::cta::thread_index(); + } + + _CG_STATIC_QUALIFIER dim3 group_dim() { + return details::cta::block_dim(); + } + + _CG_STATIC_QUALIFIER dim3 dim_threads() { + return details::cta::dim_threads(); + } + + _CG_STATIC_QUALIFIER unsigned int num_threads() { + return details::cta::num_threads(); + } + +}; + +/** + * thread_block this_thread_block() + * + * Constructs a thread_block group + */ +_CG_QUALIFIER thread_block this_thread_block() +{ + return (thread_block()); +} + +#if defined(_CG_CPP11_FEATURES) +template +_CG_QUALIFIER thread_block this_thread_block(block_tile_memory& scratch) { + return (thread_block(scratch)); +} +#endif + +/** + * class coalesced_group + * + * A group representing the current set of converged threads in a warp. + * The size of the group is not guaranteed and it may return a group of + * only one thread (itself). + * + * This group exposes warp-synchronous builtins. + * Constructed via coalesced_threads(); + */ +class coalesced_group : public thread_group_base +{ +private: + friend _CG_QUALIFIER coalesced_group coalesced_threads(); + friend _CG_QUALIFIER thread_group tiled_partition(const thread_group& parent, unsigned int tilesz); + friend _CG_QUALIFIER coalesced_group tiled_partition(const coalesced_group& parent, unsigned int tilesz); + friend class details::_coalesced_group_data_access; + + _CG_QUALIFIER unsigned int _packLanes(unsigned laneMask) const { + unsigned int member_pack = 0; + unsigned int member_rank = 0; + for (int bit_idx = 0; bit_idx < 32; bit_idx++) { + unsigned int lane_bit = _data.coalesced.mask & (1 << bit_idx); + if (lane_bit) { + if (laneMask & lane_bit) + member_pack |= 1 << member_rank; + member_rank++; + } + } + return (member_pack); + } + + // Internal Use + _CG_QUALIFIER coalesced_group _get_tiled_threads(unsigned int tilesz) const { + const bool pow2_tilesz = ((tilesz & (tilesz - 1)) == 0); + + // Invalid, immediately fail + if (tilesz == 0 || (tilesz > 32) || !pow2_tilesz) { + details::abort(); + return (coalesced_group(0)); + } + if (size() <= tilesz) { + return (*this); + } + + if ((_data.coalesced.is_tiled == true) && pow2_tilesz) { + unsigned int base_offset = (thread_rank() & (~(tilesz - 1))); + unsigned int masklength = min((unsigned int)size() - base_offset, tilesz); + unsigned int mask = (unsigned int)(-1) >> (32 - masklength); + + mask <<= (details::laneid() & ~(tilesz - 1)); + coalesced_group coalesced_tile = coalesced_group(mask); + coalesced_tile._data.coalesced.metaGroupSize = size() / tilesz; + coalesced_tile._data.coalesced.metaGroupRank = thread_rank() / tilesz; + coalesced_tile._data.coalesced.is_tiled = true; + return (coalesced_tile); + } + else if ((_data.coalesced.is_tiled == false) && pow2_tilesz) { + unsigned int mask = 0; + unsigned int member_rank = 0; + int seen_lanes = (thread_rank() / tilesz) * tilesz; + for (unsigned int bit_idx = 0; bit_idx < 32; bit_idx++) { + unsigned int lane_bit = _data.coalesced.mask & (1 << bit_idx); + if (lane_bit) { + if (seen_lanes <= 0 && member_rank < tilesz) { + mask |= lane_bit; + member_rank++; + } + seen_lanes--; + } + } + coalesced_group coalesced_tile = coalesced_group(mask); + // Override parent with the size of this group + coalesced_tile._data.coalesced.metaGroupSize = (size() + tilesz - 1) / tilesz; + coalesced_tile._data.coalesced.metaGroupRank = thread_rank() / tilesz; + return coalesced_tile; + } + else { + // None in _CG_VERSION 1000 + details::abort(); + } + + return (coalesced_group(0)); + } + + protected: + _CG_QUALIFIER coalesced_group(unsigned int mask) { + _data.coalesced.mask = mask; + _data.coalesced.size = __popc(mask); + _data.coalesced.metaGroupRank = 0; + _data.coalesced.metaGroupSize = 1; + _data.coalesced.is_tiled = false; + } + + _CG_QUALIFIER unsigned int get_mask() const { + return (_data.coalesced.mask); + } + + public: + _CG_STATIC_CONST_DECL unsigned int _group_id = details::coalesced_group_id; + _CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_block) + + _CG_QUALIFIER unsigned int num_threads() const { + return _data.coalesced.size; + } + + _CG_QUALIFIER unsigned int size() const { + return num_threads(); + } + + _CG_QUALIFIER unsigned int thread_rank() const { + return (__popc(_data.coalesced.mask & details::lanemask32_lt())); + } + + // Rank of this group in the upper level of the hierarchy + _CG_QUALIFIER unsigned int meta_group_rank() const { + return _data.coalesced.metaGroupRank; + } + + // Total num partitions created out of all CTAs when the group was created + _CG_QUALIFIER unsigned int meta_group_size() const { + return _data.coalesced.metaGroupSize; + } + + _CG_QUALIFIER void sync() const { + __syncwarp(_data.coalesced.mask); + } + +#ifdef _CG_CPP11_FEATURES + template > + _CG_QUALIFIER TyRet shfl(TyElem&& elem, int srcRank) const { + unsigned int lane = (srcRank == 0) ? __ffs(_data.coalesced.mask) - 1 : + (size() == 32) ? srcRank : __fns(_data.coalesced.mask, 0, (srcRank + 1)); + + return details::tile::shuffle_dispatch::shfl( + _CG_STL_NAMESPACE::forward(elem), _data.coalesced.mask, lane, 32); + } + + template > + _CG_QUALIFIER TyRet shfl_down(TyElem&& elem, unsigned int delta) const { + if (size() == 32) { + return details::tile::shuffle_dispatch::shfl_down( + _CG_STL_NAMESPACE::forward(elem), 0xFFFFFFFF, delta, 32); + } + + unsigned int lane = __fns(_data.coalesced.mask, details::laneid(), delta + 1); + + if (lane >= 32) + lane = details::laneid(); + + return details::tile::shuffle_dispatch::shfl( + _CG_STL_NAMESPACE::forward(elem), _data.coalesced.mask, lane, 32); + } + + template > + _CG_QUALIFIER TyRet shfl_up(TyElem&& elem, int delta) const { + if (size() == 32) { + return details::tile::shuffle_dispatch::shfl_up( + _CG_STL_NAMESPACE::forward(elem), 0xFFFFFFFF, delta, 32); + } + + unsigned lane = __fns(_data.coalesced.mask, details::laneid(), -(delta + 1)); + if (lane >= 32) + lane = details::laneid(); + + return details::tile::shuffle_dispatch::shfl( + _CG_STL_NAMESPACE::forward(elem), _data.coalesced.mask, lane, 32); + } +#else + template + _CG_QUALIFIER TyIntegral shfl(TyIntegral var, unsigned int src_rank) const { + details::assert_if_not_arithmetic(); + unsigned int lane = (src_rank == 0) ? __ffs(_data.coalesced.mask) - 1 : + (size() == 32) ? src_rank : __fns(_data.coalesced.mask, 0, (src_rank + 1)); + return (__shfl_sync(_data.coalesced.mask, var, lane, 32)); + } + + template + _CG_QUALIFIER TyIntegral shfl_up(TyIntegral var, int delta) const { + details::assert_if_not_arithmetic(); + if (size() == 32) { + return (__shfl_up_sync(0xFFFFFFFF, var, delta, 32)); + } + unsigned lane = __fns(_data.coalesced.mask, details::laneid(), -(delta + 1)); + if (lane >= 32) lane = details::laneid(); + return (__shfl_sync(_data.coalesced.mask, var, lane, 32)); + } + + template + _CG_QUALIFIER TyIntegral shfl_down(TyIntegral var, int delta) const { + details::assert_if_not_arithmetic(); + if (size() == 32) { + return (__shfl_down_sync(0xFFFFFFFF, var, delta, 32)); + } + unsigned int lane = __fns(_data.coalesced.mask, details::laneid(), delta + 1); + if (lane >= 32) lane = details::laneid(); + return (__shfl_sync(_data.coalesced.mask, var, lane, 32)); + } +#endif + + _CG_QUALIFIER int any(int predicate) const { + return (__ballot_sync(_data.coalesced.mask, predicate) != 0); + } + _CG_QUALIFIER int all(int predicate) const { + return (__ballot_sync(_data.coalesced.mask, predicate) == _data.coalesced.mask); + } + _CG_QUALIFIER unsigned int ballot(int predicate) const { + if (size() == 32) { + return (__ballot_sync(0xFFFFFFFF, predicate)); + } + unsigned int lane_ballot = __ballot_sync(_data.coalesced.mask, predicate); + return (_packLanes(lane_ballot)); + } + +#ifdef _CG_HAS_MATCH_COLLECTIVE + + template + _CG_QUALIFIER unsigned int match_any(TyIntegral val) const { + details::assert_if_not_arithmetic(); + if (size() == 32) { + return (__match_any_sync(0xFFFFFFFF, val)); + } + unsigned int lane_match = __match_any_sync(_data.coalesced.mask, val); + return (_packLanes(lane_match)); + } + + template + _CG_QUALIFIER unsigned int match_all(TyIntegral val, int &pred) const { + details::assert_if_not_arithmetic(); + if (size() == 32) { + return (__match_all_sync(0xFFFFFFFF, val, &pred)); + } + unsigned int lane_match = __match_all_sync(_data.coalesced.mask, val, &pred); + return (_packLanes(lane_match)); + } + +#endif /* !_CG_HAS_MATCH_COLLECTIVE */ + +}; + +_CG_QUALIFIER coalesced_group coalesced_threads() +{ + return (coalesced_group(__activemask())); +} + +namespace details { + template struct verify_thread_block_tile_size; + template <> struct verify_thread_block_tile_size<32> { typedef void OK; }; + template <> struct verify_thread_block_tile_size<16> { typedef void OK; }; + template <> struct verify_thread_block_tile_size<8> { typedef void OK; }; + template <> struct verify_thread_block_tile_size<4> { typedef void OK; }; + template <> struct verify_thread_block_tile_size<2> { typedef void OK; }; + template <> struct verify_thread_block_tile_size<1> { typedef void OK; }; + +#ifdef _CG_CPP11_FEATURES + template + using _is_power_of_2 = _CG_STL_NAMESPACE::integral_constant; + + template + using _is_single_warp = _CG_STL_NAMESPACE::integral_constant; + template + using _is_multi_warp = + _CG_STL_NAMESPACE::integral_constant 32) && (Size <= 1024)>; + + template + using _is_valid_single_warp_tile = + _CG_STL_NAMESPACE::integral_constant::value && _is_single_warp::value>; + template + using _is_valid_multi_warp_tile = + _CG_STL_NAMESPACE::integral_constant::value && _is_multi_warp::value>; +#else + template + struct _is_multi_warp { + static const bool value = false; + }; +#endif +} + +template +class __static_size_tile_base +{ +protected: + _CG_STATIC_CONST_DECL unsigned int numThreads = Size; + +public: + _CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_block) + + // Rank of thread within tile + _CG_STATIC_QUALIFIER unsigned int thread_rank() { + return (details::cta::thread_rank() & (numThreads - 1)); + } + + // Number of threads within tile + _CG_STATIC_CONSTEXPR_QUALIFIER unsigned int num_threads() { + return numThreads; + } + + _CG_STATIC_CONSTEXPR_QUALIFIER unsigned int size() { + return num_threads(); + } +}; + +template +class __static_size_thread_block_tile_base : public __static_size_tile_base +{ + friend class details::_coalesced_group_data_access; + typedef details::tile::tile_helpers th; + +#ifdef _CG_CPP11_FEATURES + static_assert(details::_is_valid_single_warp_tile::value, "Size must be one of 1/2/4/8/16/32"); +#else + typedef typename details::verify_thread_block_tile_size::OK valid; +#endif + using __static_size_tile_base::numThreads; + _CG_STATIC_CONST_DECL unsigned int fullMask = 0xFFFFFFFF; + + protected: + _CG_STATIC_QUALIFIER unsigned int build_mask() { + unsigned int mask = fullMask; + if (numThreads != 32) { + // [0,31] representing the current active thread in the warp + unsigned int laneId = details::laneid(); + // shift mask according to the partition it belongs to + mask = th::tileMask << (laneId & ~(th::laneMask)); + } + return (mask); + } + +public: + _CG_STATIC_CONST_DECL unsigned int _group_id = details::coalesced_group_id; + + _CG_STATIC_QUALIFIER void sync() { + __syncwarp(build_mask()); + } + +#ifdef _CG_CPP11_FEATURES + // PTX supported collectives + template > + _CG_QUALIFIER TyRet shfl(TyElem&& elem, int srcRank) const { + return details::tile::shuffle_dispatch::shfl( + _CG_STL_NAMESPACE::forward(elem), build_mask(), srcRank, numThreads); + } + + template > + _CG_QUALIFIER TyRet shfl_down(TyElem&& elem, unsigned int delta) const { + return details::tile::shuffle_dispatch::shfl_down( + _CG_STL_NAMESPACE::forward(elem), build_mask(), delta, numThreads); + } + + template > + _CG_QUALIFIER TyRet shfl_up(TyElem&& elem, unsigned int delta) const { + return details::tile::shuffle_dispatch::shfl_up( + _CG_STL_NAMESPACE::forward(elem), build_mask(), delta, numThreads); + } + + template > + _CG_QUALIFIER TyRet shfl_xor(TyElem&& elem, unsigned int laneMask) const { + return details::tile::shuffle_dispatch::shfl_xor( + _CG_STL_NAMESPACE::forward(elem), build_mask(), laneMask, numThreads); + } +#else + template + _CG_QUALIFIER TyIntegral shfl(TyIntegral var, int srcRank) const { + details::assert_if_not_arithmetic(); + return (__shfl_sync(build_mask(), var, srcRank, numThreads)); + } + + template + _CG_QUALIFIER TyIntegral shfl_down(TyIntegral var, unsigned int delta) const { + details::assert_if_not_arithmetic(); + return (__shfl_down_sync(build_mask(), var, delta, numThreads)); + } + + template + _CG_QUALIFIER TyIntegral shfl_up(TyIntegral var, unsigned int delta) const { + details::assert_if_not_arithmetic(); + return (__shfl_up_sync(build_mask(), var, delta, numThreads)); + } + + template + _CG_QUALIFIER TyIntegral shfl_xor(TyIntegral var, unsigned int laneMask) const { + details::assert_if_not_arithmetic(); + return (__shfl_xor_sync(build_mask(), var, laneMask, numThreads)); + } +#endif //_CG_CPP11_FEATURES + + _CG_QUALIFIER int any(int predicate) const { + unsigned int lane_ballot = __ballot_sync(build_mask(), predicate); + return (lane_ballot != 0); + } + _CG_QUALIFIER int all(int predicate) const { + unsigned int lane_ballot = __ballot_sync(build_mask(), predicate); + return (lane_ballot == build_mask()); + } + _CG_QUALIFIER unsigned int ballot(int predicate) const { + unsigned int lane_ballot = __ballot_sync(build_mask(), predicate); + return (lane_ballot >> (details::laneid() & (~(th::laneMask)))); + } + +#ifdef _CG_HAS_MATCH_COLLECTIVE + template + _CG_QUALIFIER unsigned int match_any(TyIntegral val) const { + details::assert_if_not_arithmetic(); + unsigned int lane_match = __match_any_sync(build_mask(), val); + return (lane_match >> (details::laneid() & (~(th::laneMask)))); + } + + template + _CG_QUALIFIER unsigned int match_all(TyIntegral val, int &pred) const { + details::assert_if_not_arithmetic(); + unsigned int lane_match = __match_all_sync(build_mask(), val, &pred); + return (lane_match >> (details::laneid() & (~(th::laneMask)))); + } +#endif + +}; + +template +class __static_parent_thread_block_tile_base +{ +public: + // Rank of this group in the upper level of the hierarchy + _CG_STATIC_QUALIFIER unsigned int meta_group_rank() { + return ParentT::thread_rank() / Size; + } + + // Total num partitions created out of all CTAs when the group was created + _CG_STATIC_QUALIFIER unsigned int meta_group_size() { + return (ParentT::size() + Size - 1) / Size; + } +}; + +/** + * class thread_block_tile + * + * Statically-sized group type, representing one tile of a thread block. + * The only specializations currently supported are those with native + * hardware support (1/2/4/8/16/32) + * + * This group exposes warp-synchronous builtins. + * Can only be constructed via tiled_partition(ParentT&) + */ + +template +class __single_warp_thread_block_tile : + public __static_size_thread_block_tile_base, + public __static_parent_thread_block_tile_base +{ + typedef __static_parent_thread_block_tile_base staticParentBaseT; + friend class details::_coalesced_group_data_access; + +protected: + _CG_QUALIFIER __single_warp_thread_block_tile() { }; + _CG_QUALIFIER __single_warp_thread_block_tile(unsigned int, unsigned int) { }; + + _CG_STATIC_QUALIFIER unsigned int get_mask() { + return __static_size_thread_block_tile_base::build_mask(); + } +}; + +template +class __single_warp_thread_block_tile : + public __static_size_thread_block_tile_base, + public thread_group_base +{ + _CG_STATIC_CONST_DECL unsigned int numThreads = Size; + + template friend class __single_warp_thread_block_tile; + friend class details::_coalesced_group_data_access; + + typedef __static_size_thread_block_tile_base staticSizeBaseT; + +protected: + _CG_QUALIFIER __single_warp_thread_block_tile(unsigned int meta_group_rank = 0, unsigned int meta_group_size = 1) { + _data.coalesced.mask = staticSizeBaseT::build_mask(); + _data.coalesced.size = numThreads; + _data.coalesced.metaGroupRank = meta_group_rank; + _data.coalesced.metaGroupSize = meta_group_size; + _data.coalesced.is_tiled = true; + } + + _CG_QUALIFIER unsigned int get_mask() const { + return (_data.coalesced.mask); + } + +public: + using staticSizeBaseT::sync; + using staticSizeBaseT::size; + using staticSizeBaseT::num_threads; + using staticSizeBaseT::thread_rank; + + _CG_QUALIFIER unsigned int meta_group_rank() const { + return _data.coalesced.metaGroupRank; + } + + _CG_QUALIFIER unsigned int meta_group_size() const { + return _data.coalesced.metaGroupSize; + } +}; + +/** + * Outer level API calls + * void sync(GroupT) - see .sync() + * void thread_rank(GroupT) - see .thread_rank() + * void group_size(GroupT) - see .size() + */ +template +_CG_QUALIFIER void sync(GroupT const &g) +{ + g.sync(); +} + +// TODO: Use a static dispatch to determine appropriate return type +// C++03 is stuck with unsigned long long for now +#ifdef _CG_CPP11_FEATURES +template +_CG_QUALIFIER auto thread_rank(GroupT const& g) -> decltype(g.thread_rank()) { + return g.thread_rank(); +} + + +template +_CG_QUALIFIER auto group_size(GroupT const &g) -> decltype(g.num_threads()) { + return g.num_threads(); +} +#else +template +_CG_QUALIFIER unsigned long long thread_rank(GroupT const& g) { + return static_cast(g.thread_rank()); +} + + +template +_CG_QUALIFIER unsigned long long group_size(GroupT const &g) { + return static_cast(g.num_threads()); +} +#endif + + +/** + * tiled_partition + * + * The tiled_partition(parent, tilesz) method is a collective operation that + * partitions the parent group into a one-dimensional, row-major, tiling of subgroups. + * + * A total of ((size(parent)+tilesz-1)/tilesz) subgroups will + * be created where threads having identical k = (thread_rank(parent)/tilesz) + * will be members of the same subgroup. + * + * The implementation may cause the calling thread to wait until all the members + * of the parent group have invoked the operation before resuming execution. + * + * Functionality is limited to power-of-two sized subgorup instances of at most + * 32 threads. Only thread_block, thread_block_tile<>, and their subgroups can be + * tiled_partition() in _CG_VERSION 1000. + */ +_CG_QUALIFIER thread_group tiled_partition(const thread_group& parent, unsigned int tilesz) +{ + if (parent.get_type() == details::coalesced_group_id) { + const coalesced_group *_cg = static_cast(&parent); + return _cg->_get_tiled_threads(tilesz); + } + else { + const thread_block *_tb = static_cast(&parent); + return _tb->_get_tiled_threads(tilesz); + } +} + +// Thread block type overload: returns a basic thread_group for now (may be specialized later) +_CG_QUALIFIER thread_group tiled_partition(const thread_block& parent, unsigned int tilesz) +{ + return (parent._get_tiled_threads(tilesz)); +} + +// Coalesced group type overload: retains its ability to stay coalesced +_CG_QUALIFIER coalesced_group tiled_partition(const coalesced_group& parent, unsigned int tilesz) +{ + return (parent._get_tiled_threads(tilesz)); +} + +namespace details { + template + class internal_thread_block_tile : public __single_warp_thread_block_tile {}; + + template + _CG_QUALIFIER internal_thread_block_tile tiled_partition_internal() { + return internal_thread_block_tile(); + } + + template + _CG_QUALIFIER TyVal multi_warp_collectives_helper( + const GroupT& group, + WarpLambda warp_lambda, + InterWarpLambda inter_warp_lambda) { + return group.template collectives_scheme(warp_lambda, inter_warp_lambda); + } + + template + _CG_QUALIFIER T* multi_warp_scratch_location_getter(const GroupT& group, unsigned int warp_id) { + return group.template get_scratch_location(warp_id); + } + + template + _CG_QUALIFIER details::barrier_t* multi_warp_sync_location_getter(const GroupT& group) { + return group.get_sync_location(); + } + +} +/** + * tiled_partition + * + * The tiled_partition(parent) method is a collective operation that + * partitions the parent group into a one-dimensional, row-major, tiling of subgroups. + * + * A total of ((size(parent)/tilesz) subgroups will be created, + * therefore the parent group size must be evenly divisible by the tilesz. + * The allow parent groups are thread_block or thread_block_tile. + * + * The implementation may cause the calling thread to wait until all the members + * of the parent group have invoked the operation before resuming execution. + * + * Functionality is limited to native hardware sizes, 1/2/4/8/16/32. + * The size(parent) must be greater than the template Size parameter + * otherwise the results are undefined. + */ + +#if defined(_CG_CPP11_FEATURES) +template +class __static_size_multi_warp_tile_base : public __static_size_tile_base +{ + static_assert(details::_is_valid_multi_warp_tile::value, "Size must be one of 64/128/256/512"); + + template + friend __device__ TyVal details::multi_warp_collectives_helper( + const GroupT& group, + WarpLambda warp_lambda, + InterWarpLambda inter_warp_lambda); + template + friend __device__ T* details::multi_warp_scratch_location_getter(const GroupT& group, unsigned int warp_id); + template + friend __device__ details::barrier_t* details::multi_warp_sync_location_getter(const GroupT& group); + template + friend class __static_size_multi_warp_tile_base; + using WarpType = details::internal_thread_block_tile<32, __static_size_multi_warp_tile_base>; + using ThisType = __static_size_multi_warp_tile_base; + _CG_STATIC_CONST_DECL int numWarps = Size / 32; + +protected: + details::multi_warp_scratch* const tile_memory; + + template + _CG_QUALIFIER __static_size_multi_warp_tile_base(const GroupT& g) : tile_memory(g.tile_memory) { +#if defined(_CG_HAS_RESERVED_SHARED) + details::sync_warps_reset(get_sync_location(), details::cta::thread_rank()); + g.sync(); +#endif + } + + +private: + _CG_QUALIFIER details::barrier_t* get_sync_location() const { + // Different group sizes use different barriers, all groups of a given size share one barrier. + unsigned int sync_id = details::log2(Size / 64); + return &tile_memory->barriers[sync_id]; + } + + template + _CG_QUALIFIER T* get_scratch_location(unsigned int warp_id) const { + unsigned int scratch_id = (details::cta::thread_rank() - thread_rank()) / 32 + warp_id; + return reinterpret_cast(&tile_memory->communication_memory[scratch_id]); + } + + template + _CG_QUALIFIER T* get_scratch_location() const { + unsigned int scratch_id = details::cta::thread_rank() / 32; + return reinterpret_cast(&tile_memory->communication_memory[scratch_id]); + } + + template + _CG_QUALIFIER TyVal shfl_impl(TyVal val, unsigned int src) const { + unsigned int src_warp = src / 32; + auto warp = details::tiled_partition_internal<32, ThisType>(); + details::barrier_t* sync_location = get_sync_location(); + + // Get warp slot of the source threads warp. + TyVal* warp_scratch_location = get_scratch_location(src_warp); + + if (warp.meta_group_rank() == src_warp) { + warp.sync(); + // Put shuffled value into my warp slot and let my warp arrive at the barrier. + if (thread_rank() == src) { + *warp_scratch_location = val; + } + details::sync_warps_arrive(sync_location, details::cta::thread_rank(), numWarps); + TyVal result = *warp_scratch_location; + details::sync_warps_wait(sync_location, details::cta::thread_rank()); + return result; + } + else { + // Wait for the source warp to arrive on the barrier. + details::sync_warps_wait_for_specific_warp(sync_location, + (details::cta::thread_rank() / 32 - warp.meta_group_rank() + src_warp)); + TyVal result = *warp_scratch_location; + details::sync_warps(sync_location, details::cta::thread_rank(), numWarps); + return result; + } + } + + template + _CG_QUALIFIER TyVal collectives_scheme(const WarpLambda& warp_lambda, const InterWarpLambda& inter_warp_lambda) const { + static_assert(sizeof(TyVal) <= details::multi_warp_scratch::communication_size, + "Collectives with tiles larger than 32 threads are limited to types smaller then 8 bytes"); + auto warp = details::tiled_partition_internal<32, ThisType>(); + details::barrier_t* sync_location = get_sync_location(); + TyVal* warp_scratch_location = get_scratch_location(); + + warp_lambda(warp, warp_scratch_location); + + if (details::sync_warps_last_releases(sync_location, details::cta::thread_rank(), numWarps)) { + auto subwarp = details::tiled_partition_internal(); + if (subwarp.meta_group_rank() == 0) { + TyVal* thread_scratch_location = get_scratch_location(subwarp.thread_rank()); + inter_warp_lambda(subwarp, thread_scratch_location); + } + warp.sync(); + details::sync_warps_release(sync_location, warp.thread_rank() == 0, details::cta::thread_rank(), numWarps); + } + TyVal result = *warp_scratch_location; + return result; + } + +public: + _CG_STATIC_CONST_DECL unsigned int _group_id = details::multi_tile_group_id; + + using __static_size_tile_base::thread_rank; + + template + _CG_QUALIFIER TyVal shfl(TyVal val, unsigned int src) const { + static_assert(sizeof(TyVal) <= details::multi_warp_scratch::communication_size, + "Collectives with tiles larger than 32 threads are limited to types smaller then 8 bytes"); + return shfl_impl(val, src); + } + + _CG_QUALIFIER void sync() const { + details::sync_warps(get_sync_location(), details::cta::thread_rank(), numWarps); + } + + _CG_QUALIFIER int any(int predicate) const { + auto warp_lambda = [=] (WarpType& warp, int* warp_scratch_location) { + *warp_scratch_location = __any_sync(0xFFFFFFFF, predicate); + }; + auto inter_warp_lambda = + [] (details::internal_thread_block_tile& subwarp, int* thread_scratch_location) { + *thread_scratch_location = __any_sync(0xFFFFFFFFU >> (32 - numWarps), *thread_scratch_location); + }; + return collectives_scheme(warp_lambda, inter_warp_lambda); + } + + _CG_QUALIFIER int all(int predicate) const { + auto warp_lambda = [=] (WarpType& warp, int* warp_scratch_location) { + *warp_scratch_location = __all_sync(0xFFFFFFFF, predicate); + }; + auto inter_warp_lambda = + [] (details::internal_thread_block_tile& subwarp, int* thread_scratch_location) { + *thread_scratch_location = __all_sync(0xFFFFFFFFU >> (32 - numWarps), *thread_scratch_location); + }; + return collectives_scheme(warp_lambda, inter_warp_lambda); + } +}; + + +template +class __multi_warp_thread_block_tile : + public __static_size_multi_warp_tile_base, + public __static_parent_thread_block_tile_base +{ + typedef __static_parent_thread_block_tile_base staticParentBaseT; + typedef __static_size_multi_warp_tile_base staticTileBaseT; +protected: + _CG_QUALIFIER __multi_warp_thread_block_tile(const ParentT& g) : + __static_size_multi_warp_tile_base(g) {} +}; + +template +class __multi_warp_thread_block_tile : public __static_size_multi_warp_tile_base +{ + const unsigned int metaGroupRank; + const unsigned int metaGroupSize; + +protected: + template + _CG_QUALIFIER __multi_warp_thread_block_tile(const __multi_warp_thread_block_tile& g) : + __static_size_multi_warp_tile_base(g), metaGroupRank(g.meta_group_rank()), metaGroupSize(g.meta_group_size()) {} + +public: + _CG_QUALIFIER unsigned int meta_group_rank() const { + return metaGroupRank; + } + + _CG_QUALIFIER unsigned int meta_group_size() const { + return metaGroupSize; + } +}; +#endif + +template +class thread_block_tile; + +namespace details { + template + class thread_block_tile_impl; + + template + class thread_block_tile_impl: public __single_warp_thread_block_tile + { + protected: + template + _CG_QUALIFIER thread_block_tile_impl(const thread_block_tile_impl& g) : + __single_warp_thread_block_tile(g.meta_group_rank(), g.meta_group_size()) {} + + _CG_QUALIFIER thread_block_tile_impl(const thread_block& g) : + __single_warp_thread_block_tile() {} + }; + +#if defined(_CG_CPP11_FEATURES) + template + class thread_block_tile_impl : public __multi_warp_thread_block_tile + { + protected: + template + _CG_QUALIFIER thread_block_tile_impl(const GroupT& g) : + __multi_warp_thread_block_tile(g) {} + }; +#else + template + class thread_block_tile_impl + { + protected: + template + _CG_QUALIFIER thread_block_tile_impl(const GroupT& g) {} + }; +#endif +} + +template +class thread_block_tile : public details::thread_block_tile_impl::value> +{ + friend _CG_QUALIFIER thread_block_tile<1, void> this_thread(); + +protected: + _CG_QUALIFIER thread_block_tile(const ParentT& g) : + details::thread_block_tile_impl::value>(g) {} + +public: + _CG_QUALIFIER operator thread_block_tile() const { + return thread_block_tile(*this); + } +}; + +template +class thread_block_tile : public details::thread_block_tile_impl::value> +{ + template + friend class thread_block_tile; + +protected: + template + _CG_QUALIFIER thread_block_tile(const thread_block_tile& g) : + details::thread_block_tile_impl::value>(g) {} + +public: + template + _CG_QUALIFIER thread_block_tile(const thread_block_tile& g) : + details::thread_block_tile_impl::value>(g) {} +}; + +namespace details { + template + struct tiled_partition_impl; + + template + struct tiled_partition_impl : public thread_block_tile { + _CG_QUALIFIER tiled_partition_impl(const thread_block& g) : + thread_block_tile(g) {} + }; + + // ParentT = static thread_block_tile specialization + template + struct tiled_partition_impl > : + public thread_block_tile > { +#ifdef _CG_CPP11_FEATURES + static_assert(Size < ParentSize, "Tile size bigger or equal to the parent group size"); +#endif + _CG_QUALIFIER tiled_partition_impl(const thread_block_tile& g) : + thread_block_tile >(g) {} + }; + +} + +template +_CG_QUALIFIER thread_block_tile tiled_partition(const ParentT& g) +{ + return details::tiled_partition_impl(g); +} + +/** + * thread_group this_thread() + * + * Constructs a generic thread_group containing only the calling thread + */ +_CG_QUALIFIER thread_block_tile<1, void> this_thread() +{ + // Make thread_block_tile<1, thread_block> parent of the returned group, so it will have its + // meta group rank and size set to 0 and 1 respectively. + return thread_block_tile<1, thread_block_tile<1, thread_block> >(this_thread_block()); +} + +/** + * .sync() + * + * Executes a barrier across the group + * + * Implements both a compiler fence and an architectural fence to prevent, + * memory reordering around the barrier. + */ +_CG_QUALIFIER void thread_group::sync() const +{ + switch (_data.group.type) { + case details::coalesced_group_id: + cooperative_groups::sync(*static_cast(this)); + break; + case details::thread_block_id: + cooperative_groups::sync(*static_cast(this)); + break; + case details::grid_group_id: + cooperative_groups::sync(*static_cast(this)); + break; +#if defined(_CG_HAS_MULTI_GRID_GROUP) && defined(_CG_CPP11_FEATURES) && defined(_CG_ABI_EXPERIMENTAL) + case details::multi_grid_group_id: + cooperative_groups::sync(*static_cast(this)); + break; +#endif +#if defined(_CG_HAS_CLUSTER_GROUP) + case details::cluster_group_id: + cooperative_groups::sync(*static_cast(this)); + break; +#endif + default: + break; + } +} + +/** + * .size() + * + * Returns the total number of threads in the group. + */ +_CG_QUALIFIER unsigned long long thread_group::size() const +{ + unsigned long long size = 0; + switch (_data.group.type) { + case details::coalesced_group_id: + size = cooperative_groups::group_size(*static_cast(this)); + break; + case details::thread_block_id: + size = cooperative_groups::group_size(*static_cast(this)); + break; + case details::grid_group_id: + size = cooperative_groups::group_size(*static_cast(this)); + break; +#if defined(_CG_HAS_MULTI_GRID_GROUP) && defined(_CG_CPP11_FEATURES) && defined(_CG_ABI_EXPERIMENTAL) + case details::multi_grid_group_id: + size = cooperative_groups::group_size(*static_cast(this)); + break; +#endif +#if defined(_CG_HAS_CLUSTER_GROUP) + case details::cluster_group_id: + size = cooperative_groups::group_size(*static_cast(this)); + break; +#endif + default: + break; + } + return size; +} + +/** + * .thread_rank() + * + * Returns the linearized rank of the calling thread along the interval [0, size()). + */ +_CG_QUALIFIER unsigned long long thread_group::thread_rank() const +{ + unsigned long long rank = 0; + switch (_data.group.type) { + case details::coalesced_group_id: + rank = cooperative_groups::thread_rank(*static_cast(this)); + break; + case details::thread_block_id: + rank = cooperative_groups::thread_rank(*static_cast(this)); + break; + case details::grid_group_id: + rank = cooperative_groups::thread_rank(*static_cast(this)); + break; +#if defined(_CG_HAS_MULTI_GRID_GROUP) && defined(_CG_CPP11_FEATURES) && defined(_CG_ABI_EXPERIMENTAL) + case details::multi_grid_group_id: + rank = cooperative_groups::thread_rank(*static_cast(this)); + break; +#endif +#if defined(_CG_HAS_CLUSTER_GROUP) + case details::cluster_group_id: + rank = cooperative_groups::thread_rank(*static_cast(this)); + break; +#endif + default: + break; + } + return rank; +} + +_CG_END_NAMESPACE + +#include +#if (!defined(_MSC_VER) || defined(_WIN64)) +# include +#endif + +# endif /* ! (__cplusplus, __CUDACC__) */ + +#endif /* !_COOPERATIVE_GROUPS_H_ */ diff --git a/cuda_toolkit/include/csetjmp b/cuda_toolkit/include/csetjmp new file mode 100644 index 0000000000000000000000000000000000000000..fc05c77cd541fbdeb515d311e4536d632e688c53 --- /dev/null +++ b/cuda_toolkit/include/csetjmp @@ -0,0 +1,51 @@ +// -*- C++ -*- +//===--------------------------- csetjmp ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CSETJMP +#define _LIBCUDACXX_CSETJMP + +/* + csetjmp synopsis + +Macros: + + setjmp + +namespace std +{ + +Types: + + jmp_buf + +void longjmp(jmp_buf env, int val); + +} // std + +*/ + +#include <__config> +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::jmp_buf; +using ::longjmp; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_CSETJMP diff --git a/cuda_toolkit/include/csignal b/cuda_toolkit/include/csignal new file mode 100644 index 0000000000000000000000000000000000000000..9929a25fd4decc275ee03aa7788316d961efddb0 --- /dev/null +++ b/cuda_toolkit/include/csignal @@ -0,0 +1,61 @@ +// -*- C++ -*- +//===--------------------------- csignal ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CSIGNAL +#define _LIBCUDACXX_CSIGNAL + +/* + csignal synopsis + +Macros: + + SIG_DFL + SIG_ERR + SIG_IGN + SIGABRT + SIGFPE + SIGILL + SIGINT + SIGSEGV + SIGTERM + +namespace std +{ + +Types: + + sig_atomic_t + +void (*signal(int sig, void (*func)(int)))(int); +int raise(int sig); + +} // std + +*/ + +#include <__config> +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::sig_atomic_t; +using ::signal; +using ::raise; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_CSIGNAL diff --git a/cuda_toolkit/include/cstdarg b/cuda_toolkit/include/cstdarg new file mode 100644 index 0000000000000000000000000000000000000000..4e938d641013207d0998a522546869b7e9464662 --- /dev/null +++ b/cuda_toolkit/include/cstdarg @@ -0,0 +1,58 @@ +// -*- C++ -*- +//===--------------------------- cstdarg ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CSTDARG +#define _LIBCUDACXX_CSTDARG + +/* + cstdarg synopsis + +Macros: + + type va_arg(va_list ap, type); + void va_copy(va_list dest, va_list src); // C99 + void va_end(va_list ap); + void va_start(va_list ap, parmN); + +namespace std +{ + +Types: + + va_list + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#include +#include <__pragma_push> +#endif //__cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::va_list; + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_CSTDARG diff --git a/cuda_toolkit/include/cstdbool b/cuda_toolkit/include/cstdbool new file mode 100644 index 0000000000000000000000000000000000000000..08804a8218297c7c1faa8475d52cb3a527271d01 --- /dev/null +++ b/cuda_toolkit/include/cstdbool @@ -0,0 +1,42 @@ +// -*- C++ -*- +//===--------------------------- cstdbool ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CSTDBOOL +#define _LIBCUDACXX_CSTDBOOL + +/* + cstdbool synopsis + +Macros: + + __bool_true_false_are_defined + +*/ + +#ifndef __cuda_std__ +#include <__config> +#include <__pragma_push> +#endif //__cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#undef __bool_true_false_are_defined +#define __bool_true_false_are_defined 1 + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_CSTDBOOL diff --git a/cuda_toolkit/include/cstddef b/cuda_toolkit/include/cstddef new file mode 100644 index 0000000000000000000000000000000000000000..a61c54ccb346d6201f3f31712df2652cf36c22e8 --- /dev/null +++ b/cuda_toolkit/include/cstddef @@ -0,0 +1,181 @@ +// -*- C++ -*- +//===--------------------------- cstddef ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CSTDDEF +#define _LIBCUDACXX_CSTDDEF + +/* + cstddef synopsis + +Macros: + + offsetof(type,member-designator) + NULL + +namespace std +{ + +Types: + + ptrdiff_t + size_t + max_align_t + nullptr_t + byte // C++17 + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#else +#include "__cuda/cstddef_prelude.h" +#endif //__cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__type_traits/enable_if.h" +#include "__type_traits/is_integral.h" +#include "version" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif //__cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#ifndef __cuda_std__ +// Don't include our own ; we don't want to declare ::nullptr_t. +#ifdef _MSC_VER + #include <../ucrt/stddef.h> +#else + #include_next +#endif +#include <__nullptr> +#endif //__cuda_std__ + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::ptrdiff_t; +using ::size_t; + +#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \ + defined(__DEFINED_max_align_t) || defined(__NetBSD__) +// Re-use the compiler's max_align_t where possible. +using ::max_align_t; +#else +typedef long double max_align_t; +#endif + +_LIBCUDACXX_END_NAMESPACE_STD + +#if _LIBCUDACXX_STD_VER > 11 +#ifdef _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION +_LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION +#else +namespace std // purposefully not versioned +{ +#endif //_LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION +enum class byte : unsigned char {}; + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr byte operator| (byte __lhs, byte __rhs) noexcept +{ + return static_cast( + static_cast( + static_cast(__lhs) | static_cast(__rhs) + )); +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept +{ return __lhs = __lhs | __rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr byte operator& (byte __lhs, byte __rhs) noexcept +{ + return static_cast( + static_cast( + static_cast(__lhs) & static_cast(__rhs) + )); +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept +{ return __lhs = __lhs & __rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr byte operator^ (byte __lhs, byte __rhs) noexcept +{ + return static_cast( + static_cast( + static_cast(__lhs) ^ static_cast(__rhs) + )); +} + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept +{ return __lhs = __lhs ^ __rhs; } + +_LIBCUDACXX_INLINE_VISIBILITY +constexpr byte operator~ (byte __b) noexcept +{ + return static_cast( + static_cast( + ~static_cast(__b) + )); +} + +template + _LIBCUDACXX_INLINE_VISIBILITY + constexpr __enable_if_t, byte> & + operator<<=(byte& __lhs, _Integer __shift) noexcept + { return __lhs = __lhs << __shift; } + +template + _LIBCUDACXX_INLINE_VISIBILITY + constexpr __enable_if_t, byte> + operator<< (byte __lhs, _Integer __shift) noexcept + { return static_cast(static_cast(static_cast(__lhs) << __shift)); } + +template + _LIBCUDACXX_INLINE_VISIBILITY + constexpr __enable_if_t, byte> & + operator>>=(byte& __lhs, _Integer __shift) noexcept + { return __lhs = __lhs >> __shift; } + +template + _LIBCUDACXX_INLINE_VISIBILITY + constexpr __enable_if_t, byte> + operator>> (byte __lhs, _Integer __shift) noexcept + { return static_cast(static_cast(static_cast(__lhs) >> __shift)); } + +template + _LIBCUDACXX_INLINE_VISIBILITY + constexpr __enable_if_t, _Integer> + to_integer(byte __b) noexcept { return static_cast<_Integer>(__b); } + +#ifdef _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION +_LIBCUDACXX_END_NAMESPACE_STD_NOVERSION +#else +} +#endif //_LIBCUDACXX_END_NAMESPACE_STD_NOVERSION +#endif // _LIBCUDACXX_STD_VER > 11 + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_CSTDDEF diff --git a/cuda_toolkit/include/cstdint b/cuda_toolkit/include/cstdint new file mode 100644 index 0000000000000000000000000000000000000000..229e0ba097305f208fa2144534b449839af49697 --- /dev/null +++ b/cuda_toolkit/include/cstdint @@ -0,0 +1,212 @@ +// -*- C++ -*- +//===--------------------------- cstdint ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CSTDINT +#define _LIBCUDACXX_CSTDINT + +/* + cstdint synopsis + +Macros: + + INT8_MIN + INT16_MIN + INT32_MIN + INT64_MIN + + INT8_MAX + INT16_MAX + INT32_MAX + INT64_MAX + + UINT8_MAX + UINT16_MAX + UINT32_MAX + UINT64_MAX + + INT_LEAST8_MIN + INT_LEAST16_MIN + INT_LEAST32_MIN + INT_LEAST64_MIN + + INT_LEAST8_MAX + INT_LEAST16_MAX + INT_LEAST32_MAX + INT_LEAST64_MAX + + UINT_LEAST8_MAX + UINT_LEAST16_MAX + UINT_LEAST32_MAX + UINT_LEAST64_MAX + + INT_FAST8_MIN + INT_FAST16_MIN + INT_FAST32_MIN + INT_FAST64_MIN + + INT_FAST8_MAX + INT_FAST16_MAX + INT_FAST32_MAX + INT_FAST64_MAX + + UINT_FAST8_MAX + UINT_FAST16_MAX + UINT_FAST32_MAX + UINT_FAST64_MAX + + INTPTR_MIN + INTPTR_MAX + UINTPTR_MAX + + INTMAX_MIN + INTMAX_MAX + + UINTMAX_MAX + + PTRDIFF_MIN + PTRDIFF_MAX + + SIG_ATOMIC_MIN + SIG_ATOMIC_MAX + + SIZE_MAX + + WCHAR_MIN + WCHAR_MAX + + WINT_MIN + WINT_MAX + + INT8_C(value) + INT16_C(value) + INT32_C(value) + INT64_C(value) + + UINT8_C(value) + UINT16_C(value) + UINT32_C(value) + UINT64_C(value) + + INTMAX_C(value) + UINTMAX_C(value) + +namespace std +{ + +Types: + + int8_t + int16_t + int32_t + int64_t + + uint8_t + uint16_t + uint32_t + uint64_t + + int_least8_t + int_least16_t + int_least32_t + int_least64_t + + uint_least8_t + uint_least16_t + uint_least32_t + uint_least64_t + + int_fast8_t + int_fast16_t + int_fast32_t + int_fast64_t + + uint_fast8_t + uint_fast16_t + uint_fast32_t + uint_fast64_t + + intptr_t + uintptr_t + + intmax_t + uintmax_t + +} // std +*/ + +#ifndef __cuda_std__ +#include <__config> +#else +#include "__cuda/cstdint_prelude.h" +#endif //__cuda_std__ + +#ifndef _LIBCUDACXX_COMPILER_NVRTC +#include +#endif // _LIBCUDACXX_COMPILER_NVRTC + +#include "climits" +#include "version" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif //__cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using::int8_t; +using::int16_t; +using::int32_t; +using::int64_t; + +using::uint8_t; +using::uint16_t; +using::uint32_t; +using::uint64_t; + +using::int_least8_t; +using::int_least16_t; +using::int_least32_t; +using::int_least64_t; + +using::uint_least8_t; +using::uint_least16_t; +using::uint_least32_t; +using::uint_least64_t; + +using::int_fast8_t; +using::int_fast16_t; +using::int_fast32_t; +using::int_fast64_t; + +using::uint_fast8_t; +using::uint_fast16_t; +using::uint_fast32_t; +using::uint_fast64_t; + +using::intptr_t; +using::uintptr_t; + +using::intmax_t; +using::uintmax_t; + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_CSTDINT diff --git a/cuda_toolkit/include/cstdio b/cuda_toolkit/include/cstdio new file mode 100644 index 0000000000000000000000000000000000000000..b30915412e035fe5ce056370ad9e234c727732b8 --- /dev/null +++ b/cuda_toolkit/include/cstdio @@ -0,0 +1,175 @@ +// -*- C++ -*- +//===---------------------------- cstdio ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CSTDIO +#define _LIBCUDACXX_CSTDIO + +/* + cstdio synopsis + +Macros: + + BUFSIZ + EOF + FILENAME_MAX + FOPEN_MAX + L_tmpnam + NULL + SEEK_CUR + SEEK_END + SEEK_SET + TMP_MAX + _IOFBF + _IOLBF + _IONBF + stderr + stdin + stdout + +namespace std +{ + +Types: + +FILE +fpos_t +size_t + +int remove(const char* filename); +int rename(const char* old, const char* new); +FILE* tmpfile(void); +char* tmpnam(char* s); +int fclose(FILE* stream); +int fflush(FILE* stream); +FILE* fopen(const char* restrict filename, const char* restrict mode); +FILE* freopen(const char* restrict filename, const char * restrict mode, + FILE * restrict stream); +void setbuf(FILE* restrict stream, char* restrict buf); +int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size); +int fprintf(FILE* restrict stream, const char* restrict format, ...); +int fscanf(FILE* restrict stream, const char * restrict format, ...); +int printf(const char* restrict format, ...); +int scanf(const char* restrict format, ...); +int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99 +int sprintf(char* restrict s, const char* restrict format, ...); +int sscanf(const char* restrict s, const char* restrict format, ...); +int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg); +int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99 +int vprintf(const char* restrict format, va_list arg); +int vscanf(const char* restrict format, va_list arg); // C99 +int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99 + va_list arg); +int vsprintf(char* restrict s, const char* restrict format, va_list arg); +int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99 +int fgetc(FILE* stream); +char* fgets(char* restrict s, int n, FILE* restrict stream); +int fputc(int c, FILE* stream); +int fputs(const char* restrict s, FILE* restrict stream); +int getc(FILE* stream); +int getchar(void); +char* gets(char* s); // removed in C++14 +int putc(int c, FILE* stream); +int putchar(int c); +int puts(const char* s); +int ungetc(int c, FILE* stream); +size_t fread(void* restrict ptr, size_t size, size_t nmemb, + FILE* restrict stream); +size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb, + FILE* restrict stream); +int fgetpos(FILE* restrict stream, fpos_t* restrict pos); +int fseek(FILE* stream, long offset, int whence); +int fsetpos(FILE*stream, const fpos_t* pos); +long ftell(FILE* stream); +void rewind(FILE* stream); +void clearerr(FILE* stream); +int feof(FILE* stream); +int ferror(FILE* stream); +void perror(const char* s); + +} // std +*/ + +#include <__config> +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::FILE; +using ::fpos_t; +using ::size_t; + +using ::fclose; +using ::fflush; +using ::setbuf; +using ::setvbuf; +using ::fprintf; +using ::fscanf; +using ::snprintf; +using ::sprintf; +using ::sscanf; +using ::vfprintf; +using ::vfscanf; +using ::vsscanf; +using ::vsnprintf; +using ::vsprintf; +using ::fgetc; +using ::fgets; +using ::fputc; +using ::fputs; +using ::getc; +using ::putc; +using ::ungetc; +using ::fread; +using ::fwrite; +using ::fgetpos; +using ::fseek; +using ::fsetpos; +using ::ftell; +using ::rewind; +using ::clearerr; +using ::feof; +using ::ferror; +using ::perror; + +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +using ::fopen; +using ::freopen; +using ::remove; +using ::rename; +using ::tmpfile; +using ::tmpnam; +#endif + +#ifndef _LIBCUDACXX_HAS_NO_STDIN +using ::getchar; +#if _LIBCUDACXX_STD_VER <= 11 && !defined(_LIBCUDACXX_C_HAS_NO_GETS) +using ::gets; +#endif +using ::scanf; +using ::vscanf; +#endif + +#ifndef _LIBCUDACXX_HAS_NO_STDOUT +using ::printf; +using ::putchar; +using ::puts; +using ::vprintf; +#endif + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_CSTDIO diff --git a/cuda_toolkit/include/cstdlib b/cuda_toolkit/include/cstdlib new file mode 100644 index 0000000000000000000000000000000000000000..ec99b70669877937178ed2b2036a3f880bd0eee7 --- /dev/null +++ b/cuda_toolkit/include/cstdlib @@ -0,0 +1,207 @@ +// -*- C++ -*- +//===--------------------------- cstdlib ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CSTDLIB +#define _LIBCUDACXX_CSTDLIB + +/* + cstdlib synopsis + +Macros: + + EXIT_FAILURE + EXIT_SUCCESS + MB_CUR_MAX + NULL + RAND_MAX + +namespace std +{ + +Types: + + size_t + div_t + ldiv_t + lldiv_t // C99 + +double atof (const char* nptr); +int atoi (const char* nptr); +long atol (const char* nptr); +long long atoll(const char* nptr); // C99 +double strtod (const char* restrict nptr, char** restrict endptr); +float strtof (const char* restrict nptr, char** restrict endptr); // C99 +long double strtold (const char* restrict nptr, char** restrict endptr); // C99 +long strtol (const char* restrict nptr, char** restrict endptr, int base); +long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99 +unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base); +unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99 +int rand(void); +void srand(unsigned int seed); +void* calloc(size_t nmemb, size_t size); +void free(void* ptr); +void* malloc(size_t size); +void* realloc(void* ptr, size_t size); +void abort(void); +int atexit(void (*func)(void)); +void exit(int status); +void _Exit(int status); +char* getenv(const char* name); +int system(const char* string); +void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, + int (*compar)(const void *, const void *)); +void qsort(void* base, size_t nmemb, size_t size, + int (*compar)(const void *, const void *)); +int abs( int j); +long abs( long j); +long long abs(long long j); // C++0X +long labs( long j); +long long llabs(long long j); // C99 +div_t div( int numer, int denom); +ldiv_t div( long numer, long denom); +lldiv_t div(long long numer, long long denom); // C++0X +ldiv_t ldiv( long numer, long denom); +lldiv_t lldiv(long long numer, long long denom); // C99 +int mblen(const char* s, size_t n); +int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n); +int wctomb(char* s, wchar_t wchar); +size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); +size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); +int at_quick_exit(void (*func)(void)) // C++11 +void quick_exit(int status); // C++11 +void *aligned_alloc(size_t alignment, size_t size); // C11 + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#include +#endif // __cuda_std__ + +#ifndef _LIBCUDACXX_COMPILER_NVRTC +# include +#endif // _LIBCUDACXX_COMPILER_NVRTC + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#if defined(_LIBCUDACXX_COMPILER_CLANG_CUDA) +# define _LIBCUDACXX_UNREACHABLE() __builtin_unreachable() +#elif defined(__CUDA_ARCH__) +#if defined(_LIBCUDACXX_CUDACC_BELOW_11_2) +# define _LIBCUDACXX_UNREACHABLE() __trap() +#elif defined(_LIBCUDACXX_CUDACC_BELOW_11_3) +# define _LIBCUDACXX_UNREACHABLE() __builtin_assume(false) +#else +# define _LIBCUDACXX_UNREACHABLE() __builtin_unreachable() +#endif // CUDACC above 11.4 +#else // ^^^ __CUDA_ARCH__ ^^^ / vvv !__CUDA_ARCH__ vvv +#if defined(_LIBCUDACXX_COMPILER_MSVC_2017) +template +_LIBCUDACXX_INLINE_VISIBILITY __declspec(noreturn) void __unreachable_fallback() { __assume(0); } +# define _LIBCUDACXX_UNREACHABLE() __unreachable_fallback() +#elif defined(_LIBCUDACXX_COMPILER_MSVC) +# define _LIBCUDACXX_UNREACHABLE() __assume(0) +#elif defined(_LIBCUDACXX_COMPILER_GCC) || __has_builtin(__builtin_unreachable) +# define _LIBCUDACXX_UNREACHABLE() __builtin_unreachable() +#else // Other compilers +# define _LIBCUDACXX_UNREACHABLE() ::abort() +#endif // Other compilers +#endif // !__CUDA_ARCH__ + +#ifdef _LIBCUDACXX_COMPILER_NVHPC +#define _LIBCUDACXX_UNREACHABLE_AFTER_SWITCH() +#else +#define _LIBCUDACXX_UNREACHABLE_AFTER_SWITCH() _LIBCUDACXX_UNREACHABLE() +#endif + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCUDACXX_COMPILER_NVRTC) +using ::size_t; +using ::div_t; +using ::ldiv_t; +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +using ::lldiv_t; +#endif // _LIBCUDACXX_HAS_NO_LONG_LONG +using ::atof; +using ::atoi; +using ::atol; +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +using ::atoll; +#endif // _LIBCUDACXX_HAS_NO_LONG_LONG +using ::strtod; +using ::strtof; +using ::strtold; +using ::strtol; +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +using ::strtoll; +#endif // _LIBCUDACXX_HAS_NO_LONG_LONG +using ::strtoul; +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +using ::strtoull; +#endif // _LIBCUDACXX_HAS_NO_LONG_LONG +using ::rand; +using ::srand; +using ::calloc; +using ::free; +using ::malloc; +using ::realloc; +using ::abort; +using ::atexit; +using ::exit; +using ::_Exit; +#ifndef _LIBCUDACXX_WINDOWS_STORE_APP +using ::getenv; +using ::system; +#endif +using ::bsearch; +using ::qsort; +using ::abs; +using ::labs; +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +using ::llabs; +#endif // _LIBCUDACXX_HAS_NO_LONG_LONG +using ::div; +using ::ldiv; +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +using ::lldiv; +#endif // _LIBCUDACXX_HAS_NO_LONG_LONG +using ::mblen; +using ::mbtowc; +using ::wctomb; +using ::mbstowcs; +using ::wcstombs; +#if defined(_LIBCUDACXX_HAS_QUICK_EXIT) +using ::at_quick_exit; +using ::quick_exit; +#endif +#if _LIBCUDACXX_STD_VER > 14 && defined(_LIBCUDACXX_HAS_C11_FEATURES) +using ::aligned_alloc; +#endif +#endif // !defined(_LIBCUDACXX_COMPILER_NVRTC) + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_CSTDLIB diff --git a/cuda_toolkit/include/cstring b/cuda_toolkit/include/cstring new file mode 100644 index 0000000000000000000000000000000000000000..7bdca8cfff076265d63e510765418b154bd0c2b7 --- /dev/null +++ b/cuda_toolkit/include/cstring @@ -0,0 +1,107 @@ +// -*- C++ -*- +//===--------------------------- cstring ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CSTRING +#define _LIBCUDACXX_CSTRING + +/* + cstring synopsis + +Macros: + + NULL + +namespace std +{ + +Types: + + size_t + +void* memcpy(void* restrict s1, const void* restrict s2, size_t n); +void* memmove(void* s1, const void* s2, size_t n); +char* strcpy (char* restrict s1, const char* restrict s2); +char* strncpy(char* restrict s1, const char* restrict s2, size_t n); +char* strcat (char* restrict s1, const char* restrict s2); +char* strncat(char* restrict s1, const char* restrict s2, size_t n); +int memcmp(const void* s1, const void* s2, size_t n); +int strcmp (const char* s1, const char* s2); +int strncmp(const char* s1, const char* s2, size_t n); +int strcoll(const char* s1, const char* s2); +size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n); +const void* memchr(const void* s, int c, size_t n); + void* memchr( void* s, int c, size_t n); +const char* strchr(const char* s, int c); + char* strchr( char* s, int c); +size_t strcspn(const char* s1, const char* s2); +const char* strpbrk(const char* s1, const char* s2); + char* strpbrk( char* s1, const char* s2); +const char* strrchr(const char* s, int c); + char* strrchr( char* s, int c); +size_t strspn(const char* s1, const char* s2); +const char* strstr(const char* s1, const char* s2); + char* strstr( char* s1, const char* s2); +char* strtok(char* restrict s1, const char* restrict s2); +void* memset(void* s, int c, size_t n); +char* strerror(int errnum); +size_t strlen(const char* s); + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#include +#include <__pragma_push> +#endif //__simet__ <- a tribute to ogiroux + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::size_t; +using ::memcpy; +using ::memmove; +using ::strcpy; +using ::strncpy; +using ::strcat; +using ::strncat; +using ::memcmp; +using ::strcmp; +using ::strncmp; +using ::strcoll; +using ::strxfrm; +using ::memchr; +using ::strchr; +using ::strcspn; +using ::strpbrk; +using ::strrchr; +using ::strspn; +using ::strstr; +#ifndef _LIBCUDACXX_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS +using ::strtok; +#endif +using ::memset; +using ::strerror; +using ::strlen; + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_CSTRING diff --git a/cuda_toolkit/include/ctgmath b/cuda_toolkit/include/ctgmath new file mode 100644 index 0000000000000000000000000000000000000000..cd9214851c34a8b832dca9ca6922f3667ed7e750 --- /dev/null +++ b/cuda_toolkit/include/ctgmath @@ -0,0 +1,32 @@ +// -*- C++ -*- +//===-------------------------- ctgmath -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CTGMATH +#define _LIBCUDACXX_CTGMATH + +/* + ctgmath synopsis + +#include +#include + +*/ + +#include +#include "cmath" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#endif // _LIBCUDACXX_CTGMATH diff --git a/cuda_toolkit/include/ctime b/cuda_toolkit/include/ctime new file mode 100644 index 0000000000000000000000000000000000000000..0dc842d6f1f22d43e2f30c2339b76a08334bfdc6 --- /dev/null +++ b/cuda_toolkit/include/ctime @@ -0,0 +1,104 @@ +// -*- C++ -*- +//===---------------------------- ctime -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CTIME +#define _LIBCUDACXX_CTIME + +/* + ctime synopsis + +Macros: + + NULL + CLOCKS_PER_SEC + TIME_UTC // C++17 + +namespace std +{ + +Types: + + clock_t + size_t + time_t + tm + timespec // C++17 + +clock_t clock(); +double difftime(time_t time1, time_t time0); +time_t mktime(tm* timeptr); +time_t time(time_t* timer); +char* asctime(const tm* timeptr); +char* ctime(const time_t* timer); +tm* gmtime(const time_t* timer); +tm* localtime(const time_t* timer); +size_t strftime(char* restrict s, size_t maxsize, const char* restrict format, + const tm* restrict timeptr); +int timespec_get( struct timespec *ts, int base); // C++17 +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#endif // __cuda_std__ + +#ifndef _LIBCUDACXX_COMPILER_NVRTC +#include +#else +typedef long long int time_t; +#endif // _LIBCUDACXX_COMPILER_NVRTC + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::clock_t; +using ::size_t; +using ::time_t; + +#ifndef _LIBCUDACXX_COMPILER_NVRTC + +using ::tm; +#if _LIBCUDACXX_STD_VER > 14 && defined(_LIBCUDACXX_HAS_C11_FEATURES) +using ::timespec; +#endif +using ::clock; +using ::difftime; +using ::mktime; +using ::time; +#ifndef _LIBCUDACXX_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS +using ::asctime; +using ::ctime; +using ::gmtime; +using ::localtime; +#endif +using ::strftime; +#if _LIBCUDACXX_STD_VER > 14 && defined(_LIBCUDACXX_HAS_TIMESPEC_GET) +using ::timespec_get; +#endif +#endif // _LIBCUDACXX_COMPILER_NVRTC + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_CTIME diff --git a/cuda_toolkit/include/ctype.h b/cuda_toolkit/include/ctype.h new file mode 100644 index 0000000000000000000000000000000000000000..f9210f03c08728a6b754f2af019df7b7f31e0c52 --- /dev/null +++ b/cuda_toolkit/include/ctype.h @@ -0,0 +1,63 @@ +// -*- C++ -*- +//===---------------------------- ctype.h ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CTYPE_H +#define _LIBCUDACXX_CTYPE_H + +/* + ctype.h synopsis + +int isalnum(int c); +int isalpha(int c); +int isblank(int c); // C99 +int iscntrl(int c); +int isdigit(int c); +int isgraph(int c); +int islower(int c); +int isprint(int c); +int ispunct(int c); +int isspace(int c); +int isupper(int c); +int isxdigit(int c); +int tolower(int c); +int toupper(int c); +*/ + +#include <__config> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include_next + +#ifdef __cplusplus + +#undef isalnum +#undef isalpha +#undef isblank +#undef iscntrl +#undef isdigit +#undef isgraph +#undef islower +#undef isprint +#undef ispunct +#undef isspace +#undef isupper +#undef isxdigit +#undef tolower +#undef toupper + +#endif + +#endif // _LIBCUDACXX_CTYPE_H diff --git a/cuda_toolkit/include/cuComplex.h b/cuda_toolkit/include/cuComplex.h new file mode 100644 index 0000000000000000000000000000000000000000..cf1ac1d9f8b851c72855a9c1095f216ccbccb683 --- /dev/null +++ b/cuda_toolkit/include/cuComplex.h @@ -0,0 +1,348 @@ +/* + * Copyright 1993-2012 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(CU_COMPLEX_H_) +#define CU_COMPLEX_H_ + +#if !defined(__CUDACC_RTC__) +#if defined(__GNUC__) +#if defined(__clang__) || (!defined(__PGIC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))) +#pragma GCC diagnostic ignored "-Wunused-function" +#endif +#endif +#endif + +/* When trying to include C header file in C++ Code extern "C" is required + * But the Standard QNX headers already have ifdef extern in them when compiling C++ Code + * extern "C" cannot be nested + * Hence keep the header out of extern "C" block + */ + +#if !defined(__CUDACC__) +#include /* import fabsf, sqrt */ +#endif /* !defined(__CUDACC__) */ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +#include "vector_types.h" + +typedef float2 cuFloatComplex; + +__host__ __device__ static __inline__ float cuCrealf (cuFloatComplex x) +{ + return x.x; +} + +__host__ __device__ static __inline__ float cuCimagf (cuFloatComplex x) +{ + return x.y; +} + +__host__ __device__ static __inline__ cuFloatComplex make_cuFloatComplex + (float r, float i) +{ + cuFloatComplex res; + res.x = r; + res.y = i; + return res; +} + +__host__ __device__ static __inline__ cuFloatComplex cuConjf (cuFloatComplex x) +{ + return make_cuFloatComplex (cuCrealf(x), -cuCimagf(x)); +} +__host__ __device__ static __inline__ cuFloatComplex cuCaddf (cuFloatComplex x, + cuFloatComplex y) +{ + return make_cuFloatComplex (cuCrealf(x) + cuCrealf(y), + cuCimagf(x) + cuCimagf(y)); +} + +__host__ __device__ static __inline__ cuFloatComplex cuCsubf (cuFloatComplex x, + cuFloatComplex y) +{ + return make_cuFloatComplex (cuCrealf(x) - cuCrealf(y), + cuCimagf(x) - cuCimagf(y)); +} + +/* This implementation could suffer from intermediate overflow even though + * the final result would be in range. However, various implementations do + * not guard against this (presumably to avoid losing performance), so we + * don't do it either to stay competitive. + */ +__host__ __device__ static __inline__ cuFloatComplex cuCmulf (cuFloatComplex x, + cuFloatComplex y) +{ + cuFloatComplex prod; + prod = make_cuFloatComplex ((cuCrealf(x) * cuCrealf(y)) - + (cuCimagf(x) * cuCimagf(y)), + (cuCrealf(x) * cuCimagf(y)) + + (cuCimagf(x) * cuCrealf(y))); + return prod; +} + +/* This implementation guards against intermediate underflow and overflow + * by scaling. Such guarded implementations are usually the default for + * complex library implementations, with some also offering an unguarded, + * faster version. + */ +__host__ __device__ static __inline__ cuFloatComplex cuCdivf (cuFloatComplex x, + cuFloatComplex y) +{ + cuFloatComplex quot; + float s = fabsf(cuCrealf(y)) + fabsf(cuCimagf(y)); + float oos = 1.0f / s; + float ars = cuCrealf(x) * oos; + float ais = cuCimagf(x) * oos; + float brs = cuCrealf(y) * oos; + float bis = cuCimagf(y) * oos; + s = (brs * brs) + (bis * bis); + oos = 1.0f / s; + quot = make_cuFloatComplex (((ars * brs) + (ais * bis)) * oos, + ((ais * brs) - (ars * bis)) * oos); + return quot; +} + +/* + * We would like to call hypotf(), but it's not available on all platforms. + * This discrete implementation guards against intermediate underflow and + * overflow by scaling. Otherwise we would lose half the exponent range. + * There are various ways of doing guarded computation. For now chose the + * simplest and fastest solution, however this may suffer from inaccuracies + * if sqrt and division are not IEEE compliant. + */ +__host__ __device__ static __inline__ float cuCabsf (cuFloatComplex x) +{ + float a = cuCrealf(x); + float b = cuCimagf(x); + float v, w, t; + a = fabsf(a); + b = fabsf(b); + if (a > b) { + v = a; + w = b; + } else { + v = b; + w = a; + } + t = w / v; + t = 1.0f + t * t; + t = v * sqrtf(t); + if ((v == 0.0f) || (v > 3.402823466e38f) || (w > 3.402823466e38f)) { + t = v + w; + } + return t; +} + +/* Double precision */ +typedef double2 cuDoubleComplex; + +__host__ __device__ static __inline__ double cuCreal (cuDoubleComplex x) +{ + return x.x; +} + +__host__ __device__ static __inline__ double cuCimag (cuDoubleComplex x) +{ + return x.y; +} + +__host__ __device__ static __inline__ cuDoubleComplex make_cuDoubleComplex + (double r, double i) +{ + cuDoubleComplex res; + res.x = r; + res.y = i; + return res; +} + +__host__ __device__ static __inline__ cuDoubleComplex cuConj(cuDoubleComplex x) +{ + return make_cuDoubleComplex (cuCreal(x), -cuCimag(x)); +} + +__host__ __device__ static __inline__ cuDoubleComplex cuCadd(cuDoubleComplex x, + cuDoubleComplex y) +{ + return make_cuDoubleComplex (cuCreal(x) + cuCreal(y), + cuCimag(x) + cuCimag(y)); +} + +__host__ __device__ static __inline__ cuDoubleComplex cuCsub(cuDoubleComplex x, + cuDoubleComplex y) +{ + return make_cuDoubleComplex (cuCreal(x) - cuCreal(y), + cuCimag(x) - cuCimag(y)); +} + +/* This implementation could suffer from intermediate overflow even though + * the final result would be in range. However, various implementations do + * not guard against this (presumably to avoid losing performance), so we + * don't do it either to stay competitive. + */ +__host__ __device__ static __inline__ cuDoubleComplex cuCmul(cuDoubleComplex x, + cuDoubleComplex y) +{ + cuDoubleComplex prod; + prod = make_cuDoubleComplex ((cuCreal(x) * cuCreal(y)) - + (cuCimag(x) * cuCimag(y)), + (cuCreal(x) * cuCimag(y)) + + (cuCimag(x) * cuCreal(y))); + return prod; +} + +/* This implementation guards against intermediate underflow and overflow + * by scaling. Such guarded implementations are usually the default for + * complex library implementations, with some also offering an unguarded, + * faster version. + */ +__host__ __device__ static __inline__ cuDoubleComplex cuCdiv(cuDoubleComplex x, + cuDoubleComplex y) +{ + cuDoubleComplex quot; + double s = (fabs(cuCreal(y))) + (fabs(cuCimag(y))); + double oos = 1.0 / s; + double ars = cuCreal(x) * oos; + double ais = cuCimag(x) * oos; + double brs = cuCreal(y) * oos; + double bis = cuCimag(y) * oos; + s = (brs * brs) + (bis * bis); + oos = 1.0 / s; + quot = make_cuDoubleComplex (((ars * brs) + (ais * bis)) * oos, + ((ais * brs) - (ars * bis)) * oos); + return quot; +} + +/* This implementation guards against intermediate underflow and overflow + * by scaling. Otherwise we would lose half the exponent range. There are + * various ways of doing guarded computation. For now chose the simplest + * and fastest solution, however this may suffer from inaccuracies if sqrt + * and division are not IEEE compliant. + */ +__host__ __device__ static __inline__ double cuCabs (cuDoubleComplex x) +{ + double a = cuCreal(x); + double b = cuCimag(x); + double v, w, t; + a = fabs(a); + b = fabs(b); + if (a > b) { + v = a; + w = b; + } else { + v = b; + w = a; + } + t = w / v; + t = 1.0 + t * t; + t = v * sqrt(t); + if ((v == 0.0) || + (v > 1.79769313486231570e+308) || (w > 1.79769313486231570e+308)) { + t = v + w; + } + return t; +} + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +/* aliases */ +typedef cuFloatComplex cuComplex; +__host__ __device__ static __inline__ cuComplex make_cuComplex (float x, + float y) +{ + return make_cuFloatComplex (x, y); +} + +/* float-to-double promotion */ +__host__ __device__ static __inline__ cuDoubleComplex cuComplexFloatToDouble + (cuFloatComplex c) +{ + return make_cuDoubleComplex ((double)cuCrealf(c), (double)cuCimagf(c)); +} + +__host__ __device__ static __inline__ cuFloatComplex cuComplexDoubleToFloat +(cuDoubleComplex c) +{ + return make_cuFloatComplex ((float)cuCreal(c), (float)cuCimag(c)); +} + + +__host__ __device__ static __inline__ cuComplex cuCfmaf( cuComplex x, cuComplex y, cuComplex d) +{ + float real_res; + float imag_res; + + real_res = (cuCrealf(x) * cuCrealf(y)) + cuCrealf(d); + imag_res = (cuCrealf(x) * cuCimagf(y)) + cuCimagf(d); + + real_res = -(cuCimagf(x) * cuCimagf(y)) + real_res; + imag_res = (cuCimagf(x) * cuCrealf(y)) + imag_res; + + return make_cuComplex(real_res, imag_res); +} + +__host__ __device__ static __inline__ cuDoubleComplex cuCfma( cuDoubleComplex x, cuDoubleComplex y, cuDoubleComplex d) +{ + double real_res; + double imag_res; + + real_res = (cuCreal(x) * cuCreal(y)) + cuCreal(d); + imag_res = (cuCreal(x) * cuCimag(y)) + cuCimag(d); + + real_res = -(cuCimag(x) * cuCimag(y)) + real_res; + imag_res = (cuCimag(x) * cuCreal(y)) + imag_res; + + return make_cuDoubleComplex(real_res, imag_res); +} + +#endif /* !defined(CU_COMPLEX_H_) */ diff --git a/cuda_toolkit/include/cublas.h b/cuda_toolkit/include/cublas.h new file mode 100644 index 0000000000000000000000000000000000000000..7422168e2f02ea6fe960fc2ed4bd8b73806cafc4 --- /dev/null +++ b/cuda_toolkit/include/cublas.h @@ -0,0 +1,891 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/* + * This is the public header file for the CUBLAS library, defining the API + * + * CUBLAS is an implementation of BLAS (Basic Linear Algebra Subroutines) + * on top of the CUDA runtime. + */ + +#if !defined(CUBLAS_H_) +#define CUBLAS_H_ + +#if defined(CUBLAS_V2_H_) +#error "It is an error to include both cublas.h and cublas_v2.h" +#endif + +#include + +#ifndef CUBLASWINAPI +#ifdef _WIN32 +#define CUBLASWINAPI __stdcall +#else +#define CUBLASWINAPI +#endif +#endif + +#undef CUBLASAPI +#ifdef __CUDACC__ +#define CUBLASAPI __host__ +#else +#define CUBLASAPI +#endif + +#include "cublas_api.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/* CUBLAS data types */ +#define cublasStatus cublasStatus_t + +cublasStatus CUBLASWINAPI cublasInit(void); +cublasStatus CUBLASWINAPI cublasShutdown(void); +cublasStatus CUBLASWINAPI cublasGetError(void); + +cublasStatus CUBLASWINAPI cublasGetVersion(int* version); +cublasStatus CUBLASWINAPI cublasAlloc(int n, int elemSize, void** devicePtr); + +cublasStatus CUBLASWINAPI cublasFree(void* devicePtr); + +cublasStatus CUBLASWINAPI cublasSetKernelStream(cudaStream_t stream); + +/* ---------------- CUBLAS BLAS1 functions ---------------- */ +/* NRM2 */ +float CUBLASWINAPI cublasSnrm2(int n, const float* x, int incx); +double CUBLASWINAPI cublasDnrm2(int n, const double* x, int incx); +float CUBLASWINAPI cublasScnrm2(int n, const cuComplex* x, int incx); +double CUBLASWINAPI cublasDznrm2(int n, const cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* DOT */ +float CUBLASWINAPI cublasSdot(int n, const float* x, int incx, const float* y, int incy); +double CUBLASWINAPI cublasDdot(int n, const double* x, int incx, const double* y, int incy); +cuComplex CUBLASWINAPI cublasCdotu(int n, const cuComplex* x, int incx, const cuComplex* y, int incy); +cuComplex CUBLASWINAPI cublasCdotc(int n, const cuComplex* x, int incx, const cuComplex* y, int incy); +cuDoubleComplex CUBLASWINAPI cublasZdotu(int n, const cuDoubleComplex* x, int incx, const cuDoubleComplex* y, int incy); +cuDoubleComplex CUBLASWINAPI cublasZdotc(int n, const cuDoubleComplex* x, int incx, const cuDoubleComplex* y, int incy); +/*------------------------------------------------------------------------*/ +/* SCAL */ +void CUBLASWINAPI cublasSscal(int n, float alpha, float* x, int incx); +void CUBLASWINAPI cublasDscal(int n, double alpha, double* x, int incx); +void CUBLASWINAPI cublasCscal(int n, cuComplex alpha, cuComplex* x, int incx); +void CUBLASWINAPI cublasZscal(int n, cuDoubleComplex alpha, cuDoubleComplex* x, int incx); + +void CUBLASWINAPI cublasCsscal(int n, float alpha, cuComplex* x, int incx); +void CUBLASWINAPI cublasZdscal(int n, double alpha, cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* AXPY */ +void CUBLASWINAPI cublasSaxpy(int n, float alpha, const float* x, int incx, float* y, int incy); +void CUBLASWINAPI cublasDaxpy(int n, double alpha, const double* x, int incx, double* y, int incy); +void CUBLASWINAPI cublasCaxpy(int n, cuComplex alpha, const cuComplex* x, int incx, cuComplex* y, int incy); +void CUBLASWINAPI +cublasZaxpy(int n, cuDoubleComplex alpha, const cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy); +/*------------------------------------------------------------------------*/ +/* COPY */ +void CUBLASWINAPI cublasScopy(int n, const float* x, int incx, float* y, int incy); +void CUBLASWINAPI cublasDcopy(int n, const double* x, int incx, double* y, int incy); +void CUBLASWINAPI cublasCcopy(int n, const cuComplex* x, int incx, cuComplex* y, int incy); +void CUBLASWINAPI cublasZcopy(int n, const cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy); +/*------------------------------------------------------------------------*/ +/* SWAP */ +void CUBLASWINAPI cublasSswap(int n, float* x, int incx, float* y, int incy); +void CUBLASWINAPI cublasDswap(int n, double* x, int incx, double* y, int incy); +void CUBLASWINAPI cublasCswap(int n, cuComplex* x, int incx, cuComplex* y, int incy); +void CUBLASWINAPI cublasZswap(int n, cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy); +/*------------------------------------------------------------------------*/ +/* AMAX */ +int CUBLASWINAPI cublasIsamax(int n, const float* x, int incx); +int CUBLASWINAPI cublasIdamax(int n, const double* x, int incx); +int CUBLASWINAPI cublasIcamax(int n, const cuComplex* x, int incx); +int CUBLASWINAPI cublasIzamax(int n, const cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* AMIN */ +int CUBLASWINAPI cublasIsamin(int n, const float* x, int incx); +int CUBLASWINAPI cublasIdamin(int n, const double* x, int incx); + +int CUBLASWINAPI cublasIcamin(int n, const cuComplex* x, int incx); +int CUBLASWINAPI cublasIzamin(int n, const cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* ASUM */ +float CUBLASWINAPI cublasSasum(int n, const float* x, int incx); +double CUBLASWINAPI cublasDasum(int n, const double* x, int incx); +float CUBLASWINAPI cublasScasum(int n, const cuComplex* x, int incx); +double CUBLASWINAPI cublasDzasum(int n, const cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* ROT */ +void CUBLASWINAPI cublasSrot(int n, float* x, int incx, float* y, int incy, float sc, float ss); +void CUBLASWINAPI cublasDrot(int n, double* x, int incx, double* y, int incy, double sc, double ss); +void CUBLASWINAPI cublasCrot(int n, cuComplex* x, int incx, cuComplex* y, int incy, float c, cuComplex s); +void CUBLASWINAPI +cublasZrot(int n, cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy, double sc, cuDoubleComplex cs); +void CUBLASWINAPI cublasCsrot(int n, cuComplex* x, int incx, cuComplex* y, int incy, float c, float s); +void CUBLASWINAPI cublasZdrot(int n, cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy, double c, double s); +/*------------------------------------------------------------------------*/ +/* ROTG */ +void CUBLASWINAPI cublasSrotg(float* sa, float* sb, float* sc, float* ss); +void CUBLASWINAPI cublasDrotg(double* sa, double* sb, double* sc, double* ss); +void CUBLASWINAPI cublasCrotg(cuComplex* ca, cuComplex cb, float* sc, cuComplex* cs); +void CUBLASWINAPI cublasZrotg(cuDoubleComplex* ca, cuDoubleComplex cb, double* sc, cuDoubleComplex* cs); +/*------------------------------------------------------------------------*/ +/* ROTM */ +void CUBLASWINAPI cublasSrotm(int n, float* x, int incx, float* y, int incy, const float* sparam); +void CUBLASWINAPI cublasDrotm(int n, double* x, int incx, double* y, int incy, const double* sparam); +/*------------------------------------------------------------------------*/ +/* ROTMG */ +void CUBLASWINAPI cublasSrotmg(float* sd1, float* sd2, float* sx1, const float* sy1, float* sparam); +void CUBLASWINAPI cublasDrotmg(double* sd1, double* sd2, double* sx1, const double* sy1, double* sparam); + +/* --------------- CUBLAS BLAS2 functions ---------------- */ +/* GEMV */ +void CUBLASWINAPI cublasSgemv(char trans, + int m, + int n, + float alpha, + const float* A, + int lda, + const float* x, + int incx, + float beta, + float* y, + int incy); +void CUBLASWINAPI cublasDgemv(char trans, + int m, + int n, + double alpha, + const double* A, + int lda, + const double* x, + int incx, + double beta, + double* y, + int incy); +void CUBLASWINAPI cublasCgemv(char trans, + int m, + int n, + cuComplex alpha, + const cuComplex* A, + int lda, + const cuComplex* x, + int incx, + cuComplex beta, + cuComplex* y, + int incy); +void CUBLASWINAPI cublasZgemv(char trans, + int m, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* x, + int incx, + cuDoubleComplex beta, + cuDoubleComplex* y, + int incy); +/*------------------------------------------------------------------------*/ +/* GBMV */ +void CUBLASWINAPI cublasSgbmv(char trans, + int m, + int n, + int kl, + int ku, + float alpha, + const float* A, + int lda, + const float* x, + int incx, + float beta, + float* y, + int incy); +void CUBLASWINAPI cublasDgbmv(char trans, + int m, + int n, + int kl, + int ku, + double alpha, + const double* A, + int lda, + const double* x, + int incx, + double beta, + double* y, + int incy); +void CUBLASWINAPI cublasCgbmv(char trans, + int m, + int n, + int kl, + int ku, + cuComplex alpha, + const cuComplex* A, + int lda, + const cuComplex* x, + int incx, + cuComplex beta, + cuComplex* y, + int incy); +void CUBLASWINAPI cublasZgbmv(char trans, + int m, + int n, + int kl, + int ku, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* x, + int incx, + cuDoubleComplex beta, + cuDoubleComplex* y, + int incy); +/*------------------------------------------------------------------------*/ +/* TRMV */ +void CUBLASWINAPI cublasStrmv(char uplo, char trans, char diag, int n, const float* A, int lda, float* x, int incx); +void CUBLASWINAPI cublasDtrmv(char uplo, char trans, char diag, int n, const double* A, int lda, double* x, int incx); +void CUBLASWINAPI +cublasCtrmv(char uplo, char trans, char diag, int n, const cuComplex* A, int lda, cuComplex* x, int incx); +void CUBLASWINAPI +cublasZtrmv(char uplo, char trans, char diag, int n, const cuDoubleComplex* A, int lda, cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* TBMV */ +void CUBLASWINAPI +cublasStbmv(char uplo, char trans, char diag, int n, int k, const float* A, int lda, float* x, int incx); +void CUBLASWINAPI +cublasDtbmv(char uplo, char trans, char diag, int n, int k, const double* A, int lda, double* x, int incx); +void CUBLASWINAPI +cublasCtbmv(char uplo, char trans, char diag, int n, int k, const cuComplex* A, int lda, cuComplex* x, int incx); +void CUBLASWINAPI cublasZtbmv( + char uplo, char trans, char diag, int n, int k, const cuDoubleComplex* A, int lda, cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* TPMV */ +void CUBLASWINAPI cublasStpmv(char uplo, char trans, char diag, int n, const float* AP, float* x, int incx); + +void CUBLASWINAPI cublasDtpmv(char uplo, char trans, char diag, int n, const double* AP, double* x, int incx); + +void CUBLASWINAPI cublasCtpmv(char uplo, char trans, char diag, int n, const cuComplex* AP, cuComplex* x, int incx); + +void CUBLASWINAPI +cublasZtpmv(char uplo, char trans, char diag, int n, const cuDoubleComplex* AP, cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* TRSV */ +void CUBLASWINAPI cublasStrsv(char uplo, char trans, char diag, int n, const float* A, int lda, float* x, int incx); + +void CUBLASWINAPI cublasDtrsv(char uplo, char trans, char diag, int n, const double* A, int lda, double* x, int incx); + +void CUBLASWINAPI +cublasCtrsv(char uplo, char trans, char diag, int n, const cuComplex* A, int lda, cuComplex* x, int incx); + +void CUBLASWINAPI +cublasZtrsv(char uplo, char trans, char diag, int n, const cuDoubleComplex* A, int lda, cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* TPSV */ +void CUBLASWINAPI cublasStpsv(char uplo, char trans, char diag, int n, const float* AP, float* x, int incx); + +void CUBLASWINAPI cublasDtpsv(char uplo, char trans, char diag, int n, const double* AP, double* x, int incx); + +void CUBLASWINAPI cublasCtpsv(char uplo, char trans, char diag, int n, const cuComplex* AP, cuComplex* x, int incx); + +void CUBLASWINAPI +cublasZtpsv(char uplo, char trans, char diag, int n, const cuDoubleComplex* AP, cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* TBSV */ +void CUBLASWINAPI +cublasStbsv(char uplo, char trans, char diag, int n, int k, const float* A, int lda, float* x, int incx); + +void CUBLASWINAPI +cublasDtbsv(char uplo, char trans, char diag, int n, int k, const double* A, int lda, double* x, int incx); +void CUBLASWINAPI +cublasCtbsv(char uplo, char trans, char diag, int n, int k, const cuComplex* A, int lda, cuComplex* x, int incx); + +void CUBLASWINAPI cublasZtbsv( + char uplo, char trans, char diag, int n, int k, const cuDoubleComplex* A, int lda, cuDoubleComplex* x, int incx); +/*------------------------------------------------------------------------*/ +/* SYMV/HEMV */ +void CUBLASWINAPI cublasSsymv( + char uplo, int n, float alpha, const float* A, int lda, const float* x, int incx, float beta, float* y, int incy); +void CUBLASWINAPI cublasDsymv(char uplo, + int n, + double alpha, + const double* A, + int lda, + const double* x, + int incx, + double beta, + double* y, + int incy); +void CUBLASWINAPI cublasChemv(char uplo, + int n, + cuComplex alpha, + const cuComplex* A, + int lda, + const cuComplex* x, + int incx, + cuComplex beta, + cuComplex* y, + int incy); +void CUBLASWINAPI cublasZhemv(char uplo, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* x, + int incx, + cuDoubleComplex beta, + cuDoubleComplex* y, + int incy); +/*------------------------------------------------------------------------*/ +/* SBMV/HBMV */ +void CUBLASWINAPI cublasSsbmv(char uplo, + int n, + int k, + float alpha, + const float* A, + int lda, + const float* x, + int incx, + float beta, + float* y, + int incy); +void CUBLASWINAPI cublasDsbmv(char uplo, + int n, + int k, + double alpha, + const double* A, + int lda, + const double* x, + int incx, + double beta, + double* y, + int incy); +void CUBLASWINAPI cublasChbmv(char uplo, + int n, + int k, + cuComplex alpha, + const cuComplex* A, + int lda, + const cuComplex* x, + int incx, + cuComplex beta, + cuComplex* y, + int incy); +void CUBLASWINAPI cublasZhbmv(char uplo, + int n, + int k, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* x, + int incx, + cuDoubleComplex beta, + cuDoubleComplex* y, + int incy); +/*------------------------------------------------------------------------*/ +/* SPMV/HPMV */ +void CUBLASWINAPI +cublasSspmv(char uplo, int n, float alpha, const float* AP, const float* x, int incx, float beta, float* y, int incy); +void CUBLASWINAPI cublasDspmv( + char uplo, int n, double alpha, const double* AP, const double* x, int incx, double beta, double* y, int incy); +void CUBLASWINAPI cublasChpmv(char uplo, + int n, + cuComplex alpha, + const cuComplex* AP, + const cuComplex* x, + int incx, + cuComplex beta, + cuComplex* y, + int incy); +void CUBLASWINAPI cublasZhpmv(char uplo, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* AP, + const cuDoubleComplex* x, + int incx, + cuDoubleComplex beta, + cuDoubleComplex* y, + int incy); + +/*------------------------------------------------------------------------*/ +/* GER */ +void CUBLASWINAPI +cublasSger(int m, int n, float alpha, const float* x, int incx, const float* y, int incy, float* A, int lda); +void CUBLASWINAPI +cublasDger(int m, int n, double alpha, const double* x, int incx, const double* y, int incy, double* A, int lda); + +void CUBLASWINAPI cublasCgeru( + int m, int n, cuComplex alpha, const cuComplex* x, int incx, const cuComplex* y, int incy, cuComplex* A, int lda); +void CUBLASWINAPI cublasCgerc( + int m, int n, cuComplex alpha, const cuComplex* x, int incx, const cuComplex* y, int incy, cuComplex* A, int lda); +void CUBLASWINAPI cublasZgeru(int m, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* A, + int lda); +void CUBLASWINAPI cublasZgerc(int m, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* A, + int lda); +/*------------------------------------------------------------------------*/ +/* SYR/HER */ +void CUBLASWINAPI cublasSsyr(char uplo, int n, float alpha, const float* x, int incx, float* A, int lda); +void CUBLASWINAPI cublasDsyr(char uplo, int n, double alpha, const double* x, int incx, double* A, int lda); + +void CUBLASWINAPI cublasCher(char uplo, int n, float alpha, const cuComplex* x, int incx, cuComplex* A, int lda); +void CUBLASWINAPI +cublasZher(char uplo, int n, double alpha, const cuDoubleComplex* x, int incx, cuDoubleComplex* A, int lda); + +/*------------------------------------------------------------------------*/ +/* SPR/HPR */ +void CUBLASWINAPI cublasSspr(char uplo, int n, float alpha, const float* x, int incx, float* AP); +void CUBLASWINAPI cublasDspr(char uplo, int n, double alpha, const double* x, int incx, double* AP); +void CUBLASWINAPI cublasChpr(char uplo, int n, float alpha, const cuComplex* x, int incx, cuComplex* AP); +void CUBLASWINAPI cublasZhpr(char uplo, int n, double alpha, const cuDoubleComplex* x, int incx, cuDoubleComplex* AP); +/*------------------------------------------------------------------------*/ +/* SYR2/HER2 */ +void CUBLASWINAPI +cublasSsyr2(char uplo, int n, float alpha, const float* x, int incx, const float* y, int incy, float* A, int lda); +void CUBLASWINAPI +cublasDsyr2(char uplo, int n, double alpha, const double* x, int incx, const double* y, int incy, double* A, int lda); +void CUBLASWINAPI cublasCher2(char uplo, + int n, + cuComplex alpha, + const cuComplex* x, + int incx, + const cuComplex* y, + int incy, + cuComplex* A, + int lda); +void CUBLASWINAPI cublasZher2(char uplo, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* A, + int lda); + +/*------------------------------------------------------------------------*/ +/* SPR2/HPR2 */ +void CUBLASWINAPI +cublasSspr2(char uplo, int n, float alpha, const float* x, int incx, const float* y, int incy, float* AP); +void CUBLASWINAPI +cublasDspr2(char uplo, int n, double alpha, const double* x, int incx, const double* y, int incy, double* AP); +void CUBLASWINAPI cublasChpr2( + char uplo, int n, cuComplex alpha, const cuComplex* x, int incx, const cuComplex* y, int incy, cuComplex* AP); +void CUBLASWINAPI cublasZhpr2(char uplo, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* AP); +/* ------------------------BLAS3 Functions ------------------------------- */ +/* GEMM */ +void CUBLASWINAPI cublasSgemm(char transa, + char transb, + int m, + int n, + int k, + float alpha, + const float* A, + int lda, + const float* B, + int ldb, + float beta, + float* C, + int ldc); +void CUBLASWINAPI cublasDgemm(char transa, + char transb, + int m, + int n, + int k, + double alpha, + const double* A, + int lda, + const double* B, + int ldb, + double beta, + double* C, + int ldc); +void CUBLASWINAPI cublasCgemm(char transa, + char transb, + int m, + int n, + int k, + cuComplex alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + cuComplex beta, + cuComplex* C, + int ldc); +void CUBLASWINAPI cublasZgemm(char transa, + char transb, + int m, + int n, + int k, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + cuDoubleComplex beta, + cuDoubleComplex* C, + int ldc); +/* -------------------------------------------------------*/ +/* SYRK */ +void CUBLASWINAPI +cublasSsyrk(char uplo, char trans, int n, int k, float alpha, const float* A, int lda, float beta, float* C, int ldc); +void CUBLASWINAPI cublasDsyrk( + char uplo, char trans, int n, int k, double alpha, const double* A, int lda, double beta, double* C, int ldc); + +void CUBLASWINAPI cublasCsyrk(char uplo, + char trans, + int n, + int k, + cuComplex alpha, + const cuComplex* A, + int lda, + cuComplex beta, + cuComplex* C, + int ldc); +void CUBLASWINAPI cublasZsyrk(char uplo, + char trans, + int n, + int k, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + cuDoubleComplex beta, + cuDoubleComplex* C, + int ldc); +/* ------------------------------------------------------- */ +/* HERK */ +void CUBLASWINAPI cublasCherk( + char uplo, char trans, int n, int k, float alpha, const cuComplex* A, int lda, float beta, cuComplex* C, int ldc); +void CUBLASWINAPI cublasZherk(char uplo, + char trans, + int n, + int k, + double alpha, + const cuDoubleComplex* A, + int lda, + double beta, + cuDoubleComplex* C, + int ldc); +/* ------------------------------------------------------- */ +/* SYR2K */ +void CUBLASWINAPI cublasSsyr2k(char uplo, + char trans, + int n, + int k, + float alpha, + const float* A, + int lda, + const float* B, + int ldb, + float beta, + float* C, + int ldc); + +void CUBLASWINAPI cublasDsyr2k(char uplo, + char trans, + int n, + int k, + double alpha, + const double* A, + int lda, + const double* B, + int ldb, + double beta, + double* C, + int ldc); +void CUBLASWINAPI cublasCsyr2k(char uplo, + char trans, + int n, + int k, + cuComplex alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + cuComplex beta, + cuComplex* C, + int ldc); + +void CUBLASWINAPI cublasZsyr2k(char uplo, + char trans, + int n, + int k, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + cuDoubleComplex beta, + cuDoubleComplex* C, + int ldc); +/* ------------------------------------------------------- */ +/* HER2K */ +void CUBLASWINAPI cublasCher2k(char uplo, + char trans, + int n, + int k, + cuComplex alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + float beta, + cuComplex* C, + int ldc); + +void CUBLASWINAPI cublasZher2k(char uplo, + char trans, + int n, + int k, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + double beta, + cuDoubleComplex* C, + int ldc); + +/*------------------------------------------------------------------------*/ +/* SYMM*/ +void CUBLASWINAPI cublasSsymm(char side, + char uplo, + int m, + int n, + float alpha, + const float* A, + int lda, + const float* B, + int ldb, + float beta, + float* C, + int ldc); +void CUBLASWINAPI cublasDsymm(char side, + char uplo, + int m, + int n, + double alpha, + const double* A, + int lda, + const double* B, + int ldb, + double beta, + double* C, + int ldc); + +void CUBLASWINAPI cublasCsymm(char side, + char uplo, + int m, + int n, + cuComplex alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + cuComplex beta, + cuComplex* C, + int ldc); + +void CUBLASWINAPI cublasZsymm(char side, + char uplo, + int m, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + cuDoubleComplex beta, + cuDoubleComplex* C, + int ldc); +/*------------------------------------------------------------------------*/ +/* HEMM*/ +void CUBLASWINAPI cublasChemm(char side, + char uplo, + int m, + int n, + cuComplex alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + cuComplex beta, + cuComplex* C, + int ldc); +void CUBLASWINAPI cublasZhemm(char side, + char uplo, + int m, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + cuDoubleComplex beta, + cuDoubleComplex* C, + int ldc); + +/*------------------------------------------------------------------------*/ +/* TRSM*/ +void CUBLASWINAPI cublasStrsm(char side, + char uplo, + char transa, + char diag, + int m, + int n, + float alpha, + const float* A, + int lda, + float* B, + int ldb); + +void CUBLASWINAPI cublasDtrsm(char side, + char uplo, + char transa, + char diag, + int m, + int n, + double alpha, + const double* A, + int lda, + double* B, + int ldb); + +void CUBLASWINAPI cublasCtrsm(char side, + char uplo, + char transa, + char diag, + int m, + int n, + cuComplex alpha, + const cuComplex* A, + int lda, + cuComplex* B, + int ldb); + +void CUBLASWINAPI cublasZtrsm(char side, + char uplo, + char transa, + char diag, + int m, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + cuDoubleComplex* B, + int ldb); +/*------------------------------------------------------------------------*/ +/* TRMM*/ +void CUBLASWINAPI cublasStrmm(char side, + char uplo, + char transa, + char diag, + int m, + int n, + float alpha, + const float* A, + int lda, + float* B, + int ldb); +void CUBLASWINAPI cublasDtrmm(char side, + char uplo, + char transa, + char diag, + int m, + int n, + double alpha, + const double* A, + int lda, + double* B, + int ldb); +void CUBLASWINAPI cublasCtrmm(char side, + char uplo, + char transa, + char diag, + int m, + int n, + cuComplex alpha, + const cuComplex* A, + int lda, + cuComplex* B, + int ldb); +void CUBLASWINAPI cublasZtrmm(char side, + char uplo, + char transa, + char diag, + int m, + int n, + cuDoubleComplex alpha, + const cuDoubleComplex* A, + int lda, + cuDoubleComplex* B, + int ldb); + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif /* !defined(CUBLAS_H_) */ diff --git a/cuda_toolkit/include/cublasLt.h b/cuda_toolkit/include/cublasLt.h new file mode 100644 index 0000000000000000000000000000000000000000..7209e00d38c5d5490b00dc1a1b83b42deade5cc0 --- /dev/null +++ b/cuda_toolkit/include/cublasLt.h @@ -0,0 +1,1845 @@ +/* + * Copyright 1993-2022 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ +#pragma once + +#ifndef CUBLASAPI +#ifdef __CUDACC__ +#define CUBLASAPI __host__ __device__ +#else +#define CUBLASAPI +#endif +#endif + +#include + +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/** Opaque structure holding CUBLASLT context + */ +typedef struct cublasLtContext* cublasLtHandle_t; + +cublasStatus_t CUBLASWINAPI cublasLtCreate(cublasLtHandle_t* lightHandle); + +cublasStatus_t CUBLASWINAPI cublasLtDestroy(cublasLtHandle_t lightHandle); + +const char* CUBLASWINAPI cublasLtGetStatusName(cublasStatus_t status); + +const char* CUBLASWINAPI cublasLtGetStatusString(cublasStatus_t status); + +size_t CUBLASWINAPI cublasLtGetVersion(void); + +size_t CUBLASWINAPI cublasLtGetCudartVersion(void); + +cublasStatus_t CUBLASWINAPI cublasLtGetProperty(libraryPropertyType type, int* value); + +cublasStatus_t CUBLASWINAPI cublasLtHeuristicsCacheGetCapacity(size_t* capacity); +cublasStatus_t CUBLASWINAPI cublasLtHeuristicsCacheSetCapacity(size_t capacity); + +/** Restricts usage of CPU instructions (ISA) specified by the flags in the mask. + * + * Flags can be combined with bitwise OR(|) operator. Supported flags: + * - 0x1 -- x86-64 AVX512 ISA + * + * Default mask: 0 (any applicable ISA is allowed). + * + * The function returns the previous value of the mask. + * The function takes precedence over the environment variable CUBLASLT_DISABLE_CPU_INSTRUCTIONS_MASK. + */ +unsigned CUBLASWINAPI cublasLtDisableCpuInstructionsSetMask(unsigned mask); + +/** Semi-opaque descriptor for matrix memory layout + */ +typedef struct { + uint64_t data[8]; +} cublasLtMatrixLayoutOpaque_t; + +/** Opaque descriptor for matrix memory layout + */ +typedef cublasLtMatrixLayoutOpaque_t* cublasLtMatrixLayout_t; + +/** Semi-opaque algorithm descriptor (to avoid complicated alloc/free schemes) + * + * This structure can be trivially serialized and later restored for use with the same version of cuBLAS library to save + * on selecting the right configuration again. + */ +typedef struct { + uint64_t data[8]; +} cublasLtMatmulAlgo_t; + +/** Semi-opaque descriptor for cublasLtMatmul() operation details + */ +typedef struct { + uint64_t data[32]; +} cublasLtMatmulDescOpaque_t; + +/** Opaque descriptor for cublasLtMatmul() operation details + */ +typedef cublasLtMatmulDescOpaque_t* cublasLtMatmulDesc_t; + +/** Semi-opaque descriptor for cublasLtMatrixTransform() operation details + */ +typedef struct { + uint64_t data[8]; +} cublasLtMatrixTransformDescOpaque_t; + +/** Opaque descriptor for cublasLtMatrixTransform() operation details + */ +typedef cublasLtMatrixTransformDescOpaque_t* cublasLtMatrixTransformDesc_t; + +/** Semi-opaque descriptor for cublasLtMatmulPreference() operation details + */ +typedef struct { + uint64_t data[8]; +} cublasLtMatmulPreferenceOpaque_t; + +/** Opaque descriptor for cublasLtMatmulAlgoGetHeuristic() configuration + */ +typedef cublasLtMatmulPreferenceOpaque_t* cublasLtMatmulPreference_t; + +/** Tile size (in C/D matrix Rows x Cols) + * + * General order of tile IDs is sorted by size first and by first dimension second. + */ +typedef enum { + CUBLASLT_MATMUL_TILE_UNDEFINED = 0, + CUBLASLT_MATMUL_TILE_8x8 = 1, + CUBLASLT_MATMUL_TILE_8x16 = 2, + CUBLASLT_MATMUL_TILE_16x8 = 3, + CUBLASLT_MATMUL_TILE_8x32 = 4, + CUBLASLT_MATMUL_TILE_16x16 = 5, + CUBLASLT_MATMUL_TILE_32x8 = 6, + CUBLASLT_MATMUL_TILE_8x64 = 7, + CUBLASLT_MATMUL_TILE_16x32 = 8, + CUBLASLT_MATMUL_TILE_32x16 = 9, + CUBLASLT_MATMUL_TILE_64x8 = 10, + CUBLASLT_MATMUL_TILE_32x32 = 11, + CUBLASLT_MATMUL_TILE_32x64 = 12, + CUBLASLT_MATMUL_TILE_64x32 = 13, + CUBLASLT_MATMUL_TILE_32x128 = 14, + CUBLASLT_MATMUL_TILE_64x64 = 15, + CUBLASLT_MATMUL_TILE_128x32 = 16, + CUBLASLT_MATMUL_TILE_64x128 = 17, + CUBLASLT_MATMUL_TILE_128x64 = 18, + CUBLASLT_MATMUL_TILE_64x256 = 19, + CUBLASLT_MATMUL_TILE_128x128 = 20, + CUBLASLT_MATMUL_TILE_256x64 = 21, + CUBLASLT_MATMUL_TILE_64x512 = 22, + CUBLASLT_MATMUL_TILE_128x256 = 23, + CUBLASLT_MATMUL_TILE_256x128 = 24, + CUBLASLT_MATMUL_TILE_512x64 = 25, + CUBLASLT_MATMUL_TILE_64x96 = 26, + CUBLASLT_MATMUL_TILE_96x64 = 27, + CUBLASLT_MATMUL_TILE_96x128 = 28, + CUBLASLT_MATMUL_TILE_128x160 = 29, + CUBLASLT_MATMUL_TILE_160x128 = 30, + CUBLASLT_MATMUL_TILE_192x128 = 31, + CUBLASLT_MATMUL_TILE_128x192 = 32, + CUBLASLT_MATMUL_TILE_128x96 = 33, + CUBLASLT_MATMUL_TILE_32x256 = 34, + CUBLASLT_MATMUL_TILE_256x32 = 35, + CUBLASLT_MATMUL_TILE_END +} cublasLtMatmulTile_t; + +/** Size and number of stages in which elements are read into shared memory + * + * General order of stages IDs is sorted by stage size first and by number of stages second. + */ +typedef enum { + CUBLASLT_MATMUL_STAGES_UNDEFINED = 0, + CUBLASLT_MATMUL_STAGES_16x1 = 1, + CUBLASLT_MATMUL_STAGES_16x2 = 2, + CUBLASLT_MATMUL_STAGES_16x3 = 3, + CUBLASLT_MATMUL_STAGES_16x4 = 4, + CUBLASLT_MATMUL_STAGES_16x5 = 5, + CUBLASLT_MATMUL_STAGES_16x6 = 6, + CUBLASLT_MATMUL_STAGES_32x1 = 7, + CUBLASLT_MATMUL_STAGES_32x2 = 8, + CUBLASLT_MATMUL_STAGES_32x3 = 9, + CUBLASLT_MATMUL_STAGES_32x4 = 10, + CUBLASLT_MATMUL_STAGES_32x5 = 11, + CUBLASLT_MATMUL_STAGES_32x6 = 12, + CUBLASLT_MATMUL_STAGES_64x1 = 13, + CUBLASLT_MATMUL_STAGES_64x2 = 14, + CUBLASLT_MATMUL_STAGES_64x3 = 15, + CUBLASLT_MATMUL_STAGES_64x4 = 16, + CUBLASLT_MATMUL_STAGES_64x5 = 17, + CUBLASLT_MATMUL_STAGES_64x6 = 18, + CUBLASLT_MATMUL_STAGES_128x1 = 19, + CUBLASLT_MATMUL_STAGES_128x2 = 20, + CUBLASLT_MATMUL_STAGES_128x3 = 21, + CUBLASLT_MATMUL_STAGES_128x4 = 22, + CUBLASLT_MATMUL_STAGES_128x5 = 23, + CUBLASLT_MATMUL_STAGES_128x6 = 24, + CUBLASLT_MATMUL_STAGES_32x10 = 25, + CUBLASLT_MATMUL_STAGES_8x4 = 26, + CUBLASLT_MATMUL_STAGES_16x10 = 27, + CUBLASLT_MATMUL_STAGES_8x5 = 28, + CUBLASLT_MATMUL_STAGES_8x3 = 31, + CUBLASLT_MATMUL_STAGES_8xAUTO = 32, + CUBLASLT_MATMUL_STAGES_16xAUTO = 33, + CUBLASLT_MATMUL_STAGES_32xAUTO = 34, + CUBLASLT_MATMUL_STAGES_64xAUTO = 35, + CUBLASLT_MATMUL_STAGES_128xAUTO = 36, + CUBLASLT_MATMUL_STAGES_END +} cublasLtMatmulStages_t; + +/** Thread Block Cluster size + * + * Typically dimensioned similar to cublasLtMatmulTile_t, with the third coordinate unused at this time. + */ +typedef enum { + /** Let library pick cluster shape automatically */ + CUBLASLT_CLUSTER_SHAPE_AUTO = 0, + CUBLASLT_CLUSTER_SHAPE_1x1x1 = 2, + CUBLASLT_CLUSTER_SHAPE_2x1x1 = 3, + CUBLASLT_CLUSTER_SHAPE_4x1x1 = 4, + CUBLASLT_CLUSTER_SHAPE_1x2x1 = 5, + CUBLASLT_CLUSTER_SHAPE_2x2x1 = 6, + CUBLASLT_CLUSTER_SHAPE_4x2x1 = 7, + CUBLASLT_CLUSTER_SHAPE_1x4x1 = 8, + CUBLASLT_CLUSTER_SHAPE_2x4x1 = 9, + CUBLASLT_CLUSTER_SHAPE_4x4x1 = 10, + CUBLASLT_CLUSTER_SHAPE_8x1x1 = 11, + CUBLASLT_CLUSTER_SHAPE_1x8x1 = 12, + CUBLASLT_CLUSTER_SHAPE_8x2x1 = 13, + CUBLASLT_CLUSTER_SHAPE_2x8x1 = 14, + CUBLASLT_CLUSTER_SHAPE_16x1x1 = 15, + CUBLASLT_CLUSTER_SHAPE_1x16x1 = 16, + CUBLASLT_CLUSTER_SHAPE_3x1x1 = 17, + CUBLASLT_CLUSTER_SHAPE_5x1x1 = 18, + CUBLASLT_CLUSTER_SHAPE_6x1x1 = 19, + CUBLASLT_CLUSTER_SHAPE_7x1x1 = 20, + CUBLASLT_CLUSTER_SHAPE_9x1x1 = 21, + CUBLASLT_CLUSTER_SHAPE_10x1x1 = 22, + CUBLASLT_CLUSTER_SHAPE_11x1x1 = 23, + CUBLASLT_CLUSTER_SHAPE_12x1x1 = 24, + CUBLASLT_CLUSTER_SHAPE_13x1x1 = 25, + CUBLASLT_CLUSTER_SHAPE_14x1x1 = 26, + CUBLASLT_CLUSTER_SHAPE_15x1x1 = 27, + CUBLASLT_CLUSTER_SHAPE_3x2x1 = 28, + CUBLASLT_CLUSTER_SHAPE_5x2x1 = 29, + CUBLASLT_CLUSTER_SHAPE_6x2x1 = 30, + CUBLASLT_CLUSTER_SHAPE_7x2x1 = 31, + CUBLASLT_CLUSTER_SHAPE_1x3x1 = 32, + CUBLASLT_CLUSTER_SHAPE_2x3x1 = 33, + CUBLASLT_CLUSTER_SHAPE_3x3x1 = 34, + CUBLASLT_CLUSTER_SHAPE_4x3x1 = 35, + CUBLASLT_CLUSTER_SHAPE_5x3x1 = 36, + CUBLASLT_CLUSTER_SHAPE_3x4x1 = 37, + CUBLASLT_CLUSTER_SHAPE_1x5x1 = 38, + CUBLASLT_CLUSTER_SHAPE_2x5x1 = 39, + CUBLASLT_CLUSTER_SHAPE_3x5x1 = 40, + CUBLASLT_CLUSTER_SHAPE_1x6x1 = 41, + CUBLASLT_CLUSTER_SHAPE_2x6x1 = 42, + CUBLASLT_CLUSTER_SHAPE_1x7x1 = 43, + CUBLASLT_CLUSTER_SHAPE_2x7x1 = 44, + CUBLASLT_CLUSTER_SHAPE_1x9x1 = 45, + CUBLASLT_CLUSTER_SHAPE_1x10x1 = 46, + CUBLASLT_CLUSTER_SHAPE_1x11x1 = 47, + CUBLASLT_CLUSTER_SHAPE_1x12x1 = 48, + CUBLASLT_CLUSTER_SHAPE_1x13x1 = 49, + CUBLASLT_CLUSTER_SHAPE_1x14x1 = 50, + CUBLASLT_CLUSTER_SHAPE_1x15x1 = 51, + CUBLASLT_CLUSTER_SHAPE_END +} cublasLtClusterShape_t; + +/** Inner size of the kernel + * + * Represents various aspects of internal kernel design, that don't impact CUDA grid size but may have other more subtle + * effects. + * + */ +typedef enum { + CUBLASLT_MATMUL_INNER_SHAPE_UNDEFINED = 0, + CUBLASLT_MATMUL_INNER_SHAPE_MMA884 = 1, + CUBLASLT_MATMUL_INNER_SHAPE_MMA1684 = 2, + CUBLASLT_MATMUL_INNER_SHAPE_MMA1688 = 3, + CUBLASLT_MATMUL_INNER_SHAPE_MMA16816 = 4, + CUBLASLT_MATMUL_INNER_SHAPE_END +} cublasLtMatmulInnerShape_t; + +/** Pointer mode to use for alpha/beta */ +typedef enum { + /** matches CUBLAS_POINTER_MODE_HOST, pointer targets a single value host memory */ + CUBLASLT_POINTER_MODE_HOST = CUBLAS_POINTER_MODE_HOST, + /** matches CUBLAS_POINTER_MODE_DEVICE, pointer targets a single value device memory */ + CUBLASLT_POINTER_MODE_DEVICE = CUBLAS_POINTER_MODE_DEVICE, + /** pointer targets an array in device memory */ + CUBLASLT_POINTER_MODE_DEVICE_VECTOR = 2, + /** alpha pointer targets an array in device memory, beta is zero. Note: + CUBLASLT_MATMUL_DESC_ALPHA_VECTOR_BATCH_STRIDE is not supported, must be 0. */ + CUBLASLT_POINTER_MODE_ALPHA_DEVICE_VECTOR_BETA_ZERO = 3, + /** alpha pointer targets an array in device memory, beta is a single value in host memory. */ + CUBLASLT_POINTER_MODE_ALPHA_DEVICE_VECTOR_BETA_HOST = 4, +} cublasLtPointerMode_t; + +/** Mask to define pointer mode capability */ +typedef enum { + /** see CUBLASLT_POINTER_MODE_HOST */ + CUBLASLT_POINTER_MODE_MASK_HOST = 1, + /** see CUBLASLT_POINTER_MODE_DEVICE */ + CUBLASLT_POINTER_MODE_MASK_DEVICE = 2, + /** see CUBLASLT_POINTER_MODE_DEVICE_VECTOR */ + CUBLASLT_POINTER_MODE_MASK_DEVICE_VECTOR = 4, + /** see CUBLASLT_POINTER_MODE_ALPHA_DEVICE_VECTOR_BETA_ZERO */ + CUBLASLT_POINTER_MODE_MASK_ALPHA_DEVICE_VECTOR_BETA_ZERO = 8, + /** see CUBLASLT_POINTER_MODE_ALPHA_DEVICE_VECTOR_BETA_HOST */ + CUBLASLT_POINTER_MODE_MASK_ALPHA_DEVICE_VECTOR_BETA_HOST = 16, +} cublasLtPointerModeMask_t; + +/** Implementation details that may affect numerical behavior of algorithms. */ +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_FMA (0x01ull << 0) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_HMMA (0x02ull << 0) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_IMMA (0x04ull << 0) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_DMMA (0x08ull << 0) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_TENSOR_OP_MASK (0xfeull << 0) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_OP_TYPE_MASK (0xffull << 0) + +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_ACCUMULATOR_16F (0x01ull << 8) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_ACCUMULATOR_32F (0x02ull << 8) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_ACCUMULATOR_64F (0x04ull << 8) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_ACCUMULATOR_32I (0x08ull << 8) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_ACCUMULATOR_TYPE_MASK (0xffull << 8) + +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_INPUT_16F (0x01ull << 16) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_INPUT_16BF (0x02ull << 16) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_INPUT_TF32 (0x04ull << 16) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_INPUT_32F (0x08ull << 16) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_INPUT_64F (0x10ull << 16) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_INPUT_8I (0x20ull << 16) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_INPUT_8F_E4M3 (0x40ull << 16) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_INPUT_8F_E5M2 (0x80ull << 16) +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_OP_INPUT_TYPE_MASK (0xffull << 16) + +#define CUBLASLT_NUMERICAL_IMPL_FLAGS_GAUSSIAN (0x01ull << 32) +typedef uint64_t cublasLtNumericalImplFlags_t; + +/** Execute matrix multiplication (D = alpha * op(A) * op(B) + beta * C). + * + * \retval CUBLAS_STATUS_NOT_INITIALIZED if cuBLASLt handle has not been initialized + * \retval CUBLAS_STATUS_INVALID_VALUE if parameters are in conflict or in an impossible configuration; e.g. + * when workspaceSizeInBytes is less than workspace required by configured + * algo + * \retval CUBLAS_STATUS_NOT_SUPPORTED if current implementation on selected device doesn't support configured + * operation + * \retval CUBLAS_STATUS_ARCH_MISMATCH if configured operation cannot be run using selected device + * \retval CUBLAS_STATUS_EXECUTION_FAILED if cuda reported execution error from the device + * \retval CUBLAS_STATUS_SUCCESS if the operation completed successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmul(cublasLtHandle_t lightHandle, + cublasLtMatmulDesc_t computeDesc, + const void* alpha, /* host or device pointer */ + const void* A, + cublasLtMatrixLayout_t Adesc, + const void* B, + cublasLtMatrixLayout_t Bdesc, + const void* beta, /* host or device pointer */ + const void* C, + cublasLtMatrixLayout_t Cdesc, + void* D, + cublasLtMatrixLayout_t Ddesc, + const cublasLtMatmulAlgo_t* algo, + void* workspace, + size_t workspaceSizeInBytes, + cudaStream_t stream); + +/** Matrix layout conversion helper (C = alpha * op(A) + beta * op(B)) + * + * Can be used to change memory order of data or to scale and shift the values. + * + * \retval CUBLAS_STATUS_NOT_INITIALIZED if cuBLASLt handle has not been initialized + * \retval CUBLAS_STATUS_INVALID_VALUE if parameters are in conflict or in an impossible configuration; e.g. + * when A is not NULL, but Adesc is NULL + * \retval CUBLAS_STATUS_NOT_SUPPORTED if current implementation on selected device doesn't support configured + * operation + * \retval CUBLAS_STATUS_ARCH_MISMATCH if configured operation cannot be run using selected device + * \retval CUBLAS_STATUS_EXECUTION_FAILED if cuda reported execution error from the device + * \retval CUBLAS_STATUS_SUCCESS if the operation completed successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixTransform(cublasLtHandle_t lightHandle, + cublasLtMatrixTransformDesc_t transformDesc, + const void* alpha, /* host or device pointer */ + const void* A, + cublasLtMatrixLayout_t Adesc, + const void* beta, /* host or device pointer */ + const void* B, + cublasLtMatrixLayout_t Bdesc, + void* C, + cublasLtMatrixLayout_t Cdesc, + cudaStream_t stream); + +/* ---------------------------------------------------------------------------------------*/ +/* Helper functions for cublasLtMatrixLayout_t */ +/* ---------------------------------------------------------------------------------------*/ + +/** Enum for data ordering */ +typedef enum { + /** Column-major + * + * Leading dimension is the stride (in elements) to the beginning of next column in memory. + */ + CUBLASLT_ORDER_COL = 0, + /** Row major + * + * Leading dimension is the stride (in elements) to the beginning of next row in memory. + */ + CUBLASLT_ORDER_ROW = 1, + /** Column-major ordered tiles of 32 columns. + * + * Leading dimension is the stride (in elements) to the beginning of next group of 32-columns. E.g. if matrix has 33 + * columns and 2 rows, ld must be at least (32) * 2 = 64. + */ + CUBLASLT_ORDER_COL32 = 2, + /** Column-major ordered tiles of composite tiles with total 32 columns and 8 rows, tile composed of interleaved + * inner tiles of 4 columns within 4 even or odd rows in an alternating pattern. + * + * Leading dimension is the stride (in elements) to the beginning of the first 32 column x 8 row tile for the next + * 32-wide group of columns. E.g. if matrix has 33 columns and 1 row, ld must be at least (32 * 8) * 1 = 256. + */ + CUBLASLT_ORDER_COL4_4R2_8C = 3, + /** Column-major ordered tiles of composite tiles with total 32 columns ands 32 rows. + * Element offset within the tile is calculated as (((row%8)/2*4+row/8)*2+row%2)*32+col. + * + * Leading dimension is the stride (in elements) to the beginning of the first 32 column x 32 row tile for the next + * 32-wide group of columns. E.g. if matrix has 33 columns and 1 row, ld must be at least (32*32)*1 = 1024. + */ + CUBLASLT_ORDER_COL32_2R_4R4 = 4, + +} cublasLtOrder_t; + +/** Attributes of memory layout */ +typedef enum { + /** Data type, see cudaDataType. + * + * uint32_t + */ + CUBLASLT_MATRIX_LAYOUT_TYPE = 0, + + /** Memory order of the data, see cublasLtOrder_t. + * + * int32_t, default: CUBLASLT_ORDER_COL + */ + CUBLASLT_MATRIX_LAYOUT_ORDER = 1, + + /** Number of rows. + * + * Usually only values that can be expressed as int32_t are supported. + * + * uint64_t + */ + CUBLASLT_MATRIX_LAYOUT_ROWS = 2, + + /** Number of columns. + * + * Usually only values that can be expressed as int32_t are supported. + * + * uint64_t + */ + CUBLASLT_MATRIX_LAYOUT_COLS = 3, + + /** Matrix leading dimension. + * + * For CUBLASLT_ORDER_COL this is stride (in elements) of matrix column, for more details and documentation for + * other memory orders see documentation for cublasLtOrder_t values. + * + * Currently only non-negative values are supported, must be large enough so that matrix memory locations are not + * overlapping (e.g. greater or equal to CUBLASLT_MATRIX_LAYOUT_ROWS in case of CUBLASLT_ORDER_COL). + * + * int64_t; + */ + CUBLASLT_MATRIX_LAYOUT_LD = 4, + + /** Number of matmul operations to perform in the batch. + * + * See also CUBLASLT_ALGO_CAP_STRIDED_BATCH_SUPPORT + * + * int32_t, default: 1 + */ + CUBLASLT_MATRIX_LAYOUT_BATCH_COUNT = 5, + + /** Stride (in elements) to the next matrix for strided batch operation. + * + * When matrix type is planar-complex (CUBLASLT_MATRIX_LAYOUT_PLANE_OFFSET != 0), batch stride + * is interpreted by cublasLtMatmul() in number of real valued sub-elements. E.g. for data of type CUDA_C_16F, + * offset of 1024B is encoded as a stride of value 512 (since each element of the real and imaginary matrices + * is a 2B (16bit) floating point type). + * + * NOTE: A bug in cublasLtMatrixTransform() causes it to interpret the batch stride for a planar-complex matrix + * as if it was specified in number of complex elements. Therefore an offset of 1024B must be encoded as stride + * value 256 when calling cublasLtMatrixTransform() (each complex element is 4B with real and imaginary values 2B + * each). This behavior is expected to be corrected in the next major cuBLAS version. + * + * int64_t, default: 0 + */ + CUBLASLT_MATRIX_LAYOUT_STRIDED_BATCH_OFFSET = 6, + + /** Stride (in bytes) to the imaginary plane for planar complex layout. + * + * int64_t, default: 0 - 0 means that layout is regular (real and imaginary parts of complex numbers are interleaved + * in memory in each element) + */ + CUBLASLT_MATRIX_LAYOUT_PLANE_OFFSET = 7, +} cublasLtMatrixLayoutAttribute_t; + +/** Internal. Do not use directly. + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixLayoutInit_internal( // + cublasLtMatrixLayout_t matLayout, + size_t size, + cudaDataType type, + uint64_t rows, + uint64_t cols, + int64_t ld); + +/** Initialize matrix layout descriptor in pre-allocated space. + * + * \retval CUBLAS_STATUS_ALLOC_FAILED if size of the pre-allocated space is insufficient + * \retval CUBLAS_STATUS_SUCCESS if desciptor was created successfully + */ +static inline cublasStatus_t cublasLtMatrixLayoutInit( + cublasLtMatrixLayout_t matLayout, cudaDataType type, uint64_t rows, uint64_t cols, int64_t ld) { + return cublasLtMatrixLayoutInit_internal(matLayout, sizeof(*matLayout), type, rows, cols, ld); +} + +/** Create new matrix layout descriptor. + * + * \retval CUBLAS_STATUS_ALLOC_FAILED if memory could not be allocated + * \retval CUBLAS_STATUS_SUCCESS if desciptor was created successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixLayoutCreate( // + cublasLtMatrixLayout_t* matLayout, + cudaDataType type, + uint64_t rows, + uint64_t cols, + int64_t ld); + +/** Destroy matrix layout descriptor. + * + * \retval CUBLAS_STATUS_SUCCESS if operation was successful + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixLayoutDestroy(cublasLtMatrixLayout_t matLayout); + +/** Set matrix layout descriptor attribute. + * + * \param[in] matLayout The descriptor + * \param[in] attr The attribute + * \param[in] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * + * \retval CUBLAS_STATUS_INVALID_VALUE if buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute was set successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixLayoutSetAttribute( // + cublasLtMatrixLayout_t matLayout, + cublasLtMatrixLayoutAttribute_t attr, + const void* buf, + size_t sizeInBytes); + +/** Get matrix layout descriptor attribute. + * + * \param[in] matLayout The descriptor + * \param[in] attr The attribute + * \param[out] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * \param[out] sizeWritten only valid when return value is CUBLAS_STATUS_SUCCESS. If sizeInBytes is non-zero: number of + * bytes actually written, if sizeInBytes is 0: number of bytes needed to write full contents + * + * \retval CUBLAS_STATUS_INVALID_VALUE if sizeInBytes is 0 and sizeWritten is NULL, or if sizeInBytes is non-zero + * and buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute's value was successfully written to user memory + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixLayoutGetAttribute( // + cublasLtMatrixLayout_t matLayout, + cublasLtMatrixLayoutAttribute_t attr, + void* buf, + size_t sizeInBytes, + size_t* sizeWritten); + +/* ---------------------------------------------------------------------------------------*/ +/* Helper functions for cublasLtMatmulDesc_t */ +/* ---------------------------------------------------------------------------------------*/ + +/** Matmul descriptor attributes to define details of the operation. */ +typedef enum { + /** Compute type, see cudaDataType. Defines data type used for multiply and accumulate operations and the + * accumulator during matrix multiplication. + * + * int32_t + */ + CUBLASLT_MATMUL_DESC_COMPUTE_TYPE = 0, + + /** Scale type, see cudaDataType. Defines data type of alpha and beta. Accumulator and value from matrix C are + * typically converted to scale type before final scaling. Value is then converted from scale type to type of matrix + * D before being stored in memory. + * + * int32_t, default: same as CUBLASLT_MATMUL_DESC_COMPUTE_TYPE + */ + CUBLASLT_MATMUL_DESC_SCALE_TYPE = 1, + + /** Pointer mode of alpha and beta, see cublasLtPointerMode_t. When CUBLASLT_POINTER_MODE_DEVICE_VECTOR is in use, + * alpha/beta vector lenghts must match number of output matrix rows. + * + * int32_t, default: CUBLASLT_POINTER_MODE_HOST + */ + CUBLASLT_MATMUL_DESC_POINTER_MODE = 2, + + /** Transform of matrix A, see cublasOperation_t. + * + * int32_t, default: CUBLAS_OP_N + */ + CUBLASLT_MATMUL_DESC_TRANSA = 3, + + /** Transform of matrix B, see cublasOperation_t. + * + * int32_t, default: CUBLAS_OP_N + */ + CUBLASLT_MATMUL_DESC_TRANSB = 4, + + /** Transform of matrix C, see cublasOperation_t. + * + * Currently only CUBLAS_OP_N is supported. + * + * int32_t, default: CUBLAS_OP_N + */ + CUBLASLT_MATMUL_DESC_TRANSC = 5, + + /** Matrix fill mode, see cublasFillMode_t. + * + * int32_t, default: CUBLAS_FILL_MODE_FULL + */ + CUBLASLT_MATMUL_DESC_FILL_MODE = 6, + + /** Epilogue function, see cublasLtEpilogue_t. + * + * uint32_t, default: CUBLASLT_EPILOGUE_DEFAULT + */ + CUBLASLT_MATMUL_DESC_EPILOGUE = 7, + + /** Bias or bias gradient vector pointer in the device memory. + * + * Bias case. See CUBLASLT_EPILOGUE_BIAS. + * For bias data type see CUBLASLT_MATMUL_DESC_BIAS_DATA_TYPE. + * + * Bias vector length must match matrix D rows count. + * + * Bias gradient case. See CUBLASLT_EPILOGUE_DRELU_BGRAD and CUBLASLT_EPILOGUE_DGELU_BGRAD. + * Bias gradient vector elements are the same type as the output elements + * (Ctype) with the exception of IMMA kernels (see above). + * + * Routines that don't dereference this pointer, like cublasLtMatmulAlgoGetHeuristic() + * depend on its value to determine expected pointer alignment. + * + * Bias case: const void *, default: NULL + * Bias gradient case: void *, default: NULL + */ + CUBLASLT_MATMUL_DESC_BIAS_POINTER = 8, + + /** Batch stride for bias or bias gradient vector. + * + * Used together with CUBLASLT_MATMUL_DESC_BIAS_POINTER when matrix D's CUBLASLT_MATRIX_LAYOUT_BATCH_COUNT > 1. + * + * int64_t, default: 0 + */ + CUBLASLT_MATMUL_DESC_BIAS_BATCH_STRIDE = 10, + + /** Pointer for epilogue auxiliary buffer. + * + * - Output vector for ReLu bit-mask in forward pass when CUBLASLT_EPILOGUE_RELU_AUX + * or CUBLASLT_EPILOGUE_RELU_AUX_BIAS epilogue is used. + * - Input vector for ReLu bit-mask in backward pass when + * CUBLASLT_EPILOGUE_DRELU_BGRAD epilogue is used. + * + * - Output of GELU input matrix in forward pass when + * CUBLASLT_EPILOGUE_GELU_AUX_BIAS epilogue is used. + * - Input of GELU input matrix for backward pass when + * CUBLASLT_EPILOGUE_DGELU_BGRAD epilogue is used. + * + * For aux data type see CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_DATA_TYPE. + * + * Routines that don't dereference this pointer, like cublasLtMatmulAlgoGetHeuristic() + * depend on its value to determine expected pointer alignment. + * + * Requires setting CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_LD attribute. + * + * Forward pass: void *, default: NULL + * Backward pass: const void *, default: NULL + */ + CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER = 11, + + /** Leading dimension for epilogue auxiliary buffer. + * + * - ReLu bit-mask matrix leading dimension in elements (i.e. bits) + * when CUBLASLT_EPILOGUE_RELU_AUX, CUBLASLT_EPILOGUE_RELU_AUX_BIAS or CUBLASLT_EPILOGUE_DRELU_BGRAD epilogue is + * used. Must be divisible by 128 and be no less than the number of rows in the output matrix. + * + * - GELU input matrix leading dimension in elements + * when CUBLASLT_EPILOGUE_GELU_AUX_BIAS or CUBLASLT_EPILOGUE_DGELU_BGRAD epilogue used. + * Must be divisible by 8 and be no less than the number of rows in the output matrix. + * + * int64_t, default: 0 + */ + CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_LD = 12, + + /** Batch stride for epilogue auxiliary buffer. + * + * - ReLu bit-mask matrix batch stride in elements (i.e. bits) + * when CUBLASLT_EPILOGUE_RELU_AUX, CUBLASLT_EPILOGUE_RELU_AUX_BIAS or CUBLASLT_EPILOGUE_DRELU_BGRAD epilogue is + * used. Must be divisible by 128. + * + * - GELU input matrix batch stride in elements + * when CUBLASLT_EPILOGUE_GELU_AUX_BIAS or CUBLASLT_EPILOGUE_DGELU_BGRAD epilogue used. + * Must be divisible by 8. + * + * int64_t, default: 0 + */ + CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_BATCH_STRIDE = 13, + + /** Batch stride for alpha vector. + * + * Used together with CUBLASLT_POINTER_MODE_ALPHA_DEVICE_VECTOR_BETA_HOST when matrix D's + * CUBLASLT_MATRIX_LAYOUT_BATCH_COUNT > 1. If CUBLASLT_POINTER_MODE_ALPHA_DEVICE_VECTOR_BETA_ZERO is set then + * CUBLASLT_MATMUL_DESC_ALPHA_VECTOR_BATCH_STRIDE must be set to 0 as this mode doesnt supported batched alpha vector. + * + * int64_t, default: 0 + */ + CUBLASLT_MATMUL_DESC_ALPHA_VECTOR_BATCH_STRIDE = 14, + + /** Number of SMs to target for parallel execution. Optimizes heuristics for execution on a different number of SMs + * when user expects a concurrent stream to be using some of the device resources. + * + * int32_t, default: 0 - use the number reported by the device. + */ + CUBLASLT_MATMUL_DESC_SM_COUNT_TARGET = 15, + + /** Device pointer to the scale factor value that converts data in matrix A to the compute data type range. + * + * The scaling factor value must have the same type as the compute type. + * + * If not specified, or set to NULL, the scaling factor is assumed to be 1. + * + * If set for an unsupported matrix data, scale, and compute type combination, calling cublasLtMatmul() + * will return CUBLAS_INVALID_VALUE. + * + * const void *, default: NULL + */ + CUBLASLT_MATMUL_DESC_A_SCALE_POINTER = 17, + + /** Device pointer to the scale factor value to convert data in matrix B to compute data type range. + * + * The scaling factor value must have the same type as the compute type. + * + * If not specified, or set to NULL, the scaling factor is assumed to be 1. + * + * If set for an unsupported matrix data, scale, and compute type combination, calling cublasLtMatmul() + * will return CUBLAS_INVALID_VALUE. + * + * const void *, default: NULL + */ + CUBLASLT_MATMUL_DESC_B_SCALE_POINTER = 18, + + /** Device pointer to the scale factor value to convert data in matrix C to compute data type range. + * + * The scaling factor value must have the same type as the compute type. + * + * If not specified, or set to NULL, the scaling factor is assumed to be 1. + * + * If set for an unsupported matrix data, scale, and compute type combination, calling cublasLtMatmul() + * will return CUBLAS_INVALID_VALUE. + * + * const void *, default: NULL + */ + CUBLASLT_MATMUL_DESC_C_SCALE_POINTER = 19, + + /** Device pointer to the scale factor value to convert data in matrix D to compute data type range. + * + * The scaling factor value must have the same type as the compute type. + * + * If not specified, or set to NULL, the scaling factor is assumed to be 1. + * + * If set for an unsupported matrix data, scale, and compute type combination, calling cublasLtMatmul() + * will return CUBLAS_INVALID_VALUE. + * + * const void *, default: NULL + */ + CUBLASLT_MATMUL_DESC_D_SCALE_POINTER = 20, + + /** Device pointer to the memory location that on completion will be set to the maximum of absolute values in the + * output matrix. + * + * The computed value has the same type as the compute type. + * + * If not specified or set to NULL, the maximum absolute value is not computed. If set for an unsupported matrix + * data, scale, and compute type combination, calling cublasLtMatmul() will return CUBLAS_INVALID_VALUE. + * + * void *, default: NULL + */ + CUBLASLT_MATMUL_DESC_AMAX_D_POINTER = 21, + + /** Type of the data to be stored to the memory pointed to by CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + * + * If unset, the data type defaults to the type of elements of the output matrix with some exceptions, see details + * below. + * + * ReLu uses a bit-mask. + * + * GELU input matrix elements type is the same as the type of elements of + * the output matrix with some exceptions, see details below. + * + * For fp8 kernels with output type CUDA_R_8F_E4M3 the aux data type can be CUDA_R_8F_E4M3 or CUDA_R_16F with some + * restrictions. See https://docs.nvidia.com/cuda/cublas/index.html#cublasLtMatmulDescAttributes_t for more details. + * + * If set for an unsupported matrix data, scale, and compute type combination, calling cublasLtMatmul() + * will return CUBLAS_INVALID_VALUE. + * + * int32_t based on cudaDataType, default: -1 + */ + CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_DATA_TYPE = 22, + + /** Device pointer to the scaling factor value to convert results from compute type data range to storage + * data range in the auxiliary matrix that is set via CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + * + * The scaling factor value must have the same type as the compute type. + * + * If not specified, or set to NULL, the scaling factor is assumed to be 1. If set for an unsupported matrix data, + * scale, and compute type combination, calling cublasLtMatmul() will return CUBLAS_INVALID_VALUE. + * + * void *, default: NULL + */ + CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_SCALE_POINTER = 23, + + /** Device pointer to the memory location that on completion will be set to the maximum of absolute values in the + * buffer that is set via CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + * + * The computed value has the same type as the compute type. + * + * If not specified or set to NULL, the maximum absolute value is not computed. If set for an unsupported matrix + * data, scale, and compute type combination, calling cublasLtMatmul() will return CUBLAS_INVALID_VALUE. + * + * void *, default: NULL + */ + CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_AMAX_POINTER = 24, + + /** Flag for managing fp8 fast accumulation mode. + * When enabled, problem execution might be faster but at the cost of lower accuracy because intermediate results + * will not periodically be promoted to a higher precision. + * + * int8_t, default: 0 - fast accumulation mode is disabled. + */ + CUBLASLT_MATMUL_DESC_FAST_ACCUM = 25, + + /** Type of bias or bias gradient vector in the device memory. + * + * Bias case: see CUBLASLT_EPILOGUE_BIAS. + * + * Bias vector elements are the same type as the elements of output matrix (Dtype) with the following exceptions: + * - IMMA kernels with computeType=CUDA_R_32I and Ctype=CUDA_R_8I where the bias vector elements + * are the same type as alpha, beta (CUBLASLT_MATMUL_DESC_SCALE_TYPE=CUDA_R_32F) + * - fp8 kernels with an output type of CUDA_R_32F, CUDA_R_8F_E4M3 or CUDA_R_8F_E5M2, See + * https://docs.nvidia.com/cuda/cublas/index.html#cublasLtMatmul for details. + * + * int32_t based on cudaDataType, default: -1 + */ + CUBLASLT_MATMUL_DESC_BIAS_DATA_TYPE = 26, + + /** EXPERIMENTAL: Number of atomic synchronization chunks in the row dimension of the output matrix D. + * + * int32_t, default 0 (atomic synchronization disabled) + */ + CUBLASLT_MATMUL_DESC_ATOMIC_SYNC_NUM_CHUNKS_D_ROWS = 27, + + /** EXPERIMENTAL: Number of atomic synchronization chunks in the column dimension of the output matrix D. + * + * int32_t, default 0 (atomic synchronization disabled) + */ + CUBLASLT_MATMUL_DESC_ATOMIC_SYNC_NUM_CHUNKS_D_COLS = 28, + + /** EXPERIMENTAL: Pointer to a device array of input atomic counters consumed by a matmul. + * + * int32_t *, default: NULL + * */ + CUBLASLT_MATMUL_DESC_ATOMIC_SYNC_IN_COUNTERS_POINTER = 29, + + /** EXPERIMENTAL: Pointer to a device array of output atomic counters produced by a matmul. + * + * int32_t *, default: NULL + * */ + CUBLASLT_MATMUL_DESC_ATOMIC_SYNC_OUT_COUNTERS_POINTER = 30, +} cublasLtMatmulDescAttributes_t; + +/** Internal. Do not use directly. + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulDescInit_internal( // + cublasLtMatmulDesc_t matmulDesc, + size_t size, + cublasComputeType_t computeType, + cudaDataType_t scaleType); + +/** Initialize matmul operation descriptor in pre-allocated space. + * + * \retval CUBLAS_STATUS_ALLOC_FAILED if size of the pre-allocated space is insufficient + * \retval CUBLAS_STATUS_SUCCESS if desciptor was initialized successfully + */ +static inline cublasStatus_t cublasLtMatmulDescInit( // + cublasLtMatmulDesc_t matmulDesc, + cublasComputeType_t computeType, + cudaDataType_t scaleType) { + return cublasLtMatmulDescInit_internal(matmulDesc, sizeof(*matmulDesc), computeType, scaleType); +} + +/** Create new matmul operation descriptor. + * + * \retval CUBLAS_STATUS_ALLOC_FAILED if memory could not be allocated + * \retval CUBLAS_STATUS_SUCCESS if desciptor was created successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulDescCreate(cublasLtMatmulDesc_t* matmulDesc, + cublasComputeType_t computeType, + cudaDataType_t scaleType); + +/** Destroy matmul operation descriptor. + * + * \retval CUBLAS_STATUS_SUCCESS if operation was successful + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulDescDestroy(cublasLtMatmulDesc_t matmulDesc); + +/** Set matmul operation descriptor attribute. + * + * \param[in] matmulDesc The descriptor + * \param[in] attr The attribute + * \param[in] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * + * \retval CUBLAS_STATUS_INVALID_VALUE if buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute was set successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulDescSetAttribute( // + cublasLtMatmulDesc_t matmulDesc, + cublasLtMatmulDescAttributes_t attr, + const void* buf, + size_t sizeInBytes); + +/** Get matmul operation descriptor attribute. + * + * \param[in] matmulDesc The descriptor + * \param[in] attr The attribute + * \param[out] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * \param[out] sizeWritten only valid when return value is CUBLAS_STATUS_SUCCESS. If sizeInBytes is non-zero: number of + * bytes actually written, if sizeInBytes is 0: number of bytes needed to write full contents + * + * \retval CUBLAS_STATUS_INVALID_VALUE if sizeInBytes is 0 and sizeWritten is NULL, or if sizeInBytes is non-zero + * and buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute's value was successfully written to user memory + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulDescGetAttribute( // + cublasLtMatmulDesc_t matmulDesc, + cublasLtMatmulDescAttributes_t attr, + void* buf, + size_t sizeInBytes, + size_t* sizeWritten); + +/* ---------------------------------------------------------------------------------------*/ +/* Helper functions for cublasLtMatrixTransformDesc_t */ +/* ---------------------------------------------------------------------------------------*/ + +/** Matrix transform descriptor attributes to define details of the operation. + */ +typedef enum { + /** Scale type, see cudaDataType. Inputs are converted to scale type for scaling and summation and results are then + * converted to output type to store in memory. + * + * int32_t + */ + CUBLASLT_MATRIX_TRANSFORM_DESC_SCALE_TYPE, + + /** Pointer mode of alpha and beta, see cublasLtPointerMode_t. + * + * int32_t, default: CUBLASLT_POINTER_MODE_HOST + */ + CUBLASLT_MATRIX_TRANSFORM_DESC_POINTER_MODE, + + /** Transform of matrix A, see cublasOperation_t. + * + * int32_t, default: CUBLAS_OP_N + */ + CUBLASLT_MATRIX_TRANSFORM_DESC_TRANSA, + + /** Transform of matrix B, see cublasOperation_t. + * + * int32_t, default: CUBLAS_OP_N + */ + CUBLASLT_MATRIX_TRANSFORM_DESC_TRANSB, +} cublasLtMatrixTransformDescAttributes_t; + +/** Internal. Do not use directly. + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixTransformDescInit_internal(cublasLtMatrixTransformDesc_t transformDesc, + size_t size, + cudaDataType scaleType); + +/** Initialize matrix transform operation descriptor in pre-allocated space. + * + * \retval CUBLAS_STATUS_ALLOC_FAILED if size of the pre-allocated space is insufficient + * \retval CUBLAS_STATUS_SUCCESS if desciptor was created successfully + */ +static inline cublasStatus_t cublasLtMatrixTransformDescInit(cublasLtMatrixTransformDesc_t transformDesc, + cudaDataType scaleType) { + return cublasLtMatrixTransformDescInit_internal(transformDesc, sizeof(*transformDesc), scaleType); +} + +/** Create new matrix transform operation descriptor. + * + * \retval CUBLAS_STATUS_ALLOC_FAILED if memory could not be allocated + * \retval CUBLAS_STATUS_SUCCESS if desciptor was created successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixTransformDescCreate(cublasLtMatrixTransformDesc_t* transformDesc, + cudaDataType scaleType); + +/** Destroy matrix transform operation descriptor. + * + * \retval CUBLAS_STATUS_SUCCESS if operation was successful + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixTransformDescDestroy(cublasLtMatrixTransformDesc_t transformDesc); + +/** Set matrix transform operation descriptor attribute. + * + * \param[in] transformDesc The descriptor + * \param[in] attr The attribute + * \param[in] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * + * \retval CUBLAS_STATUS_INVALID_VALUE if buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute was set successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixTransformDescSetAttribute( // + cublasLtMatrixTransformDesc_t transformDesc, + cublasLtMatrixTransformDescAttributes_t attr, + const void* buf, + size_t sizeInBytes); + +/** Get matrix transform operation descriptor attribute. + * + * \param[in] transformDesc The descriptor + * \param[in] attr The attribute + * \param[out] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * \param[out] sizeWritten only valid when return value is CUBLAS_STATUS_SUCCESS. If sizeInBytes is non-zero: number + * of bytes actually written, if sizeInBytes is 0: number of bytes needed to write full contents + * + * \retval CUBLAS_STATUS_INVALID_VALUE if sizeInBytes is 0 and sizeWritten is NULL, or if sizeInBytes is non-zero + * and buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute's value was successfully written to user memory + */ +cublasStatus_t CUBLASWINAPI cublasLtMatrixTransformDescGetAttribute( // + cublasLtMatrixTransformDesc_t transformDesc, + cublasLtMatrixTransformDescAttributes_t attr, + void* buf, + size_t sizeInBytes, + size_t* sizeWritten); + +/** Reduction scheme for portions of the dot-product calculated in parallel (a. k. a. "split - K"). + */ +typedef enum { + /** No reduction scheme, dot-product shall be performed in one sequence. + */ + CUBLASLT_REDUCTION_SCHEME_NONE = 0, + + /** Reduction is performed "in place" - using the output buffer (and output data type) and counters (in workspace) to + * guarantee the sequentiality. + */ + CUBLASLT_REDUCTION_SCHEME_INPLACE = 1, + + /** Intermediate results are stored in compute type in the workspace and reduced in a separate step. + */ + CUBLASLT_REDUCTION_SCHEME_COMPUTE_TYPE = 2, + + /** Intermediate results are stored in output type in the workspace and reduced in a separate step. + */ + CUBLASLT_REDUCTION_SCHEME_OUTPUT_TYPE = 4, + + CUBLASLT_REDUCTION_SCHEME_MASK = 0x7, +} cublasLtReductionScheme_t; + +/** Postprocessing options for the epilogue + */ +typedef enum { + /** No special postprocessing, just scale and quantize results if necessary. + */ + CUBLASLT_EPILOGUE_DEFAULT = 1, + + /** ReLu, apply ReLu point-wise transform to the results (x:=max(x, 0)). + */ + CUBLASLT_EPILOGUE_RELU = 2, + + /** ReLu, apply ReLu point-wise transform to the results (x:=max(x, 0)). + * + * This epilogue mode produces an extra output, a ReLu bit-mask matrix, + * see CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + */ + CUBLASLT_EPILOGUE_RELU_AUX = (CUBLASLT_EPILOGUE_RELU | 128), + + /** Bias, apply (broadcasted) Bias from bias vector. Bias vector length must match matrix D rows, it must be packed + * (stride between vector elements is 1). Bias vector is broadcasted to all columns and added before applying final + * postprocessing. + */ + CUBLASLT_EPILOGUE_BIAS = 4, + + /** ReLu and Bias, apply Bias and then ReLu transform + */ + CUBLASLT_EPILOGUE_RELU_BIAS = (CUBLASLT_EPILOGUE_RELU | CUBLASLT_EPILOGUE_BIAS), + + /** ReLu and Bias, apply Bias and then ReLu transform + * + * This epilogue mode produces an extra output, a ReLu bit-mask matrix, + * see CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + */ + CUBLASLT_EPILOGUE_RELU_AUX_BIAS = (CUBLASLT_EPILOGUE_RELU_AUX | CUBLASLT_EPILOGUE_BIAS), + + /* ReLu gradient. Apply ReLu gradient to matmul output. Store ReLu gradient in the output matrix. + * + * This epilogue mode requires an extra input, + * see CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + */ + CUBLASLT_EPILOGUE_DRELU = 8 | 128, + + /* ReLu and Bias gradients. Apply independently ReLu and Bias gradient to + * matmul output. Store ReLu gradient in the output matrix, and Bias gradient + * in the auxiliary output (see CUBLASLT_MATMUL_DESC_BIAS_POINTER). + * + * This epilogue mode requires an extra input, + * see CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + */ + CUBLASLT_EPILOGUE_DRELU_BGRAD = CUBLASLT_EPILOGUE_DRELU | 16, + + /** GELU, apply GELU point-wise transform to the results (x:=GELU(x)). + */ + CUBLASLT_EPILOGUE_GELU = 32, + + /** GELU, apply GELU point-wise transform to the results (x:=GELU(x)). + * + * This epilogue mode outputs GELU input as a separate matrix (useful for training). + * See CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + */ + CUBLASLT_EPILOGUE_GELU_AUX = (CUBLASLT_EPILOGUE_GELU | 128), + + /** GELU and Bias, apply Bias and then GELU transform + */ + CUBLASLT_EPILOGUE_GELU_BIAS = (CUBLASLT_EPILOGUE_GELU | CUBLASLT_EPILOGUE_BIAS), + + /** GELU and Bias, apply Bias and then GELU transform + * + * This epilogue mode outputs GELU input as a separate matrix (useful for training). + * See CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + */ + CUBLASLT_EPILOGUE_GELU_AUX_BIAS = (CUBLASLT_EPILOGUE_GELU_AUX | CUBLASLT_EPILOGUE_BIAS), + + /* GELU gradient. Apply GELU gradient to matmul output. Store GELU gradient in the output matrix. + * + * This epilogue mode requires an extra input, + * see CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + */ + CUBLASLT_EPILOGUE_DGELU = 64 | 128, + + /* GELU and Bias gradients. Apply independently GELU and Bias gradient to + * matmul output. Store GELU gradient in the output matrix, and Bias gradient + * in the auxiliary output (see CUBLASLT_MATMUL_DESC_BIAS_POINTER). + * + * This epilogue mode requires an extra input, + * see CUBLASLT_MATMUL_DESC_EPILOGUE_AUX_POINTER. + */ + CUBLASLT_EPILOGUE_DGELU_BGRAD = CUBLASLT_EPILOGUE_DGELU | 16, + + /** Bias gradient based on the input matrix A. + * + * The bias size corresponds to the number of rows of the matrix D. + * The reduction happens over the GEMM's "k" dimension. + * + * Stores Bias gradient in the auxiliary output + * (see CUBLASLT_MATMUL_DESC_BIAS_POINTER). + */ + CUBLASLT_EPILOGUE_BGRADA = 256, + + /** Bias gradient based on the input matrix B. + * + * The bias size corresponds to the number of columns of the matrix D. + * The reduction happens over the GEMM's "k" dimension. + * + * Stores Bias gradient in the auxiliary output + * (see CUBLASLT_MATMUL_DESC_BIAS_POINTER). + */ + CUBLASLT_EPILOGUE_BGRADB = 512, +} cublasLtEpilogue_t; + +/** Matmul heuristic search mode + */ +typedef enum { + /** ask heuristics for best algo for given usecase + */ + CUBLASLT_SEARCH_BEST_FIT = 0, + /** only try to find best config for preconfigured algo id + */ + CUBLASLT_SEARCH_LIMITED_BY_ALGO_ID = 1, + /** reserved for future use + */ + CUBLASLT_SEARCH_RESERVED_02 = 2, + /** reserved for future use + */ + CUBLASLT_SEARCH_RESERVED_03 = 3, + /** reserved for future use + */ + CUBLASLT_SEARCH_RESERVED_04 = 4, + /** reserved for future use + */ + CUBLASLT_SEARCH_RESERVED_05 = 5, +} cublasLtMatmulSearch_t; + +/** Algo search preference to fine tune the heuristic function. */ +typedef enum { + /** Search mode, see cublasLtMatmulSearch_t. + * + * uint32_t, default: CUBLASLT_SEARCH_BEST_FIT + */ + CUBLASLT_MATMUL_PREF_SEARCH_MODE = 0, + + /** Maximum allowed workspace size in bytes. + * + * uint64_t, default: 0 - no workspace allowed + */ + CUBLASLT_MATMUL_PREF_MAX_WORKSPACE_BYTES = 1, + + /** Reduction scheme mask, see cublasLtReductionScheme_t. Filters heuristic result to only include algo configs that + * use one of the required modes. + * + * E.g. mask value of 0x03 will allow only INPLACE and COMPUTE_TYPE reduction schemes. + * + * uint32_t, default: CUBLASLT_REDUCTION_SCHEME_MASK (allows all reduction schemes) + */ + CUBLASLT_MATMUL_PREF_REDUCTION_SCHEME_MASK = 3, + + /** Minimum buffer alignment for matrix A (in bytes). + * + * Selecting a smaller value will exclude algorithms that can not work with matrix A that is not as strictly aligned + * as they need. + * + * uint32_t, default: 256 + */ + CUBLASLT_MATMUL_PREF_MIN_ALIGNMENT_A_BYTES = 5, + + /** Minimum buffer alignment for matrix B (in bytes). + * + * Selecting a smaller value will exclude algorithms that can not work with matrix B that is not as strictly aligned + * as they need. + * + * uint32_t, default: 256 + */ + CUBLASLT_MATMUL_PREF_MIN_ALIGNMENT_B_BYTES = 6, + + /** Minimum buffer alignment for matrix C (in bytes). + * + * Selecting a smaller value will exclude algorithms that can not work with matrix C that is not as strictly aligned + * as they need. + * + * uint32_t, default: 256 + */ + CUBLASLT_MATMUL_PREF_MIN_ALIGNMENT_C_BYTES = 7, + + /** Minimum buffer alignment for matrix D (in bytes). + * + * Selecting a smaller value will exclude algorithms that can not work with matrix D that is not as strictly aligned + * as they need. + * + * uint32_t, default: 256 + */ + CUBLASLT_MATMUL_PREF_MIN_ALIGNMENT_D_BYTES = 8, + + /** Maximum wave count. + * + * See cublasLtMatmulHeuristicResult_t::wavesCount. + * + * Selecting a non-zero value will exclude algorithms that report device utilization higher than specified. + * + * float, default: 0.0f + */ + CUBLASLT_MATMUL_PREF_MAX_WAVES_COUNT = 9, + + /** Numerical implementation details mask, see cublasLtNumericalImplFlags_t. Filters heuristic result to only include + * algorithms that use the allowed implementations. + * + * uint64_t, default: uint64_t(-1) (allow everything) + */ + CUBLASLT_MATMUL_PREF_IMPL_MASK = 12, +} cublasLtMatmulPreferenceAttributes_t; + +/** Internal. Do not use directly. + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulPreferenceInit_internal(cublasLtMatmulPreference_t pref, size_t size); + +/** Initialize matmul heuristic search preference descriptor in pre-allocated space. + * + * \retval CUBLAS_STATUS_ALLOC_FAILED if size of the pre-allocated space is insufficient + * \retval CUBLAS_STATUS_SUCCESS if desciptor was created successfully + */ +static inline cublasStatus_t cublasLtMatmulPreferenceInit(cublasLtMatmulPreference_t pref) { + return cublasLtMatmulPreferenceInit_internal(pref, sizeof(*pref)); +} + +/** Create new matmul heuristic search preference descriptor. + * + * \retval CUBLAS_STATUS_ALLOC_FAILED if memory could not be allocated + * \retval CUBLAS_STATUS_SUCCESS if desciptor was created successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulPreferenceCreate(cublasLtMatmulPreference_t* pref); + +/** Destroy matmul heuristic search preference descriptor. + * + * \retval CUBLAS_STATUS_SUCCESS if operation was successful + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulPreferenceDestroy(cublasLtMatmulPreference_t pref); + +/** Set matmul heuristic search preference descriptor attribute. + * + * \param[in] pref The descriptor + * \param[in] attr The attribute + * \param[in] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * + * \retval CUBLAS_STATUS_INVALID_VALUE if buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute was set successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulPreferenceSetAttribute( // + cublasLtMatmulPreference_t pref, + cublasLtMatmulPreferenceAttributes_t attr, + const void* buf, + size_t sizeInBytes); + +/** Get matmul heuristic search preference descriptor attribute. + * + * \param[in] pref The descriptor + * \param[in] attr The attribute + * \param[out] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * \param[out] sizeWritten only valid when return value is CUBLAS_STATUS_SUCCESS. If sizeInBytes is non-zero: number of + * bytes actually written, if sizeInBytes is 0: number of bytes needed to write full contents + * + * \retval CUBLAS_STATUS_INVALID_VALUE if sizeInBytes is 0 and sizeWritten is NULL, or if sizeInBytes is non-zero + * and buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute's value was successfully written to user memory + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulPreferenceGetAttribute( // + cublasLtMatmulPreference_t pref, + cublasLtMatmulPreferenceAttributes_t attr, + void* buf, + size_t sizeInBytes, + size_t* sizeWritten); + +/** Results structure used by cublasLtMatmulGetAlgo. + * + * Holds returned configured algo descriptor and its runtime properties. + */ +typedef struct { + /** Matmul algorithm descriptor. + * + * Must be initialized with cublasLtMatmulAlgoInit() if preferences' CUBLASLT_MATMUL_PERF_SEARCH_MODE is set to + * CUBLASLT_SEARCH_LIMITED_BY_ALGO_ID + */ + cublasLtMatmulAlgo_t algo; + + /** Actual size of workspace memory required. + */ + size_t workspaceSize; + + /** Result status, other fields are only valid if after call to cublasLtMatmulAlgoGetHeuristic() this member is set to + * CUBLAS_STATUS_SUCCESS. + */ + cublasStatus_t state; + + /** Waves count - a device utilization metric. + * + * wavesCount value of 1.0f suggests that when kernel is launched it will fully occupy the GPU. + */ + float wavesCount; + + int reserved[4]; +} cublasLtMatmulHeuristicResult_t; + +/** Query cublasLt heuristic for algorithm appropriate for given use case. + * + * \param[in] lightHandle Pointer to the allocated cuBLASLt handle for the cuBLASLt + * context. See cublasLtHandle_t. + * \param[in] operationDesc Handle to the matrix multiplication descriptor. + * \param[in] Adesc Handle to the layout descriptors for matrix A. + * \param[in] Bdesc Handle to the layout descriptors for matrix B. + * \param[in] Cdesc Handle to the layout descriptors for matrix C. + * \param[in] Ddesc Handle to the layout descriptors for matrix D. + * \param[in] preference Pointer to the structure holding the heuristic search + * preferences descriptor. See cublasLtMatrixLayout_t. + * \param[in] requestedAlgoCount Size of heuristicResultsArray (in elements) and requested + * maximum number of algorithms to return. + * \param[in, out] heuristicResultsArray Output algorithms and associated runtime characteristics, + * ordered in increasing estimated compute time. + * \param[out] returnAlgoCount The number of heuristicResultsArray elements written. + * + * \retval CUBLAS_STATUS_INVALID_VALUE if requestedAlgoCount is less or equal to zero + * \retval CUBLAS_STATUS_NOT_SUPPORTED if no heuristic function available for current configuration + * \retval CUBLAS_STATUS_SUCCESS if query was successful, inspect + * heuristicResultsArray[0 to (returnAlgoCount - 1)].state + * for detail status of results + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulAlgoGetHeuristic(cublasLtHandle_t lightHandle, + cublasLtMatmulDesc_t operationDesc, + cublasLtMatrixLayout_t Adesc, + cublasLtMatrixLayout_t Bdesc, + cublasLtMatrixLayout_t Cdesc, + cublasLtMatrixLayout_t Ddesc, + cublasLtMatmulPreference_t preference, + int requestedAlgoCount, + cublasLtMatmulHeuristicResult_t heuristicResultsArray[], + int* returnAlgoCount); + +/* ---------------------------------------------------------------------------------------*/ +/* Lower level API to be able to implement own Heuristic and Find routines */ +/* ---------------------------------------------------------------------------------------*/ + +/** Routine to get all algo IDs that can potentially run + * + * \param[in] int requestedAlgoCount requested number of algos (must be less or equal to size of algoIdsA + * (in elements)) \param[out] algoIdsA array to write algoIds to \param[out] returnAlgoCount number of algoIds + * actually written + * + * \retval CUBLAS_STATUS_INVALID_VALUE if requestedAlgoCount is less or equal to zero + * \retval CUBLAS_STATUS_SUCCESS if query was successful, inspect returnAlgoCount to get actual number of IDs + * available + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulAlgoGetIds(cublasLtHandle_t lightHandle, + cublasComputeType_t computeType, + cudaDataType_t scaleType, + cudaDataType_t Atype, + cudaDataType_t Btype, + cudaDataType_t Ctype, + cudaDataType_t Dtype, + int requestedAlgoCount, + int algoIdsArray[], + int* returnAlgoCount); + +/** Initialize algo structure + * + * \retval CUBLAS_STATUS_INVALID_VALUE if algo is NULL or algoId is outside of recognized range + * \retval CUBLAS_STATUS_NOT_SUPPORTED if algoId is not supported for given combination of data types + * \retval CUBLAS_STATUS_SUCCESS if the structure was successfully initialized + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulAlgoInit(cublasLtHandle_t lightHandle, + cublasComputeType_t computeType, + cudaDataType_t scaleType, + cudaDataType_t Atype, + cudaDataType_t Btype, + cudaDataType_t Ctype, + cudaDataType_t Dtype, + int algoId, + cublasLtMatmulAlgo_t* algo); + +/** Check configured algo descriptor for correctness and support on current device. + * + * Result includes required workspace size and calculated wave count. + * + * CUBLAS_STATUS_SUCCESS doesn't fully guarantee algo will run (will fail if e.g. buffers are not correctly aligned); + * but if cublasLtMatmulAlgoCheck fails, the algo will not run. + * + * \param[in] algo algo configuration to check + * \param[out] result result structure to report algo runtime characteristics; algo field is never updated + * + * \retval CUBLAS_STATUS_INVALID_VALUE if matrix layout descriptors or operation descriptor don't match algo + * descriptor + * \retval CUBLAS_STATUS_NOT_SUPPORTED if algo configuration or data type combination is not currently supported on + * given device + * \retval CUBLAS_STATUS_ARCH_MISMATCH if algo configuration cannot be run using the selected device + * \retval CUBLAS_STATUS_SUCCESS if check was successful + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulAlgoCheck( // + cublasLtHandle_t lightHandle, + cublasLtMatmulDesc_t operationDesc, + cublasLtMatrixLayout_t Adesc, + cublasLtMatrixLayout_t Bdesc, + cublasLtMatrixLayout_t Cdesc, + cublasLtMatrixLayout_t Ddesc, + const cublasLtMatmulAlgo_t* algo, ///< may point to result->algo + cublasLtMatmulHeuristicResult_t* result); + +/** Capabilities Attributes that can be retrieved from an initialized Algo structure + */ +typedef enum { + /** support for split K, see CUBLASLT_ALGO_CONFIG_SPLITK_NUM + * + * int32_t, 0 means no support, supported otherwise + */ + CUBLASLT_ALGO_CAP_SPLITK_SUPPORT = 0, + + /** reduction scheme mask, see cublasLtReductionScheme_t; shows supported reduction schemes, if reduction scheme is + * not masked out it is supported. + * + * e.g. int isReductionSchemeComputeTypeSupported ? (reductionSchemeMask & CUBLASLT_REDUCTION_SCHEME_COMPUTE_TYPE) == + * CUBLASLT_REDUCTION_SCHEME_COMPUTE_TYPE ? 1 : 0; + * + * uint32_t + */ + CUBLASLT_ALGO_CAP_REDUCTION_SCHEME_MASK = 1, + + /** support for cta swizzling, see CUBLASLT_ALGO_CONFIG_CTA_SWIZZLING + * + * uint32_t, 0 means no support, 1 means supported value of 1, other values are reserved + */ + CUBLASLT_ALGO_CAP_CTA_SWIZZLING_SUPPORT = 2, + + /** support strided batch + * + * int32_t, 0 means no support, supported otherwise + */ + CUBLASLT_ALGO_CAP_STRIDED_BATCH_SUPPORT = 3, + + /** support results out of place (D != C in D = alpha.A.B + beta.C) + * + * int32_t, 0 means no support, supported otherwise + */ + CUBLASLT_ALGO_CAP_OUT_OF_PLACE_RESULT_SUPPORT = 4, + + /** syrk/herk support (on top of regular gemm) + * + * int32_t, 0 means no support, supported otherwise + */ + CUBLASLT_ALGO_CAP_UPLO_SUPPORT = 5, + + /** tile ids possible to use, see cublasLtMatmulTile_t; if no tile ids are supported use + * CUBLASLT_MATMUL_TILE_UNDEFINED + * + * use cublasLtMatmulAlgoCapGetAttribute() with sizeInBytes=0 to query actual count + * + * array of uint32_t + */ + CUBLASLT_ALGO_CAP_TILE_IDS = 6, + + /** custom option range is from 0 to CUBLASLT_ALGO_CAP_CUSTOM_OPTION_MAX (inclusive), see + * CUBLASLT_ALGO_CONFIG_CUSTOM_OPTION + * + * int32_t + */ + CUBLASLT_ALGO_CAP_CUSTOM_OPTION_MAX = 7, + + /** whether algorithm supports custom (not COL or ROW memory order), see cublasLtOrder_t + * + * int32_t 0 means only COL and ROW memory order is allowed, non-zero means that algo might have different + * requirements; + */ + CUBLASLT_ALGO_CAP_CUSTOM_MEMORY_ORDER = 10, + + /** bitmask enumerating pointer modes algorithm supports + * + * uint32_t, see cublasLtPointerModeMask_t + */ + CUBLASLT_ALGO_CAP_POINTER_MODE_MASK = 11, + + /** bitmask enumerating kinds of postprocessing algorithm supports in the epilogue + * + * uint32_t, see cublasLtEpilogue_t + */ + CUBLASLT_ALGO_CAP_EPILOGUE_MASK = 12, + + /** stages ids possible to use, see cublasLtMatmulStages_t; if no stages ids are supported use + * CUBLASLT_MATMUL_STAGES_UNDEFINED + * + * use cublasLtMatmulAlgoCapGetAttribute() with sizeInBytes=0 to query actual count + * + * array of uint32_t + */ + CUBLASLT_ALGO_CAP_STAGES_IDS = 13, + + /** support for nagative ld for all of the matrices + * + * int32_t 0 means no support, supported otherwise + */ + CUBLASLT_ALGO_CAP_LD_NEGATIVE = 14, + + /** details about algorithm's implementation that affect it's numerical behavior + * + * uint64_t, see cublasLtNumericalImplFlags_t + */ + CUBLASLT_ALGO_CAP_NUMERICAL_IMPL_FLAGS = 15, + + /** minimum alignment required for A matrix in bytes + * (required for buffer pointer, leading dimension, and possibly other strides defined for matrix memory order) + * + * uint32_t + */ + CUBLASLT_ALGO_CAP_MIN_ALIGNMENT_A_BYTES = 16, + + /** minimum alignment required for B matrix in bytes + * (required for buffer pointer, leading dimension, and possibly other strides defined for matrix memory order) + * + * uint32_t + */ + CUBLASLT_ALGO_CAP_MIN_ALIGNMENT_B_BYTES = 17, + + /** minimum alignment required for C matrix in bytes + * (required for buffer pointer, leading dimension, and possibly other strides defined for matrix memory order) + * + * uint32_t + */ + CUBLASLT_ALGO_CAP_MIN_ALIGNMENT_C_BYTES = 18, + + /** minimum alignment required for D matrix in bytes + * (required for buffer pointer, leading dimension, and possibly other strides defined for matrix memory order) + * + * uint32_t + */ + CUBLASLT_ALGO_CAP_MIN_ALIGNMENT_D_BYTES = 19, + + /** EXPERIMENTAL: support for synchronization via atomic counters + * + * int32_t + */ + CUBLASLT_ALGO_CAP_ATOMIC_SYNC = 20, +} cublasLtMatmulAlgoCapAttributes_t; + +/** Get algo capability attribute. + * + * E.g. to get list of supported Tile IDs: + * cublasLtMatmulTile_t tiles[CUBLASLT_MATMUL_TILE_END]; + * size_t num_tiles, size_written; + * if (cublasLtMatmulAlgoCapGetAttribute(algo, CUBLASLT_ALGO_CAP_TILE_IDS, tiles, sizeof(tiles), size_written) == + * CUBLAS_STATUS_SUCCESS) { num_tiles = size_written / sizeof(tiles[0]); + * } + * + * \param[in] algo The algo descriptor + * \param[in] attr The attribute + * \param[out] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * \param[out] sizeWritten only valid when return value is CUBLAS_STATUS_SUCCESS. If sizeInBytes is non-zero: number of + * bytes actually written, if sizeInBytes is 0: number of bytes needed to write full contents + * + * \retval CUBLAS_STATUS_INVALID_VALUE if sizeInBytes is 0 and sizeWritten is NULL, or if sizeInBytes is non-zero + * and buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute's value was successfully written to user memory + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulAlgoCapGetAttribute(const cublasLtMatmulAlgo_t* algo, + cublasLtMatmulAlgoCapAttributes_t attr, + void* buf, + size_t sizeInBytes, + size_t* sizeWritten); + +/** Algo Configuration Attributes that can be set according to the Algo capabilities + */ +typedef enum { + /** algorithm index, see cublasLtMatmulAlgoGetIds() + * + * readonly, set by cublasLtMatmulAlgoInit() + * int32_t + */ + CUBLASLT_ALGO_CONFIG_ID = 0, + /** tile id, see cublasLtMatmulTile_t + * + * uint32_t, default: CUBLASLT_MATMUL_TILE_UNDEFINED + */ + CUBLASLT_ALGO_CONFIG_TILE_ID = 1, + /** Number of K splits. If the number of K splits is greater than one, SPLITK_NUM parts + * of matrix multiplication will be computed in parallel. The results will be accumulated + * according to CUBLASLT_ALGO_CONFIG_REDUCTION_SCHEME + * + * int32_t, default: 1 + */ + CUBLASLT_ALGO_CONFIG_SPLITK_NUM = 2, + /** reduction scheme, see cublasLtReductionScheme_t + * + * uint32_t, default: CUBLASLT_REDUCTION_SCHEME_NONE + */ + CUBLASLT_ALGO_CONFIG_REDUCTION_SCHEME = 3, + /** cta swizzling, change mapping from CUDA grid coordinates to parts of the matrices + * + * possible values: 0, 1, other values reserved + * + * uint32_t, default: 0 + */ + CUBLASLT_ALGO_CONFIG_CTA_SWIZZLING = 4, + /** custom option, each algorithm can support some custom options that don't fit description of the other config + * attributes, see CUBLASLT_ALGO_CAP_CUSTOM_OPTION_MAX to get accepted range for any specific case + * + * uint32_t, default: 0 + */ + CUBLASLT_ALGO_CONFIG_CUSTOM_OPTION = 5, + /** stages id, see cublasLtMatmulStages_t + * + * uint32_t, default: CUBLASLT_MATMUL_STAGES_UNDEFINED + */ + CUBLASLT_ALGO_CONFIG_STAGES_ID = 6, + /** inner shape id, see cublasLtMatmulInnerShape_t + * + * uint16_t, default: 0 (CUBLASLT_MATMUL_INNER_SHAPE_UNDEFINED) + */ + CUBLASLT_ALGO_CONFIG_INNER_SHAPE_ID = 7, + /** Thread Block Cluster shape id, see cublasLtClusterShape_t. Defines cluster size to use. + * + * uint16_t, default: 0 (CUBLASLT_CLUSTER_SHAPE_AUTO) + */ + CUBLASLT_ALGO_CONFIG_CLUSTER_SHAPE_ID = 8, +} cublasLtMatmulAlgoConfigAttributes_t; + +/** Set algo configuration attribute. + * + * \param[in] algo The algo descriptor + * \param[in] attr The attribute + * \param[in] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * + * \retval CUBLAS_STATUS_INVALID_VALUE if buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute was set successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulAlgoConfigSetAttribute(cublasLtMatmulAlgo_t* algo, + cublasLtMatmulAlgoConfigAttributes_t attr, + const void* buf, + size_t sizeInBytes); + +/** Get algo configuration attribute. + * + * \param[in] algo The algo descriptor + * \param[in] attr The attribute + * \param[out] buf memory address containing the new value + * \param[in] sizeInBytes size of buf buffer for verification (in bytes) + * \param[out] sizeWritten only valid when return value is CUBLAS_STATUS_SUCCESS. If sizeInBytes is non-zero: number of + * bytes actually written, if sizeInBytes is 0: number of bytes needed to write full contents + * + * \retval CUBLAS_STATUS_INVALID_VALUE if sizeInBytes is 0 and sizeWritten is NULL, or if sizeInBytes is non-zero + * and buf is NULL or sizeInBytes doesn't match size of internal storage for + * selected attribute + * \retval CUBLAS_STATUS_SUCCESS if attribute's value was successfully written to user memory + */ +cublasStatus_t CUBLASWINAPI cublasLtMatmulAlgoConfigGetAttribute(const cublasLtMatmulAlgo_t* algo, + cublasLtMatmulAlgoConfigAttributes_t attr, + void* buf, + size_t sizeInBytes, + size_t* sizeWritten); + +/** Experimental: Logger callback type. + */ +typedef void (*cublasLtLoggerCallback_t)(int logLevel, const char* functionName, const char* message); + +/** Experimental: Logger callback setter. + * + * \param[in] callback a user defined callback function to be called by the logger + * + * \retval CUBLAS_STATUS_SUCCESS if callback was set successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtLoggerSetCallback(cublasLtLoggerCallback_t callback); + +/** Experimental: Log file setter. + * + * \param[in] file an open file with write permissions + * + * \retval CUBLAS_STATUS_SUCCESS if log file was set successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtLoggerSetFile(FILE* file); + +/** Experimental: Open log file. + * + * \param[in] logFile log file path. if the log file does not exist, it will be created + * + * \retval CUBLAS_STATUS_SUCCESS if log file was created successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtLoggerOpenFile(const char* logFile); + +/** Experimental: Log level setter. + * + * \param[in] level log level, should be one of the following: + * 0. Off + * 1. Errors + * 2. Performance Trace + * 3. Performance Hints + * 4. Heuristics Trace + * 5. API Trace + * + * \retval CUBLAS_STATUS_INVALID_VALUE if log level is not one of the above levels + * + * \retval CUBLAS_STATUS_SUCCESS if log level was set successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtLoggerSetLevel(int level); + +/** Experimental: Log mask setter. + * + * \param[in] mask log mask, should be a combination of the following masks: + * 0. Off + * 1. Errors + * 2. Performance Trace + * 4. Performance Hints + * 8. Heuristics Trace + * 16. API Trace + * + * \retval CUBLAS_STATUS_SUCCESS if log mask was set successfully + */ +cublasStatus_t CUBLASWINAPI cublasLtLoggerSetMask(int mask); + +/** Experimental: Disable logging for the entire session. + * + * \retval CUBLAS_STATUS_SUCCESS if disabled logging + */ +cublasStatus_t CUBLASWINAPI cublasLtLoggerForceDisable(); + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ diff --git a/cuda_toolkit/include/cublasXt.h b/cuda_toolkit/include/cublasXt.h new file mode 100644 index 0000000000000000000000000000000000000000..35a4dc5f1e7e7b775b169f9158ba645ed4c2a518 --- /dev/null +++ b/cuda_toolkit/include/cublasXt.h @@ -0,0 +1,693 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/* cublasXt : Host API, Out of Core and Multi-GPU BLAS Library + +*/ + +#if !defined(CUBLAS_XT_H_) +#define CUBLAS_XT_H_ + +#include "driver_types.h" +#include "cuComplex.h" /* import complex data type */ + +#include "cublas_v2.h" + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +struct cublasXtContext; +typedef struct cublasXtContext* cublasXtHandle_t; + +cublasStatus_t CUBLASWINAPI cublasXtCreate(cublasXtHandle_t* handle); +cublasStatus_t CUBLASWINAPI cublasXtDestroy(cublasXtHandle_t handle); +cublasStatus_t CUBLASWINAPI cublasXtGetNumBoards(int nbDevices, int deviceId[], int* nbBoards); +cublasStatus_t CUBLASWINAPI cublasXtMaxBoards(int* nbGpuBoards); +/* This routine selects the Gpus that the user want to use for CUBLAS-XT */ +cublasStatus_t CUBLASWINAPI cublasXtDeviceSelect(cublasXtHandle_t handle, int nbDevices, int deviceId[]); + +/* This routine allows to change the dimension of the tiles ( blockDim x blockDim ) */ +cublasStatus_t CUBLASWINAPI cublasXtSetBlockDim(cublasXtHandle_t handle, int blockDim); +cublasStatus_t CUBLASWINAPI cublasXtGetBlockDim(cublasXtHandle_t handle, int* blockDim); + +typedef enum { CUBLASXT_PINNING_DISABLED = 0, CUBLASXT_PINNING_ENABLED = 1 } cublasXtPinnedMemMode_t; +/* This routine allows to CUBLAS-XT to pin the Host memory if it find out that some of the matrix passed + are not pinned : Pinning/Unpinning the Host memory is still a costly operation + It is better if the user controls the memory on its own (by pinning/unpinning oly when necessary) +*/ +cublasStatus_t CUBLASWINAPI cublasXtGetPinningMemMode(cublasXtHandle_t handle, cublasXtPinnedMemMode_t* mode); +cublasStatus_t CUBLASWINAPI cublasXtSetPinningMemMode(cublasXtHandle_t handle, cublasXtPinnedMemMode_t mode); + +/* This routines is to provide a CPU Blas routines, used for too small sizes or hybrid computation */ +typedef enum { + CUBLASXT_FLOAT = 0, + CUBLASXT_DOUBLE = 1, + CUBLASXT_COMPLEX = 2, + CUBLASXT_DOUBLECOMPLEX = 3, +} cublasXtOpType_t; + +typedef enum { + CUBLASXT_GEMM = 0, + CUBLASXT_SYRK = 1, + CUBLASXT_HERK = 2, + CUBLASXT_SYMM = 3, + CUBLASXT_HEMM = 4, + CUBLASXT_TRSM = 5, + CUBLASXT_SYR2K = 6, + CUBLASXT_HER2K = 7, + + CUBLASXT_SPMM = 8, + CUBLASXT_SYRKX = 9, + CUBLASXT_HERKX = 10, + CUBLASXT_TRMM = 11, + CUBLASXT_ROUTINE_MAX = 12, +} cublasXtBlasOp_t; + +/* Currently only 32-bit integer BLAS routines are supported */ +cublasStatus_t CUBLASWINAPI cublasXtSetCpuRoutine(cublasXtHandle_t handle, + cublasXtBlasOp_t blasOp, + cublasXtOpType_t type, + void* blasFunctor); + +/* Specified the percentage of work that should done by the CPU, default is 0 (no work) */ +cublasStatus_t CUBLASWINAPI cublasXtSetCpuRatio(cublasXtHandle_t handle, + cublasXtBlasOp_t blasOp, + cublasXtOpType_t type, + float ratio); + +/* GEMM */ +cublasStatus_t CUBLASWINAPI cublasXtSgemm(cublasXtHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + size_t m, + size_t n, + size_t k, + const float* alpha, + const float* A, + size_t lda, + const float* B, + size_t ldb, + const float* beta, + float* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtDgemm(cublasXtHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + size_t m, + size_t n, + size_t k, + const double* alpha, + const double* A, + size_t lda, + const double* B, + size_t ldb, + const double* beta, + double* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtCgemm(cublasXtHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + size_t m, + size_t n, + size_t k, + const cuComplex* alpha, + const cuComplex* A, + size_t lda, + const cuComplex* B, + size_t ldb, + const cuComplex* beta, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZgemm(cublasXtHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + size_t m, + size_t n, + size_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + size_t lda, + const cuDoubleComplex* B, + size_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + size_t ldc); +/* ------------------------------------------------------- */ +/* SYRK */ +cublasStatus_t CUBLASWINAPI cublasXtSsyrk(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const float* alpha, + const float* A, + size_t lda, + const float* beta, + float* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtDsyrk(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const double* alpha, + const double* A, + size_t lda, + const double* beta, + double* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtCsyrk(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const cuComplex* alpha, + const cuComplex* A, + size_t lda, + const cuComplex* beta, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZsyrk(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + size_t lda, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + size_t ldc); +/* -------------------------------------------------------------------- */ +/* HERK */ +cublasStatus_t CUBLASWINAPI cublasXtCherk(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const float* alpha, + const cuComplex* A, + size_t lda, + const float* beta, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZherk(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const double* alpha, + const cuDoubleComplex* A, + size_t lda, + const double* beta, + cuDoubleComplex* C, + size_t ldc); +/* -------------------------------------------------------------------- */ +/* SYR2K */ +cublasStatus_t CUBLASWINAPI cublasXtSsyr2k(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const float* alpha, + const float* A, + size_t lda, + const float* B, + size_t ldb, + const float* beta, + float* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtDsyr2k(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const double* alpha, + const double* A, + size_t lda, + const double* B, + size_t ldb, + const double* beta, + double* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtCsyr2k(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const cuComplex* alpha, + const cuComplex* A, + size_t lda, + const cuComplex* B, + size_t ldb, + const cuComplex* beta, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZsyr2k(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + size_t lda, + const cuDoubleComplex* B, + size_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + size_t ldc); +/* -------------------------------------------------------------------- */ +/* HERKX : variant extension of HERK */ +cublasStatus_t CUBLASWINAPI cublasXtCherkx(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const cuComplex* alpha, + const cuComplex* A, + size_t lda, + const cuComplex* B, + size_t ldb, + const float* beta, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZherkx(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + size_t lda, + const cuDoubleComplex* B, + size_t ldb, + const double* beta, + cuDoubleComplex* C, + size_t ldc); + +/* -------------------------------------------------------------------- */ +/* TRSM */ +cublasStatus_t CUBLASWINAPI cublasXtStrsm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + size_t m, + size_t n, + const float* alpha, + const float* A, + size_t lda, + float* B, + size_t ldb); + +cublasStatus_t CUBLASWINAPI cublasXtDtrsm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + size_t m, + size_t n, + const double* alpha, + const double* A, + size_t lda, + double* B, + size_t ldb); + +cublasStatus_t CUBLASWINAPI cublasXtCtrsm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + size_t m, + size_t n, + const cuComplex* alpha, + const cuComplex* A, + size_t lda, + cuComplex* B, + size_t ldb); + +cublasStatus_t CUBLASWINAPI cublasXtZtrsm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + size_t m, + size_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + size_t lda, + cuDoubleComplex* B, + size_t ldb); +/* -------------------------------------------------------------------- */ +/* SYMM : Symmetric Multiply Matrix*/ +cublasStatus_t CUBLASWINAPI cublasXtSsymm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + size_t m, + size_t n, + const float* alpha, + const float* A, + size_t lda, + const float* B, + size_t ldb, + const float* beta, + float* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtDsymm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + size_t m, + size_t n, + const double* alpha, + const double* A, + size_t lda, + const double* B, + size_t ldb, + const double* beta, + double* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtCsymm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + size_t m, + size_t n, + const cuComplex* alpha, + const cuComplex* A, + size_t lda, + const cuComplex* B, + size_t ldb, + const cuComplex* beta, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZsymm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + size_t m, + size_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + size_t lda, + const cuDoubleComplex* B, + size_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + size_t ldc); +/* -------------------------------------------------------------------- */ +/* HEMM : Hermitian Matrix Multiply */ +cublasStatus_t CUBLASWINAPI cublasXtChemm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + size_t m, + size_t n, + const cuComplex* alpha, + const cuComplex* A, + size_t lda, + const cuComplex* B, + size_t ldb, + const cuComplex* beta, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZhemm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + size_t m, + size_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + size_t lda, + const cuDoubleComplex* B, + size_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + size_t ldc); + +/* -------------------------------------------------------------------- */ +/* SYRKX : variant extension of SYRK */ +cublasStatus_t CUBLASWINAPI cublasXtSsyrkx(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const float* alpha, + const float* A, + size_t lda, + const float* B, + size_t ldb, + const float* beta, + float* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtDsyrkx(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const double* alpha, + const double* A, + size_t lda, + const double* B, + size_t ldb, + const double* beta, + double* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtCsyrkx(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const cuComplex* alpha, + const cuComplex* A, + size_t lda, + const cuComplex* B, + size_t ldb, + const cuComplex* beta, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZsyrkx(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + size_t lda, + const cuDoubleComplex* B, + size_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + size_t ldc); +/* -------------------------------------------------------------------- */ +/* HER2K : variant extension of HERK */ +cublasStatus_t CUBLASWINAPI cublasXtCher2k(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const cuComplex* alpha, + const cuComplex* A, + size_t lda, + const cuComplex* B, + size_t ldb, + const float* beta, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZher2k(cublasXtHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + size_t n, + size_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + size_t lda, + const cuDoubleComplex* B, + size_t ldb, + const double* beta, + cuDoubleComplex* C, + size_t ldc); + +/* -------------------------------------------------------------------- */ +/* SPMM : Symmetric Packed Multiply Matrix*/ +cublasStatus_t CUBLASWINAPI cublasXtSspmm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + size_t m, + size_t n, + const float* alpha, + const float* AP, + const float* B, + size_t ldb, + const float* beta, + float* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtDspmm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + size_t m, + size_t n, + const double* alpha, + const double* AP, + const double* B, + size_t ldb, + const double* beta, + double* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtCspmm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + size_t m, + size_t n, + const cuComplex* alpha, + const cuComplex* AP, + const cuComplex* B, + size_t ldb, + const cuComplex* beta, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZspmm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + size_t m, + size_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* AP, + const cuDoubleComplex* B, + size_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + size_t ldc); + +/* -------------------------------------------------------------------- */ +/* TRMM */ +cublasStatus_t CUBLASWINAPI cublasXtStrmm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + size_t m, + size_t n, + const float* alpha, + const float* A, + size_t lda, + const float* B, + size_t ldb, + float* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtDtrmm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + size_t m, + size_t n, + const double* alpha, + const double* A, + size_t lda, + const double* B, + size_t ldb, + double* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtCtrmm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + size_t m, + size_t n, + const cuComplex* alpha, + const cuComplex* A, + size_t lda, + const cuComplex* B, + size_t ldb, + cuComplex* C, + size_t ldc); + +cublasStatus_t CUBLASWINAPI cublasXtZtrmm(cublasXtHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + size_t m, + size_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + size_t lda, + const cuDoubleComplex* B, + size_t ldb, + cuDoubleComplex* C, + size_t ldc); + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif /* !defined(CUBLAS_XT_H_) */ diff --git a/cuda_toolkit/include/cublas_api.h b/cuda_toolkit/include/cublas_api.h new file mode 100644 index 0000000000000000000000000000000000000000..f63b9539b7f7ca70e94c7da8363c92aa0e00da4c --- /dev/null +++ b/cuda_toolkit/include/cublas_api.h @@ -0,0 +1,5793 @@ +/* + * Copyright 1993-2022 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/* + * This is the public header file for the CUBLAS library, defining the API + * + * CUBLAS is an implementation of BLAS (Basic Linear Algebra Subroutines) + * on top of the CUDA runtime. + */ + +#if !defined(CUBLAS_API_H_) +#define CUBLAS_API_H_ + +#ifndef CUBLASWINAPI +#ifdef _WIN32 +#define CUBLASWINAPI __stdcall +#else +#define CUBLASWINAPI +#endif +#endif + +#ifndef CUBLASAPI +#error "This file should not be included without defining CUBLASAPI" +#endif + +#include + +#include "driver_types.h" +#include "cuComplex.h" /* import complex data type */ + +#include +#include + +#include + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +#define CUBLAS_VER_MAJOR 12 +#define CUBLAS_VER_MINOR 4 +#define CUBLAS_VER_PATCH 5 +#define CUBLAS_VER_BUILD 8 +#define CUBLAS_VERSION (CUBLAS_VER_MAJOR * 10000 + CUBLAS_VER_MINOR * 100 + CUBLAS_VER_PATCH) + +/* CUBLAS status type returns */ +typedef enum { + CUBLAS_STATUS_SUCCESS = 0, + CUBLAS_STATUS_NOT_INITIALIZED = 1, + CUBLAS_STATUS_ALLOC_FAILED = 3, + CUBLAS_STATUS_INVALID_VALUE = 7, + CUBLAS_STATUS_ARCH_MISMATCH = 8, + CUBLAS_STATUS_MAPPING_ERROR = 11, + CUBLAS_STATUS_EXECUTION_FAILED = 13, + CUBLAS_STATUS_INTERNAL_ERROR = 14, + CUBLAS_STATUS_NOT_SUPPORTED = 15, + CUBLAS_STATUS_LICENSE_ERROR = 16 +} cublasStatus_t; + +typedef enum { CUBLAS_FILL_MODE_LOWER = 0, CUBLAS_FILL_MODE_UPPER = 1, CUBLAS_FILL_MODE_FULL = 2 } cublasFillMode_t; + +typedef enum { CUBLAS_DIAG_NON_UNIT = 0, CUBLAS_DIAG_UNIT = 1 } cublasDiagType_t; + +typedef enum { CUBLAS_SIDE_LEFT = 0, CUBLAS_SIDE_RIGHT = 1 } cublasSideMode_t; + +typedef enum { + CUBLAS_OP_N = 0, + CUBLAS_OP_T = 1, + CUBLAS_OP_C = 2, + CUBLAS_OP_HERMITAN = 2, /* synonym if CUBLAS_OP_C */ + CUBLAS_OP_CONJG = 3 /* conjugate, placeholder - not supported in the current release */ +} cublasOperation_t; + +typedef enum { CUBLAS_POINTER_MODE_HOST = 0, CUBLAS_POINTER_MODE_DEVICE = 1 } cublasPointerMode_t; + +typedef enum { CUBLAS_ATOMICS_NOT_ALLOWED = 0, CUBLAS_ATOMICS_ALLOWED = 1 } cublasAtomicsMode_t; + +/*For different GEMM algorithm */ +typedef enum { + CUBLAS_GEMM_DFALT = -1, + CUBLAS_GEMM_DEFAULT = -1, + CUBLAS_GEMM_ALGO0 = 0, + CUBLAS_GEMM_ALGO1 = 1, + CUBLAS_GEMM_ALGO2 = 2, + CUBLAS_GEMM_ALGO3 = 3, + CUBLAS_GEMM_ALGO4 = 4, + CUBLAS_GEMM_ALGO5 = 5, + CUBLAS_GEMM_ALGO6 = 6, + CUBLAS_GEMM_ALGO7 = 7, + CUBLAS_GEMM_ALGO8 = 8, + CUBLAS_GEMM_ALGO9 = 9, + CUBLAS_GEMM_ALGO10 = 10, + CUBLAS_GEMM_ALGO11 = 11, + CUBLAS_GEMM_ALGO12 = 12, + CUBLAS_GEMM_ALGO13 = 13, + CUBLAS_GEMM_ALGO14 = 14, + CUBLAS_GEMM_ALGO15 = 15, + CUBLAS_GEMM_ALGO16 = 16, + CUBLAS_GEMM_ALGO17 = 17, + CUBLAS_GEMM_ALGO18 = 18, // sliced 32x32 + CUBLAS_GEMM_ALGO19 = 19, // sliced 64x32 + CUBLAS_GEMM_ALGO20 = 20, // sliced 128x32 + CUBLAS_GEMM_ALGO21 = 21, // sliced 32x32 -splitK + CUBLAS_GEMM_ALGO22 = 22, // sliced 64x32 -splitK + CUBLAS_GEMM_ALGO23 = 23, // sliced 128x32 -splitK + CUBLAS_GEMM_DEFAULT_TENSOR_OP = 99, + CUBLAS_GEMM_DFALT_TENSOR_OP = 99, + CUBLAS_GEMM_ALGO0_TENSOR_OP = 100, + CUBLAS_GEMM_ALGO1_TENSOR_OP = 101, + CUBLAS_GEMM_ALGO2_TENSOR_OP = 102, + CUBLAS_GEMM_ALGO3_TENSOR_OP = 103, + CUBLAS_GEMM_ALGO4_TENSOR_OP = 104, + CUBLAS_GEMM_ALGO5_TENSOR_OP = 105, + CUBLAS_GEMM_ALGO6_TENSOR_OP = 106, + CUBLAS_GEMM_ALGO7_TENSOR_OP = 107, + CUBLAS_GEMM_ALGO8_TENSOR_OP = 108, + CUBLAS_GEMM_ALGO9_TENSOR_OP = 109, + CUBLAS_GEMM_ALGO10_TENSOR_OP = 110, + CUBLAS_GEMM_ALGO11_TENSOR_OP = 111, + CUBLAS_GEMM_ALGO12_TENSOR_OP = 112, + CUBLAS_GEMM_ALGO13_TENSOR_OP = 113, + CUBLAS_GEMM_ALGO14_TENSOR_OP = 114, + CUBLAS_GEMM_ALGO15_TENSOR_OP = 115 +} cublasGemmAlgo_t; + +/*Enum for default math mode/tensor operation*/ +typedef enum { + CUBLAS_DEFAULT_MATH = 0, + + /* deprecated, same effect as using CUBLAS_COMPUTE_32F_FAST_16F, will be removed in a future release */ + CUBLAS_TENSOR_OP_MATH = 1, + + /* same as using matching _PEDANTIC compute type when using cublasroutine calls or cublasEx() calls with + cudaDataType as compute type */ + CUBLAS_PEDANTIC_MATH = 2, + + /* allow accelerating single precision routines using TF32 tensor cores */ + CUBLAS_TF32_TENSOR_OP_MATH = 3, + + /* flag to force any reductons to use the accumulator type and not output type in case of mixed precision routines + with lower size output type */ + CUBLAS_MATH_DISALLOW_REDUCED_PRECISION_REDUCTION = 16, +} cublasMath_t; + +/* For backward compatibility purposes */ +typedef cudaDataType cublasDataType_t; + +/* Enum for compute type + * + * - default types provide best available performance using all available hardware features + * and guarantee internal storage precision with at least the same precision and range; + * - _PEDANTIC types ensure standard arithmetic and exact specified internal storage format; + * - _FAST types allow for some loss of precision to enable higher throughput arithmetic. + */ +typedef enum { + CUBLAS_COMPUTE_16F = 64, /* half - default */ + CUBLAS_COMPUTE_16F_PEDANTIC = 65, /* half - pedantic */ + CUBLAS_COMPUTE_32F = 68, /* float - default */ + CUBLAS_COMPUTE_32F_PEDANTIC = 69, /* float - pedantic */ + CUBLAS_COMPUTE_32F_FAST_16F = 74, /* float - fast, allows down-converting inputs to half or TF32 */ + CUBLAS_COMPUTE_32F_FAST_16BF = 75, /* float - fast, allows down-converting inputs to bfloat16 or TF32 */ + CUBLAS_COMPUTE_32F_FAST_TF32 = 77, /* float - fast, allows down-converting inputs to TF32 */ + CUBLAS_COMPUTE_64F = 70, /* double - default */ + CUBLAS_COMPUTE_64F_PEDANTIC = 71, /* double - pedantic */ + CUBLAS_COMPUTE_32I = 72, /* signed 32-bit int - default */ + CUBLAS_COMPUTE_32I_PEDANTIC = 73, /* signed 32-bit int - pedantic */ +} cublasComputeType_t; + +/* Opaque structure holding CUBLAS library context */ +struct cublasContext; +typedef struct cublasContext* cublasHandle_t; + +/* Cublas logging */ +typedef void (*cublasLogCallback)(const char* msg); + +/* cuBLAS Exported API {{{ */ + +/* --------------- CUBLAS Helper Functions ---------------- */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCreate_v2(cublasHandle_t* handle); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDestroy_v2(cublasHandle_t handle); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGetVersion_v2(cublasHandle_t handle, int* version); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGetProperty(libraryPropertyType type, int* value); + +CUBLASAPI size_t CUBLASWINAPI cublasGetCudartVersion(void); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSetWorkspace_v2(cublasHandle_t handle, + void* workspace, + size_t workspaceSizeInBytes); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSetStream_v2(cublasHandle_t handle, cudaStream_t streamId); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGetStream_v2(cublasHandle_t handle, cudaStream_t* streamId); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGetPointerMode_v2(cublasHandle_t handle, cublasPointerMode_t* mode); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSetPointerMode_v2(cublasHandle_t handle, cublasPointerMode_t mode); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGetAtomicsMode(cublasHandle_t handle, cublasAtomicsMode_t* mode); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSetAtomicsMode(cublasHandle_t handle, cublasAtomicsMode_t mode); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGetMathMode(cublasHandle_t handle, cublasMath_t* mode); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSetMathMode(cublasHandle_t handle, cublasMath_t mode); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGetSmCountTarget(cublasHandle_t handle, int* smCountTarget); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSetSmCountTarget(cublasHandle_t handle, int smCountTarget); + +CUBLASAPI const char* CUBLASWINAPI cublasGetStatusName(cublasStatus_t status); + +CUBLASAPI const char* CUBLASWINAPI cublasGetStatusString(cublasStatus_t status); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasLoggerConfigure(int logIsOn, + int logToStdOut, + int logToStdErr, + const char* logFileName); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSetLoggerCallback(cublasLogCallback userCallback); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGetLoggerCallback(cublasLogCallback* userCallback); + +cublasStatus_t CUBLASWINAPI cublasSetVector(int n, int elemSize, const void* x, int incx, void* devicePtr, int incy); + +cublasStatus_t CUBLASWINAPI +cublasSetVector_64(int64_t n, int64_t elemSize, const void* x, int64_t incx, void* devicePtr, int64_t incy); + +cublasStatus_t CUBLASWINAPI cublasGetVector(int n, int elemSize, const void* x, int incx, void* y, int incy); + +cublasStatus_t CUBLASWINAPI +cublasGetVector_64(int64_t n, int64_t elemSize, const void* x, int64_t incx, void* y, int64_t incy); + +cublasStatus_t CUBLASWINAPI cublasSetMatrix(int rows, int cols, int elemSize, const void* A, int lda, void* B, int ldb); + +cublasStatus_t CUBLASWINAPI +cublasSetMatrix_64(int64_t rows, int64_t cols, int64_t elemSize, const void* A, int64_t lda, void* B, int64_t ldb); + +cublasStatus_t CUBLASWINAPI cublasGetMatrix(int rows, int cols, int elemSize, const void* A, int lda, void* B, int ldb); + +cublasStatus_t CUBLASWINAPI +cublasGetMatrix_64(int64_t rows, int64_t cols, int64_t elemSize, const void* A, int64_t lda, void* B, int64_t ldb); + +cublasStatus_t CUBLASWINAPI cublasSetVectorAsync( + int n, int elemSize, const void* hostPtr, int incx, void* devicePtr, int incy, cudaStream_t stream); + +cublasStatus_t CUBLASWINAPI cublasSetVectorAsync_64( + int64_t n, int64_t elemSize, const void* hostPtr, int64_t incx, void* devicePtr, int64_t incy, cudaStream_t stream); + +cublasStatus_t CUBLASWINAPI cublasGetVectorAsync( + int n, int elemSize, const void* devicePtr, int incx, void* hostPtr, int incy, cudaStream_t stream); + +cublasStatus_t CUBLASWINAPI cublasGetVectorAsync_64( + int64_t n, int64_t elemSize, const void* devicePtr, int64_t incx, void* hostPtr, int64_t incy, cudaStream_t stream); + +cublasStatus_t CUBLASWINAPI +cublasSetMatrixAsync(int rows, int cols, int elemSize, const void* A, int lda, void* B, int ldb, cudaStream_t stream); + +cublasStatus_t CUBLASWINAPI cublasSetMatrixAsync_64(int64_t rows, + int64_t cols, + int64_t elemSize, + const void* A, + int64_t lda, + void* B, + int64_t ldb, + cudaStream_t stream); + +cublasStatus_t CUBLASWINAPI +cublasGetMatrixAsync(int rows, int cols, int elemSize, const void* A, int lda, void* B, int ldb, cudaStream_t stream); + +cublasStatus_t CUBLASWINAPI cublasGetMatrixAsync_64(int64_t rows, + int64_t cols, + int64_t elemSize, + const void* A, + int64_t lda, + void* B, + int64_t ldb, + cudaStream_t stream); + +CUBLASAPI void CUBLASWINAPI cublasXerbla(const char* srName, int info); + +/* --------------- CUBLAS BLAS1 Functions ---------------- */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasNrm2Ex(cublasHandle_t handle, + int n, + const void* x, + cudaDataType xType, + int incx, + void* result, + cudaDataType resultType, + cudaDataType executionType); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasNrm2Ex_64(cublasHandle_t handle, + int64_t n, + const void* x, + cudaDataType xType, + int64_t incx, + void* result, + cudaDataType resultType, + cudaDataType executionType); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSnrm2_v2(cublasHandle_t handle, int n, const float* x, int incx, float* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSnrm2_v2_64(cublasHandle_t handle, int64_t n, const float* x, int64_t incx, float* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDnrm2_v2(cublasHandle_t handle, int n, const double* x, int incx, double* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDnrm2_v2_64(cublasHandle_t handle, int64_t n, const double* x, int64_t incx, double* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasScnrm2_v2(cublasHandle_t handle, int n, const cuComplex* x, int incx, float* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasScnrm2_v2_64(cublasHandle_t handle, int64_t n, const cuComplex* x, int64_t incx, float* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDznrm2_v2(cublasHandle_t handle, int n, const cuDoubleComplex* x, int incx, double* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDznrm2_v2_64(cublasHandle_t handle, int64_t n, const cuDoubleComplex* x, int64_t incx, double* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDotEx(cublasHandle_t handle, + int n, + const void* x, + cudaDataType xType, + int incx, + const void* y, + cudaDataType yType, + int incy, + void* result, + cudaDataType resultType, + cudaDataType executionType); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDotEx_64(cublasHandle_t handle, + int64_t n, + const void* x, + cudaDataType xType, + int64_t incx, + const void* y, + cudaDataType yType, + int64_t incy, + void* result, + cudaDataType resultType, + cudaDataType executionType); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDotcEx(cublasHandle_t handle, + int n, + const void* x, + cudaDataType xType, + int incx, + const void* y, + cudaDataType yType, + int incy, + void* result, + cudaDataType resultType, + cudaDataType executionType); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDotcEx_64(cublasHandle_t handle, + int64_t n, + const void* x, + cudaDataType xType, + int64_t incx, + const void* y, + cudaDataType yType, + int64_t incy, + void* result, + cudaDataType resultType, + cudaDataType executionType); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSdot_v2(cublasHandle_t handle, int n, const float* x, int incx, const float* y, int incy, float* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSdot_v2_64( + cublasHandle_t handle, int64_t n, const float* x, int64_t incx, const float* y, int64_t incy, float* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDdot_v2(cublasHandle_t handle, int n, const double* x, int incx, const double* y, int incy, double* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDdot_v2_64( + cublasHandle_t handle, int64_t n, const double* x, int64_t incx, const double* y, int64_t incy, double* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCdotu_v2( + cublasHandle_t handle, int n, const cuComplex* x, int incx, const cuComplex* y, int incy, cuComplex* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCdotu_v2_64(cublasHandle_t handle, + int64_t n, + const cuComplex* x, + int64_t incx, + const cuComplex* y, + int64_t incy, + cuComplex* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCdotc_v2( + cublasHandle_t handle, int n, const cuComplex* x, int incx, const cuComplex* y, int incy, cuComplex* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCdotc_v2_64(cublasHandle_t handle, + int64_t n, + const cuComplex* x, + int64_t incx, + const cuComplex* y, + int64_t incy, + cuComplex* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZdotu_v2(cublasHandle_t handle, + int n, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZdotu_v2_64(cublasHandle_t handle, + int64_t n, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* y, + int64_t incy, + cuDoubleComplex* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZdotc_v2(cublasHandle_t handle, + int n, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZdotc_v2_64(cublasHandle_t handle, + int64_t n, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* y, + int64_t incy, + cuDoubleComplex* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasScalEx(cublasHandle_t handle, + int n, + const void* alpha, + cudaDataType alphaType, + void* x, + cudaDataType xType, + int incx, + cudaDataType executionType); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasScalEx_64(cublasHandle_t handle, + int64_t n, + const void* alpha, + cudaDataType alphaType, + void* x, + cudaDataType xType, + int64_t incx, + cudaDataType executionType); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSscal_v2(cublasHandle_t handle, int n, const float* alpha, float* x, int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSscal_v2_64(cublasHandle_t handle, int64_t n, const float* alpha, float* x, int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDscal_v2(cublasHandle_t handle, int n, const double* alpha, double* x, int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDscal_v2_64(cublasHandle_t handle, int64_t n, const double* alpha, double* x, int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCscal_v2(cublasHandle_t handle, int n, const cuComplex* alpha, cuComplex* x, int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCscal_v2_64(cublasHandle_t handle, int64_t n, const cuComplex* alpha, cuComplex* x, int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCsscal_v2(cublasHandle_t handle, int n, const float* alpha, cuComplex* x, int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCsscal_v2_64(cublasHandle_t handle, int64_t n, const float* alpha, cuComplex* x, int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasZscal_v2(cublasHandle_t handle, int n, const cuDoubleComplex* alpha, cuDoubleComplex* x, int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasZscal_v2_64(cublasHandle_t handle, int64_t n, const cuDoubleComplex* alpha, cuDoubleComplex* x, int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasZdscal_v2(cublasHandle_t handle, int n, const double* alpha, cuDoubleComplex* x, int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasZdscal_v2_64(cublasHandle_t handle, int64_t n, const double* alpha, cuDoubleComplex* x, int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasAxpyEx(cublasHandle_t handle, + int n, + const void* alpha, + cudaDataType alphaType, + const void* x, + cudaDataType xType, + int incx, + void* y, + cudaDataType yType, + int incy, + cudaDataType executiontype); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasAxpyEx_64(cublasHandle_t handle, + int64_t n, + const void* alpha, + cudaDataType alphaType, + const void* x, + cudaDataType xType, + int64_t incx, + void* y, + cudaDataType yType, + int64_t incy, + cudaDataType executiontype); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSaxpy_v2(cublasHandle_t handle, int n, const float* alpha, const float* x, int incx, float* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSaxpy_v2_64( + cublasHandle_t handle, int64_t n, const float* alpha, const float* x, int64_t incx, float* y, int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDaxpy_v2(cublasHandle_t handle, int n, const double* alpha, const double* x, int incx, double* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDaxpy_v2_64( + cublasHandle_t handle, int64_t n, const double* alpha, const double* x, int64_t incx, double* y, int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCaxpy_v2( + cublasHandle_t handle, int n, const cuComplex* alpha, const cuComplex* x, int incx, cuComplex* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCaxpy_v2_64(cublasHandle_t handle, + int64_t n, + const cuComplex* alpha, + const cuComplex* x, + int64_t incx, + cuComplex* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZaxpy_v2(cublasHandle_t handle, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int incx, + cuDoubleComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZaxpy_v2_64(cublasHandle_t handle, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int64_t incx, + cuDoubleComplex* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCopyEx( + cublasHandle_t handle, int n, const void* x, cudaDataType xType, int incx, void* y, cudaDataType yType, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCopyEx_64(cublasHandle_t handle, + int64_t n, + const void* x, + cudaDataType xType, + int64_t incx, + void* y, + cudaDataType yType, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasScopy_v2(cublasHandle_t handle, int n, const float* x, int incx, float* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasScopy_v2_64(cublasHandle_t handle, int64_t n, const float* x, int64_t incx, float* y, int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDcopy_v2(cublasHandle_t handle, int n, const double* x, int incx, double* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDcopy_v2_64(cublasHandle_t handle, int64_t n, const double* x, int64_t incx, double* y, int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCcopy_v2(cublasHandle_t handle, int n, const cuComplex* x, int incx, cuComplex* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCcopy_v2_64(cublasHandle_t handle, int64_t n, const cuComplex* x, int64_t incx, cuComplex* y, int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasZcopy_v2(cublasHandle_t handle, int n, const cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZcopy_v2_64( + cublasHandle_t handle, int64_t n, const cuDoubleComplex* x, int64_t incx, cuDoubleComplex* y, int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSswap_v2(cublasHandle_t handle, int n, float* x, int incx, float* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSswap_v2_64(cublasHandle_t handle, int64_t n, float* x, int64_t incx, float* y, int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDswap_v2(cublasHandle_t handle, int n, double* x, int incx, double* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDswap_v2_64(cublasHandle_t handle, int64_t n, double* x, int64_t incx, double* y, int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCswap_v2(cublasHandle_t handle, int n, cuComplex* x, int incx, cuComplex* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCswap_v2_64(cublasHandle_t handle, int64_t n, cuComplex* x, int64_t incx, cuComplex* y, int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasZswap_v2(cublasHandle_t handle, int n, cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasZswap_v2_64(cublasHandle_t handle, int64_t n, cuDoubleComplex* x, int64_t incx, cuDoubleComplex* y, int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSwapEx( + cublasHandle_t handle, int n, void* x, cudaDataType xType, int incx, void* y, cudaDataType yType, int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSwapEx_64(cublasHandle_t handle, + int64_t n, + void* x, + cudaDataType xType, + int64_t incx, + void* y, + cudaDataType yType, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIsamax_v2(cublasHandle_t handle, int n, const float* x, int incx, int* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIsamax_v2_64(cublasHandle_t handle, int64_t n, const float* x, int64_t incx, int64_t* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIdamax_v2(cublasHandle_t handle, int n, const double* x, int incx, int* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIdamax_v2_64(cublasHandle_t handle, int64_t n, const double* x, int64_t incx, int64_t* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIcamax_v2(cublasHandle_t handle, int n, const cuComplex* x, int incx, int* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIcamax_v2_64(cublasHandle_t handle, int64_t n, const cuComplex* x, int64_t incx, int64_t* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIzamax_v2(cublasHandle_t handle, int n, const cuDoubleComplex* x, int incx, int* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIzamax_v2_64(cublasHandle_t handle, int64_t n, const cuDoubleComplex* x, int64_t incx, int64_t* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIamaxEx(cublasHandle_t handle, int n, const void* x, cudaDataType xType, int incx, int* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIamaxEx_64(cublasHandle_t handle, int64_t n, const void* x, cudaDataType xType, int64_t incx, int64_t* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIsamin_v2(cublasHandle_t handle, int n, const float* x, int incx, int* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIsamin_v2_64(cublasHandle_t handle, int64_t n, const float* x, int64_t incx, int64_t* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIdamin_v2(cublasHandle_t handle, int n, const double* x, int incx, int* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIdamin_v2_64(cublasHandle_t handle, int64_t n, const double* x, int64_t incx, int64_t* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIcamin_v2(cublasHandle_t handle, int n, const cuComplex* x, int incx, int* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIcamin_v2_64(cublasHandle_t handle, int64_t n, const cuComplex* x, int64_t incx, int64_t* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIzamin_v2(cublasHandle_t handle, int n, const cuDoubleComplex* x, int incx, int* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIzamin_v2_64(cublasHandle_t handle, int64_t n, const cuDoubleComplex* x, int64_t incx, int64_t* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIaminEx(cublasHandle_t handle, int n, const void* x, cudaDataType xType, int incx, int* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasIaminEx_64(cublasHandle_t handle, int64_t n, const void* x, cudaDataType xType, int64_t incx, int64_t* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasAsumEx(cublasHandle_t handle, + int n, + const void* x, + cudaDataType xType, + int incx, + void* result, + cudaDataType resultType, + cudaDataType executiontype); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasAsumEx_64(cublasHandle_t handle, + int64_t n, + const void* x, + cudaDataType xType, + int64_t incx, + void* result, + cudaDataType resultType, + cudaDataType executiontype); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSasum_v2(cublasHandle_t handle, int n, const float* x, int incx, float* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSasum_v2_64(cublasHandle_t handle, int64_t n, const float* x, int64_t incx, float* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDasum_v2(cublasHandle_t handle, int n, const double* x, int incx, double* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDasum_v2_64(cublasHandle_t handle, int64_t n, const double* x, int64_t incx, double* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasScasum_v2(cublasHandle_t handle, int n, const cuComplex* x, int incx, float* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasScasum_v2_64(cublasHandle_t handle, int64_t n, const cuComplex* x, int64_t incx, float* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDzasum_v2(cublasHandle_t handle, int n, const cuDoubleComplex* x, int incx, double* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDzasum_v2_64(cublasHandle_t handle, int64_t n, const cuDoubleComplex* x, int64_t incx, double* result); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSrot_v2(cublasHandle_t handle, int n, float* x, int incx, float* y, int incy, const float* c, const float* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSrot_v2_64( + cublasHandle_t handle, int64_t n, float* x, int64_t incx, float* y, int64_t incy, const float* c, const float* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDrot_v2(cublasHandle_t handle, int n, double* x, int incx, double* y, int incy, const double* c, const double* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDrot_v2_64(cublasHandle_t handle, + int64_t n, + double* x, + int64_t incx, + double* y, + int64_t incy, + const double* c, + const double* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCrot_v2( + cublasHandle_t handle, int n, cuComplex* x, int incx, cuComplex* y, int incy, const float* c, const cuComplex* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCrot_v2_64(cublasHandle_t handle, + int64_t n, + cuComplex* x, + int64_t incx, + cuComplex* y, + int64_t incy, + const float* c, + const cuComplex* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsrot_v2( + cublasHandle_t handle, int n, cuComplex* x, int incx, cuComplex* y, int incy, const float* c, const float* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsrot_v2_64(cublasHandle_t handle, + int64_t n, + cuComplex* x, + int64_t incx, + cuComplex* y, + int64_t incy, + const float* c, + const float* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZrot_v2(cublasHandle_t handle, + int n, + cuDoubleComplex* x, + int incx, + cuDoubleComplex* y, + int incy, + const double* c, + const cuDoubleComplex* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZrot_v2_64(cublasHandle_t handle, + int64_t n, + cuDoubleComplex* x, + int64_t incx, + cuDoubleComplex* y, + int64_t incy, + const double* c, + const cuDoubleComplex* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZdrot_v2(cublasHandle_t handle, + int n, + cuDoubleComplex* x, + int incx, + cuDoubleComplex* y, + int incy, + const double* c, + const double* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZdrot_v2_64(cublasHandle_t handle, + int64_t n, + cuDoubleComplex* x, + int64_t incx, + cuDoubleComplex* y, + int64_t incy, + const double* c, + const double* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasRotEx(cublasHandle_t handle, + int n, + void* x, + cudaDataType xType, + int incx, + void* y, + cudaDataType yType, + int incy, + const void* c, + const void* s, + cudaDataType csType, + cudaDataType executiontype); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasRotEx_64(cublasHandle_t handle, + int64_t n, + void* x, + cudaDataType xType, + int64_t incx, + void* y, + cudaDataType yType, + int64_t incy, + const void* c, + const void* s, + cudaDataType csType, + cudaDataType executiontype); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSrotg_v2(cublasHandle_t handle, float* a, float* b, float* c, float* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDrotg_v2(cublasHandle_t handle, double* a, double* b, double* c, double* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCrotg_v2(cublasHandle_t handle, cuComplex* a, cuComplex* b, float* c, cuComplex* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasZrotg_v2(cublasHandle_t handle, cuDoubleComplex* a, cuDoubleComplex* b, double* c, cuDoubleComplex* s); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasRotgEx(cublasHandle_t handle, + void* a, + void* b, + cudaDataType abType, + void* c, + void* s, + cudaDataType csType, + cudaDataType executiontype); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSrotm_v2(cublasHandle_t handle, int n, float* x, int incx, float* y, int incy, const float* param); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSrotm_v2_64(cublasHandle_t handle, int64_t n, float* x, int64_t incx, float* y, int64_t incy, const float* param); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDrotm_v2(cublasHandle_t handle, int n, double* x, int incx, double* y, int incy, const double* param); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDrotm_v2_64( + cublasHandle_t handle, int64_t n, double* x, int64_t incx, double* y, int64_t incy, const double* param); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasRotmEx(cublasHandle_t handle, + int n, + void* x, + cudaDataType xType, + int incx, + void* y, + cudaDataType yType, + int incy, + const void* param, + cudaDataType paramType, + cudaDataType executiontype); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasRotmEx_64(cublasHandle_t handle, + int64_t n, + void* x, + cudaDataType xType, + int64_t incx, + void* y, + cudaDataType yType, + int64_t incy, + const void* param, + cudaDataType paramType, + cudaDataType executiontype); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSrotmg_v2(cublasHandle_t handle, float* d1, float* d2, float* x1, const float* y1, float* param); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDrotmg_v2(cublasHandle_t handle, double* d1, double* d2, double* x1, const double* y1, double* param); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasRotmgEx(cublasHandle_t handle, + void* d1, + cudaDataType d1Type, + void* d2, + cudaDataType d2Type, + void* x1, + cudaDataType x1Type, + const void* y1, + cudaDataType y1Type, + void* param, + cudaDataType paramType, + cudaDataType executiontype); + +/* --------------- CUBLAS BLAS2 Functions ---------------- */ + +/* GEMV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemv_v2(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const float* A, + int lda, + const float* x, + int incx, + const float* beta, + float* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemv_v2_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const float* A, + int64_t lda, + const float* x, + int64_t incx, + const float* beta, + float* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemv_v2(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const double* alpha, + const double* A, + int lda, + const double* x, + int incx, + const double* beta, + double* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemv_v2_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const double* alpha, + const double* A, + int64_t lda, + const double* x, + int64_t incx, + const double* beta, + double* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemv_v2(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* x, + int incx, + const cuComplex* beta, + cuComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemv_v2_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* x, + int64_t incx, + const cuComplex* beta, + cuComplex* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemv_v2(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemv_v2_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int64_t incy); + +/* GBMV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgbmv_v2(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + int kl, + int ku, + const float* alpha, + const float* A, + int lda, + const float* x, + int incx, + const float* beta, + float* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgbmv_v2_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + int64_t kl, + int64_t ku, + const float* alpha, + const float* A, + int64_t lda, + const float* x, + int64_t incx, + const float* beta, + float* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgbmv_v2(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + int kl, + int ku, + const double* alpha, + const double* A, + int lda, + const double* x, + int incx, + const double* beta, + double* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgbmv_v2_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + int64_t kl, + int64_t ku, + const double* alpha, + const double* A, + int64_t lda, + const double* x, + int64_t incx, + const double* beta, + double* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgbmv_v2(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + int kl, + int ku, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* x, + int incx, + const cuComplex* beta, + cuComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgbmv_v2_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + int64_t kl, + int64_t ku, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* x, + int64_t incx, + const cuComplex* beta, + cuComplex* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgbmv_v2(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + int kl, + int ku, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgbmv_v2_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + int64_t kl, + int64_t ku, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int64_t incy); + +/* TRMV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStrmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const float* A, + int lda, + float* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStrmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const float* A, + int64_t lda, + float* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtrmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const double* A, + int lda, + double* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtrmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const double* A, + int64_t lda, + double* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtrmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const cuComplex* A, + int lda, + cuComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtrmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const cuComplex* A, + int64_t lda, + cuComplex* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const cuDoubleComplex* A, + int lda, + cuDoubleComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const cuDoubleComplex* A, + int64_t lda, + cuDoubleComplex* x, + int64_t incx); + +/* TBMV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStbmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + int k, + const float* A, + int lda, + float* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStbmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + int64_t k, + const float* A, + int64_t lda, + float* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtbmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + int k, + const double* A, + int lda, + double* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtbmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + int64_t k, + const double* A, + int64_t lda, + double* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtbmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + int k, + const cuComplex* A, + int lda, + cuComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtbmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + int64_t k, + const cuComplex* A, + int64_t lda, + cuComplex* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtbmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + int k, + const cuDoubleComplex* A, + int lda, + cuDoubleComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtbmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + int64_t k, + const cuDoubleComplex* A, + int64_t lda, + cuDoubleComplex* x, + int64_t incx); + +/* TPMV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStpmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const float* AP, + float* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStpmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const float* AP, + float* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtpmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const double* AP, + double* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtpmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const double* AP, + double* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtpmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const cuComplex* AP, + cuComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtpmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const cuComplex* AP, + cuComplex* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtpmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const cuDoubleComplex* AP, + cuDoubleComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtpmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const cuDoubleComplex* AP, + cuDoubleComplex* x, + int64_t incx); + +/* TRSV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStrsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const float* A, + int lda, + float* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStrsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const float* A, + int64_t lda, + float* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtrsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const double* A, + int lda, + double* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtrsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const double* A, + int64_t lda, + double* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtrsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const cuComplex* A, + int lda, + cuComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtrsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const cuComplex* A, + int64_t lda, + cuComplex* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const cuDoubleComplex* A, + int lda, + cuDoubleComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const cuDoubleComplex* A, + int64_t lda, + cuDoubleComplex* x, + int64_t incx); + +/* TPSV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStpsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const float* AP, + float* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStpsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const float* AP, + float* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtpsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const double* AP, + double* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtpsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const double* AP, + double* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtpsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const cuComplex* AP, + cuComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtpsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const cuComplex* AP, + cuComplex* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtpsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + const cuDoubleComplex* AP, + cuDoubleComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtpsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + const cuDoubleComplex* AP, + cuDoubleComplex* x, + int64_t incx); + +/* TBSV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStbsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + int k, + const float* A, + int lda, + float* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStbsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + int64_t k, + const float* A, + int64_t lda, + float* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtbsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + int k, + const double* A, + int lda, + double* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtbsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + int64_t k, + const double* A, + int64_t lda, + double* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtbsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + int k, + const cuComplex* A, + int lda, + cuComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtbsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + int64_t k, + const cuComplex* A, + int64_t lda, + cuComplex* x, + int64_t incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtbsv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int n, + int k, + const cuDoubleComplex* A, + int lda, + cuDoubleComplex* x, + int incx); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtbsv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t n, + int64_t k, + const cuDoubleComplex* A, + int64_t lda, + cuDoubleComplex* x, + int64_t incx); + +/* SYMV/HEMV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsymv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const float* alpha, + const float* A, + int lda, + const float* x, + int incx, + const float* beta, + float* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsymv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const float* alpha, + const float* A, + int64_t lda, + const float* x, + int64_t incx, + const float* beta, + float* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsymv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const double* alpha, + const double* A, + int lda, + const double* x, + int incx, + const double* beta, + double* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsymv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const double* alpha, + const double* A, + int64_t lda, + const double* x, + int64_t incx, + const double* beta, + double* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsymv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* x, + int incx, + const cuComplex* beta, + cuComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsymv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* x, + int64_t incx, + const cuComplex* beta, + cuComplex* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsymv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsymv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChemv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* x, + int incx, + const cuComplex* beta, + cuComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChemv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* x, + int64_t incx, + const cuComplex* beta, + cuComplex* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhemv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhemv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int64_t incy); + +/* SBMV/HBMV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsbmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + int k, + const float* alpha, + const float* A, + int lda, + const float* x, + int incx, + const float* beta, + float* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsbmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + int64_t k, + const float* alpha, + const float* A, + int64_t lda, + const float* x, + int64_t incx, + const float* beta, + float* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsbmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + int k, + const double* alpha, + const double* A, + int lda, + const double* x, + int incx, + const double* beta, + double* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsbmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + int64_t k, + const double* alpha, + const double* A, + int64_t lda, + const double* x, + int64_t incx, + const double* beta, + double* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChbmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + int k, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* x, + int incx, + const cuComplex* beta, + cuComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChbmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* x, + int64_t incx, + const cuComplex* beta, + cuComplex* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhbmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + int k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhbmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + int64_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int64_t incy); + +/* SPMV/HPMV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSspmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const float* alpha, + const float* AP, + const float* x, + int incx, + const float* beta, + float* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSspmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const float* alpha, + const float* AP, + const float* x, + int64_t incx, + const float* beta, + float* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDspmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const double* alpha, + const double* AP, + const double* x, + int incx, + const double* beta, + double* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDspmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const double* alpha, + const double* AP, + const double* x, + int64_t incx, + const double* beta, + double* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChpmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuComplex* alpha, + const cuComplex* AP, + const cuComplex* x, + int incx, + const cuComplex* beta, + cuComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChpmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuComplex* alpha, + const cuComplex* AP, + const cuComplex* x, + int64_t incx, + const cuComplex* beta, + cuComplex* y, + int64_t incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhpmv_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* AP, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int incy); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhpmv_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* AP, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int64_t incy); + +/* GER */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSger_v2(cublasHandle_t handle, + int m, + int n, + const float* alpha, + const float* x, + int incx, + const float* y, + int incy, + float* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSger_v2_64(cublasHandle_t handle, + int64_t m, + int64_t n, + const float* alpha, + const float* x, + int64_t incx, + const float* y, + int64_t incy, + float* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDger_v2(cublasHandle_t handle, + int m, + int n, + const double* alpha, + const double* x, + int incx, + const double* y, + int incy, + double* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDger_v2_64(cublasHandle_t handle, + int64_t m, + int64_t n, + const double* alpha, + const double* x, + int64_t incx, + const double* y, + int64_t incy, + double* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgeru_v2(cublasHandle_t handle, + int m, + int n, + const cuComplex* alpha, + const cuComplex* x, + int incx, + const cuComplex* y, + int incy, + cuComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgeru_v2_64(cublasHandle_t handle, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* x, + int64_t incx, + const cuComplex* y, + int64_t incy, + cuComplex* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgerc_v2(cublasHandle_t handle, + int m, + int n, + const cuComplex* alpha, + const cuComplex* x, + int incx, + const cuComplex* y, + int incy, + cuComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgerc_v2_64(cublasHandle_t handle, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* x, + int64_t incx, + const cuComplex* y, + int64_t incy, + cuComplex* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgeru_v2(cublasHandle_t handle, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgeru_v2_64(cublasHandle_t handle, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* y, + int64_t incy, + cuDoubleComplex* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgerc_v2(cublasHandle_t handle, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgerc_v2_64(cublasHandle_t handle, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* y, + int64_t incy, + cuDoubleComplex* A, + int64_t lda); + +/* SYR/HER */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsyr_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const float* alpha, + const float* x, + int incx, + float* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsyr_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const float* alpha, + const float* x, + int64_t incx, + float* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsyr_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const double* alpha, + const double* x, + int incx, + double* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsyr_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const double* alpha, + const double* x, + int64_t incx, + double* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyr_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuComplex* alpha, + const cuComplex* x, + int incx, + cuComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyr_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuComplex* alpha, + const cuComplex* x, + int64_t incx, + cuComplex* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsyr_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int incx, + cuDoubleComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsyr_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int64_t incx, + cuDoubleComplex* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCher_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const float* alpha, + const cuComplex* x, + int incx, + cuComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCher_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const float* alpha, + const cuComplex* x, + int64_t incx, + cuComplex* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZher_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const double* alpha, + const cuDoubleComplex* x, + int incx, + cuDoubleComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZher_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const double* alpha, + const cuDoubleComplex* x, + int64_t incx, + cuDoubleComplex* A, + int64_t lda); + +/* SPR/HPR */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSspr_v2( + cublasHandle_t handle, cublasFillMode_t uplo, int n, const float* alpha, const float* x, int incx, float* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSspr_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const float* alpha, + const float* x, + int64_t incx, + float* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDspr_v2( + cublasHandle_t handle, cublasFillMode_t uplo, int n, const double* alpha, const double* x, int incx, double* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDspr_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const double* alpha, + const double* x, + int64_t incx, + double* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChpr_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const float* alpha, + const cuComplex* x, + int incx, + cuComplex* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChpr_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const float* alpha, + const cuComplex* x, + int64_t incx, + cuComplex* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhpr_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const double* alpha, + const cuDoubleComplex* x, + int incx, + cuDoubleComplex* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhpr_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const double* alpha, + const cuDoubleComplex* x, + int64_t incx, + cuDoubleComplex* AP); + +/* SYR2/HER2 */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsyr2_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const float* alpha, + const float* x, + int incx, + const float* y, + int incy, + float* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsyr2_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const float* alpha, + const float* x, + int64_t incx, + const float* y, + int64_t incy, + float* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsyr2_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const double* alpha, + const double* x, + int incx, + const double* y, + int incy, + double* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsyr2_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const double* alpha, + const double* x, + int64_t incx, + const double* y, + int64_t incy, + double* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyr2_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuComplex* alpha, + const cuComplex* x, + int incx, + const cuComplex* y, + int incy, + cuComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyr2_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuComplex* alpha, + const cuComplex* x, + int64_t incx, + const cuComplex* y, + int64_t incy, + cuComplex* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsyr2_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsyr2_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* y, + int64_t incy, + cuDoubleComplex* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCher2_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuComplex* alpha, + const cuComplex* x, + int incx, + const cuComplex* y, + int incy, + cuComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCher2_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuComplex* alpha, + const cuComplex* x, + int64_t incx, + const cuComplex* y, + int64_t incy, + cuComplex* A, + int64_t lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZher2_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* A, + int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZher2_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* y, + int64_t incy, + cuDoubleComplex* A, + int64_t lda); + +/* SPR2/HPR2 */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSspr2_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const float* alpha, + const float* x, + int incx, + const float* y, + int incy, + float* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSspr2_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const float* alpha, + const float* x, + int64_t incx, + const float* y, + int64_t incy, + float* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDspr2_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const double* alpha, + const double* x, + int incx, + const double* y, + int incy, + double* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDspr2_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const double* alpha, + const double* x, + int64_t incx, + const double* y, + int64_t incy, + double* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChpr2_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuComplex* alpha, + const cuComplex* x, + int incx, + const cuComplex* y, + int incy, + cuComplex* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChpr2_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuComplex* alpha, + const cuComplex* x, + int64_t incx, + const cuComplex* y, + int64_t incy, + cuComplex* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhpr2_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int incx, + const cuDoubleComplex* y, + int incy, + cuDoubleComplex* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhpr2_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* x, + int64_t incx, + const cuDoubleComplex* y, + int64_t incy, + cuDoubleComplex* AP); + +/* BATCH GEMV */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemvBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const float* const Aarray[], + int lda, + const float* const xarray[], + int incx, + const float* beta, + float* const yarray[], + int incy, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemvBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const float* const Aarray[], + int64_t lda, + const float* const xarray[], + int64_t incx, + const float* beta, + float* const yarray[], + int64_t incy, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemvBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const double* alpha, + const double* const Aarray[], + int lda, + const double* const xarray[], + int incx, + const double* beta, + double* const yarray[], + int incy, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemvBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const double* alpha, + const double* const Aarray[], + int64_t lda, + const double* const xarray[], + int64_t incx, + const double* beta, + double* const yarray[], + int64_t incy, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemvBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const cuComplex* alpha, + const cuComplex* const Aarray[], + int lda, + const cuComplex* const xarray[], + int incx, + const cuComplex* beta, + cuComplex* const yarray[], + int incy, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemvBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* const Aarray[], + int64_t lda, + const cuComplex* const xarray[], + int64_t incx, + const cuComplex* beta, + cuComplex* const yarray[], + int64_t incy, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemvBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* const Aarray[], + int lda, + const cuDoubleComplex* const xarray[], + int incx, + const cuDoubleComplex* beta, + cuDoubleComplex* const yarray[], + int incy, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemvBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* const Aarray[], + int64_t lda, + const cuDoubleComplex* const xarray[], + int64_t incx, + const cuDoubleComplex* beta, + cuDoubleComplex* const yarray[], + int64_t incy, + int64_t batchCount); + +#if defined(__cplusplus) + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHSHgemvBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const __half* const Aarray[], + int lda, + const __half* const xarray[], + int incx, + const float* beta, + __half* const yarray[], + int incy, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHSHgemvBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const __half* const Aarray[], + int64_t lda, + const __half* const xarray[], + int64_t incx, + const float* beta, + __half* const yarray[], + int64_t incy, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHSSgemvBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const __half* const Aarray[], + int lda, + const __half* const xarray[], + int incx, + const float* beta, + float* const yarray[], + int incy, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHSSgemvBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const __half* const Aarray[], + int64_t lda, + const __half* const xarray[], + int64_t incx, + const float* beta, + float* const yarray[], + int64_t incy, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasTSTgemvBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const __nv_bfloat16* const Aarray[], + int lda, + const __nv_bfloat16* const xarray[], + int incx, + const float* beta, + __nv_bfloat16* const yarray[], + int incy, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasTSTgemvBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const __nv_bfloat16* const Aarray[], + int64_t lda, + const __nv_bfloat16* const xarray[], + int64_t incx, + const float* beta, + __nv_bfloat16* const yarray[], + int64_t incy, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasTSSgemvBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const __nv_bfloat16* const Aarray[], + int lda, + const __nv_bfloat16* const xarray[], + int incx, + const float* beta, + float* const yarray[], + int incy, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasTSSgemvBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const __nv_bfloat16* const Aarray[], + int64_t lda, + const __nv_bfloat16* const xarray[], + int64_t incx, + const float* beta, + float* const yarray[], + int64_t incy, + int64_t batchCount); + +#endif + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemvStridedBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const float* A, + int lda, + long long int strideA, + const float* x, + int incx, + long long int stridex, + const float* beta, + float* y, + int incy, + long long int stridey, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemvStridedBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const float* A, + int64_t lda, + long long int strideA, + const float* x, + int64_t incx, + long long int stridex, + const float* beta, + float* y, + int64_t incy, + long long int stridey, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemvStridedBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const double* alpha, + const double* A, + int lda, + long long int strideA, + const double* x, + int incx, + long long int stridex, + const double* beta, + double* y, + int incy, + long long int stridey, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemvStridedBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const double* alpha, + const double* A, + int64_t lda, + long long int strideA, + const double* x, + int64_t incx, + long long int stridex, + const double* beta, + double* y, + int64_t incy, + long long int stridey, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemvStridedBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const cuComplex* alpha, + const cuComplex* A, + int lda, + long long int strideA, + const cuComplex* x, + int incx, + long long int stridex, + const cuComplex* beta, + cuComplex* y, + int incy, + long long int stridey, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemvStridedBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + long long int strideA, + const cuComplex* x, + int64_t incx, + long long int stridex, + const cuComplex* beta, + cuComplex* y, + int64_t incy, + long long int stridey, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemvStridedBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + long long int strideA, + const cuDoubleComplex* x, + int incx, + long long int stridex, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int incy, + long long int stridey, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemvStridedBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + long long int strideA, + const cuDoubleComplex* x, + int64_t incx, + long long int stridex, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + int64_t incy, + long long int stridey, + int64_t batchCount); + +#if defined(__cplusplus) + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHSHgemvStridedBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const __half* A, + int lda, + long long int strideA, + const __half* x, + int incx, + long long int stridex, + const float* beta, + __half* y, + int incy, + long long int stridey, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHSHgemvStridedBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const __half* A, + int64_t lda, + long long int strideA, + const __half* x, + int64_t incx, + long long int stridex, + const float* beta, + __half* y, + int64_t incy, + long long int stridey, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHSSgemvStridedBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const __half* A, + int lda, + long long int strideA, + const __half* x, + int incx, + long long int stridex, + const float* beta, + float* y, + int incy, + long long int stridey, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHSSgemvStridedBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const __half* A, + int64_t lda, + long long int strideA, + const __half* x, + int64_t incx, + long long int stridex, + const float* beta, + float* y, + int64_t incy, + long long int stridey, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasTSTgemvStridedBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const __nv_bfloat16* A, + int lda, + long long int strideA, + const __nv_bfloat16* x, + int incx, + long long int stridex, + const float* beta, + __nv_bfloat16* y, + int incy, + long long int stridey, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasTSTgemvStridedBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const __nv_bfloat16* A, + int64_t lda, + long long int strideA, + const __nv_bfloat16* x, + int64_t incx, + long long int stridex, + const float* beta, + __nv_bfloat16* y, + int64_t incy, + long long int stridey, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasTSSgemvStridedBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + const float* alpha, + const __nv_bfloat16* A, + int lda, + long long int strideA, + const __nv_bfloat16* x, + int incx, + long long int stridex, + const float* beta, + float* y, + int incy, + long long int stridey, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasTSSgemvStridedBatched_64(cublasHandle_t handle, + cublasOperation_t trans, + int64_t m, + int64_t n, + const float* alpha, + const __nv_bfloat16* A, + int64_t lda, + long long int strideA, + const __nv_bfloat16* x, + int64_t incx, + long long int stridex, + const float* beta, + float* y, + int64_t incy, + long long int stridey, + int64_t batchCount); + +#endif + +/* ---------------- CUBLAS BLAS3 Functions ---------------- */ + +/* GEMM */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemm_v2(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const float* alpha, + const float* A, + int lda, + const float* B, + int ldb, + const float* beta, + float* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemm_v2_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const float* alpha, + const float* A, + int64_t lda, + const float* B, + int64_t ldb, + const float* beta, + float* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemm_v2(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const double* alpha, + const double* A, + int lda, + const double* B, + int ldb, + const double* beta, + double* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemm_v2_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const double* alpha, + const double* A, + int64_t lda, + const double* B, + int64_t ldb, + const double* beta, + double* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemm_v2(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + const cuComplex* beta, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemm_v2_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* B, + int64_t ldb, + const cuComplex* beta, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemm3m(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + const cuComplex* beta, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemm3m_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* B, + int64_t ldb, + const cuComplex* beta, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemm3mEx(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuComplex* alpha, + const void* A, + cudaDataType Atype, + int lda, + const void* B, + cudaDataType Btype, + int ldb, + const cuComplex* beta, + void* C, + cudaDataType Ctype, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemm3mEx_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuComplex* alpha, + const void* A, + cudaDataType Atype, + int64_t lda, + const void* B, + cudaDataType Btype, + int64_t ldb, + const cuComplex* beta, + void* C, + cudaDataType Ctype, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemm_v2(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemm_v2_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* B, + int64_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemm3m(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemm3m_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* B, + int64_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int64_t ldc); + +#if defined(__cplusplus) + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHgemm(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const __half* alpha, + const __half* A, + int lda, + const __half* B, + int ldb, + const __half* beta, + __half* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHgemm_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const __half* alpha, + const __half* A, + int64_t lda, + const __half* B, + int64_t ldb, + const __half* beta, + __half* C, + int64_t ldc); + +#endif + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemmEx(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const float* alpha, + const void* A, + cudaDataType Atype, + int lda, + const void* B, + cudaDataType Btype, + int ldb, + const float* beta, + void* C, + cudaDataType Ctype, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemmEx_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const float* alpha, + const void* A, + cudaDataType Atype, + int64_t lda, + const void* B, + cudaDataType Btype, + int64_t ldb, + const float* beta, + void* C, + cudaDataType Ctype, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGemmEx(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const void* alpha, + const void* A, + cudaDataType Atype, + int lda, + const void* B, + cudaDataType Btype, + int ldb, + const void* beta, + void* C, + cudaDataType Ctype, + int ldc, + cublasComputeType_t computeType, + cublasGemmAlgo_t algo); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGemmEx_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const void* alpha, + const void* A, + cudaDataType Atype, + int64_t lda, + const void* B, + cudaDataType Btype, + int64_t ldb, + const void* beta, + void* C, + cudaDataType Ctype, + int64_t ldc, + cublasComputeType_t computeType, + cublasGemmAlgo_t algo); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemmEx(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuComplex* alpha, + const void* A, + cudaDataType Atype, + int lda, + const void* B, + cudaDataType Btype, + int ldb, + const cuComplex* beta, + void* C, + cudaDataType Ctype, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemmEx_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuComplex* alpha, + const void* A, + cudaDataType Atype, + int64_t lda, + const void* B, + cudaDataType Btype, + int64_t ldb, + const cuComplex* beta, + void* C, + cudaDataType Ctype, + int64_t ldc); + +/* SYRK */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsyrk_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const float* alpha, + const float* A, + int lda, + const float* beta, + float* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsyrk_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const float* alpha, + const float* A, + int64_t lda, + const float* beta, + float* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsyrk_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const double* alpha, + const double* A, + int lda, + const double* beta, + double* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsyrk_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const double* alpha, + const double* A, + int64_t lda, + const double* beta, + double* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyrk_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* beta, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyrk_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* beta, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsyrk_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsyrk_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyrkEx(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuComplex* alpha, + const void* A, + cudaDataType Atype, + int lda, + const cuComplex* beta, + void* C, + cudaDataType Ctype, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyrkEx_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuComplex* alpha, + const void* A, + cudaDataType Atype, + int64_t lda, + const cuComplex* beta, + void* C, + cudaDataType Ctype, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyrk3mEx(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuComplex* alpha, + const void* A, + cudaDataType Atype, + int lda, + const cuComplex* beta, + void* C, + cudaDataType Ctype, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyrk3mEx_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuComplex* alpha, + const void* A, + cudaDataType Atype, + int64_t lda, + const cuComplex* beta, + void* C, + cudaDataType Ctype, + int64_t ldc); + +/* HERK */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCherk_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const float* alpha, + const cuComplex* A, + int lda, + const float* beta, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCherk_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const float* alpha, + const cuComplex* A, + int64_t lda, + const float* beta, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZherk_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const double* alpha, + const cuDoubleComplex* A, + int lda, + const double* beta, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZherk_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const double* alpha, + const cuDoubleComplex* A, + int64_t lda, + const double* beta, + cuDoubleComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCherkEx(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const float* alpha, + const void* A, + cudaDataType Atype, + int lda, + const float* beta, + void* C, + cudaDataType Ctype, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCherkEx_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const float* alpha, + const void* A, + cudaDataType Atype, + int64_t lda, + const float* beta, + void* C, + cudaDataType Ctype, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCherk3mEx(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const float* alpha, + const void* A, + cudaDataType Atype, + int lda, + const float* beta, + void* C, + cudaDataType Ctype, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCherk3mEx_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const float* alpha, + const void* A, + cudaDataType Atype, + int64_t lda, + const float* beta, + void* C, + cudaDataType Ctype, + int64_t ldc); + +/* SYR2K / HER2K */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsyr2k_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const float* alpha, + const float* A, + int lda, + const float* B, + int ldb, + const float* beta, + float* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsyr2k_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const float* alpha, + const float* A, + int64_t lda, + const float* B, + int64_t ldb, + const float* beta, + float* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsyr2k_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const double* alpha, + const double* A, + int lda, + const double* B, + int ldb, + const double* beta, + double* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsyr2k_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const double* alpha, + const double* A, + int64_t lda, + const double* B, + int64_t ldb, + const double* beta, + double* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyr2k_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + const cuComplex* beta, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyr2k_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* B, + int64_t ldb, + const cuComplex* beta, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsyr2k_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsyr2k_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* B, + int64_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCher2k_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + const float* beta, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCher2k_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* B, + int64_t ldb, + const float* beta, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZher2k_v2(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + const double* beta, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZher2k_v2_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* B, + int64_t ldb, + const double* beta, + cuDoubleComplex* C, + int64_t ldc); + +/* SYRKX / HERKX */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsyrkx(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const float* alpha, + const float* A, + int lda, + const float* B, + int ldb, + const float* beta, + float* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsyrkx_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const float* alpha, + const float* A, + int64_t lda, + const float* B, + int64_t ldb, + const float* beta, + float* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsyrkx(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const double* alpha, + const double* A, + int lda, + const double* B, + int ldb, + const double* beta, + double* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsyrkx_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const double* alpha, + const double* A, + int64_t lda, + const double* B, + int64_t ldb, + const double* beta, + double* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyrkx(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + const cuComplex* beta, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsyrkx_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* B, + int64_t ldb, + const cuComplex* beta, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsyrkx(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsyrkx_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* B, + int64_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCherkx(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + const float* beta, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCherkx_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* B, + int64_t ldb, + const float* beta, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZherkx(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int n, + int k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + const double* beta, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZherkx_64(cublasHandle_t handle, + cublasFillMode_t uplo, + cublasOperation_t trans, + int64_t n, + int64_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* B, + int64_t ldb, + const double* beta, + cuDoubleComplex* C, + int64_t ldc); + +/* SYMM */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsymm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int m, + int n, + const float* alpha, + const float* A, + int lda, + const float* B, + int ldb, + const float* beta, + float* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSsymm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int64_t m, + int64_t n, + const float* alpha, + const float* A, + int64_t lda, + const float* B, + int64_t ldb, + const float* beta, + float* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsymm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int m, + int n, + const double* alpha, + const double* A, + int lda, + const double* B, + int ldb, + const double* beta, + double* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDsymm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int64_t m, + int64_t n, + const double* alpha, + const double* A, + int64_t lda, + const double* B, + int64_t ldb, + const double* beta, + double* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsymm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int m, + int n, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + const cuComplex* beta, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCsymm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* B, + int64_t ldb, + const cuComplex* beta, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsymm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZsymm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* B, + int64_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int64_t ldc); + +/* HEMM */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChemm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int m, + int n, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + const cuComplex* beta, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasChemm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* B, + int64_t ldb, + const cuComplex* beta, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhemm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZhemm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* B, + int64_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int64_t ldc); + +/* TRSM */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStrsm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const float* alpha, + const float* A, + int lda, + float* B, + int ldb); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStrsm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const float* alpha, + const float* A, + int64_t lda, + float* B, + int64_t ldb); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtrsm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const double* alpha, + const double* A, + int lda, + double* B, + int ldb); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtrsm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const double* alpha, + const double* A, + int64_t lda, + double* B, + int64_t ldb); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtrsm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const cuComplex* alpha, + const cuComplex* A, + int lda, + cuComplex* B, + int ldb); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtrsm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + cuComplex* B, + int64_t ldb); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrsm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + cuDoubleComplex* B, + int ldb); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrsm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + cuDoubleComplex* B, + int64_t ldb); + +/* TRMM */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStrmm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const float* alpha, + const float* A, + int lda, + const float* B, + int ldb, + float* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStrmm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const float* alpha, + const float* A, + int64_t lda, + const float* B, + int64_t ldb, + float* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtrmm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const double* alpha, + const double* A, + int lda, + const double* B, + int ldb, + double* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtrmm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const double* alpha, + const double* A, + int64_t lda, + const double* B, + int64_t ldb, + double* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtrmm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* B, + int ldb, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtrmm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* B, + int64_t ldb, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrmm_v2(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* B, + int ldb, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrmm_v2_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* B, + int64_t ldb, + cuDoubleComplex* C, + int64_t ldc); + +/* BATCH GEMM */ + +#if defined(__cplusplus) + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHgemmBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const __half* alpha, + const __half* const Aarray[], + int lda, + const __half* const Barray[], + int ldb, + const __half* beta, + __half* const Carray[], + int ldc, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHgemmBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const __half* alpha, + const __half* const Aarray[], + int64_t lda, + const __half* const Barray[], + int64_t ldb, + const __half* beta, + __half* const Carray[], + int64_t ldc, + int64_t batchCount); + +#endif + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemmBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const float* alpha, + const float* const Aarray[], + int lda, + const float* const Barray[], + int ldb, + const float* beta, + float* const Carray[], + int ldc, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemmBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const float* alpha, + const float* const Aarray[], + int64_t lda, + const float* const Barray[], + int64_t ldb, + const float* beta, + float* const Carray[], + int64_t ldc, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemmBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const double* alpha, + const double* const Aarray[], + int lda, + const double* const Barray[], + int ldb, + const double* beta, + double* const Carray[], + int ldc, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemmBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const double* alpha, + const double* const Aarray[], + int64_t lda, + const double* const Barray[], + int64_t ldb, + const double* beta, + double* const Carray[], + int64_t ldc, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemmBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuComplex* alpha, + const cuComplex* const Aarray[], + int lda, + const cuComplex* const Barray[], + int ldb, + const cuComplex* beta, + cuComplex* const Carray[], + int ldc, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemmBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* const Aarray[], + int64_t lda, + const cuComplex* const Barray[], + int64_t ldb, + const cuComplex* beta, + cuComplex* const Carray[], + int64_t ldc, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemm3mBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuComplex* alpha, + const cuComplex* const Aarray[], + int lda, + const cuComplex* const Barray[], + int ldb, + const cuComplex* beta, + cuComplex* const Carray[], + int ldc, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemm3mBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* const Aarray[], + int64_t lda, + const cuComplex* const Barray[], + int64_t ldb, + const cuComplex* beta, + cuComplex* const Carray[], + int64_t ldc, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemmBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* const Aarray[], + int lda, + const cuDoubleComplex* const Barray[], + int ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* const Carray[], + int ldc, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemmBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* const Aarray[], + int64_t lda, + const cuDoubleComplex* const Barray[], + int64_t ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* const Carray[], + int64_t ldc, + int64_t batchCount); + +#if defined(__cplusplus) + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHgemmStridedBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const __half* alpha, + const __half* A, + int lda, + long long int strideA, + const __half* B, + int ldb, + long long int strideB, + const __half* beta, + __half* C, + int ldc, + long long int strideC, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasHgemmStridedBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const __half* alpha, + const __half* A, + int64_t lda, + long long int strideA, + const __half* B, + int64_t ldb, + long long int strideB, + const __half* beta, + __half* C, + int64_t ldc, + long long int strideC, + int64_t batchCount); + +#endif + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemmStridedBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const float* alpha, + const float* A, + int lda, + long long int strideA, + const float* B, + int ldb, + long long int strideB, + const float* beta, + float* C, + int ldc, + long long int strideC, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemmStridedBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const float* alpha, + const float* A, + int64_t lda, + long long int strideA, + const float* B, + int64_t ldb, + long long int strideB, + const float* beta, + float* C, + int64_t ldc, + long long int strideC, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemmStridedBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const double* alpha, + const double* A, + int lda, + long long int strideA, + const double* B, + int ldb, + long long int strideB, + const double* beta, + double* C, + int ldc, + long long int strideC, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemmStridedBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const double* alpha, + const double* A, + int64_t lda, + long long int strideA, + const double* B, + int64_t ldb, + long long int strideB, + const double* beta, + double* C, + int64_t ldc, + long long int strideC, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemmStridedBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuComplex* alpha, + const cuComplex* A, + int lda, + long long int strideA, + const cuComplex* B, + int ldb, + long long int strideB, + const cuComplex* beta, + cuComplex* C, + int ldc, + long long int strideC, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemmStridedBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + long long int strideA, + const cuComplex* B, + int64_t ldb, + long long int strideB, + const cuComplex* beta, + cuComplex* C, + int64_t ldc, + long long int strideC, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemm3mStridedBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuComplex* alpha, + const cuComplex* A, + int lda, + long long int strideA, + const cuComplex* B, + int ldb, + long long int strideB, + const cuComplex* beta, + cuComplex* C, + int ldc, + long long int strideC, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgemm3mStridedBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + long long int strideA, + const cuComplex* B, + int64_t ldb, + long long int strideB, + const cuComplex* beta, + cuComplex* C, + int64_t ldc, + long long int strideC, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemmStridedBatched(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + long long int strideA, + const cuDoubleComplex* B, + int ldb, + long long int strideB, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int ldc, + long long int strideC, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgemmStridedBatched_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + long long int strideA, + const cuDoubleComplex* B, + int64_t ldb, + long long int strideB, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int64_t ldc, + long long int strideC, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGemmBatchedEx(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const void* alpha, + const void* const Aarray[], + cudaDataType Atype, + int lda, + const void* const Barray[], + cudaDataType Btype, + int ldb, + const void* beta, + void* const Carray[], + cudaDataType Ctype, + int ldc, + int batchCount, + cublasComputeType_t computeType, + cublasGemmAlgo_t algo); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGemmBatchedEx_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const void* alpha, + const void* const Aarray[], + cudaDataType Atype, + int64_t lda, + const void* const Barray[], + cudaDataType Btype, + int64_t ldb, + const void* beta, + void* const Carray[], + cudaDataType Ctype, + int64_t ldc, + int64_t batchCount, + cublasComputeType_t computeType, + cublasGemmAlgo_t algo); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGemmStridedBatchedEx(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const void* alpha, + const void* A, + cudaDataType Atype, + int lda, + long long int strideA, + const void* B, + cudaDataType Btype, + int ldb, + long long int strideB, + const void* beta, + void* C, + cudaDataType Ctype, + int ldc, + long long int strideC, + int batchCount, + cublasComputeType_t computeType, + cublasGemmAlgo_t algo); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasGemmStridedBatchedEx_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + int64_t k, + const void* alpha, + const void* A, + cudaDataType Atype, + int64_t lda, + long long int strideA, + const void* B, + cudaDataType Btype, + int64_t ldb, + long long int strideB, + const void* beta, + void* C, + cudaDataType Ctype, + int64_t ldc, + long long int strideC, + int64_t batchCount, + cublasComputeType_t computeType, + cublasGemmAlgo_t algo); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemmGroupedBatched(cublasHandle_t handle, + const cublasOperation_t transa_array[], + const cublasOperation_t transb_array[], + const int m_array[], + const int n_array[], + const int k_array[], + const float alpha_array[], + const float* const Aarray[], + const int lda_array[], + const float* const Barray[], + const int ldb_array[], + const float beta_array[], + float* const Carray[], + const int ldc_array[], + int group_count, + const int group_size[]); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgemmGroupedBatched_64(cublasHandle_t handle, + const cublasOperation_t transa_array[], + const cublasOperation_t transb_array[], + const int64_t m_array[], + const int64_t n_array[], + const int64_t k_array[], + const float alpha_array[], + const float* const Aarray[], + const int64_t lda_array[], + const float* const Barray[], + const int64_t ldb_array[], + const float beta_array[], + float* const Carray[], + const int64_t ldc_array[], + int64_t group_count, + const int64_t group_size[]); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemmGroupedBatched(cublasHandle_t handle, + const cublasOperation_t transa_array[], + const cublasOperation_t transb_array[], + const int m_array[], + const int n_array[], + const int k_array[], + const double alpha_array[], + const double* const Aarray[], + const int lda_array[], + const double* const Barray[], + const int ldb_array[], + const double beta_array[], + double* const Carray[], + const int ldc_array[], + int group_count, + const int group_size[]); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgemmGroupedBatched_64(cublasHandle_t handle, + const cublasOperation_t transa_array[], + const cublasOperation_t transb_array[], + const int64_t m_array[], + const int64_t n_array[], + const int64_t k_array[], + const double alpha_array[], + const double* const Aarray[], + const int64_t lda_array[], + const double* const Barray[], + const int64_t ldb_array[], + const double beta_array[], + double* const Carray[], + const int64_t ldc_array[], + int64_t group_count, + const int64_t group_size[]); + +/* ---------------- CUBLAS BLAS-like Extension ---------------- */ + +/* GEAM */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgeam(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + const float* alpha, + const float* A, + int lda, + const float* beta, + const float* B, + int ldb, + float* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgeam_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + const float* alpha, + const float* A, + int64_t lda, + const float* beta, + const float* B, + int64_t ldb, + float* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgeam(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + const double* alpha, + const double* A, + int lda, + const double* beta, + const double* B, + int ldb, + double* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgeam_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + const double* alpha, + const double* A, + int64_t lda, + const double* beta, + const double* B, + int64_t ldb, + double* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgeam(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + const cuComplex* alpha, + const cuComplex* A, + int lda, + const cuComplex* beta, + const cuComplex* B, + int ldb, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgeam_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* A, + int64_t lda, + const cuComplex* beta, + const cuComplex* B, + int64_t ldb, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgeam(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* beta, + const cuDoubleComplex* B, + int ldb, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgeam_64(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* beta, + const cuDoubleComplex* B, + int64_t ldb, + cuDoubleComplex* C, + int64_t ldc); + +/* TRSM - Batched Triangular Solver */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStrsmBatched(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const float* alpha, + const float* const A[], + int lda, + float* const B[], + int ldb, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasStrsmBatched_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const float* alpha, + const float* const A[], + int64_t lda, + float* const B[], + int64_t ldb, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtrsmBatched(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const double* alpha, + const double* const A[], + int lda, + double* const B[], + int ldb, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDtrsmBatched_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const double* alpha, + const double* const A[], + int64_t lda, + double* const B[], + int64_t ldb, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtrsmBatched(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const cuComplex* alpha, + const cuComplex* const A[], + int lda, + cuComplex* const B[], + int ldb, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCtrsmBatched_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const cuComplex* alpha, + const cuComplex* const A[], + int64_t lda, + cuComplex* const B[], + int64_t ldb, + int64_t batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrsmBatched(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* const A[], + int lda, + cuDoubleComplex* const B[], + int ldb, + int batchCount); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrsmBatched_64(cublasHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + cublasDiagType_t diag, + int64_t m, + int64_t n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* const A[], + int64_t lda, + cuDoubleComplex* const B[], + int64_t ldb, + int64_t batchCount); + +/* DGMM */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSdgmm(cublasHandle_t handle, + cublasSideMode_t mode, + int m, + int n, + const float* A, + int lda, + const float* x, + int incx, + float* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSdgmm_64(cublasHandle_t handle, + cublasSideMode_t mode, + int64_t m, + int64_t n, + const float* A, + int64_t lda, + const float* x, + int64_t incx, + float* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDdgmm(cublasHandle_t handle, + cublasSideMode_t mode, + int m, + int n, + const double* A, + int lda, + const double* x, + int incx, + double* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDdgmm_64(cublasHandle_t handle, + cublasSideMode_t mode, + int64_t m, + int64_t n, + const double* A, + int64_t lda, + const double* x, + int64_t incx, + double* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCdgmm(cublasHandle_t handle, + cublasSideMode_t mode, + int m, + int n, + const cuComplex* A, + int lda, + const cuComplex* x, + int incx, + cuComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCdgmm_64(cublasHandle_t handle, + cublasSideMode_t mode, + int64_t m, + int64_t n, + const cuComplex* A, + int64_t lda, + const cuComplex* x, + int64_t incx, + cuComplex* C, + int64_t ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZdgmm(cublasHandle_t handle, + cublasSideMode_t mode, + int m, + int n, + const cuDoubleComplex* A, + int lda, + const cuDoubleComplex* x, + int incx, + cuDoubleComplex* C, + int ldc); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZdgmm_64(cublasHandle_t handle, + cublasSideMode_t mode, + int64_t m, + int64_t n, + const cuDoubleComplex* A, + int64_t lda, + const cuDoubleComplex* x, + int64_t incx, + cuDoubleComplex* C, + int64_t ldc); + +/* Batched - MATINV*/ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSmatinvBatched(cublasHandle_t handle, + int n, + const float* const A[], + int lda, + float* const Ainv[], + int lda_inv, + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDmatinvBatched(cublasHandle_t handle, + int n, + const double* const A[], + int lda, + double* const Ainv[], + int lda_inv, + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCmatinvBatched(cublasHandle_t handle, + int n, + const cuComplex* const A[], + int lda, + cuComplex* const Ainv[], + int lda_inv, + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZmatinvBatched(cublasHandle_t handle, + int n, + const cuDoubleComplex* const A[], + int lda, + cuDoubleComplex* const Ainv[], + int lda_inv, + int* info, + int batchSize); + +/* Batch QR Factorization */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgeqrfBatched(cublasHandle_t handle, + int m, + int n, + float* const Aarray[], + int lda, + float* const TauArray[], + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgeqrfBatched(cublasHandle_t handle, + int m, + int n, + double* const Aarray[], + int lda, + double* const TauArray[], + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgeqrfBatched(cublasHandle_t handle, + int m, + int n, + cuComplex* const Aarray[], + int lda, + cuComplex* const TauArray[], + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgeqrfBatched(cublasHandle_t handle, + int m, + int n, + cuDoubleComplex* const Aarray[], + int lda, + cuDoubleComplex* const TauArray[], + int* info, + int batchSize); + +/* Least Square Min only m >= n and Non-transpose supported */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgelsBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + int nrhs, + float* const Aarray[], + int lda, + float* const Carray[], + int ldc, + int* info, + int* devInfoArray, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgelsBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + int nrhs, + double* const Aarray[], + int lda, + double* const Carray[], + int ldc, + int* info, + int* devInfoArray, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgelsBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + int nrhs, + cuComplex* const Aarray[], + int lda, + cuComplex* const Carray[], + int ldc, + int* info, + int* devInfoArray, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgelsBatched(cublasHandle_t handle, + cublasOperation_t trans, + int m, + int n, + int nrhs, + cuDoubleComplex* const Aarray[], + int lda, + cuDoubleComplex* const Carray[], + int ldc, + int* info, + int* devInfoArray, + int batchSize); + +/* TPTTR : Triangular Pack format to Triangular format */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasStpttr(cublasHandle_t handle, cublasFillMode_t uplo, int n, const float* AP, float* A, int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDtpttr(cublasHandle_t handle, cublasFillMode_t uplo, int n, const double* AP, double* A, int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCtpttr(cublasHandle_t handle, cublasFillMode_t uplo, int n, const cuComplex* AP, cuComplex* A, int lda); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtpttr( + cublasHandle_t handle, cublasFillMode_t uplo, int n, const cuDoubleComplex* AP, cuDoubleComplex* A, int lda); + +/* TRTTP : Triangular format to Triangular Pack format */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasStrttp(cublasHandle_t handle, cublasFillMode_t uplo, int n, const float* A, int lda, float* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDtrttp(cublasHandle_t handle, cublasFillMode_t uplo, int n, const double* A, int lda, double* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCtrttp(cublasHandle_t handle, cublasFillMode_t uplo, int n, const cuComplex* A, int lda, cuComplex* AP); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZtrttp( + cublasHandle_t handle, cublasFillMode_t uplo, int n, const cuDoubleComplex* A, int lda, cuDoubleComplex* AP); + +/* Batched LU - GETRF*/ + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasSgetrfBatched(cublasHandle_t handle, int n, float* const A[], int lda, int* P, int* info, int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasDgetrfBatched(cublasHandle_t handle, int n, double* const A[], int lda, int* P, int* info, int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI +cublasCgetrfBatched(cublasHandle_t handle, int n, cuComplex* const A[], int lda, int* P, int* info, int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgetrfBatched( + cublasHandle_t handle, int n, cuDoubleComplex* const A[], int lda, int* P, int* info, int batchSize); + +/* Batched inversion based on LU factorization from getrf */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgetriBatched(cublasHandle_t handle, + int n, + const float* const A[], + int lda, + const int* P, + float* const C[], + int ldc, + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgetriBatched(cublasHandle_t handle, + int n, + const double* const A[], + int lda, + const int* P, + double* const C[], + int ldc, + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgetriBatched(cublasHandle_t handle, + int n, + const cuComplex* const A[], + int lda, + const int* P, + cuComplex* const C[], + int ldc, + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgetriBatched(cublasHandle_t handle, + int n, + const cuDoubleComplex* const A[], + int lda, + const int* P, + cuDoubleComplex* const C[], + int ldc, + int* info, + int batchSize); + +/* Batched solver based on LU factorization from getrf */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasSgetrsBatched(cublasHandle_t handle, + cublasOperation_t trans, + int n, + int nrhs, + const float* const Aarray[], + int lda, + const int* devIpiv, + float* const Barray[], + int ldb, + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasDgetrsBatched(cublasHandle_t handle, + cublasOperation_t trans, + int n, + int nrhs, + const double* const Aarray[], + int lda, + const int* devIpiv, + double* const Barray[], + int ldb, + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasCgetrsBatched(cublasHandle_t handle, + cublasOperation_t trans, + int n, + int nrhs, + const cuComplex* const Aarray[], + int lda, + const int* devIpiv, + cuComplex* const Barray[], + int ldb, + int* info, + int batchSize); + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasZgetrsBatched(cublasHandle_t handle, + cublasOperation_t trans, + int n, + int nrhs, + const cuDoubleComplex* const Aarray[], + int lda, + const int* devIpiv, + cuDoubleComplex* const Barray[], + int ldb, + int* info, + int batchSize); + +/* Deprecated */ + +CUBLASAPI cublasStatus_t CUBLASWINAPI cublasUint8gemmBias(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + cublasOperation_t transc, + int m, + int n, + int k, + const unsigned char* A, + int A_bias, + int lda, + const unsigned char* B, + int B_bias, + int ldb, + unsigned char* C, + int C_bias, + int ldc, + int C_mult, + int C_shift); + +/* }}} cuBLAS Exported API */ + +#if defined(__cplusplus) +} + +static inline cublasStatus_t cublasMigrateComputeType(cublasHandle_t handle, + cudaDataType_t dataType, + cublasComputeType_t* computeType) { + cublasMath_t mathMode = CUBLAS_DEFAULT_MATH; + cublasStatus_t status = CUBLAS_STATUS_SUCCESS; + + status = cublasGetMathMode(handle, &mathMode); + if (status != CUBLAS_STATUS_SUCCESS) { + return status; + } + + bool isPedantic = ((mathMode & 0xf) == CUBLAS_PEDANTIC_MATH); + + switch (dataType) { + case CUDA_R_32F: + case CUDA_C_32F: + *computeType = isPedantic ? CUBLAS_COMPUTE_32F_PEDANTIC : CUBLAS_COMPUTE_32F; + return CUBLAS_STATUS_SUCCESS; + case CUDA_R_64F: + case CUDA_C_64F: + *computeType = isPedantic ? CUBLAS_COMPUTE_64F_PEDANTIC : CUBLAS_COMPUTE_64F; + return CUBLAS_STATUS_SUCCESS; + case CUDA_R_16F: + *computeType = isPedantic ? CUBLAS_COMPUTE_16F_PEDANTIC : CUBLAS_COMPUTE_16F; + return CUBLAS_STATUS_SUCCESS; + case CUDA_R_32I: + *computeType = isPedantic ? CUBLAS_COMPUTE_32I_PEDANTIC : CUBLAS_COMPUTE_32I; + return CUBLAS_STATUS_SUCCESS; + default: + return CUBLAS_STATUS_NOT_SUPPORTED; + } +} +/* wrappers to accept old code with cudaDataType computeType when referenced from c++ code */ +static inline cublasStatus_t cublasGemmEx(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const void* alpha, /* host or device pointer */ + const void* A, + cudaDataType Atype, + int lda, + const void* B, + cudaDataType Btype, + int ldb, + const void* beta, /* host or device pointer */ + void* C, + cudaDataType Ctype, + int ldc, + cudaDataType computeType, + cublasGemmAlgo_t algo) { + cublasComputeType_t migratedComputeType = CUBLAS_COMPUTE_32F; + cublasStatus_t status = CUBLAS_STATUS_SUCCESS; + status = cublasMigrateComputeType(handle, computeType, &migratedComputeType); + if (status != CUBLAS_STATUS_SUCCESS) { + return status; + } + + return cublasGemmEx(handle, + transa, + transb, + m, + n, + k, + alpha, + A, + Atype, + lda, + B, + Btype, + ldb, + beta, + C, + Ctype, + ldc, + migratedComputeType, + algo); +} + +static inline cublasStatus_t cublasGemmBatchedEx(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const void* alpha, /* host or device pointer */ + const void* const Aarray[], + cudaDataType Atype, + int lda, + const void* const Barray[], + cudaDataType Btype, + int ldb, + const void* beta, /* host or device pointer */ + void* const Carray[], + cudaDataType Ctype, + int ldc, + int batchCount, + cudaDataType computeType, + cublasGemmAlgo_t algo) { + cublasComputeType_t migratedComputeType; + cublasStatus_t status; + status = cublasMigrateComputeType(handle, computeType, &migratedComputeType); + if (status != CUBLAS_STATUS_SUCCESS) { + return status; + } + + return cublasGemmBatchedEx(handle, + transa, + transb, + m, + n, + k, + alpha, + Aarray, + Atype, + lda, + Barray, + Btype, + ldb, + beta, + Carray, + Ctype, + ldc, + batchCount, + migratedComputeType, + algo); +} + +static inline cublasStatus_t cublasGemmStridedBatchedEx(cublasHandle_t handle, + cublasOperation_t transa, + cublasOperation_t transb, + int m, + int n, + int k, + const void* alpha, /* host or device pointer */ + const void* A, + cudaDataType Atype, + int lda, + long long int strideA, /* purposely signed */ + const void* B, + cudaDataType Btype, + int ldb, + long long int strideB, + const void* beta, /* host or device pointer */ + void* C, + cudaDataType Ctype, + int ldc, + long long int strideC, + int batchCount, + cudaDataType computeType, + cublasGemmAlgo_t algo) { + cublasComputeType_t migratedComputeType; + cublasStatus_t status; + status = cublasMigrateComputeType(handle, computeType, &migratedComputeType); + if (status != CUBLAS_STATUS_SUCCESS) { + return status; + } + + return cublasGemmStridedBatchedEx(handle, + transa, + transb, + m, + n, + k, + alpha, + A, + Atype, + lda, + strideA, + B, + Btype, + ldb, + strideB, + beta, + C, + Ctype, + ldc, + strideC, + batchCount, + migratedComputeType, + algo); +} +#endif /* __cplusplus */ + +#endif /* !defined(CUBLAS_API_H_) */ diff --git a/cuda_toolkit/include/cublas_v2.h b/cuda_toolkit/include/cublas_v2.h new file mode 100644 index 0000000000000000000000000000000000000000..bf8820025eb373d083e80f7092bd8d1113a7e1cb --- /dev/null +++ b/cuda_toolkit/include/cublas_v2.h @@ -0,0 +1,478 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/* + * This is the public header file for the new CUBLAS library API, it mapped the generic + * Cublas name functions to the actual _v2 implementations. + */ + +#if !defined(CUBLAS_V2_H_) +#define CUBLAS_V2_H_ + +#if defined(CUBLAS_H_) +#error "It is an error to include both cublas.h and cublas_v2.h" +#endif + +#undef CUBLASAPI +#ifdef __CUDACC__ +#define CUBLASAPI __host__ __device__ +#else +#define CUBLASAPI +#endif + +#include "cublas_api.h" + +#define cublasCreate cublasCreate_v2 +#define cublasDestroy cublasDestroy_v2 +#define cublasGetVersion cublasGetVersion_v2 +#define cublasSetWorkspace cublasSetWorkspace_v2 +#define cublasSetStream cublasSetStream_v2 +#define cublasGetStream cublasGetStream_v2 +#define cublasGetPointerMode cublasGetPointerMode_v2 +#define cublasSetPointerMode cublasSetPointerMode_v2 + +/* 32-bit integer */ + +/* Blas1 Routines */ + +#define cublasSnrm2 cublasSnrm2_v2 +#define cublasDnrm2 cublasDnrm2_v2 +#define cublasScnrm2 cublasScnrm2_v2 +#define cublasDznrm2 cublasDznrm2_v2 + +#define cublasSdot cublasSdot_v2 +#define cublasDdot cublasDdot_v2 +#define cublasCdotu cublasCdotu_v2 +#define cublasCdotc cublasCdotc_v2 +#define cublasZdotu cublasZdotu_v2 +#define cublasZdotc cublasZdotc_v2 + +#define cublasSscal cublasSscal_v2 +#define cublasDscal cublasDscal_v2 +#define cublasCscal cublasCscal_v2 +#define cublasCsscal cublasCsscal_v2 +#define cublasZscal cublasZscal_v2 +#define cublasZdscal cublasZdscal_v2 + +#define cublasSaxpy cublasSaxpy_v2 +#define cublasDaxpy cublasDaxpy_v2 +#define cublasCaxpy cublasCaxpy_v2 +#define cublasZaxpy cublasZaxpy_v2 + +#define cublasScopy cublasScopy_v2 +#define cublasDcopy cublasDcopy_v2 +#define cublasCcopy cublasCcopy_v2 +#define cublasZcopy cublasZcopy_v2 + +#define cublasSswap cublasSswap_v2 +#define cublasDswap cublasDswap_v2 +#define cublasCswap cublasCswap_v2 +#define cublasZswap cublasZswap_v2 + +#define cublasIsamax cublasIsamax_v2 +#define cublasIdamax cublasIdamax_v2 +#define cublasIcamax cublasIcamax_v2 +#define cublasIzamax cublasIzamax_v2 + +#define cublasIsamin cublasIsamin_v2 +#define cublasIdamin cublasIdamin_v2 +#define cublasIcamin cublasIcamin_v2 +#define cublasIzamin cublasIzamin_v2 + +#define cublasSasum cublasSasum_v2 +#define cublasDasum cublasDasum_v2 +#define cublasScasum cublasScasum_v2 +#define cublasDzasum cublasDzasum_v2 + +#define cublasSrot cublasSrot_v2 +#define cublasDrot cublasDrot_v2 +#define cublasCrot cublasCrot_v2 +#define cublasCsrot cublasCsrot_v2 +#define cublasZrot cublasZrot_v2 +#define cublasZdrot cublasZdrot_v2 + +#define cublasSrotg cublasSrotg_v2 +#define cublasDrotg cublasDrotg_v2 +#define cublasCrotg cublasCrotg_v2 +#define cublasZrotg cublasZrotg_v2 + +#define cublasSrotm cublasSrotm_v2 +#define cublasDrotm cublasDrotm_v2 + +#define cublasSrotmg cublasSrotmg_v2 +#define cublasDrotmg cublasDrotmg_v2 + +/* Blas2 Routines */ + +#define cublasSgemv cublasSgemv_v2 +#define cublasDgemv cublasDgemv_v2 +#define cublasCgemv cublasCgemv_v2 +#define cublasZgemv cublasZgemv_v2 + +#define cublasSgbmv cublasSgbmv_v2 +#define cublasDgbmv cublasDgbmv_v2 +#define cublasCgbmv cublasCgbmv_v2 +#define cublasZgbmv cublasZgbmv_v2 + +#define cublasStrmv cublasStrmv_v2 +#define cublasDtrmv cublasDtrmv_v2 +#define cublasCtrmv cublasCtrmv_v2 +#define cublasZtrmv cublasZtrmv_v2 + +#define cublasStbmv cublasStbmv_v2 +#define cublasDtbmv cublasDtbmv_v2 +#define cublasCtbmv cublasCtbmv_v2 +#define cublasZtbmv cublasZtbmv_v2 + +#define cublasStpmv cublasStpmv_v2 +#define cublasDtpmv cublasDtpmv_v2 +#define cublasCtpmv cublasCtpmv_v2 +#define cublasZtpmv cublasZtpmv_v2 + +#define cublasStrsv cublasStrsv_v2 +#define cublasDtrsv cublasDtrsv_v2 +#define cublasCtrsv cublasCtrsv_v2 +#define cublasZtrsv cublasZtrsv_v2 + +#define cublasStpsv cublasStpsv_v2 +#define cublasDtpsv cublasDtpsv_v2 +#define cublasCtpsv cublasCtpsv_v2 +#define cublasZtpsv cublasZtpsv_v2 + +#define cublasStbsv cublasStbsv_v2 +#define cublasDtbsv cublasDtbsv_v2 +#define cublasCtbsv cublasCtbsv_v2 +#define cublasZtbsv cublasZtbsv_v2 + +#define cublasSsymv cublasSsymv_v2 +#define cublasDsymv cublasDsymv_v2 +#define cublasCsymv cublasCsymv_v2 +#define cublasZsymv cublasZsymv_v2 +#define cublasChemv cublasChemv_v2 +#define cublasZhemv cublasZhemv_v2 + +#define cublasSsbmv cublasSsbmv_v2 +#define cublasDsbmv cublasDsbmv_v2 +#define cublasChbmv cublasChbmv_v2 +#define cublasZhbmv cublasZhbmv_v2 + +#define cublasSspmv cublasSspmv_v2 +#define cublasDspmv cublasDspmv_v2 +#define cublasChpmv cublasChpmv_v2 +#define cublasZhpmv cublasZhpmv_v2 + +#define cublasSger cublasSger_v2 +#define cublasDger cublasDger_v2 +#define cublasCgeru cublasCgeru_v2 +#define cublasCgerc cublasCgerc_v2 +#define cublasZgeru cublasZgeru_v2 +#define cublasZgerc cublasZgerc_v2 + +#define cublasSsyr cublasSsyr_v2 +#define cublasDsyr cublasDsyr_v2 +#define cublasCsyr cublasCsyr_v2 +#define cublasZsyr cublasZsyr_v2 +#define cublasCher cublasCher_v2 +#define cublasZher cublasZher_v2 + +#define cublasSspr cublasSspr_v2 +#define cublasDspr cublasDspr_v2 +#define cublasChpr cublasChpr_v2 +#define cublasZhpr cublasZhpr_v2 + +#define cublasSsyr2 cublasSsyr2_v2 +#define cublasDsyr2 cublasDsyr2_v2 +#define cublasCsyr2 cublasCsyr2_v2 +#define cublasZsyr2 cublasZsyr2_v2 +#define cublasCher2 cublasCher2_v2 +#define cublasZher2 cublasZher2_v2 + +#define cublasSspr2 cublasSspr2_v2 +#define cublasDspr2 cublasDspr2_v2 +#define cublasChpr2 cublasChpr2_v2 +#define cublasZhpr2 cublasZhpr2_v2 + +/* Blas3 Routines */ + +#define cublasSgemm cublasSgemm_v2 +#define cublasDgemm cublasDgemm_v2 +#define cublasCgemm cublasCgemm_v2 +#define cublasZgemm cublasZgemm_v2 + +#define cublasSsyrk cublasSsyrk_v2 +#define cublasDsyrk cublasDsyrk_v2 +#define cublasCsyrk cublasCsyrk_v2 +#define cublasZsyrk cublasZsyrk_v2 +#define cublasCherk cublasCherk_v2 +#define cublasZherk cublasZherk_v2 + +#define cublasSsyr2k cublasSsyr2k_v2 +#define cublasDsyr2k cublasDsyr2k_v2 +#define cublasCsyr2k cublasCsyr2k_v2 +#define cublasZsyr2k cublasZsyr2k_v2 +#define cublasCher2k cublasCher2k_v2 +#define cublasZher2k cublasZher2k_v2 + +#define cublasSsymm cublasSsymm_v2 +#define cublasDsymm cublasDsymm_v2 +#define cublasCsymm cublasCsymm_v2 +#define cublasZsymm cublasZsymm_v2 +#define cublasChemm cublasChemm_v2 +#define cublasZhemm cublasZhemm_v2 + +#define cublasStrsm cublasStrsm_v2 +#define cublasDtrsm cublasDtrsm_v2 +#define cublasCtrsm cublasCtrsm_v2 +#define cublasZtrsm cublasZtrsm_v2 + +#define cublasStrmm cublasStrmm_v2 +#define cublasDtrmm cublasDtrmm_v2 +#define cublasCtrmm cublasCtrmm_v2 +#define cublasZtrmm cublasZtrmm_v2 + +/* 64-bit integer */ + +/* Blas1 Routines */ + +#define cublasSnrm2_64 cublasSnrm2_v2_64 +#define cublasDnrm2_64 cublasDnrm2_v2_64 +#define cublasScnrm2_64 cublasScnrm2_v2_64 +#define cublasDznrm2_64 cublasDznrm2_v2_64 + +#define cublasSdot_64 cublasSdot_v2_64 +#define cublasDdot_64 cublasDdot_v2_64 +#define cublasCdotu_64 cublasCdotu_v2_64 +#define cublasCdotc_64 cublasCdotc_v2_64 +#define cublasZdotu_64 cublasZdotu_v2_64 +#define cublasZdotc_64 cublasZdotc_v2_64 + +#define cublasSscal_64 cublasSscal_v2_64 +#define cublasDscal_64 cublasDscal_v2_64 +#define cublasCscal_64 cublasCscal_v2_64 +#define cublasCsscal_64 cublasCsscal_v2_64 +#define cublasZscal_64 cublasZscal_v2_64 +#define cublasZdscal_64 cublasZdscal_v2_64 + +#define cublasSaxpy_64 cublasSaxpy_v2_64 +#define cublasDaxpy_64 cublasDaxpy_v2_64 +#define cublasCaxpy_64 cublasCaxpy_v2_64 +#define cublasZaxpy_64 cublasZaxpy_v2_64 + +#define cublasScopy_64 cublasScopy_v2_64 +#define cublasDcopy_64 cublasDcopy_v2_64 +#define cublasCcopy_64 cublasCcopy_v2_64 +#define cublasZcopy_64 cublasZcopy_v2_64 + +#define cublasSswap_64 cublasSswap_v2_64 +#define cublasDswap_64 cublasDswap_v2_64 +#define cublasCswap_64 cublasCswap_v2_64 +#define cublasZswap_64 cublasZswap_v2_64 + +#define cublasIsamax_64 cublasIsamax_v2_64 +#define cublasIdamax_64 cublasIdamax_v2_64 +#define cublasIcamax_64 cublasIcamax_v2_64 +#define cublasIzamax_64 cublasIzamax_v2_64 + +#define cublasIsamin_64 cublasIsamin_v2_64 +#define cublasIdamin_64 cublasIdamin_v2_64 +#define cublasIcamin_64 cublasIcamin_v2_64 +#define cublasIzamin_64 cublasIzamin_v2_64 + +#define cublasSasum_64 cublasSasum_v2_64 +#define cublasDasum_64 cublasDasum_v2_64 +#define cublasScasum_64 cublasScasum_v2_64 +#define cublasDzasum_64 cublasDzasum_v2_64 + +#define cublasSrot_64 cublasSrot_v2_64 +#define cublasDrot_64 cublasDrot_v2_64 +#define cublasCrot_64 cublasCrot_v2_64 +#define cublasCsrot_64 cublasCsrot_v2_64 +#define cublasZrot_64 cublasZrot_v2_64 +#define cublasZdrot_64 cublasZdrot_v2_64 + +#define cublasSrotg_64 cublasSrotg_v2_64 +#define cublasDrotg_64 cublasDrotg_v2_64 +#define cublasCrotg_64 cublasCrotg_v2_64 +#define cublasZrotg_64 cublasZrotg_v2_64 + +#define cublasSrotm_64 cublasSrotm_v2_64 +#define cublasDrotm_64 cublasDrotm_v2_64 + +#define cublasSrotmg_64 cublasSrotmg_v2_64 +#define cublasDrotmg_64 cublasDrotmg_v2_64 + +/* Blas2 Routines */ + +#define cublasSgemv_64 cublasSgemv_v2_64 +#define cublasDgemv_64 cublasDgemv_v2_64 +#define cublasCgemv_64 cublasCgemv_v2_64 +#define cublasZgemv_64 cublasZgemv_v2_64 + +#define cublasSgbmv_64 cublasSgbmv_v2_64 +#define cublasDgbmv_64 cublasDgbmv_v2_64 +#define cublasCgbmv_64 cublasCgbmv_v2_64 +#define cublasZgbmv_64 cublasZgbmv_v2_64 + +#define cublasStrmv_64 cublasStrmv_v2_64 +#define cublasDtrmv_64 cublasDtrmv_v2_64 +#define cublasCtrmv_64 cublasCtrmv_v2_64 +#define cublasZtrmv_64 cublasZtrmv_v2_64 + +#define cublasStbmv_64 cublasStbmv_v2_64 +#define cublasDtbmv_64 cublasDtbmv_v2_64 +#define cublasCtbmv_64 cublasCtbmv_v2_64 +#define cublasZtbmv_64 cublasZtbmv_v2_64 + +#define cublasStpmv_64 cublasStpmv_v2_64 +#define cublasDtpmv_64 cublasDtpmv_v2_64 +#define cublasCtpmv_64 cublasCtpmv_v2_64 +#define cublasZtpmv_64 cublasZtpmv_v2_64 + +#define cublasStrsv_64 cublasStrsv_v2_64 +#define cublasDtrsv_64 cublasDtrsv_v2_64 +#define cublasCtrsv_64 cublasCtrsv_v2_64 +#define cublasZtrsv_64 cublasZtrsv_v2_64 + +#define cublasStpsv_64 cublasStpsv_v2_64 +#define cublasDtpsv_64 cublasDtpsv_v2_64 +#define cublasCtpsv_64 cublasCtpsv_v2_64 +#define cublasZtpsv_64 cublasZtpsv_v2_64 + +#define cublasStbsv_64 cublasStbsv_v2_64 +#define cublasDtbsv_64 cublasDtbsv_v2_64 +#define cublasCtbsv_64 cublasCtbsv_v2_64 +#define cublasZtbsv_64 cublasZtbsv_v2_64 + +#define cublasSsymv_64 cublasSsymv_v2_64 +#define cublasDsymv_64 cublasDsymv_v2_64 +#define cublasCsymv_64 cublasCsymv_v2_64 +#define cublasZsymv_64 cublasZsymv_v2_64 +#define cublasChemv_64 cublasChemv_v2_64 +#define cublasZhemv_64 cublasZhemv_v2_64 + +#define cublasSsbmv_64 cublasSsbmv_v2_64 +#define cublasDsbmv_64 cublasDsbmv_v2_64 +#define cublasChbmv_64 cublasChbmv_v2_64 +#define cublasZhbmv_64 cublasZhbmv_v2_64 + +#define cublasSspmv_64 cublasSspmv_v2_64 +#define cublasDspmv_64 cublasDspmv_v2_64 +#define cublasChpmv_64 cublasChpmv_v2_64 +#define cublasZhpmv_64 cublasZhpmv_v2_64 + +#define cublasSger_64 cublasSger_v2_64 +#define cublasDger_64 cublasDger_v2_64 +#define cublasCgeru_64 cublasCgeru_v2_64 +#define cublasCgerc_64 cublasCgerc_v2_64 +#define cublasZgeru_64 cublasZgeru_v2_64 +#define cublasZgerc_64 cublasZgerc_v2_64 + +#define cublasSsyr_64 cublasSsyr_v2_64 +#define cublasDsyr_64 cublasDsyr_v2_64 +#define cublasCsyr_64 cublasCsyr_v2_64 +#define cublasZsyr_64 cublasZsyr_v2_64 +#define cublasCher_64 cublasCher_v2_64 +#define cublasZher_64 cublasZher_v2_64 + +#define cublasSspr_64 cublasSspr_v2_64 +#define cublasDspr_64 cublasDspr_v2_64 +#define cublasChpr_64 cublasChpr_v2_64 +#define cublasZhpr_64 cublasZhpr_v2_64 + +#define cublasSsyr2_64 cublasSsyr2_v2_64 +#define cublasDsyr2_64 cublasDsyr2_v2_64 +#define cublasCsyr2_64 cublasCsyr2_v2_64 +#define cublasZsyr2_64 cublasZsyr2_v2_64 +#define cublasCher2_64 cublasCher2_v2_64 +#define cublasZher2_64 cublasZher2_v2_64 + +#define cublasSspr2_64 cublasSspr2_v2_64 +#define cublasDspr2_64 cublasDspr2_v2_64 +#define cublasChpr2_64 cublasChpr2_v2_64 +#define cublasZhpr2_64 cublasZhpr2_v2_64 + +/* Blas3 Routines */ + +#define cublasSgemm_64 cublasSgemm_v2_64 +#define cublasDgemm_64 cublasDgemm_v2_64 +#define cublasCgemm_64 cublasCgemm_v2_64 +#define cublasZgemm_64 cublasZgemm_v2_64 + +#define cublasSsyrk_64 cublasSsyrk_v2_64 +#define cublasDsyrk_64 cublasDsyrk_v2_64 +#define cublasCsyrk_64 cublasCsyrk_v2_64 +#define cublasZsyrk_64 cublasZsyrk_v2_64 +#define cublasCherk_64 cublasCherk_v2_64 +#define cublasZherk_64 cublasZherk_v2_64 + +#define cublasSsyr2k_64 cublasSsyr2k_v2_64 +#define cublasDsyr2k_64 cublasDsyr2k_v2_64 +#define cublasCsyr2k_64 cublasCsyr2k_v2_64 +#define cublasZsyr2k_64 cublasZsyr2k_v2_64 +#define cublasCher2k_64 cublasCher2k_v2_64 +#define cublasZher2k_64 cublasZher2k_v2_64 + +#define cublasSsymm_64 cublasSsymm_v2_64 +#define cublasDsymm_64 cublasDsymm_v2_64 +#define cublasCsymm_64 cublasCsymm_v2_64 +#define cublasZsymm_64 cublasZsymm_v2_64 +#define cublasChemm_64 cublasChemm_v2_64 +#define cublasZhemm_64 cublasZhemm_v2_64 + +#define cublasStrsm_64 cublasStrsm_v2_64 +#define cublasDtrsm_64 cublasDtrsm_v2_64 +#define cublasCtrsm_64 cublasCtrsm_v2_64 +#define cublasZtrsm_64 cublasZtrsm_v2_64 + +#define cublasStrmm_64 cublasStrmm_v2_64 +#define cublasDtrmm_64 cublasDtrmm_v2_64 +#define cublasCtrmm_64 cublasCtrmm_v2_64 +#define cublasZtrmm_64 cublasZtrmm_v2_64 + +#endif /* !defined(CUBLAS_V2_H_) */ diff --git a/cuda_toolkit/include/cuda.h b/cuda_toolkit/include/cuda.h new file mode 100644 index 0000000000000000000000000000000000000000..d9a1575c7de3dea20e6cfe22612c7f1fc97ece65 --- /dev/null +++ b/cuda_toolkit/include/cuda.h @@ -0,0 +1,24359 @@ +/* + * Copyright 1993-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef __cuda_cuda_h__ +#define __cuda_cuda_h__ + + + + +#include +#ifdef _MSC_VER +typedef unsigned __int32 cuuint32_t; +typedef unsigned __int64 cuuint64_t; +#else +#include +typedef uint32_t cuuint32_t; +typedef uint64_t cuuint64_t; +#endif + +#if defined(__CUDA_API_VERSION_INTERNAL) || defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif + +#if defined(CUDA_FORCE_API_VERSION) +#error "CUDA_FORCE_API_VERSION is no longer supported." +#endif + +#if defined(__CUDA_API_VERSION_INTERNAL) || defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) + #define __CUDA_API_PER_THREAD_DEFAULT_STREAM + #define __CUDA_API_PTDS(api) api ## _ptds + #define __CUDA_API_PTSZ(api) api ## _ptsz +#else + #define __CUDA_API_PTDS(api) api + #define __CUDA_API_PTSZ(api) api +#endif + +#define cuDeviceTotalMem cuDeviceTotalMem_v2 +#define cuCtxCreate cuCtxCreate_v2 +#define cuCtxCreate_v3 cuCtxCreate_v3 +#define cuModuleGetGlobal cuModuleGetGlobal_v2 +#define cuMemGetInfo cuMemGetInfo_v2 +#define cuMemAlloc cuMemAlloc_v2 +#define cuMemAllocPitch cuMemAllocPitch_v2 +#define cuMemFree cuMemFree_v2 +#define cuMemGetAddressRange cuMemGetAddressRange_v2 +#define cuMemAllocHost cuMemAllocHost_v2 +#define cuMemHostGetDevicePointer cuMemHostGetDevicePointer_v2 +#define cuMemcpyHtoD __CUDA_API_PTDS(cuMemcpyHtoD_v2) +#define cuMemcpyDtoH __CUDA_API_PTDS(cuMemcpyDtoH_v2) +#define cuMemcpyDtoD __CUDA_API_PTDS(cuMemcpyDtoD_v2) +#define cuMemcpyDtoA __CUDA_API_PTDS(cuMemcpyDtoA_v2) +#define cuMemcpyAtoD __CUDA_API_PTDS(cuMemcpyAtoD_v2) +#define cuMemcpyHtoA __CUDA_API_PTDS(cuMemcpyHtoA_v2) +#define cuMemcpyAtoH __CUDA_API_PTDS(cuMemcpyAtoH_v2) +#define cuMemcpyAtoA __CUDA_API_PTDS(cuMemcpyAtoA_v2) +#define cuMemcpyHtoAAsync __CUDA_API_PTSZ(cuMemcpyHtoAAsync_v2) +#define cuMemcpyAtoHAsync __CUDA_API_PTSZ(cuMemcpyAtoHAsync_v2) +#define cuMemcpy2D __CUDA_API_PTDS(cuMemcpy2D_v2) +#define cuMemcpy2DUnaligned __CUDA_API_PTDS(cuMemcpy2DUnaligned_v2) +#define cuMemcpy3D __CUDA_API_PTDS(cuMemcpy3D_v2) +#define cuMemcpyHtoDAsync __CUDA_API_PTSZ(cuMemcpyHtoDAsync_v2) +#define cuMemcpyDtoHAsync __CUDA_API_PTSZ(cuMemcpyDtoHAsync_v2) +#define cuMemcpyDtoDAsync __CUDA_API_PTSZ(cuMemcpyDtoDAsync_v2) +#define cuMemcpy2DAsync __CUDA_API_PTSZ(cuMemcpy2DAsync_v2) +#define cuMemcpy3DAsync __CUDA_API_PTSZ(cuMemcpy3DAsync_v2) +#define cuMemsetD8 __CUDA_API_PTDS(cuMemsetD8_v2) +#define cuMemsetD16 __CUDA_API_PTDS(cuMemsetD16_v2) +#define cuMemsetD32 __CUDA_API_PTDS(cuMemsetD32_v2) +#define cuMemsetD2D8 __CUDA_API_PTDS(cuMemsetD2D8_v2) +#define cuMemsetD2D16 __CUDA_API_PTDS(cuMemsetD2D16_v2) +#define cuMemsetD2D32 __CUDA_API_PTDS(cuMemsetD2D32_v2) +#define cuArrayCreate cuArrayCreate_v2 +#define cuArrayGetDescriptor cuArrayGetDescriptor_v2 +#define cuArray3DCreate cuArray3DCreate_v2 +#define cuArray3DGetDescriptor cuArray3DGetDescriptor_v2 +#define cuTexRefSetAddress cuTexRefSetAddress_v2 +#define cuTexRefGetAddress cuTexRefGetAddress_v2 +#define cuGraphicsResourceGetMappedPointer cuGraphicsResourceGetMappedPointer_v2 +#define cuCtxDestroy cuCtxDestroy_v2 +#define cuCtxPopCurrent cuCtxPopCurrent_v2 +#define cuCtxPushCurrent cuCtxPushCurrent_v2 +#define cuStreamDestroy cuStreamDestroy_v2 +#define cuEventDestroy cuEventDestroy_v2 +#define cuTexRefSetAddress2D cuTexRefSetAddress2D_v3 +#define cuLinkCreate cuLinkCreate_v2 +#define cuLinkAddData cuLinkAddData_v2 +#define cuLinkAddFile cuLinkAddFile_v2 +#define cuMemHostRegister cuMemHostRegister_v2 +#define cuGraphicsResourceSetMapFlags cuGraphicsResourceSetMapFlags_v2 +#define cuStreamBeginCapture __CUDA_API_PTSZ(cuStreamBeginCapture_v2) +#define cuDevicePrimaryCtxRelease cuDevicePrimaryCtxRelease_v2 +#define cuDevicePrimaryCtxReset cuDevicePrimaryCtxReset_v2 +#define cuDevicePrimaryCtxSetFlags cuDevicePrimaryCtxSetFlags_v2 +#define cuDeviceGetUuid_v2 cuDeviceGetUuid_v2 +#define cuIpcOpenMemHandle cuIpcOpenMemHandle_v2 + +#define cuGraphInstantiate cuGraphInstantiateWithFlags + +#define cuGraphExecUpdate cuGraphExecUpdate_v2 +#define cuGetProcAddress cuGetProcAddress_v2 +#define cuGraphAddKernelNode cuGraphAddKernelNode_v2 +#define cuGraphKernelNodeGetParams cuGraphKernelNodeGetParams_v2 +#define cuGraphKernelNodeSetParams cuGraphKernelNodeSetParams_v2 +#define cuGraphExecKernelNodeSetParams cuGraphExecKernelNodeSetParams_v2 + +#define cuStreamWriteValue32 __CUDA_API_PTSZ(cuStreamWriteValue32_v2) +#define cuStreamWaitValue32 __CUDA_API_PTSZ(cuStreamWaitValue32_v2) +#define cuStreamWriteValue64 __CUDA_API_PTSZ(cuStreamWriteValue64_v2) +#define cuStreamWaitValue64 __CUDA_API_PTSZ(cuStreamWaitValue64_v2) +#define cuStreamBatchMemOp __CUDA_API_PTSZ(cuStreamBatchMemOp_v2) +#define cuStreamGetCaptureInfo __CUDA_API_PTSZ(cuStreamGetCaptureInfo_v2) +#define cuStreamGetCaptureInfo_v2 __CUDA_API_PTSZ(cuStreamGetCaptureInfo_v2) + +#if defined(__CUDA_API_PER_THREAD_DEFAULT_STREAM) + #define cuMemcpy __CUDA_API_PTDS(cuMemcpy) + #define cuMemcpyAsync __CUDA_API_PTSZ(cuMemcpyAsync) + #define cuMemcpyPeer __CUDA_API_PTDS(cuMemcpyPeer) + #define cuMemcpyPeerAsync __CUDA_API_PTSZ(cuMemcpyPeerAsync) + #define cuMemcpy3DPeer __CUDA_API_PTDS(cuMemcpy3DPeer) + #define cuMemcpy3DPeerAsync __CUDA_API_PTSZ(cuMemcpy3DPeerAsync) + #define cuMemPrefetchAsync __CUDA_API_PTSZ(cuMemPrefetchAsync) + #define cuMemPrefetchAsync_v2 __CUDA_API_PTSZ(cuMemPrefetchAsync_v2) + + #define cuMemsetD8Async __CUDA_API_PTSZ(cuMemsetD8Async) + #define cuMemsetD16Async __CUDA_API_PTSZ(cuMemsetD16Async) + #define cuMemsetD32Async __CUDA_API_PTSZ(cuMemsetD32Async) + #define cuMemsetD2D8Async __CUDA_API_PTSZ(cuMemsetD2D8Async) + #define cuMemsetD2D16Async __CUDA_API_PTSZ(cuMemsetD2D16Async) + #define cuMemsetD2D32Async __CUDA_API_PTSZ(cuMemsetD2D32Async) + + #define cuStreamGetPriority __CUDA_API_PTSZ(cuStreamGetPriority) + #define cuStreamGetId __CUDA_API_PTSZ(cuStreamGetId) + #define cuStreamGetFlags __CUDA_API_PTSZ(cuStreamGetFlags) + #define cuStreamGetCtx __CUDA_API_PTSZ(cuStreamGetCtx) + #define cuStreamWaitEvent __CUDA_API_PTSZ(cuStreamWaitEvent) + #define cuStreamEndCapture __CUDA_API_PTSZ(cuStreamEndCapture) + #define cuStreamIsCapturing __CUDA_API_PTSZ(cuStreamIsCapturing) + #define cuStreamGetCaptureInfo_v3 __CUDA_API_PTSZ(cuStreamGetCaptureInfo_v3) + #define cuStreamUpdateCaptureDependencies __CUDA_API_PTSZ(cuStreamUpdateCaptureDependencies) + #define cuStreamUpdateCaptureDependencies_v2 __CUDA_API_PTSZ(cuStreamUpdateCaptureDependencies_v2) + #define cuStreamAddCallback __CUDA_API_PTSZ(cuStreamAddCallback) + #define cuStreamAttachMemAsync __CUDA_API_PTSZ(cuStreamAttachMemAsync) + #define cuStreamQuery __CUDA_API_PTSZ(cuStreamQuery) + #define cuStreamSynchronize __CUDA_API_PTSZ(cuStreamSynchronize) + #define cuEventRecord __CUDA_API_PTSZ(cuEventRecord) + #define cuEventRecordWithFlags __CUDA_API_PTSZ(cuEventRecordWithFlags) + #define cuLaunchKernel __CUDA_API_PTSZ(cuLaunchKernel) + #define cuLaunchKernelEx __CUDA_API_PTSZ(cuLaunchKernelEx) + #define cuLaunchHostFunc __CUDA_API_PTSZ(cuLaunchHostFunc) + #define cuGraphicsMapResources __CUDA_API_PTSZ(cuGraphicsMapResources) + #define cuGraphicsUnmapResources __CUDA_API_PTSZ(cuGraphicsUnmapResources) + + #define cuLaunchCooperativeKernel __CUDA_API_PTSZ(cuLaunchCooperativeKernel) + + #define cuSignalExternalSemaphoresAsync __CUDA_API_PTSZ(cuSignalExternalSemaphoresAsync) + #define cuWaitExternalSemaphoresAsync __CUDA_API_PTSZ(cuWaitExternalSemaphoresAsync) + + #define cuGraphInstantiateWithParams __CUDA_API_PTSZ(cuGraphInstantiateWithParams) + #define cuGraphUpload __CUDA_API_PTSZ(cuGraphUpload) + #define cuGraphLaunch __CUDA_API_PTSZ(cuGraphLaunch) + #define cuStreamCopyAttributes __CUDA_API_PTSZ(cuStreamCopyAttributes) + #define cuStreamGetAttribute __CUDA_API_PTSZ(cuStreamGetAttribute) + #define cuStreamSetAttribute __CUDA_API_PTSZ(cuStreamSetAttribute) + #define cuMemMapArrayAsync __CUDA_API_PTSZ(cuMemMapArrayAsync) + + #define cuMemFreeAsync __CUDA_API_PTSZ(cuMemFreeAsync) + #define cuMemAllocAsync __CUDA_API_PTSZ(cuMemAllocAsync) + #define cuMemAllocFromPoolAsync __CUDA_API_PTSZ(cuMemAllocFromPoolAsync) + + #define cuStreamBeginCaptureToGraph __CUDA_API_PTSZ(cuStreamBeginCaptureToGraph) + +#endif + +/** + * \file cuda.h + * \brief Header file for the CUDA Toolkit application programming interface. + * + * \file cudaGL.h + * \brief Header file for the OpenGL interoperability functions of the + * low-level CUDA driver application programming interface. + * + * \file cudaD3D9.h + * \brief Header file for the Direct3D 9 interoperability functions of the + * low-level CUDA driver application programming interface. + */ + +/** + * \defgroup CUDA_TYPES Data types used by CUDA driver + * @{ + */ + +/** + * CUDA API version number + */ +#define CUDA_VERSION 12040 + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * CUDA device pointer + * CUdeviceptr is defined as an unsigned integer type whose size matches the size of a pointer on the target platform. + */ +#if defined(_WIN64) || defined(__LP64__) +typedef unsigned long long CUdeviceptr_v2; +#else +typedef unsigned int CUdeviceptr_v2; +#endif +typedef CUdeviceptr_v2 CUdeviceptr; /**< CUDA device pointer */ + +typedef int CUdevice_v1; /**< CUDA device */ +typedef CUdevice_v1 CUdevice; /**< CUDA device */ +typedef struct CUctx_st *CUcontext; /**< CUDA context */ +typedef struct CUmod_st *CUmodule; /**< CUDA module */ +typedef struct CUfunc_st *CUfunction; /**< CUDA function */ +typedef struct CUlib_st *CUlibrary; /**< CUDA library */ +typedef struct CUkern_st *CUkernel; /**< CUDA kernel */ +typedef struct CUarray_st *CUarray; /**< CUDA array */ +typedef struct CUmipmappedArray_st *CUmipmappedArray; /**< CUDA mipmapped array */ +typedef struct CUtexref_st *CUtexref; /**< CUDA texture reference */ +typedef struct CUsurfref_st *CUsurfref; /**< CUDA surface reference */ +typedef struct CUevent_st *CUevent; /**< CUDA event */ +typedef struct CUstream_st *CUstream; /**< CUDA stream */ +typedef struct CUgraphicsResource_st *CUgraphicsResource; /**< CUDA graphics interop resource */ +typedef unsigned long long CUtexObject_v1; /**< An opaque value that represents a CUDA texture object */ +typedef CUtexObject_v1 CUtexObject; /**< An opaque value that represents a CUDA texture object */ +typedef unsigned long long CUsurfObject_v1; /**< An opaque value that represents a CUDA surface object */ +typedef CUsurfObject_v1 CUsurfObject; /**< An opaque value that represents a CUDA surface object */ +typedef struct CUextMemory_st *CUexternalMemory; /**< CUDA external memory */ +typedef struct CUextSemaphore_st *CUexternalSemaphore; /**< CUDA external semaphore */ +typedef struct CUgraph_st *CUgraph; /**< CUDA graph */ +typedef struct CUgraphNode_st *CUgraphNode; /**< CUDA graph node */ +typedef struct CUgraphExec_st *CUgraphExec; /**< CUDA executable graph */ +typedef struct CUmemPoolHandle_st *CUmemoryPool; /**< CUDA memory pool */ +typedef struct CUuserObject_st *CUuserObject; /**< CUDA user object for graphs */ +typedef cuuint64_t CUgraphConditionalHandle; /**< CUDA graph conditional handle */ +typedef struct CUgraphDeviceUpdatableNode_st *CUgraphDeviceNode; /**< CUDA graph device node handle */ +typedef struct CUasyncCallbackEntry_st *CUasyncCallbackHandle; /**< CUDA async notification callback handle */ + +#ifndef CU_UUID_HAS_BEEN_DEFINED +#define CU_UUID_HAS_BEEN_DEFINED +typedef struct CUuuid_st { /**< CUDA definition of UUID */ + char bytes[16]; +} CUuuid; +#endif + +/** + * CUDA IPC handle size + */ +#define CU_IPC_HANDLE_SIZE 64 + +/** + * Fabric handle - An opaque handle representing a memory allocation + * that can be exported to processes in same or different nodes. For IPC + * between processes on different nodes they must be connected via the + * NVSwitch fabric. + */ +typedef struct CUmemFabricHandle_st { + unsigned char data[CU_IPC_HANDLE_SIZE]; +} CUmemFabricHandle_v1; +typedef CUmemFabricHandle_v1 CUmemFabricHandle; + +/** + * CUDA IPC event handle + */ +typedef struct CUipcEventHandle_st { + char reserved[CU_IPC_HANDLE_SIZE]; +} CUipcEventHandle_v1; +typedef CUipcEventHandle_v1 CUipcEventHandle; + +/** + * CUDA IPC mem handle + */ +typedef struct CUipcMemHandle_st { + char reserved[CU_IPC_HANDLE_SIZE]; +} CUipcMemHandle_v1; +typedef CUipcMemHandle_v1 CUipcMemHandle; + +/** + * CUDA Ipc Mem Flags + */ +typedef enum CUipcMem_flags_enum { + CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = 0x1 /**< Automatically enable peer access between remote devices as needed */ +} CUipcMem_flags; + + +/** + * CUDA Mem Attach Flags + */ +typedef enum CUmemAttach_flags_enum { + CU_MEM_ATTACH_GLOBAL = 0x1, /**< Memory can be accessed by any stream on any device */ + CU_MEM_ATTACH_HOST = 0x2, /**< Memory cannot be accessed by any stream on any device */ + CU_MEM_ATTACH_SINGLE = 0x4 /**< Memory can only be accessed by a single stream on the associated device */ +} CUmemAttach_flags; + +/** + * Context creation flags + */ +typedef enum CUctx_flags_enum { + CU_CTX_SCHED_AUTO = 0x00, /**< Automatic scheduling */ + CU_CTX_SCHED_SPIN = 0x01, /**< Set spin as default scheduling */ + CU_CTX_SCHED_YIELD = 0x02, /**< Set yield as default scheduling */ + CU_CTX_SCHED_BLOCKING_SYNC = 0x04, /**< Set blocking synchronization as default scheduling */ + CU_CTX_BLOCKING_SYNC = 0x04, /**< Set blocking synchronization as default scheduling + * \deprecated This flag was deprecated as of CUDA 4.0 + * and was replaced with ::CU_CTX_SCHED_BLOCKING_SYNC. */ + CU_CTX_SCHED_MASK = 0x07, + CU_CTX_MAP_HOST = 0x08, /**< \deprecated This flag was deprecated as of CUDA 11.0 + * and it no longer has any effect. All contexts + * as of CUDA 3.2 behave as though the flag is enabled. */ + CU_CTX_LMEM_RESIZE_TO_MAX = 0x10, /**< Keep local memory allocation after launch */ + CU_CTX_COREDUMP_ENABLE = 0x20, /**< Trigger coredumps from exceptions in this context */ + CU_CTX_USER_COREDUMP_ENABLE= 0x40, /**< Enable user pipe to trigger coredumps in this context */ + CU_CTX_SYNC_MEMOPS = 0x80, /**< Ensure synchronous memory operations on this context will synchronize */ + CU_CTX_FLAGS_MASK = 0xFF +} CUctx_flags; + +/** + * Event sched flags + */ +typedef enum CUevent_sched_flags_enum { + CU_EVENT_SCHED_AUTO = 0x00, /**< Automatic scheduling */ + CU_EVENT_SCHED_SPIN = 0x01, /**< Set spin as default scheduling */ + CU_EVENT_SCHED_YIELD = 0x02, /**< Set yield as default scheduling */ + CU_EVENT_SCHED_BLOCKING_SYNC = 0x04, /**< Set blocking synchronization as default scheduling */ +} CUevent_sched_flags; + +/** + * NVCL event scheduling flags + */ +typedef enum cl_event_flags_enum { + NVCL_EVENT_SCHED_AUTO = 0x00, /**< Automatic scheduling */ + NVCL_EVENT_SCHED_SPIN = 0x01, /**< Set spin as default scheduling */ + NVCL_EVENT_SCHED_YIELD = 0x02, /**< Set yield as default scheduling */ + NVCL_EVENT_SCHED_BLOCKING_SYNC = 0x04, /**< Set blocking synchronization as default scheduling */ +} cl_event_flags; + +/** + * NVCL context scheduling flags + */ +typedef enum cl_context_flags_enum { + NVCL_CTX_SCHED_AUTO = 0x00, /**< Automatic scheduling */ + NVCL_CTX_SCHED_SPIN = 0x01, /**< Set spin as default scheduling */ + NVCL_CTX_SCHED_YIELD = 0x02, /**< Set yield as default scheduling */ + NVCL_CTX_SCHED_BLOCKING_SYNC = 0x04, /**< Set blocking synchronization as default scheduling */ +} cl_context_flags; + + +/** + * Stream creation flags + */ +typedef enum CUstream_flags_enum { + CU_STREAM_DEFAULT = 0x0, /**< Default stream flag */ + CU_STREAM_NON_BLOCKING = 0x1 /**< Stream does not synchronize with stream 0 (the NULL stream) */ +} CUstream_flags; + +/** + * Legacy stream handle + * + * Stream handle that can be passed as a CUstream to use an implicit stream + * with legacy synchronization behavior. + * + * See details of the \link_sync_behavior + */ +#define CU_STREAM_LEGACY ((CUstream)0x1) + +/** + * Per-thread stream handle + * + * Stream handle that can be passed as a CUstream to use an implicit stream + * with per-thread synchronization behavior. + * + * See details of the \link_sync_behavior + */ +#define CU_STREAM_PER_THREAD ((CUstream)0x2) + +/** + * Event creation flags + */ +typedef enum CUevent_flags_enum { + CU_EVENT_DEFAULT = 0x0, /**< Default event flag */ + CU_EVENT_BLOCKING_SYNC = 0x1, /**< Event uses blocking synchronization */ + CU_EVENT_DISABLE_TIMING = 0x2, /**< Event will not record timing data */ + CU_EVENT_INTERPROCESS = 0x4 /**< Event is suitable for interprocess use. CU_EVENT_DISABLE_TIMING must be set */ +} CUevent_flags; + +/** + * Event record flags + */ +typedef enum CUevent_record_flags_enum { + CU_EVENT_RECORD_DEFAULT = 0x0, /**< Default event record flag */ + CU_EVENT_RECORD_EXTERNAL = 0x1 /**< When using stream capture, create an event record node + * instead of the default behavior. This flag is invalid + * when used outside of capture. */ +} CUevent_record_flags; + +/** + * Event wait flags + */ +typedef enum CUevent_wait_flags_enum { + CU_EVENT_WAIT_DEFAULT = 0x0, /**< Default event wait flag */ + CU_EVENT_WAIT_EXTERNAL = 0x1 /**< When using stream capture, create an event wait node + * instead of the default behavior. This flag is invalid + * when used outside of capture.*/ +} CUevent_wait_flags; + +/** + * Flags for ::cuStreamWaitValue32 and ::cuStreamWaitValue64 + */ +typedef enum CUstreamWaitValue_flags_enum { + CU_STREAM_WAIT_VALUE_GEQ = 0x0, /**< Wait until (int32_t)(*addr - value) >= 0 (or int64_t for 64 bit + values). Note this is a cyclic comparison which ignores wraparound. + (Default behavior.) */ + CU_STREAM_WAIT_VALUE_EQ = 0x1, /**< Wait until *addr == value. */ + CU_STREAM_WAIT_VALUE_AND = 0x2, /**< Wait until (*addr & value) != 0. */ + CU_STREAM_WAIT_VALUE_NOR = 0x3, /**< Wait until ~(*addr | value) != 0. Support for this operation can be + queried with ::cuDeviceGetAttribute() and + ::CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR.*/ + CU_STREAM_WAIT_VALUE_FLUSH = 1<<30 /**< Follow the wait operation with a flush of outstanding remote writes. This + means that, if a remote write operation is guaranteed to have reached the + device before the wait can be satisfied, that write is guaranteed to be + visible to downstream device work. The device is permitted to reorder + remote writes internally. For example, this flag would be required if + two remote writes arrive in a defined order, the wait is satisfied by the + second write, and downstream work needs to observe the first write. + Support for this operation is restricted to selected platforms and can be + queried with ::CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES.*/ +} CUstreamWaitValue_flags; + +/** + * Flags for ::cuStreamWriteValue32 + */ +typedef enum CUstreamWriteValue_flags_enum { + CU_STREAM_WRITE_VALUE_DEFAULT = 0x0, /**< Default behavior */ + CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER = 0x1 /**< Permits the write to be reordered with writes which were issued + before it, as a performance optimization. Normally, + ::cuStreamWriteValue32 will provide a memory fence before the + write, which has similar semantics to + __threadfence_system() but is scoped to the stream + rather than a CUDA thread. + This flag is not supported in the v2 API. */ +} CUstreamWriteValue_flags; + +/** + * Operations for ::cuStreamBatchMemOp + */ +typedef enum CUstreamBatchMemOpType_enum { + CU_STREAM_MEM_OP_WAIT_VALUE_32 = 1, /**< Represents a ::cuStreamWaitValue32 operation */ + CU_STREAM_MEM_OP_WRITE_VALUE_32 = 2, /**< Represents a ::cuStreamWriteValue32 operation */ + CU_STREAM_MEM_OP_WAIT_VALUE_64 = 4, /**< Represents a ::cuStreamWaitValue64 operation */ + CU_STREAM_MEM_OP_WRITE_VALUE_64 = 5, /**< Represents a ::cuStreamWriteValue64 operation */ + CU_STREAM_MEM_OP_BARRIER = 6, /**< Insert a memory barrier of the specified type */ + CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES = 3 /**< This has the same effect as ::CU_STREAM_WAIT_VALUE_FLUSH, but as a + standalone operation. */ +} CUstreamBatchMemOpType; + +/** + * Flags for ::cuStreamMemoryBarrier + */ +typedef enum CUstreamMemoryBarrier_flags_enum { + CU_STREAM_MEMORY_BARRIER_TYPE_SYS = 0x0, /**< System-wide memory barrier. */ + CU_STREAM_MEMORY_BARRIER_TYPE_GPU = 0x1 /**< Limit memory barrier scope to the GPU. */ +} CUstreamMemoryBarrier_flags; + +/** + * Per-operation parameters for ::cuStreamBatchMemOp + */ +typedef union CUstreamBatchMemOpParams_union { + CUstreamBatchMemOpType operation; + struct CUstreamMemOpWaitValueParams_st { + CUstreamBatchMemOpType operation; + CUdeviceptr address; + union { + cuuint32_t value; + cuuint64_t value64; + }; + unsigned int flags; + CUdeviceptr alias; /**< For driver internal use. Initial value is unimportant. */ + } waitValue; + struct CUstreamMemOpWriteValueParams_st { + CUstreamBatchMemOpType operation; + CUdeviceptr address; + union { + cuuint32_t value; + cuuint64_t value64; + }; + unsigned int flags; + CUdeviceptr alias; /**< For driver internal use. Initial value is unimportant. */ + } writeValue; + struct CUstreamMemOpFlushRemoteWritesParams_st { + CUstreamBatchMemOpType operation; + unsigned int flags; + } flushRemoteWrites; + struct CUstreamMemOpMemoryBarrierParams_st { /**< Only supported in the _v2 API */ + CUstreamBatchMemOpType operation; + unsigned int flags; + } memoryBarrier; + cuuint64_t pad[6]; +} CUstreamBatchMemOpParams_v1; +typedef CUstreamBatchMemOpParams_v1 CUstreamBatchMemOpParams; + +typedef struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st { + CUcontext ctx; + unsigned int count; + CUstreamBatchMemOpParams *paramArray; + unsigned int flags; +} CUDA_BATCH_MEM_OP_NODE_PARAMS_v1; +typedef CUDA_BATCH_MEM_OP_NODE_PARAMS_v1 CUDA_BATCH_MEM_OP_NODE_PARAMS; + +/** + * Batch memory operation node parameters + */ +typedef struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st { + CUcontext ctx; /**< Context to use for the operations. */ + unsigned int count; /**< Number of operations in paramArray. */ + CUstreamBatchMemOpParams *paramArray; /**< Array of batch memory operations. */ + unsigned int flags; /**< Flags to control the node. */ +} CUDA_BATCH_MEM_OP_NODE_PARAMS_v2; + +/** + * Occupancy calculator flag + */ +typedef enum CUoccupancy_flags_enum { + CU_OCCUPANCY_DEFAULT = 0x0, /**< Default behavior */ + CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE = 0x1 /**< Assume global caching is enabled and cannot be automatically turned off */ +} CUoccupancy_flags; + +/** + * Flags for ::cuStreamUpdateCaptureDependencies + */ +typedef enum CUstreamUpdateCaptureDependencies_flags_enum { + CU_STREAM_ADD_CAPTURE_DEPENDENCIES = 0x0, /**< Add new nodes to the dependency set */ + CU_STREAM_SET_CAPTURE_DEPENDENCIES = 0x1 /**< Replace the dependency set with the new nodes */ +} CUstreamUpdateCaptureDependencies_flags; + +/** +* Types of async notification that can be sent +*/ +typedef enum CUasyncNotificationType_enum { + CU_ASYNC_NOTIFICATION_TYPE_OVER_BUDGET = 0x1 +} CUasyncNotificationType; + +/** +* Information passed to the user via the async notification callback +*/ +typedef struct CUasyncNotificationInfo_st { + CUasyncNotificationType type; + union { + struct { + unsigned long long bytesOverBudget; + } overBudget; + } info; +} CUasyncNotificationInfo; + +/** + * CUDA async notification callback + * \param info Information describing what actions to take as a result of this trim notification. + * \param userData Pointer to user defined data provided at registration. + * \param callback The callback handle associated with this specific callback. + */ +typedef void (*CUasyncCallback)(CUasyncNotificationInfo *info, void *userData, CUasyncCallbackHandle callback); + +/** + * Array formats + */ +typedef enum CUarray_format_enum { + CU_AD_FORMAT_UNSIGNED_INT8 = 0x01, /**< Unsigned 8-bit integers */ + CU_AD_FORMAT_UNSIGNED_INT16 = 0x02, /**< Unsigned 16-bit integers */ + CU_AD_FORMAT_UNSIGNED_INT32 = 0x03, /**< Unsigned 32-bit integers */ + CU_AD_FORMAT_SIGNED_INT8 = 0x08, /**< Signed 8-bit integers */ + CU_AD_FORMAT_SIGNED_INT16 = 0x09, /**< Signed 16-bit integers */ + CU_AD_FORMAT_SIGNED_INT32 = 0x0a, /**< Signed 32-bit integers */ + CU_AD_FORMAT_HALF = 0x10, /**< 16-bit floating point */ + CU_AD_FORMAT_FLOAT = 0x20, /**< 32-bit floating point */ + CU_AD_FORMAT_NV12 = 0xb0, /**< 8-bit YUV planar format, with 4:2:0 sampling */ + CU_AD_FORMAT_UNORM_INT8X1 = 0xc0, /**< 1 channel unsigned 8-bit normalized integer */ + CU_AD_FORMAT_UNORM_INT8X2 = 0xc1, /**< 2 channel unsigned 8-bit normalized integer */ + CU_AD_FORMAT_UNORM_INT8X4 = 0xc2, /**< 4 channel unsigned 8-bit normalized integer */ + CU_AD_FORMAT_UNORM_INT16X1 = 0xc3, /**< 1 channel unsigned 16-bit normalized integer */ + CU_AD_FORMAT_UNORM_INT16X2 = 0xc4, /**< 2 channel unsigned 16-bit normalized integer */ + CU_AD_FORMAT_UNORM_INT16X4 = 0xc5, /**< 4 channel unsigned 16-bit normalized integer */ + CU_AD_FORMAT_SNORM_INT8X1 = 0xc6, /**< 1 channel signed 8-bit normalized integer */ + CU_AD_FORMAT_SNORM_INT8X2 = 0xc7, /**< 2 channel signed 8-bit normalized integer */ + CU_AD_FORMAT_SNORM_INT8X4 = 0xc8, /**< 4 channel signed 8-bit normalized integer */ + CU_AD_FORMAT_SNORM_INT16X1 = 0xc9, /**< 1 channel signed 16-bit normalized integer */ + CU_AD_FORMAT_SNORM_INT16X2 = 0xca, /**< 2 channel signed 16-bit normalized integer */ + CU_AD_FORMAT_SNORM_INT16X4 = 0xcb, /**< 4 channel signed 16-bit normalized integer */ + CU_AD_FORMAT_BC1_UNORM = 0x91, /**< 4 channel unsigned normalized block-compressed (BC1 compression) format */ + CU_AD_FORMAT_BC1_UNORM_SRGB = 0x92, /**< 4 channel unsigned normalized block-compressed (BC1 compression) format with sRGB encoding*/ + CU_AD_FORMAT_BC2_UNORM = 0x93, /**< 4 channel unsigned normalized block-compressed (BC2 compression) format */ + CU_AD_FORMAT_BC2_UNORM_SRGB = 0x94, /**< 4 channel unsigned normalized block-compressed (BC2 compression) format with sRGB encoding*/ + CU_AD_FORMAT_BC3_UNORM = 0x95, /**< 4 channel unsigned normalized block-compressed (BC3 compression) format */ + CU_AD_FORMAT_BC3_UNORM_SRGB = 0x96, /**< 4 channel unsigned normalized block-compressed (BC3 compression) format with sRGB encoding*/ + CU_AD_FORMAT_BC4_UNORM = 0x97, /**< 1 channel unsigned normalized block-compressed (BC4 compression) format */ + CU_AD_FORMAT_BC4_SNORM = 0x98, /**< 1 channel signed normalized block-compressed (BC4 compression) format */ + CU_AD_FORMAT_BC5_UNORM = 0x99, /**< 2 channel unsigned normalized block-compressed (BC5 compression) format */ + CU_AD_FORMAT_BC5_SNORM = 0x9a, /**< 2 channel signed normalized block-compressed (BC5 compression) format */ + CU_AD_FORMAT_BC6H_UF16 = 0x9b, /**< 3 channel unsigned half-float block-compressed (BC6H compression) format */ + CU_AD_FORMAT_BC6H_SF16 = 0x9c, /**< 3 channel signed half-float block-compressed (BC6H compression) format */ + CU_AD_FORMAT_BC7_UNORM = 0x9d, /**< 4 channel unsigned normalized block-compressed (BC7 compression) format */ + CU_AD_FORMAT_BC7_UNORM_SRGB = 0x9e /**< 4 channel unsigned normalized block-compressed (BC7 compression) format with sRGB encoding */ +} CUarray_format; + +/** + * Texture reference addressing modes + */ +typedef enum CUaddress_mode_enum { + CU_TR_ADDRESS_MODE_WRAP = 0, /**< Wrapping address mode */ + CU_TR_ADDRESS_MODE_CLAMP = 1, /**< Clamp to edge address mode */ + CU_TR_ADDRESS_MODE_MIRROR = 2, /**< Mirror address mode */ + CU_TR_ADDRESS_MODE_BORDER = 3 /**< Border address mode */ +} CUaddress_mode; + +/** + * Texture reference filtering modes + */ +typedef enum CUfilter_mode_enum { + CU_TR_FILTER_MODE_POINT = 0, /**< Point filter mode */ + CU_TR_FILTER_MODE_LINEAR = 1 /**< Linear filter mode */ +} CUfilter_mode; + +/** + * Device properties + */ +typedef enum CUdevice_attribute_enum { + CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1, /**< Maximum number of threads per block */ + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2, /**< Maximum block dimension X */ + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3, /**< Maximum block dimension Y */ + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4, /**< Maximum block dimension Z */ + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5, /**< Maximum grid dimension X */ + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6, /**< Maximum grid dimension Y */ + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7, /**< Maximum grid dimension Z */ + CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8, /**< Maximum shared memory available per block in bytes */ + CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK */ + CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9, /**< Memory available on device for __constant__ variables in a CUDA C kernel in bytes */ + CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10, /**< Warp size in threads */ + CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11, /**< Maximum pitch in bytes allowed by memory copies */ + CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12, /**< Maximum number of 32-bit registers available per block */ + CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK */ + CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13, /**< Typical clock frequency in kilohertz */ + CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14, /**< Alignment requirement for textures */ + CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15, /**< Device can possibly copy memory and execute a kernel concurrently. Deprecated. Use instead CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT. */ + CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16, /**< Number of multiprocessors on device */ + CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17, /**< Specifies whether there is a run time limit on kernels */ + CU_DEVICE_ATTRIBUTE_INTEGRATED = 18, /**< Device is integrated with host memory */ + CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19, /**< Device can map host memory into CUDA address space */ + CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20, /**< Compute mode (See ::CUcomputemode for details) */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21, /**< Maximum 1D texture width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22, /**< Maximum 2D texture width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23, /**< Maximum 2D texture height */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24, /**< Maximum 3D texture width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25, /**< Maximum 3D texture height */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26, /**< Maximum 3D texture depth */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = 27, /**< Maximum 2D layered texture width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = 28, /**< Maximum 2D layered texture height */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = 29, /**< Maximum layers in a 2D layered texture */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS */ + CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30, /**< Alignment requirement for surfaces */ + CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31, /**< Device can possibly execute multiple kernels concurrently */ + CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32, /**< Device has ECC support enabled */ + CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33, /**< PCI bus ID of the device */ + CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34, /**< PCI device ID of the device */ + CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35, /**< Device is using TCC driver model */ + CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = 36, /**< Peak memory clock frequency in kilohertz */ + CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = 37, /**< Global memory bus width in bits */ + CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = 38, /**< Size of L2 cache in bytes */ + CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = 39, /**< Maximum resident threads per multiprocessor */ + CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40, /**< Number of asynchronous engines */ + CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41, /**< Device shares a unified address space with the host */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = 42, /**< Maximum 1D layered texture width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = 43, /**< Maximum layers in a 1D layered texture */ + CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = 44, /**< Deprecated, do not use. */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = 45, /**< Maximum 2D texture width if CUDA_ARRAY3D_TEXTURE_GATHER is set */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = 46, /**< Maximum 2D texture height if CUDA_ARRAY3D_TEXTURE_GATHER is set */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = 47, /**< Alternate maximum 3D texture width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = 48, /**< Alternate maximum 3D texture height */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = 49, /**< Alternate maximum 3D texture depth */ + CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50, /**< PCI domain ID of the device */ + CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51, /**< Pitch alignment requirement for textures */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = 52, /**< Maximum cubemap texture width/height */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = 53, /**< Maximum cubemap layered texture width/height */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = 54, /**< Maximum layers in a cubemap layered texture */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = 55, /**< Maximum 1D surface width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = 56, /**< Maximum 2D surface width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = 57, /**< Maximum 2D surface height */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = 58, /**< Maximum 3D surface width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = 59, /**< Maximum 3D surface height */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = 60, /**< Maximum 3D surface depth */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = 61, /**< Maximum 1D layered surface width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = 62, /**< Maximum layers in a 1D layered surface */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = 63, /**< Maximum 2D layered surface width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = 64, /**< Maximum 2D layered surface height */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = 65, /**< Maximum layers in a 2D layered surface */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = 66, /**< Maximum cubemap surface width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = 67, /**< Maximum cubemap layered surface width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = 68, /**< Maximum layers in a cubemap layered surface */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = 69, /**< Deprecated, do not use. Use cudaDeviceGetTexture1DLinearMaxWidth() or cuDeviceGetTexture1DLinearMaxWidth() instead. */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = 70, /**< Maximum 2D linear texture width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = 71, /**< Maximum 2D linear texture height */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = 72, /**< Maximum 2D linear texture pitch in bytes */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = 73, /**< Maximum mipmapped 2D texture width */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = 74, /**< Maximum mipmapped 2D texture height */ + CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75, /**< Major compute capability version number */ + CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76, /**< Minor compute capability version number */ + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = 77, /**< Maximum mipmapped 1D texture width */ + CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = 78, /**< Device supports stream priorities */ + CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = 79, /**< Device supports caching globals in L1 */ + CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = 80, /**< Device supports caching locals in L1 */ + CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = 81, /**< Maximum shared memory available per multiprocessor in bytes */ + CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = 82, /**< Maximum number of 32-bit registers available per multiprocessor */ + CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83, /**< Device can allocate managed memory on this system */ + CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = 84, /**< Device is on a multi-GPU board */ + CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = 85, /**< Unique id for a group of devices on the same multi-GPU board */ + CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED = 86, /**< Link between the device and the host supports native atomic operations (this is a placeholder attribute, and is not supported on any current hardware)*/ + CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO = 87, /**< Ratio of single precision performance (in floating-point operations per second) to double precision performance */ + CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS = 88, /**< Device supports coherently accessing pageable memory without calling cudaHostRegister on it */ + CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS = 89, /**< Device can coherently access managed memory concurrently with the CPU */ + CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED = 90, /**< Device supports compute preemption. */ + CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM = 91, /**< Device can access host registered memory at the same virtual address as the CPU */ + CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1 = 92, /**< Deprecated, along with v1 MemOps API, ::cuStreamBatchMemOp and related APIs are supported. */ + CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1 = 93, /**< Deprecated, along with v1 MemOps API, 64-bit operations are supported in ::cuStreamBatchMemOp and related APIs. */ + CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1 = 94, /**< Deprecated, along with v1 MemOps API, ::CU_STREAM_WAIT_VALUE_NOR is supported. */ + CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH = 95, /**< Device supports launching cooperative kernels via ::cuLaunchCooperativeKernel */ + CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH = 96, /**< Deprecated, ::cuLaunchCooperativeKernelMultiDevice is deprecated. */ + CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN = 97, /**< Maximum optin shared memory per block */ + CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES = 98, /**< The ::CU_STREAM_WAIT_VALUE_FLUSH flag and the ::CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES MemOp are supported on the device. See \ref CUDA_MEMOP for additional details. */ + CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED = 99, /**< Device supports host memory registration via ::cudaHostRegister. */ + CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES = 100, /**< Device accesses pageable memory via the host's page tables. */ + CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST = 101, /**< The host can directly access managed memory on the device without migration. */ + CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED = 102, /**< Deprecated, Use CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED*/ + CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED = 102, /**< Device supports virtual memory management APIs like ::cuMemAddressReserve, ::cuMemCreate, ::cuMemMap and related APIs */ + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED = 103, /**< Device supports exporting memory to a posix file descriptor with ::cuMemExportToShareableHandle, if requested via ::cuMemCreate */ + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED = 104, /**< Device supports exporting memory to a Win32 NT handle with ::cuMemExportToShareableHandle, if requested via ::cuMemCreate */ + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED = 105, /**< Device supports exporting memory to a Win32 KMT handle with ::cuMemExportToShareableHandle, if requested via ::cuMemCreate */ + CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR = 106, /**< Maximum number of blocks per multiprocessor */ + CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED = 107, /**< Device supports compression of memory */ + CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE = 108, /**< Maximum L2 persisting lines capacity setting in bytes. */ + CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE = 109, /**< Maximum value of CUaccessPolicyWindow::num_bytes. */ + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED = 110, /**< Device supports specifying the GPUDirect RDMA flag with ::cuMemCreate */ + CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK = 111, /**< Shared memory reserved by CUDA driver per block in bytes */ + CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED = 112, /**< Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays */ + CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED = 113, /**< Device supports using the ::cuMemHostRegister flag ::CU_MEMHOSTERGISTER_READ_ONLY to register memory that must be mapped as read-only to the GPU */ + CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED = 114, /**< External timeline semaphore interop is supported on the device */ + CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED = 115, /**< Device supports using the ::cuMemAllocAsync and ::cuMemPool family of APIs */ + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED = 116, /**< Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see https://docs.nvidia.com/cuda/gpudirect-rdma for more information) */ + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS = 117, /**< The returned attribute shall be interpreted as a bitmask, where the individual bits are described by the ::CUflushGPUDirectRDMAWritesOptions enum */ + CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING = 118, /**< GPUDirect RDMA writes to the device do not need to be flushed for consumers within the scope indicated by the returned attribute. See ::CUGPUDirectRDMAWritesOrdering for the numerical values returned here. */ + CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES = 119, /**< Handle types supported with mempool based IPC */ + CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH = 120, /**< Indicates device supports cluster launch */ + CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED = 121, /**< Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays */ + CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS = 122, /**< 64-bit operations are supported in ::cuStreamBatchMemOp and related MemOp APIs. */ + CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR = 123, /**< ::CU_STREAM_WAIT_VALUE_NOR is supported by MemOp APIs. */ + CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED = 124, /**< Device supports buffer sharing with dma_buf mechanism. */ + CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED = 125, /**< Device supports IPC Events. */ + CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT = 126, /**< Number of memory domains the device supports. */ + CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED = 127, /**< Device supports accessing memory using Tensor Map. */ + CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED = 128, /**< Device supports exporting memory to a fabric handle with cuMemExportToShareableHandle() or requested with cuMemCreate() */ + CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS = 129, /**< Device supports unified function pointers. */ + CU_DEVICE_ATTRIBUTE_NUMA_CONFIG = 130, + CU_DEVICE_ATTRIBUTE_NUMA_ID = 131, + CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED = 132, /**< Device supports switch multicast and reduction operations. */ + CU_DEVICE_ATTRIBUTE_MPS_ENABLED = 133, /**< Indicates if contexts created on this device will be shared via MPS */ + CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID = 134, /**< NUMA ID of the host node closest to the device. Returns -1 when system does not support NUMA. */ + CU_DEVICE_ATTRIBUTE_MAX +} CUdevice_attribute; + +/** + * Legacy device properties + */ +typedef struct CUdevprop_st { + int maxThreadsPerBlock; /**< Maximum number of threads per block */ + int maxThreadsDim[3]; /**< Maximum size of each dimension of a block */ + int maxGridSize[3]; /**< Maximum size of each dimension of a grid */ + int sharedMemPerBlock; /**< Shared memory available per block in bytes */ + int totalConstantMemory; /**< Constant memory available on device in bytes */ + int SIMDWidth; /**< Warp size in threads */ + int memPitch; /**< Maximum pitch in bytes allowed by memory copies */ + int regsPerBlock; /**< 32-bit registers available per block */ + int clockRate; /**< Clock frequency in kilohertz */ + int textureAlign; /**< Alignment requirement for textures */ +} CUdevprop_v1; +typedef CUdevprop_v1 CUdevprop; + +/** + * Pointer information + */ +typedef enum CUpointer_attribute_enum { + CU_POINTER_ATTRIBUTE_CONTEXT = 1, /**< The ::CUcontext on which a pointer was allocated or registered */ + CU_POINTER_ATTRIBUTE_MEMORY_TYPE = 2, /**< The ::CUmemorytype describing the physical location of a pointer */ + CU_POINTER_ATTRIBUTE_DEVICE_POINTER = 3, /**< The address at which a pointer's memory may be accessed on the device */ + CU_POINTER_ATTRIBUTE_HOST_POINTER = 4, /**< The address at which a pointer's memory may be accessed on the host */ + CU_POINTER_ATTRIBUTE_P2P_TOKENS = 5, /**< A pair of tokens for use with the nv-p2p.h Linux kernel interface */ + CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = 6, /**< Synchronize every synchronous memory operation initiated on this region */ + CU_POINTER_ATTRIBUTE_BUFFER_ID = 7, /**< A process-wide unique ID for an allocated memory region*/ + CU_POINTER_ATTRIBUTE_IS_MANAGED = 8, /**< Indicates if the pointer points to managed memory */ + CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL = 9, /**< A device ordinal of a device on which a pointer was allocated or registered */ + CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE = 10, /**< 1 if this pointer maps to an allocation that is suitable for ::cudaIpcGetMemHandle, 0 otherwise **/ + CU_POINTER_ATTRIBUTE_RANGE_START_ADDR = 11, /**< Starting address for this requested pointer */ + CU_POINTER_ATTRIBUTE_RANGE_SIZE = 12, /**< Size of the address range for this requested pointer */ + CU_POINTER_ATTRIBUTE_MAPPED = 13, /**< 1 if this pointer is in a valid address range that is mapped to a backing allocation, 0 otherwise **/ + CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES = 14, /**< Bitmask of allowed ::CUmemAllocationHandleType for this allocation **/ + CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE = 15, /**< 1 if the memory this pointer is referencing can be used with the GPUDirect RDMA API **/ + CU_POINTER_ATTRIBUTE_ACCESS_FLAGS = 16, /**< Returns the access flags the device associated with the current context has on the corresponding memory referenced by the pointer given */ + CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE = 17, /**< Returns the mempool handle for the allocation if it was allocated from a mempool. Otherwise returns NULL. **/ + CU_POINTER_ATTRIBUTE_MAPPING_SIZE = 18, /**< Size of the actual underlying mapping that the pointer belongs to **/ + CU_POINTER_ATTRIBUTE_MAPPING_BASE_ADDR = 19, /**< The start address of the mapping that the pointer belongs to **/ + CU_POINTER_ATTRIBUTE_MEMORY_BLOCK_ID = 20 /**< A process-wide unique id corresponding to the physical allocation the pointer belongs to **/ +} CUpointer_attribute; + +/** + * Function properties + */ +typedef enum CUfunction_attribute_enum { + /** + * The maximum number of threads per block, beyond which a launch of the + * function would fail. This number depends on both the function and the + * device on which the function is currently loaded. + */ + CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0, + + /** + * The size in bytes of statically-allocated shared memory required by + * this function. This does not include dynamically-allocated shared + * memory requested by the user at runtime. + */ + CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1, + + /** + * The size in bytes of user-allocated constant memory required by this + * function. + */ + CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2, + + /** + * The size in bytes of local memory used by each thread of this function. + */ + CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3, + + /** + * The number of registers used by each thread of this function. + */ + CU_FUNC_ATTRIBUTE_NUM_REGS = 4, + + /** + * The PTX virtual architecture version for which the function was + * compiled. This value is the major PTX version * 10 + the minor PTX + * version, so a PTX version 1.3 function would return the value 13. + * Note that this may return the undefined value of 0 for cubins + * compiled prior to CUDA 3.0. + */ + CU_FUNC_ATTRIBUTE_PTX_VERSION = 5, + + /** + * The binary architecture version for which the function was compiled. + * This value is the major binary version * 10 + the minor binary version, + * so a binary version 1.3 function would return the value 13. Note that + * this will return a value of 10 for legacy cubins that do not have a + * properly-encoded binary architecture version. + */ + CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6, + + /** + * The attribute to indicate whether the function has been compiled with + * user specified option "-Xptxas --dlcm=ca" set . + */ + CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7, + + /** + * The maximum size in bytes of dynamically-allocated shared memory that can be used by + * this function. If the user-specified dynamic shared memory size is larger than this + * value, the launch will fail. + * See ::cuFuncSetAttribute, ::cuKernelSetAttribute + */ + CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = 8, + + /** + * On devices where the L1 cache and shared memory use the same hardware resources, + * this sets the shared memory carveout preference, in percent of the total shared memory. + * Refer to ::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR. + * This is only a hint, and the driver can choose a different ratio if required to execute the function. + * See ::cuFuncSetAttribute, ::cuKernelSetAttribute + */ + CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 9, + + /** + * If this attribute is set, the kernel must launch with a valid cluster + * size specified. + * See ::cuFuncSetAttribute, ::cuKernelSetAttribute + */ + CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET = 10, + + /** + * The required cluster width in blocks. The values must either all be 0 or + * all be positive. The validity of the cluster dimensions is otherwise + * checked at launch time. + * + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime will return CUDA_ERROR_NOT_PERMITTED. + * See ::cuFuncSetAttribute, ::cuKernelSetAttribute + */ + CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH = 11, + + /** + * The required cluster height in blocks. The values must either all be 0 or + * all be positive. The validity of the cluster dimensions is otherwise + * checked at launch time. + * + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime should return CUDA_ERROR_NOT_PERMITTED. + * See ::cuFuncSetAttribute, ::cuKernelSetAttribute + */ + CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT = 12, + + /** + * The required cluster depth in blocks. The values must either all be 0 or + * all be positive. The validity of the cluster dimensions is otherwise + * checked at launch time. + * + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime should return CUDA_ERROR_NOT_PERMITTED. + * See ::cuFuncSetAttribute, ::cuKernelSetAttribute + */ + CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH = 13, + + /** + * Whether the function can be launched with non-portable cluster size. 1 is + * allowed, 0 is disallowed. A non-portable cluster size may only function + * on the specific SKUs the program is tested on. The launch might fail if + * the program is run on a different hardware platform. + * + * CUDA API provides cudaOccupancyMaxActiveClusters to assist with checking + * whether the desired size can be launched on the current device. + * + * Portable Cluster Size + * + * A portable cluster size is guaranteed to be functional on all compute + * capabilities higher than the target compute capability. The portable + * cluster size for sm_90 is 8 blocks per cluster. This value may increase + * for future compute capabilities. + * + * The specific hardware unit may support higher cluster sizes that’s not + * guaranteed to be portable. + * See ::cuFuncSetAttribute, ::cuKernelSetAttribute + */ + CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED = 14, + + /** + * The block scheduling policy of a function. The value type is + * CUclusterSchedulingPolicy / cudaClusterSchedulingPolicy. + * See ::cuFuncSetAttribute, ::cuKernelSetAttribute + */ + CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = 15, + + CU_FUNC_ATTRIBUTE_MAX +} CUfunction_attribute; + +/** + * Function cache configurations + */ +typedef enum CUfunc_cache_enum { + CU_FUNC_CACHE_PREFER_NONE = 0x00, /**< no preference for shared memory or L1 (default) */ + CU_FUNC_CACHE_PREFER_SHARED = 0x01, /**< prefer larger shared memory and smaller L1 cache */ + CU_FUNC_CACHE_PREFER_L1 = 0x02, /**< prefer larger L1 cache and smaller shared memory */ + CU_FUNC_CACHE_PREFER_EQUAL = 0x03 /**< prefer equal sized L1 cache and shared memory */ +} CUfunc_cache; + +/** + * \deprecated + * + * Shared memory configurations + */ +typedef enum CUsharedconfig_enum { + CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE = 0x00, /**< set default shared memory bank size */ + CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE = 0x01, /**< set shared memory bank width to four bytes */ + CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE = 0x02 /**< set shared memory bank width to eight bytes */ +} CUsharedconfig; + +/** + * Shared memory carveout configurations. These may be passed to ::cuFuncSetAttribute or ::cuKernelSetAttribute + */ +typedef enum CUshared_carveout_enum { + CU_SHAREDMEM_CARVEOUT_DEFAULT = -1, /**< No preference for shared memory or L1 (default) */ + CU_SHAREDMEM_CARVEOUT_MAX_SHARED = 100, /**< Prefer maximum available shared memory, minimum L1 cache */ + CU_SHAREDMEM_CARVEOUT_MAX_L1 = 0 /**< Prefer maximum available L1 cache, minimum shared memory */ +} CUshared_carveout; + +/** + * Memory types + */ +typedef enum CUmemorytype_enum { + CU_MEMORYTYPE_HOST = 0x01, /**< Host memory */ + CU_MEMORYTYPE_DEVICE = 0x02, /**< Device memory */ + CU_MEMORYTYPE_ARRAY = 0x03, /**< Array memory */ + CU_MEMORYTYPE_UNIFIED = 0x04 /**< Unified device or host memory */ +} CUmemorytype; + +/** + * Compute Modes + */ +typedef enum CUcomputemode_enum { + CU_COMPUTEMODE_DEFAULT = 0, /**< Default compute mode (Multiple contexts allowed per device) */ + CU_COMPUTEMODE_PROHIBITED = 2, /**< Compute-prohibited mode (No contexts can be created on this device at this time) */ + CU_COMPUTEMODE_EXCLUSIVE_PROCESS = 3 /**< Compute-exclusive-process mode (Only one context used by a single process can be present on this device at a time) */ +} CUcomputemode; + +/** + * Memory advise values + */ +typedef enum CUmem_advise_enum { + CU_MEM_ADVISE_SET_READ_MOSTLY = 1, /**< Data will mostly be read and only occasionally be written to */ + CU_MEM_ADVISE_UNSET_READ_MOSTLY = 2, /**< Undo the effect of ::CU_MEM_ADVISE_SET_READ_MOSTLY */ + CU_MEM_ADVISE_SET_PREFERRED_LOCATION = 3, /**< Set the preferred location for the data as the specified device */ + CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION = 4, /**< Clear the preferred location for the data */ + CU_MEM_ADVISE_SET_ACCESSED_BY = 5, /**< Data will be accessed by the specified device, so prevent page faults as much as possible */ + CU_MEM_ADVISE_UNSET_ACCESSED_BY = 6 /**< Let the Unified Memory subsystem decide on the page faulting policy for the specified device */ +} CUmem_advise; + +typedef enum CUmem_range_attribute_enum { + CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY = 1, /**< Whether the range will mostly be read and only occasionally be written to */ + CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION = 2, /**< The preferred location of the range */ + CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY = 3, /**< Memory range has ::CU_MEM_ADVISE_SET_ACCESSED_BY set for specified device */ + CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION = 4 /**< The last location to which the range was prefetched */ + , CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE = 5 /**< The preferred location type of the range */ + , CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID = 6 /**< The preferred location id of the range */ + , CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE = 7 /**< The last location type to which the range was prefetched */ + , CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID = 8 /**< The last location id to which the range was prefetched */ +} CUmem_range_attribute; + +/** + * Online compiler and linker options + */ +typedef enum CUjit_option_enum +{ + /** + * Max number of registers that a thread may use.\n + * Option type: unsigned int\n + * Applies to: compiler only + */ + CU_JIT_MAX_REGISTERS = 0, + + /** + * IN: Specifies minimum number of threads per block to target compilation + * for\n + * OUT: Returns the number of threads the compiler actually targeted. + * This restricts the resource utilization of the compiler (e.g. max + * registers) such that a block with the given number of threads should be + * able to launch based on register limitations. Note, this option does not + * currently take into account any other resource limitations, such as + * shared memory utilization.\n + * Cannot be combined with ::CU_JIT_TARGET.\n + * Option type: unsigned int\n + * Applies to: compiler only + */ + CU_JIT_THREADS_PER_BLOCK = 1, + + /** + * Overwrites the option value with the total wall clock time, in + * milliseconds, spent in the compiler and linker\n + * Option type: float\n + * Applies to: compiler and linker + */ + CU_JIT_WALL_TIME = 2, + + /** + * Pointer to a buffer in which to print any log messages + * that are informational in nature (the buffer size is specified via + * option ::CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES)\n + * Option type: char *\n + * Applies to: compiler and linker + */ + CU_JIT_INFO_LOG_BUFFER = 3, + + /** + * IN: Log buffer size in bytes. Log messages will be capped at this size + * (including null terminator)\n + * OUT: Amount of log buffer filled with messages\n + * Option type: unsigned int\n + * Applies to: compiler and linker + */ + CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES = 4, + + /** + * Pointer to a buffer in which to print any log messages that + * reflect errors (the buffer size is specified via option + * ::CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES)\n + * Option type: char *\n + * Applies to: compiler and linker + */ + CU_JIT_ERROR_LOG_BUFFER = 5, + + /** + * IN: Log buffer size in bytes. Log messages will be capped at this size + * (including null terminator)\n + * OUT: Amount of log buffer filled with messages\n + * Option type: unsigned int\n + * Applies to: compiler and linker + */ + CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES = 6, + + /** + * Level of optimizations to apply to generated code (0 - 4), with 4 + * being the default and highest level of optimizations.\n + * Option type: unsigned int\n + * Applies to: compiler only + */ + CU_JIT_OPTIMIZATION_LEVEL = 7, + + /** + * No option value required. Determines the target based on the current + * attached context (default)\n + * Option type: No option value needed\n + * Applies to: compiler and linker + */ + CU_JIT_TARGET_FROM_CUCONTEXT = 8, + + /** + * Target is chosen based on supplied ::CUjit_target. Cannot be + * combined with ::CU_JIT_THREADS_PER_BLOCK.\n + * Option type: unsigned int for enumerated type ::CUjit_target\n + * Applies to: compiler and linker + */ + CU_JIT_TARGET = 9, + + /** + * Specifies choice of fallback strategy if matching cubin is not found. + * Choice is based on supplied ::CUjit_fallback. This option cannot be + * used with cuLink* APIs as the linker requires exact matches.\n + * Option type: unsigned int for enumerated type ::CUjit_fallback\n + * Applies to: compiler only + */ + CU_JIT_FALLBACK_STRATEGY = 10, + + /** + * Specifies whether to create debug information in output (-g) + * (0: false, default)\n + * Option type: int\n + * Applies to: compiler and linker + */ + CU_JIT_GENERATE_DEBUG_INFO = 11, + + /** + * Generate verbose log messages (0: false, default)\n + * Option type: int\n + * Applies to: compiler and linker + */ + CU_JIT_LOG_VERBOSE = 12, + + /** + * Generate line number information (-lineinfo) (0: false, default)\n + * Option type: int\n + * Applies to: compiler only + */ + CU_JIT_GENERATE_LINE_INFO = 13, + + /** + * Specifies whether to enable caching explicitly (-dlcm) \n + * Choice is based on supplied ::CUjit_cacheMode_enum.\n + * Option type: unsigned int for enumerated type ::CUjit_cacheMode_enum\n + * Applies to: compiler only + */ + CU_JIT_CACHE_MODE = 14, + + /** + * \deprecated + * This jit option is deprecated and should not be used. + */ + CU_JIT_NEW_SM3X_OPT = 15, + + /** + * This jit option is used for internal purpose only. + */ + CU_JIT_FAST_COMPILE = 16, + + /** + * Array of device symbol names that will be relocated to the corresponding + * host addresses stored in ::CU_JIT_GLOBAL_SYMBOL_ADDRESSES.\n + * Must contain ::CU_JIT_GLOBAL_SYMBOL_COUNT entries.\n + * When loading a device module, driver will relocate all encountered + * unresolved symbols to the host addresses.\n + * It is only allowed to register symbols that correspond to unresolved + * global variables.\n + * It is illegal to register the same device symbol at multiple addresses.\n + * Option type: const char **\n + * Applies to: dynamic linker only + */ + CU_JIT_GLOBAL_SYMBOL_NAMES = 17, + + /** + * Array of host addresses that will be used to relocate corresponding + * device symbols stored in ::CU_JIT_GLOBAL_SYMBOL_NAMES.\n + * Must contain ::CU_JIT_GLOBAL_SYMBOL_COUNT entries.\n + * Option type: void **\n + * Applies to: dynamic linker only + */ + CU_JIT_GLOBAL_SYMBOL_ADDRESSES = 18, + + /** + * Number of entries in ::CU_JIT_GLOBAL_SYMBOL_NAMES and + * ::CU_JIT_GLOBAL_SYMBOL_ADDRESSES arrays.\n + * Option type: unsigned int\n + * Applies to: dynamic linker only + */ + CU_JIT_GLOBAL_SYMBOL_COUNT = 19, + + /** + * \deprecated + * Enable link-time optimization (-dlto) for device code (Disabled by default).\n + * This option is not supported on 32-bit platforms.\n + * Option type: int\n + * Applies to: compiler and linker + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_LTO = 20, + + /** + * \deprecated + * Control single-precision denormals (-ftz) support (0: false, default). + * 1 : flushes denormal values to zero + * 0 : preserves denormal values + * Option type: int\n + * Applies to: link-time optimization specified with CU_JIT_LTO + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_FTZ = 21, + + /** + * \deprecated + * Control single-precision floating-point division and reciprocals + * (-prec-div) support (1: true, default). + * 1 : Enables the IEEE round-to-nearest mode + * 0 : Enables the fast approximation mode + * Option type: int\n + * Applies to: link-time optimization specified with CU_JIT_LTO + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_PREC_DIV = 22, + + /** + * \deprecated + * Control single-precision floating-point square root + * (-prec-sqrt) support (1: true, default). + * 1 : Enables the IEEE round-to-nearest mode + * 0 : Enables the fast approximation mode + * Option type: int\n + * Applies to: link-time optimization specified with CU_JIT_LTO + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_PREC_SQRT = 23, + + /** + * \deprecated + * Enable/Disable the contraction of floating-point multiplies + * and adds/subtracts into floating-point multiply-add (-fma) + * operations (1: Enable, default; 0: Disable). + * Option type: int\n + * Applies to: link-time optimization specified with CU_JIT_LTO + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_FMA = 24, + + /** + * \deprecated + * Array of kernel names that should be preserved at link time while others + * can be removed.\n + * Must contain ::CU_JIT_REFERENCED_KERNEL_COUNT entries.\n + * Note that kernel names can be mangled by the compiler in which case the + * mangled name needs to be specified.\n + * Wildcard "*" can be used to represent zero or more characters instead of + * specifying the full or mangled name.\n + * It is important to note that the wildcard "*" is also added implicitly. + * For example, specifying "foo" will match "foobaz", "barfoo", "barfoobaz" and + * thus preserve all kernels with those names. This can be avoided by providing + * a more specific name like "barfoobaz".\n + * Option type: const char **\n + * Applies to: dynamic linker only + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_REFERENCED_KERNEL_NAMES = 25, + + /** + * \deprecated + * Number of entries in ::CU_JIT_REFERENCED_KERNEL_NAMES array.\n + * Option type: unsigned int\n + * Applies to: dynamic linker only + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_REFERENCED_KERNEL_COUNT = 26, + + /** + * \deprecated + * Array of variable names (__device__ and/or __constant__) that should be + * preserved at link time while others can be removed.\n + * Must contain ::CU_JIT_REFERENCED_VARIABLE_COUNT entries.\n + * Note that variable names can be mangled by the compiler in which case the + * mangled name needs to be specified.\n + * Wildcard "*" can be used to represent zero or more characters instead of + * specifying the full or mangled name.\n + * It is important to note that the wildcard "*" is also added implicitly. + * For example, specifying "foo" will match "foobaz", "barfoo", "barfoobaz" and + * thus preserve all variables with those names. This can be avoided by providing + * a more specific name like "barfoobaz".\n + * Option type: const char **\n + * Applies to: link-time optimization specified with CU_JIT_LTO + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_REFERENCED_VARIABLE_NAMES = 27, + + /** + * \deprecated + * Number of entries in ::CU_JIT_REFERENCED_VARIABLE_NAMES array.\n + * Option type: unsigned int\n + * Applies to: link-time optimization specified with CU_JIT_LTO + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_REFERENCED_VARIABLE_COUNT = 28, + + /** + * \deprecated + * This option serves as a hint to enable the JIT compiler/linker + * to remove constant (__constant__) and device (__device__) variables + * unreferenced in device code (Disabled by default).\n + * Note that host references to constant and device variables using APIs like + * ::cuModuleGetGlobal() with this option specified may result in undefined behavior unless + * the variables are explicitly specified using ::CU_JIT_REFERENCED_VARIABLE_NAMES.\n + * Option type: int\n + * Applies to: link-time optimization specified with CU_JIT_LTO + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_OPTIMIZE_UNUSED_DEVICE_VARIABLES = 29, + + /** + * Generate position independent code (0: false)\n + * Option type: int\n + * Applies to: compiler only + */ + CU_JIT_POSITION_INDEPENDENT_CODE = 30, + + /** + * This option hints to the JIT compiler the minimum number of CTAs from the + * kernel’s grid to be mapped to a SM. This option is ignored when used together + * with ::CU_JIT_MAX_REGISTERS or ::CU_JIT_THREADS_PER_BLOCK. + * Optimizations based on this option need ::CU_JIT_MAX_THREADS_PER_BLOCK to + * be specified as well. For kernels already using PTX directive .minnctapersm, + * this option will be ignored by default. Use ::CU_JIT_OVERRIDE_DIRECTIVE_VALUES + * to let this option take precedence over the PTX directive. + * Option type: unsigned int\n + * Applies to: compiler only + */ + CU_JIT_MIN_CTA_PER_SM = 31, + + /** + * Maximum number threads in a thread block, computed as the product of + * the maximum extent specifed for each dimension of the block. This limit + * is guaranteed not to be exeeded in any invocation of the kernel. Exceeding + * the the maximum number of threads results in runtime error or kernel launch + * failure. For kernels already using PTX directive .maxntid, this option will + * be ignored by default. Use ::CU_JIT_OVERRIDE_DIRECTIVE_VALUES to let this + * option take precedence over the PTX directive. + * Option type: int\n + * Applies to: compiler only + */ + CU_JIT_MAX_THREADS_PER_BLOCK = 32, + + /** + * This option lets the values specified using ::CU_JIT_MAX_REGISTERS, + * ::CU_JIT_THREADS_PER_BLOCK, ::CU_JIT_MAX_THREADS_PER_BLOCK and + * ::CU_JIT_MIN_CTA_PER_SM take precedence over any PTX directives. + * (0: Disable, default; 1: Enable) + * Option type: int\n + * Applies to: compiler only + */ + CU_JIT_OVERRIDE_DIRECTIVE_VALUES = 33, + CU_JIT_NUM_OPTIONS + +} CUjit_option; + +/* + * Indicates that compute device class supports accelerated features. + */ +#define CU_COMPUTE_ACCELERATED_TARGET_BASE 0x10000 + +/** + * Online compilation targets + */ +typedef enum CUjit_target_enum +{ + CU_TARGET_COMPUTE_30 = 30, /**< Compute device class 3.0 */ + CU_TARGET_COMPUTE_32 = 32, /**< Compute device class 3.2 */ + CU_TARGET_COMPUTE_35 = 35, /**< Compute device class 3.5 */ + CU_TARGET_COMPUTE_37 = 37, /**< Compute device class 3.7 */ + CU_TARGET_COMPUTE_50 = 50, /**< Compute device class 5.0 */ + CU_TARGET_COMPUTE_52 = 52, /**< Compute device class 5.2 */ + CU_TARGET_COMPUTE_53 = 53, /**< Compute device class 5.3 */ + CU_TARGET_COMPUTE_60 = 60, /**< Compute device class 6.0.*/ + CU_TARGET_COMPUTE_61 = 61, /**< Compute device class 6.1.*/ + CU_TARGET_COMPUTE_62 = 62, /**< Compute device class 6.2.*/ + CU_TARGET_COMPUTE_70 = 70, /**< Compute device class 7.0.*/ + CU_TARGET_COMPUTE_72 = 72, /**< Compute device class 7.2.*/ + CU_TARGET_COMPUTE_75 = 75, /**< Compute device class 7.5.*/ + CU_TARGET_COMPUTE_80 = 80, /**< Compute device class 8.0.*/ + CU_TARGET_COMPUTE_86 = 86, /**< Compute device class 8.6.*/ + CU_TARGET_COMPUTE_87 = 87, /**< Compute device class 8.7.*/ + CU_TARGET_COMPUTE_89 = 89, /**< Compute device class 8.9.*/ + CU_TARGET_COMPUTE_90 = 90, /**< Compute device class 9.0.*/ + + /**< Compute device class 9.0. with accelerated features.*/ + CU_TARGET_COMPUTE_90A = CU_COMPUTE_ACCELERATED_TARGET_BASE + CU_TARGET_COMPUTE_90, +} CUjit_target; + +/** + * Cubin matching fallback strategies + */ +typedef enum CUjit_fallback_enum +{ + CU_PREFER_PTX = 0, /**< Prefer to compile ptx if exact binary match not found */ + + CU_PREFER_BINARY /**< Prefer to fall back to compatible binary code if exact match not found */ + +} CUjit_fallback; + +/** + * Caching modes for dlcm + */ +typedef enum CUjit_cacheMode_enum +{ + CU_JIT_CACHE_OPTION_NONE = 0, /**< Compile with no -dlcm flag specified */ + CU_JIT_CACHE_OPTION_CG, /**< Compile with L1 cache disabled */ + CU_JIT_CACHE_OPTION_CA /**< Compile with L1 cache enabled */ +} CUjit_cacheMode; + +/** + * Device code formats + */ +typedef enum CUjitInputType_enum +{ + /** + * Compiled device-class-specific device code\n + * Applicable options: none + */ + CU_JIT_INPUT_CUBIN = 0, + + /** + * PTX source code\n + * Applicable options: PTX compiler options + */ + CU_JIT_INPUT_PTX = 1, + + /** + * Bundle of multiple cubins and/or PTX of some device code\n + * Applicable options: PTX compiler options, ::CU_JIT_FALLBACK_STRATEGY + */ + CU_JIT_INPUT_FATBINARY = 2, + + /** + * Host object with embedded device code\n + * Applicable options: PTX compiler options, ::CU_JIT_FALLBACK_STRATEGY + */ + CU_JIT_INPUT_OBJECT = 3, + + /** + * Archive of host objects with embedded device code\n + * Applicable options: PTX compiler options, ::CU_JIT_FALLBACK_STRATEGY + */ + CU_JIT_INPUT_LIBRARY = 4, + + /** + * \deprecated + * High-level intermediate code for link-time optimization\n + * Applicable options: NVVM compiler options, PTX compiler options + * + * Only valid with LTO-IR compiled with toolkits prior to CUDA 12.0 + */ + CU_JIT_INPUT_NVVM = 5, + + CU_JIT_NUM_INPUT_TYPES = 6 +} CUjitInputType; + +typedef struct CUlinkState_st *CUlinkState; + +/** + * Flags to register a graphics resource + */ +typedef enum CUgraphicsRegisterFlags_enum { + CU_GRAPHICS_REGISTER_FLAGS_NONE = 0x00, + CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = 0x01, + CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = 0x02, + CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST = 0x04, + CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = 0x08 +} CUgraphicsRegisterFlags; + +/** + * Flags for mapping and unmapping interop resources + */ +typedef enum CUgraphicsMapResourceFlags_enum { + CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0x00, + CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01, + CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02 +} CUgraphicsMapResourceFlags; + +/** + * Array indices for cube faces + */ +typedef enum CUarray_cubemap_face_enum { + CU_CUBEMAP_FACE_POSITIVE_X = 0x00, /**< Positive X face of cubemap */ + CU_CUBEMAP_FACE_NEGATIVE_X = 0x01, /**< Negative X face of cubemap */ + CU_CUBEMAP_FACE_POSITIVE_Y = 0x02, /**< Positive Y face of cubemap */ + CU_CUBEMAP_FACE_NEGATIVE_Y = 0x03, /**< Negative Y face of cubemap */ + CU_CUBEMAP_FACE_POSITIVE_Z = 0x04, /**< Positive Z face of cubemap */ + CU_CUBEMAP_FACE_NEGATIVE_Z = 0x05 /**< Negative Z face of cubemap */ +} CUarray_cubemap_face; + +/** + * Limits + */ +typedef enum CUlimit_enum { + CU_LIMIT_STACK_SIZE = 0x00, /**< GPU thread stack size */ + CU_LIMIT_PRINTF_FIFO_SIZE = 0x01, /**< GPU printf FIFO size */ + CU_LIMIT_MALLOC_HEAP_SIZE = 0x02, /**< GPU malloc heap size */ + CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH = 0x03, /**< GPU device runtime launch synchronize depth */ + CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = 0x04, /**< GPU device runtime pending launch count */ + CU_LIMIT_MAX_L2_FETCH_GRANULARITY = 0x05, /**< A value between 0 and 128 that indicates the maximum fetch granularity of L2 (in Bytes). This is a hint */ + CU_LIMIT_PERSISTING_L2_CACHE_SIZE = 0x06, /**< A size in bytes for L2 persisting lines cache size */ + CU_LIMIT_MAX +} CUlimit; + +/** + * Resource types + */ +typedef enum CUresourcetype_enum { + CU_RESOURCE_TYPE_ARRAY = 0x00, /**< Array resource */ + CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01, /**< Mipmapped array resource */ + CU_RESOURCE_TYPE_LINEAR = 0x02, /**< Linear resource */ + CU_RESOURCE_TYPE_PITCH2D = 0x03 /**< Pitch 2D resource */ +} CUresourcetype; + +#ifdef _WIN32 +#define CUDA_CB __stdcall +#else +#define CUDA_CB +#endif + +/** + * CUDA host function + * \param userData Argument value passed to the function + */ +typedef void (CUDA_CB *CUhostFn)(void *userData); + +/** + * Specifies performance hint with ::CUaccessPolicyWindow for hitProp and missProp members. + */ +typedef enum CUaccessProperty_enum { + CU_ACCESS_PROPERTY_NORMAL = 0, /**< Normal cache persistence. */ + CU_ACCESS_PROPERTY_STREAMING = 1, /**< Streaming access is less likely to persit from cache. */ + CU_ACCESS_PROPERTY_PERSISTING = 2 /**< Persisting access is more likely to persist in cache.*/ +} CUaccessProperty; + +/** + * Specifies an access policy for a window, a contiguous extent of memory + * beginning at base_ptr and ending at base_ptr + num_bytes. + * num_bytes is limited by CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE. + * Partition into many segments and assign segments such that: + * sum of "hit segments" / window == approx. ratio. + * sum of "miss segments" / window == approx 1-ratio. + * Segments and ratio specifications are fitted to the capabilities of + * the architecture. + * Accesses in a hit segment apply the hitProp access policy. + * Accesses in a miss segment apply the missProp access policy. + */ +typedef struct CUaccessPolicyWindow_st { + void *base_ptr; /**< Starting address of the access policy window. CUDA driver may align it. */ + size_t num_bytes; /**< Size in bytes of the window policy. CUDA driver may restrict the maximum size and alignment. */ + float hitRatio; /**< hitRatio specifies percentage of lines assigned hitProp, rest are assigned missProp. */ + CUaccessProperty hitProp; /**< ::CUaccessProperty set for hit. */ + CUaccessProperty missProp; /**< ::CUaccessProperty set for miss. Must be either NORMAL or STREAMING */ +} CUaccessPolicyWindow_v1; +/** + * Access policy window + */ +typedef CUaccessPolicyWindow_v1 CUaccessPolicyWindow; + +/** + * GPU kernel node parameters + */ +typedef struct CUDA_KERNEL_NODE_PARAMS_st { + CUfunction func; /**< Kernel to launch */ + unsigned int gridDimX; /**< Width of grid in blocks */ + unsigned int gridDimY; /**< Height of grid in blocks */ + unsigned int gridDimZ; /**< Depth of grid in blocks */ + unsigned int blockDimX; /**< X dimension of each thread block */ + unsigned int blockDimY; /**< Y dimension of each thread block */ + unsigned int blockDimZ; /**< Z dimension of each thread block */ + unsigned int sharedMemBytes; /**< Dynamic shared-memory size per thread block in bytes */ + void **kernelParams; /**< Array of pointers to kernel parameters */ + void **extra; /**< Extra options */ +} CUDA_KERNEL_NODE_PARAMS_v1; + +/** + * GPU kernel node parameters + */ +typedef struct CUDA_KERNEL_NODE_PARAMS_v2_st { + CUfunction func; /**< Kernel to launch */ + unsigned int gridDimX; /**< Width of grid in blocks */ + unsigned int gridDimY; /**< Height of grid in blocks */ + unsigned int gridDimZ; /**< Depth of grid in blocks */ + unsigned int blockDimX; /**< X dimension of each thread block */ + unsigned int blockDimY; /**< Y dimension of each thread block */ + unsigned int blockDimZ; /**< Z dimension of each thread block */ + unsigned int sharedMemBytes; /**< Dynamic shared-memory size per thread block in bytes */ + void **kernelParams; /**< Array of pointers to kernel parameters */ + void **extra; /**< Extra options */ + CUkernel kern; /**< Kernel to launch, will only be referenced if func is NULL */ + CUcontext ctx; /**< Context for the kernel task to run in. The value NULL will indicate the current context should be used by the api. This field is ignored if func is set. */ +} CUDA_KERNEL_NODE_PARAMS_v2; +typedef CUDA_KERNEL_NODE_PARAMS_v2 CUDA_KERNEL_NODE_PARAMS; + +/** + * GPU kernel node parameters + */ +typedef struct CUDA_KERNEL_NODE_PARAMS_v3_st { + CUfunction func; /**< Kernel to launch */ + unsigned int gridDimX; /**< Width of grid in blocks */ + unsigned int gridDimY; /**< Height of grid in blocks */ + unsigned int gridDimZ; /**< Depth of grid in blocks */ + unsigned int blockDimX; /**< X dimension of each thread block */ + unsigned int blockDimY; /**< Y dimension of each thread block */ + unsigned int blockDimZ; /**< Z dimension of each thread block */ + unsigned int sharedMemBytes; /**< Dynamic shared-memory size per thread block in bytes */ + void **kernelParams; /**< Array of pointers to kernel parameters */ + void **extra; /**< Extra options */ + CUkernel kern; /**< Kernel to launch, will only be referenced if func is NULL */ + CUcontext ctx; /**< Context for the kernel task to run in. The value NULL will indicate the current context should be used by the api. This field is ignored if func is set. */ +} CUDA_KERNEL_NODE_PARAMS_v3; + +/** + * Memset node parameters + */ +typedef struct CUDA_MEMSET_NODE_PARAMS_st { + CUdeviceptr dst; /**< Destination device pointer */ + size_t pitch; /**< Pitch of destination device pointer. Unused if height is 1 */ + unsigned int value; /**< Value to be set */ + unsigned int elementSize; /**< Size of each element in bytes. Must be 1, 2, or 4. */ + size_t width; /**< Width of the row in elements */ + size_t height; /**< Number of rows */ +} CUDA_MEMSET_NODE_PARAMS_v1; +typedef CUDA_MEMSET_NODE_PARAMS_v1 CUDA_MEMSET_NODE_PARAMS; + +/** + * Memset node parameters + */ +typedef struct CUDA_MEMSET_NODE_PARAMS_v2_st { + CUdeviceptr dst; /**< Destination device pointer */ + size_t pitch; /**< Pitch of destination device pointer. Unused if height is 1 */ + unsigned int value; /**< Value to be set */ + unsigned int elementSize; /**< Size of each element in bytes. Must be 1, 2, or 4. */ + size_t width; /**< Width of the row in elements */ + size_t height; /**< Number of rows */ + CUcontext ctx; /**< Context on which to run the node */ +} CUDA_MEMSET_NODE_PARAMS_v2; + +/** + * Host node parameters + */ +typedef struct CUDA_HOST_NODE_PARAMS_st { + CUhostFn fn; /**< The function to call when the node executes */ + void* userData; /**< Argument to pass to the function */ +} CUDA_HOST_NODE_PARAMS_v1; +typedef CUDA_HOST_NODE_PARAMS_v1 CUDA_HOST_NODE_PARAMS; + +/** + * Host node parameters + */ +typedef struct CUDA_HOST_NODE_PARAMS_v2_st { + CUhostFn fn; /**< The function to call when the node executes */ + void* userData; /**< Argument to pass to the function */ +} CUDA_HOST_NODE_PARAMS_v2; + +/** + * Conditional node handle flags + */ +#define CU_GRAPH_COND_ASSIGN_DEFAULT 0x1 /**< Default value is applied when graph is launched. */ + +/** + * Conditional node types + */ +typedef enum CUgraphConditionalNodeType_enum { + CU_GRAPH_COND_TYPE_IF = 0, /**< Conditional 'if' Node. Body executed once if condition value is non-zero. */ + CU_GRAPH_COND_TYPE_WHILE = 1, /**< Conditional 'while' Node. Body executed repeatedly while condition value is non-zero. */ +} CUgraphConditionalNodeType; + +/** + * Conditional node parameters + */ +typedef struct CUDA_CONDITIONAL_NODE_PARAMS { + CUgraphConditionalHandle handle; /**< Conditional node handle. + Handles must be created in advance of creating the node + using ::cuGraphConditionalHandleCreate. */ + CUgraphConditionalNodeType type; /**< Type of conditional node. */ + unsigned int size; /**< Size of graph output array. Must be 1. */ + CUgraph *phGraph_out; /**< CUDA-owned array populated with conditional node child graphs during creation of the node. + Valid for the lifetime of the conditional node. + The contents of the graph(s) are subject to the following constraints: + + - Allowed node types are kernel nodes, empty nodes, child graphs, memsets, + memcopies, and conditionals. This applies recursively to child graphs and conditional bodies. + - All kernels, including kernels in nested conditionals or child graphs at any level, + must belong to the same CUDA context. + + These graphs may be populated using graph node creation APIs or ::cuStreamBeginCaptureToGraph. */ + CUcontext ctx; /**< Context on which to run the node. Must match context used to create the handle and all body nodes. */ +} CUDA_CONDITIONAL_NODE_PARAMS; + +/** + * Graph node types + */ +typedef enum CUgraphNodeType_enum { + CU_GRAPH_NODE_TYPE_KERNEL = 0, /**< GPU kernel node */ + CU_GRAPH_NODE_TYPE_MEMCPY = 1, /**< Memcpy node */ + CU_GRAPH_NODE_TYPE_MEMSET = 2, /**< Memset node */ + CU_GRAPH_NODE_TYPE_HOST = 3, /**< Host (executable) node */ + CU_GRAPH_NODE_TYPE_GRAPH = 4, /**< Node which executes an embedded graph */ + CU_GRAPH_NODE_TYPE_EMPTY = 5, /**< Empty (no-op) node */ + CU_GRAPH_NODE_TYPE_WAIT_EVENT = 6, /**< External event wait node */ + CU_GRAPH_NODE_TYPE_EVENT_RECORD = 7, /**< External event record node */ + CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL = 8, /**< External semaphore signal node */ + CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT = 9, /**< External semaphore wait node */ + CU_GRAPH_NODE_TYPE_MEM_ALLOC = 10,/**< Memory Allocation Node */ + CU_GRAPH_NODE_TYPE_MEM_FREE = 11,/**< Memory Free Node */ + CU_GRAPH_NODE_TYPE_BATCH_MEM_OP = 12 /**< Batch MemOp Node */ + , + CU_GRAPH_NODE_TYPE_CONDITIONAL = 13 /**< Conditional Node + + May be used to implement a conditional execution path or loop + inside of a graph. The graph(s) contained within the body of the conditional node + can be selectively executed or iterated upon based on the value of a conditional + variable. + + Handles must be created in advance of creating the node + using ::cuGraphConditionalHandleCreate. + + The following restrictions apply to graphs which contain conditional nodes: + The graph cannot be used in a child node. + Only one instantiation of the graph may exist at any point in time. + The graph cannot be cloned. + + To set the control value, supply a default value when creating the handle and/or + call ::cudaGraphSetConditional from device code.*/ +} CUgraphNodeType; + +/** + * Type annotations that can be applied to graph edges as part of ::CUgraphEdgeData. + */ +typedef enum CUgraphDependencyType_enum { + CU_GRAPH_DEPENDENCY_TYPE_DEFAULT = 0, /**< This is an ordinary dependency. */ + CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC = 1 /**< This dependency type allows the downstream node to + use \c cudaGridDependencySynchronize(). It may only be used + between kernel nodes, and must be used with either the + ::CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC or + ::CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER outgoing port. */ +} CUgraphDependencyType; + +/** + * This port activates when the kernel has finished executing. + */ +#define CU_GRAPH_KERNEL_NODE_PORT_DEFAULT 0 +/** + * This port activates when all blocks of the kernel have performed cudaTriggerProgrammaticLaunchCompletion() + * or have terminated. It must be used with edge type ::CU_GRAPH_DEPENDENCY_TYPE_PROGRAMMATIC. See also + * ::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT. + */ +#define CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC 1 +/** + * This port activates when all blocks of the kernel have begun execution. See also + * ::CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT. + */ +#define CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER 2 + +/** + * Optional annotation for edges in a CUDA graph. Note, all edges implicitly have annotations and + * default to a zero-initialized value if not specified. A zero-initialized struct indicates a + * standard full serialization of two nodes with memory visibility. + */ +typedef struct CUgraphEdgeData_st { + unsigned char from_port; /**< This indicates when the dependency is triggered from the upstream + node on the edge. The meaning is specfic to the node type. A value + of 0 in all cases means full completion of the upstream node, with + memory visibility to the downstream node or portion thereof + (indicated by \c to_port). +
+ Only kernel nodes define non-zero ports. A kernel node + can use the following output port types: + ::CU_GRAPH_KERNEL_NODE_PORT_DEFAULT, ::CU_GRAPH_KERNEL_NODE_PORT_PROGRAMMATIC, + or ::CU_GRAPH_KERNEL_NODE_PORT_LAUNCH_ORDER. */ + unsigned char to_port; /**< This indicates what portion of the downstream node is dependent on + the upstream node or portion thereof (indicated by \c from_port). The + meaning is specific to the node type. A value of 0 in all cases means + the entirety of the downstream node is dependent on the upstream work. +
+ Currently no node types define non-zero ports. Accordingly, this field + must be set to zero. */ + unsigned char type; /**< This should be populated with a value from ::CUgraphDependencyType. (It + is typed as char due to compiler-specific layout of bitfields.) See + ::CUgraphDependencyType. */ + unsigned char reserved[5]; /**< These bytes are unused and must be zeroed. This ensures + compatibility if additional fields are added in the future. */ +} CUgraphEdgeData; + +/** + * Graph instantiation results +*/ +typedef enum CUgraphInstantiateResult_enum +{ + CUDA_GRAPH_INSTANTIATE_SUCCESS = 0, /**< Instantiation succeeded */ + CUDA_GRAPH_INSTANTIATE_ERROR = 1, /**< Instantiation failed for an unexpected reason which is described in the return value of the function */ + CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE = 2, /**< Instantiation failed due to invalid structure, such as cycles */ + CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED = 3, /**< Instantiation for device launch failed because the graph contained an unsupported operation */ + CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED = 4 /**< Instantiation for device launch failed due to the nodes belonging to different contexts */ +} CUgraphInstantiateResult; + +/** + * Graph instantiation parameters + */ +typedef struct CUDA_GRAPH_INSTANTIATE_PARAMS_st +{ + cuuint64_t flags; /**< Instantiation flags */ + CUstream hUploadStream; /**< Upload stream */ + CUgraphNode hErrNode_out; /**< The node which caused instantiation to fail, if any */ + CUgraphInstantiateResult result_out; /**< Whether instantiation was successful. If it failed, the reason why */ +} CUDA_GRAPH_INSTANTIATE_PARAMS; + +typedef enum CUsynchronizationPolicy_enum { + CU_SYNC_POLICY_AUTO = 1, + CU_SYNC_POLICY_SPIN = 2, + CU_SYNC_POLICY_YIELD = 3, + CU_SYNC_POLICY_BLOCKING_SYNC = 4 +} CUsynchronizationPolicy; + +/** + * Cluster scheduling policies. These may be passed to ::cuFuncSetAttribute or ::cuKernelSetAttribute + */ +typedef enum CUclusterSchedulingPolicy_enum { + CU_CLUSTER_SCHEDULING_POLICY_DEFAULT = 0, /**< the default policy */ + CU_CLUSTER_SCHEDULING_POLICY_SPREAD = 1, /**< spread the blocks within a cluster to the SMs */ + CU_CLUSTER_SCHEDULING_POLICY_LOAD_BALANCING = 2 /**< allow the hardware to load-balance the blocks in a cluster to the SMs */ +} CUclusterSchedulingPolicy; + +/** + * Memory Synchronization Domain + * + * A kernel can be launched in a specified memory synchronization domain that affects all memory operations issued by + * that kernel. A memory barrier issued in one domain will only order memory operations in that domain, thus eliminating + * latency increase from memory barriers ordering unrelated traffic. + * + * By default, kernels are launched in domain 0. Kernel launched with ::CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE will have a + * different domain ID. User may also alter the domain ID with ::CUlaunchMemSyncDomainMap for a specific stream / + * graph node / kernel launch. See ::CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN, ::cuStreamSetAttribute, ::cuLaunchKernelEx, + * ::cuGraphKernelNodeSetAttribute. + * + * Memory operations done in kernels launched in different domains are considered system-scope distanced. In other + * words, a GPU scoped memory synchronization is not sufficient for memory order to be observed by kernels in another + * memory synchronization domain even if they are on the same GPU. + */ +typedef enum CUlaunchMemSyncDomain_enum { + CU_LAUNCH_MEM_SYNC_DOMAIN_DEFAULT = 0, /**< Launch kernels in the default domain */ + CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE = 1 /**< Launch kernels in the remote domain */ +} CUlaunchMemSyncDomain; + +/** + * Memory Synchronization Domain map + * + * See ::cudaLaunchMemSyncDomain. + * + * By default, kernels are launched in domain 0. Kernel launched with ::CU_LAUNCH_MEM_SYNC_DOMAIN_REMOTE will have a + * different domain ID. User may also alter the domain ID with ::CUlaunchMemSyncDomainMap for a specific stream / + * graph node / kernel launch. See ::CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. + * + * Domain ID range is available through ::CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT. + */ +typedef struct CUlaunchMemSyncDomainMap_st { + unsigned char default_; /**< The default domain ID to use for designated kernels */ + unsigned char remote; /**< The remote domain ID to use for designated kernels */ +} CUlaunchMemSyncDomainMap; + +/** + * Launch attributes enum; used as id field of ::CUlaunchAttribute + */ +typedef enum CUlaunchAttributeID_enum { + CU_LAUNCH_ATTRIBUTE_IGNORE = 0 /**< Ignored entry, for convenient composition */ + , CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = 1 /**< Valid for streams, graph nodes, launches. See + ::CUlaunchAttributeValue::accessPolicyWindow. */ + , CU_LAUNCH_ATTRIBUTE_COOPERATIVE = 2 /**< Valid for graph nodes, launches. See + ::CUlaunchAttributeValue::cooperative. */ + , CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = 3 /**< Valid for streams. See + ::CUlaunchAttributeValue::syncPolicy. */ + , CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = 4 /**< Valid for graph nodes, launches. See ::CUlaunchAttributeValue::clusterDim. */ + , CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = 5 /**< Valid for graph nodes, launches. See ::CUlaunchAttributeValue::clusterSchedulingPolicyPreference. */ + , CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = 6 /**< Valid for launches. Setting + ::CUlaunchAttributeValue::programmaticStreamSerializationAllowed + to non-0 signals that the kernel will use programmatic + means to resolve its stream dependency, so that the + CUDA runtime should opportunistically allow the grid's + execution to overlap with the previous kernel in the + stream, if that kernel requests the overlap. The + dependent launches can choose to wait on the + dependency using the programmatic sync + (cudaGridDependencySynchronize() or equivalent PTX + instructions). */ + , CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = 7 /**< Valid for launches. Set + ::CUlaunchAttributeValue::programmaticEvent to + record the event. Event recorded through this + launch attribute is guaranteed to only trigger + after all block in the associated kernel trigger + the event. A block can trigger the event through + PTX launchdep.release or CUDA builtin function + cudaTriggerProgrammaticLaunchCompletion(). A + trigger can also be inserted at the beginning of + each block's execution if triggerAtBlockStart is + set to non-0. The dependent launches can choose to + wait on the dependency using the programmatic sync + (cudaGridDependencySynchronize() or equivalent PTX + instructions). Note that dependents (including the + CPU thread calling cuEventSynchronize()) are not + guaranteed to observe the release precisely when + it is released. For example, cuEventSynchronize() + may only observe the event trigger long after the + associated kernel has completed. This recording + type is primarily meant for establishing + programmatic dependency between device tasks. Note + also this type of dependency allows, but does not + guarantee, concurrent execution of tasks. +
+ The event supplied must not be an interprocess or + interop event. The event must disable timing (i.e. + must be created with the ::CU_EVENT_DISABLE_TIMING + flag set). + */ + , CU_LAUNCH_ATTRIBUTE_PRIORITY = 8 /**< Valid for streams, graph nodes, launches. See + ::CUlaunchAttributeValue::priority. */ + , CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = 9 /**< Valid for streams, graph nodes, launches. See + ::CUlaunchAttributeValue::memSyncDomainMap. */ + , CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = 10 /**< Valid for streams, graph nodes, launches. See + ::CUlaunchAttributeValue::memSyncDomain. */ + , CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = 12 /**< Valid for launches. Set + ::CUlaunchAttributeValue::launchCompletionEvent to record the + event. +
+ Nominally, the event is triggered once all blocks of the kernel + have begun execution. Currently this is a best effort. If a kernel + B has a launch completion dependency on a kernel A, B may wait + until A is complete. Alternatively, blocks of B may begin before + all blocks of A have begun, for example if B can claim execution + resources unavailable to A (e.g. they run on different GPUs) or + if B is a higher priority than A. + Exercise caution if such an ordering inversion could lead + to deadlock. +
+ A launch completion event is nominally similar to a programmatic + event with \c triggerAtBlockStart set except that it is not + visible to \c cudaGridDependencySynchronize() and can be used with + compute capability less than 9.0. +
+ The event supplied must not be an interprocess or interop + event. The event must disable timing (i.e. must be created + with the ::CU_EVENT_DISABLE_TIMING flag set). */ + , CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = 13 /**< Valid for graph nodes, launches. This attribute is graphs-only, + and passing it to a launch in a non-capturing stream will result + in an error. +
+ ::CUlaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable can + only be set to 0 or 1. Setting the field to 1 indicates that the + corresponding kernel node should be device-updatable. On success, a handle + will be returned via + ::CUlaunchAttributeValue::deviceUpdatableKernelNode::devNode which can be + passed to the various device-side update functions to update the node's + kernel parameters from within another kernel. For more information on the + types of device updates that can be made, as well as the relevant limitations + thereof, see ::cudaGraphKernelNodeUpdatesApply. +
+ Nodes which are device-updatable have additional restrictions compared to + regular kernel nodes. Firstly, device-updatable nodes cannot be removed + from their graph via ::cuGraphDestroyNode. Additionally, once opted-in + to this functionality, a node cannot opt out, and any attempt to set the + deviceUpdatable attribute to 0 will result in an error. Device-updatable + kernel nodes also cannot have their attributes copied to/from another kernel + node via ::cuGraphKernelNodeCopyAttributes. Graphs containing one or more + device-updatable nodes also do not allow multiple instantiation, and neither + the graph nor its instantiated version can be passed to ::cuGraphExecUpdate. +
+ If a graph contains device-updatable nodes and updates those nodes from the device + from within the graph, the graph must be uploaded with ::cuGraphUpload before it + is launched. For such a graph, if host-side executable graph updates are made to the + device-updatable nodes, the graph must be uploaded before it is launched again. */ +#ifdef __CUDA_API_VERSION_INTERNAL + , CU_LAUNCH_ATTRIBUTE_MAX +#endif +} CUlaunchAttributeID; + +/** + * Launch attributes union; used as value field of ::CUlaunchAttribute + */ +typedef union CUlaunchAttributeValue_union { + char pad[64]; /* Pad to 64 bytes */ + CUaccessPolicyWindow accessPolicyWindow; /**< Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW. */ + int cooperative; /**< Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_COOPERATIVE. Nonzero indicates a cooperative + kernel (see ::cuLaunchCooperativeKernel). */ + CUsynchronizationPolicy syncPolicy; /**< Value of launch attribute + ::CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY. ::CUsynchronizationPolicy for + work queued up in this stream */ + + /** + * Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION that + * represents the desired cluster dimensions for the kernel. Opaque type + * with the following fields: + * - \p x - The X dimension of the cluster, in blocks. Must be a divisor + * of the grid X dimension. + * - \p y - The Y dimension of the cluster, in blocks. Must be a divisor + * of the grid Y dimension. + * - \p z - The Z dimension of the cluster, in blocks. Must be a divisor + * of the grid Z dimension. + */ + struct { + unsigned int x; + unsigned int y; + unsigned int z; + } clusterDim; + CUclusterSchedulingPolicy clusterSchedulingPolicyPreference; /**< Value of launch attribute + ::CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE. Cluster + scheduling policy preference for the kernel. */ + int programmaticStreamSerializationAllowed; /**< Value of launch attribute + ::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION. */ + struct { + CUevent event; /**< Event to fire when all blocks trigger it */ + int flags; /**< Event record flags, see ::cuEventRecordWithFlags. Does not accept + ::CU_EVENT_RECORD_EXTERNAL. */ + int triggerAtBlockStart; /**< If this is set to non-0, each block launch will automatically trigger the event */ + } programmaticEvent; /**< Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT. */ + struct { + CUevent event; /**< Event to fire when the last block launches */ + int flags; /**< Event record flags, see ::cuEventRecordWithFlags. Does not accept ::CU_EVENT_RECORD_EXTERNAL. */ + } launchCompletionEvent; /**< Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT. */ + int priority; /**< Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_PRIORITY. Execution priority of the kernel. */ + CUlaunchMemSyncDomainMap memSyncDomainMap; /**< Value of launch attribute + ::CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP. See + ::CUlaunchMemSyncDomainMap. */ + CUlaunchMemSyncDomain memSyncDomain; /**< Value of launch attribute + ::CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN. See::CUlaunchMemSyncDomain */ + + struct { + int deviceUpdatable; /**< Whether or not the resulting kernel node should be device-updatable. */ + CUgraphDeviceNode devNode; /**< Returns a handle to pass to the various device-side update functions. */ + } deviceUpdatableKernelNode; /**< Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. */ +} CUlaunchAttributeValue; + +/** + * Launch attribute + */ +typedef struct CUlaunchAttribute_st { + CUlaunchAttributeID id; /**< Attribute to set */ + char pad[8 - sizeof(CUlaunchAttributeID)]; + CUlaunchAttributeValue value; /**< Value of the attribute */ +} CUlaunchAttribute; + +/** + * CUDA extensible launch configuration + */ +typedef struct CUlaunchConfig_st { + unsigned int gridDimX; /**< Width of grid in blocks */ + unsigned int gridDimY; /**< Height of grid in blocks */ + unsigned int gridDimZ; /**< Depth of grid in blocks */ + unsigned int blockDimX; /**< X dimension of each thread block */ + unsigned int blockDimY; /**< Y dimension of each thread block */ + unsigned int blockDimZ; /**< Z dimension of each thread block */ + unsigned int sharedMemBytes; /**< Dynamic shared-memory size per thread block in bytes */ + CUstream hStream; /**< Stream identifier */ + CUlaunchAttribute *attrs; /**< List of attributes; nullable if ::CUlaunchConfig::numAttrs == 0 */ + unsigned int numAttrs; /**< Number of attributes populated in ::CUlaunchConfig::attrs */ +} CUlaunchConfig; + +typedef CUlaunchAttributeID CUkernelNodeAttrID; +#define CU_KERNEL_NODE_ATTRIBUTE_ACCESS_POLICY_WINDOW CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW +#define CU_KERNEL_NODE_ATTRIBUTE_COOPERATIVE CU_LAUNCH_ATTRIBUTE_COOPERATIVE +#define CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_DIMENSION CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION +#define CU_KERNEL_NODE_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE +#define CU_KERNEL_NODE_ATTRIBUTE_PRIORITY CU_LAUNCH_ATTRIBUTE_PRIORITY +#define CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP +#define CU_KERNEL_NODE_ATTRIBUTE_MEM_SYNC_DOMAIN CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN +#define CU_KERNEL_NODE_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE + +typedef CUlaunchAttributeValue CUkernelNodeAttrValue_v1; +typedef CUkernelNodeAttrValue_v1 CUkernelNodeAttrValue; + +/** + * Possible stream capture statuses returned by ::cuStreamIsCapturing + */ +typedef enum CUstreamCaptureStatus_enum { + CU_STREAM_CAPTURE_STATUS_NONE = 0, /**< Stream is not capturing */ + CU_STREAM_CAPTURE_STATUS_ACTIVE = 1, /**< Stream is actively capturing */ + CU_STREAM_CAPTURE_STATUS_INVALIDATED = 2 /**< Stream is part of a capture sequence that + has been invalidated, but not terminated */ +} CUstreamCaptureStatus; + +/** + * Possible modes for stream capture thread interactions. For more details see + * ::cuStreamBeginCapture and ::cuThreadExchangeStreamCaptureMode + */ +typedef enum CUstreamCaptureMode_enum { + CU_STREAM_CAPTURE_MODE_GLOBAL = 0, + CU_STREAM_CAPTURE_MODE_THREAD_LOCAL = 1, + CU_STREAM_CAPTURE_MODE_RELAXED = 2 +} CUstreamCaptureMode; + +typedef CUlaunchAttributeID CUstreamAttrID; +#define CU_STREAM_ATTRIBUTE_ACCESS_POLICY_WINDOW CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW +#define CU_STREAM_ATTRIBUTE_SYNCHRONIZATION_POLICY CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY +#define CU_STREAM_ATTRIBUTE_PRIORITY CU_LAUNCH_ATTRIBUTE_PRIORITY +#define CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP +#define CU_STREAM_ATTRIBUTE_MEM_SYNC_DOMAIN CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN + +typedef CUlaunchAttributeValue CUstreamAttrValue_v1; +typedef CUstreamAttrValue_v1 CUstreamAttrValue; + +/** + * Flags to specify search options. For more details see ::cuGetProcAddress + */ +typedef enum CUdriverProcAddress_flags_enum { + CU_GET_PROC_ADDRESS_DEFAULT = 0, /**< Default search mode for driver symbols. */ + CU_GET_PROC_ADDRESS_LEGACY_STREAM = 1 << 0, /**< Search for legacy versions of driver symbols. */ + CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM = 1 << 1 /**< Search for per-thread versions of driver symbols. */ +} CUdriverProcAddress_flags; + +/** + * Flags to indicate search status. For more details see ::cuGetProcAddress + */ +typedef enum CUdriverProcAddressQueryResult_enum { + CU_GET_PROC_ADDRESS_SUCCESS = 0, /**< Symbol was succesfully found */ + CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND = 1, /**< Symbol was not found in search */ + CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT = 2 /**< Symbol was found but version supplied was not sufficient */ +} CUdriverProcAddressQueryResult; + +/** + * Execution Affinity Types + */ +typedef enum CUexecAffinityType_enum { + CU_EXEC_AFFINITY_TYPE_SM_COUNT = 0, /**< Create a context with limited SMs. */ + CU_EXEC_AFFINITY_TYPE_MAX +} CUexecAffinityType; + +/** + * Value for ::CU_EXEC_AFFINITY_TYPE_SM_COUNT + */ +typedef struct CUexecAffinitySmCount_st { + unsigned int val; /**< The number of SMs the context is limited to use. */ +} CUexecAffinitySmCount_v1; +typedef CUexecAffinitySmCount_v1 CUexecAffinitySmCount; + +/** + * Execution Affinity Parameters + */ +typedef struct CUexecAffinityParam_st { + CUexecAffinityType type; + union { + CUexecAffinitySmCount smCount; /** Value for ::CU_EXEC_AFFINITY_TYPE_SM_COUNT */ + } param; +} CUexecAffinityParam_v1; +/** + * Execution Affinity Parameters + */ +typedef CUexecAffinityParam_v1 CUexecAffinityParam; + +/** + * Library options to be specified with ::cuLibraryLoadData() or ::cuLibraryLoadFromFile() + */ +typedef enum CUlibraryOption_enum +{ + CU_LIBRARY_HOST_UNIVERSAL_FUNCTION_AND_DATA_TABLE = 0, + + /** + * Specifes that the argument \p code passed to ::cuLibraryLoadData() will be preserved. + * Specifying this option will let the driver know that \p code can be accessed at any point + * until ::cuLibraryUnload(). The default behavior is for the driver to allocate and + * maintain its own copy of \p code. Note that this is only a memory usage optimization + * hint and the driver can choose to ignore it if required. + * Specifying this option with ::cuLibraryLoadFromFile() is invalid and + * will return ::CUDA_ERROR_INVALID_VALUE. + */ + CU_LIBRARY_BINARY_IS_PRESERVED = 1, + + CU_LIBRARY_NUM_OPTIONS +} CUlibraryOption; + +typedef struct CUlibraryHostUniversalFunctionAndDataTable_st +{ + void *functionTable; + size_t functionWindowSize; + void *dataTable; + size_t dataWindowSize; +} CUlibraryHostUniversalFunctionAndDataTable; + +/** + * Error codes + */ +typedef enum cudaError_enum { + /** + * The API call returned with no errors. In the case of query calls, this + * also means that the operation being queried is complete (see + * ::cuEventQuery() and ::cuStreamQuery()). + */ + CUDA_SUCCESS = 0, + + /** + * This indicates that one or more of the parameters passed to the API call + * is not within an acceptable range of values. + */ + CUDA_ERROR_INVALID_VALUE = 1, + + /** + * The API call failed because it was unable to allocate enough memory or + * other resources to perform the requested operation. + */ + CUDA_ERROR_OUT_OF_MEMORY = 2, + + /** + * This indicates that the CUDA driver has not been initialized with + * ::cuInit() or that initialization has failed. + */ + CUDA_ERROR_NOT_INITIALIZED = 3, + + /** + * This indicates that the CUDA driver is in the process of shutting down. + */ + CUDA_ERROR_DEINITIALIZED = 4, + + /** + * This indicates profiler is not initialized for this run. This can + * happen when the application is running with external profiling tools + * like visual profiler. + */ + CUDA_ERROR_PROFILER_DISABLED = 5, + + /** + * \deprecated + * This error return is deprecated as of CUDA 5.0. It is no longer an error + * to attempt to enable/disable the profiling via ::cuProfilerStart or + * ::cuProfilerStop without initialization. + */ + CUDA_ERROR_PROFILER_NOT_INITIALIZED = 6, + + /** + * \deprecated + * This error return is deprecated as of CUDA 5.0. It is no longer an error + * to call cuProfilerStart() when profiling is already enabled. + */ + CUDA_ERROR_PROFILER_ALREADY_STARTED = 7, + + /** + * \deprecated + * This error return is deprecated as of CUDA 5.0. It is no longer an error + * to call cuProfilerStop() when profiling is already disabled. + */ + CUDA_ERROR_PROFILER_ALREADY_STOPPED = 8, + + /** + * This indicates that the CUDA driver that the application has loaded is a + * stub library. Applications that run with the stub rather than a real + * driver loaded will result in CUDA API returning this error. + */ + CUDA_ERROR_STUB_LIBRARY = 34, + + /** + * This indicates that requested CUDA device is unavailable at the current + * time. Devices are often unavailable due to use of + * ::CU_COMPUTEMODE_EXCLUSIVE_PROCESS or ::CU_COMPUTEMODE_PROHIBITED. + */ + CUDA_ERROR_DEVICE_UNAVAILABLE = 46, + + /** + * This indicates that no CUDA-capable devices were detected by the installed + * CUDA driver. + */ + CUDA_ERROR_NO_DEVICE = 100, + + /** + * This indicates that the device ordinal supplied by the user does not + * correspond to a valid CUDA device or that the action requested is + * invalid for the specified device. + */ + CUDA_ERROR_INVALID_DEVICE = 101, + + /** + * This error indicates that the Grid license is not applied. + */ + CUDA_ERROR_DEVICE_NOT_LICENSED = 102, + + /** + * This indicates that the device kernel image is invalid. This can also + * indicate an invalid CUDA module. + */ + CUDA_ERROR_INVALID_IMAGE = 200, + + /** + * This most frequently indicates that there is no context bound to the + * current thread. This can also be returned if the context passed to an + * API call is not a valid handle (such as a context that has had + * ::cuCtxDestroy() invoked on it). This can also be returned if a user + * mixes different API versions (i.e. 3010 context with 3020 API calls). + * See ::cuCtxGetApiVersion() for more details. + * This can also be returned if the green context passed to an API call + * was not converted to a ::CUcontext using ::cuCtxFromGreenCtx API. + */ + CUDA_ERROR_INVALID_CONTEXT = 201, + + /** + * This indicated that the context being supplied as a parameter to the + * API call was already the active context. + * \deprecated + * This error return is deprecated as of CUDA 3.2. It is no longer an + * error to attempt to push the active context via ::cuCtxPushCurrent(). + */ + CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202, + + /** + * This indicates that a map or register operation has failed. + */ + CUDA_ERROR_MAP_FAILED = 205, + + /** + * This indicates that an unmap or unregister operation has failed. + */ + CUDA_ERROR_UNMAP_FAILED = 206, + + /** + * This indicates that the specified array is currently mapped and thus + * cannot be destroyed. + */ + CUDA_ERROR_ARRAY_IS_MAPPED = 207, + + /** + * This indicates that the resource is already mapped. + */ + CUDA_ERROR_ALREADY_MAPPED = 208, + + /** + * This indicates that there is no kernel image available that is suitable + * for the device. This can occur when a user specifies code generation + * options for a particular CUDA source file that do not include the + * corresponding device configuration. + */ + CUDA_ERROR_NO_BINARY_FOR_GPU = 209, + + /** + * This indicates that a resource has already been acquired. + */ + CUDA_ERROR_ALREADY_ACQUIRED = 210, + + /** + * This indicates that a resource is not mapped. + */ + CUDA_ERROR_NOT_MAPPED = 211, + + /** + * This indicates that a mapped resource is not available for access as an + * array. + */ + CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212, + + /** + * This indicates that a mapped resource is not available for access as a + * pointer. + */ + CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213, + + /** + * This indicates that an uncorrectable ECC error was detected during + * execution. + */ + CUDA_ERROR_ECC_UNCORRECTABLE = 214, + + /** + * This indicates that the ::CUlimit passed to the API call is not + * supported by the active device. + */ + CUDA_ERROR_UNSUPPORTED_LIMIT = 215, + + /** + * This indicates that the ::CUcontext passed to the API call can + * only be bound to a single CPU thread at a time but is already + * bound to a CPU thread. + */ + CUDA_ERROR_CONTEXT_ALREADY_IN_USE = 216, + + /** + * This indicates that peer access is not supported across the given + * devices. + */ + CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = 217, + + /** + * This indicates that a PTX JIT compilation failed. + */ + CUDA_ERROR_INVALID_PTX = 218, + + /** + * This indicates an error with OpenGL or DirectX context. + */ + CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219, + + /** + * This indicates that an uncorrectable NVLink error was detected during the + * execution. + */ + CUDA_ERROR_NVLINK_UNCORRECTABLE = 220, + + /** + * This indicates that the PTX JIT compiler library was not found. + */ + CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221, + + /** + * This indicates that the provided PTX was compiled with an unsupported toolchain. + */ + + CUDA_ERROR_UNSUPPORTED_PTX_VERSION = 222, + + /** + * This indicates that the PTX JIT compilation was disabled. + */ + CUDA_ERROR_JIT_COMPILATION_DISABLED = 223, + + /** + * This indicates that the ::CUexecAffinityType passed to the API call is not + * supported by the active device. + */ + CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY = 224, + + /** + * This indicates that the code to be compiled by the PTX JIT contains + * unsupported call to cudaDeviceSynchronize. + */ + CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC = 225, + + /** + * This indicates that the device kernel source is invalid. This includes + * compilation/linker errors encountered in device code or user error. + */ + CUDA_ERROR_INVALID_SOURCE = 300, + + /** + * This indicates that the file specified was not found. + */ + CUDA_ERROR_FILE_NOT_FOUND = 301, + + /** + * This indicates that a link to a shared object failed to resolve. + */ + CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302, + + /** + * This indicates that initialization of a shared object failed. + */ + CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303, + + /** + * This indicates that an OS call failed. + */ + CUDA_ERROR_OPERATING_SYSTEM = 304, + + /** + * This indicates that a resource handle passed to the API call was not + * valid. Resource handles are opaque types like ::CUstream and ::CUevent. + */ + CUDA_ERROR_INVALID_HANDLE = 400, + + /** + * This indicates that a resource required by the API call is not in a + * valid state to perform the requested operation. + */ + CUDA_ERROR_ILLEGAL_STATE = 401, + + /** + * This indicates an attempt was made to introspect an object in a way that + * would discard semantically important information. This is either due to + * the object using funtionality newer than the API version used to + * introspect it or omission of optional return arguments. + */ + CUDA_ERROR_LOSSY_QUERY = 402, + + /** + * This indicates that a named symbol was not found. Examples of symbols + * are global/constant variable names, driver function names, texture names, + * and surface names. + */ + CUDA_ERROR_NOT_FOUND = 500, + + /** + * This indicates that asynchronous operations issued previously have not + * completed yet. This result is not actually an error, but must be indicated + * differently than ::CUDA_SUCCESS (which indicates completion). Calls that + * may return this value include ::cuEventQuery() and ::cuStreamQuery(). + */ + CUDA_ERROR_NOT_READY = 600, + + /** + * While executing a kernel, the device encountered a + * load or store instruction on an invalid memory address. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + CUDA_ERROR_ILLEGAL_ADDRESS = 700, + + /** + * This indicates that a launch did not occur because it did not have + * appropriate resources. This error usually indicates that the user has + * attempted to pass too many arguments to the device kernel, or the + * kernel launch specifies too many threads for the kernel's register + * count. Passing arguments of the wrong size (i.e. a 64-bit pointer + * when a 32-bit int is expected) is equivalent to passing too many + * arguments and can also result in this error. + */ + CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701, + + /** + * This indicates that the device kernel took too long to execute. This can + * only occur if timeouts are enabled - see the device attribute + * ::CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT for more information. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + CUDA_ERROR_LAUNCH_TIMEOUT = 702, + + /** + * This error indicates a kernel launch that uses an incompatible texturing + * mode. + */ + CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703, + + /** + * This error indicates that a call to ::cuCtxEnablePeerAccess() is + * trying to re-enable peer access to a context which has already + * had peer access to it enabled. + */ + CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = 704, + + /** + * This error indicates that ::cuCtxDisablePeerAccess() is + * trying to disable peer access which has not been enabled yet + * via ::cuCtxEnablePeerAccess(). + */ + CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = 705, + + /** + * This error indicates that the primary context for the specified device + * has already been initialized. + */ + CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = 708, + + /** + * This error indicates that the context current to the calling thread + * has been destroyed using ::cuCtxDestroy, or is a primary context which + * has not yet been initialized. + */ + CUDA_ERROR_CONTEXT_IS_DESTROYED = 709, + + /** + * A device-side assert triggered during kernel execution. The context + * cannot be used anymore, and must be destroyed. All existing device + * memory allocations from this context are invalid and must be + * reconstructed if the program is to continue using CUDA. + */ + CUDA_ERROR_ASSERT = 710, + + /** + * This error indicates that the hardware resources required to enable + * peer access have been exhausted for one or more of the devices + * passed to ::cuCtxEnablePeerAccess(). + */ + CUDA_ERROR_TOO_MANY_PEERS = 711, + + /** + * This error indicates that the memory range passed to ::cuMemHostRegister() + * has already been registered. + */ + CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712, + + /** + * This error indicates that the pointer passed to ::cuMemHostUnregister() + * does not correspond to any currently registered memory region. + */ + CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = 713, + + /** + * While executing a kernel, the device encountered a stack error. + * This can be due to stack corruption or exceeding the stack size limit. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + CUDA_ERROR_HARDWARE_STACK_ERROR = 714, + + /** + * While executing a kernel, the device encountered an illegal instruction. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + CUDA_ERROR_ILLEGAL_INSTRUCTION = 715, + + /** + * While executing a kernel, the device encountered a load or store instruction + * on a memory address which is not aligned. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + CUDA_ERROR_MISALIGNED_ADDRESS = 716, + + /** + * While executing a kernel, the device encountered an instruction + * which can only operate on memory locations in certain address spaces + * (global, shared, or local), but was supplied a memory address not + * belonging to an allowed address space. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + CUDA_ERROR_INVALID_ADDRESS_SPACE = 717, + + /** + * While executing a kernel, the device program counter wrapped its address space. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + CUDA_ERROR_INVALID_PC = 718, + + /** + * An exception occurred on the device while executing a kernel. Common + * causes include dereferencing an invalid device pointer and accessing + * out of bounds shared memory. Less common cases can be system specific - more + * information about these cases can be found in the system specific user guide. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + CUDA_ERROR_LAUNCH_FAILED = 719, + + /** + * This error indicates that the number of blocks launched per grid for a kernel that was + * launched via either ::cuLaunchCooperativeKernel or ::cuLaunchCooperativeKernelMultiDevice + * exceeds the maximum number of blocks as allowed by ::cuOccupancyMaxActiveBlocksPerMultiprocessor + * or ::cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags times the number of multiprocessors + * as specified by the device attribute ::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT. + */ + CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE = 720, + + /** + * This error indicates that the attempted operation is not permitted. + */ + CUDA_ERROR_NOT_PERMITTED = 800, + + /** + * This error indicates that the attempted operation is not supported + * on the current system or device. + */ + CUDA_ERROR_NOT_SUPPORTED = 801, + + /** + * This error indicates that the system is not yet ready to start any CUDA + * work. To continue using CUDA, verify the system configuration is in a + * valid state and all required driver daemons are actively running. + * More information about this error can be found in the system specific + * user guide. + */ + CUDA_ERROR_SYSTEM_NOT_READY = 802, + + /** + * This error indicates that there is a mismatch between the versions of + * the display driver and the CUDA driver. Refer to the compatibility documentation + * for supported versions. + */ + CUDA_ERROR_SYSTEM_DRIVER_MISMATCH = 803, + + /** + * This error indicates that the system was upgraded to run with forward compatibility + * but the visible hardware detected by CUDA does not support this configuration. + * Refer to the compatibility documentation for the supported hardware matrix or ensure + * that only supported hardware is visible during initialization via the CUDA_VISIBLE_DEVICES + * environment variable. + */ + CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE = 804, + + /** + * This error indicates that the MPS client failed to connect to the MPS control daemon or the MPS server. + */ + CUDA_ERROR_MPS_CONNECTION_FAILED = 805, + + /** + * This error indicates that the remote procedural call between the MPS server and the MPS client failed. + */ + CUDA_ERROR_MPS_RPC_FAILURE = 806, + + /** + * This error indicates that the MPS server is not ready to accept new MPS client requests. + * This error can be returned when the MPS server is in the process of recovering from a fatal failure. + */ + CUDA_ERROR_MPS_SERVER_NOT_READY = 807, + + /** + * This error indicates that the hardware resources required to create MPS client have been exhausted. + */ + CUDA_ERROR_MPS_MAX_CLIENTS_REACHED = 808, + + /** + * This error indicates the the hardware resources required to support device connections have been exhausted. + */ + CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED = 809, + + /** + * This error indicates that the MPS client has been terminated by the server. To continue using CUDA, the process must be terminated and relaunched. + */ + CUDA_ERROR_MPS_CLIENT_TERMINATED = 810, + + /** + * This error indicates that the module is using CUDA Dynamic Parallelism, but the current configuration, like MPS, does not support it. + */ + CUDA_ERROR_CDP_NOT_SUPPORTED = 811, + + /** + * This error indicates that a module contains an unsupported interaction between different versions of CUDA Dynamic Parallelism. + */ + CUDA_ERROR_CDP_VERSION_MISMATCH = 812, + + /** + * This error indicates that the operation is not permitted when + * the stream is capturing. + */ + CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED = 900, + + /** + * This error indicates that the current capture sequence on the stream + * has been invalidated due to a previous error. + */ + CUDA_ERROR_STREAM_CAPTURE_INVALIDATED = 901, + + /** + * This error indicates that the operation would have resulted in a merge + * of two independent capture sequences. + */ + CUDA_ERROR_STREAM_CAPTURE_MERGE = 902, + + /** + * This error indicates that the capture was not initiated in this stream. + */ + CUDA_ERROR_STREAM_CAPTURE_UNMATCHED = 903, + + /** + * This error indicates that the capture sequence contains a fork that was + * not joined to the primary stream. + */ + CUDA_ERROR_STREAM_CAPTURE_UNJOINED = 904, + + /** + * This error indicates that a dependency would have been created which + * crosses the capture sequence boundary. Only implicit in-stream ordering + * dependencies are allowed to cross the boundary. + */ + CUDA_ERROR_STREAM_CAPTURE_ISOLATION = 905, + + /** + * This error indicates a disallowed implicit dependency on a current capture + * sequence from cudaStreamLegacy. + */ + CUDA_ERROR_STREAM_CAPTURE_IMPLICIT = 906, + + /** + * This error indicates that the operation is not permitted on an event which + * was last recorded in a capturing stream. + */ + CUDA_ERROR_CAPTURED_EVENT = 907, + + /** + * A stream capture sequence not initiated with the ::CU_STREAM_CAPTURE_MODE_RELAXED + * argument to ::cuStreamBeginCapture was passed to ::cuStreamEndCapture in a + * different thread. + */ + CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD = 908, + + /** + * This error indicates that the timeout specified for the wait operation has lapsed. + */ + CUDA_ERROR_TIMEOUT = 909, + + /** + * This error indicates that the graph update was not performed because it included + * changes which violated constraints specific to instantiated graph update. + */ + CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE = 910, + + /** + * This indicates that an async error has occurred in a device outside of CUDA. + * If CUDA was waiting for an external device's signal before consuming shared data, + * the external device signaled an error indicating that the data is not valid for + * consumption. This leaves the process in an inconsistent state and any further CUDA + * work will return the same error. To continue using CUDA, the process must be + * terminated and relaunched. + */ + CUDA_ERROR_EXTERNAL_DEVICE = 911, + + /** + * Indicates a kernel launch error due to cluster misconfiguration. + */ + CUDA_ERROR_INVALID_CLUSTER_SIZE = 912, + + /** + * Indiciates a function handle is not loaded when calling an API that requires + * a loaded function. + */ + CUDA_ERROR_FUNCTION_NOT_LOADED = 913, + + /** + * This error indicates one or more resources passed in are not valid resource + * types for the operation. + */ + CUDA_ERROR_INVALID_RESOURCE_TYPE = 914, + + /** + * This error indicates one or more resources are insufficient or non-applicable for + * the operation. + */ + CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION = 915, + + /** + * This indicates that an unknown internal error has occurred. + */ + CUDA_ERROR_UNKNOWN = 999 +} CUresult; + +/** + * P2P Attributes + */ +typedef enum CUdevice_P2PAttribute_enum { + CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = 0x01, /**< A relative value indicating the performance of the link between two devices */ + CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = 0x02, /**< P2P Access is enable */ + CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = 0x03, /**< Atomic operation over the link supported */ + CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED = 0x04, /**< \deprecated use CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED instead */ + CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED = 0x04 /**< Accessing CUDA arrays over the link supported */ +} CUdevice_P2PAttribute; + +/** + * CUDA stream callback + * \param hStream The stream the callback was added to, as passed to ::cuStreamAddCallback. May be NULL. + * \param status ::CUDA_SUCCESS or any persistent error on the stream. + * \param userData User parameter provided at registration. + */ +typedef void (CUDA_CB *CUstreamCallback)(CUstream hStream, CUresult status, void *userData); + +/** + * Block size to per-block dynamic shared memory mapping for a certain + * kernel \param blockSize Block size of the kernel. + * + * \return The dynamic shared memory needed by a block. + */ +typedef size_t (CUDA_CB *CUoccupancyB2DSize)(int blockSize); + +/** + * If set, host memory is portable between CUDA contexts. + * Flag for ::cuMemHostAlloc() + */ +#define CU_MEMHOSTALLOC_PORTABLE 0x01 + +/** + * If set, host memory is mapped into CUDA address space and + * ::cuMemHostGetDevicePointer() may be called on the host pointer. + * Flag for ::cuMemHostAlloc() + */ +#define CU_MEMHOSTALLOC_DEVICEMAP 0x02 + +/** + * If set, host memory is allocated as write-combined - fast to write, + * faster to DMA, slow to read except via SSE4 streaming load instruction + * (MOVNTDQA). + * Flag for ::cuMemHostAlloc() + */ +#define CU_MEMHOSTALLOC_WRITECOMBINED 0x04 + +/** + * If set, host memory is portable between CUDA contexts. + * Flag for ::cuMemHostRegister() + */ +#define CU_MEMHOSTREGISTER_PORTABLE 0x01 + +/** + * If set, host memory is mapped into CUDA address space and + * ::cuMemHostGetDevicePointer() may be called on the host pointer. + * Flag for ::cuMemHostRegister() + */ +#define CU_MEMHOSTREGISTER_DEVICEMAP 0x02 + +/** + * If set, the passed memory pointer is treated as pointing to some + * memory-mapped I/O space, e.g. belonging to a third-party PCIe device. + * On Windows the flag is a no-op. + * On Linux that memory is marked as non cache-coherent for the GPU and + * is expected to be physically contiguous. It may return + * ::CUDA_ERROR_NOT_PERMITTED if run as an unprivileged user, + * ::CUDA_ERROR_NOT_SUPPORTED on older Linux kernel versions. + * On all other platforms, it is not supported and ::CUDA_ERROR_NOT_SUPPORTED + * is returned. + * Flag for ::cuMemHostRegister() + */ +#define CU_MEMHOSTREGISTER_IOMEMORY 0x04 + +/** +* If set, the passed memory pointer is treated as pointing to memory that is +* considered read-only by the device. On platforms without +* ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, this flag is +* required in order to register memory mapped to the CPU as read-only. Support +* for the use of this flag can be queried from the device attribute +* ::CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED. Using this flag with +* a current context associated with a device that does not have this attribute +* set will cause ::cuMemHostRegister to error with ::CUDA_ERROR_NOT_SUPPORTED. +*/ +#define CU_MEMHOSTREGISTER_READ_ONLY 0x08 + +/** + * 2D memory copy parameters + */ +typedef struct CUDA_MEMCPY2D_st { + size_t srcXInBytes; /**< Source X in bytes */ + size_t srcY; /**< Source Y */ + + CUmemorytype srcMemoryType; /**< Source memory type (host, device, array) */ + const void *srcHost; /**< Source host pointer */ + CUdeviceptr srcDevice; /**< Source device pointer */ + CUarray srcArray; /**< Source array reference */ + size_t srcPitch; /**< Source pitch (ignored when src is array) */ + + size_t dstXInBytes; /**< Destination X in bytes */ + size_t dstY; /**< Destination Y */ + + CUmemorytype dstMemoryType; /**< Destination memory type (host, device, array) */ + void *dstHost; /**< Destination host pointer */ + CUdeviceptr dstDevice; /**< Destination device pointer */ + CUarray dstArray; /**< Destination array reference */ + size_t dstPitch; /**< Destination pitch (ignored when dst is array) */ + + size_t WidthInBytes; /**< Width of 2D memory copy in bytes */ + size_t Height; /**< Height of 2D memory copy */ +} CUDA_MEMCPY2D_v2; +typedef CUDA_MEMCPY2D_v2 CUDA_MEMCPY2D; + +/** + * 3D memory copy parameters + */ +typedef struct CUDA_MEMCPY3D_st { + size_t srcXInBytes; /**< Source X in bytes */ + size_t srcY; /**< Source Y */ + size_t srcZ; /**< Source Z */ + size_t srcLOD; /**< Source LOD */ + CUmemorytype srcMemoryType; /**< Source memory type (host, device, array) */ + const void *srcHost; /**< Source host pointer */ + CUdeviceptr srcDevice; /**< Source device pointer */ + CUarray srcArray; /**< Source array reference */ + void *reserved0; /**< Must be NULL */ + size_t srcPitch; /**< Source pitch (ignored when src is array) */ + size_t srcHeight; /**< Source height (ignored when src is array; may be 0 if Depth==1) */ + + size_t dstXInBytes; /**< Destination X in bytes */ + size_t dstY; /**< Destination Y */ + size_t dstZ; /**< Destination Z */ + size_t dstLOD; /**< Destination LOD */ + CUmemorytype dstMemoryType; /**< Destination memory type (host, device, array) */ + void *dstHost; /**< Destination host pointer */ + CUdeviceptr dstDevice; /**< Destination device pointer */ + CUarray dstArray; /**< Destination array reference */ + void *reserved1; /**< Must be NULL */ + size_t dstPitch; /**< Destination pitch (ignored when dst is array) */ + size_t dstHeight; /**< Destination height (ignored when dst is array; may be 0 if Depth==1) */ + + size_t WidthInBytes; /**< Width of 3D memory copy in bytes */ + size_t Height; /**< Height of 3D memory copy */ + size_t Depth; /**< Depth of 3D memory copy */ +} CUDA_MEMCPY3D_v2; +typedef CUDA_MEMCPY3D_v2 CUDA_MEMCPY3D; + +/** + * 3D memory cross-context copy parameters + */ +typedef struct CUDA_MEMCPY3D_PEER_st { + size_t srcXInBytes; /**< Source X in bytes */ + size_t srcY; /**< Source Y */ + size_t srcZ; /**< Source Z */ + size_t srcLOD; /**< Source LOD */ + CUmemorytype srcMemoryType; /**< Source memory type (host, device, array) */ + const void *srcHost; /**< Source host pointer */ + CUdeviceptr srcDevice; /**< Source device pointer */ + CUarray srcArray; /**< Source array reference */ + CUcontext srcContext; /**< Source context (ignored with srcMemoryType is ::CU_MEMORYTYPE_ARRAY) */ + size_t srcPitch; /**< Source pitch (ignored when src is array) */ + size_t srcHeight; /**< Source height (ignored when src is array; may be 0 if Depth==1) */ + + size_t dstXInBytes; /**< Destination X in bytes */ + size_t dstY; /**< Destination Y */ + size_t dstZ; /**< Destination Z */ + size_t dstLOD; /**< Destination LOD */ + CUmemorytype dstMemoryType; /**< Destination memory type (host, device, array) */ + void *dstHost; /**< Destination host pointer */ + CUdeviceptr dstDevice; /**< Destination device pointer */ + CUarray dstArray; /**< Destination array reference */ + CUcontext dstContext; /**< Destination context (ignored with dstMemoryType is ::CU_MEMORYTYPE_ARRAY) */ + size_t dstPitch; /**< Destination pitch (ignored when dst is array) */ + size_t dstHeight; /**< Destination height (ignored when dst is array; may be 0 if Depth==1) */ + + size_t WidthInBytes; /**< Width of 3D memory copy in bytes */ + size_t Height; /**< Height of 3D memory copy */ + size_t Depth; /**< Depth of 3D memory copy */ +} CUDA_MEMCPY3D_PEER_v1; +typedef CUDA_MEMCPY3D_PEER_v1 CUDA_MEMCPY3D_PEER; + +/** + * Memcpy node parameters + */ +typedef struct CUDA_MEMCPY_NODE_PARAMS_st { + int flags; /**< Must be zero */ + int reserved; /**< Must be zero */ + CUcontext copyCtx; /**< Context on which to run the node */ + CUDA_MEMCPY3D copyParams; /**< Parameters for the memory copy */ +} CUDA_MEMCPY_NODE_PARAMS; + +/** + * Array descriptor + */ +typedef struct CUDA_ARRAY_DESCRIPTOR_st +{ + size_t Width; /**< Width of array */ + size_t Height; /**< Height of array */ + + CUarray_format Format; /**< Array format */ + unsigned int NumChannels; /**< Channels per array element */ +} CUDA_ARRAY_DESCRIPTOR_v2; +typedef CUDA_ARRAY_DESCRIPTOR_v2 CUDA_ARRAY_DESCRIPTOR; + +/** + * 3D array descriptor + */ +typedef struct CUDA_ARRAY3D_DESCRIPTOR_st +{ + size_t Width; /**< Width of 3D array */ + size_t Height; /**< Height of 3D array */ + size_t Depth; /**< Depth of 3D array */ + + CUarray_format Format; /**< Array format */ + unsigned int NumChannels; /**< Channels per array element */ + unsigned int Flags; /**< Flags */ +} CUDA_ARRAY3D_DESCRIPTOR_v2; +typedef CUDA_ARRAY3D_DESCRIPTOR_v2 CUDA_ARRAY3D_DESCRIPTOR; + +/** + * Indicates that the layered sparse CUDA array or CUDA mipmapped array has a single mip tail region for all layers + */ +#define CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL 0x1 + +/** + * CUDA array sparse properties + */ +typedef struct CUDA_ARRAY_SPARSE_PROPERTIES_st { + struct { + unsigned int width; /**< Width of sparse tile in elements */ + unsigned int height; /**< Height of sparse tile in elements */ + unsigned int depth; /**< Depth of sparse tile in elements */ + } tileExtent; + + /** + * First mip level at which the mip tail begins. + */ + unsigned int miptailFirstLevel; + /** + * Total size of the mip tail. + */ + unsigned long long miptailSize; + /** + * Flags will either be zero or ::CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL + */ + unsigned int flags; + unsigned int reserved[4]; +} CUDA_ARRAY_SPARSE_PROPERTIES_v1; +typedef CUDA_ARRAY_SPARSE_PROPERTIES_v1 CUDA_ARRAY_SPARSE_PROPERTIES; + +/** + * CUDA array memory requirements + */ +typedef struct CUDA_ARRAY_MEMORY_REQUIREMENTS_st { + size_t size; /**< Total required memory size */ + size_t alignment; /**< alignment requirement */ + unsigned int reserved[4]; +} CUDA_ARRAY_MEMORY_REQUIREMENTS_v1; +typedef CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 CUDA_ARRAY_MEMORY_REQUIREMENTS; + +/** + * CUDA Resource descriptor + */ +typedef struct CUDA_RESOURCE_DESC_st +{ + CUresourcetype resType; /**< Resource type */ + + union { + struct { + CUarray hArray; /**< CUDA array */ + } array; + struct { + CUmipmappedArray hMipmappedArray; /**< CUDA mipmapped array */ + } mipmap; + struct { + CUdeviceptr devPtr; /**< Device pointer */ + CUarray_format format; /**< Array format */ + unsigned int numChannels; /**< Channels per array element */ + size_t sizeInBytes; /**< Size in bytes */ + } linear; + struct { + CUdeviceptr devPtr; /**< Device pointer */ + CUarray_format format; /**< Array format */ + unsigned int numChannels; /**< Channels per array element */ + size_t width; /**< Width of the array in elements */ + size_t height; /**< Height of the array in elements */ + size_t pitchInBytes; /**< Pitch between two rows in bytes */ + } pitch2D; + struct { + int reserved[32]; + } reserved; + } res; + + unsigned int flags; /**< Flags (must be zero) */ +} CUDA_RESOURCE_DESC_v1; +typedef CUDA_RESOURCE_DESC_v1 CUDA_RESOURCE_DESC; + +/** + * Texture descriptor + */ +typedef struct CUDA_TEXTURE_DESC_st { + CUaddress_mode addressMode[3]; /**< Address modes */ + CUfilter_mode filterMode; /**< Filter mode */ + unsigned int flags; /**< Flags */ + unsigned int maxAnisotropy; /**< Maximum anisotropy ratio */ + CUfilter_mode mipmapFilterMode; /**< Mipmap filter mode */ + float mipmapLevelBias; /**< Mipmap level bias */ + float minMipmapLevelClamp; /**< Mipmap minimum level clamp */ + float maxMipmapLevelClamp; /**< Mipmap maximum level clamp */ + float borderColor[4]; /**< Border Color */ + int reserved[12]; +} CUDA_TEXTURE_DESC_v1; +typedef CUDA_TEXTURE_DESC_v1 CUDA_TEXTURE_DESC; + +/** + * Resource view format + */ +typedef enum CUresourceViewFormat_enum +{ + CU_RES_VIEW_FORMAT_NONE = 0x00, /**< No resource view format (use underlying resource format) */ + CU_RES_VIEW_FORMAT_UINT_1X8 = 0x01, /**< 1 channel unsigned 8-bit integers */ + CU_RES_VIEW_FORMAT_UINT_2X8 = 0x02, /**< 2 channel unsigned 8-bit integers */ + CU_RES_VIEW_FORMAT_UINT_4X8 = 0x03, /**< 4 channel unsigned 8-bit integers */ + CU_RES_VIEW_FORMAT_SINT_1X8 = 0x04, /**< 1 channel signed 8-bit integers */ + CU_RES_VIEW_FORMAT_SINT_2X8 = 0x05, /**< 2 channel signed 8-bit integers */ + CU_RES_VIEW_FORMAT_SINT_4X8 = 0x06, /**< 4 channel signed 8-bit integers */ + CU_RES_VIEW_FORMAT_UINT_1X16 = 0x07, /**< 1 channel unsigned 16-bit integers */ + CU_RES_VIEW_FORMAT_UINT_2X16 = 0x08, /**< 2 channel unsigned 16-bit integers */ + CU_RES_VIEW_FORMAT_UINT_4X16 = 0x09, /**< 4 channel unsigned 16-bit integers */ + CU_RES_VIEW_FORMAT_SINT_1X16 = 0x0a, /**< 1 channel signed 16-bit integers */ + CU_RES_VIEW_FORMAT_SINT_2X16 = 0x0b, /**< 2 channel signed 16-bit integers */ + CU_RES_VIEW_FORMAT_SINT_4X16 = 0x0c, /**< 4 channel signed 16-bit integers */ + CU_RES_VIEW_FORMAT_UINT_1X32 = 0x0d, /**< 1 channel unsigned 32-bit integers */ + CU_RES_VIEW_FORMAT_UINT_2X32 = 0x0e, /**< 2 channel unsigned 32-bit integers */ + CU_RES_VIEW_FORMAT_UINT_4X32 = 0x0f, /**< 4 channel unsigned 32-bit integers */ + CU_RES_VIEW_FORMAT_SINT_1X32 = 0x10, /**< 1 channel signed 32-bit integers */ + CU_RES_VIEW_FORMAT_SINT_2X32 = 0x11, /**< 2 channel signed 32-bit integers */ + CU_RES_VIEW_FORMAT_SINT_4X32 = 0x12, /**< 4 channel signed 32-bit integers */ + CU_RES_VIEW_FORMAT_FLOAT_1X16 = 0x13, /**< 1 channel 16-bit floating point */ + CU_RES_VIEW_FORMAT_FLOAT_2X16 = 0x14, /**< 2 channel 16-bit floating point */ + CU_RES_VIEW_FORMAT_FLOAT_4X16 = 0x15, /**< 4 channel 16-bit floating point */ + CU_RES_VIEW_FORMAT_FLOAT_1X32 = 0x16, /**< 1 channel 32-bit floating point */ + CU_RES_VIEW_FORMAT_FLOAT_2X32 = 0x17, /**< 2 channel 32-bit floating point */ + CU_RES_VIEW_FORMAT_FLOAT_4X32 = 0x18, /**< 4 channel 32-bit floating point */ + CU_RES_VIEW_FORMAT_UNSIGNED_BC1 = 0x19, /**< Block compressed 1 */ + CU_RES_VIEW_FORMAT_UNSIGNED_BC2 = 0x1a, /**< Block compressed 2 */ + CU_RES_VIEW_FORMAT_UNSIGNED_BC3 = 0x1b, /**< Block compressed 3 */ + CU_RES_VIEW_FORMAT_UNSIGNED_BC4 = 0x1c, /**< Block compressed 4 unsigned */ + CU_RES_VIEW_FORMAT_SIGNED_BC4 = 0x1d, /**< Block compressed 4 signed */ + CU_RES_VIEW_FORMAT_UNSIGNED_BC5 = 0x1e, /**< Block compressed 5 unsigned */ + CU_RES_VIEW_FORMAT_SIGNED_BC5 = 0x1f, /**< Block compressed 5 signed */ + CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = 0x20, /**< Block compressed 6 unsigned half-float */ + CU_RES_VIEW_FORMAT_SIGNED_BC6H = 0x21, /**< Block compressed 6 signed half-float */ + CU_RES_VIEW_FORMAT_UNSIGNED_BC7 = 0x22 /**< Block compressed 7 */ +} CUresourceViewFormat; + +/** + * Resource view descriptor + */ +typedef struct CUDA_RESOURCE_VIEW_DESC_st +{ + CUresourceViewFormat format; /**< Resource view format */ + size_t width; /**< Width of the resource view */ + size_t height; /**< Height of the resource view */ + size_t depth; /**< Depth of the resource view */ + unsigned int firstMipmapLevel; /**< First defined mipmap level */ + unsigned int lastMipmapLevel; /**< Last defined mipmap level */ + unsigned int firstLayer; /**< First layer index */ + unsigned int lastLayer; /**< Last layer index */ + unsigned int reserved[16]; +} CUDA_RESOURCE_VIEW_DESC_v1; +typedef CUDA_RESOURCE_VIEW_DESC_v1 CUDA_RESOURCE_VIEW_DESC; + +/** + * Size of tensor map descriptor + */ +#define CU_TENSOR_MAP_NUM_QWORDS 16 + +/** + * Tensor map descriptor. Requires compiler support for aligning to 64 bytes. + */ +typedef struct CUtensorMap_st { +#if defined(__cplusplus) && (__cplusplus >= 201103L) + alignas(64) +#elif __STDC_VERSION__ >= 201112L + _Alignas(64) +#endif + cuuint64_t opaque[CU_TENSOR_MAP_NUM_QWORDS]; +} CUtensorMap; + +/** + * Tensor map data type + */ +typedef enum CUtensorMapDataType_enum { + CU_TENSOR_MAP_DATA_TYPE_UINT8 = 0, + CU_TENSOR_MAP_DATA_TYPE_UINT16, + CU_TENSOR_MAP_DATA_TYPE_UINT32, + CU_TENSOR_MAP_DATA_TYPE_INT32, + CU_TENSOR_MAP_DATA_TYPE_UINT64, + CU_TENSOR_MAP_DATA_TYPE_INT64, + CU_TENSOR_MAP_DATA_TYPE_FLOAT16, + CU_TENSOR_MAP_DATA_TYPE_FLOAT32, + CU_TENSOR_MAP_DATA_TYPE_FLOAT64, + CU_TENSOR_MAP_DATA_TYPE_BFLOAT16, + CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ, + CU_TENSOR_MAP_DATA_TYPE_TFLOAT32, + CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ +} CUtensorMapDataType; + +/** + * Tensor map interleave layout type + */ +typedef enum CUtensorMapInterleave_enum { + CU_TENSOR_MAP_INTERLEAVE_NONE = 0, + CU_TENSOR_MAP_INTERLEAVE_16B, + CU_TENSOR_MAP_INTERLEAVE_32B +} CUtensorMapInterleave; + +/** + * Tensor map swizzling mode of shared memory banks + */ +typedef enum CUtensorMapSwizzle_enum { + CU_TENSOR_MAP_SWIZZLE_NONE = 0, + CU_TENSOR_MAP_SWIZZLE_32B, + CU_TENSOR_MAP_SWIZZLE_64B, + CU_TENSOR_MAP_SWIZZLE_128B, +} CUtensorMapSwizzle; + +/** + * Tensor map L2 promotion type + */ +typedef enum CUtensorMapL2promotion_enum { + CU_TENSOR_MAP_L2_PROMOTION_NONE = 0, + CU_TENSOR_MAP_L2_PROMOTION_L2_64B, + CU_TENSOR_MAP_L2_PROMOTION_L2_128B, + CU_TENSOR_MAP_L2_PROMOTION_L2_256B +} CUtensorMapL2promotion; + +/** + * Tensor map out-of-bounds fill type + */ +typedef enum CUtensorMapFloatOOBfill_enum { + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE = 0, + CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA +} CUtensorMapFloatOOBfill; + +/** + * GPU Direct v3 tokens + */ +typedef struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st { + unsigned long long p2pToken; + unsigned int vaSpaceToken; +} CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1; +typedef CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_v1 CUDA_POINTER_ATTRIBUTE_P2P_TOKENS; + +/** +* Access flags that specify the level of access the current context's device has +* on the memory referenced. +*/ +typedef enum CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS_enum { + CU_POINTER_ATTRIBUTE_ACCESS_FLAG_NONE = 0x0, /**< No access, meaning the device cannot access this memory at all, thus must be staged through accessible memory in order to complete certain operations */ + CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READ = 0x1, /**< Read-only access, meaning writes to this memory are considered invalid accesses and thus return error in that case. */ + CU_POINTER_ATTRIBUTE_ACCESS_FLAG_READWRITE = 0x3 /**< Read-write access, the device has full read-write access to the memory */ +} CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS; + +/** + * Kernel launch parameters + */ +typedef struct CUDA_LAUNCH_PARAMS_st { + CUfunction function; /**< Kernel to launch */ + unsigned int gridDimX; /**< Width of grid in blocks */ + unsigned int gridDimY; /**< Height of grid in blocks */ + unsigned int gridDimZ; /**< Depth of grid in blocks */ + unsigned int blockDimX; /**< X dimension of each thread block */ + unsigned int blockDimY; /**< Y dimension of each thread block */ + unsigned int blockDimZ; /**< Z dimension of each thread block */ + unsigned int sharedMemBytes; /**< Dynamic shared-memory size per thread block in bytes */ + CUstream hStream; /**< Stream identifier */ + void **kernelParams; /**< Array of pointers to kernel parameters */ +} CUDA_LAUNCH_PARAMS_v1; +typedef CUDA_LAUNCH_PARAMS_v1 CUDA_LAUNCH_PARAMS; + +/** + * External memory handle types + */ +typedef enum CUexternalMemoryHandleType_enum { + /** + * Handle is an opaque file descriptor + */ + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD = 1, + /** + * Handle is an opaque shared NT handle + */ + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 = 2, + /** + * Handle is an opaque, globally shared handle + */ + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3, + /** + * Handle is a D3D12 heap object + */ + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP = 4, + /** + * Handle is a D3D12 committed resource + */ + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE = 5, + /** + * Handle is a shared NT handle to a D3D11 resource + */ + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE = 6, + /** + * Handle is a globally shared handle to a D3D11 resource + */ + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT = 7, + /** + * Handle is an NvSciBuf object + */ + CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF = 8 +} CUexternalMemoryHandleType; + +/** + * Indicates that the external memory object is a dedicated resource + */ +#define CUDA_EXTERNAL_MEMORY_DEDICATED 0x1 + +/** When the \p flags parameter of ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS + * contains this flag, it indicates that signaling an external semaphore object + * should skip performing appropriate memory synchronization operations over all + * the external memory objects that are imported as ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF, + * which otherwise are performed by default to ensure data coherency with other + * importers of the same NvSciBuf memory objects. + */ +#define CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC 0x01 + +/** When the \p flags parameter of ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS + * contains this flag, it indicates that waiting on an external semaphore object + * should skip performing appropriate memory synchronization operations over all + * the external memory objects that are imported as ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF, + * which otherwise are performed by default to ensure data coherency with other + * importers of the same NvSciBuf memory objects. + */ +#define CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC 0x02 + +/** + * When \p flags of ::cuDeviceGetNvSciSyncAttributes is set to this, + * it indicates that application needs signaler specific NvSciSyncAttr + * to be filled by ::cuDeviceGetNvSciSyncAttributes. + */ +#define CUDA_NVSCISYNC_ATTR_SIGNAL 0x1 + +/** + * When \p flags of ::cuDeviceGetNvSciSyncAttributes is set to this, + * it indicates that application needs waiter specific NvSciSyncAttr + * to be filled by ::cuDeviceGetNvSciSyncAttributes. + */ +#define CUDA_NVSCISYNC_ATTR_WAIT 0x2 +/** + * External memory handle descriptor + */ +typedef struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st { + /** + * Type of the handle + */ + CUexternalMemoryHandleType type; + union { + /** + * File descriptor referencing the memory object. Valid + * when type is + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD + */ + int fd; + /** + * Win32 handle referencing the semaphore object. Valid when + * type is one of the following: + * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 + * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT + * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP + * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE + * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE + * - ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT + * Exactly one of 'handle' and 'name' must be non-NULL. If + * type is one of the following: + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT + * then 'name' must be NULL. + */ + struct { + /** + * Valid NT handle. Must be NULL if 'name' is non-NULL + */ + void *handle; + /** + * Name of a valid memory object. + * Must be NULL if 'handle' is non-NULL. + */ + const void *name; + } win32; + /** + * A handle representing an NvSciBuf Object. Valid when type + * is ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF + */ + const void *nvSciBufObject; + } handle; + /** + * Size of the memory allocation + */ + unsigned long long size; + /** + * Flags must either be zero or ::CUDA_EXTERNAL_MEMORY_DEDICATED + */ + unsigned int flags; + unsigned int reserved[16]; +} CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1; +typedef CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1 CUDA_EXTERNAL_MEMORY_HANDLE_DESC; + +/** + * External memory buffer descriptor + */ +typedef struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st { + /** + * Offset into the memory object where the buffer's base is + */ + unsigned long long offset; + /** + * Size of the buffer + */ + unsigned long long size; + /** + * Flags reserved for future use. Must be zero. + */ + unsigned int flags; + unsigned int reserved[16]; +} CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1; +typedef CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1 CUDA_EXTERNAL_MEMORY_BUFFER_DESC; + +/** + * External memory mipmap descriptor + */ +typedef struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st { + /** + * Offset into the memory object where the base level of the + * mipmap chain is. + */ + unsigned long long offset; + /** + * Format, dimension and type of base level of the mipmap chain + */ + CUDA_ARRAY3D_DESCRIPTOR arrayDesc; + /** + * Total number of levels in the mipmap chain + */ + unsigned int numLevels; + unsigned int reserved[16]; +} CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1; +typedef CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC; + +/** + * External semaphore handle types + */ +typedef enum CUexternalSemaphoreHandleType_enum { + /** + * Handle is an opaque file descriptor + */ + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD = 1, + /** + * Handle is an opaque shared NT handle + */ + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 = 2, + /** + * Handle is an opaque, globally shared handle + */ + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3, + /** + * Handle is a shared NT handle referencing a D3D12 fence object + */ + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = 4, + /** + * Handle is a shared NT handle referencing a D3D11 fence object + */ + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE = 5, + /** + * Opaque handle to NvSciSync Object + */ + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC = 6, + /** + * Handle is a shared NT handle referencing a D3D11 keyed mutex object + */ + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX = 7, + /** + * Handle is a globally shared handle referencing a D3D11 keyed mutex object + */ + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT = 8, + /** + * Handle is an opaque file descriptor referencing a timeline semaphore + */ + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD = 9, + /** + * Handle is an opaque shared NT handle referencing a timeline semaphore + */ + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 = 10 +} CUexternalSemaphoreHandleType; + +/** + * External semaphore handle descriptor + */ +typedef struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st { + /** + * Type of the handle + */ + CUexternalSemaphoreHandleType type; + union { + /** + * File descriptor referencing the semaphore object. Valid + * when type is one of the following: + * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD + * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD + */ + int fd; + /** + * Win32 handle referencing the semaphore object. Valid when + * type is one of the following: + * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 + * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT + * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE + * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE + * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX + * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 + * Exactly one of 'handle' and 'name' must be non-NULL. If + * type is one of the following: + * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT + * - ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT + * then 'name' must be NULL. + */ + struct { + /** + * Valid NT handle. Must be NULL if 'name' is non-NULL + */ + void *handle; + /** + * Name of a valid synchronization primitive. + * Must be NULL if 'handle' is non-NULL. + */ + const void *name; + } win32; + /** + * Valid NvSciSyncObj. Must be non NULL + */ + const void* nvSciSyncObj; + } handle; + /** + * Flags reserved for the future. Must be zero. + */ + unsigned int flags; + unsigned int reserved[16]; +} CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1; +typedef CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1 CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC; + +/** + * External semaphore signal parameters + */ +typedef struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st { + struct { + /** + * Parameters for fence objects + */ + struct { + /** + * Value of fence to be signaled + */ + unsigned long long value; + } fence; + union { + /** + * Pointer to NvSciSyncFence. Valid if ::CUexternalSemaphoreHandleType + * is of type ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC. + */ + void *fence; + unsigned long long reserved; + } nvSciSync; + /** + * Parameters for keyed mutex objects + */ + struct { + /** + * Value of key to release the mutex with + */ + unsigned long long key; + } keyedMutex; + unsigned int reserved[12]; + } params; + /** + * Only when ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS is used to + * signal a ::CUexternalSemaphore of type + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, the valid flag is + * ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC which indicates + * that while signaling the ::CUexternalSemaphore, no memory synchronization + * operations should be performed for any external memory object imported + * as ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. + * For all other types of ::CUexternalSemaphore, flags must be zero. + */ + unsigned int flags; + unsigned int reserved[16]; +} CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1; +typedef CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS; + +/** + * External semaphore wait parameters + */ +typedef struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st { + struct { + /** + * Parameters for fence objects + */ + struct { + /** + * Value of fence to be waited on + */ + unsigned long long value; + } fence; + /** + * Pointer to NvSciSyncFence. Valid if CUexternalSemaphoreHandleType + * is of type CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC. + */ + union { + void *fence; + unsigned long long reserved; + } nvSciSync; + /** + * Parameters for keyed mutex objects + */ + struct { + /** + * Value of key to acquire the mutex with + */ + unsigned long long key; + /** + * Timeout in milliseconds to wait to acquire the mutex + */ + unsigned int timeoutMs; + } keyedMutex; + unsigned int reserved[10]; + } params; + /** + * Only when ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS is used to wait on + * a ::CUexternalSemaphore of type ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, + * the valid flag is ::CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC + * which indicates that while waiting for the ::CUexternalSemaphore, no memory + * synchronization operations should be performed for any external memory + * object imported as ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. + * For all other types of ::CUexternalSemaphore, flags must be zero. + */ + unsigned int flags; + unsigned int reserved[16]; +} CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1; +typedef CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS; + +/** + * Semaphore signal node parameters + */ +typedef struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st { + CUexternalSemaphore* extSemArray; /**< Array of external semaphore handles. */ + const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray; /**< Array of external semaphore signal parameters. */ + unsigned int numExtSems; /**< Number of handles and parameters supplied in extSemArray and paramsArray. */ +} CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1; +typedef CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 CUDA_EXT_SEM_SIGNAL_NODE_PARAMS; + +/** + * Semaphore signal node parameters + */ +typedef struct CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st { + CUexternalSemaphore* extSemArray; /**< Array of external semaphore handles. */ + const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray; /**< Array of external semaphore signal parameters. */ + unsigned int numExtSems; /**< Number of handles and parameters supplied in extSemArray and paramsArray. */ +} CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2; + +/** + * Semaphore wait node parameters + */ +typedef struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_st { + CUexternalSemaphore* extSemArray; /**< Array of external semaphore handles. */ + const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray; /**< Array of external semaphore wait parameters. */ + unsigned int numExtSems; /**< Number of handles and parameters supplied in extSemArray and paramsArray. */ +} CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1; +typedef CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 CUDA_EXT_SEM_WAIT_NODE_PARAMS; + +/** + * Semaphore wait node parameters + */ +typedef struct CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st { + CUexternalSemaphore* extSemArray; /**< Array of external semaphore handles. */ + const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray; /**< Array of external semaphore wait parameters. */ + unsigned int numExtSems; /**< Number of handles and parameters supplied in extSemArray and paramsArray. */ +} CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2; + +typedef unsigned long long CUmemGenericAllocationHandle_v1; +typedef CUmemGenericAllocationHandle_v1 CUmemGenericAllocationHandle; + +/** + * Flags for specifying particular handle types + */ +typedef enum CUmemAllocationHandleType_enum { + CU_MEM_HANDLE_TYPE_NONE = 0x0, /**< Does not allow any export mechanism. > */ + CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR = 0x1, /**< Allows a file descriptor to be used for exporting. Permitted only on POSIX systems. (int) */ + CU_MEM_HANDLE_TYPE_WIN32 = 0x2, /**< Allows a Win32 NT handle to be used for exporting. (HANDLE) */ + CU_MEM_HANDLE_TYPE_WIN32_KMT = 0x4, /**< Allows a Win32 KMT handle to be used for exporting. (D3DKMT_HANDLE) */ + CU_MEM_HANDLE_TYPE_FABRIC = 0x8, /**< Allows a fabric handle to be used for exporting. (CUmemFabricHandle)*/ + CU_MEM_HANDLE_TYPE_MAX = 0x7FFFFFFF +} CUmemAllocationHandleType; + +/** + * Specifies the memory protection flags for mapping. + */ +typedef enum CUmemAccess_flags_enum { + CU_MEM_ACCESS_FLAGS_PROT_NONE = 0x0, /**< Default, make the address range not accessible */ + CU_MEM_ACCESS_FLAGS_PROT_READ = 0x1, /**< Make the address range read accessible */ + CU_MEM_ACCESS_FLAGS_PROT_READWRITE = 0x3, /**< Make the address range read-write accessible */ + CU_MEM_ACCESS_FLAGS_PROT_MAX = 0x7FFFFFFF +} CUmemAccess_flags; + +/** + * Specifies the type of location + */ +typedef enum CUmemLocationType_enum { + CU_MEM_LOCATION_TYPE_INVALID = 0x0, + CU_MEM_LOCATION_TYPE_DEVICE = 0x1, /**< Location is a device location, thus id is a device ordinal */ + CU_MEM_LOCATION_TYPE_HOST = 0x2, /**< Location is host, id is ignored */ + CU_MEM_LOCATION_TYPE_HOST_NUMA = 0x3, /**< Location is a host NUMA node, thus id is a host NUMA node id */ + CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT = 0x4, /**< Location is a host NUMA node of the current thread, id is ignored */ + CU_MEM_LOCATION_TYPE_MAX = 0x7FFFFFFF +} CUmemLocationType; + +/** +* Defines the allocation types available +*/ +typedef enum CUmemAllocationType_enum { + CU_MEM_ALLOCATION_TYPE_INVALID = 0x0, + + /** This allocation type is 'pinned', i.e. cannot migrate from its current + * location while the application is actively using it + */ + CU_MEM_ALLOCATION_TYPE_PINNED = 0x1, + CU_MEM_ALLOCATION_TYPE_MAX = 0x7FFFFFFF +} CUmemAllocationType; + +/** +* Flag for requesting different optimal and required granularities for an allocation. +*/ +typedef enum CUmemAllocationGranularity_flags_enum { + CU_MEM_ALLOC_GRANULARITY_MINIMUM = 0x0, /**< Minimum required granularity for allocation */ + CU_MEM_ALLOC_GRANULARITY_RECOMMENDED = 0x1 /**< Recommended granularity for allocation for best performance */ +} CUmemAllocationGranularity_flags; + +/** +* Specifies the handle type for address range +*/ +typedef enum CUmemRangeHandleType_enum +{ + CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD = 0x1, + CU_MEM_RANGE_HANDLE_TYPE_MAX = 0x7FFFFFFF +} CUmemRangeHandleType; + +/** + * Sparse subresource types + */ +typedef enum CUarraySparseSubresourceType_enum { + CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL = 0, + CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL = 1 +} CUarraySparseSubresourceType; + +/** + * Memory operation types + */ +typedef enum CUmemOperationType_enum { + CU_MEM_OPERATION_TYPE_MAP = 1, + CU_MEM_OPERATION_TYPE_UNMAP = 2 +} CUmemOperationType; + +/** + * Memory handle types + */ +typedef enum CUmemHandleType_enum { + CU_MEM_HANDLE_TYPE_GENERIC = 0 +} CUmemHandleType; + +/** + * Specifies the CUDA array or CUDA mipmapped array memory mapping information + */ +typedef struct CUarrayMapInfo_st { + CUresourcetype resourceType; /**< Resource type */ + + union { + CUmipmappedArray mipmap; + CUarray array; + } resource; + + CUarraySparseSubresourceType subresourceType; /**< Sparse subresource type */ + + union { + struct { + unsigned int level; /**< For CUDA mipmapped arrays must a valid mipmap level. For CUDA arrays must be zero */ + unsigned int layer; /**< For CUDA layered arrays must be a valid layer index. Otherwise, must be zero */ + unsigned int offsetX; /**< Starting X offset in elements */ + unsigned int offsetY; /**< Starting Y offset in elements */ + unsigned int offsetZ; /**< Starting Z offset in elements */ + unsigned int extentWidth; /**< Width in elements */ + unsigned int extentHeight; /**< Height in elements */ + unsigned int extentDepth; /**< Depth in elements */ + } sparseLevel; + struct { + unsigned int layer; /**< For CUDA layered arrays must be a valid layer index. Otherwise, must be zero */ + unsigned long long offset; /**< Offset within mip tail */ + unsigned long long size; /**< Extent in bytes */ + } miptail; + } subresource; + + CUmemOperationType memOperationType; /**< Memory operation type */ + CUmemHandleType memHandleType; /**< Memory handle type */ + + union { + CUmemGenericAllocationHandle memHandle; + } memHandle; + + unsigned long long offset; /**< Offset within the memory */ + unsigned int deviceBitMask; /**< Device ordinal bit mask */ + unsigned int flags; /**< flags for future use, must be zero now. */ + unsigned int reserved[2]; /**< Reserved for future use, must be zero now. */ +} CUarrayMapInfo_v1; +typedef CUarrayMapInfo_v1 CUarrayMapInfo; + +/** + * Specifies a memory location. + */ +typedef struct CUmemLocation_st { + CUmemLocationType type; /**< Specifies the location type, which modifies the meaning of id. */ + int id; /**< identifier for a given this location's ::CUmemLocationType. */ +} CUmemLocation_v1; +typedef CUmemLocation_v1 CUmemLocation; + +/** + * Specifies compression attribute for an allocation. + */ +typedef enum CUmemAllocationCompType_enum { + CU_MEM_ALLOCATION_COMP_NONE = 0x0, /**< Allocating non-compressible memory */ + CU_MEM_ALLOCATION_COMP_GENERIC = 0x1 /**< Allocating compressible memory */ +} CUmemAllocationCompType; + +/** + * This flag if set indicates that the memory will be used as a tile pool. + */ +#define CU_MEM_CREATE_USAGE_TILE_POOL 0x1 + +/** +* Specifies the allocation properties for a allocation. +*/ +typedef struct CUmemAllocationProp_st { + /** Allocation type */ + CUmemAllocationType type; + /** requested ::CUmemAllocationHandleType */ + CUmemAllocationHandleType requestedHandleTypes; + /** Location of allocation */ + CUmemLocation location; + /** + * Windows-specific POBJECT_ATTRIBUTES required when + * ::CU_MEM_HANDLE_TYPE_WIN32 is specified. This object attributes structure + * includes security attributes that define + * the scope of which exported allocations may be transferred to other + * processes. In all other cases, this field is required to be zero. + */ + void *win32HandleMetaData; + struct { + /** + * Allocation hint for requesting compressible memory. + * On devices that support Compute Data Compression, compressible + * memory can be used to accelerate accesses to data with unstructured + * sparsity and other compressible data patterns. Applications are + * expected to query allocation property of the handle obtained with + * ::cuMemCreate using ::cuMemGetAllocationPropertiesFromHandle to + * validate if the obtained allocation is compressible or not. Note that + * compressed memory may not be mappable on all devices. + */ + unsigned char compressionType; + unsigned char gpuDirectRDMACapable; + /** Bitmask indicating intended usage for this allocation */ + unsigned short usage; + unsigned char reserved[4]; + } allocFlags; +} CUmemAllocationProp_v1; +typedef CUmemAllocationProp_v1 CUmemAllocationProp; + +/** +* Flags for querying different granularities for a multicast object +*/ +typedef enum CUmulticastGranularity_flags_enum { + CU_MULTICAST_GRANULARITY_MINIMUM = 0x0, /**< Minimum required granularity */ + CU_MULTICAST_GRANULARITY_RECOMMENDED = 0x1 /**< Recommended granularity for best performance */ +} CUmulticastGranularity_flags; + +/** +* Specifies the properties for a multicast object. +*/ +typedef struct CUmulticastObjectProp_st { + /** + * The number of devices in the multicast team that will bind memory to this + * object + */ + unsigned int numDevices; + /** + * The maximum amount of memory that can be bound to this multicast object + * per device + */ + size_t size; + /** + * Bitmask of exportable handle types (see ::CUmemAllocationHandleType) for + * this object + */ + unsigned long long handleTypes; + /** + * Flags for future use, must be zero now + */ + unsigned long long flags; +} CUmulticastObjectProp_v1; +typedef CUmulticastObjectProp_v1 CUmulticastObjectProp; + +/** + * Memory access descriptor + */ +typedef struct CUmemAccessDesc_st { + CUmemLocation location; /**< Location on which the request is to change it's accessibility */ + CUmemAccess_flags flags; /**< ::CUmemProt accessibility flags to set on the request */ +} CUmemAccessDesc_v1; +typedef CUmemAccessDesc_v1 CUmemAccessDesc; + +/** + * CUDA Graph Update error types + */ +typedef enum CUgraphExecUpdateResult_enum { + CU_GRAPH_EXEC_UPDATE_SUCCESS = 0x0, /**< The update succeeded */ + CU_GRAPH_EXEC_UPDATE_ERROR = 0x1, /**< The update failed for an unexpected reason which is described in the return value of the function */ + CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED = 0x2, /**< The update failed because the topology changed */ + CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED = 0x3, /**< The update failed because a node type changed */ + CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED = 0x4, /**< The update failed because the function of a kernel node changed (CUDA driver < 11.2) */ + CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED = 0x5, /**< The update failed because the parameters changed in a way that is not supported */ + CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED = 0x6, /**< The update failed because something about the node is not supported */ + CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE = 0x7, /**< The update failed because the function of a kernel node changed in an unsupported way */ + CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED = 0x8 /**< The update failed because the node attributes changed in a way that is not supported */ +} CUgraphExecUpdateResult; + +/** + * Result information returned by cuGraphExecUpdate + */ +typedef struct CUgraphExecUpdateResultInfo_st { + /** + * Gives more specific detail when a cuda graph update fails. + */ + CUgraphExecUpdateResult result; + + /** + * The "to node" of the error edge when the topologies do not match. + * The error node when the error is associated with a specific node. + * NULL when the error is generic. + */ + CUgraphNode errorNode; + + /** + * The from node of error edge when the topologies do not match. Otherwise NULL. + */ + CUgraphNode errorFromNode; +} CUgraphExecUpdateResultInfo_v1; +typedef CUgraphExecUpdateResultInfo_v1 CUgraphExecUpdateResultInfo; + +/** + * CUDA memory pool attributes + */ +typedef enum CUmemPool_attribute_enum { + /** + * (value type = int) + * Allow cuMemAllocAsync to use memory asynchronously freed + * in another streams as long as a stream ordering dependency + * of the allocating stream on the free action exists. + * Cuda events and null stream interactions can create the required + * stream ordered dependencies. (default enabled) + */ + CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES = 1, + + /** + * (value type = int) + * Allow reuse of already completed frees when there is no dependency + * between the free and allocation. (default enabled) + */ + CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC, + + /** + * (value type = int) + * Allow cuMemAllocAsync to insert new stream dependencies + * in order to establish the stream ordering required to reuse + * a piece of memory released by cuFreeAsync (default enabled). + */ + CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES, + + /** + * (value type = cuuint64_t) + * Amount of reserved memory in bytes to hold onto before trying + * to release memory back to the OS. When more than the release + * threshold bytes of memory are held by the memory pool, the + * allocator will try to release memory back to the OS on the + * next call to stream, event or context synchronize. (default 0) + */ + CU_MEMPOOL_ATTR_RELEASE_THRESHOLD, + + /** + * (value type = cuuint64_t) + * Amount of backing memory currently allocated for the mempool. + */ + CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT, + + /** + * (value type = cuuint64_t) + * High watermark of backing memory allocated for the mempool since the + * last time it was reset. High watermark can only be reset to zero. + */ + CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH, + + /** + * (value type = cuuint64_t) + * Amount of memory from the pool that is currently in use by the application. + */ + CU_MEMPOOL_ATTR_USED_MEM_CURRENT, + + /** + * (value type = cuuint64_t) + * High watermark of the amount of memory from the pool that was in use by the application since + * the last time it was reset. High watermark can only be reset to zero. + */ + CU_MEMPOOL_ATTR_USED_MEM_HIGH +} CUmemPool_attribute; + +/** + * Specifies the properties of allocations made from the pool. + */ +typedef struct CUmemPoolProps_st { + CUmemAllocationType allocType; /**< Allocation type. Currently must be specified as CU_MEM_ALLOCATION_TYPE_PINNED */ + CUmemAllocationHandleType handleTypes; /**< Handle types that will be supported by allocations from the pool. */ + CUmemLocation location; /**< Location where allocations should reside. */ + /** + * Windows-specific LPSECURITYATTRIBUTES required when + * ::CU_MEM_HANDLE_TYPE_WIN32 is specified. This security attribute defines + * the scope of which exported allocations may be transferred to other + * processes. In all other cases, this field is required to be zero. + */ + void *win32SecurityAttributes; + size_t maxSize; /**< Maximum pool size. When set to 0, defaults to a system dependent value. */ + unsigned char reserved[56]; /**< reserved for future use, must be 0 */ +} CUmemPoolProps_v1; +typedef CUmemPoolProps_v1 CUmemPoolProps; + +/** + * Opaque data for exporting a pool allocation + */ +typedef struct CUmemPoolPtrExportData_st { + unsigned char reserved[64]; +} CUmemPoolPtrExportData_v1; +typedef CUmemPoolPtrExportData_v1 CUmemPoolPtrExportData; + +/** + * Memory allocation node parameters + */ +typedef struct CUDA_MEM_ALLOC_NODE_PARAMS_v1_st { + /** + * in: location where the allocation should reside (specified in ::location). + * ::handleTypes must be ::CU_MEM_HANDLE_TYPE_NONE. IPC is not supported. + */ + CUmemPoolProps poolProps; + const CUmemAccessDesc *accessDescs; /**< in: array of memory access descriptors. Used to describe peer GPU access */ + size_t accessDescCount; /**< in: number of memory access descriptors. Must not exceed the number of GPUs. */ + size_t bytesize; /**< in: size in bytes of the requested allocation */ + CUdeviceptr dptr; /**< out: address of the allocation returned by CUDA */ +} CUDA_MEM_ALLOC_NODE_PARAMS_v1; +typedef CUDA_MEM_ALLOC_NODE_PARAMS_v1 CUDA_MEM_ALLOC_NODE_PARAMS; + +/** + * Memory allocation node parameters + */ +typedef struct CUDA_MEM_ALLOC_NODE_PARAMS_v2_st { + /** + * in: location where the allocation should reside (specified in ::location). + * ::handleTypes must be ::CU_MEM_HANDLE_TYPE_NONE. IPC is not supported. + */ + CUmemPoolProps poolProps; + const CUmemAccessDesc *accessDescs; /**< in: array of memory access descriptors. Used to describe peer GPU access */ + size_t accessDescCount; /**< in: number of memory access descriptors. Must not exceed the number of GPUs. */ + size_t bytesize; /**< in: size in bytes of the requested allocation */ + CUdeviceptr dptr; /**< out: address of the allocation returned by CUDA */ +} CUDA_MEM_ALLOC_NODE_PARAMS_v2; + +/** + * Memory free node parameters + */ +typedef struct CUDA_MEM_FREE_NODE_PARAMS_st { + CUdeviceptr dptr; /**< in: the pointer to free */ +} CUDA_MEM_FREE_NODE_PARAMS; + +typedef enum CUgraphMem_attribute_enum { + /** + * (value type = cuuint64_t) + * Amount of memory, in bytes, currently associated with graphs + */ + CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT, + + /** + * (value type = cuuint64_t) + * High watermark of memory, in bytes, associated with graphs since the + * last time it was reset. High watermark can only be reset to zero. + */ + CU_GRAPH_MEM_ATTR_USED_MEM_HIGH, + + /** + * (value type = cuuint64_t) + * Amount of memory, in bytes, currently allocated for use by + * the CUDA graphs asynchronous allocator. + */ + CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT, + + /** + * (value type = cuuint64_t) + * High watermark of memory, in bytes, currently allocated for use by + * the CUDA graphs asynchronous allocator. + */ + CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH +} CUgraphMem_attribute; + +/** + * Child graph node parameters + */ +typedef struct CUDA_CHILD_GRAPH_NODE_PARAMS_st { + CUgraph graph; /**< The child graph to clone into the node for node creation, or + a handle to the graph owned by the node for node query */ +} CUDA_CHILD_GRAPH_NODE_PARAMS; + +/** + * Event record node parameters + */ +typedef struct CUDA_EVENT_RECORD_NODE_PARAMS_st { + CUevent event; /**< The event to record when the node executes */ +} CUDA_EVENT_RECORD_NODE_PARAMS; + +/** + * Event wait node parameters + */ +typedef struct CUDA_EVENT_WAIT_NODE_PARAMS_st { + CUevent event; /**< The event to wait on from the node */ +} CUDA_EVENT_WAIT_NODE_PARAMS; + +/** + * Graph node parameters. See ::cuGraphAddNode. + */ +typedef struct CUgraphNodeParams_st { + CUgraphNodeType type; /**< Type of the node */ + int reserved0[3]; /**< Reserved. Must be zero. */ + + union { + long long reserved1[29]; /**< Padding. Unused bytes must be zero. */ + CUDA_KERNEL_NODE_PARAMS_v3 kernel; /**< Kernel node parameters. */ + CUDA_MEMCPY_NODE_PARAMS memcpy; /**< Memcpy node parameters. */ + CUDA_MEMSET_NODE_PARAMS_v2 memset; /**< Memset node parameters. */ + CUDA_HOST_NODE_PARAMS_v2 host; /**< Host node parameters. */ + CUDA_CHILD_GRAPH_NODE_PARAMS graph; /**< Child graph node parameters. */ + CUDA_EVENT_WAIT_NODE_PARAMS eventWait; /**< Event wait node parameters. */ + CUDA_EVENT_RECORD_NODE_PARAMS eventRecord; /**< Event record node parameters. */ + CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2 extSemSignal; /**< External semaphore signal node parameters. */ + CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2 extSemWait; /**< External semaphore wait node parameters. */ + CUDA_MEM_ALLOC_NODE_PARAMS_v2 alloc; /**< Memory allocation node parameters. */ + CUDA_MEM_FREE_NODE_PARAMS free; /**< Memory free node parameters. */ + CUDA_BATCH_MEM_OP_NODE_PARAMS_v2 memOp; /**< MemOp node parameters. */ + CUDA_CONDITIONAL_NODE_PARAMS conditional; /**< Conditional node parameters. */ + }; + + long long reserved2; /**< Reserved bytes. Must be zero. */ +} CUgraphNodeParams; + +/** + * If set, each kernel launched as part of ::cuLaunchCooperativeKernelMultiDevice only + * waits for prior work in the stream corresponding to that GPU to complete before the + * kernel begins execution. + */ +#define CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC 0x01 + +/** + * If set, any subsequent work pushed in a stream that participated in a call to + * ::cuLaunchCooperativeKernelMultiDevice will only wait for the kernel launched on + * the GPU corresponding to that stream to complete before it begins execution. + */ +#define CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC 0x02 + +/** + * If set, the CUDA array is a collection of layers, where each layer is either a 1D + * or a 2D array and the Depth member of CUDA_ARRAY3D_DESCRIPTOR specifies the number + * of layers, not the depth of a 3D array. + */ +#define CUDA_ARRAY3D_LAYERED 0x01 + +/** + * Deprecated, use CUDA_ARRAY3D_LAYERED + */ +#define CUDA_ARRAY3D_2DARRAY 0x01 + +/** + * This flag must be set in order to bind a surface reference + * to the CUDA array + */ +#define CUDA_ARRAY3D_SURFACE_LDST 0x02 + +/** + * If set, the CUDA array is a collection of six 2D arrays, representing faces of a cube. The + * width of such a CUDA array must be equal to its height, and Depth must be six. + * If ::CUDA_ARRAY3D_LAYERED flag is also set, then the CUDA array is a collection of cubemaps + * and Depth must be a multiple of six. + */ +#define CUDA_ARRAY3D_CUBEMAP 0x04 + +/** + * This flag must be set in order to perform texture gather operations + * on a CUDA array. + */ +#define CUDA_ARRAY3D_TEXTURE_GATHER 0x08 + +/** + * This flag if set indicates that the CUDA + * array is a DEPTH_TEXTURE. + */ +#define CUDA_ARRAY3D_DEPTH_TEXTURE 0x10 + +/** + * This flag indicates that the CUDA array may be bound as a color target + * in an external graphics API + */ +#define CUDA_ARRAY3D_COLOR_ATTACHMENT 0x20 + +/** + * This flag if set indicates that the CUDA array or CUDA mipmapped array + * is a sparse CUDA array or CUDA mipmapped array respectively + */ +#define CUDA_ARRAY3D_SPARSE 0x40 + +/** + * This flag if set indicates that the CUDA array or CUDA mipmapped array + * will allow deferred memory mapping + */ +#define CUDA_ARRAY3D_DEFERRED_MAPPING 0x80 + +/** + * Override the texref format with a format inferred from the array. + * Flag for ::cuTexRefSetArray() + */ +#define CU_TRSA_OVERRIDE_FORMAT 0x01 + +/** + * Read the texture as integers rather than promoting the values to floats + * in the range [0,1]. + * Flag for ::cuTexRefSetFlags() and ::cuTexObjectCreate() + */ +#define CU_TRSF_READ_AS_INTEGER 0x01 + +/** + * Use normalized texture coordinates in the range [0,1) instead of [0,dim). + * Flag for ::cuTexRefSetFlags() and ::cuTexObjectCreate() + */ +#define CU_TRSF_NORMALIZED_COORDINATES 0x02 + +/** + * Perform sRGB->linear conversion during texture read. + * Flag for ::cuTexRefSetFlags() and ::cuTexObjectCreate() + */ +#define CU_TRSF_SRGB 0x10 + + /** + * Disable any trilinear filtering optimizations. + * Flag for ::cuTexRefSetFlags() and ::cuTexObjectCreate() + */ +#define CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION 0x20 + +/** + * Enable seamless cube map filtering. + * Flag for ::cuTexObjectCreate() + */ +#define CU_TRSF_SEAMLESS_CUBEMAP 0x40 + +/** + * C++ compile time constant for CU_LAUNCH_PARAM_END + */ +#define CU_LAUNCH_PARAM_END_AS_INT 0x00 + +/** + * End of array terminator for the \p extra parameter to + * ::cuLaunchKernel + */ +#define CU_LAUNCH_PARAM_END ((void*)CU_LAUNCH_PARAM_END_AS_INT) + +/** + * C++ compile time constant for CU_LAUNCH_PARAM_BUFFER_POINTER + */ +#define CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT 0x01 + +/** + * Indicator that the next value in the \p extra parameter to + * ::cuLaunchKernel will be a pointer to a buffer containing all kernel + * parameters used for launching kernel \p f. This buffer needs to + * honor all alignment/padding requirements of the individual parameters. + * If ::CU_LAUNCH_PARAM_BUFFER_SIZE is not also specified in the + * \p extra array, then ::CU_LAUNCH_PARAM_BUFFER_POINTER will have no + * effect. + */ +#define CU_LAUNCH_PARAM_BUFFER_POINTER ((void*)CU_LAUNCH_PARAM_BUFFER_POINTER_AS_INT) + +/** + * C++ compile time constant for CU_LAUNCH_PARAM_BUFFER_SIZE + */ +#define CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT 0x02 + +/** + * Indicator that the next value in the \p extra parameter to + * ::cuLaunchKernel will be a pointer to a size_t which contains the + * size of the buffer specified with ::CU_LAUNCH_PARAM_BUFFER_POINTER. + * It is required that ::CU_LAUNCH_PARAM_BUFFER_POINTER also be specified + * in the \p extra array if the value associated with + * ::CU_LAUNCH_PARAM_BUFFER_SIZE is not zero. + */ +#define CU_LAUNCH_PARAM_BUFFER_SIZE ((void*)CU_LAUNCH_PARAM_BUFFER_SIZE_AS_INT) + +/** + * For texture references loaded into the module, use default texunit from + * texture reference. + */ +#define CU_PARAM_TR_DEFAULT -1 + +/** + * Device that represents the CPU + */ +#define CU_DEVICE_CPU ((CUdevice)-1) + +/** + * Device that represents an invalid device + */ +#define CU_DEVICE_INVALID ((CUdevice)-2) + +/** + * Bitmasks for ::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS + */ +typedef enum CUflushGPUDirectRDMAWritesOptions_enum { + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_HOST = 1<<0, /**< ::cuFlushGPUDirectRDMAWrites() and its CUDA Runtime API counterpart are supported on the device. */ + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_OPTION_MEMOPS = 1<<1 /**< The ::CU_STREAM_WAIT_VALUE_FLUSH flag and the ::CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES MemOp are supported on the device. */ +} CUflushGPUDirectRDMAWritesOptions; + +/** + * Platform native ordering for GPUDirect RDMA writes + */ +typedef enum CUGPUDirectRDMAWritesOrdering_enum { + CU_GPU_DIRECT_RDMA_WRITES_ORDERING_NONE = 0, /**< The device does not natively support ordering of remote writes. ::cuFlushGPUDirectRDMAWrites() can be leveraged if supported. */ + CU_GPU_DIRECT_RDMA_WRITES_ORDERING_OWNER = 100, /**< Natively, the device can consistently consume remote writes, although other CUDA devices may not. */ + CU_GPU_DIRECT_RDMA_WRITES_ORDERING_ALL_DEVICES = 200 /**< Any CUDA device in the system can consistently consume remote writes to this device. */ +} CUGPUDirectRDMAWritesOrdering; + +/** + * The scopes for ::cuFlushGPUDirectRDMAWrites + */ +typedef enum CUflushGPUDirectRDMAWritesScope_enum { + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_OWNER = 100, /**< Blocks until remote writes are visible to the CUDA device context owning the data. */ + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TO_ALL_DEVICES = 200 /**< Blocks until remote writes are visible to all CUDA device contexts. */ +} CUflushGPUDirectRDMAWritesScope; + +/** + * The targets for ::cuFlushGPUDirectRDMAWrites + */ +typedef enum CUflushGPUDirectRDMAWritesTarget_enum { + CU_FLUSH_GPU_DIRECT_RDMA_WRITES_TARGET_CURRENT_CTX = 0 /**< Sets the target for ::cuFlushGPUDirectRDMAWrites() to the currently active CUDA device context. */ +} CUflushGPUDirectRDMAWritesTarget; + +/** + * The additional write options for ::cuGraphDebugDotPrint + */ +typedef enum CUgraphDebugDot_flags_enum { + CU_GRAPH_DEBUG_DOT_FLAGS_VERBOSE = 1<<0, /**< Output all debug data as if every debug flag is enabled */ + CU_GRAPH_DEBUG_DOT_FLAGS_RUNTIME_TYPES = 1<<1, /**< Use CUDA Runtime structures for output */ + CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_PARAMS = 1<<2, /**< Adds CUDA_KERNEL_NODE_PARAMS values to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_MEMCPY_NODE_PARAMS = 1<<3, /**< Adds CUDA_MEMCPY3D values to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_MEMSET_NODE_PARAMS = 1<<4, /**< Adds CUDA_MEMSET_NODE_PARAMS values to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_HOST_NODE_PARAMS = 1<<5, /**< Adds CUDA_HOST_NODE_PARAMS values to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_EVENT_NODE_PARAMS = 1<<6, /**< Adds CUevent handle from record and wait nodes to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_SIGNAL_NODE_PARAMS = 1<<7, /**< Adds CUDA_EXT_SEM_SIGNAL_NODE_PARAMS values to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_EXT_SEMAS_WAIT_NODE_PARAMS = 1<<8, /**< Adds CUDA_EXT_SEM_WAIT_NODE_PARAMS values to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_KERNEL_NODE_ATTRIBUTES = 1<<9, /**< Adds CUkernelNodeAttrValue values to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_HANDLES = 1<<10, /**< Adds node handles and every kernel function handle to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_MEM_ALLOC_NODE_PARAMS = 1<<11, /**< Adds memory alloc node parameters to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_MEM_FREE_NODE_PARAMS = 1<<12, /**< Adds memory free node parameters to output */ + CU_GRAPH_DEBUG_DOT_FLAGS_BATCH_MEM_OP_NODE_PARAMS = 1<<13 /**< Adds batch mem op node parameters to output */ + , CU_GRAPH_DEBUG_DOT_FLAGS_EXTRA_TOPO_INFO = 1<<14 /**< Adds edge numbering information */ + , CU_GRAPH_DEBUG_DOT_FLAGS_CONDITIONAL_NODE_PARAMS = 1<<15 /**< Adds conditional node parameters to output */ +} CUgraphDebugDot_flags; + +/** + * Flags for user objects for graphs + */ +typedef enum CUuserObject_flags_enum { + CU_USER_OBJECT_NO_DESTRUCTOR_SYNC = 1 /**< Indicates the destructor execution is not synchronized by any CUDA handle. */ +} CUuserObject_flags; + +/** + * Flags for retaining user object references for graphs + */ +typedef enum CUuserObjectRetain_flags_enum { + CU_GRAPH_USER_OBJECT_MOVE = 1 /**< Transfer references from the caller rather than creating new references. */ +} CUuserObjectRetain_flags; + +/** + * Flags for instantiating a graph + */ +typedef enum CUgraphInstantiate_flags_enum { + CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH = 1 /**< Automatically free memory allocated in a graph before relaunching. */ + , CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD = 2 /**< Automatically upload the graph after instantiation. Only supported by + ::cuGraphInstantiateWithParams. The upload will be performed using the + stream provided in \p instantiateParams. */ + , CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH = 4 /**< Instantiate the graph to be launchable from the device. This flag can only + be used on platforms which support unified addressing. This flag cannot be + used in conjunction with CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH. */ + , CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY = 8 /**< Run the graph using the per-node priority attributes rather than the + priority of the stream it is launched into. */ +} CUgraphInstantiate_flags; + +typedef enum CUdeviceNumaConfig_enum { + CU_DEVICE_NUMA_CONFIG_NONE = 0, /**< The GPU is not a NUMA node */ + CU_DEVICE_NUMA_CONFIG_NUMA_NODE, /**< The GPU is a NUMA node, CU_DEVICE_ATTRIBUTE_NUMA_ID contains its NUMA ID */ +} CUdeviceNumaConfig; + +/** @} */ /* END CUDA_TYPES */ + +#if defined(__GNUC__) + #if defined(__CUDA_API_PUSH_VISIBILITY_DEFAULT) + #pragma GCC visibility push(default) + #endif +#endif + +#ifdef _WIN32 +#define CUDAAPI __stdcall +#else +#define CUDAAPI +#endif + +/** + * \defgroup CUDA_ERROR Error Handling + * + * ___MANBRIEF___ error handling functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the error handling functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Gets the string description of an error code + * + * Sets \p *pStr to the address of a NULL-terminated string description + * of the error code \p error. + * If the error code is not recognized, ::CUDA_ERROR_INVALID_VALUE + * will be returned and \p *pStr will be set to the NULL address. + * + * \param error - Error code to convert to string + * \param pStr - Address of the string pointer. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::CUresult, + * ::cudaGetErrorString + */ +CUresult CUDAAPI cuGetErrorString(CUresult error, const char **pStr); + +/** + * \brief Gets the string representation of an error code enum name + * + * Sets \p *pStr to the address of a NULL-terminated string representation + * of the name of the enum error code \p error. + * If the error code is not recognized, ::CUDA_ERROR_INVALID_VALUE + * will be returned and \p *pStr will be set to the NULL address. + * + * \param error - Error code to convert to string + * \param pStr - Address of the string pointer. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::CUresult, + * ::cudaGetErrorName + */ +CUresult CUDAAPI cuGetErrorName(CUresult error, const char **pStr); + +/** @} */ /* END CUDA_ERROR */ + +/** + * \defgroup CUDA_INITIALIZE Initialization + * + * ___MANBRIEF___ initialization functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the initialization functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Initialize the CUDA driver API + * Initializes the driver API and must be called before any other function from + * the driver API in the current process. Currently, the \p Flags parameter must be 0. If ::cuInit() + * has not been called, any function from the driver API will return + * ::CUDA_ERROR_NOT_INITIALIZED. + * + * \param Flags - Initialization flag for CUDA. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_SYSTEM_DRIVER_MISMATCH, + * ::CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE + * \notefnerr + */ +CUresult CUDAAPI cuInit(unsigned int Flags); + +/** @} */ /* END CUDA_INITIALIZE */ + +/** + * \defgroup CUDA_VERSION Version Management + * + * ___MANBRIEF___ version management functions of the low-level CUDA driver + * API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the version management functions of the low-level + * CUDA driver application programming interface. + * + * @{ + */ + +/** + * \brief Returns the latest CUDA version supported by driver + * + * Returns in \p *driverVersion the version of CUDA supported by + * the driver. The version is returned as + * (1000 × major + 10 × minor). For example, CUDA 9.2 + * would be represented by 9020. + * + * This function automatically returns ::CUDA_ERROR_INVALID_VALUE if + * \p driverVersion is NULL. + * + * \param driverVersion - Returns the CUDA driver version + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa + * ::cudaDriverGetVersion, + * ::cudaRuntimeGetVersion + */ +CUresult CUDAAPI cuDriverGetVersion(int *driverVersion); + +/** @} */ /* END CUDA_VERSION */ + +/** + * \defgroup CUDA_DEVICE Device Management + * + * ___MANBRIEF___ device management functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the device management functions of the low-level + * CUDA driver application programming interface. + * + * @{ + */ + +/** + * \brief Returns a handle to a compute device + * + * Returns in \p *device a device handle given an ordinal in the range [0, + * ::cuDeviceGetCount()-1]. + * + * \param device - Returned device handle + * \param ordinal - Device number to get handle for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetAttribute, + * ::cuDeviceGetCount, + * ::cuDeviceGetName, + * ::cuDeviceGetUuid, + * ::cuDeviceGetLuid, + * ::cuDeviceTotalMem, + * ::cuDeviceGetExecAffinitySupport + */ +CUresult CUDAAPI cuDeviceGet(CUdevice *device, int ordinal); + +/** + * \brief Returns the number of compute-capable devices + * + * Returns in \p *count the number of devices with compute capability greater + * than or equal to 2.0 that are available for execution. If there is no such + * device, ::cuDeviceGetCount() returns 0. + * + * \param count - Returned number of compute-capable devices + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa + * ::cuDeviceGetAttribute, + * ::cuDeviceGetName, + * ::cuDeviceGetUuid, + * ::cuDeviceGetLuid, + * ::cuDeviceGet, + * ::cuDeviceTotalMem, + * ::cuDeviceGetExecAffinitySupport, + * ::cudaGetDeviceCount + */ +CUresult CUDAAPI cuDeviceGetCount(int *count); + +/** + * \brief Returns an identifier string for the device + * + * Returns an ASCII string identifying the device \p dev in the NULL-terminated + * string pointed to by \p name. \p len specifies the maximum length of the + * string that may be returned. + * + * \param name - Returned identifier string for the device + * \param len - Maximum length of string to store in \p name + * \param dev - Device to get identifier string for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetAttribute, + * ::cuDeviceGetUuid, + * ::cuDeviceGetLuid, + * ::cuDeviceGetCount, + * ::cuDeviceGet, + * ::cuDeviceTotalMem, + * ::cuDeviceGetExecAffinitySupport, + * ::cudaGetDeviceProperties + */ +CUresult CUDAAPI cuDeviceGetName(char *name, int len, CUdevice dev); + +/** + * \brief Return an UUID for the device + * + * Note there is a later version of this API, ::cuDeviceGetUuid_v2. It will + * supplant this version in 12.0, which is retained for minor version compatibility. + * + * Returns 16-octets identifying the device \p dev in the structure + * pointed by the \p uuid. + * + * \param uuid - Returned UUID + * \param dev - Device to get identifier string for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetUuid_v2 + * ::cuDeviceGetAttribute, + * ::cuDeviceGetCount, + * ::cuDeviceGetName, + * ::cuDeviceGetLuid, + * ::cuDeviceGet, + * ::cuDeviceTotalMem, + * ::cuDeviceGetExecAffinitySupport, + * ::cudaGetDeviceProperties + */ +CUresult CUDAAPI cuDeviceGetUuid(CUuuid *uuid, CUdevice dev); + +/** + * \brief Return an UUID for the device (11.4+) + * + * Returns 16-octets identifying the device \p dev in the structure + * pointed by the \p uuid. If the device is in MIG mode, returns its + * MIG UUID which uniquely identifies the subscribed MIG compute instance. + * + * \param uuid - Returned UUID + * \param dev - Device to get identifier string for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetAttribute, + * ::cuDeviceGetCount, + * ::cuDeviceGetName, + * ::cuDeviceGetLuid, + * ::cuDeviceGet, + * ::cuDeviceTotalMem, + * ::cudaGetDeviceProperties + */ +CUresult CUDAAPI cuDeviceGetUuid_v2(CUuuid *uuid, CUdevice dev); + +/** + * \brief Return an LUID and device node mask for the device + * + * Return identifying information (\p luid and \p deviceNodeMask) to allow + * matching device with graphics APIs. + * + * \param luid - Returned LUID + * \param deviceNodeMask - Returned device node mask + * \param dev - Device to get identifier string for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetAttribute, + * ::cuDeviceGetCount, + * ::cuDeviceGetName, + * ::cuDeviceGet, + * ::cuDeviceTotalMem, + * ::cuDeviceGetExecAffinitySupport, + * ::cudaGetDeviceProperties + */ +CUresult CUDAAPI cuDeviceGetLuid(char *luid, unsigned int *deviceNodeMask, CUdevice dev); + +/** + * \brief Returns the total amount of memory on the device + * + * Returns in \p *bytes the total amount of memory available on the device + * \p dev in bytes. + * + * \param bytes - Returned memory available on device in bytes + * \param dev - Device handle + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetAttribute, + * ::cuDeviceGetCount, + * ::cuDeviceGetName, + * ::cuDeviceGetUuid, + * ::cuDeviceGet, + * ::cuDeviceGetExecAffinitySupport, + * ::cudaMemGetInfo + */ +CUresult CUDAAPI cuDeviceTotalMem(size_t *bytes, CUdevice dev); + +/** + * \brief Returns the maximum number of elements allocatable in a 1D linear texture for a given texture element size. + * + * Returns in \p maxWidthInElements the maximum number of texture elements allocatable in a 1D linear texture + * for given \p format and \p numChannels. + * + * \param maxWidthInElements - Returned maximum number of texture elements allocatable for given \p format and \p numChannels. + * \param format - Texture format. + * \param numChannels - Number of channels per texture element. + * \param dev - Device handle. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetAttribute, + * ::cuDeviceGetCount, + * ::cuDeviceGetName, + * ::cuDeviceGetUuid, + * ::cuDeviceGet, + * ::cudaMemGetInfo, + * ::cuDeviceTotalMem + */ +CUresult CUDAAPI cuDeviceGetTexture1DLinearMaxWidth(size_t *maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice dev); + +/** + * \brief Returns information about the device + * + * Returns in \p *pi the integer value of the attribute \p attrib on device + * \p dev. The supported attributes are: + * - ::CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK: Maximum number of threads per + * block; + * - ::CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X: Maximum x-dimension of a block + * - ::CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y: Maximum y-dimension of a block + * - ::CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z: Maximum z-dimension of a block + * - ::CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X: Maximum x-dimension of a grid + * - ::CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y: Maximum y-dimension of a grid + * - ::CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z: Maximum z-dimension of a grid + * - ::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK: Maximum amount of + * shared memory available to a thread block in bytes + * - ::CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY: Memory available on device for + * __constant__ variables in a CUDA C kernel in bytes + * - ::CU_DEVICE_ATTRIBUTE_WARP_SIZE: Warp size in threads + * - ::CU_DEVICE_ATTRIBUTE_MAX_PITCH: Maximum pitch in bytes allowed by the + * memory copy functions that involve memory regions allocated through + * ::cuMemAllocPitch() + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH: Maximum 1D + * texture width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH: Maximum width + * for a 1D texture bound to linear memory + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH: Maximum + * mipmapped 1D texture width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH: Maximum 2D + * texture width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT: Maximum 2D + * texture height + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH: Maximum width + * for a 2D texture bound to linear memory + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT: Maximum height + * for a 2D texture bound to linear memory + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH: Maximum pitch + * in bytes for a 2D texture bound to linear memory + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH: Maximum + * mipmapped 2D texture width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT: Maximum + * mipmapped 2D texture height + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH: Maximum 3D + * texture width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT: Maximum 3D + * texture height + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH: Maximum 3D + * texture depth + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE: + * Alternate maximum 3D texture width, 0 if no alternate + * maximum 3D texture size is supported + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE: + * Alternate maximum 3D texture height, 0 if no alternate + * maximum 3D texture size is supported + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE: + * Alternate maximum 3D texture depth, 0 if no alternate + * maximum 3D texture size is supported + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH: + * Maximum cubemap texture width or height + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH: + * Maximum 1D layered texture width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS: + * Maximum layers in a 1D layered texture + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH: + * Maximum 2D layered texture width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT: + * Maximum 2D layered texture height + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS: + * Maximum layers in a 2D layered texture + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH: + * Maximum cubemap layered texture width or height + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS: + * Maximum layers in a cubemap layered texture + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH: + * Maximum 1D surface width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH: + * Maximum 2D surface width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT: + * Maximum 2D surface height + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH: + * Maximum 3D surface width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT: + * Maximum 3D surface height + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH: + * Maximum 3D surface depth + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH: + * Maximum 1D layered surface width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS: + * Maximum layers in a 1D layered surface + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH: + * Maximum 2D layered surface width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT: + * Maximum 2D layered surface height + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS: + * Maximum layers in a 2D layered surface + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH: + * Maximum cubemap surface width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH: + * Maximum cubemap layered surface width + * - ::CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS: + * Maximum layers in a cubemap layered surface + * - ::CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK: Maximum number of 32-bit + * registers available to a thread block + * - ::CU_DEVICE_ATTRIBUTE_CLOCK_RATE: The typical clock frequency in kilohertz + * - ::CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT: Alignment requirement; texture + * base addresses aligned to ::textureAlign bytes do not need an offset + * applied to texture fetches + * - ::CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT: Pitch alignment requirement + * for 2D texture references bound to pitched memory + * - ::CU_DEVICE_ATTRIBUTE_GPU_OVERLAP: 1 if the device can concurrently copy + * memory between host and device while executing a kernel, or 0 if not + * - ::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT: Number of multiprocessors on + * the device + * - ::CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT: 1 if there is a run time limit + * for kernels executed on the device, or 0 if not + * - ::CU_DEVICE_ATTRIBUTE_INTEGRATED: 1 if the device is integrated with the + * memory subsystem, or 0 if not + * - ::CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY: 1 if the device can map host + * memory into the CUDA address space, or 0 if not + * - ::CU_DEVICE_ATTRIBUTE_COMPUTE_MODE: Compute mode that device is currently + * in. Available modes are as follows: + * - ::CU_COMPUTEMODE_DEFAULT: Default mode - Device is not restricted and + * can have multiple CUDA contexts present at a single time. + * - ::CU_COMPUTEMODE_PROHIBITED: Compute-prohibited mode - Device is + * prohibited from creating new CUDA contexts. + * - ::CU_COMPUTEMODE_EXCLUSIVE_PROCESS: Compute-exclusive-process mode - Device + * can have only one context used by a single process at a time. + * - ::CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS: 1 if the device supports + * executing multiple kernels within the same context simultaneously, or 0 if + * not. It is not guaranteed that multiple kernels will be resident + * on the device concurrently so this feature should not be relied upon for + * correctness. + * - ::CU_DEVICE_ATTRIBUTE_ECC_ENABLED: 1 if error correction is enabled on the + * device, 0 if error correction is disabled or not supported by the device + * - ::CU_DEVICE_ATTRIBUTE_PCI_BUS_ID: PCI bus identifier of the device + * - ::CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID: PCI device (also known as slot) identifier + * of the device + * - ::CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID: PCI domain identifier of the device + * - ::CU_DEVICE_ATTRIBUTE_TCC_DRIVER: 1 if the device is using a TCC driver. TCC + * is only available on Tesla hardware running Windows Vista or later + * - ::CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE: Peak memory clock frequency in kilohertz + * - ::CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH: Global memory bus width in bits + * - ::CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE: Size of L2 cache in bytes. 0 if the device doesn't have L2 cache + * - ::CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR: Maximum resident threads per multiprocessor + * - ::CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING: 1 if the device shares a unified address space with + * the host, or 0 if not + * - ::CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR: Major compute capability version number + * - ::CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR: Minor compute capability version number + * - ::CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED: 1 if device supports caching globals + * in L1 cache, 0 if caching globals in L1 cache is not supported by the device + * - ::CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED: 1 if device supports caching locals + * in L1 cache, 0 if caching locals in L1 cache is not supported by the device + * - ::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR: Maximum amount of + * shared memory available to a multiprocessor in bytes; this amount is shared + * by all thread blocks simultaneously resident on a multiprocessor + * - ::CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR: Maximum number of 32-bit + * registers available to a multiprocessor; this number is shared by all thread + * blocks simultaneously resident on a multiprocessor + * - ::CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY: 1 if device supports allocating managed memory + * on this system, 0 if allocating managed memory is not supported by the device on this system. + * - ::CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD: 1 if device is on a multi-GPU board, 0 if not. + * - ::CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID: Unique identifier for a group of devices + * associated with the same board. Devices on the same multi-GPU board will share the same identifier. + * - ::CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED: 1 if Link between the device and the host + * supports native atomic operations. + * - ::CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO: Ratio of single precision performance + * (in floating-point operations per second) to double precision performance. + * - ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS: Device supports coherently accessing + * pageable memory without calling cudaHostRegister on it. + * - ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS: Device can coherently access managed memory + * concurrently with the CPU. + * - ::CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED: Device supports Compute Preemption. + * - ::CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM: Device can access host registered + * memory at the same virtual address as the CPU. + * - ::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN: The maximum per block shared memory size + * supported on this device. This is the maximum value that can be opted into when using the cuFuncSetAttribute() or cuKernelSetAttribute() call. + * For more details see ::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES + * - ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES: Device accesses pageable memory via the host's + * page tables. + * - ::CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST: The host can directly access managed memory on the device without migration. + * - ::CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED: Device supports virtual memory management APIs like ::cuMemAddressReserve, ::cuMemCreate, ::cuMemMap and related APIs + * - ::CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED: Device supports exporting memory to a posix file descriptor with ::cuMemExportToShareableHandle, if requested via ::cuMemCreate + * - ::CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED: Device supports exporting memory to a Win32 NT handle with ::cuMemExportToShareableHandle, if requested via ::cuMemCreate + * - ::CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED: Device supports exporting memory to a Win32 KMT handle with ::cuMemExportToShareableHandle, if requested via ::cuMemCreate + * - ::CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR: Maximum number of thread blocks that can reside on a multiprocessor + * - ::CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED: Device supports compressible memory allocation via ::cuMemCreate + * - ::CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE: Maximum L2 persisting lines capacity setting in bytes + * - ::CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE: Maximum value of CUaccessPolicyWindow::num_bytes + * - ::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED: Device supports specifying the GPUDirect RDMA flag with ::cuMemCreate. + * - ::CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK: Amount of shared memory per block reserved by CUDA driver in bytes + * - ::CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED: Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays. + * - ::CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED: Device supports using the ::cuMemHostRegister flag ::CU_MEMHOSTERGISTER_READ_ONLY to register memory that must be mapped as read-only to the GPU + * - ::CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED: Device supports using the ::cuMemAllocAsync and ::cuMemPool family of APIs + * - ::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED: Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see https://docs.nvidia.com/cuda/gpudirect-rdma for more information) + * - ::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS: The returned attribute shall be interpreted as a bitmask, where the individual bits are described by the ::CUflushGPUDirectRDMAWritesOptions enum + * - ::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING: GPUDirect RDMA writes to the device do not need to be flushed for consumers within the scope indicated by the returned attribute. See ::CUGPUDirectRDMAWritesOrdering for the numerical values returned here. + * - ::CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES: Bitmask of handle types supported with mempool based IPC + * - ::CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED: Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays. + * + * \param pi - Returned device attribute value + * \param attrib - Device attribute to query + * \param dev - Device handle + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetCount, + * ::cuDeviceGetName, + * ::cuDeviceGetUuid, + * ::cuDeviceGet, + * ::cuDeviceTotalMem, + * ::cuDeviceGetExecAffinitySupport, + * ::cudaDeviceGetAttribute, + * ::cudaGetDeviceProperties + */ +CUresult CUDAAPI cuDeviceGetAttribute(int *pi, CUdevice_attribute attrib, CUdevice dev); + +/** + * \brief Return NvSciSync attributes that this device can support. + * + * Returns in \p nvSciSyncAttrList, the properties of NvSciSync that + * this CUDA device, \p dev can support. The returned \p nvSciSyncAttrList + * can be used to create an NvSciSync object that matches this device's capabilities. + * + * If NvSciSyncAttrKey_RequiredPerm field in \p nvSciSyncAttrList is + * already set this API will return ::CUDA_ERROR_INVALID_VALUE. + * + * The applications should set \p nvSciSyncAttrList to a valid + * NvSciSyncAttrList failing which this API will return + * ::CUDA_ERROR_INVALID_HANDLE. + * + * The \p flags controls how applications intends to use + * the NvSciSync created from the \p nvSciSyncAttrList. The valid flags are: + * - ::CUDA_NVSCISYNC_ATTR_SIGNAL, specifies that the applications intends to + * signal an NvSciSync on this CUDA device. + * - ::CUDA_NVSCISYNC_ATTR_WAIT, specifies that the applications intends to + * wait on an NvSciSync on this CUDA device. + * + * At least one of these flags must be set, failing which the API + * returns ::CUDA_ERROR_INVALID_VALUE. Both the flags are orthogonal + * to one another: a developer may set both these flags that allows to + * set both wait and signal specific attributes in the same \p nvSciSyncAttrList. + * + * Note that this API updates the input \p nvSciSyncAttrList with values equivalent + * to the following public attribute key-values: + * NvSciSyncAttrKey_RequiredPerm is set to + * - NvSciSyncAccessPerm_SignalOnly if ::CUDA_NVSCISYNC_ATTR_SIGNAL is set in \p flags. + * - NvSciSyncAccessPerm_WaitOnly if ::CUDA_NVSCISYNC_ATTR_WAIT is set in \p flags. + * - NvSciSyncAccessPerm_WaitSignal if both ::CUDA_NVSCISYNC_ATTR_WAIT and + * ::CUDA_NVSCISYNC_ATTR_SIGNAL are set in \p flags. + * NvSciSyncAttrKey_PrimitiveInfo is set to + * - NvSciSyncAttrValPrimitiveType_SysmemSemaphore on any valid \p device. + * - NvSciSyncAttrValPrimitiveType_Syncpoint if \p device is a Tegra device. + * - NvSciSyncAttrValPrimitiveType_SysmemSemaphorePayload64b if \p device is GA10X+. + * NvSciSyncAttrKey_GpuId is set to the same UUID that is returned for this + * \p device from ::cuDeviceGetUuid. + * + * \param nvSciSyncAttrList - Return NvSciSync attributes supported. + * \param dev - Valid Cuda Device to get NvSciSync attributes for. + * \param flags - flags describing NvSciSync usage. + * + * \return + * + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa + * ::cuImportExternalSemaphore, + * ::cuDestroyExternalSemaphore, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync + */ +CUresult CUDAAPI cuDeviceGetNvSciSyncAttributes(void *nvSciSyncAttrList, CUdevice dev, int flags); + +/** + * \brief Sets the current memory pool of a device + * + * The memory pool must be local to the specified device. + * ::cuMemAllocAsync allocates from the current mempool of the provided stream's device. + * By default, a device's current memory pool is its default memory pool. + * + * \note Use ::cuMemAllocFromPoolAsync to specify asynchronous allocations from a device different + * than the one the stream runs on. + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuDeviceGetDefaultMemPool, ::cuDeviceGetMemPool, ::cuMemPoolCreate, ::cuMemPoolDestroy, ::cuMemAllocFromPoolAsync + */ +CUresult CUDAAPI cuDeviceSetMemPool(CUdevice dev, CUmemoryPool pool); + +/** + * \brief Gets the current mempool for a device + * + * Returns the last pool provided to ::cuDeviceSetMemPool for this device + * or the device's default memory pool if ::cuDeviceSetMemPool has never been called. + * By default the current mempool is the default mempool for a device. + * Otherwise the returned pool must have been set with ::cuDeviceSetMemPool. + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuDeviceGetDefaultMemPool, ::cuMemPoolCreate, ::cuDeviceSetMemPool + */ +CUresult CUDAAPI cuDeviceGetMemPool(CUmemoryPool *pool, CUdevice dev); + +/** + * \brief Returns the default mempool of a device + * + * The default mempool of a device contains device memory from that device. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \notefnerr + * + * \sa ::cuMemAllocAsync, ::cuMemPoolTrimTo, ::cuMemPoolGetAttribute, ::cuMemPoolSetAttribute, cuMemPoolSetAccess, ::cuDeviceGetMemPool, ::cuMemPoolCreate + */ +CUresult CUDAAPI cuDeviceGetDefaultMemPool(CUmemoryPool *pool_out, CUdevice dev); + +/** + * \brief Returns information about the execution affinity support of the device. + * + * Returns in \p *pi whether execution affinity type \p type is supported by device \p dev. + * The supported types are: + * - ::CU_EXEC_AFFINITY_TYPE_SM_COUNT: 1 if context with limited SMs is supported by the device, + * or 0 if not; + * + * \param pi - 1 if the execution affinity type \p type is supported by the device, or 0 if not + * \param type - Execution affinity type to query + * \param dev - Device handle + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetAttribute, + * ::cuDeviceGetCount, + * ::cuDeviceGetName, + * ::cuDeviceGetUuid, + * ::cuDeviceGet, + * ::cuDeviceTotalMem + */ +CUresult CUDAAPI cuDeviceGetExecAffinitySupport(int *pi, CUexecAffinityType type, CUdevice dev); + +/** + * \brief Blocks until remote writes are visible to the specified scope + * + * Blocks until GPUDirect RDMA writes to the target context via mappings + * created through APIs like nvidia_p2p_get_pages (see + * https://docs.nvidia.com/cuda/gpudirect-rdma for more information), are + * visible to the specified scope. + * + * If the scope equals or lies within the scope indicated by + * ::CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING, the call + * will be a no-op and can be safely omitted for performance. This can be + * determined by comparing the numerical values between the two enums, with + * smaller scopes having smaller values. + * + * Users may query support for this API via + * ::CU_DEVICE_ATTRIBUTE_FLUSH_FLUSH_GPU_DIRECT_RDMA_OPTIONS. + * + * \param target - The target of the operation, see ::CUflushGPUDirectRDMAWritesTarget + * \param scope - The scope of the operation, see ::CUflushGPUDirectRDMAWritesScope + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * + */ +CUresult CUDAAPI cuFlushGPUDirectRDMAWrites(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope); + +/** @} */ /* END CUDA_DEVICE */ + +/** + * \defgroup CUDA_DEVICE_DEPRECATED Device Management [DEPRECATED] + * + * ___MANBRIEF___ deprecated device management functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the device management functions of the low-level + * CUDA driver application programming interface. + * + * @{ + */ + +/** + * \brief Returns properties for a selected device + * + * \deprecated + * + * This function was deprecated as of CUDA 5.0 and replaced by ::cuDeviceGetAttribute(). + * + * Returns in \p *prop the properties of device \p dev. The ::CUdevprop + * structure is defined as: + * + * \code + typedef struct CUdevprop_st { + int maxThreadsPerBlock; + int maxThreadsDim[3]; + int maxGridSize[3]; + int sharedMemPerBlock; + int totalConstantMemory; + int SIMDWidth; + int memPitch; + int regsPerBlock; + int clockRate; + int textureAlign + } CUdevprop; + * \endcode + * where: + * + * - ::maxThreadsPerBlock is the maximum number of threads per block; + * - ::maxThreadsDim[3] is the maximum sizes of each dimension of a block; + * - ::maxGridSize[3] is the maximum sizes of each dimension of a grid; + * - ::sharedMemPerBlock is the total amount of shared memory available per + * block in bytes; + * - ::totalConstantMemory is the total amount of constant memory available on + * the device in bytes; + * - ::SIMDWidth is the warp size; + * - ::memPitch is the maximum pitch allowed by the memory copy functions that + * involve memory regions allocated through ::cuMemAllocPitch(); + * - ::regsPerBlock is the total number of registers available per block; + * - ::clockRate is the clock frequency in kilohertz; + * - ::textureAlign is the alignment requirement; texture base addresses that + * are aligned to ::textureAlign bytes do not need an offset applied to + * texture fetches. + * + * \param prop - Returned properties of device + * \param dev - Device to get properties for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetAttribute, + * ::cuDeviceGetCount, + * ::cuDeviceGetName, + * ::cuDeviceGetUuid, + * ::cuDeviceGet, + * ::cuDeviceTotalMem + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuDeviceGetProperties(CUdevprop *prop, CUdevice dev); + +/** + * \brief Returns the compute capability of the device + * + * \deprecated + * + * This function was deprecated as of CUDA 5.0 and its functionality superseded + * by ::cuDeviceGetAttribute(). + * + * Returns in \p *major and \p *minor the major and minor revision numbers that + * define the compute capability of the device \p dev. + * + * \param major - Major revision number + * \param minor - Minor revision number + * \param dev - Device handle + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGetAttribute, + * ::cuDeviceGetCount, + * ::cuDeviceGetName, + * ::cuDeviceGetUuid, + * ::cuDeviceGet, + * ::cuDeviceTotalMem + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuDeviceComputeCapability(int *major, int *minor, CUdevice dev); + +/** @} */ /* END CUDA_DEVICE_DEPRECATED */ + +/** + * \defgroup CUDA_PRIMARY_CTX Primary Context Management + * + * ___MANBRIEF___ primary context management functions of the low-level CUDA driver + * API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the primary context management functions of the low-level + * CUDA driver application programming interface. + * + * The primary context is unique per device and shared with the CUDA runtime API. + * These functions allow integration with other libraries using CUDA. + * + * @{ + */ + +/** + * \brief Retain the primary context on the GPU + * + * Retains the primary context on the device. + * Once the user successfully retains the primary context, the primary context + * will be active and available to the user until the user releases it + * with ::cuDevicePrimaryCtxRelease() or resets it with ::cuDevicePrimaryCtxReset(). + * Unlike ::cuCtxCreate() the newly retained context is not pushed onto the stack. + * + * Retaining the primary context for the first time will fail with ::CUDA_ERROR_UNKNOWN + * if the compute mode of the device is ::CU_COMPUTEMODE_PROHIBITED. The function + * ::cuDeviceGetAttribute() can be used with ::CU_DEVICE_ATTRIBUTE_COMPUTE_MODE to + * determine the compute mode of the device. + * The nvidia-smi tool can be used to set the compute mode for + * devices. Documentation for nvidia-smi can be obtained by passing a + * -h option to it. + * + * Please note that the primary context always supports pinned allocations. Other + * flags can be specified by ::cuDevicePrimaryCtxSetFlags(). + * + * \param pctx - Returned context handle of the new context + * \param dev - Device for which primary context is requested + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuDevicePrimaryCtxRelease, + * ::cuDevicePrimaryCtxSetFlags, + * ::cuCtxCreate, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize + */ +CUresult CUDAAPI cuDevicePrimaryCtxRetain(CUcontext *pctx, CUdevice dev); + +/** + * \brief Release the primary context on the GPU + * + * Releases the primary context interop on the device. + * A retained context should always be released once the user is done using + * it. The context is automatically reset once the last reference to it is + * released. This behavior is different when the primary context was retained + * by the CUDA runtime from CUDA 4.0 and earlier. In this case, the primary + * context remains always active. + * + * Releasing a primary context that has not been previously retained will + * fail with ::CUDA_ERROR_INVALID_CONTEXT. + * + * Please note that unlike ::cuCtxDestroy() this method does not pop the context + * from stack in any circumstances. + * + * \param dev - Device which primary context is released + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa ::cuDevicePrimaryCtxRetain, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize + */ +CUresult CUDAAPI cuDevicePrimaryCtxRelease(CUdevice dev); + +/** + * \brief Set flags for the primary context + * + * Sets the flags for the primary context on the device overwriting perviously + * set ones. + * + * The three LSBs of the \p flags parameter can be used to control how the OS + * thread, which owns the CUDA context at the time of an API call, interacts + * with the OS scheduler when waiting for results from the GPU. Only one of + * the scheduling flags can be set when creating a context. + * + * - ::CU_CTX_SCHED_SPIN: Instruct CUDA to actively spin when waiting for + * results from the GPU. This can decrease latency when waiting for the GPU, + * but may lower the performance of CPU threads if they are performing work in + * parallel with the CUDA thread. + * + * - ::CU_CTX_SCHED_YIELD: Instruct CUDA to yield its thread when waiting for + * results from the GPU. This can increase latency when waiting for the GPU, + * but can increase the performance of CPU threads performing work in parallel + * with the GPU. + * + * - ::CU_CTX_SCHED_BLOCKING_SYNC: Instruct CUDA to block the CPU thread on a + * synchronization primitive when waiting for the GPU to finish work. + * + * - ::CU_CTX_BLOCKING_SYNC: Instruct CUDA to block the CPU thread on a + * synchronization primitive when waiting for the GPU to finish work.
+ * Deprecated: This flag was deprecated as of CUDA 4.0 and was + * replaced with ::CU_CTX_SCHED_BLOCKING_SYNC. + * + * - ::CU_CTX_SCHED_AUTO: The default value if the \p flags parameter is zero, + * uses a heuristic based on the number of active CUDA contexts in the + * process \e C and the number of logical processors in the system \e P. If + * \e C > \e P, then CUDA will yield to other OS threads when waiting for + * the GPU (::CU_CTX_SCHED_YIELD), otherwise CUDA will not yield while + * waiting for results and actively spin on the processor (::CU_CTX_SCHED_SPIN). + * Additionally, on Tegra devices, ::CU_CTX_SCHED_AUTO uses a heuristic based on + * the power profile of the platform and may choose ::CU_CTX_SCHED_BLOCKING_SYNC + * for low-powered devices. + * + * - ::CU_CTX_LMEM_RESIZE_TO_MAX: Instruct CUDA to not reduce local memory + * after resizing local memory for a kernel. This can prevent thrashing by + * local memory allocations when launching many kernels with high local + * memory usage at the cost of potentially increased memory usage.
+ * Deprecated: This flag is deprecated and the behavior enabled + * by this flag is now the default and cannot be disabled. + * + * - ::CU_CTX_COREDUMP_ENABLE: If GPU coredumps have not been enabled globally + * with ::cuCoredumpSetAttributeGlobal or environment variables, this flag can + * be set during context creation to instruct CUDA to create a coredump if + * this context raises an exception during execution. These environment variables + * are described in the CUDA-GDB user guide under the "GPU core dump support" + * section. + * The initial settings will be taken from the global settings at the time of + * context creation. The other settings that control coredump output can be + * modified by calling ::cuCoredumpSetAttribute from the created context after + * it becomes current. + * + * - ::CU_CTX_USER_COREDUMP_ENABLE: If user-triggered GPU coredumps have not + * been enabled globally with ::cuCoredumpSetAttributeGlobal or environment + * variables, this flag can be set during context creation to instruct CUDA to + * create a coredump if data is written to a certain pipe that is present in the + * OS space. These environment variables are described in the CUDA-GDB user + * guide under the "GPU core dump support" section. + * It is important to note that the pipe name *must* be set with + * ::cuCoredumpSetAttributeGlobal before creating the context if this flag is + * used. Setting this flag implies that ::CU_CTX_COREDUMP_ENABLE is set. + * The initial settings will be taken from the global settings at the time of + * context creation. The other settings that control coredump output can be + * modified by calling ::cuCoredumpSetAttribute from the created context after + * it becomes current. + * + * - ::CU_CTX_SYNC_MEMOPS: Ensures that synchronous memory operations initiated + * on this context will always synchronize. See further documentation in the + * section titled "API Synchronization behavior" to learn more about cases when + * synchronous memory operations can exhibit asynchronous behavior. + * + * \param dev - Device for which the primary context flags are set + * \param flags - New flags for the device + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * + * \sa ::cuDevicePrimaryCtxRetain, + * ::cuDevicePrimaryCtxGetState, + * ::cuCtxCreate, + * ::cuCtxGetFlags, + * ::cuCtxSetFlags, + * ::cudaSetDeviceFlags + */ +CUresult CUDAAPI cuDevicePrimaryCtxSetFlags(CUdevice dev, unsigned int flags); + +/** + * \brief Get the state of the primary context + * + * Returns in \p *flags the flags for the primary context of \p dev, and in + * \p *active whether it is active. See ::cuDevicePrimaryCtxSetFlags for flag + * values. + * + * \param dev - Device to get primary context flags for + * \param flags - Pointer to store flags + * \param active - Pointer to store context state; 0 = inactive, 1 = active + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * + * \sa + * ::cuDevicePrimaryCtxSetFlags, + * ::cuCtxGetFlags, + * ::cuCtxSetFlags, + * ::cudaGetDeviceFlags + */ +CUresult CUDAAPI cuDevicePrimaryCtxGetState(CUdevice dev, unsigned int *flags, int *active); + +/** + * \brief Destroy all allocations and reset all state on the primary context + * + * Explicitly destroys and cleans up all resources associated with the current + * device in the current process. + * + * Note that it is responsibility of the calling function to ensure that no + * other module in the process is using the device any more. For that reason + * it is recommended to use ::cuDevicePrimaryCtxRelease() in most cases. + * However it is safe for other modules to call ::cuDevicePrimaryCtxRelease() + * even after resetting the device. + * Resetting the primary context does not release it, an application that has + * retained the primary context should explicitly release its usage. + * + * \param dev - Device for which primary context is destroyed + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE + * \notefnerr + * + * \sa ::cuDevicePrimaryCtxRetain, + * ::cuDevicePrimaryCtxRelease, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize, + * ::cudaDeviceReset + */ +CUresult CUDAAPI cuDevicePrimaryCtxReset(CUdevice dev); + +/** @} */ /* END CUDA_PRIMARY_CTX */ + +/** + * \defgroup CUDA_CTX Context Management + * + * ___MANBRIEF___ context management functions of the low-level CUDA driver + * API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the context management functions of the low-level + * CUDA driver application programming interface. + * + * Please note that some functions are described in + * \ref CUDA_PRIMARY_CTX "Primary Context Management" section. + * + * @{ + */ + +/** + * \brief Create a CUDA context + * + * \note In most cases it is recommended to use ::cuDevicePrimaryCtxRetain. + * + * Creates a new CUDA context and associates it with the calling thread. The + * \p flags parameter is described below. The context is created with a usage + * count of 1 and the caller of ::cuCtxCreate() must call ::cuCtxDestroy() + * when done using the context. If a context is already current to the thread, + * it is supplanted by the newly created context and may be restored by a subsequent + * call to ::cuCtxPopCurrent(). + * + * The three LSBs of the \p flags parameter can be used to control how the OS + * thread, which owns the CUDA context at the time of an API call, interacts + * with the OS scheduler when waiting for results from the GPU. Only one of + * the scheduling flags can be set when creating a context. + * + * - ::CU_CTX_SCHED_SPIN: Instruct CUDA to actively spin when waiting for + * results from the GPU. This can decrease latency when waiting for the GPU, + * but may lower the performance of CPU threads if they are performing work in + * parallel with the CUDA thread. + * + * - ::CU_CTX_SCHED_YIELD: Instruct CUDA to yield its thread when waiting for + * results from the GPU. This can increase latency when waiting for the GPU, + * but can increase the performance of CPU threads performing work in parallel + * with the GPU. + * + * - ::CU_CTX_SCHED_BLOCKING_SYNC: Instruct CUDA to block the CPU thread on a + * synchronization primitive when waiting for the GPU to finish work. + * + * - ::CU_CTX_BLOCKING_SYNC: Instruct CUDA to block the CPU thread on a + * synchronization primitive when waiting for the GPU to finish work.
+ * Deprecated: This flag was deprecated as of CUDA 4.0 and was + * replaced with ::CU_CTX_SCHED_BLOCKING_SYNC. + * + * - ::CU_CTX_SCHED_AUTO: The default value if the \p flags parameter is zero, + * uses a heuristic based on the number of active CUDA contexts in the + * process \e C and the number of logical processors in the system \e P. If + * \e C > \e P, then CUDA will yield to other OS threads when waiting for + * the GPU (::CU_CTX_SCHED_YIELD), otherwise CUDA will not yield while + * waiting for results and actively spin on the processor (::CU_CTX_SCHED_SPIN). + * Additionally, on Tegra devices, ::CU_CTX_SCHED_AUTO uses a heuristic based on + * the power profile of the platform and may choose ::CU_CTX_SCHED_BLOCKING_SYNC + * for low-powered devices. + * + * - ::CU_CTX_MAP_HOST: Instruct CUDA to support mapped pinned allocations. + * This flag must be set in order to allocate pinned host memory that is + * accessible to the GPU. + * + * - ::CU_CTX_LMEM_RESIZE_TO_MAX: Instruct CUDA to not reduce local memory + * after resizing local memory for a kernel. This can prevent thrashing by + * local memory allocations when launching many kernels with high local + * memory usage at the cost of potentially increased memory usage.
+ * Deprecated: This flag is deprecated and the behavior enabled + * by this flag is now the default and cannot be disabled. + * Instead, the per-thread stack size can be controlled with ::cuCtxSetLimit(). + * + * - ::CU_CTX_COREDUMP_ENABLE: If GPU coredumps have not been enabled globally + * with ::cuCoredumpSetAttributeGlobal or environment variables, this flag can + * be set during context creation to instruct CUDA to create a coredump if + * this context raises an exception during execution. These environment variables + * are described in the CUDA-GDB user guide under the "GPU core dump support" + * section. + * The initial attributes will be taken from the global attributes at the time of + * context creation. The other attributes that control coredump output can be + * modified by calling ::cuCoredumpSetAttribute from the created context after + * it becomes current. + * + * - ::CU_CTX_USER_COREDUMP_ENABLE: If user-triggered GPU coredumps have not + * been enabled globally with ::cuCoredumpSetAttributeGlobal or environment + * variables, this flag can be set during context creation to instruct CUDA to + * create a coredump if data is written to a certain pipe that is present in the + * OS space. These environment variables are described in the CUDA-GDB user + * guide under the "GPU core dump support" section. + * It is important to note that the pipe name *must* be set with + * ::cuCoredumpSetAttributeGlobal before creating the context if this flag is + * used. Setting this flag implies that ::CU_CTX_COREDUMP_ENABLE is set. + * The initial attributes will be taken from the global attributes at the time of + * context creation. The other attributes that control coredump output can be + * modified by calling ::cuCoredumpSetAttribute from the created context after + * it becomes current. + * Setting this flag on any context creation is equivalent to setting the + * ::CU_COREDUMP_ENABLE_USER_TRIGGER attribute to \p true globally. + * + * - ::CU_CTX_SYNC_MEMOPS: Ensures that synchronous memory operations initiated + * on this context will always synchronize. See further documentation in the + * section titled "API Synchronization behavior" to learn more about cases when + * synchronous memory operations can exhibit asynchronous behavior. + * + * Context creation will fail with ::CUDA_ERROR_UNKNOWN if the compute mode of + * the device is ::CU_COMPUTEMODE_PROHIBITED. The function ::cuDeviceGetAttribute() + * can be used with ::CU_DEVICE_ATTRIBUTE_COMPUTE_MODE to determine the + * compute mode of the device. The nvidia-smi tool can be used to set + * the compute mode for * devices. + * Documentation for nvidia-smi can be obtained by passing a + * -h option to it. + * + * \param pctx - Returned context handle of the new context + * \param flags - Context creation flags + * \param dev - Device to create context on + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCoredumpSetAttributeGlobal, + * ::cuCoredumpSetAttribute, + * ::cuCtxSynchronize + */ +CUresult CUDAAPI cuCtxCreate(CUcontext *pctx, unsigned int flags, CUdevice dev); + +/** + * \brief Create a CUDA context with execution affinity + * + * Creates a new CUDA context with execution affinity and associates it with + * the calling thread. The \p paramsArray and \p flags parameter are described below. + * The context is created with a usage count of 1 and the caller of ::cuCtxCreate() must + * call ::cuCtxDestroy() when done using the context. If a context is already + * current to the thread, it is supplanted by the newly created context and may + * be restored by a subsequent call to ::cuCtxPopCurrent(). + * + * The type and the amount of execution resource the context can use is limited by \p paramsArray + * and \p numParams. The \p paramsArray is an array of \p CUexecAffinityParam and the \p numParams + * describes the size of the array. If two \p CUexecAffinityParam in the array have the same type, + * the latter execution affinity parameter overrides the former execution affinity parameter. + * The supported execution affinity types are: + * - ::CU_EXEC_AFFINITY_TYPE_SM_COUNT limits the portion of SMs that the context can use. The portion + * of SMs is specified as the number of SMs via \p CUexecAffinitySmCount. This limit will be internally + * rounded up to the next hardware-supported amount. Hence, it is imperative to query the actual execution + * affinity of the context via \p cuCtxGetExecAffinity after context creation. Currently, this attribute + * is only supported under Volta+ MPS. + * + * The three LSBs of the \p flags parameter can be used to control how the OS + * thread, which owns the CUDA context at the time of an API call, interacts + * with the OS scheduler when waiting for results from the GPU. Only one of + * the scheduling flags can be set when creating a context. + * + * - ::CU_CTX_SCHED_SPIN: Instruct CUDA to actively spin when waiting for + * results from the GPU. This can decrease latency when waiting for the GPU, + * but may lower the performance of CPU threads if they are performing work in + * parallel with the CUDA thread. + * + * - ::CU_CTX_SCHED_YIELD: Instruct CUDA to yield its thread when waiting for + * results from the GPU. This can increase latency when waiting for the GPU, + * but can increase the performance of CPU threads performing work in parallel + * with the GPU. + * + * - ::CU_CTX_SCHED_BLOCKING_SYNC: Instruct CUDA to block the CPU thread on a + * synchronization primitive when waiting for the GPU to finish work. + * + * - ::CU_CTX_BLOCKING_SYNC: Instruct CUDA to block the CPU thread on a + * synchronization primitive when waiting for the GPU to finish work.
+ * Deprecated: This flag was deprecated as of CUDA 4.0 and was + * replaced with ::CU_CTX_SCHED_BLOCKING_SYNC. + * + * - ::CU_CTX_SCHED_AUTO: The default value if the \p flags parameter is zero, + * uses a heuristic based on the number of active CUDA contexts in the + * process \e C and the number of logical processors in the system \e P. If + * \e C > \e P, then CUDA will yield to other OS threads when waiting for + * the GPU (::CU_CTX_SCHED_YIELD), otherwise CUDA will not yield while + * waiting for results and actively spin on the processor (::CU_CTX_SCHED_SPIN). + * Additionally, on Tegra devices, ::CU_CTX_SCHED_AUTO uses a heuristic based on + * the power profile of the platform and may choose ::CU_CTX_SCHED_BLOCKING_SYNC + * for low-powered devices. + * + * - ::CU_CTX_MAP_HOST: Instruct CUDA to support mapped pinned allocations. + * This flag must be set in order to allocate pinned host memory that is + * accessible to the GPU. + * + * - ::CU_CTX_LMEM_RESIZE_TO_MAX: Instruct CUDA to not reduce local memory + * after resizing local memory for a kernel. This can prevent thrashing by + * local memory allocations when launching many kernels with high local + * memory usage at the cost of potentially increased memory usage.
+ * Deprecated: This flag is deprecated and the behavior enabled + * by this flag is now the default and cannot be disabled. + * Instead, the per-thread stack size can be controlled with ::cuCtxSetLimit(). + * + * - ::CU_CTX_COREDUMP_ENABLE: If GPU coredumps have not been enabled globally + * with ::cuCoredumpSetAttributeGlobal or environment variables, this flag can + * be set during context creation to instruct CUDA to create a coredump if + * this context raises an exception during execution. These environment variables + * are described in the CUDA-GDB user guide under the "GPU core dump support" + * section. + * The initial attributes will be taken from the global attributes at the time of + * context creation. The other attributes that control coredump output can be + * modified by calling ::cuCoredumpSetAttribute from the created context after + * it becomes current. + * + * - ::CU_CTX_USER_COREDUMP_ENABLE: If user-triggered GPU coredumps have not + * been enabled globally with ::cuCoredumpSetAttributeGlobal or environment + * variables, this flag can be set during context creation to instruct CUDA to + * create a coredump if data is written to a certain pipe that is present in the + * OS space. These environment variables are described in the CUDA-GDB user + * guide under the "GPU core dump support" section. + * It is important to note that the pipe name *must* be set with + * ::cuCoredumpSetAttributeGlobal before creating the context if this flag is + * used. Setting this flag implies that ::CU_CTX_COREDUMP_ENABLE is set. + * The initial attributes will be taken from the global attributes at the time of + * context creation. The other attributes that control coredump output can be + * modified by calling ::cuCoredumpSetAttribute from the created context after + * it becomes current. + * Setting this flag on any context creation is equivalent to setting the + * ::CU_COREDUMP_ENABLE_USER_TRIGGER attribute to \p true globally. + * + * Context creation will fail with ::CUDA_ERROR_UNKNOWN if the compute mode of + * the device is ::CU_COMPUTEMODE_PROHIBITED. The function ::cuDeviceGetAttribute() + * can be used with ::CU_DEVICE_ATTRIBUTE_COMPUTE_MODE to determine the + * compute mode of the device. The nvidia-smi tool can be used to set + * the compute mode for * devices. + * Documentation for nvidia-smi can be obtained by passing a + * -h option to it. + * + * \param pctx - Returned context handle of the new context + * \param paramsArray - Execution affinity parameters + * \param numParams - Number of execution affinity parameters + * \param flags - Context creation flags + * \param dev - Device to create context on + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize, + * ::cuCoredumpSetAttributeGlobal, + * ::cuCoredumpSetAttribute, + * ::CUexecAffinityParam + */ +CUresult CUDAAPI cuCtxCreate_v3(CUcontext *pctx, CUexecAffinityParam *paramsArray, int numParams, unsigned int flags, CUdevice dev); + +/** + * \brief Destroy a CUDA context + * + * Destroys the CUDA context specified by \p ctx. The context \p ctx will be + * destroyed regardless of how many threads it is current to. + * It is the responsibility of the calling function to ensure that no API + * call issues using \p ctx while ::cuCtxDestroy() is executing. + * + * Destroys and cleans up all resources associated with the context. + * It is the caller's responsibility to ensure that the context or its resources + * are not accessed or passed in subsequent API calls and doing so will result in undefined behavior. + * These resources include CUDA types such as ::CUmodule, ::CUfunction, ::CUstream, ::CUevent, + * ::CUarray, ::CUmipmappedArray, ::CUtexObject, ::CUsurfObject, ::CUtexref, ::CUsurfref, + * ::CUgraphicsResource, ::CUlinkState, ::CUexternalMemory and ::CUexternalSemaphore. + * + * If \p ctx is current to the calling thread then \p ctx will also be + * popped from the current thread's context stack (as though ::cuCtxPopCurrent() + * were called). If \p ctx is current to other threads, then \p ctx will + * remain current to those threads, and attempting to access \p ctx from + * those threads will result in the error ::CUDA_ERROR_CONTEXT_IS_DESTROYED. + * + * \param ctx - Context to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize + */ +CUresult CUDAAPI cuCtxDestroy(CUcontext ctx); + +/** + * \brief Pushes a context on the current CPU thread + * + * Pushes the given context \p ctx onto the CPU thread's stack of current + * contexts. The specified context becomes the CPU thread's current context, so + * all CUDA functions that operate on the current context are affected. + * + * The previous current context may be made current again by calling + * ::cuCtxDestroy() or ::cuCtxPopCurrent(). + * + * \param ctx - Context to push + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize + */ +CUresult CUDAAPI cuCtxPushCurrent(CUcontext ctx); + +/** + * \brief Pops the current CUDA context from the current CPU thread. + * + * Pops the current CUDA context from the CPU thread and passes back the + * old context handle in \p *pctx. That context may then be made current + * to a different CPU thread by calling ::cuCtxPushCurrent(). + * + * If a context was current to the CPU thread before ::cuCtxCreate() or + * ::cuCtxPushCurrent() was called, this function makes that context current to + * the CPU thread again. + * + * \param pctx - Returned popped context handle + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize + */ +CUresult CUDAAPI cuCtxPopCurrent(CUcontext *pctx); + +/** + * \brief Binds the specified CUDA context to the calling CPU thread + * + * Binds the specified CUDA context to the calling CPU thread. + * If \p ctx is NULL then the CUDA context previously bound to the + * calling CPU thread is unbound and ::CUDA_SUCCESS is returned. + * + * If there exists a CUDA context stack on the calling CPU thread, this + * will replace the top of that stack with \p ctx. + * If \p ctx is NULL then this will be equivalent to popping the top + * of the calling CPU thread's CUDA context stack (or a no-op if the + * calling CPU thread's CUDA context stack is empty). + * + * \param ctx - Context to bind to the calling CPU thread + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa + * ::cuCtxGetCurrent, + * ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cudaSetDevice + */ +CUresult CUDAAPI cuCtxSetCurrent(CUcontext ctx); + +/** + * \brief Returns the CUDA context bound to the calling CPU thread. + * + * Returns in \p *pctx the CUDA context bound to the calling CPU thread. + * If no context is bound to the calling CPU thread then \p *pctx is + * set to NULL and ::CUDA_SUCCESS is returned. + * + * \param pctx - Returned context handle + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * \notefnerr + * + * \sa + * ::cuCtxSetCurrent, + * ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cudaGetDevice + */ +CUresult CUDAAPI cuCtxGetCurrent(CUcontext *pctx); + +/** + * \brief Returns the device ID for the current context + * + * Returns in \p *device the ordinal of the current context's device. + * + * \param device - Returned device ID for the current context + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize, + * ::cudaGetDevice + */ +CUresult CUDAAPI cuCtxGetDevice(CUdevice *device); + +/** + * \brief Returns the flags for the current context + * + * Returns in \p *flags the flags of the current context. See ::cuCtxCreate + * for flag values. + * + * \param flags - Pointer to store flags of current context + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetCurrent, + * ::cuCtxGetDevice, + * ::cuCtxGetLimit, + * ::cuCtxGetSharedMemConfig, + * ::cuCtxGetStreamPriorityRange, + * ::cuCtxSetFlags, + * ::cudaGetDeviceFlags + */ +CUresult CUDAAPI cuCtxGetFlags(unsigned int *flags); + +/** + * \brief Sets the flags for the current context + * + * Sets the flags for the current context overwriting previously set ones. See + * ::cuDevicePrimaryCtxSetFlags for flag values. + * + * \param flags - Flags to set on the current context + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetCurrent, + * ::cuCtxGetDevice, + * ::cuCtxGetLimit, + * ::cuCtxGetSharedMemConfig, + * ::cuCtxGetStreamPriorityRange, + * ::cuCtxGetFlags, + * ::cudaGetDeviceFlags, + * ::cuDevicePrimaryCtxSetFlags, + */ +CUresult CUDAAPI cuCtxSetFlags(unsigned int flags); + +/** + * \brief Returns the unique Id associated with the context supplied + * + * Returns in \p ctxId the unique Id which is associated with a given context. + * The Id is unique for the life of the program for this instance of CUDA. + * If context is supplied as NULL and there is one current, the Id of the + * current context is returned. + * + * \param ctx - Context for which to obtain the Id + * \param ctxId - Pointer to store the Id of the context + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_CONTEXT_IS_DESTROYED, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPushCurrent + */ +CUresult CUDAAPI cuCtxGetId(CUcontext ctx, unsigned long long *ctxId); + +/** + * \brief Block for a context's tasks to complete + * + * Blocks until the device has completed all preceding requested tasks. + * ::cuCtxSynchronize() returns an error if one of the preceding tasks failed. + * If the context was created with the ::CU_CTX_SCHED_BLOCKING_SYNC flag, the + * CPU thread will block until the GPU context has finished its work. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cudaDeviceSynchronize + */ +CUresult CUDAAPI cuCtxSynchronize(void); + +/** + * \brief Set resource limits + * + * Setting \p limit to \p value is a request by the application to update + * the current limit maintained by the context. The driver is free to + * modify the requested value to meet h/w requirements (this could be + * clamping to minimum or maximum values, rounding up to nearest element + * size, etc). The application can use ::cuCtxGetLimit() to find out exactly + * what the limit has been set to. + * + * Setting each ::CUlimit has its own specific restrictions, so each is + * discussed here. + * + * - ::CU_LIMIT_STACK_SIZE controls the stack size in bytes of each GPU thread. + * The driver automatically increases the per-thread stack size + * for each kernel launch as needed. This size isn't reset back to the + * original value after each launch. Setting this value will take effect + * immediately, and if necessary, the device will block until all preceding + * requested tasks are complete. + * + * - ::CU_LIMIT_PRINTF_FIFO_SIZE controls the size in bytes of the FIFO used + * by the ::printf() device system call. Setting ::CU_LIMIT_PRINTF_FIFO_SIZE + * must be performed before launching any kernel that uses the ::printf() + * device system call, otherwise ::CUDA_ERROR_INVALID_VALUE will be returned. + * + * - ::CU_LIMIT_MALLOC_HEAP_SIZE controls the size in bytes of the heap used + * by the ::malloc() and ::free() device system calls. Setting + * ::CU_LIMIT_MALLOC_HEAP_SIZE must be performed before launching any kernel + * that uses the ::malloc() or ::free() device system calls, otherwise + * ::CUDA_ERROR_INVALID_VALUE will be returned. + * + * - ::CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH controls the maximum nesting depth of + * a grid at which a thread can safely call ::cudaDeviceSynchronize(). Setting + * this limit must be performed before any launch of a kernel that uses the + * device runtime and calls ::cudaDeviceSynchronize() above the default sync + * depth, two levels of grids. Calls to ::cudaDeviceSynchronize() will fail + * with error code ::cudaErrorSyncDepthExceeded if the limitation is + * violated. This limit can be set smaller than the default or up the maximum + * launch depth of 24. When setting this limit, keep in mind that additional + * levels of sync depth require the driver to reserve large amounts of device + * memory which can no longer be used for user allocations. If these + * reservations of device memory fail, ::cuCtxSetLimit() will return + * ::CUDA_ERROR_OUT_OF_MEMORY, and the limit can be reset to a lower value. + * This limit is only applicable to devices of compute capability < 9.0. + * Attempting to set this limit on devices of other compute capability + * versions will result in the error ::CUDA_ERROR_UNSUPPORTED_LIMIT being + * returned. + * + * - ::CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT controls the maximum number of + * outstanding device runtime launches that can be made from the current + * context. A grid is outstanding from the point of launch up until the grid + * is known to have been completed. Device runtime launches which violate + * this limitation fail and return ::cudaErrorLaunchPendingCountExceeded when + * ::cudaGetLastError() is called after launch. If more pending launches than + * the default (2048 launches) are needed for a module using the device + * runtime, this limit can be increased. Keep in mind that being able to + * sustain additional pending launches will require the driver to reserve + * larger amounts of device memory upfront which can no longer be used for + * allocations. If these reservations fail, ::cuCtxSetLimit() will return + * ::CUDA_ERROR_OUT_OF_MEMORY, and the limit can be reset to a lower value. + * This limit is only applicable to devices of compute capability 3.5 and + * higher. Attempting to set this limit on devices of compute capability less + * than 3.5 will result in the error ::CUDA_ERROR_UNSUPPORTED_LIMIT being + * returned. + * + * - ::CU_LIMIT_MAX_L2_FETCH_GRANULARITY controls the L2 cache fetch granularity. + * Values can range from 0B to 128B. This is purely a performance hint and + * it can be ignored or clamped depending on the platform. + * + * - ::CU_LIMIT_PERSISTING_L2_CACHE_SIZE controls size in bytes available for + * persisting L2 cache. This is purely a performance hint and it can be + * ignored or clamped depending on the platform. + * + * \param limit - Limit to set + * \param value - Size of limit + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_UNSUPPORTED_LIMIT, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSynchronize, + * ::cudaDeviceSetLimit + */ +CUresult CUDAAPI cuCtxSetLimit(CUlimit limit, size_t value); + +/** + * \brief Returns resource limits + * + * Returns in \p *pvalue the current size of \p limit. The supported + * ::CUlimit values are: + * - ::CU_LIMIT_STACK_SIZE: stack size in bytes of each GPU thread. + * - ::CU_LIMIT_PRINTF_FIFO_SIZE: size in bytes of the FIFO used by the + * ::printf() device system call. + * - ::CU_LIMIT_MALLOC_HEAP_SIZE: size in bytes of the heap used by the + * ::malloc() and ::free() device system calls. + * - ::CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH: maximum grid depth at which a thread + * can issue the device runtime call ::cudaDeviceSynchronize() to wait on + * child grid launches to complete. + * - ::CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT: maximum number of outstanding + * device runtime launches that can be made from this context. + * - ::CU_LIMIT_MAX_L2_FETCH_GRANULARITY: L2 cache fetch granularity. + * - ::CU_LIMIT_PERSISTING_L2_CACHE_SIZE: Persisting L2 cache size in bytes + * + * \param limit - Limit to query + * \param pvalue - Returned size of limit + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_UNSUPPORTED_LIMIT + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize, + * ::cudaDeviceGetLimit + */ +CUresult CUDAAPI cuCtxGetLimit(size_t *pvalue, CUlimit limit); + +/** + * \brief Returns the preferred cache configuration for the current context. + * + * On devices where the L1 cache and shared memory use the same hardware + * resources, this function returns through \p pconfig the preferred cache configuration + * for the current context. This is only a preference. The driver will use + * the requested configuration if possible, but it is free to choose a different + * configuration if required to execute functions. + * + * This will return a \p pconfig of ::CU_FUNC_CACHE_PREFER_NONE on devices + * where the size of the L1 cache and shared memory are fixed. + * + * The supported cache configurations are: + * - ::CU_FUNC_CACHE_PREFER_NONE: no preference for shared memory or L1 (default) + * - ::CU_FUNC_CACHE_PREFER_SHARED: prefer larger shared memory and smaller L1 cache + * - ::CU_FUNC_CACHE_PREFER_L1: prefer larger L1 cache and smaller shared memory + * - ::CU_FUNC_CACHE_PREFER_EQUAL: prefer equal sized L1 cache and shared memory + * + * \param pconfig - Returned cache configuration + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize, + * ::cuFuncSetCacheConfig, + * ::cudaDeviceGetCacheConfig + */ +CUresult CUDAAPI cuCtxGetCacheConfig(CUfunc_cache *pconfig); + +/** + * \brief Sets the preferred cache configuration for the current context. + * + * On devices where the L1 cache and shared memory use the same hardware + * resources, this sets through \p config the preferred cache configuration for + * the current context. This is only a preference. The driver will use + * the requested configuration if possible, but it is free to choose a different + * configuration if required to execute the function. Any function preference + * set via ::cuFuncSetCacheConfig() or ::cuKernelSetCacheConfig() will be preferred over this context-wide + * setting. Setting the context-wide cache configuration to + * ::CU_FUNC_CACHE_PREFER_NONE will cause subsequent kernel launches to prefer + * to not change the cache configuration unless required to launch the kernel. + * + * This setting does nothing on devices where the size of the L1 cache and + * shared memory are fixed. + * + * Launching a kernel with a different preference than the most recent + * preference setting may insert a device-side synchronization point. + * + * The supported cache configurations are: + * - ::CU_FUNC_CACHE_PREFER_NONE: no preference for shared memory or L1 (default) + * - ::CU_FUNC_CACHE_PREFER_SHARED: prefer larger shared memory and smaller L1 cache + * - ::CU_FUNC_CACHE_PREFER_L1: prefer larger L1 cache and smaller shared memory + * - ::CU_FUNC_CACHE_PREFER_EQUAL: prefer equal sized L1 cache and shared memory + * + * \param config - Requested cache configuration + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize, + * ::cuFuncSetCacheConfig, + * ::cudaDeviceSetCacheConfig, + * ::cuKernelSetCacheConfig + */ +CUresult CUDAAPI cuCtxSetCacheConfig(CUfunc_cache config); + +/** + * \brief Gets the context's API version. + * + * Returns a version number in \p version corresponding to the capabilities of + * the context (e.g. 3010 or 3020), which library developers can use to direct + * callers to a specific API version. If \p ctx is NULL, returns the API version + * used to create the currently bound context. + * + * Note that new API versions are only introduced when context capabilities are + * changed that break binary compatibility, so the API version and driver version + * may be different. For example, it is valid for the API version to be 3020 while + * the driver version is 4020. + * + * \param ctx - Context to check + * \param version - Pointer to version + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize + */ +CUresult CUDAAPI cuCtxGetApiVersion(CUcontext ctx, unsigned int *version); + +/** + * \brief Returns numerical values that correspond to the least and + * greatest stream priorities. + * + * Returns in \p *leastPriority and \p *greatestPriority the numerical values that correspond + * to the least and greatest stream priorities respectively. Stream priorities + * follow a convention where lower numbers imply greater priorities. The range of + * meaningful stream priorities is given by [\p *greatestPriority, \p *leastPriority]. + * If the user attempts to create a stream with a priority value that is + * outside the meaningful range as specified by this API, the priority is + * automatically clamped down or up to either \p *leastPriority or \p *greatestPriority + * respectively. See ::cuStreamCreateWithPriority for details on creating a + * priority stream. + * A NULL may be passed in for \p *leastPriority or \p *greatestPriority if the value + * is not desired. + * + * This function will return '0' in both \p *leastPriority and \p *greatestPriority if + * the current context's device does not support stream priorities + * (see ::cuDeviceGetAttribute). + * + * \param leastPriority - Pointer to an int in which the numerical value for least + * stream priority is returned + * \param greatestPriority - Pointer to an int in which the numerical value for greatest + * stream priority is returned + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * + * \sa ::cuStreamCreateWithPriority, + * ::cuStreamGetPriority, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize, + * ::cudaDeviceGetStreamPriorityRange + */ +CUresult CUDAAPI cuCtxGetStreamPriorityRange(int *leastPriority, int *greatestPriority); + +/** + * \brief Resets all persisting lines in cache to normal status. + * + * ::cuCtxResetPersistingL2Cache Resets all persisting lines in cache to normal + * status. Takes effect on function return. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_SUPPORTED + * \notefnerr + * + * \sa + * ::CUaccessPolicyWindow + */ +CUresult CUDAAPI cuCtxResetPersistingL2Cache(void); + +/** + * \brief Returns the execution affinity setting for the current context. + * + * Returns in \p *pExecAffinity the current value of \p type. The supported + * ::CUexecAffinityType values are: + * - ::CU_EXEC_AFFINITY_TYPE_SM_COUNT: number of SMs the context is limited to use. + * + * \param type - Execution affinity type to query + * \param pExecAffinity - Returned execution affinity + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY + * \notefnerr + * + * \sa + * ::CUexecAffinityParam + */ +CUresult CUDAAPI cuCtxGetExecAffinity(CUexecAffinityParam *pExecAffinity, CUexecAffinityType type); + + +/** @} */ /* END CUDA_CTX */ + +/** + * \defgroup CUDA_CTX_DEPRECATED Context Management [DEPRECATED] + * + * ___MANBRIEF___ deprecated context management functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the deprecated context management functions of the low-level + * CUDA driver application programming interface. + * + * @{ + */ + +/** + * \brief Increment a context's usage-count + * + * \deprecated + * + * Note that this function is deprecated and should not be used. + * + * Increments the usage count of the context and passes back a context handle + * in \p *pctx that must be passed to ::cuCtxDetach() when the application is + * done with the context. ::cuCtxAttach() fails if there is no context current + * to the thread. + * + * Currently, the \p flags parameter must be 0. + * + * \param pctx - Returned context handle of the current context + * \param flags - Context attach flags (must be 0) + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxDetach, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuCtxAttach(CUcontext *pctx, unsigned int flags); + +/** + * \brief Decrement a context's usage-count + * + * \deprecated + * + * Note that this function is deprecated and should not be used. + * + * Decrements the usage count of the context \p ctx, and destroys the context + * if the usage count goes to 0. The context must be a handle that was passed + * back by ::cuCtxCreate() or ::cuCtxAttach(), and must be current to the + * calling thread. + * + * \param ctx - Context to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetCacheConfig, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuCtxDetach(CUcontext ctx); + + +/** + * \brief Returns the current shared memory configuration for the current context. + * + * \deprecated + * + * This function will return in \p pConfig the current size of shared memory banks + * in the current context. On devices with configurable shared memory banks, + * ::cuCtxSetSharedMemConfig can be used to change this setting, so that all + * subsequent kernel launches will by default use the new bank size. When + * ::cuCtxGetSharedMemConfig is called on devices without configurable shared + * memory, it will return the fixed bank size of the hardware. + * + * The returned bank configurations can be either: + * - ::CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE: shared memory bank width is + * four bytes. + * - ::CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE: shared memory bank width will + * eight bytes. + * + * \param pConfig - returned shared memory configuration + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize, + * ::cuCtxGetSharedMemConfig, + * ::cuFuncSetCacheConfig, + * ::cudaDeviceGetSharedMemConfig + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuCtxGetSharedMemConfig(CUsharedconfig *pConfig); + +/** + * \brief Sets the shared memory configuration for the current context. + * + * \deprecated + * + * On devices with configurable shared memory banks, this function will set + * the context's shared memory bank size which is used for subsequent kernel + * launches. + * + * Changed the shared memory configuration between launches may insert a device + * side synchronization point between those launches. + * + * Changing the shared memory bank size will not increase shared memory usage + * or affect occupancy of kernels, but may have major effects on performance. + * Larger bank sizes will allow for greater potential bandwidth to shared memory, + * but will change what kinds of accesses to shared memory will result in bank + * conflicts. + * + * This function will do nothing on devices with fixed shared memory bank size. + * + * The supported bank configurations are: + * - ::CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE: set bank width to the default initial + * setting (currently, four bytes). + * - ::CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE: set shared memory bank width to + * be natively four bytes. + * - ::CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE: set shared memory bank width to + * be natively eight bytes. + * + * \param config - requested shared memory configuration + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuCtxCreate, + * ::cuCtxDestroy, + * ::cuCtxGetApiVersion, + * ::cuCtxGetCacheConfig, + * ::cuCtxGetDevice, + * ::cuCtxGetFlags, + * ::cuCtxGetLimit, + * ::cuCtxPopCurrent, + * ::cuCtxPushCurrent, + * ::cuCtxSetLimit, + * ::cuCtxSynchronize, + * ::cuCtxGetSharedMemConfig, + * ::cuFuncSetCacheConfig, + * ::cudaDeviceSetSharedMemConfig + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuCtxSetSharedMemConfig(CUsharedconfig config); + +/** @} */ /* END CUDA_CTX_DEPRECATED */ + + +/** + * \defgroup CUDA_MODULE Module Management + * + * ___MANBRIEF___ module management functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the module management functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Loads a compute module + * + * Takes a filename \p fname and loads the corresponding module \p module into + * the current context. The CUDA driver API does not attempt to lazily + * allocate the resources needed by a module; if the memory for functions and + * data (constant and global) needed by the module cannot be allocated, + * ::cuModuleLoad() fails. The file should be a \e cubin file as output by + * \b nvcc, or a \e PTX file either as output by \b nvcc or handwritten, or + * a \e fatbin file as output by \b nvcc from toolchain 4.0 or later. + * + * \param module - Returned module + * \param fname - Filename of module to load + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_PTX, + * ::CUDA_ERROR_UNSUPPORTED_PTX_VERSION, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_FILE_NOT_FOUND, + * ::CUDA_ERROR_NO_BINARY_FOR_GPU, + * ::CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, + * ::CUDA_ERROR_JIT_COMPILER_NOT_FOUND + * \notefnerr + * + * \sa ::cuModuleGetFunction, + * ::cuModuleGetGlobal, + * ::cuModuleGetTexRef, + * ::cuModuleLoadData, + * ::cuModuleLoadDataEx, + * ::cuModuleLoadFatBinary, + * ::cuModuleUnload + */ +CUresult CUDAAPI cuModuleLoad(CUmodule *module, const char *fname); + +/** + * \brief Load a module's data + * + * Takes a pointer \p image and loads the corresponding module \p module into + * the current context. The \p image may be a \e cubin or \e fatbin + * as output by \b nvcc, or a NULL-terminated \e PTX, either as output by \b nvcc + * or hand-written. + * + * \param module - Returned module + * \param image - Module data to load + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_PTX, + * ::CUDA_ERROR_UNSUPPORTED_PTX_VERSION, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_NO_BINARY_FOR_GPU, + * ::CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, + * ::CUDA_ERROR_JIT_COMPILER_NOT_FOUND + * \notefnerr + * + * \sa ::cuModuleGetFunction, + * ::cuModuleGetGlobal, + * ::cuModuleGetTexRef, + * ::cuModuleLoad, + * ::cuModuleLoadDataEx, + * ::cuModuleLoadFatBinary, + * ::cuModuleUnload + */ +CUresult CUDAAPI cuModuleLoadData(CUmodule *module, const void *image); + +/** + * \brief Load a module's data with options + * + * Takes a pointer \p image and loads the corresponding module \p module into + * the current context. The \p image may be a \e cubin or \e fatbin + * as output by \b nvcc, or a NULL-terminated \e PTX, either as output by \b nvcc + * or hand-written. + * + * \param module - Returned module + * \param image - Module data to load + * \param numOptions - Number of options + * \param options - Options for JIT + * \param optionValues - Option values for JIT + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_PTX, + * ::CUDA_ERROR_UNSUPPORTED_PTX_VERSION, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_NO_BINARY_FOR_GPU, + * ::CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, + * ::CUDA_ERROR_JIT_COMPILER_NOT_FOUND + * \notefnerr + * + * \sa ::cuModuleGetFunction, + * ::cuModuleGetGlobal, + * ::cuModuleGetTexRef, + * ::cuModuleLoad, + * ::cuModuleLoadData, + * ::cuModuleLoadFatBinary, + * ::cuModuleUnload + */ +CUresult CUDAAPI cuModuleLoadDataEx(CUmodule *module, const void *image, unsigned int numOptions, CUjit_option *options, void **optionValues); + +/** + * \brief Load a module's data + * + * Takes a pointer \p fatCubin and loads the corresponding module \p module + * into the current context. The pointer represents a fat binary object, + * which is a collection of different \e cubin and/or \e PTX files, all + * representing the same device code, but compiled and optimized for different + * architectures. + * + * Prior to CUDA 4.0, there was no documented API for constructing and using + * fat binary objects by programmers. Starting with CUDA 4.0, fat binary + * objects can be constructed by providing the -fatbin option to \b nvcc. + * More information can be found in the \b nvcc document. + * + * \param module - Returned module + * \param fatCubin - Fat binary to load + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_PTX, + * ::CUDA_ERROR_UNSUPPORTED_PTX_VERSION, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_NO_BINARY_FOR_GPU, + * ::CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, + * ::CUDA_ERROR_JIT_COMPILER_NOT_FOUND + * \notefnerr + * + * \sa ::cuModuleGetFunction, + * ::cuModuleGetGlobal, + * ::cuModuleGetTexRef, + * ::cuModuleLoad, + * ::cuModuleLoadData, + * ::cuModuleLoadDataEx, + * ::cuModuleUnload + */ +CUresult CUDAAPI cuModuleLoadFatBinary(CUmodule *module, const void *fatCubin); + +/** + * \brief Unloads a module + * + * Unloads a module \p hmod from the current context. Attempting to unload + * a module which was obtained from the Library Management API such as + * ::cuLibraryGetModule will return ::CUDA_ERROR_NOT_PERMITTED. + * + * \param hmod - Module to unload + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_PERMITTED + * \notefnerr + * \note_destroy_ub + * + * \sa ::cuModuleGetFunction, + * ::cuModuleGetGlobal, + * ::cuModuleGetTexRef, + * ::cuModuleLoad, + * ::cuModuleLoadData, + * ::cuModuleLoadDataEx, + * ::cuModuleLoadFatBinary + */ +CUresult CUDAAPI cuModuleUnload(CUmodule hmod); + +/** + * CUDA Lazy Loading status + */ +typedef enum CUmoduleLoadingMode_enum { + CU_MODULE_EAGER_LOADING = 0x1, /**< Lazy Kernel Loading is not enabled */ + CU_MODULE_LAZY_LOADING = 0x2, /**< Lazy Kernel Loading is enabled */ +} CUmoduleLoadingMode; + +/** + * \brief Query lazy loading mode + * + * Returns lazy loading mode + * Module loading mode is controlled by CUDA_MODULE_LOADING env variable + * + * \param mode - Returns the lazy loading mode + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * + * \sa + * ::cuModuleLoad, + */ +CUresult CUDAAPI cuModuleGetLoadingMode(CUmoduleLoadingMode *mode); + +/** + * \brief Returns a function handle + * + * Returns in \p *hfunc the handle of the function of name \p name located in + * module \p hmod. If no function of that name exists, ::cuModuleGetFunction() + * returns ::CUDA_ERROR_NOT_FOUND. + * + * \param hfunc - Returned function handle + * \param hmod - Module to retrieve function from + * \param name - Name of function to retrieve + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND + * \notefnerr + * + * \sa ::cuModuleGetGlobal, + * ::cuModuleGetTexRef, + * ::cuModuleLoad, + * ::cuModuleLoadData, + * ::cuModuleLoadDataEx, + * ::cuModuleLoadFatBinary, + * ::cuModuleUnload + */ +CUresult CUDAAPI cuModuleGetFunction(CUfunction *hfunc, CUmodule hmod, const char *name); + +/** + * \brief Returns the number of functions within a module + * + * Returns in \p count the number of functions in \p mod. + * + * \param count - Number of functions found within the module + * \param mod - Module to query + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + */ +CUresult CUDAAPI cuModuleGetFunctionCount(unsigned int *count, CUmodule mod); + +/** + * \brief Returns the function handles within a module. + * + * Returns in \p functions a maximum number of \p numFunctions function handles within \p mod. When + * function loading mode is set to LAZY the function retrieved may be partially loaded. The loading + * state of a function can be queried using ::cuFunctionIsLoaded. CUDA APIs may load the function + * automatically when called with partially loaded function handle which may incur additional + * latency. Alternatively, ::cuFunctionLoad can be used to explicitly load a function. The returned + * function handles become invalid when the module is unloaded. + * + * \param functions - Buffer where the function handles are returned to + * \param numFunctions - Maximum number of function handles may be returned to the buffer + * \param mod - Module to query from + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuModuleGetFunction, + * ::cuModuleGetFunctionCount, + * ::cuFuncIsLoaded, + * ::cuFuncLoad + */ +CUresult CUDAAPI cuModuleEnumerateFunctions(CUfunction *functions, unsigned int numFunctions, CUmodule mod); + +/** + * \brief Returns a global pointer from a module + * + * Returns in \p *dptr and \p *bytes the base pointer and size of the + * global of name \p name located in module \p hmod. If no variable of that name + * exists, ::cuModuleGetGlobal() returns ::CUDA_ERROR_NOT_FOUND. + * One of the parameters \p dptr or \p bytes (not both) can be NULL in which + * case it is ignored. + * + * \param dptr - Returned global device pointer + * \param bytes - Returned global size in bytes + * \param hmod - Module to retrieve global from + * \param name - Name of global to retrieve + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND + * \notefnerr + * + * \sa ::cuModuleGetFunction, + * ::cuModuleGetTexRef, + * ::cuModuleLoad, + * ::cuModuleLoadData, + * ::cuModuleLoadDataEx, + * ::cuModuleLoadFatBinary, + * ::cuModuleUnload, + * ::cudaGetSymbolAddress, + * ::cudaGetSymbolSize + */ +CUresult CUDAAPI cuModuleGetGlobal(CUdeviceptr *dptr, size_t *bytes, CUmodule hmod, const char *name); + +/** + * \brief Creates a pending JIT linker invocation. + * + * If the call is successful, the caller owns the returned CUlinkState, which + * should eventually be destroyed with ::cuLinkDestroy. The + * device code machine size (32 or 64 bit) will match the calling application. + * + * Both linker and compiler options may be specified. Compiler options will + * be applied to inputs to this linker action which must be compiled from PTX. + * The options ::CU_JIT_WALL_TIME, + * ::CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, and ::CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES + * will accumulate data until the CUlinkState is destroyed. + * + * \p optionValues must remain valid for the life of the CUlinkState if output + * options are used. No other references to inputs are maintained after this + * call returns. + * + * \note For LTO-IR input, only LTO-IR compiled with toolkits prior to CUDA 12.0 will be accepted + * + * \param numOptions Size of options arrays + * \param options Array of linker and compiler options + * \param optionValues Array of option values, each cast to void * + * \param stateOut On success, this will contain a CUlinkState to specify + * and complete this action + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_JIT_COMPILER_NOT_FOUND + * \notefnerr + * + * \sa ::cuLinkAddData, + * ::cuLinkAddFile, + * ::cuLinkComplete, + * ::cuLinkDestroy + */ +CUresult CUDAAPI +cuLinkCreate(unsigned int numOptions, CUjit_option *options, void **optionValues, CUlinkState *stateOut); + +/** + * \brief Add an input to a pending linker invocation + * + * Ownership of \p data is retained by the caller. No reference is retained to any + * inputs after this call returns. + * + * This method accepts only compiler options, which are used if the data must + * be compiled from PTX, and does not accept any of + * ::CU_JIT_WALL_TIME, ::CU_JIT_INFO_LOG_BUFFER, ::CU_JIT_ERROR_LOG_BUFFER, + * ::CU_JIT_TARGET_FROM_CUCONTEXT, or ::CU_JIT_TARGET. + * + * \note For LTO-IR input, only LTO-IR compiled with toolkits prior to CUDA 12.0 will be accepted + * + * \param state A pending linker action. + * \param type The type of the input data. + * \param data The input data. PTX must be NULL-terminated. + * \param size The length of the input data. + * \param name An optional name for this input in log messages. + * \param numOptions Size of options. + * \param options Options to be applied only for this input (overrides options from ::cuLinkCreate). + * \param optionValues Array of option values, each cast to void *. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_IMAGE, + * ::CUDA_ERROR_INVALID_PTX, + * ::CUDA_ERROR_UNSUPPORTED_PTX_VERSION, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_NO_BINARY_FOR_GPU + * + * \sa ::cuLinkCreate, + * ::cuLinkAddFile, + * ::cuLinkComplete, + * ::cuLinkDestroy + */ +CUresult CUDAAPI +cuLinkAddData(CUlinkState state, CUjitInputType type, void *data, size_t size, const char *name, + unsigned int numOptions, CUjit_option *options, void **optionValues); + +/** + * \brief Add a file input to a pending linker invocation + * + * No reference is retained to any inputs after this call returns. + * + * This method accepts only compiler options, which are used if the input + * must be compiled from PTX, and does not accept any of + * ::CU_JIT_WALL_TIME, ::CU_JIT_INFO_LOG_BUFFER, ::CU_JIT_ERROR_LOG_BUFFER, + * ::CU_JIT_TARGET_FROM_CUCONTEXT, or ::CU_JIT_TARGET. + * + * This method is equivalent to invoking ::cuLinkAddData on the contents + * of the file. + * + * \note For LTO-IR input, only LTO-IR compiled with toolkits prior to CUDA 12.0 will be accepted + * + * \param state A pending linker action + * \param type The type of the input data + * \param path Path to the input file + * \param numOptions Size of options + * \param options Options to be applied only for this input (overrides options from ::cuLinkCreate) + * \param optionValues Array of option values, each cast to void * + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_FILE_NOT_FOUND + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_IMAGE, + * ::CUDA_ERROR_INVALID_PTX, + * ::CUDA_ERROR_UNSUPPORTED_PTX_VERSION, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_NO_BINARY_FOR_GPU + * + * \sa ::cuLinkCreate, + * ::cuLinkAddData, + * ::cuLinkComplete, + * ::cuLinkDestroy + */ +CUresult CUDAAPI +cuLinkAddFile(CUlinkState state, CUjitInputType type, const char *path, + unsigned int numOptions, CUjit_option *options, void **optionValues); + +/** + * \brief Complete a pending linker invocation + * + * Completes the pending linker action and returns the cubin image for the linked + * device code, which can be used with ::cuModuleLoadData. The cubin is owned by + * \p state, so it should be loaded before \p state is destroyed via ::cuLinkDestroy. + * This call does not destroy \p state. + * + * \param state A pending linker invocation + * \param cubinOut On success, this will point to the output image + * \param sizeOut Optional parameter to receive the size of the generated image + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa ::cuLinkCreate, + * ::cuLinkAddData, + * ::cuLinkAddFile, + * ::cuLinkDestroy, + * ::cuModuleLoadData + */ +CUresult CUDAAPI +cuLinkComplete(CUlinkState state, void **cubinOut, size_t *sizeOut); + +/** + * \brief Destroys state for a JIT linker invocation. + * + * \param state State object for the linker invocation + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE + * + * \sa ::cuLinkCreate + */ +CUresult CUDAAPI +cuLinkDestroy(CUlinkState state); + +/** @} */ /* END CUDA_MODULE */ + +/** + * \defgroup CUDA_MODULE_DEPRECATED Module Management [DEPRECATED] + * + * ___MANBRIEF___ deprecated module management functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the deprecated module management functions of the low-level + * CUDA driver application programming interface. + * + * @{ + */ + +/** + * \brief Returns a handle to a texture reference + * + * \deprecated + * + * Returns in \p *pTexRef the handle of the texture reference of name \p name + * in the module \p hmod. If no texture reference of that name exists, + * ::cuModuleGetTexRef() returns ::CUDA_ERROR_NOT_FOUND. This texture reference + * handle should not be destroyed, since it will be destroyed when the module + * is unloaded. + * + * \param pTexRef - Returned texture reference + * \param hmod - Module to retrieve texture reference from + * \param name - Name of texture reference to retrieve + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND + * \notefnerr + * + * \sa + * ::cuModuleGetFunction, + * ::cuModuleGetGlobal, + * ::cuModuleGetSurfRef, + * ::cuModuleLoad, + * ::cuModuleLoadData, + * ::cuModuleLoadDataEx, + * ::cuModuleLoadFatBinary, + * ::cuModuleUnload + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuModuleGetTexRef(CUtexref *pTexRef, CUmodule hmod, const char *name); + +/** + * \brief Returns a handle to a surface reference + * + * \deprecated + * + * Returns in \p *pSurfRef the handle of the surface reference of name \p name + * in the module \p hmod. If no surface reference of that name exists, + * ::cuModuleGetSurfRef() returns ::CUDA_ERROR_NOT_FOUND. + * + * \param pSurfRef - Returned surface reference + * \param hmod - Module to retrieve surface reference from + * \param name - Name of surface reference to retrieve + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND + * \notefnerr + * + * \sa + * ::cuModuleGetFunction, + * ::cuModuleGetGlobal, + * ::cuModuleGetTexRef, + * ::cuModuleLoad, + * ::cuModuleLoadData, + * ::cuModuleLoadDataEx, + * ::cuModuleLoadFatBinary, + * ::cuModuleUnload + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuModuleGetSurfRef(CUsurfref *pSurfRef, CUmodule hmod, const char *name); + +/** @} */ /* END CUDA_MODULE_DEPRECATED */ + +/** + * \defgroup CUDA_LIBRARY Library Management + * + * ___MANBRIEF___ library management functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the library management functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Load a library with specified code and options + * + * Takes a pointer \p code and loads the corresponding library \p library based on + * the application defined library loading mode: + * - If module loading is set to EAGER, via the environment variables described in "Module loading", + * \p library is loaded eagerly into all contexts at the time of the call and future contexts + * at the time of creation until the library is unloaded with ::cuLibraryUnload(). + * - If the environment variables are set to LAZY, \p library + * is not immediately loaded onto all existent contexts and will only be + * loaded when a function is needed for that context, such as a kernel launch. + * + * These environment variables are described in the CUDA programming guide under the + * "CUDA environment variables" section. + * + * The \p code may be a \e cubin or \e fatbin as output by \b nvcc, + * or a NULL-terminated \e PTX, either as output by \b nvcc or hand-written. + * + * Options are passed as an array via \p jitOptions and any corresponding parameters are passed in + * \p jitOptionsValues. The number of total JIT options is supplied via \p numJitOptions. + * Any outputs will be returned via \p jitOptionsValues. + * + * Library load options are passed as an array via \p libraryOptions and any corresponding parameters are passed in + * \p libraryOptionValues. The number of total library load options is supplied via \p numLibraryOptions. + * + * \param library - Returned library + * \param code - Code to load + * \param jitOptions - Options for JIT + * \param jitOptionsValues - Option values for JIT + * \param numJitOptions - Number of options + * \param libraryOptions - Options for loading + * \param libraryOptionValues - Option values for loading + * \param numLibraryOptions - Number of options for loading + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_PTX, + * ::CUDA_ERROR_UNSUPPORTED_PTX_VERSION, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_NO_BINARY_FOR_GPU, + * ::CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, + * ::CUDA_ERROR_JIT_COMPILER_NOT_FOUND + * + * \sa ::cuLibraryLoadFromFile, + * ::cuLibraryUnload, + * ::cuModuleLoad, + * ::cuModuleLoadData, + * ::cuModuleLoadDataEx + */ +CUresult CUDAAPI cuLibraryLoadData(CUlibrary *library, const void *code, + CUjit_option *jitOptions, void **jitOptionsValues, unsigned int numJitOptions, + CUlibraryOption *libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions); + +/** + * \brief Load a library with specified file and options + * + * Takes a pointer \p code and loads the corresponding library \p library based on + * the application defined library loading mode: + * - If module loading is set to EAGER, via the environment variables described in "Module loading", + * \p library is loaded eagerly into all contexts at the time of the call and future contexts + * at the time of creation until the library is unloaded with ::cuLibraryUnload(). + * - If the environment variables are set to LAZY, \p library + * is not immediately loaded onto all existent contexts and will only be + * loaded when a function is needed for that context, such as a kernel launch. + * + * These environment variables are described in the CUDA programming guide under the + * "CUDA environment variables" section. + * + * The file should be a \e cubin file as output by \b nvcc, or a \e PTX file either + * as output by \b nvcc or handwritten, or a \e fatbin file as output by \b nvcc. + * + * Options are passed as an array via \p jitOptions and any corresponding parameters are + * passed in \p jitOptionsValues. The number of total options is supplied via \p numJitOptions. + * Any outputs will be returned via \p jitOptionsValues. + * + * Library load options are passed as an array via \p libraryOptions and any corresponding parameters are passed in + * \p libraryOptionValues. The number of total library load options is supplied via \p numLibraryOptions. + * + * \param library - Returned library + * \param fileName - File to load from + * \param jitOptions - Options for JIT + * \param jitOptionsValues - Option values for JIT + * \param numJitOptions - Number of options + * \param libraryOptions - Options for loading + * \param libraryOptionValues - Option values for loading + * \param numLibraryOptions - Number of options for loading + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_PTX, + * ::CUDA_ERROR_UNSUPPORTED_PTX_VERSION, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_NO_BINARY_FOR_GPU, + * ::CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, + * ::CUDA_ERROR_JIT_COMPILER_NOT_FOUND + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryUnload, + * ::cuModuleLoad, + * ::cuModuleLoadData, + * ::cuModuleLoadDataEx + */ +CUresult CUDAAPI cuLibraryLoadFromFile(CUlibrary *library, const char *fileName, + CUjit_option *jitOptions, void **jitOptionsValues, unsigned int numJitOptions, + CUlibraryOption *libraryOptions, void **libraryOptionValues, unsigned int numLibraryOptions); + +/** + * \brief Unloads a library + * + * Unloads the library specified with \p library + * + * \param library - Library to unload + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryLoadFromFile, + * ::cuModuleUnload + */ +CUresult CUDAAPI cuLibraryUnload(CUlibrary library); + +/** + * \brief Returns a kernel handle + * + * Returns in \p pKernel the handle of the kernel with name \p name located in library \p library. + * If kernel handle is not found, the call returns ::CUDA_ERROR_NOT_FOUND. + * + * \param pKernel - Returned kernel handle + * \param library - Library to retrieve kernel from + * \param name - Name of kernel to retrieve + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_FOUND + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryLoadFromFile, + * ::cuLibraryUnload, + * ::cuKernelGetFunction, + * ::cuLibraryGetModule, + * ::cuModuleGetFunction + */ +CUresult CUDAAPI cuLibraryGetKernel(CUkernel *pKernel, CUlibrary library, const char *name); + +/** + * \brief Returns the number of kernels within a library + * + * Returns in \p count the number of kernels in \p lib. + * + * \param count - Number of kernels found within the library + * \param lib - Library to query + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + */ +CUresult CUDAAPI cuLibraryGetKernelCount(unsigned int *count, CUlibrary lib); + +/** + * \brief Retrieve the kernel handles within a library. + * + * Returns in \p kernels a maximum number of \p numKernels kernel handles within \p lib. + * The returned kernel handle becomes invalid when the library is unloaded. + * + * \param kernels - Buffer where the kernel handles are returned to + * \param numKernels - Maximum number of kernel handles may be returned to the buffer + * \param lib - Library to query from + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuLibraryGetKernelCount + */ +CUresult CUDAAPI cuLibraryEnumerateKernels(CUkernel *kernels, unsigned int numKernels, CUlibrary lib); + +/** + * \brief Returns a module handle + * + * Returns in \p pMod the module handle associated with the current context located in + * library \p library. If module handle is not found, the call returns ::CUDA_ERROR_NOT_FOUND. + * + * \param pMod - Returned module handle + * \param library - Library to retrieve module from + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_CONTEXT_IS_DESTROYED + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryLoadFromFile, + * ::cuLibraryUnload, + * ::cuModuleGetFunction + */ +CUresult CUDAAPI cuLibraryGetModule(CUmodule *pMod, CUlibrary library); + +/** + * \brief Returns a function handle + * + * Returns in \p pFunc the handle of the function for the requested kernel \p kernel and + * the current context. If function handle is not found, the call returns ::CUDA_ERROR_NOT_FOUND. + * + * \param pFunc - Returned function handle + * \param kernel - Kernel to retrieve function for the requested context + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_CONTEXT_IS_DESTROYED + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryLoadFromFile, + * ::cuLibraryUnload, + * ::cuLibraryGetKernel, + * ::cuLibraryGetModule, + * ::cuModuleGetFunction + */ +CUresult CUDAAPI cuKernelGetFunction(CUfunction *pFunc, CUkernel kernel); + +/** + * \brief Returns a global device pointer + * + * Returns in \p *dptr and \p *bytes the base pointer and size of the global with + * name \p name for the requested library \p library and the current context. + * If no global for the requested name \p name exists, the call returns ::CUDA_ERROR_NOT_FOUND. + * One of the parameters \p dptr or \p bytes (not both) can be NULL in which + * case it is ignored. + * + * \param dptr - Returned global device pointer for the requested context + * \param bytes - Returned global size in bytes + * \param library - Library to retrieve global from + * \param name - Name of global to retrieve + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_CONTEXT_IS_DESTROYED + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryLoadFromFile, + * ::cuLibraryUnload, + * ::cuLibraryGetModule, + * cuModuleGetGlobal + */ +CUresult CUDAAPI cuLibraryGetGlobal(CUdeviceptr *dptr, size_t *bytes, CUlibrary library, const char *name); + +/** + * \brief Returns a pointer to managed memory + * + * Returns in \p *dptr and \p *bytes the base pointer and size of the managed memory with + * name \p name for the requested library \p library. If no managed memory with the + * requested name \p name exists, the call returns ::CUDA_ERROR_NOT_FOUND. One of the parameters + * \p dptr or \p bytes (not both) can be NULL in which case it is ignored. + * Note that managed memory for library \p library is shared across devices and is registered + * when the library is loaded into atleast one context. + * + * \note The API requires a CUDA context to be present and initialized on at least one device. + * If no context is present, the call returns ::CUDA_ERROR_NOT_FOUND. + * + * \param dptr - Returned pointer to the managed memory + * \param bytes - Returned memory size in bytes + * \param library - Library to retrieve managed memory from + * \param name - Name of managed memory to retrieve + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_FOUND + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryLoadFromFile, + * ::cuLibraryUnload + */ +CUresult CUDAAPI cuLibraryGetManaged(CUdeviceptr *dptr, size_t *bytes, CUlibrary library, const char *name); + +/** + * \brief Returns a pointer to a unified function + * + * Returns in \p *fptr the function pointer to a unified function denoted by \p symbol. + * If no unified function with name \p symbol exists, the call returns ::CUDA_ERROR_NOT_FOUND. + * If there is no device with attribute ::CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS present in the system, + * the call may return ::CUDA_ERROR_NOT_FOUND. + * + * \param fptr - Returned pointer to a unified function + * \param library - Library to retrieve function pointer memory from + * \param symbol - Name of function pointer to retrieve + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_FOUND + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryLoadFromFile, + * ::cuLibraryUnload + */ +CUresult CUDAAPI cuLibraryGetUnifiedFunction(void **fptr, CUlibrary library, const char *symbol); + +/** + * \brief Returns information about a kernel + * + * Returns in \p *pi the integer value of the attribute \p attrib for the kernel + * \p kernel for the requested device \p dev. The supported attributes are: + * - ::CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK: The maximum number of threads + * per block, beyond which a launch of the kernel would fail. This number + * depends on both the kernel and the requested device. + * - ::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES: The size in bytes of + * statically-allocated shared memory per block required by this kernel. + * This does not include dynamically-allocated shared memory requested by + * the user at runtime. + * - ::CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES: The size in bytes of user-allocated + * constant memory required by this kernel. + * - ::CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES: The size in bytes of local memory + * used by each thread of this kernel. + * - ::CU_FUNC_ATTRIBUTE_NUM_REGS: The number of registers used by each thread + * of this kernel. + * - ::CU_FUNC_ATTRIBUTE_PTX_VERSION: The PTX virtual architecture version for + * which the kernel was compiled. This value is the major PTX version * 10 + * + the minor PTX version, so a PTX version 1.3 function would return the + * value 13. Note that this may return the undefined value of 0 for cubins + * compiled prior to CUDA 3.0. + * - ::CU_FUNC_ATTRIBUTE_BINARY_VERSION: The binary architecture version for + * which the kernel was compiled. This value is the major binary + * version * 10 + the minor binary version, so a binary version 1.3 function + * would return the value 13. Note that this will return a value of 10 for + * legacy cubins that do not have a properly-encoded binary architecture + * version. + * - ::CU_FUNC_CACHE_MODE_CA: The attribute to indicate whether the kernel has + * been compiled with user specified option "-Xptxas --dlcm=ca" set. + * - ::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES: The maximum size in bytes of + * dynamically-allocated shared memory. + * - ::CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT: Preferred shared memory-L1 + * cache split ratio in percent of total shared memory. + * - ::CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET: If this attribute is set, the + * kernel must launch with a valid cluster size specified. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH: The required cluster width in + * blocks. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT: The required cluster height in + * blocks. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH: The required cluster depth in + * blocks. + * - ::CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED: Indicates whether + * the function can be launched with non-portable cluster size. 1 is allowed, + * 0 is disallowed. A non-portable cluster size may only function on the + * specific SKUs the program is tested on. The launch might fail if the + * program is run on a different hardware platform. CUDA API provides + * cudaOccupancyMaxActiveClusters to assist with checking whether the desired + * size can be launched on the current device. A portable cluster size is + * guaranteed to be functional on all compute capabilities higher than the + * target compute capability. The portable cluster size for sm_90 is 8 blocks + * per cluster. This value may increase for future compute capabilities. The + * specific hardware unit may support higher cluster sizes that’s not + * guaranteed to be portable. + * - ::CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE: The block + * scheduling policy of a function. The value type is CUclusterSchedulingPolicy. + * + * \note If another thread is trying to set the same attribute on the same device using + * ::cuKernelSetAttribute() simultaneously, the attribute query will give the old or new + * value depending on the interleavings chosen by the OS scheduler and memory consistency. + * + * \param pi - Returned attribute value + * \param attrib - Attribute requested + * \param kernel - Kernel to query attribute of + * \param dev - Device to query attribute of + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryLoadFromFile, + * ::cuLibraryUnload, + * ::cuKernelSetAttribute, + * ::cuLibraryGetKernel, + * ::cuLaunchKernel, + * ::cuKernelGetFunction, + * ::cuLibraryGetModule, + * ::cuModuleGetFunction, + * ::cuFuncGetAttribute + */ +CUresult CUDAAPI cuKernelGetAttribute(int *pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev); + +/** + * \brief Sets information about a kernel + * + * This call sets the value of a specified attribute \p attrib on the kernel \p kernel + * for the requested device \p dev to an integer value specified by \p val. + * This function returns CUDA_SUCCESS if the new value of the attribute could be + * successfully set. If the set fails, this call will return an error. + * Not all attributes can have values set. Attempting to set a value on a read-only + * attribute will result in an error (CUDA_ERROR_INVALID_VALUE) + * + * Note that attributes set using ::cuFuncSetAttribute() will override the attribute + * set by this API irrespective of whether the call to ::cuFuncSetAttribute() is made + * before or after this API call. However, ::cuKernelGetAttribute() will always + * return the attribute value set by this API. + * + * Supported attributes are: + * - ::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES: This is the maximum size in bytes of + * dynamically-allocated shared memory. The value should contain the requested + * maximum size of dynamically-allocated shared memory. The sum of this value and + * the function attribute ::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES cannot exceed the + * device attribute ::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN. + * The maximal size of requestable dynamic shared memory may differ by GPU + * architecture. + * - ::CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT: On devices where the L1 + * cache and shared memory use the same hardware resources, this sets the shared memory + * carveout preference, in percent of the total shared memory. + * See ::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR + * This is only a hint, and the driver can choose a different ratio if required to execute the function. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH: The required cluster width in + * blocks. The width, height, and depth values must either all be 0 or all be + * positive. The validity of the cluster dimensions is checked at launch time. + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime will return CUDA_ERROR_NOT_PERMITTED. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT: The required cluster height in + * blocks. The width, height, and depth values must either all be 0 or all be + * positive. The validity of the cluster dimensions is checked at launch time. + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime will return CUDA_ERROR_NOT_PERMITTED. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH: The required cluster depth in + * blocks. The width, height, and depth values must either all be 0 or all be + * positive. The validity of the cluster dimensions is checked at launch time. + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime will return CUDA_ERROR_NOT_PERMITTED. + * - ::CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE: The block + * scheduling policy of a function. The value type is CUclusterSchedulingPolicy. + * + * \note The API has stricter locking requirements in comparison to its legacy counterpart + * ::cuFuncSetAttribute() due to device-wide semantics. If multiple threads are trying to + * set the same attribute on the same device simultaneously, the attribute setting will depend + * on the interleavings chosen by the OS scheduler and memory consistency. + * + * \param attrib - Attribute requested + * \param val - Value to set + * \param kernel - Kernel to set attribute of + * \param dev - Device to set attribute of + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryLoadFromFile, + * ::cuLibraryUnload, + * ::cuKernelGetAttribute, + * ::cuLibraryGetKernel, + * ::cuLaunchKernel, + * ::cuKernelGetFunction, + * ::cuLibraryGetModule, + * ::cuModuleGetFunction, + * ::cuFuncSetAttribute + */ +CUresult CUDAAPI cuKernelSetAttribute(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev); + +/** + * \brief Sets the preferred cache configuration for a device kernel. + * + * On devices where the L1 cache and shared memory use the same hardware + * resources, this sets through \p config the preferred cache configuration for + * the device kernel \p kernel on the requested device \p dev. This is only a preference. + * The driver will use the requested configuration if possible, but it is free to choose a different + * configuration if required to execute \p kernel. Any context-wide preference + * set via ::cuCtxSetCacheConfig() will be overridden by this per-kernel + * setting. + * + * Note that attributes set using ::cuFuncSetCacheConfig() will override the attribute + * set by this API irrespective of whether the call to ::cuFuncSetCacheConfig() is made + * before or after this API call. + * + * This setting does nothing on devices where the size of the L1 cache and + * shared memory are fixed. + * + * Launching a kernel with a different preference than the most recent + * preference setting may insert a device-side synchronization point. + * + * + * The supported cache configurations are: + * - ::CU_FUNC_CACHE_PREFER_NONE: no preference for shared memory or L1 (default) + * - ::CU_FUNC_CACHE_PREFER_SHARED: prefer larger shared memory and smaller L1 cache + * - ::CU_FUNC_CACHE_PREFER_L1: prefer larger L1 cache and smaller shared memory + * - ::CU_FUNC_CACHE_PREFER_EQUAL: prefer equal sized L1 cache and shared memory + * + * \note The API has stricter locking requirements in comparison to its legacy counterpart + * ::cuFuncSetCacheConfig() due to device-wide semantics. If multiple threads are trying to + * set a config on the same device simultaneously, the cache config setting will depend + * on the interleavings chosen by the OS scheduler and memory consistency. + * + * \param kernel - Kernel to configure cache for + * \param config - Requested cache configuration + * \param dev - Device to set attribute of + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa ::cuLibraryLoadData, + * ::cuLibraryLoadFromFile, + * ::cuLibraryUnload, + * ::cuLibraryGetKernel, + * ::cuKernelGetFunction, + * ::cuLibraryGetModule, + * ::cuModuleGetFunction, + * ::cuFuncSetCacheConfig, + * ::cuCtxSetCacheConfig, + * ::cuLaunchKernel + */ +CUresult CUDAAPI cuKernelSetCacheConfig(CUkernel kernel, CUfunc_cache config, CUdevice dev); + +/** + * \brief Returns the function name for a ::CUkernel handle + * + * Returns in \p **name the function name associated with the kernel handle \p hfunc . + * The function name is returned as a null-terminated string. The returned name is only + * valid when the kernel handle is valid. If the library is unloaded or reloaded, one + * must call the API again to get the updated name. This API may return a mangled name if + * the function is not declared as having C linkage. If either \p **name or \p hfunc + * is NULL, ::CUDA_ERROR_INVALID_VALUE is returned. + * + * \param name - The returned name of the function + * \param hfunc - The function handle to retrieve the name for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + */ +CUresult CUDAAPI cuKernelGetName(const char **name, CUkernel hfunc); + +/** + * \brief Returns the offset and size of a kernel parameter in the device-side parameter layout + * + * Queries the kernel parameter at \p paramIndex into \p kernel's list of parameters, and returns + * in \p paramOffset and \p paramSize the offset and size, respectively, where the parameter + * will reside in the device-side parameter layout. This information can be used to update kernel + * node parameters from the device via ::cudaGraphKernelNodeSetParam() and + * ::cudaGraphKernelNodeUpdatesApply(). \p paramIndex must be less than the number of parameters + * that \p kernel takes. \p paramSize can be set to NULL if only the parameter offset is desired. + * + * \param kernel - The kernel to query + * \param paramIndex - The parameter index to query + * \param paramOffset - Returns the offset into the device-side parameter layout at which the parameter resides + * \param paramSize - Optionally returns the size of the parameter in the device-side parameter layout + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * +* \sa ::cuFuncGetParamInfo + */ +CUresult CUDAAPI cuKernelGetParamInfo(CUkernel kernel, size_t paramIndex, size_t *paramOffset, size_t *paramSize); +/** @} */ /* END CUDA_LIBRARY */ + +/** + * \defgroup CUDA_MEM Memory Management + * + * ___MANBRIEF___ memory management functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the memory management functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Gets free and total memory + * + * Returns in \p *total the total amount of memory available to the the current context. + * Returns in \p *free the amount of memory on the device that is free according to the OS. + * CUDA is not guaranteed to be able to allocate all of the memory that the OS reports as free. + * In a multi-tenet situation, free estimate returned is prone to race condition where + * a new allocation/free done by a different process or a different thread in the same + * process between the time when free memory was estimated and reported, will result in + * deviation in free value reported and actual free memory. + * + * The integrated GPU on Tegra shares memory with CPU and other component + * of the SoC. The free and total values returned by the API excludes + * the SWAP memory space maintained by the OS on some platforms. + * The OS may move some of the memory pages into swap area as the GPU or + * CPU allocate or access memory. See Tegra app note on how to calculate + * total and free memory on Tegra. + * + * \param free - Returned free memory in bytes + * \param total - Returned total memory in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemGetInfo + */ +CUresult CUDAAPI cuMemGetInfo(size_t *free, size_t *total); + +/** + * \brief Allocates device memory + * + * Allocates \p bytesize bytes of linear memory on the device and returns in + * \p *dptr a pointer to the allocated memory. The allocated memory is suitably + * aligned for any kind of variable. The memory is not cleared. If \p bytesize + * is 0, ::cuMemAlloc() returns ::CUDA_ERROR_INVALID_VALUE. + * + * \param dptr - Returned device pointer + * \param bytesize - Requested allocation size in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMalloc + */ +CUresult CUDAAPI cuMemAlloc(CUdeviceptr *dptr, size_t bytesize); + +/** + * \brief Allocates pitched device memory + * + * Allocates at least \p WidthInBytes * \p Height bytes of linear memory on + * the device and returns in \p *dptr a pointer to the allocated memory. The + * function may pad the allocation to ensure that corresponding pointers in + * any given row will continue to meet the alignment requirements for + * coalescing as the address is updated from row to row. \p ElementSizeBytes + * specifies the size of the largest reads and writes that will be performed + * on the memory range. \p ElementSizeBytes may be 4, 8 or 16 (since coalesced + * memory transactions are not possible on other data sizes). If + * \p ElementSizeBytes is smaller than the actual read/write size of a kernel, + * the kernel will run correctly, but possibly at reduced speed. The pitch + * returned in \p *pPitch by ::cuMemAllocPitch() is the width in bytes of the + * allocation. The intended usage of pitch is as a separate parameter of the + * allocation, used to compute addresses within the 2D array. Given the row + * and column of an array element of type \b T, the address is computed as: + * \code + T* pElement = (T*)((char*)BaseAddress + Row * Pitch) + Column; + * \endcode + * + * The pitch returned by ::cuMemAllocPitch() is guaranteed to work with + * ::cuMemcpy2D() under all circumstances. For allocations of 2D arrays, it is + * recommended that programmers consider performing pitch allocations using + * ::cuMemAllocPitch(). Due to alignment restrictions in the hardware, this is + * especially true if the application will be performing 2D memory copies + * between different regions of device memory (whether linear memory or CUDA + * arrays). + * + * The byte alignment of the pitch returned by ::cuMemAllocPitch() is guaranteed + * to match or exceed the alignment requirement for texture binding with + * ::cuTexRefSetAddress2D(). + * + * \param dptr - Returned device pointer + * \param pPitch - Returned pitch of allocation in bytes + * \param WidthInBytes - Requested allocation width in bytes + * \param Height - Requested allocation height in rows + * \param ElementSizeBytes - Size of largest reads/writes for range + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMallocPitch + */ +CUresult CUDAAPI cuMemAllocPitch(CUdeviceptr *dptr, size_t *pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes); + +/** + * \brief Frees device memory + * + * Frees the memory space pointed to by \p dptr, which must have been returned + * by a previous call to one of the following memory allocation APIs - ::cuMemAlloc(), + * ::cuMemAllocPitch(), ::cuMemAllocManaged(), ::cuMemAllocAsync(), ::cuMemAllocFromPoolAsync() + * + * Note - This API will not perform any implict synchronization when the pointer was allocated with + * ::cuMemAllocAsync or ::cuMemAllocFromPoolAsync. Callers must ensure that all accesses to the + * pointer have completed before invoking ::cuMemFree. For best performance and memory reuse, users + * should use ::cuMemFreeAsync to free memory allocated via the stream ordered memory allocator. + * + * \param dptr - Pointer to memory to free + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemAllocManaged, ::cuMemAllocAsync, ::cuMemAllocFromPoolAsync, + * ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, ::cuMemcpy3D, ::cuMemcpy3DAsync, + * ::cuMemcpyAtoA, ::cuMemcpyAtoD, ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, + * ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, + * ::cuMemcpyHtoAAsync, ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, ::cuMemFreeAsync, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaFree + */ +CUresult CUDAAPI cuMemFree(CUdeviceptr dptr); + +/** + * \brief Get information on memory allocations + * + * Returns the base address in \p *pbase and size in \p *psize of the + * allocation by ::cuMemAlloc() or ::cuMemAllocPitch() that contains the input + * pointer \p dptr. Both parameters \p pbase and \p psize are optional. If one + * of them is NULL, it is ignored. + * + * \param pbase - Returned base address + * \param psize - Returned size of device memory allocation + * \param dptr - Device pointer to query + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32 + */ +CUresult CUDAAPI cuMemGetAddressRange(CUdeviceptr *pbase, size_t *psize, CUdeviceptr dptr); + +/** + * \brief Allocates page-locked host memory + * + * Allocates \p bytesize bytes of host memory that is page-locked and + * accessible to the device. The driver tracks the virtual memory ranges + * allocated with this function and automatically accelerates calls to + * functions such as ::cuMemcpy(). Since the memory can be accessed directly by + * the device, it can be read or written with much higher bandwidth than + * pageable memory obtained with functions such as ::malloc(). + * + * On systems where ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES + * is true, ::cuMemAllocHost may not page-lock the allocated memory. + * + * Page-locking excessive amounts of memory with ::cuMemAllocHost() may degrade system + * performance, since it reduces the amount of memory available to the system + * for paging. As a result, this function is best used sparingly to allocate + * staging areas for data exchange between host and device. + * + * Note all host memory allocated using ::cuMemAllocHost() will automatically + * be immediately accessible to all contexts on all devices which support unified + * addressing (as may be queried using ::CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING). + * The device pointer that may be used to access this host memory from those + * contexts is always equal to the returned host pointer \p *pp. + * See \ref CUDA_UNIFIED for additional details. + * + * \param pp - Returned pointer to host memory + * \param bytesize - Requested allocation size in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMallocHost + */ +CUresult CUDAAPI cuMemAllocHost(void **pp, size_t bytesize); + +/** + * \brief Frees page-locked host memory + * + * Frees the memory space pointed to by \p p, which must have been returned by + * a previous call to ::cuMemAllocHost(). + * + * \param p - Pointer to memory to free + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaFreeHost + */ +CUresult CUDAAPI cuMemFreeHost(void *p); + +/** + * \brief Allocates page-locked host memory + * + * Allocates \p bytesize bytes of host memory that is page-locked and accessible + * to the device. The driver tracks the virtual memory ranges allocated with + * this function and automatically accelerates calls to functions such as + * ::cuMemcpyHtoD(). Since the memory can be accessed directly by the device, + * it can be read or written with much higher bandwidth than pageable memory + * obtained with functions such as ::malloc(). + * + * On systems where ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES + * is true, ::cuMemHostAlloc may not page-lock the allocated memory. + * + * Page-locking excessive amounts of memory may degrade system performance, + * since it reduces the amount of memory available to the system for paging. + * As a result, this function is best used sparingly to allocate staging areas + * for data exchange between host and device. + * + * The \p Flags parameter enables different options to be specified that + * affect the allocation, as follows. + * + * - ::CU_MEMHOSTALLOC_PORTABLE: The memory returned by this call will be + * considered as pinned memory by all CUDA contexts, not just the one that + * performed the allocation. + * + * - ::CU_MEMHOSTALLOC_DEVICEMAP: Maps the allocation into the CUDA address + * space. The device pointer to the memory may be obtained by calling + * ::cuMemHostGetDevicePointer(). + * + * - ::CU_MEMHOSTALLOC_WRITECOMBINED: Allocates the memory as write-combined + * (WC). WC memory can be transferred across the PCI Express bus more + * quickly on some system configurations, but cannot be read efficiently by + * most CPUs. WC memory is a good option for buffers that will be written by + * the CPU and read by the GPU via mapped pinned memory or host->device + * transfers. + * + * All of these flags are orthogonal to one another: a developer may allocate + * memory that is portable, mapped and/or write-combined with no restrictions. + * + * The ::CU_MEMHOSTALLOC_DEVICEMAP flag may be specified on CUDA contexts for + * devices that do not support mapped pinned memory. The failure is deferred + * to ::cuMemHostGetDevicePointer() because the memory may be mapped into + * other CUDA contexts via the ::CU_MEMHOSTALLOC_PORTABLE flag. + * + * The memory allocated by this function must be freed with ::cuMemFreeHost(). + * + * Note all host memory allocated using ::cuMemHostAlloc() will automatically + * be immediately accessible to all contexts on all devices which support unified + * addressing (as may be queried using ::CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING). + * Unless the flag ::CU_MEMHOSTALLOC_WRITECOMBINED is specified, the device pointer + * that may be used to access this host memory from those contexts is always equal + * to the returned host pointer \p *pp. If the flag ::CU_MEMHOSTALLOC_WRITECOMBINED + * is specified, then the function ::cuMemHostGetDevicePointer() must be used + * to query the device pointer, even if the context supports unified addressing. + * See \ref CUDA_UNIFIED for additional details. + * + * \param pp - Returned pointer to host memory + * \param bytesize - Requested allocation size in bytes + * \param Flags - Flags for allocation request + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaHostAlloc + */ +CUresult CUDAAPI cuMemHostAlloc(void **pp, size_t bytesize, unsigned int Flags); + +/** + * \brief Passes back device pointer of mapped pinned memory + * + * Passes back the device pointer \p pdptr corresponding to the mapped, pinned + * host buffer \p p allocated by ::cuMemHostAlloc. + * + * ::cuMemHostGetDevicePointer() will fail if the ::CU_MEMHOSTALLOC_DEVICEMAP + * flag was not specified at the time the memory was allocated, or if the + * function is called on a GPU that does not support mapped pinned memory. + * + * For devices that have a non-zero value for the device attribute + * ::CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM, the memory + * can also be accessed from the device using the host pointer \p p. + * The device pointer returned by ::cuMemHostGetDevicePointer() may or may not + * match the original host pointer \p p and depends on the devices visible to the + * application. If all devices visible to the application have a non-zero value for the + * device attribute, the device pointer returned by ::cuMemHostGetDevicePointer() + * will match the original pointer \p p. If any device visible to the application + * has a zero value for the device attribute, the device pointer returned by + * ::cuMemHostGetDevicePointer() will not match the original host pointer \p p, + * but it will be suitable for use on all devices provided Unified Virtual Addressing + * is enabled. In such systems, it is valid to access the memory using either pointer + * on devices that have a non-zero value for the device attribute. Note however that + * such devices should access the memory using only one of the two pointers and not both. + * + * \p Flags provides for future releases. For now, it must be set to 0. + * + * \param pdptr - Returned device pointer + * \param p - Host pointer + * \param Flags - Options (must be 0) + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaHostGetDevicePointer + */ +CUresult CUDAAPI cuMemHostGetDevicePointer(CUdeviceptr *pdptr, void *p, unsigned int Flags); + +/** + * \brief Passes back flags that were used for a pinned allocation + * + * Passes back the flags \p pFlags that were specified when allocating + * the pinned host buffer \p p allocated by ::cuMemHostAlloc. + * + * ::cuMemHostGetFlags() will fail if the pointer does not reside in + * an allocation performed by ::cuMemAllocHost() or ::cuMemHostAlloc(). + * + * \param pFlags - Returned flags word + * \param p - Host pointer + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa + * ::cuMemAllocHost, + * ::cuMemHostAlloc, + * ::cudaHostGetFlags + */ +CUresult CUDAAPI cuMemHostGetFlags(unsigned int *pFlags, void *p); + +/** + * \brief Allocates memory that will be automatically managed by the Unified Memory system + * + * Allocates \p bytesize bytes of managed memory on the device and returns in + * \p *dptr a pointer to the allocated memory. If the device doesn't support + * allocating managed memory, ::CUDA_ERROR_NOT_SUPPORTED is returned. Support + * for managed memory can be queried using the device attribute + * ::CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY. The allocated memory is suitably + * aligned for any kind of variable. The memory is not cleared. If \p bytesize + * is 0, ::cuMemAllocManaged returns ::CUDA_ERROR_INVALID_VALUE. The pointer + * is valid on the CPU and on all GPUs in the system that support managed memory. + * All accesses to this pointer must obey the Unified Memory programming model. + * + * \p flags specifies the default stream association for this allocation. + * \p flags must be one of ::CU_MEM_ATTACH_GLOBAL or ::CU_MEM_ATTACH_HOST. If + * ::CU_MEM_ATTACH_GLOBAL is specified, then this memory is accessible from + * any stream on any device. If ::CU_MEM_ATTACH_HOST is specified, then the + * allocation should not be accessed from devices that have a zero value for the + * device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS; an explicit call to + * ::cuStreamAttachMemAsync will be required to enable access on such devices. + * + * If the association is later changed via ::cuStreamAttachMemAsync to + * a single stream, the default association as specified during ::cuMemAllocManaged + * is restored when that stream is destroyed. For __managed__ variables, the + * default association is always ::CU_MEM_ATTACH_GLOBAL. Note that destroying a + * stream is an asynchronous operation, and as a result, the change to default + * association won't happen until all work in the stream has completed. + * + * Memory allocated with ::cuMemAllocManaged should be released with ::cuMemFree. + * + * Device memory oversubscription is possible for GPUs that have a non-zero value for the + * device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. Managed memory on + * such GPUs may be evicted from device memory to host memory at any time by the Unified + * Memory driver in order to make room for other allocations. + * + * In a system where all GPUs have a non-zero value for the device attribute + * ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS, managed memory may not be populated when this + * API returns and instead may be populated on access. In such systems, managed memory can + * migrate to any processor's memory at any time. The Unified Memory driver will employ heuristics to + * maintain data locality and prevent excessive page faults to the extent possible. The application + * can also guide the driver about memory usage patterns via ::cuMemAdvise. The application + * can also explicitly migrate memory to a desired processor's memory via + * ::cuMemPrefetchAsync. + * + * In a multi-GPU system where all of the GPUs have a zero value for the device attribute + * ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS and all the GPUs have peer-to-peer support + * with each other, the physical storage for managed memory is created on the GPU which is active + * at the time ::cuMemAllocManaged is called. All other GPUs will reference the data at reduced + * bandwidth via peer mappings over the PCIe bus. The Unified Memory driver does not migrate + * memory among such GPUs. + * + * In a multi-GPU system where not all GPUs have peer-to-peer support with each other and + * where the value of the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS + * is zero for at least one of those GPUs, the location chosen for physical storage of managed + * memory is system-dependent. + * - On Linux, the location chosen will be device memory as long as the current set of active + * contexts are on devices that either have peer-to-peer support with each other or have a + * non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. + * If there is an active context on a GPU that does not have a non-zero value for that device + * attribute and it does not have peer-to-peer support with the other devices that have active + * contexts on them, then the location for physical storage will be 'zero-copy' or host memory. + * Note that this means that managed memory that is located in device memory is migrated to + * host memory if a new context is created on a GPU that doesn't have a non-zero value for + * the device attribute and does not support peer-to-peer with at least one of the other devices + * that has an active context. This in turn implies that context creation may fail if there is + * insufficient host memory to migrate all managed allocations. + * - On Windows, the physical storage is always created in 'zero-copy' or host memory. + * All GPUs will reference the data at reduced bandwidth over the PCIe bus. In these + * circumstances, use of the environment variable CUDA_VISIBLE_DEVICES is recommended to + * restrict CUDA to only use those GPUs that have peer-to-peer support. + * Alternatively, users can also set CUDA_MANAGED_FORCE_DEVICE_ALLOC to a + * non-zero value to force the driver to always use device memory for physical storage. + * When this environment variable is set to a non-zero value, all contexts created in + * that process on devices that support managed memory have to be peer-to-peer compatible + * with each other. Context creation will fail if a context is created on a device that + * supports managed memory and is not peer-to-peer compatible with any of the other + * managed memory supporting devices on which contexts were previously created, even if + * those contexts have been destroyed. These environment variables are described + * in the CUDA programming guide under the "CUDA environment variables" section. + * - On ARM, managed memory is not available on discrete gpu with Drive PX-2. + * + * \param dptr - Returned device pointer + * \param bytesize - Requested allocation size in bytes + * \param flags - Must be one of ::CU_MEM_ATTACH_GLOBAL or ::CU_MEM_ATTACH_HOST + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cuDeviceGetAttribute, ::cuStreamAttachMemAsync, + * ::cudaMallocManaged + */ +CUresult CUDAAPI cuMemAllocManaged(CUdeviceptr *dptr, size_t bytesize, unsigned int flags); + +/** +* \brief Registers a callback function to receive async notifications +* +* Registers \p callbackFunc to receive async notifications. +* +* The \p userData parameter is passed to the callback function at async notification time. +* Likewise, \p callback is also passed to the callback function to distinguish between +* multiple registered callbacks. +* +* The callback function being registered should be designed to return quickly (~10ms). +* Any long running tasks should be queued for execution on an application thread. +* +* Callbacks may not call cuDeviceRegisterAsyncNotification or cuDeviceUnregisterAsyncNotification. +* Doing so will result in ::CUDA_ERROR_NOT_PERMITTED. Async notification callbacks execute +* in an undefined order and may be serialized. +* +* Returns in \p *callback a handle representing the registered callback instance. +* +* \param device - The device on which to register the callback +* \param callbackFunc - The function to register as a callback +* \param userData - A generic pointer to user data. This is passed into the callback function. +* \param callback - A handle representing the registered callback instance +* +* \return +* ::CUDA_SUCCESS +* ::CUDA_ERROR_NOT_SUPPORTED +* ::CUDA_ERROR_INVALID_DEVICE +* ::CUDA_ERROR_INVALID_VALUE +* ::CUDA_ERROR_NOT_PERMITTED +* ::CUDA_ERROR_UNKNOWN +* \notefnerr +* +* \sa +* ::cuDeviceUnregisterAsyncNotification +*/ +CUresult CUDAAPI cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void *userData, CUasyncCallbackHandle *callback); + +/** +* \brief Unregisters an async notification callback +* +* Unregisters \p callback so that the corresponding callback function will stop receiving +* async notifications. +* +* \param device - The device from which to remove \p callback. +* \param callback - The callback instance to unregister from receiving async notifications. +* +* \return +* ::CUDA_SUCCESS +* ::CUDA_ERROR_NOT_SUPPORTED +* ::CUDA_ERROR_INVALID_DEVICE +* ::CUDA_ERROR_INVALID_VALUE +* ::CUDA_ERROR_NOT_PERMITTED +* ::CUDA_ERROR_UNKNOWN +* \notefnerr +* +* \sa +* ::cuDeviceRegisterAsyncNotification +*/ +CUresult CUDAAPI cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback); + +/** + * \brief Returns a handle to a compute device + * + * Returns in \p *device a device handle given a PCI bus ID string. + * + * \param dev - Returned device handle + * + * \param pciBusId - String in one of the following forms: + * [domain]:[bus]:[device].[function] + * [domain]:[bus]:[device] + * [bus]:[device].[function] + * where \p domain, \p bus, \p device, and \p function are all hexadecimal values + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGet, + * ::cuDeviceGetAttribute, + * ::cuDeviceGetPCIBusId, + * ::cudaDeviceGetByPCIBusId + */ +CUresult CUDAAPI cuDeviceGetByPCIBusId(CUdevice *dev, const char *pciBusId); + +/** + * \brief Returns a PCI Bus Id string for the device + * + * Returns an ASCII string identifying the device \p dev in the NULL-terminated + * string pointed to by \p pciBusId. \p len specifies the maximum length of the + * string that may be returned. + * + * \param pciBusId - Returned identifier string for the device in the following format + * [domain]:[bus]:[device].[function] + * where \p domain, \p bus, \p device, and \p function are all hexadecimal values. + * pciBusId should be large enough to store 13 characters including the NULL-terminator. + * + * \param len - Maximum length of string to store in \p name + * + * \param dev - Device to get identifier string for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuDeviceGet, + * ::cuDeviceGetAttribute, + * ::cuDeviceGetByPCIBusId, + * ::cudaDeviceGetPCIBusId + */ +CUresult CUDAAPI cuDeviceGetPCIBusId(char *pciBusId, int len, CUdevice dev); + +/** + * \brief Gets an interprocess handle for a previously allocated event + * + * Takes as input a previously allocated event. This event must have been + * created with the ::CU_EVENT_INTERPROCESS and ::CU_EVENT_DISABLE_TIMING + * flags set. This opaque handle may be copied into other processes and + * opened with ::cuIpcOpenEventHandle to allow efficient hardware + * synchronization between GPU work in different processes. + * + * After the event has been opened in the importing process, + * ::cuEventRecord, ::cuEventSynchronize, ::cuStreamWaitEvent and + * ::cuEventQuery may be used in either process. Performing operations + * on the imported event after the exported event has been freed + * with ::cuEventDestroy will result in undefined behavior. + * + * IPC functionality is restricted to devices with support for unified + * addressing on Linux and Windows operating systems. + * IPC functionality on Windows is restricted to GPUs in TCC mode + * Users can test their device for IPC functionality by calling + * ::cuapiDeviceGetAttribute with ::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED + * + * \param pHandle - Pointer to a user allocated CUipcEventHandle + * in which to return the opaque event handle + * \param event - Event allocated with ::CU_EVENT_INTERPROCESS and + * ::CU_EVENT_DISABLE_TIMING flags. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_MAP_FAILED, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuEventCreate, + * ::cuEventDestroy, + * ::cuEventSynchronize, + * ::cuEventQuery, + * ::cuStreamWaitEvent, + * ::cuIpcOpenEventHandle, + * ::cuIpcGetMemHandle, + * ::cuIpcOpenMemHandle, + * ::cuIpcCloseMemHandle, + * ::cudaIpcGetEventHandle + */ +CUresult CUDAAPI cuIpcGetEventHandle(CUipcEventHandle *pHandle, CUevent event); + +/** + * \brief Opens an interprocess event handle for use in the current process + * + * Opens an interprocess event handle exported from another process with + * ::cuIpcGetEventHandle. This function returns a ::CUevent that behaves like + * a locally created event with the ::CU_EVENT_DISABLE_TIMING flag specified. + * This event must be freed with ::cuEventDestroy. + * + * Performing operations on the imported event after the exported event has + * been freed with ::cuEventDestroy will result in undefined behavior. + * + * IPC functionality is restricted to devices with support for unified + * addressing on Linux and Windows operating systems. + * IPC functionality on Windows is restricted to GPUs in TCC mode + * Users can test their device for IPC functionality by calling + * ::cuapiDeviceGetAttribute with ::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED + * + * \param phEvent - Returns the imported event + * \param handle - Interprocess handle to open + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_MAP_FAILED, + * ::CUDA_ERROR_PEER_ACCESS_UNSUPPORTED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuEventCreate, + * ::cuEventDestroy, + * ::cuEventSynchronize, + * ::cuEventQuery, + * ::cuStreamWaitEvent, + * ::cuIpcGetEventHandle, + * ::cuIpcGetMemHandle, + * ::cuIpcOpenMemHandle, + * ::cuIpcCloseMemHandle, + * ::cudaIpcOpenEventHandle + */ +CUresult CUDAAPI cuIpcOpenEventHandle(CUevent *phEvent, CUipcEventHandle handle); + +/** + * \brief Gets an interprocess memory handle for an existing device memory + * allocation + * + * Takes a pointer to the base of an existing device memory allocation created + * with ::cuMemAlloc and exports it for use in another process. This is a + * lightweight operation and may be called multiple times on an allocation + * without adverse effects. + * + * If a region of memory is freed with ::cuMemFree and a subsequent call + * to ::cuMemAlloc returns memory with the same device address, + * ::cuIpcGetMemHandle will return a unique handle for the + * new memory. + * + * IPC functionality is restricted to devices with support for unified + * addressing on Linux and Windows operating systems. + * IPC functionality on Windows is restricted to GPUs in TCC mode + * Users can test their device for IPC functionality by calling + * ::cuapiDeviceGetAttribute with ::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED + * + * \param pHandle - Pointer to user allocated ::CUipcMemHandle to return + * the handle in. + * \param dptr - Base pointer to previously allocated device memory + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_MAP_FAILED, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuMemAlloc, + * ::cuMemFree, + * ::cuIpcGetEventHandle, + * ::cuIpcOpenEventHandle, + * ::cuIpcOpenMemHandle, + * ::cuIpcCloseMemHandle, + * ::cudaIpcGetMemHandle + */ +CUresult CUDAAPI cuIpcGetMemHandle(CUipcMemHandle *pHandle, CUdeviceptr dptr); + +/** + * \brief Opens an interprocess memory handle exported from another process + * and returns a device pointer usable in the local process. + * + * Maps memory exported from another process with ::cuIpcGetMemHandle into + * the current device address space. For contexts on different devices + * ::cuIpcOpenMemHandle can attempt to enable peer access between the + * devices as if the user called ::cuCtxEnablePeerAccess. This behavior is + * controlled by the ::CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS flag. + * ::cuDeviceCanAccessPeer can determine if a mapping is possible. + * + * Contexts that may open ::CUipcMemHandles are restricted in the following way. + * ::CUipcMemHandles from each ::CUdevice in a given process may only be opened + * by one ::CUcontext per ::CUdevice per other process. + * + * If the memory handle has already been opened by the current context, the + * reference count on the handle is incremented by 1 and the existing device pointer + * is returned. + * + * Memory returned from ::cuIpcOpenMemHandle must be freed with + * ::cuIpcCloseMemHandle. + * + * Calling ::cuMemFree on an exported memory region before calling + * ::cuIpcCloseMemHandle in the importing context will result in undefined + * behavior. + * + * IPC functionality is restricted to devices with support for unified + * addressing on Linux and Windows operating systems. + * IPC functionality on Windows is restricted to GPUs in TCC mode + * Users can test their device for IPC functionality by calling + * ::cuapiDeviceGetAttribute with ::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED + * + * \param pdptr - Returned device pointer + * \param handle - ::CUipcMemHandle to open + * \param Flags - Flags for this operation. Must be specified as ::CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_MAP_FAILED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_TOO_MANY_PEERS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \note No guarantees are made about the address returned in \p *pdptr. + * In particular, multiple processes may not receive the same address for the same \p handle. + * + * \sa + * ::cuMemAlloc, + * ::cuMemFree, + * ::cuIpcGetEventHandle, + * ::cuIpcOpenEventHandle, + * ::cuIpcGetMemHandle, + * ::cuIpcCloseMemHandle, + * ::cuCtxEnablePeerAccess, + * ::cuDeviceCanAccessPeer, + * ::cudaIpcOpenMemHandle + */ +CUresult CUDAAPI cuIpcOpenMemHandle(CUdeviceptr *pdptr, CUipcMemHandle handle, unsigned int Flags); + +/** + * \brief Attempts to close memory mapped with ::cuIpcOpenMemHandle + * + * Decrements the reference count of the memory returned by ::cuIpcOpenMemHandle by 1. + * When the reference count reaches 0, this API unmaps the memory. The original allocation + * in the exporting process as well as imported mappings in other processes + * will be unaffected. + * + * Any resources used to enable peer access will be freed if this is the + * last mapping using them. + * + * IPC functionality is restricted to devices with support for unified + * addressing on Linux and Windows operating systems. + * IPC functionality on Windows is restricted to GPUs in TCC mode + * Users can test their device for IPC functionality by calling + * ::cuapiDeviceGetAttribute with ::CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED + * + * \param dptr - Device pointer returned by ::cuIpcOpenMemHandle + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_MAP_FAILED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * \sa + * ::cuMemAlloc, + * ::cuMemFree, + * ::cuIpcGetEventHandle, + * ::cuIpcOpenEventHandle, + * ::cuIpcGetMemHandle, + * ::cuIpcOpenMemHandle, + * ::cudaIpcCloseMemHandle + */ +CUresult CUDAAPI cuIpcCloseMemHandle(CUdeviceptr dptr); + +/** + * \brief Registers an existing host memory range for use by CUDA + * + * Page-locks the memory range specified by \p p and \p bytesize and maps it + * for the device(s) as specified by \p Flags. This memory range also is added + * to the same tracking mechanism as ::cuMemHostAlloc to automatically accelerate + * calls to functions such as ::cuMemcpyHtoD(). Since the memory can be accessed + * directly by the device, it can be read or written with much higher bandwidth + * than pageable memory that has not been registered. Page-locking excessive + * amounts of memory may degrade system performance, since it reduces the amount + * of memory available to the system for paging. As a result, this function is + * best used sparingly to register staging areas for data exchange between + * host and device. + * + * On systems where ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES + * is true, ::cuMemHostRegister will not page-lock the memory range specified + * by \p ptr but only populate unpopulated pages. + * + * The \p Flags parameter enables different options to be specified that + * affect the allocation, as follows. + * + * - ::CU_MEMHOSTREGISTER_PORTABLE: The memory returned by this call will be + * considered as pinned memory by all CUDA contexts, not just the one that + * performed the allocation. + * + * - ::CU_MEMHOSTREGISTER_DEVICEMAP: Maps the allocation into the CUDA address + * space. The device pointer to the memory may be obtained by calling + * ::cuMemHostGetDevicePointer(). + * + * - ::CU_MEMHOSTREGISTER_IOMEMORY: The pointer is treated as pointing to some + * I/O memory space, e.g. the PCI Express resource of a 3rd party device. + * + * - ::CU_MEMHOSTREGISTER_READ_ONLY: The pointer is treated as pointing to memory + * that is considered read-only by the device. On platforms without + * ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, this flag is + * required in order to register memory mapped to the CPU as read-only. Support + * for the use of this flag can be queried from the device attribute + * ::CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED. Using this flag with + * a current context associated with a device that does not have this attribute + * set will cause ::cuMemHostRegister to error with CUDA_ERROR_NOT_SUPPORTED. + * + * All of these flags are orthogonal to one another: a developer may page-lock + * memory that is portable or mapped with no restrictions. + * + * The ::CU_MEMHOSTREGISTER_DEVICEMAP flag may be specified on CUDA contexts for + * devices that do not support mapped pinned memory. The failure is deferred + * to ::cuMemHostGetDevicePointer() because the memory may be mapped into + * other CUDA contexts via the ::CU_MEMHOSTREGISTER_PORTABLE flag. + * + * For devices that have a non-zero value for the device attribute + * ::CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM, the memory + * can also be accessed from the device using the host pointer \p p. + * The device pointer returned by ::cuMemHostGetDevicePointer() may or may not + * match the original host pointer \p ptr and depends on the devices visible to the + * application. If all devices visible to the application have a non-zero value for the + * device attribute, the device pointer returned by ::cuMemHostGetDevicePointer() + * will match the original pointer \p ptr. If any device visible to the application + * has a zero value for the device attribute, the device pointer returned by + * ::cuMemHostGetDevicePointer() will not match the original host pointer \p ptr, + * but it will be suitable for use on all devices provided Unified Virtual Addressing + * is enabled. In such systems, it is valid to access the memory using either pointer + * on devices that have a non-zero value for the device attribute. Note however that + * such devices should access the memory using only of the two pointers and not both. + * + * The memory page-locked by this function must be unregistered with + * ::cuMemHostUnregister(). + * + * \param p - Host pointer to memory to page-lock + * \param bytesize - Size in bytes of the address range to page-lock + * \param Flags - Flags for allocation request + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED, + * ::CUDA_ERROR_NOT_PERMITTED, + * ::CUDA_ERROR_NOT_SUPPORTED + * \notefnerr + * + * \sa + * ::cuMemHostUnregister, + * ::cuMemHostGetFlags, + * ::cuMemHostGetDevicePointer, + * ::cudaHostRegister + */ +CUresult CUDAAPI cuMemHostRegister(void *p, size_t bytesize, unsigned int Flags); + +/** + * \brief Unregisters a memory range that was registered with cuMemHostRegister. + * + * Unmaps the memory range whose base address is specified by \p p, and makes + * it pageable again. + * + * The base address must be the same one specified to ::cuMemHostRegister(). + * + * \param p - Host pointer to memory to unregister + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED, + * \notefnerr + * + * \sa + * ::cuMemHostRegister, + * ::cudaHostUnregister + */ +CUresult CUDAAPI cuMemHostUnregister(void *p); + +/** + * \brief Copies memory + * + * Copies data between two pointers. + * \p dst and \p src are base pointers of the destination and source, respectively. + * \p ByteCount specifies the number of bytes to copy. + * Note that this function infers the type of the transfer (host to host, host to + * device, device to device, or device to host) from the pointer values. This + * function is only allowed in contexts which support unified addressing. + * + * \param dst - Destination unified virtual address space pointer + * \param src - Source unified virtual address space pointer + * \param ByteCount - Size of memory copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * \note_memcpy + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpy, + * ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol + */ +CUresult CUDAAPI cuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount); + +/** + * \brief Copies device memory between two contexts + * + * Copies from device memory in one context to device memory in another + * context. \p dstDevice is the base device pointer of the destination memory + * and \p dstContext is the destination context. \p srcDevice is the base + * device pointer of the source memory and \p srcContext is the source pointer. + * \p ByteCount specifies the number of bytes to copy. + * + * \param dstDevice - Destination device pointer + * \param dstContext - Destination context + * \param srcDevice - Source device pointer + * \param srcContext - Source context + * \param ByteCount - Size of memory copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * + * \sa ::cuMemcpyDtoD, ::cuMemcpy3DPeer, ::cuMemcpyDtoDAsync, ::cuMemcpyPeerAsync, + * ::cuMemcpy3DPeerAsync, + * ::cudaMemcpyPeer + */ +CUresult CUDAAPI cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount); + +/** + * \brief Copies memory from Host to Device + * + * Copies from host memory to device memory. \p dstDevice and \p srcHost are + * the base addresses of the destination and source, respectively. \p ByteCount + * specifies the number of bytes to copy. + * + * \param dstDevice - Destination device pointer + * \param srcHost - Source host pointer + * \param ByteCount - Size of memory copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * \note_memcpy + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpy, + * ::cudaMemcpyToSymbol + */ +CUresult CUDAAPI cuMemcpyHtoD(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount); + +/** + * \brief Copies memory from Device to Host + * + * Copies from device to host memory. \p dstHost and \p srcDevice specify the + * base pointers of the destination and source, respectively. \p ByteCount + * specifies the number of bytes to copy. + * + * \param dstHost - Destination host pointer + * \param srcDevice - Source device pointer + * \param ByteCount - Size of memory copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * \note_memcpy + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpy, + * ::cudaMemcpyFromSymbol + */ +CUresult CUDAAPI cuMemcpyDtoH(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount); + +/** + * \brief Copies memory from Device to Device + * + * Copies from device memory to device memory. \p dstDevice and \p srcDevice + * are the base pointers of the destination and source, respectively. + * \p ByteCount specifies the number of bytes to copy. + * + * \param dstDevice - Destination device pointer + * \param srcDevice - Source device pointer + * \param ByteCount - Size of memory copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpy, + * ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol + */ +CUresult CUDAAPI cuMemcpyDtoD(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount); + +/** + * \brief Copies memory from Device to Array + * + * Copies from device memory to a 1D CUDA array. \p dstArray and \p dstOffset + * specify the CUDA array handle and starting index of the destination data. + * \p srcDevice specifies the base pointer of the source. \p ByteCount + * specifies the number of bytes to copy. + * + * \param dstArray - Destination array + * \param dstOffset - Offset in bytes of destination array + * \param srcDevice - Source device pointer + * \param ByteCount - Size of memory copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpyToArray + */ +CUresult CUDAAPI cuMemcpyDtoA(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount); + +/** + * \brief Copies memory from Array to Device + * + * Copies from one 1D CUDA array to device memory. \p dstDevice specifies the + * base pointer of the destination and must be naturally aligned with the CUDA + * array elements. \p srcArray and \p srcOffset specify the CUDA array handle + * and the offset in bytes into the array where the copy is to begin. + * \p ByteCount specifies the number of bytes to copy and must be evenly + * divisible by the array element size. + * + * \param dstDevice - Destination device pointer + * \param srcArray - Source array + * \param srcOffset - Offset in bytes of source array + * \param ByteCount - Size of memory copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpyFromArray + */ +CUresult CUDAAPI cuMemcpyAtoD(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount); + +/** + * \brief Copies memory from Host to Array + * + * Copies from host memory to a 1D CUDA array. \p dstArray and \p dstOffset + * specify the CUDA array handle and starting offset in bytes of the destination + * data. \p pSrc specifies the base address of the source. \p ByteCount specifies + * the number of bytes to copy. + * + * \param dstArray - Destination array + * \param dstOffset - Offset in bytes of destination array + * \param srcHost - Source host pointer + * \param ByteCount - Size of memory copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * \note_memcpy + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpyToArray + */ +CUresult CUDAAPI cuMemcpyHtoA(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount); + +/** + * \brief Copies memory from Array to Host + * + * Copies from one 1D CUDA array to host memory. \p dstHost specifies the base + * pointer of the destination. \p srcArray and \p srcOffset specify the CUDA + * array handle and starting offset in bytes of the source data. + * \p ByteCount specifies the number of bytes to copy. + * + * \param dstHost - Destination device pointer + * \param srcArray - Source array + * \param srcOffset - Offset in bytes of source array + * \param ByteCount - Size of memory copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * \note_memcpy + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpyFromArray + */ +CUresult CUDAAPI cuMemcpyAtoH(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount); + +/** + * \brief Copies memory from Array to Array + * + * Copies from one 1D CUDA array to another. \p dstArray and \p srcArray + * specify the handles of the destination and source CUDA arrays for the copy, + * respectively. \p dstOffset and \p srcOffset specify the destination and + * source offsets in bytes into the CUDA arrays. \p ByteCount is the number of + * bytes to be copied. The size of the elements in the CUDA arrays need not be + * the same format, but the elements must be the same size; and count must be + * evenly divisible by that size. + * + * \param dstArray - Destination array + * \param dstOffset - Offset in bytes of destination array + * \param srcArray - Source array + * \param srcOffset - Offset in bytes of source array + * \param ByteCount - Size of memory copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpyArrayToArray + */ +CUresult CUDAAPI cuMemcpyAtoA(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount); + +/** + * \brief Copies memory for 2D arrays + * + * Perform a 2D memory copy according to the parameters specified in \p pCopy. + * The ::CUDA_MEMCPY2D structure is defined as: + * + * \code + typedef struct CUDA_MEMCPY2D_st { + unsigned int srcXInBytes, srcY; + CUmemorytype srcMemoryType; + const void *srcHost; + CUdeviceptr srcDevice; + CUarray srcArray; + unsigned int srcPitch; + + unsigned int dstXInBytes, dstY; + CUmemorytype dstMemoryType; + void *dstHost; + CUdeviceptr dstDevice; + CUarray dstArray; + unsigned int dstPitch; + + unsigned int WidthInBytes; + unsigned int Height; + } CUDA_MEMCPY2D; + * \endcode + * where: + * - ::srcMemoryType and ::dstMemoryType specify the type of memory of the + * source and destination, respectively; ::CUmemorytype_enum is defined as: + * + * \code + typedef enum CUmemorytype_enum { + CU_MEMORYTYPE_HOST = 0x01, + CU_MEMORYTYPE_DEVICE = 0x02, + CU_MEMORYTYPE_ARRAY = 0x03, + CU_MEMORYTYPE_UNIFIED = 0x04 + } CUmemorytype; + * \endcode + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::srcDevice and ::srcPitch + * specify the (unified virtual address space) base address of the source data + * and the bytes per row to apply. ::srcArray is ignored. + * This value may be used only if unified addressing is supported in the calling + * context. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_HOST, ::srcHost and ::srcPitch + * specify the (host) base address of the source data and the bytes per row to + * apply. ::srcArray is ignored. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_DEVICE, ::srcDevice and ::srcPitch + * specify the (device) base address of the source data and the bytes per row + * to apply. ::srcArray is ignored. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_ARRAY, ::srcArray specifies the + * handle of the source data. ::srcHost, ::srcDevice and ::srcPitch are + * ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_HOST, ::dstHost and ::dstPitch + * specify the (host) base address of the destination data and the bytes per + * row to apply. ::dstArray is ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::dstDevice and ::dstPitch + * specify the (unified virtual address space) base address of the source data + * and the bytes per row to apply. ::dstArray is ignored. + * This value may be used only if unified addressing is supported in the calling + * context. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_DEVICE, ::dstDevice and ::dstPitch + * specify the (device) base address of the destination data and the bytes per + * row to apply. ::dstArray is ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_ARRAY, ::dstArray specifies the + * handle of the destination data. ::dstHost, ::dstDevice and ::dstPitch are + * ignored. + * + * - ::srcXInBytes and ::srcY specify the base address of the source data for + * the copy. + * + * \par + * For host pointers, the starting address is + * \code + void* Start = (void*)((char*)srcHost+srcY*srcPitch + srcXInBytes); + * \endcode + * + * \par + * For device pointers, the starting address is + * \code + CUdeviceptr Start = srcDevice+srcY*srcPitch+srcXInBytes; + * \endcode + * + * \par + * For CUDA arrays, ::srcXInBytes must be evenly divisible by the array + * element size. + * + * - ::dstXInBytes and ::dstY specify the base address of the destination data + * for the copy. + * + * \par + * For host pointers, the base address is + * \code + void* dstStart = (void*)((char*)dstHost+dstY*dstPitch + dstXInBytes); + * \endcode + * + * \par + * For device pointers, the starting address is + * \code + CUdeviceptr dstStart = dstDevice+dstY*dstPitch+dstXInBytes; + * \endcode + * + * \par + * For CUDA arrays, ::dstXInBytes must be evenly divisible by the array + * element size. + * + * - ::WidthInBytes and ::Height specify the width (in bytes) and height of + * the 2D copy being performed. + * - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + + * ::srcXInBytes, and ::dstPitch must be greater than or equal to + * ::WidthInBytes + dstXInBytes. + * + * \par + * ::cuMemcpy2D() returns an error if any pitch is greater than the maximum + * allowed (::CU_DEVICE_ATTRIBUTE_MAX_PITCH). ::cuMemAllocPitch() passes back + * pitches that always work with ::cuMemcpy2D(). On intra-device memory copies + * (device to device, CUDA array to device, CUDA array to CUDA array), + * ::cuMemcpy2D() may fail for pitches not computed by ::cuMemAllocPitch(). + * ::cuMemcpy2DUnaligned() does not have this restriction, but may run + * significantly slower in the cases where ::cuMemcpy2D() would have returned + * an error code. + * + * \param pCopy - Parameters for the memory copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, + * ::cudaMemcpy2DFromArray + */ +CUresult CUDAAPI cuMemcpy2D(const CUDA_MEMCPY2D *pCopy); + +/** + * \brief Copies memory for 2D arrays + * + * Perform a 2D memory copy according to the parameters specified in \p pCopy. + * The ::CUDA_MEMCPY2D structure is defined as: + * + * \code + typedef struct CUDA_MEMCPY2D_st { + unsigned int srcXInBytes, srcY; + CUmemorytype srcMemoryType; + const void *srcHost; + CUdeviceptr srcDevice; + CUarray srcArray; + unsigned int srcPitch; + unsigned int dstXInBytes, dstY; + CUmemorytype dstMemoryType; + void *dstHost; + CUdeviceptr dstDevice; + CUarray dstArray; + unsigned int dstPitch; + unsigned int WidthInBytes; + unsigned int Height; + } CUDA_MEMCPY2D; + * \endcode + * where: + * - ::srcMemoryType and ::dstMemoryType specify the type of memory of the + * source and destination, respectively; ::CUmemorytype_enum is defined as: + * + * \code + typedef enum CUmemorytype_enum { + CU_MEMORYTYPE_HOST = 0x01, + CU_MEMORYTYPE_DEVICE = 0x02, + CU_MEMORYTYPE_ARRAY = 0x03, + CU_MEMORYTYPE_UNIFIED = 0x04 + } CUmemorytype; + * \endcode + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::srcDevice and ::srcPitch + * specify the (unified virtual address space) base address of the source data + * and the bytes per row to apply. ::srcArray is ignored. + * This value may be used only if unified addressing is supported in the calling + * context. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_HOST, ::srcHost and ::srcPitch + * specify the (host) base address of the source data and the bytes per row to + * apply. ::srcArray is ignored. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_DEVICE, ::srcDevice and ::srcPitch + * specify the (device) base address of the source data and the bytes per row + * to apply. ::srcArray is ignored. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_ARRAY, ::srcArray specifies the + * handle of the source data. ::srcHost, ::srcDevice and ::srcPitch are + * ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::dstDevice and ::dstPitch + * specify the (unified virtual address space) base address of the source data + * and the bytes per row to apply. ::dstArray is ignored. + * This value may be used only if unified addressing is supported in the calling + * context. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_HOST, ::dstHost and ::dstPitch + * specify the (host) base address of the destination data and the bytes per + * row to apply. ::dstArray is ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_DEVICE, ::dstDevice and ::dstPitch + * specify the (device) base address of the destination data and the bytes per + * row to apply. ::dstArray is ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_ARRAY, ::dstArray specifies the + * handle of the destination data. ::dstHost, ::dstDevice and ::dstPitch are + * ignored. + * + * - ::srcXInBytes and ::srcY specify the base address of the source data for + * the copy. + * + * \par + * For host pointers, the starting address is + * \code + void* Start = (void*)((char*)srcHost+srcY*srcPitch + srcXInBytes); + * \endcode + * + * \par + * For device pointers, the starting address is + * \code + CUdeviceptr Start = srcDevice+srcY*srcPitch+srcXInBytes; + * \endcode + * + * \par + * For CUDA arrays, ::srcXInBytes must be evenly divisible by the array + * element size. + * + * - ::dstXInBytes and ::dstY specify the base address of the destination data + * for the copy. + * + * \par + * For host pointers, the base address is + * \code + void* dstStart = (void*)((char*)dstHost+dstY*dstPitch + dstXInBytes); + * \endcode + * + * \par + * For device pointers, the starting address is + * \code + CUdeviceptr dstStart = dstDevice+dstY*dstPitch+dstXInBytes; + * \endcode + * + * \par + * For CUDA arrays, ::dstXInBytes must be evenly divisible by the array + * element size. + * + * - ::WidthInBytes and ::Height specify the width (in bytes) and height of + * the 2D copy being performed. + * - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + + * ::srcXInBytes, and ::dstPitch must be greater than or equal to + * ::WidthInBytes + dstXInBytes. + * + * \par + * ::cuMemcpy2D() returns an error if any pitch is greater than the maximum + * allowed (::CU_DEVICE_ATTRIBUTE_MAX_PITCH). ::cuMemAllocPitch() passes back + * pitches that always work with ::cuMemcpy2D(). On intra-device memory copies + * (device to device, CUDA array to device, CUDA array to CUDA array), + * ::cuMemcpy2D() may fail for pitches not computed by ::cuMemAllocPitch(). + * ::cuMemcpy2DUnaligned() does not have this restriction, but may run + * significantly slower in the cases where ::cuMemcpy2D() would have returned + * an error code. + * + * \param pCopy - Parameters for the memory copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, + * ::cudaMemcpy2DFromArray + */ +CUresult CUDAAPI cuMemcpy2DUnaligned(const CUDA_MEMCPY2D *pCopy); + +/** + * \brief Copies memory for 3D arrays + * + * Perform a 3D memory copy according to the parameters specified in + * \p pCopy. The ::CUDA_MEMCPY3D structure is defined as: + * + * \code + typedef struct CUDA_MEMCPY3D_st { + + unsigned int srcXInBytes, srcY, srcZ; + unsigned int srcLOD; + CUmemorytype srcMemoryType; + const void *srcHost; + CUdeviceptr srcDevice; + CUarray srcArray; + unsigned int srcPitch; // ignored when src is array + unsigned int srcHeight; // ignored when src is array; may be 0 if Depth==1 + + unsigned int dstXInBytes, dstY, dstZ; + unsigned int dstLOD; + CUmemorytype dstMemoryType; + void *dstHost; + CUdeviceptr dstDevice; + CUarray dstArray; + unsigned int dstPitch; // ignored when dst is array + unsigned int dstHeight; // ignored when dst is array; may be 0 if Depth==1 + + unsigned int WidthInBytes; + unsigned int Height; + unsigned int Depth; + } CUDA_MEMCPY3D; + * \endcode + * where: + * - ::srcMemoryType and ::dstMemoryType specify the type of memory of the + * source and destination, respectively; ::CUmemorytype_enum is defined as: + * + * \code + typedef enum CUmemorytype_enum { + CU_MEMORYTYPE_HOST = 0x01, + CU_MEMORYTYPE_DEVICE = 0x02, + CU_MEMORYTYPE_ARRAY = 0x03, + CU_MEMORYTYPE_UNIFIED = 0x04 + } CUmemorytype; + * \endcode + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::srcDevice and ::srcPitch + * specify the (unified virtual address space) base address of the source data + * and the bytes per row to apply. ::srcArray is ignored. + * This value may be used only if unified addressing is supported in the calling + * context. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_HOST, ::srcHost, ::srcPitch and + * ::srcHeight specify the (host) base address of the source data, the bytes + * per row, and the height of each 2D slice of the 3D array. ::srcArray is + * ignored. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_DEVICE, ::srcDevice, ::srcPitch and + * ::srcHeight specify the (device) base address of the source data, the bytes + * per row, and the height of each 2D slice of the 3D array. ::srcArray is + * ignored. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_ARRAY, ::srcArray specifies the + * handle of the source data. ::srcHost, ::srcDevice, ::srcPitch and + * ::srcHeight are ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::dstDevice and ::dstPitch + * specify the (unified virtual address space) base address of the source data + * and the bytes per row to apply. ::dstArray is ignored. + * This value may be used only if unified addressing is supported in the calling + * context. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_HOST, ::dstHost and ::dstPitch + * specify the (host) base address of the destination data, the bytes per row, + * and the height of each 2D slice of the 3D array. ::dstArray is ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_DEVICE, ::dstDevice and ::dstPitch + * specify the (device) base address of the destination data, the bytes per + * row, and the height of each 2D slice of the 3D array. ::dstArray is ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_ARRAY, ::dstArray specifies the + * handle of the destination data. ::dstHost, ::dstDevice, ::dstPitch and + * ::dstHeight are ignored. + * + * - ::srcXInBytes, ::srcY and ::srcZ specify the base address of the source + * data for the copy. + * + * \par + * For host pointers, the starting address is + * \code + void* Start = (void*)((char*)srcHost+(srcZ*srcHeight+srcY)*srcPitch + srcXInBytes); + * \endcode + * + * \par + * For device pointers, the starting address is + * \code + CUdeviceptr Start = srcDevice+(srcZ*srcHeight+srcY)*srcPitch+srcXInBytes; + * \endcode + * + * \par + * For CUDA arrays, ::srcXInBytes must be evenly divisible by the array + * element size. + * + * - dstXInBytes, ::dstY and ::dstZ specify the base address of the + * destination data for the copy. + * + * \par + * For host pointers, the base address is + * \code + void* dstStart = (void*)((char*)dstHost+(dstZ*dstHeight+dstY)*dstPitch + dstXInBytes); + * \endcode + * + * \par + * For device pointers, the starting address is + * \code + CUdeviceptr dstStart = dstDevice+(dstZ*dstHeight+dstY)*dstPitch+dstXInBytes; + * \endcode + * + * \par + * For CUDA arrays, ::dstXInBytes must be evenly divisible by the array + * element size. + * + * - ::WidthInBytes, ::Height and ::Depth specify the width (in bytes), height + * and depth of the 3D copy being performed. + * - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + + * ::srcXInBytes, and ::dstPitch must be greater than or equal to + * ::WidthInBytes + dstXInBytes. + * - If specified, ::srcHeight must be greater than or equal to ::Height + + * ::srcY, and ::dstHeight must be greater than or equal to ::Height + ::dstY. + * + * \par + * ::cuMemcpy3D() returns an error if any pitch is greater than the maximum + * allowed (::CU_DEVICE_ATTRIBUTE_MAX_PITCH). + * + * The ::srcLOD and ::dstLOD members of the ::CUDA_MEMCPY3D structure must be + * set to 0. + * + * \param pCopy - Parameters for the memory copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMemcpy3D + */ +CUresult CUDAAPI cuMemcpy3D(const CUDA_MEMCPY3D *pCopy); + +/** + * \brief Copies memory between contexts + * + * Perform a 3D memory copy according to the parameters specified in + * \p pCopy. See the definition of the ::CUDA_MEMCPY3D_PEER structure + * for documentation of its parameters. + * + * \param pCopy - Parameters for the memory copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_sync + * + * \sa ::cuMemcpyDtoD, ::cuMemcpyPeer, ::cuMemcpyDtoDAsync, ::cuMemcpyPeerAsync, + * ::cuMemcpy3DPeerAsync, + * ::cudaMemcpy3DPeer + */ +CUresult CUDAAPI cuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER *pCopy); + +/** + * \brief Copies memory asynchronously + * + * Copies data between two pointers. + * \p dst and \p src are base pointers of the destination and source, respectively. + * \p ByteCount specifies the number of bytes to copy. + * Note that this function infers the type of the transfer (host to host, host to + * device, device to device, or device to host) from the pointer values. This + * function is only allowed in contexts which support unified addressing. + * + * \param dst - Destination unified virtual address space pointer + * \param src - Source unified virtual address space pointer + * \param ByteCount - Size of memory copy in bytes + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * \note_async + * \note_null_stream + * \note_memcpy + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemcpyAsync, + * ::cudaMemcpyToSymbolAsync, + * ::cudaMemcpyFromSymbolAsync + */ +CUresult CUDAAPI cuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream); + +/** + * \brief Copies device memory between two contexts asynchronously. + * + * Copies from device memory in one context to device memory in another + * context. \p dstDevice is the base device pointer of the destination memory + * and \p dstContext is the destination context. \p srcDevice is the base + * device pointer of the source memory and \p srcContext is the source pointer. + * \p ByteCount specifies the number of bytes to copy. + * + * \param dstDevice - Destination device pointer + * \param dstContext - Destination context + * \param srcDevice - Source device pointer + * \param srcContext - Source context + * \param ByteCount - Size of memory copy in bytes + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * \note_async + * \note_null_stream + * + * \sa ::cuMemcpyDtoD, ::cuMemcpyPeer, ::cuMemcpy3DPeer, ::cuMemcpyDtoDAsync, + * ::cuMemcpy3DPeerAsync, + * ::cudaMemcpyPeerAsync + */ +CUresult CUDAAPI cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream); + +/** + * \brief Copies memory from Host to Device + * + * Copies from host memory to device memory. \p dstDevice and \p srcHost are + * the base addresses of the destination and source, respectively. \p ByteCount + * specifies the number of bytes to copy. + * + * \param dstDevice - Destination device pointer + * \param srcHost - Source host pointer + * \param ByteCount - Size of memory copy in bytes + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * \note_async + * \note_null_stream + * \note_memcpy + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemcpyAsync, + * ::cudaMemcpyToSymbolAsync + */ +CUresult CUDAAPI cuMemcpyHtoDAsync(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream); + +/** + * \brief Copies memory from Device to Host + * + * Copies from device to host memory. \p dstHost and \p srcDevice specify the + * base pointers of the destination and source, respectively. \p ByteCount + * specifies the number of bytes to copy. + * + * \param dstHost - Destination host pointer + * \param srcDevice - Source device pointer + * \param ByteCount - Size of memory copy in bytes + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * \note_async + * \note_null_stream + * \note_memcpy + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemcpyAsync, + * ::cudaMemcpyFromSymbolAsync + */ +CUresult CUDAAPI cuMemcpyDtoHAsync(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); + +/** + * \brief Copies memory from Device to Device + * + * Copies from device memory to device memory. \p dstDevice and \p srcDevice + * are the base pointers of the destination and source, respectively. + * \p ByteCount specifies the number of bytes to copy. + * + * \param dstDevice - Destination device pointer + * \param srcDevice - Source device pointer + * \param ByteCount - Size of memory copy in bytes + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * \note_async + * \note_null_stream + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemcpyAsync, + * ::cudaMemcpyToSymbolAsync, + * ::cudaMemcpyFromSymbolAsync + */ +CUresult CUDAAPI cuMemcpyDtoDAsync(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); + +/** + * \brief Copies memory from Host to Array + * + * Copies from host memory to a 1D CUDA array. \p dstArray and \p dstOffset + * specify the CUDA array handle and starting offset in bytes of the + * destination data. \p srcHost specifies the base address of the source. + * \p ByteCount specifies the number of bytes to copy. + * + * \param dstArray - Destination array + * \param dstOffset - Offset in bytes of destination array + * \param srcHost - Source host pointer + * \param ByteCount - Size of memory copy in bytes + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * \note_async + * \note_null_stream + * \note_memcpy + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemcpyToArrayAsync + */ +CUresult CUDAAPI cuMemcpyHtoAAsync(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount, CUstream hStream); + +/** + * \brief Copies memory from Array to Host + * + * Copies from one 1D CUDA array to host memory. \p dstHost specifies the base + * pointer of the destination. \p srcArray and \p srcOffset specify the CUDA + * array handle and starting offset in bytes of the source data. + * \p ByteCount specifies the number of bytes to copy. + * + * \param dstHost - Destination pointer + * \param srcArray - Source array + * \param srcOffset - Offset in bytes of source array + * \param ByteCount - Size of memory copy in bytes + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * \note_async + * \note_null_stream + * \note_memcpy + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemcpyFromArrayAsync + */ +CUresult CUDAAPI cuMemcpyAtoHAsync(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream); + +/** + * \brief Copies memory for 2D arrays + * + * Perform a 2D memory copy according to the parameters specified in \p pCopy. + * The ::CUDA_MEMCPY2D structure is defined as: + * + * \code + typedef struct CUDA_MEMCPY2D_st { + unsigned int srcXInBytes, srcY; + CUmemorytype srcMemoryType; + const void *srcHost; + CUdeviceptr srcDevice; + CUarray srcArray; + unsigned int srcPitch; + unsigned int dstXInBytes, dstY; + CUmemorytype dstMemoryType; + void *dstHost; + CUdeviceptr dstDevice; + CUarray dstArray; + unsigned int dstPitch; + unsigned int WidthInBytes; + unsigned int Height; + } CUDA_MEMCPY2D; + * \endcode + * where: + * - ::srcMemoryType and ::dstMemoryType specify the type of memory of the + * source and destination, respectively; ::CUmemorytype_enum is defined as: + * + * \code + typedef enum CUmemorytype_enum { + CU_MEMORYTYPE_HOST = 0x01, + CU_MEMORYTYPE_DEVICE = 0x02, + CU_MEMORYTYPE_ARRAY = 0x03, + CU_MEMORYTYPE_UNIFIED = 0x04 + } CUmemorytype; + * \endcode + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_HOST, ::srcHost and ::srcPitch + * specify the (host) base address of the source data and the bytes per row to + * apply. ::srcArray is ignored. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::srcDevice and ::srcPitch + * specify the (unified virtual address space) base address of the source data + * and the bytes per row to apply. ::srcArray is ignored. + * This value may be used only if unified addressing is supported in the calling + * context. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_DEVICE, ::srcDevice and ::srcPitch + * specify the (device) base address of the source data and the bytes per row + * to apply. ::srcArray is ignored. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_ARRAY, ::srcArray specifies the + * handle of the source data. ::srcHost, ::srcDevice and ::srcPitch are + * ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::dstDevice and ::dstPitch + * specify the (unified virtual address space) base address of the source data + * and the bytes per row to apply. ::dstArray is ignored. + * This value may be used only if unified addressing is supported in the calling + * context. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_HOST, ::dstHost and ::dstPitch + * specify the (host) base address of the destination data and the bytes per + * row to apply. ::dstArray is ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_DEVICE, ::dstDevice and ::dstPitch + * specify the (device) base address of the destination data and the bytes per + * row to apply. ::dstArray is ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_ARRAY, ::dstArray specifies the + * handle of the destination data. ::dstHost, ::dstDevice and ::dstPitch are + * ignored. + * + * - ::srcXInBytes and ::srcY specify the base address of the source data for + * the copy. + * + * \par + * For host pointers, the starting address is + * \code + void* Start = (void*)((char*)srcHost+srcY*srcPitch + srcXInBytes); + * \endcode + * + * \par + * For device pointers, the starting address is + * \code + CUdeviceptr Start = srcDevice+srcY*srcPitch+srcXInBytes; + * \endcode + * + * \par + * For CUDA arrays, ::srcXInBytes must be evenly divisible by the array + * element size. + * + * - ::dstXInBytes and ::dstY specify the base address of the destination data + * for the copy. + * + * \par + * For host pointers, the base address is + * \code + void* dstStart = (void*)((char*)dstHost+dstY*dstPitch + dstXInBytes); + * \endcode + * + * \par + * For device pointers, the starting address is + * \code + CUdeviceptr dstStart = dstDevice+dstY*dstPitch+dstXInBytes; + * \endcode + * + * \par + * For CUDA arrays, ::dstXInBytes must be evenly divisible by the array + * element size. + * + * - ::WidthInBytes and ::Height specify the width (in bytes) and height of + * the 2D copy being performed. + * - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + + * ::srcXInBytes, and ::dstPitch must be greater than or equal to + * ::WidthInBytes + dstXInBytes. + * - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + + * ::srcXInBytes, and ::dstPitch must be greater than or equal to + * ::WidthInBytes + dstXInBytes. + * - If specified, ::srcHeight must be greater than or equal to ::Height + + * ::srcY, and ::dstHeight must be greater than or equal to ::Height + ::dstY. + * + * \par + * ::cuMemcpy2DAsync() returns an error if any pitch is greater than the maximum + * allowed (::CU_DEVICE_ATTRIBUTE_MAX_PITCH). ::cuMemAllocPitch() passes back + * pitches that always work with ::cuMemcpy2D(). On intra-device memory copies + * (device to device, CUDA array to device, CUDA array to CUDA array), + * ::cuMemcpy2DAsync() may fail for pitches not computed by ::cuMemAllocPitch(). + * + * \param pCopy - Parameters for the memory copy + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * \note_async + * \note_null_stream + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync + */ +CUresult CUDAAPI cuMemcpy2DAsync(const CUDA_MEMCPY2D *pCopy, CUstream hStream); + +/** + * \brief Copies memory for 3D arrays + * + * Perform a 3D memory copy according to the parameters specified in + * \p pCopy. The ::CUDA_MEMCPY3D structure is defined as: + * + * \code + typedef struct CUDA_MEMCPY3D_st { + + unsigned int srcXInBytes, srcY, srcZ; + unsigned int srcLOD; + CUmemorytype srcMemoryType; + const void *srcHost; + CUdeviceptr srcDevice; + CUarray srcArray; + unsigned int srcPitch; // ignored when src is array + unsigned int srcHeight; // ignored when src is array; may be 0 if Depth==1 + + unsigned int dstXInBytes, dstY, dstZ; + unsigned int dstLOD; + CUmemorytype dstMemoryType; + void *dstHost; + CUdeviceptr dstDevice; + CUarray dstArray; + unsigned int dstPitch; // ignored when dst is array + unsigned int dstHeight; // ignored when dst is array; may be 0 if Depth==1 + + unsigned int WidthInBytes; + unsigned int Height; + unsigned int Depth; + } CUDA_MEMCPY3D; + * \endcode + * where: + * - ::srcMemoryType and ::dstMemoryType specify the type of memory of the + * source and destination, respectively; ::CUmemorytype_enum is defined as: + * + * \code + typedef enum CUmemorytype_enum { + CU_MEMORYTYPE_HOST = 0x01, + CU_MEMORYTYPE_DEVICE = 0x02, + CU_MEMORYTYPE_ARRAY = 0x03, + CU_MEMORYTYPE_UNIFIED = 0x04 + } CUmemorytype; + * \endcode + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::srcDevice and ::srcPitch + * specify the (unified virtual address space) base address of the source data + * and the bytes per row to apply. ::srcArray is ignored. + * This value may be used only if unified addressing is supported in the calling + * context. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_HOST, ::srcHost, ::srcPitch and + * ::srcHeight specify the (host) base address of the source data, the bytes + * per row, and the height of each 2D slice of the 3D array. ::srcArray is + * ignored. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_DEVICE, ::srcDevice, ::srcPitch and + * ::srcHeight specify the (device) base address of the source data, the bytes + * per row, and the height of each 2D slice of the 3D array. ::srcArray is + * ignored. + * + * \par + * If ::srcMemoryType is ::CU_MEMORYTYPE_ARRAY, ::srcArray specifies the + * handle of the source data. ::srcHost, ::srcDevice, ::srcPitch and + * ::srcHeight are ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_UNIFIED, ::dstDevice and ::dstPitch + * specify the (unified virtual address space) base address of the source data + * and the bytes per row to apply. ::dstArray is ignored. + * This value may be used only if unified addressing is supported in the calling + * context. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_HOST, ::dstHost and ::dstPitch + * specify the (host) base address of the destination data, the bytes per row, + * and the height of each 2D slice of the 3D array. ::dstArray is ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_DEVICE, ::dstDevice and ::dstPitch + * specify the (device) base address of the destination data, the bytes per + * row, and the height of each 2D slice of the 3D array. ::dstArray is ignored. + * + * \par + * If ::dstMemoryType is ::CU_MEMORYTYPE_ARRAY, ::dstArray specifies the + * handle of the destination data. ::dstHost, ::dstDevice, ::dstPitch and + * ::dstHeight are ignored. + * + * - ::srcXInBytes, ::srcY and ::srcZ specify the base address of the source + * data for the copy. + * + * \par + * For host pointers, the starting address is + * \code + void* Start = (void*)((char*)srcHost+(srcZ*srcHeight+srcY)*srcPitch + srcXInBytes); + * \endcode + * + * \par + * For device pointers, the starting address is + * \code + CUdeviceptr Start = srcDevice+(srcZ*srcHeight+srcY)*srcPitch+srcXInBytes; + * \endcode + * + * \par + * For CUDA arrays, ::srcXInBytes must be evenly divisible by the array + * element size. + * + * - dstXInBytes, ::dstY and ::dstZ specify the base address of the + * destination data for the copy. + * + * \par + * For host pointers, the base address is + * \code + void* dstStart = (void*)((char*)dstHost+(dstZ*dstHeight+dstY)*dstPitch + dstXInBytes); + * \endcode + * + * \par + * For device pointers, the starting address is + * \code + CUdeviceptr dstStart = dstDevice+(dstZ*dstHeight+dstY)*dstPitch+dstXInBytes; + * \endcode + * + * \par + * For CUDA arrays, ::dstXInBytes must be evenly divisible by the array + * element size. + * + * - ::WidthInBytes, ::Height and ::Depth specify the width (in bytes), height + * and depth of the 3D copy being performed. + * - If specified, ::srcPitch must be greater than or equal to ::WidthInBytes + + * ::srcXInBytes, and ::dstPitch must be greater than or equal to + * ::WidthInBytes + dstXInBytes. + * - If specified, ::srcHeight must be greater than or equal to ::Height + + * ::srcY, and ::dstHeight must be greater than or equal to ::Height + ::dstY. + * + * \par + * ::cuMemcpy3DAsync() returns an error if any pitch is greater than the maximum + * allowed (::CU_DEVICE_ATTRIBUTE_MAX_PITCH). + * + * The ::srcLOD and ::dstLOD members of the ::CUDA_MEMCPY3D structure must be + * set to 0. + * + * \param pCopy - Parameters for the memory copy + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * \note_async + * \note_null_stream + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemcpy3DAsync + */ +CUresult CUDAAPI cuMemcpy3DAsync(const CUDA_MEMCPY3D *pCopy, CUstream hStream); + +/** + * \brief Copies memory between contexts asynchronously. + * + * Perform a 3D memory copy according to the parameters specified in + * \p pCopy. See the definition of the ::CUDA_MEMCPY3D_PEER structure + * for documentation of its parameters. + * + * \param pCopy - Parameters for the memory copy + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_async + * \note_null_stream + * + * \sa ::cuMemcpyDtoD, ::cuMemcpyPeer, ::cuMemcpyDtoDAsync, ::cuMemcpyPeerAsync, + * ::cuMemcpy3DPeerAsync, + * ::cudaMemcpy3DPeerAsync + */ +CUresult CUDAAPI cuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER *pCopy, CUstream hStream); + +/** + * \brief Initializes device memory + * + * Sets the memory range of \p N 8-bit values to the specified value + * \p uc. + * + * \param dstDevice - Destination device pointer + * \param uc - Value to set + * \param N - Number of elements + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemset + */ +CUresult CUDAAPI cuMemsetD8(CUdeviceptr dstDevice, unsigned char uc, size_t N); + +/** + * \brief Initializes device memory + * + * Sets the memory range of \p N 16-bit values to the specified value + * \p us. The \p dstDevice pointer must be two byte aligned. + * + * \param dstDevice - Destination device pointer + * \param us - Value to set + * \param N - Number of elements + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemset + */ +CUresult CUDAAPI cuMemsetD16(CUdeviceptr dstDevice, unsigned short us, size_t N); + +/** + * \brief Initializes device memory + * + * Sets the memory range of \p N 32-bit values to the specified value + * \p ui. The \p dstDevice pointer must be four byte aligned. + * + * \param dstDevice - Destination device pointer + * \param ui - Value to set + * \param N - Number of elements + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32Async, + * ::cudaMemset + */ +CUresult CUDAAPI cuMemsetD32(CUdeviceptr dstDevice, unsigned int ui, size_t N); + +/** + * \brief Initializes device memory + * + * Sets the 2D memory range of \p Width 8-bit values to the specified value + * \p uc. \p Height specifies the number of rows to set, and \p dstPitch + * specifies the number of bytes between each row. This function performs + * fastest when the pitch is one that has been passed back by + * ::cuMemAllocPitch(). + * + * \param dstDevice - Destination device pointer + * \param dstPitch - Pitch of destination device pointer(Unused if \p Height is 1) + * \param uc - Value to set + * \param Width - Width of row + * \param Height - Number of rows + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemset2D + */ +CUresult CUDAAPI cuMemsetD2D8(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height); + +/** + * \brief Initializes device memory + * + * Sets the 2D memory range of \p Width 16-bit values to the specified value + * \p us. \p Height specifies the number of rows to set, and \p dstPitch + * specifies the number of bytes between each row. The \p dstDevice pointer + * and \p dstPitch offset must be two byte aligned. This function performs + * fastest when the pitch is one that has been passed back by + * ::cuMemAllocPitch(). + * + * \param dstDevice - Destination device pointer + * \param dstPitch - Pitch of destination device pointer(Unused if \p Height is 1) + * \param us - Value to set + * \param Width - Width of row + * \param Height - Number of rows + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemset2D + */ +CUresult CUDAAPI cuMemsetD2D16(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height); + +/** + * \brief Initializes device memory + * + * Sets the 2D memory range of \p Width 32-bit values to the specified value + * \p ui. \p Height specifies the number of rows to set, and \p dstPitch + * specifies the number of bytes between each row. The \p dstDevice pointer + * and \p dstPitch offset must be four byte aligned. This function performs + * fastest when the pitch is one that has been passed back by + * ::cuMemAllocPitch(). + * + * \param dstDevice - Destination device pointer + * \param dstPitch - Pitch of destination device pointer(Unused if \p Height is 1) + * \param ui - Value to set + * \param Width - Width of row + * \param Height - Number of rows + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemset2D + */ +CUresult CUDAAPI cuMemsetD2D32(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height); + +/** + * \brief Sets device memory + * + * Sets the memory range of \p N 8-bit values to the specified value + * \p uc. + * + * \param dstDevice - Destination device pointer + * \param uc - Value to set + * \param N - Number of elements + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * \note_null_stream + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemsetAsync + */ +CUresult CUDAAPI cuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream); + +/** + * \brief Sets device memory + * + * Sets the memory range of \p N 16-bit values to the specified value + * \p us. The \p dstDevice pointer must be two byte aligned. + * + * \param dstDevice - Destination device pointer + * \param us - Value to set + * \param N - Number of elements + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * \note_null_stream + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemsetAsync + */ +CUresult CUDAAPI cuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream); + +/** + * \brief Sets device memory + * + * Sets the memory range of \p N 32-bit values to the specified value + * \p ui. The \p dstDevice pointer must be four byte aligned. + * + * \param dstDevice - Destination device pointer + * \param ui - Value to set + * \param N - Number of elements + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * \note_null_stream + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, ::cuMemsetD32, + * ::cudaMemsetAsync + */ +CUresult CUDAAPI cuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream); + +/** + * \brief Sets device memory + * + * Sets the 2D memory range of \p Width 8-bit values to the specified value + * \p uc. \p Height specifies the number of rows to set, and \p dstPitch + * specifies the number of bytes between each row. This function performs + * fastest when the pitch is one that has been passed back by + * ::cuMemAllocPitch(). + * + * \param dstDevice - Destination device pointer + * \param dstPitch - Pitch of destination device pointer(Unused if \p Height is 1) + * \param uc - Value to set + * \param Width - Width of row + * \param Height - Number of rows + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * \note_null_stream + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemset2DAsync + */ +CUresult CUDAAPI cuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream); + +/** + * \brief Sets device memory + * + * Sets the 2D memory range of \p Width 16-bit values to the specified value + * \p us. \p Height specifies the number of rows to set, and \p dstPitch + * specifies the number of bytes between each row. The \p dstDevice pointer + * and \p dstPitch offset must be two byte aligned. This function performs + * fastest when the pitch is one that has been passed back by + * ::cuMemAllocPitch(). + * + * \param dstDevice - Destination device pointer + * \param dstPitch - Pitch of destination device pointer(Unused if \p Height is 1) + * \param us - Value to set + * \param Width - Width of row + * \param Height - Number of rows + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * \note_null_stream + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D32, ::cuMemsetD2D32Async, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemset2DAsync + */ +CUresult CUDAAPI cuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream); + +/** + * \brief Sets device memory + * + * Sets the 2D memory range of \p Width 32-bit values to the specified value + * \p ui. \p Height specifies the number of rows to set, and \p dstPitch + * specifies the number of bytes between each row. The \p dstDevice pointer + * and \p dstPitch offset must be four byte aligned. This function performs + * fastest when the pitch is one that has been passed back by + * ::cuMemAllocPitch(). + * + * \param dstDevice - Destination device pointer + * \param dstPitch - Pitch of destination device pointer(Unused if \p Height is 1) + * \param ui - Value to set + * \param Width - Width of row + * \param Height - Number of rows + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * \note_memset + * \note_null_stream + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D8Async, + * ::cuMemsetD2D16, ::cuMemsetD2D16Async, ::cuMemsetD2D32, + * ::cuMemsetD8, ::cuMemsetD8Async, ::cuMemsetD16, ::cuMemsetD16Async, + * ::cuMemsetD32, ::cuMemsetD32Async, + * ::cudaMemset2DAsync + */ +CUresult CUDAAPI cuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream); + +/** + * \brief Creates a 1D or 2D CUDA array + * + * Creates a CUDA array according to the ::CUDA_ARRAY_DESCRIPTOR structure + * \p pAllocateArray and returns a handle to the new CUDA array in \p *pHandle. + * The ::CUDA_ARRAY_DESCRIPTOR is defined as: + * + * \code + typedef struct { + unsigned int Width; + unsigned int Height; + CUarray_format Format; + unsigned int NumChannels; + } CUDA_ARRAY_DESCRIPTOR; + * \endcode + * where: + * + * - \p Width, and \p Height are the width, and height of the CUDA array (in + * elements); the CUDA array is one-dimensional if height is 0, two-dimensional + * otherwise; + * - ::Format specifies the format of the elements; ::CUarray_format is + * defined as: + * \code + typedef enum CUarray_format_enum { + CU_AD_FORMAT_UNSIGNED_INT8 = 0x01, + CU_AD_FORMAT_UNSIGNED_INT16 = 0x02, + CU_AD_FORMAT_UNSIGNED_INT32 = 0x03, + CU_AD_FORMAT_SIGNED_INT8 = 0x08, + CU_AD_FORMAT_SIGNED_INT16 = 0x09, + CU_AD_FORMAT_SIGNED_INT32 = 0x0a, + CU_AD_FORMAT_HALF = 0x10, + CU_AD_FORMAT_FLOAT = 0x20 + } CUarray_format; + * \endcode + * - \p NumChannels specifies the number of packed components per CUDA array + * element; it may be 1, 2, or 4; + * + * Here are examples of CUDA array descriptions: + * + * Description for a CUDA array of 2048 floats: + * \code + CUDA_ARRAY_DESCRIPTOR desc; + desc.Format = CU_AD_FORMAT_FLOAT; + desc.NumChannels = 1; + desc.Width = 2048; + desc.Height = 1; + * \endcode + * + * Description for a 64 x 64 CUDA array of floats: + * \code + CUDA_ARRAY_DESCRIPTOR desc; + desc.Format = CU_AD_FORMAT_FLOAT; + desc.NumChannels = 1; + desc.Width = 64; + desc.Height = 64; + * \endcode + * + * Description for a \p width x \p height CUDA array of 64-bit, 4x16-bit + * float16's: + * \code + CUDA_ARRAY_DESCRIPTOR desc; + desc.Format = CU_AD_FORMAT_HALF; + desc.NumChannels = 4; + desc.Width = width; + desc.Height = height; + * \endcode + * + * Description for a \p width x \p height CUDA array of 16-bit elements, each + * of which is two 8-bit unsigned chars: + * \code + CUDA_ARRAY_DESCRIPTOR arrayDesc; + desc.Format = CU_AD_FORMAT_UNSIGNED_INT8; + desc.NumChannels = 2; + desc.Width = width; + desc.Height = height; + * \endcode + * + * \param pHandle - Returned array + * \param pAllocateArray - Array descriptor + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMallocArray + */ +CUresult CUDAAPI cuArrayCreate(CUarray *pHandle, const CUDA_ARRAY_DESCRIPTOR *pAllocateArray); + +/** + * \brief Get a 1D or 2D CUDA array descriptor + * + * Returns in \p *pArrayDescriptor a descriptor containing information on the + * format and dimensions of the CUDA array \p hArray. It is useful for + * subroutines that have been passed a CUDA array, but need to know the CUDA + * array parameters for validation or other purposes. + * + * \param pArrayDescriptor - Returned array descriptor + * \param hArray - Array to get descriptor of + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaArrayGetInfo + */ +CUresult CUDAAPI cuArrayGetDescriptor(CUDA_ARRAY_DESCRIPTOR *pArrayDescriptor, CUarray hArray); + +/** + * \brief Returns the layout properties of a sparse CUDA array + * + * Returns the layout properties of a sparse CUDA array in \p sparseProperties + * If the CUDA array is not allocated with flag ::CUDA_ARRAY3D_SPARSE + * ::CUDA_ERROR_INVALID_VALUE will be returned. + * + * If the returned value in ::CUDA_ARRAY_SPARSE_PROPERTIES::flags contains ::CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL, + * then ::CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize represents the total size of the array. Otherwise, it will be zero. + * Also, the returned value in ::CUDA_ARRAY_SPARSE_PROPERTIES::miptailFirstLevel is always zero. + * Note that the \p array must have been allocated using ::cuArrayCreate or ::cuArray3DCreate. For CUDA arrays obtained + * using ::cuMipmappedArrayGetLevel, ::CUDA_ERROR_INVALID_VALUE will be returned. Instead, ::cuMipmappedArrayGetSparseProperties + * must be used to obtain the sparse properties of the entire CUDA mipmapped array to which \p array belongs to. + * + * \return + * ::CUDA_SUCCESS + * ::CUDA_ERROR_INVALID_VALUE + * + * \param[out] sparseProperties - Pointer to ::CUDA_ARRAY_SPARSE_PROPERTIES + * \param[in] array - CUDA array to get the sparse properties of + * \sa ::cuMipmappedArrayGetSparseProperties, ::cuMemMapArrayAsync + */ +CUresult CUDAAPI cuArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES *sparseProperties, CUarray array); + +/** + * \brief Returns the layout properties of a sparse CUDA mipmapped array + * + * Returns the sparse array layout properties in \p sparseProperties + * If the CUDA mipmapped array is not allocated with flag ::CUDA_ARRAY3D_SPARSE + * ::CUDA_ERROR_INVALID_VALUE will be returned. + * + * For non-layered CUDA mipmapped arrays, ::CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize returns the + * size of the mip tail region. The mip tail region includes all mip levels whose width, height or depth + * is less than that of the tile. + * For layered CUDA mipmapped arrays, if ::CUDA_ARRAY_SPARSE_PROPERTIES::flags contains ::CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL, + * then ::CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize specifies the size of the mip tail of all layers combined. + * Otherwise, ::CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize specifies mip tail size per layer. + * The returned value of ::CUDA_ARRAY_SPARSE_PROPERTIES::miptailFirstLevel is valid only if ::CUDA_ARRAY_SPARSE_PROPERTIES::miptailSize is non-zero. + * + * \return + * ::CUDA_SUCCESS + * ::CUDA_ERROR_INVALID_VALUE + * + * \param[out] sparseProperties - Pointer to ::CUDA_ARRAY_SPARSE_PROPERTIES + * \param[in] mipmap - CUDA mipmapped array to get the sparse properties of + * \sa ::cuArrayGetSparseProperties, ::cuMemMapArrayAsync + */ +CUresult CUDAAPI cuMipmappedArrayGetSparseProperties(CUDA_ARRAY_SPARSE_PROPERTIES *sparseProperties, CUmipmappedArray mipmap); + +/** + * \brief Returns the memory requirements of a CUDA array + * + * Returns the memory requirements of a CUDA array in \p memoryRequirements + * If the CUDA array is not allocated with flag ::CUDA_ARRAY3D_DEFERRED_MAPPING + * ::CUDA_ERROR_INVALID_VALUE will be returned. + * + * The returned value in ::CUDA_ARRAY_MEMORY_REQUIREMENTS::size + * represents the total size of the CUDA array. + * The returned value in ::CUDA_ARRAY_MEMORY_REQUIREMENTS::alignment + * represents the alignment necessary for mapping the CUDA array. + * + * \return + * ::CUDA_SUCCESS + * ::CUDA_ERROR_INVALID_VALUE + * + * \param[out] memoryRequirements - Pointer to ::CUDA_ARRAY_MEMORY_REQUIREMENTS + * \param[in] array - CUDA array to get the memory requirements of + * \param[in] device - Device to get the memory requirements for + * \sa ::cuMipmappedArrayGetMemoryRequirements, ::cuMemMapArrayAsync + */ +CUresult CUDAAPI cuArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS *memoryRequirements, CUarray array, CUdevice device); + +/** + * \brief Returns the memory requirements of a CUDA mipmapped array + * + * Returns the memory requirements of a CUDA mipmapped array in \p memoryRequirements + * If the CUDA mipmapped array is not allocated with flag ::CUDA_ARRAY3D_DEFERRED_MAPPING + * ::CUDA_ERROR_INVALID_VALUE will be returned. + * + * The returned value in ::CUDA_ARRAY_MEMORY_REQUIREMENTS::size + * represents the total size of the CUDA mipmapped array. + * The returned value in ::CUDA_ARRAY_MEMORY_REQUIREMENTS::alignment + * represents the alignment necessary for mapping the CUDA mipmapped + * array. + * + * \return + * ::CUDA_SUCCESS + * ::CUDA_ERROR_INVALID_VALUE + * + * \param[out] memoryRequirements - Pointer to ::CUDA_ARRAY_MEMORY_REQUIREMENTS + * \param[in] mipmap - CUDA mipmapped array to get the memory requirements of + * \param[in] device - Device to get the memory requirements for + * \sa ::cuArrayGetMemoryRequirements, ::cuMemMapArrayAsync + */ +CUresult CUDAAPI cuMipmappedArrayGetMemoryRequirements(CUDA_ARRAY_MEMORY_REQUIREMENTS *memoryRequirements, CUmipmappedArray mipmap, CUdevice device); + +/** + * \brief Gets a CUDA array plane from a CUDA array + * + * Returns in \p pPlaneArray a CUDA array that represents a single format plane + * of the CUDA array \p hArray. + * + * If \p planeIdx is greater than the maximum number of planes in this array or if the array does + * not have a multi-planar format e.g: ::CU_AD_FORMAT_NV12, then ::CUDA_ERROR_INVALID_VALUE is returned. + * + * Note that if the \p hArray has format ::CU_AD_FORMAT_NV12, then passing in 0 for \p planeIdx returns + * a CUDA array of the same size as \p hArray but with one channel and ::CU_AD_FORMAT_UNSIGNED_INT8 as its format. + * If 1 is passed for \p planeIdx, then the returned CUDA array has half the height and width + * of \p hArray with two channels and ::CU_AD_FORMAT_UNSIGNED_INT8 as its format. + * + * \param pPlaneArray - Returned CUDA array referenced by the \p planeIdx + * \param hArray - Multiplanar CUDA array + * \param planeIdx - Plane index + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa + * ::cuArrayCreate, + * ::cudaArrayGetPlane + */ +CUresult CUDAAPI cuArrayGetPlane(CUarray *pPlaneArray, CUarray hArray, unsigned int planeIdx); + +/** + * \brief Destroys a CUDA array + * + * Destroys the CUDA array \p hArray. + * + * \param hArray - Array to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ARRAY_IS_MAPPED, + * ::CUDA_ERROR_CONTEXT_IS_DESTROYED + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaFreeArray + */ +CUresult CUDAAPI cuArrayDestroy(CUarray hArray); + +/** + * \brief Creates a 3D CUDA array + * + * Creates a CUDA array according to the ::CUDA_ARRAY3D_DESCRIPTOR structure + * \p pAllocateArray and returns a handle to the new CUDA array in \p *pHandle. + * The ::CUDA_ARRAY3D_DESCRIPTOR is defined as: + * + * \code + typedef struct { + unsigned int Width; + unsigned int Height; + unsigned int Depth; + CUarray_format Format; + unsigned int NumChannels; + unsigned int Flags; + } CUDA_ARRAY3D_DESCRIPTOR; + * \endcode + * where: + * + * - \p Width, \p Height, and \p Depth are the width, height, and depth of the + * CUDA array (in elements); the following types of CUDA arrays can be allocated: + * - A 1D array is allocated if \p Height and \p Depth extents are both zero. + * - A 2D array is allocated if only \p Depth extent is zero. + * - A 3D array is allocated if all three extents are non-zero. + * - A 1D layered CUDA array is allocated if only \p Height is zero and the + * ::CUDA_ARRAY3D_LAYERED flag is set. Each layer is a 1D array. The number + * of layers is determined by the depth extent. + * - A 2D layered CUDA array is allocated if all three extents are non-zero and + * the ::CUDA_ARRAY3D_LAYERED flag is set. Each layer is a 2D array. The number + * of layers is determined by the depth extent. + * - A cubemap CUDA array is allocated if all three extents are non-zero and the + * ::CUDA_ARRAY3D_CUBEMAP flag is set. \p Width must be equal to \p Height, and + * \p Depth must be six. A cubemap is a special type of 2D layered CUDA array, + * where the six layers represent the six faces of a cube. The order of the six + * layers in memory is the same as that listed in ::CUarray_cubemap_face. + * - A cubemap layered CUDA array is allocated if all three extents are non-zero, + * and both, ::CUDA_ARRAY3D_CUBEMAP and ::CUDA_ARRAY3D_LAYERED flags are set. + * \p Width must be equal to \p Height, and \p Depth must be a multiple of six. + * A cubemap layered CUDA array is a special type of 2D layered CUDA array that + * consists of a collection of cubemaps. The first six layers represent the first + * cubemap, the next six layers form the second cubemap, and so on. + * + * - ::Format specifies the format of the elements; ::CUarray_format is + * defined as: + * \code + typedef enum CUarray_format_enum { + CU_AD_FORMAT_UNSIGNED_INT8 = 0x01, + CU_AD_FORMAT_UNSIGNED_INT16 = 0x02, + CU_AD_FORMAT_UNSIGNED_INT32 = 0x03, + CU_AD_FORMAT_SIGNED_INT8 = 0x08, + CU_AD_FORMAT_SIGNED_INT16 = 0x09, + CU_AD_FORMAT_SIGNED_INT32 = 0x0a, + CU_AD_FORMAT_HALF = 0x10, + CU_AD_FORMAT_FLOAT = 0x20 + } CUarray_format; + * \endcode + * + * - \p NumChannels specifies the number of packed components per CUDA array + * element; it may be 1, 2, or 4; + * + * - ::Flags may be set to + * - ::CUDA_ARRAY3D_LAYERED to enable creation of layered CUDA arrays. If this flag is set, + * \p Depth specifies the number of layers, not the depth of a 3D array. + * - ::CUDA_ARRAY3D_SURFACE_LDST to enable surface references to be bound to the CUDA array. + * If this flag is not set, ::cuSurfRefSetArray will fail when attempting to bind the CUDA array + * to a surface reference. + * - ::CUDA_ARRAY3D_CUBEMAP to enable creation of cubemaps. If this flag is set, \p Width must be + * equal to \p Height, and \p Depth must be six. If the ::CUDA_ARRAY3D_LAYERED flag is also set, + * then \p Depth must be a multiple of six. + * - ::CUDA_ARRAY3D_TEXTURE_GATHER to indicate that the CUDA array will be used for texture gather. + * Texture gather can only be performed on 2D CUDA arrays. + * + * \p Width, \p Height and \p Depth must meet certain size requirements as listed in the following table. + * All values are specified in elements. Note that for brevity's sake, the full name of the device attribute + * is not specified. For ex., TEXTURE1D_WIDTH refers to the device attribute + * ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH. + * + * Note that 2D CUDA arrays have different size requirements if the ::CUDA_ARRAY3D_TEXTURE_GATHER flag + * is set. \p Width and \p Height must not be greater than ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH + * and ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT respectively, in that case. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
CUDA array typeValid extents that must always be met
{(width range in elements), (height range), + * (depth range)}
Valid extents with CUDA_ARRAY3D_SURFACE_LDST set
+ * {(width range in elements), (height range), (depth range)}
1D{ (1,TEXTURE1D_WIDTH), 0, 0 }{ (1,SURFACE1D_WIDTH), 0, 0 }
2D{ (1,TEXTURE2D_WIDTH), (1,TEXTURE2D_HEIGHT), 0 }{ (1,SURFACE2D_WIDTH), (1,SURFACE2D_HEIGHT), 0 }
3D{ (1,TEXTURE3D_WIDTH), (1,TEXTURE3D_HEIGHT), (1,TEXTURE3D_DEPTH) } + *
OR
{ (1,TEXTURE3D_WIDTH_ALTERNATE), (1,TEXTURE3D_HEIGHT_ALTERNATE), + * (1,TEXTURE3D_DEPTH_ALTERNATE) }
{ (1,SURFACE3D_WIDTH), (1,SURFACE3D_HEIGHT), + * (1,SURFACE3D_DEPTH) }
1D Layered{ (1,TEXTURE1D_LAYERED_WIDTH), 0, + * (1,TEXTURE1D_LAYERED_LAYERS) }{ (1,SURFACE1D_LAYERED_WIDTH), 0, + * (1,SURFACE1D_LAYERED_LAYERS) }
2D Layered{ (1,TEXTURE2D_LAYERED_WIDTH), (1,TEXTURE2D_LAYERED_HEIGHT), + * (1,TEXTURE2D_LAYERED_LAYERS) }{ (1,SURFACE2D_LAYERED_WIDTH), (1,SURFACE2D_LAYERED_HEIGHT), + * (1,SURFACE2D_LAYERED_LAYERS) }
Cubemap{ (1,TEXTURECUBEMAP_WIDTH), (1,TEXTURECUBEMAP_WIDTH), 6 }{ (1,SURFACECUBEMAP_WIDTH), + * (1,SURFACECUBEMAP_WIDTH), 6 }
Cubemap Layered{ (1,TEXTURECUBEMAP_LAYERED_WIDTH), (1,TEXTURECUBEMAP_LAYERED_WIDTH), + * (1,TEXTURECUBEMAP_LAYERED_LAYERS) }{ (1,SURFACECUBEMAP_LAYERED_WIDTH), (1,SURFACECUBEMAP_LAYERED_WIDTH), + * (1,SURFACECUBEMAP_LAYERED_LAYERS) }
+ * + * Here are examples of CUDA array descriptions: + * + * Description for a CUDA array of 2048 floats: + * \code + CUDA_ARRAY3D_DESCRIPTOR desc; + desc.Format = CU_AD_FORMAT_FLOAT; + desc.NumChannels = 1; + desc.Width = 2048; + desc.Height = 0; + desc.Depth = 0; + * \endcode + * + * Description for a 64 x 64 CUDA array of floats: + * \code + CUDA_ARRAY3D_DESCRIPTOR desc; + desc.Format = CU_AD_FORMAT_FLOAT; + desc.NumChannels = 1; + desc.Width = 64; + desc.Height = 64; + desc.Depth = 0; + * \endcode + * + * Description for a \p width x \p height x \p depth CUDA array of 64-bit, + * 4x16-bit float16's: + * \code + CUDA_ARRAY3D_DESCRIPTOR desc; + desc.Format = CU_AD_FORMAT_HALF; + desc.NumChannels = 4; + desc.Width = width; + desc.Height = height; + desc.Depth = depth; + * \endcode + * + * \param pHandle - Returned array + * \param pAllocateArray - 3D array descriptor + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuArray3DGetDescriptor, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaMalloc3DArray + */ +CUresult CUDAAPI cuArray3DCreate(CUarray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR *pAllocateArray); + +/** + * \brief Get a 3D CUDA array descriptor + * + * Returns in \p *pArrayDescriptor a descriptor containing information on the + * format and dimensions of the CUDA array \p hArray. It is useful for + * subroutines that have been passed a CUDA array, but need to know the CUDA + * array parameters for validation or other purposes. + * + * This function may be called on 1D and 2D arrays, in which case the \p Height + * and/or \p Depth members of the descriptor struct will be set to 0. + * + * \param pArrayDescriptor - Returned 3D array descriptor + * \param hArray - 3D array to get descriptor of + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_CONTEXT_IS_DESTROYED + * \notefnerr + * + * \sa ::cuArray3DCreate, ::cuArrayCreate, + * ::cuArrayDestroy, ::cuArrayGetDescriptor, ::cuMemAlloc, ::cuMemAllocHost, + * ::cuMemAllocPitch, ::cuMemcpy2D, ::cuMemcpy2DAsync, ::cuMemcpy2DUnaligned, + * ::cuMemcpy3D, ::cuMemcpy3DAsync, ::cuMemcpyAtoA, ::cuMemcpyAtoD, + * ::cuMemcpyAtoH, ::cuMemcpyAtoHAsync, ::cuMemcpyDtoA, ::cuMemcpyDtoD, ::cuMemcpyDtoDAsync, + * ::cuMemcpyDtoH, ::cuMemcpyDtoHAsync, ::cuMemcpyHtoA, ::cuMemcpyHtoAAsync, + * ::cuMemcpyHtoD, ::cuMemcpyHtoDAsync, ::cuMemFree, ::cuMemFreeHost, + * ::cuMemGetAddressRange, ::cuMemGetInfo, ::cuMemHostAlloc, + * ::cuMemHostGetDevicePointer, ::cuMemsetD2D8, ::cuMemsetD2D16, + * ::cuMemsetD2D32, ::cuMemsetD8, ::cuMemsetD16, ::cuMemsetD32, + * ::cudaArrayGetInfo + */ +CUresult CUDAAPI cuArray3DGetDescriptor(CUDA_ARRAY3D_DESCRIPTOR *pArrayDescriptor, CUarray hArray); + +/** + * \brief Creates a CUDA mipmapped array + * + * Creates a CUDA mipmapped array according to the ::CUDA_ARRAY3D_DESCRIPTOR structure + * \p pMipmappedArrayDesc and returns a handle to the new CUDA mipmapped array in \p *pHandle. + * \p numMipmapLevels specifies the number of mipmap levels to be allocated. This value is + * clamped to the range [1, 1 + floor(log2(max(width, height, depth)))]. + * + * The ::CUDA_ARRAY3D_DESCRIPTOR is defined as: + * + * \code + typedef struct { + unsigned int Width; + unsigned int Height; + unsigned int Depth; + CUarray_format Format; + unsigned int NumChannels; + unsigned int Flags; + } CUDA_ARRAY3D_DESCRIPTOR; + * \endcode + * where: + * + * - \p Width, \p Height, and \p Depth are the width, height, and depth of the + * CUDA array (in elements); the following types of CUDA arrays can be allocated: + * - A 1D mipmapped array is allocated if \p Height and \p Depth extents are both zero. + * - A 2D mipmapped array is allocated if only \p Depth extent is zero. + * - A 3D mipmapped array is allocated if all three extents are non-zero. + * - A 1D layered CUDA mipmapped array is allocated if only \p Height is zero and the + * ::CUDA_ARRAY3D_LAYERED flag is set. Each layer is a 1D array. The number + * of layers is determined by the depth extent. + * - A 2D layered CUDA mipmapped array is allocated if all three extents are non-zero and + * the ::CUDA_ARRAY3D_LAYERED flag is set. Each layer is a 2D array. The number + * of layers is determined by the depth extent. + * - A cubemap CUDA mipmapped array is allocated if all three extents are non-zero and the + * ::CUDA_ARRAY3D_CUBEMAP flag is set. \p Width must be equal to \p Height, and + * \p Depth must be six. A cubemap is a special type of 2D layered CUDA array, + * where the six layers represent the six faces of a cube. The order of the six + * layers in memory is the same as that listed in ::CUarray_cubemap_face. + * - A cubemap layered CUDA mipmapped array is allocated if all three extents are non-zero, + * and both, ::CUDA_ARRAY3D_CUBEMAP and ::CUDA_ARRAY3D_LAYERED flags are set. + * \p Width must be equal to \p Height, and \p Depth must be a multiple of six. + * A cubemap layered CUDA array is a special type of 2D layered CUDA array that + * consists of a collection of cubemaps. The first six layers represent the first + * cubemap, the next six layers form the second cubemap, and so on. + * + * - ::Format specifies the format of the elements; ::CUarray_format is + * defined as: + * \code + typedef enum CUarray_format_enum { + CU_AD_FORMAT_UNSIGNED_INT8 = 0x01, + CU_AD_FORMAT_UNSIGNED_INT16 = 0x02, + CU_AD_FORMAT_UNSIGNED_INT32 = 0x03, + CU_AD_FORMAT_SIGNED_INT8 = 0x08, + CU_AD_FORMAT_SIGNED_INT16 = 0x09, + CU_AD_FORMAT_SIGNED_INT32 = 0x0a, + CU_AD_FORMAT_HALF = 0x10, + CU_AD_FORMAT_FLOAT = 0x20 + } CUarray_format; + * \endcode + * + * - \p NumChannels specifies the number of packed components per CUDA array + * element; it may be 1, 2, or 4; + * + * - ::Flags may be set to + * - ::CUDA_ARRAY3D_LAYERED to enable creation of layered CUDA mipmapped arrays. If this flag is set, + * \p Depth specifies the number of layers, not the depth of a 3D array. + * - ::CUDA_ARRAY3D_SURFACE_LDST to enable surface references to be bound to individual mipmap levels of + * the CUDA mipmapped array. If this flag is not set, ::cuSurfRefSetArray will fail when attempting to + * bind a mipmap level of the CUDA mipmapped array to a surface reference. + * - ::CUDA_ARRAY3D_CUBEMAP to enable creation of mipmapped cubemaps. If this flag is set, \p Width must be + * equal to \p Height, and \p Depth must be six. If the ::CUDA_ARRAY3D_LAYERED flag is also set, + * then \p Depth must be a multiple of six. + * - ::CUDA_ARRAY3D_TEXTURE_GATHER to indicate that the CUDA mipmapped array will be used for texture gather. + * Texture gather can only be performed on 2D CUDA mipmapped arrays. + * + * \p Width, \p Height and \p Depth must meet certain size requirements as listed in the following table. + * All values are specified in elements. Note that for brevity's sake, the full name of the device attribute + * is not specified. For ex., TEXTURE1D_MIPMAPPED_WIDTH refers to the device attribute + * ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
CUDA array typeValid extents that must always be met
{(width range in elements), (height range), + * (depth range)}
Valid extents with CUDA_ARRAY3D_SURFACE_LDST set
+ * {(width range in elements), (height range), (depth range)}
1D{ (1,TEXTURE1D_MIPMAPPED_WIDTH), 0, 0 }{ (1,SURFACE1D_WIDTH), 0, 0 }
2D{ (1,TEXTURE2D_MIPMAPPED_WIDTH), (1,TEXTURE2D_MIPMAPPED_HEIGHT), 0 }{ (1,SURFACE2D_WIDTH), (1,SURFACE2D_HEIGHT), 0 }
3D{ (1,TEXTURE3D_WIDTH), (1,TEXTURE3D_HEIGHT), (1,TEXTURE3D_DEPTH) } + *
OR
{ (1,TEXTURE3D_WIDTH_ALTERNATE), (1,TEXTURE3D_HEIGHT_ALTERNATE), + * (1,TEXTURE3D_DEPTH_ALTERNATE) }
{ (1,SURFACE3D_WIDTH), (1,SURFACE3D_HEIGHT), + * (1,SURFACE3D_DEPTH) }
1D Layered{ (1,TEXTURE1D_LAYERED_WIDTH), 0, + * (1,TEXTURE1D_LAYERED_LAYERS) }{ (1,SURFACE1D_LAYERED_WIDTH), 0, + * (1,SURFACE1D_LAYERED_LAYERS) }
2D Layered{ (1,TEXTURE2D_LAYERED_WIDTH), (1,TEXTURE2D_LAYERED_HEIGHT), + * (1,TEXTURE2D_LAYERED_LAYERS) }{ (1,SURFACE2D_LAYERED_WIDTH), (1,SURFACE2D_LAYERED_HEIGHT), + * (1,SURFACE2D_LAYERED_LAYERS) }
Cubemap{ (1,TEXTURECUBEMAP_WIDTH), (1,TEXTURECUBEMAP_WIDTH), 6 }{ (1,SURFACECUBEMAP_WIDTH), + * (1,SURFACECUBEMAP_WIDTH), 6 }
Cubemap Layered{ (1,TEXTURECUBEMAP_LAYERED_WIDTH), (1,TEXTURECUBEMAP_LAYERED_WIDTH), + * (1,TEXTURECUBEMAP_LAYERED_LAYERS) }{ (1,SURFACECUBEMAP_LAYERED_WIDTH), (1,SURFACECUBEMAP_LAYERED_WIDTH), + * (1,SURFACECUBEMAP_LAYERED_LAYERS) }
+ * + * + * \param pHandle - Returned mipmapped array + * \param pMipmappedArrayDesc - mipmapped array descriptor + * \param numMipmapLevels - Number of mipmap levels + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuMipmappedArrayDestroy, + * ::cuMipmappedArrayGetLevel, + * ::cuArrayCreate, + * ::cudaMallocMipmappedArray + */ +CUresult CUDAAPI cuMipmappedArrayCreate(CUmipmappedArray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR *pMipmappedArrayDesc, unsigned int numMipmapLevels); + +/** + * \brief Gets a mipmap level of a CUDA mipmapped array + * + * Returns in \p *pLevelArray a CUDA array that represents a single mipmap level + * of the CUDA mipmapped array \p hMipmappedArray. + * + * If \p level is greater than the maximum number of levels in this mipmapped array, + * ::CUDA_ERROR_INVALID_VALUE is returned. + * + * \param pLevelArray - Returned mipmap level CUDA array + * \param hMipmappedArray - CUDA mipmapped array + * \param level - Mipmap level + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa + * ::cuMipmappedArrayCreate, + * ::cuMipmappedArrayDestroy, + * ::cuArrayCreate, + * ::cudaGetMipmappedArrayLevel + */ +CUresult CUDAAPI cuMipmappedArrayGetLevel(CUarray *pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level); + +/** + * \brief Destroys a CUDA mipmapped array + * + * Destroys the CUDA mipmapped array \p hMipmappedArray. + * + * \param hMipmappedArray - Mipmapped array to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ARRAY_IS_MAPPED, + * ::CUDA_ERROR_CONTEXT_IS_DESTROYED + * \notefnerr + * + * \sa + * ::cuMipmappedArrayCreate, + * ::cuMipmappedArrayGetLevel, + * ::cuArrayCreate, + * ::cudaFreeMipmappedArray + */ +CUresult CUDAAPI cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray); + +/** +* \brief Retrieve handle for an address range +* +* Get a handle of the specified type to an address range. The address range +* must have been obtained by a prior call to either ::cuMemAlloc or ::cuMemAddressReserve. +* If the address range was obtained via ::cuMemAddressReserve, it must also be fully mapped via ::cuMemMap. +* The address range must have been obtained by a prior call to either ::cuMemAllocHost or +* ::cuMemHostAlloc on Tegra. +* +* Users must ensure the \p dptr and \p size are aligned to the host page size. +* +* When requesting CUmemRangeHandleType::CU_MEM_RANGE_HANDLE_TYPE_DMA_BUF_FD, +* users are expected to query for dma_buf support for the platform +* by using ::CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED device attribute before calling +* this API. The \p handle will be interpreted as a pointer to an integer to store the dma_buf file descriptor. +* Users must ensure the entire address range is backed and mapped when +* the address range is allocated by ::cuMemAddressReserve. All the physical +* allocations backing the address range must be resident on the same device and +* have identical allocation properties. Users are also expected to retrieve a +* new handle every time the underlying physical allocation(s) corresponding +* to a previously queried VA range are changed. +* +* \param[out] handle - Pointer to the location where the returned handle will be stored. +* \param[in] dptr - Pointer to a valid CUDA device allocation. Must be aligned to host page size. +* \param[in] size - Length of the address range. Must be aligned to host page size. +* \param[in] handleType - Type of handle requested (defines type and size of the \p handle output parameter) +* \param[in] flags - Reserved, must be zero +* +* \return +* CUDA_SUCCESS +* CUDA_ERROR_INVALID_VALUE +* CUDA_ERROR_NOT_SUPPORTED +*/ +CUresult CUDAAPI cuMemGetHandleForAddressRange(void *handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags); + +/** @} */ /* END CUDA_MEM */ + +/** + * \defgroup CUDA_VA Virtual Memory Management + * + * ___MANBRIEF___ virtual memory management functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the virtual memory management functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** +* \brief Allocate an address range reservation. +* +* Reserves a virtual address range based on the given parameters, giving +* the starting address of the range in \p ptr. This API requires a system that +* supports UVA. The size and address parameters must be a multiple of the +* host page size and the alignment must be a power of two or zero for default +* alignment. +* +* \param[out] ptr - Resulting pointer to start of virtual address range allocated +* \param[in] size - Size of the reserved virtual address range requested +* \param[in] alignment - Alignment of the reserved virtual address range requested +* \param[in] addr - Fixed starting address range requested +* \param[in] flags - Currently unused, must be zero +* \return +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_OUT_OF_MEMORY, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* +* \sa ::cuMemAddressFree +*/ +CUresult CUDAAPI cuMemAddressReserve(CUdeviceptr *ptr, size_t size, size_t alignment, CUdeviceptr addr, unsigned long long flags); + +/** +* \brief Free an address range reservation. +* +* Frees a virtual address range reserved by cuMemAddressReserve. The size +* must match what was given to memAddressReserve and the ptr given must +* match what was returned from memAddressReserve. +* +* \param[in] ptr - Starting address of the virtual address range to free +* \param[in] size - Size of the virtual address region to free +* \return +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* +* \sa ::cuMemAddressReserve +*/ +CUresult CUDAAPI cuMemAddressFree(CUdeviceptr ptr, size_t size); + +/** +* \brief Create a CUDA memory handle representing a memory allocation of a given size described by the given properties +* +* This creates a memory allocation on the target device specified through the +* \p prop structure. The created allocation will not have any device or host +* mappings. The generic memory \p handle for the allocation can be +* mapped to the address space of calling process via ::cuMemMap. This handle +* cannot be transmitted directly to other processes (see +* ::cuMemExportToShareableHandle). On Windows, the caller must also pass +* an LPSECURITYATTRIBUTE in \p prop to be associated with this handle which +* limits or allows access to this handle for a recipient process (see +* ::CUmemAllocationProp::win32HandleMetaData for more). The \p size of this +* allocation must be a multiple of the the value given via +* ::cuMemGetAllocationGranularity with the ::CU_MEM_ALLOC_GRANULARITY_MINIMUM +* flag. +* To create a CPU allocation targeting a specific host NUMA node, applications must +* set ::CUmemAllocationProp::CUmemLocation::type to ::CU_MEM_LOCATION_TYPE_HOST_NUMA and +* ::CUmemAllocationProp::CUmemLocation::id must specify the NUMA ID of the CPU. +* On systems where NUMA is not available ::CUmemAllocationProp::CUmemLocation::id must be set to 0. +* +* Applications can set ::CUmemAllocationProp::requestedHandleTypes to +* ::CU_MEM_HANDLE_TYPE_FABRIC in order to create allocations suitable for sharing +* within an IMEX domain. An IMEX domain is either an OS instance or a group of securely +* connected OS instances using the NVIDIA IMEX daemon. An IMEX channel is a global resource +* within the IMEX domain that represents a logical entity that aims to provide fine grained +* accessibility control for the participating processes. When exporter and importer CUDA processes +* have been granted access to the same IMEX channel, they can securely share memory. +* If the allocating process does not have access setup for an IMEX channel, attempting to create +* a ::CUmemGenericAllocationHandle with ::CU_MEM_HANDLE_TYPE_FABRIC will result in ::CUDA_ERROR_NOT_PERMITTED. +* The nvidia-modprobe CLI provides more information regarding setting up of IMEX channels. +* +* If ::CUmemAllocationProp::allocFlags::usage contains ::CU_MEM_CREATE_USAGE_TILE_POOL flag then +* the memory allocation is intended only to be used as backing tile pool for sparse CUDA arrays +* and sparse CUDA mipmapped arrays. +* (see ::cuMemMapArrayAsync). +* +* \param[out] handle - Value of handle returned. All operations on this allocation are to be performed using this handle. +* \param[in] size - Size of the allocation requested +* \param[in] prop - Properties of the allocation to create. +* \param[in] flags - flags for future use, must be zero now. +* \return +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_OUT_OF_MEMORY, +* ::CUDA_ERROR_INVALID_DEVICE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* \notefnerr +* +* \sa ::cuMemRelease, ::cuMemExportToShareableHandle, ::cuMemImportFromShareableHandle +*/ +CUresult CUDAAPI cuMemCreate(CUmemGenericAllocationHandle *handle, size_t size, const CUmemAllocationProp *prop, unsigned long long flags); + +/** +* \brief Release a memory handle representing a memory allocation which was previously allocated through cuMemCreate. +* +* Frees the memory that was allocated on a device through cuMemCreate. +* +* The memory allocation will be freed when all outstanding mappings to the memory +* are unmapped and when all outstanding references to the handle (including it's +* shareable counterparts) are also released. The generic memory handle can be +* freed when there are still outstanding mappings made with this handle. Each +* time a recipient process imports a shareable handle, it needs to pair it with +* ::cuMemRelease for the handle to be freed. If \p handle is not a valid handle +* the behavior is undefined. +* +* \param[in] handle Value of handle which was returned previously by cuMemCreate. +* \return +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* \notefnerr +* +* \sa ::cuMemCreate +*/ +CUresult CUDAAPI cuMemRelease(CUmemGenericAllocationHandle handle); + +/** +* \brief Maps an allocation handle to a reserved virtual address range. +* +* Maps bytes of memory represented by \p handle starting from byte \p offset to +* \p size to address range [\p addr, \p addr + \p size]. This range must be an +* address reservation previously reserved with ::cuMemAddressReserve, and +* \p offset + \p size must be less than the size of the memory allocation. +* Both \p ptr, \p size, and \p offset must be a multiple of the value given via +* ::cuMemGetAllocationGranularity with the ::CU_MEM_ALLOC_GRANULARITY_MINIMUM flag. +* If \p handle represents a multicast object, \p ptr, \p size and \p offset must +* be aligned to the value returned by ::cuMulticastGetGranularity with the flag +* ::CU_MULTICAST_MINIMUM_GRANULARITY. For best performance however, it is +* recommended that \p ptr, \p size and \p offset be aligned to the value +* returned by ::cuMulticastGetGranularity with the flag +* ::CU_MULTICAST_RECOMMENDED_GRANULARITY. +* +* Please note calling ::cuMemMap does not make the address accessible, +* the caller needs to update accessibility of a contiguous mapped VA +* range by calling ::cuMemSetAccess. +* +* Once a recipient process obtains a shareable memory handle +* from ::cuMemImportFromShareableHandle, the process must +* use ::cuMemMap to map the memory into its address ranges before +* setting accessibility with ::cuMemSetAccess. +* +* ::cuMemMap can only create mappings on VA range reservations +* that are not currently mapped. +* +* \param[in] ptr - Address where memory will be mapped. +* \param[in] size - Size of the memory mapping. +* \param[in] offset - Offset into the memory represented by +* - \p handle from which to start mapping +* - Note: currently must be zero. +* \param[in] handle - Handle to a shareable memory +* \param[in] flags - flags for future use, must be zero now. +* \return +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_INVALID_DEVICE, +* ::CUDA_ERROR_OUT_OF_MEMORY, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* \notefnerr +* +* \sa ::cuMemUnmap, ::cuMemSetAccess, ::cuMemCreate, ::cuMemAddressReserve, ::cuMemImportFromShareableHandle +*/ +CUresult CUDAAPI cuMemMap(CUdeviceptr ptr, size_t size, size_t offset, CUmemGenericAllocationHandle handle, unsigned long long flags); + +/** + * \brief Maps or unmaps subregions of sparse CUDA arrays and sparse CUDA mipmapped arrays + * + * Performs map or unmap operations on subregions of sparse CUDA arrays and sparse CUDA mipmapped arrays. + * Each operation is specified by a ::CUarrayMapInfo entry in the \p mapInfoList array of size \p count. + * The structure ::CUarrayMapInfo is defined as follow: + \code + typedef struct CUarrayMapInfo_st { + CUresourcetype resourceType; + union { + CUmipmappedArray mipmap; + CUarray array; + } resource; + + CUarraySparseSubresourceType subresourceType; + union { + struct { + unsigned int level; + unsigned int layer; + unsigned int offsetX; + unsigned int offsetY; + unsigned int offsetZ; + unsigned int extentWidth; + unsigned int extentHeight; + unsigned int extentDepth; + } sparseLevel; + struct { + unsigned int layer; + unsigned long long offset; + unsigned long long size; + } miptail; + } subresource; + + CUmemOperationType memOperationType; + + CUmemHandleType memHandleType; + union { + CUmemGenericAllocationHandle memHandle; + } memHandle; + + unsigned long long offset; + unsigned int deviceBitMask; + unsigned int flags; + unsigned int reserved[2]; + } CUarrayMapInfo; + \endcode + * + * where ::CUarrayMapInfo::resourceType specifies the type of resource to be operated on. + * If ::CUarrayMapInfo::resourceType is set to ::CUresourcetype::CU_RESOURCE_TYPE_ARRAY then + * ::CUarrayMapInfo::resource::array must be set to a valid sparse CUDA array handle. + * The CUDA array must be either a 2D, 2D layered or 3D CUDA array and must have been allocated using + * ::cuArrayCreate or ::cuArray3DCreate with the flag ::CUDA_ARRAY3D_SPARSE + * or ::CUDA_ARRAY3D_DEFERRED_MAPPING. + * For CUDA arrays obtained using ::cuMipmappedArrayGetLevel, ::CUDA_ERROR_INVALID_VALUE will be returned. + * If ::CUarrayMapInfo::resourceType is set to ::CUresourcetype::CU_RESOURCE_TYPE_MIPMAPPED_ARRAY + * then ::CUarrayMapInfo::resource::mipmap must be set to a valid sparse CUDA mipmapped array handle. + * The CUDA mipmapped array must be either a 2D, 2D layered or 3D CUDA mipmapped array and must have been + * allocated using ::cuMipmappedArrayCreate with the flag ::CUDA_ARRAY3D_SPARSE + * or ::CUDA_ARRAY3D_DEFERRED_MAPPING. + * + * ::CUarrayMapInfo::subresourceType specifies the type of subresource within the resource. + * ::CUarraySparseSubresourceType_enum is defined as: + \code + typedef enum CUarraySparseSubresourceType_enum { + CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL = 0, + CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL = 1 + } CUarraySparseSubresourceType; + \endcode + * + * where ::CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL indicates a + * sparse-miplevel which spans at least one tile in every dimension. The remaining miplevels which + * are too small to span at least one tile in any dimension constitute the mip tail region as indicated by + * ::CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL subresource type. + * + * If ::CUarrayMapInfo::subresourceType is set to ::CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL + * then ::CUarrayMapInfo::subresource::sparseLevel struct must contain valid array subregion offsets and extents. + * The ::CUarrayMapInfo::subresource::sparseLevel::offsetX, ::CUarrayMapInfo::subresource::sparseLevel::offsetY + * and ::CUarrayMapInfo::subresource::sparseLevel::offsetZ must specify valid X, Y and Z offsets respectively. + * The ::CUarrayMapInfo::subresource::sparseLevel::extentWidth, ::CUarrayMapInfo::subresource::sparseLevel::extentHeight + * and ::CUarrayMapInfo::subresource::sparseLevel::extentDepth must specify valid width, height and depth extents respectively. + * These offsets and extents must be aligned to the corresponding tile dimension. + * For CUDA mipmapped arrays ::CUarrayMapInfo::subresource::sparseLevel::level must specify a valid mip level index. Otherwise, + * must be zero. + * For layered CUDA arrays and layered CUDA mipmapped arrays ::CUarrayMapInfo::subresource::sparseLevel::layer must specify a valid layer index. Otherwise, + * must be zero. + * ::CUarrayMapInfo::subresource::sparseLevel::offsetZ must be zero and ::CUarrayMapInfo::subresource::sparseLevel::extentDepth + * must be set to 1 for 2D and 2D layered CUDA arrays and CUDA mipmapped arrays. + * Tile extents can be obtained by calling ::cuArrayGetSparseProperties and ::cuMipmappedArrayGetSparseProperties + * + * If ::CUarrayMapInfo::subresourceType is set to ::CUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL + * then ::CUarrayMapInfo::subresource::miptail struct must contain valid mip tail offset in + * ::CUarrayMapInfo::subresource::miptail::offset and size in ::CUarrayMapInfo::subresource::miptail::size. + * Both, mip tail offset and mip tail size must be aligned to the tile size. + * For layered CUDA mipmapped arrays which don't have the flag ::CU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAIL set in ::CUDA_ARRAY_SPARSE_PROPERTIES::flags + * as returned by ::cuMipmappedArrayGetSparseProperties, ::CUarrayMapInfo::subresource::miptail::layer must specify a valid layer index. + * Otherwise, must be zero. + * + * If ::CUarrayMapInfo::resource::array or ::CUarrayMapInfo::resource::mipmap was created with ::CUDA_ARRAY3D_DEFERRED_MAPPING + * flag set the ::CUarrayMapInfo::subresourceType and the contents of ::CUarrayMapInfo::subresource will be ignored. + * + * ::CUarrayMapInfo::memOperationType specifies the type of operation. ::CUmemOperationType is defined as: + \code + typedef enum CUmemOperationType_enum { + CU_MEM_OPERATION_TYPE_MAP = 1, + CU_MEM_OPERATION_TYPE_UNMAP = 2 + } CUmemOperationType; + \endcode + * If ::CUarrayMapInfo::memOperationType is set to ::CUmemOperationType::CU_MEM_OPERATION_TYPE_MAP then the subresource + * will be mapped onto the tile pool memory specified by ::CUarrayMapInfo::memHandle at offset ::CUarrayMapInfo::offset. + * The tile pool allocation has to be created by specifying the ::CU_MEM_CREATE_USAGE_TILE_POOL flag when calling ::cuMemCreate. Also, + * ::CUarrayMapInfo::memHandleType must be set to ::CUmemHandleType::CU_MEM_HANDLE_TYPE_GENERIC. + * + * If ::CUarrayMapInfo::memOperationType is set to ::CUmemOperationType::CU_MEM_OPERATION_TYPE_UNMAP then an unmapping operation + * is performed. ::CUarrayMapInfo::memHandle must be NULL. + * + * ::CUarrayMapInfo::deviceBitMask specifies the list of devices that must map or unmap physical memory. + * Currently, this mask must have exactly one bit set, and the corresponding device must match the device associated with the stream. + * If ::CUarrayMapInfo::memOperationType is set to ::CUmemOperationType::CU_MEM_OPERATION_TYPE_MAP, the device must also match + * the device associated with the tile pool memory allocation as specified by ::CUarrayMapInfo::memHandle. + * + * ::CUarrayMapInfo::flags and ::CUarrayMapInfo::reserved[] are unused and must be set to zero. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * + * \param[in] mapInfoList - List of ::CUarrayMapInfo + * \param[in] count - Count of ::CUarrayMapInfo in \p mapInfoList + * \param[in] hStream - Stream identifier for the stream to use for map or unmap operations + * + * \sa ::cuMipmappedArrayCreate, ::cuArrayCreate, ::cuArray3DCreate, ::cuMemCreate, ::cuArrayGetSparseProperties, ::cuMipmappedArrayGetSparseProperties + */ +CUresult CUDAAPI cuMemMapArrayAsync(CUarrayMapInfo *mapInfoList, unsigned int count, CUstream hStream); + +/** +* \brief Unmap the backing memory of a given address range. +* +* The range must be the entire contiguous address range that was mapped to. In +* other words, ::cuMemUnmap cannot unmap a sub-range of an address range mapped +* by ::cuMemCreate / ::cuMemMap. Any backing memory allocations will be freed +* if there are no existing mappings and there are no unreleased memory handles. +* +* When ::cuMemUnmap returns successfully the address range is converted to an +* address reservation and can be used for a future calls to ::cuMemMap. Any new +* mapping to this virtual address will need to have access granted through +* ::cuMemSetAccess, as all mappings start with no accessibility setup. +* +* \param[in] ptr - Starting address for the virtual address range to unmap +* \param[in] size - Size of the virtual address range to unmap +* \returns +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* \notefnerr +* \note_sync +* +* \sa ::cuMemCreate, ::cuMemAddressReserve +*/ +CUresult CUDAAPI cuMemUnmap(CUdeviceptr ptr, size_t size); + +/** +* \brief Set the access flags for each location specified in \p desc for the given virtual address range +* +* Given the virtual address range via \p ptr and \p size, and the locations +* in the array given by \p desc and \p count, set the access flags for the +* target locations. The range must be a fully mapped address range +* containing all allocations created by ::cuMemMap / ::cuMemCreate. +* Users cannot specify ::CU_MEM_LOCATION_TYPE_HOST_NUMA accessibility for allocations created on with other location types. +* Note: When ::CUmemAccessDesc::CUmemLocation::type is ::CU_MEM_LOCATION_TYPE_HOST_NUMA, ::CUmemAccessDesc::CUmemLocation::id +* is ignored. +* When setting the access flags for a virtual address range mapping a multicast +* object, \p ptr and \p size must be aligned to the value returned by +* ::cuMulticastGetGranularity with the flag ::CU_MULTICAST_MINIMUM_GRANULARITY. +* For best performance however, it is recommended that \p ptr and \p size be +* aligned to the value returned by ::cuMulticastGetGranularity with the flag +* ::CU_MULTICAST_RECOMMENDED_GRANULARITY. +* +* \param[in] ptr - Starting address for the virtual address range +* \param[in] size - Length of the virtual address range +* \param[in] desc - Array of ::CUmemAccessDesc that describe how to change the +* - mapping for each location specified +* \param[in] count - Number of ::CUmemAccessDesc in \p desc +* \returns +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_INVALID_DEVICE, +* ::CUDA_ERROR_NOT_SUPPORTED +* \notefnerr +* \note_sync +* +* \sa ::cuMemSetAccess, ::cuMemCreate, :cuMemMap +*/ +CUresult CUDAAPI cuMemSetAccess(CUdeviceptr ptr, size_t size, const CUmemAccessDesc *desc, size_t count); + +/** +* \brief Get the access \p flags set for the given \p location and \p ptr +* +* \param[out] flags - Flags set for this location +* \param[in] location - Location in which to check the flags for +* \param[in] ptr - Address in which to check the access flags for +* \returns +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_INVALID_DEVICE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* +* \sa ::cuMemSetAccess +*/ +CUresult CUDAAPI cuMemGetAccess(unsigned long long *flags, const CUmemLocation *location, CUdeviceptr ptr); + +/** +* \brief Exports an allocation to a requested shareable handle type +* +* Given a CUDA memory handle, create a shareable memory +* allocation handle that can be used to share the memory with other +* processes. The recipient process can convert the shareable handle back into a +* CUDA memory handle using ::cuMemImportFromShareableHandle and map +* it with ::cuMemMap. The implementation of what this handle is and how it +* can be transferred is defined by the requested handle type in \p handleType +* +* Once all shareable handles are closed and the allocation is released, the allocated +* memory referenced will be released back to the OS and uses of the CUDA handle afterward +* will lead to undefined behavior. +* +* This API can also be used in conjunction with other APIs (e.g. Vulkan, OpenGL) +* that support importing memory from the shareable type +* +* \param[out] shareableHandle - Pointer to the location in which to store the requested handle type +* \param[in] handle - CUDA handle for the memory allocation +* \param[in] handleType - Type of shareable handle requested (defines type and size of the \p shareableHandle output parameter) +* \param[in] flags - Reserved, must be zero +* \returns +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* +* \sa ::cuMemImportFromShareableHandle +*/ +CUresult CUDAAPI cuMemExportToShareableHandle(void *shareableHandle, CUmemGenericAllocationHandle handle, CUmemAllocationHandleType handleType, unsigned long long flags); + +/** +* \brief Imports an allocation from a requested shareable handle type. +* +* If the current process cannot support the memory described by this shareable +* handle, this API will error as ::CUDA_ERROR_NOT_SUPPORTED. +* +* If \p shHandleType is ::CU_MEM_HANDLE_TYPE_FABRIC and the importer process has not been +* granted access to the same IMEX channel as the exporter process, this API will error +* as ::CUDA_ERROR_NOT_PERMITTED. +* +* \note Importing shareable handles exported from some graphics APIs(VUlkan, OpenGL, etc) +* created on devices under an SLI group may not be supported, and thus this API will +* return CUDA_ERROR_NOT_SUPPORTED. +* There is no guarantee that the contents of \p handle will be the same CUDA memory handle +* for the same given OS shareable handle, or the same underlying allocation. +* +* \param[out] handle - CUDA Memory handle for the memory allocation. +* \param[in] osHandle - Shareable Handle representing the memory allocation that is to be imported. +* \param[in] shHandleType - handle type of the exported handle ::CUmemAllocationHandleType. +* \returns +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* +* \sa ::cuMemExportToShareableHandle, ::cuMemMap, ::cuMemRelease +*/ +CUresult CUDAAPI cuMemImportFromShareableHandle(CUmemGenericAllocationHandle *handle, void *osHandle, CUmemAllocationHandleType shHandleType); + +/** +* \brief Calculates either the minimal or recommended granularity +* +* Calculates either the minimal or recommended granularity +* for a given allocation specification and returns it in granularity. This +* granularity can be used as a multiple for alignment, size, or address mapping. +* +* \param[out] granularity Returned granularity. +* \param[in] prop Property for which to determine the granularity for +* \param[in] option Determines which granularity to return +* \returns +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* +* \sa ::cuMemCreate, ::cuMemMap +*/ +CUresult CUDAAPI cuMemGetAllocationGranularity(size_t *granularity, const CUmemAllocationProp *prop, CUmemAllocationGranularity_flags option); + +/** +* \brief Retrieve the contents of the property structure defining properties for this handle +* +* \param[out] prop - Pointer to a properties structure which will hold the information about this handle +* \param[in] handle - Handle which to perform the query on +* \returns +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* +* \sa ::cuMemCreate, ::cuMemImportFromShareableHandle +*/ +CUresult CUDAAPI cuMemGetAllocationPropertiesFromHandle(CUmemAllocationProp *prop, CUmemGenericAllocationHandle handle); + +/** +* \brief Given an address \p addr, returns the allocation handle of the backing memory allocation. +* +* The handle is guaranteed to be the same handle value used to map the memory. If the address +* requested is not mapped, the function will fail. The returned handle must be released with +* corresponding number of calls to ::cuMemRelease. +* +* \note The address \p addr, can be any address in a range previously mapped +* by ::cuMemMap, and not necessarily the start address. +* +* \param[out] handle CUDA Memory handle for the backing memory allocation. +* \param[in] addr Memory address to query, that has been mapped previously. +* \returns +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* +* \sa ::cuMemCreate, ::cuMemRelease, ::cuMemMap +*/ +CUresult CUDAAPI cuMemRetainAllocationHandle(CUmemGenericAllocationHandle *handle, void *addr); + +/** @} */ /* END CUDA_VA */ + +/** + * \defgroup CUDA_MALLOC_ASYNC Stream Ordered Memory Allocator + * + * ___MANBRIEF___ Functions for performing allocation and free operations in stream order. + * Functions for controlling the behavior of the underlying allocator. + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the stream ordered memory allocator exposed by the + * low-level CUDA driver application programming interface. + * + * @{ + * + * \section CUDA_MALLOC_ASYNC_overview overview + * + * The asynchronous allocator allows the user to allocate and free in stream order. + * All asynchronous accesses of the allocation must happen between + * the stream executions of the allocation and the free. If the memory is accessed + * outside of the promised stream order, a use before allocation / use after free error + * will cause undefined behavior. + * + * The allocator is free to reallocate the memory as long as it can guarantee + * that compliant memory accesses will not overlap temporally. + * The allocator may refer to internal stream ordering as well as inter-stream dependencies + * (such as CUDA events and null stream dependencies) when establishing the temporal guarantee. + * The allocator may also insert inter-stream dependencies to establish the temporal guarantee. + * + * \section CUDA_MALLOC_ASYNC_support Supported Platforms + * + * Whether or not a device supports the integrated stream ordered memory allocator + * may be queried by calling ::cuDeviceGetAttribute() with the device attribute + * ::CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED + */ + +/** + * \brief Frees memory with stream ordered semantics + * + * Inserts a free operation into \p hStream. + * The allocation must not be accessed after stream execution reaches the free. + * After this API returns, accessing the memory from any subsequent work launched on the GPU + * or querying its pointer attributes results in undefined behavior. + * + * \note During stream capture, this function results in the creation of a free node and + * must therefore be passed the address of a graph allocation. + * + * \param dptr - memory to free + * \param hStream - The stream establishing the stream ordering contract. + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT (default stream specified with no current context), + * ::CUDA_ERROR_NOT_SUPPORTED + */ +CUresult CUDAAPI cuMemFreeAsync(CUdeviceptr dptr, CUstream hStream); + +/** + * \brief Allocates memory with stream ordered semantics + * + * Inserts an allocation operation into \p hStream. + * A pointer to the allocated memory is returned immediately in *dptr. + * The allocation must not be accessed until the the allocation operation completes. + * The allocation comes from the memory pool current to the stream's device. + * + * \note The default memory pool of a device contains device memory from that device. + * \note Basic stream ordering allows future work submitted into the same stream to use the allocation. + * Stream query, stream synchronize, and CUDA events can be used to guarantee that the allocation + * operation completes before work submitted in a separate stream runs. + * \note During stream capture, this function results in the creation of an allocation node. In this case, + * the allocation is owned by the graph instead of the memory pool. The memory pool's properties + * are used to set the node's creation parameters. + * + * \param[out] dptr - Returned device pointer + * \param[in] bytesize - Number of bytes to allocate + * \param[in] hStream - The stream establishing the stream ordering contract and the memory pool to allocate from + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT (default stream specified with no current context), + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa ::cuMemAllocFromPoolAsync, ::cuMemFreeAsync, ::cuDeviceSetMemPool, + * ::cuDeviceGetDefaultMemPool, ::cuDeviceGetMemPool, ::cuMemPoolCreate, + * ::cuMemPoolSetAccess, ::cuMemPoolSetAttribute + */ +CUresult CUDAAPI cuMemAllocAsync(CUdeviceptr *dptr, size_t bytesize, CUstream hStream); + +/** + * \brief Tries to release memory back to the OS + * + * Releases memory back to the OS until the pool contains fewer than minBytesToKeep + * reserved bytes, or there is no more memory that the allocator can safely release. + * The allocator cannot release OS allocations that back outstanding asynchronous allocations. + * The OS allocations may happen at different granularity from the user allocations. + * + * \note: Allocations that have not been freed count as outstanding. + * \note: Allocations that have been asynchronously freed but whose completion has + * not been observed on the host (eg. by a synchronize) can count as outstanding. + * + * \param[in] pool - The memory pool to trim + * \param[in] minBytesToKeep - If the pool has less than minBytesToKeep reserved, + * the TrimTo operation is a no-op. Otherwise the pool will be guaranteed to have + * at least minBytesToKeep bytes reserved after the operation. + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuMemAllocAsync, ::cuMemFreeAsync, ::cuDeviceGetDefaultMemPool, + * ::cuDeviceGetMemPool, ::cuMemPoolCreate + */ +CUresult CUDAAPI cuMemPoolTrimTo(CUmemoryPool pool, size_t minBytesToKeep); + +/** + * \brief Sets attributes of a memory pool + * + * Supported attributes are: + * - ::CU_MEMPOOL_ATTR_RELEASE_THRESHOLD: (value type = cuuint64_t) + * Amount of reserved memory in bytes to hold onto before trying + * to release memory back to the OS. When more than the release + * threshold bytes of memory are held by the memory pool, the + * allocator will try to release memory back to the OS on the + * next call to stream, event or context synchronize. (default 0) + * - ::CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES: (value type = int) + * Allow ::cuMemAllocAsync to use memory asynchronously freed + * in another stream as long as a stream ordering dependency + * of the allocating stream on the free action exists. + * Cuda events and null stream interactions can create the required + * stream ordered dependencies. (default enabled) + * - ::CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC: (value type = int) + * Allow reuse of already completed frees when there is no dependency + * between the free and allocation. (default enabled) + * - ::CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES: (value type = int) + * Allow ::cuMemAllocAsync to insert new stream dependencies + * in order to establish the stream ordering required to reuse + * a piece of memory released by ::cuMemFreeAsync (default enabled). + * - ::CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH: (value type = cuuint64_t) + * Reset the high watermark that tracks the amount of backing memory that was + * allocated for the memory pool. It is illegal to set this attribute to a non-zero value. + * - ::CU_MEMPOOL_ATTR_USED_MEM_HIGH: (value type = cuuint64_t) + * Reset the high watermark that tracks the amount of used memory that was + * allocated for the memory pool. + * + * \param[in] pool - The memory pool to modify + * \param[in] attr - The attribute to modify + * \param[in] value - Pointer to the value to assign + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuMemAllocAsync, ::cuMemFreeAsync, ::cuDeviceGetDefaultMemPool, + * ::cuDeviceGetMemPool, ::cuMemPoolCreate + */ +CUresult CUDAAPI cuMemPoolSetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void *value); + +/** + * \brief Gets attributes of a memory pool + * + * Supported attributes are: + * - ::CU_MEMPOOL_ATTR_RELEASE_THRESHOLD: (value type = cuuint64_t) + * Amount of reserved memory in bytes to hold onto before trying + * to release memory back to the OS. When more than the release + * threshold bytes of memory are held by the memory pool, the + * allocator will try to release memory back to the OS on the + * next call to stream, event or context synchronize. (default 0) + * - ::CU_MEMPOOL_ATTR_REUSE_FOLLOW_EVENT_DEPENDENCIES: (value type = int) + * Allow ::cuMemAllocAsync to use memory asynchronously freed + * in another stream as long as a stream ordering dependency + * of the allocating stream on the free action exists. + * Cuda events and null stream interactions can create the required + * stream ordered dependencies. (default enabled) + * - ::CU_MEMPOOL_ATTR_REUSE_ALLOW_OPPORTUNISTIC: (value type = int) + * Allow reuse of already completed frees when there is no dependency + * between the free and allocation. (default enabled) + * - ::CU_MEMPOOL_ATTR_REUSE_ALLOW_INTERNAL_DEPENDENCIES: (value type = int) + * Allow ::cuMemAllocAsync to insert new stream dependencies + * in order to establish the stream ordering required to reuse + * a piece of memory released by ::cuMemFreeAsync (default enabled). + * - ::CU_MEMPOOL_ATTR_RESERVED_MEM_CURRENT: (value type = cuuint64_t) + * Amount of backing memory currently allocated for the mempool + * - ::CU_MEMPOOL_ATTR_RESERVED_MEM_HIGH: (value type = cuuint64_t) + * High watermark of backing memory allocated for the mempool since the + * last time it was reset. + * - ::CU_MEMPOOL_ATTR_USED_MEM_CURRENT: (value type = cuuint64_t) + * Amount of memory from the pool that is currently in use by the application. + * - ::CU_MEMPOOL_ATTR_USED_MEM_HIGH: (value type = cuuint64_t) + * High watermark of the amount of memory from the pool that was in use by the application. + * + * \param[in] pool - The memory pool to get attributes of + * \param[in] attr - The attribute to get + * \param[out] value - Retrieved value + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuMemAllocAsync, ::cuMemFreeAsync, ::cuDeviceGetDefaultMemPool, + * ::cuDeviceGetMemPool, ::cuMemPoolCreate + */ +CUresult CUDAAPI cuMemPoolGetAttribute(CUmemoryPool pool, CUmemPool_attribute attr, void *value); + +/** + * \brief Controls visibility of pools between devices + * + * \param[in] pool - The pool being modified + * \param[in] map - Array of access descriptors. Each descriptor instructs the access to enable for a single gpu. + * \param[in] count - Number of descriptors in the map array. + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuMemAllocAsync, ::cuMemFreeAsync, ::cuDeviceGetDefaultMemPool, + * ::cuDeviceGetMemPool, ::cuMemPoolCreate + */ +CUresult CUDAAPI cuMemPoolSetAccess(CUmemoryPool pool, const CUmemAccessDesc *map, size_t count); + +/** + * \brief Returns the accessibility of a pool from a device + * + * Returns the accessibility of the pool's memory from the specified location. + * + * \param[out] flags - the accessibility of the pool from the specified location + * \param[in] memPool - the pool being queried + * \param[in] location - the location accessing the pool + * + * \sa ::cuMemAllocAsync, ::cuMemFreeAsync, ::cuDeviceGetDefaultMemPool, + * ::cuDeviceGetMemPool, ::cuMemPoolCreate + */ +CUresult CUDAAPI cuMemPoolGetAccess(CUmemAccess_flags *flags, CUmemoryPool memPool, CUmemLocation *location); + +/** + * \brief Creates a memory pool + * + * Creates a CUDA memory pool and returns the handle in \p pool. The \p poolProps determines + * the properties of the pool such as the backing device and IPC capabilities. + * +* To create a memory pool targeting a specific host NUMA node, applications must +* set ::CUmemPoolProps::CUmemLocation::type to ::CU_MEM_LOCATION_TYPE_HOST_NUMA and +* ::CUmemPoolProps::CUmemLocation::id must specify the NUMA ID of the host memory node. +* By default, the pool's memory will be accessible from the device it is allocated on. + * In the case of pools created with ::CU_MEM_LOCATION_TYPE_HOST_NUMA, their default accessibility + * will be from the host CPU. + * Applications can control the maximum size of the pool by specifying a non-zero value for ::CUmemPoolProps::maxSize. + * If set to 0, the maximum size of the pool will default to a system dependent value. + * + * Applications can set ::CUmemPoolProps::handleTypes to ::CU_MEM_HANDLE_TYPE_FABRIC + * in order to create ::CUmemoryPool suitable for sharing within an IMEX domain. + * An IMEX domain is either an OS instance or a group of securely connected OS instances + * using the NVIDIA IMEX daemon. An IMEX channel is a global resource within the IMEX domain + * that represents a logical entity that aims to provide fine grained accessibility control + * for the participating processes. When exporter and importer CUDA processes have been + * granted access to the same IMEX channel, they can securely share memory. + * If the allocating process does not have access setup for an IMEX channel, attempting to export + * a ::CUmemoryPool with ::CU_MEM_HANDLE_TYPE_FABRIC will result in ::CUDA_ERROR_NOT_PERMITTED. + * The nvidia-modprobe CLI provides more information regarding setting up of IMEX channels. + * + * \note Specifying CU_MEM_HANDLE_TYPE_NONE creates a memory pool that will not support IPC. + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_NOT_PERMITTED + * ::CUDA_ERROR_NOT_SUPPORTED + * + * \sa ::cuDeviceSetMemPool, ::cuDeviceGetMemPool, ::cuDeviceGetDefaultMemPool, + * ::cuMemAllocFromPoolAsync, ::cuMemPoolExportToShareableHandle + */ +CUresult CUDAAPI cuMemPoolCreate(CUmemoryPool *pool, const CUmemPoolProps *poolProps); + +/** + * \brief Destroys the specified memory pool + * + * If any pointers obtained from this pool haven't been freed or + * the pool has free operations that haven't completed + * when ::cuMemPoolDestroy is invoked, the function will return immediately and the + * resources associated with the pool will be released automatically + * once there are no more outstanding allocations. + * + * Destroying the current mempool of a device sets the default mempool of + * that device as the current mempool for that device. + * + * \note A device's default memory pool cannot be destroyed. + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuMemFreeAsync, ::cuDeviceSetMemPool, ::cuDeviceGetMemPool, + * ::cuDeviceGetDefaultMemPool, ::cuMemPoolCreate + */ +CUresult CUDAAPI cuMemPoolDestroy(CUmemoryPool pool); + +/** + * \brief Allocates memory from a specified pool with stream ordered semantics. + * + * Inserts an allocation operation into \p hStream. + * A pointer to the allocated memory is returned immediately in *dptr. + * The allocation must not be accessed until the the allocation operation completes. + * The allocation comes from the specified memory pool. + * + * \note + * - The specified memory pool may be from a device different than that of the specified \p hStream. + * + * - Basic stream ordering allows future work submitted into the same stream to use the allocation. + * Stream query, stream synchronize, and CUDA events can be used to guarantee that the allocation + * operation completes before work submitted in a separate stream runs. + * + * \note During stream capture, this function results in the creation of an allocation node. In this case, + * the allocation is owned by the graph instead of the memory pool. The memory pool's properties + * are used to set the node's creation parameters. + * + * \param[out] dptr - Returned device pointer + * \param[in] bytesize - Number of bytes to allocate + * \param[in] pool - The pool to allocate from + * \param[in] hStream - The stream establishing the stream ordering semantic + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT (default stream specified with no current context), + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa ::cuMemAllocAsync, ::cuMemFreeAsync, ::cuDeviceGetDefaultMemPool, + * ::cuDeviceGetMemPool, ::cuMemPoolCreate, ::cuMemPoolSetAccess, + * ::cuMemPoolSetAttribute + */ +CUresult CUDAAPI cuMemAllocFromPoolAsync(CUdeviceptr *dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream); + +/** + * \brief Exports a memory pool to the requested handle type. + * + * Given an IPC capable mempool, create an OS handle to share the pool with another process. + * A recipient process can convert the shareable handle into a mempool with ::cuMemPoolImportFromShareableHandle. + * Individual pointers can then be shared with the ::cuMemPoolExportPointer and ::cuMemPoolImportPointer APIs. + * The implementation of what the shareable handle is and how it can be transferred is defined by the requested + * handle type. + * + * \note: To create an IPC capable mempool, create a mempool with a CUmemAllocationHandleType other than CU_MEM_HANDLE_TYPE_NONE. + * + * \param[out] handle_out - Returned OS handle + * \param[in] pool - pool to export + * \param[in] handleType - the type of handle to create + * \param[in] flags - must be 0 + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa ::cuMemPoolImportFromShareableHandle, ::cuMemPoolExportPointer, + * ::cuMemPoolImportPointer, ::cuMemAllocAsync, ::cuMemFreeAsync, + * ::cuDeviceGetDefaultMemPool, ::cuDeviceGetMemPool, ::cuMemPoolCreate, + * ::cuMemPoolSetAccess, ::cuMemPoolSetAttribute + */ +CUresult CUDAAPI cuMemPoolExportToShareableHandle(void *handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags); + +/** + * \brief imports a memory pool from a shared handle. + * + * Specific allocations can be imported from the imported pool with cuMemPoolImportPointer. + * + * If \p handleType is ::CU_MEM_HANDLE_TYPE_FABRIC and the importer process has not been + * granted access to the same IMEX channel as the exporter process, this API will error + * as ::CUDA_ERROR_NOT_PERMITTED. + * + * + * \note Imported memory pools do not support creating new allocations. + * As such imported memory pools may not be used in cuDeviceSetMemPool + * or ::cuMemAllocFromPoolAsync calls. + * + * \param[out] pool_out - Returned memory pool + * \param[in] handle - OS handle of the pool to open + * \param[in] handleType - The type of handle being imported + * \param[in] flags - must be 0 + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa ::cuMemPoolExportToShareableHandle, ::cuMemPoolExportPointer, ::cuMemPoolImportPointer + */ +CUresult CUDAAPI cuMemPoolImportFromShareableHandle( + CUmemoryPool *pool_out, + void *handle, + CUmemAllocationHandleType handleType, + unsigned long long flags); + +/** + * \brief Export data to share a memory pool allocation between processes. + * + * Constructs \p shareData_out for sharing a specific allocation from an already shared memory pool. + * The recipient process can import the allocation with the ::cuMemPoolImportPointer api. + * The data is not a handle and may be shared through any IPC mechanism. + * + * \param[out] shareData_out - Returned export data + * \param[in] ptr - pointer to memory being exported + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa ::cuMemPoolExportToShareableHandle, ::cuMemPoolImportFromShareableHandle, ::cuMemPoolImportPointer + */ +CUresult CUDAAPI cuMemPoolExportPointer(CUmemPoolPtrExportData *shareData_out, CUdeviceptr ptr); + +/** + * \brief Import a memory pool allocation from another process. + * + * Returns in \p ptr_out a pointer to the imported memory. + * The imported memory must not be accessed before the allocation operation completes + * in the exporting process. The imported memory must be freed from all importing processes before + * being freed in the exporting process. The pointer may be freed with cuMemFree + * or cuMemFreeAsync. If cuMemFreeAsync is used, the free must be completed + * on the importing process before the free operation on the exporting process. + * + * \note The cuMemFreeAsync api may be used in the exporting process before + * the cuMemFreeAsync operation completes in its stream as long as the + * cuMemFreeAsync in the exporting process specifies a stream with + * a stream dependency on the importing process's cuMemFreeAsync. + * + * \param[out] ptr_out - pointer to imported memory + * \param[in] pool - pool from which to import + * \param[in] shareData - data specifying the memory to import + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa ::cuMemPoolExportToShareableHandle, ::cuMemPoolImportFromShareableHandle, ::cuMemPoolExportPointer + */ +CUresult CUDAAPI cuMemPoolImportPointer(CUdeviceptr *ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData *shareData); + +/** @} */ /* END CUDA_MALLOC_ASYNC */ + +/** + * \defgroup CUDA_MULTICAST Multicast Object Management + * + * ___MANBRIEF___ Functions for creating multicast objects, adding devices to them and binding/unbinding memory + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the CUDA multicast object operations exposed by the + * low-level CUDA driver application programming interface. + * + * @{ + * + * \section CUDA_MULTICAST_overview overview + * + * A multicast object created via ::cuMulticastCreate enables certain memory + * operations to be broadcast to a team of devices. Devices can be added to a + * multicast object via ::cuMulticastAddDevice. Memory can be bound on each + * participating device via either ::cuMulticastBindMem or ::cuMulticastBindAddr. + * Multicast objects can be mapped into a device's virtual address space using + * the virtual memmory management APIs (see ::cuMemMap and ::cuMemSetAccess). + * + * \section CUDA_MULTICAST_support Supported Platforms + * + * Support for multicast on a specific device can be queried using the device + * attribute ::CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED + */ + +/** + * \brief Create a generic allocation handle representing a multicast object described by the given properties. + * + * This creates a multicast object as described by \p prop. The number of + * participating devices is specified by ::CUmulticastObjectProp::numDevices. + * Devices can be added to the multicast object via ::cuMulticastAddDevice. + * All participating devices must be added to the multicast object before memory + * can be bound to it. Memory is bound to the multicast object via either + * ::cuMulticastBindMem or ::cuMulticastBindAddr, and can be unbound via + * ::cuMulticastUnbind. The total amount of memory that can be bound per device + * is specified by :CUmulticastObjectProp::size. This size must be a multiple of + * the value returned by ::cuMulticastGetGranularity with the flag + * ::CU_MULTICAST_GRANULARITY_MINIMUM. For best performance however, the size + * should be aligned to the value returned by ::cuMulticastGetGranularity with + * the flag ::CU_MULTICAST_GRANULARITY_RECOMMENDED. + * + * After all participating devices have been added, multicast objects can also + * be mapped to a device's virtual address space using the virtual memory + * management APIs (see ::cuMemMap and ::cuMemSetAccess). Multicast objects can + * also be shared with other processes by requesting a shareable handle via + * ::cuMemExportToShareableHandle. Note that the desired types of shareable + * handles must be specified in the bitmask ::CUmulticastObjectProp::handleTypes. + * Multicast objects can be released using the virtual memory management API + * ::cuMemRelease. + * + * \param[out] mcHandle Value of handle returned. + * \param[in] prop Properties of the multicast object to create. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_PERMITTED, + * ::CUDA_ERROR_NOT_SUPPORTED + * + * \sa ::cuMulticastAddDevice, ::cuMulticastBindMem, ::cuMulticastBindAddr, ::cuMulticastUnbind + * \sa ::cuMemCreate, ::cuMemRelease, ::cuMemExportToShareableHandle, ::cuMemImportFromShareableHandle + */ +CUresult CUDAAPI cuMulticastCreate(CUmemGenericAllocationHandle *mcHandle, const CUmulticastObjectProp *prop); + +/** + * \brief Associate a device to a multicast object. + * + * Associates a device to a multicast object. The added device will be a part of + * the multicast team of size specified by CUmulticastObjectProp::numDevices + * during ::cuMulticastCreate. + * The association of the device to the multicast object is permanent during + * the life time of the multicast object. + * All devices must be added to the multicast team before any memory can be + * bound to any device in the team. Any calls to ::cuMulticastBindMem or + * ::cuMulticastBindAddr will block until all devices have been added. + * Similarly all devices must be added to the multicast team before a virtual + * address range can be mapped to the multicast object. A call to ::cuMemMap + * will block until all devices have been added. + * + * \param[in] mcHandle Handle representing a multicast object. + * \param[in] dev Device that will be associated to the multicast + * object. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_PERMITTED, + * ::CUDA_ERROR_NOT_SUPPORTED + * + * \sa ::cuMulticastCreate, ::cuMulticastBindMem, ::cuMulticastBindAddr + */ +CUresult CUDAAPI cuMulticastAddDevice(CUmemGenericAllocationHandle mcHandle, CUdevice dev); + +/** + * \brief Bind a memory allocation represented by a handle to a multicast object. + * + * Binds a memory allocation specified by \p memHandle and created via + * ::cuMemCreate to a multicast object represented by \p mcHandle and created + * via ::cuMulticastCreate. The intended \p size of the bind, the offset in the + * multicast range \p mcOffset as well as the offset in the memory \p memOffset + * must be a multiple of the value returned by ::cuMulticastGetGranularity with + * the flag ::CU_MULTICAST_GRANULARITY_MINIMUM. For best performance however, + * \p size, \p mcOffset and \p memOffset should be aligned to the granularity of + * the memory allocation(see ::cuMemGetAllocationGranularity) or to the value + * returned by ::cuMulticastGetGranularity with the flag + * ::CU_MULTICAST_GRANULARITY_RECOMMENDED. + * + * The \p size + \p memOffset must be smaller than the size of the allocated + * memory. Similarly the \p size + \p mcOffset must be smaller than the size + * of the multicast object. + * The memory allocation must have beeen created on one of the devices + * that was added to the multicast team via ::cuMulticastAddDevice. + * Externally shareable as well as imported multicast objects can be bound only + * to externally shareable memory. + * Note that this call will return CUDA_ERROR_OUT_OF_MEMORY if there are + * insufficient resources required to perform the bind. This call may also + * return CUDA_ERROR_SYSTEM_NOT_READY if the necessary system software is not + * initialized or running. + * + * \param[in] mcHandle Handle representing a multicast object. + * \param[in] mcOffset Offset into the multicast object for attachment. + * \param[in] memHandle Handle representing a memory allocation. + * \param[in] memOffset Offset into the memory for attachment. + * \param[in] size Size of the memory that will be bound to the + * multicast object. + * \param[in] flags Flags for future use, must be zero for now. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_PERMITTED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_SYSTEM_NOT_READY + * + * \sa ::cuMulticastCreate, ::cuMulticastAddDevice, ::cuMemCreate + */ +CUresult CUDAAPI cuMulticastBindMem(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags); + +/** + * \brief Bind a memory allocation represented by a virtual address to a multicast object. + * + * Binds a memory allocation specified by its mapped address \p memptr to a + * multicast object represented by \p mcHandle. + * The memory must have been allocated via ::cuMemCreate or ::cudaMallocAsync. + * The intended \p size of the bind, the offset in the multicast range + * \p mcOffset and \p memptr must be a multiple of the value returned by + * ::cuMulticastGetGranularity with the flag ::CU_MULTICAST_GRANULARITY_MINIMUM. + * For best performance however, \p size, \p mcOffset and \p memptr should be + * aligned to the value returned by ::cuMulticastGetGranularity with the flag + * ::CU_MULTICAST_GRANULARITY_RECOMMENDED. + * + * The \p size must be smaller than the size of the allocated memory. + * Similarly the \p size + \p mcOffset must be smaller than the total size + * of the multicast object. + * The memory allocation must have beeen created on one of the devices + * that was added to the multicast team via ::cuMulticastAddDevice. + * Externally shareable as well as imported multicast objects can be bound only + * to externally shareable memory. + * Note that this call will return CUDA_ERROR_OUT_OF_MEMORY if there are + * insufficient resources required to perform the bind. This call may also + * return CUDA_ERROR_SYSTEM_NOT_READY if the necessary system software is not + * initialized or running. + * + * \param[in] mcHandle Handle representing a multicast object. + * \param[in] mcOffset Offset into multicast va range for attachment. + * \param[in] memptr Virtual address of the memory allocation. + * \param[in] size Size of memory that will be bound to the + * multicast object. + * \param[in] flags Flags for future use, must be zero now. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_PERMITTED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_SYSTEM_NOT_READY + * + * \sa ::cuMulticastCreate, ::cuMulticastAddDevice, ::cuMemCreate + */ +CUresult CUDAAPI cuMulticastBindAddr(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags); + +/** + * \brief Unbind any memory allocations bound to a multicast object at a given offset and upto a given size. + * + * Unbinds any memory allocations hosted on \p dev and bound to a multicast + * object at \p mcOffset and upto a given \p size. + * The intended \p size of the unbind and the offset in the multicast range + * ( \p mcOffset ) must be a multiple of the value returned by + * ::cuMulticastGetGranularity flag ::CU_MULTICAST_GRANULARITY_MINIMUM. + * The \p size + \p mcOffset must be smaller than the total size of the + * multicast object. + * + * \note + * Warning: + * The \p mcOffset and the \p size must match the corresponding values specified + * during the bind call. Any other values may result in undefined behavior. + * + * \param[in] mcHandle Handle representing a multicast object. + * \param[in] dev Device that hosts the memory allocation. + * \param[in] mcOffset Offset into the multicast object. + * \param[in] size Desired size to unbind. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_PERMITTED, + * ::CUDA_ERROR_NOT_SUPPORTED + * + * \sa ::cuMulticastBindMem, ::cuMulticastBindAddr + */ +CUresult CUDAAPI cuMulticastUnbind(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size); + +/** +* \brief Calculates either the minimal or recommended granularity for multicast object +* +* Calculates either the minimal or recommended granularity for a given set of +* multicast object properties and returns it in granularity. This granularity +* can be used as a multiple for size, bind offsets and address mappings of the +* multicast object. +* +* \param[out] granularity Returned granularity. +* \param[in] prop Properties of the multicast object. +* \param[in] option Determines which granularity to return. +* +* \returns +* ::CUDA_SUCCESS, +* ::CUDA_ERROR_INVALID_VALUE, +* ::CUDA_ERROR_NOT_INITIALIZED, +* ::CUDA_ERROR_DEINITIALIZED, +* ::CUDA_ERROR_NOT_PERMITTED, +* ::CUDA_ERROR_NOT_SUPPORTED +* +* \sa ::cuMulticastCreate, ::cuMulticastBindMem, ::cuMulticastBindAddr, ::cuMulticastUnbind +*/ +CUresult CUDAAPI cuMulticastGetGranularity(size_t *granularity, const CUmulticastObjectProp *prop, CUmulticastGranularity_flags option); + +/** @} */ /* END CUDA_MULTICAST */ + +/** + * \defgroup CUDA_UNIFIED Unified Addressing + * + * ___MANBRIEF___ unified addressing functions of the low-level CUDA driver + * API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the unified addressing functions of the + * low-level CUDA driver application programming interface. + * + * @{ + * + * \section CUDA_UNIFIED_overview Overview + * + * CUDA devices can share a unified address space with the host. + * For these devices there is no distinction between a device + * pointer and a host pointer -- the same pointer value may be + * used to access memory from the host program and from a kernel + * running on the device (with exceptions enumerated below). + * + * \section CUDA_UNIFIED_support Supported Platforms + * + * Whether or not a device supports unified addressing may be + * queried by calling ::cuDeviceGetAttribute() with the device + * attribute ::CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING. + * + * Unified addressing is automatically enabled in 64-bit processes + * + * \section CUDA_UNIFIED_lookup Looking Up Information from Pointer Values + * + * It is possible to look up information about the memory which backs a + * pointer value. For instance, one may want to know if a pointer points + * to host or device memory. As another example, in the case of device + * memory, one may want to know on which CUDA device the memory + * resides. These properties may be queried using the function + * ::cuPointerGetAttribute() + * + * Since pointers are unique, it is not necessary to specify information + * about the pointers specified to the various copy functions in the + * CUDA API. The function ::cuMemcpy() may be used to perform a copy + * between two pointers, ignoring whether they point to host or device + * memory (making ::cuMemcpyHtoD(), ::cuMemcpyDtoD(), and ::cuMemcpyDtoH() + * unnecessary for devices supporting unified addressing). For + * multidimensional copies, the memory type ::CU_MEMORYTYPE_UNIFIED may be + * used to specify that the CUDA driver should infer the location of the + * pointer from its value. + * + * \section CUDA_UNIFIED_automaphost Automatic Mapping of Host Allocated Host Memory + * + * All host memory allocated in all contexts using ::cuMemAllocHost() and + * ::cuMemHostAlloc() is always directly accessible from all contexts on + * all devices that support unified addressing. This is the case regardless + * of whether or not the flags ::CU_MEMHOSTALLOC_PORTABLE and + * ::CU_MEMHOSTALLOC_DEVICEMAP are specified. + * + * The pointer value through which allocated host memory may be accessed + * in kernels on all devices that support unified addressing is the same + * as the pointer value through which that memory is accessed on the host, + * so it is not necessary to call ::cuMemHostGetDevicePointer() to get the device + * pointer for these allocations. + * + * Note that this is not the case for memory allocated using the flag + * ::CU_MEMHOSTALLOC_WRITECOMBINED, as discussed below. + * + * \section CUDA_UNIFIED_autopeerregister Automatic Registration of Peer Memory + * + * Upon enabling direct access from a context that supports unified addressing + * to another peer context that supports unified addressing using + * ::cuCtxEnablePeerAccess() all memory allocated in the peer context using + * ::cuMemAlloc() and ::cuMemAllocPitch() will immediately be accessible + * by the current context. The device pointer value through + * which any peer memory may be accessed in the current context + * is the same pointer value through which that memory may be + * accessed in the peer context. + * + * \section CUDA_UNIFIED_exceptions Exceptions, Disjoint Addressing + * + * Not all memory may be accessed on devices through the same pointer + * value through which they are accessed on the host. These exceptions + * are host memory registered using ::cuMemHostRegister() and host memory + * allocated using the flag ::CU_MEMHOSTALLOC_WRITECOMBINED. For these + * exceptions, there exists a distinct host and device address for the + * memory. The device address is guaranteed to not overlap any valid host + * pointer range and is guaranteed to have the same value across all + * contexts that support unified addressing. + * + * This device address may be queried using ::cuMemHostGetDevicePointer() + * when a context using unified addressing is current. Either the host + * or the unified device pointer value may be used to refer to this memory + * through ::cuMemcpy() and similar functions using the + * ::CU_MEMORYTYPE_UNIFIED memory type. + * + */ + +/** + * \brief Returns information about a pointer + * + * The supported attributes are: + * + * - ::CU_POINTER_ATTRIBUTE_CONTEXT: + * + * Returns in \p *data the ::CUcontext in which \p ptr was allocated or + * registered. + * The type of \p data must be ::CUcontext *. + * + * If \p ptr was not allocated by, mapped by, or registered with + * a ::CUcontext which uses unified virtual addressing then + * ::CUDA_ERROR_INVALID_VALUE is returned. + * + * - ::CU_POINTER_ATTRIBUTE_MEMORY_TYPE: + * + * Returns in \p *data the physical memory type of the memory that + * \p ptr addresses as a ::CUmemorytype enumerated value. + * The type of \p data must be unsigned int. + * + * If \p ptr addresses device memory then \p *data is set to + * ::CU_MEMORYTYPE_DEVICE. The particular ::CUdevice on which the + * memory resides is the ::CUdevice of the ::CUcontext returned by the + * ::CU_POINTER_ATTRIBUTE_CONTEXT attribute of \p ptr. + * + * If \p ptr addresses host memory then \p *data is set to + * ::CU_MEMORYTYPE_HOST. + * + * If \p ptr was not allocated by, mapped by, or registered with + * a ::CUcontext which uses unified virtual addressing then + * ::CUDA_ERROR_INVALID_VALUE is returned. + * + * If the current ::CUcontext does not support unified virtual + * addressing then ::CUDA_ERROR_INVALID_CONTEXT is returned. + * + * - ::CU_POINTER_ATTRIBUTE_DEVICE_POINTER: + * + * Returns in \p *data the device pointer value through which + * \p ptr may be accessed by kernels running in the current + * ::CUcontext. + * The type of \p data must be CUdeviceptr *. + * + * If there exists no device pointer value through which + * kernels running in the current ::CUcontext may access + * \p ptr then ::CUDA_ERROR_INVALID_VALUE is returned. + * + * If there is no current ::CUcontext then + * ::CUDA_ERROR_INVALID_CONTEXT is returned. + * + * Except in the exceptional disjoint addressing cases discussed + * below, the value returned in \p *data will equal the input + * value \p ptr. + * + * - ::CU_POINTER_ATTRIBUTE_HOST_POINTER: + * + * Returns in \p *data the host pointer value through which + * \p ptr may be accessed by by the host program. + * The type of \p data must be void **. + * If there exists no host pointer value through which + * the host program may directly access \p ptr then + * ::CUDA_ERROR_INVALID_VALUE is returned. + * + * Except in the exceptional disjoint addressing cases discussed + * below, the value returned in \p *data will equal the input + * value \p ptr. + * + * - ::CU_POINTER_ATTRIBUTE_P2P_TOKENS: + * + * Returns in \p *data two tokens for use with the nv-p2p.h Linux + * kernel interface. \p data must be a struct of type + * CUDA_POINTER_ATTRIBUTE_P2P_TOKENS. + * + * \p ptr must be a pointer to memory obtained from :cuMemAlloc(). + * Note that p2pToken and vaSpaceToken are only valid for the + * lifetime of the source allocation. A subsequent allocation at + * the same address may return completely different tokens. + * Querying this attribute has a side effect of setting the attribute + * ::CU_POINTER_ATTRIBUTE_SYNC_MEMOPS for the region of memory that + * \p ptr points to. + * + * - ::CU_POINTER_ATTRIBUTE_SYNC_MEMOPS: + * + * A boolean attribute which when set, ensures that synchronous memory operations + * initiated on the region of memory that \p ptr points to will always synchronize. + * See further documentation in the section titled "API synchronization behavior" + * to learn more about cases when synchronous memory operations can + * exhibit asynchronous behavior. + * + * - ::CU_POINTER_ATTRIBUTE_BUFFER_ID: + * + * Returns in \p *data a buffer ID which is guaranteed to be unique within the process. + * \p data must point to an unsigned long long. + * + * \p ptr must be a pointer to memory obtained from a CUDA memory allocation API. + * Every memory allocation from any of the CUDA memory allocation APIs will + * have a unique ID over a process lifetime. Subsequent allocations do not reuse IDs + * from previous freed allocations. IDs are only unique within a single process. + * + * + * - ::CU_POINTER_ATTRIBUTE_IS_MANAGED: + * + * Returns in \p *data a boolean that indicates whether the pointer points to + * managed memory or not. + * + * If \p ptr is not a valid CUDA pointer then ::CUDA_ERROR_INVALID_VALUE is returned. + * + * - ::CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL: + * + * Returns in \p *data an integer representing a device ordinal of a device against + * which the memory was allocated or registered. + * + * - ::CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE: + * + * Returns in \p *data a boolean that indicates if this pointer maps to + * an allocation that is suitable for ::cudaIpcGetMemHandle. + * + * - ::CU_POINTER_ATTRIBUTE_RANGE_START_ADDR: + * + * Returns in \p *data the starting address for the allocation referenced + * by the device pointer \p ptr. Note that this is not necessarily the + * address of the mapped region, but the address of the mappable address + * range \p ptr references (e.g. from ::cuMemAddressReserve). + * + * - ::CU_POINTER_ATTRIBUTE_RANGE_SIZE: + * + * Returns in \p *data the size for the allocation referenced by the device + * pointer \p ptr. Note that this is not necessarily the size of the mapped + * region, but the size of the mappable address range \p ptr references + * (e.g. from ::cuMemAddressReserve). To retrieve the size of the mapped + * region, see ::cuMemGetAddressRange + * + * - ::CU_POINTER_ATTRIBUTE_MAPPED: + * + * Returns in \p *data a boolean that indicates if this pointer is in a + * valid address range that is mapped to a backing allocation. + * + * - ::CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES: + * + * Returns a bitmask of the allowed handle types for an allocation that may + * be passed to ::cuMemExportToShareableHandle. + * + * - ::CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE: + * + * Returns in \p *data the handle to the mempool that the allocation was obtained from. + * + * \par + * + * Note that for most allocations in the unified virtual address space + * the host and device pointer for accessing the allocation will be the + * same. The exceptions to this are + * - user memory registered using ::cuMemHostRegister + * - host memory allocated using ::cuMemHostAlloc with the + * ::CU_MEMHOSTALLOC_WRITECOMBINED flag + * For these types of allocation there will exist separate, disjoint host + * and device addresses for accessing the allocation. In particular + * - The host address will correspond to an invalid unmapped device address + * (which will result in an exception if accessed from the device) + * - The device address will correspond to an invalid unmapped host address + * (which will result in an exception if accessed from the host). + * For these types of allocations, querying ::CU_POINTER_ATTRIBUTE_HOST_POINTER + * and ::CU_POINTER_ATTRIBUTE_DEVICE_POINTER may be used to retrieve the host + * and device addresses from either address. + * + * \param data - Returned pointer attribute value + * \param attribute - Pointer attribute to query + * \param ptr - Pointer + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuPointerSetAttribute, + * ::cuMemAlloc, + * ::cuMemFree, + * ::cuMemAllocHost, + * ::cuMemFreeHost, + * ::cuMemHostAlloc, + * ::cuMemHostRegister, + * ::cuMemHostUnregister, + * ::cudaPointerGetAttributes + */ +CUresult CUDAAPI cuPointerGetAttribute(void *data, CUpointer_attribute attribute, CUdeviceptr ptr); + +/** + * \brief Prefetches memory to the specified destination device + * + * Note there is a later version of this API, ::cuMemPrefetchAsync_v2. It will + * supplant this version in 13.0, which is retained for minor version compatibility. + * + * Prefetches memory to the specified destination device. \p devPtr is the + * base device pointer of the memory to be prefetched and \p dstDevice is the + * destination device. \p count specifies the number of bytes to copy. \p hStream + * is the stream in which the operation is enqueued. The memory range must refer + * to managed memory allocated via ::cuMemAllocManaged or declared via __managed__ variables. + * + * Passing in CU_DEVICE_CPU for \p dstDevice will prefetch the data to host memory. If + * \p dstDevice is a GPU, then the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS + * must be non-zero. Additionally, \p hStream must be associated with a device that has a + * non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. + * + * The start address and end address of the memory range will be rounded down and rounded up + * respectively to be aligned to CPU page size before the prefetch operation is enqueued + * in the stream. + * + * If no physical memory has been allocated for this region, then this memory region + * will be populated and mapped on the destination device. If there's insufficient + * memory to prefetch the desired region, the Unified Memory driver may evict pages from other + * ::cuMemAllocManaged allocations to host memory in order to make room. Device memory + * allocated using ::cuMemAlloc or ::cuArrayCreate will not be evicted. + * + * By default, any mappings to the previous location of the migrated pages are removed and + * mappings for the new location are only setup on \p dstDevice. The exact behavior however + * also depends on the settings applied to this memory range via ::cuMemAdvise as described + * below: + * + * If ::CU_MEM_ADVISE_SET_READ_MOSTLY was set on any subset of this memory range, + * then that subset will create a read-only copy of the pages on \p dstDevice. + * + * If ::CU_MEM_ADVISE_SET_PREFERRED_LOCATION was called on any subset of this memory + * range, then the pages will be migrated to \p dstDevice even if \p dstDevice is not the + * preferred location of any pages in the memory range. + * + * If ::CU_MEM_ADVISE_SET_ACCESSED_BY was called on any subset of this memory range, + * then mappings to those pages from all the appropriate processors are updated to + * refer to the new location if establishing such a mapping is possible. Otherwise, + * those mappings are cleared. + * + * Note that this API is not required for functionality and only serves to improve performance + * by allowing the application to migrate data to a suitable location before it is accessed. + * Memory accesses to this range are always coherent and are allowed even when the data is + * actively being migrated. + * + * Note that this function is asynchronous with respect to the host and all work + * on other devices. + * + * \param devPtr - Pointer to be prefetched + * \param count - Size in bytes + * \param dstDevice - Destination device to prefetch to + * \param hStream - Stream to enqueue prefetch operation + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * \note_async + * \note_null_stream + * + * \sa ::cuMemcpy, ::cuMemcpyPeer, ::cuMemcpyAsync, + * ::cuMemcpy3DPeerAsync, ::cuMemAdvise, ::cuMemPrefetchAsync + * ::cudaMemPrefetchAsync_v2 + */ +CUresult CUDAAPI cuMemPrefetchAsync(CUdeviceptr devPtr, size_t count, CUdevice dstDevice, CUstream hStream); + +/** + * \brief Prefetches memory to the specified destination location + * + * Prefetches memory to the specified destination location. \p devPtr is the + * base device pointer of the memory to be prefetched and \p location specifies the + * destination location. \p count specifies the number of bytes to copy. \p hStream + * is the stream in which the operation is enqueued. The memory range must refer + * to managed memory allocated via ::cuMemAllocManaged or declared via __managed__ variables. + * + * Specifying ::CU_MEM_LOCATION_TYPE_DEVICE for ::CUmemLocation::type will prefetch memory to GPU + * specified by device ordinal ::CUmemLocation::id which must have non-zero value for the device attribute + * ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. Additionally, \p hStream must be associated with a device + * that has a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. + * Specifying ::CU_MEM_LOCATION_TYPE_HOST as ::CUmemLocation::type will prefetch data to host memory. + * Applications can request prefetching memory to a specific host NUMA node by specifying + * ::CU_MEM_LOCATION_TYPE_HOST_NUMA for ::CUmemLocation::type and a valid host NUMA node id in ::CUmemLocation::id + * Users can also request prefetching memory to the host NUMA node closest to the current thread's CPU by specifying + * ::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT for ::CUmemLocation::type. Note when ::CUmemLocation::type is etiher + * ::CU_MEM_LOCATION_TYPE_HOST OR ::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT, ::CUmemLocation::id will be ignored. + * + * The start address and end address of the memory range will be rounded down and rounded up + * respectively to be aligned to CPU page size before the prefetch operation is enqueued + * in the stream. + * + * If no physical memory has been allocated for this region, then this memory region + * will be populated and mapped on the destination device. If there's insufficient + * memory to prefetch the desired region, the Unified Memory driver may evict pages from other + * ::cuMemAllocManaged allocations to host memory in order to make room. Device memory + * allocated using ::cuMemAlloc or ::cuArrayCreate will not be evicted. + * + * By default, any mappings to the previous location of the migrated pages are removed and + * mappings for the new location are only setup on the destination location. The exact behavior however + * also depends on the settings applied to this memory range via ::cuMemAdvise as described + * below: + * + * If ::CU_MEM_ADVISE_SET_READ_MOSTLY was set on any subset of this memory range, + * then that subset will create a read-only copy of the pages on destination location. + * If however the destination location is a host NUMA node, then any pages of that subset + * that are already in another host NUMA node will be transferred to the destination. + * + * If ::CU_MEM_ADVISE_SET_PREFERRED_LOCATION was called on any subset of this memory + * range, then the pages will be migrated to \p location even if \p location is not the + * preferred location of any pages in the memory range. + * + * If ::CU_MEM_ADVISE_SET_ACCESSED_BY was called on any subset of this memory range, + * then mappings to those pages from all the appropriate processors are updated to + * refer to the new location if establishing such a mapping is possible. Otherwise, + * those mappings are cleared. + * + * Note that this API is not required for functionality and only serves to improve performance + * by allowing the application to migrate data to a suitable location before it is accessed. + * Memory accesses to this range are always coherent and are allowed even when the data is + * actively being migrated. + * + * Note that this function is asynchronous with respect to the host and all work + * on other devices. + * + * \param devPtr - Pointer to be prefetched + * \param count - Size in bytes + * \param dstDevice - Destination device to prefetch to + * \param flags - flags for future use, must be zero now. + * \param hStream - Stream to enqueue prefetch operation + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * \note_async + * \note_null_stream + * + * \sa ::cuMemcpy, ::cuMemcpyPeer, ::cuMemcpyAsync, + * ::cuMemcpy3DPeerAsync, ::cuMemAdvise, ::cuMemPrefetchAsync + * ::cudaMemPrefetchAsync_v2 + */ +CUresult CUDAAPI cuMemPrefetchAsync_v2(CUdeviceptr devPtr, size_t count, CUmemLocation location, unsigned int flags, CUstream hStream); + +/** + * \brief Advise about the usage of a given memory range + * + * Note there is a later version of this API, ::cuMemAdvise_v2. It will + * supplant this version in 13.0, which is retained for minor version compatibility. + * + * Advise the Unified Memory subsystem about the usage pattern for the memory range + * starting at \p devPtr with a size of \p count bytes. The start address and end address of the memory + * range will be rounded down and rounded up respectively to be aligned to CPU page size before the + * advice is applied. The memory range must refer to managed memory allocated via ::cuMemAllocManaged + * or declared via __managed__ variables. The memory range could also refer to system-allocated pageable + * memory provided it represents a valid, host-accessible region of memory and all additional constraints + * imposed by \p advice as outlined below are also satisfied. Specifying an invalid system-allocated pageable + * memory range results in an error being returned. + * + * The \p advice parameter can take the following values: + * - ::CU_MEM_ADVISE_SET_READ_MOSTLY: This implies that the data is mostly going to be read + * from and only occasionally written to. Any read accesses from any processor to this region will create a + * read-only copy of at least the accessed pages in that processor's memory. Additionally, if ::cuMemPrefetchAsync + * is called on this region, it will create a read-only copy of the data on the destination processor. + * If any processor writes to this region, all copies of the corresponding page will be invalidated + * except for the one where the write occurred. The \p device argument is ignored for this advice. + * Note that for a page to be read-duplicated, the accessing processor must either be the CPU or a GPU + * that has a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. + * Also, if a context is created on a device that does not have the device attribute + * ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS set, then read-duplication will not occur until + * all such contexts are destroyed. + * If the memory region refers to valid system-allocated pageable memory, then the accessing device must + * have a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS for a read-only + * copy to be created on that device. Note however that if the accessing device also has a non-zero value for the + * device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, then setting this advice + * will not create a read-only copy when that device accesses this memory region. + * + * - ::CU_MEM_ADVISE_UNSET_READ_MOSTLY: Undoes the effect of ::CU_MEM_ADVISE_SET_READ_MOSTLY and also prevents the + * Unified Memory driver from attempting heuristic read-duplication on the memory range. Any read-duplicated + * copies of the data will be collapsed into a single copy. The location for the collapsed + * copy will be the preferred location if the page has a preferred location and one of the read-duplicated + * copies was resident at that location. Otherwise, the location chosen is arbitrary. + * + * - ::CU_MEM_ADVISE_SET_PREFERRED_LOCATION: This advice sets the preferred location for the + * data to be the memory belonging to \p device. Passing in CU_DEVICE_CPU for \p device sets the + * preferred location as host memory. If \p device is a GPU, then it must have a non-zero value for the + * device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. Setting the preferred location + * does not cause data to migrate to that location immediately. Instead, it guides the migration policy + * when a fault occurs on that memory region. If the data is already in its preferred location and the + * faulting processor can establish a mapping without requiring the data to be migrated, then + * data migration will be avoided. On the other hand, if the data is not in its preferred location + * or if a direct mapping cannot be established, then it will be migrated to the processor accessing + * it. It is important to note that setting the preferred location does not prevent data prefetching + * done using ::cuMemPrefetchAsync. + * Having a preferred location can override the page thrash detection and resolution logic in the Unified + * Memory driver. Normally, if a page is detected to be constantly thrashing between for example host and device + * memory, the page may eventually be pinned to host memory by the Unified Memory driver. But + * if the preferred location is set as device memory, then the page will continue to thrash indefinitely. + * If ::CU_MEM_ADVISE_SET_READ_MOSTLY is also set on this memory region or any subset of it, then the + * policies associated with that advice will override the policies of this advice, unless read accesses from + * \p device will not result in a read-only copy being created on that device as outlined in description for + * the advice ::CU_MEM_ADVISE_SET_READ_MOSTLY. + * If the memory region refers to valid system-allocated pageable memory, then \p device must have a non-zero + * value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS. + * + * - ::CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION: Undoes the effect of ::CU_MEM_ADVISE_SET_PREFERRED_LOCATION + * and changes the preferred location to none. + * + * - ::CU_MEM_ADVISE_SET_ACCESSED_BY: This advice implies that the data will be accessed by \p device. + * Passing in ::CU_DEVICE_CPU for \p device will set the advice for the CPU. If \p device is a GPU, then + * the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS must be non-zero. + * This advice does not cause data migration and has no impact on the location of the data per se. Instead, + * it causes the data to always be mapped in the specified processor's page tables, as long as the + * location of the data permits a mapping to be established. If the data gets migrated for any reason, + * the mappings are updated accordingly. + * This advice is recommended in scenarios where data locality is not important, but avoiding faults is. + * Consider for example a system containing multiple GPUs with peer-to-peer access enabled, where the + * data located on one GPU is occasionally accessed by peer GPUs. In such scenarios, migrating data + * over to the other GPUs is not as important because the accesses are infrequent and the overhead of + * migration may be too high. But preventing faults can still help improve performance, and so having + * a mapping set up in advance is useful. Note that on CPU access of this data, the data may be migrated + * to host memory because the CPU typically cannot access device memory directly. Any GPU that had the + * ::CU_MEM_ADVISE_SET_ACCESSED_BY flag set for this data will now have its mapping updated to point to the + * page in host memory. + * If ::CU_MEM_ADVISE_SET_READ_MOSTLY is also set on this memory region or any subset of it, then the + * policies associated with that advice will override the policies of this advice. Additionally, if the + * preferred location of this memory region or any subset of it is also \p device, then the policies + * associated with ::CU_MEM_ADVISE_SET_PREFERRED_LOCATION will override the policies of this advice. + * If the memory region refers to valid system-allocated pageable memory, then \p device must have a non-zero + * value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS. Additionally, if \p device has + * a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, + * then this call has no effect. + * + * - ::CU_MEM_ADVISE_UNSET_ACCESSED_BY: Undoes the effect of ::CU_MEM_ADVISE_SET_ACCESSED_BY. Any mappings to + * the data from \p device may be removed at any time causing accesses to result in non-fatal page faults. + * If the memory region refers to valid system-allocated pageable memory, then \p device must have a non-zero + * value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS. Additionally, if \p device has + * a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, + * then this call has no effect. + * + * \param devPtr - Pointer to memory to set the advice for + * \param count - Size in bytes of the memory range + * \param advice - Advice to be applied for the specified memory range + * \param device - Device to apply the advice for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * \note_async + * \note_null_stream + * + * \sa ::cuMemcpy, ::cuMemcpyPeer, ::cuMemcpyAsync, + * ::cuMemcpy3DPeerAsync, ::cuMemPrefetchAsync, ::cuMemAdvise_v2 + * ::cudaMemAdvise + */ +CUresult CUDAAPI cuMemAdvise(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUdevice device); + +/** + * \brief Advise about the usage of a given memory range + * + * Advise the Unified Memory subsystem about the usage pattern for the memory range + * starting at \p devPtr with a size of \p count bytes. The start address and end address of the memory + * range will be rounded down and rounded up respectively to be aligned to CPU page size before the + * advice is applied. The memory range must refer to managed memory allocated via ::cuMemAllocManaged + * or declared via __managed__ variables. The memory range could also refer to system-allocated pageable + * memory provided it represents a valid, host-accessible region of memory and all additional constraints + * imposed by \p advice as outlined below are also satisfied. Specifying an invalid system-allocated pageable + * memory range results in an error being returned. + * + * The \p advice parameter can take the following values: + * - ::CU_MEM_ADVISE_SET_READ_MOSTLY: This implies that the data is mostly going to be read + * from and only occasionally written to. Any read accesses from any processor to this region will create a + * read-only copy of at least the accessed pages in that processor's memory. Additionally, if ::cuMemPrefetchAsync + * or ::cuMemPrefetchAsync_v2 is called on this region, it will create a read-only copy of the data on the destination processor. + * If the target location for ::cuMemPrefetchAsync_v2 is a host NUMA node and a read-only copy already exists on + * another host NUMA node, that copy will be migrated to the targeted host NUMA node. + * If any processor writes to this region, all copies of the corresponding page will be invalidated + * except for the one where the write occurred. If the writing processor is the CPU and the preferred location of + * the page is a host NUMA node, then the page will also be migrated to that host NUMA node. The \p location argument is ignored for this advice. + * Note that for a page to be read-duplicated, the accessing processor must either be the CPU or a GPU + * that has a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. + * Also, if a context is created on a device that does not have the device attribute + * ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS set, then read-duplication will not occur until + * all such contexts are destroyed. + * If the memory region refers to valid system-allocated pageable memory, then the accessing device must + * have a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS for a read-only + * copy to be created on that device. Note however that if the accessing device also has a non-zero value for the + * device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, then setting this advice + * will not create a read-only copy when that device accesses this memory region. + * + * - ::CU_MEM_ADVISE_UNSET_READ_MOSTLY: Undoes the effect of ::CU_MEM_ADVISE_SET_READ_MOSTLY and also prevents the + * Unified Memory driver from attempting heuristic read-duplication on the memory range. Any read-duplicated + * copies of the data will be collapsed into a single copy. The location for the collapsed + * copy will be the preferred location if the page has a preferred location and one of the read-duplicated + * copies was resident at that location. Otherwise, the location chosen is arbitrary. + * Note: The \p location argument is ignored for this advice. + * + * - ::CU_MEM_ADVISE_SET_PREFERRED_LOCATION: This advice sets the preferred location for the + * data to be the memory belonging to \p location. When ::CUmemLocation::type is ::CU_MEM_LOCATION_TYPE_HOST, + * ::CUmemLocation::id is ignored and the preferred location is set to be host memory. To set the preferred location + * to a specific host NUMA node, applications must set ::CUmemLocation::type to ::CU_MEM_LOCATION_TYPE_HOST_NUMA and + * ::CUmemLocation::id must specify the NUMA ID of the host NUMA node. If ::CUmemLocation::type is set to ::CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT, + * ::CUmemLocation::id will be ignored and the the host NUMA node closest to the calling thread's CPU will be used as the preferred location. + * If ::CUmemLocation::type is a ::CU_MEM_LOCATION_TYPE_DEVICE, then ::CUmemLocation::id must be a valid device ordinal + * and the device must have a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. + * Setting the preferred location does not cause data to migrate to that location immediately. Instead, it guides the migration policy + * when a fault occurs on that memory region. If the data is already in its preferred location and the + * faulting processor can establish a mapping without requiring the data to be migrated, then + * data migration will be avoided. On the other hand, if the data is not in its preferred location + * or if a direct mapping cannot be established, then it will be migrated to the processor accessing + * it. It is important to note that setting the preferred location does not prevent data prefetching + * done using ::cuMemPrefetchAsync. + * Having a preferred location can override the page thrash detection and resolution logic in the Unified + * Memory driver. Normally, if a page is detected to be constantly thrashing between for example host and device + * memory, the page may eventually be pinned to host memory by the Unified Memory driver. But + * if the preferred location is set as device memory, then the page will continue to thrash indefinitely. + * If ::CU_MEM_ADVISE_SET_READ_MOSTLY is also set on this memory region or any subset of it, then the + * policies associated with that advice will override the policies of this advice, unless read accesses from + * \p location will not result in a read-only copy being created on that procesor as outlined in description for + * the advice ::CU_MEM_ADVISE_SET_READ_MOSTLY. + * If the memory region refers to valid system-allocated pageable memory, and ::CUmemLocation::type is CU_MEM_LOCATION_TYPE_DEVICE + * then ::CUmemLocation::id must be a valid device that has a non-zero alue for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS. + * + * - ::CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION: Undoes the effect of ::CU_MEM_ADVISE_SET_PREFERRED_LOCATION + * and changes the preferred location to none. The \p location argument is ignored for this advice. + * + * - ::CU_MEM_ADVISE_SET_ACCESSED_BY: This advice implies that the data will be accessed by processor \p location. + * The ::CUmemLocation::type must be either ::CU_MEM_LOCATION_TYPE_DEVICE with ::CUmemLocation::id representing a valid device + * ordinal or ::CU_MEM_LOCATION_TYPE_HOST and ::CUmemLocation::id will be ignored. All other location types are invalid. + * If ::CUmemLocation::id is a GPU, then the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS must be non-zero. + * This advice does not cause data migration and has no impact on the location of the data per se. Instead, + * it causes the data to always be mapped in the specified processor's page tables, as long as the + * location of the data permits a mapping to be established. If the data gets migrated for any reason, + * the mappings are updated accordingly. + * This advice is recommended in scenarios where data locality is not important, but avoiding faults is. + * Consider for example a system containing multiple GPUs with peer-to-peer access enabled, where the + * data located on one GPU is occasionally accessed by peer GPUs. In such scenarios, migrating data + * over to the other GPUs is not as important because the accesses are infrequent and the overhead of + * migration may be too high. But preventing faults can still help improve performance, and so having + * a mapping set up in advance is useful. Note that on CPU access of this data, the data may be migrated + * to host memory because the CPU typically cannot access device memory directly. Any GPU that had the + * ::CU_MEM_ADVISE_SET_ACCESSED_BY flag set for this data will now have its mapping updated to point to the + * page in host memory. + * If ::CU_MEM_ADVISE_SET_READ_MOSTLY is also set on this memory region or any subset of it, then the + * policies associated with that advice will override the policies of this advice. Additionally, if the + * preferred location of this memory region or any subset of it is also \p location, then the policies + * associated with ::CU_MEM_ADVISE_SET_PREFERRED_LOCATION will override the policies of this advice. + * If the memory region refers to valid system-allocated pageable memory, and ::CUmemLocation::type is ::CU_MEM_LOCATION_TYPE_DEVICE + * then device in ::CUmemLocation::id must have a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS. + * Additionally, if ::CUmemLocation::id has a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, + * then this call has no effect. + * + * - ::CU_MEM_ADVISE_UNSET_ACCESSED_BY: Undoes the effect of ::CU_MEM_ADVISE_SET_ACCESSED_BY. Any mappings to + * the data from \p location may be removed at any time causing accesses to result in non-fatal page faults. + * If the memory region refers to valid system-allocated pageable memory, and ::CUmemLocation::type is ::CU_MEM_LOCATION_TYPE_DEVICE + * then device in ::CUmemLocation::id must have a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS. + * Additionally, if ::CUmemLocation::id has a non-zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, + * then this call has no effect. + * + * \param devPtr - Pointer to memory to set the advice for + * \param count - Size in bytes of the memory range + * \param advice - Advice to be applied for the specified memory range + * \param location - location to apply the advice for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * \note_async + * \note_null_stream + * + * \sa ::cuMemcpy, ::cuMemcpyPeer, ::cuMemcpyAsync, + * ::cuMemcpy3DPeerAsync, ::cuMemPrefetchAsync, ::cuMemAdvise + * ::cudaMemAdvise + */ +CUresult CUDAAPI cuMemAdvise_v2(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUmemLocation location); + +/** + * \brief Query an attribute of a given memory range + * + * Query an attribute about the memory range starting at \p devPtr with a size of \p count bytes. The + * memory range must refer to managed memory allocated via ::cuMemAllocManaged or declared via + * __managed__ variables. + * + * The \p attribute parameter can take the following values: + * - ::CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY: If this attribute is specified, \p data will be interpreted + * as a 32-bit integer, and \p dataSize must be 4. The result returned will be 1 if all pages in the given + * memory range have read-duplication enabled, or 0 otherwise. + * - ::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION: If this attribute is specified, \p data will be + * interpreted as a 32-bit integer, and \p dataSize must be 4. The result returned will be a GPU device + * id if all pages in the memory range have that GPU as their preferred location, or it will be CU_DEVICE_CPU + * if all pages in the memory range have the CPU as their preferred location, or it will be CU_DEVICE_INVALID + * if either all the pages don't have the same preferred location or some of the pages don't have a + * preferred location at all. Note that the actual location of the pages in the memory range at the time of + * the query may be different from the preferred location. + * - ::CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY: If this attribute is specified, \p data will be interpreted + * as an array of 32-bit integers, and \p dataSize must be a non-zero multiple of 4. The result returned + * will be a list of device ids that had ::CU_MEM_ADVISE_SET_ACCESSED_BY set for that entire memory range. + * If any device does not have that advice set for the entire memory range, that device will not be included. + * If \p data is larger than the number of devices that have that advice set for that memory range, + * CU_DEVICE_INVALID will be returned in all the extra space provided. For ex., if \p dataSize is 12 + * (i.e. \p data has 3 elements) and only device 0 has the advice set, then the result returned will be + * { 0, CU_DEVICE_INVALID, CU_DEVICE_INVALID }. If \p data is smaller than the number of devices that have + * that advice set, then only as many devices will be returned as can fit in the array. There is no + * guarantee on which specific devices will be returned, however. + * - ::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION: If this attribute is specified, \p data will be + * interpreted as a 32-bit integer, and \p dataSize must be 4. The result returned will be the last location + * to which all pages in the memory range were prefetched explicitly via ::cuMemPrefetchAsync. This will either be + * a GPU id or CU_DEVICE_CPU depending on whether the last location for prefetch was a GPU or the CPU + * respectively. If any page in the memory range was never explicitly prefetched or if all pages were not + * prefetched to the same location, CU_DEVICE_INVALID will be returned. Note that this simply returns the + * last location that the application requested to prefetch the memory range to. It gives no indication as to + * whether the prefetch operation to that location has completed or even begun. + * - ::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE: If this attribute is specified, \p data will be + * interpreted as a ::CUmemLocationType, and \p dataSize must be sizeof(CUmemLocationType). The ::CUmemLocationType returned will be + * ::CU_MEM_LOCATION_TYPE_DEVICE if all pages in the memory range have the same GPU as their preferred location, or ::CUmemLocationType + * will be ::CU_MEM_LOCATION_TYPE_HOST if all pages in the memory range have the CPU as their preferred location, or it will be ::CU_MEM_LOCATION_TYPE_HOST_NUMA + * if all the pages in the memory range have the same host NUMA node ID as their preferred location or it will be ::CU_MEM_LOCATION_TYPE_INVALID + * if either all the pages don't have the same preferred location or some of the pages don't have a preferred location at all. + * Note that the actual location type of the pages in the memory range at the time of the query may be different from the preferred location type. + * - ::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID: If this attribute is specified, \p data will be + * interpreted as a 32-bit integer, and \p dataSize must be 4. If the ::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE query for the same address range + * returns ::CU_MEM_LOCATION_TYPE_DEVICE, it will be a valid device ordinal or if it returns ::CU_MEM_LOCATION_TYPE_HOST_NUMA, it will be a valid host NUMA node ID + * or if it returns any other location type, the id should be ignored. + * - ::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE: If this attribute is specified, \p data will be + * interpreted as a ::CUmemLocationType, and \p dataSize must be sizeof(CUmemLocationType). The result returned will be the last location + * to which all pages in the memory range were prefetched explicitly via ::cuMemPrefetchAsync. The ::CUmemLocationType returned + * will be ::CU_MEM_LOCATION_TYPE_DEVICE if the last prefetch location was a GPU or ::CU_MEM_LOCATION_TYPE_HOST if it was the CPU or ::CU_MEM_LOCATION_TYPE_HOST_NUMA if + * the last prefetch location was a specific host NUMA node. If any page in the memory range was never explicitly prefetched or if all pages were not + * prefetched to the same location, ::CUmemLocationType will be ::CU_MEM_LOCATION_TYPE_INVALID. + * Note that this simply returns the last location type that the application requested to prefetch the memory range to. It gives no indication as to + * whether the prefetch operation to that location has completed or even begun. + * - ::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID: If this attribute is specified, \p data will be + * interpreted as a 32-bit integer, and \p dataSize must be 4. If the ::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE query for the same address range + * returns ::CU_MEM_LOCATION_TYPE_DEVICE, it will be a valid device ordinal or if it returns ::CU_MEM_LOCATION_TYPE_HOST_NUMA, it will be a valid host NUMA node ID + * or if it returns any other location type, the id should be ignored. + * + * \param data - A pointers to a memory location where the result + * of each attribute query will be written to. + * \param dataSize - Array containing the size of data + * \param attribute - The attribute to query + * \param devPtr - Start of the range to query + * \param count - Size of the range to query + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * \note_async + * \note_null_stream + * + * \sa ::cuMemRangeGetAttributes, ::cuMemPrefetchAsync, + * ::cuMemAdvise, + * ::cudaMemRangeGetAttribute + */ +CUresult CUDAAPI cuMemRangeGetAttribute(void *data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count); + +/** + * \brief Query attributes of a given memory range. + * + * Query attributes of the memory range starting at \p devPtr with a size of \p count bytes. The + * memory range must refer to managed memory allocated via ::cuMemAllocManaged or declared via + * __managed__ variables. The \p attributes array will be interpreted to have \p numAttributes + * entries. The \p dataSizes array will also be interpreted to have \p numAttributes entries. + * The results of the query will be stored in \p data. + * + * The list of supported attributes are given below. Please refer to ::cuMemRangeGetAttribute for + * attribute descriptions and restrictions. + * + * - ::CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY + * - ::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION + * - ::CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY + * - ::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION + * - ::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_TYPE + * - ::CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION_ID + * - ::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_TYPE + * - ::CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION_ID + * + * \param data - A two-dimensional array containing pointers to memory + * locations where the result of each attribute query will be written to. + * \param dataSizes - Array containing the sizes of each result + * \param attributes - An array of attributes to query + * (numAttributes and the number of attributes in this array should match) + * \param numAttributes - Number of attributes to query + * \param devPtr - Start of the range to query + * \param count - Size of the range to query + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa ::cuMemRangeGetAttribute, ::cuMemAdvise, + * ::cuMemPrefetchAsync, + * ::cudaMemRangeGetAttributes + */ +CUresult CUDAAPI cuMemRangeGetAttributes(void **data, size_t *dataSizes, CUmem_range_attribute *attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count); + +/** + * \brief Set attributes on a previously allocated memory region + * + * The supported attributes are: + * + * - ::CU_POINTER_ATTRIBUTE_SYNC_MEMOPS: + * + * A boolean attribute that can either be set (1) or unset (0). When set, + * the region of memory that \p ptr points to is guaranteed to always synchronize + * memory operations that are synchronous. If there are some previously initiated + * synchronous memory operations that are pending when this attribute is set, the + * function does not return until those memory operations are complete. + * See further documentation in the section titled "API synchronization behavior" + * to learn more about cases when synchronous memory operations can + * exhibit asynchronous behavior. + * \p value will be considered as a pointer to an unsigned integer to which this attribute is to be set. + * + * \param value - Pointer to memory containing the value to be set + * \param attribute - Pointer attribute to set + * \param ptr - Pointer to a memory region allocated using CUDA memory allocation APIs + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa ::cuPointerGetAttribute, + * ::cuPointerGetAttributes, + * ::cuMemAlloc, + * ::cuMemFree, + * ::cuMemAllocHost, + * ::cuMemFreeHost, + * ::cuMemHostAlloc, + * ::cuMemHostRegister, + * ::cuMemHostUnregister + */ +CUresult CUDAAPI cuPointerSetAttribute(const void *value, CUpointer_attribute attribute, CUdeviceptr ptr); + +/** + * \brief Returns information about a pointer. + * + * The supported attributes are (refer to ::cuPointerGetAttribute for attribute descriptions and restrictions): + * + * - ::CU_POINTER_ATTRIBUTE_CONTEXT + * - ::CU_POINTER_ATTRIBUTE_MEMORY_TYPE + * - ::CU_POINTER_ATTRIBUTE_DEVICE_POINTER + * - ::CU_POINTER_ATTRIBUTE_HOST_POINTER + * - ::CU_POINTER_ATTRIBUTE_SYNC_MEMOPS + * - ::CU_POINTER_ATTRIBUTE_BUFFER_ID + * - ::CU_POINTER_ATTRIBUTE_IS_MANAGED + * - ::CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL + * - ::CU_POINTER_ATTRIBUTE_RANGE_START_ADDR + * - ::CU_POINTER_ATTRIBUTE_RANGE_SIZE + * - ::CU_POINTER_ATTRIBUTE_MAPPED + * - ::CU_POINTER_ATTRIBUTE_IS_LEGACY_CUDA_IPC_CAPABLE + * - ::CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES + * - ::CU_POINTER_ATTRIBUTE_MEMPOOL_HANDLE + * + * \param numAttributes - Number of attributes to query + * \param attributes - An array of attributes to query + * (numAttributes and the number of attributes in this array should match) + * \param data - A two-dimensional array containing pointers to memory + * locations where the result of each attribute query will be written to. + * \param ptr - Pointer to query + * + * Unlike ::cuPointerGetAttribute, this function will not return an error when the \p ptr + * encountered is not a valid CUDA pointer. Instead, the attributes are assigned default NULL values + * and CUDA_SUCCESS is returned. + * + * If \p ptr was not allocated by, mapped by, or registered with a ::CUcontext which uses UVA + * (Unified Virtual Addressing), ::CUDA_ERROR_INVALID_CONTEXT is returned. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuPointerGetAttribute, + * ::cuPointerSetAttribute, + * ::cudaPointerGetAttributes + */ +CUresult CUDAAPI cuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute *attributes, void **data, CUdeviceptr ptr); + +/** @} */ /* END CUDA_UNIFIED */ + +/** + * \defgroup CUDA_STREAM Stream Management + * + * ___MANBRIEF___ stream management functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the stream management functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Create a stream + * + * Creates a stream and returns a handle in \p phStream. The \p Flags argument + * determines behaviors of the stream. + * + * Valid values for \p Flags are: + * - ::CU_STREAM_DEFAULT: Default stream creation flag. + * - ::CU_STREAM_NON_BLOCKING: Specifies that work running in the created + * stream may run concurrently with work in stream 0 (the NULL stream), and that + * the created stream should perform no implicit synchronization with stream 0. + * + * \param phStream - Returned newly created stream + * \param Flags - Parameters for stream creation + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \sa ::cuStreamDestroy, + * ::cuStreamCreateWithPriority, + * ::cuStreamGetPriority, + * ::cuStreamGetFlags, + * ::cuStreamWaitEvent, + * ::cuStreamQuery, + * ::cuStreamSynchronize, + * ::cuStreamAddCallback, + * ::cudaStreamCreate, + * ::cudaStreamCreateWithFlags + */ +CUresult CUDAAPI cuStreamCreate(CUstream *phStream, unsigned int Flags); + +/** + * \brief Create a stream with the given priority + * + * Creates a stream with the specified priority and returns a handle in \p phStream. + * This affects the scheduling priority of work in the stream. Priorities provide a + * hint to preferentially run work with higher priority when possible, but do + * not preempt already-running work or provide any other functional guarantee on + * execution order. + * + * \p priority follows a convention where lower numbers represent higher priorities. + * '0' represents default priority. The range of meaningful numerical priorities can + * be queried using ::cuCtxGetStreamPriorityRange. If the specified priority is + * outside the numerical range returned by ::cuCtxGetStreamPriorityRange, + * it will automatically be clamped to the lowest or the highest number in the range. + * + * \param phStream - Returned newly created stream + * \param flags - Flags for stream creation. See ::cuStreamCreate for a list of + * valid flags + * \param priority - Stream priority. Lower numbers represent higher priorities. + * See ::cuCtxGetStreamPriorityRange for more information about + * meaningful stream priorities that can be passed. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \note Stream priorities are supported only on GPUs + * with compute capability 3.5 or higher. + * + * \note In the current implementation, only compute kernels launched in + * priority streams are affected by the stream's priority. Stream priorities have + * no effect on host-to-device and device-to-host memory operations. + * + * \sa ::cuStreamDestroy, + * ::cuStreamCreate, + * ::cuStreamGetPriority, + * ::cuCtxGetStreamPriorityRange, + * ::cuStreamGetFlags, + * ::cuStreamWaitEvent, + * ::cuStreamQuery, + * ::cuStreamSynchronize, + * ::cuStreamAddCallback, + * ::cudaStreamCreateWithPriority + */ +CUresult CUDAAPI cuStreamCreateWithPriority(CUstream *phStream, unsigned int flags, int priority); + + +/** + * \brief Query the priority of a given stream + * + * Query the priority of a stream created using ::cuStreamCreate or ::cuStreamCreateWithPriority + * and return the priority in \p priority. Note that if the stream was created with a + * priority outside the numerical range returned by ::cuCtxGetStreamPriorityRange, + * this function returns the clamped priority. + * See ::cuStreamCreateWithPriority for details about priority clamping. + * + * \param hStream - Handle to the stream to be queried + * \param priority - Pointer to a signed integer in which the stream's priority is returned + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \sa ::cuStreamDestroy, + * ::cuStreamCreate, + * ::cuStreamCreateWithPriority, + * ::cuCtxGetStreamPriorityRange, + * ::cuStreamGetFlags, + * ::cudaStreamGetPriority + */ +CUresult CUDAAPI cuStreamGetPriority(CUstream hStream, int *priority); + +/** + * \brief Query the flags of a given stream + * + * Query the flags of a stream created using ::cuStreamCreate or ::cuStreamCreateWithPriority + * and return the flags in \p flags. + * + * \param hStream - Handle to the stream to be queried + * \param flags - Pointer to an unsigned integer in which the stream's flags are returned + * The value returned in \p flags is a logical 'OR' of all flags that + * were used while creating this stream. See ::cuStreamCreate for the list + * of valid flags + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \sa ::cuStreamDestroy, + * ::cuStreamCreate, + * ::cuStreamGetPriority, + * ::cudaStreamGetFlags + */ +CUresult CUDAAPI cuStreamGetFlags(CUstream hStream, unsigned int *flags); + +/** + * \brief Returns the unique Id associated with the stream handle supplied + * + * Returns in \p streamId the unique Id which is associated with the given stream handle. + * The Id is unique for the life of the program. + * + * The stream handle \p hStream can refer to any of the following: + *
    + *
  • a stream created via any of the CUDA driver APIs such as ::cuStreamCreate + * and ::cuStreamCreateWithPriority, or their runtime API equivalents such as + * ::cudaStreamCreate, ::cudaStreamCreateWithFlags and ::cudaStreamCreateWithPriority. + * Passing an invalid handle will result in undefined behavior.
  • + *
  • any of the special streams such as the NULL stream, ::CU_STREAM_LEGACY and + * ::CU_STREAM_PER_THREAD. The runtime API equivalents of these are also accepted, + * which are NULL, ::cudaStreamLegacy and ::cudaStreamPerThread respectively.
  • + *
+ * + * \param hStream - Handle to the stream to be queried + * \param streamId - Pointer to store the Id of the stream + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuStreamDestroy, + * ::cuStreamCreate, + * ::cuStreamGetPriority, + * ::cudaStreamGetId + */ +CUresult CUDAAPI cuStreamGetId(CUstream hStream, unsigned long long *streamId); + +/** + * \brief Query the context associated with a stream + * + * Returns the CUDA context that the stream is associated with. + * + * The stream handle \p hStream can refer to any of the following: + *
    + *
  • a stream created via any of the CUDA driver APIs such as ::cuStreamCreate + * and ::cuStreamCreateWithPriority, or their runtime API equivalents such as + * ::cudaStreamCreate, ::cudaStreamCreateWithFlags and ::cudaStreamCreateWithPriority. + * The returned context is the context that was active in the calling thread when the + * stream was created. Passing an invalid handle will result in undefined behavior.
  • + *
  • any of the special streams such as the NULL stream, ::CU_STREAM_LEGACY and + * ::CU_STREAM_PER_THREAD. The runtime API equivalents of these are also accepted, + * which are NULL, ::cudaStreamLegacy and ::cudaStreamPerThread respectively. + * Specifying any of the special handles will return the context current to the + * calling thread. If no context is current to the calling thread, + * ::CUDA_ERROR_INVALID_CONTEXT is returned.
  • + *
+ * + * \param hStream - Handle to the stream to be queried + * \param pctx - Returned context associated with the stream + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * \notefnerr + * + * \sa ::cuStreamDestroy, + * ::cuStreamCreateWithPriority, + * ::cuStreamGetPriority, + * ::cuStreamGetFlags, + * ::cuStreamWaitEvent, + * ::cuStreamQuery, + * ::cuStreamSynchronize, + * ::cuStreamAddCallback, + * ::cudaStreamCreate, + * ::cudaStreamCreateWithFlags + */ +CUresult CUDAAPI cuStreamGetCtx(CUstream hStream, CUcontext *pctx); + +/** + * \brief Make a compute stream wait on an event + * + * Makes all future work submitted to \p hStream wait for all work captured in + * \p hEvent. See ::cuEventRecord() for details on what is captured by an event. + * The synchronization will be performed efficiently on the device when applicable. + * \p hEvent may be from a different context or device than \p hStream. + * + * flags include: + * - ::CU_EVENT_WAIT_DEFAULT: Default event creation flag. + * - ::CU_EVENT_WAIT_EXTERNAL: Event is captured in the graph as an external + * event node when performing stream capture. This flag is invalid outside + * of stream capture. + * + * \param hStream - Stream to wait + * \param hEvent - Event to wait on (may not be NULL) + * \param Flags - See ::CUevent_capture_flags + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * \note_null_stream + * \notefnerr + * + * \sa ::cuStreamCreate, + * ::cuEventRecord, + * ::cuStreamQuery, + * ::cuStreamSynchronize, + * ::cuStreamAddCallback, + * ::cuStreamDestroy, + * ::cudaStreamWaitEvent + */ +CUresult CUDAAPI cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags); + +/** + * \brief Add a callback to a compute stream + * + * \note This function is slated for eventual deprecation and removal. If + * you do not require the callback to execute in case of a device error, + * consider using ::cuLaunchHostFunc. Additionally, this function is not + * supported with ::cuStreamBeginCapture and ::cuStreamEndCapture, unlike + * ::cuLaunchHostFunc. + * + * Adds a callback to be called on the host after all currently enqueued + * items in the stream have completed. For each + * cuStreamAddCallback call, the callback will be executed exactly once. + * The callback will block later work in the stream until it is finished. + * + * The callback may be passed ::CUDA_SUCCESS or an error code. In the event + * of a device error, all subsequently executed callbacks will receive an + * appropriate ::CUresult. + * + * Callbacks must not make any CUDA API calls. Attempting to use a CUDA API + * will result in ::CUDA_ERROR_NOT_PERMITTED. Callbacks must not perform any + * synchronization that may depend on outstanding device work or other callbacks + * that are not mandated to run earlier. Callbacks without a mandated order + * (in independent streams) execute in undefined order and may be serialized. + * + * For the purposes of Unified Memory, callback execution makes a number of + * guarantees: + *
    + *
  • The callback stream is considered idle for the duration of the + * callback. Thus, for example, a callback may always use memory attached + * to the callback stream.
  • + *
  • The start of execution of a callback has the same effect as + * synchronizing an event recorded in the same stream immediately prior to + * the callback. It thus synchronizes streams which have been "joined" + * prior to the callback.
  • + *
  • Adding device work to any stream does not have the effect of making + * the stream active until all preceding host functions and stream callbacks + * have executed. Thus, for + * example, a callback might use global attached memory even if work has + * been added to another stream, if the work has been ordered behind the + * callback with an event.
  • + *
  • Completion of a callback does not cause a stream to become + * active except as described above. The callback stream will remain idle + * if no device work follows the callback, and will remain idle across + * consecutive callbacks without device work in between. Thus, for example, + * stream synchronization can be done by signaling from a callback at the + * end of the stream.
  • + *
+ * + * \param hStream - Stream to add callback to + * \param callback - The function to call once preceding stream operations are complete + * \param userData - User specified data to be passed to the callback function + * \param flags - Reserved for future use, must be 0 + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \note_null_stream + * \notefnerr + * + * \sa ::cuStreamCreate, + * ::cuStreamQuery, + * ::cuStreamSynchronize, + * ::cuStreamWaitEvent, + * ::cuStreamDestroy, + * ::cuMemAllocManaged, + * ::cuStreamAttachMemAsync, + * ::cuLaunchHostFunc, + * ::cudaStreamAddCallback + */ +CUresult CUDAAPI cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void *userData, unsigned int flags); + +/** + * \brief Begins graph capture on a stream + * + * Begin graph capture on \p hStream. When a stream is in capture mode, all operations + * pushed into the stream will not be executed, but will instead be captured into + * a graph, which will be returned via ::cuStreamEndCapture. Capture may not be initiated + * if \p stream is CU_STREAM_LEGACY. Capture must be ended on the same stream in which + * it was initiated, and it may only be initiated if the stream is not already in capture + * mode. The capture mode may be queried via ::cuStreamIsCapturing. A unique id + * representing the capture sequence may be queried via ::cuStreamGetCaptureInfo. + * + * If \p mode is not ::CU_STREAM_CAPTURE_MODE_RELAXED, ::cuStreamEndCapture must be + * called on this stream from the same thread. + * + * \param hStream - Stream in which to initiate capture + * \param mode - Controls the interaction of this capture sequence with other API + * calls that are potentially unsafe. For more details see + * ::cuThreadExchangeStreamCaptureMode. + * + * \note Kernels captured using this API must not use texture and surface references. + * Reading or writing through any texture or surface reference is undefined + * behavior. This restriction does not apply to texture and surface objects. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa + * ::cuStreamCreate, + * ::cuStreamIsCapturing, + * ::cuStreamEndCapture, + * ::cuThreadExchangeStreamCaptureMode + */ +CUresult CUDAAPI cuStreamBeginCapture(CUstream hStream, CUstreamCaptureMode mode); + +/** + * \brief Begins graph capture on a stream to an existing graph + * + * Begin graph capture on \p hStream, placing new nodes into an existing graph. When a stream is + * in capture mode, all operations pushed into the stream will not be executed, but will instead + * be captured into \p hGraph. The graph will not be instantiable until the user calls + * ::cuStreamEndCapture. + * + * Capture may not be initiated if \p stream is CU_STREAM_LEGACY. Capture must be ended on the + * same stream in which it was initiated, and it may only be initiated if the stream is not + * already in capture mode. The capture mode may be queried via ::cuStreamIsCapturing. A unique id + * representing the capture sequence may be queried via ::cuStreamGetCaptureInfo. + * + * If \p mode is not ::CU_STREAM_CAPTURE_MODE_RELAXED, ::cuStreamEndCapture must be + * called on this stream from the same thread. + * + * \param hStream - Stream in which to initiate capture. + * \param hGraph - Graph to capture into. + * \param dependencies - Dependencies of the first node captured in the stream. Can be NULL if numDependencies is 0. + * \param dependencyData - Optional array of data associated with each dependency. + * \param numDependencies - Number of dependencies. + * \param mode - Controls the interaction of this capture sequence with other API + * calls that are potentially unsafe. For more details see + * ::cuThreadExchangeStreamCaptureMode. + * + * \note Kernels captured using this API must not use texture and surface references. + * Reading or writing through any texture or surface reference is undefined + * behavior. This restriction does not apply to texture and surface objects. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa + * ::cuStreamBeginCapture, + * ::cuStreamCreate, + * ::cuStreamIsCapturing, + * ::cuStreamEndCapture, + * ::cuThreadExchangeStreamCaptureMode, + * ::cuGraphAddNode, + */ +CUresult CUDAAPI cuStreamBeginCaptureToGraph(CUstream hStream, CUgraph hGraph, const CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, CUstreamCaptureMode mode); + +/** + * \brief Swaps the stream capture interaction mode for a thread + * + * Sets the calling thread's stream capture interaction mode to the value contained + * in \p *mode, and overwrites \p *mode with the previous mode for the thread. To + * facilitate deterministic behavior across function or module boundaries, callers + * are encouraged to use this API in a push-pop fashion: \code + CUstreamCaptureMode mode = desiredMode; + cuThreadExchangeStreamCaptureMode(&mode); + ... + cuThreadExchangeStreamCaptureMode(&mode); // restore previous mode + * \endcode + * + * During stream capture (see ::cuStreamBeginCapture), some actions, such as a call + * to ::cudaMalloc, may be unsafe. In the case of ::cudaMalloc, the operation is + * not enqueued asynchronously to a stream, and is not observed by stream capture. + * Therefore, if the sequence of operations captured via ::cuStreamBeginCapture + * depended on the allocation being replayed whenever the graph is launched, the + * captured graph would be invalid. + * + * Therefore, stream capture places restrictions on API calls that can be made within + * or concurrently to a ::cuStreamBeginCapture-::cuStreamEndCapture sequence. This + * behavior can be controlled via this API and flags to ::cuStreamBeginCapture. + * + * A thread's mode is one of the following: + * - \p CU_STREAM_CAPTURE_MODE_GLOBAL: This is the default mode. If the local thread has + * an ongoing capture sequence that was not initiated with + * \p CU_STREAM_CAPTURE_MODE_RELAXED at \p cuStreamBeginCapture, or if any other thread + * has a concurrent capture sequence initiated with \p CU_STREAM_CAPTURE_MODE_GLOBAL, + * this thread is prohibited from potentially unsafe API calls. + * - \p CU_STREAM_CAPTURE_MODE_THREAD_LOCAL: If the local thread has an ongoing capture + * sequence not initiated with \p CU_STREAM_CAPTURE_MODE_RELAXED, it is prohibited + * from potentially unsafe API calls. Concurrent capture sequences in other threads + * are ignored. + * - \p CU_STREAM_CAPTURE_MODE_RELAXED: The local thread is not prohibited from potentially + * unsafe API calls. Note that the thread is still prohibited from API calls which + * necessarily conflict with stream capture, for example, attempting ::cuEventQuery + * on an event that was last recorded inside a capture sequence. + * + * \param mode - Pointer to mode value to swap with the current mode + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa + * ::cuStreamBeginCapture + */ +CUresult CUDAAPI cuThreadExchangeStreamCaptureMode(CUstreamCaptureMode *mode); + +/** + * \brief Ends capture on a stream, returning the captured graph + * + * End capture on \p hStream, returning the captured graph via \p phGraph. + * Capture must have been initiated on \p hStream via a call to ::cuStreamBeginCapture. + * If capture was invalidated, due to a violation of the rules of stream capture, then + * a NULL graph will be returned. + * + * If the \p mode argument to ::cuStreamBeginCapture was not + * ::CU_STREAM_CAPTURE_MODE_RELAXED, this call must be from the same thread as + * ::cuStreamBeginCapture. + * + * \param hStream - Stream to query + * \param phGraph - The captured graph + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD + * \notefnerr + * + * \sa + * ::cuStreamCreate, + * ::cuStreamBeginCapture, + * ::cuStreamIsCapturing, + * ::cuGraphDestroy + */ +CUresult CUDAAPI cuStreamEndCapture(CUstream hStream, CUgraph *phGraph); + +/** + * \brief Returns a stream's capture status + * + * Return the capture status of \p hStream via \p captureStatus. After a successful + * call, \p *captureStatus will contain one of the following: + * - ::CU_STREAM_CAPTURE_STATUS_NONE: The stream is not capturing. + * - ::CU_STREAM_CAPTURE_STATUS_ACTIVE: The stream is capturing. + * - ::CU_STREAM_CAPTURE_STATUS_INVALIDATED: The stream was capturing but an error + * has invalidated the capture sequence. The capture sequence must be terminated + * with ::cuStreamEndCapture on the stream where it was initiated in order to + * continue using \p hStream. + * + * Note that, if this is called on ::CU_STREAM_LEGACY (the "null stream") while + * a blocking stream in the same context is capturing, it will return + * ::CUDA_ERROR_STREAM_CAPTURE_IMPLICIT and \p *captureStatus is unspecified + * after the call. The blocking stream capture is not invalidated. + * + * When a blocking stream is capturing, the legacy stream is in an + * unusable state until the blocking stream capture is terminated. The legacy + * stream is not supported for stream capture, but attempted use would have an + * implicit dependency on the capturing stream(s). + * + * \param hStream - Stream to query + * \param captureStatus - Returns the stream's capture status + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_STREAM_CAPTURE_IMPLICIT + * \notefnerr + * + * \sa + * ::cuStreamCreate, + * ::cuStreamBeginCapture, + * ::cuStreamEndCapture + */ +CUresult CUDAAPI cuStreamIsCapturing(CUstream hStream, CUstreamCaptureStatus *captureStatus); + +/** + * \brief Query a stream's capture state + * + * Query stream state related to stream capture. + * + * If called on ::CU_STREAM_LEGACY (the "null stream") while a stream not created + * with ::CU_STREAM_NON_BLOCKING is capturing, returns ::CUDA_ERROR_STREAM_CAPTURE_IMPLICIT. + * + * Valid data (other than capture status) is returned only if both of the following are true: + * - the call returns CUDA_SUCCESS + * - the returned capture status is ::CU_STREAM_CAPTURE_STATUS_ACTIVE + * + * \param hStream - The stream to query + * \param captureStatus_out - Location to return the capture status of the stream; required + * \param id_out - Optional location to return an id for the capture sequence, which is + * unique over the lifetime of the process + * \param graph_out - Optional location to return the graph being captured into. All + * operations other than destroy and node removal are permitted on the graph + * while the capture sequence is in progress. This API does not transfer + * ownership of the graph, which is transferred or destroyed at + * ::cuStreamEndCapture. Note that the graph handle may be invalidated before + * end of capture for certain errors. Nodes that are or become + * unreachable from the original stream at ::cuStreamEndCapture due to direct + * actions on the graph do not trigger ::CUDA_ERROR_STREAM_CAPTURE_UNJOINED. + * \param dependencies_out - Optional location to store a pointer to an array of nodes. + * The next node to be captured in the stream will depend on this set of nodes, + * absent operations such as event wait which modify this set. The array pointer + * is valid until the next API call which operates on the stream or until the + * capture is terminated. The node handles may be copied out and are valid until + * they or the graph is destroyed. The driver-owned array may also be passed + * directly to APIs that operate on the graph (not the stream) without copying. + * \param numDependencies_out - Optional location to store the size of the array + * returned in dependencies_out. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_STREAM_CAPTURE_IMPLICIT + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuStreamGetCaptureInfo_v3 + * ::cuStreamBeginCapture, + * ::cuStreamIsCapturing, + * ::cuStreamUpdateCaptureDependencies + */ +CUresult CUDAAPI cuStreamGetCaptureInfo(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, + cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, size_t *numDependencies_out); + +/** + * \brief Query a stream's capture state (12.3+) + * + * Query stream state related to stream capture. + * + * If called on ::CU_STREAM_LEGACY (the "null stream") while a stream not created + * with ::CU_STREAM_NON_BLOCKING is capturing, returns ::CUDA_ERROR_STREAM_CAPTURE_IMPLICIT. + * + * Valid data (other than capture status) is returned only if both of the following are true: + * - the call returns CUDA_SUCCESS + * - the returned capture status is ::CU_STREAM_CAPTURE_STATUS_ACTIVE + * + * If \p edgeData_out is non-NULL then \p dependencies_out must be as well. If + * \p dependencies_out is non-NULL and \p edgeData_out is NULL, but there is non-zero edge + * data for one or more of the current stream dependencies, the call will return + * ::CUDA_ERROR_LOSSY_QUERY. + * + * \param hStream - The stream to query + * \param captureStatus_out - Location to return the capture status of the stream; required + * \param id_out - Optional location to return an id for the capture sequence, which is + * unique over the lifetime of the process + * \param graph_out - Optional location to return the graph being captured into. All + * operations other than destroy and node removal are permitted on the graph + * while the capture sequence is in progress. This API does not transfer + * ownership of the graph, which is transferred or destroyed at + * ::cuStreamEndCapture. Note that the graph handle may be invalidated before + * end of capture for certain errors. Nodes that are or become + * unreachable from the original stream at ::cuStreamEndCapture due to direct + * actions on the graph do not trigger ::CUDA_ERROR_STREAM_CAPTURE_UNJOINED. + * \param dependencies_out - Optional location to store a pointer to an array of nodes. + * The next node to be captured in the stream will depend on this set of nodes, + * absent operations such as event wait which modify this set. The array pointer + * is valid until the next API call which operates on the stream or until the + * capture is terminated. The node handles may be copied out and are valid until + * they or the graph is destroyed. The driver-owned array may also be passed + * directly to APIs that operate on the graph (not the stream) without copying. + * \param edgeData_out - Optional location to store a pointer to an array of graph edge + * data. This array parallels \c dependencies_out; the next node to be added + * has an edge to \c dependencies_out[i] with annotation \c edgeData_out[i] for + * each \c i. The array pointer is valid until the next API call which operates + * on the stream or until the capture is terminated. + * \param numDependencies_out - Optional location to store the size of the array + * returned in dependencies_out. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_STREAM_CAPTURE_IMPLICIT, + * ::CUDA_ERROR_LOSSY_QUERY + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuStreamGetCaptureInfo + * ::cuStreamBeginCapture, + * ::cuStreamIsCapturing, + * ::cuStreamUpdateCaptureDependencies + */ +CUresult CUDAAPI cuStreamGetCaptureInfo_v3(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, + cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, + const CUgraphEdgeData **edgeData_out, size_t *numDependencies_out); + +/** + * \brief Update the set of dependencies in a capturing stream (11.3+) + * + * Modifies the dependency set of a capturing stream. The dependency set is the set + * of nodes that the next captured node in the stream will depend on. + * + * Valid flags are ::CU_STREAM_ADD_CAPTURE_DEPENDENCIES and + * ::CU_STREAM_SET_CAPTURE_DEPENDENCIES. These control whether the set passed to + * the API is added to the existing set or replaces it. A flags value of 0 defaults + * to ::CU_STREAM_ADD_CAPTURE_DEPENDENCIES. + * + * Nodes that are removed from the dependency set via this API do not result in + * ::CUDA_ERROR_STREAM_CAPTURE_UNJOINED if they are unreachable from the stream at + * ::cuStreamEndCapture. + * + * Returns ::CUDA_ERROR_ILLEGAL_STATE if the stream is not capturing. + * + * This API is new in CUDA 11.3. Developers requiring compatibility across minor + * versions to CUDA 11.0 should not use this API or provide a fallback. + * + * \param hStream - The stream to update + * \param dependencies - The set of dependencies to add + * \param numDependencies - The size of the dependencies array + * \param flags - See above + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_ILLEGAL_STATE + * + * \sa + * ::cuStreamBeginCapture, + * ::cuStreamGetCaptureInfo, + */ +CUresult CUDAAPI cuStreamUpdateCaptureDependencies(CUstream hStream, CUgraphNode *dependencies, size_t numDependencies, unsigned int flags); + +/** + * \brief Update the set of dependencies in a capturing stream (12.3+) + * + * Modifies the dependency set of a capturing stream. The dependency set is the set + * of nodes that the next captured node in the stream will depend on along with the + * edge data for those dependencies. + * + * Valid flags are ::CU_STREAM_ADD_CAPTURE_DEPENDENCIES and + * ::CU_STREAM_SET_CAPTURE_DEPENDENCIES. These control whether the set passed to + * the API is added to the existing set or replaces it. A flags value of 0 defaults + * to ::CU_STREAM_ADD_CAPTURE_DEPENDENCIES. + * + * Nodes that are removed from the dependency set via this API do not result in + * ::CUDA_ERROR_STREAM_CAPTURE_UNJOINED if they are unreachable from the stream at + * ::cuStreamEndCapture. + * + * Returns ::CUDA_ERROR_ILLEGAL_STATE if the stream is not capturing. + * + * \param hStream - The stream to update + * \param dependencies - The set of dependencies to add + * \param dependencyData - Optional array of data associated with each dependency. + * \param numDependencies - The size of the dependencies array + * \param flags - See above + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_ILLEGAL_STATE + * + * \sa + * ::cuStreamBeginCapture, + * ::cuStreamGetCaptureInfo, + */ +CUresult CUDAAPI cuStreamUpdateCaptureDependencies_v2(CUstream hStream, CUgraphNode *dependencies, + const CUgraphEdgeData *dependencyData, size_t numDependencies, unsigned int flags); + +/** + * \brief Attach memory to a stream asynchronously + * + * Enqueues an operation in \p hStream to specify stream association of + * \p length bytes of memory starting from \p dptr. This function is a + * stream-ordered operation, meaning that it is dependent on, and will + * only take effect when, previous work in stream has completed. Any + * previous association is automatically replaced. + * + * \p dptr must point to one of the following types of memories: + * - managed memory declared using the __managed__ keyword or allocated with + * ::cuMemAllocManaged. + * - a valid host-accessible region of system-allocated pageable memory. This + * type of memory may only be specified if the device associated with the + * stream reports a non-zero value for the device attribute + * ::CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS. + * + * For managed allocations, \p length must be either zero or the entire + * allocation's size. Both indicate that the entire allocation's stream + * association is being changed. Currently, it is not possible to change stream + * association for a portion of a managed allocation. + * + * For pageable host allocations, \p length must be non-zero. + * + * The stream association is specified using \p flags which must be + * one of ::CUmemAttach_flags. + * If the ::CU_MEM_ATTACH_GLOBAL flag is specified, the memory can be accessed + * by any stream on any device. + * If the ::CU_MEM_ATTACH_HOST flag is specified, the program makes a guarantee + * that it won't access the memory on the device from any stream on a device that + * has a zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. + * If the ::CU_MEM_ATTACH_SINGLE flag is specified and \p hStream is associated with + * a device that has a zero value for the device attribute ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS, + * the program makes a guarantee that it will only access the memory on the device + * from \p hStream. It is illegal to attach singly to the NULL stream, because the + * NULL stream is a virtual global stream and not a specific stream. An error will + * be returned in this case. + * + * When memory is associated with a single stream, the Unified Memory system will + * allow CPU access to this memory region so long as all operations in \p hStream + * have completed, regardless of whether other streams are active. In effect, + * this constrains exclusive ownership of the managed memory region by + * an active GPU to per-stream activity instead of whole-GPU activity. + * + * Accessing memory on the device from streams that are not associated with + * it will produce undefined results. No error checking is performed by the + * Unified Memory system to ensure that kernels launched into other streams + * do not access this region. + * + * It is a program's responsibility to order calls to ::cuStreamAttachMemAsync + * via events, synchronization or other means to ensure legal access to memory + * at all times. Data visibility and coherency will be changed appropriately + * for all kernels which follow a stream-association change. + * + * If \p hStream is destroyed while data is associated with it, the association is + * removed and the association reverts to the default visibility of the allocation + * as specified at ::cuMemAllocManaged. For __managed__ variables, the default + * association is always ::CU_MEM_ATTACH_GLOBAL. Note that destroying a stream is an + * asynchronous operation, and as a result, the change to default association won't + * happen until all work in the stream has completed. + * + * \param hStream - Stream in which to enqueue the attach operation + * \param dptr - Pointer to memory (must be a pointer to managed memory or + * to a valid host-accessible region of system-allocated + * pageable memory) + * \param length - Length of memory + * \param flags - Must be one of ::CUmemAttach_flags + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \note_null_stream + * \notefnerr + * + * \sa ::cuStreamCreate, + * ::cuStreamQuery, + * ::cuStreamSynchronize, + * ::cuStreamWaitEvent, + * ::cuStreamDestroy, + * ::cuMemAllocManaged, + * ::cudaStreamAttachMemAsync + */ +CUresult CUDAAPI cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags); + +/** + * \brief Determine status of a compute stream + * + * Returns ::CUDA_SUCCESS if all operations in the stream specified by + * \p hStream have completed, or ::CUDA_ERROR_NOT_READY if not. + * + * For the purposes of Unified Memory, a return value of ::CUDA_SUCCESS + * is equivalent to having called ::cuStreamSynchronize(). + * + * \param hStream - Stream to query status of + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_READY + * \note_null_stream + * \notefnerr + * + * \sa ::cuStreamCreate, + * ::cuStreamWaitEvent, + * ::cuStreamDestroy, + * ::cuStreamSynchronize, + * ::cuStreamAddCallback, + * ::cudaStreamQuery + */ +CUresult CUDAAPI cuStreamQuery(CUstream hStream); + +/** + * \brief Wait until a stream's tasks are completed + * + * Waits until the device has completed all operations in the stream specified + * by \p hStream. If the context was created with the + * ::CU_CTX_SCHED_BLOCKING_SYNC flag, the CPU thread will block until the + * stream is finished with all of its tasks. + * + * \param hStream - Stream to wait for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE + + * \note_null_stream + * \notefnerr + * + * \sa ::cuStreamCreate, + * ::cuStreamDestroy, + * ::cuStreamWaitEvent, + * ::cuStreamQuery, + * ::cuStreamAddCallback, + * ::cudaStreamSynchronize + */ +CUresult CUDAAPI cuStreamSynchronize(CUstream hStream); + +/** + * \brief Destroys a stream + * + * Destroys the stream specified by \p hStream. + * + * In case the device is still doing work in the stream \p hStream + * when ::cuStreamDestroy() is called, the function will return immediately + * and the resources associated with \p hStream will be released automatically + * once the device has completed all work in \p hStream. + * + * \param hStream - Stream to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuStreamCreate, + * ::cuStreamWaitEvent, + * ::cuStreamQuery, + * ::cuStreamSynchronize, + * ::cuStreamAddCallback, + * ::cudaStreamDestroy + */ +CUresult CUDAAPI cuStreamDestroy(CUstream hStream); + +/** + * \brief Copies attributes from source stream to destination stream. + * + * Copies attributes from source stream \p src to destination stream \p dst. + * Both streams must have the same context. + * + * \param[out] dst Destination stream + * \param[in] src Source stream + * For list of attributes see ::CUstreamAttrID + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa + * ::CUaccessPolicyWindow + */ +CUresult CUDAAPI cuStreamCopyAttributes(CUstream dst, CUstream src); + +/** + * \brief Queries stream attribute. + * + * Queries attribute \p attr from \p hStream and stores it in corresponding + * member of \p value_out. + * + * \param[in] hStream + * \param[in] attr + * \param[out] value_out + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa + * ::CUaccessPolicyWindow + */ +CUresult CUDAAPI cuStreamGetAttribute(CUstream hStream, CUstreamAttrID attr, + CUstreamAttrValue *value_out); + +/** + * \brief Sets stream attribute. + * + * Sets attribute \p attr on \p hStream from corresponding attribute of + * \p value. The updated attribute will be applied to subsequent work + * submitted to the stream. It will not affect previously submitted work. + * + * \param[out] hStream + * \param[in] attr + * \param[in] value + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa + * ::CUaccessPolicyWindow + */ +CUresult CUDAAPI cuStreamSetAttribute(CUstream hStream, CUstreamAttrID attr, + const CUstreamAttrValue *value); + +/** @} */ /* END CUDA_STREAM */ + + +/** + * \defgroup CUDA_EVENT Event Management + * + * ___MANBRIEF___ event management functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the event management functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Creates an event + * + * Creates an event *phEvent for the current context with the flags specified via + * \p Flags. Valid flags include: + * - ::CU_EVENT_DEFAULT: Default event creation flag. + * - ::CU_EVENT_BLOCKING_SYNC: Specifies that the created event should use blocking + * synchronization. A CPU thread that uses ::cuEventSynchronize() to wait on + * an event created with this flag will block until the event has actually + * been recorded. + * - ::CU_EVENT_DISABLE_TIMING: Specifies that the created event does not need + * to record timing data. Events created with this flag specified and + * the ::CU_EVENT_BLOCKING_SYNC flag not specified will provide the best + * performance when used with ::cuStreamWaitEvent() and ::cuEventQuery(). + * - ::CU_EVENT_INTERPROCESS: Specifies that the created event may be used as an + * interprocess event by ::cuIpcGetEventHandle(). ::CU_EVENT_INTERPROCESS must + * be specified along with ::CU_EVENT_DISABLE_TIMING. + * + * \param phEvent - Returns newly created event + * \param Flags - Event creation flags + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \sa + * ::cuEventRecord, + * ::cuEventQuery, + * ::cuEventSynchronize, + * ::cuEventDestroy, + * ::cuEventElapsedTime, + * ::cudaEventCreate, + * ::cudaEventCreateWithFlags + */ +CUresult CUDAAPI cuEventCreate(CUevent *phEvent, unsigned int Flags); + +/** + * \brief Records an event + * + * Captures in \p hEvent the contents of \p hStream at the time of this call. + * \p hEvent and \p hStream must be from the same context. + * Calls such as ::cuEventQuery() or ::cuStreamWaitEvent() will then + * examine or wait for completion of the work that was captured. Uses of + * \p hStream after this call do not modify \p hEvent. See note on default + * stream behavior for what is captured in the default case. + * + * ::cuEventRecord() can be called multiple times on the same event and + * will overwrite the previously captured state. Other APIs such as + * ::cuStreamWaitEvent() use the most recently captured state at the time + * of the API call, and are not affected by later calls to + * ::cuEventRecord(). Before the first call to ::cuEventRecord(), an + * event represents an empty set of work, so for example ::cuEventQuery() + * would return ::CUDA_SUCCESS. + * + * \param hEvent - Event to record + * \param hStream - Stream to record event for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * \note_null_stream + * \notefnerr + * + * \sa ::cuEventCreate, + * ::cuEventQuery, + * ::cuEventSynchronize, + * ::cuStreamWaitEvent, + * ::cuEventDestroy, + * ::cuEventElapsedTime, + * ::cudaEventRecord, + * ::cuEventRecordWithFlags + */ +CUresult CUDAAPI cuEventRecord(CUevent hEvent, CUstream hStream); + +/** + * \brief Records an event + * + * Captures in \p hEvent the contents of \p hStream at the time of this call. + * \p hEvent and \p hStream must be from the same context. + * Calls such as ::cuEventQuery() or ::cuStreamWaitEvent() will then + * examine or wait for completion of the work that was captured. Uses of + * \p hStream after this call do not modify \p hEvent. See note on default + * stream behavior for what is captured in the default case. + * + * ::cuEventRecordWithFlags() can be called multiple times on the same event and + * will overwrite the previously captured state. Other APIs such as + * ::cuStreamWaitEvent() use the most recently captured state at the time + * of the API call, and are not affected by later calls to + * ::cuEventRecordWithFlags(). Before the first call to ::cuEventRecordWithFlags(), an + * event represents an empty set of work, so for example ::cuEventQuery() + * would return ::CUDA_SUCCESS. + * + * flags include: + * - ::CU_EVENT_RECORD_DEFAULT: Default event creation flag. + * - ::CU_EVENT_RECORD_EXTERNAL: Event is captured in the graph as an external + * event node when performing stream capture. This flag is invalid outside + * of stream capture. + * + * \param hEvent - Event to record + * \param hStream - Stream to record event for + * \param flags - See ::CUevent_capture_flags + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * \note_null_stream + * \notefnerr + * + * \sa ::cuEventCreate, + * ::cuEventQuery, + * ::cuEventSynchronize, + * ::cuStreamWaitEvent, + * ::cuEventDestroy, + * ::cuEventElapsedTime, + * ::cuEventRecord, + * ::cudaEventRecord + */ +CUresult CUDAAPI cuEventRecordWithFlags(CUevent hEvent, CUstream hStream, unsigned int flags); + +/** + * \brief Queries an event's status + * + * Queries the status of all work currently captured by \p hEvent. See + * ::cuEventRecord() for details on what is captured by an event. + * + * Returns ::CUDA_SUCCESS if all captured work has been completed, or + * ::CUDA_ERROR_NOT_READY if any captured work is incomplete. + * + * For the purposes of Unified Memory, a return value of ::CUDA_SUCCESS + * is equivalent to having called ::cuEventSynchronize(). + * + * \param hEvent - Event to query + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_READY + * \notefnerr + * + * \sa ::cuEventCreate, + * ::cuEventRecord, + * ::cuEventSynchronize, + * ::cuEventDestroy, + * ::cuEventElapsedTime, + * ::cudaEventQuery + */ +CUresult CUDAAPI cuEventQuery(CUevent hEvent); + +/** + * \brief Waits for an event to complete + * + * Waits until the completion of all work currently captured in \p hEvent. + * See ::cuEventRecord() for details on what is captured by an event. + * + * Waiting for an event that was created with the ::CU_EVENT_BLOCKING_SYNC + * flag will cause the calling CPU thread to block until the event has + * been completed by the device. If the ::CU_EVENT_BLOCKING_SYNC flag has + * not been set, then the CPU thread will busy-wait until the event has + * been completed by the device. + * + * \param hEvent - Event to wait for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuEventCreate, + * ::cuEventRecord, + * ::cuEventQuery, + * ::cuEventDestroy, + * ::cuEventElapsedTime, + * ::cudaEventSynchronize + */ +CUresult CUDAAPI cuEventSynchronize(CUevent hEvent); + +/** + * \brief Destroys an event + * + * Destroys the event specified by \p hEvent. + * + * An event may be destroyed before it is complete (i.e., while + * ::cuEventQuery() would return ::CUDA_ERROR_NOT_READY). In this case, the + * call does not block on completion of the event, and any associated + * resources will automatically be released asynchronously at completion. + * + * \param hEvent - Event to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuEventCreate, + * ::cuEventRecord, + * ::cuEventQuery, + * ::cuEventSynchronize, + * ::cuEventElapsedTime, + * ::cudaEventDestroy + */ +CUresult CUDAAPI cuEventDestroy(CUevent hEvent); + +/** + * \brief Computes the elapsed time between two events + * + * Computes the elapsed time between two events (in milliseconds with a + * resolution of around 0.5 microseconds). + * + * If either event was last recorded in a non-NULL stream, the resulting time + * may be greater than expected (even if both used the same stream handle). This + * happens because the ::cuEventRecord() operation takes place asynchronously + * and there is no guarantee that the measured latency is actually just between + * the two events. Any number of other different stream operations could execute + * in between the two measured events, thus altering the timing in a significant + * way. + * + * If ::cuEventRecord() has not been called on either event then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If ::cuEventRecord() has been called + * on both events but one or both of them has not yet been completed (that is, + * ::cuEventQuery() would return ::CUDA_ERROR_NOT_READY on at least one of the + * events), ::CUDA_ERROR_NOT_READY is returned. If either event was created with + * the ::CU_EVENT_DISABLE_TIMING flag, then this function will return + * ::CUDA_ERROR_INVALID_HANDLE. + * + * \param pMilliseconds - Time between \p hStart and \p hEnd in ms + * \param hStart - Starting event + * \param hEnd - Ending event + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_READY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuEventCreate, + * ::cuEventRecord, + * ::cuEventQuery, + * ::cuEventSynchronize, + * ::cuEventDestroy, + * ::cudaEventElapsedTime + */ +CUresult CUDAAPI cuEventElapsedTime(float *pMilliseconds, CUevent hStart, CUevent hEnd); + +/** @} */ /* END CUDA_EVENT */ + +/** + * \defgroup CUDA_EXTRES_INTEROP External Resource Interoperability + * + * ___MANBRIEF___ External resource interoperability functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the external resource interoperability functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + + /** + * \brief Imports an external memory object + * + * Imports an externally allocated memory object and returns + * a handle to that in \p extMem_out. + * + * The properties of the handle being imported must be described in + * \p memHandleDesc. The ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC structure + * is defined as follows: + * + * \code + typedef struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st { + CUexternalMemoryHandleType type; + union { + int fd; + struct { + void *handle; + const void *name; + } win32; + const void *nvSciBufObject; + } handle; + unsigned long long size; + unsigned int flags; + } CUDA_EXTERNAL_MEMORY_HANDLE_DESC; + * \endcode + * + * where ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type specifies the type + * of handle being imported. ::CUexternalMemoryHandleType is + * defined as: + * + * \code + typedef enum CUexternalMemoryHandleType_enum { + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD = 1, + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 = 2, + CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3, + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP = 4, + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE = 5, + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE = 6, + CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT = 7, + CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF = 8 + } CUexternalMemoryHandleType; + * \endcode + * + * If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type is + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD, then + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::fd must be a valid + * file descriptor referencing a memory object. Ownership of + * the file descriptor is transferred to the CUDA driver when the + * handle is imported successfully. Performing any operations on the + * file descriptor after it is imported results in undefined behavior. + * + * If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type is + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32, then exactly one + * of ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle and + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name must not be + * NULL. If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * references a memory object. Ownership of this handle is + * not transferred to CUDA after the import operation, so the + * application must release the handle using the appropriate system + * call. If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name + * is not NULL, then it must point to a NULL-terminated array of + * UTF-16 characters that refers to a memory object. + * + * If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type is + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT, then + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle must + * be non-NULL and + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name + * must be NULL. The handle specified must be a globally shared KMT + * handle. This handle does not hold a reference to the underlying + * object, and thus will be invalid when all references to the + * memory object are destroyed. + * + * If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type is + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP, then exactly one + * of ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle and + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name must not be + * NULL. If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * is returned by ID3D12Device::CreateSharedHandle when referring to a + * ID3D12Heap object. This handle holds a reference to the underlying + * object. If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name + * is not NULL, then it must point to a NULL-terminated array of + * UTF-16 characters that refers to a ID3D12Heap object. + * + * If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type is + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE, then exactly one + * of ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle and + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name must not be + * NULL. If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * is returned by ID3D12Device::CreateSharedHandle when referring to a + * ID3D12Resource object. This handle holds a reference to the + * underlying object. If + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name + * is not NULL, then it must point to a NULL-terminated array of + * UTF-16 characters that refers to a ID3D12Resource object. + * + * If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type is + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE, then + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle must + * represent a valid shared NT handle that is returned by + * IDXGIResource1::CreateSharedHandle when referring to a + * ID3D11Resource object. If + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name + * is not NULL, then it must point to a NULL-terminated array of + * UTF-16 characters that refers to a ID3D11Resource object. + * + * If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type is + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT, then + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::handle must + * represent a valid shared KMT handle that is returned by + * IDXGIResource::GetSharedHandle when referring to a + * ID3D11Resource object and + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::win32::name + * must be NULL. + * + * If ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type is + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF, then + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::handle::nvSciBufObject must be non-NULL + * and reference a valid NvSciBuf object. + * If the NvSciBuf object imported into CUDA is also mapped by other drivers, then the + * application must use ::cuWaitExternalSemaphoresAsync or ::cuSignalExternalSemaphoresAsync + * as appropriate barriers to maintain coherence between CUDA and the other drivers. + * See ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC and ::CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC + * for memory synchronization. + * + * + * The size of the memory object must be specified in + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::size. + * + * Specifying the flag ::CUDA_EXTERNAL_MEMORY_DEDICATED in + * ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::flags indicates that the + * resource is a dedicated resource. The definition of what a + * dedicated resource is outside the scope of this extension. + * This flag must be set if ::CUDA_EXTERNAL_MEMORY_HANDLE_DESC::type + * is one of the following: + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT + * + * \param extMem_out - Returned handle to an external memory object + * \param memHandleDesc - Memory import handle descriptor + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OPERATING_SYSTEM + * \notefnerr + * + * \note If the Vulkan memory imported into CUDA is mapped on the CPU then the + * application must use vkInvalidateMappedMemoryRanges/vkFlushMappedMemoryRanges + * as well as appropriate Vulkan pipeline barriers to maintain coherence between + * CPU and GPU. For more information on these APIs, please refer to "Synchronization + * and Cache Control" chapter from Vulkan specification. + * + * \sa ::cuDestroyExternalMemory, + * ::cuExternalMemoryGetMappedBuffer, + * ::cuExternalMemoryGetMappedMipmappedArray + */ +CUresult CUDAAPI cuImportExternalMemory(CUexternalMemory *extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC *memHandleDesc); + +/** + * \brief Maps a buffer onto an imported memory object + * + * Maps a buffer onto an imported memory object and returns a device + * pointer in \p devPtr. + * + * The properties of the buffer being mapped must be described in + * \p bufferDesc. The ::CUDA_EXTERNAL_MEMORY_BUFFER_DESC structure is + * defined as follows: + * + * \code + typedef struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st { + unsigned long long offset; + unsigned long long size; + unsigned int flags; + } CUDA_EXTERNAL_MEMORY_BUFFER_DESC; + * \endcode + * + * where ::CUDA_EXTERNAL_MEMORY_BUFFER_DESC::offset is the offset in + * the memory object where the buffer's base address is. + * ::CUDA_EXTERNAL_MEMORY_BUFFER_DESC::size is the size of the buffer. + * ::CUDA_EXTERNAL_MEMORY_BUFFER_DESC::flags must be zero. + * + * The offset and size have to be suitably aligned to match the + * requirements of the external API. Mapping two buffers whose ranges + * overlap may or may not result in the same virtual address being + * returned for the overlapped portion. In such cases, the application + * must ensure that all accesses to that region from the GPU are + * volatile. Otherwise writes made via one address are not guaranteed + * to be visible via the other address, even if they're issued by the + * same thread. It is recommended that applications map the combined + * range instead of mapping separate buffers and then apply the + * appropriate offsets to the returned pointer to derive the + * individual buffers. + * + * The returned pointer \p devPtr must be freed using ::cuMemFree. + * + * \param devPtr - Returned device pointer to buffer + * \param extMem - Handle to external memory object + * \param bufferDesc - Buffer descriptor + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuImportExternalMemory, + * ::cuDestroyExternalMemory, + * ::cuExternalMemoryGetMappedMipmappedArray + */ +CUresult CUDAAPI cuExternalMemoryGetMappedBuffer(CUdeviceptr *devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC *bufferDesc); + +/** + * \brief Maps a CUDA mipmapped array onto an external memory object + * + * Maps a CUDA mipmapped array onto an external object and returns a + * handle to it in \p mipmap. + * + * The properties of the CUDA mipmapped array being mapped must be + * described in \p mipmapDesc. The structure + * ::CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC is defined as follows: + * + * \code + typedef struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st { + unsigned long long offset; + CUDA_ARRAY3D_DESCRIPTOR arrayDesc; + unsigned int numLevels; + } CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC; + * \endcode + * + * where ::CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::offset is the + * offset in the memory object where the base level of the mipmap + * chain is. + * ::CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::arrayDesc describes + * the format, dimensions and type of the base level of the mipmap + * chain. For further details on these parameters, please refer to the + * documentation for ::cuMipmappedArrayCreate. Note that if the mipmapped + * array is bound as a color target in the graphics API, then the flag + * ::CUDA_ARRAY3D_COLOR_ATTACHMENT must be specified in + * ::CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::arrayDesc::Flags. + * ::CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::numLevels specifies + * the total number of levels in the mipmap chain. + * + * If \p extMem was imported from a handle of type ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF, then + * ::CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC::numLevels must be equal to 1. + * + * The returned CUDA mipmapped array must be freed using ::cuMipmappedArrayDestroy. + * + * \param mipmap - Returned CUDA mipmapped array + * \param extMem - Handle to external memory object + * \param mipmapDesc - CUDA array descriptor + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuImportExternalMemory, + * ::cuDestroyExternalMemory, + * ::cuExternalMemoryGetMappedBuffer + */ +CUresult CUDAAPI cuExternalMemoryGetMappedMipmappedArray(CUmipmappedArray *mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC *mipmapDesc); + +/** + * \brief Destroys an external memory object. + * + * Destroys the specified external memory object. Any existing buffers + * and CUDA mipmapped arrays mapped onto this object must no longer be + * used and must be explicitly freed using ::cuMemFree and + * ::cuMipmappedArrayDestroy respectively. + * + * \param extMem - External memory object to be destroyed + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuImportExternalMemory, + * ::cuExternalMemoryGetMappedBuffer, + * ::cuExternalMemoryGetMappedMipmappedArray + */ +CUresult CUDAAPI cuDestroyExternalMemory(CUexternalMemory extMem); + +/** + * \brief Imports an external semaphore + * + * Imports an externally allocated synchronization object and returns + * a handle to that in \p extSem_out. + * + * The properties of the handle being imported must be described in + * \p semHandleDesc. The ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC is + * defined as follows: + * + * \code + typedef struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st { + CUexternalSemaphoreHandleType type; + union { + int fd; + struct { + void *handle; + const void *name; + } win32; + const void* NvSciSyncObj; + } handle; + unsigned int flags; + } CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC; + * \endcode + * + * where ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type specifies the type of + * handle being imported. ::CUexternalSemaphoreHandleType is defined + * as: + * + * \code + typedef enum CUexternalSemaphoreHandleType_enum { + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD = 1, + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 = 2, + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3, + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = 4, + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE = 5, + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC = 6, + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX = 7, + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT = 8, + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD = 9, + CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 = 10 + } CUexternalSemaphoreHandleType; + * \endcode + * + * If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type is + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD, then + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::fd must be a valid + * file descriptor referencing a synchronization object. Ownership of + * the file descriptor is transferred to the CUDA driver when the + * handle is imported successfully. Performing any operations on the + * file descriptor after it is imported results in undefined behavior. + * + * If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type is + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32, then exactly one + * of ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle and + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name must not be + * NULL. If + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * references a synchronization object. Ownership of this handle is + * not transferred to CUDA after the import operation, so the + * application must release the handle using the appropriate system + * call. If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name + * is not NULL, then it must name a valid synchronization object. + * + * If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type is + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT, then + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle must + * be non-NULL and + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name + * must be NULL. The handle specified must be a globally shared KMT + * handle. This handle does not hold a reference to the underlying + * object, and thus will be invalid when all references to the + * synchronization object are destroyed. + * + * If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type is + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE, then exactly one + * of ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle and + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name must not be + * NULL. If + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * is returned by ID3D12Device::CreateSharedHandle when referring to a + * ID3D12Fence object. This handle holds a reference to the underlying + * object. If + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name + * is not NULL, then it must name a valid synchronization object that + * refers to a valid ID3D12Fence object. + * + * If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type is + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE, then + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle + * represents a valid shared NT handle that is returned by + * ID3D11Fence::CreateSharedHandle. If + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name + * is not NULL, then it must name a valid synchronization object that + * refers to a valid ID3D11Fence object. + * + * If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type is + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, then + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::nvSciSyncObj + * represents a valid NvSciSyncObj. + * + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX, then + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle + * represents a valid shared NT handle that + * is returned by IDXGIResource1::CreateSharedHandle when referring to + * a IDXGIKeyedMutex object. If + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name + * is not NULL, then it must name a valid synchronization object that + * refers to a valid IDXGIKeyedMutex object. + * + * If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type is + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT, then + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle + * represents a valid shared KMT handle that + * is returned by IDXGIResource::GetSharedHandle when referring to + * a IDXGIKeyedMutex object and + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name must be NULL. + * + * If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type is + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD, then + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::fd must be a valid + * file descriptor referencing a synchronization object. Ownership of + * the file descriptor is transferred to the CUDA driver when the + * handle is imported successfully. Performing any operations on the + * file descriptor after it is imported results in undefined behavior. + * + * If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::type is + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32, then exactly one + * of ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle and + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name must not be + * NULL. If + * ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * references a synchronization object. Ownership of this handle is + * not transferred to CUDA after the import operation, so the + * application must release the handle using the appropriate system + * call. If ::CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC::handle::win32::name + * is not NULL, then it must name a valid synchronization object. + * + * \param extSem_out - Returned handle to an external semaphore + * \param semHandleDesc - Semaphore import handle descriptor + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OPERATING_SYSTEM + * \notefnerr + * + * \sa ::cuDestroyExternalSemaphore, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync + */ +CUresult CUDAAPI cuImportExternalSemaphore(CUexternalSemaphore *extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC *semHandleDesc); + +/** + * \brief Signals a set of external semaphore objects + * + * Enqueues a signal operation on a set of externally allocated + * semaphore object in the specified stream. The operations will be + * executed when all prior operations in the stream complete. + * + * The exact semantics of signaling a semaphore depends on the type of + * the object. + * + * If the semaphore object is any one of the following types: + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT + * then signaling the semaphore will set it to the signaled state. + * + * If the semaphore object is any one of the following types: + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 + * then the semaphore will be set to the value specified in + * ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS::params::fence::value. + * + * If the semaphore object is of the type ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC + * this API sets ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS::params::nvSciSync::fence + * to a value that can be used by subsequent waiters of the same NvSciSync object + * to order operations with those currently submitted in \p stream. Such an update + * will overwrite previous contents of + * ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS::params::nvSciSync::fence. By default, + * signaling such an external semaphore object causes appropriate memory synchronization + * operations to be performed over all external memory objects that are imported as + * ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. This ensures that any subsequent accesses + * made by other importers of the same set of NvSciBuf memory object(s) are coherent. + * These operations can be skipped by specifying the flag + * ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_SKIP_NVSCIBUF_MEMSYNC, which can be used as a + * performance optimization when data coherency is not required. But specifying this + * flag in scenarios where data coherency is required results in undefined behavior. + * Also, for semaphore object of the type ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, + * if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in + * ::cuDeviceGetNvSciSyncAttributes to CUDA_NVSCISYNC_ATTR_SIGNAL, this API will return + * CUDA_ERROR_NOT_SUPPORTED. + * NvSciSyncFence associated with semaphore object of the type + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC can be deterministic. For this the + * NvSciSyncAttrList used to create the semaphore object must have value of + * NvSciSyncAttrKey_RequireDeterministicFences key set to true. Deterministic fences + * allow users to enqueue a wait over the semaphore object even before corresponding + * signal is enqueued. For such a semaphore object, CUDA guarantees that each signal + * operation will increment the fence value by '1'. Users are expected to track count + * of signals enqueued on the semaphore object and insert waits accordingly. When such + * a semaphore object is signaled from multiple streams, due to concurrent stream + * execution, it is possible that the order in which the semaphore gets signaled is + * indeterministic. This could lead to waiters of the semaphore getting unblocked + * incorrectly. Users are expected to handle such situations, either by not using the + * same semaphore object with deterministic fence support enabled in different streams + * or by adding explicit dependency amongst such streams so that the semaphore is + * signaled in order. + * + * If the semaphore object is any one of the following types: + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT + * then the keyed mutex will be released with the key specified in + * ::CUDA_EXTERNAL_SEMAPHORE_PARAMS::params::keyedmutex::key. + * + * \param extSemArray - Set of external semaphores to be signaled + * \param paramsArray - Array of semaphore parameters + * \param numExtSems - Number of semaphores to signal + * \param stream - Stream to enqueue the signal operations in + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \notefnerr + * + * \sa ::cuImportExternalSemaphore, + * ::cuDestroyExternalSemaphore, + * ::cuWaitExternalSemaphoresAsync + */ +CUresult CUDAAPI cuSignalExternalSemaphoresAsync(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS *paramsArray, unsigned int numExtSems, CUstream stream); + +/** + * \brief Waits on a set of external semaphore objects + * + * Enqueues a wait operation on a set of externally allocated + * semaphore object in the specified stream. The operations will be + * executed when all prior operations in the stream complete. + * + * The exact semantics of waiting on a semaphore depends on the type + * of the object. + * + * If the semaphore object is any one of the following types: + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT + * then waiting on the semaphore will wait until the semaphore reaches + * the signaled state. The semaphore will then be reset to the + * unsignaled state. Therefore for every signal operation, there can + * only be one wait operation. + * + * If the semaphore object is any one of the following types: + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 + * then waiting on the semaphore will wait until the value of the + * semaphore is greater than or equal to + * ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS::params::fence::value. + * + * If the semaphore object is of the type ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC + * then, waiting on the semaphore will wait until the + * ::CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS::params::nvSciSync::fence is signaled by the + * signaler of the NvSciSyncObj that was associated with this semaphore object. + * By default, waiting on such an external semaphore object causes appropriate + * memory synchronization operations to be performed over all external memory objects + * that are imported as ::CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF. This ensures that + * any subsequent accesses made by other importers of the same set of NvSciBuf memory + * object(s) are coherent. These operations can be skipped by specifying the flag + * ::CUDA_EXTERNAL_SEMAPHORE_WAIT_SKIP_NVSCIBUF_MEMSYNC, which can be used as a + * performance optimization when data coherency is not required. But specifying this + * flag in scenarios where data coherency is required results in undefined behavior. + * Also, for semaphore object of the type ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC, + * if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in + * ::cuDeviceGetNvSciSyncAttributes to CUDA_NVSCISYNC_ATTR_WAIT, this API will return + * CUDA_ERROR_NOT_SUPPORTED. + * + * If the semaphore object is any one of the following types: + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX, + * ::CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT + * then the keyed mutex will be acquired when it is released with the key + * specified in ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS::params::keyedmutex::key + * or until the timeout specified by + * ::CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS::params::keyedmutex::timeoutMs + * has lapsed. The timeout interval can either be a finite value + * specified in milliseconds or an infinite value. In case an infinite + * value is specified the timeout never elapses. The windows INFINITE + * macro must be used to specify infinite timeout. + * + * \param extSemArray - External semaphores to be waited on + * \param paramsArray - Array of semaphore parameters + * \param numExtSems - Number of semaphores to wait on + * \param stream - Stream to enqueue the wait operations in + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_TIMEOUT + * \notefnerr + * + * \sa ::cuImportExternalSemaphore, + * ::cuDestroyExternalSemaphore, + * ::cuSignalExternalSemaphoresAsync + */ +CUresult CUDAAPI cuWaitExternalSemaphoresAsync(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS *paramsArray, unsigned int numExtSems, CUstream stream); + +/** + * \brief Destroys an external semaphore + * + * Destroys an external semaphore object and releases any references + * to the underlying resource. Any outstanding signals or waits must + * have completed before the semaphore is destroyed. + * + * \param extSem - External semaphore to be destroyed + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuImportExternalSemaphore, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync + */ +CUresult CUDAAPI cuDestroyExternalSemaphore(CUexternalSemaphore extSem); + +/** @} */ /* END CUDA_EXTRES_INTEROP */ + +/** + * \defgroup CUDA_MEMOP Stream Memory Operations + * + * ___MANBRIEF___ Stream memory operations of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the stream memory operations of the low-level CUDA + * driver application programming interface. + * + * Support for the ::CU_STREAM_WAIT_VALUE_NOR flag can be queried with + * ::CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V2. + * + * Support for the ::cuStreamWriteValue64() and ::cuStreamWaitValue64() + * functions, as well as for the ::CU_STREAM_MEM_OP_WAIT_VALUE_64 and + * ::CU_STREAM_MEM_OP_WRITE_VALUE_64 flags, can be queried with + * ::CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS. + * + * Support for both ::CU_STREAM_WAIT_VALUE_FLUSH and + * ::CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES requires dedicated platform + * hardware features and can be queried with ::cuDeviceGetAttribute() and + * ::CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES. + * + * Note that all memory pointers passed as parameters to these operations + * are device pointers. Where necessary a device pointer should be + * obtained, for example with ::cuMemHostGetDevicePointer(). + * + * None of the operations accepts pointers to managed memory buffers + * (::cuMemAllocManaged). + * + * \note + * Warning: + * Improper use of these APIs may deadlock the application. Synchronization + * ordering established through these APIs is not visible to CUDA. CUDA tasks + * that are (even indirectly) ordered by these APIs should also have that order + * expressed with CUDA-visible dependencies such as events. This ensures that + * the scheduler does not serialize them in an improper order. + * + * @{ + */ + +/** + * \brief Wait on a memory location + * + * Enqueues a synchronization of the stream on the given memory location. Work + * ordered after the operation will block until the given condition on the + * memory is satisfied. By default, the condition is to wait for + * (int32_t)(*addr - value) >= 0, a cyclic greater-or-equal. + * Other condition types can be specified via \p flags. + * + * If the memory was registered via ::cuMemHostRegister(), the device pointer + * should be obtained with ::cuMemHostGetDevicePointer(). This function cannot + * be used with managed memory (::cuMemAllocManaged). + * + * Support for CU_STREAM_WAIT_VALUE_NOR can be queried with ::cuDeviceGetAttribute() and + * ::CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V2. + * + * \note + * Warning: + * Improper use of this API may deadlock the application. Synchronization + * ordering established through this API is not visible to CUDA. CUDA tasks + * that are (even indirectly) ordered by this API should also have that order + * expressed with CUDA-visible dependencies such as events. This ensures that + * the scheduler does not serialize them in an improper order. + * + * \param stream The stream to synchronize on the memory location. + * \param addr The memory location to wait on. + * \param value The value to compare with the memory location. + * \param flags See ::CUstreamWaitValue_flags. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \notefnerr + * + * \sa ::cuStreamWaitValue64, + * ::cuStreamWriteValue32, + * ::cuStreamWriteValue64, + * ::cuStreamBatchMemOp, + * ::cuMemHostRegister, + * ::cuStreamWaitEvent + */ +CUresult CUDAAPI cuStreamWaitValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags); + +/** + * \brief Wait on a memory location + * + * Enqueues a synchronization of the stream on the given memory location. Work + * ordered after the operation will block until the given condition on the + * memory is satisfied. By default, the condition is to wait for + * (int64_t)(*addr - value) >= 0, a cyclic greater-or-equal. + * Other condition types can be specified via \p flags. + * + * If the memory was registered via ::cuMemHostRegister(), the device pointer + * should be obtained with ::cuMemHostGetDevicePointer(). + * + * Support for this can be queried with ::cuDeviceGetAttribute() and + * ::CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS. + * + * \note + * Warning: + * Improper use of this API may deadlock the application. Synchronization + * ordering established through this API is not visible to CUDA. CUDA tasks + * that are (even indirectly) ordered by this API should also have that order + * expressed with CUDA-visible dependencies such as events. This ensures that + * the scheduler does not serialize them in an improper order. + * + * \param stream The stream to synchronize on the memory location. + * \param addr The memory location to wait on. + * \param value The value to compare with the memory location. + * \param flags See ::CUstreamWaitValue_flags. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \notefnerr + * + * \sa ::cuStreamWaitValue32, + * ::cuStreamWriteValue32, + * ::cuStreamWriteValue64, + * ::cuStreamBatchMemOp, + * ::cuMemHostRegister, + * ::cuStreamWaitEvent + */ +CUresult CUDAAPI cuStreamWaitValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags); + +/** + * \brief Write a value to memory + * + * Write a value to memory. + * + * If the memory was registered via ::cuMemHostRegister(), the device pointer + * should be obtained with ::cuMemHostGetDevicePointer(). This function cannot + * be used with managed memory (::cuMemAllocManaged). + * + * \param stream The stream to do the write in. + * \param addr The device address to write to. + * \param value The value to write. + * \param flags See ::CUstreamWriteValue_flags. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \notefnerr + * + * \sa ::cuStreamWriteValue64, + * ::cuStreamWaitValue32, + * ::cuStreamWaitValue64, + * ::cuStreamBatchMemOp, + * ::cuMemHostRegister, + * ::cuEventRecord + */ +CUresult CUDAAPI cuStreamWriteValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags); + +/** + * \brief Write a value to memory + * + * Write a value to memory. + * + * If the memory was registered via ::cuMemHostRegister(), the device pointer + * should be obtained with ::cuMemHostGetDevicePointer(). + * + * Support for this can be queried with ::cuDeviceGetAttribute() and + * ::CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS. + * + * \param stream The stream to do the write in. + * \param addr The device address to write to. + * \param value The value to write. + * \param flags See ::CUstreamWriteValue_flags. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \notefnerr + * + * \sa ::cuStreamWriteValue32, + * ::cuStreamWaitValue32, + * ::cuStreamWaitValue64, + * ::cuStreamBatchMemOp, + * ::cuMemHostRegister, + * ::cuEventRecord + */ +CUresult CUDAAPI cuStreamWriteValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags); + +/** + * \brief Batch operations to synchronize the stream via memory operations + * + * This is a batch version of ::cuStreamWaitValue32() and ::cuStreamWriteValue32(). + * Batching operations may avoid some performance overhead in both the API call + * and the device execution versus adding them to the stream in separate API + * calls. The operations are enqueued in the order they appear in the array. + * + * See ::CUstreamBatchMemOpType for the full set of supported operations, and + * ::cuStreamWaitValue32(), ::cuStreamWaitValue64(), ::cuStreamWriteValue32(), + * and ::cuStreamWriteValue64() for details of specific operations. + * + * See related APIs for details on querying support for specific operations. + * + * \note + * Warning: + * Improper use of this API may deadlock the application. Synchronization + * ordering established through this API is not visible to CUDA. CUDA tasks + * that are (even indirectly) ordered by this API should also have that order + * expressed with CUDA-visible dependencies such as events. This ensures that + * the scheduler does not serialize them in an improper order. For more + * information, see the Stream Memory Operations section in the programming + * guide(https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html). + * + * \param stream The stream to enqueue the operations in. + * \param count The number of operations in the array. Must be less than 256. + * \param paramArray The types and parameters of the individual operations. + * \param flags Reserved for future expansion; must be 0. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \notefnerr + * + * \sa ::cuStreamWaitValue32, + * ::cuStreamWaitValue64, + * ::cuStreamWriteValue32, + * ::cuStreamWriteValue64, + * ::cuMemHostRegister + */ +CUresult CUDAAPI cuStreamBatchMemOp(CUstream stream, unsigned int count, CUstreamBatchMemOpParams *paramArray, unsigned int flags); + +/** @} */ /* END CUDA_MEMOP */ + +/** + * \defgroup CUDA_EXEC Execution Control + * + * ___MANBRIEF___ execution control functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the execution control functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Returns information about a function + * + * Returns in \p *pi the integer value of the attribute \p attrib on the kernel + * given by \p hfunc. The supported attributes are: + * - ::CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK: The maximum number of threads + * per block, beyond which a launch of the function would fail. This number + * depends on both the function and the device on which the function is + * currently loaded. + * - ::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES: The size in bytes of + * statically-allocated shared memory per block required by this function. + * This does not include dynamically-allocated shared memory requested by + * the user at runtime. + * - ::CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES: The size in bytes of user-allocated + * constant memory required by this function. + * - ::CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES: The size in bytes of local memory + * used by each thread of this function. + * - ::CU_FUNC_ATTRIBUTE_NUM_REGS: The number of registers used by each thread + * of this function. + * - ::CU_FUNC_ATTRIBUTE_PTX_VERSION: The PTX virtual architecture version for + * which the function was compiled. This value is the major PTX version * 10 + * + the minor PTX version, so a PTX version 1.3 function would return the + * value 13. Note that this may return the undefined value of 0 for cubins + * compiled prior to CUDA 3.0. + * - ::CU_FUNC_ATTRIBUTE_BINARY_VERSION: The binary architecture version for + * which the function was compiled. This value is the major binary + * version * 10 + the minor binary version, so a binary version 1.3 function + * would return the value 13. Note that this will return a value of 10 for + * legacy cubins that do not have a properly-encoded binary architecture + * version. + * - ::CU_FUNC_CACHE_MODE_CA: The attribute to indicate whether the function has + * been compiled with user specified option "-Xptxas --dlcm=ca" set . + * - ::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES: The maximum size in bytes of + * dynamically-allocated shared memory. + * - ::CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT: Preferred shared memory-L1 + * cache split ratio in percent of total shared memory. + * - ::CU_FUNC_ATTRIBUTE_CLUSTER_SIZE_MUST_BE_SET: If this attribute is set, the + * kernel must launch with a valid cluster size specified. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH: The required cluster width in + * blocks. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT: The required cluster height in + * blocks. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH: The required cluster depth in + * blocks. + * - ::CU_FUNC_ATTRIBUTE_NON_PORTABLE_CLUSTER_SIZE_ALLOWED: Indicates whether + * the function can be launched with non-portable cluster size. 1 is allowed, + * 0 is disallowed. A non-portable cluster size may only function on the + * specific SKUs the program is tested on. The launch might fail if the + * program is run on a different hardware platform. CUDA API provides + * cudaOccupancyMaxActiveClusters to assist with checking whether the desired + * size can be launched on the current device. A portable cluster size is + * guaranteed to be functional on all compute capabilities higher than the + * target compute capability. The portable cluster size for sm_90 is 8 blocks + * per cluster. This value may increase for future compute capabilities. The + * specific hardware unit may support higher cluster sizes that’s not + * guaranteed to be portable. + * - ::CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE: The block + * scheduling policy of a function. The value type is CUclusterSchedulingPolicy. + * + * With a few execeptions, function attributes may also be queried on unloaded + * function handles returned from ::cuModuleEnumerateFunctions. + * ::CUDA_ERROR_FUNCTION_NOT_LOADED is returned if the attribute requires a fully + * loaded function but the function is not loaded. The loading state of a function + * may be queried using ::cuFuncIsloaded. ::cuFuncLoad may be called to explicitly + * load a function before querying the following attributes that require the function + * to be loaded: + * - ::CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK + * - ::CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES + * - ::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES + * + * \param pi - Returned attribute value + * \param attrib - Attribute requested + * \param hfunc - Function to query attribute of + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_FUNCTION_NOT_LOADED + * \notefnerr + * + * \sa ::cuCtxGetCacheConfig, + * ::cuCtxSetCacheConfig, + * ::cuFuncSetCacheConfig, + * ::cuLaunchKernel, + * ::cudaFuncGetAttributes, + * ::cudaFuncSetAttribute, + * ::cuFuncIsLoaded, + * ::cuFuncLoad, + * ::cuKernelGetAttribute + */ +CUresult CUDAAPI cuFuncGetAttribute(int *pi, CUfunction_attribute attrib, CUfunction hfunc); + +/** + * \brief Sets information about a function + * + * This call sets the value of a specified attribute \p attrib on the kernel given + * by \p hfunc to an integer value specified by \p val + * This function returns CUDA_SUCCESS if the new value of the attribute could be + * successfully set. If the set fails, this call will return an error. + * Not all attributes can have values set. Attempting to set a value on a read-only + * attribute will result in an error (CUDA_ERROR_INVALID_VALUE) + * + * Supported attributes for the cuFuncSetAttribute call are: + * - ::CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES: This maximum size in bytes of + * dynamically-allocated shared memory. The value should contain the requested + * maximum size of dynamically-allocated shared memory. The sum of this value and + * the function attribute ::CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES cannot exceed the + * device attribute ::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN. + * The maximal size of requestable dynamic shared memory may differ by GPU + * architecture. + * - ::CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT: On devices where the L1 + * cache and shared memory use the same hardware resources, this sets the shared memory + * carveout preference, in percent of the total shared memory. + * See ::CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR + * This is only a hint, and the driver can choose a different ratio if required to execute the function. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_WIDTH: The required cluster width in + * blocks. The width, height, and depth values must either all be 0 or all be + * positive. The validity of the cluster dimensions is checked at launch time. + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime will return CUDA_ERROR_NOT_PERMITTED. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_HEIGHT: The required cluster height in + * blocks. The width, height, and depth values must either all be 0 or all be + * positive. The validity of the cluster dimensions is checked at launch time. + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime will return CUDA_ERROR_NOT_PERMITTED. + * - ::CU_FUNC_ATTRIBUTE_REQUIRED_CLUSTER_DEPTH: The required cluster depth in + * blocks. The width, height, and depth values must either all be 0 or all be + * positive. The validity of the cluster dimensions is checked at launch time. + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime will return CUDA_ERROR_NOT_PERMITTED. + * - ::CU_FUNC_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE: The block + * scheduling policy of a function. The value type is CUclusterSchedulingPolicy. + * + * \param hfunc - Function to query attribute of + * \param attrib - Attribute requested + * \param value - The value to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuCtxGetCacheConfig, + * ::cuCtxSetCacheConfig, + * ::cuFuncSetCacheConfig, + * ::cuLaunchKernel, + * ::cudaFuncGetAttributes, + * ::cudaFuncSetAttribute, + * ::cuKernelSetAttribute + */ +CUresult CUDAAPI cuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value); + +/** + * \brief Sets the preferred cache configuration for a device function + * + * On devices where the L1 cache and shared memory use the same hardware + * resources, this sets through \p config the preferred cache configuration for + * the device function \p hfunc. This is only a preference. The driver will use + * the requested configuration if possible, but it is free to choose a different + * configuration if required to execute \p hfunc. Any context-wide preference + * set via ::cuCtxSetCacheConfig() will be overridden by this per-function + * setting unless the per-function setting is ::CU_FUNC_CACHE_PREFER_NONE. In + * that case, the current context-wide setting will be used. + * + * This setting does nothing on devices where the size of the L1 cache and + * shared memory are fixed. + * + * Launching a kernel with a different preference than the most recent + * preference setting may insert a device-side synchronization point. + * + * + * The supported cache configurations are: + * - ::CU_FUNC_CACHE_PREFER_NONE: no preference for shared memory or L1 (default) + * - ::CU_FUNC_CACHE_PREFER_SHARED: prefer larger shared memory and smaller L1 cache + * - ::CU_FUNC_CACHE_PREFER_L1: prefer larger L1 cache and smaller shared memory + * - ::CU_FUNC_CACHE_PREFER_EQUAL: prefer equal sized L1 cache and shared memory + * + * \param hfunc - Kernel to configure cache for + * \param config - Requested cache configuration + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa ::cuCtxGetCacheConfig, + * ::cuCtxSetCacheConfig, + * ::cuFuncGetAttribute, + * ::cuLaunchKernel, + * ::cudaFuncSetCacheConfig, + * ::cuKernelSetCacheConfig + */ +CUresult CUDAAPI cuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config); + + +/** + * \brief Returns a module handle + * + * Returns in \p *hmod the handle of the module that function \p hfunc + * is located in. The lifetime of the module corresponds to the lifetime of + * the context it was loaded in or until the module is explicitly unloaded. + * + * The CUDA runtime manages its own modules loaded into the primary context. + * If the handle returned by this API refers to a module loaded by the CUDA runtime, + * calling ::cuModuleUnload() on that module will result in undefined behavior. + * + * \param hmod - Returned module handle + * \param hfunc - Function to retrieve module for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND + * \notefnerr + * + */ +CUresult CUDAAPI cuFuncGetModule(CUmodule *hmod, CUfunction hfunc); + +/** + * \brief Returns the function name for a ::CUfunction handle + * + * Returns in \p **name the function name associated with the function handle \p hfunc . + * The function name is returned as a null-terminated string. The returned name is only + * valid when the function handle is valid. If the module is unloaded or reloaded, one + * must call the API again to get the updated name. This API may return a mangled name if + * the function is not declared as having C linkage. If either \p **name or \p hfunc + * is NULL, ::CUDA_ERROR_INVALID_VALUE is returned. + * + * \param name - The returned name of the function + * \param hfunc - The function handle to retrieve the name for + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * + */ +CUresult CUDAAPI cuFuncGetName(const char **name, CUfunction hfunc); + +/** + * \brief Returns the offset and size of a kernel parameter in the device-side parameter layout + * + * Queries the kernel parameter at \p paramIndex into \p func's list of parameters, and returns + * in \p paramOffset and \p paramSize the offset and size, respectively, where the parameter + * will reside in the device-side parameter layout. This information can be used to update kernel + * node parameters from the device via ::cudaGraphKernelNodeSetParam() and + * ::cudaGraphKernelNodeUpdatesApply(). \p paramIndex must be less than the number of parameters + * that \p func takes. \p paramSize can be set to NULL if only the parameter offset is desired. + * + * \param func - The function to query + * \param paramIndex - The parameter index to query + * \param paramOffset - Returns the offset into the device-side parameter layout at which the parameter resides + * \param paramSize - Optionally returns the size of the parameter in the device-side parameter layout + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + * +* \sa ::cuKernelGetParamInfo + */ +CUresult CUDAAPI cuFuncGetParamInfo(CUfunction func, size_t paramIndex, size_t *paramOffset, size_t *paramSize); + +typedef enum CUfunctionLoadingState_enum { + CU_FUNCTION_LOADING_STATE_UNLOADED = 0, + CU_FUNCTION_LOADING_STATE_LOADED = 1, + CU_FUNCTION_LOADING_STATE_MAX +} CUfunctionLoadingState; + +/** + * \brief Returns if the function is loaded + * + * Returns in \p state the loading state of \p function. + * + * \param state - returned loading state + * \param function - the function to check + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuFuncLoad, + * ::cuModuleEnumerateFunctions + */ +CUresult CUDAAPI cuFuncIsLoaded(CUfunctionLoadingState *state, CUfunction function); + +/** + * \brief Loads a function + * + * Finalizes function loading for \p function. Calling this API with a + * fully loaded function has no effect. + * + * \param function - the function to load + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuModuleEnumerateFunctions, + * ::cuFuncIsLoaded + */ +CUresult CUDAAPI cuFuncLoad(CUfunction function); + +/** + * \brief Launches a CUDA function ::CUfunction or a CUDA kernel ::CUkernel + * + * Invokes the function ::CUfunction or the kernel ::CUkernel \p f + * on a \p gridDimX x \p gridDimY x \p gridDimZ grid of blocks. + * Each block contains \p blockDimX x \p blockDimY x + * \p blockDimZ threads. + * + * \p sharedMemBytes sets the amount of dynamic shared memory that will be + * available to each thread block. + * + * Kernel parameters to \p f can be specified in one of two ways: + * + * 1) Kernel parameters can be specified via \p kernelParams. If \p f + * has N parameters, then \p kernelParams needs to be an array of N + * pointers. Each of \p kernelParams[0] through \p kernelParams[N-1] + * must point to a region of memory from which the actual kernel + * parameter will be copied. The number of kernel parameters and their + * offsets and sizes do not need to be specified as that information is + * retrieved directly from the kernel's image. + * + * 2) Kernel parameters can also be packaged by the application into + * a single buffer that is passed in via the \p extra parameter. + * This places the burden on the application of knowing each kernel + * parameter's size and alignment/padding within the buffer. Here is + * an example of using the \p extra parameter in this manner: + * \code + size_t argBufferSize; + char argBuffer[256]; + + // populate argBuffer and argBufferSize + + void *config[] = { + CU_LAUNCH_PARAM_BUFFER_POINTER, argBuffer, + CU_LAUNCH_PARAM_BUFFER_SIZE, &argBufferSize, + CU_LAUNCH_PARAM_END + }; + status = cuLaunchKernel(f, gx, gy, gz, bx, by, bz, sh, s, NULL, config); + * \endcode + * + * The \p extra parameter exists to allow ::cuLaunchKernel to take + * additional less commonly used arguments. \p extra specifies a list of + * names of extra settings and their corresponding values. Each extra + * setting name is immediately followed by the corresponding value. The + * list must be terminated with either NULL or ::CU_LAUNCH_PARAM_END. + * + * - ::CU_LAUNCH_PARAM_END, which indicates the end of the \p extra + * array; + * - ::CU_LAUNCH_PARAM_BUFFER_POINTER, which specifies that the next + * value in \p extra will be a pointer to a buffer containing all + * the kernel parameters for launching kernel \p f; + * - ::CU_LAUNCH_PARAM_BUFFER_SIZE, which specifies that the next + * value in \p extra will be a pointer to a size_t containing the + * size of the buffer specified with ::CU_LAUNCH_PARAM_BUFFER_POINTER; + * + * The error ::CUDA_ERROR_INVALID_VALUE will be returned if kernel + * parameters are specified with both \p kernelParams and \p extra + * (i.e. both \p kernelParams and \p extra are non-NULL). + * + * Calling ::cuLaunchKernel() invalidates the persistent function state + * set through the following deprecated APIs: + * ::cuFuncSetBlockShape(), + * ::cuFuncSetSharedSize(), + * ::cuParamSetSize(), + * ::cuParamSeti(), + * ::cuParamSetf(), + * ::cuParamSetv(). + * + * Note that to use ::cuLaunchKernel(), the kernel \p f must either have + * been compiled with toolchain version 3.2 or later so that it will + * contain kernel parameter information, or have no kernel parameters. + * If either of these conditions is not met, then ::cuLaunchKernel() will + * return ::CUDA_ERROR_INVALID_IMAGE. + * + * Note that the API can also be used to launch context-less kernel ::CUkernel + * by querying the handle using ::cuLibraryGetKernel() and then passing it + * to the API by casting to ::CUfunction. Here, the context to launch + * the kernel on will either be taken from the specified stream \p hStream + * or the current context in case of NULL stream. + * + * \param f - Function ::CUfunction or Kernel ::CUkernel to launch + * \param gridDimX - Width of grid in blocks + * \param gridDimY - Height of grid in blocks + * \param gridDimZ - Depth of grid in blocks + * \param blockDimX - X dimension of each thread block + * \param blockDimY - Y dimension of each thread block + * \param blockDimZ - Z dimension of each thread block + * \param sharedMemBytes - Dynamic shared-memory size per thread block in bytes + * \param hStream - Stream identifier + * \param kernelParams - Array of pointers to kernel parameters + * \param extra - Extra options + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_IMAGE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_LAUNCH_FAILED, + * ::CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, + * ::CUDA_ERROR_LAUNCH_TIMEOUT, + * ::CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, + * ::CUDA_ERROR_NOT_FOUND + * \note_null_stream + * \notefnerr + * + * \sa ::cuCtxGetCacheConfig, + * ::cuCtxSetCacheConfig, + * ::cuFuncSetCacheConfig, + * ::cuFuncGetAttribute, + * ::cudaLaunchKernel, + * ::cuLibraryGetKernel, + * ::cuKernelSetCacheConfig, + * ::cuKernelGetAttribute, + * ::cuKernelSetAttribute + */ +CUresult CUDAAPI cuLaunchKernel(CUfunction f, + unsigned int gridDimX, + unsigned int gridDimY, + unsigned int gridDimZ, + unsigned int blockDimX, + unsigned int blockDimY, + unsigned int blockDimZ, + unsigned int sharedMemBytes, + CUstream hStream, + void **kernelParams, + void **extra); + +/** + * \brief Launches a CUDA function ::CUfunction or a CUDA kernel ::CUkernel with launch-time configuration + * + * Invokes the function ::CUfunction or the kernel ::CUkernel \p f with the specified launch-time configuration + * \p config. + * + * The ::CUlaunchConfig structure is defined as: + * + * \code + * typedef struct CUlaunchConfig_st { + * unsigned int gridDimX; + * unsigned int gridDimY; + * unsigned int gridDimZ; + * unsigned int blockDimX; + * unsigned int blockDimY; + * unsigned int blockDimZ; + * unsigned int sharedMemBytes; + * CUstream hStream; + * CUlaunchAttribute *attrs; + * unsigned int numAttrs; + * } CUlaunchConfig; + * \endcode + * + * where: + * - ::CUlaunchConfig::gridDimX is the width of the grid in blocks. + * - ::CUlaunchConfig::gridDimY is the height of the grid in blocks. + * - ::CUlaunchConfig::gridDimZ is the depth of the grid in blocks. + * - ::CUlaunchConfig::blockDimX is the X dimension of each thread block. + * - ::CUlaunchConfig::blockDimX is the Y dimension of each thread block. + * - ::CUlaunchConfig::blockDimZ is the Z dimension of each thread block. + * - ::CUlaunchConfig::sharedMemBytes is the dynamic shared-memory size per + * thread block in bytes. + * - ::CUlaunchConfig::hStream is the handle to the stream to perform the launch + * in. The CUDA context associated with this stream must match that associated + * with function f. + * - ::CUlaunchConfig::attrs is an array of ::CUlaunchConfig::numAttrs + * continguous ::CUlaunchAttribute elements. The value of this pointer is not + * considered if ::CUlaunchConfig::numAttrs is zero. However, in that case, it + * is recommended to set the pointer to NULL. + * - ::CUlaunchConfig::numAttrs is the number of attributes populating the + * first ::CUlaunchConfig::numAttrs positions of the ::CUlaunchConfig::attrs + * array. + * + * Launch-time configuration is specified by adding entries to + * ::CUlaunchConfig::attrs. Each entry is an attribute ID and a corresponding + * attribute value. + * + * The ::CUlaunchAttribute structure is defined as: + * \code + * typedef struct CUlaunchAttribute_st { + * CUlaunchAttributeID id; + * CUlaunchAttributeValue value; + * } CUlaunchAttribute; + * \endcode + * where: + * - ::CUlaunchAttribute::id is a unique enum identifying the attribute. + * - ::CUlaunchAttribute::value is a union that hold the attribute value. + * + * An example of using the \p config parameter: + * \code + * CUlaunchAttribute coopAttr = {.id = CU_LAUNCH_ATTRIBUTE_COOPERATIVE, + * .value = 1}; + * CUlaunchConfig config = {... // set block and grid dimensions + * .attrs = &coopAttr, + * .numAttrs = 1}; + * + * cuLaunchKernelEx(&config, kernel, NULL, NULL); + * \endcode + * + * The ::CUlaunchAttributeID enum is defined as: + * \code + * typedef enum CUlaunchAttributeID_enum { + * CU_LAUNCH_ATTRIBUTE_IGNORE = 0, + * CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW = 1, + * CU_LAUNCH_ATTRIBUTE_COOPERATIVE = 2, + * CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY = 3, + * CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION = 4, + * CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE = 5, + * CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION = 6, + * CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT = 7, + * CU_LAUNCH_ATTRIBUTE_PRIORITY = 8, + * CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN_MAP = 9, + * CU_LAUNCH_ATTRIBUTE_MEM_SYNC_DOMAIN = 10, + * CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT = 12, + * CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE = 13, + * } CUlaunchAttributeID; + * \endcode + * + * and the corresponding ::CUlaunchAttributeValue union as : + * \code + * typedef union CUlaunchAttributeValue_union { + * CUaccessPolicyWindow accessPolicyWindow; + * int cooperative; + * CUsynchronizationPolicy syncPolicy; + * struct { + * unsigned int x; + * unsigned int y; + * unsigned int z; + * } clusterDim; + * CUclusterSchedulingPolicy clusterSchedulingPolicyPreference; + * int programmaticStreamSerializationAllowed; + * struct { + * CUevent event; + * int flags; + * int triggerAtBlockStart; + * } programmaticEvent; + * int priority; + * CUlaunchMemSyncDomainMap memSyncDomainMap; + * CUlaunchMemSyncDomain memSyncDomain; + * struct { + * CUevent event; + * int flags; + * } launchCompletionEvent; + * struct { + * int deviceUpdatable; + * CUgraphDeviceNode devNode; + * } deviceUpdatableKernelNode; + * } CUlaunchAttributeValue; + * \endcode + * + * Setting ::CU_LAUNCH_ATTRIBUTE_COOPERATIVE to a non-zero value causes the + * kernel launch to be a cooperative launch, with exactly the same usage and + * semantics of ::cuLaunchCooperativeKernel. + * + * Setting ::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_STREAM_SERIALIZATION to a non-zero + * values causes the kernel to use programmatic means to resolve its stream + * dependency -- enabling the CUDA runtime to opportunistically allow the grid's + * execution to overlap with the previous kernel in the stream, if that kernel + * requests the overlap. + * + * ::CU_LAUNCH_ATTRIBUTE_PROGRAMMATIC_EVENT records an event along with the + * kernel launch. Event recorded through this launch attribute is guaranteed to + * only trigger after all block in the associated kernel trigger the event. A + * block can trigger the event through PTX launchdep.release or CUDA builtin + * function cudaTriggerProgrammaticLaunchCompletion(). A trigger can also be + * inserted at the beginning of each block's execution if triggerAtBlockStart is + * set to non-0. Note that dependents (including the CPU thread calling + * cuEventSynchronize()) are not guaranteed to observe the release precisely + * when it is released. For example, cuEventSynchronize() may only observe the + * event trigger long after the associated kernel has completed. This recording + * type is primarily meant for establishing programmatic dependency between + * device tasks. The event supplied must not be an interprocess or interop + * event. The event must disable timing (i.e. created with + * ::CU_EVENT_DISABLE_TIMING flag set). + * + * ::CU_LAUNCH_ATTRIBUTE_LAUNCH_COMPLETION_EVENT records an event along with + * the kernel launch. Nominally, the event is triggered once all blocks of the + * kernel have begun execution. Currently this is a best effort. If a kernel B + * has a launch completion dependency on a kernel A, B may wait until A is + * complete. Alternatively, blocks of B may begin before all blocks of A have + * begun, for example: + * + * - If B can claim execution resources unavaiable to A, for example if they + * run on different GPUs. + * - If B is a higher priority than A. + * + * Exercise caution if such an ordering inversion could lead to deadlock. The + * event supplied must not be an interprocess or interop event. The event must + * disable timing (i.e. must be created with the ::CU_EVENT_DISABLE_TIMING flag + * set). + * + * Setting ::CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE to 1 + * on a captured launch causes the resulting kernel node to be device-updatable. + * This attribute is specific to graphs, and passing it to a launch in a + * non-capturing stream results in an error. Passing a value other than 0 or 1 is + * not allowed. + * + * On success, a handle will be returned via + * ::CUlaunchAttributeValue::deviceUpdatableKernelNode::devNode which can be passed + * to the various device-side update functions to update the node's kernel parameters + * from within another kernel. For more information on the types of device updates + * that can be made, as well as the relevant limitations thereof, see + * ::cudaGraphKernelNodeUpdatesApply. + * + * Kernel nodes which are device-updatable have additional restrictions compared to regular + * kernel nodes. Firstly, device-updatable nodes cannot be removed from their graph via + * ::cuGraphDestroyNode. Additionally, once opted-in to this functionality, a node cannot + * opt out, and any attempt to set the attribute to 0 will result in an error. Graphs + * containing one or more device-updatable node also do not allow multiple instantiation. + * + * + * The effect of other attributes is consistent with their effect when set via + * persistent APIs. + * + * See ::cuStreamSetAttribute for + * - ::CU_LAUNCH_ATTRIBUTE_ACCESS_POLICY_WINDOW + * - ::CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY + * + * See ::cuFuncSetAttribute for + * - ::CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION + * - ::CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE + * + * Kernel parameters to \p f can be specified in the same ways that they can be + * using ::cuLaunchKernel. + * + * Note that the API can also be used to launch context-less kernel ::CUkernel + * by querying the handle using ::cuLibraryGetKernel() and then passing it + * to the API by casting to ::CUfunction. Here, the context to launch + * the kernel on will either be taken from the specified stream ::CUlaunchConfig::hStream + * or the current context in case of NULL stream. + * + * \param config - Config to launch + * \param f - Function ::CUfunction or Kernel ::CUkernel to launch + * \param kernelParams - Array of pointers to kernel parameters + * \param extra - Extra options + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_IMAGE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_LAUNCH_FAILED, + * ::CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, + * ::CUDA_ERROR_LAUNCH_TIMEOUT, + * ::CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, + * ::CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, + * ::CUDA_ERROR_NOT_FOUND + * \note_null_stream + * \notefnerr + * + * \sa ::cuCtxGetCacheConfig, + * ::cuCtxSetCacheConfig, + * ::cuFuncSetCacheConfig, + * ::cuFuncGetAttribute, + * ::cudaLaunchKernel, + * ::cudaLaunchKernelEx, + * ::cuLibraryGetKernel, + * ::cuKernelSetCacheConfig, + * ::cuKernelGetAttribute, + * ::cuKernelSetAttribute + */ +CUresult CUDAAPI cuLaunchKernelEx(const CUlaunchConfig *config, + CUfunction f, + void **kernelParams, + void **extra); + +/** + * \brief Launches a CUDA function ::CUfunction or a CUDA kernel ::CUkernel where thread blocks + * can cooperate and synchronize as they execute + * + * Invokes the function ::CUfunction or the kernel ::CUkernel \p f on a \p gridDimX x \p gridDimY x \p gridDimZ + * grid of blocks. Each block contains \p blockDimX x \p blockDimY x + * \p blockDimZ threads. + * + * Note that the API can also be used to launch context-less kernel ::CUkernel + * by querying the handle using ::cuLibraryGetKernel() and then passing it + * to the API by casting to ::CUfunction. Here, the context to launch + * the kernel on will either be taken from the specified stream \p hStream + * or the current context in case of NULL stream. + * + * \p sharedMemBytes sets the amount of dynamic shared memory that will be + * available to each thread block. + * + * The device on which this kernel is invoked must have a non-zero value for + * the device attribute ::CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH. + * + * The total number of blocks launched cannot exceed the maximum number of blocks per + * multiprocessor as returned by ::cuOccupancyMaxActiveBlocksPerMultiprocessor (or + * ::cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags) times the number of multiprocessors + * as specified by the device attribute ::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT. + * + * The kernel cannot make use of CUDA dynamic parallelism. + * + * Kernel parameters must be specified via \p kernelParams. If \p f + * has N parameters, then \p kernelParams needs to be an array of N + * pointers. Each of \p kernelParams[0] through \p kernelParams[N-1] + * must point to a region of memory from which the actual kernel + * parameter will be copied. The number of kernel parameters and their + * offsets and sizes do not need to be specified as that information is + * retrieved directly from the kernel's image. + * + * Calling ::cuLaunchCooperativeKernel() sets persistent function state that is + * the same as function state set through ::cuLaunchKernel API + * + * When the kernel \p f is launched via ::cuLaunchCooperativeKernel(), the previous + * block shape, shared size and parameter info associated with \p f + * is overwritten. + * + * Note that to use ::cuLaunchCooperativeKernel(), the kernel \p f must either have + * been compiled with toolchain version 3.2 or later so that it will + * contain kernel parameter information, or have no kernel parameters. + * If either of these conditions is not met, then ::cuLaunchCooperativeKernel() will + * return ::CUDA_ERROR_INVALID_IMAGE. + * + * Note that the API can also be used to launch context-less kernel ::CUkernel + * by querying the handle using ::cuLibraryGetKernel() and then passing it + * to the API by casting to ::CUfunction. Here, the context to launch + * the kernel on will either be taken from the specified stream \p hStream + * or the current context in case of NULL stream. + * + * \param f - Function ::CUfunction or Kernel ::CUkernel to launch + * \param gridDimX - Width of grid in blocks + * \param gridDimY - Height of grid in blocks + * \param gridDimZ - Depth of grid in blocks + * \param blockDimX - X dimension of each thread block + * \param blockDimY - Y dimension of each thread block + * \param blockDimZ - Z dimension of each thread block + * \param sharedMemBytes - Dynamic shared-memory size per thread block in bytes + * \param hStream - Stream identifier + * \param kernelParams - Array of pointers to kernel parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_IMAGE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_LAUNCH_FAILED, + * ::CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, + * ::CUDA_ERROR_LAUNCH_TIMEOUT, + * ::CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, + * ::CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, + * ::CUDA_ERROR_NOT_FOUND + * \note_null_stream + * \notefnerr + * + * \sa ::cuCtxGetCacheConfig, + * ::cuCtxSetCacheConfig, + * ::cuFuncSetCacheConfig, + * ::cuFuncGetAttribute, + * ::cuLaunchCooperativeKernelMultiDevice, + * ::cudaLaunchCooperativeKernel, + * ::cuLibraryGetKernel, + * ::cuKernelSetCacheConfig, + * ::cuKernelGetAttribute, + * ::cuKernelSetAttribute + */ +CUresult CUDAAPI cuLaunchCooperativeKernel(CUfunction f, + unsigned int gridDimX, + unsigned int gridDimY, + unsigned int gridDimZ, + unsigned int blockDimX, + unsigned int blockDimY, + unsigned int blockDimZ, + unsigned int sharedMemBytes, + CUstream hStream, + void **kernelParams); + +/** + * \brief Launches CUDA functions on multiple devices where thread blocks can cooperate and synchronize as they execute + * + * \deprecated This function is deprecated as of CUDA 11.3. + * + * Invokes kernels as specified in the \p launchParamsList array where each element + * of the array specifies all the parameters required to perform a single kernel launch. + * These kernels can cooperate and synchronize as they execute. The size of the array is + * specified by \p numDevices. + * + * No two kernels can be launched on the same device. All the devices targeted by this + * multi-device launch must be identical. All devices must have a non-zero value for the + * device attribute ::CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH. + * + * All kernels launched must be identical with respect to the compiled code. Note that + * any __device__, __constant__ or __managed__ variables present in the module that owns + * the kernel launched on each device, are independently instantiated on every device. + * It is the application's responsibility to ensure these variables are initialized and + * used appropriately. + * + * The size of the grids as specified in blocks, the size of the blocks themselves + * and the amount of shared memory used by each thread block must also match across + * all launched kernels. + * + * The streams used to launch these kernels must have been created via either ::cuStreamCreate + * or ::cuStreamCreateWithPriority. The NULL stream or ::CU_STREAM_LEGACY or ::CU_STREAM_PER_THREAD + * cannot be used. + * + * The total number of blocks launched per kernel cannot exceed the maximum number of blocks + * per multiprocessor as returned by ::cuOccupancyMaxActiveBlocksPerMultiprocessor (or + * ::cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags) times the number of multiprocessors + * as specified by the device attribute ::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT. Since the + * total number of blocks launched per device has to match across all devices, the maximum + * number of blocks that can be launched per device will be limited by the device with the + * least number of multiprocessors. + * + * The kernels cannot make use of CUDA dynamic parallelism. + * + * The ::CUDA_LAUNCH_PARAMS structure is defined as: + * \code + typedef struct CUDA_LAUNCH_PARAMS_st + { + CUfunction function; + unsigned int gridDimX; + unsigned int gridDimY; + unsigned int gridDimZ; + unsigned int blockDimX; + unsigned int blockDimY; + unsigned int blockDimZ; + unsigned int sharedMemBytes; + CUstream hStream; + void **kernelParams; + } CUDA_LAUNCH_PARAMS; + * \endcode + * where: + * - ::CUDA_LAUNCH_PARAMS::function specifies the kernel to be launched. All functions must + * be identical with respect to the compiled code. + * Note that you can also specify context-less kernel ::CUkernel by querying the handle + * using ::cuLibraryGetKernel() and then casting to ::CUfunction. In this case, the context to + * launch the kernel on be taken from the specified stream ::CUDA_LAUNCH_PARAMS::hStream. + * - ::CUDA_LAUNCH_PARAMS::gridDimX is the width of the grid in blocks. This must match across + * all kernels launched. + * - ::CUDA_LAUNCH_PARAMS::gridDimY is the height of the grid in blocks. This must match across + * all kernels launched. + * - ::CUDA_LAUNCH_PARAMS::gridDimZ is the depth of the grid in blocks. This must match across + * all kernels launched. + * - ::CUDA_LAUNCH_PARAMS::blockDimX is the X dimension of each thread block. This must match across + * all kernels launched. + * - ::CUDA_LAUNCH_PARAMS::blockDimX is the Y dimension of each thread block. This must match across + * all kernels launched. + * - ::CUDA_LAUNCH_PARAMS::blockDimZ is the Z dimension of each thread block. This must match across + * all kernels launched. + * - ::CUDA_LAUNCH_PARAMS::sharedMemBytes is the dynamic shared-memory size per thread block in bytes. + * This must match across all kernels launched. + * - ::CUDA_LAUNCH_PARAMS::hStream is the handle to the stream to perform the launch in. This cannot + * be the NULL stream or ::CU_STREAM_LEGACY or ::CU_STREAM_PER_THREAD. The CUDA context associated + * with this stream must match that associated with ::CUDA_LAUNCH_PARAMS::function. + * - ::CUDA_LAUNCH_PARAMS::kernelParams is an array of pointers to kernel parameters. If + * ::CUDA_LAUNCH_PARAMS::function has N parameters, then ::CUDA_LAUNCH_PARAMS::kernelParams + * needs to be an array of N pointers. Each of ::CUDA_LAUNCH_PARAMS::kernelParams[0] through + * ::CUDA_LAUNCH_PARAMS::kernelParams[N-1] must point to a region of memory from which the actual + * kernel parameter will be copied. The number of kernel parameters and their offsets and sizes + * do not need to be specified as that information is retrieved directly from the kernel's image. + * + * By default, the kernel won't begin execution on any GPU until all prior work in all the specified + * streams has completed. This behavior can be overridden by specifying the flag + * ::CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC. When this flag is specified, each kernel + * will only wait for prior work in the stream corresponding to that GPU to complete before it begins + * execution. + * + * Similarly, by default, any subsequent work pushed in any of the specified streams will not begin + * execution until the kernels on all GPUs have completed. This behavior can be overridden by specifying + * the flag ::CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC. When this flag is specified, + * any subsequent work pushed in any of the specified streams will only wait for the kernel launched + * on the GPU corresponding to that stream to complete before it begins execution. + * + * Calling ::cuLaunchCooperativeKernelMultiDevice() sets persistent function state that is + * the same as function state set through ::cuLaunchKernel API when called individually for each + * element in \p launchParamsList. + * + * When kernels are launched via ::cuLaunchCooperativeKernelMultiDevice(), the previous + * block shape, shared size and parameter info associated with each ::CUDA_LAUNCH_PARAMS::function + * in \p launchParamsList is overwritten. + * + * Note that to use ::cuLaunchCooperativeKernelMultiDevice(), the kernels must either have + * been compiled with toolchain version 3.2 or later so that it will + * contain kernel parameter information, or have no kernel parameters. + * If either of these conditions is not met, then ::cuLaunchCooperativeKernelMultiDevice() will + * return ::CUDA_ERROR_INVALID_IMAGE. + * + * \param launchParamsList - List of launch parameters, one per device + * \param numDevices - Size of the \p launchParamsList array + * \param flags - Flags to control launch behavior + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_IMAGE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_LAUNCH_FAILED, + * ::CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, + * ::CUDA_ERROR_LAUNCH_TIMEOUT, + * ::CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, + * ::CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED + * \note_null_stream + * \notefnerr + * + * \sa ::cuCtxGetCacheConfig, + * ::cuCtxSetCacheConfig, + * ::cuFuncSetCacheConfig, + * ::cuFuncGetAttribute, + * ::cuLaunchCooperativeKernel, + * ::cudaLaunchCooperativeKernelMultiDevice + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS *launchParamsList, unsigned int numDevices, unsigned int flags); + +/** + * \brief Enqueues a host function call in a stream + * + * Enqueues a host function to run in a stream. The function will be called + * after currently enqueued work and will block work added after it. + * + * The host function must not make any CUDA API calls. Attempting to use a + * CUDA API may result in ::CUDA_ERROR_NOT_PERMITTED, but this is not required. + * The host function must not perform any synchronization that may depend on + * outstanding CUDA work not mandated to run earlier. Host functions without a + * mandated order (such as in independent streams) execute in undefined order + * and may be serialized. + * + * For the purposes of Unified Memory, execution makes a number of guarantees: + *
    + *
  • The stream is considered idle for the duration of the function's + * execution. Thus, for example, the function may always use memory attached + * to the stream it was enqueued in.
  • + *
  • The start of execution of the function has the same effect as + * synchronizing an event recorded in the same stream immediately prior to + * the function. It thus synchronizes streams which have been "joined" + * prior to the function.
  • + *
  • Adding device work to any stream does not have the effect of making + * the stream active until all preceding host functions and stream callbacks + * have executed. Thus, for + * example, a function might use global attached memory even if work has + * been added to another stream, if the work has been ordered behind the + * function call with an event.
  • + *
  • Completion of the function does not cause a stream to become + * active except as described above. The stream will remain idle + * if no device work follows the function, and will remain idle across + * consecutive host functions or stream callbacks without device work in + * between. Thus, for example, + * stream synchronization can be done by signaling from a host function at the + * end of the stream.
  • + *
+ * + * Note that, in contrast to ::cuStreamAddCallback, the function will not be + * called in the event of an error in the CUDA context. + * + * \param hStream - Stream to enqueue function call in + * \param fn - The function to call once preceding stream operations are complete + * \param userData - User-specified data to be passed to the function + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \note_null_stream + * \notefnerr + * + * \sa ::cuStreamCreate, + * ::cuStreamQuery, + * ::cuStreamSynchronize, + * ::cuStreamWaitEvent, + * ::cuStreamDestroy, + * ::cuMemAllocManaged, + * ::cuStreamAttachMemAsync, + * ::cuStreamAddCallback + */ +CUresult CUDAAPI cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void *userData); + +/** @} */ /* END CUDA_EXEC */ + +/** + * \defgroup CUDA_EXEC_DEPRECATED Execution Control [DEPRECATED] + * + * ___MANBRIEF___ deprecated execution control functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the deprecated execution control functions of the + * low-level CUDA driver application programming interface. + * + * @{ + */ + +/** + * \brief Sets the block-dimensions for the function + * + * \deprecated + * + * Specifies the \p x, \p y, and \p z dimensions of the thread blocks that are + * created when the kernel given by \p hfunc is launched. + * + * \param hfunc - Kernel to specify dimensions of + * \param x - X dimension + * \param y - Y dimension + * \param z - Z dimension + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuFuncSetSharedSize, + * ::cuFuncSetCacheConfig, + * ::cuFuncGetAttribute, + * ::cuParamSetSize, + * ::cuParamSeti, + * ::cuParamSetf, + * ::cuParamSetv, + * ::cuLaunch, + * ::cuLaunchGrid, + * ::cuLaunchGridAsync, + * ::cuLaunchKernel + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z); + +/** + * \brief Sets the dynamic shared-memory size for the function + * + * \deprecated + * + * Sets through \p bytes the amount of dynamic shared memory that will be + * available to each thread block when the kernel given by \p hfunc is launched. + * + * \param hfunc - Kernel to specify dynamic shared-memory size for + * \param bytes - Dynamic shared-memory size per thread in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuFuncSetBlockShape, + * ::cuFuncSetCacheConfig, + * ::cuFuncGetAttribute, + * ::cuParamSetSize, + * ::cuParamSeti, + * ::cuParamSetf, + * ::cuParamSetv, + * ::cuLaunch, + * ::cuLaunchGrid, + * ::cuLaunchGridAsync, + * ::cuLaunchKernel + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuFuncSetSharedSize(CUfunction hfunc, unsigned int bytes); + +/** + * \brief Sets the parameter size for the function + * + * \deprecated + * + * Sets through \p numbytes the total size in bytes needed by the function + * parameters of the kernel corresponding to \p hfunc. + * + * \param hfunc - Kernel to set parameter size for + * \param numbytes - Size of parameter list in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuFuncSetBlockShape, + * ::cuFuncSetSharedSize, + * ::cuFuncGetAttribute, + * ::cuParamSetf, + * ::cuParamSeti, + * ::cuParamSetv, + * ::cuLaunch, + * ::cuLaunchGrid, + * ::cuLaunchGridAsync, + * ::cuLaunchKernel + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuParamSetSize(CUfunction hfunc, unsigned int numbytes); + +/** + * \brief Adds an integer parameter to the function's argument list + * + * \deprecated + * + * Sets an integer parameter that will be specified the next time the + * kernel corresponding to \p hfunc will be invoked. \p offset is a byte offset. + * + * \param hfunc - Kernel to add parameter to + * \param offset - Offset to add parameter to argument list + * \param value - Value of parameter + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuFuncSetBlockShape, + * ::cuFuncSetSharedSize, + * ::cuFuncGetAttribute, + * ::cuParamSetSize, + * ::cuParamSetf, + * ::cuParamSetv, + * ::cuLaunch, + * ::cuLaunchGrid, + * ::cuLaunchGridAsync, + * ::cuLaunchKernel + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuParamSeti(CUfunction hfunc, int offset, unsigned int value); + +/** + * \brief Adds a floating-point parameter to the function's argument list + * + * \deprecated + * + * Sets a floating-point parameter that will be specified the next time the + * kernel corresponding to \p hfunc will be invoked. \p offset is a byte offset. + * + * \param hfunc - Kernel to add parameter to + * \param offset - Offset to add parameter to argument list + * \param value - Value of parameter + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuFuncSetBlockShape, + * ::cuFuncSetSharedSize, + * ::cuFuncGetAttribute, + * ::cuParamSetSize, + * ::cuParamSeti, + * ::cuParamSetv, + * ::cuLaunch, + * ::cuLaunchGrid, + * ::cuLaunchGridAsync, + * ::cuLaunchKernel + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuParamSetf(CUfunction hfunc, int offset, float value); + +/** + * \brief Adds arbitrary data to the function's argument list + * + * \deprecated + * + * Copies an arbitrary amount of data (specified in \p numbytes) from \p ptr + * into the parameter space of the kernel corresponding to \p hfunc. \p offset + * is a byte offset. + * + * \param hfunc - Kernel to add data to + * \param offset - Offset to add data to argument list + * \param ptr - Pointer to arbitrary data + * \param numbytes - Size of data to copy in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuFuncSetBlockShape, + * ::cuFuncSetSharedSize, + * ::cuFuncGetAttribute, + * ::cuParamSetSize, + * ::cuParamSetf, + * ::cuParamSeti, + * ::cuLaunch, + * ::cuLaunchGrid, + * ::cuLaunchGridAsync, + * ::cuLaunchKernel + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuParamSetv(CUfunction hfunc, int offset, void *ptr, unsigned int numbytes); + +/** + * \brief Launches a CUDA function + * + * \deprecated + * + * Invokes the kernel \p f on a 1 x 1 x 1 grid of blocks. The block + * contains the number of threads specified by a previous call to + * ::cuFuncSetBlockShape(). + * + * The block shape, dynamic shared memory size, and parameter information + * must be set using + * ::cuFuncSetBlockShape(), + * ::cuFuncSetSharedSize(), + * ::cuParamSetSize(), + * ::cuParamSeti(), + * ::cuParamSetf(), and + * ::cuParamSetv() + * prior to calling this function. + * + * Launching a function via ::cuLaunchKernel() invalidates the function's + * block shape, dynamic shared memory size, and parameter information. After + * launching via cuLaunchKernel, this state must be re-initialized prior to + * calling this function. Failure to do so results in undefined behavior. + * + * \param f - Kernel to launch + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_LAUNCH_FAILED, + * ::CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, + * ::CUDA_ERROR_LAUNCH_TIMEOUT, + * ::CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED + * \notefnerr + * + * \sa ::cuFuncSetBlockShape, + * ::cuFuncSetSharedSize, + * ::cuFuncGetAttribute, + * ::cuParamSetSize, + * ::cuParamSetf, + * ::cuParamSeti, + * ::cuParamSetv, + * ::cuLaunchGrid, + * ::cuLaunchGridAsync, + * ::cuLaunchKernel + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuLaunch(CUfunction f); + +/** + * \brief Launches a CUDA function + * + * \deprecated + * + * Invokes the kernel \p f on a \p grid_width x \p grid_height grid of + * blocks. Each block contains the number of threads specified by a previous + * call to ::cuFuncSetBlockShape(). + * + * The block shape, dynamic shared memory size, and parameter information + * must be set using + * ::cuFuncSetBlockShape(), + * ::cuFuncSetSharedSize(), + * ::cuParamSetSize(), + * ::cuParamSeti(), + * ::cuParamSetf(), and + * ::cuParamSetv() + * prior to calling this function. + * + * Launching a function via ::cuLaunchKernel() invalidates the function's + * block shape, dynamic shared memory size, and parameter information. After + * launching via cuLaunchKernel, this state must be re-initialized prior to + * calling this function. Failure to do so results in undefined behavior. + * + * \param f - Kernel to launch + * \param grid_width - Width of grid in blocks + * \param grid_height - Height of grid in blocks + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_LAUNCH_FAILED, + * ::CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, + * ::CUDA_ERROR_LAUNCH_TIMEOUT, + * ::CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED + * \notefnerr + * + * \sa ::cuFuncSetBlockShape, + * ::cuFuncSetSharedSize, + * ::cuFuncGetAttribute, + * ::cuParamSetSize, + * ::cuParamSetf, + * ::cuParamSeti, + * ::cuParamSetv, + * ::cuLaunch, + * ::cuLaunchGridAsync, + * ::cuLaunchKernel + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuLaunchGrid(CUfunction f, int grid_width, int grid_height); + +/** + * \brief Launches a CUDA function + * + * \deprecated + * + * Invokes the kernel \p f on a \p grid_width x \p grid_height grid of + * blocks. Each block contains the number of threads specified by a previous + * call to ::cuFuncSetBlockShape(). + * + * The block shape, dynamic shared memory size, and parameter information + * must be set using + * ::cuFuncSetBlockShape(), + * ::cuFuncSetSharedSize(), + * ::cuParamSetSize(), + * ::cuParamSeti(), + * ::cuParamSetf(), and + * ::cuParamSetv() + * prior to calling this function. + * + * Launching a function via ::cuLaunchKernel() invalidates the function's + * block shape, dynamic shared memory size, and parameter information. After + * launching via cuLaunchKernel, this state must be re-initialized prior to + * calling this function. Failure to do so results in undefined behavior. + * + * \param f - Kernel to launch + * \param grid_width - Width of grid in blocks + * \param grid_height - Height of grid in blocks + * \param hStream - Stream identifier + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_LAUNCH_FAILED, + * ::CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, + * ::CUDA_ERROR_LAUNCH_TIMEOUT, + * ::CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, + * ::CUDA_ERROR_SHARED_OBJECT_INIT_FAILED + * + * \note In certain cases where cubins are created with no ABI (i.e., using \p ptxas \p --abi-compile \p no), + * this function may serialize kernel launches. The CUDA driver retains asynchronous behavior by + * growing the per-thread stack as needed per launch and not shrinking it afterwards. + * + * \note_null_stream + * \notefnerr + * + * \sa ::cuFuncSetBlockShape, + * ::cuFuncSetSharedSize, + * ::cuFuncGetAttribute, + * ::cuParamSetSize, + * ::cuParamSetf, + * ::cuParamSeti, + * ::cuParamSetv, + * ::cuLaunch, + * ::cuLaunchGrid, + * ::cuLaunchKernel + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream); + + +/** + * \brief Adds a texture-reference to the function's argument list + * + * \deprecated + * + * Makes the CUDA array or linear memory bound to the texture reference + * \p hTexRef available to a device program as a texture. In this version of + * CUDA, the texture-reference must be obtained via ::cuModuleGetTexRef() and + * the \p texunit parameter must be set to ::CU_PARAM_TR_DEFAULT. + * + * \param hfunc - Kernel to add texture-reference to + * \param texunit - Texture unit (must be ::CU_PARAM_TR_DEFAULT) + * \param hTexRef - Texture-reference to add to argument list + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef); + +/** + * \brief Sets the shared memory configuration for a device function. + * + * \deprecated + * + * On devices with configurable shared memory banks, this function will + * force all subsequent launches of the specified device function to have + * the given shared memory bank size configuration. On any given launch of the + * function, the shared memory configuration of the device will be temporarily + * changed if needed to suit the function's preferred configuration. Changes in + * shared memory configuration between subsequent launches of functions, + * may introduce a device side synchronization point. + * + * Any per-function setting of shared memory bank size set via + * ::cuFuncSetSharedMemConfig will override the context wide setting set with + * ::cuCtxSetSharedMemConfig. + * + * Changing the shared memory bank size will not increase shared memory usage + * or affect occupancy of kernels, but may have major effects on performance. + * Larger bank sizes will allow for greater potential bandwidth to shared memory, + * but will change what kinds of accesses to shared memory will result in bank + * conflicts. + * + * This function will do nothing on devices with fixed shared memory bank size. + * + * The supported bank configurations are: + * - ::CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE: use the context's shared memory + * configuration when launching this function. + * - ::CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE: set shared memory bank width to + * be natively four bytes when launching this function. + * - ::CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE: set shared memory bank width to + * be natively eight bytes when launching this function. + * + * \param hfunc - kernel to be given a shared memory config + * \param config - requested shared memory configuration + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa ::cuCtxGetCacheConfig, + * ::cuCtxSetCacheConfig, + * ::cuCtxGetSharedMemConfig, + * ::cuCtxSetSharedMemConfig, + * ::cuFuncGetAttribute, + * ::cuLaunchKernel, + * ::cudaFuncSetSharedMemConfig + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config); + +/** @} */ /* END CUDA_EXEC_DEPRECATED */ + +/** + * \defgroup CUDA_GRAPH Graph Management + * + * ___MANBRIEF___ graph management functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the graph management functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Creates a graph + * + * Creates an empty graph, which is returned via \p phGraph. + * + * \param phGraph - Returns newly created graph + * \param flags - Graph creation flags, must be 0 + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddHostNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode, + * ::cuGraphInstantiate, + * ::cuGraphDestroy, + * ::cuGraphGetNodes, + * ::cuGraphGetRootNodes, + * ::cuGraphGetEdges, + * ::cuGraphClone + */ +CUresult CUDAAPI cuGraphCreate(CUgraph *phGraph, unsigned int flags); + +/** + * \brief Creates a kernel execution node and adds it to a graph + * + * Creates a new kernel execution node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies and arguments specified in \p nodeParams. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * The CUDA_KERNEL_NODE_PARAMS structure is defined as: + * + * \code + * typedef struct CUDA_KERNEL_NODE_PARAMS_st { + * CUfunction func; + * unsigned int gridDimX; + * unsigned int gridDimY; + * unsigned int gridDimZ; + * unsigned int blockDimX; + * unsigned int blockDimY; + * unsigned int blockDimZ; + * unsigned int sharedMemBytes; + * void **kernelParams; + * void **extra; + * CUkernel kern; + * CUcontext ctx; + * } CUDA_KERNEL_NODE_PARAMS; + * \endcode + * + * When the graph is launched, the node will invoke kernel \p func on a (\p gridDimX x + * \p gridDimY x \p gridDimZ) grid of blocks. Each block contains + * (\p blockDimX x \p blockDimY x \p blockDimZ) threads. + * + * \p sharedMemBytes sets the amount of dynamic shared memory that will be + * available to each thread block. + * + * Kernel parameters to \p func can be specified in one of two ways: + * + * 1) Kernel parameters can be specified via \p kernelParams. If the kernel has N + * parameters, then \p kernelParams needs to be an array of N pointers. Each pointer, + * from \p kernelParams[0] to \p kernelParams[N-1], points to the region of memory from which the actual + * parameter will be copied. The number of kernel parameters and their offsets and sizes do not need + * to be specified as that information is retrieved directly from the kernel's image. + * + * 2) Kernel parameters for non-cooperative kernels can also be packaged by the application into a single + * buffer that is passed in via \p extra. This places the burden on the application of knowing each + * kernel parameter's size and alignment/padding within the buffer. The \p extra parameter exists + * to allow this function to take additional less commonly used arguments. \p extra specifies + * a list of names of extra settings and their corresponding values. Each extra setting name is + * immediately followed by the corresponding value. The list must be terminated with either NULL or + * CU_LAUNCH_PARAM_END. + * + * - ::CU_LAUNCH_PARAM_END, which indicates the end of the \p extra + * array; + * - ::CU_LAUNCH_PARAM_BUFFER_POINTER, which specifies that the next + * value in \p extra will be a pointer to a buffer + * containing all the kernel parameters for launching kernel + * \p func; + * - ::CU_LAUNCH_PARAM_BUFFER_SIZE, which specifies that the next + * value in \p extra will be a pointer to a size_t + * containing the size of the buffer specified with + * ::CU_LAUNCH_PARAM_BUFFER_POINTER; + * + * The error ::CUDA_ERROR_INVALID_VALUE will be returned if kernel parameters are specified with both + * \p kernelParams and \p extra (i.e. both \p kernelParams and \p extra are non-NULL). + * ::CUDA_ERROR_INVALID_VALUE will be returned if \p extra is used for a cooperative kernel. + * + * The \p kernelParams or \p extra array, as well as the argument values it points to, + * are copied during this call. + * + * \note Kernels launched using graphs must not use texture and surface references. Reading or + * writing through any texture or surface reference is undefined behavior. + * This restriction does not apply to texture and surface objects. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Parameters for the GPU execution node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuLaunchKernel, + * ::cuLaunchCooperativeKernel, + * ::cuGraphKernelNodeGetParams, + * ::cuGraphKernelNodeSetParams, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddHostNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddKernelNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS *nodeParams); + +/** + * \brief Returns a kernel node's parameters + * + * Returns the parameters of kernel node \p hNode in \p nodeParams. + * The \p kernelParams or \p extra array returned in \p nodeParams, + * as well as the argument values it points to, are owned by the node. + * This memory remains valid until the node is destroyed or its + * parameters are modified, and should not be modified + * directly. Use ::cuGraphKernelNodeSetParams to update the + * parameters of this node. + * + * The params will contain either \p kernelParams or \p extra, + * according to which of these was most recently set on the node. + * + * \param hNode - Node to get the parameters for + * \param nodeParams - Pointer to return the parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuLaunchKernel, + * ::cuGraphAddKernelNode, + * ::cuGraphKernelNodeSetParams + */ +CUresult CUDAAPI cuGraphKernelNodeGetParams(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS *nodeParams); + +/** + * \brief Sets a kernel node's parameters + * + * Sets the parameters of kernel node \p hNode to \p nodeParams. + * + * \param hNode - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeSetParams, + * ::cuLaunchKernel, + * ::cuGraphAddKernelNode, + * ::cuGraphKernelNodeGetParams + */ +CUresult CUDAAPI cuGraphKernelNodeSetParams(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS *nodeParams); + +/** + * \brief Creates a memcpy node and adds it to a graph + * + * Creates a new memcpy node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * When the graph is launched, the node will perform the memcpy described by \p copyParams. + * See ::cuMemcpy3D() for a description of the structure and its restrictions. + * + * Memcpy nodes have some additional restrictions with regards to managed memory, if the + * system contains at least one device which has a zero value for the device attribute + * ::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. If one or more of the operands refer + * to managed memory, then using the memory type ::CU_MEMORYTYPE_UNIFIED is disallowed + * for those operand(s). The managed memory will be treated as residing on either the + * host or the device, depending on which memory type is specified. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param copyParams - Parameters for the memory copy + * \param ctx - Context on which to run the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuMemcpy3D, + * ::cuGraphMemcpyNodeGetParams, + * ::cuGraphMemcpyNodeSetParams, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddHostNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddMemcpyNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_MEMCPY3D *copyParams, CUcontext ctx); + +/** + * \brief Returns a memcpy node's parameters + * + * Returns the parameters of memcpy node \p hNode in \p nodeParams. + * + * \param hNode - Node to get the parameters for + * \param nodeParams - Pointer to return the parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuMemcpy3D, + * ::cuGraphAddMemcpyNode, + * ::cuGraphMemcpyNodeSetParams + */ +CUresult CUDAAPI cuGraphMemcpyNodeGetParams(CUgraphNode hNode, CUDA_MEMCPY3D *nodeParams); + +/** + * \brief Sets a memcpy node's parameters + * + * Sets the parameters of memcpy node \p hNode to \p nodeParams. + * + * \param hNode - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeSetParams, + * ::cuMemcpy3D, + * ::cuGraphAddMemcpyNode, + * ::cuGraphMemcpyNodeGetParams + */ +CUresult CUDAAPI cuGraphMemcpyNodeSetParams(CUgraphNode hNode, const CUDA_MEMCPY3D *nodeParams); + +/** + * \brief Creates a memset node and adds it to a graph + * + * Creates a new memset node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * The element size must be 1, 2, or 4 bytes. + * When the graph is launched, the node will perform the memset described by \p memsetParams. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param memsetParams - Parameters for the memory set + * \param ctx - Context on which to run the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_CONTEXT + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuMemsetD2D32, + * ::cuGraphMemsetNodeGetParams, + * ::cuGraphMemsetNodeSetParams, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddHostNode, + * ::cuGraphAddMemcpyNode + */ +CUresult CUDAAPI cuGraphAddMemsetNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS *memsetParams, CUcontext ctx); + +/** + * \brief Returns a memset node's parameters + * + * Returns the parameters of memset node \p hNode in \p nodeParams. + * + * \param hNode - Node to get the parameters for + * \param nodeParams - Pointer to return the parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuMemsetD2D32, + * ::cuGraphAddMemsetNode, + * ::cuGraphMemsetNodeSetParams + */ +CUresult CUDAAPI cuGraphMemsetNodeGetParams(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS *nodeParams); + +/** + * \brief Sets a memset node's parameters + * + * Sets the parameters of memset node \p hNode to \p nodeParams. + * + * \param hNode - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeSetParams, + * ::cuMemsetD2D32, + * ::cuGraphAddMemsetNode, + * ::cuGraphMemsetNodeGetParams + */ +CUresult CUDAAPI cuGraphMemsetNodeSetParams(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS *nodeParams); + +/** + * \brief Creates a host execution node and adds it to a graph + * + * Creates a new CPU execution node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies and arguments specified in \p nodeParams. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * When the graph is launched, the node will invoke the specified CPU function. + * Host nodes are not supported under MPS with pre-Volta GPUs. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Parameters for the host node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuLaunchHostFunc, + * ::cuGraphHostNodeGetParams, + * ::cuGraphHostNodeSetParams, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddHostNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS *nodeParams); + +/** + * \brief Returns a host node's parameters + * + * Returns the parameters of host node \p hNode in \p nodeParams. + * + * \param hNode - Node to get the parameters for + * \param nodeParams - Pointer to return the parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuLaunchHostFunc, + * ::cuGraphAddHostNode, + * ::cuGraphHostNodeSetParams + */ +CUresult CUDAAPI cuGraphHostNodeGetParams(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS *nodeParams); + +/** + * \brief Sets a host node's parameters + * + * Sets the parameters of host node \p hNode to \p nodeParams. + * + * \param hNode - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeSetParams, + * ::cuLaunchHostFunc, + * ::cuGraphAddHostNode, + * ::cuGraphHostNodeGetParams + */ +CUresult CUDAAPI cuGraphHostNodeSetParams(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS *nodeParams); + +/** + * \brief Creates a child graph node and adds it to a graph + * + * Creates a new node which executes an embedded graph, and adds it to \p hGraph with + * \p numDependencies dependencies specified via \p dependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * If \p hGraph contains allocation or free nodes, this call will return an error. + * + * The node executes an embedded child graph. The child graph is cloned in this call. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param childGraph - The graph to clone into this node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuGraphChildGraphNodeGetGraph, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddHostNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode, + * ::cuGraphClone + */ +CUresult CUDAAPI cuGraphAddChildGraphNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUgraph childGraph); + +/** + * \brief Gets a handle to the embedded graph of a child graph node + * + * Gets a handle to the embedded graph in a child graph node. This call + * does not clone the graph. Changes to the graph will be reflected in + * the node, and the node retains ownership of the graph. + * + * Allocation and free nodes cannot be added to the returned graph. + * Attempting to do so will return an error. + * + * \param hNode - Node to get the embedded graph for + * \param phGraph - Location to store a handle to the graph + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddChildGraphNode, + * ::cuGraphNodeFindInClone + */ +CUresult CUDAAPI cuGraphChildGraphNodeGetGraph(CUgraphNode hNode, CUgraph *phGraph); + +/** + * \brief Creates an empty node and adds it to a graph + * + * Creates a new node which performs no operation, and adds it to \p hGraph with + * \p numDependencies dependencies specified via \p dependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * An empty node performs no operation during execution, but can be used for + * transitive ordering. For example, a phased execution graph with 2 groups of n + * nodes with a barrier between them can be represented using an empty node and + * 2*n dependency edges, rather than no empty node and n^2 dependency edges. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddHostNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddEmptyNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies); + +/** + * \brief Creates an event record node and adds it to a graph + * + * Creates a new event record node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies and event specified in \p event. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * Each launch of the graph will record \p event to capture execution of the + * node's dependencies. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param event - Event for the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuGraphAddEventWaitNode, + * ::cuEventRecordWithFlags, + * ::cuStreamWaitEvent, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddEventRecordNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUevent event); + +/** + * \brief Returns the event associated with an event record node + * + * Returns the event of event record node \p hNode in \p event_out. + * + * \param hNode - Node to get the event for + * \param event_out - Pointer to return the event + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddEventRecordNode, + * ::cuGraphEventRecordNodeSetEvent, + * ::cuGraphEventWaitNodeGetEvent, + * ::cuEventRecordWithFlags, + * ::cuStreamWaitEvent + */ +CUresult CUDAAPI cuGraphEventRecordNodeGetEvent(CUgraphNode hNode, CUevent *event_out); + +/** + * \brief Sets an event record node's event + * + * Sets the event of event record node \p hNode to \p event. + * + * \param hNode - Node to set the event for + * \param event - Event to use + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeSetParams, + * ::cuGraphAddEventRecordNode, + * ::cuGraphEventRecordNodeGetEvent, + * ::cuGraphEventWaitNodeSetEvent, + * ::cuEventRecordWithFlags, + * ::cuStreamWaitEvent + */ +CUresult CUDAAPI cuGraphEventRecordNodeSetEvent(CUgraphNode hNode, CUevent event); + +/** + * \brief Creates an event wait node and adds it to a graph + * + * Creates a new event wait node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies and event specified in \p event. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * The graph node will wait for all work captured in \p event. See ::cuEventRecord() + * for details on what is captured by an event. \p event may be from a different context + * or device than the launch stream. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param event - Event for the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuGraphAddEventRecordNode, + * ::cuEventRecordWithFlags, + * ::cuStreamWaitEvent, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddEventWaitNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUevent event); + +/** + * \brief Returns the event associated with an event wait node + * + * Returns the event of event wait node \p hNode in \p event_out. + * + * \param hNode - Node to get the event for + * \param event_out - Pointer to return the event + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddEventWaitNode, + * ::cuGraphEventWaitNodeSetEvent, + * ::cuGraphEventRecordNodeGetEvent, + * ::cuEventRecordWithFlags, + * ::cuStreamWaitEvent + */ +CUresult CUDAAPI cuGraphEventWaitNodeGetEvent(CUgraphNode hNode, CUevent *event_out); + +/** + * \brief Sets an event wait node's event + * + * Sets the event of event wait node \p hNode to \p event. + * + * \param hNode - Node to set the event for + * \param event - Event to use + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeSetParams, + * ::cuGraphAddEventWaitNode, + * ::cuGraphEventWaitNodeGetEvent, + * ::cuGraphEventRecordNodeSetEvent, + * ::cuEventRecordWithFlags, + * ::cuStreamWaitEvent + */ +CUresult CUDAAPI cuGraphEventWaitNodeSetEvent(CUgraphNode hNode, CUevent event); + +/** + * \brief Creates an external semaphore signal node and adds it to a graph + * + * Creates a new external semaphore signal node and adds it to \p hGraph with \p + * numDependencies dependencies specified via \p dependencies and arguments specified + * in \p nodeParams. It is possible for \p numDependencies to be 0, in which case the + * node will be placed at the root of the graph. \p dependencies may not have any + * duplicate entries. A handle to the new node will be returned in \p phGraphNode. + * + * Performs a signal operation on a set of externally allocated semaphore objects + * when the node is launched. The operation(s) will occur after all of the node's + * dependencies have completed. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Parameters for the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuGraphExternalSemaphoresSignalNodeGetParams, + * ::cuGraphExternalSemaphoresSignalNodeSetParams, + * ::cuGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cuGraphAddExternalSemaphoresWaitNode, + * ::cuImportExternalSemaphore, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddEventRecordNode, + * ::cuGraphAddEventWaitNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddExternalSemaphoresSignalNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS *nodeParams); + +/** + * \brief Returns an external semaphore signal node's parameters + * + * Returns the parameters of an external semaphore signal node \p hNode in \p params_out. + * The \p extSemArray and \p paramsArray returned in \p params_out, + * are owned by the node. This memory remains valid until the node is destroyed or its + * parameters are modified, and should not be modified + * directly. Use ::cuGraphExternalSemaphoresSignalNodeSetParams to update the + * parameters of this node. + * + * \param hNode - Node to get the parameters for + * \param params_out - Pointer to return the parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuLaunchKernel, + * ::cuGraphAddExternalSemaphoresSignalNode, + * ::cuGraphExternalSemaphoresSignalNodeSetParams, + * ::cuGraphAddExternalSemaphoresWaitNode, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync + */ +CUresult CUDAAPI cuGraphExternalSemaphoresSignalNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS *params_out); + +/** + * \brief Sets an external semaphore signal node's parameters + * + * Sets the parameters of an external semaphore signal node \p hNode to \p nodeParams. + * + * \param hNode - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeSetParams, + * ::cuGraphAddExternalSemaphoresSignalNode, + * ::cuGraphExternalSemaphoresSignalNodeSetParams, + * ::cuGraphAddExternalSemaphoresWaitNode, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync + */ +CUresult CUDAAPI cuGraphExternalSemaphoresSignalNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS *nodeParams); + +/** + * \brief Creates an external semaphore wait node and adds it to a graph + * + * Creates a new external semaphore wait node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies and arguments specified in \p nodeParams. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. A handle + * to the new node will be returned in \p phGraphNode. + * + * Performs a wait operation on a set of externally allocated semaphore objects + * when the node is launched. The node's dependencies will not be launched until + * the wait operation has completed. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Parameters for the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuGraphExternalSemaphoresWaitNodeGetParams, + * ::cuGraphExternalSemaphoresWaitNodeSetParams, + * ::cuGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cuGraphAddExternalSemaphoresSignalNode, + * ::cuImportExternalSemaphore, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddEventRecordNode, + * ::cuGraphAddEventWaitNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddExternalSemaphoresWaitNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS *nodeParams); + +/** + * \brief Returns an external semaphore wait node's parameters + * + * Returns the parameters of an external semaphore wait node \p hNode in \p params_out. + * The \p extSemArray and \p paramsArray returned in \p params_out, + * are owned by the node. This memory remains valid until the node is destroyed or its + * parameters are modified, and should not be modified + * directly. Use ::cuGraphExternalSemaphoresSignalNodeSetParams to update the + * parameters of this node. + * + * \param hNode - Node to get the parameters for + * \param params_out - Pointer to return the parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuLaunchKernel, + * ::cuGraphAddExternalSemaphoresWaitNode, + * ::cuGraphExternalSemaphoresWaitNodeSetParams, + * ::cuGraphAddExternalSemaphoresWaitNode, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync + */ +CUresult CUDAAPI cuGraphExternalSemaphoresWaitNodeGetParams(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS *params_out); + +/** + * \brief Sets an external semaphore wait node's parameters + * + * Sets the parameters of an external semaphore wait node \p hNode to \p nodeParams. + * + * \param hNode - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeSetParams, + * ::cuGraphAddExternalSemaphoresWaitNode, + * ::cuGraphExternalSemaphoresWaitNodeSetParams, + * ::cuGraphAddExternalSemaphoresWaitNode, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync + */ +CUresult CUDAAPI cuGraphExternalSemaphoresWaitNodeSetParams(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS *nodeParams); + +/** + * \brief Creates a batch memory operation node and adds it to a graph + * + * Creates a new batch memory operation node and adds it to \p hGraph with \p + * numDependencies dependencies specified via \p dependencies and arguments specified in \p nodeParams. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * When the node is added, the paramArray inside \p nodeParams is copied and therefore it can be + * freed after the call returns. + * + * \note + * Warning: + * Improper use of this API may deadlock the application. Synchronization + * ordering established through this API is not visible to CUDA. CUDA tasks + * that are (even indirectly) ordered by this API should also have that order + * expressed with CUDA-visible dependencies such as events. This ensures that + * the scheduler does not serialize them in an improper order. For more + * information, see the Stream Memory Operations section in the programming + * guide(https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html). + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Parameters for the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuStreamBatchMemOp, + * ::cuStreamWaitValue32, + * ::cuStreamWriteValue32, + * ::cuStreamWaitValue64, + * ::cuStreamWriteValue64, + * ::cuGraphBatchMemOpNodeGetParams, + * ::cuGraphBatchMemOpNodeSetParams, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddBatchMemOpNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams); + +/** + * \brief Returns a batch mem op node's parameters + * + * Returns the parameters of batch mem op node \p hNode in \p nodeParams_out. + * The \p paramArray returned in \p nodeParams_out is owned by the node. + * This memory remains valid until the node is destroyed or its + * parameters are modified, and should not be modified + * directly. Use ::cuGraphBatchMemOpNodeSetParams to update the + * parameters of this node. + * + * \param hNode - Node to get the parameters for + * \param nodeParams_out - Pointer to return the parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuStreamBatchMemOp, + * ::cuGraphAddBatchMemOpNode, + * ::cuGraphBatchMemOpNodeSetParams + */ +CUresult CUDAAPI cuGraphBatchMemOpNodeGetParams(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams_out); + +/** + * \brief Sets a batch mem op node's parameters + * + * Sets the parameters of batch mem op node \p hNode to \p nodeParams. + * + * The paramArray inside \p nodeParams is copied and therefore it can be + * freed after the call returns. + * + * \param hNode - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeSetParams, + * ::cuStreamBatchMemOp, + * ::cuGraphAddBatchMemOpNode, + * ::cuGraphBatchMemOpNodeGetParams + */ +CUresult CUDAAPI cuGraphBatchMemOpNodeSetParams(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams); + +/** + * \brief Sets the parameters for a batch mem op node in the given graphExec + * + * Sets the parameters of a batch mem op node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p hNode in the + * non-executable graph, from which the executable graph was instantiated. + * + * The following fields on operations may be modified on an executable graph: + * + * op.waitValue.address + * op.waitValue.value[64] + * op.waitValue.flags bits corresponding to wait type (i.e. CU_STREAM_WAIT_VALUE_FLUSH bit cannot be modified) + * op.writeValue.address + * op.writeValue.value[64] + * + * Other fields, such as the context, count or type of operations, and other types of operations such as membars, + * may not be modified. + * + * \p hNode must not have been removed from the original graph. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * The paramArray inside \p nodeParams is copied and therefore it can be + * freed after the call returns. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Batch mem op node from the graph from which graphExec was instantiated + * \param nodeParams - Updated Parameters to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphExecNodeSetParams, + * ::cuStreamBatchMemOp, + * ::cuGraphAddBatchMemOpNode, + * ::cuGraphBatchMemOpNodeGetParams, + * ::cuGraphBatchMemOpNodeSetParams, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecBatchMemOpNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams); + +/** + * \brief Creates an allocation node and adds it to a graph + * + * Creates a new allocation node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies and arguments specified in \p nodeParams. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. A handle + * to the new node will be returned in \p phGraphNode. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Parameters for the node + * + * When ::cuGraphAddMemAllocNode creates an allocation node, it returns the address of the allocation in + * \p nodeParams.dptr. The allocation's address remains fixed across instantiations and launches. + * + * If the allocation is freed in the same graph, by creating a free node using ::cuGraphAddMemFreeNode, + * the allocation can be accessed by nodes ordered after the allocation node but before the free node. + * These allocations cannot be freed outside the owning graph, and they can only be freed once in the + * owning graph. + * + * If the allocation is not freed in the same graph, then it can be accessed not only by nodes in the + * graph which are ordered after the allocation node, but also by stream operations ordered after the + * graph's execution but before the allocation is freed. + * + * Allocations which are not freed in the same graph can be freed by: + * - passing the allocation to ::cuMemFreeAsync or ::cuMemFree; + * - launching a graph with a free node for that allocation; or + * - specifying ::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH during instantiation, which makes + * each launch behave as though it called ::cuMemFreeAsync for every unfreed allocation. + * + * It is not possible to free an allocation in both the owning graph and another graph. If the allocation + * is freed in the same graph, a free node cannot be added to another graph. If the allocation is freed + * in another graph, a free node can no longer be added to the owning graph. + * + * The following restrictions apply to graphs which contain allocation and/or memory free nodes: + * - Nodes and edges of the graph cannot be deleted. + * - The graph cannot be used in a child node. + * - Only one instantiation of the graph may exist at any point in time. + * - The graph cannot be cloned. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuGraphAddMemFreeNode, + * ::cuGraphMemAllocNodeGetParams, + * ::cuDeviceGraphMemTrim, + * ::cuDeviceGetGraphMemAttribute, + * ::cuDeviceSetGraphMemAttribute, + * ::cuMemAllocAsync, + * ::cuMemFreeAsync, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddEventRecordNode, + * ::cuGraphAddEventWaitNode, + * ::cuGraphAddExternalSemaphoresSignalNode, + * ::cuGraphAddExternalSemaphoresWaitNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddMemAllocNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS *nodeParams); + +/** + * \brief Returns a memory alloc node's parameters + * + * Returns the parameters of a memory alloc node \p hNode in \p params_out. + * The \p poolProps and \p accessDescs returned in \p params_out, are owned by the + * node. This memory remains valid until the node is destroyed. The returned + * parameters must not be modified. + * + * \param hNode - Node to get the parameters for + * \param params_out - Pointer to return the parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddMemAllocNode, + * ::cuGraphMemFreeNodeGetParams + */ +CUresult CUDAAPI cuGraphMemAllocNodeGetParams(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS *params_out); + +/** + * \brief Creates a memory free node and adds it to a graph + * + * Creates a new memory free node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies and arguments specified in \p nodeParams. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. A handle + * to the new node will be returned in \p phGraphNode. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param dptr - Address of memory to free + * + * ::cuGraphAddMemFreeNode will return ::CUDA_ERROR_INVALID_VALUE if the user attempts to free: + * - an allocation twice in the same graph. + * - an address that was not returned by an allocation node. + * - an invalid address. + * + * The following restrictions apply to graphs which contain allocation and/or memory free nodes: + * - Nodes and edges of the graph cannot be deleted. + * - The graph cannot be used in a child node. + * - Only one instantiation of the graph may exist at any point in time. + * - The graph cannot be cloned. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuGraphAddMemAllocNode, + * ::cuGraphMemFreeNodeGetParams, + * ::cuDeviceGraphMemTrim, + * ::cuDeviceGetGraphMemAttribute, + * ::cuDeviceSetGraphMemAttribute, + * ::cuMemAllocAsync, + * ::cuMemFreeAsync, + * ::cuGraphCreate, + * ::cuGraphDestroyNode, + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddEventRecordNode, + * ::cuGraphAddEventWaitNode, + * ::cuGraphAddExternalSemaphoresSignalNode, + * ::cuGraphAddExternalSemaphoresWaitNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphAddMemFreeNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUdeviceptr dptr); + +/** + * \brief Returns a memory free node's parameters + * + * Returns the address of a memory free node \p hNode in \p dptr_out. + * + * \param hNode - Node to get the parameters for + * \param dptr_out - Pointer to return the device address + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddMemFreeNode, + * ::cuGraphMemAllocNodeGetParams + */ +CUresult CUDAAPI cuGraphMemFreeNodeGetParams(CUgraphNode hNode, CUdeviceptr *dptr_out); + +/** + * \brief Free unused memory that was cached on the specified device for use with graphs back to the OS. + * + * Blocks which are not in use by a graph that is either currently executing or scheduled to execute are + * freed back to the operating system. + * + * \param device - The device for which cached memory should be freed. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_DEVICE + * + * \sa + * ::cuGraphAddMemAllocNode, + * ::cuGraphAddMemFreeNode, + * ::cuDeviceSetGraphMemAttribute, + * ::cuDeviceGetGraphMemAttribute + */ +CUresult CUDAAPI cuDeviceGraphMemTrim(CUdevice device); + +/** + * \brief Query asynchronous allocation attributes related to graphs + * + * Valid attributes are: + * + * - ::CU_GRAPH_MEM_ATTR_USED_MEM_CURRENT: Amount of memory, in bytes, currently associated with graphs + * - ::CU_GRAPH_MEM_ATTR_USED_MEM_HIGH: High watermark of memory, in bytes, associated with graphs since the + * last time it was reset. High watermark can only be reset to zero. + * - ::CU_GRAPH_MEM_ATTR_RESERVED_MEM_CURRENT: Amount of memory, in bytes, currently allocated for use by + * the CUDA graphs asynchronous allocator. + * - ::CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH: High watermark of memory, in bytes, currently allocated for use by + * the CUDA graphs asynchronous allocator. + * + * \param device - Specifies the scope of the query + * \param attr - attribute to get + * \param value - retrieved value + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_DEVICE + * + * \sa + * ::cuDeviceSetGraphMemAttribute, + * ::cuGraphAddMemAllocNode, + * ::cuGraphAddMemFreeNode + */ +CUresult CUDAAPI cuDeviceGetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value); + +/** + * \brief Set asynchronous allocation attributes related to graphs + * + * Valid attributes are: + * + * - ::CU_GRAPH_MEM_ATTR_USED_MEM_HIGH: High watermark of memory, in bytes, associated with graphs since the + * last time it was reset. High watermark can only be reset to zero. + * - ::CU_GRAPH_MEM_ATTR_RESERVED_MEM_HIGH: High watermark of memory, in bytes, currently allocated for use by + * the CUDA graphs asynchronous allocator. + * + * \param device - Specifies the scope of the query + * \param attr - attribute to get + * \param value - pointer to value to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_DEVICE + * + * \sa + * ::cuDeviceGetGraphMemAttribute, + * ::cuGraphAddMemAllocNode, + * ::cuGraphAddMemFreeNode + */ +CUresult CUDAAPI cuDeviceSetGraphMemAttribute(CUdevice device, CUgraphMem_attribute attr, void* value); + +/** + * \brief Clones a graph + * + * This function creates a copy of \p originalGraph and returns it in \p phGraphClone. + * All parameters are copied into the cloned graph. The original graph may be modified + * after this call without affecting the clone. + * + * Child graph nodes in the original graph are recursively copied into the clone. + * + * \param phGraphClone - Returns newly created cloned graph + * \param originalGraph - Graph to clone + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphCreate, + * ::cuGraphNodeFindInClone + */ +CUresult CUDAAPI cuGraphClone(CUgraph *phGraphClone, CUgraph originalGraph); + +/** + * \brief Finds a cloned version of a node + * + * This function returns the node in \p hClonedGraph corresponding to \p hOriginalNode + * in the original graph. + * + * \p hClonedGraph must have been cloned from \p hOriginalGraph via ::cuGraphClone. + * \p hOriginalNode must have been in \p hOriginalGraph at the time of the call to + * ::cuGraphClone, and the corresponding cloned node in \p hClonedGraph must not have + * been removed. The cloned node is then returned via \p phClonedNode. + * + * \param phNode - Returns handle to the cloned node + * \param hOriginalNode - Handle to the original node + * \param hClonedGraph - Cloned graph to query + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphClone + */ +CUresult CUDAAPI cuGraphNodeFindInClone(CUgraphNode *phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph); + +/** + * \brief Returns a node's type + * + * Returns the node type of \p hNode in \p type. + * + * \param hNode - Node to query + * \param type - Pointer to return the node type + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphGetNodes, + * ::cuGraphGetRootNodes, + * ::cuGraphChildGraphNodeGetGraph, + * ::cuGraphKernelNodeGetParams, + * ::cuGraphKernelNodeSetParams, + * ::cuGraphHostNodeGetParams, + * ::cuGraphHostNodeSetParams, + * ::cuGraphMemcpyNodeGetParams, + * ::cuGraphMemcpyNodeSetParams, + * ::cuGraphMemsetNodeGetParams, + * ::cuGraphMemsetNodeSetParams + */ +CUresult CUDAAPI cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType *type); + +/** + * \brief Returns a graph's nodes + * + * Returns a list of \p hGraph's nodes. \p nodes may be NULL, in which case this + * function will return the number of nodes in \p numNodes. Otherwise, + * \p numNodes entries will be filled in. If \p numNodes is higher than the actual + * number of nodes, the remaining entries in \p nodes will be set to NULL, and the + * number of nodes actually obtained will be returned in \p numNodes. + * + * \param hGraph - Graph to query + * \param nodes - Pointer to return the nodes + * \param numNodes - See description + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphCreate, + * ::cuGraphGetRootNodes, + * ::cuGraphGetEdges, + * ::cuGraphNodeGetType, + * ::cuGraphNodeGetDependencies, + * ::cuGraphNodeGetDependentNodes + */ +CUresult CUDAAPI cuGraphGetNodes(CUgraph hGraph, CUgraphNode *nodes, size_t *numNodes); + +/** + * \brief Returns a graph's root nodes + * + * Returns a list of \p hGraph's root nodes. \p rootNodes may be NULL, in which case this + * function will return the number of root nodes in \p numRootNodes. Otherwise, + * \p numRootNodes entries will be filled in. If \p numRootNodes is higher than the actual + * number of root nodes, the remaining entries in \p rootNodes will be set to NULL, and the + * number of nodes actually obtained will be returned in \p numRootNodes. + * + * \param hGraph - Graph to query + * \param rootNodes - Pointer to return the root nodes + * \param numRootNodes - See description + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphCreate, + * ::cuGraphGetNodes, + * ::cuGraphGetEdges, + * ::cuGraphNodeGetType, + * ::cuGraphNodeGetDependencies, + * ::cuGraphNodeGetDependentNodes + */ +CUresult CUDAAPI cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode *rootNodes, size_t *numRootNodes); + +/** + * \brief Returns a graph's dependency edges + * + * Returns a list of \p hGraph's dependency edges. Edges are returned via corresponding + * indices in \p from and \p to; that is, the node in \p to[i] has a dependency on the + * node in \p from[i]. \p from and \p to may both be NULL, in which + * case this function only returns the number of edges in \p numEdges. Otherwise, + * \p numEdges entries will be filled in. If \p numEdges is higher than the actual + * number of edges, the remaining entries in \p from and \p to will be set to NULL, and + * the number of edges actually returned will be written to \p numEdges. + * + * \param hGraph - Graph to get the edges from + * \param from - Location to return edge endpoints + * \param to - Location to return edge endpoints + * \param numEdges - See description + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphGetNodes, + * ::cuGraphGetRootNodes, + * ::cuGraphAddDependencies, + * ::cuGraphRemoveDependencies, + * ::cuGraphNodeGetDependencies, + * ::cuGraphNodeGetDependentNodes + */ +CUresult CUDAAPI cuGraphGetEdges(CUgraph hGraph, CUgraphNode *from, CUgraphNode *to, size_t *numEdges); + +/** + * \brief Returns a graph's dependency edges (12.3+) + * + * Returns a list of \p hGraph's dependency edges. Edges are returned via corresponding + * indices in \p from, \p to and \p edgeData; that is, the node in \p to[i] has a + * dependency on the node in \p from[i] with data \p edgeData[i]. \p from and \p to may + * both be NULL, in which case this function only returns the number of edges in + * \p numEdges. Otherwise, \p numEdges entries will be filled in. If \p numEdges is higher + * than the actual number of edges, the remaining entries in \p from and \p to will be + * set to NULL, and the number of edges actually returned will be written to \p numEdges. + * \p edgeData may alone be NULL, in which case the edges must all have default (zeroed) + * edge data. Attempting a lossy query via NULL \p edgeData will result in + * ::CUDA_ERROR_LOSSY_QUERY. If \p edgeData is non-NULL then \p from and \p to must be + * as well. + * + * \param hGraph - Graph to get the edges from + * \param from - Location to return edge endpoints + * \param to - Location to return edge endpoints + * \param edgeData - Optional location to return edge data + * \param numEdges - See description + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_LOSSY_QUERY, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphGetNodes, + * ::cuGraphGetRootNodes, + * ::cuGraphAddDependencies, + * ::cuGraphRemoveDependencies, + * ::cuGraphNodeGetDependencies, + * ::cuGraphNodeGetDependentNodes + */ +CUresult CUDAAPI cuGraphGetEdges_v2(CUgraph hGraph, CUgraphNode *from, CUgraphNode *to, CUgraphEdgeData *edgeData, size_t *numEdges); + +/** + * \brief Returns a node's dependencies + * + * Returns a list of \p node's dependencies. \p dependencies may be NULL, in which case this + * function will return the number of dependencies in \p numDependencies. Otherwise, + * \p numDependencies entries will be filled in. If \p numDependencies is higher than the actual + * number of dependencies, the remaining entries in \p dependencies will be set to NULL, and the + * number of nodes actually obtained will be returned in \p numDependencies. + * + * \param hNode - Node to query + * \param dependencies - Pointer to return the dependencies + * \param numDependencies - See description + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeGetDependentNodes, + * ::cuGraphGetNodes, + * ::cuGraphGetRootNodes, + * ::cuGraphGetEdges, + * ::cuGraphAddDependencies, + * ::cuGraphRemoveDependencies + */ +CUresult CUDAAPI cuGraphNodeGetDependencies(CUgraphNode hNode, CUgraphNode *dependencies, size_t *numDependencies); + +/** + * \brief Returns a node's dependencies (12.3+) + * + * Returns a list of \p node's dependencies. \p dependencies may be NULL, in which case this + * function will return the number of dependencies in \p numDependencies. Otherwise, + * \p numDependencies entries will be filled in. If \p numDependencies is higher than the actual + * number of dependencies, the remaining entries in \p dependencies will be set to NULL, and the + * number of nodes actually obtained will be returned in \p numDependencies. + * + * Note that if an edge has non-zero (non-default) edge data and \p edgeData is NULL, + * this API will return ::CUDA_ERROR_LOSSY_QUERY. If \p edgeData is non-NULL, then + * \p dependencies must be as well. + * + * \param hNode - Node to query + * \param dependencies - Pointer to return the dependencies + * \param edgeData - Optional array to return edge data for each dependency + * \param numDependencies - See description + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_LOSSY_QUERY, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeGetDependentNodes, + * ::cuGraphGetNodes, + * ::cuGraphGetRootNodes, + * ::cuGraphGetEdges, + * ::cuGraphAddDependencies, + * ::cuGraphRemoveDependencies + */ +CUresult CUDAAPI cuGraphNodeGetDependencies_v2(CUgraphNode hNode, CUgraphNode *dependencies, CUgraphEdgeData *edgeData, size_t *numDependencies); + +/** + * \brief Returns a node's dependent nodes + * + * Returns a list of \p node's dependent nodes. \p dependentNodes may be NULL, in which + * case this function will return the number of dependent nodes in \p numDependentNodes. + * Otherwise, \p numDependentNodes entries will be filled in. If \p numDependentNodes is + * higher than the actual number of dependent nodes, the remaining entries in + * \p dependentNodes will be set to NULL, and the number of nodes actually obtained will + * be returned in \p numDependentNodes. + * + * \param hNode - Node to query + * \param dependentNodes - Pointer to return the dependent nodes + * \param numDependentNodes - See description + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeGetDependencies, + * ::cuGraphGetNodes, + * ::cuGraphGetRootNodes, + * ::cuGraphGetEdges, + * ::cuGraphAddDependencies, + * ::cuGraphRemoveDependencies + */ +CUresult CUDAAPI cuGraphNodeGetDependentNodes(CUgraphNode hNode, CUgraphNode *dependentNodes, size_t *numDependentNodes); + +/** + * \brief Returns a node's dependent nodes (12.3+) + * + * Returns a list of \p node's dependent nodes. \p dependentNodes may be NULL, in which + * case this function will return the number of dependent nodes in \p numDependentNodes. + * Otherwise, \p numDependentNodes entries will be filled in. If \p numDependentNodes is + * higher than the actual number of dependent nodes, the remaining entries in + * \p dependentNodes will be set to NULL, and the number of nodes actually obtained will + * be returned in \p numDependentNodes. + * + * Note that if an edge has non-zero (non-default) edge data and \p edgeData is NULL, + * this API will return ::CUDA_ERROR_LOSSY_QUERY. If \p edgeData is non-NULL, then + * \p dependentNodes must be as well. + * + * \param hNode - Node to query + * \param dependentNodes - Pointer to return the dependent nodes + * \param edgeData - Optional pointer to return edge data for dependent nodes + * \param numDependentNodes - See description + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_LOSSY_QUERY, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeGetDependencies, + * ::cuGraphGetNodes, + * ::cuGraphGetRootNodes, + * ::cuGraphGetEdges, + * ::cuGraphAddDependencies, + * ::cuGraphRemoveDependencies + */ +CUresult CUDAAPI cuGraphNodeGetDependentNodes_v2(CUgraphNode hNode, CUgraphNode *dependentNodes, CUgraphEdgeData *edgeData, size_t *numDependentNodes); + +/** + * \brief Adds dependency edges to a graph + * + * The number of dependencies to be added is defined by \p numDependencies + * Elements in \p from and \p to at corresponding indices define a dependency. + * Each node in \p from and \p to must belong to \p hGraph. + * + * If \p numDependencies is 0, elements in \p from and \p to will be ignored. + * Specifying an existing dependency will return an error. + * + * \param hGraph - Graph to which dependencies are added + * \param from - Array of nodes that provide the dependencies + * \param to - Array of dependent nodes + * \param numDependencies - Number of dependencies to be added + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphRemoveDependencies, + * ::cuGraphGetEdges, + * ::cuGraphNodeGetDependencies, + * ::cuGraphNodeGetDependentNodes + */ +CUresult CUDAAPI cuGraphAddDependencies(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, size_t numDependencies); + +/** + * \brief Adds dependency edges to a graph (12.3+) + * + * The number of dependencies to be added is defined by \p numDependencies + * Elements in \p from and \p to at corresponding indices define a dependency. + * Each node in \p from and \p to must belong to \p hGraph. + * + * If \p numDependencies is 0, elements in \p from and \p to will be ignored. + * Specifying an existing dependency will return an error. + * + * \param hGraph - Graph to which dependencies are added + * \param from - Array of nodes that provide the dependencies + * \param to - Array of dependent nodes + * \param edgeData - Optional array of edge data. If NULL, default (zeroed) edge data is assumed. + * \param numDependencies - Number of dependencies to be added + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphRemoveDependencies, + * ::cuGraphGetEdges, + * ::cuGraphNodeGetDependencies, + * ::cuGraphNodeGetDependentNodes + */ +CUresult CUDAAPI cuGraphAddDependencies_v2(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, const CUgraphEdgeData *edgeData, size_t numDependencies); + +/** + * \brief Removes dependency edges from a graph + * + * The number of \p dependencies to be removed is defined by \p numDependencies. + * Elements in \p from and \p to at corresponding indices define a dependency. + * Each node in \p from and \p to must belong to \p hGraph. + * + * If \p numDependencies is 0, elements in \p from and \p to will be ignored. + * Specifying a non-existing dependency will return an error. + * + * Dependencies cannot be removed from graphs which contain allocation or free nodes. + * Any attempt to do so will return an error. + * + * \param hGraph - Graph from which to remove dependencies + * \param from - Array of nodes that provide the dependencies + * \param to - Array of dependent nodes + * \param numDependencies - Number of dependencies to be removed + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddDependencies, + * ::cuGraphGetEdges, + * ::cuGraphNodeGetDependencies, + * ::cuGraphNodeGetDependentNodes + */ +CUresult CUDAAPI cuGraphRemoveDependencies(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, size_t numDependencies); + +/** + * \brief Removes dependency edges from a graph (12.3+) + * + * The number of \p dependencies to be removed is defined by \p numDependencies. + * Elements in \p from and \p to at corresponding indices define a dependency. + * Each node in \p from and \p to must belong to \p hGraph. + * + * If \p numDependencies is 0, elements in \p from and \p to will be ignored. + * Specifying an edge that does not exist in the graph, with data matching + * \p edgeData, results in an error. \p edgeData is nullable, which is equivalent + * to passing default (zeroed) data for each edge. + * + * Dependencies cannot be removed from graphs which contain allocation or free nodes. + * Any attempt to do so will return an error. + * + * \param hGraph - Graph from which to remove dependencies + * \param from - Array of nodes that provide the dependencies + * \param to - Array of dependent nodes + * \param edgeData - Optional array of edge data. If NULL, edge data is assumed to + * be default (zeroed). + * \param numDependencies - Number of dependencies to be removed + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddDependencies, + * ::cuGraphGetEdges, + * ::cuGraphNodeGetDependencies, + * ::cuGraphNodeGetDependentNodes + */ +CUresult CUDAAPI cuGraphRemoveDependencies_v2(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, const CUgraphEdgeData *edgeData, size_t numDependencies); + +/** + * \brief Remove a node from the graph + * + * Removes \p hNode from its graph. This operation also severs any dependencies of other nodes + * on \p hNode and vice versa. + * + * Nodes which belong to a graph which contains allocation or free nodes cannot be destroyed. + * Any attempt to do so will return an error. + * + * \param hNode - Node to remove + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddChildGraphNode, + * ::cuGraphAddEmptyNode, + * ::cuGraphAddKernelNode, + * ::cuGraphAddHostNode, + * ::cuGraphAddMemcpyNode, + * ::cuGraphAddMemsetNode + */ +CUresult CUDAAPI cuGraphDestroyNode(CUgraphNode hNode); + +/** + * \brief Creates an executable graph from a graph + * + * Instantiates \p hGraph as an executable graph. The graph is validated for any + * structural constraints or intra-node constraints which were not previously + * validated. If instantiation is successful, a handle to the instantiated graph + * is returned in \p phGraphExec. + * + * The \p flags parameter controls the behavior of instantiation and subsequent + * graph launches. Valid flags are: + * + * - ::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH, which configures a + * graph containing memory allocation nodes to automatically free any + * unfreed memory allocations before the graph is relaunched. + * + * - ::CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH, which configures the graph for launch + * from the device. If this flag is passed, the executable graph handle returned can be + * used to launch the graph from both the host and device. This flag can only be used + * on platforms which support unified addressing. This flag cannot be used in + * conjunction with ::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH. + * + * - ::CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY, which causes the graph + * to use the priorities from the per-node attributes rather than the priority + * of the launch stream during execution. Note that priorities are only available + * on kernel nodes, and are copied from stream priority during stream capture. + * + * If \p hGraph contains any allocation or free nodes, there can be at most one + * executable graph in existence for that graph at a time. An attempt to instantiate + * a second executable graph before destroying the first with ::cuGraphExecDestroy + * will result in an error. + * The same also applies if \p hGraph contains any device-updatable kernel nodes. + * + * If \p hGraph contains kernels which call device-side cudaGraphLaunch() from multiple + * contexts, this will result in an error. + * + * Graphs instantiated for launch on the device have additional restrictions which do not + * apply to host graphs: + * + * - The graph's nodes must reside on a single context. + * - The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes. + * - The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. + * Operation-specific restrictions are outlined below. + * - Kernel nodes: + * - Use of CUDA Dynamic Parallelism is not permitted. + * - Cooperative launches are permitted as long as MPS is not in use. + * - Memcpy nodes: + * - Only copies involving device memory and/or pinned device-mapped host memory are permitted. + * - Copies involving CUDA arrays are not permitted. + * - Both operands must be accessible from the current context, and the current context must + * match the context of other nodes in the graph. + * + * \param phGraphExec - Returns instantiated graph + * \param hGraph - Graph to instantiate + * \param flags - Flags to control instantiation. See ::CUgraphInstantiate_flags. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphInstantiate, + * ::cuGraphCreate, + * ::cuGraphUpload, + * ::cuGraphLaunch, + * ::cuGraphExecDestroy + */ +CUresult CUDAAPI cuGraphInstantiate(CUgraphExec *phGraphExec, CUgraph hGraph, unsigned long long flags); + +/** + * \brief Creates an executable graph from a graph + * + * Instantiates \p hGraph as an executable graph according to the \p instantiateParams structure. + * The graph is validated for any structural constraints or intra-node constraints + * which were not previously validated. If instantiation is successful, a handle to + * the instantiated graph is returned in \p phGraphExec. + * + * \p instantiateParams controls the behavior of instantiation and subsequent + * graph launches, as well as returning more detailed information in the event of an error. + * ::CUDA_GRAPH_INSTANTIATE_PARAMS is defined as: + * + * \code + typedef struct { + cuuint64_t flags; + CUstream hUploadStream; + CUgraphNode hErrNode_out; + CUgraphInstantiateResult result_out; + } CUDA_GRAPH_INSTANTIATE_PARAMS; + * \endcode + * + * The \p flags field controls the behavior of instantiation and subsequent + * graph launches. Valid flags are: + * + * - ::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH, which configures a + * graph containing memory allocation nodes to automatically free any + * unfreed memory allocations before the graph is relaunched. + * + * - ::CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD, which will perform an upload of the graph + * into \p hUploadStream once the graph has been instantiated. + * + * - ::CUDA_GRAPH_INSTANTIATE_FLAG_DEVICE_LAUNCH, which configures the graph for launch + * from the device. If this flag is passed, the executable graph handle returned can be + * used to launch the graph from both the host and device. This flag can only be used + * on platforms which support unified addressing. This flag cannot be used in + * conjunction with ::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH. + * + * - ::CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY, which causes the graph + * to use the priorities from the per-node attributes rather than the priority + * of the launch stream during execution. Note that priorities are only available + * on kernel nodes, and are copied from stream priority during stream capture. + * + * If \p hGraph contains any allocation or free nodes, there can be at most one + * executable graph in existence for that graph at a time. An attempt to instantiate a + * second executable graph before destroying the first with ::cuGraphExecDestroy will + * result in an error. + * The same also applies if \p hGraph contains any device-updatable kernel nodes. + * + * If \p hGraph contains kernels which call device-side cudaGraphLaunch() from multiple + * contexts, this will result in an error. + * + * Graphs instantiated for launch on the device have additional restrictions which do not + * apply to host graphs: + * + * - The graph's nodes must reside on a single context. + * - The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes. + * - The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. + * Operation-specific restrictions are outlined below. + * - Kernel nodes: + * - Use of CUDA Dynamic Parallelism is not permitted. + * - Cooperative launches are permitted as long as MPS is not in use. + * - Memcpy nodes: + * - Only copies involving device memory and/or pinned device-mapped host memory are permitted. + * - Copies involving CUDA arrays are not permitted. + * - Both operands must be accessible from the current context, and the current context must + * match the context of other nodes in the graph. + * + * In the event of an error, the \p result_out and \p hErrNode_out fields will contain more + * information about the nature of the error. Possible error reporting includes: + * + * - ::CUDA_GRAPH_INSTANTIATE_ERROR, if passed an invalid value or if an unexpected error occurred + * which is described by the return value of the function. \p hErrNode_out will be set to NULL. + * - ::CUDA_GRAPH_INSTANTIATE_INVALID_STRUCTURE, if the graph structure is invalid. \p hErrNode_out + * will be set to one of the offending nodes. + * - ::CUDA_GRAPH_INSTANTIATE_NODE_OPERATION_NOT_SUPPORTED, if the graph is instantiated for device + * launch but contains a node of an unsupported node type, or a node which performs unsupported + * operations, such as use of CUDA dynamic parallelism within a kernel node. \p hErrNode_out will + * be set to this node. + * - ::CUDA_GRAPH_INSTANTIATE_MULTIPLE_CTXS_NOT_SUPPORTED, if the graph is instantiated for device + * launch but a node’s context differs from that of another node. This error can also be returned + * if a graph is not instantiated for device launch and it contains kernels which call device-side + * cudaGraphLaunch() from multiple contexts. \p hErrNode_out will be set to this node. + * + * If instantiation is successful, \p result_out will be set to ::CUDA_GRAPH_INSTANTIATE_SUCCESS, + * and \p hErrNode_out will be set to NULL. + * + * \param phGraphExec - Returns instantiated graph + * \param hGraph - Graph to instantiate + * \param instantiateParams - Instantiation parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphCreate, + * ::cuGraphInstantiate, + * ::cuGraphExecDestroy + */ +CUresult CUDAAPI cuGraphInstantiateWithParams(CUgraphExec *phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS *instantiateParams); + +/** + * \brief Query the instantiation flags of an executable graph + * + * Returns the flags that were passed to instantiation for the given executable graph. + * ::CUDA_GRAPH_INSTANTIATE_FLAG_UPLOAD will not be returned by this API as it does + * not affect the resulting executable graph. + * + * \param hGraphExec - The executable graph to query + * \param flags - Returns the instantiation flags + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphInstantiate, + * ::cuGraphInstantiateWithParams + */ +CUresult CUDAAPI cuGraphExecGetFlags(CUgraphExec hGraphExec, cuuint64_t *flags); + +/** + * \brief Sets the parameters for a kernel node in the given graphExec + * + * Sets the parameters of a kernel node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p hNode in the + * non-executable graph, from which the executable graph was instantiated. + * + * \p hNode must not have been removed from the original graph. All \p nodeParams + * fields may change, but the following restrictions apply to \p func updates: + * + * - The owning context of the function cannot change. + * - A node whose function originally did not use CUDA dynamic parallelism cannot be updated + * to a function which uses CDP + * - A node whose function originally did not make device-side update calls cannot be updated + * to a function which makes device-side update calls. + * - If \p hGraphExec was not instantiated for device launch, a node whose function originally + * did not use device-side cudaGraphLaunch() cannot be updated to a function which uses + * device-side cudaGraphLaunch() unless the node resides on the same context as nodes which + * contained such calls at instantiate-time. If no such calls were present at instantiation, + * these updates cannot be performed at all. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * If \p hNode is a device-updatable kernel node, the next upload/launch of \p hGraphExec + * will overwrite any previous device-side updates. Additionally, applying host updates to a + * device-updatable kernel node while it is being updated from the device will result in + * undefined behavior. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - kernel node from the graph from which graphExec was instantiated + * \param nodeParams - Updated Parameters to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphExecNodeSetParams, + * ::cuGraphAddKernelNode, + * ::cuGraphKernelNodeSetParams, + * ::cuGraphExecMemcpyNodeSetParams, + * ::cuGraphExecMemsetNodeSetParams, + * ::cuGraphExecHostNodeSetParams, + * ::cuGraphExecChildGraphNodeSetParams, + * ::cuGraphExecEventRecordNodeSetEvent, + * ::cuGraphExecEventWaitNodeSetEvent, + * ::cuGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cuGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecKernelNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS *nodeParams); + +/** + * \brief Sets the parameters for a memcpy node in the given graphExec. + * + * Updates the work represented by \p hNode in \p hGraphExec as though \p hNode had + * contained \p copyParams at instantiation. hNode must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from hNode are ignored. + * + * The source and destination memory in \p copyParams must be allocated from the same + * contexts as the original source and destination memory. Both the instantiation-time + * memory operands and the memory operands in \p copyParams must be 1-dimensional. + * Zero-length operations are not supported. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. hNode is also + * not modified by this call. + * + * Returns CUDA_ERROR_INVALID_VALUE if the memory operands' mappings changed or + * either the original or new memory operands are multidimensional. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Memcpy node from the graph which was used to instantiate graphExec + * \param copyParams - The updated parameters to set + * \param ctx - Context on which to run the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphExecNodeSetParams, + * ::cuGraphAddMemcpyNode, + * ::cuGraphMemcpyNodeSetParams, + * ::cuGraphExecKernelNodeSetParams, + * ::cuGraphExecMemsetNodeSetParams, + * ::cuGraphExecHostNodeSetParams, + * ::cuGraphExecChildGraphNodeSetParams, + * ::cuGraphExecEventRecordNodeSetEvent, + * ::cuGraphExecEventWaitNodeSetEvent, + * ::cuGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cuGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecMemcpyNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D *copyParams, CUcontext ctx); + +/** + * \brief Sets the parameters for a memset node in the given graphExec. + * + * Updates the work represented by \p hNode in \p hGraphExec as though \p hNode had + * contained \p memsetParams at instantiation. hNode must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from hNode are ignored. + * + * The destination memory in \p memsetParams must be allocated from the same + * contexts as the original destination memory. Both the instantiation-time + * memory operand and the memory operand in \p memsetParams must be 1-dimensional. + * Zero-length operations are not supported. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. hNode is also + * not modified by this call. + * + * Returns CUDA_ERROR_INVALID_VALUE if the memory operand's mappings changed or + * either the original or new memory operand are multidimensional. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Memset node from the graph which was used to instantiate graphExec + * \param memsetParams - The updated parameters to set + * \param ctx - Context on which to run the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphExecNodeSetParams, + * ::cuGraphAddMemsetNode, + * ::cuGraphMemsetNodeSetParams, + * ::cuGraphExecKernelNodeSetParams, + * ::cuGraphExecMemcpyNodeSetParams, + * ::cuGraphExecHostNodeSetParams, + * ::cuGraphExecChildGraphNodeSetParams, + * ::cuGraphExecEventRecordNodeSetEvent, + * ::cuGraphExecEventWaitNodeSetEvent, + * ::cuGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cuGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecMemsetNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS *memsetParams, CUcontext ctx); + +/** + * \brief Sets the parameters for a host node in the given graphExec. + * + * Updates the work represented by \p hNode in \p hGraphExec as though \p hNode had + * contained \p nodeParams at instantiation. hNode must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from hNode are ignored. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. hNode is also + * not modified by this call. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Host node from the graph which was used to instantiate graphExec + * \param nodeParams - The updated parameters to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphExecNodeSetParams, + * ::cuGraphAddHostNode, + * ::cuGraphHostNodeSetParams, + * ::cuGraphExecKernelNodeSetParams, + * ::cuGraphExecMemcpyNodeSetParams, + * ::cuGraphExecMemsetNodeSetParams, + * ::cuGraphExecChildGraphNodeSetParams, + * ::cuGraphExecEventRecordNodeSetEvent, + * ::cuGraphExecEventWaitNodeSetEvent, + * ::cuGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cuGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecHostNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS *nodeParams); + +/** + * \brief Updates node parameters in the child graph node in the given graphExec. + * + * Updates the work represented by \p hNode in \p hGraphExec as though the nodes contained + * in \p hNode's graph had the parameters contained in \p childGraph's nodes at instantiation. + * \p hNode must remain in the graph which was used to instantiate \p hGraphExec. + * Changed edges to and from \p hNode are ignored. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. \p hNode is also + * not modified by this call. + * + * The topology of \p childGraph, as well as the node insertion order, must match that + * of the graph contained in \p hNode. See ::cuGraphExecUpdate() for a list of restrictions + * on what can be updated in an instantiated graph. The update is recursive, so child graph + * nodes contained within the top level child graph will also be updated. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Host node from the graph which was used to instantiate graphExec + * \param childGraph - The graph supplying the updated parameters + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphExecNodeSetParams, + * ::cuGraphAddChildGraphNode, + * ::cuGraphChildGraphNodeGetGraph, + * ::cuGraphExecKernelNodeSetParams, + * ::cuGraphExecMemcpyNodeSetParams, + * ::cuGraphExecMemsetNodeSetParams, + * ::cuGraphExecHostNodeSetParams, + * ::cuGraphExecEventRecordNodeSetEvent, + * ::cuGraphExecEventWaitNodeSetEvent, + * ::cuGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cuGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecChildGraphNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph); + +/** + * \brief Sets the event for an event record node in the given graphExec + * + * Sets the event of an event record node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p hNode in the + * non-executable graph, from which the executable graph was instantiated. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - event record node from the graph from which graphExec was instantiated + * \param event - Updated event to use + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphExecNodeSetParams, + * ::cuGraphAddEventRecordNode, + * ::cuGraphEventRecordNodeGetEvent, + * ::cuGraphEventWaitNodeSetEvent, + * ::cuEventRecordWithFlags, + * ::cuStreamWaitEvent, + * ::cuGraphExecKernelNodeSetParams, + * ::cuGraphExecMemcpyNodeSetParams, + * ::cuGraphExecMemsetNodeSetParams, + * ::cuGraphExecHostNodeSetParams, + * ::cuGraphExecChildGraphNodeSetParams, + * ::cuGraphExecEventWaitNodeSetEvent, + * ::cuGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cuGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecEventRecordNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event); + +/** + * \brief Sets the event for an event wait node in the given graphExec + * + * Sets the event of an event wait node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p hNode in the + * non-executable graph, from which the executable graph was instantiated. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - event wait node from the graph from which graphExec was instantiated + * \param event - Updated event to use + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphExecNodeSetParams, + * ::cuGraphAddEventWaitNode, + * ::cuGraphEventWaitNodeGetEvent, + * ::cuGraphEventRecordNodeSetEvent, + * ::cuEventRecordWithFlags, + * ::cuStreamWaitEvent, + * ::cuGraphExecKernelNodeSetParams, + * ::cuGraphExecMemcpyNodeSetParams, + * ::cuGraphExecMemsetNodeSetParams, + * ::cuGraphExecHostNodeSetParams, + * ::cuGraphExecChildGraphNodeSetParams, + * ::cuGraphExecEventRecordNodeSetEvent, + * ::cuGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cuGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecEventWaitNodeSetEvent(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event); + +/** + * \brief Sets the parameters for an external semaphore signal node in the given graphExec + * + * Sets the parameters of an external semaphore signal node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p hNode in the + * non-executable graph, from which the executable graph was instantiated. + * + * \p hNode must not have been removed from the original graph. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * Changing \p nodeParams->numExtSems is not supported. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - semaphore signal node from the graph from which graphExec was instantiated + * \param nodeParams - Updated Parameters to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphExecNodeSetParams, + * ::cuGraphAddExternalSemaphoresSignalNode, + * ::cuImportExternalSemaphore, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync, + * ::cuGraphExecKernelNodeSetParams, + * ::cuGraphExecMemcpyNodeSetParams, + * ::cuGraphExecMemsetNodeSetParams, + * ::cuGraphExecHostNodeSetParams, + * ::cuGraphExecChildGraphNodeSetParams, + * ::cuGraphExecEventRecordNodeSetEvent, + * ::cuGraphExecEventWaitNodeSetEvent, + * ::cuGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecExternalSemaphoresSignalNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS *nodeParams); + +/** + * \brief Sets the parameters for an external semaphore wait node in the given graphExec + * + * Sets the parameters of an external semaphore wait node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p hNode in the + * non-executable graph, from which the executable graph was instantiated. + * + * \p hNode must not have been removed from the original graph. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * Changing \p nodeParams->numExtSems is not supported. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - semaphore wait node from the graph from which graphExec was instantiated + * \param nodeParams - Updated Parameters to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphExecNodeSetParams, + * ::cuGraphAddExternalSemaphoresWaitNode, + * ::cuImportExternalSemaphore, + * ::cuSignalExternalSemaphoresAsync, + * ::cuWaitExternalSemaphoresAsync, + * ::cuGraphExecKernelNodeSetParams, + * ::cuGraphExecMemcpyNodeSetParams, + * ::cuGraphExecMemsetNodeSetParams, + * ::cuGraphExecHostNodeSetParams, + * ::cuGraphExecChildGraphNodeSetParams, + * ::cuGraphExecEventRecordNodeSetEvent, + * ::cuGraphExecEventWaitNodeSetEvent, + * ::cuGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecExternalSemaphoresWaitNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS *nodeParams); + +/** + * \brief Enables or disables the specified node in the given graphExec + * + * Sets \p hNode to be either enabled or disabled. Disabled nodes are functionally equivalent + * to empty nodes until they are reenabled. Existing node parameters are not affected by + * disabling/enabling the node. + * + * The node is identified by the corresponding node \p hNode in the non-executable + * graph, from which the executable graph was instantiated. + * + * \p hNode must not have been removed from the original graph. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * If \p hNode is a device-updatable kernel node, the next upload/launch of \p hGraphExec + * will overwrite any previous device-side updates. Additionally, applying host updates to a + * device-updatable kernel node while it is being updated from the device will result in + * undefined behavior. + * + * \note Currently only kernel, memset and memcpy nodes are supported. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Node from the graph from which graphExec was instantiated + * \param isEnabled - Node is enabled if != 0, otherwise the node is disabled + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeGetEnabled, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + * ::cuGraphLaunch + */ +CUresult CUDAAPI cuGraphNodeSetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled); + +/** + * \brief Query whether a node in the given graphExec is enabled + * + * Sets isEnabled to 1 if \p hNode is enabled, or 0 if \p hNode is disabled. + * + * The node is identified by the corresponding node \p hNode in the non-executable + * graph, from which the executable graph was instantiated. + * + * \p hNode must not have been removed from the original graph. + * + * \note Currently only kernel, memset and memcpy nodes are supported. + * \note This function will not reflect device-side updates for device-updatable kernel nodes. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Node from the graph from which graphExec was instantiated + * \param isEnabled - Location to return the enabled status of the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphNodeSetEnabled, + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + * ::cuGraphLaunch + */ +CUresult CUDAAPI cuGraphNodeGetEnabled(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int *isEnabled); + +/** + * \brief Uploads an executable graph in a stream + * + * Uploads \p hGraphExec to the device in \p hStream without executing it. Uploads of + * the same \p hGraphExec will be serialized. Each upload is ordered behind both any + * previous work in \p hStream and any previous launches of \p hGraphExec. + * Uses memory cached by \p stream to back the allocations owned by \p hGraphExec. + * + * \param hGraphExec - Executable graph to upload + * \param hStream - Stream in which to upload the graph + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphInstantiate, + * ::cuGraphLaunch, + * ::cuGraphExecDestroy + */ +CUresult CUDAAPI cuGraphUpload(CUgraphExec hGraphExec, CUstream hStream); + +/** + * \brief Launches an executable graph in a stream + * + * Executes \p hGraphExec in \p hStream. Only one instance of \p hGraphExec may be executing + * at a time. Each launch is ordered behind both any previous work in \p hStream + * and any previous launches of \p hGraphExec. To execute a graph concurrently, it must be + * instantiated multiple times into multiple executable graphs. + * + * If any allocations created by \p hGraphExec remain unfreed (from a previous launch) and + * \p hGraphExec was not instantiated with ::CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH, + * the launch will fail with ::CUDA_ERROR_INVALID_VALUE. + * + * \param hGraphExec - Executable graph to launch + * \param hStream - Stream in which to launch the graph + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphInstantiate, + * ::cuGraphUpload, + * ::cuGraphExecDestroy + */ +CUresult CUDAAPI cuGraphLaunch(CUgraphExec hGraphExec, CUstream hStream); + +/** + * \brief Destroys an executable graph + * + * Destroys the executable graph specified by \p hGraphExec, as well + * as all of its executable nodes. If the executable graph is + * in-flight, it will not be terminated, but rather freed + * asynchronously on completion. + * + * \param hGraphExec - Executable graph to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphInstantiate, + * ::cuGraphUpload, + * ::cuGraphLaunch + */ +CUresult CUDAAPI cuGraphExecDestroy(CUgraphExec hGraphExec); + +/** + * \brief Destroys a graph + * + * Destroys the graph specified by \p hGraph, as well as all of its nodes. + * + * \param hGraph - Graph to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphCreate + */ +CUresult CUDAAPI cuGraphDestroy(CUgraph hGraph); + +/** + * \brief Check whether an executable graph can be updated with a graph and perform the update if possible + * + * Updates the node parameters in the instantiated graph specified by \p hGraphExec with the + * node parameters in a topologically identical graph specified by \p hGraph. + * + * Limitations: + * + * - Kernel nodes: + * - The owning context of the function cannot change. + * - A node whose function originally did not use CUDA dynamic parallelism cannot be updated + * to a function which uses CDP. + * - A node whose function originally did not make device-side update calls cannot be updated + * to a function which makes device-side update calls. + * - A cooperative node cannot be updated to a non-cooperative node, and vice-versa. + * - If the graph was instantiated with CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY, the + * priority attribute cannot change. Equality is checked on the originally requested + * priority values, before they are clamped to the device's supported range. + * - If \p hGraphExec was not instantiated for device launch, a node whose function originally + * did not use device-side cudaGraphLaunch() cannot be updated to a function which uses + * device-side cudaGraphLaunch() unless the node resides on the same context as nodes which + * contained such calls at instantiate-time. If no such calls were present at instantiation, + * these updates cannot be performed at all. + * - Neither \p hGraph nor \p hGraphExec may contain device-updatable kernel nodes. + * - Memset and memcpy nodes: + * - The CUDA device(s) to which the operand(s) was allocated/mapped cannot change. + * - The source/destination memory must be allocated from the same contexts as the original + * source/destination memory. + * - Only 1D memsets can be changed. + * - Additional memcpy node restrictions: + * - Changing either the source or destination memory type(i.e. CU_MEMORYTYPE_DEVICE, + * CU_MEMORYTYPE_ARRAY, etc.) is not supported. + * - External semaphore wait nodes and record nodes: + * - Changing the number of semaphores is not supported. + * - Conditional nodes: + * - Changing node parameters is not supported. + * - Changeing parameters of nodes within the conditional body graph is subject to the rules above. + * - Conditional handle flags and default values are updated as part of the graph update. + * + * Note: The API may add further restrictions in future releases. The return code should always be checked. + * + * cuGraphExecUpdate sets the result member of \p resultInfo to CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED + * under the following conditions: + * - The count of nodes directly in \p hGraphExec and \p hGraph differ, in which case resultInfo->errorNode + * is set to NULL. + * - \p hGraph has more exit nodes than \p hGraph, in which case resultInfo->errorNode is set to one of + * the exit nodes in hGraph. + * - A node in \p hGraph has a different number of dependencies than the node from \p hGraphExec it is paired with, + * in which case resultInfo->errorNode is set to the node from \p hGraph. + * - A node in \p hGraph has a dependency that does not match with the corresponding dependency of the paired node + * from \p hGraphExec. resultInfo->errorNode will be set to the node from \p hGraph. resultInfo->errorFromNode + * will be set to the mismatched dependency. The dependencies are paired based on edge order and a dependency + * does not match when the nodes are already paired based on other edges examined in the graph. + * + * cuGraphExecUpdate sets the result member of \p resultInfo to: + * - CU_GRAPH_EXEC_UPDATE_ERROR if passed an invalid value. + * - CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED if the graph topology changed + * - CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED if the type of a node changed, in which case + * \p hErrorNode_out is set to the node from \p hGraph. + * - CU_GRAPH_EXEC_UPDATE_ERROR_UNSUPPORTED_FUNCTION_CHANGE if the function changed in an unsupported + * way(see note above), in which case \p hErrorNode_out is set to the node from \p hGraph + * - CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED if any parameters to a node changed in a way + * that is not supported, in which case \p hErrorNode_out is set to the node from \p hGraph. + * - CU_GRAPH_EXEC_UPDATE_ERROR_ATTRIBUTES_CHANGED if any attributes of a node changed in a way + * that is not supported, in which case \p hErrorNode_out is set to the node from \p hGraph. + * - CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED if something about a node is unsupported, like + * the node's type or configuration, in which case \p hErrorNode_out is set to the node from \p hGraph + * + * If the update fails for a reason not listed above, the result member of \p resultInfo will be set + * to CU_GRAPH_EXEC_UPDATE_ERROR. If the update succeeds, the result member will be set to CU_GRAPH_EXEC_UPDATE_SUCCESS. + * + * cuGraphExecUpdate returns CUDA_SUCCESS when the updated was performed successfully. It returns + * CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE if the graph update was not performed because it included + * changes which violated constraints specific to instantiated graph update. + * + * \param hGraphExec The instantiated graph to be updated + * \param hGraph The graph containing the updated parameters + * \param resultInfo the error info structure + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE, + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecUpdate(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo *resultInfo); + +/** + * \brief Copies attributes from source node to destination node. + * + * Copies attributes from source node \p src to destination node \p dst. + * Both node must have the same context. + * + * \param[out] dst Destination node + * \param[in] src Source node + * For list of attributes see ::CUkernelNodeAttrID + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa + * ::CUaccessPolicyWindow + */ +CUresult CUDAAPI cuGraphKernelNodeCopyAttributes(CUgraphNode dst, CUgraphNode src); + +/** + * \brief Queries node attribute. + * + * Queries attribute \p attr from node \p hNode and stores it in corresponding + * member of \p value_out. + * + * \param[in] hNode + * \param[in] attr + * \param[out] value_out + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa + * ::CUaccessPolicyWindow + */ +CUresult CUDAAPI cuGraphKernelNodeGetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, + CUkernelNodeAttrValue *value_out); + +/** + * \brief Sets node attribute. + * + * Sets attribute \p attr on node \p hNode from corresponding attribute of + * \p value. + * + * \param[out] hNode + * \param[in] attr + * \param[out] value + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa + * ::CUaccessPolicyWindow + */ +CUresult CUDAAPI cuGraphKernelNodeSetAttribute(CUgraphNode hNode, CUkernelNodeAttrID attr, + const CUkernelNodeAttrValue *value); + +/** + * \brief Write a DOT file describing graph structure + * + * Using the provided \p hGraph, write to \p path a DOT formatted description of the graph. + * By default this includes the graph topology, node types, node id, kernel names and memcpy direction. + * \p flags can be specified to write more detailed information about each node type such as + * parameter values, kernel attributes, node and function handles. + * + * \param hGraph - The graph to create a DOT file from + * \param path - The path to write the DOT file to + * \param flags - Flags from CUgraphDebugDot_flags for specifying which additional node information to write + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OPERATING_SYSTEM + */ +CUresult CUDAAPI cuGraphDebugDotPrint(CUgraph hGraph, const char *path, unsigned int flags); + +/** + * \brief Create a user object + * + * Create a user object with the specified destructor callback and initial reference count. The + * initial references are owned by the caller. + * + * Destructor callbacks cannot make CUDA API calls and should avoid blocking behavior, as they + * are executed by a shared internal thread. Another thread may be signaled to perform such + * actions, if it does not block forward progress of tasks scheduled through CUDA. + * + * See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. + * + * \param object_out - Location to return the user object handle + * \param ptr - The pointer to pass to the destroy function + * \param destroy - Callback to free the user object when it is no longer in use + * \param initialRefcount - The initial refcount to create the object with, typically 1. The + * initial references are owned by the calling thread. + * \param flags - Currently it is required to pass ::CU_USER_OBJECT_NO_DESTRUCTOR_SYNC, + * which is the only defined flag. This indicates that the destroy + * callback cannot be waited on by any CUDA API. Users requiring + * synchronization of the callback should signal its completion + * manually. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuUserObjectRetain, + * ::cuUserObjectRelease, + * ::cuGraphRetainUserObject, + * ::cuGraphReleaseUserObject, + * ::cuGraphCreate + */ +CUresult CUDAAPI cuUserObjectCreate(CUuserObject *object_out, void *ptr, CUhostFn destroy, + unsigned int initialRefcount, unsigned int flags); + +/** + * \brief Retain a reference to a user object + * + * Retains new references to a user object. The new references are owned by the caller. + * + * See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. + * + * \param object - The object to retain + * \param count - The number of references to retain, typically 1. Must be nonzero + * and not larger than INT_MAX. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuUserObjectCreate, + * ::cuUserObjectRelease, + * ::cuGraphRetainUserObject, + * ::cuGraphReleaseUserObject, + * ::cuGraphCreate + */ +CUresult CUDAAPI cuUserObjectRetain(CUuserObject object, unsigned int count); + +/** + * \brief Release a reference to a user object + * + * Releases user object references owned by the caller. The object's destructor is invoked if + * the reference count reaches zero. + * + * It is undefined behavior to release references not owned by the caller, or to use a user + * object handle after all references are released. + * + * See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. + * + * \param object - The object to release + * \param count - The number of references to release, typically 1. Must be nonzero + * and not larger than INT_MAX. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuUserObjectCreate, + * ::cuUserObjectRetain, + * ::cuGraphRetainUserObject, + * ::cuGraphReleaseUserObject, + * ::cuGraphCreate + */ +CUresult CUDAAPI cuUserObjectRelease(CUuserObject object, unsigned int count); + +/** + * \brief Retain a reference to a user object from a graph + * + * Creates or moves user object references that will be owned by a CUDA graph. + * + * See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. + * + * \param graph - The graph to associate the reference with + * \param object - The user object to retain a reference for + * \param count - The number of references to add to the graph, typically 1. Must be + * nonzero and not larger than INT_MAX. + * \param flags - The optional flag ::CU_GRAPH_USER_OBJECT_MOVE transfers references + * from the calling thread, rather than create new references. Pass 0 + * to create new references. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuUserObjectCreate, + * ::cuUserObjectRetain, + * ::cuUserObjectRelease, + * ::cuGraphReleaseUserObject, + * ::cuGraphCreate + */ +CUresult CUDAAPI cuGraphRetainUserObject(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags); + +/** + * \brief Release a user object reference from a graph + * + * Releases user object references owned by a graph. + * + * See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. + * + * \param graph - The graph that will release the reference + * \param object - The user object to release a reference for + * \param count - The number of references to release, typically 1. Must be nonzero + * and not larger than INT_MAX. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuUserObjectCreate, + * ::cuUserObjectRetain, + * ::cuUserObjectRelease, + * ::cuGraphRetainUserObject, + * ::cuGraphCreate + */ +CUresult CUDAAPI cuGraphReleaseUserObject(CUgraph graph, CUuserObject object, unsigned int count); + +/** + * \brief Adds a node of arbitrary type to a graph + * + * Creates a new node in \p hGraph described by \p nodeParams with \p numDependencies + * dependencies specified via \p dependencies. \p numDependencies may be 0. + * \p dependencies may be null if \p numDependencies is 0. \p dependencies may not have + * any duplicate entries. + * + * \p nodeParams is a tagged union. The node type should be specified in the \p type field, + * and type-specific parameters in the corresponding union member. All unused bytes - that + * is, \p reserved0 and all bytes past the utilized union member - must be set to zero. + * It is recommended to use brace initialization or memset to ensure all bytes are + * initialized. + * + * Note that for some node types, \p nodeParams may contain "out parameters" which are + * modified during the call, such as \p nodeParams->alloc.dptr. + * + * A handle to the new node will be returned in \p phGraphNode. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Specification of the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_NOT_SUPPORTED + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphCreate, + * ::cuGraphNodeSetParams, + * ::cuGraphExecNodeSetParams + */ +CUresult CUDAAPI cuGraphAddNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUgraphNodeParams *nodeParams); + +/** + * \brief Adds a node of arbitrary type to a graph (12.3+) + * + * Creates a new node in \p hGraph described by \p nodeParams with \p numDependencies + * dependencies specified via \p dependencies. \p numDependencies may be 0. + * \p dependencies may be null if \p numDependencies is 0. \p dependencies may not have + * any duplicate entries. + * + * \p nodeParams is a tagged union. The node type should be specified in the \p type field, + * and type-specific parameters in the corresponding union member. All unused bytes - that + * is, \p reserved0 and all bytes past the utilized union member - must be set to zero. + * It is recommended to use brace initialization or memset to ensure all bytes are + * initialized. + * + * Note that for some node types, \p nodeParams may contain "out parameters" which are + * modified during the call, such as \p nodeParams->alloc.dptr. + * + * A handle to the new node will be returned in \p phGraphNode. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param dependencyData - Optional edge data for the dependencies. If NULL, the data is + * assumed to be default (zeroed) for all dependencies. + * \param numDependencies - Number of dependencies + * \param nodeParams - Specification of the node + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_NOT_SUPPORTED + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphCreate, + * ::cuGraphNodeSetParams, + * ::cuGraphExecNodeSetParams + */ +CUresult CUDAAPI cuGraphAddNode_v2(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, CUgraphNodeParams *nodeParams); + +/** + * \brief Update's a graph node's parameters + * + * Sets the parameters of graph node \p hNode to \p nodeParams. The node type specified by + * \p nodeParams->type must match the type of \p hNode. \p nodeParams must be fully + * initialized and all unused bytes (reserved, padding) zeroed. + * + * Modifying parameters is not supported for node types CU_GRAPH_NODE_TYPE_MEM_ALLOC and + * CU_GRAPH_NODE_TYPE_MEM_FREE. + * + * \param hNode - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuGraphExecNodeSetParams + */ +CUresult CUDAAPI cuGraphNodeSetParams(CUgraphNode hNode, CUgraphNodeParams *nodeParams); + +/** + * \brief Update's a graph node's parameters in an instantiated graph + * + * Sets the parameters of a node in an executable graph \p hGraphExec. The node is identified + * by the corresponding node \p hNode in the non-executable graph from which the executable + * graph was instantiated. \p hNode must not have been removed from the original graph. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * Allowed changes to parameters on executable graphs are as follows: + * + *
Node typeAllowed changes + *
kernelSee ::cuGraphExecKernelNodeSetParams + *
memcpyAddresses for 1-dimensional copies if allocated in same context; see ::cuGraphExecMemcpyNodeSetParams + *
memsetAddresses for 1-dimensional memsets if allocated in same context; see ::cuGraphExecMemsetNodeSetParams + *
hostUnrestricted + *
child graphTopology must match and restrictions apply recursively; see ::cuGraphExecUpdate + *
event waitUnrestricted + *
event recordUnrestricted + *
external semaphore signalNumber of semaphore operations cannot change + *
external semaphore waitNumber of semaphore operations cannot change + *
memory allocationAPI unsupported + *
memory freeAPI unsupported + *
batch memopsAddresses, values, and operation type for wait operations; see ::cuGraphExecBatchMemOpNodeSetParams + *
+ * + * \param hGraphExec - The executable graph in which to update the specified node + * \param hNode - Corresponding node from the graph from which graphExec was instantiated + * \param nodeParams - Updated Parameters to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + * ::cuGraphNodeSetParams + * ::cuGraphExecUpdate, + * ::cuGraphInstantiate + */ +CUresult CUDAAPI cuGraphExecNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams *nodeParams); + +/** + * \brief Create a conditional handle + * + * Creates a conditional handle associated with \p hGraph. + * + * The conditional handle must be associated with a conditional node in this graph or one of its children. + * + * Handles not associated with a conditional node may cause graph instantiation to fail. + * + * Handles can only be set from the context with which they are associated. + * + * \param pHandle_out - Pointer used to return the handle to the caller. + * \param hGraph - Graph which will contain the conditional node using this handle. + * \param ctx - Context for the handle and associated conditional node. + * \param defaultLaunchValue - Optional initial value for the conditional variable. + * \param flags - Currently must be CU_GRAPH_COND_ASSIGN_DEFAULT or 0. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode + */ +CUresult CUDAAPI cuGraphConditionalHandleCreate(CUgraphConditionalHandle *pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags); + +/** @} */ /* END CUDA_GRAPH */ + +/** + * \defgroup CUDA_OCCUPANCY Occupancy + * + * ___MANBRIEF___ occupancy calculation functions of the low-level CUDA driver + * API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the occupancy calculation functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Returns occupancy of a function + * + * Returns in \p *numBlocks the number of the maximum active blocks per + * streaming multiprocessor. + * + * \param numBlocks - Returned occupancy + * \param func - Kernel for which occupancy is calculated + * \param blockSize - Block size the kernel is intended to be launched with + * \param dynamicSMemSize - Per-block dynamic shared memory usage intended, in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cudaOccupancyMaxActiveBlocksPerMultiprocessor + */ +CUresult CUDAAPI cuOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize); + +/** + * \brief Returns occupancy of a function + * + * Returns in \p *numBlocks the number of the maximum active blocks per + * streaming multiprocessor. + * + * The \p Flags parameter controls how special cases are handled. The + * valid flags are: + * + * - ::CU_OCCUPANCY_DEFAULT, which maintains the default behavior as + * ::cuOccupancyMaxActiveBlocksPerMultiprocessor; + * + * - ::CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE, which suppresses the + * default behavior on platform where global caching affects + * occupancy. On such platforms, if caching is enabled, but + * per-block SM resource usage would result in zero occupancy, the + * occupancy calculator will calculate the occupancy as if caching + * is disabled. Setting ::CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE makes + * the occupancy calculator to return 0 in such cases. More information + * can be found about this feature in the "Unified L1/Texture Cache" + * section of the Maxwell tuning guide. + * + * \param numBlocks - Returned occupancy + * \param func - Kernel for which occupancy is calculated + * \param blockSize - Block size the kernel is intended to be launched with + * \param dynamicSMemSize - Per-block dynamic shared memory usage intended, in bytes + * \param flags - Requested behavior for the occupancy calculator + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + */ +CUresult CUDAAPI cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags); + +/** + * \brief Suggest a launch configuration with reasonable occupancy + * + * Returns in \p *blockSize a reasonable block size that can achieve + * the maximum occupancy (or, the maximum number of active warps with + * the fewest blocks per multiprocessor), and in \p *minGridSize the + * minimum grid size to achieve the maximum occupancy. + * + * If \p blockSizeLimit is 0, the configurator will use the maximum + * block size permitted by the device / function instead. + * + * If per-block dynamic shared memory allocation is not needed, the + * user should leave both \p blockSizeToDynamicSMemSize and \p + * dynamicSMemSize as 0. + * + * If per-block dynamic shared memory allocation is needed, then if + * the dynamic shared memory size is constant regardless of block + * size, the size should be passed through \p dynamicSMemSize, and \p + * blockSizeToDynamicSMemSize should be NULL. + * + * Otherwise, if the per-block dynamic shared memory size varies with + * different block sizes, the user needs to provide a unary function + * through \p blockSizeToDynamicSMemSize that computes the dynamic + * shared memory needed by \p func for any given block size. \p + * dynamicSMemSize is ignored. An example signature is: + * + * \code + * // Take block size, returns dynamic shared memory needed + * size_t blockToSmem(int blockSize); + * \endcode + * + * \param minGridSize - Returned minimum grid size needed to achieve the maximum occupancy + * \param blockSize - Returned maximum block size that can achieve the maximum occupancy + * \param func - Kernel for which launch configuration is calculated + * \param blockSizeToDynamicSMemSize - A function that calculates how much per-block dynamic shared memory \p func uses based on the block size + * \param dynamicSMemSize - Dynamic shared memory usage intended, in bytes + * \param blockSizeLimit - The maximum block size \p func is designed to handle + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cudaOccupancyMaxPotentialBlockSize + */ +CUresult CUDAAPI cuOccupancyMaxPotentialBlockSize(int *minGridSize, int *blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit); + +/** + * \brief Suggest a launch configuration with reasonable occupancy + * + * An extended version of ::cuOccupancyMaxPotentialBlockSize. In + * addition to arguments passed to ::cuOccupancyMaxPotentialBlockSize, + * ::cuOccupancyMaxPotentialBlockSizeWithFlags also takes a \p Flags + * parameter. + * + * The \p Flags parameter controls how special cases are handled. The + * valid flags are: + * + * - ::CU_OCCUPANCY_DEFAULT, which maintains the default behavior as + * ::cuOccupancyMaxPotentialBlockSize; + * + * - ::CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE, which suppresses the + * default behavior on platform where global caching affects + * occupancy. On such platforms, the launch configurations that + * produces maximal occupancy might not support global + * caching. Setting ::CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE + * guarantees that the the produced launch configuration is global + * caching compatible at a potential cost of occupancy. More information + * can be found about this feature in the "Unified L1/Texture Cache" + * section of the Maxwell tuning guide. + * + * \param minGridSize - Returned minimum grid size needed to achieve the maximum occupancy + * \param blockSize - Returned maximum block size that can achieve the maximum occupancy + * \param func - Kernel for which launch configuration is calculated + * \param blockSizeToDynamicSMemSize - A function that calculates how much per-block dynamic shared memory \p func uses based on the block size + * \param dynamicSMemSize - Dynamic shared memory usage intended, in bytes + * \param blockSizeLimit - The maximum block size \p func is designed to handle + * \param flags - Options + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cudaOccupancyMaxPotentialBlockSizeWithFlags + */ +CUresult CUDAAPI cuOccupancyMaxPotentialBlockSizeWithFlags(int *minGridSize, int *blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags); + +/** + * \brief Returns dynamic shared memory available per block when launching \p numBlocks blocks on SM + * + * Returns in \p *dynamicSmemSize the maximum size of dynamic shared memory to allow \p numBlocks blocks per SM. + * + * \param dynamicSmemSize - Returned maximum dynamic shared memory + * \param func - Kernel function for which occupancy is calculated + * \param numBlocks - Number of blocks to fit on SM + * \param blockSize - Size of the blocks + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + */ +CUresult CUDAAPI cuOccupancyAvailableDynamicSMemPerBlock(size_t *dynamicSmemSize, CUfunction func, int numBlocks, int blockSize); + +/** + * \brief Given the kernel function (\p func) and launch configuration + * (\p config), return the maximum cluster size in \p *clusterSize. + * + * The cluster dimensions in \p config are ignored. If func has a required + * cluster size set (see ::cudaFuncGetAttributes / ::cuFuncGetAttribute),\p + * *clusterSize will reflect the required cluster size. + * + * By default this function will always return a value that's portable on + * future hardware. A higher value may be returned if the kernel function + * allows non-portable cluster sizes. + * + * This function will respect the compile time launch bounds. + * + * \param clusterSize - Returned maximum cluster size that can be launched + * for the given kernel function and launch configuration + * \param func - Kernel function for which maximum cluster + * size is calculated + * \param config - Launch configuration for the given kernel function + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cudaFuncGetAttributes, + * ::cuFuncGetAttribute + */ +CUresult CUDAAPI cuOccupancyMaxPotentialClusterSize(int *clusterSize, CUfunction func, const CUlaunchConfig *config); + +/** + * \brief Given the kernel function (\p func) and launch configuration + * (\p config), return the maximum number of clusters that could co-exist + * on the target device in \p *numClusters. + * + * If the function has required cluster size already set (see + * ::cudaFuncGetAttributes / ::cuFuncGetAttribute), the cluster size + * from config must either be unspecified or match the required size. + * Without required sizes, the cluster size must be specified in config, + * else the function will return an error. + * + * Note that various attributes of the kernel function may affect occupancy + * calculation. Runtime environment may affect how the hardware schedules + * the clusters, so the calculated occupancy is not guaranteed to be achievable. + * + * \param numClusters - Returned maximum number of clusters that + * could co-exist on the target device + * \param func - Kernel function for which maximum number + * of clusters are calculated + * \param config - Launch configuration for the given kernel function + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_CLUSTER_SIZE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cudaFuncGetAttributes, + * ::cuFuncGetAttribute + */ +CUresult CUDAAPI cuOccupancyMaxActiveClusters(int *numClusters, CUfunction func, const CUlaunchConfig *config); +/** @} */ /* END CUDA_OCCUPANCY */ + +/** + * \defgroup CUDA_TEXREF_DEPRECATED Texture Reference Management [DEPRECATED] + * + * ___MANBRIEF___ deprecated texture reference management functions of the + * low-level CUDA driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the deprecated texture reference management + * functions of the low-level CUDA driver application programming interface. + * + * @{ + */ + +/** + * \brief Binds an array as a texture reference + * + * \deprecated + * + * Binds the CUDA array \p hArray to the texture reference \p hTexRef. Any + * previous address or CUDA array state associated with the texture reference + * is superseded by this function. \p Flags must be set to + * ::CU_TRSA_OVERRIDE_FORMAT. Any CUDA array previously bound to \p hTexRef is + * unbound. + * + * \param hTexRef - Texture reference to bind + * \param hArray - Array to bind + * \param Flags - Options (must be ::CU_TRSA_OVERRIDE_FORMAT) + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags); + +/** + * \brief Binds a mipmapped array to a texture reference + * + * \deprecated + * + * Binds the CUDA mipmapped array \p hMipmappedArray to the texture reference \p hTexRef. + * Any previous address or CUDA array state associated with the texture reference + * is superseded by this function. \p Flags must be set to ::CU_TRSA_OVERRIDE_FORMAT. + * Any CUDA array previously bound to \p hTexRef is unbound. + * + * \param hTexRef - Texture reference to bind + * \param hMipmappedArray - Mipmapped array to bind + * \param Flags - Options (must be ::CU_TRSA_OVERRIDE_FORMAT) + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags); + +/** + * \brief Binds an address as a texture reference + * + * \deprecated + * + * Binds a linear address range to the texture reference \p hTexRef. Any + * previous address or CUDA array state associated with the texture reference + * is superseded by this function. Any memory previously bound to \p hTexRef + * is unbound. + * + * Since the hardware enforces an alignment requirement on texture base + * addresses, ::cuTexRefSetAddress() passes back a byte offset in + * \p *ByteOffset that must be applied to texture fetches in order to read from + * the desired memory. This offset must be divided by the texel size and + * passed to kernels that read from the texture so they can be applied to the + * ::tex1Dfetch() function. + * + * If the device memory pointer was returned from ::cuMemAlloc(), the offset + * is guaranteed to be 0 and NULL may be passed as the \p ByteOffset parameter. + * + * The total number of elements (or texels) in the linear address range + * cannot exceed ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH. + * The number of elements is computed as (\p bytes / bytesPerElement), + * where bytesPerElement is determined from the data format and number of + * components set using ::cuTexRefSetFormat(). + * + * \param ByteOffset - Returned byte offset + * \param hTexRef - Texture reference to bind + * \param dptr - Device pointer to bind + * \param bytes - Size of memory to bind in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetAddress(size_t *ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes); + +/** + * \brief Binds an address as a 2D texture reference + * + * \deprecated + * + * Binds a linear address range to the texture reference \p hTexRef. Any + * previous address or CUDA array state associated with the texture reference + * is superseded by this function. Any memory previously bound to \p hTexRef + * is unbound. + * + * Using a ::tex2D() function inside a kernel requires a call to either + * ::cuTexRefSetArray() to bind the corresponding texture reference to an + * array, or ::cuTexRefSetAddress2D() to bind the texture reference to linear + * memory. + * + * Function calls to ::cuTexRefSetFormat() cannot follow calls to + * ::cuTexRefSetAddress2D() for the same texture reference. + * + * It is required that \p dptr be aligned to the appropriate hardware-specific + * texture alignment. You can query this value using the device attribute + * ::CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT. If an unaligned \p dptr is + * supplied, ::CUDA_ERROR_INVALID_VALUE is returned. + * + * \p Pitch has to be aligned to the hardware-specific texture pitch alignment. + * This value can be queried using the device attribute + * ::CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT. If an unaligned \p Pitch is + * supplied, ::CUDA_ERROR_INVALID_VALUE is returned. + * + * Width and Height, which are specified in elements (or texels), cannot exceed + * ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH and + * ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT respectively. + * \p Pitch, which is specified in bytes, cannot exceed + * ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH. + * + * \param hTexRef - Texture reference to bind + * \param desc - Descriptor of CUDA array + * \param dptr - Device pointer to bind + * \param Pitch - Line pitch in bytes + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetAddress2D(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR *desc, CUdeviceptr dptr, size_t Pitch); + +/** + * \brief Sets the format for a texture reference + * + * \deprecated + * + * Specifies the format of the data to be read by the texture reference + * \p hTexRef. \p fmt and \p NumPackedComponents are exactly analogous to the + * ::Format and ::NumChannels members of the ::CUDA_ARRAY_DESCRIPTOR structure: + * They specify the format of each component and the number of components per + * array element. + * + * \param hTexRef - Texture reference + * \param fmt - Format to set + * \param NumPackedComponents - Number of components per array element + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat, + * ::cudaCreateChannelDesc + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents); + +/** + * \brief Sets the addressing mode for a texture reference + * + * \deprecated + * + * Specifies the addressing mode \p am for the given dimension \p dim of the + * texture reference \p hTexRef. If \p dim is zero, the addressing mode is + * applied to the first parameter of the functions used to fetch from the + * texture; if \p dim is 1, the second, and so on. ::CUaddress_mode is defined + * as: + * \code + typedef enum CUaddress_mode_enum { + CU_TR_ADDRESS_MODE_WRAP = 0, + CU_TR_ADDRESS_MODE_CLAMP = 1, + CU_TR_ADDRESS_MODE_MIRROR = 2, + CU_TR_ADDRESS_MODE_BORDER = 3 + } CUaddress_mode; + * \endcode + * + * Note that this call has no effect if \p hTexRef is bound to linear memory. + * Also, if the flag, ::CU_TRSF_NORMALIZED_COORDINATES, is not set, the only + * supported address mode is ::CU_TR_ADDRESS_MODE_CLAMP. + * + * \param hTexRef - Texture reference + * \param dim - Dimension + * \param am - Addressing mode to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am); + +/** + * \brief Sets the filtering mode for a texture reference + * + * \deprecated + * + * Specifies the filtering mode \p fm to be used when reading memory through + * the texture reference \p hTexRef. ::CUfilter_mode_enum is defined as: + * + * \code + typedef enum CUfilter_mode_enum { + CU_TR_FILTER_MODE_POINT = 0, + CU_TR_FILTER_MODE_LINEAR = 1 + } CUfilter_mode; + * \endcode + * + * Note that this call has no effect if \p hTexRef is bound to linear memory. + * + * \param hTexRef - Texture reference + * \param fm - Filtering mode to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm); + +/** + * \brief Sets the mipmap filtering mode for a texture reference + * + * \deprecated + * + * Specifies the mipmap filtering mode \p fm to be used when reading memory through + * the texture reference \p hTexRef. ::CUfilter_mode_enum is defined as: + * + * \code + typedef enum CUfilter_mode_enum { + CU_TR_FILTER_MODE_POINT = 0, + CU_TR_FILTER_MODE_LINEAR = 1 + } CUfilter_mode; + * \endcode + * + * Note that this call has no effect if \p hTexRef is not bound to a mipmapped array. + * + * \param hTexRef - Texture reference + * \param fm - Filtering mode to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm); + +/** + * \brief Sets the mipmap level bias for a texture reference + * + * \deprecated + * + * Specifies the mipmap level bias \p bias to be added to the specified mipmap level when + * reading memory through the texture reference \p hTexRef. + * + * Note that this call has no effect if \p hTexRef is not bound to a mipmapped array. + * + * \param hTexRef - Texture reference + * \param bias - Mipmap level bias + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias); + +/** + * \brief Sets the mipmap min/max mipmap level clamps for a texture reference + * + * \deprecated + * + * Specifies the min/max mipmap level clamps, \p minMipmapLevelClamp and \p maxMipmapLevelClamp + * respectively, to be used when reading memory through the texture reference + * \p hTexRef. + * + * Note that this call has no effect if \p hTexRef is not bound to a mipmapped array. + * + * \param hTexRef - Texture reference + * \param minMipmapLevelClamp - Mipmap min level clamp + * \param maxMipmapLevelClamp - Mipmap max level clamp + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp); + +/** + * \brief Sets the maximum anisotropy for a texture reference + * + * \deprecated + * + * Specifies the maximum anisotropy \p maxAniso to be used when reading memory through + * the texture reference \p hTexRef. + * + * Note that this call has no effect if \p hTexRef is bound to linear memory. + * + * \param hTexRef - Texture reference + * \param maxAniso - Maximum anisotropy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso); + +/** + * \brief Sets the border color for a texture reference + * + * \deprecated + * + * Specifies the value of the RGBA color via the \p pBorderColor to the texture reference + * \p hTexRef. The color value supports only float type and holds color components in + * the following sequence: + * pBorderColor[0] holds 'R' component + * pBorderColor[1] holds 'G' component + * pBorderColor[2] holds 'B' component + * pBorderColor[3] holds 'A' component + * + * Note that the color values can be set only when the Address mode is set to + * CU_TR_ADDRESS_MODE_BORDER using ::cuTexRefSetAddressMode. + * Applications using integer border color values have to "reinterpret_cast" their values to float. + * + * \param hTexRef - Texture reference + * \param pBorderColor - RGBA color + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddressMode, + * ::cuTexRefGetAddressMode, ::cuTexRefGetBorderColor + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetBorderColor(CUtexref hTexRef, float *pBorderColor); + +/** + * \brief Sets the flags for a texture reference + * + * \deprecated + * + * Specifies optional flags via \p Flags to specify the behavior of data + * returned through the texture reference \p hTexRef. The valid flags are: + * + * - ::CU_TRSF_READ_AS_INTEGER, which suppresses the default behavior of + * having the texture promote integer data to floating point data in the + * range [0, 1]. Note that texture with 32-bit integer format + * would not be promoted, regardless of whether or not this + * flag is specified; + * - ::CU_TRSF_NORMALIZED_COORDINATES, which suppresses the + * default behavior of having the texture coordinates range + * from [0, Dim) where Dim is the width or height of the CUDA + * array. Instead, the texture coordinates [0, 1.0) reference + * the entire breadth of the array dimension; + * - ::CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION, which disables any trilinear + * filtering optimizations. Trilinear optimizations improve texture filtering + * performance by allowing bilinear filtering on textures in scenarios where + * it can closely approximate the expected results. + * + * \param hTexRef - Texture reference + * \param Flags - Optional flags to set + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags); + +/** + * \brief Gets the address associated with a texture reference + * + * \deprecated + * + * Returns in \p *pdptr the base address bound to the texture reference + * \p hTexRef, or returns ::CUDA_ERROR_INVALID_VALUE if the texture reference + * is not bound to any device memory range. + * + * \param pdptr - Returned device address + * \param hTexRef - Texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetAddress(CUdeviceptr *pdptr, CUtexref hTexRef); + +/** + * \brief Gets the array bound to a texture reference + * + * \deprecated + * + * Returns in \p *phArray the CUDA array bound to the texture reference + * \p hTexRef, or returns ::CUDA_ERROR_INVALID_VALUE if the texture reference + * is not bound to any CUDA array. + * + * \param phArray - Returned array + * \param hTexRef - Texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetArray(CUarray *phArray, CUtexref hTexRef); + +/** + * \brief Gets the mipmapped array bound to a texture reference + * + * \deprecated + * + * Returns in \p *phMipmappedArray the CUDA mipmapped array bound to the texture + * reference \p hTexRef, or returns ::CUDA_ERROR_INVALID_VALUE if the texture reference + * is not bound to any CUDA mipmapped array. + * + * \param phMipmappedArray - Returned mipmapped array + * \param hTexRef - Texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetMipmappedArray(CUmipmappedArray *phMipmappedArray, CUtexref hTexRef); + +/** + * \brief Gets the addressing mode used by a texture reference + * + * \deprecated + * + * Returns in \p *pam the addressing mode corresponding to the + * dimension \p dim of the texture reference \p hTexRef. Currently, the only + * valid value for \p dim are 0 and 1. + * + * \param pam - Returned addressing mode + * \param hTexRef - Texture reference + * \param dim - Dimension + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetAddressMode(CUaddress_mode *pam, CUtexref hTexRef, int dim); + +/** + * \brief Gets the filter-mode used by a texture reference + * + * \deprecated + * + * Returns in \p *pfm the filtering mode of the texture reference + * \p hTexRef. + * + * \param pfm - Returned filtering mode + * \param hTexRef - Texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetFilterMode(CUfilter_mode *pfm, CUtexref hTexRef); + +/** + * \brief Gets the format used by a texture reference + * + * \deprecated + * + * Returns in \p *pFormat and \p *pNumChannels the format and number + * of components of the CUDA array bound to the texture reference \p hTexRef. + * If \p pFormat or \p pNumChannels is NULL, it will be ignored. + * + * \param pFormat - Returned format + * \param pNumChannels - Returned number of components + * \param hTexRef - Texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetFormat(CUarray_format *pFormat, int *pNumChannels, CUtexref hTexRef); + +/** + * \brief Gets the mipmap filtering mode for a texture reference + * + * \deprecated + * + * Returns the mipmap filtering mode in \p pfm that's used when reading memory through + * the texture reference \p hTexRef. + * + * \param pfm - Returned mipmap filtering mode + * \param hTexRef - Texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetMipmapFilterMode(CUfilter_mode *pfm, CUtexref hTexRef); + +/** + * \brief Gets the mipmap level bias for a texture reference + * + * \deprecated + * + * Returns the mipmap level bias in \p pBias that's added to the specified mipmap + * level when reading memory through the texture reference \p hTexRef. + * + * \param pbias - Returned mipmap level bias + * \param hTexRef - Texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetMipmapLevelBias(float *pbias, CUtexref hTexRef); + +/** + * \brief Gets the min/max mipmap level clamps for a texture reference + * + * \deprecated + * + * Returns the min/max mipmap level clamps in \p pminMipmapLevelClamp and \p pmaxMipmapLevelClamp + * that's used when reading memory through the texture reference \p hTexRef. + * + * \param pminMipmapLevelClamp - Returned mipmap min level clamp + * \param pmaxMipmapLevelClamp - Returned mipmap max level clamp + * \param hTexRef - Texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetMipmapLevelClamp(float *pminMipmapLevelClamp, float *pmaxMipmapLevelClamp, CUtexref hTexRef); + +/** + * \brief Gets the maximum anisotropy for a texture reference + * + * \deprecated + * + * Returns the maximum anisotropy in \p pmaxAniso that's used when reading memory through + * the texture reference \p hTexRef. + * + * \param pmaxAniso - Returned maximum anisotropy + * \param hTexRef - Texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFlags, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetMaxAnisotropy(int *pmaxAniso, CUtexref hTexRef); + +/** + * \brief Gets the border color used by a texture reference + * + * \deprecated + * + * Returns in \p pBorderColor, values of the RGBA color used by + * the texture reference \p hTexRef. + * The color value is of type float and holds color components in + * the following sequence: + * pBorderColor[0] holds 'R' component + * pBorderColor[1] holds 'G' component + * pBorderColor[2] holds 'B' component + * pBorderColor[3] holds 'A' component + * + * \param hTexRef - Texture reference + * \param pBorderColor - Returned Type and Value of RGBA color + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddressMode, + * ::cuTexRefSetAddressMode, ::cuTexRefSetBorderColor + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetBorderColor(float *pBorderColor, CUtexref hTexRef); + +/** + * \brief Gets the flags used by a texture reference + * + * \deprecated + * + * Returns in \p *pFlags the flags of the texture reference \p hTexRef. + * + * \param pFlags - Returned flags + * \param hTexRef - Texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefSetAddress, + * ::cuTexRefSetAddress2D, ::cuTexRefSetAddressMode, ::cuTexRefSetArray, + * ::cuTexRefSetFilterMode, ::cuTexRefSetFlags, ::cuTexRefSetFormat, + * ::cuTexRefGetAddress, ::cuTexRefGetAddressMode, ::cuTexRefGetArray, + * ::cuTexRefGetFilterMode, ::cuTexRefGetFormat + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefGetFlags(unsigned int *pFlags, CUtexref hTexRef); + +/** + * \brief Creates a texture reference + * + * \deprecated + * + * Creates a texture reference and returns its handle in \p *pTexRef. Once + * created, the application must call ::cuTexRefSetArray() or + * ::cuTexRefSetAddress() to associate the reference with allocated memory. + * Other texture reference functions are used to specify the format and + * interpretation (addressing, filtering, etc.) to be used when the memory is + * read through this texture reference. + * + * \param pTexRef - Returned texture reference + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefDestroy + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefCreate(CUtexref *pTexRef); + +/** + * \brief Destroys a texture reference + * + * \deprecated + * + * Destroys the texture reference specified by \p hTexRef. + * + * \param hTexRef - Texture reference to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuTexRefCreate + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuTexRefDestroy(CUtexref hTexRef); + +/** @} */ /* END CUDA_TEXREF_DEPRECATED */ + + +/** + * \defgroup CUDA_SURFREF_DEPRECATED Surface Reference Management [DEPRECATED] + * + * ___MANBRIEF___ surface reference management functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the surface reference management functions of the + * low-level CUDA driver application programming interface. + * + * @{ + */ + +/** + * \brief Sets the CUDA array for a surface reference. + * + * \deprecated + * + * Sets the CUDA array \p hArray to be read and written by the surface reference + * \p hSurfRef. Any previous CUDA array state associated with the surface + * reference is superseded by this function. \p Flags must be set to 0. + * The ::CUDA_ARRAY3D_SURFACE_LDST flag must have been set for the CUDA array. + * Any CUDA array previously bound to \p hSurfRef is unbound. + + * \param hSurfRef - Surface reference handle + * \param hArray - CUDA array handle + * \param Flags - set to 0 + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuModuleGetSurfRef, + * ::cuSurfRefGetArray + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags); + +/** + * \brief Passes back the CUDA array bound to a surface reference. + * + * \deprecated + * + * Returns in \p *phArray the CUDA array bound to the surface reference + * \p hSurfRef, or returns ::CUDA_ERROR_INVALID_VALUE if the surface reference + * is not bound to any CUDA array. + + * \param phArray - Surface reference handle + * \param hSurfRef - Surface reference handle + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa ::cuModuleGetSurfRef, ::cuSurfRefSetArray + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuSurfRefGetArray(CUarray *phArray, CUsurfref hSurfRef); + +/** @} */ /* END CUDA_SURFREF_DEPRECATED */ + +/** + * \defgroup CUDA_TEXOBJECT Texture Object Management + * + * ___MANBRIEF___ texture object management functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the texture object management functions of the + * low-level CUDA driver application programming interface. The texture + * object API is only supported on devices of compute capability 3.0 or higher. + * + * @{ + */ + +/** + * \brief Creates a texture object + * + * Creates a texture object and returns it in \p pTexObject. \p pResDesc describes + * the data to texture from. \p pTexDesc describes how the data should be sampled. + * \p pResViewDesc is an optional argument that specifies an alternate format for + * the data described by \p pResDesc, and also describes the subresource region + * to restrict access to when texturing. \p pResViewDesc can only be specified if + * the type of resource is a CUDA array or a CUDA mipmapped array. + * + * Texture objects are only supported on devices of compute capability 3.0 or higher. + * Additionally, a texture object is an opaque value, and, as such, should only be + * accessed through CUDA API calls. + * + * The ::CUDA_RESOURCE_DESC structure is defined as: + * \code + typedef struct CUDA_RESOURCE_DESC_st + { + CUresourcetype resType; + + union { + struct { + CUarray hArray; + } array; + struct { + CUmipmappedArray hMipmappedArray; + } mipmap; + struct { + CUdeviceptr devPtr; + CUarray_format format; + unsigned int numChannels; + size_t sizeInBytes; + } linear; + struct { + CUdeviceptr devPtr; + CUarray_format format; + unsigned int numChannels; + size_t width; + size_t height; + size_t pitchInBytes; + } pitch2D; + } res; + + unsigned int flags; + } CUDA_RESOURCE_DESC; + + * \endcode + * where: + * - ::CUDA_RESOURCE_DESC::resType specifies the type of resource to texture from. + * CUresourceType is defined as: + * \code + typedef enum CUresourcetype_enum { + CU_RESOURCE_TYPE_ARRAY = 0x00, + CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01, + CU_RESOURCE_TYPE_LINEAR = 0x02, + CU_RESOURCE_TYPE_PITCH2D = 0x03 + } CUresourcetype; + * \endcode + * + * \par + * If ::CUDA_RESOURCE_DESC::resType is set to ::CU_RESOURCE_TYPE_ARRAY, ::CUDA_RESOURCE_DESC::res::array::hArray + * must be set to a valid CUDA array handle. + * + * \par + * If ::CUDA_RESOURCE_DESC::resType is set to ::CU_RESOURCE_TYPE_MIPMAPPED_ARRAY, ::CUDA_RESOURCE_DESC::res::mipmap::hMipmappedArray + * must be set to a valid CUDA mipmapped array handle. + * + * \par + * If ::CUDA_RESOURCE_DESC::resType is set to ::CU_RESOURCE_TYPE_LINEAR, ::CUDA_RESOURCE_DESC::res::linear::devPtr + * must be set to a valid device pointer, that is aligned to ::CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT. + * ::CUDA_RESOURCE_DESC::res::linear::format and ::CUDA_RESOURCE_DESC::res::linear::numChannels + * describe the format of each component and the number of components per array element. ::CUDA_RESOURCE_DESC::res::linear::sizeInBytes + * specifies the size of the array in bytes. The total number of elements in the linear address range cannot exceed + * ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH. The number of elements is computed as (sizeInBytes / (sizeof(format) * numChannels)). + * + * \par + * If ::CUDA_RESOURCE_DESC::resType is set to ::CU_RESOURCE_TYPE_PITCH2D, ::CUDA_RESOURCE_DESC::res::pitch2D::devPtr + * must be set to a valid device pointer, that is aligned to ::CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT. + * ::CUDA_RESOURCE_DESC::res::pitch2D::format and ::CUDA_RESOURCE_DESC::res::pitch2D::numChannels + * describe the format of each component and the number of components per array element. ::CUDA_RESOURCE_DESC::res::pitch2D::width + * and ::CUDA_RESOURCE_DESC::res::pitch2D::height specify the width and height of the array in elements, and cannot exceed + * ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH and ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT respectively. + * ::CUDA_RESOURCE_DESC::res::pitch2D::pitchInBytes specifies the pitch between two rows in bytes and has to be aligned to + * ::CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT. Pitch cannot exceed ::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH. + * + * - ::flags must be set to zero. + * + * + * The ::CUDA_TEXTURE_DESC struct is defined as + * \code + typedef struct CUDA_TEXTURE_DESC_st { + CUaddress_mode addressMode[3]; + CUfilter_mode filterMode; + unsigned int flags; + unsigned int maxAnisotropy; + CUfilter_mode mipmapFilterMode; + float mipmapLevelBias; + float minMipmapLevelClamp; + float maxMipmapLevelClamp; + } CUDA_TEXTURE_DESC; + * \endcode + * where + * - ::CUDA_TEXTURE_DESC::addressMode specifies the addressing mode for each dimension of the texture data. ::CUaddress_mode is defined as: + * \code + typedef enum CUaddress_mode_enum { + CU_TR_ADDRESS_MODE_WRAP = 0, + CU_TR_ADDRESS_MODE_CLAMP = 1, + CU_TR_ADDRESS_MODE_MIRROR = 2, + CU_TR_ADDRESS_MODE_BORDER = 3 + } CUaddress_mode; + * \endcode + * This is ignored if ::CUDA_RESOURCE_DESC::resType is ::CU_RESOURCE_TYPE_LINEAR. Also, if the flag, ::CU_TRSF_NORMALIZED_COORDINATES + * is not set, the only supported address mode is ::CU_TR_ADDRESS_MODE_CLAMP. + * + * - ::CUDA_TEXTURE_DESC::filterMode specifies the filtering mode to be used when fetching from the texture. CUfilter_mode is defined as: + * \code + typedef enum CUfilter_mode_enum { + CU_TR_FILTER_MODE_POINT = 0, + CU_TR_FILTER_MODE_LINEAR = 1 + } CUfilter_mode; + * \endcode + * This is ignored if ::CUDA_RESOURCE_DESC::resType is ::CU_RESOURCE_TYPE_LINEAR. + * + * - ::CUDA_TEXTURE_DESC::flags can be any combination of the following: + * - ::CU_TRSF_READ_AS_INTEGER, which suppresses the default behavior of + * having the texture promote integer data to floating point data in the + * range [0, 1]. Note that texture with 32-bit integer format would not be + * promoted, regardless of whether or not this flag is specified. + * - ::CU_TRSF_NORMALIZED_COORDINATES, which suppresses the default behavior + * of having the texture coordinates range from [0, Dim) where Dim is the + * width or height of the CUDA array. Instead, the texture coordinates + * [0, 1.0) reference the entire breadth of the array dimension; Note that + * for CUDA mipmapped arrays, this flag has to be set. + * - ::CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION, which disables any trilinear + * filtering optimizations. Trilinear optimizations improve texture filtering + * performance by allowing bilinear filtering on textures in scenarios where + * it can closely approximate the expected results. + * - ::CU_TRSF_SEAMLESS_CUBEMAP, which enables seamless cube map filtering. + * This flag can only be specified if the underlying resource is a CUDA array + * or a CUDA mipmapped array that was created with the flag ::CUDA_ARRAY3D_CUBEMAP. + * When seamless cube map filtering is enabled, texture address modes specified + * by ::CUDA_TEXTURE_DESC::addressMode are ignored. Instead, if the ::CUDA_TEXTURE_DESC::filterMode + * is set to ::CU_TR_FILTER_MODE_POINT the address mode ::CU_TR_ADDRESS_MODE_CLAMP + * will be applied for all dimensions. If the ::CUDA_TEXTURE_DESC::filterMode is + * set to ::CU_TR_FILTER_MODE_LINEAR seamless cube map filtering will be performed + * when sampling along the cube face borders. + * + * - ::CUDA_TEXTURE_DESC::maxAnisotropy specifies the maximum anisotropy ratio to be used when doing anisotropic filtering. This value will be + * clamped to the range [1,16]. + * + * - ::CUDA_TEXTURE_DESC::mipmapFilterMode specifies the filter mode when the calculated mipmap level lies between two defined mipmap levels. + * + * - ::CUDA_TEXTURE_DESC::mipmapLevelBias specifies the offset to be applied to the calculated mipmap level. + * + * - ::CUDA_TEXTURE_DESC::minMipmapLevelClamp specifies the lower end of the mipmap level range to clamp access to. + * + * - ::CUDA_TEXTURE_DESC::maxMipmapLevelClamp specifies the upper end of the mipmap level range to clamp access to. + * + * + * The ::CUDA_RESOURCE_VIEW_DESC struct is defined as + * \code + typedef struct CUDA_RESOURCE_VIEW_DESC_st + { + CUresourceViewFormat format; + size_t width; + size_t height; + size_t depth; + unsigned int firstMipmapLevel; + unsigned int lastMipmapLevel; + unsigned int firstLayer; + unsigned int lastLayer; + } CUDA_RESOURCE_VIEW_DESC; + * \endcode + * where: + * - ::CUDA_RESOURCE_VIEW_DESC::format specifies how the data contained in the CUDA array or CUDA mipmapped array should + * be interpreted. Note that this can incur a change in size of the texture data. If the resource view format is a block + * compressed format, then the underlying CUDA array or CUDA mipmapped array has to have a base of format ::CU_AD_FORMAT_UNSIGNED_INT32. + * with 2 or 4 channels, depending on the block compressed format. For ex., BC1 and BC4 require the underlying CUDA array to have + * a format of ::CU_AD_FORMAT_UNSIGNED_INT32 with 2 channels. The other BC formats require the underlying resource to have the same base + * format but with 4 channels. + * + * - ::CUDA_RESOURCE_VIEW_DESC::width specifies the new width of the texture data. If the resource view format is a block + * compressed format, this value has to be 4 times the original width of the resource. For non block compressed formats, + * this value has to be equal to that of the original resource. + * + * - ::CUDA_RESOURCE_VIEW_DESC::height specifies the new height of the texture data. If the resource view format is a block + * compressed format, this value has to be 4 times the original height of the resource. For non block compressed formats, + * this value has to be equal to that of the original resource. + * + * - ::CUDA_RESOURCE_VIEW_DESC::depth specifies the new depth of the texture data. This value has to be equal to that of the + * original resource. + * + * - ::CUDA_RESOURCE_VIEW_DESC::firstMipmapLevel specifies the most detailed mipmap level. This will be the new mipmap level zero. + * For non-mipmapped resources, this value has to be zero.::CUDA_TEXTURE_DESC::minMipmapLevelClamp and ::CUDA_TEXTURE_DESC::maxMipmapLevelClamp + * will be relative to this value. For ex., if the firstMipmapLevel is set to 2, and a minMipmapLevelClamp of 1.2 is specified, + * then the actual minimum mipmap level clamp will be 3.2. + * + * - ::CUDA_RESOURCE_VIEW_DESC::lastMipmapLevel specifies the least detailed mipmap level. For non-mipmapped resources, this value + * has to be zero. + * + * - ::CUDA_RESOURCE_VIEW_DESC::firstLayer specifies the first layer index for layered textures. This will be the new layer zero. + * For non-layered resources, this value has to be zero. + * + * - ::CUDA_RESOURCE_VIEW_DESC::lastLayer specifies the last layer index for layered textures. For non-layered resources, + * this value has to be zero. + * + * + * \param pTexObject - Texture object to create + * \param pResDesc - Resource descriptor + * \param pTexDesc - Texture descriptor + * \param pResViewDesc - Resource view descriptor + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexObjectDestroy, + * ::cudaCreateTextureObject + */ +CUresult CUDAAPI cuTexObjectCreate(CUtexObject *pTexObject, const CUDA_RESOURCE_DESC *pResDesc, const CUDA_TEXTURE_DESC *pTexDesc, const CUDA_RESOURCE_VIEW_DESC *pResViewDesc); + +/** + * \brief Destroys a texture object + * + * Destroys the texture object specified by \p texObject. + * + * \param texObject - Texture object to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexObjectCreate, + * ::cudaDestroyTextureObject + */ +CUresult CUDAAPI cuTexObjectDestroy(CUtexObject texObject); + +/** + * \brief Returns a texture object's resource descriptor + * + * Returns the resource descriptor for the texture object specified by \p texObject. + * + * \param pResDesc - Resource descriptor + * \param texObject - Texture object + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexObjectCreate, + * ::cudaGetTextureObjectResourceDesc, + */ +CUresult CUDAAPI cuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC *pResDesc, CUtexObject texObject); + +/** + * \brief Returns a texture object's texture descriptor + * + * Returns the texture descriptor for the texture object specified by \p texObject. + * + * \param pTexDesc - Texture descriptor + * \param texObject - Texture object + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexObjectCreate, + * ::cudaGetTextureObjectTextureDesc + */ +CUresult CUDAAPI cuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC *pTexDesc, CUtexObject texObject); + +/** + * \brief Returns a texture object's resource view descriptor + * + * Returns the resource view descriptor for the texture object specified by \p texObject. + * If no resource view was set for \p texObject, the ::CUDA_ERROR_INVALID_VALUE is returned. + * + * \param pResViewDesc - Resource view descriptor + * \param texObject - Texture object + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTexObjectCreate, + * ::cudaGetTextureObjectResourceViewDesc + */ +CUresult CUDAAPI cuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC *pResViewDesc, CUtexObject texObject); + +/** @} */ /* END CUDA_TEXOBJECT */ + +/** + * \defgroup CUDA_SURFOBJECT Surface Object Management + * + * ___MANBRIEF___ surface object management functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the surface object management functions of the + * low-level CUDA driver application programming interface. The surface + * object API is only supported on devices of compute capability 3.0 or higher. + * + * @{ + */ + +/** + * \brief Creates a surface object + * + * Creates a surface object and returns it in \p pSurfObject. \p pResDesc describes + * the data to perform surface load/stores on. ::CUDA_RESOURCE_DESC::resType must be + * ::CU_RESOURCE_TYPE_ARRAY and ::CUDA_RESOURCE_DESC::res::array::hArray + * must be set to a valid CUDA array handle. ::CUDA_RESOURCE_DESC::flags must be set to zero. + * + * Surface objects are only supported on devices of compute capability 3.0 or higher. + * Additionally, a surface object is an opaque value, and, as such, should only be + * accessed through CUDA API calls. + * + * \param pSurfObject - Surface object to create + * \param pResDesc - Resource descriptor + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuSurfObjectDestroy, + * ::cudaCreateSurfaceObject + */ +CUresult CUDAAPI cuSurfObjectCreate(CUsurfObject *pSurfObject, const CUDA_RESOURCE_DESC *pResDesc); + +/** + * \brief Destroys a surface object + * + * Destroys the surface object specified by \p surfObject. + * + * \param surfObject - Surface object to destroy + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuSurfObjectCreate, + * ::cudaDestroySurfaceObject + */ +CUresult CUDAAPI cuSurfObjectDestroy(CUsurfObject surfObject); + +/** + * \brief Returns a surface object's resource descriptor + * + * Returns the resource descriptor for the surface object specified by \p surfObject. + * + * \param pResDesc - Resource descriptor + * \param surfObject - Surface object + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuSurfObjectCreate, + * ::cudaGetSurfaceObjectResourceDesc + */ +CUresult CUDAAPI cuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC *pResDesc, CUsurfObject surfObject); + +/** @} */ /* END CUDA_SURFOBJECT */ + +/** + * \defgroup CUDA_TENSOR_MEMORY Tensor Map Object Managment + * + * ___MANBRIEF___ tensor map object management functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the tensor map object management functions of the + * low-level CUDA driver application programming interface. The tensor + * core API is only supported on devices of compute capability 9.0 or higher. + * + * @{ + */ + +/** + * \brief Create a tensor map descriptor object representing tiled memory region + * + * Creates a descriptor for Tensor Memory Access (TMA) object specified + * by the parameters describing a tiled region and returns it in \p tensorMap. + * + * Tensor map objects are only supported on devices of compute capability 9.0 or higher. + * Additionally, a tensor map object is an opaque value, and, as such, should only be + * accessed through CUDA API calls. + * + * The parameters passed are bound to the following requirements: + * + * - \p tensorMap address must be aligned to 64 bytes. + * + * - \p tensorDataType has to be an enum from ::CUtensorMapDataType which is defined as: + * \code + typedef enum CUtensorMapDataType_enum { + CU_TENSOR_MAP_DATA_TYPE_UINT8 = 0, // 1 byte + CU_TENSOR_MAP_DATA_TYPE_UINT16, // 2 bytes + CU_TENSOR_MAP_DATA_TYPE_UINT32, // 4 bytes + CU_TENSOR_MAP_DATA_TYPE_INT32, // 4 bytes + CU_TENSOR_MAP_DATA_TYPE_UINT64, // 8 bytes + CU_TENSOR_MAP_DATA_TYPE_INT64, // 8 bytes + CU_TENSOR_MAP_DATA_TYPE_FLOAT16, // 2 bytes + CU_TENSOR_MAP_DATA_TYPE_FLOAT32, // 4 bytes + CU_TENSOR_MAP_DATA_TYPE_FLOAT64, // 8 bytes + CU_TENSOR_MAP_DATA_TYPE_BFLOAT16, // 2 bytes + CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ, // 4 bytes + CU_TENSOR_MAP_DATA_TYPE_TFLOAT32, // 4 bytes + CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ // 4 bytes + } CUtensorMapDataType; + * \endcode + * + * - \p tensorRank must be non-zero and less than or equal to the maximum supported dimensionality of 5. If \p interleave is not + * ::CU_TENSOR_MAP_INTERLEAVE_NONE, then \p tensorRank must additionally be greater than or equal to 3. + * + * - \p globalAddress, which specifies the starting address of the memory region described, must be 32 byte aligned when \p interleave is + * ::CU_TENSOR_MAP_INTERLEAVE_32B and 16 byte aligned otherwise. + * + * - \p globalDim array, which specifies tensor size of each of the \p tensorRank dimensions, must be non-zero and less than or + * equal to 2^32. + * + * - \p globalStrides array, which specifies tensor stride of each of the lower \p tensorRank - 1 dimensions in bytes, must be a + * multiple of 16 and less than 2^40. Additionally, the stride must be a multiple of 32 when \p interleave is ::CU_TENSOR_MAP_INTERLEAVE_32B. + * Each following dimension specified includes previous dimension stride: + * \code + globalStrides[0] = globalDim[0] * elementSizeInBytes(tensorDataType) + padding[0]; + for (i = 1; i < tensorRank - 1; i++) + globalStrides[i] = globalStrides[i – 1] * (globalDim[i] + padding[i]); + assert(globalStrides[i] >= globalDim[i]); + * \endcode + * + * - \p boxDim array, which specifies number of elements to be traversed along each of the \p tensorRank dimensions, must be non-zero + * and less than or equal to 256. + * When \p interleave is ::CU_TENSOR_MAP_INTERLEAVE_NONE, { \p boxDim[0] * elementSizeInBytes( \p tensorDataType ) } must be a multiple + * of 16 bytes. + * + * - \p elementStrides array, which specifies the iteration step along each of the \p tensorRank dimensions, must be non-zero and less + * than or equal to 8. Note that when \p interleave is ::CU_TENSOR_MAP_INTERLEAVE_NONE, the first element of this array is ignored since + * TMA doesn’t support the stride for dimension zero. + * When all elements of \p elementStrides array is one, \p boxDim specifies the number of elements to load. However, if the \p elementStrides[i] + * is not equal to one, then TMA loads ceil( \p boxDim[i] / \p elementStrides[i]) number of elements along i-th dimension. To load N elements along + * i-th dimension, \p boxDim[i] must be set to N * \p elementStrides[i]. + * + * - \p interleave specifies the interleaved layout of type ::CUtensorMapInterleave, which is defined as: + * \code + typedef enum CUtensorMapInterleave_enum { + CU_TENSOR_MAP_INTERLEAVE_NONE = 0, + CU_TENSOR_MAP_INTERLEAVE_16B, + CU_TENSOR_MAP_INTERLEAVE_32B + } CUtensorMapInterleave; + * \endcode + * TMA supports interleaved layouts like NC/8HWC8 where C8 utilizes 16 bytes in memory assuming 2 byte per channel or NC/16HWC16 where C16 + * uses 32 bytes. + * When \p interleave is ::CU_TENSOR_MAP_INTERLEAVE_NONE and \p swizzle is not ::CU_TENSOR_MAP_SWIZZLE_NONE, the bounding box inner dimension + * (computed as \p boxDim[0] multiplied by element size derived from \p tensorDataType) must be less than or equal to the swizzle size. + * - CU_TENSOR_MAP_SWIZZLE_32B implies the bounding box inner dimension will be <= 32. + * - CU_TENSOR_MAP_SWIZZLE_64B implies the bounding box inner dimension will be <= 64. + * - CU_TENSOR_MAP_SWIZZLE_128B implies the bounding box inner dimension will be <= 128. + * + * - \p swizzle, which specifies the shared memory bank swizzling pattern, has to be of type ::CUtensorMapSwizzle which is defined as: + * \code + typedef enum CUtensorMapSwizzle_enum { + CU_TENSOR_MAP_SWIZZLE_NONE = 0, + CU_TENSOR_MAP_SWIZZLE_32B, + CU_TENSOR_MAP_SWIZZLE_64B, + CU_TENSOR_MAP_SWIZZLE_128B + } CUtensorMapSwizzle; + * \endcode + * Data are organized in a specific order in global memory; however, this may not match the order in which the application accesses data + * in shared memory. This difference in data organization may cause bank conflicts when shared memory is accessed. In order to avoid this + * problem, data can be loaded to shared memory with shuffling across shared memory banks. + * When \p interleave is ::CU_TENSOR_MAP_INTERLEAVE_32B, \p swizzle must be ::CU_TENSOR_MAP_SWIZZLE_32B. + * Other interleave modes can have any swizzling pattern. + * + * - \p l2Promotion specifies L2 fetch size which indicates the byte granurality at which L2 requests is filled from DRAM. It must be of + * type ::CUtensorMapL2promotion, which is defined as: + * \code + typedef enum CUtensorMapL2promotion_enum { + CU_TENSOR_MAP_L2_PROMOTION_NONE = 0, + CU_TENSOR_MAP_L2_PROMOTION_L2_64B, + CU_TENSOR_MAP_L2_PROMOTION_L2_128B, + CU_TENSOR_MAP_L2_PROMOTION_L2_256B + } CUtensorMapL2promotion; + * \endcode + * + * - \p oobFill, which indicates whether zero or a special NaN constant should be used to fill out-of-bound elements, must be of type + * ::CUtensorMapFloatOOBfill which is defined as: + * \code + typedef enum CUtensorMapFloatOOBfill_enum { + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE = 0, + CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA + } CUtensorMapFloatOOBfill; + * \endcode + * Note that ::CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA can only be used when \p tensorDataType represents a floating-point data type. + * + * \param tensorMap - Tensor map object to create + * \param tensorDataType - Tensor data type + * \param tensorRank - Dimensionality of tensor + * \param globalAddress - Starting address of memory region described by tensor + * \param globalDim - Array containing tensor size (number of elements) along each of the \p tensorRank dimensions + * \param globalStrides - Array containing stride size (in bytes) along each of the \p tensorRank - 1 dimensions + * \param boxDim - Array containing traversal box size (number of elments) along each of the \p tensorRank dimensions. Specifies how many elements to be traversed along each tensor dimension. + * \param elementStrides - Array containing traversal stride in each of the \p tensorRank dimensions + * \param interleave - Type of interleaved layout the tensor addresses + * \param swizzle - Bank swizzling pattern inside shared memory + * \param l2Promotion - L2 promotion size + * \param oobFill - Indicate whether zero or special NaN constant must be used to fill out-of-bound elements + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTensorMapEncodeIm2col, + * ::cuTensorMapReplaceAddress + */ +CUresult CUDAAPI cuTensorMapEncodeTiled(CUtensorMap *tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void *globalAddress, const cuuint64_t *globalDim, const cuuint64_t *globalStrides, const cuuint32_t *boxDim, const cuuint32_t *elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill); + + +/** + * \brief Create a tensor map descriptor object representing im2col memory region + * + * Creates a descriptor for Tensor Memory Access (TMA) object specified + * by the parameters describing a im2col memory layout and returns it in \p tensorMap. + * + * Tensor map objects are only supported on devices of compute capability 9.0 or higher. + * Additionally, a tensor map object is an opaque value, and, as such, should only be + * accessed through CUDA API calls. + * + * The parameters passed are bound to the following requirements: + * + * - \p tensorMap address must be aligned to 64 bytes. + * + * - \p tensorDataType has to be an enum from ::CUtensorMapDataType which is defined as: + * \code + typedef enum CUtensorMapDataType_enum { + CU_TENSOR_MAP_DATA_TYPE_UINT8 = 0, // 1 byte + CU_TENSOR_MAP_DATA_TYPE_UINT16, // 2 bytes + CU_TENSOR_MAP_DATA_TYPE_UINT32, // 4 bytes + CU_TENSOR_MAP_DATA_TYPE_INT32, // 4 bytes + CU_TENSOR_MAP_DATA_TYPE_UINT64, // 8 bytes + CU_TENSOR_MAP_DATA_TYPE_INT64, // 8 bytes + CU_TENSOR_MAP_DATA_TYPE_FLOAT16, // 2 bytes + CU_TENSOR_MAP_DATA_TYPE_FLOAT32, // 4 bytes + CU_TENSOR_MAP_DATA_TYPE_FLOAT64, // 8 bytes + CU_TENSOR_MAP_DATA_TYPE_BFLOAT16, // 2 bytes + CU_TENSOR_MAP_DATA_TYPE_FLOAT32_FTZ, // 4 bytes + CU_TENSOR_MAP_DATA_TYPE_TFLOAT32, // 4 bytes + CU_TENSOR_MAP_DATA_TYPE_TFLOAT32_FTZ // 4 bytes + } CUtensorMapDataType; + * \endcode + * + * - \p tensorRank, which specifies the number of tensor dimensions, must be 3, 4, or 5. + * + * - \p globalAddress, which specifies the starting address of the memory region described, must be 32 byte aligned when \p interleave is + * ::CU_TENSOR_MAP_INTERLEAVE_32B and 16 byte aligned otherwise. + * + * - \p globalDim array, which specifies tensor size of each of the \p tensorRank dimensions, must be non-zero and less than or + * equal to 2^32. + * + * - \p globalStrides array, which specifies tensor stride of each of the lower \p tensorRank - 1 dimensions in bytes, must be a + * multiple of 16 and less than 2^40. Additionally, the stride must be a multiple of 32 when \p interleave is ::CU_TENSOR_MAP_INTERLEAVE_32B. + * Each following dimension specified includes previous dimension stride: + * \code + globalStrides[0] = globalDim[0] * elementSizeInBytes(tensorDataType) + padding[0]; + for (i = 1; i < tensorRank - 1; i++) + globalStrides[i] = globalStrides[i – 1] * (globalDim[i] + padding[i]); + assert(globalStrides[i] >= globalDim[i]); + * \endcode + * + * - \p pixelBoxLowerCorner array specifies the coordinate offsets {D, H, W} of the bounding box from top/left/front corner. The number of + * offsets and their precision depend on the tensor dimensionality: + * - When \p tensorRank is 3, one signed offset within range [-32768, 32767] is supported. + * - When \p tensorRank is 4, two signed offsets each within range [-128, 127] are supported. + * - When \p tensorRank is 5, three offsets each within range [-16, 15] are supported. + * + * - \p pixelBoxUpperCorner array specifies the coordinate offsets {D, H, W} of the bounding box from bottom/right/back corner. The number of + * offsets and their precision depend on the tensor dimensionality: + * - When \p tensorRank is 3, one signed offset within range [-32768, 32767] is supported. + * - When \p tensorRank is 4, two signed offsets each within range [-128, 127] are supported. + * - When \p tensorRank is 5, three offsets each within range [-16, 15] are supported. + * The bounding box specified by \p pixelBoxLowerCorner and \p pixelBoxUpperCorner must have non-zero area. + * + * - \p channelsPerPixel, which specifies the number of elements which must be accessed along C dimension, must be less than or equal to 256. + * + * - \p pixelsPerColumn, which specifies the number of elements that must be accessed along the {N, D, H, W} dimensions, must be less than or + * equal to 1024. + * + * - \p elementStrides array, which specifies the iteration step along each of the \p tensorRank dimensions, must be non-zero and less + * than or equal to 8. Note that when \p interleave is ::CU_TENSOR_MAP_INTERLEAVE_NONE, the first element of this array is ignored since + * TMA doesn’t support the stride for dimension zero. + * When all elements of the \p elementStrides array are one, \p boxDim specifies the number of elements to load. However, if \p elementStrides[i] + * is not equal to one for some \p i, then TMA loads ceil( \p boxDim[i] / \p elementStrides[i]) number of elements along i-th dimension. + * To load N elements along i-th dimension, \p boxDim[i] must be set to N * \p elementStrides[i]. + * + * - \p interleave specifies the interleaved layout of type ::CUtensorMapInterleave, which is defined as: + * \code + typedef enum CUtensorMapInterleave_enum { + CU_TENSOR_MAP_INTERLEAVE_NONE = 0, + CU_TENSOR_MAP_INTERLEAVE_16B, + CU_TENSOR_MAP_INTERLEAVE_32B + } CUtensorMapInterleave; + * \endcode + * TMA supports interleaved layouts like NC/8HWC8 where C8 utilizes 16 bytes in memory assuming 2 byte per channel or NC/16HWC16 where C16 + * uses 32 bytes. + * When \p interleave is ::CU_TENSOR_MAP_INTERLEAVE_NONE and \p swizzle is not ::CU_TENSOR_MAP_SWIZZLE_NONE, the bounding box inner dimension + * (computed as \p boxDim[0] multiplied by element size derived from \p tensorDataType) must be less than or equal to the swizzle size. + * - CU_TENSOR_MAP_SWIZZLE_32B implies the bounding box inner dimension will be <= 32. + * - CU_TENSOR_MAP_SWIZZLE_64B implies the bounding box inner dimension will be <= 64. + * - CU_TENSOR_MAP_SWIZZLE_128B implies the bounding box inner dimension will be <= 128. + * + * - \p swizzle, which specifies the shared memory bank swizzling pattern, has to be of type ::CUtensorMapSwizzle which is defined as: + * \code + typedef enum CUtensorMapSwizzle_enum { + CU_TENSOR_MAP_SWIZZLE_NONE = 0, + CU_TENSOR_MAP_SWIZZLE_32B, + CU_TENSOR_MAP_SWIZZLE_64B, + CU_TENSOR_MAP_SWIZZLE_128B + } CUtensorMapSwizzle; + * \endcode + * Data are organized in a specific order in global memory; however, this may not match the order in which the application accesses data + * in shared memory. This difference in data organization may cause bank conflicts when shared memory is accessed. In order to avoid this + * problem, data can be loaded to shared memory with shuffling across shared memory banks. + * When \p interleave is ::CU_TENSOR_MAP_INTERLEAVE_32B, \p swizzle must be ::CU_TENSOR_MAP_SWIZZLE_32B. + * Other interleave modes can have any swizzling pattern. + * + * - \p l2Promotion specifies L2 fetch size which indicates the byte granularity at which L2 requests are filled from DRAM. It must be of + * type ::CUtensorMapL2promotion, which is defined as: + * \code + typedef enum CUtensorMapL2promotion_enum { + CU_TENSOR_MAP_L2_PROMOTION_NONE = 0, + CU_TENSOR_MAP_L2_PROMOTION_L2_64B, + CU_TENSOR_MAP_L2_PROMOTION_L2_128B, + CU_TENSOR_MAP_L2_PROMOTION_L2_256B + } CUtensorMapL2promotion; + * \endcode + * + * - \p oobFill, which indicates whether zero or a special NaN constant should be used to fill out-of-bound elements, must be of type + * ::CUtensorMapFloatOOBfill which is defined as: + * \code + typedef enum CUtensorMapFloatOOBfill_enum { + CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE = 0, + CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA + } CUtensorMapFloatOOBfill; + * \endcode + * Note that ::CU_TENSOR_MAP_FLOAT_OOB_FILL_NAN_REQUEST_ZERO_FMA can only be used when \p tensorDataType represents a floating-point data type. + * + * \param tensorMap - Tensor map object to create + * \param tensorDataType - Tensor data type + * \param tensorRank - Dimensionality of tensor; must be at least 3 + * \param globalAddress - Starting address of memory region described by tensor + * \param globalDim - Array containing tensor size (number of elements) along each of the \p tensorRank dimensions + * \param globalStrides - Array containing stride size (in bytes) along each of the \p tensorRank - 1 dimensions + * \param pixelBoxLowerCorner - Array containing DHW dimensions of lower box corner + * \param pixelBoxUpperCorner - Array containing DHW dimensions of upper box corner + * \param channelsPerPixel - Number of channels per pixel + * \param pixelsPerColumn - Number of pixels per column + * \param elementStrides - Array containing traversal stride in each of the \p tensorRank dimensions + * \param interleave - Type of interleaved layout the tensor addresses + * \param swizzle - Bank swizzling pattern inside shared memory + * \param l2Promotion - L2 promotion size + * \param oobFill - Indicate whether zero or special NaN constant will be used to fill out-of-bound elements + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTensorMapEncodeTiled, + * ::cuTensorMapReplaceAddress + */ +CUresult CUDAAPI cuTensorMapEncodeIm2col(CUtensorMap *tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void *globalAddress, const cuuint64_t *globalDim, const cuuint64_t *globalStrides, const int *pixelBoxLowerCorner, const int *pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t *elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill); + +/** + * \brief Modify an existing tensor map descriptor with an updated global address + * + * Modifies the descriptor for Tensor Memory Access (TMA) object passed in \p tensorMap with + * an updated \p globalAddress. + * + * Tensor map objects are only supported on devices of compute capability 9.0 or higher. + * Additionally, a tensor map object is an opaque value, and, as such, should only be + * accessed through CUDA API calls. + * + * \param tensorMap - Tensor map object to modify + * \param globalAddress - Starting address of memory region described by tensor, must follow previous alignment requirements + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuTensorMapEncodeTiled, + * ::cuTensorMapEncodeIm2col + */ +CUresult CUDAAPI cuTensorMapReplaceAddress(CUtensorMap *tensorMap, void *globalAddress); + +/** @} */ +/* END CUDA_TENSOR_MEMORY */ + +/** + * \defgroup CUDA_PEER_ACCESS Peer Context Memory Access + * + * ___MANBRIEF___ direct peer context memory access functions of the low-level + * CUDA driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the direct peer context memory access functions + * of the low-level CUDA driver application programming interface. + * + * @{ + */ + +/** + * \brief Queries if a device may directly access a peer device's memory. + * + * Returns in \p *canAccessPeer a value of 1 if contexts on \p dev are capable of + * directly accessing memory from contexts on \p peerDev and 0 otherwise. + * If direct access of \p peerDev from \p dev is possible, then access may be + * enabled on two specific contexts by calling ::cuCtxEnablePeerAccess(). + * + * \param canAccessPeer - Returned access capability + * \param dev - Device from which allocations on \p peerDev are to + * be directly accessed. + * \param peerDev - Device on which the allocations to be directly accessed + * by \p dev reside. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_DEVICE + * \notefnerr + * + * \sa + * ::cuCtxEnablePeerAccess, + * ::cuCtxDisablePeerAccess, + * ::cudaDeviceCanAccessPeer + */ +CUresult CUDAAPI cuDeviceCanAccessPeer(int *canAccessPeer, CUdevice dev, CUdevice peerDev); + +/** + * \brief Enables direct access to memory allocations in a peer context. + * + * If both the current context and \p peerContext are on devices which support unified + * addressing (as may be queried using ::CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING) and same + * major compute capability, then on success all allocations from \p peerContext will + * immediately be accessible by the current context. See \ref CUDA_UNIFIED for additional + * details. + * + * Note that access granted by this call is unidirectional and that in order to access + * memory from the current context in \p peerContext, a separate symmetric call + * to ::cuCtxEnablePeerAccess() is required. + * + * Note that there are both device-wide and system-wide limitations per system + * configuration, as noted in the CUDA Programming Guide under the section + * "Peer-to-Peer Memory Access". + * + * Returns ::CUDA_ERROR_PEER_ACCESS_UNSUPPORTED if ::cuDeviceCanAccessPeer() indicates + * that the ::CUdevice of the current context cannot directly access memory + * from the ::CUdevice of \p peerContext. + * + * Returns ::CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED if direct access of + * \p peerContext from the current context has already been enabled. + * + * Returns ::CUDA_ERROR_TOO_MANY_PEERS if direct peer access is not possible + * because hardware resources required for peer access have been exhausted. + * + * Returns ::CUDA_ERROR_INVALID_CONTEXT if there is no current context, \p peerContext + * is not a valid context, or if the current context is \p peerContext. + * + * Returns ::CUDA_ERROR_INVALID_VALUE if \p Flags is not 0. + * + * \param peerContext - Peer context to enable direct access to from the current context + * \param Flags - Reserved for future use and must be set to 0 + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED, + * ::CUDA_ERROR_TOO_MANY_PEERS, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_PEER_ACCESS_UNSUPPORTED, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa + * ::cuDeviceCanAccessPeer, + * ::cuCtxDisablePeerAccess, + * ::cudaDeviceEnablePeerAccess + */ +CUresult CUDAAPI cuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags); + +/** + * \brief Disables direct access to memory allocations in a peer context and + * unregisters any registered allocations. + * + Returns ::CUDA_ERROR_PEER_ACCESS_NOT_ENABLED if direct peer access has + * not yet been enabled from \p peerContext to the current context. + * + * Returns ::CUDA_ERROR_INVALID_CONTEXT if there is no current context, or if + * \p peerContext is not a valid context. + * + * \param peerContext - Peer context to disable direct access to + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_PEER_ACCESS_NOT_ENABLED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * \notefnerr + * + * \sa + * ::cuDeviceCanAccessPeer, + * ::cuCtxEnablePeerAccess, + * ::cudaDeviceDisablePeerAccess + */ +CUresult CUDAAPI cuCtxDisablePeerAccess(CUcontext peerContext); + +/** + * \brief Queries attributes of the link between two devices. + * + * Returns in \p *value the value of the requested attribute \p attrib of the + * link between \p srcDevice and \p dstDevice. The supported attributes are: + * - ::CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK: A relative value indicating the + * performance of the link between two devices. + * - ::CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED P2P: 1 if P2P Access is enable. + * - ::CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED: 1 if Atomic operations over + * the link are supported. + * - ::CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED: 1 if cudaArray can + * be accessed over the link. + * + * Returns ::CUDA_ERROR_INVALID_DEVICE if \p srcDevice or \p dstDevice are not valid + * or if they represent the same device. + * + * Returns ::CUDA_ERROR_INVALID_VALUE if \p attrib is not valid or if \p value is + * a null pointer. + * + * \param value - Returned value of the requested attribute + * \param attrib - The requested attribute of the link between \p srcDevice and \p dstDevice. + * \param srcDevice - The source device of the target link. + * \param dstDevice - The destination device of the target link. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa + * ::cuCtxEnablePeerAccess, + * ::cuCtxDisablePeerAccess, + * ::cuDeviceCanAccessPeer, + * ::cudaDeviceGetP2PAttribute + */ +CUresult CUDAAPI cuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice); + +/** @} */ /* END CUDA_PEER_ACCESS */ + +/** + * \defgroup CUDA_GRAPHICS Graphics Interoperability + * + * ___MANBRIEF___ graphics interoperability functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the graphics interoperability functions of the + * low-level CUDA driver application programming interface. + * + * @{ + */ + +/** + * \brief Unregisters a graphics resource for access by CUDA + * + * Unregisters the graphics resource \p resource so it is not accessible by + * CUDA unless registered again. + * + * If \p resource is invalid then ::CUDA_ERROR_INVALID_HANDLE is + * returned. + * + * \param resource - Resource to unregister + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuGraphicsD3D9RegisterResource, + * ::cuGraphicsD3D10RegisterResource, + * ::cuGraphicsD3D11RegisterResource, + * ::cuGraphicsGLRegisterBuffer, + * ::cuGraphicsGLRegisterImage, + * ::cudaGraphicsUnregisterResource + */ +CUresult CUDAAPI cuGraphicsUnregisterResource(CUgraphicsResource resource); + +/** + * \brief Get an array through which to access a subresource of a mapped graphics resource. + * + * Returns in \p *pArray an array through which the subresource of the mapped + * graphics resource \p resource which corresponds to array index \p arrayIndex + * and mipmap level \p mipLevel may be accessed. The value set in \p *pArray may + * change every time that \p resource is mapped. + * + * If \p resource is not a texture then it cannot be accessed via an array and + * ::CUDA_ERROR_NOT_MAPPED_AS_ARRAY is returned. + * If \p arrayIndex is not a valid array index for \p resource then + * ::CUDA_ERROR_INVALID_VALUE is returned. + * If \p mipLevel is not a valid mipmap level for \p resource then + * ::CUDA_ERROR_INVALID_VALUE is returned. + * If \p resource is not mapped then ::CUDA_ERROR_NOT_MAPPED is returned. + * + * \param pArray - Returned array through which a subresource of \p resource may be accessed + * \param resource - Mapped resource to access + * \param arrayIndex - Array index for array textures or cubemap face + * index as defined by ::CUarray_cubemap_face for + * cubemap textures for the subresource to access + * \param mipLevel - Mipmap level for the subresource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED, + * ::CUDA_ERROR_NOT_MAPPED_AS_ARRAY + * \notefnerr + * + * \sa + * ::cuGraphicsResourceGetMappedPointer, + * ::cudaGraphicsSubResourceGetMappedArray + */ +CUresult CUDAAPI cuGraphicsSubResourceGetMappedArray(CUarray *pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel); + +/** + * \brief Get a mipmapped array through which to access a mapped graphics resource. + * + * Returns in \p *pMipmappedArray a mipmapped array through which the mapped graphics + * resource \p resource. The value set in \p *pMipmappedArray may change every time + * that \p resource is mapped. + * + * If \p resource is not a texture then it cannot be accessed via a mipmapped array and + * ::CUDA_ERROR_NOT_MAPPED_AS_ARRAY is returned. + * If \p resource is not mapped then ::CUDA_ERROR_NOT_MAPPED is returned. + * + * \param pMipmappedArray - Returned mipmapped array through which \p resource may be accessed + * \param resource - Mapped resource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED, + * ::CUDA_ERROR_NOT_MAPPED_AS_ARRAY + * \notefnerr + * + * \sa + * ::cuGraphicsResourceGetMappedPointer, + * ::cudaGraphicsResourceGetMappedMipmappedArray + */ +CUresult CUDAAPI cuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray *pMipmappedArray, CUgraphicsResource resource); + +/** + * \brief Get a device pointer through which to access a mapped graphics resource. + * + * Returns in \p *pDevPtr a pointer through which the mapped graphics resource + * \p resource may be accessed. + * Returns in \p pSize the size of the memory in bytes which may be accessed from that pointer. + * The value set in \p pPointer may change every time that \p resource is mapped. + * + * If \p resource is not a buffer then it cannot be accessed via a pointer and + * ::CUDA_ERROR_NOT_MAPPED_AS_POINTER is returned. + * If \p resource is not mapped then ::CUDA_ERROR_NOT_MAPPED is returned. + * * + * \param pDevPtr - Returned pointer through which \p resource may be accessed + * \param pSize - Returned size of the buffer accessible starting at \p *pPointer + * \param resource - Mapped resource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED, + * ::CUDA_ERROR_NOT_MAPPED_AS_POINTER + * \notefnerr + * + * \sa + * ::cuGraphicsMapResources, + * ::cuGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsResourceGetMappedPointer + */ +CUresult CUDAAPI cuGraphicsResourceGetMappedPointer(CUdeviceptr *pDevPtr, size_t *pSize, CUgraphicsResource resource); + +/** + * \brief Set usage flags for mapping a graphics resource + * + * Set \p flags for mapping the graphics resource \p resource. + * + * Changes to \p flags will take effect the next time \p resource is mapped. + * The \p flags argument may be any of the following: + + * - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE: Specifies no hints about how this + * resource will be used. It is therefore assumed that this resource will be + * read from and written to by CUDA kernels. This is the default value. + * - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_READONLY: Specifies that CUDA kernels which + * access this resource will not write to this resource. + * - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITEDISCARD: Specifies that CUDA kernels + * which access this resource will not read from this resource and will + * write over the entire contents of the resource, so none of the data + * previously stored in the resource will be preserved. + * + * If \p resource is presently mapped for access by CUDA then + * ::CUDA_ERROR_ALREADY_MAPPED is returned. + * If \p flags is not one of the above values then ::CUDA_ERROR_INVALID_VALUE is returned. + * + * \param resource - Registered resource to set flags for + * \param flags - Parameters for resource mapping + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ALREADY_MAPPED + * \notefnerr + * + * \sa + * ::cuGraphicsMapResources, + * ::cudaGraphicsResourceSetMapFlags + */ +CUresult CUDAAPI cuGraphicsResourceSetMapFlags(CUgraphicsResource resource, unsigned int flags); + +/** + * \brief Map graphics resources for access by CUDA + * + * Maps the \p count graphics resources in \p resources for access by CUDA. + * + * The resources in \p resources may be accessed by CUDA until they + * are unmapped. The graphics API from which \p resources were registered + * should not access any resources while they are mapped by CUDA. If an + * application does so, the results are undefined. + * + * This function provides the synchronization guarantee that any graphics calls + * issued before ::cuGraphicsMapResources() will complete before any subsequent CUDA + * work issued in \p stream begins. + * + * If \p resources includes any duplicate entries then ::CUDA_ERROR_INVALID_HANDLE is returned. + * If any of \p resources are presently mapped for access by CUDA then ::CUDA_ERROR_ALREADY_MAPPED is returned. + * + * \param count - Number of resources to map + * \param resources - Resources to map for CUDA usage + * \param hStream - Stream with which to synchronize + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ALREADY_MAPPED, + * ::CUDA_ERROR_UNKNOWN + * \note_null_stream + * \notefnerr + * + * \sa + * ::cuGraphicsResourceGetMappedPointer, + * ::cuGraphicsSubResourceGetMappedArray, + * ::cuGraphicsUnmapResources, + * ::cudaGraphicsMapResources + */ +CUresult CUDAAPI cuGraphicsMapResources(unsigned int count, CUgraphicsResource *resources, CUstream hStream); + +/** + * \brief Unmap graphics resources. + * + * Unmaps the \p count graphics resources in \p resources. + * + * Once unmapped, the resources in \p resources may not be accessed by CUDA + * until they are mapped again. + * + * This function provides the synchronization guarantee that any CUDA work issued + * in \p stream before ::cuGraphicsUnmapResources() will complete before any + * subsequently issued graphics work begins. + * + * + * If \p resources includes any duplicate entries then ::CUDA_ERROR_INVALID_HANDLE is returned. + * If any of \p resources are not presently mapped for access by CUDA then ::CUDA_ERROR_NOT_MAPPED is returned. + * + * \param count - Number of resources to unmap + * \param resources - Resources to unmap + * \param hStream - Stream with which to synchronize + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED, + * ::CUDA_ERROR_UNKNOWN + * \note_null_stream + * \notefnerr + * + * \sa + * ::cuGraphicsMapResources, + * ::cudaGraphicsUnmapResources + */ +CUresult CUDAAPI cuGraphicsUnmapResources(unsigned int count, CUgraphicsResource *resources, CUstream hStream); + +/** @} */ /* END CUDA_GRAPHICS */ + +/** + * \defgroup CUDA_DRIVER_ENTRY_POINT Driver Entry Point Access + * + * ___MANBRIEF___ driver entry point access functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the driver entry point access functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Returns the requested driver API function pointer + * + * Returns in \p **pfn the address of the CUDA driver function for the requested + * CUDA version and flags. + * + * The CUDA version is specified as (1000 * major + 10 * minor), so CUDA 11.2 + * should be specified as 11020. For a requested driver symbol, if the specified + * CUDA version is greater than or equal to the CUDA version in which the driver symbol + * was introduced, this API will return the function pointer to the corresponding + * versioned function. + * + * The pointer returned by the API should be cast to a function pointer matching the + * requested driver function's definition in the API header file. The function pointer + * typedef can be picked up from the corresponding typedefs header file. For example, + * cudaTypedefs.h consists of function pointer typedefs for driver APIs defined in cuda.h. + * + * The API will return ::CUDA_SUCCESS and set the returned \p pfn to NULL if the + * requested driver function is not supported on the platform, no ABI + * compatible driver function exists for the specified \p cudaVersion or if the + * driver symbol is invalid. + * + * It will also set the optional \p symbolStatus to one of the values in + * ::CUdriverProcAddressQueryResult with the following meanings: + * - ::CU_GET_PROC_ADDRESS_SUCCESS - The requested symbol was succesfully found based + * on input arguments and \p pfn is valid + * - ::CU_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND - The requested symbol was not found + * - ::CU_GET_PROC_ADDRESS_VERSION_NOT_SUFFICIENT - The requested symbol was found but is + * not supported by cudaVersion specified + * + * The requested flags can be: + * - ::CU_GET_PROC_ADDRESS_DEFAULT: This is the default mode. This is equivalent to + * ::CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM if the code is compiled with + * --default-stream per-thread compilation flag or the macro CUDA_API_PER_THREAD_DEFAULT_STREAM + * is defined; ::CU_GET_PROC_ADDRESS_LEGACY_STREAM otherwise. + * - ::CU_GET_PROC_ADDRESS_LEGACY_STREAM: This will enable the search for all driver symbols + * that match the requested driver symbol name except the corresponding per-thread versions. + * - ::CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM: This will enable the search for all + * driver symbols that match the requested driver symbol name including the per-thread + * versions. If a per-thread version is not found, the API will return the legacy version + * of the driver function. + * + * \param symbol - The base name of the driver API function to look for. As an example, + * for the driver API ::cuMemAlloc_v2, \p symbol would be cuMemAlloc and + * \p cudaVersion would be the ABI compatible CUDA version for the _v2 variant. + * \param pfn - Location to return the function pointer to the requested driver function + * \param cudaVersion - The CUDA version to look for the requested driver symbol + * \param flags - Flags to specify search options. + * \param symbolStatus - Optional location to store the status of the search for + * \p symbol based on \p cudaVersion. See ::CUdriverProcAddressQueryResult + * for possible values. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \note_version_mixing + * + * \sa + * ::cudaGetDriverEntryPoint + */ +CUresult CUDAAPI cuGetProcAddress(const char *symbol, void **pfn, int cudaVersion, cuuint64_t flags, CUdriverProcAddressQueryResult *symbolStatus); + +/** @} */ /* END CUDA_DRIVER_ENTRY_POINT */ + +/** + * \defgroup CUDA_COREDUMP Coredump Attributes Control API + * + * ___MANBRIEF___ coredump attribute control functions for the low-level CUDA API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the coredump attribute control functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * Flags for choosing a coredump attribute to get/set + */ +typedef enum CUcoredumpSettings_enum { + CU_COREDUMP_ENABLE_ON_EXCEPTION = 1, + CU_COREDUMP_TRIGGER_HOST, + CU_COREDUMP_LIGHTWEIGHT, + CU_COREDUMP_ENABLE_USER_TRIGGER, + CU_COREDUMP_FILE, + CU_COREDUMP_PIPE, + CU_COREDUMP_MAX +} CUcoredumpSettings; + +/** + * \brief Allows caller to fetch a coredump attribute value for the current context + * + * Returns in \p *value the requested value specified by \p attrib. It is up to the caller + * to ensure that the data type and size of \p *value matches the request. + * + * If the caller calls this function with \p *value equal to NULL, the size of the memory + * region (in bytes) expected for \p attrib will be placed in \p size. + * + * The supported attributes are: + * - ::CU_COREDUMP_ENABLE_ON_EXCEPTION: Bool where ::true means that GPU exceptions from + * this context will create a coredump at the location specified by ::CU_COREDUMP_FILE. + * The default value is ::false unless set to ::true globally or locally, or the + * CU_CTX_USER_COREDUMP_ENABLE flag was set during context creation. + * - ::CU_COREDUMP_TRIGGER_HOST: Bool where ::true means that the host CPU will + * also create a coredump. The default value is ::true unless set to ::false globally or + * or locally. + * - ::CU_COREDUMP_LIGHTWEIGHT: Bool where ::true means that any resulting coredumps + * will not have a dump of GPU memory or non-reloc ELF images. The default value is + * ::false unless set to ::true globally or locally. + * - ::CU_COREDUMP_ENABLE_USER_TRIGGER: Bool where ::true means that a coredump can be + * created by writing to the system pipe specified by ::CU_COREDUMP_PIPE. The default + * value is ::false unless set to ::true globally or locally. + * - ::CU_COREDUMP_FILE: String of up to 1023 characters that defines the location where + * any coredumps generated by this context will be written. The default value is + * ::core.cuda.HOSTNAME.PID where ::HOSTNAME is the host name of the machine running + * the CUDA applications and ::PID is the process ID of the CUDA application. + * - ::CU_COREDUMP_PIPE: String of up to 1023 characters that defines the name of the pipe + * that will be monitored if user-triggered coredumps are enabled. The default value is + * ::corepipe.cuda.HOSTNAME.PID where ::HOSTNAME is the host name of the machine running + * the CUDA application and ::PID is the process ID of the CUDA application. + * + * \param attrib - The enum defining which value to fetch. + * \param value - void* containing the requested data. + * \param size - The size of the memory region \p value points to. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_PERMITTED, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_CONTEXT_IS_DESTROYED + * + * \sa + * ::cuCoredumpGetAttributeGlobal, + * ::cuCoredumpSetAttribute, + * ::cuCoredumpSetAttributeGlobal + */ +CUresult CUDAAPI cuCoredumpGetAttribute(CUcoredumpSettings attrib, void* value, size_t *size); + +/** + * \brief Allows caller to fetch a coredump attribute value for the entire application + * + * Returns in \p *value the requested value specified by \p attrib. It is up to the caller + * to ensure that the data type and size of \p *value matches the request. + * + * If the caller calls this function with \p *value equal to NULL, the size of the memory + * region (in bytes) expected for \p attrib will be placed in \p size. + * + * The supported attributes are: + * - ::CU_COREDUMP_ENABLE_ON_EXCEPTION: Bool where ::true means that GPU exceptions from + * this context will create a coredump at the location specified by ::CU_COREDUMP_FILE. + * The default value is ::false. + * - ::CU_COREDUMP_TRIGGER_HOST: Bool where ::true means that the host CPU will + * also create a coredump. The default value is ::true. + * - ::CU_COREDUMP_LIGHTWEIGHT: Bool where ::true means that any resulting coredumps + * will not have a dump of GPU memory or non-reloc ELF images. The default value is + * ::false. + * - ::CU_COREDUMP_ENABLE_USER_TRIGGER: Bool where ::true means that a coredump can be + * created by writing to the system pipe specified by ::CU_COREDUMP_PIPE. The default + * value is ::false. + * - ::CU_COREDUMP_FILE: String of up to 1023 characters that defines the location where + * any coredumps generated by this context will be written. The default value is + * ::core.cuda.HOSTNAME.PID where ::HOSTNAME is the host name of the machine running + * the CUDA applications and ::PID is the process ID of the CUDA application. + * - ::CU_COREDUMP_PIPE: String of up to 1023 characters that defines the name of the pipe + * that will be monitored if user-triggered coredumps are enabled. The default value is + * ::corepipe.cuda.HOSTNAME.PID where ::HOSTNAME is the host name of the machine running + * the CUDA application and ::PID is the process ID of the CUDA application. + * + * \param attrib - The enum defining which value to fetch. + * \param value - void* containing the requested data. + * \param size - The size of the memory region \p value points to. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuCoredumpGetAttribute, + * ::cuCoredumpSetAttribute, + * ::cuCoredumpSetAttributeGlobal + */ +CUresult CUDAAPI cuCoredumpGetAttributeGlobal(CUcoredumpSettings attrib, void *value, size_t *size); + +/** + * \brief Allows caller to set a coredump attribute value for the current context + * + * This function should be considered an alternate interface to the CUDA-GDB environment + * variables defined in this document: https://docs.nvidia.com/cuda/cuda-gdb/index.html#gpu-coredump + * + * An important design decision to note is that any coredump environment variable values + * set before CUDA initializes will take permanent precedence over any values set with this + * this function. This decision was made to ensure no change in behavior for any users that + * may be currently using these variables to get coredumps. + * + * \p *value shall contain the requested value specified by \p set. It is up to the caller + * to ensure that the data type and size of \p *value matches the request. + * + * If the caller calls this function with \p *value equal to NULL, the size of the memory + * region (in bytes) expected for \p set will be placed in \p size. + * + * /note This function will return ::CUDA_ERROR_NOT_SUPPORTED if the caller attempts to set + * ::CU_COREDUMP_ENABLE_ON_EXCEPTION on a GPU of with Compute Capability < 6.0. ::cuCoredumpSetAttributeGlobal + * works on those platforms as an alternative. + * + * /note ::CU_COREDUMP_ENABLE_USER_TRIGGER and ::CU_COREDUMP_PIPE cannot be set on a per-context basis. + * + * The supported attributes are: + * - ::CU_COREDUMP_ENABLE_ON_EXCEPTION: Bool where ::true means that GPU exceptions from + * this context will create a coredump at the location specified by ::CU_COREDUMP_FILE. + * The default value is ::false. + * - ::CU_COREDUMP_TRIGGER_HOST: Bool where ::true means that the host CPU will + * also create a coredump. The default value is ::true. + * - ::CU_COREDUMP_LIGHTWEIGHT: Bool where ::true means that any resulting coredumps + * will not have a dump of GPU memory or non-reloc ELF images. The default value is + * ::false. + * - ::CU_COREDUMP_FILE: String of up to 1023 characters that defines the location where + * any coredumps generated by this context will be written. The default value is + * ::core.cuda.HOSTNAME.PID where ::HOSTNAME is the host name of the machine running + * the CUDA applications and ::PID is the process ID of the CUDA application. + * + * \param attrib - The enum defining which value to set. + * \param value - void* containing the requested data. + * \param size - The size of the memory region \p value points to. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_PERMITTED, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_CONTEXT_IS_DESTROYED, + * ::CUDA_ERROR_NOT_SUPPORTED + * + * \sa + * ::cuCoredumpGetAttributeGlobal, + * ::cuCoredumpGetAttribute, + * ::cuCoredumpSetAttributeGlobal + */ +CUresult CUDAAPI cuCoredumpSetAttribute(CUcoredumpSettings attrib, void* value, size_t *size); + +/** + * \brief Allows caller to set a coredump attribute value globally + * + * This function should be considered an alternate interface to the CUDA-GDB environment + * variables defined in this document: https://docs.nvidia.com/cuda/cuda-gdb/index.html#gpu-coredump + * + * An important design decision to note is that any coredump environment variable values + * set before CUDA initializes will take permanent precedence over any values set with this + * this function. This decision was made to ensure no change in behavior for any users that + * may be currently using these variables to get coredumps. + * + * \p *value shall contain the requested value specified by \p set. It is up to the caller + * to ensure that the data type and size of \p *value matches the request. + * + * If the caller calls this function with \p *value equal to NULL, the size of the memory + * region (in bytes) expected for \p set will be placed in \p size. + * + * The supported attributes are: + * - ::CU_COREDUMP_ENABLE_ON_EXCEPTION: Bool where ::true means that GPU exceptions from + * this context will create a coredump at the location specified by ::CU_COREDUMP_FILE. + * The default value is ::false. + * - ::CU_COREDUMP_TRIGGER_HOST: Bool where ::true means that the host CPU will + * also create a coredump. The default value is ::true. + * - ::CU_COREDUMP_LIGHTWEIGHT: Bool where ::true means that any resulting coredumps + * will not have a dump of GPU memory or non-reloc ELF images. The default value is + * ::false. + * - ::CU_COREDUMP_ENABLE_USER_TRIGGER: Bool where ::true means that a coredump can be + * created by writing to the system pipe specified by ::CU_COREDUMP_PIPE. The default + * value is ::false. + * - ::CU_COREDUMP_FILE: String of up to 1023 characters that defines the location where + * any coredumps generated by this context will be written. The default value is + * ::core.cuda.HOSTNAME.PID where ::HOSTNAME is the host name of the machine running + * the CUDA applications and ::PID is the process ID of the CUDA application. + * - ::CU_COREDUMP_PIPE: String of up to 1023 characters that defines the name of the pipe + * that will be monitored if user-triggered coredumps are enabled. This value may not be + * changed after ::CU_COREDUMP_ENABLE_USER_TRIGGER is set to ::true. The default + * value is ::corepipe.cuda.HOSTNAME.PID where ::HOSTNAME is the host name of the machine + * running the CUDA application and ::PID is the process ID of the CUDA application. + * + * \param attrib - The enum defining which value to set. + * \param value - void* containing the requested data. + * \param size - The size of the memory region \p value points to. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_PERMITTED + * + * \sa + * ::cuCoredumpGetAttribute, + * ::cuCoredumpGetAttributeGlobal, + * ::cuCoredumpSetAttribute + */ +CUresult CUDAAPI cuCoredumpSetAttributeGlobal(CUcoredumpSettings attrib, void *value, size_t *size); + +/** @} */ /* END CUDA_COREDUMP */ + +CUresult CUDAAPI cuGetExportTable(const void **ppExportTable, const CUuuid *pExportTableId); + +/* +** ******************* GREEN CONTEXTS ********************** +*/ + +/** + * \defgroup CUDA_GREEN_CONTEXTS Green Contexts + * + * ___MANBRIEF___ Driver level API for creation and manipulation of green contexts + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the APIs for creation and manipulation of green contexts in the CUDA + * driver. Green contexts are a lightweight alternative to traditional contexts, with the ability + * to pass in a set of resources that they should be initialized with. This allows the developer to + * represent distinct spatial partitions of the GPU, provision resources for them, and target them + * via the same programming model that CUDA exposes (streams, kernel launches, etc.). + * + * There are 4 main steps to using these new set of APIs. + * - (1) Start with an initial set of resources, for example via ::cuDeviceGetDevResource. Only SM type is supported today. + * - (2) Partition this set of resources by providing them as input to a partition API, for example: ::cuDevSmResourceSplitByCount. + * - (3) Finalize the specification of resources by creating a descriptor via ::cuDevResourceGenerateDesc. + * - (4) Provision the resources and create a green context via ::cuGreenCtxCreate. + * + * For \p CU_DEV_RESOURCE_TYPE_SM, the partitions created have minimum SM count requirements, often rounding up and aligning the + * minCount provided to ::cuDevSmResourceSplitByCount. The following is a guideline for each architecture + * and may be subject to change: + * - On Compute Architecture 6.X: The minimum count is 1 SM. + * - On Compute Architecture 7.X: The minimum count is 2 SMs and must be a multiple of 2. + * - On Compute Architecture 8.X: The minimum count is 4 SMs and must be a multiple of 2. + * - On Compute Architecture 9.0+: The minimum count is 8 SMs and must be a multiple of 8. + * + * In the future, flags can be provided to tradeoff functional and performance characteristics versus finer grained SM partitions. + * + * Even if the green contexts have disjoint SM partitions, it is not guaranteed that the kernels launched + * in them will run concurrently or have forward progress guarantees. This is due to other resources (like HW connections, + * see ::CUDA_DEVICE_MAX_CONNECTIONS) that could cause a dependency. Additionally, in certain scenarios, + * it is possible for the workload to run on more SMs than was provisioned (but never less). + * The following are two scenarios which can exhibit this behavior: + * - On Volta+ MPS: When \p CUDA_MPS_ACTIVE_THREAD_PERCENTAGE is used, + * the set of SMs that are used for running kernels can be scaled up to the value of SMs used for the MPS client. + * - On Compute Architecture 9.x: When a module with dynamic parallelism (CDP) is loaded, all future + * kernels running under green contexts may use and share an additional set of 2 SMs. + * + * @{ + */ + +/*! + * \typedef typedef struct CUgreenCtx_st* CUgreenCtx + * A green context handle. This handle can be used safely from only one CPU thread at a time. + * Created via ::cuGreenCtxCreate + */ +typedef struct CUgreenCtx_st *CUgreenCtx; + +/*! + * \typedef struct CUdevResourceDesc_st* CUdevResourceDesc; + * An opaque descriptor handle. The descriptor encapsulates multiple created and configured resources. + * Created via ::cuDevResourceGenerateDesc + */ +typedef struct CUdevResourceDesc_st *CUdevResourceDesc; + +typedef enum { + CU_GREEN_CTX_DEFAULT_STREAM = 0x1, /**< Required. Creates a default stream to use inside the green context */ +} CUgreenCtxCreate_flags; + +#define RESOURCE_ABI_VERSION 1 +#define RESOURCE_ABI_EXTERNAL_BYTES 48 + +#define _CONCAT_INNER(x, y) x ## y +#define _CONCAT_OUTER(x, y) _CONCAT_INNER(x, y) + +/*! + * \typedef enum CUdevResourceType + * Type of resource + */ +typedef enum { + CU_DEV_RESOURCE_TYPE_INVALID = 0, + CU_DEV_RESOURCE_TYPE_SM = 1, /**< Streaming multiprocessors related information */ +#ifdef __CUDA_API_VERSION_INTERNAL + CU_DEV_RESOURCE_TYPE_MAX, +#endif +} CUdevResourceType; + +/*! + * \struct CUdevSmResource + * Data for SM-related resources + */ +typedef struct CUdevSmResource_st { + unsigned int smCount; /**< The amount of streaming multiprocessors available in this resource. This is an output parameter only, do not write to this field. */ +} CUdevSmResource; + +/*! + * \struct CUdevResource + * A tagged union describing different resources identified by the type field. This structure should not be directly modified outside of the API that created it. + * \code + * struct { + * CUdevResourceType type; + * union { + * CUdevSmResource sm; + * }; + * }; + * \endcode + * - If \p type is \p CU_DEV_RESOURCE_TYPE_INVALID, this resoure is not valid and cannot be further accessed. + * - If \p type is \p CU_DEV_RESOURCE_TYPE_SM, the ::CUdevSmResource structure \p sm is filled in. For example, + * \p sm.smCount will reflect the amount of streaming multiprocessors available in this resource. + */ +typedef struct CUdevResource_st { + CUdevResourceType type; /**< Type of resource, dictates which union field was last set */ + unsigned char _internal_padding[92]; + union { + CUdevSmResource sm; /**< Resource corresponding to CU_DEV_RESOURCE_TYPE_SM \p. type. */ + unsigned char _oversize[RESOURCE_ABI_EXTERNAL_BYTES]; + }; +} _CONCAT_OUTER(CUdevResource_v, RESOURCE_ABI_VERSION); +typedef _CONCAT_OUTER(CUdevResource_v, RESOURCE_ABI_VERSION) CUdevResource; + +#undef _CONCAT_INNER +#undef _CONCAT_OUTER + +#undef ABI_PER_RESOURCE_EXTERNAL_BYTES +#undef ABI_RESOURCE_VERSION + +/** + * \brief Creates a green context with a specified set of resources. + * + * This API creates a green context with the resources specified in the descriptor \p desc and + * returns it in the handle represented by \p phCtx. This API will retain the primary context on device \p dev, + * which will is released when the green context is destroyed. It is advised to have the primary context active + * before calling this API to avoid the heavy cost of triggering primary context initialization and + * deinitialization multiple times. + * + * The API does not set the green context current. In order to set it current, you need to explicitly set it current + * by first converting the green context to a CUcontext using ::cuCtxFromGreenCtx and subsequently calling + * ::cuCtxSetCurrent / ::cuCtxPushCurrent. It should be noted that a green context can be current to only one + * thread at a time. There is no internal synchronization to make API calls accessing the same green context + * from multiple threads work. + * + * Note: The API is not supported on 32-bit platforms. + * + * \param phCtx - Pointer for the output handle to the green context + * \param desc - Descriptor generated via ::cuDevResourceGenerateDesc which contains the set of resources to be used + * \param dev - Device on which to create the green context. + * \param flags - One of the supported green context creation flags. \p CU_GREEN_CTX_DEFAULT_STREAM is required. + * + * The supported flags are: + * - \p CU_GREEN_CTX_DEFAULT_STREAM : Creates a default stream to use inside the green context. Required. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa + * ::cuGreenCtxDestroy, + * ::cuCtxFromGreenCtx, + * ::cuCtxSetCurrent, + * ::cuCtxPushCurrent, + * ::cuDevResourceGenerateDesc, + * ::cuDevicePrimaryCtxRetain, + * ::cuCtxCreate, + * ::cuCtxCreate_v3 + */ +CUresult CUDAAPI cuGreenCtxCreate(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags); + +/** + * \brief Destroys a green context + * + * Destroys the green context, releasing the primary context of the device that this green context was created for. + * Any resources provisioned for this green context (that were initially available via the resource descriptor) + * are released as well. + * \param hCtx - Green context to be destroyed + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_CONTEXT_IS_DESTROYED + * + * \sa + * ::cuGreenCtxCreate, + * ::cuCtxDestroy + */ +CUresult CUDAAPI cuGreenCtxDestroy(CUgreenCtx hCtx); + +/** + * \brief Converts a green context into the primary context + * + * The API converts a green context into the primary context returned in \p pContext. It is important + * to note that the converted context \p pContext is a normal primary context but with + * the resources of the specified green context \p hCtx. Once converted, it can then + * be used to set the context current with ::cuCtxSetCurrent or with any of the CUDA APIs + * that accept a CUcontext parameter. + * + * Users are expected to call this API before calling any CUDA APIs that accept a + * CUcontext. Failing to do so will result in the APIs returning ::CUDA_ERROR_INVALID_CONTEXT. + * + * \param pContext Returned primary context with green context resources + * \param hCtx Green context to convert + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuGreenCtxCreate + */ +CUresult CUDAAPI cuCtxFromGreenCtx(CUcontext *pContext, CUgreenCtx hCtx); + +/** + * \brief Get device resources + * + * Get the \p type resources available to the \p device. + * This may often be the starting point for further partitioning or configuring of resources. + * + * Note: The API is not supported on 32-bit platforms. + * + * \param device - Device to get resource for + * \param resource - Output pointer to a CUdevResource structure + * \param type - Type of resource to retrieve + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_RESOURCE_TYPE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_DEVICE + * + * \sa + * ::cuDevResourceGenerateDesc + */ +CUresult CUDAAPI cuDeviceGetDevResource(CUdevice device, CUdevResource* resource, CUdevResourceType type); + +/** + * \brief Get context resources + * + * Get the \p type resources available to the context represented by \p hCtx + * \param hCtx - Context to get resource for + * + * Note: The API is not supported on 32-bit platforms. + * + * \param resource - Output pointer to a CUdevResource structure + * \param type - Type of resource to retrieve + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_RESOURCE_TYPE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_CONTEXT + * + * \sa + * ::cuDevResourceGenerateDesc + */ +CUresult CUDAAPI cuCtxGetDevResource(CUcontext hCtx, CUdevResource* resource, CUdevResourceType type); + +/** + * \brief Get green context resources + * + * Get the \p type resources available to the green context represented by \p hCtx + * \param hCtx - Green context to get resource for + * \param resource - Output pointer to a CUdevResource structure + * \param type - Type of resource to retrieve + * + * \return + * ::CUDA_SUCCESS + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_RESOURCE_TYPE, + * ::CUDA_ERROR_INVALID_VALUE + * + * \sa + * ::cuDevResourceGenerateDesc + */ +CUresult CUDAAPI cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource, CUdevResourceType type); + +/** + * \brief Splits \p CU_DEV_RESOURCE_TYPE_SM resources. + * + * Splits \p CU_DEV_RESOURCE_TYPE_SM resources into \p nbGroups, adhering to the minimum SM count specified in \p minCount + * and the usage flags in \p useFlags. If \p result is NULL, the API simulates a split and provides the amount of groups that + * would be created in \p nbGroups. Otherwise, \p nbGroups must point to the amount of elements in \p result and on return, + * the API will overwrite \p nbGroups with the amount actually created. The groups are written to the array in \p result. + * \p nbGroups can be less than the total amount if a smaller number of groups is needed. + * + * This API is used to spatially partition the input resource. The input resource needs to come from one of + * ::cuDeviceGetDevResource, ::cuCtxGetDevResource, or ::cuGreenCtxGetDevResource. + * A limitation of the API is that the output results cannot be split again without + * first creating a descriptor and a green context with that descriptor. + * + * When creating the groups, the API will take into account the performance and functional characteristics of the + * input resource, and guarantee a split that will create a disjoint set of symmetrical partitions. This may lead to less groups created + * than purely dividing the total SM count by the \p minCount due to cluster requirements or + * alignment and granularity requirements for the minCount. + * + * The \p remainder set, might not have the same functional or performance guarantees as the groups in \p result. + * Its use should be carefully planned and future partitions of the \p remainder set are discouraged. + * + * A successful API call must either have: + * - A valid array of \p result pointers of size passed in \p nbGroups, with \p Input of type \p CU_DEV_RESOURCE_TYPE_SM. + * Value of \p minCount must be between 0 and the SM count specified in \p input. \p remaining and \p useFlags are optional. + * - NULL passed in for \p result, with a valid integer pointer in \p nbGroups and \p Input of type \p CU_DEV_RESOURCE_TYPE_SM. + * Value of \p minCount must be between 0 and the SM count specified in \p input. + * This queries the number of groups that would be created by the API. + * + * Note: The API is not supported on 32-bit platforms. + * + * \param result - Output array of \p CUdevResource resources. Can be NULL to query the number of groups. + * \param nbGroups - This is a pointer, specifying the number of groups that would be or should be created as described below. + * \param input - Input SM resource to be split. Must be a valid \p CU_DEV_RESOURCE_TYPE_SM resource. + * \param remaining - If the input resource cannot be cleanly split among \p nbGroups, the remaining is placed in here. + * Can be ommitted (NULL) if the user does not need the remaining set. + * \param useFlags - Flags specifying how these partitions are used or which constraints to abide by when splitting the input. + * \param minCount - Minimum number of SMs required + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_RESOURCE_TYPE, + * ::CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION + * + * \sa + * ::cuGreenCtxGetDevResource, + * ::cuCtxGetDevResource, + * ::cuDeviceGetDevResource + */ +CUresult CUDAAPI cuDevSmResourceSplitByCount( + CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remaining, unsigned int useFlags, unsigned int minCount); + +/** + * \brief Generate a resource descriptor + * + * Generates a resource descriptor with the set of resources specified in \p resources. + * The generated resource descriptor is necessary for the creation of green contexts via the ::cuGreenCtxCreate API. + * The API expects \p nbResources == 1, as there is only one type of resource and merging the same + * types of resource is currently not supported. + * + * Note: The API is not supported on 32-bit platforms. + * + * \param phDesc - Output descriptor + * \param resources - Array of resources to be included in the descriptor + * \param nbResources - Number of resources passed in \p resources + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_RESOURCE_TYPE, + * ::CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION + * + * \sa + * ::cuDevSmResourceSplitByCount + */ +CUresult CUDAAPI cuDevResourceGenerateDesc(CUdevResourceDesc *phDesc, CUdevResource *resources, unsigned int nbResources); + +/** + * \brief Records an event. + * + * Captures in \phEvent all the activities of the green context of \phCtx + * at the time of this call. \phEvent and \phCtx must be from the same + * CUDA context. Calls such as ::cuEventQuery() or ::cuGreenCtxWaitEvent() will + * then examine or wait for completion of the work that was captured. Uses of + * \p hCtx after this call do not modify \p hEvent. + * + * \note The API will return an error if the specified green context \p hCtx + * has a stream in the capture mode. In such a case, the call will invalidate + * all the conflicting captures. + * + * \param hCtx - Green context to record event for + * \param hEvent - Event to record + * + * \return + * ::CUDA_SUCCESS + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE + * + * \sa + * ::cuGreenCtxWaitEvent, + * ::cuEventRecord + */ +CUresult CUDAAPI cuGreenCtxRecordEvent(CUgreenCtx hCtx, CUevent hEvent); + +/** + * \brief Make a green context wait on an event + * + * Makes all future work submitted to green context \phCtx wait for all work + * captured in \phEvent. The synchronization will be performed on the device + * and will not block the calling CPU thread. See ::cuGreenCtxRecordEvent() + * for details on what is captured by an event. + * + * \note The API will return an error and invalidate the capture if the specified + * event \p hEvent is part of an ongoing capture sequence. + * + * \param hCtx - Green context to wait + * \param hEvent - Event to wait on (may not be NULL) + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE + * + * \sa + * ::cuGreenCtxRecordEvent, + * ::cuStreamWaitEvent + */ +CUresult CUDAAPI cuGreenCtxWaitEvent(CUgreenCtx hCtx, CUevent hEvent); + +/** + * \brief Query the green context associated with a stream + * + * Returns the CUDA green context that the stream is associated with, or NULL if the stream + * is not associated with any green context. + * + * The stream handle \p hStream can refer to any of the following: + *
    + *
  • + * a stream created via any of the CUDA driver APIs such as ::cuStreamCreate. + * If during stream creation the context that was active in the calling thread was obtained + * with cuCtxFromGreenCtx, that green context is returned in \p phCtx. + * Otherwise, \p *phCtx is set to NULL instead. + *
  • + *
  • + * special stream such as the NULL stream or ::CU_STREAM_LEGACY. + * In that case if context that is active in the calling thread was obtained + * with cuCtxFromGreenCtx, that green context is returned. + * Otherwise, \p *phCtx is set to NULL instead. + *
  • + *
+ * Passing an invalid handle will result in undefined behavior. + * + * \param hStream - Handle to the stream to be queried + * \param phCtx - Returned green context associated with the stream + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * \notefnerr + * + * \sa ::cuStreamDestroy, + * ::cuStreamCreateWithPriority, + * ::cuStreamGetPriority, + * ::cuStreamGetFlags, + * ::cuStreamWaitEvent, + * ::cuStreamQuery, + * ::cuStreamSynchronize, + * ::cuStreamAddCallback, + * ::cudaStreamCreate, + * ::cudaStreamCreateWithFlags + */ +CUresult CUDAAPI cuStreamGetGreenCtx(CUstream hStream, CUgreenCtx *phCtx); + +/** @} */ + +/* +** *************** END CUDA_GREEN_CONTEXTS ***************** +*/ + +/** + * CUDA API versioning support + */ +#if defined(__CUDA_API_VERSION_INTERNAL) + #undef cuMemHostRegister + #undef cuGraphicsResourceSetMapFlags + #undef cuLinkCreate + #undef cuLinkAddData + #undef cuLinkAddFile + #undef cuDeviceTotalMem + #undef cuCtxCreate + #undef cuModuleGetGlobal + #undef cuMemGetInfo + #undef cuMemAlloc + #undef cuMemAllocPitch + #undef cuMemFree + #undef cuMemGetAddressRange + #undef cuMemAllocHost + #undef cuMemHostGetDevicePointer + #undef cuMemcpyHtoD + #undef cuMemcpyDtoH + #undef cuMemcpyDtoD + #undef cuMemcpyDtoA + #undef cuMemcpyAtoD + #undef cuMemcpyHtoA + #undef cuMemcpyAtoH + #undef cuMemcpyAtoA + #undef cuMemcpyHtoAAsync + #undef cuMemcpyAtoHAsync + #undef cuMemcpy2D + #undef cuMemcpy2DUnaligned + #undef cuMemcpy3D + #undef cuMemcpyHtoDAsync + #undef cuMemcpyDtoHAsync + #undef cuMemcpyDtoDAsync + #undef cuMemcpy2DAsync + #undef cuMemcpy3DAsync + #undef cuMemsetD8 + #undef cuMemsetD16 + #undef cuMemsetD32 + #undef cuMemsetD2D8 + #undef cuMemsetD2D16 + #undef cuMemsetD2D32 + #undef cuArrayCreate + #undef cuArrayGetDescriptor + #undef cuArray3DCreate + #undef cuArray3DGetDescriptor + #undef cuTexRefSetAddress + #undef cuTexRefSetAddress2D + #undef cuTexRefGetAddress + #undef cuGraphicsResourceGetMappedPointer + #undef cuCtxDestroy + #undef cuCtxPopCurrent + #undef cuCtxPushCurrent + #undef cuStreamDestroy + #undef cuEventDestroy + #undef cuMemcpy + #undef cuMemcpyAsync + #undef cuMemcpyPeer + #undef cuMemcpyPeerAsync + #undef cuMemcpy3DPeer + #undef cuMemcpy3DPeerAsync + #undef cuMemsetD8Async + #undef cuMemsetD16Async + #undef cuMemsetD32Async + #undef cuMemsetD2D8Async + #undef cuMemsetD2D16Async + #undef cuMemsetD2D32Async + #undef cuStreamGetPriority + #undef cuStreamGetId + #undef cuStreamGetFlags + #undef cuStreamGetCtx + #undef cuStreamWaitEvent + #undef cuStreamAddCallback + #undef cuStreamAttachMemAsync + #undef cuStreamQuery + #undef cuStreamSynchronize + #undef cuEventRecord + #undef cuEventRecordWithFlags + #undef cuLaunchKernel + #undef cuLaunchKernelEx + #undef cuLaunchHostFunc + #undef cuGraphicsMapResources + #undef cuGraphicsUnmapResources + #undef cuStreamWriteValue32 + #undef cuStreamWaitValue32 + #undef cuStreamWriteValue64 + #undef cuStreamWaitValue64 + #undef cuStreamBatchMemOp + #undef cuStreamWriteValue32_v2 + #undef cuStreamWaitValue32_v2 + #undef cuStreamWriteValue64_v2 + #undef cuStreamWaitValue64_v2 + #undef cuStreamBatchMemOp_v2 + #undef cuMemPrefetchAsync + #undef cuMemPrefetchAsync_v2 + #undef cuLaunchCooperativeKernel + #undef cuSignalExternalSemaphoresAsync + #undef cuWaitExternalSemaphoresAsync + #undef cuStreamBeginCapture + #undef cuStreamBeginCaptureToGraph + #undef cuStreamEndCapture + #undef cuStreamIsCapturing + #undef cuStreamGetCaptureInfo + #undef cuStreamGetCaptureInfo_v2 + #undef cuStreamGetCaptureInfo_v3 + #undef cuGraphInstantiateWithParams + #undef cuGraphExecUpdate + #undef cuGraphUpload + #undef cuGraphLaunch + #undef cuDevicePrimaryCtxRelease + #undef cuDevicePrimaryCtxReset + #undef cuDevicePrimaryCtxSetFlags + #undef cuIpcOpenMemHandle + #undef cuStreamCopyAttributes + #undef cuStreamSetAttribute + #undef cuStreamGetAttribute + #undef cuGraphInstantiate + #undef cuGraphAddKernelNode + #undef cuGraphKernelNodeGetParams + #undef cuGraphKernelNodeSetParams + #undef cuGraphExecKernelNodeSetParams + #undef cuMemMapArrayAsync + #undef cuMemFreeAsync + #undef cuMemAllocAsync + #undef cuMemAllocFromPoolAsync + #undef cuStreamUpdateCaptureDependencies + #undef cuStreamUpdateCaptureDependencies_v2 + #undef cuGetProcAddress + + CUresult CUDAAPI cuMemHostRegister(void *p, size_t bytesize, unsigned int Flags); + CUresult CUDAAPI cuGraphicsResourceSetMapFlags(CUgraphicsResource resource, unsigned int flags); + CUresult CUDAAPI cuLinkCreate(unsigned int numOptions, CUjit_option *options, void **optionValues, CUlinkState *stateOut); + CUresult CUDAAPI cuLinkAddData(CUlinkState state, CUjitInputType type, void *data, size_t size, const char *name, + unsigned int numOptions, CUjit_option *options, void **optionValues); + CUresult CUDAAPI cuLinkAddFile(CUlinkState state, CUjitInputType type, const char *path, + unsigned int numOptions, CUjit_option *options, void **optionValues); + CUresult CUDAAPI cuTexRefSetAddress2D_v2(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR *desc, CUdeviceptr dptr, size_t Pitch); + + typedef unsigned int CUdeviceptr_v1; + + typedef struct CUDA_MEMCPY2D_v1_st + { + unsigned int srcXInBytes; /**< Source X in bytes */ + unsigned int srcY; /**< Source Y */ + CUmemorytype srcMemoryType; /**< Source memory type (host, device, array) */ + const void *srcHost; /**< Source host pointer */ + CUdeviceptr_v1 srcDevice; /**< Source device pointer */ + CUarray srcArray; /**< Source array reference */ + unsigned int srcPitch; /**< Source pitch (ignored when src is array) */ + + unsigned int dstXInBytes; /**< Destination X in bytes */ + unsigned int dstY; /**< Destination Y */ + CUmemorytype dstMemoryType; /**< Destination memory type (host, device, array) */ + void *dstHost; /**< Destination host pointer */ + CUdeviceptr_v1 dstDevice; /**< Destination device pointer */ + CUarray dstArray; /**< Destination array reference */ + unsigned int dstPitch; /**< Destination pitch (ignored when dst is array) */ + + unsigned int WidthInBytes; /**< Width of 2D memory copy in bytes */ + unsigned int Height; /**< Height of 2D memory copy */ + } CUDA_MEMCPY2D_v1; + + typedef struct CUDA_MEMCPY3D_v1_st + { + unsigned int srcXInBytes; /**< Source X in bytes */ + unsigned int srcY; /**< Source Y */ + unsigned int srcZ; /**< Source Z */ + unsigned int srcLOD; /**< Source LOD */ + CUmemorytype srcMemoryType; /**< Source memory type (host, device, array) */ + const void *srcHost; /**< Source host pointer */ + CUdeviceptr_v1 srcDevice; /**< Source device pointer */ + CUarray srcArray; /**< Source array reference */ + void *reserved0; /**< Must be NULL */ + unsigned int srcPitch; /**< Source pitch (ignored when src is array) */ + unsigned int srcHeight; /**< Source height (ignored when src is array; may be 0 if Depth==1) */ + + unsigned int dstXInBytes; /**< Destination X in bytes */ + unsigned int dstY; /**< Destination Y */ + unsigned int dstZ; /**< Destination Z */ + unsigned int dstLOD; /**< Destination LOD */ + CUmemorytype dstMemoryType; /**< Destination memory type (host, device, array) */ + void *dstHost; /**< Destination host pointer */ + CUdeviceptr_v1 dstDevice; /**< Destination device pointer */ + CUarray dstArray; /**< Destination array reference */ + void *reserved1; /**< Must be NULL */ + unsigned int dstPitch; /**< Destination pitch (ignored when dst is array) */ + unsigned int dstHeight; /**< Destination height (ignored when dst is array; may be 0 if Depth==1) */ + + unsigned int WidthInBytes; /**< Width of 3D memory copy in bytes */ + unsigned int Height; /**< Height of 3D memory copy */ + unsigned int Depth; /**< Depth of 3D memory copy */ + } CUDA_MEMCPY3D_v1; + + typedef struct CUDA_ARRAY_DESCRIPTOR_v1_st + { + unsigned int Width; /**< Width of array */ + unsigned int Height; /**< Height of array */ + + CUarray_format Format; /**< Array format */ + unsigned int NumChannels; /**< Channels per array element */ + } CUDA_ARRAY_DESCRIPTOR_v1; + + typedef struct CUDA_ARRAY3D_DESCRIPTOR_v1_st + { + unsigned int Width; /**< Width of 3D array */ + unsigned int Height; /**< Height of 3D array */ + unsigned int Depth; /**< Depth of 3D array */ + + CUarray_format Format; /**< Array format */ + unsigned int NumChannels; /**< Channels per array element */ + unsigned int Flags; /**< Flags */ + } CUDA_ARRAY3D_DESCRIPTOR_v1; + + CUresult CUDAAPI cuDeviceTotalMem(unsigned int *bytes, CUdevice dev); + CUresult CUDAAPI cuCtxCreate(CUcontext *pctx, unsigned int flags, CUdevice dev); + CUresult CUDAAPI cuModuleGetGlobal(CUdeviceptr_v1 *dptr, unsigned int *bytes, CUmodule hmod, const char *name); + CUresult CUDAAPI cuMemGetInfo(unsigned int *free, unsigned int *total); + CUresult CUDAAPI cuMemAlloc(CUdeviceptr_v1 *dptr, unsigned int bytesize); + CUresult CUDAAPI cuMemAllocPitch(CUdeviceptr_v1 *dptr, unsigned int *pPitch, unsigned int WidthInBytes, unsigned int Height, unsigned int ElementSizeBytes); + CUresult CUDAAPI cuMemFree(CUdeviceptr_v1 dptr); + CUresult CUDAAPI cuMemGetAddressRange(CUdeviceptr_v1 *pbase, unsigned int *psize, CUdeviceptr_v1 dptr); + CUresult CUDAAPI cuMemAllocHost(void **pp, unsigned int bytesize); + CUresult CUDAAPI cuMemHostGetDevicePointer(CUdeviceptr_v1 *pdptr, void *p, unsigned int Flags); + CUresult CUDAAPI cuMemcpyHtoD(CUdeviceptr_v1 dstDevice, const void *srcHost, unsigned int ByteCount); + CUresult CUDAAPI cuMemcpyDtoH(void *dstHost, CUdeviceptr_v1 srcDevice, unsigned int ByteCount); + CUresult CUDAAPI cuMemcpyDtoD(CUdeviceptr_v1 dstDevice, CUdeviceptr_v1 srcDevice, unsigned int ByteCount); + CUresult CUDAAPI cuMemcpyDtoA(CUarray dstArray, unsigned int dstOffset, CUdeviceptr_v1 srcDevice, unsigned int ByteCount); + CUresult CUDAAPI cuMemcpyAtoD(CUdeviceptr_v1 dstDevice, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount); + CUresult CUDAAPI cuMemcpyHtoA(CUarray dstArray, unsigned int dstOffset, const void *srcHost, unsigned int ByteCount); + CUresult CUDAAPI cuMemcpyAtoH(void *dstHost, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount); + CUresult CUDAAPI cuMemcpyAtoA(CUarray dstArray, unsigned int dstOffset, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount); + CUresult CUDAAPI cuMemcpyHtoAAsync(CUarray dstArray, unsigned int dstOffset, const void *srcHost, unsigned int ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpyAtoHAsync(void *dstHost, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpy2D(const CUDA_MEMCPY2D_v1 *pCopy); + CUresult CUDAAPI cuMemcpy2DUnaligned(const CUDA_MEMCPY2D_v1 *pCopy); + CUresult CUDAAPI cuMemcpy3D(const CUDA_MEMCPY3D_v1 *pCopy); + CUresult CUDAAPI cuMemcpyHtoDAsync(CUdeviceptr_v1 dstDevice, const void *srcHost, unsigned int ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpyDtoHAsync(void *dstHost, CUdeviceptr_v1 srcDevice, unsigned int ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpyDtoDAsync(CUdeviceptr_v1 dstDevice, CUdeviceptr_v1 srcDevice, unsigned int ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpy2DAsync(const CUDA_MEMCPY2D_v1 *pCopy, CUstream hStream); + CUresult CUDAAPI cuMemcpy3DAsync(const CUDA_MEMCPY3D_v1 *pCopy, CUstream hStream); + CUresult CUDAAPI cuMemsetD8(CUdeviceptr_v1 dstDevice, unsigned char uc, unsigned int N); + CUresult CUDAAPI cuMemsetD16(CUdeviceptr_v1 dstDevice, unsigned short us, unsigned int N); + CUresult CUDAAPI cuMemsetD32(CUdeviceptr_v1 dstDevice, unsigned int ui, unsigned int N); + CUresult CUDAAPI cuMemsetD2D8(CUdeviceptr_v1 dstDevice, unsigned int dstPitch, unsigned char uc, unsigned int Width, unsigned int Height); + CUresult CUDAAPI cuMemsetD2D16(CUdeviceptr_v1 dstDevice, unsigned int dstPitch, unsigned short us, unsigned int Width, unsigned int Height); + CUresult CUDAAPI cuMemsetD2D32(CUdeviceptr_v1 dstDevice, unsigned int dstPitch, unsigned int ui, unsigned int Width, unsigned int Height); + CUresult CUDAAPI cuArrayCreate(CUarray *pHandle, const CUDA_ARRAY_DESCRIPTOR_v1 *pAllocateArray); + CUresult CUDAAPI cuArrayGetDescriptor(CUDA_ARRAY_DESCRIPTOR_v1 *pArrayDescriptor, CUarray hArray); + CUresult CUDAAPI cuArray3DCreate(CUarray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR_v1 *pAllocateArray); + CUresult CUDAAPI cuArray3DGetDescriptor(CUDA_ARRAY3D_DESCRIPTOR_v1 *pArrayDescriptor, CUarray hArray); + CUresult CUDAAPI cuTexRefSetAddress(unsigned int *ByteOffset, CUtexref hTexRef, CUdeviceptr_v1 dptr, unsigned int bytes); + CUresult CUDAAPI cuTexRefSetAddress2D(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR_v1 *desc, CUdeviceptr_v1 dptr, unsigned int Pitch); + CUresult CUDAAPI cuTexRefGetAddress(CUdeviceptr_v1 *pdptr, CUtexref hTexRef); + CUresult CUDAAPI cuGraphicsResourceGetMappedPointer(CUdeviceptr_v1 *pDevPtr, unsigned int *pSize, CUgraphicsResource resource); + + CUresult CUDAAPI cuCtxDestroy(CUcontext ctx); + CUresult CUDAAPI cuCtxPopCurrent(CUcontext *pctx); + CUresult CUDAAPI cuCtxPushCurrent(CUcontext ctx); + CUresult CUDAAPI cuStreamDestroy(CUstream hStream); + CUresult CUDAAPI cuEventDestroy(CUevent hEvent); + CUresult CUDAAPI cuDevicePrimaryCtxRelease(CUdevice dev); + CUresult CUDAAPI cuDevicePrimaryCtxReset(CUdevice dev); + CUresult CUDAAPI cuDevicePrimaryCtxSetFlags(CUdevice dev, unsigned int flags); + + CUresult CUDAAPI cuMemcpyHtoD_v2(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount); + CUresult CUDAAPI cuMemcpyDtoH_v2(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount); + CUresult CUDAAPI cuMemcpyDtoD_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount); + CUresult CUDAAPI cuMemcpyDtoA_v2(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount); + CUresult CUDAAPI cuMemcpyAtoD_v2(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount); + CUresult CUDAAPI cuMemcpyHtoA_v2(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount); + CUresult CUDAAPI cuMemcpyAtoH_v2(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount); + CUresult CUDAAPI cuMemcpyAtoA_v2(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount); + CUresult CUDAAPI cuMemcpyHtoAAsync_v2(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpyAtoHAsync_v2(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpy2D_v2(const CUDA_MEMCPY2D *pCopy); + CUresult CUDAAPI cuMemcpy2DUnaligned_v2(const CUDA_MEMCPY2D *pCopy); + CUresult CUDAAPI cuMemcpy3D_v2(const CUDA_MEMCPY3D *pCopy); + CUresult CUDAAPI cuMemcpyHtoDAsync_v2(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpyDtoHAsync_v2(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpyDtoDAsync_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpy2DAsync_v2(const CUDA_MEMCPY2D *pCopy, CUstream hStream); + CUresult CUDAAPI cuMemcpy3DAsync_v2(const CUDA_MEMCPY3D *pCopy, CUstream hStream); + CUresult CUDAAPI cuMemsetD8_v2(CUdeviceptr dstDevice, unsigned char uc, size_t N); + CUresult CUDAAPI cuMemsetD16_v2(CUdeviceptr dstDevice, unsigned short us, size_t N); + CUresult CUDAAPI cuMemsetD32_v2(CUdeviceptr dstDevice, unsigned int ui, size_t N); + CUresult CUDAAPI cuMemsetD2D8_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height); + CUresult CUDAAPI cuMemsetD2D16_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height); + CUresult CUDAAPI cuMemsetD2D32_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height); + CUresult CUDAAPI cuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount); + CUresult CUDAAPI cuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount); + CUresult CUDAAPI cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream); + CUresult CUDAAPI cuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER *pCopy); + CUresult CUDAAPI cuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER *pCopy, CUstream hStream); + + CUresult CUDAAPI cuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream); + CUresult CUDAAPI cuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream); + CUresult CUDAAPI cuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream); + CUresult CUDAAPI cuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream); + CUresult CUDAAPI cuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream); + CUresult CUDAAPI cuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream); + + CUresult CUDAAPI cuStreamGetPriority(CUstream hStream, int *priority); + CUresult CUDAAPI cuStreamGetId(CUstream hStream, unsigned long long *streamId); + CUresult CUDAAPI cuStreamGetFlags(CUstream hStream, unsigned int *flags); + CUresult CUDAAPI cuStreamGetCtx(CUstream hStream, CUcontext *pctx); + CUresult CUDAAPI cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags); + CUresult CUDAAPI cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void *userData, unsigned int flags); + CUresult CUDAAPI cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags); + CUresult CUDAAPI cuStreamQuery(CUstream hStream); + CUresult CUDAAPI cuStreamSynchronize(CUstream hStream); + CUresult CUDAAPI cuEventRecord(CUevent hEvent, CUstream hStream); + CUresult CUDAAPI cuEventRecordWithFlags(CUevent hEvent, CUstream hStream, unsigned int flags); + CUresult CUDAAPI cuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams, void **extra); + CUresult CUDAAPI cuLaunchKernelEx(const CUlaunchConfig *config, CUfunction f, void **kernelParams, void **extra); + CUresult CUDAAPI cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void *userData); + CUresult CUDAAPI cuGraphicsMapResources(unsigned int count, CUgraphicsResource *resources, CUstream hStream); + CUresult CUDAAPI cuGraphicsUnmapResources(unsigned int count, CUgraphicsResource *resources, CUstream hStream); + CUresult CUDAAPI cuStreamWriteValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags); + CUresult CUDAAPI cuStreamWaitValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags); + CUresult CUDAAPI cuStreamWriteValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags); + CUresult CUDAAPI cuStreamWaitValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags); + CUresult CUDAAPI cuStreamBatchMemOp(CUstream stream, unsigned int count, CUstreamBatchMemOpParams *paramArray, unsigned int flags); + + CUresult CUDAAPI cuStreamWriteValue32_ptsz(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags); + CUresult CUDAAPI cuStreamWaitValue32_ptsz(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags); + CUresult CUDAAPI cuStreamWriteValue64_ptsz(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags); + CUresult CUDAAPI cuStreamWaitValue64_ptsz(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags); + CUresult CUDAAPI cuStreamBatchMemOp_ptsz(CUstream stream, unsigned int count, CUstreamBatchMemOpParams *paramArray, unsigned int flags); + + CUresult CUDAAPI cuStreamWriteValue32_v2(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags); + CUresult CUDAAPI cuStreamWaitValue32_v2(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags); + CUresult CUDAAPI cuStreamWriteValue64_v2(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags); + CUresult CUDAAPI cuStreamWaitValue64_v2(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags); + CUresult CUDAAPI cuStreamBatchMemOp_v2(CUstream stream, unsigned int count, CUstreamBatchMemOpParams *paramArray, unsigned int flags); + CUresult CUDAAPI cuMemPrefetchAsync(CUdeviceptr devPtr, size_t count, CUdevice dstDevice, CUstream hStream); + CUresult CUDAAPI cuMemPrefetchAsync_v2(CUdeviceptr devPtr, size_t count, CUmemLocation location, unsigned int flags, CUstream hStream); + CUresult CUDAAPI cuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams); + CUresult CUDAAPI cuSignalExternalSemaphoresAsync(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS *paramsArray, unsigned int numExtSems, CUstream stream); + CUresult CUDAAPI cuWaitExternalSemaphoresAsync(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS *paramsArray, unsigned int numExtSems, CUstream stream); + CUresult CUDAAPI cuStreamBeginCapture(CUstream hStream); + CUresult CUDAAPI cuStreamBeginCapture_ptsz(CUstream hStream); + CUresult CUDAAPI cuStreamBeginCapture_v2(CUstream hStream, CUstreamCaptureMode mode); + CUresult CUDAAPI cuStreamBeginCaptureToGraph(CUstream hStream, CUgraph hGraph, const CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, CUstreamCaptureMode mode); + CUresult CUDAAPI cuStreamEndCapture(CUstream hStream, CUgraph *phGraph); + CUresult CUDAAPI cuStreamIsCapturing(CUstream hStream, CUstreamCaptureStatus *captureStatus); + CUresult CUDAAPI cuStreamGetCaptureInfo(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out); + CUresult CUDAAPI cuStreamGetCaptureInfo_ptsz(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out); + CUresult CUDAAPI cuStreamGetCaptureInfo_v2(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, size_t *numDependencies_out); + CUresult CUDAAPI cuStreamGetCaptureInfo_v3(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, const CUgraphEdgeData **edgeData_out, size_t *numDependencies_out); + CUresult CUDAAPI cuGraphAddKernelNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams); + CUresult CUDAAPI cuGraphKernelNodeGetParams(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams); + CUresult CUDAAPI cuGraphKernelNodeSetParams(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams); + CUresult CUDAAPI cuGraphExecKernelNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams); + CUresult CUDAAPI cuGraphInstantiateWithParams(CUgraphExec *phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS *instantiateParams); + CUresult CUDAAPI cuGraphExecUpdate(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphNode *hErrorNode_out, CUgraphExecUpdateResult *updateResult_out); + CUresult CUDAAPI cuGraphUpload(CUgraphExec hGraph, CUstream hStream); + CUresult CUDAAPI cuGraphLaunch(CUgraphExec hGraph, CUstream hStream); + CUresult CUDAAPI cuStreamCopyAttributes(CUstream dstStream, CUstream srcStream); + CUresult CUDAAPI cuStreamGetAttribute(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue *value); + CUresult CUDAAPI cuStreamSetAttribute(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue *param); + + CUresult CUDAAPI cuIpcOpenMemHandle(CUdeviceptr *pdptr, CUipcMemHandle handle, unsigned int Flags); + CUresult CUDAAPI cuGraphInstantiate(CUgraphExec *phGraphExec, CUgraph hGraph, CUgraphNode *phErrorNode, char *logBuffer, size_t bufferSize); + CUresult CUDAAPI cuGraphInstantiate_v2(CUgraphExec *phGraphExec, CUgraph hGraph, CUgraphNode *phErrorNode, char *logBuffer, size_t bufferSize); + + CUresult CUDAAPI cuMemMapArrayAsync(CUarrayMapInfo *mapInfoList, unsigned int count, CUstream hStream); + + CUresult CUDAAPI cuMemFreeAsync(CUdeviceptr dptr, CUstream hStream); + CUresult CUDAAPI cuMemAllocAsync(CUdeviceptr *dptr, size_t bytesize, CUstream hStream); + CUresult CUDAAPI cuMemAllocFromPoolAsync(CUdeviceptr *dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream); + + CUresult CUDAAPI cuStreamUpdateCaptureDependencies(CUstream hStream, CUgraphNode *dependencies, size_t numDependencies, unsigned int flags); + CUresult CUDAAPI cuStreamUpdateCaptureDependencies_v2(CUstream hStream, CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, unsigned int flags); + CUresult CUDAAPI cuGetProcAddress(const char *symbol, void **pfn, int cudaVersion, cuuint64_t flags); + +#elif defined(__CUDA_API_PER_THREAD_DEFAULT_STREAM) +static inline CUresult cuGetProcAddress_v2_ptsz(const char *symbol, void **funcPtr, int driverVersion, cuuint64_t flags, CUdriverProcAddressQueryResult *symbolStatus) { + const int procAddressMask = (CU_GET_PROC_ADDRESS_LEGACY_STREAM| + CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM); + if ((flags & procAddressMask) == 0) { + flags |= CU_GET_PROC_ADDRESS_PER_THREAD_DEFAULT_STREAM; + } + return cuGetProcAddress_v2(symbol, funcPtr, driverVersion, flags, symbolStatus); +} +#define cuGetProcAddress_v2 cuGetProcAddress_v2_ptsz +#endif + +#ifdef __cplusplus +} +#endif + +#if defined(__GNUC__) + #if defined(__CUDA_API_PUSH_VISIBILITY_DEFAULT) + #pragma GCC visibility pop + #endif +#endif + +#undef __CUDA_DEPRECATED + +#endif /* __cuda_cuda_h__ */ diff --git a/cuda_toolkit/include/cudaD3D10.h b/cuda_toolkit/include/cudaD3D10.h new file mode 100644 index 0000000000000000000000000000000000000000..c085d8968342bc5f9418930f1e6de77a20e9d2d6 --- /dev/null +++ b/cuda_toolkit/include/cudaD3D10.h @@ -0,0 +1,805 @@ +/* + * Copyright 1993-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CUDAD3D10_H +#define CUDAD3D10_H + +#if defined(__CUDA_API_VERSION_INTERNAL) || defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif + +#ifdef CUDA_FORCE_API_VERSION +#error "CUDA_FORCE_API_VERSION is no longer supported." +#endif + +#define cuD3D10CtxCreate cuD3D10CtxCreate_v2 +#define cuD3D10ResourceGetSurfaceDimensions cuD3D10ResourceGetSurfaceDimensions_v2 +#define cuD3D10ResourceGetMappedPointer cuD3D10ResourceGetMappedPointer_v2 +#define cuD3D10ResourceGetMappedSize cuD3D10ResourceGetMappedSize_v2 +#define cuD3D10ResourceGetMappedPitch cuD3D10ResourceGetMappedPitch_v2 + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \defgroup CUDA_D3D10 Direct3D 10 Interoperability + * \ingroup CUDA_DRIVER + * + * ___MANBRIEF___ Direct3D 10 interoperability functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the Direct3D 10 interoperability functions of the + * low-level CUDA driver application programming interface. Note that mapping + * of Direct3D 10 resources is performed with the graphics API agnostic, resource + * mapping interface described in \ref CUDA_GRAPHICS "Graphics Interoperability". + * + * @{ + */ + +/** + * CUDA devices corresponding to a D3D10 device + */ +typedef enum CUd3d10DeviceList_enum { + CU_D3D10_DEVICE_LIST_ALL = 0x01, /**< The CUDA devices for all GPUs used by a D3D10 device */ + CU_D3D10_DEVICE_LIST_CURRENT_FRAME = 0x02, /**< The CUDA devices for the GPUs used by a D3D10 device in its currently rendering frame */ + CU_D3D10_DEVICE_LIST_NEXT_FRAME = 0x03, /**< The CUDA devices for the GPUs to be used by a D3D10 device in the next frame */ +} CUd3d10DeviceList; + +/** + * \brief Gets the CUDA device corresponding to a display adapter. + * + * Returns in \p *pCudaDevice the CUDA-compatible device corresponding to the + * adapter \p pAdapter obtained from ::IDXGIFactory::EnumAdapters. + * + * If no device on \p pAdapter is CUDA-compatible then the call will fail. + * + * \param pCudaDevice - Returned CUDA device corresponding to \p pAdapter + * \param pAdapter - Adapter to query for CUDA device + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D10GetDevices, + * ::cudaD3D10GetDevice + */ +CUresult CUDAAPI cuD3D10GetDevice(CUdevice *pCudaDevice, IDXGIAdapter *pAdapter); + +/** + * \brief Gets the CUDA devices corresponding to a Direct3D 10 device + * + * Returns in \p *pCudaDeviceCount the number of CUDA-compatible device corresponding + * to the Direct3D 10 device \p pD3D10Device. + * Also returns in \p *pCudaDevices at most \p cudaDeviceCount of the CUDA-compatible devices + * corresponding to the Direct3D 10 device \p pD3D10Device. + * + * If any of the GPUs being used to render \p pDevice are not CUDA capable then the + * call will return ::CUDA_ERROR_NO_DEVICE. + * + * \param pCudaDeviceCount - Returned number of CUDA devices corresponding to \p pD3D10Device + * \param pCudaDevices - Returned CUDA devices corresponding to \p pD3D10Device + * \param cudaDeviceCount - The size of the output device array \p pCudaDevices + * \param pD3D10Device - Direct3D 10 device to query for CUDA devices + * \param deviceList - The set of devices to return. This set may be + * ::CU_D3D10_DEVICE_LIST_ALL for all devices, + * ::CU_D3D10_DEVICE_LIST_CURRENT_FRAME for the devices used to + * render the current frame (in SLI), or + * ::CU_D3D10_DEVICE_LIST_NEXT_FRAME for the devices used to + * render the next frame (in SLI). + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NO_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D10GetDevice, + * ::cudaD3D10GetDevices + */ +CUresult CUDAAPI cuD3D10GetDevices(unsigned int *pCudaDeviceCount, CUdevice *pCudaDevices, unsigned int cudaDeviceCount, ID3D10Device *pD3D10Device, CUd3d10DeviceList deviceList); + +/** + * \brief Register a Direct3D 10 resource for access by CUDA + * + * Registers the Direct3D 10 resource \p pD3DResource for access by CUDA and + * returns a CUDA handle to \p pD3Dresource in \p pCudaResource. + * The handle returned in \p pCudaResource may be used to map and unmap this + * resource until it is unregistered. + * On success this call will increase the internal reference count on + * \p pD3DResource. This reference count will be decremented when this + * resource is unregistered through ::cuGraphicsUnregisterResource(). + * + * This call is potentially high-overhead and should not be called every frame + * in interactive applications. + * + * The type of \p pD3DResource must be one of the following. + * - ::ID3D10Buffer: may be accessed through a device pointer. + * - ::ID3D10Texture1D: individual subresources of the texture may be accessed via arrays + * - ::ID3D10Texture2D: individual subresources of the texture may be accessed via arrays + * - ::ID3D10Texture3D: individual subresources of the texture may be accessed via arrays + * + * The \p Flags argument may be used to specify additional parameters at register + * time. The valid values for this parameter are + * - ::CU_GRAPHICS_REGISTER_FLAGS_NONE: Specifies no hints about how this + * resource will be used. + * - ::CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST: Specifies that CUDA will + * bind this resource to a surface reference. + * - ::CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER: Specifies that CUDA will perform + * texture gather operations on this resource. + * + * Not all Direct3D resources of the above types may be used for + * interoperability with CUDA. The following are some limitations. + * - The primary rendertarget may not be registered with CUDA. + * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, + * or 32-bit integer or floating-point data cannot be shared. + * - Surfaces of depth or stencil formats cannot be shared. + * + * A complete list of supported DXGI formats is as follows. For compactness the + * notation A_{B,C,D} represents A_B, A_C, and A_D. + * - DXGI_FORMAT_A8_UNORM + * - DXGI_FORMAT_B8G8R8A8_UNORM + * - DXGI_FORMAT_B8G8R8X8_UNORM + * - DXGI_FORMAT_R16_FLOAT + * - DXGI_FORMAT_R16G16B16A16_{FLOAT,SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R16G16_{FLOAT,SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R16_{SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R32_FLOAT + * - DXGI_FORMAT_R32G32B32A32_{FLOAT,SINT,UINT} + * - DXGI_FORMAT_R32G32_{FLOAT,SINT,UINT} + * - DXGI_FORMAT_R32_{SINT,UINT} + * - DXGI_FORMAT_R8G8B8A8_{SINT,SNORM,UINT,UNORM,UNORM_SRGB} + * - DXGI_FORMAT_R8G8_{SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R8_{SINT,SNORM,UINT,UNORM} + * + * If \p pD3DResource is of incorrect type or is already registered then + * ::CUDA_ERROR_INVALID_HANDLE is returned. + * If \p pD3DResource cannot be registered then ::CUDA_ERROR_UNKNOWN is returned. + * If \p Flags is not one of the above specified value then ::CUDA_ERROR_INVALID_VALUE + * is returned. + * + * \param pCudaResource - Returned graphics resource handle + * \param pD3DResource - Direct3D resource to register + * \param Flags - Parameters for resource registration + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuGraphicsUnregisterResource, + * ::cuGraphicsMapResources, + * ::cuGraphicsSubResourceGetMappedArray, + * ::cuGraphicsResourceGetMappedPointer, + * ::cudaGraphicsD3D10RegisterResource + */ +CUresult CUDAAPI cuGraphicsD3D10RegisterResource(CUgraphicsResource *pCudaResource, ID3D10Resource *pD3DResource, unsigned int Flags); + +/** + * \defgroup CUDA_D3D10_DEPRECATED Direct3D 10 Interoperability [DEPRECATED] + * + * ___MANBRIEF___ deprecated Direct3D 10 interoperability functions of the + * low-level CUDA driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes deprecated Direct3D 10 interoperability functionality. + * @{ + */ + +/** Flags to register a resource */ +typedef enum CUD3D10register_flags_enum { + CU_D3D10_REGISTER_FLAGS_NONE = 0x00, + CU_D3D10_REGISTER_FLAGS_ARRAY = 0x01, +} CUD3D10register_flags; + +/** Flags to map or unmap a resource */ +typedef enum CUD3D10map_flags_enum { + CU_D3D10_MAPRESOURCE_FLAGS_NONE = 0x00, + CU_D3D10_MAPRESOURCE_FLAGS_READONLY = 0x01, + CU_D3D10_MAPRESOURCE_FLAGS_WRITEDISCARD = 0x02, +} CUD3D10map_flags; + + +/** + * \brief Create a CUDA context for interoperability with Direct3D 10 + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA context with a D3D10 + * device in order to achieve maximum interoperability performance. + * + * \param pCtx - Returned newly created CUDA context + * \param pCudaDevice - Returned pointer to the device on which the context was created + * \param Flags - Context creation flags (see ::cuCtxCreate() for details) + * \param pD3DDevice - Direct3D device to create interoperability context with + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D10GetDevice, + * ::cuGraphicsD3D10RegisterResource + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10CtxCreate(CUcontext *pCtx, CUdevice *pCudaDevice, unsigned int Flags, ID3D10Device *pD3DDevice); + +/** + * \brief Create a CUDA context for interoperability with Direct3D 10 + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA context with a D3D10 + * device in order to achieve maximum interoperability performance. + * + * \param pCtx - Returned newly created CUDA context + * \param flags - Context creation flags (see ::cuCtxCreate() for details) + * \param pD3DDevice - Direct3D device to create interoperability context with + * \param cudaDevice - The CUDA device on which to create the context. This device + * must be among the devices returned when querying + * ::CU_D3D10_DEVICES_ALL from ::cuD3D10GetDevices. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D10GetDevices, + * ::cuGraphicsD3D10RegisterResource + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10CtxCreateOnDevice(CUcontext *pCtx, unsigned int flags, ID3D10Device *pD3DDevice, CUdevice cudaDevice); + +/** + * \brief Get the Direct3D 10 device against which the current CUDA context was + * created + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA context with a D3D10 + * device in order to achieve maximum interoperability performance. + * + * \param ppD3DDevice - Returned Direct3D device corresponding to CUDA context + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa + * ::cuD3D10GetDevice + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10GetDirect3DDevice(ID3D10Device **ppD3DDevice); + +/** + * \brief Register a Direct3D resource for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Registers the Direct3D resource \p pResource for access by CUDA. + * + * If this call is successful, then the application will be able to map and + * unmap this resource until it is unregistered through + * ::cuD3D10UnregisterResource(). Also on success, this call will increase the + * internal reference count on \p pResource. This reference count will be + * decremented when this resource is unregistered through + * ::cuD3D10UnregisterResource(). + * + * This call is potentially high-overhead and should not be called every frame + * in interactive applications. + * + * The type of \p pResource must be one of the following. + * + * - ::ID3D10Buffer: Cannot be used with \p Flags set to + * ::CU_D3D10_REGISTER_FLAGS_ARRAY. + * - ::ID3D10Texture1D: No restrictions. + * - ::ID3D10Texture2D: No restrictions. + * - ::ID3D10Texture3D: No restrictions. + * + * The \p Flags argument specifies the mechanism through which CUDA will + * access the Direct3D resource. The following values are allowed. + * + * - ::CU_D3D10_REGISTER_FLAGS_NONE: Specifies that CUDA will access this + * resource through a ::CUdeviceptr. The pointer, size, and (for textures), + * pitch for each subresource of this allocation may be queried through + * ::cuD3D10ResourceGetMappedPointer(), ::cuD3D10ResourceGetMappedSize(), + * and ::cuD3D10ResourceGetMappedPitch() respectively. This option is valid + * for all resource types. + * - ::CU_D3D10_REGISTER_FLAGS_ARRAY: Specifies that CUDA will access this + * resource through a ::CUarray queried on a sub-resource basis through + * ::cuD3D10ResourceGetMappedArray(). This option is only valid for + * resources of type ::ID3D10Texture1D, ::ID3D10Texture2D, and + * ::ID3D10Texture3D. + * + * Not all Direct3D resources of the above types may be used for + * interoperability with CUDA. The following are some limitations. + * + * - The primary rendertarget may not be registered with CUDA. + * - Resources allocated as shared may not be registered with CUDA. + * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, + * or 32-bit integer or floating-point data cannot be shared. + * - Surfaces of depth or stencil formats cannot be shared. + * + * If Direct3D interoperability is not initialized on this context then + * ::CUDA_ERROR_INVALID_CONTEXT is returned. If \p pResource is of incorrect + * type or is already registered, then ::CUDA_ERROR_INVALID_HANDLE is + * returned. If \p pResource cannot be registered, then ::CUDA_ERROR_UNKNOWN + * is returned. + * + * \param pResource - Resource to register + * \param Flags - Parameters for resource registration + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuGraphicsD3D10RegisterResource + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10RegisterResource(ID3D10Resource *pResource, unsigned int Flags); + +/** + * \brief Unregister a Direct3D resource + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unregisters the Direct3D resource \p pResource so it is not accessible by + * CUDA unless registered again. + * + * If \p pResource is not registered, then ::CUDA_ERROR_INVALID_HANDLE is + * returned. + * + * \param pResource - Resources to unregister + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuGraphicsUnregisterResource + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10UnregisterResource(ID3D10Resource *pResource); + +/** + * \brief Map Direct3D resources for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Maps the \p count Direct3D resources in \p ppResources for access by CUDA. + * + * The resources in \p ppResources may be accessed in CUDA kernels until they + * are unmapped. Direct3D should not access any resources while they are mapped + * by CUDA. If an application does so, the results are undefined. + * + * This function provides the synchronization guarantee that any Direct3D calls + * issued before ::cuD3D10MapResources() will complete before any CUDA kernels + * issued after ::cuD3D10MapResources() begin. + * + * If any of \p ppResources have not been registered for use with CUDA or if + * \p ppResources contains any duplicate entries, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If any of \p ppResources are + * presently mapped for access by CUDA, then ::CUDA_ERROR_ALREADY_MAPPED is + * returned. + * + * \param count - Number of resources to map for CUDA + * \param ppResources - Resources to map for CUDA + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ALREADY_MAPPED, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuGraphicsMapResources + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10MapResources(unsigned int count, ID3D10Resource **ppResources); + +/** + * \brief Unmap Direct3D resources + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unmaps the \p count Direct3D resources in \p ppResources. + * + * This function provides the synchronization guarantee that any CUDA kernels + * issued before ::cuD3D10UnmapResources() will complete before any Direct3D + * calls issued after ::cuD3D10UnmapResources() begin. + * + * If any of \p ppResources have not been registered for use with CUDA or if + * \p ppResources contains any duplicate entries, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If any of \p ppResources are not + * presently mapped for access by CUDA, then ::CUDA_ERROR_NOT_MAPPED is + * returned. + * + * \param count - Number of resources to unmap for CUDA + * \param ppResources - Resources to unmap for CUDA + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuGraphicsUnmapResources + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10UnmapResources(unsigned int count, ID3D10Resource **ppResources); + +/** + * \brief Set usage flags for mapping a Direct3D resource + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Set flags for mapping the Direct3D resource \p pResource. + * + * Changes to flags will take effect the next time \p pResource is mapped. The + * \p Flags argument may be any of the following. + * + * - ::CU_D3D10_MAPRESOURCE_FLAGS_NONE: Specifies no hints about how this + * resource will be used. It is therefore assumed that this resource will be + * read from and written to by CUDA kernels. This is the default value. + * - ::CU_D3D10_MAPRESOURCE_FLAGS_READONLY: Specifies that CUDA kernels which + * access this resource will not write to this resource. + * - ::CU_D3D10_MAPRESOURCE_FLAGS_WRITEDISCARD: Specifies that CUDA kernels + * which access this resource will not read from this resource and will + * write over the entire contents of the resource, so none of the data + * previously stored in the resource will be preserved. + * + * If \p pResource has not been registered for use with CUDA, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p pResource is presently + * mapped for access by CUDA then ::CUDA_ERROR_ALREADY_MAPPED is returned. + * + * \param pResource - Registered resource to set flags for + * \param Flags - Parameters for resource mapping + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ALREADY_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsResourceSetMapFlags + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10ResourceSetMapFlags(ID3D10Resource *pResource, unsigned int Flags); + +/** + * \brief Get an array through which to access a subresource of a Direct3D + * resource which has been mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pArray an array through which the subresource of the mapped + * Direct3D resource \p pResource, which corresponds to \p SubResource may be + * accessed. The value set in \p pArray may change every time that \p pResource + * is mapped. + * + * If \p pResource is not registered, then ::CUDA_ERROR_INVALID_HANDLE is + * returned. If \p pResource was not registered with usage flags + * ::CU_D3D10_REGISTER_FLAGS_ARRAY, then ::CUDA_ERROR_INVALID_HANDLE is + * returned. If \p pResource is not mapped, then ::CUDA_ERROR_NOT_MAPPED is + * returned. + * + * For usage requirements of the \p SubResource parameter, see + * ::cuD3D10ResourceGetMappedPointer(). + * + * \param pArray - Returned array corresponding to subresource + * \param pResource - Mapped resource to access + * \param SubResource - Subresource of pResource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsSubResourceGetMappedArray + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10ResourceGetMappedArray(CUarray *pArray, ID3D10Resource *pResource, unsigned int SubResource); + +/** + * \brief Get a pointer through which to access a subresource of a Direct3D + * resource which has been mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pDevPtr the base pointer of the subresource of the mapped + * Direct3D resource \p pResource, which corresponds to \p SubResource. The + * value set in \p pDevPtr may change every time that \p pResource is mapped. + * + * If \p pResource is not registered, then ::CUDA_ERROR_INVALID_HANDLE is + * returned. If \p pResource was not registered with usage flags + * ::CU_D3D10_REGISTER_FLAGS_NONE, then ::CUDA_ERROR_INVALID_HANDLE is + * returned. If \p pResource is not mapped, then ::CUDA_ERROR_NOT_MAPPED is + * returned. + * + * If \p pResource is of type ::ID3D10Buffer, then \p SubResource must be 0. + * If \p pResource is of any other type, then the value of \p SubResource must + * come from the subresource calculation in ::D3D10CalcSubResource(). + * + * \param pDevPtr - Returned pointer corresponding to subresource + * \param pResource - Mapped resource to access + * \param SubResource - Subresource of pResource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsResourceGetMappedPointer + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10ResourceGetMappedPointer(CUdeviceptr *pDevPtr, ID3D10Resource *pResource, unsigned int SubResource); + +/** + * \brief Get the size of a subresource of a Direct3D resource which has been + * mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pSize the size of the subresource of the mapped Direct3D + * resource \p pResource, which corresponds to \p SubResource. The value set + * in \p pSize may change every time that \p pResource is mapped. + * + * If \p pResource has not been registered for use with CUDA, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p pResource was not registered + * with usage flags ::CU_D3D10_REGISTER_FLAGS_NONE, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p pResource is not mapped for + * access by CUDA, then ::CUDA_ERROR_NOT_MAPPED is returned. + * + * For usage requirements of the \p SubResource parameter, see + * ::cuD3D10ResourceGetMappedPointer(). + * + * \param pSize - Returned size of subresource + * \param pResource - Mapped resource to access + * \param SubResource - Subresource of pResource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsResourceGetMappedPointer + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10ResourceGetMappedSize(size_t *pSize, ID3D10Resource *pResource, unsigned int SubResource); + +/** + * \brief Get the pitch of a subresource of a Direct3D resource which has been + * mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pPitch and \p *pPitchSlice the pitch and Z-slice pitch of the + * subresource of the mapped Direct3D resource \p pResource, which corresponds + * to \p SubResource. The values set in \p pPitch and \p pPitchSlice may + * change every time that \p pResource is mapped. + * + * The pitch and Z-slice pitch values may be used to compute the location of a + * sample on a surface as follows. + * + * For a 2D surface, the byte offset of the sample at position \b x, \b y from + * the base pointer of the surface is: + * + * \b y * \b pitch + (bytes per pixel) * \b x + * + * For a 3D surface, the byte offset of the sample at position \b x, \b y, + * \b z from the base pointer of the surface is: + * + * \b z* \b slicePitch + \b y * \b pitch + (bytes per pixel) * \b x + * + * Both parameters \p pPitch and \p pPitchSlice are optional and may be set to + * NULL. + * + * If \p pResource is not of type ::IDirect3DBaseTexture10 or one of its + * sub-types or if \p pResource has not been registered for use with CUDA, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p pResource was not registered + * with usage flags ::CU_D3D10_REGISTER_FLAGS_NONE, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p pResource is not mapped for + * access by CUDA, then ::CUDA_ERROR_NOT_MAPPED is returned. + * + * For usage requirements of the \p SubResource parameter, see + * ::cuD3D10ResourceGetMappedPointer(). + * + * \param pPitch - Returned pitch of subresource + * \param pPitchSlice - Returned Z-slice pitch of subresource + * \param pResource - Mapped resource to access + * \param SubResource - Subresource of pResource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsSubResourceGetMappedArray + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10ResourceGetMappedPitch(size_t *pPitch, size_t *pPitchSlice, ID3D10Resource *pResource, unsigned int SubResource); + +/** + * \brief Get the dimensions of a registered surface + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pWidth, \p *pHeight, and \p *pDepth the dimensions of the + * subresource of the mapped Direct3D resource \p pResource, which corresponds + * to \p SubResource. + * + * Because anti-aliased surfaces may have multiple samples per pixel, it is + * possible that the dimensions of a resource will be an integer factor larger + * than the dimensions reported by the Direct3D runtime. + * + * The parameters \p pWidth, \p pHeight, and \p pDepth are optional. For 2D + * surfaces, the value returned in \p *pDepth will be 0. + * + * If \p pResource is not of type ::IDirect3DBaseTexture10 or + * ::IDirect3DSurface10 or if \p pResource has not been registered for use + * with CUDA, then ::CUDA_ERROR_INVALID_HANDLE is returned. + * + * For usage requirements of the \p SubResource parameter, see + * ::cuD3D10ResourceGetMappedPointer(). + * + * \param pWidth - Returned width of surface + * \param pHeight - Returned height of surface + * \param pDepth - Returned depth of surface + * \param pResource - Registered resource to access + * \param SubResource - Subresource of pResource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuGraphicsSubResourceGetMappedArray + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D10ResourceGetSurfaceDimensions(size_t *pWidth, size_t *pHeight, size_t *pDepth, ID3D10Resource *pResource, unsigned int SubResource); + +/** @} */ /* END CUDA_D3D10_DEPRECATED */ +/** @} */ /* END CUDA_D3D10 */ + + +#if defined(__CUDA_API_VERSION_INTERNAL) + #undef cuD3D10CtxCreate + #undef cuD3D10ResourceGetSurfaceDimensions + #undef cuD3D10ResourceGetMappedPointer + #undef cuD3D10ResourceGetMappedSize + #undef cuD3D10ResourceGetMappedPitch + + CUresult CUDAAPI cuD3D10CtxCreate(CUcontext *pCtx, CUdevice *pCudaDevice, unsigned int Flags, ID3D10Device *pD3DDevice); + CUresult CUDAAPI cuD3D10ResourceGetMappedPitch(unsigned int *pPitch, unsigned int *pPitchSlice, ID3D10Resource *pResource, unsigned int SubResource); + CUresult CUDAAPI cuD3D10ResourceGetMappedPointer(CUdeviceptr_v1 *pDevPtr, ID3D10Resource *pResource, unsigned int SubResource); + CUresult CUDAAPI cuD3D10ResourceGetMappedSize(unsigned int *pSize, ID3D10Resource *pResource, unsigned int SubResource); + CUresult CUDAAPI cuD3D10ResourceGetSurfaceDimensions(unsigned int *pWidth, unsigned int *pHeight, unsigned int *pDepth, ID3D10Resource *pResource, unsigned int SubResource); +#endif /* __CUDA_API_VERSION_INTERNAL */ + +#ifdef __cplusplus +}; +#endif + +#undef __CUDA_DEPRECATED + +#endif + diff --git a/cuda_toolkit/include/cudaD3D10Typedefs.h b/cuda_toolkit/include/cudaD3D10Typedefs.h new file mode 100644 index 0000000000000000000000000000000000000000..048202683bfeca0ca0e398d05472ef0c62095790 --- /dev/null +++ b/cuda_toolkit/include/cudaD3D10Typedefs.h @@ -0,0 +1,119 @@ +/* + * Copyright 2020-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CUDAD3D10TYPEDEFS_H +#define CUDAD3D10TYPEDEFS_H + +// Dependent includes for cudaD3D10.h +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/* + * Macros for the latest version for each driver function in cudaD3D10.h + */ +#define PFN_cuD3D10GetDevice PFN_cuD3D10GetDevice_v2010 +#define PFN_cuD3D10GetDevices PFN_cuD3D10GetDevices_v3020 +#define PFN_cuGraphicsD3D10RegisterResource PFN_cuGraphicsD3D10RegisterResource_v3000 +#define PFN_cuD3D10CtxCreate PFN_cuD3D10CtxCreate_v3020 +#define PFN_cuD3D10CtxCreateOnDevice PFN_cuD3D10CtxCreateOnDevice_v3020 +#define PFN_cuD3D10GetDirect3DDevice PFN_cuD3D10GetDirect3DDevice_v3020 +#define PFN_cuD3D10RegisterResource PFN_cuD3D10RegisterResource_v2010 +#define PFN_cuD3D10UnregisterResource PFN_cuD3D10UnregisterResource_v2010 +#define PFN_cuD3D10MapResources PFN_cuD3D10MapResources_v2010 +#define PFN_cuD3D10UnmapResources PFN_cuD3D10UnmapResources_v2010 +#define PFN_cuD3D10ResourceSetMapFlags PFN_cuD3D10ResourceSetMapFlags_v2010 +#define PFN_cuD3D10ResourceGetMappedArray PFN_cuD3D10ResourceGetMappedArray_v2010 +#define PFN_cuD3D10ResourceGetMappedPointer PFN_cuD3D10ResourceGetMappedPointer_v3020 +#define PFN_cuD3D10ResourceGetMappedSize PFN_cuD3D10ResourceGetMappedSize_v3020 +#define PFN_cuD3D10ResourceGetMappedPitch PFN_cuD3D10ResourceGetMappedPitch_v3020 +#define PFN_cuD3D10ResourceGetSurfaceDimensions PFN_cuD3D10ResourceGetSurfaceDimensions_v3020 + + +/** + * Type definitions for functions defined in cudaD3D10.h + */ +typedef CUresult (CUDAAPI *PFN_cuD3D10GetDevice_v2010)(CUdevice_v1 *pCudaDevice, IDXGIAdapter *pAdapter); +typedef CUresult (CUDAAPI *PFN_cuD3D10GetDevices_v3020)(unsigned int *pCudaDeviceCount, CUdevice_v1 *pCudaDevices, unsigned int cudaDeviceCount, ID3D10Device *pD3D10Device, CUd3d10DeviceList deviceList); +typedef CUresult (CUDAAPI *PFN_cuGraphicsD3D10RegisterResource_v3000)(CUgraphicsResource *pCudaResource, ID3D10Resource *pD3DResource, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuD3D10CtxCreate_v3020)(CUcontext *pCtx, CUdevice_v1 *pCudaDevice, unsigned int Flags, ID3D10Device *pD3DDevice); +typedef CUresult (CUDAAPI *PFN_cuD3D10CtxCreateOnDevice_v3020)(CUcontext *pCtx, unsigned int flags, ID3D10Device *pD3DDevice, CUdevice_v1 cudaDevice); +typedef CUresult (CUDAAPI *PFN_cuD3D10GetDirect3DDevice_v3020)(ID3D10Device **ppD3DDevice); +typedef CUresult (CUDAAPI *PFN_cuD3D10RegisterResource_v2010)(ID3D10Resource *pResource, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuD3D10UnregisterResource_v2010)(ID3D10Resource *pResource); +typedef CUresult (CUDAAPI *PFN_cuD3D10MapResources_v2010)(unsigned int count, ID3D10Resource **ppResources); +typedef CUresult (CUDAAPI *PFN_cuD3D10UnmapResources_v2010)(unsigned int count, ID3D10Resource **ppResources); +typedef CUresult (CUDAAPI *PFN_cuD3D10ResourceSetMapFlags_v2010)(ID3D10Resource *pResource, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuD3D10ResourceGetMappedArray_v2010)(CUarray *pArray, ID3D10Resource *pResource, unsigned int SubResource); +typedef CUresult (CUDAAPI *PFN_cuD3D10ResourceGetMappedPointer_v3020)(CUdeviceptr_v2 *pDevPtr, ID3D10Resource *pResource, unsigned int SubResource); +typedef CUresult (CUDAAPI *PFN_cuD3D10ResourceGetMappedSize_v3020)(size_t *pSize, ID3D10Resource *pResource, unsigned int SubResource); +typedef CUresult (CUDAAPI *PFN_cuD3D10ResourceGetMappedPitch_v3020)(size_t *pPitch, size_t *pPitchSlice, ID3D10Resource *pResource, unsigned int SubResource); +typedef CUresult (CUDAAPI *PFN_cuD3D10ResourceGetSurfaceDimensions_v3020)(size_t *pWidth, size_t *pHeight, size_t *pDepth, ID3D10Resource *pResource, unsigned int SubResource); + +/* + * Type definitions for older versioned functions in cudaD3D10.h + */ +#if defined(__CUDA_API_VERSION_INTERNAL) + typedef CUresult (CUDAAPI *PFN_cuD3D10CtxCreate_v2010)(CUcontext *pCtx, CUdevice_v1 *pCudaDevice, unsigned int Flags, ID3D10Device *pD3DDevice); + typedef CUresult (CUDAAPI *PFN_cuD3D10ResourceGetMappedPitch_v2010)(unsigned int *pPitch, unsigned int *pPitchSlice, ID3D10Resource *pResource, unsigned int SubResource); + typedef CUresult (CUDAAPI *PFN_cuD3D10ResourceGetMappedPointer_v2010)(CUdeviceptr_v1 *pDevPtr, ID3D10Resource *pResource, unsigned int SubResource); + typedef CUresult (CUDAAPI *PFN_cuD3D10ResourceGetMappedSize_v2010)(unsigned int *pSize, ID3D10Resource *pResource, unsigned int SubResource); + typedef CUresult (CUDAAPI *PFN_cuD3D10ResourceGetSurfaceDimensions_v2010)(unsigned int *pWidth, unsigned int *pHeight, unsigned int *pDepth, ID3D10Resource *pResource, unsigned int SubResource); +#endif + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // file guard diff --git a/cuda_toolkit/include/cudaD3D11.h b/cuda_toolkit/include/cudaD3D11.h new file mode 100644 index 0000000000000000000000000000000000000000..fc9a0941e433b9274992df357d731b8f5ee8f50e --- /dev/null +++ b/cuda_toolkit/include/cudaD3D11.h @@ -0,0 +1,357 @@ +/* + * Copyright 1993-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CUDAD3D11_H +#define CUDAD3D11_H + +#if defined(__CUDA_API_VERSION_INTERNAL) || defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif + +#ifdef CUDA_FORCE_API_VERSION +#error "CUDA_FORCE_API_VERSION is no longer supported." +#endif + +#define cuD3D11CtxCreate cuD3D11CtxCreate_v2 + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \defgroup CUDA_D3D11 Direct3D 11 Interoperability + * \ingroup CUDA_DRIVER + * + * ___MANBRIEF___ Direct3D 11 interoperability functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the Direct3D 11 interoperability functions of the + * low-level CUDA driver application programming interface. Note that mapping + * of Direct3D 11 resources is performed with the graphics API agnostic, resource + * mapping interface described in \ref CUDA_GRAPHICS "Graphics Interoperability". + * + * @{ + */ + +/** + * CUDA devices corresponding to a D3D11 device + */ +typedef enum CUd3d11DeviceList_enum { + CU_D3D11_DEVICE_LIST_ALL = 0x01, /**< The CUDA devices for all GPUs used by a D3D11 device */ + CU_D3D11_DEVICE_LIST_CURRENT_FRAME = 0x02, /**< The CUDA devices for the GPUs used by a D3D11 device in its currently rendering frame */ + CU_D3D11_DEVICE_LIST_NEXT_FRAME = 0x03, /**< The CUDA devices for the GPUs to be used by a D3D11 device in the next frame */ +} CUd3d11DeviceList; + +/** + * \brief Gets the CUDA device corresponding to a display adapter. + * + * Returns in \p *pCudaDevice the CUDA-compatible device corresponding to the + * adapter \p pAdapter obtained from ::IDXGIFactory::EnumAdapters. + * + * If no device on \p pAdapter is CUDA-compatible the call will return + * ::CUDA_ERROR_NO_DEVICE. + * + * \param pCudaDevice - Returned CUDA device corresponding to \p pAdapter + * \param pAdapter - Adapter to query for CUDA device + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NO_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D11GetDevices, + * ::cudaD3D11GetDevice + */ +CUresult CUDAAPI cuD3D11GetDevice(CUdevice *pCudaDevice, IDXGIAdapter *pAdapter); + +/** + * \brief Gets the CUDA devices corresponding to a Direct3D 11 device + * + * Returns in \p *pCudaDeviceCount the number of CUDA-compatible device corresponding + * to the Direct3D 11 device \p pD3D11Device. + * Also returns in \p *pCudaDevices at most \p cudaDeviceCount of the CUDA-compatible devices + * corresponding to the Direct3D 11 device \p pD3D11Device. + * + * If any of the GPUs being used to render \p pDevice are not CUDA capable then the + * call will return ::CUDA_ERROR_NO_DEVICE. + * + * \param pCudaDeviceCount - Returned number of CUDA devices corresponding to \p pD3D11Device + * \param pCudaDevices - Returned CUDA devices corresponding to \p pD3D11Device + * \param cudaDeviceCount - The size of the output device array \p pCudaDevices + * \param pD3D11Device - Direct3D 11 device to query for CUDA devices + * \param deviceList - The set of devices to return. This set may be + * ::CU_D3D11_DEVICE_LIST_ALL for all devices, + * ::CU_D3D11_DEVICE_LIST_CURRENT_FRAME for the devices used to + * render the current frame (in SLI), or + * ::CU_D3D11_DEVICE_LIST_NEXT_FRAME for the devices used to + * render the next frame (in SLI). + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NO_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D11GetDevice, + * ::cudaD3D11GetDevices + */ +CUresult CUDAAPI cuD3D11GetDevices(unsigned int *pCudaDeviceCount, CUdevice *pCudaDevices, unsigned int cudaDeviceCount, ID3D11Device *pD3D11Device, CUd3d11DeviceList deviceList); + +/** + * \brief Register a Direct3D 11 resource for access by CUDA + * + * Registers the Direct3D 11 resource \p pD3DResource for access by CUDA and + * returns a CUDA handle to \p pD3Dresource in \p pCudaResource. + * The handle returned in \p pCudaResource may be used to map and unmap this + * resource until it is unregistered. + * On success this call will increase the internal reference count on + * \p pD3DResource. This reference count will be decremented when this + * resource is unregistered through ::cuGraphicsUnregisterResource(). + * + * This call is potentially high-overhead and should not be called every frame + * in interactive applications. + * + * The type of \p pD3DResource must be one of the following. + * - ::ID3D11Buffer: may be accessed through a device pointer. + * - ::ID3D11Texture1D: individual subresources of the texture may be accessed via arrays + * - ::ID3D11Texture2D: individual subresources of the texture may be accessed via arrays + * - ::ID3D11Texture3D: individual subresources of the texture may be accessed via arrays + * + * The \p Flags argument may be used to specify additional parameters at register + * time. The valid values for this parameter are + * - ::CU_GRAPHICS_REGISTER_FLAGS_NONE: Specifies no hints about how this + * resource will be used. + * - ::CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST: Specifies that CUDA will + * bind this resource to a surface reference. + * - ::CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER: Specifies that CUDA will perform + * texture gather operations on this resource. + * + * Not all Direct3D resources of the above types may be used for + * interoperability with CUDA. The following are some limitations. + * - The primary rendertarget may not be registered with CUDA. + * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, + * or 32-bit integer or floating-point data cannot be shared. + * - Surfaces of depth or stencil formats cannot be shared. + * + * A complete list of supported DXGI formats is as follows. For compactness the + * notation A_{B,C,D} represents A_B, A_C, and A_D. + * - DXGI_FORMAT_A8_UNORM + * - DXGI_FORMAT_B8G8R8A8_UNORM + * - DXGI_FORMAT_B8G8R8X8_UNORM + * - DXGI_FORMAT_R16_FLOAT + * - DXGI_FORMAT_R16G16B16A16_{FLOAT,SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R16G16_{FLOAT,SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R16_{SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R32_FLOAT + * - DXGI_FORMAT_R32G32B32A32_{FLOAT,SINT,UINT} + * - DXGI_FORMAT_R32G32_{FLOAT,SINT,UINT} + * - DXGI_FORMAT_R32_{SINT,UINT} + * - DXGI_FORMAT_R8G8B8A8_{SINT,SNORM,UINT,UNORM,UNORM_SRGB} + * - DXGI_FORMAT_R8G8_{SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R8_{SINT,SNORM,UINT,UNORM} + * + * If \p pD3DResource is of incorrect type or is already registered then + * ::CUDA_ERROR_INVALID_HANDLE is returned. + * If \p pD3DResource cannot be registered then ::CUDA_ERROR_UNKNOWN is returned. + * If \p Flags is not one of the above specified value then ::CUDA_ERROR_INVALID_VALUE + * is returned. + * + * \param pCudaResource - Returned graphics resource handle + * \param pD3DResource - Direct3D resource to register + * \param Flags - Parameters for resource registration + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuGraphicsUnregisterResource, + * ::cuGraphicsMapResources, + * ::cuGraphicsSubResourceGetMappedArray, + * ::cuGraphicsResourceGetMappedPointer, + * ::cudaGraphicsD3D11RegisterResource + */ +CUresult CUDAAPI cuGraphicsD3D11RegisterResource(CUgraphicsResource *pCudaResource, ID3D11Resource *pD3DResource, unsigned int Flags); + +/** + * \defgroup CUDA_D3D11_DEPRECATED Direct3D 11 Interoperability [DEPRECATED] + * + * ___MANBRIEF___ deprecated Direct3D 11 interoperability functions of the + * low-level CUDA driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes deprecated Direct3D 11 interoperability functionality. + * @{ + */ + +/** + * \brief Create a CUDA context for interoperability with Direct3D 11 + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA context with a D3D11 + * device in order to achieve maximum interoperability performance. + * + * \param pCtx - Returned newly created CUDA context + * \param pCudaDevice - Returned pointer to the device on which the context was created + * \param Flags - Context creation flags (see ::cuCtxCreate() for details) + * \param pD3DDevice - Direct3D device to create interoperability context with + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D11GetDevice, + * ::cuGraphicsD3D11RegisterResource + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D11CtxCreate(CUcontext *pCtx, CUdevice *pCudaDevice, unsigned int Flags, ID3D11Device *pD3DDevice); + +/** + * \brief Create a CUDA context for interoperability with Direct3D 11 + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA context with a D3D11 + * device in order to achieve maximum interoperability performance. + * + * \param pCtx - Returned newly created CUDA context + * \param flags - Context creation flags (see ::cuCtxCreate() for details) + * \param pD3DDevice - Direct3D device to create interoperability context with + * \param cudaDevice - The CUDA device on which to create the context. This device + * must be among the devices returned when querying + * ::CU_D3D11_DEVICES_ALL from ::cuD3D11GetDevices. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D11GetDevices, + * ::cuGraphicsD3D11RegisterResource + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D11CtxCreateOnDevice(CUcontext *pCtx, unsigned int flags, ID3D11Device *pD3DDevice, CUdevice cudaDevice); + +/** + * \brief Get the Direct3D 11 device against which the current CUDA context was + * created + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA context with a D3D11 + * device in order to achieve maximum interoperability performance. + * + * \param ppD3DDevice - Returned Direct3D device corresponding to CUDA context + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa + * ::cuD3D11GetDevice + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D11GetDirect3DDevice(ID3D11Device **ppD3DDevice); + +/** @} */ /* END CUDA_D3D11_DEPRECATED */ +/** @} */ /* END CUDA_D3D11 */ + + +#if defined(__CUDA_API_VERSION_INTERNAL) + #undef cuD3D11CtxCreate + + CUresult CUDAAPI cuD3D11CtxCreate(CUcontext *pCtx, CUdevice *pCudaDevice, unsigned int Flags, ID3D11Device *pD3DDevice); +#endif /* __CUDA_API_VERSION_INTERNAL */ + +#ifdef __cplusplus +}; +#endif + +#undef __CUDA_DEPRECATED + +#endif + diff --git a/cuda_toolkit/include/cudaD3D11Typedefs.h b/cuda_toolkit/include/cudaD3D11Typedefs.h new file mode 100644 index 0000000000000000000000000000000000000000..2f02831675d77b1a3073b2fb1910031769d654b7 --- /dev/null +++ b/cuda_toolkit/include/cudaD3D11Typedefs.h @@ -0,0 +1,92 @@ +/* + * Copyright 2020-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CUDAD3D11TYPEDEFS_H +#define CUDAD3D11TYPEDEFS_H + +// Dependent includes for cudaD3D11.h +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/* + * Macros for the latest version for each driver function in cudaD3D11.h + */ +#define PFN_cuD3D11GetDevice PFN_cuD3D11GetDevice_v3000 +#define PFN_cuD3D11GetDevices PFN_cuD3D11GetDevices_v3020 +#define PFN_cuGraphicsD3D11RegisterResource PFN_cuGraphicsD3D11RegisterResource_v3000 +#define PFN_cuD3D11CtxCreate PFN_cuD3D11CtxCreate_v3020 +#define PFN_cuD3D11CtxCreateOnDevice PFN_cuD3D11CtxCreateOnDevice_v3020 +#define PFN_cuD3D11GetDirect3DDevice PFN_cuD3D11GetDirect3DDevice_v3020 + + +/** + * Type definitions for functions defined in cudaD3D11.h + */ +typedef CUresult (CUDAAPI *PFN_cuD3D11GetDevice_v3000)(CUdevice_v1 *pCudaDevice, IDXGIAdapter *pAdapter); +typedef CUresult (CUDAAPI *PFN_cuD3D11GetDevices_v3020)(unsigned int *pCudaDeviceCount, CUdevice_v1 *pCudaDevices, unsigned int cudaDeviceCount, ID3D11Device *pD3D11Device, CUd3d11DeviceList deviceList); +typedef CUresult (CUDAAPI *PFN_cuGraphicsD3D11RegisterResource_v3000)(CUgraphicsResource *pCudaResource, ID3D11Resource *pD3DResource, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuD3D11CtxCreate_v3020)(CUcontext *pCtx, CUdevice_v1 *pCudaDevice, unsigned int Flags, ID3D11Device *pD3DDevice); +typedef CUresult (CUDAAPI *PFN_cuD3D11CtxCreateOnDevice_v3020)(CUcontext *pCtx, unsigned int flags, ID3D11Device *pD3DDevice, CUdevice_v1 cudaDevice); +typedef CUresult (CUDAAPI *PFN_cuD3D11GetDirect3DDevice_v3020)(ID3D11Device **ppD3DDevice); + +#if defined(__CUDA_API_VERSION_INTERNAL) + typedef CUresult (CUDAAPI *PFN_cuD3D11CtxCreate_v3000)(CUcontext *pCtx, CUdevice_v1 *pCudaDevice, unsigned int Flags, ID3D11Device *pD3DDevice); +#endif + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // file guard diff --git a/cuda_toolkit/include/cudaD3D9.h b/cuda_toolkit/include/cudaD3D9.h new file mode 100644 index 0000000000000000000000000000000000000000..57426abceb192efa02c099aea2e0b3fd22a8379d --- /dev/null +++ b/cuda_toolkit/include/cudaD3D9.h @@ -0,0 +1,886 @@ +/* + * Copyright 1993-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CUDAD3D9_H +#define CUDAD3D9_H + +#if defined(__CUDA_API_VERSION_INTERNAL) || defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif + +#ifdef CUDA_FORCE_API_VERSION +#error "CUDA_FORCE_API_VERSION is no longer supported." +#endif + +#define cuD3D9CtxCreate cuD3D9CtxCreate_v2 +#define cuD3D9ResourceGetSurfaceDimensions cuD3D9ResourceGetSurfaceDimensions_v2 +#define cuD3D9ResourceGetMappedPointer cuD3D9ResourceGetMappedPointer_v2 +#define cuD3D9ResourceGetMappedSize cuD3D9ResourceGetMappedSize_v2 +#define cuD3D9ResourceGetMappedPitch cuD3D9ResourceGetMappedPitch_v2 +#define cuD3D9MapVertexBuffer cuD3D9MapVertexBuffer_v2 + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file cudaD3D9.h + * \brief Header file for the Direct3D 9 interoperability functions of the + * low-level CUDA driver application programming interface. + */ + +/** + * \defgroup CUDA_D3D9 Direct3D 9 Interoperability + * \ingroup CUDA_DRIVER + * + * ___MANBRIEF___ Direct3D 9 interoperability functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the Direct3D 9 interoperability functions of the + * low-level CUDA driver application programming interface. Note that mapping + * of Direct3D 9 resources is performed with the graphics API agnostic, resource + * mapping interface described in \ref CUDA_GRAPHICS "Graphics Interoperability". + * + * @{ + */ + +/** + * CUDA devices corresponding to a D3D9 device + */ +typedef enum CUd3d9DeviceList_enum { + CU_D3D9_DEVICE_LIST_ALL = 0x01, /**< The CUDA devices for all GPUs used by a D3D9 device */ + CU_D3D9_DEVICE_LIST_CURRENT_FRAME = 0x02, /**< The CUDA devices for the GPUs used by a D3D9 device in its currently rendering frame */ + CU_D3D9_DEVICE_LIST_NEXT_FRAME = 0x03, /**< The CUDA devices for the GPUs to be used by a D3D9 device in the next frame */ +} CUd3d9DeviceList; + +/** + * \brief Gets the CUDA device corresponding to a display adapter. + * + * Returns in \p *pCudaDevice the CUDA-compatible device corresponding to the + * adapter name \p pszAdapterName obtained from ::EnumDisplayDevices() or + * ::IDirect3D9::GetAdapterIdentifier(). + * + * If no device on the adapter with name \p pszAdapterName is CUDA-compatible, + * then the call will fail. + * + * \param pCudaDevice - Returned CUDA device corresponding to pszAdapterName + * \param pszAdapterName - Adapter name to query for device + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D9CtxCreate, + * ::cudaD3D9GetDevice + */ +CUresult CUDAAPI cuD3D9GetDevice(CUdevice *pCudaDevice, const char *pszAdapterName); + +/** + * \brief Gets the CUDA devices corresponding to a Direct3D 9 device + * + * Returns in \p *pCudaDeviceCount the number of CUDA-compatible device corresponding + * to the Direct3D 9 device \p pD3D9Device. + * Also returns in \p *pCudaDevices at most \p cudaDeviceCount of the CUDA-compatible devices + * corresponding to the Direct3D 9 device \p pD3D9Device. + * + * If any of the GPUs being used to render \p pDevice are not CUDA capable then the + * call will return ::CUDA_ERROR_NO_DEVICE. + * + * \param pCudaDeviceCount - Returned number of CUDA devices corresponding to \p pD3D9Device + * \param pCudaDevices - Returned CUDA devices corresponding to \p pD3D9Device + * \param cudaDeviceCount - The size of the output device array \p pCudaDevices + * \param pD3D9Device - Direct3D 9 device to query for CUDA devices + * \param deviceList - The set of devices to return. This set may be + * ::CU_D3D9_DEVICE_LIST_ALL for all devices, + * ::CU_D3D9_DEVICE_LIST_CURRENT_FRAME for the devices used to + * render the current frame (in SLI), or + * ::CU_D3D9_DEVICE_LIST_NEXT_FRAME for the devices used to + * render the next frame (in SLI). + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_NO_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_FOUND, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D9CtxCreate, + * ::cudaD3D9GetDevices + */ +CUresult CUDAAPI cuD3D9GetDevices(unsigned int *pCudaDeviceCount, CUdevice *pCudaDevices, unsigned int cudaDeviceCount, IDirect3DDevice9 *pD3D9Device, CUd3d9DeviceList deviceList); + +/** + * \brief Create a CUDA context for interoperability with Direct3D 9 + * + * Creates a new CUDA context, enables interoperability for that context with + * the Direct3D device \p pD3DDevice, and associates the created CUDA context + * with the calling thread. + * The created ::CUcontext will be returned in \p *pCtx. + * Direct3D resources from this device may be registered and mapped through the + * lifetime of this CUDA context. + * If \p pCudaDevice is non-NULL then the ::CUdevice on which this CUDA context was + * created will be returned in \p *pCudaDevice. + * + * On success, this call will increase the internal reference count on + * \p pD3DDevice. This reference count will be decremented upon destruction of + * this context through ::cuCtxDestroy(). + * This context will cease to function if \p pD3DDevice is destroyed or encounters + * an error. + * + * Note that this function is never required for correct functionality. Use of + * this function will result in accelerated interoperability only when the + * operating system is Windows Vista or Windows 7, and the device \p pD3DDdevice + * is not an IDirect3DDevice9Ex. In all other circumstances, this function is + * not necessary. + * + * \param pCtx - Returned newly created CUDA context + * \param pCudaDevice - Returned pointer to the device on which the context was created + * \param Flags - Context creation flags (see ::cuCtxCreate() for details) + * \param pD3DDevice - Direct3D device to create interoperability context with + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D9GetDevice, + * ::cuGraphicsD3D9RegisterResource + */ +CUresult CUDAAPI cuD3D9CtxCreate(CUcontext *pCtx, CUdevice *pCudaDevice, unsigned int Flags, IDirect3DDevice9 *pD3DDevice); + +/** + * \brief Create a CUDA context for interoperability with Direct3D 9 + * + * Creates a new CUDA context, enables interoperability for that context with + * the Direct3D device \p pD3DDevice, and associates the created CUDA context + * with the calling thread. + * The created ::CUcontext will be returned in \p *pCtx. + * Direct3D resources from this device may be registered and mapped through the + * lifetime of this CUDA context. + * + * On success, this call will increase the internal reference count on + * \p pD3DDevice. This reference count will be decremented upon destruction of + * this context through ::cuCtxDestroy(). + * This context will cease to function if \p pD3DDevice is destroyed or encounters + * an error. + * + * Note that this function is never required for correct functionality. Use of + * this function will result in accelerated interoperability only when the + * operating system is Windows Vista or Windows 7, and the device \p pD3DDdevice + * is not an IDirect3DDevice9Ex. In all other circumstances, this function is + * not necessary. + * + * \param pCtx - Returned newly created CUDA context + * \param flags - Context creation flags (see ::cuCtxCreate() for details) + * \param pD3DDevice - Direct3D device to create interoperability context with + * \param cudaDevice - The CUDA device on which to create the context. This device + * must be among the devices returned when querying + * ::CU_D3D9_DEVICES_ALL from ::cuD3D9GetDevices. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D9GetDevices, + * ::cuGraphicsD3D9RegisterResource + */ +CUresult CUDAAPI cuD3D9CtxCreateOnDevice(CUcontext *pCtx, unsigned int flags, IDirect3DDevice9 *pD3DDevice, CUdevice cudaDevice); + +/** + * \brief Get the Direct3D 9 device against which the current CUDA context was + * created + * + * Returns in \p *ppD3DDevice the Direct3D device against which this CUDA context + * was created in ::cuD3D9CtxCreate(). + * + * \param ppD3DDevice - Returned Direct3D device corresponding to CUDA context + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT + * ::CUDA_ERROR_INVALID_GRAPHICS_CONTEXT + * \notefnerr + * + * \sa + * ::cuD3D9GetDevice, + * ::cudaD3D9GetDirect3DDevice + */ +CUresult CUDAAPI cuD3D9GetDirect3DDevice(IDirect3DDevice9 **ppD3DDevice); + +/** + * \brief Register a Direct3D 9 resource for access by CUDA + * + * Registers the Direct3D 9 resource \p pD3DResource for access by CUDA and + * returns a CUDA handle to \p pD3Dresource in \p pCudaResource. + * The handle returned in \p pCudaResource may be used to map and unmap this + * resource until it is unregistered. + * On success this call will increase the internal reference count on + * \p pD3DResource. This reference count will be decremented when this + * resource is unregistered through ::cuGraphicsUnregisterResource(). + * + * This call is potentially high-overhead and should not be called every frame + * in interactive applications. + * + * The type of \p pD3DResource must be one of the following. + * - ::IDirect3DVertexBuffer9: may be accessed through a device pointer + * - ::IDirect3DIndexBuffer9: may be accessed through a device pointer + * - ::IDirect3DSurface9: may be accessed through an array. + * Only stand-alone objects of type ::IDirect3DSurface9 + * may be explicitly shared. In particular, individual mipmap levels and faces + * of cube maps may not be registered directly. To access individual surfaces + * associated with a texture, one must register the base texture object. + * - ::IDirect3DBaseTexture9: individual surfaces on this texture may be accessed + * through an array. + * + * The \p Flags argument may be used to specify additional parameters at register + * time. The valid values for this parameter are + * - ::CU_GRAPHICS_REGISTER_FLAGS_NONE: Specifies no hints about how this + * resource will be used. + * - ::CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST: Specifies that CUDA will + * bind this resource to a surface reference. + * - ::CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER: Specifies that CUDA will perform + * texture gather operations on this resource. + * + * Not all Direct3D resources of the above types may be used for + * interoperability with CUDA. The following are some limitations. + * - The primary rendertarget may not be registered with CUDA. + * - Resources allocated as shared may not be registered with CUDA. + * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, + * or 32-bit integer or floating-point data cannot be shared. + * - Surfaces of depth or stencil formats cannot be shared. + * + * A complete list of supported formats is as follows: + * - D3DFMT_L8 + * - D3DFMT_L16 + * - D3DFMT_A8R8G8B8 + * - D3DFMT_X8R8G8B8 + * - D3DFMT_G16R16 + * - D3DFMT_A8B8G8R8 + * - D3DFMT_A8 + * - D3DFMT_A8L8 + * - D3DFMT_Q8W8V8U8 + * - D3DFMT_V16U16 + * - D3DFMT_A16B16G16R16F + * - D3DFMT_A16B16G16R16 + * - D3DFMT_R32F + * - D3DFMT_G16R16F + * - D3DFMT_A32B32G32R32F + * - D3DFMT_G32R32F + * - D3DFMT_R16F + * + * If Direct3D interoperability is not initialized for this context using + * ::cuD3D9CtxCreate then ::CUDA_ERROR_INVALID_CONTEXT is returned. + * If \p pD3DResource is of incorrect type or is already registered then + * ::CUDA_ERROR_INVALID_HANDLE is returned. + * If \p pD3DResource cannot be registered then ::CUDA_ERROR_UNKNOWN is returned. + * If \p Flags is not one of the above specified value then ::CUDA_ERROR_INVALID_VALUE + * is returned. + * + * \param pCudaResource - Returned graphics resource handle + * \param pD3DResource - Direct3D resource to register + * \param Flags - Parameters for resource registration + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuD3D9CtxCreate, + * ::cuGraphicsUnregisterResource, + * ::cuGraphicsMapResources, + * ::cuGraphicsSubResourceGetMappedArray, + * ::cuGraphicsResourceGetMappedPointer, + * ::cudaGraphicsD3D9RegisterResource + */ +CUresult CUDAAPI cuGraphicsD3D9RegisterResource(CUgraphicsResource *pCudaResource, IDirect3DResource9 *pD3DResource, unsigned int Flags); + +/** + * \defgroup CUDA_D3D9_DEPRECATED Direct3D 9 Interoperability [DEPRECATED] + * + * ___MANBRIEF___ deprecated Direct3D 9 interoperability functions of the + * low-level CUDA driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes deprecated Direct3D 9 interoperability functionality. + * @{ + */ + +/** Flags to register a resource */ +typedef enum CUd3d9register_flags_enum { + CU_D3D9_REGISTER_FLAGS_NONE = 0x00, + CU_D3D9_REGISTER_FLAGS_ARRAY = 0x01, +} CUd3d9register_flags; + +/** Flags to map or unmap a resource */ +typedef enum CUd3d9map_flags_enum { + CU_D3D9_MAPRESOURCE_FLAGS_NONE = 0x00, + CU_D3D9_MAPRESOURCE_FLAGS_READONLY = 0x01, + CU_D3D9_MAPRESOURCE_FLAGS_WRITEDISCARD = 0x02, +} CUd3d9map_flags; + +/** + * \brief Register a Direct3D resource for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Registers the Direct3D resource \p pResource for access by CUDA. + * + * If this call is successful, then the application will be able to map and + * unmap this resource until it is unregistered through + * ::cuD3D9UnregisterResource(). Also on success, this call will increase the + * internal reference count on \p pResource. This reference count will be + * decremented when this resource is unregistered through + * ::cuD3D9UnregisterResource(). + * + * This call is potentially high-overhead and should not be called every frame + * in interactive applications. + * + * The type of \p pResource must be one of the following. + * + * - ::IDirect3DVertexBuffer9: Cannot be used with \p Flags set to + * ::CU_D3D9_REGISTER_FLAGS_ARRAY. + * - ::IDirect3DIndexBuffer9: Cannot be used with \p Flags set to + * ::CU_D3D9_REGISTER_FLAGS_ARRAY. + * - ::IDirect3DSurface9: Only stand-alone objects of type ::IDirect3DSurface9 + * may be explicitly shared. In particular, individual mipmap levels and + * faces of cube maps may not be registered directly. To access individual + * surfaces associated with a texture, one must register the base texture + * object. For restrictions on the \p Flags parameter, see type + * ::IDirect3DBaseTexture9. + * - ::IDirect3DBaseTexture9: When a texture is registered, all surfaces + * associated with the all mipmap levels of all faces of the texture will be + * accessible to CUDA. + * + * The \p Flags argument specifies the mechanism through which CUDA will access + * the Direct3D resource. The following values are allowed. + * + * - CU_D3D9_REGISTER_FLAGS_NONE: Specifies that CUDA will access this resource + * through a ::CUdeviceptr. The pointer, size, and (for textures), pitch for + * each subresource of this allocation may be queried through + * ::cuD3D9ResourceGetMappedPointer(), ::cuD3D9ResourceGetMappedSize(), and + * ::cuD3D9ResourceGetMappedPitch() respectively. This option is valid for + * all resource types. + * - ::CU_D3D9_REGISTER_FLAGS_ARRAY: Specifies that CUDA will access this + * resource through a ::CUarray queried on a sub-resource basis through + * ::cuD3D9ResourceGetMappedArray(). This option is only valid for resources + * of type ::IDirect3DSurface9 and subtypes of ::IDirect3DBaseTexture9. + * + * Not all Direct3D resources of the above types may be used for + * interoperability with CUDA. The following are some limitations. + * + * - The primary rendertarget may not be registered with CUDA. + * - Resources allocated as shared may not be registered with CUDA. + * - Any resources allocated in ::D3DPOOL_SYSTEMMEM or ::D3DPOOL_MANAGED may + * not be registered with CUDA. + * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, + * or 32-bit integer or floating-point data cannot be shared. + * - Surfaces of depth or stencil formats cannot be shared. + * + * If Direct3D interoperability is not initialized on this context, then + * ::CUDA_ERROR_INVALID_CONTEXT is returned. If \p pResource is of incorrect + * type (e.g. is a non-stand-alone ::IDirect3DSurface9) or is already + * registered, then ::CUDA_ERROR_INVALID_HANDLE is returned. If \p pResource + * cannot be registered then ::CUDA_ERROR_UNKNOWN is returned. + * + * \param pResource - Resource to register for CUDA access + * \param Flags - Flags for resource registration + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_OUT_OF_MEMORY, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuGraphicsD3D9RegisterResource + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9RegisterResource(IDirect3DResource9 *pResource, unsigned int Flags); + +/** + * \brief Unregister a Direct3D resource + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unregisters the Direct3D resource \p pResource so it is not accessible by + * CUDA unless registered again. + * + * If \p pResource is not registered, then ::CUDA_ERROR_INVALID_HANDLE is + * returned. + * + * \param pResource - Resource to unregister + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuGraphicsUnregisterResource + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9UnregisterResource(IDirect3DResource9 *pResource); + +/** + * \brief Map Direct3D resources for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Maps the \p count Direct3D resources in \p ppResource for access by CUDA. + * + * The resources in \p ppResource may be accessed in CUDA kernels until they + * are unmapped. Direct3D should not access any resources while they are mapped + * by CUDA. If an application does so the results are undefined. + * + * This function provides the synchronization guarantee that any Direct3D calls + * issued before ::cuD3D9MapResources() will complete before any CUDA kernels + * issued after ::cuD3D9MapResources() begin. + * + * If any of \p ppResource have not been registered for use with CUDA or if + * \p ppResource contains any duplicate entries, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If any of \p ppResource are + * presently mapped for access by CUDA, then ::CUDA_ERROR_ALREADY_MAPPED is + * returned. + * + * \param count - Number of resources in ppResource + * \param ppResource - Resources to map for CUDA usage + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ALREADY_MAPPED, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuGraphicsMapResources + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9MapResources(unsigned int count, IDirect3DResource9 **ppResource); + +/** + * \brief Unmaps Direct3D resources + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unmaps the \p count Direct3D resources in \p ppResource. + * + * This function provides the synchronization guarantee that any CUDA kernels + * issued before ::cuD3D9UnmapResources() will complete before any Direct3D + * calls issued after ::cuD3D9UnmapResources() begin. + * + * If any of \p ppResource have not been registered for use with CUDA or if + * \p ppResource contains any duplicate entries, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If any of \p ppResource are not + * presently mapped for access by CUDA, then ::CUDA_ERROR_NOT_MAPPED is + * returned. + * + * \param count - Number of resources to unmap for CUDA + * \param ppResource - Resources to unmap for CUDA + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa + * ::cuGraphicsUnmapResources + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9UnmapResources(unsigned int count, IDirect3DResource9 **ppResource); + +/** + * \brief Set usage flags for mapping a Direct3D resource + * + * \deprecated This function is deprecated as of Cuda 3.0. + * + * Set \p Flags for mapping the Direct3D resource \p pResource. + * + * Changes to \p Flags will take effect the next time \p pResource is mapped. + * The \p Flags argument may be any of the following: + * - ::CU_D3D9_MAPRESOURCE_FLAGS_NONE: Specifies no hints about how this + * resource will be used. It is therefore assumed that this resource will be + * read from and written to by CUDA kernels. This is the default value. + * - ::CU_D3D9_MAPRESOURCE_FLAGS_READONLY: Specifies that CUDA kernels which + * access this resource will not write to this resource. + * - ::CU_D3D9_MAPRESOURCE_FLAGS_WRITEDISCARD: Specifies that CUDA kernels + * which access this resource will not read from this resource and will + * write over the entire contents of the resource, so none of the data + * previously stored in the resource will be preserved. + * + * If \p pResource has not been registered for use with CUDA, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p pResource is presently + * mapped for access by CUDA, then ::CUDA_ERROR_ALREADY_MAPPED is returned. + * + * \param pResource - Registered resource to set flags for + * \param Flags - Parameters for resource mapping + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ALREADY_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsResourceSetMapFlags + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9ResourceSetMapFlags(IDirect3DResource9 *pResource, unsigned int Flags); + +/** + * \brief Get the dimensions of a registered surface + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pWidth, \p *pHeight, and \p *pDepth the dimensions of the + * subresource of the mapped Direct3D resource \p pResource, which corresponds + * to \p Face and \p Level. + * + * Because anti-aliased surfaces may have multiple samples per pixel, it is + * possible that the dimensions of a resource will be an integer factor larger + * than the dimensions reported by the Direct3D runtime. + * + * The parameters \p pWidth, \p pHeight, and \p pDepth are optional. For 2D + * surfaces, the value returned in \p *pDepth will be 0. + * + * If \p pResource is not of type ::IDirect3DBaseTexture9 or + * ::IDirect3DSurface9 or if \p pResource has not been registered for use with + * CUDA, then ::CUDA_ERROR_INVALID_HANDLE is returned. + * + * For usage requirements of \p Face and \p Level parameters, see + * ::cuD3D9ResourceGetMappedPointer(). + * + * \param pWidth - Returned width of surface + * \param pHeight - Returned height of surface + * \param pDepth - Returned depth of surface + * \param pResource - Registered resource to access + * \param Face - Face of resource to access + * \param Level - Level of resource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE + * \notefnerr + * + * \sa ::cuGraphicsSubResourceGetMappedArray + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9ResourceGetSurfaceDimensions(size_t *pWidth, size_t *pHeight, size_t *pDepth, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + +/** + * \brief Get an array through which to access a subresource of a Direct3D + * resource which has been mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pArray an array through which the subresource of the mapped + * Direct3D resource \p pResource which corresponds to \p Face and \p Level may + * be accessed. The value set in \p pArray may change every time that + * \p pResource is mapped. + * + * If \p pResource is not registered then ::CUDA_ERROR_INVALID_HANDLE is + * returned. If \p pResource was not registered with usage flags + * ::CU_D3D9_REGISTER_FLAGS_ARRAY then ::CUDA_ERROR_INVALID_HANDLE is + * returned. If \p pResource is not mapped then ::CUDA_ERROR_NOT_MAPPED is + * returned. + * + * For usage requirements of \p Face and \p Level parameters, see + * ::cuD3D9ResourceGetMappedPointer(). + * + * \param pArray - Returned array corresponding to subresource + * \param pResource - Mapped resource to access + * \param Face - Face of resource to access + * \param Level - Level of resource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsSubResourceGetMappedArray + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9ResourceGetMappedArray(CUarray *pArray, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + +/** + * \brief Get the pointer through which to access a subresource of a Direct3D + * resource which has been mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pDevPtr the base pointer of the subresource of the mapped + * Direct3D resource \p pResource, which corresponds to \p Face and \p Level. + * The value set in \p pDevPtr may change every time that \p pResource is + * mapped. + * + * If \p pResource is not registered, then ::CUDA_ERROR_INVALID_HANDLE is + * returned. If \p pResource was not registered with usage flags + * ::CU_D3D9_REGISTER_FLAGS_NONE, then ::CUDA_ERROR_INVALID_HANDLE is returned. + * If \p pResource is not mapped, then ::CUDA_ERROR_NOT_MAPPED is returned. + * + * If \p pResource is of type ::IDirect3DCubeTexture9, then \p Face must one + * of the values enumerated by type ::D3DCUBEMAP_FACES. For all other types + * \p Face must be 0. If \p Face is invalid, then ::CUDA_ERROR_INVALID_VALUE + * is returned. + * + * If \p pResource is of type ::IDirect3DBaseTexture9, then \p Level must + * correspond to a valid mipmap level. At present only mipmap level 0 is + * supported. For all other types \p Level must be 0. If \p Level is invalid, + * then ::CUDA_ERROR_INVALID_VALUE is returned. + * + * \param pDevPtr - Returned pointer corresponding to subresource + * \param pResource - Mapped resource to access + * \param Face - Face of resource to access + * \param Level - Level of resource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsResourceGetMappedPointer + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9ResourceGetMappedPointer(CUdeviceptr *pDevPtr, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + +/** + * \brief Get the size of a subresource of a Direct3D resource which has been + * mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pSize the size of the subresource of the mapped Direct3D + * resource \p pResource, which corresponds to \p Face and \p Level. The value + * set in \p pSize may change every time that \p pResource is mapped. + * + * If \p pResource has not been registered for use with CUDA, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p pResource was not registered + * with usage flags ::CU_D3D9_REGISTER_FLAGS_NONE, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p pResource is not mapped for + * access by CUDA, then ::CUDA_ERROR_NOT_MAPPED is returned. + * + * For usage requirements of \p Face and \p Level parameters, see + * ::cuD3D9ResourceGetMappedPointer. + * + * \param pSize - Returned size of subresource + * \param pResource - Mapped resource to access + * \param Face - Face of resource to access + * \param Level - Level of resource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsResourceGetMappedPointer + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9ResourceGetMappedSize(size_t *pSize, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + +/** + * \brief Get the pitch of a subresource of a Direct3D resource which has been + * mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pPitch and \p *pPitchSlice the pitch and Z-slice pitch of + * the subresource of the mapped Direct3D resource \p pResource, which + * corresponds to \p Face and \p Level. The values set in \p pPitch and + * \p pPitchSlice may change every time that \p pResource is mapped. + * + * The pitch and Z-slice pitch values may be used to compute the location of a + * sample on a surface as follows. + * + * For a 2D surface, the byte offset of the sample at position \b x, \b y from + * the base pointer of the surface is: + * + * \b y * \b pitch + (bytes per pixel) * \b x + * + * For a 3D surface, the byte offset of the sample at position \b x, \b y, + * \b z from the base pointer of the surface is: + * + * \b z* \b slicePitch + \b y * \b pitch + (bytes per pixel) * \b x + * + * Both parameters \p pPitch and \p pPitchSlice are optional and may be set to + * NULL. + * + * If \p pResource is not of type ::IDirect3DBaseTexture9 or one of its + * sub-types or if \p pResource has not been registered for use with CUDA, + * then ::cudaErrorInvalidResourceHandle is returned. If \p pResource was not + * registered with usage flags ::CU_D3D9_REGISTER_FLAGS_NONE, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p pResource is not mapped + * for access by CUDA then ::CUDA_ERROR_NOT_MAPPED is returned. + * + * For usage requirements of \p Face and \p Level parameters, see + * ::cuD3D9ResourceGetMappedPointer(). + * + * \param pPitch - Returned pitch of subresource + * \param pPitchSlice - Returned Z-slice pitch of subresource + * \param pResource - Mapped resource to access + * \param Face - Face of resource to access + * \param Level - Level of resource to access + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_NOT_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsSubResourceGetMappedArray + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9ResourceGetMappedPitch(size_t *pPitch, size_t *pPitchSlice, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + +/* CUDA 1.x compatibility API. These functions are deprecated, please use the ones above. */ +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9Begin(IDirect3DDevice9 *pDevice); +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9End(void); +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9RegisterVertexBuffer(IDirect3DVertexBuffer9 *pVB); +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9MapVertexBuffer(CUdeviceptr *pDevPtr, size_t *pSize, IDirect3DVertexBuffer9 *pVB); +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9UnmapVertexBuffer(IDirect3DVertexBuffer9 *pVB); +__CUDA_DEPRECATED CUresult CUDAAPI cuD3D9UnregisterVertexBuffer(IDirect3DVertexBuffer9 *pVB); + +/** @} */ /* END CUDA_D3D9_DEPRECATED */ +/** @} */ /* END CUDA_D3D9 */ + + +/** + * CUDA API versioning support + */ +#if defined(__CUDA_API_VERSION_INTERNAL) + #undef cuD3D9CtxCreate + #undef cuD3D9ResourceGetSurfaceDimensions + #undef cuD3D9ResourceGetMappedPointer + #undef cuD3D9ResourceGetMappedSize + #undef cuD3D9ResourceGetMappedPitch + #undef cuD3D9MapVertexBuffer + + CUresult CUDAAPI cuD3D9CtxCreate(CUcontext *pCtx, CUdevice *pCudaDevice, unsigned int Flags, IDirect3DDevice9 *pD3DDevice); + CUresult CUDAAPI cuD3D9ResourceGetSurfaceDimensions(unsigned int *pWidth, unsigned int *pHeight, unsigned int *pDepth, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + CUresult CUDAAPI cuD3D9ResourceGetMappedPointer(CUdeviceptr_v1 *pDevPtr, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + CUresult CUDAAPI cuD3D9ResourceGetMappedSize(unsigned int *pSize, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + CUresult CUDAAPI cuD3D9ResourceGetMappedPitch(unsigned int *pPitch, unsigned int *pPitchSlice, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + CUresult CUDAAPI cuD3D9MapVertexBuffer(CUdeviceptr_v1 *pDevPtr, unsigned int *pSize, IDirect3DVertexBuffer9 *pVB); +#endif /* __CUDA_API_VERSION_INTERNAL */ + +#ifdef __cplusplus +}; +#endif + +#undef __CUDA_DEPRECATED + +#endif + diff --git a/cuda_toolkit/include/cudaD3D9Typedefs.h b/cuda_toolkit/include/cudaD3D9Typedefs.h new file mode 100644 index 0000000000000000000000000000000000000000..fd4ddc654a72fb2f45febe1261e4262968ef4c4b --- /dev/null +++ b/cuda_toolkit/include/cudaD3D9Typedefs.h @@ -0,0 +1,131 @@ +/* + * Copyright 2020-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CUDAD3D9TYPEDEFS_H +#define CUDAD3D9TYPEDEFS_H + +// Dependent includes for cudaD3D11.h +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/* + * Macros for the latest version for each driver function in cudaD3D9.h + */ +#define PFN_cuD3D9GetDevice PFN_cuD3D9GetDevice_v2000 +#define PFN_cuD3D9GetDevices PFN_cuD3D9GetDevices_v3020 +#define PFN_cuD3D9CtxCreate PFN_cuD3D9CtxCreate_v3020 +#define PFN_cuD3D9CtxCreateOnDevice PFN_cuD3D9CtxCreateOnDevice_v3020 +#define PFN_cuD3D9GetDirect3DDevice PFN_cuD3D9GetDirect3DDevice_v2000 +#define PFN_cuGraphicsD3D9RegisterResource PFN_cuGraphicsD3D9RegisterResource_v3000 +#define PFN_cuD3D9RegisterResource PFN_cuD3D9RegisterResource_v2000 +#define PFN_cuD3D9UnregisterResource PFN_cuD3D9UnregisterResource_v2000 +#define PFN_cuD3D9MapResources PFN_cuD3D9MapResources_v2000 +#define PFN_cuD3D9UnmapResources PFN_cuD3D9UnmapResources_v2000 +#define PFN_cuD3D9ResourceSetMapFlags PFN_cuD3D9ResourceSetMapFlags_v2000 +#define PFN_cuD3D9ResourceGetSurfaceDimensions PFN_cuD3D9ResourceGetSurfaceDimensions_v3020 +#define PFN_cuD3D9ResourceGetMappedArray PFN_cuD3D9ResourceGetMappedArray_v2010 +#define PFN_cuD3D9ResourceGetMappedPointer PFN_cuD3D9ResourceGetMappedPointer_v3020 +#define PFN_cuD3D9ResourceGetMappedSize PFN_cuD3D9ResourceGetMappedSize_v3020 +#define PFN_cuD3D9ResourceGetMappedPitch PFN_cuD3D9ResourceGetMappedPitch_v3020 +#define PFN_cuD3D9Begin PFN_cuD3D9Begin_v2000 +#define PFN_cuD3D9End PFN_cuD3D9End_v2000 +#define PFN_cuD3D9RegisterVertexBuffer PFN_cuD3D9RegisterVertexBuffer_v2000 +#define PFN_cuD3D9MapVertexBuffer PFN_cuD3D9MapVertexBuffer_v3020 +#define PFN_cuD3D9UnmapVertexBuffer PFN_cuD3D9UnmapVertexBuffer_v2000 +#define PFN_cuD3D9UnregisterVertexBuffer PFN_cuD3D9UnregisterVertexBuffer_v2000 + + +/** + * Type definitions for functions defined in cudaD3D9.h + */ +typedef CUresult (CUDAAPI *PFN_cuD3D9GetDevice_v2000)(CUdevice_v1 *pCudaDevice, const char *pszAdapterName); +typedef CUresult (CUDAAPI *PFN_cuD3D9GetDevices_v3020)(unsigned int *pCudaDeviceCount, CUdevice_v1 *pCudaDevices, unsigned int cudaDeviceCount, IDirect3DDevice9 *pD3D9Device, CUd3d9DeviceList deviceList); +typedef CUresult (CUDAAPI *PFN_cuD3D9CtxCreate_v3020)(CUcontext *pCtx, CUdevice_v1 *pCudaDevice, unsigned int Flags, IDirect3DDevice9 *pD3DDevice); +typedef CUresult (CUDAAPI *PFN_cuD3D9CtxCreateOnDevice_v3020)(CUcontext *pCtx, unsigned int flags, IDirect3DDevice9 *pD3DDevice, CUdevice_v1 cudaDevice); +typedef CUresult (CUDAAPI *PFN_cuD3D9GetDirect3DDevice_v2000)(IDirect3DDevice9 **ppD3DDevice); +typedef CUresult (CUDAAPI *PFN_cuGraphicsD3D9RegisterResource_v3000)(CUgraphicsResource *pCudaResource, IDirect3DResource9 *pD3DResource, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuD3D9RegisterResource_v2000)(IDirect3DResource9 *pResource, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuD3D9UnregisterResource_v2000)(IDirect3DResource9 *pResource); +typedef CUresult (CUDAAPI *PFN_cuD3D9MapResources_v2000)(unsigned int count, IDirect3DResource9 **ppResource); +typedef CUresult (CUDAAPI *PFN_cuD3D9UnmapResources_v2000)(unsigned int count, IDirect3DResource9 **ppResource); +typedef CUresult (CUDAAPI *PFN_cuD3D9ResourceSetMapFlags_v2000)(IDirect3DResource9 *pResource, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuD3D9ResourceGetSurfaceDimensions_v3020)(size_t *pWidth, size_t *pHeight, size_t *pDepth, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); +typedef CUresult (CUDAAPI *PFN_cuD3D9ResourceGetMappedArray_v2010)(CUarray *pArray, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); +typedef CUresult (CUDAAPI *PFN_cuD3D9ResourceGetMappedPointer_v3020)(CUdeviceptr_v2 *pDevPtr, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); +typedef CUresult (CUDAAPI *PFN_cuD3D9ResourceGetMappedSize_v3020)(size_t *pSize, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); +typedef CUresult (CUDAAPI *PFN_cuD3D9ResourceGetMappedPitch_v3020)(size_t *pPitch, size_t *pPitchSlice, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); +typedef CUresult (CUDAAPI *PFN_cuD3D9Begin_v2000)(IDirect3DDevice9 *pDevice); +typedef CUresult (CUDAAPI *PFN_cuD3D9End_v2000)(void); +typedef CUresult (CUDAAPI *PFN_cuD3D9RegisterVertexBuffer_v2000)(IDirect3DVertexBuffer9 *pVB); +typedef CUresult (CUDAAPI *PFN_cuD3D9MapVertexBuffer_v3020)(CUdeviceptr_v2 *pDevPtr, size_t *pSize, IDirect3DVertexBuffer9 *pVB); +typedef CUresult (CUDAAPI *PFN_cuD3D9UnmapVertexBuffer_v2000)(IDirect3DVertexBuffer9 *pVB); +typedef CUresult (CUDAAPI *PFN_cuD3D9UnregisterVertexBuffer_v2000)(IDirect3DVertexBuffer9 *pVB); + +/* + * Type definitions for older versioned functions in cudaD3D9.h + */ +#if defined(__CUDA_API_VERSION_INTERNAL) + typedef CUresult (CUDAAPI *PFN_cuD3D9CtxCreate_v2000)(CUcontext *pCtx, CUdevice_v1 *pCudaDevice, unsigned int Flags, IDirect3DDevice9 *pD3DDevice); + typedef CUresult (CUDAAPI *PFN_cuD3D9ResourceGetSurfaceDimensions_v2000)(unsigned int *pWidth, unsigned int *pHeight, unsigned int *pDepth, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + typedef CUresult (CUDAAPI *PFN_cuD3D9ResourceGetMappedPointer_v2000)(CUdeviceptr_v1 *pDevPtr, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + typedef CUresult (CUDAAPI *PFN_cuD3D9ResourceGetMappedSize_v2000)(unsigned int *pSize, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + typedef CUresult (CUDAAPI *PFN_cuD3D9ResourceGetMappedPitch_v2000)(unsigned int *pPitch, unsigned int *pPitchSlice, IDirect3DResource9 *pResource, unsigned int Face, unsigned int Level); + typedef CUresult (CUDAAPI *PFN_cuD3D9MapVertexBuffer_v2000)(CUdeviceptr_v1 *pDevPtr, unsigned int *pSize, IDirect3DVertexBuffer9 *pVB); +#endif + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // file guard diff --git a/cuda_toolkit/include/cudaGL.h b/cuda_toolkit/include/cudaGL.h new file mode 100644 index 0000000000000000000000000000000000000000..4f6eaf18574fd56b5ba112ba8e6a499b3084b9fb --- /dev/null +++ b/cuda_toolkit/include/cudaGL.h @@ -0,0 +1,608 @@ +/* + * Copyright 1993-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CUDAGL_H +#define CUDAGL_H + +#include +#include + +#if defined(__CUDA_API_VERSION_INTERNAL) || defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif + +#ifdef CUDA_FORCE_API_VERSION +#error "CUDA_FORCE_API_VERSION is no longer supported." +#endif + +#if defined(__CUDA_API_VERSION_INTERNAL) || defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) + #define __CUDA_API_PER_THREAD_DEFAULT_STREAM + #define __CUDA_API_PTDS(api) api ## _ptds + #define __CUDA_API_PTSZ(api) api ## _ptsz +#else + #define __CUDA_API_PTDS(api) api + #define __CUDA_API_PTSZ(api) api +#endif + +#define cuGLCtxCreate cuGLCtxCreate_v2 +#define cuGLMapBufferObject __CUDA_API_PTDS(cuGLMapBufferObject_v2) +#define cuGLMapBufferObjectAsync __CUDA_API_PTSZ(cuGLMapBufferObjectAsync_v2) +#define cuGLGetDevices cuGLGetDevices_v2 + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file cudaGL.h + * \brief Header file for the OpenGL interoperability functions of the + * low-level CUDA driver application programming interface. + */ + +/** + * \defgroup CUDA_GL OpenGL Interoperability + * \ingroup CUDA_DRIVER + * + * ___MANBRIEF___ OpenGL interoperability functions of the low-level CUDA + * driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the OpenGL interoperability functions of the + * low-level CUDA driver application programming interface. Note that mapping + * of OpenGL resources is performed with the graphics API agnostic, resource + * mapping interface described in \ref CUDA_GRAPHICS "Graphics Interoperability". + * + * @{ + */ + +#if defined(_WIN32) +#if !defined(WGL_NV_gpu_affinity) +typedef void* HGPUNV; +#endif +#endif /* _WIN32 */ + +/** + * \brief Registers an OpenGL buffer object + * + * Registers the buffer object specified by \p buffer for access by + * CUDA. A handle to the registered object is returned as \p + * pCudaResource. The register flags \p Flags specify the intended usage, + * as follows: + * + * - ::CU_GRAPHICS_REGISTER_FLAGS_NONE: Specifies no hints about how this + * resource will be used. It is therefore assumed that this resource will be + * read from and written to by CUDA. This is the default value. + * - ::CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY: Specifies that CUDA + * will not write to this resource. + * - ::CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD: Specifies that + * CUDA will not read from this resource and will write over the + * entire contents of the resource, so none of the data previously + * stored in the resource will be preserved. + * + * \param pCudaResource - Pointer to the returned object handle + * \param buffer - name of buffer object to be registered + * \param Flags - Register flags + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ALREADY_MAPPED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_OPERATING_SYSTEM + * \notefnerr + * + * \sa + * ::cuGraphicsUnregisterResource, + * ::cuGraphicsMapResources, + * ::cuGraphicsResourceGetMappedPointer, + * ::cudaGraphicsGLRegisterBuffer + */ +CUresult CUDAAPI cuGraphicsGLRegisterBuffer(CUgraphicsResource *pCudaResource, GLuint buffer, unsigned int Flags); + +/** + * \brief Register an OpenGL texture or renderbuffer object + * + * Registers the texture or renderbuffer object specified by \p image for access by CUDA. + * A handle to the registered object is returned as \p pCudaResource. + * + * \p target must match the type of the object, and must be one of ::GL_TEXTURE_2D, + * ::GL_TEXTURE_RECTANGLE, ::GL_TEXTURE_CUBE_MAP, ::GL_TEXTURE_3D, ::GL_TEXTURE_2D_ARRAY, + * or ::GL_RENDERBUFFER. + * + * The register flags \p Flags specify the intended usage, as follows: + * + * - ::CU_GRAPHICS_REGISTER_FLAGS_NONE: Specifies no hints about how this + * resource will be used. It is therefore assumed that this resource will be + * read from and written to by CUDA. This is the default value. + * - ::CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY: Specifies that CUDA + * will not write to this resource. + * - ::CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD: Specifies that + * CUDA will not read from this resource and will write over the + * entire contents of the resource, so none of the data previously + * stored in the resource will be preserved. + * - ::CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST: Specifies that CUDA will + * bind this resource to a surface reference. + * - ::CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER: Specifies that CUDA will perform + * texture gather operations on this resource. + * + * The following image formats are supported. For brevity's sake, the list is abbreviated. + * For ex., {GL_R, GL_RG} X {8, 16} would expand to the following 4 formats + * {GL_R8, GL_R16, GL_RG8, GL_RG16} : + * - GL_RED, GL_RG, GL_RGBA, GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY + * - {GL_R, GL_RG, GL_RGBA} X {8, 16, 16F, 32F, 8UI, 16UI, 32UI, 8I, 16I, 32I} + * - {GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY} X + * {8, 16, 16F_ARB, 32F_ARB, 8UI_EXT, 16UI_EXT, 32UI_EXT, 8I_EXT, 16I_EXT, 32I_EXT} + * + * The following image classes are currently disallowed: + * - Textures with borders + * - Multisampled renderbuffers + * + * \param pCudaResource - Pointer to the returned object handle + * \param image - name of texture or renderbuffer object to be registered + * \param target - Identifies the type of object specified by \p image + * \param Flags - Register flags + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ALREADY_MAPPED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_OPERATING_SYSTEM + * \notefnerr + * + * \sa + * ::cuGraphicsUnregisterResource, + * ::cuGraphicsMapResources, + * ::cuGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsGLRegisterImage + */ +CUresult CUDAAPI cuGraphicsGLRegisterImage(CUgraphicsResource *pCudaResource, GLuint image, GLenum target, unsigned int Flags); + +#ifdef _WIN32 +/** + * \brief Gets the CUDA device associated with hGpu + * + * Returns in \p *pDevice the CUDA device associated with a \p hGpu, if + * applicable. + * + * \param pDevice - Device associated with hGpu + * \param hGpu - Handle to a GPU, as queried via ::WGL_NV_gpu_affinity() + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuGLMapBufferObject, + * ::cuGLRegisterBufferObject, ::cuGLUnmapBufferObject, + * ::cuGLUnregisterBufferObject, ::cuGLUnmapBufferObjectAsync, + * ::cuGLSetBufferObjectMapFlags, + * ::cudaWGLGetDevice + */ +CUresult CUDAAPI cuWGLGetDevice(CUdevice *pDevice, HGPUNV hGpu); +#endif /* _WIN32 */ + +/** + * CUDA devices corresponding to an OpenGL device + */ +typedef enum CUGLDeviceList_enum { + CU_GL_DEVICE_LIST_ALL = 0x01, /**< The CUDA devices for all GPUs used by the current OpenGL context */ + CU_GL_DEVICE_LIST_CURRENT_FRAME = 0x02, /**< The CUDA devices for the GPUs used by the current OpenGL context in its currently rendering frame */ + CU_GL_DEVICE_LIST_NEXT_FRAME = 0x03, /**< The CUDA devices for the GPUs to be used by the current OpenGL context in the next frame */ +} CUGLDeviceList; + +/** + * \brief Gets the CUDA devices associated with the current OpenGL context + * + * Returns in \p *pCudaDeviceCount the number of CUDA-compatible devices + * corresponding to the current OpenGL context. Also returns in \p *pCudaDevices + * at most cudaDeviceCount of the CUDA-compatible devices corresponding to + * the current OpenGL context. If any of the GPUs being used by the current OpenGL + * context are not CUDA capable then the call will return CUDA_ERROR_NO_DEVICE. + * + * The \p deviceList argument may be any of the following: + * - ::CU_GL_DEVICE_LIST_ALL: Query all devices used by the current OpenGL context. + * - ::CU_GL_DEVICE_LIST_CURRENT_FRAME: Query the devices used by the current OpenGL context to + * render the current frame (in SLI). + * - ::CU_GL_DEVICE_LIST_NEXT_FRAME: Query the devices used by the current OpenGL context to + * render the next frame (in SLI). Note that this is a prediction, it can't be guaranteed that + * this is correct in all cases. + * + * \param pCudaDeviceCount - Returned number of CUDA devices. + * \param pCudaDevices - Returned CUDA devices. + * \param cudaDeviceCount - The size of the output device array pCudaDevices. + * \param deviceList - The set of devices to return. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NO_DEVICE, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_GRAPHICS_CONTEXT, + * ::CUDA_ERROR_OPERATING_SYSTEM + * + * \notefnerr + * + * \sa + * ::cuWGLGetDevice, + * ::cudaGLGetDevices + */ +CUresult CUDAAPI cuGLGetDevices(unsigned int *pCudaDeviceCount, CUdevice *pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList); + +/** + * \defgroup CUDA_GL_DEPRECATED OpenGL Interoperability [DEPRECATED] + * + * ___MANBRIEF___ deprecated OpenGL interoperability functions of the low-level + * CUDA driver API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes deprecated OpenGL interoperability functionality. + * + * @{ + */ + +/** Flags to map or unmap a resource */ +typedef enum CUGLmap_flags_enum { + CU_GL_MAP_RESOURCE_FLAGS_NONE = 0x00, + CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01, + CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02, +} CUGLmap_flags; + +/** + * \brief Create a CUDA context for interoperability with OpenGL + * + * \deprecated This function is deprecated as of Cuda 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA context with an OpenGL + * context in order to achieve maximum interoperability performance. + * + * \param pCtx - Returned CUDA context + * \param Flags - Options for CUDA context creation + * \param device - Device on which to create the context + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_OUT_OF_MEMORY + * \notefnerr + * + * \sa ::cuCtxCreate, ::cuGLInit, ::cuGLMapBufferObject, + * ::cuGLRegisterBufferObject, ::cuGLUnmapBufferObject, + * ::cuGLUnregisterBufferObject, ::cuGLMapBufferObjectAsync, + * ::cuGLUnmapBufferObjectAsync, ::cuGLSetBufferObjectMapFlags, + * ::cuWGLGetDevice + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuGLCtxCreate(CUcontext *pCtx, unsigned int Flags, CUdevice device ); + +/** + * \brief Initializes OpenGL interoperability + * + * \deprecated This function is deprecated as of Cuda 3.0. + * + * Initializes OpenGL interoperability. This function is deprecated + * and calling it is no longer required. It may fail if the needed + * OpenGL driver facilities are not available. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_UNKNOWN + * \notefnerr + * + * \sa ::cuGLMapBufferObject, + * ::cuGLRegisterBufferObject, ::cuGLUnmapBufferObject, + * ::cuGLUnregisterBufferObject, ::cuGLMapBufferObjectAsync, + * ::cuGLUnmapBufferObjectAsync, ::cuGLSetBufferObjectMapFlags, + * ::cuWGLGetDevice + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuGLInit(void); + +/** + * \brief Registers an OpenGL buffer object + * + * \deprecated This function is deprecated as of Cuda 3.0. + * + * Registers the buffer object specified by \p buffer for access by + * CUDA. This function must be called before CUDA can map the buffer + * object. There must be a valid OpenGL context bound to the current + * thread when this function is called, and the buffer name is + * resolved by that context. + * + * \param buffer - The name of the buffer object to register. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_ALREADY_MAPPED + * \notefnerr + * + * \sa ::cuGraphicsGLRegisterBuffer + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuGLRegisterBufferObject(GLuint buffer); + +/** + * \brief Maps an OpenGL buffer object + * + * \deprecated This function is deprecated as of Cuda 3.0. + * + * Maps the buffer object specified by \p buffer into the address space of the + * current CUDA context and returns in \p *dptr and \p *size the base pointer + * and size of the resulting mapping. + * + * There must be a valid OpenGL context bound to the current thread + * when this function is called. This must be the same context, or a + * member of the same shareGroup, as the context that was bound when + * the buffer was registered. + * + * All streams in the current CUDA context are synchronized with the + * current GL context. + * + * \param dptr - Returned mapped base pointer + * \param size - Returned size of mapping + * \param buffer - The name of the buffer object to map + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_MAP_FAILED + * \notefnerr + * + * \sa ::cuGraphicsMapResources + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuGLMapBufferObject(CUdeviceptr *dptr, size_t *size, GLuint buffer); + +/** + * \brief Unmaps an OpenGL buffer object + * + * \deprecated This function is deprecated as of Cuda 3.0. + * + * Unmaps the buffer object specified by \p buffer for access by CUDA. + * + * There must be a valid OpenGL context bound to the current thread + * when this function is called. This must be the same context, or a + * member of the same shareGroup, as the context that was bound when + * the buffer was registered. + * + * All streams in the current CUDA context are synchronized with the + * current GL context. + * + * \param buffer - Buffer object to unmap + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuGraphicsUnmapResources + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuGLUnmapBufferObject(GLuint buffer); + +/** + * \brief Unregister an OpenGL buffer object + * + * \deprecated This function is deprecated as of Cuda 3.0. + * + * Unregisters the buffer object specified by \p buffer. This + * releases any resources associated with the registered buffer. + * After this call, the buffer may no longer be mapped for access by + * CUDA. + * + * There must be a valid OpenGL context bound to the current thread + * when this function is called. This must be the same context, or a + * member of the same shareGroup, as the context that was bound when + * the buffer was registered. + * + * \param buffer - Name of the buffer object to unregister + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuGraphicsUnregisterResource + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuGLUnregisterBufferObject(GLuint buffer); + +/** + * \brief Set the map flags for an OpenGL buffer object + * + * \deprecated This function is deprecated as of Cuda 3.0. + * + * Sets the map flags for the buffer object specified by \p buffer. + * + * Changes to \p Flags will take effect the next time \p buffer is mapped. + * The \p Flags argument may be any of the following: + * - ::CU_GL_MAP_RESOURCE_FLAGS_NONE: Specifies no hints about how this + * resource will be used. It is therefore assumed that this resource will be + * read from and written to by CUDA kernels. This is the default value. + * - ::CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY: Specifies that CUDA kernels which + * access this resource will not write to this resource. + * - ::CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD: Specifies that CUDA kernels + * which access this resource will not read from this resource and will + * write over the entire contents of the resource, so none of the data + * previously stored in the resource will be preserved. + * + * If \p buffer has not been registered for use with CUDA, then + * ::CUDA_ERROR_INVALID_HANDLE is returned. If \p buffer is presently + * mapped for access by CUDA, then ::CUDA_ERROR_ALREADY_MAPPED is returned. + * + * There must be a valid OpenGL context bound to the current thread + * when this function is called. This must be the same context, or a + * member of the same shareGroup, as the context that was bound when + * the buffer was registered. + * + * \param buffer - Buffer object to unmap + * \param Flags - Map flags + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_HANDLE, + * ::CUDA_ERROR_ALREADY_MAPPED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * \notefnerr + * + * \sa ::cuGraphicsResourceSetMapFlags + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuGLSetBufferObjectMapFlags(GLuint buffer, unsigned int Flags); + +/** + * \brief Maps an OpenGL buffer object + * + * \deprecated This function is deprecated as of Cuda 3.0. + * + * Maps the buffer object specified by \p buffer into the address space of the + * current CUDA context and returns in \p *dptr and \p *size the base pointer + * and size of the resulting mapping. + * + * There must be a valid OpenGL context bound to the current thread + * when this function is called. This must be the same context, or a + * member of the same shareGroup, as the context that was bound when + * the buffer was registered. + * + * Stream \p hStream in the current CUDA context is synchronized with + * the current GL context. + * + * \param dptr - Returned mapped base pointer + * \param size - Returned size of mapping + * \param buffer - The name of the buffer object to map + * \param hStream - Stream to synchronize + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_MAP_FAILED + * \notefnerr + * + * \sa ::cuGraphicsMapResources + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuGLMapBufferObjectAsync(CUdeviceptr *dptr, size_t *size, GLuint buffer, CUstream hStream); + +/** + * \brief Unmaps an OpenGL buffer object + * + * \deprecated This function is deprecated as of Cuda 3.0. + * + * Unmaps the buffer object specified by \p buffer for access by CUDA. + * + * There must be a valid OpenGL context bound to the current thread + * when this function is called. This must be the same context, or a + * member of the same shareGroup, as the context that was bound when + * the buffer was registered. + * + * Stream \p hStream in the current CUDA context is synchronized with + * the current GL context. + * + * \param buffer - Name of the buffer object to unmap + * \param hStream - Stream to synchronize + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_DEINITIALIZED, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_INVALID_CONTEXT, + * ::CUDA_ERROR_INVALID_VALUE + * \notefnerr + * + * \sa ::cuGraphicsUnmapResources + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuGLUnmapBufferObjectAsync(GLuint buffer, CUstream hStream); + +/** @} */ /* END CUDA_GL_DEPRECATED */ +/** @} */ /* END CUDA_GL */ + + +#if defined(__CUDA_API_VERSION_INTERNAL) + #undef cuGLCtxCreate + #undef cuGLMapBufferObject + #undef cuGLMapBufferObjectAsync + #undef cuGLGetDevices + + CUresult CUDAAPI cuGLGetDevices(unsigned int *pCudaDeviceCount, CUdevice *pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList); + CUresult CUDAAPI cuGLMapBufferObject_v2(CUdeviceptr *dptr, size_t *size, GLuint buffer); + CUresult CUDAAPI cuGLMapBufferObjectAsync_v2(CUdeviceptr *dptr, size_t *size, GLuint buffer, CUstream hStream); + CUresult CUDAAPI cuGLCtxCreate(CUcontext *pCtx, unsigned int Flags, CUdevice device ); + CUresult CUDAAPI cuGLMapBufferObject(CUdeviceptr_v1 *dptr, unsigned int *size, GLuint buffer); + CUresult CUDAAPI cuGLMapBufferObjectAsync(CUdeviceptr_v1 *dptr, unsigned int *size, GLuint buffer, CUstream hStream); +#endif /* __CUDA_API_VERSION_INTERNAL */ + +#ifdef __cplusplus +}; +#endif + +#undef __CUDA_DEPRECATED + +#endif diff --git a/cuda_toolkit/include/cudaGLTypedefs.h b/cuda_toolkit/include/cudaGLTypedefs.h new file mode 100644 index 0000000000000000000000000000000000000000..66aec9d5e5f7c64c6b47287a42c14555f1248390 --- /dev/null +++ b/cuda_toolkit/include/cudaGLTypedefs.h @@ -0,0 +1,123 @@ +/* + * Copyright 2020-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CUDAGLTYPEDEFS_H +#define CUDAGLTYPEDEFS_H + +// Dependent includes for cudagl.h +#include + +#include + +#if defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) + #define __API_TYPEDEF_PTDS(api, default_version, ptds_version) api ## _v ## ptds_version ## _ptds + #define __API_TYPEDEF_PTSZ(api, default_version, ptds_version) api ## _v ## ptds_version ## _ptsz +#else + #define __API_TYPEDEF_PTDS(api, default_version, ptds_version) api ## _v ## default_version + #define __API_TYPEDEF_PTSZ(api, default_version, ptds_version) api ## _v ## default_version +#endif + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/* + * Macros for the latest version for each driver function in cudaGL.h + */ +#define PFN_cuGraphicsGLRegisterBuffer PFN_cuGraphicsGLRegisterBuffer_v3000 +#define PFN_cuGraphicsGLRegisterImage PFN_cuGraphicsGLRegisterImage_v3000 +#define PFN_cuWGLGetDevice PFN_cuWGLGetDevice_v2020 +#define PFN_cuGLGetDevices PFN_cuGLGetDevices_v6050 +#define PFN_cuGLCtxCreate PFN_cuGLCtxCreate_v3020 +#define PFN_cuGLInit PFN_cuGLInit_v2000 +#define PFN_cuGLRegisterBufferObject PFN_cuGLRegisterBufferObject_v2000 +#define PFN_cuGLMapBufferObject __API_TYPEDEF_PTDS(PFN_cuGLMapBufferObject, 3020, 7000) +#define PFN_cuGLUnmapBufferObject PFN_cuGLUnmapBufferObject_v2000 +#define PFN_cuGLUnregisterBufferObject PFN_cuGLUnregisterBufferObject_v2000 +#define PFN_cuGLSetBufferObjectMapFlags PFN_cuGLSetBufferObjectMapFlags_v2030 +#define PFN_cuGLMapBufferObjectAsync __API_TYPEDEF_PTSZ(PFN_cuGLMapBufferObjectAsync, 3020, 7000) +#define PFN_cuGLUnmapBufferObjectAsync PFN_cuGLUnmapBufferObjectAsync_v2030 + + +/** + * Type definitions for functions defined in cudaGL.h + */ +typedef CUresult (CUDAAPI *PFN_cuGraphicsGLRegisterBuffer_v3000)(CUgraphicsResource *pCudaResource, GLuint buffer, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuGraphicsGLRegisterImage_v3000)(CUgraphicsResource *pCudaResource, GLuint image, GLenum target, unsigned int Flags); +#ifdef _WIN32 +typedef CUresult (CUDAAPI *PFN_cuWGLGetDevice_v2020)(CUdevice_v1 *pDevice, HGPUNV hGpu); +#endif +typedef CUresult (CUDAAPI *PFN_cuGLGetDevices_v6050)(unsigned int *pCudaDeviceCount, CUdevice_v1 *pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList); +typedef CUresult (CUDAAPI *PFN_cuGLCtxCreate_v3020)(CUcontext *pCtx, unsigned int Flags, CUdevice_v1 device); +typedef CUresult (CUDAAPI *PFN_cuGLInit_v2000)(void); +typedef CUresult (CUDAAPI *PFN_cuGLRegisterBufferObject_v2000)(GLuint buffer); +typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObject_v7000_ptds)(CUdeviceptr_v2 *dptr, size_t *size, GLuint buffer); +typedef CUresult (CUDAAPI *PFN_cuGLUnmapBufferObject_v2000)(GLuint buffer); +typedef CUresult (CUDAAPI *PFN_cuGLUnregisterBufferObject_v2000)(GLuint buffer); +typedef CUresult (CUDAAPI *PFN_cuGLSetBufferObjectMapFlags_v2030)(GLuint buffer, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObjectAsync_v7000_ptsz)(CUdeviceptr_v2 *dptr, size_t *size, GLuint buffer, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuGLUnmapBufferObjectAsync_v2030)(GLuint buffer, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObject_v3020)(CUdeviceptr_v2 *dptr, size_t *size, GLuint buffer); +typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObjectAsync_v3020)(CUdeviceptr_v2 *dptr, size_t *size, GLuint buffer, CUstream hStream); + +/* + * Type definitions for older versioned functions in cuda.h + */ +#if defined(__CUDA_API_VERSION_INTERNAL) +typedef CUresult (CUDAAPI *PFN_cuGLGetDevices_v4010)(unsigned int *pCudaDeviceCount, CUdevice_v1 *pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList); +typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObject_v2000)(CUdeviceptr_v1 *dptr, unsigned int *size, GLuint buffer); +typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObjectAsync_v2030)(CUdeviceptr_v1 *dptr, unsigned int *size, GLuint buffer, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuGLCtxCreate_v2000)(CUcontext *pCtx, unsigned int Flags, CUdevice_v1 device); +#endif + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // file guard diff --git a/cuda_toolkit/include/cudaProfiler.h b/cuda_toolkit/include/cudaProfiler.h new file mode 100644 index 0000000000000000000000000000000000000000..32495c5a42b62adc7342641981ab8803f97fc342 --- /dev/null +++ b/cuda_toolkit/include/cudaProfiler.h @@ -0,0 +1,216 @@ +/* + * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef cuda_profiler_H +#define cuda_profiler_H + +#include + +#if defined(__CUDA_API_VERSION_INTERNAL) || defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Profiler Output Modes + */ +/*DEVICE_BUILTIN*/ +typedef enum CUoutput_mode_enum +{ + CU_OUT_KEY_VALUE_PAIR = 0x00, /**< Output mode Key-Value pair format. */ + CU_OUT_CSV = 0x01 /**< Output mode Comma separated values format. */ +}CUoutput_mode; + + +/** + * \ingroup CUDA_DRIVER + * \defgroup CUDA_PROFILER_DEPRECATED Profiler Control [DEPRECATED] + * + * ___MANBRIEF___ profiler control functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the profiler control functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Initialize the profiling. + * + * \deprecated + * + * Note that this function is deprecated and should not be used. + * Starting with CUDA 12.0, it always returns error code ::CUDA_ERROR_NOT_SUPPORTED. + * + * Using this API user can initialize the CUDA profiler by specifying + * the configuration file, output file and output file format. This + * API is generally used to profile different set of counters by + * looping the kernel launch. The \p configFile parameter can be used + * to select profiling options including profiler counters. Refer to + * the "Compute Command Line Profiler User Guide" for supported + * profiler options and counters. + * + * Limitation: The CUDA profiler cannot be initialized with this API + * if another profiling tool is already active, as indicated by the + * ::CUDA_ERROR_PROFILER_DISABLED return code. + * + * Typical usage of the profiling APIs is as follows: + * + * for each set of counters/options\n + * {\n + * cuProfilerInitialize(); //Initialize profiling, set the counters or options in the config file \n + * ...\n + * cuProfilerStart(); \n + * // code to be profiled \n + * cuProfilerStop(); \n + * ...\n + * cuProfilerStart(); \n + * // code to be profiled \n + * cuProfilerStop(); \n + * ...\n + * }\n + * + * \param configFile - Name of the config file that lists the counters/options + * for profiling. + * \param outputFile - Name of the outputFile where the profiling results will + * be stored. + * \param outputMode - outputMode, can be ::CU_OUT_KEY_VALUE_PAIR or ::CU_OUT_CSV. + * + * \return + * ::CUDA_ERROR_NOT_SUPPORTED + * \notefnerr + * + * \sa + * ::cuProfilerStart, + * ::cuProfilerStop, + */ +__CUDA_DEPRECATED CUresult CUDAAPI cuProfilerInitialize(const char *configFile, const char *outputFile, CUoutput_mode outputMode); + +/** @} */ /* END CUDA_PROFILER_DEPRECATED */ + +/** + * \ingroup CUDA_DRIVER + * \defgroup CUDA_PROFILER Profiler Control + * + * ___MANBRIEF___ profiler control functions of the low-level CUDA driver API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the profiler control functions of the low-level CUDA + * driver application programming interface. + * + * @{ + */ + +/** + * \brief Enable profiling. + * + * Enables profile collection by the active profiling tool for the + * current context. If profiling is already enabled, then + * cuProfilerStart() has no effect. + * + * cuProfilerStart and cuProfilerStop APIs are used to + * programmatically control the profiling granularity by allowing + * profiling to be done only on selective pieces of code. + * + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa + * ::cuProfilerInitialize, + * ::cuProfilerStop, + * ::cudaProfilerStart + */ +CUresult CUDAAPI cuProfilerStart(void); + +/** + * \brief Disable profiling. + * + * Disables profile collection by the active profiling tool for the + * current context. If profiling is already disabled, then + * cuProfilerStop() has no effect. + * + * cuProfilerStart and cuProfilerStop APIs are used to + * programmatically control the profiling granularity by allowing + * profiling to be done only on selective pieces of code. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_CONTEXT + * \notefnerr + * + * \sa + * ::cuProfilerInitialize, + * ::cuProfilerStart, + * ::cudaProfilerStop + */ +CUresult CUDAAPI cuProfilerStop(void); + +/** @} */ /* END CUDA_PROFILER */ + +#ifdef __cplusplus +}; +#endif + +#undef __CUDA_DEPRECATED + +#endif + diff --git a/cuda_toolkit/include/cudaProfilerTypedefs.h b/cuda_toolkit/include/cudaProfilerTypedefs.h new file mode 100644 index 0000000000000000000000000000000000000000..e6f393cb34e9bd13ede8b3442e9ed9a155877cd7 --- /dev/null +++ b/cuda_toolkit/include/cudaProfilerTypedefs.h @@ -0,0 +1,78 @@ +/* + * Copyright 2020-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CUDAPROFILERTYPEDEFS_H +#define CUDAPROFILERTYPEDEFS_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/* + * Macros for the latest version for each driver function in cudaProfiler.h + */ +#define PFN_cuProfilerInitialize PFN_cuProfilerInitialize_v4000 +#define PFN_cuProfilerStart PFN_cuProfilerStart_v4000 +#define PFN_cuProfilerStop PFN_cuProfilerStop_v4000 + + +/** + * Type definitions for functions defined in cudaProfiler.h + */ +typedef CUresult (CUDAAPI *PFN_cuProfilerInitialize_v4000)(const char *configFile, const char *outputFile, CUoutput_mode outputMode); +typedef CUresult (CUDAAPI *PFN_cuProfilerStart_v4000)(void); +typedef CUresult (CUDAAPI *PFN_cuProfilerStop_v4000)(void); + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // file guard diff --git a/cuda_toolkit/include/cudaTypedefs.h b/cuda_toolkit/include/cudaTypedefs.h new file mode 100644 index 0000000000000000000000000000000000000000..34d5f4f03634eb9ed4d0d696d415bee59df0b76b --- /dev/null +++ b/cuda_toolkit/include/cudaTypedefs.h @@ -0,0 +1,1102 @@ +/* + * Copyright 2020-2022 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CUDATYPEDEFS_H +#define CUDATYPEDEFS_H + +#include + +#if defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) + #define __API_TYPEDEF_PTDS(api, default_version, ptds_version) api ## _v ## ptds_version ## _ptds + #define __API_TYPEDEF_PTSZ(api, default_version, ptds_version) api ## _v ## ptds_version ## _ptsz +#else + #define __API_TYPEDEF_PTDS(api, default_version, ptds_version) api ## _v ## default_version + #define __API_TYPEDEF_PTSZ(api, default_version, ptds_version) api ## _v ## default_version +#endif + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/* + * Macros for the latest version for each driver function in cuda.h + */ +#define PFN_cuGetErrorString PFN_cuGetErrorString_v6000 +#define PFN_cuGetErrorName PFN_cuGetErrorName_v6000 +#define PFN_cuInit PFN_cuInit_v2000 +#define PFN_cuDriverGetVersion PFN_cuDriverGetVersion_v2020 +#define PFN_cuDeviceGet PFN_cuDeviceGet_v2000 +#define PFN_cuDeviceGetCount PFN_cuDeviceGetCount_v2000 +#define PFN_cuDeviceGetName PFN_cuDeviceGetName_v2000 +#define PFN_cuDeviceGetUuid PFN_cuDeviceGetUuid_v11040 +#define PFN_cuDeviceGetLuid PFN_cuDeviceGetLuid_v10000 +#define PFN_cuDeviceTotalMem PFN_cuDeviceTotalMem_v3020 +#define PFN_cuDeviceGetTexture1DLinearMaxWidth PFN_cuDeviceGetTexture1DLinearMaxWidth_v11010 +#define PFN_cuDeviceGetAttribute PFN_cuDeviceGetAttribute_v2000 +#define PFN_cuDeviceGetNvSciSyncAttributes PFN_cuDeviceGetNvSciSyncAttributes_v10020 +#define PFN_cuDeviceSetMemPool PFN_cuDeviceSetMemPool_v11020 +#define PFN_cuDeviceGetMemPool PFN_cuDeviceGetMemPool_v11020 +#define PFN_cuDeviceGetDefaultMemPool PFN_cuDeviceGetDefaultMemPool_v11020 +#define PFN_cuDeviceGetProperties PFN_cuDeviceGetProperties_v2000 +#define PFN_cuDeviceComputeCapability PFN_cuDeviceComputeCapability_v2000 +#define PFN_cuDevicePrimaryCtxRetain PFN_cuDevicePrimaryCtxRetain_v7000 +#define PFN_cuDevicePrimaryCtxRelease PFN_cuDevicePrimaryCtxRelease_v11000 +#define PFN_cuDevicePrimaryCtxSetFlags PFN_cuDevicePrimaryCtxSetFlags_v11000 +#define PFN_cuDevicePrimaryCtxGetState PFN_cuDevicePrimaryCtxGetState_v7000 +#define PFN_cuDevicePrimaryCtxReset PFN_cuDevicePrimaryCtxReset_v11000 +#define PFN_cuDeviceGetExecAffinitySupport PFN_cuDeviceGetExecAffinitySupport_v11040 +#define PFN_cuCtxCreate PFN_cuCtxCreate_v11040 +#define PFN_cuCtxGetId PFN_cuCtxGetId_v12000 +#define PFN_cuCtxDestroy PFN_cuCtxDestroy_v4000 +#define PFN_cuCtxPushCurrent PFN_cuCtxPushCurrent_v4000 +#define PFN_cuCtxPopCurrent PFN_cuCtxPopCurrent_v4000 +#define PFN_cuCtxSetCurrent PFN_cuCtxSetCurrent_v4000 +#define PFN_cuCtxGetCurrent PFN_cuCtxGetCurrent_v4000 +#define PFN_cuCtxGetDevice PFN_cuCtxGetDevice_v2000 +#define PFN_cuCtxGetFlags PFN_cuCtxGetFlags_v7000 +#define PFN_cuCtxSetFlags PFN_cuCtxSetFlags_v12010 +#define PFN_cuCtxSynchronize PFN_cuCtxSynchronize_v2000 +#define PFN_cuCtxSetLimit PFN_cuCtxSetLimit_v3010 +#define PFN_cuCtxGetLimit PFN_cuCtxGetLimit_v3010 +#define PFN_cuCtxGetCacheConfig PFN_cuCtxGetCacheConfig_v3020 +#define PFN_cuCtxSetCacheConfig PFN_cuCtxSetCacheConfig_v3020 +#define PFN_cuCtxGetSharedMemConfig PFN_cuCtxGetSharedMemConfig_v4020 +#define PFN_cuCtxSetSharedMemConfig PFN_cuCtxSetSharedMemConfig_v4020 +#define PFN_cuCtxGetApiVersion PFN_cuCtxGetApiVersion_v3020 +#define PFN_cuCtxGetStreamPriorityRange PFN_cuCtxGetStreamPriorityRange_v5050 +#define PFN_cuCtxResetPersistingL2Cache PFN_cuCtxResetPersistingL2Cache_v11000 +#define PFN_cuCtxAttach PFN_cuCtxAttach_v2000 +#define PFN_cuCtxDetach PFN_cuCtxDetach_v2000 +#define PFN_cuCtxGetExecAffinity PFN_cuCtxGetExecAffinity_v11040 +#define PFN_cuModuleLoad PFN_cuModuleLoad_v2000 +#define PFN_cuModuleLoadData PFN_cuModuleLoadData_v2000 +#define PFN_cuModuleLoadDataEx PFN_cuModuleLoadDataEx_v2010 +#define PFN_cuModuleLoadFatBinary PFN_cuModuleLoadFatBinary_v2000 +#define PFN_cuModuleUnload PFN_cuModuleUnload_v2000 +#define PFN_cuModuleGetFunction PFN_cuModuleGetFunction_v2000 +#define PFN_cuModuleGetGlobal PFN_cuModuleGetGlobal_v3020 +#define PFN_cuModuleGetTexRef PFN_cuModuleGetTexRef_v2000 +#define PFN_cuModuleGetSurfRef PFN_cuModuleGetSurfRef_v3000 +#define PFN_cuModuleGetFunctionCount PFN_cuModuleGetFunctionCount_v12040 +#define PFN_cuModuleEnumerateFunctions PFN_cuModuleEnumerateFunctions_v12040 +#define PFN_cuLinkCreate PFN_cuLinkCreate_v6050 +#define PFN_cuLinkAddData PFN_cuLinkAddData_v6050 +#define PFN_cuLinkAddFile PFN_cuLinkAddFile_v6050 +#define PFN_cuLinkComplete PFN_cuLinkComplete_v5050 +#define PFN_cuLinkDestroy PFN_cuLinkDestroy_v5050 +#define PFN_cuMemGetInfo PFN_cuMemGetInfo_v3020 +#define PFN_cuMemAlloc PFN_cuMemAlloc_v3020 +#define PFN_cuMemAllocPitch PFN_cuMemAllocPitch_v3020 +#define PFN_cuMemFree PFN_cuMemFree_v3020 +#define PFN_cuMemGetAddressRange PFN_cuMemGetAddressRange_v3020 +#define PFN_cuMemAllocHost PFN_cuMemAllocHost_v3020 +#define PFN_cuMemFreeHost PFN_cuMemFreeHost_v2000 +#define PFN_cuMemHostAlloc PFN_cuMemHostAlloc_v2020 +#define PFN_cuMemHostGetDevicePointer PFN_cuMemHostGetDevicePointer_v3020 +#define PFN_cuMemHostGetFlags PFN_cuMemHostGetFlags_v2030 +#define PFN_cuMemAllocManaged PFN_cuMemAllocManaged_v6000 +#define PFN_cuDeviceGetByPCIBusId PFN_cuDeviceGetByPCIBusId_v4010 +#define PFN_cuDeviceGetPCIBusId PFN_cuDeviceGetPCIBusId_v4010 +#define PFN_cuIpcGetEventHandle PFN_cuIpcGetEventHandle_v4010 +#define PFN_cuIpcOpenEventHandle PFN_cuIpcOpenEventHandle_v4010 +#define PFN_cuIpcGetMemHandle PFN_cuIpcGetMemHandle_v4010 +#define PFN_cuIpcOpenMemHandle PFN_cuIpcOpenMemHandle_v11000 +#define PFN_cuIpcCloseMemHandle PFN_cuIpcCloseMemHandle_v4010 +#define PFN_cuMemHostRegister PFN_cuMemHostRegister_v6050 +#define PFN_cuMemHostUnregister PFN_cuMemHostUnregister_v4000 +#define PFN_cuMemcpy __API_TYPEDEF_PTDS(PFN_cuMemcpy, 4000, 7000) +#define PFN_cuMemcpyPeer __API_TYPEDEF_PTDS(PFN_cuMemcpyPeer, 4000, 7000) +#define PFN_cuMemcpyHtoD __API_TYPEDEF_PTDS(PFN_cuMemcpyHtoD, 3020, 7000) +#define PFN_cuMemcpyDtoH __API_TYPEDEF_PTDS(PFN_cuMemcpyDtoH, 3020, 7000) +#define PFN_cuMemcpyDtoD __API_TYPEDEF_PTDS(PFN_cuMemcpyDtoD, 3020, 7000) +#define PFN_cuMemcpyDtoA __API_TYPEDEF_PTDS(PFN_cuMemcpyDtoA, 3020, 7000) +#define PFN_cuMemcpyAtoD __API_TYPEDEF_PTDS(PFN_cuMemcpyAtoD, 3020, 7000) +#define PFN_cuMemcpyHtoA __API_TYPEDEF_PTDS(PFN_cuMemcpyHtoA, 3020, 7000) +#define PFN_cuMemcpyAtoH __API_TYPEDEF_PTDS(PFN_cuMemcpyAtoH, 3020, 7000) +#define PFN_cuMemcpyAtoA __API_TYPEDEF_PTDS(PFN_cuMemcpyAtoA, 3020, 7000) +#define PFN_cuMemcpy2D __API_TYPEDEF_PTDS(PFN_cuMemcpy2D, 3020, 7000) +#define PFN_cuMemcpy2DUnaligned __API_TYPEDEF_PTDS(PFN_cuMemcpy2DUnaligned, 3020, 7000) +#define PFN_cuMemcpy3D __API_TYPEDEF_PTDS(PFN_cuMemcpy3D, 3020, 7000) +#define PFN_cuMemcpy3DPeer __API_TYPEDEF_PTDS(PFN_cuMemcpy3DPeer, 4000, 7000) +#define PFN_cuMemcpyAsync __API_TYPEDEF_PTSZ(PFN_cuMemcpyAsync, 4000, 7000) +#define PFN_cuMemcpyPeerAsync __API_TYPEDEF_PTSZ(PFN_cuMemcpyPeerAsync, 4000, 7000) +#define PFN_cuMemcpyHtoDAsync __API_TYPEDEF_PTSZ(PFN_cuMemcpyHtoDAsync, 3020, 7000) +#define PFN_cuMemcpyDtoHAsync __API_TYPEDEF_PTSZ(PFN_cuMemcpyDtoHAsync, 3020, 7000) +#define PFN_cuMemcpyDtoDAsync __API_TYPEDEF_PTSZ(PFN_cuMemcpyDtoDAsync, 3020, 7000) +#define PFN_cuMemcpyHtoAAsync __API_TYPEDEF_PTSZ(PFN_cuMemcpyHtoAAsync, 3020, 7000) +#define PFN_cuMemcpyAtoHAsync __API_TYPEDEF_PTSZ(PFN_cuMemcpyAtoHAsync, 3020, 7000) +#define PFN_cuMemcpy2DAsync __API_TYPEDEF_PTSZ(PFN_cuMemcpy2DAsync, 3020, 7000) +#define PFN_cuMemcpy3DAsync __API_TYPEDEF_PTSZ(PFN_cuMemcpy3DAsync, 3020, 7000) +#define PFN_cuMemcpy3DPeerAsync __API_TYPEDEF_PTSZ(PFN_cuMemcpy3DPeerAsync, 4000, 7000) +#define PFN_cuMemsetD8 __API_TYPEDEF_PTDS(PFN_cuMemsetD8, 3020, 7000) +#define PFN_cuMemsetD16 __API_TYPEDEF_PTDS(PFN_cuMemsetD16, 3020, 7000) +#define PFN_cuMemsetD32 __API_TYPEDEF_PTDS(PFN_cuMemsetD32, 3020, 7000) +#define PFN_cuMemsetD2D8 __API_TYPEDEF_PTDS(PFN_cuMemsetD2D8, 3020, 7000) +#define PFN_cuMemsetD2D16 __API_TYPEDEF_PTDS(PFN_cuMemsetD2D16, 3020, 7000) +#define PFN_cuMemsetD2D32 __API_TYPEDEF_PTDS(PFN_cuMemsetD2D32, 3020, 7000) +#define PFN_cuMemsetD8Async __API_TYPEDEF_PTSZ(PFN_cuMemsetD8Async, 3020, 7000) +#define PFN_cuMemsetD16Async __API_TYPEDEF_PTSZ(PFN_cuMemsetD16Async, 3020, 7000) +#define PFN_cuMemsetD32Async __API_TYPEDEF_PTSZ(PFN_cuMemsetD32Async, 3020, 7000) +#define PFN_cuMemsetD2D8Async __API_TYPEDEF_PTSZ(PFN_cuMemsetD2D8Async, 3020, 7000) +#define PFN_cuMemsetD2D16Async __API_TYPEDEF_PTSZ(PFN_cuMemsetD2D16Async, 3020, 7000) +#define PFN_cuMemsetD2D32Async __API_TYPEDEF_PTSZ(PFN_cuMemsetD2D32Async, 3020, 7000) +#define PFN_cuArrayCreate PFN_cuArrayCreate_v3020 +#define PFN_cuArrayGetDescriptor PFN_cuArrayGetDescriptor_v3020 +#define PFN_cuArrayGetSparseProperties PFN_cuArrayGetSparseProperties_v11010 +#define PFN_cuMipmappedArrayGetSparseProperties PFN_cuMipmappedArrayGetSparseProperties_v11010 +#define PFN_cuArrayGetMemoryRequirements PFN_cuArrayGetMemoryRequirements_v11060 +#define PFN_cuMipmappedArrayGetMemoryRequirements PFN_cuMipmappedArrayGetMemoryRequirements_v11060 +#define PFN_cuArrayGetPlane PFN_cuArrayGetPlane_v11020 +#define PFN_cuArrayDestroy PFN_cuArrayDestroy_v2000 +#define PFN_cuArray3DCreate PFN_cuArray3DCreate_v3020 +#define PFN_cuArray3DGetDescriptor PFN_cuArray3DGetDescriptor_v3020 +#define PFN_cuMipmappedArrayCreate PFN_cuMipmappedArrayCreate_v5000 +#define PFN_cuMipmappedArrayGetLevel PFN_cuMipmappedArrayGetLevel_v5000 +#define PFN_cuMipmappedArrayDestroy PFN_cuMipmappedArrayDestroy_v5000 +#define PFN_cuMemAddressReserve PFN_cuMemAddressReserve_v10020 +#define PFN_cuMemAddressFree PFN_cuMemAddressFree_v10020 +#define PFN_cuMemCreate PFN_cuMemCreate_v10020 +#define PFN_cuMemRelease PFN_cuMemRelease_v10020 +#define PFN_cuMemMap PFN_cuMemMap_v10020 +#define PFN_cuMemMapArrayAsync __API_TYPEDEF_PTSZ(PFN_cuMemMapArrayAsync, 11010, 11010) +#define PFN_cuMemUnmap PFN_cuMemUnmap_v10020 +#define PFN_cuMemSetAccess PFN_cuMemSetAccess_v10020 +#define PFN_cuMemGetAccess PFN_cuMemGetAccess_v10020 +#define PFN_cuMemExportToShareableHandle PFN_cuMemExportToShareableHandle_v10020 +#define PFN_cuMemImportFromShareableHandle PFN_cuMemImportFromShareableHandle_v10020 +#define PFN_cuMemGetAllocationGranularity PFN_cuMemGetAllocationGranularity_v10020 +#define PFN_cuMemGetAllocationPropertiesFromHandle PFN_cuMemGetAllocationPropertiesFromHandle_v10020 +#define PFN_cuMemRetainAllocationHandle PFN_cuMemRetainAllocationHandle_v11000 +#define PFN_cuMemFreeAsync __API_TYPEDEF_PTSZ(PFN_cuMemFreeAsync, 11020, 11020) +#define PFN_cuMemAllocAsync __API_TYPEDEF_PTSZ(PFN_cuMemAllocAsync, 11020, 11020) +#define PFN_cuMemPoolTrimTo PFN_cuMemPoolTrimTo_v11020 +#define PFN_cuMemPoolSetAttribute PFN_cuMemPoolSetAttribute_v11020 +#define PFN_cuMemPoolGetAttribute PFN_cuMemPoolGetAttribute_v11020 +#define PFN_cuMemPoolSetAccess PFN_cuMemPoolSetAccess_v11020 +#define PFN_cuMemPoolGetAccess PFN_cuMemPoolGetAccess_v11020 +#define PFN_cuMemPoolCreate PFN_cuMemPoolCreate_v11020 +#define PFN_cuMemPoolDestroy PFN_cuMemPoolDestroy_v11020 +#define PFN_cuMemAllocFromPoolAsync __API_TYPEDEF_PTSZ(PFN_cuMemAllocFromPoolAsync, 11020, 11020) +#define PFN_cuMemPoolExportToShareableHandle PFN_cuMemPoolExportToShareableHandle_v11020 +#define PFN_cuMemPoolImportFromShareableHandle PFN_cuMemPoolImportFromShareableHandle_v11020 +#define PFN_cuMemPoolExportPointer PFN_cuMemPoolExportPointer_v11020 +#define PFN_cuMemPoolImportPointer PFN_cuMemPoolImportPointer_v11020 +#define PFN_cuPointerGetAttribute PFN_cuPointerGetAttribute_v4000 +#define PFN_cuMemPrefetchAsync __API_TYPEDEF_PTSZ(PFN_cuMemPrefetchAsync, 8000, 8000) +#define PFN_cuMemAdvise PFN_cuMemAdvise_v8000 +#define PFN_cuMemAdvise_v2 PFN_cuMemAdvise_v12020 +#define PFN_cuMemPrefetchAsync_v2 __API_TYPEDEF_PTSZ(PFN_cuMemPrefetchAsync, 12020, 12020) +#define PFN_cuMemRangeGetAttribute PFN_cuMemRangeGetAttribute_v8000 +#define PFN_cuMemRangeGetAttributes PFN_cuMemRangeGetAttributes_v8000 +#define PFN_cuMulticastCreate PFN_cuMulticastCreate_v12010 +#define PFN_cuMulticastAddDevice PFN_cuMulticastAddDevice_v12010 +#define PFN_cuMulticastBindMem PFN_cuMulticastBindMem_v12010 +#define PFN_cuMulticastBindAddr PFN_cuMulticastBindAddr_v12010 +#define PFN_cuMulticastUnbind PFN_cuMulticastUnbind_v12010 +#define PFN_cuMulticastGetGranularity PFN_cuMulticastGetGranularity_v12010 +#define PFN_cuPointerSetAttribute PFN_cuPointerSetAttribute_v6000 +#define PFN_cuPointerGetAttributes PFN_cuPointerGetAttributes_v7000 +#define PFN_cuStreamCreate PFN_cuStreamCreate_v2000 +#define PFN_cuStreamCreateWithPriority PFN_cuStreamCreateWithPriority_v5050 +#define PFN_cuStreamGetId __API_TYPEDEF_PTSZ(PFN_cuStreamGetId_v12000, 12000, 12000) +#define PFN_cuStreamGetPriority __API_TYPEDEF_PTSZ(PFN_cuStreamGetPriority, 5050, 7000) +#define PFN_cuStreamGetFlags __API_TYPEDEF_PTSZ(PFN_cuStreamGetFlags, 5050, 7000) +#define PFN_cuStreamGetCtx __API_TYPEDEF_PTSZ(PFN_cuStreamGetCtx, 9020, 9020) +#define PFN_cuStreamWaitEvent __API_TYPEDEF_PTSZ(PFN_cuStreamWaitEvent, 3020, 7000) +#define PFN_cuStreamAddCallback __API_TYPEDEF_PTSZ(PFN_cuStreamAddCallback, 5000, 7000) +#define PFN_cuStreamBeginCapture __API_TYPEDEF_PTSZ(PFN_cuStreamBeginCapture, 10010, 10010) +#define PFN_cuStreamBeginCaptureToGraph __API_TYPEDEF_PTSZ(PFN_cuStreamBeginCaptureToGraph, 12030, 12030) +#define PFN_cuThreadExchangeStreamCaptureMode PFN_cuThreadExchangeStreamCaptureMode_v10010 +#define PFN_cuStreamEndCapture __API_TYPEDEF_PTSZ(PFN_cuStreamEndCapture, 10000, 10000) +#define PFN_cuStreamIsCapturing __API_TYPEDEF_PTSZ(PFN_cuStreamIsCapturing, 10000, 10000) +#define PFN_cuStreamGetCaptureInfo __API_TYPEDEF_PTSZ(PFN_cuStreamGetCaptureInfo, 10010, 10010) +#define PFN_cuStreamGetCaptureInfo_v2 __API_TYPEDEF_PTSZ(PFN_cuStreamGetCaptureInfo, 11030, 11030) +#define PFN_cuStreamGetCaptureInfo_v3 __API_TYPEDEF_PTSZ(PFN_cuStreamGetCaptureInfo, 12030, 12030) +#define PFN_cuStreamUpdateCaptureDependencies __API_TYPEDEF_PTSZ(PFN_cuStreamUpdateCaptureDependencies, 11030, 11030) +#define PFN_cuStreamUpdateCaptureDependencies_v2 __API_TYPEDEF_PTSZ(PFN_cuStreamUpdateCaptureDependencies, 12030, 12030) +#define PFN_cuStreamAttachMemAsync __API_TYPEDEF_PTSZ(PFN_cuStreamAttachMemAsync, 6000, 7000) +#define PFN_cuStreamQuery __API_TYPEDEF_PTSZ(PFN_cuStreamQuery, 2000, 7000) +#define PFN_cuStreamSynchronize __API_TYPEDEF_PTSZ(PFN_cuStreamSynchronize, 2000, 7000) +#define PFN_cuStreamDestroy PFN_cuStreamDestroy_v4000 +#define PFN_cuStreamCopyAttributes __API_TYPEDEF_PTSZ(PFN_cuStreamCopyAttributes, 11000, 11000) +#define PFN_cuStreamGetAttribute __API_TYPEDEF_PTSZ(PFN_cuStreamGetAttribute, 11000, 11000) +#define PFN_cuStreamSetAttribute __API_TYPEDEF_PTSZ(PFN_cuStreamSetAttribute, 11000, 11000) +#define PFN_cuEventCreate PFN_cuEventCreate_v2000 +#define PFN_cuEventRecord __API_TYPEDEF_PTSZ(PFN_cuEventRecord, 2000, 7000) +#define PFN_cuEventRecordWithFlags __API_TYPEDEF_PTSZ(PFN_cuEventRecordWithFlags, 11010, 11010) +#define PFN_cuEventQuery PFN_cuEventQuery_v2000 +#define PFN_cuEventSynchronize PFN_cuEventSynchronize_v2000 +#define PFN_cuEventDestroy PFN_cuEventDestroy_v4000 +#define PFN_cuEventElapsedTime PFN_cuEventElapsedTime_v2000 +#define PFN_cuImportExternalMemory PFN_cuImportExternalMemory_v10000 +#define PFN_cuExternalMemoryGetMappedBuffer PFN_cuExternalMemoryGetMappedBuffer_v10000 +#define PFN_cuExternalMemoryGetMappedMipmappedArray PFN_cuExternalMemoryGetMappedMipmappedArray_v10000 +#define PFN_cuDestroyExternalMemory PFN_cuDestroyExternalMemory_v10000 +#define PFN_cuImportExternalSemaphore PFN_cuImportExternalSemaphore_v10000 +#define PFN_cuSignalExternalSemaphoresAsync __API_TYPEDEF_PTSZ(PFN_cuSignalExternalSemaphoresAsync, 10000, 10000) +#define PFN_cuWaitExternalSemaphoresAsync __API_TYPEDEF_PTSZ(PFN_cuWaitExternalSemaphoresAsync, 10000, 10000) +#define PFN_cuDestroyExternalSemaphore PFN_cuDestroyExternalSemaphore_v10000 +#define PFN_cuStreamWaitValue32 __API_TYPEDEF_PTSZ(PFN_cuStreamWaitValue32, 8000, 8000) +#define PFN_cuStreamWaitValue64 __API_TYPEDEF_PTSZ(PFN_cuStreamWaitValue64, 9000, 9000) +#define PFN_cuStreamWriteValue32 __API_TYPEDEF_PTSZ(PFN_cuStreamWriteValue32, 8000, 8000) +#define PFN_cuStreamWriteValue64 __API_TYPEDEF_PTSZ(PFN_cuStreamWriteValue64, 9000, 9000) +#define PFN_cuStreamBatchMemOp __API_TYPEDEF_PTSZ(PFN_cuStreamBatchMemOp, 8000, 8000) +#define PFN_cuStreamWaitValue32_v2 __API_TYPEDEF_PTSZ(PFN_cuStreamWaitValue32, 11070, 11070) +#define PFN_cuStreamWaitValue64_v2 __API_TYPEDEF_PTSZ(PFN_cuStreamWaitValue64, 11070, 11070) +#define PFN_cuStreamWriteValue32_v2 __API_TYPEDEF_PTSZ(PFN_cuStreamWriteValue32, 11070, 11070) +#define PFN_cuStreamWriteValue64_v2 __API_TYPEDEF_PTSZ(PFN_cuStreamWriteValue64, 11070, 11070) +#define PFN_cuStreamBatchMemOp_v2 __API_TYPEDEF_PTSZ(PFN_cuStreamBatchMemOp, 11070, 11070) +#define PFN_cuFuncGetAttribute PFN_cuFuncGetAttribute_v2020 +#define PFN_cuFuncSetAttribute PFN_cuFuncSetAttribute_v9000 +#define PFN_cuFuncSetCacheConfig PFN_cuFuncSetCacheConfig_v3000 +#define PFN_cuFuncSetSharedMemConfig PFN_cuFuncSetSharedMemConfig_v4020 +#define PFN_cuFuncGetName PFN_cuFuncGetName_v12030 +#define PFN_cuFuncGetParamInfo PFN_cuFuncGetParamInfo_v12040 +#define PFN_cuFuncIsLoaded PFN_cuFuncIsLoaded_v12040 +#define PFN_cuFuncLoad PFN_cuFuncLoad_v12040 +#define PFN_cuLaunchKernel __API_TYPEDEF_PTSZ(PFN_cuLaunchKernel, 4000, 7000) +#define PFN_cuLaunchKernelEx __API_TYPEDEF_PTSZ(PFN_cuLaunchKernelEx, 11060, 11060) +#define PFN_cuLaunchCooperativeKernel __API_TYPEDEF_PTSZ(PFN_cuLaunchCooperativeKernel, 9000, 9000) +#define PFN_cuLaunchCooperativeKernelMultiDevice PFN_cuLaunchCooperativeKernelMultiDevice_v9000 +#define PFN_cuLaunchHostFunc __API_TYPEDEF_PTSZ(PFN_cuLaunchHostFunc, 10000, 10000) +#define PFN_cuFuncSetBlockShape PFN_cuFuncSetBlockShape_v2000 +#define PFN_cuFuncSetSharedSize PFN_cuFuncSetSharedSize_v2000 +#define PFN_cuParamSetSize PFN_cuParamSetSize_v2000 +#define PFN_cuParamSeti PFN_cuParamSeti_v2000 +#define PFN_cuParamSetf PFN_cuParamSetf_v2000 +#define PFN_cuParamSetv PFN_cuParamSetv_v2000 +#define PFN_cuLaunch PFN_cuLaunch_v2000 +#define PFN_cuLaunchGrid PFN_cuLaunchGrid_v2000 +#define PFN_cuLaunchGridAsync PFN_cuLaunchGridAsync_v2000 +#define PFN_cuParamSetTexRef PFN_cuParamSetTexRef_v2000 +#define PFN_cuGraphCreate PFN_cuGraphCreate_v10000 +#define PFN_cuGraphAddKernelNode PFN_cuGraphAddKernelNode_v12000 +#define PFN_cuGraphKernelNodeGetParams PFN_cuGraphKernelNodeGetParams_v12000 +#define PFN_cuGraphKernelNodeSetParams PFN_cuGraphKernelNodeSetParams_v12000 +#define PFN_cuGraphAddMemcpyNode PFN_cuGraphAddMemcpyNode_v10000 +#define PFN_cuGraphMemcpyNodeGetParams PFN_cuGraphMemcpyNodeGetParams_v10000 +#define PFN_cuGraphMemcpyNodeSetParams PFN_cuGraphMemcpyNodeSetParams_v10000 +#define PFN_cuGraphAddMemsetNode PFN_cuGraphAddMemsetNode_v10000 +#define PFN_cuGraphMemsetNodeGetParams PFN_cuGraphMemsetNodeGetParams_v10000 +#define PFN_cuGraphMemsetNodeSetParams PFN_cuGraphMemsetNodeSetParams_v10000 +#define PFN_cuGraphAddHostNode PFN_cuGraphAddHostNode_v10000 +#define PFN_cuGraphHostNodeGetParams PFN_cuGraphHostNodeGetParams_v10000 +#define PFN_cuGraphHostNodeSetParams PFN_cuGraphHostNodeSetParams_v10000 +#define PFN_cuGraphAddChildGraphNode PFN_cuGraphAddChildGraphNode_v10000 +#define PFN_cuGraphChildGraphNodeGetGraph PFN_cuGraphChildGraphNodeGetGraph_v10000 +#define PFN_cuGraphAddEmptyNode PFN_cuGraphAddEmptyNode_v10000 +#define PFN_cuGraphAddEventRecordNode PFN_cuGraphAddEventRecordNode_v11010 +#define PFN_cuGraphEventRecordNodeGetEvent PFN_cuGraphEventRecordNodeGetEvent_v11010 +#define PFN_cuGraphEventRecordNodeSetEvent PFN_cuGraphEventRecordNodeSetEvent_v11010 +#define PFN_cuGraphAddEventWaitNode PFN_cuGraphAddEventWaitNode_v11010 +#define PFN_cuGraphEventWaitNodeGetEvent PFN_cuGraphEventWaitNodeGetEvent_v11010 +#define PFN_cuGraphEventWaitNodeSetEvent PFN_cuGraphEventWaitNodeSetEvent_v11010 +#define PFN_cuGraphAddExternalSemaphoresSignalNode PFN_cuGraphAddExternalSemaphoresSignalNode_v11020 +#define PFN_cuGraphExternalSemaphoresSignalNodeGetParams PFN_cuGraphExternalSemaphoresSignalNodeGetParams_v11020 +#define PFN_cuGraphExternalSemaphoresSignalNodeSetParams PFN_cuGraphExternalSemaphoresSignalNodeSetParams_v11020 +#define PFN_cuGraphAddExternalSemaphoresWaitNode PFN_cuGraphAddExternalSemaphoresWaitNode_v11020 +#define PFN_cuGraphExternalSemaphoresWaitNodeGetParams PFN_cuGraphExternalSemaphoresWaitNodeGetParams_v11020 +#define PFN_cuGraphExternalSemaphoresWaitNodeSetParams PFN_cuGraphExternalSemaphoresWaitNodeSetParams_v11020 +#define PFN_cuGraphAddBatchMemOpNode PFN_cuGraphAddBatchMemOpNode_v11070 +#define PFN_cuGraphBatchMemOpNodeGetParams PFN_cuGraphBatchMemOpNodeGetParams_v11070 +#define PFN_cuGraphBatchMemOpNodeSetParams PFN_cuGraphBatchMemOpNodeSetParams _v11070 +#define PFN_cuGraphExecBatchMemOpNodeSetParams PFN_cuGraphExecBatchMemOpNodeSetParams_v11070 +#define PFN_cuGraphClone PFN_cuGraphClone_v10000 +#define PFN_cuGraphNodeFindInClone PFN_cuGraphNodeFindInClone_v10000 +#define PFN_cuGraphNodeGetType PFN_cuGraphNodeGetType_v10000 +#define PFN_cuGraphGetNodes PFN_cuGraphGetNodes_v10000 +#define PFN_cuGraphGetRootNodes PFN_cuGraphGetRootNodes_v10000 +#define PFN_cuGraphGetEdges PFN_cuGraphGetEdges_v12030 +#define PFN_cuGraphNodeGetDependencies PFN_cuGraphNodeGetDependencies_v12030 +#define PFN_cuGraphNodeGetDependentNodes PFN_cuGraphNodeGetDependentNodes_v12030 +#define PFN_cuGraphAddDependencies PFN_cuGraphAddDependencies_v12030 +#define PFN_cuGraphRemoveDependencies PFN_cuGraphRemoveDependencies_v12030 +#define PFN_cuGraphDestroyNode PFN_cuGraphDestroyNode_v10000 + +#define PFN_cuGraphInstantiate PFN_cuGraphInstantiateWithFlags_v11040 + +#define PFN_cuGraphInstantiateWithFlags PFN_cuGraphInstantiateWithFlags_v11040 +#define PFN_cuGraphInstantiateWithParams __API_TYPEDEF_PTSZ(PFN_cuGraphInstantiateWithParams, 12000, 12000) +#define PFN_cuGraphExecGetFlags PFN_cuGraphExecGetFlags_v12000 +#define PFN_cuGraphExecKernelNodeSetParams PFN_cuGraphExecKernelNodeSetParams_v12000 +#define PFN_cuGraphExecMemcpyNodeSetParams PFN_cuGraphExecMemcpyNodeSetParams_v10020 +#define PFN_cuGraphExecMemsetNodeSetParams PFN_cuGraphExecMemsetNodeSetParams_v10020 +#define PFN_cuGraphExecHostNodeSetParams PFN_cuGraphExecHostNodeSetParams_v10020 +#define PFN_cuGraphExecChildGraphNodeSetParams PFN_cuGraphExecChildGraphNodeSetParams_v11010 +#define PFN_cuGraphExecEventRecordNodeSetEvent PFN_cuGraphExecEventRecordNodeSetEvent_v11010 +#define PFN_cuGraphExecEventWaitNodeSetEvent PFN_cuGraphExecEventWaitNodeSetEvent_v11010 +#define PFN_cuGraphExecExternalSemaphoresSignalNodeSetParams PFN_cuGraphExecExternalSemaphoresSignalNodeSetParams_v11020 +#define PFN_cuGraphExecExternalSemaphoresWaitNodeSetParams PFN_cuGraphExecExternalSemaphoresWaitNodeSetParams_v11020 +#define PFN_cuGraphUpload __API_TYPEDEF_PTSZ(PFN_cuGraphUpload, 11010, 11010) +#define PFN_cuGraphLaunch __API_TYPEDEF_PTSZ(PFN_cuGraphLaunch, 10000, 10000) +#define PFN_cuGraphExecDestroy PFN_cuGraphExecDestroy_v10000 +#define PFN_cuGraphDestroy PFN_cuGraphDestroy_v10000 +#define PFN_cuGraphExecUpdate PFN_cuGraphExecUpdate_v12000 +#define PFN_cuGraphKernelNodeCopyAttributes PFN_cuGraphKernelNodeCopyAttributes_v11000 +#define PFN_cuGraphKernelNodeGetAttribute PFN_cuGraphKernelNodeGetAttribute_v11000 +#define PFN_cuGraphKernelNodeSetAttribute PFN_cuGraphKernelNodeSetAttribute_v11000 +#define PFN_cuGraphDebugDotPrint PFN_cuGraphDebugDotPrint_v11030 +#define PFN_cuGraphAddMemAllocNode PFN_cuGraphAddMemAllocNode_v11040 +#define PFN_cuGraphMemAllocNodeGetParams PFN_cuGraphMemAllocNodeGetParams_v11040 +#define PFN_cuGraphAddMemFreeNode PFN_cuGraphAddMemFreeNode_v11040 +#define PFN_cuGraphMemFreeNodeGetParams PFN_cuGraphMemFreeNodeGetParams_v11040 +#define PFN_cuGraphNodeSetEnabled PFN_cuGraphNodeSetEnabled_v11060 +#define PFN_cuGraphNodeGetEnabled PFN_cuGraphNodeGetEnabled_v11060 +#define PFN_cuGraphAddNode PFN_cuGraphAddNode_v12030 +#define PFN_cuGraphNodeSetParams PFN_cuGraphNodeSetParams_v12020 +#define PFN_cuGraphExecNodeSetParams PFN_cuGraphExecNodeSetParams_v12020 +#define PFN_GraphConditionalHandleCreate PFN_cuGraphConditionalHandleCreate_v12030 +#define PFN_cuDeviceGraphMemTrim PFN_cuDeviceGraphMemTrim_v11040 +#define PFN_cuDeviceGetGraphMemAttribute PFN_cuDeviceGetGraphMemAttribute_v11040 +#define PFN_cuDeviceSetGraphMemAttribute PFN_cuDeviceSetGraphMemAttribute_v11040 +#define PFN_cuOccupancyMaxActiveBlocksPerMultiprocessor PFN_cuOccupancyMaxActiveBlocksPerMultiprocessor_v6050 +#define PFN_cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags PFN_cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags_v7000 +#define PFN_cuOccupancyMaxPotentialBlockSize PFN_cuOccupancyMaxPotentialBlockSize_v6050 +#define PFN_cuOccupancyMaxPotentialBlockSizeWithFlags PFN_cuOccupancyMaxPotentialBlockSizeWithFlags_v7000 +#define PFN_cuOccupancyAvailableDynamicSMemPerBlock PFN_cuOccupancyAvailableDynamicSMemPerBlock_v10020 +#define PFN_cuOccupancyMaxPotentialClusterSize PFN_cuOccupancyMaxPotentialClusterSize_v11070 +#define PFN_cuOccupancyMaxActiveClusters PFN_cuOccupancyMaxActiveClusters_v11070 +#define PFN_cuTexRefSetArray PFN_cuTexRefSetArray_v2000 +#define PFN_cuTexRefSetMipmappedArray PFN_cuTexRefSetMipmappedArray_v5000 +#define PFN_cuTexRefSetAddress PFN_cuTexRefSetAddress_v3020 +#define PFN_cuTexRefSetAddress2D PFN_cuTexRefSetAddress2D_v4010 +#define PFN_cuTexRefSetFormat PFN_cuTexRefSetFormat_v2000 +#define PFN_cuTexRefSetAddressMode PFN_cuTexRefSetAddressMode_v2000 +#define PFN_cuTexRefSetFilterMode PFN_cuTexRefSetFilterMode_v2000 +#define PFN_cuTexRefSetMipmapFilterMode PFN_cuTexRefSetMipmapFilterMode_v5000 +#define PFN_cuTexRefSetMipmapLevelBias PFN_cuTexRefSetMipmapLevelBias_v5000 +#define PFN_cuTexRefSetMipmapLevelClamp PFN_cuTexRefSetMipmapLevelClamp_v5000 +#define PFN_cuTexRefSetMaxAnisotropy PFN_cuTexRefSetMaxAnisotropy_v5000 +#define PFN_cuTexRefSetBorderColor PFN_cuTexRefSetBorderColor_v8000 +#define PFN_cuTexRefSetFlags PFN_cuTexRefSetFlags_v2000 +#define PFN_cuTexRefGetAddress PFN_cuTexRefGetAddress_v3020 +#define PFN_cuTexRefGetArray PFN_cuTexRefGetArray_v2000 +#define PFN_cuTexRefGetMipmappedArray PFN_cuTexRefGetMipmappedArray_v5000 +#define PFN_cuTexRefGetAddressMode PFN_cuTexRefGetAddressMode_v2000 +#define PFN_cuTexRefGetFilterMode PFN_cuTexRefGetFilterMode_v2000 +#define PFN_cuTexRefGetFormat PFN_cuTexRefGetFormat_v2000 +#define PFN_cuTexRefGetMipmapFilterMode PFN_cuTexRefGetMipmapFilterMode_v5000 +#define PFN_cuTexRefGetMipmapLevelBias PFN_cuTexRefGetMipmapLevelBias_v5000 +#define PFN_cuTexRefGetMipmapLevelClamp PFN_cuTexRefGetMipmapLevelClamp_v5000 +#define PFN_cuTexRefGetMaxAnisotropy PFN_cuTexRefGetMaxAnisotropy_v5000 +#define PFN_cuTexRefGetBorderColor PFN_cuTexRefGetBorderColor_v8000 +#define PFN_cuTexRefGetFlags PFN_cuTexRefGetFlags_v2000 +#define PFN_cuTexRefCreate PFN_cuTexRefCreate_v2000 +#define PFN_cuTexRefDestroy PFN_cuTexRefDestroy_v2000 +#define PFN_cuSurfRefSetArray PFN_cuSurfRefSetArray_v3000 +#define PFN_cuSurfRefGetArray PFN_cuSurfRefGetArray_v3000 +#define PFN_cuTexObjectCreate PFN_cuTexObjectCreate_v5000 +#define PFN_cuTexObjectDestroy PFN_cuTexObjectDestroy_v5000 +#define PFN_cuTexObjectGetResourceDesc PFN_cuTexObjectGetResourceDesc_v5000 +#define PFN_cuTexObjectGetTextureDesc PFN_cuTexObjectGetTextureDesc_v5000 +#define PFN_cuTexObjectGetResourceViewDesc PFN_cuTexObjectGetResourceViewDesc_v5000 +#define PFN_cuSurfObjectCreate PFN_cuSurfObjectCreate_v5000 +#define PFN_cuSurfObjectDestroy PFN_cuSurfObjectDestroy_v5000 +#define PFN_cuSurfObjectGetResourceDesc PFN_cuSurfObjectGetResourceDesc_v5000 +#define PFN_cuTensorMapEncodeTiled PFN_cuTensorMapEncodeTiled_v12000 +#define PFN_cuTensorMapEncodeIm2col PFN_cuTensorMapEncodeIm2col_v12000 +#define PFN_cuTensorMapReplaceAddress PFN_cuTensorMapReplaceAddress_v12000 +#define PFN_cuDeviceCanAccessPeer PFN_cuDeviceCanAccessPeer_v4000 +#define PFN_cuCtxEnablePeerAccess PFN_cuCtxEnablePeerAccess_v4000 +#define PFN_cuCtxDisablePeerAccess PFN_cuCtxDisablePeerAccess_v4000 +#define PFN_cuDeviceGetP2PAttribute PFN_cuDeviceGetP2PAttribute_v8000 +#define PFN_cuGraphicsUnregisterResource PFN_cuGraphicsUnregisterResource_v3000 +#define PFN_cuGraphicsSubResourceGetMappedArray PFN_cuGraphicsSubResourceGetMappedArray_v3000 +#define PFN_cuGraphicsResourceGetMappedMipmappedArray PFN_cuGraphicsResourceGetMappedMipmappedArray_v5000 +#define PFN_cuGraphicsResourceGetMappedPointer PFN_cuGraphicsResourceGetMappedPointer_v3020 +#define PFN_cuGraphicsResourceSetMapFlags PFN_cuGraphicsResourceSetMapFlags_v6050 +#define PFN_cuGraphicsMapResources __API_TYPEDEF_PTSZ(PFN_cuGraphicsMapResources, 3000, 7000) +#define PFN_cuGraphicsUnmapResources __API_TYPEDEF_PTSZ(PFN_cuGraphicsUnmapResources, 3000, 7000) +#define PFN_cuGetExportTable PFN_cuGetExportTable_v3000 +#define PFN_cuFuncGetModule PFN_cuFuncGetModule_v11000 +#define PFN_cuFlushGPUDirectRDMAWrites PFN_cuFlushGPUDirectRDMAWrites_v11030 +#define PFN_cuGetProcAddress PFN_cuGetProcAddress_v12000 +#define PFN_cuUserObjectCreate PFN_cuUserObjectCreate_v11030 +#define PFN_cuUserObjectRetain PFN_cuUserObjectRetain_v11030 +#define PFN_cuUserObjectRelease PFN_cuUserObjectRelease_v11030 +#define PFN_cuGraphRetainUserObject PFN_cuGraphRetainUserObject_v11030 +#define PFN_cuGraphReleaseUserObject PFN_cuGraphReleaseUserObject_v11030 +#define PFN_cuModuleGetLoadingMode PFN_cuModuleGetLoadingMode_v11070 +#define PFN_cuMemGetHandleForAddressRange PFN_cuMemGetHandleForAddressRange_v11070 +#define PFN_cuLibraryLoadData PFN_cuLibraryLoadData_v12000 +#define PFN_cuLibraryLoadFromFile PFN_cuLibraryLoadFromFile_v12000 +#define PFN_cuLibraryUnload PFN_cuLibraryUnload_v12000 +#define PFN_cuLibraryGetKernel PFN_cuLibraryGetKernel_v12000 +#define PFN_cuLibraryGetModule PFN_cuLibraryGetModule_v12000 +#define PFN_cuKernelGetFunction PFN_cuKernelGetFunction_v12000 +#define PFN_cuLibraryGetGlobal PFN_cuLibraryGetGlobal_v12000 +#define PFN_cuLibraryGetManaged PFN_cuLibraryGetManaged_v12000 +#define PFN_cuLibraryGetKernelCount PFN_cuLibraryGetKernelCount_v12040 +#define PFN_cuLibraryEnumerateKernels PFN_cuLibraryEnumerateKernels_v12040 +#define PFN_cuKernelGetAttribute PFN_cuKernelGetAttribute_v12000 +#define PFN_cuKernelSetAttribute PFN_cuKernelSetAttribute_v12000 +#define PFN_cuKernelSetCacheConfig PFN_cuKernelSetCacheConfig_v12000 +#define PFN_cuKernelGetName PFN_cuKernelGetName_v12030 +#define PFN_cuKernelGetParamInfo PFN_cuKernelGetParamInfo_v12040 +#define PFN_cuLibraryGetUnifiedFunction PFN_cuLibraryGetUnifiedFunction_v12000 +#define PFN_cuCoredumpGetAttribute PFN_cuCoredumpGetAttribute_v12010 +#define PFN_cuCoredumpGetAttributeGlobal PFN_cuCoredumpGetAttributeGlobal_v12010 +#define PFN_cuCoredumpSetAttribute PFN_cuCoredumpSetAttribute_v12010 +#define PFN_cuCoredumpSetAttributeGlobal PFN_cuCoredumpSetAttributeGlobal_v12010 +#define PFN_cuDeviceRegisterAsyncNotification PFN_cuDeviceRegisterAsyncNotification_v12040 +#define PFN_cuDeviceUnregisterAsyncNotification PFN_cuDeviceUnregisterAsyncNotification_v12040 +#define PFN_cuGreenCtxCreate PFN_cuGreenCtxCreate_v12040 +#define PFN_cuGreenCtxDestroy PFN_cuGreenCtxDestroy_v12040 +#define PFN_cuDeviceGetDevResource PFN_cuDeviceGetDevResource_v12040 +#define PFN_cuCtxGetDevResource PFN_cuCtxGetDevResource_v12040 +#define PFN_cuGreenCtxGetDevResource PFN_cuGreenCtxGetDevResource_v12040 +#define PFN_cuGreenCtxRecordEvent PFN_cuGreenCtxRecordEvent_v12040 +#define PFN_cuGreenCtxWaitEvent PFN_cuGreenCtxWaitEvent_v12040 +#define PFN_cuDevResourceGenerateDesc PFN_cuDevResourceGenerateDesc_v12040 +#define PFN_cuDevSmResourceSplitByCount PFN_cuDevSmResourceSplitByCount_v12040 +#define PFN_cuStreamGetGreenCtx PFN_cuStreamGetGreenCtx_v12040 +#define PFN_cuCtxFromGreenCtx PFN_cuCtxFromGreenCtx_v12040 + +/* + * Type definitions for functions defined in cuda.h + */ +typedef CUresult (CUDAAPI *PFN_cuGetErrorString_v6000)(CUresult error, const char **pStr); +typedef CUresult (CUDAAPI *PFN_cuGetErrorName_v6000)(CUresult error, const char **pStr); +typedef CUresult (CUDAAPI *PFN_cuInit_v2000)(unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuDriverGetVersion_v2020)(int *driverVersion); +typedef CUresult (CUDAAPI *PFN_cuDeviceGet_v2000)(CUdevice_v1 *device, int ordinal); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetCount_v2000)(int *count); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetName_v2000)(char *name, int len, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetUuid_v9020)(CUuuid *uuid, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetUuid_v11040)(CUuuid *uuid, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetLuid_v10000)(char *luid, unsigned int *deviceNodeMask, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceTotalMem_v3020)(size_t *bytes, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetTexture1DLinearMaxWidth_v11010)(size_t *maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetAttribute_v2000)(int *pi, CUdevice_attribute attrib, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetNvSciSyncAttributes_v10020)(void *nvSciSyncAttrList, CUdevice_v1 dev, int flags); +typedef CUresult (CUDAAPI *PFN_cuDeviceSetMemPool_v11020)(CUdevice_v1 dev, CUmemoryPool pool); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetMemPool_v11020)(CUmemoryPool *pool, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetDefaultMemPool_v11020)(CUmemoryPool *pool_out, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetProperties_v2000)(CUdevprop_v1 *prop, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceComputeCapability_v2000)(int *major, int *minor, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxRetain_v7000)(CUcontext *pctx, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxRelease_v11000)(CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxSetFlags_v11000)(CUdevice_v1 dev, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxGetState_v7000)(CUdevice_v1 dev, unsigned int *flags, int *active); +typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxReset_v11000)(CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetExecAffinitySupport_v11040)(int *pi, CUexecAffinityType type, CUdevice dev); +typedef CUresult (CUDAAPI *PFN_cuCtxCreate_v3020)(CUcontext *pctx, unsigned int flags, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuCtxCreate_v11040)(CUcontext *pctx, CUexecAffinityParam *paramsArray, int numParams, unsigned int flags, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuCtxGetId_v12000)(CUcontext ctx, unsigned long long *ctxId); +typedef CUresult (CUDAAPI *PFN_cuCtxDestroy_v4000)(CUcontext ctx); +typedef CUresult (CUDAAPI *PFN_cuCtxPushCurrent_v4000)(CUcontext ctx); +typedef CUresult (CUDAAPI *PFN_cuCtxPopCurrent_v4000)(CUcontext *pctx); +typedef CUresult (CUDAAPI *PFN_cuCtxSetCurrent_v4000)(CUcontext ctx); +typedef CUresult (CUDAAPI *PFN_cuCtxGetCurrent_v4000)(CUcontext *pctx); +typedef CUresult (CUDAAPI *PFN_cuCtxGetDevice_v2000)(CUdevice_v1 *device); +typedef CUresult (CUDAAPI *PFN_cuCtxGetFlags_v7000)(unsigned int *flags); +typedef CUresult (CUDAAPI *PFN_cuCtxSetFlags_v12010)(unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuCtxSynchronize_v2000)(void); +typedef CUresult (CUDAAPI *PFN_cuCtxSetLimit_v3010)(CUlimit limit, size_t value); +typedef CUresult (CUDAAPI *PFN_cuCtxGetLimit_v3010)(size_t *pvalue, CUlimit limit); +typedef CUresult (CUDAAPI *PFN_cuCtxGetCacheConfig_v3020)(CUfunc_cache *pconfig); +typedef CUresult (CUDAAPI *PFN_cuCtxSetCacheConfig_v3020)(CUfunc_cache config); +typedef CUresult (CUDAAPI *PFN_cuCtxGetSharedMemConfig_v4020)(CUsharedconfig *pConfig); +typedef CUresult (CUDAAPI *PFN_cuCtxSetSharedMemConfig_v4020)(CUsharedconfig config); +typedef CUresult (CUDAAPI *PFN_cuCtxGetApiVersion_v3020)(CUcontext ctx, unsigned int *version); +typedef CUresult (CUDAAPI *PFN_cuCtxGetStreamPriorityRange_v5050)(int *leastPriority, int *greatestPriority); +typedef CUresult (CUDAAPI *PFN_cuCtxResetPersistingL2Cache_v11000)(void); +typedef CUresult (CUDAAPI *PFN_cuCtxAttach_v2000)(CUcontext *pctx, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuCtxDetach_v2000)(CUcontext ctx); +typedef CUresult (CUDAAPI *PFN_cuCtxGetExecAffinity_v11040)(CUexecAffinityParam *pExecAffinity, CUexecAffinityType type); +typedef CUresult (CUDAAPI *PFN_cuModuleLoad_v2000)(CUmodule *module, const char *fname); +typedef CUresult (CUDAAPI *PFN_cuModuleLoadData_v2000)(CUmodule *module, const void *image); +typedef CUresult (CUDAAPI *PFN_cuModuleLoadDataEx_v2010)(CUmodule *module, const void *image, unsigned int numOptions, CUjit_option *options, void **optionValues); +typedef CUresult (CUDAAPI *PFN_cuModuleLoadFatBinary_v2000)(CUmodule *module, const void *fatCubin); +typedef CUresult (CUDAAPI *PFN_cuModuleUnload_v2000)(CUmodule hmod); +typedef CUresult (CUDAAPI *PFN_cuModuleGetFunction_v2000)(CUfunction *hfunc, CUmodule hmod, const char *name); +typedef CUresult (CUDAAPI *PFN_cuModuleGetGlobal_v3020)(CUdeviceptr_v2 *dptr, size_t *bytes, CUmodule hmod, const char *name); +typedef CUresult (CUDAAPI *PFN_cuModuleGetTexRef_v2000)(CUtexref *pTexRef, CUmodule hmod, const char *name); +typedef CUresult (CUDAAPI *PFN_cuModuleGetSurfRef_v3000)(CUsurfref *pSurfRef, CUmodule hmod, const char *name); +typedef CUresult (CUDAAPI *PFN_cuModuleGetFunctionCount)(unsigned int *count, CUmodule hmod); +typedef CUresult (CUDAAPI *PFN_cuModuleEnumerateFunctions)(CUfunction *functions, unsigned int numFunctions, CUmodule mod); +typedef CUresult (CUDAAPI *PFN_cuLinkCreate_v6050)(unsigned int numOptions, CUjit_option *options, void **optionValues, CUlinkState *stateOut); +typedef CUresult (CUDAAPI *PFN_cuLinkAddData_v6050)(CUlinkState state, CUjitInputType type, void *data, size_t size, const char *name, unsigned int numOptions, CUjit_option *options, void **optionValues); +typedef CUresult (CUDAAPI *PFN_cuLinkAddFile_v6050)(CUlinkState state, CUjitInputType type, const char *path, unsigned int numOptions, CUjit_option *options, void **optionValues); +typedef CUresult (CUDAAPI *PFN_cuLinkComplete_v5050)(CUlinkState state, void **cubinOut, size_t *sizeOut); +typedef CUresult (CUDAAPI *PFN_cuLinkDestroy_v5050)(CUlinkState state); +typedef CUresult (CUDAAPI *PFN_cuMemGetInfo_v3020)(size_t *free, size_t *total); +typedef CUresult (CUDAAPI *PFN_cuMemAlloc_v3020)(CUdeviceptr_v2 *dptr, size_t bytesize); +typedef CUresult (CUDAAPI *PFN_cuMemAllocPitch_v3020)(CUdeviceptr_v2 *dptr, size_t *pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes); +typedef CUresult (CUDAAPI *PFN_cuMemFree_v3020)(CUdeviceptr_v2 dptr); +typedef CUresult (CUDAAPI *PFN_cuMemGetAddressRange_v3020)(CUdeviceptr_v2 *pbase, size_t *psize, CUdeviceptr_v2 dptr); +typedef CUresult (CUDAAPI *PFN_cuMemAllocHost_v3020)(void **pp, size_t bytesize); +typedef CUresult (CUDAAPI *PFN_cuMemFreeHost_v2000)(void *p); +typedef CUresult (CUDAAPI *PFN_cuMemHostAlloc_v2020)(void **pp, size_t bytesize, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuMemHostGetDevicePointer_v3020)(CUdeviceptr_v2 *pdptr, void *p, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuMemHostGetFlags_v2030)(unsigned int *pFlags, void *p); +typedef CUresult (CUDAAPI *PFN_cuMemAllocManaged_v6000)(CUdeviceptr_v2 *dptr, size_t bytesize, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetByPCIBusId_v4010)(CUdevice_v1 *dev, const char *pciBusId); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetPCIBusId_v4010)(char *pciBusId, int len, CUdevice_v1 dev); +typedef CUresult (CUDAAPI *PFN_cuIpcGetEventHandle_v4010)(CUipcEventHandle_v1 *pHandle, CUevent event); +typedef CUresult (CUDAAPI *PFN_cuIpcOpenEventHandle_v4010)(CUevent *phEvent, CUipcEventHandle_v1 handle); +typedef CUresult (CUDAAPI *PFN_cuIpcGetMemHandle_v4010)(CUipcMemHandle_v1 *pHandle, CUdeviceptr_v2 dptr); +typedef CUresult (CUDAAPI *PFN_cuIpcOpenMemHandle_v11000)(CUdeviceptr_v2 *pdptr, CUipcMemHandle_v1 handle, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuIpcCloseMemHandle_v4010)(CUdeviceptr_v2 dptr); +typedef CUresult (CUDAAPI *PFN_cuMemHostRegister_v6050)(void *p, size_t bytesize, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuMemHostUnregister_v4000)(void *p); +typedef CUresult (CUDAAPI *PFN_cuMemcpy_v7000_ptds)(CUdeviceptr_v2 dst, CUdeviceptr_v2 src, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyPeer_v7000_ptds)(CUdeviceptr_v2 dstDevice, CUcontext dstContext, CUdeviceptr_v2 srcDevice, CUcontext srcContext, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoD_v7000_ptds)(CUdeviceptr_v2 dstDevice, const void *srcHost, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoH_v7000_ptds)(void *dstHost, CUdeviceptr_v2 srcDevice, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoD_v7000_ptds)(CUdeviceptr_v2 dstDevice, CUdeviceptr_v2 srcDevice, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoA_v7000_ptds)(CUarray dstArray, size_t dstOffset, CUdeviceptr_v2 srcDevice, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoD_v7000_ptds)(CUdeviceptr_v2 dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoA_v7000_ptds)(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoH_v7000_ptds)(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoA_v7000_ptds)(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpy2D_v7000_ptds)(const CUDA_MEMCPY2D_v2 *pCopy); +typedef CUresult (CUDAAPI *PFN_cuMemcpy2DUnaligned_v7000_ptds)(const CUDA_MEMCPY2D_v2 *pCopy); +typedef CUresult (CUDAAPI *PFN_cuMemcpy3D_v7000_ptds)(const CUDA_MEMCPY3D_v2 *pCopy); +typedef CUresult (CUDAAPI *PFN_cuMemcpy3DPeer_v7000_ptds)(const CUDA_MEMCPY3D_PEER_v1 *pCopy); +typedef CUresult (CUDAAPI *PFN_cuMemcpyAsync_v7000_ptsz)(CUdeviceptr_v2 dst, CUdeviceptr_v2 src, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpyPeerAsync_v7000_ptsz)(CUdeviceptr_v2 dstDevice, CUcontext dstContext, CUdeviceptr_v2 srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoDAsync_v7000_ptsz)(CUdeviceptr_v2 dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoHAsync_v7000_ptsz)(void *dstHost, CUdeviceptr_v2 srcDevice, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoDAsync_v7000_ptsz)(CUdeviceptr_v2 dstDevice, CUdeviceptr_v2 srcDevice, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoAAsync_v7000_ptsz)(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoHAsync_v7000_ptsz)(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpy2DAsync_v7000_ptsz)(const CUDA_MEMCPY2D_v2 *pCopy, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpy3DAsync_v7000_ptsz)(const CUDA_MEMCPY3D_v2 *pCopy, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpy3DPeerAsync_v7000_ptsz)(const CUDA_MEMCPY3D_PEER_v1 *pCopy, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD8_v7000_ptds)(CUdeviceptr_v2 dstDevice, unsigned char uc, size_t N); +typedef CUresult (CUDAAPI *PFN_cuMemsetD16_v7000_ptds)(CUdeviceptr_v2 dstDevice, unsigned short us, size_t N); +typedef CUresult (CUDAAPI *PFN_cuMemsetD32_v7000_ptds)(CUdeviceptr_v2 dstDevice, unsigned int ui, size_t N); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D8_v7000_ptds)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D16_v7000_ptds)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D32_v7000_ptds)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height); +typedef CUresult (CUDAAPI *PFN_cuMemsetD8Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, unsigned char uc, size_t N, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD16Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, unsigned short us, size_t N, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD32Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, unsigned int ui, size_t N, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D8Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D16Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D32Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuArrayCreate_v3020)(CUarray *pHandle, const CUDA_ARRAY_DESCRIPTOR_v2 *pAllocateArray); +typedef CUresult (CUDAAPI *PFN_cuArrayGetDescriptor_v3020)(CUDA_ARRAY_DESCRIPTOR_v2 *pArrayDescriptor, CUarray hArray); +typedef CUresult (CUDAAPI *PFN_cuArrayGetSparseProperties_v11010)(CUDA_ARRAY_SPARSE_PROPERTIES_v1 *sparseProperties, CUarray array); +typedef CUresult (CUDAAPI *PFN_cuMipmappedArrayGetSparseProperties_v11010)(CUDA_ARRAY_SPARSE_PROPERTIES_v1 *sparseProperties, CUmipmappedArray mipmap); +typedef CUresult (CUDAAPI *PFN_cuArrayGetMemoryRequirements_v11060)(CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 *memoryRequirements, CUarray array, CUdevice device); +typedef CUresult (CUDAAPI *PFN_cuMipmappedArrayGetMemoryRequirements_v11060)(CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 *memoryRequirements, CUmipmappedArray mipmap, CUdevice device); +typedef CUresult (CUDAAPI *PFN_cuArrayGetPlane_v11020)(CUarray *pPlaneArray, CUarray hArray, unsigned int planeIdx); +typedef CUresult (CUDAAPI *PFN_cuArrayDestroy_v2000)(CUarray hArray); +typedef CUresult (CUDAAPI *PFN_cuArray3DCreate_v3020)(CUarray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR_v2 *pAllocateArray); +typedef CUresult (CUDAAPI *PFN_cuArray3DGetDescriptor_v3020)(CUDA_ARRAY3D_DESCRIPTOR_v2 *pArrayDescriptor, CUarray hArray); +typedef CUresult (CUDAAPI *PFN_cuMipmappedArrayCreate_v5000)(CUmipmappedArray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR_v2 *pMipmappedArrayDesc, unsigned int numMipmapLevels); +typedef CUresult (CUDAAPI *PFN_cuMipmappedArrayGetLevel_v5000)(CUarray *pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level); +typedef CUresult (CUDAAPI *PFN_cuMipmappedArrayDestroy_v5000)(CUmipmappedArray hMipmappedArray); +typedef CUresult (CUDAAPI *PFN_cuMemAddressReserve_v10020)(CUdeviceptr_v2 *ptr, size_t size, size_t alignment, CUdeviceptr_v2 addr, unsigned long long flags); +typedef CUresult (CUDAAPI *PFN_cuMemAddressFree_v10020)(CUdeviceptr_v2 ptr, size_t size); +typedef CUresult (CUDAAPI *PFN_cuMemCreate_v10020)(CUmemGenericAllocationHandle_v1 *handle, size_t size, const CUmemAllocationProp_v1 *prop, unsigned long long flags); +typedef CUresult (CUDAAPI *PFN_cuMemRelease_v10020)(CUmemGenericAllocationHandle_v1 handle); +typedef CUresult (CUDAAPI *PFN_cuMemMap_v10020)(CUdeviceptr_v2 ptr, size_t size, size_t offset, CUmemGenericAllocationHandle_v1 handle, unsigned long long flags); +typedef CUresult (CUDAAPI *PFN_cuMemMapArrayAsync_v11010_ptsz)(CUarrayMapInfo_v1 *mapInfoList, unsigned int count, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemUnmap_v10020)(CUdeviceptr_v2 ptr, size_t size); +typedef CUresult (CUDAAPI *PFN_cuMemSetAccess_v10020)(CUdeviceptr_v2 ptr, size_t size, const CUmemAccessDesc_v1 *desc, size_t count); +typedef CUresult (CUDAAPI *PFN_cuMemGetAccess_v10020)(unsigned long long *flags, const CUmemLocation_v1 *location, CUdeviceptr_v2 ptr); +typedef CUresult (CUDAAPI *PFN_cuMemExportToShareableHandle_v10020)(void *shareableHandle, CUmemGenericAllocationHandle_v1 handle, CUmemAllocationHandleType handleType, unsigned long long flags); +typedef CUresult (CUDAAPI *PFN_cuMemImportFromShareableHandle_v10020)(CUmemGenericAllocationHandle_v1 *handle, void *osHandle, CUmemAllocationHandleType shHandleType); +typedef CUresult (CUDAAPI *PFN_cuMemGetAllocationGranularity_v10020)(size_t *granularity, const CUmemAllocationProp_v1 *prop, CUmemAllocationGranularity_flags option); +typedef CUresult (CUDAAPI *PFN_cuMemGetAllocationPropertiesFromHandle_v10020)(CUmemAllocationProp_v1 *prop, CUmemGenericAllocationHandle_v1 handle); +typedef CUresult (CUDAAPI *PFN_cuMemRetainAllocationHandle_v11000)(CUmemGenericAllocationHandle_v1 *handle, void *addr); +typedef CUresult (CUDAAPI *PFN_cuMemFreeAsync_v11020_ptsz)(CUdeviceptr_v2 dptr, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemAllocAsync_v11020_ptsz)(CUdeviceptr_v2 *dptr, size_t bytesize, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemPoolTrimTo_v11020)(CUmemoryPool pool, size_t minBytesToKeep); +typedef CUresult (CUDAAPI *PFN_cuMemPoolSetAttribute_v11020)(CUmemoryPool pool, CUmemPool_attribute attr, void *value); +typedef CUresult (CUDAAPI *PFN_cuMemPoolGetAttribute_v11020)(CUmemoryPool pool, CUmemPool_attribute attr, void *value); +typedef CUresult (CUDAAPI *PFN_cuMemPoolSetAccess_v11020)(CUmemoryPool pool, const CUmemAccessDesc_v1 *map, size_t count); +typedef CUresult (CUDAAPI *PFN_cuMemPoolGetAccess_v11020)(CUmemAccess_flags *flags, CUmemoryPool memPool, CUmemLocation_v1 *location); +typedef CUresult (CUDAAPI *PFN_cuMemPoolCreate_v11020)(CUmemoryPool *pool, const CUmemPoolProps_v1 *poolProps); +typedef CUresult (CUDAAPI *PFN_cuMemPoolDestroy_v11020)(CUmemoryPool pool); +typedef CUresult (CUDAAPI *PFN_cuMemAllocFromPoolAsync_v11020_ptsz)(CUdeviceptr_v2 *dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemPoolExportToShareableHandle_v11020)(void *handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags); +typedef CUresult (CUDAAPI *PFN_cuMemPoolImportFromShareableHandle_v11020)(CUmemoryPool *pool_out, void *handle, CUmemAllocationHandleType handleType, unsigned long long flags); +typedef CUresult (CUDAAPI *PFN_cuMemPoolExportPointer_v11020)(CUmemPoolPtrExportData_v1 *shareData_out, CUdeviceptr_v2 ptr); +typedef CUresult (CUDAAPI *PFN_cuMemPoolImportPointer_v11020)(CUdeviceptr_v2 *ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData_v1 *shareData); +typedef CUresult (CUDAAPI *PFN_cuPointerGetAttribute_v4000)(void *data, CUpointer_attribute attribute, CUdeviceptr_v2 ptr); +typedef CUresult (CUDAAPI *PFN_cuMemPrefetchAsync_v8000_ptsz)(CUdeviceptr_v2 devPtr, size_t count, CUdevice_v1 dstDevice, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemAdvise_v8000)(CUdeviceptr_v2 devPtr, size_t count, CUmem_advise advice, CUdevice_v1 device); +typedef CUresult (CUDAAPI *PFN_cuMemAdvise_v12020)(CUdeviceptr_v2 devPtr, size_t count, CUmem_advise advice, CUmemLocation_v1 location); +typedef CUresult (CUDAAPI *PFN_cuMemPrefetchAsync_v12020_ptsz)(CUdeviceptr_v2 devPtr, size_t count, CUmemLocation_v1 location, unsigned int flags, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemRangeGetAttribute_v8000)(void *data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr_v2 devPtr, size_t count); +typedef CUresult (CUDAAPI *PFN_cuMemRangeGetAttributes_v8000)(void **data, size_t *dataSizes, CUmem_range_attribute *attributes, size_t numAttributes, CUdeviceptr_v2 devPtr, size_t count); +typedef CUresult (CUDAAPI *PFN_cuMulticastCreate_v12010)(CUmemGenericAllocationHandle *mcHandle, const CUmulticastObjectProp *prop); +typedef CUresult (CUDAAPI *PFN_cuMulticastAddDevice_v12010)(CUmemGenericAllocationHandle mcHandle, CUdevice dev); +typedef CUresult (CUDAAPI *PFN_cuMulticastBindMem_v12010)(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags); +typedef CUresult (CUDAAPI *PFN_cuMulticastBindAddr_v12010)(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags); +typedef CUresult (CUDAAPI *PFN_cuMulticastUnbind_v12010)(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size); +typedef CUresult (CUDAAPI *PFN_cuMulticastGetGranularity_v12010)(size_t *granularity, const CUmulticastObjectProp *prop, CUmulticastGranularity_flags option); +typedef CUresult (CUDAAPI *PFN_cuPointerSetAttribute_v6000)(const void *value, CUpointer_attribute attribute, CUdeviceptr_v2 ptr); +typedef CUresult (CUDAAPI *PFN_cuPointerGetAttributes_v7000)(unsigned int numAttributes, CUpointer_attribute *attributes, void **data, CUdeviceptr_v2 ptr); +typedef CUresult (CUDAAPI *PFN_cuStreamCreate_v2000)(CUstream *phStream, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuStreamCreateWithPriority_v5050)(CUstream *phStream, unsigned int flags, int priority); +typedef CUresult (CUDAAPI *PFN_cuStreamGetId_v12000)(CUstream hStream, unsigned long long *streamId); +typedef CUresult (CUDAAPI *PFN_cuStreamGetId_v12000_ptsz)(CUstream hStream, unsigned long long *streamId); +typedef CUresult (CUDAAPI *PFN_cuStreamGetPriority_v7000_ptsz)(CUstream hStream, int *priority); +typedef CUresult (CUDAAPI *PFN_cuStreamGetFlags_v7000_ptsz)(CUstream hStream, unsigned int *flags); +typedef CUresult (CUDAAPI *PFN_cuStreamGetCtx_v9020_ptsz)(CUstream hStream, CUcontext *pctx); +typedef CUresult (CUDAAPI *PFN_cuStreamWaitEvent_v7000_ptsz)(CUstream hStream, CUevent hEvent, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuStreamAddCallback_v7000_ptsz)(CUstream hStream, CUstreamCallback callback, void *userData, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamBeginCapture_v10010_ptsz)(CUstream hStream, CUstreamCaptureMode mode); +typedef CUresult (CUDAAPI *PFN_cuStreamBeginCaptureToGraph_v12030_ptsz)(CUstream hStream, CUgraph hGraph, const CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, CUstreamCaptureMode mode); +typedef CUresult (CUDAAPI *PFN_cuThreadExchangeStreamCaptureMode_v10010)(CUstreamCaptureMode *mode); +typedef CUresult (CUDAAPI *PFN_cuStreamEndCapture_v10000_ptsz)(CUstream hStream, CUgraph *phGraph); +typedef CUresult (CUDAAPI *PFN_cuStreamIsCapturing_v10000_ptsz)(CUstream hStream, CUstreamCaptureStatus *captureStatus); +typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v10010_ptsz)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out); +typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v11030_ptsz)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, size_t *numDependencies_out); +typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v12030_ptsz)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, const CUgraphEdgeData **edgeData_out, size_t *numDependencies_out); +typedef CUresult (CUDAAPI *PFN_cuStreamUpdateCaptureDependencies_v11030_ptsz)(CUstream hStream, CUgraphNode *dependencies, size_t numDependencies, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamUpdateCaptureDependencies_v12030_ptsz)(CUstream hStream, CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamAttachMemAsync_v7000_ptsz)(CUstream hStream, CUdeviceptr_v2 dptr, size_t length, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamQuery_v7000_ptsz)(CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuStreamSynchronize_v7000_ptsz)(CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuStreamDestroy_v4000)(CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuStreamCopyAttributes_v11000_ptsz)(CUstream dst, CUstream src); +typedef CUresult (CUDAAPI *PFN_cuStreamGetAttribute_v11000_ptsz)(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue_v1 *value_out); +typedef CUresult (CUDAAPI *PFN_cuStreamSetAttribute_v11000_ptsz)(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue_v1 *value); +typedef CUresult (CUDAAPI *PFN_cuEventCreate_v2000)(CUevent *phEvent, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuEventRecord_v7000_ptsz)(CUevent hEvent, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuEventRecordWithFlags_v11010_ptsz)(CUevent hEvent, CUstream hStream, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuEventQuery_v2000)(CUevent hEvent); +typedef CUresult (CUDAAPI *PFN_cuEventSynchronize_v2000)(CUevent hEvent); +typedef CUresult (CUDAAPI *PFN_cuEventDestroy_v4000)(CUevent hEvent); +typedef CUresult (CUDAAPI *PFN_cuEventElapsedTime_v2000)(float *pMilliseconds, CUevent hStart, CUevent hEnd); +typedef CUresult (CUDAAPI *PFN_cuImportExternalMemory_v10000)(CUexternalMemory *extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1 *memHandleDesc); +typedef CUresult (CUDAAPI *PFN_cuExternalMemoryGetMappedBuffer_v10000)(CUdeviceptr_v2 *devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1 *bufferDesc); +typedef CUresult (CUDAAPI *PFN_cuExternalMemoryGetMappedMipmappedArray_v10000)(CUmipmappedArray *mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 *mipmapDesc); +typedef CUresult (CUDAAPI *PFN_cuDestroyExternalMemory_v10000)(CUexternalMemory extMem); +typedef CUresult (CUDAAPI *PFN_cuImportExternalSemaphore_v10000)(CUexternalSemaphore *extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1 *semHandleDesc); +typedef CUresult (CUDAAPI *PFN_cuSignalExternalSemaphoresAsync_v10000_ptsz)(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 *paramsArray, unsigned int numExtSems, CUstream stream); +typedef CUresult (CUDAAPI *PFN_cuWaitExternalSemaphoresAsync_v10000_ptsz)(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 *paramsArray, unsigned int numExtSems, CUstream stream); +typedef CUresult (CUDAAPI *PFN_cuDestroyExternalSemaphore_v10000)(CUexternalSemaphore extSem); +typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue32_v8000_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue64_v9000_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue32_v8000_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue64_v9000_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamBatchMemOp_v8000_ptsz)(CUstream stream, unsigned int count, CUstreamBatchMemOpParams_v1 *paramArray, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue32_v11070_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue64_v11070_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue32_v11070_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue64_v11070_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamBatchMemOp_v11070_ptsz)(CUstream stream, unsigned int count, CUstreamBatchMemOpParams *paramArray, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuFuncGetAttribute_v2020)(int *pi, CUfunction_attribute attrib, CUfunction hfunc); +typedef CUresult (CUDAAPI *PFN_cuFuncSetAttribute_v9000)(CUfunction hfunc, CUfunction_attribute attrib, int value); +typedef CUresult (CUDAAPI *PFN_cuFuncSetCacheConfig_v3000)(CUfunction hfunc, CUfunc_cache config); +typedef CUresult (CUDAAPI *PFN_cuFuncSetSharedMemConfig_v4020)(CUfunction hfunc, CUsharedconfig config); +typedef CUresult (CUDAAPI *PFN_cuFuncGetName_v12030)(const char **name, CUfunction hfunc); +typedef CUresult (CUDAAPI *PFN_cuFuncGetParamInfo_v12040)(CUfunction func, size_t paramIndex, size_t *paramOffset, size_t *paramSize); +typedef CUresult (CUDAAPI *PFN_cuFuncIsLoaded_v12040)(CUfunctionLoadingState *state, CUfunction hfunc); +typedef CUresult (CUDAAPI *PFN_cuFuncLoad_v12040)(CUfunction hfunc); +typedef CUresult (CUDAAPI *PFN_cuLaunchKernel_v7000_ptsz)(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams, void **extra); +typedef CUresult (CUDAAPI *PFN_cuLaunchKernelEx_v11060_ptsz)(const CUlaunchConfig *config, CUfunction f, void **kernelParams, void **extra); +typedef CUresult (CUDAAPI *PFN_cuLaunchCooperativeKernel_v9000_ptsz)(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams); +typedef CUresult (CUDAAPI *PFN_cuLaunchCooperativeKernelMultiDevice_v9000)(CUDA_LAUNCH_PARAMS_v1 *launchParamsList, unsigned int numDevices, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuLaunchHostFunc_v10000_ptsz)(CUstream hStream, CUhostFn fn, void *userData); +typedef CUresult (CUDAAPI *PFN_cuFuncSetBlockShape_v2000)(CUfunction hfunc, int x, int y, int z); +typedef CUresult (CUDAAPI *PFN_cuFuncSetSharedSize_v2000)(CUfunction hfunc, unsigned int bytes); +typedef CUresult (CUDAAPI *PFN_cuParamSetSize_v2000)(CUfunction hfunc, unsigned int numbytes); +typedef CUresult (CUDAAPI *PFN_cuParamSeti_v2000)(CUfunction hfunc, int offset, unsigned int value); +typedef CUresult (CUDAAPI *PFN_cuParamSetf_v2000)(CUfunction hfunc, int offset, float value); +typedef CUresult (CUDAAPI *PFN_cuParamSetv_v2000)(CUfunction hfunc, int offset, void *ptr, unsigned int numbytes); +typedef CUresult (CUDAAPI *PFN_cuLaunch_v2000)(CUfunction f); +typedef CUresult (CUDAAPI *PFN_cuLaunchGrid_v2000)(CUfunction f, int grid_width, int grid_height); +typedef CUresult (CUDAAPI *PFN_cuLaunchGridAsync_v2000)(CUfunction f, int grid_width, int grid_height, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuParamSetTexRef_v2000)(CUfunction hfunc, int texunit, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuGraphCreate_v10000)(CUgraph *phGraph, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuGraphAddKernelNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeGetParams_v10000)(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeSetParams_v10000)(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphAddKernelNode_v12000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS_v2 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeGetParams_v12000)(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS_v2 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeSetParams_v12000)(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS_v2 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphAddMemcpyNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_MEMCPY3D_v2 *copyParams, CUcontext ctx); +typedef CUresult (CUDAAPI *PFN_cuGraphMemcpyNodeGetParams_v10000)(CUgraphNode hNode, CUDA_MEMCPY3D_v2 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphMemcpyNodeSetParams_v10000)(CUgraphNode hNode, const CUDA_MEMCPY3D_v2 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphAddMemsetNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS_v1 *memsetParams, CUcontext ctx); +typedef CUresult (CUDAAPI *PFN_cuGraphMemsetNodeGetParams_v10000)(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphMemsetNodeSetParams_v10000)(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphAddHostNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphHostNodeGetParams_v10000)(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphHostNodeSetParams_v10000)(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphAddChildGraphNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUgraph childGraph); +typedef CUresult (CUDAAPI *PFN_cuGraphChildGraphNodeGetGraph_v10000)(CUgraphNode hNode, CUgraph *phGraph); +typedef CUresult (CUDAAPI *PFN_cuGraphAddEmptyNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies); +typedef CUresult (CUDAAPI *PFN_cuGraphAddEventRecordNode_v11010)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUevent event); +typedef CUresult (CUDAAPI *PFN_cuGraphEventRecordNodeGetEvent_v11010)(CUgraphNode hNode, CUevent *event_out); +typedef CUresult (CUDAAPI *PFN_cuGraphEventRecordNodeSetEvent_v11010)(CUgraphNode hNode, CUevent event); +typedef CUresult (CUDAAPI *PFN_cuGraphAddEventWaitNode_v11010)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUevent event); +typedef CUresult (CUDAAPI *PFN_cuGraphEventWaitNodeGetEvent_v11010)(CUgraphNode hNode, CUevent *event_out); +typedef CUresult (CUDAAPI *PFN_cuGraphEventWaitNodeSetEvent_v11010)(CUgraphNode hNode, CUevent event); +typedef CUresult (CUDAAPI *PFN_cuGraphAddExternalSemaphoresSignalNode_v11020)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphExternalSemaphoresSignalNodeGetParams_v11020)(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 *params_out); +typedef CUresult (CUDAAPI *PFN_cuGraphExternalSemaphoresSignalNodeSetParams_v11020)(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphAddExternalSemaphoresWaitNode_v11020)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphExternalSemaphoresWaitNodeGetParams_v11020)(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 *params_out); +typedef CUresult (CUDAAPI *PFN_cuGraphExternalSemaphoresWaitNodeSetParams_v11020)(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphAddBatchMemOpNode_v11070)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphBatchMemOpNodeGetParams_v11070)(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams_out); +typedef CUresult (CUDAAPI *PFN_cuGraphBatchMemOpNodeSetParams_v11070)(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphExecBatchMemOpNodeSetParams_v11070)(CUgraphExec graphExec, CUgraphNode node, const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphClone_v10000)(CUgraph *phGraphClone, CUgraph originalGraph); +typedef CUresult (CUDAAPI *PFN_cuGraphNodeFindInClone_v10000)(CUgraphNode *phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph); +typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetType_v10000)(CUgraphNode hNode, CUgraphNodeType *type); +typedef CUresult (CUDAAPI *PFN_cuGraphGetNodes_v10000)(CUgraph hGraph, CUgraphNode *nodes, size_t *numNodes); +typedef CUresult (CUDAAPI *PFN_cuGraphGetRootNodes_v10000)(CUgraph hGraph, CUgraphNode *rootNodes, size_t *numRootNodes); +typedef CUresult (CUDAAPI *PFN_cuGraphGetEdges_v10000)(CUgraph hGraph, CUgraphNode *from, CUgraphNode *to, size_t *numEdges); +typedef CUresult (CUDAAPI *PFN_cuGraphGetEdges_v12030)(CUgraph hGraph, CUgraphNode *from, CUgraphNode *to, CUgraphEdgeData *edgeData, size_t *numEdges); +typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetDependencies_v10000)(CUgraphNode hNode, CUgraphNode *dependencies, size_t *numDependencies); +typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetDependencies_v12030)(CUgraphNode hNode, CUgraphNode *dependencies, CUgraphEdgeData *edgeData, size_t *numDependencies); +typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetDependentNodes_v10000)(CUgraphNode hNode, CUgraphNode *dependentNodes, size_t *numDependentNodes); +typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetDependentNodes_v12030)(CUgraphNode hNode, CUgraphNode *dependentNodes, CUgraphEdgeData *edgeData, size_t *numDependentNodes); +typedef CUresult (CUDAAPI *PFN_cuGraphAddDependencies_v10000)(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, size_t numDependencies); +typedef CUresult (CUDAAPI *PFN_cuGraphAddDependencies_v12030)(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, const CUgraphEdgeData *edgeData, size_t numDependencies); +typedef CUresult (CUDAAPI *PFN_cuGraphRemoveDependencies_v10000)(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, size_t numDependencies); +typedef CUresult (CUDAAPI *PFN_cuGraphRemoveDependencies_v12030)(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, const CUgraphEdgeData *edgeData, size_t numDependencies); +typedef CUresult (CUDAAPI *PFN_cuGraphDestroyNode_v10000)(CUgraphNode hNode); +typedef CUresult (CUDAAPI *PFN_cuGraphInstantiateWithFlags_v11040)(CUgraphExec *phGraphExec, CUgraph hGraph, unsigned long long flags); +typedef CUresult (CUDAAPI *PFN_cuGraphInstantiateWithParams_v12000_ptsz)(CUgraphExec *phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS *instantiateParams); +typedef CUresult (CUDAAPI *PFN_cuGraphExecGetFlags_v12000)(CUgraphExec hGraphExec, cuuint64_t *flags); +typedef CUresult (CUDAAPI *PFN_cuGraphExecKernelNodeSetParams_v10010)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphExecKernelNodeSetParams_v12000)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS_v2 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphExecMemcpyNodeSetParams_v10020)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D_v2 *copyParams, CUcontext ctx); +typedef CUresult (CUDAAPI *PFN_cuGraphExecMemsetNodeSetParams_v10020)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS_v1 *memsetParams, CUcontext ctx); +typedef CUresult (CUDAAPI *PFN_cuGraphExecHostNodeSetParams_v10020)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphExecChildGraphNodeSetParams_v11010)(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph); +typedef CUresult (CUDAAPI *PFN_cuGraphExecEventRecordNodeSetEvent_v11010)(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event); +typedef CUresult (CUDAAPI *PFN_cuGraphExecEventWaitNodeSetEvent_v11010)(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event); +typedef CUresult (CUDAAPI *PFN_cuGraphExecExternalSemaphoresSignalNodeSetParams_v11020)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphExecExternalSemaphoresWaitNodeSetParams_v11020)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphUpload_v11010_ptsz)(CUgraphExec hGraphExec, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuGraphLaunch_v10000_ptsz)(CUgraphExec hGraphExec, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuGraphExecDestroy_v10000)(CUgraphExec hGraphExec); +typedef CUresult (CUDAAPI *PFN_cuGraphDestroy_v10000)(CUgraph hGraph); +typedef CUresult (CUDAAPI *PFN_cuGraphExecUpdate_v10020)(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphNode *hErrorNode_out, CUgraphExecUpdateResult *updateResult_out); +typedef CUresult (CUDAAPI *PFN_cuGraphExecUpdate_v12000)(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo *resultInfo); +typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeCopyAttributes_v11000)(CUgraphNode dst, CUgraphNode src); +typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeGetAttribute_v11000)(CUgraphNode hNode, CUkernelNodeAttrID attr, CUkernelNodeAttrValue_v1 *value_out); +typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeSetAttribute_v11000)(CUgraphNode hNode, CUkernelNodeAttrID attr, const CUkernelNodeAttrValue_v1 *value); +typedef CUresult (CUDAAPI *PFN_cuGraphDebugDotPrint_v11030)(CUgraph hGraph, const char *path, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuGraphAddMemAllocNode_v11040)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphMemAllocNodeGetParams_v11040)(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS *params_out); +typedef CUresult (CUDAAPI *PFN_cuGraphAddMemFreeNode_v11040)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUdeviceptr dptr); +typedef CUresult (CUDAAPI *PFN_cuGraphMemFreeNodeGetParams_v11040)(CUgraphNode hNode, CUdeviceptr *dptr_out); +typedef CUresult (CUDAAPI *PFN_cuGraphNodeSetEnabled_v11060)(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled); +typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetEnabled_v11060)(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int *isEnabled); +typedef CUresult (CUDAAPI *PFN_cuGraphAddNode_v12020)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUgraphNodeParams *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphAddNode_v12030)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, CUgraphNodeParams *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphNodeSetParams_v12020)(CUgraphNode hNode, CUgraphNodeParams *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphExecNodeSetParams_v12020)(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams *nodeParams); +typedef CUresult (CUDAAPI *PFN_cuGraphConditionalHandleCreate_v12030)(CUgraphConditionalHandle *pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuDeviceGraphMemTrim_v11040)(CUdevice device); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetGraphMemAttribute_v11040)(CUdevice device, CUgraphMem_attribute attr, void* value); +typedef CUresult (CUDAAPI *PFN_cuDeviceSetGraphMemAttribute_v11040)(CUdevice device, CUgraphMem_attribute attr, void* value); +typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxActiveBlocksPerMultiprocessor_v6050)(int *numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize); +typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags_v7000)(int *numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxPotentialBlockSize_v6050)(int *minGridSize, int *blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit); +typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxPotentialBlockSizeWithFlags_v7000)(int *minGridSize, int *blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuOccupancyAvailableDynamicSMemPerBlock_v10020)(size_t *dynamicSmemSize, CUfunction func, int numBlocks, int blockSize); +typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxPotentialClusterSize_v11070)(int *clusterSize, CUfunction func, const CUlaunchConfig *config); +typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxActiveClusters_v11070)(int *numClusters, CUfunction func, const CUlaunchConfig *config); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetArray_v2000)(CUtexref hTexRef, CUarray hArray, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetMipmappedArray_v5000)(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddress_v3020)(size_t *ByteOffset, CUtexref hTexRef, CUdeviceptr_v2 dptr, size_t bytes); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddress2D_v4010)(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR_v2 *desc, CUdeviceptr_v2 dptr, size_t Pitch); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetFormat_v2000)(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddressMode_v2000)(CUtexref hTexRef, int dim, CUaddress_mode am); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetFilterMode_v2000)(CUtexref hTexRef, CUfilter_mode fm); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetMipmapFilterMode_v5000)(CUtexref hTexRef, CUfilter_mode fm); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetMipmapLevelBias_v5000)(CUtexref hTexRef, float bias); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetMipmapLevelClamp_v5000)(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetMaxAnisotropy_v5000)(CUtexref hTexRef, unsigned int maxAniso); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetBorderColor_v8000)(CUtexref hTexRef, float *pBorderColor); +typedef CUresult (CUDAAPI *PFN_cuTexRefSetFlags_v2000)(CUtexref hTexRef, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetAddress_v3020)(CUdeviceptr_v2 *pdptr, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetArray_v2000)(CUarray *phArray, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetMipmappedArray_v5000)(CUmipmappedArray *phMipmappedArray, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetAddressMode_v2000)(CUaddress_mode *pam, CUtexref hTexRef, int dim); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetFilterMode_v2000)(CUfilter_mode *pfm, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetFormat_v2000)(CUarray_format *pFormat, int *pNumChannels, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetMipmapFilterMode_v5000)(CUfilter_mode *pfm, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetMipmapLevelBias_v5000)(float *pbias, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetMipmapLevelClamp_v5000)(float *pminMipmapLevelClamp, float *pmaxMipmapLevelClamp, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetMaxAnisotropy_v5000)(int *pmaxAniso, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetBorderColor_v8000)(float *pBorderColor, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefGetFlags_v2000)(unsigned int *pFlags, CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefCreate_v2000)(CUtexref *pTexRef); +typedef CUresult (CUDAAPI *PFN_cuTexRefDestroy_v2000)(CUtexref hTexRef); +typedef CUresult (CUDAAPI *PFN_cuSurfRefSetArray_v3000)(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuSurfRefGetArray_v3000)(CUarray *phArray, CUsurfref hSurfRef); +typedef CUresult (CUDAAPI *PFN_cuTexObjectCreate_v5000)(CUtexObject_v1 *pTexObject, const CUDA_RESOURCE_DESC_v1 *pResDesc, const CUDA_TEXTURE_DESC_v1 *pTexDesc, const CUDA_RESOURCE_VIEW_DESC_v1 *pResViewDesc); +typedef CUresult (CUDAAPI *PFN_cuTexObjectDestroy_v5000)(CUtexObject_v1 texObject); +typedef CUresult (CUDAAPI *PFN_cuTexObjectGetResourceDesc_v5000)(CUDA_RESOURCE_DESC_v1 *pResDesc, CUtexObject_v1 texObject); +typedef CUresult (CUDAAPI *PFN_cuTexObjectGetTextureDesc_v5000)(CUDA_TEXTURE_DESC_v1 *pTexDesc, CUtexObject_v1 texObject); +typedef CUresult (CUDAAPI *PFN_cuTexObjectGetResourceViewDesc_v5000)(CUDA_RESOURCE_VIEW_DESC_v1 *pResViewDesc, CUtexObject_v1 texObject); +typedef CUresult (CUDAAPI *PFN_cuSurfObjectCreate_v5000)(CUsurfObject_v1 *pSurfObject, const CUDA_RESOURCE_DESC_v1 *pResDesc); +typedef CUresult (CUDAAPI *PFN_cuSurfObjectDestroy_v5000)(CUsurfObject_v1 surfObject); +typedef CUresult (CUDAAPI *PFN_cuSurfObjectGetResourceDesc_v5000)(CUDA_RESOURCE_DESC_v1 *pResDesc, CUsurfObject_v1 surfObject); +typedef CUresult (CUDAAPI *PFN_cuTensorMapEncodeTiled_v12000)(CUtensorMap *tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void *globalAddress, const cuuint64_t *globalDim, const cuuint64_t *globalStrides, const cuuint32_t *boxDim, const cuuint32_t *elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill); +typedef CUresult (CUDAAPI *PFN_cuTensorMapEncodeIm2col_v12000)(CUtensorMap *tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void *globalAddress, const cuuint64_t *globalDim, const cuuint64_t *globalStrides, const int *pixelBoxLowerCorner, const int *pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t *elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill); +typedef CUresult (CUDAAPI *PFN_cuTensorMapReplaceAddress_v12000)(CUtensorMap *tensorMap, void *globalAddress); +typedef CUresult (CUDAAPI *PFN_cuDeviceCanAccessPeer_v4000)(int *canAccessPeer, CUdevice_v1 dev, CUdevice_v1 peerDev); +typedef CUresult (CUDAAPI *PFN_cuCtxEnablePeerAccess_v4000)(CUcontext peerContext, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuCtxDisablePeerAccess_v4000)(CUcontext peerContext); +typedef CUresult (CUDAAPI *PFN_cuDeviceGetP2PAttribute_v8000)(int *value, CUdevice_P2PAttribute attrib, CUdevice_v1 srcDevice, CUdevice_v1 dstDevice); +typedef CUresult (CUDAAPI *PFN_cuGraphicsUnregisterResource_v3000)(CUgraphicsResource resource); +typedef CUresult (CUDAAPI *PFN_cuGraphicsSubResourceGetMappedArray_v3000)(CUarray *pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel); +typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceGetMappedMipmappedArray_v5000)(CUmipmappedArray *pMipmappedArray, CUgraphicsResource resource); +typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceGetMappedPointer_v3020)(CUdeviceptr_v2 *pDevPtr, size_t *pSize, CUgraphicsResource resource); +typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceSetMapFlags_v6050)(CUgraphicsResource resource, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuGraphicsMapResources_v7000_ptsz)(unsigned int count, CUgraphicsResource *resources, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuGraphicsUnmapResources_v7000_ptsz)(unsigned int count, CUgraphicsResource *resources, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuGetExportTable_v3000)(const void **ppExportTable, const CUuuid *pExportTableId); +typedef CUresult (CUDAAPI *PFN_cuFuncGetModule_v11000)(CUmodule *hmod, CUfunction hfunc); +typedef CUresult (CUDAAPI *PFN_cuGetProcAddress_v11030)(const char *symbol, void **pfn, int driverVersion, cuuint64_t flags); +typedef CUresult (CUDAAPI *PFN_cuGetProcAddress_v12000)(const char *symbol, void **pfn, int driverVersion, cuuint64_t flags, CUdriverProcAddressQueryResult *symbolFound); +typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoD_v3020)(CUdeviceptr_v2 dstDevice, const void *srcHost, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoH_v3020)(void *dstHost, CUdeviceptr_v2 srcDevice, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoD_v3020)(CUdeviceptr_v2 dstDevice, CUdeviceptr_v2 srcDevice, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoA_v3020)(CUarray dstArray, size_t dstOffset, CUdeviceptr_v2 srcDevice, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoD_v3020)(CUdeviceptr_v2 dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoA_v3020)(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoH_v3020)(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoA_v3020)(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoAAsync_v3020)(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoHAsync_v3020)(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpy2D_v3020)(const CUDA_MEMCPY2D_v2 *pCopy); +typedef CUresult (CUDAAPI *PFN_cuMemcpy2DUnaligned_v3020)(const CUDA_MEMCPY2D_v2 *pCopy); +typedef CUresult (CUDAAPI *PFN_cuMemcpy3D_v3020)(const CUDA_MEMCPY3D_v2 *pCopy); +typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoDAsync_v3020)(CUdeviceptr_v2 dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoHAsync_v3020)(void *dstHost, CUdeviceptr_v2 srcDevice, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoDAsync_v3020)(CUdeviceptr_v2 dstDevice, CUdeviceptr_v2 srcDevice, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpy2DAsync_v3020)(const CUDA_MEMCPY2D_v2 *pCopy, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpy3DAsync_v3020)(const CUDA_MEMCPY3D_v2 *pCopy, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD8_v3020)(CUdeviceptr_v2 dstDevice, unsigned char uc, size_t N); +typedef CUresult (CUDAAPI *PFN_cuMemsetD16_v3020)(CUdeviceptr_v2 dstDevice, unsigned short us, size_t N); +typedef CUresult (CUDAAPI *PFN_cuMemsetD32_v3020)(CUdeviceptr_v2 dstDevice, unsigned int ui, size_t N); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D8_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D16_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D32_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height); +typedef CUresult (CUDAAPI *PFN_cuMemcpy_v4000)(CUdeviceptr_v2 dst, CUdeviceptr_v2 src, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyAsync_v4000)(CUdeviceptr_v2 dst, CUdeviceptr_v2 src, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpyPeer_v4000)(CUdeviceptr_v2 dstDevice, CUcontext dstContext, CUdeviceptr_v2 srcDevice, CUcontext srcContext, size_t ByteCount); +typedef CUresult (CUDAAPI *PFN_cuMemcpyPeerAsync_v4000)(CUdeviceptr_v2 dstDevice, CUcontext dstContext, CUdeviceptr_v2 srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemcpy3DPeer_v4000)(const CUDA_MEMCPY3D_PEER_v1 *pCopy); +typedef CUresult (CUDAAPI *PFN_cuMemcpy3DPeerAsync_v4000)(const CUDA_MEMCPY3D_PEER_v1 *pCopy, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD8Async_v3020)(CUdeviceptr_v2 dstDevice, unsigned char uc, size_t N, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD16Async_v3020)(CUdeviceptr_v2 dstDevice, unsigned short us, size_t N, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD32Async_v3020)(CUdeviceptr_v2 dstDevice, unsigned int ui, size_t N, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D8Async_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D16Async_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemsetD2D32Async_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuStreamGetPriority_v5050)(CUstream hStream, int *priority); +typedef CUresult (CUDAAPI *PFN_cuStreamGetFlags_v5050)(CUstream hStream, unsigned int *flags); +typedef CUresult (CUDAAPI *PFN_cuStreamGetCtx_v9020)(CUstream hStream, CUcontext *pctx); +typedef CUresult (CUDAAPI *PFN_cuStreamWaitEvent_v3020)(CUstream hStream, CUevent hEvent, unsigned int Flags); +typedef CUresult (CUDAAPI *PFN_cuStreamAddCallback_v5000)(CUstream hStream, CUstreamCallback callback, void *userData, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamAttachMemAsync_v6000)(CUstream hStream, CUdeviceptr_v2 dptr, size_t length, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamQuery_v2000)(CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuStreamSynchronize_v2000)(CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuEventRecord_v2000)(CUevent hEvent, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuEventRecordWithFlags_v11010)(CUevent hEvent, CUstream hStream, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuLaunchKernel_v4000)(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams, void **extra); +typedef CUresult (CUDAAPI *PFN_cuLaunchKernelEx_v11060)(const CUlaunchConfig *config, CUfunction f, void **kernelParams, void **extra); +typedef CUresult (CUDAAPI *PFN_cuLaunchHostFunc_v10000)(CUstream hStream, CUhostFn fn, void *userData); +typedef CUresult (CUDAAPI *PFN_cuGraphicsMapResources_v3000)(unsigned int count, CUgraphicsResource *resources, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuGraphicsUnmapResources_v3000)(unsigned int count, CUgraphicsResource *resources, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue32_v8000)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue32_v8000)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue64_v9000)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue64_v9000)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamBatchMemOp_v8000)(CUstream stream, unsigned int count, CUstreamBatchMemOpParams *paramArray, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue32_v11070)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue32_v11070)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue64_v11070)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue64_v11070)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamBatchMemOp_v11070)(CUstream stream, unsigned int count, CUstreamBatchMemOpParams *paramArray, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuMemPrefetchAsync_v8000)(CUdeviceptr_v2 devPtr, size_t count, CUdevice_v1 dstDevice, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemPrefetchAsync_v12020)(CUdeviceptr_v2 devPtr, size_t count, CUmemLocation_v1 location, unsigned int flags, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuLaunchCooperativeKernel_v9000)(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams); +typedef CUresult (CUDAAPI *PFN_cuSignalExternalSemaphoresAsync_v10000)(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 *paramsArray, unsigned int numExtSems, CUstream stream); +typedef CUresult (CUDAAPI *PFN_cuWaitExternalSemaphoresAsync_v10000)(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 *paramsArray, unsigned int numExtSems, CUstream stream); +typedef CUresult (CUDAAPI *PFN_cuStreamBeginCapture_v10010)(CUstream hStream, CUstreamCaptureMode mode); +typedef CUresult (CUDAAPI *PFN_cuStreamBeginCaptureToGraph_v12030)(CUstream hStream, CUgraph hGraph, const CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, CUstreamCaptureMode mode); +typedef CUresult (CUDAAPI *PFN_cuStreamEndCapture_v10000)(CUstream hStream, CUgraph *phGraph); +typedef CUresult (CUDAAPI *PFN_cuStreamIsCapturing_v10000)(CUstream hStream, CUstreamCaptureStatus *captureStatus); +typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v10010)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out); +typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v11030)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, size_t *numDependencies_out); +typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v12030)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, const CUgraphEdgeData **edgeData_out, size_t *numDependencies_out); +typedef CUresult (CUDAAPI *PFN_cuStreamUpdateCaptureDependencies_v11030)(CUstream hStream, CUgraphNode *dependencies, size_t numDependencies, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuStreamUpdateCaptureDependencies_v12030)(CUstream hStream, CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuGraphInstantiateWithParams_v12000)(CUgraphExec *phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS *instantiateParams); +typedef CUresult (CUDAAPI *PFN_cuGraphUpload_v11010)(CUgraphExec hGraph, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuGraphLaunch_v10000)(CUgraphExec hGraph, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuStreamCopyAttributes_v11000)(CUstream dstStream, CUstream srcStream); +typedef CUresult (CUDAAPI *PFN_cuStreamGetAttribute_v11000)(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue_v1 *value); +typedef CUresult (CUDAAPI *PFN_cuStreamSetAttribute_v11000)(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue_v1 *param); +typedef CUresult (CUDAAPI *PFN_cuMemMapArrayAsync_v11010)(CUarrayMapInfo_v1 *mapInfoList, unsigned int count, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemFreeAsync_v11020)(CUdeviceptr_v2 dptr, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemAllocAsync_v11020)(CUdeviceptr_v2 *dptr, size_t bytesize, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuMemAllocFromPoolAsync_v11020)(CUdeviceptr_v2 *dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream); +typedef CUresult (CUDAAPI *PFN_cuFlushGPUDirectRDMAWrites_v11030)(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope); +typedef CUresult (CUDAAPI *PFN_cuUserObjectCreate_v11030)(CUuserObject *object_out, void *ptr, CUhostFn destroy, unsigned int initialRefcount, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuUserObjectRetain_v11030)(CUuserObject object, unsigned int count); +typedef CUresult (CUDAAPI *PFN_cuUserObjectRelease_v11030)(CUuserObject object, unsigned int count); +typedef CUresult (CUDAAPI *PFN_cuGraphRetainUserObject_v11030)(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags); +typedef CUresult (CUDAAPI *PFN_cuGraphReleaseUserObject_v11030)(CUgraph graph, CUuserObject object, unsigned int count); +typedef CUresult (CUDAAPI *PFN_cuModuleGetLoadingMode_v11070)(CUmoduleLoadingMode *mode); +typedef CUresult (CUDAAPI *PFN_cuMemGetHandleForAddressRange_v11070)(void *handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags); +typedef CUresult (CUDAAPI *PFN_cuLibraryLoadData_v12000)(CUlibrary *library, const void *code, CUjit_option *jitOptions, void **jitOptionsValues, unsigned int numJitOptions, CUlibraryOption *libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions); +typedef CUresult (CUDAAPI *PFN_cuLibraryLoadFromFile_v12000)(CUlibrary *library, const char *fileName, CUjit_option *jitOptions, void **jitOptionsValues, unsigned int numJitOptions, CUlibraryOption *libraryOptions, void **libraryOptionValues, unsigned int numLibraryOptions); +typedef CUresult (CUDAAPI *PFN_cuLibraryUnload_v12000)(CUlibrary library); +typedef CUresult (CUDAAPI *PFN_cuLibraryGetKernel_v12000)(CUkernel *pKernel, CUlibrary library, const char *name); +typedef CUresult (CUDAAPI *PFN_cuLibraryGetModule_v12000)(CUmodule *pMod, CUlibrary library); +typedef CUresult (CUDAAPI *PFN_cuLibraryGetKernelCount)(unsigned int *count, CUlibrary lib); +typedef CUresult (CUDAAPI *PFN_cuLibraryEnumerateKernels)(CUkernel *kernels, unsigned int numKernels, CUlibrary lib); +typedef CUresult (CUDAAPI *PFN_cuKernelGetFunction_v12000)(CUfunction *pFunc, CUkernel kernel); +typedef CUresult (CUDAAPI *PFN_cuLibraryGetGlobal_v12000)(CUdeviceptr *dptr, size_t *bytes, CUlibrary library, const char *name); +typedef CUresult (CUDAAPI *PFN_cuLibraryGetManaged_v12000)(CUdeviceptr *dptr, size_t *bytes, CUlibrary library, const char *name); +typedef CUresult (CUDAAPI *PFN_cuKernelGetAttribute_v12000)(int *pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev); +typedef CUresult (CUDAAPI *PFN_cuKernelSetAttribute_v12000)(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev); +typedef CUresult (CUDAAPI *PFN_cuKernelSetCacheConfig_v12000)(CUkernel kernel, CUfunc_cache config, CUdevice dev); +typedef CUresult (CUDAAPI *PFN_cuKernelGetName_v12030)(const char **name, CUkernel hfunc); +typedef CUresult (CUDAAPI *PFN_cuKernelGetParamInfo_v12040)(CUkernel kernel, size_t paramIndex, size_t *paramOffset, size_t *paramSize); +typedef CUresult (CUDAAPI *PFN_cuLibraryGetUnifiedFunction_v12000)(void **fptr, CUlibrary library, const char *symbol); +typedef CUresult(CUDAAPI *PFN_cuCoredumpGetAttribute_v12010)(CUcoredumpSettings get, void *value, size_t *size); +typedef CUresult(CUDAAPI *PFN_cuCoredumpGetAttributeGlobal_v12010)(CUcoredumpSettings get, void *value, size_t *size); +typedef CUresult(CUDAAPI *PFN_cuCoredumpSetAttribute_v12010)(CUcoredumpSettings set, void *value, size_t *size); +typedef CUresult(CUDAAPI *PFN_cuCoredumpSetAttributeGlobal_v12010)(CUcoredumpSettings set, void *value, size_t *size); +typedef CUresult(CUDAAPI *PFN_cuDeviceRegisterAsyncNotification_v12040)(CUdevice device, CUasyncCallback callbackFunc, void *userData, CUasyncCallbackHandle *callback); +typedef CUresult(CUDAAPI *PFN_cuDeviceUnregisterAsyncNotification_v12040)(CUdevice device, CUasyncCallbackHandle callback); +typedef CUresult(CUDAAPI *PFN_cuGreenCtxCreate_v12040)(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags); +typedef CUresult(CUDAAPI *PFN_cuGreenCtxDestroy_v12040)(CUgreenCtx hCtx); +typedef CUresult(CUDAAPI *PFN_cuDeviceGetDevResource_v12040)(CUdevice dev, CUdevResource* result, CUdevResourceType type); +typedef CUresult(CUDAAPI *PFN_cuCtxGetDevResource_v12040)(CUcontext hCtx, CUdevResource* result, CUdevResourceType type); +typedef CUresult(CUDAAPI *PFN_cuGreenCtxGetDevResource_v12040)(CUgreenCtx hCtx, CUdevResource* result, CUdevResourceType type); +typedef CUresult(CUDAAPI *PFN_cuGreenCtxRecordEvent_v12040)(CUgreenCtx hCtx, CUevent hEvent); +typedef CUresult(CUDAAPI *PFN_cuGreenCtxWaitEvent_v12040)(CUgreenCtx hCtx, CUevent hEvent); +typedef CUresult(CUDAAPI *PFN_cuDevResourceGenerateDesc_v12040)(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources); +typedef CUresult(CUDAAPI *PFN_cuDevSmResourceSplitByCount_v12040)(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remaining, unsigned int useFlags, unsigned int minCount); +typedef CUresult(CUDAAPI *PFN_cuStreamGetGreenCtx_v12040)(CUstream hStream, CUgreenCtx *phCtx); +typedef CUresult(CUDAAPI *PFN_cuCtxFromGreenCtx_v12040)(CUcontext *pContext, CUgreenCtx hCtx); +/* + * Type definitions for older versioned functions in cuda.h + */ +#if defined(__CUDA_API_VERSION_INTERNAL) + typedef CUresult (CUDAAPI *PFN_cuMemHostRegister_v4000)(void *p, size_t bytesize, unsigned int Flags); + typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceSetMapFlags_v3000)(CUgraphicsResource resource, unsigned int flags); + typedef CUresult (CUDAAPI *PFN_cuLinkCreate_v5050)(unsigned int numOptions, CUjit_option *options, void **optionValues, CUlinkState *stateOut); + typedef CUresult (CUDAAPI *PFN_cuLinkAddData_v5050)(CUlinkState state, CUjitInputType type, void *data, size_t size, const char *name, unsigned int numOptions, CUjit_option *options, void **optionValues); + typedef CUresult (CUDAAPI *PFN_cuLinkAddFile_v5050)(CUlinkState state, CUjitInputType type, const char *path, unsigned int numOptions, CUjit_option *options, void **optionValues); + typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddress2D_v3020)(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR_v2 *desc, CUdeviceptr_v2 dptr, size_t Pitch); + typedef CUresult (CUDAAPI *PFN_cuDeviceTotalMem_v2000)(unsigned int *bytes, CUdevice_v1 dev); + typedef CUresult (CUDAAPI *PFN_cuCtxCreate_v2000)(CUcontext *pctx, unsigned int flags, CUdevice_v1 dev); + typedef CUresult (CUDAAPI *PFN_cuModuleGetGlobal_v2000)(CUdeviceptr_v1 *dptr, unsigned int *bytes, CUmodule hmod, const char *name); + typedef CUresult (CUDAAPI *PFN_cuMemGetInfo_v2000)(unsigned int *free, unsigned int *total); + typedef CUresult (CUDAAPI *PFN_cuMemAlloc_v2000)(CUdeviceptr_v1 *dptr, unsigned int bytesize); + typedef CUresult (CUDAAPI *PFN_cuMemAllocPitch_v2000)(CUdeviceptr_v1 *dptr, unsigned int *pPitch, unsigned int WidthInBytes, unsigned int Height, unsigned int ElementSizeBytes); + typedef CUresult (CUDAAPI *PFN_cuMemFree_v2000)(CUdeviceptr_v1 dptr); + typedef CUresult (CUDAAPI *PFN_cuMemGetAddressRange_v2000)(CUdeviceptr_v1 *pbase, unsigned int *psize, CUdeviceptr_v1 dptr); + typedef CUresult (CUDAAPI *PFN_cuMemAllocHost_v2000)(void **pp, unsigned int bytesize); + typedef CUresult (CUDAAPI *PFN_cuMemHostGetDevicePointer_v2020)(CUdeviceptr_v1 *pdptr, void *p, unsigned int Flags); + typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoD_v2000)(CUdeviceptr_v1 dstDevice, const void *srcHost, unsigned int ByteCount); + typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoH_v2000)(void *dstHost, CUdeviceptr_v1 srcDevice, unsigned int ByteCount); + typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoD_v2000)(CUdeviceptr_v1 dstDevice, CUdeviceptr_v1 srcDevice, unsigned int ByteCount); + typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoA_v2000)(CUarray dstArray, unsigned int dstOffset, CUdeviceptr_v1 srcDevice, unsigned int ByteCount); + typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoD_v2000)(CUdeviceptr_v1 dstDevice, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount); + typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoA_v2000)(CUarray dstArray, unsigned int dstOffset, const void *srcHost, unsigned int ByteCount); + typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoH_v2000)(void *dstHost, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount); + typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoA_v2000)(CUarray dstArray, unsigned int dstOffset, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount); + typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoAAsync_v2000)(CUarray dstArray, unsigned int dstOffset, const void *srcHost, unsigned int ByteCount, CUstream hStream); + typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoHAsync_v2000)(void *dstHost, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount, CUstream hStream); + typedef CUresult (CUDAAPI *PFN_cuMemcpy2D_v2000)(const CUDA_MEMCPY2D_v1 *pCopy); + typedef CUresult (CUDAAPI *PFN_cuMemcpy2DUnaligned_v2000)(const CUDA_MEMCPY2D_v1 *pCopy); + typedef CUresult (CUDAAPI *PFN_cuMemcpy3D_v2000)(const CUDA_MEMCPY3D_v1 *pCopy); + typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoDAsync_v2000)(CUdeviceptr_v1 dstDevice, const void *srcHost, unsigned int ByteCount, CUstream hStream); + typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoHAsync_v2000)(void *dstHost, CUdeviceptr_v1 srcDevice, unsigned int ByteCount, CUstream hStream); + typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoDAsync_v3000)(CUdeviceptr_v1 dstDevice, CUdeviceptr_v1 srcDevice, unsigned int ByteCount, CUstream hStream); + typedef CUresult (CUDAAPI *PFN_cuMemcpy2DAsync_v2000)(const CUDA_MEMCPY2D_v1 *pCopy, CUstream hStream); + typedef CUresult (CUDAAPI *PFN_cuMemcpy3DAsync_v2000)(const CUDA_MEMCPY3D_v1 *pCopy, CUstream hStream); + typedef CUresult (CUDAAPI *PFN_cuMemsetD8_v2000)(CUdeviceptr_v1 dstDevice, unsigned char uc, unsigned int N); + typedef CUresult (CUDAAPI *PFN_cuMemsetD16_v2000)(CUdeviceptr_v1 dstDevice, unsigned short us, unsigned int N); + typedef CUresult (CUDAAPI *PFN_cuMemsetD32_v2000)(CUdeviceptr_v1 dstDevice, unsigned int ui, unsigned int N); + typedef CUresult (CUDAAPI *PFN_cuMemsetD2D8_v2000)(CUdeviceptr_v1 dstDevice, unsigned int dstPitch, unsigned char uc, unsigned int Width, unsigned int Height); + typedef CUresult (CUDAAPI *PFN_cuMemsetD2D16_v2000)(CUdeviceptr_v1 dstDevice, unsigned int dstPitch, unsigned short us, unsigned int Width, unsigned int Height); + typedef CUresult (CUDAAPI *PFN_cuMemsetD2D32_v2000)(CUdeviceptr_v1 dstDevice, unsigned int dstPitch, unsigned int ui, unsigned int Width, unsigned int Height); + typedef CUresult (CUDAAPI *PFN_cuArrayCreate_v2000)(CUarray *pHandle, const CUDA_ARRAY_DESCRIPTOR_v1 *pAllocateArray); + typedef CUresult (CUDAAPI *PFN_cuArrayGetDescriptor_v2000)(CUDA_ARRAY_DESCRIPTOR_v1 *pArrayDescriptor, CUarray hArray); + typedef CUresult (CUDAAPI *PFN_cuArray3DCreate_v2000)(CUarray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR_v1 *pAllocateArray); + typedef CUresult (CUDAAPI *PFN_cuArray3DGetDescriptor_v2000)(CUDA_ARRAY3D_DESCRIPTOR_v1 *pArrayDescriptor, CUarray hArray); + typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddress_v2000)(unsigned int *ByteOffset, CUtexref hTexRef, CUdeviceptr_v1 dptr, unsigned int bytes); + typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddress2D_v2020)(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR_v1 *desc, CUdeviceptr_v1 dptr, unsigned int Pitch); + typedef CUresult (CUDAAPI *PFN_cuTexRefGetAddress_v2000)(CUdeviceptr_v1 *pdptr, CUtexref hTexRef); + typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceGetMappedPointer_v3000)(CUdeviceptr_v1 *pDevPtr, unsigned int *pSize, CUgraphicsResource resource); + typedef CUresult (CUDAAPI *PFN_cuCtxDestroy_v2000)(CUcontext ctx); + typedef CUresult (CUDAAPI *PFN_cuCtxPopCurrent_v2000)(CUcontext *pctx); + typedef CUresult (CUDAAPI *PFN_cuCtxPushCurrent_v2000)(CUcontext ctx); + typedef CUresult (CUDAAPI *PFN_cuStreamDestroy_v2000)(CUstream hStream); + typedef CUresult (CUDAAPI *PFN_cuEventDestroy_v2000)(CUevent hEvent); + typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxRelease_v7000)(CUdevice_v1 dev); + typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxReset_v7000)(CUdevice_v1 dev); + typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxSetFlags_v7000)(CUdevice_v1 dev, unsigned int flags); + typedef CUresult (CUDAAPI *PFN_cuStreamBeginCapture_v10000)(CUstream hStream); + typedef CUresult (CUDAAPI *PFN_cuStreamBeginCapture_v10000_ptsz)(CUstream hStream); + typedef CUresult (CUDAAPI *PFN_cuIpcOpenMemHandle_v4010)(CUdeviceptr_v2 *pdptr, CUipcMemHandle_v1 handle, unsigned int Flags); + typedef CUresult (CUDAAPI *PFN_cuGraphInstantiate_v10000)(CUgraphExec *phGraphExec, CUgraph hGraph, CUgraphNode *phErrorNode, char *logBuffer, size_t bufferSize); + typedef CUresult (CUDAAPI *PFN_cuGraphInstantiate_v11000)(CUgraphExec *phGraphExec, CUgraph hGraph, CUgraphNode *phErrorNode, char *logBuffer, size_t bufferSize); +#endif + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // file guard diff --git a/cuda_toolkit/include/cuda_awbarrier.h b/cuda_toolkit/include/cuda_awbarrier.h new file mode 100644 index 0000000000000000000000000000000000000000..dfe9cce98af602ce139e13bafee0c4825e83eb4f --- /dev/null +++ b/cuda_toolkit/include/cuda_awbarrier.h @@ -0,0 +1,280 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef _CUDA_AWBARRIER_H_ +# define _CUDA_AWBARRIER_H_ + +# include "cuda_awbarrier_primitives.h" + +# if !defined(_CUDA_AWBARRIER_SM_TARGET) +# error This file requires compute capability 7.0 or greater. +# endif + +# if !defined(_CUDA_AWBARRIER_CPLUSPLUS_11_OR_LATER) +# error This file requires compiler support for the ISO C++ 2011 standard. This support must be enabled with the \ + -std=c++11 compiler option. +# endif + +_CUDA_AWBARRIER_BEGIN_NAMESPACE + +class awbarrier { +public: + class arrival_token { + public: + arrival_token() = default; + ~arrival_token() = default; + _CUDA_AWBARRIER_QUALIFIER uint32_t pending_count() const; + private: + _CUDA_AWBARRIER_QUALIFIER arrival_token(uint64_t token); + uint64_t token; + friend awbarrier; + }; + awbarrier() = default; + awbarrier(const awbarrier&) = delete; + awbarrier& operator=(const awbarrier&) = delete; + ~awbarrier() = default; + + _CUDA_AWBARRIER_QUALIFIER arrival_token arrive(); + _CUDA_AWBARRIER_QUALIFIER arrival_token arrive_and_drop(); + _CUDA_AWBARRIER_QUALIFIER bool timed_wait(arrival_token token, uint32_t hint_cycles); + _CUDA_AWBARRIER_QUALIFIER bool timed_wait_parity(bool phase, uint32_t hint_cycles); + _CUDA_AWBARRIER_QUALIFIER void wait(arrival_token token); + _CUDA_AWBARRIER_QUALIFIER void arrive_and_wait(); + _CUDA_AWBARRIER_QUALIFIER bool try_wait(arrival_token token, uint32_t maxSleepNanosec); + _CUDA_AWBARRIER_QUALIFIER bool try_wait_parity(bool phase, uint32_t maxSleepNanosec); + _CUDA_AWBARRIER_STATIC_QUALIFIER __host__ constexpr uint32_t max(); + +private: + uint64_t barrier; + friend _CUDA_AWBARRIER_QUALIFIER void init(awbarrier* barrier, uint32_t expected_count); + friend _CUDA_AWBARRIER_QUALIFIER void inval(awbarrier* barrier); + friend class pipeline; +}; + +_CUDA_AWBARRIER_QUALIFIER +uint32_t awbarrier::arrival_token::pending_count() const +{ + const uint32_t pending_count = _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_token_pending_count(this->token); +#if (__CUDA_ARCH__ >= 900) + return pending_count; +#else + return (pending_count >> 15); +#endif +} + +_CUDA_AWBARRIER_QUALIFIER +awbarrier::arrival_token::arrival_token(uint64_t token) + : token(token) +{ +} + +_CUDA_AWBARRIER_QUALIFIER +void init(awbarrier* barrier, uint32_t expected_count) +{ + _CUDA_AWBARRIER_ASSERT(__isShared(barrier)); + _CUDA_AWBARRIER_ASSERT(expected_count > 0 && expected_count <= _CUDA_AWBARRIER_MAX_COUNT); + +#if (__CUDA_ARCH__ >= 900) + const uint32_t init_count = expected_count; +#else + const uint32_t init_count = (expected_count << 15) + expected_count; +#endif + + _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_init(&barrier->barrier, init_count); +} + +_CUDA_AWBARRIER_QUALIFIER +void inval(awbarrier* barrier) +{ + _CUDA_AWBARRIER_ASSERT(__isShared(barrier)); + + _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_inval(&barrier->barrier); +} + +_CUDA_AWBARRIER_QUALIFIER +awbarrier::arrival_token awbarrier::arrive() +{ + _CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier)); + + #if (__CUDA_ARCH__ < 900) + const uint32_t arrive_count = 1 << 15; + const uint64_t token = _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop_no_complete(&this->barrier, arrive_count); + (void) +#else + const uint64_t token = + #endif + _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop(&this->barrier); + + return arrival_token(token); +} + +_CUDA_AWBARRIER_QUALIFIER +awbarrier::arrival_token awbarrier::arrive_and_drop() +{ + _CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier)); + + #if (__CUDA_ARCH__ < 900) + const uint32_t arrive_count = 1 << 15; + const uint64_t token = _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop_no_complete(&this->barrier, arrive_count); + (void) +#else + const uint64_t token = + #endif + _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop(&this->barrier); + + return arrival_token(token); +} + +_CUDA_AWBARRIER_QUALIFIER +bool awbarrier::timed_wait(arrival_token token, uint32_t hint_cycles) +{ + constexpr uint64_t max_busy_wait_cycles = 1024; + constexpr uint32_t max_sleep_ns = 1 << 20; + + _CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier)); + + if (_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait(&this->barrier, token.token)) { + return true; + } + + uint64_t start_cycles = clock64(); + uint64_t elapsed_cycles = 0; + uint32_t sleep_ns = 32; + while (elapsed_cycles < hint_cycles) { + if (_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait(&this->barrier, token.token)) { + return true; + } + + if (elapsed_cycles > max_busy_wait_cycles) { + __nanosleep(sleep_ns); + if (sleep_ns < max_sleep_ns) { + sleep_ns *= 2; + } + } + + elapsed_cycles = clock64() - start_cycles; + } + + return false; +} + +_CUDA_AWBARRIER_QUALIFIER +bool awbarrier::timed_wait_parity(bool phase, uint32_t hint_cycles) +{ + constexpr uint64_t max_busy_wait_cycles = 1024; + constexpr uint32_t max_sleep_ns = 1 << 20; + + _CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier)); + + if (_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait_parity(&this->barrier, phase)) { + return true; + } + + uint64_t start_cycles = clock64(); + uint64_t elapsed_cycles = 0; + uint32_t sleep_ns = 32; + while (elapsed_cycles < hint_cycles) { + if (_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait_parity(&this->barrier, phase)) { + return true; + } + + if (elapsed_cycles > max_busy_wait_cycles) { + __nanosleep(sleep_ns); + if (sleep_ns < max_sleep_ns) { + sleep_ns *= 2; + } + } + + elapsed_cycles = clock64() - start_cycles; + } + + return false; +} + +_CUDA_AWBARRIER_QUALIFIER +bool awbarrier::try_wait(arrival_token token, uint32_t maxSleepNanosec) +{ + _CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier)); + + return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_try_wait(&this->barrier, token.token, maxSleepNanosec); +} + +_CUDA_AWBARRIER_QUALIFIER +bool awbarrier::try_wait_parity(bool phase, uint32_t maxSleepNanosec) +{ + _CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier)); + + return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_try_wait_parity(&this->barrier, phase, maxSleepNanosec); +} + +_CUDA_AWBARRIER_QUALIFIER +void awbarrier::wait(arrival_token token) +{ + _CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier)); + + while (!timed_wait(token, ~0u)); +} + +_CUDA_AWBARRIER_QUALIFIER +void awbarrier::arrive_and_wait() +{ + _CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier)); + + this->wait(this->arrive()); +} + +_CUDA_AWBARRIER_QUALIFIER __host__ +constexpr uint32_t awbarrier::max() +{ + return _CUDA_AWBARRIER_MAX_COUNT; +} + +_CUDA_AWBARRIER_END_NAMESPACE + +#endif /* !_CUDA_AWBARRIER_H_ */ diff --git a/cuda_toolkit/include/cuda_awbarrier_helpers.h b/cuda_toolkit/include/cuda_awbarrier_helpers.h new file mode 100644 index 0000000000000000000000000000000000000000..de10ce3ee609d67ae475b185082305e5f5e4f200 --- /dev/null +++ b/cuda_toolkit/include/cuda_awbarrier_helpers.h @@ -0,0 +1,365 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef _CUDA_AWBARRIER_HELPERS_H_ +#define _CUDA_AWBARRIER_HELPERS_H_ + +#define _CUDA_AWBARRIER_NAMESPACE nvcuda::experimental +#define _CUDA_AWBARRIER_BEGIN_NAMESPACE namespace nvcuda { namespace experimental { +#define _CUDA_AWBARRIER_END_NAMESPACE } } + +#define _CUDA_AWBARRIER_INTERNAL_NAMESPACE _CUDA_AWBARRIER_NAMESPACE::__awbarrier_internal +#define _CUDA_AWBARRIER_BEGIN_INTERNAL_NAMESPACE _CUDA_AWBARRIER_BEGIN_NAMESPACE namespace __awbarrier_internal { +#define _CUDA_AWBARRIER_END_INTERNAL_NAMESPACE } _CUDA_AWBARRIER_END_NAMESPACE + +# if !defined(_CUDA_AWBARRIER_QUALIFIER) +# define _CUDA_AWBARRIER_QUALIFIER inline __device__ +# endif +# if !defined(_CUDA_AWBARRIER_STATIC_QUALIFIER) +# define _CUDA_AWBARRIER_STATIC_QUALIFIER static inline __device__ +#endif + +#if defined(__CUDA_ARCH__) +#if (__CUDA_ARCH__ >= 900) +# define _CUDA_AWBARRIER_SM_TARGET _CUDA_AWBARRIER_SM_90 +#elif (__CUDA_ARCH__ >= 800) +# define _CUDA_AWBARRIER_SM_TARGET _CUDA_AWBARRIER_SM_80 +#elif (__CUDA_ARCH__ >= 700) +# define _CUDA_AWBARRIER_SM_TARGET _CUDA_AWBARRIER_SM_70 +#endif +#else +# define _CUDA_AWBARRIER_SM_TARGET _CUDA_AWBARRIER_SM_70 +#endif + +#define _CUDA_AWBARRIER_MAX_COUNT ((1 << 14) - 1) + +#if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1900))) +# define _CUDA_AWBARRIER_CPLUSPLUS_11_OR_LATER +#endif + +#if !defined(_CUDA_AWBARRIER_DEBUG) +# if defined(__CUDACC_DEBUG__) +# define _CUDA_AWBARRIER_DEBUG 1 +# else +# define _CUDA_AWBARRIER_DEBUG 0 +# endif +#endif + +#if defined(_CUDA_AWBARRIER_DEBUG) && (_CUDA_AWBARRIER_DEBUG == 1) && !defined(NDEBUG) +# if !defined(__CUDACC_RTC__) +# include +# endif +# define _CUDA_AWBARRIER_ASSERT(x) assert((x)); +# define _CUDA_AWBARRIER_ABORT() assert(0); +#else +# define _CUDA_AWBARRIER_ASSERT(x) +# define _CUDA_AWBARRIER_ABORT() __trap(); +#endif + +#if defined(__CUDACC_RTC__) +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; +typedef uint64_t uintptr_t; +#else +# include +#endif + +// implicitly provided by NVRTC +#ifndef __CUDACC_RTC__ +#include +#endif /* !defined(__CUDACC_RTC__) */ + +typedef uint64_t __mbarrier_t; +typedef uint64_t __mbarrier_token_t; + +_CUDA_AWBARRIER_BEGIN_INTERNAL_NAMESPACE + +extern "C" __device__ uint32_t __nvvm_get_smem_pointer(void *); + +union AWBarrier { + struct { + uint32_t expected; + uint32_t pending; + } split; + uint64_t raw; +}; + +_CUDA_AWBARRIER_STATIC_QUALIFIER +void awbarrier_init(uint64_t* barrier, uint32_t expected_count) { + _CUDA_AWBARRIER_ASSERT(__isShared(barrier)); + _CUDA_AWBARRIER_ASSERT(expected_count > 0 && expected_count < (1 << 29)); + + NV_IF_TARGET(NV_PROVIDES_SM_80, + asm volatile ("mbarrier.init.shared.b64 [%0], %1;" + : + : "r"(__nvvm_get_smem_pointer(barrier)), "r"(expected_count) + : "memory"); + return; + ) + NV_IF_TARGET(NV_PROVIDES_SM_70, + AWBarrier* awbarrier = reinterpret_cast(barrier); + + awbarrier->split.expected = 0x40000000 - expected_count; + awbarrier->split.pending = 0x80000000 - expected_count; + return; + ) +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +void awbarrier_inval(uint64_t* barrier) { + _CUDA_AWBARRIER_ASSERT(__isShared(barrier)); + + NV_IF_TARGET(NV_PROVIDES_SM_80, + asm volatile ("mbarrier.inval.shared.b64 [%0];" + : + : "r"(__nvvm_get_smem_pointer(barrier)) + : "memory"); + return; + ) + return; +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +uint32_t awbarrier_token_pending_count(uint64_t token) { + NV_IF_TARGET(NV_PROVIDES_SM_80, + uint32_t __pending_count; + + asm ("mbarrier.pending_count.b64 %0, %1;" + : "=r"(__pending_count) + : "l"(token)); + return __pending_count; + ) + NV_IF_TARGET(NV_PROVIDES_SM_70, + const uint32_t pending = token >> 32; + return 0x80000000 - (pending & 0x7fffffff); + ) +} + +template +_CUDA_AWBARRIER_STATIC_QUALIFIER +uint64_t awbarrier_arrive_drop(uint64_t* barrier) { + _CUDA_AWBARRIER_ASSERT(__isShared(barrier)); + + NV_IF_TARGET(NV_PROVIDES_SM_80, + uint64_t token; + + if (_Drop) { + asm volatile ("mbarrier.arrive_drop.shared.b64 %0, [%1];" + : "=l"(token) + : "r"(__nvvm_get_smem_pointer(barrier)) + : "memory"); + } else { + asm volatile ("mbarrier.arrive.shared.b64 %0, [%1];" + : "=l"(token) + : "r"(__nvvm_get_smem_pointer(barrier)) + : "memory"); + } + + return token; + ) + NV_IF_TARGET(NV_PROVIDES_SM_70, + AWBarrier* awbarrier = reinterpret_cast(barrier); + + while ((*reinterpret_cast(&awbarrier->split.pending) & 0x7fffffff) == 0); + + if (_Drop) { + (void)atomicAdd_block(&awbarrier->split.expected, 1); + } + + __threadfence_block(); + + const uint32_t old_pending = atomicAdd_block(&awbarrier->split.pending, 1); + const uint32_t new_pending = old_pending + 1; + const bool reset = (old_pending ^ new_pending) & 0x80000000; + + if (reset) { + __threadfence_block(); + + uint32_t new_expected = *reinterpret_cast(&awbarrier->split.expected); + new_expected &= ~0x40000000; + if (new_expected & 0x20000000) { + new_expected |= 0x40000000; + } + atomicAdd_block(&awbarrier->split.pending, new_expected); + } + + return static_cast(old_pending) << 32; + ) +} + +template +_CUDA_AWBARRIER_STATIC_QUALIFIER +uint64_t awbarrier_arrive_drop_no_complete(uint64_t* barrier, uint32_t count) { + _CUDA_AWBARRIER_ASSERT(__isShared(barrier)); + _CUDA_AWBARRIER_ASSERT(count > 0 && count < (1 << 29)); + + NV_IF_TARGET(NV_PROVIDES_SM_80, + uint64_t token; + + if (_Drop) { + asm volatile ("mbarrier.arrive_drop.noComplete.shared.b64 %0, [%1], %2;" + : "=l"(token) + : "r"(__nvvm_get_smem_pointer(barrier)), "r"(count) + : "memory"); + } else { + asm volatile ("mbarrier.arrive.noComplete.shared.b64 %0, [%1], %2;" + : "=l"(token) + : "r"(__nvvm_get_smem_pointer(barrier)), "r"(count) + : "memory"); + } + + return token; + ) + NV_IF_TARGET(NV_PROVIDES_SM_70, + AWBarrier* awbarrier = reinterpret_cast(barrier); + + while ((*reinterpret_cast(&awbarrier->split.pending) & 0x7fffffff) == 0); + + if (_Drop) { + (void)atomicAdd_block(&awbarrier->split.expected, count); + } + + return static_cast(atomicAdd_block(&awbarrier->split.pending, count)) << 32; + ) +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +bool awbarrier_test_wait(uint64_t* barrier, uint64_t token) { + _CUDA_AWBARRIER_ASSERT(__isShared(barrier)); + + NV_IF_TARGET(NV_PROVIDES_SM_80, + uint32_t __wait_complete; + + asm volatile ("{" + " .reg .pred %%p;" + " mbarrier.test_wait.shared.b64 %%p, [%1], %2;" + " selp.b32 %0, 1, 0, %%p;" + "}" + : "=r"(__wait_complete) + : "r"(__nvvm_get_smem_pointer(barrier)), "l"(token) + : "memory"); + return bool(__wait_complete); + ) + NV_IF_TARGET(NV_PROVIDES_SM_70, + volatile AWBarrier* awbarrier = reinterpret_cast(barrier); + + return ((token >> 32) ^ awbarrier->split.pending) & 0x80000000; + ) +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +bool awbarrier_test_wait_parity(uint64_t* barrier, bool phase_parity) { + _CUDA_AWBARRIER_ASSERT(__isShared(barrier)); + + NV_IF_TARGET(NV_PROVIDES_SM_90, + uint32_t __wait_complete = 0; + + asm volatile ("{" + ".reg .pred %%p;" + "mbarrier.test_wait.parity.shared.b64 %%p, [%1], %2;" + "selp.b32 %0, 1, 0, %%p;" + "}" + : "=r"(__wait_complete) + : "r"(__nvvm_get_smem_pointer(barrier)), "r"(static_cast(phase_parity)) + : "memory"); + + return __wait_complete; + ) + _CUDA_AWBARRIER_ABORT() + return false; +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +bool awbarrier_try_wait(uint64_t* barrier, uint64_t token, uint32_t max_sleep_nanosec) { + _CUDA_AWBARRIER_ASSERT(__isShared(barrier)); + + NV_IF_TARGET(NV_PROVIDES_SM_90, + uint32_t __wait_complete = 0; + + asm volatile ("{\n\t" + ".reg .pred p;\n\t" + "mbarrier.try_wait.shared.b64 p, [%1], %2, %3;\n\t" + "selp.b32 %0, 1, 0, p;\n\t" + "}" + : "=r"(__wait_complete) + : "r"(__nvvm_get_smem_pointer(barrier)), "l"(token), "r"(max_sleep_nanosec) + : "memory"); + + return __wait_complete; + ) + _CUDA_AWBARRIER_ABORT() + return false; +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +bool awbarrier_try_wait_parity(uint64_t* barrier, bool phase_parity, uint32_t max_sleep_nanosec) { + _CUDA_AWBARRIER_ASSERT(__isShared(barrier)); + + NV_IF_TARGET(NV_PROVIDES_SM_90, + uint32_t __wait_complete = 0; + + asm volatile ("{\n\t" + ".reg .pred p;\n\t" + "mbarrier.try_wait.parity.shared.b64 p, [%1], %2, %3;\n\t" + "selp.b32 %0, 1, 0, p;\n\t" + "}" + : "=r"(__wait_complete) + : "r"(__nvvm_get_smem_pointer(barrier)), "r"(static_cast(phase_parity)), "r"(max_sleep_nanosec) + : "memory"); + + return __wait_complete; + ) + _CUDA_AWBARRIER_ABORT() + return false; +} + +_CUDA_AWBARRIER_END_INTERNAL_NAMESPACE + +#endif /* !_CUDA_AWBARRIER_HELPERS_H_ */ diff --git a/cuda_toolkit/include/cuda_awbarrier_primitives.h b/cuda_toolkit/include/cuda_awbarrier_primitives.h new file mode 100644 index 0000000000000000000000000000000000000000..bbbf32201a54732429349ef748b2d13eeb831835 --- /dev/null +++ b/cuda_toolkit/include/cuda_awbarrier_primitives.h @@ -0,0 +1,109 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef _CUDA_AWBARRIER_PRIMITIVES_H_ +#define _CUDA_AWBARRIER_PRIMITIVES_H_ + +#include "cuda_awbarrier_helpers.h" + +#if !defined(_CUDA_AWBARRIER_SM_TARGET) +# error This file requires compute capability 7.0 or greater. +#endif + +_CUDA_AWBARRIER_STATIC_QUALIFIER __host__ +uint32_t __mbarrier_maximum_count() { + return _CUDA_AWBARRIER_MAX_COUNT; +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +void __mbarrier_init(__mbarrier_t* barrier, uint32_t expected_count) { + _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_init(barrier, expected_count); +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +void __mbarrier_inval(__mbarrier_t* barrier) { + _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_inval(barrier); +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +__mbarrier_token_t __mbarrier_arrive(__mbarrier_t* barrier) { + return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop(barrier); +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +__mbarrier_token_t __mbarrier_arrive_and_drop(__mbarrier_t* barrier) { + return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop(barrier); +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +bool __mbarrier_test_wait(__mbarrier_t* barrier, __mbarrier_token_t token) { + return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait(barrier, token); +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +uint32_t __mbarrier_token_pending_count(__mbarrier_token_t token) { + return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_token_pending_count(token); +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +bool __mbarrier_test_wait_parity(__mbarrier_t* barrier, bool phase_parity) { + return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait_parity(barrier, phase_parity); +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +bool __mbarrier_try_wait(__mbarrier_t* barrier, __mbarrier_token_t token, uint32_t max_sleep_nanosec) { + return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_try_wait(barrier, token, max_sleep_nanosec); +} + +_CUDA_AWBARRIER_STATIC_QUALIFIER +bool __mbarrier_try_wait_parity(__mbarrier_t* barrier, bool phase_parity, uint32_t max_sleep_nanosec) { + return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_try_wait_parity(barrier, phase_parity, max_sleep_nanosec); +} + +#endif /* !_CUDA_AWBARRIER_PRIMITIVES_H_ */ diff --git a/cuda_toolkit/include/cuda_bf16.h b/cuda_toolkit/include/cuda_bf16.h new file mode 100644 index 0000000000000000000000000000000000000000..c4d6d958f48ba60158ee1ed294fdcbdf0dd6736d --- /dev/null +++ b/cuda_toolkit/include/cuda_bf16.h @@ -0,0 +1,4851 @@ +/* +* Copyright 1993-2024 NVIDIA Corporation. All rights reserved. +* +* NOTICE TO LICENSEE: +* +* This source code and/or documentation ("Licensed Deliverables") are +* subject to NVIDIA intellectual property rights under U.S. and +* international Copyright laws. +* +* These Licensed Deliverables contained herein is PROPRIETARY and +* CONFIDENTIAL to NVIDIA and is being provided under the terms and +* conditions of a form of NVIDIA software license agreement by and +* between NVIDIA and Licensee ("License Agreement") or electronically +* accepted by Licensee. Notwithstanding any terms or conditions to +* the contrary in the License Agreement, reproduction or disclosure +* of the Licensed Deliverables to any third party without the express +* written consent of NVIDIA is prohibited. +* +* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE +* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE +* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS +* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. +* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED +* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, +* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. +* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE +* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY +* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY +* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +* OF THESE LICENSED DELIVERABLES. +* +* U.S. Government End Users. These Licensed Deliverables are a +* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT +* 1995), consisting of "commercial computer software" and "commercial +* computer software documentation" as such terms are used in 48 +* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government +* only as a commercial end item. Consistent with 48 C.F.R.12.212 and +* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all +* U.S. Government End Users acquire the Licensed Deliverables with +* only those rights set forth herein. +* +* Any use of the Licensed Deliverables in individual and commercial +* software must include, in the user documentation and internal +* comments to the code, the above Disclaimer and U.S. Government End +* Users Notice. +*/ + +/** +* \defgroup CUDA_MATH_INTRINSIC_BFLOAT16 Bfloat16 Precision Intrinsics +* This section describes nv_bfloat16 precision intrinsic functions. +* To use these functions, include the header file \p cuda_bf16.h in your program. +* All of the functions defined here are available in device code. +* Some of the functions are also available to host compilers, please +* refer to respective functions' documentation for details. +* +* NOTE: Aggressive floating-point optimizations performed by host or device +* compilers may affect numeric behavior of the functions implemented in this +* header. Specific examples are: +* - hsin(__nv_bfloat16); +* - hcos(__nv_bfloat16); +* - h2sin(__nv_bfloat162); +* - h2cos(__nv_bfloat162); +* +* The following macros are available to help users selectively enable/disable +* various definitions present in the header file: +* - \p CUDA_NO_BFLOAT16 - If defined, this macro will prevent the definition of +* additional type aliases in the global namespace, helping to avoid potential +* conflicts with symbols defined in the user program. +* - \p __CUDA_NO_BFLOAT16_CONVERSIONS__ - If defined, this macro will prevent +* the use of the C++ type conversions (converting constructors and conversion +* operators) that are common for built-in floating-point types, but may be +* undesirable for \p __nv_bfloat16 which is essentially a user-defined type. +* - \p __CUDA_NO_BFLOAT16_OPERATORS__ and \p __CUDA_NO_BFLOAT162_OPERATORS__ - +* If defined, these macros will prevent the inadvertent use of usual arithmetic +* and comparison operators. This enforces the storage-only type semantics and +* prevents C++ style computations on \p __nv_bfloat16 and \p __nv_bfloat162 types. +*/ + +/** +* \defgroup CUDA_MATH_INTRINSIC_BFLOAT16_CONSTANTS Bfloat16 Arithmetic Constants +* \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 +* To use these constants, include the header file \p cuda_bf16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__BFLOAT16_ARITHMETIC Bfloat16 Arithmetic Functions +* \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 +* To use these functions, include the header file \p cuda_bf16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__BFLOAT162_ARITHMETIC Bfloat162 Arithmetic Functions +* \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 +* To use these functions, include the header file \p cuda_bf16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__BFLOAT16_COMPARISON Bfloat16 Comparison Functions +* \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 +* To use these functions, include the header file \p cuda_bf16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__BFLOAT162_COMPARISON Bfloat162 Comparison Functions +* \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 +* To use these functions, include the header file \p cuda_bf16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__BFLOAT16_MISC Bfloat16 Precision Conversion and Data Movement +* \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 +* To use these functions, include the header file \p cuda_bf16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__BFLOAT16_FUNCTIONS Bfloat16 Math Functions +* \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 +* To use these functions, include the header file \p cuda_bf16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__BFLOAT162_FUNCTIONS Bfloat162 Math Functions +* \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 +* To use these functions, include the header file \p cuda_bf16.h in your program. +*/ + +#ifndef __CUDA_BF16_H__ +#define __CUDA_BF16_H__ + +/* bring in __half data type and operations, for use in converting constructors */ +#include "cuda_fp16.h" +/* bring in float2, double4, etc vector types */ +#include "vector_types.h" +/* bring in operations on vector types like: make_float2 */ +#include "vector_functions.h" + +#define ___CUDA_BF16_STRINGIFY_INNERMOST(x) #x +#define __CUDA_BF16_STRINGIFY(x) ___CUDA_BF16_STRINGIFY_INNERMOST(x) + +#if defined(__cplusplus) + +/* Set up function decorations */ +#if (defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3)))) +#define __CUDA_BF16_DECL__ __device__ +#define __CUDA_HOSTDEVICE_BF16_DECL__ __device__ +#define __CUDA_HOSTDEVICE__ __device__ +#elif defined(__CUDACC__) || defined(_NVHPC_CUDA) +#define __CUDA_BF16_DECL__ static __device__ __inline__ +#define __CUDA_HOSTDEVICE_BF16_DECL__ static __host__ __device__ __inline__ +#define __CUDA_HOSTDEVICE__ __host__ __device__ +#else /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +#if defined(__GNUC__) +#define __CUDA_HOSTDEVICE_BF16_DECL__ static __attribute__ ((unused)) +#else +#define __CUDA_HOSTDEVICE_BF16_DECL__ static +#endif /* defined(__GNUC__) */ +#define __CUDA_HOSTDEVICE__ +#endif /* (defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3))))) */ + +#define __CUDA_BF16_TYPES_EXIST__ + +/* Macros to allow nv_bfloat16 & nv_bfloat162 to be used by inline assembly */ +#define __BFLOAT16_TO_US(var) *(reinterpret_cast(&(var))) +#define __BFLOAT16_TO_CUS(var) *(reinterpret_cast(&(var))) +#define __BFLOAT162_TO_UI(var) *(reinterpret_cast(&(var))) +#define __BFLOAT162_TO_CUI(var) *(reinterpret_cast(&(var))) + +/* Forward-declaration of structures defined in "cuda_bf16.hpp" */ +struct __nv_bfloat16; +struct __nv_bfloat162; + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts double number to nv_bfloat16 precision in round-to-nearest-even mode +* and returns \p nv_bfloat16 with converted value. +* +* \details Converts double number \p a to nv_bfloat16 precision in round-to-nearest-even mode. +* \param[in] a - double. Is only being read. +* \returns nv_bfloat16 +* - \p a converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __double2bfloat16(const double a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts float number to nv_bfloat16 precision in round-to-nearest-even mode +* and returns \p nv_bfloat16 with converted value. +* +* \details Converts float number \p a to nv_bfloat16 precision in round-to-nearest-even mode. +* \param[in] a - float. Is only being read. +* \returns nv_bfloat16 +* - \p a converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __float2bfloat16(const float a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts float number to nv_bfloat16 precision in round-to-nearest-even mode +* and returns \p nv_bfloat16 with converted value. +* +* \details Converts float number \p a to nv_bfloat16 precision in round-to-nearest-even mode. +* \param[in] a - float. Is only being read. +* \returns nv_bfloat16 +* - \p a converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __float2bfloat16_rn(const float a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts float number to nv_bfloat16 precision in round-towards-zero mode +* and returns \p nv_bfloat16 with converted value. +* +* \details Converts float number \p a to nv_bfloat16 precision in round-towards-zero mode. +* \param[in] a - float. Is only being read. +* \returns nv_bfloat16 +* - \p a converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __float2bfloat16_rz(const float a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts float number to nv_bfloat16 precision in round-down mode +* and returns \p nv_bfloat16 with converted value. +* +* \details Converts float number \p a to nv_bfloat16 precision in round-down mode. +* \param[in] a - float. Is only being read. +* +* \returns nv_bfloat16 +* - \p a converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __float2bfloat16_rd(const float a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts float number to nv_bfloat16 precision in round-up mode +* and returns \p nv_bfloat16 with converted value. +* +* \details Converts float number \p a to nv_bfloat16 precision in round-up mode. +* \param[in] a - float. Is only being read. +* +* \returns nv_bfloat16 +* - \p a converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __float2bfloat16_ru(const float a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts \p nv_bfloat16 number to float. +* +* \details Converts nv_bfloat16 number \p a to float. +* \param[in] a - float. Is only being read. +* +* \returns float +* - \p a converted to float. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ float __bfloat162float(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts input to nv_bfloat16 precision in round-to-nearest-even mode and +* populates both halves of \p nv_bfloat162 with converted value. +* +* \details Converts input \p a to nv_bfloat16 precision in round-to-nearest-even mode and +* populates both halves of \p nv_bfloat162 with converted value. +* \param[in] a - float. Is only being read. +* +* \returns nv_bfloat162 +* - The \p nv_bfloat162 value with both halves equal to the converted nv_bfloat16 +* precision number. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __float2bfloat162_rn(const float a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts both input floats to nv_bfloat16 precision in round-to-nearest-even +* mode and returns \p nv_bfloat162 with converted values. +* +* \details Converts both input floats to nv_bfloat16 precision in round-to-nearest-even mode +* and combines the results into one \p nv_bfloat162 number. Low 16 bits of the return +* value correspond to the input \p a, high 16 bits correspond to the input \p +* b. +* \param[in] a - float. Is only being read. +* \param[in] b - float. Is only being read. +* +* \returns nv_bfloat162 +* - The \p nv_bfloat162 value with corresponding halves equal to the +* converted input floats. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __floats2bfloat162_rn(const float a, const float b); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts low 16 bits of \p nv_bfloat162 to float and returns the result +* +* \details Converts low 16 bits of \p nv_bfloat162 input \p a to 32-bit floating-point number +* and returns the result. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns float +* - The low 16 bits of \p a converted to float. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ float __low2float(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts high 16 bits of \p nv_bfloat162 to float and returns the result +* +* \details Converts high 16 bits of \p nv_bfloat162 input \p a to 32-bit floating-point number +* and returns the result. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns float +* - The high 16 bits of \p a converted to float. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ float __high2float(const __nv_bfloat162 a); + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts both components of float2 number to nv_bfloat16 precision in +* round-to-nearest-even mode and returns \p nv_bfloat162 with converted values. +* +* \details Converts both components of float2 to nv_bfloat16 precision in round-to-nearest-even +* mode and combines the results into one \p nv_bfloat162 number. Low 16 bits of the +* return value correspond to \p a.x and high 16 bits of the return value +* correspond to \p a.y. +* \param[in] a - float2. Is only being read. +* +* \returns nv_bfloat162 +* - The \p nv_bfloat162 which has corresponding halves equal to the +* converted float2 components. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __float22bfloat162_rn(const float2 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Converts both halves of \p nv_bfloat162 to float2 and returns the result. +* +* \details Converts both halves of \p nv_bfloat162 input \p a to float2 and returns the +* result. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns float2 +* - \p a converted to float2. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ float2 __bfloat1622float2(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed char in round-towards-zero mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed +* char in round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns signed char +* - \p h converted to a signed char. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ signed char __bfloat162char_rz(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned char in round-towards-zero mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned +* char in round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned char +* - \p h converted to an unsigned char. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned char __bfloat162uchar_rz(const __nv_bfloat16 h); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed integer in round-to-nearest-even mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed integer in +* round-to-nearest-even mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns int +* - \p h converted to a signed integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ int __bfloat162int_rn(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed integer in round-towards-zero mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed integer in +* round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns int +* - \p h converted to a signed integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ int __bfloat162int_rz(const __nv_bfloat16 h); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed integer in round-down mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed integer in +* round-down mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns int +* - \p h converted to a signed integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ int __bfloat162int_rd(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed integer in round-up mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed integer in +* round-up mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns int +* - \p h converted to a signed integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ int __bfloat162int_ru(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed integer to a nv_bfloat16 in round-to-nearest-even mode. +* +* \details Convert the signed integer value \p i to a nv_bfloat16 floating-point +* value in round-to-nearest-even mode. +* \param[in] i - int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __int2bfloat16_rn(const int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed integer to a nv_bfloat16 in round-towards-zero mode. +* +* \details Convert the signed integer value \p i to a nv_bfloat16 floating-point +* value in round-towards-zero mode. +* \param[in] i - int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __int2bfloat16_rz(const int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed integer to a nv_bfloat16 in round-down mode. +* +* \details Convert the signed integer value \p i to a nv_bfloat16 floating-point +* value in round-down mode. +* \param[in] i - int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __int2bfloat16_rd(const int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed integer to a nv_bfloat16 in round-up mode. +* +* \details Convert the signed integer value \p i to a nv_bfloat16 floating-point +* value in round-up mode. +* \param[in] i - int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __int2bfloat16_ru(const int i); + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed short integer in round-to-nearest-even +* mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed short +* integer in round-to-nearest-even mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns short int +* - \p h converted to a signed short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ short int __bfloat162short_rn(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed short integer in round-towards-zero mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed short +* integer in round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns short int +* - \p h converted to a signed short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ short int __bfloat162short_rz(const __nv_bfloat16 h); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed short integer in round-down mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed short +* integer in round-down mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns short int +* - \p h converted to a signed short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ short int __bfloat162short_rd(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed short integer in round-up mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed short +* integer in round-up mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns short int +* - \p h converted to a signed short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ short int __bfloat162short_ru(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed short integer to a nv_bfloat16 in round-to-nearest-even +* mode. +* +* \details Convert the signed short integer value \p i to a nv_bfloat16 floating-point +* value in round-to-nearest-even mode. +* \param[in] i - short int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __short2bfloat16_rn(const short int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed short integer to a nv_bfloat16 in round-towards-zero mode. +* +* \details Convert the signed short integer value \p i to a nv_bfloat16 floating-point +* value in round-towards-zero mode. +* \param[in] i - short int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __short2bfloat16_rz(const short int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed short integer to a nv_bfloat16 in round-down mode. +* +* \details Convert the signed short integer value \p i to a nv_bfloat16 floating-point +* value in round-down mode. +* \param[in] i - short int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __short2bfloat16_rd(const short int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed short integer to a nv_bfloat16 in round-up mode. +* +* \details Convert the signed short integer value \p i to a nv_bfloat16 floating-point +* value in round-up mode. +* \param[in] i - short int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __short2bfloat16_ru(const short int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned integer in round-to-nearest-even mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned integer +* in round-to-nearest-even mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned int +* - \p h converted to an unsigned integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ unsigned int __bfloat162uint_rn(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned integer in round-towards-zero mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned integer +* in round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned int +* - \p h converted to an unsigned integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned int __bfloat162uint_rz(const __nv_bfloat16 h); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned integer in round-down mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned integer +* in round-down mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned int +* - \p h converted to an unsigned integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ unsigned int __bfloat162uint_rd(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned integer in round-up mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned integer +* in round-up mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned int +* - \p h converted to an unsigned integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ unsigned int __bfloat162uint_ru(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned integer to a nv_bfloat16 in round-to-nearest-even mode. +* +* \details Convert the unsigned integer value \p i to a nv_bfloat16 floating-point +* value in round-to-nearest-even mode. +* \param[in] i - unsigned int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __uint2bfloat16_rn(const unsigned int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned integer to a nv_bfloat16 in round-towards-zero mode. +* +* \details Convert the unsigned integer value \p i to a nv_bfloat16 floating-point +* value in round-towards-zero mode. +* \param[in] i - unsigned int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __uint2bfloat16_rz(const unsigned int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned integer to a nv_bfloat16 in round-down mode. +* +* \details Convert the unsigned integer value \p i to a nv_bfloat16 floating-point +* value in round-down mode. +* \param[in] i - unsigned int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __uint2bfloat16_rd(const unsigned int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned integer to a nv_bfloat16 in round-up mode. +* +* \details Convert the unsigned integer value \p i to a nv_bfloat16 floating-point +* value in round-up mode. +* \param[in] i - unsigned int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __uint2bfloat16_ru(const unsigned int i); + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned short integer in round-to-nearest-even +* mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned short +* integer in round-to-nearest-even mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned short int +* - \p h converted to an unsigned short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ unsigned short int __bfloat162ushort_rn(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned short integer in round-towards-zero +* mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned short +* integer in round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned short int +* - \p h converted to an unsigned short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned short int __bfloat162ushort_rz(const __nv_bfloat16 h); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned short integer in round-down mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned short +* integer in round-down mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned short int +* - \p h converted to an unsigned short integer. +*/ +__CUDA_BF16_DECL__ unsigned short int __bfloat162ushort_rd(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned short integer in round-up mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned short +* integer in round-up mode. NaN inputs are converted to 0. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned short int +* - \p h converted to an unsigned short integer. +*/ +__CUDA_BF16_DECL__ unsigned short int __bfloat162ushort_ru(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned short integer to a nv_bfloat16 in round-to-nearest-even +* mode. +* +* \details Convert the unsigned short integer value \p i to a nv_bfloat16 floating-point +* value in round-to-nearest-even mode. +* \param[in] i - unsigned short int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __ushort2bfloat16_rn(const unsigned short int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned short integer to a nv_bfloat16 in round-towards-zero +* mode. +* +* \details Convert the unsigned short integer value \p i to a nv_bfloat16 floating-point +* value in round-towards-zero mode. +* \param[in] i - unsigned short int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ushort2bfloat16_rz(const unsigned short int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned short integer to a nv_bfloat16 in round-down mode. +* +* \details Convert the unsigned short integer value \p i to a nv_bfloat16 floating-point +* value in round-down mode. +* \param[in] i - unsigned short int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ushort2bfloat16_rd(const unsigned short int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned short integer to a nv_bfloat16 in round-up mode. +* +* \details Convert the unsigned short integer value \p i to a nv_bfloat16 floating-point +* value in round-up mode. +* \param[in] i - unsigned short int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ushort2bfloat16_ru(const unsigned short int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned 64-bit integer in round-to-nearest-even +* mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned 64-bit +* integer in round-to-nearest-even mode. NaN inputs return 0x8000000000000000. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned long long int +* - \p h converted to an unsigned 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ unsigned long long int __bfloat162ull_rn(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned 64-bit integer in round-towards-zero +* mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned 64-bit +* integer in round-towards-zero mode. NaN inputs return 0x8000000000000000. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned long long int +* - \p h converted to an unsigned 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned long long int __bfloat162ull_rz(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Vector function, combines two \p nv_bfloat16 numbers into one \p nv_bfloat162 number. +* +* \details Combines two input \p nv_bfloat16 number \p x and \p y into one \p nv_bfloat162 number. +* Input \p x is stored in low 16 bits of the return value, input \p y is stored +* in high 16 bits of the return value. +* \param[in] x - nv_bfloat16. Is only being read. +* \param[in] y - nv_bfloat16. Is only being read. +* +* \returns __nv_bfloat162 +* - The \p __nv_bfloat162 vector with one half equal to \p x and the other to \p y. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 make_bfloat162(const __nv_bfloat16 x, const __nv_bfloat16 y); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned 64-bit integer in round-down mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned 64-bit +* integer in round-down mode. NaN inputs return 0x8000000000000000. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned long long int +* - \p h converted to an unsigned 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ unsigned long long int __bfloat162ull_rd(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to an unsigned 64-bit integer in round-up mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to an unsigned 64-bit +* integer in round-up mode. NaN inputs return 0x8000000000000000. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned long long int +* - \p h converted to an unsigned 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ unsigned long long int __bfloat162ull_ru(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned 64-bit integer to a nv_bfloat16 in round-to-nearest-even +* mode. +* +* \details Convert the unsigned 64-bit integer value \p i to a nv_bfloat16 floating-point +* value in round-to-nearest-even mode. +* \param[in] i - unsigned long long int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __ull2bfloat16_rn(const unsigned long long int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned 64-bit integer to a nv_bfloat16 in round-towards-zero +* mode. +* +* \details Convert the unsigned 64-bit integer value \p i to a nv_bfloat16 floating-point +* value in round-towards-zero mode. +* \param[in] i - unsigned long long int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ull2bfloat16_rz(const unsigned long long int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned 64-bit integer to a nv_bfloat16 in round-down mode. +* +* \details Convert the unsigned 64-bit integer value \p i to a nv_bfloat16 floating-point +* value in round-down mode. +* \param[in] i - unsigned long long int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ull2bfloat16_rd(const unsigned long long int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert an unsigned 64-bit integer to a nv_bfloat16 in round-up mode. +* +* \details Convert the unsigned 64-bit integer value \p i to a nv_bfloat16 floating-point +* value in round-up mode. +* \param[in] i - unsigned long long int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ull2bfloat16_ru(const unsigned long long int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed 64-bit integer in round-to-nearest-even +* mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed 64-bit +* integer in round-to-nearest-even mode. NaN inputs return a long long int with hex value of 0x8000000000000000. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns long long int +* - \p h converted to a signed 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ long long int __bfloat162ll_rn(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed 64-bit integer in round-towards-zero mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed 64-bit +* integer in round-towards-zero mode. NaN inputs return a long long int with hex value of 0x8000000000000000. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns long long int +* - \p h converted to a signed 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ long long int __bfloat162ll_rz(const __nv_bfloat16 h); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed 64-bit integer in round-down mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed 64-bit +* integer in round-down mode. NaN inputs return a long long int with hex value of 0x8000000000000000. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns long long int +* - \p h converted to a signed 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ long long int __bfloat162ll_rd(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a nv_bfloat16 to a signed 64-bit integer in round-up mode. +* +* \details Convert the nv_bfloat16 floating-point value \p h to a signed 64-bit +* integer in round-up mode. NaN inputs return a long long int with hex value of 0x8000000000000000. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns long long int +* - \p h converted to a signed 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ long long int __bfloat162ll_ru(const __nv_bfloat16 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed 64-bit integer to a nv_bfloat16 in round-to-nearest-even +* mode. +* +* \details Convert the signed 64-bit integer value \p i to a nv_bfloat16 floating-point +* value in round-to-nearest-even mode. +* \param[in] i - long long int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __ll2bfloat16_rn(const long long int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed 64-bit integer to a nv_bfloat16 in round-towards-zero mode. +* +* \details Convert the signed 64-bit integer value \p i to a nv_bfloat16 floating-point +* value in round-towards-zero mode. +* \param[in] i - long long int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ll2bfloat16_rz(const long long int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed 64-bit integer to a nv_bfloat16 in round-down mode. +* +* \details Convert the signed 64-bit integer value \p i to a nv_bfloat16 floating-point +* value in round-down mode. +* \param[in] i - long long int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ll2bfloat16_rd(const long long int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Convert a signed 64-bit integer to a nv_bfloat16 in round-up mode. +* +* \details Convert the signed 64-bit integer value \p i to a nv_bfloat16 floating-point +* value in round-up mode. +* \param[in] i - long long int. Is only being read. +* +* \returns nv_bfloat16 +* - \p i converted to nv_bfloat16. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ll2bfloat16_ru(const long long int i); + +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Truncate input argument to the integral part. +* +* \details Round \p h to the nearest integer value that does not exceed \p h in +* magnitude. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The truncated integer value. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 htrunc(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculate ceiling of the input argument. +* +* \details Compute the smallest integer value not less than \p h. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The smallest integer value not less than \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hceil(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculate the largest integer less than or equal to \p h. +* +* \details Calculate the largest integer value which is less than or equal to \p h. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The largest integer value which is less than or equal to \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hfloor(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Round input to nearest integer value in nv_bfloat16 floating-point +* number. +* +* \details Round \p h to the nearest integer value in nv_bfloat16 floating-point +* format, with bfloat16way cases rounded to the nearest even integer value. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The nearest integer to \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hrint(const __nv_bfloat16 h); + +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Truncate \p nv_bfloat162 vector input argument to the integral part. +* +* \details Round each component of vector \p h to the nearest integer value that does +* not exceed \p h in magnitude. +* \param[in] h - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The truncated \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2trunc(const __nv_bfloat162 h); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculate \p nv_bfloat162 vector ceiling of the input argument. +* +* \details For each component of vector \p h compute the smallest integer value not less +* than \p h. +* \param[in] h - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector of smallest integers not less than \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2ceil(const __nv_bfloat162 h); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculate the largest integer less than or equal to \p h. +* +* \details For each component of vector \p h calculate the largest integer value which +* is less than or equal to \p h. +* \param[in] h - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector of largest integers which is less than or equal to \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2floor(const __nv_bfloat162 h); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Round input to nearest integer value in nv_bfloat16 floating-point +* number. +* +* \details Round each component of \p nv_bfloat162 vector \p h to the nearest integer value in +* nv_bfloat16 floating-point format, with bfloat16way cases rounded to the +* nearest even integer value. +* \param[in] h - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector of rounded integer values. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2rint(const __nv_bfloat162 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Returns \p nv_bfloat162 with both halves equal to the input value. +* +* \details Returns \p nv_bfloat162 number with both halves equal to the input \p a \p nv_bfloat16 +* number. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat162 +* - The vector which has both its halves equal to the input \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __bfloat162bfloat162(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Swaps both halves of the \p nv_bfloat162 input. +* +* \details Swaps both halves of the \p nv_bfloat162 input and returns a new \p nv_bfloat162 number +* with swapped halves. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - \p a with its halves being swapped. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __lowhigh2highlow(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Extracts low 16 bits from each of the two \p nv_bfloat162 inputs and combines +* into one \p nv_bfloat162 number. +* +* \details Extracts low 16 bits from each of the two \p nv_bfloat162 inputs and combines into +* one \p nv_bfloat162 number. Low 16 bits from input \p a is stored in low 16 bits of +* the return value, low 16 bits from input \p b is stored in high 16 bits of +* the return value. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The low 16 bits of \p a and of \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __lows2bfloat162(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Extracts high 16 bits from each of the two \p nv_bfloat162 inputs and +* combines into one \p nv_bfloat162 number. +* +* \details Extracts high 16 bits from each of the two \p nv_bfloat162 inputs and combines into +* one \p nv_bfloat162 number. High 16 bits from input \p a is stored in low 16 bits of +* the return value, high 16 bits from input \p b is stored in high 16 bits of +* the return value. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The high 16 bits of \p a and of \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __highs2bfloat162(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Returns high 16 bits of \p nv_bfloat162 input. +* +* \details Returns high 16 bits of \p nv_bfloat162 input \p a. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat16 +* - The high 16 bits of the input. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __high2bfloat16(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Returns low 16 bits of \p nv_bfloat162 input. +* +* \details Returns low 16 bits of \p nv_bfloat162 input \p a. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat16 +* - Returns \p nv_bfloat16 which contains low 16 bits of the input \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __low2bfloat16(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Checks if the input \p nv_bfloat16 number is infinite. +* +* \details Checks if the input \p nv_bfloat16 number \p a is infinite. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns int +* - -1 iff \p a is equal to negative infinity, +* - 1 iff \p a is equal to positive infinity, +* - 0 otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ int __hisinf(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Combines two \p nv_bfloat16 numbers into one \p nv_bfloat162 number. +* +* \details Combines two input \p nv_bfloat16 number \p a and \p b into one \p nv_bfloat162 number. +* Input \p a is stored in low 16 bits of the return value, input \p b is stored +* in high 16 bits of the return value. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat162 +* - The nv_bfloat162 with one nv_bfloat16 equal to \p a and the other to \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __halves2bfloat162(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Extracts low 16 bits from \p nv_bfloat162 input. +* +* \details Extracts low 16 bits from \p nv_bfloat162 input \p a and returns a new \p nv_bfloat162 +* number which has both halves equal to the extracted bits. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The nv_bfloat162 with both halves equal to the low 16 bits of the input. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __low2bfloat162(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Extracts high 16 bits from \p nv_bfloat162 input. +* +* \details Extracts high 16 bits from \p nv_bfloat162 input \p a and returns a new \p nv_bfloat162 +* number which has both halves equal to the extracted bits. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The nv_bfloat162 with both halves equal to the high 16 bits of the input. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __high2bfloat162(const __nv_bfloat162 a); + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Reinterprets bits in a \p nv_bfloat16 as a signed short integer. +* +* \details Reinterprets the bits in the nv_bfloat16 floating-point number \p h +* as a signed short integer. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns short int +* - The reinterpreted value. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ short int __bfloat16_as_short(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Reinterprets bits in a \p nv_bfloat16 as an unsigned short integer. +* +* \details Reinterprets the bits in the nv_bfloat16 floating-point \p h +* as an unsigned short number. +* \param[in] h - nv_bfloat16. Is only being read. +* +* \returns unsigned short int +* - The reinterpreted value. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned short int __bfloat16_as_ushort(const __nv_bfloat16 h); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Reinterprets bits in a signed short integer as a \p nv_bfloat16. +* +* \details Reinterprets the bits in the signed short integer \p i as a +* nv_bfloat16 floating-point number. +* \param[in] i - short int. Is only being read. +* +* \returns nv_bfloat16 +* - The reinterpreted value. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __short_as_bfloat16(const short int i); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Reinterprets bits in an unsigned short integer as a \p nv_bfloat16. +* +* \details Reinterprets the bits in the unsigned short integer \p i as a +* nv_bfloat16 floating-point number. +* \param[in] i - unsigned short int. Is only being read. +* +* \returns nv_bfloat16 +* - The reinterpreted value. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __ushort_as_bfloat16(const unsigned short int i); + +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 300))) || defined(_NVHPC_CUDA) + +#if !defined warpSize && !defined __local_warpSize +#define warpSize 32 +#define __local_warpSize +#endif + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Exchange a variable between threads within a warp. Direct copy from indexed thread. +* +* \details Returns the value of var held by the thread whose ID is given by delta. +* If width is less than warpSize then each subsection of the warp behaves as a separate +* entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], +* the value returned corresponds to the value of var held by the delta modulo width (i.e. +* within the same subsection). width must have a value which is a power of 2; +* results are undefined if width is not a power of 2, or is a number greater than +* warpSize. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - nv_bfloat162. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 4-byte word referenced by var from the source thread ID as nv_bfloat162. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __shfl_sync(const unsigned mask, const __nv_bfloat162 var, const int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller. +* +* \details Calculates a source thread ID by subtracting delta from the caller's lane ID. +* The value of var held by the resulting lane ID is returned: in effect, var is shifted up +* the warp by delta threads. If width is less than warpSize then each subsection of the warp +* behaves as a separate entity with a starting logical thread ID of 0. The source thread index +* will not wrap around the value of width, so effectively the lower delta threads will be unchanged. +* width must have a value which is a power of 2; results are undefined if width is not a power of 2, +* or is a number greater than warpSize. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - nv_bfloat162. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 4-byte word referenced by var from the source thread ID as nv_bfloat162. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __shfl_up_sync(const unsigned mask, const __nv_bfloat162 var, const unsigned int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller. +* +* \details Calculates a source thread ID by adding delta to the caller's thread ID. +* The value of var held by the resulting thread ID is returned: this has the effect +* of shifting var down the warp by delta threads. If width is less than warpSize then +* each subsection of the warp behaves as a separate entity with a starting logical +* thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread +* will not wrap around the value of width and so the upper delta threads +* will remain unchanged. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - nv_bfloat162. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 4-byte word referenced by var from the source thread ID as nv_bfloat162. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __shfl_down_sync(const unsigned mask, const __nv_bfloat162 var, const unsigned int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID. +* +* \details Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: +* the value of var held by the resulting thread ID is returned. If width is less than warpSize then each +* group of width consecutive threads are able to access elements from earlier groups of threads, +* however if they attempt to access elements from later groups of threads their own value of var +* will be returned. This mode implements a butterfly addressing pattern such as is used in tree +* reduction and broadcast. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - nv_bfloat162. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 4-byte word referenced by var from the source thread ID as nv_bfloat162. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __shfl_xor_sync(const unsigned mask, const __nv_bfloat162 var, const int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Exchange a variable between threads within a warp. Direct copy from indexed thread. +* +* \details Returns the value of var held by the thread whose ID is given by delta. +* If width is less than warpSize then each subsection of the warp behaves as a separate +* entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], +* the value returned corresponds to the value of var held by the delta modulo width (i.e. +* within the same subsection). width must have a value which is a power of 2; +* results are undefined if width is not a power of 2, or is a number greater than +* warpSize. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - nv_bfloat16. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 2-byte word referenced by var from the source thread ID as nv_bfloat16. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __shfl_sync(const unsigned mask, const __nv_bfloat16 var, const int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller. +* \details Calculates a source thread ID by subtracting delta from the caller's lane ID. +* The value of var held by the resulting lane ID is returned: in effect, var is shifted up +* the warp by delta threads. If width is less than warpSize then each subsection of the warp +* behaves as a separate entity with a starting logical thread ID of 0. The source thread index +* will not wrap around the value of width, so effectively the lower delta threads will be unchanged. +* width must have a value which is a power of 2; results are undefined if width is not a power of 2, +* or is a number greater than warpSize. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - nv_bfloat16. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 2-byte word referenced by var from the source thread ID as nv_bfloat16. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __shfl_up_sync(const unsigned mask, const __nv_bfloat16 var, const unsigned int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller. +* +* \details Calculates a source thread ID by adding delta to the caller's thread ID. +* The value of var held by the resulting thread ID is returned: this has the effect +* of shifting var down the warp by delta threads. If width is less than warpSize then +* each subsection of the warp behaves as a separate entity with a starting logical +* thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread +* will not wrap around the value of width and so the upper delta threads +* will remain unchanged. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - nv_bfloat16. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 2-byte word referenced by var from the source thread ID as nv_bfloat16. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __shfl_down_sync(const unsigned mask, const __nv_bfloat16 var, const unsigned int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID. +* +* \details Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: +* the value of var held by the resulting thread ID is returned. If width is less than warpSize then each +* group of width consecutive threads are able to access elements from earlier groups of threads, +* however if they attempt to access elements from later groups of threads their own value of var +* will be returned. This mode implements a butterfly addressing pattern such as is used in tree +* reduction and broadcast. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - nv_bfloat16. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 2-byte word referenced by var from the source thread ID as nv_bfloat16. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __shfl_xor_sync(const unsigned mask, const __nv_bfloat16 var, const int delta, const int width = warpSize); +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 300))) || defined(_NVHPC_CUDA) */ + +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 320))) || defined(_NVHPC_CUDA) +#if defined(__local_warpSize) +#undef warpSize +#undef __local_warpSize +#endif + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.nc` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __ldg(const __nv_bfloat162 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.nc` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ldg(const __nv_bfloat16 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.cg` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __ldcg(const __nv_bfloat162 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.cg` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ldcg(const __nv_bfloat16 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.ca` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __ldca(const __nv_bfloat162 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.ca` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ldca(const __nv_bfloat16 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.cs` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __ldcs(const __nv_bfloat162 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.cs` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ldcs(const __nv_bfloat16 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.lu` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __ldlu(const __nv_bfloat162 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.lu` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ldlu(const __nv_bfloat16 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.cv` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __ldcv(const __nv_bfloat162 *const ptr); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `ld.global.cv` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __ldcv(const __nv_bfloat16 *const ptr); + +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `st.global.wb` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_BF16_DECL__ void __stwb(__nv_bfloat162 *const ptr, const __nv_bfloat162 value); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `st.global.wb` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_BF16_DECL__ void __stwb(__nv_bfloat16 *const ptr, const __nv_bfloat16 value); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `st.global.cg` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_BF16_DECL__ void __stcg(__nv_bfloat162 *const ptr, const __nv_bfloat162 value); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `st.global.cg` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_BF16_DECL__ void __stcg(__nv_bfloat16 *const ptr, const __nv_bfloat16 value); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `st.global.cs` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_BF16_DECL__ void __stcs(__nv_bfloat162 *const ptr, const __nv_bfloat162 value); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `st.global.cs` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_BF16_DECL__ void __stcs(__nv_bfloat16 *const ptr, const __nv_bfloat16 value); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `st.global.wt` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_BF16_DECL__ void __stwt(__nv_bfloat162 *const ptr, const __nv_bfloat162 value); +/** +* \ingroup CUDA_MATH__BFLOAT16_MISC +* \brief Generates a `st.global.wt` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_BF16_DECL__ void __stwt(__nv_bfloat16 *const ptr, const __nv_bfloat16 value); + +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 320))) || defined(_NVHPC_CUDA) */ + +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs nv_bfloat162 vector if-equal comparison. +* +* \details Performs \p nv_bfloat162 vector if-equal comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector result of if-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __heq2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector not-equal comparison. +* +* \details Performs \p nv_bfloat162 vector not-equal comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector result of not-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hne2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector less-equal comparison. +* +* \details Performs \p nv_bfloat162 vector less-equal comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The \p nv_bfloat162 result of less-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hle2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector greater-equal comparison. +* +* \details Performs \p nv_bfloat162 vector greater-equal comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector result of greater-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hge2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector less-than comparison. +* +* \details Performs \p nv_bfloat162 vector less-than comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The nv_bfloat162 vector result of less-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hlt2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector greater-than comparison. +* +* \details Performs \p nv_bfloat162 vector greater-than comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector result of greater-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hgt2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered if-equal comparison. +* +* \details Performs \p nv_bfloat162 vector if-equal comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector result of unordered if-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hequ2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered not-equal comparison. +* +* \details Performs \p nv_bfloat162 vector not-equal comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector result of unordered not-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hneu2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered less-equal comparison. +* +* Performs \p nv_bfloat162 vector less-equal comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector result of unordered less-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hleu2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered greater-equal comparison. +* +* \details Performs \p nv_bfloat162 vector greater-equal comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The \p nv_bfloat162 vector result of unordered greater-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hgeu2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered less-than comparison. +* +* \details Performs \p nv_bfloat162 vector less-than comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The vector result of unordered less-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hltu2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered greater-than comparison. +* +* \details Performs \p nv_bfloat162 vector greater-than comparison of inputs \p a and \p b. +* The corresponding \p nv_bfloat16 results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The \p nv_bfloat162 vector result of unordered greater-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hgtu2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs nv_bfloat162 vector if-equal comparison. +* +* \details Performs \p nv_bfloat162 vector if-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of if-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __heq2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector not-equal comparison. +* +* \details Performs \p nv_bfloat162 vector not-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of not-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hne2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector less-equal comparison. +* +* \details Performs \p nv_bfloat162 vector less-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of less-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hle2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector greater-equal comparison. +* +* \details Performs \p nv_bfloat162 vector greater-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of greater-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hge2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector less-than comparison. +* +* \details Performs \p nv_bfloat162 vector less-than comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of less-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hlt2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector greater-than comparison. +* +* \details Performs \p nv_bfloat162 vector greater-than comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of greater-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hgt2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered if-equal comparison. +* +* \details Performs \p nv_bfloat162 vector if-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered if-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hequ2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered not-equal comparison. +* +* \details Performs \p nv_bfloat162 vector not-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered not-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hneu2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered less-equal comparison. +* +* Performs \p nv_bfloat162 vector less-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered less-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hleu2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered greater-equal comparison. +* +* \details Performs \p nv_bfloat162 vector greater-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered greater-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hgeu2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered less-than comparison. +* +* \details Performs \p nv_bfloat162 vector less-than comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered less-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hltu2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered greater-than comparison. +* +* \details Performs \p nv_bfloat162 vector greater-than comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered greater-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hgtu2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Determine whether \p nv_bfloat162 argument is a NaN. +* +* \details Determine whether each nv_bfloat16 of input \p nv_bfloat162 number \p a is a NaN. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The nv_bfloat162 with the corresponding \p nv_bfloat16 results set to +* 1.0 for NaN, 0.0 otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hisnan2(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector addition in round-to-nearest-even mode. +* +* \details Performs \p nv_bfloat162 vector add of inputs \p a and \p b, in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-95 +* \endinternal +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The sum of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hadd2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector subtraction in round-to-nearest-even mode. +* +* \details Subtracts \p nv_bfloat162 input vector \p b from input vector \p a in +* round-to-nearest-even mode. +* \internal +* \req DEEPLEARN-SRM_REQ-104 +* \endinternal +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The subtraction of vector \p b from \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hsub2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector multiplication in round-to-nearest-even mode. +* +* \details Performs \p nv_bfloat162 vector multiplication of inputs \p a and \p b, in +* round-to-nearest-even mode. +* \internal +* \req DEEPLEARN-SRM_REQ-102 +* \endinternal +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of elementwise multiplying the vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmul2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector addition in round-to-nearest-even mode. +* +* \details Performs \p nv_bfloat162 vector add of inputs \p a and \p b, in round-to-nearest-even +* mode. Prevents floating-point contractions of mul+add into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-95 +* \endinternal +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The sum of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hadd2_rn(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector subtraction in round-to-nearest-even mode. +* +* \details Subtracts \p nv_bfloat162 input vector \p b from input vector \p a in +* round-to-nearest-even mode. Prevents floating-point contractions of mul+sub into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-104 +* \endinternal +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The subtraction of vector \p b from \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hsub2_rn(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector multiplication in round-to-nearest-even mode. +* +* \details Performs \p nv_bfloat162 vector multiplication of inputs \p a and \p b, in +* round-to-nearest-even mode. Prevents floating-point contractions of mul+add +* or sub into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-102 +* \endinternal +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of elementwise multiplying the vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmul2_rn(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector division in round-to-nearest-even mode. +* +* \details Divides \p nv_bfloat162 input vector \p a by input vector \p b in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-103 +* \endinternal +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The elementwise division of \p a with \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __h2div(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Calculates the absolute value of both halves of the input \p nv_bfloat162 number and +* returns the result. +* +* \details Calculates the absolute value of both halves of the input \p nv_bfloat162 number and +* returns the result. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns bfloat2 +* - Returns \p a with the absolute value of both halves. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __habs2(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector addition in round-to-nearest-even mode, with +* saturation to [0.0, 1.0]. +* +* \details Performs \p nv_bfloat162 vector add of inputs \p a and \p b, in round-to-nearest-even +* mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +* +0.0. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The sum of \p a and \p b, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hadd2_sat(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector subtraction in round-to-nearest-even mode, +* with saturation to [0.0, 1.0]. +* +* \details Subtracts \p nv_bfloat162 input vector \p b from input vector \p a in +* round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN +* results are flushed to +0.0. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The subtraction of vector \p b from \p a, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hsub2_sat(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector multiplication in round-to-nearest-even mode, +* with saturation to [0.0, 1.0]. +* +* \details Performs \p nv_bfloat162 vector multiplication of inputs \p a and \p b, in +* round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN +* results are flushed to +0.0. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of elementwise multiplication of vectors \p a and \p b, +* with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmul2_sat(const __nv_bfloat162 a, const __nv_bfloat162 b); +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector fused multiply-add in round-to-nearest-even +* mode. +* +* \details Performs \p nv_bfloat162 vector multiply on inputs \p a and \p b, +* then performs a \p nv_bfloat162 vector add of the result with \p c, +* rounding the result once in round-to-nearest-even mode. +* \internal +* \req DEEPLEARN-SRM_REQ-105 +* \endinternal +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* \param[in] c - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of elementwise fused multiply-add operation on vectors \p a, \p b, and \p c. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __hfma2(const __nv_bfloat162 a, const __nv_bfloat162 b, const __nv_bfloat162 c); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector fused multiply-add in round-to-nearest-even +* mode, with saturation to [0.0, 1.0]. +* +* \details Performs \p nv_bfloat162 vector multiply on inputs \p a and \p b, +* then performs a \p nv_bfloat162 vector add of the result with \p c, +* rounding the result once in round-to-nearest-even mode, and clamps the +* results to range [0.0, 1.0]. NaN results are flushed to +0.0. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* \param[in] c - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of elementwise fused multiply-add operation on vectors \p a, \p b, and \p c, +* with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __hfma2_sat(const __nv_bfloat162 a, const __nv_bfloat162 b, const __nv_bfloat162 c); +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Negates both halves of the input \p nv_bfloat162 number and returns the +* result. +* +* \details Negates both halves of the input \p nv_bfloat162 number \p a and returns the result. +* \internal +* \req DEEPLEARN-SRM_REQ-101 +* \endinternal +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - Returns \p a with both halves negated. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hneg2(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Calculates the absolute value of input \p nv_bfloat16 number and returns the result. +* +* \details Calculates the absolute value of input \p nv_bfloat16 number and returns the result. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The absolute value of a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __habs(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 addition in round-to-nearest-even mode. +* +* \details Performs \p nv_bfloat16 addition of inputs \p a and \p b, in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-94 +* \endinternal +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The sum of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hadd(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 subtraction in round-to-nearest-even mode. +* +* \details Subtracts \p nv_bfloat16 input \p b from input \p a in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-97 +* \endinternal +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The result of subtracting \p b from \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hsub(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 multiplication in round-to-nearest-even mode. +* +* \details Performs \p nv_bfloat16 multiplication of inputs \p a and \p b, in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-99 +* \endinternal +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The result of multiplying \p a and \p b. +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmul(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 addition in round-to-nearest-even mode. +* +* \details Performs \p nv_bfloat16 addition of inputs \p a and \p b, in round-to-nearest-even +* mode. Prevents floating-point contractions of mul+add into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-94 +* \endinternal +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The sum of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hadd_rn(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 subtraction in round-to-nearest-even mode. +* +* \details Subtracts \p nv_bfloat16 input \p b from input \p a in round-to-nearest-even +* mode. Prevents floating-point contractions of mul+sub into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-97 +* \endinternal +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The result of subtracting \p b from \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hsub_rn(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 multiplication in round-to-nearest-even mode. +* +* \details Performs \p nv_bfloat16 multiplication of inputs \p a and \p b, in round-to-nearest-even +* mode. Prevents floating-point contractions of mul+add or sub into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-99 +* \endinternal +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The result of multiplying \p a and \p b. +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmul_rn(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 division in round-to-nearest-even mode. +* +* \details Divides \p nv_bfloat16 input \p a by input \p b in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-98 +* \endinternal +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The result of dividing \p a by \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hdiv(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 addition in round-to-nearest-even mode, with +* saturation to [0.0, 1.0]. +* +* \details Performs \p nv_bfloat16 add of inputs \p a and \p b, in round-to-nearest-even mode, +* and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The sum of \p a and \p b, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hadd_sat(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 subtraction in round-to-nearest-even mode, with +* saturation to [0.0, 1.0]. +* +* \details Subtracts \p nv_bfloat16 input \p b from input \p a in round-to-nearest-even +* mode, +* and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The result of subtraction of \p b from \p a, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hsub_sat(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 multiplication in round-to-nearest-even mode, with +* saturation to [0.0, 1.0]. +* +* \details Performs \p nv_bfloat16 multiplication of inputs \p a and \p b, in round-to-nearest-even +* mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +* +0.0. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The result of multiplying \p a and \p b, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmul_sat(const __nv_bfloat16 a, const __nv_bfloat16 b); +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 fused multiply-add in round-to-nearest-even mode. +* +* \details Performs \p nv_bfloat16 multiply on inputs \p a and \p b, +* then performs a \p nv_bfloat16 add of the result with \p c, +* rounding the result once in round-to-nearest-even mode. +* \internal +* \req DEEPLEARN-SRM_REQ-96 +* \endinternal +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* \param[in] c - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The result of fused multiply-add operation on \p +* a, \p b, and \p c. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __hfma(const __nv_bfloat16 a, const __nv_bfloat16 b, const __nv_bfloat16 c); +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 fused multiply-add in round-to-nearest-even mode, +* with saturation to [0.0, 1.0]. +* +* \details Performs \p nv_bfloat16 multiply on inputs \p a and \p b, +* then performs a \p nv_bfloat16 add of the result with \p c, +* rounding the result once in round-to-nearest-even mode, and clamps the result +* to range [0.0, 1.0]. NaN results are flushed to +0.0. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* \param[in] c - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The result of fused multiply-add operation on \p +* a, \p b, and \p c, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __hfma_sat(const __nv_bfloat16 a, const __nv_bfloat16 b, const __nv_bfloat16 c); +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Negates input \p nv_bfloat16 number and returns the result. +* +* \details Negates input \p nv_bfloat16 number and returns the result. +* \internal +* \req DEEPLEARN-SRM_REQ-100 +* \endinternal +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - minus a +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hneg(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector if-equal comparison and returns boolean true +* iff both \p nv_bfloat16 results are true, boolean false otherwise. +* +* \details Performs \p nv_bfloat162 vector if-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 if-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of if-equal comparison +* of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbeq2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector not-equal comparison and returns boolean +* true iff both \p nv_bfloat16 results are true, boolean false otherwise. +* +* \details Performs \p nv_bfloat162 vector not-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 not-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of not-equal comparison +* of vectors \p a and \p b are true, +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbne2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector less-equal comparison and returns boolean +* true iff both \p nv_bfloat16 results are true, boolean false otherwise. +* +* \details Performs \p nv_bfloat162 vector less-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 less-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of less-equal comparison +* of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hble2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector greater-equal comparison and returns boolean +* true iff both \p nv_bfloat16 results are true, boolean false otherwise. +* +* \details Performs \p nv_bfloat162 vector greater-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 greater-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of greater-equal +* comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbge2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector less-than comparison and returns boolean +* true iff both \p nv_bfloat16 results are true, boolean false otherwise. +* +* \details Performs \p nv_bfloat162 vector less-than comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 less-than comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of less-than comparison +* of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hblt2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector greater-than comparison and returns boolean +* true iff both \p nv_bfloat16 results are true, boolean false otherwise. +* +* \details Performs \p nv_bfloat162 vector greater-than comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 greater-than comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of greater-than +* comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbgt2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered if-equal comparison and returns +* boolean true iff both \p nv_bfloat16 results are true, boolean false otherwise. +* +* \details Performs \p nv_bfloat162 vector if-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 if-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of unordered if-equal +* comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbequ2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered not-equal comparison and returns +* boolean true iff both \p nv_bfloat16 results are true, boolean false otherwise. +* +* \details Performs \p nv_bfloat162 vector not-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 not-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of unordered not-equal +* comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbneu2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered less-equal comparison and returns +* boolean true iff both \p nv_bfloat16 results are true, boolean false otherwise. +* +* \details Performs \p nv_bfloat162 vector less-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 less-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of unordered less-equal +* comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbleu2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered greater-equal comparison and +* returns boolean true iff both \p nv_bfloat16 results are true, boolean false +* otherwise. +* +* \details Performs \p nv_bfloat162 vector greater-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 greater-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of unordered +* greater-equal comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbgeu2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered less-than comparison and returns +* boolean true iff both \p nv_bfloat16 results are true, boolean false otherwise. +* +* \details Performs \p nv_bfloat162 vector less-than comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 less-than comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of unordered less-than comparison of +* vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbltu2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Performs \p nv_bfloat162 vector unordered greater-than comparison and +* returns boolean true iff both \p nv_bfloat16 results are true, boolean false +* otherwise. +* +* \details Performs \p nv_bfloat162 vector greater-than comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p nv_bfloat16 greater-than comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns bool +* - true if both \p nv_bfloat16 results of unordered +* greater-than comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbgtu2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 if-equal comparison. +* +* \details Performs \p nv_bfloat16 if-equal comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of if-equal comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __heq(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 not-equal comparison. +* +* \details Performs \p nv_bfloat16 not-equal comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of not-equal comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hne(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 less-equal comparison. +* +* \details Performs \p nv_bfloat16 less-equal comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of less-equal comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hle(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 greater-equal comparison. +* +* \details Performs \p nv_bfloat16 greater-equal comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of greater-equal comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hge(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 less-than comparison. +* +* \details Performs \p nv_bfloat16 less-than comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of less-than comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hlt(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 greater-than comparison. +* +* \details Performs \p nv_bfloat16 greater-than comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of greater-than comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hgt(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 unordered if-equal comparison. +* +* \details Performs \p nv_bfloat16 if-equal comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of unordered if-equal comparison of \p a and +* \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hequ(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 unordered not-equal comparison. +* +* \details Performs \p nv_bfloat16 not-equal comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of unordered not-equal comparison of \p a and +* \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hneu(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 unordered less-equal comparison. +* +* \details Performs \p nv_bfloat16 less-equal comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of unordered less-equal comparison of \p a and +* \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hleu(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 unordered greater-equal comparison. +* +* \details Performs \p nv_bfloat16 greater-equal comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of unordered greater-equal comparison of \p a +* and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hgeu(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 unordered less-than comparison. +* +* \details Performs \p nv_bfloat16 less-than comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of unordered less-than comparison of \p a and +* \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hltu(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Performs \p nv_bfloat16 unordered greater-than comparison. +* +* \details Performs \p nv_bfloat16 greater-than comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns bool +* - The boolean result of unordered greater-than comparison of \p a +* and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hgtu(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Determine whether \p nv_bfloat16 argument is a NaN. +* +* \details Determine whether \p nv_bfloat16 value \p a is a NaN. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns bool +* - true iff argument is NaN. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hisnan(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Calculates \p nv_bfloat16 maximum of two input values. +* +* \details Calculates \p nv_bfloat16 max(\p a, \p b) +* defined as (\p a > \p b) ? \p a : \p b. +* - If either of inputs is NaN, the other input is returned. +* - If both inputs are NaNs, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmax(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Calculates \p nv_bfloat16 minimum of two input values. +* +* \details Calculates \p nv_bfloat16 min(\p a, \p b) +* defined as (\p a < \p b) ? \p a : \p b. +* - If either of inputs is NaN, the other input is returned. +* - If both inputs are NaNs, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmin(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Calculates \p nv_bfloat16 maximum of two input values, NaNs pass through. +* +* \details Calculates \p nv_bfloat16 max(\p a, \p b) +* defined as (\p a > \p b) ? \p a : \p b. +* - If either of inputs is NaN, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmax_nan(const __nv_bfloat16 a, const __nv_bfloat16 b); +/** +* \ingroup CUDA_MATH__BFLOAT16_COMPARISON +* \brief Calculates \p nv_bfloat16 minimum of two input values, NaNs pass through. +* +* \details Calculates \p nv_bfloat16 min(\p a, \p b) +* defined as (\p a < \p b) ? \p a : \p b. +* - If either of inputs is NaN, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmin_nan(const __nv_bfloat16 a, const __nv_bfloat16 b); +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Performs \p nv_bfloat16 fused multiply-add in round-to-nearest-even mode with relu saturation. +* +* \details Performs \p nv_bfloat16 multiply on inputs \p a and \p b, +* then performs a \p nv_bfloat16 add of the result with \p c, +* rounding the result once in round-to-nearest-even mode. +* Then negative result is clamped to 0. +* NaN result is converted to canonical NaN. +* \param[in] a - nv_bfloat16. Is only being read. +* \param[in] b - nv_bfloat16. Is only being read. +* \param[in] c - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The result of fused multiply-add operation on \p +* a, \p b, and \p c with relu saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 __hfma_relu(const __nv_bfloat16 a, const __nv_bfloat16 b, const __nv_bfloat16 c); +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Calculates \p nv_bfloat162 vector maximum of two inputs. +* +* \details Calculates \p nv_bfloat162 vector max(\p a, \p b). +* Elementwise \p nv_bfloat16 operation is defined as +* (\p a > \p b) ? \p a : \p b. +* - If either of inputs is NaN, the other input is returned. +* - If both inputs are NaNs, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of elementwise maximum of vectors \p a and \p b +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmax2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Calculates \p nv_bfloat162 vector minimum of two inputs. +* +* \details Calculates \p nv_bfloat162 vector min(\p a, \p b). +* Elementwise \p nv_bfloat16 operation is defined as +* (\p a < \p b) ? \p a : \p b. +* - If either of inputs is NaN, the other input is returned. +* - If both inputs are NaNs, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of elementwise minimum of vectors \p a and \p b +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmin2(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Calculates \p nv_bfloat162 vector maximum of two inputs, NaNs pass through. +* +* \details Calculates \p nv_bfloat162 vector max(\p a, \p b). +* Elementwise \p nv_bfloat16 operation is defined as +* (\p a > \p b) ? \p a : \p b. +* - If either of inputs is NaN, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of elementwise maximum of vectors \p a and \p b, with NaNs pass through +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmax2_nan(const __nv_bfloat162 a, const __nv_bfloat162 b); +/** +* \ingroup CUDA_MATH__BFLOAT162_COMPARISON +* \brief Calculates \p nv_bfloat162 vector minimum of two inputs, NaNs pass through. +* +* \details Calculates \p nv_bfloat162 vector min(\p a, \p b). +* Elementwise \p nv_bfloat16 operation is defined as +* (\p a < \p b) ? \p a : \p b. +* - If either of inputs is NaN, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of elementwise minimum of vectors \p a and \p b, with NaNs pass through +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmin2_nan(const __nv_bfloat162 a, const __nv_bfloat162 b); +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs \p nv_bfloat162 vector fused multiply-add in round-to-nearest-even +* mode with relu saturation. +* +* \details Performs \p nv_bfloat162 vector multiply on inputs \p a and \p b, +* then performs a \p nv_bfloat162 vector add of the result with \p c, +* rounding the result once in round-to-nearest-even mode. +* Then negative result is clamped to 0. +* NaN result is converted to canonical NaN. +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* \param[in] c - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of elementwise fused multiply-add operation on vectors \p a, \p b, and \p c with relu saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __hfma2_relu(const __nv_bfloat162 a, const __nv_bfloat162 b, const __nv_bfloat162 c); +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Performs fast complex multiply-accumulate +* +* \details Interprets vector \p nv_bfloat162 input pairs \p a, \p b, and \p c as +* complex numbers in \p nv_bfloat16 precision and performs +* complex multiply-accumulate operation: a*b + c +* \param[in] a - nv_bfloat162. Is only being read. +* \param[in] b - nv_bfloat162. Is only being read. +* \param[in] c - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The result of complex multiply-accumulate operation on complex numbers \p a, \p b, and \p c +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __hcmadd(const __nv_bfloat162 a, const __nv_bfloat162 b, const __nv_bfloat162 c); +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) */ +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 square root in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat16 square root of input \p a in round-to-nearest-even mode. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The square root of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hsqrt(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 reciprocal square root in round-to-nearest-even +* mode. +* +* \details Calculates \p nv_bfloat16 reciprocal square root of input \p a in round-to-nearest-even +* mode. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The reciprocal square root of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hrsqrt(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 reciprocal in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat16 reciprocal of input \p a in round-to-nearest-even mode. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The reciprocal of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hrcp(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 natural logarithm in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat16 natural logarithm of input \p a in round-to-nearest-even +* mode. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The natural logarithm of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hlog(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 binary logarithm in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat16 binary logarithm of input \p a in round-to-nearest-even +* mode. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The binary logarithm of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hlog2(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 decimal logarithm in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat16 decimal logarithm of input \p a in round-to-nearest-even +* mode. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The decimal logarithm of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hlog10(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 natural exponential function in round-to-nearest-even +* mode. +* +* \details Calculates \p nv_bfloat16 natural exponential function of input \p a in +* round-to-nearest-even mode. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The natural exponential function on \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hexp(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 binary exponential function in round-to-nearest-even +* mode. +* +* \details Calculates \p nv_bfloat16 binary exponential function of input \p a in +* round-to-nearest-even mode. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The binary exponential function on \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hexp2(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 decimal exponential function in round-to-nearest-even +* mode. +* +* \details Calculates \p nv_bfloat16 decimal exponential function of input \p a in +* round-to-nearest-even mode. +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The decimal exponential function on \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hexp10(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 cosine in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat16 cosine of input \p a in round-to-nearest-even mode. +* +* NOTE: this function's implementation calls cosf(float) function and is exposed +* to compiler optimizations. Specifically, \p --use_fast_math flag changes cosf(float) +* into an intrinsic __cosf(float), which has less accurate numeric behavior. +* +* \param[in] a - nv_bfloat16. Is only being read. +* \returns nv_bfloat16 +* - The cosine of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hcos(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT16_FUNCTIONS +* \brief Calculates \p nv_bfloat16 sine in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat16 sine of input \p a in round-to-nearest-even mode. +* +* NOTE: this function's implementation calls sinf(float) function and is exposed +* to compiler optimizations. Specifically, \p --use_fast_math flag changes sinf(float) +* into an intrinsic __sinf(float), which has less accurate numeric behavior. +* +* \param[in] a - nv_bfloat16. Is only being read. +* +* \returns nv_bfloat16 +* - The sine of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 hsin(const __nv_bfloat16 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector square root in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat162 square root of input vector \p a in round-to-nearest-even +* mode. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The elementwise square root on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2sqrt(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector reciprocal square root in round-to-nearest-even +* mode. +* +* \details Calculates \p nv_bfloat162 reciprocal square root of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The elementwise reciprocal square root on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2rsqrt(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector reciprocal in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat162 reciprocal of input vector \p a in round-to-nearest-even +* mode. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The elementwise reciprocal on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2rcp(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector natural logarithm in round-to-nearest-even +* mode. +* +* \details Calculates \p nv_bfloat162 natural logarithm of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The elementwise natural logarithm on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2log(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector binary logarithm in round-to-nearest-even +* mode. +* +* \details Calculates \p nv_bfloat162 binary logarithm of input vector \p a in round-to-nearest-even +* mode. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The elementwise binary logarithm on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2log2(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector decimal logarithm in round-to-nearest-even +* mode. +* +* \details Calculates \p nv_bfloat162 decimal logarithm of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The elementwise decimal logarithm on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2log10(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector exponential function in round-to-nearest-even +* mode. +* +* \details Calculates \p nv_bfloat162 exponential function of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The elementwise exponential function on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2exp(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector binary exponential function in +* round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat162 binary exponential function of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The elementwise binary exponential function on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2exp2(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector decimal exponential function in +* round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat162 decimal exponential function of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - nv_bfloat162. Is only being read. +* +* \returns nv_bfloat162 +* - The elementwise decimal exponential function on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2exp10(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector cosine in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat162 cosine of input vector \p a in round-to-nearest-even +* mode. +* +* NOTE: this function's implementation calls cosf(float) function and is exposed +* to compiler optimizations. Specifically, \p --use_fast_math flag changes cosf(float) +* into an intrinsic __cosf(float), which has less accurate numeric behavior. +* +* \param[in] a - nv_bfloat162. Is only being read. +* \returns nv_bfloat162 +* - The elementwise cosine on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2cos(const __nv_bfloat162 a); +/** +* \ingroup CUDA_MATH__BFLOAT162_FUNCTIONS +* \brief Calculates \p nv_bfloat162 vector sine in round-to-nearest-even mode. +* +* \details Calculates \p nv_bfloat162 sine of input vector \p a in round-to-nearest-even mode. +* +* NOTE: this function's implementation calls sinf(float) function and is exposed +* to compiler optimizations. Specifically, \p --use_fast_math flag changes sinf(float) +* into an intrinsic __sinf(float), which has less accurate numeric behavior. +* +* \param[in] a - nv_bfloat162. Is only being read. +* \returns nv_bfloat162 +* - The elementwise sine on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 h2sin(const __nv_bfloat162 a); + +/** +* \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC +* \brief Vector add \p val to the value stored at \p address in global or shared memory, and writes this +* value back to \p address. The atomicity of the add operation is guaranteed separately for each of the +* two nv_bfloat16 elements; the entire __nv_bfloat162 is not guaranteed to be atomic as a single 32-bit access. +* +* \details The location of \p address must be in global or shared memory. This operation has undefined +* behavior otherwise. This operation is natively supported by devices of compute capability 9.x and higher, +* older devices use emulation path. +* +* \param[in] address - __nv_bfloat162*. An address in global or shared memory. +* \param[in] val - __nv_bfloat162. The value to be added. +* +* \returns __nv_bfloat162 +* - The old value read from \p address. +* +* \note_ref_guide_atomic +*/ +__CUDA_BF16_DECL__ __nv_bfloat162 atomicAdd(__nv_bfloat162 *const address, const __nv_bfloat162 val); + +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 700))) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC +* \brief Adds \p val to the value stored at \p address in global or shared memory, and writes this value +* back to \p address. This operation is performed in one atomic operation. +* +* \details The location of \p address must be in global or shared memory. This operation has undefined +* behavior otherwise. This operation is natively supported by devices of compute capability 9.x and higher, +* older devices of compute capability 7.x and 8.x use emulation path. +* +* \param[in] address - __nv_bfloat16*. An address in global or shared memory. +* \param[in] val - __nv_bfloat16. The value to be added. +* +* \returns __nv_bfloat16 +* - The old value read from \p address. +* +* \note_ref_guide_atomic +*/ +__CUDA_BF16_DECL__ __nv_bfloat16 atomicAdd(__nv_bfloat16 *const address, const __nv_bfloat16 val); +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 700))) || defined(_NVHPC_CUDA) */ + +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +#endif /* defined(__cplusplus) */ + +#if !defined(_MSC_VER) && __cplusplus >= 201103L +# define __CPP_VERSION_AT_LEAST_11_BF16 +#elif _MSC_FULL_VER >= 190024210 && _MSVC_LANG >= 201103L +# define __CPP_VERSION_AT_LEAST_11_BF16 +#endif + +/* C++11 header for std::move. + * In RTC mode, std::move is provided implicitly; don't include the header + */ +#if defined(__CPP_VERSION_AT_LEAST_11_BF16) && !defined(__CUDACC_RTC__) +#include +#endif /* defined(__CPP_VERSION_AT_LEAST_11_BF16) && !defined(__CUDACC_RTC__) */ + +/* C++ header for std::memcpy (used for type punning in host-side implementations). + * When compiling as a CUDA source file memcpy is provided implicitly. + * !defined(__CUDACC__) implies !defined(__CUDACC_RTC__). + */ +#if defined(__cplusplus) && !defined(__CUDACC__) +#include +#endif /* defined(__cplusplus) && !defined(__CUDACC__) */ + +// implicitly provided by NVRTC +#if !defined(__CUDACC_RTC__) +#include +#endif /* !defined(__CUDACC_RTC__) */ + +#if (defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3)))) +#define __CUDA_BF16_INLINE__ +#define __CUDA_BF16_FORCEINLINE__ +#else +#define __CUDA_BF16_INLINE__ inline +#define __CUDA_BF16_FORCEINLINE__ __forceinline__ +#endif /* #if (defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3)))) */ + +/* Set up structure-alignment attribute */ +#if defined(__CUDACC__) +#define __CUDA_ALIGN__(align) __align__(align) +#else +/* Define alignment macro based on compiler type (cannot assume C11 "_Alignas" is available) */ +#if defined(__CPP_VERSION_AT_LEAST_11_BF16) +#define __CUDA_ALIGN__(n) alignas(n) /* C++11 kindly gives us a keyword for this */ +#else /* defined(__CPP_VERSION_AT_LEAST_11_BF16)*/ +#if defined(__GNUC__) +#define __CUDA_ALIGN__(n) __attribute__ ((aligned(n))) +#elif defined(_MSC_VER) +#define __CUDA_ALIGN__(n) __declspec(align(n)) +#else +#define __CUDA_ALIGN__(n) +#endif /* defined(__GNUC__) */ +#endif /* defined(__CPP_VERSION_AT_LEAST_11_BF16) */ +#endif /* defined(__CUDACC__) */ + +// define __CUDA_BF16_CONSTEXPR__ in order to +// use constexpr where possible, with supporting C++ dialects +// undef after use +#if (defined __CPP_VERSION_AT_LEAST_11_BF16) +#define __CUDA_BF16_CONSTEXPR__ constexpr +#else +#define __CUDA_BF16_CONSTEXPR__ +#endif + +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 + * \brief __nv_bfloat16_raw data type + * \details Type allows static initialization of \p nv_bfloat16 until it becomes + * a builtin type. + * + * - Note: this initialization is as a bit-field representation of \p nv_bfloat16, + * and not a conversion from \p short to \p nv_bfloat16. + * Such representation will be deprecated in a future version of CUDA. + * + * - Note: this is visible to non-nvcc compilers, including C-only compilations + */ +typedef struct __CUDA_ALIGN__(2) { + unsigned short x; +} __nv_bfloat16_raw; + +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 + * \brief __nv_bfloat162_raw data type + * \details Type allows static initialization of \p nv_bfloat162 until it becomes + * a builtin type. + * + * - Note: this initialization is as a bit-field representation of \p nv_bfloat162, + * and not a conversion from \p short2 to \p nv_bfloat162. + * Such representation will be deprecated in a future version of CUDA. + * + * - Note: this is visible to non-nvcc compilers, including C-only compilations + */ +typedef struct __CUDA_ALIGN__(4) { + unsigned short x; + unsigned short y; +} __nv_bfloat162_raw; + +/* All other definitions in this file are only visible to C++ compilers */ +#if defined(__cplusplus) + +/* Hide GCC member initialization list warnings because of host/device in-function init requirement */ +#if defined(__GNUC__) +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) */ +#endif /* defined(__GNUC__) */ + +/* class' : multiple assignment operators specified + The class has multiple assignment operators of a single type. This warning is informational */ +#if defined(_MSC_VER) && _MSC_VER >= 1500 +#pragma warning( push ) +#pragma warning( disable:4522 ) +#endif /* defined(__GNUC__) */ + +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 + * \brief nv_bfloat16 datatype + * + * \details This structure implements the datatype for storing + * nv_bfloat16 floating-point numbers. The structure implements + * assignment operators and type conversions. 16 bits are being + * used in total: 1 sign bit, 8 bits for the exponent, and + * the significand is being stored in 7 bits. The total + * precision is 8 bits. + * + */ +struct __CUDA_ALIGN__(2) __nv_bfloat16 { +protected: + /** + * Protected storage variable contains the bits of floating-point data. + */ + unsigned short __x; + +public: + + /** + * Constructor by default. + */ +#if defined(__CPP_VERSION_AT_LEAST_11_BF16) + __nv_bfloat16() = default; +#else + __CUDA_HOSTDEVICE__ __nv_bfloat16() { } +#endif /* defined(__CPP_VERSION_AT_LEAST_11_BF16) */ + + /* Convert to/from __nv_bfloat16_raw */ + /** + * Constructor from \p __nv_bfloat16_raw. + */ + __CUDA_HOSTDEVICE__ __CUDA_BF16_CONSTEXPR__ __nv_bfloat16(const __nv_bfloat16_raw &hr) : __x(hr.x) { } + /** + * Assignment operator from \p __nv_bfloat16_raw. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16 &operator=(const __nv_bfloat16_raw &hr); + /** + * Assignment operator from \p __nv_bfloat16_raw to \p volatile \p __nv_bfloat16. + */ + __CUDA_HOSTDEVICE__ volatile __nv_bfloat16 &operator=(const __nv_bfloat16_raw &hr) volatile; + /** + * Assignment operator from \p volatile \p __nv_bfloat16_raw to \p volatile \p __nv_bfloat16. + */ + __CUDA_HOSTDEVICE__ volatile __nv_bfloat16 &operator=(const volatile __nv_bfloat16_raw &hr) volatile; + /** + * Type cast to \p __nv_bfloat16_raw operator. + */ + __CUDA_HOSTDEVICE__ operator __nv_bfloat16_raw() const; + /** + * Type cast to \p __nv_bfloat16_raw operator with \p volatile input. + */ + __CUDA_HOSTDEVICE__ operator __nv_bfloat16_raw() const volatile; + +#if !defined(__CUDA_NO_BFLOAT16_CONVERSIONS__) +#if defined(__CPP_VERSION_AT_LEAST_11_BF16) + /** + * Construct \p __nv_bfloat16 from \p __half input using default round-to-nearest-even rounding mode. + */ + explicit __CUDA_HOSTDEVICE__ __nv_bfloat16(const __half f) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("{ cvt.rn.bf16.f16 %0, %1;}\n" : "=h"(__x) : "h"(__BFLOAT16_TO_CUS(f))); +, + __x = __float2bfloat16(__half2float(f)).__x; +) +} +#endif /* #if defined(__CPP_VERSION_AT_LEAST_11_BF16) */ + + /* Construct from float/double */ + /** + * Construct \p __nv_bfloat16 from \p float input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16(const float f) { __x = __float2bfloat16(f).__x; } + /** + * Construct \p __nv_bfloat16 from \p double input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16(const double f) { __x = __double2bfloat16(f).__x; } + /** + * Type cast to \p float operator. + */ + __CUDA_HOSTDEVICE__ operator float() const; + /** + * Type cast to \p __nv_bfloat16 assignment operator from \p float input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16 &operator=(const float f); + + /* We omit "cast to double" operator, so as to not be ambiguous about up-cast */ + /** + * Type cast to \p __nv_bfloat16 assignment operator from \p double input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16 &operator=(const double f); + +/* + * Implicit type conversions to/from integer types were only available to nvcc compilation. + * Introducing them for all compilers is a potentially breaking change that may affect + * overloads resolution and will require users to update their code. + * Define __CUDA_BF16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__ to opt-out. + */ +#if !(defined __CUDA_BF16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__) || (defined __CUDACC__) + /* Allow automatic construction from types supported natively in hardware */ + /* Note we do avoid constructor init-list because of special host/device compilation rules */ + + /** + * Construct \p __nv_bfloat16 from \p short integer input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16(short val) { __x = __short2bfloat16_rn(val).__x; } + /** + * Construct \p __nv_bfloat16 from \p unsigned \p short integer input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16(unsigned short val) { __x = __ushort2bfloat16_rn(val).__x; } + /** + * Construct \p __nv_bfloat16 from \p int input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16(int val) { __x = __int2bfloat16_rn(val).__x; } + /** + * Construct \p __nv_bfloat16 from \p unsigned \p int input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16(unsigned int val) { __x = __uint2bfloat16_rn(val).__x; } + /** + * Construct \p __nv_bfloat16 from \p long input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16(const long val) { + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(long) == sizeof(long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + __x = __ll2bfloat16_rn(static_cast(val)).__x; + } else { + __x = __int2bfloat16_rn(static_cast(val)).__x; + } + } + + /** + * Construct \p __nv_bfloat16 from \p unsigned \p long input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16(const unsigned long val) { + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(unsigned long) == sizeof(unsigned long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + __x = __ull2bfloat16_rn(static_cast(val)).__x; + } else { + __x = __uint2bfloat16_rn(static_cast(val)).__x; + } + } + /** + * Construct \p __nv_bfloat16 from \p long \p long input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16(long long val) { __x = __ll2bfloat16_rn(val).__x; } + /** + * Construct \p __nv_bfloat16 from \p unsigned \p long \p long input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16(unsigned long long val) { __x = __ull2bfloat16_rn(val).__x; } + + /* Allow automatic casts to supported builtin types, matching all that are permitted with float */ + + /** + * Conversion operator to \p signed \p char data type. + * Using round-toward-zero rounding mode. + * + * See __bfloat162char_rz(__nv_bfloat16) for further details + */ + __CUDA_HOSTDEVICE__ operator signed char() const; + /** + * Conversion operator to \p unsigned \p char data type. + * Using round-toward-zero rounding mode. + * + * See __bfloat162uchar_rz(__nv_bfloat16) for further details + */ + __CUDA_HOSTDEVICE__ operator unsigned char() const; + /** + * Conversion operator to an implementation defined \p char data type. + * Using round-toward-zero rounding mode. + * + * Detects signedness of the \p char type and proceeds accordingly, see + * further details in signed and unsigned char operators. + */ + __CUDA_HOSTDEVICE__ operator char() const; + /** + * Conversion operator to \p short data type. + * Using round-toward-zero rounding mode. + * + * See __bfloat162short_rz(__nv_bfloat16) for further details + */ + __CUDA_HOSTDEVICE__ operator short() const; + /** + * Conversion operator to \p unsigned \p short data type. + * Using round-toward-zero rounding mode. + * + * See __bfloat162ushort_rz(__nv_bfloat16) for further details + */ + __CUDA_HOSTDEVICE__ operator unsigned short() const; + /** + * Conversion operator to \p int data type. + * Using round-toward-zero rounding mode. + * + * See __bfloat162int_rz(__nv_bfloat16) for further details + */ + __CUDA_HOSTDEVICE__ operator int() const; + /** + * Conversion operator to \p unsigned \p int data type. + * Using round-toward-zero rounding mode. + * + * See __bfloat162uint_rz(__nv_bfloat16) for further details + */ + __CUDA_HOSTDEVICE__ operator unsigned int() const; + /** + * Conversion operator to \p long data type. + * Using round-toward-zero rounding mode. + */ + __CUDA_HOSTDEVICE__ operator long() const; + /** + * Conversion operator to \p unsigned \p long data type. + * Using round-toward-zero rounding mode. + */ + __CUDA_HOSTDEVICE__ operator unsigned long() const; + /** + * Conversion operator to \p long \p long data type. + * Using round-toward-zero rounding mode. + * + * See __bfloat162ll_rz(__nv_bfloat16) for further details + */ + __CUDA_HOSTDEVICE__ operator long long() const; + /** + * Conversion operator to \p unsigned \p long \p long data type. + * Using round-toward-zero rounding mode. + * + * See __bfloat162ull_rz(__nv_bfloat16) for further details + */ + __CUDA_HOSTDEVICE__ operator unsigned long long() const; + /** + * Type cast from \p short assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16 &operator=(short val); + /** + * Type cast from \p unsigned \p short assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16 &operator=(unsigned short val); + /** + * Type cast from \p int assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16 &operator=(int val); + /** + * Type cast from \p unsigned \p int assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16 &operator=(unsigned int val); + /** + * Type cast from \p long \p long assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16 &operator=(long long val); + /** + * Type cast from \p unsigned \p long \p long assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __nv_bfloat16 &operator=(unsigned long long val); + /** + * Conversion operator to \p bool data type. + * +0 and -0 inputs convert to \p false. + * Non-zero inputs convert to \p true. + */ + __CUDA_HOSTDEVICE__ __CUDA_BF16_CONSTEXPR__ operator bool() const { return (__x & 0x7FFFU) != 0U; } +#endif /* !(defined __CUDA_BF16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__) || (defined __CUDACC__) */ +#endif /* !defined(__CUDA_NO_BFLOAT16_CONVERSIONS__) */ +}; + +#if !defined(__CUDA_NO_BFLOAT16_OPERATORS__) +/* Some basic arithmetic operations expected of a builtin */ +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 addition operation. + * See also __hadd(__nv_bfloat16, __nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator+(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 subtraction operation. + * See also __hsub(__nv_bfloat16, __nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator-(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 multiplication operation. + * See also __hmul(__nv_bfloat16, __nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator*(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 division operation. + * See also __hdiv(__nv_bfloat16, __nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator/(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh); + +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 compound assignment with addition operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator+=(__nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 compound assignment with subtraction operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator-=(__nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 compound assignment with multiplication operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator*=(__nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 compound assignment with division operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator/=(__nv_bfloat16 &lh, const __nv_bfloat16 &rh); + +/* Note for increment and decrement we use the raw value 0x3F80U equating to nv_bfloat16(1.0F), to avoid the extra conversion */ +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 prefix increment operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator++(__nv_bfloat16 &h); +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 prefix decrement operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator--(__nv_bfloat16 &h); +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 postfix increment operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator++(__nv_bfloat16 &h, const int ignored); +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Performs \p nv_bfloat16 postfix decrement operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator--(__nv_bfloat16 &h, const int ignored); +/* Unary plus and inverse operators */ +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Implements \p nv_bfloat16 unary plus operator, returns input value. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator+(const __nv_bfloat16 &h); +/** + * \ingroup CUDA_MATH__BFLOAT16_ARITHMETIC + * Implements \p nv_bfloat16 unary minus operator. + * See also __hneg(__nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator-(const __nv_bfloat16 &h); + +/* Some basic comparison operations to make it look like a builtin */ +/** + * \ingroup CUDA_MATH__BFLOAT16_COMPARISON + * Performs \p nv_bfloat16 ordered compare equal operation. + * See also __heq(__nv_bfloat16, __nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator==(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_COMPARISON + * Performs \p nv_bfloat16 unordered compare not-equal operation. + * See also __hneu(__nv_bfloat16, __nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator!=(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_COMPARISON + * Performs \p nv_bfloat16 ordered greater-than compare operation. + * See also __hgt(__nv_bfloat16, __nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator> (const __nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_COMPARISON + * Performs \p nv_bfloat16 ordered less-than compare operation. + * See also __hlt(__nv_bfloat16, __nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator< (const __nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_COMPARISON + * Performs \p nv_bfloat16 ordered greater-or-equal compare operation. + * See also __hge(__nv_bfloat16, __nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator>=(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT16_COMPARISON + * Performs \p nv_bfloat16 ordered less-or-equal compare operation. + * See also __hle(__nv_bfloat16, __nv_bfloat16) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator<=(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh); +#endif /* !defined(__CUDA_NO_BFLOAT16_OPERATORS__) */ + +/** +* \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 + * \brief nv_bfloat162 datatype + * \details This structure implements the datatype for storing two + * nv_bfloat16 floating-point numbers. + * The structure implements assignment, arithmetic and comparison + * operators, and type conversions. + * + * - NOTE: __nv_bfloat162 is visible to non-nvcc host compilers + */ +struct __CUDA_ALIGN__(4) __nv_bfloat162 { + /** + * Storage field holding lower \p __nv_bfloat16 part. + */ + __nv_bfloat16 x; + /** + * Storage field holding upper \p __nv_bfloat16 part. + */ + __nv_bfloat16 y; + + // All construct/copy/assign/move +public: + /** + * Constructor by default. + */ +#if defined(__CPP_VERSION_AT_LEAST_11_BF16) + __nv_bfloat162() = default; + /** + * Move constructor, available for \p C++11 and later dialects + */ + __CUDA_HOSTDEVICE__ __nv_bfloat162(__nv_bfloat162 &&src); + /** + * Move assignment operator, available for \p C++11 and later dialects + */ + __CUDA_HOSTDEVICE__ __nv_bfloat162 &operator=(__nv_bfloat162 &&src); +#else + __CUDA_HOSTDEVICE__ __nv_bfloat162(); +#endif /* defined(__CPP_VERSION_AT_LEAST_11_BF16) */ + + /** + * Constructor from two \p __nv_bfloat16 variables + */ + __CUDA_HOSTDEVICE__ __CUDA_BF16_CONSTEXPR__ __nv_bfloat162(const __nv_bfloat16 &a, const __nv_bfloat16 &b) : x(a), y(b) { } + /** + * Copy constructor + */ + __CUDA_HOSTDEVICE__ __nv_bfloat162(const __nv_bfloat162 &src); + /** + * Copy assignment operator + */ + __CUDA_HOSTDEVICE__ __nv_bfloat162 &operator=(const __nv_bfloat162 &src); + + /* Convert to/from __nv_bfloat162_raw */ + /** + * Constructor from \p __nv_bfloat162_raw + */ + __CUDA_HOSTDEVICE__ __nv_bfloat162(const __nv_bfloat162_raw &h2r ); + /** + * Assignment operator from \p __nv_bfloat162_raw + */ + __CUDA_HOSTDEVICE__ __nv_bfloat162 &operator=(const __nv_bfloat162_raw &h2r); + /** + * Conversion operator to \p __nv_bfloat162_raw + */ + __CUDA_HOSTDEVICE__ operator __nv_bfloat162_raw() const; +}; + +#if !defined(__CUDA_NO_BFLOAT162_OPERATORS__) +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 addition operation. + * See also __hadd2(__nv_bfloat162, __nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator+(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 subtraction operation. + * See also __hsub2(__nv_bfloat162, __nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator-(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 multiplication operation. + * See also __hmul2(__nv_bfloat162, __nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator*(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 division operation. + * See also __h2div(__nv_bfloat162, __nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator/(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 compound assignment with addition operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162& operator+=(__nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 compound assignment with subtraction operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162& operator-=(__nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 compound assignment with multiplication operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162& operator*=(__nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 compound assignment with division operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162& operator/=(__nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 prefix increment operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 &operator++(__nv_bfloat162 &h); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 prefix decrement operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 &operator--(__nv_bfloat162 &h); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 postfix increment operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator++(__nv_bfloat162 &h, const int ignored); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Performs packed \p nv_bfloat16 postfix decrement operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator--(__nv_bfloat162 &h, const int ignored); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Implements packed \p nv_bfloat16 unary plus operator, returns input value. + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator+(const __nv_bfloat162 &h); +/** + * \ingroup CUDA_MATH__BFLOAT162_ARITHMETIC + * Implements packed \p nv_bfloat16 unary minus operator. + * See also __hneg2(__nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator-(const __nv_bfloat162 &h); +/** + * \ingroup CUDA_MATH__BFLOAT162_COMPARISON + * Performs packed \p nv_bfloat16 ordered compare equal operation. + * See also __hbeq2(__nv_bfloat162, __nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator==(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_COMPARISON + * Performs packed \p nv_bfloat16 unordered compare not-equal operation. + * See also __hbneu2(__nv_bfloat162, __nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator!=(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_COMPARISON + * Performs packed \p nv_bfloat16 ordered greater-than compare operation. + * See also __hbgt2(__nv_bfloat162, __nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator>(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_COMPARISON + * Performs packed \p nv_bfloat16 ordered less-than compare operation. + * See also __hblt2(__nv_bfloat162, __nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator<(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_COMPARISON + * Performs packed \p nv_bfloat16 ordered greater-or-equal compare operation. + * See also __hbge2(__nv_bfloat162, __nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator>=(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh); +/** + * \ingroup CUDA_MATH__BFLOAT162_COMPARISON + * Performs packed \p nv_bfloat16 ordered less-or-equal compare operation. + * See also __hble2(__nv_bfloat162, __nv_bfloat162) + */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator<=(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh); + +#endif /* !defined(__CUDA_NO_BFLOAT162_OPERATORS__) */ + +#if defined(__CPP_VERSION_AT_LEAST_11_BF16) +#if !defined(__CUDA_NO_HALF_CONVERSIONS__) +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __half::__half(const __nv_bfloat16 f) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("{ cvt.rn.f16.bf16 %0, %1;}\n" : "=h"(__x) : "h"(__BFLOAT16_TO_CUS(f))); +, + __x = __float2half_rn(__bfloat162float(f)).__x; +) +} +#endif +#endif /* #if defined(__CPP_VERSION_AT_LEAST_11_BF16) */ + +#endif /* defined(__cplusplus) */ + +#if (defined(__FORCE_INCLUDE_CUDA_BF16_HPP_FROM_BF16_H__) || \ + !(defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3))))) +/* Note the .hpp file is included to capture the "nv_bfloat16" & "nv_bfloat162" builtin function definitions. For NVRTC, the builtin + function definitions are compiled at NVRTC library build-time and are available through the NVRTC builtins library at + link time. +*/ +#include "cuda_bf16.hpp" +#endif /* (defined(__FORCE_INCLUDE_CUDA_BF16_HPP_FROM_BF16_H__) || \ + !(defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3))))) */ + +/* Define first-class types "nv_bfloat16" and "nv_bfloat162", unless user specifies otherwise via "#define CUDA_NO_BFLOAT16" */ +/* C cannot ever have these types defined here, because __nv_bfloat16 and __nv_bfloat162 are C++ classes */ +#if defined(__cplusplus) && !defined(CUDA_NO_BFLOAT16) +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 + * \brief This datatype is meant to be the first-class or fundamental + * implementation of the bfloat16 numbers format. + * + * \details Should be implemented in the compiler in the future. + * Current implementation is a simple typedef to a respective + * user-level type with underscores. + */ +typedef __nv_bfloat16 nv_bfloat16; + +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16 + * \brief This datatype is meant to be the first-class or fundamental + * implementation of type for pairs of bfloat16 numbers. + * + * \details Should be implemented in the compiler in the future. + * Current implementation is a simple typedef to a respective + * user-level type with underscores. + */ +typedef __nv_bfloat162 nv_bfloat162; + +#endif /* defined(__cplusplus) && !defined(CUDA_NO_BFLOAT16) */ + +#undef __CUDA_BF16_DECL__ +#undef __CUDA_HOSTDEVICE_BF16_DECL__ +#undef __CUDA_HOSTDEVICE__ +#undef __CUDA_BF16_INLINE__ +#undef __CUDA_BF16_FORCEINLINE__ + +#undef ___CUDA_BF16_STRINGIFY_INNERMOST +#undef __CUDA_BF16_STRINGIFY + +#endif /* end of include guard: __CUDA_BF16_H__ */ diff --git a/cuda_toolkit/include/cuda_bf16.hpp b/cuda_toolkit/include/cuda_bf16.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d0a0bdc28ba71b21dea193336870532c490db108 --- /dev/null +++ b/cuda_toolkit/include/cuda_bf16.hpp @@ -0,0 +1,3791 @@ +/* +* Copyright 1993-2024 NVIDIA Corporation. All rights reserved. +* +* NOTICE TO LICENSEE: +* +* This source code and/or documentation ("Licensed Deliverables") are +* subject to NVIDIA intellectual property rights under U.S. and +* international Copyright laws. +* +* These Licensed Deliverables contained herein is PROPRIETARY and +* CONFIDENTIAL to NVIDIA and is being provided under the terms and +* conditions of a form of NVIDIA software license agreement by and +* between NVIDIA and Licensee ("License Agreement") or electronically +* accepted by Licensee. Notwithstanding any terms or conditions to +* the contrary in the License Agreement, reproduction or disclosure +* of the Licensed Deliverables to any third party without the express +* written consent of NVIDIA is prohibited. +* +* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE +* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE +* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS +* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. +* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED +* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, +* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. +* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE +* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY +* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY +* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +* OF THESE LICENSED DELIVERABLES. +* +* U.S. Government End Users. These Licensed Deliverables are a +* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT +* 1995), consisting of "commercial computer software" and "commercial +* computer software documentation" as such terms are used in 48 +* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government +* only as a commercial end item. Consistent with 48 C.F.R.12.212 and +* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all +* U.S. Government End Users acquire the Licensed Deliverables with +* only those rights set forth herein. +* +* Any use of the Licensed Deliverables in individual and commercial +* software must include, in the user documentation and internal +* comments to the code, the above Disclaimer and U.S. Government End +* Users Notice. +*/ + +#if !defined(__CUDA_BF16_HPP__) +#define __CUDA_BF16_HPP__ + +#if !defined(__CUDA_BF16_H__) +#error "Do not include this file directly. Instead, include cuda_bf16.h." +#endif + +#if !defined(IF_DEVICE_OR_CUDACC) +#if defined(__CUDACC__) + #define IF_DEVICE_OR_CUDACC(d, c, f) NV_IF_ELSE_TARGET(NV_IS_DEVICE, d, c) +#else + #define IF_DEVICE_OR_CUDACC(d, c, f) NV_IF_ELSE_TARGET(NV_IS_DEVICE, d, f) +#endif +#endif + +/* All other definitions in this file are only visible to C++ compilers */ +#if defined(__cplusplus) +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16_CONSTANTS + * \brief Defines floating-point positive infinity value for the \p nv_bfloat16 data type + */ +#define CUDART_INF_BF16 __ushort_as_bfloat16((unsigned short)0x7F80U) +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16_CONSTANTS + * \brief Defines canonical NaN value for the \p nv_bfloat16 data type + */ +#define CUDART_NAN_BF16 __ushort_as_bfloat16((unsigned short)0x7FFFU) +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16_CONSTANTS + * \brief Defines a minimum representable (denormalized) value for the \p nv_bfloat16 data type + */ +#define CUDART_MIN_DENORM_BF16 __ushort_as_bfloat16((unsigned short)0x0001U) +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16_CONSTANTS + * \brief Defines a maximum representable value for the \p nv_bfloat16 data type + */ +#define CUDART_MAX_NORMAL_BF16 __ushort_as_bfloat16((unsigned short)0x7F7FU) +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16_CONSTANTS + * \brief Defines a negative zero value for the \p nv_bfloat16 data type + */ +#define CUDART_NEG_ZERO_BF16 __ushort_as_bfloat16((unsigned short)0x8000U) +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16_CONSTANTS + * \brief Defines a positive zero value for the \p nv_bfloat16 data type + */ +#define CUDART_ZERO_BF16 __ushort_as_bfloat16((unsigned short)0x0000U) +/** + * \ingroup CUDA_MATH_INTRINSIC_BFLOAT16_CONSTANTS + * \brief Defines a value of 1.0 for the \p nv_bfloat16 data type + */ +#define CUDART_ONE_BF16 __ushort_as_bfloat16((unsigned short)0x3F80U) + + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16 &__nv_bfloat16::operator=(const __nv_bfloat16_raw &hr) { __x = hr.x; return *this; } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ volatile __nv_bfloat16 &__nv_bfloat16::operator=(const __nv_bfloat16_raw &hr) volatile { __x = hr.x; return *this; } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ volatile __nv_bfloat16 &__nv_bfloat16::operator=(const volatile __nv_bfloat16_raw &hr) volatile { __x = hr.x; return *this; } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator __nv_bfloat16_raw() const { __nv_bfloat16_raw ret; ret.x = __x; return ret; } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator __nv_bfloat16_raw() const volatile { __nv_bfloat16_raw ret; ret.x = __x; return ret; } + +#if !defined(__CUDA_NO_BFLOAT16_CONVERSIONS__) + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator float() const { return __bfloat162float(*this); } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16 &__nv_bfloat16::operator=(const float f) { __x = __float2bfloat16(f).__x; return *this; } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16 &__nv_bfloat16::operator=(const double f) { __x = __double2bfloat16(f).__x; return *this; } + +/* + * Implicit type conversions to/from integer types were only available to nvcc compilation. + * Introducing them for all compilers is a potentially breaking change that may affect + * overloads resolution and will require users to update their code. + * Define __CUDA_BF16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__ to opt-out. + */ +#if !(defined __CUDA_BF16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__) || (defined __CUDACC__) + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator signed char() const { return __bfloat162char_rz(*this); } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator unsigned char() const { return __bfloat162uchar_rz(*this); } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator char() const { + char value; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (((char)-1) < (char)0) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + value = static_cast(__bfloat162char_rz(*this)); + } + else + { + value = static_cast(__bfloat162uchar_rz(*this)); + } + return value; + } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator short() const { return __bfloat162short_rz(*this); } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator unsigned short() const { return __bfloat162ushort_rz(*this); } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator int() const { return __bfloat162int_rz(*this); } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator unsigned int() const { return __bfloat162uint_rz(*this); } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator long() const { + long retval; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(long) == sizeof(long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + retval = static_cast(__bfloat162ll_rz(*this)); + } + else + { + retval = static_cast(__bfloat162int_rz(*this)); + } + return retval; + } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator unsigned long() const { + unsigned long retval; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(unsigned long) == sizeof(unsigned long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + retval = static_cast(__bfloat162ull_rz(*this)); + } + else + { + retval = static_cast(__bfloat162uint_rz(*this)); + } + return retval; + } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator long long() const { return __bfloat162ll_rz(*this); } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16::operator unsigned long long() const { return __bfloat162ull_rz(*this); } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16 &__nv_bfloat16::operator=(short val) { __x = __short2bfloat16_rn(val).__x; return *this; } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16 &__nv_bfloat16::operator=(unsigned short val) { __x = __ushort2bfloat16_rn(val).__x; return *this; } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16 &__nv_bfloat16::operator=(int val) { __x = __int2bfloat16_rn(val).__x; return *this; } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16 &__nv_bfloat16::operator=(unsigned int val) { __x = __uint2bfloat16_rn(val).__x; return *this; } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16 &__nv_bfloat16::operator=(long long val) { __x = __ll2bfloat16_rn(val).__x; return *this; } + __CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat16 &__nv_bfloat16::operator=(unsigned long long val) { __x = __ull2bfloat16_rn(val).__x; return *this; } +#endif /* !(defined __CUDA_BF16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__) || (defined __CUDACC__) */ +#endif /* !defined(__CUDA_NO_BFLOAT16_CONVERSIONS__) */ + + +#if !defined(__CUDA_NO_BFLOAT16_OPERATORS__) +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator+(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh) { return __hadd(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator-(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh) { return __hsub(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator*(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh) { return __hmul(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator/(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh) { return __hdiv(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator+=(__nv_bfloat16 &lh, const __nv_bfloat16 &rh) { lh = __hadd(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator-=(__nv_bfloat16 &lh, const __nv_bfloat16 &rh) { lh = __hsub(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator*=(__nv_bfloat16 &lh, const __nv_bfloat16 &rh) { lh = __hmul(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator/=(__nv_bfloat16 &lh, const __nv_bfloat16 &rh) { lh = __hdiv(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator++(__nv_bfloat16 &h) { __nv_bfloat16_raw one; one.x = 0x3F80U; h += one; return h; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 &operator--(__nv_bfloat16 &h) { __nv_bfloat16_raw one; one.x = 0x3F80U; h -= one; return h; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator++(__nv_bfloat16 &h, const int ignored) +{ + // ignored on purpose. Parameter only needed to distinguish the function declaration from other types of operators. + static_cast(ignored); + + const __nv_bfloat16 ret = h; + __nv_bfloat16_raw one; + one.x = 0x3F80U; + h += one; + return ret; +} +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator--(__nv_bfloat16 &h, const int ignored) +{ + // ignored on purpose. Parameter only needed to distinguish the function declaration from other types of operators. + static_cast(ignored); + + const __nv_bfloat16 ret = h; + __nv_bfloat16_raw one; + one.x = 0x3F80U; + h -= one; + return ret; +} +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator+(const __nv_bfloat16 &h) { return h; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat16 operator-(const __nv_bfloat16 &h) { return __hneg(h); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator==(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh) { return __heq(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator!=(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh) { return __hneu(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator> (const __nv_bfloat16 &lh, const __nv_bfloat16 &rh) { return __hgt(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator< (const __nv_bfloat16 &lh, const __nv_bfloat16 &rh) { return __hlt(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator>=(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh) { return __hge(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator<=(const __nv_bfloat16 &lh, const __nv_bfloat16 &rh) { return __hle(lh, rh); } +#endif /* !defined(__CUDA_NO_BFLOAT16_OPERATORS__) */ + +#if defined(__CPP_VERSION_AT_LEAST_11_BF16) +__CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat162::__nv_bfloat162(__nv_bfloat162 &&src) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __BFLOAT162_TO_UI(*this) = std::move(__BFLOAT162_TO_CUI(src)); +, + this->x = src.x; + this->y = src.y; +) +} +__CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat162 &__nv_bfloat162::operator=(__nv_bfloat162 &&src) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __BFLOAT162_TO_UI(*this) = std::move(__BFLOAT162_TO_CUI(src)); +, + this->x = src.x; + this->y = src.y; +) + return *this; +} +#else +__CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat162::__nv_bfloat162() { } +#endif /* defined(__CPP_VERSION_AT_LEAST_11_BF16) */ +__CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat162::__nv_bfloat162(const __nv_bfloat162 &src) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __BFLOAT162_TO_UI(*this) = __BFLOAT162_TO_CUI(src); +, + this->x = src.x; + this->y = src.y; +) +} +__CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat162 &__nv_bfloat162::operator=(const __nv_bfloat162 &src) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __BFLOAT162_TO_UI(*this) = __BFLOAT162_TO_CUI(src); +, + this->x = src.x; + this->y = src.y; +) + return *this; +} +__CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat162::__nv_bfloat162(const __nv_bfloat162_raw &h2r ) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __BFLOAT162_TO_UI(*this) = __BFLOAT162_TO_CUI(h2r); +, + __nv_bfloat16_raw tr; + tr.x = h2r.x; + this->x = static_cast<__nv_bfloat16>(tr); + tr.x = h2r.y; + this->y = static_cast<__nv_bfloat16>(tr); +) +} +__CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat162 &__nv_bfloat162::operator=(const __nv_bfloat162_raw &h2r) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __BFLOAT162_TO_UI(*this) = __BFLOAT162_TO_CUI(h2r); +, + __nv_bfloat16_raw tr; + tr.x = h2r.x; + this->x = static_cast<__nv_bfloat16>(tr); + tr.x = h2r.y; + this->y = static_cast<__nv_bfloat16>(tr); +) + return *this; +} +__CUDA_HOSTDEVICE__ __CUDA_BF16_INLINE__ __nv_bfloat162::operator __nv_bfloat162_raw() const { + __nv_bfloat162_raw ret; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + ret.x = 0U; + ret.y = 0U; + __BFLOAT162_TO_UI(ret) = __BFLOAT162_TO_CUI(*this); +, + ret.x = static_cast<__nv_bfloat16_raw>(this->x).x; + ret.y = static_cast<__nv_bfloat16_raw>(this->y).x; +) + return ret; +} + +#if !defined(__CUDA_NO_BFLOAT162_OPERATORS__) +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator+(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh) { return __hadd2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator-(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh) { return __hsub2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator*(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh) { return __hmul2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator/(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh) { return __h2div(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162& operator+=(__nv_bfloat162 &lh, const __nv_bfloat162 &rh) { lh = __hadd2(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162& operator-=(__nv_bfloat162 &lh, const __nv_bfloat162 &rh) { lh = __hsub2(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162& operator*=(__nv_bfloat162 &lh, const __nv_bfloat162 &rh) { lh = __hmul2(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162& operator/=(__nv_bfloat162 &lh, const __nv_bfloat162 &rh) { lh = __h2div(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 &operator++(__nv_bfloat162 &h) { __nv_bfloat162_raw one; one.x = 0x3F80U; one.y = 0x3F80U; h = __hadd2(h, one); return h; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 &operator--(__nv_bfloat162 &h) { __nv_bfloat162_raw one; one.x = 0x3F80U; one.y = 0x3F80U; h = __hsub2(h, one); return h; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator++(__nv_bfloat162 &h, const int ignored) +{ + // ignored on purpose. Parameter only needed to distinguish the function declaration from other types of operators. + static_cast(ignored); + + const __nv_bfloat162 ret = h; + __nv_bfloat162_raw one; + one.x = 0x3F80U; + one.y = 0x3F80U; + h = __hadd2(h, one); + return ret; +} +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator--(__nv_bfloat162 &h, const int ignored) +{ + // ignored on purpose. Parameter only needed to distinguish the function declaration from other types of operators. + static_cast(ignored); + + const __nv_bfloat162 ret = h; + __nv_bfloat162_raw one; + one.x = 0x3F80U; + one.y = 0x3F80U; + h = __hsub2(h, one); + return ret; +} +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator+(const __nv_bfloat162 &h) { return h; } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ __nv_bfloat162 operator-(const __nv_bfloat162 &h) { return __hneg2(h); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator==(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh) { return __hbeq2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator!=(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh) { return __hbneu2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator>(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh) { return __hbgt2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator<(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh) { return __hblt2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator>=(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh) { return __hbge2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_BF16_FORCEINLINE__ bool operator<=(const __nv_bfloat162 &lh, const __nv_bfloat162 &rh) { return __hble2(lh, rh); } +#endif /* !defined(__CUDA_NO_BFLOAT162_OPERATORS__) */ + +/* Restore warning for multiple assignment operators */ +#if defined(_MSC_VER) && _MSC_VER >= 1500 +#pragma warning( pop ) +#endif /* defined(_MSC_VER) && _MSC_VER >= 1500 */ + +/* Restore -Weffc++ warnings from here on */ +#if defined(__GNUC__) +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +#pragma GCC diagnostic pop +#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) */ +#endif /* defined(__GNUC__) */ + +#undef __CUDA_HOSTDEVICE__ +#undef __CUDA_ALIGN__ + +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned int __internal_float_as_uint(const float f) +{ + unsigned int u; +IF_DEVICE_OR_CUDACC( + u = __float_as_uint(f); +, + memcpy(&u, &f, sizeof(f)); +, + std::memcpy(&u, &f, sizeof(f)); +) + return u; +} + +__CUDA_HOSTDEVICE_BF16_DECL__ float __internal_uint_as_float(const unsigned int u) +{ + float f; +IF_DEVICE_OR_CUDACC( + f = __uint_as_float(u); +, + memcpy(&f, &u, sizeof(u)); +, + std::memcpy(&f, &u, sizeof(u)); +) + return f; +} + +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned short __internal_float2bfloat16(const float f, unsigned int &sign, unsigned int &remainder) +{ + unsigned int x; + + x = __internal_float_as_uint(f); + + if ((x & 0x7fffffffU) > 0x7f800000U) { + sign = 0U; + remainder = 0U; + return static_cast(0x7fffU); + } + sign = x >> 31U; + remainder = x << 16U; + return static_cast(x >> 16U); +} + +__CUDA_HOSTDEVICE_BF16_DECL__ float __internal_double2float_rn(const double x) +{ + float r; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rn.f32.f64 %0, %1;" : "=f"(r) : "d"(x)); +, + r = static_cast(x); +) + return r; +} +__CUDA_HOSTDEVICE_BF16_DECL__ double __internal_float2double(const float x) +{ + double r; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.f64.f32 %0, %1;" : "=d"(r) : "f"(x)); +, + r = static_cast(x); +) + return r; +} + +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __double2bfloat16(const double x) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("{ cvt.rn.bf16.f64 %0, %1;}\n" : "=h"(__BFLOAT16_TO_US(val)) : "d"(x)); + return val; +, + float f = __internal_double2float_rn(x); + const double d = __internal_float2double(f); + unsigned int u = __internal_float_as_uint(f); + + bool x_is_not_nan = ((u << (unsigned)1U) <= (unsigned)0xFF000000U); + + + if ((x > 0.0) && (d > x)) { + u--; + } + if ((x < 0.0) && (d < x)) { + u--; + } + if ((d != x) && x_is_not_nan) { + u |= 1U; + } + + f = __internal_uint_as_float(u); + + return __float2bfloat16(f); +) +} + +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __float2bfloat16(const float a) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm("{ cvt.rn.bf16.f32 %0, %1;}\n" : "=h"(__BFLOAT16_TO_US(val)) : "f"(a)); +, + __nv_bfloat16_raw r; + unsigned int sign = 0U; + unsigned int remainder = 0U; + r.x = __internal_float2bfloat16(a, sign, remainder); + if ((remainder > 0x80000000U) || ((remainder == 0x80000000U) && ((r.x & 0x1U) != 0U))) { + r.x++; + } + val = r; +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __float2bfloat16_rn(const float a) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm("{ cvt.rn.bf16.f32 %0, %1;}\n" : "=h"(__BFLOAT16_TO_US(val)) : "f"(a)); +, + __nv_bfloat16_raw r; + unsigned int sign = 0U; + unsigned int remainder = 0U; + r.x = __internal_float2bfloat16(a, sign, remainder); + if ((remainder > 0x80000000U) || ((remainder == 0x80000000U) && ((r.x & 0x1U) != 0U))) { + r.x++; + } + val = r; +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __float2bfloat16_rz(const float a) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm("{ cvt.rz.bf16.f32 %0, %1;}\n" : "=h"(__BFLOAT16_TO_US(val)) : "f"(a)); +, + __nv_bfloat16_raw r; + unsigned int sign = 0U; + unsigned int remainder = 0U; + r.x = __internal_float2bfloat16(a, sign, remainder); + val = r; +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __float2bfloat16_rd(const float a) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("{ cvt.rm.bf16.f32 %0, %1;}\n" : "=h"(__BFLOAT16_TO_US(val)) : "f"(a)); + return val; +, + __nv_bfloat16 val; + __nv_bfloat16_raw r; + unsigned int sign = 0U; + unsigned int remainder = 0U; + r.x = __internal_float2bfloat16(a, sign, remainder); + if ((remainder != 0U) && (sign != 0U)) { + r.x++; + } + val = r; + return val; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __float2bfloat16_ru(const float a) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("{ cvt.rp.bf16.f32 %0, %1;}\n" : "=h"(__BFLOAT16_TO_US(val)) : "f"(a)); + return val; +, + __nv_bfloat16 val; + __nv_bfloat16_raw r; + unsigned int sign = 0U; + unsigned int remainder = 0U; + r.x = __internal_float2bfloat16(a, sign, remainder); + if ((remainder != 0U) && (sign == 0U)) { + r.x++; + } + val = r; + return val; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __float2bfloat162_rn(const float a) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm("{.reg .b16 low;\n" + " cvt.rn.bf16.f32 low, %1;\n" + " mov.b32 %0, {low,low};}\n" : "=r"(__BFLOAT162_TO_UI(val)) : "f"(a)); +, + val = __nv_bfloat162(__float2bfloat16_rn(a), __float2bfloat16_rn(a)); +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __floats2bfloat162_rn(const float a, const float b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm("{ cvt.rn.bf16x2.f32 %0, %2, %1;}\n" + : "=r"(__BFLOAT162_TO_UI(val)) : "f"(a), "f"(b)); +, + val = __nv_bfloat162(__float2bfloat16_rn(a), __float2bfloat16_rn(b)); +) + return val; +} + +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ float __internal_device_bfloat162float(const unsigned short h) +{ + float f; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("{ cvt.f32.bf16 %0, %1;}\n" : "=f"(f) : "h"(h)); +, + asm("{ mov.b32 %0, {0,%1};}\n" : "=f"(f) : "h"(h)); +) + return f; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +__CUDA_HOSTDEVICE_BF16_DECL__ float __internal_bfloat162float(const unsigned short h) +{ + float f; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + f = __internal_device_bfloat162float(h); +, + unsigned int u = static_cast(h) << 16; + f = __internal_uint_as_float(u); +) + return f; +} + +__CUDA_HOSTDEVICE_BF16_DECL__ float __bfloat162float(const __nv_bfloat16 a) +{ + return __internal_bfloat162float(static_cast<__nv_bfloat16_raw>(a).x); +} +__CUDA_HOSTDEVICE_BF16_DECL__ float __low2float(const __nv_bfloat162 a) +{ + return __internal_bfloat162float(static_cast<__nv_bfloat162_raw>(a).x); +} + +__CUDA_HOSTDEVICE_BF16_DECL__ float __high2float(const __nv_bfloat162 a) +{ + return __internal_bfloat162float(static_cast<__nv_bfloat162_raw>(a).y); +} + +/* CUDA vector-types compatible vector creation function (note returns __nv_bfloat162, not nv_bfloat162) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 make_bfloat162(const __nv_bfloat16 x, const __nv_bfloat16 y) +{ + __nv_bfloat162 t; t.x = x; t.y = y; return t; +} + +/* Definitions of intrinsics */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __float22bfloat162_rn(const float2 a) +{ + __nv_bfloat162 val = __floats2bfloat162_rn(a.x, a.y); + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ float2 __bfloat1622float2(const __nv_bfloat162 a) +{ + float hi_float; + float lo_float; + lo_float = __internal_bfloat162float(((__nv_bfloat162_raw)a).x); + hi_float = __internal_bfloat162float(((__nv_bfloat162_raw)a).y); + return make_float2(lo_float, hi_float); +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ int __bfloat162int_rn(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + int val; + asm("{ cvt.rni.s32.bf16 %0, %1;}\n" : "=r"(val) : "h"(__BFLOAT16_TO_CUS(h))); + return val; +, + return __float2int_rn(__bfloat162float(h)); +) +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +__CUDA_HOSTDEVICE_BF16_DECL__ int __internal_bfloat162int_rz(const __nv_bfloat16 h) +{ + const float f = __bfloat162float(h); + int i; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + i = __float2int_rz(f); +, + const int max_val = (int)0x7fffffffU; + const int min_val = (int)0x80000000U; + const unsigned short bits = static_cast(static_cast<__nv_bfloat16_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xFF00U) { + // NaN + i = 0; + } else if (f >= static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + i = static_cast(f); + } +) + return i; +} + +__CUDA_HOSTDEVICE_BF16_DECL__ int __bfloat162int_rz(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + int val; + asm("{ cvt.rzi.s32.bf16 %0, %1;}\n" : "=r"(val) : "h"(__BFLOAT16_TO_CUS(h))); + return val; +, + return __internal_bfloat162int_rz(h); +) +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ int __bfloat162int_rd(const __nv_bfloat16 h) +{ + int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("{ cvt.rmi.s32.bf16 %0, %1;}\n" : "=r"(val) : "h"(__BFLOAT16_TO_CUS(h))); +, + const float f = __bfloat162float(h); + asm("cvt.rmi.s32.f32 %0, %1;" : "=r"(val) : "f"(f)); +) + return val; +} +__CUDA_BF16_DECL__ int __bfloat162int_ru(const __nv_bfloat16 h) +{ + int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("{ cvt.rpi.s32.bf16 %0, %1;}\n" : "=r"(val) : "h"(__BFLOAT16_TO_CUS(h))); +, + const float f = __bfloat162float(h); + asm("cvt.rpi.s32.f32 %0, %1;" : "=r"(val) : "f"(f)); +) + return val; +} + +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_device_int2bfloat16_rn(const int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rn.bf16.s32 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "r"(i)); + return val; +, + const float ru = __int2float_ru(i); + const float rd = __int2float_rd(i); + float rz = __int2float_rz(i); + if (ru != rd) { + rz = __uint_as_float(__float_as_uint(rz) | 1U); + } + return __float2bfloat16_rn(rz); +) +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __int2bfloat16_rn(const int i) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_int2bfloat16_rn(i); +, + const double d = static_cast(i); + return __double2bfloat16(d); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ signed char __bfloat162char_rz(const __nv_bfloat16 h) +{ + signed char i; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + unsigned short tmp = 0; + asm("{ .reg.b8 myreg;\n" + " cvt.rzi.s8.bf16 myreg, %1;\n" + " mov.b16 %0, {myreg, 0};\n}" + :"=h"(tmp) : "h"(__BFLOAT16_TO_CUS(h))); + const unsigned char u = static_cast(tmp); + i = static_cast(u); +, + const float f = __bfloat162float(h); + const signed char max_val = (signed char)0x7fU; + const signed char min_val = (signed char)0x80U; + const unsigned short bits = static_cast(static_cast<__nv_bfloat16_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xFF00U) { + // NaN + i = 0; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value, conversion is well-defined + i = static_cast(f); + } +) + return i; +} + +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned char __bfloat162uchar_rz(const __nv_bfloat16 h) +{ + unsigned char i; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + unsigned short tmp = 0; + asm("{ .reg.b8 myreg;\n" + " cvt.rzi.u8.bf16 myreg, %1;\n" + " mov.b16 %0, {myreg, 0};\n}" + :"=h"(tmp) : "h"(__BFLOAT16_TO_CUS(h))); + i = static_cast(tmp); +, + const float f = __bfloat162float(h); + const unsigned char max_val = 0xffU; + const unsigned char min_val = 0U; + const unsigned short bits = static_cast(static_cast<__nv_bfloat16_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xFF00U) { + // NaN + i = 0U; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value, conversion is well-defined + i = static_cast(f); + } +) + return i; +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __int2bfloat16_rz(const int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rz.bf16.s32 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "r"(i)); + return val; +, + return __float2bfloat16_rz(__int2float_rz(i)); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __int2bfloat16_rd(const int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rm.bf16.s32 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "r"(i)); + return val; +, + return __float2bfloat16_rd(__int2float_rd(i)); +) +} + +__CUDA_BF16_DECL__ __nv_bfloat16 __int2bfloat16_ru(const int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rp.bf16.s32 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "r"(i)); + return val; +, + return __float2bfloat16_ru(__int2float_ru(i)); +) +} + +__CUDA_BF16_DECL__ short int __bfloat162short_rn(const __nv_bfloat16 h) +{ + short int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rni.s16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +, + asm("{ .reg.f32 f;\n" + " mov.b32 f, {0,%1};\n" + " cvt.rni.s16.f32 %0,f;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +) + return val; +} + +__CUDA_BF16_DECL__ short int __internal_device_bfloat162short_rz(const __nv_bfloat16 h) +{ + short int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rzi.s16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +, + asm("{ .reg.f32 f;\n" + " mov.b32 f, {0,%1};\n" + " cvt.rzi.s16.f32 %0,f;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +) + return val; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ short int __bfloat162short_rz(const __nv_bfloat16 h) +{ + short int val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + val = __internal_device_bfloat162short_rz(h); +, + const float f = __bfloat162float(h); + const short int max_val = (short int)0x7fffU; + const short int min_val = (short int)0x8000U; + const unsigned short bits = static_cast(static_cast<__nv_bfloat16_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xFF00U) { + // NaN + val = 0; + } else if (f > static_cast(max_val)) { + // saturate maximum + val = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + val = min_val; + } else { + val = static_cast(f); + } +) + return val; +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ short int __bfloat162short_rd(const __nv_bfloat16 h) +{ + short int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rmi.s16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +, + asm("{ .reg.f32 f;\n" + " mov.b32 f, {0,%1};\n" + " cvt.rmi.s16.f32 %0,f;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +) + return val; +} +__CUDA_BF16_DECL__ short int __bfloat162short_ru(const __nv_bfloat16 h) +{ + short int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rpi.s16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +, + asm("{ .reg.f32 f;\n" + " mov.b32 f, {0,%1};\n" + " cvt.rpi.s16.f32 %0,f;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +) + return val; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __short2bfloat16_rn(const short int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rn.bf16.s16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(i)); + return val; +, + const float f = static_cast(i); + return __float2bfloat16_rn(f); +) +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __short2bfloat16_rz(const short int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rz.bf16.s16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(i)); + return val; +, + return __float2bfloat16_rz(__int2float_rz(static_cast(i))); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __short2bfloat16_rd(const short int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rm.bf16.s16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(i)); + return val; +, + return __float2bfloat16_rd(__int2float_rd(static_cast(i))); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __short2bfloat16_ru(const short int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rp.bf16.s16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(i)); + return val; +, + return __float2bfloat16_ru(__int2float_ru(static_cast(i))); +) +} + +__CUDA_BF16_DECL__ unsigned int __bfloat162uint_rn(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + unsigned int val; + asm("{ cvt.rni.u32.bf16 %0, %1;}\n" : "=r"(val) : "h"(__BFLOAT16_TO_CUS(h))); + return val; +, + return __float2uint_rn(__bfloat162float(h)); +) +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned int __internal_bfloat162uint_rz(const __nv_bfloat16 h) +{ + const float f = __bfloat162float(h); + unsigned int i; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + i = __float2uint_rz(f); +, + const unsigned int max_val = 0xffffffffU; + const unsigned int min_val = 0U; + const unsigned short bits = static_cast(static_cast<__nv_bfloat16_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xFF00U) { + // NaN + i = 0U; + } else if (f >= static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + i = static_cast(f); + } +) + return i; +} + +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned int __bfloat162uint_rz(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + unsigned int val; + asm("{ cvt.rzi.u32.bf16 %0, %1;}\n" : "=r"(val) : "h"(__BFLOAT16_TO_CUS(h))); + return val; +, + return __internal_bfloat162uint_rz(h); +) +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ unsigned int __bfloat162uint_rd(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + unsigned int val; + asm("{ cvt.rmi.u32.bf16 %0, %1;}\n" : "=r"(val) : "h"(__BFLOAT16_TO_CUS(h))); + return val; +, + return __float2uint_rd(__bfloat162float(h)); +) +} +__CUDA_BF16_DECL__ unsigned int __bfloat162uint_ru(const __nv_bfloat16 h) +{ + unsigned int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("{ cvt.rpi.u32.bf16 %0, %1;}\n" : "=r"(val) : "h"(__BFLOAT16_TO_CUS(h))); +, + const float f = __bfloat162float(h); + asm("cvt.rpi.u32.f32 %0, %1;" : "=r"(val) : "f"(f)); +) + return val; +} + +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_device_uint2bfloat16_rn(const unsigned int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rn.bf16.u32 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "r"(i)); + return val; +, + const float ru = __uint2float_ru(i); + const float rd = __uint2float_rd(i); + float rz = __uint2float_rz(i); + if (ru != rd) { + rz = __uint_as_float(__float_as_uint(rz) | 1U); + } + return __float2bfloat16_rn(rz); +) +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __uint2bfloat16_rn(const unsigned int i) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_uint2bfloat16_rn(i); +, + const double d = static_cast(i); + return __double2bfloat16(d); +) +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __uint2bfloat16_rz(const unsigned int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rz.bf16.u32 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "r"(i)); + return val; +, + return __float2bfloat16_rz(__uint2float_rz(i)); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __uint2bfloat16_rd(const unsigned int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rm.bf16.u32 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "r"(i)); + return val; +, + return __float2bfloat16_rd(__uint2float_rd(i)); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __uint2bfloat16_ru(const unsigned int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rp.bf16.u32 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "r"(i)); + return val; +, + return __float2bfloat16_ru(__uint2float_ru(i)); +) +} + +__CUDA_BF16_DECL__ unsigned short int __bfloat162ushort_rn(const __nv_bfloat16 h) +{ + unsigned short int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rni.u16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +, + asm("{ .reg.f32 f;\n" + " mov.b32 f, {0,%1};\n" + " cvt.rni.u16.f32 %0,f;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +) + return val; +} + +__CUDA_BF16_DECL__ unsigned short int __internal_device_bfloat162ushort_rz(const __nv_bfloat16 h) +{ + unsigned short int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rzi.u16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +, + asm("{ .reg.f32 f;\n" + " mov.b32 f, {0,%1};\n" + " cvt.rzi.u16.f32 %0,f;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +) + return val; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned short int __bfloat162ushort_rz(const __nv_bfloat16 h) +{ + unsigned short int val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + val = __internal_device_bfloat162ushort_rz(h); +, + const float f = __bfloat162float(h); + const unsigned short int max_val = 0xffffU; + const unsigned short int min_val = 0U; + const unsigned short bits = static_cast(static_cast<__nv_bfloat16_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xFF00U) { + // NaN + val = 0U; + } else if (f > static_cast(max_val)) { + // saturate maximum + val = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + val = min_val; + } else { + val = static_cast(f); + } +) + return val; +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ unsigned short int __bfloat162ushort_rd(const __nv_bfloat16 h) +{ + unsigned short int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rmi.u16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +, + asm("{ .reg.f32 f;\n" + " mov.b32 f, {0,%1};\n" + " cvt.rmi.u16.f32 %0,f;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +) + return val; +} +__CUDA_BF16_DECL__ unsigned short int __bfloat162ushort_ru(const __nv_bfloat16 h) +{ + unsigned short int val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rpi.u16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +, + asm("{ .reg.f32 f;\n" + " mov.b32 f, {0,%1};\n" + " cvt.rpi.u16.f32 %0,f;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(h))); +) + return val; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __ushort2bfloat16_rn(const unsigned short int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rn.bf16.u16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(i)); + return val; +, + const float f = static_cast(i); + return __float2bfloat16_rn(f); +) +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __ushort2bfloat16_rz(const unsigned short int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rz.bf16.u16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(i)); + return val; +, + return __float2bfloat16_rz(__uint2float_rz(static_cast(i))); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ushort2bfloat16_rd(const unsigned short int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rm.bf16.u16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(i)); + return val; +, + return __float2bfloat16_rd(__uint2float_rd(static_cast(i))); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ushort2bfloat16_ru(const unsigned short int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 val; + asm("cvt.rp.bf16.u16 %0, %1;" : "=h"(__BFLOAT16_TO_US(val)) : "h"(i)); + return val; +, + return __float2bfloat16_ru(__uint2float_ru(static_cast(i))); +) +} + +__CUDA_BF16_DECL__ unsigned long long int __bfloat162ull_rn(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + unsigned long long int i; + asm("cvt.rni.u64.bf16 %0, %1;" : "=l"(i) : "h"(__BFLOAT16_TO_CUS(h))); + return i; +, + return __float2ull_rn(__bfloat162float(h)); +) +} + +__CUDA_BF16_DECL__ unsigned long long int __internal_device_bfloat162ull_rz(const __nv_bfloat16 h) +{ + unsigned long long int i; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rzi.u64.bf16 %0, %1;" : "=l"(i) : "h"(__BFLOAT16_TO_CUS(h))); +, + const float f = __bfloat162float(h); + i = __float2ull_rz(f); +) + return i; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned long long int __bfloat162ull_rz(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_bfloat162ull_rz(h); +, + const float f = __bfloat162float(h); + unsigned long long int i; + const unsigned long long int max_val = 0xffffffffffffffffULL; + const unsigned long long int min_val = 0ULL; + const unsigned short bits = static_cast(static_cast<__nv_bfloat16_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xFF00U) { + // NaN + i = 0x8000000000000000ULL; + } else if (f >= static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + i = static_cast(f); + } + return i; +) +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ unsigned long long int __bfloat162ull_rd(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + unsigned long long int i; + asm("cvt.rmi.u64.bf16 %0, %1;" : "=l"(i) : "h"(__BFLOAT16_TO_CUS(h))); + return i; +, + return __float2ull_rd(__bfloat162float(h)); +) +} +__CUDA_BF16_DECL__ unsigned long long int __bfloat162ull_ru(const __nv_bfloat16 h) +{ + unsigned long long int i; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rpi.u64.bf16 %0, %1;" : "=l"(i) : "h"(__BFLOAT16_TO_CUS(h))); +, + const float f = __bfloat162float(h); + asm("cvt.rpi.u64.f32 %0, %1;" : "=l"(i) : "f"(f)); +) + return i; +} + +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_device_ull2bfloat16_rn(const unsigned long long int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 h; + asm("cvt.rn.bf16.u64 %0, %1;" : "=h"(__BFLOAT16_TO_US(h)) : "l"(i)); + return h; +, + const float ru = __ull2float_ru(i); + const float rd = __ull2float_rd(i); + float rz = __ull2float_rz(i); + if (ru != rd) { + rz = __uint_as_float(__float_as_uint(rz) | 1U); + } + return __float2bfloat16_rn(rz); +) +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __ull2bfloat16_rn(const unsigned long long int i) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_ull2bfloat16_rn(i); +, + float f = static_cast(i); + const unsigned long long int uf = static_cast(f); + unsigned int u = __internal_float_as_uint(f); + // round up happened here + // note: no need to handle round up to f == 0x1.p64 specially + if (uf > i) { + u--; + } + if (uf != i) { + u |= 1U; + } + f = __internal_uint_as_float(u); + return __float2bfloat16_rn(f); +) +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __ull2bfloat16_rz(const unsigned long long int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 h; + asm("cvt.rz.bf16.u64 %0, %1;" : "=h"(__BFLOAT16_TO_US(h)) : "l"(i)); + return h; +, + return __float2bfloat16_rz(__ull2float_rz(i)); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ull2bfloat16_rd(const unsigned long long int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 h; + asm("cvt.rm.bf16.u64 %0, %1;" : "=h"(__BFLOAT16_TO_US(h)) : "l"(i)); + return h; +, + return __float2bfloat16_rd(__ull2float_rd(i)); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ull2bfloat16_ru(const unsigned long long int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 h; + asm("cvt.rp.bf16.u64 %0, %1;" : "=h"(__BFLOAT16_TO_US(h)) : "l"(i)); + return h; +, + return __float2bfloat16_ru(__ull2float_ru(i)); +) +} +__CUDA_BF16_DECL__ long long int __bfloat162ll_rn(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + long long int i; + asm("cvt.rni.s64.bf16 %0, %1;" : "=l"(i) : "h"(__BFLOAT16_TO_CUS(h))); + return i; +, + return __float2ll_rn(__bfloat162float(h)); +) +} + +__CUDA_BF16_DECL__ long long int __internal_device_bfloat162ll_rz(const __nv_bfloat16 h) +{ + long long int i; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rzi.s64.bf16 %0, %1;" : "=l"(i) : "h"(__BFLOAT16_TO_CUS(h))); +, + const float f = __bfloat162float(h); + i = __float2ll_rz(f); +) + return i; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ long long int __bfloat162ll_rz(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_bfloat162ll_rz(h); +, + long long int i; + const float f = __bfloat162float(h); + const long long int max_val = (long long int)0x7fffffffffffffffULL; + const long long int min_val = (long long int)0x8000000000000000ULL; + const unsigned short bits = static_cast(static_cast<__nv_bfloat16_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xFF00U) { + // NaN + i = min_val; + } else if (f >= static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + i = static_cast(f); + } + return i; +) +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ long long int __bfloat162ll_rd(const __nv_bfloat16 h) +{ + long long int i; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rmi.s64.bf16 %0, %1;" : "=l"(i) : "h"(__BFLOAT16_TO_CUS(h))); +, + const float f = __bfloat162float(h); + asm("cvt.rmi.s64.f32 %0, %1;" : "=l"(i) : "f"(f)); +) + return i; +} +__CUDA_BF16_DECL__ long long int __bfloat162ll_ru(const __nv_bfloat16 h) +{ + long long int i; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("cvt.rpi.s64.bf16 %0, %1;" : "=l"(i) : "h"(__BFLOAT16_TO_CUS(h))); +, + const float f = __bfloat162float(h); + asm("cvt.rpi.s64.f32 %0, %1;" : "=l"(i) : "f"(f)); +) + return i; +} + +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_device_ll2bfloat16_rn(const long long int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 h; + asm("cvt.rn.bf16.s64 %0, %1;" : "=h"(__BFLOAT16_TO_US(h)) : "l"(i)); + return h; +, + const float ru = __ll2float_ru(i); + const float rd = __ll2float_rd(i); + float rz = __ll2float_rz(i); + if (ru != rd) { + rz = __uint_as_float(__float_as_uint(rz) | 1U); + } + return __float2bfloat16_rn(rz); +) +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __ll2bfloat16_rn(const long long int i) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_ll2bfloat16_rn(i); +, + float f = static_cast(i); + const long long int lf = static_cast(f); + unsigned int u = __internal_float_as_uint(f); + + if ((f > 0.0f) && (lf > i)) { + u--; + } + if ((f < 0.0f) && (lf < i)) { + u--; + } + if (lf != i) { + u |= 1U; + } + + f = __internal_uint_as_float(u); + return __float2bfloat16_rn(f); +) +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __ll2bfloat16_rz(const long long int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 h; + asm("cvt.rz.bf16.s64 %0, %1;" : "=h"(__BFLOAT16_TO_US(h)) : "l"(i)); + return h; +, + return __float2bfloat16_rz(__ll2float_rz(i)); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ll2bfloat16_rd(const long long int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 h; + asm("cvt.rm.bf16.s64 %0, %1;" : "=h"(__BFLOAT16_TO_US(h)) : "l"(i)); + return h; +, + return __float2bfloat16_rd(__ll2float_rd(i)); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ll2bfloat16_ru(const long long int i) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 h; + asm("cvt.rp.bf16.s64 %0, %1;" : "=h"(__BFLOAT16_TO_US(h)) : "l"(i)); + return h; +, + return __float2bfloat16_ru(__ll2float_ru(i)); +) +} + +__CUDA_BF16_DECL__ __nv_bfloat16 htrunc(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 r; + asm("cvt.rzi.bf16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(r)) : "h"(__BFLOAT16_TO_CUS(h))); + return r; +, + return __float2bfloat16_rz(truncf(__bfloat162float(h))); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 hceil(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 r; + asm("cvt.rpi.bf16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(r)) : "h"(__BFLOAT16_TO_CUS(h))); + return r; +, + float fh = __bfloat162float(h); + asm( "{ cvt.rpi.f32.f32 %0, %0; }\n" + :"+f"(fh)); + return __float2bfloat16_rz(fh); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 hfloor(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 r; + asm("cvt.rmi.bf16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(r)) : "h"(__BFLOAT16_TO_CUS(h))); + return r; +, + float fh = __bfloat162float(h); + asm( "{ cvt.rmi.f32.f32 %0, %0; }\n" + :"+f"(fh)); + return __float2bfloat16_rz(fh); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 hrint(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 r; + asm("cvt.rni.bf16.bf16 %0, %1;" : "=h"(__BFLOAT16_TO_US(r)) : "h"(__BFLOAT16_TO_CUS(h))); + return r; +, + return __float2bfloat16_rz(rintf(__bfloat162float(h))); +) +} + +__CUDA_BF16_DECL__ __nv_bfloat162 h2trunc(const __nv_bfloat162 h) +{ + const __nv_bfloat16 low = htrunc(h.x); + const __nv_bfloat16 high = htrunc(h.y); + return __nv_bfloat162(low, high); +} +__CUDA_BF16_DECL__ __nv_bfloat162 h2ceil(const __nv_bfloat162 h) +{ + const __nv_bfloat16 low = hceil(h.x); + const __nv_bfloat16 high = hceil(h.y); + return __nv_bfloat162(low, high); +} +__CUDA_BF16_DECL__ __nv_bfloat162 h2floor(const __nv_bfloat162 h) +{ + const __nv_bfloat16 low = hfloor(h.x); + const __nv_bfloat16 high = hfloor(h.y); + return __nv_bfloat162(low, high); +} + +__CUDA_BF16_DECL__ __nv_bfloat162 h2rint(const __nv_bfloat162 h) +{ + return __halves2bfloat162(hrint(__low2bfloat16(h)), hrint(__high2bfloat16(h))); +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __lows2bfloat162(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .b16 alow,ahigh,blow,bhigh;\n" + " mov.b32 {alow,ahigh}, %1;\n" + " mov.b32 {blow,bhigh}, %2;\n" + " mov.b32 %0, {alow,blow};}\n" : "=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)), "r"(__BFLOAT162_TO_CUI(b))); +, + val.x = a.x; + val.y = b.x; +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __highs2bfloat162(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .b16 alow,ahigh,blow,bhigh;\n" + " mov.b32 {alow,ahigh}, %1;\n" + " mov.b32 {blow,bhigh}, %2;\n" + " mov.b32 %0, {ahigh,bhigh};}\n" : "=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)), "r"(__BFLOAT162_TO_CUI(b))); +, + val.x = a.y; + val.y = b.y; +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __low2bfloat16(const __nv_bfloat162 a) +{ + __nv_bfloat16 ret; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .b16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " mov.b16 %0, low;}" : "=h"(__BFLOAT16_TO_US(ret)) : "r"(__BFLOAT162_TO_CUI(a))); +, + ret = a.x; +) + return ret; +} +__CUDA_HOSTDEVICE_BF16_DECL__ int __hisinf(const __nv_bfloat16 a) +{ + int retval; + const __nv_bfloat16_raw araw = __nv_bfloat16_raw(a); + if (araw.x == 0xFF80U) { + retval = -1; + } else if (araw.x == 0x7F80U) { + retval = 1; + } else { + retval = 0; + } + return retval; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __low2bfloat162(const __nv_bfloat162 a) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .b16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " mov.b32 %0, {low,low};}\n" : "=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a))); +, + val.x = a.x; + val.y = a.x; +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __high2bfloat162(const __nv_bfloat162 a) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .b16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " mov.b32 %0, {high,high};}\n" : "=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a))); +, + val.x = a.y; + val.y = a.y; +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __high2bfloat16(const __nv_bfloat162 a) +{ + __nv_bfloat16 ret; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .b16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " mov.b16 %0, high;}" : "=h"(__BFLOAT16_TO_US(ret)) : "r"(__BFLOAT162_TO_CUI(a))); +, + ret = a.y; +) + return ret; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __halves2bfloat162(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{ mov.b32 %0, {%1,%2};}\n" + : "=r"(__BFLOAT162_TO_UI(val)) : "h"(__BFLOAT16_TO_CUS(a)), "h"(__BFLOAT16_TO_CUS(b))); +, + val.x = a; + val.y = b; +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __bfloat162bfloat162(const __nv_bfloat16 a) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{ mov.b32 %0, {%1,%1};}\n" + : "=r"(__BFLOAT162_TO_UI(val)) : "h"(__BFLOAT16_TO_CUS(a))); +, + val.x = a; + val.y = a; +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __lowhigh2highlow(const __nv_bfloat162 a) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .b16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " mov.b32 %0, {high,low};}\n" : "=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a))); +, + val.x = a.y; + val.y = a.x; +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ short int __bfloat16_as_short(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return static_cast(__BFLOAT16_TO_CUS(h)); +, + return static_cast(__nv_bfloat16_raw(h).x); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned short int __bfloat16_as_ushort(const __nv_bfloat16 h) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __BFLOAT16_TO_CUS(h); +, + return __nv_bfloat16_raw(h).x; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __short_as_bfloat16(const short int i) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __nv_bfloat16 h; + __BFLOAT16_TO_US(h) = static_cast(i); + return h; +, + __nv_bfloat16_raw hr; + hr.x = static_cast(i); + return __nv_bfloat16(hr); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __ushort_as_bfloat16(const unsigned short int i) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __nv_bfloat16 h; + __BFLOAT16_TO_US(h) = i; + return h; +, + __nv_bfloat16_raw hr; + hr.x = i; + return __nv_bfloat16(hr); +) +} + +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 300))) || defined(_NVHPC_CUDA) +/****************************************************************************** +* __nv_bfloat16, __nv_bfloat162 warp shuffle * +******************************************************************************/ +#define __SHUFFLE_SYNC_BFLOAT162_MACRO(name) /* do */ {\ + __nv_bfloat162 r; \ + asm volatile ("{" __CUDA_BF16_STRINGIFY(name) " %0,%1,%2,%3,%4;\n}" \ + :"=r"(__BFLOAT162_TO_UI(r)): "r"(__BFLOAT162_TO_CUI(var)), "r"(delta), "r"(c), "r"(mask)); \ + return r; \ +} /* while(0) */ + +__CUDA_BF16_DECL__ __nv_bfloat162 __shfl_sync(const unsigned mask, const __nv_bfloat162 var, const int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = ((warp_size - static_cast(width)) << 8U) | 0x1fU; + __SHUFFLE_SYNC_BFLOAT162_MACRO(shfl.sync.idx.b32) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __shfl_up_sync(const unsigned mask, const __nv_bfloat162 var, const unsigned int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = (warp_size - static_cast(width)) << 8U; + __SHUFFLE_SYNC_BFLOAT162_MACRO(shfl.sync.up.b32) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __shfl_down_sync(const unsigned mask, const __nv_bfloat162 var, const unsigned int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = ((warp_size - static_cast(width)) << 8U) | 0x1fU; + __SHUFFLE_SYNC_BFLOAT162_MACRO(shfl.sync.down.b32) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __shfl_xor_sync(const unsigned mask, const __nv_bfloat162 var, const int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = ((warp_size - static_cast(width)) << 8U) | 0x1fU; + __SHUFFLE_SYNC_BFLOAT162_MACRO(shfl.sync.bfly.b32) +} + +#undef __SHUFFLE_SYNC_BFLOAT162_MACRO + +__CUDA_BF16_DECL__ __nv_bfloat16 __shfl_sync(const unsigned mask, const __nv_bfloat16 var, const int delta, const int width) +{ + const __nv_bfloat162 temp1 = __halves2bfloat162(var, var); + const __nv_bfloat162 temp2 = __shfl_sync(mask, temp1, delta, width); + return __low2bfloat16(temp2); +} +__CUDA_BF16_DECL__ __nv_bfloat16 __shfl_up_sync(const unsigned mask, const __nv_bfloat16 var, const unsigned int delta, const int width) +{ + const __nv_bfloat162 temp1 = __halves2bfloat162(var, var); + const __nv_bfloat162 temp2 = __shfl_up_sync(mask, temp1, delta, width); + return __low2bfloat16(temp2); +} +__CUDA_BF16_DECL__ __nv_bfloat16 __shfl_down_sync(const unsigned mask, const __nv_bfloat16 var, const unsigned int delta, const int width) +{ + const __nv_bfloat162 temp1 = __halves2bfloat162(var, var); + const __nv_bfloat162 temp2 = __shfl_down_sync(mask, temp1, delta, width); + return __low2bfloat16(temp2); +} +__CUDA_BF16_DECL__ __nv_bfloat16 __shfl_xor_sync(const unsigned mask, const __nv_bfloat16 var, const int delta, const int width) +{ + const __nv_bfloat162 temp1 = __halves2bfloat162(var, var); + const __nv_bfloat162 temp2 = __shfl_xor_sync(mask, temp1, delta, width); + return __low2bfloat16(temp2); +} + +/****************************************************************************** +* __nv_bfloat16 and __nv_bfloat162 __ldg,__ldcg,__ldca,__ldcs * +******************************************************************************/ + +#if (defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) || defined(__CUDACC_RTC__) +#define __LDG_PTR "l" +#else +#define __LDG_PTR "r" +#endif /*(defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) || defined(__CUDACC_RTC__)*/ +__CUDA_BF16_DECL__ __nv_bfloat162 __ldg(const __nv_bfloat162 *const ptr) +{ + __nv_bfloat162 ret; + asm ("ld.global.nc.b32 %0, [%1];" : "=r"(__BFLOAT162_TO_UI(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ldg(const __nv_bfloat16 *const ptr) +{ + __nv_bfloat16 ret; + asm ("ld.global.nc.b16 %0, [%1];" : "=h"(__BFLOAT16_TO_US(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat162 __ldcg(const __nv_bfloat162 *const ptr) +{ + __nv_bfloat162 ret; + asm ("ld.global.cg.b32 %0, [%1];" : "=r"(__BFLOAT162_TO_UI(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ldcg(const __nv_bfloat16 *const ptr) +{ + __nv_bfloat16 ret; + asm ("ld.global.cg.b16 %0, [%1];" : "=h"(__BFLOAT16_TO_US(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat162 __ldca(const __nv_bfloat162 *const ptr) +{ + __nv_bfloat162 ret; + asm ("ld.global.ca.b32 %0, [%1];" : "=r"(__BFLOAT162_TO_UI(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ldca(const __nv_bfloat16 *const ptr) +{ + __nv_bfloat16 ret; + asm ("ld.global.ca.b16 %0, [%1];" : "=h"(__BFLOAT16_TO_US(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat162 __ldcs(const __nv_bfloat162 *const ptr) +{ + __nv_bfloat162 ret; + asm ("ld.global.cs.b32 %0, [%1];" : "=r"(__BFLOAT162_TO_UI(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ldcs(const __nv_bfloat16 *const ptr) +{ + __nv_bfloat16 ret; + asm ("ld.global.cs.b16 %0, [%1];" : "=h"(__BFLOAT16_TO_US(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat162 __ldlu(const __nv_bfloat162 *const ptr) +{ + __nv_bfloat162 ret; + asm ("ld.global.lu.b32 %0, [%1];" : "=r"(__BFLOAT162_TO_UI(ret)) : __LDG_PTR(ptr) : "memory"); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ldlu(const __nv_bfloat16 *const ptr) +{ + __nv_bfloat16 ret; + asm ("ld.global.lu.b16 %0, [%1];" : "=h"(__BFLOAT16_TO_US(ret)) : __LDG_PTR(ptr) : "memory"); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat162 __ldcv(const __nv_bfloat162 *const ptr) +{ + __nv_bfloat162 ret; + asm ("ld.global.cv.b32 %0, [%1];" : "=r"(__BFLOAT162_TO_UI(ret)) : __LDG_PTR(ptr) : "memory"); + return ret; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __ldcv(const __nv_bfloat16 *const ptr) +{ + __nv_bfloat16 ret; + asm ("ld.global.cv.b16 %0, [%1];" : "=h"(__BFLOAT16_TO_US(ret)) : __LDG_PTR(ptr) : "memory"); + return ret; +} + +__CUDA_BF16_DECL__ void __stwb(__nv_bfloat162 *const ptr, const __nv_bfloat162 value) +{ + asm ("st.global.wb.b32 [%0], %1;" :: __LDG_PTR(ptr), "r"(__BFLOAT162_TO_CUI(value)) : "memory"); +} +__CUDA_BF16_DECL__ void __stwb(__nv_bfloat16 *const ptr, const __nv_bfloat16 value) +{ + asm ("st.global.wb.b16 [%0], %1;" :: __LDG_PTR(ptr), "h"(__BFLOAT16_TO_CUS(value)) : "memory"); +} +__CUDA_BF16_DECL__ void __stcg(__nv_bfloat162 *const ptr, const __nv_bfloat162 value) +{ + asm ("st.global.cg.b32 [%0], %1;" :: __LDG_PTR(ptr), "r"(__BFLOAT162_TO_CUI(value)) : "memory"); +} +__CUDA_BF16_DECL__ void __stcg(__nv_bfloat16 *const ptr, const __nv_bfloat16 value) +{ + asm ("st.global.cg.b16 [%0], %1;" :: __LDG_PTR(ptr), "h"(__BFLOAT16_TO_CUS(value)) : "memory"); +} +__CUDA_BF16_DECL__ void __stcs(__nv_bfloat162 *const ptr, const __nv_bfloat162 value) +{ + asm ("st.global.cs.b32 [%0], %1;" :: __LDG_PTR(ptr), "r"(__BFLOAT162_TO_CUI(value)) : "memory"); +} +__CUDA_BF16_DECL__ void __stcs(__nv_bfloat16 *const ptr, const __nv_bfloat16 value) +{ + asm ("st.global.cs.b16 [%0], %1;" :: __LDG_PTR(ptr), "h"(__BFLOAT16_TO_CUS(value)) : "memory"); +} +__CUDA_BF16_DECL__ void __stwt(__nv_bfloat162 *const ptr, const __nv_bfloat162 value) +{ + asm ("st.global.wt.b32 [%0], %1;" :: __LDG_PTR(ptr), "r"(__BFLOAT162_TO_CUI(value)) : "memory"); +} +__CUDA_BF16_DECL__ void __stwt(__nv_bfloat16 *const ptr, const __nv_bfloat16 value) +{ + asm ("st.global.wt.b16 [%0], %1;" :: __LDG_PTR(ptr), "h"(__BFLOAT16_TO_CUS(value)) : "memory"); +} + +#undef __LDG_PTR +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 300))) || defined(_NVHPC_CUDA) */ +/****************************************************************************** +* __nv_bfloat162 comparison * +******************************************************************************/ +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +#define __COMPARISON_OP_BFLOAT162_MACRO(name) {\ + __nv_bfloat162 val; \ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90,\ + asm( "{ " __CUDA_BF16_STRINGIFY(name) ".bf16x2.bf16x2 %0,%1,%2;\n}" \ + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); \ +,\ + asm( "{.reg .b32 low_a,low_b,high_a,high_b,high_res,low_res;\n"\ + " and.b32 high_a, %1, 0xffff0000U;\n"\ + " and.b32 high_b, %2, 0xffff0000U;\n"\ + " shl.b32 low_a, %1, 16;\n"\ + " shl.b32 low_b, %2, 16;\n"\ + " " __CUDA_BF16_STRINGIFY(name) ".f32.f32 low_res, low_a, low_b;\n"\ + " " __CUDA_BF16_STRINGIFY(name) ".f32.f32 high_res, high_a, high_b;\n"\ + " shr.u32 low_res, low_res, 16;\n"\ + " or.b32 %0, high_res, low_res;}\n"\ + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); \ +)\ + return val; \ +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_heq2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.eq) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hne2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.ne) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hle2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.le) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hge2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.ge) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hlt2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.lt) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hgt2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.gt) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hequ2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.equ) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hneu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.neu) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hleu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.leu) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hgeu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.geu) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hltu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.ltu) +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hgtu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __COMPARISON_OP_BFLOAT162_MACRO(set.gtu) +} +#undef __COMPARISON_OP_BFLOAT162_MACRO +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __heq2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_heq2(a, b); +, + __nv_bfloat162_raw val; + val.x = __heq(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __heq(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hne2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hne2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hne(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hne(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hle2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hle2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hle(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hle(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hge2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hge2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hge(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hge(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hlt2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hlt2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hlt(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hlt(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hgt2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hgt2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hgt(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hgt(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hequ2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hequ2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hequ(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hequ(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hneu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hneu2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hneu(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hneu(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hleu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hleu2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hleu(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hleu(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hgeu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hgeu2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hgeu(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hgeu(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hltu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hltu2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hltu(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hltu(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hgtu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hgtu2(a, b); +, + __nv_bfloat162_raw val; + val.x = __hgtu(a.x, b.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hgtu(a.y, b.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + return __nv_bfloat162(val); +) +} + +/****************************************************************************** +* __nv_bfloat162 comparison with mask output * +******************************************************************************/ +#define __COMPARISON_OP_BFLOAT162_MACRO_MASK(name) {\ + unsigned val; \ + asm( "{ " __CUDA_BF16_STRINGIFY(name) ".u32.bf16x2 %0,%1,%2;\n}" \ + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); \ + return val; \ +} + +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __heq2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.eq) +, + const unsigned short px = __heq(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __heq(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hne2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.ne) +, + const unsigned short px = __hne(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hne(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hle2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.le) +, + const unsigned short px = __hle(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hle(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hge2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.ge) +, + const unsigned short px = __hge(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hge(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hlt2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.lt) +, + const unsigned short px = __hlt(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hlt(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hgt2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.gt) +, + const unsigned short px = __hgt(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hgt(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hequ2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.equ) +, + const unsigned short px = __hequ(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hequ(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hneu2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.neu) +, + const unsigned short px = __hneu(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hneu(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hleu2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.leu) +, + const unsigned short px = __hleu(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hleu(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hgeu2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.geu) +, + const unsigned short px = __hgeu(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hgeu(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hltu2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.ltu) +, + const unsigned short px = __hltu(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hltu(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ unsigned __hgtu2_mask(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __COMPARISON_OP_BFLOAT162_MACRO_MASK(set.gtu) +, + const unsigned short px = __hgtu(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hgtu(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +#undef __COMPARISON_OP_BFLOAT162_MACRO_MASK + +#define __BOOL_COMPARISON_OP_BFLOAT162_MACRO(name) {\ + unsigned int val; \ + bool retval; \ + asm( "{ " __CUDA_BF16_STRINGIFY(name) ".bf16x2.bf16x2 %0,%1,%2;\n}" \ + :"=r"(val) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); \ + if (val == 0x3F803F80U) {\ + retval = true; \ + } else { \ + retval = false; \ + }\ + return retval;\ +} + +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbeq2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.eq) +, + return (__heq(a.x, b.x) && __heq(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbne2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.ne) +, + return (__hne(a.x, b.x) && __hne(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hble2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.le) +, + return (__hle(a.x, b.x) && __hle(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbge2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.ge) +, + return (__hge(a.x, b.x) && __hge(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hblt2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.lt) +, + return (__hlt(a.x, b.x) && __hlt(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbgt2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.gt) +, + return (__hgt(a.x, b.x) && __hgt(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbequ2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.equ) +, + return (__hequ(a.x, b.x) && __hequ(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbneu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.neu) +, + return (__hneu(a.x, b.x) && __hneu(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbleu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.leu) +, + return (__hleu(a.x, b.x) && __hleu(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbgeu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.geu) +, + return (__hgeu(a.x, b.x) && __hgeu(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbltu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.ltu) +, + return (__hltu(a.x, b.x) && __hltu(a.y, b.y)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hbgtu2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __BOOL_COMPARISON_OP_BFLOAT162_MACRO(set.gtu) +, + return (__hgtu(a.x, b.x) && __hgtu(a.y, b.y)); +) +} +#undef __BOOL_COMPARISON_OP_BFLOAT162_MACRO +/****************************************************************************** +* __nv_bfloat16 comparison * +******************************************************************************/ +#define __COMPARISON_OP_BFLOAT16_MACRO(name) {\ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90,\ + unsigned short val; \ + asm( "{ .reg .pred __$temp3;\n" \ + " setp." __CUDA_BF16_STRINGIFY(name) ".bf16 __$temp3, %1, %2;\n" \ + " selp.u16 %0, 1, 0, __$temp3;}" \ + : "=h"(val) : "h"(__BFLOAT16_TO_CUS(a)), "h"(__BFLOAT16_TO_CUS(b))); \ + return (val != 0U) ? true : false; \ +,\ + unsigned int val; \ + asm( "{.reg .b32 a,b;\n"\ + " mov.b32 a, {0, %1};\n"\ + " mov.b32 b, {0, %2};\n"\ + " set." __CUDA_BF16_STRINGIFY(name) ".f32.f32 %0, a, b;}\n"\ + :"=r"(val) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); \ + return (val != 0U) ? true : false; \ +)\ +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __heq(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(eq) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa == fb); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hne(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(ne) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa != fb) && (!__hisnan(a)) && (!__hisnan(b)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hle(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(le) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa <= fb); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hge(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(ge) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa >= fb); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hlt(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(lt) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa < fb); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hgt(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(gt) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa > fb); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hequ(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(equ) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa == fb) || (__hisnan(a)) || (__hisnan(b)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hneu(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(neu) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa != fb); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hleu(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(leu) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa <= fb) || (__hisnan(a)) || (__hisnan(b)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hgeu(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(geu) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa >= fb) || (__hisnan(a)) || (__hisnan(b)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hltu(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(ltu) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa < fb) || (__hisnan(a)) || (__hisnan(b)); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hgtu(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __COMPARISON_OP_BFLOAT16_MACRO(gtu) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return (fa > fb) || (__hisnan(a)) || (__hisnan(b)); +) +} +#undef __COMPARISON_OP_BFLOAT16_MACRO +/****************************************************************************** +* __nv_bfloat162 arithmetic * +******************************************************************************/ +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hadd2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ add.bf16x2 %0,%1,%2; }\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +, + asm( "{.reg .b32 c;\n" + " mov.b32 c, 0x3f803f80U;\n" + " fma.rn.bf16x2 %0,%1,c,%2;}\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +) + return val; +} + +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hsub2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ sub.bf16x2 %0,%1,%2; }\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +, + asm( "{.reg .b32 c;\n" + " mov.b32 c, 0xbf80bf80U;\n" + " fma.rn.bf16x2 %0,%2,c,%1;}\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hmul2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ mul.bf16x2 %0,%1,%2; }\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +, + asm( "{.reg .b32 c;\n" + " mov.b32 c, 0x80008000U;\n" + " fma.rn.bf16x2 %0,%1,%2,c;}\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hadd2_rn(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ add.rn.bf16x2 %0,%1,%2; }\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +, + asm( "{.reg .b32 c;\n" + " mov.b32 c, 0x3f803f80U;\n" + " fma.rn.bf16x2 %0,%1,c,%2;}\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hsub2_rn(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ sub.rn.bf16x2 %0,%1,%2; }\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +, + asm( "{.reg .b32 c;\n" + " mov.b32 c, 0xbf80bf80U;\n" + " fma.rn.bf16x2 %0,%2,c,%1;}\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat162 __internal_device_hmul2_rn(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ mul.rn.bf16x2 %0,%1,%2; }\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +, + asm( "{.reg .b32 c;\n" + " mov.b32 c, 0x80008000U;\n" + " fma.rn.bf16x2 %0,%1,%2,c;}\n" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +) + return val; +} +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hadd2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + val = __internal_device_hadd2(a, b); +, + val.x = __hadd(a.x, b.x); + val.y = __hadd(a.y, b.y); +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hsub2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + val = __internal_device_hsub2(a, b); +, + val.x = __hsub(a.x, b.x); + val.y = __hsub(a.y, b.y); +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmul2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + val = __internal_device_hmul2(a, b); +, + val.x = __hmul(a.x, b.x); + val.y = __hmul(a.y, b.y); +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hadd2_rn(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + val = __internal_device_hadd2_rn(a, b); +, + val.x = __hadd_rn(a.x, b.x); + val.y = __hadd_rn(a.y, b.y); +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hsub2_rn(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + val = __internal_device_hsub2_rn(a, b); +, + val.x = __hsub_rn(a.x, b.x); + val.y = __hsub_rn(a.y, b.y); +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmul2_rn(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + val = __internal_device_hmul2_rn(a, b); +, + val.x = __hmul_rn(a.x, b.x); + val.y = __hmul_rn(a.y, b.y); +) + return val; +} + +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hadd2_sat(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm( "{.reg .b32 f, one, zero;\n" + " mov.b32 one, 0x3f803f80U;\n" + " mov.b32 zero, 0;\n" + " fma.rn.bf16x2 f,%1,one,%2;\n" + " max.bf16x2 f, f, zero;\n" + " min.bf16x2 %0, f, one;\n}" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +, + val.x = __hadd_sat(a.x, b.x); + val.y = __hadd_sat(a.y, b.y); +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hsub2_sat(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm( "{.reg .b32 f, one, zero, mone;\n" + " mov.b32 one, 0x3f803f80U;\n" + " mov.b32 zero, 0;\n" + " mov.b32 mone, 0xbf80bf80U;\n" + " fma.rn.bf16x2 f,%2,mone,%1;\n" + " max.bf16x2 f, f, zero;\n" + " min.bf16x2 %0, f, one;\n}" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +, + val.x = __hsub_sat(a.x, b.x); + val.y = __hsub_sat(a.y, b.y); +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmul2_sat(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ + __nv_bfloat162 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm( "{.reg .b32 f, one, zero, mzero;\n" + " mov.b32 one, 0x3f803f80U;\n" + " mov.b32 zero, 0;\n" + " mov.b32 mzero, 0x80008000U;\n" + " fma.rn.bf16x2 f,%1,%2,mzero;\n" + " max.bf16x2 f, f, zero;\n" + " min.bf16x2 %0, f, one;\n}" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); +, + val.x = __hmul_sat(a.x, b.x); + val.y = __hmul_sat(a.y, b.y); +) + return val; +} +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat162 __hfma2(const __nv_bfloat162 a, const __nv_bfloat162 b, const __nv_bfloat162 c) +{ + __nv_bfloat162 val; + asm( "{fma.rn.bf16x2 %0,%1,%2,%3;\n}" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b)),"r"(__BFLOAT162_TO_CUI(c))); + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat162 __hfma2_sat(const __nv_bfloat162 a, const __nv_bfloat162 b, const __nv_bfloat162 c) +{ + __nv_bfloat162 val; + asm( "{ .reg .b32 f, one, zero;\n" + " mov.b32 one, 0x3f803f80U;\n" + " mov.b32 zero, 0;\n" + " fma.rn.bf16x2 f, %1, %2, %3;\n" + " max.bf16x2 f, f, zero;\n" + " min.bf16x2 %0, f, one;\n}" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b)),"r"(__BFLOAT162_TO_CUI(c))); + return val; +} +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __h2div(const __nv_bfloat162 a, const __nv_bfloat162 b) { + __nv_bfloat16 ha, hb; + + ha = __low2bfloat16(a); + hb = __low2bfloat16(b); + + const __nv_bfloat16 v1 = __hdiv(ha, hb); + + ha = __high2bfloat16(a); + hb = __high2bfloat16(b); + + const __nv_bfloat16 v2 = __hdiv(ha, hb); + + return __halves2bfloat162(v1, v2); +} +/****************************************************************************** +* __nv_bfloat16 arithmetic * +******************************************************************************/ +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_sm80_device_hadd(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ add.bf16 %0,%1,%2; }\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +, + asm( "{.reg .b16 c;\n" + " mov.b16 c, 0x3f80U;\n" + " fma.rn.bf16 %0,%1,c,%2;}\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_sm80_device_hsub(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ sub.bf16 %0,%1,%2; }\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +, + asm( "{.reg .b16 c;\n" + " mov.b16 c, 0xbf80U;\n" + " fma.rn.bf16 %0,%2,c,%1;}\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_sm80_device_hmul(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ mul.bf16 %0,%1,%2; }\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +, + asm( "{.reg .b16 c;\n" + " mov.b16 c, 0x8000U;\n" + " fma.rn.bf16 %0,%1,%2,c;}\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_sm80_device_hadd_rn(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ add.rn.bf16 %0,%1,%2; }\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +, + asm( "{.reg .b16 c;\n" + " mov.b16 c, 0x3f80U;\n" + " fma.rn.bf16 %0,%1,c,%2;}\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_sm80_device_hsub_rn(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ sub.rn.bf16 %0,%1,%2; }\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +, + asm( "{.reg .b16 c;\n" + " mov.b16 c, 0xbf80U;\n" + " fma.rn.bf16 %0,%2,c,%1;}\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_sm80_device_hmul_rn(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm( "{ mul.rn.bf16 %0,%1,%2; }\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +, + asm( "{.reg .b16 c;\n" + " mov.b16 c, 0x8000U;\n" + " fma.rn.bf16 %0,%1,%2,c;}\n" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +) + return val; +} +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) */ +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_device_hadd(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + val = __internal_sm80_device_hadd(a, b); +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + // avoid ftz in device code + val = __float2bfloat16(__fmaf_ieee_rn(fa, 1.0f, fb)); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_device_hsub(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + val = __internal_sm80_device_hsub(a, b); +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + // avoid ftz in device code + val = __float2bfloat16(__fmaf_ieee_rn(fb, -1.0f, fa)); +) + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_device_hmul(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + val = __internal_sm80_device_hmul(a, b); +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + // avoid ftz in device code + val = __float2bfloat16(__fmaf_ieee_rn(fa, fb, -0.0f)); +) + return val; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hadd(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hadd(a, b); +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return __float2bfloat16(fa + fb); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hsub(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hsub(a, b); +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return __float2bfloat16(fa - fb); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmul(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hmul(a, b); +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return __float2bfloat16(fa * fb); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hadd_rn(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + return __internal_sm80_device_hadd_rn(a, b); +, + return __hadd(a, b); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hsub_rn(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + return __internal_sm80_device_hsub_rn(a, b); +, + return __hsub(a, b); + +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmul_rn(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + return __internal_sm80_device_hmul_rn(a, b); +, + return __hmul(a, b); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hadd_sat(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm( "{ .reg .b16 f, one, zero;\n" + " mov.b16 one, 0x3f80U;\n" + " mov.b16 zero, 0;\n" + " fma.rn.bf16 f, %1, one, %2;\n" + " max.bf16 f, f, zero;\n" + " min.bf16 %0, f, one;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +, + val = __hmin(__hmax(__hadd(a, b), CUDART_ZERO_BF16), CUDART_ONE_BF16); +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hsub_sat(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm( "{ .reg .b16 f, one, zero, mone;\n" + " mov.b16 one, 0x3f80U;\n" + " mov.b16 zero, 0;\n" + " mov.b16 mone, 0xbf80U;\n" + " fma.rn.bf16 f, %2, mone, %1;\n" + " max.bf16 f, f, zero;\n" + " min.bf16 %0, f, one;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +, + val = __hmin(__hmax(__hsub(a, b), CUDART_ZERO_BF16), CUDART_ONE_BF16); +) + return val; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmul_sat(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ + __nv_bfloat16 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm( "{ .reg .b16 f, one, zero, mzero;\n" + " mov.b16 one, 0x3f80U;\n" + " mov.b16 zero, 0;\n" + " mov.b16 mzero, 0x8000U;\n" + " fma.rn.bf16 f, %1, %2, mzero;\n" + " max.bf16 f, f, zero;\n" + " min.bf16 %0, f, one;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); +, + val = __hmin(__hmax(__hmul(a, b), CUDART_ZERO_BF16), CUDART_ONE_BF16); +) + return val; +} +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __hfma(const __nv_bfloat16 a, const __nv_bfloat16 b, const __nv_bfloat16 c) +{ + __nv_bfloat16 val; + asm( "{fma.rn.bf16 %0,%1,%2,%3;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b)),"h"(__BFLOAT16_TO_CUS(c))); + return val; +} +__CUDA_BF16_DECL__ __nv_bfloat16 __hfma_sat(const __nv_bfloat16 a, const __nv_bfloat16 b, const __nv_bfloat16 c) +{ + __nv_bfloat16 val; + asm( "{ .reg .b16 f, one, zero;\n" + " mov.b16 one, 0x3f80U;\n" + " mov.b16 zero, 0;\n" + " fma.rn.bf16 f, %1, %2, %3;\n" + " max.bf16 f, f, zero;\n" + " min.bf16 %0, f, one;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b)),"h"(__BFLOAT16_TO_CUS(c))); + return val; +} +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) */ +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +#define __BINARY_OP_BFLOAT16_MACRO(name) /* do */ {\ + __nv_bfloat16 val; \ + asm( "{.reg .b32 a,b,res;\n"\ + " mov.b32 a, {0,%1};\n"\ + " mov.b32 b, {0,%2};\n"\ + " " __CUDA_BF16_STRINGIFY(name) ".f32 res, a, b;\n"\ + " cvt.rn.bf16.f32 %0, res;}\n"\ + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); \ + return val; \ +} /* while(0) */ +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_device_hdiv(const __nv_bfloat16 a, const __nv_bfloat16 b) { +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __BINARY_OP_BFLOAT16_MACRO(div.rn) +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + float fr; + asm( "{ div.rn.f32 %0, %1, %2; }\n" + :"=f"(fr) : "f"(fa),"f"(fb)); + return __float2bfloat16(fr); +) +} +#undef __BINARY_OP_BFLOAT16_MACRO +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hdiv(const __nv_bfloat16 a, const __nv_bfloat16 b) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hdiv(a, b); +, + const float fa = __bfloat162float(a); + const float fb = __bfloat162float(b); + return __float2bfloat16(fa / fb); +) +} + +/****************************************************************************** +* __nv_bfloat162 functions * +******************************************************************************/ +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __hsin_internal(const __nv_bfloat16 a) { + float f = __bfloat162float(a); + float r = sinf(f); + // Detect compile-time FTZ setting: + // if subnormal constant is not flushed to zero at compile-time, then + // ftz=off, and it is safe to return result of sinf() + // Otherwise, ftz=on, then sinf() result is valid for non-flushed + // values, and subnormal input is returned unchanged via else + // branch. + if ((__uint_as_float(0x00000001U) > 0.0f) || (f != 0.0f)) + { + f = r; + } + return __float2bfloat16_rn(f); +} +__CUDA_BF16_DECL__ __nv_bfloat16 hsin(const __nv_bfloat16 a) { + return __hsin_internal(a); +} +__CUDA_BF16_DECL__ __nv_bfloat162 h2sin(const __nv_bfloat162 a) { + const __nv_bfloat16 l = __low2bfloat16(a); + const __nv_bfloat16 h = __high2bfloat16(a); + return __halves2bfloat162(__hsin_internal(l), __hsin_internal(h)); +} +__CUDA_BF16_DECL__ __nv_bfloat16 __hcos_internal(const __nv_bfloat16 a) { + float f = __bfloat162float(a); + f = cosf(f); + return __float2bfloat16_rn(f); +} +__CUDA_BF16_DECL__ __nv_bfloat16 hcos(const __nv_bfloat16 a) { + return __hcos_internal(a); +} +__CUDA_BF16_DECL__ __nv_bfloat162 h2cos(const __nv_bfloat162 a) { + const __nv_bfloat16 l = __low2bfloat16(a); + const __nv_bfloat16 h = __high2bfloat16(a); + return __halves2bfloat162(__hcos_internal(l), __hcos_internal(h)); +} + +__CUDA_BF16_DECL__ float __internal_device_fast_bf16exp(const float x) +{ + const float log2e_up = __uint_as_float(0x3FB8AA3CU); + float fa = x * log2e_up; + asm("{ ex2.approx.f32 %0, %0; }" : "+f"(fa)); + return fa; +} + +__CUDA_BF16_DECL__ __nv_bfloat16 hexp(const __nv_bfloat16 a) { + float fa = __bfloat162float(a); + fa = __internal_device_fast_bf16exp(fa); + return __float2bfloat16_rn(fa); +} + +#define __APPROX_FCAST2(fun) /* do */ {\ + __nv_bfloat162 val;\ + asm("{.reg.b16 hl, hu; \n"\ + " .reg.b32 fl, fu; \n"\ + " mov.b32 {hl, hu}, %1; \n"\ + " mov.b32 fl, {0,hl}; \n"\ + " mov.b32 fu, {0,hu}; \n"\ + " " __CUDA_BF16_STRINGIFY(fun) ".approx.f32 fl, fl; \n"\ + " " __CUDA_BF16_STRINGIFY(fun) ".approx.f32 fu, fu; \n"\ + " cvt.rn.bf16.f32 hl, fl; \n"\ + " cvt.rn.bf16.f32 hu, fu; \n"\ + " mov.b32 %0, {hl, hu}; \n"\ + "}":"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a))); \ + return val;\ +} /* while(0) */ +#define __BF16_SPEC_CASE2(i,r, spc, ulp) \ + "{.reg.b32 spc, ulp, p;\n"\ + " mov.b32 spc," __CUDA_BF16_STRINGIFY(spc) ";\n"\ + " mov.b32 ulp," __CUDA_BF16_STRINGIFY(ulp) ";\n"\ + " set.eq.f16x2.f16x2 p," __CUDA_BF16_STRINGIFY(i) ", spc;\n"\ + " fma.rn.bf16x2 " __CUDA_BF16_STRINGIFY(r) ",p,ulp," __CUDA_BF16_STRINGIFY(r) ";\n}\n" + +__CUDA_BF16_DECL__ __nv_bfloat162 h2exp(const __nv_bfloat162 a) { +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat162 val; + asm("{.reg.b16 hl, hu; \n" + " .reg.b32 h,r,fl,fu, C; \n" + " mov.b32 {hl, hu}, %1; \n" + " mov.b32 h, %1; \n" + " mov.b32 fl, {0,hl}; \n" + " mov.b32 fu, {0,hu}; \n" + " mov.b32 C, 0x3FB8AA3CU; \n" + " mul.f32 fl,fl,C; \n" + " mul.f32 fu,fu,C; \n" + " ex2.approx.f32 fl, fl; \n" + " ex2.approx.f32 fu, fu; \n" + " cvt.rn.bf16.f32 hl, fl; \n" + " cvt.rn.bf16.f32 hu, fu; \n" + " mov.b32 r, {hl, hu}; \n" + " mov.b32 %0, r; \n" + "}":"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a))); + return val; +, + return __floats2bfloat162_rn( __internal_device_fast_bf16exp(__low2float(a)), __internal_device_fast_bf16exp(__high2float(a)) ); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 hexp2(const __nv_bfloat16 a) { + float fa = __bfloat162float(a); + asm("{ ex2.approx.f32 %0, %0; }" : "+f"(fa)); + return __float2bfloat16_rn(fa); +} +__CUDA_BF16_DECL__ __nv_bfloat162 h2exp2(const __nv_bfloat162 a) { +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __APPROX_FCAST2(ex2) +, + float fl = __low2float(a); + asm("{ ex2.approx.f32 %0, %0; }" : "+f"(fl)); + float fh = __high2float(a); + asm("{ ex2.approx.f32 %0, %0; }" : "+f"(fh)); + return __floats2bfloat162_rn( fl, fh ); +) +} + +__CUDA_BF16_DECL__ __nv_bfloat16 hexp10(const __nv_bfloat16 a) { + const float log10_2 = __uint_as_float(0x40549A78U); + float fa = __bfloat162float(a) * log10_2; + asm("{ ex2.approx.f32 %0, %0; }" : "+f"(fa)); + __nv_bfloat16 r = __float2bfloat16_rn(fa); + __nv_bfloat16_raw araw = static_cast<__nv_bfloat16_raw>(a); + if (araw.x == (unsigned short)0xBC95U) + { + araw.x = 0x3f75U; + r = static_cast<__nv_bfloat16>(araw); + } + return r; +} +__CUDA_BF16_DECL__ __nv_bfloat162 h2exp10(const __nv_bfloat162 a) { + __nv_bfloat162 r; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm("{.reg.b16 hl, hu; \n" + " .reg.b32 h,r,fl,fu, C; \n" + " mov.b32 {hl, hu}, %1; \n" + " mov.b32 fl, {0,hl}; \n" + " mov.b32 fu, {0,hu}; \n" + " mov.b32 C, 0x40549A78U; \n" + " mul.f32 fl,fl,C; \n" + " mul.f32 fu,fu,C; \n" + " ex2.approx.f32 fl, fl; \n" + " ex2.approx.f32 fu, fu; \n" + " cvt.rn.bf16.f32 hl, fl; \n" + " cvt.rn.bf16.f32 hu, fu; \n" + " mov.b32 r, {hl, hu}; \n" + __BF16_SPEC_CASE2(%1, r, 0xBC95BC95U,0xBF00BF00U) + " mov.b32 %0, r; \n" + "}":"=r"(__BFLOAT162_TO_UI(r)) : "r"(__BFLOAT162_TO_CUI(a))); +, + const float log10_2 = __uint_as_float(0x40549A78U); + float fl = __low2float(a) * log10_2; + asm("{ ex2.approx.f32 %0, %0; }" : "+f"(fl)); + + float fh = __high2float(a) * log10_2; + asm("{ ex2.approx.f32 %0, %0; }" : "+f"(fh)); + + r = __floats2bfloat162_rn( fl, fh ); + + const __nv_bfloat162_raw araw = static_cast<__nv_bfloat162_raw>(a); + if (araw.x == (unsigned short)0xBC95U) + { + __nv_bfloat16_raw raw_fix; + raw_fix.x = (unsigned short)0x3f75U; + r.x = static_cast<__nv_bfloat16>(raw_fix); + } + if (araw.y == (unsigned short)0xBC95U) + { + __nv_bfloat16_raw raw_fix; + raw_fix.x = (unsigned short)0x3f75U; + r.y = static_cast<__nv_bfloat16>(raw_fix); + } +) + return r; +} + +__CUDA_BF16_DECL__ float __internal_device_fast_bf16log2(float x) +{ + asm("{ lg2.approx.f32 %0, %0; }" : "+f"(x)); + return x; +} + +__CUDA_BF16_DECL__ __nv_bfloat16 hlog2(const __nv_bfloat16 a) { + float fa = __bfloat162float(a); + fa = __internal_device_fast_bf16log2(fa); + return __float2bfloat16_rn(fa); +} + +__CUDA_BF16_DECL__ __nv_bfloat162 h2log2(const __nv_bfloat162 a) { +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __APPROX_FCAST2(lg2) +, + float fl = __low2float(a); + fl = __internal_device_fast_bf16log2(fl); + float fh = __high2float(a); + fh = __internal_device_fast_bf16log2(fh); + return __floats2bfloat162_rn( fl, fh ); +) +} + +__CUDA_BF16_DECL__ __nv_bfloat16 hlog(const __nv_bfloat16 a) { + const float flt_ln2 = __uint_as_float(0x3f317218U); + float fa = __bfloat162float(a); + fa = __internal_device_fast_bf16log2(fa); + fa = fa * flt_ln2; + return __float2bfloat16_rn(fa); +} +__CUDA_BF16_DECL__ __nv_bfloat162 h2log(const __nv_bfloat162 a) { +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat162 val; + asm("{.reg.b16 hl, hu; \n" + " .reg.b32 r, fl, fu, C, h; \n" + " mov.b32 {hl, hu}, %1; \n" + " mov.b32 h, %1; \n" + " mov.b32 fl, {0,hl}; \n" + " mov.b32 fu, {0,hu}; \n" + " lg2.approx.f32 fl, fl; \n" + " lg2.approx.f32 fu, fu; \n" + " mov.b32 C, 0x3f317218U; \n" + " mul.f32 fl,fl,C; \n" + " mul.f32 fu,fu,C; \n" + " cvt.rn.bf16.f32 hl, fl; \n" + " cvt.rn.bf16.f32 hu, fu; \n" + " mov.b32 r, {hl, hu}; \n" + " mov.b32 %0, r; \n" + "}":"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a))); + return val; +, + const float flt_ln2 = __uint_as_float(0x3f317218U); + + float fl = __low2float(a); + fl = __internal_device_fast_bf16log2(fl); + fl = fl * flt_ln2; + + float fh = __high2float(a); + fh = __internal_device_fast_bf16log2(fh); + fh = fh * flt_ln2; + + return __floats2bfloat162_rn( fl, fh ); +) +} + +__CUDA_BF16_DECL__ __nv_bfloat16 hlog10(const __nv_bfloat16 a) { + const float flt_log10_2 = __uint_as_float(0x3E9A209BU); + float fa = __bfloat162float(a); + fa = __internal_device_fast_bf16log2(fa); + fa = fa * flt_log10_2; + return __float2bfloat16_rn(fa); +} +__CUDA_BF16_DECL__ __nv_bfloat162 h2log10(const __nv_bfloat162 a) { +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat162 val; + asm("{.reg.b16 hl, hu; \n" + " .reg.b32 r, fl, fu, C, h; \n" + " mov.b32 {hl, hu}, %1; \n" + " mov.b32 h, %1; \n" + " mov.b32 fl, {0,hl}; \n" + " mov.b32 fu, {0,hu}; \n" + " lg2.approx.f32 fl, fl; \n" + " lg2.approx.f32 fu, fu; \n" + " mov.b32 C, 0x3E9A209BU; \n" + " mul.f32 fl,fl,C; \n" + " mul.f32 fu,fu,C; \n" + " cvt.rn.bf16.f32 hl, fl; \n" + " cvt.rn.bf16.f32 hu, fu; \n" + " mov.b32 r, {hl, hu}; \n" + " mov.b32 %0, r; \n" + "}":"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a))); + return val; +, + const float flt_log10_2 = __uint_as_float(0x3E9A209BU); + + float fl = __low2float(a); + fl = __internal_device_fast_bf16log2(fl); + fl = fl * flt_log10_2; + + float fh = __high2float(a); + fh = __internal_device_fast_bf16log2(fh); + fh = fh * flt_log10_2; + + return __floats2bfloat162_rn( fl, fh ); +) +} + +__CUDA_BF16_DECL__ __nv_bfloat162 h2rcp(const __nv_bfloat162 a) { + float fl = __low2float(a); + asm("{ rcp.approx.f32 %0, %0; }" : "+f"(fl)); + float fh = __high2float(a); + asm("{ rcp.approx.f32 %0, %0; }" : "+f"(fh)); + return __floats2bfloat162_rn( fl, fh ); +} +__CUDA_BF16_DECL__ __nv_bfloat16 hrcp(const __nv_bfloat16 a) { + float fa = __bfloat162float(a); + asm("{ rcp.approx.f32 %0, %0; }" : "+f"(fa)); + return __float2bfloat16_rn(fa); +} +__CUDA_BF16_DECL__ __nv_bfloat162 h2rsqrt(const __nv_bfloat162 a) { +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __APPROX_FCAST2(rsqrt) +, + float fl = __low2float(a); + asm("{ rsqrt.approx.f32 %0, %0; }" : "+f"(fl)); + float fh = __high2float(a); + asm("{ rsqrt.approx.f32 %0, %0; }" : "+f"(fh)); + return __floats2bfloat162_rn( fl, fh ); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 hrsqrt(const __nv_bfloat16 a) { + float fa = __bfloat162float(a); + asm("{ rsqrt.approx.f32 %0, %0; }" : "+f"(fa)); + return __float2bfloat16_rn(fa); +} +__CUDA_BF16_DECL__ __nv_bfloat162 h2sqrt(const __nv_bfloat162 a) { +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __APPROX_FCAST2(sqrt) +, + float fl = __low2float(a); + asm("{ sqrt.approx.f32 %0, %0; }" : "+f"(fl)); + float fh = __high2float(a); + asm("{ sqrt.approx.f32 %0, %0; }" : "+f"(fh)); + return __floats2bfloat162_rn( fl, fh ); +) +} +__CUDA_BF16_DECL__ __nv_bfloat16 hsqrt(const __nv_bfloat16 a) { + float fa = __bfloat162float(a); + asm("{ sqrt.approx.f32 %0, %0; }" : "+f"(fa)); + return __float2bfloat16_rn(fa); +} +#undef __APPROX_FCAST2 +#undef __BF16_SPEC_CASE2 + +__CUDA_BF16_DECL__ bool __internal_device_hisnan(const __nv_bfloat16 a) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 r; + asm("{set.nan.bf16.bf16 %0,%1,%1;\n}" + :"=h"(__BFLOAT16_TO_US(r)) : "h"(__BFLOAT16_TO_CUS(a))); + return __BFLOAT16_TO_CUS(r) != 0U; +, + unsigned int r; + asm( "{.reg .b32 a;\n" + " mov.b32 a, {0,%1};\n" + " set.nan.f32.f32 %0, a, a;}\n" + :"=r"(r) : "h"(__BFLOAT16_TO_CUS(a))); + return r != 0U; +) +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hisnan2(const __nv_bfloat162 a) +{ + __nv_bfloat162 r; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + asm("{set.nan.bf16x2.bf16x2 %0,%1,%1;\n}" + :"=r"(__BFLOAT162_TO_UI(r)) : "r"(__BFLOAT162_TO_CUI(a))); +, + __nv_bfloat162_raw val; + val.x = __hisnan(a.x) ? (unsigned short)0x3F80U : (unsigned short)0U; + val.y = __hisnan(a.y) ? (unsigned short)0x3F80U : (unsigned short)0U; + r = __nv_bfloat162(val); +) + return r; +} +__CUDA_HOSTDEVICE_BF16_DECL__ bool __hisnan(const __nv_bfloat16 a) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hisnan(a); +, + const __nv_bfloat16_raw hr = static_cast<__nv_bfloat16_raw>(a); + return ((hr.x & 0x7FFFU) > 0x7F80U); +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hneg2(const __nv_bfloat162 a) +{ + __nv_bfloat162 r; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm("{neg.bf16x2 %0,%1;\n}" + :"=r"(__BFLOAT162_TO_UI(r)) : "r"(__BFLOAT162_TO_CUI(a))); +, + r.x = __hneg(a.x); + r.y = __hneg(a.y); +) + return r; +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __internal_device_hneg(const __nv_bfloat16 a) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat16 r; + asm("{neg.bf16 %0,%1;\n}" + :"=h"(__BFLOAT16_TO_US(r)) : "h"(__BFLOAT16_TO_CUS(a))); + return r; +, + const float fa = __bfloat162float(a); + return __float2bfloat16(__fmaf_ieee_rn(fa, -1.0f, -0.0f)); +) +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hneg(const __nv_bfloat16 a) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hneg(a); +, + const float fa = __bfloat162float(a); + return __float2bfloat16(-fa); +) +} + +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __habs2(const __nv_bfloat162 a) +{ + __nv_bfloat162 r; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm("{abs.bf16x2 %0,%1;\n}" + :"=r"(__BFLOAT162_TO_UI(r)) : "r"(__BFLOAT162_TO_CUI(a))); +, + r.x = __habs(a.x); + r.y = __habs(a.y); +) + return r; +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __habs(const __nv_bfloat16 a) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat16 r; + asm("{abs.bf16 %0,%1;\n}" + :"=h"(__BFLOAT16_TO_US(r)) : "h"(__BFLOAT16_TO_CUS(a))); + return r; +, + __nv_bfloat16_raw abs_a_raw = static_cast<__nv_bfloat16_raw>(a); + abs_a_raw.x &= (unsigned short)0x7FFFU; + if (abs_a_raw.x > (unsigned short)0x7F80U) + { + // return canonical NaN + abs_a_raw.x = (unsigned short)0x7FFFU; + } + return static_cast<__nv_bfloat16>(abs_a_raw); +) +} + +/****************************************************************************** +* __nv_bfloat16 arithmetic * +******************************************************************************/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmax(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat16 val; + asm( "{ max.bf16 %0,%1,%2;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); + return val; +, + __nv_bfloat16 maxval; + + maxval = (__hge(a, b) || __hisnan(b)) ? a : b; + + if (__hisnan(maxval)) + { + // if both inputs are NaN, return canonical NaN + maxval = CUDART_NAN_BF16; + } + else if (__heq(a, b)) + { + // hmax(+0.0, -0.0) = +0.0 + // unsigned compare 0x8000U > 0x0000U + __nv_bfloat16_raw ra = __nv_bfloat16_raw(a); + __nv_bfloat16_raw rb = __nv_bfloat16_raw(b); + maxval = (ra.x > rb.x) ? b : a; + } + + return maxval; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmin(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat16 val; + asm( "{ min.bf16 %0,%1,%2;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); + return val; +, + __nv_bfloat16 minval; + + minval = (__hle(a, b) || __hisnan(b)) ? a : b; + + if (__hisnan(minval)) + { + // if both inputs are NaN, return canonical NaN + minval = CUDART_NAN_BF16; + } + else if (__heq(a, b)) + { + // hmin(+0.0, -0.0) = -0.0 + // unsigned compare 0x8000U > 0x0000U + __nv_bfloat16_raw ra = __nv_bfloat16_raw(a); + __nv_bfloat16_raw rb = __nv_bfloat16_raw(b); + minval = (ra.x > rb.x) ? a : b; + } + + return minval; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmax_nan(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat16 val; + asm( "{ max.NaN.bf16 %0,%1,%2;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); + return val; +, + __nv_bfloat16 maxval; + + if (__hisnan(a) || __hisnan(b)) + { + // if either input is NaN, return canonical NaN + maxval = CUDART_NAN_BF16; + } + else + { + maxval = __hge(a, b) ? a : b; + } + + return maxval; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat16 __hmin_nan(const __nv_bfloat16 a, const __nv_bfloat16 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat16 val; + asm( "{ min.NaN.bf16 %0,%1,%2;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b))); + return val; +, + __nv_bfloat16 minval; + + if (__hisnan(a) || __hisnan(b)) + { + // if either input is NaN, return canonical NaN + minval = CUDART_NAN_BF16; + } + else + { + minval = __hle(a, b) ? a : b; + } + + return minval; +) +} +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 __hfma_relu(const __nv_bfloat16 a, const __nv_bfloat16 b, const __nv_bfloat16 c) +{ + __nv_bfloat16 val; + asm( "{ fma.rn.relu.bf16 %0,%1,%2,%3;\n}" + :"=h"(__BFLOAT16_TO_US(val)) : "h"(__BFLOAT16_TO_CUS(a)),"h"(__BFLOAT16_TO_CUS(b)),"h"(__BFLOAT16_TO_CUS(c))); + return val; +} +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) */ +/****************************************************************************** +* __nv_bfloat162 arithmetic * +******************************************************************************/ +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmax2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat162 val; + asm( "{ max.bf16x2 %0,%1,%2;\n}" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); + return val; +, + __nv_bfloat162 val; + val.x = __hmax(a.x, b.x); + val.y = __hmax(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmin2(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat162 val; + asm( "{ min.bf16x2 %0,%1,%2;\n}" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); + return val; +, + __nv_bfloat162 val; + val.x = __hmin(a.x, b.x); + val.y = __hmin(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmax2_nan(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat162 val; + asm( "{ max.NaN.bf16x2 %0,%1,%2;\n}" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); + return val; +, + __nv_bfloat162 val; + val.x = __hmax_nan(a.x, b.x); + val.y = __hmax_nan(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_BF16_DECL__ __nv_bfloat162 __hmin2_nan(const __nv_bfloat162 a, const __nv_bfloat162 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __nv_bfloat162 val; + asm( "{ min.NaN.bf16x2 %0,%1,%2;\n}" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b))); + return val; +, + __nv_bfloat162 val; + val.x = __hmin_nan(a.x, b.x); + val.y = __hmin_nan(a.y, b.y); + return val; +) +} +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat162 __hfma2_relu(const __nv_bfloat162 a, const __nv_bfloat162 b, const __nv_bfloat162 c) +{ + __nv_bfloat162 val; + asm( "{ fma.rn.relu.bf16x2 %0,%1,%2,%3;\n}" + :"=r"(__BFLOAT162_TO_UI(val)) : "r"(__BFLOAT162_TO_CUI(a)),"r"(__BFLOAT162_TO_CUI(b)),"r"(__BFLOAT162_TO_CUI(c))); + return val; +} + +__CUDA_BF16_DECL__ __nv_bfloat162 __hcmadd(const __nv_bfloat162 a, const __nv_bfloat162 b, const __nv_bfloat162 c) +{ + // fast version of complex multiply-accumulate + // (a.re, a.im) * (b.re, b.im) + (c.re, c.im) + // acc.re = (c.re + a.re*b.re) - a.im*b.im + // acc.im = (c.im + a.re*b.im) + a.im*b.re + __nv_bfloat16 real_tmp = __hfma(a.x, b.x, c.x); + __nv_bfloat16 img_tmp = __hfma(a.x, b.y, c.y); + real_tmp = __hfma(__hneg(a.y), b.y, real_tmp); + img_tmp = __hfma(a.y, b.x, img_tmp); + return make_bfloat162(real_tmp, img_tmp); +} +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 800))) || defined(_NVHPC_CUDA) */ + +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/* Define __PTR for atomicAdd prototypes below, undef after done */ +#if (defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) || defined(__CUDACC_RTC__) +#define __PTR "l" +#else +#define __PTR "r" +#endif /*(defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) || defined(__CUDACC_RTC__)*/ + +__CUDA_BF16_DECL__ __nv_bfloat162 atomicAdd(__nv_bfloat162 *const address, const __nv_bfloat162 val) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat162 r; + asm volatile ("{ atom.add.noftz.bf16x2 %0,[%1],%2; }\n" + : "=r"(__BFLOAT162_TO_UI(r)) : __PTR(address), "r"(__BFLOAT162_TO_CUI(val)) + : "memory"); + return r; +, + unsigned int* address_as_uint = (unsigned int*)address; + unsigned int old = *address_as_uint; + unsigned int assumed; + do { + assumed = old; + __nv_bfloat162 new_val = __hadd2(val, *(__nv_bfloat162*)&assumed); + old = atomicCAS(address_as_uint, assumed, *(unsigned int*)&new_val); + } while (assumed != old); + return *(__nv_bfloat162*)&old; +) +} + +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 700))) || defined(_NVHPC_CUDA) +__CUDA_BF16_DECL__ __nv_bfloat16 atomicAdd(__nv_bfloat16 *const address, const __nv_bfloat16 val) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + __nv_bfloat16 r; + asm volatile ("{ atom.add.noftz.bf16 %0,[%1],%2; }\n" + : "=h"(__BFLOAT16_TO_US(r)) + : __PTR(address), "h"(__BFLOAT16_TO_CUS(val)) + : "memory"); + return r; +, + unsigned short int* address_as_us = (unsigned short int*)address; + unsigned short int old = *address_as_us; + unsigned short int assumed; + do { + assumed = old; + old = atomicCAS(address_as_us, assumed, + __bfloat16_as_ushort(__hadd(val, __ushort_as_bfloat16(assumed)))); + } while (assumed != old); + return __ushort_as_bfloat16(old); +) +} +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 700))) || defined(_NVHPC_CUDA) */ + +#undef __PTR +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +#endif /* defined(__cplusplus) */ + +#undef __CUDA_HOSTDEVICE_BF16_DECL__ +#undef __CUDA_BF16_DECL__ +#undef __CUDA_BF16_CONSTEXPR__ + +#if defined(__CPP_VERSION_AT_LEAST_11_BF16) +#undef __CPP_VERSION_AT_LEAST_11_BF16 +#endif /* defined(__CPP_VERSION_AT_LEAST_11_BF16) */ + +#endif /* end of include guard: __CUDA_BF16_HPP__ */ diff --git a/cuda_toolkit/include/cuda_d3d10_interop.h b/cuda_toolkit/include/cuda_d3d10_interop.h new file mode 100644 index 0000000000000000000000000000000000000000..2ec709f6415cd84e151f7e943e1b7073eb0f41e2 --- /dev/null +++ b/cuda_toolkit/include/cuda_d3d10_interop.h @@ -0,0 +1,727 @@ +/* + * Copyright 1993-2012 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_D3D10_INTEROP_H__) +#define __CUDA_D3D10_INTEROP_H__ + +#include "cuda_runtime_api.h" + +/** \cond impl_private */ +#if !defined(__dv) + +#if defined(__cplusplus) + +#define __dv(v) \ + = v + +#else /* __cplusplus */ + +#define __dv(v) + +#endif /* __cplusplus */ + +#endif /* !__dv */ +/** \endcond impl_private */ + +#include + +/** \cond impl_private */ +#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif +/** \endcond impl_private */ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/** + * \addtogroup CUDART_D3D10 Direct3D 10 Interoperability + * This section describes the Direct3D 10 interoperability functions of the CUDA + * runtime application programming interface. Note that mapping of Direct3D 10 + * resources is performed with the graphics API agnostic, resource mapping + * interface described in \ref CUDART_INTEROP "Graphics Interopability". + * + * @{ + */ + +/** + * CUDA devices corresponding to a D3D10 device + */ +enum cudaD3D10DeviceList +{ + cudaD3D10DeviceListAll = 1, /**< The CUDA devices for all GPUs used by a D3D10 device */ + cudaD3D10DeviceListCurrentFrame = 2, /**< The CUDA devices for the GPUs used by a D3D10 device in its currently rendering frame */ + cudaD3D10DeviceListNextFrame = 3 /**< The CUDA devices for the GPUs to be used by a D3D10 device in the next frame */ +}; + +/** + * \brief Registers a Direct3D 10 resource for access by CUDA + * + * Registers the Direct3D 10 resource \p pD3DResource for access by CUDA. + * + * If this call is successful, then the application will be able to map and + * unmap this resource until it is unregistered through + * ::cudaGraphicsUnregisterResource(). Also on success, this call will increase the + * internal reference count on \p pD3DResource. This reference count will be + * decremented when this resource is unregistered through + * ::cudaGraphicsUnregisterResource(). + * + * This call potentially has a high-overhead and should not be called every frame + * in interactive applications. + * + * The type of \p pD3DResource must be one of the following. + * + * - ::ID3D10Buffer: may be accessed via a device pointer + * - ::ID3D10Texture1D: individual subresources of the texture may be accessed via arrays + * - ::ID3D10Texture2D: individual subresources of the texture may be accessed via arrays + * - ::ID3D10Texture3D: individual subresources of the texture may be accessed via arrays + * + * The \p flags argument may be used to specify additional parameters at register + * time. The valid values for this parameter are + * + * - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this + * resource will be used. + * - ::cudaGraphicsRegisterFlagsSurfaceLoadStore: Specifies that CUDA will + * bind this resource to a surface reference. + * - ::cudaGraphicsRegisterFlagsTextureGather: Specifies that CUDA will perform + * texture gather operations on this resource. + * + * Not all Direct3D resources of the above types may be used for + * interoperability with CUDA. The following are some limitations. + * + * - The primary rendertarget may not be registered with CUDA. + * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, + * or 32-bit integer or floating-point data cannot be shared. + * - Surfaces of depth or stencil formats cannot be shared. + * + * A complete list of supported DXGI formats is as follows. For compactness the + * notation A_{B,C,D} represents A_B, A_C, and A_D. + * - DXGI_FORMAT_A8_UNORM + * - DXGI_FORMAT_B8G8R8A8_UNORM + * - DXGI_FORMAT_B8G8R8X8_UNORM + * - DXGI_FORMAT_R16_FLOAT + * - DXGI_FORMAT_R16G16B16A16_{FLOAT,SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R16G16_{FLOAT,SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R16_{SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R32_FLOAT + * - DXGI_FORMAT_R32G32B32A32_{FLOAT,SINT,UINT} + * - DXGI_FORMAT_R32G32_{FLOAT,SINT,UINT} + * - DXGI_FORMAT_R32_{SINT,UINT} + * - DXGI_FORMAT_R8G8B8A8_{SINT,SNORM,UINT,UNORM,UNORM_SRGB} + * - DXGI_FORMAT_R8G8_{SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R8_{SINT,SNORM,UINT,UNORM} + * + * If \p pD3DResource is of incorrect type or is already registered, then + * ::cudaErrorInvalidResourceHandle is returned. + * If \p pD3DResource cannot be registered, then ::cudaErrorUnknown is returned. + * + * \param resource - Pointer to returned resource handle + * \param pD3DResource - Direct3D resource to register + * \param flags - Parameters for resource registration + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsMapResources, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuGraphicsD3D10RegisterResource + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsD3D10RegisterResource(struct cudaGraphicsResource **resource, ID3D10Resource *pD3DResource, unsigned int flags); + +/** + * \brief Gets the device number for an adapter + * + * Returns in \p *device the CUDA-compatible device corresponding to the + * adapter \p pAdapter obtained from ::IDXGIFactory::EnumAdapters. This call + * will succeed only if a device on adapter \p pAdapter is CUDA-compatible. + * + * \param device - Returns the device corresponding to pAdapter + * \param pAdapter - D3D10 adapter to get device for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsD3D10RegisterResource, + * ::cuD3D10GetDevice + */ +extern __host__ cudaError_t CUDARTAPI cudaD3D10GetDevice(int *device, IDXGIAdapter *pAdapter); + +/** + * \brief Gets the CUDA devices corresponding to a Direct3D 10 device + * + * Returns in \p *pCudaDeviceCount the number of CUDA-compatible devices corresponding + * to the Direct3D 10 device \p pD3D10Device. + * Also returns in \p *pCudaDevices at most \p cudaDeviceCount of the the CUDA-compatible devices + * corresponding to the Direct3D 10 device \p pD3D10Device. + * + * If any of the GPUs being used to render \p pDevice are not CUDA capable then the + * call will return ::cudaErrorNoDevice. + * + * \param pCudaDeviceCount - Returned number of CUDA devices corresponding to \p pD3D10Device + * \param pCudaDevices - Returned CUDA devices corresponding to \p pD3D10Device + * \param cudaDeviceCount - The size of the output device array \p pCudaDevices + * \param pD3D10Device - Direct3D 10 device to query for CUDA devices + * \param deviceList - The set of devices to return. This set may be + * ::cudaD3D10DeviceListAll for all devices, + * ::cudaD3D10DeviceListCurrentFrame for the devices used to + * render the current frame (in SLI), or + * ::cudaD3D10DeviceListNextFrame for the devices used to + * render the next frame (in SLI). + * + * \return + * ::cudaSuccess, + * ::cudaErrorNoDevice, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsMapResources, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuD3D10GetDevices + */ +extern __host__ cudaError_t CUDARTAPI cudaD3D10GetDevices(unsigned int *pCudaDeviceCount, int *pCudaDevices, unsigned int cudaDeviceCount, ID3D10Device *pD3D10Device, enum cudaD3D10DeviceList deviceList); + +/** @} */ /* END CUDART_D3D10 */ + +/** + * \addtogroup CUDART_D3D10_DEPRECATED Direct3D 10 Interoperability [DEPRECATED] + * This section describes deprecated Direct3D 10 interoperability functions. + * + * @{ + */ + +/** + * CUDA D3D10 Register Flags + */ +enum cudaD3D10RegisterFlags +{ + cudaD3D10RegisterFlagsNone = 0, /**< Default; Resource can be accessed through a void* */ + cudaD3D10RegisterFlagsArray = 1 /**< Resource can be accessed through a CUarray* */ +}; + +/** + * CUDA D3D10 Map Flags + */ +enum cudaD3D10MapFlags +{ + cudaD3D10MapFlagsNone = 0, /**< Default; Assume resource can be read/written */ + cudaD3D10MapFlagsReadOnly = 1, /**< CUDA kernels will not write to this resource */ + cudaD3D10MapFlagsWriteDiscard = 2 /**< CUDA kernels will only write to and will not read from this resource */ +}; + +/** + * \brief Gets the Direct3D device against which the current CUDA context was + * created + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA device with a D3D10 + * device in order to achieve maximum interoperability performance. + * + * \param ppD3D10Device - Returns the Direct3D device for this thread + * + * \return + * ::cudaSuccess, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaD3D10SetDirect3DDevice + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10GetDirect3DDevice(ID3D10Device **ppD3D10Device); + +/** + * \brief Sets the Direct3D 10 device to use for interoperability with + * a CUDA device + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA device with a D3D10 + * device in order to achieve maximum interoperability performance. + * + * This function will immediately initialize the primary context on + * \p device if needed. + * + * \param pD3D10Device - Direct3D device to use for interoperability + * \param device - The CUDA device to use. This device must be among the devices + * returned when querying ::cudaD3D10DeviceListAll from ::cudaD3D10GetDevices, + * may be set to -1 to automatically select an appropriate CUDA device. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInitializationError, + * ::cudaErrorInvalidValue, + * ::cudaErrorSetOnActiveProcess + * \notefnerr + * + * \sa + * ::cudaD3D10GetDevice, + * ::cudaGraphicsD3D10RegisterResource, + * ::cudaDeviceReset + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10SetDirect3DDevice(ID3D10Device *pD3D10Device, int device __dv(-1)); + +/** + * \brief Registers a Direct3D 10 resource for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Registers the Direct3D resource \p pResource for access by CUDA. + * + * If this call is successful, then the application will be able to map and + * unmap this resource until it is unregistered through + * ::cudaD3D10UnregisterResource(). Also on success, this call will increase + * the internal reference count on \p pResource. This reference count will be + * decremented when this resource is unregistered through + * ::cudaD3D10UnregisterResource(). + * + * This call potentially has a high-overhead and should not be called every frame + * in interactive applications. + * + * The type of \p pResource must be one of the following: + * + * - ::ID3D10Buffer: Cannot be used with \p flags set to + * \p cudaD3D10RegisterFlagsArray. + * - ::ID3D10Texture1D: No restrictions. + * - ::ID3D10Texture2D: No restrictions. + * - ::ID3D10Texture3D: No restrictions. + * + * The \p flags argument specifies the mechanism through which CUDA will + * access the Direct3D resource. The following values are allowed. + * + * - ::cudaD3D10RegisterFlagsNone: Specifies that CUDA will access this + * resource through a \p void*. The pointer, size, and pitch for each + * subresource of this resource may be queried through + * ::cudaD3D10ResourceGetMappedPointer(), ::cudaD3D10ResourceGetMappedSize(), + * and ::cudaD3D10ResourceGetMappedPitch() respectively. This option is valid + * for all resource types. + * - ::cudaD3D10RegisterFlagsArray: Specifies that CUDA will access this + * resource through a \p CUarray queried on a sub-resource basis through + * ::cudaD3D10ResourceGetMappedArray(). This option is only valid for resources + * of type ::ID3D10Texture1D, ::ID3D10Texture2D, and ::ID3D10Texture3D. + * + * Not all Direct3D resources of the above types may be used for + * interoperability with CUDA. The following are some limitations. + * + * - The primary rendertarget may not be registered with CUDA. + * - Resources allocated as shared may not be registered with CUDA. + * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, + * or 32-bit integer or floating-point data cannot be shared. + * - Surfaces of depth or stencil formats cannot be shared. + * + * If Direct3D interoperability is not initialized on this context then + * ::cudaErrorInvalidDevice is returned. If \p pResource is of incorrect type + * or is already registered then ::cudaErrorInvalidResourceHandle is returned. + * If \p pResource cannot be registered then ::cudaErrorUnknown is returned. + * + * \param pResource - Resource to register + * \param flags - Parameters for resource registration + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa ::cudaGraphicsD3D10RegisterResource + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10RegisterResource(ID3D10Resource *pResource, unsigned int flags); + +/** + * \brief Unregisters a Direct3D resource + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unregisters the Direct3D resource \p resource so it is not accessible by + * CUDA unless registered again. + * + * If \p pResource is not registered, then ::cudaErrorInvalidResourceHandle + * is returned. + * + * \param pResource - Resource to unregister + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa ::cudaGraphicsUnregisterResource + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10UnregisterResource(ID3D10Resource *pResource); + +/** + * \brief Maps Direct3D Resources for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Maps the \p count Direct3D resources in \p ppResources for access by CUDA. + * + * The resources in \p ppResources may be accessed in CUDA kernels until they + * are unmapped. Direct3D should not access any resources while they are + * mapped by CUDA. If an application does so, the results are undefined. + * + * This function provides the synchronization guarantee that any Direct3D + * calls issued before ::cudaD3D10MapResources() will complete before any CUDA + * kernels issued after ::cudaD3D10MapResources() begin. + * + * If any of \p ppResources have not been registered for use with CUDA or if + * \p ppResources contains any duplicate entries then ::cudaErrorInvalidResourceHandle + * is returned. If any of \p ppResources are presently mapped for access by + * CUDA then ::cudaErrorUnknown is returned. + * + * \param count - Number of resources to map for CUDA + * \param ppResources - Resources to map for CUDA + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa ::cudaGraphicsMapResources + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10MapResources(int count, ID3D10Resource **ppResources); + +/** + * \brief Unmaps Direct3D resources + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unmaps the \p count Direct3D resource in \p ppResources. + * + * This function provides the synchronization guarantee that any CUDA kernels + * issued before ::cudaD3D10UnmapResources() will complete before any Direct3D + * calls issued after ::cudaD3D10UnmapResources() begin. + * + * If any of \p ppResources have not been registered for use with CUDA or if + * \p ppResources contains any duplicate entries, then + * ::cudaErrorInvalidResourceHandle is returned. If any of \p ppResources are + * not presently mapped for access by CUDA then ::cudaErrorUnknown is returned. + * + * \param count - Number of resources to unmap for CUDA + * \param ppResources - Resources to unmap for CUDA + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa ::cudaGraphicsUnmapResources + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10UnmapResources(int count, ID3D10Resource **ppResources); + +/** + * \brief Gets an array through which to access a subresource of a Direct3D + * resource which has been mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *ppArray an array through which the subresource of the mapped + * Direct3D resource \p pResource which corresponds to \p subResource may be + * accessed. The value set in \p ppArray may change every time that + * \p pResource is mapped. + * + * If \p pResource is not registered, then ::cudaErrorInvalidResourceHandle is + * returned. If \p pResource was not registered with usage flags + * ::cudaD3D10RegisterFlagsArray, then ::cudaErrorInvalidResourceHandle is + * returned. If \p pResource is not mapped then ::cudaErrorUnknown is returned. + * + * For usage requirements of the \p subResource parameter, see + * ::cudaD3D10ResourceGetMappedPointer(). + * + * \param ppArray - Returned array corresponding to subresource + * \param pResource - Mapped resource to access + * \param subResource - Subresource of pResource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa ::cudaGraphicsSubResourceGetMappedArray + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceGetMappedArray(cudaArray **ppArray, ID3D10Resource *pResource, unsigned int subResource); + +/** + * \brief Set usage flags for mapping a Direct3D resource + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Set usage flags for mapping the Direct3D resource \p pResource. + * + * Changes to flags will take effect the next time \p pResource is mapped. + * The \p flags argument may be any of the following: + * + * - ::cudaD3D10MapFlagsNone: Specifies no hints about how this resource will + * be used. It is therefore assumed that this resource will be read from and + * written to by CUDA kernels. This is the default value. + * - ::cudaD3D10MapFlagsReadOnly: Specifies that CUDA kernels which access + * this resource will not write to this resource. + * - ::cudaD3D10MapFlagsWriteDiscard: Specifies that CUDA kernels which access + * this resource will not read from this resource and will write over the + * entire contents of the resource, so none of the data previously stored in + * the resource will be preserved. + * + * If \p pResource has not been registered for use with CUDA then + * ::cudaErrorInvalidHandle is returned. If \p pResource is presently mapped + * for access by CUDA then ::cudaErrorUnknown is returned. + * + * \param pResource - Registered resource to set flags for + * \param flags - Parameters for resource mapping + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown, + * \notefnerr + * + * \sa ::cudaGraphicsResourceSetMapFlags + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceSetMapFlags(ID3D10Resource *pResource, unsigned int flags); + +/** + * \brief Gets the dimensions of a registered Direct3D surface + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pWidth, \p *pHeight, and \p *pDepth the dimensions of the + * subresource of the mapped Direct3D resource \p pResource which corresponds + * to \p subResource. + * + * Since anti-aliased surfaces may have multiple samples per pixel, it is + * possible that the dimensions of a resource will be an integer factor larger + * than the dimensions reported by the Direct3D runtime. + * + * The parameters \p pWidth, \p pHeight, and \p pDepth are optional. For 2D + * surfaces, the value returned in \p *pDepth will be 0. + * + * If \p pResource is not of type ::ID3D10Texture1D, ::ID3D10Texture2D, or + * ::ID3D10Texture3D, or if \p pResource has not been registered for use with + * CUDA, then ::cudaErrorInvalidHandle is returned. + + * For usage requirements of \p subResource parameters see + * ::cudaD3D10ResourceGetMappedPointer(). + * + * \param pWidth - Returned width of surface + * \param pHeight - Returned height of surface + * \param pDepth - Returned depth of surface + * \param pResource - Registered resource to access + * \param subResource - Subresource of pResource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * \notefnerr + * + * \sa ::cudaGraphicsSubResourceGetMappedArray + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceGetSurfaceDimensions(size_t *pWidth, size_t *pHeight, size_t *pDepth, ID3D10Resource *pResource, unsigned int subResource); + +/** + * \brief Gets a pointer through which to access a subresource of a Direct3D + * resource which has been mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pPointer the base pointer of the subresource of the mapped + * Direct3D resource \p pResource which corresponds to \p subResource. The + * value set in \p pPointer may change every time that \p pResource is mapped. + * + * If \p pResource is not registered, then ::cudaErrorInvalidResourceHandle is + * returned. If \p pResource was not registered with usage flags + * ::cudaD3D9RegisterFlagsNone, then ::cudaErrorInvalidResourceHandle is + * returned. If \p pResource is not mapped then ::cudaErrorUnknown is returned. + * + * If \p pResource is of type ::ID3D10Buffer then \p subResource must be 0. + * If \p pResource is of any other type, then the value of \p subResource must + * come from the subresource calculation in ::D3D10CalcSubResource(). + * + * \param pPointer - Returned pointer corresponding to subresource + * \param pResource - Mapped resource to access + * \param subResource - Subresource of pResource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa ::cudaGraphicsResourceGetMappedPointer + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceGetMappedPointer(void **pPointer, ID3D10Resource *pResource, unsigned int subResource); + +/** + * \brief Gets the size of a subresource of a Direct3D resource which has been + * mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pSize the size of the subresource of the mapped Direct3D + * resource \p pResource which corresponds to \p subResource. The value set in + * \p pSize may change every time that \p pResource is mapped. + * + * If \p pResource has not been registered for use with CUDA then + * ::cudaErrorInvalidHandle is returned. If \p pResource was not registered + * with usage flags ::cudaD3D10RegisterFlagsNone, then + * ::cudaErrorInvalidResourceHandle is returned. If \p pResource is not mapped for + * access by CUDA then ::cudaErrorUnknown is returned. + * + * For usage requirements of the \p subResource parameter see + * ::cudaD3D10ResourceGetMappedPointer(). + * + * \param pSize - Returned size of subresource + * \param pResource - Mapped resource to access + * \param subResource - Subresource of pResource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa ::cudaGraphicsResourceGetMappedPointer + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceGetMappedSize(size_t *pSize, ID3D10Resource *pResource, unsigned int subResource); + +/** + * \brief Gets the pitch of a subresource of a Direct3D resource which has been + * mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pPitch and \p *pPitchSlice the pitch and Z-slice pitch of + * the subresource of the mapped Direct3D resource \p pResource, which + * corresponds to \p subResource. The values set in \p pPitch and + * \p pPitchSlice may change every time that \p pResource is mapped. + * + * The pitch and Z-slice pitch values may be used to compute the location of a + * sample on a surface as follows. + * + * For a 2D surface, the byte offset of the sample at position \b x, \b y from + * the base pointer of the surface is: + * + * \b y * \b pitch + (bytes per pixel) * \b x + * + * For a 3D surface, the byte offset of the sample at position \b x, \b y, + * \b z from the base pointer of the surface is: + * + * \b z* \b slicePitch + \b y * \b pitch + (bytes per pixel) * \b x + * + * Both parameters \p pPitch and \p pPitchSlice are optional and may be set to + * NULL. + * + * If \p pResource is not of type ::ID3D10Texture1D, ::ID3D10Texture2D, or + * ::ID3D10Texture3D, or if \p pResource has not been registered for use with + * CUDA, then ::cudaErrorInvalidResourceHandle is returned. If \p pResource was + * not registered with usage flags ::cudaD3D10RegisterFlagsNone, then + * ::cudaErrorInvalidResourceHandle is returned. If \p pResource is not mapped + * for access by CUDA then ::cudaErrorUnknown is returned. + * + * For usage requirements of the \p subResource parameter see + * ::cudaD3D10ResourceGetMappedPointer(). + * + * \param pPitch - Returned pitch of subresource + * \param pPitchSlice - Returned Z-slice pitch of subresource + * \param pResource - Mapped resource to access + * \param subResource - Subresource of pResource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa ::cudaGraphicsSubResourceGetMappedArray + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D10ResourceGetMappedPitch(size_t *pPitch, size_t *pPitchSlice, ID3D10Resource *pResource, unsigned int subResource); + +/** @} */ /* END CUDART_D3D10_DEPRECATED */ + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#undef __dv +#undef __CUDA_DEPRECATED + +#endif /* __CUDA_D3D10_INTEROP_H__ */ diff --git a/cuda_toolkit/include/cuda_d3d11_interop.h b/cuda_toolkit/include/cuda_d3d11_interop.h new file mode 100644 index 0000000000000000000000000000000000000000..82eddbc237746b61e62460dc52ab457ff9bfdac5 --- /dev/null +++ b/cuda_toolkit/include/cuda_d3d11_interop.h @@ -0,0 +1,326 @@ +/* + * Copyright 1993-2012 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_D3D11_INTEROP_H__) +#define __CUDA_D3D11_INTEROP_H__ + +#include "cuda_runtime_api.h" + +/** \cond impl_private */ +#if !defined(__dv) + +#if defined(__cplusplus) + +#define __dv(v) \ + = v + +#else /* __cplusplus */ + +#define __dv(v) + +#endif /* __cplusplus */ + +#endif /* !__dv */ +/** \endcond impl_private */ + +#include + +/** \cond impl_private */ +#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif +/** \endcond impl_private */ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/** + * \addtogroup CUDART_D3D11 Direct3D 11 Interoperability + * This section describes the Direct3D 11 interoperability functions of the CUDA + * runtime application programming interface. Note that mapping of Direct3D 11 + * resources is performed with the graphics API agnostic, resource mapping + * interface described in \ref CUDART_INTEROP "Graphics Interopability". + * + * @{ + */ + +/** + * CUDA devices corresponding to a D3D11 device + */ +enum cudaD3D11DeviceList +{ + cudaD3D11DeviceListAll = 1, /**< The CUDA devices for all GPUs used by a D3D11 device */ + cudaD3D11DeviceListCurrentFrame = 2, /**< The CUDA devices for the GPUs used by a D3D11 device in its currently rendering frame */ + cudaD3D11DeviceListNextFrame = 3 /**< The CUDA devices for the GPUs to be used by a D3D11 device in the next frame */ +}; + +/** + * \brief Register a Direct3D 11 resource for access by CUDA + * + * Registers the Direct3D 11 resource \p pD3DResource for access by CUDA. + * + * If this call is successful, then the application will be able to map and + * unmap this resource until it is unregistered through + * ::cudaGraphicsUnregisterResource(). Also on success, this call will increase the + * internal reference count on \p pD3DResource. This reference count will be + * decremented when this resource is unregistered through + * ::cudaGraphicsUnregisterResource(). + * + * This call potentially has a high-overhead and should not be called every frame + * in interactive applications. + * + * The type of \p pD3DResource must be one of the following. + * + * - ::ID3D11Buffer: may be accessed via a device pointer + * - ::ID3D11Texture1D: individual subresources of the texture may be accessed via arrays + * - ::ID3D11Texture2D: individual subresources of the texture may be accessed via arrays + * - ::ID3D11Texture3D: individual subresources of the texture may be accessed via arrays + * + * The \p flags argument may be used to specify additional parameters at register + * time. The valid values for this parameter are + * + * - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this + * resource will be used. + * - ::cudaGraphicsRegisterFlagsSurfaceLoadStore: Specifies that CUDA will + * bind this resource to a surface reference. + * - ::cudaGraphicsRegisterFlagsTextureGather: Specifies that CUDA will perform + * texture gather operations on this resource. + * + * Not all Direct3D resources of the above types may be used for + * interoperability with CUDA. The following are some limitations. + * + * - The primary rendertarget may not be registered with CUDA. + * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, + * or 32-bit integer or floating-point data cannot be shared. + * - Surfaces of depth or stencil formats cannot be shared. + * + * A complete list of supported DXGI formats is as follows. For compactness the + * notation A_{B,C,D} represents A_B, A_C, and A_D. + * - DXGI_FORMAT_A8_UNORM + * - DXGI_FORMAT_B8G8R8A8_UNORM + * - DXGI_FORMAT_B8G8R8X8_UNORM + * - DXGI_FORMAT_R16_FLOAT + * - DXGI_FORMAT_R16G16B16A16_{FLOAT,SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R16G16_{FLOAT,SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R16_{SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R32_FLOAT + * - DXGI_FORMAT_R32G32B32A32_{FLOAT,SINT,UINT} + * - DXGI_FORMAT_R32G32_{FLOAT,SINT,UINT} + * - DXGI_FORMAT_R32_{SINT,UINT} + * - DXGI_FORMAT_R8G8B8A8_{SINT,SNORM,UINT,UNORM,UNORM_SRGB} + * - DXGI_FORMAT_R8G8_{SINT,SNORM,UINT,UNORM} + * - DXGI_FORMAT_R8_{SINT,SNORM,UINT,UNORM} + * + * If \p pD3DResource is of incorrect type or is already registered, then + * ::cudaErrorInvalidResourceHandle is returned. + * If \p pD3DResource cannot be registered, then ::cudaErrorUnknown is returned. + * + * \param resource - Pointer to returned resource handle + * \param pD3DResource - Direct3D resource to register + * \param flags - Parameters for resource registration + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsMapResources, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuGraphicsD3D11RegisterResource + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsD3D11RegisterResource(struct cudaGraphicsResource **resource, ID3D11Resource *pD3DResource, unsigned int flags); + +/** + * \brief Gets the device number for an adapter + * + * Returns in \p *device the CUDA-compatible device corresponding to the + * adapter \p pAdapter obtained from ::IDXGIFactory::EnumAdapters. This call + * will succeed only if a device on adapter \p pAdapter is CUDA-compatible. + * + * \param device - Returns the device corresponding to pAdapter + * \param pAdapter - D3D11 adapter to get device for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsMapResources, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuD3D11GetDevice + */ +extern __host__ cudaError_t CUDARTAPI cudaD3D11GetDevice(int *device, IDXGIAdapter *pAdapter); + +/** + * \brief Gets the CUDA devices corresponding to a Direct3D 11 device + * + * Returns in \p *pCudaDeviceCount the number of CUDA-compatible devices corresponding + * to the Direct3D 11 device \p pD3D11Device. + * Also returns in \p *pCudaDevices at most \p cudaDeviceCount of the the CUDA-compatible devices + * corresponding to the Direct3D 11 device \p pD3D11Device. + * + * If any of the GPUs being used to render \p pDevice are not CUDA capable then the + * call will return ::cudaErrorNoDevice. + * + * \param pCudaDeviceCount - Returned number of CUDA devices corresponding to \p pD3D11Device + * \param pCudaDevices - Returned CUDA devices corresponding to \p pD3D11Device + * \param cudaDeviceCount - The size of the output device array \p pCudaDevices + * \param pD3D11Device - Direct3D 11 device to query for CUDA devices + * \param deviceList - The set of devices to return. This set may be + * ::cudaD3D11DeviceListAll for all devices, + * ::cudaD3D11DeviceListCurrentFrame for the devices used to + * render the current frame (in SLI), or + * ::cudaD3D11DeviceListNextFrame for the devices used to + * render the next frame (in SLI). + * + * \return + * ::cudaSuccess, + * ::cudaErrorNoDevice, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsMapResources, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuD3D11GetDevices + */ +extern __host__ cudaError_t CUDARTAPI cudaD3D11GetDevices(unsigned int *pCudaDeviceCount, int *pCudaDevices, unsigned int cudaDeviceCount, ID3D11Device *pD3D11Device, enum cudaD3D11DeviceList deviceList); + +/** @} */ /* END CUDART_D3D11 */ + +/** + * \addtogroup CUDART_D3D11_DEPRECATED Direct3D 11 Interoperability [DEPRECATED] + * This section describes deprecated Direct3D 11 interoperability functions. + * + * @{ + */ + +/** + * \brief Gets the Direct3D device against which the current CUDA context was + * created + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA device with a D3D11 + * device in order to achieve maximum interoperability performance. + * + * \param ppD3D11Device - Returns the Direct3D device for this thread + * + * \return + * ::cudaSuccess, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaD3D11SetDirect3DDevice + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D11GetDirect3DDevice(ID3D11Device **ppD3D11Device); + +/** + * \brief Sets the Direct3D 11 device to use for interoperability with + * a CUDA device + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA device with a D3D11 + * device in order to achieve maximum interoperability performance. + * + * This function will immediately initialize the primary context on + * \p device if needed. + * + * \param pD3D11Device - Direct3D device to use for interoperability + * \param device - The CUDA device to use. This device must be among the devices + * returned when querying ::cudaD3D11DeviceListAll from ::cudaD3D11GetDevices, + * may be set to -1 to automatically select an appropriate CUDA device. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInitializationError, + * ::cudaErrorInvalidValue, + * ::cudaErrorSetOnActiveProcess + * \notefnerr + * + * \sa + * ::cudaD3D11GetDevice, + * ::cudaGraphicsD3D11RegisterResource, + * ::cudaDeviceReset + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D11SetDirect3DDevice(ID3D11Device *pD3D11Device, int device __dv(-1)); + +/** @} */ /* END CUDART_D3D11_DEPRECATED */ + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#undef __dv +#undef __CUDA_DEPRECATED + +#endif /* __CUDA_D3D11_INTEROP_H__ */ diff --git a/cuda_toolkit/include/cuda_d3d9_interop.h b/cuda_toolkit/include/cuda_d3d9_interop.h new file mode 100644 index 0000000000000000000000000000000000000000..b0bf60b0afd3ee26c06c865bfc323771a9a5032b --- /dev/null +++ b/cuda_toolkit/include/cuda_d3d9_interop.h @@ -0,0 +1,785 @@ +/* + * Copyright 1993-2012 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_D3D9_INTEROP_H__) +#define __CUDA_D3D9_INTEROP_H__ + +#include "cuda_runtime_api.h" + +/** \cond impl_private */ +#if !defined(__dv) + +#if defined(__cplusplus) + +#define __dv(v) \ + = v + +#else /* __cplusplus */ + +#define __dv(v) + +#endif /* __cplusplus */ + +#endif /* !__dv */ +/** \endcond impl_private */ + +#include + +/** \cond impl_private */ +#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif +/** \endcond impl_private */ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/** + * \addtogroup CUDART_D3D9 Direct3D 9 Interoperability + * This section describes the Direct3D 9 interoperability functions of the CUDA + * runtime application programming interface. Note that mapping of Direct3D 9 + * resources is performed with the graphics API agnostic, resource mapping + * interface described in \ref CUDART_INTEROP "Graphics Interopability". + * + * @{ + */ + +/** + * CUDA devices corresponding to a D3D9 device + */ +enum cudaD3D9DeviceList +{ + cudaD3D9DeviceListAll = 1, /**< The CUDA devices for all GPUs used by a D3D9 device */ + cudaD3D9DeviceListCurrentFrame = 2, /**< The CUDA devices for the GPUs used by a D3D9 device in its currently rendering frame */ + cudaD3D9DeviceListNextFrame = 3 /**< The CUDA devices for the GPUs to be used by a D3D9 device in the next frame */ +}; + +/** + * \brief Gets the Direct3D device against which the current CUDA context was + * created + * + * Returns in \p *ppD3D9Device the Direct3D device against which this CUDA + * context was created in ::cudaD3D9SetDirect3DDevice(). + * + * \param ppD3D9Device - Returns the Direct3D device for this thread + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidGraphicsContext, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaD3D9SetDirect3DDevice, + * ::cuD3D9GetDirect3DDevice + */ +extern __host__ cudaError_t CUDARTAPI cudaD3D9GetDirect3DDevice(IDirect3DDevice9 **ppD3D9Device); + +/** + * \brief Register a Direct3D 9 resource for access by CUDA + * + * Registers the Direct3D 9 resource \p pD3DResource for access by CUDA. + * + * If this call is successful then the application will be able to map and + * unmap this resource until it is unregistered through + * ::cudaGraphicsUnregisterResource(). Also on success, this call will increase the + * internal reference count on \p pD3DResource. This reference count will be + * decremented when this resource is unregistered through + * ::cudaGraphicsUnregisterResource(). + * + * This call potentially has a high-overhead and should not be called every frame + * in interactive applications. + * + * The type of \p pD3DResource must be one of the following. + * + * - ::IDirect3DVertexBuffer9: may be accessed through a device pointer + * - ::IDirect3DIndexBuffer9: may be accessed through a device pointer + * - ::IDirect3DSurface9: may be accessed through an array. + * Only stand-alone objects of type ::IDirect3DSurface9 + * may be explicitly shared. In particular, individual mipmap levels and faces + * of cube maps may not be registered directly. To access individual surfaces + * associated with a texture, one must register the base texture object. + * - ::IDirect3DBaseTexture9: individual surfaces on this texture may be accessed + * through an array. + * + * The \p flags argument may be used to specify additional parameters at register + * time. The valid values for this parameter are + * + * - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this + * resource will be used. + * - ::cudaGraphicsRegisterFlagsSurfaceLoadStore: Specifies that CUDA will + * bind this resource to a surface reference. + * - ::cudaGraphicsRegisterFlagsTextureGather: Specifies that CUDA will perform + * texture gather operations on this resource. + * + * Not all Direct3D resources of the above types may be used for + * interoperability with CUDA. The following are some limitations. + * + * - The primary rendertarget may not be registered with CUDA. + * - Resources allocated as shared may not be registered with CUDA. + * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, + * or 32-bit integer or floating-point data cannot be shared. + * - Surfaces of depth or stencil formats cannot be shared. + * + * A complete list of supported formats is as follows: + * - D3DFMT_L8 + * - D3DFMT_L16 + * - D3DFMT_A8R8G8B8 + * - D3DFMT_X8R8G8B8 + * - D3DFMT_G16R16 + * - D3DFMT_A8B8G8R8 + * - D3DFMT_A8 + * - D3DFMT_A8L8 + * - D3DFMT_Q8W8V8U8 + * - D3DFMT_V16U16 + * - D3DFMT_A16B16G16R16F + * - D3DFMT_A16B16G16R16 + * - D3DFMT_R32F + * - D3DFMT_G16R16F + * - D3DFMT_A32B32G32R32F + * - D3DFMT_G32R32F + * - D3DFMT_R16F + * + * If \p pD3DResource is of incorrect type or is already registered, then + * ::cudaErrorInvalidResourceHandle is returned. + * If \p pD3DResource cannot be registered, then ::cudaErrorUnknown is returned. + * + * \param resource - Pointer to returned resource handle + * \param pD3DResource - Direct3D resource to register + * \param flags - Parameters for resource registration + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaD3D9SetDirect3DDevice, + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsMapResources, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuGraphicsD3D9RegisterResource + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsD3D9RegisterResource(struct cudaGraphicsResource **resource, IDirect3DResource9 *pD3DResource, unsigned int flags); + +/** + * \brief Gets the device number for an adapter + * + * Returns in \p *device the CUDA-compatible device corresponding to the + * adapter name \p pszAdapterName obtained from ::EnumDisplayDevices or + * ::IDirect3D9::GetAdapterIdentifier(). If no device on the adapter with name + * \p pszAdapterName is CUDA-compatible then the call will fail. + * + * \param device - Returns the device corresponding to pszAdapterName + * \param pszAdapterName - D3D9 adapter to get device for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaD3D9SetDirect3DDevice, + * ::cudaGraphicsD3D9RegisterResource, + * ::cuD3D9GetDevice + */ +extern __host__ cudaError_t CUDARTAPI cudaD3D9GetDevice(int *device, const char *pszAdapterName); + +/** + * \brief Gets the CUDA devices corresponding to a Direct3D 9 device + * + * Returns in \p *pCudaDeviceCount the number of CUDA-compatible devices corresponding + * to the Direct3D 9 device \p pD3D9Device. + * Also returns in \p *pCudaDevices at most \p cudaDeviceCount of the the CUDA-compatible devices + * corresponding to the Direct3D 9 device \p pD3D9Device. + * + * If any of the GPUs being used to render \p pDevice are not CUDA capable then the + * call will return ::cudaErrorNoDevice. + * + * \param pCudaDeviceCount - Returned number of CUDA devices corresponding to \p pD3D9Device + * \param pCudaDevices - Returned CUDA devices corresponding to \p pD3D9Device + * \param cudaDeviceCount - The size of the output device array \p pCudaDevices + * \param pD3D9Device - Direct3D 9 device to query for CUDA devices + * \param deviceList - The set of devices to return. This set may be + * ::cudaD3D9DeviceListAll for all devices, + * ::cudaD3D9DeviceListCurrentFrame for the devices used to + * render the current frame (in SLI), or + * ::cudaD3D9DeviceListNextFrame for the devices used to + * render the next frame (in SLI). + * + * \return + * ::cudaSuccess, + * ::cudaErrorNoDevice, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsMapResources, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuD3D9GetDevices + */ +extern __host__ cudaError_t CUDARTAPI cudaD3D9GetDevices(unsigned int *pCudaDeviceCount, int *pCudaDevices, unsigned int cudaDeviceCount, IDirect3DDevice9 *pD3D9Device, enum cudaD3D9DeviceList deviceList); + +/** + * \brief Sets the Direct3D 9 device to use for interoperability with + * a CUDA device + * + * Records \p pD3D9Device as the Direct3D 9 device to use for Direct3D 9 + * interoperability with the CUDA device \p device and sets \p device as + * the current device for the calling host thread. + * + * This function will immediately initialize the primary context on + * \p device if needed. + * + * If \p device has already been initialized then this call will fail with + * the error ::cudaErrorSetOnActiveProcess. In this case it is necessary + * to reset \p device using ::cudaDeviceReset() before Direct3D 9 + * interoperability on \p device may be enabled. + * + * Successfully initializing CUDA interoperability with \p pD3D9Device + * will increase the internal reference count on \p pD3D9Device. This + * reference count will be decremented when \p device is reset using + * ::cudaDeviceReset(). + * + * Note that this function is never required for correct functionality. Use of + * this function will result in accelerated interoperability only when the + * operating system is Windows Vista or Windows 7, and the device \p pD3DDdevice + * is not an IDirect3DDevice9Ex. In all other cirumstances, this function is + * not necessary. + * + * \param pD3D9Device - Direct3D device to use for this thread + * \param device - The CUDA device to use. This device must be among the devices + * returned when querying ::cudaD3D9DeviceListAll from ::cudaD3D9GetDevices, + * may be set to -1 to automatically select an appropriate CUDA device. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInitializationError, + * ::cudaErrorInvalidValue, + * ::cudaErrorSetOnActiveProcess + * \notefnerr + * + * \sa + * ::cudaD3D9GetDevice, + * ::cudaGraphicsD3D9RegisterResource, + * ::cudaDeviceReset + */ +extern __host__ cudaError_t CUDARTAPI cudaD3D9SetDirect3DDevice(IDirect3DDevice9 *pD3D9Device, int device __dv(-1)); + +/** @} */ /* END CUDART_D3D9 */ + +/** + * \addtogroup CUDART_D3D9_DEPRECATED Direct3D 9 Interoperability [DEPRECATED] + * This section describes deprecated Direct3D 9 interoperability functions. + * + * @{ + */ + +/** + * CUDA D3D9 Register Flags + */ +enum cudaD3D9RegisterFlags +{ + cudaD3D9RegisterFlagsNone = 0, /**< Default; Resource can be accessed througa void* */ + cudaD3D9RegisterFlagsArray = 1 /**< Resource can be accessed through a CUarray* */ +}; + +/** + * CUDA D3D9 Map Flags + */ +enum cudaD3D9MapFlags +{ + cudaD3D9MapFlagsNone = 0, /**< Default; Assume resource can be read/written */ + cudaD3D9MapFlagsReadOnly = 1, /**< CUDA kernels will not write to this resource */ + cudaD3D9MapFlagsWriteDiscard = 2 /**< CUDA kernels will only write to and will not read from this resource */ +}; + +/** + * \brief Registers a Direct3D resource for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Registers the Direct3D resource \p pResource for access by CUDA. + * + * If this call is successful, then the application will be able to map and + * unmap this resource until it is unregistered through + * ::cudaD3D9UnregisterResource(). Also on success, this call will increase + * the internal reference count on \p pResource. This reference count will be + * decremented when this resource is unregistered through + * ::cudaD3D9UnregisterResource(). + * + * This call potentially has a high-overhead and should not be called every frame + * in interactive applications. + * + * The type of \p pResource must be one of the following. + * + * - ::IDirect3DVertexBuffer9: No notes. + * - ::IDirect3DIndexBuffer9: No notes. + * - ::IDirect3DSurface9: Only stand-alone objects of type ::IDirect3DSurface9 + * may be explicitly shared. In particular, individual mipmap levels and faces + * of cube maps may not be registered directly. To access individual surfaces + * associated with a texture, one must register the base texture object. + * - ::IDirect3DBaseTexture9: When a texture is registered, all surfaces + * associated with all mipmap levels of all faces of the texture will be + * accessible to CUDA. + * + * The \p flags argument specifies the mechanism through which CUDA will + * access the Direct3D resource. The following value is allowed: + * + * - ::cudaD3D9RegisterFlagsNone: Specifies that CUDA will access this + * resource through a \p void*. The pointer, size, and pitch for each + * subresource of this resource may be queried through + * ::cudaD3D9ResourceGetMappedPointer(), ::cudaD3D9ResourceGetMappedSize(), + * and ::cudaD3D9ResourceGetMappedPitch() respectively. This option is valid + * for all resource types. + * + * Not all Direct3D resources of the above types may be used for + * interoperability with CUDA. The following are some limitations: + * + * - The primary rendertarget may not be registered with CUDA. + * - Resources allocated as shared may not be registered with CUDA. + * - Any resources allocated in ::D3DPOOL_SYSTEMMEM or ::D3DPOOL_MANAGED may + * not be registered with CUDA. + * - Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, + * or 32-bit integer or floating-point data cannot be shared. + * - Surfaces of depth or stencil formats cannot be shared. + * + * If Direct3D interoperability is not initialized on this context, then + * ::cudaErrorInvalidDevice is returned. If \p pResource is of incorrect type + * (e.g, is a non-stand-alone ::IDirect3DSurface9) or is already registered, + * then ::cudaErrorInvalidResourceHandle is returned. If \p pResource cannot + * be registered then ::cudaErrorUnknown is returned. + * + * \param pResource - Resource to register + * \param flags - Parameters for resource registration + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsD3D9RegisterResource + */ +extern __host__ cudaError_t CUDARTAPI cudaD3D9RegisterResource(IDirect3DResource9 *pResource, unsigned int flags); + +/** + * \brief Unregisters a Direct3D resource for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unregisters the Direct3D resource \p pResource so it is not accessible by + * CUDA unless registered again. + * + * If \p pResource is not registered, then ::cudaErrorInvalidResourceHandle is + * returned. + * + * \param pResource - Resource to unregister + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsUnregisterResource + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9UnregisterResource(IDirect3DResource9 *pResource); + +/** + * \brief Map Direct3D resources for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Maps the \p count Direct3D resources in \p ppResources for access by CUDA. + * + * The resources in \p ppResources may be accessed in CUDA kernels until they + * are unmapped. Direct3D should not access any resources while they are + * mapped by CUDA. If an application does so, the results are undefined. + * + * This function provides the synchronization guarantee that any Direct3D + * calls issued before ::cudaD3D9MapResources() will complete before any CUDA + * kernels issued after ::cudaD3D9MapResources() begin. + * + * If any of \p ppResources have not been registered for use with CUDA or if + * \p ppResources contains any duplicate entries then + * ::cudaErrorInvalidResourceHandle is returned. If any of \p ppResources are + * presently mapped for access by CUDA then ::cudaErrorUnknown is returned. + * + * \param count - Number of resources to map for CUDA + * \param ppResources - Resources to map for CUDA + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsMapResources + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9MapResources(int count, IDirect3DResource9 **ppResources); + +/** + * \brief Unmap Direct3D resources for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unmaps the \p count Direct3D resources in \p ppResources. + * + * This function provides the synchronization guarantee that any CUDA kernels + * issued before ::cudaD3D9UnmapResources() will complete before any Direct3D + * calls issued after ::cudaD3D9UnmapResources() begin. + * + * If any of \p ppResources have not been registered for use with CUDA or if + * \p ppResources contains any duplicate entries, then + * ::cudaErrorInvalidResourceHandle is returned. If any of \p ppResources are + * not presently mapped for access by CUDA then ::cudaErrorUnknown is returned. + * + * \param count - Number of resources to unmap for CUDA + * \param ppResources - Resources to unmap for CUDA + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsUnmapResources + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9UnmapResources(int count, IDirect3DResource9 **ppResources); + +/** + * \brief Set usage flags for mapping a Direct3D resource + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Set flags for mapping the Direct3D resource \p pResource. + * + * Changes to flags will take effect the next time \p pResource is mapped. + * The \p flags argument may be any of the following: + * + * - ::cudaD3D9MapFlagsNone: Specifies no hints about how this resource will + * be used. It is therefore assumed that this resource will be read from and + * written to by CUDA kernels. This is the default value. + * - ::cudaD3D9MapFlagsReadOnly: Specifies that CUDA kernels which access this + * resource will not write to this resource. + * - ::cudaD3D9MapFlagsWriteDiscard: Specifies that CUDA kernels which access + * this resource will not read from this resource and will write over the + * entire contents of the resource, so none of the data previously stored in + * the resource will be preserved. + * + * If \p pResource has not been registered for use with CUDA, then + * ::cudaErrorInvalidResourceHandle is returned. If \p pResource is presently + * mapped for access by CUDA, then ::cudaErrorUnknown is returned. + * + * \param pResource - Registered resource to set flags for + * \param flags - Parameters for resource mapping + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaInteropResourceSetMapFlags + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceSetMapFlags(IDirect3DResource9 *pResource, unsigned int flags); + +/** + * \brief Get the dimensions of a registered Direct3D surface + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pWidth, \p *pHeight, and \p *pDepth the dimensions of the + * subresource of the mapped Direct3D resource \p pResource which corresponds + * to \p face and \p level. + * + * Since anti-aliased surfaces may have multiple samples per pixel, it is + * possible that the dimensions of a resource will be an integer factor larger + * than the dimensions reported by the Direct3D runtime. + * + * The parameters \p pWidth, \p pHeight, and \p pDepth are optional. For 2D + * surfaces, the value returned in \p *pDepth will be 0. + * + * If \p pResource is not of type ::IDirect3DBaseTexture9 or + * ::IDirect3DSurface9 or if \p pResource has not been registered for use with + * CUDA, then ::cudaErrorInvalidResourceHandle is returned. + * + * For usage requirements of \p face and \p level parameters, see + * ::cudaD3D9ResourceGetMappedPointer. + * + * \param pWidth - Returned width of surface + * \param pHeight - Returned height of surface + * \param pDepth - Returned depth of surface + * \param pResource - Registered resource to access + * \param face - Face of resource to access + * \param level - Level of resource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * \notefnerr + * + * \sa + * ::cudaGraphicsSubResourceGetMappedArray + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceGetSurfaceDimensions(size_t *pWidth, size_t *pHeight, size_t *pDepth, IDirect3DResource9 *pResource, unsigned int face, unsigned int level); + +/** + * \brief Get an array through which to access a subresource of a Direct3D + * resource which has been mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pArray an array through which the subresource of the mapped + * Direct3D resource \p pResource, which corresponds to \p face and \p level + * may be accessed. The value set in \p pArray may change every time that + * \p pResource is mapped. + * + * If \p pResource is not registered then ::cudaErrorInvalidResourceHandle is + * returned. If \p pResource was not registered with usage flags + * ::cudaD3D9RegisterFlagsArray, then ::cudaErrorInvalidResourceHandle is + * returned. If \p pResource is not mapped, then ::cudaErrorUnknown is + * returned. + * + * For usage requirements of \p face and \p level parameters, see + * ::cudaD3D9ResourceGetMappedPointer(). + * + * \param ppArray - Returned array corresponding to subresource + * \param pResource - Mapped resource to access + * \param face - Face of resource to access + * \param level - Level of resource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsSubResourceGetMappedArray + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceGetMappedArray(cudaArray **ppArray, IDirect3DResource9 *pResource, unsigned int face, unsigned int level); + +/** + * \brief Get a pointer through which to access a subresource of a Direct3D + * resource which has been mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pPointer the base pointer of the subresource of the mapped + * Direct3D resource \p pResource, which corresponds to \p face and \p level. + * The value set in \p pPointer may change every time that \p pResource is + * mapped. + * + * If \p pResource is not registered, then ::cudaErrorInvalidResourceHandle is + * returned. If \p pResource was not registered with usage flags + * ::cudaD3D9RegisterFlagsNone, then ::cudaErrorInvalidResourceHandle is + * returned. If \p pResource is not mapped, then ::cudaErrorUnknown is + * returned. + * + * If \p pResource is of type ::IDirect3DCubeTexture9, then \p face must one + * of the values enumerated by type ::D3DCUBEMAP_FACES. For all other types, + * \p face must be 0. If \p face is invalid, then ::cudaErrorInvalidValue is + * returned. + * + * If \p pResource is of type ::IDirect3DBaseTexture9, then \p level must + * correspond to a valid mipmap level. Only mipmap level 0 is supported for + * now. For all other types \p level must be 0. If \p level is invalid, then + * ::cudaErrorInvalidValue is returned. + * + * \param pPointer - Returned pointer corresponding to subresource + * \param pResource - Mapped resource to access + * \param face - Face of resource to access + * \param level - Level of resource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsResourceGetMappedPointer + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceGetMappedPointer(void **pPointer, IDirect3DResource9 *pResource, unsigned int face, unsigned int level); + +/** + * \brief Get the size of a subresource of a Direct3D resource which has been + * mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pSize the size of the subresource of the mapped Direct3D + * resource \p pResource, which corresponds to \p face and \p level. The value + * set in \p pSize may change every time that \p pResource is mapped. + * + * If \p pResource has not been registered for use with CUDA then + * ::cudaErrorInvalidResourceHandle is returned. If \p pResource was not + * registered with usage flags ::cudaD3D9RegisterFlagsNone, then + * ::cudaErrorInvalidResourceHandle is returned. If \p pResource is not mapped + * for access by CUDA then ::cudaErrorUnknown is returned. + * + * For usage requirements of \p face and \p level parameters, see + * ::cudaD3D9ResourceGetMappedPointer(). + * + * \param pSize - Returned size of subresource + * \param pResource - Mapped resource to access + * \param face - Face of resource to access + * \param level - Level of resource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsResourceGetMappedPointer + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceGetMappedSize(size_t *pSize, IDirect3DResource9 *pResource, unsigned int face, unsigned int level); + +/** + * \brief Get the pitch of a subresource of a Direct3D resource which has been + * mapped for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Returns in \p *pPitch and \p *pPitchSlice the pitch and Z-slice pitch of + * the subresource of the mapped Direct3D resource \p pResource, which + * corresponds to \p face and \p level. The values set in \p pPitch and + * \p pPitchSlice may change every time that \p pResource is mapped. + * + * The pitch and Z-slice pitch values may be used to compute the location of a + * sample on a surface as follows. + * + * For a 2D surface, the byte offset of the sample at position \b x, \b y from + * the base pointer of the surface is: + * + * \b y * \b pitch + (bytes per pixel) * \b x + * + * For a 3D surface, the byte offset of the sample at position \b x, \b y, + * \b z from the base pointer of the surface is: + * + * \b z* \b slicePitch + \b y * \b pitch + (bytes per pixel) * \b x + * + * Both parameters \p pPitch and \p pPitchSlice are optional and may be set to + * NULL. + * + * If \p pResource is not of type ::IDirect3DBaseTexture9 or one of its + * sub-types or if \p pResource has not been registered for use with CUDA, + * then ::cudaErrorInvalidResourceHandle is returned. If \p pResource was not + * registered with usage flags ::cudaD3D9RegisterFlagsNone, then + * ::cudaErrorInvalidResourceHandle is returned. If \p pResource is not mapped + * for access by CUDA then ::cudaErrorUnknown is returned. + * + * For usage requirements of \p face and \p level parameters, see + * ::cudaD3D9ResourceGetMappedPointer(). + * + * \param pPitch - Returned pitch of subresource + * \param pPitchSlice - Returned Z-slice pitch of subresource + * \param pResource - Mapped resource to access + * \param face - Face of resource to access + * \param level - Level of resource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsResourceGetMappedPointer + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9ResourceGetMappedPitch(size_t *pPitch, size_t *pPitchSlice, IDirect3DResource9 *pResource, unsigned int face, unsigned int level); + +/* D3D9 1.x interop interface */ + +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9Begin(IDirect3DDevice9 *pDevice); +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9End(void); +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9RegisterVertexBuffer(IDirect3DVertexBuffer9 *pVB); +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9UnregisterVertexBuffer(IDirect3DVertexBuffer9 *pVB); +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9MapVertexBuffer(void **dptr, IDirect3DVertexBuffer9 *pVB); +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaD3D9UnmapVertexBuffer(IDirect3DVertexBuffer9 *pVB); + +/** @} */ /* END CUDART_D3D9_DEPRECATED */ + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#undef __dv +#undef __CUDA_DEPRECATED + +#endif /* __CUDA_D3D9_INTEROP_H__ */ diff --git a/cuda_toolkit/include/cuda_device_runtime_api.h b/cuda_toolkit/include/cuda_device_runtime_api.h new file mode 100644 index 0000000000000000000000000000000000000000..4902da810e996c58b334a88929d9f9aa70147e13 --- /dev/null +++ b/cuda_toolkit/include/cuda_device_runtime_api.h @@ -0,0 +1,889 @@ +/* + * Copyright 1993-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_DEVICE_RUNTIME_API_H__) +#define __CUDA_DEVICE_RUNTIME_API_H__ + +#if defined(__CUDACC__) && !defined(__CUDACC_RTC__) +#include +#endif + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#if !defined(CUDA_FORCE_CDP1_IF_SUPPORTED) && !defined(__CUDADEVRT_INTERNAL__) && !defined(_NVHPC_CUDA) && !(defined(_WIN32) && !defined(_WIN64)) +#define __CUDA_INTERNAL_USE_CDP2 +#endif + +#if !defined(__CUDACC_RTC__) + +#if !defined(__CUDACC_INTERNAL_NO_STUBS__) && !defined(__CUDACC_RDC__) && !defined(__CUDACC_EWP__) && defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 350) && !defined(__CUDADEVRT_INTERNAL__) + +#if defined(__cplusplus) +extern "C" { +#endif + +struct cudaFuncAttributes; + + +#ifndef __CUDA_INTERNAL_USE_CDP2 +inline __device__ cudaError_t CUDARTAPI cudaMalloc(void **p, size_t s) +{ + return cudaErrorUnknown; +} + +inline __device__ cudaError_t CUDARTAPI cudaFuncGetAttributes(struct cudaFuncAttributes *p, const void *c) +{ + return cudaErrorUnknown; +} + +inline __device__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) +{ + return cudaErrorUnknown; +} + +inline __device__ cudaError_t CUDARTAPI cudaGetDevice(int *device) +{ + return cudaErrorUnknown; +} + +inline __device__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize) +{ + return cudaErrorUnknown; +} + +inline __device__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize, unsigned int flags) +{ + return cudaErrorUnknown; +} +#else // __CUDA_INTERNAL_USE_CDP2 +inline __device__ cudaError_t CUDARTAPI __cudaCDP2Malloc(void **p, size_t s) +{ + return cudaErrorUnknown; +} + +inline __device__ cudaError_t CUDARTAPI __cudaCDP2FuncGetAttributes(struct cudaFuncAttributes *p, const void *c) +{ + return cudaErrorUnknown; +} + +inline __device__ cudaError_t CUDARTAPI __cudaCDP2DeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) +{ + return cudaErrorUnknown; +} + +inline __device__ cudaError_t CUDARTAPI __cudaCDP2GetDevice(int *device) +{ + return cudaErrorUnknown; +} + +inline __device__ cudaError_t CUDARTAPI __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize) +{ + return cudaErrorUnknown; +} + +inline __device__ cudaError_t CUDARTAPI __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize, unsigned int flags) +{ + return cudaErrorUnknown; +} +#endif // __CUDA_INTERNAL_USE_CDP2 + + +#if defined(__cplusplus) +} +#endif + +#endif /* !defined(__CUDACC_INTERNAL_NO_STUBS__) && !defined(__CUDACC_RDC__) && !defined(__CUDACC_EWP__) && defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 350) && !defined(__CUDADEVRT_INTERNAL__) */ + +#endif /* !defined(__CUDACC_RTC__) */ + +#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +# define __DEPRECATED__(msg) +#elif defined(_WIN32) +# define __DEPRECATED__(msg) __declspec(deprecated(msg)) +#elif (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5 && !defined(__clang__)))) +# define __DEPRECATED__(msg) __attribute__((deprecated)) +#else +# define __DEPRECATED__(msg) __attribute__((deprecated(msg))) +#endif + +#if defined(__CUDA_ARCH__) && !defined(__CDPRT_SUPPRESS_SYNC_DEPRECATION_WARNING) +# define __CDPRT_DEPRECATED(func_name) __DEPRECATED__("Use of "#func_name" from device code is deprecated. Moreover, such use will cause this module to fail to load on sm_90+ devices. If calls to "#func_name" from device code cannot be removed for older devices at this time, you may guard them with __CUDA_ARCH__ macros to remove them only for sm_90+ devices, making sure to generate code for compute_90 for the macros to take effect. Note that this mitigation will no longer work when support for "#func_name" from device code is eventually dropped for all devices. Disable this warning with -D__CDPRT_SUPPRESS_SYNC_DEPRECATION_WARNING.") +#else +# define __CDPRT_DEPRECATED(func_name) +#endif + +#if defined(__cplusplus) && defined(__CUDACC__) /* Visible to nvcc front-end only */ +#if !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 350) // Visible to SM>=3.5 and "__host__ __device__" only + +#include "driver_types.h" +#include "crt/host_defines.h" + +#define cudaStreamGraphTailLaunch (cudaStream_t)0x0100000000000000 +#define cudaStreamGraphFireAndForget (cudaStream_t)0x0200000000000000 +#define cudaStreamGraphFireAndForgetAsSibling (cudaStream_t)0x0300000000000000 + +#ifdef __CUDA_INTERNAL_USE_CDP2 +#define cudaStreamTailLaunch ((cudaStream_t)0x3) /**< Per-grid stream with a tail launch semantics. Only applicable when used with CUDA Dynamic Parallelism. */ +#define cudaStreamFireAndForget ((cudaStream_t)0x4) /**< Per-grid stream with a fire-and-forget synchronization behavior. Only applicable when used with CUDA Dynamic Parallelism. */ +#endif + +extern "C" +{ + +// Symbols beginning with __cudaCDP* should not be used outside +// this header file. Instead, compile with -DCUDA_FORCE_CDP1_IF_SUPPORTED if +// CDP1 support is required. + +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaDeviceSynchronizeDeprecationAvoidance(void); + +#ifndef __CUDA_INTERNAL_USE_CDP2 +//// CDP1 endpoints +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig); +extern __DEPRECATED__("cudaDeviceGetSharedMemConfig deprecated") __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig); +#if (__CUDA_ARCH__ < 900) && (defined(CUDA_FORCE_CDP1_IF_SUPPORTED) || (defined(_WIN32) && !defined(_WIN64))) +// cudaDeviceSynchronize is removed on sm_90+ +extern __device__ __cudart_builtin__ __CDPRT_DEPRECATED(cudaDeviceSynchronize) cudaError_t CUDARTAPI cudaDeviceSynchronize(void); +#endif +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetLastError(void); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaPeekAtLastError(void); +extern __device__ __cudart_builtin__ const char* CUDARTAPI cudaGetErrorString(cudaError_t error); +extern __device__ __cudart_builtin__ const char* CUDARTAPI cudaGetErrorName(cudaError_t error); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDeviceCount(int *count); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDevice(int *device); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamDestroy(cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent_ptsz(cudaStream_t stream, cudaEvent_t event, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecord(cudaEvent_t event, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecord_ptsz(cudaEvent_t event, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecordWithFlags_ptsz(cudaEvent_t event, cudaStream_t stream, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventDestroy(cudaEvent_t event); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFree(void *devPtr); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMalloc(void **devPtr, size_t size); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpyAsync(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpyAsync_ptsz(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync_ptsz(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync(const struct cudaMemcpy3DParms *p, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync_ptsz(const struct cudaMemcpy3DParms *p, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync(void *devPtr, int value, size_t count, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync_ptsz(void *devPtr, int value, size_t count, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset2DAsync_ptsz(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset3DAsync_ptsz(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaRuntimeGetVersion(int *runtimeVersion); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize, unsigned int flags); +#endif // __CUDA_INTERNAL_USE_CDP2 + +//// CDP2 endpoints +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2DeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2DeviceGetLimit(size_t *pValue, enum cudaLimit limit); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2DeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2DeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2GetLastError(void); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2PeekAtLastError(void); +extern __device__ __cudart_builtin__ const char* CUDARTAPI __cudaCDP2GetErrorString(cudaError_t error); +extern __device__ __cudart_builtin__ const char* CUDARTAPI __cudaCDP2GetErrorName(cudaError_t error); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2GetDeviceCount(int *count); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2GetDevice(int *device); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2StreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2StreamDestroy(cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2StreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2StreamWaitEvent_ptsz(cudaStream_t stream, cudaEvent_t event, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventCreateWithFlags(cudaEvent_t *event, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventRecord(cudaEvent_t event, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventRecord_ptsz(cudaEvent_t event, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventRecordWithFlags_ptsz(cudaEvent_t event, cudaStream_t stream, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventDestroy(cudaEvent_t event); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2FuncGetAttributes(struct cudaFuncAttributes *attr, const void *func); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Free(void *devPtr); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Malloc(void **devPtr, size_t size); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2MemcpyAsync(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2MemcpyAsync_ptsz(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memcpy2DAsync(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memcpy2DAsync_ptsz(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memcpy3DAsync(const struct cudaMemcpy3DParms *p, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memcpy3DAsync_ptsz(const struct cudaMemcpy3DParms *p, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2MemsetAsync(void *devPtr, int value, size_t count, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2MemsetAsync_ptsz(void *devPtr, int value, size_t count, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memset2DAsync(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memset2DAsync_ptsz(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memset3DAsync_ptsz(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2RuntimeGetVersion(int *runtimeVersion); +extern __device__ __cudart_builtin__ void * CUDARTAPI __cudaCDP2GetParameterBuffer(size_t alignment, size_t size); +extern __device__ __cudart_builtin__ void * CUDARTAPI __cudaCDP2GetParameterBufferV2(void *func, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2LaunchDevice_ptsz(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2LaunchDeviceV2_ptsz(void *parameterBuffer, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2LaunchDevice(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2LaunchDeviceV2(void *parameterBuffer, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize, unsigned int flags); + + +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream); +#if defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) +static inline __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphLaunch_ptsz(cudaGraphExec_t graphExec, cudaStream_t stream) +{ + if (stream == 0) { + stream = cudaStreamPerThread; + } + return cudaGraphLaunch(graphExec, stream); +} +#endif + +/** + * \ingroup CUDART_GRAPH + * \brief Get the currently running device graph id. + * + * Get the currently running device graph id. + * \return Returns the current device graph id, 0 if the call is outside of a device graph. + * \sa cudaGraphLaunch + */ +static inline __device__ __cudart_builtin__ cudaGraphExec_t CUDARTAPI cudaGetCurrentGraphExec(void) +{ + unsigned long long current_graph_exec; + asm ("mov.u64 %0, %%current_graph_exec;" : "=l"(current_graph_exec)); + return (cudaGraphExec_t)current_graph_exec; +} + +/** + * \ingroup CUDART_GRAPH + * \brief Updates the kernel parameters of the given kernel node + * + * Updates \p size bytes in the kernel parameters of \p node at \p offset to + * the contents of \p value. \p node must be device-updatable, and must reside upon the same + * device as the calling kernel. + * + * If this function is called for the node's immediate dependent and that dependent is configured + * for programmatic dependent launch, then a memory fence must be invoked via __threadfence() before + * kickoff of the dependent is triggered via ::cudaTriggerProgrammaticLaunchCompletion() to ensure + * that the update is visible to that dependent node before it is launched. + * + * \param node - The node to update + * \param offset - The offset into the params at which to make the update + * \param value - Buffer containing the params to write + * \param size - Size in bytes to update + * + * \return + * cudaSucces, + * cudaErrorInvalidValue + * \notefnerr + * + * \sa + * ::cudaGraphKernelNodeSetEnabled, + * ::cudaGraphKernelNodeSetGridDim, + * ::cudaGraphKernelNodeUpdatesApply + */ +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParam(cudaGraphDeviceNode_t node, size_t offset, const void *value , size_t size); + +/** + * \ingroup CUDART_GRAPH + * \brief Enables or disables the given kernel node + * + * Enables or disables \p node based upon \p enable. If \p enable is true, the node will be enabled; + * if it is false, the node will be disabled. Disabled nodes will act as a NOP during execution. + * \p node must be device-updatable, and must reside upon the same device as the calling kernel. + * + * If this function is called for the node's immediate dependent and that dependent is configured + * for programmatic dependent launch, then a memory fence must be invoked via __threadfence() before + * kickoff of the dependent is triggered via ::cudaTriggerProgrammaticLaunchCompletion() to ensure + * that the update is visible to that dependent node before it is launched. + * + * \param node - The node to update + * \param enable - Whether to enable or disable the node + * + * \return + * cudaSucces, + * cudaErrorInvalidValue + * \notefnerr + * + * \sa + * ::cudaGraphKernelNodeSetParam, + * ::cudaGraphKernelNodeSetGridDim, + * ::cudaGraphKernelNodeUpdatesApply + */ +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetEnabled(cudaGraphDeviceNode_t node, bool enable); + +/** + * \ingroup CUDART_GRAPH + * \brief Updates the grid dimensions of the given kernel node + * + * Sets the grid dimensions of \p node to \p gridDim. \p node must be device-updatable, + * and must reside upon the same device as thecalling kernel. + * + * If this function is called for the node's immediate dependent and that dependent is configured + * for programmatic dependent launch, then a memory fence must be invoked via __threadfence() before + * kickoff of the dependent is triggered via ::cudaTriggerProgrammaticLaunchCompletion() to ensure + * that the update is visible to that dependent node before it is launched. + * + * \param node - The node to update + * \param gridDim - The grid dimensions to set + * + * \return + * cudaSucces, + * cudaErrorInvalidValue + * \notefnerr + * + * \sa + * ::cudaGraphKernelNodeSetParam, + * ::cudaGraphKernelNodeSetEnabled, + * ::cudaGraphKernelNodeUpdatesApply + */ +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetGridDim(cudaGraphDeviceNode_t node, dim3 gridDim); + +/** + * \ingroup CUDART_GRAPH + * \brief Batch applies multiple kernel node updates + * + * Batch applies one or more kernel node updates based on the information provided in \p updates. + * \p updateCount specifies the number of updates to apply. Each entry in \p updates must specify + * a node to update, the type of update to apply, and the parameters for that type of update. See + * the documentation for ::cudaGraphKernelNodeUpdate for more detail. + * + * If this function is called for the node's immediate dependent and that dependent is configured + * for programmatic dependent launch, then a memory fence must be invoked via __threadfence() before + * kickoff of the dependent is triggered via ::cudaTriggerProgrammaticLaunchCompletion() to ensure + * that the update is visible to that dependent node before it is launched. + * + * \param updates - The updates to apply + * \param updateCount - The number of updates to apply + * + * \return + * cudaSucces, + * cudaErrorInvalidValue + * \notefnerr + * + * \sa + * ::cudaGraphKernelNodeSetParam, + * ::cudaGraphKernelNodeSetEnabled, + * ::cudaGraphKernelNodeSetGridDim + */ +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphKernelNodeUpdatesApply(const cudaGraphKernelNodeUpdate *updates, size_t updateCount); + +/** + * \ingroup CUDART_EXECUTION + * \brief Programmatic dependency trigger + * + * This device function ensures the programmatic launch completion edges / + * events are fulfilled. See + * ::cudaLaunchAttributeID::cudaLaunchAttributeProgrammaticStreamSerialization + * and ::cudaLaunchAttributeID::cudaLaunchAttributeProgrammaticEvent for more + * information. The event / edge kick off only happens when every CTAs + * in the grid has either exited or called this function at least once, + * otherwise the kick off happens automatically after all warps finishes + * execution but before the grid completes. The kick off only enables + * scheduling of the secondary kernel. It provides no memory visibility + * guarantee itself. The user could enforce memory visibility by inserting a + * memory fence of the correct scope. + */ +static inline __device__ __cudart_builtin__ void CUDARTAPI cudaTriggerProgrammaticLaunchCompletion(void) +{ + asm volatile("griddepcontrol.launch_dependents;":::); +} + +/** + * \ingroup CUDART_EXECUTION + * \brief Programmatic grid dependency synchronization + * + * This device function will block the thread until all direct grid + * dependencies have completed. This API is intended to use in conjuncture with + * programmatic / launch event / dependency. See + * ::cudaLaunchAttributeID::cudaLaunchAttributeProgrammaticStreamSerialization + * and ::cudaLaunchAttributeID::cudaLaunchAttributeProgrammaticEvent for more + * information. + */ +static inline __device__ __cudart_builtin__ void CUDARTAPI cudaGridDependencySynchronize(void) +{ + asm volatile("griddepcontrol.wait;":::"memory"); +} + +/** + * \ingroup CUDART_GRAPH + * \brief Sets the condition value associated with a conditional node. + * + * Sets the condition value associated with a conditional node. + * \sa cudaGraphConditionalHandleCreate + */ +extern __device__ __cudart_builtin__ void CUDARTAPI cudaGraphSetConditional(cudaGraphConditionalHandle handle, unsigned int value); + +//// CG API +extern __device__ __cudart_builtin__ unsigned long long CUDARTAPI cudaCGGetIntrinsicHandle(enum cudaCGScope scope); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaCGSynchronize(unsigned long long handle, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaCGSynchronizeGrid(unsigned long long handle, unsigned int flags); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaCGGetSize(unsigned int *numThreads, unsigned int *numGrids, unsigned long long handle); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaCGGetRank(unsigned int *threadRank, unsigned int *gridRank, unsigned long long handle); + + +//// CDP API + +#ifdef __CUDA_ARCH__ + +#ifdef __CUDA_INTERNAL_USE_CDP2 +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) +{ + return __cudaCDP2DeviceGetAttribute(value, attr, device); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit) +{ + return __cudaCDP2DeviceGetLimit(pValue, limit); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig) +{ + return __cudaCDP2DeviceGetCacheConfig(pCacheConfig); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig) +{ + return __cudaCDP2DeviceGetSharedMemConfig(pConfig); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetLastError(void) +{ + return __cudaCDP2GetLastError(); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaPeekAtLastError(void) +{ + return __cudaCDP2PeekAtLastError(); +} + +static __inline__ __device__ __cudart_builtin__ const char* CUDARTAPI cudaGetErrorString(cudaError_t error) +{ + return __cudaCDP2GetErrorString(error); +} + +static __inline__ __device__ __cudart_builtin__ const char* CUDARTAPI cudaGetErrorName(cudaError_t error) +{ + return __cudaCDP2GetErrorName(error); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDeviceCount(int *count) +{ + return __cudaCDP2GetDeviceCount(count); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDevice(int *device) +{ + return __cudaCDP2GetDevice(device); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags) +{ + return __cudaCDP2StreamCreateWithFlags(pStream, flags); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamDestroy(cudaStream_t stream) +{ + return __cudaCDP2StreamDestroy(stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) +{ + return __cudaCDP2StreamWaitEvent(stream, event, flags); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent_ptsz(cudaStream_t stream, cudaEvent_t event, unsigned int flags) +{ + return __cudaCDP2StreamWaitEvent_ptsz(stream, event, flags); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags) +{ + return __cudaCDP2EventCreateWithFlags(event, flags); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecord(cudaEvent_t event, cudaStream_t stream) +{ + return __cudaCDP2EventRecord(event, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecord_ptsz(cudaEvent_t event, cudaStream_t stream) +{ + return __cudaCDP2EventRecord_ptsz(event, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) +{ + return __cudaCDP2EventRecordWithFlags(event, stream, flags); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecordWithFlags_ptsz(cudaEvent_t event, cudaStream_t stream, unsigned int flags) +{ + return __cudaCDP2EventRecordWithFlags_ptsz(event, stream, flags); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventDestroy(cudaEvent_t event) +{ + return __cudaCDP2EventDestroy(event); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func) +{ + return __cudaCDP2FuncGetAttributes(attr, func); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFree(void *devPtr) +{ + return __cudaCDP2Free(devPtr); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMalloc(void **devPtr, size_t size) +{ + return __cudaCDP2Malloc(devPtr, size); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpyAsync(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream) +{ + return __cudaCDP2MemcpyAsync(dst, src, count, kind, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpyAsync_ptsz(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream) +{ + return __cudaCDP2MemcpyAsync_ptsz(dst, src, count, kind, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream) +{ + return __cudaCDP2Memcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync_ptsz(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream) +{ + return __cudaCDP2Memcpy2DAsync_ptsz(dst, dpitch, src, spitch, width, height, kind, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync(const struct cudaMemcpy3DParms *p, cudaStream_t stream) +{ + return __cudaCDP2Memcpy3DAsync(p, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync_ptsz(const struct cudaMemcpy3DParms *p, cudaStream_t stream) +{ + return __cudaCDP2Memcpy3DAsync_ptsz(p, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync(void *devPtr, int value, size_t count, cudaStream_t stream) +{ + return __cudaCDP2MemsetAsync(devPtr, value, count, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync_ptsz(void *devPtr, int value, size_t count, cudaStream_t stream) +{ + return __cudaCDP2MemsetAsync_ptsz(devPtr, value, count, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) +{ + return __cudaCDP2Memset2DAsync(devPtr, pitch, value, width, height, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset2DAsync_ptsz(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) +{ + return __cudaCDP2Memset2DAsync_ptsz(devPtr, pitch, value, width, height, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream) +{ + return __cudaCDP2Memset3DAsync(pitchedDevPtr, value, extent, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset3DAsync_ptsz(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream) +{ + return __cudaCDP2Memset3DAsync_ptsz(pitchedDevPtr, value, extent, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaRuntimeGetVersion(int *runtimeVersion) +{ + return __cudaCDP2RuntimeGetVersion(runtimeVersion); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize) +{ + return __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSmemSize); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize, unsigned int flags) +{ + return __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSmemSize, flags); +} +#endif // __CUDA_INTERNAL_USE_CDP2 + +#endif // __CUDA_ARCH__ + + +/** + * \ingroup CUDART_EXECUTION + * \brief Obtains a parameter buffer + * + * Obtains a parameter buffer which can be filled with parameters for a kernel launch. + * Parameters passed to ::cudaLaunchDevice must be allocated via this function. + * + * This is a low level API and can only be accessed from Parallel Thread Execution (PTX). + * CUDA user code should use <<< >>> to launch kernels. + * + * \param alignment - Specifies alignment requirement of the parameter buffer + * \param size - Specifies size requirement in bytes + * + * \return + * Returns pointer to the allocated parameterBuffer + * \notefnerr + * + * \sa cudaLaunchDevice + */ +#ifdef __CUDA_INTERNAL_USE_CDP2 +static __inline__ __device__ __cudart_builtin__ void * CUDARTAPI cudaGetParameterBuffer(size_t alignment, size_t size) +{ + return __cudaCDP2GetParameterBuffer(alignment, size); +} +#else +extern __device__ __cudart_builtin__ void * CUDARTAPI cudaGetParameterBuffer(size_t alignment, size_t size); +#endif + + +#ifdef __CUDA_INTERNAL_USE_CDP2 +static __inline__ __device__ __cudart_builtin__ void * CUDARTAPI cudaGetParameterBufferV2(void *func, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize) +{ + return __cudaCDP2GetParameterBufferV2(func, gridDimension, blockDimension, sharedMemSize); +} +#else +extern __device__ __cudart_builtin__ void * CUDARTAPI cudaGetParameterBufferV2(void *func, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize); +#endif + + +#ifdef __CUDA_INTERNAL_USE_CDP2 +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDevice_ptsz(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream) +{ + return __cudaCDP2LaunchDevice_ptsz(func, parameterBuffer, gridDimension, blockDimension, sharedMemSize, stream); +} + +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDeviceV2_ptsz(void *parameterBuffer, cudaStream_t stream) +{ + return __cudaCDP2LaunchDeviceV2_ptsz(parameterBuffer, stream); +} +#else +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDevice_ptsz(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDeviceV2_ptsz(void *parameterBuffer, cudaStream_t stream); +#endif + + +/** + * \ingroup CUDART_EXECUTION + * \brief Launches a specified kernel + * + * Launches a specified kernel with the specified parameter buffer. A parameter buffer can be obtained + * by calling ::cudaGetParameterBuffer(). + * + * This is a low level API and can only be accessed from Parallel Thread Execution (PTX). + * CUDA user code should use <<< >>> to launch the kernels. + * + * \param func - Pointer to the kernel to be launched + * \param parameterBuffer - Holds the parameters to the launched kernel. parameterBuffer can be NULL. (Optional) + * \param gridDimension - Specifies grid dimensions + * \param blockDimension - Specifies block dimensions + * \param sharedMemSize - Specifies size of shared memory + * \param stream - Specifies the stream to be used + * + * \return + * ::cudaSuccess, ::cudaErrorInvalidDevice, ::cudaErrorLaunchMaxDepthExceeded, ::cudaErrorInvalidConfiguration, + * ::cudaErrorStartupFailure, ::cudaErrorLaunchPendingCountExceeded, ::cudaErrorLaunchOutOfResources + * \notefnerr + * \n Please refer to Execution Configuration and Parameter Buffer Layout from the CUDA Programming + * Guide for the detailed descriptions of launch configuration and parameter layout respectively. + * + * \sa cudaGetParameterBuffer + */ +#if defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) && defined(__CUDA_ARCH__) + // When compiling for the device and per thread default stream is enabled, add + // a static inline redirect to the per thread stream entry points. + + static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI + cudaLaunchDevice(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream) + { +#ifdef __CUDA_INTERNAL_USE_CDP2 + return __cudaCDP2LaunchDevice_ptsz(func, parameterBuffer, gridDimension, blockDimension, sharedMemSize, stream); +#else + return cudaLaunchDevice_ptsz(func, parameterBuffer, gridDimension, blockDimension, sharedMemSize, stream); +#endif + } + + static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI + cudaLaunchDeviceV2(void *parameterBuffer, cudaStream_t stream) + { +#ifdef __CUDA_INTERNAL_USE_CDP2 + return __cudaCDP2LaunchDeviceV2_ptsz(parameterBuffer, stream); +#else + return cudaLaunchDeviceV2_ptsz(parameterBuffer, stream); +#endif + } +#else // defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) && defined(__CUDA_ARCH__) +#ifdef __CUDA_INTERNAL_USE_CDP2 + static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDevice(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream) + { + return __cudaCDP2LaunchDevice(func, parameterBuffer, gridDimension, blockDimension, sharedMemSize, stream); + } + + static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDeviceV2(void *parameterBuffer, cudaStream_t stream) + { + return __cudaCDP2LaunchDeviceV2(parameterBuffer, stream); + } +#else // __CUDA_INTERNAL_USE_CDP2 +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDevice(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream); +extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDeviceV2(void *parameterBuffer, cudaStream_t stream); +#endif // __CUDA_INTERNAL_USE_CDP2 +#endif // defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) && defined(__CUDA_ARCH__) + + +// These symbols should not be used outside of this header file. +#define __cudaCDP2DeviceGetAttribute +#define __cudaCDP2DeviceGetLimit +#define __cudaCDP2DeviceGetCacheConfig +#define __cudaCDP2DeviceGetSharedMemConfig +#define __cudaCDP2GetLastError +#define __cudaCDP2PeekAtLastError +#define __cudaCDP2GetErrorString +#define __cudaCDP2GetErrorName +#define __cudaCDP2GetDeviceCount +#define __cudaCDP2GetDevice +#define __cudaCDP2StreamCreateWithFlags +#define __cudaCDP2StreamDestroy +#define __cudaCDP2StreamWaitEvent +#define __cudaCDP2StreamWaitEvent_ptsz +#define __cudaCDP2EventCreateWithFlags +#define __cudaCDP2EventRecord +#define __cudaCDP2EventRecord_ptsz +#define __cudaCDP2EventRecordWithFlags +#define __cudaCDP2EventRecordWithFlags_ptsz +#define __cudaCDP2EventDestroy +#define __cudaCDP2FuncGetAttributes +#define __cudaCDP2Free +#define __cudaCDP2Malloc +#define __cudaCDP2MemcpyAsync +#define __cudaCDP2MemcpyAsync_ptsz +#define __cudaCDP2Memcpy2DAsync +#define __cudaCDP2Memcpy2DAsync_ptsz +#define __cudaCDP2Memcpy3DAsync +#define __cudaCDP2Memcpy3DAsync_ptsz +#define __cudaCDP2MemsetAsync +#define __cudaCDP2MemsetAsync_ptsz +#define __cudaCDP2Memset2DAsync +#define __cudaCDP2Memset2DAsync_ptsz +#define __cudaCDP2Memset3DAsync +#define __cudaCDP2Memset3DAsync_ptsz +#define __cudaCDP2RuntimeGetVersion +#define __cudaCDP2GetParameterBuffer +#define __cudaCDP2GetParameterBufferV2 +#define __cudaCDP2LaunchDevice_ptsz +#define __cudaCDP2LaunchDeviceV2_ptsz +#define __cudaCDP2LaunchDevice +#define __cudaCDP2LaunchDeviceV2 +#define __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessor +#define __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessorWithFlags + +} + +template static __inline__ __device__ __cudart_builtin__ cudaError_t cudaMalloc(T **devPtr, size_t size); +template static __inline__ __device__ __cudart_builtin__ cudaError_t cudaFuncGetAttributes(struct cudaFuncAttributes *attr, T *entry); +template static __inline__ __device__ __cudart_builtin__ cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, T func, int blockSize, size_t dynamicSmemSize); +template static __inline__ __device__ __cudart_builtin__ cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, T func, int blockSize, size_t dynamicSmemSize, unsigned int flags); + +/** + * \ingroup CUDART_GRAPH + * \brief Updates the kernel parameters of the given kernel node + * + * Updates the kernel parameters of \p node at \p offset to \p value. \p node must be + * device-updatable, and must reside upon the same device as the calling kernel. + * + * If this function is called for the node's immediate dependent and that dependent is configured + * for programmatic dependent launch, then a memory fence must be invoked via __threadfence() before + * kickoff of the dependent is triggered via ::cudaTriggerProgrammaticLaunchCompletion() to ensure + * that the update is visible to that dependent node before it is launched. + * + * \param node - The node to update + * \param offset - The offset into the params at which to make the update + * \param value - Parameter value to write + * + * \return + * cudaSucces, + * cudaErrorInvalidValue + * \notefnerr + * + * \sa + * ::etblGraphKernelNodeSetEnabled, + * ::etblGraphKernelNodeSetGridDim, + * ::etblGraphKernelNodeUpdatesApply + */ +template +static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParam(cudaGraphDeviceNode_t node, size_t offset, const T &value) +{ + return cudaGraphKernelNodeSetParam(node, offset, &value, sizeof(T)); +} + +#endif // !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 350) +#endif /* defined(__cplusplus) && defined(__CUDACC__) */ + +#undef __DEPRECATED__ +#undef __CDPRT_DEPRECATED +#undef __CUDA_INTERNAL_USE_CDP2 + +#endif /* !__CUDA_DEVICE_RUNTIME_API_H__ */ diff --git a/cuda_toolkit/include/cuda_egl_interop.h b/cuda_toolkit/include/cuda_egl_interop.h new file mode 100644 index 0000000000000000000000000000000000000000..d24d5f090e7815c78d552e1f3ef3e7106ac7cb08 --- /dev/null +++ b/cuda_toolkit/include/cuda_egl_interop.h @@ -0,0 +1,642 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_EGL_INTEROP_H__) +#define __CUDA_EGL_INTEROP_H__ + +#include "cuda_runtime_api.h" +#include "cuda_runtime.h" +#include "cudart_platform.h" +#include "EGL/egl.h" +#include "EGL/eglext.h" + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/** + * \addtogroup CUDART_TYPES + * @{ + */ + + /** + * Maximum number of planes per frame + */ +#define CUDA_EGL_MAX_PLANES 3 + +/** + * CUDA EglFrame type - array or pointer + */ +typedef enum cudaEglFrameType_enum +{ + cudaEglFrameTypeArray = 0, /**< Frame type CUDA array */ + cudaEglFrameTypePitch = 1, /**< Frame type CUDA pointer */ +} cudaEglFrameType; + +/** + * Resource location flags- sysmem or vidmem + * + * For CUDA context on iGPU, since video and system memory are equivalent - + * these flags will not have an effect on the execution. + * + * For CUDA context on dGPU, applications can use the flag ::cudaEglResourceLocationFlags + * to give a hint about the desired location. + * + * ::cudaEglResourceLocationSysmem - the frame data is made resident on the system memory + * to be accessed by CUDA. + * + * ::cudaEglResourceLocationVidmem - the frame data is made resident on the dedicated + * video memory to be accessed by CUDA. + * + * There may be an additional latency due to new allocation and data migration, + * if the frame is produced on a different memory. + */ +typedef enum cudaEglResourceLocationFlags_enum { + cudaEglResourceLocationSysmem = 0x00, /**< Resource location sysmem */ + cudaEglResourceLocationVidmem = 0x01, /**< Resource location vidmem */ +} cudaEglResourceLocationFlags; + +/** + * CUDA EGL Color Format - The different planar and multiplanar formats currently supported for CUDA_EGL interops. + */ +typedef enum cudaEglColorFormat_enum { + cudaEglColorFormatYUV420Planar = 0, /**< Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYUV420SemiPlanar = 1, /**< Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV420Planar. */ + cudaEglColorFormatYUV422Planar = 2, /**< Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height. */ + cudaEglColorFormatYUV422SemiPlanar = 3, /**< Y, UV in two surfaces with VU byte ordering, width, height ratio same as YUV422Planar. */ + cudaEglColorFormatARGB = 6, /**< R/G/B/A four channels in one surface with BGRA byte ordering. */ + cudaEglColorFormatRGBA = 7, /**< R/G/B/A four channels in one surface with ABGR byte ordering. */ + cudaEglColorFormatL = 8, /**< single luminance channel in one surface. */ + cudaEglColorFormatR = 9, /**< single color channel in one surface. */ + cudaEglColorFormatYUV444Planar = 10, /**< Y, U, V in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatYUV444SemiPlanar = 11, /**< Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV444Planar. */ + cudaEglColorFormatYUYV422 = 12, /**< Y, U, V in one surface, interleaved as UYVY in one channel. */ + cudaEglColorFormatUYVY422 = 13, /**< Y, U, V in one surface, interleaved as YUYV in one channel. */ + cudaEglColorFormatABGR = 14, /**< R/G/B/A four channels in one surface with RGBA byte ordering. */ + cudaEglColorFormatBGRA = 15, /**< R/G/B/A four channels in one surface with ARGB byte ordering. */ + cudaEglColorFormatA = 16, /**< Alpha color format - one channel in one surface. */ + cudaEglColorFormatRG = 17, /**< R/G color format - two channels in one surface with GR byte ordering */ + cudaEglColorFormatAYUV = 18, /**< Y, U, V, A four channels in one surface, interleaved as VUYA. */ + cudaEglColorFormatYVU444SemiPlanar = 19, /**< Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatYVU422SemiPlanar = 20, /**< Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height. */ + cudaEglColorFormatYVU420SemiPlanar = 21, /**< Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatY10V10U10_444SemiPlanar = 22, /**< Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatY10V10U10_420SemiPlanar = 23, /**< Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatY12V12U12_444SemiPlanar = 24, /**< Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatY12V12U12_420SemiPlanar = 25, /**< Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatVYUY_ER = 26, /**< Extended Range Y, U, V in one surface, interleaved as YVYU in one channel. */ + cudaEglColorFormatUYVY_ER = 27, /**< Extended Range Y, U, V in one surface, interleaved as YUYV in one channel. */ + cudaEglColorFormatYUYV_ER = 28, /**< Extended Range Y, U, V in one surface, interleaved as UYVY in one channel. */ + cudaEglColorFormatYVYU_ER = 29, /**< Extended Range Y, U, V in one surface, interleaved as VYUY in one channel. */ + cudaEglColorFormatYUVA_ER = 31, /**< Extended Range Y, U, V, A four channels in one surface, interleaved as AVUY. */ + cudaEglColorFormatAYUV_ER = 32, /**< Extended Range Y, U, V, A four channels in one surface, interleaved as VUYA. */ + cudaEglColorFormatYUV444Planar_ER = 33, /**< Extended Range Y, U, V in three surfaces, U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatYUV422Planar_ER = 34, /**< Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = Y height. */ + cudaEglColorFormatYUV420Planar_ER = 35, /**< Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYUV444SemiPlanar_ER = 36, /**< Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatYUV422SemiPlanar_ER = 37, /**< Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = Y height. */ + cudaEglColorFormatYUV420SemiPlanar_ER = 38, /**< Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYVU444Planar_ER = 39, /**< Extended Range Y, V, U in three surfaces, U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatYVU422Planar_ER = 40, /**< Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = Y height. */ + cudaEglColorFormatYVU420Planar_ER = 41, /**< Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYVU444SemiPlanar_ER = 42, /**< Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatYVU422SemiPlanar_ER = 43, /**< Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height. */ + cudaEglColorFormatYVU420SemiPlanar_ER = 44, /**< Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatBayerRGGB = 45, /**< Bayer format - one channel in one surface with interleaved RGGB ordering. */ + cudaEglColorFormatBayerBGGR = 46, /**< Bayer format - one channel in one surface with interleaved BGGR ordering. */ + cudaEglColorFormatBayerGRBG = 47, /**< Bayer format - one channel in one surface with interleaved GRBG ordering. */ + cudaEglColorFormatBayerGBRG = 48, /**< Bayer format - one channel in one surface with interleaved GBRG ordering. */ + cudaEglColorFormatBayer10RGGB = 49, /**< Bayer10 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 10 bits used 6 bits No-op. */ + cudaEglColorFormatBayer10BGGR = 50, /**< Bayer10 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 10 bits used 6 bits No-op. */ + cudaEglColorFormatBayer10GRBG = 51, /**< Bayer10 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 10 bits used 6 bits No-op. */ + cudaEglColorFormatBayer10GBRG = 52, /**< Bayer10 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 10 bits used 6 bits No-op. */ + cudaEglColorFormatBayer12RGGB = 53, /**< Bayer12 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 12 bits used 4 bits No-op. */ + cudaEglColorFormatBayer12BGGR = 54, /**< Bayer12 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 12 bits used 4 bits No-op. */ + cudaEglColorFormatBayer12GRBG = 55, /**< Bayer12 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 12 bits used 4 bits No-op. */ + cudaEglColorFormatBayer12GBRG = 56, /**< Bayer12 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 12 bits used 4 bits No-op. */ + cudaEglColorFormatBayer14RGGB = 57, /**< Bayer14 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 14 bits used 2 bits No-op. */ + cudaEglColorFormatBayer14BGGR = 58, /**< Bayer14 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 14 bits used 2 bits No-op. */ + cudaEglColorFormatBayer14GRBG = 59, /**< Bayer14 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 14 bits used 2 bits No-op. */ + cudaEglColorFormatBayer14GBRG = 60, /**< Bayer14 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 14 bits used 2 bits No-op. */ + cudaEglColorFormatBayer20RGGB = 61, /**< Bayer20 format - one channel in one surface with interleaved RGGB ordering. Out of 32 bits, 20 bits used 12 bits No-op. */ + cudaEglColorFormatBayer20BGGR = 62, /**< Bayer20 format - one channel in one surface with interleaved BGGR ordering. Out of 32 bits, 20 bits used 12 bits No-op. */ + cudaEglColorFormatBayer20GRBG = 63, /**< Bayer20 format - one channel in one surface with interleaved GRBG ordering. Out of 32 bits, 20 bits used 12 bits No-op. */ + cudaEglColorFormatBayer20GBRG = 64, /**< Bayer20 format - one channel in one surface with interleaved GBRG ordering. Out of 32 bits, 20 bits used 12 bits No-op. */ + cudaEglColorFormatYVU444Planar = 65, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatYVU422Planar = 66, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height. */ + cudaEglColorFormatYVU420Planar = 67, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatBayerIspRGGB = 68, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved RGGB ordering and mapped to opaque integer datatype. */ + cudaEglColorFormatBayerIspBGGR = 69, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved BGGR ordering and mapped to opaque integer datatype. */ + cudaEglColorFormatBayerIspGRBG = 70, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GRBG ordering and mapped to opaque integer datatype. */ + cudaEglColorFormatBayerIspGBRG = 71, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GBRG ordering and mapped to opaque integer datatype. */ + cudaEglColorFormatBayerBCCR = 72, /**< Bayer format - one channel in one surface with interleaved BCCR ordering. */ + cudaEglColorFormatBayerRCCB = 73, /**< Bayer format - one channel in one surface with interleaved RCCB ordering. */ + cudaEglColorFormatBayerCRBC = 74, /**< Bayer format - one channel in one surface with interleaved CRBC ordering. */ + cudaEglColorFormatBayerCBRC = 75, /**< Bayer format - one channel in one surface with interleaved CBRC ordering. */ + cudaEglColorFormatBayer10CCCC = 76, /**< Bayer10 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 10 bits used 6 bits No-op. */ + cudaEglColorFormatBayer12BCCR = 77, /**< Bayer12 format - one channel in one surface with interleaved BCCR ordering. Out of 16 bits, 12 bits used 4 bits No-op. */ + cudaEglColorFormatBayer12RCCB = 78, /**< Bayer12 format - one channel in one surface with interleaved RCCB ordering. Out of 16 bits, 12 bits used 4 bits No-op. */ + cudaEglColorFormatBayer12CRBC = 79, /**< Bayer12 format - one channel in one surface with interleaved CRBC ordering. Out of 16 bits, 12 bits used 4 bits No-op. */ + cudaEglColorFormatBayer12CBRC = 80, /**< Bayer12 format - one channel in one surface with interleaved CBRC ordering. Out of 16 bits, 12 bits used 4 bits No-op. */ + cudaEglColorFormatBayer12CCCC = 81, /**< Bayer12 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 12 bits used 4 bits No-op. */ + cudaEglColorFormatY = 82, /**< Color format for single Y plane. */ + cudaEglColorFormatYUV420SemiPlanar_2020 = 83, /**< Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYVU420SemiPlanar_2020 = 84, /**< Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYUV420Planar_2020 = 85, /**< Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYVU420Planar_2020 = 86, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYUV420SemiPlanar_709 = 87, /**< Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYVU420SemiPlanar_709 = 88, /**< Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYUV420Planar_709 = 89, /**< Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatYVU420Planar_709 = 90, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatY10V10U10_420SemiPlanar_709 = 91, /**< Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatY10V10U10_420SemiPlanar_2020 = 92, /**< Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatY10V10U10_422SemiPlanar_2020 = 93, /**< Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. */ + cudaEglColorFormatY10V10U10_422SemiPlanar = 94, /**< Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. */ + cudaEglColorFormatY10V10U10_422SemiPlanar_709 = 95, /**< Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. */ + cudaEglColorFormatY_ER = 96, /**< Extended Range Color format for single Y plane. */ + cudaEglColorFormatY_709_ER = 97, /**< Extended Range Color format for single Y plane. */ + cudaEglColorFormatY10_ER = 98, /**< Extended Range Color format for single Y10 plane. */ + cudaEglColorFormatY10_709_ER = 99, /**< Extended Range Color format for single Y10 plane. */ + cudaEglColorFormatY12_ER = 100, /**< Extended Range Color format for single Y12 plane. */ + cudaEglColorFormatY12_709_ER = 101, /**< Extended Range Color format for single Y12 plane. */ + cudaEglColorFormatYUVA = 102, /**< Y, U, V, A four channels in one surface, interleaved as AVUY. */ + cudaEglColorFormatYVYU = 104, /**< Y, U, V in one surface, interleaved as YVYU in one channel. */ + cudaEglColorFormatVYUY = 105, /**< Y, U, V in one surface, interleaved as VYUY in one channel. */ + cudaEglColorFormatY10V10U10_420SemiPlanar_ER = 106, /**< Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER = 107, /**< Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatY10V10U10_444SemiPlanar_ER = 108, /**< Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER = 109, /**< Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatY12V12U12_420SemiPlanar_ER = 110, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER = 111, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */ + cudaEglColorFormatY12V12U12_444SemiPlanar_ER = 112, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */ + cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER = 113, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */ +} cudaEglColorFormat; + +/** + * CUDA EGL Plane Descriptor - structure defining each plane of a CUDA EGLFrame + */ +typedef struct cudaEglPlaneDesc_st { + unsigned int width; /**< Width of plane */ + unsigned int height; /**< Height of plane */ + unsigned int depth; /**< Depth of plane */ + unsigned int pitch; /**< Pitch of plane */ + unsigned int numChannels; /**< Number of channels for the plane */ + struct cudaChannelFormatDesc channelDesc; /**< Channel Format Descriptor */ + unsigned int reserved[4]; /**< Reserved for future use */ +} cudaEglPlaneDesc; + +/** + * CUDA EGLFrame Descriptor - structure defining one frame of EGL. + * + * Each frame may contain one or more planes depending on whether the surface is Multiplanar or not. + * Each plane of EGLFrame is represented by ::cudaEglPlaneDesc which is defined as: + * \code + * typedef struct cudaEglPlaneDesc_st { + * unsigned int width; + * unsigned int height; + * unsigned int depth; + * unsigned int pitch; + * unsigned int numChannels; + * struct cudaChannelFormatDesc channelDesc; + * unsigned int reserved[4]; + * } cudaEglPlaneDesc; + * \endcode + +*/ +typedef struct cudaEglFrame_st { + union { + cudaArray_t pArray[CUDA_EGL_MAX_PLANES]; /**< Array of CUDA arrays corresponding to each plane*/ + struct cudaPitchedPtr pPitch[CUDA_EGL_MAX_PLANES]; /**< Array of Pointers corresponding to each plane*/ + } frame; + cudaEglPlaneDesc planeDesc[CUDA_EGL_MAX_PLANES]; /**< CUDA EGL Plane Descriptor ::cudaEglPlaneDesc*/ + unsigned int planeCount; /**< Number of planes */ + cudaEglFrameType frameType; /**< Array or Pitch */ + cudaEglColorFormat eglColorFormat; /**< CUDA EGL Color Format*/ +} cudaEglFrame; + +/** + * CUDA EGLSream Connection + */ +typedef struct CUeglStreamConnection_st *cudaEglStreamConnection; + +/** @} */ /* END CUDART_TYPES */ + +/** + * \addtogroup CUDART_EGL EGL Interoperability + * This section describes the EGL interoperability functions of the CUDA + * runtime application programming interface. + * + * @{ + */ + +/** + * \brief Registers an EGL image + * + * Registers the EGLImageKHR specified by \p image for access by + * CUDA. A handle to the registered object is returned as \p pCudaResource. + * Additional Mapping/Unmapping is not required for the registered resource and + * ::cudaGraphicsResourceGetMappedEglFrame can be directly called on the \p pCudaResource. + * + * The application will be responsible for synchronizing access to shared objects. + * The application must ensure that any pending operation which access the objects have completed + * before passing control to CUDA. This may be accomplished by issuing and waiting for + * glFinish command on all GLcontexts (for OpenGL and likewise for other APIs). + * The application will be also responsible for ensuring that any pending operation on the + * registered CUDA resource has completed prior to executing subsequent commands in other APIs + * accesing the same memory objects. + * This can be accomplished by calling cuCtxSynchronize or cuEventSynchronize (preferably). + * + * The surface's intended usage is specified using \p flags, as follows: + * + * - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this + * resource will be used. It is therefore assumed that this resource will be + * read from and written to by CUDA. This is the default value. + * - ::cudaGraphicsRegisterFlagsReadOnly: Specifies that CUDA + * will not write to this resource. + * - ::cudaGraphicsRegisterFlagsWriteDiscard: Specifies that + * CUDA will not read from this resource and will write over the + * entire contents of the resource, so none of the data previously + * stored in the resource will be preserved. + * + * The EGLImageKHR is an object which can be used to create EGLImage target resource. It is defined as a void pointer. + * typedef void* EGLImageKHR + * + * \param pCudaResource - Pointer to the returned object handle + * \param image - An EGLImageKHR image which can be used to create target resource. + * \param flags - Map flags + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * + * \sa + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsResourceGetMappedEglFrame, + * ::cuGraphicsEGLRegisterImage + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsEGLRegisterImage(struct cudaGraphicsResource **pCudaResource, EGLImageKHR image, unsigned int flags); + +/** + * \brief Connect CUDA to EGLStream as a consumer. + * + * Connect CUDA as a consumer to EGLStreamKHR specified by \p eglStream. + * + * The EGLStreamKHR is an EGL object that transfers a sequence of image frames from one + * API to another. + * + * \param conn - Pointer to the returned connection handle + * \param eglStream - EGLStreamKHR handle + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * + * \sa + * ::cudaEGLStreamConsumerDisconnect, + * ::cudaEGLStreamConsumerAcquireFrame, + * ::cudaEGLStreamConsumerReleaseFrame, + * ::cuEGLStreamConsumerConnect + */ +extern __host__ cudaError_t CUDARTAPI cudaEGLStreamConsumerConnect(cudaEglStreamConnection *conn, EGLStreamKHR eglStream); + +/** + * \brief Connect CUDA to EGLStream as a consumer with given flags. + * + * Connect CUDA as a consumer to EGLStreamKHR specified by \p stream with specified \p flags defined by + * ::cudaEglResourceLocationFlags. + * + * The flags specify whether the consumer wants to access frames from system memory or video memory. + * Default is ::cudaEglResourceLocationVidmem. + * + * \param conn - Pointer to the returned connection handle + * \param eglStream - EGLStreamKHR handle + * \param flags - Flags denote intended location - system or video. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * + * \sa + * ::cudaEGLStreamConsumerDisconnect, + * ::cudaEGLStreamConsumerAcquireFrame, + * ::cudaEGLStreamConsumerReleaseFrame, + * ::cuEGLStreamConsumerConnectWithFlags + */ +extern __host__ cudaError_t CUDARTAPI cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection *conn, EGLStreamKHR eglStream, unsigned int flags); + +/** + * \brief Disconnect CUDA as a consumer to EGLStream . + * + * Disconnect CUDA as a consumer to EGLStreamKHR. + * + * \param conn - Conection to disconnect. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * + * \sa + * ::cudaEGLStreamConsumerConnect, + * ::cudaEGLStreamConsumerAcquireFrame, + * ::cudaEGLStreamConsumerReleaseFrame, + * ::cuEGLStreamConsumerDisconnect + */ +extern __host__ cudaError_t CUDARTAPI cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection *conn); + +/** + * \brief Acquire an image frame from the EGLStream with CUDA as a consumer. + * + * Acquire an image frame from EGLStreamKHR. + * ::cudaGraphicsResourceGetMappedEglFrame can be called on \p pCudaResource to get + * ::cudaEglFrame. + * + * \param conn - Connection on which to acquire + * \param pCudaResource - CUDA resource on which the EGLStream frame will be mapped for use. + * \param pStream - CUDA stream for synchronization and any data migrations + * implied by ::cudaEglResourceLocationFlags. + * \param timeout - Desired timeout in usec. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * ::cudaErrorLaunchTimeout + * + * \sa + * ::cudaEGLStreamConsumerConnect, + * ::cudaEGLStreamConsumerDisconnect, + * ::cudaEGLStreamConsumerReleaseFrame, + * ::cuEGLStreamConsumerAcquireFrame + */ + +extern __host__ cudaError_t CUDARTAPI cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection *conn, + cudaGraphicsResource_t *pCudaResource, cudaStream_t *pStream, unsigned int timeout); +/** + * \brief Releases the last frame acquired from the EGLStream. + * + * Release the acquired image frame specified by \p pCudaResource to EGLStreamKHR. + * + * \param conn - Connection on which to release + * \param pCudaResource - CUDA resource whose corresponding frame is to be released + * \param pStream - CUDA stream on which release will be done. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * + * \sa + * ::cudaEGLStreamConsumerConnect, + * ::cudaEGLStreamConsumerDisconnect, + * ::cudaEGLStreamConsumerAcquireFrame, + * ::cuEGLStreamConsumerReleaseFrame + */ +extern __host__ cudaError_t CUDARTAPI cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection *conn, + cudaGraphicsResource_t pCudaResource, cudaStream_t *pStream); + +/** + * \brief Connect CUDA to EGLStream as a producer. + * + * Connect CUDA as a producer to EGLStreamKHR specified by \p stream. + * + * The EGLStreamKHR is an EGL object that transfers a sequence of image frames from one + * API to another. + * + * \param conn - Pointer to the returned connection handle + * \param eglStream - EGLStreamKHR handle + * \param width - width of the image to be submitted to the stream + * \param height - height of the image to be submitted to the stream + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * + * \sa + * ::cudaEGLStreamProducerDisconnect, + * ::cudaEGLStreamProducerPresentFrame, + * ::cudaEGLStreamProducerReturnFrame, + * ::cuEGLStreamProducerConnect + */ +extern __host__ cudaError_t CUDARTAPI cudaEGLStreamProducerConnect(cudaEglStreamConnection *conn, + EGLStreamKHR eglStream, EGLint width, EGLint height); + +/** + * \brief Disconnect CUDA as a producer to EGLStream . + * + * Disconnect CUDA as a producer to EGLStreamKHR. + * + * \param conn - Conection to disconnect. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * + * \sa + * ::cudaEGLStreamProducerConnect, + * ::cudaEGLStreamProducerPresentFrame, + * ::cudaEGLStreamProducerReturnFrame, + * ::cuEGLStreamProducerDisconnect + */ +extern __host__ cudaError_t CUDARTAPI cudaEGLStreamProducerDisconnect(cudaEglStreamConnection *conn); + +/** + * \brief Present a CUDA eglFrame to the EGLStream with CUDA as a producer. + * + * The ::cudaEglFrame is defined as: + * \code + * typedef struct cudaEglFrame_st { + * union { + * cudaArray_t pArray[CUDA_EGL_MAX_PLANES]; + * struct cudaPitchedPtr pPitch[CUDA_EGL_MAX_PLANES]; + * } frame; + * cudaEglPlaneDesc planeDesc[CUDA_EGL_MAX_PLANES]; + * unsigned int planeCount; + * cudaEglFrameType frameType; + * cudaEglColorFormat eglColorFormat; + * } cudaEglFrame; + * \endcode + * + * For ::cudaEglFrame of type ::cudaEglFrameTypePitch, the application may present sub-region of a memory + * allocation. In that case, ::cudaPitchedPtr::ptr will specify the start address of the sub-region in + * the allocation and ::cudaEglPlaneDesc will specify the dimensions of the sub-region. + * + * \param conn - Connection on which to present the CUDA array + * \param eglframe - CUDA Eglstream Proucer Frame handle to be sent to the consumer over EglStream. + * \param pStream - CUDA stream on which to present the frame. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * + * \sa + * ::cudaEGLStreamProducerConnect, + * ::cudaEGLStreamProducerDisconnect, + * ::cudaEGLStreamProducerReturnFrame, + * ::cuEGLStreamProducerPresentFrame + */ +extern __host__ cudaError_t CUDARTAPI cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection *conn, + cudaEglFrame eglframe, cudaStream_t *pStream); + +/** + * \brief Return the CUDA eglFrame to the EGLStream last released by the consumer. + * + * This API can potentially return cudaErrorLaunchTimeout if the consumer has not + * returned a frame to EGL stream. If timeout is returned the application can retry. + * + * \param conn - Connection on which to present the CUDA array + * \param eglframe - CUDA Eglstream Proucer Frame handle returned from the consumer over EglStream. + * \param pStream - CUDA stream on which to return the frame. + * + * \return + * ::cudaSuccess, + * ::cudaErrorLaunchTimeout, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * + * \sa + * ::cudaEGLStreamProducerConnect, + * ::cudaEGLStreamProducerDisconnect, + * ::cudaEGLStreamProducerPresentFrame, + * ::cuEGLStreamProducerReturnFrame + */ +extern __host__ cudaError_t CUDARTAPI cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection *conn, + cudaEglFrame *eglframe, cudaStream_t *pStream); + +/** + * \brief Get an eglFrame through which to access a registered EGL graphics resource. + * + * Returns in \p *eglFrame an eglFrame pointer through which the registered graphics resource + * \p resource may be accessed. + * This API can only be called for EGL graphics resources. + * + * The ::cudaEglFrame is defined as + * \code + * typedef struct cudaEglFrame_st { + * union { + * cudaArray_t pArray[CUDA_EGL_MAX_PLANES]; + * struct cudaPitchedPtr pPitch[CUDA_EGL_MAX_PLANES]; + * } frame; + * cudaEglPlaneDesc planeDesc[CUDA_EGL_MAX_PLANES]; + * unsigned int planeCount; + * cudaEglFrameType frameType; + * cudaEglColorFormat eglColorFormat; + * } cudaEglFrame; + * \endcode + * + * + * \param eglFrame - Returned eglFrame. + * \param resource - Registered resource to access. + * \param index - Index for cubemap surfaces. + * \param mipLevel - Mipmap level for the subresource to access. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown + * + * \note Note that in case of multiplanar \p *eglFrame, pitch of only first plane (unsigned int cudaEglPlaneDesc::pitch) is to be considered by the application. + * + * \sa + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuGraphicsResourceGetMappedEglFrame + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, + cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel); + +/** + * \brief Creates an event from EGLSync object + * + * Creates an event *phEvent from an EGLSyncKHR eglSync with the flages specified + * via \p flags. Valid flags include: + * - ::cudaEventDefault: Default event creation flag. + * - ::cudaEventBlockingSync: Specifies that the created event should use blocking + * synchronization. A CPU thread that uses ::cudaEventSynchronize() to wait on + * an event created with this flag will block until the event has actually + * been completed. + * + * ::cudaEventRecord and TimingData are not supported for events created from EGLSync. + * + * The EGLSyncKHR is an opaque handle to an EGL sync object. + * typedef void* EGLSyncKHR + * + * \param phEvent - Returns newly created event + * \param eglSync - Opaque handle to EGLSync object + * \param flags - Event creation flags + * + * \return + * ::cudaSuccess, + * ::cudaErrorInitializationError, + * ::cudaErrorInvalidValue, + * ::cudaErrorLaunchFailure, + * ::cudaErrorMemoryAllocation + * + * \sa + * ::cudaEventQuery, + * ::cudaEventSynchronize, + * ::cudaEventDestroy + */ +extern __host__ cudaError_t CUDARTAPI cudaEventCreateFromEGLSync(cudaEvent_t *phEvent, EGLSyncKHR eglSync, unsigned int flags); + +/** @} */ /* END CUDART_EGL */ + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif /* __CUDA_EGL_INTEROP_H__ */ + diff --git a/cuda_toolkit/include/cuda_fp16.h b/cuda_toolkit/include/cuda_fp16.h new file mode 100644 index 0000000000000000000000000000000000000000..85880dd696f8a6231977eda9cbe0c890169b1bb7 --- /dev/null +++ b/cuda_toolkit/include/cuda_fp16.h @@ -0,0 +1,4884 @@ +/* +* Copyright 1993-2024 NVIDIA Corporation. All rights reserved. +* +* NOTICE TO LICENSEE: +* +* This source code and/or documentation ("Licensed Deliverables") are +* subject to NVIDIA intellectual property rights under U.S. and +* international Copyright laws. +* +* These Licensed Deliverables contained herein is PROPRIETARY and +* CONFIDENTIAL to NVIDIA and is being provided under the terms and +* conditions of a form of NVIDIA software license agreement by and +* between NVIDIA and Licensee ("License Agreement") or electronically +* accepted by Licensee. Notwithstanding any terms or conditions to +* the contrary in the License Agreement, reproduction or disclosure +* of the Licensed Deliverables to any third party without the express +* written consent of NVIDIA is prohibited. +* +* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE +* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE +* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS +* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. +* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED +* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, +* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. +* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE +* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY +* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY +* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +* OF THESE LICENSED DELIVERABLES. +* +* U.S. Government End Users. These Licensed Deliverables are a +* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT +* 1995), consisting of "commercial computer software" and "commercial +* computer software documentation" as such terms are used in 48 +* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government +* only as a commercial end item. Consistent with 48 C.F.R.12.212 and +* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all +* U.S. Government End Users acquire the Licensed Deliverables with +* only those rights set forth herein. +* +* Any use of the Licensed Deliverables in individual and commercial +* software must include, in the user documentation and internal +* comments to the code, the above Disclaimer and U.S. Government End +* Users Notice. +*/ + +/** +* \defgroup CUDA_MATH_INTRINSIC_HALF Half Precision Intrinsics +* This section describes half precision intrinsic functions. +* To use these functions, include the header file \p cuda_fp16.h in your program. +* All of the functions defined here are available in device code. +* Some of the functions are also available to host compilers, please +* refer to respective functions' documentation for details. +* +* NOTE: Aggressive floating-point optimizations performed by host or device +* compilers may affect numeric behavior of the functions implemented in this +* header. +* +* The following macros are available to help users selectively enable/disable +* various definitions present in the header file: +* - \p CUDA_NO_HALF - If defined, this macro will prevent the definition of +* additional type aliases in the global namespace, helping to avoid potential +* conflicts with symbols defined in the user program. +* - \p __CUDA_NO_HALF_CONVERSIONS__ - If defined, this macro will prevent the +* use of the C++ type conversions (converting constructors and conversion +* operators) that are common for built-in floating-point types, but may be +* undesirable for \p half which is essentially a user-defined type. +* - \p __CUDA_NO_HALF_OPERATORS__ and \p __CUDA_NO_HALF2_OPERATORS__ - If +* defined, these macros will prevent the inadvertent use of usual arithmetic +* and comparison operators. This enforces the storage-only type semantics and +* prevents C++ style computations on \p half and \p half2 types. +*/ + +/** +* \defgroup CUDA_MATH_INTRINSIC_HALF_CONSTANTS Half Arithmetic Constants +* \ingroup CUDA_MATH_INTRINSIC_HALF +* To use these constants, include the header file \p cuda_fp16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__HALF_ARITHMETIC Half Arithmetic Functions +* \ingroup CUDA_MATH_INTRINSIC_HALF +* To use these functions, include the header file \p cuda_fp16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__HALF2_ARITHMETIC Half2 Arithmetic Functions +* \ingroup CUDA_MATH_INTRINSIC_HALF +* To use these functions, include the header file \p cuda_fp16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__HALF_COMPARISON Half Comparison Functions +* \ingroup CUDA_MATH_INTRINSIC_HALF +* To use these functions, include the header file \p cuda_fp16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__HALF2_COMPARISON Half2 Comparison Functions +* \ingroup CUDA_MATH_INTRINSIC_HALF +* To use these functions, include the header file \p cuda_fp16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__HALF_MISC Half Precision Conversion and Data Movement +* \ingroup CUDA_MATH_INTRINSIC_HALF +* To use these functions, include the header file \p cuda_fp16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__HALF_FUNCTIONS Half Math Functions +* \ingroup CUDA_MATH_INTRINSIC_HALF +* To use these functions, include the header file \p cuda_fp16.h in your program. +*/ + +/** +* \defgroup CUDA_MATH__HALF2_FUNCTIONS Half2 Math Functions +* \ingroup CUDA_MATH_INTRINSIC_HALF +* To use these functions, include the header file \p cuda_fp16.h in your program. +*/ + +#ifndef __CUDA_FP16_H__ +#define __CUDA_FP16_H__ + +/* bring in float2, double4, etc vector types */ +#include "vector_types.h" +/* bring in operations on vector types like: make_float2 */ +#include "vector_functions.h" + +#define ___CUDA_FP16_STRINGIFY_INNERMOST(x) #x +#define __CUDA_FP16_STRINGIFY(x) ___CUDA_FP16_STRINGIFY_INNERMOST(x) + +#if defined(__cplusplus) + +/* Set up function decorations */ +#if (defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3)))) +#define __CUDA_FP16_DECL__ __device__ +#define __CUDA_HOSTDEVICE_FP16_DECL__ __device__ +#define __CUDA_HOSTDEVICE__ __device__ +#elif defined(__CUDACC__) || defined(_NVHPC_CUDA) +#define __CUDA_FP16_DECL__ static __device__ __inline__ +#define __CUDA_HOSTDEVICE_FP16_DECL__ static __host__ __device__ __inline__ +#define __CUDA_HOSTDEVICE__ __host__ __device__ +#else /* !defined(__CUDACC__) */ +#if defined(__GNUC__) +#define __CUDA_HOSTDEVICE_FP16_DECL__ static __attribute__ ((unused)) +#else +#define __CUDA_HOSTDEVICE_FP16_DECL__ static +#endif /* defined(__GNUC__) */ +#define __CUDA_HOSTDEVICE__ +#endif /* (defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3)))) */ + +#define __CUDA_FP16_TYPES_EXIST__ + +/* Macros to allow half & half2 to be used by inline assembly */ +#define __HALF_TO_US(var) *(reinterpret_cast(&(var))) +#define __HALF_TO_CUS(var) *(reinterpret_cast(&(var))) +#define __HALF2_TO_UI(var) *(reinterpret_cast(&(var))) +#define __HALF2_TO_CUI(var) *(reinterpret_cast(&(var))) + +/* Forward-declaration of structures defined in "cuda_fp16.hpp" */ +struct __half; +struct __half2; + +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts double number to half precision in round-to-nearest-even mode +* and returns \p half with converted value. +* +* \details Converts double number \p a to half precision in round-to-nearest-even mode. +* \param[in] a - double. Is only being read. +* \returns half +* - \p a converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __double2half(const double a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts float number to half precision in round-to-nearest-even mode +* and returns \p half with converted value. +* +* \details Converts float number \p a to half precision in round-to-nearest-even mode. +* \param[in] a - float. Is only being read. +* \returns half +* - \p a converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __float2half(const float a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts float number to half precision in round-to-nearest-even mode +* and returns \p half with converted value. +* +* \details Converts float number \p a to half precision in round-to-nearest-even mode. +* \param[in] a - float. Is only being read. +* \returns half +* - \p a converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __float2half_rn(const float a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts float number to half precision in round-towards-zero mode +* and returns \p half with converted value. +* +* \details Converts float number \p a to half precision in round-towards-zero mode. +* \param[in] a - float. Is only being read. +* \returns half +* - \p a converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __float2half_rz(const float a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts float number to half precision in round-down mode +* and returns \p half with converted value. +* +* \details Converts float number \p a to half precision in round-down mode. +* \param[in] a - float. Is only being read. +* +* \returns half +* - \p a converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __float2half_rd(const float a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts float number to half precision in round-up mode +* and returns \p half with converted value. +* +* \details Converts float number \p a to half precision in round-up mode. +* \param[in] a - float. Is only being read. +* +* \returns half +* - \p a converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __float2half_ru(const float a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts \p half number to float. +* +* \details Converts half number \p a to float. +* \param[in] a - float. Is only being read. +* +* \returns float +* - \p a converted to float. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ float __half2float(const __half a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts input to half precision in round-to-nearest-even mode and +* populates both halves of \p half2 with converted value. +* +* \details Converts input \p a to half precision in round-to-nearest-even mode and +* populates both halves of \p half2 with converted value. +* \param[in] a - float. Is only being read. +* +* \returns half2 +* - The \p half2 value with both halves equal to the converted half +* precision number. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __float2half2_rn(const float a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts both input floats to half precision in round-to-nearest-even +* mode and returns \p half2 with converted values. +* +* \details Converts both input floats to half precision in round-to-nearest-even mode +* and combines the results into one \p half2 number. Low 16 bits of the return +* value correspond to the input \p a, high 16 bits correspond to the input \p +* b. +* \param[in] a - float. Is only being read. +* \param[in] b - float. Is only being read. +* +* \returns half2 +* - The \p half2 value with corresponding halves equal to the +* converted input floats. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __floats2half2_rn(const float a, const float b); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts low 16 bits of \p half2 to float and returns the result +* +* \details Converts low 16 bits of \p half2 input \p a to 32-bit floating-point number +* and returns the result. +* \param[in] a - half2. Is only being read. +* +* \returns float +* - The low 16 bits of \p a converted to float. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ float __low2float(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts high 16 bits of \p half2 to float and returns the result +* +* \details Converts high 16 bits of \p half2 input \p a to 32-bit floating-point number +* and returns the result. +* \param[in] a - half2. Is only being read. +* +* \returns float +* - The high 16 bits of \p a converted to float. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ float __high2float(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed char in round-towards-zero mode. +* +* \details Convert the half-precision floating-point value \p h to a signed char +* integer in round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns signed char +* - \p h converted to a signed char. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ signed char __half2char_rz(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned char in round-towards-zero +* mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned +* char in round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns unsigned char +* - \p h converted to an unsigned char. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned char __half2uchar_rz(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed short integer in round-towards-zero mode. +* +* \details Convert the half-precision floating-point value \p h to a signed short +* integer in round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns short int +* - \p h converted to a signed short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ short int __half2short_rz(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned short integer in round-towards-zero +* mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned short +* integer in round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns unsigned short int +* - \p h converted to an unsigned short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned short int __half2ushort_rz(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed integer in round-towards-zero mode. +* +* \details Convert the half-precision floating-point value \p h to a signed integer in +* round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns int +* - \p h converted to a signed integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ int __half2int_rz(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned integer in round-towards-zero mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned integer +* in round-towards-zero mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns unsigned int +* - \p h converted to an unsigned integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned int __half2uint_rz(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed 64-bit integer in round-towards-zero mode. +* +* \details Convert the half-precision floating-point value \p h to a signed 64-bit +* integer in round-towards-zero mode. NaN inputs return a long long int with hex value of 0x8000000000000000. +* \param[in] h - half. Is only being read. +* +* \returns long long int +* - \p h converted to a signed 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ long long int __half2ll_rz(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned 64-bit integer in round-towards-zero +* mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned 64-bit +* integer in round-towards-zero mode. NaN inputs return 0x8000000000000000. +* \param[in] h - half. Is only being read. +* +* \returns unsigned long long int +* - \p h converted to an unsigned 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned long long int __half2ull_rz(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Vector function, combines two \p __half numbers into one \p __half2 number. +* +* \details Combines two input \p __half number \p x and \p y into one \p __half2 number. +* Input \p x is stored in low 16 bits of the return value, input \p y is stored +* in high 16 bits of the return value. +* \param[in] x - half. Is only being read. +* \param[in] y - half. Is only being read. +* +* \returns __half2 +* - The \p __half2 vector with one half equal to \p x and the other to \p y. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 make_half2(const __half x, const __half y); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts both components of float2 number to half precision in +* round-to-nearest-even mode and returns \p half2 with converted values. +* +* \details Converts both components of float2 to half precision in round-to-nearest-even +* mode and combines the results into one \p half2 number. Low 16 bits of the +* return value correspond to \p a.x and high 16 bits of the return value +* correspond to \p a.y. +* \param[in] a - float2. Is only being read. +* +* \returns half2 +* - The \p half2 which has corresponding halves equal to the +* converted float2 components. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __float22half2_rn(const float2 a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Converts both halves of \p half2 to float2 and returns the result. +* +* \details Converts both halves of \p half2 input \p a to float2 and returns the +* result. +* \param[in] a - half2. Is only being read. +* +* \returns float2 +* - \p a converted to float2. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ float2 __half22float2(const __half2 a); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed integer in round-to-nearest-even mode. +* +* \details Convert the half-precision floating-point value \p h to a signed integer in +* round-to-nearest-even mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns int +* - \p h converted to a signed integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ int __half2int_rn(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed integer in round-down mode. +* +* \details Convert the half-precision floating-point value \p h to a signed integer in +* round-down mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns int +* - \p h converted to a signed integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ int __half2int_rd(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed integer in round-up mode. +* +* \details Convert the half-precision floating-point value \p h to a signed integer in +* round-up mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns int +* - \p h converted to a signed integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ int __half2int_ru(const __half h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed integer to a half in round-to-nearest-even mode. +* +* \details Convert the signed integer value \p i to a half-precision floating-point +* value in round-to-nearest-even mode. +* \param[in] i - int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __int2half_rn(const int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed integer to a half in round-towards-zero mode. +* +* \details Convert the signed integer value \p i to a half-precision floating-point +* value in round-towards-zero mode. +* \param[in] i - int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __int2half_rz(const int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed integer to a half in round-down mode. +* +* \details Convert the signed integer value \p i to a half-precision floating-point +* value in round-down mode. +* \param[in] i - int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __int2half_rd(const int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed integer to a half in round-up mode. +* +* \details Convert the signed integer value \p i to a half-precision floating-point +* value in round-up mode. +* \param[in] i - int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __int2half_ru(const int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed short integer in round-to-nearest-even +* mode. +* +* \details Convert the half-precision floating-point value \p h to a signed short +* integer in round-to-nearest-even mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns short int +* - \p h converted to a signed short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ short int __half2short_rn(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed short integer in round-down mode. +* +* \details Convert the half-precision floating-point value \p h to a signed short +* integer in round-down mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns short int +* - \p h converted to a signed short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ short int __half2short_rd(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed short integer in round-up mode. +* +* \details Convert the half-precision floating-point value \p h to a signed short +* integer in round-up mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns short int +* - \p h converted to a signed short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ short int __half2short_ru(const __half h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed short integer to a half in round-to-nearest-even +* mode. +* +* \details Convert the signed short integer value \p i to a half-precision floating-point +* value in round-to-nearest-even mode. +* \param[in] i - short int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __short2half_rn(const short int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed short integer to a half in round-towards-zero mode. +* +* \details Convert the signed short integer value \p i to a half-precision floating-point +* value in round-towards-zero mode. +* \param[in] i - short int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __short2half_rz(const short int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed short integer to a half in round-down mode. +* +* \details Convert the signed short integer value \p i to a half-precision floating-point +* value in round-down mode. +* \param[in] i - short int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __short2half_rd(const short int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed short integer to a half in round-up mode. +* +* \details Convert the signed short integer value \p i to a half-precision floating-point +* value in round-up mode. +* \param[in] i - short int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __short2half_ru(const short int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned integer in round-to-nearest-even mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned integer +* in round-to-nearest-even mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns unsigned int +* - \p h converted to an unsigned integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ unsigned int __half2uint_rn(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned integer in round-down mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned integer +* in round-down mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns unsigned int +* - \p h converted to an unsigned integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ unsigned int __half2uint_rd(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned integer in round-up mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned integer +* in round-up mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns unsigned int +* - \p h converted to an unsigned integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ unsigned int __half2uint_ru(const __half h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned integer to a half in round-to-nearest-even mode. +* +* \details Convert the unsigned integer value \p i to a half-precision floating-point +* value in round-to-nearest-even mode. +* \param[in] i - unsigned int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __uint2half_rn(const unsigned int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned integer to a half in round-towards-zero mode. +* +* \details Convert the unsigned integer value \p i to a half-precision floating-point +* value in round-towards-zero mode. +* \param[in] i - unsigned int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __uint2half_rz(const unsigned int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned integer to a half in round-down mode. +* +* \details Convert the unsigned integer value \p i to a half-precision floating-point +* value in round-down mode. +* \param[in] i - unsigned int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __uint2half_rd(const unsigned int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned integer to a half in round-up mode. +* +* \details Convert the unsigned integer value \p i to a half-precision floating-point +* value in round-up mode. +* \param[in] i - unsigned int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __uint2half_ru(const unsigned int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned short integer in round-to-nearest-even +* mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned short +* integer in round-to-nearest-even mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns unsigned short int +* - \p h converted to an unsigned short integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ unsigned short int __half2ushort_rn(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned short integer in round-down mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned short +* integer in round-down mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns unsigned short int +* - \p h converted to an unsigned short integer. +*/ +__CUDA_FP16_DECL__ unsigned short int __half2ushort_rd(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned short integer in round-up mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned short +* integer in round-up mode. NaN inputs are converted to 0. +* \param[in] h - half. Is only being read. +* +* \returns unsigned short int +* - \p h converted to an unsigned short integer. +*/ +__CUDA_FP16_DECL__ unsigned short int __half2ushort_ru(const __half h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned short integer to a half in round-to-nearest-even +* mode. +* +* \details Convert the unsigned short integer value \p i to a half-precision floating-point +* value in round-to-nearest-even mode. +* \param[in] i - unsigned short int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ushort2half_rn(const unsigned short int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned short integer to a half in round-towards-zero +* mode. +* +* \details Convert the unsigned short integer value \p i to a half-precision floating-point +* value in round-towards-zero mode. +* \param[in] i - unsigned short int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ushort2half_rz(const unsigned short int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned short integer to a half in round-down mode. +* +* \details Convert the unsigned short integer value \p i to a half-precision floating-point +* value in round-down mode. +* \param[in] i - unsigned short int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ushort2half_rd(const unsigned short int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned short integer to a half in round-up mode. +* +* \details Convert the unsigned short integer value \p i to a half-precision floating-point +* value in round-up mode. +* \param[in] i - unsigned short int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ushort2half_ru(const unsigned short int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned 64-bit integer in round-to-nearest-even +* mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned 64-bit +* integer in round-to-nearest-even mode. NaN inputs return 0x8000000000000000. +* \param[in] h - half. Is only being read. +* +* \returns unsigned long long int +* - \p h converted to an unsigned 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ unsigned long long int __half2ull_rn(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned 64-bit integer in round-down mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned 64-bit +* integer in round-down mode. NaN inputs return 0x8000000000000000. +* \param[in] h - half. Is only being read. +* +* \returns unsigned long long int +* - \p h converted to an unsigned 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ unsigned long long int __half2ull_rd(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to an unsigned 64-bit integer in round-up mode. +* +* \details Convert the half-precision floating-point value \p h to an unsigned 64-bit +* integer in round-up mode. NaN inputs return 0x8000000000000000. +* \param[in] h - half. Is only being read. +* +* \returns unsigned long long int +* - \p h converted to an unsigned 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ unsigned long long int __half2ull_ru(const __half h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned 64-bit integer to a half in round-to-nearest-even +* mode. +* +* \details Convert the unsigned 64-bit integer value \p i to a half-precision floating-point +* value in round-to-nearest-even mode. +* \param[in] i - unsigned long long int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ull2half_rn(const unsigned long long int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned 64-bit integer to a half in round-towards-zero +* mode. +* +* \details Convert the unsigned 64-bit integer value \p i to a half-precision floating-point +* value in round-towards-zero mode. +* \param[in] i - unsigned long long int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ull2half_rz(const unsigned long long int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned 64-bit integer to a half in round-down mode. +* +* \details Convert the unsigned 64-bit integer value \p i to a half-precision floating-point +* value in round-down mode. +* \param[in] i - unsigned long long int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ull2half_rd(const unsigned long long int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert an unsigned 64-bit integer to a half in round-up mode. +* +* \details Convert the unsigned 64-bit integer value \p i to a half-precision floating-point +* value in round-up mode. +* \param[in] i - unsigned long long int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ull2half_ru(const unsigned long long int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed 64-bit integer in round-to-nearest-even +* mode. +* +* \details Convert the half-precision floating-point value \p h to a signed 64-bit +* integer in round-to-nearest-even mode. NaN inputs return a long long int with hex value of 0x8000000000000000. +* \param[in] h - half. Is only being read. +* +* \returns long long int +* - \p h converted to a signed 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ long long int __half2ll_rn(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed 64-bit integer in round-down mode. +* +* \details Convert the half-precision floating-point value \p h to a signed 64-bit +* integer in round-down mode. NaN inputs return a long long int with hex value of 0x8000000000000000. +* \param[in] h - half. Is only being read. +* +* \returns long long int +* - \p h converted to a signed 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ long long int __half2ll_rd(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a half to a signed 64-bit integer in round-up mode. +* +* \details Convert the half-precision floating-point value \p h to a signed 64-bit +* integer in round-up mode. NaN inputs return a long long int with hex value of 0x8000000000000000. +* \param[in] h - half. Is only being read. +* +* \returns long long int +* - \p h converted to a signed 64-bit integer. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ long long int __half2ll_ru(const __half h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed 64-bit integer to a half in round-to-nearest-even +* mode. +* +* \details Convert the signed 64-bit integer value \p i to a half-precision floating-point +* value in round-to-nearest-even mode. +* \param[in] i - long long int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ll2half_rn(const long long int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed 64-bit integer to a half in round-towards-zero mode. +* +* \details Convert the signed 64-bit integer value \p i to a half-precision floating-point +* value in round-towards-zero mode. +* \param[in] i - long long int. Is only being read. +* +* \returns half +* - \p i converted to half. +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ll2half_rz(const long long int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed 64-bit integer to a half in round-down mode. +* +* \details Convert the signed 64-bit integer value \p i to a half-precision floating-point +* value in round-down mode. +* \param[in] i - long long int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ll2half_rd(const long long int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Convert a signed 64-bit integer to a half in round-up mode. +* +* \details Convert the signed 64-bit integer value \p i to a half-precision floating-point +* value in round-up mode. +* \param[in] i - long long int. Is only being read. +* +* \returns half +* - \p i converted to half. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ll2half_ru(const long long int i); +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Truncate input argument to the integral part. +* +* \details Round \p h to the nearest integer value that does not exceed \p h in +* magnitude. +* \param[in] h - half. Is only being read. +* +* \returns half +* - The truncated integer value. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half htrunc(const __half h); +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculate ceiling of the input argument. +* +* \details Compute the smallest integer value not less than \p h. +* \param[in] h - half. Is only being read. +* +* \returns half +* - The smallest integer value not less than \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hceil(const __half h); +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculate the largest integer less than or equal to \p h. +* +* \details Calculate the largest integer value which is less than or equal to \p h. +* \param[in] h - half. Is only being read. +* +* \returns half +* - The largest integer value which is less than or equal to \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hfloor(const __half h); +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Round input to nearest integer value in half-precision floating-point +* number. +* +* \details Round \p h to the nearest integer value in half-precision floating-point +* format, with halfway cases rounded to the nearest even integer value. +* \param[in] h - half. Is only being read. +* +* \returns half +* - The nearest integer to \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hrint(const __half h); + +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Truncate \p half2 vector input argument to the integral part. +* +* \details Round each component of vector \p h to the nearest integer value that does +* not exceed \p h in magnitude. +* \param[in] h - half2. Is only being read. +* +* \returns half2 +* - The truncated \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2trunc(const __half2 h); +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculate \p half2 vector ceiling of the input argument. +* +* \details For each component of vector \p h compute the smallest integer value not less +* than \p h. +* \param[in] h - half2. Is only being read. +* +* \returns half2 +* - The vector of smallest integers not less than \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2ceil(const __half2 h); +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculate the largest integer less than or equal to \p h. +* +* \details For each component of vector \p h calculate the largest integer value which +* is less than or equal to \p h. +* \param[in] h - half2. Is only being read. +* +* \returns half2 +* - The vector of largest integers which is less than or equal to \p h. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2floor(const __half2 h); +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Round input to nearest integer value in half-precision floating-point +* number. +* +* \details Round each component of \p half2 vector \p h to the nearest integer value in +* half-precision floating-point format, with halfway cases rounded to the +* nearest even integer value. +* \param[in] h - half2. Is only being read. +* +* \returns half2 +* - The vector of rounded integer values. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2rint(const __half2 h); +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Returns \p half2 with both halves equal to the input value. +* +* \details Returns \p half2 number with both halves equal to the input \p a \p half +* number. +* \param[in] a - half. Is only being read. +* +* \returns half2 +* - The vector which has both its halves equal to the input \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __half2half2(const __half a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Swaps both halves of the \p half2 input. +* +* \details Swaps both halves of the \p half2 input and returns a new \p half2 number +* with swapped halves. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - \p a with its halves being swapped. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __lowhigh2highlow(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Extracts low 16 bits from each of the two \p half2 inputs and combines +* into one \p half2 number. +* +* \details Extracts low 16 bits from each of the two \p half2 inputs and combines into +* one \p half2 number. Low 16 bits from input \p a is stored in low 16 bits of +* the return value, low 16 bits from input \p b is stored in high 16 bits of +* the return value. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The low 16 bits of \p a and of \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __lows2half2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Extracts high 16 bits from each of the two \p half2 inputs and +* combines into one \p half2 number. +* +* \details Extracts high 16 bits from each of the two \p half2 inputs and combines into +* one \p half2 number. High 16 bits from input \p a is stored in low 16 bits of +* the return value, high 16 bits from input \p b is stored in high 16 bits of +* the return value. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The high 16 bits of \p a and of \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __highs2half2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Returns high 16 bits of \p half2 input. +* +* \details Returns high 16 bits of \p half2 input \p a. +* \param[in] a - half2. Is only being read. +* +* \returns half +* - The high 16 bits of the input. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __high2half(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Returns low 16 bits of \p half2 input. +* +* \details Returns low 16 bits of \p half2 input \p a. +* \param[in] a - half2. Is only being read. +* +* \returns half +* - Returns \p half which contains low 16 bits of the input \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __low2half(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Checks if the input \p half number is infinite. +* +* \details Checks if the input \p half number \p a is infinite. +* \param[in] a - half. Is only being read. +* +* \returns int +* - -1 iff \p a is equal to negative infinity, +* - 1 iff \p a is equal to positive infinity, +* - 0 otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ int __hisinf(const __half a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Combines two \p half numbers into one \p half2 number. +* +* \details Combines two input \p half number \p a and \p b into one \p half2 number. +* Input \p a is stored in low 16 bits of the return value, input \p b is stored +* in high 16 bits of the return value. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half2 +* - The half2 with one half equal to \p a and the other to \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __halves2half2(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Extracts low 16 bits from \p half2 input. +* +* \details Extracts low 16 bits from \p half2 input \p a and returns a new \p half2 +* number which has both halves equal to the extracted bits. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The half2 with both halves equal to the low 16 bits of the input. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __low2half2(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Extracts high 16 bits from \p half2 input. +* +* \details Extracts high 16 bits from \p half2 input \p a and returns a new \p half2 +* number which has both halves equal to the extracted bits. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The half2 with both halves equal to the high 16 bits of the input. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __high2half2(const __half2 a); + +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Reinterprets bits in a \p half as a signed short integer. +* +* \details Reinterprets the bits in the half-precision floating-point number \p h +* as a signed short integer. +* \param[in] h - half. Is only being read. +* +* \returns short int +* - The reinterpreted value. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ short int __half_as_short(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Reinterprets bits in a \p half as an unsigned short integer. +* +* \details Reinterprets the bits in the half-precision floating-point \p h +* as an unsigned short number. +* \param[in] h - half. Is only being read. +* +* \returns unsigned short int +* - The reinterpreted value. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned short int __half_as_ushort(const __half h); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Reinterprets bits in a signed short integer as a \p half. +* +* \details Reinterprets the bits in the signed short integer \p i as a +* half-precision floating-point number. +* \param[in] i - short int. Is only being read. +* +* \returns half +* - The reinterpreted value. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __short_as_half(const short int i); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Reinterprets bits in an unsigned short integer as a \p half. +* +* \details Reinterprets the bits in the unsigned short integer \p i as a +* half-precision floating-point number. +* \param[in] i - unsigned short int. Is only being read. +* +* \returns half +* - The reinterpreted value. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ushort_as_half(const unsigned short int i); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Calculates \p half maximum of two input values. +* +* \details Calculates \p half max(\p a, \p b) +* defined as (\p a > \p b) ? \p a : \p b. +* - If either of inputs is NaN, the other input is returned. +* - If both inputs are NaNs, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmax(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Calculates \p half minimum of two input values. +* +* \details Calculates \p half min(\p a, \p b) +* defined as (\p a < \p b) ? \p a : \p b. +* - If either of inputs is NaN, the other input is returned. +* - If both inputs are NaNs, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmin(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Calculates \p half2 vector maximum of two inputs. +* +* \details Calculates \p half2 vector max(\p a, \p b). +* Elementwise \p half operation is defined as +* (\p a > \p b) ? \p a : \p b. +* - If either of inputs is NaN, the other input is returned. +* - If both inputs are NaNs, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The result of elementwise maximum of vectors \p a and \p b +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmax2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Calculates \p half2 vector minimum of two inputs. +* +* \details Calculates \p half2 vector min(\p a, \p b). +* Elementwise \p half operation is defined as +* (\p a < \p b) ? \p a : \p b. +* - If either of inputs is NaN, the other input is returned. +* - If both inputs are NaNs, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The result of elementwise minimum of vectors \p a and \p b +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmin2(const __half2 a, const __half2 b); + +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +#if !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 300) +#if !defined warpSize && !defined __local_warpSize +#define warpSize 32 +#define __local_warpSize +#endif + +#if !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ < 700) + +#if defined(_WIN32) +# define __CUDA_FP16_DEPRECATED__(msg) __declspec(deprecated(msg)) +#elif (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5 && !defined(__clang__)))) +# define __CUDA_FP16_DEPRECATED__(msg) __attribute__((deprecated)) +#else +# define __CUDA_FP16_DEPRECATED__(msg) __attribute__((deprecated(msg))) +#endif + +#if defined(_NVHPC_CUDA) +#define __CUDA_FP16_WSB_DEPRECATION_MESSAGE(x) __CUDA_FP16_STRINGIFY(x) "() is deprecated in favor of " __CUDA_FP16_STRINGIFY(x) "_sync() and may be removed in a future release." +#else +#define __CUDA_FP16_WSB_DEPRECATION_MESSAGE(x) __CUDA_FP16_STRINGIFY(x) "() is deprecated in favor of " __CUDA_FP16_STRINGIFY(x) "_sync() and may be removed in a future release (Use -Wno-deprecated-declarations to suppress this warning)." +#endif + +__CUDA_FP16_DECL__ __CUDA_FP16_DEPRECATED__(__CUDA_FP16_WSB_DEPRECATION_MESSAGE(__shfl)) __half2 __shfl(const __half2 var, const int delta, const int width = warpSize); +__CUDA_FP16_DECL__ __CUDA_FP16_DEPRECATED__(__CUDA_FP16_WSB_DEPRECATION_MESSAGE(__shfl_up)) __half2 __shfl_up(const __half2 var, const unsigned int delta, const int width = warpSize); +__CUDA_FP16_DECL__ __CUDA_FP16_DEPRECATED__(__CUDA_FP16_WSB_DEPRECATION_MESSAGE(__shfl_down))__half2 __shfl_down(const __half2 var, const unsigned int delta, const int width = warpSize); +__CUDA_FP16_DECL__ __CUDA_FP16_DEPRECATED__(__CUDA_FP16_WSB_DEPRECATION_MESSAGE(__shfl_xor)) __half2 __shfl_xor(const __half2 var, const int delta, const int width = warpSize); +__CUDA_FP16_DECL__ __CUDA_FP16_DEPRECATED__(__CUDA_FP16_WSB_DEPRECATION_MESSAGE(__shfl)) __half __shfl(const __half var, const int delta, const int width = warpSize); +__CUDA_FP16_DECL__ __CUDA_FP16_DEPRECATED__(__CUDA_FP16_WSB_DEPRECATION_MESSAGE(__shfl_up)) __half __shfl_up(const __half var, const unsigned int delta, const int width = warpSize); +__CUDA_FP16_DECL__ __CUDA_FP16_DEPRECATED__(__CUDA_FP16_WSB_DEPRECATION_MESSAGE(__shfl_down)) __half __shfl_down(const __half var, const unsigned int delta, const int width = warpSize); +__CUDA_FP16_DECL__ __CUDA_FP16_DEPRECATED__(__CUDA_FP16_WSB_DEPRECATION_MESSAGE(__shfl_xor)) __half __shfl_xor(const __half var, const int delta, const int width = warpSize); + +#undef __CUDA_FP16_WSB_DEPRECATION_MESSAGE +#undef __CUDA_FP16_DEPRECATED__ +#endif /* !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 700 */ + +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Exchange a variable between threads within a warp. Direct copy from indexed thread. +* +* \details Returns the value of var held by the thread whose ID is given by delta. +* If width is less than warpSize then each subsection of the warp behaves as a separate +* entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], +* the value returned corresponds to the value of var held by the delta modulo width (i.e. +* within the same subsection). width must have a value which is a power of 2; +* results are undefined if width is not a power of 2, or is a number greater than +* warpSize. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - half2. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 4-byte word referenced by var from the source thread ID as half2. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 __shfl_sync(const unsigned mask, const __half2 var, const int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller. +* +* \details Calculates a source thread ID by subtracting delta from the caller's lane ID. +* The value of var held by the resulting lane ID is returned: in effect, var is shifted up +* the warp by delta threads. If width is less than warpSize then each subsection of the warp +* behaves as a separate entity with a starting logical thread ID of 0. The source thread index +* will not wrap around the value of width, so effectively the lower delta threads will be unchanged. +* width must have a value which is a power of 2; results are undefined if width is not a power of 2, +* or is a number greater than warpSize. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - half2. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 4-byte word referenced by var from the source thread ID as half2. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 __shfl_up_sync(const unsigned mask, const __half2 var, const unsigned int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller. +* +* \details Calculates a source thread ID by adding delta to the caller's thread ID. +* The value of var held by the resulting thread ID is returned: this has the effect +* of shifting var down the warp by delta threads. If width is less than warpSize then +* each subsection of the warp behaves as a separate entity with a starting logical +* thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread +* will not wrap around the value of width and so the upper delta threads +* will remain unchanged. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - half2. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 4-byte word referenced by var from the source thread ID as half2. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 __shfl_down_sync(const unsigned mask, const __half2 var, const unsigned int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID. +* +* \details Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: +* the value of var held by the resulting thread ID is returned. If width is less than warpSize then each +* group of width consecutive threads are able to access elements from earlier groups of threads, +* however if they attempt to access elements from later groups of threads their own value of var +* will be returned. This mode implements a butterfly addressing pattern such as is used in tree +* reduction and broadcast. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - half2. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 4-byte word referenced by var from the source thread ID as half2. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 __shfl_xor_sync(const unsigned mask, const __half2 var, const int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Exchange a variable between threads within a warp. Direct copy from indexed thread. +* +* \details Returns the value of var held by the thread whose ID is given by delta. +* If width is less than warpSize then each subsection of the warp behaves as a separate +* entity with a starting logical thread ID of 0. If delta is outside the range [0:width-1], +* the value returned corresponds to the value of var held by the delta modulo width (i.e. +* within the same subsection). width must have a value which is a power of 2; +* results are undefined if width is not a power of 2, or is a number greater than +* warpSize. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - half. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 2-byte word referenced by var from the source thread ID as half. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half __shfl_sync(const unsigned mask, const __half var, const int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread with lower ID relative to the caller. +* \details Calculates a source thread ID by subtracting delta from the caller's lane ID. +* The value of var held by the resulting lane ID is returned: in effect, var is shifted up +* the warp by delta threads. If width is less than warpSize then each subsection of the warp +* behaves as a separate entity with a starting logical thread ID of 0. The source thread index +* will not wrap around the value of width, so effectively the lower delta threads will be unchanged. +* width must have a value which is a power of 2; results are undefined if width is not a power of 2, +* or is a number greater than warpSize. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - half. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 2-byte word referenced by var from the source thread ID as half. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half __shfl_up_sync(const unsigned mask, const __half var, const unsigned int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread with higher ID relative to the caller. +* +* \details Calculates a source thread ID by adding delta to the caller's thread ID. +* The value of var held by the resulting thread ID is returned: this has the effect +* of shifting var down the warp by delta threads. If width is less than warpSize then +* each subsection of the warp behaves as a separate entity with a starting logical +* thread ID of 0. As for __shfl_up_sync(), the ID number of the source thread +* will not wrap around the value of width and so the upper delta threads +* will remain unchanged. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - half. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 2-byte word referenced by var from the source thread ID as half. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half __shfl_down_sync(const unsigned mask, const __half var, const unsigned int delta, const int width = warpSize); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Exchange a variable between threads within a warp. Copy from a thread based on bitwise XOR of own thread ID. +* +* \details Calculates a source thread ID by performing a bitwise XOR of the caller's thread ID with mask: +* the value of var held by the resulting thread ID is returned. If width is less than warpSize then each +* group of width consecutive threads are able to access elements from earlier groups of threads, +* however if they attempt to access elements from later groups of threads their own value of var +* will be returned. This mode implements a butterfly addressing pattern such as is used in tree +* reduction and broadcast. +* \param[in] mask - unsigned int. Is only being read. +* \param[in] var - half. Is only being read. +* \param[in] delta - int. Is only being read. +* \param[in] width - int. Is only being read. +* +* \returns Returns the 2-byte word referenced by var from the source thread ID as half. +* If the source thread ID is out of range or the source thread has exited, the calling thread's own var is returned. +* \note_ref_guide_warp_shuffle +* \internal +* \exception-guarantee no-throw guarantee +* \behavior not reentrant, not thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half __shfl_xor_sync(const unsigned mask, const __half var, const int delta, const int width = warpSize); + +#if defined(__local_warpSize) +#undef warpSize +#undef __local_warpSize +#endif +#endif /*!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 300) */ + +#if defined(__cplusplus) && ( !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 320) ) +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.nc` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half2 __ldg(const __half2 *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.nc` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half __ldg(const __half *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.cg` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half2 __ldcg(const __half2 *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.cg` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half __ldcg(const __half *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.ca` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half2 __ldca(const __half2 *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.ca` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half __ldca(const __half *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.cs` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half2 __ldcs(const __half2 *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.cs` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half __ldcs(const __half *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.lu` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half2 __ldlu(const __half2 *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.lu` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half __ldlu(const __half *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.cv` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half2 __ldcv(const __half2 *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `ld.global.cv` load instruction. +* \param[in] ptr - memory location +* \returns The value pointed by `ptr` +*/ +__CUDA_FP16_DECL__ __half __ldcv(const __half *const ptr); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `st.global.wb` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_FP16_DECL__ void __stwb(__half2 *const ptr, const __half2 value); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `st.global.wb` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_FP16_DECL__ void __stwb(__half *const ptr, const __half value); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `st.global.cg` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_FP16_DECL__ void __stcg(__half2 *const ptr, const __half2 value); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `st.global.cg` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_FP16_DECL__ void __stcg(__half *const ptr, const __half value); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `st.global.cs` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_FP16_DECL__ void __stcs(__half2 *const ptr, const __half2 value); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `st.global.cs` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_FP16_DECL__ void __stcs(__half *const ptr, const __half value); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `st.global.wt` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_FP16_DECL__ void __stwt(__half2 *const ptr, const __half2 value); +/** +* \ingroup CUDA_MATH__HALF_MISC +* \brief Generates a `st.global.wt` store instruction. +* \param[out] ptr - memory location +* \param[in] value - the value to be stored +*/ +__CUDA_FP16_DECL__ void __stwt(__half *const ptr, const __half value); +#endif /*defined(__cplusplus) && ( !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 320) )*/ +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs half2 vector if-equal comparison. +* +* \details Performs \p half2 vector if-equal comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The vector result of if-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __heq2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector not-equal comparison. +* +* \details Performs \p half2 vector not-equal comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The vector result of not-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hne2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector less-equal comparison. +* +* \details Performs \p half2 vector less-equal comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The \p half2 result of less-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hle2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector greater-equal comparison. +* +* \details Performs \p half2 vector greater-equal comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The vector result of greater-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hge2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector less-than comparison. +* +* \details Performs \p half2 vector less-than comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The half2 vector result of less-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hlt2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector greater-than comparison. +* +* \details Performs \p half2 vector greater-than comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The vector result of greater-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hgt2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered if-equal comparison. +* +* \details Performs \p half2 vector if-equal comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The vector result of unordered if-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hequ2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered not-equal comparison. +* +* \details Performs \p half2 vector not-equal comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The vector result of unordered not-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hneu2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered less-equal comparison. +* +* Performs \p half2 vector less-equal comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The vector result of unordered less-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hleu2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered greater-equal comparison. +* +* \details Performs \p half2 vector greater-equal comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The \p half2 vector result of unordered greater-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hgeu2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered less-than comparison. +* +* \details Performs \p half2 vector less-than comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The vector result of unordered less-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hltu2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered greater-than comparison. +* +* \details Performs \p half2 vector greater-than comparison of inputs \p a and \p b. +* The corresponding \p half results are set to 1.0 for true, or 0.0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The \p half2 vector result of unordered greater-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hgtu2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs half2 vector if-equal comparison. +* +* \details Performs \p half2 vector if-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of if-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __heq2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector not-equal comparison. +* +* \details Performs \p half2 vector not-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of not-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hne2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector less-equal comparison. +* +* \details Performs \p half2 vector less-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of less-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hle2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector greater-equal comparison. +* +* \details Performs \p half2 vector greater-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of greater-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hge2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector less-than comparison. +* +* \details Performs \p half2 vector less-than comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of less-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hlt2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector greater-than comparison. +* +* \details Performs \p half2 vector greater-than comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of greater-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hgt2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered if-equal comparison. +* +* \details Performs \p half2 vector if-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered if-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hequ2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered not-equal comparison. +* +* \details Performs \p half2 vector not-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered not-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hneu2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered less-equal comparison. +* +* Performs \p half2 vector less-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered less-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hleu2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered greater-equal comparison. +* +* \details Performs \p half2 vector greater-equal comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered greater-equal comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hgeu2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered less-than comparison. +* +* \details Performs \p half2 vector less-than comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered less-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hltu2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered greater-than comparison. +* +* \details Performs \p half2 vector greater-than comparison of inputs \p a and \p b. +* The corresponding \p unsigned bits are set to 0xFFFF for true, or 0x0 for false. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns unsigned int +* - The vector mask result of unordered greater-than comparison of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hgtu2_mask(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Determine whether \p half2 argument is a NaN. +* +* \details Determine whether each half of input \p half2 number \p a is a NaN. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The half2 with the corresponding \p half results set to +* 1.0 for NaN, 0.0 otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hisnan2(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector addition in round-to-nearest-even mode. +* +* \details Performs \p half2 vector add of inputs \p a and \p b, in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-95 +* \endinternal +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The sum of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hadd2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector subtraction in round-to-nearest-even mode. +* +* \details Subtracts \p half2 input vector \p b from input vector \p a in +* round-to-nearest-even mode. +* \internal +* \req DEEPLEARN-SRM_REQ-104 +* \endinternal +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The subtraction of vector \p b from \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hsub2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector multiplication in round-to-nearest-even mode. +* +* \details Performs \p half2 vector multiplication of inputs \p a and \p b, in +* round-to-nearest-even mode. +* \internal +* \req DEEPLEARN-SRM_REQ-102 +* \endinternal +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The result of elementwise multiplying the vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmul2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector addition in round-to-nearest-even mode. +* +* \details Performs \p half2 vector add of inputs \p a and \p b, in round-to-nearest-even +* mode. Prevents floating-point contractions of mul+add into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-95 +* \endinternal +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The sum of vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hadd2_rn(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector subtraction in round-to-nearest-even mode. +* +* \details Subtracts \p half2 input vector \p b from input vector \p a in +* round-to-nearest-even mode. Prevents floating-point contractions of mul+sub +* into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-104 +* \endinternal +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The subtraction of vector \p b from \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hsub2_rn(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector multiplication in round-to-nearest-even mode. +* +* \details Performs \p half2 vector multiplication of inputs \p a and \p b, in +* round-to-nearest-even mode. Prevents floating-point contractions of +* mul+add or sub into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-102 +* \endinternal +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The result of elementwise multiplying the vectors \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmul2_rn(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector division in round-to-nearest-even mode. +* +* \details Divides \p half2 input vector \p a by input vector \p b in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-103 +* \endinternal +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The elementwise division of \p a with \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __h2div(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Calculates the absolute value of both halves of the input \p half2 number and +* returns the result. +* +* \details Calculates the absolute value of both halves of the input \p half2 number and +* returns the result. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - Returns \p a with the absolute value of both halves. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __habs2(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector addition in round-to-nearest-even mode, with +* saturation to [0.0, 1.0]. +* +* \details Performs \p half2 vector add of inputs \p a and \p b, in round-to-nearest-even +* mode, and clamps the results to range [0.0, 1.0]. NaN results are flushed to +* +0.0. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The sum of \p a and \p b, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hadd2_sat(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector subtraction in round-to-nearest-even mode, +* with saturation to [0.0, 1.0]. +* +* \details Subtracts \p half2 input vector \p b from input vector \p a in +* round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN +* results are flushed to +0.0. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The subtraction of vector \p b from \p a, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hsub2_sat(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector multiplication in round-to-nearest-even mode, +* with saturation to [0.0, 1.0]. +* +* \details Performs \p half2 vector multiplication of inputs \p a and \p b, in +* round-to-nearest-even mode, and clamps the results to range [0.0, 1.0]. NaN +* results are flushed to +0.0. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The result of elementwise multiplication of vectors \p a and \p b, +* with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmul2_sat(const __half2 a, const __half2 b); + +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector fused multiply-add in round-to-nearest-even +* mode. +* +* \details Performs \p half2 vector multiply on inputs \p a and \p b, +* then performs a \p half2 vector add of the result with \p c, +* rounding the result once in round-to-nearest-even mode. +* \internal +* \req DEEPLEARN-SRM_REQ-105 +* \endinternal +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* \param[in] c - half2. Is only being read. +* +* \returns half2 +* - The result of elementwise fused multiply-add operation on vectors \p a, \p b, and \p c. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 __hfma2(const __half2 a, const __half2 b, const __half2 c); +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector fused multiply-add in round-to-nearest-even +* mode, with saturation to [0.0, 1.0]. +* +* \details Performs \p half2 vector multiply on inputs \p a and \p b, +* then performs a \p half2 vector add of the result with \p c, +* rounding the result once in round-to-nearest-even mode, and clamps the +* results to range [0.0, 1.0]. NaN results are flushed to +0.0. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* \param[in] c - half2. Is only being read. +* +* \returns half2 +* - The result of elementwise fused multiply-add operation on vectors \p a, \p b, and \p c, +* with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 __hfma2_sat(const __half2 a, const __half2 b, const __half2 c); +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Negates both halves of the input \p half2 number and returns the +* result. +* +* \details Negates both halves of the input \p half2 number \p a and returns the result. +* \internal +* \req DEEPLEARN-SRM_REQ-101 +* \endinternal +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - Returns \p a with both halves negated. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hneg2(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Calculates the absolute value of input \p half number and returns the result. +* +* \details Calculates the absolute value of input \p half number and returns the result. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The absolute value of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __habs(const __half a); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half addition in round-to-nearest-even mode. +* +* \details Performs \p half addition of inputs \p a and \p b, in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-94 +* \endinternal +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* - The sum of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hadd(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half subtraction in round-to-nearest-even mode. +* +* \details Subtracts \p half input \p b from input \p a in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-97 +* \endinternal +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* - The result of subtracting \p b from \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hsub(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half multiplication in round-to-nearest-even mode. +* +* \details Performs \p half multiplication of inputs \p a and \p b, in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-99 +* \endinternal +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* - The result of multiplying \p a and \p b. +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmul(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half addition in round-to-nearest-even mode. +* +* \details Performs \p half addition of inputs \p a and \p b, in round-to-nearest-even +* mode. Prevents floating-point contractions of mul+add into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-94 +* \endinternal +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* - The sum of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hadd_rn(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half subtraction in round-to-nearest-even mode. +* +* \details Subtracts \p half input \p b from input \p a in round-to-nearest-even +* mode. Prevents floating-point contractions of mul+sub into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-97 +* \endinternal +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* - The result of subtracting \p b from \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hsub_rn(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half multiplication in round-to-nearest-even mode. +* +* \details Performs \p half multiplication of inputs \p a and \p b, in round-to-nearest-even +* mode. Prevents floating-point contractions of mul+add or sub into fma. +* \internal +* \req DEEPLEARN-SRM_REQ-99 +* \endinternal +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* - The result of multiplying \p a and \p b. +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmul_rn(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half division in round-to-nearest-even mode. +* +* \details Divides \p half input \p a by input \p b in round-to-nearest-even +* mode. +* \internal +* \req DEEPLEARN-SRM_REQ-98 +* \endinternal +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* - The result of dividing \p a by \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hdiv(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half addition in round-to-nearest-even mode, with +* saturation to [0.0, 1.0]. +* +* \details Performs \p half add of inputs \p a and \p b, in round-to-nearest-even mode, +* and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* - The sum of \p a and \p b, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hadd_sat(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half subtraction in round-to-nearest-even mode, with +* saturation to [0.0, 1.0]. +* +* \details Subtracts \p half input \p b from input \p a in round-to-nearest-even +* mode, +* and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* - The result of subtraction of \p b from \p a, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hsub_sat(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half multiplication in round-to-nearest-even mode, with +* saturation to [0.0, 1.0]. +* +* \details Performs \p half multiplication of inputs \p a and \p b, in round-to-nearest-even +* mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +* +0.0. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* - The result of multiplying \p a and \p b, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmul_sat(const __half a, const __half b); + +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half fused multiply-add in round-to-nearest-even mode. +* +* \details Performs \p half multiply on inputs \p a and \p b, +* then performs a \p half add of the result with \p c, +* rounding the result once in round-to-nearest-even mode. +* \internal +* \req DEEPLEARN-SRM_REQ-96 +* \endinternal +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* \param[in] c - half. Is only being read. +* +* \returns half +* - The result of fused multiply-add operation on \p +* a, \p b, and \p c. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half __hfma(const __half a, const __half b, const __half c); +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half fused multiply-add in round-to-nearest-even mode, +* with saturation to [0.0, 1.0]. +* +* \details Performs \p half multiply on inputs \p a and \p b, +* then performs a \p half add of the result with \p c, +* rounding the result once in round-to-nearest-even mode, and clamps the result +* to range [0.0, 1.0]. NaN results are flushed to +0.0. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* \param[in] c - half. Is only being read. +* +* \returns half +* - The result of fused multiply-add operation on \p +* a, \p b, and \p c, with respect to saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half __hfma_sat(const __half a, const __half b, const __half c); +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ + +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Negates input \p half number and returns the result. +* +* \details Negates input \p half number and returns the result. +* \internal +* \req DEEPLEARN-SRM_REQ-100 +* \endinternal +* \param[in] a - half. Is only being read. +* +* \returns half +* - minus a +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hneg(const __half a); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector if-equal comparison and returns boolean true +* iff both \p half results are true, boolean false otherwise. +* +* \details Performs \p half2 vector if-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half if-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of if-equal comparison +* of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbeq2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector not-equal comparison and returns boolean +* true iff both \p half results are true, boolean false otherwise. +* +* \details Performs \p half2 vector not-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half not-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of not-equal comparison +* of vectors \p a and \p b are true, +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbne2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector less-equal comparison and returns boolean +* true iff both \p half results are true, boolean false otherwise. +* +* \details Performs \p half2 vector less-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half less-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of less-equal comparison +* of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hble2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector greater-equal comparison and returns boolean +* true iff both \p half results are true, boolean false otherwise. +* +* \details Performs \p half2 vector greater-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half greater-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of greater-equal +* comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbge2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector less-than comparison and returns boolean +* true iff both \p half results are true, boolean false otherwise. +* +* \details Performs \p half2 vector less-than comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half less-than comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of less-than comparison +* of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hblt2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector greater-than comparison and returns boolean +* true iff both \p half results are true, boolean false otherwise. +* +* \details Performs \p half2 vector greater-than comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half greater-than comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate false results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of greater-than +* comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbgt2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered if-equal comparison and returns +* boolean true iff both \p half results are true, boolean false otherwise. +* +* \details Performs \p half2 vector if-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half if-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of unordered if-equal +* comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbequ2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered not-equal comparison and returns +* boolean true iff both \p half results are true, boolean false otherwise. +* +* \details Performs \p half2 vector not-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half not-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of unordered not-equal +* comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbneu2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered less-equal comparison and returns +* boolean true iff both \p half results are true, boolean false otherwise. +* +* \details Performs \p half2 vector less-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half less-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of unordered less-equal +* comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbleu2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered greater-equal comparison and +* returns boolean true iff both \p half results are true, boolean false +* otherwise. +* +* \details Performs \p half2 vector greater-equal comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half greater-equal comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of unordered +* greater-equal comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbgeu2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered less-than comparison and returns +* boolean true iff both \p half results are true, boolean false otherwise. +* +* \details Performs \p half2 vector less-than comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half less-than comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of unordered less-than comparison of +* vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbltu2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Performs \p half2 vector unordered greater-than comparison and +* returns boolean true iff both \p half results are true, boolean false +* otherwise. +* +* \details Performs \p half2 vector greater-than comparison of inputs \p a and \p b. +* The bool result is set to true only if both \p half greater-than comparisons +* evaluate to true, or false otherwise. +* NaN inputs generate true results. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns bool +* - true if both \p half results of unordered +* greater-than comparison of vectors \p a and \p b are true; +* - false otherwise. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbgtu2(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half if-equal comparison. +* +* \details Performs \p half if-equal comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of if-equal comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __heq(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half not-equal comparison. +* +* \details Performs \p half not-equal comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of not-equal comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hne(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half less-equal comparison. +* +* \details Performs \p half less-equal comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of less-equal comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hle(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half greater-equal comparison. +* +* \details Performs \p half greater-equal comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of greater-equal comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hge(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half less-than comparison. +* +* \details Performs \p half less-than comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of less-than comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hlt(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half greater-than comparison. +* +* \details Performs \p half greater-than comparison of inputs \p a and \p b. +* NaN inputs generate false results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of greater-than comparison of \p a and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hgt(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half unordered if-equal comparison. +* +* \details Performs \p half if-equal comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of unordered if-equal comparison of \p a and +* \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hequ(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half unordered not-equal comparison. +* +* \details Performs \p half not-equal comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of unordered not-equal comparison of \p a and +* \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hneu(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half unordered less-equal comparison. +* +* \details Performs \p half less-equal comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of unordered less-equal comparison of \p a and +* \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hleu(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half unordered greater-equal comparison. +* +* \details Performs \p half greater-equal comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of unordered greater-equal comparison of \p a +* and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hgeu(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half unordered less-than comparison. +* +* \details Performs \p half less-than comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of unordered less-than comparison of \p a and +* \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hltu(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Performs \p half unordered greater-than comparison. +* +* \details Performs \p half greater-than comparison of inputs \p a and \p b. +* NaN inputs generate true results. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns bool +* - The boolean result of unordered greater-than comparison of \p a +* and \p b. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hgtu(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Determine whether \p half argument is a NaN. +* +* \details Determine whether \p half value \p a is a NaN. +* \param[in] a - half. Is only being read. +* +* \returns bool +* - true iff argument is NaN. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hisnan(const __half a); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Calculates \p half maximum of two input values, NaNs pass through. +* +* \details Calculates \p half max(\p a, \p b) +* defined as (\p a > \p b) ? \p a : \p b. +* - If either of inputs is NaN, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmax_nan(const __half a, const __half b); +/** +* \ingroup CUDA_MATH__HALF_COMPARISON +* \brief Calculates \p half minimum of two input values, NaNs pass through. +* +* \details Calculates \p half min(\p a, \p b) +* defined as (\p a < \p b) ? \p a : \p b. +* - If either of inputs is NaN, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* +* \returns half +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmin_nan(const __half a, const __half b); +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Performs \p half fused multiply-add in round-to-nearest-even mode with relu saturation. +* +* \details Performs \p half multiply on inputs \p a and \p b, +* then performs a \p half add of the result with \p c, +* rounding the result once in round-to-nearest-even mode. +* Then negative result is clamped to 0. +* NaN result is converted to canonical NaN. +* \param[in] a - half. Is only being read. +* \param[in] b - half. Is only being read. +* \param[in] c - half. Is only being read. +* +* \returns half +* - The result of fused multiply-add operation on \p +* a, \p b, and \p c with relu saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half __hfma_relu(const __half a, const __half b, const __half c); +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Calculates \p half2 vector maximum of two inputs, NaNs pass through. +* +* \details Calculates \p half2 vector max(\p a, \p b). +* Elementwise \p half operation is defined as +* (\p a > \p b) ? \p a : \p b. +* - If either of inputs is NaN, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The result of elementwise maximum of vectors \p a and \p b, with NaNs pass through +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmax2_nan(const __half2 a, const __half2 b); +/** +* \ingroup CUDA_MATH__HALF2_COMPARISON +* \brief Calculates \p half2 vector minimum of two inputs, NaNs pass through. +* +* \details Calculates \p half2 vector min(\p a, \p b). +* Elementwise \p half operation is defined as +* (\p a < \p b) ? \p a : \p b. +* - If either of inputs is NaN, then canonical NaN is returned. +* - If values of both inputs are 0.0, then +0.0 > -0.0 +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* +* \returns half2 +* - The result of elementwise minimum of vectors \p a and \p b, with NaNs pass through +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmin2_nan(const __half2 a, const __half2 b); +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs \p half2 vector fused multiply-add in round-to-nearest-even +* mode with relu saturation. +* +* \details Performs \p half2 vector multiply on inputs \p a and \p b, +* then performs a \p half2 vector add of the result with \p c, +* rounding the result once in round-to-nearest-even mode. +* Then negative result is clamped to 0. +* NaN result is converted to canonical NaN. +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* \param[in] c - half2. Is only being read. +* +* \returns half2 +* - The result of elementwise fused multiply-add operation on vectors \p a, \p b, and \p c with relu saturation. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 __hfma2_relu(const __half2 a, const __half2 b, const __half2 c); + +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Performs fast complex multiply-accumulate +* +* \details Interprets vector \p half2 input pairs \p a, \p b, and \p c as +* complex numbers in \p half precision and performs +* complex multiply-accumulate operation: a*b + c +* \param[in] a - half2. Is only being read. +* \param[in] b - half2. Is only being read. +* \param[in] c - half2. Is only being read. +* +* \returns half2 +* - The result of complex multiply-accumulate operation on complex numbers \p a, \p b, and \p c +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 __hcmadd(const __half2 a, const __half2 b, const __half2 c); +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half square root in round-to-nearest-even mode. +* +* \details Calculates \p half square root of input \p a in round-to-nearest-even mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The square root of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hsqrt(const __half a); +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half reciprocal square root in round-to-nearest-even +* mode. +* +* \details Calculates \p half reciprocal square root of input \p a in round-to-nearest-even +* mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The reciprocal square root of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hrsqrt(const __half a); +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half reciprocal in round-to-nearest-even mode. +* +* \details Calculates \p half reciprocal of input \p a in round-to-nearest-even mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The reciprocal of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hrcp(const __half a); +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half natural logarithm in round-to-nearest-even mode. +* +* \details Calculates \p half natural logarithm of input \p a in round-to-nearest-even +* mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The natural logarithm of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hlog(const __half a); +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half binary logarithm in round-to-nearest-even mode. +* +* \details Calculates \p half binary logarithm of input \p a in round-to-nearest-even +* mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The binary logarithm of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hlog2(const __half a); +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half decimal logarithm in round-to-nearest-even mode. +* +* \details Calculates \p half decimal logarithm of input \p a in round-to-nearest-even +* mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The decimal logarithm of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hlog10(const __half a); +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half natural exponential function in round-to-nearest-even +* mode. +* +* \details Calculates \p half natural exponential function of input \p a in +* round-to-nearest-even mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The natural exponential function on \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hexp(const __half a); +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half binary exponential function in round-to-nearest-even +* mode. +* +* \details Calculates \p half binary exponential function of input \p a in +* round-to-nearest-even mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The binary exponential function on \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hexp2(const __half a); +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half decimal exponential function in round-to-nearest-even +* mode. +* +* \details Calculates \p half decimal exponential function of input \p a in +* round-to-nearest-even mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The decimal exponential function on \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hexp10(const __half a); +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half cosine in round-to-nearest-even mode. +* +* \details Calculates \p half cosine of input \p a in round-to-nearest-even mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The cosine of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hcos(const __half a); +/** +* \ingroup CUDA_MATH__HALF_FUNCTIONS +* \brief Calculates \p half sine in round-to-nearest-even mode. +* +* \details Calculates \p half sine of input \p a in round-to-nearest-even mode. +* \param[in] a - half. Is only being read. +* +* \returns half +* - The sine of \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half hsin(const __half a); +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector square root in round-to-nearest-even mode. +* +* \details Calculates \p half2 square root of input vector \p a in round-to-nearest-even +* mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise square root on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2sqrt(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector reciprocal square root in round-to-nearest-even +* mode. +* +* \details Calculates \p half2 reciprocal square root of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise reciprocal square root on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2rsqrt(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector reciprocal in round-to-nearest-even mode. +* +* \details Calculates \p half2 reciprocal of input vector \p a in round-to-nearest-even +* mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise reciprocal on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2rcp(const __half2 a); +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector natural logarithm in round-to-nearest-even +* mode. +* +* \details Calculates \p half2 natural logarithm of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise natural logarithm on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2log(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector binary logarithm in round-to-nearest-even +* mode. +* +* \details Calculates \p half2 binary logarithm of input vector \p a in round-to-nearest-even +* mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise binary logarithm on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2log2(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector decimal logarithm in round-to-nearest-even +* mode. +* +* \details Calculates \p half2 decimal logarithm of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise decimal logarithm on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2log10(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector exponential function in round-to-nearest-even +* mode. +* +* \details Calculates \p half2 exponential function of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise exponential function on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2exp(const __half2 a); +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector binary exponential function in +* round-to-nearest-even mode. +* +* \details Calculates \p half2 binary exponential function of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise binary exponential function on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2exp2(const __half2 a); +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector decimal exponential function in +* round-to-nearest-even mode. +* +* \details Calculates \p half2 decimal exponential function of input vector \p a in +* round-to-nearest-even mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise decimal exponential function on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2exp10(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector cosine in round-to-nearest-even mode. +* +* \details Calculates \p half2 cosine of input vector \p a in round-to-nearest-even +* mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise cosine on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2cos(const __half2 a); +/** +* \ingroup CUDA_MATH__HALF2_FUNCTIONS +* \brief Calculates \p half2 vector sine in round-to-nearest-even mode. +* +* \details Calculates \p half2 sine of input vector \p a in round-to-nearest-even mode. +* \param[in] a - half2. Is only being read. +* +* \returns half2 +* - The elementwise sine on vector \p a. +* \internal +* \exception-guarantee no-throw guarantee +* \behavior reentrant, thread safe +* \endinternal +*/ +__CUDA_FP16_DECL__ __half2 h2sin(const __half2 a); +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ + +/** +* \ingroup CUDA_MATH__HALF2_ARITHMETIC +* \brief Vector add \p val to the value stored at \p address in global or shared memory, and writes this +* value back to \p address. The atomicity of the add operation is guaranteed separately for each of the +* two __half elements; the entire __half2 is not guaranteed to be atomic as a single 32-bit access. +* +* \details The location of \p address must be in global or shared memory. This operation has undefined +* behavior otherwise. This operation is natively supported by devices of compute capability 6.x and higher, +* older devices use emulation path. +* +* \param[in] address - half2*. An address in global or shared memory. +* \param[in] val - half2. The value to be added. +* +* \returns half2 +* - The old value read from \p address. +* +* \note_ref_guide_atomic +*/ +__CUDA_FP16_DECL__ __half2 atomicAdd(__half2 *const address, const __half2 val); + +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 700))) || defined(_NVHPC_CUDA) +/** +* \ingroup CUDA_MATH__HALF_ARITHMETIC +* \brief Adds \p val to the value stored at \p address in global or shared memory, and writes this value +* back to \p address. This operation is performed in one atomic operation. +* +* \details The location of \p address must be in global or shared memory. This operation has undefined +* behavior otherwise. This operation is only supported by devices of compute capability 7.x and higher. +* +* \param[in] address - half*. An address in global or shared memory. +* \param[in] val - half. The value to be added. +* +* \returns half +* - The old value read from \p address. +* +* \note_ref_guide_atomic +*/ +__CUDA_FP16_DECL__ __half atomicAdd(__half *const address, const __half val); +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 700))) || defined(_NVHPC_CUDA) */ + +#endif /*defined(__CUDACC__) || defined(_NVHPC_CUDA)*/ + +#endif /* defined(__cplusplus) */ + +#if !defined(_MSC_VER) && __cplusplus >= 201103L +# define __CPP_VERSION_AT_LEAST_11_FP16 +#elif _MSC_FULL_VER >= 190024210 && _MSVC_LANG >= 201103L +# define __CPP_VERSION_AT_LEAST_11_FP16 +#endif + +// implicitly provided by NVRTC +#if !defined(__CUDACC_RTC__) +#include +#endif /* !defined(__CUDACC_RTC__) */ + +/* C++11 header for std::move. + * In RTC mode, std::move is provided implicitly; don't include the header + */ +#if defined(__CPP_VERSION_AT_LEAST_11_FP16) && !defined(__CUDACC_RTC__) +#include +#endif /* __cplusplus >= 201103L && !defined(__CUDACC_RTC__) */ + +/* C++ header for std::memcpy (used for type punning in host-side implementations). + * When compiling as a CUDA source file memcpy is provided implicitly. + * !defined(__CUDACC__) implies !defined(__CUDACC_RTC__). + */ +#if defined(__cplusplus) && !defined(__CUDACC__) +#include +#endif /* defined(__cplusplus) && !defined(__CUDACC__) */ + +#if (defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3)))) +#define __CUDA_FP16_INLINE__ +#define __CUDA_FP16_FORCEINLINE__ +#else +#define __CUDA_FP16_INLINE__ inline +#define __CUDA_FP16_FORCEINLINE__ __forceinline__ +#endif /* (defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3)))) */ + +/* Set up structure-alignment attribute */ +#if defined(__CUDACC__) +#define __CUDA_ALIGN__(align) __align__(align) +#else +/* Define alignment macro based on compiler type (cannot assume C11 "_Alignas" is available) */ +#if __cplusplus >= 201103L +#define __CUDA_ALIGN__(n) alignas(n) /* C++11 kindly gives us a keyword for this */ +#else /* !defined(__CPP_VERSION_AT_LEAST_11_FP16)*/ +#if defined(__GNUC__) +#define __CUDA_ALIGN__(n) __attribute__ ((aligned(n))) +#elif defined(_MSC_VER) +#define __CUDA_ALIGN__(n) __declspec(align(n)) +#else +#define __CUDA_ALIGN__(n) +#endif /* defined(__GNUC__) */ +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP16) */ +#endif /* defined(__CUDACC__) */ + +// define __CUDA_FP16_CONSTEXPR__ in order to +// use constexpr where possible, with supporting C++ dialects +// undef after use +#if (defined __CPP_VERSION_AT_LEAST_11_FP16) +#define __CUDA_FP16_CONSTEXPR__ constexpr +#else +#define __CUDA_FP16_CONSTEXPR__ +#endif + +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief __half_raw data type + * \details Type allows static initialization of \p half until it becomes + * a builtin type. + * + * - Note: this initialization is as a bit-field representation of \p half, + * and not a conversion from \p short to \p half. + * Such representation will be deprecated in a future version of CUDA. + * + * - Note: this is visible to non-nvcc compilers, including C-only compilations + */ +typedef struct __CUDA_ALIGN__(2) { + unsigned short x; +} __half_raw; + +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief __half2_raw data type + * \details Type allows static initialization of \p half2 until it becomes + * a builtin type. + * + * - Note: this initialization is as a bit-field representation of \p half2, + * and not a conversion from \p short2 to \p half2. + * Such representation will be deprecated in a future version of CUDA. + * + * - Note: this is visible to non-nvcc compilers, including C-only compilations + */ +typedef struct __CUDA_ALIGN__(4) { + unsigned short x; + unsigned short y; +} __half2_raw; + +/* All other definitions in this file are only visible to C++ compilers */ +#if defined(__cplusplus) + +/* Hide GCC member initialization list warnings because of host/device in-function init requirement */ +#if defined(__GNUC__) +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) */ +#endif /* defined(__GNUC__) */ + +/* class' : multiple assignment operators specified + The class has multiple assignment operators of a single type. This warning is informational */ +#if defined(_MSC_VER) && _MSC_VER >= 1500 +#pragma warning( push ) +#pragma warning( disable:4522 ) +#endif /* defined(_MSC_VER) && _MSC_VER >= 1500 */ + +// forward-declaration of bfloat type to be used in converting constructor +struct __nv_bfloat16; + +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief __half data type + * \details This structure implements the datatype for storing + * half-precision floating-point numbers. The structure implements + * assignment, arithmetic and comparison operators, and type conversions. + * 16 bits are being used in total: 1 sign bit, 5 bits for the exponent, + * and the significand is being stored in 10 bits. + * The total precision is 11 bits. There are 15361 representable + * numbers within the interval [0.0, 1.0], endpoints included. + * On average we have log10(2**11) ~ 3.311 decimal digits. + * + * The objective here is to provide IEEE754-compliant implementation + * of \p binary16 type and arithmetic with limitations due to + * device HW not supporting floating-point exceptions. + */ +struct __CUDA_ALIGN__(2) __half { +protected: + /** + * Protected storage variable contains the bits of floating-point data. + */ + unsigned short __x; + +public: + /** + * Constructor by default. + */ +#if defined(__CPP_VERSION_AT_LEAST_11_FP16) + __half() = default; +#else + __CUDA_HOSTDEVICE__ __half() {} +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP16) */ + + /* Convert to/from __half_raw */ + /** + * Constructor from \p __half_raw. + */ + __CUDA_HOSTDEVICE__ __CUDA_FP16_CONSTEXPR__ __half(const __half_raw &hr) : __x(hr.x) { } + /** + * Assignment operator from \p __half_raw. + */ + __CUDA_HOSTDEVICE__ __half &operator=(const __half_raw &hr); + /** + * Assignment operator from \p __half_raw to \p volatile \p __half. + */ + __CUDA_HOSTDEVICE__ volatile __half &operator=(const __half_raw &hr) volatile; + /** + * Assignment operator from \p volatile \p __half_raw to \p volatile \p __half. + */ + __CUDA_HOSTDEVICE__ volatile __half &operator=(const volatile __half_raw &hr) volatile; + /** + * Type cast to \p __half_raw operator. + */ + __CUDA_HOSTDEVICE__ operator __half_raw() const; + /** + * Type cast to \p __half_raw operator with \p volatile input. + */ + __CUDA_HOSTDEVICE__ operator __half_raw() const volatile; +#if !defined(__CUDA_NO_HALF_CONVERSIONS__) +#if defined(__CPP_VERSION_AT_LEAST_11_FP16) + /** + * Construct \p __half from \p __nv_bfloat16 input using default round-to-nearest-even rounding mode. + * Need to include the header file \p cuda_bf16.h + */ + explicit __CUDA_HOSTDEVICE__ __half(const __nv_bfloat16 f); //forward declaration only, implemented in cuda_bf16.hpp +#endif /* #if defined(__CPP_VERSION_AT_LEAST_11_FP16) */ + /* Construct from float/double */ + /** + * Construct \p __half from \p float input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half(const float f) { __x = __float2half(f).__x; } + /** + * Construct \p __half from \p double input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half(const double f) { __x = __double2half(f).__x; } + /** + * Type cast to \p float operator. + */ + __CUDA_HOSTDEVICE__ operator float() const; + /** + * Type cast to \p __half assignment operator from \p float input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half &operator=(const float f); + + /* We omit "cast to double" operator, so as to not be ambiguous about up-cast */ + /** + * Type cast to \p __half assignment operator from \p double input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half &operator=(const double f); + + /* Allow automatic construction from types supported natively in hardware */ + /* Note we do avoid constructor init-list because of special host/device compilation rules */ + +/* + * Implicit type conversions to/from integer types were only available to nvcc compilation. + * Introducing them for all compilers is a potentially breaking change that may affect + * overloads resolution and will require users to update their code. + * Define __CUDA_FP16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__ to opt-out. + */ +#if !(defined __CUDA_FP16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__) || (defined __CUDACC__) + /** + * Construct \p __half from \p short integer input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half(const short val) { __x = __short2half_rn(val).__x; } + /** + * Construct \p __half from \p unsigned \p short integer input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half(const unsigned short val) { __x = __ushort2half_rn(val).__x; } + /** + * Construct \p __half from \p int input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half(const int val) { __x = __int2half_rn(val).__x; } + /** + * Construct \p __half from \p unsigned \p int input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half(const unsigned int val) { __x = __uint2half_rn(val).__x; } + /** + * Construct \p __half from \p long input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half(const long val) { + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(long) == sizeof(long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (default: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + __x = __ll2half_rn(static_cast(val)).__x; + } else { + __x = __int2half_rn(static_cast(val)).__x; + } + } + /** + * Construct \p __half from \p unsigned \p long input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half(const unsigned long val) { + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(unsigned long) == sizeof(unsigned long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (default: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + __x = __ull2half_rn(static_cast(val)).__x; + } else { + __x = __uint2half_rn(static_cast(val)).__x; + } + } + + /** + * Construct \p __half from \p long \p long input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half(const long long val) { __x = __ll2half_rn(val).__x; } + /** + * Construct \p __half from \p unsigned \p long \p long input using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half(const unsigned long long val) { __x = __ull2half_rn(val).__x; } + + /* Allow automatic casts to supported builtin types, matching all that are permitted with float */ + + /** + * Conversion operator to \p signed \p char data type. + * Using round-toward-zero rounding mode. + * + * See __half2char_rz(__half) for further details + */ + __CUDA_HOSTDEVICE__ operator signed char() const; + /** + * Conversion operator to \p unsigned \p char data type. + * Using round-toward-zero rounding mode. + * + * See __half2uchar_rz(__half) for further details + */ + __CUDA_HOSTDEVICE__ operator unsigned char() const; + /** + * Conversion operator to an implementation defined \p char data type. + * Using round-toward-zero rounding mode. + * + * Detects signedness of the \p char type and proceeds accordingly, see + * further details in signed and unsigned char operators. + */ + __CUDA_HOSTDEVICE__ operator char() const; + /** + * Conversion operator to \p short data type. + * Using round-toward-zero rounding mode. + * + * See __half2short_rz(__half) for further details + */ + __CUDA_HOSTDEVICE__ operator short() const; + /** + * Conversion operator to \p unsigned \p short data type. + * Using round-toward-zero rounding mode. + * + * See __half2ushort_rz(__half) for further details + */ + __CUDA_HOSTDEVICE__ operator unsigned short() const; + /** + * Conversion operator to \p int data type. + * Using round-toward-zero rounding mode. + * + * See __half2int_rz(__half) for further details + */ + __CUDA_HOSTDEVICE__ operator int() const; + /** + * Conversion operator to \p unsigned \p int data type. + * Using round-toward-zero rounding mode. + * + * See __half2uint_rz(__half) for further details + */ + __CUDA_HOSTDEVICE__ operator unsigned int() const; + /** + * Conversion operator to \p long data type. + * Using round-toward-zero rounding mode. + */ + __CUDA_HOSTDEVICE__ operator long() const; + /** + * Conversion operator to \p unsigned \p long data type. + * Using round-toward-zero rounding mode. + */ + __CUDA_HOSTDEVICE__ operator unsigned long() const; + /** + * Conversion operator to \p long \p long data type. + * Using round-toward-zero rounding mode. + * + * See __half2ll_rz(__half) for further details + */ + __CUDA_HOSTDEVICE__ operator long long() const; + /** + * Conversion operator to \p unsigned \p long \p long data type. + * Using round-toward-zero rounding mode. + * + * See __half2ull_rz(__half) for further details + */ + __CUDA_HOSTDEVICE__ operator unsigned long long() const; + /** + * Type cast from \p short assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half &operator=(const short val); + /** + * Type cast from \p unsigned \p short assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half &operator=(const unsigned short val); + /** + * Type cast from \p int assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half &operator=(const int val); + /** + * Type cast from \p unsigned \p int assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half &operator=(const unsigned int val); + /** + * Type cast from \p long \p long assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half &operator=(const long long val); + /** + * Type cast from \p unsigned \p long \p long assignment operator, using default round-to-nearest-even rounding mode. + */ + __CUDA_HOSTDEVICE__ __half &operator=(const unsigned long long val); + /** + * Conversion operator to \p bool data type. + * +0 and -0 inputs convert to \p false. + * Non-zero inputs convert to \p true. + */ + __CUDA_HOSTDEVICE__ __CUDA_FP16_CONSTEXPR__ operator bool() const { return (__x & 0x7FFFU) != 0U; } +#endif /* #if !(defined __CUDA_FP16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__) || (defined __CUDACC__) */ +#endif /* !defined(__CUDA_NO_HALF_CONVERSIONS__) */ +}; + +#if !defined(__CUDA_NO_HALF_OPERATORS__) +/* Some basic arithmetic operations expected of a builtin */ + +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half addition operation. + * See also __hadd(__half, __half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator+(const __half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half subtraction operation. + * See also __hsub(__half, __half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator-(const __half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half multiplication operation. + * See also __hmul(__half, __half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator*(const __half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half division operation. + * See also __hdiv(__half, __half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator/(const __half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half compound assignment with addition operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator+=(__half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half compound assignment with subtraction operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator-=(__half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half compound assignment with multiplication operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator*=(__half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half compound assignment with division operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator/=(__half &lh, const __half &rh); +/* Note for increment and decrement we use the raw value 0x3C00U equating to half(1.0F), to avoid the extra conversion */ +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half prefix increment operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator++(__half &h); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half prefix decrement operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator--(__half &h); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half postfix increment operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator++(__half &h, const int ignored); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Performs \p half postfix decrement operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator--(__half &h, const int ignored); + +/* Unary plus and inverse operators */ +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Implements \p half unary plus operator, returns input value. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator+(const __half &h); +/** + * \ingroup CUDA_MATH__HALF_ARITHMETIC + * Implements \p half unary minus operator. + * See also __hneg(__half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator-(const __half &h); +/* Some basic comparison operations to make it look like a builtin */ +/** + * \ingroup CUDA_MATH__HALF_COMPARISON + * Performs \p half ordered compare equal operation. + * See also __heq(__half, __half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator==(const __half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_COMPARISON + * Performs \p half unordered compare not-equal operation. + * See also __hneu(__half, __half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator!=(const __half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_COMPARISON + * Performs \p half ordered greater-than compare operation. + * See also __hgt(__half, __half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator> (const __half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_COMPARISON + * Performs \p half ordered less-than compare operation. + * See also __hlt(__half, __half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator< (const __half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_COMPARISON + * Performs \p half ordered greater-or-equal compare operation. + * See also __hge(__half, __half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator>=(const __half &lh, const __half &rh); +/** + * \ingroup CUDA_MATH__HALF_COMPARISON + * Performs \p half ordered less-or-equal compare operation. + * See also __hle(__half, __half) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator<=(const __half &lh, const __half &rh); +#endif /* !defined(__CUDA_NO_HALF_OPERATORS__) */ + +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief __half2 data type + * \details This structure implements the datatype for storing two + * half-precision floating-point numbers. + * The structure implements assignment, arithmetic and comparison + * operators, and type conversions. + * + * - NOTE: __half2 is visible to non-nvcc host compilers + */ +struct __CUDA_ALIGN__(4) __half2 { + /** + * Storage field holding lower \p __half part. + */ + __half x; + /** + * Storage field holding upper \p __half part. + */ + __half y; + + // All construct/copy/assign/move +public: + /** + * Constructor by default. + */ +#if defined(__CPP_VERSION_AT_LEAST_11_FP16) + __half2() = default; + /** + * Move constructor, available for \p C++11 and later dialects + */ + __CUDA_HOSTDEVICE__ __half2(const __half2 &&src) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __HALF2_TO_UI(*this) = std::move(__HALF2_TO_CUI(src)); +, + this->x = src.x; + this->y = src.y; +) +} + /** + * Move assignment operator, available for \p C++11 and later dialects + */ + __CUDA_HOSTDEVICE__ __half2 &operator=(const __half2 &&src); +#else + __CUDA_HOSTDEVICE__ __half2() { } +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP16) */ + + /** + * Constructor from two \p __half variables + */ + __CUDA_HOSTDEVICE__ __CUDA_FP16_CONSTEXPR__ __half2(const __half &a, const __half &b) : x(a), y(b) { } + /** + * Copy constructor + */ + __CUDA_HOSTDEVICE__ __half2(const __half2 &src) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __HALF2_TO_UI(*this) = __HALF2_TO_CUI(src); +, + this->x = src.x; + this->y = src.y; +) +} + /** + * Copy assignment operator + */ + __CUDA_HOSTDEVICE__ __half2 &operator=(const __half2 &src); + + /* Convert to/from __half2_raw */ + /** + * Constructor from \p __half2_raw + */ + __CUDA_HOSTDEVICE__ __half2(const __half2_raw &h2r ) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __HALF2_TO_UI(*this) = __HALF2_TO_CUI(h2r); +, + __half_raw tr; + tr.x = h2r.x; + this->x = static_cast<__half>(tr); + tr.x = h2r.y; + this->y = static_cast<__half>(tr); +) +} + /** + * Assignment operator from \p __half2_raw + */ + __CUDA_HOSTDEVICE__ __half2 &operator=(const __half2_raw &h2r); + /** + * Conversion operator to \p __half2_raw + */ + __CUDA_HOSTDEVICE__ operator __half2_raw() const; +}; + +#if !defined(__CUDA_NO_HALF2_OPERATORS__) +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half addition operation. + * See also __hadd2(__half2, __half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator+(const __half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half subtraction operation. + * See also __hsub2(__half2, __half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator-(const __half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half multiplication operation. + * See also __hmul2(__half2, __half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator*(const __half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half division operation. + * See also __h2div(__half2, __half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator/(const __half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half compound assignment with addition operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2& operator+=(__half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half compound assignment with subtraction operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2& operator-=(__half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half compound assignment with multiplication operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2& operator*=(__half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half compound assignment with division operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2& operator/=(__half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half prefix increment operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 &operator++(__half2 &h); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half prefix decrement operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 &operator--(__half2 &h); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half postfix increment operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator++(__half2 &h, const int ignored); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Performs packed \p half postfix decrement operation. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator--(__half2 &h, const int ignored); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Implements packed \p half unary plus operator, returns input value. + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator+(const __half2 &h); +/** + * \ingroup CUDA_MATH__HALF2_ARITHMETIC + * Implements packed \p half unary minus operator. + * See also __hneg2(__half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator-(const __half2 &h); +/** + * \ingroup CUDA_MATH__HALF2_COMPARISON + * Performs packed \p half ordered compare equal operation. + * See also __hbeq2(__half2, __half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator==(const __half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_COMPARISON + * Performs packed \p half unordered compare not-equal operation. + * See also __hbneu2(__half2, __half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator!=(const __half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_COMPARISON + * Performs packed \p half ordered greater-than compare operation. + * See also __hbgt2(__half2, __half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator>(const __half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_COMPARISON + * Performs packed \p half ordered less-than compare operation. + * See also __hblt2(__half2, __half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator<(const __half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_COMPARISON + * Performs packed \p half ordered greater-or-equal compare operation. + * See also __hbge2(__half2, __half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator>=(const __half2 &lh, const __half2 &rh); +/** + * \ingroup CUDA_MATH__HALF2_COMPARISON + * Performs packed \p half ordered less-or-equal compare operation. + * See also __hble2(__half2, __half2) + */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator<=(const __half2 &lh, const __half2 &rh); + +#endif /* !defined(__CUDA_NO_HALF2_OPERATORS__) */ + +#endif /* defined(__cplusplus) */ + +#if (defined(__FORCE_INCLUDE_CUDA_FP16_HPP_FROM_FP16_H__) || \ + !(defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3))))) +/* Note the .hpp file is included to capture the "half" & "half2" builtin function definitions. For NVRTC, the builtin + function definitions are compiled at NVRTC library build-time and are available through the NVRTC builtins library at + link time. +*/ +#include "cuda_fp16.hpp" +#endif /* (defined(__FORCE_INCLUDE_CUDA_FP16_HPP_FROM_FP16_H__) || \ + !(defined(__CUDACC_RTC__) && ((__CUDACC_VER_MAJOR__ > 12) || ((__CUDACC_VER_MAJOR__ == 12) && (__CUDACC_VER_MINOR__ >= 3))))) */ + +/* Define first-class types "half" and "half2", unless user specifies otherwise via "#define CUDA_NO_HALF" */ +/* C cannot ever have these types defined here, because __half and __half2 are C++ classes */ +#if defined(__cplusplus) && !defined(CUDA_NO_HALF) +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief This datatype is meant to be the first-class or fundamental + * implementation of the half-precision numbers format. + * + * \details Should be implemented in the compiler in the future. + * Current implementation is a simple typedef to a respective + * user-level type with underscores. + */ +typedef __half half; + +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief This datatype is meant to be the first-class or fundamental + * implementation of type for pairs of half-precision numbers. + * + * \details Should be implemented in the compiler in the future. + * Current implementation is a simple typedef to a respective + * user-level type with underscores. + */ +typedef __half2 half2; +// for consistency with __nv_bfloat16 + +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief This datatype is an \p __nv_ prefixed alias + */ +typedef __half __nv_half; +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief This datatype is an \p __nv_ prefixed alias + */ +typedef __half2 __nv_half2; +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief This datatype is an \p __nv_ prefixed alias + */ +typedef __half_raw __nv_half_raw; +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief This datatype is an \p __nv_ prefixed alias + */ +typedef __half2_raw __nv_half2_raw; +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief This datatype is an \p nv_ prefixed alias + */ +typedef __half nv_half; +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF + * \brief This datatype is an \p nv_ prefixed alias + */ +typedef __half2 nv_half2; +#endif /* defined(__cplusplus) && !defined(CUDA_NO_HALF) */ + +#undef __CUDA_FP16_DECL__ +#undef __CUDA_HOSTDEVICE_FP16_DECL__ +#undef __CUDA_HOSTDEVICE__ +#undef __CUDA_FP16_INLINE__ +#undef __CUDA_FP16_FORCEINLINE__ + +#undef ___CUDA_FP16_STRINGIFY_INNERMOST +#undef __CUDA_FP16_STRINGIFY + +#endif /* end of include guard: __CUDA_FP16_H__ */ diff --git a/cuda_toolkit/include/cuda_fp16.hpp b/cuda_toolkit/include/cuda_fp16.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bcf825c2a3eeade27281c33a24668a84aa71ab45 --- /dev/null +++ b/cuda_toolkit/include/cuda_fp16.hpp @@ -0,0 +1,3440 @@ +/* +* Copyright 1993-2023 NVIDIA Corporation. All rights reserved. +* +* NOTICE TO LICENSEE: +* +* This source code and/or documentation ("Licensed Deliverables") are +* subject to NVIDIA intellectual property rights under U.S. and +* international Copyright laws. +* +* These Licensed Deliverables contained herein is PROPRIETARY and +* CONFIDENTIAL to NVIDIA and is being provided under the terms and +* conditions of a form of NVIDIA software license agreement by and +* between NVIDIA and Licensee ("License Agreement") or electronically +* accepted by Licensee. Notwithstanding any terms or conditions to +* the contrary in the License Agreement, reproduction or disclosure +* of the Licensed Deliverables to any third party without the express +* written consent of NVIDIA is prohibited. +* +* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE +* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE +* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS +* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. +* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED +* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, +* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. +* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE +* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY +* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY +* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +* OF THESE LICENSED DELIVERABLES. +* +* U.S. Government End Users. These Licensed Deliverables are a +* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT +* 1995), consisting of "commercial computer software" and "commercial +* computer software documentation" as such terms are used in 48 +* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government +* only as a commercial end item. Consistent with 48 C.F.R.12.212 and +* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all +* U.S. Government End Users acquire the Licensed Deliverables with +* only those rights set forth herein. +* +* Any use of the Licensed Deliverables in individual and commercial +* software must include, in the user documentation and internal +* comments to the code, the above Disclaimer and U.S. Government End +* Users Notice. +*/ + +#if !defined(__CUDA_FP16_HPP__) +#define __CUDA_FP16_HPP__ + +#if !defined(__CUDA_FP16_H__) +#error "Do not include this file directly. Instead, include cuda_fp16.h." +#endif + +#if !defined(IF_DEVICE_OR_CUDACC) +#if defined(__CUDACC__) + #define IF_DEVICE_OR_CUDACC(d, c, f) NV_IF_ELSE_TARGET(NV_IS_DEVICE, d, c) +#else + #define IF_DEVICE_OR_CUDACC(d, c, f) NV_IF_ELSE_TARGET(NV_IS_DEVICE, d, f) +#endif +#endif + +/* Macros for half & half2 binary arithmetic */ +#define __BINARY_OP_HALF_MACRO(name) /* do */ {\ + __half val; \ + asm( "{" __CUDA_FP16_STRINGIFY(name) ".f16 %0,%1,%2;\n}" \ + :"=h"(__HALF_TO_US(val)) : "h"(__HALF_TO_CUS(a)),"h"(__HALF_TO_CUS(b))); \ + return val; \ +} /* while(0) */ +#define __BINARY_OP_HALF2_MACRO(name) /* do */ {\ + __half2 val; \ + asm( "{" __CUDA_FP16_STRINGIFY(name) ".f16x2 %0,%1,%2;\n}" \ + :"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a)),"r"(__HALF2_TO_CUI(b))); \ + return val; \ +} /* while(0) */ +#define __TERNARY_OP_HALF_MACRO(name) /* do */ {\ + __half val; \ + asm( "{" __CUDA_FP16_STRINGIFY(name) ".f16 %0,%1,%2,%3;\n}" \ + :"=h"(__HALF_TO_US(val)) : "h"(__HALF_TO_CUS(a)),"h"(__HALF_TO_CUS(b)),"h"(__HALF_TO_CUS(c))); \ + return val; \ +} /* while(0) */ +#define __TERNARY_OP_HALF2_MACRO(name) /* do */ {\ + __half2 val; \ + asm( "{" __CUDA_FP16_STRINGIFY(name) ".f16x2 %0,%1,%2,%3;\n}" \ + :"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a)),"r"(__HALF2_TO_CUI(b)),"r"(__HALF2_TO_CUI(c))); \ + return val; \ +} /* while(0) */ + +/* All other definitions in this file are only visible to C++ compilers */ +#if defined(__cplusplus) + +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF_CONSTANTS + * \brief Defines floating-point positive infinity value for the \p half data type + */ +#define CUDART_INF_FP16 __ushort_as_half((unsigned short)0x7C00U) +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF_CONSTANTS + * \brief Defines canonical NaN value for the \p half data type + */ +#define CUDART_NAN_FP16 __ushort_as_half((unsigned short)0x7FFFU) +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF_CONSTANTS + * \brief Defines a minimum representable (denormalized) value for the \p half data type + */ +#define CUDART_MIN_DENORM_FP16 __ushort_as_half((unsigned short)0x0001U) +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF_CONSTANTS + * \brief Defines a maximum representable value for the \p half data type + */ +#define CUDART_MAX_NORMAL_FP16 __ushort_as_half((unsigned short)0x7BFFU) +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF_CONSTANTS + * \brief Defines a negative zero value for the \p half data type + */ +#define CUDART_NEG_ZERO_FP16 __ushort_as_half((unsigned short)0x8000U) +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF_CONSTANTS + * \brief Defines a positive zero value for the \p half data type + */ +#define CUDART_ZERO_FP16 __ushort_as_half((unsigned short)0x0000U) +/** + * \ingroup CUDA_MATH_INTRINSIC_HALF_CONSTANTS + * \brief Defines a value of 1.0 for the \p half data type + */ +#define CUDART_ONE_FP16 __ushort_as_half((unsigned short)0x3C00U) + +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half &__half::operator=(const __half_raw &hr) { __x = hr.x; return *this; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ volatile __half &__half::operator=(const __half_raw &hr) volatile { __x = hr.x; return *this; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ volatile __half &__half::operator=(const volatile __half_raw &hr) volatile { __x = hr.x; return *this; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator __half_raw() const { __half_raw ret; ret.x = __x; return ret; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator __half_raw() const volatile { __half_raw ret; ret.x = __x; return ret; } +#if !defined(__CUDA_NO_HALF_CONVERSIONS__) +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator float() const { return __half2float(*this); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half &__half::operator=(const float f) { __x = __float2half(f).__x; return *this; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half &__half::operator=(const double f) { __x = __double2half(f).__x; return *this; } +#if !(defined __CUDA_FP16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__) || (defined __CUDACC__) +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator signed char() const { return __half2char_rz(*this); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator unsigned char() const { return __half2uchar_rz(*this); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator char() const { + char value; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (((char)-1) < (char)0) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + value = static_cast(__half2char_rz(*this)); + } + else + { + value = static_cast(__half2uchar_rz(*this)); + } + return value; +} +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator short() const { return __half2short_rz(*this); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator unsigned short() const { return __half2ushort_rz(*this); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator int() const { return __half2int_rz(*this); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator unsigned int() const { return __half2uint_rz(*this); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator long() const { + long retval; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(long) == sizeof(long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + retval = static_cast(__half2ll_rz(*this)); + } + else + { + retval = static_cast(__half2int_rz(*this)); + } + return retval; +} +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator unsigned long() const { + unsigned long retval; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(unsigned long) == sizeof(unsigned long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + retval = static_cast(__half2ull_rz(*this)); + } + else + { + retval = static_cast(__half2uint_rz(*this)); + } + return retval; +} +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator long long() const { return __half2ll_rz(*this); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half::operator unsigned long long() const { return __half2ull_rz(*this); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half &__half::operator=(const short val) { __x = __short2half_rn(val).__x; return *this; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half &__half::operator=(const unsigned short val) { __x = __ushort2half_rn(val).__x; return *this; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half &__half::operator=(const int val) { __x = __int2half_rn(val).__x; return *this; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half &__half::operator=(const unsigned int val) { __x = __uint2half_rn(val).__x; return *this; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half &__half::operator=(const long long val) { __x = __ll2half_rn(val).__x; return *this; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half &__half::operator=(const unsigned long long val) { __x = __ull2half_rn(val).__x; return *this; } +#endif /* #if !(defined __CUDA_FP16_DISABLE_IMPLICIT_INTEGER_CONVERTS_FOR_HOST_COMPILERS__) || (defined __CUDACC__) */ +#endif /* !defined(__CUDA_NO_HALF_CONVERSIONS__) */ +#if !defined(__CUDA_NO_HALF_OPERATORS__) +/* Some basic arithmetic operations expected of a builtin */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator+(const __half &lh, const __half &rh) { return __hadd(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator-(const __half &lh, const __half &rh) { return __hsub(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator*(const __half &lh, const __half &rh) { return __hmul(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator/(const __half &lh, const __half &rh) { return __hdiv(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator+=(__half &lh, const __half &rh) { lh = __hadd(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator-=(__half &lh, const __half &rh) { lh = __hsub(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator*=(__half &lh, const __half &rh) { lh = __hmul(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator/=(__half &lh, const __half &rh) { lh = __hdiv(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator++(__half &h) { __half_raw one; one.x = 0x3C00U; h += one; return h; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half &operator--(__half &h) { __half_raw one; one.x = 0x3C00U; h -= one; return h; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator++(__half &h, const int ignored) +{ + // ignored on purpose. Parameter only needed to distinguish the function declaration from other types of operators. + static_cast(ignored); + + const __half ret = h; + __half_raw one; + one.x = 0x3C00U; + h += one; + return ret; +} +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator--(__half &h, const int ignored) +{ + // ignored on purpose. Parameter only needed to distinguish the function declaration from other types of operators. + static_cast(ignored); + + const __half ret = h; + __half_raw one; + one.x = 0x3C00U; + h -= one; + return ret; +} +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator+(const __half &h) { return h; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half operator-(const __half &h) { return __hneg(h); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator==(const __half &lh, const __half &rh) { return __heq(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator!=(const __half &lh, const __half &rh) { return __hneu(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator> (const __half &lh, const __half &rh) { return __hgt(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator< (const __half &lh, const __half &rh) { return __hlt(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator>=(const __half &lh, const __half &rh) { return __hge(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator<=(const __half &lh, const __half &rh) { return __hle(lh, rh); } +#endif /* !defined(__CUDA_NO_HALF_OPERATORS__) */ +#if defined(__CPP_VERSION_AT_LEAST_11_FP16) +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half2 &__half2::operator=(const __half2 &&src) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __HALF2_TO_UI(*this) = std::move(__HALF2_TO_CUI(src)); +, + this->x = src.x; + this->y = src.y; +) + return *this; +} +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP16) */ +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half2 &__half2::operator=(const __half2 &src) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __HALF2_TO_UI(*this) = __HALF2_TO_CUI(src); +, + this->x = src.x; + this->y = src.y; +) + return *this; +} +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half2 &__half2::operator=(const __half2_raw &h2r) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __HALF2_TO_UI(*this) = __HALF2_TO_CUI(h2r); +, + __half_raw tr; + tr.x = h2r.x; + this->x = static_cast<__half>(tr); + tr.x = h2r.y; + this->y = static_cast<__half>(tr); +) + return *this; +} +__CUDA_HOSTDEVICE__ __CUDA_FP16_INLINE__ __half2::operator __half2_raw() const { + __half2_raw ret; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + ret.x = 0U; + ret.y = 0U; + __HALF2_TO_UI(ret) = __HALF2_TO_CUI(*this); +, + ret.x = static_cast<__half_raw>(this->x).x; + ret.y = static_cast<__half_raw>(this->y).x; +) + return ret; +} +#if !defined(__CUDA_NO_HALF2_OPERATORS__) +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator+(const __half2 &lh, const __half2 &rh) { return __hadd2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator-(const __half2 &lh, const __half2 &rh) { return __hsub2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator*(const __half2 &lh, const __half2 &rh) { return __hmul2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator/(const __half2 &lh, const __half2 &rh) { return __h2div(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2& operator+=(__half2 &lh, const __half2 &rh) { lh = __hadd2(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2& operator-=(__half2 &lh, const __half2 &rh) { lh = __hsub2(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2& operator*=(__half2 &lh, const __half2 &rh) { lh = __hmul2(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2& operator/=(__half2 &lh, const __half2 &rh) { lh = __h2div(lh, rh); return lh; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 &operator++(__half2 &h) { __half2_raw one; one.x = 0x3C00U; one.y = 0x3C00U; h = __hadd2(h, one); return h; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 &operator--(__half2 &h) { __half2_raw one; one.x = 0x3C00U; one.y = 0x3C00U; h = __hsub2(h, one); return h; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator++(__half2 &h, const int ignored) +{ + // ignored on purpose. Parameter only needed to distinguish the function declaration from other types of operators. + static_cast(ignored); + + const __half2 ret = h; + __half2_raw one; + one.x = 0x3C00U; + one.y = 0x3C00U; + h = __hadd2(h, one); + return ret; +} +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator--(__half2 &h, const int ignored) +{ + // ignored on purpose. Parameter only needed to distinguish the function declaration from other types of operators. + static_cast(ignored); + + const __half2 ret = h; + __half2_raw one; + one.x = 0x3C00U; + one.y = 0x3C00U; + h = __hsub2(h, one); + return ret; +} +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator+(const __half2 &h) { return h; } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ __half2 operator-(const __half2 &h) { return __hneg2(h); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator==(const __half2 &lh, const __half2 &rh) { return __hbeq2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator!=(const __half2 &lh, const __half2 &rh) { return __hbneu2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator>(const __half2 &lh, const __half2 &rh) { return __hbgt2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator<(const __half2 &lh, const __half2 &rh) { return __hblt2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator>=(const __half2 &lh, const __half2 &rh) { return __hbge2(lh, rh); } +__CUDA_HOSTDEVICE__ __CUDA_FP16_FORCEINLINE__ bool operator<=(const __half2 &lh, const __half2 &rh) { return __hble2(lh, rh); } +#endif /* !defined(__CUDA_NO_HALF2_OPERATORS__) */ + +/* Restore warning for multiple assignment operators */ +#if defined(_MSC_VER) && _MSC_VER >= 1500 +#pragma warning( pop ) +#endif /* defined(_MSC_VER) && _MSC_VER >= 1500 */ + +/* Restore -Weffc++ warnings from here on */ +#if defined(__GNUC__) +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +#pragma GCC diagnostic pop +#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) */ +#endif /* defined(__GNUC__) */ + +#undef __CUDA_HOSTDEVICE__ +#undef __CUDA_ALIGN__ + +#ifndef __CUDACC_RTC__ /* no host functions in NVRTC mode */ +static inline unsigned short __internal_float2half(const float f, unsigned int &sign, unsigned int &remainder) +{ + unsigned int x; + unsigned int u; + unsigned int result; +#if defined(__CUDACC__) + (void)memcpy(&x, &f, sizeof(f)); +#else + (void)std::memcpy(&x, &f, sizeof(f)); +#endif + u = (x & 0x7fffffffU); + sign = ((x >> 16U) & 0x8000U); + // NaN/+Inf/-Inf + if (u >= 0x7f800000U) { + remainder = 0U; + result = ((u == 0x7f800000U) ? (sign | 0x7c00U) : 0x7fffU); + } else if (u > 0x477fefffU) { // Overflows + remainder = 0x80000000U; + result = (sign | 0x7bffU); + } else if (u >= 0x38800000U) { // Normal numbers + remainder = u << 19U; + u -= 0x38000000U; + result = (sign | (u >> 13U)); + } else if (u < 0x33000001U) { // +0/-0 + remainder = u; + result = sign; + } else { // Denormal numbers + const unsigned int exponent = u >> 23U; + const unsigned int shift = 0x7eU - exponent; + unsigned int mantissa = (u & 0x7fffffU); + mantissa |= 0x800000U; + remainder = mantissa << (32U - shift); + result = (sign | (mantissa >> shift)); + result &= 0x0000FFFFU; + } + return static_cast(result); +} +#endif /* #if !defined(__CUDACC_RTC__) */ + +__CUDA_HOSTDEVICE_FP16_DECL__ __half __double2half(const double a) +{ +IF_DEVICE_OR_CUDACC( + __half val; + asm("{ cvt.rn.f16.f64 %0, %1;}\n" : "=h"(__HALF_TO_US(val)) : "d"(a)); + return val; +, + __half result; + // Perform rounding to 11 bits of precision, convert value + // to float and call existing float to half conversion. + // By pre-rounding to 11 bits we avoid additional rounding + // in float to half conversion. + unsigned long long int absa; + unsigned long long int ua; + (void)memcpy(&ua, &a, sizeof(a)); + absa = (ua & 0x7fffffffffffffffULL); + if ((absa >= 0x40f0000000000000ULL) || (absa <= 0x3e60000000000000ULL)) + { + // |a| >= 2^16 or NaN or |a| <= 2^(-25) + // double-rounding is not a problem + result = __float2half(static_cast(a)); + } + else + { + // here 2^(-25) < |a| < 2^16 + // prepare shifter value such that a + shifter + // done in double precision performs round-to-nearest-even + // and (a + shifter) - shifter results in a rounded to + // 11 bits of precision. Shifter needs to have exponent of + // a plus 53 - 11 = 42 and a leading bit in mantissa to guard + // against negative values. + // So need to have |a| capped to avoid overflow in exponent. + // For inputs that are smaller than half precision minnorm + // we prepare fixed shifter exponent. + unsigned long long shifterBits; + if (absa >= 0x3f10000000000000ULL) + { // Here if |a| >= 2^(-14) + // add 42 to exponent bits + shifterBits = (ua & 0x7ff0000000000000ULL) + 0x02A0000000000000ULL; + } + else + { // 2^(-25) < |a| < 2^(-14), potentially results in denormal + // set exponent bits to 42 - 14 + bias + shifterBits = 0x41B0000000000000ULL; + } + // set leading mantissa bit to protect against negative inputs + shifterBits |= 0x0008000000000000ULL; + double shifter; + (void)memcpy(&shifter, &shifterBits, sizeof(shifterBits)); + double aShiftRound = a + shifter; + + // Prevent the compiler from optimizing away a + shifter - shifter + // by doing intermediate memcopy and harmless bitwize operation + unsigned long long int aShiftRoundBits; + (void)memcpy(&aShiftRoundBits, &aShiftRound, sizeof(aShiftRound)); + + // the value is positive, so this operation doesn't change anything + aShiftRoundBits &= 0x7fffffffffffffffULL; + + (void)memcpy(&aShiftRound, &aShiftRoundBits, sizeof(aShiftRound)); + + result = __float2half(static_cast(aShiftRound - shifter)); + } + + return result; +, + __half result; + /* + // Perform rounding to 11 bits of precision, convert value + // to float and call existing float to half conversion. + // By pre-rounding to 11 bits we avoid additional rounding + // in float to half conversion. + */ + unsigned long long int absa; + unsigned long long int ua; + (void)std::memcpy(&ua, &a, sizeof(a)); + absa = (ua & 0x7fffffffffffffffULL); + if ((absa >= 0x40f0000000000000ULL) || (absa <= 0x3e60000000000000ULL)) + { + /* + // |a| >= 2^16 or NaN or |a| <= 2^(-25) + // double-rounding is not a problem + */ + result = __float2half(static_cast(a)); + } + else + { + /* + // here 2^(-25) < |a| < 2^16 + // prepare shifter value such that a + shifter + // done in double precision performs round-to-nearest-even + // and (a + shifter) - shifter results in a rounded to + // 11 bits of precision. Shifter needs to have exponent of + // a plus 53 - 11 = 42 and a leading bit in mantissa to guard + // against negative values. + // So need to have |a| capped to avoid overflow in exponent. + // For inputs that are smaller than half precision minnorm + // we prepare fixed shifter exponent. + */ + unsigned long long shifterBits; + if (absa >= 0x3f10000000000000ULL) + { + /* + // Here if |a| >= 2^(-14) + // add 42 to exponent bits + */ + shifterBits = (ua & 0x7ff0000000000000ULL) + 0x02A0000000000000ULL; + } + else + { + /* + // 2^(-25) < |a| < 2^(-14), potentially results in denormal + // set exponent bits to 42 - 14 + bias + */ + shifterBits = 0x41B0000000000000ULL; + } + // set leading mantissa bit to protect against negative inputs + shifterBits |= 0x0008000000000000ULL; + double shifter; + (void)std::memcpy(&shifter, &shifterBits, sizeof(shifterBits)); + double aShiftRound = a + shifter; + + /* + // Prevent the compiler from optimizing away a + shifter - shifter + // by doing intermediate memcopy and harmless bitwize operation + */ + unsigned long long int aShiftRoundBits; + (void)std::memcpy(&aShiftRoundBits, &aShiftRound, sizeof(aShiftRound)); + + // the value is positive, so this operation doesn't change anything + aShiftRoundBits &= 0x7fffffffffffffffULL; + + (void)std::memcpy(&aShiftRound, &aShiftRoundBits, sizeof(aShiftRound)); + + result = __float2half(static_cast(aShiftRound - shifter)); + } + + return result; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __float2half(const float a) +{ + __half val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{ cvt.rn.f16.f32 %0, %1;}\n" : "=h"(__HALF_TO_US(val)) : "f"(a)); +, + __half_raw r; + unsigned int sign = 0U; + unsigned int remainder = 0U; + r.x = __internal_float2half(a, sign, remainder); + if ((remainder > 0x80000000U) || ((remainder == 0x80000000U) && ((r.x & 0x1U) != 0U))) { + r.x++; + } + val = r; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __float2half_rn(const float a) +{ + __half val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{ cvt.rn.f16.f32 %0, %1;}\n" : "=h"(__HALF_TO_US(val)) : "f"(a)); +, + __half_raw r; + unsigned int sign = 0U; + unsigned int remainder = 0U; + r.x = __internal_float2half(a, sign, remainder); + if ((remainder > 0x80000000U) || ((remainder == 0x80000000U) && ((r.x & 0x1U) != 0U))) { + r.x++; + } + val = r; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __float2half_rz(const float a) +{ + __half val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{ cvt.rz.f16.f32 %0, %1;}\n" : "=h"(__HALF_TO_US(val)) : "f"(a)); +, + __half_raw r; + unsigned int sign = 0U; + unsigned int remainder = 0U; + r.x = __internal_float2half(a, sign, remainder); + val = r; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __float2half_rd(const float a) +{ + __half val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{ cvt.rm.f16.f32 %0, %1;}\n" : "=h"(__HALF_TO_US(val)) : "f"(a)); +, + __half_raw r; + unsigned int sign = 0U; + unsigned int remainder = 0U; + r.x = __internal_float2half(a, sign, remainder); + if ((remainder != 0U) && (sign != 0U)) { + r.x++; + } + val = r; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __float2half_ru(const float a) +{ + __half val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{ cvt.rp.f16.f32 %0, %1;}\n" : "=h"(__HALF_TO_US(val)) : "f"(a)); +, + __half_raw r; + unsigned int sign = 0U; + unsigned int remainder = 0U; + r.x = __internal_float2half(a, sign, remainder); + if ((remainder != 0U) && (sign == 0U)) { + r.x++; + } + val = r; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __float2half2_rn(const float a) +{ + __half2 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 low;\n" + " cvt.rn.f16.f32 low, %1;\n" + " mov.b32 %0, {low,low};}\n" : "=r"(__HALF2_TO_UI(val)) : "f"(a)); +, + val = __half2(__float2half_rn(a), __float2half_rn(a)); +) + return val; +} + +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ __half2 __internal_device_float2_to_half2_rn(const float a, const float b) { + __half2 val; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + asm("{ cvt.rn.f16x2.f32 %0, %2, %1; }\n" + : "=r"(__HALF2_TO_UI(val)) : "f"(a), "f"(b)); +, + asm("{.reg .f16 low,high;\n" + " cvt.rn.f16.f32 low, %1;\n" + " cvt.rn.f16.f32 high, %2;\n" + " mov.b32 %0, {low,high};}\n" : "=r"(__HALF2_TO_UI(val)) : "f"(a), "f"(b)); +) + return val; +} + +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __floats2half2_rn(const float a, const float b) +{ + __half2 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + val = __internal_device_float2_to_half2_rn(a,b); +, + val = __half2(__float2half_rn(a), __float2half_rn(b)); +) + return val; +} + +#ifndef __CUDACC_RTC__ /* no host functions in NVRTC mode */ +static inline float __internal_half2float(const unsigned short h) +{ + unsigned int sign = ((static_cast(h) >> 15U) & 1U); + unsigned int exponent = ((static_cast(h) >> 10U) & 0x1fU); + unsigned int mantissa = ((static_cast(h) & 0x3ffU) << 13U); + float f; + if (exponent == 0x1fU) { /* NaN or Inf */ + /* discard sign of a NaN */ + sign = ((mantissa != 0U) ? (sign >> 1U) : sign); + mantissa = ((mantissa != 0U) ? 0x7fffffU : 0U); + exponent = 0xffU; + } else if (exponent == 0U) { /* Denorm or Zero */ + if (mantissa != 0U) { + unsigned int msb; + exponent = 0x71U; + do { + msb = (mantissa & 0x400000U); + mantissa <<= 1U; /* normalize */ + --exponent; + } while (msb == 0U); + mantissa &= 0x7fffffU; /* 1.mantissa is implicit */ + } + } else { + exponent += 0x70U; + } + const unsigned int u = ((sign << 31U) | (exponent << 23U) | mantissa); +#if defined(__CUDACC__) + (void)memcpy(&f, &u, sizeof(u)); +#else + (void)std::memcpy(&f, &u, sizeof(u)); +#endif + return f; +} +#endif /* !defined(__CUDACC_RTC__) */ + +__CUDA_HOSTDEVICE_FP16_DECL__ float __half2float(const __half a) +{ + float val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{ cvt.f32.f16 %0, %1;}\n" : "=f"(val) : "h"(__HALF_TO_CUS(a))); +, + val = __internal_half2float(static_cast<__half_raw>(a).x); +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ float __low2float(const __half2 a) +{ + float val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high},%1;\n" + " cvt.f32.f16 %0, low;}\n" : "=f"(val) : "r"(__HALF2_TO_CUI(a))); +, + val = __internal_half2float(static_cast<__half2_raw>(a).x); +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ float __high2float(const __half2 a) +{ + float val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high},%1;\n" + " cvt.f32.f16 %0, high;}\n" : "=f"(val) : "r"(__HALF2_TO_CUI(a))); +, + val = __internal_half2float(static_cast<__half2_raw>(a).y); +) + return val; +} + +__CUDA_HOSTDEVICE_FP16_DECL__ signed char __half2char_rz(const __half h) +{ + signed char i; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + unsigned int tmp; + asm("cvt.rzi.s8.f16 %0, %1;" : "=r"(tmp) : "h"(__HALF_TO_CUS(h))); + const unsigned char u = static_cast(tmp); + i = static_cast(u); +, + const float f = __half2float(h); + const signed char max_val = (signed char)0x7fU; + const signed char min_val = (signed char)0x80U; + const unsigned short bits = static_cast(static_cast<__half_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xF800U) { + // NaN + i = 0; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value, conversion is well-defined + i = static_cast(f); + } +) + return i; +} + +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned char __half2uchar_rz(const __half h) +{ + unsigned char i; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_90, + unsigned int tmp; + asm("cvt.rzi.u8.f16 %0, %1;" : "=r"(tmp) : "h"(__HALF_TO_CUS(h))); + i = static_cast(tmp); +, + const float f = __half2float(h); + const unsigned char max_val = 0xffU; + const unsigned char min_val = 0U; + const unsigned short bits = static_cast(static_cast<__half_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xF800U) { + // NaN + i = 0U; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value, conversion is well-defined + i = static_cast(f); + } +) + return i; +} + +__CUDA_HOSTDEVICE_FP16_DECL__ short int __half2short_rz(const __half h) +{ + short int i; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rzi.s16.f16 %0, %1;" : "=h"(i) : "h"(__HALF_TO_CUS(h))); +, + const float f = __half2float(h); + const short int max_val = (short int)0x7fffU; + const short int min_val = (short int)0x8000U; + const unsigned short bits = static_cast(static_cast<__half_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xF800U) { + // NaN + i = 0; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value, conversion is well-defined + i = static_cast(f); + } +) + return i; +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned short int __half2ushort_rz(const __half h) +{ + unsigned short int i; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rzi.u16.f16 %0, %1;" : "=h"(i) : "h"(__HALF_TO_CUS(h))); +, + const float f = __half2float(h); + const unsigned short int max_val = 0xffffU; + const unsigned short int min_val = 0U; + const unsigned short bits = static_cast(static_cast<__half_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xF800U) { + // NaN + i = 0U; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value, conversion is well-defined + i = static_cast(f); + } +) + return i; +} +__CUDA_HOSTDEVICE_FP16_DECL__ int __half2int_rz(const __half h) +{ + int i; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rzi.s32.f16 %0, %1;" : "=r"(i) : "h"(__HALF_TO_CUS(h))); +, + const float f = __half2float(h); + const int max_val = (int)0x7fffffffU; + const int min_val = (int)0x80000000U; + const unsigned short bits = static_cast(static_cast<__half_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xF800U) { + // NaN + i = 0; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value, conversion is well-defined + i = static_cast(f); + } +) + return i; +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned int __half2uint_rz(const __half h) +{ + unsigned int i; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rzi.u32.f16 %0, %1;" : "=r"(i) : "h"(__HALF_TO_CUS(h))); +, + const float f = __half2float(h); + const unsigned int max_val = 0xffffffffU; + const unsigned int min_val = 0U; + const unsigned short bits = static_cast(static_cast<__half_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xF800U) { + // NaN + i = 0U; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value, conversion is well-defined + i = static_cast(f); + } +) + return i; +} +__CUDA_HOSTDEVICE_FP16_DECL__ long long int __half2ll_rz(const __half h) +{ + long long int i; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rzi.s64.f16 %0, %1;" : "=l"(i) : "h"(__HALF_TO_CUS(h))); +, + const float f = __half2float(h); + const long long int max_val = (long long int)0x7fffffffffffffffULL; + const long long int min_val = (long long int)0x8000000000000000ULL; + const unsigned short bits = static_cast(static_cast<__half_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xF800U) { + // NaN + i = min_val; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value, conversion is well-defined + i = static_cast(f); + } +) + return i; +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned long long int __half2ull_rz(const __half h) +{ + unsigned long long int i; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rzi.u64.f16 %0, %1;" : "=l"(i) : "h"(__HALF_TO_CUS(h))); +, + const float f = __half2float(h); + const unsigned long long int max_val = 0xffffffffffffffffULL; + const unsigned long long int min_val = 0ULL; + const unsigned short bits = static_cast(static_cast<__half_raw>(h).x << 1U); + // saturation fixup + if (bits > (unsigned short)0xF800U) { + // NaN + i = 0x8000000000000000ULL; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value, conversion is well-defined + i = static_cast(f); + } +) + return i; +} +/* CUDA vector-types compatible vector creation function (note returns __half2, not half2) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 make_half2(const __half x, const __half y) +{ + __half2 t; t.x = x; t.y = y; return t; +} + + +/* Definitions of intrinsics */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __float22half2_rn(const float2 a) +{ + const __half2 val = __floats2half2_rn(a.x, a.y); + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ float2 __half22float2(const __half2 a) +{ + float hi_float; + float lo_float; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high},%1;\n" + " cvt.f32.f16 %0, low;}\n" : "=f"(lo_float) : "r"(__HALF2_TO_CUI(a))); + + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high},%1;\n" + " cvt.f32.f16 %0, high;}\n" : "=f"(hi_float) : "r"(__HALF2_TO_CUI(a))); +, + lo_float = __internal_half2float(((__half2_raw)a).x); + hi_float = __internal_half2float(((__half2_raw)a).y); +) + return make_float2(lo_float, hi_float); +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ int __half2int_rn(const __half h) +{ + int i; + asm("cvt.rni.s32.f16 %0, %1;" : "=r"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ int __half2int_rd(const __half h) +{ + int i; + asm("cvt.rmi.s32.f16 %0, %1;" : "=r"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ int __half2int_ru(const __half h) +{ + int i; + asm("cvt.rpi.s32.f16 %0, %1;" : "=r"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __int2half_rn(const int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rn.f16.s32 %0, %1;" : "=h"(__HALF_TO_US(h)) : "r"(i)); +, + // double-rounding is not a problem here: if integer + // has more than 24 bits, it is already too large to + // be represented in half precision, and result will + // be infinity. + const float f = static_cast(i); + h = __float2half_rn(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __int2half_rz(const int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rz.f16.s32 %0, %1;" : "=h"(__HALF_TO_US(h)) : "r"(i)); +, + const float f = static_cast(i); + h = __float2half_rz(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __int2half_rd(const int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rm.f16.s32 %0, %1;" : "=h"(__HALF_TO_US(h)) : "r"(i)); +, + const float f = static_cast(i); + h = __float2half_rd(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __int2half_ru(const int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rp.f16.s32 %0, %1;" : "=h"(__HALF_TO_US(h)) : "r"(i)); +, + const float f = static_cast(i); + h = __float2half_ru(f); +) + return h; +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ short int __half2short_rn(const __half h) +{ + short int i; + asm("cvt.rni.s16.f16 %0, %1;" : "=h"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ short int __half2short_rd(const __half h) +{ + short int i; + asm("cvt.rmi.s16.f16 %0, %1;" : "=h"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ short int __half2short_ru(const __half h) +{ + short int i; + asm("cvt.rpi.s16.f16 %0, %1;" : "=h"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __short2half_rn(const short int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rn.f16.s16 %0, %1;" : "=h"(__HALF_TO_US(h)) : "h"(i)); +, + const float f = static_cast(i); + h = __float2half_rn(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __short2half_rz(const short int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rz.f16.s16 %0, %1;" : "=h"(__HALF_TO_US(h)) : "h"(i)); +, + const float f = static_cast(i); + h = __float2half_rz(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __short2half_rd(const short int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rm.f16.s16 %0, %1;" : "=h"(__HALF_TO_US(h)) : "h"(i)); +, + const float f = static_cast(i); + h = __float2half_rd(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __short2half_ru(const short int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rp.f16.s16 %0, %1;" : "=h"(__HALF_TO_US(h)) : "h"(i)); +, + const float f = static_cast(i); + h = __float2half_ru(f); +) + return h; +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ unsigned int __half2uint_rn(const __half h) +{ + unsigned int i; + asm("cvt.rni.u32.f16 %0, %1;" : "=r"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ unsigned int __half2uint_rd(const __half h) +{ + unsigned int i; + asm("cvt.rmi.u32.f16 %0, %1;" : "=r"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ unsigned int __half2uint_ru(const __half h) +{ + unsigned int i; + asm("cvt.rpi.u32.f16 %0, %1;" : "=r"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __uint2half_rn(const unsigned int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rn.f16.u32 %0, %1;" : "=h"(__HALF_TO_US(h)) : "r"(i)); +, + // double-rounding is not a problem here: if integer + // has more than 24 bits, it is already too large to + // be represented in half precision, and result will + // be infinity. + const float f = static_cast(i); + h = __float2half_rn(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __uint2half_rz(const unsigned int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rz.f16.u32 %0, %1;" : "=h"(__HALF_TO_US(h)) : "r"(i)); +, + const float f = static_cast(i); + h = __float2half_rz(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __uint2half_rd(const unsigned int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rm.f16.u32 %0, %1;" : "=h"(__HALF_TO_US(h)) : "r"(i)); +, + const float f = static_cast(i); + h = __float2half_rd(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __uint2half_ru(const unsigned int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rp.f16.u32 %0, %1;" : "=h"(__HALF_TO_US(h)) : "r"(i)); +, + const float f = static_cast(i); + h = __float2half_ru(f); +) + return h; +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ unsigned short int __half2ushort_rn(const __half h) +{ + unsigned short int i; + asm("cvt.rni.u16.f16 %0, %1;" : "=h"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ unsigned short int __half2ushort_rd(const __half h) +{ + unsigned short int i; + asm("cvt.rmi.u16.f16 %0, %1;" : "=h"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ unsigned short int __half2ushort_ru(const __half h) +{ + unsigned short int i; + asm("cvt.rpi.u16.f16 %0, %1;" : "=h"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ushort2half_rn(const unsigned short int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rn.f16.u16 %0, %1;" : "=h"(__HALF_TO_US(h)) : "h"(i)); +, + const float f = static_cast(i); + h = __float2half_rn(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ushort2half_rz(const unsigned short int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rz.f16.u16 %0, %1;" : "=h"(__HALF_TO_US(h)) : "h"(i)); +, + const float f = static_cast(i); + h = __float2half_rz(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ushort2half_rd(const unsigned short int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rm.f16.u16 %0, %1;" : "=h"(__HALF_TO_US(h)) : "h"(i)); +, + const float f = static_cast(i); + h = __float2half_rd(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ushort2half_ru(const unsigned short int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rp.f16.u16 %0, %1;" : "=h"(__HALF_TO_US(h)) : "h"(i)); +, + const float f = static_cast(i); + h = __float2half_ru(f); +) + return h; +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ unsigned long long int __half2ull_rn(const __half h) +{ + unsigned long long int i; + asm("cvt.rni.u64.f16 %0, %1;" : "=l"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ unsigned long long int __half2ull_rd(const __half h) +{ + unsigned long long int i; + asm("cvt.rmi.u64.f16 %0, %1;" : "=l"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ unsigned long long int __half2ull_ru(const __half h) +{ + unsigned long long int i; + asm("cvt.rpi.u64.f16 %0, %1;" : "=l"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ull2half_rn(const unsigned long long int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rn.f16.u64 %0, %1;" : "=h"(__HALF_TO_US(h)) : "l"(i)); +, + // double-rounding is not a problem here: if integer + // has more than 24 bits, it is already too large to + // be represented in half precision, and result will + // be infinity. + const float f = static_cast(i); + h = __float2half_rn(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ull2half_rz(const unsigned long long int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rz.f16.u64 %0, %1;" : "=h"(__HALF_TO_US(h)) : "l"(i)); +, + const float f = static_cast(i); + h = __float2half_rz(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ull2half_rd(const unsigned long long int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rm.f16.u64 %0, %1;" : "=h"(__HALF_TO_US(h)) : "l"(i)); +, + const float f = static_cast(i); + h = __float2half_rd(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ull2half_ru(const unsigned long long int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rp.f16.u64 %0, %1;" : "=h"(__HALF_TO_US(h)) : "l"(i)); +, + const float f = static_cast(i); + h = __float2half_ru(f); +) + return h; +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ long long int __half2ll_rn(const __half h) +{ + long long int i; + asm("cvt.rni.s64.f16 %0, %1;" : "=l"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ long long int __half2ll_rd(const __half h) +{ + long long int i; + asm("cvt.rmi.s64.f16 %0, %1;" : "=l"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +__CUDA_FP16_DECL__ long long int __half2ll_ru(const __half h) +{ + long long int i; + asm("cvt.rpi.s64.f16 %0, %1;" : "=l"(i) : "h"(__HALF_TO_CUS(h))); + return i; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ll2half_rn(const long long int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rn.f16.s64 %0, %1;" : "=h"(__HALF_TO_US(h)) : "l"(i)); +, + // double-rounding is not a problem here: if integer + // has more than 24 bits, it is already too large to + // be represented in half precision, and result will + // be infinity. + const float f = static_cast(i); + h = __float2half_rn(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ll2half_rz(const long long int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rz.f16.s64 %0, %1;" : "=h"(__HALF_TO_US(h)) : "l"(i)); +, + const float f = static_cast(i); + h = __float2half_rz(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ll2half_rd(const long long int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rm.f16.s64 %0, %1;" : "=h"(__HALF_TO_US(h)) : "l"(i)); +, + const float f = static_cast(i); + h = __float2half_rd(f); +) + return h; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ll2half_ru(const long long int i) +{ + __half h; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("cvt.rp.f16.s64 %0, %1;" : "=h"(__HALF_TO_US(h)) : "l"(i)); +, + const float f = static_cast(i); + h = __float2half_ru(f); +) + return h; +} +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ __half htrunc(const __half h) +{ + __half r; + asm("cvt.rzi.f16.f16 %0, %1;" : "=h"(__HALF_TO_US(r)) : "h"(__HALF_TO_CUS(h))); + return r; +} +__CUDA_FP16_DECL__ __half hceil(const __half h) +{ + __half r; + asm("cvt.rpi.f16.f16 %0, %1;" : "=h"(__HALF_TO_US(r)) : "h"(__HALF_TO_CUS(h))); + return r; +} +__CUDA_FP16_DECL__ __half hfloor(const __half h) +{ + __half r; + asm("cvt.rmi.f16.f16 %0, %1;" : "=h"(__HALF_TO_US(r)) : "h"(__HALF_TO_CUS(h))); + return r; +} +__CUDA_FP16_DECL__ __half hrint(const __half h) +{ + __half r; + asm("cvt.rni.f16.f16 %0, %1;" : "=h"(__HALF_TO_US(r)) : "h"(__HALF_TO_CUS(h))); + return r; +} + +__CUDA_FP16_DECL__ __half2 h2trunc(const __half2 h) +{ + __half2 val; + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " cvt.rzi.f16.f16 low, low;\n" + " cvt.rzi.f16.f16 high, high;\n" + " mov.b32 %0, {low,high};}\n" : "=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(h))); + return val; +} +__CUDA_FP16_DECL__ __half2 h2ceil(const __half2 h) +{ + __half2 val; + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " cvt.rpi.f16.f16 low, low;\n" + " cvt.rpi.f16.f16 high, high;\n" + " mov.b32 %0, {low,high};}\n" : "=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(h))); + return val; +} +__CUDA_FP16_DECL__ __half2 h2floor(const __half2 h) +{ + __half2 val; + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " cvt.rmi.f16.f16 low, low;\n" + " cvt.rmi.f16.f16 high, high;\n" + " mov.b32 %0, {low,high};}\n" : "=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(h))); + return val; +} +__CUDA_FP16_DECL__ __half2 h2rint(const __half2 h) +{ + __half2 val; + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " cvt.rni.f16.f16 low, low;\n" + " cvt.rni.f16.f16 high, high;\n" + " mov.b32 %0, {low,high};}\n" : "=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(h))); + return val; +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __lows2half2(const __half2 a, const __half2 b) +{ + __half2 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 alow,ahigh,blow,bhigh;\n" + " mov.b32 {alow,ahigh}, %1;\n" + " mov.b32 {blow,bhigh}, %2;\n" + " mov.b32 %0, {alow,blow};}\n" : "=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a)), "r"(__HALF2_TO_CUI(b))); +, + val.x = a.x; + val.y = b.x; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __highs2half2(const __half2 a, const __half2 b) +{ + __half2 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 alow,ahigh,blow,bhigh;\n" + " mov.b32 {alow,ahigh}, %1;\n" + " mov.b32 {blow,bhigh}, %2;\n" + " mov.b32 %0, {ahigh,bhigh};}\n" : "=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a)), "r"(__HALF2_TO_CUI(b))); +, + val.x = a.y; + val.y = b.y; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __low2half(const __half2 a) +{ + __half ret; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " mov.b16 %0, low;}" : "=h"(__HALF_TO_US(ret)) : "r"(__HALF2_TO_CUI(a))); +, + ret = a.x; +) + return ret; +} +__CUDA_HOSTDEVICE_FP16_DECL__ int __hisinf(const __half a) +{ + int retval; + const __half_raw araw = __half_raw(a); + if (araw.x == 0xFC00U) { + retval = -1; + } else if (araw.x == 0x7C00U) { + retval = 1; + } else { + retval = 0; + } + return retval; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __low2half2(const __half2 a) +{ + __half2 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " mov.b32 %0, {low,low};}\n" : "=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a))); +, + val.x = a.x; + val.y = a.x; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __high2half2(const __half2 a) +{ + __half2 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " mov.b32 %0, {high,high};}\n" : "=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a))); +, + val.x = a.y; + val.y = a.y; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __high2half(const __half2 a) +{ + __half ret; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " mov.b16 %0, high;}" : "=h"(__HALF_TO_US(ret)) : "r"(__HALF2_TO_CUI(a))); +, + ret = a.y; +) + return ret; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __halves2half2(const __half a, const __half b) +{ + __half2 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{ mov.b32 %0, {%1,%2};}\n" + : "=r"(__HALF2_TO_UI(val)) : "h"(__HALF_TO_CUS(a)), "h"(__HALF_TO_CUS(b))); +, + val.x = a; + val.y = b; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __half2half2(const __half a) +{ + __half2 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{ mov.b32 %0, {%1,%1};}\n" + : "=r"(__HALF2_TO_UI(val)) : "h"(__HALF_TO_CUS(a))); +, + val.x = a; + val.y = a; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __lowhigh2highlow(const __half2 a) +{ + __half2 val; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm("{.reg .f16 low,high;\n" + " mov.b32 {low,high}, %1;\n" + " mov.b32 %0, {high,low};}\n" : "=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a))); +, + val.x = a.y; + val.y = a.x; +) + return val; +} +__CUDA_HOSTDEVICE_FP16_DECL__ short int __half_as_short(const __half h) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return static_cast(__HALF_TO_CUS(h)); +, + return static_cast(__half_raw(h).x); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned short int __half_as_ushort(const __half h) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __HALF_TO_CUS(h); +, + return __half_raw(h).x; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __short_as_half(const short int i) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __half h; + __HALF_TO_US(h) = static_cast(i); + return h; +, + __half_raw hr; + hr.x = static_cast(i); + return __half(hr); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __ushort_as_half(const unsigned short int i) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __half h; + __HALF_TO_US(h) = i; + return h; +, + __half_raw hr; + hr.x = i; + return __half(hr);) +} + +/****************************************************************************** +* __half arithmetic * +******************************************************************************/ +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ __half __internal_device_hmax(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __BINARY_OP_HALF_MACRO(max) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + float fr; + asm("{max.f32 %0,%1,%2;\n}" + :"=f"(fr) : "f"(fa), "f"(fb)); + const __half hr = __float2half(fr); + return hr; +) +} +__CUDA_FP16_DECL__ __half __internal_device_hmin(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __BINARY_OP_HALF_MACRO(min) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + float fr; + asm("{min.f32 %0,%1,%2;\n}" + :"=f"(fr) : "f"(fa), "f"(fb)); + const __half hr = __float2half(fr); + return hr; +) +} +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmax(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hmax(a, b); +, + __half maxval; + + maxval = (__hge(a, b) || __hisnan(b)) ? a : b; + + if (__hisnan(maxval)) + { + // if both inputs are NaN, return canonical NaN + maxval = CUDART_NAN_FP16; + } + else if (__heq(a, b)) + { + // hmax(+0.0, -0.0) = +0.0 + // unsigned compare 0x8000U > 0x0000U + __half_raw ra = __half_raw(a); + __half_raw rb = __half_raw(b); + maxval = (ra.x > rb.x) ? b : a; + } + return maxval; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmin(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __internal_device_hmin(a, b); +, + __half minval; + + minval = (__hle(a, b) || __hisnan(b)) ? a : b; + + if (__hisnan(minval)) + { + // if both inputs are NaN, return canonical NaN + minval = CUDART_NAN_FP16; + } + else if (__heq(a, b)) + { + // hmin(+0.0, -0.0) = -0.0 + // unsigned compare 0x8000U > 0x0000U + __half_raw ra = __half_raw(a); + __half_raw rb = __half_raw(b); + minval = (ra.x > rb.x) ? a : b; + } + + return minval; +) +} + + +/****************************************************************************** +* __half2 arithmetic * +******************************************************************************/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmax2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __BINARY_OP_HALF2_MACRO(max) +, + __half2 val; + val.x = __hmax(a.x, b.x); + val.y = __hmax(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmin2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __BINARY_OP_HALF2_MACRO(min) +, + __half2 val; + val.x = __hmin(a.x, b.x); + val.y = __hmin(a.y, b.y); + return val; +) +} + +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +#if !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 300) || defined(_NVHPC_CUDA) +/****************************************************************************** +* __half, __half2 warp shuffle * +******************************************************************************/ +#define __SHUFFLE_HALF2_MACRO(name) /* do */ {\ + __half2 r; \ + asm volatile ("{" __CUDA_FP16_STRINGIFY(name) " %0,%1,%2,%3;\n}" \ + :"=r"(__HALF2_TO_UI(r)): "r"(__HALF2_TO_CUI(var)), "r"(delta), "r"(c)); \ + return r; \ +} /* while(0) */ + +#define __SHUFFLE_SYNC_HALF2_MACRO(name) /* do */ {\ + __half2 r; \ + asm volatile ("{" __CUDA_FP16_STRINGIFY(name) " %0,%1,%2,%3,%4;\n}" \ + :"=r"(__HALF2_TO_UI(r)): "r"(__HALF2_TO_CUI(var)), "r"(delta), "r"(c), "r"(mask)); \ + return r; \ +} /* while(0) */ + +#if defined(_NVHPC_CUDA) || !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ < 700) + +__CUDA_FP16_DECL__ __half2 __shfl(const __half2 var, const int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = ((warp_size - static_cast(width)) << 8U) | 0x1fU; + __SHUFFLE_HALF2_MACRO(shfl.idx.b32) +} +__CUDA_FP16_DECL__ __half2 __shfl_up(const __half2 var, const unsigned int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = (warp_size - static_cast(width)) << 8U; + __SHUFFLE_HALF2_MACRO(shfl.up.b32) +} +__CUDA_FP16_DECL__ __half2 __shfl_down(const __half2 var, const unsigned int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = ((warp_size - static_cast(width)) << 8U) | 0x1fU; + __SHUFFLE_HALF2_MACRO(shfl.down.b32) +} +__CUDA_FP16_DECL__ __half2 __shfl_xor(const __half2 var, const int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = ((warp_size - static_cast(width)) << 8U) | 0x1fU; + __SHUFFLE_HALF2_MACRO(shfl.bfly.b32) +} + +#endif /* defined(_NVHPC_CUDA) || !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ < 700) */ + +__CUDA_FP16_DECL__ __half2 __shfl_sync(const unsigned mask, const __half2 var, const int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = ((warp_size - static_cast(width)) << 8U) | 0x1fU; + __SHUFFLE_SYNC_HALF2_MACRO(shfl.sync.idx.b32) +} +__CUDA_FP16_DECL__ __half2 __shfl_up_sync(const unsigned mask, const __half2 var, const unsigned int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = (warp_size - static_cast(width)) << 8U; + __SHUFFLE_SYNC_HALF2_MACRO(shfl.sync.up.b32) +} +__CUDA_FP16_DECL__ __half2 __shfl_down_sync(const unsigned mask, const __half2 var, const unsigned int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = ((warp_size - static_cast(width)) << 8U) | 0x1fU; + __SHUFFLE_SYNC_HALF2_MACRO(shfl.sync.down.b32) +} +__CUDA_FP16_DECL__ __half2 __shfl_xor_sync(const unsigned mask, const __half2 var, const int delta, const int width) +{ + unsigned int warp_size; + asm("{mov.u32 %0, WARP_SZ;\n}" : "=r"(warp_size)); + const unsigned int c = ((warp_size - static_cast(width)) << 8U) | 0x1fU; + __SHUFFLE_SYNC_HALF2_MACRO(shfl.sync.bfly.b32) +} + +#undef __SHUFFLE_HALF2_MACRO +#undef __SHUFFLE_SYNC_HALF2_MACRO + +#if defined(_NVHPC_CUDA) || !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ < 700) + +__CUDA_FP16_DECL__ __half __shfl(const __half var, const int delta, const int width) +{ + const __half2 temp1 = __halves2half2(var, var); + const __half2 temp2 = __shfl(temp1, delta, width); + return __low2half(temp2); +} +__CUDA_FP16_DECL__ __half __shfl_up(const __half var, const unsigned int delta, const int width) +{ + const __half2 temp1 = __halves2half2(var, var); + const __half2 temp2 = __shfl_up(temp1, delta, width); + return __low2half(temp2); +} +__CUDA_FP16_DECL__ __half __shfl_down(const __half var, const unsigned int delta, const int width) +{ + const __half2 temp1 = __halves2half2(var, var); + const __half2 temp2 = __shfl_down(temp1, delta, width); + return __low2half(temp2); +} +__CUDA_FP16_DECL__ __half __shfl_xor(const __half var, const int delta, const int width) +{ + const __half2 temp1 = __halves2half2(var, var); + const __half2 temp2 = __shfl_xor(temp1, delta, width); + return __low2half(temp2); +} + +#endif /* defined(_NVHPC_CUDA) || !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ < 700) */ + +__CUDA_FP16_DECL__ __half __shfl_sync(const unsigned mask, const __half var, const int delta, const int width) +{ + const __half2 temp1 = __halves2half2(var, var); + const __half2 temp2 = __shfl_sync(mask, temp1, delta, width); + return __low2half(temp2); +} +__CUDA_FP16_DECL__ __half __shfl_up_sync(const unsigned mask, const __half var, const unsigned int delta, const int width) +{ + const __half2 temp1 = __halves2half2(var, var); + const __half2 temp2 = __shfl_up_sync(mask, temp1, delta, width); + return __low2half(temp2); +} +__CUDA_FP16_DECL__ __half __shfl_down_sync(const unsigned mask, const __half var, const unsigned int delta, const int width) +{ + const __half2 temp1 = __halves2half2(var, var); + const __half2 temp2 = __shfl_down_sync(mask, temp1, delta, width); + return __low2half(temp2); +} +__CUDA_FP16_DECL__ __half __shfl_xor_sync(const unsigned mask, const __half var, const int delta, const int width) +{ + const __half2 temp1 = __halves2half2(var, var); + const __half2 temp2 = __shfl_xor_sync(mask, temp1, delta, width); + return __low2half(temp2); +} + +#endif /* !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 300) || defined(_NVHPC_CUDA) */ +/****************************************************************************** +* __half and __half2 __ldg,__ldcg,__ldca,__ldcs * +******************************************************************************/ + +#if defined(__cplusplus) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 320) || defined(_NVHPC_CUDA)) +#if (defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) || defined(__CUDACC_RTC__) +#define __LDG_PTR "l" +#else +#define __LDG_PTR "r" +#endif /*(defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) || defined(__CUDACC_RTC__)*/ +__CUDA_FP16_DECL__ __half2 __ldg(const __half2 *const ptr) +{ + __half2 ret; + asm ("ld.global.nc.b32 %0, [%1];" : "=r"(__HALF2_TO_UI(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_FP16_DECL__ __half __ldg(const __half *const ptr) +{ + __half ret; + asm ("ld.global.nc.b16 %0, [%1];" : "=h"(__HALF_TO_US(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_FP16_DECL__ __half2 __ldcg(const __half2 *const ptr) +{ + __half2 ret; + asm ("ld.global.cg.b32 %0, [%1];" : "=r"(__HALF2_TO_UI(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_FP16_DECL__ __half __ldcg(const __half *const ptr) +{ + __half ret; + asm ("ld.global.cg.b16 %0, [%1];" : "=h"(__HALF_TO_US(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_FP16_DECL__ __half2 __ldca(const __half2 *const ptr) +{ + __half2 ret; + asm ("ld.global.ca.b32 %0, [%1];" : "=r"(__HALF2_TO_UI(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_FP16_DECL__ __half __ldca(const __half *const ptr) +{ + __half ret; + asm ("ld.global.ca.b16 %0, [%1];" : "=h"(__HALF_TO_US(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_FP16_DECL__ __half2 __ldcs(const __half2 *const ptr) +{ + __half2 ret; + asm ("ld.global.cs.b32 %0, [%1];" : "=r"(__HALF2_TO_UI(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_FP16_DECL__ __half __ldcs(const __half *const ptr) +{ + __half ret; + asm ("ld.global.cs.b16 %0, [%1];" : "=h"(__HALF_TO_US(ret)) : __LDG_PTR(ptr)); + return ret; +} +__CUDA_FP16_DECL__ __half2 __ldlu(const __half2 *const ptr) +{ + __half2 ret; + asm ("ld.global.lu.b32 %0, [%1];" : "=r"(__HALF2_TO_UI(ret)) : __LDG_PTR(ptr) : "memory"); + return ret; +} +__CUDA_FP16_DECL__ __half __ldlu(const __half *const ptr) +{ + __half ret; + asm ("ld.global.lu.b16 %0, [%1];" : "=h"(__HALF_TO_US(ret)) : __LDG_PTR(ptr) : "memory"); + return ret; +} +__CUDA_FP16_DECL__ __half2 __ldcv(const __half2 *const ptr) +{ + __half2 ret; + asm ("ld.global.cv.b32 %0, [%1];" : "=r"(__HALF2_TO_UI(ret)) : __LDG_PTR(ptr) : "memory"); + return ret; +} +__CUDA_FP16_DECL__ __half __ldcv(const __half *const ptr) +{ + __half ret; + asm ("ld.global.cv.b16 %0, [%1];" : "=h"(__HALF_TO_US(ret)) : __LDG_PTR(ptr) : "memory"); + return ret; +} +__CUDA_FP16_DECL__ void __stwb(__half2 *const ptr, const __half2 value) +{ + asm ("st.global.wb.b32 [%0], %1;" :: __LDG_PTR(ptr), "r"(__HALF2_TO_CUI(value)) : "memory"); +} +__CUDA_FP16_DECL__ void __stwb(__half *const ptr, const __half value) +{ + asm ("st.global.wb.b16 [%0], %1;" :: __LDG_PTR(ptr), "h"(__HALF_TO_CUS(value)) : "memory"); +} +__CUDA_FP16_DECL__ void __stcg(__half2 *const ptr, const __half2 value) +{ + asm ("st.global.cg.b32 [%0], %1;" :: __LDG_PTR(ptr), "r"(__HALF2_TO_CUI(value)) : "memory"); +} +__CUDA_FP16_DECL__ void __stcg(__half *const ptr, const __half value) +{ + asm ("st.global.cg.b16 [%0], %1;" :: __LDG_PTR(ptr), "h"(__HALF_TO_CUS(value)) : "memory"); +} +__CUDA_FP16_DECL__ void __stcs(__half2 *const ptr, const __half2 value) +{ + asm ("st.global.cs.b32 [%0], %1;" :: __LDG_PTR(ptr), "r"(__HALF2_TO_CUI(value)) : "memory"); +} +__CUDA_FP16_DECL__ void __stcs(__half *const ptr, const __half value) +{ + asm ("st.global.cs.b16 [%0], %1;" :: __LDG_PTR(ptr), "h"(__HALF_TO_CUS(value)) : "memory"); +} +__CUDA_FP16_DECL__ void __stwt(__half2 *const ptr, const __half2 value) +{ + asm ("st.global.wt.b32 [%0], %1;" :: __LDG_PTR(ptr), "r"(__HALF2_TO_CUI(value)) : "memory"); +} +__CUDA_FP16_DECL__ void __stwt(__half *const ptr, const __half value) +{ + asm ("st.global.wt.b16 [%0], %1;" :: __LDG_PTR(ptr), "h"(__HALF_TO_CUS(value)) : "memory"); +} +#undef __LDG_PTR +#endif /* defined(__cplusplus) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 320) || defined(_NVHPC_CUDA)) */ +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ + +/****************************************************************************** +* __half2 comparison * +******************************************************************************/ +#define __COMPARISON_OP_HALF2_MACRO(name) /* do */ {\ + __half2 val; \ + asm( "{ " __CUDA_FP16_STRINGIFY(name) ".f16x2.f16x2 %0,%1,%2;\n}" \ + :"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a)),"r"(__HALF2_TO_CUI(b))); \ + return val; \ +} /* while(0) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __heq2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.eq) +, + __half2_raw val; + val.x = __heq(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __heq(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hne2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.ne) +, + __half2_raw val; + val.x = __hne(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hne(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hle2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.le) +, + __half2_raw val; + val.x = __hle(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hle(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hge2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.ge) +, + __half2_raw val; + val.x = __hge(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hge(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hlt2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.lt) +, + __half2_raw val; + val.x = __hlt(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hlt(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hgt2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.gt) +, + __half2_raw val; + val.x = __hgt(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hgt(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hequ2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.equ) +, + __half2_raw val; + val.x = __hequ(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hequ(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hneu2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.neu) +, + __half2_raw val; + val.x = __hneu(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hneu(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hleu2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.leu) +, + __half2_raw val; + val.x = __hleu(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hleu(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hgeu2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.geu) +, + __half2_raw val; + val.x = __hgeu(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hgeu(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hltu2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.ltu) +, + __half2_raw val; + val.x = __hltu(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hltu(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hgtu2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO(set.gtu) +, + __half2_raw val; + val.x = __hgtu(a.x, b.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hgtu(a.y, b.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + return __half2(val); +) +} +#undef __COMPARISON_OP_HALF2_MACRO +/****************************************************************************** +* __half2 comparison with mask output * +******************************************************************************/ +#define __COMPARISON_OP_HALF2_MACRO_MASK(name) /* do */ {\ + unsigned val; \ + asm( "{ " __CUDA_FP16_STRINGIFY(name) ".u32.f16x2 %0,%1,%2;\n}" \ + :"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a)),"r"(__HALF2_TO_CUI(b))); \ + return val; \ +} /* while(0) */ +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __heq2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.eq) +, + const unsigned short px = __heq(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __heq(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hne2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.ne) +, + const unsigned short px = __hne(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hne(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hle2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.le) +, + const unsigned short px = __hle(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hle(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hge2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.ge) +, + const unsigned short px = __hge(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hge(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hlt2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.lt) +, + const unsigned short px = __hlt(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hlt(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hgt2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.gt) +, + const unsigned short px = __hgt(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hgt(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hequ2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.equ) +, + const unsigned short px = __hequ(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hequ(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hneu2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.neu) +, + const unsigned short px = __hneu(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hneu(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hleu2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.leu) +, + const unsigned short px = __hleu(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hleu(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hgeu2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.geu) +, + const unsigned short px = __hgeu(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hgeu(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hltu2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.ltu) +, + const unsigned short px = __hltu(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hltu(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ unsigned __hgtu2_mask(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF2_MACRO_MASK(set.gtu) +, + const unsigned short px = __hgtu(a.x, b.x) ? (unsigned short)0xFFFFU : (unsigned short)0U; + const unsigned short py = __hgtu(a.y, b.y) ? (unsigned short)0xFFFFU : (unsigned short)0U; + unsigned ur = (unsigned)py; + ur <<= (unsigned)16U; + ur |= (unsigned)px; + return ur; +) +} +#undef __COMPARISON_OP_HALF2_MACRO_MASK + +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbeq2(const __half2 a, const __half2 b) +{ + const unsigned mask = __heq2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbne2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hne2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hble2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hle2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbge2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hge2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hblt2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hlt2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbgt2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hgt2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbequ2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hequ2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbneu2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hneu2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbleu2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hleu2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbgeu2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hgeu2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbltu2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hltu2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hbgtu2(const __half2 a, const __half2 b) +{ + const unsigned mask = __hgtu2_mask(a, b); + return (mask == 0xFFFFFFFFU); +} +/****************************************************************************** +* __half comparison * +******************************************************************************/ +#define __COMPARISON_OP_HALF_MACRO(name) /* do */ {\ + unsigned short val; \ + asm( "{ .reg .pred __$temp3;\n" \ + " setp." __CUDA_FP16_STRINGIFY(name) ".f16 __$temp3, %1, %2;\n" \ + " selp.u16 %0, 1, 0, __$temp3;}" \ + : "=h"(val) : "h"(__HALF_TO_CUS(a)), "h"(__HALF_TO_CUS(b))); \ + return (val != 0U) ? true : false; \ +} /* while(0) */ +__CUDA_HOSTDEVICE_FP16_DECL__ bool __heq(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(eq) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa == fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hne(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(ne) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa != fb) && (!__hisnan(a)) && (!__hisnan(b)); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hle(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(le) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa <= fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hge(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(ge) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa >= fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hlt(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(lt) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa < fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hgt(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(gt) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa > fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hequ(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(equ) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa == fb) || (__hisnan(a)) || (__hisnan(b)); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hneu(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(neu) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa != fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hleu(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(leu) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa <= fb) || (__hisnan(a)) || (__hisnan(b)); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hgeu(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(geu) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa >= fb) || (__hisnan(a)) || (__hisnan(b)); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hltu(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(ltu) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa < fb) || (__hisnan(a)) || (__hisnan(b)); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hgtu(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __COMPARISON_OP_HALF_MACRO(gtu) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return (fa > fb) || (__hisnan(a)) || (__hisnan(b)); +) +} +#undef __COMPARISON_OP_HALF_MACRO +/****************************************************************************** +* __half2 arithmetic * +******************************************************************************/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hadd2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF2_MACRO(add) +, + __half2 val; + val.x = __hadd(a.x, b.x); + val.y = __hadd(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hsub2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF2_MACRO(sub) +, + __half2 val; + val.x = __hsub(a.x, b.x); + val.y = __hsub(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmul2(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF2_MACRO(mul) +, + __half2 val; + val.x = __hmul(a.x, b.x); + val.y = __hmul(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hadd2_sat(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF2_MACRO(add.sat) +, + __half2 val; + val.x = __hadd_sat(a.x, b.x); + val.y = __hadd_sat(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hsub2_sat(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF2_MACRO(sub.sat) +, + __half2 val; + val.x = __hsub_sat(a.x, b.x); + val.y = __hsub_sat(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmul2_sat(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF2_MACRO(mul.sat) +, + __half2 val; + val.x = __hmul_sat(a.x, b.x); + val.y = __hmul_sat(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hadd2_rn(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF2_MACRO(add.rn) +, + __half2 val; + val.x = __hadd_rn(a.x, b.x); + val.y = __hadd_rn(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hsub2_rn(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF2_MACRO(sub.rn) +, + __half2 val; + val.x = __hsub_rn(a.x, b.x); + val.y = __hsub_rn(a.y, b.y); + return val; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmul2_rn(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF2_MACRO(mul.rn) +, + __half2 val; + val.x = __hmul_rn(a.x, b.x); + val.y = __hmul_rn(a.y, b.y); + return val; +) +} +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ __half2 __hfma2(const __half2 a, const __half2 b, const __half2 c) +{ + __TERNARY_OP_HALF2_MACRO(fma.rn) +} +__CUDA_FP16_DECL__ __half2 __hfma2_sat(const __half2 a, const __half2 b, const __half2 c) +{ + __TERNARY_OP_HALF2_MACRO(fma.rn.sat) +} +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __h2div(const __half2 a, const __half2 b) { + __half ha = __low2half(a); + __half hb = __low2half(b); + + const __half v1 = __hdiv(ha, hb); + + ha = __high2half(a); + hb = __high2half(b); + + const __half v2 = __hdiv(ha, hb); + + return __halves2half2(v1, v2); +} + +/****************************************************************************** +* __half arithmetic * +******************************************************************************/ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hadd(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF_MACRO(add) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return __float2half(fa + fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hsub(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF_MACRO(sub) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return __float2half(fa - fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmul(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF_MACRO(mul) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return __float2half(fa * fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hadd_sat(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF_MACRO(add.sat) +, + return __hmin(__hmax(__hadd(a, b), CUDART_ZERO_FP16), CUDART_ONE_FP16); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hsub_sat(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF_MACRO(sub.sat) +, + return __hmin(__hmax(__hsub(a, b), CUDART_ZERO_FP16), CUDART_ONE_FP16); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmul_sat(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF_MACRO(mul.sat) +, + return __hmin(__hmax(__hmul(a, b), CUDART_ZERO_FP16), CUDART_ONE_FP16); +) +} + +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hadd_rn(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF_MACRO(add.rn) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return __float2half(fa + fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hsub_rn(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF_MACRO(sub.rn) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return __float2half(fa - fb); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmul_rn(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __BINARY_OP_HALF_MACRO(mul.rn) +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return __float2half(fa * fb); +) +} +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ __half __hfma(const __half a, const __half b, const __half c) +{ + __TERNARY_OP_HALF_MACRO(fma.rn) +} +__CUDA_FP16_DECL__ __half __hfma_sat(const __half a, const __half b, const __half c) +{ + __TERNARY_OP_HALF_MACRO(fma.rn.sat) +} +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hdiv(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __half v; + __half abs; + __half den; + __HALF_TO_US(den) = 0x008FU; + + float rcp; + const float fa = __half2float(a); + const float fb = __half2float(b); + + asm("{rcp.approx.ftz.f32 %0, %1;\n}" :"=f"(rcp) : "f"(fb)); + + float fv = rcp * fa; + + v = __float2half(fv); + abs = __habs(v); + if (__hlt(abs, den) && __hlt(__float2half(0.0f), abs)) { + const float err = __fmaf_rn(-fb, fv, fa); + fv = __fmaf_rn(rcp, err, fv); + v = __float2half(fv); + } + return v; +, + const float fa = __half2float(a); + const float fb = __half2float(b); + return __float2half(fa / fb); +) +} + +/****************************************************************************** +* __half2 functions * +******************************************************************************/ +#if defined(_NVHPC_CUDA) || defined(__CUDACC__) +#define __APPROX_FCAST(fun) /* do */ {\ + __half val;\ + asm("{.reg.b32 f; \n"\ + " .reg.b16 r; \n"\ + " mov.b16 r,%1; \n"\ + " cvt.f32.f16 f,r; \n"\ + " " __CUDA_FP16_STRINGIFY(fun) ".approx.ftz.f32 f,f; \n"\ + " cvt.rn.f16.f32 r,f; \n"\ + " mov.b16 %0,r; \n"\ + "}": "=h"(__HALF_TO_US(val)) : "h"(__HALF_TO_CUS(a)));\ + return val;\ +} /* while(0) */ +#define __APPROX_FCAST2(fun) /* do */ {\ + __half2 val;\ + asm("{.reg.b16 hl, hu; \n"\ + " .reg.b32 fl, fu; \n"\ + " mov.b32 {hl, hu}, %1; \n"\ + " cvt.f32.f16 fl, hl; \n"\ + " cvt.f32.f16 fu, hu; \n"\ + " " __CUDA_FP16_STRINGIFY(fun) ".approx.ftz.f32 fl, fl; \n"\ + " " __CUDA_FP16_STRINGIFY(fun) ".approx.ftz.f32 fu, fu; \n"\ + " cvt.rn.f16.f32 hl, fl; \n"\ + " cvt.rn.f16.f32 hu, fu; \n"\ + " mov.b32 %0, {hl, hu}; \n"\ + "}":"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a))); \ + return val;\ +} /* while(0) */ +#if !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530) || defined(_NVHPC_CUDA) +#define __SPEC_CASE2(i,r, spc, ulp) \ + "{.reg.b32 spc, ulp, p;\n"\ + " mov.b32 spc," __CUDA_FP16_STRINGIFY(spc) ";\n"\ + " mov.b32 ulp," __CUDA_FP16_STRINGIFY(ulp) ";\n"\ + " set.eq.f16x2.f16x2 p," __CUDA_FP16_STRINGIFY(i) ", spc;\n"\ + " fma.rn.f16x2 " __CUDA_FP16_STRINGIFY(r) ",p,ulp," __CUDA_FP16_STRINGIFY(r) ";\n}\n" +#define __SPEC_CASE(i,r, spc, ulp) \ + "{.reg.b16 spc, ulp, p;\n"\ + " mov.b16 spc," __CUDA_FP16_STRINGIFY(spc) ";\n"\ + " mov.b16 ulp," __CUDA_FP16_STRINGIFY(ulp) ";\n"\ + " set.eq.f16.f16 p," __CUDA_FP16_STRINGIFY(i) ", spc;\n"\ + " fma.rn.f16 " __CUDA_FP16_STRINGIFY(r) ",p,ulp," __CUDA_FP16_STRINGIFY(r) ";\n}\n" +static __device__ __forceinline__ float __float_simpl_sinf(float a); +static __device__ __forceinline__ float __float_simpl_cosf(float a); +__CUDA_FP16_DECL__ __half hsin(const __half a) { + const float sl = __float_simpl_sinf(__half2float(a)); + __half r = __float2half_rn(sl); + asm("{\n\t" + " .reg.b16 i,r,t; \n\t" + " mov.b16 r, %0; \n\t" + " mov.b16 i, %1; \n\t" + " and.b16 t, r, 0x8000U; \n\t" + " abs.f16 r, r; \n\t" + " abs.f16 i, i; \n\t" + __SPEC_CASE(i, r, 0X32B3U, 0x0800U) + __SPEC_CASE(i, r, 0X5CB0U, 0x9000U) + " or.b16 r,r,t; \n\t" + " mov.b16 %0, r; \n" + "}\n" : "+h"(__HALF_TO_US(r)) : "h"(__HALF_TO_CUS(a))); + return r; +} +__CUDA_FP16_DECL__ __half2 h2sin(const __half2 a) { + const float sl = __float_simpl_sinf(__half2float(a.x)); + const float sh = __float_simpl_sinf(__half2float(a.y)); + __half2 r = __floats2half2_rn(sl, sh); + asm("{\n\t" + " .reg.b32 i,r,t; \n\t" + " mov.b32 r, %0; \n\t" + " mov.b32 i, %1; \n\t" + " and.b32 t, r, 0x80008000U; \n\t" + " abs.f16x2 r, r; \n\t" + " abs.f16x2 i, i; \n\t" + __SPEC_CASE2(i, r, 0X32B332B3U, 0x08000800U) + __SPEC_CASE2(i, r, 0X5CB05CB0U, 0x90009000U) + " or.b32 r, r, t; \n\t" + " mov.b32 %0, r; \n" + "}\n" : "+r"(__HALF2_TO_UI(r)) : "r"(__HALF2_TO_CUI(a))); + return r; +} +__CUDA_FP16_DECL__ __half hcos(const __half a) { + const float cl = __float_simpl_cosf(__half2float(a)); + __half r = __float2half_rn(cl); + asm("{\n\t" + " .reg.b16 i,r; \n\t" + " mov.b16 r, %0; \n\t" + " mov.b16 i, %1; \n\t" + " abs.f16 i, i; \n\t" + __SPEC_CASE(i, r, 0X2B7CU, 0x1000U) + " mov.b16 %0, r; \n" + "}\n" : "+h"(__HALF_TO_US(r)) : "h"(__HALF_TO_CUS(a))); + return r; +} +__CUDA_FP16_DECL__ __half2 h2cos(const __half2 a) { + const float cl = __float_simpl_cosf(__half2float(a.x)); + const float ch = __float_simpl_cosf(__half2float(a.y)); + __half2 r = __floats2half2_rn(cl, ch); + asm("{\n\t" + " .reg.b32 i,r; \n\t" + " mov.b32 r, %0; \n\t" + " mov.b32 i, %1; \n\t" + " abs.f16x2 i, i; \n\t" + __SPEC_CASE2(i, r, 0X2B7C2B7CU, 0x10001000U) + " mov.b32 %0, r; \n" + "}\n" : "+r"(__HALF2_TO_UI(r)) : "r"(__HALF2_TO_CUI(a))); + return r; +} +static __device__ __forceinline__ float __internal_trig_reduction_kernel(const float a, unsigned int *const quadrant) +{ + const float ar = __fmaf_rn(a, 0.636619772F, 12582912.0F); + const unsigned q = __float_as_uint(ar); + const float j = __fsub_rn(ar, 12582912.0F); + float t = __fmaf_rn(j, -1.5707962512969971e+000F, a); + t = __fmaf_rn(j, -7.5497894158615964e-008F, t); + *quadrant = q; + return t; +} +static __device__ __forceinline__ float __internal_sin_cos_kernel(const float x, const unsigned int i) +{ + float z; + const float x2 = x*x; + float a8; + float a6; + float a4; + float a2; + float a1; + float a0; + + if ((i & 1U) != 0U) { + // cos + a8 = 2.44331571e-5F; + a6 = -1.38873163e-3F; + a4 = 4.16666457e-2F; + a2 = -5.00000000e-1F; + a1 = x2; + a0 = 1.0F; + } + else { + // sin + a8 = -1.95152959e-4F; + a6 = 8.33216087e-3F; + a4 = -1.66666546e-1F; + a2 = 0.0F; + a1 = x; + a0 = x; + } + + z = __fmaf_rn(a8, x2, a6); + z = __fmaf_rn(z, x2, a4); + z = __fmaf_rn(z, x2, a2); + z = __fmaf_rn(z, a1, a0); + + if ((i & 2U) != 0U) { + z = -z; + } + return z; +} +static __device__ __forceinline__ float __float_simpl_sinf(float a) +{ + float z; + unsigned i; + a = __internal_trig_reduction_kernel(a, &i); + z = __internal_sin_cos_kernel(a, i); + return z; +} +static __device__ __forceinline__ float __float_simpl_cosf(float a) +{ + float z; + unsigned i; + a = __internal_trig_reduction_kernel(a, &i); + z = __internal_sin_cos_kernel(a, (i & 0x3U) + 1U); + return z; +} + +__CUDA_FP16_DECL__ __half hexp(const __half a) { + __half val; + asm("{.reg.b32 f, C, nZ; \n" + " .reg.b16 h,r; \n" + " mov.b16 h,%1; \n" + " cvt.f32.f16 f,h; \n" + " mov.b32 C, 0x3fb8aa3bU; \n" + " mov.b32 nZ, 0x80000000U;\n" + " fma.rn.f32 f,f,C,nZ; \n" + " ex2.approx.ftz.f32 f,f; \n" + " cvt.rn.f16.f32 r,f; \n" + __SPEC_CASE(h, r, 0X1F79U, 0x9400U) + __SPEC_CASE(h, r, 0X25CFU, 0x9400U) + __SPEC_CASE(h, r, 0XC13BU, 0x0400U) + __SPEC_CASE(h, r, 0XC1EFU, 0x0200U) + " mov.b16 %0,r; \n" + "}": "=h"(__HALF_TO_US(val)) : "h"(__HALF_TO_CUS(a))); + return val; +} +__CUDA_FP16_DECL__ __half2 h2exp(const __half2 a) { + __half2 val; + asm("{.reg.b16 hl, hu; \n" + " .reg.b32 h,r,fl,fu,C,nZ; \n" + " mov.b32 {hl, hu}, %1; \n" + " mov.b32 h, %1; \n" + " cvt.f32.f16 fl, hl; \n" + " cvt.f32.f16 fu, hu; \n" + " mov.b32 C, 0x3fb8aa3bU; \n" + " mov.b32 nZ, 0x80000000U;\n" + " fma.rn.f32 fl,fl,C,nZ; \n" + " fma.rn.f32 fu,fu,C,nZ; \n" + " ex2.approx.ftz.f32 fl, fl; \n" + " ex2.approx.ftz.f32 fu, fu; \n" + " cvt.rn.f16.f32 hl, fl; \n" + " cvt.rn.f16.f32 hu, fu; \n" + " mov.b32 r, {hl, hu}; \n" + __SPEC_CASE2(h, r, 0X1F791F79U, 0x94009400U) + __SPEC_CASE2(h, r, 0X25CF25CFU, 0x94009400U) + __SPEC_CASE2(h, r, 0XC13BC13BU, 0x04000400U) + __SPEC_CASE2(h, r, 0XC1EFC1EFU, 0x02000200U) + " mov.b32 %0, r; \n" + "}":"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a))); + return val; +} +#endif /* !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530) || defined(_NVHPC_CUDA) */ +__CUDA_FP16_DECL__ __half hexp2(const __half a) { + __half val; + asm("{.reg.b32 f, ULP; \n" + " .reg.b16 r; \n" + " mov.b16 r,%1; \n" + " cvt.f32.f16 f,r; \n" + " ex2.approx.ftz.f32 f,f; \n" + " mov.b32 ULP, 0x33800000U;\n" + " fma.rn.f32 f,f,ULP,f; \n" + " cvt.rn.f16.f32 r,f; \n" + " mov.b16 %0,r; \n" + "}": "=h"(__HALF_TO_US(val)) : "h"(__HALF_TO_CUS(a))); + return val; +} +__CUDA_FP16_DECL__ __half2 h2exp2(const __half2 a) { + __half2 val; + asm("{.reg.b16 hl, hu; \n" + " .reg.b32 fl, fu, ULP; \n" + " mov.b32 {hl, hu}, %1; \n" + " cvt.f32.f16 fl, hl; \n" + " cvt.f32.f16 fu, hu; \n" + " ex2.approx.ftz.f32 fl, fl; \n" + " ex2.approx.ftz.f32 fu, fu; \n" + " mov.b32 ULP, 0x33800000U;\n" + " fma.rn.f32 fl,fl,ULP,fl; \n" + " fma.rn.f32 fu,fu,ULP,fu; \n" + " cvt.rn.f16.f32 hl, fl; \n" + " cvt.rn.f16.f32 hu, fu; \n" + " mov.b32 %0, {hl, hu}; \n" + "}":"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a))); + return val; +} +#if !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ __half hexp10(const __half a) { + __half val; + asm("{.reg.b16 h,r; \n" + " .reg.b32 f, C, nZ; \n" + " mov.b16 h, %1; \n" + " cvt.f32.f16 f, h; \n" + " mov.b32 C, 0x40549A78U; \n" + " mov.b32 nZ, 0x80000000U;\n" + " fma.rn.f32 f,f,C,nZ; \n" + " ex2.approx.ftz.f32 f, f; \n" + " cvt.rn.f16.f32 r, f; \n" + __SPEC_CASE(h, r, 0x34DEU, 0x9800U) + __SPEC_CASE(h, r, 0x9766U, 0x9000U) + __SPEC_CASE(h, r, 0x9972U, 0x1000U) + __SPEC_CASE(h, r, 0xA5C4U, 0x1000U) + __SPEC_CASE(h, r, 0xBF0AU, 0x8100U) + " mov.b16 %0, r; \n" + "}":"=h"(__HALF_TO_US(val)) : "h"(__HALF_TO_CUS(a))); + return val; +} +__CUDA_FP16_DECL__ __half2 h2exp10(const __half2 a) { + __half2 val; + asm("{.reg.b16 hl, hu; \n" + " .reg.b32 h,r,fl,fu,C,nZ; \n" + " mov.b32 {hl, hu}, %1; \n" + " mov.b32 h, %1; \n" + " cvt.f32.f16 fl, hl; \n" + " cvt.f32.f16 fu, hu; \n" + " mov.b32 C, 0x40549A78U; \n" + " mov.b32 nZ, 0x80000000U;\n" + " fma.rn.f32 fl,fl,C,nZ; \n" + " fma.rn.f32 fu,fu,C,nZ; \n" + " ex2.approx.ftz.f32 fl, fl; \n" + " ex2.approx.ftz.f32 fu, fu; \n" + " cvt.rn.f16.f32 hl, fl; \n" + " cvt.rn.f16.f32 hu, fu; \n" + " mov.b32 r, {hl, hu}; \n" + __SPEC_CASE2(h, r, 0x34DE34DEU, 0x98009800U) + __SPEC_CASE2(h, r, 0x97669766U, 0x90009000U) + __SPEC_CASE2(h, r, 0x99729972U, 0x10001000U) + __SPEC_CASE2(h, r, 0xA5C4A5C4U, 0x10001000U) + __SPEC_CASE2(h, r, 0xBF0ABF0AU, 0x81008100U) + " mov.b32 %0, r; \n" + "}":"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a))); + return val; +} +__CUDA_FP16_DECL__ __half hlog2(const __half a) { + __half val; + asm("{.reg.b16 h, r; \n" + " .reg.b32 f; \n" + " mov.b16 h, %1; \n" + " cvt.f32.f16 f, h; \n" + " lg2.approx.ftz.f32 f, f; \n" + " cvt.rn.f16.f32 r, f; \n" + __SPEC_CASE(r, r, 0xA2E2U, 0x8080U) + __SPEC_CASE(r, r, 0xBF46U, 0x9400U) + " mov.b16 %0, r; \n" + "}":"=h"(__HALF_TO_US(val)) : "h"(__HALF_TO_CUS(a))); + return val; +} +__CUDA_FP16_DECL__ __half2 h2log2(const __half2 a) { + __half2 val; + asm("{.reg.b16 hl, hu; \n" + " .reg.b32 fl, fu, r, p; \n" + " mov.b32 {hl, hu}, %1; \n" + " cvt.f32.f16 fl, hl; \n" + " cvt.f32.f16 fu, hu; \n" + " lg2.approx.ftz.f32 fl, fl; \n" + " lg2.approx.ftz.f32 fu, fu; \n" + " cvt.rn.f16.f32 hl, fl; \n" + " cvt.rn.f16.f32 hu, fu; \n" + " mov.b32 r, {hl, hu}; \n" + __SPEC_CASE2(r, r, 0xA2E2A2E2U, 0x80808080U) + __SPEC_CASE2(r, r, 0xBF46BF46U, 0x94009400U) + " mov.b32 %0, r; \n" + "}":"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a))); + return val; +} +__CUDA_FP16_DECL__ __half hlog(const __half a) { + __half val; + asm("{.reg.b32 f, C; \n" + " .reg.b16 r,h; \n" + " mov.b16 h,%1; \n" + " cvt.f32.f16 f,h; \n" + " lg2.approx.ftz.f32 f,f; \n" + " mov.b32 C, 0x3f317218U; \n" + " mul.f32 f,f,C; \n" + " cvt.rn.f16.f32 r,f; \n" + __SPEC_CASE(h, r, 0X160DU, 0x9C00U) + __SPEC_CASE(h, r, 0X3BFEU, 0x8010U) + __SPEC_CASE(h, r, 0X3C0BU, 0x8080U) + __SPEC_CASE(h, r, 0X6051U, 0x1C00U) + " mov.b16 %0,r; \n" + "}": "=h"(__HALF_TO_US(val)) : "h"(__HALF_TO_CUS(a))); + return val; +} +__CUDA_FP16_DECL__ __half2 h2log(const __half2 a) { + __half2 val; + asm("{.reg.b16 hl, hu; \n" + " .reg.b32 r, fl, fu, C, h; \n" + " mov.b32 {hl, hu}, %1; \n" + " mov.b32 h, %1; \n" + " cvt.f32.f16 fl, hl; \n" + " cvt.f32.f16 fu, hu; \n" + " lg2.approx.ftz.f32 fl, fl; \n" + " lg2.approx.ftz.f32 fu, fu; \n" + " mov.b32 C, 0x3f317218U; \n" + " mul.f32 fl,fl,C; \n" + " mul.f32 fu,fu,C; \n" + " cvt.rn.f16.f32 hl, fl; \n" + " cvt.rn.f16.f32 hu, fu; \n" + " mov.b32 r, {hl, hu}; \n" + __SPEC_CASE2(h, r, 0X160D160DU, 0x9C009C00U) + __SPEC_CASE2(h, r, 0X3BFE3BFEU, 0x80108010U) + __SPEC_CASE2(h, r, 0X3C0B3C0BU, 0x80808080U) + __SPEC_CASE2(h, r, 0X60516051U, 0x1C001C00U) + " mov.b32 %0, r; \n" + "}":"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a))); + return val; +} +__CUDA_FP16_DECL__ __half hlog10(const __half a) { + __half val; + asm("{.reg.b16 h, r; \n" + " .reg.b32 f, C; \n" + " mov.b16 h, %1; \n" + " cvt.f32.f16 f, h; \n" + " lg2.approx.ftz.f32 f, f; \n" + " mov.b32 C, 0x3E9A209BU; \n" + " mul.f32 f,f,C; \n" + " cvt.rn.f16.f32 r, f; \n" + __SPEC_CASE(h, r, 0x338FU, 0x1000U) + __SPEC_CASE(h, r, 0x33F8U, 0x9000U) + __SPEC_CASE(h, r, 0x57E1U, 0x9800U) + __SPEC_CASE(h, r, 0x719DU, 0x9C00U) + " mov.b16 %0, r; \n" + "}":"=h"(__HALF_TO_US(val)) : "h"(__HALF_TO_CUS(a))); + return val; +} +__CUDA_FP16_DECL__ __half2 h2log10(const __half2 a) { + __half2 val; + asm("{.reg.b16 hl, hu; \n" + " .reg.b32 r, fl, fu, C, h; \n" + " mov.b32 {hl, hu}, %1; \n" + " mov.b32 h, %1; \n" + " cvt.f32.f16 fl, hl; \n" + " cvt.f32.f16 fu, hu; \n" + " lg2.approx.ftz.f32 fl, fl; \n" + " lg2.approx.ftz.f32 fu, fu; \n" + " mov.b32 C, 0x3E9A209BU; \n" + " mul.f32 fl,fl,C; \n" + " mul.f32 fu,fu,C; \n" + " cvt.rn.f16.f32 hl, fl; \n" + " cvt.rn.f16.f32 hu, fu; \n" + " mov.b32 r, {hl, hu}; \n" + __SPEC_CASE2(h, r, 0x338F338FU, 0x10001000U) + __SPEC_CASE2(h, r, 0x33F833F8U, 0x90009000U) + __SPEC_CASE2(h, r, 0x57E157E1U, 0x98009800U) + __SPEC_CASE2(h, r, 0x719D719DU, 0x9C009C00U) + " mov.b32 %0, r; \n" + "}":"=r"(__HALF2_TO_UI(val)) : "r"(__HALF2_TO_CUI(a))); + return val; +} +#undef __SPEC_CASE2 +#undef __SPEC_CASE +#endif /* !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530) || defined(_NVHPC_CUDA) */ +__CUDA_FP16_DECL__ __half2 h2rcp(const __half2 a) { + __APPROX_FCAST2(rcp) +} +__CUDA_FP16_DECL__ __half hrcp(const __half a) { + __APPROX_FCAST(rcp) +} +__CUDA_FP16_DECL__ __half2 h2rsqrt(const __half2 a) { + __APPROX_FCAST2(rsqrt) +} +__CUDA_FP16_DECL__ __half hrsqrt(const __half a) { + __APPROX_FCAST(rsqrt) +} +__CUDA_FP16_DECL__ __half2 h2sqrt(const __half2 a) { + __APPROX_FCAST2(sqrt) +} +__CUDA_FP16_DECL__ __half hsqrt(const __half a) { + __APPROX_FCAST(sqrt) +} +#undef __APPROX_FCAST +#undef __APPROX_FCAST2 +#endif /* defined(_NVHPC_CUDA) || defined(__CUDACC__) */ +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hisnan2(const __half2 a) +{ + __half2 r; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + asm("{set.nan.f16x2.f16x2 %0,%1,%2;\n}" + :"=r"(__HALF2_TO_UI(r)) : "r"(__HALF2_TO_CUI(a)), "r"(__HALF2_TO_CUI(a))); +, + __half2_raw val; + val.x = __hisnan(a.x) ? (unsigned short)0x3C00U : (unsigned short)0U; + val.y = __hisnan(a.y) ? (unsigned short)0x3C00U : (unsigned short)0U; + r = __half2(val); +) + return r; +} +__CUDA_HOSTDEVICE_FP16_DECL__ bool __hisnan(const __half a) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __half r; + asm("{set.nan.f16.f16 %0,%1,%2;\n}" + :"=h"(__HALF_TO_US(r)) : "h"(__HALF_TO_CUS(a)), "h"(__HALF_TO_CUS(a))); + return __HALF_TO_CUS(r) != 0U; +, + const __half_raw hr = static_cast<__half_raw>(a); + return ((hr.x & (unsigned short)0x7FFFU) > (unsigned short)0x7C00U); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hneg2(const __half2 a) +{ + __half2 r; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + asm("{neg.f16x2 %0,%1;\n}" + :"=r"(__HALF2_TO_UI(r)) : "r"(__HALF2_TO_CUI(a))); +, + r.x = __hneg(a.x); + r.y = __hneg(a.y); +) + return r; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hneg(const __half a) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __half r; + asm("{neg.f16 %0,%1;\n}" + :"=h"(__HALF_TO_US(r)) : "h"(__HALF_TO_CUS(a))); + return r; +, + const float fa = __half2float(a); + return __float2half(-fa); +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __habs2(const __half2 a) +{ + __half2 r; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + asm("{abs.f16x2 %0,%1;\n}" + :"=r"(__HALF2_TO_UI(r)) : "r"(__HALF2_TO_CUI(a))); +, + r.x = __habs(a.x); + r.y = __habs(a.y); +) + return r; +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __habs(const __half a) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_53, + __half r; + asm("{abs.f16 %0,%1;\n}" + :"=h"(__HALF_TO_US(r)) : "h"(__HALF_TO_CUS(a))); + return r; +, + __half_raw abs_a_raw = static_cast<__half_raw>(a); + abs_a_raw.x &= (unsigned short)0x7FFFU; + if (abs_a_raw.x > (unsigned short)0x7C00U) + { + // return canonical NaN + abs_a_raw.x = (unsigned short)0x7FFFU; + } + return static_cast<__half>(abs_a_raw); +) +} +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ __half2 __hcmadd(const __half2 a, const __half2 b, const __half2 c) +{ + // fast version of complex multiply-accumulate + // (a.re, a.im) * (b.re, b.im) + (c.re, c.im) + // acc.re = (c.re + a.re*b.re) - a.im*b.im + // acc.im = (c.im + a.re*b.im) + a.im*b.re + __half real_tmp = __hfma(a.x, b.x, c.x); + __half img_tmp = __hfma(a.x, b.y, c.y); + real_tmp = __hfma(__hneg(a.y), b.y, real_tmp); + img_tmp = __hfma(a.y, b.x, img_tmp); + return make_half2(real_tmp, img_tmp); +} +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ + +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmax_nan(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __BINARY_OP_HALF_MACRO(max.NaN) +, + __half maxval; + if (__hisnan(a) || __hisnan(b)) + { + maxval = CUDART_NAN_FP16; + } + else + { + maxval = __hmax(a, b); + } + return maxval; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half __hmin_nan(const __half a, const __half b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __BINARY_OP_HALF_MACRO(min.NaN) +, + __half minval; + if (__hisnan(a) || __hisnan(b)) + { + minval = CUDART_NAN_FP16; + } + else + { + minval = __hmin(a, b); + } + return minval; +) +} + +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ __half __hfma_relu(const __half a, const __half b, const __half c) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __TERNARY_OP_HALF_MACRO(fma.rn.relu) +, + return __hmax_nan(__hfma(a, b, c), CUDART_ZERO_FP16); +) +} +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ + +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmax2_nan(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __BINARY_OP_HALF2_MACRO(max.NaN) +, + __half2 result = __hmax2(a, b); + if (__hisnan(a.x) || __hisnan(b.x)) + { + result.x = CUDART_NAN_FP16; + } + if (__hisnan(a.y) || __hisnan(b.y)) + { + result.y = CUDART_NAN_FP16; + } + return result; +) +} +__CUDA_HOSTDEVICE_FP16_DECL__ __half2 __hmin2_nan(const __half2 a, const __half2 b) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __BINARY_OP_HALF2_MACRO(min.NaN) +, + __half2 result = __hmin2(a, b); + if (__hisnan(a.x) || __hisnan(b.x)) + { + result.x = CUDART_NAN_FP16; + } + if (__hisnan(a.y) || __hisnan(b.y)) + { + result.y = CUDART_NAN_FP16; + } + return result; +) +} +#if defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ __half2 __hfma2_relu(const __half2 a, const __half2 b, const __half2 c) +{ +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, + __TERNARY_OP_HALF2_MACRO(fma.rn.relu) +, + __half2_raw hzero; + hzero.x = (unsigned short)0U; + hzero.y = (unsigned short)0U; + return __hmax2_nan(__hfma2(a, b, c), __half2(hzero)); +) +} +#endif /* defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 530)) || defined(_NVHPC_CUDA) */ + +#if defined(__CUDACC__) || defined(_NVHPC_CUDA) +/* Define __PTR for atomicAdd prototypes below, undef after done */ +#if (defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) || defined(__CUDACC_RTC__) +#define __PTR "l" +#else +#define __PTR "r" +#endif /*(defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) || defined(__CUDACC_RTC__)*/ + +__CUDA_FP16_DECL__ __half2 atomicAdd(__half2 *const address, const __half2 val) { +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_60, + __half2 r; + asm volatile ("{ atom.add.noftz.f16x2 %0,[%1],%2; }\n" + : "=r"(__HALF2_TO_UI(r)) : __PTR(address), "r"(__HALF2_TO_CUI(val)) + : "memory"); + return r; +, + unsigned int* address_as_uint = (unsigned int*)address; + unsigned int old = *address_as_uint; + unsigned int assumed; + do { + assumed = old; + __half2 new_val = __hadd2(val, *(__half2*)&assumed); + old = atomicCAS(address_as_uint, assumed, *(unsigned int*)&new_val); + } while (assumed != old); + return *(__half2*)&old; +) +} + +#if (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 700))) || defined(_NVHPC_CUDA) +__CUDA_FP16_DECL__ __half atomicAdd(__half *const address, const __half val) { + __half r; + asm volatile ("{ atom.add.noftz.f16 %0,[%1],%2; }\n" + : "=h"(__HALF_TO_US(r)) + : __PTR(address), "h"(__HALF_TO_CUS(val)) + : "memory"); + return r; +} +#endif /* (defined(__CUDACC__) && (!defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 700))) || defined(_NVHPC_CUDA) */ + +#undef __PTR +#endif /* defined(__CUDACC__) || defined(_NVHPC_CUDA) */ +#endif /* defined(__cplusplus) */ + +#undef __TERNARY_OP_HALF2_MACRO +#undef __TERNARY_OP_HALF_MACRO +#undef __BINARY_OP_HALF2_MACRO +#undef __BINARY_OP_HALF_MACRO + +#undef __CUDA_HOSTDEVICE_FP16_DECL__ +#undef __CUDA_FP16_DECL__ + +#undef __HALF_TO_US +#undef __HALF_TO_CUS +#undef __HALF2_TO_UI +#undef __HALF2_TO_CUI +#undef __CUDA_FP16_CONSTEXPR__ + +#if defined(__CPP_VERSION_AT_LEAST_11_FP16) +#undef __CPP_VERSION_AT_LEAST_11_FP16 +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP16) */ + +#endif /* end of include guard: __CUDA_FP16_HPP__ */ diff --git a/cuda_toolkit/include/cuda_fp8.h b/cuda_toolkit/include/cuda_fp8.h new file mode 100644 index 0000000000000000000000000000000000000000..9861d1693796dde38ff083a620e13d00e0325e90 --- /dev/null +++ b/cuda_toolkit/include/cuda_fp8.h @@ -0,0 +1,367 @@ +/* + * Copyright 2022 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef __CUDA_FP8_H__ +#define __CUDA_FP8_H__ + +/* Set up function decorations */ +#if defined(__CUDACC__) +#define __CUDA_FP8_DECL__ static __device__ __inline__ +#define __CUDA_HOSTDEVICE_FP8__ __host__ __device__ +#define __CUDA_HOSTDEVICE_FP8_DECL__ static __host__ __device__ __inline__ +#else /* !defined(__CUDACC__) */ +#if defined(__GNUC__) +#define __CUDA_HOSTDEVICE_FP8_DECL__ static __attribute__((unused)) +#else +#define __CUDA_HOSTDEVICE_FP8_DECL__ static +#endif /* defined(__GNUC__) */ +#define __CUDA_HOSTDEVICE_FP8__ +#endif /* defined(__CUDACC_) */ + +#if !defined(_MSC_VER) && __cplusplus >= 201103L +#define __CPP_VERSION_AT_LEAST_11_FP8 +#elif _MSC_FULL_VER >= 190024210 && _MSVC_LANG >= 201103L +#define __CPP_VERSION_AT_LEAST_11_FP8 +#endif + +/* bring in __half_raw data type */ +#include "cuda_fp16.h" +/* bring in __nv_bfloat16_raw data type */ +#include "cuda_bf16.h" +/* bring in float2, double4, etc vector types */ +#include "vector_types.h" + +/** + * \defgroup CUDA_MATH_INTRINSIC_FP8 FP8 Intrinsics + * This section describes fp8 intrinsic functions. + * To use these functions, include the header file \p cuda_fp8.h in your + * program. + * The following macros are available to help users selectively enable/disable + * various definitions present in the header file: + * - \p __CUDA_NO_FP8_CONVERSIONS__ - If defined, this macro will prevent any + * use of the C++ type conversions (converting constructors and conversion + * operators) defined in the header. + * - \p __CUDA_NO_FP8_CONVERSION_OPERATORS__ - If defined, this macro will + * prevent any use of the C++ conversion operators from \p fp8 to other types. + */ + +/** + * \defgroup CUDA_MATH_FP8_MISC FP8 Conversion and Data Movement + * \ingroup CUDA_MATH_INTRINSIC_FP8 + * To use these functions, include the header file \p cuda_fp8.h in your + * program. + */ + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief 8-bit \p unsigned \p integer + * type abstraction used to for \p fp8 floating-point + * numbers storage. + */ +typedef unsigned char __nv_fp8_storage_t; + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief 16-bit \p unsigned \p integer + * type abstraction used to for storage of pairs of + * \p fp8 floating-point numbers. + */ +typedef unsigned short int __nv_fp8x2_storage_t; + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief 32-bit \p unsigned \p integer + * type abstraction used to for storage of tetrads of + * \p fp8 floating-point numbers. + */ +typedef unsigned int __nv_fp8x4_storage_t; + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Enumerates the modes applicable when + * performing a narrowing conversion to \p fp8 destination types. + */ +typedef enum __nv_saturation_t { + /** + * Means no saturation to finite is performed when conversion + * results in rounding values outside the range of destination + * type. + * NOTE: for fp8 type of e4m3 kind, the results that are larger + * than the maximum representable finite number of the target + * format become NaN. + */ + __NV_NOSAT, + /** + * Means input larger than the maximum representable + * finite number MAXNORM of the target format round to the + * MAXNORM of the same sign as input. + */ + __NV_SATFINITE, +} __nv_saturation_t; + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Enumerates the possible + * interpretations of the 8-bit values when referring to them as + * \p fp8 types. + */ +typedef enum __nv_fp8_interpretation_t { + __NV_E4M3, /**< Stands for \p fp8 numbers of \p e4m3 kind. */ + __NV_E5M2, /**< Stands for \p fp8 numbers of \p e5m2 kind. */ +} __nv_fp8_interpretation_t; + +/* Forward-declaration of C-style APIs */ + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Converts input \p double precision \p x to \p fp8 type of the + * requested kind using round-to-nearest-even rounding and requested saturation + * mode. + * + * \details Converts input \p x to \p fp8 type of the kind specified by + * \p fp8_interpretation parameter, + * using round-to-nearest-even rounding and + * saturation mode specified by \p saturate parameter. + * + * \returns + * - The \p __nv_fp8_storage_t value holds the result of conversion. + */ +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8_storage_t +__nv_cvt_double_to_fp8(const double x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation); + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Converts input vector of two \p double precision numbers packed + * in \p double2 \p x into a vector of two values of \p fp8 type of + * the requested kind using round-to-nearest-even rounding and requested + * saturation mode. + * + * \details Converts input vector \p x to a vector of two \p fp8 values of the + * kind specified by \p fp8_interpretation parameter, using + * round-to-nearest-even rounding and saturation mode specified by \p saturate + * parameter. + * + * \returns + * - The \p __nv_fp8x2_storage_t value holds the result of conversion. + */ +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8x2_storage_t +__nv_cvt_double2_to_fp8x2(const double2 x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation); + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Converts input \p single precision \p x to \p fp8 type of the + * requested kind using round-to-nearest-even rounding and requested saturation + * mode. + * + * \details Converts input \p x to \p fp8 type of the kind specified by + * \p fp8_interpretation parameter, + * using round-to-nearest-even rounding and + * saturation mode specified by \p saturate parameter. + * + * \returns + * - The \p __nv_fp8_storage_t value holds the result of conversion. + */ +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8_storage_t +__nv_cvt_float_to_fp8(const float x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation); + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Converts input vector of two \p single precision numbers packed + * in \p float2 \p x into a vector of two values of \p fp8 type of + * the requested kind using round-to-nearest-even rounding and requested + * saturation mode. + * + * \details Converts input vector \p x to a vector of two \p fp8 values of the + * kind specified by \p fp8_interpretation parameter, using + * round-to-nearest-even rounding and saturation mode specified by \p saturate + * parameter. + * + * \returns + * - The \p __nv_fp8x2_storage_t value holds the result of conversion. + */ +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8x2_storage_t +__nv_cvt_float2_to_fp8x2(const float2 x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation); + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Converts input \p half precision \p x to \p fp8 type of the requested + * kind using round-to-nearest-even rounding and requested saturation mode. + * + * \details Converts input \p x to \p fp8 type of the kind specified by + * \p fp8_interpretation parameter, + * using round-to-nearest-even rounding and + * saturation mode specified by \p saturate parameter. + * + * \returns + * - The \p __nv_fp8_storage_t value holds the result of conversion. + */ +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8_storage_t +__nv_cvt_halfraw_to_fp8(const __half_raw x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation); + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Converts input vector of two \p half precision numbers packed + * in \p __half2_raw \p x into a vector of two values of \p fp8 type of + * the requested kind using round-to-nearest-even rounding and requested + * saturation mode. + * + * \details Converts input vector \p x to a vector of two \p fp8 values of the + * kind specified by \p fp8_interpretation parameter, using + * round-to-nearest-even rounding and saturation mode specified by \p saturate + * parameter. + * + * \returns + * - The \p __nv_fp8x2_storage_t value holds the result of conversion. + */ +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8x2_storage_t __nv_cvt_halfraw2_to_fp8x2( + const __half2_raw x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation); + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Converts input \p nv_bfloat16 precision \p x to \p fp8 type of the + * requested kind using round-to-nearest-even rounding and requested saturation + * mode. + * + * \details Converts input \p x to \p fp8 type of the kind specified by + * \p fp8_interpretation parameter, + * using round-to-nearest-even rounding and + * saturation mode specified by \p saturate parameter. + * + * \returns + * - The \p __nv_fp8_storage_t value holds the result of conversion. + */ +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8_storage_t __nv_cvt_bfloat16raw_to_fp8( + const __nv_bfloat16_raw x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation); + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Converts input vector of two \p nv_bfloat16 precision numbers packed + * in \p __nv_bfloat162_raw \p x into a vector of two values of \p fp8 type of + * the requested kind using round-to-nearest-even rounding and requested + * saturation mode. + * + * \details Converts input vector \p x to a vector of two \p fp8 values of the + * kind specified by \p fp8_interpretation parameter, using + * round-to-nearest-even rounding and saturation mode specified by \p saturate + * parameter. + * + * \returns + * - The \p __nv_fp8x2_storage_t value holds the result of conversion. + */ +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8x2_storage_t +__nv_cvt_bfloat16raw2_to_fp8x2( + const __nv_bfloat162_raw x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation); + +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Converts input \p fp8 \p x of the specified kind + * to \p half precision. + * + * \details Converts input \p x of \p fp8 type of the kind specified by + * \p fp8_interpretation parameter + * to \p half precision. + * + * \returns + * - The \p __half_raw value holds the result of conversion. + */ +__CUDA_HOSTDEVICE_FP8_DECL__ __half_raw +__nv_cvt_fp8_to_halfraw(const __nv_fp8_storage_t x, + const __nv_fp8_interpretation_t fp8_interpretation); +/** + * \ingroup CUDA_MATH_FP8_MISC + * \brief Converts input vector of two \p fp8 values of the specified kind + * to a vector of two \p half precision values packed in \p __half2_raw + * structure. + * + * \details Converts input vector \p x of \p fp8 type of the kind specified by + * \p fp8_interpretation parameter + * to a vector of two \p half precision values and returns as \p __half2_raw + * structure. + * + * \returns + * - The \p __half2_raw value holds the result of conversion. + */ +__CUDA_HOSTDEVICE_FP8_DECL__ __half2_raw +__nv_cvt_fp8x2_to_halfraw2(const __nv_fp8x2_storage_t x, + const __nv_fp8_interpretation_t fp8_interpretation); + +#if defined(__cplusplus) + +#define __CUDA_FP8_TYPES_EXIST__ + +/* Forward-declaration of structures defined in "cuda_fp8.hpp" */ +struct __nv_fp8_e5m2; +struct __nv_fp8x2_e5m2; +struct __nv_fp8x4_e5m2; + +struct __nv_fp8_e4m3; +struct __nv_fp8x2_e4m3; +struct __nv_fp8x4_e4m3; + +#endif /* defined(__cplusplus) */ + +#include "cuda_fp8.hpp" + +#undef __CUDA_FP8_DECL__ +#undef __CUDA_HOSTDEVICE_FP8__ +#undef __CUDA_HOSTDEVICE_FP8_DECL__ + +#if defined(__CPP_VERSION_AT_LEAST_11_FP8) +#undef __CPP_VERSION_AT_LEAST_11_FP8 +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP8) */ + +#endif /* end of include guard: __CUDA_FP8_H__ */ diff --git a/cuda_toolkit/include/cuda_fp8.hpp b/cuda_toolkit/include/cuda_fp8.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8b3de89f58eb0b1700cabdbed18749cf908d37c0 --- /dev/null +++ b/cuda_toolkit/include/cuda_fp8.hpp @@ -0,0 +1,1750 @@ +/* + * Copyright 2022-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_FP8_HPP__) +#define __CUDA_FP8_HPP__ + +#if !defined(__CUDA_FP8_H__) +#error "Do not include this file directly. Instead, include cuda_fp8.h." +#endif + +/* C++ header for std::memcpy (used for type punning in host-side + * implementations). When compiling as a CUDA source file memcpy is provided + * implicitly. !defined(__CUDACC__) implies !defined(__CUDACC_RTC__). + */ +#if defined(__cplusplus) && !defined(__CUDACC__) +#include +#elif !defined(__cplusplus) && !defined(__CUDACC__) +#include +#endif /* defined(__cplusplus) && !defined(__CUDACC__) */ + +/* Set up structure-alignment attribute */ +#if !(defined __CUDA_ALIGN__) +#if defined(__CUDACC__) +#define __CUDA_ALIGN__(align) __align__(align) +#else +/* Define alignment macro based on compiler type (cannot assume C11 "_Alignas" + * is available) */ +#if __cplusplus >= 201103L +#define __CUDA_ALIGN__(n) \ + alignas(n) /* C++11 kindly gives us a keyword for this */ +#else /* !defined(__CPP_VERSION_AT_LEAST_11_FP8)*/ +#if defined(__GNUC__) +#define __CUDA_ALIGN__(n) __attribute__((aligned(n))) +#elif defined(_MSC_VER) +#define __CUDA_ALIGN__(n) __declspec(align(n)) +#else +#define __CUDA_ALIGN__(n) +#endif /* defined(__GNUC__) */ +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP8) */ +#endif /* defined(__CUDACC__) */ +#endif /* !(defined __CUDA_ALIGN__) */ + +#if !(defined __CPP_VERSION_AT_LEAST_11_FP8) +/* need c++11 for explicit operators */ +#define __CUDA_NO_FP8_CONVERSION_OPERATORS__ +#endif + +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8_storage_t +__nv_cvt_double_to_fp8(const double x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation) { + unsigned char res; + unsigned long long int xbits; + +#if defined(__CUDACC__) || (!defined __cplusplus) + (void)memcpy(&xbits, &x, sizeof(x)); +#else + (void)std::memcpy(&xbits, &x, sizeof(x)); +#endif + unsigned char FP8_MAXNORM; + unsigned char FP8_MANTISSA_MASK; + unsigned short int FP8_EXP_BIAS; + unsigned long long int FP8_SIGNIFICAND_BITS; + const unsigned long long int DP_INF_BITS = 0x7FF0000000000000ULL; + unsigned long long int FP8_MINDENORM_O2; + unsigned long long int FP8_OVERFLOW_THRESHOLD; + unsigned long long int FP8_MINNORM; + + if (fp8_interpretation == __NV_E4M3) { + FP8_EXP_BIAS = 7U; + FP8_SIGNIFICAND_BITS = 4ULL; + FP8_MANTISSA_MASK = 0x7U; + FP8_MINDENORM_O2 = 0x3F50000000000000ULL; // mindenorm/2 = 2^-10 + FP8_OVERFLOW_THRESHOLD = + 0x407D000000000000ULL; // maxnorm + 1/2ulp = 0x1.Cp+8 + 0x1p+4 + FP8_MAXNORM = 0x7EU; + FP8_MINNORM = 0x3F90000000000000ULL; // minnorm = 2^-6 + } else { //__NV_E5M2 + FP8_EXP_BIAS = 15U; + FP8_SIGNIFICAND_BITS = 3ULL; + FP8_MANTISSA_MASK = 0x3U; + FP8_MINDENORM_O2 = 0x3EE0000000000000ULL; // mindenorm/2 = 2^-17 + FP8_OVERFLOW_THRESHOLD = + 0x40EE000000000000ULL - + 1ULL; // maxnorm + 1/2ulp = 0x1.Ep+15, and -1 to have common code + FP8_MAXNORM = 0x7BU; + FP8_MINNORM = 0x3F10000000000000ULL; // minnorm = 2^-14 + } + + // 1/2 LSB of the target format, positioned in double precision mantissa + // helpful in midpoints detection during round-to-nearest-even step + const unsigned long long int FP8_DP_HALF_ULP = + (unsigned long long int)1ULL << (53ULL - FP8_SIGNIFICAND_BITS - 1ULL); + // prepare sign bit in target format + unsigned char sign = (unsigned char)((xbits >> 63ULL) << 7U); + // prepare exponent field in target format + unsigned char exp = + (unsigned char)((((unsigned short int)(xbits >> 52ULL)) & 0x7FFU) - + 1023U + FP8_EXP_BIAS); + // round mantissa to target format width, rounding towards zero + unsigned char mantissa = + (unsigned char)(xbits >> (53ULL - FP8_SIGNIFICAND_BITS)) & + FP8_MANTISSA_MASK; + unsigned long long int absx = xbits & 0x7FFFFFFFFFFFFFFFULL; + + if (absx <= FP8_MINDENORM_O2) { + // zero or underflow + res = 0U; + } else if (absx > DP_INF_BITS) { + // NaN + if (fp8_interpretation == __NV_E4M3) { + res = 0x7FU; + } else { + // NaN --> QNaN + res = 0x7EU | mantissa; + } + } else if (absx > FP8_OVERFLOW_THRESHOLD) { + if (saturate == __NV_SATFINITE) { + res = FP8_MAXNORM; + } else { + // __NV_NOSAT + if (fp8_interpretation == __NV_E4M3) { + // no Inf in E4M3 + res = 0x7FU; // NaN + } else { + res = 0x7CU; // Inf in E5M2 + } + } + } else if (absx >= FP8_MINNORM) { + res = (unsigned char)((exp << (FP8_SIGNIFICAND_BITS - 1U)) | mantissa); + // rounded-off bits + unsigned long long int round = + xbits & ((FP8_DP_HALF_ULP << 1ULL) - 1ULL); + // round-to-nearest-even adjustment + if ((round > FP8_DP_HALF_ULP) || + ((round == FP8_DP_HALF_ULP) && (mantissa & 1U))) { + res = (unsigned char)(res + 1U); + } + } else // Denormal range + { + unsigned char shift = (unsigned char)(1U - exp); + // add implicit leading bit + mantissa |= (unsigned char)(1U << (FP8_SIGNIFICAND_BITS - 1U)); + // additional round-off due to denormalization + res = (unsigned char)(mantissa >> shift); + + // rounded-off bits, including implicit leading bit + unsigned long long int round = + (xbits | ((unsigned long long int)1ULL << (53ULL - 1ULL))) & + ((FP8_DP_HALF_ULP << (shift + 1ULL)) - 1ULL); + // round-to-nearest-even adjustment + if ((round > (FP8_DP_HALF_ULP << shift)) || + ((round == (FP8_DP_HALF_ULP << shift)) && (res & 1U))) { + res = (unsigned char)(res + 1U); + } + } + + res |= sign; + + return (__nv_fp8_storage_t)res; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8x2_storage_t +__nv_cvt_double2_to_fp8x2(const double2 x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation) { + __nv_fp8x2_storage_t storage = (__nv_fp8x2_storage_t)__nv_cvt_double_to_fp8( + x.y, saturate, fp8_interpretation); + storage = (__nv_fp8x2_storage_t)(storage << 8U); + storage = (__nv_fp8x2_storage_t)(storage | + __nv_cvt_double_to_fp8( + x.x, saturate, fp8_interpretation)); + return storage; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8_storage_t +__nv_cvt_float_to_fp8(const float x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation) { + __nv_fp8_storage_t res = 0U; +#if (defined __CUDA_ARCH__) && (__CUDA_ARCH__ >= 890) + if (saturate == __NV_SATFINITE) { + __nv_fp8x2_storage_t storage; + if (fp8_interpretation == __NV_E5M2) { + asm("{cvt.rn.satfinite.e5m2x2.f32 %0, %2, %1;}\n" + : "=h"(storage) + : "f"(x), "f"(0.0f)); + } else { + asm("{cvt.rn.satfinite.e4m3x2.f32 %0, %2, %1;}\n" + : "=h"(storage) + : "f"(x), "f"(0.0f)); + } + res = (__nv_fp8_storage_t)storage; + } else +#endif + { + unsigned int xbits; +#if defined(__CUDACC__) || (!defined __cplusplus) + (void)memcpy(&xbits, &x, sizeof(x)); +#else + (void)std::memcpy(&xbits, &x, sizeof(x)); +#endif + + // isnan + if ((xbits & 0x7FFFFFFFU) > 0x7F800000U) { + // Canonical NaN + xbits = 0x7FFFFFFFU; + } + + float fx; +#if defined(__CUDACC__) || (!defined __cplusplus) + (void)memcpy(&fx, &xbits, sizeof(xbits)); +#else + (void)std::memcpy(&fx, &xbits, sizeof(xbits)); +#endif + + const double dx = (double)fx; + res = __nv_cvt_double_to_fp8(dx, saturate, fp8_interpretation); + } + return res; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8x2_storage_t +__nv_cvt_float2_to_fp8x2(const float2 x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation) { + __nv_fp8x2_storage_t storage; +#if (defined __CUDA_ARCH__) && (__CUDA_ARCH__ >= 890) + if (saturate == __NV_SATFINITE) { + if (fp8_interpretation == __NV_E5M2) { + asm("{cvt.rn.satfinite.e5m2x2.f32 %0, %2, %1;}\n" + : "=h"(storage) + : "f"(x.x), "f"(x.y)); + } else { + asm("{cvt.rn.satfinite.e4m3x2.f32 %0, %2, %1;}\n" + : "=h"(storage) + : "f"(x.x), "f"(x.y)); + } + } else +#endif + { + storage = (__nv_fp8x2_storage_t)__nv_cvt_float_to_fp8( + x.y, saturate, fp8_interpretation); + storage = (__nv_fp8x2_storage_t)(storage << 8U); + storage = (__nv_fp8x2_storage_t)(storage | __nv_cvt_float_to_fp8( + x.x, saturate, + fp8_interpretation)); + } + return storage; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ float +__internal_halfraw_to_float(const __half_raw x) { + float f; +#if (defined __CUDA_ARCH__) && (__CUDA_ARCH__ >= 530) + asm("{cvt.f32.f16 %0, %1;}\n" : "=f"(f) : "h"(x.x)); +#else + const unsigned int ux = (unsigned int)x.x; + unsigned int sign = (ux >> 15U) & 1U; + unsigned int exponent = (ux >> 10U) & 0x1fU; + unsigned int mantissa = (ux & 0x3ffU) << 13U; + if (exponent == 0x1fU) { /* NaN or Inf */ + /* discard sign of a NaN */ + sign = ((mantissa != 0U) ? (sign >> 1U) : sign); + mantissa = ((mantissa != 0U) ? 0x7fffffU : 0U); + exponent = 0xffU; + } else if (exponent == 0U) { /* Denorm or Zero */ + if (mantissa != 0U) { + unsigned int msb; + exponent = 0x71U; + do { + msb = (mantissa & 0x400000U); + mantissa <<= 1U; /* normalize */ + --exponent; + } while (msb == 0U); + mantissa &= 0x7fffffU; /* 1.mantissa is implicit */ + } + } else { + exponent += 0x70U; + } + const unsigned int u = ((sign << 31U) | (exponent << 23U) | mantissa); +#if defined(__CUDACC__) || (!defined __cplusplus) + (void)memcpy(&f, &u, sizeof(u)); +#else + (void)std::memcpy(&f, &u, sizeof(u)); +#endif +#endif /* (defined __CUDA_ARCH__) && (__CUDA_ARCH__ >= 530) */ + return f; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ float2 +__internal_halfraw2_to_float2(const __half2_raw x) { + __half_raw raw; + float2 res; + raw.x = x.x; + res.x = __internal_halfraw_to_float(raw); + raw.x = x.y; + res.y = __internal_halfraw_to_float(raw); + return res; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8_storage_t +__nv_cvt_halfraw_to_fp8(const __half_raw x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation) { + __nv_fp8_storage_t res = 0U; +#if (defined __CUDA_ARCH__) && (__CUDA_ARCH__ >= 890) + if (saturate == __NV_SATFINITE) { + unsigned int half2_storage = (unsigned int)(x.x); + __nv_fp8x2_storage_t tmp; + if (fp8_interpretation == __NV_E5M2) { + asm("{cvt.rn.satfinite.e5m2x2.f16x2 %0, %1;}\n" + : "=h"(tmp) + : "r"(half2_storage)); + } else { + asm("{cvt.rn.satfinite.e4m3x2.f16x2 %0, %1;}\n" + : "=h"(tmp) + : "r"(half2_storage)); + } + res = (__nv_fp8_storage_t)tmp; + } else +#endif + { + float fx = __internal_halfraw_to_float(x); + res = __nv_cvt_float_to_fp8(fx, saturate, fp8_interpretation); + } + return res; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8x2_storage_t __nv_cvt_halfraw2_to_fp8x2( + const __half2_raw x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation) { + __nv_fp8x2_storage_t tmp; +#if (defined __CUDA_ARCH__) && (__CUDA_ARCH__ >= 890) + if (saturate == __NV_SATFINITE) { + unsigned int half2_storage; + (void)memcpy(&half2_storage, &x, sizeof(x)); + + if (fp8_interpretation == __NV_E5M2) { + asm("{cvt.rn.satfinite.e5m2x2.f16x2 %0, %1;}\n" + : "=h"(tmp) + : "r"(half2_storage)); + } else { + asm("{cvt.rn.satfinite.e4m3x2.f16x2 %0, %1;}\n" + : "=h"(tmp) + : "r"(half2_storage)); + } + } else +#endif + { + __half_raw raw; + raw.x = x.x; + __nv_fp8_storage_t lo = + __nv_cvt_halfraw_to_fp8(raw, saturate, fp8_interpretation); + raw.x = x.y; + __nv_fp8_storage_t hi = + __nv_cvt_halfraw_to_fp8(raw, saturate, fp8_interpretation); + tmp = hi; + tmp = (__nv_fp8x2_storage_t)(tmp << 8U); + tmp = (__nv_fp8x2_storage_t)(tmp | lo); + } + return tmp; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ float +__internal_bf16raw_to_float(const __nv_bfloat16_raw x) { + const unsigned int ux = ((unsigned int)x.x) << 16U; + float fx; +#if defined(__CUDACC__) || (!defined __cplusplus) + (void)memcpy(&fx, &ux, sizeof(ux)); +#else + (void)std::memcpy(&fx, &ux, sizeof(ux)); +#endif + return fx; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_bfloat16_raw +__internal_float_to_bf16raw_rz(const float x) { + unsigned int ux; + __nv_bfloat16_raw r; +#if defined(__CUDACC__) || (!defined __cplusplus) + (void)memcpy(&ux, &x, sizeof(x)); +#else + (void)std::memcpy(&ux, &x, sizeof(x)); +#endif + r.x = (unsigned short int)(ux >> 16U); + return r; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8_storage_t __nv_cvt_bfloat16raw_to_fp8( + const __nv_bfloat16_raw x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation) { + const float fx = __internal_bf16raw_to_float(x); + const __nv_fp8_storage_t res = + __nv_cvt_float_to_fp8(fx, saturate, fp8_interpretation); + return res; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ __nv_fp8x2_storage_t +__nv_cvt_bfloat16raw2_to_fp8x2( + const __nv_bfloat162_raw x, const __nv_saturation_t saturate, + const __nv_fp8_interpretation_t fp8_interpretation) { + __nv_bfloat16_raw raw; + raw.x = x.y; + __nv_fp8x2_storage_t storage = + (__nv_fp8x2_storage_t)__nv_cvt_bfloat16raw_to_fp8(raw, saturate, + fp8_interpretation); + storage = (__nv_fp8x2_storage_t)(storage << 8U); + raw.x = x.x; + storage = (__nv_fp8x2_storage_t)(storage | + __nv_cvt_bfloat16raw_to_fp8( + raw, saturate, fp8_interpretation)); + return storage; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ __half2_raw +__nv_cvt_fp8x2_to_halfraw2(const __nv_fp8x2_storage_t x, + const __nv_fp8_interpretation_t fp8_interpretation); +__CUDA_HOSTDEVICE_FP8_DECL__ __half_raw +__nv_cvt_fp8_to_halfraw(const __nv_fp8_storage_t x, + const __nv_fp8_interpretation_t fp8_interpretation) { + __half_raw res; + res.x = 0U; +#if (defined __CUDA_ARCH__) && (__CUDA_ARCH__ >= 890) + res.x = + __nv_cvt_fp8x2_to_halfraw2((__nv_fp8x2_storage_t)x, fp8_interpretation) + .x; +#else + unsigned short int ur = (unsigned short int)x; + ur = (unsigned short int)(ur << 8U); + + if (fp8_interpretation == __NV_E5M2) { + if ((ur & 0x7FFFU) > 0x7C00U) { + /* If NaN, return canonical NaN */ + ur = 0x7FFFU; + } + } else { // __NV_E4M3 + unsigned short int sign = ur & 0x8000U; + unsigned short int exponent = + (unsigned short int)(((ur & 0x7800U) >> 1U) + 0x2000U); + unsigned short int mantissa = (ur & 0x0700U) >> 1U; + unsigned char absx = 0x7FU & (unsigned char)x; + + if (absx == 0x7FU) // NaN + { + ur = 0x7FFFU; // fp16 canonical NaN, discard sign + } else if (exponent == 0x2000U) { + // zero or denormal + if (mantissa != 0U) { + // normalize + mantissa = (unsigned short int)(mantissa << 1U); + while ((mantissa & 0x0400U) == 0U) { + mantissa = (unsigned short int)(mantissa << 1U); + exponent = (unsigned short int)(exponent - 0x0400U); + } + // discard implicit leading bit + mantissa &= 0x03FFU; + } else { // Zero + exponent = 0U; + } + + ur = (sign | exponent) | mantissa; + } else { + ur = (sign | exponent) | mantissa; + } + } + res.x = ur; +#endif + return res; +} + +__CUDA_HOSTDEVICE_FP8_DECL__ __half2_raw +__nv_cvt_fp8x2_to_halfraw2(const __nv_fp8x2_storage_t x, + const __nv_fp8_interpretation_t fp8_interpretation) { + __half2_raw res; +#if (defined __CUDA_ARCH__) && (__CUDA_ARCH__ >= 890) + unsigned int half2_storage; + if (fp8_interpretation == __NV_E5M2) { + asm("{cvt.rn.f16x2.e5m2x2 %0, %1;}\n" : "=r"(half2_storage) : "h"(x)); + } else { + asm("{cvt.rn.f16x2.e4m3x2 %0, %1;}\n" : "=r"(half2_storage) : "h"(x)); + } + (void)memcpy(&res, &half2_storage, sizeof(half2_storage)); +#else + res.x = + __nv_cvt_fp8_to_halfraw((__nv_fp8_storage_t)x, fp8_interpretation).x; + res.y = __nv_cvt_fp8_to_halfraw((__nv_fp8_storage_t)(x >> 8U), + fp8_interpretation) + .x; +#endif + return res; +} + +/* All other definitions in this file are only visible to C++ compilers */ +#if defined(__cplusplus) + +/** + * \defgroup CUDA_MATH_FP8_E5M2_STRUCT C++ struct for handling fp8 data type of e5m2 kind. + * \ingroup CUDA_MATH_INTRINSIC_FP8 + */ + +/** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * \brief __nv_fp8_e5m2 datatype + * + * \details This structure implements the datatype for handling + * \p fp8 floating-point numbers of \p e5m2 kind: + * with 1 sign, 5 exponent, 1 implicit and 2 explicit mantissa bits. + * + * The structure implements converting constructors and operators. + */ +struct __CUDA_ALIGN__(1) __nv_fp8_e5m2 { + public: + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Storage variable contains the \p fp8 floating-point data. + */ + __nv_fp8_storage_t __x; + + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor by default. + */ +#if defined(__CPP_VERSION_AT_LEAST_11_FP8) + __nv_fp8_e5m2() = default; +#else + __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2() {} +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP8) */ + +#if !defined(__CUDA_NO_FP8_CONVERSIONS__) + + /* Construct from wider FP types */ + /* Note we do avoid constructor init-list because of special host/device + * compilation rules */ + + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p __half data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2(const __half f) { + __x = __nv_cvt_halfraw_to_fp8(static_cast<__half_raw>(f), + __NV_SATFINITE, __NV_E5M2); + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p __nv_bfloat16 data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2(const __nv_bfloat16 f) { + __x = __nv_cvt_bfloat16raw_to_fp8(static_cast<__nv_bfloat16_raw>(f), + __NV_SATFINITE, __NV_E5M2); + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p float data type, relies on \p __NV_SATFINITE behavior + * for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2(const float f) { + __x = __nv_cvt_float_to_fp8(f, __NV_SATFINITE, __NV_E5M2); + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p double data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2(const double f) { + __x = __nv_cvt_double_to_fp8(f, __NV_SATFINITE, __NV_E5M2); + } + + /* Converts from integral */ + + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p unsigned \p short \p int data type, relies on \p + * __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ + __nv_fp8_e5m2(const unsigned short int val) { + __x = static_cast<__nv_fp8_e5m2>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p unsigned \p int data type, relies on \p + * __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2(const unsigned int val) { + __x = static_cast<__nv_fp8_e5m2>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p unsigned \p long \p int data type, relies on \p + * __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2(const unsigned long int val) { + __x = static_cast<__nv_fp8_e5m2>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p unsigned \p long \p long \p int data type, relies on + * \p __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ + __nv_fp8_e5m2(const unsigned long long int val) { + __x = static_cast<__nv_fp8_e5m2>(static_cast(val)).__x; + } + + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p short \p int data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2(const short int val) { + __x = static_cast<__nv_fp8_e5m2>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p int data type, relies on \p __NV_SATFINITE behavior + * for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2(const int val) { + __x = static_cast<__nv_fp8_e5m2>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p long \p int data type, relies on \p __NV_SATFINITE behavior + * for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2(const long int val) { + __x = static_cast<__nv_fp8_e5m2>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Constructor from \p long \p long \p int data type, relies on \p + * __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e5m2(const long long int val) { + __x = static_cast<__nv_fp8_e5m2>(static_cast(val)).__x; + } + +#if !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) + /* Widening FP converts */ + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p __half data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator __half() const { + return static_cast<__half>(__nv_cvt_fp8_to_halfraw(__x, __NV_E5M2)); + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p float data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator float() const { + return __internal_halfraw_to_float( + __nv_cvt_fp8_to_halfraw(__x, __NV_E5M2)); + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p __nv_bfloat16 data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator __nv_bfloat16() const { + return static_cast<__nv_bfloat16>( + __internal_float_to_bf16raw_rz(float(*this))); + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p double data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator double() const { + return static_cast(float(*this)); + } + + /* Convert to integral */ + + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p unsigned \p char data type. + * Clamps negative and too large inputs to the output range. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator unsigned char() const { + unsigned char i; + const float f = float(*this); + const unsigned char max_val = 0xFFU; + const unsigned char min_val = 0U; + const unsigned char bits = (*this).__x; + // saturation fixup + if ((bits & 0x7FU) > 0x7CU) { + // NaN + i = 0; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value + i = static_cast(f); + } + return i; + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p unsigned \p short \p int data type. + * Clamps negative and too large inputs to the output range. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator unsigned short int() const { + return __half2ushort_rz(__half(*this)); + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p unsigned \p int data type. + * Clamps negative and too large inputs to the output range. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator unsigned int() const { + return __half2uint_rz(__half(*this)); + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p unsigned \p long \p int data type. + * Clamps negative and too large inputs to the output range. + * \p NaN inputs convert to \p zero if output type is 32-bit. + * \p NaN inputs convert to \p 0x8000000000000000ULL if output type is 64-bit. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator unsigned long int() const { + unsigned long retval; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(unsigned long) == sizeof(unsigned long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + retval = static_cast(__half2ull_rz(__half(*this))); + } + else + { + retval = static_cast(__half2uint_rz(__half(*this))); + } + return retval; + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p unsigned \p long \p long \p int data type. + * Clamps negative and too large inputs to the output range. + * \p NaN inputs convert to \p 0x8000000000000000ULL. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator unsigned long long int() const { + return __half2ull_rz(__half(*this)); + } + + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p signed \p char data type. + * Clamps too large inputs to the output range. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator signed char() const { + signed char i; + const float f = float(*this); + const signed char max_val = (signed char)0x7FU; + const signed char min_val = (signed char)0x80U; + const unsigned char bits = (*this).__x; + // saturation fixup + if ((bits & 0x7FU) > 0x7CU) { + // NaN + i = 0; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value + i = static_cast(f); + } + return i; + } + + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to an implementation defined \p char data type. + * + * Detects signedness of the \p char type and proceeds accordingly, see + * further details in signed and unsigned char operators. + + * Clamps inputs to the output range. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator char() const { + char value; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (((char)-1) < (char)0) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + value = static_cast(static_cast(*this)); + } + else + { + value = static_cast(static_cast(*this)); + } + return value; + } + + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p short \p int data type. + * Clamps too large inputs to the output range. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator short int() const { + return __half2short_rz(__half(*this)); + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p int data type. + * Clamps too large inputs to the output range. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator int() const { + return __half2int_rz(__half(*this)); + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p long \p int data type. + * Clamps too large inputs to the output range. + * \p NaN inputs convert to \p zero if output type is 32-bit. + * \p NaN inputs convert to \p 0x8000000000000000ULL if output type is 64-bit. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator long int() const { + long retval; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(long) == sizeof(long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + retval = static_cast(__half2ll_rz(__half(*this))); + } + else + { + retval = static_cast(__half2int_rz(__half(*this))); + } + return retval; + } + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p long \p long \p int data type. + * Clamps too large inputs to the output range. + * \p NaN inputs convert to \p 0x8000000000000000LL. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator long long int() const { + return __half2ll_rz(__half(*this)); + } + + /** + * \ingroup CUDA_MATH_FP8_E5M2_STRUCT + * Conversion operator to \p bool data type. + * +0 and -0 inputs convert to \p false. + * Non-zero inputs convert to \p true. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator bool() const { + return (__x & 0x7FU) != 0U; + } +#endif /* !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) */ +#endif /* !defined(__CUDA_NO_FP8_CONVERSIONS__) */ +}; + +/** + * \defgroup CUDA_MATH_FP8X2_E5M2_STRUCT C++ struct for handling vector type of two fp8 values of e5m2 kind. + * \ingroup CUDA_MATH_INTRINSIC_FP8 + */ + +/** + * \ingroup CUDA_MATH_FP8X2_E5M2_STRUCT + * \brief __nv_fp8x2_e5m2 datatype + * + * \details This structure implements the datatype for handling two + * \p fp8 floating-point numbers of \p e5m2 kind each: + * with 1 sign, 5 exponent, 1 implicit and 2 explicit mantissa bits. + * + * The structure implements converting constructors and operators. + */ +struct __CUDA_ALIGN__(2) __nv_fp8x2_e5m2 { + public: + /** + * \ingroup CUDA_MATH_FP8X2_E5M2_STRUCT + * Storage variable contains the vector of two \p fp8 floating-point data + * values. + */ + __nv_fp8x2_storage_t __x; + + /** + * \ingroup CUDA_MATH_FP8X2_E5M2_STRUCT + * Constructor by default. + */ +#if defined(__CPP_VERSION_AT_LEAST_11_FP8) + __nv_fp8x2_e5m2() = default; +#else + __CUDA_HOSTDEVICE_FP8__ __nv_fp8x2_e5m2() {} +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP8) */ + +#if !defined(__CUDA_NO_FP8_CONVERSIONS__) + + /* Construct from wider types */ + + /** + * \ingroup CUDA_MATH_FP8X2_E5M2_STRUCT + * Constructor from \p __half2 data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x2_e5m2(const __half2 f) { + __x = __nv_cvt_halfraw2_to_fp8x2(static_cast<__half2_raw>(f), + __NV_SATFINITE, __NV_E5M2); + } + /** + * \ingroup CUDA_MATH_FP8X2_E5M2_STRUCT + * Constructor from \p __nv_bfloat162 data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x2_e5m2(const __nv_bfloat162 f) { + __x = __nv_cvt_bfloat16raw2_to_fp8x2(static_cast<__nv_bfloat162_raw>(f), + __NV_SATFINITE, __NV_E5M2); + } + /** + * \ingroup CUDA_MATH_FP8X2_E5M2_STRUCT + * Constructor from \p float2 data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x2_e5m2(const float2 f) { + __x = __nv_cvt_float2_to_fp8x2(f, __NV_SATFINITE, __NV_E5M2); + } + /** + * \ingroup CUDA_MATH_FP8X2_E5M2_STRUCT + * Constructor from \p double2 data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x2_e5m2(const double2 f) { + __x = __nv_cvt_double2_to_fp8x2(f, __NV_SATFINITE, __NV_E5M2); + } + +#if !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) + /* Widening converts */ + /** + * \ingroup CUDA_MATH_FP8X2_E5M2_STRUCT + * Conversion operator to \p __half2 data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator __half2() const { + return static_cast<__half2>(__nv_cvt_fp8x2_to_halfraw2(__x, __NV_E5M2)); + } + /** + * \ingroup CUDA_MATH_FP8X2_E5M2_STRUCT + * Conversion operator to \p float2 data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator float2() const { + return __internal_halfraw2_to_float2( + __nv_cvt_fp8x2_to_halfraw2(__x, __NV_E5M2)); + } +#endif /* !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) */ +#endif /* !defined(__CUDA_NO_FP8_CONVERSIONS__) */ +}; + +__CUDA_HOSTDEVICE_FP8_DECL__ unsigned int +__internal_pack_u16x2_to_u32(const unsigned short int src_lo, + const unsigned short int src_hi) { + unsigned int dst; +#if (defined __CUDACC__) && (defined __CUDA_ARCH__) + asm("{ mov.b32 %0, {%1,%2};}\n" : "=r"(dst) : "h"(src_lo), "h"(src_hi)); +#else + dst = (static_cast(src_hi) << 16U) | + static_cast(src_lo); +#endif + return dst; +} + +/** + * \defgroup CUDA_MATH_FP8X4_E5M2_STRUCT C++ struct for handling vector type of four fp8 values of e5m2 kind. + * \ingroup CUDA_MATH_INTRINSIC_FP8 + */ + +/** + * \ingroup CUDA_MATH_FP8X4_E5M2_STRUCT + * \brief __nv_fp8x4_e5m2 datatype + * + * \details This structure implements the datatype for handling four + * \p fp8 floating-point numbers of \p e5m2 kind each: + * with 1 sign, 5 exponent, 1 implicit and 2 explicit mantissa bits. + * + * The structure implements converting constructors and operators. + */ +struct __CUDA_ALIGN__(4) __nv_fp8x4_e5m2 { + public: + /** + * \ingroup CUDA_MATH_FP8X4_E5M2_STRUCT + * Storage variable contains the vector of four \p fp8 floating-point data + * values. + */ + __nv_fp8x4_storage_t __x; + + /** + * \ingroup CUDA_MATH_FP8X4_E5M2_STRUCT + * Constructor by default. + */ +#if defined(__CPP_VERSION_AT_LEAST_11_FP8) + __nv_fp8x4_e5m2() = default; +#else + __CUDA_HOSTDEVICE_FP8__ __nv_fp8x4_e5m2() {} +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP8) */ + +#if !defined(__CUDA_NO_FP8_CONVERSIONS__) + + /* Construct from wider types */ + + /** + * \ingroup CUDA_MATH_FP8X4_E5M2_STRUCT + * Constructor from a pair of \p __half2 data type values, + * relies on \p __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x4_e5m2(const __half2 flo, + const __half2 fhi) { + const __nv_fp8x2_storage_t rlo = __nv_cvt_halfraw2_to_fp8x2( + static_cast<__half2_raw>(flo), __NV_SATFINITE, __NV_E5M2); + const __nv_fp8x2_storage_t rhi = __nv_cvt_halfraw2_to_fp8x2( + static_cast<__half2_raw>(fhi), __NV_SATFINITE, __NV_E5M2); + __x = __internal_pack_u16x2_to_u32(rlo, rhi); + } + /** + * \ingroup CUDA_MATH_FP8X4_E5M2_STRUCT + * Constructor from a pair of \p __nv_bfloat162 data type values, + * relies on \p __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x4_e5m2(const __nv_bfloat162 flo, + const __nv_bfloat162 fhi) { + const __nv_fp8x2_storage_t rlo = __nv_cvt_bfloat16raw2_to_fp8x2( + static_cast<__nv_bfloat162_raw>(flo), __NV_SATFINITE, __NV_E5M2); + const __nv_fp8x2_storage_t rhi = __nv_cvt_bfloat16raw2_to_fp8x2( + static_cast<__nv_bfloat162_raw>(fhi), __NV_SATFINITE, __NV_E5M2); + __x = __internal_pack_u16x2_to_u32(rlo, rhi); + } + /** + * \ingroup CUDA_MATH_FP8X4_E5M2_STRUCT + * Constructor from \p float4 vector data type, + * relies on \p __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x4_e5m2(const float4 f) { + const float2 flo = {f.x, f.y}; + const float2 fhi = {f.z, f.w}; + const __nv_fp8x2_storage_t rlo = + __nv_cvt_float2_to_fp8x2(flo, __NV_SATFINITE, __NV_E5M2); + const __nv_fp8x2_storage_t rhi = + __nv_cvt_float2_to_fp8x2(fhi, __NV_SATFINITE, __NV_E5M2); + __x = __internal_pack_u16x2_to_u32(rlo, rhi); + } + /** + * \ingroup CUDA_MATH_FP8X4_E5M2_STRUCT + * Constructor from \p double4 vector data type, + * relies on \p __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x4_e5m2(const double4 f) { + const double2 flo = {f.x, f.y}; + const double2 fhi = {f.z, f.w}; + const __nv_fp8x2_storage_t rlo = + __nv_cvt_double2_to_fp8x2(flo, __NV_SATFINITE, __NV_E5M2); + const __nv_fp8x2_storage_t rhi = + __nv_cvt_double2_to_fp8x2(fhi, __NV_SATFINITE, __NV_E5M2); + __x = __internal_pack_u16x2_to_u32(rlo, rhi); + } + +#if !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) + /* Widening converts */ + + /** + * \ingroup CUDA_MATH_FP8X4_E5M2_STRUCT + * Conversion operator to \p float4 vector data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator float4() const { + const __nv_fp8x2_storage_t slo = static_cast<__nv_fp8x2_storage_t>(__x); + const __nv_fp8x2_storage_t shi = + static_cast<__nv_fp8x2_storage_t>(__x >> 16U); + float2 rlo = __internal_halfraw2_to_float2( + __nv_cvt_fp8x2_to_halfraw2(slo, __NV_E5M2)); + float2 rhi = __internal_halfraw2_to_float2( + __nv_cvt_fp8x2_to_halfraw2(shi, __NV_E5M2)); + float4 res = {rlo.x, rlo.y, rhi.x, rhi.y}; + return res; + } +#endif /* !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) */ +#endif /* !defined(__CUDA_NO_FP8_CONVERSIONS__) */ +}; + +/** + * \defgroup CUDA_MATH_FP8_E4M3_STRUCT C++ struct for handling fp8 data type of e4m3 kind. + * \ingroup CUDA_MATH_INTRINSIC_FP8 + */ + +/** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * \brief __nv_fp8_e4m3 datatype + * + * \details This structure implements the datatype for storing + * \p fp8 floating-point numbers of \p e4m3 kind: + * with 1 sign, 4 exponent, 1 implicit and 3 explicit mantissa bits. + * The encoding doesn't support Infinity. + * NaNs are limited to 0x7F and 0xFF values. + * + * The structure implements converting constructors and operators. + */ +struct __CUDA_ALIGN__(1) __nv_fp8_e4m3 { + public: + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Storage variable contains the \p fp8 floating-point data. + */ + __nv_fp8_storage_t __x; + + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor by default. + */ +#if defined(__CPP_VERSION_AT_LEAST_11_FP8) + __nv_fp8_e4m3() = default; +#else + __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3() {} +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP8) */ + +#if !defined(__CUDA_NO_FP8_CONVERSIONS__) + + /* Construct from wider FP types */ + /* Note we do avoid constructor init-list because of special host/device + * compilation rules */ + + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p __half data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3(const __half f) { + __x = __nv_cvt_halfraw_to_fp8(static_cast<__half_raw>(f), + __NV_SATFINITE, __NV_E4M3); + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p __nv_bfloat16 data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3(const __nv_bfloat16 f) { + __x = __nv_cvt_bfloat16raw_to_fp8(static_cast<__nv_bfloat16_raw>(f), + __NV_SATFINITE, __NV_E4M3); + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p float data type, relies on \p __NV_SATFINITE behavior + * for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3(const float f) { + __x = __nv_cvt_float_to_fp8(f, __NV_SATFINITE, __NV_E4M3); + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p double data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3(const double f) { + __x = __nv_cvt_double_to_fp8(f, __NV_SATFINITE, __NV_E4M3); + } + + /* Converts from integral */ + + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p unsigned \p short \p int data type, relies on \p + * __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ + __nv_fp8_e4m3(const unsigned short int val) { + __x = static_cast<__nv_fp8_e4m3>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p unsigned \p int data type, relies on \p + * __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3(const unsigned int val) { + __x = static_cast<__nv_fp8_e4m3>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p unsigned \p long \p int data type, relies on \p + * __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3(const unsigned long int val) { + __x = static_cast<__nv_fp8_e4m3>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p unsigned \p long \p long \p int data type, relies on + * \p __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ + __nv_fp8_e4m3(const unsigned long long int val) { + __x = static_cast<__nv_fp8_e4m3>(static_cast(val)).__x; + } + + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p short \p int data type, relies on \p + * __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3(const short int val) { + __x = static_cast<__nv_fp8_e4m3>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p int data type, relies on \p __NV_SATFINITE behavior + * for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3(const int val) { + __x = static_cast<__nv_fp8_e4m3>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p long \p int data type, relies on \p + * __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3(const long int val) { + __x = static_cast<__nv_fp8_e4m3>(static_cast(val)).__x; + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Constructor from \p long \p long \p int data type, relies on \p + * __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8_e4m3(const long long int val) { + __x = static_cast<__nv_fp8_e4m3>(static_cast(val)).__x; + } + +#if !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) + /* Widening FP converts */ + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p __half data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator __half() const { + return static_cast<__half>(__nv_cvt_fp8_to_halfraw(__x, __NV_E4M3)); + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p float data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator float() const { + return __internal_halfraw_to_float( + __nv_cvt_fp8_to_halfraw(__x, __NV_E4M3)); + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p __nv_bfloat16 data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator __nv_bfloat16() const { + return static_cast<__nv_bfloat16>( + __internal_float_to_bf16raw_rz(float(*this))); + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p double data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator double() const { + return static_cast(float(*this)); + } + + /* Convert to integral */ + + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p unsigned \p char data type. + * Clamps negative and too large inputs to the output range. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator unsigned char() const { + unsigned char i; + const float f = float(*this); + const unsigned char max_val = 0xFFU; + const unsigned char min_val = 0U; + const unsigned char bits = (*this).__x; + // saturation fixup + if ((bits & 0x7FU) == 0x7FU) { + // NaN + i = 0; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value + i = static_cast(f); + } + return i; + } + + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p unsigned \p short \p int data type. + * Clamps negative inputs to zero. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator unsigned short int() const { + return __half2ushort_rz(__half(*this)); + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p unsigned \p int data type. + * Clamps negative inputs to zero. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator unsigned int() const { + return __half2uint_rz(__half(*this)); + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p unsigned \p long \p int data type. + * Clamps negative and too large inputs to the output range. + * \p NaN inputs convert to \p zero if output type is 32-bit. + * \p NaN inputs convert to \p 0x8000000000000000ULL if output type is 64-bit. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator unsigned long int() const { + unsigned long retval; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(unsigned long) == sizeof(unsigned long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + retval = static_cast(__half2ull_rz(__half(*this))); + } + else + { + retval = static_cast(__half2uint_rz(__half(*this))); + } + return retval; + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p unsigned \p long \p long \p int data type. + * Clamps negative inputs to zero. + * \p NaN inputs convert to \p 0x8000000000000000ULL. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator unsigned long long int() const { + return __half2ull_rz(__half(*this)); + } + + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p signed \p char data type. + * Clamps too large inputs to the output range. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator signed char() const { + signed char i; + const float f = float(*this); + const signed char max_val = (signed char)0x7FU; + const signed char min_val = (signed char)0x80U; + const unsigned char bits = (*this).__x; + // saturation fixup + if ((bits & 0x7FU) == 0x7FU) { + // NaN + i = 0; + } else if (f > static_cast(max_val)) { + // saturate maximum + i = max_val; + } else if (f < static_cast(min_val)) { + // saturate minimum + i = min_val; + } else { + // normal value + i = static_cast(f); + } + return i; + } + + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to an implementation defined \p char data type. + * + * Detects signedness of the \p char type and proceeds accordingly, see + * further details in signed and unsigned char operators. + + * Clamps inputs to the output range. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator char() const { + char value; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (((char)-1) < (char)0) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + value = static_cast(static_cast(*this)); + } + else + { + value = static_cast(static_cast(*this)); + } + return value; + } + + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p short \p int data type. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator short int() const { + return __half2short_rz(__half(*this)); + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p int data type. + * \p NaN inputs convert to \p zero. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator int() const { + return __half2int_rz(__half(*this)); + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p long \p int data type. + * Clamps too large inputs to the output range. + * \p NaN inputs convert to \p zero if output type is 32-bit. + * \p NaN inputs convert to \p 0x8000000000000000ULL if output type is 64-bit. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator long int() const { + long retval; + /* Suppress VS warning: warning C4127: conditional expression is constant */ +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (push) +#pragma warning (disable: 4127) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + if (sizeof(long) == sizeof(long long)) +#if defined(_MSC_VER) && !defined(__CUDA_ARCH__) +#pragma warning (pop) +#endif /* _MSC_VER && !defined(__CUDA_ARCH__) */ + { + retval = static_cast(__half2ll_rz(__half(*this))); + } + else + { + retval = static_cast(__half2int_rz(__half(*this))); + } + return retval; + } + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p long \p long \p int data type. + * \p NaN inputs convert to \p 0x8000000000000000LL. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator long long int() const { + return __half2ll_rz(__half(*this)); + } + + /** + * \ingroup CUDA_MATH_FP8_E4M3_STRUCT + * Conversion operator to \p bool data type. + * +0 and -0 inputs convert to \p false. + * Non-zero inputs convert to \p true. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator bool() const { + return (__x & 0x7FU) != 0U; + } +#endif /* !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) */ +#endif /* !defined(__CUDA_NO_FP8_CONVERSIONS__) */ +}; + +/** + * \defgroup CUDA_MATH_FP8X2_E4M3_STRUCT C++ struct for handling vector type of two fp8 values of e4m3 kind. + * \ingroup CUDA_MATH_INTRINSIC_FP8 + */ + +/** + * \ingroup CUDA_MATH_FP8X2_E4M3_STRUCT + * \brief __nv_fp8x2_e4m3 datatype + * + * \details This structure implements the datatype for storage + * and operations on the vector of two \p fp8 values of \p e4m3 kind each: + * with 1 sign, 4 exponent, 1 implicit and 3 explicit mantissa bits. + * The encoding doesn't support Infinity. + * NaNs are limited to 0x7F and 0xFF values. + */ +struct __CUDA_ALIGN__(2) __nv_fp8x2_e4m3 { + public: + /** + * \ingroup CUDA_MATH_FP8X2_E4M3_STRUCT + * Storage variable contains the vector of two \p fp8 floating-point data + * values. + */ + __nv_fp8x2_storage_t __x; + + /** + * \ingroup CUDA_MATH_FP8X2_E4M3_STRUCT + * Constructor by default. + */ +#if defined(__CPP_VERSION_AT_LEAST_11_FP8) + __nv_fp8x2_e4m3() = default; +#else + __CUDA_HOSTDEVICE_FP8__ __nv_fp8x2_e4m3() {} +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP8) */ + +#if !defined(__CUDA_NO_FP8_CONVERSIONS__) + + /* Construct from wider types */ + + /** + * \ingroup CUDA_MATH_FP8X2_E4M3_STRUCT + * Constructor from \p __half2 data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x2_e4m3(const __half2 f) { + __x = __nv_cvt_halfraw2_to_fp8x2(static_cast<__half2_raw>(f), + __NV_SATFINITE, __NV_E4M3); + } + /** + * \ingroup CUDA_MATH_FP8X2_E4M3_STRUCT + * Constructor from \p __nv_bfloat162 data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x2_e4m3(const __nv_bfloat162 f) { + __x = __nv_cvt_bfloat16raw2_to_fp8x2(static_cast<__nv_bfloat162_raw>(f), + __NV_SATFINITE, __NV_E4M3); + } + /** + * \ingroup CUDA_MATH_FP8X2_E4M3_STRUCT + * Constructor from \p float2 data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x2_e4m3(const float2 f) { + __x = __nv_cvt_float2_to_fp8x2(f, __NV_SATFINITE, __NV_E4M3); + } + /** + * \ingroup CUDA_MATH_FP8X2_E4M3_STRUCT + * Constructor from \p double2 data type, relies on \p __NV_SATFINITE + * behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x2_e4m3(const double2 f) { + __x = __nv_cvt_double2_to_fp8x2(f, __NV_SATFINITE, __NV_E4M3); + } + +#if !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) + /* Widening converts */ + /** + * \ingroup CUDA_MATH_FP8X2_E4M3_STRUCT + * Conversion operator to \p __half2 data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator __half2() const { + return static_cast<__half2>(__nv_cvt_fp8x2_to_halfraw2(__x, __NV_E4M3)); + } + /** + * \ingroup CUDA_MATH_FP8X2_E4M3_STRUCT + * Conversion operator to \p float2 data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator float2() const { + return __internal_halfraw2_to_float2( + __nv_cvt_fp8x2_to_halfraw2(__x, __NV_E4M3)); + } +#endif /* !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) */ +#endif /* !defined(__CUDA_NO_FP8_CONVERSIONS__) */ +}; + +/** + * \defgroup CUDA_MATH_FP8X4_E4M3_STRUCT C++ struct for handling vector type of four fp8 values of e4m3 kind. + * \ingroup CUDA_MATH_INTRINSIC_FP8 + */ + +/** + * \ingroup CUDA_MATH_FP8X4_E4M3_STRUCT + * \brief __nv_fp8x4_e4m3 datatype + * + * \details This structure implements the datatype for storage + * and operations on the vector of four \p fp8 values of \p e4m3 kind each: + * with 1 sign, 4 exponent, 1 implicit and 3 explicit mantissa bits. + * The encoding doesn't support Infinity. + * NaNs are limited to 0x7F and 0xFF values. + */ +struct __CUDA_ALIGN__(4) __nv_fp8x4_e4m3 { + public: + /** + * \ingroup CUDA_MATH_FP8X4_E4M3_STRUCT + * Storage variable contains the vector of four \p fp8 floating-point data + * values. + */ + __nv_fp8x4_storage_t __x; + + /** + * \ingroup CUDA_MATH_FP8X4_E4M3_STRUCT + * Constructor by default. + */ +#if defined(__CPP_VERSION_AT_LEAST_11_FP8) + __nv_fp8x4_e4m3() = default; +#else + __CUDA_HOSTDEVICE_FP8__ __nv_fp8x4_e4m3() {} +#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP8) */ + +#if !defined(__CUDA_NO_FP8_CONVERSIONS__) + + /* Construct from wider types */ + + /** + * \ingroup CUDA_MATH_FP8X4_E4M3_STRUCT + * Constructor from a pair of \p __half2 data type values, + * relies on \p __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x4_e4m3(const __half2 flo, + const __half2 fhi) { + const __nv_fp8x2_storage_t rlo = __nv_cvt_halfraw2_to_fp8x2( + static_cast<__half2_raw>(flo), __NV_SATFINITE, __NV_E4M3); + const __nv_fp8x2_storage_t rhi = __nv_cvt_halfraw2_to_fp8x2( + static_cast<__half2_raw>(fhi), __NV_SATFINITE, __NV_E4M3); + __x = __internal_pack_u16x2_to_u32(rlo, rhi); + } + /** + * \ingroup CUDA_MATH_FP8X4_E4M3_STRUCT + * Constructor from a pair of \p __nv_bfloat162 data type values, + * relies on \p __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x4_e4m3(const __nv_bfloat162 flo, + const __nv_bfloat162 fhi) { + const __nv_fp8x2_storage_t rlo = __nv_cvt_bfloat16raw2_to_fp8x2( + static_cast<__nv_bfloat162_raw>(flo), __NV_SATFINITE, __NV_E4M3); + const __nv_fp8x2_storage_t rhi = __nv_cvt_bfloat16raw2_to_fp8x2( + static_cast<__nv_bfloat162_raw>(fhi), __NV_SATFINITE, __NV_E4M3); + __x = __internal_pack_u16x2_to_u32(rlo, rhi); + } + /** + * \ingroup CUDA_MATH_FP8X4_E4M3_STRUCT + * Constructor from \p float4 vector data type, + * relies on \p __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x4_e4m3(const float4 f) { + const float2 flo = {f.x, f.y}; + const float2 fhi = {f.z, f.w}; + const __nv_fp8x2_storage_t rlo = + __nv_cvt_float2_to_fp8x2(flo, __NV_SATFINITE, __NV_E4M3); + const __nv_fp8x2_storage_t rhi = + __nv_cvt_float2_to_fp8x2(fhi, __NV_SATFINITE, __NV_E4M3); + __x = __internal_pack_u16x2_to_u32(rlo, rhi); + } + /** + * \ingroup CUDA_MATH_FP8X4_E4M3_STRUCT + * Constructor from \p double4 vector data type, + * relies on \p __NV_SATFINITE behavior for out-of-range values. + */ + explicit __CUDA_HOSTDEVICE_FP8__ __nv_fp8x4_e4m3(const double4 f) { + const double2 flo = {f.x, f.y}; + const double2 fhi = {f.z, f.w}; + const __nv_fp8x2_storage_t rlo = + __nv_cvt_double2_to_fp8x2(flo, __NV_SATFINITE, __NV_E4M3); + const __nv_fp8x2_storage_t rhi = + __nv_cvt_double2_to_fp8x2(fhi, __NV_SATFINITE, __NV_E4M3); + __x = __internal_pack_u16x2_to_u32(rlo, rhi); + } + +#if !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) + /* Widening converts */ + + /** + * \ingroup CUDA_MATH_FP8X4_E4M3_STRUCT + * Conversion operator to \p float4 vector data type. + */ + explicit __CUDA_HOSTDEVICE_FP8__ operator float4() const { + const __nv_fp8x2_storage_t slo = static_cast<__nv_fp8x2_storage_t>(__x); + const __nv_fp8x2_storage_t shi = + static_cast<__nv_fp8x2_storage_t>(__x >> 16U); + float2 rlo = __internal_halfraw2_to_float2( + __nv_cvt_fp8x2_to_halfraw2(slo, __NV_E4M3)); + float2 rhi = __internal_halfraw2_to_float2( + __nv_cvt_fp8x2_to_halfraw2(shi, __NV_E4M3)); + float4 res = {rlo.x, rlo.y, rhi.x, rhi.y}; + return res; + } +#endif /* !defined(__CUDA_NO_FP8_CONVERSION_OPERATORS__) */ +#endif /* !defined(__CUDA_NO_FP8_CONVERSIONS__) */ +}; + +#endif /* defined(__cplusplus) */ + +#endif /* end of include guard: __CUDA_FP8_HPP__ */ diff --git a/cuda_toolkit/include/cuda_gl_interop.h b/cuda_toolkit/include/cuda_gl_interop.h new file mode 100644 index 0000000000000000000000000000000000000000..d1a79b33ea57ec091685f9b6bbe7e73d96abb550 --- /dev/null +++ b/cuda_toolkit/include/cuda_gl_interop.h @@ -0,0 +1,514 @@ +/* + * Copyright 1993-2012 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_GL_INTEROP_H__) +#define __CUDA_GL_INTEROP_H__ + +#include "cuda_runtime_api.h" + +#if defined(__APPLE__) + +#include + +#else /* __APPLE__ */ + +#if defined(__arm__) || defined(__aarch64__) +#ifndef GL_VERSION +#error Please include the appropriate gl headers before including cuda_gl_interop.h +#endif +#else +#include +#endif + +#endif /* __APPLE__ */ + +/** \cond impl_private */ +#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif +/** \endcond impl_private */ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/** + * \addtogroup CUDART_OPENGL OpenGL Interoperability + * This section describes the OpenGL interoperability functions of the CUDA + * runtime application programming interface. Note that mapping of OpenGL + * resources is performed with the graphics API agnostic, resource mapping + * interface described in \ref CUDART_INTEROP "Graphics Interopability". + * + * @{ + */ + +/** + * CUDA devices corresponding to the current OpenGL context + */ +enum cudaGLDeviceList +{ + cudaGLDeviceListAll = 1, /**< The CUDA devices for all GPUs used by the current OpenGL context */ + cudaGLDeviceListCurrentFrame = 2, /**< The CUDA devices for the GPUs used by the current OpenGL context in its currently rendering frame */ + cudaGLDeviceListNextFrame = 3 /**< The CUDA devices for the GPUs to be used by the current OpenGL context in the next frame */ +}; + +/** + * \brief Gets the CUDA devices associated with the current OpenGL context + * + * Returns in \p *pCudaDeviceCount the number of CUDA-compatible devices + * corresponding to the current OpenGL context. Also returns in \p *pCudaDevices + * at most \p cudaDeviceCount of the CUDA-compatible devices corresponding to + * the current OpenGL context. If any of the GPUs being used by the current OpenGL + * context are not CUDA capable then the call will return ::cudaErrorNoDevice. + * + * \param pCudaDeviceCount - Returned number of CUDA devices corresponding to the + * current OpenGL context + * \param pCudaDevices - Returned CUDA devices corresponding to the current + * OpenGL context + * \param cudaDeviceCount - The size of the output device array \p pCudaDevices + * \param deviceList - The set of devices to return. This set may be + * ::cudaGLDeviceListAll for all devices, + * ::cudaGLDeviceListCurrentFrame for the devices used to + * render the current frame (in SLI), or + * ::cudaGLDeviceListNextFrame for the devices used to + * render the next frame (in SLI). + * + * \return + * ::cudaSuccess, + * ::cudaErrorNoDevice, + * ::cudaErrorInvalidGraphicsContext, + * ::cudaErrorOperatingSystem, + * ::cudaErrorUnknown + * + * \note This function is not supported on Mac OS X. + * \notefnerr + * + * \sa + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsMapResources, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuGLGetDevices + */ +extern __host__ cudaError_t CUDARTAPI cudaGLGetDevices(unsigned int *pCudaDeviceCount, int *pCudaDevices, unsigned int cudaDeviceCount, enum cudaGLDeviceList deviceList); + +/** + * \brief Register an OpenGL texture or renderbuffer object + * + * Registers the texture or renderbuffer object specified by \p image for access by CUDA. + * A handle to the registered object is returned as \p resource. + * + * \p target must match the type of the object, and must be one of ::GL_TEXTURE_2D, + * ::GL_TEXTURE_RECTANGLE, ::GL_TEXTURE_CUBE_MAP, ::GL_TEXTURE_3D, ::GL_TEXTURE_2D_ARRAY, + * or ::GL_RENDERBUFFER. + * + * The register flags \p flags specify the intended usage, as follows: + * - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this + * resource will be used. It is therefore assumed that this resource will be + * read from and written to by CUDA. This is the default value. + * - ::cudaGraphicsRegisterFlagsReadOnly: Specifies that CUDA + * will not write to this resource. + * - ::cudaGraphicsRegisterFlagsWriteDiscard: Specifies that + * CUDA will not read from this resource and will write over the + * entire contents of the resource, so none of the data previously + * stored in the resource will be preserved. + * - ::cudaGraphicsRegisterFlagsSurfaceLoadStore: Specifies that CUDA will + * bind this resource to a surface reference. + * - ::cudaGraphicsRegisterFlagsTextureGather: Specifies that CUDA will perform + * texture gather operations on this resource. + * + * The following image formats are supported. For brevity's sake, the list is abbreviated. + * For ex., {GL_R, GL_RG} X {8, 16} would expand to the following 4 formats + * {GL_R8, GL_R16, GL_RG8, GL_RG16} : + * - GL_RED, GL_RG, GL_RGBA, GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY + * - {GL_R, GL_RG, GL_RGBA} X {8, 16, 16F, 32F, 8UI, 16UI, 32UI, 8I, 16I, 32I} + * - {GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY} X + * {8, 16, 16F_ARB, 32F_ARB, 8UI_EXT, 16UI_EXT, 32UI_EXT, 8I_EXT, 16I_EXT, 32I_EXT} + * + * The following image classes are currently disallowed: + * - Textures with borders + * - Multisampled renderbuffers + * + * \param resource - Pointer to the returned object handle + * \param image - name of texture or renderbuffer object to be registered + * \param target - Identifies the type of object specified by \p image + * \param flags - Register flags + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorOperatingSystem, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsMapResources, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cuGraphicsGLRegisterImage + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsGLRegisterImage(struct cudaGraphicsResource **resource, GLuint image, GLenum target, unsigned int flags); + +/** + * \brief Registers an OpenGL buffer object + * + * Registers the buffer object specified by \p buffer for access by + * CUDA. A handle to the registered object is returned as \p + * resource. The register flags \p flags specify the intended usage, + * as follows: + * + * - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this + * resource will be used. It is therefore assumed that this resource will be + * read from and written to by CUDA. This is the default value. + * - ::cudaGraphicsRegisterFlagsReadOnly: Specifies that CUDA + * will not write to this resource. + * - ::cudaGraphicsRegisterFlagsWriteDiscard: Specifies that + * CUDA will not read from this resource and will write over the + * entire contents of the resource, so none of the data previously + * stored in the resource will be preserved. + * + * \param resource - Pointer to the returned object handle + * \param buffer - name of buffer object to be registered + * \param flags - Register flags + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorOperatingSystem, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa + * ::cudaGraphicsUnregisterResource, + * ::cudaGraphicsMapResources, + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuGraphicsGLRegisterBuffer + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsGLRegisterBuffer(struct cudaGraphicsResource **resource, GLuint buffer, unsigned int flags); + +#ifdef _WIN32 +#ifndef WGL_NV_gpu_affinity +typedef void* HGPUNV; +#endif + +/** + * \brief Gets the CUDA device associated with hGpu + * + * Returns the CUDA device associated with a hGpu, if applicable. + * + * \param device - Returns the device associated with hGpu, or -1 if hGpu is + * not a compute device. + * \param hGpu - Handle to a GPU, as queried via WGL_NV_gpu_affinity + * + * \return + * ::cudaSuccess + * \notefnerr + * + * \sa + * ::WGL_NV_gpu_affinity, + * ::cuWGLGetDevice + */ +extern __host__ cudaError_t CUDARTAPI cudaWGLGetDevice(int *device, HGPUNV hGpu); +#endif + +/** @} */ /* END CUDART_OPENGL */ + +/** + * \addtogroup CUDART_OPENGL_DEPRECATED OpenGL Interoperability [DEPRECATED] + * This section describes deprecated OpenGL interoperability functionality. + * + * @{ + */ + +/** + * CUDA GL Map Flags + */ +enum cudaGLMapFlags +{ + cudaGLMapFlagsNone = 0, /**< Default; Assume resource can be read/written */ + cudaGLMapFlagsReadOnly = 1, /**< CUDA kernels will not write to this resource */ + cudaGLMapFlagsWriteDiscard = 2 /**< CUDA kernels will only write to and will not read from this resource */ +}; + +/** + * \brief Sets a CUDA device to use OpenGL interoperability + * + * \deprecated This function is deprecated as of CUDA 5.0. + * + * This function is deprecated and should no longer be used. It is + * no longer necessary to associate a CUDA device with an OpenGL + * context in order to achieve maximum interoperability performance. + * + * This function will immediately initialize the primary context on + * \p device if needed. + * + * \param device - Device to use for OpenGL interoperability + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorSetOnActiveProcess + * \notefnerr + * + * \sa ::cudaGraphicsGLRegisterBuffer, ::cudaGraphicsGLRegisterImage + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLSetGLDevice(int device); + +/** + * \brief Registers a buffer object for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Registers the buffer object of ID \p bufObj for access by + * CUDA. This function must be called before CUDA can map the buffer + * object. The OpenGL context used to create the buffer, or another + * context from the same share group, must be bound to the current + * thread when this is called. + * + * \param bufObj - Buffer object ID to register + * + * \return + * ::cudaSuccess, + * ::cudaErrorInitializationError + * \notefnerr + * + * \sa ::cudaGraphicsGLRegisterBuffer + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLRegisterBufferObject(GLuint bufObj); + +/** + * \brief Maps a buffer object for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Maps the buffer object of ID \p bufObj into the address space of + * CUDA and returns in \p *devPtr the base pointer of the resulting + * mapping. The buffer must have previously been registered by + * calling ::cudaGLRegisterBufferObject(). While a buffer is mapped + * by CUDA, any OpenGL operation which references the buffer will + * result in undefined behavior. The OpenGL context used to create + * the buffer, or another context from the same share group, must be + * bound to the current thread when this is called. + * + * All streams in the current thread are synchronized with the current + * GL context. + * + * \param devPtr - Returned device pointer to CUDA object + * \param bufObj - Buffer object ID to map + * + * \return + * ::cudaSuccess, + * ::cudaErrorMapBufferObjectFailed + * \notefnerr + * + * \sa ::cudaGraphicsMapResources + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLMapBufferObject(void **devPtr, GLuint bufObj); + +/** + * \brief Unmaps a buffer object for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unmaps the buffer object of ID \p bufObj for access by CUDA. When + * a buffer is unmapped, the base address returned by + * ::cudaGLMapBufferObject() is invalid and subsequent references to + * the address result in undefined behavior. The OpenGL context used + * to create the buffer, or another context from the same share group, + * must be bound to the current thread when this is called. + * + * All streams in the current thread are synchronized with the current + * GL context. + * + * \param bufObj - Buffer object to unmap + * + * \return + * ::cudaSuccess, + * ::cudaErrorUnmapBufferObjectFailed + * \notefnerr + * + * \sa ::cudaGraphicsUnmapResources + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLUnmapBufferObject(GLuint bufObj); + +/** + * \brief Unregisters a buffer object for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unregisters the buffer object of ID \p bufObj for access by CUDA + * and releases any CUDA resources associated with the buffer. Once a + * buffer is unregistered, it may no longer be mapped by CUDA. The GL + * context used to create the buffer, or another context from the + * same share group, must be bound to the current thread when this is + * called. + * + * \param bufObj - Buffer object to unregister + * + * \return + * ::cudaSuccess + * \notefnerr + * + * \sa ::cudaGraphicsUnregisterResource + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLUnregisterBufferObject(GLuint bufObj); + +/** + * \brief Set usage flags for mapping an OpenGL buffer + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Set flags for mapping the OpenGL buffer \p bufObj + * + * Changes to flags will take effect the next time \p bufObj is mapped. + * The \p flags argument may be any of the following: + * + * - ::cudaGLMapFlagsNone: Specifies no hints about how this buffer will + * be used. It is therefore assumed that this buffer will be read from and + * written to by CUDA kernels. This is the default value. + * - ::cudaGLMapFlagsReadOnly: Specifies that CUDA kernels which access this + * buffer will not write to the buffer. + * - ::cudaGLMapFlagsWriteDiscard: Specifies that CUDA kernels which access + * this buffer will not read from the buffer and will write over the + * entire contents of the buffer, so none of the data previously stored in + * the buffer will be preserved. + * + * If \p bufObj has not been registered for use with CUDA, then + * ::cudaErrorInvalidResourceHandle is returned. If \p bufObj is presently + * mapped for access by CUDA, then ::cudaErrorUnknown is returned. + * + * \param bufObj - Registered buffer object to set flags for + * \param flags - Parameters for buffer mapping + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * + * \sa ::cudaGraphicsResourceSetMapFlags + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLSetBufferObjectMapFlags(GLuint bufObj, unsigned int flags); + +/** + * \brief Maps a buffer object for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Maps the buffer object of ID \p bufObj into the address space of + * CUDA and returns in \p *devPtr the base pointer of the resulting + * mapping. The buffer must have previously been registered by + * calling ::cudaGLRegisterBufferObject(). While a buffer is mapped + * by CUDA, any OpenGL operation which references the buffer will + * result in undefined behavior. The OpenGL context used to create + * the buffer, or another context from the same share group, must be + * bound to the current thread when this is called. + * + * Stream /p stream is synchronized with the current GL context. + * + * \param devPtr - Returned device pointer to CUDA object + * \param bufObj - Buffer object ID to map + * \param stream - Stream to synchronize + * + * \return + * ::cudaSuccess, + * ::cudaErrorMapBufferObjectFailed + * \notefnerr + * + * \sa ::cudaGraphicsMapResources + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLMapBufferObjectAsync(void **devPtr, GLuint bufObj, cudaStream_t stream); + +/** + * \brief Unmaps a buffer object for access by CUDA + * + * \deprecated This function is deprecated as of CUDA 3.0. + * + * Unmaps the buffer object of ID \p bufObj for access by CUDA. When + * a buffer is unmapped, the base address returned by + * ::cudaGLMapBufferObject() is invalid and subsequent references to + * the address result in undefined behavior. The OpenGL context used + * to create the buffer, or another context from the same share group, + * must be bound to the current thread when this is called. + * + * Stream /p stream is synchronized with the current GL context. + * + * \param bufObj - Buffer object to unmap + * \param stream - Stream to synchronize + * + * \return + * ::cudaSuccess, + * ::cudaErrorUnmapBufferObjectFailed + * \notefnerr + * + * \sa ::cudaGraphicsUnmapResources + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLUnmapBufferObjectAsync(GLuint bufObj, cudaStream_t stream); + +/** @} */ /* END CUDART_OPENGL_DEPRECATED */ + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#undef __CUDA_DEPRECATED + +#endif /* __CUDA_GL_INTEROP_H__ */ + diff --git a/cuda_toolkit/include/cuda_occupancy.h b/cuda_toolkit/include/cuda_occupancy.h new file mode 100644 index 0000000000000000000000000000000000000000..2a7c690f409a4c16394b49c80f93c11ce7f9a420 --- /dev/null +++ b/cuda_toolkit/include/cuda_occupancy.h @@ -0,0 +1,1958 @@ +/* + * Copyright 1993-2017 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/** + * CUDA Occupancy Calculator + * + * NAME + * + * cudaOccMaxActiveBlocksPerMultiprocessor, + * cudaOccMaxPotentialOccupancyBlockSize, + * cudaOccMaxPotentialOccupancyBlockSizeVariableSMem + * cudaOccAvailableDynamicSMemPerBlock + * + * DESCRIPTION + * + * The CUDA occupancy calculator provides a standalone, programmatical + * interface to compute the occupancy of a function on a device. It can also + * provide occupancy-oriented launch configuration suggestions. + * + * The function and device are defined by the user through + * cudaOccFuncAttributes, cudaOccDeviceProp, and cudaOccDeviceState + * structures. All APIs require all 3 of them. + * + * See the structure definition for more details about the device / function + * descriptors. + * + * See each API's prototype for API usage. + * + * COMPATIBILITY + * + * The occupancy calculator will be updated on each major CUDA toolkit + * release. It does not provide forward compatibility, i.e. new hardwares + * released after this implementation's release will not be supported. + * + * NOTE + * + * If there is access to CUDA runtime, and the sole intent is to calculate + * occupancy related values on one of the accessible CUDA devices, using CUDA + * runtime's occupancy calculation APIs is recommended. + * + */ + +#ifndef __cuda_occupancy_h__ +#define __cuda_occupancy_h__ + +#include +#include +#include + + +// __OCC_INLINE will be undefined at the end of this header +// +#ifdef __CUDACC__ +#define __OCC_INLINE inline __host__ __device__ +#elif defined _MSC_VER +#define __OCC_INLINE __inline +#else // GNUCC assumed +#define __OCC_INLINE inline +#endif + +enum cudaOccError_enum { + CUDA_OCC_SUCCESS = 0, // no error encountered + CUDA_OCC_ERROR_INVALID_INPUT = 1, // input parameter is invalid + CUDA_OCC_ERROR_UNKNOWN_DEVICE = 2, // requested device is not supported in + // current implementation or device is + // invalid +}; +typedef enum cudaOccError_enum cudaOccError; + +typedef struct cudaOccResult cudaOccResult; +typedef struct cudaOccDeviceProp cudaOccDeviceProp; +typedef struct cudaOccFuncAttributes cudaOccFuncAttributes; +typedef struct cudaOccDeviceState cudaOccDeviceState; + +/** + * The CUDA occupancy calculator computes the occupancy of the function + * described by attributes with the given block size (blockSize), static device + * properties (properties), dynamic device states (states) and per-block dynamic + * shared memory allocation (dynamicSMemSize) in bytes, and output it through + * result along with other useful information. The occupancy is computed in + * terms of the maximum number of active blocks per multiprocessor. The user can + * then convert it to other metrics, such as number of active warps. + * + * RETURN VALUE + * + * The occupancy and related information is returned through result. + * + * If result->activeBlocksPerMultiprocessor is 0, then the given parameter + * combination cannot run on the device. + * + * ERRORS + * + * CUDA_OCC_ERROR_INVALID_INPUT input parameter is invalid. + * CUDA_OCC_ERROR_UNKNOWN_DEVICE requested device is not supported in + * current implementation or device is invalid + */ +static __OCC_INLINE +cudaOccError cudaOccMaxActiveBlocksPerMultiprocessor( + cudaOccResult *result, // out + const cudaOccDeviceProp *properties, // in + const cudaOccFuncAttributes *attributes, // in + const cudaOccDeviceState *state, // in + int blockSize, // in + size_t dynamicSmemSize); // in + +/** + * The CUDA launch configurator C API suggests a grid / block size pair (in + * minGridSize and blockSize) that achieves the best potential occupancy + * (i.e. maximum number of active warps with the smallest number of blocks) for + * the given function described by attributes, on a device described by + * properties with settings in state. + * + * If per-block dynamic shared memory allocation is not needed, the user should + * leave both blockSizeToDynamicSMemSize and dynamicSMemSize as 0. + * + * If per-block dynamic shared memory allocation is needed, then if the dynamic + * shared memory size is constant regardless of block size, the size should be + * passed through dynamicSMemSize, and blockSizeToDynamicSMemSize should be + * NULL. + * + * Otherwise, if the per-block dynamic shared memory size varies with different + * block sizes, the user needs to provide a pointer to an unary function through + * blockSizeToDynamicSMemSize that computes the dynamic shared memory needed by + * a block of the function for any given block size. dynamicSMemSize is + * ignored. An example signature is: + * + * // Take block size, returns dynamic shared memory needed + * size_t blockToSmem(int blockSize); + * + * RETURN VALUE + * + * The suggested block size and the minimum number of blocks needed to achieve + * the maximum occupancy are returned through blockSize and minGridSize. + * + * If *blockSize is 0, then the given combination cannot run on the device. + * + * ERRORS + * + * CUDA_OCC_ERROR_INVALID_INPUT input parameter is invalid. + * CUDA_OCC_ERROR_UNKNOWN_DEVICE requested device is not supported in + * current implementation or device is invalid + * + */ +static __OCC_INLINE +cudaOccError cudaOccMaxPotentialOccupancyBlockSize( + int *minGridSize, // out + int *blockSize, // out + const cudaOccDeviceProp *properties, // in + const cudaOccFuncAttributes *attributes, // in + const cudaOccDeviceState *state, // in + size_t (*blockSizeToDynamicSMemSize)(int), // in + size_t dynamicSMemSize); // in + +/** + * The CUDA launch configurator C++ API suggests a grid / block size pair (in + * minGridSize and blockSize) that achieves the best potential occupancy + * (i.e. the maximum number of active warps with the smallest number of blocks) + * for the given function described by attributes, on a device described by + * properties with settings in state. + * + * If per-block dynamic shared memory allocation is 0 or constant regardless of + * block size, the user can use cudaOccMaxPotentialOccupancyBlockSize to + * configure the launch. A constant dynamic shared memory allocation size in + * bytes can be passed through dynamicSMemSize. + * + * Otherwise, if the per-block dynamic shared memory size varies with different + * block sizes, the user needs to use + * cudaOccMaxPotentialOccupancyBlockSizeVariableSmem instead, and provide a + * functor / pointer to an unary function (blockSizeToDynamicSMemSize) that + * computes the dynamic shared memory needed by func for any given block + * size. An example signature is: + * + * // Take block size, returns per-block dynamic shared memory needed + * size_t blockToSmem(int blockSize); + * + * RETURN VALUE + * + * The suggested block size and the minimum number of blocks needed to achieve + * the maximum occupancy are returned through blockSize and minGridSize. + * + * If *blockSize is 0, then the given combination cannot run on the device. + * + * ERRORS + * + * CUDA_OCC_ERROR_INVALID_INPUT input parameter is invalid. + * CUDA_OCC_ERROR_UNKNOWN_DEVICE requested device is not supported in + * current implementation or device is invalid + * + */ + +#if defined(__cplusplus) +namespace { + +__OCC_INLINE +cudaOccError cudaOccMaxPotentialOccupancyBlockSize( + int *minGridSize, // out + int *blockSize, // out + const cudaOccDeviceProp *properties, // in + const cudaOccFuncAttributes *attributes, // in + const cudaOccDeviceState *state, // in + size_t dynamicSMemSize = 0); // in + +template +__OCC_INLINE +cudaOccError cudaOccMaxPotentialOccupancyBlockSizeVariableSMem( + int *minGridSize, // out + int *blockSize, // out + const cudaOccDeviceProp *properties, // in + const cudaOccFuncAttributes *attributes, // in + const cudaOccDeviceState *state, // in + UnaryFunction blockSizeToDynamicSMemSize); // in + +} // namespace anonymous +#endif // defined(__cplusplus) + +/** + * + * The CUDA dynamic shared memory calculator computes the maximum size of + * per-block dynamic shared memory if we want to place numBlocks blocks + * on an SM. + * + * RETURN VALUE + * + * Returns in *dynamicSmemSize the maximum size of dynamic shared memory to allow + * numBlocks blocks per SM. + * + * ERRORS + * + * CUDA_OCC_ERROR_INVALID_INPUT input parameter is invalid. + * CUDA_OCC_ERROR_UNKNOWN_DEVICE requested device is not supported in + * current implementation or device is invalid + * + */ +static __OCC_INLINE +cudaOccError cudaOccAvailableDynamicSMemPerBlock( + size_t *dynamicSmemSize, + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes, + const cudaOccDeviceState *state, + int numBlocks, + int blockSize); + +/** + * Data structures + * + * These structures are subject to change for future architecture and CUDA + * releases. C users should initialize the structure as {0}. + * + */ + +/** + * Device descriptor + * + * This structure describes a device. + */ +struct cudaOccDeviceProp { + int computeMajor; // Compute capability major version + int computeMinor; // Compute capability minor + // version. None supported minor version + // may cause error + int maxThreadsPerBlock; // Maximum number of threads per block + int maxThreadsPerMultiprocessor; // Maximum number of threads per SM + // i.e. (Max. number of warps) x (warp + // size) + int regsPerBlock; // Maximum number of registers per block + int regsPerMultiprocessor; // Maximum number of registers per SM + int warpSize; // Warp size + size_t sharedMemPerBlock; // Maximum shared memory size per block + size_t sharedMemPerMultiprocessor; // Maximum shared memory size per SM + int numSms; // Number of SMs available + size_t sharedMemPerBlockOptin; // Maximum optin shared memory size per block + size_t reservedSharedMemPerBlock; // Shared memory per block reserved by driver + +#ifdef __cplusplus + // This structure can be converted from a cudaDeviceProp structure for users + // that use this header in their CUDA applications. + // + // If the application have access to the CUDA Runtime API, the application + // can obtain the device properties of a CUDA device through + // cudaGetDeviceProperties, and initialize a cudaOccDeviceProp with the + // cudaDeviceProp structure. + // + // Example: + /* + { + cudaDeviceProp prop; + + cudaGetDeviceProperties(&prop, ...); + + cudaOccDeviceProp occProp = prop; + + ... + + cudaOccMaxPotentialOccupancyBlockSize(..., &occProp, ...); + } + */ + // + template + __OCC_INLINE + cudaOccDeviceProp(const DeviceProp &props) + : computeMajor (props.major), + computeMinor (props.minor), + maxThreadsPerBlock (props.maxThreadsPerBlock), + maxThreadsPerMultiprocessor (props.maxThreadsPerMultiProcessor), + regsPerBlock (props.regsPerBlock), + regsPerMultiprocessor (props.regsPerMultiprocessor), + warpSize (props.warpSize), + sharedMemPerBlock (props.sharedMemPerBlock), + sharedMemPerMultiprocessor (props.sharedMemPerMultiprocessor), + numSms (props.multiProcessorCount), + sharedMemPerBlockOptin (props.sharedMemPerBlockOptin), + reservedSharedMemPerBlock (props.reservedSharedMemPerBlock) + {} + + __OCC_INLINE + cudaOccDeviceProp() + : computeMajor (0), + computeMinor (0), + maxThreadsPerBlock (0), + maxThreadsPerMultiprocessor (0), + regsPerBlock (0), + regsPerMultiprocessor (0), + warpSize (0), + sharedMemPerBlock (0), + sharedMemPerMultiprocessor (0), + numSms (0), + sharedMemPerBlockOptin (0), + reservedSharedMemPerBlock (0) + {} +#endif // __cplusplus +}; + +/** + * Partitioned global caching option + */ +typedef enum cudaOccPartitionedGCConfig_enum { + PARTITIONED_GC_OFF, // Disable partitioned global caching + PARTITIONED_GC_ON, // Prefer partitioned global caching + PARTITIONED_GC_ON_STRICT // Force partitioned global caching +} cudaOccPartitionedGCConfig; + +/** + * Per function opt in maximum dynamic shared memory limit + */ +typedef enum cudaOccFuncShmemConfig_enum { + FUNC_SHMEM_LIMIT_DEFAULT, // Default shmem limit + FUNC_SHMEM_LIMIT_OPTIN, // Use the optin shmem limit +} cudaOccFuncShmemConfig; + +/** + * Function descriptor + * + * This structure describes a CUDA function. + */ +struct cudaOccFuncAttributes { + int maxThreadsPerBlock; // Maximum block size the function can work with. If + // unlimited, use INT_MAX or any value greater than + // or equal to maxThreadsPerBlock of the device + int numRegs; // Number of registers used. When the function is + // launched on device, the register count may change + // due to internal tools requirements. + size_t sharedSizeBytes; // Number of static shared memory used + + cudaOccPartitionedGCConfig partitionedGCConfig; + // Partitioned global caching is required to enable + // caching on certain chips, such as sm_52 + // devices. Partitioned global caching can be + // automatically disabled if the occupancy + // requirement of the launch cannot support caching. + // + // To override this behavior with caching on and + // calculate occupancy strictly according to the + // preference, set partitionedGCConfig to + // PARTITIONED_GC_ON_STRICT. This is especially + // useful for experimenting and finding launch + // configurations (MaxPotentialOccupancyBlockSize) + // that allow global caching to take effect. + // + // This flag only affects the occupancy calculation. + + cudaOccFuncShmemConfig shmemLimitConfig; + // Certain chips like sm_70 allow a user to opt into + // a higher per block limit of dynamic shared memory + // This optin is performed on a per function basis + // using the cuFuncSetAttribute function + + size_t maxDynamicSharedSizeBytes; + // User set limit on maximum dynamic shared memory + // usable by the kernel + // This limit is set using the cuFuncSetAttribute + // function. + + int numBlockBarriers; // Number of block barriers used (default to 1) +#ifdef __cplusplus + // This structure can be converted from a cudaFuncAttributes structure for + // users that use this header in their CUDA applications. + // + // If the application have access to the CUDA Runtime API, the application + // can obtain the function attributes of a CUDA kernel function through + // cudaFuncGetAttributes, and initialize a cudaOccFuncAttributes with the + // cudaFuncAttributes structure. + // + // Example: + /* + __global__ void foo() {...} + + ... + + { + cudaFuncAttributes attr; + + cudaFuncGetAttributes(&attr, foo); + + cudaOccFuncAttributes occAttr = attr; + + ... + + cudaOccMaxPotentialOccupancyBlockSize(..., &occAttr, ...); + } + */ + // + template + __OCC_INLINE + cudaOccFuncAttributes(const FuncAttributes &attr) + : maxThreadsPerBlock (attr.maxThreadsPerBlock), + numRegs (attr.numRegs), + sharedSizeBytes (attr.sharedSizeBytes), + partitionedGCConfig (PARTITIONED_GC_OFF), + shmemLimitConfig (FUNC_SHMEM_LIMIT_OPTIN), + maxDynamicSharedSizeBytes (attr.maxDynamicSharedSizeBytes), + numBlockBarriers (1) + {} + + __OCC_INLINE + cudaOccFuncAttributes() + : maxThreadsPerBlock (0), + numRegs (0), + sharedSizeBytes (0), + partitionedGCConfig (PARTITIONED_GC_OFF), + shmemLimitConfig (FUNC_SHMEM_LIMIT_DEFAULT), + maxDynamicSharedSizeBytes (0), + numBlockBarriers (0) + {} +#endif +}; + +typedef enum cudaOccCacheConfig_enum { + CACHE_PREFER_NONE = 0x00, // no preference for shared memory or L1 (default) + CACHE_PREFER_SHARED = 0x01, // prefer larger shared memory and smaller L1 cache + CACHE_PREFER_L1 = 0x02, // prefer larger L1 cache and smaller shared memory + CACHE_PREFER_EQUAL = 0x03 // prefer equal sized L1 cache and shared memory +} cudaOccCacheConfig; + +typedef enum cudaOccCarveoutConfig_enum { + SHAREDMEM_CARVEOUT_DEFAULT = -1, // no preference for shared memory or L1 (default) + SHAREDMEM_CARVEOUT_MAX_SHARED = 100, // prefer maximum available shared memory, minimum L1 cache + SHAREDMEM_CARVEOUT_MAX_L1 = 0, // prefer maximum available L1 cache, minimum shared memory + SHAREDMEM_CARVEOUT_HALF = 50 // prefer half of maximum available shared memory, with the rest as L1 cache +} cudaOccCarveoutConfig; + +/** + * Device state descriptor + * + * This structure describes device settings that affect occupancy calculation. + */ +struct cudaOccDeviceState +{ + // Cache / shared memory split preference. Deprecated on Volta + cudaOccCacheConfig cacheConfig; + // Shared memory / L1 split preference. Supported on only Volta + int carveoutConfig; + +#ifdef __cplusplus + __OCC_INLINE + cudaOccDeviceState() + : cacheConfig (CACHE_PREFER_NONE), + carveoutConfig (SHAREDMEM_CARVEOUT_DEFAULT) + {} +#endif +}; + +typedef enum cudaOccLimitingFactor_enum { + // Occupancy limited due to: + OCC_LIMIT_WARPS = 0x01, // - warps available + OCC_LIMIT_REGISTERS = 0x02, // - registers available + OCC_LIMIT_SHARED_MEMORY = 0x04, // - shared memory available + OCC_LIMIT_BLOCKS = 0x08, // - blocks available + OCC_LIMIT_BARRIERS = 0x10 // - barrier available +} cudaOccLimitingFactor; + +/** + * Occupancy output + * + * This structure contains occupancy calculator's output. + */ +struct cudaOccResult { + int activeBlocksPerMultiprocessor; // Occupancy + unsigned int limitingFactors; // Factors that limited occupancy. A bit + // field that counts the limiting + // factors, see cudaOccLimitingFactor + int blockLimitRegs; // Occupancy due to register + // usage, INT_MAX if the kernel does not + // use any register. + int blockLimitSharedMem; // Occupancy due to shared memory + // usage, INT_MAX if the kernel does not + // use shared memory. + int blockLimitWarps; // Occupancy due to block size limit + int blockLimitBlocks; // Occupancy due to maximum number of blocks + // managable per SM + int blockLimitBarriers; // Occupancy due to block barrier usage + int allocatedRegistersPerBlock; // Actual number of registers allocated per + // block + size_t allocatedSharedMemPerBlock; // Actual size of shared memory allocated + // per block + cudaOccPartitionedGCConfig partitionedGCConfig; + // Report if partitioned global caching + // is actually enabled. +}; + +/** + * Partitioned global caching support + * + * See cudaOccPartitionedGlobalCachingModeSupport + */ +typedef enum cudaOccPartitionedGCSupport_enum { + PARTITIONED_GC_NOT_SUPPORTED, // Partitioned global caching is not supported + PARTITIONED_GC_SUPPORTED, // Partitioned global caching is supported +} cudaOccPartitionedGCSupport; + +/** + * Implementation + */ + +/** + * Max compute capability supported + */ +#define __CUDA_OCC_MAJOR__ 9 +#define __CUDA_OCC_MINOR__ 0 + +////////////////////////////////////////// +// Mathematical Helper Functions // +////////////////////////////////////////// + +static __OCC_INLINE int __occMin(int lhs, int rhs) +{ + return rhs < lhs ? rhs : lhs; +} + +static __OCC_INLINE int __occDivideRoundUp(int x, int y) +{ + return (x + (y - 1)) / y; +} + +static __OCC_INLINE int __occRoundUp(int x, int y) +{ + return y * __occDivideRoundUp(x, y); +} + +////////////////////////////////////////// +// Architectural Properties // +////////////////////////////////////////// + +/** + * Granularity of shared memory allocation + */ +static __OCC_INLINE cudaOccError cudaOccSMemAllocationGranularity(int *limit, const cudaOccDeviceProp *properties) +{ + int value; + + switch(properties->computeMajor) { + case 3: + case 5: + case 6: + case 7: + value = 256; + break; + case 8: + case 9: + value = 128; + break; + default: + return CUDA_OCC_ERROR_UNKNOWN_DEVICE; + } + + *limit = value; + + return CUDA_OCC_SUCCESS; +} + +/** + * Maximum number of registers per thread + */ +static __OCC_INLINE cudaOccError cudaOccRegAllocationMaxPerThread(int *limit, const cudaOccDeviceProp *properties) +{ + int value; + + switch(properties->computeMajor) { + case 3: + case 5: + case 6: + value = 255; + break; + case 7: + case 8: + case 9: + value = 256; + break; + default: + return CUDA_OCC_ERROR_UNKNOWN_DEVICE; + } + + *limit = value; + + return CUDA_OCC_SUCCESS; +} + +/** + * Granularity of register allocation + */ +static __OCC_INLINE cudaOccError cudaOccRegAllocationGranularity(int *limit, const cudaOccDeviceProp *properties) +{ + int value; + + switch(properties->computeMajor) { + case 3: + case 5: + case 6: + case 7: + case 8: + case 9: + value = 256; + break; + default: + return CUDA_OCC_ERROR_UNKNOWN_DEVICE; + } + + *limit = value; + + return CUDA_OCC_SUCCESS; +} + +/** + * Number of sub-partitions + */ +static __OCC_INLINE cudaOccError cudaOccSubPartitionsPerMultiprocessor(int *limit, const cudaOccDeviceProp *properties) +{ + int value; + + switch(properties->computeMajor) { + case 3: + case 5: + case 7: + case 8: + case 9: + value = 4; + break; + case 6: + value = properties->computeMinor ? 4 : 2; + break; + default: + return CUDA_OCC_ERROR_UNKNOWN_DEVICE; + } + + *limit = value; + + return CUDA_OCC_SUCCESS; +} + + +/** + * Maximum number of blocks that can run simultaneously on a multiprocessor + */ +static __OCC_INLINE cudaOccError cudaOccMaxBlocksPerMultiprocessor(int* limit, const cudaOccDeviceProp *properties) +{ + int value; + + switch(properties->computeMajor) { + case 3: + value = 16; + break; + case 5: + case 6: + value = 32; + break; + case 7: { + int isTuring = properties->computeMinor == 5; + value = (isTuring) ? 16 : 32; + break; + } + case 8: + if (properties->computeMinor == 0) { + value = 32; + } + else if (properties->computeMinor == 9) { + value = 24; + } + else { + value = 16; + } + break; + case 9: + value = 32; + break; + default: + return CUDA_OCC_ERROR_UNKNOWN_DEVICE; + } + + *limit = value; + + return CUDA_OCC_SUCCESS; +} + +/** + * Align up shared memory based on compute major configurations + */ +static __OCC_INLINE cudaOccError cudaOccAlignUpShmemSizeVoltaPlus(size_t *shMemSize, const cudaOccDeviceProp *properties) +{ + // Volta and Turing have shared L1 cache / shared memory, and support cache + // configuration to trade one for the other. These values are needed to + // map carveout config ratio to the next available architecture size + size_t size = *shMemSize; + + switch (properties->computeMajor) { + case 7: { + // Turing supports 32KB and 64KB shared mem. + int isTuring = properties->computeMinor == 5; + if (isTuring) { + if (size <= 32 * 1024) { + *shMemSize = 32 * 1024; + } + else if (size <= 64 * 1024) { + *shMemSize = 64 * 1024; + } + else { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + } + // Volta supports 0KB, 8KB, 16KB, 32KB, 64KB, and 96KB shared mem. + else { + if (size == 0) { + *shMemSize = 0; + } + else if (size <= 8 * 1024) { + *shMemSize = 8 * 1024; + } + else if (size <= 16 * 1024) { + *shMemSize = 16 * 1024; + } + else if (size <= 32 * 1024) { + *shMemSize = 32 * 1024; + } + else if (size <= 64 * 1024) { + *shMemSize = 64 * 1024; + } + else if (size <= 96 * 1024) { + *shMemSize = 96 * 1024; + } + else { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + } + break; + } + case 8: + if (properties->computeMinor == 0 || properties->computeMinor == 7) { + if (size == 0) { + *shMemSize = 0; + } + else if (size <= 8 * 1024) { + *shMemSize = 8 * 1024; + } + else if (size <= 16 * 1024) { + *shMemSize = 16 * 1024; + } + else if (size <= 32 * 1024) { + *shMemSize = 32 * 1024; + } + else if (size <= 64 * 1024) { + *shMemSize = 64 * 1024; + } + else if (size <= 100 * 1024) { + *shMemSize = 100 * 1024; + } + else if (size <= 132 * 1024) { + *shMemSize = 132 * 1024; + } + else if (size <= 164 * 1024) { + *shMemSize = 164 * 1024; + } + else { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + } + else { + if (size == 0) { + *shMemSize = 0; + } + else if (size <= 8 * 1024) { + *shMemSize = 8 * 1024; + } + else if (size <= 16 * 1024) { + *shMemSize = 16 * 1024; + } + else if (size <= 32 * 1024) { + *shMemSize = 32 * 1024; + } + else if (size <= 64 * 1024) { + *shMemSize = 64 * 1024; + } + else if (size <= 100 * 1024) { + *shMemSize = 100 * 1024; + } + else { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + } + break; + case 9: { + if (size == 0) { + *shMemSize = 0; + } + else if (size <= 8 * 1024) { + *shMemSize = 8 * 1024; + } + else if (size <= 16 * 1024) { + *shMemSize = 16 * 1024; + } + else if (size <= 32 * 1024) { + *shMemSize = 32 * 1024; + } + else if (size <= 64 * 1024) { + *shMemSize = 64 * 1024; + } + else if (size <= 100 * 1024) { + *shMemSize = 100 * 1024; + } + else if (size <= 132 * 1024) { + *shMemSize = 132 * 1024; + } + else if (size <= 164 * 1024) { + *shMemSize = 164 * 1024; + } + else if (size <= 196 * 1024) { + *shMemSize = 196 * 1024; + } + else if (size <= 228 * 1024) { + *shMemSize = 228 * 1024; + } + else { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + break; + } + default: + return CUDA_OCC_ERROR_UNKNOWN_DEVICE; + } + + return CUDA_OCC_SUCCESS; +} + +/** + * Shared memory based on the new carveoutConfig API introduced with Volta + */ +static __OCC_INLINE cudaOccError cudaOccSMemPreferenceVoltaPlus(size_t *limit, const cudaOccDeviceProp *properties, const cudaOccDeviceState *state) +{ + cudaOccError status = CUDA_OCC_SUCCESS; + size_t preferenceShmemSize; + + // CUDA 9.0 introduces a new API to set shared memory - L1 configuration on supported + // devices. This preference will take precedence over the older cacheConfig setting. + // Map cacheConfig to its effective preference value. + int effectivePreference = state->carveoutConfig; + if ((effectivePreference < SHAREDMEM_CARVEOUT_DEFAULT) || (effectivePreference > SHAREDMEM_CARVEOUT_MAX_SHARED)) { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + + if (effectivePreference == SHAREDMEM_CARVEOUT_DEFAULT) { + switch (state->cacheConfig) + { + case CACHE_PREFER_L1: + effectivePreference = SHAREDMEM_CARVEOUT_MAX_L1; + break; + case CACHE_PREFER_SHARED: + effectivePreference = SHAREDMEM_CARVEOUT_MAX_SHARED; + break; + case CACHE_PREFER_EQUAL: + effectivePreference = SHAREDMEM_CARVEOUT_HALF; + break; + default: + effectivePreference = SHAREDMEM_CARVEOUT_DEFAULT; + break; + } + } + + if (effectivePreference == SHAREDMEM_CARVEOUT_DEFAULT) { + preferenceShmemSize = properties->sharedMemPerMultiprocessor; + } + else { + preferenceShmemSize = (size_t) (effectivePreference * properties->sharedMemPerMultiprocessor) / 100; + } + + status = cudaOccAlignUpShmemSizeVoltaPlus(&preferenceShmemSize, properties); + *limit = preferenceShmemSize; + return status; +} + +/** + * Shared memory based on the cacheConfig + */ +static __OCC_INLINE cudaOccError cudaOccSMemPreference(size_t *limit, const cudaOccDeviceProp *properties, const cudaOccDeviceState *state) +{ + size_t bytes = 0; + size_t sharedMemPerMultiprocessorHigh = properties->sharedMemPerMultiprocessor; + cudaOccCacheConfig cacheConfig = state->cacheConfig; + + // Kepler has shared L1 cache / shared memory, and support cache + // configuration to trade one for the other. These values are needed to + // calculate the correct shared memory size for user requested cache + // configuration. + // + size_t minCacheSize = 16384; + size_t maxCacheSize = 49152; + size_t cacheAndSharedTotal = sharedMemPerMultiprocessorHigh + minCacheSize; + size_t sharedMemPerMultiprocessorLow = cacheAndSharedTotal - maxCacheSize; + + switch (properties->computeMajor) { + case 3: + // Kepler supports 16KB, 32KB, or 48KB partitions for L1. The rest + // is shared memory. + // + switch (cacheConfig) { + default : + case CACHE_PREFER_NONE: + case CACHE_PREFER_SHARED: + bytes = sharedMemPerMultiprocessorHigh; + break; + case CACHE_PREFER_L1: + bytes = sharedMemPerMultiprocessorLow; + break; + case CACHE_PREFER_EQUAL: + // Equal is the mid-point between high and low. It should be + // equivalent to low + 16KB. + // + bytes = (sharedMemPerMultiprocessorHigh + sharedMemPerMultiprocessorLow) / 2; + break; + } + break; + case 5: + case 6: + // Maxwell and Pascal have dedicated shared memory. + // + bytes = sharedMemPerMultiprocessorHigh; + break; + default: + return CUDA_OCC_ERROR_UNKNOWN_DEVICE; + } + + *limit = bytes; + + return CUDA_OCC_SUCCESS; +} + +/** + * Shared memory based on config requested by User + */ +static __OCC_INLINE cudaOccError cudaOccSMemPerMultiprocessor(size_t *limit, const cudaOccDeviceProp *properties, const cudaOccDeviceState *state) +{ + // Volta introduces a new API that allows for shared memory carveout preference. Because it is a shared memory preference, + // it is handled separately from the cache config preference. + if (properties->computeMajor >= 7) { + return cudaOccSMemPreferenceVoltaPlus(limit, properties, state); + } + return cudaOccSMemPreference(limit, properties, state); +} + +/** + * Return the per block shared memory limit based on function config + */ +static __OCC_INLINE cudaOccError cudaOccSMemPerBlock(size_t *limit, const cudaOccDeviceProp *properties, cudaOccFuncShmemConfig shmemLimitConfig, size_t smemPerCta) +{ + switch (properties->computeMajor) { + case 2: + case 3: + case 4: + case 5: + case 6: + *limit = properties->sharedMemPerBlock; + break; + case 7: + case 8: + case 9: + switch (shmemLimitConfig) { + default: + case FUNC_SHMEM_LIMIT_DEFAULT: + *limit = properties->sharedMemPerBlock; + break; + case FUNC_SHMEM_LIMIT_OPTIN: + if (smemPerCta > properties->sharedMemPerBlock) { + *limit = properties->sharedMemPerBlockOptin; + } + else { + *limit = properties->sharedMemPerBlock; + } + break; + } + break; + default: + return CUDA_OCC_ERROR_UNKNOWN_DEVICE; + } + + // Starting Ampere, CUDA driver reserves additional shared memory per block + if (properties->computeMajor >= 8) { + *limit += properties->reservedSharedMemPerBlock; + } + + return CUDA_OCC_SUCCESS; +} + +/** + * Partitioned global caching mode support + */ +static __OCC_INLINE cudaOccError cudaOccPartitionedGlobalCachingModeSupport(cudaOccPartitionedGCSupport *limit, const cudaOccDeviceProp *properties) +{ + *limit = PARTITIONED_GC_NOT_SUPPORTED; + + if ((properties->computeMajor == 5 && (properties->computeMinor == 2 || properties->computeMinor == 3)) || + properties->computeMajor == 6) { + *limit = PARTITIONED_GC_SUPPORTED; + } + + if (properties->computeMajor == 6 && properties->computeMinor == 0) { + *limit = PARTITIONED_GC_NOT_SUPPORTED; + } + + return CUDA_OCC_SUCCESS; +} + +/////////////////////////////////////////////// +// User Input Sanity // +/////////////////////////////////////////////// + +static __OCC_INLINE cudaOccError cudaOccDevicePropCheck(const cudaOccDeviceProp *properties) +{ + // Verify device properties + // + // Each of these limits must be a positive number. + // + // Compute capacity is checked during the occupancy calculation + // + if (properties->maxThreadsPerBlock <= 0 || + properties->maxThreadsPerMultiprocessor <= 0 || + properties->regsPerBlock <= 0 || + properties->regsPerMultiprocessor <= 0 || + properties->warpSize <= 0 || + properties->sharedMemPerBlock <= 0 || + properties->sharedMemPerMultiprocessor <= 0 || + properties->numSms <= 0) { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + + return CUDA_OCC_SUCCESS; +} + +static __OCC_INLINE cudaOccError cudaOccFuncAttributesCheck(const cudaOccFuncAttributes *attributes) +{ + // Verify function attributes + // + if (attributes->maxThreadsPerBlock <= 0 || + attributes->numRegs < 0) { // Compiler may choose not to use + // any register (empty kernels, + // etc.) + return CUDA_OCC_ERROR_INVALID_INPUT; + } + + return CUDA_OCC_SUCCESS; +} + +static __OCC_INLINE cudaOccError cudaOccDeviceStateCheck(const cudaOccDeviceState *state) +{ + (void)state; // silence unused-variable warning + // Placeholder + // + + return CUDA_OCC_SUCCESS; +} + +static __OCC_INLINE cudaOccError cudaOccInputCheck( + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes, + const cudaOccDeviceState *state) +{ + cudaOccError status = CUDA_OCC_SUCCESS; + + status = cudaOccDevicePropCheck(properties); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + status = cudaOccFuncAttributesCheck(attributes); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + status = cudaOccDeviceStateCheck(state); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + return status; +} + +/////////////////////////////////////////////// +// Occupancy calculation Functions // +/////////////////////////////////////////////// + +static __OCC_INLINE cudaOccPartitionedGCConfig cudaOccPartitionedGCExpected( + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes) +{ + cudaOccPartitionedGCSupport gcSupport; + cudaOccPartitionedGCConfig gcConfig; + + cudaOccPartitionedGlobalCachingModeSupport(&gcSupport, properties); + + gcConfig = attributes->partitionedGCConfig; + + if (gcSupport == PARTITIONED_GC_NOT_SUPPORTED) { + gcConfig = PARTITIONED_GC_OFF; + } + + return gcConfig; +} + +// Warp limit +// +static __OCC_INLINE cudaOccError cudaOccMaxBlocksPerSMWarpsLimit( + int *limit, + cudaOccPartitionedGCConfig gcConfig, + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes, + int blockSize) +{ + cudaOccError status = CUDA_OCC_SUCCESS; + int maxWarpsPerSm; + int warpsAllocatedPerCTA; + int maxBlocks; + (void)attributes; // silence unused-variable warning + + if (blockSize > properties->maxThreadsPerBlock) { + maxBlocks = 0; + } + else { + maxWarpsPerSm = properties->maxThreadsPerMultiprocessor / properties->warpSize; + warpsAllocatedPerCTA = __occDivideRoundUp(blockSize, properties->warpSize); + maxBlocks = 0; + + if (gcConfig != PARTITIONED_GC_OFF) { + int maxBlocksPerSmPartition; + int maxWarpsPerSmPartition; + + // If partitioned global caching is on, then a CTA can only use a SM + // partition (a half SM), and thus a half of the warp slots + // available per SM + // + maxWarpsPerSmPartition = maxWarpsPerSm / 2; + maxBlocksPerSmPartition = maxWarpsPerSmPartition / warpsAllocatedPerCTA; + maxBlocks = maxBlocksPerSmPartition * 2; + } + // On hardware that supports partitioned global caching, each half SM is + // guaranteed to support at least 32 warps (maximum number of warps of a + // CTA), so caching will not cause 0 occupancy due to insufficient warp + // allocation slots. + // + else { + maxBlocks = maxWarpsPerSm / warpsAllocatedPerCTA; + } + } + + *limit = maxBlocks; + + return status; +} + +// Shared memory limit +// +static __OCC_INLINE cudaOccError cudaOccMaxBlocksPerSMSmemLimit( + int *limit, + cudaOccResult *result, + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes, + const cudaOccDeviceState *state, + int blockSize, + size_t dynamicSmemSize) +{ + cudaOccError status = CUDA_OCC_SUCCESS; + int allocationGranularity; + size_t userSmemPreference = 0; + size_t totalSmemUsagePerCTA; + size_t maxSmemUsagePerCTA; + size_t smemAllocatedPerCTA; + size_t staticSmemSize; + size_t sharedMemPerMultiprocessor; + size_t smemLimitPerCTA; + int maxBlocks; + int dynamicSmemSizeExceeded = 0; + int totalSmemSizeExceeded = 0; + (void)blockSize; // silence unused-variable warning + + status = cudaOccSMemAllocationGranularity(&allocationGranularity, properties); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + // Obtain the user preferred shared memory size. This setting is ignored if + // user requests more shared memory than preferred. + // + status = cudaOccSMemPerMultiprocessor(&userSmemPreference, properties, state); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + staticSmemSize = attributes->sharedSizeBytes + properties->reservedSharedMemPerBlock; + totalSmemUsagePerCTA = staticSmemSize + dynamicSmemSize; + smemAllocatedPerCTA = __occRoundUp((int)totalSmemUsagePerCTA, (int)allocationGranularity); + + maxSmemUsagePerCTA = staticSmemSize + attributes->maxDynamicSharedSizeBytes; + + dynamicSmemSizeExceeded = 0; + totalSmemSizeExceeded = 0; + + // Obtain the user set maximum dynamic size if it exists + // If so, the current launch dynamic shared memory must not + // exceed the set limit + if (attributes->shmemLimitConfig != FUNC_SHMEM_LIMIT_DEFAULT && + dynamicSmemSize > attributes->maxDynamicSharedSizeBytes) { + dynamicSmemSizeExceeded = 1; + } + + status = cudaOccSMemPerBlock(&smemLimitPerCTA, properties, attributes->shmemLimitConfig, maxSmemUsagePerCTA); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + if (smemAllocatedPerCTA > smemLimitPerCTA) { + totalSmemSizeExceeded = 1; + } + + if (dynamicSmemSizeExceeded || totalSmemSizeExceeded) { + maxBlocks = 0; + } + else { + // User requested shared memory limit is used as long as it is greater + // than the total shared memory used per CTA, i.e. as long as at least + // one CTA can be launched. + if (userSmemPreference >= smemAllocatedPerCTA) { + sharedMemPerMultiprocessor = userSmemPreference; + } + else { + // On Volta+, user requested shared memory will limit occupancy + // if it's less than shared memory per CTA. Otherwise, the + // maximum shared memory limit is used. + if (properties->computeMajor >= 7) { + sharedMemPerMultiprocessor = smemAllocatedPerCTA; + status = cudaOccAlignUpShmemSizeVoltaPlus(&sharedMemPerMultiprocessor, properties); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + } + else { + sharedMemPerMultiprocessor = properties->sharedMemPerMultiprocessor; + } + } + + if (smemAllocatedPerCTA > 0) { + maxBlocks = (int)(sharedMemPerMultiprocessor / smemAllocatedPerCTA); + } + else { + maxBlocks = INT_MAX; + } + } + + result->allocatedSharedMemPerBlock = smemAllocatedPerCTA; + + *limit = maxBlocks; + + return status; +} + +static __OCC_INLINE +cudaOccError cudaOccMaxBlocksPerSMRegsLimit( + int *limit, + cudaOccPartitionedGCConfig *gcConfig, + cudaOccResult *result, + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes, + int blockSize) +{ + cudaOccError status = CUDA_OCC_SUCCESS; + int allocationGranularity; + int warpsAllocatedPerCTA; + int regsAllocatedPerCTA; + int regsAssumedPerCTA; + int regsPerWarp; + int regsAllocatedPerWarp; + int numSubPartitions; + int numRegsPerSubPartition; + int numWarpsPerSubPartition; + int numWarpsPerSM; + int maxBlocks; + int maxRegsPerThread; + + status = cudaOccRegAllocationGranularity( + &allocationGranularity, + properties); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + status = cudaOccRegAllocationMaxPerThread( + &maxRegsPerThread, + properties); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + status = cudaOccSubPartitionsPerMultiprocessor(&numSubPartitions, properties); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + warpsAllocatedPerCTA = __occDivideRoundUp(blockSize, properties->warpSize); + + // GPUs of compute capability 2.x and higher allocate registers to warps + // + // Number of regs per warp is regs per thread x warp size, rounded up to + // register allocation granularity + // + regsPerWarp = attributes->numRegs * properties->warpSize; + regsAllocatedPerWarp = __occRoundUp(regsPerWarp, allocationGranularity); + regsAllocatedPerCTA = regsAllocatedPerWarp * warpsAllocatedPerCTA; + + // Hardware verifies if a launch fits the per-CTA register limit. For + // historical reasons, the verification logic assumes register + // allocations are made to all partitions simultaneously. Therefore, to + // simulate the hardware check, the warp allocation needs to be rounded + // up to the number of partitions. + // + regsAssumedPerCTA = regsAllocatedPerWarp * __occRoundUp(warpsAllocatedPerCTA, numSubPartitions); + + if (properties->regsPerBlock < regsAssumedPerCTA || // Hardware check + properties->regsPerBlock < regsAllocatedPerCTA || // Software check + attributes->numRegs > maxRegsPerThread) { // Per thread limit check + maxBlocks = 0; + } + else { + if (regsAllocatedPerWarp > 0) { + // Registers are allocated in each sub-partition. The max number + // of warps that can fit on an SM is equal to the max number of + // warps per sub-partition x number of sub-partitions. + // + numRegsPerSubPartition = properties->regsPerMultiprocessor / numSubPartitions; + numWarpsPerSubPartition = numRegsPerSubPartition / regsAllocatedPerWarp; + + maxBlocks = 0; + + if (*gcConfig != PARTITIONED_GC_OFF) { + int numSubPartitionsPerSmPartition; + int numWarpsPerSmPartition; + int maxBlocksPerSmPartition; + + // If partitioned global caching is on, then a CTA can only + // use a half SM, and thus a half of the registers available + // per SM + // + numSubPartitionsPerSmPartition = numSubPartitions / 2; + numWarpsPerSmPartition = numWarpsPerSubPartition * numSubPartitionsPerSmPartition; + maxBlocksPerSmPartition = numWarpsPerSmPartition / warpsAllocatedPerCTA; + maxBlocks = maxBlocksPerSmPartition * 2; + } + + // Try again if partitioned global caching is not enabled, or if + // the CTA cannot fit on the SM with caching on (maxBlocks == 0). In the latter + // case, the device will automatically turn off caching, except + // if the user forces enablement via PARTITIONED_GC_ON_STRICT to calculate + // occupancy and launch configuration. + // + if (maxBlocks == 0 && *gcConfig != PARTITIONED_GC_ON_STRICT) { + // In case *gcConfig was PARTITIONED_GC_ON flip it OFF since + // this is what it will be if we spread CTA across partitions. + // + *gcConfig = PARTITIONED_GC_OFF; + numWarpsPerSM = numWarpsPerSubPartition * numSubPartitions; + maxBlocks = numWarpsPerSM / warpsAllocatedPerCTA; + } + } + else { + maxBlocks = INT_MAX; + } + } + + + result->allocatedRegistersPerBlock = regsAllocatedPerCTA; + + *limit = maxBlocks; + + return status; +} + +// Barrier limit +// +static __OCC_INLINE cudaOccError cudaOccMaxBlocksPerSMBlockBarrierLimit( + int *limit, + int ctaLimitBlocks, + const cudaOccFuncAttributes *attributes) +{ + cudaOccError status = CUDA_OCC_SUCCESS; + int numBarriersAvailable = ctaLimitBlocks * 2; + int numBarriersUsed = attributes->numBlockBarriers; + int maxBlocks = INT_MAX; + + if (numBarriersUsed) { + maxBlocks = numBarriersAvailable / numBarriersUsed; + } + + *limit = maxBlocks; + + return status; +} + +/////////////////////////////////// +// API Implementations // +/////////////////////////////////// + +static __OCC_INLINE +cudaOccError cudaOccMaxActiveBlocksPerMultiprocessor( + cudaOccResult *result, + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes, + const cudaOccDeviceState *state, + int blockSize, + size_t dynamicSmemSize) +{ + cudaOccError status = CUDA_OCC_SUCCESS; + int ctaLimitWarps = 0; + int ctaLimitBlocks = 0; + int ctaLimitSMem = 0; + int ctaLimitRegs = 0; + int ctaLimitBars = 0; + int ctaLimit = 0; + unsigned int limitingFactors = 0; + + cudaOccPartitionedGCConfig gcConfig = PARTITIONED_GC_OFF; + + if (!result || !properties || !attributes || !state || blockSize <= 0) { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + + /////////////////////////// + // Check user input + /////////////////////////// + + status = cudaOccInputCheck(properties, attributes, state); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + /////////////////////////// + // Initialization + /////////////////////////// + + gcConfig = cudaOccPartitionedGCExpected(properties, attributes); + + /////////////////////////// + // Compute occupancy + /////////////////////////// + + // Limits due to registers/SM + // Also compute if partitioned global caching has to be turned off + // + status = cudaOccMaxBlocksPerSMRegsLimit(&ctaLimitRegs, &gcConfig, result, properties, attributes, blockSize); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + // SMs on GP100 (6.0) have 2 subpartitions, while those on GP10x have 4. + // As a result, an SM on GP100 may be able to run more CTAs than the one on GP10x. + // For forward compatibility within Pascal family, if a function cannot run on GP10x (maxBlock == 0), + // we do not let it run on any Pascal processor, even though it may be able to run on GP100. + // Therefore, we check the occupancy on GP10x when it can run on GP100 + // + if (properties->computeMajor == 6 && properties->computeMinor == 0 && ctaLimitRegs) { + cudaOccDeviceProp propertiesGP10x; + cudaOccPartitionedGCConfig gcConfigGP10x = gcConfig; + int ctaLimitRegsGP10x = 0; + + // Set up properties for GP10x + memcpy(&propertiesGP10x, properties, sizeof(propertiesGP10x)); + propertiesGP10x.computeMinor = 1; + + status = cudaOccMaxBlocksPerSMRegsLimit(&ctaLimitRegsGP10x, &gcConfigGP10x, result, &propertiesGP10x, attributes, blockSize); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + if (ctaLimitRegsGP10x == 0) { + ctaLimitRegs = 0; + } + } + + // Limits due to warps/SM + // + status = cudaOccMaxBlocksPerSMWarpsLimit(&ctaLimitWarps, gcConfig, properties, attributes, blockSize); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + // Limits due to blocks/SM + // + status = cudaOccMaxBlocksPerMultiprocessor(&ctaLimitBlocks, properties); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + // Limits due to shared memory/SM + // + status = cudaOccMaxBlocksPerSMSmemLimit(&ctaLimitSMem, result, properties, attributes, state, blockSize, dynamicSmemSize); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + /////////////////////////// + // Overall occupancy + /////////////////////////// + + // Overall limit is min() of limits due to above reasons + // + ctaLimit = __occMin(ctaLimitRegs, __occMin(ctaLimitSMem, __occMin(ctaLimitWarps, ctaLimitBlocks))); + + // Determine occupancy limiting factors + // + if (ctaLimit == ctaLimitWarps) { + limitingFactors |= OCC_LIMIT_WARPS; + } + if (ctaLimit == ctaLimitRegs) { + limitingFactors |= OCC_LIMIT_REGISTERS; + } + if (ctaLimit == ctaLimitSMem) { + limitingFactors |= OCC_LIMIT_SHARED_MEMORY; + } + if (ctaLimit == ctaLimitBlocks) { + limitingFactors |= OCC_LIMIT_BLOCKS; + } + + // For Hopper onwards compute the limits to occupancy based on block barrier count + // + if (properties->computeMajor >= 9 && attributes->numBlockBarriers > 0) { + // Limits due to barrier/SM + // + status = cudaOccMaxBlocksPerSMBlockBarrierLimit(&ctaLimitBars, ctaLimitBlocks, attributes); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + // Recompute overall limit based on barrier/SM + // + ctaLimit = __occMin(ctaLimitBars, ctaLimit); + + // Determine if this is occupancy limiting factor + // + if (ctaLimit == ctaLimitBars) { + limitingFactors |= OCC_LIMIT_BARRIERS; + } + } + else { + ctaLimitBars = INT_MAX; + } + + // Fill in the return values + // + result->limitingFactors = limitingFactors; + + result->blockLimitRegs = ctaLimitRegs; + result->blockLimitSharedMem = ctaLimitSMem; + result->blockLimitWarps = ctaLimitWarps; + result->blockLimitBlocks = ctaLimitBlocks; + result->blockLimitBarriers = ctaLimitBars; + result->partitionedGCConfig = gcConfig; + + // Final occupancy + result->activeBlocksPerMultiprocessor = ctaLimit; + + return CUDA_OCC_SUCCESS; +} + +static __OCC_INLINE +cudaOccError cudaOccAvailableDynamicSMemPerBlock( + size_t *bytesAvailable, + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes, + const cudaOccDeviceState *state, + int numBlocks, + int blockSize) +{ + int allocationGranularity; + size_t smemLimitPerBlock; + size_t smemAvailableForDynamic; + size_t userSmemPreference = 0; + size_t sharedMemPerMultiprocessor; + cudaOccResult result; + cudaOccError status = CUDA_OCC_SUCCESS; + + if (numBlocks <= 0) + return CUDA_OCC_ERROR_INVALID_INPUT; + + // First compute occupancy of potential kernel launch. + // + status = cudaOccMaxActiveBlocksPerMultiprocessor(&result, properties, attributes, state, blockSize, 0); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + // Check if occupancy is achievable given user requested number of blocks. + // + if (result.activeBlocksPerMultiprocessor < numBlocks) { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + + status = cudaOccSMemAllocationGranularity(&allocationGranularity, properties); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + // Return the per block shared memory limit based on function config. + // + status = cudaOccSMemPerBlock(&smemLimitPerBlock, properties, attributes->shmemLimitConfig, properties->sharedMemPerMultiprocessor); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + // If there is only a single block needed per SM, then the user preference can be ignored and the fully SW + // limit is allowed to be used as shared memory otherwise if more than one block is needed, then the user + // preference sets the total limit of available shared memory. + // + cudaOccSMemPerMultiprocessor(&userSmemPreference, properties, state); + if (numBlocks == 1) { + sharedMemPerMultiprocessor = smemLimitPerBlock; + } + else { + if (!userSmemPreference) { + userSmemPreference = 1 ; + status = cudaOccAlignUpShmemSizeVoltaPlus(&userSmemPreference, properties); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + } + sharedMemPerMultiprocessor = userSmemPreference; + } + + // Compute total shared memory available per SM + // + smemAvailableForDynamic = sharedMemPerMultiprocessor / numBlocks; + smemAvailableForDynamic = (smemAvailableForDynamic / allocationGranularity) * allocationGranularity; + + // Cap shared memory + // + if (smemAvailableForDynamic > smemLimitPerBlock) { + smemAvailableForDynamic = smemLimitPerBlock; + } + + // Now compute dynamic shared memory size + smemAvailableForDynamic = smemAvailableForDynamic - attributes->sharedSizeBytes; + + // Cap computed dynamic SM by user requested limit specified via cuFuncSetAttribute() + // + if (smemAvailableForDynamic > attributes->maxDynamicSharedSizeBytes) + smemAvailableForDynamic = attributes->maxDynamicSharedSizeBytes; + + *bytesAvailable = smemAvailableForDynamic; + return CUDA_OCC_SUCCESS; +} + +static __OCC_INLINE +cudaOccError cudaOccMaxPotentialOccupancyBlockSize( + int *minGridSize, + int *blockSize, + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes, + const cudaOccDeviceState *state, + size_t (*blockSizeToDynamicSMemSize)(int), + size_t dynamicSMemSize) +{ + cudaOccError status = CUDA_OCC_SUCCESS; + cudaOccResult result; + + // Limits + int occupancyLimit; + int granularity; + int blockSizeLimit; + + // Recorded maximum + int maxBlockSize = 0; + int numBlocks = 0; + int maxOccupancy = 0; + + // Temporary + int blockSizeToTryAligned; + int blockSizeToTry; + int blockSizeLimitAligned; + int occupancyInBlocks; + int occupancyInThreads; + + /////////////////////////// + // Check user input + /////////////////////////// + + if (!minGridSize || !blockSize || !properties || !attributes || !state) { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + + status = cudaOccInputCheck(properties, attributes, state); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + ///////////////////////////////////////////////////////////////////////////////// + // Try each block size, and pick the block size with maximum occupancy + ///////////////////////////////////////////////////////////////////////////////// + + occupancyLimit = properties->maxThreadsPerMultiprocessor; + granularity = properties->warpSize; + + blockSizeLimit = __occMin(properties->maxThreadsPerBlock, attributes->maxThreadsPerBlock); + blockSizeLimitAligned = __occRoundUp(blockSizeLimit, granularity); + + for (blockSizeToTryAligned = blockSizeLimitAligned; blockSizeToTryAligned > 0; blockSizeToTryAligned -= granularity) { + blockSizeToTry = __occMin(blockSizeLimit, blockSizeToTryAligned); + + // Ignore dynamicSMemSize if the user provides a mapping + // + if (blockSizeToDynamicSMemSize) { + dynamicSMemSize = (*blockSizeToDynamicSMemSize)(blockSizeToTry); + } + + status = cudaOccMaxActiveBlocksPerMultiprocessor( + &result, + properties, + attributes, + state, + blockSizeToTry, + dynamicSMemSize); + + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + occupancyInBlocks = result.activeBlocksPerMultiprocessor; + occupancyInThreads = blockSizeToTry * occupancyInBlocks; + + if (occupancyInThreads > maxOccupancy) { + maxBlockSize = blockSizeToTry; + numBlocks = occupancyInBlocks; + maxOccupancy = occupancyInThreads; + } + + // Early out if we have reached the maximum + // + if (occupancyLimit == maxOccupancy) { + break; + } + } + + /////////////////////////// + // Return best available + /////////////////////////// + + // Suggested min grid size to achieve a full machine launch + // + *minGridSize = numBlocks * properties->numSms; + *blockSize = maxBlockSize; + + return status; +} + + +#if defined(__cplusplus) + +namespace { + +__OCC_INLINE +cudaOccError cudaOccMaxPotentialOccupancyBlockSize( + int *minGridSize, + int *blockSize, + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes, + const cudaOccDeviceState *state, + size_t dynamicSMemSize) +{ + return cudaOccMaxPotentialOccupancyBlockSize( + minGridSize, + blockSize, + properties, + attributes, + state, + NULL, + dynamicSMemSize); +} + +template +__OCC_INLINE +cudaOccError cudaOccMaxPotentialOccupancyBlockSizeVariableSMem( + int *minGridSize, + int *blockSize, + const cudaOccDeviceProp *properties, + const cudaOccFuncAttributes *attributes, + const cudaOccDeviceState *state, + UnaryFunction blockSizeToDynamicSMemSize) +{ + cudaOccError status = CUDA_OCC_SUCCESS; + cudaOccResult result; + + // Limits + int occupancyLimit; + int granularity; + int blockSizeLimit; + + // Recorded maximum + int maxBlockSize = 0; + int numBlocks = 0; + int maxOccupancy = 0; + + // Temporary + int blockSizeToTryAligned; + int blockSizeToTry; + int blockSizeLimitAligned; + int occupancyInBlocks; + int occupancyInThreads; + size_t dynamicSMemSize; + + /////////////////////////// + // Check user input + /////////////////////////// + + if (!minGridSize || !blockSize || !properties || !attributes || !state) { + return CUDA_OCC_ERROR_INVALID_INPUT; + } + + status = cudaOccInputCheck(properties, attributes, state); + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + ///////////////////////////////////////////////////////////////////////////////// + // Try each block size, and pick the block size with maximum occupancy + ///////////////////////////////////////////////////////////////////////////////// + + occupancyLimit = properties->maxThreadsPerMultiprocessor; + granularity = properties->warpSize; + blockSizeLimit = __occMin(properties->maxThreadsPerBlock, attributes->maxThreadsPerBlock); + blockSizeLimitAligned = __occRoundUp(blockSizeLimit, granularity); + + for (blockSizeToTryAligned = blockSizeLimitAligned; blockSizeToTryAligned > 0; blockSizeToTryAligned -= granularity) { + blockSizeToTry = __occMin(blockSizeLimit, blockSizeToTryAligned); + + dynamicSMemSize = blockSizeToDynamicSMemSize(blockSizeToTry); + + status = cudaOccMaxActiveBlocksPerMultiprocessor( + &result, + properties, + attributes, + state, + blockSizeToTry, + dynamicSMemSize); + + if (status != CUDA_OCC_SUCCESS) { + return status; + } + + occupancyInBlocks = result.activeBlocksPerMultiprocessor; + + occupancyInThreads = blockSizeToTry * occupancyInBlocks; + + if (occupancyInThreads > maxOccupancy) { + maxBlockSize = blockSizeToTry; + numBlocks = occupancyInBlocks; + maxOccupancy = occupancyInThreads; + } + + // Early out if we have reached the maximum + // + if (occupancyLimit == maxOccupancy) { + break; + } + } + + /////////////////////////// + // Return best available + /////////////////////////// + + // Suggested min grid size to achieve a full machine launch + // + *minGridSize = numBlocks * properties->numSms; + *blockSize = maxBlockSize; + + return status; +} + +} // namespace anonymous + +#endif /*__cplusplus */ + +#undef __OCC_INLINE + +#endif /*__cuda_occupancy_h__*/ diff --git a/cuda_toolkit/include/cuda_pipeline.h b/cuda_toolkit/include/cuda_pipeline.h new file mode 100644 index 0000000000000000000000000000000000000000..6852389fc90cf84c261595063fa394b7d4d1ec13 --- /dev/null +++ b/cuda_toolkit/include/cuda_pipeline.h @@ -0,0 +1,224 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef _CUDA_PIPELINE_H_ +# define _CUDA_PIPELINE_H_ + +# include "cuda_pipeline_primitives.h" + +# if !defined(_CUDA_PIPELINE_CPLUSPLUS_11_OR_LATER) +# error This file requires compiler support for the ISO C++ 2011 standard. This support must be enabled with the \ + -std=c++11 compiler option. +# endif + +# if defined(_CUDA_PIPELINE_ARCH_700_OR_LATER) +# include "cuda_awbarrier.h" +# endif + +// Integration with libcu++'s cuda::barrier. + +# if defined(_CUDA_PIPELINE_ARCH_700_OR_LATER) +# if defined(_LIBCUDACXX_CUDA_ABI_VERSION) +# define _LIBCUDACXX_PIPELINE_ASSUMED_ABI_VERSION _LIBCUDACXX_CUDA_ABI_VERSION +# else +# define _LIBCUDACXX_PIPELINE_ASSUMED_ABI_VERSION 4 +# endif + +# define _LIBCUDACXX_PIPELINE_CONCAT(X, Y) X ## Y +# define _LIBCUDACXX_PIPELINE_CONCAT2(X, Y) _LIBCUDACXX_PIPELINE_CONCAT(X, Y) +# define _LIBCUDACXX_PIPELINE_INLINE_NAMESPACE _LIBCUDACXX_PIPELINE_CONCAT2(__, _LIBCUDACXX_PIPELINE_ASSUMED_ABI_VERSION) + +namespace cuda { inline namespace _LIBCUDACXX_PIPELINE_INLINE_NAMESPACE { + struct __block_scope_barrier_base; +}} + +# endif + +_CUDA_PIPELINE_BEGIN_NAMESPACE + +template +_CUDA_PIPELINE_QUALIFIER +auto segment(T* ptr) -> T(*)[N]; + +class pipeline { +public: + pipeline(const pipeline&) = delete; + pipeline(pipeline&&) = delete; + pipeline& operator=(const pipeline&) = delete; + pipeline& operator=(pipeline&&) = delete; + + _CUDA_PIPELINE_QUALIFIER pipeline(); + _CUDA_PIPELINE_QUALIFIER size_t commit(); + _CUDA_PIPELINE_QUALIFIER void commit_and_wait(); + _CUDA_PIPELINE_QUALIFIER void wait(size_t batch); + template + _CUDA_PIPELINE_QUALIFIER void wait_prior(); + +# if defined(_CUDA_PIPELINE_ARCH_700_OR_LATER) + _CUDA_PIPELINE_QUALIFIER void arrive_on(awbarrier& barrier); + _CUDA_PIPELINE_QUALIFIER void arrive_on(cuda::__block_scope_barrier_base& barrier); +# endif + +private: + size_t current_batch; +}; + +template +_CUDA_PIPELINE_QUALIFIER +void memcpy_async(T& dst, const T& src, pipeline& pipe); + +template +_CUDA_PIPELINE_QUALIFIER +void memcpy_async(T(*dst)[DstN], const T(*src)[SrcN], pipeline& pipe); + +template +_CUDA_PIPELINE_QUALIFIER +auto segment(T* ptr) -> T(*)[N] +{ + return (T(*)[N])ptr; +} + +_CUDA_PIPELINE_QUALIFIER +pipeline::pipeline() + : current_batch(0) +{ +} + +_CUDA_PIPELINE_QUALIFIER +size_t pipeline::commit() +{ + _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_commit(); + return this->current_batch++; +} + +_CUDA_PIPELINE_QUALIFIER +void pipeline::commit_and_wait() +{ + (void)pipeline::commit(); + pipeline::wait_prior<0>(); +} + +_CUDA_PIPELINE_QUALIFIER +void pipeline::wait(size_t batch) +{ + const size_t prior = this->current_batch > batch ? this->current_batch - batch : 0; + + switch (prior) { + case 0 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<0>(); break; + case 1 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<1>(); break; + case 2 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<2>(); break; + case 3 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<3>(); break; + case 4 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<4>(); break; + case 5 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<5>(); break; + case 6 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<6>(); break; + case 7 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<7>(); break; + default : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<8>(); break; + } +} + +template +_CUDA_PIPELINE_QUALIFIER +void pipeline::wait_prior() +{ + _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior(); +} + +# if defined(_CUDA_PIPELINE_ARCH_700_OR_LATER) +_CUDA_PIPELINE_QUALIFIER +void pipeline::arrive_on(awbarrier& barrier) +{ + _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_arrive_on(&barrier.barrier); +} + +_CUDA_PIPELINE_QUALIFIER +void pipeline::arrive_on(cuda::__block_scope_barrier_base & barrier) +{ + _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_arrive_on(reinterpret_cast(&barrier)); +} +# endif + +template +_CUDA_PIPELINE_QUALIFIER +void memcpy_async(T& dst, const T& src, pipeline& pipe) +{ + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(&src) & (alignof(T) - 1))); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(&dst) & (alignof(T) - 1))); + + if (__is_trivially_copyable(T)) { + _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_copy_relaxed( + reinterpret_cast(&dst), reinterpret_cast(&src)); + } else { + dst = src; + } +} + +template +_CUDA_PIPELINE_QUALIFIER +void memcpy_async(T(*dst)[DstN], const T(*src)[SrcN], pipeline& pipe) +{ + constexpr size_t dst_size = sizeof(*dst); + constexpr size_t src_size = sizeof(*src); + static_assert(dst_size == 4 || dst_size == 8 || dst_size == 16, "Unsupported copy size."); + static_assert(src_size <= dst_size, "Source size must be less than or equal to destination size."); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(src) & (dst_size - 1))); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(dst) & (dst_size - 1))); + + if (__is_trivially_copyable(T)) { + _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_copy_strict( + reinterpret_cast(*dst), reinterpret_cast(*src)); + } else { + for (size_t i = 0; i < DstN; ++i) { + (*dst)[i] = (i < SrcN) ? (*src)[i] : T(); + } + } +} + +_CUDA_PIPELINE_END_NAMESPACE + +#endif /* !_CUDA_PIPELINE_H_ */ diff --git a/cuda_toolkit/include/cuda_pipeline_helpers.h b/cuda_toolkit/include/cuda_pipeline_helpers.h new file mode 100644 index 0000000000000000000000000000000000000000..c70da8b2a3c793d6e487d8f237556cf00d19e4cb --- /dev/null +++ b/cuda_toolkit/include/cuda_pipeline_helpers.h @@ -0,0 +1,373 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef _CUDA_PIPELINE_HELPERS_H_ +# define _CUDA_PIPELINE_HELPERS_H_ + +# define _CUDA_PIPELINE_NAMESPACE nvcuda::experimental +# define _CUDA_PIPELINE_BEGIN_NAMESPACE namespace nvcuda { namespace experimental { +# define _CUDA_PIPELINE_END_NAMESPACE } } + +# define _CUDA_PIPELINE_INTERNAL_NAMESPACE _CUDA_PIPELINE_NAMESPACE::__pipeline_internal +# define _CUDA_PIPELINE_BEGIN_INTERNAL_NAMESPACE _CUDA_PIPELINE_BEGIN_NAMESPACE namespace __pipeline_internal { +# define _CUDA_PIPELINE_END_INTERNAL_NAMESPACE } _CUDA_PIPELINE_END_NAMESPACE + +# if !defined(_CUDA_PIPELINE_QUALIFIER) +# define _CUDA_PIPELINE_QUALIFIER inline __device__ +# endif +# if !defined(_CUDA_PIPELINE_STATIC_QUALIFIER) +# define _CUDA_PIPELINE_STATIC_QUALIFIER static inline __device__ +# endif + +# if defined(_NVHPC_CUDA) || !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 700) +# define _CUDA_PIPELINE_ARCH_700_OR_LATER +# endif + +# if (__CUDA_ARCH__ >= 800) +# define _CUDA_PIPELINE_HAS_ASYNC_COPY 1 +# else +# define _CUDA_PIPELINE_HAS_ASYNC_COPY 0 +# endif + +# if !defined(_CUDA_PIPELINE_MAX_STAGES) +# define _CUDA_PIPELINE_MAX_STAGES 8 +# endif + +# if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1900))) +# define _CUDA_PIPELINE_CPLUSPLUS_11_OR_LATER +# endif + +# if !defined(_CUDA_PIPELINE_DEBUG) +# if defined(__CUDACC_DEBUG__) +# define _CUDA_PIPELINE_DEBUG 1 +# else +# define _CUDA_PIPELINE_DEBUG 0 +# endif +# endif + +# if defined(_CUDA_PIPELINE_DEBUG) && (_CUDA_PIPELINE_DEBUG == 1) && !defined(NDEBUG) +# if !defined(__CUDACC_RTC__) +# include +# endif +# define _CUDA_PIPELINE_ASSERT(x) assert((x)); +# define _CUDA_PIPELINE_ABORT() assert(0); +# else +# define _CUDA_PIPELINE_ASSERT(x) +# define _CUDA_PIPELINE_ABORT() __trap(); +# endif + +# if defined(_CUDA_PIPELINE_CPLUSPLUS_11_OR_LATER) +# define _CUDA_PIPELINE_STATIC_ASSERT(c, m) static_assert(c, m) +# else +# define _CUDA_PIPELINE_STATIC_ASSERT(c, m) +# endif + +# if (defined(_MSC_VER) && !defined(_WIN64)) || defined(__arm__) +# define _CUDA_PIPELINE_ASM_PTR_CONSTRAINT "r" +# else +# define _CUDA_PIPELINE_ASM_PTR_CONSTRAINT "l" +# endif + +# if defined(__CUDACC_RTC__) +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; +typedef uint64_t uintptr_t; +# else +# include +# endif + +_CUDA_PIPELINE_BEGIN_INTERNAL_NAMESPACE + +_CUDA_PIPELINE_STATIC_ASSERT(sizeof(short) == 2, "Size mismatch for type 'short'"); +_CUDA_PIPELINE_STATIC_ASSERT(sizeof(int) == 4, "Size mismatch for type 'int'"); +_CUDA_PIPELINE_STATIC_ASSERT(sizeof(int2) == 8, "Size mismatch for type 'int2'"); +_CUDA_PIPELINE_STATIC_ASSERT(sizeof(int4) == 16, "Size mismatch for type 'int4'"); + +extern "C" __device__ uint32_t __nvvm_get_smem_pointer(void *); + +template +_CUDA_PIPELINE_QUALIFIER +void pipeline_memcpy_sync(void* __restrict__ dst, const void* __restrict__ src) +{ + _CUDA_PIPELINE_STATIC_ASSERT(CopySize == 4 || CopySize == 8 || CopySize == 16, "Unsupported copy size."); + _CUDA_PIPELINE_STATIC_ASSERT(SourceSize <= CopySize, "Source size must be less than or equal to copy size"); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(dst) & (CopySize - 1))); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(src) & (CopySize - 1))); + + char* const d = reinterpret_cast(dst); + const char* const s = reinterpret_cast(src); + + size_t copy_step_size; + if (SourceSize == 0) { + copy_step_size = CopySize; + } else if (SourceSize == 2 || SourceSize == 4 || SourceSize == 8 || SourceSize == 16) { + copy_step_size = SourceSize; + } else { + copy_step_size = 1; + } + + for (size_t i = 0; i < CopySize; i += copy_step_size) { + const bool copy_source = SourceSize && (i < SourceSize); + + switch (copy_step_size) { + case 1: + d[i] = copy_source ? s[i] : char(); + break; + case 2: + *reinterpret_cast(d + i) = copy_source ? *reinterpret_cast(s + i) : short(); + break; + case 4: + *reinterpret_cast(d + i) = copy_source ? *reinterpret_cast(s + i) : int(); + break; + case 8: + *reinterpret_cast(d + i) = copy_source ? *reinterpret_cast(s + i) : int2(); + break; + case 16: + *reinterpret_cast(d + i) = copy_source ? *reinterpret_cast(s + i) : int4(); + break; + } + } +} + +template +struct ImplementationChooser; + +template<> +struct ImplementationChooser { + template + struct CpAsyncChooser { + _CUDA_PIPELINE_STATIC_QUALIFIER + void cp_async(void* __restrict__ dst, const void* __restrict__ src) + { + asm volatile ("cp.async.ca.shared.global [%0], [%1], %2, %3;" + : + : "r"(__nvvm_get_smem_pointer(dst)), _CUDA_PIPELINE_ASM_PTR_CONSTRAINT(src), "n"(CopySize), + "n"(SourceSize) + : "memory"); + } + }; + + template + struct CpAsyncChooser<16, SourceSize> { + _CUDA_PIPELINE_STATIC_QUALIFIER + void cp_async(void* __restrict__ dst, const void* __restrict__ src) + { + asm volatile ("cp.async.cg.shared.global [%0], [%1], %2, %3;" + : + : "r"(__nvvm_get_smem_pointer(dst)), _CUDA_PIPELINE_ASM_PTR_CONSTRAINT(src), "n"(16), "n"(SourceSize) + : "memory"); + } + }; + + template + _CUDA_PIPELINE_STATIC_QUALIFIER + void pipeline_memcpy_async(void* __restrict__ dst, const void* __restrict__ src) + { + _CUDA_PIPELINE_STATIC_ASSERT(CopySize == 4 || CopySize == 8 || CopySize == 16, "Unsupported copy size."); + _CUDA_PIPELINE_STATIC_ASSERT(SourceSize <= CopySize, "Source size must be less than or equal to copy size"); + _CUDA_PIPELINE_ASSERT(__isShared(dst)); + _CUDA_PIPELINE_ASSERT(__isGlobal(src)); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(dst) & (CopySize - 1))); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(src) & (CopySize - 1))); + + CpAsyncChooser::cp_async(dst, src); + } + + _CUDA_PIPELINE_STATIC_QUALIFIER + void pipeline_commit() + { + asm volatile ("cp.async.commit_group;"); + } + + template + _CUDA_PIPELINE_STATIC_QUALIFIER + void pipeline_wait_prior() + { + asm volatile ("cp.async.wait_group %0;" + : + : "n"(N < _CUDA_PIPELINE_MAX_STAGES ? N : _CUDA_PIPELINE_MAX_STAGES)); + } + + _CUDA_PIPELINE_STATIC_QUALIFIER + void pipeline_arrive_on(uint64_t* barrier) + { + _CUDA_PIPELINE_ASSERT(__isShared(barrier)); + + asm volatile ("cp.async.mbarrier.arrive.shared.b64 [%0];" + : + : "r"(__nvvm_get_smem_pointer(barrier))); + } +}; + +template<> +struct ImplementationChooser { + template + _CUDA_PIPELINE_STATIC_QUALIFIER + void pipeline_memcpy_async(void* __restrict__ dst, const void* __restrict__ src) + { + _CUDA_PIPELINE_STATIC_ASSERT(CopySize == 4 || CopySize == 8 || CopySize == 16, "Unsupported copy size."); + _CUDA_PIPELINE_STATIC_ASSERT(SourceSize <= CopySize, "Source size must be less than or equal to copy size"); + _CUDA_PIPELINE_ASSERT(__isShared(dst)); + _CUDA_PIPELINE_ASSERT(__isGlobal(src)); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(dst) & (CopySize - 1))); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(src) & (CopySize - 1))); + + pipeline_memcpy_sync(dst, src); + } + + _CUDA_PIPELINE_STATIC_QUALIFIER + void pipeline_commit() + { + } + + template + _CUDA_PIPELINE_STATIC_QUALIFIER + void pipeline_wait_prior() + { + } + + _CUDA_PIPELINE_STATIC_QUALIFIER + void pipeline_arrive_on(uint64_t* barrier) + { + } +}; + +template +_CUDA_PIPELINE_QUALIFIER +void pipeline_memcpy_async(void* __restrict__ dst, const void* __restrict__ src) +{ + _CUDA_PIPELINE_STATIC_ASSERT(CopySize == 4 || CopySize == 8 || CopySize == 16, "Unsupported copy size."); + _CUDA_PIPELINE_STATIC_ASSERT(SourceSize <= CopySize, "Source size must be less than or equal to copy size"); + _CUDA_PIPELINE_ASSERT(__isShared(dst)); + _CUDA_PIPELINE_ASSERT(__isGlobal(src)); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(dst) & (CopySize - 1))); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(src) & (CopySize - 1))); + + ImplementationChooser<_CUDA_PIPELINE_HAS_ASYNC_COPY>::pipeline_memcpy_async(dst, src); +} + +_CUDA_PIPELINE_QUALIFIER +void pipeline_commit() +{ + ImplementationChooser<_CUDA_PIPELINE_HAS_ASYNC_COPY>::pipeline_commit(); +} + +template +_CUDA_PIPELINE_QUALIFIER +void pipeline_wait_prior() +{ + ImplementationChooser<_CUDA_PIPELINE_HAS_ASYNC_COPY>::pipeline_wait_prior(); +} + +_CUDA_PIPELINE_QUALIFIER +void pipeline_arrive_on(uint64_t* barrier) +{ + ImplementationChooser<_CUDA_PIPELINE_HAS_ASYNC_COPY>::pipeline_arrive_on(barrier); +} + +template +_CUDA_PIPELINE_QUALIFIER +void pipeline_copy_strict(void* __restrict__ dst, const void* __restrict__ src) +{ + _CUDA_PIPELINE_STATIC_ASSERT(CopySize == 4 || CopySize == 8 || CopySize == 16, "Unsupported copy size."); + _CUDA_PIPELINE_STATIC_ASSERT(SourceSize <= CopySize, "Source size must be less than or equal to copy size."); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(src) & (CopySize - 1))); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(dst) & (CopySize - 1))); + + if (__isGlobal(src) && __isShared(dst)) { + pipeline_memcpy_async(dst, src); + } else { + pipeline_memcpy_sync(dst, src); + } +} + +template +_CUDA_PIPELINE_QUALIFIER +void pipeline_copy_relaxed(void* __restrict__ dst, const void* __restrict__ src) +{ + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(src) & (Align - 1))); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(dst) & (Align - 1))); + + const char* s = reinterpret_cast(src); + char* d = reinterpret_cast(dst); + size_t remaining = CopySize; + + while (remaining) { + if ((Align >= 16) && (remaining >= 16)) { + pipeline_copy_strict<16, 16>(dst, src); + d += 16; + s += 16; + remaining -= 16; + } else if ((Align >= 8) && (remaining >= 8)) { + pipeline_copy_strict<8, 8>(dst, src); + d += 8; + s += 8; + remaining -= 8; + } else if ((Align >= 4) && (remaining >= 4)) { + pipeline_copy_strict<4, 4>(dst, src); + d += 4; + s += 4; + remaining -= 4; + } else if ((Align >= 2) && (remaining >= 2)) { + *reinterpret_cast(d) = *reinterpret_cast(s); + d += 2; + s += 2; + remaining -= 2; + } else { + *d = *s; + d += 1; + s += 1; + remaining -= 1; + } + } +} + +_CUDA_PIPELINE_END_INTERNAL_NAMESPACE + +#endif /* !_CUDA_PIPELINE_HELPERS_H_ */ diff --git a/cuda_toolkit/include/cuda_pipeline_primitives.h b/cuda_toolkit/include/cuda_pipeline_primitives.h new file mode 100644 index 0000000000000000000000000000000000000000..2e843c67b5ca950b5dfe0feb1dbbbc0d9d7490f8 --- /dev/null +++ b/cuda_toolkit/include/cuda_pipeline_primitives.h @@ -0,0 +1,148 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef _CUDA_PIPELINE_PRIMITIVES_H_ +# define _CUDA_PIPELINE_PRIMITIVES_H_ + +# include "cuda_pipeline_helpers.h" + +_CUDA_PIPELINE_STATIC_QUALIFIER +void __pipeline_memcpy_async(void* __restrict__ dst_shared, const void* __restrict__ src_global, size_t size_and_align, + size_t zfill = 0) +{ + _CUDA_PIPELINE_ASSERT(size_and_align == 4 || size_and_align == 8 || size_and_align == 16); + _CUDA_PIPELINE_ASSERT(zfill <= size_and_align); + _CUDA_PIPELINE_ASSERT(__isShared(dst_shared)); + _CUDA_PIPELINE_ASSERT(__isGlobal(src_global)); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(dst_shared) & (size_and_align - 1))); + _CUDA_PIPELINE_ASSERT(!(reinterpret_cast(src_global) & (size_and_align - 1))); + + switch (size_and_align) { + case 16: + switch (zfill) { + case 0: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 16>(dst_shared, src_global); return; + case 1: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 15>(dst_shared, src_global); return; + case 2: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 14>(dst_shared, src_global); return; + case 3: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 13>(dst_shared, src_global); return; + case 4: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 12>(dst_shared, src_global); return; + case 5: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 11>(dst_shared, src_global); return; + case 6: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 10>(dst_shared, src_global); return; + case 7: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 9>(dst_shared, src_global); return; + case 8: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 8>(dst_shared, src_global); return; + case 9: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 7>(dst_shared, src_global); return; + case 10: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 6>(dst_shared, src_global); return; + case 11: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 5>(dst_shared, src_global); return; + case 12: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 4>(dst_shared, src_global); return; + case 13: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 3>(dst_shared, src_global); return; + case 14: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 2>(dst_shared, src_global); return; + case 15: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 1>(dst_shared, src_global); return; + case 16: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async<16, 0>(dst_shared, src_global); return; + default: _CUDA_PIPELINE_ABORT(); return; + } + case 8: + switch (zfill) { + case 0: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 8, 8>(dst_shared, src_global); return; + case 1: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 8, 7>(dst_shared, src_global); return; + case 2: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 8, 6>(dst_shared, src_global); return; + case 3: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 8, 5>(dst_shared, src_global); return; + case 4: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 8, 4>(dst_shared, src_global); return; + case 5: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 8, 3>(dst_shared, src_global); return; + case 6: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 8, 2>(dst_shared, src_global); return; + case 7: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 8, 1>(dst_shared, src_global); return; + case 8: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 8, 0>(dst_shared, src_global); return; + default: _CUDA_PIPELINE_ABORT(); return; + } + case 4: + switch (zfill) { + case 0: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 4, 4>(dst_shared, src_global); return; + case 1: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 4, 3>(dst_shared, src_global); return; + case 2: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 4, 2>(dst_shared, src_global); return; + case 3: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 4, 1>(dst_shared, src_global); return; + case 4: _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_memcpy_async< 4, 0>(dst_shared, src_global); return; + default: _CUDA_PIPELINE_ABORT(); return; + } + default: + _CUDA_PIPELINE_ABORT(); + return; + } +} + +_CUDA_PIPELINE_STATIC_QUALIFIER +void __pipeline_commit() +{ + _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_commit(); +} + +_CUDA_PIPELINE_STATIC_QUALIFIER +void __pipeline_wait_prior(size_t prior) +{ + switch (prior) { + case 0 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<0>(); return; + case 1 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<1>(); return; + case 2 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<2>(); return; + case 3 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<3>(); return; + case 4 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<4>(); return; + case 5 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<5>(); return; + case 6 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<6>(); return; + case 7 : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<7>(); return; + default : _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_wait_prior<8>(); return; + } +} + +# if defined(_CUDA_PIPELINE_ARCH_700_OR_LATER) +# include "cuda_awbarrier_primitives.h" + +_CUDA_PIPELINE_STATIC_QUALIFIER +void __pipeline_arrive_on(__mbarrier_t* barrier) +{ + _CUDA_PIPELINE_INTERNAL_NAMESPACE::pipeline_arrive_on(barrier); +} +# endif + +#endif /* !_CUDA_PIPELINE_PRIMITIVES_H_ */ diff --git a/cuda_toolkit/include/cuda_profiler_api.h b/cuda_toolkit/include/cuda_profiler_api.h new file mode 100644 index 0000000000000000000000000000000000000000..d2708d400a23e7a80103e3f1b70ec8ece325a483 --- /dev/null +++ b/cuda_toolkit/include/cuda_profiler_api.h @@ -0,0 +1,134 @@ +/* + * Copyright 1993-2012 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_PROFILER_API_H__) +#define __CUDA_PROFILER_API_H__ + +#include "driver_types.h" + +#if defined(__CUDA_API_VERSION_INTERNAL) || defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/** + * \ingroup CUDART + * \defgroup CUDART_PROFILER Profiler Control + * + * ___MANBRIEF___ profiler control functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the profiler control functions of the CUDA runtime + * application programming interface. + * + * @{ + */ + +/** + * \brief Enable profiling. + * + * Enables profile collection by the active profiling tool for the + * current context. If profiling is already enabled, then + * cudaProfilerStart() has no effect. + * + * cudaProfilerStart and cudaProfilerStop APIs are used to + * programmatically control the profiling granularity by allowing + * profiling to be done only on selective pieces of code. + * + * + * \return + * ::cudaSuccess + * \notefnerr + * + * \sa + * ::cudaProfilerStop, + * ::cuProfilerStart + */ +extern __host__ cudaError_t CUDARTAPI cudaProfilerStart(void); + +/** + * \brief Disable profiling. + * + * Disables profile collection by the active profiling tool for the + * current context. If profiling is already disabled, then + * cudaProfilerStop() has no effect. + * + * cudaProfilerStart and cudaProfilerStop APIs are used to + * programmatically control the profiling granularity by allowing + * profiling to be done only on selective pieces of code. + * + * \return + * ::cudaSuccess + * \notefnerr + * + * \sa + * ::cudaProfilerStart, + * ::cuProfilerStop + */ +extern __host__ cudaError_t CUDARTAPI cudaProfilerStop(void); + +/** @} */ /* END CUDART_PROFILER */ + +#undef __CUDA_DEPRECATED + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif /* !__CUDA_PROFILER_API_H__ */ + diff --git a/cuda_toolkit/include/cuda_runtime.h b/cuda_toolkit/include/cuda_runtime.h new file mode 100644 index 0000000000000000000000000000000000000000..cf1d2e8d4a0ca0e5d9751834d0700572d1b3da0f --- /dev/null +++ b/cuda_toolkit/include/cuda_runtime.h @@ -0,0 +1,2374 @@ +/* + * Copyright 1993-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_RUNTIME_H__) +#define __CUDA_RUNTIME_H__ + +#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__) +#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_RUNTIME_H__ +#endif + +#define EXCLUDE_FROM_RTC +#if defined(__GNUC__) +#if defined(__clang__) || (!defined(__PGIC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) +#pragma GCC diagnostic push +#endif +#if defined(__clang__) || (!defined(__PGIC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))) +#pragma GCC diagnostic ignored "-Wunused-function" +#endif +#elif defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable: 4820) +#endif +#ifdef __QNX__ +#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) +typedef unsigned size_t; +#endif +#endif +#undef EXCLUDE_FROM_RTC +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#include "crt/host_config.h" + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#include "builtin_types.h" +#include "library_types.h" +#if !defined(__CUDACC_RTC__) +#define EXCLUDE_FROM_RTC +#include "channel_descriptor.h" +#include "cuda_runtime_api.h" +#include "driver_functions.h" +#undef EXCLUDE_FROM_RTC +#endif /* !__CUDACC_RTC__ */ +#include "crt/host_defines.h" +#ifdef __CUDACC_RTC__ +#include "target" +#endif /* defined(__CUDACC_RTC__) */ + + +#include "vector_functions.h" + +#if defined(__CUDACC__) + +#if defined(__CUDACC_RTC__) +#include "nvrtc_device_runtime.h" +#include "crt/device_functions.h" +#include "crt/common_functions.h" +#include "device_launch_parameters.h" + +#else /* !__CUDACC_RTC__ */ +#define EXCLUDE_FROM_RTC +#include "crt/common_functions.h" +#include "crt/device_functions.h" +#include "device_launch_parameters.h" + +#if defined(__CUDACC_EXTENDED_LAMBDA__) +#include +#include +struct __device_builtin__ __nv_lambda_preheader_injection { }; +#endif /* defined(__CUDACC_EXTENDED_LAMBDA__) */ + +#undef EXCLUDE_FROM_RTC +#endif /* __CUDACC_RTC__ */ + +#endif /* __CUDACC__ */ + +/** \cond impl_private */ +#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif +/** \endcond impl_private */ + +#define EXCLUDE_FROM_RTC +#if defined(__cplusplus) && !defined(__CUDACC_RTC__) + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && (_MSC_VER >= 1900)) +#include +#endif + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +/** + * \addtogroup CUDART_HIGHLEVEL + * @{ + */ + +/** + *\brief Launches a device function + * + * The function invokes kernel \p func on \p gridDim (\p gridDim.x × \p gridDim.y + * × \p gridDim.z) grid of blocks. Each block contains \p blockDim (\p blockDim.x × + * \p blockDim.y × \p blockDim.z) threads. + * + * If the kernel has N parameters the \p args should point to array of N pointers. + * Each pointer, from args[0] to args[N - 1], point to the region + * of memory from which the actual parameter will be copied. + * + * \p sharedMem sets the amount of dynamic shared memory that will be available to + * each thread block. + * + * \p stream specifies a stream the invocation is associated to. + * + * \param func - Device function symbol + * \param gridDim - Grid dimentions + * \param blockDim - Block dimentions + * \param args - Arguments + * \param sharedMem - Shared memory (defaults to 0) + * \param stream - Stream identifier (defaults to NULL) + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidConfiguration, + * ::cudaErrorLaunchFailure, + * ::cudaErrorLaunchTimeout, + * ::cudaErrorLaunchOutOfResources, + * ::cudaErrorSharedObjectInitFailed, + * ::cudaErrorInvalidPtx, + * ::cudaErrorUnsupportedPtxVersion, + * ::cudaErrorNoKernelImageForDevice, + * ::cudaErrorJitCompilerNotFound, + * ::cudaErrorJitCompilationDisabled + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \ref ::cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchKernel (C API)" + */ +template +static __inline__ __host__ cudaError_t cudaLaunchKernel( + const T *func, + dim3 gridDim, + dim3 blockDim, + void **args, + size_t sharedMem = 0, + cudaStream_t stream = 0 +) +{ + return ::cudaLaunchKernel((const void *)func, gridDim, blockDim, args, sharedMem, stream); +} + + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && (_MSC_VER >= 1900)) || defined(__DOXYGEN_ONLY__) +/** + * \brief Launches a CUDA function with launch-time configuration + * + * Invokes the kernel \p func on \p config->gridDim (\p config->gridDim.x + * × \p config->gridDim.y × \p config->gridDim.z) grid of blocks. + * Each block contains \p config->blockDim (\p config->blockDim.x × + * \p config->blockDim.y × \p config->blockDim.z) threads. + * + * \p config->dynamicSmemBytes sets the amount of dynamic shared memory that + * will be available to each thread block. + * + * \p config->stream specifies a stream the invocation is associated to. + * + * Configuration beyond grid and block dimensions, dynamic shared memory size, + * and stream can be provided with the following two fields of \p config: + * + * \p config->attrs is an array of \p config->numAttrs contiguous + * ::cudaLaunchAttribute elements. The value of this pointer is not considered + * if \p config->numAttrs is zero. However, in that case, it is recommended to + * set the pointer to NULL. + * \p config->numAttrs is the number of attributes populating the first + * \p config->numAttrs positions of the \p config->attrs array. + * + * The kernel arguments should be passed as arguments to this function via the + * \p args parameter pack. + * + * The C API version of this function, \p cudaLaunchKernelExC, is also available + * for pre-C++11 compilers and for use cases where the ability to pass kernel + * parameters via void* array is preferable. + * + * \param config - Launch configuration + * \param func - Kernel to launch + * \param args - Parameter pack of kernel parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidConfiguration, + * ::cudaErrorLaunchFailure, + * ::cudaErrorLaunchTimeout, + * ::cudaErrorLaunchOutOfResources, + * ::cudaErrorSharedObjectInitFailed, + * ::cudaErrorInvalidPtx, + * ::cudaErrorUnsupportedPtxVersion, + * ::cudaErrorNoKernelImageForDevice, + * ::cudaErrorJitCompilerNotFound, + * ::cudaErrorJitCompilationDisabled + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaLaunchKernelExC(const cudaLaunchConfig_t *config, const void *func, void **args) "cudaLaunchKernelEx (C API)", + * ::cuLaunchKernelEx + */ +template +static __inline__ __host__ cudaError_t cudaLaunchKernelEx( + const cudaLaunchConfig_t *config, + void (*kernel)(ExpTypes...), + ActTypes &&... args +) +{ + return [&](ExpTypes... coercedArgs){ + void *pArgs[] = { &coercedArgs... }; + return ::cudaLaunchKernelExC(config, (const void *)kernel, pArgs); + }(std::forward(args)...); +} +#endif + +/** + *\brief Launches a device function + * + * The function invokes kernel \p func on \p gridDim (\p gridDim.x × \p gridDim.y + * × \p gridDim.z) grid of blocks. Each block contains \p blockDim (\p blockDim.x × + * \p blockDim.y × \p blockDim.z) threads. + * + * The device on which this kernel is invoked must have a non-zero value for + * the device attribute ::cudaDevAttrCooperativeLaunch. + * + * The total number of blocks launched cannot exceed the maximum number of blocks per + * multiprocessor as returned by ::cudaOccupancyMaxActiveBlocksPerMultiprocessor (or + * ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags) times the number of multiprocessors + * as specified by the device attribute ::cudaDevAttrMultiProcessorCount. + * + * The kernel cannot make use of CUDA dynamic parallelism. + * + * If the kernel has N parameters the \p args should point to array of N pointers. + * Each pointer, from args[0] to args[N - 1], point to the region + * of memory from which the actual parameter will be copied. + * + * \p sharedMem sets the amount of dynamic shared memory that will be available to + * each thread block. + * + * \p stream specifies a stream the invocation is associated to. + * + * \param func - Device function symbol + * \param gridDim - Grid dimentions + * \param blockDim - Block dimentions + * \param args - Arguments + * \param sharedMem - Shared memory (defaults to 0) + * \param stream - Stream identifier (defaults to NULL) + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidConfiguration, + * ::cudaErrorLaunchFailure, + * ::cudaErrorLaunchTimeout, + * ::cudaErrorLaunchOutOfResources, + * ::cudaErrorSharedObjectInitFailed + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \ref ::cudaLaunchCooperativeKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchCooperativeKernel (C API)" + */ +template +static __inline__ __host__ cudaError_t cudaLaunchCooperativeKernel( + const T *func, + dim3 gridDim, + dim3 blockDim, + void **args, + size_t sharedMem = 0, + cudaStream_t stream = 0 +) +{ + return ::cudaLaunchCooperativeKernel((const void *)func, gridDim, blockDim, args, sharedMem, stream); +} + +/** + * \brief \hl Creates an event object with the specified flags + * + * Creates an event object with the specified flags. Valid flags include: + * - ::cudaEventDefault: Default event creation flag. + * - ::cudaEventBlockingSync: Specifies that event should use blocking + * synchronization. A host thread that uses ::cudaEventSynchronize() to wait + * on an event created with this flag will block until the event actually + * completes. + * - ::cudaEventDisableTiming: Specifies that the created event does not need + * to record timing data. Events created with this flag specified and + * the ::cudaEventBlockingSync flag not specified will provide the best + * performance when used with ::cudaStreamWaitEvent() and ::cudaEventQuery(). + * + * \param event - Newly created event + * \param flags - Flags for new event + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorLaunchFailure, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa \ref ::cudaEventCreate(cudaEvent_t*) "cudaEventCreate (C API)", + * ::cudaEventCreateWithFlags, ::cudaEventRecord, ::cudaEventQuery, + * ::cudaEventSynchronize, ::cudaEventDestroy, ::cudaEventElapsedTime, + * ::cudaStreamWaitEvent + */ +static __inline__ __host__ cudaError_t cudaEventCreate( + cudaEvent_t *event, + unsigned int flags +) +{ + return ::cudaEventCreateWithFlags(event, flags); +} + +/** + * \brief Creates an executable graph from a graph + * + * Instantiates \p graph as an executable graph. The graph is validated for any + * structural constraints or intra-node constraints which were not previously + * validated. If instantiation is successful, a handle to the instantiated graph + * is returned in \p pGraphExec. + * + * If there are any errors, diagnostic information may be returned in \p pErrorNode and + * \p pLogBuffer. This is the primary way to inspect instantiation errors. The output + * will be null terminated unless the diagnostics overflow + * the buffer. In this case, they will be truncated, and the last byte can be + * inspected to determine if truncation occurred. + * + * \param pGraphExec - Returns instantiated graph + * \param graph - Graph to instantiate + * \param pErrorNode - In case of an instantiation error, this may be modified to + * indicate a node contributing to the error + * \param pLogBuffer - A character buffer to store diagnostic messages + * \param bufferSize - Size of the log buffer in bytes + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphInstantiateWithFlags, + * ::cudaGraphCreate, + * ::cudaGraphUpload, + * ::cudaGraphLaunch, + * ::cudaGraphExecDestroy + */ +static __inline__ __host__ cudaError_t cudaGraphInstantiate( + cudaGraphExec_t *pGraphExec, + cudaGraph_t graph, + cudaGraphNode_t *pErrorNode, + char *pLogBuffer, + size_t bufferSize +) +{ + (void)pErrorNode; + (void)pLogBuffer; + (void)bufferSize; + return ::cudaGraphInstantiate(pGraphExec, graph, 0); +} + +/** + * \brief \hl Allocates page-locked memory on the host + * + * Allocates \p size bytes of host memory that is page-locked and accessible + * to the device. The driver tracks the virtual memory ranges allocated with + * this function and automatically accelerates calls to functions such as + * ::cudaMemcpy(). Since the memory can be accessed directly by the device, it + * can be read or written with much higher bandwidth than pageable memory + * obtained with functions such as ::malloc(). Allocating excessive amounts of + * pinned memory may degrade system performance, since it reduces the amount + * of memory available to the system for paging. As a result, this function is + * best used sparingly to allocate staging areas for data exchange between host + * and device. + * + * The \p flags parameter enables different options to be specified that affect + * the allocation, as follows. + * - ::cudaHostAllocDefault: This flag's value is defined to be 0. + * - ::cudaHostAllocPortable: The memory returned by this call will be + * considered as pinned memory by all CUDA contexts, not just the one that + * performed the allocation. + * - ::cudaHostAllocMapped: Maps the allocation into the CUDA address space. + * The device pointer to the memory may be obtained by calling + * ::cudaHostGetDevicePointer(). + * - ::cudaHostAllocWriteCombined: Allocates the memory as write-combined (WC). + * WC memory can be transferred across the PCI Express bus more quickly on some + * system configurations, but cannot be read efficiently by most CPUs. WC + * memory is a good option for buffers that will be written by the CPU and read + * by the device via mapped pinned memory or host->device transfers. + * + * All of these flags are orthogonal to one another: a developer may allocate + * memory that is portable, mapped and/or write-combined with no restrictions. + * + * ::cudaSetDeviceFlags() must have been called with the ::cudaDeviceMapHost + * flag in order for the ::cudaHostAllocMapped flag to have any effect. + * + * The ::cudaHostAllocMapped flag may be specified on CUDA contexts for devices + * that do not support mapped pinned memory. The failure is deferred to + * ::cudaHostGetDevicePointer() because the memory may be mapped into other + * CUDA contexts via the ::cudaHostAllocPortable flag. + * + * Memory allocated by this function must be freed with ::cudaFreeHost(). + * + * \param ptr - Device pointer to allocated memory + * \param size - Requested allocation size in bytes + * \param flags - Requested properties of allocated memory + * + * \return + * ::cudaSuccess, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaSetDeviceFlags, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaHostAlloc + */ +static __inline__ __host__ cudaError_t cudaMallocHost( + void **ptr, + size_t size, + unsigned int flags +) +{ + return ::cudaHostAlloc(ptr, size, flags); +} + +template +static __inline__ __host__ cudaError_t cudaHostAlloc( + T **ptr, + size_t size, + unsigned int flags +) +{ + return ::cudaHostAlloc((void**)(void*)ptr, size, flags); +} + +template +static __inline__ __host__ cudaError_t cudaHostGetDevicePointer( + T **pDevice, + void *pHost, + unsigned int flags +) +{ + return ::cudaHostGetDevicePointer((void**)(void*)pDevice, pHost, flags); +} + +/** + * \brief Allocates memory that will be automatically managed by the Unified Memory system + * + * Allocates \p size bytes of managed memory on the device and returns in + * \p *devPtr a pointer to the allocated memory. If the device doesn't support + * allocating managed memory, ::cudaErrorNotSupported is returned. Support + * for managed memory can be queried using the device attribute + * ::cudaDevAttrManagedMemory. The allocated memory is suitably + * aligned for any kind of variable. The memory is not cleared. If \p size + * is 0, ::cudaMallocManaged returns ::cudaErrorInvalidValue. The pointer + * is valid on the CPU and on all GPUs in the system that support managed memory. + * All accesses to this pointer must obey the Unified Memory programming model. + * + * \p flags specifies the default stream association for this allocation. + * \p flags must be one of ::cudaMemAttachGlobal or ::cudaMemAttachHost. The + * default value for \p flags is ::cudaMemAttachGlobal. + * If ::cudaMemAttachGlobal is specified, then this memory is accessible from + * any stream on any device. If ::cudaMemAttachHost is specified, then the + * allocation should not be accessed from devices that have a zero value for the + * device attribute ::cudaDevAttrConcurrentManagedAccess; an explicit call to + * ::cudaStreamAttachMemAsync will be required to enable access on such devices. + * + * If the association is later changed via ::cudaStreamAttachMemAsync to + * a single stream, the default association, as specifed during ::cudaMallocManaged, + * is restored when that stream is destroyed. For __managed__ variables, the + * default association is always ::cudaMemAttachGlobal. Note that destroying a + * stream is an asynchronous operation, and as a result, the change to default + * association won't happen until all work in the stream has completed. + * + * Memory allocated with ::cudaMallocManaged should be released with ::cudaFree. + * + * Device memory oversubscription is possible for GPUs that have a non-zero value for the + * device attribute ::cudaDevAttrConcurrentManagedAccess. Managed memory on + * such GPUs may be evicted from device memory to host memory at any time by the Unified + * Memory driver in order to make room for other allocations. + * + * In a multi-GPU system where all GPUs have a non-zero value for the device attribute + * ::cudaDevAttrConcurrentManagedAccess, managed memory may not be populated when this + * API returns and instead may be populated on access. In such systems, managed memory can + * migrate to any processor's memory at any time. The Unified Memory driver will employ heuristics to + * maintain data locality and prevent excessive page faults to the extent possible. The application + * can also guide the driver about memory usage patterns via ::cudaMemAdvise. The application + * can also explicitly migrate memory to a desired processor's memory via + * ::cudaMemPrefetchAsync. + * + * In a multi-GPU system where all of the GPUs have a zero value for the device attribute + * ::cudaDevAttrConcurrentManagedAccess and all the GPUs have peer-to-peer support + * with each other, the physical storage for managed memory is created on the GPU which is active + * at the time ::cudaMallocManaged is called. All other GPUs will reference the data at reduced + * bandwidth via peer mappings over the PCIe bus. The Unified Memory driver does not migrate + * memory among such GPUs. + * + * In a multi-GPU system where not all GPUs have peer-to-peer support with each other and + * where the value of the device attribute ::cudaDevAttrConcurrentManagedAccess + * is zero for at least one of those GPUs, the location chosen for physical storage of managed + * memory is system-dependent. + * - On Linux, the location chosen will be device memory as long as the current set of active + * contexts are on devices that either have peer-to-peer support with each other or have a + * non-zero value for the device attribute ::cudaDevAttrConcurrentManagedAccess. + * If there is an active context on a GPU that does not have a non-zero value for that device + * attribute and it does not have peer-to-peer support with the other devices that have active + * contexts on them, then the location for physical storage will be 'zero-copy' or host memory. + * Note that this means that managed memory that is located in device memory is migrated to + * host memory if a new context is created on a GPU that doesn't have a non-zero value for + * the device attribute and does not support peer-to-peer with at least one of the other devices + * that has an active context. This in turn implies that context creation may fail if there is + * insufficient host memory to migrate all managed allocations. + * - On Windows, the physical storage is always created in 'zero-copy' or host memory. + * All GPUs will reference the data at reduced bandwidth over the PCIe bus. In these + * circumstances, use of the environment variable CUDA_VISIBLE_DEVICES is recommended to + * restrict CUDA to only use those GPUs that have peer-to-peer support. + * Alternatively, users can also set CUDA_MANAGED_FORCE_DEVICE_ALLOC to a non-zero + * value to force the driver to always use device memory for physical storage. + * When this environment variable is set to a non-zero value, all devices used in + * that process that support managed memory have to be peer-to-peer compatible + * with each other. The error ::cudaErrorInvalidDevice will be returned if a device + * that supports managed memory is used and it is not peer-to-peer compatible with + * any of the other managed memory supporting devices that were previously used in + * that process, even if ::cudaDeviceReset has been called on those devices. These + * environment variables are described in the CUDA programming guide under the + * "CUDA environment variables" section. + * - On ARM, managed memory is not available on discrete gpu with Drive PX-2. + * + * \param devPtr - Pointer to allocated device memory + * \param size - Requested allocation size in bytes + * \param flags - Must be either ::cudaMemAttachGlobal or ::cudaMemAttachHost (defaults to ::cudaMemAttachGlobal) + * + * \return + * ::cudaSuccess, + * ::cudaErrorMemoryAllocation, + * ::cudaErrorNotSupported, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa ::cudaMallocPitch, ::cudaFree, ::cudaMallocArray, ::cudaFreeArray, + * ::cudaMalloc3D, ::cudaMalloc3DArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaHostAlloc, ::cudaDeviceGetAttribute, ::cudaStreamAttachMemAsync + */ +template +static __inline__ __host__ cudaError_t cudaMallocManaged( + T **devPtr, + size_t size, + unsigned int flags = cudaMemAttachGlobal +) +{ + return ::cudaMallocManaged((void**)(void*)devPtr, size, flags); +} + +/** + * \brief Advise about the usage of a given memory range. + * + * This is an alternate spelling for cudaMemAdvise made available through operator overloading. + * + * \sa ::cudaMemAdvise, + * \ref ::cudaMemAdvise(const void* devPtr, size_t count, enum cudaMemoryAdvise advice, struct cudaMemLocation location) "cudaMemAdvise (C API)" + */ +template +cudaError_t cudaMemAdvise( + T *devPtr, + size_t count, + enum cudaMemoryAdvise advice, + struct cudaMemLocation location +) +{ + return ::cudaMemAdvise_v2((const void *)devPtr, count, advice, location); +} + +template +static __inline__ __host__ cudaError_t cudaMemPrefetchAsync( + T *devPtr, + size_t count, + struct cudaMemLocation location, + unsigned int flags, + cudaStream_t stream = 0 +) +{ + return ::cudaMemPrefetchAsync_v2((const void *)devPtr, count, location, flags, stream); +} + +/** + * \brief Attach memory to a stream asynchronously + * + * Enqueues an operation in \p stream to specify stream association of + * \p length bytes of memory starting from \p devPtr. This function is a + * stream-ordered operation, meaning that it is dependent on, and will + * only take effect when, previous work in stream has completed. Any + * previous association is automatically replaced. + * + * \p devPtr must point to an one of the following types of memories: + * - managed memory declared using the __managed__ keyword or allocated with + * ::cudaMallocManaged. + * - a valid host-accessible region of system-allocated pageable memory. This + * type of memory may only be specified if the device associated with the + * stream reports a non-zero value for the device attribute + * ::cudaDevAttrPageableMemoryAccess. + * + * For managed allocations, \p length must be either zero or the entire + * allocation's size. Both indicate that the entire allocation's stream + * association is being changed. Currently, it is not possible to change stream + * association for a portion of a managed allocation. + * + * For pageable allocations, \p length must be non-zero. + * + * The stream association is specified using \p flags which must be + * one of ::cudaMemAttachGlobal, ::cudaMemAttachHost or ::cudaMemAttachSingle. + * The default value for \p flags is ::cudaMemAttachSingle + * If the ::cudaMemAttachGlobal flag is specified, the memory can be accessed + * by any stream on any device. + * If the ::cudaMemAttachHost flag is specified, the program makes a guarantee + * that it won't access the memory on the device from any stream on a device that + * has a zero value for the device attribute ::cudaDevAttrConcurrentManagedAccess. + * If the ::cudaMemAttachSingle flag is specified and \p stream is associated with + * a device that has a zero value for the device attribute ::cudaDevAttrConcurrentManagedAccess, + * the program makes a guarantee that it will only access the memory on the device + * from \p stream. It is illegal to attach singly to the NULL stream, because the + * NULL stream is a virtual global stream and not a specific stream. An error will + * be returned in this case. + * + * When memory is associated with a single stream, the Unified Memory system will + * allow CPU access to this memory region so long as all operations in \p stream + * have completed, regardless of whether other streams are active. In effect, + * this constrains exclusive ownership of the managed memory region by + * an active GPU to per-stream activity instead of whole-GPU activity. + * + * Accessing memory on the device from streams that are not associated with + * it will produce undefined results. No error checking is performed by the + * Unified Memory system to ensure that kernels launched into other streams + * do not access this region. + * + * It is a program's responsibility to order calls to ::cudaStreamAttachMemAsync + * via events, synchronization or other means to ensure legal access to memory + * at all times. Data visibility and coherency will be changed appropriately + * for all kernels which follow a stream-association change. + * + * If \p stream is destroyed while data is associated with it, the association is + * removed and the association reverts to the default visibility of the allocation + * as specified at ::cudaMallocManaged. For __managed__ variables, the default + * association is always ::cudaMemAttachGlobal. Note that destroying a stream is an + * asynchronous operation, and as a result, the change to default association won't + * happen until all work in the stream has completed. + * + * \param stream - Stream in which to enqueue the attach operation + * \param devPtr - Pointer to memory (must be a pointer to managed memory or + * to a valid host-accessible region of system-allocated + * memory) + * \param length - Length of memory (defaults to zero) + * \param flags - Must be one of ::cudaMemAttachGlobal, ::cudaMemAttachHost or ::cudaMemAttachSingle (defaults to ::cudaMemAttachSingle) + * + * \return + * ::cudaSuccess, + * ::cudaErrorNotReady, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreate, ::cudaStreamCreateWithFlags, ::cudaStreamWaitEvent, ::cudaStreamSynchronize, ::cudaStreamAddCallback, ::cudaStreamDestroy, ::cudaMallocManaged + */ +template +static __inline__ __host__ cudaError_t cudaStreamAttachMemAsync( + cudaStream_t stream, + T *devPtr, + size_t length = 0, + unsigned int flags = cudaMemAttachSingle +) +{ + return ::cudaStreamAttachMemAsync(stream, (void*)devPtr, length, flags); +} + +template +static __inline__ __host__ cudaError_t cudaMalloc( + T **devPtr, + size_t size +) +{ + return ::cudaMalloc((void**)(void*)devPtr, size); +} + +template +static __inline__ __host__ cudaError_t cudaMallocHost( + T **ptr, + size_t size, + unsigned int flags = 0 +) +{ + return cudaMallocHost((void**)(void*)ptr, size, flags); +} + +template +static __inline__ __host__ cudaError_t cudaMallocPitch( + T **devPtr, + size_t *pitch, + size_t width, + size_t height +) +{ + return ::cudaMallocPitch((void**)(void*)devPtr, pitch, width, height); +} + +/** + * \brief Allocate from a pool + * + * This is an alternate spelling for cudaMallocFromPoolAsync + * made available through operator overloading. + * + * \sa ::cudaMallocFromPoolAsync, + * \ref ::cudaMallocAsync(void** ptr, size_t size, cudaStream_t hStream) "cudaMallocAsync (C API)" + */ +static __inline__ __host__ cudaError_t cudaMallocAsync( + void **ptr, + size_t size, + cudaMemPool_t memPool, + cudaStream_t stream +) +{ + return ::cudaMallocFromPoolAsync(ptr, size, memPool, stream); +} + +template +static __inline__ __host__ cudaError_t cudaMallocAsync( + T **ptr, + size_t size, + cudaMemPool_t memPool, + cudaStream_t stream +) +{ + return ::cudaMallocFromPoolAsync((void**)(void*)ptr, size, memPool, stream); +} + +template +static __inline__ __host__ cudaError_t cudaMallocAsync( + T **ptr, + size_t size, + cudaStream_t stream +) +{ + return ::cudaMallocAsync((void**)(void*)ptr, size, stream); +} + +template +static __inline__ __host__ cudaError_t cudaMallocFromPoolAsync( + T **ptr, + size_t size, + cudaMemPool_t memPool, + cudaStream_t stream +) +{ + return ::cudaMallocFromPoolAsync((void**)(void*)ptr, size, memPool, stream); +} + +#if defined(__CUDACC__) + +/** + * \brief \hl Copies data to the given symbol on the device + * + * Copies \p count bytes from the memory area pointed to by \p src + * to the memory area \p offset bytes from the start of symbol + * \p symbol. The memory areas may not overlap. \p symbol is a variable that + * resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToDevice. + * + * \param symbol - Device symbol reference + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorInvalidMemcpyDirection, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_sync + * \note_string_api_deprecation + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync + */ +template +static __inline__ __host__ cudaError_t cudaMemcpyToSymbol( + const T &symbol, + const void *src, + size_t count, + size_t offset = 0, + enum cudaMemcpyKind kind = cudaMemcpyHostToDevice +) +{ + return ::cudaMemcpyToSymbol((const void*)&symbol, src, count, offset, kind); +} + +/** + * \brief \hl Copies data to the given symbol on the device + * + * Copies \p count bytes from the memory area pointed to by \p src + * to the memory area \p offset bytes from the start of symbol + * \p symbol. The memory areas may not overlap. \p symbol is a variable that + * resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToDevice. + * + * ::cudaMemcpyToSymbolAsync() is asynchronous with respect to the host, so + * the call may return before the copy is complete. The copy can optionally + * be associated to a stream by passing a non-zero \p stream argument. If + * \p kind is ::cudaMemcpyHostToDevice and \p stream is non-zero, the copy + * may overlap with operations in other streams. + * + * \param symbol - Device symbol reference + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorInvalidMemcpyDirection, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_async + * \note_string_api_deprecation + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyFromSymbolAsync + */ +template +static __inline__ __host__ cudaError_t cudaMemcpyToSymbolAsync( + const T &symbol, + const void *src, + size_t count, + size_t offset = 0, + enum cudaMemcpyKind kind = cudaMemcpyHostToDevice, + cudaStream_t stream = 0 +) +{ + return ::cudaMemcpyToSymbolAsync((const void*)&symbol, src, count, offset, kind, stream); +} + +/** + * \brief \hl Copies data from the given symbol on the device + * + * Copies \p count bytes from the memory area \p offset bytes + * from the start of symbol \p symbol to the memory area pointed to by \p dst. + * The memory areas may not overlap. \p symbol is a variable that + * resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyDeviceToHost or ::cudaMemcpyDeviceToDevice. + * + * \param dst - Destination memory address + * \param symbol - Device symbol reference + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorInvalidMemcpyDirection, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_sync + * \note_string_api_deprecation + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync + */ +template +static __inline__ __host__ cudaError_t cudaMemcpyFromSymbol( + void *dst, + const T &symbol, + size_t count, + size_t offset = 0, + enum cudaMemcpyKind kind = cudaMemcpyDeviceToHost +) +{ + return ::cudaMemcpyFromSymbol(dst, (const void*)&symbol, count, offset, kind); +} + +/** + * \brief \hl Copies data from the given symbol on the device + * + * Copies \p count bytes from the memory area \p offset bytes + * from the start of symbol \p symbol to the memory area pointed to by \p dst. + * The memory areas may not overlap. \p symbol is a variable that resides in + * global or constant memory space. \p kind can be either + * ::cudaMemcpyDeviceToHost or ::cudaMemcpyDeviceToDevice. + * + * ::cudaMemcpyFromSymbolAsync() is asynchronous with respect to the host, so + * the call may return before the copy is complete. The copy can optionally be + * associated to a stream by passing a non-zero \p stream argument. If \p kind + * is ::cudaMemcpyDeviceToHost and \p stream is non-zero, the copy may overlap + * with operations in other streams. + * + * \param dst - Destination memory address + * \param symbol - Device symbol reference + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorInvalidMemcpyDirection, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_async + * \note_string_api_deprecation + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync + */ +template +static __inline__ __host__ cudaError_t cudaMemcpyFromSymbolAsync( + void *dst, + const T &symbol, + size_t count, + size_t offset = 0, + enum cudaMemcpyKind kind = cudaMemcpyDeviceToHost, + cudaStream_t stream = 0 +) +{ + return ::cudaMemcpyFromSymbolAsync(dst, (const void*)&symbol, count, offset, kind, stream); +} + +/** + * \brief Creates a memcpy node to copy to a symbol on the device and adds it to a graph + * + * Creates a new memcpy node to copy to \p symbol and adds it to \p graph with + * \p numDependencies dependencies specified via \p pDependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * When the graph is launched, the node will copy \p count bytes from the memory area + * pointed to by \p src to the memory area pointed to by \p offset bytes from the start + * of symbol \p symbol. The memory areas may not overlap. \p symbol is a variable that + * resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of + * transfer is inferred from the pointer values. However, ::cudaMemcpyDefault + * is only allowed on systems that support unified virtual addressing. + * + * Memcpy nodes have some additional restrictions with regards to managed memory, if the + * system contains at least one device which has a zero value for the device attribute + * ::cudaDevAttrConcurrentManagedAccess. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param symbol - Device symbol address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpyToSymbol, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemcpyNodeFromSymbol, + * ::cudaGraphMemcpyNodeGetParams, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsToSymbol, + * ::cudaGraphMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemsetNode + */ +template +static __inline__ __host__ cudaError_t cudaGraphAddMemcpyNodeToSymbol( + cudaGraphNode_t *pGraphNode, + cudaGraph_t graph, + const cudaGraphNode_t *pDependencies, + size_t numDependencies, + const T &symbol, + const void* src, + size_t count, + size_t offset, + enum cudaMemcpyKind kind) +{ + return ::cudaGraphAddMemcpyNodeToSymbol(pGraphNode, graph, pDependencies, numDependencies, (const void*)&symbol, src, count, offset, kind); +} + +/** + * \brief Creates a memcpy node to copy from a symbol on the device and adds it to a graph + * + * Creates a new memcpy node to copy from \p symbol and adds it to \p graph with + * \p numDependencies dependencies specified via \p pDependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * When the graph is launched, the node will copy \p count bytes from the memory area + * pointed to by \p offset bytes from the start of symbol \p symbol to the memory area + * pointed to by \p dst. The memory areas may not overlap. \p symbol is a variable + * that resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyDeviceToHost, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of transfer + * is inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * Memcpy nodes have some additional restrictions with regards to managed memory, if the + * system contains at least one device which has a zero value for the device attribute + * ::cudaDevAttrConcurrentManagedAccess. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param dst - Destination memory address + * \param symbol - Device symbol address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpyFromSymbol, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemcpyNodeToSymbol, + * ::cudaGraphMemcpyNodeGetParams, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphMemcpyNodeSetParamsToSymbol, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemsetNode + */ +template +static __inline__ __host__ cudaError_t cudaGraphAddMemcpyNodeFromSymbol( + cudaGraphNode_t* pGraphNode, + cudaGraph_t graph, + const cudaGraphNode_t* pDependencies, + size_t numDependencies, + void* dst, + const T &symbol, + size_t count, + size_t offset, + enum cudaMemcpyKind kind) +{ + return ::cudaGraphAddMemcpyNodeFromSymbol(pGraphNode, graph, pDependencies, numDependencies, dst, (const void*)&symbol, count, offset, kind); +} + +/** + * \brief Sets a memcpy node's parameters to copy to a symbol on the device + * + * Sets the parameters of memcpy node \p node to the copy described by the provided parameters. + * + * When the graph is launched, the node will copy \p count bytes from the memory area + * pointed to by \p src to the memory area pointed to by \p offset bytes from the start + * of symbol \p symbol. The memory areas may not overlap. \p symbol is a variable that + * resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of + * transfer is inferred from the pointer values. However, ::cudaMemcpyDefault + * is only allowed on systems that support unified virtual addressing. + * + * \param node - Node to set the parameters for + * \param symbol - Device symbol address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpyToSymbol, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphMemcpyNodeGetParams + */ +template +static __inline__ __host__ cudaError_t cudaGraphMemcpyNodeSetParamsToSymbol( + cudaGraphNode_t node, + const T &symbol, + const void* src, + size_t count, + size_t offset, + enum cudaMemcpyKind kind) +{ + return ::cudaGraphMemcpyNodeSetParamsToSymbol(node, (const void*)&symbol, src, count, offset, kind); +} + +/** + * \brief Sets a memcpy node's parameters to copy from a symbol on the device + * + * Sets the parameters of memcpy node \p node to the copy described by the provided parameters. + * + * When the graph is launched, the node will copy \p count bytes from the memory area + * pointed to by \p offset bytes from the start of symbol \p symbol to the memory area + * pointed to by \p dst. The memory areas may not overlap. \p symbol is a variable + * that resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyDeviceToHost, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of transfer + * is inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * \param node - Node to set the parameters for + * \param dst - Destination memory address + * \param symbol - Device symbol address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpyFromSymbol, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsToSymbol, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphMemcpyNodeGetParams + */ +template +static __inline__ __host__ cudaError_t cudaGraphMemcpyNodeSetParamsFromSymbol( + cudaGraphNode_t node, + void* dst, + const T &symbol, + size_t count, + size_t offset, + enum cudaMemcpyKind kind) +{ + return ::cudaGraphMemcpyNodeSetParamsFromSymbol(node, dst, (const void*)&symbol, count, offset, kind); +} + +/** + * \brief Sets the parameters for a memcpy node in the given graphExec to copy to a symbol on the device + * + * Updates the work represented by \p node in \p hGraphExec as though \p node had + * contained the given params at instantiation. \p node must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from \p node are ignored. + * + * \p src and \p symbol must be allocated from the same contexts as the original source and + * destination memory. The instantiation-time memory operands must be 1-dimensional. + * Zero-length operations are not supported. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. \p node is also + * not modified by this call. + * + * Returns ::cudaErrorInvalidValue if the memory operands' mappings changed or + * the original memory operands are multidimensional. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param node - Memcpy node from the graph which was used to instantiate graphExec + * \param symbol - Device symbol address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemcpyNodeToSymbol, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsToSymbol, + * ::cudaGraphInstantiate, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams + */ +template +static __inline__ __host__ cudaError_t cudaGraphExecMemcpyNodeSetParamsToSymbol( + cudaGraphExec_t hGraphExec, + cudaGraphNode_t node, + const T &symbol, + const void* src, + size_t count, + size_t offset, + enum cudaMemcpyKind kind) +{ + return ::cudaGraphExecMemcpyNodeSetParamsToSymbol(hGraphExec, node, (const void*)&symbol, src, count, offset, kind); +} + +/** + * \brief Sets the parameters for a memcpy node in the given graphExec to copy from a symbol on the device + * + * Updates the work represented by \p node in \p hGraphExec as though \p node had + * contained the given params at instantiation. \p node must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from \p node are ignored. + * + * \p symbol and \p dst must be allocated from the same contexts as the original source and + * destination memory. The instantiation-time memory operands must be 1-dimensional. + * Zero-length operations are not supported. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. \p node is also + * not modified by this call. + * + * Returns ::cudaErrorInvalidValue if the memory operands' mappings changed or + * the original memory operands are multidimensional. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param node - Memcpy node from the graph which was used to instantiate graphExec + * \param dst - Destination memory address + * \param symbol - Device symbol address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemcpyNodeFromSymbol, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphInstantiate, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParamsToSymbol, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams + */ +template +static __inline__ __host__ cudaError_t cudaGraphExecMemcpyNodeSetParamsFromSymbol( + cudaGraphExec_t hGraphExec, + cudaGraphNode_t node, + void* dst, + const T &symbol, + size_t count, + size_t offset, + enum cudaMemcpyKind kind) +{ + return ::cudaGraphExecMemcpyNodeSetParamsFromSymbol(hGraphExec, node, dst, (const void*)&symbol, count, offset, kind); +} + +// convenience function to avoid source breakage in c++ code +static __inline__ __host__ cudaError_t CUDARTAPI cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphNode_t *hErrorNode_out, enum cudaGraphExecUpdateResult *updateResult_out) +{ + cudaGraphExecUpdateResultInfo resultInfo; + cudaError_t status = cudaGraphExecUpdate(hGraphExec, hGraph, &resultInfo); + if (hErrorNode_out) { + *hErrorNode_out = resultInfo.errorNode; + } + if (updateResult_out) { + *updateResult_out = resultInfo.result; + } + return status; +} + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && (_MSC_VER >= 1900)) + +/** + * \brief Creates a user object by wrapping a C++ object + * + * TODO detail + * + * \param object_out - Location to return the user object handle + * \param objectToWrap - This becomes the \ptr argument to ::cudaUserObjectCreate. A + * lambda will be passed for the \p destroy argument, which calls + * delete on this object pointer. + * \param initialRefcount - The initial refcount to create the object with, typically 1. The + * initial references are owned by the calling thread. + * \param flags - Currently it is required to pass cudaUserObjectNoDestructorSync, + * which is the only defined flag. This indicates that the destroy + * callback cannot be waited on by any CUDA API. Users requiring + * synchronization of the callback should signal its completion + * manually. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * + * \sa + * ::cudaUserObjectCreate + */ +template +static __inline__ __host__ cudaError_t cudaUserObjectCreate( + cudaUserObject_t *object_out, + T *objectToWrap, + unsigned int initialRefcount, + unsigned int flags) +{ + return ::cudaUserObjectCreate( + object_out, + objectToWrap, + [](void *vpObj) { delete reinterpret_cast(vpObj); }, + initialRefcount, + flags); +} + +template +static __inline__ __host__ cudaError_t cudaUserObjectCreate( + cudaUserObject_t *object_out, + T *objectToWrap, + unsigned int initialRefcount, + cudaUserObjectFlags flags) +{ + return cudaUserObjectCreate(object_out, objectToWrap, initialRefcount, (unsigned int)flags); +} + +#endif + +/** + * \brief \hl Finds the address associated with a CUDA symbol + * + * Returns in \p *devPtr the address of symbol \p symbol on the device. + * \p symbol can either be a variable that resides in global or constant memory space. + * If \p symbol cannot be found, or if \p symbol is not declared + * in the global or constant memory space, \p *devPtr is unchanged and the error + * ::cudaErrorInvalidSymbol is returned. + * + * \param devPtr - Return device pointer associated with symbol + * \param symbol - Device symbol reference + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa \ref ::cudaGetSymbolAddress(void**, const void*) "cudaGetSymbolAddress (C API)", + * \ref ::cudaGetSymbolSize(size_t*, const T&) "cudaGetSymbolSize (C++ API)" + */ +template +static __inline__ __host__ cudaError_t cudaGetSymbolAddress( + void **devPtr, + const T &symbol +) +{ + return ::cudaGetSymbolAddress(devPtr, (const void*)&symbol); +} + +/** + * \brief \hl Finds the size of the object associated with a CUDA symbol + * + * Returns in \p *size the size of symbol \p symbol. \p symbol must be a + * variable that resides in global or constant memory space. + * If \p symbol cannot be found, or if \p symbol is not declared + * in global or constant memory space, \p *size is unchanged and the error + * ::cudaErrorInvalidSymbol is returned. + * + * \param size - Size of object associated with symbol + * \param symbol - Device symbol reference + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa \ref ::cudaGetSymbolAddress(void**, const T&) "cudaGetSymbolAddress (C++ API)", + * \ref ::cudaGetSymbolSize(size_t*, const void*) "cudaGetSymbolSize (C API)" + */ +template +static __inline__ __host__ cudaError_t cudaGetSymbolSize( + size_t *size, + const T &symbol +) +{ + return ::cudaGetSymbolSize(size, (const void*)&symbol); +} + +/** + * \brief \hl Sets the preferred cache configuration for a device function + * + * On devices where the L1 cache and shared memory use the same hardware + * resources, this sets through \p cacheConfig the preferred cache configuration + * for the function specified via \p func. This is only a preference. The + * runtime will use the requested configuration if possible, but it is free to + * choose a different configuration if required to execute \p func. + * + * \p func must be a pointer to a function that executes on the device. + * The parameter specified by \p func must be declared as a \p __global__ + * function. If the specified function does not exist, + * then ::cudaErrorInvalidDeviceFunction is returned. + * + * This setting does nothing on devices where the size of the L1 cache and + * shared memory are fixed. + * + * Launching a kernel with a different preference than the most recent + * preference setting may insert a device-side synchronization point. + * + * The supported cache configurations are: + * - ::cudaFuncCachePreferNone: no preference for shared memory or L1 (default) + * - ::cudaFuncCachePreferShared: prefer larger shared memory and smaller L1 cache + * - ::cudaFuncCachePreferL1: prefer larger L1 cache and smaller shared memory + * + * \param func - device function pointer + * \param cacheConfig - Requested cache configuration + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction + * \notefnerr + * \note_init_rt + * \note_callback + * + * \ref ::cudaLaunchKernel(const T *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchKernel (C++ API)", + * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)", + * \ref ::cudaFuncGetAttributes(struct cudaFuncAttributes*, T*) "cudaFuncGetAttributes (C++ API)", + * ::cudaSetDoubleForDevice, + * ::cudaSetDoubleForHost, + * ::cudaThreadGetCacheConfig, + * ::cudaThreadSetCacheConfig + */ +template +static __inline__ __host__ cudaError_t cudaFuncSetCacheConfig( + T *func, + enum cudaFuncCache cacheConfig +) +{ + return ::cudaFuncSetCacheConfig((const void*)func, cacheConfig); +} + +template +static __inline__ +__CUDA_DEPRECATED +__host__ cudaError_t cudaFuncSetSharedMemConfig( + T *func, + enum cudaSharedMemConfig config +) +{ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#elif defined(_MSC_VER) +#pragma warning(suppress: 4996) +#endif + return ::cudaFuncSetSharedMemConfig((const void*)func, config); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +} + +#endif // __CUDACC__ + +/** + * \brief Returns occupancy for a device function + * + * Returns in \p *numBlocks the maximum number of active blocks per + * streaming multiprocessor for the device function. + * + * \param numBlocks - Returned occupancy + * \param func - Kernel function for which occupancy is calulated + * \param blockSize - Block size the kernel is intended to be launched with + * \param dynamicSMemSize - Per-block dynamic shared memory usage intended, in bytes + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + * \sa ::cudaOccupancyMaxPotentialBlockSize + * \sa ::cudaOccupancyMaxPotentialBlockSizeWithFlags + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMem + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags + * \sa ::cudaOccupancyAvailableDynamicSMemPerBlock + */ +template +static __inline__ __host__ cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessor( + int *numBlocks, + T func, + int blockSize, + size_t dynamicSMemSize) +{ + return ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, (const void*)func, blockSize, dynamicSMemSize, cudaOccupancyDefault); +} + +/** + * \brief Returns occupancy for a device function with the specified flags + * + * Returns in \p *numBlocks the maximum number of active blocks per + * streaming multiprocessor for the device function. + * + * The \p flags parameter controls how special cases are handled. Valid flags include: + * + * - ::cudaOccupancyDefault: keeps the default behavior as + * ::cudaOccupancyMaxActiveBlocksPerMultiprocessor + * + * - ::cudaOccupancyDisableCachingOverride: suppresses the default behavior + * on platform where global caching affects occupancy. On such platforms, if caching + * is enabled, but per-block SM resource usage would result in zero occupancy, the + * occupancy calculator will calculate the occupancy as if caching is disabled. + * Setting this flag makes the occupancy calculator to return 0 in such cases. + * More information can be found about this feature in the "Unified L1/Texture Cache" + * section of the Maxwell tuning guide. + * + * \param numBlocks - Returned occupancy + * \param func - Kernel function for which occupancy is calulated + * \param blockSize - Block size the kernel is intended to be launched with + * \param dynamicSMemSize - Per-block dynamic shared memory usage intended, in bytes + * \param flags - Requested behavior for the occupancy calculator + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessor + * \sa ::cudaOccupancyMaxPotentialBlockSize + * \sa ::cudaOccupancyMaxPotentialBlockSizeWithFlags + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMem + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags + * \sa ::cudaOccupancyAvailableDynamicSMemPerBlock + */ +template +static __inline__ __host__ cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags( + int *numBlocks, + T func, + int blockSize, + size_t dynamicSMemSize, + unsigned int flags) +{ + return ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, (const void*)func, blockSize, dynamicSMemSize, flags); +} + +/** + * Helper functor for cudaOccupancyMaxPotentialBlockSize + */ +class __cudaOccupancyB2DHelper { + size_t n; +public: + inline __host__ CUDART_DEVICE __cudaOccupancyB2DHelper(size_t n_) : n(n_) {} + inline __host__ CUDART_DEVICE size_t operator()(int) + { + return n; + } +}; + +/** + * \brief Returns grid and block size that achieves maximum potential occupancy for a device function + * + * Returns in \p *minGridSize and \p *blocksize a suggested grid / + * block size pair that achieves the best potential occupancy + * (i.e. the maximum number of active warps with the smallest number + * of blocks). + * + * The \p flags parameter controls how special cases are handled. Valid flags include: + * + * - ::cudaOccupancyDefault: keeps the default behavior as + * ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags + * + * - ::cudaOccupancyDisableCachingOverride: This flag suppresses the default behavior + * on platform where global caching affects occupancy. On such platforms, if caching + * is enabled, but per-block SM resource usage would result in zero occupancy, the + * occupancy calculator will calculate the occupancy as if caching is disabled. + * Setting this flag makes the occupancy calculator to return 0 in such cases. + * More information can be found about this feature in the "Unified L1/Texture Cache" + * section of the Maxwell tuning guide. + * + * \param minGridSize - Returned minimum grid size needed to achieve the best potential occupancy + * \param blockSize - Returned block size + * \param func - Device function symbol + * \param blockSizeToDynamicSMemSize - A unary function / functor that takes block size, and returns the size, in bytes, of dynamic shared memory needed for a block + * \param blockSizeLimit - The maximum block size \p func is designed to work with. 0 means no limit. + * \param flags - Requested behavior for the occupancy calculator + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMem + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessor + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + * \sa ::cudaOccupancyMaxPotentialBlockSize + * \sa ::cudaOccupancyMaxPotentialBlockSizeWithFlags + * \sa ::cudaOccupancyAvailableDynamicSMemPerBlock + */ + +template +static __inline__ __host__ CUDART_DEVICE cudaError_t cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags( + int *minGridSize, + int *blockSize, + T func, + UnaryFunction blockSizeToDynamicSMemSize, + int blockSizeLimit = 0, + unsigned int flags = 0) +{ + cudaError_t status; + + // Device and function properties + int device; + struct cudaFuncAttributes attr; + + // Limits + int maxThreadsPerMultiProcessor; + int warpSize; + int devMaxThreadsPerBlock; + int multiProcessorCount; + int funcMaxThreadsPerBlock; + int occupancyLimit; + int granularity; + + // Recorded maximum + int maxBlockSize = 0; + int numBlocks = 0; + int maxOccupancy = 0; + + // Temporary + int blockSizeToTryAligned; + int blockSizeToTry; + int blockSizeLimitAligned; + int occupancyInBlocks; + int occupancyInThreads; + size_t dynamicSMemSize; + + /////////////////////////// + // Check user input + /////////////////////////// + + if (!minGridSize || !blockSize || !func) { + return cudaErrorInvalidValue; + } + + ////////////////////////////////////////////// + // Obtain device and function properties + ////////////////////////////////////////////// + + status = ::cudaGetDevice(&device); + if (status != cudaSuccess) { + return status; + } + + status = cudaDeviceGetAttribute( + &maxThreadsPerMultiProcessor, + cudaDevAttrMaxThreadsPerMultiProcessor, + device); + if (status != cudaSuccess) { + return status; + } + + status = cudaDeviceGetAttribute( + &warpSize, + cudaDevAttrWarpSize, + device); + if (status != cudaSuccess) { + return status; + } + + status = cudaDeviceGetAttribute( + &devMaxThreadsPerBlock, + cudaDevAttrMaxThreadsPerBlock, + device); + if (status != cudaSuccess) { + return status; + } + + status = cudaDeviceGetAttribute( + &multiProcessorCount, + cudaDevAttrMultiProcessorCount, + device); + if (status != cudaSuccess) { + return status; + } + + status = cudaFuncGetAttributes(&attr, func); + if (status != cudaSuccess) { + return status; + } + + funcMaxThreadsPerBlock = attr.maxThreadsPerBlock; + + ///////////////////////////////////////////////////////////////////////////////// + // Try each block size, and pick the block size with maximum occupancy + ///////////////////////////////////////////////////////////////////////////////// + + occupancyLimit = maxThreadsPerMultiProcessor; + granularity = warpSize; + + if (blockSizeLimit == 0) { + blockSizeLimit = devMaxThreadsPerBlock; + } + + if (devMaxThreadsPerBlock < blockSizeLimit) { + blockSizeLimit = devMaxThreadsPerBlock; + } + + if (funcMaxThreadsPerBlock < blockSizeLimit) { + blockSizeLimit = funcMaxThreadsPerBlock; + } + + blockSizeLimitAligned = ((blockSizeLimit + (granularity - 1)) / granularity) * granularity; + + for (blockSizeToTryAligned = blockSizeLimitAligned; blockSizeToTryAligned > 0; blockSizeToTryAligned -= granularity) { + // This is needed for the first iteration, because + // blockSizeLimitAligned could be greater than blockSizeLimit + // + if (blockSizeLimit < blockSizeToTryAligned) { + blockSizeToTry = blockSizeLimit; + } else { + blockSizeToTry = blockSizeToTryAligned; + } + + dynamicSMemSize = blockSizeToDynamicSMemSize(blockSizeToTry); + + status = cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags( + &occupancyInBlocks, + func, + blockSizeToTry, + dynamicSMemSize, + flags); + + if (status != cudaSuccess) { + return status; + } + + occupancyInThreads = blockSizeToTry * occupancyInBlocks; + + if (occupancyInThreads > maxOccupancy) { + maxBlockSize = blockSizeToTry; + numBlocks = occupancyInBlocks; + maxOccupancy = occupancyInThreads; + } + + // Early out if we have reached the maximum + // + if (occupancyLimit == maxOccupancy) { + break; + } + } + + /////////////////////////// + // Return best available + /////////////////////////// + + // Suggested min grid size to achieve a full machine launch + // + *minGridSize = numBlocks * multiProcessorCount; + *blockSize = maxBlockSize; + + return status; +} + +/** + * \brief Returns grid and block size that achieves maximum potential occupancy for a device function + * + * Returns in \p *minGridSize and \p *blocksize a suggested grid / + * block size pair that achieves the best potential occupancy + * (i.e. the maximum number of active warps with the smallest number + * of blocks). + * + * \param minGridSize - Returned minimum grid size needed to achieve the best potential occupancy + * \param blockSize - Returned block size + * \param func - Device function symbol + * \param blockSizeToDynamicSMemSize - A unary function / functor that takes block size, and returns the size, in bytes, of dynamic shared memory needed for a block + * \param blockSizeLimit - The maximum block size \p func is designed to work with. 0 means no limit. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessor + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + * \sa ::cudaOccupancyMaxPotentialBlockSize + * \sa ::cudaOccupancyMaxPotentialBlockSizeWithFlags + * \sa ::cudaOccupancyAvailableDynamicSMemPerBlock + */ + +template +static __inline__ __host__ CUDART_DEVICE cudaError_t cudaOccupancyMaxPotentialBlockSizeVariableSMem( + int *minGridSize, + int *blockSize, + T func, + UnaryFunction blockSizeToDynamicSMemSize, + int blockSizeLimit = 0) +{ + return cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags(minGridSize, blockSize, func, blockSizeToDynamicSMemSize, blockSizeLimit, cudaOccupancyDefault); +} + +/** + * \brief Returns grid and block size that achieves maximum potential occupancy for a device function + * + * Returns in \p *minGridSize and \p *blocksize a suggested grid / + * block size pair that achieves the best potential occupancy + * (i.e. the maximum number of active warps with the smallest number + * of blocks). + * + * Use \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMem if the + * amount of per-block dynamic shared memory changes with different + * block sizes. + * + * \param minGridSize - Returned minimum grid size needed to achieve the best potential occupancy + * \param blockSize - Returned block size + * \param func - Device function symbol + * \param dynamicSMemSize - Per-block dynamic shared memory usage intended, in bytes + * \param blockSizeLimit - The maximum block size \p func is designed to work with. 0 means no limit. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaOccupancyMaxPotentialBlockSizeWithFlags + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessor + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMem + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags + * \sa ::cudaOccupancyAvailableDynamicSMemPerBlock + */ +template +static __inline__ __host__ CUDART_DEVICE cudaError_t cudaOccupancyMaxPotentialBlockSize( + int *minGridSize, + int *blockSize, + T func, + size_t dynamicSMemSize = 0, + int blockSizeLimit = 0) +{ + return cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags(minGridSize, blockSize, func, __cudaOccupancyB2DHelper(dynamicSMemSize), blockSizeLimit, cudaOccupancyDefault); +} + +/** + * \brief Returns dynamic shared memory available per block when launching \p numBlocks blocks on SM. + * + * Returns in \p *dynamicSmemSize the maximum size of dynamic shared memory to allow \p numBlocks blocks per SM. + * + * \param dynamicSmemSize - Returned maximum dynamic shared memory + * \param func - Kernel function for which occupancy is calculated + * \param numBlocks - Number of blocks to fit on SM + * \param blockSize - Size of the block + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaOccupancyMaxPotentialBlockSize + * \sa ::cudaOccupancyMaxPotentialBlockSizeWithFlags + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessor + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMem + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags + */ +template +static __inline__ __host__ cudaError_t cudaOccupancyAvailableDynamicSMemPerBlock( + size_t *dynamicSmemSize, + T func, + int numBlocks, + int blockSize) +{ + return ::cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, (const void*)func, numBlocks, blockSize); +} + +/** + * \brief Returns grid and block size that achived maximum potential occupancy for a device function with the specified flags + * + * Returns in \p *minGridSize and \p *blocksize a suggested grid / + * block size pair that achieves the best potential occupancy + * (i.e. the maximum number of active warps with the smallest number + * of blocks). + * + * The \p flags parameter controls how special cases are handle. Valid flags include: + * + * - ::cudaOccupancyDefault: keeps the default behavior as + * ::cudaOccupancyMaxPotentialBlockSize + * + * - ::cudaOccupancyDisableCachingOverride: This flag suppresses the default behavior + * on platform where global caching affects occupancy. On such platforms, if caching + * is enabled, but per-block SM resource usage would result in zero occupancy, the + * occupancy calculator will calculate the occupancy as if caching is disabled. + * Setting this flag makes the occupancy calculator to return 0 in such cases. + * More information can be found about this feature in the "Unified L1/Texture Cache" + * section of the Maxwell tuning guide. + * + * Use \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMem if the + * amount of per-block dynamic shared memory changes with different + * block sizes. + * + * \param minGridSize - Returned minimum grid size needed to achieve the best potential occupancy + * \param blockSize - Returned block size + * \param func - Device function symbol + * \param dynamicSMemSize - Per-block dynamic shared memory usage intended, in bytes + * \param blockSizeLimit - The maximum block size \p func is designed to work with. 0 means no limit. + * \param flags - Requested behavior for the occupancy calculator + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaOccupancyMaxPotentialBlockSize + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessor + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMem + * \sa ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags + * \sa ::cudaOccupancyAvailableDynamicSMemPerBlock + */ +template +static __inline__ __host__ CUDART_DEVICE cudaError_t cudaOccupancyMaxPotentialBlockSizeWithFlags( + int *minGridSize, + int *blockSize, + T func, + size_t dynamicSMemSize = 0, + int blockSizeLimit = 0, + unsigned int flags = 0) +{ + return cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags(minGridSize, blockSize, func, __cudaOccupancyB2DHelper(dynamicSMemSize), blockSizeLimit, flags); +} + +/** + * \brief Given the kernel function (\p func) and launch configuration + * (\p config), return the maximum cluster size in \p *clusterSize. + * + * The cluster dimensions in \p config are ignored. If func has a required + * cluster size set (see ::cudaFuncGetAttributes),\p *clusterSize will reflect + * the required cluster size. + * + * By default this function will always return a value that's portable on + * future hardware. A higher value may be returned if the kernel function + * allows non-portable cluster sizes. + * + * This function will respect the compile time launch bounds. + * + * \param clusterSize - Returned maximum cluster size that can be launched + * for the given kernel function and launch configuration + * \param func - Kernel function for which maximum cluster + * size is calculated + * \param config - Launch configuration for the given kernel function + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaFuncGetAttributes + */ +template +static __inline__ __host__ cudaError_t cudaOccupancyMaxPotentialClusterSize( + int *clusterSize, + T *func, + const cudaLaunchConfig_t *config) +{ + return ::cudaOccupancyMaxPotentialClusterSize(clusterSize, (const void*)func, config); +} + +/** + * \brief Given the kernel function (\p func) and launch configuration + * (\p config), return the maximum number of clusters that could co-exist + * on the target device in \p *numClusters. + * + * If the function has required cluster size already set (see + * ::cudaFuncGetAttributes), the cluster size from config must either be + * unspecified or match the required size. + * Without required sizes, the cluster size must be specified in config, + * else the function will return an error. + * + * Note that various attributes of the kernel function may affect occupancy + * calculation. Runtime environment may affect how the hardware schedules + * the clusters, so the calculated occupancy is not guaranteed to be achievable. + * + * \param numClusters - Returned maximum number of clusters that + * could co-exist on the target device + * \param func - Kernel function for which maximum number + * of clusters are calculated + * \param config - Launch configuration for the given kernel function + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidClusterSize, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaFuncGetAttributes + */ +template +static __inline__ __host__ cudaError_t cudaOccupancyMaxActiveClusters( + int *numClusters, + T *func, + const cudaLaunchConfig_t *config) +{ + return ::cudaOccupancyMaxActiveClusters(numClusters, (const void*)func, config); +} + +#if defined __CUDACC__ + +/** + * \brief \hl Find out attributes for a given function + * + * This function obtains the attributes of a function specified via \p entry. + * The parameter \p entry must be a pointer to a function that executes + * on the device. The parameter specified by \p entry must be declared as a \p __global__ + * function. The fetched attributes are placed in \p attr. If the specified + * function does not exist, then ::cudaErrorInvalidDeviceFunction is returned. + * + * Note that some function attributes such as + * \ref ::cudaFuncAttributes::maxThreadsPerBlock "maxThreadsPerBlock" + * may vary based on the device that is currently being used. + * + * \param attr - Return pointer to function's attributes + * \param entry - Function to get attributes of + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction + * \notefnerr + * \note_init_rt + * \note_callback + * + * \ref ::cudaLaunchKernel(const T *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchKernel (C++ API)", + * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)", + * \ref ::cudaFuncGetAttributes(struct cudaFuncAttributes*, const void*) "cudaFuncGetAttributes (C API)", + * ::cudaSetDoubleForDevice, + * ::cudaSetDoubleForHost + */ +template +static __inline__ __host__ cudaError_t cudaFuncGetAttributes( + struct cudaFuncAttributes *attr, + T *entry +) +{ + return ::cudaFuncGetAttributes(attr, (const void*)entry); +} + +/** + * \brief \hl Set attributes for a given function + * + * This function sets the attributes of a function specified via \p entry. + * The parameter \p entry must be a pointer to a function that executes + * on the device. The parameter specified by \p entry must be declared as a \p __global__ + * function. The enumeration defined by \p attr is set to the value defined by \p value. + * If the specified function does not exist, then ::cudaErrorInvalidDeviceFunction is returned. + * If the specified attribute cannot be written, or if the value is incorrect, + * then ::cudaErrorInvalidValue is returned. + * + * Valid values for \p attr are: + * - ::cudaFuncAttributeMaxDynamicSharedMemorySize - The requested maximum size in bytes of dynamically-allocated shared memory. The sum of this value and the function attribute ::sharedSizeBytes + * cannot exceed the device attribute ::cudaDevAttrMaxSharedMemoryPerBlockOptin. The maximal size of requestable dynamic shared memory may differ by GPU architecture. + * - ::cudaFuncAttributePreferredSharedMemoryCarveout - On devices where the L1 cache and shared memory use the same hardware resources, + * this sets the shared memory carveout preference, in percent of the total shared memory. See ::cudaDevAttrMaxSharedMemoryPerMultiprocessor. + * This is only a hint, and the driver can choose a different ratio if required to execute the function. + * - ::cudaFuncAttributeRequiredClusterWidth: The required cluster width in + * blocks. The width, height, and depth values must either all be 0 or all be + * positive. The validity of the cluster dimensions is checked at launch time. + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime will return cudaErrorNotPermitted. + * - ::cudaFuncAttributeRequiredClusterHeight: The required cluster height in + * blocks. The width, height, and depth values must either all be 0 or all be + * positive. The validity of the cluster dimensions is checked at launch time. + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime will return cudaErrorNotPermitted. + * - ::cudaFuncAttributeRequiredClusterDepth: The required cluster depth in + * blocks. The width, height, and depth values must either all be 0 or all be + * positive. The validity of the cluster dimensions is checked at launch time. + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime will return cudaErrorNotPermitted. + * - ::cudaFuncAttributeClusterSchedulingPolicyPreference: The block + * scheduling policy of a function. The value type is cudaClusterSchedulingPolicy. + * + * \param entry - Function to get attributes of + * \param attr - Attribute to set + * \param value - Value to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \ref ::cudaLaunchKernel(const T *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchKernel (C++ API)", + * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)", + * \ref ::cudaFuncGetAttributes(struct cudaFuncAttributes*, const void*) "cudaFuncGetAttributes (C API)", + * ::cudaSetDoubleForDevice, + * ::cudaSetDoubleForHost + */ +template +static __inline__ __host__ cudaError_t cudaFuncSetAttribute( + T *entry, + enum cudaFuncAttribute attr, + int value +) +{ + return ::cudaFuncSetAttribute((const void*)entry, attr, value); +} + +/** + * \brief Returns the function name for a device entry function pointer. + * + * Returns in \p **name the function name associated with the symbol \p func . + * The function name is returned as a null-terminated string. This API may + * return a mangled name if the function is not declared as having C linkage. + * If \p **name is NULL, ::cudaErrorInvalidValue is returned. If \p func is + * not a device entry function, ::cudaErrorInvalidDeviceFunction is returned. + * + * \param name - The returned name of the function + * \param func - The function pointer to retrieve name for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDeviceFunction + * \notefnerr + * \note_init_rt + * \note_callback + * + * \ref ::cudaFuncGetName(const char **name, const void *func) "cudaFuncGetName (C API)" + */ +template +static __inline__ __host__ cudaError_t CUDARTAPI cudaFuncGetName( + const char **name, + const T *func +) +{ + return ::cudaFuncGetName(name, (const void *)func); +} + +/** + * \brief Get pointer to device kernel that matches entry function \p entryFuncAddr + * + * Returns in \p kernelPtr the device kernel corresponding to the entry function \p entryFuncAddr. + * + * \param kernelPtr - Returns the device kernel + * \param entryFuncAddr - Address of device entry function to search kernel for + * + * \return + * ::cudaSuccess + * + * \sa + * \ref ::cudaGetKernel(cudaKernel_t *kernelPtr, const void *entryFuncAddr) "cudaGetKernel (C API)" + */ +template +static __inline__ __host__ cudaError_t cudaGetKernel( + cudaKernel_t *kernelPtr, + const T *entryFuncAddr +) +{ + return ::cudaGetKernel(kernelPtr, (const void *)entryFuncAddr); +} + +#endif /* __CUDACC__ */ + +/** @} */ /* END CUDART_HIGHLEVEL */ + +#endif /* __cplusplus && !__CUDACC_RTC__ */ + +#if !defined(__CUDACC_RTC__) +#if defined(__GNUC__) +#if defined(__clang__) || (!defined(__PGIC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) +#pragma GCC diagnostic pop +#endif +#elif defined(_MSC_VER) +#pragma warning(pop) +#endif +#endif + +#undef EXCLUDE_FROM_RTC +#undef __CUDA_DEPRECATED + +#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_RUNTIME_H__) +#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_RUNTIME_H__ +#endif + +#endif /* !__CUDA_RUNTIME_H__ */ diff --git a/cuda_toolkit/include/cuda_runtime_api.h b/cuda_toolkit/include/cuda_runtime_api.h new file mode 100644 index 0000000000000000000000000000000000000000..51250f6d4a9f293c549bda482bd4d53994261e75 --- /dev/null +++ b/cuda_toolkit/include/cuda_runtime_api.h @@ -0,0 +1,14059 @@ +/* + * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + + + +#if !defined(__CUDA_RUNTIME_API_H__) +#define __CUDA_RUNTIME_API_H__ + +#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__) +#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_RUNTIME_API_H__ +#endif + +/** + * \latexonly + * \page sync_async API synchronization behavior + * + * \section memcpy_sync_async_behavior Memcpy + * The API provides memcpy/memset functions in both synchronous and asynchronous forms, + * the latter having an \e "Async" suffix. This is a misnomer as each function + * may exhibit synchronous or asynchronous behavior depending on the arguments + * passed to the function. In the reference documentation, each memcpy function is + * categorized as \e synchronous or \e asynchronous, corresponding to the definitions + * below. + * + * \subsection MemcpySynchronousBehavior Synchronous + * + *
    + *
  1. For transfers from pageable host memory to device memory, a stream sync is performed + * before the copy is initiated. The function will return once the pageable + * buffer has been copied to the staging memory for DMA transfer to device memory, + * but the DMA to final destination may not have completed. + * + *
  2. For transfers from pinned host memory to device memory, the function is synchronous + * with respect to the host. + * + *
  3. For transfers from device to either pageable or pinned host memory, the function returns + * only once the copy has completed. + * + *
  4. For transfers from device memory to device memory, no host-side synchronization is + * performed. + * + *
  5. For transfers from any host memory to any host memory, the function is fully + * synchronous with respect to the host. + *
+ * + * \subsection MemcpyAsynchronousBehavior Asynchronous + * + *
    + *
  1. For transfers between device memory and pageable host memory, the function might + * be synchronous with respect to host. + * + *
  2. For transfers from any host memory to any host memory, the function is fully + * synchronous with respect to the host. + * + *
  3. If pageable memory must first be staged to pinned memory, the driver may + * synchronize with the stream and stage the copy into pinned memory. + * + *
  4. For all other transfers, the function should be fully asynchronous. + *
+ * + * \section memset_sync_async_behavior Memset + * The cudaMemset functions are asynchronous with respect to the host + * except when the target memory is pinned host memory. The \e Async + * versions are always asynchronous with respect to the host. + * + * \section kernel_launch_details Kernel Launches + * Kernel launches are asynchronous with respect to the host. Details of + * concurrent kernel execution and data transfers can be found in the CUDA + * Programmers Guide. + * + * \endlatexonly + */ + +/** + * There are two levels for the runtime API. + * + * The C API (cuda_runtime_api.h) is + * a C-style interface that does not require compiling with \p nvcc. + * + * The \ref CUDART_HIGHLEVEL "C++ API" (cuda_runtime.h) is a + * C++-style interface built on top of the C API. It wraps some of the + * C API routines, using overloading, references and default arguments. + * These wrappers can be used from C++ code and can be compiled with any C++ + * compiler. The C++ API also has some CUDA-specific wrappers that wrap + * C API routines that deal with symbols, textures, and device functions. + * These wrappers require the use of \p nvcc because they depend on code being + * generated by the compiler. For example, the execution configuration syntax + * to invoke kernels is only available in source code compiled with \p nvcc. + */ + +/** CUDA Runtime API Version */ +#define CUDART_VERSION 12040 + +#if defined(__CUDA_API_VER_MAJOR__) && defined(__CUDA_API_VER_MINOR__) +# define __CUDART_API_VERSION ((__CUDA_API_VER_MAJOR__ * 1000) + (__CUDA_API_VER_MINOR__ * 10)) +#else +# define __CUDART_API_VERSION CUDART_VERSION +#endif + +#ifndef __DOXYGEN_ONLY__ +#include "crt/host_defines.h" +#endif +#include "builtin_types.h" + +#if !defined(__CUDACC_RTC_MINIMAL__) && ((defined(__CUDACC_RDC__) || defined(__CUDACC_EWP__) || !defined(__CUDACC_RTC__))) +#include "cuda_device_runtime_api.h" +#endif /* !defined(__CUDACC_RTC_MINIMAL__) && (defined(__CUDACC_RDC__) || defined(__CUDACC_EWP__) || !defined(__CUDACC_RTC__)) */ + + +#ifndef __CUDACC_RTC_MINIMAL__ +#if defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) || defined(__CUDA_API_VERSION_INTERNAL) + #define __CUDART_API_PER_THREAD_DEFAULT_STREAM + #define __CUDART_API_PTDS(api) api ## _ptds + #define __CUDART_API_PTSZ(api) api ## _ptsz +#else + #define __CUDART_API_PTDS(api) api + #define __CUDART_API_PTSZ(api) api +#endif + +#define cudaSignalExternalSemaphoresAsync __CUDART_API_PTSZ(cudaSignalExternalSemaphoresAsync_v2) +#define cudaWaitExternalSemaphoresAsync __CUDART_API_PTSZ(cudaWaitExternalSemaphoresAsync_v2) + + #define cudaStreamGetCaptureInfo __CUDART_API_PTSZ(cudaStreamGetCaptureInfo_v2) + +#define cudaGetDeviceProperties cudaGetDeviceProperties_v2 + +#if defined(__CUDART_API_PER_THREAD_DEFAULT_STREAM) + #define cudaMemcpy __CUDART_API_PTDS(cudaMemcpy) + #define cudaMemcpyToSymbol __CUDART_API_PTDS(cudaMemcpyToSymbol) + #define cudaMemcpyFromSymbol __CUDART_API_PTDS(cudaMemcpyFromSymbol) + #define cudaMemcpy2D __CUDART_API_PTDS(cudaMemcpy2D) + #define cudaMemcpyToArray __CUDART_API_PTDS(cudaMemcpyToArray) + #define cudaMemcpy2DToArray __CUDART_API_PTDS(cudaMemcpy2DToArray) + #define cudaMemcpyFromArray __CUDART_API_PTDS(cudaMemcpyFromArray) + #define cudaMemcpy2DFromArray __CUDART_API_PTDS(cudaMemcpy2DFromArray) + #define cudaMemcpyArrayToArray __CUDART_API_PTDS(cudaMemcpyArrayToArray) + #define cudaMemcpy2DArrayToArray __CUDART_API_PTDS(cudaMemcpy2DArrayToArray) + #define cudaMemcpy3D __CUDART_API_PTDS(cudaMemcpy3D) + #define cudaMemcpy3DPeer __CUDART_API_PTDS(cudaMemcpy3DPeer) + #define cudaMemset __CUDART_API_PTDS(cudaMemset) + #define cudaMemset2D __CUDART_API_PTDS(cudaMemset2D) + #define cudaMemset3D __CUDART_API_PTDS(cudaMemset3D) + #define cudaGraphInstantiateWithParams __CUDART_API_PTSZ(cudaGraphInstantiateWithParams) + #define cudaGraphUpload __CUDART_API_PTSZ(cudaGraphUpload) + #define cudaGraphLaunch __CUDART_API_PTSZ(cudaGraphLaunch) + #define cudaStreamBeginCapture __CUDART_API_PTSZ(cudaStreamBeginCapture) + #define cudaStreamBeginCaptureToGraph __CUDART_API_PTSZ(cudaStreamBeginCaptureToGraph) + #define cudaStreamEndCapture __CUDART_API_PTSZ(cudaStreamEndCapture) + #define cudaStreamGetCaptureInfo_v3 __CUDART_API_PTSZ(cudaStreamGetCaptureInfo_v3) + #define cudaStreamUpdateCaptureDependencies __CUDART_API_PTSZ(cudaStreamUpdateCaptureDependencies) + #define cudaStreamUpdateCaptureDependencies_v2 __CUDART_API_PTSZ(cudaStreamUpdateCaptureDependencies_v2) + #define cudaStreamIsCapturing __CUDART_API_PTSZ(cudaStreamIsCapturing) + #define cudaMemcpyAsync __CUDART_API_PTSZ(cudaMemcpyAsync) + #define cudaMemcpyToSymbolAsync __CUDART_API_PTSZ(cudaMemcpyToSymbolAsync) + #define cudaMemcpyFromSymbolAsync __CUDART_API_PTSZ(cudaMemcpyFromSymbolAsync) + #define cudaMemcpy2DAsync __CUDART_API_PTSZ(cudaMemcpy2DAsync) + #define cudaMemcpyToArrayAsync __CUDART_API_PTSZ(cudaMemcpyToArrayAsync) + #define cudaMemcpy2DToArrayAsync __CUDART_API_PTSZ(cudaMemcpy2DToArrayAsync) + #define cudaMemcpyFromArrayAsync __CUDART_API_PTSZ(cudaMemcpyFromArrayAsync) + #define cudaMemcpy2DFromArrayAsync __CUDART_API_PTSZ(cudaMemcpy2DFromArrayAsync) + #define cudaMemcpy3DAsync __CUDART_API_PTSZ(cudaMemcpy3DAsync) + #define cudaMemcpy3DPeerAsync __CUDART_API_PTSZ(cudaMemcpy3DPeerAsync) + #define cudaMemsetAsync __CUDART_API_PTSZ(cudaMemsetAsync) + #define cudaMemset2DAsync __CUDART_API_PTSZ(cudaMemset2DAsync) + #define cudaMemset3DAsync __CUDART_API_PTSZ(cudaMemset3DAsync) + #define cudaStreamQuery __CUDART_API_PTSZ(cudaStreamQuery) + #define cudaStreamGetFlags __CUDART_API_PTSZ(cudaStreamGetFlags) + #define cudaStreamGetId __CUDART_API_PTSZ(cudaStreamGetId) + #define cudaStreamGetPriority __CUDART_API_PTSZ(cudaStreamGetPriority) + #define cudaEventRecord __CUDART_API_PTSZ(cudaEventRecord) + #define cudaEventRecordWithFlags __CUDART_API_PTSZ(cudaEventRecordWithFlags) + #define cudaStreamWaitEvent __CUDART_API_PTSZ(cudaStreamWaitEvent) + #define cudaStreamAddCallback __CUDART_API_PTSZ(cudaStreamAddCallback) + #define cudaStreamAttachMemAsync __CUDART_API_PTSZ(cudaStreamAttachMemAsync) + #define cudaStreamSynchronize __CUDART_API_PTSZ(cudaStreamSynchronize) + #define cudaLaunchKernel __CUDART_API_PTSZ(cudaLaunchKernel) + #define cudaLaunchKernelExC __CUDART_API_PTSZ(cudaLaunchKernelExC) + #define cudaLaunchHostFunc __CUDART_API_PTSZ(cudaLaunchHostFunc) + #define cudaMemPrefetchAsync __CUDART_API_PTSZ(cudaMemPrefetchAsync) + #define cudaMemPrefetchAsync_v2 __CUDART_API_PTSZ(cudaMemPrefetchAsync_v2) + #define cudaLaunchCooperativeKernel __CUDART_API_PTSZ(cudaLaunchCooperativeKernel) + #define cudaStreamCopyAttributes __CUDART_API_PTSZ(cudaStreamCopyAttributes) + #define cudaStreamGetAttribute __CUDART_API_PTSZ(cudaStreamGetAttribute) + #define cudaStreamSetAttribute __CUDART_API_PTSZ(cudaStreamSetAttribute) + #define cudaMallocAsync __CUDART_API_PTSZ(cudaMallocAsync) + #define cudaFreeAsync __CUDART_API_PTSZ(cudaFreeAsync) + #define cudaMallocFromPoolAsync __CUDART_API_PTSZ(cudaMallocFromPoolAsync) + #define cudaGetDriverEntryPoint __CUDART_API_PTSZ(cudaGetDriverEntryPoint) +#endif + +#endif /* __CUDACC_RTC_MINIMAL__ */ + +/** \cond impl_private */ +#if !defined(__dv) + +#if defined(__cplusplus) + +#define __dv(v) \ + = v + +#else /* __cplusplus */ + +#define __dv(v) + +#endif /* __cplusplus */ + +#endif /* !__dv */ +/** \endcond impl_private */ + +#if (defined(_NVHPC_CUDA) || !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 350)) /** Visible to SM>=3.5 and "__host__ __device__" only **/ + +#define CUDART_DEVICE __device__ + +#else + +#define CUDART_DEVICE + +#endif /** CUDART_DEVICE */ + +#if !defined(__CUDACC_RTC__) +#define EXCLUDE_FROM_RTC + +/** \cond impl_private */ +#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif +/** \endcond impl_private */ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/** + * \defgroup CUDART_DEVICE Device Management + * + * ___MANBRIEF___ device management functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the device management functions of the CUDA runtime + * application programming interface. + * + * @{ + */ + +/** + * \brief Destroy all allocations and reset all state on the current device + * in the current process. + * + * Explicitly destroys and cleans up all resources associated with the current + * device in the current process. It is the caller's responsibility to ensure + * that the resources are not accessed or passed in subsequent API calls and + * doing so will result in undefined behavior. These resources include CUDA types + * such as ::cudaStream_t, ::cudaEvent_t, ::cudaArray_t, ::cudaMipmappedArray_t, + * ::cudaTextureObject_t, ::cudaSurfaceObject_t, ::textureReference, ::surfaceReference, + * ::cudaExternalMemory_t, ::cudaExternalSemaphore_t and ::cudaGraphicsResource_t. + * Any subsequent API call to this device will reinitialize the device. + * + * Note that this function will reset the device immediately. It is the caller's + * responsibility to ensure that the device is not being accessed by any + * other host threads from the process when this function is called. + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceSynchronize + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceReset(void); + +/** + * \brief Wait for compute device to finish + * + * Blocks until the device has completed all preceding requested tasks. + * ::cudaDeviceSynchronize() returns an error if one of the preceding tasks + * has failed. If the ::cudaDeviceScheduleBlockingSync flag was set for + * this device, the host thread will block until the device has finished + * its work. + * + * \return + * ::cudaSuccess + * \note_device_sync_deprecated + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaDeviceReset, + * ::cuCtxSynchronize + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceSynchronize(void); + +/** + * \brief Set resource limits + * + * Setting \p limit to \p value is a request by the application to update + * the current limit maintained by the device. The driver is free to + * modify the requested value to meet h/w requirements (this could be + * clamping to minimum or maximum values, rounding up to nearest element + * size, etc). The application can use ::cudaDeviceGetLimit() to find out + * exactly what the limit has been set to. + * + * Setting each ::cudaLimit has its own specific restrictions, so each is + * discussed here. + * + * - ::cudaLimitStackSize controls the stack size in bytes of each GPU thread. + * + * - ::cudaLimitPrintfFifoSize controls the size in bytes of the shared FIFO + * used by the ::printf() device system call. Setting + * ::cudaLimitPrintfFifoSize must not be performed after launching any kernel + * that uses the ::printf() device system call - in such case + * ::cudaErrorInvalidValue will be returned. + * + * - ::cudaLimitMallocHeapSize controls the size in bytes of the heap used by + * the ::malloc() and ::free() device system calls. Setting + * ::cudaLimitMallocHeapSize must not be performed after launching any kernel + * that uses the ::malloc() or ::free() device system calls - in such case + * ::cudaErrorInvalidValue will be returned. + * + * - ::cudaLimitDevRuntimeSyncDepth controls the maximum nesting depth of a + * grid at which a thread can safely call ::cudaDeviceSynchronize(). Setting + * this limit must be performed before any launch of a kernel that uses the + * device runtime and calls ::cudaDeviceSynchronize() above the default sync + * depth, two levels of grids. Calls to ::cudaDeviceSynchronize() will fail + * with error code ::cudaErrorSyncDepthExceeded if the limitation is + * violated. This limit can be set smaller than the default or up the maximum + * launch depth of 24. When setting this limit, keep in mind that additional + * levels of sync depth require the runtime to reserve large amounts of + * device memory which can no longer be used for user allocations. If these + * reservations of device memory fail, ::cudaDeviceSetLimit will return + * ::cudaErrorMemoryAllocation, and the limit can be reset to a lower value. + * This limit is only applicable to devices of compute capability < 9.0. + * Attempting to set this limit on devices of other compute capability will + * results in error ::cudaErrorUnsupportedLimit being returned. + * + * - ::cudaLimitDevRuntimePendingLaunchCount controls the maximum number of + * outstanding device runtime launches that can be made from the current + * device. A grid is outstanding from the point of launch up until the grid + * is known to have been completed. Device runtime launches which violate + * this limitation fail and return ::cudaErrorLaunchPendingCountExceeded when + * ::cudaGetLastError() is called after launch. If more pending launches than + * the default (2048 launches) are needed for a module using the device + * runtime, this limit can be increased. Keep in mind that being able to + * sustain additional pending launches will require the runtime to reserve + * larger amounts of device memory upfront which can no longer be used for + * allocations. If these reservations fail, ::cudaDeviceSetLimit will return + * ::cudaErrorMemoryAllocation, and the limit can be reset to a lower value. + * This limit is only applicable to devices of compute capability 3.5 and + * higher. Attempting to set this limit on devices of compute capability less + * than 3.5 will result in the error ::cudaErrorUnsupportedLimit being + * returned. + * + * - ::cudaLimitMaxL2FetchGranularity controls the L2 cache fetch granularity. + * Values can range from 0B to 128B. This is purely a performance hint and + * it can be ignored or clamped depending on the platform. + * + * - ::cudaLimitPersistingL2CacheSize controls size in bytes available + * for persisting L2 cache. This is purely a performance hint and it + * can be ignored or clamped depending on the platform. + * + * \param limit - Limit to set + * \param value - Size of limit + * + * \return + * ::cudaSuccess, + * ::cudaErrorUnsupportedLimit, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaDeviceGetLimit, + * ::cuCtxSetLimit + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, size_t value); + +/** + * \brief Return resource limits + * + * Returns in \p *pValue the current size of \p limit. The following ::cudaLimit values are supported. + * - ::cudaLimitStackSize is the stack size in bytes of each GPU thread. + * - ::cudaLimitPrintfFifoSize is the size in bytes of the shared FIFO used by the + * ::printf() device system call. + * - ::cudaLimitMallocHeapSize is the size in bytes of the heap used by the + * ::malloc() and ::free() device system calls. + * - ::cudaLimitDevRuntimeSyncDepth is the maximum grid depth at which a + * thread can isssue the device runtime call ::cudaDeviceSynchronize() + * to wait on child grid launches to complete. This functionality is removed + * for devices of compute capability >= 9.0, and hence will return error + * ::cudaErrorUnsupportedLimit on such devices. + * - ::cudaLimitDevRuntimePendingLaunchCount is the maximum number of outstanding + * device runtime launches. + * - ::cudaLimitMaxL2FetchGranularity is the L2 cache fetch granularity. + * - ::cudaLimitPersistingL2CacheSize is the persisting L2 cache size in bytes. + * + * \param limit - Limit to query + * \param pValue - Returned size of the limit + * + * \return + * ::cudaSuccess, + * ::cudaErrorUnsupportedLimit, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaDeviceSetLimit, + * ::cuCtxGetLimit + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit); + +/** + * \brief Returns the maximum number of elements allocatable in a 1D linear texture for a given element size. + * + * Returns in \p maxWidthInElements the maximum number of elements allocatable in a 1D linear texture + * for given format descriptor \p fmtDesc. + * + * \param maxWidthInElements - Returns maximum number of texture elements allocatable for given \p fmtDesc. + * \param fmtDesc - Texture format description. + * + * \return + * ::cudaSuccess, + * ::cudaErrorUnsupportedLimit, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cuDeviceGetTexture1DLinearMaxWidth + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetTexture1DLinearMaxWidth(size_t *maxWidthInElements, const struct cudaChannelFormatDesc *fmtDesc, int device); +#endif + +/** + * \brief Returns the preferred cache configuration for the current device. + * + * On devices where the L1 cache and shared memory use the same hardware + * resources, this returns through \p pCacheConfig the preferred cache + * configuration for the current device. This is only a preference. The + * runtime will use the requested configuration if possible, but it is free to + * choose a different configuration if required to execute functions. + * + * This will return a \p pCacheConfig of ::cudaFuncCachePreferNone on devices + * where the size of the L1 cache and shared memory are fixed. + * + * The supported cache configurations are: + * - ::cudaFuncCachePreferNone: no preference for shared memory or L1 (default) + * - ::cudaFuncCachePreferShared: prefer larger shared memory and smaller L1 cache + * - ::cudaFuncCachePreferL1: prefer larger L1 cache and smaller shared memory + * - ::cudaFuncCachePreferEqual: prefer equal size L1 cache and shared memory + * + * \param pCacheConfig - Returned cache configuration + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceSetCacheConfig, + * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)", + * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)", + * ::cuCtxGetCacheConfig + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig); + +/** + * \brief Returns numerical values that correspond to the least and + * greatest stream priorities. + * + * Returns in \p *leastPriority and \p *greatestPriority the numerical values that correspond + * to the least and greatest stream priorities respectively. Stream priorities + * follow a convention where lower numbers imply greater priorities. The range of + * meaningful stream priorities is given by [\p *greatestPriority, \p *leastPriority]. + * If the user attempts to create a stream with a priority value that is + * outside the the meaningful range as specified by this API, the priority is + * automatically clamped down or up to either \p *leastPriority or \p *greatestPriority + * respectively. See ::cudaStreamCreateWithPriority for details on creating a + * priority stream. + * A NULL may be passed in for \p *leastPriority or \p *greatestPriority if the value + * is not desired. + * + * This function will return '0' in both \p *leastPriority and \p *greatestPriority if + * the current context's device does not support stream priorities + * (see ::cudaDeviceGetAttribute). + * + * \param leastPriority - Pointer to an int in which the numerical value for least + * stream priority is returned + * \param greatestPriority - Pointer to an int in which the numerical value for greatest + * stream priority is returned + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreateWithPriority, + * ::cudaStreamGetPriority, + * ::cuCtxGetStreamPriorityRange + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority); + +/** + * \brief Sets the preferred cache configuration for the current device. + * + * On devices where the L1 cache and shared memory use the same hardware + * resources, this sets through \p cacheConfig the preferred cache + * configuration for the current device. This is only a preference. The + * runtime will use the requested configuration if possible, but it is free to + * choose a different configuration if required to execute the function. Any + * function preference set via + * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)" + * or + * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)" + * will be preferred over this device-wide setting. Setting the device-wide + * cache configuration to ::cudaFuncCachePreferNone will cause subsequent + * kernel launches to prefer to not change the cache configuration unless + * required to launch the kernel. + * + * This setting does nothing on devices where the size of the L1 cache and + * shared memory are fixed. + * + * Launching a kernel with a different preference than the most recent + * preference setting may insert a device-side synchronization point. + * + * The supported cache configurations are: + * - ::cudaFuncCachePreferNone: no preference for shared memory or L1 (default) + * - ::cudaFuncCachePreferShared: prefer larger shared memory and smaller L1 cache + * - ::cudaFuncCachePreferL1: prefer larger L1 cache and smaller shared memory + * - ::cudaFuncCachePreferEqual: prefer equal size L1 cache and shared memory + * + * \param cacheConfig - Requested cache configuration + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceGetCacheConfig, + * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)", + * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)", + * ::cuCtxSetCacheConfig + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceSetCacheConfig(enum cudaFuncCache cacheConfig); + +/** + * \brief Returns a handle to a compute device + * + * Returns in \p *device a device ordinal given a PCI bus ID string. + * + * \param device - Returned device ordinal + * + * \param pciBusId - String in one of the following forms: + * [domain]:[bus]:[device].[function] + * [domain]:[bus]:[device] + * [bus]:[device].[function] + * where \p domain, \p bus, \p device, and \p function are all hexadecimal values + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaDeviceGetPCIBusId, + * ::cuDeviceGetByPCIBusId + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceGetByPCIBusId(int *device, const char *pciBusId); + +/** + * \brief Returns a PCI Bus Id string for the device + * + * Returns an ASCII string identifying the device \p dev in the NULL-terminated + * string pointed to by \p pciBusId. \p len specifies the maximum length of the + * string that may be returned. + * + * \param pciBusId - Returned identifier string for the device in the following format + * [domain]:[bus]:[device].[function] + * where \p domain, \p bus, \p device, and \p function are all hexadecimal values. + * pciBusId should be large enough to store 13 characters including the NULL-terminator. + * + * \param len - Maximum length of string to store in \p name + * + * \param device - Device to get identifier string for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaDeviceGetByPCIBusId, + * ::cuDeviceGetPCIBusId + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *pciBusId, int len, int device); + +/** + * \brief Gets an interprocess handle for a previously allocated event + * + * Takes as input a previously allocated event. This event must have been + * created with the ::cudaEventInterprocess and ::cudaEventDisableTiming + * flags set. This opaque handle may be copied into other processes and + * opened with ::cudaIpcOpenEventHandle to allow efficient hardware + * synchronization between GPU work in different processes. + * + * After the event has been been opened in the importing process, + * ::cudaEventRecord, ::cudaEventSynchronize, ::cudaStreamWaitEvent and + * ::cudaEventQuery may be used in either process. Performing operations + * on the imported event after the exported event has been freed + * with ::cudaEventDestroy will result in undefined behavior. + * + * IPC functionality is restricted to devices with support for unified + * addressing on Linux and Windows operating systems. + * IPC functionality on Windows is restricted to GPUs in TCC mode. + * Users can test their device for IPC functionality by calling + * ::cudaDeviceGetAttribute with ::cudaDevAttrIpcEventSupport + * + * \param handle - Pointer to a user allocated cudaIpcEventHandle + * in which to return the opaque event handle + * \param event - Event allocated with ::cudaEventInterprocess and + * ::cudaEventDisableTiming flags. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorMemoryAllocation, + * ::cudaErrorMapBufferObjectFailed, + * ::cudaErrorNotSupported, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaEventCreate, + * ::cudaEventDestroy, + * ::cudaEventSynchronize, + * ::cudaEventQuery, + * ::cudaStreamWaitEvent, + * ::cudaIpcOpenEventHandle, + * ::cudaIpcGetMemHandle, + * ::cudaIpcOpenMemHandle, + * ::cudaIpcCloseMemHandle, + * ::cuIpcGetEventHandle + */ +extern __host__ cudaError_t CUDARTAPI cudaIpcGetEventHandle(cudaIpcEventHandle_t *handle, cudaEvent_t event); + +/** + * \brief Opens an interprocess event handle for use in the current process + * + * Opens an interprocess event handle exported from another process with + * ::cudaIpcGetEventHandle. This function returns a ::cudaEvent_t that behaves like + * a locally created event with the ::cudaEventDisableTiming flag specified. + * This event must be freed with ::cudaEventDestroy. + * + * Performing operations on the imported event after the exported event has + * been freed with ::cudaEventDestroy will result in undefined behavior. + * + * IPC functionality is restricted to devices with support for unified + * addressing on Linux and Windows operating systems. + * IPC functionality on Windows is restricted to GPUs in TCC mode. + * Users can test their device for IPC functionality by calling + * ::cudaDeviceGetAttribute with ::cudaDevAttrIpcEventSupport + * + * \param event - Returns the imported event + * \param handle - Interprocess handle to open + * + * \returns + * ::cudaSuccess, + * ::cudaErrorMapBufferObjectFailed, + * ::cudaErrorNotSupported, + * ::cudaErrorInvalidValue, + * ::cudaErrorDeviceUninitialized + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaEventCreate, + * ::cudaEventDestroy, + * ::cudaEventSynchronize, + * ::cudaEventQuery, + * ::cudaStreamWaitEvent, + * ::cudaIpcGetEventHandle, + * ::cudaIpcGetMemHandle, + * ::cudaIpcOpenMemHandle, + * ::cudaIpcCloseMemHandle, + * ::cuIpcOpenEventHandle + */ +extern __host__ cudaError_t CUDARTAPI cudaIpcOpenEventHandle(cudaEvent_t *event, cudaIpcEventHandle_t handle); + +/** + * \brief Gets an interprocess memory handle for an existing device memory + * allocation + * + * Takes a pointer to the base of an existing device memory allocation created + * with ::cudaMalloc and exports it for use in another process. This is a + * lightweight operation and may be called multiple times on an allocation + * without adverse effects. + * + * If a region of memory is freed with ::cudaFree and a subsequent call + * to ::cudaMalloc returns memory with the same device address, + * ::cudaIpcGetMemHandle will return a unique handle for the + * new memory. + * + * IPC functionality is restricted to devices with support for unified + * addressing on Linux and Windows operating systems. + * IPC functionality on Windows is restricted to GPUs in TCC mode. + * Users can test their device for IPC functionality by calling + * ::cudaDeviceGetAttribute with ::cudaDevAttrIpcEventSupport + * + * \param handle - Pointer to user allocated ::cudaIpcMemHandle to return + * the handle in. + * \param devPtr - Base pointer to previously allocated device memory + * + * \returns + * ::cudaSuccess, + * ::cudaErrorMemoryAllocation, + * ::cudaErrorMapBufferObjectFailed, + * ::cudaErrorNotSupported, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMalloc, + * ::cudaFree, + * ::cudaIpcGetEventHandle, + * ::cudaIpcOpenEventHandle, + * ::cudaIpcOpenMemHandle, + * ::cudaIpcCloseMemHandle, + * ::cuIpcGetMemHandle + */ +extern __host__ cudaError_t CUDARTAPI cudaIpcGetMemHandle(cudaIpcMemHandle_t *handle, void *devPtr); + +/** + * \brief Opens an interprocess memory handle exported from another process + * and returns a device pointer usable in the local process. + * + * Maps memory exported from another process with ::cudaIpcGetMemHandle into + * the current device address space. For contexts on different devices + * ::cudaIpcOpenMemHandle can attempt to enable peer access between the + * devices as if the user called ::cudaDeviceEnablePeerAccess. This behavior is + * controlled by the ::cudaIpcMemLazyEnablePeerAccess flag. + * ::cudaDeviceCanAccessPeer can determine if a mapping is possible. + * + * ::cudaIpcOpenMemHandle can open handles to devices that may not be visible + * in the process calling the API. + * + * Contexts that may open ::cudaIpcMemHandles are restricted in the following way. + * ::cudaIpcMemHandles from each device in a given process may only be opened + * by one context per device per other process. + * + * If the memory handle has already been opened by the current context, the + * reference count on the handle is incremented by 1 and the existing device pointer + * is returned. + * + * Memory returned from ::cudaIpcOpenMemHandle must be freed with + * ::cudaIpcCloseMemHandle. + * + * Calling ::cudaFree on an exported memory region before calling + * ::cudaIpcCloseMemHandle in the importing context will result in undefined + * behavior. + * + * IPC functionality is restricted to devices with support for unified + * addressing on Linux and Windows operating systems. + * IPC functionality on Windows is restricted to GPUs in TCC mode. + * Users can test their device for IPC functionality by calling + * ::cudaDeviceGetAttribute with ::cudaDevAttrIpcEventSupport + * + * \param devPtr - Returned device pointer + * \param handle - ::cudaIpcMemHandle to open + * \param flags - Flags for this operation. Must be specified as ::cudaIpcMemLazyEnablePeerAccess + * + * \returns + * ::cudaSuccess, + * ::cudaErrorMapBufferObjectFailed, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorDeviceUninitialized, + * ::cudaErrorTooManyPeers, + * ::cudaErrorNotSupported, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \note No guarantees are made about the address returned in \p *devPtr. + * In particular, multiple processes may not receive the same address for the same \p handle. + * + * \sa + * ::cudaMalloc, + * ::cudaFree, + * ::cudaIpcGetEventHandle, + * ::cudaIpcOpenEventHandle, + * ::cudaIpcGetMemHandle, + * ::cudaIpcCloseMemHandle, + * ::cudaDeviceEnablePeerAccess, + * ::cudaDeviceCanAccessPeer, + * ::cuIpcOpenMemHandle + */ +extern __host__ cudaError_t CUDARTAPI cudaIpcOpenMemHandle(void **devPtr, cudaIpcMemHandle_t handle, unsigned int flags); + +/** + * \brief Attempts to close memory mapped with cudaIpcOpenMemHandle + * + * Decrements the reference count of the memory returnd by ::cudaIpcOpenMemHandle by 1. + * When the reference count reaches 0, this API unmaps the memory. The original allocation + * in the exporting process as well as imported mappings in other processes + * will be unaffected. + * + * Any resources used to enable peer access will be freed if this is the + * last mapping using them. + * + * IPC functionality is restricted to devices with support for unified + * addressing on Linux and Windows operating systems. + * IPC functionality on Windows is restricted to GPUs in TCC mode. + * Users can test their device for IPC functionality by calling + * ::cudaDeviceGetAttribute with ::cudaDevAttrIpcEventSupport + * + * \param devPtr - Device pointer returned by ::cudaIpcOpenMemHandle + * + * \returns + * ::cudaSuccess, + * ::cudaErrorMapBufferObjectFailed, + * ::cudaErrorNotSupported, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMalloc, + * ::cudaFree, + * ::cudaIpcGetEventHandle, + * ::cudaIpcOpenEventHandle, + * ::cudaIpcGetMemHandle, + * ::cudaIpcOpenMemHandle, + * ::cuIpcCloseMemHandle + */ +extern __host__ cudaError_t CUDARTAPI cudaIpcCloseMemHandle(void *devPtr); + +/** + * \brief Blocks until remote writes are visible to the specified scope + * + * Blocks until remote writes to the target context via mappings created + * through GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see + * https://docs.nvidia.com/cuda/gpudirect-rdma for more information), are + * visible to the specified scope. + * + * If the scope equals or lies within the scope indicated by + * ::cudaDevAttrGPUDirectRDMAWritesOrdering, the call will be a no-op and + * can be safely omitted for performance. This can be determined by + * comparing the numerical values between the two enums, with smaller + * scopes having smaller values. + * + * Users may query support for this API via ::cudaDevAttrGPUDirectRDMAFlushWritesOptions. + * + * \param target - The target of the operation, see cudaFlushGPUDirectRDMAWritesTarget + * \param scope - The scope of the operation, see cudaFlushGPUDirectRDMAWritesScope + * + * \return + * ::cudaSuccess, + * ::cudaErrorNotSupported, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cuFlushGPUDirectRDMAWrites + */ +#if __CUDART_API_VERSION >= 11030 +extern __host__ cudaError_t CUDARTAPI cudaDeviceFlushGPUDirectRDMAWrites(enum cudaFlushGPUDirectRDMAWritesTarget target, enum cudaFlushGPUDirectRDMAWritesScope scope); +#endif + +/** +* \brief Registers a callback function to receive async notifications +* +* Registers \p callbackFunc to receive async notifications. +* +* The \p userData parameter is passed to the callback function at async notification time. +* Likewise, \p callback is also passed to the callback function to distinguish between +* multiple registered callbacks. +* +* The callback function being registered should be designed to return quickly (~10ms). +* Any long running tasks should be queued for execution on an application thread. +* +* Callbacks may not call cudaDeviceRegisterAsyncNotification or cudaDeviceUnregisterAsyncNotification. +* Doing so will result in ::cudaErrorNotPermitted. Async notification callbacks execute +* in an undefined order and may be serialized. +* +* Returns in \p *callback a handle representing the registered callback instance. +* +* \param device - The device on which to register the callback +* \param callbackFunc - The function to register as a callback +* \param userData - A generic pointer to user data. This is passed into the callback function. +* \param callback - A handle representing the registered callback instance +* +* \return +* ::cudaSuccess +* ::cudaErrorNotSupported +* ::cudaErrorInvalidDevice +* ::cudaErrorInvalidValue +* ::cudaErrorNotPermitted +* ::cudaErrorUnknown +* \notefnerr +* +* \sa +* ::cudaDeviceUnregisterAsyncNotification +*/ +extern __host__ cudaError_t CUDARTAPI cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback); + +/** +* \brief Unregisters an async notification callback +* +* Unregisters \p callback so that the corresponding callback function will stop receiving +* async notifications. +* +* \param device - The device from which to remove \p callback. +* \param callback - The callback instance to unregister from receiving async notifications. +* +* \return +* ::cudaSuccess +* ::cudaErrorNotSupported +* ::cudaErrorInvalidDevice +* ::cudaErrorInvalidValue +* ::cudaErrorNotPermitted +* ::cudaErrorUnknown +* \notefnerr +* +* \sa +* ::cudaDeviceRegisterAsyncNotification +*/ +extern __host__ cudaError_t CUDARTAPI cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback); + +/** @} */ /* END CUDART_DEVICE */ + +/** + * \defgroup CUDART_DEVICE_DEPRECATED Device Management [DEPRECATED] + * + * ___MANBRIEF___ deprecated device management functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the deprecated device management functions of the CUDA runtime + * application programming interface. + * + * @{ + */ + +/** + * \brief Returns the shared memory configuration for the current device. + * + * \deprecated + * + * This function will return in \p pConfig the current size of shared memory banks + * on the current device. On devices with configurable shared memory banks, + * ::cudaDeviceSetSharedMemConfig can be used to change this setting, so that all + * subsequent kernel launches will by default use the new bank size. When + * ::cudaDeviceGetSharedMemConfig is called on devices without configurable shared + * memory, it will return the fixed bank size of the hardware. + * + * The returned bank configurations can be either: + * - ::cudaSharedMemBankSizeFourByte - shared memory bank width is four bytes. + * - ::cudaSharedMemBankSizeEightByte - shared memory bank width is eight bytes. + * + * \param pConfig - Returned cache configuration + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceSetCacheConfig, + * ::cudaDeviceGetCacheConfig, + * ::cudaDeviceSetSharedMemConfig, + * ::cudaFuncSetCacheConfig, + * ::cuCtxGetSharedMemConfig + */ +extern __CUDA_DEPRECATED __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig); + +/** + * \brief Sets the shared memory configuration for the current device. + * + * \deprecated + * + * On devices with configurable shared memory banks, this function will set + * the shared memory bank size which is used for all subsequent kernel launches. + * Any per-function setting of shared memory set via ::cudaFuncSetSharedMemConfig + * will override the device wide setting. + * + * Changing the shared memory configuration between launches may introduce + * a device side synchronization point. + * + * Changing the shared memory bank size will not increase shared memory usage + * or affect occupancy of kernels, but may have major effects on performance. + * Larger bank sizes will allow for greater potential bandwidth to shared memory, + * but will change what kinds of accesses to shared memory will result in bank + * conflicts. + * + * This function will do nothing on devices with fixed shared memory bank size. + * + * The supported bank configurations are: + * - ::cudaSharedMemBankSizeDefault: set bank width the device default (currently, + * four bytes) + * - ::cudaSharedMemBankSizeFourByte: set shared memory bank width to be four bytes + * natively. + * - ::cudaSharedMemBankSizeEightByte: set shared memory bank width to be eight + * bytes natively. + * + * \param config - Requested cache configuration + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceSetCacheConfig, + * ::cudaDeviceGetCacheConfig, + * ::cudaDeviceGetSharedMemConfig, + * ::cudaFuncSetCacheConfig, + * ::cuCtxSetSharedMemConfig + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaDeviceSetSharedMemConfig(enum cudaSharedMemConfig config); +/** @} */ /* END CUDART_DEVICE_DEPRECATED */ + +/** + * \defgroup CUDART_THREAD_DEPRECATED Thread Management [DEPRECATED] + * + * ___MANBRIEF___ deprecated thread management functions of the CUDA runtime + * API (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes deprecated thread management functions of the CUDA runtime + * application programming interface. + * + * @{ + */ + +/** + * \brief Exit and clean up from CUDA launches + * + * \deprecated + * + * Note that this function is deprecated because its name does not + * reflect its behavior. Its functionality is identical to the + * non-deprecated function ::cudaDeviceReset(), which should be used + * instead. + * + * Explicitly destroys all cleans up all resources associated with the current + * device in the current process. Any subsequent API call to this device will + * reinitialize the device. + * + * Note that this function will reset the device immediately. It is the caller's + * responsibility to ensure that the device is not being accessed by any + * other host threads from the process when this function is called. + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceReset + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadExit(void); + +/** + * \brief Wait for compute device to finish + * + * \deprecated + * + * Note that this function is deprecated because its name does not + * reflect its behavior. Its functionality is similar to the + * non-deprecated function ::cudaDeviceSynchronize(), which should be used + * instead. + * + * Blocks until the device has completed all preceding requested tasks. + * ::cudaThreadSynchronize() returns an error if one of the preceding tasks + * has failed. If the ::cudaDeviceScheduleBlockingSync flag was set for + * this device, the host thread will block until the device has finished + * its work. + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceSynchronize + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadSynchronize(void); + +/** + * \brief Set resource limits + * + * \deprecated + * + * Note that this function is deprecated because its name does not + * reflect its behavior. Its functionality is identical to the + * non-deprecated function ::cudaDeviceSetLimit(), which should be used + * instead. + * + * Setting \p limit to \p value is a request by the application to update + * the current limit maintained by the device. The driver is free to + * modify the requested value to meet h/w requirements (this could be + * clamping to minimum or maximum values, rounding up to nearest element + * size, etc). The application can use ::cudaThreadGetLimit() to find out + * exactly what the limit has been set to. + * + * Setting each ::cudaLimit has its own specific restrictions, so each is + * discussed here. + * + * - ::cudaLimitStackSize controls the stack size of each GPU thread. + * + * - ::cudaLimitPrintfFifoSize controls the size of the shared FIFO + * used by the ::printf() device system call. + * Setting ::cudaLimitPrintfFifoSize must be performed before + * launching any kernel that uses the ::printf() device + * system call, otherwise ::cudaErrorInvalidValue will be returned. + * + * - ::cudaLimitMallocHeapSize controls the size of the heap used + * by the ::malloc() and ::free() device system calls. Setting + * ::cudaLimitMallocHeapSize must be performed before launching + * any kernel that uses the ::malloc() or ::free() device system calls, + * otherwise ::cudaErrorInvalidValue will be returned. + * + * \param limit - Limit to set + * \param value - Size in bytes of limit + * + * \return + * ::cudaSuccess, + * ::cudaErrorUnsupportedLimit, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceSetLimit + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadSetLimit(enum cudaLimit limit, size_t value); + +/** + * \brief Returns resource limits + * + * \deprecated + * + * Note that this function is deprecated because its name does not + * reflect its behavior. Its functionality is identical to the + * non-deprecated function ::cudaDeviceGetLimit(), which should be used + * instead. + * + * Returns in \p *pValue the current size of \p limit. The supported + * ::cudaLimit values are: + * - ::cudaLimitStackSize: stack size of each GPU thread; + * - ::cudaLimitPrintfFifoSize: size of the shared FIFO used by the + * ::printf() device system call. + * - ::cudaLimitMallocHeapSize: size of the heap used by the + * ::malloc() and ::free() device system calls; + * + * \param limit - Limit to query + * \param pValue - Returned size in bytes of limit + * + * \return + * ::cudaSuccess, + * ::cudaErrorUnsupportedLimit, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceGetLimit + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadGetLimit(size_t *pValue, enum cudaLimit limit); + +/** + * \brief Returns the preferred cache configuration for the current device. + * + * \deprecated + * + * Note that this function is deprecated because its name does not + * reflect its behavior. Its functionality is identical to the + * non-deprecated function ::cudaDeviceGetCacheConfig(), which should be + * used instead. + * + * On devices where the L1 cache and shared memory use the same hardware + * resources, this returns through \p pCacheConfig the preferred cache + * configuration for the current device. This is only a preference. The + * runtime will use the requested configuration if possible, but it is free to + * choose a different configuration if required to execute functions. + * + * This will return a \p pCacheConfig of ::cudaFuncCachePreferNone on devices + * where the size of the L1 cache and shared memory are fixed. + * + * The supported cache configurations are: + * - ::cudaFuncCachePreferNone: no preference for shared memory or L1 (default) + * - ::cudaFuncCachePreferShared: prefer larger shared memory and smaller L1 cache + * - ::cudaFuncCachePreferL1: prefer larger L1 cache and smaller shared memory + * + * \param pCacheConfig - Returned cache configuration + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceGetCacheConfig + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadGetCacheConfig(enum cudaFuncCache *pCacheConfig); + +/** + * \brief Sets the preferred cache configuration for the current device. + * + * \deprecated + * + * Note that this function is deprecated because its name does not + * reflect its behavior. Its functionality is identical to the + * non-deprecated function ::cudaDeviceSetCacheConfig(), which should be + * used instead. + * + * On devices where the L1 cache and shared memory use the same hardware + * resources, this sets through \p cacheConfig the preferred cache + * configuration for the current device. This is only a preference. The + * runtime will use the requested configuration if possible, but it is free to + * choose a different configuration if required to execute the function. Any + * function preference set via + * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)" + * or + * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)" + * will be preferred over this device-wide setting. Setting the device-wide + * cache configuration to ::cudaFuncCachePreferNone will cause subsequent + * kernel launches to prefer to not change the cache configuration unless + * required to launch the kernel. + * + * This setting does nothing on devices where the size of the L1 cache and + * shared memory are fixed. + * + * Launching a kernel with a different preference than the most recent + * preference setting may insert a device-side synchronization point. + * + * The supported cache configurations are: + * - ::cudaFuncCachePreferNone: no preference for shared memory or L1 (default) + * - ::cudaFuncCachePreferShared: prefer larger shared memory and smaller L1 cache + * - ::cudaFuncCachePreferL1: prefer larger L1 cache and smaller shared memory + * + * \param cacheConfig - Requested cache configuration + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceSetCacheConfig + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadSetCacheConfig(enum cudaFuncCache cacheConfig); + +/** @} */ /* END CUDART_THREAD_DEPRECATED */ + +/** + * \defgroup CUDART_ERROR Error Handling + * + * ___MANBRIEF___ error handling functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the error handling functions of the CUDA runtime + * application programming interface. + * + * @{ + */ + +/** + * \brief Returns the last error from a runtime call + * + * Returns the last error that has been produced by any of the runtime calls + * in the same instance of the CUDA Runtime library in the host thread and + * resets it to ::cudaSuccess. + * + * Note: Multiple instances of the CUDA Runtime library can be present in an + * application when using a library that statically links the CUDA Runtime. + * + * \return + * ::cudaSuccess, + * ::cudaErrorMissingConfiguration, + * ::cudaErrorMemoryAllocation, + * ::cudaErrorInitializationError, + * ::cudaErrorLaunchFailure, + * ::cudaErrorLaunchTimeout, + * ::cudaErrorLaunchOutOfResources, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidConfiguration, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidPitchValue, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorUnmapBufferObjectFailed, + * ::cudaErrorInvalidDevicePointer, + * ::cudaErrorInvalidTexture, + * ::cudaErrorInvalidTextureBinding, + * ::cudaErrorInvalidChannelDescriptor, + * ::cudaErrorInvalidMemcpyDirection, + * ::cudaErrorInvalidFilterSetting, + * ::cudaErrorInvalidNormSetting, + * ::cudaErrorUnknown, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorInsufficientDriver, + * ::cudaErrorNoDevice, + * ::cudaErrorSetOnActiveProcess, + * ::cudaErrorStartupFailure, + * ::cudaErrorInvalidPtx, + * ::cudaErrorUnsupportedPtxVersion, + * ::cudaErrorNoKernelImageForDevice, + * ::cudaErrorJitCompilerNotFound, + * ::cudaErrorJitCompilationDisabled + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaPeekAtLastError, ::cudaGetErrorName, ::cudaGetErrorString, ::cudaError + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetLastError(void); + +/** + * \brief Returns the last error from a runtime call + * + * Returns the last error that has been produced by any of the runtime calls + * in the same instance of the CUDA Runtime library in the host thread. This + * call does not reset the error to ::cudaSuccess like ::cudaGetLastError(). + * + * Note: Multiple instances of the CUDA Runtime library can be present in an + * application when using a library that statically links the CUDA Runtime. + * + * \return + * ::cudaSuccess, + * ::cudaErrorMissingConfiguration, + * ::cudaErrorMemoryAllocation, + * ::cudaErrorInitializationError, + * ::cudaErrorLaunchFailure, + * ::cudaErrorLaunchTimeout, + * ::cudaErrorLaunchOutOfResources, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidConfiguration, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidPitchValue, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorUnmapBufferObjectFailed, + * ::cudaErrorInvalidDevicePointer, + * ::cudaErrorInvalidTexture, + * ::cudaErrorInvalidTextureBinding, + * ::cudaErrorInvalidChannelDescriptor, + * ::cudaErrorInvalidMemcpyDirection, + * ::cudaErrorInvalidFilterSetting, + * ::cudaErrorInvalidNormSetting, + * ::cudaErrorUnknown, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorInsufficientDriver, + * ::cudaErrorNoDevice, + * ::cudaErrorSetOnActiveProcess, + * ::cudaErrorStartupFailure, + * ::cudaErrorInvalidPtx, + * ::cudaErrorUnsupportedPtxVersion, + * ::cudaErrorNoKernelImageForDevice, + * ::cudaErrorJitCompilerNotFound, + * ::cudaErrorJitCompilationDisabled + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetLastError, ::cudaGetErrorName, ::cudaGetErrorString, ::cudaError + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaPeekAtLastError(void); + +/** + * \brief Returns the string representation of an error code enum name + * + * Returns a string containing the name of an error code in the enum. If the error + * code is not recognized, "unrecognized error code" is returned. + * + * \param error - Error code to convert to string + * + * \return + * \p char* pointer to a NULL-terminated string + * + * \sa ::cudaGetErrorString, ::cudaGetLastError, ::cudaPeekAtLastError, ::cudaError, + * ::cuGetErrorName + */ +extern __host__ __cudart_builtin__ const char* CUDARTAPI cudaGetErrorName(cudaError_t error); + +/** + * \brief Returns the description string for an error code + * + * Returns the description string for an error code. If the error + * code is not recognized, "unrecognized error code" is returned. + * + * \param error - Error code to convert to string + * + * \return + * \p char* pointer to a NULL-terminated string + * + * \sa ::cudaGetErrorName, ::cudaGetLastError, ::cudaPeekAtLastError, ::cudaError, + * ::cuGetErrorString + */ +extern __host__ __cudart_builtin__ const char* CUDARTAPI cudaGetErrorString(cudaError_t error); +/** @} */ /* END CUDART_ERROR */ + +/** + * \addtogroup CUDART_DEVICE + * + * @{ + */ + +/** + * \brief Returns the number of compute-capable devices + * + * Returns in \p *count the number of devices with compute capability greater + * or equal to 2.0 that are available for execution. + * + * \param count - Returns the number of devices with compute capability + * greater or equal to 2.0 + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDevice, ::cudaSetDevice, ::cudaGetDeviceProperties, + * ::cudaChooseDevice, + * ::cudaInitDevice, + * ::cuDeviceGetCount + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDeviceCount(int *count); + +/** + * \brief Returns information about the compute-device + * + * Returns in \p *prop the properties of device \p dev. The ::cudaDeviceProp + * structure is defined as: + * \code + struct cudaDeviceProp { + char name[256]; + cudaUUID_t uuid; + size_t totalGlobalMem; + size_t sharedMemPerBlock; + int regsPerBlock; + int warpSize; + size_t memPitch; + int maxThreadsPerBlock; + int maxThreadsDim[3]; + int maxGridSize[3]; + int clockRate; + size_t totalConstMem; + int major; + int minor; + size_t textureAlignment; + size_t texturePitchAlignment; + int deviceOverlap; + int multiProcessorCount; + int kernelExecTimeoutEnabled; + int integrated; + int canMapHostMemory; + int computeMode; + int maxTexture1D; + int maxTexture1DMipmap; + int maxTexture1DLinear; + int maxTexture2D[2]; + int maxTexture2DMipmap[2]; + int maxTexture2DLinear[3]; + int maxTexture2DGather[2]; + int maxTexture3D[3]; + int maxTexture3DAlt[3]; + int maxTextureCubemap; + int maxTexture1DLayered[2]; + int maxTexture2DLayered[3]; + int maxTextureCubemapLayered[2]; + int maxSurface1D; + int maxSurface2D[2]; + int maxSurface3D[3]; + int maxSurface1DLayered[2]; + int maxSurface2DLayered[3]; + int maxSurfaceCubemap; + int maxSurfaceCubemapLayered[2]; + size_t surfaceAlignment; + int concurrentKernels; + int ECCEnabled; + int pciBusID; + int pciDeviceID; + int pciDomainID; + int tccDriver; + int asyncEngineCount; + int unifiedAddressing; + int memoryClockRate; + int memoryBusWidth; + int l2CacheSize; + int persistingL2CacheMaxSize; + int maxThreadsPerMultiProcessor; + int streamPrioritiesSupported; + int globalL1CacheSupported; + int localL1CacheSupported; + size_t sharedMemPerMultiprocessor; + int regsPerMultiprocessor; + int managedMemory; + int isMultiGpuBoard; + int multiGpuBoardGroupID; + int singleToDoublePrecisionPerfRatio; + int pageableMemoryAccess; + int concurrentManagedAccess; + int computePreemptionSupported; + int canUseHostPointerForRegisteredMem; + int cooperativeLaunch; + int cooperativeMultiDeviceLaunch; + int pageableMemoryAccessUsesHostPageTables; + int directManagedMemAccessFromHost; + int accessPolicyMaxWindowSize; + } + \endcode + * where: + * - \ref ::cudaDeviceProp::name "name[256]" is an ASCII string identifying + * the device. + * - \ref ::cudaDeviceProp::uuid "uuid" is a 16-byte unique identifier. + * - \ref ::cudaDeviceProp::totalGlobalMem "totalGlobalMem" is the total + * amount of global memory available on the device in bytes. + * - \ref ::cudaDeviceProp::sharedMemPerBlock "sharedMemPerBlock" is the + * maximum amount of shared memory available to a thread block in bytes. + * - \ref ::cudaDeviceProp::regsPerBlock "regsPerBlock" is the maximum number + * of 32-bit registers available to a thread block. + * - \ref ::cudaDeviceProp::warpSize "warpSize" is the warp size in threads. + * - \ref ::cudaDeviceProp::memPitch "memPitch" is the maximum pitch in + * bytes allowed by the memory copy functions that involve memory regions + * allocated through ::cudaMallocPitch(). + * - \ref ::cudaDeviceProp::maxThreadsPerBlock "maxThreadsPerBlock" is the + * maximum number of threads per block. + * - \ref ::cudaDeviceProp::maxThreadsDim "maxThreadsDim[3]" contains the + * maximum size of each dimension of a block. + * - \ref ::cudaDeviceProp::maxGridSize "maxGridSize[3]" contains the + * maximum size of each dimension of a grid. + * - \ref ::cudaDeviceProp::clockRate "clockRate" is the clock frequency in + * kilohertz. + * - \ref ::cudaDeviceProp::totalConstMem "totalConstMem" is the total amount + * of constant memory available on the device in bytes. + * - \ref ::cudaDeviceProp::major "major", + * \ref ::cudaDeviceProp::minor "minor" are the major and minor revision + * numbers defining the device's compute capability. + * - \ref ::cudaDeviceProp::textureAlignment "textureAlignment" is the + * alignment requirement; texture base addresses that are aligned to + * \ref ::cudaDeviceProp::textureAlignment "textureAlignment" bytes do not + * need an offset applied to texture fetches. + * - \ref ::cudaDeviceProp::texturePitchAlignment "texturePitchAlignment" is the + * pitch alignment requirement for 2D texture references that are bound to + * pitched memory. + * - \ref ::cudaDeviceProp::deviceOverlap "deviceOverlap" is 1 if the device + * can concurrently copy memory between host and device while executing a + * kernel, or 0 if not. Deprecated, use instead asyncEngineCount. + * - \ref ::cudaDeviceProp::multiProcessorCount "multiProcessorCount" is the + * number of multiprocessors on the device. + * - \ref ::cudaDeviceProp::kernelExecTimeoutEnabled "kernelExecTimeoutEnabled" + * is 1 if there is a run time limit for kernels executed on the device, or + * 0 if not. + * - \ref ::cudaDeviceProp::integrated "integrated" is 1 if the device is an + * integrated (motherboard) GPU and 0 if it is a discrete (card) component. + * - \ref ::cudaDeviceProp::canMapHostMemory "canMapHostMemory" is 1 if the + * device can map host memory into the CUDA address space for use with + * ::cudaHostAlloc()/::cudaHostGetDevicePointer(), or 0 if not. + * - \ref ::cudaDeviceProp::computeMode "computeMode" is the compute mode + * that the device is currently in. Available modes are as follows: + * - cudaComputeModeDefault: Default mode - Device is not restricted and + * multiple threads can use ::cudaSetDevice() with this device. + * - cudaComputeModeProhibited: Compute-prohibited mode - No threads can use + * ::cudaSetDevice() with this device. + * - cudaComputeModeExclusiveProcess: Compute-exclusive-process mode - Many + * threads in one process will be able to use ::cudaSetDevice() with this device. + *
When an occupied exclusive mode device is chosen with ::cudaSetDevice, + * all subsequent non-device management runtime functions will return + * ::cudaErrorDevicesUnavailable. + * - \ref ::cudaDeviceProp::maxTexture1D "maxTexture1D" is the maximum 1D + * texture size. + * - \ref ::cudaDeviceProp::maxTexture1DMipmap "maxTexture1DMipmap" is the maximum + * 1D mipmapped texture texture size. + * - \ref ::cudaDeviceProp::maxTexture1DLinear "maxTexture1DLinear" is the maximum + * 1D texture size for textures bound to linear memory. + * - \ref ::cudaDeviceProp::maxTexture2D "maxTexture2D[2]" contains the maximum + * 2D texture dimensions. + * - \ref ::cudaDeviceProp::maxTexture2DMipmap "maxTexture2DMipmap[2]" contains the + * maximum 2D mipmapped texture dimensions. + * - \ref ::cudaDeviceProp::maxTexture2DLinear "maxTexture2DLinear[3]" contains the + * maximum 2D texture dimensions for 2D textures bound to pitch linear memory. + * - \ref ::cudaDeviceProp::maxTexture2DGather "maxTexture2DGather[2]" contains the + * maximum 2D texture dimensions if texture gather operations have to be performed. + * - \ref ::cudaDeviceProp::maxTexture3D "maxTexture3D[3]" contains the maximum + * 3D texture dimensions. + * - \ref ::cudaDeviceProp::maxTexture3DAlt "maxTexture3DAlt[3]" + * contains the maximum alternate 3D texture dimensions. + * - \ref ::cudaDeviceProp::maxTextureCubemap "maxTextureCubemap" is the + * maximum cubemap texture width or height. + * - \ref ::cudaDeviceProp::maxTexture1DLayered "maxTexture1DLayered[2]" contains + * the maximum 1D layered texture dimensions. + * - \ref ::cudaDeviceProp::maxTexture2DLayered "maxTexture2DLayered[3]" contains + * the maximum 2D layered texture dimensions. + * - \ref ::cudaDeviceProp::maxTextureCubemapLayered "maxTextureCubemapLayered[2]" + * contains the maximum cubemap layered texture dimensions. + * - \ref ::cudaDeviceProp::maxSurface1D "maxSurface1D" is the maximum 1D + * surface size. + * - \ref ::cudaDeviceProp::maxSurface2D "maxSurface2D[2]" contains the maximum + * 2D surface dimensions. + * - \ref ::cudaDeviceProp::maxSurface3D "maxSurface3D[3]" contains the maximum + * 3D surface dimensions. + * - \ref ::cudaDeviceProp::maxSurface1DLayered "maxSurface1DLayered[2]" contains + * the maximum 1D layered surface dimensions. + * - \ref ::cudaDeviceProp::maxSurface2DLayered "maxSurface2DLayered[3]" contains + * the maximum 2D layered surface dimensions. + * - \ref ::cudaDeviceProp::maxSurfaceCubemap "maxSurfaceCubemap" is the maximum + * cubemap surface width or height. + * - \ref ::cudaDeviceProp::maxSurfaceCubemapLayered "maxSurfaceCubemapLayered[2]" + * contains the maximum cubemap layered surface dimensions. + * - \ref ::cudaDeviceProp::surfaceAlignment "surfaceAlignment" specifies the + * alignment requirements for surfaces. + * - \ref ::cudaDeviceProp::concurrentKernels "concurrentKernels" is 1 if the + * device supports executing multiple kernels within the same context + * simultaneously, or 0 if not. It is not guaranteed that multiple kernels + * will be resident on the device concurrently so this feature should not be + * relied upon for correctness. + * - \ref ::cudaDeviceProp::ECCEnabled "ECCEnabled" is 1 if the device has ECC + * support turned on, or 0 if not. + * - \ref ::cudaDeviceProp::pciBusID "pciBusID" is the PCI bus identifier of + * the device. + * - \ref ::cudaDeviceProp::pciDeviceID "pciDeviceID" is the PCI device + * (sometimes called slot) identifier of the device. + * - \ref ::cudaDeviceProp::pciDomainID "pciDomainID" is the PCI domain identifier + * of the device. + * - \ref ::cudaDeviceProp::tccDriver "tccDriver" is 1 if the device is using a + * TCC driver or 0 if not. + * - \ref ::cudaDeviceProp::asyncEngineCount "asyncEngineCount" is 1 when the + * device can concurrently copy memory between host and device while executing + * a kernel. It is 2 when the device can concurrently copy memory between host + * and device in both directions and execute a kernel at the same time. It is + * 0 if neither of these is supported. + * - \ref ::cudaDeviceProp::unifiedAddressing "unifiedAddressing" is 1 if the device + * shares a unified address space with the host and 0 otherwise. + * - \ref ::cudaDeviceProp::memoryClockRate "memoryClockRate" is the peak memory + * clock frequency in kilohertz. + * - \ref ::cudaDeviceProp::memoryBusWidth "memoryBusWidth" is the memory bus width + * in bits. + * - \ref ::cudaDeviceProp::l2CacheSize "l2CacheSize" is L2 cache size in bytes. + * - \ref ::cudaDeviceProp::persistingL2CacheMaxSize "persistingL2CacheMaxSize" is L2 cache's maximum persisting lines size in bytes. + * - \ref ::cudaDeviceProp::maxThreadsPerMultiProcessor "maxThreadsPerMultiProcessor" + * is the number of maximum resident threads per multiprocessor. + * - \ref ::cudaDeviceProp::streamPrioritiesSupported "streamPrioritiesSupported" + * is 1 if the device supports stream priorities, or 0 if it is not supported. + * - \ref ::cudaDeviceProp::globalL1CacheSupported "globalL1CacheSupported" + * is 1 if the device supports caching of globals in L1 cache, or 0 if it is not supported. + * - \ref ::cudaDeviceProp::localL1CacheSupported "localL1CacheSupported" + * is 1 if the device supports caching of locals in L1 cache, or 0 if it is not supported. + * - \ref ::cudaDeviceProp::sharedMemPerMultiprocessor "sharedMemPerMultiprocessor" is the + * maximum amount of shared memory available to a multiprocessor in bytes; this amount is + * shared by all thread blocks simultaneously resident on a multiprocessor. + * - \ref ::cudaDeviceProp::regsPerMultiprocessor "regsPerMultiprocessor" is the maximum number + * of 32-bit registers available to a multiprocessor; this number is shared + * by all thread blocks simultaneously resident on a multiprocessor. + * - \ref ::cudaDeviceProp::managedMemory "managedMemory" + * is 1 if the device supports allocating managed memory on this system, or 0 if it is not supported. + * - \ref ::cudaDeviceProp::isMultiGpuBoard "isMultiGpuBoard" + * is 1 if the device is on a multi-GPU board (e.g. Gemini cards), and 0 if not; + * - \ref ::cudaDeviceProp::multiGpuBoardGroupID "multiGpuBoardGroupID" is a unique identifier + * for a group of devices associated with the same board. + * Devices on the same multi-GPU board will share the same identifier. + * - \ref ::cudaDeviceProp::hostNativeAtomicSupported "hostNativeAtomicSupported" + * is 1 if the link between the device and the host supports native atomic operations, or 0 if it is not supported. + * - \ref ::cudaDeviceProp::singleToDoublePrecisionPerfRatio "singleToDoublePrecisionPerfRatio" + * is the ratio of single precision performance (in floating-point operations per second) + * to double precision performance. + * - \ref ::cudaDeviceProp::pageableMemoryAccess "pageableMemoryAccess" is 1 if the device supports + * coherently accessing pageable memory without calling cudaHostRegister on it, and 0 otherwise. + * - \ref ::cudaDeviceProp::concurrentManagedAccess "concurrentManagedAccess" is 1 if the device can + * coherently access managed memory concurrently with the CPU, and 0 otherwise. + * - \ref ::cudaDeviceProp::computePreemptionSupported "computePreemptionSupported" is 1 if the device + * supports Compute Preemption, and 0 otherwise. + * - \ref ::cudaDeviceProp::canUseHostPointerForRegisteredMem "canUseHostPointerForRegisteredMem" is 1 if + * the device can access host registered memory at the same virtual address as the CPU, and 0 otherwise. + * - \ref ::cudaDeviceProp::cooperativeLaunch "cooperativeLaunch" is 1 if the device supports launching + * cooperative kernels via ::cudaLaunchCooperativeKernel, and 0 otherwise. + * - \ref ::cudaDeviceProp::cooperativeMultiDeviceLaunch "cooperativeMultiDeviceLaunch" is 1 if the device + * supports launching cooperative kernels via ::cudaLaunchCooperativeKernelMultiDevice, and 0 otherwise. + * - \ref ::cudaDeviceProp::sharedMemPerBlockOptin "sharedMemPerBlockOptin" + * is the per device maximum shared memory per block usable by special opt in + * - \ref ::cudaDeviceProp::pageableMemoryAccessUsesHostPageTables "pageableMemoryAccessUsesHostPageTables" is 1 if the device accesses + * pageable memory via the host's page tables, and 0 otherwise. + * - \ref ::cudaDeviceProp::directManagedMemAccessFromHost "directManagedMemAccessFromHost" is 1 if the host can directly access managed + * memory on the device without migration, and 0 otherwise. + * - \ref ::cudaDeviceProp::maxBlocksPerMultiProcessor "maxBlocksPerMultiProcessor" is the maximum number of thread blocks + * that can reside on a multiprocessor. + * - \ref ::cudaDeviceProp::accessPolicyMaxWindowSize "accessPolicyMaxWindowSize" is + * the maximum value of ::cudaAccessPolicyWindow::num_bytes. + * - \ref ::cudaDeviceProp::reservedSharedMemPerBlock "reservedSharedMemPerBlock" + * is the shared memory reserved by CUDA driver per block in bytes + * - \ref ::cudaDeviceProp::hostRegisterSupported "hostRegisterSupported" + * is 1 if the device supports host memory registration via ::cudaHostRegister, and 0 otherwise. + * - \ref ::cudaDeviceProp::sparseCudaArraySupported "sparseCudaArraySupported" + * is 1 if the device supports sparse CUDA arrays and sparse CUDA mipmapped arrays, 0 otherwise + * - \ref ::cudaDeviceProp::hostRegisterReadOnlySupported "hostRegisterReadOnlySupported" + * is 1 if the device supports using the ::cudaHostRegister flag cudaHostRegisterReadOnly to register memory that must be mapped as + * read-only to the GPU + * - \ref ::cudaDeviceProp::timelineSemaphoreInteropSupported "timelineSemaphoreInteropSupported" + * is 1 if external timeline semaphore interop is supported on the device, 0 otherwise + * - \ref ::cudaDeviceProp::memoryPoolsSupported "memoryPoolsSupported" + * is 1 if the device supports using the cudaMallocAsync and cudaMemPool family of APIs, 0 otherwise + * - \ref ::cudaDeviceProp::gpuDirectRDMASupported "gpuDirectRDMASupported" + * is 1 if the device supports GPUDirect RDMA APIs, 0 otherwise + * - \ref ::cudaDeviceProp::gpuDirectRDMAFlushWritesOptions "gpuDirectRDMAFlushWritesOptions" + * is a bitmask to be interpreted according to the ::cudaFlushGPUDirectRDMAWritesOptions enum + * - \ref ::cudaDeviceProp::gpuDirectRDMAWritesOrdering "gpuDirectRDMAWritesOrdering" + * See the ::cudaGPUDirectRDMAWritesOrdering enum for numerical values + * - \ref ::cudaDeviceProp::memoryPoolSupportedHandleTypes "memoryPoolSupportedHandleTypes" + * is a bitmask of handle types supported with mempool-based IPC + * - \ref ::cudaDeviceProp::deferredMappingCudaArraySupported "deferredMappingCudaArraySupported" + * is 1 if the device supports deferred mapping CUDA arrays and CUDA mipmapped arrays + * - \ref ::cudaDeviceProp::ipcEventSupported "ipcEventSupported" + * is 1 if the device supports IPC Events, and 0 otherwise + * - \ref ::cudaDeviceProp::unifiedFunctionPointers "unifiedFunctionPointers" + * is 1 if the device support unified pointers, and 0 otherwise + * + * \param prop - Properties for the specified device + * \param device - Device number to get properties for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDeviceCount, ::cudaGetDevice, ::cudaSetDevice, ::cudaChooseDevice, + * ::cudaDeviceGetAttribute, + * ::cudaInitDevice, + * ::cuDeviceGetAttribute, + * ::cuDeviceGetName + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDeviceProperties(struct cudaDeviceProp *prop, int device); + +/** + * \brief Returns information about the device + * + * Returns in \p *value the integer value of the attribute \p attr on device + * \p device. The supported attributes are: + * - ::cudaDevAttrMaxThreadsPerBlock: Maximum number of threads per block + * - ::cudaDevAttrMaxBlockDimX: Maximum x-dimension of a block + * - ::cudaDevAttrMaxBlockDimY: Maximum y-dimension of a block + * - ::cudaDevAttrMaxBlockDimZ: Maximum z-dimension of a block + * - ::cudaDevAttrMaxGridDimX: Maximum x-dimension of a grid + * - ::cudaDevAttrMaxGridDimY: Maximum y-dimension of a grid + * - ::cudaDevAttrMaxGridDimZ: Maximum z-dimension of a grid + * - ::cudaDevAttrMaxSharedMemoryPerBlock: Maximum amount of shared memory + * available to a thread block in bytes + * - ::cudaDevAttrTotalConstantMemory: Memory available on device for + * __constant__ variables in a CUDA C kernel in bytes + * - ::cudaDevAttrWarpSize: Warp size in threads + * - ::cudaDevAttrMaxPitch: Maximum pitch in bytes allowed by the memory copy + * functions that involve memory regions allocated through ::cudaMallocPitch() + * - ::cudaDevAttrMaxTexture1DWidth: Maximum 1D texture width + * - ::cudaDevAttrMaxTexture1DLinearWidth: Maximum width for a 1D texture bound + * to linear memory + * - ::cudaDevAttrMaxTexture1DMipmappedWidth: Maximum mipmapped 1D texture width + * - ::cudaDevAttrMaxTexture2DWidth: Maximum 2D texture width + * - ::cudaDevAttrMaxTexture2DHeight: Maximum 2D texture height + * - ::cudaDevAttrMaxTexture2DLinearWidth: Maximum width for a 2D texture + * bound to linear memory + * - ::cudaDevAttrMaxTexture2DLinearHeight: Maximum height for a 2D texture + * bound to linear memory + * - ::cudaDevAttrMaxTexture2DLinearPitch: Maximum pitch in bytes for a 2D + * texture bound to linear memory + * - ::cudaDevAttrMaxTexture2DMipmappedWidth: Maximum mipmapped 2D texture + * width + * - ::cudaDevAttrMaxTexture2DMipmappedHeight: Maximum mipmapped 2D texture + * height + * - ::cudaDevAttrMaxTexture3DWidth: Maximum 3D texture width + * - ::cudaDevAttrMaxTexture3DHeight: Maximum 3D texture height + * - ::cudaDevAttrMaxTexture3DDepth: Maximum 3D texture depth + * - ::cudaDevAttrMaxTexture3DWidthAlt: Alternate maximum 3D texture width, + * 0 if no alternate maximum 3D texture size is supported + * - ::cudaDevAttrMaxTexture3DHeightAlt: Alternate maximum 3D texture height, + * 0 if no alternate maximum 3D texture size is supported + * - ::cudaDevAttrMaxTexture3DDepthAlt: Alternate maximum 3D texture depth, + * 0 if no alternate maximum 3D texture size is supported + * - ::cudaDevAttrMaxTextureCubemapWidth: Maximum cubemap texture width or + * height + * - ::cudaDevAttrMaxTexture1DLayeredWidth: Maximum 1D layered texture width + * - ::cudaDevAttrMaxTexture1DLayeredLayers: Maximum layers in a 1D layered + * texture + * - ::cudaDevAttrMaxTexture2DLayeredWidth: Maximum 2D layered texture width + * - ::cudaDevAttrMaxTexture2DLayeredHeight: Maximum 2D layered texture height + * - ::cudaDevAttrMaxTexture2DLayeredLayers: Maximum layers in a 2D layered + * texture + * - ::cudaDevAttrMaxTextureCubemapLayeredWidth: Maximum cubemap layered + * texture width or height + * - ::cudaDevAttrMaxTextureCubemapLayeredLayers: Maximum layers in a cubemap + * layered texture + * - ::cudaDevAttrMaxSurface1DWidth: Maximum 1D surface width + * - ::cudaDevAttrMaxSurface2DWidth: Maximum 2D surface width + * - ::cudaDevAttrMaxSurface2DHeight: Maximum 2D surface height + * - ::cudaDevAttrMaxSurface3DWidth: Maximum 3D surface width + * - ::cudaDevAttrMaxSurface3DHeight: Maximum 3D surface height + * - ::cudaDevAttrMaxSurface3DDepth: Maximum 3D surface depth + * - ::cudaDevAttrMaxSurface1DLayeredWidth: Maximum 1D layered surface width + * - ::cudaDevAttrMaxSurface1DLayeredLayers: Maximum layers in a 1D layered + * surface + * - ::cudaDevAttrMaxSurface2DLayeredWidth: Maximum 2D layered surface width + * - ::cudaDevAttrMaxSurface2DLayeredHeight: Maximum 2D layered surface height + * - ::cudaDevAttrMaxSurface2DLayeredLayers: Maximum layers in a 2D layered + * surface + * - ::cudaDevAttrMaxSurfaceCubemapWidth: Maximum cubemap surface width + * - ::cudaDevAttrMaxSurfaceCubemapLayeredWidth: Maximum cubemap layered + * surface width + * - ::cudaDevAttrMaxSurfaceCubemapLayeredLayers: Maximum layers in a cubemap + * layered surface + * - ::cudaDevAttrMaxRegistersPerBlock: Maximum number of 32-bit registers + * available to a thread block + * - ::cudaDevAttrClockRate: Peak clock frequency in kilohertz + * - ::cudaDevAttrTextureAlignment: Alignment requirement; texture base + * addresses aligned to ::textureAlign bytes do not need an offset applied + * to texture fetches + * - ::cudaDevAttrTexturePitchAlignment: Pitch alignment requirement for 2D + * texture references bound to pitched memory + * - ::cudaDevAttrGpuOverlap: 1 if the device can concurrently copy memory + * between host and device while executing a kernel, or 0 if not + * - ::cudaDevAttrMultiProcessorCount: Number of multiprocessors on the device + * - ::cudaDevAttrKernelExecTimeout: 1 if there is a run time limit for kernels + * executed on the device, or 0 if not + * - ::cudaDevAttrIntegrated: 1 if the device is integrated with the memory + * subsystem, or 0 if not + * - ::cudaDevAttrCanMapHostMemory: 1 if the device can map host memory into + * the CUDA address space, or 0 if not + * - ::cudaDevAttrComputeMode: Compute mode is the compute mode that the device + * is currently in. Available modes are as follows: + * - ::cudaComputeModeDefault: Default mode - Device is not restricted and + * multiple threads can use ::cudaSetDevice() with this device. + * - ::cudaComputeModeProhibited: Compute-prohibited mode - No threads can use + * ::cudaSetDevice() with this device. + * - ::cudaComputeModeExclusiveProcess: Compute-exclusive-process mode - Many + * threads in one process will be able to use ::cudaSetDevice() with this + * device. + * - ::cudaDevAttrConcurrentKernels: 1 if the device supports executing + * multiple kernels within the same context simultaneously, or 0 if + * not. It is not guaranteed that multiple kernels will be resident on the + * device concurrently so this feature should not be relied upon for + * correctness. + * - ::cudaDevAttrEccEnabled: 1 if error correction is enabled on the device, + * 0 if error correction is disabled or not supported by the device + * - ::cudaDevAttrPciBusId: PCI bus identifier of the device + * - ::cudaDevAttrPciDeviceId: PCI device (also known as slot) identifier of + * the device + * - ::cudaDevAttrTccDriver: 1 if the device is using a TCC driver. TCC is only + * available on Tesla hardware running Windows Vista or later. + * - ::cudaDevAttrMemoryClockRate: Peak memory clock frequency in kilohertz + * - ::cudaDevAttrGlobalMemoryBusWidth: Global memory bus width in bits + * - ::cudaDevAttrL2CacheSize: Size of L2 cache in bytes. 0 if the device + * doesn't have L2 cache. + * - ::cudaDevAttrMaxThreadsPerMultiProcessor: Maximum resident threads per + * multiprocessor + * - ::cudaDevAttrUnifiedAddressing: 1 if the device shares a unified address + * space with the host, or 0 if not + * - ::cudaDevAttrComputeCapabilityMajor: Major compute capability version + * number + * - ::cudaDevAttrComputeCapabilityMinor: Minor compute capability version + * number + * - ::cudaDevAttrStreamPrioritiesSupported: 1 if the device supports stream + * priorities, or 0 if not + * - ::cudaDevAttrGlobalL1CacheSupported: 1 if device supports caching globals + * in L1 cache, 0 if not + * - ::cudaDevAttrLocalL1CacheSupported: 1 if device supports caching locals + * in L1 cache, 0 if not + * - ::cudaDevAttrMaxSharedMemoryPerMultiprocessor: Maximum amount of shared memory + * available to a multiprocessor in bytes; this amount is shared by all + * thread blocks simultaneously resident on a multiprocessor + * - ::cudaDevAttrMaxRegistersPerMultiprocessor: Maximum number of 32-bit registers + * available to a multiprocessor; this number is shared by all thread blocks + * simultaneously resident on a multiprocessor + * - ::cudaDevAttrManagedMemory: 1 if device supports allocating + * managed memory, 0 if not + * - ::cudaDevAttrIsMultiGpuBoard: 1 if device is on a multi-GPU board, 0 if not + * - ::cudaDevAttrMultiGpuBoardGroupID: Unique identifier for a group of devices on the + * same multi-GPU board + * - ::cudaDevAttrHostNativeAtomicSupported: 1 if the link between the device and the + * host supports native atomic operations + * - ::cudaDevAttrSingleToDoublePrecisionPerfRatio: Ratio of single precision performance + * (in floating-point operations per second) to double precision performance + * - ::cudaDevAttrPageableMemoryAccess: 1 if the device supports coherently accessing + * pageable memory without calling cudaHostRegister on it, and 0 otherwise + * - ::cudaDevAttrConcurrentManagedAccess: 1 if the device can coherently access managed + * memory concurrently with the CPU, and 0 otherwise + * - ::cudaDevAttrComputePreemptionSupported: 1 if the device supports + * Compute Preemption, 0 if not + * - ::cudaDevAttrCanUseHostPointerForRegisteredMem: 1 if the device can access host + * registered memory at the same virtual address as the CPU, and 0 otherwise + * - ::cudaDevAttrCooperativeLaunch: 1 if the device supports launching cooperative kernels + * via ::cudaLaunchCooperativeKernel, and 0 otherwise + * - ::cudaDevAttrCooperativeMultiDeviceLaunch: 1 if the device supports launching cooperative + * kernels via ::cudaLaunchCooperativeKernelMultiDevice, and 0 otherwise + * - ::cudaDevAttrCanFlushRemoteWrites: 1 if the device supports flushing of outstanding + * remote writes, and 0 otherwise + * - ::cudaDevAttrHostRegisterSupported: 1 if the device supports host memory registration + * via ::cudaHostRegister, and 0 otherwise + * - ::cudaDevAttrPageableMemoryAccessUsesHostPageTables: 1 if the device accesses pageable memory via the + * host's page tables, and 0 otherwise + * - ::cudaDevAttrDirectManagedMemAccessFromHost: 1 if the host can directly access managed memory on the device + * without migration, and 0 otherwise + * - ::cudaDevAttrMaxSharedMemoryPerBlockOptin: Maximum per block shared memory size on the device. This value can + * be opted into when using ::cudaFuncSetAttribute + * - ::cudaDevAttrMaxBlocksPerMultiprocessor: Maximum number of thread blocks that can reside on a multiprocessor + * - ::cudaDevAttrMaxPersistingL2CacheSize: Maximum L2 persisting lines capacity setting in bytes + * - ::cudaDevAttrMaxAccessPolicyWindowSize: Maximum value of cudaAccessPolicyWindow::num_bytes + * - ::cudaDevAttrReservedSharedMemoryPerBlock: Shared memory reserved by CUDA driver per block in bytes + * - ::cudaDevAttrSparseCudaArraySupported: 1 if the device supports sparse CUDA arrays and sparse CUDA mipmapped arrays. + * - ::cudaDevAttrHostRegisterReadOnlySupported: Device supports using the ::cudaHostRegister flag cudaHostRegisterReadOnly + * to register memory that must be mapped as read-only to the GPU + * - ::cudaDevAttrMemoryPoolsSupported: 1 if the device supports using the cudaMallocAsync and cudaMemPool family of APIs, and 0 otherwise + * - ::cudaDevAttrGPUDirectRDMASupported: 1 if the device supports GPUDirect RDMA APIs, and 0 otherwise + * - ::cudaDevAttrGPUDirectRDMAFlushWritesOptions: bitmask to be interpreted according to the ::cudaFlushGPUDirectRDMAWritesOptions enum + * - ::cudaDevAttrGPUDirectRDMAWritesOrdering: see the ::cudaGPUDirectRDMAWritesOrdering enum for numerical values + * - ::cudaDevAttrMemoryPoolSupportedHandleTypes: Bitmask of handle types supported with mempool based IPC + * - ::cudaDevAttrDeferredMappingCudaArraySupported : 1 if the device supports deferred mapping CUDA arrays and CUDA mipmapped arrays. + * - ::cudaDevAttrIpcEventSupport: 1 if the device supports IPC Events. + * + * \param value - Returned device attribute value + * \param attr - Device attribute to query + * \param device - Device number to query + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDeviceCount, ::cudaGetDevice, ::cudaSetDevice, ::cudaChooseDevice, + * ::cudaGetDeviceProperties, + * ::cudaInitDevice, + * ::cuDeviceGetAttribute + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device); + +/** + * \brief Returns the default mempool of a device + * + * The default mempool of a device contains device memory from that device. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue + * ::cudaErrorNotSupported + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cuDeviceGetDefaultMemPool, ::cudaMallocAsync, ::cudaMemPoolTrimTo, ::cudaMemPoolGetAttribute, ::cudaDeviceSetMemPool, ::cudaMemPoolSetAttribute, ::cudaMemPoolSetAccess + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceGetDefaultMemPool(cudaMemPool_t *memPool, int device); + + +/** + * \brief Sets the current memory pool of a device + * + * The memory pool must be local to the specified device. + * Unless a mempool is specified in the ::cudaMallocAsync call, + * ::cudaMallocAsync allocates from the current mempool of the provided stream's device. + * By default, a device's current memory pool is its default memory pool. + * + * \note Use ::cudaMallocFromPoolAsync to specify asynchronous allocations from a device different + * than the one the stream runs on. + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * ::cudaErrorInvalidDevice + * ::cudaErrorNotSupported + * \notefnerr + * \note_callback + * + * \sa ::cuDeviceSetMemPool, ::cudaDeviceGetMemPool, ::cudaDeviceGetDefaultMemPool, ::cudaMemPoolCreate, ::cudaMemPoolDestroy, ::cudaMallocFromPoolAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceSetMemPool(int device, cudaMemPool_t memPool); + +/** + * \brief Gets the current mempool for a device + * + * Returns the last pool provided to ::cudaDeviceSetMemPool for this device + * or the device's default memory pool if ::cudaDeviceSetMemPool has never been called. + * By default the current mempool is the default mempool for a device, + * otherwise the returned pool must have been set with ::cuDeviceSetMemPool or ::cudaDeviceSetMemPool. + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * ::cudaErrorNotSupported + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cuDeviceGetMemPool, ::cudaDeviceGetDefaultMemPool, ::cudaDeviceSetMemPool + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceGetMemPool(cudaMemPool_t *memPool, int device); + +/** + * \brief Return NvSciSync attributes that this device can support. + * + * Returns in \p nvSciSyncAttrList, the properties of NvSciSync that + * this CUDA device, \p dev can support. The returned \p nvSciSyncAttrList + * can be used to create an NvSciSync that matches this device's capabilities. + * + * If NvSciSyncAttrKey_RequiredPerm field in \p nvSciSyncAttrList is + * already set this API will return ::cudaErrorInvalidValue. + * + * The applications should set \p nvSciSyncAttrList to a valid + * NvSciSyncAttrList failing which this API will return + * ::cudaErrorInvalidHandle. + * + * The \p flags controls how applications intends to use + * the NvSciSync created from the \p nvSciSyncAttrList. The valid flags are: + * - ::cudaNvSciSyncAttrSignal, specifies that the applications intends to + * signal an NvSciSync on this CUDA device. + * - ::cudaNvSciSyncAttrWait, specifies that the applications intends to + * wait on an NvSciSync on this CUDA device. + * + * At least one of these flags must be set, failing which the API + * returns ::cudaErrorInvalidValue. Both the flags are orthogonal + * to one another: a developer may set both these flags that allows to + * set both wait and signal specific attributes in the same \p nvSciSyncAttrList. + * + * Note that this API updates the input \p nvSciSyncAttrList with values equivalent + * to the following public attribute key-values: + * NvSciSyncAttrKey_RequiredPerm is set to + * - NvSciSyncAccessPerm_SignalOnly if ::cudaNvSciSyncAttrSignal is set in \p flags. + * - NvSciSyncAccessPerm_WaitOnly if ::cudaNvSciSyncAttrWait is set in \p flags. + * - NvSciSyncAccessPerm_WaitSignal if both ::cudaNvSciSyncAttrWait and + * ::cudaNvSciSyncAttrSignal are set in \p flags. + * NvSciSyncAttrKey_PrimitiveInfo is set to + * - NvSciSyncAttrValPrimitiveType_SysmemSemaphore on any valid \p device. + * - NvSciSyncAttrValPrimitiveType_Syncpoint if \p device is a Tegra device. + * - NvSciSyncAttrValPrimitiveType_SysmemSemaphorePayload64b if \p device is GA10X+. + * NvSciSyncAttrKey_GpuId is set to the same UUID that is returned in + * \p cudaDeviceProp.uuid from ::cudaDeviceGetProperties for this \p device. + * + * \param nvSciSyncAttrList - Return NvSciSync attributes supported. + * \param device - Valid Cuda Device to get NvSciSync attributes for. + * \param flags - flags describing NvSciSync usage. + * + * \return + * + * ::cudaSuccess, + * ::cudaErrorDeviceUninitialized, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidHandle, + * ::cudaErrorInvalidDevice, + * ::cudaErrorNotSupported, + * ::cudaErrorMemoryAllocation + * + * \sa + * ::cudaImportExternalSemaphore, + * ::cudaDestroyExternalSemaphore, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceGetNvSciSyncAttributes(void *nvSciSyncAttrList, int device, int flags); + +/** + * \brief Queries attributes of the link between two devices. + * + * Returns in \p *value the value of the requested attribute \p attrib of the + * link between \p srcDevice and \p dstDevice. The supported attributes are: + * - ::cudaDevP2PAttrPerformanceRank: A relative value indicating the + * performance of the link between two devices. Lower value means better + * performance (0 being the value used for most performant link). + * - ::cudaDevP2PAttrAccessSupported: 1 if peer access is enabled. + * - ::cudaDevP2PAttrNativeAtomicSupported: 1 if native atomic operations over + * the link are supported. + * - ::cudaDevP2PAttrCudaArrayAccessSupported: 1 if accessing CUDA arrays over + * the link is supported. + * + * Returns ::cudaErrorInvalidDevice if \p srcDevice or \p dstDevice are not valid + * or if they represent the same device. + * + * Returns ::cudaErrorInvalidValue if \p attrib is not valid or if \p value is + * a null pointer. + * + * \param value - Returned value of the requested attribute + * \param attrib - The requested attribute of the link between \p srcDevice and \p dstDevice. + * \param srcDevice - The source device of the target link. + * \param dstDevice - The destination device of the target link. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceEnablePeerAccess, + * ::cudaDeviceDisablePeerAccess, + * ::cudaDeviceCanAccessPeer, + * ::cuDeviceGetP2PAttribute + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, int srcDevice, int dstDevice); + +/** + * \brief Select compute-device which best matches criteria + * + * Returns in \p *device the device which has properties that best match + * \p *prop. + * + * \param device - Device with best match + * \param prop - Desired device properties + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDeviceCount, ::cudaGetDevice, ::cudaSetDevice, + * ::cudaGetDeviceProperties, + * ::cudaInitDevice + */ +extern __host__ cudaError_t CUDARTAPI cudaChooseDevice(int *device, const struct cudaDeviceProp *prop); +/** + * \brief Initialize device to be used for GPU executions + * + * This function will initialize the CUDA Runtime structures and primary context on \p device when called, + * but the context will not be made current to \p device. + * + * When ::cudaInitDeviceFlagsAreValid is set in \p flags, deviceFlags are applied to the requested device. + * The values of deviceFlags match those of the flags parameters in ::cudaSetDeviceFlags. + * The effect may be verified by ::cudaGetDeviceFlags. + * + * This function will return an error if the device is in ::cudaComputeModeExclusiveProcess + * and is occupied by another process or if the device is in ::cudaComputeModeProhibited. + * + * \param device - Device on which the runtime will initialize itself. + * \param deviceFlags - Parameters for device operation. + * \param flags - Flags for controlling the device initialization. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDeviceCount, ::cudaGetDevice, ::cudaGetDeviceProperties, + * ::cudaChooseDevice, ::cudaSetDevice + * ::cuCtxSetCurrent + */ +extern __host__ cudaError_t CUDARTAPI cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags); +/** + * \brief Set device to be used for GPU executions + * + * Sets \p device as the current device for the calling host thread. + * Valid device id's are 0 to (::cudaGetDeviceCount() - 1). + * + * Any device memory subsequently allocated from this host thread + * using ::cudaMalloc(), ::cudaMallocPitch() or ::cudaMallocArray() + * will be physically resident on \p device. Any host memory allocated + * from this host thread using ::cudaMallocHost() or ::cudaHostAlloc() + * or ::cudaHostRegister() will have its lifetime associated with + * \p device. Any streams or events created from this host thread will + * be associated with \p device. Any kernels launched from this host + * thread using the <<<>>> operator or ::cudaLaunchKernel() will be executed + * on \p device. + * + * This call may be made from any host thread, to any device, and at + * any time. This function will do no synchronization with the previous + * or new device, + * and should only take significant time when it initializes the runtime's context state. + * This call will bind the primary context of the specified device to the calling thread and all the + * subsequent memory allocations, stream and event creations, and kernel launches + * will be associated with the primary context. + * This function will also immediately initialize the runtime state on the primary context, + * and the context will be current on \p device immediately. This function will return an + * error if the device is in ::cudaComputeModeExclusiveProcess and is occupied by another + * process or if the device is in ::cudaComputeModeProhibited. + * + * It is not required to call ::cudaInitDevice before using this function. + * \param device - Device on which the active host thread should execute the + * device code. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorDeviceUnavailable, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDeviceCount, ::cudaGetDevice, ::cudaGetDeviceProperties, + * ::cudaChooseDevice, + * ::cudaInitDevice, + * ::cuCtxSetCurrent + */ +extern __host__ cudaError_t CUDARTAPI cudaSetDevice(int device); + +/** + * \brief Returns which device is currently being used + * + * Returns in \p *device the current device for the calling host thread. + * + * \param device - Returns the device on which the active host thread + * executes the device code. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorDeviceUnavailable, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDeviceCount, ::cudaSetDevice, ::cudaGetDeviceProperties, + * ::cudaChooseDevice, + * ::cuCtxGetCurrent + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDevice(int *device); + +/** + * \brief Set a list of devices that can be used for CUDA + * + * Sets a list of devices for CUDA execution in priority order using + * \p device_arr. The parameter \p len specifies the number of elements in the + * list. CUDA will try devices from the list sequentially until it finds one + * that works. If this function is not called, or if it is called with a \p len + * of 0, then CUDA will go back to its default behavior of trying devices + * sequentially from a default list containing all of the available CUDA + * devices in the system. If a specified device ID in the list does not exist, + * this function will return ::cudaErrorInvalidDevice. If \p len is not 0 and + * \p device_arr is NULL or if \p len exceeds the number of devices in + * the system, then ::cudaErrorInvalidValue is returned. + * + * \param device_arr - List of devices to try + * \param len - Number of devices in specified list + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDeviceCount, ::cudaSetDevice, ::cudaGetDeviceProperties, + * ::cudaSetDeviceFlags, + * ::cudaChooseDevice + */ +extern __host__ cudaError_t CUDARTAPI cudaSetValidDevices(int *device_arr, int len); + +/** + * \brief Sets flags to be used for device executions + * + * Records \p flags as the flags for the current device. If the current device + * has been set and that device has already been initialized, the previous flags + * are overwritten. If the current device has not been initialized, it is + * initialized with the provided flags. If no device has been made current to + * the calling thread, a default device is selected and initialized with the + * provided flags. + * + * The two LSBs of the \p flags parameter can be used to control how the CPU + * thread interacts with the OS scheduler when waiting for results from the + * device. + * + * - ::cudaDeviceScheduleAuto: The default value if the \p flags parameter is + * zero, uses a heuristic based on the number of active CUDA contexts in the + * process \p C and the number of logical processors in the system \p P. If + * \p C \> \p P, then CUDA will yield to other OS threads when waiting for the + * device, otherwise CUDA will not yield while waiting for results and + * actively spin on the processor. Additionally, on Tegra devices, + * ::cudaDeviceScheduleAuto uses a heuristic based on the power profile of + * the platform and may choose ::cudaDeviceScheduleBlockingSync for low-powered + * devices. + * - ::cudaDeviceScheduleSpin: Instruct CUDA to actively spin when waiting for + * results from the device. This can decrease latency when waiting for the + * device, but may lower the performance of CPU threads if they are performing + * work in parallel with the CUDA thread. + * - ::cudaDeviceScheduleYield: Instruct CUDA to yield its thread when waiting + * for results from the device. This can increase latency when waiting for the + * device, but can increase the performance of CPU threads performing work in + * parallel with the device. + * - ::cudaDeviceScheduleBlockingSync: Instruct CUDA to block the CPU thread + * on a synchronization primitive when waiting for the device to finish work. + * - ::cudaDeviceBlockingSync: Instruct CUDA to block the CPU thread on a + * synchronization primitive when waiting for the device to finish work.
+ * \ref deprecated "Deprecated:" This flag was deprecated as of CUDA 4.0 and + * replaced with ::cudaDeviceScheduleBlockingSync. + * - ::cudaDeviceMapHost: This flag enables allocating pinned + * host memory that is accessible to the device. It is implicit for the + * runtime but may be absent if a context is created using the driver API. + * If this flag is not set, ::cudaHostGetDevicePointer() will always return + * a failure code. + * - ::cudaDeviceLmemResizeToMax: Instruct CUDA to not reduce local memory + * after resizing local memory for a kernel. This can prevent thrashing by + * local memory allocations when launching many kernels with high local + * memory usage at the cost of potentially increased memory usage.
+ * \ref deprecated "Deprecated:" This flag is deprecated and the behavior enabled + * by this flag is now the default and cannot be disabled. + * - ::cudaDeviceSyncMemops: Ensures that synchronous memory operations initiated + * on this context will always synchronize. See further documentation in the + * section titled "API Synchronization behavior" to learn more about cases when + * synchronous memory operations can exhibit asynchronous behavior. + * + * \param flags - Parameters for device operation + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDeviceFlags, ::cudaGetDeviceCount, ::cudaGetDevice, ::cudaGetDeviceProperties, + * ::cudaSetDevice, ::cudaSetValidDevices, + * ::cudaInitDevice, + * ::cudaChooseDevice, + * ::cuDevicePrimaryCtxSetFlags + */ +extern __host__ cudaError_t CUDARTAPI cudaSetDeviceFlags( unsigned int flags ); + +/** + * \brief Gets the flags for the current device + * + * + * Returns in \p flags the flags for the current device. If there is a current + * device for the calling thread, the flags for the device are returned. If + * there is no current device, the flags for the first device are returned, + * which may be the default flags. Compare to the behavior of + * ::cudaSetDeviceFlags. + * + * Typically, the flags returned should match the behavior that will be seen + * if the calling thread uses a device after this call, without any change to + * the flags or current device inbetween by this or another thread. Note that + * if the device is not initialized, it is possible for another thread to + * change the flags for the current device before it is initialized. + * Additionally, when using exclusive mode, if this thread has not requested a + * specific device, it may use a device other than the first device, contrary + * to the assumption made by this function. + * + * If a context has been created via the driver API and is current to the + * calling thread, the flags for that context are always returned. + * + * Flags returned by this function may specifically include ::cudaDeviceMapHost + * even though it is not accepted by ::cudaSetDeviceFlags because it is + * implicit in runtime API flags. The reason for this is that the current + * context may have been created via the driver API in which case the flag is + * not implicit and may be unset. + * + * \param flags - Pointer to store the device flags + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDevice, ::cudaGetDeviceProperties, + * ::cudaSetDevice, ::cudaSetDeviceFlags, + * ::cudaInitDevice, + * ::cuCtxGetFlags, + * ::cuDevicePrimaryCtxGetState + */ +extern __host__ cudaError_t CUDARTAPI cudaGetDeviceFlags( unsigned int *flags ); +/** @} */ /* END CUDART_DEVICE */ + +/** + * \defgroup CUDART_STREAM Stream Management + * + * ___MANBRIEF___ stream management functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the stream management functions of the CUDA runtime + * application programming interface. + * + * @{ + */ + +/** + * \brief Create an asynchronous stream + * + * Creates a new asynchronous stream. + * + * \param pStream - Pointer to new stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreateWithPriority, + * ::cudaStreamCreateWithFlags, + * ::cudaStreamGetPriority, + * ::cudaStreamGetFlags, + * ::cudaStreamQuery, + * ::cudaStreamSynchronize, + * ::cudaStreamWaitEvent, + * ::cudaStreamAddCallback, + * ::cudaStreamDestroy, + * ::cuStreamCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamCreate(cudaStream_t *pStream); + +/** + * \brief Create an asynchronous stream + * + * Creates a new asynchronous stream. The \p flags argument determines the + * behaviors of the stream. Valid values for \p flags are + * - ::cudaStreamDefault: Default stream creation flag. + * - ::cudaStreamNonBlocking: Specifies that work running in the created + * stream may run concurrently with work in stream 0 (the NULL stream), and that + * the created stream should perform no implicit synchronization with stream 0. + * + * \param pStream - Pointer to new stream identifier + * \param flags - Parameters for stream creation + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreate, + * ::cudaStreamCreateWithPriority, + * ::cudaStreamGetFlags, + * ::cudaStreamQuery, + * ::cudaStreamSynchronize, + * ::cudaStreamWaitEvent, + * ::cudaStreamAddCallback, + * ::cudaStreamDestroy, + * ::cuStreamCreate + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags); + +/** + * \brief Create an asynchronous stream with the specified priority + * + * Creates a stream with the specified priority and returns a handle in \p pStream. + * This affects the scheduling priority of work in the stream. Priorities provide a + * hint to preferentially run work with higher priority when possible, but do + * not preempt already-running work or provide any other functional guarantee on + * execution order. + * + * \p priority follows a convention where lower numbers represent higher priorities. + * '0' represents default priority. The range of meaningful numerical priorities can + * be queried using ::cudaDeviceGetStreamPriorityRange. If the specified priority is + * outside the numerical range returned by ::cudaDeviceGetStreamPriorityRange, + * it will automatically be clamped to the lowest or the highest number in the range. + * + * \param pStream - Pointer to new stream identifier + * \param flags - Flags for stream creation. See ::cudaStreamCreateWithFlags for a list of valid flags that can be passed + * \param priority - Priority of the stream. Lower numbers represent higher priorities. + * See ::cudaDeviceGetStreamPriorityRange for more information about + * the meaningful stream priorities that can be passed. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \note Stream priorities are supported only on GPUs + * with compute capability 3.5 or higher. + * + * \note In the current implementation, only compute kernels launched in + * priority streams are affected by the stream's priority. Stream priorities have + * no effect on host-to-device and device-to-host memory operations. + * + * \sa ::cudaStreamCreate, + * ::cudaStreamCreateWithFlags, + * ::cudaDeviceGetStreamPriorityRange, + * ::cudaStreamGetPriority, + * ::cudaStreamQuery, + * ::cudaStreamWaitEvent, + * ::cudaStreamAddCallback, + * ::cudaStreamSynchronize, + * ::cudaStreamDestroy, + * ::cuStreamCreateWithPriority + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamCreateWithPriority(cudaStream_t *pStream, unsigned int flags, int priority); + +/** + * \brief Query the priority of a stream + * + * Query the priority of a stream. The priority is returned in in \p priority. + * Note that if the stream was created with a priority outside the meaningful + * numerical range returned by ::cudaDeviceGetStreamPriorityRange, + * this function returns the clamped priority. + * See ::cudaStreamCreateWithPriority for details about priority clamping. + * + * \param hStream - Handle to the stream to be queried + * \param priority - Pointer to a signed integer in which the stream's priority is returned + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreateWithPriority, + * ::cudaDeviceGetStreamPriorityRange, + * ::cudaStreamGetFlags, + * ::cuStreamGetPriority + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamGetPriority(cudaStream_t hStream, int *priority); + +/** + * \brief Query the flags of a stream + * + * Query the flags of a stream. The flags are returned in \p flags. + * See ::cudaStreamCreateWithFlags for a list of valid flags. + * + * \param hStream - Handle to the stream to be queried + * \param flags - Pointer to an unsigned integer in which the stream's flags are returned + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreateWithPriority, + * ::cudaStreamCreateWithFlags, + * ::cudaStreamGetPriority, + * ::cuStreamGetFlags + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamGetFlags(cudaStream_t hStream, unsigned int *flags); + +/** + * \brief Query the Id of a stream + * + * Query the Id of a stream. The Id is returned in \p streamId. + * The Id is unique for the life of the program. + * + * The stream handle \p hStream can refer to any of the following: + *
    + *
  • a stream created via any of the CUDA runtime APIs such as ::cudaStreamCreate, + * ::cudaStreamCreateWithFlags and ::cudaStreamCreateWithPriority, or their driver + * API equivalents such as ::cuStreamCreate or ::cuStreamCreateWithPriority. + * Passing an invalid handle will result in undefined behavior.
  • + *
  • any of the special streams such as the NULL stream, ::cudaStreamLegacy + * and ::cudaStreamPerThread respectively. The driver API equivalents of these + * are also accepted which are NULL, ::CU_STREAM_LEGACY and ::CU_STREAM_PER_THREAD.
  • + *
+ * + * \param hStream - Handle to the stream to be queried + * \param streamId - Pointer to an unsigned long long in which the stream Id is returned + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreateWithPriority, + * ::cudaStreamCreateWithFlags, + * ::cudaStreamGetPriority, + * ::cudaStreamGetFlags, + * ::cuStreamGetId + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamGetId(cudaStream_t hStream, unsigned long long *streamId); + +/** + * \brief Resets all persisting lines in cache to normal status. + * + * Resets all persisting lines in cache to normal status. + * Takes effect on function return. + * + * \return + * ::cudaSuccess, + * \notefnerr + * + * \sa + * ::cudaAccessPolicyWindow + */ +extern __host__ cudaError_t CUDARTAPI cudaCtxResetPersistingL2Cache(void); + +/** + * \brief Copies attributes from source stream to destination stream. + * + * Copies attributes from source stream \p src to destination stream \p dst. + * Both streams must have the same context. + * + * \param[out] dst Destination stream + * \param[in] src Source stream + * For attributes see ::cudaStreamAttrID + * + * \return + * ::cudaSuccess, + * ::cudaErrorNotSupported + * \notefnerr + * + * \sa + * ::cudaAccessPolicyWindow + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src); + + /** + * \brief Queries stream attribute. + * + * Queries attribute \p attr from \p hStream and stores it in corresponding + * member of \p value_out. + * + * \param[in] hStream + * \param[in] attr + * \param[out] value_out + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * + * \sa + * ::cudaAccessPolicyWindow + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamGetAttribute( + cudaStream_t hStream, cudaStreamAttrID attr, + cudaStreamAttrValue *value_out); + + /** + * \brief Sets stream attribute. + * + * Sets attribute \p attr on \p hStream from corresponding attribute of + * \p value. The updated attribute will be applied to subsequent work + * submitted to the stream. It will not affect previously submitted work. + * + * \param[out] hStream + * \param[in] attr + * \param[in] value + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * + * \sa + * ::cudaAccessPolicyWindow + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamSetAttribute( + cudaStream_t hStream, cudaStreamAttrID attr, + const cudaStreamAttrValue *value); + + /** + * \brief Destroys and cleans up an asynchronous stream + * + * Destroys and cleans up the asynchronous stream specified by \p stream. + * + * In case the device is still doing work in the stream \p stream + * when ::cudaStreamDestroy() is called, the function will return immediately + * and the resources associated with \p stream will be released automatically + * once the device has completed all work in \p stream. + * + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * \note_destroy_ub + * + * \sa ::cudaStreamCreate, + * ::cudaStreamCreateWithFlags, + * ::cudaStreamQuery, + * ::cudaStreamWaitEvent, + * ::cudaStreamSynchronize, + * ::cudaStreamAddCallback, + * ::cuStreamDestroy + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamDestroy(cudaStream_t stream); + +/** + * \brief Make a compute stream wait on an event + * + * Makes all future work submitted to \p stream wait for all work captured in + * \p event. See ::cudaEventRecord() for details on what is captured by an event. + * The synchronization will be performed efficiently on the device when applicable. + * \p event may be from a different device than \p stream. + * + * flags include: + * - ::cudaEventWaitDefault: Default event creation flag. + * - ::cudaEventWaitExternal: Event is captured in the graph as an external + * event node when performing stream capture. + * + * \param stream - Stream to wait + * \param event - Event to wait on + * \param flags - Parameters for the operation(See above) + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreate, ::cudaStreamCreateWithFlags, ::cudaStreamQuery, ::cudaStreamSynchronize, ::cudaStreamAddCallback, ::cudaStreamDestroy, + * ::cuStreamWaitEvent + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags __dv(0)); + +/** + * Type of stream callback functions. + * \param stream The stream as passed to ::cudaStreamAddCallback, may be NULL. + * \param status ::cudaSuccess or any persistent error on the stream. + * \param userData User parameter provided at registration. + */ +typedef void (CUDART_CB *cudaStreamCallback_t)(cudaStream_t stream, cudaError_t status, void *userData); + +/** + * \brief Add a callback to a compute stream + * + * \note This function is slated for eventual deprecation and removal. If + * you do not require the callback to execute in case of a device error, + * consider using ::cudaLaunchHostFunc. Additionally, this function is not + * supported with ::cudaStreamBeginCapture and ::cudaStreamEndCapture, unlike + * ::cudaLaunchHostFunc. + * + * Adds a callback to be called on the host after all currently enqueued + * items in the stream have completed. For each + * cudaStreamAddCallback call, a callback will be executed exactly once. + * The callback will block later work in the stream until it is finished. + * + * The callback may be passed ::cudaSuccess or an error code. In the event + * of a device error, all subsequently executed callbacks will receive an + * appropriate ::cudaError_t. + * + * Callbacks must not make any CUDA API calls. Attempting to use CUDA APIs + * may result in ::cudaErrorNotPermitted. Callbacks must not perform any + * synchronization that may depend on outstanding device work or other callbacks + * that are not mandated to run earlier. Callbacks without a mandated order + * (in independent streams) execute in undefined order and may be serialized. + * + * For the purposes of Unified Memory, callback execution makes a number of + * guarantees: + *
    + *
  • The callback stream is considered idle for the duration of the + * callback. Thus, for example, a callback may always use memory attached + * to the callback stream.
  • + *
  • The start of execution of a callback has the same effect as + * synchronizing an event recorded in the same stream immediately prior to + * the callback. It thus synchronizes streams which have been "joined" + * prior to the callback.
  • + *
  • Adding device work to any stream does not have the effect of making + * the stream active until all preceding callbacks have executed. Thus, for + * example, a callback might use global attached memory even if work has + * been added to another stream, if it has been properly ordered with an + * event.
  • + *
  • Completion of a callback does not cause a stream to become + * active except as described above. The callback stream will remain idle + * if no device work follows the callback, and will remain idle across + * consecutive callbacks without device work in between. Thus, for example, + * stream synchronization can be done by signaling from a callback at the + * end of the stream.
  • + *
+ * + * \param stream - Stream to add callback to + * \param callback - The function to call once preceding stream operations are complete + * \param userData - User specified data to be passed to the callback function + * \param flags - Reserved for future use, must be 0 + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorInvalidValue, + * ::cudaErrorNotSupported + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreate, ::cudaStreamCreateWithFlags, ::cudaStreamQuery, ::cudaStreamSynchronize, ::cudaStreamWaitEvent, ::cudaStreamDestroy, ::cudaMallocManaged, ::cudaStreamAttachMemAsync, + * ::cudaLaunchHostFunc, ::cuStreamAddCallback + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamAddCallback(cudaStream_t stream, + cudaStreamCallback_t callback, void *userData, unsigned int flags); + +/** + * \brief Waits for stream tasks to complete + * + * Blocks until \p stream has completed all operations. If the + * ::cudaDeviceScheduleBlockingSync flag was set for this device, + * the host thread will block until the stream is finished with + * all of its tasks. + * + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreate, ::cudaStreamCreateWithFlags, ::cudaStreamQuery, ::cudaStreamWaitEvent, ::cudaStreamAddCallback, ::cudaStreamDestroy, + * ::cuStreamSynchronize + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamSynchronize(cudaStream_t stream); + +/** + * \brief Queries an asynchronous stream for completion status + * + * Returns ::cudaSuccess if all operations in \p stream have + * completed, or ::cudaErrorNotReady if not. + * + * For the purposes of Unified Memory, a return value of ::cudaSuccess + * is equivalent to having called ::cudaStreamSynchronize(). + * + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorNotReady, + * ::cudaErrorInvalidResourceHandle + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreate, ::cudaStreamCreateWithFlags, ::cudaStreamWaitEvent, ::cudaStreamSynchronize, ::cudaStreamAddCallback, ::cudaStreamDestroy, + * ::cuStreamQuery + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamQuery(cudaStream_t stream); + +/** + * \brief Attach memory to a stream asynchronously + * + * Enqueues an operation in \p stream to specify stream association of + * \p length bytes of memory starting from \p devPtr. This function is a + * stream-ordered operation, meaning that it is dependent on, and will + * only take effect when, previous work in stream has completed. Any + * previous association is automatically replaced. + * + * \p devPtr must point to an one of the following types of memories: + * - managed memory declared using the __managed__ keyword or allocated with + * ::cudaMallocManaged. + * - a valid host-accessible region of system-allocated pageable memory. This + * type of memory may only be specified if the device associated with the + * stream reports a non-zero value for the device attribute + * ::cudaDevAttrPageableMemoryAccess. + * + * For managed allocations, \p length must be either zero or the entire + * allocation's size. Both indicate that the entire allocation's stream + * association is being changed. Currently, it is not possible to change stream + * association for a portion of a managed allocation. + * + * For pageable allocations, \p length must be non-zero. + * + * The stream association is specified using \p flags which must be + * one of ::cudaMemAttachGlobal, ::cudaMemAttachHost or ::cudaMemAttachSingle. + * The default value for \p flags is ::cudaMemAttachSingle + * If the ::cudaMemAttachGlobal flag is specified, the memory can be accessed + * by any stream on any device. + * If the ::cudaMemAttachHost flag is specified, the program makes a guarantee + * that it won't access the memory on the device from any stream on a device that + * has a zero value for the device attribute ::cudaDevAttrConcurrentManagedAccess. + * If the ::cudaMemAttachSingle flag is specified and \p stream is associated with + * a device that has a zero value for the device attribute ::cudaDevAttrConcurrentManagedAccess, + * the program makes a guarantee that it will only access the memory on the device + * from \p stream. It is illegal to attach singly to the NULL stream, because the + * NULL stream is a virtual global stream and not a specific stream. An error will + * be returned in this case. + * + * When memory is associated with a single stream, the Unified Memory system will + * allow CPU access to this memory region so long as all operations in \p stream + * have completed, regardless of whether other streams are active. In effect, + * this constrains exclusive ownership of the managed memory region by + * an active GPU to per-stream activity instead of whole-GPU activity. + * + * Accessing memory on the device from streams that are not associated with + * it will produce undefined results. No error checking is performed by the + * Unified Memory system to ensure that kernels launched into other streams + * do not access this region. + * + * It is a program's responsibility to order calls to ::cudaStreamAttachMemAsync + * via events, synchronization or other means to ensure legal access to memory + * at all times. Data visibility and coherency will be changed appropriately + * for all kernels which follow a stream-association change. + * + * If \p stream is destroyed while data is associated with it, the association is + * removed and the association reverts to the default visibility of the allocation + * as specified at ::cudaMallocManaged. For __managed__ variables, the default + * association is always ::cudaMemAttachGlobal. Note that destroying a stream is an + * asynchronous operation, and as a result, the change to default association won't + * happen until all work in the stream has completed. + * + * \param stream - Stream in which to enqueue the attach operation + * \param devPtr - Pointer to memory (must be a pointer to managed memory or + * to a valid host-accessible region of system-allocated + * memory) + * \param length - Length of memory (defaults to zero) + * \param flags - Must be one of ::cudaMemAttachGlobal, ::cudaMemAttachHost or ::cudaMemAttachSingle (defaults to ::cudaMemAttachSingle) + * + * \return + * ::cudaSuccess, + * ::cudaErrorNotReady, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreate, ::cudaStreamCreateWithFlags, ::cudaStreamWaitEvent, ::cudaStreamSynchronize, ::cudaStreamAddCallback, ::cudaStreamDestroy, ::cudaMallocManaged, + * ::cuStreamAttachMemAsync + */ +#if defined(__cplusplus) +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, size_t length __dv(0), unsigned int flags = cudaMemAttachSingle); +#else +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, size_t length __dv(0), unsigned int flags); +#endif + +/** + * \brief Begins graph capture on a stream + * + * Begin graph capture on \p stream. When a stream is in capture mode, all operations + * pushed into the stream will not be executed, but will instead be captured into + * a graph, which will be returned via ::cudaStreamEndCapture. Capture may not be initiated + * if \p stream is ::cudaStreamLegacy. Capture must be ended on the same stream in which + * it was initiated, and it may only be initiated if the stream is not already in capture + * mode. The capture mode may be queried via ::cudaStreamIsCapturing. A unique id + * representing the capture sequence may be queried via ::cudaStreamGetCaptureInfo. + * + * If \p mode is not ::cudaStreamCaptureModeRelaxed, ::cudaStreamEndCapture must be + * called on this stream from the same thread. + * + * \note Kernels captured using this API must not use texture and surface references. + * Reading or writing through any texture or surface reference is undefined + * behavior. This restriction does not apply to texture and surface objects. + * + * \param stream - Stream in which to initiate capture + * \param mode - Controls the interaction of this capture sequence with other API + * calls that are potentially unsafe. For more details see + * ::cudaThreadExchangeStreamCaptureMode. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * + * \sa + * ::cudaStreamCreate, + * ::cudaStreamIsCapturing, + * ::cudaStreamEndCapture, + * ::cudaThreadExchangeStreamCaptureMode + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamBeginCapture(cudaStream_t stream, enum cudaStreamCaptureMode mode); + +/** + * \brief Begins graph capture on a stream to an existing graph + * + * Begin graph capture on \p stream. When a stream is in capture mode, all operations + * pushed into the stream will not be executed, but will instead be captured into + * \p graph, which will be returned via ::cudaStreamEndCapture. + * + * Capture may not be initiated if \p stream is ::cudaStreamLegacy. Capture must be ended on the + * same stream in which it was initiated, and it may only be initiated if the stream is not + * already in capture mode. The capture mode may be queried via ::cudaStreamIsCapturing. A unique id + * representing the capture sequence may be queried via ::cudaStreamGetCaptureInfo. + * + * If \p mode is not ::cudaStreamCaptureModeRelaxed, ::cudaStreamEndCapture must be + * called on this stream from the same thread. + * + * \note Kernels captured using this API must not use texture and surface references. + * Reading or writing through any texture or surface reference is undefined + * behavior. This restriction does not apply to texture and surface objects. + * + * \param stream - Stream in which to initiate capture. + * \param graph - Graph to capture into. + * \param dependencies - Dependencies of the first node captured in the stream. Can be NULL if numDependencies is 0. + * \param dependencyData - Optional array of data associated with each dependency. + * \param numDependencies - Number of dependencies. + * \param mode - Controls the interaction of this capture sequence with other API + * calls that are potentially unsafe. For more details see + * ::cudaThreadExchangeStreamCaptureMode. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * + * \sa + * ::cudaStreamCreate, + * ::cudaStreamIsCapturing, + * ::cudaStreamEndCapture, + * ::cudaThreadExchangeStreamCaptureMode + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t *dependencies, const cudaGraphEdgeData *dependencyData, size_t numDependencies, enum cudaStreamCaptureMode mode); + +/** + * \brief Swaps the stream capture interaction mode for a thread + * + * Sets the calling thread's stream capture interaction mode to the value contained + * in \p *mode, and overwrites \p *mode with the previous mode for the thread. To + * facilitate deterministic behavior across function or module boundaries, callers + * are encouraged to use this API in a push-pop fashion: \code + cudaStreamCaptureMode mode = desiredMode; + cudaThreadExchangeStreamCaptureMode(&mode); + ... + cudaThreadExchangeStreamCaptureMode(&mode); // restore previous mode + * \endcode + * + * During stream capture (see ::cudaStreamBeginCapture), some actions, such as a call + * to ::cudaMalloc, may be unsafe. In the case of ::cudaMalloc, the operation is + * not enqueued asynchronously to a stream, and is not observed by stream capture. + * Therefore, if the sequence of operations captured via ::cudaStreamBeginCapture + * depended on the allocation being replayed whenever the graph is launched, the + * captured graph would be invalid. + * + * Therefore, stream capture places restrictions on API calls that can be made within + * or concurrently to a ::cudaStreamBeginCapture-::cudaStreamEndCapture sequence. This + * behavior can be controlled via this API and flags to ::cudaStreamBeginCapture. + * + * A thread's mode is one of the following: + * - \p cudaStreamCaptureModeGlobal: This is the default mode. If the local thread has + * an ongoing capture sequence that was not initiated with + * \p cudaStreamCaptureModeRelaxed at \p cuStreamBeginCapture, or if any other thread + * has a concurrent capture sequence initiated with \p cudaStreamCaptureModeGlobal, + * this thread is prohibited from potentially unsafe API calls. + * - \p cudaStreamCaptureModeThreadLocal: If the local thread has an ongoing capture + * sequence not initiated with \p cudaStreamCaptureModeRelaxed, it is prohibited + * from potentially unsafe API calls. Concurrent capture sequences in other threads + * are ignored. + * - \p cudaStreamCaptureModeRelaxed: The local thread is not prohibited from potentially + * unsafe API calls. Note that the thread is still prohibited from API calls which + * necessarily conflict with stream capture, for example, attempting ::cudaEventQuery + * on an event that was last recorded inside a capture sequence. + * + * \param mode - Pointer to mode value to swap with the current mode + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * + * \sa + * ::cudaStreamBeginCapture + */ +extern __host__ cudaError_t CUDARTAPI cudaThreadExchangeStreamCaptureMode(enum cudaStreamCaptureMode *mode); + +/** + * \brief Ends capture on a stream, returning the captured graph + * + * End capture on \p stream, returning the captured graph via \p pGraph. + * Capture must have been initiated on \p stream via a call to ::cudaStreamBeginCapture. + * If capture was invalidated, due to a violation of the rules of stream capture, then + * a NULL graph will be returned. + * + * If the \p mode argument to ::cudaStreamBeginCapture was not + * ::cudaStreamCaptureModeRelaxed, this call must be from the same thread as + * ::cudaStreamBeginCapture. + * + * \param stream - Stream to query + * \param pGraph - The captured graph + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorStreamCaptureWrongThread + * \notefnerr + * + * \sa + * ::cudaStreamCreate, + * ::cudaStreamBeginCapture, + * ::cudaStreamIsCapturing, + * ::cudaGraphDestroy + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t *pGraph); + +/** + * \brief Returns a stream's capture status + * + * Return the capture status of \p stream via \p pCaptureStatus. After a successful + * call, \p *pCaptureStatus will contain one of the following: + * - ::cudaStreamCaptureStatusNone: The stream is not capturing. + * - ::cudaStreamCaptureStatusActive: The stream is capturing. + * - ::cudaStreamCaptureStatusInvalidated: The stream was capturing but an error + * has invalidated the capture sequence. The capture sequence must be terminated + * with ::cudaStreamEndCapture on the stream where it was initiated in order to + * continue using \p stream. + * + * Note that, if this is called on ::cudaStreamLegacy (the "null stream") while + * a blocking stream on the same device is capturing, it will return + * ::cudaErrorStreamCaptureImplicit and \p *pCaptureStatus is unspecified + * after the call. The blocking stream capture is not invalidated. + * + * When a blocking stream is capturing, the legacy stream is in an + * unusable state until the blocking stream capture is terminated. The legacy + * stream is not supported for stream capture, but attempted use would have an + * implicit dependency on the capturing stream(s). + * + * \param stream - Stream to query + * \param pCaptureStatus - Returns the stream's capture status + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorStreamCaptureImplicit + * \notefnerr + * + * \sa + * ::cudaStreamCreate, + * ::cudaStreamBeginCapture, + * ::cudaStreamEndCapture + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamIsCapturing(cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus); + +/** + * \brief Query a stream's capture state + * + * Query stream state related to stream capture. + * + * If called on ::cudaStreamLegacy (the "null stream") while a stream not created + * with ::cudaStreamNonBlocking is capturing, returns ::cudaErrorStreamCaptureImplicit. + * + * Valid data (other than capture status) is returned only if both of the following are true: + * - the call returns cudaSuccess + * - the returned capture status is ::cudaStreamCaptureStatusActive + * + * \param stream - The stream to query + * \param captureStatus_out - Location to return the capture status of the stream; required + * \param id_out - Optional location to return an id for the capture sequence, which is + * unique over the lifetime of the process + * \param graph_out - Optional location to return the graph being captured into. All + * operations other than destroy and node removal are permitted on the graph + * while the capture sequence is in progress. This API does not transfer + * ownership of the graph, which is transferred or destroyed at + * ::cudaStreamEndCapture. Note that the graph handle may be invalidated before + * end of capture for certain errors. Nodes that are or become + * unreachable from the original stream at ::cudaStreamEndCapture due to direct + * actions on the graph do not trigger ::cudaErrorStreamCaptureUnjoined. + * \param dependencies_out - Optional location to store a pointer to an array of nodes. + * The next node to be captured in the stream will depend on this set of nodes, + * absent operations such as event wait which modify this set. The array pointer + * is valid until the next API call which operates on the stream or until the + * capture is terminated. The node handles may be copied out and are valid until + * they or the graph is destroyed. The driver-owned array may also be passed + * directly to APIs that operate on the graph (not the stream) without copying. + * \param numDependencies_out - Optional location to store the size of the array + * returned in dependencies_out. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorStreamCaptureImplicit + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cudaStreamGetCaptureInfo_v3, + * ::cudaStreamBeginCapture, + * ::cudaStreamIsCapturing, + * ::cudaStreamUpdateCaptureDependencies + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo(cudaStream_t stream, enum cudaStreamCaptureStatus *captureStatus_out, unsigned long long *id_out __dv(0), cudaGraph_t *graph_out __dv(0), const cudaGraphNode_t **dependencies_out __dv(0), size_t *numDependencies_out __dv(0)); + +/** + * \brief Query a stream's capture state (12.3+) + * + * Query stream state related to stream capture. + * + * If called on ::cudaStreamLegacy (the "null stream") while a stream not created + * with ::cudaStreamNonBlocking is capturing, returns ::cudaErrorStreamCaptureImplicit. + * + * Valid data (other than capture status) is returned only if both of the following are true: + * - the call returns cudaSuccess + * - the returned capture status is ::cudaStreamCaptureStatusActive + * + * If \p edgeData_out is non-NULL then \p dependencies_out must be as well. If + * \p dependencies_out is non-NULL and \p edgeData_out is NULL, but there is non-zero edge + * data for one or more of the current stream dependencies, the call will return + * ::cudaErrorLossyQuery. + * + * \param stream - The stream to query + * \param captureStatus_out - Location to return the capture status of the stream; required + * \param id_out - Optional location to return an id for the capture sequence, which is + * unique over the lifetime of the process + * \param graph_out - Optional location to return the graph being captured into. All + * operations other than destroy and node removal are permitted on the graph + * while the capture sequence is in progress. This API does not transfer + * ownership of the graph, which is transferred or destroyed at + * ::cudaStreamEndCapture. Note that the graph handle may be invalidated before + * end of capture for certain errors. Nodes that are or become + * unreachable from the original stream at ::cudaStreamEndCapture due to direct + * actions on the graph do not trigger ::cudaErrorStreamCaptureUnjoined. + * \param dependencies_out - Optional location to store a pointer to an array of nodes. + * The next node to be captured in the stream will depend on this set of nodes, + * absent operations such as event wait which modify this set. The array pointer + * is valid until the next API call which operates on the stream or until the + * capture is terminated. The node handles may be copied out and are valid until + * they or the graph is destroyed. The driver-owned array may also be passed + * directly to APIs that operate on the graph (not the stream) without copying. + * \param edgeData_out - Optional location to store a pointer to an array of graph edge + * data. This array parallels \c dependencies_out; the next node to be added + * has an edge to \c dependencies_out[i] with annotation \c edgeData_out[i] for + * each \c i. The array pointer is valid until the next API call which operates + * on the stream or until the capture is terminated. + * \param numDependencies_out - Optional location to store the size of the array + * returned in dependencies_out. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorStreamCaptureImplicit, + * ::cudaErrorLossyQuery + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cudaStreamBeginCapture, + * ::cudaStreamIsCapturing, + * ::cudaStreamUpdateCaptureDependencies + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo_v3(cudaStream_t stream, + enum cudaStreamCaptureStatus *captureStatus_out, unsigned long long *id_out __dv(0), + cudaGraph_t *graph_out __dv(0), const cudaGraphNode_t **dependencies_out __dv(0), + const cudaGraphEdgeData **edgeData_out __dv(0), size_t *numDependencies_out __dv(0)); + +/** + * \brief Update the set of dependencies in a capturing stream (11.3+) + * + * Modifies the dependency set of a capturing stream. The dependency set is the set + * of nodes that the next captured node in the stream will depend on. + * + * Valid flags are ::cudaStreamAddCaptureDependencies and + * ::cudaStreamSetCaptureDependencies. These control whether the set passed to + * the API is added to the existing set or replaces it. A flags value of 0 defaults + * to ::cudaStreamAddCaptureDependencies. + * + * Nodes that are removed from the dependency set via this API do not result in + * ::cudaErrorStreamCaptureUnjoined if they are unreachable from the stream at + * ::cudaStreamEndCapture. + * + * Returns ::cudaErrorIllegalState if the stream is not capturing. + * + * This API is new in CUDA 11.3. Developers requiring compatibility across minor + * versions of the CUDA driver to 11.0 should not use this API or provide a fallback. + * + * \param stream - The stream to update + * \param dependencies - The set of dependencies to add + * \param numDependencies - The size of the dependencies array + * \param flags - See above + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorIllegalState + * \notefnerr + * + * \sa + * ::cudaStreamBeginCapture, + * ::cudaStreamGetCaptureInfo, + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t *dependencies, size_t numDependencies, unsigned int flags __dv(0)); + +/** + * \brief Update the set of dependencies in a capturing stream (12.3+) + * + * Modifies the dependency set of a capturing stream. The dependency set is the set + * of nodes that the next captured node in the stream will depend on. + * + * Valid flags are ::cudaStreamAddCaptureDependencies and + * ::cudaStreamSetCaptureDependencies. These control whether the set passed to + * the API is added to the existing set or replaces it. A flags value of 0 defaults + * to ::cudaStreamAddCaptureDependencies. + * + * Nodes that are removed from the dependency set via this API do not result in + * ::cudaErrorStreamCaptureUnjoined if they are unreachable from the stream at + * ::cudaStreamEndCapture. + * + * Returns ::cudaErrorIllegalState if the stream is not capturing. + * + * \param stream - The stream to update + * \param dependencies - The set of dependencies to add + * \param dependencyData - Optional array of data associated with each dependency. + * \param numDependencies - The size of the dependencies array + * \param flags - See above + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorIllegalState + * \notefnerr + * + * \sa + * ::cudaStreamBeginCapture, + * ::cudaStreamGetCaptureInfo, + */ +extern __host__ cudaError_t CUDARTAPI cudaStreamUpdateCaptureDependencies_v2(cudaStream_t stream, cudaGraphNode_t *dependencies, const cudaGraphEdgeData *dependencyData, size_t numDependencies, unsigned int flags __dv(0)); +/** @} */ /* END CUDART_STREAM */ + +/** + * \defgroup CUDART_EVENT Event Management + * + * ___MANBRIEF___ event management functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the event management functions of the CUDA runtime + * application programming interface. + * + * @{ + */ + +/** + * \brief Creates an event object + * + * Creates an event object for the current device using ::cudaEventDefault. + * + * \param event - Newly created event + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorLaunchFailure, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa \ref ::cudaEventCreate(cudaEvent_t*, unsigned int) "cudaEventCreate (C++ API)", + * ::cudaEventCreateWithFlags, ::cudaEventRecord, ::cudaEventQuery, + * ::cudaEventSynchronize, ::cudaEventDestroy, ::cudaEventElapsedTime, + * ::cudaStreamWaitEvent, + * ::cuEventCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaEventCreate(cudaEvent_t *event); + +/** + * \brief Creates an event object with the specified flags + * + * Creates an event object for the current device with the specified flags. Valid + * flags include: + * - ::cudaEventDefault: Default event creation flag. + * - ::cudaEventBlockingSync: Specifies that event should use blocking + * synchronization. A host thread that uses ::cudaEventSynchronize() to wait + * on an event created with this flag will block until the event actually + * completes. + * - ::cudaEventDisableTiming: Specifies that the created event does not need + * to record timing data. Events created with this flag specified and + * the ::cudaEventBlockingSync flag not specified will provide the best + * performance when used with ::cudaStreamWaitEvent() and ::cudaEventQuery(). + * - ::cudaEventInterprocess: Specifies that the created event may be used as an + * interprocess event by ::cudaIpcGetEventHandle(). ::cudaEventInterprocess must + * be specified along with ::cudaEventDisableTiming. + * + * \param event - Newly created event + * \param flags - Flags for new event + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorLaunchFailure, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa \ref ::cudaEventCreate(cudaEvent_t*) "cudaEventCreate (C API)", + * ::cudaEventSynchronize, ::cudaEventDestroy, ::cudaEventElapsedTime, + * ::cudaStreamWaitEvent, + * ::cuEventCreate + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags); + +/** + * \brief Records an event + * + * Captures in \p event the contents of \p stream at the time of this call. + * \p event and \p stream must be on the same CUDA context. + * Calls such as ::cudaEventQuery() or ::cudaStreamWaitEvent() will then + * examine or wait for completion of the work that was captured. Uses of + * \p stream after this call do not modify \p event. See note on default + * stream behavior for what is captured in the default case. + * + * ::cudaEventRecord() can be called multiple times on the same event and + * will overwrite the previously captured state. Other APIs such as + * ::cudaStreamWaitEvent() use the most recently captured state at the time + * of the API call, and are not affected by later calls to + * ::cudaEventRecord(). Before the first call to ::cudaEventRecord(), an + * event represents an empty set of work, so for example ::cudaEventQuery() + * would return ::cudaSuccess. + * + * \param event - Event to record + * \param stream - Stream in which to record event + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorLaunchFailure + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * \note_null_event + * + * \sa \ref ::cudaEventCreate(cudaEvent_t*) "cudaEventCreate (C API)", + * ::cudaEventCreateWithFlags, ::cudaEventQuery, + * ::cudaEventSynchronize, ::cudaEventDestroy, ::cudaEventElapsedTime, + * ::cudaStreamWaitEvent, + * ::cudaEventRecordWithFlags, + * ::cuEventRecord + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecord(cudaEvent_t event, cudaStream_t stream __dv(0)); + +/** + * \brief Records an event + * + * Captures in \p event the contents of \p stream at the time of this call. + * \p event and \p stream must be on the same CUDA context. + * Calls such as ::cudaEventQuery() or ::cudaStreamWaitEvent() will then + * examine or wait for completion of the work that was captured. Uses of + * \p stream after this call do not modify \p event. See note on default + * stream behavior for what is captured in the default case. + * + * ::cudaEventRecordWithFlags() can be called multiple times on the same event and + * will overwrite the previously captured state. Other APIs such as + * ::cudaStreamWaitEvent() use the most recently captured state at the time + * of the API call, and are not affected by later calls to + * ::cudaEventRecordWithFlags(). Before the first call to ::cudaEventRecordWithFlags(), an + * event represents an empty set of work, so for example ::cudaEventQuery() + * would return ::cudaSuccess. + * + * flags include: + * - ::cudaEventRecordDefault: Default event creation flag. + * - ::cudaEventRecordExternal: Event is captured in the graph as an external + * event node when performing stream capture. + * + * \param event - Event to record + * \param stream - Stream in which to record event + * \param flags - Parameters for the operation(See above) + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorLaunchFailure + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * \note_null_event + * + * \sa \ref ::cudaEventCreate(cudaEvent_t*) "cudaEventCreate (C API)", + * ::cudaEventCreateWithFlags, ::cudaEventQuery, + * ::cudaEventSynchronize, ::cudaEventDestroy, ::cudaEventElapsedTime, + * ::cudaStreamWaitEvent, + * ::cudaEventRecord, + * ::cuEventRecord, + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream __dv(0), unsigned int flags __dv(0)); +#endif + +/** + * \brief Queries an event's status + * + * Queries the status of all work currently captured by \p event. See + * ::cudaEventRecord() for details on what is captured by an event. + * + * Returns ::cudaSuccess if all captured work has been completed, or + * ::cudaErrorNotReady if any captured work is incomplete. + * + * For the purposes of Unified Memory, a return value of ::cudaSuccess + * is equivalent to having called ::cudaEventSynchronize(). + * + * \param event - Event to query + * + * \return + * ::cudaSuccess, + * ::cudaErrorNotReady, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorLaunchFailure + * \notefnerr + * \note_init_rt + * \note_callback + * \note_null_event + * + * \sa \ref ::cudaEventCreate(cudaEvent_t*) "cudaEventCreate (C API)", + * ::cudaEventCreateWithFlags, ::cudaEventRecord, + * ::cudaEventSynchronize, ::cudaEventDestroy, ::cudaEventElapsedTime, + * ::cuEventQuery + */ +extern __host__ cudaError_t CUDARTAPI cudaEventQuery(cudaEvent_t event); + +/** + * \brief Waits for an event to complete + * + * Waits until the completion of all work currently captured in \p event. + * See ::cudaEventRecord() for details on what is captured by an event. + * + * Waiting for an event that was created with the ::cudaEventBlockingSync + * flag will cause the calling CPU thread to block until the event has + * been completed by the device. If the ::cudaEventBlockingSync flag has + * not been set, then the CPU thread will busy-wait until the event has + * been completed by the device. + * + * \param event - Event to wait for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorLaunchFailure + * \notefnerr + * \note_init_rt + * \note_callback + * \note_null_event + * + * \sa \ref ::cudaEventCreate(cudaEvent_t*) "cudaEventCreate (C API)", + * ::cudaEventCreateWithFlags, ::cudaEventRecord, + * ::cudaEventQuery, ::cudaEventDestroy, ::cudaEventElapsedTime, + * ::cuEventSynchronize + */ +extern __host__ cudaError_t CUDARTAPI cudaEventSynchronize(cudaEvent_t event); + +/** + * \brief Destroys an event object + * + * Destroys the event specified by \p event. + * + * An event may be destroyed before it is complete (i.e., while + * ::cudaEventQuery() would return ::cudaErrorNotReady). In this case, the + * call does not block on completion of the event, and any associated + * resources will automatically be released asynchronously at completion. + * + * \param event - Event to destroy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorLaunchFailure + * \notefnerr + * \note_init_rt + * \note_callback + * \note_destroy_ub + * \note_null_event + * + * \sa \ref ::cudaEventCreate(cudaEvent_t*) "cudaEventCreate (C API)", + * ::cudaEventCreateWithFlags, ::cudaEventQuery, + * ::cudaEventSynchronize, ::cudaEventRecord, ::cudaEventElapsedTime, + * ::cuEventDestroy + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventDestroy(cudaEvent_t event); + +/** + * \brief Computes the elapsed time between events + * + * Computes the elapsed time between two events (in milliseconds with a + * resolution of around 0.5 microseconds). + * + * If either event was last recorded in a non-NULL stream, the resulting time + * may be greater than expected (even if both used the same stream handle). This + * happens because the ::cudaEventRecord() operation takes place asynchronously + * and there is no guarantee that the measured latency is actually just between + * the two events. Any number of other different stream operations could execute + * in between the two measured events, thus altering the timing in a significant + * way. + * + * If ::cudaEventRecord() has not been called on either event, then + * ::cudaErrorInvalidResourceHandle is returned. If ::cudaEventRecord() has been + * called on both events but one or both of them has not yet been completed + * (that is, ::cudaEventQuery() would return ::cudaErrorNotReady on at least one + * of the events), ::cudaErrorNotReady is returned. If either event was created + * with the ::cudaEventDisableTiming flag, then this function will return + * ::cudaErrorInvalidResourceHandle. + * + * \param ms - Time between \p start and \p end in ms + * \param start - Starting event + * \param end - Ending event + * + * \return + * ::cudaSuccess, + * ::cudaErrorNotReady, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorLaunchFailure, + * ::cudaErrorUnknown + * \notefnerr + * \note_init_rt + * \note_callback + * \note_null_event + * + * \sa \ref ::cudaEventCreate(cudaEvent_t*) "cudaEventCreate (C API)", + * ::cudaEventCreateWithFlags, ::cudaEventQuery, + * ::cudaEventSynchronize, ::cudaEventDestroy, ::cudaEventRecord, + * ::cuEventElapsedTime + */ +extern __host__ cudaError_t CUDARTAPI cudaEventElapsedTime(float *ms, cudaEvent_t start, cudaEvent_t end); + +/** @} */ /* END CUDART_EVENT */ + +/** + * \defgroup CUDART_EXTRES_INTEROP External Resource Interoperability + * + * ___MANBRIEF___ External resource interoperability functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the external resource interoperability functions of the CUDA + * runtime application programming interface. + * + * @{ + */ + +/** + * \brief Imports an external memory object + * + * Imports an externally allocated memory object and returns + * a handle to that in \p extMem_out. + * + * The properties of the handle being imported must be described in + * \p memHandleDesc. The ::cudaExternalMemoryHandleDesc structure + * is defined as follows: + * + * \code + typedef struct cudaExternalMemoryHandleDesc_st { + cudaExternalMemoryHandleType type; + union { + int fd; + struct { + void *handle; + const void *name; + } win32; + const void *nvSciBufObject; + } handle; + unsigned long long size; + unsigned int flags; + } cudaExternalMemoryHandleDesc; + * \endcode + * + * where ::cudaExternalMemoryHandleDesc::type specifies the type + * of handle being imported. ::cudaExternalMemoryHandleType is + * defined as: + * + * \code + typedef enum cudaExternalMemoryHandleType_enum { + cudaExternalMemoryHandleTypeOpaqueFd = 1, + cudaExternalMemoryHandleTypeOpaqueWin32 = 2, + cudaExternalMemoryHandleTypeOpaqueWin32Kmt = 3, + cudaExternalMemoryHandleTypeD3D12Heap = 4, + cudaExternalMemoryHandleTypeD3D12Resource = 5, + cudaExternalMemoryHandleTypeD3D11Resource = 6, + cudaExternalMemoryHandleTypeD3D11ResourceKmt = 7, + cudaExternalMemoryHandleTypeNvSciBuf = 8 + } cudaExternalMemoryHandleType; + * \endcode + * + * If ::cudaExternalMemoryHandleDesc::type is + * ::cudaExternalMemoryHandleTypeOpaqueFd, then + * ::cudaExternalMemoryHandleDesc::handle::fd must be a valid + * file descriptor referencing a memory object. Ownership of + * the file descriptor is transferred to the CUDA driver when the + * handle is imported successfully. Performing any operations on the + * file descriptor after it is imported results in undefined behavior. + * + * If ::cudaExternalMemoryHandleDesc::type is + * ::cudaExternalMemoryHandleTypeOpaqueWin32, then exactly one + * of ::cudaExternalMemoryHandleDesc::handle::win32::handle and + * ::cudaExternalMemoryHandleDesc::handle::win32::name must not be + * NULL. If ::cudaExternalMemoryHandleDesc::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * references a memory object. Ownership of this handle is + * not transferred to CUDA after the import operation, so the + * application must release the handle using the appropriate system + * call. If ::cudaExternalMemoryHandleDesc::handle::win32::name + * is not NULL, then it must point to a NULL-terminated array of + * UTF-16 characters that refers to a memory object. + * + * If ::cudaExternalMemoryHandleDesc::type is + * ::cudaExternalMemoryHandleTypeOpaqueWin32Kmt, then + * ::cudaExternalMemoryHandleDesc::handle::win32::handle must + * be non-NULL and + * ::cudaExternalMemoryHandleDesc::handle::win32::name + * must be NULL. The handle specified must be a globally shared KMT + * handle. This handle does not hold a reference to the underlying + * object, and thus will be invalid when all references to the + * memory object are destroyed. + * + * If ::cudaExternalMemoryHandleDesc::type is + * ::cudaExternalMemoryHandleTypeD3D12Heap, then exactly one + * of ::cudaExternalMemoryHandleDesc::handle::win32::handle and + * ::cudaExternalMemoryHandleDesc::handle::win32::name must not be + * NULL. If ::cudaExternalMemoryHandleDesc::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * is returned by ID3D12Device::CreateSharedHandle when referring to a + * ID3D12Heap object. This handle holds a reference to the underlying + * object. If ::cudaExternalMemoryHandleDesc::handle::win32::name + * is not NULL, then it must point to a NULL-terminated array of + * UTF-16 characters that refers to a ID3D12Heap object. + * + * If ::cudaExternalMemoryHandleDesc::type is + * ::cudaExternalMemoryHandleTypeD3D12Resource, then exactly one + * of ::cudaExternalMemoryHandleDesc::handle::win32::handle and + * ::cudaExternalMemoryHandleDesc::handle::win32::name must not be + * NULL. If ::cudaExternalMemoryHandleDesc::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * is returned by ID3D12Device::CreateSharedHandle when referring to a + * ID3D12Resource object. This handle holds a reference to the + * underlying object. If + * ::cudaExternalMemoryHandleDesc::handle::win32::name + * is not NULL, then it must point to a NULL-terminated array of + * UTF-16 characters that refers to a ID3D12Resource object. + * + * If ::cudaExternalMemoryHandleDesc::type is + * ::cudaExternalMemoryHandleTypeD3D11Resource,then exactly one + * of ::cudaExternalMemoryHandleDesc::handle::win32::handle and + * ::cudaExternalMemoryHandleDesc::handle::win32::name must not be + * NULL. If ::cudaExternalMemoryHandleDesc::handle::win32::handle is + * not NULL, then it must represent a valid shared NT handle that is + * returned by IDXGIResource1::CreateSharedHandle when referring to a + * ID3D11Resource object. If + * ::cudaExternalMemoryHandleDesc::handle::win32::name + * is not NULL, then it must point to a NULL-terminated array of + * UTF-16 characters that refers to a ID3D11Resource object. + * + * If ::cudaExternalMemoryHandleDesc::type is + * ::cudaExternalMemoryHandleTypeD3D11ResourceKmt, then + * ::cudaExternalMemoryHandleDesc::handle::win32::handle must + * be non-NULL and ::cudaExternalMemoryHandleDesc::handle::win32::name + * must be NULL. The handle specified must be a valid shared KMT + * handle that is returned by IDXGIResource::GetSharedHandle when + * referring to a ID3D11Resource object. + * + * If ::cudaExternalMemoryHandleDesc::type is + * ::cudaExternalMemoryHandleTypeNvSciBuf, then + * ::cudaExternalMemoryHandleDesc::handle::nvSciBufObject must be NON-NULL + * and reference a valid NvSciBuf object. + * If the NvSciBuf object imported into CUDA is also mapped by other drivers, then the + * application must use ::cudaWaitExternalSemaphoresAsync or ::cudaSignalExternalSemaphoresAsync + * as approprriate barriers to maintain coherence between CUDA and the other drivers. + * See ::cudaExternalSemaphoreWaitSkipNvSciBufMemSync and ::cudaExternalSemaphoreSignalSkipNvSciBufMemSync + * for memory synchronization. + * + * The size of the memory object must be specified in + * ::cudaExternalMemoryHandleDesc::size. + * + * Specifying the flag ::cudaExternalMemoryDedicated in + * ::cudaExternalMemoryHandleDesc::flags indicates that the + * resource is a dedicated resource. The definition of what a + * dedicated resource is outside the scope of this extension. + * This flag must be set if ::cudaExternalMemoryHandleDesc::type + * is one of the following: + * ::cudaExternalMemoryHandleTypeD3D12Resource + * ::cudaExternalMemoryHandleTypeD3D11Resource + * ::cudaExternalMemoryHandleTypeD3D11ResourceKmt + * + * \param extMem_out - Returned handle to an external memory object + * \param memHandleDesc - Memory import handle descriptor + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorOperatingSystem + * \notefnerr + * \note_init_rt + * \note_callback + * + * \note If the Vulkan memory imported into CUDA is mapped on the CPU then the + * application must use vkInvalidateMappedMemoryRanges/vkFlushMappedMemoryRanges + * as well as appropriate Vulkan pipeline barriers to maintain coherence between + * CPU and GPU. For more information on these APIs, please refer to "Synchronization + * and Cache Control" chapter from Vulkan specification. + * + * + * \sa ::cudaDestroyExternalMemory, + * ::cudaExternalMemoryGetMappedBuffer, + * ::cudaExternalMemoryGetMappedMipmappedArray + */ +extern __host__ cudaError_t CUDARTAPI cudaImportExternalMemory(cudaExternalMemory_t *extMem_out, const struct cudaExternalMemoryHandleDesc *memHandleDesc); + +/** + * \brief Maps a buffer onto an imported memory object + * + * Maps a buffer onto an imported memory object and returns a device + * pointer in \p devPtr. + * + * The properties of the buffer being mapped must be described in + * \p bufferDesc. The ::cudaExternalMemoryBufferDesc structure is + * defined as follows: + * + * \code + typedef struct cudaExternalMemoryBufferDesc_st { + unsigned long long offset; + unsigned long long size; + unsigned int flags; + } cudaExternalMemoryBufferDesc; + * \endcode + * + * where ::cudaExternalMemoryBufferDesc::offset is the offset in + * the memory object where the buffer's base address is. + * ::cudaExternalMemoryBufferDesc::size is the size of the buffer. + * ::cudaExternalMemoryBufferDesc::flags must be zero. + * + * The offset and size have to be suitably aligned to match the + * requirements of the external API. Mapping two buffers whose ranges + * overlap may or may not result in the same virtual address being + * returned for the overlapped portion. In such cases, the application + * must ensure that all accesses to that region from the GPU are + * volatile. Otherwise writes made via one address are not guaranteed + * to be visible via the other address, even if they're issued by the + * same thread. It is recommended that applications map the combined + * range instead of mapping separate buffers and then apply the + * appropriate offsets to the returned pointer to derive the + * individual buffers. + * + * The returned pointer \p devPtr must be freed using ::cudaFree. + * + * \param devPtr - Returned device pointer to buffer + * \param extMem - Handle to external memory object + * \param bufferDesc - Buffer descriptor + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaImportExternalMemory, + * ::cudaDestroyExternalMemory, + * ::cudaExternalMemoryGetMappedMipmappedArray + */ +extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedBuffer(void **devPtr, cudaExternalMemory_t extMem, const struct cudaExternalMemoryBufferDesc *bufferDesc); + +/** + * \brief Maps a CUDA mipmapped array onto an external memory object + * + * Maps a CUDA mipmapped array onto an external object and returns a + * handle to it in \p mipmap. + * + * The properties of the CUDA mipmapped array being mapped must be + * described in \p mipmapDesc. The structure + * ::cudaExternalMemoryMipmappedArrayDesc is defined as follows: + * + * \code + typedef struct cudaExternalMemoryMipmappedArrayDesc_st { + unsigned long long offset; + cudaChannelFormatDesc formatDesc; + cudaExtent extent; + unsigned int flags; + unsigned int numLevels; + } cudaExternalMemoryMipmappedArrayDesc; + * \endcode + * + * where ::cudaExternalMemoryMipmappedArrayDesc::offset is the + * offset in the memory object where the base level of the mipmap + * chain is. + * ::cudaExternalMemoryMipmappedArrayDesc::formatDesc describes the + * format of the data. + * ::cudaExternalMemoryMipmappedArrayDesc::extent specifies the + * dimensions of the base level of the mipmap chain. + * ::cudaExternalMemoryMipmappedArrayDesc::flags are flags associated + * with CUDA mipmapped arrays. For further details, please refer to + * the documentation for ::cudaMalloc3DArray. Note that if the mipmapped + * array is bound as a color target in the graphics API, then the flag + * ::cudaArrayColorAttachment must be specified in + * ::cudaExternalMemoryMipmappedArrayDesc::flags. + * ::cudaExternalMemoryMipmappedArrayDesc::numLevels specifies + * the total number of levels in the mipmap chain. + * + * The returned CUDA mipmapped array must be freed using ::cudaFreeMipmappedArray. + * + * \param mipmap - Returned CUDA mipmapped array + * \param extMem - Handle to external memory object + * \param mipmapDesc - CUDA array descriptor + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaImportExternalMemory, + * ::cudaDestroyExternalMemory, + * ::cudaExternalMemoryGetMappedBuffer + * + * \note If ::cudaExternalMemoryHandleDesc::type is + * ::cudaExternalMemoryHandleTypeNvSciBuf, then + * ::cudaExternalMemoryMipmappedArrayDesc::numLevels must not be greater than 1. + */ +extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t *mipmap, cudaExternalMemory_t extMem, const struct cudaExternalMemoryMipmappedArrayDesc *mipmapDesc); + +/** + * \brief Destroys an external memory object. + * + * Destroys the specified external memory object. Any existing buffers + * and CUDA mipmapped arrays mapped onto this object must no longer be + * used and must be explicitly freed using ::cudaFree and + * ::cudaFreeMipmappedArray respectively. + * + * \param extMem - External memory object to be destroyed + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * \note_init_rt + * \note_callback + * \note_destroy_ub + * + * \sa ::cudaImportExternalMemory, + * ::cudaExternalMemoryGetMappedBuffer, + * ::cudaExternalMemoryGetMappedMipmappedArray + */ +extern __host__ cudaError_t CUDARTAPI cudaDestroyExternalMemory(cudaExternalMemory_t extMem); + +/** + * \brief Imports an external semaphore + * + * Imports an externally allocated synchronization object and returns + * a handle to that in \p extSem_out. + * + * The properties of the handle being imported must be described in + * \p semHandleDesc. The ::cudaExternalSemaphoreHandleDesc is defined + * as follows: + * + * \code + typedef struct cudaExternalSemaphoreHandleDesc_st { + cudaExternalSemaphoreHandleType type; + union { + int fd; + struct { + void *handle; + const void *name; + } win32; + const void* NvSciSyncObj; + } handle; + unsigned int flags; + } cudaExternalSemaphoreHandleDesc; + * \endcode + * + * where ::cudaExternalSemaphoreHandleDesc::type specifies the type of + * handle being imported. ::cudaExternalSemaphoreHandleType is defined + * as: + * + * \code + typedef enum cudaExternalSemaphoreHandleType_enum { + cudaExternalSemaphoreHandleTypeOpaqueFd = 1, + cudaExternalSemaphoreHandleTypeOpaqueWin32 = 2, + cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt = 3, + cudaExternalSemaphoreHandleTypeD3D12Fence = 4, + cudaExternalSemaphoreHandleTypeD3D11Fence = 5, + cudaExternalSemaphoreHandleTypeNvSciSync = 6, + cudaExternalSemaphoreHandleTypeKeyedMutex = 7, + cudaExternalSemaphoreHandleTypeKeyedMutexKmt = 8, + cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd = 9, + cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 = 10 + } cudaExternalSemaphoreHandleType; + * \endcode + * + * If ::cudaExternalSemaphoreHandleDesc::type is + * ::cudaExternalSemaphoreHandleTypeOpaqueFd, then + * ::cudaExternalSemaphoreHandleDesc::handle::fd must be a valid file + * descriptor referencing a synchronization object. Ownership of the + * file descriptor is transferred to the CUDA driver when the handle + * is imported successfully. Performing any operations on the file + * descriptor after it is imported results in undefined behavior. + * + * If ::cudaExternalSemaphoreHandleDesc::type is + * ::cudaExternalSemaphoreHandleTypeOpaqueWin32, then exactly one of + * ::cudaExternalSemaphoreHandleDesc::handle::win32::handle and + * ::cudaExternalSemaphoreHandleDesc::handle::win32::name must not be + * NULL. If ::cudaExternalSemaphoreHandleDesc::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * references a synchronization object. Ownership of this handle is + * not transferred to CUDA after the import operation, so the + * application must release the handle using the appropriate system + * call. If ::cudaExternalSemaphoreHandleDesc::handle::win32::name is + * not NULL, then it must name a valid synchronization object. + * + * If ::cudaExternalSemaphoreHandleDesc::type is + * ::cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt, then + * ::cudaExternalSemaphoreHandleDesc::handle::win32::handle must be + * non-NULL and ::cudaExternalSemaphoreHandleDesc::handle::win32::name + * must be NULL. The handle specified must be a globally shared KMT + * handle. This handle does not hold a reference to the underlying + * object, and thus will be invalid when all references to the + * synchronization object are destroyed. + * + * If ::cudaExternalSemaphoreHandleDesc::type is + * ::cudaExternalSemaphoreHandleTypeD3D12Fence, then exactly one of + * ::cudaExternalSemaphoreHandleDesc::handle::win32::handle and + * ::cudaExternalSemaphoreHandleDesc::handle::win32::name must not be + * NULL. If ::cudaExternalSemaphoreHandleDesc::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * is returned by ID3D12Device::CreateSharedHandle when referring to a + * ID3D12Fence object. This handle holds a reference to the underlying + * object. If ::cudaExternalSemaphoreHandleDesc::handle::win32::name + * is not NULL, then it must name a valid synchronization object that + * refers to a valid ID3D12Fence object. + * + * If ::cudaExternalSemaphoreHandleDesc::type is + * ::cudaExternalSemaphoreHandleTypeD3D11Fence, then exactly one of + * ::cudaExternalSemaphoreHandleDesc::handle::win32::handle and + * ::cudaExternalSemaphoreHandleDesc::handle::win32::name must not be + * NULL. If ::cudaExternalSemaphoreHandleDesc::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * is returned by ID3D11Fence::CreateSharedHandle. If + * ::cudaExternalSemaphoreHandleDesc::handle::win32::name + * is not NULL, then it must name a valid synchronization object that + * refers to a valid ID3D11Fence object. + * + * If ::cudaExternalSemaphoreHandleDesc::type is + * ::cudaExternalSemaphoreHandleTypeNvSciSync, then + * ::cudaExternalSemaphoreHandleDesc::handle::nvSciSyncObj + * represents a valid NvSciSyncObj. + * + * ::cudaExternalSemaphoreHandleTypeKeyedMutex, then exactly one of + * ::cudaExternalSemaphoreHandleDesc::handle::win32::handle and + * ::cudaExternalSemaphoreHandleDesc::handle::win32::name must not be + * NULL. If ::cudaExternalSemaphoreHandleDesc::handle::win32::handle + * is not NULL, then it represent a valid shared NT handle that + * is returned by IDXGIResource1::CreateSharedHandle when referring to + * a IDXGIKeyedMutex object. + * + * If ::cudaExternalSemaphoreHandleDesc::type is + * ::cudaExternalSemaphoreHandleTypeKeyedMutexKmt, then + * ::cudaExternalSemaphoreHandleDesc::handle::win32::handle must be + * non-NULL and ::cudaExternalSemaphoreHandleDesc::handle::win32::name + * must be NULL. The handle specified must represent a valid KMT + * handle that is returned by IDXGIResource::GetSharedHandle when + * referring to a IDXGIKeyedMutex object. + * + * If ::cudaExternalSemaphoreHandleDesc::type is + * ::cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd, then + * ::cudaExternalSemaphoreHandleDesc::handle::fd must be a valid file + * descriptor referencing a synchronization object. Ownership of the + * file descriptor is transferred to the CUDA driver when the handle + * is imported successfully. Performing any operations on the file + * descriptor after it is imported results in undefined behavior. + * + * If ::cudaExternalSemaphoreHandleDesc::type is + * ::cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32, then exactly one of + * ::cudaExternalSemaphoreHandleDesc::handle::win32::handle and + * ::cudaExternalSemaphoreHandleDesc::handle::win32::name must not be + * NULL. If ::cudaExternalSemaphoreHandleDesc::handle::win32::handle + * is not NULL, then it must represent a valid shared NT handle that + * references a synchronization object. Ownership of this handle is + * not transferred to CUDA after the import operation, so the + * application must release the handle using the appropriate system + * call. If ::cudaExternalSemaphoreHandleDesc::handle::win32::name is + * not NULL, then it must name a valid synchronization object. + * + * \param extSem_out - Returned handle to an external semaphore + * \param semHandleDesc - Semaphore import handle descriptor + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorOperatingSystem + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDestroyExternalSemaphore, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaImportExternalSemaphore(cudaExternalSemaphore_t *extSem_out, const struct cudaExternalSemaphoreHandleDesc *semHandleDesc); + +/** + * \brief Signals a set of external semaphore objects + * + * Enqueues a signal operation on a set of externally allocated + * semaphore object in the specified stream. The operations will be + * executed when all prior operations in the stream complete. + * + * The exact semantics of signaling a semaphore depends on the type of + * the object. + * + * If the semaphore object is any one of the following types: + * ::cudaExternalSemaphoreHandleTypeOpaqueFd, + * ::cudaExternalSemaphoreHandleTypeOpaqueWin32, + * ::cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt + * then signaling the semaphore will set it to the signaled state. + * + * If the semaphore object is any one of the following types: + * ::cudaExternalSemaphoreHandleTypeD3D12Fence, + * ::cudaExternalSemaphoreHandleTypeD3D11Fence, + * ::cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd, + * ::cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 + * then the semaphore will be set to the value specified in + * ::cudaExternalSemaphoreSignalParams::params::fence::value. + * + * If the semaphore object is of the type ::cudaExternalSemaphoreHandleTypeNvSciSync + * this API sets ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence to a + * value that can be used by subsequent waiters of the same NvSciSync object to + * order operations with those currently submitted in \p stream. Such an update + * will overwrite previous contents of + * ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence. By default, + * signaling such an external semaphore object causes appropriate memory synchronization + * operations to be performed over all the external memory objects that are imported as + * ::cudaExternalMemoryHandleTypeNvSciBuf. This ensures that any subsequent accesses + * made by other importers of the same set of NvSciBuf memory object(s) are coherent. + * These operations can be skipped by specifying the flag + * ::cudaExternalSemaphoreSignalSkipNvSciBufMemSync, which can be used as a + * performance optimization when data coherency is not required. But specifying this + * flag in scenarios where data coherency is required results in undefined behavior. + * Also, for semaphore object of the type ::cudaExternalSemaphoreHandleTypeNvSciSync, + * if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in + * ::cudaDeviceGetNvSciSyncAttributes to cudaNvSciSyncAttrSignal, this API will return + * cudaErrorNotSupported. + * + * ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence associated with + * semaphore object of the type ::cudaExternalSemaphoreHandleTypeNvSciSync can be + * deterministic. For this the NvSciSyncAttrList used to create the semaphore object + * must have value of NvSciSyncAttrKey_RequireDeterministicFences key set to true. + * Deterministic fences allow users to enqueue a wait over the semaphore object even + * before corresponding signal is enqueued. For such a semaphore object, CUDA guarantees + * that each signal operation will increment the fence value by '1'. Users are expected + * to track count of signals enqueued on the semaphore object and insert waits accordingly. + * When such a semaphore object is signaled from multiple streams, due to concurrent + * stream execution, it is possible that the order in which the semaphore gets signaled + * is indeterministic. This could lead to waiters of the semaphore getting unblocked + * incorrectly. Users are expected to handle such situations, either by not using the + * same semaphore object with deterministic fence support enabled in different streams + * or by adding explicit dependency amongst such streams so that the semaphore is + * signaled in order. + * + * If the semaphore object is any one of the following types: + * ::cudaExternalSemaphoreHandleTypeKeyedMutex, + * ::cudaExternalSemaphoreHandleTypeKeyedMutexKmt, + * then the keyed mutex will be released with the key specified in + * ::cudaExternalSemaphoreSignalParams::params::keyedmutex::key. + * + * \param extSemArray - Set of external semaphores to be signaled + * \param paramsArray - Array of semaphore parameters + * \param numExtSems - Number of semaphores to signal + * \param stream - Stream to enqueue the signal operations in + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaImportExternalSemaphore, + * ::cudaDestroyExternalSemaphore, + * ::cudaWaitExternalSemaphoresAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t *extSemArray, const struct cudaExternalSemaphoreSignalParams *paramsArray, unsigned int numExtSems, cudaStream_t stream __dv(0)); + +/** + * \brief Waits on a set of external semaphore objects + * + * Enqueues a wait operation on a set of externally allocated + * semaphore object in the specified stream. The operations will be + * executed when all prior operations in the stream complete. + * + * The exact semantics of waiting on a semaphore depends on the type + * of the object. + * + * If the semaphore object is any one of the following types: + * ::cudaExternalSemaphoreHandleTypeOpaqueFd, + * ::cudaExternalSemaphoreHandleTypeOpaqueWin32, + * ::cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt + * then waiting on the semaphore will wait until the semaphore reaches + * the signaled state. The semaphore will then be reset to the + * unsignaled state. Therefore for every signal operation, there can + * only be one wait operation. + * + * If the semaphore object is any one of the following types: + * ::cudaExternalSemaphoreHandleTypeD3D12Fence, + * ::cudaExternalSemaphoreHandleTypeD3D11Fence, + * ::cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd, + * ::cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 + * then waiting on the semaphore will wait until the value of the + * semaphore is greater than or equal to + * ::cudaExternalSemaphoreWaitParams::params::fence::value. + * + * If the semaphore object is of the type ::cudaExternalSemaphoreHandleTypeNvSciSync + * then, waiting on the semaphore will wait until the + * ::cudaExternalSemaphoreSignalParams::params::nvSciSync::fence is signaled by the + * signaler of the NvSciSyncObj that was associated with this semaphore object. + * By default, waiting on such an external semaphore object causes appropriate + * memory synchronization operations to be performed over all external memory objects + * that are imported as ::cudaExternalMemoryHandleTypeNvSciBuf. This ensures that + * any subsequent accesses made by other importers of the same set of NvSciBuf memory + * object(s) are coherent. These operations can be skipped by specifying the flag + * ::cudaExternalSemaphoreWaitSkipNvSciBufMemSync, which can be used as a + * performance optimization when data coherency is not required. But specifying this + * flag in scenarios where data coherency is required results in undefined behavior. + * Also, for semaphore object of the type ::cudaExternalSemaphoreHandleTypeNvSciSync, + * if the NvSciSyncAttrList used to create the NvSciSyncObj had not set the flags in + * ::cudaDeviceGetNvSciSyncAttributes to cudaNvSciSyncAttrWait, this API will return + * cudaErrorNotSupported. + * + * If the semaphore object is any one of the following types: + * ::cudaExternalSemaphoreHandleTypeKeyedMutex, + * ::cudaExternalSemaphoreHandleTypeKeyedMutexKmt, + * then the keyed mutex will be acquired when it is released with the key specified + * in ::cudaExternalSemaphoreSignalParams::params::keyedmutex::key or + * until the timeout specified by + * ::cudaExternalSemaphoreSignalParams::params::keyedmutex::timeoutMs + * has lapsed. The timeout interval can either be a finite value + * specified in milliseconds or an infinite value. In case an infinite + * value is specified the timeout never elapses. The windows INFINITE + * macro must be used to specify infinite timeout + * + * \param extSemArray - External semaphores to be waited on + * \param paramsArray - Array of semaphore parameters + * \param numExtSems - Number of semaphores to wait on + * \param stream - Stream to enqueue the wait operations in + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle + * ::cudaErrorTimeout + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaImportExternalSemaphore, + * ::cudaDestroyExternalSemaphore, + * ::cudaSignalExternalSemaphoresAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t *extSemArray, const struct cudaExternalSemaphoreWaitParams *paramsArray, unsigned int numExtSems, cudaStream_t stream __dv(0)); + +/** + * \brief Destroys an external semaphore + * + * Destroys an external semaphore object and releases any references + * to the underlying resource. Any outstanding signals or waits must + * have completed before the semaphore is destroyed. + * + * \param extSem - External semaphore to be destroyed + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * \note_init_rt + * \note_callback + * \note_destroy_ub + * + * \sa ::cudaImportExternalSemaphore, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem); + +/** @} */ /* END CUDART_EXTRES_INTEROP */ + +/** + * \defgroup CUDART_EXECUTION Execution Control + * + * ___MANBRIEF___ execution control functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the execution control functions of the CUDA runtime + * application programming interface. + * + * Some functions have overloaded C++ API template versions documented separately in the + * \ref CUDART_HIGHLEVEL "C++ API Routines" module. + * + * @{ + */ + +/** + * \brief Launches a device function + * + * The function invokes kernel \p func on \p gridDim (\p gridDim.x × \p gridDim.y + * × \p gridDim.z) grid of blocks. Each block contains \p blockDim (\p blockDim.x × + * \p blockDim.y × \p blockDim.z) threads. + * + * If the kernel has N parameters the \p args should point to array of N pointers. + * Each pointer, from args[0] to args[N - 1], point to the region + * of memory from which the actual parameter will be copied. + * + * For templated functions, pass the function symbol as follows: + * func_name + * + * \p sharedMem sets the amount of dynamic shared memory that will be available to + * each thread block. + * + * \p stream specifies a stream the invocation is associated to. + * + * \param func - Device function symbol + * \param gridDim - Grid dimentions + * \param blockDim - Block dimentions + * \param args - Arguments + * \param sharedMem - Shared memory + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidConfiguration, + * ::cudaErrorLaunchFailure, + * ::cudaErrorLaunchTimeout, + * ::cudaErrorLaunchOutOfResources, + * ::cudaErrorSharedObjectInitFailed, + * ::cudaErrorInvalidPtx, + * ::cudaErrorUnsupportedPtxVersion, + * ::cudaErrorNoKernelImageForDevice, + * ::cudaErrorJitCompilerNotFound, + * ::cudaErrorJitCompilationDisabled + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaLaunchKernel(const T *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchKernel (C++ API)", + * ::cuLaunchKernel + */ +extern __host__ cudaError_t CUDARTAPI cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream); + +/** + * \brief Launches a CUDA function with launch-time configuration + * + * Note that the functionally equivalent variadic template ::cudaLaunchKernelEx + * is available for C++11 and newer. + * + * Invokes the kernel \p func on \p config->gridDim (\p config->gridDim.x + * × \p config->gridDim.y × \p config->gridDim.z) grid of blocks. + * Each block contains \p config->blockDim (\p config->blockDim.x × + * \p config->blockDim.y × \p config->blockDim.z) threads. + * + * \p config->dynamicSmemBytes sets the amount of dynamic shared memory that + * will be available to each thread block. + * + * \p config->stream specifies a stream the invocation is associated to. + * + * Configuration beyond grid and block dimensions, dynamic shared memory size, + * and stream can be provided with the following two fields of \p config: + * + * \p config->attrs is an array of \p config->numAttrs contiguous + * ::cudaLaunchAttribute elements. The value of this pointer is not considered + * if \p config->numAttrs is zero. However, in that case, it is recommended to + * set the pointer to NULL. + * \p config->numAttrs is the number of attributes populating the first + * \p config->numAttrs positions of the \p config->attrs array. + * + * If the kernel has N parameters the \p args should point to array of N + * pointers. Each pointer, from args[0] to args[N - 1], point + * to the region of memory from which the actual parameter will be copied. + * + * N.B. This function is so named to avoid unintentionally invoking the + * templated version, \p cudaLaunchKernelEx, for kernels taking a single + * void** or void* parameter. + * + * \param config - Launch configuration + * \param func - Kernel to launch + * \param args - Array of pointers to kernel parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidConfiguration, + * ::cudaErrorLaunchFailure, + * ::cudaErrorLaunchTimeout, + * ::cudaErrorLaunchOutOfResources, + * ::cudaErrorSharedObjectInitFailed, + * ::cudaErrorInvalidPtx, + * ::cudaErrorUnsupportedPtxVersion, + * ::cudaErrorNoKernelImageForDevice, + * ::cudaErrorJitCompilerNotFound, + * ::cudaErrorJitCompilationDisabled + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaLaunchKernelEx(const cudaLaunchConfig_t *config, void (*kernel)(ExpTypes...), ActTypes &&... args) "cudaLaunchKernelEx (C++ API)", + * ::cuLaunchKernelEx + */ +extern __host__ cudaError_t CUDARTAPI cudaLaunchKernelExC(const cudaLaunchConfig_t *config, const void *func, void **args); + +/** + * \brief Launches a device function where thread blocks can cooperate and synchronize as they execute + * + * The function invokes kernel \p func on \p gridDim (\p gridDim.x × \p gridDim.y + * × \p gridDim.z) grid of blocks. Each block contains \p blockDim (\p blockDim.x × + * \p blockDim.y × \p blockDim.z) threads. + * + * The device on which this kernel is invoked must have a non-zero value for + * the device attribute ::cudaDevAttrCooperativeLaunch. + * + * The total number of blocks launched cannot exceed the maximum number of blocks per + * multiprocessor as returned by ::cudaOccupancyMaxActiveBlocksPerMultiprocessor (or + * ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags) times the number of multiprocessors + * as specified by the device attribute ::cudaDevAttrMultiProcessorCount. + * + * The kernel cannot make use of CUDA dynamic parallelism. + * + * If the kernel has N parameters the \p args should point to array of N pointers. + * Each pointer, from args[0] to args[N - 1], point to the region + * of memory from which the actual parameter will be copied. + * + * For templated functions, pass the function symbol as follows: + * func_name + * + * \p sharedMem sets the amount of dynamic shared memory that will be available to + * each thread block. + * + * \p stream specifies a stream the invocation is associated to. + * + * \param func - Device function symbol + * \param gridDim - Grid dimentions + * \param blockDim - Block dimentions + * \param args - Arguments + * \param sharedMem - Shared memory + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidConfiguration, + * ::cudaErrorLaunchFailure, + * ::cudaErrorLaunchTimeout, + * ::cudaErrorLaunchOutOfResources, + * ::cudaErrorCooperativeLaunchTooLarge, + * ::cudaErrorSharedObjectInitFailed + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaLaunchCooperativeKernel(const T *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchCooperativeKernel (C++ API)", + * ::cudaLaunchCooperativeKernelMultiDevice, + * ::cuLaunchCooperativeKernel + */ +extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream); + +/** + * \brief Launches device functions on multiple devices where thread blocks can cooperate and synchronize as they execute + * + * \deprecated This function is deprecated as of CUDA 11.3. + * + * Invokes kernels as specified in the \p launchParamsList array where each element + * of the array specifies all the parameters required to perform a single kernel launch. + * These kernels can cooperate and synchronize as they execute. The size of the array is + * specified by \p numDevices. + * + * No two kernels can be launched on the same device. All the devices targeted by this + * multi-device launch must be identical. All devices must have a non-zero value for the + * device attribute ::cudaDevAttrCooperativeMultiDeviceLaunch. + * + * The same kernel must be launched on all devices. Note that any __device__ or __constant__ + * variables are independently instantiated on every device. It is the application's + * responsiblity to ensure these variables are initialized and used appropriately. + * + * The size of the grids as specified in blocks, the size of the blocks themselves and the + * amount of shared memory used by each thread block must also match across all launched kernels. + * + * The streams used to launch these kernels must have been created via either ::cudaStreamCreate + * or ::cudaStreamCreateWithPriority or ::cudaStreamCreateWithPriority. The NULL stream or + * ::cudaStreamLegacy or ::cudaStreamPerThread cannot be used. + * + * The total number of blocks launched per kernel cannot exceed the maximum number of blocks + * per multiprocessor as returned by ::cudaOccupancyMaxActiveBlocksPerMultiprocessor (or + * ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags) times the number of multiprocessors + * as specified by the device attribute ::cudaDevAttrMultiProcessorCount. Since the + * total number of blocks launched per device has to match across all devices, the maximum + * number of blocks that can be launched per device will be limited by the device with the + * least number of multiprocessors. + * + * The kernel cannot make use of CUDA dynamic parallelism. + * + * The ::cudaLaunchParams structure is defined as: + * \code + struct cudaLaunchParams + { + void *func; + dim3 gridDim; + dim3 blockDim; + void **args; + size_t sharedMem; + cudaStream_t stream; + }; + * \endcode + * where: + * - ::cudaLaunchParams::func specifies the kernel to be launched. This same functions must + * be launched on all devices. For templated functions, pass the function symbol as follows: + * func_name + * - ::cudaLaunchParams::gridDim specifies the width, height and depth of the grid in blocks. + * This must match across all kernels launched. + * - ::cudaLaunchParams::blockDim is the width, height and depth of each thread block. This + * must match across all kernels launched. + * - ::cudaLaunchParams::args specifies the arguments to the kernel. If the kernel has + * N parameters then ::cudaLaunchParams::args should point to array of N pointers. Each + * pointer, from ::cudaLaunchParams::args[0] to ::cudaLaunchParams::args[N - 1], + * point to the region of memory from which the actual parameter will be copied. + * - ::cudaLaunchParams::sharedMem is the dynamic shared-memory size per thread block in bytes. + * This must match across all kernels launched. + * - ::cudaLaunchParams::stream is the handle to the stream to perform the launch in. This cannot + * be the NULL stream or ::cudaStreamLegacy or ::cudaStreamPerThread. + * + * By default, the kernel won't begin execution on any GPU until all prior work in all the specified + * streams has completed. This behavior can be overridden by specifying the flag + * ::cudaCooperativeLaunchMultiDeviceNoPreSync. When this flag is specified, each kernel + * will only wait for prior work in the stream corresponding to that GPU to complete before it begins + * execution. + * + * Similarly, by default, any subsequent work pushed in any of the specified streams will not begin + * execution until the kernels on all GPUs have completed. This behavior can be overridden by specifying + * the flag ::cudaCooperativeLaunchMultiDeviceNoPostSync. When this flag is specified, + * any subsequent work pushed in any of the specified streams will only wait for the kernel launched + * on the GPU corresponding to that stream to complete before it begins execution. + * + * \param launchParamsList - List of launch parameters, one per device + * \param numDevices - Size of the \p launchParamsList array + * \param flags - Flags to control launch behavior + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidConfiguration, + * ::cudaErrorLaunchFailure, + * ::cudaErrorLaunchTimeout, + * ::cudaErrorLaunchOutOfResources, + * ::cudaErrorCooperativeLaunchTooLarge, + * ::cudaErrorSharedObjectInitFailed + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaLaunchCooperativeKernel(const T *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchCooperativeKernel (C++ API)", + * ::cudaLaunchCooperativeKernel, + * ::cuLaunchCooperativeKernelMultiDevice + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernelMultiDevice(struct cudaLaunchParams *launchParamsList, unsigned int numDevices, unsigned int flags __dv(0)); + +/** + * \brief Sets the preferred cache configuration for a device function + * + * On devices where the L1 cache and shared memory use the same hardware + * resources, this sets through \p cacheConfig the preferred cache configuration + * for the function specified via \p func. This is only a preference. The + * runtime will use the requested configuration if possible, but it is free to + * choose a different configuration if required to execute \p func. + * + * \p func is a device function symbol and must be declared as a + * \c __global__ function. If the specified function does not exist, + * then ::cudaErrorInvalidDeviceFunction is returned. For templated functions, + * pass the function symbol as follows: func_name + * + * This setting does nothing on devices where the size of the L1 cache and + * shared memory are fixed. + * + * Launching a kernel with a different preference than the most recent + * preference setting may insert a device-side synchronization point. + * + * The supported cache configurations are: + * - ::cudaFuncCachePreferNone: no preference for shared memory or L1 (default) + * - ::cudaFuncCachePreferShared: prefer larger shared memory and smaller L1 cache + * - ::cudaFuncCachePreferL1: prefer larger L1 cache and smaller shared memory + * - ::cudaFuncCachePreferEqual: prefer equal size L1 cache and shared memory + * + * \param func - Device function symbol + * \param cacheConfig - Requested cache configuration + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction + * \notefnerr + * \note_string_api_deprecation2 + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)", + * \ref ::cudaFuncGetAttributes(struct cudaFuncAttributes*, const void*) "cudaFuncGetAttributes (C API)", + * \ref ::cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchKernel (C API)", + * ::cuFuncSetCacheConfig + */ +extern __host__ cudaError_t CUDARTAPI cudaFuncSetCacheConfig(const void *func, enum cudaFuncCache cacheConfig); + +/** + * \brief Find out attributes for a given function + * + * This function obtains the attributes of a function specified via \p func. + * \p func is a device function symbol and must be declared as a + * \c __global__ function. The fetched attributes are placed in \p attr. + * If the specified function does not exist, then + * ::cudaErrorInvalidDeviceFunction is returned. For templated functions, pass + * the function symbol as follows: func_name + * + * Note that some function attributes such as + * \ref ::cudaFuncAttributes::maxThreadsPerBlock "maxThreadsPerBlock" + * may vary based on the device that is currently being used. + * + * \param attr - Return pointer to function's attributes + * \param func - Device function symbol + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction + * \notefnerr + * \note_string_api_deprecation2 + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)", + * \ref ::cudaFuncGetAttributes(struct cudaFuncAttributes*, T*) "cudaFuncGetAttributes (C++ API)", + * \ref ::cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchKernel (C API)", + * ::cuFuncGetAttribute + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func); + + +/** + * \brief Set attributes for a given function + * + * This function sets the attributes of a function specified via \p func. + * The parameter \p func must be a pointer to a function that executes + * on the device. The parameter specified by \p func must be declared as a \p __global__ + * function. The enumeration defined by \p attr is set to the value defined by \p value. + * If the specified function does not exist, then ::cudaErrorInvalidDeviceFunction is returned. + * If the specified attribute cannot be written, or if the value is incorrect, + * then ::cudaErrorInvalidValue is returned. + * + * Valid values for \p attr are: + * - ::cudaFuncAttributeMaxDynamicSharedMemorySize - The requested maximum size in bytes of dynamically-allocated shared memory. The sum of this value and the function attribute ::sharedSizeBytes + * cannot exceed the device attribute ::cudaDevAttrMaxSharedMemoryPerBlockOptin. The maximal size of requestable dynamic shared memory may differ by GPU architecture. + * - ::cudaFuncAttributePreferredSharedMemoryCarveout - On devices where the L1 cache and shared memory use the same hardware resources, + * this sets the shared memory carveout preference, in percent of the total shared memory. See ::cudaDevAttrMaxSharedMemoryPerMultiprocessor. + * This is only a hint, and the driver can choose a different ratio if required to execute the function. + * + * \param func - Function to get attributes of + * \param attr - Attribute to set + * \param value - Value to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \ref ::cudaLaunchKernel(const T *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) "cudaLaunchKernel (C++ API)", + * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)", + * \ref ::cudaFuncGetAttributes(struct cudaFuncAttributes*, const void*) "cudaFuncGetAttributes (C API)", + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFuncSetAttribute(const void *func, enum cudaFuncAttribute attr, int value); + +/** + * \brief Returns the function name for a device entry function pointer. + * + * Returns in \p **name the function name associated with the symbol \p func . + * The function name is returned as a null-terminated string. This API may + * return a mangled name if the function is not declared as having C linkage. + * If \p **name is NULL, ::cudaErrorInvalidValue is returned. If \p func is + * not a device entry function, ::cudaErrorInvalidDeviceFunction is returned. + * + * \param name - The returned name of the function + * \param func - The function pointer to retrieve name for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDeviceFunction + * \notefnerr + * \note_init_rt + * \note_callback + * + * \ref ::cudaFuncGetName(const char **name, const T *func) "cudaFuncGetName (C++ API)" + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFuncGetName(const char **name, const void *func); + +/** + * \brief Returns the offset and size of a kernel parameter in the device-side parameter layout. + * + * Queries the kernel parameter at \p paramIndex in \p func's list of parameters and returns + * parameter information via \p paramOffset and \p paramSize. \p paramOffset returns the + * offset of the parameter in the device-side parameter layout. \p paramSize returns the size + * in bytes of the parameter. This information can be used to update kernel node parameters + * from the device via ::cudaGraphKernelNodeSetParam() and ::cudaGraphKernelNodeUpdatesApply(). + * \p paramIndex must be less than the number of parameters that \p func takes. + * + * \param func - The function to query + * \param paramIndex - The parameter index to query + * \param paramOffset - The offset into the device-side parameter layout at which the parameter resides + * \param paramSize - The size of the parameter in the device-side parameter layout + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * \notefnerr + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFuncGetParamInfo(const void *func, size_t paramIndex, size_t *paramOffset, size_t *paramSize); + +/** + * \brief Converts a double argument to be executed on a device + * + * \param d - Double to convert + * + * \deprecated This function is deprecated as of CUDA 7.5 + * + * Converts the double value of \p d to an internal float representation if + * the device does not support double arithmetic. If the device does natively + * support doubles, then this function does nothing. + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)", + * \ref ::cudaFuncGetAttributes(struct cudaFuncAttributes*, const void*) "cudaFuncGetAttributes (C API)", + * ::cudaSetDoubleForHost + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaSetDoubleForDevice(double *d); + +/** + * \brief Converts a double argument after execution on a device + * + * \deprecated This function is deprecated as of CUDA 7.5 + * + * Converts the double value of \p d from a potentially internal float + * representation if the device does not support double arithmetic. If the + * device does natively support doubles, then this function does nothing. + * + * \param d - Double to convert + * + * \return + * ::cudaSuccess + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)", + * \ref ::cudaFuncGetAttributes(struct cudaFuncAttributes*, const void*) "cudaFuncGetAttributes (C API)", + * ::cudaSetDoubleForDevice + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaSetDoubleForHost(double *d); + +/** + * \brief Enqueues a host function call in a stream + * + * Enqueues a host function to run in a stream. The function will be called + * after currently enqueued work and will block work added after it. + * + * The host function must not make any CUDA API calls. Attempting to use a + * CUDA API may result in ::cudaErrorNotPermitted, but this is not required. + * The host function must not perform any synchronization that may depend on + * outstanding CUDA work not mandated to run earlier. Host functions without a + * mandated order (such as in independent streams) execute in undefined order + * and may be serialized. + * + * For the purposes of Unified Memory, execution makes a number of guarantees: + *
    + *
  • The stream is considered idle for the duration of the function's + * execution. Thus, for example, the function may always use memory attached + * to the stream it was enqueued in.
  • + *
  • The start of execution of the function has the same effect as + * synchronizing an event recorded in the same stream immediately prior to + * the function. It thus synchronizes streams which have been "joined" + * prior to the function.
  • + *
  • Adding device work to any stream does not have the effect of making + * the stream active until all preceding host functions and stream callbacks + * have executed. Thus, for + * example, a function might use global attached memory even if work has + * been added to another stream, if the work has been ordered behind the + * function call with an event.
  • + *
  • Completion of the function does not cause a stream to become + * active except as described above. The stream will remain idle + * if no device work follows the function, and will remain idle across + * consecutive host functions or stream callbacks without device work in + * between. Thus, for example, + * stream synchronization can be done by signaling from a host function at the + * end of the stream.
  • + *
+ * + * Note that, in constrast to ::cuStreamAddCallback, the function will not be + * called in the event of an error in the CUDA context. + * + * \param hStream - Stream to enqueue function call in + * \param fn - The function to call once preceding stream operations are complete + * \param userData - User-specified data to be passed to the function + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorInvalidValue, + * ::cudaErrorNotSupported + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaStreamCreate, + * ::cudaStreamQuery, + * ::cudaStreamSynchronize, + * ::cudaStreamWaitEvent, + * ::cudaStreamDestroy, + * ::cudaMallocManaged, + * ::cudaStreamAttachMemAsync, + * ::cudaStreamAddCallback, + * ::cuLaunchHostFunc + */ +extern __host__ cudaError_t CUDARTAPI cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void *userData); + +/** @} */ /* END CUDART_EXECUTION */ + +/** + * \defgroup CUDART_EXECUTION_DEPRECATED Execution Control [DEPRECATED] + * + * ___MANBRIEF___ deprecated execution control functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the deprecated execution control functions of the CUDA runtime + * application programming interface. + * + * Some functions have overloaded C++ API template versions documented separately in the + * \ref CUDART_HIGHLEVEL "C++ API Routines" module. + * + * @{ + */ + +/** + * \brief Sets the shared memory configuration for a device function + * + * \deprecated + * + * On devices with configurable shared memory banks, this function will + * force all subsequent launches of the specified device function to have + * the given shared memory bank size configuration. On any given launch of the + * function, the shared memory configuration of the device will be temporarily + * changed if needed to suit the function's preferred configuration. Changes in + * shared memory configuration between subsequent launches of functions, + * may introduce a device side synchronization point. + * + * Any per-function setting of shared memory bank size set via + * ::cudaFuncSetSharedMemConfig will override the device wide setting set by + * ::cudaDeviceSetSharedMemConfig. + * + * Changing the shared memory bank size will not increase shared memory usage + * or affect occupancy of kernels, but may have major effects on performance. + * Larger bank sizes will allow for greater potential bandwidth to shared memory, + * but will change what kinds of accesses to shared memory will result in bank + * conflicts. + * + * This function will do nothing on devices with fixed shared memory bank size. + * + * For templated functions, pass the function symbol as follows: + * func_name + * + * The supported bank configurations are: + * - ::cudaSharedMemBankSizeDefault: use the device's shared memory configuration + * when launching this function. + * - ::cudaSharedMemBankSizeFourByte: set shared memory bank width to be + * four bytes natively when launching this function. + * - ::cudaSharedMemBankSizeEightByte: set shared memory bank width to be eight + * bytes natively when launching this function. + * + * \param func - Device function symbol + * \param config - Requested shared memory configuration + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * \notefnerr + * \note_string_api_deprecation2 + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceSetSharedMemConfig, + * ::cudaDeviceGetSharedMemConfig, + * ::cudaDeviceSetCacheConfig, + * ::cudaDeviceGetCacheConfig, + * ::cudaFuncSetCacheConfig, + * ::cuFuncSetSharedMemConfig + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaFuncSetSharedMemConfig(const void *func, enum cudaSharedMemConfig config); +/** @} */ /* END CUDART_EXECUTION_DEPRECATED */ + +/** + * \defgroup CUDART_OCCUPANCY Occupancy + * + * ___MANBRIEF___ occupancy calculation functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the occupancy calculation functions of the CUDA runtime + * application programming interface. + * + * Besides the occupancy calculator functions + * (\ref ::cudaOccupancyMaxActiveBlocksPerMultiprocessor and \ref ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags), + * there are also C++ only occupancy-based launch configuration functions documented in + * \ref CUDART_HIGHLEVEL "C++ API Routines" module. + * + * See + * \ref ::cudaOccupancyMaxPotentialBlockSize(int*, int*, T, size_t, int) "cudaOccupancyMaxPotentialBlockSize (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeWithFlags(int*, int*, T, size_t, int, unsigned int) "cudaOccupancyMaxPotentialBlockSize (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeVariableSMem(int*, int*, T, UnaryFunction, int) "cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags(int*, int*, T, UnaryFunction, int, unsigned int) "cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API)" + * \ref ::cudaOccupancyAvailableDynamicSMemPerBlock(size_t*, T, int, int) "cudaOccupancyAvailableDynamicSMemPerBlock (C++ API)", + * + * @{ + */ + +/** + * \brief Returns occupancy for a device function + * + * Returns in \p *numBlocks the maximum number of active blocks per + * streaming multiprocessor for the device function. + * + * \param numBlocks - Returned occupancy + * \param func - Kernel function for which occupancy is calculated + * \param blockSize - Block size the kernel is intended to be launched with + * \param dynamicSMemSize - Per-block dynamic shared memory usage intended, in bytes + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags, + * \ref ::cudaOccupancyMaxPotentialBlockSize(int*, int*, T, size_t, int) "cudaOccupancyMaxPotentialBlockSize (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeWithFlags(int*, int*, T, size_t, int, unsigned int) "cudaOccupancyMaxPotentialBlockSizeWithFlags (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeVariableSMem(int*, int*, T, UnaryFunction, int) "cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags(int*, int*, T, UnaryFunction, int, unsigned int) "cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags (C++ API)", + * \ref ::cudaOccupancyAvailableDynamicSMemPerBlock(size_t*, T, int, int) "cudaOccupancyAvailableDynamicSMemPerBlock (C++ API)", + * ::cuOccupancyMaxActiveBlocksPerMultiprocessor + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSMemSize); + +/** + * \brief Returns dynamic shared memory available per block when launching \p numBlocks blocks on SM. + * + * Returns in \p *dynamicSmemSize the maximum size of dynamic shared memory to allow \p numBlocks blocks per SM. + * + * \param dynamicSmemSize - Returned maximum dynamic shared memory + * \param func - Kernel function for which occupancy is calculated + * \param numBlocks - Number of blocks to fit on SM + * \param blockSize - Size of the block + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags, + * \ref ::cudaOccupancyMaxPotentialBlockSize(int*, int*, T, size_t, int) "cudaOccupancyMaxPotentialBlockSize (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeWithFlags(int*, int*, T, size_t, int, unsigned int) "cudaOccupancyMaxPotentialBlockSizeWithFlags (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeVariableSMem(int*, int*, T, UnaryFunction, int) "cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags(int*, int*, T, UnaryFunction, int, unsigned int) "cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags (C++ API)", + * ::cudaOccupancyAvailableDynamicSMemPerBlock + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyAvailableDynamicSMemPerBlock(size_t *dynamicSmemSize, const void *func, int numBlocks, int blockSize); + +/** + * \brief Returns occupancy for a device function with the specified flags + * + * Returns in \p *numBlocks the maximum number of active blocks per + * streaming multiprocessor for the device function. + * + * The \p flags parameter controls how special cases are handled. Valid flags include: + * + * - ::cudaOccupancyDefault: keeps the default behavior as + * ::cudaOccupancyMaxActiveBlocksPerMultiprocessor + * + * - ::cudaOccupancyDisableCachingOverride: This flag suppresses the default behavior + * on platform where global caching affects occupancy. On such platforms, if caching + * is enabled, but per-block SM resource usage would result in zero occupancy, the + * occupancy calculator will calculate the occupancy as if caching is disabled. + * Setting this flag makes the occupancy calculator to return 0 in such cases. + * More information can be found about this feature in the "Unified L1/Texture Cache" + * section of the Maxwell tuning guide. + * + * \param numBlocks - Returned occupancy + * \param func - Kernel function for which occupancy is calculated + * \param blockSize - Block size the kernel is intended to be launched with + * \param dynamicSMemSize - Per-block dynamic shared memory usage intended, in bytes + * \param flags - Requested behavior for the occupancy calculator + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaOccupancyMaxActiveBlocksPerMultiprocessor, + * \ref ::cudaOccupancyMaxPotentialBlockSize(int*, int*, T, size_t, int) "cudaOccupancyMaxPotentialBlockSize (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeWithFlags(int*, int*, T, size_t, int, unsigned int) "cudaOccupancyMaxPotentialBlockSizeWithFlags (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeVariableSMem(int*, int*, T, UnaryFunction, int) "cudaOccupancyMaxPotentialBlockSizeVariableSMem (C++ API)", + * \ref ::cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags(int*, int*, T, UnaryFunction, int, unsigned int) "cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags (C++ API)", + * \ref ::cudaOccupancyAvailableDynamicSMemPerBlock(size_t*, T, int, int) "cudaOccupancyAvailableDynamicSMemPerBlock (C++ API)", + * ::cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSMemSize, unsigned int flags); + +/** + * \brief Given the kernel function (\p func) and launch configuration + * (\p config), return the maximum cluster size in \p *clusterSize. + * + * The cluster dimensions in \p config are ignored. If func has a required + * cluster size set (see ::cudaFuncGetAttributes),\p *clusterSize will reflect + * the required cluster size. + * + * By default this function will always return a value that's portable on + * future hardware. A higher value may be returned if the kernel function + * allows non-portable cluster sizes. + * + * This function will respect the compile time launch bounds. + * + * \param clusterSize - Returned maximum cluster size that can be launched + * for the given kernel function and launch configuration + * \param func - Kernel function for which maximum cluster + * size is calculated + * \param config - Launch configuration for the given kernel function + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaFuncGetAttributes + * \ref ::cudaOccupancyMaxPotentialClusterSize(int*, T, const cudaLaunchConfig_t*) "cudaOccupancyMaxPotentialClusterSize (C++ API)", + * ::cuOccupancyMaxPotentialClusterSize + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxPotentialClusterSize(int *clusterSize, const void *func, const cudaLaunchConfig_t *launchConfig); + + +/** + * \brief Given the kernel function (\p func) and launch configuration + * (\p config), return the maximum number of clusters that could co-exist + * on the target device in \p *numClusters. + * + * If the function has required cluster size already set (see + * ::cudaFuncGetAttributes), the cluster size from config must either be + * unspecified or match the required size. + * Without required sizes, the cluster size must be specified in config, + * else the function will return an error. + * + * Note that various attributes of the kernel function may affect occupancy + * calculation. Runtime environment may affect how the hardware schedules + * the clusters, so the calculated occupancy is not guaranteed to be achievable. + * + * \param numClusters - Returned maximum number of clusters that + * could co-exist on the target device + * \param func - Kernel function for which maximum number + * of clusters are calculated + * \param config - Launch configuration for the given kernel function + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidClusterSize, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaFuncGetAttributes + * \ref ::cudaOccupancyMaxActiveClusters(int*, T, const cudaLaunchConfig_t*) "cudaOccupancyMaxActiveClusters (C++ API)", + * ::cuOccupancyMaxActiveClusters + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveClusters(int *numClusters, const void *func, const cudaLaunchConfig_t *launchConfig); +/** @} */ /* END CUDA_OCCUPANCY */ + +/** + * \defgroup CUDART_MEMORY Memory Management + * + * ___MANBRIEF___ memory management functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the memory management functions of the CUDA runtime + * application programming interface. + * + * Some functions have overloaded C++ API template versions documented separately in the + * \ref CUDART_HIGHLEVEL "C++ API Routines" module. + * + * @{ + */ + +/** + * \brief Allocates memory that will be automatically managed by the Unified Memory system + * + * Allocates \p size bytes of managed memory on the device and returns in + * \p *devPtr a pointer to the allocated memory. If the device doesn't support + * allocating managed memory, ::cudaErrorNotSupported is returned. Support + * for managed memory can be queried using the device attribute + * ::cudaDevAttrManagedMemory. The allocated memory is suitably + * aligned for any kind of variable. The memory is not cleared. If \p size + * is 0, ::cudaMallocManaged returns ::cudaErrorInvalidValue. The pointer + * is valid on the CPU and on all GPUs in the system that support managed memory. + * All accesses to this pointer must obey the Unified Memory programming model. + * + * \p flags specifies the default stream association for this allocation. + * \p flags must be one of ::cudaMemAttachGlobal or ::cudaMemAttachHost. The + * default value for \p flags is ::cudaMemAttachGlobal. + * If ::cudaMemAttachGlobal is specified, then this memory is accessible from + * any stream on any device. If ::cudaMemAttachHost is specified, then the + * allocation should not be accessed from devices that have a zero value for the + * device attribute ::cudaDevAttrConcurrentManagedAccess; an explicit call to + * ::cudaStreamAttachMemAsync will be required to enable access on such devices. + * + * If the association is later changed via ::cudaStreamAttachMemAsync to + * a single stream, the default association, as specifed during ::cudaMallocManaged, + * is restored when that stream is destroyed. For __managed__ variables, the + * default association is always ::cudaMemAttachGlobal. Note that destroying a + * stream is an asynchronous operation, and as a result, the change to default + * association won't happen until all work in the stream has completed. + * + * Memory allocated with ::cudaMallocManaged should be released with ::cudaFree. + * + * Device memory oversubscription is possible for GPUs that have a non-zero value for the + * device attribute ::cudaDevAttrConcurrentManagedAccess. Managed memory on + * such GPUs may be evicted from device memory to host memory at any time by the Unified + * Memory driver in order to make room for other allocations. + * + * In a system where all GPUs have a non-zero value for the device attribute + * ::cudaDevAttrConcurrentManagedAccess, managed memory may not be populated when this + * API returns and instead may be populated on access. In such systems, managed memory can + * migrate to any processor's memory at any time. The Unified Memory driver will employ heuristics to + * maintain data locality and prevent excessive page faults to the extent possible. The application + * can also guide the driver about memory usage patterns via ::cudaMemAdvise. The application + * can also explicitly migrate memory to a desired processor's memory via + * ::cudaMemPrefetchAsync. + * + * In a multi-GPU system where all of the GPUs have a zero value for the device attribute + * ::cudaDevAttrConcurrentManagedAccess and all the GPUs have peer-to-peer support + * with each other, the physical storage for managed memory is created on the GPU which is active + * at the time ::cudaMallocManaged is called. All other GPUs will reference the data at reduced + * bandwidth via peer mappings over the PCIe bus. The Unified Memory driver does not migrate + * memory among such GPUs. + * + * In a multi-GPU system where not all GPUs have peer-to-peer support with each other and + * where the value of the device attribute ::cudaDevAttrConcurrentManagedAccess + * is zero for at least one of those GPUs, the location chosen for physical storage of managed + * memory is system-dependent. + * - On Linux, the location chosen will be device memory as long as the current set of active + * contexts are on devices that either have peer-to-peer support with each other or have a + * non-zero value for the device attribute ::cudaDevAttrConcurrentManagedAccess. + * If there is an active context on a GPU that does not have a non-zero value for that device + * attribute and it does not have peer-to-peer support with the other devices that have active + * contexts on them, then the location for physical storage will be 'zero-copy' or host memory. + * Note that this means that managed memory that is located in device memory is migrated to + * host memory if a new context is created on a GPU that doesn't have a non-zero value for + * the device attribute and does not support peer-to-peer with at least one of the other devices + * that has an active context. This in turn implies that context creation may fail if there is + * insufficient host memory to migrate all managed allocations. + * - On Windows, the physical storage is always created in 'zero-copy' or host memory. + * All GPUs will reference the data at reduced bandwidth over the PCIe bus. In these + * circumstances, use of the environment variable CUDA_VISIBLE_DEVICES is recommended to + * restrict CUDA to only use those GPUs that have peer-to-peer support. + * Alternatively, users can also set CUDA_MANAGED_FORCE_DEVICE_ALLOC to a non-zero + * value to force the driver to always use device memory for physical storage. + * When this environment variable is set to a non-zero value, all devices used in + * that process that support managed memory have to be peer-to-peer compatible + * with each other. The error ::cudaErrorInvalidDevice will be returned if a device + * that supports managed memory is used and it is not peer-to-peer compatible with + * any of the other managed memory supporting devices that were previously used in + * that process, even if ::cudaDeviceReset has been called on those devices. These + * environment variables are described in the CUDA programming guide under the + * "CUDA environment variables" section. + * + * \param devPtr - Pointer to allocated device memory + * \param size - Requested allocation size in bytes + * \param flags - Must be either ::cudaMemAttachGlobal or ::cudaMemAttachHost (defaults to ::cudaMemAttachGlobal) + * + * \return + * ::cudaSuccess, + * ::cudaErrorMemoryAllocation, + * ::cudaErrorNotSupported, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMallocPitch, ::cudaFree, ::cudaMallocArray, ::cudaFreeArray, + * ::cudaMalloc3D, ::cudaMalloc3DArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaHostAlloc, ::cudaDeviceGetAttribute, ::cudaStreamAttachMemAsync, + * ::cuMemAllocManaged + */ +#if defined(__cplusplus) +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMallocManaged(void **devPtr, size_t size, unsigned int flags = cudaMemAttachGlobal); +#else +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMallocManaged(void **devPtr, size_t size, unsigned int flags); +#endif + +/** + * \brief Allocate memory on the device + * + * Allocates \p size bytes of linear memory on the device and returns in + * \p *devPtr a pointer to the allocated memory. The allocated memory is + * suitably aligned for any kind of variable. The memory is not cleared. + * ::cudaMalloc() returns ::cudaErrorMemoryAllocation in case of failure. + * + * The device version of ::cudaFree cannot be used with a \p *devPtr + * allocated using the host API, and vice versa. + * + * \param devPtr - Pointer to allocated device memory + * \param size - Requested allocation size in bytes + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMallocPitch, ::cudaFree, ::cudaMallocArray, ::cudaFreeArray, + * ::cudaMalloc3D, ::cudaMalloc3DArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaHostAlloc, + * ::cuMemAlloc + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMalloc(void **devPtr, size_t size); + +/** + * \brief Allocates page-locked memory on the host + * + * Allocates \p size bytes of host memory that is page-locked and accessible + * to the device. The driver tracks the virtual memory ranges allocated with + * this function and automatically accelerates calls to functions such as + * ::cudaMemcpy*(). Since the memory can be accessed directly by the device, + * it can be read or written with much higher bandwidth than pageable memory + * obtained with functions such as ::malloc(). + + * On systems where ::pageableMemoryAccessUsesHostPageTables + * is true, ::cudaMallocHost may not page-lock the allocated memory. + + * Page-locking excessive amounts of memory with ::cudaMallocHost() may degrade + * system performance, since it reduces the amount of memory available to the + * system for paging. As a result, this function is best used sparingly to allocate + * staging areas for data exchange between host and device. + * + * \param ptr - Pointer to allocated host memory + * \param size - Requested allocation size in bytes + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc, ::cudaMallocPitch, ::cudaMallocArray, ::cudaMalloc3D, + * ::cudaMalloc3DArray, ::cudaHostAlloc, ::cudaFree, ::cudaFreeArray, + * \ref ::cudaMallocHost(void**, size_t, unsigned int) "cudaMallocHost (C++ API)", + * ::cudaFreeHost, ::cudaHostAlloc, + * ::cuMemAllocHost + */ +extern __host__ cudaError_t CUDARTAPI cudaMallocHost(void **ptr, size_t size); + +/** + * \brief Allocates pitched memory on the device + * + * Allocates at least \p width (in bytes) * \p height bytes of linear memory + * on the device and returns in \p *devPtr a pointer to the allocated memory. + * The function may pad the allocation to ensure that corresponding pointers + * in any given row will continue to meet the alignment requirements for + * coalescing as the address is updated from row to row. The pitch returned in + * \p *pitch by ::cudaMallocPitch() is the width in bytes of the allocation. + * The intended usage of \p pitch is as a separate parameter of the allocation, + * used to compute addresses within the 2D array. Given the row and column of + * an array element of type \p T, the address is computed as: + * \code + T* pElement = (T*)((char*)BaseAddress + Row * pitch) + Column; + \endcode + * + * For allocations of 2D arrays, it is recommended that programmers consider + * performing pitch allocations using ::cudaMallocPitch(). Due to pitch + * alignment restrictions in the hardware, this is especially true if the + * application will be performing 2D memory copies between different regions + * of device memory (whether linear memory or CUDA arrays). + * + * \param devPtr - Pointer to allocated pitched device memory + * \param pitch - Pitch for allocation + * \param width - Requested pitched allocation width (in bytes) + * \param height - Requested pitched allocation height + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc, ::cudaFree, ::cudaMallocArray, ::cudaFreeArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaMalloc3D, ::cudaMalloc3DArray, + * ::cudaHostAlloc, + * ::cuMemAllocPitch + */ +extern __host__ cudaError_t CUDARTAPI cudaMallocPitch(void **devPtr, size_t *pitch, size_t width, size_t height); + +/** + * \brief Allocate an array on the device + * + * Allocates a CUDA array according to the ::cudaChannelFormatDesc structure + * \p desc and returns a handle to the new CUDA array in \p *array. + * + * The ::cudaChannelFormatDesc is defined as: + * \code + struct cudaChannelFormatDesc { + int x, y, z, w; + enum cudaChannelFormatKind f; + }; + \endcode + * where ::cudaChannelFormatKind is one of ::cudaChannelFormatKindSigned, + * ::cudaChannelFormatKindUnsigned, or ::cudaChannelFormatKindFloat. + * + * The \p flags parameter enables different options to be specified that affect + * the allocation, as follows. + * - ::cudaArrayDefault: This flag's value is defined to be 0 and provides default array allocation + * - ::cudaArraySurfaceLoadStore: Allocates an array that can be read from or written to using a surface reference + * - ::cudaArrayTextureGather: This flag indicates that texture gather operations will be performed on the array. + * - ::cudaArraySparse: Allocates a CUDA array without physical backing memory. The subregions within this sparse array + * can later be mapped onto a physical memory allocation by calling ::cuMemMapArrayAsync. + * The physical backing memory must be allocated via ::cuMemCreate. + * - ::cudaArrayDeferredMapping: Allocates a CUDA array without physical backing memory. The entire array can + * later be mapped onto a physical memory allocation by calling ::cuMemMapArrayAsync. + * The physical backing memory must be allocated via ::cuMemCreate. + * + * \p width and \p height must meet certain size requirements. See ::cudaMalloc3DArray() for more details. + * + * \param array - Pointer to allocated array in device memory + * \param desc - Requested channel format + * \param width - Requested array allocation width + * \param height - Requested array allocation height + * \param flags - Requested properties of allocated array + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc, ::cudaMallocPitch, ::cudaFree, ::cudaFreeArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaMalloc3D, ::cudaMalloc3DArray, + * ::cudaHostAlloc, + * ::cuArrayCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaMallocArray(cudaArray_t *array, const struct cudaChannelFormatDesc *desc, size_t width, size_t height __dv(0), unsigned int flags __dv(0)); + +/** + * \brief Frees memory on the device + * + * Frees the memory space pointed to by \p devPtr, which must have been + * returned by a previous call to one of the following memory allocation APIs - + * ::cudaMalloc(), ::cudaMallocPitch(), ::cudaMallocManaged(), ::cudaMallocAsync(), + * ::cudaMallocFromPoolAsync(). + * + * Note - This API will not perform any implicit synchronization when the pointer was + * allocated with ::cudaMallocAsync or ::cudaMallocFromPoolAsync. Callers must ensure + * that all accesses to the pointer have completed before invoking ::cudaFree. For + * best performance and memory reuse, users should use ::cudaFreeAsync to free memory + * allocated via the stream ordered memory allocator. + * + * If ::cudaFree(\p devPtr) has already been called before, + * an error is returned. If \p devPtr is 0, no operation is performed. + * ::cudaFree() returns ::cudaErrorValue in case of failure. + * + * The device version of ::cudaFree cannot be used with a \p *devPtr + * allocated using the host API, and vice versa. + * + * \param devPtr - Device pointer to memory to free + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc, ::cudaMallocPitch, ::cudaMallocManaged, ::cudaMallocArray, ::cudaFreeArray, ::cudaMallocAsync, ::cudaMallocFromPoolAsync + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaMalloc3D, ::cudaMalloc3DArray, ::cudaFreeAsync + * ::cudaHostAlloc, + * ::cuMemFree + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFree(void *devPtr); + +/** + * \brief Frees page-locked memory + * + * Frees the memory space pointed to by \p hostPtr, which must have been + * returned by a previous call to ::cudaMallocHost() or ::cudaHostAlloc(). + * + * \param ptr - Pointer to memory to free + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc, ::cudaMallocPitch, ::cudaFree, ::cudaMallocArray, + * ::cudaFreeArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaMalloc3D, ::cudaMalloc3DArray, ::cudaHostAlloc, + * ::cuMemFreeHost + */ +extern __host__ cudaError_t CUDARTAPI cudaFreeHost(void *ptr); + +/** + * \brief Frees an array on the device + * + * Frees the CUDA array \p array, which must have been returned by a + * previous call to ::cudaMallocArray(). If \p devPtr is 0, + * no operation is performed. + * + * \param array - Pointer to array to free + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc, ::cudaMallocPitch, ::cudaFree, ::cudaMallocArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaHostAlloc, + * ::cuArrayDestroy + */ +extern __host__ cudaError_t CUDARTAPI cudaFreeArray(cudaArray_t array); + +/** + * \brief Frees a mipmapped array on the device + * + * Frees the CUDA mipmapped array \p mipmappedArray, which must have been + * returned by a previous call to ::cudaMallocMipmappedArray(). If \p devPtr + * is 0, no operation is performed. + * + * \param mipmappedArray - Pointer to mipmapped array to free + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc, ::cudaMallocPitch, ::cudaFree, ::cudaMallocArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaHostAlloc, + * ::cuMipmappedArrayDestroy + */ +extern __host__ cudaError_t CUDARTAPI cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray); + + +/** + * \brief Allocates page-locked memory on the host + * + * Allocates \p size bytes of host memory that is page-locked and accessible + * to the device. The driver tracks the virtual memory ranges allocated with + * this function and automatically accelerates calls to functions such as + * ::cudaMemcpy(). Since the memory can be accessed directly by the device, it + * can be read or written with much higher bandwidth than pageable memory + * obtained with functions such as ::malloc(). Allocating excessive amounts of + * pinned memory may degrade system performance, since it reduces the amount + * of memory available to the system for paging. As a result, this function is + * best used sparingly to allocate staging areas for data exchange between host + * and device. + * + * The \p flags parameter enables different options to be specified that affect + * the allocation, as follows. + * - ::cudaHostAllocDefault: This flag's value is defined to be 0 and causes + * ::cudaHostAlloc() to emulate ::cudaMallocHost(). + * - ::cudaHostAllocPortable: The memory returned by this call will be + * considered as pinned memory by all CUDA contexts, not just the one that + * performed the allocation. + * - ::cudaHostAllocMapped: Maps the allocation into the CUDA address space. + * The device pointer to the memory may be obtained by calling + * ::cudaHostGetDevicePointer(). + * - ::cudaHostAllocWriteCombined: Allocates the memory as write-combined (WC). + * WC memory can be transferred across the PCI Express bus more quickly on some + * system configurations, but cannot be read efficiently by most CPUs. WC + * memory is a good option for buffers that will be written by the CPU and read + * by the device via mapped pinned memory or host->device transfers. + * + * All of these flags are orthogonal to one another: a developer may allocate + * memory that is portable, mapped and/or write-combined with no restrictions. + * + * In order for the ::cudaHostAllocMapped flag to have any effect, the CUDA context + * must support the ::cudaDeviceMapHost flag, which can be checked via + * ::cudaGetDeviceFlags(). The ::cudaDeviceMapHost flag is implicitly set for + * contexts created via the runtime API. + * + * The ::cudaHostAllocMapped flag may be specified on CUDA contexts for devices + * that do not support mapped pinned memory. The failure is deferred to + * ::cudaHostGetDevicePointer() because the memory may be mapped into other + * CUDA contexts via the ::cudaHostAllocPortable flag. + * + * Memory allocated by this function must be freed with ::cudaFreeHost(). + * + * \param pHost - Device pointer to allocated memory + * \param size - Requested allocation size in bytes + * \param flags - Requested properties of allocated memory + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaSetDeviceFlags, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, + * ::cudaGetDeviceFlags, + * ::cuMemHostAlloc + */ +extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags); + +/** + * \brief Registers an existing host memory range for use by CUDA + * + * Page-locks the memory range specified by \p ptr and \p size and maps it + * for the device(s) as specified by \p flags. This memory range also is added + * to the same tracking mechanism as ::cudaHostAlloc() to automatically accelerate + * calls to functions such as ::cudaMemcpy(). Since the memory can be accessed + * directly by the device, it can be read or written with much higher bandwidth + * than pageable memory that has not been registered. Page-locking excessive + * amounts of memory may degrade system performance, since it reduces the amount + * of memory available to the system for paging. As a result, this function is + * best used sparingly to register staging areas for data exchange between + * host and device. + * + * On systems where ::pageableMemoryAccessUsesHostPageTables is true, ::cudaHostRegister + * will not page-lock the memory range specified by \p ptr but only populate + * unpopulated pages. + * + * ::cudaHostRegister is supported only on I/O coherent devices that have a non-zero + * value for the device attribute ::cudaDevAttrHostRegisterSupported. + * + * The \p flags parameter enables different options to be specified that + * affect the allocation, as follows. + * + * - ::cudaHostRegisterDefault: On a system with unified virtual addressing, + * the memory will be both mapped and portable. On a system with no unified + * virtual addressing, the memory will be neither mapped nor portable. + * + * - ::cudaHostRegisterPortable: The memory returned by this call will be + * considered as pinned memory by all CUDA contexts, not just the one that + * performed the allocation. + * + * - ::cudaHostRegisterMapped: Maps the allocation into the CUDA address + * space. The device pointer to the memory may be obtained by calling + * ::cudaHostGetDevicePointer(). + * + * - ::cudaHostRegisterIoMemory: The passed memory pointer is treated as + * pointing to some memory-mapped I/O space, e.g. belonging to a + * third-party PCIe device, and it will marked as non cache-coherent and + * contiguous. + * + * - ::cudaHostRegisterReadOnly: The passed memory pointer is treated as + * pointing to memory that is considered read-only by the device. On + * platforms without ::cudaDevAttrPageableMemoryAccessUsesHostPageTables, this + * flag is required in order to register memory mapped to the CPU as + * read-only. Support for the use of this flag can be queried from the device + * attribute cudaDeviceAttrReadOnlyHostRegisterSupported. Using this flag with + * a current context associated with a device that does not have this attribute + * set will cause ::cudaHostRegister to error with cudaErrorNotSupported. + * + * All of these flags are orthogonal to one another: a developer may page-lock + * memory that is portable or mapped with no restrictions. + * + * The CUDA context must have been created with the ::cudaMapHost flag in + * order for the ::cudaHostRegisterMapped flag to have any effect. + * + * The ::cudaHostRegisterMapped flag may be specified on CUDA contexts for + * devices that do not support mapped pinned memory. The failure is deferred + * to ::cudaHostGetDevicePointer() because the memory may be mapped into + * other CUDA contexts via the ::cudaHostRegisterPortable flag. + * + * For devices that have a non-zero value for the device attribute + * ::cudaDevAttrCanUseHostPointerForRegisteredMem, the memory + * can also be accessed from the device using the host pointer \p ptr. + * The device pointer returned by ::cudaHostGetDevicePointer() may or may not + * match the original host pointer \p ptr and depends on the devices visible to the + * application. If all devices visible to the application have a non-zero value for the + * device attribute, the device pointer returned by ::cudaHostGetDevicePointer() + * will match the original pointer \p ptr. If any device visible to the application + * has a zero value for the device attribute, the device pointer returned by + * ::cudaHostGetDevicePointer() will not match the original host pointer \p ptr, + * but it will be suitable for use on all devices provided Unified Virtual Addressing + * is enabled. In such systems, it is valid to access the memory using either pointer + * on devices that have a non-zero value for the device attribute. Note however that + * such devices should access the memory using only of the two pointers and not both. + * + * The memory page-locked by this function must be unregistered with ::cudaHostUnregister(). + * + * \param ptr - Host pointer to memory to page-lock + * \param size - Size in bytes of the address range to page-lock in bytes + * \param flags - Flags for allocation request + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation, + * ::cudaErrorHostMemoryAlreadyRegistered, + * ::cudaErrorNotSupported + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaHostUnregister, ::cudaHostGetFlags, ::cudaHostGetDevicePointer, + * ::cuMemHostRegister + */ +extern __host__ cudaError_t CUDARTAPI cudaHostRegister(void *ptr, size_t size, unsigned int flags); + +/** + * \brief Unregisters a memory range that was registered with cudaHostRegister + * + * Unmaps the memory range whose base address is specified by \p ptr, and makes + * it pageable again. + * + * The base address must be the same one specified to ::cudaHostRegister(). + * + * \param ptr - Host pointer to memory to unregister + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorHostMemoryNotRegistered + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaHostUnregister, + * ::cuMemHostUnregister + */ +extern __host__ cudaError_t CUDARTAPI cudaHostUnregister(void *ptr); + +/** + * \brief Passes back device pointer of mapped host memory allocated by + * cudaHostAlloc or registered by cudaHostRegister + * + * Passes back the device pointer corresponding to the mapped, pinned host + * buffer allocated by ::cudaHostAlloc() or registered by ::cudaHostRegister(). + * + * ::cudaHostGetDevicePointer() will fail if the ::cudaDeviceMapHost flag was + * not specified before deferred context creation occurred, or if called on a + * device that does not support mapped, pinned memory. + * + * For devices that have a non-zero value for the device attribute + * ::cudaDevAttrCanUseHostPointerForRegisteredMem, the memory + * can also be accessed from the device using the host pointer \p pHost. + * The device pointer returned by ::cudaHostGetDevicePointer() may or may not + * match the original host pointer \p pHost and depends on the devices visible to the + * application. If all devices visible to the application have a non-zero value for the + * device attribute, the device pointer returned by ::cudaHostGetDevicePointer() + * will match the original pointer \p pHost. If any device visible to the application + * has a zero value for the device attribute, the device pointer returned by + * ::cudaHostGetDevicePointer() will not match the original host pointer \p pHost, + * but it will be suitable for use on all devices provided Unified Virtual Addressing + * is enabled. In such systems, it is valid to access the memory using either pointer + * on devices that have a non-zero value for the device attribute. Note however that + * such devices should access the memory using only of the two pointers and not both. + * + * \p flags provides for future releases. For now, it must be set to 0. + * + * \param pDevice - Returned device pointer for mapped memory + * \param pHost - Requested host pointer mapping + * \param flags - Flags for extensions (must be 0 for now) + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaSetDeviceFlags, ::cudaHostAlloc, + * ::cuMemHostGetDevicePointer + */ +extern __host__ cudaError_t CUDARTAPI cudaHostGetDevicePointer(void **pDevice, void *pHost, unsigned int flags); + +/** + * \brief Passes back flags used to allocate pinned host memory allocated by + * cudaHostAlloc + * + * ::cudaHostGetFlags() will fail if the input pointer does not + * reside in an address range allocated by ::cudaHostAlloc(). + * + * \param pFlags - Returned flags word + * \param pHost - Host pointer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaHostAlloc, + * ::cuMemHostGetFlags + */ +extern __host__ cudaError_t CUDARTAPI cudaHostGetFlags(unsigned int *pFlags, void *pHost); + +/** + * \brief Allocates logical 1D, 2D, or 3D memory objects on the device + * + * Allocates at least \p width * \p height * \p depth bytes of linear memory + * on the device and returns a ::cudaPitchedPtr in which \p ptr is a pointer + * to the allocated memory. The function may pad the allocation to ensure + * hardware alignment requirements are met. The pitch returned in the \p pitch + * field of \p pitchedDevPtr is the width in bytes of the allocation. + * + * The returned ::cudaPitchedPtr contains additional fields \p xsize and + * \p ysize, the logical width and height of the allocation, which are + * equivalent to the \p width and \p height \p extent parameters provided by + * the programmer during allocation. + * + * For allocations of 2D and 3D objects, it is highly recommended that + * programmers perform allocations using ::cudaMalloc3D() or + * ::cudaMallocPitch(). Due to alignment restrictions in the hardware, this is + * especially true if the application will be performing memory copies + * involving 2D or 3D objects (whether linear memory or CUDA arrays). + * + * \param pitchedDevPtr - Pointer to allocated pitched device memory + * \param extent - Requested allocation size (\p width field in bytes) + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMallocPitch, ::cudaFree, ::cudaMemcpy3D, ::cudaMemset3D, + * ::cudaMalloc3DArray, ::cudaMallocArray, ::cudaFreeArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaHostAlloc, ::make_cudaPitchedPtr, ::make_cudaExtent, + * ::cuMemAllocPitch + */ +extern __host__ cudaError_t CUDARTAPI cudaMalloc3D(struct cudaPitchedPtr* pitchedDevPtr, struct cudaExtent extent); + +/** + * \brief Allocate an array on the device + * + * Allocates a CUDA array according to the ::cudaChannelFormatDesc structure + * \p desc and returns a handle to the new CUDA array in \p *array. + * + * The ::cudaChannelFormatDesc is defined as: + * \code + struct cudaChannelFormatDesc { + int x, y, z, w; + enum cudaChannelFormatKind f; + }; + \endcode + * where ::cudaChannelFormatKind is one of ::cudaChannelFormatKindSigned, + * ::cudaChannelFormatKindUnsigned, or ::cudaChannelFormatKindFloat. + * + * ::cudaMalloc3DArray() can allocate the following: + * + * - A 1D array is allocated if the height and depth extents are both zero. + * - A 2D array is allocated if only the depth extent is zero. + * - A 3D array is allocated if all three extents are non-zero. + * - A 1D layered CUDA array is allocated if only the height extent is zero and + * the cudaArrayLayered flag is set. Each layer is a 1D array. The number of layers is + * determined by the depth extent. + * - A 2D layered CUDA array is allocated if all three extents are non-zero and + * the cudaArrayLayered flag is set. Each layer is a 2D array. The number of layers is + * determined by the depth extent. + * - A cubemap CUDA array is allocated if all three extents are non-zero and the + * cudaArrayCubemap flag is set. Width must be equal to height, and depth must be six. A cubemap is + * a special type of 2D layered CUDA array, where the six layers represent the six faces of a cube. + * The order of the six layers in memory is the same as that listed in ::cudaGraphicsCubeFace. + * - A cubemap layered CUDA array is allocated if all three extents are non-zero, and both, + * cudaArrayCubemap and cudaArrayLayered flags are set. Width must be equal to height, and depth must be + * a multiple of six. A cubemap layered CUDA array is a special type of 2D layered CUDA array that consists + * of a collection of cubemaps. The first six layers represent the first cubemap, the next six layers form + * the second cubemap, and so on. + * + * + * The \p flags parameter enables different options to be specified that affect + * the allocation, as follows. + * - ::cudaArrayDefault: This flag's value is defined to be 0 and provides default array allocation + * - ::cudaArrayLayered: Allocates a layered CUDA array, with the depth extent indicating the number of layers + * - ::cudaArrayCubemap: Allocates a cubemap CUDA array. Width must be equal to height, and depth must be six. + * If the cudaArrayLayered flag is also set, depth must be a multiple of six. + * - ::cudaArraySurfaceLoadStore: Allocates a CUDA array that could be read from or written to using a surface + * reference. + * - ::cudaArrayTextureGather: This flag indicates that texture gather operations will be performed on the CUDA + * array. Texture gather can only be performed on 2D CUDA arrays. + * - ::cudaArraySparse: Allocates a CUDA array without physical backing memory. The subregions within this sparse array + * can later be mapped onto a physical memory allocation by calling ::cuMemMapArrayAsync. This flag can only be used for + * creating 2D, 3D or 2D layered sparse CUDA arrays. The physical backing memory must be allocated via ::cuMemCreate. + * - ::cudaArrayDeferredMapping: Allocates a CUDA array without physical backing memory. The entire array can + * later be mapped onto a physical memory allocation by calling ::cuMemMapArrayAsync. The physical backing memory must be allocated + * via ::cuMemCreate. + * + * The width, height and depth extents must meet certain size requirements as listed in the following table. + * All values are specified in elements. + * + * Note that 2D CUDA arrays have different size requirements if the ::cudaArrayTextureGather flag is set. In that + * case, the valid range for (width, height, depth) is ((1,maxTexture2DGather[0]), (1,maxTexture2DGather[1]), 0). + * + * \xmlonly + * + * + * + * + * + * + * + * CUDA array type + * Valid extents that must always be met {(width range in elements), + * (height range), (depth range)} + * Valid extents with cudaArraySurfaceLoadStore set {(width range in + * elements), (height range), (depth range)} + * + * + * + * + * 1D + * { (1,maxTexture1D), 0, 0 } + * { (1,maxSurface1D), 0, 0 } + * + * + * 2D + * { (1,maxTexture2D[0]), (1,maxTexture2D[1]), 0 } + * { (1,maxSurface2D[0]), (1,maxSurface2D[1]), 0 } + * + * + * 3D + * { (1,maxTexture3D[0]), (1,maxTexture3D[1]), (1,maxTexture3D[2]) } + * OR { (1,maxTexture3DAlt[0]), (1,maxTexture3DAlt[1]), + * (1,maxTexture3DAlt[2]) } + * { (1,maxSurface3D[0]), (1,maxSurface3D[1]), (1,maxSurface3D[2]) } + * + * + * 1D Layered + * { (1,maxTexture1DLayered[0]), 0, (1,maxTexture1DLayered[1]) } + * { (1,maxSurface1DLayered[0]), 0, (1,maxSurface1DLayered[1]) } + * + * + * 2D Layered + * { (1,maxTexture2DLayered[0]), (1,maxTexture2DLayered[1]), + * (1,maxTexture2DLayered[2]) } + * { (1,maxSurface2DLayered[0]), (1,maxSurface2DLayered[1]), + * (1,maxSurface2DLayered[2]) } + * + * + * Cubemap + * { (1,maxTextureCubemap), (1,maxTextureCubemap), 6 } + * { (1,maxSurfaceCubemap), (1,maxSurfaceCubemap), 6 } + * + * + * Cubemap Layered + * { (1,maxTextureCubemapLayered[0]), (1,maxTextureCubemapLayered[0]), + * (1,maxTextureCubemapLayered[1]) } + * { (1,maxSurfaceCubemapLayered[0]), (1,maxSurfaceCubemapLayered[0]), + * (1,maxSurfaceCubemapLayered[1]) } + * + * + * + *
+ * \endxmlonly + * + * \param array - Pointer to allocated array in device memory + * \param desc - Requested channel format + * \param extent - Requested allocation size (\p width field in elements) + * \param flags - Flags for extensions + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc3D, ::cudaMalloc, ::cudaMallocPitch, ::cudaFree, + * ::cudaFreeArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaHostAlloc, + * ::make_cudaExtent, + * ::cuArray3DCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaMalloc3DArray(cudaArray_t *array, const struct cudaChannelFormatDesc* desc, struct cudaExtent extent, unsigned int flags __dv(0)); + +/** + * \brief Allocate a mipmapped array on the device + * + * Allocates a CUDA mipmapped array according to the ::cudaChannelFormatDesc structure + * \p desc and returns a handle to the new CUDA mipmapped array in \p *mipmappedArray. + * \p numLevels specifies the number of mipmap levels to be allocated. This value is + * clamped to the range [1, 1 + floor(log2(max(width, height, depth)))]. + * + * The ::cudaChannelFormatDesc is defined as: + * \code + struct cudaChannelFormatDesc { + int x, y, z, w; + enum cudaChannelFormatKind f; + }; + \endcode + * where ::cudaChannelFormatKind is one of ::cudaChannelFormatKindSigned, + * ::cudaChannelFormatKindUnsigned, or ::cudaChannelFormatKindFloat. + * + * ::cudaMallocMipmappedArray() can allocate the following: + * + * - A 1D mipmapped array is allocated if the height and depth extents are both zero. + * - A 2D mipmapped array is allocated if only the depth extent is zero. + * - A 3D mipmapped array is allocated if all three extents are non-zero. + * - A 1D layered CUDA mipmapped array is allocated if only the height extent is zero and + * the cudaArrayLayered flag is set. Each layer is a 1D mipmapped array. The number of layers is + * determined by the depth extent. + * - A 2D layered CUDA mipmapped array is allocated if all three extents are non-zero and + * the cudaArrayLayered flag is set. Each layer is a 2D mipmapped array. The number of layers is + * determined by the depth extent. + * - A cubemap CUDA mipmapped array is allocated if all three extents are non-zero and the + * cudaArrayCubemap flag is set. Width must be equal to height, and depth must be six. + * The order of the six layers in memory is the same as that listed in ::cudaGraphicsCubeFace. + * - A cubemap layered CUDA mipmapped array is allocated if all three extents are non-zero, and both, + * cudaArrayCubemap and cudaArrayLayered flags are set. Width must be equal to height, and depth must be + * a multiple of six. A cubemap layered CUDA mipmapped array is a special type of 2D layered CUDA mipmapped + * array that consists of a collection of cubemap mipmapped arrays. The first six layers represent the + * first cubemap mipmapped array, the next six layers form the second cubemap mipmapped array, and so on. + * + * + * The \p flags parameter enables different options to be specified that affect + * the allocation, as follows. + * - ::cudaArrayDefault: This flag's value is defined to be 0 and provides default mipmapped array allocation + * - ::cudaArrayLayered: Allocates a layered CUDA mipmapped array, with the depth extent indicating the number of layers + * - ::cudaArrayCubemap: Allocates a cubemap CUDA mipmapped array. Width must be equal to height, and depth must be six. + * If the cudaArrayLayered flag is also set, depth must be a multiple of six. + * - ::cudaArraySurfaceLoadStore: This flag indicates that individual mipmap levels of the CUDA mipmapped array + * will be read from or written to using a surface reference. + * - ::cudaArrayTextureGather: This flag indicates that texture gather operations will be performed on the CUDA + * array. Texture gather can only be performed on 2D CUDA mipmapped arrays, and the gather operations are + * performed only on the most detailed mipmap level. + * - ::cudaArraySparse: Allocates a CUDA mipmapped array without physical backing memory. The subregions within this sparse array + * can later be mapped onto a physical memory allocation by calling ::cuMemMapArrayAsync. This flag can only be used for creating + * 2D, 3D or 2D layered sparse CUDA mipmapped arrays. The physical backing memory must be allocated via ::cuMemCreate. + * - ::cudaArrayDeferredMapping: Allocates a CUDA mipmapped array without physical backing memory. The entire array can + * later be mapped onto a physical memory allocation by calling ::cuMemMapArrayAsync. The physical backing memory must be allocated + * via ::cuMemCreate. + * + * The width, height and depth extents must meet certain size requirements as listed in the following table. + * All values are specified in elements. + * + * \xmlonly + * + * + * + * + * + * + * + * CUDA array type + * Valid extents that must always be met {(width range in elements), + * (height range), (depth range)} + * Valid extents with cudaArraySurfaceLoadStore set {(width range in + * elements), (height range), (depth range)} + * + * + * + * + * 1D + * { (1,maxTexture1DMipmap), 0, 0 } + * { (1,maxSurface1D), 0, 0 } + * + * + * 2D + * { (1,maxTexture2DMipmap[0]), (1,maxTexture2DMipmap[1]), 0 } + * { (1,maxSurface2D[0]), (1,maxSurface2D[1]), 0 } + * + * + * 3D + * { (1,maxTexture3D[0]), (1,maxTexture3D[1]), (1,maxTexture3D[2]) } + * OR { (1,maxTexture3DAlt[0]), (1,maxTexture3DAlt[1]), + * (1,maxTexture3DAlt[2]) } + * { (1,maxSurface3D[0]), (1,maxSurface3D[1]), (1,maxSurface3D[2]) } + * + * + * 1D Layered + * { (1,maxTexture1DLayered[0]), 0, (1,maxTexture1DLayered[1]) } + * { (1,maxSurface1DLayered[0]), 0, (1,maxSurface1DLayered[1]) } + * + * + * 2D Layered + * { (1,maxTexture2DLayered[0]), (1,maxTexture2DLayered[1]), + * (1,maxTexture2DLayered[2]) } + * { (1,maxSurface2DLayered[0]), (1,maxSurface2DLayered[1]), + * (1,maxSurface2DLayered[2]) } + * + * + * Cubemap + * { (1,maxTextureCubemap), (1,maxTextureCubemap), 6 } + * { (1,maxSurfaceCubemap), (1,maxSurfaceCubemap), 6 } + * + * + * Cubemap Layered + * { (1,maxTextureCubemapLayered[0]), (1,maxTextureCubemapLayered[0]), + * (1,maxTextureCubemapLayered[1]) } + * { (1,maxSurfaceCubemapLayered[0]), (1,maxSurfaceCubemapLayered[0]), + * (1,maxSurfaceCubemapLayered[1]) } + * + * + * + *
+ * \endxmlonly + * + * \param mipmappedArray - Pointer to allocated mipmapped array in device memory + * \param desc - Requested channel format + * \param extent - Requested allocation size (\p width field in elements) + * \param numLevels - Number of mipmap levels to allocate + * \param flags - Flags for extensions + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc3D, ::cudaMalloc, ::cudaMallocPitch, ::cudaFree, + * ::cudaFreeArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaHostAlloc, + * ::make_cudaExtent, + * ::cuMipmappedArrayCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaMallocMipmappedArray(cudaMipmappedArray_t *mipmappedArray, const struct cudaChannelFormatDesc* desc, struct cudaExtent extent, unsigned int numLevels, unsigned int flags __dv(0)); + +/** + * \brief Gets a mipmap level of a CUDA mipmapped array + * + * Returns in \p *levelArray a CUDA array that represents a single mipmap level + * of the CUDA mipmapped array \p mipmappedArray. + * + * If \p level is greater than the maximum number of levels in this mipmapped array, + * ::cudaErrorInvalidValue is returned. + * + * If \p mipmappedArray is NULL, + * ::cudaErrorInvalidResourceHandle is returned. + * + * \param levelArray - Returned mipmap level CUDA array + * \param mipmappedArray - CUDA mipmapped array + * \param level - Mipmap level + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc3D, ::cudaMalloc, ::cudaMallocPitch, ::cudaFree, + * ::cudaFreeArray, + * \ref ::cudaMallocHost(void**, size_t) "cudaMallocHost (C API)", + * ::cudaFreeHost, ::cudaHostAlloc, + * ::make_cudaExtent, + * ::cuMipmappedArrayGetLevel + */ +extern __host__ cudaError_t CUDARTAPI cudaGetMipmappedArrayLevel(cudaArray_t *levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level); + +/** + * \brief Copies data between 3D objects + * +\code +struct cudaExtent { + size_t width; + size_t height; + size_t depth; +}; +struct cudaExtent make_cudaExtent(size_t w, size_t h, size_t d); + +struct cudaPos { + size_t x; + size_t y; + size_t z; +}; +struct cudaPos make_cudaPos(size_t x, size_t y, size_t z); + +struct cudaMemcpy3DParms { + cudaArray_t srcArray; + struct cudaPos srcPos; + struct cudaPitchedPtr srcPtr; + cudaArray_t dstArray; + struct cudaPos dstPos; + struct cudaPitchedPtr dstPtr; + struct cudaExtent extent; + enum cudaMemcpyKind kind; +}; +\endcode + * + * ::cudaMemcpy3D() copies data betwen two 3D objects. The source and + * destination objects may be in either host memory, device memory, or a CUDA + * array. The source, destination, extent, and kind of copy performed is + * specified by the ::cudaMemcpy3DParms struct which should be initialized to + * zero before use: +\code +cudaMemcpy3DParms myParms = {0}; +\endcode + * + * The struct passed to ::cudaMemcpy3D() must specify one of \p srcArray or + * \p srcPtr and one of \p dstArray or \p dstPtr. Passing more than one + * non-zero source or destination will cause ::cudaMemcpy3D() to return an + * error. + * + * The \p srcPos and \p dstPos fields are optional offsets into the source and + * destination objects and are defined in units of each object's elements. The + * element for a host or device pointer is assumed to be unsigned char. + * + * The \p extent field defines the dimensions of the transferred area in + * elements. If a CUDA array is participating in the copy, the extent is + * defined in terms of that array's elements. If no CUDA array is + * participating in the copy then the extents are defined in elements of + * unsigned char. + * + * The \p kind field defines the direction of the copy. It must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * For ::cudaMemcpyHostToHost or ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToHost + * passed as kind and cudaArray type passed as source or destination, if the kind + * implies cudaArray type to be present on the host, ::cudaMemcpy3D() will + * disregard that implication and silently correct the kind based on the fact that + * cudaArray type can only be present on the device. + * + * If the source and destination are both arrays, ::cudaMemcpy3D() will return + * an error if they do not have the same element size. + * + * The source and destination object may not overlap. If overlapping source + * and destination objects are specified, undefined behavior will result. + * + * The source object must entirely contain the region defined by \p srcPos + * and \p extent. The destination object must entirely contain the region + * defined by \p dstPos and \p extent. + * + * ::cudaMemcpy3D() returns an error if the pitch of \p srcPtr or \p dstPtr + * exceeds the maximum allowed. The pitch of a ::cudaPitchedPtr allocated + * with ::cudaMalloc3D() will always be valid. + * + * \param p - 3D memory copy parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidPitchValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_sync + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc3D, ::cudaMalloc3DArray, ::cudaMemset3D, ::cudaMemcpy3DAsync, + * ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::make_cudaExtent, ::make_cudaPos, + * ::cuMemcpy3D + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpy3D(const struct cudaMemcpy3DParms *p); + +/** + * \brief Copies memory between devices + * + * Perform a 3D memory copy according to the parameters specified in + * \p p. See the definition of the ::cudaMemcpy3DPeerParms structure + * for documentation of its parameters. + * + * Note that this function is synchronous with respect to the host only if + * the source or destination of the transfer is host memory. Note also + * that this copy is serialized with respect to all pending and future + * asynchronous work in to the current device, the copy's source device, + * and the copy's destination device (use ::cudaMemcpy3DPeerAsync to avoid + * this synchronization). + * + * \param p - Parameters for the memory copy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidPitchValue + * \notefnerr + * \note_sync + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpyPeer, ::cudaMemcpyAsync, ::cudaMemcpyPeerAsync, + * ::cudaMemcpy3DPeerAsync, + * ::cuMemcpy3DPeer + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeer(const struct cudaMemcpy3DPeerParms *p); + +/** + * \brief Copies data between 3D objects + * +\code +struct cudaExtent { + size_t width; + size_t height; + size_t depth; +}; +struct cudaExtent make_cudaExtent(size_t w, size_t h, size_t d); + +struct cudaPos { + size_t x; + size_t y; + size_t z; +}; +struct cudaPos make_cudaPos(size_t x, size_t y, size_t z); + +struct cudaMemcpy3DParms { + cudaArray_t srcArray; + struct cudaPos srcPos; + struct cudaPitchedPtr srcPtr; + cudaArray_t dstArray; + struct cudaPos dstPos; + struct cudaPitchedPtr dstPtr; + struct cudaExtent extent; + enum cudaMemcpyKind kind; +}; +\endcode + * + * ::cudaMemcpy3DAsync() copies data betwen two 3D objects. The source and + * destination objects may be in either host memory, device memory, or a CUDA + * array. The source, destination, extent, and kind of copy performed is + * specified by the ::cudaMemcpy3DParms struct which should be initialized to + * zero before use: +\code +cudaMemcpy3DParms myParms = {0}; +\endcode + * + * The struct passed to ::cudaMemcpy3DAsync() must specify one of \p srcArray + * or \p srcPtr and one of \p dstArray or \p dstPtr. Passing more than one + * non-zero source or destination will cause ::cudaMemcpy3DAsync() to return an + * error. + * + * The \p srcPos and \p dstPos fields are optional offsets into the source and + * destination objects and are defined in units of each object's elements. The + * element for a host or device pointer is assumed to be unsigned char. + * For CUDA arrays, positions must be in the range [0, 2048) for any + * dimension. + * + * The \p extent field defines the dimensions of the transferred area in + * elements. If a CUDA array is participating in the copy, the extent is + * defined in terms of that array's elements. If no CUDA array is + * participating in the copy then the extents are defined in elements of + * unsigned char. + * + * The \p kind field defines the direction of the copy. It must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * For ::cudaMemcpyHostToHost or ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToHost + * passed as kind and cudaArray type passed as source or destination, if the kind + * implies cudaArray type to be present on the host, ::cudaMemcpy3DAsync() will + * disregard that implication and silently correct the kind based on the fact that + * cudaArray type can only be present on the device. + * + * If the source and destination are both arrays, ::cudaMemcpy3DAsync() will + * return an error if they do not have the same element size. + * + * The source and destination object may not overlap. If overlapping source + * and destination objects are specified, undefined behavior will result. + * + * The source object must lie entirely within the region defined by \p srcPos + * and \p extent. The destination object must lie entirely within the region + * defined by \p dstPos and \p extent. + * + * ::cudaMemcpy3DAsync() returns an error if the pitch of \p srcPtr or + * \p dstPtr exceeds the maximum allowed. The pitch of a + * ::cudaPitchedPtr allocated with ::cudaMalloc3D() will always be valid. + * + * ::cudaMemcpy3DAsync() is asynchronous with respect to the host, so + * the call may return before the copy is complete. The copy can optionally + * be associated to a stream by passing a non-zero \p stream argument. If + * \p kind is ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToHost and \p stream + * is non-zero, the copy may overlap with operations in other streams. + * + * The device version of this function only handles device to device copies and + * cannot be given local or shared pointers. + * + * \param p - 3D memory copy parameters + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidPitchValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMalloc3D, ::cudaMalloc3DArray, ::cudaMemset3D, ::cudaMemcpy3D, + * ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, :::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::make_cudaExtent, ::make_cudaPos, + * ::cuMemcpy3DAsync + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync(const struct cudaMemcpy3DParms *p, cudaStream_t stream __dv(0)); + +/** + * \brief Copies memory between devices asynchronously. + * + * Perform a 3D memory copy according to the parameters specified in + * \p p. See the definition of the ::cudaMemcpy3DPeerParms structure + * for documentation of its parameters. + * + * \param p - Parameters for the memory copy + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidPitchValue + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpyPeer, ::cudaMemcpyAsync, ::cudaMemcpyPeerAsync, + * ::cudaMemcpy3DPeerAsync, + * ::cuMemcpy3DPeerAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeerAsync(const struct cudaMemcpy3DPeerParms *p, cudaStream_t stream __dv(0)); + +/** + * \brief Gets free and total device memory + * + * Returns in \p *total the total amount of memory available to the the current context. + * Returns in \p *free the amount of memory on the device that is free according to the OS. + * CUDA is not guaranteed to be able to allocate all of the memory that the OS reports as free. + * In a multi-tenet situation, free estimate returned is prone to race condition where + * a new allocation/free done by a different process or a different thread in the same + * process between the time when free memory was estimated and reported, will result in + * deviation in free value reported and actual free memory. + * + * The integrated GPU on Tegra shares memory with CPU and other component + * of the SoC. The free and total values returned by the API excludes + * the SWAP memory space maintained by the OS on some platforms. + * The OS may move some of the memory pages into swap area as the GPU or + * CPU allocate or access memory. See Tegra app note on how to calculate + * total and free memory on Tegra. + * + * \param free - Returned free memory in bytes + * \param total - Returned total memory in bytes + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorLaunchFailure + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cuMemGetInfo + */ +extern __host__ cudaError_t CUDARTAPI cudaMemGetInfo(size_t *free, size_t *total); + +/** + * \brief Gets info about the specified cudaArray + * + * Returns in \p *desc, \p *extent and \p *flags respectively, the type, shape + * and flags of \p array. + * + * Any of \p *desc, \p *extent and \p *flags may be specified as NULL. + * + * \param desc - Returned array type + * \param extent - Returned array shape. 2D arrays will have depth of zero + * \param flags - Returned array flags + * \param array - The ::cudaArray to get info for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cuArrayGetDescriptor, + * ::cuArray3DGetDescriptor + */ +extern __host__ cudaError_t CUDARTAPI cudaArrayGetInfo(struct cudaChannelFormatDesc *desc, struct cudaExtent *extent, unsigned int *flags, cudaArray_t array); + +/** + * \brief Gets a CUDA array plane from a CUDA array + * + * Returns in \p pPlaneArray a CUDA array that represents a single format plane + * of the CUDA array \p hArray. + * + * If \p planeIdx is greater than the maximum number of planes in this array or if the array does + * not have a multi-planar format e.g: ::cudaChannelFormatKindNV12, then ::cudaErrorInvalidValue is returned. + * + * Note that if the \p hArray has format ::cudaChannelFormatKindNV12, then passing in 0 for \p planeIdx returns + * a CUDA array of the same size as \p hArray but with one 8-bit channel and ::cudaChannelFormatKindUnsigned as its format kind. + * If 1 is passed for \p planeIdx, then the returned CUDA array has half the height and width + * of \p hArray with two 8-bit channels and ::cudaChannelFormatKindUnsigned as its format kind. + * + * \param pPlaneArray - Returned CUDA array referenced by the \p planeIdx + * \param hArray - CUDA array + * \param planeIdx - Plane index + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * + * \sa + * ::cuArrayGetPlane + */ +extern __host__ cudaError_t CUDARTAPI cudaArrayGetPlane(cudaArray_t *pPlaneArray, cudaArray_t hArray, unsigned int planeIdx); + +/** + * \brief Returns the memory requirements of a CUDA array + * + * Returns the memory requirements of a CUDA array in \p memoryRequirements + * If the CUDA array is not allocated with flag ::cudaArrayDeferredMapping + * ::cudaErrorInvalidValue will be returned. + * + * The returned value in ::cudaArrayMemoryRequirements::size + * represents the total size of the CUDA array. + * The returned value in ::cudaArrayMemoryRequirements::alignment + * represents the alignment necessary for mapping the CUDA array. + * + * \return + * ::cudaSuccess + * ::cudaErrorInvalidValue + * + * \param[out] memoryRequirements - Pointer to ::cudaArrayMemoryRequirements + * \param[in] array - CUDA array to get the memory requirements of + * \param[in] device - Device to get the memory requirements for + * \sa ::cudaMipmappedArrayGetMemoryRequirements + */ +extern __host__ cudaError_t CUDARTAPI cudaArrayGetMemoryRequirements(struct cudaArrayMemoryRequirements *memoryRequirements, cudaArray_t array, int device); + +/** + * \brief Returns the memory requirements of a CUDA mipmapped array + * + * Returns the memory requirements of a CUDA mipmapped array in \p memoryRequirements + * If the CUDA mipmapped array is not allocated with flag ::cudaArrayDeferredMapping + * ::cudaErrorInvalidValue will be returned. + * + * The returned value in ::cudaArrayMemoryRequirements::size + * represents the total size of the CUDA mipmapped array. + * The returned value in ::cudaArrayMemoryRequirements::alignment + * represents the alignment necessary for mapping the CUDA mipmapped + * array. + * + * \return + * ::cudaSuccess + * ::cudaErrorInvalidValue + * + * \param[out] memoryRequirements - Pointer to ::cudaArrayMemoryRequirements + * \param[in] mipmap - CUDA mipmapped array to get the memory requirements of + * \param[in] device - Device to get the memory requirements for + * \sa ::cudaArrayGetMemoryRequirements + */ +extern __host__ cudaError_t CUDARTAPI cudaMipmappedArrayGetMemoryRequirements(struct cudaArrayMemoryRequirements *memoryRequirements, cudaMipmappedArray_t mipmap, int device); + +/** + * \brief Returns the layout properties of a sparse CUDA array + * + * Returns the layout properties of a sparse CUDA array in \p sparseProperties. + * If the CUDA array is not allocated with flag ::cudaArraySparse + * ::cudaErrorInvalidValue will be returned. + * + * If the returned value in ::cudaArraySparseProperties::flags contains ::cudaArraySparsePropertiesSingleMipTail, + * then ::cudaArraySparseProperties::miptailSize represents the total size of the array. Otherwise, it will be zero. + * Also, the returned value in ::cudaArraySparseProperties::miptailFirstLevel is always zero. + * Note that the \p array must have been allocated using ::cudaMallocArray or ::cudaMalloc3DArray. For CUDA arrays obtained + * using ::cudaMipmappedArrayGetLevel, ::cudaErrorInvalidValue will be returned. Instead, ::cudaMipmappedArrayGetSparseProperties + * must be used to obtain the sparse properties of the entire CUDA mipmapped array to which \p array belongs to. + * + * \return + * ::cudaSuccess + * ::cudaErrorInvalidValue + * + * \param[out] sparseProperties - Pointer to return the ::cudaArraySparseProperties + * \param[in] array - The CUDA array to get the sparse properties of + * + * \sa + * ::cudaMipmappedArrayGetSparseProperties, + * ::cuMemMapArrayAsync + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaArrayGetSparseProperties(struct cudaArraySparseProperties *sparseProperties, cudaArray_t array); +#endif + +/** + * \brief Returns the layout properties of a sparse CUDA mipmapped array + * + * Returns the sparse array layout properties in \p sparseProperties. + * If the CUDA mipmapped array is not allocated with flag ::cudaArraySparse + * ::cudaErrorInvalidValue will be returned. + * + * For non-layered CUDA mipmapped arrays, ::cudaArraySparseProperties::miptailSize returns the + * size of the mip tail region. The mip tail region includes all mip levels whose width, height or depth + * is less than that of the tile. + * For layered CUDA mipmapped arrays, if ::cudaArraySparseProperties::flags contains ::cudaArraySparsePropertiesSingleMipTail, + * then ::cudaArraySparseProperties::miptailSize specifies the size of the mip tail of all layers combined. + * Otherwise, ::cudaArraySparseProperties::miptailSize specifies mip tail size per layer. + * The returned value of ::cudaArraySparseProperties::miptailFirstLevel is valid only if ::cudaArraySparseProperties::miptailSize is non-zero. + * + * \return + * ::cudaSuccess + * ::cudaErrorInvalidValue + * + * \param[out] sparseProperties - Pointer to return ::cudaArraySparseProperties + * \param[in] mipmap - The CUDA mipmapped array to get the sparse properties of + * + * \sa + * ::cudaArrayGetSparseProperties, + * ::cuMemMapArrayAsync + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaMipmappedArrayGetSparseProperties(struct cudaArraySparseProperties *sparseProperties, cudaMipmappedArray_t mipmap); +#endif + +/** + * \brief Copies data between host and device + * + * Copies \p count bytes from the memory area pointed to by \p src to the + * memory area pointed to by \p dst, where \p kind specifies the direction + * of the copy, and must be one of ::cudaMemcpyHostToHost, + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. Calling + * ::cudaMemcpy() with dst and src pointers that do not match the direction of + * the copy results in an undefined behavior. + * + * \param dst - Destination memory address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_init_rt + * \note_callback + * + * \note_sync + * \note_memcpy + * + * \sa ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpyDtoH, + * ::cuMemcpyHtoD, + * ::cuMemcpyDtoD, + * ::cuMemcpy + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind); + +/** + * \brief Copies memory between two devices + * + * Copies memory from one device to memory on another device. \p dst is the + * base device pointer of the destination memory and \p dstDevice is the + * destination device. \p src is the base device pointer of the source memory + * and \p srcDevice is the source device. \p count specifies the number of bytes + * to copy. + * + * Note that this function is asynchronous with respect to the host, but + * serialized with respect all pending and future asynchronous work in to the + * current device, \p srcDevice, and \p dstDevice (use ::cudaMemcpyPeerAsync + * to avoid this synchronization). + * + * \param dst - Destination device pointer + * \param dstDevice - Destination device + * \param src - Source device pointer + * \param srcDevice - Source device + * \param count - Size of memory copy in bytes + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_sync + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpyAsync, ::cudaMemcpyPeerAsync, + * ::cudaMemcpy3DPeerAsync, + * ::cuMemcpyPeer + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpyPeer(void *dst, int dstDevice, const void *src, int srcDevice, size_t count); + +/** + * \brief Copies data between host and device + * + * Copies a matrix (\p height rows of \p width bytes each) from the memory + * area pointed to by \p src to the memory area pointed to by \p dst, where + * \p kind specifies the direction of the copy, and must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. \p dpitch and + * \p spitch are the widths in memory in bytes of the 2D arrays pointed to by + * \p dst and \p src, including any padding added to the end of each row. The + * memory areas may not overlap. \p width must not exceed either \p dpitch or + * \p spitch. Calling ::cudaMemcpy2D() with \p dst and \p src pointers that do + * not match the direction of the copy results in an undefined behavior. + * ::cudaMemcpy2D() returns an error if \p dpitch or \p spitch exceeds + * the maximum allowed. + * + * \param dst - Destination memory address + * \param dpitch - Pitch of destination memory + * \param src - Source memory address + * \param spitch - Pitch of source memory + * \param width - Width of matrix transfer (columns in bytes) + * \param height - Height of matrix transfer (rows) + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidPitchValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_init_rt + * \note_callback + * \note_memcpy + * + * \sa ::cudaMemcpy, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpy2D, + * ::cuMemcpy2DUnaligned + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpy2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind); + +/** + * \brief Copies data between host and device + * + * Copies a matrix (\p height rows of \p width bytes each) from the memory + * area pointed to by \p src to the CUDA array \p dst starting at + * \p hOffset rows and \p wOffset bytes from the upper left corner, + * where \p kind specifies the direction of the copy, and must be one + * of ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * \p spitch is the width in memory in bytes of the 2D array pointed to by + * \p src, including any padding added to the end of each row. \p wOffset + + * \p width must not exceed the width of the CUDA array \p dst. \p width must + * not exceed \p spitch. ::cudaMemcpy2DToArray() returns an error if \p spitch + * exceeds the maximum allowed. + * + * \param dst - Destination memory address + * \param wOffset - Destination starting X offset (columns in bytes) + * \param hOffset - Destination starting Y offset (rows) + * \param src - Source memory address + * \param spitch - Pitch of source memory + * \param width - Width of matrix transfer (columns in bytes) + * \param height - Height of matrix transfer (rows) + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidPitchValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_sync + * \note_init_rt + * \note_callback + * \note_memcpy + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpy2D, + * ::cuMemcpy2DUnaligned + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind); + +/** + * \brief Copies data between host and device + * + * Copies a matrix (\p height rows of \p width bytes each) from the CUDA + * array \p src starting at \p hOffset rows and \p wOffset bytes from the + * upper left corner to the memory area pointed to by \p dst, where + * \p kind specifies the direction of the copy, and must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. \p dpitch is the + * width in memory in bytes of the 2D array pointed to by \p dst, including any + * padding added to the end of each row. \p wOffset + \p width must not exceed + * the width of the CUDA array \p src. \p width must not exceed \p dpitch. + * ::cudaMemcpy2DFromArray() returns an error if \p dpitch exceeds the maximum + * allowed. + * + * \param dst - Destination memory address + * \param dpitch - Pitch of destination memory + * \param src - Source memory address + * \param wOffset - Source starting X offset (columns in bytes) + * \param hOffset - Source starting Y offset (rows) + * \param width - Width of matrix transfer (columns in bytes) + * \param height - Height of matrix transfer (rows) + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidPitchValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_sync + * \note_init_rt + * \note_callback + * \note_memcpy + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpy2D, + * ::cuMemcpy2DUnaligned + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArray(void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind); + +/** + * \brief Copies data between host and device + * + * Copies a matrix (\p height rows of \p width bytes each) from the CUDA + * array \p src starting at \p hOffsetSrc rows and \p wOffsetSrc bytes from the + * upper left corner to the CUDA array \p dst starting at \p hOffsetDst rows + * and \p wOffsetDst bytes from the upper left corner, where \p kind + * specifies the direction of the copy, and must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * \p wOffsetDst + \p width must not exceed the width of the CUDA array \p dst. + * \p wOffsetSrc + \p width must not exceed the width of the CUDA array \p src. + * + * \param dst - Destination memory address + * \param wOffsetDst - Destination starting X offset (columns in bytes) + * \param hOffsetDst - Destination starting Y offset (rows) + * \param src - Source memory address + * \param wOffsetSrc - Source starting X offset (columns in bytes) + * \param hOffsetSrc - Source starting Y offset (rows) + * \param width - Width of matrix transfer (columns in bytes) + * \param height - Height of matrix transfer (rows) + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_sync + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpy2D, + * ::cuMemcpy2DUnaligned + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)); + +/** + * \brief Copies data to the given symbol on the device + * + * Copies \p count bytes from the memory area pointed to by \p src + * to the memory area pointed to by \p offset bytes from the start of symbol + * \p symbol. The memory areas may not overlap. \p symbol is a variable that + * resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of + * transfer is inferred from the pointer values. However, ::cudaMemcpyDefault + * is only allowed on systems that support unified virtual addressing. + * + * \param symbol - Device symbol address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorInvalidMemcpyDirection, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_sync + * \note_string_api_deprecation + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpy, + * ::cuMemcpyHtoD, + * ::cuMemcpyDtoD + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbol(const void *symbol, const void *src, size_t count, size_t offset __dv(0), enum cudaMemcpyKind kind __dv(cudaMemcpyHostToDevice)); + + +/** + * \brief Copies data from the given symbol on the device + * + * Copies \p count bytes from the memory area pointed to by \p offset bytes + * from the start of symbol \p symbol to the memory area pointed to by \p dst. + * The memory areas may not overlap. \p symbol is a variable that + * resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyDeviceToHost, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of + * transfer is inferred from the pointer values. However, ::cudaMemcpyDefault + * is only allowed on systems that support unified virtual addressing. + * + * \param dst - Destination memory address + * \param symbol - Device symbol address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorInvalidMemcpyDirection, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_sync + * \note_string_api_deprecation + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpy, + * ::cuMemcpyDtoH, + * ::cuMemcpyDtoD + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol(void *dst, const void *symbol, size_t count, size_t offset __dv(0), enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToHost)); + + +/** + * \brief Copies data between host and device + * + * Copies \p count bytes from the memory area pointed to by \p src to the + * memory area pointed to by \p dst, where \p kind specifies the + * direction of the copy, and must be one of ::cudaMemcpyHostToHost, + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * The memory areas may not overlap. Calling ::cudaMemcpyAsync() with \p dst and + * \p src pointers that do not match the direction of the copy results in an + * undefined behavior. + * + * ::cudaMemcpyAsync() is asynchronous with respect to the host, so the call + * may return before the copy is complete. The copy can optionally be + * associated to a stream by passing a non-zero \p stream argument. If \p kind + * is ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToHost and the \p stream is + * non-zero, the copy may overlap with operations in other streams. + * + * The device version of this function only handles device to device copies and + * cannot be given local or shared pointers. + * + * \param dst - Destination memory address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param kind - Type of transfer + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * \note_memcpy + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpyAsync, + * ::cuMemcpyDtoHAsync, + * ::cuMemcpyHtoDAsync, + * ::cuMemcpyDtoDAsync + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpyAsync(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + +/** + * \brief Copies memory between two devices asynchronously. + * + * Copies memory from one device to memory on another device. \p dst is the + * base device pointer of the destination memory and \p dstDevice is the + * destination device. \p src is the base device pointer of the source memory + * and \p srcDevice is the source device. \p count specifies the number of bytes + * to copy. + * + * Note that this function is asynchronous with respect to the host and all work + * on other devices. + * + * \param dst - Destination device pointer + * \param dstDevice - Destination device + * \param src - Source device pointer + * \param srcDevice - Source device + * \param count - Size of memory copy in bytes + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpyPeer, ::cudaMemcpyAsync, + * ::cudaMemcpy3DPeerAsync, + * ::cuMemcpyPeerAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t count, cudaStream_t stream __dv(0)); + +/** + * \brief Copies data between host and device + * + * Copies a matrix (\p height rows of \p width bytes each) from the memory + * area pointed to by \p src to the memory area pointed to by \p dst, where + * \p kind specifies the direction of the copy, and must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * \p dpitch and \p spitch are the widths in memory in bytes of the 2D arrays + * pointed to by \p dst and \p src, including any padding added to the end of + * each row. The memory areas may not overlap. \p width must not exceed either + * \p dpitch or \p spitch. + * + * Calling ::cudaMemcpy2DAsync() with \p dst and \p src pointers that do not + * match the direction of the copy results in an undefined behavior. + * ::cudaMemcpy2DAsync() returns an error if \p dpitch or \p spitch is greater + * than the maximum allowed. + * + * ::cudaMemcpy2DAsync() is asynchronous with respect to the host, so + * the call may return before the copy is complete. The copy can optionally + * be associated to a stream by passing a non-zero \p stream argument. If + * \p kind is ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToHost and + * \p stream is non-zero, the copy may overlap with operations in other + * streams. + * + * The device version of this function only handles device to device copies and + * cannot be given local or shared pointers. + * + * \param dst - Destination memory address + * \param dpitch - Pitch of destination memory + * \param src - Source memory address + * \param spitch - Pitch of source memory + * \param width - Width of matrix transfer (columns in bytes) + * \param height - Height of matrix transfer (rows) + * \param kind - Type of transfer + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidPitchValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * \note_memcpy + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpy2DAsync + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + +/** + * \brief Copies data between host and device + * + * Copies a matrix (\p height rows of \p width bytes each) from the memory + * area pointed to by \p src to the CUDA array \p dst starting at \p hOffset + * rows and \p wOffset bytes from the upper left corner, where \p kind specifies + * the direction of the copy, and must be one of ::cudaMemcpyHostToHost, + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * \p spitch is the width in memory in bytes of the 2D array pointed to by + * \p src, including any padding added to the end of each row. \p wOffset + + * \p width must not exceed the width of the CUDA array \p dst. \p width must + * not exceed \p spitch. ::cudaMemcpy2DToArrayAsync() returns an error if + * \p spitch exceeds the maximum allowed. + * + * ::cudaMemcpy2DToArrayAsync() is asynchronous with respect to the host, so + * the call may return before the copy is complete. The copy can optionally + * be associated to a stream by passing a non-zero \p stream argument. If + * \p kind is ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToHost and + * \p stream is non-zero, the copy may overlap with operations in other + * streams. + * + * \param dst - Destination memory address + * \param wOffset - Destination starting X offset (columns in bytes) + * \param hOffset - Destination starting Y offset (rows) + * \param src - Source memory address + * \param spitch - Pitch of source memory + * \param width - Width of matrix transfer (columns in bytes) + * \param height - Height of matrix transfer (rows) + * \param kind - Type of transfer + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidPitchValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * \note_memcpy + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpy2DAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + +/** + * \brief Copies data between host and device + * + * Copies a matrix (\p height rows of \p width bytes each) from the CUDA + * array \p src starting at \p hOffset rows and \p wOffset bytes from the + * upper left corner to the memory area pointed to by \p dst, + * where \p kind specifies the direction of the copy, and must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * \p dpitch is the width in memory in bytes of the 2D + * array pointed to by \p dst, including any padding added to the end of each + * row. \p wOffset + \p width must not exceed the width of the CUDA array + * \p src. \p width must not exceed \p dpitch. ::cudaMemcpy2DFromArrayAsync() + * returns an error if \p dpitch exceeds the maximum allowed. + * + * ::cudaMemcpy2DFromArrayAsync() is asynchronous with respect to the host, so + * the call may return before the copy is complete. The copy can optionally be + * associated to a stream by passing a non-zero \p stream argument. If \p kind + * is ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToHost and \p stream is + * non-zero, the copy may overlap with operations in other streams. + * + * \param dst - Destination memory address + * \param dpitch - Pitch of destination memory + * \param src - Source memory address + * \param wOffset - Source starting X offset (columns in bytes) + * \param hOffset - Source starting Y offset (rows) + * \param width - Width of matrix transfer (columns in bytes) + * \param height - Height of matrix transfer (rows) + * \param kind - Type of transfer + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidPitchValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * \note_memcpy + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpy2DAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArrayAsync(void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + +/** + * \brief Copies data to the given symbol on the device + * + * Copies \p count bytes from the memory area pointed to by \p src + * to the memory area pointed to by \p offset bytes from the start of symbol + * \p symbol. The memory areas may not overlap. \p symbol is a variable that + * resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of transfer + * is inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * ::cudaMemcpyToSymbolAsync() is asynchronous with respect to the host, so + * the call may return before the copy is complete. The copy can optionally + * be associated to a stream by passing a non-zero \p stream argument. If + * \p kind is ::cudaMemcpyHostToDevice and \p stream is non-zero, the copy + * may overlap with operations in other streams. + * + * \param symbol - Device symbol address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorInvalidMemcpyDirection, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_async + * \note_null_stream + * \note_string_api_deprecation + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpyAsync, + * ::cuMemcpyHtoDAsync, + * ::cuMemcpyDtoDAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbolAsync(const void *symbol, const void *src, size_t count, size_t offset, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + +/** + * \brief Copies data from the given symbol on the device + * + * Copies \p count bytes from the memory area pointed to by \p offset bytes + * from the start of symbol \p symbol to the memory area pointed to by \p dst. + * The memory areas may not overlap. \p symbol is a variable that resides in + * global or constant memory space. \p kind can be either + * ::cudaMemcpyDeviceToHost, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of transfer + * is inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * ::cudaMemcpyFromSymbolAsync() is asynchronous with respect to the host, so + * the call may return before the copy is complete. The copy can optionally be + * associated to a stream by passing a non-zero \p stream argument. If \p kind + * is ::cudaMemcpyDeviceToHost and \p stream is non-zero, the copy may overlap + * with operations in other streams. + * + * \param dst - Destination memory address + * \param symbol - Device symbol address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorInvalidMemcpyDirection, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_async + * \note_null_stream + * \note_string_api_deprecation + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, + * ::cuMemcpyAsync, + * ::cuMemcpyDtoHAsync, + * ::cuMemcpyDtoDAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbolAsync(void *dst, const void *symbol, size_t count, size_t offset, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + + +/** + * \brief Initializes or sets device memory to a value + * + * Fills the first \p count bytes of the memory area pointed to by \p devPtr + * with the constant byte value \p value. + * + * Note that this function is asynchronous with respect to the host unless + * \p devPtr refers to pinned host memory. + * + * \param devPtr - Pointer to device memory + * \param value - Value to set for each byte of specified memory + * \param count - Size in bytes to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \notefnerr + * \note_memset + * \note_init_rt + * \note_callback + * + * \sa + * ::cuMemsetD8, + * ::cuMemsetD16, + * ::cuMemsetD32 + */ +extern __host__ cudaError_t CUDARTAPI cudaMemset(void *devPtr, int value, size_t count); + +/** + * \brief Initializes or sets device memory to a value + * + * Sets to the specified value \p value a matrix (\p height rows of \p width + * bytes each) pointed to by \p dstPtr. \p pitch is the width in bytes of the + * 2D array pointed to by \p dstPtr, including any padding added to the end + * of each row. This function performs fastest when the pitch is one that has + * been passed back by ::cudaMallocPitch(). + * + * Note that this function is asynchronous with respect to the host unless + * \p devPtr refers to pinned host memory. + * + * \param devPtr - Pointer to 2D device memory + * \param pitch - Pitch in bytes of 2D device memory(Unused if \p height is 1) + * \param value - Value to set for each byte of specified memory + * \param width - Width of matrix set (columns in bytes) + * \param height - Height of matrix set (rows) + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \notefnerr + * \note_memset + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemset, ::cudaMemset3D, ::cudaMemsetAsync, + * ::cudaMemset2DAsync, ::cudaMemset3DAsync, + * ::cuMemsetD2D8, + * ::cuMemsetD2D16, + * ::cuMemsetD2D32 + */ +extern __host__ cudaError_t CUDARTAPI cudaMemset2D(void *devPtr, size_t pitch, int value, size_t width, size_t height); + +/** + * \brief Initializes or sets device memory to a value + * + * Initializes each element of a 3D array to the specified value \p value. + * The object to initialize is defined by \p pitchedDevPtr. The \p pitch field + * of \p pitchedDevPtr is the width in memory in bytes of the 3D array pointed + * to by \p pitchedDevPtr, including any padding added to the end of each row. + * The \p xsize field specifies the logical width of each row in bytes, while + * the \p ysize field specifies the height of each 2D slice in rows. + * The \p pitch field of \p pitchedDevPtr is ignored when \p height and \p depth + * are both equal to 1. + * + * The extents of the initialized region are specified as a \p width in bytes, + * a \p height in rows, and a \p depth in slices. + * + * Extents with \p width greater than or equal to the \p xsize of + * \p pitchedDevPtr may perform significantly faster than extents narrower + * than the \p xsize. Secondarily, extents with \p height equal to the + * \p ysize of \p pitchedDevPtr will perform faster than when the \p height is + * shorter than the \p ysize. + * + * This function performs fastest when the \p pitchedDevPtr has been allocated + * by ::cudaMalloc3D(). + * + * Note that this function is asynchronous with respect to the host unless + * \p pitchedDevPtr refers to pinned host memory. + * + * \param pitchedDevPtr - Pointer to pitched device memory + * \param value - Value to set for each byte of specified memory + * \param extent - Size parameters for where to set device memory (\p width field in bytes) + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \notefnerr + * \note_memset + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemset, ::cudaMemset2D, + * ::cudaMemsetAsync, ::cudaMemset2DAsync, ::cudaMemset3DAsync, + * ::cudaMalloc3D, ::make_cudaPitchedPtr, + * ::make_cudaExtent + */ +extern __host__ cudaError_t CUDARTAPI cudaMemset3D(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent); + +/** + * \brief Initializes or sets device memory to a value + * + * Fills the first \p count bytes of the memory area pointed to by \p devPtr + * with the constant byte value \p value. + * + * ::cudaMemsetAsync() is asynchronous with respect to the host, so + * the call may return before the memset is complete. The operation can optionally + * be associated to a stream by passing a non-zero \p stream argument. + * If \p stream is non-zero, the operation may overlap with operations in other streams. + * + * The device version of this function only handles device to device copies and + * cannot be given local or shared pointers. + * + * \param devPtr - Pointer to device memory + * \param value - Value to set for each byte of specified memory + * \param count - Size in bytes to set + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \notefnerr + * \note_memset + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemset, ::cudaMemset2D, ::cudaMemset3D, + * ::cudaMemset2DAsync, ::cudaMemset3DAsync, + * ::cuMemsetD8Async, + * ::cuMemsetD16Async, + * ::cuMemsetD32Async + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync(void *devPtr, int value, size_t count, cudaStream_t stream __dv(0)); + +/** + * \brief Initializes or sets device memory to a value + * + * Sets to the specified value \p value a matrix (\p height rows of \p width + * bytes each) pointed to by \p dstPtr. \p pitch is the width in bytes of the + * 2D array pointed to by \p dstPtr, including any padding added to the end + * of each row. This function performs fastest when the pitch is one that has + * been passed back by ::cudaMallocPitch(). + * + * ::cudaMemset2DAsync() is asynchronous with respect to the host, so + * the call may return before the memset is complete. The operation can optionally + * be associated to a stream by passing a non-zero \p stream argument. + * If \p stream is non-zero, the operation may overlap with operations in other streams. + * + * The device version of this function only handles device to device copies and + * cannot be given local or shared pointers. + * + * \param devPtr - Pointer to 2D device memory + * \param pitch - Pitch in bytes of 2D device memory(Unused if \p height is 1) + * \param value - Value to set for each byte of specified memory + * \param width - Width of matrix set (columns in bytes) + * \param height - Height of matrix set (rows) + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \notefnerr + * \note_memset + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemset, ::cudaMemset2D, ::cudaMemset3D, + * ::cudaMemsetAsync, ::cudaMemset3DAsync, + * ::cuMemsetD2D8Async, + * ::cuMemsetD2D16Async, + * ::cuMemsetD2D32Async + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream __dv(0)); + +/** + * \brief Initializes or sets device memory to a value + * + * Initializes each element of a 3D array to the specified value \p value. + * The object to initialize is defined by \p pitchedDevPtr. The \p pitch field + * of \p pitchedDevPtr is the width in memory in bytes of the 3D array pointed + * to by \p pitchedDevPtr, including any padding added to the end of each row. + * The \p xsize field specifies the logical width of each row in bytes, while + * the \p ysize field specifies the height of each 2D slice in rows. + * The \p pitch field of \p pitchedDevPtr is ignored when \p height and \p depth + * are both equal to 1. + * + * The extents of the initialized region are specified as a \p width in bytes, + * a \p height in rows, and a \p depth in slices. + * + * Extents with \p width greater than or equal to the \p xsize of + * \p pitchedDevPtr may perform significantly faster than extents narrower + * than the \p xsize. Secondarily, extents with \p height equal to the + * \p ysize of \p pitchedDevPtr will perform faster than when the \p height is + * shorter than the \p ysize. + * + * This function performs fastest when the \p pitchedDevPtr has been allocated + * by ::cudaMalloc3D(). + * + * ::cudaMemset3DAsync() is asynchronous with respect to the host, so + * the call may return before the memset is complete. The operation can optionally + * be associated to a stream by passing a non-zero \p stream argument. + * If \p stream is non-zero, the operation may overlap with operations in other streams. + * + * The device version of this function only handles device to device copies and + * cannot be given local or shared pointers. + * + * \param pitchedDevPtr - Pointer to pitched device memory + * \param value - Value to set for each byte of specified memory + * \param extent - Size parameters for where to set device memory (\p width field in bytes) + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \notefnerr + * \note_memset + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemset, ::cudaMemset2D, ::cudaMemset3D, + * ::cudaMemsetAsync, ::cudaMemset2DAsync, + * ::cudaMalloc3D, ::make_cudaPitchedPtr, + * ::make_cudaExtent + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream __dv(0)); + +/** + * \brief Finds the address associated with a CUDA symbol + * + * Returns in \p *devPtr the address of symbol \p symbol on the device. + * \p symbol is a variable that resides in global or constant memory space. + * If \p symbol cannot be found, or if \p symbol is not declared in the + * global or constant memory space, \p *devPtr is unchanged and the error + * ::cudaErrorInvalidSymbol is returned. + * + * \param devPtr - Return device pointer associated with symbol + * \param symbol - Device symbol address + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_string_api_deprecation + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaGetSymbolAddress(void**, const T&) "cudaGetSymbolAddress (C++ API)", + * \ref ::cudaGetSymbolSize(size_t*, const void*) "cudaGetSymbolSize (C API)", + * ::cuModuleGetGlobal + */ +extern __host__ cudaError_t CUDARTAPI cudaGetSymbolAddress(void **devPtr, const void *symbol); + +/** + * \brief Finds the size of the object associated with a CUDA symbol + * + * Returns in \p *size the size of symbol \p symbol. \p symbol is a variable that + * resides in global or constant memory space. If \p symbol cannot be found, or + * if \p symbol is not declared in global or constant memory space, \p *size is + * unchanged and the error ::cudaErrorInvalidSymbol is returned. + * + * \param size - Size of object associated with symbol + * \param symbol - Device symbol address + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidSymbol, + * ::cudaErrorNoKernelImageForDevice + * \notefnerr + * \note_string_api_deprecation + * \note_init_rt + * \note_callback + * + * \sa + * \ref ::cudaGetSymbolAddress(void**, const void*) "cudaGetSymbolAddress (C API)", + * \ref ::cudaGetSymbolSize(size_t*, const T&) "cudaGetSymbolSize (C++ API)", + * ::cuModuleGetGlobal + */ +extern __host__ cudaError_t CUDARTAPI cudaGetSymbolSize(size_t *size, const void *symbol); + +/** + * \brief Prefetches memory to the specified destination device + * + * Prefetches memory to the specified destination device. \p devPtr is the + * base device pointer of the memory to be prefetched and \p dstDevice is the + * destination device. \p count specifies the number of bytes to copy. \p stream + * is the stream in which the operation is enqueued. The memory range must refer + * to managed memory allocated via ::cudaMallocManaged or declared via __managed__ variables. + * + * Passing in cudaCpuDeviceId for \p dstDevice will prefetch the data to host memory. If + * \p dstDevice is a GPU, then the device attribute ::cudaDevAttrConcurrentManagedAccess + * must be non-zero. Additionally, \p stream must be associated with a device that has a + * non-zero value for the device attribute ::cudaDevAttrConcurrentManagedAccess. + * + * The start address and end address of the memory range will be rounded down and rounded up + * respectively to be aligned to CPU page size before the prefetch operation is enqueued + * in the stream. + * + * If no physical memory has been allocated for this region, then this memory region + * will be populated and mapped on the destination device. If there's insufficient + * memory to prefetch the desired region, the Unified Memory driver may evict pages from other + * ::cudaMallocManaged allocations to host memory in order to make room. Device memory + * allocated using ::cudaMalloc or ::cudaMallocArray will not be evicted. + * + * By default, any mappings to the previous location of the migrated pages are removed and + * mappings for the new location are only setup on \p dstDevice. The exact behavior however + * also depends on the settings applied to this memory range via ::cudaMemAdvise as described + * below: + * + * If ::cudaMemAdviseSetReadMostly was set on any subset of this memory range, + * then that subset will create a read-only copy of the pages on \p dstDevice. + * + * If ::cudaMemAdviseSetPreferredLocation was called on any subset of this memory + * range, then the pages will be migrated to \p dstDevice even if \p dstDevice is not the + * preferred location of any pages in the memory range. + * + * If ::cudaMemAdviseSetAccessedBy was called on any subset of this memory range, + * then mappings to those pages from all the appropriate processors are updated to + * refer to the new location if establishing such a mapping is possible. Otherwise, + * those mappings are cleared. + * + * Note that this API is not required for functionality and only serves to improve performance + * by allowing the application to migrate data to a suitable location before it is accessed. + * Memory accesses to this range are always coherent and are allowed even when the data is + * actively being migrated. + * + * Note that this function is asynchronous with respect to the host and all work + * on other devices. + * + * \param devPtr - Pointer to be prefetched + * \param count - Size in bytes + * \param dstDevice - Destination device to prefetch to + * \param stream - Stream to enqueue prefetch operation + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpyPeer, ::cudaMemcpyAsync, + * ::cudaMemcpy3DPeerAsync, ::cudaMemAdvise, ::cudaMemAdvise_v2 + * ::cuMemPrefetchAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPrefetchAsync(const void *devPtr, size_t count, int dstDevice, cudaStream_t stream __dv(0)); + +extern __host__ cudaError_t CUDARTAPI cudaMemPrefetchAsync_v2(const void *devPtr, size_t count, struct cudaMemLocation location, unsigned int flags, cudaStream_t stream __dv(0)); + +/** + * \brief Advise about the usage of a given memory range + * + * Advise the Unified Memory subsystem about the usage pattern for the memory range + * starting at \p devPtr with a size of \p count bytes. The start address and end address of the memory + * range will be rounded down and rounded up respectively to be aligned to CPU page size before the + * advice is applied. The memory range must refer to managed memory allocated via ::cudaMallocManaged + * or declared via __managed__ variables. The memory range could also refer to system-allocated pageable + * memory provided it represents a valid, host-accessible region of memory and all additional constraints + * imposed by \p advice as outlined below are also satisfied. Specifying an invalid system-allocated pageable + * memory range results in an error being returned. + * + * The \p advice parameter can take the following values: + * - ::cudaMemAdviseSetReadMostly: This implies that the data is mostly going to be read + * from and only occasionally written to. Any read accesses from any processor to this region will create a + * read-only copy of at least the accessed pages in that processor's memory. Additionally, if ::cudaMemPrefetchAsync + * is called on this region, it will create a read-only copy of the data on the destination processor. + * If any processor writes to this region, all copies of the corresponding page will be invalidated + * except for the one where the write occurred. The \p device argument is ignored for this advice. + * Note that for a page to be read-duplicated, the accessing processor must either be the CPU or a GPU + * that has a non-zero value for the device attribute ::cudaDevAttrConcurrentManagedAccess. + * Also, if a context is created on a device that does not have the device attribute + * ::cudaDevAttrConcurrentManagedAccess set, then read-duplication will not occur until + * all such contexts are destroyed. + * If the memory region refers to valid system-allocated pageable memory, then the accessing device must + * have a non-zero value for the device attribute ::cudaDevAttrPageableMemoryAccess for a read-only + * copy to be created on that device. Note however that if the accessing device also has a non-zero value for the + * device attribute ::cudaDevAttrPageableMemoryAccessUsesHostPageTables, then setting this advice + * will not create a read-only copy when that device accesses this memory region. + * + * - ::cudaMemAdviceUnsetReadMostly: Undoes the effect of ::cudaMemAdviceReadMostly and also prevents the + * Unified Memory driver from attempting heuristic read-duplication on the memory range. Any read-duplicated + * copies of the data will be collapsed into a single copy. The location for the collapsed + * copy will be the preferred location if the page has a preferred location and one of the read-duplicated + * copies was resident at that location. Otherwise, the location chosen is arbitrary. + * + * - ::cudaMemAdviseSetPreferredLocation: This advice sets the preferred location for the + * data to be the memory belonging to \p device. Passing in cudaCpuDeviceId for \p device sets the + * preferred location as host memory. If \p device is a GPU, then it must have a non-zero value for the + * device attribute ::cudaDevAttrConcurrentManagedAccess. Setting the preferred location + * does not cause data to migrate to that location immediately. Instead, it guides the migration policy + * when a fault occurs on that memory region. If the data is already in its preferred location and the + * faulting processor can establish a mapping without requiring the data to be migrated, then + * data migration will be avoided. On the other hand, if the data is not in its preferred location + * or if a direct mapping cannot be established, then it will be migrated to the processor accessing + * it. It is important to note that setting the preferred location does not prevent data prefetching + * done using ::cudaMemPrefetchAsync. + * Having a preferred location can override the page thrash detection and resolution logic in the Unified + * Memory driver. Normally, if a page is detected to be constantly thrashing between for example host and device + * memory, the page may eventually be pinned to host memory by the Unified Memory driver. But + * if the preferred location is set as device memory, then the page will continue to thrash indefinitely. + * If ::cudaMemAdviseSetReadMostly is also set on this memory region or any subset of it, then the + * policies associated with that advice will override the policies of this advice, unless read accesses from + * \p device will not result in a read-only copy being created on that device as outlined in description for + * the advice ::cudaMemAdviseSetReadMostly. + * If the memory region refers to valid system-allocated pageable memory, then \p device must have a non-zero + * value for the device attribute ::cudaDevAttrPageableMemoryAccess. + * + * - ::cudaMemAdviseUnsetPreferredLocation: Undoes the effect of ::cudaMemAdviseSetPreferredLocation + * and changes the preferred location to none. + * + * - ::cudaMemAdviseSetAccessedBy: This advice implies that the data will be accessed by \p device. + * Passing in ::cudaCpuDeviceId for \p device will set the advice for the CPU. If \p device is a GPU, then + * the device attribute ::cudaDevAttrConcurrentManagedAccess must be non-zero. + * This advice does not cause data migration and has no impact on the location of the data per se. Instead, + * it causes the data to always be mapped in the specified processor's page tables, as long as the + * location of the data permits a mapping to be established. If the data gets migrated for any reason, + * the mappings are updated accordingly. + * This advice is recommended in scenarios where data locality is not important, but avoiding faults is. + * Consider for example a system containing multiple GPUs with peer-to-peer access enabled, where the + * data located on one GPU is occasionally accessed by peer GPUs. In such scenarios, migrating data + * over to the other GPUs is not as important because the accesses are infrequent and the overhead of + * migration may be too high. But preventing faults can still help improve performance, and so having + * a mapping set up in advance is useful. Note that on CPU access of this data, the data may be migrated + * to host memory because the CPU typically cannot access device memory directly. Any GPU that had the + * ::cudaMemAdviceSetAccessedBy flag set for this data will now have its mapping updated to point to the + * page in host memory. + * If ::cudaMemAdviseSetReadMostly is also set on this memory region or any subset of it, then the + * policies associated with that advice will override the policies of this advice. Additionally, if the + * preferred location of this memory region or any subset of it is also \p device, then the policies + * associated with ::cudaMemAdviseSetPreferredLocation will override the policies of this advice. + * If the memory region refers to valid system-allocated pageable memory, then \p device must have a non-zero + * value for the device attribute ::cudaDevAttrPageableMemoryAccess. Additionally, if \p device has + * a non-zero value for the device attribute ::cudaDevAttrPageableMemoryAccessUsesHostPageTables, + * then this call has no effect. + * + * - ::cudaMemAdviseUnsetAccessedBy: Undoes the effect of ::cudaMemAdviseSetAccessedBy. Any mappings to + * the data from \p device may be removed at any time causing accesses to result in non-fatal page faults. + * If the memory region refers to valid system-allocated pageable memory, then \p device must have a non-zero + * value for the device attribute ::cudaDevAttrPageableMemoryAccess. Additionally, if \p device has + * a non-zero value for the device attribute ::cudaDevAttrPageableMemoryAccessUsesHostPageTables, + * then this call has no effect. + * + * \param devPtr - Pointer to memory to set the advice for + * \param count - Size in bytes of the memory range + * \param advice - Advice to be applied for the specified memory range + * \param device - Device to apply the advice for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpyPeer, ::cudaMemcpyAsync, + * ::cudaMemcpy3DPeerAsync, ::cudaMemPrefetchAsync, + * ::cuMemAdvise + */ +extern __host__ cudaError_t CUDARTAPI cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, int device); + +/** + * \brief Advise about the usage of a given memory range + * + * Advise the Unified Memory subsystem about the usage pattern for the memory range + * starting at \p devPtr with a size of \p count bytes. The start address and end address of the memory + * range will be rounded down and rounded up respectively to be aligned to CPU page size before the + * advice is applied. The memory range must refer to managed memory allocated via ::cudaMemAllocManaged + * or declared via __managed__ variables. The memory range could also refer to system-allocated pageable + * memory provided it represents a valid, host-accessible region of memory and all additional constraints + * imposed by \p advice as outlined below are also satisfied. Specifying an invalid system-allocated pageable + * memory range results in an error being returned. + * + * The \p advice parameter can take the following values: + * - ::cudaMemAdviseSetReadMostly: This implies that the data is mostly going to be read + * from and only occasionally written to. Any read accesses from any processor to this region will create a + * read-only copy of at least the accessed pages in that processor's memory. Additionally, if ::cudaMemPrefetchAsync + * or ::cudaMemPrefetchAsync_v2 is called on this region, it will create a read-only copy of the data on the destination processor. + * If the target location for ::cudaMemPrefetchAsync_v2 is a host NUMA node and a read-only copy already exists on + * another host NUMA node, that copy will be migrated to the targeted host NUMA node. + * If any processor writes to this region, all copies of the corresponding page will be invalidated + * except for the one where the write occurred. If the writing processor is the CPU and the preferred location of + * the page is a host NUMA node, then the page will also be migrated to that host NUMA node. The \p location argument is ignored for this advice. + * Note that for a page to be read-duplicated, the accessing processor must either be the CPU or a GPU + * that has a non-zero value for the device attribute ::cudaDevAttrConcurrentManagedAccess. + * Also, if a context is created on a device that does not have the device attribute + * ::cudaDevAttrConcurrentManagedAccess set, then read-duplication will not occur until + * all such contexts are destroyed. + * If the memory region refers to valid system-allocated pageable memory, then the accessing device must + * have a non-zero value for the device attribute ::cudaDevAttrPageableMemoryAccess for a read-only + * copy to be created on that device. Note however that if the accessing device also has a non-zero value for the + * device attribute ::cudaDevAttrPageableMemoryAccessUsesHostPageTables, then setting this advice + * will not create a read-only copy when that device accesses this memory region. + * + * - ::cudaMemAdviceUnsetReadMostly: Undoes the effect of ::cudaMemAdviseSetReadMostly and also prevents the + * Unified Memory driver from attempting heuristic read-duplication on the memory range. Any read-duplicated + * copies of the data will be collapsed into a single copy. The location for the collapsed + * copy will be the preferred location if the page has a preferred location and one of the read-duplicated + * copies was resident at that location. Otherwise, the location chosen is arbitrary. + * Note: The \p location argument is ignored for this advice. + * + * - ::cudaMemAdviseSetPreferredLocation: This advice sets the preferred location for the + * data to be the memory belonging to \p location. When ::cudaMemLocation::type is ::cudaMemLocationTypeHost, + * ::cudaMemLocation::id is ignored and the preferred location is set to be host memory. To set the preferred location + * to a specific host NUMA node, applications must set ::cudaMemLocation::type to ::cudaMemLocationTypeHostNuma and + * ::cudaMemLocation::id must specify the NUMA ID of the host NUMA node. If ::cudaMemLocation::type is set to ::cudaMemLocationTypeHostNumaCurrent, + * ::cudaMemLocation::id will be ignored and the host NUMA node closest to the calling thread's CPU will be used as the preferred location. + * If ::cudaMemLocation::type is a ::cudaMemLocationTypeDevice, then ::cudaMemLocation::id must be a valid device ordinal + * and the device must have a non-zero value for the device attribute ::cudaDevAttrConcurrentManagedAccess. + * Setting the preferred location does not cause data to migrate to that location immediately. Instead, it guides the migration policy + * when a fault occurs on that memory region. If the data is already in its preferred location and the + * faulting processor can establish a mapping without requiring the data to be migrated, then + * data migration will be avoided. On the other hand, if the data is not in its preferred location + * or if a direct mapping cannot be established, then it will be migrated to the processor accessing + * it. It is important to note that setting the preferred location does not prevent data prefetching + * done using ::cudaMemPrefetchAsync. + * Having a preferred location can override the page thrash detection and resolution logic in the Unified + * Memory driver. Normally, if a page is detected to be constantly thrashing between for example host and device + * memory, the page may eventually be pinned to host memory by the Unified Memory driver. But + * if the preferred location is set as device memory, then the page will continue to thrash indefinitely. + * If ::cudaMemAdviseSetReadMostly is also set on this memory region or any subset of it, then the + * policies associated with that advice will override the policies of this advice, unless read accesses from + * \p location will not result in a read-only copy being created on that procesor as outlined in description for + * the advice ::cudaMemAdviseSetReadMostly. + * If the memory region refers to valid system-allocated pageable memory, and ::cudaMemLocation::type is ::cudaMemLocationTypeDevice + * then ::cudaMemLocation::id must be a valid device that has a non-zero alue for the device attribute ::cudaDevAttrPageableMemoryAccess. + * + * - ::cudaMemAdviseUnsetPreferredLocation: Undoes the effect of ::cudaMemAdviseSetPreferredLocation + * and changes the preferred location to none. The \p location argument is ignored for this advice. + * + * - ::cudaMemAdviseSetAccessedBy: This advice implies that the data will be accessed by processor \p location. + * The ::cudaMemLocation::type must be either ::cudaMemLocationTypeDevice with ::cudaMemLocation::id representing a valid device + * ordinal or ::cudaMemLocationTypeHost and ::cudaMemLocation::id will be ignored. All other location types are invalid. + * If ::cudaMemLocation::id is a GPU, then the device attribute ::cudaDevAttrConcurrentManagedAccess must be non-zero. + * This advice does not cause data migration and has no impact on the location of the data per se. Instead, + * it causes the data to always be mapped in the specified processor's page tables, as long as the + * location of the data permits a mapping to be established. If the data gets migrated for any reason, + * the mappings are updated accordingly. + * This advice is recommended in scenarios where data locality is not important, but avoiding faults is. + * Consider for example a system containing multiple GPUs with peer-to-peer access enabled, where the + * data located on one GPU is occasionally accessed by peer GPUs. In such scenarios, migrating data + * over to the other GPUs is not as important because the accesses are infrequent and the overhead of + * migration may be too high. But preventing faults can still help improve performance, and so having + * a mapping set up in advance is useful. Note that on CPU access of this data, the data may be migrated + * to host memory because the CPU typically cannot access device memory directly. Any GPU that had the + * ::cudaMemAdviseSetAccessedBy flag set for this data will now have its mapping updated to point to the + * page in host memory. + * If ::cudaMemAdviseSetReadMostly is also set on this memory region or any subset of it, then the + * policies associated with that advice will override the policies of this advice. Additionally, if the + * preferred location of this memory region or any subset of it is also \p location, then the policies + * associated with ::CU_MEM_ADVISE_SET_PREFERRED_LOCATION will override the policies of this advice. + * If the memory region refers to valid system-allocated pageable memory, and ::cudaMemLocation::type is ::cudaMemLocationTypeDevice + * then device in ::cudaMemLocation::id must have a non-zero value for the device attribute ::cudaDevAttrPageableMemoryAccess. + * Additionally, if ::cudaMemLocation::id has a non-zero value for the device attribute ::cudaDevAttrPageableMemoryAccessUsesHostPageTables, + * then this call has no effect. + * + * - ::CU_MEM_ADVISE_UNSET_ACCESSED_BY: Undoes the effect of ::cudaMemAdviseSetAccessedBy. Any mappings to + * the data from \p location may be removed at any time causing accesses to result in non-fatal page faults. + * If the memory region refers to valid system-allocated pageable memory, and ::cudaMemLocation::type is ::cudaMemLocationTypeDevice + * then device in ::cudaMemLocation::id must have a non-zero value for the device attribute ::cudaDevAttrPageableMemoryAccess. + * Additionally, if ::cudaMemLocation::id has a non-zero value for the device attribute ::cudaDevAttrPageableMemoryAccessUsesHostPageTables, + * then this call has no effect. + * + * \param devPtr - Pointer to memory to set the advice for + * \param count - Size in bytes of the memory range + * \param advice - Advice to be applied for the specified memory range + * \param location - location to apply the advice for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpyPeer, ::cudaMemcpyAsync, + * ::cudaMemcpy3DPeerAsync, ::cudaMemPrefetchAsync, + * ::cuMemAdvise, ::cuMemAdvise_v2 + */ +extern __host__ cudaError_t CUDARTAPI cudaMemAdvise_v2(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, struct cudaMemLocation location); + +/** +* \brief Query an attribute of a given memory range +* +* Query an attribute about the memory range starting at \p devPtr with a size of \p count bytes. The +* memory range must refer to managed memory allocated via ::cudaMallocManaged or declared via +* __managed__ variables. +* +* The \p attribute parameter can take the following values: +* - ::cudaMemRangeAttributeReadMostly: If this attribute is specified, \p data will be interpreted +* as a 32-bit integer, and \p dataSize must be 4. The result returned will be 1 if all pages in the given +* memory range have read-duplication enabled, or 0 otherwise. +* - ::cudaMemRangeAttributePreferredLocation: If this attribute is specified, \p data will be +* interpreted as a 32-bit integer, and \p dataSize must be 4. The result returned will be a GPU device +* id if all pages in the memory range have that GPU as their preferred location, or it will be cudaCpuDeviceId +* if all pages in the memory range have the CPU as their preferred location, or it will be cudaInvalidDeviceId +* if either all the pages don't have the same preferred location or some of the pages don't have a +* preferred location at all. Note that the actual location of the pages in the memory range at the time of +* the query may be different from the preferred location. +* - ::cudaMemRangeAttributeAccessedBy: If this attribute is specified, \p data will be interpreted +* as an array of 32-bit integers, and \p dataSize must be a non-zero multiple of 4. The result returned +* will be a list of device ids that had ::cudaMemAdviceSetAccessedBy set for that entire memory range. +* If any device does not have that advice set for the entire memory range, that device will not be included. +* If \p data is larger than the number of devices that have that advice set for that memory range, +* cudaInvalidDeviceId will be returned in all the extra space provided. For ex., if \p dataSize is 12 +* (i.e. \p data has 3 elements) and only device 0 has the advice set, then the result returned will be +* { 0, cudaInvalidDeviceId, cudaInvalidDeviceId }. If \p data is smaller than the number of devices that have +* that advice set, then only as many devices will be returned as can fit in the array. There is no +* guarantee on which specific devices will be returned, however. +* - ::cudaMemRangeAttributeLastPrefetchLocation: If this attribute is specified, \p data will be +* interpreted as a 32-bit integer, and \p dataSize must be 4. The result returned will be the last location +* to which all pages in the memory range were prefetched explicitly via ::cudaMemPrefetchAsync. This will either be +* a GPU id or cudaCpuDeviceId depending on whether the last location for prefetch was a GPU or the CPU +* respectively. If any page in the memory range was never explicitly prefetched or if all pages were not +* prefetched to the same location, cudaInvalidDeviceId will be returned. Note that this simply returns the +* last location that the applicaton requested to prefetch the memory range to. It gives no indication as to +* whether the prefetch operation to that location has completed or even begun. + * - ::cudaMemRangeAttributePreferredLocationType: If this attribute is specified, \p data will be + * interpreted as a ::cudaMemLocationType, and \p dataSize must be sizeof(cudaMemLocationType). The ::cudaMemLocationType returned will be + * ::cudaMemLocationTypeDevice if all pages in the memory range have the same GPU as their preferred location, or ::cudaMemLocationType + * will be ::cudaMemLocationTypeHost if all pages in the memory range have the CPU as their preferred location, or or it will be ::cudaMemLocationTypeHostNuma + * if all the pages in the memory range have the same host NUMA node ID as their preferred location or it will be ::cudaMemLocationTypeInvalid + * if either all the pages don't have the same preferred location or some of the pages don't have a preferred location at all. + * Note that the actual location type of the pages in the memory range at the time of the query may be different from the preferred location type. + * - ::cudaMemRangeAttributePreferredLocationId: If this attribute is specified, \p data will be + * interpreted as a 32-bit integer, and \p dataSize must be 4. If the ::cudaMemRangeAttributePreferredLocationType query for the same address range + * returns ::cudaMemLocationTypeDevice, it will be a valid device ordinal or if it returns ::cudaMemLocationTypeHostNuma, it will be a valid host NUMA node ID + * or if it returns any other location type, the id should be ignored. + * - ::cudaMemRangeAttributeLastPrefetchLocationType: If this attribute is specified, \p data will be + * interpreted as a ::cudaMemLocationType, and \p dataSize must be sizeof(cudaMemLocationType). The result returned will be the last location type + * to which all pages in the memory range were prefetched explicitly via ::cuMemPrefetchAsync. The ::cudaMemLocationType returned + * will be ::cudaMemLocationTypeDevice if the last prefetch location was the GPU or ::cudaMemLocationTypeHost if it was the CPU or ::cudaMemLocationTypeHostNuma if + * the last prefetch location was a specific host NUMA node. If any page in the memory range was never explicitly prefetched or if all pages were not + * prefetched to the same location, ::CUmemLocationType will be ::cudaMemLocationTypeInvalid. + * Note that this simply returns the last location type that the application requested to prefetch the memory range to. It gives no indication as to + * whether the prefetch operation to that location has completed or even begun. + * - ::cudaMemRangeAttributeLastPrefetchLocationId: If this attribute is specified, \p data will be + * interpreted as a 32-bit integer, and \p dataSize must be 4. If the ::cudaMemRangeAttributeLastPrefetchLocationType query for the same address range + * returns ::cudaMemLocationTypeDevice, it will be a valid device ordinal or if it returns ::cudaMemLocationTypeHostNuma, it will be a valid host NUMA node ID + * or if it returns any other location type, the id should be ignored. +* +* \param data - A pointers to a memory location where the result +* of each attribute query will be written to. +* \param dataSize - Array containing the size of data +* \param attribute - The attribute to query +* \param devPtr - Start of the range to query +* \param count - Size of the range to query + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemRangeGetAttributes, ::cudaMemPrefetchAsync, + * ::cudaMemAdvise, + * ::cuMemRangeGetAttribute + */ +extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttribute(void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, const void *devPtr, size_t count); + +/** + * \brief Query attributes of a given memory range. + * + * Query attributes of the memory range starting at \p devPtr with a size of \p count bytes. The + * memory range must refer to managed memory allocated via ::cudaMallocManaged or declared via + * __managed__ variables. The \p attributes array will be interpreted to have \p numAttributes + * entries. The \p dataSizes array will also be interpreted to have \p numAttributes entries. + * The results of the query will be stored in \p data. + * + * The list of supported attributes are given below. Please refer to ::cudaMemRangeGetAttribute for + * attribute descriptions and restrictions. + * + * - ::cudaMemRangeAttributeReadMostly + * - ::cudaMemRangeAttributePreferredLocation + * - ::cudaMemRangeAttributeAccessedBy + * - ::cudaMemRangeAttributeLastPrefetchLocation + * - :: cudaMemRangeAttributePreferredLocationType + * - :: cudaMemRangeAttributePreferredLocationId + * - :: cudaMemRangeAttributeLastPrefetchLocationType + * - :: cudaMemRangeAttributeLastPrefetchLocationId + * + * \param data - A two-dimensional array containing pointers to memory + * locations where the result of each attribute query will be written to. + * \param dataSizes - Array containing the sizes of each result + * \param attributes - An array of attributes to query + * (numAttributes and the number of attributes in this array should match) + * \param numAttributes - Number of attributes to query + * \param devPtr - Start of the range to query + * \param count - Size of the range to query + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemRangeGetAttribute, ::cudaMemAdvise, + * ::cudaMemPrefetchAsync, + * ::cuMemRangeGetAttributes + */ +extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttributes(void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, size_t numAttributes, const void *devPtr, size_t count); + +/** @} */ /* END CUDART_MEMORY */ + +/** + * \defgroup CUDART_MEMORY_DEPRECATED Memory Management [DEPRECATED] + * + * ___MANBRIEF___ deprecated memory management functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes deprecated memory management functions of the CUDA runtime + * application programming interface. + * + * Some functions have overloaded C++ API template versions documented separately in the + * \ref CUDART_HIGHLEVEL "C++ API Routines" module. + * + * @{ + */ + +/** + * \brief Copies data between host and device + * + * \deprecated + * + * Copies \p count bytes from the memory area pointed to by \p src to the + * CUDA array \p dst starting at \p hOffset rows and \p wOffset bytes from + * the upper left corner, where \p kind specifies the direction + * of the copy, and must be one of ::cudaMemcpyHostToHost, + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * \param dst - Destination memory address + * \param wOffset - Destination starting X offset (columns in bytes) + * \param hOffset - Destination starting Y offset (rows) + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_sync + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, + * ::cudaMemcpy2DToArray, ::cudaMemcpyFromArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpyArrayToArray, ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpyToArrayAsync, ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpyFromArrayAsync, ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpyHtoA, + * ::cuMemcpyDtoA + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, size_t count, enum cudaMemcpyKind kind); + +/** + * \brief Copies data between host and device + * + * \deprecated + * + * Copies \p count bytes from the CUDA array \p src starting at \p hOffset rows + * and \p wOffset bytes from the upper left corner to the memory area pointed to + * by \p dst, where \p kind specifies the direction of the copy, and must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * \param dst - Destination memory address + * \param src - Source memory address + * \param wOffset - Source starting X offset (columns in bytes) + * \param hOffset - Source starting Y offset (rows) + * \param count - Size in bytes to copy + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_sync + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, ::cudaMemcpyToArray, + * ::cudaMemcpy2DToArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpyArrayToArray, ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpyToArrayAsync, ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpyFromArrayAsync, ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpyAtoH, + * ::cuMemcpyAtoD + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, enum cudaMemcpyKind kind); + +/** + * \brief Copies data between host and device + * + * \deprecated + * + * Copies \p count bytes from the CUDA array \p src starting at \p hOffsetSrc + * rows and \p wOffsetSrc bytes from the upper left corner to the CUDA array + * \p dst starting at \p hOffsetDst rows and \p wOffsetDst bytes from the upper + * left corner, where \p kind specifies the direction of the copy, and must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * \param dst - Destination memory address + * \param wOffsetDst - Destination starting X offset (columns in bytes) + * \param hOffsetDst - Destination starting Y offset (rows) + * \param src - Source memory address + * \param wOffsetSrc - Source starting X offset (columns in bytes) + * \param hOffsetSrc - Source starting Y offset (rows) + * \param count - Size in bytes to copy + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, ::cudaMemcpyToArray, + * ::cudaMemcpy2DToArray, ::cudaMemcpyFromArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpyToArrayAsync, ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpyFromArrayAsync, ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpyAtoA + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)); + +/** + * \brief Copies data between host and device + * + * \deprecated + * + * Copies \p count bytes from the memory area pointed to by \p src to the + * CUDA array \p dst starting at \p hOffset rows and \p wOffset bytes from + * the upper left corner, where \p kind specifies the + * direction of the copy, and must be one of ::cudaMemcpyHostToHost, + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * ::cudaMemcpyToArrayAsync() is asynchronous with respect to the host, so + * the call may return before the copy is complete. The copy can optionally + * be associated to a stream by passing a non-zero \p stream argument. If \p + * kind is ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToHost and \p stream + * is non-zero, the copy may overlap with operations in other streams. + * + * \param dst - Destination memory address + * \param wOffset - Destination starting X offset (columns in bytes) + * \param hOffset - Destination starting Y offset (rows) + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param kind - Type of transfer + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, ::cudaMemcpyToArray, + * ::cudaMemcpy2DToArray, ::cudaMemcpyFromArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpyArrayToArray, ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpyFromArrayAsync, ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpyHtoAAsync, + * ::cuMemcpy2DAsync + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + +/** + * \brief Copies data between host and device + * + * \deprecated + * + * Copies \p count bytes from the CUDA array \p src starting at \p hOffset rows + * and \p wOffset bytes from the upper left corner to the memory area pointed to + * by \p dst, where \p kind specifies the direction of the copy, and must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * ::cudaMemcpyFromArrayAsync() is asynchronous with respect to the host, so + * the call may return before the copy is complete. The copy can optionally + * be associated to a stream by passing a non-zero \p stream argument. If \p + * kind is ::cudaMemcpyHostToDevice or ::cudaMemcpyDeviceToHost and \p stream + * is non-zero, the copy may overlap with operations in other streams. + * + * \param dst - Destination memory address + * \param src - Source memory address + * \param wOffset - Source starting X offset (columns in bytes) + * \param hOffset - Source starting Y offset (rows) + * \param count - Size in bytes to copy + * \param kind - Type of transfer + * \param stream - Stream identifier + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidMemcpyDirection + * \notefnerr + * \note_async + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cudaMemcpy, ::cudaMemcpy2D, ::cudaMemcpyToArray, + * ::cudaMemcpy2DToArray, ::cudaMemcpyFromArray, ::cudaMemcpy2DFromArray, + * ::cudaMemcpyArrayToArray, ::cudaMemcpy2DArrayToArray, ::cudaMemcpyToSymbol, + * ::cudaMemcpyFromSymbol, ::cudaMemcpyAsync, ::cudaMemcpy2DAsync, + * ::cudaMemcpyToArrayAsync, ::cudaMemcpy2DToArrayAsync, + * ::cudaMemcpy2DFromArrayAsync, + * ::cudaMemcpyToSymbolAsync, ::cudaMemcpyFromSymbolAsync, + * ::cuMemcpyAtoHAsync, + * ::cuMemcpy2DAsync + */ +extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyFromArrayAsync(void *dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + +/** @} */ /* END CUDART_MEMORY_DEPRECATED */ + +/** + * \defgroup CUDART_MEMORY_POOLS Stream Ordered Memory Allocator + * + * ___MANBRIEF___ Functions for performing allocation and free operations in stream order. + * Functions for controlling the behavior of the underlying allocator. + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * + * @{ + * + * \section CUDART_MEMORY_POOLS_overview overview + * + * The asynchronous allocator allows the user to allocate and free in stream order. + * All asynchronous accesses of the allocation must happen between + * the stream executions of the allocation and the free. If the memory is accessed + * outside of the promised stream order, a use before allocation / use after free error + * will cause undefined behavior. + * + * The allocator is free to reallocate the memory as long as it can guarantee + * that compliant memory accesses will not overlap temporally. + * The allocator may refer to internal stream ordering as well as inter-stream dependencies + * (such as CUDA events and null stream dependencies) when establishing the temporal guarantee. + * The allocator may also insert inter-stream dependencies to establish the temporal guarantee. + * + * \section CUDART_MEMORY_POOLS_support Supported Platforms + * + * Whether or not a device supports the integrated stream ordered memory allocator + * may be queried by calling ::cudaDeviceGetAttribute() with the device attribute + * ::cudaDevAttrMemoryPoolsSupported. + */ + +/** + * \brief Allocates memory with stream ordered semantics + * + * Inserts an allocation operation into \p hStream. + * A pointer to the allocated memory is returned immediately in *dptr. + * The allocation must not be accessed until the the allocation operation completes. + * The allocation comes from the memory pool associated with the stream's device. + * + * \note The default memory pool of a device contains device memory from that device. + * \note Basic stream ordering allows future work submitted into the same stream to use the allocation. + * Stream query, stream synchronize, and CUDA events can be used to guarantee that the allocation + * operation completes before work submitted in a separate stream runs. + * \note During stream capture, this function results in the creation of an allocation node. In this case, + * the allocation is owned by the graph instead of the memory pool. The memory pool's properties + * are used to set the node's creation parameters. + * + * \param[out] devPtr - Returned device pointer + * \param[in] size - Number of bytes to allocate + * \param[in] hStream - The stream establishing the stream ordering contract and the memory pool to allocate from + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorNotSupported, + * ::cudaErrorOutOfMemory, + * \notefnerr + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cuMemAllocAsync, + * \ref ::cudaMallocAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) "cudaMallocAsync (C++ API)", + * ::cudaMallocFromPoolAsync, ::cudaFreeAsync, ::cudaDeviceSetMemPool, ::cudaDeviceGetDefaultMemPool, ::cudaDeviceGetMemPool, ::cudaMemPoolSetAccess, ::cudaMemPoolSetAttribute, ::cudaMemPoolGetAttribute + */ +extern __host__ cudaError_t CUDARTAPI cudaMallocAsync(void **devPtr, size_t size, cudaStream_t hStream); + +/** + * \brief Frees memory with stream ordered semantics + * + * Inserts a free operation into \p hStream. + * The allocation must not be accessed after stream execution reaches the free. + * After this API returns, accessing the memory from any subsequent work launched on the GPU + * or querying its pointer attributes results in undefined behavior. + * + * \note During stream capture, this function results in the creation of a free node and + * must therefore be passed the address of a graph allocation. + * + * \param dptr - memory to free + * \param hStream - The stream establishing the stream ordering promise + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorNotSupported + * \notefnerr + * \note_null_stream + * \note_init_rt + * \note_callback + * + * \sa ::cuMemFreeAsync, ::cudaMallocAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaFreeAsync(void *devPtr, cudaStream_t hStream); + +/** + * \brief Tries to release memory back to the OS + * + * Releases memory back to the OS until the pool contains fewer than minBytesToKeep + * reserved bytes, or there is no more memory that the allocator can safely release. + * The allocator cannot release OS allocations that back outstanding asynchronous allocations. + * The OS allocations may happen at different granularity from the user allocations. + * + * \note: Allocations that have not been freed count as outstanding. + * \note: Allocations that have been asynchronously freed but whose completion has + * not been observed on the host (eg. by a synchronize) can count as outstanding. + * + * \param[in] pool - The memory pool to trim + * \param[in] minBytesToKeep - If the pool has less than minBytesToKeep reserved, + * the TrimTo operation is a no-op. Otherwise the pool will be guaranteed to have + * at least minBytesToKeep bytes reserved after the operation. + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_callback + * + * \sa ::cuMemPoolTrimTo, ::cudaMallocAsync, ::cudaFreeAsync, ::cudaDeviceGetDefaultMemPool, ::cudaDeviceGetMemPool, ::cudaMemPoolCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep); + +/** + * \brief Sets attributes of a memory pool + * + * Supported attributes are: + * - ::cudaMemPoolAttrReleaseThreshold: (value type = cuuint64_t) + * Amount of reserved memory in bytes to hold onto before trying + * to release memory back to the OS. When more than the release + * threshold bytes of memory are held by the memory pool, the + * allocator will try to release memory back to the OS on the + * next call to stream, event or context synchronize. (default 0) + * - ::cudaMemPoolReuseFollowEventDependencies: (value type = int) + * Allow ::cudaMallocAsync to use memory asynchronously freed + * in another stream as long as a stream ordering dependency + * of the allocating stream on the free action exists. + * Cuda events and null stream interactions can create the required + * stream ordered dependencies. (default enabled) + * - ::cudaMemPoolReuseAllowOpportunistic: (value type = int) + * Allow reuse of already completed frees when there is no dependency + * between the free and allocation. (default enabled) + * - ::cudaMemPoolReuseAllowInternalDependencies: (value type = int) + * Allow ::cudaMallocAsync to insert new stream dependencies + * in order to establish the stream ordering required to reuse + * a piece of memory released by ::cudaFreeAsync (default enabled). + * - ::cudaMemPoolAttrReservedMemHigh: (value type = cuuint64_t) + * Reset the high watermark that tracks the amount of backing memory that was + * allocated for the memory pool. It is illegal to set this attribute to a non-zero value. + * - ::cudaMemPoolAttrUsedMemHigh: (value type = cuuint64_t) + * Reset the high watermark that tracks the amount of used memory that was + * allocated for the memory pool. It is illegal to set this attribute to a non-zero value. + * + * \param[in] pool - The memory pool to modify + * \param[in] attr - The attribute to modify + * \param[in] value - Pointer to the value to assign + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_callback + * + * \sa ::cuMemPoolSetAttribute, ::cudaMallocAsync, ::cudaFreeAsync, ::cudaDeviceGetDefaultMemPool, ::cudaDeviceGetMemPool, ::cudaMemPoolCreate + + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolSetAttribute(cudaMemPool_t memPool, enum cudaMemPoolAttr attr, void *value ); + +/** + * \brief Gets attributes of a memory pool + * + * Supported attributes are: + * - ::cudaMemPoolAttrReleaseThreshold: (value type = cuuint64_t) + * Amount of reserved memory in bytes to hold onto before trying + * to release memory back to the OS. When more than the release + * threshold bytes of memory are held by the memory pool, the + * allocator will try to release memory back to the OS on the + * next call to stream, event or context synchronize. (default 0) + * - ::cudaMemPoolReuseFollowEventDependencies: (value type = int) + * Allow ::cudaMallocAsync to use memory asynchronously freed + * in another stream as long as a stream ordering dependency + * of the allocating stream on the free action exists. + * Cuda events and null stream interactions can create the required + * stream ordered dependencies. (default enabled) + * - ::cudaMemPoolReuseAllowOpportunistic: (value type = int) + * Allow reuse of already completed frees when there is no dependency + * between the free and allocation. (default enabled) + * - ::cudaMemPoolReuseAllowInternalDependencies: (value type = int) + * Allow ::cudaMallocAsync to insert new stream dependencies + * in order to establish the stream ordering required to reuse + * a piece of memory released by ::cudaFreeAsync (default enabled). + * - ::cudaMemPoolAttrReservedMemCurrent: (value type = cuuint64_t) + * Amount of backing memory currently allocated for the mempool. + * - ::cudaMemPoolAttrReservedMemHigh: (value type = cuuint64_t) + * High watermark of backing memory allocated for the mempool since + * the last time it was reset. + * - ::cudaMemPoolAttrUsedMemCurrent: (value type = cuuint64_t) + * Amount of memory from the pool that is currently in use by the application. + * - ::cudaMemPoolAttrUsedMemHigh: (value type = cuuint64_t) + * High watermark of the amount of memory from the pool that was in use by the + * application since the last time it was reset. + * + * \param[in] pool - The memory pool to get attributes of + * \param[in] attr - The attribute to get + * \param[in] value - Retrieved value + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_callback + * + * \sa ::cuMemPoolGetAttribute, ::cudaMallocAsync, ::cudaFreeAsync, ::cudaDeviceGetDefaultMemPool, ::cudaDeviceGetMemPool, ::cudaMemPoolCreate + + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolGetAttribute(cudaMemPool_t memPool, enum cudaMemPoolAttr attr, void *value ); + +/** + * \brief Controls visibility of pools between devices + * + * \param[in] pool - The pool being modified + * \param[in] map - Array of access descriptors. Each descriptor instructs the access to enable for a single gpu + * \param[in] count - Number of descriptors in the map array. + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * + * \sa ::cuMemPoolSetAccess, ::cudaMemPoolGetAccess, ::cudaMallocAsync, cudaFreeAsync + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolSetAccess(cudaMemPool_t memPool, const struct cudaMemAccessDesc *descList, size_t count); + +/** + * \brief Returns the accessibility of a pool from a device + * + * Returns the accessibility of the pool's memory from the specified location. + * + * \param[out] flags - the accessibility of the pool from the specified location + * \param[in] memPool - the pool being queried + * \param[in] location - the location accessing the pool + * + * \sa ::cuMemPoolGetAccess, ::cudaMemPoolSetAccess + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolGetAccess(enum cudaMemAccessFlags *flags, cudaMemPool_t memPool, struct cudaMemLocation *location); + +/** + * \brief Creates a memory pool + * + * Creates a CUDA memory pool and returns the handle in \p pool. The \p poolProps determines + * the properties of the pool such as the backing device and IPC capabilities. + * +* To create a memory pool targeting a specific host NUMA node, applications must +* set ::cudaMemPoolProps::cudaMemLocation::type to ::cudaMemLocationTypeHostNuma and +* ::cudaMemPoolProps::cudaMemLocation::id must specify the NUMA ID of the host memory node. +* By default, the pool's memory will be accessible from the device it is allocated on. + * In the case of pools created with ::cudaMemLocationTypeHostNuma, their default accessibility + * will be from the host CPU. + * Applications can control the maximum size of the pool by specifying a non-zero value for ::cudaMemPoolProps::maxSize. + * If set to 0, the maximum size of the pool will default to a system dependent value. + * + * Applications can set ::cudaMemPoolProps::handleTypes to ::cudaMemHandleTypeFabric + * in order to create ::cudaMemPool_t suitable for sharing within an IMEX domain. + * An IMEX domain is either an OS instance or a group of securely connected OS instances + * using the NVIDIA IMEX daemon. An IMEX channel is a global resource within the IMEX domain + * that represents a logical entity that aims to provide fine grained accessibility control + * for the participating processes. When exporter and importer CUDA processes have been + * granted access to the same IMEX channel, they can securely share memory. + * If the allocating process does not have access setup for an IMEX channel, attempting to export + * a ::CUmemoryPool with ::cudaMemHandleTypeFabric will result in ::cudaErrorNotPermitted. + * The nvidia-modprobe CLI provides more information regarding setting up of IMEX channels. + * + * \note Specifying cudaMemHandleTypeNone creates a memory pool that will not support IPC. + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorNotSupported + * + * \sa ::cuMemPoolCreate, ::cudaDeviceSetMemPool, ::cudaMallocFromPoolAsync, ::cudaMemPoolExportToShareableHandle, ::cudaDeviceGetDefaultMemPool, ::cudaDeviceGetMemPool + + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolCreate(cudaMemPool_t *memPool, const struct cudaMemPoolProps *poolProps); + +/** + * \brief Destroys the specified memory pool + * + * If any pointers obtained from this pool haven't been freed or + * the pool has free operations that haven't completed + * when ::cudaMemPoolDestroy is invoked, the function will return immediately and the + * resources associated with the pool will be released automatically + * once there are no more outstanding allocations. + * + * Destroying the current mempool of a device sets the default mempool of + * that device as the current mempool for that device. + * + * \note A device's default memory pool cannot be destroyed. + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * + * \sa cuMemPoolDestroy, ::cudaFreeAsync, ::cudaDeviceSetMemPool, ::cudaDeviceGetDefaultMemPool, ::cudaDeviceGetMemPool, ::cudaMemPoolCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolDestroy(cudaMemPool_t memPool); + +/** + * \brief Allocates memory from a specified pool with stream ordered semantics. + * + * Inserts an allocation operation into \p hStream. + * A pointer to the allocated memory is returned immediately in *dptr. + * The allocation must not be accessed until the the allocation operation completes. + * The allocation comes from the specified memory pool. + * + * \note + * - The specified memory pool may be from a device different than that of the specified \p hStream. + * + * - Basic stream ordering allows future work submitted into the same stream to use the allocation. + * Stream query, stream synchronize, and CUDA events can be used to guarantee that the allocation + * operation completes before work submitted in a separate stream runs. + * + * \note During stream capture, this function results in the creation of an allocation node. In this case, + * the allocation is owned by the graph instead of the memory pool. The memory pool's properties + * are used to set the node's creation parameters. + * + * \param[out] ptr - Returned device pointer + * \param[in] bytesize - Number of bytes to allocate + * \param[in] memPool - The pool to allocate from + * \param[in] stream - The stream establishing the stream ordering semantic + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorNotSupported, + * ::cudaErrorOutOfMemory + * + * \sa ::cuMemAllocFromPoolAsync, + * \ref ::cudaMallocAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) "cudaMallocAsync (C++ API)", + * ::cudaMallocAsync, ::cudaFreeAsync, ::cudaDeviceGetDefaultMemPool, ::cudaMemPoolCreate, ::cudaMemPoolSetAccess, ::cudaMemPoolSetAttribute + */ +extern __host__ cudaError_t CUDARTAPI cudaMallocFromPoolAsync(void **ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream); + +/** + * \brief Exports a memory pool to the requested handle type. + * + * Given an IPC capable mempool, create an OS handle to share the pool with another process. + * A recipient process can convert the shareable handle into a mempool with ::cudaMemPoolImportFromShareableHandle. + * Individual pointers can then be shared with the ::cudaMemPoolExportPointer and ::cudaMemPoolImportPointer APIs. + * The implementation of what the shareable handle is and how it can be transferred is defined by the requested + * handle type. + * + * \note: To create an IPC capable mempool, create a mempool with a CUmemAllocationHandleType other than cudaMemHandleTypeNone. + * + * \param[out] handle_out - pointer to the location in which to store the requested handle + * \param[in] pool - pool to export + * \param[in] handleType - the type of handle to create + * \param[in] flags - must be 0 + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorOutOfMemory + * + * \sa ::cuMemPoolExportToShareableHandle, ::cudaMemPoolImportFromShareableHandle, ::cudaMemPoolExportPointer, ::cudaMemPoolImportPointer + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolExportToShareableHandle( + void *shareableHandle, + cudaMemPool_t memPool, + enum cudaMemAllocationHandleType handleType, + unsigned int flags); + +/** + * \brief imports a memory pool from a shared handle. + * + * Specific allocations can be imported from the imported pool with ::cudaMemPoolImportPointer. + * + * \note Imported memory pools do not support creating new allocations. + * As such imported memory pools may not be used in ::cudaDeviceSetMemPool + * or ::cudaMallocFromPoolAsync calls. + * + * \param[out] pool_out - Returned memory pool + * \param[in] handle - OS handle of the pool to open + * \param[in] handleType - The type of handle being imported + * \param[in] flags - must be 0 + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorOutOfMemory + * + * \sa ::cuMemPoolImportFromShareableHandle, ::cudaMemPoolExportToShareableHandle, ::cudaMemPoolExportPointer, ::cudaMemPoolImportPointer + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolImportFromShareableHandle( + cudaMemPool_t *memPool, + void *shareableHandle, + enum cudaMemAllocationHandleType handleType, + unsigned int flags); + +/** + * \brief Export data to share a memory pool allocation between processes. + * + * Constructs \p shareData_out for sharing a specific allocation from an already shared memory pool. + * The recipient process can import the allocation with the ::cudaMemPoolImportPointer api. + * The data is not a handle and may be shared through any IPC mechanism. + * + * \param[out] shareData_out - Returned export data + * \param[in] ptr - pointer to memory being exported + * + * \returns + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorOutOfMemory + * + * \sa ::cuMemPoolExportPointer, ::cudaMemPoolExportToShareableHandle, ::cudaMemPoolImportFromShareableHandle, ::cudaMemPoolImportPointer + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolExportPointer(struct cudaMemPoolPtrExportData *exportData, void *ptr); + +/** + * \brief Import a memory pool allocation from another process. + * + * Returns in \p ptr_out a pointer to the imported memory. + * The imported memory must not be accessed before the allocation operation completes + * in the exporting process. The imported memory must be freed from all importing processes before + * being freed in the exporting process. The pointer may be freed with cudaFree + * or cudaFreeAsync. If ::cudaFreeAsync is used, the free must be completed + * on the importing process before the free operation on the exporting process. + * + * \note The ::cudaFreeAsync api may be used in the exporting process before + * the ::cudaFreeAsync operation completes in its stream as long as the + * ::cudaFreeAsync in the exporting process specifies a stream with + * a stream dependency on the importing process's ::cudaFreeAsync. + * + * \param[out] ptr_out - pointer to imported memory + * \param[in] pool - pool from which to import + * \param[in] shareData - data specifying the memory to import + * + * \returns + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_INITIALIZED, + * ::CUDA_ERROR_OUT_OF_MEMORY + * + * \sa ::cuMemPoolImportPointer, ::cudaMemPoolExportToShareableHandle, ::cudaMemPoolImportFromShareableHandle, ::cudaMemPoolExportPointer + */ +extern __host__ cudaError_t CUDARTAPI cudaMemPoolImportPointer(void **ptr, cudaMemPool_t memPool, struct cudaMemPoolPtrExportData *exportData); + +/** @} */ /* END CUDART_MEMORY_POOLS */ + +/** + * \defgroup CUDART_UNIFIED Unified Addressing + * + * ___MANBRIEF___ unified addressing functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the unified addressing functions of the CUDA + * runtime application programming interface. + * + * @{ + * + * \section CUDART_UNIFIED_overview Overview + * + * CUDA devices can share a unified address space with the host. + * For these devices there is no distinction between a device + * pointer and a host pointer -- the same pointer value may be + * used to access memory from the host program and from a kernel + * running on the device (with exceptions enumerated below). + * + * \section CUDART_UNIFIED_support Supported Platforms + * + * Whether or not a device supports unified addressing may be + * queried by calling ::cudaGetDeviceProperties() with the device + * property ::cudaDeviceProp::unifiedAddressing. + * + * Unified addressing is automatically enabled in 64-bit processes . + * + * \section CUDART_UNIFIED_lookup Looking Up Information from Pointer Values + * + * It is possible to look up information about the memory which backs a + * pointer value. For instance, one may want to know if a pointer points + * to host or device memory. As another example, in the case of device + * memory, one may want to know on which CUDA device the memory + * resides. These properties may be queried using the function + * ::cudaPointerGetAttributes() + * + * Since pointers are unique, it is not necessary to specify information + * about the pointers specified to ::cudaMemcpy() and other copy functions. + * The copy direction ::cudaMemcpyDefault may be used to specify that the + * CUDA runtime should infer the location of the pointer from its value. + * + * \section CUDART_UNIFIED_automaphost Automatic Mapping of Host Allocated Host Memory + * + * All host memory allocated through all devices using ::cudaMallocHost() and + * ::cudaHostAlloc() is always directly accessible from all devices that + * support unified addressing. This is the case regardless of whether or + * not the flags ::cudaHostAllocPortable and ::cudaHostAllocMapped are + * specified. + * + * The pointer value through which allocated host memory may be accessed + * in kernels on all devices that support unified addressing is the same + * as the pointer value through which that memory is accessed on the host. + * It is not necessary to call ::cudaHostGetDevicePointer() to get the device + * pointer for these allocations. + * + * Note that this is not the case for memory allocated using the flag + * ::cudaHostAllocWriteCombined, as discussed below. + * + * \section CUDART_UNIFIED_autopeerregister Direct Access of Peer Memory + + * Upon enabling direct access from a device that supports unified addressing + * to another peer device that supports unified addressing using + * ::cudaDeviceEnablePeerAccess() all memory allocated in the peer device using + * ::cudaMalloc() and ::cudaMallocPitch() will immediately be accessible + * by the current device. The device pointer value through + * which any peer's memory may be accessed in the current device + * is the same pointer value through which that memory may be + * accessed from the peer device. + * + * \section CUDART_UNIFIED_exceptions Exceptions, Disjoint Addressing + * + * Not all memory may be accessed on devices through the same pointer + * value through which they are accessed on the host. These exceptions + * are host memory registered using ::cudaHostRegister() and host memory + * allocated using the flag ::cudaHostAllocWriteCombined. For these + * exceptions, there exists a distinct host and device address for the + * memory. The device address is guaranteed to not overlap any valid host + * pointer range and is guaranteed to have the same value across all devices + * that support unified addressing. + * + * This device address may be queried using ::cudaHostGetDevicePointer() + * when a device using unified addressing is current. Either the host + * or the unified device pointer value may be used to refer to this memory + * in ::cudaMemcpy() and similar functions using the ::cudaMemcpyDefault + * memory direction. + * + */ + +/** + * \brief Returns attributes about a specified pointer + * + * Returns in \p *attributes the attributes of the pointer \p ptr. + * If pointer was not allocated in, mapped by or registered with context + * supporting unified addressing ::cudaErrorInvalidValue is returned. + * + * \note In CUDA 11.0 forward passing host pointer will return ::cudaMemoryTypeUnregistered + * in ::cudaPointerAttributes::type and call will return ::cudaSuccess. + * + * The ::cudaPointerAttributes structure is defined as: + * \code + struct cudaPointerAttributes { + enum cudaMemoryType type; + int device; + void *devicePointer; + void *hostPointer; + } + \endcode + * In this structure, the individual fields mean + * + * - \ref ::cudaPointerAttributes::type identifies type of memory. It can be + * ::cudaMemoryTypeUnregistered for unregistered host memory, + * ::cudaMemoryTypeHost for registered host memory, ::cudaMemoryTypeDevice for device + * memory or ::cudaMemoryTypeManaged for managed memory. + * + * - \ref ::cudaPointerAttributes::device "device" is the device against which + * \p ptr was allocated. If \p ptr has memory type ::cudaMemoryTypeDevice + * then this identifies the device on which the memory referred to by \p ptr + * physically resides. If \p ptr has memory type ::cudaMemoryTypeHost then this + * identifies the device which was current when the allocation was made + * (and if that device is deinitialized then this allocation will vanish + * with that device's state). + * + * - \ref ::cudaPointerAttributes::devicePointer "devicePointer" is + * the device pointer alias through which the memory referred to by \p ptr + * may be accessed on the current device. + * If the memory referred to by \p ptr cannot be accessed directly by the + * current device then this is NULL. + * + * - \ref ::cudaPointerAttributes::hostPointer "hostPointer" is + * the host pointer alias through which the memory referred to by \p ptr + * may be accessed on the host. + * If the memory referred to by \p ptr cannot be accessed directly by the + * host then this is NULL. + * + * \param attributes - Attributes for the specified pointer + * \param ptr - Pointer to get attributes for + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa ::cudaGetDeviceCount, ::cudaGetDevice, ::cudaSetDevice, + * ::cudaChooseDevice, + * ::cudaInitDevice, + * ::cuPointerGetAttributes + */ +extern __host__ cudaError_t CUDARTAPI cudaPointerGetAttributes(struct cudaPointerAttributes *attributes, const void *ptr); + +/** @} */ /* END CUDART_UNIFIED */ + +/** + * \defgroup CUDART_PEER Peer Device Memory Access + * + * ___MANBRIEF___ peer device memory access functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the peer device memory access functions of the CUDA runtime + * application programming interface. + * + * @{ + */ + +/** + * \brief Queries if a device may directly access a peer device's memory. + * + * Returns in \p *canAccessPeer a value of 1 if device \p device is capable of + * directly accessing memory from \p peerDevice and 0 otherwise. If direct + * access of \p peerDevice from \p device is possible, then access may be + * enabled by calling ::cudaDeviceEnablePeerAccess(). + * + * \param canAccessPeer - Returned access capability + * \param device - Device from which allocations on \p peerDevice are to + * be directly accessed. + * \param peerDevice - Device on which the allocations to be directly accessed + * by \p device reside. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceEnablePeerAccess, + * ::cudaDeviceDisablePeerAccess, + * ::cuDeviceCanAccessPeer + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice); + +/** + * \brief Enables direct access to memory allocations on a peer device. + * + * On success, all allocations from \p peerDevice will immediately be accessible by + * the current device. They will remain accessible until access is explicitly + * disabled using ::cudaDeviceDisablePeerAccess() or either device is reset using + * ::cudaDeviceReset(). + * + * Note that access granted by this call is unidirectional and that in order to access + * memory on the current device from \p peerDevice, a separate symmetric call + * to ::cudaDeviceEnablePeerAccess() is required. + * + * Note that there are both device-wide and system-wide limitations per system + * configuration, as noted in the CUDA Programming Guide under the section + * "Peer-to-Peer Memory Access". + * + * Returns ::cudaErrorInvalidDevice if ::cudaDeviceCanAccessPeer() indicates + * that the current device cannot directly access memory from \p peerDevice. + * + * Returns ::cudaErrorPeerAccessAlreadyEnabled if direct access of + * \p peerDevice from the current device has already been enabled. + * + * Returns ::cudaErrorInvalidValue if \p flags is not 0. + * + * \param peerDevice - Peer device to enable direct access to from the current device + * \param flags - Reserved for future use and must be set to 0 + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice, + * ::cudaErrorPeerAccessAlreadyEnabled, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceCanAccessPeer, + * ::cudaDeviceDisablePeerAccess, + * ::cuCtxEnablePeerAccess + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags); + +/** + * \brief Disables direct access to memory allocations on a peer device. + * + * Returns ::cudaErrorPeerAccessNotEnabled if direct access to memory on + * \p peerDevice has not yet been enabled from the current device. + * + * \param peerDevice - Peer device to disable direct access to + * + * \return + * ::cudaSuccess, + * ::cudaErrorPeerAccessNotEnabled, + * ::cudaErrorInvalidDevice + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa ::cudaDeviceCanAccessPeer, + * ::cudaDeviceEnablePeerAccess, + * ::cuCtxDisablePeerAccess + */ +extern __host__ cudaError_t CUDARTAPI cudaDeviceDisablePeerAccess(int peerDevice); + +/** @} */ /* END CUDART_PEER */ + +/** \defgroup CUDART_OPENGL OpenGL Interoperability */ + +/** \defgroup CUDART_OPENGL_DEPRECATED OpenGL Interoperability [DEPRECATED] */ + +/** \defgroup CUDART_D3D9 Direct3D 9 Interoperability */ + +/** \defgroup CUDART_D3D9_DEPRECATED Direct3D 9 Interoperability [DEPRECATED] */ + +/** \defgroup CUDART_D3D10 Direct3D 10 Interoperability */ + +/** \defgroup CUDART_D3D10_DEPRECATED Direct3D 10 Interoperability [DEPRECATED] */ + +/** \defgroup CUDART_D3D11 Direct3D 11 Interoperability */ + +/** \defgroup CUDART_D3D11_DEPRECATED Direct3D 11 Interoperability [DEPRECATED] */ + +/** \defgroup CUDART_VDPAU VDPAU Interoperability */ + +/** \defgroup CUDART_EGL EGL Interoperability */ + +/** + * \defgroup CUDART_INTEROP Graphics Interoperability + * + * ___MANBRIEF___ graphics interoperability functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the graphics interoperability functions of the CUDA + * runtime application programming interface. + * + * @{ + */ + +/** + * \brief Unregisters a graphics resource for access by CUDA + * + * Unregisters the graphics resource \p resource so it is not accessible by + * CUDA unless registered again. + * + * If \p resource is invalid then ::cudaErrorInvalidResourceHandle is + * returned. + * + * \param resource - Resource to unregister + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * \note_init_rt + * \note_callback + * \note_destroy_ub + * + * \sa + * ::cudaGraphicsD3D9RegisterResource, + * ::cudaGraphicsD3D10RegisterResource, + * ::cudaGraphicsD3D11RegisterResource, + * ::cudaGraphicsGLRegisterBuffer, + * ::cudaGraphicsGLRegisterImage, + * ::cuGraphicsUnregisterResource + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource); + +/** + * \brief Set usage flags for mapping a graphics resource + * + * Set \p flags for mapping the graphics resource \p resource. + * + * Changes to \p flags will take effect the next time \p resource is mapped. + * The \p flags argument may be any of the following: + * - ::cudaGraphicsMapFlagsNone: Specifies no hints about how \p resource will + * be used. It is therefore assumed that CUDA may read from or write to \p resource. + * - ::cudaGraphicsMapFlagsReadOnly: Specifies that CUDA will not write to \p resource. + * - ::cudaGraphicsMapFlagsWriteDiscard: Specifies CUDA will not read from \p resource and will + * write over the entire contents of \p resource, so none of the data + * previously stored in \p resource will be preserved. + * + * If \p resource is presently mapped for access by CUDA then ::cudaErrorUnknown is returned. + * If \p flags is not one of the above values then ::cudaErrorInvalidValue is returned. + * + * \param resource - Registered resource to set flags for + * \param flags - Parameters for resource mapping + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown, + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphicsMapResources, + * ::cuGraphicsResourceSetMapFlags + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags); + +/** + * \brief Map graphics resources for access by CUDA + * + * Maps the \p count graphics resources in \p resources for access by CUDA. + * + * The resources in \p resources may be accessed by CUDA until they + * are unmapped. The graphics API from which \p resources were registered + * should not access any resources while they are mapped by CUDA. If an + * application does so, the results are undefined. + * + * This function provides the synchronization guarantee that any graphics calls + * issued before ::cudaGraphicsMapResources() will complete before any subsequent CUDA + * work issued in \p stream begins. + * + * If \p resources contains any duplicate entries then ::cudaErrorInvalidResourceHandle + * is returned. If any of \p resources are presently mapped for access by + * CUDA then ::cudaErrorUnknown is returned. + * + * \param count - Number of resources to map + * \param resources - Resources to map for CUDA + * \param stream - Stream for synchronization + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphicsResourceGetMappedPointer, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cudaGraphicsUnmapResources, + * ::cuGraphicsMapResources + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsMapResources(int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)); + +/** + * \brief Unmap graphics resources. + * + * Unmaps the \p count graphics resources in \p resources. + * + * Once unmapped, the resources in \p resources may not be accessed by CUDA + * until they are mapped again. + * + * This function provides the synchronization guarantee that any CUDA work issued + * in \p stream before ::cudaGraphicsUnmapResources() will complete before any + * subsequently issued graphics work begins. + * + * If \p resources contains any duplicate entries then ::cudaErrorInvalidResourceHandle + * is returned. If any of \p resources are not presently mapped for access by + * CUDA then ::cudaErrorUnknown is returned. + * + * \param count - Number of resources to unmap + * \param resources - Resources to unmap + * \param stream - Stream for synchronization + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \note_null_stream + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphicsMapResources, + * ::cuGraphicsUnmapResources + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)); + +/** + * \brief Get an device pointer through which to access a mapped graphics resource. + * + * Returns in \p *devPtr a pointer through which the mapped graphics resource + * \p resource may be accessed. + * Returns in \p *size the size of the memory in bytes which may be accessed from that pointer. + * The value set in \p devPtr may change every time that \p resource is mapped. + * + * If \p resource is not a buffer then it cannot be accessed via a pointer and + * ::cudaErrorUnknown is returned. + * If \p resource is not mapped then ::cudaErrorUnknown is returned. + * * + * \param devPtr - Returned pointer through which \p resource may be accessed + * \param size - Returned size of the buffer accessible starting at \p *devPtr + * \param resource - Mapped resource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphicsMapResources, + * ::cudaGraphicsSubResourceGetMappedArray, + * ::cuGraphicsResourceGetMappedPointer + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedPointer(void **devPtr, size_t *size, cudaGraphicsResource_t resource); + +/** + * \brief Get an array through which to access a subresource of a mapped graphics resource. + * + * Returns in \p *array an array through which the subresource of the mapped + * graphics resource \p resource which corresponds to array index \p arrayIndex + * and mipmap level \p mipLevel may be accessed. The value set in \p array may + * change every time that \p resource is mapped. + * + * If \p resource is not a texture then it cannot be accessed via an array and + * ::cudaErrorUnknown is returned. + * If \p arrayIndex is not a valid array index for \p resource then + * ::cudaErrorInvalidValue is returned. + * If \p mipLevel is not a valid mipmap level for \p resource then + * ::cudaErrorInvalidValue is returned. + * If \p resource is not mapped then ::cudaErrorUnknown is returned. + * + * \param array - Returned array through which a subresource of \p resource may be accessed + * \param resource - Mapped resource to access + * \param arrayIndex - Array index for array textures or cubemap face + * index as defined by ::cudaGraphicsCubeFace for + * cubemap textures for the subresource to access + * \param mipLevel - Mipmap level for the subresource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuGraphicsSubResourceGetMappedArray + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsSubResourceGetMappedArray(cudaArray_t *array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel); + +/** + * \brief Get a mipmapped array through which to access a mapped graphics resource. + * + * Returns in \p *mipmappedArray a mipmapped array through which the mapped + * graphics resource \p resource may be accessed. The value set in \p mipmappedArray may + * change every time that \p resource is mapped. + * + * If \p resource is not a texture then it cannot be accessed via an array and + * ::cudaErrorUnknown is returned. + * If \p resource is not mapped then ::cudaErrorUnknown is returned. + * + * \param mipmappedArray - Returned mipmapped array through which \p resource may be accessed + * \param resource - Mapped resource to access + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorUnknown + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphicsResourceGetMappedPointer, + * ::cuGraphicsResourceGetMappedMipmappedArray + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t *mipmappedArray, cudaGraphicsResource_t resource); + +/** @} */ /* END CUDART_INTEROP */ + +/** + * \defgroup CUDART_TEXTURE_OBJECT Texture Object Management + * + * ___MANBRIEF___ texture object management functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the low level texture object management functions + * of the CUDA runtime application programming interface. The texture + * object API is only supported on devices of compute capability 3.0 or higher. + * + * @{ + */ + +/** + * \brief Get the channel descriptor of an array + * + * Returns in \p *desc the channel descriptor of the CUDA array \p array. + * + * \param desc - Channel format + * \param array - Memory array on device + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa \ref ::cudaCreateChannelDesc(int, int, int, int, cudaChannelFormatKind) "cudaCreateChannelDesc (C API)", + * ::cudaCreateTextureObject, ::cudaCreateSurfaceObject + */ +extern __host__ cudaError_t CUDARTAPI cudaGetChannelDesc(struct cudaChannelFormatDesc *desc, cudaArray_const_t array); + +/** + * \brief Returns a channel descriptor using the specified format + * + * Returns a channel descriptor with format \p f and number of bits of each + * component \p x, \p y, \p z, and \p w. The ::cudaChannelFormatDesc is + * defined as: + * \code + struct cudaChannelFormatDesc { + int x, y, z, w; + enum cudaChannelFormatKind f; + }; + * \endcode + * + * where ::cudaChannelFormatKind is one of ::cudaChannelFormatKindSigned, + * ::cudaChannelFormatKindUnsigned, or ::cudaChannelFormatKindFloat. + * + * \param x - X component + * \param y - Y component + * \param z - Z component + * \param w - W component + * \param f - Channel format + * + * \return + * Channel descriptor with format \p f + * + * \sa \ref ::cudaCreateChannelDesc(void) "cudaCreateChannelDesc (C++ API)", + * ::cudaGetChannelDesc, ::cudaCreateTextureObject, ::cudaCreateSurfaceObject + */ +extern __host__ struct cudaChannelFormatDesc CUDARTAPI cudaCreateChannelDesc(int x, int y, int z, int w, enum cudaChannelFormatKind f); + +/** + * \brief Creates a texture object + * + * Creates a texture object and returns it in \p pTexObject. \p pResDesc describes + * the data to texture from. \p pTexDesc describes how the data should be sampled. + * \p pResViewDesc is an optional argument that specifies an alternate format for + * the data described by \p pResDesc, and also describes the subresource region + * to restrict access to when texturing. \p pResViewDesc can only be specified if + * the type of resource is a CUDA array or a CUDA mipmapped array. + * + * Texture objects are only supported on devices of compute capability 3.0 or higher. + * Additionally, a texture object is an opaque value, and, as such, should only be + * accessed through CUDA API calls. + * + * The ::cudaResourceDesc structure is defined as: + * \code + struct cudaResourceDesc { + enum cudaResourceType resType; + + union { + struct { + cudaArray_t array; + } array; + struct { + cudaMipmappedArray_t mipmap; + } mipmap; + struct { + void *devPtr; + struct cudaChannelFormatDesc desc; + size_t sizeInBytes; + } linear; + struct { + void *devPtr; + struct cudaChannelFormatDesc desc; + size_t width; + size_t height; + size_t pitchInBytes; + } pitch2D; + } res; + }; + * \endcode + * where: + * - ::cudaResourceDesc::resType specifies the type of resource to texture from. + * CUresourceType is defined as: + * \code + enum cudaResourceType { + cudaResourceTypeArray = 0x00, + cudaResourceTypeMipmappedArray = 0x01, + cudaResourceTypeLinear = 0x02, + cudaResourceTypePitch2D = 0x03 + }; + * \endcode + * + * \par + * If ::cudaResourceDesc::resType is set to ::cudaResourceTypeArray, ::cudaResourceDesc::res::array::array + * must be set to a valid CUDA array handle. + * + * \par + * If ::cudaResourceDesc::resType is set to ::cudaResourceTypeMipmappedArray, ::cudaResourceDesc::res::mipmap::mipmap + * must be set to a valid CUDA mipmapped array handle and ::cudaTextureDesc::normalizedCoords must be set to true. + * + * \par + * If ::cudaResourceDesc::resType is set to ::cudaResourceTypeLinear, ::cudaResourceDesc::res::linear::devPtr + * must be set to a valid device pointer, that is aligned to ::cudaDeviceProp::textureAlignment. + * ::cudaResourceDesc::res::linear::desc describes the format and the number of components per array element. ::cudaResourceDesc::res::linear::sizeInBytes + * specifies the size of the array in bytes. The total number of elements in the linear address range cannot exceed + * ::cudaDeviceProp::maxTexture1DLinear. The number of elements is computed as (sizeInBytes / sizeof(desc)). + * + * \par + * If ::cudaResourceDesc::resType is set to ::cudaResourceTypePitch2D, ::cudaResourceDesc::res::pitch2D::devPtr + * must be set to a valid device pointer, that is aligned to ::cudaDeviceProp::textureAlignment. + * ::cudaResourceDesc::res::pitch2D::desc describes the format and the number of components per array element. ::cudaResourceDesc::res::pitch2D::width + * and ::cudaResourceDesc::res::pitch2D::height specify the width and height of the array in elements, and cannot exceed + * ::cudaDeviceProp::maxTexture2DLinear[0] and ::cudaDeviceProp::maxTexture2DLinear[1] respectively. + * ::cudaResourceDesc::res::pitch2D::pitchInBytes specifies the pitch between two rows in bytes and has to be aligned to + * ::cudaDeviceProp::texturePitchAlignment. Pitch cannot exceed ::cudaDeviceProp::maxTexture2DLinear[2]. + * + * + * The ::cudaTextureDesc struct is defined as + * \code + struct cudaTextureDesc { + enum cudaTextureAddressMode addressMode[3]; + enum cudaTextureFilterMode filterMode; + enum cudaTextureReadMode readMode; + int sRGB; + float borderColor[4]; + int normalizedCoords; + unsigned int maxAnisotropy; + enum cudaTextureFilterMode mipmapFilterMode; + float mipmapLevelBias; + float minMipmapLevelClamp; + float maxMipmapLevelClamp; + int disableTrilinearOptimization; + int seamlessCubemap; + }; + * \endcode + * where + * - ::cudaTextureDesc::addressMode specifies the addressing mode for each dimension of the texture data. ::cudaTextureAddressMode is defined as: + * \code + enum cudaTextureAddressMode { + cudaAddressModeWrap = 0, + cudaAddressModeClamp = 1, + cudaAddressModeMirror = 2, + cudaAddressModeBorder = 3 + }; + * \endcode + * This is ignored if ::cudaResourceDesc::resType is ::cudaResourceTypeLinear. Also, if ::cudaTextureDesc::normalizedCoords + * is set to zero, ::cudaAddressModeWrap and ::cudaAddressModeMirror won't be supported and will be switched to ::cudaAddressModeClamp. + * + * - ::cudaTextureDesc::filterMode specifies the filtering mode to be used when fetching from the texture. ::cudaTextureFilterMode is defined as: + * \code + enum cudaTextureFilterMode { + cudaFilterModePoint = 0, + cudaFilterModeLinear = 1 + }; + * \endcode + * This is ignored if ::cudaResourceDesc::resType is ::cudaResourceTypeLinear. + * + * - ::cudaTextureDesc::readMode specifies whether integer data should be converted to floating point or not. ::cudaTextureReadMode is defined as: + * \code + enum cudaTextureReadMode { + cudaReadModeElementType = 0, + cudaReadModeNormalizedFloat = 1 + }; + * \endcode + * Note that this applies only to 8-bit and 16-bit integer formats. 32-bit integer format would not be promoted, regardless of + * whether or not this ::cudaTextureDesc::readMode is set ::cudaReadModeNormalizedFloat is specified. + * + * - ::cudaTextureDesc::sRGB specifies whether sRGB to linear conversion should be performed during texture fetch. + * + * - ::cudaTextureDesc::borderColor specifies the float values of color. where: + * ::cudaTextureDesc::borderColor[0] contains value of 'R', + * ::cudaTextureDesc::borderColor[1] contains value of 'G', + * ::cudaTextureDesc::borderColor[2] contains value of 'B', + * ::cudaTextureDesc::borderColor[3] contains value of 'A' + * Note that application using integer border color values will need to these values to float. + * The values are set only when the addressing mode specified by ::cudaTextureDesc::addressMode is cudaAddressModeBorder. + * + * - ::cudaTextureDesc::normalizedCoords specifies whether the texture coordinates will be normalized or not. + * + * - ::cudaTextureDesc::maxAnisotropy specifies the maximum anistropy ratio to be used when doing anisotropic filtering. This value will be + * clamped to the range [1,16]. + * + * - ::cudaTextureDesc::mipmapFilterMode specifies the filter mode when the calculated mipmap level lies between two defined mipmap levels. + * + * - ::cudaTextureDesc::mipmapLevelBias specifies the offset to be applied to the calculated mipmap level. + * + * - ::cudaTextureDesc::minMipmapLevelClamp specifies the lower end of the mipmap level range to clamp access to. + * + * - ::cudaTextureDesc::maxMipmapLevelClamp specifies the upper end of the mipmap level range to clamp access to. + * + * - ::cudaTextureDesc::disableTrilinearOptimization specifies whether the trilinear filtering optimizations will be disabled. + * + * - ::cudaTextureDesc::seamlessCubemap specifies whether seamless cube map filtering is enabled. This flag can only be specified if the + * underlying resource is a CUDA array or a CUDA mipmapped array that was created with the flag ::cudaArrayCubemap. + * When seamless cube map filtering is enabled, texture address modes specified by ::cudaTextureDesc::addressMode are ignored. + * Instead, if the ::cudaTextureDesc::filterMode is set to ::cudaFilterModePoint the address mode ::cudaAddressModeClamp will be applied for all dimensions. + * If the ::cudaTextureDesc::filterMode is set to ::cudaFilterModeLinear seamless cube map filtering will be performed when sampling along the cube face borders. + * + * The ::cudaResourceViewDesc struct is defined as + * \code + struct cudaResourceViewDesc { + enum cudaResourceViewFormat format; + size_t width; + size_t height; + size_t depth; + unsigned int firstMipmapLevel; + unsigned int lastMipmapLevel; + unsigned int firstLayer; + unsigned int lastLayer; + }; + * \endcode + * where: + * - ::cudaResourceViewDesc::format specifies how the data contained in the CUDA array or CUDA mipmapped array should + * be interpreted. Note that this can incur a change in size of the texture data. If the resource view format is a block + * compressed format, then the underlying CUDA array or CUDA mipmapped array has to have a 32-bit unsigned integer format + * with 2 or 4 channels, depending on the block compressed format. For ex., BC1 and BC4 require the underlying CUDA array to have + * a 32-bit unsigned int with 2 channels. The other BC formats require the underlying resource to have the same 32-bit unsigned int + * format but with 4 channels. + * + * - ::cudaResourceViewDesc::width specifies the new width of the texture data. If the resource view format is a block + * compressed format, this value has to be 4 times the original width of the resource. For non block compressed formats, + * this value has to be equal to that of the original resource. + * + * - ::cudaResourceViewDesc::height specifies the new height of the texture data. If the resource view format is a block + * compressed format, this value has to be 4 times the original height of the resource. For non block compressed formats, + * this value has to be equal to that of the original resource. + * + * - ::cudaResourceViewDesc::depth specifies the new depth of the texture data. This value has to be equal to that of the + * original resource. + * + * - ::cudaResourceViewDesc::firstMipmapLevel specifies the most detailed mipmap level. This will be the new mipmap level zero. + * For non-mipmapped resources, this value has to be zero.::cudaTextureDesc::minMipmapLevelClamp and ::cudaTextureDesc::maxMipmapLevelClamp + * will be relative to this value. For ex., if the firstMipmapLevel is set to 2, and a minMipmapLevelClamp of 1.2 is specified, + * then the actual minimum mipmap level clamp will be 3.2. + * + * - ::cudaResourceViewDesc::lastMipmapLevel specifies the least detailed mipmap level. For non-mipmapped resources, this value + * has to be zero. + * + * - ::cudaResourceViewDesc::firstLayer specifies the first layer index for layered textures. This will be the new layer zero. + * For non-layered resources, this value has to be zero. + * + * - ::cudaResourceViewDesc::lastLayer specifies the last layer index for layered textures. For non-layered resources, + * this value has to be zero. + * + * + * \param pTexObject - Texture object to create + * \param pResDesc - Resource descriptor + * \param pTexDesc - Texture descriptor + * \param pResViewDesc - Resource view descriptor + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaDestroyTextureObject, + * ::cuTexObjectCreate + */ + +extern __host__ cudaError_t CUDARTAPI cudaCreateTextureObject(cudaTextureObject_t *pTexObject, const struct cudaResourceDesc *pResDesc, const struct cudaTextureDesc *pTexDesc, const struct cudaResourceViewDesc *pResViewDesc); + +/** + * \brief Destroys a texture object + * + * Destroys the texture object specified by \p texObject. + * + * \param texObject - Texture object to destroy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * \note_destroy_ub + * + * \sa + * ::cudaCreateTextureObject, + * ::cuTexObjectDestroy + */ +extern __host__ cudaError_t CUDARTAPI cudaDestroyTextureObject(cudaTextureObject_t texObject); + +/** + * \brief Returns a texture object's resource descriptor + * + * Returns the resource descriptor for the texture object specified by \p texObject. + * + * \param pResDesc - Resource descriptor + * \param texObject - Texture object + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaCreateTextureObject, + * ::cuTexObjectGetResourceDesc + */ +extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceDesc(struct cudaResourceDesc *pResDesc, cudaTextureObject_t texObject); + +/** + * \brief Returns a texture object's texture descriptor + * + * Returns the texture descriptor for the texture object specified by \p texObject. + * + * \param pTexDesc - Texture descriptor + * \param texObject - Texture object + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaCreateTextureObject, + * ::cuTexObjectGetTextureDesc + */ +extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectTextureDesc(struct cudaTextureDesc *pTexDesc, cudaTextureObject_t texObject); + +/** + * \brief Returns a texture object's resource view descriptor + * + * Returns the resource view descriptor for the texture object specified by \p texObject. + * If no resource view was specified, ::cudaErrorInvalidValue is returned. + * + * \param pResViewDesc - Resource view descriptor + * \param texObject - Texture object + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaCreateTextureObject, + * ::cuTexObjectGetResourceViewDesc + */ +extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceViewDesc(struct cudaResourceViewDesc *pResViewDesc, cudaTextureObject_t texObject); + +/** @} */ /* END CUDART_TEXTURE_OBJECT */ + +/** + * \defgroup CUDART_SURFACE_OBJECT Surface Object Management + * + * ___MANBRIEF___ surface object management functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the low level texture object management functions + * of the CUDA runtime application programming interface. The surface object + * API is only supported on devices of compute capability 3.0 or higher. + * + * @{ + */ + +/** + * \brief Creates a surface object + * + * Creates a surface object and returns it in \p pSurfObject. \p pResDesc describes + * the data to perform surface load/stores on. ::cudaResourceDesc::resType must be + * ::cudaResourceTypeArray and ::cudaResourceDesc::res::array::array + * must be set to a valid CUDA array handle. + * + * Surface objects are only supported on devices of compute capability 3.0 or higher. + * Additionally, a surface object is an opaque value, and, as such, should only be + * accessed through CUDA API calls. + * + * \param pSurfObject - Surface object to create + * \param pResDesc - Resource descriptor + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidChannelDescriptor, + * ::cudaErrorInvalidResourceHandle + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaDestroySurfaceObject, + * ::cuSurfObjectCreate + */ + +extern __host__ cudaError_t CUDARTAPI cudaCreateSurfaceObject(cudaSurfaceObject_t *pSurfObject, const struct cudaResourceDesc *pResDesc); + +/** + * \brief Destroys a surface object + * + * Destroys the surface object specified by \p surfObject. + * + * \param surfObject - Surface object to destroy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * \note_destroy_ub + * + * \sa + * ::cudaCreateSurfaceObject, + * ::cuSurfObjectDestroy + */ +extern __host__ cudaError_t CUDARTAPI cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject); + +/** + * \brief Returns a surface object's resource descriptor + * Returns the resource descriptor for the surface object specified by \p surfObject. + * + * \param pResDesc - Resource descriptor + * \param surfObject - Surface object + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaCreateSurfaceObject, + * ::cuSurfObjectGetResourceDesc + */ +extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceObjectResourceDesc(struct cudaResourceDesc *pResDesc, cudaSurfaceObject_t surfObject); + +/** @} */ /* END CUDART_SURFACE_OBJECT */ + +/** + * \defgroup CUDART__VERSION Version Management + * + * @{ + */ + +/** + * \brief Returns the latest version of CUDA supported by the driver + * + * Returns in \p *driverVersion the latest version of CUDA supported by + * the driver. The version is returned as (1000 × major + 10 × minor). + * For example, CUDA 9.2 would be represented by 9020. If no driver is installed, + * then 0 is returned as the driver version. + * + * This function automatically returns ::cudaErrorInvalidValue + * if \p driverVersion is NULL. + * + * \param driverVersion - Returns the CUDA driver version. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaRuntimeGetVersion, + * ::cuDriverGetVersion + */ +extern __host__ cudaError_t CUDARTAPI cudaDriverGetVersion(int *driverVersion); + +/** + * \brief Returns the CUDA Runtime version + * + * Returns in \p *runtimeVersion the version number of the current CUDA + * Runtime instance. The version is returned as + * (1000 × major + 10 × minor). For example, + * CUDA 9.2 would be represented by 9020. + * + * As of CUDA 12.0, this function no longer initializes CUDA. The purpose + * of this API is solely to return a compile-time constant stating the + * CUDA Toolkit version in the above format. + * + * This function automatically returns ::cudaErrorInvalidValue if + * the \p runtimeVersion argument is NULL. + * + * \param runtimeVersion - Returns the CUDA Runtime version. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaDriverGetVersion, + * ::cuDriverGetVersion + */ +extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaRuntimeGetVersion(int *runtimeVersion); + +/** @} */ /* END CUDART__VERSION */ + +/** + * \defgroup CUDART_GRAPH Graph Management + * + * ___MANBRIEF___ graph management functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the graph management functions of CUDA + * runtime application programming interface. + * + * @{ + */ + +/** + * \brief Creates a graph + * + * Creates an empty graph, which is returned via \p pGraph. + * + * \param pGraph - Returns newly created graph + * \param flags - Graph creation flags, must be 0 + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode, + * ::cudaGraphInstantiate, + * ::cudaGraphDestroy, + * ::cudaGraphGetNodes, + * ::cudaGraphGetRootNodes, + * ::cudaGraphGetEdges, + * ::cudaGraphClone + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphCreate(cudaGraph_t *pGraph, unsigned int flags); + +/** + * \brief Creates a kernel execution node and adds it to a graph + * + * Creates a new kernel execution node and adds it to \p graph with \p numDependencies + * dependencies specified via \p pDependencies and arguments specified in \p pNodeParams. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * The cudaKernelNodeParams structure is defined as: + * + * \code + * struct cudaKernelNodeParams + * { + * void* func; + * dim3 gridDim; + * dim3 blockDim; + * unsigned int sharedMemBytes; + * void **kernelParams; + * void **extra; + * }; + * \endcode + * + * When the graph is launched, the node will invoke kernel \p func on a (\p gridDim.x x + * \p gridDim.y x \p gridDim.z) grid of blocks. Each block contains + * (\p blockDim.x x \p blockDim.y x \p blockDim.z) threads. + * + * \p sharedMem sets the amount of dynamic shared memory that will be + * available to each thread block. + * + * Kernel parameters to \p func can be specified in one of two ways: + * + * 1) Kernel parameters can be specified via \p kernelParams. If the kernel has N + * parameters, then \p kernelParams needs to be an array of N pointers. Each pointer, + * from \p kernelParams[0] to \p kernelParams[N-1], points to the region of memory from which the actual + * parameter will be copied. The number of kernel parameters and their offsets and sizes do not need + * to be specified as that information is retrieved directly from the kernel's image. + * + * 2) Kernel parameters can also be packaged by the application into a single buffer that is passed in + * via \p extra. This places the burden on the application of knowing each kernel + * parameter's size and alignment/padding within the buffer. The \p extra parameter exists + * to allow this function to take additional less commonly used arguments. \p extra specifies + * a list of names of extra settings and their corresponding values. Each extra setting name is + * immediately followed by the corresponding value. The list must be terminated with either NULL or + * CU_LAUNCH_PARAM_END. + * + * - ::CU_LAUNCH_PARAM_END, which indicates the end of the \p extra + * array; + * - ::CU_LAUNCH_PARAM_BUFFER_POINTER, which specifies that the next + * value in \p extra will be a pointer to a buffer + * containing all the kernel parameters for launching kernel + * \p func; + * - ::CU_LAUNCH_PARAM_BUFFER_SIZE, which specifies that the next + * value in \p extra will be a pointer to a size_t + * containing the size of the buffer specified with + * ::CU_LAUNCH_PARAM_BUFFER_POINTER; + * + * The error ::cudaErrorInvalidValue will be returned if kernel parameters are specified with both + * \p kernelParams and \p extra (i.e. both \p kernelParams and + * \p extra are non-NULL). + * + * The \p kernelParams or \p extra array, as well as the argument values it points to, + * are copied during this call. + * + * \note Kernels launched using graphs must not use texture and surface references. Reading or + * writing through any texture or surface reference is undefined behavior. + * This restriction does not apply to texture and surface objects. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param pNodeParams - Parameters for the GPU execution node + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDeviceFunction + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaLaunchKernel, + * ::cudaGraphKernelNodeGetParams, + * ::cudaGraphKernelNodeSetParams, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphAddKernelNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, const struct cudaKernelNodeParams *pNodeParams); + +/** + * \brief Returns a kernel node's parameters + * + * Returns the parameters of kernel node \p node in \p pNodeParams. + * The \p kernelParams or \p extra array returned in \p pNodeParams, + * as well as the argument values it points to, are owned by the node. + * This memory remains valid until the node is destroyed or its + * parameters are modified, and should not be modified + * directly. Use ::cudaGraphKernelNodeSetParams to update the + * parameters of this node. + * + * The params will contain either \p kernelParams or \p extra, + * according to which of these was most recently set on the node. + * + * \param node - Node to get the parameters for + * \param pNodeParams - Pointer to return the parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDeviceFunction + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaLaunchKernel, + * ::cudaGraphAddKernelNode, + * ::cudaGraphKernelNodeSetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetParams(cudaGraphNode_t node, struct cudaKernelNodeParams *pNodeParams); + +/** + * \brief Sets a kernel node's parameters + * + * Sets the parameters of kernel node \p node to \p pNodeParams. + * + * \param node - Node to set the parameters for + * \param pNodeParams - Parameters to copy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle, + * ::cudaErrorMemoryAllocation + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeSetParams, + * ::cudaLaunchKernel, + * ::cudaGraphAddKernelNode, + * ::cudaGraphKernelNodeGetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const struct cudaKernelNodeParams *pNodeParams); + +/** + * \brief Copies attributes from source node to destination node. + * + * Copies attributes from source node \p src to destination node \p dst. + * Both node must have the same context. + * + * \param[out] dst Destination node + * \param[in] src Source node + * For list of attributes see ::cudaKernelNodeAttrID + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidContext + * \notefnerr + * + * \sa + * ::cudaAccessPolicyWindow + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeCopyAttributes( + cudaGraphNode_t hSrc, + cudaGraphNode_t hDst); + +/** + * \brief Queries node attribute. + * + * Queries attribute \p attr from node \p hNode and stores it in corresponding + * member of \p value_out. + * + * \param[in] hNode + * \param[in] attr + * \param[out] value_out + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * + * \sa + * ::cudaAccessPolicyWindow + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetAttribute( + cudaGraphNode_t hNode, + cudaKernelNodeAttrID attr, + cudaKernelNodeAttrValue *value_out); + +/** + * \brief Sets node attribute. + * + * Sets attribute \p attr on node \p hNode from corresponding attribute of + * \p value. + * + * \param[out] hNode + * \param[in] attr + * \param[out] value + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidResourceHandle + * \notefnerr + * + * \sa + * ::cudaAccessPolicyWindow + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetAttribute( + cudaGraphNode_t hNode, + cudaKernelNodeAttrID attr, + const cudaKernelNodeAttrValue *value); + +/** + * \brief Creates a memcpy node and adds it to a graph + * + * Creates a new memcpy node and adds it to \p graph with \p numDependencies + * dependencies specified via \p pDependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * When the graph is launched, the node will perform the memcpy described by \p pCopyParams. + * See ::cudaMemcpy3D() for a description of the structure and its restrictions. + * + * Memcpy nodes have some additional restrictions with regards to managed memory, if the + * system contains at least one device which has a zero value for the device attribute + * ::cudaDevAttrConcurrentManagedAccess. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param pCopyParams - Parameters for the memory copy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaMemcpy3D, + * ::cudaGraphAddMemcpyNodeToSymbol, + * ::cudaGraphAddMemcpyNodeFromSymbol, + * ::cudaGraphAddMemcpyNode1D, + * ::cudaGraphMemcpyNodeGetParams, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemsetNode + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, const struct cudaMemcpy3DParms *pCopyParams); + +/** + * \brief Creates a memcpy node to copy to a symbol on the device and adds it to a graph + * + * Creates a new memcpy node to copy to \p symbol and adds it to \p graph with + * \p numDependencies dependencies specified via \p pDependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * When the graph is launched, the node will copy \p count bytes from the memory area + * pointed to by \p src to the memory area pointed to by \p offset bytes from the start + * of symbol \p symbol. The memory areas may not overlap. \p symbol is a variable that + * resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of + * transfer is inferred from the pointer values. However, ::cudaMemcpyDefault + * is only allowed on systems that support unified virtual addressing. + * + * Memcpy nodes have some additional restrictions with regards to managed memory, if the + * system contains at least one device which has a zero value for the device attribute + * ::cudaDevAttrConcurrentManagedAccess. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param symbol - Device symbol address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpyToSymbol, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemcpyNodeFromSymbol, + * ::cudaGraphMemcpyNodeGetParams, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsToSymbol, + * ::cudaGraphMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemsetNode + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNodeToSymbol( + cudaGraphNode_t *pGraphNode, + cudaGraph_t graph, + const cudaGraphNode_t *pDependencies, + size_t numDependencies, + const void* symbol, + const void* src, + size_t count, + size_t offset, + enum cudaMemcpyKind kind); +#endif + +/** + * \brief Creates a memcpy node to copy from a symbol on the device and adds it to a graph + * + * Creates a new memcpy node to copy from \p symbol and adds it to \p graph with + * \p numDependencies dependencies specified via \p pDependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * When the graph is launched, the node will copy \p count bytes from the memory area + * pointed to by \p offset bytes from the start of symbol \p symbol to the memory area + * pointed to by \p dst. The memory areas may not overlap. \p symbol is a variable + * that resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyDeviceToHost, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of transfer + * is inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * Memcpy nodes have some additional restrictions with regards to managed memory, if the + * system contains at least one device which has a zero value for the device attribute + * ::cudaDevAttrConcurrentManagedAccess. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param dst - Destination memory address + * \param symbol - Device symbol address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpyFromSymbol, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemcpyNodeToSymbol, + * ::cudaGraphMemcpyNodeGetParams, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphMemcpyNodeSetParamsToSymbol, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemsetNode + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNodeFromSymbol( + cudaGraphNode_t* pGraphNode, + cudaGraph_t graph, + const cudaGraphNode_t* pDependencies, + size_t numDependencies, + void* dst, + const void* symbol, + size_t count, + size_t offset, + enum cudaMemcpyKind kind); +#endif + +/** + * \brief Creates a 1D memcpy node and adds it to a graph + * + * Creates a new 1D memcpy node and adds it to \p graph with \p numDependencies + * dependencies specified via \p pDependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * When the graph is launched, the node will copy \p count bytes from the memory + * area pointed to by \p src to the memory area pointed to by \p dst, where + * \p kind specifies the direction of the copy, and must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. Launching a + * memcpy node with dst and src pointers that do not match the direction of + * the copy results in an undefined behavior. + * + * Memcpy nodes have some additional restrictions with regards to managed memory, if the + * system contains at least one device which has a zero value for the device attribute + * ::cudaDevAttrConcurrentManagedAccess. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param dst - Destination memory address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpy, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphMemcpyNodeGetParams, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParams1D, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemsetNode + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode1D( + cudaGraphNode_t *pGraphNode, + cudaGraph_t graph, + const cudaGraphNode_t *pDependencies, + size_t numDependencies, + void* dst, + const void* src, + size_t count, + enum cudaMemcpyKind kind); +#endif + +/** + * \brief Returns a memcpy node's parameters + * + * Returns the parameters of memcpy node \p node in \p pNodeParams. + * + * \param node - Node to get the parameters for + * \param pNodeParams - Pointer to return the parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpy3D, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphMemcpyNodeSetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, struct cudaMemcpy3DParms *pNodeParams); + +/** + * \brief Sets a memcpy node's parameters + * + * Sets the parameters of memcpy node \p node to \p pNodeParams. + * + * \param node - Node to set the parameters for + * \param pNodeParams - Parameters to copy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeSetParams, + * ::cudaMemcpy3D, + * ::cudaGraphMemcpyNodeSetParamsToSymbol, + * ::cudaGraphMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphMemcpyNodeSetParams1D, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphMemcpyNodeGetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const struct cudaMemcpy3DParms *pNodeParams); + +/** + * \brief Sets a memcpy node's parameters to copy to a symbol on the device + * + * Sets the parameters of memcpy node \p node to the copy described by the provided parameters. + * + * When the graph is launched, the node will copy \p count bytes from the memory area + * pointed to by \p src to the memory area pointed to by \p offset bytes from the start + * of symbol \p symbol. The memory areas may not overlap. \p symbol is a variable that + * resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of + * transfer is inferred from the pointer values. However, ::cudaMemcpyDefault + * is only allowed on systems that support unified virtual addressing. + * + * \param node - Node to set the parameters for + * \param symbol - Device symbol address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpyToSymbol, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphMemcpyNodeGetParams + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParamsToSymbol( + cudaGraphNode_t node, + const void* symbol, + const void* src, + size_t count, + size_t offset, + enum cudaMemcpyKind kind); +#endif + +/** + * \brief Sets a memcpy node's parameters to copy from a symbol on the device + * + * Sets the parameters of memcpy node \p node to the copy described by the provided parameters. + * + * When the graph is launched, the node will copy \p count bytes from the memory area + * pointed to by \p offset bytes from the start of symbol \p symbol to the memory area + * pointed to by \p dst. The memory areas may not overlap. \p symbol is a variable + * that resides in global or constant memory space. \p kind can be either + * ::cudaMemcpyDeviceToHost, ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. + * Passing ::cudaMemcpyDefault is recommended, in which case the type of transfer + * is inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. + * + * \param node - Node to set the parameters for + * \param dst - Destination memory address + * \param symbol - Device symbol address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpyFromSymbol, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsToSymbol, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphMemcpyNodeGetParams + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParamsFromSymbol( + cudaGraphNode_t node, + void* dst, + const void* symbol, + size_t count, + size_t offset, + enum cudaMemcpyKind kind); +#endif + +/** + * \brief Sets a memcpy node's parameters to perform a 1-dimensional copy + * + * Sets the parameters of memcpy node \p node to the copy described by the provided parameters. + * + * When the graph is launched, the node will copy \p count bytes from the memory + * area pointed to by \p src to the memory area pointed to by \p dst, where + * \p kind specifies the direction of the copy, and must be one of + * ::cudaMemcpyHostToHost, ::cudaMemcpyHostToDevice, ::cudaMemcpyDeviceToHost, + * ::cudaMemcpyDeviceToDevice, or ::cudaMemcpyDefault. Passing + * ::cudaMemcpyDefault is recommended, in which case the type of transfer is + * inferred from the pointer values. However, ::cudaMemcpyDefault is only + * allowed on systems that support unified virtual addressing. Launching a + * memcpy node with dst and src pointers that do not match the direction of + * the copy results in an undefined behavior. + * + * \param node - Node to set the parameters for + * \param dst - Destination memory address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemcpy, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphMemcpyNodeGetParams + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParams1D( + cudaGraphNode_t node, + void* dst, + const void* src, + size_t count, + enum cudaMemcpyKind kind); +#endif + +/** + * \brief Creates a memset node and adds it to a graph + * + * Creates a new memset node and adds it to \p graph with \p numDependencies + * dependencies specified via \p pDependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * The element size must be 1, 2, or 4 bytes. + * When the graph is launched, the node will perform the memset described by \p pMemsetParams. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param pMemsetParams - Parameters for the memory set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDevice + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaMemset2D, + * ::cudaGraphMemsetNodeGetParams, + * ::cudaGraphMemsetNodeSetParams, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemcpyNode + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemsetNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, const struct cudaMemsetParams *pMemsetParams); + +/** + * \brief Returns a memset node's parameters + * + * Returns the parameters of memset node \p node in \p pNodeParams. + * + * \param node - Node to get the parameters for + * \param pNodeParams - Pointer to return the parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaMemset2D, + * ::cudaGraphAddMemsetNode, + * ::cudaGraphMemsetNodeSetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, struct cudaMemsetParams *pNodeParams); + +/** + * \brief Sets a memset node's parameters + * + * Sets the parameters of memset node \p node to \p pNodeParams. + * + * \param node - Node to set the parameters for + * \param pNodeParams - Parameters to copy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeSetParams, + * ::cudaMemset2D, + * ::cudaGraphAddMemsetNode, + * ::cudaGraphMemsetNodeGetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const struct cudaMemsetParams *pNodeParams); + +/** + * \brief Creates a host execution node and adds it to a graph + * + * Creates a new CPU execution node and adds it to \p graph with \p numDependencies + * dependencies specified via \p pDependencies and arguments specified in \p pNodeParams. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * When the graph is launched, the node will invoke the specified CPU function. + * Host nodes are not supported under MPS with pre-Volta GPUs. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param pNodeParams - Parameters for the host node + * + * \return + * ::cudaSuccess, + * ::cudaErrorNotSupported, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaLaunchHostFunc, + * ::cudaGraphHostNodeGetParams, + * ::cudaGraphHostNodeSetParams, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphAddHostNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, const struct cudaHostNodeParams *pNodeParams); + +/** + * \brief Returns a host node's parameters + * + * Returns the parameters of host node \p node in \p pNodeParams. + * + * \param node - Node to get the parameters for + * \param pNodeParams - Pointer to return the parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaLaunchHostFunc, + * ::cudaGraphAddHostNode, + * ::cudaGraphHostNodeSetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeGetParams(cudaGraphNode_t node, struct cudaHostNodeParams *pNodeParams); + +/** + * \brief Sets a host node's parameters + * + * Sets the parameters of host node \p node to \p nodeParams. + * + * \param node - Node to set the parameters for + * \param pNodeParams - Parameters to copy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeSetParams, + * ::cudaLaunchHostFunc, + * ::cudaGraphAddHostNode, + * ::cudaGraphHostNodeGetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeSetParams(cudaGraphNode_t node, const struct cudaHostNodeParams *pNodeParams); + +/** + * \brief Creates a child graph node and adds it to a graph + * + * Creates a new node which executes an embedded graph, and adds it to \p graph with + * \p numDependencies dependencies specified via \p pDependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * If \p hGraph contains allocation or free nodes, this call will return an error. + * + * The node executes an embedded child graph. The child graph is cloned in this call. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param childGraph - The graph to clone into this node + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaGraphChildGraphNodeGetGraph, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode, + * ::cudaGraphClone + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphAddChildGraphNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, cudaGraph_t childGraph); + +/** + * \brief Gets a handle to the embedded graph of a child graph node + * + * Gets a handle to the embedded graph in a child graph node. This call + * does not clone the graph. Changes to the graph will be reflected in + * the node, and the node retains ownership of the graph. + * + * Allocation and free nodes cannot be added to the returned graph. + * Attempting to do so will return an error. + * + * \param node - Node to get the embedded graph for + * \param pGraph - Location to store a handle to the graph + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphNodeFindInClone + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t *pGraph); + +/** + * \brief Creates an empty node and adds it to a graph + * + * Creates a new node which performs no operation, and adds it to \p graph with + * \p numDependencies dependencies specified via \p pDependencies. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p pGraphNode. + * + * An empty node performs no operation during execution, but can be used for + * transitive ordering. For example, a phased execution graph with 2 groups of n + * nodes with a barrier between them can be represented using an empty node and + * 2*n dependency edges, rather than no empty node and n^2 dependency edges. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphAddEmptyNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies); + +/** + * \brief Creates an event record node and adds it to a graph + * + * Creates a new event record node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies and event specified in \p event. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * Each launch of the graph will record \p event to capture execution of the + * node's dependencies. + * + * These nodes may not be used in loops or conditionals. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param event - Event for the node + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaGraphAddEventWaitNode, + * ::cudaEventRecordWithFlags, + * ::cudaStreamWaitEvent, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphAddEventRecordNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, cudaEvent_t event); +#endif + +/** + * \brief Returns the event associated with an event record node + * + * Returns the event of event record node \p hNode in \p event_out. + * + * \param hNode - Node to get the event for + * \param event_out - Pointer to return the event + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddEventRecordNode, + * ::cudaGraphEventRecordNodeSetEvent, + * ::cudaGraphEventWaitNodeGetEvent, + * ::cudaEventRecordWithFlags, + * ::cudaStreamWaitEvent + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t *event_out); +#endif + +/** + * \brief Sets an event record node's event + * + * Sets the event of event record node \p hNode to \p event. + * + * \param hNode - Node to set the event for + * \param event - Event to use + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeSetParams, + * ::cudaGraphAddEventRecordNode, + * ::cudaGraphEventRecordNodeGetEvent, + * ::cudaGraphEventWaitNodeSetEvent, + * ::cudaEventRecordWithFlags, + * ::cudaStreamWaitEvent + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event); +#endif + +/** + * \brief Creates an event wait node and adds it to a graph + * + * Creates a new event wait node and adds it to \p hGraph with \p numDependencies + * dependencies specified via \p dependencies and event specified in \p event. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. + * A handle to the new node will be returned in \p phGraphNode. + * + * The graph node will wait for all work captured in \p event. See ::cuEventRecord() + * for details on what is captured by an event. The synchronization will be performed + * efficiently on the device when applicable. \p event may be from a different context + * or device than the launch stream. + * + * These nodes may not be used in loops or conditionals. + * + * \param phGraphNode - Returns newly created node + * \param hGraph - Graph to which to add the node + * \param dependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param event - Event for the node + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaGraphAddEventRecordNode, + * ::cudaEventRecordWithFlags, + * ::cudaStreamWaitEvent, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphAddEventWaitNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, cudaEvent_t event); +#endif + +/** + * \brief Returns the event associated with an event wait node + * + * Returns the event of event wait node \p hNode in \p event_out. + * + * \param hNode - Node to get the event for + * \param event_out - Pointer to return the event + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddEventWaitNode, + * ::cudaGraphEventWaitNodeSetEvent, + * ::cudaGraphEventRecordNodeGetEvent, + * ::cudaEventRecordWithFlags, + * ::cudaStreamWaitEvent + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t *event_out); +#endif + +/** + * \brief Sets an event wait node's event + * + * Sets the event of event wait node \p hNode to \p event. + * + * \param hNode - Node to set the event for + * \param event - Event to use + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeSetParams, + * ::cudaGraphAddEventWaitNode, + * ::cudaGraphEventWaitNodeGetEvent, + * ::cudaGraphEventRecordNodeSetEvent, + * ::cudaEventRecordWithFlags, + * ::cudaStreamWaitEvent + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event); +#endif + +/** + * \brief Creates an external semaphore signal node and adds it to a graph + * + * Creates a new external semaphore signal node and adds it to \p graph with \p + * numDependencies dependencies specified via \p dependencies and arguments specified + * in \p nodeParams. It is possible for \p numDependencies to be 0, in which case the + * node will be placed at the root of the graph. \p dependencies may not have any + * duplicate entries. A handle to the new node will be returned in \p pGraphNode. + * + * Performs a signal operation on a set of externally allocated semaphore objects + * when the node is launched. The operation(s) will occur after all of the node's + * dependencies have completed. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Parameters for the node + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaGraphExternalSemaphoresSignalNodeGetParams, + * ::cudaGraphExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphAddExternalSemaphoresWaitNode, + * ::cudaImportExternalSemaphore, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddEventRecordNode, + * ::cudaGraphAddEventWaitNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode + */ +#if __CUDART_API_VERSION >= 11020 +extern __host__ cudaError_t CUDARTAPI cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, const struct cudaExternalSemaphoreSignalNodeParams *nodeParams); +#endif + +/** + * \brief Returns an external semaphore signal node's parameters + * + * Returns the parameters of an external semaphore signal node \p hNode in \p params_out. + * The \p extSemArray and \p paramsArray returned in \p params_out, + * are owned by the node. This memory remains valid until the node is destroyed or its + * parameters are modified, and should not be modified + * directly. Use ::cudaGraphExternalSemaphoresSignalNodeSetParams to update the + * parameters of this node. + * + * \param hNode - Node to get the parameters for + * \param params_out - Pointer to return the parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaLaunchKernel, + * ::cudaGraphAddExternalSemaphoresSignalNode, + * ::cudaGraphExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphAddExternalSemaphoresWaitNode, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync + */ +#if __CUDART_API_VERSION >= 11020 +extern __host__ cudaError_t CUDARTAPI cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, struct cudaExternalSemaphoreSignalNodeParams *params_out); +#endif + +/** + * \brief Sets an external semaphore signal node's parameters + * + * Sets the parameters of an external semaphore signal node \p hNode to \p nodeParams. + * + * \param hNode - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeSetParams, + * ::cudaGraphAddExternalSemaphoresSignalNode, + * ::cudaGraphExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphAddExternalSemaphoresWaitNode, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync + */ +#if __CUDART_API_VERSION >= 11020 +extern __host__ cudaError_t CUDARTAPI cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const struct cudaExternalSemaphoreSignalNodeParams *nodeParams); +#endif + +/** + * \brief Creates an external semaphore wait node and adds it to a graph + * + * Creates a new external semaphore wait node and adds it to \p graph with \p numDependencies + * dependencies specified via \p dependencies and arguments specified in \p nodeParams. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p dependencies may not have any duplicate entries. A handle + * to the new node will be returned in \p pGraphNode. + * + * Performs a wait operation on a set of externally allocated semaphore objects + * when the node is launched. The node's dependencies will not be launched until + * the wait operation has completed. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Parameters for the node + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaGraphExternalSemaphoresWaitNodeGetParams, + * ::cudaGraphExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphAddExternalSemaphoresSignalNode, + * ::cudaImportExternalSemaphore, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddEventRecordNode, + * ::cudaGraphAddEventWaitNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode + */ +#if __CUDART_API_VERSION >= 11020 +extern __host__ cudaError_t CUDARTAPI cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, const struct cudaExternalSemaphoreWaitNodeParams *nodeParams); +#endif + +/** + * \brief Returns an external semaphore wait node's parameters + * + * Returns the parameters of an external semaphore wait node \p hNode in \p params_out. + * The \p extSemArray and \p paramsArray returned in \p params_out, + * are owned by the node. This memory remains valid until the node is destroyed or its + * parameters are modified, and should not be modified + * directly. Use ::cudaGraphExternalSemaphoresSignalNodeSetParams to update the + * parameters of this node. + * + * \param hNode - Node to get the parameters for + * \param params_out - Pointer to return the parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaLaunchKernel, + * ::cudaGraphAddExternalSemaphoresWaitNode, + * ::cudaGraphExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphAddExternalSemaphoresWaitNode, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync + */ +#if __CUDART_API_VERSION >= 11020 +extern __host__ cudaError_t CUDARTAPI cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, struct cudaExternalSemaphoreWaitNodeParams *params_out); +#endif + +/** + * \brief Sets an external semaphore wait node's parameters + * + * Sets the parameters of an external semaphore wait node \p hNode to \p nodeParams. + * + * \param hNode - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeSetParams, + * ::cudaGraphAddExternalSemaphoresWaitNode, + * ::cudaGraphExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphAddExternalSemaphoresWaitNode, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync + */ +#if __CUDART_API_VERSION >= 11020 +extern __host__ cudaError_t CUDARTAPI cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const struct cudaExternalSemaphoreWaitNodeParams *nodeParams); +#endif + +/** + * \brief Creates an allocation node and adds it to a graph + * + * Creates a new allocation node and adds it to \p graph with \p numDependencies + * dependencies specified via \p pDependencies and arguments specified in \p nodeParams. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. A handle + * to the new node will be returned in \p pGraphNode. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Parameters for the node + * + * When ::cudaGraphAddMemAllocNode creates an allocation node, it returns the address of the allocation in + * \p nodeParams.dptr. The allocation's address remains fixed across instantiations and launches. + * + * If the allocation is freed in the same graph, by creating a free node using ::cudaGraphAddMemFreeNode, + * the allocation can be accessed by nodes ordered after the allocation node but before the free node. + * These allocations cannot be freed outside the owning graph, and they can only be freed once in the + * owning graph. + * + * If the allocation is not freed in the same graph, then it can be accessed not only by nodes in the + * graph which are ordered after the allocation node, but also by stream operations ordered after the + * graph's execution but before the allocation is freed. + * + * Allocations which are not freed in the same graph can be freed by: + * - passing the allocation to ::cudaMemFreeAsync or ::cudaMemFree; + * - launching a graph with a free node for that allocation; or + * - specifying ::cudaGraphInstantiateFlagAutoFreeOnLaunch during instantiation, which makes + * each launch behave as though it called ::cudaMemFreeAsync for every unfreed allocation. + * + * It is not possible to free an allocation in both the owning graph and another graph. If the allocation + * is freed in the same graph, a free node cannot be added to another graph. If the allocation is freed + * in another graph, a free node can no longer be added to the owning graph. + * + * The following restrictions apply to graphs which contain allocation and/or memory free nodes: + * - Nodes and edges of the graph cannot be deleted. + * - The graph cannot be used in a child node. + * - Only one instantiation of the graph may exist at any point in time. + * - The graph cannot be cloned. + * + * \return + * ::cudaSuccess, + * ::cudaErrorCudartUnloading, + * ::cudaErrorInitializationError, + * ::cudaErrorNotSupported, + * ::cudaErrorInvalidValue, + * ::cudaErrorOutOfMemory + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cudaGraphAddNode, + * ::cudaGraphAddMemFreeNode, + * ::cudaGraphMemAllocNodeGetParams, + * ::cudaDeviceGraphMemTrim, + * ::cudaDeviceGetGraphMemAttribute, + * ::cudaDeviceSetGraphMemAttribute, + * ::cudaMallocAsync, + * ::cudaFreeAsync, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddEventRecordNode, + * ::cudaGraphAddEventWaitNode, + * ::cudaGraphAddExternalSemaphoresSignalNode, + * ::cudaGraphAddExternalSemaphoresWaitNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode + */ +#if __CUDART_API_VERSION >= 11040 +extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemAllocNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, struct cudaMemAllocNodeParams *nodeParams); +#endif + +/** + * \brief Returns a memory alloc node's parameters + * + * Returns the parameters of a memory alloc node \p hNode in \p params_out. + * The \p poolProps and \p accessDescs returned in \p params_out, are owned by the + * node. This memory remains valid until the node is destroyed. The returned + * parameters must not be modified. + * + * \param node - Node to get the parameters for + * \param params_out - Pointer to return the parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddMemAllocNode, + * ::cudaGraphMemFreeNodeGetParams + */ +#if __CUDART_API_VERSION >= 11040 +extern __host__ cudaError_t CUDARTAPI cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, struct cudaMemAllocNodeParams *params_out); +#endif + +/** + * \brief Creates a memory free node and adds it to a graph + * + * Creates a new memory free node and adds it to \p graph with \p numDependencies + * dependencies specified via \p pDependencies and address specified in \p dptr. + * It is possible for \p numDependencies to be 0, in which case the node will be placed + * at the root of the graph. \p pDependencies may not have any duplicate entries. A handle + * to the new node will be returned in \p pGraphNode. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param dptr - Address of memory to free + * + * ::cudaGraphAddMemFreeNode will return ::cudaErrorInvalidValue if the user attempts to free: + * - an allocation twice in the same graph. + * - an address that was not returned by an allocation node. + * - an invalid address. + * + * The following restrictions apply to graphs which contain allocation and/or memory free nodes: + * - Nodes and edges of the graph cannot be deleted. + * - The graph cannot be used in a child node. + * - Only one instantiation of the graph may exist at any point in time. + * - The graph cannot be cloned. + * + * \return + * ::cudaSuccess, + * ::cudaErrorCudartUnloading, + * ::cudaErrorInitializationError, + * ::cudaErrorNotSupported, + * ::cudaErrorInvalidValue, + * ::cudaErrorOutOfMemory + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cudaGraphAddNode, + * ::cudaGraphAddMemAllocNode, + * ::cudaGraphMemFreeNodeGetParams, + * ::cudaDeviceGraphMemTrim, + * ::cudaDeviceGetGraphMemAttribute, + * ::cudaDeviceSetGraphMemAttribute, + * ::cudaMallocAsync, + * ::cudaFreeAsync, + * ::cudaGraphCreate, + * ::cudaGraphDestroyNode, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddEventRecordNode, + * ::cudaGraphAddEventWaitNode, + * ::cudaGraphAddExternalSemaphoresSignalNode, + * ::cudaGraphAddExternalSemaphoresWaitNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode + */ +#if __CUDART_API_VERSION >= 11040 +extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemFreeNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, void *dptr); +#endif + +/** + * \brief Returns a memory free node's parameters + * + * Returns the address of a memory free node \p hNode in \p dptr_out. + * + * \param node - Node to get the parameters for + * \param dptr_out - Pointer to return the device address + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddMemFreeNode, + * ::cudaGraphMemFreeNodeGetParams + */ +#if __CUDART_API_VERSION >= 11040 +extern __host__ cudaError_t CUDARTAPI cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void *dptr_out); +#endif + +/** + * \brief Free unused memory that was cached on the specified device for use with graphs back to the OS. + * + * Blocks which are not in use by a graph that is either currently executing or scheduled to execute are + * freed back to the operating system. + * + * \param device - The device for which cached memory should be freed. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddMemAllocNode, + * ::cudaGraphAddMemFreeNode, + * ::cudaDeviceGetGraphMemAttribute, + * ::cudaDeviceSetGraphMemAttribute, + * ::cudaMallocAsync, + * ::cudaFreeAsync + */ +#if __CUDART_API_VERSION >= 11040 +extern __host__ cudaError_t CUDARTAPI cudaDeviceGraphMemTrim(int device); +#endif + +/** + * \brief Query asynchronous allocation attributes related to graphs + * + * Valid attributes are: + * + * - ::cudaGraphMemAttrUsedMemCurrent: Amount of memory, in bytes, currently associated with graphs + * - ::cudaGraphMemAttrUsedMemHigh: High watermark of memory, in bytes, associated with graphs since the + * last time it was reset. High watermark can only be reset to zero. + * - ::cudaGraphMemAttrReservedMemCurrent: Amount of memory, in bytes, currently allocated for use by + * the CUDA graphs asynchronous allocator. + * - ::cudaGraphMemAttrReservedMemHigh: High watermark of memory, in bytes, currently allocated for use by + * the CUDA graphs asynchronous allocator. + * + * \param device - Specifies the scope of the query + * \param attr - attribute to get + * \param value - retrieved value + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaDeviceSetGraphMemAttribute, + * ::cudaGraphAddMemAllocNode, + * ::cudaGraphAddMemFreeNode, + * ::cudaDeviceGraphMemTrim, + * ::cudaMallocAsync, + * ::cudaFreeAsync + */ +#if __CUDART_API_VERSION >= 11040 +extern __host__ cudaError_t CUDARTAPI cudaDeviceGetGraphMemAttribute(int device, enum cudaGraphMemAttributeType attr, void* value); +#endif + +/** + * \brief Set asynchronous allocation attributes related to graphs + * + * Valid attributes are: + * + * - ::cudaGraphMemAttrUsedMemHigh: High watermark of memory, in bytes, associated with graphs since the + * last time it was reset. High watermark can only be reset to zero. + * - ::cudaGraphMemAttrReservedMemHigh: High watermark of memory, in bytes, currently allocated for use by + * the CUDA graphs asynchronous allocator. + * + * \param device - Specifies the scope of the query + * \param attr - attribute to get + * \param value - pointer to value to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidDevice + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaDeviceGetGraphMemAttribute, + * ::cudaGraphAddMemAllocNode, + * ::cudaGraphAddMemFreeNode, + * ::cudaDeviceGraphMemTrim, + * ::cudaMallocAsync, + * ::cudaFreeAsync + */ +#if __CUDART_API_VERSION >= 11040 +extern __host__ cudaError_t CUDARTAPI cudaDeviceSetGraphMemAttribute(int device, enum cudaGraphMemAttributeType attr, void* value); +#endif + +/** + * \brief Clones a graph + * + * This function creates a copy of \p originalGraph and returns it in \p pGraphClone. + * All parameters are copied into the cloned graph. The original graph may be modified + * after this call without affecting the clone. + * + * Child graph nodes in the original graph are recursively copied into the clone. + * + * \param pGraphClone - Returns newly created cloned graph + * \param originalGraph - Graph to clone + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorMemoryAllocation + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphCreate, + * ::cudaGraphNodeFindInClone + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphClone(cudaGraph_t *pGraphClone, cudaGraph_t originalGraph); + +/** + * \brief Finds a cloned version of a node + * + * This function returns the node in \p clonedGraph corresponding to \p originalNode + * in the original graph. + * + * \p clonedGraph must have been cloned from \p originalGraph via ::cudaGraphClone. + * \p originalNode must have been in \p originalGraph at the time of the call to + * ::cudaGraphClone, and the corresponding cloned node in \p clonedGraph must not have + * been removed. The cloned node is then returned via \p pClonedNode. + * + * \param pNode - Returns handle to the cloned node + * \param originalNode - Handle to the original node + * \param clonedGraph - Cloned graph to query + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphClone + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphNodeFindInClone(cudaGraphNode_t *pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph); + +/** + * \brief Returns a node's type + * + * Returns the node type of \p node in \p pType. + * + * \param node - Node to query + * \param pType - Pointer to return the node type + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphGetNodes, + * ::cudaGraphGetRootNodes, + * ::cudaGraphChildGraphNodeGetGraph, + * ::cudaGraphKernelNodeGetParams, + * ::cudaGraphKernelNodeSetParams, + * ::cudaGraphHostNodeGetParams, + * ::cudaGraphHostNodeSetParams, + * ::cudaGraphMemcpyNodeGetParams, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemsetNodeGetParams, + * ::cudaGraphMemsetNodeSetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetType(cudaGraphNode_t node, enum cudaGraphNodeType *pType); + +/** + * \brief Returns a graph's nodes + * + * Returns a list of \p graph's nodes. \p nodes may be NULL, in which case this + * function will return the number of nodes in \p numNodes. Otherwise, + * \p numNodes entries will be filled in. If \p numNodes is higher than the actual + * number of nodes, the remaining entries in \p nodes will be set to NULL, and the + * number of nodes actually obtained will be returned in \p numNodes. + * + * \param graph - Graph to query + * \param nodes - Pointer to return the nodes + * \param numNodes - See description + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphCreate, + * ::cudaGraphGetRootNodes, + * ::cudaGraphGetEdges, + * ::cudaGraphNodeGetType, + * ::cudaGraphNodeGetDependencies, + * ::cudaGraphNodeGetDependentNodes + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t *nodes, size_t *numNodes); + +/** + * \brief Returns a graph's root nodes + * + * Returns a list of \p graph's root nodes. \p pRootNodes may be NULL, in which case this + * function will return the number of root nodes in \p pNumRootNodes. Otherwise, + * \p pNumRootNodes entries will be filled in. If \p pNumRootNodes is higher than the actual + * number of root nodes, the remaining entries in \p pRootNodes will be set to NULL, and the + * number of nodes actually obtained will be returned in \p pNumRootNodes. + * + * \param graph - Graph to query + * \param pRootNodes - Pointer to return the root nodes + * \param pNumRootNodes - See description + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphCreate, + * ::cudaGraphGetNodes, + * ::cudaGraphGetEdges, + * ::cudaGraphNodeGetType, + * ::cudaGraphNodeGetDependencies, + * ::cudaGraphNodeGetDependentNodes + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t *pRootNodes, size_t *pNumRootNodes); + +/** + * \brief Returns a graph's dependency edges + * + * Returns a list of \p graph's dependency edges. Edges are returned via corresponding + * indices in \p from and \p to; that is, the node in \p to[i] has a dependency on the + * node in \p from[i]. \p from and \p to may both be NULL, in which + * case this function only returns the number of edges in \p numEdges. Otherwise, + * \p numEdges entries will be filled in. If \p numEdges is higher than the actual + * number of edges, the remaining entries in \p from and \p to will be set to NULL, and + * the number of edges actually returned will be written to \p numEdges. + * + * \param graph - Graph to get the edges from + * \param from - Location to return edge endpoints + * \param to - Location to return edge endpoints + * \param numEdges - See description + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphGetNodes, + * ::cudaGraphGetRootNodes, + * ::cudaGraphAddDependencies, + * ::cudaGraphRemoveDependencies, + * ::cudaGraphNodeGetDependencies, + * ::cudaGraphNodeGetDependentNodes + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t *from, cudaGraphNode_t *to, size_t *numEdges); + +/** + * \brief Returns a graph's dependency edges (12.3+) + * + * Returns a list of \p graph's dependency edges. Edges are returned via corresponding + * indices in \p from, \p to and \p edgeData; that is, the node in \p to[i] has a + * dependency on the node in \p from[i] with data \p edgeData[i]. \p from and \p to may + * both be NULL, in which case this function only returns the number of edges in + * \p numEdges. Otherwise, \p numEdges entries will be filled in. If \p numEdges is higher + * than the actual number of edges, the remaining entries in \p from and \p to will be + * set to NULL, and the number of edges actually returned will be written to \p numEdges. + * \p edgeData may alone be NULL, in which case the edges must all have default (zeroed) + * edge data. Attempting a losst query via NULL \p edgeData will result in + * ::cudaErrorLossyQuery. If \p edgeData is non-NULL then \p from and \p to must be as + * well. + * + * \param graph - Graph to get the edges from + * \param from - Location to return edge endpoints + * \param to - Location to return edge endpoints + * \param edgeData - Optional location to return edge data + * \param numEdges - See description + * + * \return + * ::cudaSuccess, + * ::cudaErrorLossyQuery, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphGetNodes, + * ::cudaGraphGetRootNodes, + * ::cudaGraphAddDependencies, + * ::cudaGraphRemoveDependencies, + * ::cudaGraphNodeGetDependencies, + * ::cudaGraphNodeGetDependentNodes + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphGetEdges_v2(cudaGraph_t graph, cudaGraphNode_t *from, cudaGraphNode_t *to, cudaGraphEdgeData *edgeData, size_t *numEdges); + +/** + * \brief Returns a node's dependencies + * + * Returns a list of \p node's dependencies. \p pDependencies may be NULL, in which case this + * function will return the number of dependencies in \p pNumDependencies. Otherwise, + * \p pNumDependencies entries will be filled in. If \p pNumDependencies is higher than the actual + * number of dependencies, the remaining entries in \p pDependencies will be set to NULL, and the + * number of nodes actually obtained will be returned in \p pNumDependencies. + * + * \param node - Node to query + * \param pDependencies - Pointer to return the dependencies + * \param pNumDependencies - See description + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeGetDependentNodes, + * ::cudaGraphGetNodes, + * ::cudaGraphGetRootNodes, + * ::cudaGraphGetEdges, + * ::cudaGraphAddDependencies, + * ::cudaGraphRemoveDependencies + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t *pDependencies, size_t *pNumDependencies); + +/** + * \brief Returns a node's dependencies (12.3+) + * + * Returns a list of \p node's dependencies. \p pDependencies may be NULL, in which case this + * function will return the number of dependencies in \p pNumDependencies. Otherwise, + * \p pNumDependencies entries will be filled in. If \p pNumDependencies is higher than the actual + * number of dependencies, the remaining entries in \p pDependencies will be set to NULL, and the + * number of nodes actually obtained will be returned in \p pNumDependencies. + * + * Note that if an edge has non-zero (non-default) edge data and \p edgeData is NULL, + * this API will return ::cudaErrorLossyQuery. If \p edgeData is non-NULL, then + * \p pDependencies must be as well. + * + * \param node - Node to query + * \param pDependencies - Pointer to return the dependencies + * \param edgeData - Optional array to return edge data for each dependency + * \param pNumDependencies - See description + * + * \return + * ::cudaSuccess, + * ::cudaErrorLossyQuery, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeGetDependentNodes, + * ::cudaGraphGetNodes, + * ::cudaGraphGetRootNodes, + * ::cudaGraphGetEdges, + * ::cudaGraphAddDependencies, + * ::cudaGraphRemoveDependencies + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependencies_v2(cudaGraphNode_t node, cudaGraphNode_t *pDependencies, cudaGraphEdgeData *edgeData, size_t *pNumDependencies); + +/** + * \brief Returns a node's dependent nodes + * + * Returns a list of \p node's dependent nodes. \p pDependentNodes may be NULL, in which + * case this function will return the number of dependent nodes in \p pNumDependentNodes. + * Otherwise, \p pNumDependentNodes entries will be filled in. If \p pNumDependentNodes is + * higher than the actual number of dependent nodes, the remaining entries in + * \p pDependentNodes will be set to NULL, and the number of nodes actually obtained will + * be returned in \p pNumDependentNodes. + * + * \param node - Node to query + * \param pDependentNodes - Pointer to return the dependent nodes + * \param pNumDependentNodes - See description + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeGetDependencies, + * ::cudaGraphGetNodes, + * ::cudaGraphGetRootNodes, + * ::cudaGraphGetEdges, + * ::cudaGraphAddDependencies, + * ::cudaGraphRemoveDependencies + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t *pDependentNodes, size_t *pNumDependentNodes); + +/** + * \brief Returns a node's dependent nodes (12.3+) + * + * Returns a list of \p node's dependent nodes. \p pDependentNodes may be NULL, in which + * case this function will return the number of dependent nodes in \p pNumDependentNodes. + * Otherwise, \p pNumDependentNodes entries will be filled in. If \p pNumDependentNodes is + * higher than the actual number of dependent nodes, the remaining entries in + * \p pDependentNodes will be set to NULL, and the number of nodes actually obtained will + * be returned in \p pNumDependentNodes. + * + * Note that if an edge has non-zero (non-default) edge data and \p edgeData is NULL, + * this API will return ::cudaErrorLossyQuery. If \p edgeData is non-NULL, then + * \p pDependentNodes must be as well. + * + * \param node - Node to query + * \param pDependentNodes - Pointer to return the dependent nodes + * \param edgeData - Optional pointer to return edge data for dependent nodes + * \param pNumDependentNodes - See description + * + * \return + * ::cudaSuccess, + * ::cudaErrorLossyQuery, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeGetDependencies, + * ::cudaGraphGetNodes, + * ::cudaGraphGetRootNodes, + * ::cudaGraphGetEdges, + * ::cudaGraphAddDependencies, + * ::cudaGraphRemoveDependencies + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependentNodes_v2(cudaGraphNode_t node, cudaGraphNode_t *pDependentNodes, cudaGraphEdgeData *edgeData, size_t *pNumDependentNodes); + +/** + * \brief Adds dependency edges to a graph. + * + * The number of dependencies to be added is defined by \p numDependencies + * Elements in \p pFrom and \p pTo at corresponding indices define a dependency. + * Each node in \p pFrom and \p pTo must belong to \p graph. + * + * If \p numDependencies is 0, elements in \p pFrom and \p pTo will be ignored. + * Specifying an existing dependency will return an error. + * + * \param graph - Graph to which dependencies are added + * \param from - Array of nodes that provide the dependencies + * \param to - Array of dependent nodes + * \param numDependencies - Number of dependencies to be added + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphRemoveDependencies, + * ::cudaGraphGetEdges, + * ::cudaGraphNodeGetDependencies, + * ::cudaGraphNodeGetDependentNodes + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, const cudaGraphNode_t *to, size_t numDependencies); + +/** + * \brief Adds dependency edges to a graph. (12.3+) + * + * The number of dependencies to be added is defined by \p numDependencies + * Elements in \p pFrom and \p pTo at corresponding indices define a dependency. + * Each node in \p pFrom and \p pTo must belong to \p graph. + * + * If \p numDependencies is 0, elements in \p pFrom and \p pTo will be ignored. + * Specifying an existing dependency will return an error. + * + * \param graph - Graph to which dependencies are added + * \param from - Array of nodes that provide the dependencies + * \param to - Array of dependent nodes + * \param edgeData - Optional array of edge data. If NULL, default (zeroed) edge data is assumed. + * \param numDependencies - Number of dependencies to be added + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphRemoveDependencies, + * ::cudaGraphGetEdges, + * ::cudaGraphNodeGetDependencies, + * ::cudaGraphNodeGetDependentNodes + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphAddDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t *from, const cudaGraphNode_t *to, const cudaGraphEdgeData *edgeData, size_t numDependencies); + +/** + * \brief Removes dependency edges from a graph. + * + * The number of \p pDependencies to be removed is defined by \p numDependencies. + * Elements in \p pFrom and \p pTo at corresponding indices define a dependency. + * Each node in \p pFrom and \p pTo must belong to \p graph. + * + * If \p numDependencies is 0, elements in \p pFrom and \p pTo will be ignored. + * Specifying a non-existing dependency will return an error. + * + * \param graph - Graph from which to remove dependencies + * \param from - Array of nodes that provide the dependencies + * \param to - Array of dependent nodes + * \param numDependencies - Number of dependencies to be removed + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddDependencies, + * ::cudaGraphGetEdges, + * ::cudaGraphNodeGetDependencies, + * ::cudaGraphNodeGetDependentNodes + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, const cudaGraphNode_t *to, size_t numDependencies); + +/** + * \brief Removes dependency edges from a graph. (12.3+) + * + * The number of \p pDependencies to be removed is defined by \p numDependencies. + * Elements in \p pFrom and \p pTo at corresponding indices define a dependency. + * Each node in \p pFrom and \p pTo must belong to \p graph. + * + * If \p numDependencies is 0, elements in \p pFrom and \p pTo will be ignored. + * Specifying an edge that does not exist in the graph, with data matching + * \p edgeData, results in an error. \p edgeData is nullable, which is equivalent + * to passing default (zeroed) data for each edge. + * + * \param graph - Graph from which to remove dependencies + * \param from - Array of nodes that provide the dependencies + * \param to - Array of dependent nodes + * \param edgeData - Optional array of edge data. If NULL, edge data is assumed to + * be default (zeroed). + * \param numDependencies - Number of dependencies to be removed + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddDependencies, + * ::cudaGraphGetEdges, + * ::cudaGraphNodeGetDependencies, + * ::cudaGraphNodeGetDependentNodes + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphRemoveDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t *from, const cudaGraphNode_t *to, const cudaGraphEdgeData *edgeData, size_t numDependencies); + +/** + * \brief Remove a node from the graph + * + * Removes \p node from its graph. This operation also severs any dependencies of other nodes + * on \p node and vice versa. + * + * Dependencies cannot be removed from graphs which contain allocation or free nodes. + * Any attempt to do so will return an error. + * + * \param node - Node to remove + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * \note_destroy_ub + * + * \sa + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphAddEmptyNode, + * ::cudaGraphAddKernelNode, + * ::cudaGraphAddHostNode, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemsetNode + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphDestroyNode(cudaGraphNode_t node); + +/** + * \brief Creates an executable graph from a graph + * + * Instantiates \p graph as an executable graph. The graph is validated for any + * structural constraints or intra-node constraints which were not previously + * validated. If instantiation is successful, a handle to the instantiated graph + * is returned in \p pGraphExec. + * + * The \p flags parameter controls the behavior of instantiation and subsequent + * graph launches. Valid flags are: + * + * - ::cudaGraphInstantiateFlagAutoFreeOnLaunch, which configures a + * graph containing memory allocation nodes to automatically free any + * unfreed memory allocations before the graph is relaunched. + * + * - ::cudaGraphInstantiateFlagDeviceLaunch, which configures the graph for launch + * from the device. If this flag is passed, the executable graph handle returned can be + * used to launch the graph from both the host and device. This flag cannot be used in + * conjunction with ::cudaGraphInstantiateFlagAutoFreeOnLaunch. + * + * - ::cudaGraphInstantiateFlagUseNodePriority, which causes the graph + * to use the priorities from the per-node attributes rather than the priority + * of the launch stream during execution. Note that priorities are only available + * on kernel nodes, and are copied from stream priority during stream capture. + * + * If \p graph contains any allocation or free nodes, there can be at most one + * executable graph in existence for that graph at a time. An attempt to + * instantiate a second executable graph before destroying the first with + * ::cudaGraphExecDestroy will result in an error. + * The same also applies if \p graph contains any device-updatable kernel nodes. + * + * Graphs instantiated for launch on the device have additional restrictions which do not + * apply to host graphs: + * + * - The graph's nodes must reside on a single device. + * - The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes. + * - The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. + * Operation-specific restrictions are outlined below. + * - Kernel nodes: + * - Use of CUDA Dynamic Parallelism is not permitted. + * - Cooperative launches are permitted as long as MPS is not in use. + * - Memcpy nodes: + * - Only copies involving device memory and/or pinned device-mapped host memory are permitted. + * - Copies involving CUDA arrays are not permitted. + * - Both operands must be accessible from the current device, and the current device must + * match the device of other nodes in the graph. + * + * If \p graph is not instantiated for launch on the device but contains kernels which + * call device-side cudaGraphLaunch() from multiple devices, this will result in an error. + * + * \param pGraphExec - Returns instantiated graph + * \param graph - Graph to instantiate + * \param flags - Flags to control instantiation. See ::CUgraphInstantiate_flags. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphInstantiateWithFlags, + * ::cudaGraphCreate, + * ::cudaGraphUpload, + * ::cudaGraphLaunch, + * ::cudaGraphExecDestroy + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiate(cudaGraphExec_t *pGraphExec, cudaGraph_t graph, unsigned long long flags __dv(0)); + +/** + * \brief Creates an executable graph from a graph + * + * Instantiates \p graph as an executable graph. The graph is validated for any + * structural constraints or intra-node constraints which were not previously + * validated. If instantiation is successful, a handle to the instantiated graph + * is returned in \p pGraphExec. + * + * The \p flags parameter controls the behavior of instantiation and subsequent + * graph launches. Valid flags are: + * + * - ::cudaGraphInstantiateFlagAutoFreeOnLaunch, which configures a + * graph containing memory allocation nodes to automatically free any + * unfreed memory allocations before the graph is relaunched. + * + * - ::cudaGraphInstantiateFlagDeviceLaunch, which configures the graph for launch + * from the device. If this flag is passed, the executable graph handle returned can be + * used to launch the graph from both the host and device. This flag can only be used + * on platforms which support unified addressing. This flag cannot be used in + * conjunction with ::cudaGraphInstantiateFlagAutoFreeOnLaunch. + * + * - ::cudaGraphInstantiateFlagUseNodePriority, which causes the graph + * to use the priorities from the per-node attributes rather than the priority + * of the launch stream during execution. Note that priorities are only available + * on kernel nodes, and are copied from stream priority during stream capture. + * + * If \p graph contains any allocation or free nodes, there can be at most one + * executable graph in existence for that graph at a time. An attempt to + * instantiate a second executable graph before destroying the first with + * ::cudaGraphExecDestroy will result in an error. + * The same also applies if \p graph contains any device-updatable kernel nodes. + * + * If \p graph contains kernels which call device-side cudaGraphLaunch() from multiple + * devices, this will result in an error. + * + * Graphs instantiated for launch on the device have additional restrictions which do not + * apply to host graphs: + * + * - The graph's nodes must reside on a single device. + * - The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes. + * - The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. + * Operation-specific restrictions are outlined below. + * - Kernel nodes: + * - Use of CUDA Dynamic Parallelism is not permitted. + * - Cooperative launches are permitted as long as MPS is not in use. + * - Memcpy nodes: + * - Only copies involving device memory and/or pinned device-mapped host memory are permitted. + * - Copies involving CUDA arrays are not permitted. + * - Both operands must be accessible from the current device, and the current device must + * match the device of other nodes in the graph. + * + * \param pGraphExec - Returns instantiated graph + * \param graph - Graph to instantiate + * \param flags - Flags to control instantiation. See ::CUgraphInstantiate_flags. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphInstantiate, + * ::cudaGraphCreate, + * ::cudaGraphUpload, + * ::cudaGraphLaunch, + * ::cudaGraphExecDestroy + */ +#if __CUDART_API_VERSION >= 11040 +extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiateWithFlags(cudaGraphExec_t *pGraphExec, cudaGraph_t graph, unsigned long long flags __dv(0)); +#endif + +/** + * \brief Creates an executable graph from a graph + * + * Instantiates \p graph as an executable graph according to the \p instantiateParams structure. + * The graph is validated for any structural constraints or intra-node constraints + * which were not previously validated. If instantiation is successful, a handle to + * the instantiated graph is returned in \p pGraphExec. + * + * \p instantiateParams controls the behavior of instantiation and subsequent + * graph launches, as well as returning more detailed information in the event of an error. + * ::cudaGraphInstantiateParams is defined as: + * + * \code + typedef struct { + unsigned long long flags; + cudaStream_t uploadStream; + cudaGraphNode_t errNode_out; + cudaGraphInstantiateResult result_out; + } cudaGraphInstantiateParams; + * \endcode + * + * The \p flags field controls the behavior of instantiation and subsequent + * graph launches. Valid flags are: + * + * - ::cudaGraphInstantiateFlagAutoFreeOnLaunch, which configures a + * graph containing memory allocation nodes to automatically free any + * unfreed memory allocations before the graph is relaunched. + * + * - ::cudaGraphInstantiateFlagUpload, which will perform an upload of the graph + * into \p uploadStream once the graph has been instantiated. + * + * - ::cudaGraphInstantiateFlagDeviceLaunch, which configures the graph for launch + * from the device. If this flag is passed, the executable graph handle returned can be + * used to launch the graph from both the host and device. This flag can only be used + * on platforms which support unified addressing. This flag cannot be used in + * conjunction with ::cudaGraphInstantiateFlagAutoFreeOnLaunch. + * + * - ::cudaGraphInstantiateFlagUseNodePriority, which causes the graph + * to use the priorities from the per-node attributes rather than the priority + * of the launch stream during execution. Note that priorities are only available + * on kernel nodes, and are copied from stream priority during stream capture. + * + * If \p graph contains any allocation or free nodes, there can be at most one + * executable graph in existence for that graph at a time. An attempt to instantiate a + * second executable graph before destroying the first with ::cudaGraphExecDestroy will + * result in an error. + * The same also applies if \p graph contains any device-updatable kernel nodes. + * + * If \p graph contains kernels which call device-side cudaGraphLaunch() from multiple + * devices, this will result in an error. + * + * Graphs instantiated for launch on the device have additional restrictions which do not + * apply to host graphs: + * + * - The graph's nodes must reside on a single device. + * - The graph can only contain kernel nodes, memcpy nodes, memset nodes, and child graph nodes. + * - The graph cannot be empty and must contain at least one kernel, memcpy, or memset node. + * Operation-specific restrictions are outlined below. + * - Kernel nodes: + * - Use of CUDA Dynamic Parallelism is not permitted. + * - Cooperative launches are permitted as long as MPS is not in use. + * - Memcpy nodes: + * - Only copies involving device memory and/or pinned device-mapped host memory are permitted. + * - Copies involving CUDA arrays are not permitted. + * - Both operands must be accessible from the current device, and the current device must + * match the device of other nodes in the graph. + * + * In the event of an error, the \p result_out and \p errNode_out fields will contain more + * information about the nature of the error. Possible error reporting includes: + * + * - ::cudaGraphInstantiateError, if passed an invalid value or if an unexpected error occurred + * which is described by the return value of the function. \p errNode_out will be set to NULL. + * - ::cudaGraphInstantiateInvalidStructure, if the graph structure is invalid. \p errNode_out + * will be set to one of the offending nodes. + * - ::cudaGraphInstantiateNodeOperationNotSupported, if the graph is instantiated for device + * launch but contains a node of an unsupported node type, or a node which performs unsupported + * operations, such as use of CUDA dynamic parallelism within a kernel node. \p errNode_out will + * be set to this node. + * - ::cudaGraphInstantiateMultipleDevicesNotSupported, if the graph is instantiated for device + * launch but a node’s device differs from that of another node. This error can also be returned + * if a graph is not instantiated for device launch and it contains kernels which call device-side + * cudaGraphLaunch() from multiple devices. \p errNode_out will be set to this node. + * + * If instantiation is successful, \p result_out will be set to ::cudaGraphInstantiateSuccess, + * and \p hErrNode_out will be set to NULL. + * + * \param pGraphExec - Returns instantiated graph + * \param graph - Graph to instantiate + * \param instantiateParams - Instantiation parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphCreate, + * ::cudaGraphInstantiate, + * ::cudaGraphInstantiateWithFlags, + * ::cudaGraphExecDestroy + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiateWithParams(cudaGraphExec_t *pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams *instantiateParams); + +/** + * \brief Query the instantiation flags of an executable graph + * + * Returns the flags that were passed to instantiation for the given executable graph. + * ::cudaGraphInstantiateFlagUpload will not be returned by this API as it does + * not affect the resulting executable graph. + * + * \param graphExec - The executable graph to query + * \param flags - Returns the instantiation flags + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphInstantiate, + * ::cudaGraphInstantiateWithFlags, + * ::cudaGraphInstantiateWithParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long *flags); + +/** + * \brief Sets the parameters for a kernel node in the given graphExec + * + * Sets the parameters of a kernel node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p node in the + * non-executable graph, from which the executable graph was instantiated. + * + * \p node must not have been removed from the original graph. All \p nodeParams + * fields may change, but the following restrictions apply to \p func updates: + * + * - The owning device of the function cannot change. + * - A node whose function originally did not use CUDA dynamic parallelism cannot be updated + * to a function which uses CDP + * - A node whose function originally did not make device-side update calls cannot be updated + * to a function which makes device-side update calls. + * - If \p hGraphExec was not instantiated for device launch, a node whose function originally + * did not use device-side cudaGraphLaunch() cannot be updated to a function which uses + * device-side cudaGraphLaunch() unless the node resides on the same device as nodes which + * contained such calls at instantiate-time. If no such calls were present at instantiation, + * these updates cannot be performed at all. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p node is also not modified by this call. + * + * If \p node is a device-updatable kernel node, the next upload/launch of \p hGraphExec + * will overwrite any previous device-side updates. Additionally, applying host updates to a + * device-updatable kernel node while it is being updated from the device will result in + * undefined behavior. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param node - kernel node from the graph from which graphExec was instantiated + * \param pNodeParams - Updated Parameters to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphExecNodeSetParams, + * ::cudaGraphAddKernelNode, + * ::cudaGraphKernelNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const struct cudaKernelNodeParams *pNodeParams); + +/** + * \brief Sets the parameters for a memcpy node in the given graphExec. + * + * Updates the work represented by \p node in \p hGraphExec as though \p node had + * contained \p pNodeParams at instantiation. \p node must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from \p node are ignored. + * + * The source and destination memory in \p pNodeParams must be allocated from the same + * contexts as the original source and destination memory. Both the instantiation-time + * memory operands and the memory operands in \p pNodeParams must be 1-dimensional. + * Zero-length operations are not supported. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. \p node is also + * not modified by this call. + * + * Returns ::cudaErrorInvalidValue if the memory operands' mappings changed or + * either the original or new memory operands are multidimensional. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param node - Memcpy node from the graph which was used to instantiate graphExec + * \param pNodeParams - Updated Parameters to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphExecNodeSetParams, + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParamsToSymbol, + * ::cudaGraphExecMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphExecMemcpyNodeSetParams1D, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const struct cudaMemcpy3DParms *pNodeParams); + +/** + * \brief Sets the parameters for a memcpy node in the given graphExec to copy to a symbol on the device + * + * Updates the work represented by \p node in \p hGraphExec as though \p node had + * contained the given params at instantiation. \p node must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from \p node are ignored. + * + * \p src and \p symbol must be allocated from the same contexts as the original source and + * destination memory. The instantiation-time memory operands must be 1-dimensional. + * Zero-length operations are not supported. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. \p node is also + * not modified by this call. + * + * Returns ::cudaErrorInvalidValue if the memory operands' mappings changed or + * the original memory operands are multidimensional. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param node - Memcpy node from the graph which was used to instantiate graphExec + * \param symbol - Device symbol address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemcpyNodeToSymbol, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsToSymbol, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParamsToSymbol( + cudaGraphExec_t hGraphExec, + cudaGraphNode_t node, + const void* symbol, + const void* src, + size_t count, + size_t offset, + enum cudaMemcpyKind kind); +#endif + +/** + * \brief Sets the parameters for a memcpy node in the given graphExec to copy from a symbol on the device + * + * Updates the work represented by \p node in \p hGraphExec as though \p node had + * contained the given params at instantiation. \p node must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from \p node are ignored. + * + * \p symbol and \p dst must be allocated from the same contexts as the original source and + * destination memory. The instantiation-time memory operands must be 1-dimensional. + * Zero-length operations are not supported. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. \p node is also + * not modified by this call. + * + * Returns ::cudaErrorInvalidValue if the memory operands' mappings changed or + * the original memory operands are multidimensional. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param node - Memcpy node from the graph which was used to instantiate graphExec + * \param dst - Destination memory address + * \param symbol - Device symbol address + * \param count - Size in bytes to copy + * \param offset - Offset from start of symbol in bytes + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemcpyNodeFromSymbol, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParamsFromSymbol, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParamsToSymbol, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParamsFromSymbol( + cudaGraphExec_t hGraphExec, + cudaGraphNode_t node, + void* dst, + const void* symbol, + size_t count, + size_t offset, + enum cudaMemcpyKind kind); +#endif + +/** + * \brief Sets the parameters for a memcpy node in the given graphExec to perform a 1-dimensional copy + * + * Updates the work represented by \p node in \p hGraphExec as though \p node had + * contained the given params at instantiation. \p node must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from \p node are ignored. + * + * \p src and \p dst must be allocated from the same contexts as the original source + * and destination memory. The instantiation-time memory operands must be 1-dimensional. + * Zero-length operations are not supported. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. \p node is also + * not modified by this call. + * + * Returns ::cudaErrorInvalidValue if the memory operands' mappings changed or + * the original memory operands are multidimensional. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param node - Memcpy node from the graph which was used to instantiate graphExec + * \param dst - Destination memory address + * \param src - Source memory address + * \param count - Size in bytes to copy + * \param kind - Type of transfer + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddMemcpyNode, + * ::cudaGraphAddMemcpyNode1D, + * ::cudaGraphMemcpyNodeSetParams, + * ::cudaGraphMemcpyNodeSetParams1D, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParams1D( + cudaGraphExec_t hGraphExec, + cudaGraphNode_t node, + void* dst, + const void* src, + size_t count, + enum cudaMemcpyKind kind); +#endif + +/** + * \brief Sets the parameters for a memset node in the given graphExec. + * + * Updates the work represented by \p node in \p hGraphExec as though \p node had + * contained \p pNodeParams at instantiation. \p node must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from \p node are ignored. + * + * The destination memory in \p pNodeParams must be allocated from the same + * context as the original destination memory. Both the instantiation-time + * memory operand and the memory operand in \p pNodeParams must be 1-dimensional. + * Zero-length operations are not supported. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. \p node is also + * not modified by this call. + * + * Returns cudaErrorInvalidValue if the memory operand's mappings changed or + * either the original or new memory operand are multidimensional. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param node - Memset node from the graph which was used to instantiate graphExec + * \param pNodeParams - Updated Parameters to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphExecNodeSetParams, + * ::cudaGraphAddMemsetNode, + * ::cudaGraphMemsetNodeSetParams, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const struct cudaMemsetParams *pNodeParams); + +/** + * \brief Sets the parameters for a host node in the given graphExec. + * + * Updates the work represented by \p node in \p hGraphExec as though \p node had + * contained \p pNodeParams at instantiation. \p node must remain in the graph which was + * used to instantiate \p hGraphExec. Changed edges to and from \p node are ignored. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. \p node is also + * not modified by this call. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param node - Host node from the graph which was used to instantiate graphExec + * \param pNodeParams - Updated Parameters to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphExecNodeSetParams, + * ::cudaGraphAddHostNode, + * ::cudaGraphHostNodeSetParams, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const struct cudaHostNodeParams *pNodeParams); + +/** + * \brief Updates node parameters in the child graph node in the given graphExec. + * + * Updates the work represented by \p node in \p hGraphExec as though the nodes contained + * in \p node's graph had the parameters contained in \p childGraph's nodes at instantiation. + * \p node must remain in the graph which was used to instantiate \p hGraphExec. + * Changed edges to and from \p node are ignored. + * + * The modifications only affect future launches of \p hGraphExec. Already enqueued + * or running launches of \p hGraphExec are not affected by this call. \p node is also + * not modified by this call. + * + * The topology of \p childGraph, as well as the node insertion order, must match that + * of the graph contained in \p node. See ::cudaGraphExecUpdate() for a list of restrictions + * on what can be updated in an instantiated graph. The update is recursive, so child graph + * nodes contained within the top level child graph will also be updated. + + * \param hGraphExec - The executable graph in which to set the specified node + * \param node - Host node from the graph which was used to instantiate graphExec + * \param childGraph - The graph supplying the updated parameters + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphExecNodeSetParams, + * ::cudaGraphAddChildGraphNode, + * ::cudaGraphChildGraphNodeGetGraph, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph); +#endif + +/** + * \brief Sets the event for an event record node in the given graphExec + * + * Sets the event of an event record node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p hNode in the + * non-executable graph, from which the executable graph was instantiated. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Event record node from the graph from which graphExec was instantiated + * \param event - Updated event to use + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphExecNodeSetParams, + * ::cudaGraphAddEventRecordNode, + * ::cudaGraphEventRecordNodeGetEvent, + * ::cudaGraphEventWaitNodeSetEvent, + * ::cudaEventRecordWithFlags, + * ::cudaStreamWaitEvent, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event); +#endif + +/** + * \brief Sets the event for an event wait node in the given graphExec + * + * Sets the event of an event wait node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p hNode in the + * non-executable graph, from which the executable graph was instantiated. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Event wait node from the graph from which graphExec was instantiated + * \param event - Updated event to use + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphExecNodeSetParams, + * ::cudaGraphAddEventWaitNode, + * ::cudaGraphEventWaitNodeGetEvent, + * ::cudaGraphEventRecordNodeSetEvent, + * ::cudaEventRecordWithFlags, + * ::cudaStreamWaitEvent, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event); +#endif + +/** + * \brief Sets the parameters for an external semaphore signal node in the given graphExec + * + * Sets the parameters of an external semaphore signal node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p hNode in the + * non-executable graph, from which the executable graph was instantiated. + * + * \p hNode must not have been removed from the original graph. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * Changing \p nodeParams->numExtSems is not supported. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - semaphore signal node from the graph from which graphExec was instantiated + * \param nodeParams - Updated Parameters to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphExecNodeSetParams, + * ::cudaGraphAddExternalSemaphoresSignalNode, + * ::cudaImportExternalSemaphore, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresWaitNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +#if __CUDART_API_VERSION >= 11020 +extern __host__ cudaError_t CUDARTAPI cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const struct cudaExternalSemaphoreSignalNodeParams *nodeParams); +#endif + +/** + * \brief Sets the parameters for an external semaphore wait node in the given graphExec + * + * Sets the parameters of an external semaphore wait node in an executable graph \p hGraphExec. + * The node is identified by the corresponding node \p hNode in the + * non-executable graph, from which the executable graph was instantiated. + * + * \p hNode must not have been removed from the original graph. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * Changing \p nodeParams->numExtSems is not supported. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - semaphore wait node from the graph from which graphExec was instantiated + * \param nodeParams - Updated Parameters to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphExecNodeSetParams, + * ::cudaGraphAddExternalSemaphoresWaitNode, + * ::cudaImportExternalSemaphore, + * ::cudaSignalExternalSemaphoresAsync, + * ::cudaWaitExternalSemaphoresAsync, + * ::cudaGraphExecKernelNodeSetParams, + * ::cudaGraphExecMemcpyNodeSetParams, + * ::cudaGraphExecMemsetNodeSetParams, + * ::cudaGraphExecHostNodeSetParams, + * ::cudaGraphExecChildGraphNodeSetParams, + * ::cudaGraphExecEventRecordNodeSetEvent, + * ::cudaGraphExecEventWaitNodeSetEvent, + * ::cudaGraphExecExternalSemaphoresSignalNodeSetParams, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +#if __CUDART_API_VERSION >= 11020 +extern __host__ cudaError_t CUDARTAPI cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const struct cudaExternalSemaphoreWaitNodeParams *nodeParams); +#endif + +/** + * \brief Enables or disables the specified node in the given graphExec + * + * Sets \p hNode to be either enabled or disabled. Disabled nodes are functionally equivalent + * to empty nodes until they are reenabled. Existing node parameters are not affected by + * disabling/enabling the node. + * + * The node is identified by the corresponding node \p hNode in the non-executable + * graph, from which the executable graph was instantiated. + * + * \p hNode must not have been removed from the original graph. + * + * The modifications only affect future launches of \p hGraphExec. Already + * enqueued or running launches of \p hGraphExec are not affected by this call. + * \p hNode is also not modified by this call. + * + * \note Currently only kernel, memset and memcpy nodes are supported. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Node from the graph from which graphExec was instantiated + * \param isEnabled - Node is enabled if != 0, otherwise the node is disabled + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeGetEnabled, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + * ::cudaGraphLaunch + */ +#if __CUDART_API_VERSION >= 11060 +extern __host__ cudaError_t CUDARTAPI cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled); +#endif + +/** + * \brief Query whether a node in the given graphExec is enabled + * + * Sets isEnabled to 1 if \p hNode is enabled, or 0 if \p hNode is disabled. + * + * The node is identified by the corresponding node \p hNode in the non-executable + * graph, from which the executable graph was instantiated. + * + * \p hNode must not have been removed from the original graph. + * + * \note Currently only kernel, memset and memcpy nodes are supported. + * + * \param hGraphExec - The executable graph in which to set the specified node + * \param hNode - Node from the graph from which graphExec was instantiated + * \param isEnabled - Location to return the enabled status of the node + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphNodeSetEnabled, + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + * ::cudaGraphLaunch + */ +#if __CUDART_API_VERSION >= 11060 +extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int *isEnabled); +#endif + +/** + * \brief Check whether an executable graph can be updated with a graph and perform the update if possible + * + * Updates the node parameters in the instantiated graph specified by \p hGraphExec with the + * node parameters in a topologically identical graph specified by \p hGraph. + * + * Limitations: + * + * - Kernel nodes: + * - The owning context of the function cannot change. + * - A node whose function originally did not use CUDA dynamic parallelism cannot be updated + * to a function which uses CDP. + * - A node whose function originally did not make device-side update calls cannot be updated + * to a function which makes device-side update calls. + * - A cooperative node cannot be updated to a non-cooperative node, and vice-versa. + * - If the graph was instantiated with cudaGraphInstantiateFlagUseNodePriority, the + * priority attribute cannot change. Equality is checked on the originally requested + * priority values, before they are clamped to the device's supported range. + * - If \p hGraphExec was not instantiated for device launch, a node whose function originally + * did not use device-side cudaGraphLaunch() cannot be updated to a function which uses + * device-side cudaGraphLaunch() unless the node resides on the same device as nodes which + * contained such calls at instantiate-time. If no such calls were present at instantiation, + * these updates cannot be performed at all. + * - Neither \p hGraph nor \p hGraphExec may contain device-updatable kernel nodes. + * - Memset and memcpy nodes: + * - The CUDA device(s) to which the operand(s) was allocated/mapped cannot change. + * - The source/destination memory must be allocated from the same contexts as the original + * source/destination memory. + * - Only 1D memsets can be changed. + * - Additional memcpy node restrictions: + * - Changing either the source or destination memory type(i.e. CU_MEMORYTYPE_DEVICE, + * CU_MEMORYTYPE_ARRAY, etc.) is not supported. + * - Conditional nodes: + * - Changing node parameters is not supported. + * - Changeing parameters of nodes within the conditional body graph is subject to the rules above. + * - Conditional handle flags and default values are updated as part of the graph update. + * + * Note: The API may add further restrictions in future releases. The return code should always be checked. + * + * cudaGraphExecUpdate sets the result member of \p resultInfo to cudaGraphExecUpdateErrorTopologyChanged + * under the following conditions: + * - The count of nodes directly in \p hGraphExec and \p hGraph differ, in which case resultInfo->errorNode + * is set to NULL. + * - \p hGraph has more exit nodes than \p hGraph, in which case resultInfo->errorNode is set to one of + * the exit nodes in hGraph. + * - A node in \p hGraph has a different number of dependencies than the node from \p hGraphExec it is paired with, + * in which case resultInfo->errorNode is set to the node from \p hGraph. + * - A node in \p hGraph has a dependency that does not match with the corresponding dependency of the paired node + * from \p hGraphExec. resultInfo->errorNode will be set to the node from \p hGraph. resultInfo->errorFromNode + * will be set to the mismatched dependency. The dependencies are paired based on edge order and a dependency + * does not match when the nodes are already paired based on other edges examined in the graph. + * + * cudaGraphExecUpdate sets \p the result member of \p resultInfo to: + * - cudaGraphExecUpdateError if passed an invalid value. + * - cudaGraphExecUpdateErrorTopologyChanged if the graph topology changed + * - cudaGraphExecUpdateErrorNodeTypeChanged if the type of a node changed, in which case + * \p hErrorNode_out is set to the node from \p hGraph. + * - cudaGraphExecUpdateErrorFunctionChanged if the function of a kernel node changed (CUDA driver < 11.2) + * - cudaGraphExecUpdateErrorUnsupportedFunctionChange if the func field of a kernel changed in an + * unsupported way(see note above), in which case \p hErrorNode_out is set to the node from \p hGraph + * - cudaGraphExecUpdateErrorParametersChanged if any parameters to a node changed in a way + * that is not supported, in which case \p hErrorNode_out is set to the node from \p hGraph + * - cudaGraphExecUpdateErrorAttributesChanged if any attributes of a node changed in a way + * that is not supported, in which case \p hErrorNode_out is set to the node from \p hGraph + * - cudaGraphExecUpdateErrorNotSupported if something about a node is unsupported, like + * the node's type or configuration, in which case \p hErrorNode_out is set to the node from \p hGraph + * + * If the update fails for a reason not listed above, the result member of \p resultInfo will be set + * to cudaGraphExecUpdateError. If the update succeeds, the result member will be set to cudaGraphExecUpdateSuccess. + * + * cudaGraphExecUpdate returns cudaSuccess when the updated was performed successfully. It returns + * cudaErrorGraphExecUpdateFailure if the graph update was not performed because it included + * changes which violated constraints specific to instantiated graph update. + * + * \param hGraphExec The instantiated graph to be updated + * \param hGraph The graph containing the updated parameters + \param resultInfo the error info structure + * + * \return + * ::cudaSuccess, + * ::cudaErrorGraphExecUpdateFailure, + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphInstantiate + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo *resultInfo); + +/** + * \brief Uploads an executable graph in a stream + * + * Uploads \p hGraphExec to the device in \p hStream without executing it. Uploads of + * the same \p hGraphExec will be serialized. Each upload is ordered behind both any + * previous work in \p hStream and any previous launches of \p hGraphExec. + * Uses memory cached by \p stream to back the allocations owned by \p graphExec. + * + * \param hGraphExec - Executable graph to upload + * \param hStream - Stream in which to upload the graph + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * \notefnerr + * \note_init_rt + * + * \sa + * ::cudaGraphInstantiate, + * ::cudaGraphLaunch, + * ::cudaGraphExecDestroy + */ +#if __CUDART_API_VERSION >= 11010 + extern __host__ cudaError_t CUDARTAPI cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream); +#endif + +/** + * \brief Launches an executable graph in a stream + * + * Executes \p graphExec in \p stream. Only one instance of \p graphExec may be executing + * at a time. Each launch is ordered behind both any previous work in \p stream + * and any previous launches of \p graphExec. To execute a graph concurrently, it must be + * instantiated multiple times into multiple executable graphs. + * + * If any allocations created by \p graphExec remain unfreed (from a previous launch) and + * \p graphExec was not instantiated with ::cudaGraphInstantiateFlagAutoFreeOnLaunch, + * the launch will fail with ::cudaErrorInvalidValue. + * + * \param graphExec - Executable graph to launch + * \param stream - Stream in which to launch the graph + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphInstantiate, + * ::cudaGraphUpload, + * ::cudaGraphExecDestroy + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream); + +/** + * \brief Destroys an executable graph + * + * Destroys the executable graph specified by \p graphExec. + * + * \param graphExec - Executable graph to destroy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * \note_destroy_ub + * + * \sa + * ::cudaGraphInstantiate, + * ::cudaGraphUpload, + * ::cudaGraphLaunch + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphExecDestroy(cudaGraphExec_t graphExec); + +/** + * \brief Destroys a graph + * + * Destroys the graph specified by \p graph, as well as all of its nodes. + * + * \param graph - Graph to destroy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * \note_destroy_ub + * + * \sa + * ::cudaGraphCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphDestroy(cudaGraph_t graph); + +/** + * \brief Write a DOT file describing graph structure + * + * Using the provided \p graph, write to \p path a DOT formatted description of the graph. + * By default this includes the graph topology, node types, node id, kernel names and memcpy direction. + * \p flags can be specified to write more detailed information about each node type such as + * parameter values, kernel attributes, node and function handles. + * + * \param graph - The graph to create a DOT file from + * \param path - The path to write the DOT file to + * \param flags - Flags from cudaGraphDebugDotFlags for specifying which additional node information to write + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorOperatingSystem + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphDebugDotPrint(cudaGraph_t graph, const char *path, unsigned int flags); + +/** + * \brief Create a user object + * + * Create a user object with the specified destructor callback and initial reference count. The + * initial references are owned by the caller. + * + * Destructor callbacks cannot make CUDA API calls and should avoid blocking behavior, as they + * are executed by a shared internal thread. Another thread may be signaled to perform such + * actions, if it does not block forward progress of tasks scheduled through CUDA. + * + * See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. + * + * \param object_out - Location to return the user object handle + * \param ptr - The pointer to pass to the destroy function + * \param destroy - Callback to free the user object when it is no longer in use + * \param initialRefcount - The initial refcount to create the object with, typically 1. The + * initial references are owned by the calling thread. + * \param flags - Currently it is required to pass ::cudaUserObjectNoDestructorSync, + * which is the only defined flag. This indicates that the destroy + * callback cannot be waited on by any CUDA API. Users requiring + * synchronization of the callback should signal its completion + * manually. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * + * \sa + * ::cudaUserObjectRetain, + * ::cudaUserObjectRelease, + * ::cudaGraphRetainUserObject, + * ::cudaGraphReleaseUserObject, + * ::cudaGraphCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaUserObjectCreate(cudaUserObject_t *object_out, void *ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags); + +/** + * \brief Retain a reference to a user object + * + * Retains new references to a user object. The new references are owned by the caller. + * + * See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. + * + * \param object - The object to retain + * \param count - The number of references to retain, typically 1. Must be nonzero + * and not larger than INT_MAX. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * + * \sa + * ::cudaUserObjectCreate, + * ::cudaUserObjectRelease, + * ::cudaGraphRetainUserObject, + * ::cudaGraphReleaseUserObject, + * ::cudaGraphCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaUserObjectRetain(cudaUserObject_t object, unsigned int count __dv(1)); + +/** + * \brief Release a reference to a user object + * + * Releases user object references owned by the caller. The object's destructor is invoked if + * the reference count reaches zero. + * + * It is undefined behavior to release references not owned by the caller, or to use a user + * object handle after all references are released. + * + * See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. + * + * \param object - The object to release + * \param count - The number of references to release, typically 1. Must be nonzero + * and not larger than INT_MAX. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * + * \sa + * ::cudaUserObjectCreate, + * ::cudaUserObjectRetain, + * ::cudaGraphRetainUserObject, + * ::cudaGraphReleaseUserObject, + * ::cudaGraphCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaUserObjectRelease(cudaUserObject_t object, unsigned int count __dv(1)); + +/** + * \brief Retain a reference to a user object from a graph + * + * Creates or moves user object references that will be owned by a CUDA graph. + * + * See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. + * + * \param graph - The graph to associate the reference with + * \param object - The user object to retain a reference for + * \param count - The number of references to add to the graph, typically 1. Must be + * nonzero and not larger than INT_MAX. + * \param flags - The optional flag ::cudaGraphUserObjectMove transfers references + * from the calling thread, rather than create new references. Pass 0 + * to create new references. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * + * \sa + * ::cudaUserObjectCreate + * ::cudaUserObjectRetain, + * ::cudaUserObjectRelease, + * ::cudaGraphReleaseUserObject, + * ::cudaGraphCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count __dv(1), unsigned int flags __dv(0)); + +/** + * \brief Release a user object reference from a graph + * + * Releases user object references owned by a graph. + * + * See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects. + * + * \param graph - The graph that will release the reference + * \param object - The user object to release a reference for + * \param count - The number of references to release, typically 1. Must be nonzero + * and not larger than INT_MAX. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue + * + * \sa + * ::cudaUserObjectCreate + * ::cudaUserObjectRetain, + * ::cudaUserObjectRelease, + * ::cudaGraphRetainUserObject, + * ::cudaGraphCreate + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count __dv(1)); + +/** + * \brief Adds a node of arbitrary type to a graph + * + * Creates a new node in \p graph described by \p nodeParams with \p numDependencies + * dependencies specified via \p pDependencies. \p numDependencies may be 0. + * \p pDependencies may be null if \p numDependencies is 0. \p pDependencies may not have + * any duplicate entries. + * + * \p nodeParams is a tagged union. The node type should be specified in the \p type field, + * and type-specific parameters in the corresponding union member. All unused bytes - that + * is, \p reserved0 and all bytes past the utilized union member - must be set to zero. + * It is recommended to use brace initialization or memset to ensure all bytes are + * initialized. + * + * Note that for some node types, \p nodeParams may contain "out parameters" which are + * modified during the call, such as \p nodeParams->alloc.dptr. + * + * A handle to the new node will be returned in \p phGraphNode. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param numDependencies - Number of dependencies + * \param nodeParams - Specification of the node + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorNotSupported + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphCreate, + * ::cudaGraphNodeSetParams, + * ::cudaGraphExecNodeSetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphAddNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, size_t numDependencies, struct cudaGraphNodeParams *nodeParams); + +/** + * \brief Adds a node of arbitrary type to a graph (12.3+) + * + * Creates a new node in \p graph described by \p nodeParams with \p numDependencies + * dependencies specified via \p pDependencies. \p numDependencies may be 0. + * \p pDependencies may be null if \p numDependencies is 0. \p pDependencies may not have + * any duplicate entries. + * + * \p nodeParams is a tagged union. The node type should be specified in the \p type field, + * and type-specific parameters in the corresponding union member. All unused bytes - that + * is, \p reserved0 and all bytes past the utilized union member - must be set to zero. + * It is recommended to use brace initialization or memset to ensure all bytes are + * initialized. + * + * Note that for some node types, \p nodeParams may contain "out parameters" which are + * modified during the call, such as \p nodeParams->alloc.dptr. + * + * A handle to the new node will be returned in \p phGraphNode. + * + * \param pGraphNode - Returns newly created node + * \param graph - Graph to which to add the node + * \param pDependencies - Dependencies of the node + * \param dependencyData - Optional edge data for the dependencies. If NULL, the data is + * assumed to be default (zeroed) for all dependencies. + * \param numDependencies - Number of dependencies + * \param nodeParams - Specification of the node + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorNotSupported + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphCreate, + * ::cudaGraphNodeSetParams, + * ::cudaGraphExecNodeSetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphAddNode_v2(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, const cudaGraphNode_t *pDependencies, const cudaGraphEdgeData *dependencyData, size_t numDependencies, struct cudaGraphNodeParams *nodeParams); + +/** + * \brief Update's a graph node's parameters + * + * Sets the parameters of graph node \p node to \p nodeParams. The node type specified by + * \p nodeParams->type must match the type of \p node. \p nodeParams must be fully + * initialized and all unused bytes (reserved, padding) zeroed. + * + * Modifying parameters is not supported for node types cudaGraphNodeTypeMemAlloc and + * cudaGraphNodeTypeMemFree. + * + * \param node - Node to set the parameters for + * \param nodeParams - Parameters to copy + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorNotSupported + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaGraphExecNodeSetParams + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphNodeSetParams(cudaGraphNode_t node, struct cudaGraphNodeParams *nodeParams); + +/** + * \brief Update's a graph node's parameters in an instantiated graph + * + * Sets the parameters of a node in an executable graph \p graphExec. The node is identified + * by the corresponding node \p node in the non-executable graph from which the executable + * graph was instantiated. \p node must not have been removed from the original graph. + * + * The modifications only affect future launches of \p graphExec. Already + * enqueued or running launches of \p graphExec are not affected by this call. + * \p node is also not modified by this call. + * + * Allowed changes to parameters on executable graphs are as follows: + * + *
Node typeAllowed changes + *
kernelSee ::cudaGraphExecKernelNodeSetParams + *
memcpyAddresses for 1-dimensional copies if allocated in same context; see ::cudaGraphExecMemcpyNodeSetParams + *
memsetAddresses for 1-dimensional memsets if allocated in same context; see ::cudaGraphExecMemsetNodeSetParams + *
hostUnrestricted + *
child graphTopology must match and restrictions apply recursively; see ::cudaGraphExecUpdate + *
event waitUnrestricted + *
event recordUnrestricted + *
external semaphore signalNumber of semaphore operations cannot change + *
external semaphore waitNumber of semaphore operations cannot change + *
memory allocationAPI unsupported + *
memory freeAPI unsupported + *
+ * + * \param graphExec - The executable graph in which to update the specified node + * \param node - Corresponding node from the graph from which graphExec was instantiated + * \param nodeParams - Updated Parameters to set + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorInvalidDeviceFunction, + * ::cudaErrorNotSupported + * \note_graph_thread_safety + * \notefnerr + * \note_init_rt + * \note_callback + * + * \sa + * ::cudaGraphAddNode, + * ::cudaGraphNodeSetParams + * ::cudaGraphExecUpdate, + * ::cudaGraphInstantiate + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, struct cudaGraphNodeParams *nodeParams); + +/** + * \brief Create a conditional handle + * + * Creates a conditional handle associated with \p hGraph. + * + * The conditional handle must be associated with a conditional node in this graph or one of its children. + * + * Handles not associated with a conditional node may cause graph instantiation to fail. + * + * \param pHandle_out - Pointer used to return the handle to the caller. + * \param hGraph - Graph which will contain the conditional node using this handle. + * \param defaultLaunchValue - Optional initial value for the conditional variable. + * \param flags - Currently must be cudaGraphCondAssignDefault or 0. + * + * \return + * ::CUDA_SUCCESS, + * ::CUDA_ERROR_INVALID_VALUE, + * ::CUDA_ERROR_NOT_SUPPORTED + * \note_graph_thread_safety + * \notefnerr + * + * \sa + * ::cuGraphAddNode, + */ +extern __host__ cudaError_t CUDARTAPI cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle *pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue __dv(0), unsigned int flags __dv(0)); + +/** @} */ /* END CUDART_GRAPH */ + +/** + * \defgroup CUDART_DRIVER_ENTRY_POINT Driver Entry Point Access + * + * ___MANBRIEF___ driver entry point access functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the driver entry point access functions of CUDA + * runtime application programming interface. + * + * @{ + */ + +/** + * \brief Returns the requested driver API function pointer + * + * Returns in \p **funcPtr the address of the CUDA driver function for the requested flags. + * + * For a requested driver symbol, if the CUDA version in which the driver symbol was + * introduced is less than or equal to the CUDA runtime version, the API will return + * the function pointer to the corresponding versioned driver function. + * + * The pointer returned by the API should be cast to a function pointer matching the + * requested driver function's definition in the API header file. The function pointer + * typedef can be picked up from the corresponding typedefs header file. For example, + * cudaTypedefs.h consists of function pointer typedefs for driver APIs defined in cuda.h. + * + * The API will return ::cudaSuccess and set the returned \p funcPtr to NULL if the + * requested driver function is not supported on the platform, no ABI + * compatible driver function exists for the CUDA runtime version or if the + * driver symbol is invalid. + * + * It will also set the optional \p driverStatus to one of the values in + * ::cudaDriverEntryPointQueryResult with the following meanings: + * - ::cudaDriverEntryPointSuccess - The requested symbol was succesfully found based + * on input arguments and \p pfn is valid + * - ::cudaDriverEntryPointSymbolNotFound - The requested symbol was not found + * - ::cudaDriverEntryPointVersionNotSufficent - The requested symbol was found but is + * not supported by the current runtime version (CUDART_VERSION) + * + * The requested flags can be: + * - ::cudaEnableDefault: This is the default mode. This is equivalent to + * ::cudaEnablePerThreadDefaultStream if the code is compiled with + * --default-stream per-thread compilation flag or the macro CUDA_API_PER_THREAD_DEFAULT_STREAM + * is defined; ::cudaEnableLegacyStream otherwise. + * - ::cudaEnableLegacyStream: This will enable the search for all driver symbols + * that match the requested driver symbol name except the corresponding per-thread versions. + * - ::cudaEnablePerThreadDefaultStream: This will enable the search for all + * driver symbols that match the requested driver symbol name including the per-thread + * versions. If a per-thread version is not found, the API will return the legacy version + * of the driver function. + * + * \param symbol - The base name of the driver API function to look for. As an example, + * for the driver API ::cuMemAlloc_v2, \p symbol would be cuMemAlloc. + * Note that the API will use the CUDA runtime version to return the + * address to the most recent ABI compatible driver symbol, ::cuMemAlloc + * or ::cuMemAlloc_v2. + * \param funcPtr - Location to return the function pointer to the requested driver function + * \param flags - Flags to specify search options. + * \param driverStatus - Optional location to store the status of finding the symbol from + * the driver. See ::cudaDriverEntryPointQueryResult for + * possible values. + * + * \return + * ::cudaSuccess, + * ::cudaErrorInvalidValue, + * ::cudaErrorNotSupported + * \note_version_mixing + * \note_init_rt + * \note_callback + * + * \sa + * ::cuGetProcAddress + */ +#if defined(__cplusplus) +extern __host__ cudaError_t CUDARTAPI cudaGetDriverEntryPoint(const char *symbol, void **funcPtr, unsigned long long flags, enum cudaDriverEntryPointQueryResult *driverStatus = NULL); +#else +extern __host__ cudaError_t CUDARTAPI cudaGetDriverEntryPoint(const char *symbol, void **funcPtr, unsigned long long flags, enum cudaDriverEntryPointQueryResult *driverStatus); +#endif + +/** @} */ /* END CUDART_DRIVER_ENTRY_POINT */ + +/** \cond impl_private */ +extern __host__ cudaError_t CUDARTAPI cudaGetExportTable(const void **ppExportTable, const cudaUUID_t *pExportTableId); +/** \endcond impl_private */ + +/** + * \defgroup CUDART_HIGHLEVEL C++ API Routines + * + * ___MANBRIEF___ C++ high level API functions of the CUDA runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the C++ high level API functions of the CUDA runtime + * application programming interface. To use these functions, your + * application needs to be compiled with the \p nvcc compiler. + * + * \brief C++-style interface built on top of CUDA runtime API + */ + +/** + * \defgroup CUDART_DRIVER Interactions with the CUDA Driver API + * + * ___MANBRIEF___ interactions between CUDA Driver API and CUDA Runtime API + * (___CURRENT_FILE___) ___ENDMANBRIEF___ + * + * This section describes the interactions between the CUDA Driver API and the CUDA Runtime API + * + * @{ + * + * \section CUDART_CUDA_primary Primary Contexts + * + * There exists a one to one relationship between CUDA devices in the CUDA Runtime + * API and ::CUcontext s in the CUDA Driver API within a process. The specific + * context which the CUDA Runtime API uses for a device is called the device's + * primary context. From the perspective of the CUDA Runtime API, a device and + * its primary context are synonymous. + * + * \section CUDART_CUDA_init Initialization and Tear-Down + * + * CUDA Runtime API calls operate on the CUDA Driver API ::CUcontext which is current to + * to the calling host thread. + * + * The function ::cudaInitDevice() ensures that the primary context is initialized + * for the requested device but does not make it current to the calling thread. + * + * The function ::cudaSetDevice() initializes the primary context for the + * specified device and makes it current to the calling thread by calling ::cuCtxSetCurrent(). + * + * The CUDA Runtime API will automatically initialize the primary context for + * a device at the first CUDA Runtime API call which requires an active context. + * If no ::CUcontext is current to the calling thread when a CUDA Runtime API call + * which requires an active context is made, then the primary context for a device + * will be selected, made current to the calling thread, and initialized. + * + * The context which the CUDA Runtime API initializes will be initialized using + * the parameters specified by the CUDA Runtime API functions + * ::cudaSetDeviceFlags(), + * ::cudaD3D9SetDirect3DDevice(), + * ::cudaD3D10SetDirect3DDevice(), + * ::cudaD3D11SetDirect3DDevice(), + * ::cudaGLSetGLDevice(), and + * ::cudaVDPAUSetVDPAUDevice(). + * Note that these functions will fail with ::cudaErrorSetOnActiveProcess if they are + * called when the primary context for the specified device has already been initialized. + * (or if the current device has already been initialized, in the case of + * ::cudaSetDeviceFlags()). + * + * Primary contexts will remain active until they are explicitly deinitialized + * using ::cudaDeviceReset(). The function ::cudaDeviceReset() will deinitialize the + * primary context for the calling thread's current device immediately. The context + * will remain current to all of the threads that it was current to. The next CUDA + * Runtime API call on any thread which requires an active context will trigger the + * reinitialization of that device's primary context. + * + * Note that primary contexts are shared resources. It is recommended that + * the primary context not be reset except just before exit or to recover from an + * unspecified launch failure. + * + * \section CUDART_CUDA_context Context Interoperability + * + * Note that the use of multiple ::CUcontext s per device within a single process + * will substantially degrade performance and is strongly discouraged. Instead, + * it is highly recommended that the implicit one-to-one device-to-context mapping + * for the process provided by the CUDA Runtime API be used. + * + * If a non-primary ::CUcontext created by the CUDA Driver API is current to a + * thread then the CUDA Runtime API calls to that thread will operate on that + * ::CUcontext, with some exceptions listed below. Interoperability between data + * types is discussed in the following sections. + * + * The function ::cudaPointerGetAttributes() will return the error + * ::cudaErrorIncompatibleDriverContext if the pointer being queried was allocated by a + * non-primary context. The function ::cudaDeviceEnablePeerAccess() and the rest of + * the peer access API may not be called when a non-primary ::CUcontext is current. + * To use the pointer query and peer access APIs with a context created using the + * CUDA Driver API, it is necessary that the CUDA Driver API be used to access + * these features. + * + * All CUDA Runtime API state (e.g, global variables' addresses and values) travels + * with its underlying ::CUcontext. In particular, if a ::CUcontext is moved from one + * thread to another then all CUDA Runtime API state will move to that thread as well. + * + * Please note that attaching to legacy contexts (those with a version of 3010 as returned + * by ::cuCtxGetApiVersion()) is not possible. The CUDA Runtime will return + * ::cudaErrorIncompatibleDriverContext in such cases. + * + * \section CUDART_CUDA_stream Interactions between CUstream and cudaStream_t + * + * The types ::CUstream and ::cudaStream_t are identical and may be used interchangeably. + * + * \section CUDART_CUDA_event Interactions between CUevent and cudaEvent_t + * + * The types ::CUevent and ::cudaEvent_t are identical and may be used interchangeably. + * + * \section CUDART_CUDA_array Interactions between CUarray and cudaArray_t + * + * The types ::CUarray and struct ::cudaArray * represent the same data type and may be used + * interchangeably by casting the two types between each other. + * + * In order to use a ::CUarray in a CUDA Runtime API function which takes a struct ::cudaArray *, + * it is necessary to explicitly cast the ::CUarray to a struct ::cudaArray *. + * + * In order to use a struct ::cudaArray * in a CUDA Driver API function which takes a ::CUarray, + * it is necessary to explicitly cast the struct ::cudaArray * to a ::CUarray . + * + * \section CUDART_CUDA_graphicsResource Interactions between CUgraphicsResource and cudaGraphicsResource_t + * + * The types ::CUgraphicsResource and ::cudaGraphicsResource_t represent the same data type and may be used + * interchangeably by casting the two types between each other. + * + * In order to use a ::CUgraphicsResource in a CUDA Runtime API function which takes a + * ::cudaGraphicsResource_t, it is necessary to explicitly cast the ::CUgraphicsResource + * to a ::cudaGraphicsResource_t. + * + * In order to use a ::cudaGraphicsResource_t in a CUDA Driver API function which takes a + * ::CUgraphicsResource, it is necessary to explicitly cast the ::cudaGraphicsResource_t + * to a ::CUgraphicsResource. + * + * \section CUDART_CUDA_texture_objects Interactions between CUtexObject and cudaTextureObject_t + * + * The types ::CUtexObject and ::cudaTextureObject_t represent the same data type and may be used + * interchangeably by casting the two types between each other. + * + * In order to use a ::CUtexObject in a CUDA Runtime API function which takes a ::cudaTextureObject_t, + * it is necessary to explicitly cast the ::CUtexObject to a ::cudaTextureObject_t. + * + * In order to use a ::cudaTextureObject_t in a CUDA Driver API function which takes a ::CUtexObject, + * it is necessary to explicitly cast the ::cudaTextureObject_t to a ::CUtexObject. + * + * \section CUDART_CUDA_surface_objects Interactions between CUsurfObject and cudaSurfaceObject_t + * + * The types ::CUsurfObject and ::cudaSurfaceObject_t represent the same data type and may be used + * interchangeably by casting the two types between each other. + * + * In order to use a ::CUsurfObject in a CUDA Runtime API function which takes a ::cudaSurfaceObject_t, + * it is necessary to explicitly cast the ::CUsurfObject to a ::cudaSurfaceObject_t. + * + * In order to use a ::cudaSurfaceObject_t in a CUDA Driver API function which takes a ::CUsurfObject, + * it is necessary to explicitly cast the ::cudaSurfaceObject_t to a ::CUsurfObject. + * + * \section CUDART_CUDA_module Interactions between CUfunction and cudaFunction_t + * + * The types ::CUfunction and ::cudaFunction_t represent the same data type and may be used + * interchangeably by casting the two types between each other. + * + * In order to use a ::cudaFunction_t in a CUDA Driver API function which takes a ::CUfunction, + * it is necessary to explicitly cast the ::cudaFunction_t to a ::CUfunction. + * + */ + + /** + * \brief Get pointer to device entry function that matches entry function \p symbolPtr + * + * Returns in \p functionPtr the device entry function corresponding to the symbol \p symbolPtr. + * + * \param functionPtr - Returns the device entry function + * \param symbolPtr - Pointer to device entry function to search for + * + * \return + * ::cudaSuccess + * + */ +extern __host__ cudaError_t cudaGetFuncBySymbol(cudaFunction_t* functionPtr, const void* symbolPtr); + +/** + * \brief Get pointer to device kernel that matches entry function \p entryFuncAddr + * + * Returns in \p kernelPtr the device kernel corresponding to the entry function \p entryFuncAddr. + * + * \param kernelPtr - Returns the device kernel + * \param entryFuncAddr - Address of device entry function to search kernel for + * + * \return + * ::cudaSuccess + * + * \sa + * \ref ::cudaGetKernel(cudaKernel_t *kernelPtr, const T *entryFuncAddr) "cudaGetKernel (C++ API)" + */ +extern __host__ cudaError_t CUDARTAPI cudaGetKernel(cudaKernel_t *kernelPtr, const void *entryFuncAddr); + +/** @} */ /* END CUDART_DRIVER */ + +#if defined(__CUDA_API_VERSION_INTERNAL) + #undef cudaMemcpy + #undef cudaMemcpyToSymbol + #undef cudaMemcpyFromSymbol + #undef cudaMemcpy2D + #undef cudaMemcpyToArray + #undef cudaMemcpy2DToArray + #undef cudaMemcpyFromArray + #undef cudaMemcpy2DFromArray + #undef cudaMemcpyArrayToArray + #undef cudaMemcpy2DArrayToArray + #undef cudaMemcpy3D + #undef cudaMemcpy3DPeer + #undef cudaMemset + #undef cudaMemset2D + #undef cudaMemset3D + #undef cudaMemcpyAsync + #undef cudaMemcpyToSymbolAsync + #undef cudaMemcpyFromSymbolAsync + #undef cudaMemcpy2DAsync + #undef cudaMemcpyToArrayAsync + #undef cudaMemcpy2DToArrayAsync + #undef cudaMemcpyFromArrayAsync + #undef cudaMemcpy2DFromArrayAsync + #undef cudaMemcpy3DAsync + #undef cudaMemcpy3DPeerAsync + #undef cudaMemsetAsync + #undef cudaMemset2DAsync + #undef cudaMemset3DAsync + #undef cudaStreamQuery + #undef cudaStreamGetFlags + #undef cudaStreamGetId + #undef cudaStreamGetPriority + #undef cudaEventRecord + #undef cudaEventRecordWithFlags + #undef cudaStreamWaitEvent + #undef cudaStreamAddCallback + #undef cudaStreamAttachMemAsync + #undef cudaStreamSynchronize + #undef cudaLaunchKernel + #undef cudaLaunchKernelExC + #undef cudaLaunchHostFunc + #undef cudaMemPrefetchAsync + #undef cudaMemPrefetchAsync_v2 + #undef cudaLaunchCooperativeKernel + #undef cudaSignalExternalSemaphoresAsync + #undef cudaWaitExternalSemaphoresAsync + #undef cudaGraphInstantiateWithParams + #undef cudaGraphUpload + #undef cudaGraphLaunch + #undef cudaStreamBeginCapture + #undef cudaStreamBeginCaptureToGraph + #undef cudaStreamEndCapture + #undef cudaStreamIsCapturing + #undef cudaStreamGetCaptureInfo + #undef cudaStreamGetCaptureInfo_v2 + #undef cudaStreamGetCaptureInfo_v3 + #undef cudaStreamUpdateCaptureDependencies + #undef cudaStreamUpdateCaptureDependencies_v2 + #undef cudaStreamCopyAttributes + #undef cudaStreamGetAttribute + #undef cudaStreamSetAttribute + #undef cudaMallocAsync + #undef cudaFreeAsync + #undef cudaMallocFromPoolAsync + #undef cudaGetDriverEntryPoint + + #undef cudaGetDeviceProperties + + extern __host__ cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind); + extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbol(const void *symbol, const void *src, size_t count, size_t offset __dv(0), enum cudaMemcpyKind kind __dv(cudaMemcpyHostToDevice)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol(void *dst, const void *symbol, size_t count, size_t offset __dv(0), enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToHost)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpy2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind); + extern __host__ cudaError_t CUDARTAPI cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, size_t count, enum cudaMemcpyKind kind); + extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind); + extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, enum cudaMemcpyKind kind); + extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArray(void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind); + extern __host__ cudaError_t CUDARTAPI cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpy3D(const struct cudaMemcpy3DParms *p); + extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeer(const struct cudaMemcpy3DPeerParms *p); + extern __host__ cudaError_t CUDARTAPI cudaMemset(void *devPtr, int value, size_t count); + extern __host__ cudaError_t CUDARTAPI cudaMemset2D(void *devPtr, size_t pitch, int value, size_t width, size_t height); + extern __host__ cudaError_t CUDARTAPI cudaMemset3D(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpyAsync(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbolAsync(const void *symbol, const void *src, size_t count, size_t offset, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbolAsync(void *dst, const void *symbol, size_t count, size_t offset, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromArrayAsync(void *dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArrayAsync(void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync(const struct cudaMemcpy3DParms *p, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeerAsync(const struct cudaMemcpy3DPeerParms *p, cudaStream_t stream __dv(0)); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync(void *devPtr, int value, size_t count, cudaStream_t stream __dv(0)); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream __dv(0)); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaStreamQuery(cudaStream_t stream); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamGetFlags(cudaStream_t hStream, unsigned int *flags); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamGetId(cudaStream_t hStream, unsigned long long *streamId); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamGetPriority(cudaStream_t hStream, int *priority); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecord(cudaEvent_t event, cudaStream_t stream __dv(0)); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream __dv(0), unsigned int flags __dv(0)); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags); + extern __host__ cudaError_t CUDARTAPI cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void *userData, unsigned int flags); + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, size_t length, unsigned int flags); + extern __host__ cudaError_t CUDARTAPI cudaStreamSynchronize(cudaStream_t stream); + extern __host__ cudaError_t CUDARTAPI cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream); + extern __host__ cudaError_t CUDARTAPI cudaLaunchKernelExC(const cudaLaunchConfig_t *config, const void *func, void **args); + extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream); + extern __host__ cudaError_t CUDARTAPI cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void *userData); + extern __host__ cudaError_t CUDARTAPI cudaMemPrefetchAsync(const void *devPtr, size_t count, int dstDevice, cudaStream_t stream); + extern __host__ cudaError_t CUDARTAPI cudaMemPrefetchAsync_v2(const void *devPtr, size_t count, struct cudaMemLocation location, unsigned int flags, cudaStream_t stream); + extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t *extSemArray, const struct cudaExternalSemaphoreSignalParams_v1 *paramsArray, unsigned int numExtSems, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync_ptsz(const cudaExternalSemaphore_t *extSemArray, const struct cudaExternalSemaphoreSignalParams_v1 *paramsArray, unsigned int numExtSems, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync_v2(const cudaExternalSemaphore_t *extSemArray, const struct cudaExternalSemaphoreSignalParams *paramsArray, unsigned int numExtSems, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t *extSemArray, const struct cudaExternalSemaphoreWaitParams_v1 *paramsArray, unsigned int numExtSems, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync_ptsz(const cudaExternalSemaphore_t *extSemArray, const struct cudaExternalSemaphoreWaitParams_v1 *paramsArray, unsigned int numExtSems, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync_v2(const cudaExternalSemaphore_t *extSemArray, const struct cudaExternalSemaphoreWaitParams *paramsArray, unsigned int numExtSems, cudaStream_t stream __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiateWithParams(cudaGraphExec_t *pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams *instantiateParams); + extern __host__ cudaError_t CUDARTAPI cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream); + extern __host__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream); + extern __host__ cudaError_t CUDARTAPI cudaStreamBeginCapture(cudaStream_t stream, enum cudaStreamCaptureMode mode); + extern __host__ cudaError_t CUDARTAPI cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t *dependencies, const cudaGraphEdgeData *dependencyData, size_t numDependencies, enum cudaStreamCaptureMode mode); + extern __host__ cudaError_t CUDARTAPI cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t *pGraph); + extern __host__ cudaError_t CUDARTAPI cudaStreamIsCapturing(cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus); + extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo(cudaStream_t stream, enum cudaStreamCaptureStatus *captureStatus_out, unsigned long long *id_out); + extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo_ptsz(cudaStream_t stream, enum cudaStreamCaptureStatus *captureStatus_out, unsigned long long *id_out); + extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo_v2(cudaStream_t stream, enum cudaStreamCaptureStatus *captureStatus_out, unsigned long long *id_out __dv(0), cudaGraph_t *graph_out __dv(0), const cudaGraphNode_t **dependencies_out __dv(0), size_t *numDependencies_out __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo_v3(cudaStream_t stream, enum cudaStreamCaptureStatus *captureStatus_out, unsigned long long *id_out __dv(0), cudaGraph_t *graph_out __dv(0), const cudaGraphNode_t **dependencies_out __dv(0), const cudaGraphEdgeData **edgeData_out __dv(0), size_t *numDependencies_out __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t *dependencies, size_t numDependencies, unsigned int flags __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaStreamUpdateCaptureDependencies_v2(cudaStream_t stream, cudaGraphNode_t *dependencies, const cudaGraphEdgeData *dependencyData, size_t numDependencies, unsigned int flags __dv(0)); + extern __host__ cudaError_t CUDARTAPI cudaStreamCopyAttributes(cudaStream_t dstStream, cudaStream_t srcStream); + extern __host__ cudaError_t CUDARTAPI cudaStreamGetAttribute(cudaStream_t stream, cudaStreamAttrID attr, cudaStreamAttrValue *value); + extern __host__ cudaError_t CUDARTAPI cudaStreamSetAttribute(cudaStream_t stream, cudaStreamAttrID attr, const cudaStreamAttrValue *param); + + extern __host__ cudaError_t CUDARTAPI cudaMallocAsync(void **devPtr, size_t size, cudaStream_t hStream); + extern __host__ cudaError_t CUDARTAPI cudaFreeAsync(void *devPtr, cudaStream_t hStream); + extern __host__ cudaError_t CUDARTAPI cudaMallocFromPoolAsync(void **ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream); + extern __host__ cudaError_t CUDARTAPI cudaGetDriverEntryPoint(const char *symbol, void **funcPtr, unsigned long long flags, enum cudaDriverEntryPointQueryResult *driverStatus); + + extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDeviceProperties(struct cudaDeviceProp *prop, int device); + +#elif defined(__CUDART_API_PER_THREAD_DEFAULT_STREAM) + // nvcc stubs reference the 'cudaLaunch'/'cudaLaunchKernel' identifier even if it was defined + // to 'cudaLaunch_ptsz'/'cudaLaunchKernel_ptsz'. Redirect through a static inline function. + #undef cudaLaunchKernel + static __inline__ __host__ cudaError_t cudaLaunchKernel(const void *func, + dim3 gridDim, dim3 blockDim, + void **args, size_t sharedMem, + cudaStream_t stream) + { + return cudaLaunchKernel_ptsz(func, gridDim, blockDim, args, sharedMem, stream); + } + #define cudaLaunchKernel __CUDART_API_PTSZ(cudaLaunchKernel) + #undef cudaLaunchKernelExC + static __inline__ __host__ cudaError_t cudaLaunchKernelExC(const cudaLaunchConfig_t *config, + const void *func, + void **args) + { + return cudaLaunchKernelExC_ptsz(config, func, args); + } + #define cudaLaunchKernelExC __CUDART_API_PTSZ(cudaLaunchKernelExC) +#endif + +#if defined(__cplusplus) +} + +#endif /* __cplusplus */ + +#undef EXCLUDE_FROM_RTC +#endif /* !__CUDACC_RTC__ */ + +#undef __dv +#undef __CUDA_DEPRECATED + +#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_RUNTIME_API_H__) +#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_RUNTIME_API_H__ +#endif + +#endif /* !__CUDA_RUNTIME_API_H__ */ diff --git a/cuda_toolkit/include/cuda_stdint.h b/cuda_toolkit/include/cuda_stdint.h new file mode 100644 index 0000000000000000000000000000000000000000..01d08d321c4a246a092fafae96d493f90401c22f --- /dev/null +++ b/cuda_toolkit/include/cuda_stdint.h @@ -0,0 +1,112 @@ +/* + * Copyright 2009-2017 NVIDIA Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of NVIDIA CORPORATION nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __cuda_stdint_h__ +#define __cuda_stdint_h__ + +// Compiler-specific treatment for C99's stdint.h +// +// By default, this header will use the standard headers (so it +// is your responsibility to make sure they are available), except +// on MSVC before Visual Studio 2010, when they were not provided. +// To support old MSVC, a few of the commonly-used definitions are +// provided here. If more definitions are needed, add them here, +// or replace these definitions with a complete implementation, +// such as the ones available from Google, Boost, or MSVC10. You +// can prevent the definition of any of these types (in order to +// use your own) by #defining CU_STDINT_TYPES_ALREADY_DEFINED. + +#if !defined(CU_STDINT_TYPES_ALREADY_DEFINED) + +// In VS including stdint.h forces the C++ runtime dep - provide an opt-out +// (CU_STDINT_VS_FORCE_NO_STDINT_H) for users that care (notably static +// cudart). +#if defined(_MSC_VER) && ((_MSC_VER < 1600) || defined(CU_STDINT_VS_FORCE_NO_STDINT_H)) + +// These definitions can be used with MSVC 8 and 9, +// which don't ship with stdint.h: + +typedef unsigned char uint8_t; + +typedef short int16_t; +typedef unsigned short uint16_t; + +// To keep it consistent with all MSVC build. define those types +// in the exact same way they are defined with the MSVC headers +#if defined(_MSC_VER) +typedef signed char int8_t; + +typedef int int32_t; +typedef unsigned int uint32_t; + +typedef long long int64_t; +typedef unsigned long long uint64_t; +#else +typedef char int8_t; + +typedef long int32_t; +typedef unsigned long uint32_t; + +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#endif + +#elif defined(__DJGPP__) + +// These definitions can be used when compiling +// C code with DJGPP, which only provides stdint.h +// when compiling C++ code with TR1 enabled. + +typedef char int8_t; +typedef unsigned char uint8_t; + +typedef short int16_t; +typedef unsigned short uint16_t; + +typedef long int32_t; +typedef unsigned long uint32_t; + +typedef long long int64_t; +typedef unsigned long long uint64_t; + +#else + +// Use standard headers, as specified by C99 and C++ TR1. +// Known to be provided by: +// - gcc/glibc, supported by all versions of glibc +// - djgpp, supported since 2001 +// - MSVC, supported by Visual Studio 2010 and later + +#include + +#endif + +#endif // !defined(CU_STDINT_TYPES_ALREADY_DEFINED) + + +#endif // file guard diff --git a/cuda_toolkit/include/cuda_surface_types.h b/cuda_toolkit/include/cuda_surface_types.h new file mode 100644 index 0000000000000000000000000000000000000000..6bc2091a8af4911abd34364c8df043405f49d82f --- /dev/null +++ b/cuda_toolkit/include/cuda_surface_types.h @@ -0,0 +1,76 @@ +/* + * Copyright 1993-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_SURFACE_TYPES_H__) +#define __CUDA_SURFACE_TYPES_H__ + +#if defined(__cplusplus) && defined(__CUDACC__) + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#if !defined(__CUDACC_RTC__) +#define EXCLUDE_FROM_RTC +#include "channel_descriptor.h" +#undef EXCLUDE_FROM_RTC +#endif /* !__CUDACC_RTC__ */ +#include "cuda_runtime_api.h" + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#endif /* __cplusplus && __CUDACC__ */ + +#endif /* !__CUDA_SURFACE_TYPES_H__ */ diff --git a/cuda_toolkit/include/cuda_texture_types.h b/cuda_toolkit/include/cuda_texture_types.h new file mode 100644 index 0000000000000000000000000000000000000000..9905e6a41543520c91701a884c387554d615db83 --- /dev/null +++ b/cuda_toolkit/include/cuda_texture_types.h @@ -0,0 +1,76 @@ +/* + * Copyright 1993-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_TEXTURE_TYPES_H__) +#define __CUDA_TEXTURE_TYPES_H__ + +#if defined(__cplusplus) && defined(__CUDACC__) + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#if !defined(__CUDACC_RTC__) +#define EXCLUDE_FROM_RTC +#include "channel_descriptor.h" +#undef EXCLUDE_FROM_RTC +#endif /* !__CUDACC_RTC__ */ +#include "cuda_runtime_api.h" + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#endif /* __cplusplus && __CUDACC__ */ + +#endif /* !__CUDA_TEXTURE_TYPES_H__ */ diff --git a/cuda_toolkit/include/cudalibxt.h b/cuda_toolkit/include/cudalibxt.h new file mode 100644 index 0000000000000000000000000000000000000000..1626b1f3c3d4773d9e8c776ec10e73e595ea33f6 --- /dev/null +++ b/cuda_toolkit/include/cudalibxt.h @@ -0,0 +1,97 @@ + /* Copyright 2013,2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/*! +* \file cudalibxt.h +* \brief Public header file for the NVIDIA library multi-GPU support structures +*/ + +#ifndef _CUDA_LIB_XT_H_ +#define _CUDA_LIB_XT_H_ +#include + +#define CUDA_XT_DESCRIPTOR_VERSION 0x01000000 // This is added to CUDART_VERSION + +enum cudaXtCopyType_t { + LIB_XT_COPY_HOST_TO_DEVICE, + LIB_XT_COPY_DEVICE_TO_HOST, + LIB_XT_COPY_DEVICE_TO_DEVICE +} ; +typedef enum cudaXtCopyType_t cudaLibXtCopyType; + +enum libFormat_t { + LIB_FORMAT_CUFFT = 0x0, + LIB_FORMAT_UNDEFINED = 0x1 +}; + +typedef enum libFormat_t libFormat; + +#define MAX_CUDA_DESCRIPTOR_GPUS 64 + +struct cudaXtDesc_t{ + int version; //descriptor version + int nGPUs; //number of GPUs + int GPUs[MAX_CUDA_DESCRIPTOR_GPUS]; //array of device IDs + void *data[MAX_CUDA_DESCRIPTOR_GPUS]; //array of pointers to data, one per GPU + size_t size[MAX_CUDA_DESCRIPTOR_GPUS]; //array of data sizes, one per GPU + void *cudaXtState; //opaque CUDA utility structure +}; +typedef struct cudaXtDesc_t cudaXtDesc; + +struct cudaLibXtDesc_t{ + int version; //descriptor version + cudaXtDesc *descriptor; //multi-GPU memory descriptor + libFormat library; //which library recognizes the format + int subFormat; //library specific enumerator of sub formats + void *libDescriptor; //library specific descriptor e.g. FFT transform plan object +}; +typedef struct cudaLibXtDesc_t cudaLibXtDesc; + + +#endif + diff --git a/cuda_toolkit/include/cudart_platform.h b/cuda_toolkit/include/cudart_platform.h new file mode 100644 index 0000000000000000000000000000000000000000..b5bddb44d31eb9eb8ef413ee1b837652228e9406 --- /dev/null +++ b/cuda_toolkit/include/cudart_platform.h @@ -0,0 +1,57 @@ +/* + * Copyright 2016 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef __CUDART_PLATFORM_H__ +#define __CUDART_PLATFORM_H__ + +#if ((defined(__linux__) || defined(__QNX__)) && (defined(__arm__) || defined(__aarch64__) || defined(__x86_64__))) +#define isEglSupported 1 +#endif + +#endif diff --git a/cuda_toolkit/include/cufft.h b/cuda_toolkit/include/cufft.h new file mode 100644 index 0000000000000000000000000000000000000000..9d7fef04e9cbb2415a34fd2db11a3cfeb10f3f5a --- /dev/null +++ b/cuda_toolkit/include/cufft.h @@ -0,0 +1,334 @@ + /* Copyright 2005-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/*! +* \file cufft.h +* \brief Public header file for the NVIDIA CUDA FFT library (CUFFT) +*/ + +#ifndef _CUFFT_H_ +#define _CUFFT_H_ + + +#include "cuComplex.h" +#include "driver_types.h" +#include "library_types.h" + +#ifndef CUFFTAPI +#ifdef _WIN32 +#define CUFFTAPI __stdcall +#elif __GNUC__ >= 4 +#define CUFFTAPI __attribute__ ((visibility ("default"))) +#else +#define CUFFTAPI +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define CUFFT_VER_MAJOR 11 +#define CUFFT_VER_MINOR 2 +#define CUFFT_VER_PATCH 1 +#define CUFFT_VER_BUILD 3 + +#define CUFFT_VERSION 11201 + +// CUFFT API function return values +typedef enum cufftResult_t { + CUFFT_SUCCESS = 0x0, + CUFFT_INVALID_PLAN = 0x1, + CUFFT_ALLOC_FAILED = 0x2, + CUFFT_INVALID_TYPE = 0x3, + CUFFT_INVALID_VALUE = 0x4, + CUFFT_INTERNAL_ERROR = 0x5, + CUFFT_EXEC_FAILED = 0x6, + CUFFT_SETUP_FAILED = 0x7, + CUFFT_INVALID_SIZE = 0x8, + CUFFT_UNALIGNED_DATA = 0x9, + CUFFT_INCOMPLETE_PARAMETER_LIST = 0xA, + CUFFT_INVALID_DEVICE = 0xB, + CUFFT_PARSE_ERROR = 0xC, + CUFFT_NO_WORKSPACE = 0xD, + CUFFT_NOT_IMPLEMENTED = 0xE, + CUFFT_LICENSE_ERROR = 0x0F, + CUFFT_NOT_SUPPORTED = 0x10 + +} cufftResult; + +#define MAX_CUFFT_ERROR 0x11 + + +// CUFFT defines and supports the following data types + + +// cufftReal is a single-precision, floating-point real data type. +// cufftDoubleReal is a double-precision, real data type. +typedef float cufftReal; +typedef double cufftDoubleReal; + +// cufftComplex is a single-precision, floating-point complex data type that +// consists of interleaved real and imaginary components. +// cufftDoubleComplex is the double-precision equivalent. +typedef cuComplex cufftComplex; +typedef cuDoubleComplex cufftDoubleComplex; + +// CUFFT transform directions +#define CUFFT_FORWARD -1 // Forward FFT +#define CUFFT_INVERSE 1 // Inverse FFT + +// CUFFT supports the following transform types +typedef enum cufftType_t { + CUFFT_R2C = 0x2a, // Real to Complex (interleaved) + CUFFT_C2R = 0x2c, // Complex (interleaved) to Real + CUFFT_C2C = 0x29, // Complex to Complex, interleaved + CUFFT_D2Z = 0x6a, // Double to Double-Complex + CUFFT_Z2D = 0x6c, // Double-Complex to Double + CUFFT_Z2Z = 0x69 // Double-Complex to Double-Complex +} cufftType; + +// CUFFT supports the following data layouts +typedef enum cufftCompatibility_t { + CUFFT_COMPATIBILITY_FFTW_PADDING = 0x01 // The default value +} cufftCompatibility; + +#define CUFFT_COMPATIBILITY_DEFAULT CUFFT_COMPATIBILITY_FFTW_PADDING + +// +// structure definition used by the shim between old and new APIs +// +#define MAX_SHIM_RANK 3 + +// cufftHandle is a handle type used to store and access CUFFT plans. +typedef int cufftHandle; + + +cufftResult CUFFTAPI cufftPlan1d(cufftHandle *plan, + int nx, + cufftType type, + int batch); + +cufftResult CUFFTAPI cufftPlan2d(cufftHandle *plan, + int nx, int ny, + cufftType type); + +cufftResult CUFFTAPI cufftPlan3d(cufftHandle *plan, + int nx, int ny, int nz, + cufftType type); + +cufftResult CUFFTAPI cufftPlanMany(cufftHandle *plan, + int rank, + int *n, + int *inembed, int istride, int idist, + int *onembed, int ostride, int odist, + cufftType type, + int batch); + +cufftResult CUFFTAPI cufftMakePlan1d(cufftHandle plan, + int nx, + cufftType type, + int batch, + size_t *workSize); + +cufftResult CUFFTAPI cufftMakePlan2d(cufftHandle plan, + int nx, int ny, + cufftType type, + size_t *workSize); + +cufftResult CUFFTAPI cufftMakePlan3d(cufftHandle plan, + int nx, int ny, int nz, + cufftType type, + size_t *workSize); + +cufftResult CUFFTAPI cufftMakePlanMany(cufftHandle plan, + int rank, + int *n, + int *inembed, int istride, int idist, + int *onembed, int ostride, int odist, + cufftType type, + int batch, + size_t *workSize); + +cufftResult CUFFTAPI cufftMakePlanMany64(cufftHandle plan, + int rank, + long long int *n, + long long int *inembed, + long long int istride, + long long int idist, + long long int *onembed, + long long int ostride, long long int odist, + cufftType type, + long long int batch, + size_t * workSize); + +cufftResult CUFFTAPI cufftGetSizeMany64(cufftHandle plan, + int rank, + long long int *n, + long long int *inembed, + long long int istride, long long int idist, + long long int *onembed, + long long int ostride, long long int odist, + cufftType type, + long long int batch, + size_t *workSize); + + + + +cufftResult CUFFTAPI cufftEstimate1d(int nx, + cufftType type, + int batch, + size_t *workSize); + +cufftResult CUFFTAPI cufftEstimate2d(int nx, int ny, + cufftType type, + size_t *workSize); + +cufftResult CUFFTAPI cufftEstimate3d(int nx, int ny, int nz, + cufftType type, + size_t *workSize); + +cufftResult CUFFTAPI cufftEstimateMany(int rank, + int *n, + int *inembed, int istride, int idist, + int *onembed, int ostride, int odist, + cufftType type, + int batch, + size_t *workSize); + +cufftResult CUFFTAPI cufftCreate(cufftHandle * handle); + +cufftResult CUFFTAPI cufftGetSize1d(cufftHandle handle, + int nx, + cufftType type, + int batch, + size_t *workSize ); + +cufftResult CUFFTAPI cufftGetSize2d(cufftHandle handle, + int nx, int ny, + cufftType type, + size_t *workSize); + +cufftResult CUFFTAPI cufftGetSize3d(cufftHandle handle, + int nx, int ny, int nz, + cufftType type, + size_t *workSize); + +cufftResult CUFFTAPI cufftGetSizeMany(cufftHandle handle, + int rank, int *n, + int *inembed, int istride, int idist, + int *onembed, int ostride, int odist, + cufftType type, int batch, size_t *workArea); + +cufftResult CUFFTAPI cufftGetSize(cufftHandle handle, size_t *workSize); + +cufftResult CUFFTAPI cufftSetWorkArea(cufftHandle plan, void *workArea); + +cufftResult CUFFTAPI cufftSetAutoAllocation(cufftHandle plan, int autoAllocate); + +cufftResult CUFFTAPI cufftExecC2C(cufftHandle plan, + cufftComplex *idata, + cufftComplex *odata, + int direction); + +cufftResult CUFFTAPI cufftExecR2C(cufftHandle plan, + cufftReal *idata, + cufftComplex *odata); + +cufftResult CUFFTAPI cufftExecC2R(cufftHandle plan, + cufftComplex *idata, + cufftReal *odata); + +cufftResult CUFFTAPI cufftExecZ2Z(cufftHandle plan, + cufftDoubleComplex *idata, + cufftDoubleComplex *odata, + int direction); + +cufftResult CUFFTAPI cufftExecD2Z(cufftHandle plan, + cufftDoubleReal *idata, + cufftDoubleComplex *odata); + +cufftResult CUFFTAPI cufftExecZ2D(cufftHandle plan, + cufftDoubleComplex *idata, + cufftDoubleReal *odata); + + +// utility functions +cufftResult CUFFTAPI cufftSetStream(cufftHandle plan, + cudaStream_t stream); + +cufftResult CUFFTAPI cufftDestroy(cufftHandle plan); + +cufftResult CUFFTAPI cufftGetVersion(int *version); + +cufftResult CUFFTAPI cufftGetProperty(libraryPropertyType type, + int *value); + +// +// Set/Get PlanProperty APIs configures per-plan behavior +// +typedef enum cufftProperty_t { + NVFFT_PLAN_PROPERTY_INT64_PATIENT_JIT = 0x1 +} cufftProperty; + +cufftResult CUFFTAPI cufftSetPlanPropertyInt64(cufftHandle plan, + cufftProperty property, + const long long int inputValueInt); + +cufftResult CUFFTAPI cufftGetPlanPropertyInt64(cufftHandle plan, + cufftProperty property, + long long int* returnPtrValue); + +cufftResult CUFFTAPI cufftResetPlanProperty(cufftHandle plan, cufftProperty property); + +#ifdef __cplusplus +} +#endif + +#endif /* _CUFFT_H_ */ diff --git a/cuda_toolkit/include/cufftXt.h b/cuda_toolkit/include/cufftXt.h new file mode 100644 index 0000000000000000000000000000000000000000..1612b311a21cc1a57550ebf9d46771f98a42dc24 --- /dev/null +++ b/cuda_toolkit/include/cufftXt.h @@ -0,0 +1,259 @@ + + /* Copyright 2005-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/*! +* \file cufftXt.h +* \brief Public header file for the NVIDIA CUDA FFT library (CUFFT) +*/ + +#ifndef _CUFFTXT_H_ +#define _CUFFTXT_H_ +#include "cudalibxt.h" +#include "cufft.h" + + +#ifndef CUFFTAPI +#ifdef _WIN32 +#define CUFFTAPI __stdcall +#else +#define CUFFTAPI +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// +// cufftXtSubFormat identifies the data layout of +// a memory descriptor owned by cufft. +// note that multi GPU cufft does not yet support out-of-place transforms +// + +typedef enum cufftXtSubFormat_t { + CUFFT_XT_FORMAT_INPUT = 0x00, //by default input is in linear order across GPUs + CUFFT_XT_FORMAT_OUTPUT = 0x01, //by default output is in scrambled order depending on transform + CUFFT_XT_FORMAT_INPLACE = 0x02, //by default inplace is input order, which is linear across GPUs + CUFFT_XT_FORMAT_INPLACE_SHUFFLED = 0x03, //shuffled output order after execution of the transform + CUFFT_XT_FORMAT_1D_INPUT_SHUFFLED = 0x04, //shuffled input order prior to execution of 1D transforms + CUFFT_XT_FORMAT_DISTRIBUTED_INPUT = 0x05, + CUFFT_XT_FORMAT_DISTRIBUTED_OUTPUT = 0x06, + CUFFT_FORMAT_UNDEFINED = 0x07 +} cufftXtSubFormat; + +// +// cufftXtCopyType specifies the type of copy for cufftXtMemcpy +// +typedef enum cufftXtCopyType_t { + CUFFT_COPY_HOST_TO_DEVICE = 0x00, + CUFFT_COPY_DEVICE_TO_HOST = 0x01, + CUFFT_COPY_DEVICE_TO_DEVICE = 0x02, + CUFFT_COPY_UNDEFINED = 0x03 +} cufftXtCopyType; + +// +// cufftXtQueryType specifies the type of query for cufftXtQueryPlan +// +typedef enum cufftXtQueryType_t { + CUFFT_QUERY_1D_FACTORS = 0x00, + CUFFT_QUERY_UNDEFINED = 0x01 +} cufftXtQueryType; + +typedef struct cufftXt1dFactors_t { + long long int size; + long long int stringCount; + long long int stringLength; + long long int substringLength; + long long int factor1; + long long int factor2; + long long int stringMask; + long long int substringMask; + long long int factor1Mask; + long long int factor2Mask; + int stringShift; + int substringShift; + int factor1Shift; + int factor2Shift; +} cufftXt1dFactors; + +// +// cufftXtWorkAreaPolicy specifies policy for cufftXtSetWorkAreaPolicy +// +typedef enum cufftXtWorkAreaPolicy_t { + CUFFT_WORKAREA_MINIMAL = 0, /* maximum reduction */ + CUFFT_WORKAREA_USER = 1, /* use workSize parameter as limit */ + CUFFT_WORKAREA_PERFORMANCE = 2, /* default - 1x overhead or more, maximum performance */ +} cufftXtWorkAreaPolicy; + +// multi-GPU routines +cufftResult CUFFTAPI cufftXtSetGPUs(cufftHandle handle, int nGPUs, int *whichGPUs); + +cufftResult CUFFTAPI cufftXtMalloc(cufftHandle plan, + cudaLibXtDesc ** descriptor, + cufftXtSubFormat format); + +cufftResult CUFFTAPI cufftXtMemcpy(cufftHandle plan, + void *dstPointer, + void *srcPointer, + cufftXtCopyType type); + +cufftResult CUFFTAPI cufftXtFree(cudaLibXtDesc *descriptor); + +cufftResult CUFFTAPI cufftXtSetWorkArea(cufftHandle plan, void **workArea); + +cufftResult CUFFTAPI cufftXtExecDescriptorC2C(cufftHandle plan, + cudaLibXtDesc *input, + cudaLibXtDesc *output, + int direction); + +cufftResult CUFFTAPI cufftXtExecDescriptorR2C(cufftHandle plan, + cudaLibXtDesc *input, + cudaLibXtDesc *output); + +cufftResult CUFFTAPI cufftXtExecDescriptorC2R(cufftHandle plan, + cudaLibXtDesc *input, + cudaLibXtDesc *output); + +cufftResult CUFFTAPI cufftXtExecDescriptorZ2Z(cufftHandle plan, + cudaLibXtDesc *input, + cudaLibXtDesc *output, + int direction); + +cufftResult CUFFTAPI cufftXtExecDescriptorD2Z(cufftHandle plan, + cudaLibXtDesc *input, + cudaLibXtDesc *output); + +cufftResult CUFFTAPI cufftXtExecDescriptorZ2D(cufftHandle plan, + cudaLibXtDesc *input, + cudaLibXtDesc *output); + +// Utility functions + +cufftResult CUFFTAPI cufftXtQueryPlan(cufftHandle plan, void *queryStruct, cufftXtQueryType queryType); + + +// callbacks + + +typedef enum cufftXtCallbackType_t { + CUFFT_CB_LD_COMPLEX = 0x0, + CUFFT_CB_LD_COMPLEX_DOUBLE = 0x1, + CUFFT_CB_LD_REAL = 0x2, + CUFFT_CB_LD_REAL_DOUBLE = 0x3, + CUFFT_CB_ST_COMPLEX = 0x4, + CUFFT_CB_ST_COMPLEX_DOUBLE = 0x5, + CUFFT_CB_ST_REAL = 0x6, + CUFFT_CB_ST_REAL_DOUBLE = 0x7, + CUFFT_CB_UNDEFINED = 0x8 + +} cufftXtCallbackType; + +typedef cufftComplex (*cufftCallbackLoadC)(void *dataIn, size_t offset, void *callerInfo, void *sharedPointer); +typedef cufftDoubleComplex (*cufftCallbackLoadZ)(void *dataIn, size_t offset, void *callerInfo, void *sharedPointer); +typedef cufftReal (*cufftCallbackLoadR)(void *dataIn, size_t offset, void *callerInfo, void *sharedPointer); +typedef cufftDoubleReal(*cufftCallbackLoadD)(void *dataIn, size_t offset, void *callerInfo, void *sharedPointer); + +typedef void (*cufftCallbackStoreC)(void *dataOut, size_t offset, cufftComplex element, void *callerInfo, void *sharedPointer); +typedef void (*cufftCallbackStoreZ)(void *dataOut, size_t offset, cufftDoubleComplex element, void *callerInfo, void *sharedPointer); +typedef void (*cufftCallbackStoreR)(void *dataOut, size_t offset, cufftReal element, void *callerInfo, void *sharedPointer); +typedef void (*cufftCallbackStoreD)(void *dataOut, size_t offset, cufftDoubleReal element, void *callerInfo, void *sharedPointer); + + +cufftResult CUFFTAPI cufftXtSetCallback(cufftHandle plan, void **callback_routine, cufftXtCallbackType cbType, void **caller_info); +cufftResult CUFFTAPI cufftXtClearCallback(cufftHandle plan, cufftXtCallbackType cbType); +cufftResult CUFFTAPI cufftXtSetCallbackSharedSize(cufftHandle plan, cufftXtCallbackType cbType, size_t sharedSize); + +cufftResult CUFFTAPI cufftXtMakePlanMany(cufftHandle plan, + int rank, + long long int *n, + long long int *inembed, + long long int istride, + long long int idist, + cudaDataType inputtype, + long long int *onembed, + long long int ostride, + long long int odist, + cudaDataType outputtype, + long long int batch, + size_t *workSize, + cudaDataType executiontype); + +cufftResult CUFFTAPI cufftXtGetSizeMany(cufftHandle plan, + int rank, + long long int *n, + long long int *inembed, + long long int istride, + long long int idist, + cudaDataType inputtype, + long long int *onembed, + long long int ostride, + long long int odist, + cudaDataType outputtype, + long long int batch, + size_t *workSize, + cudaDataType executiontype); + + +cufftResult CUFFTAPI cufftXtExec(cufftHandle plan, + void *input, + void *output, + int direction); + +cufftResult CUFFTAPI cufftXtExecDescriptor(cufftHandle plan, + cudaLibXtDesc *input, + cudaLibXtDesc *output, + int direction); + +cufftResult CUFFTAPI cufftXtSetWorkAreaPolicy(cufftHandle plan, cufftXtWorkAreaPolicy policy, size_t *workSize); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/cuda_toolkit/include/cufftw.h b/cuda_toolkit/include/cufftw.h new file mode 100644 index 0000000000000000000000000000000000000000..fce978cc2a1011b0683e38cb3850e7ba79639a1b --- /dev/null +++ b/cuda_toolkit/include/cufftw.h @@ -0,0 +1,465 @@ + + /* Copyright 2005-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/*! +* \file cufftw.h +* \brief Public header file for the NVIDIA CUDA FFTW library (CUFFTW) +*/ + +#ifndef _CUFFTW_H_ +#define _CUFFTW_H_ + + +#include +#include "cufft.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Transform direction +#define FFTW_FORWARD -1 +#define FFTW_INVERSE 1 +#define FFTW_BACKWARD 1 + +// Planner flags +#define FFTW_ESTIMATE 0x01 +#define FFTW_MEASURE 0x02 +#define FFTW_PATIENT 0x03 +#define FFTW_EXHAUSTIVE 0x04 +#define FFTW_WISDOM_ONLY 0x05 + +// Algorithm restriction flags +#define FFTW_DESTROY_INPUT 0x08 +#define FFTW_PRESERVE_INPUT 0x0C +#define FFTW_UNALIGNED 0x10 + +// CUFFTW defines and supports the following data types + +// note if complex.h has been included we use the C99 complex types +#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined (complex) + typedef double _Complex fftw_complex; + typedef float _Complex fftwf_complex; +#else + typedef double fftw_complex[2]; + typedef float fftwf_complex[2]; +#endif + +typedef void *fftw_plan; + +typedef void *fftwf_plan; + +typedef struct { + int n; + int is; + int os; +} fftw_iodim; + +typedef fftw_iodim fftwf_iodim; + +typedef struct { + ptrdiff_t n; + ptrdiff_t is; + ptrdiff_t os; +} fftw_iodim64; + +typedef fftw_iodim64 fftwf_iodim64; + +// CUFFTW defines and supports the following double precision APIs + +fftw_plan CUFFTAPI fftw_plan_dft_1d(int n, + fftw_complex *in, + fftw_complex *out, + int sign, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft_2d(int n0, + int n1, + fftw_complex *in, + fftw_complex *out, + int sign, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft_3d(int n0, + int n1, + int n2, + fftw_complex *in, + fftw_complex *out, + int sign, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft(int rank, + const int *n, + fftw_complex *in, + fftw_complex *out, + int sign, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft_r2c_1d(int n, + double *in, + fftw_complex *out, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft_r2c_2d(int n0, + int n1, + double *in, + fftw_complex *out, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft_r2c_3d(int n0, + int n1, + int n2, + double *in, + fftw_complex *out, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft_r2c(int rank, + const int *n, + double *in, + fftw_complex *out, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft_c2r_1d(int n, + fftw_complex *in, + double *out, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft_c2r_2d(int n0, + int n1, + fftw_complex *in, + double *out, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft_c2r_3d(int n0, + int n1, + int n2, + fftw_complex *in, + double *out, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_dft_c2r(int rank, + const int *n, + fftw_complex *in, + double *out, + unsigned flags); + + +fftw_plan CUFFTAPI fftw_plan_many_dft(int rank, + const int *n, + int batch, + fftw_complex *in, + const int *inembed, int istride, int idist, + fftw_complex *out, + const int *onembed, int ostride, int odist, + int sign, unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_many_dft_r2c(int rank, + const int *n, + int batch, + double *in, + const int *inembed, int istride, int idist, + fftw_complex *out, + const int *onembed, int ostride, int odist, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_many_dft_c2r(int rank, + const int *n, + int batch, + fftw_complex *in, + const int *inembed, int istride, int idist, + double *out, + const int *onembed, int ostride, int odist, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_guru_dft(int rank, const fftw_iodim *dims, + int batch_rank, const fftw_iodim *batch_dims, + fftw_complex *in, fftw_complex *out, + int sign, unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_guru_dft_r2c(int rank, const fftw_iodim *dims, + int batch_rank, const fftw_iodim *batch_dims, + double *in, fftw_complex *out, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_guru_dft_c2r(int rank, const fftw_iodim *dims, + int batch_rank, const fftw_iodim *batch_dims, + fftw_complex *in, double *out, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_guru64_dft(int rank, const fftw_iodim64* dims, + int batch_rank, const fftw_iodim64* batch_dims, + fftw_complex* in, fftw_complex* out, + int sign, unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_guru64_dft_r2c(int rank, const fftw_iodim64* dims, + int batch_rank, const fftw_iodim64* batch_dims, + double* in, fftw_complex* out, + unsigned flags); + +fftw_plan CUFFTAPI fftw_plan_guru64_dft_c2r(int rank, const fftw_iodim64* dims, + int batch_rank, const fftw_iodim64* batch_dims, + fftw_complex* in, double* out, + unsigned flags); + +void CUFFTAPI fftw_execute(const fftw_plan plan); + +void CUFFTAPI fftw_execute_dft(const fftw_plan plan, + fftw_complex *idata, + fftw_complex *odata); + +void CUFFTAPI fftw_execute_dft_r2c(const fftw_plan plan, + double *idata, + fftw_complex *odata); + +void CUFFTAPI fftw_execute_dft_c2r(const fftw_plan plan, + fftw_complex *idata, + double *odata); + +// CUFFTW defines and supports the following single precision APIs + +fftwf_plan CUFFTAPI fftwf_plan_dft_1d(int n, + fftwf_complex *in, + fftwf_complex *out, + int sign, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft_2d(int n0, + int n1, + fftwf_complex *in, + fftwf_complex *out, + int sign, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft_3d(int n0, + int n1, + int n2, + fftwf_complex *in, + fftwf_complex *out, + int sign, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft(int rank, + const int *n, + fftwf_complex *in, + fftwf_complex *out, + int sign, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft_r2c_1d(int n, + float *in, + fftwf_complex *out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft_r2c_2d(int n0, + int n1, + float *in, + fftwf_complex *out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft_r2c_3d(int n0, + int n1, + int n2, + float *in, + fftwf_complex *out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft_r2c(int rank, + const int *n, + float *in, + fftwf_complex *out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft_c2r_1d(int n, + fftwf_complex *in, + float *out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft_c2r_2d(int n0, + int n1, + fftwf_complex *in, + float *out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft_c2r_3d(int n0, + int n1, + int n2, + fftwf_complex *in, + float *out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_dft_c2r(int rank, + const int *n, + fftwf_complex *in, + float *out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_many_dft(int rank, + const int *n, + int batch, + fftwf_complex *in, + const int *inembed, int istride, int idist, + fftwf_complex *out, + const int *onembed, int ostride, int odist, + int sign, unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_many_dft_r2c(int rank, + const int *n, + int batch, + float *in, + const int *inembed, int istride, int idist, + fftwf_complex *out, + const int *onembed, int ostride, int odist, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_many_dft_c2r(int rank, + const int *n, + int batch, + fftwf_complex *in, + const int *inembed, int istride, int idist, + float *out, + const int *onembed, int ostride, int odist, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_guru_dft(int rank, const fftwf_iodim *dims, + int batch_rank, const fftwf_iodim *batch_dims, + fftwf_complex *in, fftwf_complex *out, + int sign, unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_guru_dft_r2c(int rank, const fftwf_iodim *dims, + int batch_rank, const fftwf_iodim *batch_dims, + float *in, fftwf_complex *out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_guru_dft_c2r(int rank, const fftwf_iodim *dims, + int batch_rank, const fftwf_iodim *batch_dims, + fftwf_complex *in, float *out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_guru64_dft(int rank, const fftwf_iodim64* dims, + int batch_rank, const fftwf_iodim64* batch_dims, + fftwf_complex* in, fftwf_complex* out, + int sign, unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_guru64_dft_r2c(int rank, const fftwf_iodim64* dims, + int batch_rank, const fftwf_iodim64* batch_dims, + float* in, fftwf_complex* out, + unsigned flags); + +fftwf_plan CUFFTAPI fftwf_plan_guru64_dft_c2r(int rank, const fftwf_iodim64* dims, + int batch_rank, const fftwf_iodim64* batch_dims, + fftwf_complex* in, float* out, + unsigned flags); + +void CUFFTAPI fftwf_execute(const fftw_plan plan); + +void CUFFTAPI fftwf_execute_dft(const fftwf_plan plan, + fftwf_complex *idata, + fftwf_complex *odata); + +void CUFFTAPI fftwf_execute_dft_r2c(const fftwf_plan plan, + float *idata, + fftwf_complex *odata); + +void CUFFTAPI fftwf_execute_dft_c2r(const fftwf_plan plan, + fftwf_complex *idata, + float *odata); + +#ifdef _WIN32 +#define _CUFFTAPI(T) T CUFFTAPI +#else +#define _CUFFTAPI(T) CUFFTAPI T +#endif + +// CUFFTW defines and supports the following support APIs + +_CUFFTAPI(void *) fftw_malloc(size_t n); + +_CUFFTAPI(void *) fftwf_malloc(size_t n); + +void CUFFTAPI fftw_free(void *pointer); + +void CUFFTAPI fftwf_free(void *pointer); + +void CUFFTAPI fftw_export_wisdom_to_file(FILE * output_file); + +void CUFFTAPI fftwf_export_wisdom_to_file(FILE * output_file); + +int CUFFTAPI fftw_import_wisdom_from_file(FILE * input_file); + +int CUFFTAPI fftwf_import_wisdom_from_file(FILE * input_file); + +void CUFFTAPI fftw_print_plan(const fftw_plan plan); + +void CUFFTAPI fftwf_print_plan(const fftwf_plan plan); + +void CUFFTAPI fftw_set_timelimit(double seconds); + +void CUFFTAPI fftwf_set_timelimit(double seconds); + +double CUFFTAPI fftw_cost(const fftw_plan plan); + +double CUFFTAPI fftwf_cost(const fftw_plan plan); + +void CUFFTAPI fftw_flops(const fftw_plan plan, double *add, double *mul, double *fma); + +void CUFFTAPI fftwf_flops(const fftw_plan plan, double *add, double *mul, double *fma); + +void CUFFTAPI fftw_destroy_plan(fftw_plan plan); + +void CUFFTAPI fftwf_destroy_plan(fftwf_plan plan); + +void CUFFTAPI fftw_cleanup(void); + +void CUFFTAPI fftwf_cleanup(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _CUFFTW_H_ */ diff --git a/cuda_toolkit/include/cupti.h b/cuda_toolkit/include/cupti.h new file mode 100644 index 0000000000000000000000000000000000000000..abe151621b33f33aded22568c7f4e7a661dccf67 --- /dev/null +++ b/cuda_toolkit/include/cupti.h @@ -0,0 +1,123 @@ +/* + * Copyright 2010-2017 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(_CUPTI_H_) +#define _CUPTI_H_ + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#ifdef NOMINMAX +#include +#else +#define NOMINMAX +#include +#undef NOMINMAX +#endif +#endif + +#include +#include +#include + +/* Activity, callback, event and metric APIs */ +#include +#include +#include +#include + +/* Runtime, driver, and nvtx function identifiers */ +#include +#include +#include + +/* To support function parameter structures for obsoleted API. See + cuda.h for the actual definition of these structures. */ +typedef unsigned int CUdeviceptr_v1; +typedef struct CUDA_MEMCPY2D_v1_st { int dummy; } CUDA_MEMCPY2D_v1; +typedef struct CUDA_MEMCPY3D_v1_st { int dummy; } CUDA_MEMCPY3D_v1; +typedef struct CUDA_ARRAY_DESCRIPTOR_v1_st { int dummy; } CUDA_ARRAY_DESCRIPTOR_v1; +typedef struct CUDA_ARRAY3D_DESCRIPTOR_v1_st { int dummy; } CUDA_ARRAY3D_DESCRIPTOR_v1; + +/* Function parameter structures */ +#include +#include + +/* The following parameter structures cannot be included unless a + header that defines GL_VERSION is included before including them. + If these are needed then make sure such a header is included + already. */ +#ifdef GL_VERSION +#include +#include +#endif + +//#include + +/* The following parameter structures cannot be included by default as + they are not guaranteed to be available on all systems. Uncomment + the includes that are available, or use the include explicitly. */ +#if defined(__linux__) +//#include +//#include +#endif + +#ifdef _WIN32 +//#include +//#include +//#include +//#include +//#include +//#include +#endif + +#endif /*_CUPTI_H_*/ + + diff --git a/cuda_toolkit/include/cupti_activity.h b/cuda_toolkit/include/cupti_activity.h new file mode 100644 index 0000000000000000000000000000000000000000..a4bbbc52b2bdc2a2587191cc0253df5b6c12558d --- /dev/null +++ b/cuda_toolkit/include/cupti_activity.h @@ -0,0 +1,7545 @@ +/* + * Copyright 2011-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(_CUPTI_ACTIVITY_H_) +#define _CUPTI_ACTIVITY_H_ + +/** + * Deprecated APIs and structures have been moved to the + * header :doc: `cupti_activity_deprecated.h`, which is included at + * the bottom of this file. Header cupti_activity.h contains + * only the latest version of APIs and structures. + */ + +#include +#include +#include +#include +#include + +#if defined(CUPTI_DIRECTIVE_SUPPORT) +#include +#include +#endif + +#include + +#define CUPTI_UNIFIED_MEMORY_CPU_DEVICE_ID ((uint32_t) 0xFFFFFFFFU) +#define CUPTI_INVALID_CONTEXT_ID ((uint32_t) 0xFFFFFFFFU) +#define CUPTI_INVALID_STREAM_ID ((uint32_t) 0xFFFFFFFFU) +#define CUPTI_INVALID_CHANNEL_ID ((uint32_t) 0xFFFFFFFFU) + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +#define invalidNumaId ((uint32_t) 0xFFFFFFFF) + +/** + * \defgroup CUPTI_ACTIVITY_API CUPTI Activity API + * Functions, types, and enums that implement the CUPTI Activity API. + * @{ + */ + +/** + * \brief The kinds of activity records. + * + * Each activity record kind represents information about a GPU or an + * activity occurring on a CPU or GPU. Each kind is associated with a + * activity record structure that holds the information associated + * with the kind. + * \see CUpti_Activity + * \see CUpti_ActivityAPI + * \see CUpti_ActivityContext + * \see CUpti_ActivityContext2 + * \see CUpti_ActivityDevice + * \see CUpti_ActivityDevice2 + * \see CUpti_ActivityDevice3 + * \see CUpti_ActivityDevice4 + * \see CUpti_ActivityDeviceAttribute + * \see CUpti_ActivityEvent + * \see CUpti_ActivityEventInstance + * \see CUpti_ActivityKernel + * \see CUpti_ActivityKernel2 + * \see CUpti_ActivityKernel3 + * \see CUpti_ActivityKernel4 + * \see CUpti_ActivityKernel5 + * \see CUpti_ActivityKernel6 + * \see CUpti_ActivityKernel7 + * \see CUpti_ActivityKernel8 + * \see CUpti_ActivityKernel9 + * \see CUpti_ActivityCdpKernel + * \see CUpti_ActivityPreemption + * \see CUpti_ActivityMemcpy + * \see CUpti_ActivityMemcpy3 + * \see CUpti_ActivityMemcpy4 + * \see CUpti_ActivityMemcpy5 + * \see CUpti_ActivityMemcpyPtoP + * \see CUpti_ActivityMemcpyPtoP2 + * \see CUpti_ActivityMemcpyPtoP3 + * \see CUpti_ActivityMemcpyPtoP4 + * \see CUpti_ActivityMemset + * \see CUpti_ActivityMemset2 + * \see CUpti_ActivityMemset3 + * \see CUpti_ActivityMemset4 + * \see CUpti_ActivityMemory + * \see CUpti_ActivityMemory2 + * \see CUpti_ActivityMemory3 + * \see CUpti_ActivityMemoryPool + * \see CUpti_ActivityMemoryPool2 + * \see CUpti_ActivityMetric + * \see CUpti_ActivityMetricInstance + * \see CUpti_ActivityName + * \see CUpti_ActivityMarker + * \see CUpti_ActivityMarker2 + * \see CUpti_ActivityMarkerData + * \see CUpti_ActivitySourceLocator + * \see CUpti_ActivityGlobalAccess + * \see CUpti_ActivityGlobalAccess2 + * \see CUpti_ActivityGlobalAccess3 + * \see CUpti_ActivityBranch + * \see CUpti_ActivityBranch2 + * \see CUpti_ActivityOverhead3 + * \see CUpti_ActivityEnvironment + * \see CUpti_ActivityInstructionExecution + * \see CUpti_ActivityUnifiedMemoryCounter + * \see CUpti_ActivityFunction + * \see CUpti_ActivityModule + * \see CUpti_ActivitySharedAccess + * \see CUpti_ActivityPCSampling + * \see CUpti_ActivityPCSampling2 + * \see CUpti_ActivityPCSampling3 + * \see CUpti_ActivityPCSamplingRecordInfo + * \see CUpti_ActivityCudaEvent + * \see CUpti_ActivityStream + * \see CUpti_ActivitySynchronization + * \see CUpti_ActivityInstructionCorrelation + * \see CUpti_ActivityExternalCorrelation + * \see CUpti_ActivityUnifiedMemoryCounter2 + * \see CUpti_ActivityOpenAccData + * \see CUpti_ActivityOpenAccLaunch + * \see CUpti_ActivityOpenAccOther + * \see CUpti_ActivityOpenMp + * \see CUpti_ActivityNvLink + * \see CUpti_ActivityNvLink2 + * \see CUpti_ActivityNvLink3 + * \see CUpti_ActivityNvLink4 + * \see CUpti_ActivityPcie + */ + +typedef enum { + /** + * The activity record is invalid. + */ + CUPTI_ACTIVITY_KIND_INVALID = 0, + + /** + * A host<->host, host<->device, or device<->device memory copy. The + * corresponding activity record structure is \ref + * CUpti_ActivityMemcpy5. + */ + CUPTI_ACTIVITY_KIND_MEMCPY = 1, + + /** + * A memory set executing on the GPU. The corresponding activity + * record structure is \ref CUpti_ActivityMemset4. + */ + CUPTI_ACTIVITY_KIND_MEMSET = 2, + + /** + * A kernel executing on the GPU. This activity kind may significantly change + * the overall performance characteristics of the application because all + * kernel executions are serialized on the GPU. Other activity kind for kernel + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL doesn't break kernel concurrency. + * The corresponding activity record structure is \ref CUpti_ActivityKernel9. + */ + CUPTI_ACTIVITY_KIND_KERNEL = 3, + + /** + * A CUDA driver API function execution. The corresponding activity + * record structure is \ref CUpti_ActivityAPI. + */ + CUPTI_ACTIVITY_KIND_DRIVER = 4, + + /** + * A CUDA runtime API function execution. The corresponding activity + * record structure is \ref CUpti_ActivityAPI. + */ + CUPTI_ACTIVITY_KIND_RUNTIME = 5, + + /** + * An event value. The corresponding activity record structure is + * \ref CUpti_ActivityEvent. + */ + CUPTI_ACTIVITY_KIND_EVENT = 6, + + /** + * A metric value. The corresponding activity record structure is + * \ref CUpti_ActivityMetric. + */ + CUPTI_ACTIVITY_KIND_METRIC = 7, + + /** + * Information about a device. The corresponding activity record + * structure is \ref CUpti_ActivityDevice5. + */ + CUPTI_ACTIVITY_KIND_DEVICE = 8, + + /** + * Information about a context. The corresponding activity record + * structure is \ref CUpti_ActivityContext2. + */ + CUPTI_ACTIVITY_KIND_CONTEXT = 9, + + /** + * A kernel executing on the GPU. This activity kind doesn't break + * kernel concurrency. The corresponding activity record structure + * is \ref CUpti_ActivityKernel9. + */ + CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL = 10, + + /** + * Resource naming done via NVTX APIs for thread, device, context, etc. + * The corresponding activity record structure is \ref CUpti_ActivityName. + */ + CUPTI_ACTIVITY_KIND_NAME = 11, + + /** + * Instantaneous, start, or end NVTX marker. The corresponding activity + * record structure is \ref CUpti_ActivityMarker2. + */ + CUPTI_ACTIVITY_KIND_MARKER = 12, + + /** + * Extended, optional, data about a marker. The corresponding + * activity record structure is \ref CUpti_ActivityMarkerData. + */ + CUPTI_ACTIVITY_KIND_MARKER_DATA = 13, + + /** + * Source information about source level result. The corresponding + * activity record structure is \ref CUpti_ActivitySourceLocator. + */ + CUPTI_ACTIVITY_KIND_SOURCE_LOCATOR = 14, + + /** + * Results for source-level global access. The + * corresponding activity record structure is \ref + * CUpti_ActivityGlobalAccess3. + */ + CUPTI_ACTIVITY_KIND_GLOBAL_ACCESS = 15, + + /** + * Results for source-level branch. The corresponding + * activity record structure is \ref CUpti_ActivityBranch2. + */ + CUPTI_ACTIVITY_KIND_BRANCH = 16, + + /** + * Overhead activity records. The + * corresponding activity record structure is + * \ref CUpti_ActivityOverhead3. + */ + CUPTI_ACTIVITY_KIND_OVERHEAD = 17, + + /** + * A CDP (CUDA Dynamic Parallel) kernel executing on the GPU. The + * corresponding activity record structure is \ref + * CUpti_ActivityCdpKernel. This activity can not be directly + * enabled or disabled. It is enabled and disabled through + * concurrent kernel activity i.e. _CONCURRENT_KERNEL. + */ + CUPTI_ACTIVITY_KIND_CDP_KERNEL = 18, + /** + * Preemption activity record indicating a preemption of a CDP (CUDA + * Dynamic Parallel) kernel executing on the GPU. The corresponding + * activity record structure is \ref CUpti_ActivityPreemption. + */ + CUPTI_ACTIVITY_KIND_PREEMPTION = 19, + + /** + * Environment activity records indicating power, clock, thermal, + * etc. levels of the GPU. The corresponding activity record + * structure is \ref CUpti_ActivityEnvironment. + */ + CUPTI_ACTIVITY_KIND_ENVIRONMENT = 20, + + /** + * An event value associated with a specific event domain + * instance. The corresponding activity record structure is \ref + * CUpti_ActivityEventInstance. + */ + CUPTI_ACTIVITY_KIND_EVENT_INSTANCE = 21, + + /** + * A peer to peer memory copy. The corresponding activity record + * structure is \ref CUpti_ActivityMemcpyPtoP4. + */ + CUPTI_ACTIVITY_KIND_MEMCPY2 = 22, + + /** + * A metric value associated with a specific metric domain + * instance. The corresponding activity record structure is \ref + * CUpti_ActivityMetricInstance. + */ + CUPTI_ACTIVITY_KIND_METRIC_INSTANCE = 23, + + /** + * Results for source-level instruction execution. + * The corresponding activity record structure is \ref + * CUpti_ActivityInstructionExecution. + */ + CUPTI_ACTIVITY_KIND_INSTRUCTION_EXECUTION = 24, + + /** + * Unified Memory counter record. The corresponding activity + * record structure is \ref CUpti_ActivityUnifiedMemoryCounter2. + */ + CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER = 25, + + /** + * Device global/function record. The corresponding activity + * record structure is \ref CUpti_ActivityFunction. + */ + CUPTI_ACTIVITY_KIND_FUNCTION = 26, + + /** + * CUDA Module record. The corresponding activity + * record structure is \ref CUpti_ActivityModule. + */ + CUPTI_ACTIVITY_KIND_MODULE = 27, + + /** + * A device attribute value. The corresponding activity record + * structure is \ref CUpti_ActivityDeviceAttribute. + */ + CUPTI_ACTIVITY_KIND_DEVICE_ATTRIBUTE = 28, + + /** + * Results for source-level shared access. The + * corresponding activity record structure is \ref + * CUpti_ActivitySharedAccess. + */ + CUPTI_ACTIVITY_KIND_SHARED_ACCESS = 29, + + /** + * Enable PC sampling for kernels. This will serialize + * kernels. The corresponding activity record structure + * is \ref CUpti_ActivityPCSampling3. + */ + CUPTI_ACTIVITY_KIND_PC_SAMPLING = 30, + + /** + * Summary information about PC sampling records. The + * corresponding activity record structure is \ref + * CUpti_ActivityPCSamplingRecordInfo. + */ + CUPTI_ACTIVITY_KIND_PC_SAMPLING_RECORD_INFO = 31, + + /** + * SASS/Source line-by-line correlation record. + * This will generate sass/source correlation for functions that have source + * level analysis or pc sampling results. The records will be generated only + * when either of source level analysis or pc sampling activity is enabled. + * The corresponding activity record structure is \ref + * CUpti_ActivityInstructionCorrelation. + */ + CUPTI_ACTIVITY_KIND_INSTRUCTION_CORRELATION = 32, + + /** + * OpenACC data events. + * The corresponding activity record structure is \ref + * CUpti_ActivityOpenAccData. + */ + CUPTI_ACTIVITY_KIND_OPENACC_DATA = 33, + + /** + * OpenACC launch events. + * The corresponding activity record structure is \ref + * CUpti_ActivityOpenAccLaunch. + */ + CUPTI_ACTIVITY_KIND_OPENACC_LAUNCH = 34, + + /** + * OpenACC other events. + * The corresponding activity record structure is \ref + * CUpti_ActivityOpenAccOther. + */ + CUPTI_ACTIVITY_KIND_OPENACC_OTHER = 35, + + /** + * Information about a CUDA event. The + * corresponding activity record structure is \ref + * CUpti_ActivityCudaEvent. + */ + CUPTI_ACTIVITY_KIND_CUDA_EVENT = 36, + + /** + * Information about a CUDA stream. The + * corresponding activity record structure is \ref + * CUpti_ActivityStream. + */ + CUPTI_ACTIVITY_KIND_STREAM = 37, + + /** + * Records for synchronization management. The + * corresponding activity record structure is \ref + * CUpti_ActivitySynchronization. + */ + CUPTI_ACTIVITY_KIND_SYNCHRONIZATION = 38, + + /** + * Records for correlation of different programming APIs. The + * corresponding activity record structure is \ref + * CUpti_ActivityExternalCorrelation. + */ + CUPTI_ACTIVITY_KIND_EXTERNAL_CORRELATION = 39, + + /** + * NVLink information. + * The corresponding activity record structure is \ref + * CUpti_ActivityNvLink4. + */ + CUPTI_ACTIVITY_KIND_NVLINK = 40, + + /** + * Instantaneous Event information. + * The corresponding activity record structure is \ref + * CUpti_ActivityInstantaneousEvent. + */ + CUPTI_ACTIVITY_KIND_INSTANTANEOUS_EVENT = 41, + + /** + * Instantaneous Event information for a specific event + * domain instance. + * The corresponding activity record structure is \ref + * CUpti_ActivityInstantaneousEventInstance + */ + CUPTI_ACTIVITY_KIND_INSTANTANEOUS_EVENT_INSTANCE = 42, + + /** + * Instantaneous Metric information + * The corresponding activity record structure is \ref + * CUpti_ActivityInstantaneousMetric. + */ + CUPTI_ACTIVITY_KIND_INSTANTANEOUS_METRIC = 43, + + /** + * Instantaneous Metric information for a specific metric + * domain instance. + * The corresponding activity record structure is \ref + * CUpti_ActivityInstantaneousMetricInstance. + */ + CUPTI_ACTIVITY_KIND_INSTANTANEOUS_METRIC_INSTANCE = 44, + + /** + * Memory activity tracking allocation and freeing of the memory + * The corresponding activity record structure is \ref + * CUpti_ActivityMemory. + */ + CUPTI_ACTIVITY_KIND_MEMORY = 45, + + /** + * PCI devices information used for PCI topology. + * The corresponding activity record structure is \ref + * CUpti_ActivityPcie. + */ + CUPTI_ACTIVITY_KIND_PCIE = 46, + + /** + * OpenMP parallel events. + * The corresponding activity record structure is \ref + * CUpti_ActivityOpenMp. + */ + CUPTI_ACTIVITY_KIND_OPENMP = 47, + + /** + * A CUDA driver kernel launch occurring outside of any + * public API function execution. Tools can handle these + * like records for driver API launch functions, although + * the cbid field is not used here. + * The corresponding activity record structure is \ref + * CUpti_ActivityAPI. + */ + CUPTI_ACTIVITY_KIND_INTERNAL_LAUNCH_API = 48, + + /** + * Memory activity tracking allocation and freeing of the memory + * The corresponding activity record structure is \ref + * CUpti_ActivityMemory3. + */ + CUPTI_ACTIVITY_KIND_MEMORY2 = 49, + + /** + * Memory pool activity tracking creation, destruction and + * trimming of the memory pool. + * The corresponding activity record structure is \ref + * CUpti_ActivityMemoryPool2. + */ + CUPTI_ACTIVITY_KIND_MEMORY_POOL = 50, + + /** + * The corresponding activity record structure is + * \ref CUpti_ActivityGraphTrace2. + */ + CUPTI_ACTIVITY_KIND_GRAPH_TRACE = 51, + + /** + * JIT operation tracking + * The corresponding activity record structure is \ref + * CUpti_ActivityJit. + */ + CUPTI_ACTIVITY_KIND_JIT = 52, + + CUPTI_ACTIVITY_KIND_COUNT, + + CUPTI_ACTIVITY_KIND_FORCE_INT = 0x7fffffff +} CUpti_ActivityKind; + +/** + * \brief The kinds of activity objects. + * \see CUpti_ActivityObjectKindId + */ +typedef enum { + /** + * The object kind is not known. + */ + CUPTI_ACTIVITY_OBJECT_UNKNOWN = 0, + + /** + * A process. + */ + CUPTI_ACTIVITY_OBJECT_PROCESS = 1, + + /** + * A thread. + */ + CUPTI_ACTIVITY_OBJECT_THREAD = 2, + + /** + * A device. + */ + CUPTI_ACTIVITY_OBJECT_DEVICE = 3, + + /** + * A context. + */ + CUPTI_ACTIVITY_OBJECT_CONTEXT = 4, + + /** + * A stream. + */ + CUPTI_ACTIVITY_OBJECT_STREAM = 5, + + CUPTI_ACTIVITY_OBJECT_FORCE_INT = 0x7fffffff +} CUpti_ActivityObjectKind; + +/** + * \brief Identifiers for object kinds as specified by + * CUpti_ActivityObjectKind. + * \see CUpti_ActivityObjectKind + */ +typedef union { + /** + * A process object requires that we identify the process ID. A + * thread object requires that we identify both the process and + * thread ID. + */ + struct { + uint32_t processId; + uint32_t threadId; + } pt; + + /** + * A device object requires that we identify the device ID. A + * context object requires that we identify both the device and + * context ID. A stream object requires that we identify device, + * context, and stream ID. + */ + struct { + uint32_t deviceId; + uint32_t contextId; + uint32_t streamId; + } dcs; +} CUpti_ActivityObjectKindId; + +/** + * \brief The structure to provide additional data for CUPTI_ACTIVITY_OVERHEAD_COMMAND_BUFFER_FULL. + */ +typedef struct { + /** + * The length of the command buffer. + * + */ + uint32_t commandBufferLength; + /** + * The channel ID of the command buffer. + * + */ + uint32_t channelID; + /** + * The channel type of the command buffer. + * + */ + uint32_t channelType; +} CUpti_ActivityOverheadCommandBufferFullData; + +/** + * \brief The kinds of activity overhead. + */ +typedef enum { + /** + * The overhead kind is not known. + */ + CUPTI_ACTIVITY_OVERHEAD_UNKNOWN = 0, + + /** + * Compiler overhead. + */ + CUPTI_ACTIVITY_OVERHEAD_DRIVER_COMPILER = 1, + + /** + * Activity buffer flush overhead. + */ + CUPTI_ACTIVITY_OVERHEAD_CUPTI_BUFFER_FLUSH = 1<<16, + + /** + * CUPTI instrumentation overhead. + */ + CUPTI_ACTIVITY_OVERHEAD_CUPTI_INSTRUMENTATION = 2<<16, + + /** + * CUPTI resource creation and destruction overhead. + */ + CUPTI_ACTIVITY_OVERHEAD_CUPTI_RESOURCE = 3<<16, + + /** + * CUDA Runtime triggered module loading overhead. + */ + CUPTI_ACTIVITY_OVERHEAD_RUNTIME_TRIGGERED_MODULE_LOADING = 4<<16, + + /** + * Lazy function loading overhead. + */ + CUPTI_ACTIVITY_OVERHEAD_LAZY_FUNCTION_LOADING = 5<<16, + + /** + * Overhead due to lack of command buffer space. + * Refer CUpti_ActivityOverheadCommandBufferFullData for more details. + */ + CUPTI_ACTIVITY_OVERHEAD_COMMAND_BUFFER_FULL = 6<<16, + + CUPTI_ACTIVITY_OVERHEAD_FORCE_INT = 0x7fffffff +} CUpti_ActivityOverheadKind; + +/** + * \brief The kind of a compute API. + */ +typedef enum { + /** + * The compute API is not known. + */ + CUPTI_ACTIVITY_COMPUTE_API_UNKNOWN = 0, + + /** + * The compute APIs are for CUDA. + */ + CUPTI_ACTIVITY_COMPUTE_API_CUDA = 1, + + /** + * The compute APIs are for CUDA running + * in MPS (Multi-Process Service) environment. + */ + CUPTI_ACTIVITY_COMPUTE_API_CUDA_MPS = 2, + + CUPTI_ACTIVITY_COMPUTE_API_FORCE_INT = 0x7fffffff +} CUpti_ActivityComputeApiKind; + +/** + * \brief Flags associated with activity records. + * + * Activity record flags. Flags can be combined by bitwise OR to + * associated multiple flags with an activity record. Each flag is + * specific to a certain activity kind, as noted below. + */ +typedef enum { + /** + * Indicates the activity record has no flags. + */ + CUPTI_ACTIVITY_FLAG_NONE = 0, + + /** + * Indicates the activity represents a device that supports + * concurrent kernel execution. Valid for + * CUPTI_ACTIVITY_KIND_DEVICE. + */ + CUPTI_ACTIVITY_FLAG_DEVICE_CONCURRENT_KERNELS = 1 << 0, + + /** + * Indicates if the activity represents a CUdevice_attribute value + * or a CUpti_DeviceAttribute value. Valid for + * CUPTI_ACTIVITY_KIND_DEVICE_ATTRIBUTE. + */ + CUPTI_ACTIVITY_FLAG_DEVICE_ATTRIBUTE_CUDEVICE = 1 << 0, + + /** + * Indicates the activity represents an asynchronous memcpy + * operation. Valid for CUPTI_ACTIVITY_KIND_MEMCPY. + */ + CUPTI_ACTIVITY_FLAG_MEMCPY_ASYNC = 1 << 0, + + /** + * Indicates the activity represents an instantaneous marker. Valid + * for CUPTI_ACTIVITY_KIND_MARKER. + */ + CUPTI_ACTIVITY_FLAG_MARKER_INSTANTANEOUS = 1 << 0, + + /** + * Indicates the activity represents a region start marker. Valid + * for CUPTI_ACTIVITY_KIND_MARKER. + */ + CUPTI_ACTIVITY_FLAG_MARKER_START = 1 << 1, + + /** + * Indicates the activity represents a region end marker. Valid for + * CUPTI_ACTIVITY_KIND_MARKER. + */ + CUPTI_ACTIVITY_FLAG_MARKER_END = 1 << 2, + + /** + * Indicates the activity represents an attempt to acquire a user + * defined synchronization object. + * Valid for CUPTI_ACTIVITY_KIND_MARKER. + */ + CUPTI_ACTIVITY_FLAG_MARKER_SYNC_ACQUIRE = 1 << 3, + + /** + * Indicates the activity represents success in acquiring the + * user defined synchronization object. + * Valid for CUPTI_ACTIVITY_KIND_MARKER. + */ + CUPTI_ACTIVITY_FLAG_MARKER_SYNC_ACQUIRE_SUCCESS = 1 << 4, + + /** + * Indicates the activity represents failure in acquiring the + * user defined synchronization object. + * Valid for CUPTI_ACTIVITY_KIND_MARKER. + */ + CUPTI_ACTIVITY_FLAG_MARKER_SYNC_ACQUIRE_FAILED = 1 << 5, + + /** + * Indicates the activity represents releasing a reservation on + * user defined synchronization object. + * Valid for CUPTI_ACTIVITY_KIND_MARKER. + */ + CUPTI_ACTIVITY_FLAG_MARKER_SYNC_RELEASE = 1 << 6, + + /** + * Indicates the activity represents a marker that does not specify + * a color. Valid for CUPTI_ACTIVITY_KIND_MARKER_DATA. + */ + CUPTI_ACTIVITY_FLAG_MARKER_COLOR_NONE = 1 << 0, + + /** + * Indicates the activity represents a marker that specifies a color + * in alpha-red-green-blue format. Valid for + * CUPTI_ACTIVITY_KIND_MARKER_DATA. + */ + CUPTI_ACTIVITY_FLAG_MARKER_COLOR_ARGB = 1 << 1, + + /** + * The number of bytes requested by each thread + * Valid for CUpti_ActivityGlobalAccess3. + */ + CUPTI_ACTIVITY_FLAG_GLOBAL_ACCESS_KIND_SIZE_MASK = 0xFF << 0, + + /** + * If bit in this flag is set, the access was load, else it is a + * store access. Valid for CUpti_ActivityGlobalAccess3. + */ + CUPTI_ACTIVITY_FLAG_GLOBAL_ACCESS_KIND_LOAD = 1 << 8, + + /** + * If this bit in flag is set, the load access was cached else it is + * uncached. Valid for CUpti_ActivityGlobalAccess3. + */ + CUPTI_ACTIVITY_FLAG_GLOBAL_ACCESS_KIND_CACHED = 1 << 9, + + /** + * If this bit in flag is set, the metric value overflowed. Valid + * for CUpti_ActivityMetric and CUpti_ActivityMetricInstance. + */ + CUPTI_ACTIVITY_FLAG_METRIC_OVERFLOWED = 1 << 0, + + /** + * If this bit in flag is set, the metric value couldn't be + * calculated. This occurs when a value(s) required to calculate the + * metric is missing. Valid for CUpti_ActivityMetric and + * CUpti_ActivityMetricInstance. + */ + CUPTI_ACTIVITY_FLAG_METRIC_VALUE_INVALID = 1 << 1, + + /** + * If this bit in flag is set, the source level metric value couldn't be + * calculated. This occurs when a value(s) required to calculate the + * source level metric cannot be evaluated. + * Valid for CUpti_ActivityInstructionExecution. + */ + CUPTI_ACTIVITY_FLAG_INSTRUCTION_VALUE_INVALID = 1 << 0, + + /** + * The mask for the instruction class, \ref CUpti_ActivityInstructionClass + * Valid for CUpti_ActivityInstructionExecution and + * CUpti_ActivityInstructionCorrelation + */ + CUPTI_ACTIVITY_FLAG_INSTRUCTION_CLASS_MASK = 0xFF << 1, + + /** + * When calling cuptiActivityFlushAll, this flag + * can be set to force CUPTI to flush all records in the buffer, whether + * finished or not + */ + CUPTI_ACTIVITY_FLAG_FLUSH_FORCED = 1 << 0, + + /** + * The number of bytes requested by each thread + * Valid for CUpti_ActivitySharedAccess. + */ + CUPTI_ACTIVITY_FLAG_SHARED_ACCESS_KIND_SIZE_MASK = 0xFF << 0, + + /** + * If bit in this flag is set, the access was load, else it is a + * store access. Valid for CUpti_ActivitySharedAccess. + */ + CUPTI_ACTIVITY_FLAG_SHARED_ACCESS_KIND_LOAD = 1 << 8, + + /** + * Indicates the activity represents an asynchronous memset + * operation. Valid for CUPTI_ACTIVITY_KIND_MEMSET. + */ + CUPTI_ACTIVITY_FLAG_MEMSET_ASYNC = 1 << 0, + + /** + * Indicates the activity represents thrashing in CPU. + * Valid for counter of kind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THRASHING in + * CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER + */ + CUPTI_ACTIVITY_FLAG_THRASHING_IN_CPU = 1 << 0, + + /** + * Indicates the activity represents page throttling in CPU. + * Valid for counter of kind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THROTTLING in + * CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER + */ + CUPTI_ACTIVITY_FLAG_THROTTLING_IN_CPU = 1 << 0, + + CUPTI_ACTIVITY_FLAG_FORCE_INT = 0x7fffffff +} CUpti_ActivityFlag; + +/** + * \brief The stall reason for PC sampling activity. + */ +typedef enum { + /** + * Invalid reason + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_INVALID = 0, + + /** + * No stall, instruction is selected for issue + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_NONE = 1, + + /** + * Warp is blocked because next instruction is not yet available, + * because of instruction cache miss, or because of branching effects + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_INST_FETCH = 2, + + /** + * Instruction is waiting on an arithmetic dependency + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_EXEC_DEPENDENCY = 3, + + /** + * Warp is blocked because it is waiting for a memory access to complete. + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_MEMORY_DEPENDENCY = 4, + + /** + * Texture sub-system is fully utilized or has too many outstanding requests. + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_TEXTURE = 5, + + /** + * Warp is blocked as it is waiting at __syncthreads() or at memory barrier. + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_SYNC = 6, + + /** + * Warp is blocked waiting for __constant__ memory and immediate memory access to complete. + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_CONSTANT_MEMORY_DEPENDENCY = 7, + + /** + * Compute operation cannot be performed due to the required resources not + * being available. + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_PIPE_BUSY = 8, + + /** + * Warp is blocked because there are too many pending memory operations. + * In Kepler architecture it often indicates high number of memory replays. + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_MEMORY_THROTTLE = 9, + + /** + * Warp was ready to issue, but some other warp issued instead. + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_NOT_SELECTED = 10, + + /** + * Miscellaneous reasons + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_OTHER = 11, + + /** + * Sleeping. + */ + CUPTI_ACTIVITY_PC_SAMPLING_STALL_SLEEPING = 12, + + CUPTI_ACTIVITY_PC_SAMPLING_STALL_FORCE_INT = 0x7fffffff +} CUpti_ActivityPCSamplingStallReason; + +/** + * \brief Sampling period for PC sampling method + * + * Sampling period can be set using \ref cuptiActivityConfigurePCSampling + */ +typedef enum { + /** + * The PC sampling period is not set. + */ + CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_INVALID = 0, + + /** + * Minimum sampling period available on the device. + */ + CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_MIN = 1, + + /** + * Sampling period in lower range. + */ + CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_LOW = 2, + + /** + * Medium sampling period. + */ + CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_MID = 3, + + /** + * Sampling period in higher range. + */ + CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_HIGH = 4, + + /** + * Maximum sampling period available on the device. + */ + CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_MAX = 5, + + CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_FORCE_INT = 0x7fffffff +} CUpti_ActivityPCSamplingPeriod; + +/** + * \brief The kind of a memory copy, indicating the source and + * destination targets of the copy. + * + * Each kind represents the source and destination targets of a memory + * copy. Targets are host, device, and array. + */ +typedef enum { + /** + * The memory copy kind is not known. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_UNKNOWN = 0, + + /** + * A host to device memory copy. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_HTOD = 1, + + /** + * A device to host memory copy. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_DTOH = 2, + + /** + * A host to device array memory copy. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_HTOA = 3, + + /** + * A device array to host memory copy. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_ATOH = 4, + + /** + * A device array to device array memory copy. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_ATOA = 5, + + /** + * A device array to device memory copy. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_ATOD = 6, + + /** + * A device to device array memory copy. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_DTOA = 7, + + /** + * A device to device memory copy on the same device. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_DTOD = 8, + + /** + * A host to host memory copy. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_HTOH = 9, + + /** + * A peer to peer memory copy across different devices. + */ + CUPTI_ACTIVITY_MEMCPY_KIND_PTOP = 10, + + CUPTI_ACTIVITY_MEMCPY_KIND_FORCE_INT = 0x7fffffff +} CUpti_ActivityMemcpyKind; + +/** + * \brief The kinds of memory accessed by a memory operation/copy. + * + * Each kind represents the type of the memory + * accessed by a memory operation/copy. + */ +typedef enum { + /** + * The memory kind is unknown. + */ + CUPTI_ACTIVITY_MEMORY_KIND_UNKNOWN = 0, + + /** + * The memory is pageable. + */ + CUPTI_ACTIVITY_MEMORY_KIND_PAGEABLE = 1, + + /** + * The memory is pinned. + */ + CUPTI_ACTIVITY_MEMORY_KIND_PINNED = 2, + + /** + * The memory is on the device. + */ + CUPTI_ACTIVITY_MEMORY_KIND_DEVICE = 3, + + /** + * The memory is an array. + */ + CUPTI_ACTIVITY_MEMORY_KIND_ARRAY = 4, + + /** + * The memory is managed + */ + CUPTI_ACTIVITY_MEMORY_KIND_MANAGED = 5, + + /** + * The memory is device static + */ + CUPTI_ACTIVITY_MEMORY_KIND_DEVICE_STATIC = 6, + + /** + * The memory is managed static + */ + CUPTI_ACTIVITY_MEMORY_KIND_MANAGED_STATIC = 7, + + CUPTI_ACTIVITY_MEMORY_KIND_FORCE_INT = 0x7fffffff +} CUpti_ActivityMemoryKind; + +/** + * \brief The kind of a preemption activity. + */ +typedef enum { + /** + * The preemption kind is not known. + */ + CUPTI_ACTIVITY_PREEMPTION_KIND_UNKNOWN = 0, + + /** + * Preemption to save CDP block. + */ + CUPTI_ACTIVITY_PREEMPTION_KIND_SAVE = 1, + + /** + * Preemption to restore CDP block. + */ + CUPTI_ACTIVITY_PREEMPTION_KIND_RESTORE = 2, + + CUPTI_ACTIVITY_PREEMPTION_KIND_FORCE_INT = 0x7fffffff +} CUpti_ActivityPreemptionKind; + +/** + * \brief The kind of environment data. Used to indicate what type of + * data is being reported by an environment activity record. + */ +typedef enum { + /** + * Unknown data. + */ + CUPTI_ACTIVITY_ENVIRONMENT_UNKNOWN = 0, + + /** + * The environment data is related to speed. + */ + CUPTI_ACTIVITY_ENVIRONMENT_SPEED = 1, + + /** + * The environment data is related to temperature. + */ + CUPTI_ACTIVITY_ENVIRONMENT_TEMPERATURE = 2, + + /** + * The environment data is related to power. + */ + CUPTI_ACTIVITY_ENVIRONMENT_POWER = 3, + + /** + * The environment data is related to cooling. + */ + CUPTI_ACTIVITY_ENVIRONMENT_COOLING = 4, + + CUPTI_ACTIVITY_ENVIRONMENT_COUNT, + + CUPTI_ACTIVITY_ENVIRONMENT_KIND_FORCE_INT = 0x7fffffff +} CUpti_ActivityEnvironmentKind; + +/** + * \brief Reasons for clock throttling. + * + * The possible reasons that a clock can be throttled. There can be + * more than one reason that a clock is being throttled so these types + * can be combined by bitwise OR. These are used in the + * clocksThrottleReason field in the Environment Activity Record. + */ +typedef enum { + /** + * Nothing is running on the GPU and the clocks are dropping to idle + * state. + */ + CUPTI_CLOCKS_THROTTLE_REASON_GPU_IDLE = 0x00000001, + + /** + * The GPU clocks are limited by a user specified limit. + */ + CUPTI_CLOCKS_THROTTLE_REASON_USER_DEFINED_CLOCKS = 0x00000002, + + /** + * A software power scaling algorithm is reducing the clocks below + * requested clocks. + */ + CUPTI_CLOCKS_THROTTLE_REASON_SW_POWER_CAP = 0x00000004, + + /** + * Hardware slowdown to reduce the clock by a factor of two or more + * is engaged. This is an indicator of one of the following: 1) + * Temperature is too high, 2) External power brake assertion is + * being triggered (e.g. by the system power supply), 3) Change in + * power state. + */ + CUPTI_CLOCKS_THROTTLE_REASON_HW_SLOWDOWN = 0x00000008, + + /** + * Some unspecified factor is reducing the clocks. + */ + CUPTI_CLOCKS_THROTTLE_REASON_UNKNOWN = 0x80000000, + + /** + * Throttle reason is not supported for this GPU. + */ + CUPTI_CLOCKS_THROTTLE_REASON_UNSUPPORTED = 0x40000000, + + /** + * No clock throttling. + */ + CUPTI_CLOCKS_THROTTLE_REASON_NONE = 0x00000000, + + CUPTI_CLOCKS_THROTTLE_REASON_FORCE_INT = 0x7fffffff +} CUpti_EnvironmentClocksThrottleReason; + +/** + * \brief Scope of the unified memory counter (deprecated in CUDA 7.0) + */ +typedef enum { + /** + * The unified memory counter scope is not known. + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_SCOPE_UNKNOWN = 0, + + /** + * Collect unified memory counter for single process on one device + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_SCOPE_PROCESS_SINGLE_DEVICE = 1, + + /** + * Collect unified memory counter for single process across all devices + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_SCOPE_PROCESS_ALL_DEVICES = 2, + + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_SCOPE_COUNT, + + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_SCOPE_FORCE_INT = 0x7fffffff +} CUpti_ActivityUnifiedMemoryCounterScope; + +/** + * \brief Kind of the Unified Memory counter + * + * Many activities are associated with Unified Memory mechanism; among them + * are transfers from host to device, device to host, page fault at + * host side. + */ +typedef enum { + /** + * The unified memory counter kind is not known. + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_UNKNOWN = 0, + + /** + * Number of bytes transferred from host to device + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_HTOD = 1, + + /** + * Number of bytes transferred from device to host + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_DTOH = 2, + + /** + * Number of CPU page faults, this is only supported on 64 bit + * Linux and Mac platforms + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_CPU_PAGE_FAULT_COUNT = 3, + + /** + * Number of GPU page faults, this is only supported on devices with + * compute capability 6.0 and higher and 64 bit Linux platforms + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_GPU_PAGE_FAULT = 4, + + /** + * Thrashing occurs when data is frequently accessed by + * multiple processors and has to be constantly migrated around + * to achieve data locality. In this case the overhead of migration + * may exceed the benefits of locality. + * This is only supported on 64 bit Linux platforms. + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THRASHING = 5, + + /** + * Throttling is a prevention technique used by the driver to avoid + * further thrashing. Here, the driver doesn't service the fault for + * one of the contending processors for a specific period of time, + * so that the other processor can run at full-speed. + * This is only supported on 64 bit Linux platforms. + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THROTTLING = 6, + + /** + * In case throttling does not help, the driver tries to pin the memory + * to a processor for a specific period of time. One of the contending + * processors will have slow access to the memory, while the other will + * have fast access. + * This is only supported on 64 bit Linux platforms. + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_REMOTE_MAP = 7, + + /** + * Number of bytes transferred from one device to another device. + * This is only supported on 64 bit Linux platforms. + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_DTOD = 8, + + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_COUNT, + + CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_FORCE_INT = 0x7fffffff +} CUpti_ActivityUnifiedMemoryCounterKind; + +/** + * \brief Memory access type for unified memory page faults + * + * This is valid for \ref CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_GPU_PAGE_FAULT + * and \ref CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_CPU_PAGE_FAULT_COUNT + */ +typedef enum { + /** + * The unified memory access type is not known + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_ACCESS_TYPE_UNKNOWN = 0, + + /** + * The page fault was triggered by read memory instruction + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_ACCESS_TYPE_READ = 1, + + /** + * The page fault was triggered by write memory instruction + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_ACCESS_TYPE_WRITE = 2, + + /** + * The page fault was triggered by atomic memory instruction + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_ACCESS_TYPE_ATOMIC = 3, + + /** + * The page fault was triggered by memory prefetch operation + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_ACCESS_TYPE_PREFETCH = 4 +} CUpti_ActivityUnifiedMemoryAccessType; + +/** + * \brief Migration cause of the Unified Memory counter + * + * This is valid for \ref CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_HTOD and + * \ref CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_DTOH + */ +typedef enum { + /** + * The unified memory migration cause is not known + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_MIGRATION_CAUSE_UNKNOWN = 0, + + /** + * The unified memory migrated due to an explicit call from + * the user e.g. cudaMemPrefetchAsync + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_MIGRATION_CAUSE_USER = 1, + + /** + * The unified memory migrated to guarantee data coherence + * e.g. CPU/GPU faults on Pascal+ and kernel launch on pre-Pascal GPUs + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_MIGRATION_CAUSE_COHERENCE = 2, + + /** + * The unified memory was speculatively migrated by the UVM driver + * before being accessed by the destination processor to improve + * performance + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_MIGRATION_CAUSE_PREFETCH = 3, + + /** + * The unified memory migrated to the CPU because it was evicted to make + * room for another block of memory on the GPU + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_MIGRATION_CAUSE_EVICTION = 4, + + /** + * The unified memory migrated to another processor because of access counter + * notifications. Only frequently accessed pages are migrated between CPU and GPU, or + * between peer GPUs. + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_MIGRATION_CAUSE_ACCESS_COUNTERS = 5, +} CUpti_ActivityUnifiedMemoryMigrationCause; + +/** + * \brief Remote memory map cause of the Unified Memory counter + * + * This is valid for \ref CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_REMOTE_MAP + */ +typedef enum { + /** + * The cause of mapping to remote memory was unknown + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_REMOTE_MAP_CAUSE_UNKNOWN = 0, + + /** + * Mapping to remote memory was added to maintain data coherence. + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_REMOTE_MAP_CAUSE_COHERENCE = 1, + + /** + * Mapping to remote memory was added to prevent further thrashing + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_REMOTE_MAP_CAUSE_THRASHING = 2, + + /** + * Mapping to remote memory was added to enforce the hints + * specified by the programmer or by performance heuristics of the + * UVM driver + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_REMOTE_MAP_CAUSE_POLICY = 3, + + /** + * Mapping to remote memory was added because there is no more + * memory available on the processor and eviction was not + * possible + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_REMOTE_MAP_CAUSE_OUT_OF_MEMORY = 4, + + /** + * Mapping to remote memory was added after the memory was + * evicted to make room for another block of memory on the GPU + */ + CUPTI_ACTIVITY_UNIFIED_MEMORY_REMOTE_MAP_CAUSE_EVICTION = 5, +} CUpti_ActivityUnifiedMemoryRemoteMapCause; + +/** + * \brief SASS instruction classification. + * + * The sass instruction are broadly divided into different class. Each enum represents a classification. + */ +typedef enum { + /** + * The instruction class is not known. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_UNKNOWN = 0, + + /** + * Represents a 32 bit floating point operation. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_FP_32 = 1, + + /** + * Represents a 64 bit floating point operation. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_FP_64 = 2, + + /** + * Represents an integer operation. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_INTEGER = 3, + + /** + * Represents a bit conversion operation. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_BIT_CONVERSION = 4, + + /** + * Represents a control flow instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_CONTROL_FLOW = 5, + + /** + * Represents a global load-store instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_GLOBAL = 6, + + /** + * Represents a shared load-store instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_SHARED = 7, + + /** + * Represents a local load-store instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_LOCAL = 8, + + /** + * Represents a generic load-store instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_GENERIC = 9, + + /** + * Represents a surface load-store instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_SURFACE = 10, + + /** + * Represents a constant load instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_CONSTANT = 11, + + /** + * Represents a texture load-store instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_TEXTURE = 12, + + /** + * Represents a global atomic instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_GLOBAL_ATOMIC = 13, + + /** + * Represents a shared atomic instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_SHARED_ATOMIC = 14, + + /** + * Represents a surface atomic instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_SURFACE_ATOMIC = 15, + + /** + * Represents a inter-thread communication instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_INTER_THREAD_COMMUNICATION = 16, + + /** + * Represents a barrier instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_BARRIER = 17, + + /** + * Represents some miscellaneous instructions which do not fit in the above classification. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_MISCELLANEOUS = 18, + + /** + * Represents a 16 bit floating point operation. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_FP_16 = 19, + + /** + * Represents uniform instruction. + */ + CUPTI_ACTIVITY_INSTRUCTION_CLASS_UNIFORM = 20, + + CUPTI_ACTIVITY_INSTRUCTION_CLASS_KIND_FORCE_INT = 0x7fffffff +} CUpti_ActivityInstructionClass; + +/** + * \brief Partitioned global caching option + */ +typedef enum { + /** + * Partitioned global cache config unknown. + */ + CUPTI_ACTIVITY_PARTITIONED_GLOBAL_CACHE_CONFIG_UNKNOWN = 0, + + /** + * Partitioned global cache not supported. + */ + CUPTI_ACTIVITY_PARTITIONED_GLOBAL_CACHE_CONFIG_NOT_SUPPORTED = 1, + + /** + * Partitioned global cache config off. + */ + CUPTI_ACTIVITY_PARTITIONED_GLOBAL_CACHE_CONFIG_OFF = 2, + + /** + * Partitioned global cache config on. + */ + CUPTI_ACTIVITY_PARTITIONED_GLOBAL_CACHE_CONFIG_ON = 3, + + CUPTI_ACTIVITY_PARTITIONED_GLOBAL_CACHE_CONFIG_FORCE_INT = 0x7fffffff +} CUpti_ActivityPartitionedGlobalCacheConfig; + +/** + * \brief Synchronization type. + * + * The types of synchronization to be used with CUpti_ActivitySynchronization. + */ + +typedef enum { + /** + * Unknown data. + */ + CUPTI_ACTIVITY_SYNCHRONIZATION_TYPE_UNKNOWN = 0, + + /** + * Event synchronize API. + */ + CUPTI_ACTIVITY_SYNCHRONIZATION_TYPE_EVENT_SYNCHRONIZE = 1, + + /** + * Stream wait event API. + */ + CUPTI_ACTIVITY_SYNCHRONIZATION_TYPE_STREAM_WAIT_EVENT = 2, + + /** + * Stream synchronize API. + */ + CUPTI_ACTIVITY_SYNCHRONIZATION_TYPE_STREAM_SYNCHRONIZE = 3, + + /** + * Context synchronize API. + */ + CUPTI_ACTIVITY_SYNCHRONIZATION_TYPE_CONTEXT_SYNCHRONIZE = 4, + + CUPTI_ACTIVITY_SYNCHRONIZATION_TYPE_FORCE_INT = 0x7fffffff +} CUpti_ActivitySynchronizationType; + +/** + * \brief stream type. + * + * The types of stream to be used with CUpti_ActivityStream. + */ + +typedef enum { + /** + * Unknown data. + */ + CUPTI_ACTIVITY_STREAM_CREATE_FLAG_UNKNOWN = 0, + + /** + * Default stream. + */ + CUPTI_ACTIVITY_STREAM_CREATE_FLAG_DEFAULT = 1, + + /** + * Non-blocking stream. + */ + CUPTI_ACTIVITY_STREAM_CREATE_FLAG_NON_BLOCKING = 2, + + /** + * Null stream. + */ + CUPTI_ACTIVITY_STREAM_CREATE_FLAG_NULL = 3, + + /** + * Stream create Mask + */ + CUPTI_ACTIVITY_STREAM_CREATE_MASK = 0xFFFF, + + CUPTI_ACTIVITY_STREAM_CREATE_FLAG_FORCE_INT = 0x7fffffff +} CUpti_ActivityStreamFlag; + +/** +* \brief Link flags. +* +* Describes link properties, to be used with CUpti_ActivityNvLink. +*/ + +typedef enum { + /** + * The flag is invalid. + */ + CUPTI_LINK_FLAG_INVALID = 0, + + /** + * Is peer to peer access supported by this link. + */ + CUPTI_LINK_FLAG_PEER_ACCESS = (1 << 1), + + /** + * Is system memory access supported by this link. + */ + CUPTI_LINK_FLAG_SYSMEM_ACCESS = (1 << 2), + + /** + * Is peer atomic access supported by this link. + */ + CUPTI_LINK_FLAG_PEER_ATOMICS = (1 << 3), + + /** + * Is system memory atomic access supported by this link. + */ + CUPTI_LINK_FLAG_SYSMEM_ATOMICS = (1 << 4), + + CUPTI_LINK_FLAG_FORCE_INT = 0x7fffffff +} CUpti_LinkFlag; + +/** +* \brief Memory operation types. +* +* Describes the type of memory operation, to be used with CUpti_ActivityMemory3. +*/ + +typedef enum { + /** + * The operation is invalid. + */ + CUPTI_ACTIVITY_MEMORY_OPERATION_TYPE_INVALID = 0, + + /** + * Memory is allocated. + */ + CUPTI_ACTIVITY_MEMORY_OPERATION_TYPE_ALLOCATION = 1, + + /** + * Memory is released. + */ + CUPTI_ACTIVITY_MEMORY_OPERATION_TYPE_RELEASE = 2, + + CUPTI_ACTIVITY_MEMORY_OPERATION_TYPE_FORCE_INT = 0x7fffffff +} CUpti_ActivityMemoryOperationType; + +/** +* \brief Memory pool types. +* +* Describes the type of memory pool, to be used with CUpti_ActivityMemory3. +*/ + +typedef enum { + /** + * The operation is invalid. + */ + CUPTI_ACTIVITY_MEMORY_POOL_TYPE_INVALID = 0, + + /** + * Memory pool is local to the process. + */ + CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL = 1, + + /** + * Memory pool is imported by the process. + */ + CUPTI_ACTIVITY_MEMORY_POOL_TYPE_IMPORTED = 2, + + CUPTI_ACTIVITY_MEMORY_POOL_TYPE_FORCE_INT = 0x7fffffff +} CUpti_ActivityMemoryPoolType; + +/** +* \brief Memory pool operation types. +* +* Describes the type of memory pool operation, to be used with CUpti_ActivityMemoryPool2. +*/ + +typedef enum { + /** + * The operation is invalid. + */ + CUPTI_ACTIVITY_MEMORY_POOL_OPERATION_TYPE_INVALID = 0, + + /** + * Memory pool is created. + */ + CUPTI_ACTIVITY_MEMORY_POOL_OPERATION_TYPE_CREATED = 1, + + /** + * Memory pool is destroyed. + */ + CUPTI_ACTIVITY_MEMORY_POOL_OPERATION_TYPE_DESTROYED = 2, + + /** + * Memory pool is trimmed. + */ + CUPTI_ACTIVITY_MEMORY_POOL_OPERATION_TYPE_TRIMMED = 3, + + CUPTI_ACTIVITY_MEMORY_POOL_OPERATION_TYPE_FORCE_INT = 0x7fffffff +} CUpti_ActivityMemoryPoolOperationType; + +typedef enum { + CUPTI_CHANNEL_TYPE_INVALID = 0, + + CUPTI_CHANNEL_TYPE_COMPUTE = 1, + + CUPTI_CHANNEL_TYPE_ASYNC_MEMCPY = 2 +} CUpti_ChannelType; + +/** + * The source-locator ID that indicates an unknown source + * location. There is not an actual CUpti_ActivitySourceLocator object + * corresponding to this value. + */ +#define CUPTI_SOURCE_LOCATOR_ID_UNKNOWN 0 + +/** + * An invalid function index ID. + */ +#define CUPTI_FUNCTION_INDEX_ID_INVALID 0 + +/** + * An invalid/unknown correlation ID. A correlation ID of this value + * indicates that there is no correlation for the activity record. + */ +#define CUPTI_CORRELATION_ID_UNKNOWN 0 + +/** + * An invalid/unknown grid ID. + */ +#define CUPTI_GRID_ID_UNKNOWN 0LL + +/** + * An invalid/unknown timestamp for a start, end, queued, submitted, + * or completed time. + */ +#define CUPTI_TIMESTAMP_UNKNOWN 0LL + +/** + * An invalid/unknown value. + */ +#define CUPTI_SYNCHRONIZATION_INVALID_VALUE -1 + +/** + * An invalid/unknown process id. + */ +#define CUPTI_AUTO_BOOST_INVALID_CLIENT_PID 0 + +/** + * Invalid/unknown NVLink port number. +*/ +#define CUPTI_NVLINK_INVALID_PORT -1 + +/** + * Maximum NVLink port numbers. +*/ +#define CUPTI_MAX_NVLINK_PORTS 32 + +START_PACKED_ALIGNMENT +/** + * \brief Unified Memory counters configuration structure + * + * This structure controls the enable/disable of the various + * Unified Memory counters consisting of scope, kind and other parameters. + * See function \ref cuptiActivityConfigureUnifiedMemoryCounter + */ +typedef struct PACKED_ALIGNMENT { + /** + * Unified Memory counter Counter scope. (deprecated in CUDA 7.0) + */ + CUpti_ActivityUnifiedMemoryCounterScope scope; + + /** + * Unified Memory counter Counter kind + */ + CUpti_ActivityUnifiedMemoryCounterKind kind; + + /** + * Device id of the target device. This is relevant only + * for single device scopes. (deprecated in CUDA 7.0) + */ + uint32_t deviceId; + + /** + * Control to enable/disable the counter. To enable the counter + * set it to non-zero value while disable is indicated by zero. + */ + uint32_t enable; +} CUpti_ActivityUnifiedMemoryCounterConfig; + +/** + * \brief Device auto boost state structure + * + * This structure defines auto boost state for a device. + * See function \ref cuptiGetAutoBoostState + */ +typedef struct PACKED_ALIGNMENT { + /** + * Returned auto boost state. 1 is returned in case auto boost is enabled, 0 + * otherwise + */ + uint32_t enabled; + + /** + * Id of process that has set the current boost state. The value will be + * CUPTI_AUTO_BOOST_INVALID_CLIENT_PID if the user does not have the + * permission to query process ids or there is an error in querying the + * process id. + */ + uint32_t pid; + +} CUpti_ActivityAutoBoostState; + +/** + * \brief PC sampling configuration structure + * + * This structure defines the pc sampling configuration. + * + * See function \ref cuptiActivityConfigurePCSampling + */ +typedef struct PACKED_ALIGNMENT { + /** + * Size of configuration structure. + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + uint32_t size; + + /** + * There are 5 level provided for sampling period. The level + * internally maps to a period in terms of cycles. Same level can + * map to different number of cycles on different gpus. No of + * cycles will be chosen to minimize information loss. The period + * chosen will be given by samplingPeriodInCycles in + * \ref CUpti_ActivityPCSamplingRecordInfo for each kernel instance. + */ + CUpti_ActivityPCSamplingPeriod samplingPeriod; + + /** + * This will override the period set by samplingPeriod. Value 0 in samplingPeriod2 will be + * considered as samplingPeriod2 should not be used and samplingPeriod should be used. + * Valid values for samplingPeriod2 are between 5 to 31 both inclusive. + * This will set the sampling period to (2^samplingPeriod2) cycles. + */ + uint32_t samplingPeriod2; +} CUpti_ActivityPCSamplingConfig; + +/** + * \brief The base activity record. + * + * The activity API uses a CUpti_Activity as a generic representation + * for any activity. The 'kind' field is used to determine the + * specific activity kind, and from that the CUpti_Activity object can + * be cast to the specific activity record type appropriate for that kind. + * + * Note that all activity record types are padded and aligned to + * ensure that each member of the record is naturally aligned. + * + * \see CUpti_ActivityKind + */ +typedef struct PACKED_ALIGNMENT { + /** + * The kind of this activity. + */ + CUpti_ActivityKind kind; +} CUpti_Activity; + +/** + * \brief The activity record for memory copies. + * + * This activity record represents a memory copy + * (CUPTI_ACTIVITY_KIND_MEMCPY). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMCPY. + */ + CUpti_ActivityKind kind; + + /** + * The kind of the memory copy, stored as a byte to reduce record + * size. \see CUpti_ActivityMemcpyKind + */ + uint8_t copyKind; + + /** + * The source memory kind read by the memory copy, stored as a byte + * to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t srcKind; + + /** + * The destination memory kind read by the memory copy, stored as a + * byte to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t dstKind; + + /** + * The flags associated with the memory copy. \see CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * The number of bytes transferred by the memory copy. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t start; + + /** + * The end timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t end; + + /** + * The ID of the device where the memory copy is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory copy is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory copy is occurring. + */ + uint32_t streamId; + + /** + * The correlation ID of the memory copy. Each memory copy is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver API activity record that launched + * the memory copy. + */ + uint32_t correlationId; + + /** + * The runtime correlation ID of the memory copy. Each memory copy + * is assigned a unique runtime correlation ID that is identical to + * the correlation ID in the runtime API activity record that + * launched the memory copy. + */ + uint32_t runtimeCorrelationId; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The unique ID of the graph node that executed this memcpy through graph launch. + * This field will be 0 if the memcpy is not done through graph launch. + */ + uint64_t graphNodeId; + + /** + * The unique ID of the graph that executed this memcpy through graph launch. + * This field will be 0 if the memcpy is not done through graph launch. + */ + uint32_t graphId; + + /** + * The ID of the HW channel on which the memory copy is occurring. + */ + uint32_t channelID; + + /** + * The type of the channel + */ + CUpti_ChannelType channelType; + + /** + * Reserved for internal use. + */ + uint32_t pad2; +} CUpti_ActivityMemcpy5; + +/** + * \brief The activity record for peer-to-peer memory copies. + * + * This activity record represents a peer-to-peer memory copy + * (CUPTI_ACTIVITY_KIND_MEMCPY2). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMCPY2. + */ + CUpti_ActivityKind kind; + + /** + * The kind of the memory copy, stored as a byte to reduce record + * size. \see CUpti_ActivityMemcpyKind + */ + uint8_t copyKind; + + /** + * The source memory kind read by the memory copy, stored as a byte + * to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t srcKind; + + /** + * The destination memory kind read by the memory copy, stored as a + * byte to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t dstKind; + + /** + * The flags associated with the memory copy. \see + * CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * The number of bytes transferred by the memory copy. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t start; + + /** + * The end timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t end; + + /** + * The ID of the device where the memory copy is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory copy is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory copy is occurring. + */ + uint32_t streamId; + + /** + * The ID of the device where memory is being copied from. + */ + uint32_t srcDeviceId; + + /** + * The ID of the context owning the memory being copied from. + */ + uint32_t srcContextId; + + /** + * The ID of the device where memory is being copied to. + */ + uint32_t dstDeviceId; + + /** + * The ID of the context owning the memory being copied to. + */ + uint32_t dstContextId; + + /** + * The correlation ID of the memory copy. Each memory copy is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver and runtime API activity record that + * launched the memory copy. + */ + uint32_t correlationId; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The unique ID of the graph node that executed the memcpy through graph launch. + * This field will be 0 if memcpy is not done using graph launch. + */ + uint64_t graphNodeId; + + /** + * The unique ID of the graph that executed this memcpy through graph launch. + * This field will be 0 if the memcpy is not done through graph launch. + */ + uint32_t graphId; + + /** + * The ID of the HW channel on which the memory copy is occurring. + */ + uint32_t channelID; + + /** + * The type of the channel + */ + CUpti_ChannelType channelType; +} CUpti_ActivityMemcpyPtoP4; + +/** + * \brief The activity record for memset. + * + * This activity record represents a memory set operation + * (CUPTI_ACTIVITY_KIND_MEMSET). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMSET. + */ + CUpti_ActivityKind kind; + + /** + * The value being assigned to memory by the memory set. + */ + uint32_t value; + + /** + * The number of bytes being set by the memory set. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory set, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory set. + */ + uint64_t start; + + /** + * The end timestamp for the memory set, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory set. + */ + uint64_t end; + + /** + * The ID of the device where the memory set is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory set is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory set is occurring. + */ + uint32_t streamId; + + /** + * The correlation ID of the memory set. Each memory set is assigned + * a unique correlation ID that is identical to the correlation ID + * in the driver API activity record that launched the memory set. + */ + uint32_t correlationId; + + /** + * The flags associated with the memset. \see CUpti_ActivityFlag + */ + uint16_t flags; + + /** + * The memory kind of the memory set \see CUpti_ActivityMemoryKind + */ + uint16_t memoryKind; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The unique ID of the graph node that executed this memset through graph launch. + * This field will be 0 if the memset is not executed through graph launch. + */ + uint64_t graphNodeId; + + /** + * The unique ID of the graph that executed this memset through graph launch. + * This field will be 0 if the memset is not executed through graph launch. + */ + uint32_t graphId; + + /** + * The ID of the HW channel on which the memory set is occurring. + */ + uint32_t channelID; + + /** + * The type of the channel + */ + CUpti_ChannelType channelType; + + /** + * Undefined. Reserved for internal use + */ + uint32_t pad2; +} CUpti_ActivityMemset4; + +/** + * \brief The activity record for memory. + * + * This activity record represents a memory allocation and free operation + * (CUPTI_ACTIVITY_KIND_MEMORY). + * This activity record provides a single record for the memory + * allocation and memory release operations. + * + * Note: It is recommended to move to the new activity record \ref CUpti_ActivityMemory3 + * enabled using the kind \ref CUPTI_ACTIVITY_KIND_MEMORY2. + * \ref CUpti_ActivityMemory3 provides separate records for memory + * allocation and memory release operations. This allows to correlate the + * corresponding driver and runtime API activity record with the memory operation. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMORY + */ + CUpti_ActivityKind kind; + + /** + * The memory kind requested by the user + */ + CUpti_ActivityMemoryKind memoryKind; + + /** + * The virtual address of the allocation + */ + uint64_t address; + + /** + * The number of bytes of memory allocated. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory operation, i.e. + * the time when memory was allocated, in ns. + */ + uint64_t start; + + /** + * The end timestamp for the memory operation, i.e. + * the time when memory was freed, in ns. + * This will be 0 if memory is not freed in the application + */ + uint64_t end; + + /** + * The program counter of the allocation of memory + */ + uint64_t allocPC; + + /** + * The program counter of the freeing of memory. This will + * be 0 if memory is not freed in the application + */ + uint64_t freePC; + + /** + * The ID of the process to which this record belongs to. + */ + uint32_t processId; + + /** + * The ID of the device where the memory allocation is taking place. + */ + uint32_t deviceId; + + /** + * The ID of the context. If context is NULL, \p contextId is set to CUPTI_INVALID_CONTEXT_ID. + */ + uint32_t contextId; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Variable name. This name is shared across all activity + * records representing the same symbol, and so should not be + * modified. + */ + const char* name; +} CUpti_ActivityMemory; + +/** + * \brief The activity record for memory. + * + * This activity record represents a memory allocation and free operation + * (CUPTI_ACTIVITY_KIND_MEMORY2). + * This activity record provides separate records for memory allocation and + * memory release operations. + * This allows to correlate the corresponding driver and runtime API + * activity record with the memory operation. + * + * Note: This activity record is an upgrade over \ref CUpti_ActivityMemory + * enabled using the kind \ref CUPTI_ACTIVITY_KIND_MEMORY. + * \ref CUpti_ActivityMemory provides a single record for the memory + * allocation and memory release operations. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMORY2 + */ + CUpti_ActivityKind kind; + + /** + * The memory operation requested by the user, \ref CUpti_ActivityMemoryOperationType. + */ + CUpti_ActivityMemoryOperationType memoryOperationType; + + /** + * The memory kind requested by the user, \ref CUpti_ActivityMemoryKind. + */ + CUpti_ActivityMemoryKind memoryKind; + + /** + * The correlation ID of the memory operation. Each memory operation is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver and runtime API activity record that + * launched the memory operation. + */ + uint32_t correlationId; + + /** + * The virtual address of the allocation. + */ + uint64_t address; + + /** + * The number of bytes of memory allocated. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory operation, in ns. + */ + uint64_t timestamp; + + /** + * The program counter of the memory operation. + */ + uint64_t PC; + + /** + * The ID of the process to which this record belongs to. + */ + uint32_t processId; + + /** + * The ID of the device where the memory operation is taking place. + */ + uint32_t deviceId; + + /** + * The ID of the context. If context is NULL, \p contextId is set to CUPTI_INVALID_CONTEXT_ID. + */ + uint32_t contextId; + + /** + * The ID of the stream. If memory operation is not async, \p streamId is set to CUPTI_INVALID_STREAM_ID. + */ + uint32_t streamId; + + /** + * Variable name. This name is shared across all activity + * records representing the same symbol, and so should not be + * modified. + */ + const char* name; + + /** + * \p isAsync is set if memory operation happens through async memory APIs. + */ + uint32_t isAsync; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad1; +#endif + + /** + * The memory pool configuration used for the memory operations. + */ + struct PACKED_ALIGNMENT { + /** + * The type of the memory pool, \ref CUpti_ActivityMemoryPoolType + */ + CUpti_ActivityMemoryPoolType memoryPoolType; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad2; +#endif + + /** + * The base address of the memory pool. + */ + uint64_t address; + + /** + * The release threshold of the memory pool in bytes. \p releaseThreshold is + * valid for CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL, \ref CUpti_ActivityMemoryPoolType. + */ + uint64_t releaseThreshold; + + /** + * The size of memory pool in bytes and the processId of the memory pools + * \p size is valid if \p memoryPoolType is + * CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL, \ref CUpti_ActivityMemoryPoolType. + * \p processId is valid if \p memoryPoolType is + * CUPTI_ACTIVITY_MEMORY_POOL_TYPE_IMPORTED, \ref CUpti_ActivityMemoryPoolType + */ + union { + uint64_t size; + uint64_t processId; + } pool; + + /** + * The utilized size of the memory pool. \p utilizedSize is + * valid for CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL, \ref CUpti_ActivityMemoryPoolType. + */ + uint64_t utilizedSize; + } memoryPoolConfig; + +} CUpti_ActivityMemory3; + +/** + * \brief The activity record for memory pool. + * + * This activity record represents a memory pool creation, destruction and + * trimming (CUPTI_ACTIVITY_KIND_MEMORY_POOL). + * This activity record provides separate records for memory pool creation, + * destruction and trimming operations. + * This allows to correlate the corresponding driver and runtime API + * activity record with the memory pool operation. + * + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMORY_POOL + */ + CUpti_ActivityKind kind; + + /** + * The memory operation requested by the user, \ref CUpti_ActivityMemoryPoolOperationType. + */ + CUpti_ActivityMemoryPoolOperationType memoryPoolOperationType; + + /** + * The type of the memory pool, \ref CUpti_ActivityMemoryPoolType + */ + CUpti_ActivityMemoryPoolType memoryPoolType; + + /** + * The correlation ID of the memory pool operation. Each memory pool + * operation is assigned a unique correlation ID that is identical to the + * correlation ID in the driver and runtime API activity record that + * launched the memory operation. + */ + uint32_t correlationId; + + /** + * The ID of the process to which this record belongs to. + */ + uint32_t processId; + + /** + * The ID of the device where the memory pool is created. + */ + uint32_t deviceId; + + /** + * The minimum bytes to keep of the memory pool. \p minBytesToKeep is + * valid for CUPTI_ACTIVITY_MEMORY_POOL_OPERATION_TYPE_TRIMMED, + * \ref CUpti_ActivityMemoryPoolOperationType + */ + size_t minBytesToKeep; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The virtual address of the allocation. + */ + uint64_t address; + + /** + * The size of the memory pool operation in bytes. \p size is + * valid for CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL, \ref CUpti_ActivityMemoryPoolType. + */ + uint64_t size; + + /** + * The release threshold of the memory pool. \p releaseThreshold is + * valid for CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL, \ref CUpti_ActivityMemoryPoolType. + */ + uint64_t releaseThreshold; + + /** + * The start timestamp for the memory operation, in ns. + */ + uint64_t timestamp; + + /** + * The utilized size of the memory pool. \p utilizedSize is + * valid for CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL, \ref CUpti_ActivityMemoryPoolType. + */ + uint64_t utilizedSize; +} CUpti_ActivityMemoryPool2; + +/** + * \brief The type of the CUDA kernel launch. + */ +typedef enum { + /** + * The kernel was launched via a regular kernel call + */ + CUPTI_ACTIVITY_LAUNCH_TYPE_REGULAR = 0, + + /** + * The kernel was launched via API \ref cudaLaunchCooperativeKernel() or + * \ref cuLaunchCooperativeKernel() + */ + CUPTI_ACTIVITY_LAUNCH_TYPE_COOPERATIVE_SINGLE_DEVICE = 1, + + /** + * The kernel was launched via API \ref cudaLaunchCooperativeKernelMultiDevice() or + * \ref cuLaunchCooperativeKernelMultiDevice() + */ + CUPTI_ACTIVITY_LAUNCH_TYPE_COOPERATIVE_MULTI_DEVICE = 2, + + /** + * The kernel was launched as a CBL commandlist + */ + CUPTI_ACTIVITY_LAUNCH_TYPE_CBL_COMMANDLIST = 3, +} CUpti_ActivityLaunchType; + +/** + * \brief The shared memory limit per block config for a kernel + * This should be used to set 'cudaOccFuncShmemConfig' field in occupancy calculator API + */ +typedef enum { + /** The shared memory limit config is default + */ + CUPTI_FUNC_SHMEM_LIMIT_DEFAULT = 0x00, + + /** User has opted for a higher dynamic shared memory limit using function attribute + * 'cudaFuncAttributeMaxDynamicSharedMemorySize' for runtime API or + * CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES for driver API + */ + CUPTI_FUNC_SHMEM_LIMIT_OPTIN = 0x01, + + CUPTI_FUNC_SHMEM_LIMIT_FORCE_INT = 0x7fffffff +} CUpti_FuncShmemLimitConfig; + +/** + * \brief The activity record for kernel. + * + * This activity record represents a kernel execution + * (CUPTI_ACTIVITY_KIND_KERNEL and + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL) + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_KERNEL or + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL. + */ + CUpti_ActivityKind kind; + + /** + * For devices with compute capability 7.0+ cacheConfig values are not updated + * in case field isSharedMemoryCarveoutRequested is set + */ + union { + uint8_t both; + struct { + /** + * The cache configuration requested by the kernel. The value is one + * of the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t requested:4; + + /** + * The cache configuration used for the kernel. The value is one of + * the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t executed:4; + } config; + } cacheConfig; + + /** + * The shared memory configuration used for the kernel. The value is one of + * the CUsharedconfig enumeration values from cuda.h. + */ + uint8_t sharedMemoryConfig; + + /** + * The number of registers required for each thread executing the + * kernel. + */ + uint16_t registersPerThread; + + /** + * The partitioned global caching requested for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheRequested; + + /** + * The partitioned global caching executed for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. Partitioned global caching can be + * automatically disabled if the occupancy requirement of the launch cannot + * support caching. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheExecuted; + + /** + * The start timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t start; + + /** + * The end timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t end; + + /** + * The completed timestamp for the kernel execution, in ns. It + * represents the completion of all it's child kernels and the + * kernel itself. A value of CUPTI_TIMESTAMP_UNKNOWN indicates that + * the completion time is unknown. + */ + uint64_t completed; + + /** + * The ID of the device where the kernel is executing. + */ + uint32_t deviceId; + + /** + * The ID of the context where the kernel is executing. + */ + uint32_t contextId; + + /** + * The ID of the stream where the kernel is executing. + */ + uint32_t streamId; + + /** + * The X-dimension grid size for the kernel. + */ + int32_t gridX; + + /** + * The Y-dimension grid size for the kernel. + */ + int32_t gridY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t gridZ; + + /** + * The X-dimension block size for the kernel. + */ + int32_t blockX; + + /** + * The Y-dimension block size for the kernel. + */ + int32_t blockY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t blockZ; + + /** + * The static shared memory allocated for the kernel, in bytes. + */ + int32_t staticSharedMemory; + + /** + * The dynamic shared memory reserved for the kernel, in bytes. + */ + int32_t dynamicSharedMemory; + + /** + * The amount of local memory reserved for each thread, in bytes. + */ + uint32_t localMemoryPerThread; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes (deprecated in CUDA 11.8). + * Refer field localMemoryTotal_v2 + */ + uint32_t localMemoryTotal; + + /** + * The correlation ID of the kernel. Each kernel execution is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the kernel. + */ + uint32_t correlationId; + + /** + * The grid ID of the kernel. Each kernel is assigned a unique + * grid ID at runtime. + */ + int64_t gridId; + + /** + * The name of the kernel. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The timestamp when the kernel is queued up in the command buffer, in ns. + * A value of CUPTI_TIMESTAMP_UNKNOWN indicates that the queued time + * could not be collected for the kernel. This timestamp is not collected + * by default. Use API \ref cuptiActivityEnableLatencyTimestamps() to + * enable collection. + * + * Command buffer is a buffer written by CUDA driver to send commands + * like kernel launch, memory copy etc to the GPU. All launches of CUDA + * kernels are asynchronous with respect to the host, the host requests + * the launch by writing commands into the command buffer, then returns + * without checking the GPU's progress. + */ + uint64_t queued; + + /** + * The timestamp when the command buffer containing the kernel launch + * is submitted to the GPU, in ns. A value of CUPTI_TIMESTAMP_UNKNOWN + * indicates that the submitted time could not be collected for the kernel. + * This timestamp is not collected by default. Use API \ref + * cuptiActivityEnableLatencyTimestamps() to enable collection. + */ + uint64_t submitted; + + /** + * The indicates if the kernel was executed via a regular launch or via a + * single/multi device cooperative launch. \see CUpti_ActivityLaunchType + */ + uint8_t launchType; + + /** + * This indicates if CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT was + * updated for the kernel launch + */ + uint8_t isSharedMemoryCarveoutRequested; + + /** + * Shared memory carveout value requested for the function in percentage of + * the total resource. The value will be updated only if field + * isSharedMemoryCarveoutRequested is set. + */ + uint8_t sharedMemoryCarveoutRequested; + + /** + * Undefined. Reserved for internal use. + */ + uint8_t padding; + + /** + * Shared memory size set by the driver. + */ + uint32_t sharedMemoryExecuted; + + /** + * The unique ID of the graph node that launched this kernel through graph launch APIs. + * This field will be 0 if the kernel is not launched through graph launch APIs. + */ + uint64_t graphNodeId; + + /** + * The shared memory limit config for the kernel. This field shows whether user has opted for a + * higher per block limit of dynamic shared memory. + */ + CUpti_FuncShmemLimitConfig shmemLimitConfig; + + /** + * The unique ID of the graph that launched this kernel through graph launch APIs. + * This field will be 0 if the kernel is not launched through graph launch APIs. + */ + uint32_t graphId; + + /** + * The pointer to the access policy window. The structure CUaccessPolicyWindow is + * defined in cuda.h. + */ + CUaccessPolicyWindow *pAccessPolicyWindow; + + /** + * The ID of the HW channel on which the kernel is launched. + */ + uint32_t channelID; + + /** + * The type of the channel + */ + CUpti_ChannelType channelType; + + /** + * The X-dimension cluster size for the kernel. + * Field is valid for devices with compute capability 9.0 and higher + */ + uint32_t clusterX; + + /** + * The Y-dimension cluster size for the kernel. + * Field is valid for devices with compute capability 9.0 and higher + */ + uint32_t clusterY; + + /** + * The Z-dimension cluster size for the kernel. + * Field is valid for devices with compute capability 9.0 and higher + */ + uint32_t clusterZ; + + /** + * The cluster scheduling policy for the kernel. Refer CUclusterSchedulingPolicy + * Field is valid for devices with compute capability 9.0 and higher + */ + uint32_t clusterSchedulingPolicy; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes. + */ + uint64_t localMemoryTotal_v2; + + /** + * The maximum cluster size for the kernel + */ + uint32_t maxPotentialClusterSize; + + /** + * The maximum clusters that could co-exist on the target device for the kernel + */ + uint32_t maxActiveClusters; +} CUpti_ActivityKernel9; + +/** + * \brief The activity record for CDP (CUDA Dynamic Parallelism) + * kernel. + * + * This activity record represents a CDP kernel execution. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_CDP_KERNEL + */ + CUpti_ActivityKind kind; + + union { + uint8_t both; + struct { + /** + * The cache configuration requested by the kernel. The value is one + * of the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t requested:4; + + /** + * The cache configuration used for the kernel. The value is one of + * the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t executed:4; + } config; + } cacheConfig; + + /** + * The shared memory configuration used for the kernel. The value is one of + * the CUsharedconfig enumeration values from cuda.h. + */ + uint8_t sharedMemoryConfig; + + /** + * The number of registers required for each thread executing the + * kernel. + */ + uint16_t registersPerThread; + + /** + * The start timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t start; + + /** + * The end timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t end; + + /** + * The ID of the device where the kernel is executing. + */ + uint32_t deviceId; + + /** + * The ID of the context where the kernel is executing. + */ + uint32_t contextId; + + /** + * The ID of the stream where the kernel is executing. + */ + uint32_t streamId; + + /** + * The X-dimension grid size for the kernel. + */ + int32_t gridX; + + /** + * The Y-dimension grid size for the kernel. + */ + int32_t gridY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t gridZ; + + /** + * The X-dimension block size for the kernel. + */ + int32_t blockX; + + /** + * The Y-dimension block size for the kernel. + */ + int32_t blockY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t blockZ; + + /** + * The static shared memory allocated for the kernel, in bytes. + */ + int32_t staticSharedMemory; + + /** + * The dynamic shared memory reserved for the kernel, in bytes. + */ + int32_t dynamicSharedMemory; + + /** + * The amount of local memory reserved for each thread, in bytes. + */ + uint32_t localMemoryPerThread; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes. + */ + uint32_t localMemoryTotal; + + /** + * The correlation ID of the kernel. Each kernel execution is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver API activity record that launched + * the kernel. + */ + uint32_t correlationId; + + /** + * The grid ID of the kernel. Each kernel execution + * is assigned a unique grid ID. + */ + int64_t gridId; + + /** + * The grid ID of the parent kernel. + */ + int64_t parentGridId; + + /** + * The timestamp when kernel is queued up, in ns. A value of + * CUPTI_TIMESTAMP_UNKNOWN indicates that the queued time is + * unknown. + */ + uint64_t queued; + + /** + * The timestamp when kernel is submitted to the gpu, in ns. A value + * of CUPTI_TIMESTAMP_UNKNOWN indicates that the submission time is + * unknown. + */ + uint64_t submitted; + + /** + * The timestamp when kernel is marked as completed, in ns. A value + * of CUPTI_TIMESTAMP_UNKNOWN indicates that the completion time is + * unknown. + */ + uint64_t completed; + + /** + * The X-dimension of the parent block. + */ + uint32_t parentBlockX; + + /** + * The Y-dimension of the parent block. + */ + uint32_t parentBlockY; + + /** + * The Z-dimension of the parent block. + */ + uint32_t parentBlockZ; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The name of the kernel. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; +} CUpti_ActivityCdpKernel; + +/** + * \brief The activity record for a preemption of a CDP kernel. + * + * This activity record represents a preemption of a CDP kernel. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_PREEMPTION + */ + CUpti_ActivityKind kind; + + /** + * kind of the preemption + */ + CUpti_ActivityPreemptionKind preemptionKind; + + /** + * The timestamp of the preemption, in ns. A value of 0 indicates + * that timestamp information could not be collected for the + * preemption. + */ + uint64_t timestamp; + + /** + * The grid-id of the block that is preempted + */ + int64_t gridId; + + /** + * The X-dimension of the block that is preempted + */ + uint32_t blockX; + + /** + * The Y-dimension of the block that is preempted + */ + uint32_t blockY; + + /** + * The Z-dimension of the block that is preempted + */ + uint32_t blockZ; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +} CUpti_ActivityPreemption; + +/** + * \brief The activity record for a driver or runtime API invocation. + * + * This activity record represents an invocation of a driver or + * runtime API (CUPTI_ACTIVITY_KIND_DRIVER and + * CUPTI_ACTIVITY_KIND_RUNTIME). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_DRIVER, + * CUPTI_ACTIVITY_KIND_RUNTIME, or CUPTI_ACTIVITY_KIND_INTERNAL_LAUNCH_API. + */ + CUpti_ActivityKind kind; + + /** + * The ID of the driver or runtime function. + */ + CUpti_CallbackId cbid; + + /** + * The start timestamp for the function, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the function. + */ + uint64_t start; + + /** + * The end timestamp for the function, in ns. A value of 0 for both + * the start and end timestamps indicates that timestamp information + * could not be collected for the function. + */ + uint64_t end; + + /** + * The ID of the process where the driver or runtime CUDA function + * is executing. + */ + uint32_t processId; + + /** + * The ID of the thread where the driver or runtime CUDA function is + * executing. + */ + uint32_t threadId; + + /** + * The correlation ID of the driver or runtime CUDA function. Each + * function invocation is assigned a unique correlation ID that is + * identical to the correlation ID in the memcpy, memset, or kernel + * activity record that is associated with this function. + */ + uint32_t correlationId; + + /** + * The return value for the function. For a CUDA driver function + * with will be a CUresult value, and for a CUDA runtime function + * this will be a cudaError_t value. + */ + uint32_t returnValue; +} CUpti_ActivityAPI; + +/** + * \brief The activity record for a CUPTI event. + * + * This activity record represents a CUPTI event value + * (CUPTI_ACTIVITY_KIND_EVENT). This activity record kind is not + * produced by the activity API but is included for completeness and + * ease-of-use. Profile frameworks built on top of CUPTI that collect + * event data may choose to use this type to store the collected event + * data. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_EVENT. + */ + CUpti_ActivityKind kind; + + /** + * The event ID. + */ + CUpti_EventID id; + + /** + * The event value. + */ + uint64_t value; + + /** + * The event domain ID. + */ + CUpti_EventDomainID domain; + + /** + * The correlation ID of the event. Use of this ID is user-defined, + * but typically this ID value will equal the correlation ID of the + * kernel for which the event was gathered. + */ + uint32_t correlationId; +} CUpti_ActivityEvent; + +/** + * \brief The activity record for a CUPTI event with instance + * information. + * + * This activity record represents the a CUPTI event value for a + * specific event domain instance + * (CUPTI_ACTIVITY_KIND_EVENT_INSTANCE). This activity record kind is + * not produced by the activity API but is included for completeness + * and ease-of-use. Profile frameworks built on top of CUPTI that + * collect event data may choose to use this type to store the + * collected event data. This activity record should be used when + * event domain instance information needs to be associated with the + * event. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be + * CUPTI_ACTIVITY_KIND_EVENT_INSTANCE. + */ + CUpti_ActivityKind kind; + + /** + * The event ID. + */ + CUpti_EventID id; + + /** + * The event domain ID. + */ + CUpti_EventDomainID domain; + + /** + * The event domain instance. + */ + uint32_t instance; + + /** + * The event value. + */ + uint64_t value; + + /** + * The correlation ID of the event. Use of this ID is user-defined, + * but typically this ID value will equal the correlation ID of the + * kernel for which the event was gathered. + */ + uint32_t correlationId; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +} CUpti_ActivityEventInstance; + +/** + * \brief The activity record for a CUPTI metric. + * + * This activity record represents the collection of a CUPTI metric + * value (CUPTI_ACTIVITY_KIND_METRIC). This activity record kind is not + * produced by the activity API but is included for completeness and + * ease-of-use. Profile frameworks built on top of CUPTI that collect + * metric data may choose to use this type to store the collected metric + * data. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_METRIC. + */ + CUpti_ActivityKind kind; + + /** + * The metric ID. + */ + CUpti_MetricID id; + + /** + * The metric value. + */ + CUpti_MetricValue value; + + /** + * The correlation ID of the metric. Use of this ID is user-defined, + * but typically this ID value will equal the correlation ID of the + * kernel for which the metric was gathered. + */ + uint32_t correlationId; + + /** + * The properties of this metric. \see CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * Undefined. Reserved for internal use. + */ + uint8_t pad[3]; +} CUpti_ActivityMetric; + +/** + * \brief The activity record for a CUPTI metric with instance + * information. + * + * This activity record represents a CUPTI metric value + * for a specific metric domain instance + * (CUPTI_ACTIVITY_KIND_METRIC_INSTANCE). This activity record kind + * is not produced by the activity API but is included for + * completeness and ease-of-use. Profile frameworks built on top of + * CUPTI that collect metric data may choose to use this type to store + * the collected metric data. This activity record should be used when + * metric domain instance information needs to be associated with the + * metric. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be + * CUPTI_ACTIVITY_KIND_METRIC_INSTANCE. + */ + CUpti_ActivityKind kind; + + /** + * The metric ID. + */ + CUpti_MetricID id; + + /** + * The metric value. + */ + CUpti_MetricValue value; + + /** + * The metric domain instance. + */ + uint32_t instance; + + /** + * The correlation ID of the metric. Use of this ID is user-defined, + * but typically this ID value will equal the correlation ID of the + * kernel for which the metric was gathered. + */ + uint32_t correlationId; + + /** + * The properties of this metric. \see CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * Undefined. Reserved for internal use. + */ + uint8_t pad[7]; +} CUpti_ActivityMetricInstance; + +/** + * \brief The activity record for source locator. + * + * This activity record represents a source locator + * (CUPTI_ACTIVITY_KIND_SOURCE_LOCATOR). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_SOURCE_LOCATOR. + */ + CUpti_ActivityKind kind; + + /** + * The ID for the source path, will be used in all the source level + * results. + */ + uint32_t id; + + /** + * The line number in the source . + */ + uint32_t lineNumber; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The path for the file. + */ + const char *fileName; +} CUpti_ActivitySourceLocator; + +/** + * \brief The activity record for source-level global + * access. + * + * This activity records the locations of the global + * accesses in the source (CUPTI_ACTIVITY_KIND_GLOBAL_ACCESS). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_GLOBAL_ACCESS. + */ + CUpti_ActivityKind kind; + + /** + * The properties of this global access. + */ + CUpti_ActivityFlag flags; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * Correlation ID with global/device function name + */ + uint32_t functionId; + + /** + * The number of times this instruction was executed per warp. It will be incremented + * when at least one of thread among warp is active with predicate and condition code + * evaluating to true. + */ + uint32_t executed; + + /** + * The pc offset for the access. + */ + uint64_t pcOffset; + + /** + * This increments each time when this instruction is executed by number of + * threads that executed this instruction with predicate and condition code + * evaluating to true. + */ + uint64_t threadsExecuted; + + /** + * The total number of 32 bytes transactions to L2 cache generated by this + access + */ + uint64_t l2_transactions; + + /** + * The minimum number of L2 transactions possible based on the access pattern. + */ + uint64_t theoreticalL2Transactions; +} CUpti_ActivityGlobalAccess3; + +/** + * \brief The activity record for source level result + * branch. + * + * This activity record the locations of the branches in the + * source (CUPTI_ACTIVITY_KIND_BRANCH). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_BRANCH. + */ + CUpti_ActivityKind kind; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * Correlation ID with global/device function name + */ + uint32_t functionId; + + /** + * The pc offset for the branch. + */ + uint32_t pcOffset; + + /** + * Number of times this branch diverged + */ + uint32_t diverged; + + /** + * This increments each time when this instruction is executed by number + * of threads that executed this instruction + */ + uint64_t threadsExecuted; + + /** + * The number of times this instruction was executed per warp. It will be incremented + * regardless of predicate or condition code. + */ + uint32_t executed; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +} CUpti_ActivityBranch2; + +/** + * \brief The activity record for a device. (CUDA 11.6 onwards) + * + * This activity record represents information about a GPU device + * (CUPTI_ACTIVITY_KIND_DEVICE). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_DEVICE. + */ + CUpti_ActivityKind kind; + + /** + * The flags associated with the device. \see CUpti_ActivityFlag + */ + CUpti_ActivityFlag flags; + + /** + * The global memory bandwidth available on the device, in + * kBytes/sec. + */ + uint64_t globalMemoryBandwidth; + + /** + * The amount of global memory on the device, in bytes. + */ + uint64_t globalMemorySize; + + /** + * The amount of constant memory on the device, in bytes. + */ + uint32_t constantMemorySize; + + /** + * The size of the L2 cache on the device, in bytes. + */ + uint32_t l2CacheSize; + + /** + * The number of threads per warp on the device. + */ + uint32_t numThreadsPerWarp; + + /** + * The core clock rate of the device, in kHz. + */ + uint32_t coreClockRate; + + /** + * Number of memory copy engines on the device. + */ + uint32_t numMemcpyEngines; + + /** + * Number of multiprocessors on the device. + */ + uint32_t numMultiprocessors; + + /** + * The maximum "instructions per cycle" possible on each device + * multiprocessor. + */ + uint32_t maxIPC; + + /** + * Maximum number of warps that can be present on a multiprocessor + * at any given time. + */ + uint32_t maxWarpsPerMultiprocessor; + + /** + * Maximum number of blocks that can be present on a multiprocessor + * at any given time. + */ + uint32_t maxBlocksPerMultiprocessor; + + /** + * Maximum amount of shared memory available per multiprocessor, in bytes. + */ + uint32_t maxSharedMemoryPerMultiprocessor; + + /** + * Maximum number of 32-bit registers available per multiprocessor. + */ + uint32_t maxRegistersPerMultiprocessor; + + /** + * Maximum number of registers that can be allocated to a block. + */ + uint32_t maxRegistersPerBlock; + + /** + * Maximum amount of shared memory that can be assigned to a block, + * in bytes. + */ + uint32_t maxSharedMemoryPerBlock; + + /** + * Maximum number of threads allowed in a block. + */ + uint32_t maxThreadsPerBlock; + + /** + * Maximum allowed X dimension for a block. + */ + uint32_t maxBlockDimX; + + /** + * Maximum allowed Y dimension for a block. + */ + uint32_t maxBlockDimY; + + /** + * Maximum allowed Z dimension for a block. + */ + uint32_t maxBlockDimZ; + + /** + * Maximum allowed X dimension for a grid. + */ + uint32_t maxGridDimX; + + /** + * Maximum allowed Y dimension for a grid. + */ + uint32_t maxGridDimY; + + /** + * Maximum allowed Z dimension for a grid. + */ + uint32_t maxGridDimZ; + + /** + * Compute capability for the device, major number. + */ + uint32_t computeCapabilityMajor; + + /** + * Compute capability for the device, minor number. + */ + uint32_t computeCapabilityMinor; + + /** + * The device ID. + */ + uint32_t id; + + /** + * ECC enabled flag for device + */ + uint32_t eccEnabled; + + /** + * The device UUID. This value is the globally unique immutable + * alphanumeric identifier of the device. + */ + CUuuid uuid; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The device name. This name is shared across all activity records + * representing instances of the device, and so should not be + * modified. + */ + const char *name; + + /** + * Flag to indicate whether the device is visible to CUDA. Users can + * set the device visibility using CUDA_VISIBLE_DEVICES environment + */ + uint8_t isCudaVisible; + + /** + * MIG enabled flag for device + */ + uint8_t isMigEnabled; + + uint8_t reserved[6]; + + /** + * GPU Instance id for MIG enabled devices. + * If mig mode is disabled value is set to UINT32_MAX + */ + uint32_t gpuInstanceId; + + /** + * Compute Instance id for MIG enabled devices. + * If mig mode is disabled value is set to UINT32_MAX + */ + uint32_t computeInstanceId; + + /** + * The MIG UUID. This value is the globally unique immutable + * alphanumeric identifier of the device. + */ + CUuuid migUuid; + + /** + * Numa (Non-uniform memory access) information for device + * GPU is a NUMA node or not + */ + uint32_t isNumaNode; + + /** + * Numa (Non-uniform memory access) information for device + * NUMA node ID of the GPU memory + * if GPU is not a NUMA node, it returns invalidNumaId + */ + uint32_t numaId; +} CUpti_ActivityDevice5; + +/** + * \brief The activity record for a device attribute. + * + * This activity record represents information about a GPU device: + * either a CUpti_DeviceAttribute or CUdevice_attribute value + * (CUPTI_ACTIVITY_KIND_DEVICE_ATTRIBUTE). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be + * CUPTI_ACTIVITY_KIND_DEVICE_ATTRIBUTE. + */ + CUpti_ActivityKind kind; + + /** + * The flags associated with the device. \see CUpti_ActivityFlag + */ + CUpti_ActivityFlag flags; + + /** + * The ID of the device that this attribute applies to. + */ + uint32_t deviceId; + + /** + * The attribute, either a CUpti_DeviceAttribute or + * CUdevice_attribute. Flag + * CUPTI_ACTIVITY_FLAG_DEVICE_ATTRIBUTE_CUDEVICE is used to indicate + * what kind of attribute this is. If + * CUPTI_ACTIVITY_FLAG_DEVICE_ATTRIBUTE_CUDEVICE is 1 then + * CUdevice_attribute field is value, otherwise + * CUpti_DeviceAttribute field is valid. + */ + union { + CUdevice_attribute cu; + CUpti_DeviceAttribute cupti; + } attribute; + + /** + * The value for the attribute. See CUpti_DeviceAttribute and + * CUdevice_attribute for the type of the value for a given + * attribute. + */ + union { + double vDouble; + uint32_t vUint32; + uint64_t vUint64; + int32_t vInt32; + int64_t vInt64; + } value; +} CUpti_ActivityDeviceAttribute; + +/** + * \brief The activity record for a context. + * + * This activity record represents information about a context + * (CUPTI_ACTIVITY_KIND_CONTEXT). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_CONTEXT. + */ + CUpti_ActivityKind kind; + + /** + * The context ID. + */ + uint32_t contextId; + + /** + * The device ID. + */ + uint32_t deviceId; + + /** + * The compute API kind. \see CUpti_ActivityComputeApiKind + */ + uint16_t computeApiKind; + + /** + * The ID for the NULL stream in this context + */ + uint16_t nullStreamId; + + /** + * The ID of the parent context. It would be 0 if + * context does not have parent + */ + uint32_t parentContextId; + + /** + * This field indicates whether the context is a green context + */ + uint8_t isGreenContext; + + uint8_t padding[3]; +} CUpti_ActivityContext2; + +/** + * \brief The activity record providing a name. + * + * This activity record provides a name for a device, context, thread, + * etc. and other resource naming done via NVTX APIs + * (CUPTI_ACTIVITY_KIND_NAME). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_NAME. + */ + CUpti_ActivityKind kind; + + /** + * The kind of activity object being named. + */ + CUpti_ActivityObjectKind objectKind; + + /** + * The identifier for the activity object. 'objectKind' indicates + * which ID is valid for this record. + */ + CUpti_ActivityObjectKindId objectId; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The name. + */ + const char *name; + +} CUpti_ActivityName; + +/** + * \brief The activity record providing a marker which is an + * instantaneous point in time. + * + * The marker is specified with a descriptive name and unique id + * (CUPTI_ACTIVITY_KIND_MARKER). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MARKER. + */ + CUpti_ActivityKind kind; + + /** + * The flags associated with the marker. \see CUpti_ActivityFlag + */ + CUpti_ActivityFlag flags; + + /** + * The timestamp for the marker, in ns. A value of 0 indicates that + * timestamp information could not be collected for the marker. + */ + uint64_t timestamp; + + /** + * The marker ID. + */ + uint32_t id; + + /** + * The kind of activity object associated with this marker. + */ + CUpti_ActivityObjectKind objectKind; + + /** + * The identifier for the activity object associated with this + * marker. 'objectKind' indicates which ID is valid for this record. + */ + CUpti_ActivityObjectKindId objectId; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; + + + /** + * The marker name for an instantaneous or start marker. This will + * be NULL for an end marker. + */ + const char *name; + + /** + * The name of the domain to which this marker belongs to. + * This will be NULL for default domain. + */ + const char *domain; + +} CUpti_ActivityMarker2; + +/** + * \brief The activity record providing detailed information for a marker. + * + * The marker data contains color, payload, and category. + * (CUPTI_ACTIVITY_KIND_MARKER_DATA). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be + * CUPTI_ACTIVITY_KIND_MARKER_DATA. + */ + CUpti_ActivityKind kind; + + /** + * The flags associated with the marker. \see CUpti_ActivityFlag + */ + CUpti_ActivityFlag flags; + + /** + * The marker ID. + */ + uint32_t id; + + /** + * Defines the payload format for the value associated with the marker. + */ + CUpti_MetricValueKind payloadKind; + + /** + * The payload value. + */ + CUpti_MetricValue payload; + + /** + * The color for the marker. + */ + uint32_t color; + + /** + * The category for the marker. + */ + uint32_t category; + +} CUpti_ActivityMarkerData; + +/** + * \brief The activity record for CUPTI and driver overheads. + * + * This activity record provides CUPTI and driver overhead information + * (CUPTI_ACTIVITY_OVERHEAD). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_OVERHEAD. + */ + CUpti_ActivityKind kind; + + /** + * The kind of overhead, CUPTI, DRIVER, COMPILER etc. + */ + CUpti_ActivityOverheadKind overheadKind; + + /** + * The kind of activity object that the overhead is associated with. + */ + CUpti_ActivityObjectKind objectKind; + + /** + * The identifier for the activity object. 'objectKind' indicates + * which ID is valid for this record. + */ + CUpti_ActivityObjectKindId objectId; + + /** + * The start timestamp for the overhead, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the overhead. + */ + uint64_t start; + + /** + * The end timestamp for the overhead, in ns. A value of 0 for both + * the start and end timestamps indicates that timestamp information + * could not be collected for the overhead. + */ + uint64_t end; + + /** + * The correlation ID of the overhead operation to which + * records belong to. This ID is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the overhead operation. + * In some cases, it can be zero, such as for CUPTI_ACTIVITY_OVERHEAD_CUPTI_BUFFER_FLUSH records. + */ + uint32_t correlationId; + + /** + * Reserved for internal use. + */ + uint32_t reserved0; + + /** + * Pointer to the struct with additional details about the overhead. + * Refer CUpti_ActivityOverheadKind enum and the corresponding structure to typecast and access additional overhead data. + * Client is responsible for freeing this memory using the free function when done. + */ + void *overheadData; + +} CUpti_ActivityOverhead3; + +/** + * \brief The activity record for CUPTI environmental data. + * + * This activity record provides CUPTI environmental data, include + * power, clocks, and thermals. This information is sampled at + * various rates and returned in this activity record. The consumer + * of the record needs to check the environmentKind field to figure + * out what kind of environmental record this is. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_ENVIRONMENT. + */ + CUpti_ActivityKind kind; + + /** + * The ID of the device + */ + uint32_t deviceId; + + /** + * The timestamp when this sample was retrieved, in ns. A value of 0 + * indicates that timestamp information could not be collected for + * the marker. + */ + uint64_t timestamp; + + /** + * The kind of data reported in this record. + */ + CUpti_ActivityEnvironmentKind environmentKind; + + union { + /** + * Data returned for CUPTI_ACTIVITY_ENVIRONMENT_SPEED environment + * kind. + */ + struct { + /** + * The SM frequency in MHz + */ + uint32_t smClock; + + /** + * The memory frequency in MHz + */ + uint32_t memoryClock; + + /** + * The PCIe link generation. + */ + uint32_t pcieLinkGen; + + /** + * The PCIe link width. + */ + uint32_t pcieLinkWidth; + + /** + * The clocks throttle reasons. + */ + CUpti_EnvironmentClocksThrottleReason clocksThrottleReasons; + } speed; + + /** + * Data returned for CUPTI_ACTIVITY_ENVIRONMENT_TEMPERATURE + * environment kind. + */ + struct { + /** + * The GPU temperature in degrees C. + */ + uint32_t gpuTemperature; + } temperature; + + /** + * Data returned for CUPTI_ACTIVITY_ENVIRONMENT_POWER environment kind. + * The power in milliwatts consumed by GPU and associated circuitry. + * The power in milliwatts that will trigger power management algorithm. + */ + struct { + + uint32_t power; + uint32_t powerLimit; + } power; + + /** + * Data returned for CUPTI_ACTIVITY_ENVIRONMENT_COOLING + * environment kind. + */ + struct { + /** + * The fan speed as percentage of maximum. + */ + uint32_t fanSpeed; + } cooling; + } data; +} CUpti_ActivityEnvironment; + +/** + * \brief The activity record for source-level instruction execution. + * + * This activity records result for source level instruction execution. + * (CUPTI_ACTIVITY_KIND_INSTRUCTION_EXECUTION). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_INSTRUCTION_EXECUTION. + */ + CUpti_ActivityKind kind; + + /** + * The properties of this instruction execution. + */ + CUpti_ActivityFlag flags; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * Correlation ID with global/device function name + */ + uint32_t functionId; + + /** + * The pc offset for the instruction. + */ + uint32_t pcOffset; + + /** + * This increments each time when this instruction is executed by number + * of threads that executed this instruction, regardless of predicate or condition code. + */ + uint64_t threadsExecuted; + + /** + * This increments each time when this instruction is executed by number + * of threads that executed this instruction with predicate and condition code evaluating to true. + */ + uint64_t notPredOffThreadsExecuted; + + /** + * The number of times this instruction was executed per warp. It will be incremented + * regardless of predicate or condition code. + */ + uint32_t executed; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +} CUpti_ActivityInstructionExecution; + +/** + * \brief The activity record for PC sampling. + * + * This activity records information obtained by sampling PC + * (CUPTI_ACTIVITY_KIND_PC_SAMPLING). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_PC_SAMPLING. + */ + CUpti_ActivityKind kind; + + /** + * The properties of this instruction. + */ + CUpti_ActivityFlag flags; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * Correlation ID with global/device function name + */ + uint32_t functionId; + + /** + * Number of times the PC was sampled with the stallReason in the record. + * These samples indicate that no instruction was issued in that cycle from + * the warp scheduler from where the warp was sampled. + * Field is valid for devices with compute capability 6.0 and higher + */ + uint32_t latencySamples; + + /** + * Number of times the PC was sampled with the stallReason in the record. + * The same PC can be sampled with different stall reasons. The count includes + * latencySamples. + */ + uint32_t samples; + + /** + * Current stall reason. Includes one of the reasons from + * \ref CUpti_ActivityPCSamplingStallReason + */ + CUpti_ActivityPCSamplingStallReason stallReason; + + /** + * The pc offset for the instruction. + */ + uint64_t pcOffset; +} CUpti_ActivityPCSampling3; + +/** + * \brief The activity record for record status for PC sampling. + * + * This activity records information obtained by sampling PC + * (CUPTI_ACTIVITY_KIND_PC_SAMPLING_RECORD_INFO). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_PC_SAMPLING_RECORD_INFO. + */ + CUpti_ActivityKind kind; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * Number of times the PC was sampled for this kernel instance including all + * dropped samples. + */ + uint64_t totalSamples; + + /** + * Number of samples that were dropped by hardware due to backpressure/overflow. + */ + uint64_t droppedSamples; + /** + * Sampling period in terms of number of cycles . + */ + uint64_t samplingPeriodInCycles; +} CUpti_ActivityPCSamplingRecordInfo; + +/** + * \brief The activity record for Unified Memory counters (CUDA 7.0 and beyond) + * + * This activity record represents a Unified Memory counter + * (CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER + */ + CUpti_ActivityKind kind; + + /** + * The Unified Memory counter kind + */ + CUpti_ActivityUnifiedMemoryCounterKind counterKind; + + /** + * Value of the counter + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_HTOD, + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_DTOH, + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THREASHING and + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_REMOTE_MAP, it is the size of the + * memory region in bytes. + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_GPU_PAGE_FAULT, it + * is the number of page fault groups for the same page. + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_CPU_PAGE_FAULT_COUNT, + * it is the program counter for the instruction that caused fault. + */ + uint64_t value; + + /** + * The start timestamp of the counter, in ns. + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_HTOD and + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_DTOH, timestamp is + * captured when activity starts on GPU. + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_GPU_PAGE_FAULT and + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_CPU_PAGE_FAULT_COUNT, timestamp is + * captured when CUDA driver started processing the fault. + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THRASHING, timestamp + * is captured when CUDA driver detected thrashing of memory region. + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THROTTLING, + * timestamp is captured when throttling operation was started by CUDA driver. + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_REMOTE_MAP, + * timestamp is captured when CUDA driver has pushed all required operations + * to the processor specified by dstId. + */ + uint64_t start; + + /** + * The end timestamp of the counter, in ns. + * Ignore this field if counterKind is + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_CPU_PAGE_FAULT_COUNT or + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THRASHING or + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_REMOTE_MAP. + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_HTOD and + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_DTOH, timestamp is + * captured when activity finishes on GPU. + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_GPU_PAGE_FAULT, timestamp is + * captured when CUDA driver queues the replay of faulting memory accesses on the GPU + * For counterKind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THROTTLING, timestamp + * is captured when throttling operation was finished by CUDA driver + */ + uint64_t end; + + /** + * This is the virtual base address of the page/s being transferred. For cpu and + * gpu faults, the virtual address for the page that faulted. + */ + uint64_t address; + + /** + * The ID of the source CPU/device involved in the memory transfer, page fault, thrashing, + * throttling or remote map operation. For counterKind + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THRASHING, it is a bitwise ORing of the + * device IDs fighting for the memory region. Ignore this field if counterKind is + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_CPU_PAGE_FAULT_COUNT + */ + uint32_t srcId; + + /** + * The ID of the destination CPU/device involved in the memory transfer or remote map + * operation. Ignore this field if counterKind is + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_GPU_PAGE_FAULT or + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_CPU_PAGE_FAULT_COUNT or + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THRASHING or + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THROTTLING + */ + uint32_t dstId; + + /** + * The ID of the stream causing the transfer. + * This value of this field is invalid. + */ + uint32_t streamId; + + /** + * The ID of the process to which this record belongs to. + */ + uint32_t processId; + + /** + * The flags associated with this record. See enums \ref CUpti_ActivityUnifiedMemoryAccessType + * if counterKind is CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_GPU_PAGE_FAULT + * and \ref CUpti_ActivityUnifiedMemoryMigrationCause if counterKind is + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_HTOD or + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_BYTES_TRANSFER_HTOD + * and \ref CUpti_ActivityUnifiedMemoryRemoteMapCause if counterKind is + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_REMOTE_MAP and \ref CUpti_ActivityFlag + * if counterKind is CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THRASHING or + * CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THROTTLING + */ + uint32_t flags; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +} CUpti_ActivityUnifiedMemoryCounter2; + +/** + * \brief The activity record for global/device functions. + * + * This activity records function name and corresponding module + * information. + * (CUPTI_ACTIVITY_KIND_FUNCTION). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_FUNCTION. + */ + CUpti_ActivityKind kind; + + /** + * ID to uniquely identify the record + */ + uint32_t id; + + /** + * The ID of the context where the function is launched. + */ + uint32_t contextId; + + /** + * The module ID in which this global/device function is present. + */ + uint32_t moduleId; + + /** + * The function's unique symbol index in the module. + */ + uint32_t functionIndex; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The name of the function. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; +} CUpti_ActivityFunction; + +/** + * \brief The activity record for a CUDA module. + * + * This activity record represents a CUDA module + * (CUPTI_ACTIVITY_KIND_MODULE). This activity record kind is not + * produced by the activity API but is included for completeness and + * ease-of-use. Profile frameworks built on top of CUPTI that collect + * module data from the module callback may choose to use this type to + * store the collected module data. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MODULE. + */ + CUpti_ActivityKind kind; + + /** + * The ID of the context where the module is loaded. + */ + uint32_t contextId; + + /** + * The module ID. + */ + uint32_t id; + + /** + * The cubin size. + */ + uint32_t cubinSize; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The pointer to cubin. + */ + const void *cubin; +} CUpti_ActivityModule; + +/** + * \brief The activity record for source-level shared + * access. + * + * This activity records the locations of the shared + * accesses in the source + * (CUPTI_ACTIVITY_KIND_SHARED_ACCESS). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_SHARED_ACCESS. + */ + CUpti_ActivityKind kind; + + /** + * The properties of this shared access. + */ + CUpti_ActivityFlag flags; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * Correlation ID with global/device function name + */ + uint32_t functionId; + + /** + * The pc offset for the access. + */ + uint32_t pcOffset; + + /** + * This increments each time when this instruction is executed by number + * of threads that executed this instruction with predicate and condition code evaluating to true. + */ + uint64_t threadsExecuted; + + /** + * The total number of shared memory transactions generated by this access + */ + uint64_t sharedTransactions; + + /** + * The minimum number of shared memory transactions possible based on the access pattern. + */ + uint64_t theoreticalSharedTransactions; + + /** + * The number of times this instruction was executed per warp. It will be incremented + * when at least one of thread among warp is active with predicate and condition code + * evaluating to true. + */ + uint32_t executed; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +} CUpti_ActivitySharedAccess; + +/** + * \brief The activity record for CUDA event. + * + * This activity is used to track recorded events. + * (CUPTI_ACTIVITY_KIND_CUDA_EVENT). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_CUDA_EVENT. + */ + CUpti_ActivityKind kind; + + /** + * The correlation ID of the API to which this result is associated. + */ + uint32_t correlationId; + + /** + * The ID of the context where the event was recorded. + */ + uint32_t contextId; + + /** + * The compute stream where the event was recorded. + */ + uint32_t streamId; + + /** + * A unique event ID to identify the event record. + */ + uint32_t eventId; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +} CUpti_ActivityCudaEvent; + +/** + * \brief The activity record for CUDA stream. + * + * This activity is used to track created streams. + * (CUPTI_ACTIVITY_KIND_STREAM). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_STREAM. + */ + CUpti_ActivityKind kind; + /** + * The ID of the context where the stream was created. + */ + uint32_t contextId; + + /** + * A unique stream ID to identify the stream. + */ + uint32_t streamId; + + /** + * The clamped priority for the stream. + */ + uint32_t priority; + + /** + * Flags associated with the stream. + */ + CUpti_ActivityStreamFlag flag; + + /** + * The correlation ID of the API to which this result is associated. + */ + uint32_t correlationId; +} CUpti_ActivityStream; + +/** + * \brief The activity record for synchronization management. + * + * This activity is used to track various CUDA synchronization APIs. + * (CUPTI_ACTIVITY_KIND_SYNCHRONIZATION). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_SYNCHRONIZATION. + */ + CUpti_ActivityKind kind; + + /** + * The type of record. + */ + CUpti_ActivitySynchronizationType type; + + /** + * The start timestamp for the function, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the function. + */ + uint64_t start; + + /** + * The end timestamp for the function, in ns. A value of 0 for both + * the start and end timestamps indicates that timestamp information + * could not be collected for the function. + */ + uint64_t end; + + /** + * The correlation ID of the API to which this result is associated. + */ + uint32_t correlationId; + + /** + * The ID of the context for which the synchronization API is called. + * In case of context synchronization API it is the context id for which the API is called. + * In case of stream/event synchronization it is the ID of the context where the stream/event was created. + */ + uint32_t contextId; + + /** + * The compute stream for which the synchronization API is called. + * A CUPTI_SYNCHRONIZATION_INVALID_VALUE value indicate the field is not applicable for this record. + * Not valid for cuCtxSynchronize, cuEventSynchronize. + */ + uint32_t streamId; + + /** + * The event ID for which the synchronization API is called. + * A CUPTI_SYNCHRONIZATION_INVALID_VALUE value indicate the field is not applicable for this record. + * Not valid for cuCtxSynchronize, cuStreamSynchronize. + */ + uint32_t cudaEventId; +} CUpti_ActivitySynchronization; + +/** + * \brief The activity record for source-level sass/source + * line-by-line correlation. + * + * This activity records source level sass/source correlation + * information. + * (CUPTI_ACTIVITY_KIND_INSTRUCTION_CORRELATION). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_INSTRUCTION_CORRELATION. + */ + CUpti_ActivityKind kind; + + /** + * The properties of this instruction. + */ + CUpti_ActivityFlag flags; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * Correlation ID with global/device function name + */ + uint32_t functionId; + + /** + * The pc offset for the instruction. + */ + uint32_t pcOffset; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +} CUpti_ActivityInstructionCorrelation; + +/** + * \brief The OpenAcc event kind for OpenAcc activity records. + * + * \see CUpti_ActivityKindOpenAcc + */ +typedef enum { + CUPTI_OPENACC_EVENT_KIND_INVALID = 0, + CUPTI_OPENACC_EVENT_KIND_DEVICE_INIT = 1, + CUPTI_OPENACC_EVENT_KIND_DEVICE_SHUTDOWN = 2, + CUPTI_OPENACC_EVENT_KIND_RUNTIME_SHUTDOWN = 3, + CUPTI_OPENACC_EVENT_KIND_ENQUEUE_LAUNCH = 4, + CUPTI_OPENACC_EVENT_KIND_ENQUEUE_UPLOAD = 5, + CUPTI_OPENACC_EVENT_KIND_ENQUEUE_DOWNLOAD = 6, + CUPTI_OPENACC_EVENT_KIND_WAIT = 7, + CUPTI_OPENACC_EVENT_KIND_IMPLICIT_WAIT = 8, + CUPTI_OPENACC_EVENT_KIND_COMPUTE_CONSTRUCT = 9, + CUPTI_OPENACC_EVENT_KIND_UPDATE = 10, + CUPTI_OPENACC_EVENT_KIND_ENTER_DATA = 11, + CUPTI_OPENACC_EVENT_KIND_EXIT_DATA = 12, + CUPTI_OPENACC_EVENT_KIND_CREATE = 13, + CUPTI_OPENACC_EVENT_KIND_DELETE = 14, + CUPTI_OPENACC_EVENT_KIND_ALLOC = 15, + CUPTI_OPENACC_EVENT_KIND_FREE = 16, + CUPTI_OPENACC_EVENT_KIND_FORCE_INT = 0x7fffffff +} CUpti_OpenAccEventKind; + +/** + * \brief The OpenAcc parent construct kind for OpenAcc activity records. + */ +typedef enum { + CUPTI_OPENACC_CONSTRUCT_KIND_UNKNOWN = 0, + CUPTI_OPENACC_CONSTRUCT_KIND_PARALLEL = 1, + CUPTI_OPENACC_CONSTRUCT_KIND_KERNELS = 2, + CUPTI_OPENACC_CONSTRUCT_KIND_LOOP = 3, + CUPTI_OPENACC_CONSTRUCT_KIND_DATA = 4, + CUPTI_OPENACC_CONSTRUCT_KIND_ENTER_DATA = 5, + CUPTI_OPENACC_CONSTRUCT_KIND_EXIT_DATA = 6, + CUPTI_OPENACC_CONSTRUCT_KIND_HOST_DATA = 7, + CUPTI_OPENACC_CONSTRUCT_KIND_ATOMIC = 8, + CUPTI_OPENACC_CONSTRUCT_KIND_DECLARE = 9, + CUPTI_OPENACC_CONSTRUCT_KIND_INIT = 10, + CUPTI_OPENACC_CONSTRUCT_KIND_SHUTDOWN = 11, + CUPTI_OPENACC_CONSTRUCT_KIND_SET = 12, + CUPTI_OPENACC_CONSTRUCT_KIND_UPDATE = 13, + CUPTI_OPENACC_CONSTRUCT_KIND_ROUTINE = 14, + CUPTI_OPENACC_CONSTRUCT_KIND_WAIT = 15, + CUPTI_OPENACC_CONSTRUCT_KIND_RUNTIME_API = 16, + CUPTI_OPENACC_CONSTRUCT_KIND_FORCE_INT = 0x7fffffff + +} CUpti_OpenAccConstructKind; + +typedef enum { + CUPTI_OPENMP_EVENT_KIND_INVALID = 0, + CUPTI_OPENMP_EVENT_KIND_PARALLEL = 1, + CUPTI_OPENMP_EVENT_KIND_TASK = 2, + CUPTI_OPENMP_EVENT_KIND_THREAD = 3, + CUPTI_OPENMP_EVENT_KIND_IDLE = 4, + CUPTI_OPENMP_EVENT_KIND_WAIT_BARRIER = 5, + CUPTI_OPENMP_EVENT_KIND_WAIT_TASKWAIT = 6, + CUPTI_OPENMP_EVENT_KIND_FORCE_INT = 0x7fffffff +} CUpti_OpenMpEventKind; + +/** + * \brief The base activity record for OpenAcc records. + * + * The OpenACC activity API part uses a CUpti_ActivityOpenAcc as a generic + * representation for any OpenACC activity. The 'kind' field is used to determine the + * specific activity kind, and from that the CUpti_ActivityOpenAcc object can + * be cast to the specific OpenACC activity record type appropriate for that kind. + * + * Note that all OpenACC activity record types are padded and aligned to + * ensure that each member of the record is naturally aligned. + * + * \see CUpti_ActivityKind + */ +typedef struct PACKED_ALIGNMENT { + /** + * The kind of this activity. + */ + CUpti_ActivityKind kind; + + /** + * CUPTI OpenACC event kind (\see CUpti_OpenAccEventKind) + */ + CUpti_OpenAccEventKind eventKind; + + /** + * CUPTI OpenACC parent construct kind (\see CUpti_OpenAccConstructKind) + * + * Note that for applications using PGI OpenACC runtime < 16.1, this + * will always be CUPTI_OPENACC_CONSTRUCT_KIND_UNKNOWN. + */ + CUpti_OpenAccConstructKind parentConstruct; + + /** + * Version number + */ + uint32_t version; + + /** + * 1 for any implicit event, such as an implicit wait at a synchronous data construct + * 0 otherwise + */ + uint32_t implicit; + + /** + * Device type + */ + uint32_t deviceType; + + /** + * Device number + */ + uint32_t deviceNumber; + + /** + * ThreadId + */ + uint32_t threadId; + + /** + * Value of async() clause of the corresponding directive + */ + uint64_t async; + + /** + * Internal asynchronous queue number used + */ + uint64_t asyncMap; + + /** + * The line number of the directive or program construct or the starting line + * number of the OpenACC construct corresponding to the event. + * A zero value means the line number is not known. + */ + uint32_t lineNo; + + /** + * For an OpenACC construct, this contains the line number of the end + * of the construct. A zero value means the line number is not known. + */ + uint32_t endLineNo; + + /** + * The line number of the first line of the function named in funcName. + * A zero value means the line number is not known. + */ + uint32_t funcLineNo; + + /** + * The last line number of the function named in funcName. + * A zero value means the line number is not known. + */ + uint32_t funcEndLineNo; + + /** + * CUPTI start timestamp + */ + uint64_t start; + + /** + * CUPTI end timestamp + */ + uint64_t end; + + /** + * CUDA device id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuDeviceId; + + /** + * CUDA context id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuContextId; + + /** + * CUDA stream id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuStreamId; + + /** + * The ID of the process where the OpenACC activity is executing. + */ + uint32_t cuProcessId; + + /** + * The ID of the thread where the OpenACC activity is executing. + */ + uint32_t cuThreadId; + + /** + * The OpenACC correlation ID. + * Valid only if deviceType is acc_device_nvidia. + * If not 0, it uniquely identifies this record. It is identical to the + * externalId in the preceding external correlation record of type + * CUPTI_EXTERNAL_CORRELATION_KIND_OPENACC. + */ + uint32_t externalId; + + /* + * A pointer to null-terminated string containing the name of or path to + * the source file, if known, or a null pointer if not. + */ + const char *srcFile; + + /* + * A pointer to a null-terminated string containing the name of the + * function in which the event occurred. + */ + const char *funcName; +} CUpti_ActivityOpenAcc; + +/** + * \brief The activity record for OpenACC data. + * + * (CUPTI_ACTIVITY_KIND_OPENACC_DATA). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_OPENACC_DATA. + */ + CUpti_ActivityKind kind; + + /** + * CUPTI OpenACC event kind (\see CUpti_OpenAccEventKind) + */ + CUpti_OpenAccEventKind eventKind; + + /* + * CUPTI OpenACC parent construct kind (\see CUpti_OpenAccConstructKind) + * + * Note that for applications using PGI OpenACC runtime < 16.1, this + * will always be CUPTI_OPENACC_CONSTRUCT_KIND_UNKNOWN. + */ + CUpti_OpenAccConstructKind parentConstruct; + + /* + * Version number + */ + uint32_t version; + + /* + * 1 for any implicit event, such as an implicit wait at a synchronous data construct + * 0 otherwise + */ + uint32_t implicit; + + /* + * Device type + */ + uint32_t deviceType; + + /* + * Device number + */ + uint32_t deviceNumber; + + /** + * ThreadId + */ + uint32_t threadId; + + /* + * Value of async() clause of the corresponding directive + */ + uint64_t async; + + /* + * Internal asynchronous queue number used + */ + uint64_t asyncMap; + + /* + * The line number of the directive or program construct or the starting line + * number of the OpenACC construct corresponding to the event. + * A negative or zero value means the line number is not known. + */ + uint32_t lineNo; + + /* + * For an OpenACC construct, this contains the line number of the end + * of the construct. A negative or zero value means the line number is not known. + */ + uint32_t endLineNo; + + /* + * The line number of the first line of the function named in func_name. + * A negative or zero value means the line number is not known. + */ + uint32_t funcLineNo; + + /* + * The last line number of the function named in func_name. + * A negative or zero value means the line number is not known. + */ + uint32_t funcEndLineNo; + + /** + * CUPTI start timestamp + */ + uint64_t start; + + /** + * CUPTI end timestamp + */ + uint64_t end; + + /** + * CUDA device id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuDeviceId; + + /** + * CUDA context id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuContextId; + + /** + * CUDA stream id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuStreamId; + + /** + * The ID of the process where the OpenACC activity is executing. + */ + uint32_t cuProcessId; + + /** + * The ID of the thread where the OpenACC activity is executing. + */ + uint32_t cuThreadId; + + /** + * The OpenACC correlation ID. + * Valid only if deviceType is acc_device_nvidia. + * If not 0, it uniquely identifies this record. It is identical to the + * externalId in the preceding external correlation record of type + * CUPTI_EXTERNAL_CORRELATION_KIND_OPENACC. + */ + uint32_t externalId; + + /* + * A pointer to null-terminated string containing the name of or path to + * the source file, if known, or a null pointer if not. + */ + const char *srcFile; + + /* + * A pointer to a null-terminated string containing the name of the + * function in which the event occurred. + */ + const char *funcName; + + /* --- end of common CUpti_ActivityOpenAcc part --- */ + + /** + * Number of bytes + */ + uint64_t bytes; + + /** + * Host pointer if available + */ + uint64_t hostPtr; + + /** + * Device pointer if available + */ + uint64_t devicePtr; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad1; +#endif + + /* + * A pointer to null-terminated string containing the name of the variable + * for which this event is triggered, if known, or a null pointer if not. + */ + const char *varName; + +} CUpti_ActivityOpenAccData; + +/** + * \brief The activity record for OpenACC launch. + * + * (CUPTI_ACTIVITY_KIND_OPENACC_LAUNCH). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_OPENACC_LAUNCH. + */ + CUpti_ActivityKind kind; + + /** + * CUPTI OpenACC event kind (\see CUpti_OpenAccEventKind) + */ + CUpti_OpenAccEventKind eventKind; + + /** + * CUPTI OpenACC parent construct kind (\see CUpti_OpenAccConstructKind) + * + * Note that for applications using PGI OpenACC runtime < 16.1, this + * will always be CUPTI_OPENACC_CONSTRUCT_KIND_UNKNOWN. + */ + CUpti_OpenAccConstructKind parentConstruct; + + /** + * Version number + */ + uint32_t version; + + /** + * 1 for any implicit event, such as an implicit wait at a synchronous data construct + * 0 otherwise + */ + uint32_t implicit; + + /** + * Device type + */ + uint32_t deviceType; + + /** + * Device number + */ + uint32_t deviceNumber; + + /** + * ThreadId + */ + uint32_t threadId; + + /** + * Value of async() clause of the corresponding directive + */ + uint64_t async; + + /** + * Internal asynchronous queue number used + */ + uint64_t asyncMap; + + /** + * The line number of the directive or program construct or the starting line + * number of the OpenACC construct corresponding to the event. + * A negative or zero value means the line number is not known. + */ + uint32_t lineNo; + + /** + * For an OpenACC construct, this contains the line number of the end + * of the construct. A negative or zero value means the line number is not known. + */ + uint32_t endLineNo; + + /** + * The line number of the first line of the function named in func_name. + * A negative or zero value means the line number is not known. + */ + uint32_t funcLineNo; + + /** + * The last line number of the function named in func_name. + * A negative or zero value means the line number is not known. + */ + uint32_t funcEndLineNo; + + /** + * CUPTI start timestamp + */ + uint64_t start; + + /** + * CUPTI end timestamp + */ + uint64_t end; + + /** + * CUDA device id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuDeviceId; + + /** + * CUDA context id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuContextId; + + /** + * CUDA stream id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuStreamId; + + /** + * The ID of the process where the OpenACC activity is executing. + */ + uint32_t cuProcessId; + + /** + * The ID of the thread where the OpenACC activity is executing. + */ + uint32_t cuThreadId; + + /** + * The OpenACC correlation ID. + * Valid only if deviceType is acc_device_nvidia. + * If not 0, it uniquely identifies this record. It is identical to the + * externalId in the preceding external correlation record of type + * CUPTI_EXTERNAL_CORRELATION_KIND_OPENACC. + */ + uint32_t externalId; + + /** + * A pointer to null-terminated string containing the name of or path to + * the source file, if known, or a null pointer if not. + */ + const char *srcFile; + + /** + * A pointer to a null-terminated string containing the name of the + * function in which the event occurred. + */ + const char *funcName; + + /* --- end of common CUpti_ActivityOpenAcc part --- */ + + /** + * The number of gangs created for this kernel launch + */ + uint64_t numGangs; + + /** + * The number of workers created for this kernel launch + */ + uint64_t numWorkers; + + /** + * The number of vector lanes created for this kernel launch + */ + uint64_t vectorLength; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad1; +#endif + + /** + * A pointer to null-terminated string containing the name of the + * kernel being launched, if known, or a null pointer if not. + */ + const char *kernelName; + +} CUpti_ActivityOpenAccLaunch; + +/** + * \brief The activity record for OpenACC other. + * + * (CUPTI_ACTIVITY_KIND_OPENACC_OTHER). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_OPENACC_OTHER. + */ + CUpti_ActivityKind kind; + + /** + * CUPTI OpenACC event kind (\see CUpti_OpenAccEventKind) + */ + CUpti_OpenAccEventKind eventKind; + + /** + * CUPTI OpenACC parent construct kind (\see CUpti_OpenAccConstructKind) + * + * Note that for applications using PGI OpenACC runtime < 16.1, this + * will always be CUPTI_OPENACC_CONSTRUCT_KIND_UNKNOWN. + */ + CUpti_OpenAccConstructKind parentConstruct; + + /** + * Version number + */ + uint32_t version; + + /** + * 1 for any implicit event, such as an implicit wait at a synchronous data construct + * 0 otherwise + */ + uint32_t implicit; + + /** + * Device type + */ + uint32_t deviceType; + + /** + * Device number + */ + uint32_t deviceNumber; + + /** + * ThreadId + */ + uint32_t threadId; + + /** + * Value of async() clause of the corresponding directive + */ + uint64_t async; + + /** + * Internal asynchronous queue number used + */ + uint64_t asyncMap; + + /** + * The line number of the directive or program construct or the starting line + * number of the OpenACC construct corresponding to the event. + * A negative or zero value means the line number is not known. + */ + uint32_t lineNo; + + /** + * For an OpenACC construct, this contains the line number of the end + * of the construct. A negative or zero value means the line number is not known. + */ + uint32_t endLineNo; + + /** + * The line number of the first line of the function named in func_name. + * A negative or zero value means the line number is not known. + */ + uint32_t funcLineNo; + + /** + * The last line number of the function named in func_name. + * A negative or zero value means the line number is not known. + */ + uint32_t funcEndLineNo; + + /** + * CUPTI start timestamp + */ + uint64_t start; + + /** + * CUPTI end timestamp + */ + uint64_t end; + + /** + * CUDA device id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuDeviceId; + + /** + * CUDA context id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuContextId; + + /** + * CUDA stream id + * Valid only if deviceType is acc_device_nvidia. + */ + uint32_t cuStreamId; + + /** + * The ID of the process where the OpenACC activity is executing. + */ + uint32_t cuProcessId; + + /** + * The ID of the thread where the OpenACC activity is executing. + */ + uint32_t cuThreadId; + + /** + * The OpenACC correlation ID. + * Valid only if deviceType is acc_device_nvidia. + * If not 0, it uniquely identifies this record. It is identical to the + * externalId in the preceding external correlation record of type + * CUPTI_EXTERNAL_CORRELATION_KIND_OPENACC. + */ + uint32_t externalId; + + /** + * A pointer to null-terminated string containing the name of or path to + * the source file, if known, or a null pointer if not. + */ + const char *srcFile; + + /** + * A pointer to a null-terminated string containing the name of the + * function in which the event occurred. + */ + const char *funcName; + + /* --- end of common CUpti_ActivityOpenAcc part --- */ +} CUpti_ActivityOpenAccOther; + +/** + * \brief The base activity record for OpenMp records. + * + * \see CUpti_ActivityKind + */ +typedef struct PACKED_ALIGNMENT { + + /** + * The kind of this activity. + */ + CUpti_ActivityKind kind; + + /** + * CUPTI OpenMP event kind (\see CUpti_OpenMpEventKind) + */ + CUpti_OpenMpEventKind eventKind; + + /** + * Version number + */ + uint32_t version; + + /** + * ThreadId + */ + uint32_t threadId; + + /** + * CUPTI start timestamp + */ + uint64_t start; + + /** + * CUPTI end timestamp + */ + uint64_t end; + + /** + * The ID of the process where the OpenMP activity is executing. + */ + uint32_t cuProcessId; + + /** + * The ID of the thread where the OpenMP activity is executing. + */ + uint32_t cuThreadId; +} CUpti_ActivityOpenMp; + +/** + * \brief The kind of external APIs supported for correlation. + * + * Custom correlation kinds are reserved for usage in external tools. + * + * \see CUpti_ActivityExternalCorrelation + */ +typedef enum { + CUPTI_EXTERNAL_CORRELATION_KIND_INVALID = 0, + + /** + * The external API is unknown to CUPTI + */ + CUPTI_EXTERNAL_CORRELATION_KIND_UNKNOWN = 1, + + /** + * The external API is OpenACC + */ + CUPTI_EXTERNAL_CORRELATION_KIND_OPENACC = 2, + + /** + * The external API is custom0 + */ + CUPTI_EXTERNAL_CORRELATION_KIND_CUSTOM0 = 3, + + /** + * The external API is custom1 + */ + CUPTI_EXTERNAL_CORRELATION_KIND_CUSTOM1 = 4, + + /** + * The external API is custom2 + */ + CUPTI_EXTERNAL_CORRELATION_KIND_CUSTOM2 = 5, + + /** + * Add new kinds before this line + */ + CUPTI_EXTERNAL_CORRELATION_KIND_SIZE, + + CUPTI_EXTERNAL_CORRELATION_KIND_FORCE_INT = 0x7fffffff +} CUpti_ExternalCorrelationKind; + +/** + * \brief The activity record for correlation with external records + * + * This activity record correlates native CUDA records (e.g. CUDA Driver API, + * kernels, memcpys, ...) with records from external APIs such as OpenACC. + * (CUPTI_ACTIVITY_KIND_EXTERNAL_CORRELATION). + * + * \see CUpti_ActivityKind + */ +typedef struct PACKED_ALIGNMENT { + /** + * The kind of this activity. + */ + CUpti_ActivityKind kind; + + /** + * The kind of external API this record correlated to. + */ + CUpti_ExternalCorrelationKind externalKind; + + /** + * The correlation ID of the associated non-CUDA API record. + * The exact field in the associated external record depends + * on that record's activity kind (\see externalKind). + */ + uint64_t externalId; + + /** + * The correlation ID of the associated CUDA driver or runtime API record. + */ + uint32_t correlationId; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t reserved; +} CUpti_ActivityExternalCorrelation; + +/** +* \brief The device type for device connected to NVLink. +*/ +typedef enum { + CUPTI_DEV_TYPE_INVALID = 0, + + /** + * The device type is GPU. + */ + CUPTI_DEV_TYPE_GPU = 1, + + /** + * The device type is NVLink processing unit in CPU. + */ + CUPTI_DEV_TYPE_NPU = 2, + + CUPTI_DEV_TYPE_FORCE_INT = 0x7fffffff +} CUpti_DevType; + +/** +* \brief NVLink information. +* +* This structure gives capabilities of each logical NVLink connection between two devices, +* gpu<->gpu or gpu<->CPU which can be used to understand the topology. +*/ + +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_NVLINK. + */ + CUpti_ActivityKind kind; + + /** + * NvLink version. + */ + uint32_t nvlinkVersion; + + /** + * Type of device 0 \ref CUpti_DevType + */ + CUpti_DevType typeDev0; + + /** + * Type of device 1 \ref CUpti_DevType + */ + CUpti_DevType typeDev1; + + /** + * If typeDev0 is CUPTI_DEV_TYPE_GPU, UUID for device 0. \ref CUpti_ActivityDevice5. + * If typeDev0 is CUPTI_DEV_TYPE_NPU, struct npu for NPU. + */ + union { + CUuuid uuidDev; + struct { + /** + * Index of the NPU. First index will always be zero. + */ + uint32_t index; + + /** + * Domain ID of NPU. On Linux, this can be queried using lspci. + */ + uint32_t domainId; + } npu; + } idDev0; + + /** + * If typeDev1 is CUPTI_DEV_TYPE_GPU, UUID for device 1. \ref CUpti_ActivityDevice5. + * If typeDev1 is CUPTI_DEV_TYPE_NPU, struct npu for NPU. + */ + union { + CUuuid uuidDev; + struct { + + /** + * Index of the NPU. First index will always be zero. + */ + uint32_t index; + + /** + * Domain ID of NPU. On Linux, this can be queried using lspci. + */ + uint32_t domainId; + } npu; + } idDev1; + + /** + * Flag gives capabilities of the link \see CUpti_LinkFlag + */ + uint32_t flag; + + /** + * Number of physical NVLinks present between two devices. + */ + uint32_t physicalNvLinkCount; + + /** + * Port numbers for maximum 32 NVLinks connected to device 0. + * If typeDev0 is CUPTI_DEV_TYPE_NPU, ignore this field. + * In case of invalid/unknown port number, this field will be set + * to value CUPTI_NVLINK_INVALID_PORT. + * This will be used to correlate the metric values to individual + * physical link and attribute traffic to the logical NVLink in + * the topology. + */ + int8_t portDev0[CUPTI_MAX_NVLINK_PORTS]; + + /** + * Port numbers for maximum 32 NVLinks connected to device 1. + * If typeDev1 is CUPTI_DEV_TYPE_NPU, ignore this field. + * In case of invalid/unknown port number, this field will be set + * to value CUPTI_NVLINK_INVALID_PORT. + * This will be used to correlate the metric values to individual + * physical link and attribute traffic to the logical NVLink in + * the topology. + */ + int8_t portDev1[CUPTI_MAX_NVLINK_PORTS]; + + /** + * Bandwidth of NVLink in kbytes/sec + */ + uint64_t bandwidth; + + /** + * NVSwitch is connected as an intermediate node. + */ + uint8_t nvswitchConnected; + + /** + * Undefined. reserved for internal use + */ + uint8_t pad[7]; +} CUpti_ActivityNvLink4; + +#define CUPTI_MAX_GPUS 32 +/** + * Field to differentiate whether PCIE Activity record + * is of a GPU or a PCI Bridge + */ +typedef enum { + /** + * PCIE GPU record + */ + CUPTI_PCIE_DEVICE_TYPE_GPU = 0, + + /** + * PCIE Bridge record + */ + CUPTI_PCIE_DEVICE_TYPE_BRIDGE = 1, + + CUPTI_PCIE_DEVICE_TYPE_FORCE_INT = 0x7fffffff +} CUpti_PcieDeviceType; + +/** + * \brief PCI devices information required to construct topology + * + * This structure gives capabilities of GPU and PCI bridge connected to the PCIE bus + * which can be used to understand the topology. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_PCIE. + */ + CUpti_ActivityKind kind; + + /** + * Type of device in topology, \ref CUpti_PcieDeviceType. If type is + * CUPTI_PCIE_DEVICE_TYPE_GPU use devId for id and gpuAttr and if type is + * CUPTI_PCIE_DEVICE_TYPE_BRIDGE use bridgeId for id and bridgeAttr. + */ + CUpti_PcieDeviceType type; + + /** + * A unique identifier for GPU or Bridge in Topology + */ + union { + /** + * GPU device ID + */ + CUdevice devId; + + /** + * A unique identifier for Bridge in the Topology + */ + uint32_t bridgeId; + } id; + + /** + * Domain for the GPU or Bridge, required to identify which PCIE bus it belongs to in + * multiple NUMA systems. + */ + uint32_t domain; + + /** + * PCIE Generation of GPU or Bridge. + */ + uint16_t pcieGeneration; + + /** + * Link rate of the GPU or bridge in gigatransfers per second (GT/s) + */ + uint16_t linkRate; + + /** + * Link width of the GPU or bridge + */ + uint16_t linkWidth; + + /** + * Upstream bus ID for the GPU or PCI bridge. Required to identify which bus it is + * connected to in the topology. + */ + uint16_t upstreamBus; + + /** + * Attributes for more information about GPU (gpuAttr) or PCI Bridge (bridgeAttr) + */ + union { + struct { + /** + * UUID for the device. \ref CUpti_ActivityDevice5. + */ + CUuuid uuidDev; + + /** + * CUdevice with which this device has P2P capability. + * This can also be obtained by querying cuDeviceCanAccessPeer or + * cudaDeviceCanAccessPeer APIs + */ + CUdevice peerDev[CUPTI_MAX_GPUS]; + } gpuAttr; + + struct { + /** + * The downstream bus number, used to search downstream devices/bridges connected + * to this bridge. + */ + uint16_t secondaryBus; + + /** + * Device ID of the bridge + */ + uint16_t deviceId; + + /** + * Vendor ID of the bridge + */ + uint16_t vendorId; + + /** + * Padding for alignment + */ + uint16_t pad0; + } bridgeAttr; + } attr; +} CUpti_ActivityPcie; + +/** + * \brief PCIE Generation. + * + * Enumeration of PCIE Generation for + * pcie activity attribute pcieGeneration + */ +typedef enum { + /** + * PCIE Generation 1 + */ + CUPTI_PCIE_GEN_GEN1 = 1, + + /** + * PCIE Generation 2 + */ + CUPTI_PCIE_GEN_GEN2 = 2, + + /** + * PCIE Generation 3 + */ + CUPTI_PCIE_GEN_GEN3 = 3, + + /** + * PCIE Generation 4 + */ + CUPTI_PCIE_GEN_GEN4 = 4, + + /** + * PCIE Generation 5 + */ + CUPTI_PCIE_GEN_GEN5 = 5, + + CUPTI_PCIE_GEN_FORCE_INT = 0x7fffffff +} CUpti_PcieGen; + +/** + * \brief The activity record for an instantaneous CUPTI event. + * + * This activity record represents a CUPTI event value + * (CUPTI_ACTIVITY_KIND_EVENT) sampled at a particular instant. + * This activity record kind is not produced by the activity API but is + * included for completeness and ease-of-use. Profiler frameworks built on + * top of CUPTI that collect event data at a particular time may choose to + * use this type to store the collected event data. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_INSTANTANEOUS_EVENT. + */ + CUpti_ActivityKind kind; + + /** + * The event ID. + */ + CUpti_EventID id; + + /** + * The event value. + */ + uint64_t value; + + /** + * The timestamp at which event is sampled + */ + uint64_t timestamp; + + /** + * The device id + */ + uint32_t deviceId; + + /** + * Undefined. reserved for internal use + */ + uint32_t reserved; +} CUpti_ActivityInstantaneousEvent; + +/** + * \brief The activity record for an instantaneous CUPTI event + * with event domain instance information. + * + * This activity record represents the a CUPTI event value for a + * specific event domain instance + * (CUPTI_ACTIVITY_KIND_EVENT_INSTANCE) sampled at a particular instant. + * This activity record kind is not produced by the activity API but is + * included for completeness and ease-of-use. Profiler frameworks built on + * top of CUPTI that collect event data may choose to use this type to store the + * collected event data. This activity record should be used when + * event domain instance information needs to be associated with the + * event. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_INSTANTANEOUS_EVENT_INSTANCE. + */ + CUpti_ActivityKind kind; + + /** + * The event ID. + */ + CUpti_EventID id; + + /** + * The event value. + */ + uint64_t value; + + /** + * The timestamp at which event is sampled + */ + uint64_t timestamp; + + /** + * The device id + */ + uint32_t deviceId; + + /** + * The event domain instance + */ + uint8_t instance; + + /** + * Undefined. reserved for internal use + */ + uint8_t pad[3]; +} CUpti_ActivityInstantaneousEventInstance; + +/** + * \brief The activity record for an instantaneous CUPTI metric. + * + * This activity record represents the collection of a CUPTI metric + * value (CUPTI_ACTIVITY_KIND_METRIC) at a particular instance. + * This activity record kind is not produced by the activity API but + * is included for completeness and ease-of-use. Profiler frameworks built + * on top of CUPTI that collect metric data may choose to use this type to + * store the collected metric data. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_INSTANTANEOUS_METRIC. + */ + CUpti_ActivityKind kind; + + /** + * The metric ID. + */ + CUpti_MetricID id; + + /** + * The metric value. + */ + CUpti_MetricValue value; + + /** + * The timestamp at which metric is sampled + */ + uint64_t timestamp; + + /** + * The device id + */ + uint32_t deviceId; + + /** + * The properties of this metric. \see CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * Undefined. reserved for internal use + */ + uint8_t pad[3]; +} CUpti_ActivityInstantaneousMetric; + +/** + * \brief The instantaneous activity record for a CUPTI metric with instance + * information. + + * This activity record represents a CUPTI metric value + * for a specific metric domain instance + * (CUPTI_ACTIVITY_KIND_METRIC_INSTANCE) sampled at a particular time. This + * activity record kind is not produced by the activity API but is included for + * completeness and ease-of-use. Profiler frameworks built on top of + * CUPTI that collect metric data may choose to use this type to store + * the collected metric data. This activity record should be used when + * metric domain instance information needs to be associated with the + * metric. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_INSTANTANEOUS_METRIC_INSTANCE. + */ + CUpti_ActivityKind kind; + + /** + * The metric ID. + */ + CUpti_MetricID id; + + /** + * The metric value. + */ + CUpti_MetricValue value; + + /** + * The timestamp at which metric is sampled + */ + uint64_t timestamp; + + /** + * The device id + */ + uint32_t deviceId; + + /** + * The properties of this metric. \see CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * The metric domain instance + */ + uint8_t instance; + + /** + * Undefined. reserved for internal use + */ + uint8_t pad[2]; +} CUpti_ActivityInstantaneousMetricInstance; + +/** + * \brief The types of JIT entry. + * + * To be used in CUpti_ActivityJit. + */ +typedef enum { + CUPTI_ACTIVITY_JIT_ENTRY_INVALID= 0, + + /** + * PTX to CUBIN. + */ + CUPTI_ACTIVITY_JIT_ENTRY_PTX_TO_CUBIN = 1, + + /** + * NVVM-IR to PTX + */ + CUPTI_ACTIVITY_JIT_ENTRY_NVVM_IR_TO_PTX = 2, + + CUPTI_ACTIVITY_JIT_ENTRY_TYPE_FORCE_INT = 0x7fffffff +} CUpti_ActivityJitEntryType; + +/** + * \brief The types of JIT compilation operations. + * + * To be used in CUpti_ActivityJit. + */ + +typedef enum { + CUPTI_ACTIVITY_JIT_OPERATION_INVALID = 0, + /** + * Loaded from the compute cache. + */ + CUPTI_ACTIVITY_JIT_OPERATION_CACHE_LOAD = 1, + + /** + * Stored in the compute cache. + */ + CUPTI_ACTIVITY_JIT_OPERATION_CACHE_STORE = 2, + + /** + * JIT compilation. + */ + CUPTI_ACTIVITY_JIT_OPERATION_COMPILE = 3, + + CUPTI_ACTIVITY_JIT_OPERATION_TYPE_FORCE_INT = 0x7fffffff +} CUpti_ActivityJitOperationType; + +/** + * \brief The activity record for JIT operations. + * This activity represents the JIT operations (compile, load, store) of a CUmodule + * from the Compute Cache. + * Gives the exact hashed path of where the cached module is loaded from, + * or where the module will be stored after Just-In-Time (JIT) compilation. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind must be CUPTI_ACTIVITY_KIND_JIT. + */ + CUpti_ActivityKind kind; + + /** + * The JIT entry type. + */ + CUpti_ActivityJitEntryType jitEntryType; + + /** + * The JIT operation type. + */ + CUpti_ActivityJitOperationType jitOperationType; + + /** + * The device ID. + */ + uint32_t deviceId; + + /** + * The start timestamp for the JIT operation, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the JIT operation. + */ + uint64_t start; + + /** + * The end timestamp for the JIT operation, in ns. A value of 0 for both + * the start and end timestamps indicates that timestamp information + * could not be collected for the JIT operation. + */ + uint64_t end; + + /** + * The correlation ID of the JIT operation to which + * records belong to. Each JIT operation is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the JIT operation. + */ + uint32_t correlationId; + + /** + * Internal use. + */ + uint32_t padding; + + /** + * The correlation ID to correlate JIT compilation, load and store operations. + * Each JIT compilation unit is assigned a unique correlation ID + * at the time of the JIT compilation. This correlation id can be used + * to find the matching JIT cache load/store records. + */ + uint64_t jitOperationCorrelationId; + + /** + * The size of compute cache. + */ + uint64_t cacheSize; + + /** + * The path where the fat binary is cached. + */ + const char* cachePath; + + /** + * The ID of the process where the JIT operation is executing. + */ + uint32_t processId; + + /** + * The ID of the thread where the JIT operation is executing. + */ + uint32_t threadId; +} CUpti_ActivityJit2; + + +/** + * \brief The activity record for trace of graph execution. + * + * This activity record represents execution for a graph without giving visibility + * about the execution of its nodes. This is intended to reduce overheads in tracing + * each node. The activity kind is CUPTI_ACTIVITY_KIND_GRAPH_TRACE + */ +typedef struct { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_GRAPH_TRACE + */ + CUpti_ActivityKind kind; + + /** + * The correlation ID of the graph launch. Each graph launch is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver API activity record that launched + * the graph. + */ + uint32_t correlationId; + + /** + * The start timestamp for the graph execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the graph. + */ + uint64_t start; + + /** + * The end timestamp for the graph execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the graph. + */ + uint64_t end; + + /** + * The ID of the device where the first node of the graph is executed. + */ + uint32_t deviceId; + + /** + * The unique ID of the graph that is launched. + */ + uint32_t graphId; + + /** + * The ID of the context where the first node of the graph is executed. + */ + uint32_t contextId; + + /** + * The ID of the stream where the graph is being launched. + */ + uint32_t streamId; + + /** + * This field is reserved for internal use + */ + void *reserved; + + /** + * The ID of the device where last node of the graph is executed + */ + uint32_t endDeviceId; + + /** + * The ID of the context where the last node of the graph is executed. + */ + uint32_t endContextId; +} CUpti_ActivityGraphTrace2; + +END_PACKED_ALIGNMENT + +/** + * \brief Activity attributes. + * + * These attributes are used to control the behavior of the activity + * API. + */ +typedef enum { + /** + * The device memory size (in bytes) reserved for storing profiling data for concurrent + * kernels (activity kind \ref CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL), memcopies and memsets + * for each buffer on a context. The value is a size_t. + * + * There is a limit on how many device buffers can be allocated per context. User + * can query and set this limit using the attribute + * \ref CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_POOL_LIMIT. + * CUPTI doesn't pre-allocate all the buffers, it pre-allocates only those many + * buffers as set by the attribute \ref CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_PRE_ALLOCATE_VALUE. + * When all of the data in a buffer is consumed, it is added in the reuse pool, and + * CUPTI picks a buffer from this pool when a new buffer is needed. Thus memory + * footprint does not scale with the kernel count. Applications with the high density + * of kernels, memcopies and memsets might result in having CUPTI to allocate more device buffers. + * CUPTI allocates another buffer only when it runs out of the buffers in the + * reuse pool. + * + * Since buffer allocation happens in the main application thread, this might result + * in stalls in the critical path. CUPTI pre-allocates 3 buffers of the same size to + * mitigate this issue. User can query and set the pre-allocation limit using the + * attribute \ref CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_PRE_ALLOCATE_VALUE. + * + * Having larger buffer size leaves less device memory for the application. + * Having smaller buffer size increases the risk of dropping timestamps for + * records if too many kernels or memcopies or memsets are launched at one time. + * + * This value only applies to new buffer allocations. Set this value before initializing + * CUDA or before creating a context to ensure it is considered for the following allocations. + * + * The default value is 3200000 (~3MB) which can accommodate profiling data + * up to 100,000 kernels, memcopies and memsets combined. + * + * Note: Starting with the CUDA 12.0 Update 1 release, CUPTI allocates profiling buffer in the + * device memory by default as this might help in improving the performance of the + * tracing run. Refer to the description of the attribute + * \ref CUPTI_ACTIVITY_ATTR_MEM_ALLOCATION_TYPE_HOST_PINNED for more details. + * Size of the memory and maximum number of pools are still controlled by the attributes + * \ref CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_SIZE and \ref CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_POOL_LIMIT. + * + * Note: The actual amount of device memory per buffer reserved by CUPTI might be larger. + */ + CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_SIZE = 0, + + /** + * The device memory size (in bytes) reserved for storing profiling + * data for CDP operations for each buffer on a context. The + * value is a size_t. + * + * Having larger buffer size means less flush operations but + * consumes more device memory. This value only applies to new + * allocations. + * + * Set this value before initializing CUDA or before creating a + * context to ensure it is considered for the following allocations. + * + * The default value is 8388608 (8MB). + * + * Note: The actual amount of device memory per context reserved by + * CUPTI might be larger. + */ + CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_SIZE_CDP = 1, + + /** + * The maximum number of device memory buffers per context. The value is a size_t. + * + * For an application with high rate of kernel launches, memcopies and memsets having a bigger pool + * limit helps in timestamp collection for all these activities at the expense of a larger memory footprint. + * Refer to the description of the attribute \ref CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_SIZE + * for more details. + * + * Setting this value will not modify the number of memory buffers + * currently stored. + * + * Set this value before initializing CUDA to ensure the limit is + * not exceeded. + * + * The default value is 250. + */ + CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_POOL_LIMIT = 2, + + /** + * This attribute is not supported starting with CUDA 12.3 + * CUPTI no longer uses profiling semaphore pool to store profiling data. + * + * There is a limit on how many semaphore pools can be allocated per context. User + * can query and set this limit using the attribute + * \ref CUPTI_ACTIVITY_ATTR_PROFILING_SEMAPHORE_POOL_LIMIT. + * CUPTI doesn't pre-allocate all the semaphore pools, it pre-allocates only those many + * semaphore pools as set by the attribute \ref CUPTI_ACTIVITY_ATTR_PROFILING_SEMAPHORE_PRE_ALLOCATE_VALUE. + * When all of the data in a semaphore pool is consumed, it is added in the reuse pool, and + * CUPTI picks a semaphore pool from the reuse pool when a new semaphore pool is needed. Thus memory + * footprint does not scale with the kernel count. Applications with the high density + * of kernels might result in having CUPTI to allocate more semaphore pools. + * CUPTI allocates another semaphore pool only when it runs out of the semaphore pools in the + * reuse pool. + * + * Since semaphore pool allocation happens in the main application thread, this might result + * in stalls in the critical path. CUPTI pre-allocates 3 semaphore pools of the same size to + * mitigate this issue. User can query and set the pre-allocation limit using the + * attribute \ref CUPTI_ACTIVITY_ATTR_PROFILING_SEMAPHORE_PRE_ALLOCATE_VALUE. + * + * Having larger semaphore pool size leaves less device memory for the application. + * Having smaller semaphore pool size increases the risk of dropping timestamps for + * kernel records if too many kernels are issued/launched at one time. + * + * This value only applies to new semaphore pool allocations. Set this value before initializing + * CUDA or before creating a context to ensure it is considered for the following allocations. + * + * The default value is 25000 which can accommodate profiling data for upto 25,000 kernels. + * + */ + CUPTI_ACTIVITY_ATTR_PROFILING_SEMAPHORE_POOL_SIZE = 3, + + /** + * This attribute is not supported starting with CUDA 12.3 + * CUPTI no longer uses profiling semaphore pool to store profiling data. + * + * The maximum number of profiling semaphore pools per context. The value is a size_t. + * + * Refer to the description of the attribute \ref CUPTI_ACTIVITY_ATTR_PROFILING_SEMAPHORE_POOL_SIZE + * for more details. + * + * Set this value before initializing CUDA to ensure the limit is not exceeded. + * + * The default value is 250. + */ + CUPTI_ACTIVITY_ATTR_PROFILING_SEMAPHORE_POOL_LIMIT = 4, + + /** + * The flag to indicate whether user should provide activity buffer of zero value. + * The value is a uint8_t. + * + * If the value of this attribute is non-zero, user should provide + * a zero value buffer in the \ref CUpti_BuffersCallbackRequestFunc. + * If the user does not provide a zero value buffer after setting this to non-zero, + * the activity buffer may contain some uninitialized values when CUPTI returns it in + * \ref CUpti_BuffersCallbackCompleteFunc + * + * If the value of this attribute is zero, CUPTI will initialize the user buffer + * received in the \ref CUpti_BuffersCallbackRequestFunc to zero before filling it. + * If the user sets this to zero, a few stalls may appear in critical path because CUPTI + * will zero out the buffer in the main thread. + * Set this value before returning from \ref CUpti_BuffersCallbackRequestFunc to + * ensure it is considered for all the subsequent user buffers. + * + * The default value is 0. + */ + CUPTI_ACTIVITY_ATTR_ZEROED_OUT_ACTIVITY_BUFFER = 5, + + /** + * Number of device buffers to pre-allocate for a context during the initialization phase. + * The value is a size_t. + * + * Refer to the description of the attribute \ref CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_SIZE + * for details. + * + * This value must be less than the maximum number of device buffers set using + * the attribute \ref CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_POOL_LIMIT + * + * Set this value before initializing CUDA or before creating a context to ensure it + * is considered by the CUPTI. + * + * The default value is set to 3 to ping pong between these buffers (if possible). + */ + CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_PRE_ALLOCATE_VALUE = 6, + + /** + * This attribute is not supported starting with CUDA 12.3 + * CUPTI no longer uses profiling semaphore pool to store profiling data. + * + * Number of profiling semaphore pools to pre-allocate for a context during the + * initialization phase. The value is a size_t. + * + * Refer to the description of the attribute \ref CUPTI_ACTIVITY_ATTR_PROFILING_SEMAPHORE_POOL_SIZE + * for details. + * + * This value must be less than the maximum number of profiling semaphore pools set + * using the attribute \ref CUPTI_ACTIVITY_ATTR_PROFILING_SEMAPHORE_POOL_LIMIT + * + * Set this value before initializing CUDA or before creating a context to ensure it + * is considered by the CUPTI. + * + * The default value is set to 3 to ping pong between these pools (if possible). + */ + CUPTI_ACTIVITY_ATTR_PROFILING_SEMAPHORE_PRE_ALLOCATE_VALUE = 7, + + /** + * Allocate page-locked (pinned) host memory for storing profiling data for concurrent + * kernels, memcopies and memsets for each buffer on a context. The value is a uint8_t. + * + * Starting with the CUDA 11.2 release, CUPTI allocates profiling buffer in the pinned host + * memory by default as this might help in improving the performance of the tracing run. + * Allocating excessive amounts of pinned memory may degrade system performance, since it + * reduces the amount of memory available to the system for paging. For this reason user + * might want to change the location from pinned host memory to device memory by setting + * value of this attribute to 0. + * + * Using page-locked (pinned) host memory buffers is not supported on confidential computing + * devices. On setting this attribute to 1, CUPTI will return CUPTI_ERROR_NOT_SUPPORTED. + * + * The default value is 1. + */ + CUPTI_ACTIVITY_ATTR_MEM_ALLOCATION_TYPE_HOST_PINNED = 8, + + /** + * Request activity buffers per-thread to store CUPTI activity records + * in the activity buffer on per-thread basis. The value is a uint8_t. + * + * The attribute should be set before registering the buffer callbacks using + * cuptiActivityRegisterCallbacks API and before any of the CUPTI activity kinds are enabled. + * This makes sure that all the records are stored in activity buffers allocated per-thread. + * Changing this attribute in the middle of the profiling session will result in undefined behavior. + * + * The default value is 0. + */ + CUPTI_ACTIVITY_ATTR_PER_THREAD_ACTIVITY_BUFFER, + + + + CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_FORCE_INT = 0x7fffffff +} CUpti_ActivityAttribute; + +/** + * \brief Thread-Id types. + * + * CUPTI uses different methods to obtain the thread-id depending on the + * support and the underlying platform. This enum documents these methods + * for each type. APIs \ref cuptiSetThreadIdType and \ref cuptiGetThreadIdType + * can be used to set and get the thread-id type. + */ +typedef enum { + /** + * Default type + * Windows uses API GetCurrentThreadId() + * Linux/Mac/Android/QNX use POSIX pthread API pthread_self() + */ + CUPTI_ACTIVITY_THREAD_ID_TYPE_DEFAULT = 0, + + /** + * This type is based on the system API available on the underlying platform + * and thread-id obtained is supposed to be unique for the process lifetime. + * Windows uses API GetCurrentThreadId() + * Linux uses syscall SYS_gettid + * Mac uses syscall SYS_thread_selfid + * Android/QNX use gettid() + */ + CUPTI_ACTIVITY_THREAD_ID_TYPE_SYSTEM = 1, + + /** + * Add new enums before this field. + */ + CUPTI_ACTIVITY_THREAD_ID_TYPE_SIZE = 2, + + CUPTI_ACTIVITY_THREAD_ID_TYPE_FORCE_INT = 0x7fffffff +} CUpti_ActivityThreadIdType; + +/** + * \brief Get the CUPTI timestamp. + * + * Returns a timestamp normalized to correspond with the start and end + * timestamps reported in the CUPTI activity records. The timestamp is + * reported in nanoseconds. + * + * \param timestamp Returns the CUPTI timestamp + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p timestamp is NULL + */ +CUptiResult CUPTIAPI cuptiGetTimestamp(uint64_t *timestamp); + +/** + * \brief Get the ID of a context. + * + * Get the ID of a context. + * + * \param context The context + * \param contextId Returns a process-unique ID for the context + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_CONTEXT The context is NULL or not valid. + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p contextId is NULL + */ +CUptiResult CUPTIAPI cuptiGetContextId(CUcontext context, uint32_t *contextId); + +/** + * \brief Get the ID of a stream. + * + * Get the ID of a stream. The stream ID is unique within a context + * (i.e. all streams within a context will have unique stream + * IDs). + * + * \param context If non-NULL then the stream is checked to ensure + * that it belongs to this context. Typically this parameter should be + * null. + * \param stream The stream + * \param streamId Returns a context-unique ID for the stream + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_STREAM if unable to get stream ID, or + * if \p context is non-NULL and \p stream does not belong to the + * context + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p streamId is NULL + * + * **DEPRECATED** This method is deprecated as of CUDA 8.0. + * Use method cuptiGetStreamIdEx instead. + */ +CUptiResult CUPTIAPI cuptiGetStreamId(CUcontext context, CUstream stream, uint32_t *streamId); + +/** +* \brief Get the ID of a stream. +* +* Get the ID of a stream. The stream ID is unique within a context +* (i.e. all streams within a context will have unique stream +* IDs). +* +* \param context If non-NULL then the stream is checked to ensure +* that it belongs to this context. Typically this parameter should be +* null. +* \param stream The stream +* \param perThreadStream Flag to indicate if program is compiled for per-thread streams +* \param streamId Returns a context-unique ID for the stream +* +* \retval CUPTI_SUCCESS +* \retval CUPTI_ERROR_NOT_INITIALIZED +* \retval CUPTI_ERROR_INVALID_STREAM if unable to get stream ID, or +* if \p context is non-NULL and \p stream does not belong to the +* context +* \retval CUPTI_ERROR_INVALID_PARAMETER if \p streamId is NULL +*/ +CUptiResult CUPTIAPI cuptiGetStreamIdEx(CUcontext context, CUstream stream, uint8_t perThreadStream, uint32_t *streamId); + +/** + * \brief Get the ID of a device + * + * If \p context is NULL, returns the ID of the device that contains + * the currently active context. If \p context is non-NULL, returns + * the ID of the device which contains that context. Operates in a + * similar manner to cudaGetDevice() or cuCtxGetDevice() but may be + * called from within callback functions. + * + * \param context The context, or NULL to indicate the current context. + * \param deviceId Returns the ID of the device that is current for + * the calling thread. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_DEVICE if unable to get device ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p deviceId is NULL + */ +CUptiResult CUPTIAPI cuptiGetDeviceId(CUcontext context, uint32_t *deviceId); + +/** + * \brief Get the unique ID of a graph node + * + * Returns the unique ID of the CUDA graph node. + * + * \param node The graph node. + * \param nodeId Returns the unique ID of the node + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p node is NULL + */ +CUptiResult CUPTIAPI cuptiGetGraphNodeId(CUgraphNode node, uint64_t *nodeId); + +/** + * \brief Get the unique ID of graph + * + * Returns the unique ID of CUDA graph. + * + * \param graph The graph. + * \param pId Returns the unique ID of the graph + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p graph is NULL + */ +CUptiResult CUPTIAPI cuptiGetGraphId(CUgraph graph, uint32_t *pId); + +/** + * \brief Get the unique ID of executable graph + * + * Returns the unique ID of executable CUDA graph. + * + * \param graphExec The executable graph. + * \param pId Returns the unique ID of the executable graph + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p graph is NULL + */ +CUptiResult CUPTIAPI cuptiGetGraphExecId(CUgraphExec graphExec, uint32_t *pId); + +/** + * \brief Enable collection of a specific kind of activity record. + * + * Enable collection of a specific kind of activity record. Multiple + * kinds can be enabled by calling this function multiple times. By + * default all activity kinds are disabled for collection. + * + * \param kind The kind of activity record to collect + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_NOT_COMPATIBLE if the activity kind cannot be enabled + * \retval CUPTI_ERROR_INVALID_KIND if the activity kind is not supported + */ +CUptiResult CUPTIAPI cuptiActivityEnable(CUpti_ActivityKind kind); + +/** + * \brief Enable collection of a specific kind of activity record. For certain activity kinds + * it dumps existing records. + * + * In general, the behavior of this API is similar to the API \ref cuptiActivityEnable i.e. it + * enables the collection of a specific kind of activity record. + * Additionally, this API can help in dumping the records for activities which happened in + * the past before enabling the corresponding activity kind. + * The API allows to get records for the current resource allocations done in CUDA + * For CUPTI_ACTIVITY_KIND_DEVICE, existing device records are dumped + * For CUPTI_ACTIVITY_KIND_CONTEXT, existing context records are dumped + * For CUPTI_ACTIVITY_KIND_STREAM, existing stream records are dumped + * For CUPTI_ACTIVITY_KIND_ NVLINK, existing NVLINK records are dumped + * For CUPTI_ACTIVITY_KIND_PCIE, existing PCIE records are dumped + * For other activities, the behavior is similar to the API \ref cuptiActivityEnable + * + * Device records are emitted in CUPTI on CUDA driver initialization. Those records + * can only be retrieved by the user if CUPTI is attached before CUDA initialization. + * Context and stream records are emitted on context and stream creation. + * The use case of the API is to provide the records for CUDA resources + * (contexts/streams/devices) that are currently active if user late attaches CUPTI. + * + * Before calling this function, the user must register buffer callbacks + * to get the activity records by calling \ref cuptiActivityRegisterCallbacks. + * If the user does not register the buffers and calls API \ref cuptiActivityEnableAndDump, + * then CUPTI will enable the activity kind but not provide any records for that + * activity kind. + * + * \param kind The kind of activity record to collect + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_UNKNOWN if buffer is not initialized. + * \retval CUPTI_ERROR_NOT_COMPATIBLE if the activity kind cannot be enabled + * \retval CUPTI_ERROR_INVALID_KIND if the activity kind is not supported + */ +CUptiResult CUPTIAPI cuptiActivityEnableAndDump(CUpti_ActivityKind kind); + +/** + * \brief Disable collection of a specific kind of activity record. + * + * Disable collection of a specific kind of activity record. Multiple + * kinds can be disabled by calling this function multiple times. By + * default all activity kinds are disabled for collection. + * + * \param kind The kind of activity record to stop collecting + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_KIND if the activity kind is not supported + */ +CUptiResult CUPTIAPI cuptiActivityDisable(CUpti_ActivityKind kind); + +/** + * \brief Enable collection of a specific kind of activity record for + * a context. + * + * Enable collection of a specific kind of activity record for a + * context. This setting done by this API will supersede the global + * settings for activity records enabled by \ref cuptiActivityEnable. + * Multiple kinds can be enabled by calling this function multiple + * times. + * + * \param context The context for which activity is to be enabled + * \param kind The kind of activity record to collect + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_NOT_COMPATIBLE if the activity kind cannot be enabled + * \retval CUPTI_ERROR_INVALID_KIND if the activity kind is not supported + */ +CUptiResult CUPTIAPI cuptiActivityEnableContext(CUcontext context, CUpti_ActivityKind kind); + +/** + * \brief Disable collection of a specific kind of activity record for + * a context. + * + * Disable collection of a specific kind of activity record for a context. + * This setting done by this API will supersede the global settings + * for activity records. + * Multiple kinds can be enabled by calling this function multiple times. + * + * \param context The context for which activity is to be disabled + * \param kind The kind of activity record to stop collecting + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_KIND if the activity kind is not supported + */ +CUptiResult CUPTIAPI cuptiActivityDisableContext(CUcontext context, CUpti_ActivityKind kind); + +/** + * \brief Get the number of activity records that were dropped of + * insufficient buffer space. + * + * Get the number of records that were dropped because of insufficient + * buffer space. The dropped count includes records that could not be + * recorded because CUPTI did not have activity buffer space available + * for the record (because the CUpti_BuffersCallbackRequestFunc + * callback did not return an empty buffer of sufficient size) and + * also CDP records that could not be record because the device-size + * buffer was full (size is controlled by the + * CUPTI_ACTIVITY_ATTR_DEVICE_BUFFER_SIZE_CDP attribute). The dropped + * count maintained for the queue is reset to zero when this function + * is called. + * + * \param context The context, or NULL to get dropped count from global queue + * \param streamId The stream ID + * \param dropped The number of records that were dropped since the last call + * to this function. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p dropped is NULL + */ +CUptiResult CUPTIAPI cuptiActivityGetNumDroppedRecords(CUcontext context, uint32_t streamId, + size_t *dropped); + +/** + * \brief Iterate over the activity records in a buffer. + * + * This is a helper function to iterate over the activity records in a + * buffer. A buffer of activity records is typically obtained by + * receiving a CUpti_BuffersCallbackCompleteFunc callback. Stop iterating + * the buffer when an error occurs. + * + * An example of typical usage: + * \code + * CUpti_Activity *record = NULL; + * CUptiResult status = CUPTI_SUCCESS; + * do { + * status = cuptiActivityGetNextRecord(buffer, validSize, &record); + * if(status == CUPTI_SUCCESS) { + * // Use record here... + * } + * else if (status == CUPTI_ERROR_MAX_LIMIT_REACHED) + * break; + * else if (status == CUPTI_ERROR_INVALID_KIND) + * break; + * else { + * goto Error; + * } + * } while (1); + * \endcode + * + * \param buffer The buffer containing activity records + * \param record Inputs the previous record returned by + * cuptiActivityGetNextRecord and returns the next activity record + * from the buffer. If input value is NULL, returns the first activity + * record in the buffer. Records of certain kinds like CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL + * may contain invalid (0) timestamps, indicating that no timing information could + * be collected for lack of device memory. + * \param validBufferSizeBytes The number of valid bytes in the buffer. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_MAX_LIMIT_REACHED if no more records in the buffer + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p buffer is NULL. + * \retval CUPTI_ERROR_INVALID_KIND if activity record is either incomplete or invalid + */ +CUptiResult CUPTIAPI cuptiActivityGetNextRecord(uint8_t* buffer, size_t validBufferSizeBytes, + CUpti_Activity **record); + +/** + * \brief Function type for callback used by CUPTI to request an empty + * buffer for storing activity records. + * + * This callback function signals the CUPTI client that an activity + * buffer is needed by CUPTI. The activity buffer is used by CUPTI to + * store activity records. The callback function can decline the + * request by setting \p *buffer to NULL. In this case CUPTI may drop + * activity records. + * + * \param buffer Returns the new buffer. If set to NULL then no buffer + * is returned. + * \param size Returns the size of the returned buffer. + * \param maxNumRecords Returns the maximum number of records that + * should be placed in the buffer. If 0 then the buffer is filled with + * as many records as possible. If > 0 the buffer is filled with at + * most that many records before it is returned. + */ +typedef void (CUPTIAPI *CUpti_BuffersCallbackRequestFunc)( + uint8_t **buffer, + size_t *size, + size_t *maxNumRecords); + +/** + * \brief Function type for callback used by CUPTI to return a buffer + * of activity records. + * + * This callback function returns to the CUPTI client a buffer + * containing activity records. The buffer contains \p validSize + * bytes of activity records which should be read using + * cuptiActivityGetNextRecord. The number of dropped records can be + * read using cuptiActivityGetNumDroppedRecords. After this call CUPTI + * relinquished ownership of the buffer and will not use it + * anymore. The client may return the buffer to CUPTI using the + * CUpti_BuffersCallbackRequestFunc callback. + * Note: CUDA 6.0 onwards, all buffers returned by this callback are + * global buffers i.e. there is no context/stream specific buffer. + * User needs to parse the global buffer to extract the context/stream + * specific activity records. + * + * \param context The context this buffer is associated with. If NULL, the + * buffer is associated with the global activities. This field is deprecated + * as of CUDA 6.0 and will always be NULL. + * \param streamId The stream id this buffer is associated with. + * This field is deprecated as of CUDA 6.0 and will always be NULL. + * \param buffer The activity record buffer. + * \param size The total size of the buffer in bytes as set in + * CUpti_BuffersCallbackRequestFunc. + * \param validSize The number of valid bytes in the buffer. + */ +typedef void (CUPTIAPI *CUpti_BuffersCallbackCompleteFunc)( + CUcontext context, + uint32_t streamId, + uint8_t *buffer, + size_t size, + size_t validSize); + +/** + * \brief Registers callback functions with CUPTI for activity buffer + * handling. + * + * This function registers two callback functions to be used in asynchronous + * buffer handling. If registered, activity record buffers are handled using + * asynchronous requested/completed callbacks from CUPTI. + * + * Registering these callbacks prevents the client from using CUPTI's + * blocking enqueue/dequeue functions. + * + * \param funcBufferRequested callback which is invoked when an empty + * buffer is requested by CUPTI + * \param funcBufferCompleted callback which is invoked when a buffer + * containing activity records is available from CUPTI + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if either \p + * funcBufferRequested or \p funcBufferCompleted is NULL + */ +CUptiResult CUPTIAPI cuptiActivityRegisterCallbacks(CUpti_BuffersCallbackRequestFunc funcBufferRequested, + CUpti_BuffersCallbackCompleteFunc funcBufferCompleted); + +/** + * \brief Wait for all activity records to be delivered via the + * completion callback. + * + * This function does not return until all activity records associated + * with the specified context/stream are returned to the CUPTI client + * using the callback registered in cuptiActivityRegisterCallbacks. To + * ensure that all activity records are complete, the requested + * stream(s), if any, are synchronized. + * + * If \p context is NULL, the global activity records (i.e. those not + * associated with a particular stream) are flushed (in this case no + * streams are synchronized). If \p context is a valid CUcontext and + * \p streamId is 0, the buffers of all streams of this context are + * flushed. Otherwise, the buffers of the specified stream in this + * context is flushed. + * + * Before calling this function, the buffer handling callback api + * must be activated by calling cuptiActivityRegisterCallbacks. + * + * \param context A valid CUcontext or NULL. + * \param streamId The stream ID. + * \param flag The flag can be set to indicate a forced flush. See CUpti_ActivityFlag + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_CUPTI_ERROR_INVALID_OPERATION if not preceded + * by a successful call to cuptiActivityRegisterCallbacks + * \retval CUPTI_ERROR_UNKNOWN an internal error occurred + * + * **DEPRECATED** This method is deprecated + * CONTEXT and STREAMID will be ignored. Use cuptiActivityFlushAll + * to flush all data. + */ +CUptiResult CUPTIAPI cuptiActivityFlush(CUcontext context, uint32_t streamId, uint32_t flag); + +/** + * \brief Request to deliver activity records via the buffer completion callback. + * + * This function returns the activity records associated with all contexts/streams + * (and the global buffers not associated with any stream) to the CUPTI client + * using the callback registered in cuptiActivityRegisterCallbacks. + * + * This is a blocking call but it doesn't issue any CUDA synchronization calls + * implicitly thus it's not guaranteed that all activities are completed on the + * underlying devices. Activity record is considered as completed if it has all + * the information filled up including the timestamps if any. It is the client's + * responsibility to issue necessary CUDA synchronization calls before calling + * this function if all activity records with complete information are expected + * to be delivered. + * + * Behavior of the function based on the input flag: + * (-) ::For default flush i.e. when flag is set as 0, it returns all the + * activity buffers which have all the activity records completed, buffers need not + * to be full though. It doesn't return buffers which have one or more incomplete + * records. Default flush can be done at a regular interval in a separate thread. + * (-) ::For forced flush i.e. when flag CUPTI_ACTIVITY_FLAG_FLUSH_FORCED is passed + * to the function, it returns all the activity buffers including the ones which have + * one or more incomplete activity records. It's suggested for clients to do the + * force flush before the termination of the profiling session to allow remaining + * buffers to be delivered. In general, it can be done in the at-exit handler. + * + * Before calling this function, the buffer handling callback api must be activated + * by calling cuptiActivityRegisterCallbacks. + * + * \param flag The flag can be set to indicate a forced flush. See CUpti_ActivityFlag + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_OPERATION if not preceded by a + * successful call to cuptiActivityRegisterCallbacks + * \retval CUPTI_ERROR_UNKNOWN an internal error occurred + * + * \see cuptiActivityFlushPeriod + */ +CUptiResult CUPTIAPI cuptiActivityFlushAll(uint32_t flag); + +/** + * \brief Read an activity API attribute. + * + * Read an activity API attribute and return it in \p *value. + * + * \param attr The attribute to read + * \param valueSize Size of buffer pointed by the value, and + * returns the number of bytes written to \p value + * \param value Returns the value of the attribute + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p valueSize or \p value is NULL, or + * if \p attr is not an activity attribute + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT Indicates that + * the \p value buffer is too small to hold the attribute value. + */ +CUptiResult CUPTIAPI cuptiActivityGetAttribute(CUpti_ActivityAttribute attr, + size_t *valueSize, void* value); + +/** + * \brief Write an activity API attribute. + * + * Write an activity API attribute. + * + * \param attr The attribute to write + * \param valueSize The size, in bytes, of the value + * \param value The attribute value to write + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p valueSize or \p value is NULL, or + * if \p attr is not an activity attribute + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT Indicates that + * the \p value buffer is too small to hold the attribute value. + */ +CUptiResult CUPTIAPI cuptiActivitySetAttribute(CUpti_ActivityAttribute attr, + size_t *valueSize, void* value); + + +/** + * \brief Set Unified Memory Counter configuration. + * + * \param config A pointer to \ref CUpti_ActivityUnifiedMemoryCounterConfig structures + * containing Unified Memory counter configuration. + * \param count Number of Unified Memory counter configuration structures + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p config is NULL or + * any parameter in the \p config structures is not a valid value + * \retval CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED One potential reason is that + * platform (OS/arch) does not support the unified memory counters + * \retval CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED_ON_DEVICE Indicates that the device + * does not support the unified memory counters + * \retval CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED_ON_NON_P2P_DEVICES Indicates that + * multi-GPU configuration without P2P support between any pair of devices + * does not support the unified memory counters + */ +CUptiResult CUPTIAPI cuptiActivityConfigureUnifiedMemoryCounter(CUpti_ActivityUnifiedMemoryCounterConfig *config, uint32_t count); + +/** + * \brief Get auto boost state + * + * The profiling results can be inconsistent in case auto boost is enabled. + * CUPTI tries to disable auto boost while profiling. It can fail to disable in + * cases where user does not have the permissions or CUDA_AUTO_BOOST env + * variable is set. The function can be used to query whether auto boost is + * enabled. + * + * \param context A valid CUcontext. + * \param state A pointer to \ref CUpti_ActivityAutoBoostState structure which + * contains the current state and the id of the process that has requested the + * current state + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p CUcontext or \p state is NULL + * \retval CUPTI_ERROR_NOT_SUPPORTED Indicates that the device does not support auto boost + * \retval CUPTI_ERROR_UNKNOWN an internal error occurred + */ +CUptiResult CUPTIAPI cuptiGetAutoBoostState(CUcontext context, CUpti_ActivityAutoBoostState *state); + +/** + * \brief Set PC sampling configuration. + * + * For Pascal and older GPU architectures this API must be called before enabling + * activity kind CUPTI_ACTIVITY_KIND_PC_SAMPLING. There is no such requirement + * for Volta and newer GPU architectures. + * + * For Volta and newer GPU architectures if this API is called in the middle of + * execution, PC sampling configuration will be updated for subsequent kernel launches. + * + * \param ctx The context + * \param config A pointer to \ref CUpti_ActivityPCSamplingConfig structure + * containing PC sampling configuration. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_OPERATION if this api is called while + * some valid event collection method is set. + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p config is NULL or + * any parameter in the \p config structures is not a valid value + * \retval CUPTI_ERROR_NOT_SUPPORTED Indicates that the system/device + * does not support the unified memory counters + */ +CUptiResult CUPTIAPI cuptiActivityConfigurePCSampling(CUcontext ctx, CUpti_ActivityPCSamplingConfig *config); + +/** + * \brief Returns the last error from a cupti call or callback + * + * Returns the last error that has been produced by any of the cupti api calls + * or the callback in the same host thread and resets it to CUPTI_SUCCESS. + */ +CUptiResult CUPTIAPI cuptiGetLastError(void); + +/** + * \brief Set the thread-id type + * + * CUPTI uses the method corresponding to set type to generate the thread-id. + * See enum \ref CUpti_ActivityThreadIdType for the list of methods. + * Activity records having thread-id field contain the same value. + * Thread id type must not be changed during the profiling session to + * avoid thread-id value mismatch across activity records. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_SUPPORTED if \p type is not supported on the platform + */ +CUptiResult CUPTIAPI cuptiSetThreadIdType(CUpti_ActivityThreadIdType type); + +/** + * \brief Get the thread-id type + * + * Returns the thread-id type used in CUPTI + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p type is NULL + */ +CUptiResult CUPTIAPI cuptiGetThreadIdType(CUpti_ActivityThreadIdType *type); + +/** +* \brief Check support for a compute capability +* +* This function is used to check the support for a device based on +* it's compute capability. It sets the \p support when the compute +* capability is supported by the current version of CUPTI, and clears +* it otherwise. This version of CUPTI might not support all GPUs sharing +* the same compute capability. It is suggested to use API \ref +* cuptiDeviceSupported which provides correct information. +* +* \param major The major revision number of the compute capability +* \param minor The minor revision number of the compute capability +* \param support Pointer to an integer to return the support status +* +* \retval CUPTI_SUCCESS +* \retval CUPTI_ERROR_INVALID_PARAMETER if \p support is NULL +* +* \sa ::cuptiDeviceSupported +*/ +CUptiResult CUPTIAPI cuptiComputeCapabilitySupported(int major, int minor, int *support); + +/** +* \brief Check support for a compute device +* +* This function is used to check the support for a compute device. +* It sets the \p support when the device is supported by the current +* version of CUPTI, and clears it otherwise. +* +* \param dev The device handle returned by CUDA Driver API cuDeviceGet +* \param support Pointer to an integer to return the support status +* +* \retval CUPTI_SUCCESS +* \retval CUPTI_ERROR_INVALID_PARAMETER if \p support is NULL +* \retval CUPTI_ERROR_INVALID_DEVICE if \p dev is not a valid device +* +* \sa ::cuptiComputeCapabilitySupported +*/ +CUptiResult CUPTIAPI cuptiDeviceSupported(CUdevice dev, int *support); + +/** + * This indicates the virtualization mode in which CUDA device is running + */ +typedef enum { + /** + * No virtualization mode is associated with the device + * i.e. it's a baremetal GPU + */ + CUPTI_DEVICE_VIRTUALIZATION_MODE_NONE = 0, + /** + * The device is associated with the pass-through GPU. + * In this mode, an entire physical GPU is directly assigned + * to one virtual machine (VM). + */ + CUPTI_DEVICE_VIRTUALIZATION_MODE_PASS_THROUGH = 1, + /** + * The device is associated with the virtual GPU (vGPU). + * In this mode multiple virtual machines (VMs) have simultaneous, + * direct access to a single physical GPU. + */ + CUPTI_DEVICE_VIRTUALIZATION_MODE_VIRTUAL_GPU = 2, + + CUPTI_DEVICE_VIRTUALIZATION_MODE_FORCE_INT = 0x7fffffff +} CUpti_DeviceVirtualizationMode; + +/** + * \brief Query the virtualization mode of the device + * + * This function is used to query the virtualization mode of the CUDA device. + * + * \param dev The device handle returned by CUDA Driver API cuDeviceGet + * \param mode Pointer to an CUpti_DeviceVirtualizationMode to return the virtualization mode + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_DEVICE if \p dev is not a valid device + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p mode is NULL + * + */ +CUptiResult CUPTIAPI cuptiDeviceVirtualizationMode(CUdevice dev, CUpti_DeviceVirtualizationMode *mode); + +/** + * \brief Detach CUPTI from the running process + * + * This API detaches the CUPTI from the running process. It destroys and cleans up all the + * resources associated with CUPTI in the current process. After CUPTI detaches from the process, + * the process will keep on running with no CUPTI attached to it. + * For safe operation of the API, it is recommended this API is invoked from the exit callsite + * of any of the CUDA Driver or Runtime API. Otherwise CUPTI client needs to make sure that + * required CUDA synchronization and CUPTI activity buffer flush is done before calling the API. + * Sample code showing the usage of the API in the cupti callback handler code: + * \code + void CUPTIAPI + cuptiCallbackHandler(void *userdata, CUpti_CallbackDomain domain, + CUpti_CallbackId cbid, void *cbdata) + { + const CUpti_CallbackData *cbInfo = (CUpti_CallbackData *)cbdata; + + // Take this code path when CUPTI detach is requested + if (detachCupti) { + switch(domain) + { + case CUPTI_CB_DOMAIN_RUNTIME_API: + case CUPTI_CB_DOMAIN_DRIVER_API: + if (cbInfo->callbackSite == CUPTI_API_EXIT) { + // call the CUPTI detach API + cuptiFinalize(); + } + break; + default: + break; + } + } + } + \endcode + */ +CUptiResult CUPTIAPI cuptiFinalize(void); + +/** + * \brief Push an external correlation id for the calling thread + * + * This function notifies CUPTI that the calling thread is entering an external API region. + * When a CUPTI activity API record is created while within an external API region and + * CUPTI_ACTIVITY_KIND_EXTERNAL_CORRELATION is enabled, the activity API record will + * be preceded by a CUpti_ActivityExternalCorrelation record for each \ref CUpti_ExternalCorrelationKind. + * + * \param kind The kind of external API activities should be correlated with. + * \param id External correlation id. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER The external API kind is invalid + */ +CUptiResult CUPTIAPI cuptiActivityPushExternalCorrelationId(CUpti_ExternalCorrelationKind kind, uint64_t id); + +/** + * \brief Pop an external correlation id for the calling thread + * + * This function notifies CUPTI that the calling thread is leaving an external API region. + * + * \param kind The kind of external API activities should be correlated with. + * \param lastId If the function returns successful, contains the last external correlation id for this \p kind, can be NULL. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER The external API kind is invalid. + * \retval CUPTI_ERROR_QUEUE_EMPTY No external id is currently associated with \p kind. + */ +CUptiResult CUPTIAPI cuptiActivityPopExternalCorrelationId(CUpti_ExternalCorrelationKind kind, uint64_t *lastId); + +/** + * \brief Controls the collection of queued and submitted timestamps for kernels. + * + * This API is used to control the collection of queued and submitted timestamps + * for kernels whose records are provided through the struct \ref CUpti_ActivityKernel9. + * Default value is 0, i.e. these timestamps are not collected. This API needs + * to be called before initialization of CUDA and this setting should not be + * changed during the profiling session. + * + * \param enable is a boolean, denoting whether these timestamps should be + * collected + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + */ +CUptiResult CUPTIAPI cuptiActivityEnableLatencyTimestamps(uint8_t enable); + +/** + * \brief Sets the flush period for the worker thread + * + * CUPTI creates a worker thread to minimize the perturbance for the application created + * threads. CUPTI offloads certain operations from the application threads to the worker + * thread, this includes synchronization of profiling resources between host and device, + * delivery of the activity buffers to the client using the callback registered in + * cuptiActivityRegisterCallbacks. For performance reasons, CUPTI wakes up the worker + * thread based on certain heuristics. + * + * This API is used to control the flush period of the worker thread. This setting will + * override the CUPTI heuristics. Setting time to zero disables the periodic flush and + * restores the default behavior. + * + * Periodic flush can return only those activity buffers which are full and have all the + * activity records completed. + * + * It's allowed to use the API \ref cuptiActivityFlushAll to flush the data on-demand, even + * when client sets the periodic flush. + * + * \param time flush period in milliseconds (ms) + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * + * \see cuptiActivityFlushAll + */ +CUptiResult CUPTIAPI cuptiActivityFlushPeriod(uint32_t time); + +/** + * \brief Controls the collection of launch attributes for kernels. + * + * This API is used to control the collection of launch attributes for kernels whose + * records are provided through the struct \ref CUpti_ActivityKernel9. + * Default value is 0, i.e. these attributes are not collected. + * + * \param enable is a boolean denoting whether these launch attributes should be collected + */ +CUptiResult CUPTIAPI cuptiActivityEnableLaunchAttributes(uint8_t enable); + +/** + * \brief Function type for callback used by CUPTI to request a timestamp + * to be used in activity records. + * + * This callback function signals the CUPTI client that a timestamp needs + * to be returned. This timestamp would be treated as normalized timestamp + * to be used for various purposes in CUPTI. For example to store start and + * end timestamps reported in the CUPTI activity records. + * The returned timestamp must be in nanoseconds. + * + * \sa ::cuptiActivityRegisterTimestampCallback + */ +typedef uint64_t (CUPTIAPI *CUpti_TimestampCallbackFunc)(void); + +/** + * \brief Registers callback function with CUPTI for providing timestamp. + * + * This function registers a callback function to obtain timestamp of user's + * choice instead of using CUPTI provided timestamp. + * By default CUPTI uses different methods, based on the underlying platform, + * to retrieve the timestamp + * Linux and Android use clock_gettime(CLOCK_REALTIME, ..) + * Windows uses QueryPerformanceCounter() + * Mac uses mach_absolute_time() + * QNX uses ClockCycles() + * Timestamps retrieved using these methods are converted to nanosecond if needed + * before usage. + * + * The registration of timestamp callback should be done before any of the CUPTI + * activity kinds are enabled to make sure that all the records report the timestamp using + * the callback function registered through cuptiActivityRegisterTimestampCallback API. + * + * Changing the timestamp callback function in CUPTI through + * cuptiActivityRegisterTimestampCallback API in the middle of the profiling + * session can cause records generated prior to the change to report + * timestamps through previous timestamp method. + * + * \param funcTimestamp callback which is invoked when a timestamp is + * needed by CUPTI + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p funcTimestamp is NULL + * \retval CUPTI_ERROR_NOT_INITIALIZED + */ +CUptiResult CUPTIAPI cuptiActivityRegisterTimestampCallback(CUpti_TimestampCallbackFunc funcTimestamp); + +/** + * \brief Controls the collection of records for device launched graphs. + * + * This API is used to control the collection of records for device launched graphs. + * Default value is 0, i.e. these records are not collected. This API needs + * to be called before initialization of CUDA and this setting should not be + * changed during the profiling session. + * + * \param enable is a boolean, denoting whether these records should be + * collected + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + */ +CUptiResult CUPTIAPI cuptiActivityEnableDeviceGraph(uint8_t enable); + +/** @} */ /* END CUPTI_ACTIVITY_API */ + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#if defined(__cplusplus) +} +#endif + +// Including deprecated structures of CUPTI_ACTIVITY_API +#include "cupti_activity_deprecated.h" + +#endif /*_CUPTI_ACTIVITY_H_*/ diff --git a/cuda_toolkit/include/cupti_activity_deprecated.h b/cuda_toolkit/include/cupti_activity_deprecated.h new file mode 100644 index 0000000000000000000000000000000000000000..0dd78c23e6fdbc26ecc7781a061a13ce5104f854 --- /dev/null +++ b/cuda_toolkit/include/cupti_activity_deprecated.h @@ -0,0 +1,4784 @@ +/* + * Copyright 2011-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(_CUPTI_ACTIVITY_DEPRECATED_H_) +#define _CUPTI_ACTIVITY_DEPRECATED_H_ + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +/** + * \brief The kinds of activity records. + * + * Each activity record kind represents information about a GPU or an + * activity occurring on a CPU or GPU. Each kind is associated with a + * activity record structure that holds the information associated + * with the kind. + * \see CUpti_ActivityOverhead + * \see CUpti_ActivityOverhead2 + * \see CUpti_ActivityDevice + * \see CUpti_ActivityDevice2 + * \see CUpti_ActivityDevice3 + * \see CUpti_ActivityDevice4 + * \see CUpti_ActivityKernel + * \see CUpti_ActivityKernel2 + * \see CUpti_ActivityKernel3 + * \see CUpti_ActivityKernel4 + * \see CUpti_ActivityKernel5 + * \see CUpti_ActivityKernel6 + * \see CUpti_ActivityKernel7 + * \see CUpti_ActivityKernel8 + * \see CUpti_ActivityMemcpy + * \see CUpti_ActivityMemcpy3 + * \see CUpti_ActivityMemcpy4 + * \see CUpti_ActivityMemcpyPtoP + * \see CUpti_ActivityMemcpyPtoP2 + * \see CUpti_ActivityMemcpyPtoP3 + * \see CUpti_ActivityMemset + * \see CUpti_ActivityMemset2 + * \see CUpti_ActivityMemset3 + * \see CUpti_ActivityMemory2 + * \see CUpti_ActivityMemoryPool + * \see CUpti_ActivityMarker + * \see CUpti_ActivityGlobalAccess + * \see CUpti_ActivityGlobalAccess2 + * \see CUpti_ActivityBranch + * \see CUpti_ActivityPCSampling + * \see CUpti_ActivityPCSampling2 + * \see CUpti_ActivityUnifiedMemoryCounter + * \see CUpti_ActivityNvLink + * \see CUpti_ActivityNvLink2 + * \see CUpti_ActivityNvLink3 + */ + +/** + * \brief The activity record for CUPTI and driver overheads. + * (Deprecated in CUDA 12.2) + * + * This activity record provides CUPTI and driver overhead information + * (CUPTI_ACTIVITY_OVERHEAD). These records are now reported using + * CUpti_ActivityOverhead3 + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_OVERHEAD. + */ + CUpti_ActivityKind kind; + + /** + * The kind of overhead, CUPTI, DRIVER, COMPILER etc. + */ + CUpti_ActivityOverheadKind overheadKind; + + /** + * The kind of activity object that the overhead is associated with. + */ + CUpti_ActivityObjectKind objectKind; + + /** + * The identifier for the activity object. 'objectKind' indicates + * which ID is valid for this record. + */ + CUpti_ActivityObjectKindId objectId; + + /** + * The start timestamp for the overhead, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the overhead. + */ + uint64_t start; + + /** + * The end timestamp for the overhead, in ns. A value of 0 for both + * the start and end timestamps indicates that timestamp information + * could not be collected for the overhead. + */ + uint64_t end; +} CUpti_ActivityOverhead; + +/** + * \brief The activity record for CUPTI and driver overheads. + * + * This activity record provides CUPTI and driver overhead information + * (CUPTI_ACTIVITY_OVERHEAD). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_OVERHEAD. + */ + CUpti_ActivityKind kind; + + /** + * The kind of overhead, CUPTI, DRIVER, COMPILER etc. + */ + CUpti_ActivityOverheadKind overheadKind; + + /** + * The kind of activity object that the overhead is associated with. + */ + CUpti_ActivityObjectKind objectKind; + + /** + * The identifier for the activity object. 'objectKind' indicates + * which ID is valid for this record. + */ + CUpti_ActivityObjectKindId objectId; + + /** + * The start timestamp for the overhead, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the overhead. + */ + uint64_t start; + + /** + * The end timestamp for the overhead, in ns. A value of 0 for both + * the start and end timestamps indicates that timestamp information + * could not be collected for the overhead. + */ + uint64_t end; + + /** + * The correlation ID of the overhead operation to which + * records belong to. This ID is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the overhead operation. + * In some cases, it can be zero, such as for CUPTI_ACTIVITY_OVERHEAD_CUPTI_BUFFER_FLUSH records. + */ + uint32_t correlationId; + + /** + * Reserved for internal use. + */ + uint32_t reserved0; +} CUpti_ActivityOverhead2; + +/** + * \brief The activity record for a device. (deprecated) + * + * This activity record represents information about a GPU device + * (CUPTI_ACTIVITY_KIND_DEVICE). + * Device activity is now reported using the + * CUpti_ActivityDevice5 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_DEVICE. + */ + CUpti_ActivityKind kind; + + /** + * The flags associated with the device. \see CUpti_ActivityFlag + */ + CUpti_ActivityFlag flags; + + /** + * The global memory bandwidth available on the device, in + * kBytes/sec. + */ + uint64_t globalMemoryBandwidth; + + /** + * The amount of global memory on the device, in bytes. + */ + uint64_t globalMemorySize; + + /** + * The amount of constant memory on the device, in bytes. + */ + uint32_t constantMemorySize; + + /** + * The size of the L2 cache on the device, in bytes. + */ + uint32_t l2CacheSize; + + /** + * The number of threads per warp on the device. + */ + uint32_t numThreadsPerWarp; + + /** + * The core clock rate of the device, in kHz. + */ + uint32_t coreClockRate; + + /** + * Number of memory copy engines on the device. + */ + uint32_t numMemcpyEngines; + + /** + * Number of multiprocessors on the device. + */ + uint32_t numMultiprocessors; + + /** + * The maximum "instructions per cycle" possible on each device + * multiprocessor. + */ + uint32_t maxIPC; + + /** + * Maximum number of warps that can be present on a multiprocessor + * at any given time. + */ + uint32_t maxWarpsPerMultiprocessor; + + /** + * Maximum number of blocks that can be present on a multiprocessor + * at any given time. + */ + uint32_t maxBlocksPerMultiprocessor; + + /** + * Maximum number of registers that can be allocated to a block. + */ + uint32_t maxRegistersPerBlock; + + /** + * Maximum amount of shared memory that can be assigned to a block, + * in bytes. + */ + uint32_t maxSharedMemoryPerBlock; + + /** + * Maximum number of threads allowed in a block. + */ + uint32_t maxThreadsPerBlock; + + /** + * Maximum allowed X dimension for a block. + */ + uint32_t maxBlockDimX; + + /** + * Maximum allowed Y dimension for a block. + */ + uint32_t maxBlockDimY; + + /** + * Maximum allowed Z dimension for a block. + */ + uint32_t maxBlockDimZ; + + /** + * Maximum allowed X dimension for a grid. + */ + uint32_t maxGridDimX; + + /** + * Maximum allowed Y dimension for a grid. + */ + uint32_t maxGridDimY; + + /** + * Maximum allowed Z dimension for a grid. + */ + uint32_t maxGridDimZ; + + /** + * Compute capability for the device, major number. + */ + uint32_t computeCapabilityMajor; + + /** + * Compute capability for the device, minor number. + */ + uint32_t computeCapabilityMinor; + + /** + * The device ID. + */ + uint32_t id; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The device name. This name is shared across all activity records + * representing instances of the device, and so should not be + * modified. + */ + const char *name; +} CUpti_ActivityDevice; + +/** + * \brief The activity record for a device. (deprecated) + * + * This activity record represents information about a GPU device + * (CUPTI_ACTIVITY_KIND_DEVICE). + * Device activity is now reported using the + * CUpti_ActivityDevice5 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_DEVICE. + */ + CUpti_ActivityKind kind; + + /** + * The flags associated with the device. \see CUpti_ActivityFlag + */ + CUpti_ActivityFlag flags; + + /** + * The global memory bandwidth available on the device, in + * kBytes/sec. + */ + uint64_t globalMemoryBandwidth; + + /** + * The amount of global memory on the device, in bytes. + */ + uint64_t globalMemorySize; + + /** + * The amount of constant memory on the device, in bytes. + */ + uint32_t constantMemorySize; + + /** + * The size of the L2 cache on the device, in bytes. + */ + uint32_t l2CacheSize; + + /** + * The number of threads per warp on the device. + */ + uint32_t numThreadsPerWarp; + + /** + * The core clock rate of the device, in kHz. + */ + uint32_t coreClockRate; + + /** + * Number of memory copy engines on the device. + */ + uint32_t numMemcpyEngines; + + /** + * Number of multiprocessors on the device. + */ + uint32_t numMultiprocessors; + + /** + * The maximum "instructions per cycle" possible on each device + * multiprocessor. + */ + uint32_t maxIPC; + + /** + * Maximum number of warps that can be present on a multiprocessor + * at any given time. + */ + uint32_t maxWarpsPerMultiprocessor; + + /** + * Maximum number of blocks that can be present on a multiprocessor + * at any given time. + */ + uint32_t maxBlocksPerMultiprocessor; + + /** + * Maximum amount of shared memory available per multiprocessor, in bytes. + */ + uint32_t maxSharedMemoryPerMultiprocessor; + + /** + * Maximum number of 32-bit registers available per multiprocessor. + */ + uint32_t maxRegistersPerMultiprocessor; + + /** + * Maximum number of registers that can be allocated to a block. + */ + uint32_t maxRegistersPerBlock; + + /** + * Maximum amount of shared memory that can be assigned to a block, + * in bytes. + */ + uint32_t maxSharedMemoryPerBlock; + + /** + * Maximum number of threads allowed in a block. + */ + uint32_t maxThreadsPerBlock; + + /** + * Maximum allowed X dimension for a block. + */ + uint32_t maxBlockDimX; + + /** + * Maximum allowed Y dimension for a block. + */ + uint32_t maxBlockDimY; + + /** + * Maximum allowed Z dimension for a block. + */ + uint32_t maxBlockDimZ; + + /** + * Maximum allowed X dimension for a grid. + */ + uint32_t maxGridDimX; + + /** + * Maximum allowed Y dimension for a grid. + */ + uint32_t maxGridDimY; + + /** + * Maximum allowed Z dimension for a grid. + */ + uint32_t maxGridDimZ; + + /** + * Compute capability for the device, major number. + */ + uint32_t computeCapabilityMajor; + + /** + * Compute capability for the device, minor number. + */ + uint32_t computeCapabilityMinor; + + /** + * The device ID. + */ + uint32_t id; + + /** + * ECC enabled flag for device + */ + uint32_t eccEnabled; + + /** + * The device UUID. This value is the globally unique immutable + * alphanumeric identifier of the device. + */ + CUuuid uuid; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The device name. This name is shared across all activity records + * representing instances of the device, and so should not be + * modified. + */ + const char *name; +} CUpti_ActivityDevice2; + +/** + * \brief The activity record for a device. (CUDA 7.0 onwards) + * + * This activity record represents information about a GPU device + * (CUPTI_ACTIVITY_KIND_DEVICE). + * Device activity is now reported using the + * CUpti_ActivityDevice5 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_DEVICE. + */ + CUpti_ActivityKind kind; + + /** + * The flags associated with the device. \see CUpti_ActivityFlag + */ + CUpti_ActivityFlag flags; + + /** + * The global memory bandwidth available on the device, in + * kBytes/sec. + */ + uint64_t globalMemoryBandwidth; + + /** + * The amount of global memory on the device, in bytes. + */ + uint64_t globalMemorySize; + + /** + * The amount of constant memory on the device, in bytes. + */ + uint32_t constantMemorySize; + + /** + * The size of the L2 cache on the device, in bytes. + */ + uint32_t l2CacheSize; + + /** + * The number of threads per warp on the device. + */ + uint32_t numThreadsPerWarp; + + /** + * The core clock rate of the device, in kHz. + */ + uint32_t coreClockRate; + + /** + * Number of memory copy engines on the device. + */ + uint32_t numMemcpyEngines; + + /** + * Number of multiprocessors on the device. + */ + uint32_t numMultiprocessors; + + /** + * The maximum "instructions per cycle" possible on each device + * multiprocessor. + */ + uint32_t maxIPC; + + /** + * Maximum number of warps that can be present on a multiprocessor + * at any given time. + */ + uint32_t maxWarpsPerMultiprocessor; + + /** + * Maximum number of blocks that can be present on a multiprocessor + * at any given time. + */ + uint32_t maxBlocksPerMultiprocessor; + + /** + * Maximum amount of shared memory available per multiprocessor, in bytes. + */ + uint32_t maxSharedMemoryPerMultiprocessor; + + /** + * Maximum number of 32-bit registers available per multiprocessor. + */ + uint32_t maxRegistersPerMultiprocessor; + + /** + * Maximum number of registers that can be allocated to a block. + */ + uint32_t maxRegistersPerBlock; + + /** + * Maximum amount of shared memory that can be assigned to a block, + * in bytes. + */ + uint32_t maxSharedMemoryPerBlock; + + /** + * Maximum number of threads allowed in a block. + */ + uint32_t maxThreadsPerBlock; + + /** + * Maximum allowed X dimension for a block. + */ + uint32_t maxBlockDimX; + + /** + * Maximum allowed Y dimension for a block. + */ + uint32_t maxBlockDimY; + + /** + * Maximum allowed Z dimension for a block. + */ + uint32_t maxBlockDimZ; + + /** + * Maximum allowed X dimension for a grid. + */ + uint32_t maxGridDimX; + + /** + * Maximum allowed Y dimension for a grid. + */ + uint32_t maxGridDimY; + + /** + * Maximum allowed Z dimension for a grid. + */ + uint32_t maxGridDimZ; + + /** + * Compute capability for the device, major number. + */ + uint32_t computeCapabilityMajor; + + /** + * Compute capability for the device, minor number. + */ + uint32_t computeCapabilityMinor; + + /** + * The device ID. + */ + uint32_t id; + + /** + * ECC enabled flag for device + */ + uint32_t eccEnabled; + + /** + * The device UUID. This value is the globally unique immutable + * alphanumeric identifier of the device. + */ + CUuuid uuid; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The device name. This name is shared across all activity records + * representing instances of the device, and so should not be + * modified. + */ + const char *name; + + /** + * Flag to indicate whether the device is visible to CUDA. Users can + * set the device visibility using CUDA_VISIBLE_DEVICES environment + */ + uint8_t isCudaVisible; + + uint8_t reserved[7]; +} CUpti_ActivityDevice3; + +/** + * \brief The activity record for a device. (CUDA 11.6 onwards) + * + * This activity record represents information about a GPU device + * (CUPTI_ACTIVITY_KIND_DEVICE). + * Device activity is now reported using the + * CUpti_ActivityDevice5 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_DEVICE. + */ + CUpti_ActivityKind kind; + + /** + * The flags associated with the device. \see CUpti_ActivityFlag + */ + CUpti_ActivityFlag flags; + + /** + * The global memory bandwidth available on the device, in + * kBytes/sec. + */ + uint64_t globalMemoryBandwidth; + + /** + * The amount of global memory on the device, in bytes. + */ + uint64_t globalMemorySize; + + /** + * The amount of constant memory on the device, in bytes. + */ + uint32_t constantMemorySize; + + /** + * The size of the L2 cache on the device, in bytes. + */ + uint32_t l2CacheSize; + + /** + * The number of threads per warp on the device. + */ + uint32_t numThreadsPerWarp; + + /** + * The core clock rate of the device, in kHz. + */ + uint32_t coreClockRate; + + /** + * Number of memory copy engines on the device. + */ + uint32_t numMemcpyEngines; + + /** + * Number of multiprocessors on the device. + */ + uint32_t numMultiprocessors; + + /** + * The maximum "instructions per cycle" possible on each device + * multiprocessor. + */ + uint32_t maxIPC; + + /** + * Maximum number of warps that can be present on a multiprocessor + * at any given time. + */ + uint32_t maxWarpsPerMultiprocessor; + + /** + * Maximum number of blocks that can be present on a multiprocessor + * at any given time. + */ + uint32_t maxBlocksPerMultiprocessor; + + /** + * Maximum amount of shared memory available per multiprocessor, in bytes. + */ + uint32_t maxSharedMemoryPerMultiprocessor; + + /** + * Maximum number of 32-bit registers available per multiprocessor. + */ + uint32_t maxRegistersPerMultiprocessor; + + /** + * Maximum number of registers that can be allocated to a block. + */ + uint32_t maxRegistersPerBlock; + + /** + * Maximum amount of shared memory that can be assigned to a block, + * in bytes. + */ + uint32_t maxSharedMemoryPerBlock; + + /** + * Maximum number of threads allowed in a block. + */ + uint32_t maxThreadsPerBlock; + + /** + * Maximum allowed X dimension for a block. + */ + uint32_t maxBlockDimX; + + /** + * Maximum allowed Y dimension for a block. + */ + uint32_t maxBlockDimY; + + /** + * Maximum allowed Z dimension for a block. + */ + uint32_t maxBlockDimZ; + + /** + * Maximum allowed X dimension for a grid. + */ + uint32_t maxGridDimX; + + /** + * Maximum allowed Y dimension for a grid. + */ + uint32_t maxGridDimY; + + /** + * Maximum allowed Z dimension for a grid. + */ + uint32_t maxGridDimZ; + + /** + * Compute capability for the device, major number. + */ + uint32_t computeCapabilityMajor; + + /** + * Compute capability for the device, minor number. + */ + uint32_t computeCapabilityMinor; + + /** + * The device ID. + */ + uint32_t id; + + /** + * ECC enabled flag for device + */ + uint32_t eccEnabled; + + /** + * The device UUID. This value is the globally unique immutable + * alphanumeric identifier of the device. + */ + CUuuid uuid; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The device name. This name is shared across all activity records + * representing instances of the device, and so should not be + * modified. + */ + const char *name; + + /** + * Flag to indicate whether the device is visible to CUDA. Users can + * set the device visibility using CUDA_VISIBLE_DEVICES environment + */ + uint8_t isCudaVisible; + + /** + * MIG enabled flag for device + */ + uint8_t isMigEnabled; + + uint8_t reserved[6]; + + /** + * GPU Instance id for MIG enabled devices. + * If mig mode is disabled value is set to UINT32_MAX + */ + uint32_t gpuInstanceId; + + /** + * Compute Instance id for MIG enabled devices. + * If mig mode is disabled value is set to UINT32_MAX + */ + uint32_t computeInstanceId; + + /** + * The MIG UUID. This value is the globally unique immutable + * alphanumeric identifier of the device. + */ + CUuuid migUuid; + +} CUpti_ActivityDevice4; + +/** + * \brief The activity record for kernel. (deprecated) + * + * This activity record represents a kernel execution + * (CUPTI_ACTIVITY_KIND_KERNEL and + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL) but is no longer generated + * by CUPTI. Kernel activities are now reported using the + * CUpti_ActivityKernel9 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_KERNEL + * or CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL. + */ + CUpti_ActivityKind kind; + + /** + * The cache configuration requested by the kernel. The value is one + * of the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t cacheConfigRequested; + + /** + * The cache configuration used for the kernel. The value is one of + * the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t cacheConfigExecuted; + + /** + * The number of registers required for each thread executing the + * kernel. + */ + uint16_t registersPerThread; + + /** + * The start timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t start; + + /** + * The end timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t end; + + /** + * The ID of the device where the kernel is executing. + */ + uint32_t deviceId; + + /** + * The ID of the context where the kernel is executing. + */ + uint32_t contextId; + + /** + * The ID of the stream where the kernel is executing. + */ + uint32_t streamId; + + /** + * The X-dimension grid size for the kernel. + */ + int32_t gridX; + + /** + * The Y-dimension grid size for the kernel. + */ + int32_t gridY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t gridZ; + + /** + * The X-dimension block size for the kernel. + */ + int32_t blockX; + + /** + * The Y-dimension block size for the kernel. + */ + int32_t blockY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t blockZ; + + /** + * The static shared memory allocated for the kernel, in bytes. + */ + int32_t staticSharedMemory; + + /** + * The dynamic shared memory reserved for the kernel, in bytes. + */ + int32_t dynamicSharedMemory; + + /** + * The amount of local memory reserved for each thread, in bytes. + */ + uint32_t localMemoryPerThread; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes. + */ + uint32_t localMemoryTotal; + + /** + * The correlation ID of the kernel. Each kernel execution is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver API activity record that launched + * the kernel. + */ + uint32_t correlationId; + + /** + * The runtime correlation ID of the kernel. Each kernel execution + * is assigned a unique runtime correlation ID that is identical to + * the correlation ID in the runtime API activity record that + * launched the kernel. + */ + uint32_t runtimeCorrelationId; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; + + /** + * The name of the kernel. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; +} CUpti_ActivityKernel; + +/** + * \brief The activity record for kernel. (deprecated) + * + * This activity record represents a kernel execution + * (CUPTI_ACTIVITY_KIND_KERNEL and + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL) but is no longer generated + * by CUPTI. Kernel activities are now reported using the + * CUpti_ActivityKernel9 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_KERNEL or + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL. + */ + CUpti_ActivityKind kind; + + union { + uint8_t both; + struct { + /** + * The cache configuration requested by the kernel. The value is one + * of the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t requested:4; + + /** + * The cache configuration used for the kernel. The value is one of + * the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t executed:4; + } config; + } cacheConfig; + + /** + * The shared memory configuration used for the kernel. The value is one of + * the CUsharedconfig enumeration values from cuda.h. + */ + uint8_t sharedMemoryConfig; + + /** + * The number of registers required for each thread executing the + * kernel. + */ + uint16_t registersPerThread; + + /** + * The start timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t start; + + /** + * The end timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t end; + + /** + * The completed timestamp for the kernel execution, in ns. It + * represents the completion of all it's child kernels and the + * kernel itself. A value of CUPTI_TIMESTAMP_UNKNOWN indicates that + * the completion time is unknown. + */ + uint64_t completed; + + /** + * The ID of the device where the kernel is executing. + */ + uint32_t deviceId; + + /** + * The ID of the context where the kernel is executing. + */ + uint32_t contextId; + + /** + * The ID of the stream where the kernel is executing. + */ + uint32_t streamId; + + /** + * The X-dimension grid size for the kernel. + */ + int32_t gridX; + + /** + * The Y-dimension grid size for the kernel. + */ + int32_t gridY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t gridZ; + + /** + * The X-dimension block size for the kernel. + */ + int32_t blockX; + + /** + * The Y-dimension block size for the kernel. + */ + int32_t blockY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t blockZ; + + /** + * The static shared memory allocated for the kernel, in bytes. + */ + int32_t staticSharedMemory; + + /** + * The dynamic shared memory reserved for the kernel, in bytes. + */ + int32_t dynamicSharedMemory; + + /** + * The amount of local memory reserved for each thread, in bytes. + */ + uint32_t localMemoryPerThread; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes. + */ + uint32_t localMemoryTotal; + + /** + * The correlation ID of the kernel. Each kernel execution is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the kernel. + */ + uint32_t correlationId; + + /** + * The grid ID of the kernel. Each kernel is assigned a unique + * grid ID at runtime. + */ + int64_t gridId; + + /** + * The name of the kernel. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; +} CUpti_ActivityKernel2; + +/** + * \brief The activity record for a kernel (CUDA 6.5(with sm_52 support) onwards). + * (deprecated in CUDA 9.0) + * + * This activity record represents a kernel execution + * (CUPTI_ACTIVITY_KIND_KERNEL and + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL). + * Kernel activities are now reported using the CUpti_ActivityKernel9 activity + * record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_KERNEL or + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL. + */ + CUpti_ActivityKind kind; + + union { + uint8_t both; + struct { + /** + * The cache configuration requested by the kernel. The value is one + * of the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t requested:4; + + /** + * The cache configuration used for the kernel. The value is one of + * the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t executed:4; + } config; + } cacheConfig; + + /** + * The shared memory configuration used for the kernel. The value is one of + * the CUsharedconfig enumeration values from cuda.h. + */ + uint8_t sharedMemoryConfig; + + /** + * The number of registers required for each thread executing the + * kernel. + */ + uint16_t registersPerThread; + + /** + * The partitioned global caching requested for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheRequested; + + /** + * The partitioned global caching executed for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. Partitioned global caching can be + * automatically disabled if the occupancy requirement of the launch cannot + * support caching. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheExecuted; + + /** + * The start timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t start; + + /** + * The end timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t end; + + /** + * The completed timestamp for the kernel execution, in ns. It + * represents the completion of all it's child kernels and the + * kernel itself. A value of CUPTI_TIMESTAMP_UNKNOWN indicates that + * the completion time is unknown. + */ + uint64_t completed; + + /** + * The ID of the device where the kernel is executing. + */ + uint32_t deviceId; + + /** + * The ID of the context where the kernel is executing. + */ + uint32_t contextId; + + /** + * The ID of the stream where the kernel is executing. + */ + uint32_t streamId; + + /** + * The X-dimension grid size for the kernel. + */ + int32_t gridX; + + /** + * The Y-dimension grid size for the kernel. + */ + int32_t gridY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t gridZ; + + /** + * The X-dimension block size for the kernel. + */ + int32_t blockX; + + /** + * The Y-dimension block size for the kernel. + */ + int32_t blockY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t blockZ; + + /** + * The static shared memory allocated for the kernel, in bytes. + */ + int32_t staticSharedMemory; + + /** + * The dynamic shared memory reserved for the kernel, in bytes. + */ + int32_t dynamicSharedMemory; + + /** + * The amount of local memory reserved for each thread, in bytes. + */ + uint32_t localMemoryPerThread; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes. + */ + uint32_t localMemoryTotal; + + /** + * The correlation ID of the kernel. Each kernel execution is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the kernel. + */ + uint32_t correlationId; + + /** + * The grid ID of the kernel. Each kernel is assigned a unique + * grid ID at runtime. + */ + int64_t gridId; + + /** + * The name of the kernel. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; +} CUpti_ActivityKernel3; + +/** + * \brief The activity record for a kernel (CUDA 9.0(with sm_70 support) onwards). + * (deprecated in CUDA 11.0) + * + * This activity record represents a kernel execution + * (CUPTI_ACTIVITY_KIND_KERNEL and + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL). + * Kernel activities are now reported using the CUpti_ActivityKernel9 activity + * record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_KERNEL or + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL. + */ + CUpti_ActivityKind kind; + + /** + * For devices with compute capability 7.0+ cacheConfig values are not updated + * in case field isSharedMemoryCarveoutRequested is set + */ + union { + uint8_t both; + struct { + /** + * The cache configuration requested by the kernel. The value is one + * of the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t requested:4; + + /** + * The cache configuration used for the kernel. The value is one of + * the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t executed:4; + } config; + } cacheConfig; + + /** + * The shared memory configuration used for the kernel. The value is one of + * the CUsharedconfig enumeration values from cuda.h. + */ + uint8_t sharedMemoryConfig; + + /** + * The number of registers required for each thread executing the + * kernel. + */ + uint16_t registersPerThread; + + /** + * The partitioned global caching requested for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheRequested; + + /** + * The partitioned global caching executed for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. Partitioned global caching can be + * automatically disabled if the occupancy requirement of the launch cannot + * support caching. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheExecuted; + + /** + * The start timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t start; + + /** + * The end timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t end; + + /** + * The completed timestamp for the kernel execution, in ns. It + * represents the completion of all it's child kernels and the + * kernel itself. A value of CUPTI_TIMESTAMP_UNKNOWN indicates that + * the completion time is unknown. + */ + uint64_t completed; + + /** + * The ID of the device where the kernel is executing. + */ + uint32_t deviceId; + + /** + * The ID of the context where the kernel is executing. + */ + uint32_t contextId; + + /** + * The ID of the stream where the kernel is executing. + */ + uint32_t streamId; + + /** + * The X-dimension grid size for the kernel. + */ + int32_t gridX; + + /** + * The Y-dimension grid size for the kernel. + */ + int32_t gridY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t gridZ; + + /** + * The X-dimension block size for the kernel. + */ + int32_t blockX; + + /** + * The Y-dimension block size for the kernel. + */ + int32_t blockY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t blockZ; + + /** + * The static shared memory allocated for the kernel, in bytes. + */ + int32_t staticSharedMemory; + + /** + * The dynamic shared memory reserved for the kernel, in bytes. + */ + int32_t dynamicSharedMemory; + + /** + * The amount of local memory reserved for each thread, in bytes. + */ + uint32_t localMemoryPerThread; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes. + */ + uint32_t localMemoryTotal; + + /** + * The correlation ID of the kernel. Each kernel execution is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the kernel. + */ + uint32_t correlationId; + + /** + * The grid ID of the kernel. Each kernel is assigned a unique + * grid ID at runtime. + */ + int64_t gridId; + + /** + * The name of the kernel. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The timestamp when the kernel is queued up in the command buffer, in ns. + * A value of CUPTI_TIMESTAMP_UNKNOWN indicates that the queued time + * could not be collected for the kernel. This timestamp is not collected + * by default. Use API \ref cuptiActivityEnableLatencyTimestamps() to + * enable collection. + * + * Command buffer is a buffer written by CUDA driver to send commands + * like kernel launch, memory copy etc to the GPU. All launches of CUDA + * kernels are asynchronous with respect to the host, the host requests + * the launch by writing commands into the command buffer, then returns + * without checking the GPU's progress. + */ + uint64_t queued; + + /** + * The timestamp when the command buffer containing the kernel launch + * is submitted to the GPU, in ns. A value of CUPTI_TIMESTAMP_UNKNOWN + * indicates that the submitted time could not be collected for the kernel. + * This timestamp is not collected by default. Use API \ref + * cuptiActivityEnableLatencyTimestamps() to enable collection. + */ + uint64_t submitted; + + /** + * The indicates if the kernel was executed via a regular launch or via a + * single/multi device cooperative launch. \see CUpti_ActivityLaunchType + */ + uint8_t launchType; + + /** + * This indicates if CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT was + * updated for the kernel launch + */ + uint8_t isSharedMemoryCarveoutRequested; + + /** + * Shared memory carveout value requested for the function in percentage of + * the total resource. The value will be updated only if field + * isSharedMemoryCarveoutRequested is set. + */ + uint8_t sharedMemoryCarveoutRequested; + + /** + * Undefined. Reserved for internal use. + */ + uint8_t padding; + + /** + * Shared memory size set by the driver. + */ + uint32_t sharedMemoryExecuted; +} CUpti_ActivityKernel4; + +/** + * \brief The activity record for a kernel (CUDA 11.0(with sm_80 support) onwards). + * (deprecated in CUDA 11.2) + * This activity record represents a kernel execution + * (CUPTI_ACTIVITY_KIND_KERNEL and + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL) but is no longer generated + * by CUPTI. Kernel activities are now reported using the + * CUpti_ActivityKernel9 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_KERNEL or + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL. + */ + CUpti_ActivityKind kind; + + /** + * For devices with compute capability 7.0+ cacheConfig values are not updated + * in case field isSharedMemoryCarveoutRequested is set + */ + union { + uint8_t both; + struct { + /** + * The cache configuration requested by the kernel. The value is one + * of the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t requested:4; + + /** + * The cache configuration used for the kernel. The value is one of + * the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t executed:4; + } config; + } cacheConfig; + + /** + * The shared memory configuration used for the kernel. The value is one of + * the CUsharedconfig enumeration values from cuda.h. + */ + uint8_t sharedMemoryConfig; + + /** + * The number of registers required for each thread executing the + * kernel. + */ + uint16_t registersPerThread; + + /** + * The partitioned global caching requested for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheRequested; + + /** + * The partitioned global caching executed for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. Partitioned global caching can be + * automatically disabled if the occupancy requirement of the launch cannot + * support caching. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheExecuted; + + /** + * The start timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t start; + + /** + * The end timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t end; + + /** + * The completed timestamp for the kernel execution, in ns. It + * represents the completion of all it's child kernels and the + * kernel itself. A value of CUPTI_TIMESTAMP_UNKNOWN indicates that + * the completion time is unknown. + */ + uint64_t completed; + + /** + * The ID of the device where the kernel is executing. + */ + uint32_t deviceId; + + /** + * The ID of the context where the kernel is executing. + */ + uint32_t contextId; + + /** + * The ID of the stream where the kernel is executing. + */ + uint32_t streamId; + + /** + * The X-dimension grid size for the kernel. + */ + int32_t gridX; + + /** + * The Y-dimension grid size for the kernel. + */ + int32_t gridY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t gridZ; + + /** + * The X-dimension block size for the kernel. + */ + int32_t blockX; + + /** + * The Y-dimension block size for the kernel. + */ + int32_t blockY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t blockZ; + + /** + * The static shared memory allocated for the kernel, in bytes. + */ + int32_t staticSharedMemory; + + /** + * The dynamic shared memory reserved for the kernel, in bytes. + */ + int32_t dynamicSharedMemory; + + /** + * The amount of local memory reserved for each thread, in bytes. + */ + uint32_t localMemoryPerThread; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes. + */ + uint32_t localMemoryTotal; + + /** + * The correlation ID of the kernel. Each kernel execution is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the kernel. + */ + uint32_t correlationId; + + /** + * The grid ID of the kernel. Each kernel is assigned a unique + * grid ID at runtime. + */ + int64_t gridId; + + /** + * The name of the kernel. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The timestamp when the kernel is queued up in the command buffer, in ns. + * A value of CUPTI_TIMESTAMP_UNKNOWN indicates that the queued time + * could not be collected for the kernel. This timestamp is not collected + * by default. Use API \ref cuptiActivityEnableLatencyTimestamps() to + * enable collection. + * + * Command buffer is a buffer written by CUDA driver to send commands + * like kernel launch, memory copy etc to the GPU. All launches of CUDA + * kernels are asynchronous with respect to the host, the host requests + * the launch by writing commands into the command buffer, then returns + * without checking the GPU's progress. + */ + uint64_t queued; + + /** + * The timestamp when the command buffer containing the kernel launch + * is submitted to the GPU, in ns. A value of CUPTI_TIMESTAMP_UNKNOWN + * indicates that the submitted time could not be collected for the kernel. + * This timestamp is not collected by default. Use API \ref + * cuptiActivityEnableLatencyTimestamps() to enable collection. + */ + uint64_t submitted; + + /** + * The indicates if the kernel was executed via a regular launch or via a + * single/multi device cooperative launch. \see CUpti_ActivityLaunchType + */ + uint8_t launchType; + + /** + * This indicates if CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT was + * updated for the kernel launch + */ + uint8_t isSharedMemoryCarveoutRequested; + + /** + * Shared memory carveout value requested for the function in percentage of + * the total resource. The value will be updated only if field + * isSharedMemoryCarveoutRequested is set. + */ + uint8_t sharedMemoryCarveoutRequested; + + /** + * Undefined. Reserved for internal use. + */ + uint8_t padding; + + /** + * Shared memory size set by the driver. + */ + uint32_t sharedMemoryExecuted; + + /** + * The unique ID of the graph node that launched this kernel through graph launch APIs. + * This field will be 0 if the kernel is not launched through graph launch APIs. + */ + uint64_t graphNodeId; + + /** + * The shared memory limit config for the kernel. This field shows whether user has opted for a + * higher per block limit of dynamic shared memory. + */ + CUpti_FuncShmemLimitConfig shmemLimitConfig; + + /** + * The unique ID of the graph that launched this kernel through graph launch APIs. + * This field will be 0 if the kernel is not launched through graph launch APIs. + */ + uint32_t graphId; +} CUpti_ActivityKernel5; + +/** + * \brief The activity record for kernel. (deprecated in CUDA 11.6) + * + * This activity record represents a kernel execution + * (CUPTI_ACTIVITY_KIND_KERNEL and + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL) but is no longer generated + * by CUPTI. Kernel activities are now reported using the + * CUpti_ActivityKernel9 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_KERNEL or + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL. + */ + CUpti_ActivityKind kind; + + /** + * For devices with compute capability 7.0+ cacheConfig values are not updated + * in case field isSharedMemoryCarveoutRequested is set + */ + union { + uint8_t both; + struct { + /** + * The cache configuration requested by the kernel. The value is one + * of the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t requested:4; + + /** + * The cache configuration used for the kernel. The value is one of + * the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t executed:4; + } config; + } cacheConfig; + + /** + * The shared memory configuration used for the kernel. The value is one of + * the CUsharedconfig enumeration values from cuda.h. + */ + uint8_t sharedMemoryConfig; + + /** + * The number of registers required for each thread executing the + * kernel. + */ + uint16_t registersPerThread; + + /** + * The partitioned global caching requested for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheRequested; + + /** + * The partitioned global caching executed for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. Partitioned global caching can be + * automatically disabled if the occupancy requirement of the launch cannot + * support caching. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheExecuted; + + /** + * The start timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t start; + + /** + * The end timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t end; + + /** + * The completed timestamp for the kernel execution, in ns. It + * represents the completion of all it's child kernels and the + * kernel itself. A value of CUPTI_TIMESTAMP_UNKNOWN indicates that + * the completion time is unknown. + */ + uint64_t completed; + + /** + * The ID of the device where the kernel is executing. + */ + uint32_t deviceId; + + /** + * The ID of the context where the kernel is executing. + */ + uint32_t contextId; + + /** + * The ID of the stream where the kernel is executing. + */ + uint32_t streamId; + + /** + * The X-dimension grid size for the kernel. + */ + int32_t gridX; + + /** + * The Y-dimension grid size for the kernel. + */ + int32_t gridY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t gridZ; + + /** + * The X-dimension block size for the kernel. + */ + int32_t blockX; + + /** + * The Y-dimension block size for the kernel. + */ + int32_t blockY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t blockZ; + + /** + * The static shared memory allocated for the kernel, in bytes. + */ + int32_t staticSharedMemory; + + /** + * The dynamic shared memory reserved for the kernel, in bytes. + */ + int32_t dynamicSharedMemory; + + /** + * The amount of local memory reserved for each thread, in bytes. + */ + uint32_t localMemoryPerThread; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes. + */ + uint32_t localMemoryTotal; + + /** + * The correlation ID of the kernel. Each kernel execution is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the kernel. + */ + uint32_t correlationId; + + /** + * The grid ID of the kernel. Each kernel is assigned a unique + * grid ID at runtime. + */ + int64_t gridId; + + /** + * The name of the kernel. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The timestamp when the kernel is queued up in the command buffer, in ns. + * A value of CUPTI_TIMESTAMP_UNKNOWN indicates that the queued time + * could not be collected for the kernel. This timestamp is not collected + * by default. Use API \ref cuptiActivityEnableLatencyTimestamps() to + * enable collection. + * + * Command buffer is a buffer written by CUDA driver to send commands + * like kernel launch, memory copy etc to the GPU. All launches of CUDA + * kernels are asynchronous with respect to the host, the host requests + * the launch by writing commands into the command buffer, then returns + * without checking the GPU's progress. + */ + uint64_t queued; + + /** + * The timestamp when the command buffer containing the kernel launch + * is submitted to the GPU, in ns. A value of CUPTI_TIMESTAMP_UNKNOWN + * indicates that the submitted time could not be collected for the kernel. + * This timestamp is not collected by default. Use API \ref + * cuptiActivityEnableLatencyTimestamps() to enable collection. + */ + uint64_t submitted; + + /** + * The indicates if the kernel was executed via a regular launch or via a + * single/multi device cooperative launch. \see CUpti_ActivityLaunchType + */ + uint8_t launchType; + + /** + * This indicates if CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT was + * updated for the kernel launch + */ + uint8_t isSharedMemoryCarveoutRequested; + + /** + * Shared memory carveout value requested for the function in percentage of + * the total resource. The value will be updated only if field + * isSharedMemoryCarveoutRequested is set. + */ + uint8_t sharedMemoryCarveoutRequested; + + /** + * Undefined. Reserved for internal use. + */ + uint8_t padding; + + /** + * Shared memory size set by the driver. + */ + uint32_t sharedMemoryExecuted; + + /** + * The unique ID of the graph node that launched this kernel through graph launch APIs. + * This field will be 0 if the kernel is not launched through graph launch APIs. + */ + uint64_t graphNodeId; + + /** + * The shared memory limit config for the kernel. This field shows whether user has opted for a + * higher per block limit of dynamic shared memory. + */ + CUpti_FuncShmemLimitConfig shmemLimitConfig; + + /** + * The unique ID of the graph that launched this kernel through graph launch APIs. + * This field will be 0 if the kernel is not launched through graph launch APIs. + */ + uint32_t graphId; + + /** + * The pointer to the access policy window. The structure CUaccessPolicyWindow is + * defined in cuda.h. + */ + CUaccessPolicyWindow *pAccessPolicyWindow; +} CUpti_ActivityKernel6; + +/** + * \brief The activity record for kernel. (deprecated in CUDA 11.8) + * + * This activity record represents a kernel execution + * (CUPTI_ACTIVITY_KIND_KERNEL and + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL) but is no longer generated + * by CUPTI. Kernel activities are now reported using the + * CUpti_ActivityKernel9 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_KERNEL or + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL. + */ + CUpti_ActivityKind kind; + + /** + * For devices with compute capability 7.0+ cacheConfig values are not updated + * in case field isSharedMemoryCarveoutRequested is set + */ + union { + uint8_t both; + struct { + /** + * The cache configuration requested by the kernel. The value is one + * of the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t requested:4; + + /** + * The cache configuration used for the kernel. The value is one of + * the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t executed:4; + } config; + } cacheConfig; + + /** + * The shared memory configuration used for the kernel. The value is one of + * the CUsharedconfig enumeration values from cuda.h. + */ + uint8_t sharedMemoryConfig; + + /** + * The number of registers required for each thread executing the + * kernel. + */ + uint16_t registersPerThread; + + /** + * The partitioned global caching requested for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheRequested; + + /** + * The partitioned global caching executed for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. Partitioned global caching can be + * automatically disabled if the occupancy requirement of the launch cannot + * support caching. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheExecuted; + + /** + * The start timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t start; + + /** + * The end timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t end; + + /** + * The completed timestamp for the kernel execution, in ns. It + * represents the completion of all it's child kernels and the + * kernel itself. A value of CUPTI_TIMESTAMP_UNKNOWN indicates that + * the completion time is unknown. + */ + uint64_t completed; + + /** + * The ID of the device where the kernel is executing. + */ + uint32_t deviceId; + + /** + * The ID of the context where the kernel is executing. + */ + uint32_t contextId; + + /** + * The ID of the stream where the kernel is executing. + */ + uint32_t streamId; + + /** + * The X-dimension grid size for the kernel. + */ + int32_t gridX; + + /** + * The Y-dimension grid size for the kernel. + */ + int32_t gridY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t gridZ; + + /** + * The X-dimension block size for the kernel. + */ + int32_t blockX; + + /** + * The Y-dimension block size for the kernel. + */ + int32_t blockY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t blockZ; + + /** + * The static shared memory allocated for the kernel, in bytes. + */ + int32_t staticSharedMemory; + + /** + * The dynamic shared memory reserved for the kernel, in bytes. + */ + int32_t dynamicSharedMemory; + + /** + * The amount of local memory reserved for each thread, in bytes. + */ + uint32_t localMemoryPerThread; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes. + */ + uint32_t localMemoryTotal; + + /** + * The correlation ID of the kernel. Each kernel execution is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the kernel. + */ + uint32_t correlationId; + + /** + * The grid ID of the kernel. Each kernel is assigned a unique + * grid ID at runtime. + */ + int64_t gridId; + + /** + * The name of the kernel. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The timestamp when the kernel is queued up in the command buffer, in ns. + * A value of CUPTI_TIMESTAMP_UNKNOWN indicates that the queued time + * could not be collected for the kernel. This timestamp is not collected + * by default. Use API \ref cuptiActivityEnableLatencyTimestamps() to + * enable collection. + * + * Command buffer is a buffer written by CUDA driver to send commands + * like kernel launch, memory copy etc to the GPU. All launches of CUDA + * kernels are asynchronous with respect to the host, the host requests + * the launch by writing commands into the command buffer, then returns + * without checking the GPU's progress. + */ + uint64_t queued; + + /** + * The timestamp when the command buffer containing the kernel launch + * is submitted to the GPU, in ns. A value of CUPTI_TIMESTAMP_UNKNOWN + * indicates that the submitted time could not be collected for the kernel. + * This timestamp is not collected by default. Use API \ref + * cuptiActivityEnableLatencyTimestamps() to enable collection. + */ + uint64_t submitted; + + /** + * The indicates if the kernel was executed via a regular launch or via a + * single/multi device cooperative launch. \see CUpti_ActivityLaunchType + */ + uint8_t launchType; + + /** + * This indicates if CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT was + * updated for the kernel launch + */ + uint8_t isSharedMemoryCarveoutRequested; + + /** + * Shared memory carveout value requested for the function in percentage of + * the total resource. The value will be updated only if field + * isSharedMemoryCarveoutRequested is set. + */ + uint8_t sharedMemoryCarveoutRequested; + + /** + * Undefined. Reserved for internal use. + */ + uint8_t padding; + + /** + * Shared memory size set by the driver. + */ + uint32_t sharedMemoryExecuted; + + /** + * The unique ID of the graph node that launched this kernel through graph launch APIs. + * This field will be 0 if the kernel is not launched through graph launch APIs. + */ + uint64_t graphNodeId; + + /** + * The shared memory limit config for the kernel. This field shows whether user has opted for a + * higher per block limit of dynamic shared memory. + */ + CUpti_FuncShmemLimitConfig shmemLimitConfig; + + /** + * The unique ID of the graph that launched this kernel through graph launch APIs. + * This field will be 0 if the kernel is not launched through graph launch APIs. + */ + uint32_t graphId; + + /** + * The pointer to the access policy window. The structure CUaccessPolicyWindow is + * defined in cuda.h. + */ + CUaccessPolicyWindow *pAccessPolicyWindow; + + /** + * The ID of the HW channel on which the kernel is launched. + */ + uint32_t channelID; + + /** + * The type of the channel + */ + CUpti_ChannelType channelType; +} CUpti_ActivityKernel7; + +/** + * \brief The activity record for kernel. + * + * This activity record represents a kernel execution + * (CUPTI_ACTIVITY_KIND_KERNEL and + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL) + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_KERNEL or + * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL. + */ + CUpti_ActivityKind kind; + + /** + * For devices with compute capability 7.0+ cacheConfig values are not updated + * in case field isSharedMemoryCarveoutRequested is set + */ + union { + uint8_t both; + struct { + /** + * The cache configuration requested by the kernel. The value is one + * of the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t requested:4; + + /** + * The cache configuration used for the kernel. The value is one of + * the CUfunc_cache enumeration values from cuda.h. + */ + uint8_t executed:4; + } config; + } cacheConfig; + + /** + * The shared memory configuration used for the kernel. The value is one of + * the CUsharedconfig enumeration values from cuda.h. + */ + uint8_t sharedMemoryConfig; + + /** + * The number of registers required for each thread executing the + * kernel. + */ + uint16_t registersPerThread; + + /** + * The partitioned global caching requested for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheRequested; + + /** + * The partitioned global caching executed for the kernel. Partitioned + * global caching is required to enable caching on certain chips, such as + * devices with compute capability 5.2. Partitioned global caching can be + * automatically disabled if the occupancy requirement of the launch cannot + * support caching. + */ + CUpti_ActivityPartitionedGlobalCacheConfig partitionedGlobalCacheExecuted; + + /** + * The start timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t start; + + /** + * The end timestamp for the kernel execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the kernel. + */ + uint64_t end; + + /** + * The completed timestamp for the kernel execution, in ns. It + * represents the completion of all it's child kernels and the + * kernel itself. A value of CUPTI_TIMESTAMP_UNKNOWN indicates that + * the completion time is unknown. + */ + uint64_t completed; + + /** + * The ID of the device where the kernel is executing. + */ + uint32_t deviceId; + + /** + * The ID of the context where the kernel is executing. + */ + uint32_t contextId; + + /** + * The ID of the stream where the kernel is executing. + */ + uint32_t streamId; + + /** + * The X-dimension grid size for the kernel. + */ + int32_t gridX; + + /** + * The Y-dimension grid size for the kernel. + */ + int32_t gridY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t gridZ; + + /** + * The X-dimension block size for the kernel. + */ + int32_t blockX; + + /** + * The Y-dimension block size for the kernel. + */ + int32_t blockY; + + /** + * The Z-dimension grid size for the kernel. + */ + int32_t blockZ; + + /** + * The static shared memory allocated for the kernel, in bytes. + */ + int32_t staticSharedMemory; + + /** + * The dynamic shared memory reserved for the kernel, in bytes. + */ + int32_t dynamicSharedMemory; + + /** + * The amount of local memory reserved for each thread, in bytes. + */ + uint32_t localMemoryPerThread; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes (deprecated in CUDA 11.8). + * Refer field localMemoryTotal_v2 + */ + uint32_t localMemoryTotal; + + /** + * The correlation ID of the kernel. Each kernel execution is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the kernel. + */ + uint32_t correlationId; + + /** + * The grid ID of the kernel. Each kernel is assigned a unique + * grid ID at runtime. + */ + int64_t gridId; + + /** + * The name of the kernel. This name is shared across all activity + * records representing the same kernel, and so should not be + * modified. + */ + const char *name; + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The timestamp when the kernel is queued up in the command buffer, in ns. + * A value of CUPTI_TIMESTAMP_UNKNOWN indicates that the queued time + * could not be collected for the kernel. This timestamp is not collected + * by default. Use API \ref cuptiActivityEnableLatencyTimestamps() to + * enable collection. + * + * Command buffer is a buffer written by CUDA driver to send commands + * like kernel launch, memory copy etc to the GPU. All launches of CUDA + * kernels are asynchronous with respect to the host, the host requests + * the launch by writing commands into the command buffer, then returns + * without checking the GPU's progress. + */ + uint64_t queued; + + /** + * The timestamp when the command buffer containing the kernel launch + * is submitted to the GPU, in ns. A value of CUPTI_TIMESTAMP_UNKNOWN + * indicates that the submitted time could not be collected for the kernel. + * This timestamp is not collected by default. Use API \ref + * cuptiActivityEnableLatencyTimestamps() to enable collection. + */ + uint64_t submitted; + + /** + * The indicates if the kernel was executed via a regular launch or via a + * single/multi device cooperative launch. \see CUpti_ActivityLaunchType + */ + uint8_t launchType; + + /** + * This indicates if CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT was + * updated for the kernel launch + */ + uint8_t isSharedMemoryCarveoutRequested; + + /** + * Shared memory carveout value requested for the function in percentage of + * the total resource. The value will be updated only if field + * isSharedMemoryCarveoutRequested is set. + */ + uint8_t sharedMemoryCarveoutRequested; + + /** + * Undefined. Reserved for internal use. + */ + uint8_t padding; + + /** + * Shared memory size set by the driver. + */ + uint32_t sharedMemoryExecuted; + + /** + * The unique ID of the graph node that launched this kernel through graph launch APIs. + * This field will be 0 if the kernel is not launched through graph launch APIs. + */ + uint64_t graphNodeId; + + /** + * The shared memory limit config for the kernel. This field shows whether user has opted for a + * higher per block limit of dynamic shared memory. + */ + CUpti_FuncShmemLimitConfig shmemLimitConfig; + + /** + * The unique ID of the graph that launched this kernel through graph launch APIs. + * This field will be 0 if the kernel is not launched through graph launch APIs. + */ + uint32_t graphId; + + /** + * The pointer to the access policy window. The structure CUaccessPolicyWindow is + * defined in cuda.h. + */ + CUaccessPolicyWindow *pAccessPolicyWindow; + + /** + * The ID of the HW channel on which the kernel is launched. + */ + uint32_t channelID; + + /** + * The type of the channel + */ + CUpti_ChannelType channelType; + + /** + * The X-dimension cluster size for the kernel. + * Field is valid for devices with compute capability 9.0 and higher + */ + uint32_t clusterX; + + /** + * The Y-dimension cluster size for the kernel. + * Field is valid for devices with compute capability 9.0 and higher + */ + uint32_t clusterY; + + /** + * The Z-dimension cluster size for the kernel. + * Field is valid for devices with compute capability 9.0 and higher + */ + uint32_t clusterZ; + + /** + * The cluster scheduling policy for the kernel. Refer CUclusterSchedulingPolicy + * Field is valid for devices with compute capability 9.0 and higher + */ + uint32_t clusterSchedulingPolicy; + + /** + * The total amount of local memory reserved for the kernel, in + * bytes. + */ + uint64_t localMemoryTotal_v2; +} CUpti_ActivityKernel8; + +/** + * \brief The activity record for memory copies. (deprecated) + * + * This activity record represents a memory copy + * (CUPTI_ACTIVITY_KIND_MEMCPY). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMCPY. + */ + CUpti_ActivityKind kind; + + /** + * The kind of the memory copy, stored as a byte to reduce record + * size. \see CUpti_ActivityMemcpyKind + */ + uint8_t copyKind; + + /** + * The source memory kind read by the memory copy, stored as a byte + * to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t srcKind; + + /** + * The destination memory kind read by the memory copy, stored as a + * byte to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t dstKind; + + /** + * The flags associated with the memory copy. \see CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * The number of bytes transferred by the memory copy. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t start; + + /** + * The end timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t end; + + /** + * The ID of the device where the memory copy is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory copy is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory copy is occurring. + */ + uint32_t streamId; + + /** + * The correlation ID of the memory copy. Each memory copy is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver API activity record that launched + * the memory copy. + */ + uint32_t correlationId; + + /** + * The runtime correlation ID of the memory copy. Each memory copy + * is assigned a unique runtime correlation ID that is identical to + * the correlation ID in the runtime API activity record that + * launched the memory copy. + */ + uint32_t runtimeCorrelationId; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; +} CUpti_ActivityMemcpy; + +/** + * \brief The activity record for memory copies. (deprecated in CUDA 11.1) + * + * This activity record represents a memory copy + * (CUPTI_ACTIVITY_KIND_MEMCPY). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMCPY. + */ + CUpti_ActivityKind kind; + + /** + * The kind of the memory copy, stored as a byte to reduce record + * size. \see CUpti_ActivityMemcpyKind + */ + uint8_t copyKind; + + /** + * The source memory kind read by the memory copy, stored as a byte + * to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t srcKind; + + /** + * The destination memory kind read by the memory copy, stored as a + * byte to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t dstKind; + + /** + * The flags associated with the memory copy. \see CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * The number of bytes transferred by the memory copy. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t start; + + /** + * The end timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t end; + + /** + * The ID of the device where the memory copy is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory copy is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory copy is occurring. + */ + uint32_t streamId; + + /** + * The correlation ID of the memory copy. Each memory copy is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver API activity record that launched + * the memory copy. + */ + uint32_t correlationId; + + /** + * The runtime correlation ID of the memory copy. Each memory copy + * is assigned a unique runtime correlation ID that is identical to + * the correlation ID in the runtime API activity record that + * launched the memory copy. + */ + uint32_t runtimeCorrelationId; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The unique ID of the graph node that executed this memcpy through graph launch. + * This field will be 0 if the memcpy is not done through graph launch. + */ + uint64_t graphNodeId; +} CUpti_ActivityMemcpy3; + +/** + * \brief The activity record for memory copies. (deprecated in CUDA 11.6) + * + * This activity record represents a memory copy + * (CUPTI_ACTIVITY_KIND_MEMCPY). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMCPY. + */ + CUpti_ActivityKind kind; + + /** + * The kind of the memory copy, stored as a byte to reduce record + * size. \see CUpti_ActivityMemcpyKind + */ + uint8_t copyKind; + + /** + * The source memory kind read by the memory copy, stored as a byte + * to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t srcKind; + + /** + * The destination memory kind read by the memory copy, stored as a + * byte to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t dstKind; + + /** + * The flags associated with the memory copy. \see CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * The number of bytes transferred by the memory copy. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t start; + + /** + * The end timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t end; + + /** + * The ID of the device where the memory copy is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory copy is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory copy is occurring. + */ + uint32_t streamId; + + /** + * The correlation ID of the memory copy. Each memory copy is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver API activity record that launched + * the memory copy. + */ + uint32_t correlationId; + + /** + * The runtime correlation ID of the memory copy. Each memory copy + * is assigned a unique runtime correlation ID that is identical to + * the correlation ID in the runtime API activity record that + * launched the memory copy. + */ + uint32_t runtimeCorrelationId; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The unique ID of the graph node that executed this memcpy through graph launch. + * This field will be 0 if the memcpy is not done through graph launch. + */ + uint64_t graphNodeId; + + /** + * The unique ID of the graph that executed this memcpy through graph launch. + * This field will be 0 if the memcpy is not done through graph launch. + */ + uint32_t graphId; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t padding; +} CUpti_ActivityMemcpy4; + +/** + * \brief The activity record for peer-to-peer memory copies. + * + * This activity record represents a peer-to-peer memory copy + * (CUPTI_ACTIVITY_KIND_MEMCPY2) but is no longer generated + * by CUPTI. Peer-to-peer memory copy activities are now reported using the + * CUpti_ActivityMemcpyPtoP2 activity record.. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMCPY2. + */ + CUpti_ActivityKind kind; + + /** + * The kind of the memory copy, stored as a byte to reduce record + * size. \see CUpti_ActivityMemcpyKind + */ + uint8_t copyKind; + + /** + * The source memory kind read by the memory copy, stored as a byte + * to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t srcKind; + + /** + * The destination memory kind read by the memory copy, stored as a + * byte to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t dstKind; + + /** + * The flags associated with the memory copy. \see + * CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * The number of bytes transferred by the memory copy. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t start; + + /** + * The end timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t end; + + /** + * The ID of the device where the memory copy is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory copy is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory copy is occurring. + */ + uint32_t streamId; + + /** + * The ID of the device where memory is being copied from. + */ + uint32_t srcDeviceId; + + /** + * The ID of the context owning the memory being copied from. + */ + uint32_t srcContextId; + + /** + * The ID of the device where memory is being copied to. + */ + uint32_t dstDeviceId; + + /** + * The ID of the context owning the memory being copied to. + */ + uint32_t dstContextId; + + /** + * The correlation ID of the memory copy. Each memory copy is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver and runtime API activity record that + * launched the memory copy. + */ + uint32_t correlationId; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; +} CUpti_ActivityMemcpyPtoP; + +typedef CUpti_ActivityMemcpyPtoP CUpti_ActivityMemcpy2; + +/** + * \brief The activity record for peer-to-peer memory copies. + * (deprecated in CUDA 11.1) + * + * This activity record represents a peer-to-peer memory copy + * (CUPTI_ACTIVITY_KIND_MEMCPY2). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMCPY2. + */ + CUpti_ActivityKind kind; + + /** + * The kind of the memory copy, stored as a byte to reduce record + * size. \see CUpti_ActivityMemcpyKind + */ + uint8_t copyKind; + + /** + * The source memory kind read by the memory copy, stored as a byte + * to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t srcKind; + + /** + * The destination memory kind read by the memory copy, stored as a + * byte to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t dstKind; + + /** + * The flags associated with the memory copy. \see + * CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * The number of bytes transferred by the memory copy. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t start; + + /** + * The end timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t end; + + /** + * The ID of the device where the memory copy is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory copy is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory copy is occurring. + */ + uint32_t streamId; + + /** + * The ID of the device where memory is being copied from. + */ + uint32_t srcDeviceId; + + /** + * The ID of the context owning the memory being copied from. + */ + uint32_t srcContextId; + + /** + * The ID of the device where memory is being copied to. + */ + uint32_t dstDeviceId; + + /** + * The ID of the context owning the memory being copied to. + */ + uint32_t dstContextId; + + /** + * The correlation ID of the memory copy. Each memory copy is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver and runtime API activity record that + * launched the memory copy. + */ + uint32_t correlationId; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The unique ID of the graph node that executed the memcpy through graph launch. + * This field will be 0 if memcpy is not done using graph launch. + */ + uint64_t graphNodeId; +} CUpti_ActivityMemcpyPtoP2; + +/** + * \brief The activity record for peer-to-peer memory copies. + * (deprecated in CUDA 11.6) + * + * This activity record represents a peer-to-peer memory copy + * (CUPTI_ACTIVITY_KIND_MEMCPY2). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMCPY2. + */ + CUpti_ActivityKind kind; + + /** + * The kind of the memory copy, stored as a byte to reduce record + * size. \see CUpti_ActivityMemcpyKind + */ + uint8_t copyKind; + + /** + * The source memory kind read by the memory copy, stored as a byte + * to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t srcKind; + + /** + * The destination memory kind read by the memory copy, stored as a + * byte to reduce record size. \see CUpti_ActivityMemoryKind + */ + uint8_t dstKind; + + /** + * The flags associated with the memory copy. \see + * CUpti_ActivityFlag + */ + uint8_t flags; + + /** + * The number of bytes transferred by the memory copy. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t start; + + /** + * The end timestamp for the memory copy, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory copy. + */ + uint64_t end; + + /** + * The ID of the device where the memory copy is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory copy is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory copy is occurring. + */ + uint32_t streamId; + + /** + * The ID of the device where memory is being copied from. + */ + uint32_t srcDeviceId; + + /** + * The ID of the context owning the memory being copied from. + */ + uint32_t srcContextId; + + /** + * The ID of the device where memory is being copied to. + */ + uint32_t dstDeviceId; + + /** + * The ID of the context owning the memory being copied to. + */ + uint32_t dstContextId; + + /** + * The correlation ID of the memory copy. Each memory copy is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver and runtime API activity record that + * launched the memory copy. + */ + uint32_t correlationId; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The unique ID of the graph node that executed the memcpy through graph launch. + * This field will be 0 if memcpy is not done using graph launch. + */ + uint64_t graphNodeId; + + /** + * The unique ID of the graph that executed this memcpy through graph launch. + * This field will be 0 if the memcpy is not done through graph launch. + */ + uint32_t graphId; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t padding; +} CUpti_ActivityMemcpyPtoP3; + +/** + * \brief The activity record for memset. (deprecated) + * + * This activity record represents a memory set operation + * (CUPTI_ACTIVITY_KIND_MEMSET). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMSET. + */ + CUpti_ActivityKind kind; + + /** + * The value being assigned to memory by the memory set. + */ + uint32_t value; + + /** + * The number of bytes being set by the memory set. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory set, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory set. + */ + uint64_t start; + + /** + * The end timestamp for the memory set, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory set. + */ + uint64_t end; + + /** + * The ID of the device where the memory set is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory set is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory set is occurring. + */ + uint32_t streamId; + + /** + * The correlation ID of the memory set. Each memory set is assigned + * a unique correlation ID that is identical to the correlation ID + * in the driver API activity record that launched the memory set. + */ + uint32_t correlationId; + + /** + * The flags associated with the memset. \see CUpti_ActivityFlag + */ + uint16_t flags; + + /** + * The memory kind of the memory set \see CUpti_ActivityMemoryKind + */ + uint16_t memoryKind; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; +} CUpti_ActivityMemset; + +/** + * \brief The activity record for memset. (deprecated in CUDA 11.1) + * + * This activity record represents a memory set operation + * (CUPTI_ACTIVITY_KIND_MEMSET). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMSET. + */ + CUpti_ActivityKind kind; + + /** + * The value being assigned to memory by the memory set. + */ + uint32_t value; + + /** + * The number of bytes being set by the memory set. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory set, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory set. + */ + uint64_t start; + + /** + * The end timestamp for the memory set, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory set. + */ + uint64_t end; + + /** + * The ID of the device where the memory set is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory set is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory set is occurring. + */ + uint32_t streamId; + + /** + * The correlation ID of the memory set. Each memory set is assigned + * a unique correlation ID that is identical to the correlation ID + * in the driver API activity record that launched the memory set. + */ + uint32_t correlationId; + + /** + * The flags associated with the memset. \see CUpti_ActivityFlag + */ + uint16_t flags; + + /** + * The memory kind of the memory set \see CUpti_ActivityMemoryKind + */ + uint16_t memoryKind; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The unique ID of the graph node that executed this memset through graph launch. + * This field will be 0 if the memset is not executed through graph launch. + */ + uint64_t graphNodeId; +} CUpti_ActivityMemset2; + +/** + * \brief The activity record for memset. (deprecated in CUDA 11.6) + * + * This activity record represents a memory set operation + * (CUPTI_ACTIVITY_KIND_MEMSET). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMSET. + */ + CUpti_ActivityKind kind; + + /** + * The value being assigned to memory by the memory set. + */ + uint32_t value; + + /** + * The number of bytes being set by the memory set. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory set, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory set. + */ + uint64_t start; + + /** + * The end timestamp for the memory set, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the memory set. + */ + uint64_t end; + + /** + * The ID of the device where the memory set is occurring. + */ + uint32_t deviceId; + + /** + * The ID of the context where the memory set is occurring. + */ + uint32_t contextId; + + /** + * The ID of the stream where the memory set is occurring. + */ + uint32_t streamId; + + /** + * The correlation ID of the memory set. Each memory set is assigned + * a unique correlation ID that is identical to the correlation ID + * in the driver API activity record that launched the memory set. + */ + uint32_t correlationId; + + /** + * The flags associated with the memset. \see CUpti_ActivityFlag + */ + uint16_t flags; + + /** + * The memory kind of the memory set \see CUpti_ActivityMemoryKind + */ + uint16_t memoryKind; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * Undefined. Reserved for internal use. + */ + void *reserved0; + + /** + * The unique ID of the graph node that executed this memset through graph launch. + * This field will be 0 if the memset is not executed through graph launch. + */ + uint64_t graphNodeId; + + /** + * The unique ID of the graph that executed this memset through graph launch. + * This field will be 0 if the memset is not executed through graph launch. + */ + uint32_t graphId; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t padding; +} CUpti_ActivityMemset3; + +/** + * \brief The activity record for memory. + * + * This activity record represents a memory allocation and free operation + * (CUPTI_ACTIVITY_KIND_MEMORY2). + * This activity record provides separate records for memory allocation and + * memory release operations. + * This allows to correlate the corresponding driver and runtime API + * activity record with the memory operation. + * + * Note: This activity record is an upgrade over \ref CUpti_ActivityMemory + * enabled using the kind \ref CUPTI_ACTIVITY_KIND_MEMORY. + * \ref CUpti_ActivityMemory provides a single record for the memory + * allocation and memory release operations. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMORY2 + */ + CUpti_ActivityKind kind; + + /** + * The memory operation requested by the user, \ref CUpti_ActivityMemoryOperationType. + */ + CUpti_ActivityMemoryOperationType memoryOperationType; + + /** + * The memory kind requested by the user, \ref CUpti_ActivityMemoryKind. + */ + CUpti_ActivityMemoryKind memoryKind; + + /** + * The correlation ID of the memory operation. Each memory operation is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver and runtime API activity record that + * launched the memory operation. + */ + uint32_t correlationId; + + /** + * The virtual address of the allocation. + */ + uint64_t address; + + /** + * The number of bytes of memory allocated. + */ + uint64_t bytes; + + /** + * The start timestamp for the memory operation, in ns. + */ + uint64_t timestamp; + + /** + * The program counter of the memory operation. + */ + uint64_t PC; + + /** + * The ID of the process to which this record belongs to. + */ + uint32_t processId; + + /** + * The ID of the device where the memory operation is taking place. + */ + uint32_t deviceId; + + /** + * The ID of the context. If context is NULL, \p contextId is set to CUPTI_INVALID_CONTEXT_ID. + */ + uint32_t contextId; + + /** + * The ID of the stream. If memory operation is not async, \p streamId is set to CUPTI_INVALID_STREAM_ID. + */ + uint32_t streamId; + + /** + * Variable name. This name is shared across all activity + * records representing the same symbol, and so should not be + * modified. + */ + const char* name; + + /** + * \p isAsync is set if memory operation happens through async memory APIs. + */ + uint32_t isAsync; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad1; +#endif + + /** + * The memory pool configuration used for the memory operations. + */ + struct { + /** + * The type of the memory pool, \ref CUpti_ActivityMemoryPoolType + */ + CUpti_ActivityMemoryPoolType memoryPoolType; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad2; +#endif + + /** + * The base address of the memory pool. + */ + uint64_t address; + + /** + * The release threshold of the memory pool in bytes. \p releaseThreshold is + * valid for CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL, \ref CUpti_ActivityMemoryPoolType. + */ + uint64_t releaseThreshold; + + /** + * The size of the memory pool in bytes and the processID of the memory pool. + * \p size is valid if \p memoryPoolType is + * CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL, \ref CUpti_ActivityMemoryPoolType. + * \p processId is valid if \p memoryPoolType is + * CUPTI_ACTIVITY_MEMORY_POOL_TYPE_IMPORTED, \ref CUpti_ActivityMemoryPoolType. + */ + union { + uint64_t size; + uint64_t processId; + } pool; + } memoryPoolConfig; + +} CUpti_ActivityMemory2; + +/** + * \brief The activity record for memory pool. + * + * This activity record represents a memory pool creation, destruction and + * trimming (CUPTI_ACTIVITY_KIND_MEMORY_POOL). + * This activity record provides separate records for memory pool creation, + * destruction and trimming operations. + * This allows to correlate the corresponding driver and runtime API + * activity record with the memory pool operation. + * + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MEMORY_POOL + */ + CUpti_ActivityKind kind; + + /** + * The memory operation requested by the user, \ref CUpti_ActivityMemoryPoolOperationType. + */ + CUpti_ActivityMemoryPoolOperationType memoryPoolOperationType; + + /** + * The type of the memory pool, \ref CUpti_ActivityMemoryPoolType + */ + CUpti_ActivityMemoryPoolType memoryPoolType; + + /** + * The correlation ID of the memory pool operation. Each memory pool + * operation is assigned a unique correlation ID that is identical to the + * correlation ID in the driver and runtime API activity record that + * launched the memory operation. + */ + uint32_t correlationId; + + /** + * The ID of the process to which this record belongs to. + */ + uint32_t processId; + + /** + * The ID of the device where the memory pool is created. + */ + uint32_t deviceId; + + /** + * The minimum bytes to keep of the memory pool. \p minBytesToKeep is + * valid for CUPTI_ACTIVITY_MEMORY_POOL_OPERATION_TYPE_TRIMMED, + * \ref CUpti_ActivityMemoryPoolOperationType + */ + size_t minBytesToKeep; + +#ifndef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The virtual address of the allocation. + */ + uint64_t address; + + /** + * The size of the memory pool operation in bytes. \p size is + * valid for CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL, \ref CUpti_ActivityMemoryPoolType. + */ + uint64_t size; + + /** + * The release threshold of the memory pool. \p releaseThreshold is + * valid for CUPTI_ACTIVITY_MEMORY_POOL_TYPE_LOCAL, \ref CUpti_ActivityMemoryPoolType. + */ + uint64_t releaseThreshold; + + /** + * The start timestamp for the memory operation, in ns. + */ + uint64_t timestamp; +} CUpti_ActivityMemoryPool; + +/** + * \brief The activity record providing a marker which is an + * instantaneous point in time. (deprecated in CUDA 8.0) + * + * The marker is specified with a descriptive name and unique id + * (CUPTI_ACTIVITY_KIND_MARKER). + * Marker activity is now reported using the + * CUpti_ActivityMarker2 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_MARKER. + */ + CUpti_ActivityKind kind; + + /** + * The flags associated with the marker. \see CUpti_ActivityFlag + */ + CUpti_ActivityFlag flags; + + /** + * The timestamp for the marker, in ns. A value of 0 indicates that + * timestamp information could not be collected for the marker. + */ + uint64_t timestamp; + + /** + * The marker ID. + */ + uint32_t id; + + /** + * The kind of activity object associated with this marker. + */ + CUpti_ActivityObjectKind objectKind; + + /** + * The identifier for the activity object associated with this + * marker. 'objectKind' indicates which ID is valid for this record. + */ + CUpti_ActivityObjectKindId objectId; + +#ifdef CUPTILP64 + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +#endif + + /** + * The marker name for an instantaneous or start marker. This will + * be NULL for an end marker. + */ + const char *name; + +} CUpti_ActivityMarker; + +/** + * \brief The activity record for source-level global + * access. (deprecated) + * + * This activity records the locations of the global + * accesses in the source (CUPTI_ACTIVITY_KIND_GLOBAL_ACCESS). + * Global access activities are now reported using the + * CUpti_ActivityGlobalAccess3 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_GLOBAL_ACCESS. + */ + CUpti_ActivityKind kind; + + /** + * The properties of this global access. + */ + CUpti_ActivityFlag flags; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * The pc offset for the access. + */ + uint32_t pcOffset; + + /** + * The number of times this instruction was executed per warp. It will be incremented + * when at least one of thread among warp is active with predicate and condition code + * evaluating to true. + */ + uint32_t executed; + + /** + * This increments each time when this instruction is executed by number + * of threads that executed this instruction with predicate and condition code evaluating to true. + */ + uint64_t threadsExecuted; + + /** + * The total number of 32 bytes transactions to L2 cache generated by this access + */ + uint64_t l2_transactions; +} CUpti_ActivityGlobalAccess; + +/** + * \brief The activity record for source-level global + * access. (deprecated in CUDA 9.0) + * + * This activity records the locations of the global + * accesses in the source (CUPTI_ACTIVITY_KIND_GLOBAL_ACCESS). + * Global access activities are now reported using the + * CUpti_ActivityGlobalAccess3 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_GLOBAL_ACCESS. + */ + CUpti_ActivityKind kind; + + /** + * The properties of this global access. + */ + CUpti_ActivityFlag flags; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * Correlation ID with global/device function name + */ + uint32_t functionId; + + /** + * The pc offset for the access. + */ + uint32_t pcOffset; + + /** + * This increments each time when this instruction is executed by number + * of threads that executed this instruction with predicate and condition code evaluating to true. + */ + uint64_t threadsExecuted; + + /** + * The total number of 32 bytes transactions to L2 cache generated by this access + */ + uint64_t l2_transactions; + + /** + * The minimum number of L2 transactions possible based on the access pattern. + */ + uint64_t theoreticalL2Transactions; + + /** + * The number of times this instruction was executed per warp. It will be incremented + * when at least one of thread among warp is active with predicate and condition code + * evaluating to true. + */ + uint32_t executed; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +} CUpti_ActivityGlobalAccess2; + +/** + * \brief The activity record for source level result + * branch. (deprecated) + * + * This activity record the locations of the branches in the + * source (CUPTI_ACTIVITY_KIND_BRANCH). + * Branch activities are now reported using the + * CUpti_ActivityBranch2 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_BRANCH. + */ + CUpti_ActivityKind kind; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * The pc offset for the branch. + */ + uint32_t pcOffset; + + /** + * The number of times this instruction was executed per warp. It will be incremented + * regardless of predicate or condition code. + */ + uint32_t executed; + + /** + * Number of times this branch diverged + */ + uint32_t diverged; + + /** + * This increments each time when this instruction is executed by number + * of threads that executed this instruction + */ + uint64_t threadsExecuted; +} CUpti_ActivityBranch; + +/** + * \brief The activity record for PC sampling. (deprecated in CUDA 8.0) + * + * This activity records information obtained by sampling PC + * (CUPTI_ACTIVITY_KIND_PC_SAMPLING). + * PC sampling activities are now reported using the + * CUpti_ActivityPCSampling2 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_PC_SAMPLING. + */ + CUpti_ActivityKind kind; + + /** + * The properties of this instruction. + */ + CUpti_ActivityFlag flags; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * Correlation ID with global/device function name + */ + uint32_t functionId; + + /** + * The pc offset for the instruction. + */ + uint32_t pcOffset; + + /** + * Number of times the PC was sampled with the stallReason in the record. + * The same PC can be sampled with different stall reasons. + */ + uint32_t samples; + + /** + * Current stall reason. Includes one of the reasons from + * \ref CUpti_ActivityPCSamplingStallReason + */ + CUpti_ActivityPCSamplingStallReason stallReason; +} CUpti_ActivityPCSampling; + +/** + * \brief The activity record for PC sampling. (deprecated in CUDA 9.0) + * + * This activity records information obtained by sampling PC + * (CUPTI_ACTIVITY_KIND_PC_SAMPLING). + * PC sampling activities are now reported using the + * CUpti_ActivityPCSampling3 activity record. + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_PC_SAMPLING. + */ + CUpti_ActivityKind kind; + + /** + * The properties of this instruction. + */ + CUpti_ActivityFlag flags; + + /** + * The ID for source locator. + */ + uint32_t sourceLocatorId; + + /** + * The correlation ID of the kernel to which this result is associated. + */ + uint32_t correlationId; + + /** + * Correlation ID with global/device function name + */ + uint32_t functionId; + + /** + * The pc offset for the instruction. + */ + uint32_t pcOffset; + + /** + * Number of times the PC was sampled with the stallReason in the record. + * These samples indicate that no instruction was issued in that cycle from + * the warp scheduler from where the warp was sampled. + * Field is valid for devices with compute capability 6.0 and higher + */ + uint32_t latencySamples; + + /** + * Number of times the PC was sampled with the stallReason in the record. + * The same PC can be sampled with different stall reasons. The count includes + * latencySamples. + */ + uint32_t samples; + + /** + * Current stall reason. Includes one of the reasons from + * \ref CUpti_ActivityPCSamplingStallReason + */ + CUpti_ActivityPCSamplingStallReason stallReason; + + uint32_t pad; +} CUpti_ActivityPCSampling2; + +/** + * \brief The activity record for Unified Memory counters (deprecated in CUDA 7.0) + * + * This activity record represents a Unified Memory counter + * (CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER). + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER + */ + CUpti_ActivityKind kind; + + /** + * The Unified Memory counter kind. See \ref CUpti_ActivityUnifiedMemoryCounterKind + */ + CUpti_ActivityUnifiedMemoryCounterKind counterKind; + + /** + * Scope of the Unified Memory counter. See \ref CUpti_ActivityUnifiedMemoryCounterScope + */ + CUpti_ActivityUnifiedMemoryCounterScope scope; + + /** + * The ID of the device involved in the memory transfer operation. + * It is not relevant if the scope of the counter is global (all devices). + */ + uint32_t deviceId; + + /** + * Value of the counter + * + */ + uint64_t value; + + /** + * The timestamp when this sample was retrieved, in ns. A value of 0 + * indicates that timestamp information could not be collected + */ + uint64_t timestamp; + + /** + * The ID of the process to which this record belongs to. In case of + * global scope, processId is undefined. + */ + uint32_t processId; + + /** + * Undefined. Reserved for internal use. + */ + uint32_t pad; +} CUpti_ActivityUnifiedMemoryCounter; + +/** +* \brief NVLink information. (deprecated in CUDA 9.0) +* +* This structure gives capabilities of each logical NVLink connection between two devices, +* gpu<->gpu or gpu<->CPU which can be used to understand the topology. +* NVLink information are now reported using the +* CUpti_ActivityNvLink2 activity record. +*/ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_NVLINK. + */ + CUpti_ActivityKind kind; + + /** + * NVLink version. + */ + uint32_t nvlinkVersion; + + /** + * Type of device 0 \ref CUpti_DevType + */ + CUpti_DevType typeDev0; + + /** + * Type of device 1 \ref CUpti_DevType + */ + CUpti_DevType typeDev1; + + /** + * If typeDev0 is CUPTI_DEV_TYPE_GPU, UUID for device 0. \ref CUpti_ActivityDevice5. + * If typeDev0 is CUPTI_DEV_TYPE_NPU, struct npu for NPU. + */ + union { + CUuuid uuidDev; + struct { + /** + * Index of the NPU. First index will always be zero. + */ + uint32_t index; + + /** + * Domain ID of NPU. On Linux, this can be queried using lspci. + */ + uint32_t domainId; + } npu; + } idDev0; + + /** + * If typeDev1 is CUPTI_DEV_TYPE_GPU, UUID for device 1. \ref CUpti_ActivityDevice5. + * If typeDev1 is CUPTI_DEV_TYPE_NPU, struct npu for NPU. + */ + union { + CUuuid uuidDev; + struct { + /** + * Index of the NPU. First index will always be zero. + */ + uint32_t index; + + /** + * Domain ID of NPU. On Linux, this can be queried using lspci. + */ + uint32_t domainId; + } npu; + } idDev1; + + /** + * Flag gives capabilities of the link \see CUpti_LinkFlag + */ + uint32_t flag; + + /** + * Number of physical NVLinks present between two devices. + */ + uint32_t physicalNvLinkCount; + + /** + * Port numbers for maximum 4 NVLinks connected to device 0. + * If typeDev0 is CUPTI_DEV_TYPE_NPU, ignore this field. + * In case of invalid/unknown port number, this field will be set + * to value CUPTI_NVLINK_INVALID_PORT. + * This will be used to correlate the metric values to individual + * physical link and attribute traffic to the logical NVLink in + * the topology. + */ + int8_t portDev0[4]; + + /** + * Port numbers for maximum 4 NVLinks connected to device 1. + * If typeDev1 is CUPTI_DEV_TYPE_NPU, ignore this field. + * In case of invalid/unknown port number, this field will be set + * to value CUPTI_NVLINK_INVALID_PORT. + * This will be used to correlate the metric values to individual + * physical link and attribute traffic to the logical NVLink in + * the topology. + */ + int8_t portDev1[4]; + + /** + * Bandwidth of NVLink in kbytes/sec + */ + uint64_t bandwidth; +} CUpti_ActivityNvLink; + +/** +* \brief NVLink information. (deprecated in CUDA 10.0) +* +* This structure gives capabilities of each logical NVLink connection between two devices, +* gpu<->gpu or gpu<->CPU which can be used to understand the topology. +* NvLink information are now reported using the +* CUpti_ActivityNvLink4 activity record. +*/ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_NVLINK. + */ + CUpti_ActivityKind kind; + + /** + * NvLink version. + */ + uint32_t nvlinkVersion; + + /** + * Type of device 0 \ref CUpti_DevType + */ + CUpti_DevType typeDev0; + + /** + * Type of device 1 \ref CUpti_DevType + */ + CUpti_DevType typeDev1; + + /** + * If typeDev0 is CUPTI_DEV_TYPE_GPU, UUID for device 0. \ref CUpti_ActivityDevice5. + * If typeDev0 is CUPTI_DEV_TYPE_NPU, struct npu for NPU. + */ + union { + CUuuid uuidDev; + struct { + /** + * Index of the NPU. First index will always be zero. + */ + uint32_t index; + + /** + * Domain ID of NPU. On Linux, this can be queried using lspci. + */ + uint32_t domainId; + } npu; + } idDev0; + + /** + * If typeDev1 is CUPTI_DEV_TYPE_GPU, UUID for device 1. \ref CUpti_ActivityDevice5. + * If typeDev1 is CUPTI_DEV_TYPE_NPU, struct npu for NPU. + */ + union { + CUuuid uuidDev; + struct { + /** + * Index of the NPU. First index will always be zero. + */ + uint32_t index; + + /** + * Domain ID of NPU. On Linux, this can be queried using lspci. + */ + uint32_t domainId; + } npu; + } idDev1; + + /** + * Flag gives capabilities of the link \see CUpti_LinkFlag + */ + uint32_t flag; + + /** + * Number of physical NVLinks present between two devices. + */ + uint32_t physicalNvLinkCount; + + /** + * Port numbers for maximum 16 NVLinks connected to device 0. + * If typeDev0 is CUPTI_DEV_TYPE_NPU, ignore this field. + * In case of invalid/unknown port number, this field will be set + * to value CUPTI_NVLINK_INVALID_PORT. + * This will be used to correlate the metric values to individual + * physical link and attribute traffic to the logical NVLink in + * the topology. + */ + int8_t portDev0[CUPTI_MAX_NVLINK_PORTS]; + + /** + * Port numbers for maximum 16 NVLinks connected to device 1. + * If typeDev1 is CUPTI_DEV_TYPE_NPU, ignore this field. + * In case of invalid/unknown port number, this field will be set + * to value CUPTI_NVLINK_INVALID_PORT. + * This will be used to correlate the metric values to individual + * physical link and attribute traffic to the logical NVLink in + * the topology. + */ + int8_t portDev1[CUPTI_MAX_NVLINK_PORTS]; + + /** + * Bandwidth of NVLink in kbytes/sec + */ + uint64_t bandwidth; +} CUpti_ActivityNvLink2; + +/** +* \brief NVLink information. +* +* This structure gives capabilities of each logical NVLink connection between two devices, +* gpu<->gpu or gpu<->CPU which can be used to understand the topology. +* NvLink information are now reported using the +* CUpti_ActivityNvLink4 activity record. +*/ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_NVLINK. + */ + CUpti_ActivityKind kind; + /** + * NvLink version. + */ + uint32_t nvlinkVersion; + + /** + * Type of device 0 \ref CUpti_DevType + */ + CUpti_DevType typeDev0; + + /** + * Type of device 1 \ref CUpti_DevType + */ + CUpti_DevType typeDev1; + + /** + * If typeDev0 is CUPTI_DEV_TYPE_GPU, UUID for device 0. \ref CUpti_ActivityDevice5. + * If typeDev0 is CUPTI_DEV_TYPE_NPU, struct npu for NPU. + */ + union { + CUuuid uuidDev; + struct { + /** + * Index of the NPU. First index will always be zero. + */ + uint32_t index; + + /** + * Domain ID of NPU. On Linux, this can be queried using lspci. + */ + uint32_t domainId; + } npu; + } idDev0; + + /** + * If typeDev1 is CUPTI_DEV_TYPE_GPU, UUID for device 1. \ref CUpti_ActivityDevice5. + * If typeDev1 is CUPTI_DEV_TYPE_NPU, struct npu for NPU. + */ + union { + CUuuid uuidDev; + struct { + /** + * Index of the NPU. First index will always be zero. + */ + uint32_t index; + + /** + * Domain ID of NPU. On Linux, this can be queried using lspci. + */ + uint32_t domainId; + } npu; + } idDev1; + + /** + * Flag gives capabilities of the link \see CUpti_LinkFlag + */ + uint32_t flag; + + /** + * Number of physical NVLinks present between two devices. + */ + uint32_t physicalNvLinkCount; + + /** + * Port numbers for maximum 16 NVLinks connected to device 0. + * If typeDev0 is CUPTI_DEV_TYPE_NPU, ignore this field. + * In case of invalid/unknown port number, this field will be set + * to value CUPTI_NVLINK_INVALID_PORT. + * This will be used to correlate the metric values to individual + * physical link and attribute traffic to the logical NVLink in + * the topology. + */ + int8_t portDev0[CUPTI_MAX_NVLINK_PORTS]; + + /** + * Port numbers for maximum 16 NVLinks connected to device 1. + * If typeDev1 is CUPTI_DEV_TYPE_NPU, ignore this field. + * In case of invalid/unknown port number, this field will be set + * to value CUPTI_NVLINK_INVALID_PORT. + * This will be used to correlate the metric values to individual + * physical link and attribute traffic to the logical NVLink in + * the topology. + */ + int8_t portDev1[CUPTI_MAX_NVLINK_PORTS]; + + /** + * Bandwidth of NVLink in kbytes/sec + */ + uint64_t bandwidth; + + /** + * NVSwitch is connected as an intermediate node. + */ + uint8_t nvswitchConnected; + + /** + * Undefined. reserved for internal use + */ + uint8_t pad[7]; +} CUpti_ActivityNvLink3; + +/** + * \brief The activity record for trace of graph execution. + * + * This activity record represents execution for a graph without giving visibility + * about the execution of its nodes. This is intended to reduce overheads in tracing + * each node. The activity kind is CUPTI_ACTIVITY_KIND_GRAPH_TRACE + * Graph trace activity is now reported using CUpti_ActivityGraphTrace2 record. + */ +typedef struct { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_GRAPH_TRACE + */ + CUpti_ActivityKind kind; + + /** + * The correlation ID of the graph launch. Each graph launch is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver API activity record that launched + * the graph. + */ + uint32_t correlationId; + + /** + * The start timestamp for the graph execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the graph. + */ + uint64_t start; + + /** + * The end timestamp for the graph execution, in ns. A value of 0 + * for both the start and end timestamps indicates that timestamp + * information could not be collected for the graph. + */ + uint64_t end; + + /** + * The ID of the device where the graph execution is occurring. + */ + uint32_t deviceId; + + /** + * The unique ID of the graph that is launched. + */ + uint32_t graphId; + + /** + * The ID of the context where the graph is being launched. + */ + uint32_t contextId; + + /** + * The ID of the stream where the graph is being launched. + */ + uint32_t streamId; + + /** + * This field is reserved for internal use + */ + void *reserved; +} CUpti_ActivityGraphTrace; + +/** + * \brief The activity record for a context. + * + * This activity record represents information about a context + * (CUPTI_ACTIVITY_KIND_CONTEXT). + * Context activity is now reported using CUpti_ActivityContext2 record + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind, must be CUPTI_ACTIVITY_KIND_CONTEXT. + */ + CUpti_ActivityKind kind; + + /** + * The context ID. + */ + uint32_t contextId; + + /** + * The device ID. + */ + uint32_t deviceId; + + /** + * The compute API kind. \see CUpti_ActivityComputeApiKind + */ + uint16_t computeApiKind; + + /** + * The ID for the NULL stream in this context + */ + uint16_t nullStreamId; +} CUpti_ActivityContext; + +/** + * \brief The activity record for JIT operations. + * This activity represents the JIT operations (compile, load, store) of a CUmodule + * from the Compute Cache. + * Gives the exact hashed path of where the cached module is loaded from, + * or where the module will be stored after Just-In-Time (JIT) compilation. + * + * JIT activity is now reported using CUpti_ActivityJit2 record + */ +typedef struct PACKED_ALIGNMENT { + /** + * The activity record kind must be CUPTI_ACTIVITY_KIND_JIT. + */ + CUpti_ActivityKind kind; + + /** + * The JIT entry type. + */ + CUpti_ActivityJitEntryType jitEntryType; + + /** + * The JIT operation type. + */ + CUpti_ActivityJitOperationType jitOperationType; + + /** + * The device ID. + */ + uint32_t deviceId; + + /** + * The start timestamp for the JIT operation, in ns. A value of 0 for + * both the start and end timestamps indicates that timestamp + * information could not be collected for the JIT operation. + */ + uint64_t start; + + /** + * The end timestamp for the JIT operation, in ns. A value of 0 for both + * the start and end timestamps indicates that timestamp information + * could not be collected for the JIT operation. + */ + uint64_t end; + + /** + * The correlation ID of the JIT operation to which + * records belong to. Each JIT operation is + * assigned a unique correlation ID that is identical to the + * correlation ID in the driver or runtime API activity record that + * launched the JIT operation. + */ + uint32_t correlationId; + + /** + * Internal use. + */ + uint32_t padding; + + /** + * The correlation ID to correlate JIT compilation, load and store operations. + * Each JIT compilation unit is assigned a unique correlation ID + * at the time of the JIT compilation. This correlation id can be used + * to find the matching JIT cache load/store records. + */ + uint64_t jitOperationCorrelationId; + + /** + * The size of compute cache. + */ + uint64_t cacheSize; + + /** + * The path where the fat binary is cached. + */ + const char* cachePath; +} CUpti_ActivityJit; + + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /*_CUPTI_ACTIVITY_DEPRECATED_H_*/ diff --git a/cuda_toolkit/include/cupti_callbacks.h b/cuda_toolkit/include/cupti_callbacks.h new file mode 100644 index 0000000000000000000000000000000000000000..2c288d4b02f8417b0f3223eedf52e339a25b0775 --- /dev/null +++ b/cuda_toolkit/include/cupti_callbacks.h @@ -0,0 +1,860 @@ +/* + * Copyright 2010-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUPTI_CALLBACKS_H__) +#define __CUPTI_CALLBACKS_H__ + +#include +#include +#include +#include +#include + +#ifndef CUPTIAPI +#ifdef _WIN32 +#define CUPTIAPI __stdcall +#else +#define CUPTIAPI +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +/** + * \defgroup CUPTI_CALLBACK_API CUPTI Callback API + * Functions, types, and enums that implement the CUPTI Callback API. + * @{ + */ + +/** + * \brief Specifies the point in an API call that a callback is issued. + * + * Specifies the point in an API call that a callback is issued. This + * value is communicated to the callback function via \ref + * CUpti_CallbackData::callbackSite. + */ +typedef enum { + /** + * The callback is at the entry of the API call. + */ + CUPTI_API_ENTER = 0, + /** + * The callback is at the exit of the API call. + */ + CUPTI_API_EXIT = 1, + CUPTI_API_CBSITE_FORCE_INT = 0x7fffffff +} CUpti_ApiCallbackSite; + +/** + * \brief Callback domains. + * + * Callback domains. Each domain represents callback points for a + * group of related API functions or CUDA driver activity. + */ +typedef enum { + /** + * Invalid domain. + */ + CUPTI_CB_DOMAIN_INVALID = 0, + /** + * Domain containing callback points for all driver API functions. + */ + CUPTI_CB_DOMAIN_DRIVER_API = 1, + /** + * Domain containing callback points for all runtime API + * functions. + */ + CUPTI_CB_DOMAIN_RUNTIME_API = 2, + /** + * Domain containing callback points for CUDA resource tracking. + */ + CUPTI_CB_DOMAIN_RESOURCE = 3, + /** + * Domain containing callback points for CUDA synchronization. + */ + CUPTI_CB_DOMAIN_SYNCHRONIZE = 4, + /** + * Domain containing callback points for NVTX API functions. + */ + CUPTI_CB_DOMAIN_NVTX = 5, + /** + * Domain containing callback points for various states. + */ + CUPTI_CB_DOMAIN_STATE, + CUPTI_CB_DOMAIN_SIZE, + + CUPTI_CB_DOMAIN_FORCE_INT = 0x7fffffff +} CUpti_CallbackDomain; + +/** + * \brief Callback IDs for resource domain. + * + * Callback IDs for resource domain, CUPTI_CB_DOMAIN_RESOURCE. This + * value is communicated to the callback function via the \p cbid + * parameter. + */ +typedef enum { + /** + * Invalid resource callback ID. + */ + CUPTI_CBID_RESOURCE_INVALID = 0, + /** + * A new context has been created. + */ + CUPTI_CBID_RESOURCE_CONTEXT_CREATED = 1, + /** + * A context is about to be destroyed. + */ + CUPTI_CBID_RESOURCE_CONTEXT_DESTROY_STARTING = 2, + /** + * A new stream has been created. + */ + CUPTI_CBID_RESOURCE_STREAM_CREATED = 3, + /** + * A stream is about to be destroyed. + */ + CUPTI_CBID_RESOURCE_STREAM_DESTROY_STARTING = 4, + /** + * The driver has finished initializing. + */ + CUPTI_CBID_RESOURCE_CU_INIT_FINISHED = 5, + /** + * A module has been loaded. + */ + CUPTI_CBID_RESOURCE_MODULE_LOADED = 6, + /** + * A module is about to be unloaded. + */ + CUPTI_CBID_RESOURCE_MODULE_UNLOAD_STARTING = 7, + /** + * The current module which is being profiled. + */ + CUPTI_CBID_RESOURCE_MODULE_PROFILED = 8, + /** + * CUDA graph has been created. + */ + CUPTI_CBID_RESOURCE_GRAPH_CREATED = 9, + /** + * CUDA graph is about to be destroyed. + */ + CUPTI_CBID_RESOURCE_GRAPH_DESTROY_STARTING = 10, + /** + * CUDA graph is cloned. + */ + CUPTI_CBID_RESOURCE_GRAPH_CLONED = 11, + /** + * CUDA graph node is about to be created + */ + CUPTI_CBID_RESOURCE_GRAPHNODE_CREATE_STARTING = 12, + /** + * CUDA graph node is created. + */ + CUPTI_CBID_RESOURCE_GRAPHNODE_CREATED = 13, + /** + * CUDA graph node is about to be destroyed. + */ + CUPTI_CBID_RESOURCE_GRAPHNODE_DESTROY_STARTING = 14, + /** + * Dependency on a CUDA graph node is created. + */ + CUPTI_CBID_RESOURCE_GRAPHNODE_DEPENDENCY_CREATED = 15, + /** + * Dependency on a CUDA graph node is destroyed. + */ + CUPTI_CBID_RESOURCE_GRAPHNODE_DEPENDENCY_DESTROY_STARTING = 16, + /** + * An executable CUDA graph is about to be created. + */ + CUPTI_CBID_RESOURCE_GRAPHEXEC_CREATE_STARTING = 17, + /** + * An executable CUDA graph is created. + */ + CUPTI_CBID_RESOURCE_GRAPHEXEC_CREATED = 18, + /** + * An executable CUDA graph is about to be destroyed. + */ + CUPTI_CBID_RESOURCE_GRAPHEXEC_DESTROY_STARTING = 19, + /** + * CUDA graph node is cloned. + */ + CUPTI_CBID_RESOURCE_GRAPHNODE_CLONED = 20, + /** + * CUDA stream attribute is changed. + */ + CUPTI_CBID_RESOURCE_STREAM_ATTRIBUTE_CHANGED = 21, + + CUPTI_CBID_RESOURCE_SIZE, + CUPTI_CBID_RESOURCE_FORCE_INT = 0x7fffffff +} CUpti_CallbackIdResource; + +/** + * \brief Callback IDs for synchronization domain. + * + * Callback IDs for synchronization domain, + * CUPTI_CB_DOMAIN_SYNCHRONIZE. This value is communicated to the + * callback function via the \p cbid parameter. + */ +typedef enum { + /** + * Invalid synchronize callback ID. + */ + CUPTI_CBID_SYNCHRONIZE_INVALID = 0, + /** + * Stream synchronization has completed for the stream. + */ + CUPTI_CBID_SYNCHRONIZE_STREAM_SYNCHRONIZED = 1, + /** + * Context synchronization has completed for the context. + */ + CUPTI_CBID_SYNCHRONIZE_CONTEXT_SYNCHRONIZED = 2, + CUPTI_CBID_SYNCHRONIZE_SIZE, + CUPTI_CBID_SYNCHRONIZE_FORCE_INT = 0x7fffffff +} CUpti_CallbackIdSync; + +/** + * \brief Callback IDs for state domain. + * + * Callback IDs for state domain, + * CUPTI_CB_DOMAIN_STATE. This value is communicated to the + * callback function via the \p cbid parameter. + */ +typedef enum { + /** + * Invalid state callback ID. + */ + CUPTI_CBID_STATE_INVALID = 0, + /** + * Notification of fatal errors - high impact, non-recoverable + * When encountered, CUPTI automatically invokes cuptiFinalize() + * User can control behavior of the application in future from + * receiving this callback - such as continuing without profiling, or + * terminating the whole application. + */ + CUPTI_CBID_STATE_FATAL_ERROR = 1, + /** + * Notification of non fatal errors - high impact, but recoverable + * This notification is not issued in the current release. + */ + CUPTI_CBID_STATE_ERROR = 2, + /** + * Notification of warnings - low impact, recoverable + * This notification is not issued in the current release. + */ + CUPTI_CBID_STATE_WARNING = 3, + + CUPTI_CBID_STATE_SIZE, + CUPTI_CBID_STATE_FORCE_INT = 0x7fffffff +} CUpti_CallbackIdState; + +/** + * \brief Data passed into a runtime or driver API callback function. + * + * Data passed into a runtime or driver API callback function as the + * \p cbdata argument to \ref CUpti_CallbackFunc. The \p cbdata will + * be this type for \p domain equal to CUPTI_CB_DOMAIN_DRIVER_API or + * CUPTI_CB_DOMAIN_RUNTIME_API. The callback data is valid only within + * the invocation of the callback function that is passed the data. If + * you need to retain some data for use outside of the callback, you + * must make a copy of that data. For example, if you make a shallow + * copy of CUpti_CallbackData within a callback, you cannot + * dereference \p functionParams outside of that callback to access + * the function parameters. \p functionName is an exception: the + * string pointed to by \p functionName is a global constant and so + * may be accessed outside of the callback. + */ +typedef struct { + /** + * Point in the runtime or driver function from where the callback + * was issued. + */ + CUpti_ApiCallbackSite callbackSite; + + /** + * Name of the runtime or driver API function which issued the + * callback. This string is a global constant and so may be + * accessed outside of the callback. + */ + const char *functionName; + + /** + * Pointer to the arguments passed to the runtime or driver API + * call. See generated_cuda_runtime_api_meta.h and + * generated_cuda_meta.h for structure definitions for the + * parameters for each runtime and driver API function. + */ + const void *functionParams; + + /** + * Pointer to the return value of the runtime or driver API + * call. This field is only valid within the exit::CUPTI_API_EXIT + * callback. For a runtime API \p functionReturnValue points to a + * \p cudaError_t. For a driver API \p functionReturnValue points + * to a \p CUresult. + */ + void *functionReturnValue; + + /** + * Name of the symbol operated on by the runtime or driver API + * function which issued the callback. This entry is valid only for + * driver and runtime launch callbacks, where it returns the name of + * the kernel. + */ + const char *symbolName; + + /** + * Driver context current to the thread, or null if no context is + * current. This value can change from the entry to exit callback + * of a runtime API function if the runtime initializes a context. + */ + CUcontext context; + + /** + * Unique ID for the CUDA context associated with the thread. The + * UIDs are assigned sequentially as contexts are created and are + * unique within a process. + */ + uint32_t contextUid; + + /** + * Pointer to data shared between the entry and exit callbacks of + * a given runtime or drive API function invocation. This field + * can be used to pass 64-bit values from the entry callback to + * the corresponding exit callback. + */ + uint64_t *correlationData; + + /** + * The activity record correlation ID for this callback. For a + * driver domain callback (i.e. \p domain + * CUPTI_CB_DOMAIN_DRIVER_API) this ID will equal the correlation ID + * in the CUpti_ActivityAPI record corresponding to the CUDA driver + * function call. For a runtime domain callback (i.e. \p domain + * CUPTI_CB_DOMAIN_RUNTIME_API) this ID will equal the correlation + * ID in the CUpti_ActivityAPI record corresponding to the CUDA + * runtime function call. Within the callback, this ID can be + * recorded to correlate user data with the activity record. This + * field is new in 4.1. + */ + uint32_t correlationId; + +} CUpti_CallbackData; + +/** + * \brief Data passed into a resource callback function. + * + * Data passed into a resource callback function as the \p cbdata + * argument to \ref CUpti_CallbackFunc. The \p cbdata will be this + * type for \p domain equal to CUPTI_CB_DOMAIN_RESOURCE. The callback + * data is valid only within the invocation of the callback function + * that is passed the data. If you need to retain some data for use + * outside of the callback, you must make a copy of that data. + */ +typedef struct { + /** + * For CUPTI_CBID_RESOURCE_CONTEXT_CREATED and + * CUPTI_CBID_RESOURCE_CONTEXT_DESTROY_STARTING, the context being + * created or destroyed. For CUPTI_CBID_RESOURCE_STREAM_CREATED and + * CUPTI_CBID_RESOURCE_STREAM_DESTROY_STARTING, the context + * containing the stream being created or destroyed. + */ + CUcontext context; + + union { + /** + * For CUPTI_CBID_RESOURCE_STREAM_CREATED and + * CUPTI_CBID_RESOURCE_STREAM_DESTROY_STARTING, the stream being + * created or destroyed. + */ + CUstream stream; + } resourceHandle; + + /** + * Reserved for future use. + */ + void *resourceDescriptor; +} CUpti_ResourceData; + + +/** + * \brief Module data passed into a resource callback function. + * + * CUDA module data passed into a resource callback function as the \p cbdata + * argument to \ref CUpti_CallbackFunc. The \p cbdata will be this + * type for \p domain equal to CUPTI_CB_DOMAIN_RESOURCE. The module + * data is valid only within the invocation of the callback function + * that is passed the data. If you need to retain some data for use + * outside of the callback, you must make a copy of that data. + */ + +typedef struct { + /** + * Identifier to associate with the CUDA module. + */ + uint32_t moduleId; + + /** + * The size of the cubin. + */ + size_t cubinSize; + + /** + * Pointer to the associated cubin. + */ + const char *pCubin; +} CUpti_ModuleResourceData; + +/** + * \brief CUDA graphs data passed into a resource callback function. + * + * CUDA graphs data passed into a resource callback function as the \p cbdata + * argument to \ref CUpti_CallbackFunc. The \p cbdata will be this + * type for \p domain equal to CUPTI_CB_DOMAIN_RESOURCE. The graph + * data is valid only within the invocation of the callback function + * that is passed the data. If you need to retain some data for use + * outside of the callback, you must make a copy of that data. + */ + +typedef struct { + /** + * CUDA graph + */ + CUgraph graph; + /** + * The original CUDA graph from which \param graph is cloned + */ + CUgraph originalGraph; + /** + * CUDA graph node + */ + CUgraphNode node; + /** + * The original CUDA graph node from which \param node is cloned + */ + CUgraphNode originalNode; + /** + * Type of the \param node + */ + CUgraphNodeType nodeType; + /** + * The dependent graph node + * The size of the array is \param numDependencies. + */ + CUgraphNode dependency; + /** + * CUDA executable graph + */ + CUgraphExec graphExec; +} CUpti_GraphData; + +/** + * \brief Data passed into a synchronize callback function. + * + * Data passed into a synchronize callback function as the \p cbdata + * argument to \ref CUpti_CallbackFunc. The \p cbdata will be this + * type for \p domain equal to CUPTI_CB_DOMAIN_SYNCHRONIZE. The + * callback data is valid only within the invocation of the callback + * function that is passed the data. If you need to retain some data + * for use outside of the callback, you must make a copy of that data. + */ +typedef struct { + /** + * The context of the stream being synchronized. + */ + CUcontext context; + /** + * The stream being synchronized. + */ + CUstream stream; +} CUpti_SynchronizeData; + +/** + * \brief Data passed into a NVTX callback function. + * + * Data passed into a NVTX callback function as the \p cbdata argument + * to \ref CUpti_CallbackFunc. The \p cbdata will be this type for \p + * domain equal to CUPTI_CB_DOMAIN_NVTX. Unless otherwise notes, the + * callback data is valid only within the invocation of the callback + * function that is passed the data. If you need to retain some data + * for use outside of the callback, you must make a copy of that data. + */ +typedef struct { + /** + * Name of the NVTX API function which issued the callback. This + * string is a global constant and so may be accessed outside of the + * callback. + */ + const char *functionName; + + /** + * Pointer to the arguments passed to the NVTX API call. See + * generated_nvtx_meta.h for structure definitions for the + * parameters for each NVTX API function. + */ + const void *functionParams; + + /** + * Pointer to the return value of the NVTX API call. See + * nvToolsExt.h for each NVTX API function's return value. + */ + const void *functionReturnValue; +} CUpti_NvtxData; + +/** + * \brief Stream attribute data passed into a resource callback function + * for CUPTI_CBID_RESOURCE_STREAM_ATTRIBUTE_CHANGED callback + + * Data passed into a resource callback function as the \p cbdata + * argument to \ref CUpti_CallbackFunc. The \p cbdata will be this + * type for \p domain equal to CUPTI_CB_DOMAIN_RESOURCE. The + * stream attribute data is valid only within the invocation of the callback + * function that is passed the data. If you need to retain some data + * for use outside of the callback, you must make a copy of that data. + */ +typedef struct { + /** + * The CUDA stream handle for the attribute + */ + CUstream stream; + + /** + * The type of the CUDA stream attribute + */ + CUstreamAttrID attr; + + /** + * The value of the CUDA stream attribute + */ + const CUstreamAttrValue *value; +} CUpti_StreamAttrData; + +/** + * \brief Data passed into a State callback function. + * + * Data passed into a State callback function as the \p cbdata argument + * to \ref CUpti_CallbackFunc. The \p cbdata will be this type for \p + * domain equal to CUPTI_CB_DOMAIN_STATE and callback Ids belonging to CUpti_CallbackIdState. + * Unless otherwise noted, the callback data is valid only within the invocation of the callback + * function that is passed the data. If you need to retain some data + * for use outside of the callback, you must make a copy of that data. + */ +typedef struct { + union { + /** + * Data passed along with the callback Ids + * Enum CUpti_CallbackIdState used to denote callback ids + */ + struct { + /** + * Error code + */ + CUptiResult result; + /** + * String containing more details. It can be NULL. + */ + const char *message; + } notification; + }; +} CUpti_StateData; +/** + * \brief An ID for a driver API, runtime API, resource or + * synchronization callback. + * + * An ID for a driver API, runtime API, resource or synchronization + * callback. Within a driver API callback this should be interpreted + * as a CUpti_driver_api_trace_cbid value (these values are defined in + * cupti_driver_cbid.h). Within a runtime API callback this should be + * interpreted as a CUpti_runtime_api_trace_cbid value (these values + * are defined in cupti_runtime_cbid.h). Within a resource API + * callback this should be interpreted as a \ref + * CUpti_CallbackIdResource value. Within a synchronize API callback + * this should be interpreted as a \ref CUpti_CallbackIdSync value. + */ +typedef uint32_t CUpti_CallbackId; + +/** + * \brief Function type for a callback. + * + * Function type for a callback. The type of the data passed to the + * callback in \p cbdata depends on the \p domain. If \p domain is + * CUPTI_CB_DOMAIN_DRIVER_API or CUPTI_CB_DOMAIN_RUNTIME_API the type + * of \p cbdata will be CUpti_CallbackData. If \p domain is + * CUPTI_CB_DOMAIN_RESOURCE the type of \p cbdata will be + * CUpti_ResourceData. If \p domain is CUPTI_CB_DOMAIN_SYNCHRONIZE the + * type of \p cbdata will be CUpti_SynchronizeData. If \p domain is + * CUPTI_CB_DOMAIN_NVTX the type of \p cbdata will be CUpti_NvtxData. + * + * \param userdata User data supplied at subscription of the callback + * \param domain The domain of the callback + * \param cbid The ID of the callback + * \param cbdata Data passed to the callback. + */ +typedef void (CUPTIAPI *CUpti_CallbackFunc)( + void *userdata, + CUpti_CallbackDomain domain, + CUpti_CallbackId cbid, + const void *cbdata); + +/** + * \brief A callback subscriber. + */ +typedef struct CUpti_Subscriber_st *CUpti_SubscriberHandle; + +/** + * \brief Pointer to an array of callback domains. + */ +typedef CUpti_CallbackDomain *CUpti_DomainTable; + +/** + * \brief Get the available callback domains. + * + * Returns in \p *domainTable an array of size \p *domainCount of all + * the available callback domains. + * \note \b Thread-safety: this function is thread safe. + * + * \param domainCount Returns number of callback domains + * \param domainTable Returns pointer to array of available callback domains + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_NOT_INITIALIZED if unable to initialize CUPTI + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p domainCount or \p domainTable are NULL + */ +CUptiResult CUPTIAPI cuptiSupportedDomains(size_t *domainCount, + CUpti_DomainTable *domainTable); + +/** + * \brief Initialize a callback subscriber with a callback function + * and user data. + * + * Initializes a callback subscriber with a callback function and + * (optionally) a pointer to user data. The returned subscriber handle + * can be used to enable and disable the callback for specific domains + * and callback IDs. + * \note Only a single subscriber can be registered at a time. To ensure + * that no other CUPTI client interrupts the profiling session, it's the + * responsibility of all the CUPTI clients to call this function before + * starting the profling session. In case profiling session is already + * started by another CUPTI client, this function returns the error code + * CUPTI_ERROR_MULTIPLE_SUBSCRIBERS_NOT_SUPPORTED. + * Note that this function returns the same error when application is + * launched using NVIDIA tools like nvprof, Visual Profiler, Nsight Systems, + * Nsight Compute, cuda-gdb and cuda-memcheck. + * \note This function does not enable any callbacks. + * \note \b Thread-safety: this function is thread safe. + * + * \param subscriber Returns handle to initialize subscriber + * \param callback The callback function + * \param userdata A pointer to user data. This data will be passed to + * the callback function via the \p userdata parameter. + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_NOT_INITIALIZED if unable to initialize CUPTI + * \retval CUPTI_ERROR_MULTIPLE_SUBSCRIBERS_NOT_SUPPORTED if there is already a CUPTI subscriber + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p subscriber is NULL + */ +CUptiResult CUPTIAPI cuptiSubscribe(CUpti_SubscriberHandle *subscriber, + CUpti_CallbackFunc callback, + void *userdata); + +/** + * \brief Unregister a callback subscriber. + * + * Removes a callback subscriber so that no future callbacks will be + * issued to that subscriber. + * \note \b Thread-safety: this function is thread safe. + * + * \param subscriber Handle to the initialize subscriber + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_NOT_INITIALIZED if unable to initialized CUPTI + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p subscriber is NULL or not initialized + */ +CUptiResult CUPTIAPI cuptiUnsubscribe(CUpti_SubscriberHandle subscriber); + +/** + * \brief Get the current enabled/disabled state of a callback for a specific + * domain and function ID. + * + * Returns non-zero in \p *enable if the callback for a domain and + * callback ID is enabled, and zero if not enabled. + * + * \note \b Thread-safety: a subscriber must serialize access to + * cuptiGetCallbackState, cuptiEnableCallback, cuptiEnableDomain, and + * cuptiEnableAllDomains. For example, if cuptiGetCallbackState(sub, + * d, c) and cuptiEnableCallback(sub, d, c) are called concurrently, + * the results are undefined. + * + * \param enable Returns non-zero if callback enabled, zero if not enabled + * \param subscriber Handle to the initialize subscriber + * \param domain The domain of the callback + * \param cbid The ID of the callback + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_NOT_INITIALIZED if unable to initialized CUPTI + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p enabled is NULL, or if \p + * subscriber, \p domain or \p cbid is invalid. + */ +CUptiResult CUPTIAPI cuptiGetCallbackState(uint32_t *enable, + CUpti_SubscriberHandle subscriber, + CUpti_CallbackDomain domain, + CUpti_CallbackId cbid); + +/** + * \brief Enable or disabled callbacks for a specific domain and + * callback ID. + * + * Enable or disabled callbacks for a subscriber for a specific domain + * and callback ID. + * + * \note \b Thread-safety: a subscriber must serialize access to + * cuptiGetCallbackState, cuptiEnableCallback, cuptiEnableDomain, and + * cuptiEnableAllDomains. For example, if cuptiGetCallbackState(sub, + * d, c) and cuptiEnableCallback(sub, d, c) are called concurrently, + * the results are undefined. + * + * \param enable New enable state for the callback. Zero disables the + * callback, non-zero enables the callback. + * \param subscriber - Handle to callback subscription + * \param domain The domain of the callback + * \param cbid The ID of the callback + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_NOT_INITIALIZED if unable to initialized CUPTI + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p subscriber, \p domain or \p + * cbid is invalid. + */ +CUptiResult CUPTIAPI cuptiEnableCallback(uint32_t enable, + CUpti_SubscriberHandle subscriber, + CUpti_CallbackDomain domain, + CUpti_CallbackId cbid); + +/** + * \brief Enable or disabled all callbacks for a specific domain. + * + * Enable or disabled all callbacks for a specific domain. + * + * \note \b Thread-safety: a subscriber must serialize access to + * cuptiGetCallbackState, cuptiEnableCallback, cuptiEnableDomain, and + * cuptiEnableAllDomains. For example, if cuptiGetCallbackEnabled(sub, + * d, *) and cuptiEnableDomain(sub, d) are called concurrently, the + * results are undefined. + * + * \param enable New enable state for all callbacks in the + * domain. Zero disables all callbacks, non-zero enables all + * callbacks. + * \param subscriber - Handle to callback subscription + * \param domain The domain of the callback + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_NOT_INITIALIZED if unable to initialized CUPTI + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p subscriber or \p domain is invalid + */ +CUptiResult CUPTIAPI cuptiEnableDomain(uint32_t enable, + CUpti_SubscriberHandle subscriber, + CUpti_CallbackDomain domain); + +/** + * \brief Enable or disable all callbacks in all domains. + * + * Enable or disable all callbacks in all domains. + * + * \note \b Thread-safety: a subscriber must serialize access to + * cuptiGetCallbackState, cuptiEnableCallback, cuptiEnableDomain, and + * cuptiEnableAllDomains. For example, if cuptiGetCallbackState(sub, + * d, *) and cuptiEnableAllDomains(sub) are called concurrently, the + * results are undefined. + * + * \param enable New enable state for all callbacks in all + * domain. Zero disables all callbacks, non-zero enables all + * callbacks. + * \param subscriber - Handle to callback subscription + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_NOT_INITIALIZED if unable to initialized CUPTI + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p subscriber is invalid + */ +CUptiResult CUPTIAPI cuptiEnableAllDomains(uint32_t enable, + CUpti_SubscriberHandle subscriber); + +/** + * \brief Get the name of a callback for a specific domain and callback ID. + * + * Returns a pointer to the name c_string in \p **name. + * + * \note \b Names are available only for the DRIVER and RUNTIME domains. + * + * \param domain The domain of the callback + * \param cbid The ID of the callback + * \param name Returns pointer to the name string on success, NULL otherwise + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p name is NULL, or if + * \p domain or \p cbid is invalid. + */ +CUptiResult CUPTIAPI cuptiGetCallbackName(CUpti_CallbackDomain domain, + uint32_t cbid, + const char **name); + +/** @} */ /* END CUPTI_CALLBACK_API */ + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#if defined(__cplusplus) +} +#endif + +#endif // file guard + diff --git a/cuda_toolkit/include/cupti_checkpoint.h b/cuda_toolkit/include/cupti_checkpoint.h new file mode 100644 index 0000000000000000000000000000000000000000..5e9adaeed7568e13899a1f38740b96504934c9bb --- /dev/null +++ b/cuda_toolkit/include/cupti_checkpoint.h @@ -0,0 +1,127 @@ +#pragma once + +#include +#include + +#include +#include + +namespace NV { namespace Cupti { namespace Checkpoint { + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * \defgroup CUPTI_CHECKPOINT_API CUPTI Checkpoint API + * Functions, types, and enums that implement the CUPTI Checkpoint API. + * @{ + */ + +/** + * \brief Specifies optimization options for a checkpoint, may be OR'd together to specify multiple options. + */ +typedef enum +{ + CUPTI_CHECKPOINT_OPT_NONE = 0, //!< Default behavior + CUPTI_CHECKPOINT_OPT_TRANSFER = 1, //!< Determine which mem blocks have changed, and only restore those. This optimization is cached, which means cuptiCheckpointRestore must always be called at the same point in the application when this option is enabled, or the result may be incorrect. +} CUpti_CheckpointOptimizations; + +/** + * \brief Configuration and handle for a CUPTI Checkpoint + * + * A CUptiCheckpoint object should be initialized with desired options prior to passing into any + * CUPTI Checkpoint API function. The first call into a Checkpoint API function will initialize internal + * state based on these options. Subsequent changes to these options will not have any effect. + * + * Checkpoint data is saved in device, host, and filesystem space. There are options to reserve memory + * at each level (device, host, filesystem) which are intended to allow a guarantee that a certain amount + * of memory will remain free for use after the checkpoint is saved. + * Note, however, that falling back to slower levels of memory (host, and then filesystem) to save the checkpoint + * will result in performance degradation. + * Currently, the filesystem limitation is not implemented. Note that falling back to filesystem storage may + * significantly impact the performance for saving and restoring a checkpoint. + */ +typedef struct +{ + size_t structSize; //!< [in] Must be set to CUpti_Checkpoint_STRUCT_SIZE + + CUcontext ctx; //!< [in] Set to context to save from, or will use current context if NULL + + size_t reserveDeviceMB; //!< [in] Restrict checkpoint from using last N MB of device memory (-1 = use no device memory) + size_t reserveHostMB; //!< [in] Restrict checkpoint from using last N MB of host memory (-1 = use no host memory) + uint8_t allowOverwrite; //!< [in] Boolean, Allow checkpoint to save over existing checkpoint + uint8_t optimizations; //!< [in] Mask of CUpti_CheckpointOptimizations flags for this checkpoint + + void * pPriv; //!< [in] Assign to NULL +} CUpti_Checkpoint; + +#define CUpti_Checkpoint_STRUCT_SIZE \ +(offsetof(CUpti_Checkpoint, pPriv) + \ +sizeof(((CUpti_Checkpoint*)(nullptr))->pPriv)) + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +/** + * \brief Initialize and save a checkpoint of the device state associated with the handle context + * + * Uses the handle options to configure and save a checkpoint of the device state associated with the specified context. + * + * \param handle A pointer to a CUpti_Checkpoint object + * + * \retval CUPTI_SUCCESS if a checkpoint was successfully initialized and saved + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p handle does not appear to refer to a valid CUpti_Checkpoint + * \retval CUPTI_ERROR_INVALID_CONTEXT + * \retval CUPTI_ERROR_INVALID_DEVICE if device associated with context is not compatible with checkpoint API + * \retval CUPTI_ERROR_INVALID_OPERATION if Save is requested over an existing checkpoint, but \p allowOverwrite was not originally specified + * \retval CUPTI_ERROR_OUT_OF_MEMORY if as configured, not enough backing storage space to save the checkpoint + */ +CUptiResult cuptiCheckpointSave(CUpti_Checkpoint * const handle); + +/** + * \brief Restore a checkpoint to the device associated with its context + * + * Restores device, pinned, and allocated memory to the state when the checkpoint was saved + * + * \param handle A pointer to a previously saved CUpti_Checkpoint object + * + * \retval CUTPI_SUCCESS if the checkpoint was successfully restored + * \retval CUPTI_ERROR_NOT_INITIALIZED if the checkpoint was not previously initialized + * \retval CUPTI_ERROR_INVALID_CONTEXT + * \retval CUPTI_ERROR_INVALID_PARAMETER if the handle appears invalid + * \retval CUPTI_ERROR_UNKNOWN if the restore or optimization operation fails + */ +CUptiResult cuptiCheckpointRestore(CUpti_Checkpoint * const handle); + +/** + * \brief Free the backing data for a checkpoint + * + * Frees all associated device, host memory and filesystem storage used for this context. + * After freeing a handle, it may be re-used as if it was new - options may be re-configured and will + * take effect on the next call to \p cuptiCheckpointSave. + * + * \param handle A pointer to a previously saved CUpti_Checkpoint object + * + * \retval CUPTI_SUCCESS if the handle was successfully freed + * \retval CUPTI_ERROR_INVALID_PARAMETER if the handle was already freed or appears invalid + * \retval CUPTI_ERROR_INVALID_CONTEXT if the context is no longer valid + */ +CUptiResult cuptiCheckpointFree(CUpti_Checkpoint * const handle); + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +// Exit namespace NV::Cupti::Checkpoint +}}} diff --git a/cuda_toolkit/include/cupti_common.h b/cuda_toolkit/include/cupti_common.h new file mode 100644 index 0000000000000000000000000000000000000000..636f0106cfb7b070105eaa85a72bbf686b3c3d9e --- /dev/null +++ b/cuda_toolkit/include/cupti_common.h @@ -0,0 +1,93 @@ +/* + * Copyright 2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUPTI_COMMON_H__) +#define __CUPTI_COMMON_H__ + +#ifndef CUPTIAPI +#ifdef _WIN32 +#define CUPTIAPI __stdcall +#else +#define CUPTIAPI +#endif +#endif + +#ifndef CUPTIUTILAPI +#ifdef _WIN32 +#define CUPTIUTILAPI __stdcall +#else +#define CUPTIUTILAPI +#endif +#endif + +#if defined(__LP64__) +#define CUPTILP64 1 +#elif defined(_WIN64) +#define CUPTILP64 1 +#else +#undef CUPTILP64 +#endif + +#define ACTIVITY_RECORD_ALIGNMENT 8 +#if defined(_WIN32) // Windows 32- and 64-bit +#define START_PACKED_ALIGNMENT __pragma(pack(push,1)) // exact fit - no padding +#define PACKED_ALIGNMENT __declspec(align(ACTIVITY_RECORD_ALIGNMENT)) +#define END_PACKED_ALIGNMENT __pragma(pack(pop)) +#elif defined(__GNUC__) // GCC +#define START_PACKED_ALIGNMENT +#define PACKED_ALIGNMENT __attribute__ ((__packed__)) __attribute__ ((aligned (ACTIVITY_RECORD_ALIGNMENT))) +#define END_PACKED_ALIGNMENT +#else // all other compilers +#define START_PACKED_ALIGNMENT +#define PACKED_ALIGNMENT +#define END_PACKED_ALIGNMENT +#endif + +#endif /*__CUPTI_COMMON_H__*/ + diff --git a/cuda_toolkit/include/cupti_driver_cbid.h b/cuda_toolkit/include/cupti_driver_cbid.h new file mode 100644 index 0000000000000000000000000000000000000000..6e160bc6557199c98c651226b69bca93a9f38118 --- /dev/null +++ b/cuda_toolkit/include/cupti_driver_cbid.h @@ -0,0 +1,767 @@ + +// ************************************************************************* +// Definitions of indices for API functions, unique across entire API +// ************************************************************************* + +// This file is generated. Any changes you make will be lost during the next clean build. +// CUDA public interface, for type definitions and cu* function prototypes + +typedef enum CUpti_driver_api_trace_cbid_enum { + CUPTI_DRIVER_TRACE_CBID_INVALID = 0, + CUPTI_DRIVER_TRACE_CBID_cuInit = 1, + CUPTI_DRIVER_TRACE_CBID_cuDriverGetVersion = 2, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGet = 3, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetCount = 4, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetName = 5, + CUPTI_DRIVER_TRACE_CBID_cuDeviceComputeCapability = 6, + CUPTI_DRIVER_TRACE_CBID_cuDeviceTotalMem = 7, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetProperties = 8, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetAttribute = 9, + CUPTI_DRIVER_TRACE_CBID_cuCtxCreate = 10, + CUPTI_DRIVER_TRACE_CBID_cuCtxDestroy = 11, + CUPTI_DRIVER_TRACE_CBID_cuCtxAttach = 12, + CUPTI_DRIVER_TRACE_CBID_cuCtxDetach = 13, + CUPTI_DRIVER_TRACE_CBID_cuCtxPushCurrent = 14, + CUPTI_DRIVER_TRACE_CBID_cuCtxPopCurrent = 15, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetDevice = 16, + CUPTI_DRIVER_TRACE_CBID_cuCtxSynchronize = 17, + CUPTI_DRIVER_TRACE_CBID_cuModuleLoad = 18, + CUPTI_DRIVER_TRACE_CBID_cuModuleLoadData = 19, + CUPTI_DRIVER_TRACE_CBID_cuModuleLoadDataEx = 20, + CUPTI_DRIVER_TRACE_CBID_cuModuleLoadFatBinary = 21, + CUPTI_DRIVER_TRACE_CBID_cuModuleUnload = 22, + CUPTI_DRIVER_TRACE_CBID_cuModuleGetFunction = 23, + CUPTI_DRIVER_TRACE_CBID_cuModuleGetGlobal = 24, + CUPTI_DRIVER_TRACE_CBID_cu64ModuleGetGlobal = 25, + CUPTI_DRIVER_TRACE_CBID_cuModuleGetTexRef = 26, + CUPTI_DRIVER_TRACE_CBID_cuMemGetInfo = 27, + CUPTI_DRIVER_TRACE_CBID_cu64MemGetInfo = 28, + CUPTI_DRIVER_TRACE_CBID_cuMemAlloc = 29, + CUPTI_DRIVER_TRACE_CBID_cu64MemAlloc = 30, + CUPTI_DRIVER_TRACE_CBID_cuMemAllocPitch = 31, + CUPTI_DRIVER_TRACE_CBID_cu64MemAllocPitch = 32, + CUPTI_DRIVER_TRACE_CBID_cuMemFree = 33, + CUPTI_DRIVER_TRACE_CBID_cu64MemFree = 34, + CUPTI_DRIVER_TRACE_CBID_cuMemGetAddressRange = 35, + CUPTI_DRIVER_TRACE_CBID_cu64MemGetAddressRange = 36, + CUPTI_DRIVER_TRACE_CBID_cuMemAllocHost = 37, + CUPTI_DRIVER_TRACE_CBID_cuMemFreeHost = 38, + CUPTI_DRIVER_TRACE_CBID_cuMemHostAlloc = 39, + CUPTI_DRIVER_TRACE_CBID_cuMemHostGetDevicePointer = 40, + CUPTI_DRIVER_TRACE_CBID_cu64MemHostGetDevicePointer = 41, + CUPTI_DRIVER_TRACE_CBID_cuMemHostGetFlags = 42, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoD = 43, + CUPTI_DRIVER_TRACE_CBID_cu64MemcpyHtoD = 44, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoH = 45, + CUPTI_DRIVER_TRACE_CBID_cu64MemcpyDtoH = 46, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoD = 47, + CUPTI_DRIVER_TRACE_CBID_cu64MemcpyDtoD = 48, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoA = 49, + CUPTI_DRIVER_TRACE_CBID_cu64MemcpyDtoA = 50, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoD = 51, + CUPTI_DRIVER_TRACE_CBID_cu64MemcpyAtoD = 52, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoA = 53, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoH = 54, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoA = 55, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy2D = 56, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy2DUnaligned = 57, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy3D = 58, + CUPTI_DRIVER_TRACE_CBID_cu64Memcpy3D = 59, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoDAsync = 60, + CUPTI_DRIVER_TRACE_CBID_cu64MemcpyHtoDAsync = 61, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoHAsync = 62, + CUPTI_DRIVER_TRACE_CBID_cu64MemcpyDtoHAsync = 63, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoDAsync = 64, + CUPTI_DRIVER_TRACE_CBID_cu64MemcpyDtoDAsync = 65, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoAAsync = 66, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoHAsync = 67, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy2DAsync = 68, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy3DAsync = 69, + CUPTI_DRIVER_TRACE_CBID_cu64Memcpy3DAsync = 70, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD8 = 71, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD8 = 72, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD16 = 73, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD16 = 74, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD32 = 75, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD32 = 76, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D8 = 77, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD2D8 = 78, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D16 = 79, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD2D16 = 80, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D32 = 81, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD2D32 = 82, + CUPTI_DRIVER_TRACE_CBID_cuFuncSetBlockShape = 83, + CUPTI_DRIVER_TRACE_CBID_cuFuncSetSharedSize = 84, + CUPTI_DRIVER_TRACE_CBID_cuFuncGetAttribute = 85, + CUPTI_DRIVER_TRACE_CBID_cuFuncSetCacheConfig = 86, + CUPTI_DRIVER_TRACE_CBID_cuArrayCreate = 87, + CUPTI_DRIVER_TRACE_CBID_cuArrayGetDescriptor = 88, + CUPTI_DRIVER_TRACE_CBID_cuArrayDestroy = 89, + CUPTI_DRIVER_TRACE_CBID_cuArray3DCreate = 90, + CUPTI_DRIVER_TRACE_CBID_cuArray3DGetDescriptor = 91, + CUPTI_DRIVER_TRACE_CBID_cuTexRefCreate = 92, + CUPTI_DRIVER_TRACE_CBID_cuTexRefDestroy = 93, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetArray = 94, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetAddress = 95, + CUPTI_DRIVER_TRACE_CBID_cu64TexRefSetAddress = 96, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetAddress2D = 97, + CUPTI_DRIVER_TRACE_CBID_cu64TexRefSetAddress2D = 98, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetFormat = 99, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetAddressMode = 100, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetFilterMode = 101, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetFlags = 102, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetAddress = 103, + CUPTI_DRIVER_TRACE_CBID_cu64TexRefGetAddress = 104, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetArray = 105, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetAddressMode = 106, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetFilterMode = 107, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetFormat = 108, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetFlags = 109, + CUPTI_DRIVER_TRACE_CBID_cuParamSetSize = 110, + CUPTI_DRIVER_TRACE_CBID_cuParamSeti = 111, + CUPTI_DRIVER_TRACE_CBID_cuParamSetf = 112, + CUPTI_DRIVER_TRACE_CBID_cuParamSetv = 113, + CUPTI_DRIVER_TRACE_CBID_cuParamSetTexRef = 114, + CUPTI_DRIVER_TRACE_CBID_cuLaunch = 115, + CUPTI_DRIVER_TRACE_CBID_cuLaunchGrid = 116, + CUPTI_DRIVER_TRACE_CBID_cuLaunchGridAsync = 117, + CUPTI_DRIVER_TRACE_CBID_cuEventCreate = 118, + CUPTI_DRIVER_TRACE_CBID_cuEventRecord = 119, + CUPTI_DRIVER_TRACE_CBID_cuEventQuery = 120, + CUPTI_DRIVER_TRACE_CBID_cuEventSynchronize = 121, + CUPTI_DRIVER_TRACE_CBID_cuEventDestroy = 122, + CUPTI_DRIVER_TRACE_CBID_cuEventElapsedTime = 123, + CUPTI_DRIVER_TRACE_CBID_cuStreamCreate = 124, + CUPTI_DRIVER_TRACE_CBID_cuStreamQuery = 125, + CUPTI_DRIVER_TRACE_CBID_cuStreamSynchronize = 126, + CUPTI_DRIVER_TRACE_CBID_cuStreamDestroy = 127, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsUnregisterResource = 128, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsSubResourceGetMappedArray = 129, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsResourceGetMappedPointer = 130, + CUPTI_DRIVER_TRACE_CBID_cu64GraphicsResourceGetMappedPointer = 131, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsResourceSetMapFlags = 132, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsMapResources = 133, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsUnmapResources = 134, + CUPTI_DRIVER_TRACE_CBID_cuGetExportTable = 135, + CUPTI_DRIVER_TRACE_CBID_cuCtxSetLimit = 136, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetLimit = 137, + CUPTI_DRIVER_TRACE_CBID_cuD3D10GetDevice = 138, + CUPTI_DRIVER_TRACE_CBID_cuD3D10CtxCreate = 139, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsD3D10RegisterResource = 140, + CUPTI_DRIVER_TRACE_CBID_cuD3D10RegisterResource = 141, + CUPTI_DRIVER_TRACE_CBID_cuD3D10UnregisterResource = 142, + CUPTI_DRIVER_TRACE_CBID_cuD3D10MapResources = 143, + CUPTI_DRIVER_TRACE_CBID_cuD3D10UnmapResources = 144, + CUPTI_DRIVER_TRACE_CBID_cuD3D10ResourceSetMapFlags = 145, + CUPTI_DRIVER_TRACE_CBID_cuD3D10ResourceGetMappedArray = 146, + CUPTI_DRIVER_TRACE_CBID_cuD3D10ResourceGetMappedPointer = 147, + CUPTI_DRIVER_TRACE_CBID_cuD3D10ResourceGetMappedSize = 148, + CUPTI_DRIVER_TRACE_CBID_cuD3D10ResourceGetMappedPitch = 149, + CUPTI_DRIVER_TRACE_CBID_cuD3D10ResourceGetSurfaceDimensions = 150, + CUPTI_DRIVER_TRACE_CBID_cuD3D11GetDevice = 151, + CUPTI_DRIVER_TRACE_CBID_cuD3D11CtxCreate = 152, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsD3D11RegisterResource = 153, + CUPTI_DRIVER_TRACE_CBID_cuD3D9GetDevice = 154, + CUPTI_DRIVER_TRACE_CBID_cuD3D9CtxCreate = 155, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsD3D9RegisterResource = 156, + CUPTI_DRIVER_TRACE_CBID_cuD3D9GetDirect3DDevice = 157, + CUPTI_DRIVER_TRACE_CBID_cuD3D9RegisterResource = 158, + CUPTI_DRIVER_TRACE_CBID_cuD3D9UnregisterResource = 159, + CUPTI_DRIVER_TRACE_CBID_cuD3D9MapResources = 160, + CUPTI_DRIVER_TRACE_CBID_cuD3D9UnmapResources = 161, + CUPTI_DRIVER_TRACE_CBID_cuD3D9ResourceSetMapFlags = 162, + CUPTI_DRIVER_TRACE_CBID_cuD3D9ResourceGetSurfaceDimensions = 163, + CUPTI_DRIVER_TRACE_CBID_cuD3D9ResourceGetMappedArray = 164, + CUPTI_DRIVER_TRACE_CBID_cuD3D9ResourceGetMappedPointer = 165, + CUPTI_DRIVER_TRACE_CBID_cuD3D9ResourceGetMappedSize = 166, + CUPTI_DRIVER_TRACE_CBID_cuD3D9ResourceGetMappedPitch = 167, + CUPTI_DRIVER_TRACE_CBID_cuD3D9Begin = 168, + CUPTI_DRIVER_TRACE_CBID_cuD3D9End = 169, + CUPTI_DRIVER_TRACE_CBID_cuD3D9RegisterVertexBuffer = 170, + CUPTI_DRIVER_TRACE_CBID_cuD3D9MapVertexBuffer = 171, + CUPTI_DRIVER_TRACE_CBID_cuD3D9UnmapVertexBuffer = 172, + CUPTI_DRIVER_TRACE_CBID_cuD3D9UnregisterVertexBuffer = 173, + CUPTI_DRIVER_TRACE_CBID_cuGLCtxCreate = 174, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsGLRegisterBuffer = 175, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsGLRegisterImage = 176, + CUPTI_DRIVER_TRACE_CBID_cuWGLGetDevice = 177, + CUPTI_DRIVER_TRACE_CBID_cuGLInit = 178, + CUPTI_DRIVER_TRACE_CBID_cuGLRegisterBufferObject = 179, + CUPTI_DRIVER_TRACE_CBID_cuGLMapBufferObject = 180, + CUPTI_DRIVER_TRACE_CBID_cuGLUnmapBufferObject = 181, + CUPTI_DRIVER_TRACE_CBID_cuGLUnregisterBufferObject = 182, + CUPTI_DRIVER_TRACE_CBID_cuGLSetBufferObjectMapFlags = 183, + CUPTI_DRIVER_TRACE_CBID_cuGLMapBufferObjectAsync = 184, + CUPTI_DRIVER_TRACE_CBID_cuGLUnmapBufferObjectAsync = 185, + CUPTI_DRIVER_TRACE_CBID_cuVDPAUGetDevice = 186, + CUPTI_DRIVER_TRACE_CBID_cuVDPAUCtxCreate = 187, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsVDPAURegisterVideoSurface = 188, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsVDPAURegisterOutputSurface = 189, + CUPTI_DRIVER_TRACE_CBID_cuModuleGetSurfRef = 190, + CUPTI_DRIVER_TRACE_CBID_cuSurfRefCreate = 191, + CUPTI_DRIVER_TRACE_CBID_cuSurfRefDestroy = 192, + CUPTI_DRIVER_TRACE_CBID_cuSurfRefSetFormat = 193, + CUPTI_DRIVER_TRACE_CBID_cuSurfRefSetArray = 194, + CUPTI_DRIVER_TRACE_CBID_cuSurfRefGetFormat = 195, + CUPTI_DRIVER_TRACE_CBID_cuSurfRefGetArray = 196, + CUPTI_DRIVER_TRACE_CBID_cu64DeviceTotalMem = 197, + CUPTI_DRIVER_TRACE_CBID_cu64D3D10ResourceGetMappedPointer = 198, + CUPTI_DRIVER_TRACE_CBID_cu64D3D10ResourceGetMappedSize = 199, + CUPTI_DRIVER_TRACE_CBID_cu64D3D10ResourceGetMappedPitch = 200, + CUPTI_DRIVER_TRACE_CBID_cu64D3D10ResourceGetSurfaceDimensions = 201, + CUPTI_DRIVER_TRACE_CBID_cu64D3D9ResourceGetSurfaceDimensions = 202, + CUPTI_DRIVER_TRACE_CBID_cu64D3D9ResourceGetMappedPointer = 203, + CUPTI_DRIVER_TRACE_CBID_cu64D3D9ResourceGetMappedSize = 204, + CUPTI_DRIVER_TRACE_CBID_cu64D3D9ResourceGetMappedPitch = 205, + CUPTI_DRIVER_TRACE_CBID_cu64D3D9MapVertexBuffer = 206, + CUPTI_DRIVER_TRACE_CBID_cu64GLMapBufferObject = 207, + CUPTI_DRIVER_TRACE_CBID_cu64GLMapBufferObjectAsync = 208, + CUPTI_DRIVER_TRACE_CBID_cuD3D11GetDevices = 209, + CUPTI_DRIVER_TRACE_CBID_cuD3D11CtxCreateOnDevice = 210, + CUPTI_DRIVER_TRACE_CBID_cuD3D10GetDevices = 211, + CUPTI_DRIVER_TRACE_CBID_cuD3D10CtxCreateOnDevice = 212, + CUPTI_DRIVER_TRACE_CBID_cuD3D9GetDevices = 213, + CUPTI_DRIVER_TRACE_CBID_cuD3D9CtxCreateOnDevice = 214, + CUPTI_DRIVER_TRACE_CBID_cu64MemHostAlloc = 215, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD8Async = 216, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD8Async = 217, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD16Async = 218, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD16Async = 219, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD32Async = 220, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD32Async = 221, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D8Async = 222, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD2D8Async = 223, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D16Async = 224, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD2D16Async = 225, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D32Async = 226, + CUPTI_DRIVER_TRACE_CBID_cu64MemsetD2D32Async = 227, + CUPTI_DRIVER_TRACE_CBID_cu64ArrayCreate = 228, + CUPTI_DRIVER_TRACE_CBID_cu64ArrayGetDescriptor = 229, + CUPTI_DRIVER_TRACE_CBID_cu64Array3DCreate = 230, + CUPTI_DRIVER_TRACE_CBID_cu64Array3DGetDescriptor = 231, + CUPTI_DRIVER_TRACE_CBID_cu64Memcpy2D = 232, + CUPTI_DRIVER_TRACE_CBID_cu64Memcpy2DUnaligned = 233, + CUPTI_DRIVER_TRACE_CBID_cu64Memcpy2DAsync = 234, + CUPTI_DRIVER_TRACE_CBID_cuCtxCreate_v2 = 235, + CUPTI_DRIVER_TRACE_CBID_cuD3D10CtxCreate_v2 = 236, + CUPTI_DRIVER_TRACE_CBID_cuD3D11CtxCreate_v2 = 237, + CUPTI_DRIVER_TRACE_CBID_cuD3D9CtxCreate_v2 = 238, + CUPTI_DRIVER_TRACE_CBID_cuGLCtxCreate_v2 = 239, + CUPTI_DRIVER_TRACE_CBID_cuVDPAUCtxCreate_v2 = 240, + CUPTI_DRIVER_TRACE_CBID_cuModuleGetGlobal_v2 = 241, + CUPTI_DRIVER_TRACE_CBID_cuMemGetInfo_v2 = 242, + CUPTI_DRIVER_TRACE_CBID_cuMemAlloc_v2 = 243, + CUPTI_DRIVER_TRACE_CBID_cuMemAllocPitch_v2 = 244, + CUPTI_DRIVER_TRACE_CBID_cuMemFree_v2 = 245, + CUPTI_DRIVER_TRACE_CBID_cuMemGetAddressRange_v2 = 246, + CUPTI_DRIVER_TRACE_CBID_cuMemHostGetDevicePointer_v2 = 247, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy_v2 = 248, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD8_v2 = 249, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD16_v2 = 250, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD32_v2 = 251, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D8_v2 = 252, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D16_v2 = 253, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D32_v2 = 254, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetAddress_v2 = 255, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetAddress2D_v2 = 256, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetAddress_v2 = 257, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsResourceGetMappedPointer_v2 = 258, + CUPTI_DRIVER_TRACE_CBID_cuDeviceTotalMem_v2 = 259, + CUPTI_DRIVER_TRACE_CBID_cuD3D10ResourceGetMappedPointer_v2 = 260, + CUPTI_DRIVER_TRACE_CBID_cuD3D10ResourceGetMappedSize_v2 = 261, + CUPTI_DRIVER_TRACE_CBID_cuD3D10ResourceGetMappedPitch_v2 = 262, + CUPTI_DRIVER_TRACE_CBID_cuD3D10ResourceGetSurfaceDimensions_v2 = 263, + CUPTI_DRIVER_TRACE_CBID_cuD3D9ResourceGetSurfaceDimensions_v2 = 264, + CUPTI_DRIVER_TRACE_CBID_cuD3D9ResourceGetMappedPointer_v2 = 265, + CUPTI_DRIVER_TRACE_CBID_cuD3D9ResourceGetMappedSize_v2 = 266, + CUPTI_DRIVER_TRACE_CBID_cuD3D9ResourceGetMappedPitch_v2 = 267, + CUPTI_DRIVER_TRACE_CBID_cuD3D9MapVertexBuffer_v2 = 268, + CUPTI_DRIVER_TRACE_CBID_cuGLMapBufferObject_v2 = 269, + CUPTI_DRIVER_TRACE_CBID_cuGLMapBufferObjectAsync_v2 = 270, + CUPTI_DRIVER_TRACE_CBID_cuMemHostAlloc_v2 = 271, + CUPTI_DRIVER_TRACE_CBID_cuArrayCreate_v2 = 272, + CUPTI_DRIVER_TRACE_CBID_cuArrayGetDescriptor_v2 = 273, + CUPTI_DRIVER_TRACE_CBID_cuArray3DCreate_v2 = 274, + CUPTI_DRIVER_TRACE_CBID_cuArray3DGetDescriptor_v2 = 275, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoD_v2 = 276, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoDAsync_v2 = 277, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoH_v2 = 278, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoHAsync_v2 = 279, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoD_v2 = 280, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoDAsync_v2 = 281, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoH_v2 = 282, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoHAsync_v2 = 283, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoD_v2 = 284, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoA_v2 = 285, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoA_v2 = 286, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy2D_v2 = 287, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy2DUnaligned_v2 = 288, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy2DAsync_v2 = 289, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy3D_v2 = 290, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy3DAsync_v2 = 291, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoA_v2 = 292, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoAAsync_v2 = 293, + CUPTI_DRIVER_TRACE_CBID_cuMemAllocHost_v2 = 294, + CUPTI_DRIVER_TRACE_CBID_cuStreamWaitEvent = 295, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetApiVersion = 296, + CUPTI_DRIVER_TRACE_CBID_cuD3D10GetDirect3DDevice = 297, + CUPTI_DRIVER_TRACE_CBID_cuD3D11GetDirect3DDevice = 298, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetCacheConfig = 299, + CUPTI_DRIVER_TRACE_CBID_cuCtxSetCacheConfig = 300, + CUPTI_DRIVER_TRACE_CBID_cuMemHostRegister = 301, + CUPTI_DRIVER_TRACE_CBID_cuMemHostUnregister = 302, + CUPTI_DRIVER_TRACE_CBID_cuCtxSetCurrent = 303, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetCurrent = 304, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy = 305, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAsync = 306, + CUPTI_DRIVER_TRACE_CBID_cuLaunchKernel = 307, + CUPTI_DRIVER_TRACE_CBID_cuProfilerStart = 308, + CUPTI_DRIVER_TRACE_CBID_cuProfilerStop = 309, + CUPTI_DRIVER_TRACE_CBID_cuPointerGetAttribute = 310, + CUPTI_DRIVER_TRACE_CBID_cuProfilerInitialize = 311, + CUPTI_DRIVER_TRACE_CBID_cuDeviceCanAccessPeer = 312, + CUPTI_DRIVER_TRACE_CBID_cuCtxEnablePeerAccess = 313, + CUPTI_DRIVER_TRACE_CBID_cuCtxDisablePeerAccess = 314, + CUPTI_DRIVER_TRACE_CBID_cuMemPeerRegister = 315, + CUPTI_DRIVER_TRACE_CBID_cuMemPeerUnregister = 316, + CUPTI_DRIVER_TRACE_CBID_cuMemPeerGetDevicePointer = 317, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyPeer = 318, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyPeerAsync = 319, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy3DPeer = 320, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy3DPeerAsync = 321, + CUPTI_DRIVER_TRACE_CBID_cuCtxDestroy_v2 = 322, + CUPTI_DRIVER_TRACE_CBID_cuCtxPushCurrent_v2 = 323, + CUPTI_DRIVER_TRACE_CBID_cuCtxPopCurrent_v2 = 324, + CUPTI_DRIVER_TRACE_CBID_cuEventDestroy_v2 = 325, + CUPTI_DRIVER_TRACE_CBID_cuStreamDestroy_v2 = 326, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetAddress2D_v3 = 327, + CUPTI_DRIVER_TRACE_CBID_cuIpcGetMemHandle = 328, + CUPTI_DRIVER_TRACE_CBID_cuIpcOpenMemHandle = 329, + CUPTI_DRIVER_TRACE_CBID_cuIpcCloseMemHandle = 330, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetByPCIBusId = 331, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetPCIBusId = 332, + CUPTI_DRIVER_TRACE_CBID_cuGLGetDevices = 333, + CUPTI_DRIVER_TRACE_CBID_cuIpcGetEventHandle = 334, + CUPTI_DRIVER_TRACE_CBID_cuIpcOpenEventHandle = 335, + CUPTI_DRIVER_TRACE_CBID_cuCtxSetSharedMemConfig = 336, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetSharedMemConfig = 337, + CUPTI_DRIVER_TRACE_CBID_cuFuncSetSharedMemConfig = 338, + CUPTI_DRIVER_TRACE_CBID_cuTexObjectCreate = 339, + CUPTI_DRIVER_TRACE_CBID_cuTexObjectDestroy = 340, + CUPTI_DRIVER_TRACE_CBID_cuTexObjectGetResourceDesc = 341, + CUPTI_DRIVER_TRACE_CBID_cuTexObjectGetTextureDesc = 342, + CUPTI_DRIVER_TRACE_CBID_cuSurfObjectCreate = 343, + CUPTI_DRIVER_TRACE_CBID_cuSurfObjectDestroy = 344, + CUPTI_DRIVER_TRACE_CBID_cuSurfObjectGetResourceDesc = 345, + CUPTI_DRIVER_TRACE_CBID_cuStreamAddCallback = 346, + CUPTI_DRIVER_TRACE_CBID_cuMipmappedArrayCreate = 347, + CUPTI_DRIVER_TRACE_CBID_cuMipmappedArrayGetLevel = 348, + CUPTI_DRIVER_TRACE_CBID_cuMipmappedArrayDestroy = 349, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetMipmappedArray = 350, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetMipmapFilterMode = 351, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetMipmapLevelBias = 352, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetMipmapLevelClamp = 353, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetMaxAnisotropy = 354, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetMipmappedArray = 355, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetMipmapFilterMode = 356, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetMipmapLevelBias = 357, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetMipmapLevelClamp = 358, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetMaxAnisotropy = 359, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsResourceGetMappedMipmappedArray = 360, + CUPTI_DRIVER_TRACE_CBID_cuTexObjectGetResourceViewDesc = 361, + CUPTI_DRIVER_TRACE_CBID_cuLinkCreate = 362, + CUPTI_DRIVER_TRACE_CBID_cuLinkAddData = 363, + CUPTI_DRIVER_TRACE_CBID_cuLinkAddFile = 364, + CUPTI_DRIVER_TRACE_CBID_cuLinkComplete = 365, + CUPTI_DRIVER_TRACE_CBID_cuLinkDestroy = 366, + CUPTI_DRIVER_TRACE_CBID_cuStreamCreateWithPriority = 367, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetPriority = 368, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetFlags = 369, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetStreamPriorityRange = 370, + CUPTI_DRIVER_TRACE_CBID_cuMemAllocManaged = 371, + CUPTI_DRIVER_TRACE_CBID_cuGetErrorString = 372, + CUPTI_DRIVER_TRACE_CBID_cuGetErrorName = 373, + CUPTI_DRIVER_TRACE_CBID_cuOccupancyMaxActiveBlocksPerMultiprocessor = 374, + CUPTI_DRIVER_TRACE_CBID_cuCompilePtx = 375, + CUPTI_DRIVER_TRACE_CBID_cuBinaryFree = 376, + CUPTI_DRIVER_TRACE_CBID_cuStreamAttachMemAsync = 377, + CUPTI_DRIVER_TRACE_CBID_cuPointerSetAttribute = 378, + CUPTI_DRIVER_TRACE_CBID_cuMemHostRegister_v2 = 379, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsResourceSetMapFlags_v2 = 380, + CUPTI_DRIVER_TRACE_CBID_cuLinkCreate_v2 = 381, + CUPTI_DRIVER_TRACE_CBID_cuLinkAddData_v2 = 382, + CUPTI_DRIVER_TRACE_CBID_cuLinkAddFile_v2 = 383, + CUPTI_DRIVER_TRACE_CBID_cuOccupancyMaxPotentialBlockSize = 384, + CUPTI_DRIVER_TRACE_CBID_cuGLGetDevices_v2 = 385, + CUPTI_DRIVER_TRACE_CBID_cuDevicePrimaryCtxRetain = 386, + CUPTI_DRIVER_TRACE_CBID_cuDevicePrimaryCtxRelease = 387, + CUPTI_DRIVER_TRACE_CBID_cuDevicePrimaryCtxSetFlags = 388, + CUPTI_DRIVER_TRACE_CBID_cuDevicePrimaryCtxReset = 389, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsEGLRegisterImage = 390, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetFlags = 391, + CUPTI_DRIVER_TRACE_CBID_cuDevicePrimaryCtxGetState = 392, + CUPTI_DRIVER_TRACE_CBID_cuEGLStreamConsumerConnect = 393, + CUPTI_DRIVER_TRACE_CBID_cuEGLStreamConsumerDisconnect = 394, + CUPTI_DRIVER_TRACE_CBID_cuEGLStreamConsumerAcquireFrame = 395, + CUPTI_DRIVER_TRACE_CBID_cuEGLStreamConsumerReleaseFrame = 396, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoD_v2_ptds = 397, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoH_v2_ptds = 398, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoD_v2_ptds = 399, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoA_v2_ptds = 400, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoD_v2_ptds = 401, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoA_v2_ptds = 402, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoH_v2_ptds = 403, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoA_v2_ptds = 404, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy2D_v2_ptds = 405, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy2DUnaligned_v2_ptds = 406, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy3D_v2_ptds = 407, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy_ptds = 408, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyPeer_ptds = 409, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy3DPeer_ptds = 410, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD8_v2_ptds = 411, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD16_v2_ptds = 412, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD32_v2_ptds = 413, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D8_v2_ptds = 414, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D16_v2_ptds = 415, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D32_v2_ptds = 416, + CUPTI_DRIVER_TRACE_CBID_cuGLMapBufferObject_v2_ptds = 417, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAsync_ptsz = 418, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoAAsync_v2_ptsz = 419, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyAtoHAsync_v2_ptsz = 420, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyHtoDAsync_v2_ptsz = 421, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoHAsync_v2_ptsz = 422, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyDtoDAsync_v2_ptsz = 423, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy2DAsync_v2_ptsz = 424, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy3DAsync_v2_ptsz = 425, + CUPTI_DRIVER_TRACE_CBID_cuMemcpyPeerAsync_ptsz = 426, + CUPTI_DRIVER_TRACE_CBID_cuMemcpy3DPeerAsync_ptsz = 427, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD8Async_ptsz = 428, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD16Async_ptsz = 429, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD32Async_ptsz = 430, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D8Async_ptsz = 431, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D16Async_ptsz = 432, + CUPTI_DRIVER_TRACE_CBID_cuMemsetD2D32Async_ptsz = 433, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetPriority_ptsz = 434, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetFlags_ptsz = 435, + CUPTI_DRIVER_TRACE_CBID_cuStreamWaitEvent_ptsz = 436, + CUPTI_DRIVER_TRACE_CBID_cuStreamAddCallback_ptsz = 437, + CUPTI_DRIVER_TRACE_CBID_cuStreamAttachMemAsync_ptsz = 438, + CUPTI_DRIVER_TRACE_CBID_cuStreamQuery_ptsz = 439, + CUPTI_DRIVER_TRACE_CBID_cuStreamSynchronize_ptsz = 440, + CUPTI_DRIVER_TRACE_CBID_cuEventRecord_ptsz = 441, + CUPTI_DRIVER_TRACE_CBID_cuLaunchKernel_ptsz = 442, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsMapResources_ptsz = 443, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsUnmapResources_ptsz = 444, + CUPTI_DRIVER_TRACE_CBID_cuGLMapBufferObjectAsync_v2_ptsz = 445, + CUPTI_DRIVER_TRACE_CBID_cuEGLStreamProducerConnect = 446, + CUPTI_DRIVER_TRACE_CBID_cuEGLStreamProducerDisconnect = 447, + CUPTI_DRIVER_TRACE_CBID_cuEGLStreamProducerPresentFrame = 448, + CUPTI_DRIVER_TRACE_CBID_cuGraphicsResourceGetMappedEglFrame = 449, + CUPTI_DRIVER_TRACE_CBID_cuPointerGetAttributes = 450, + CUPTI_DRIVER_TRACE_CBID_cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags = 451, + CUPTI_DRIVER_TRACE_CBID_cuOccupancyMaxPotentialBlockSizeWithFlags = 452, + CUPTI_DRIVER_TRACE_CBID_cuEGLStreamProducerReturnFrame = 453, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetP2PAttribute = 454, + CUPTI_DRIVER_TRACE_CBID_cuTexRefSetBorderColor = 455, + CUPTI_DRIVER_TRACE_CBID_cuTexRefGetBorderColor = 456, + CUPTI_DRIVER_TRACE_CBID_cuMemAdvise = 457, + CUPTI_DRIVER_TRACE_CBID_cuStreamWaitValue32 = 458, + CUPTI_DRIVER_TRACE_CBID_cuStreamWaitValue32_ptsz = 459, + CUPTI_DRIVER_TRACE_CBID_cuStreamWriteValue32 = 460, + CUPTI_DRIVER_TRACE_CBID_cuStreamWriteValue32_ptsz = 461, + CUPTI_DRIVER_TRACE_CBID_cuStreamBatchMemOp = 462, + CUPTI_DRIVER_TRACE_CBID_cuStreamBatchMemOp_ptsz = 463, + CUPTI_DRIVER_TRACE_CBID_cuNVNbufferGetPointer = 464, + CUPTI_DRIVER_TRACE_CBID_cuNVNtextureGetArray = 465, + CUPTI_DRIVER_TRACE_CBID_cuNNSetAllocator = 466, + CUPTI_DRIVER_TRACE_CBID_cuMemPrefetchAsync = 467, + CUPTI_DRIVER_TRACE_CBID_cuMemPrefetchAsync_ptsz = 468, + CUPTI_DRIVER_TRACE_CBID_cuEventCreateFromNVNSync = 469, + CUPTI_DRIVER_TRACE_CBID_cuEGLStreamConsumerConnectWithFlags = 470, + CUPTI_DRIVER_TRACE_CBID_cuMemRangeGetAttribute = 471, + CUPTI_DRIVER_TRACE_CBID_cuMemRangeGetAttributes = 472, + CUPTI_DRIVER_TRACE_CBID_cuStreamWaitValue64 = 473, + CUPTI_DRIVER_TRACE_CBID_cuStreamWaitValue64_ptsz = 474, + CUPTI_DRIVER_TRACE_CBID_cuStreamWriteValue64 = 475, + CUPTI_DRIVER_TRACE_CBID_cuStreamWriteValue64_ptsz = 476, + CUPTI_DRIVER_TRACE_CBID_cuLaunchCooperativeKernel = 477, + CUPTI_DRIVER_TRACE_CBID_cuLaunchCooperativeKernel_ptsz = 478, + CUPTI_DRIVER_TRACE_CBID_cuEventCreateFromEGLSync = 479, + CUPTI_DRIVER_TRACE_CBID_cuLaunchCooperativeKernelMultiDevice = 480, + CUPTI_DRIVER_TRACE_CBID_cuFuncSetAttribute = 481, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetUuid = 482, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetCtx = 483, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetCtx_ptsz = 484, + CUPTI_DRIVER_TRACE_CBID_cuImportExternalMemory = 485, + CUPTI_DRIVER_TRACE_CBID_cuExternalMemoryGetMappedBuffer = 486, + CUPTI_DRIVER_TRACE_CBID_cuExternalMemoryGetMappedMipmappedArray = 487, + CUPTI_DRIVER_TRACE_CBID_cuDestroyExternalMemory = 488, + CUPTI_DRIVER_TRACE_CBID_cuImportExternalSemaphore = 489, + CUPTI_DRIVER_TRACE_CBID_cuSignalExternalSemaphoresAsync = 490, + CUPTI_DRIVER_TRACE_CBID_cuSignalExternalSemaphoresAsync_ptsz = 491, + CUPTI_DRIVER_TRACE_CBID_cuWaitExternalSemaphoresAsync = 492, + CUPTI_DRIVER_TRACE_CBID_cuWaitExternalSemaphoresAsync_ptsz = 493, + CUPTI_DRIVER_TRACE_CBID_cuDestroyExternalSemaphore = 494, + CUPTI_DRIVER_TRACE_CBID_cuStreamBeginCapture = 495, + CUPTI_DRIVER_TRACE_CBID_cuStreamBeginCapture_ptsz = 496, + CUPTI_DRIVER_TRACE_CBID_cuStreamEndCapture = 497, + CUPTI_DRIVER_TRACE_CBID_cuStreamEndCapture_ptsz = 498, + CUPTI_DRIVER_TRACE_CBID_cuStreamIsCapturing = 499, + CUPTI_DRIVER_TRACE_CBID_cuStreamIsCapturing_ptsz = 500, + CUPTI_DRIVER_TRACE_CBID_cuGraphCreate = 501, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddKernelNode = 502, + CUPTI_DRIVER_TRACE_CBID_cuGraphKernelNodeGetParams = 503, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddMemcpyNode = 504, + CUPTI_DRIVER_TRACE_CBID_cuGraphMemcpyNodeGetParams = 505, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddMemsetNode = 506, + CUPTI_DRIVER_TRACE_CBID_cuGraphMemsetNodeGetParams = 507, + CUPTI_DRIVER_TRACE_CBID_cuGraphMemsetNodeSetParams = 508, + CUPTI_DRIVER_TRACE_CBID_cuGraphNodeGetType = 509, + CUPTI_DRIVER_TRACE_CBID_cuGraphGetRootNodes = 510, + CUPTI_DRIVER_TRACE_CBID_cuGraphNodeGetDependencies = 511, + CUPTI_DRIVER_TRACE_CBID_cuGraphNodeGetDependentNodes = 512, + CUPTI_DRIVER_TRACE_CBID_cuGraphInstantiate = 513, + CUPTI_DRIVER_TRACE_CBID_cuGraphLaunch = 514, + CUPTI_DRIVER_TRACE_CBID_cuGraphLaunch_ptsz = 515, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecDestroy = 516, + CUPTI_DRIVER_TRACE_CBID_cuGraphDestroy = 517, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddDependencies = 518, + CUPTI_DRIVER_TRACE_CBID_cuGraphRemoveDependencies = 519, + CUPTI_DRIVER_TRACE_CBID_cuGraphMemcpyNodeSetParams = 520, + CUPTI_DRIVER_TRACE_CBID_cuGraphKernelNodeSetParams = 521, + CUPTI_DRIVER_TRACE_CBID_cuGraphDestroyNode = 522, + CUPTI_DRIVER_TRACE_CBID_cuGraphClone = 523, + CUPTI_DRIVER_TRACE_CBID_cuGraphNodeFindInClone = 524, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddChildGraphNode = 525, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddEmptyNode = 526, + CUPTI_DRIVER_TRACE_CBID_cuLaunchHostFunc = 527, + CUPTI_DRIVER_TRACE_CBID_cuLaunchHostFunc_ptsz = 528, + CUPTI_DRIVER_TRACE_CBID_cuGraphChildGraphNodeGetGraph = 529, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddHostNode = 530, + CUPTI_DRIVER_TRACE_CBID_cuGraphHostNodeGetParams = 531, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetLuid = 532, + CUPTI_DRIVER_TRACE_CBID_cuGraphHostNodeSetParams = 533, + CUPTI_DRIVER_TRACE_CBID_cuGraphGetNodes = 534, + CUPTI_DRIVER_TRACE_CBID_cuGraphGetEdges = 535, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetCaptureInfo = 536, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetCaptureInfo_ptsz = 537, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecKernelNodeSetParams = 538, + CUPTI_DRIVER_TRACE_CBID_cuStreamBeginCapture_v2 = 539, + CUPTI_DRIVER_TRACE_CBID_cuStreamBeginCapture_v2_ptsz = 540, + CUPTI_DRIVER_TRACE_CBID_cuThreadExchangeStreamCaptureMode = 541, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetNvSciSyncAttributes = 542, + CUPTI_DRIVER_TRACE_CBID_cuOccupancyAvailableDynamicSMemPerBlock = 543, + CUPTI_DRIVER_TRACE_CBID_cuDevicePrimaryCtxRelease_v2 = 544, + CUPTI_DRIVER_TRACE_CBID_cuDevicePrimaryCtxReset_v2 = 545, + CUPTI_DRIVER_TRACE_CBID_cuDevicePrimaryCtxSetFlags_v2 = 546, + CUPTI_DRIVER_TRACE_CBID_cuMemAddressReserve = 547, + CUPTI_DRIVER_TRACE_CBID_cuMemAddressFree = 548, + CUPTI_DRIVER_TRACE_CBID_cuMemCreate = 549, + CUPTI_DRIVER_TRACE_CBID_cuMemRelease = 550, + CUPTI_DRIVER_TRACE_CBID_cuMemMap = 551, + CUPTI_DRIVER_TRACE_CBID_cuMemUnmap = 552, + CUPTI_DRIVER_TRACE_CBID_cuMemSetAccess = 553, + CUPTI_DRIVER_TRACE_CBID_cuMemExportToShareableHandle = 554, + CUPTI_DRIVER_TRACE_CBID_cuMemImportFromShareableHandle = 555, + CUPTI_DRIVER_TRACE_CBID_cuMemGetAllocationGranularity = 556, + CUPTI_DRIVER_TRACE_CBID_cuMemGetAllocationPropertiesFromHandle = 557, + CUPTI_DRIVER_TRACE_CBID_cuMemGetAccess = 558, + CUPTI_DRIVER_TRACE_CBID_cuStreamSetFlags = 559, + CUPTI_DRIVER_TRACE_CBID_cuStreamSetFlags_ptsz = 560, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecUpdate = 561, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecMemcpyNodeSetParams = 562, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecMemsetNodeSetParams = 563, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecHostNodeSetParams = 564, + CUPTI_DRIVER_TRACE_CBID_cuMemRetainAllocationHandle = 565, + CUPTI_DRIVER_TRACE_CBID_cuFuncGetModule = 566, + CUPTI_DRIVER_TRACE_CBID_cuIpcOpenMemHandle_v2 = 567, + CUPTI_DRIVER_TRACE_CBID_cuCtxResetPersistingL2Cache = 568, + CUPTI_DRIVER_TRACE_CBID_cuGraphKernelNodeCopyAttributes = 569, + CUPTI_DRIVER_TRACE_CBID_cuGraphKernelNodeGetAttribute = 570, + CUPTI_DRIVER_TRACE_CBID_cuGraphKernelNodeSetAttribute = 571, + CUPTI_DRIVER_TRACE_CBID_cuStreamCopyAttributes = 572, + CUPTI_DRIVER_TRACE_CBID_cuStreamCopyAttributes_ptsz = 573, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetAttribute = 574, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetAttribute_ptsz = 575, + CUPTI_DRIVER_TRACE_CBID_cuStreamSetAttribute = 576, + CUPTI_DRIVER_TRACE_CBID_cuStreamSetAttribute_ptsz = 577, + CUPTI_DRIVER_TRACE_CBID_cuGraphInstantiate_v2 = 578, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetTexture1DLinearMaxWidth = 579, + CUPTI_DRIVER_TRACE_CBID_cuGraphUpload = 580, + CUPTI_DRIVER_TRACE_CBID_cuGraphUpload_ptsz = 581, + CUPTI_DRIVER_TRACE_CBID_cuArrayGetSparseProperties = 582, + CUPTI_DRIVER_TRACE_CBID_cuMipmappedArrayGetSparseProperties = 583, + CUPTI_DRIVER_TRACE_CBID_cuMemMapArrayAsync = 584, + CUPTI_DRIVER_TRACE_CBID_cuMemMapArrayAsync_ptsz = 585, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecChildGraphNodeSetParams = 586, + CUPTI_DRIVER_TRACE_CBID_cuEventRecordWithFlags = 587, + CUPTI_DRIVER_TRACE_CBID_cuEventRecordWithFlags_ptsz = 588, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddEventRecordNode = 589, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddEventWaitNode = 590, + CUPTI_DRIVER_TRACE_CBID_cuGraphEventRecordNodeGetEvent = 591, + CUPTI_DRIVER_TRACE_CBID_cuGraphEventWaitNodeGetEvent = 592, + CUPTI_DRIVER_TRACE_CBID_cuGraphEventRecordNodeSetEvent = 593, + CUPTI_DRIVER_TRACE_CBID_cuGraphEventWaitNodeSetEvent = 594, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecEventRecordNodeSetEvent = 595, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecEventWaitNodeSetEvent = 596, + CUPTI_DRIVER_TRACE_CBID_cuArrayGetPlane = 597, + CUPTI_DRIVER_TRACE_CBID_cuMemAllocAsync = 598, + CUPTI_DRIVER_TRACE_CBID_cuMemAllocAsync_ptsz = 599, + CUPTI_DRIVER_TRACE_CBID_cuMemFreeAsync = 600, + CUPTI_DRIVER_TRACE_CBID_cuMemFreeAsync_ptsz = 601, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolTrimTo = 602, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolSetAttribute = 603, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolGetAttribute = 604, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolSetAccess = 605, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetDefaultMemPool = 606, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolCreate = 607, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolDestroy = 608, + CUPTI_DRIVER_TRACE_CBID_cuDeviceSetMemPool = 609, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetMemPool = 610, + CUPTI_DRIVER_TRACE_CBID_cuMemAllocFromPoolAsync = 611, + CUPTI_DRIVER_TRACE_CBID_cuMemAllocFromPoolAsync_ptsz = 612, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolExportToShareableHandle = 613, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolImportFromShareableHandle = 614, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolExportPointer = 615, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolImportPointer = 616, + CUPTI_DRIVER_TRACE_CBID_cuMemPoolGetAccess = 617, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddExternalSemaphoresSignalNode = 618, + CUPTI_DRIVER_TRACE_CBID_cuGraphExternalSemaphoresSignalNodeGetParams = 619, + CUPTI_DRIVER_TRACE_CBID_cuGraphExternalSemaphoresSignalNodeSetParams = 620, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddExternalSemaphoresWaitNode = 621, + CUPTI_DRIVER_TRACE_CBID_cuGraphExternalSemaphoresWaitNodeGetParams = 622, + CUPTI_DRIVER_TRACE_CBID_cuGraphExternalSemaphoresWaitNodeSetParams = 623, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecExternalSemaphoresSignalNodeSetParams = 624, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecExternalSemaphoresWaitNodeSetParams = 625, + CUPTI_DRIVER_TRACE_CBID_cuGetProcAddress = 626, + CUPTI_DRIVER_TRACE_CBID_cuFlushGPUDirectRDMAWrites = 627, + CUPTI_DRIVER_TRACE_CBID_cuGraphDebugDotPrint = 628, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetCaptureInfo_v2 = 629, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetCaptureInfo_v2_ptsz = 630, + CUPTI_DRIVER_TRACE_CBID_cuStreamUpdateCaptureDependencies = 631, + CUPTI_DRIVER_TRACE_CBID_cuStreamUpdateCaptureDependencies_ptsz = 632, + CUPTI_DRIVER_TRACE_CBID_cuUserObjectCreate = 633, + CUPTI_DRIVER_TRACE_CBID_cuUserObjectRetain = 634, + CUPTI_DRIVER_TRACE_CBID_cuUserObjectRelease = 635, + CUPTI_DRIVER_TRACE_CBID_cuGraphRetainUserObject = 636, + CUPTI_DRIVER_TRACE_CBID_cuGraphReleaseUserObject = 637, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddMemAllocNode = 638, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddMemFreeNode = 639, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGraphMemTrim = 640, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetGraphMemAttribute = 641, + CUPTI_DRIVER_TRACE_CBID_cuDeviceSetGraphMemAttribute = 642, + CUPTI_DRIVER_TRACE_CBID_cuGraphInstantiateWithFlags = 643, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetExecAffinitySupport = 644, + CUPTI_DRIVER_TRACE_CBID_cuCtxCreate_v3 = 645, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetExecAffinity = 646, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetUuid_v2 = 647, + CUPTI_DRIVER_TRACE_CBID_cuGraphMemAllocNodeGetParams = 648, + CUPTI_DRIVER_TRACE_CBID_cuGraphMemFreeNodeGetParams = 649, + CUPTI_DRIVER_TRACE_CBID_cuGraphNodeSetEnabled = 650, + CUPTI_DRIVER_TRACE_CBID_cuGraphNodeGetEnabled = 651, + CUPTI_DRIVER_TRACE_CBID_cuLaunchKernelEx = 652, + CUPTI_DRIVER_TRACE_CBID_cuLaunchKernelEx_ptsz = 653, + CUPTI_DRIVER_TRACE_CBID_cuArrayGetMemoryRequirements = 654, + CUPTI_DRIVER_TRACE_CBID_cuMipmappedArrayGetMemoryRequirements = 655, + CUPTI_DRIVER_TRACE_CBID_cuGraphInstantiateWithParams = 656, + CUPTI_DRIVER_TRACE_CBID_cuGraphInstantiateWithParams_ptsz = 657, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecGetFlags = 658, + CUPTI_DRIVER_TRACE_CBID_cuStreamWaitValue32_v2 = 659, + CUPTI_DRIVER_TRACE_CBID_cuStreamWaitValue32_v2_ptsz = 660, + CUPTI_DRIVER_TRACE_CBID_cuStreamWaitValue64_v2 = 661, + CUPTI_DRIVER_TRACE_CBID_cuStreamWaitValue64_v2_ptsz = 662, + CUPTI_DRIVER_TRACE_CBID_cuStreamWriteValue32_v2 = 663, + CUPTI_DRIVER_TRACE_CBID_cuStreamWriteValue32_v2_ptsz = 664, + CUPTI_DRIVER_TRACE_CBID_cuStreamWriteValue64_v2 = 665, + CUPTI_DRIVER_TRACE_CBID_cuStreamWriteValue64_v2_ptsz = 666, + CUPTI_DRIVER_TRACE_CBID_cuStreamBatchMemOp_v2 = 667, + CUPTI_DRIVER_TRACE_CBID_cuStreamBatchMemOp_v2_ptsz = 668, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddBatchMemOpNode = 669, + CUPTI_DRIVER_TRACE_CBID_cuGraphBatchMemOpNodeGetParams = 670, + CUPTI_DRIVER_TRACE_CBID_cuGraphBatchMemOpNodeSetParams = 671, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecBatchMemOpNodeSetParams = 672, + CUPTI_DRIVER_TRACE_CBID_cuModuleGetLoadingMode = 673, + CUPTI_DRIVER_TRACE_CBID_cuMemGetHandleForAddressRange = 674, + CUPTI_DRIVER_TRACE_CBID_cuOccupancyMaxPotentialClusterSize = 675, + CUPTI_DRIVER_TRACE_CBID_cuOccupancyMaxActiveClusters = 676, + CUPTI_DRIVER_TRACE_CBID_cuGetProcAddress_v2 = 677, + CUPTI_DRIVER_TRACE_CBID_cuLibraryLoadData = 678, + CUPTI_DRIVER_TRACE_CBID_cuLibraryLoadFromFile = 679, + CUPTI_DRIVER_TRACE_CBID_cuLibraryUnload = 680, + CUPTI_DRIVER_TRACE_CBID_cuLibraryGetKernel = 681, + CUPTI_DRIVER_TRACE_CBID_cuLibraryGetModule = 682, + CUPTI_DRIVER_TRACE_CBID_cuKernelGetFunction = 683, + CUPTI_DRIVER_TRACE_CBID_cuLibraryGetGlobal = 684, + CUPTI_DRIVER_TRACE_CBID_cuLibraryGetManaged = 685, + CUPTI_DRIVER_TRACE_CBID_cuKernelGetAttribute = 686, + CUPTI_DRIVER_TRACE_CBID_cuKernelSetAttribute = 687, + CUPTI_DRIVER_TRACE_CBID_cuKernelSetCacheConfig = 688, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddKernelNode_v2 = 689, + CUPTI_DRIVER_TRACE_CBID_cuGraphKernelNodeGetParams_v2 = 690, + CUPTI_DRIVER_TRACE_CBID_cuGraphKernelNodeSetParams_v2 = 691, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecKernelNodeSetParams_v2 = 692, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetId = 693, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetId_ptsz = 694, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetId = 695, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecUpdate_v2 = 696, + CUPTI_DRIVER_TRACE_CBID_cuTensorMapEncodeTiled = 697, + CUPTI_DRIVER_TRACE_CBID_cuTensorMapEncodeIm2col = 698, + CUPTI_DRIVER_TRACE_CBID_cuTensorMapReplaceAddress = 699, + CUPTI_DRIVER_TRACE_CBID_cuLibraryGetUnifiedFunction = 700, + CUPTI_DRIVER_TRACE_CBID_cuCoredumpGetAttribute = 701, + CUPTI_DRIVER_TRACE_CBID_cuCoredumpGetAttributeGlobal = 702, + CUPTI_DRIVER_TRACE_CBID_cuCoredumpSetAttribute = 703, + CUPTI_DRIVER_TRACE_CBID_cuCoredumpSetAttributeGlobal = 704, + CUPTI_DRIVER_TRACE_CBID_cuCtxSetFlags = 705, + CUPTI_DRIVER_TRACE_CBID_cuMulticastCreate = 706, + CUPTI_DRIVER_TRACE_CBID_cuMulticastAddDevice = 707, + CUPTI_DRIVER_TRACE_CBID_cuMulticastBindMem = 708, + CUPTI_DRIVER_TRACE_CBID_cuMulticastBindAddr = 709, + CUPTI_DRIVER_TRACE_CBID_cuMulticastUnbind = 710, + CUPTI_DRIVER_TRACE_CBID_cuMulticastGetGranularity = 711, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddNode = 712, + CUPTI_DRIVER_TRACE_CBID_cuGraphNodeSetParams = 713, + CUPTI_DRIVER_TRACE_CBID_cuGraphExecNodeSetParams = 714, + CUPTI_DRIVER_TRACE_CBID_cuMemAdvise_v2 = 715, + CUPTI_DRIVER_TRACE_CBID_cuMemPrefetchAsync_v2 = 716, + CUPTI_DRIVER_TRACE_CBID_cuMemPrefetchAsync_v2_ptsz = 717, + CUPTI_DRIVER_TRACE_CBID_cuFuncGetName = 718, + CUPTI_DRIVER_TRACE_CBID_cuKernelGetName = 719, + CUPTI_DRIVER_TRACE_CBID_cuStreamBeginCaptureToGraph = 720, + CUPTI_DRIVER_TRACE_CBID_cuStreamBeginCaptureToGraph_ptsz = 721, + CUPTI_DRIVER_TRACE_CBID_cuGraphConditionalHandleCreate = 722, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddNode_v2 = 723, + CUPTI_DRIVER_TRACE_CBID_cuGraphGetEdges_v2 = 724, + CUPTI_DRIVER_TRACE_CBID_cuGraphNodeGetDependencies_v2 = 725, + CUPTI_DRIVER_TRACE_CBID_cuGraphNodeGetDependentNodes_v2 = 726, + CUPTI_DRIVER_TRACE_CBID_cuGraphAddDependencies_v2 = 727, + CUPTI_DRIVER_TRACE_CBID_cuGraphRemoveDependencies_v2 = 728, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetCaptureInfo_v3 = 729, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetCaptureInfo_v3_ptsz = 730, + CUPTI_DRIVER_TRACE_CBID_cuStreamUpdateCaptureDependencies_v2 = 731, + CUPTI_DRIVER_TRACE_CBID_cuStreamUpdateCaptureDependencies_v2_ptsz = 732, + CUPTI_DRIVER_TRACE_CBID_cuFuncGetParamInfo = 733, + CUPTI_DRIVER_TRACE_CBID_cuKernelGetParamInfo = 734, + CUPTI_DRIVER_TRACE_CBID_cuDeviceRegisterAsyncNotification = 735, + CUPTI_DRIVER_TRACE_CBID_cuDeviceUnregisterAsyncNotification = 736, + CUPTI_DRIVER_TRACE_CBID_cuModuleGetFunctionCount = 737, + CUPTI_DRIVER_TRACE_CBID_cuModuleEnumerateFunctions = 738, + CUPTI_DRIVER_TRACE_CBID_cuLibraryGetKernelCount = 739, + CUPTI_DRIVER_TRACE_CBID_cuLibraryEnumerateKernels = 740, + CUPTI_DRIVER_TRACE_CBID_cuFuncIsLoaded = 741, + CUPTI_DRIVER_TRACE_CBID_cuFuncLoad = 742, + CUPTI_DRIVER_TRACE_CBID_cuGreenCtxCreate = 743, + CUPTI_DRIVER_TRACE_CBID_cuGreenCtxDestroy = 744, + CUPTI_DRIVER_TRACE_CBID_cuDeviceGetDevResource = 745, + CUPTI_DRIVER_TRACE_CBID_cuCtxGetDevResource = 746, + CUPTI_DRIVER_TRACE_CBID_cuGreenCtxGetDevResource = 747, + CUPTI_DRIVER_TRACE_CBID_cuDevResourceGenerateDesc = 748, + CUPTI_DRIVER_TRACE_CBID_cuGreenCtxRecordEvent = 749, + CUPTI_DRIVER_TRACE_CBID_cuGreenCtxWaitEvent = 750, + CUPTI_DRIVER_TRACE_CBID_cuDevSmResourceSplitByCount = 751, + CUPTI_DRIVER_TRACE_CBID_cuStreamGetGreenCtx = 752, + CUPTI_DRIVER_TRACE_CBID_cuCtxFromGreenCtx = 753, + CUPTI_DRIVER_TRACE_CBID_SIZE = 754, + CUPTI_DRIVER_TRACE_CBID_FORCE_INT = 0x7fffffff +} CUpti_driver_api_trace_cbid; + diff --git a/cuda_toolkit/include/cupti_events.h b/cuda_toolkit/include/cupti_events.h new file mode 100644 index 0000000000000000000000000000000000000000..61a3c5f01925587558eb60b4ac83cffa0febe0e6 --- /dev/null +++ b/cuda_toolkit/include/cupti_events.h @@ -0,0 +1,1350 @@ +/* + * Copyright 2010-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(_CUPTI_EVENTS_H_) +#define _CUPTI_EVENTS_H_ + +#include +#include +#include +#include + +#ifndef CUPTIAPI +#ifdef _WIN32 +#define CUPTIAPI __stdcall +#else +#define CUPTIAPI +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +/** + * \defgroup CUPTI_EVENT_API CUPTI Event API + * Functions, types, and enums that implement the CUPTI Event API. + * + * \note CUPTI event API from the header cupti_events.h are not supported on devices + * with compute capability 7.5 and higher (i.e. Turing and later GPU architectures). + * These API will be deprecated in a future CUDA release. These are replaced by + * Profiling API in the header cupti_profiler_target.h and Perfworks metrics API + * in the headers nvperf_host.h and nvperf_target.h which are supported on + * devices with compute capability 7.0 and higher (i.e. Volta and later GPU + * architectures). + * + * @{ + */ + +/** + * \brief ID for an event. + * + * An event represents a countable activity, action, or occurrence on + * the device. + */ +typedef uint32_t CUpti_EventID; + +/** + * \brief ID for an event domain. + * + * ID for an event domain. An event domain represents a group of + * related events. A device may have multiple instances of a domain, + * indicating that the device can simultaneously record multiple + * instances of each event within that domain. + */ +typedef uint32_t CUpti_EventDomainID; + +/** + * \brief A group of events. + * + * An event group is a collection of events that are managed + * together. All events in an event group must belong to the same + * domain. + */ +typedef void *CUpti_EventGroup; + +/** + * \brief Device class. + * + * Enumeration of device classes for device attribute + * CUPTI_DEVICE_ATTR_DEVICE_CLASS. + */ +typedef enum { + CUPTI_DEVICE_ATTR_DEVICE_CLASS_TESLA = 0, + CUPTI_DEVICE_ATTR_DEVICE_CLASS_QUADRO = 1, + CUPTI_DEVICE_ATTR_DEVICE_CLASS_GEFORCE = 2, + CUPTI_DEVICE_ATTR_DEVICE_CLASS_TEGRA = 3, +} CUpti_DeviceAttributeDeviceClass; + +/** + * \brief Device attributes. + * + * CUPTI device attributes. These attributes can be read using \ref + * cuptiDeviceGetAttribute. + */ +typedef enum { + /** + * Number of event IDs for a device. Value is a uint32_t. + */ + CUPTI_DEVICE_ATTR_MAX_EVENT_ID = 1, + /** + * Number of event domain IDs for a device. Value is a uint32_t. + */ + CUPTI_DEVICE_ATTR_MAX_EVENT_DOMAIN_ID = 2, + /** + * Get global memory bandwidth in Kbytes/sec. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_GLOBAL_MEMORY_BANDWIDTH = 3, + /** + * Get theoretical maximum number of instructions per cycle. Value + * is a uint32_t. + */ + CUPTI_DEVICE_ATTR_INSTRUCTION_PER_CYCLE = 4, + /** + * Get theoretical maximum number of single precision instructions + * that can be executed per second. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_INSTRUCTION_THROUGHPUT_SINGLE_PRECISION = 5, + /** + * Get number of frame buffers for device. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_MAX_FRAME_BUFFERS = 6, + /** + * Get PCIE link rate in Mega bits/sec for device. Return 0 if bus-type + * is non-PCIE. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_PCIE_LINK_RATE = 7, + /** + * Get PCIE link width for device. Return 0 if bus-type + * is non-PCIE. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_PCIE_LINK_WIDTH = 8, + /** + * Get PCIE generation for device. Return 0 if bus-type + * is non-PCIE. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_PCIE_GEN = 9, + /** + * Get the class for the device. Value is a + * CUpti_DeviceAttributeDeviceClass. + */ + CUPTI_DEVICE_ATTR_DEVICE_CLASS = 10, + /** + * Get the peak single precision flop per cycle. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_FLOP_SP_PER_CYCLE = 11, + /** + * Get the peak double precision flop per cycle. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_FLOP_DP_PER_CYCLE = 12, + /** + * Get number of L2 units. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_MAX_L2_UNITS = 13, + /** + * Get the maximum shared memory for the CU_FUNC_CACHE_PREFER_SHARED + * preference. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_MAX_SHARED_MEMORY_CACHE_CONFIG_PREFER_SHARED = 14, + /** + * Get the maximum shared memory for the CU_FUNC_CACHE_PREFER_L1 + * preference. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_MAX_SHARED_MEMORY_CACHE_CONFIG_PREFER_L1 = 15, + /** + * Get the maximum shared memory for the CU_FUNC_CACHE_PREFER_EQUAL + * preference. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_MAX_SHARED_MEMORY_CACHE_CONFIG_PREFER_EQUAL = 16, + /** + * Get the peak half precision flop per cycle. Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_FLOP_HP_PER_CYCLE = 17, + /** + * Check if Nvlink is connected to device. Returns 1, if at least one + * Nvlink is connected to the device, returns 0 otherwise. + * Value is a uint32_t. + */ + CUPTI_DEVICE_ATTR_NVLINK_PRESENT = 18, + /** + * Check if Nvlink is present between GPU and CPU. Returns Bandwidth, + * in Bytes/sec, if Nvlink is present, returns 0 otherwise. + * Value is a uint64_t. + */ + CUPTI_DEVICE_ATTR_GPU_CPU_NVLINK_BW = 19, + /** + * Check if NVSwitch is present in the underlying topology. + * Returns 1, if present, returns 0 otherwise. + * Value is a uint32_t. + */ + CUPTI_DEVICE_ATTR_NVSWITCH_PRESENT = 20, + CUPTI_DEVICE_ATTR_FORCE_INT = 0x7fffffff, +} CUpti_DeviceAttribute; + +/** + * \brief Event domain attributes. + * + * Event domain attributes. Except where noted, all the attributes can + * be read using either \ref cuptiDeviceGetEventDomainAttribute or + * \ref cuptiEventDomainGetAttribute. + */ +typedef enum { + /** + * Event domain name. Value is a null terminated const c-string. + */ + CUPTI_EVENT_DOMAIN_ATTR_NAME = 0, + /** + * Number of instances of the domain for which event counts will be + * collected. The domain may have additional instances that cannot + * be profiled (see CUPTI_EVENT_DOMAIN_ATTR_TOTAL_INSTANCE_COUNT). + * Can be read only with \ref + * cuptiDeviceGetEventDomainAttribute. Value is a uint32_t. + */ + CUPTI_EVENT_DOMAIN_ATTR_INSTANCE_COUNT = 1, + /** + * Total number of instances of the domain, including instances that + * cannot be profiled. Use CUPTI_EVENT_DOMAIN_ATTR_INSTANCE_COUNT + * to get the number of instances that can be profiled. Can be read + * only with \ref cuptiDeviceGetEventDomainAttribute. Value is a + * uint32_t. + */ + CUPTI_EVENT_DOMAIN_ATTR_TOTAL_INSTANCE_COUNT = 3, + /** + * Collection method used for events contained in the event domain. + * Value is a \ref CUpti_EventCollectionMethod. + */ + CUPTI_EVENT_DOMAIN_ATTR_COLLECTION_METHOD = 4, + + CUPTI_EVENT_DOMAIN_ATTR_FORCE_INT = 0x7fffffff, +} CUpti_EventDomainAttribute; + +/** + * \brief The collection method used for an event. + * + * The collection method indicates how an event is collected. + */ +typedef enum { + /** + * Event is collected using a hardware global performance monitor. + */ + CUPTI_EVENT_COLLECTION_METHOD_PM = 0, + /** + * Event is collected using a hardware SM performance monitor. + */ + CUPTI_EVENT_COLLECTION_METHOD_SM = 1, + /** + * Event is collected using software instrumentation. + */ + CUPTI_EVENT_COLLECTION_METHOD_INSTRUMENTED = 2, + /** + * Event is collected using NvLink throughput counter method. + */ + CUPTI_EVENT_COLLECTION_METHOD_NVLINK_TC = 3, + CUPTI_EVENT_COLLECTION_METHOD_FORCE_INT = 0x7fffffff +} CUpti_EventCollectionMethod; + +/** + * \brief Event group attributes. + * + * Event group attributes. These attributes can be read using \ref + * cuptiEventGroupGetAttribute. Attributes marked [rw] can also be + * written using \ref cuptiEventGroupSetAttribute. + */ +typedef enum { + /** + * The domain to which the event group is bound. This attribute is + * set when the first event is added to the group. Value is a + * CUpti_EventDomainID. + */ + CUPTI_EVENT_GROUP_ATTR_EVENT_DOMAIN_ID = 0, + /** + * [rw] Profile all the instances of the domain for this + * eventgroup. This feature can be used to get load balancing + * across all instances of a domain. Value is an integer. + */ + CUPTI_EVENT_GROUP_ATTR_PROFILE_ALL_DOMAIN_INSTANCES = 1, + /** + * [rw] Reserved for user data. + */ + CUPTI_EVENT_GROUP_ATTR_USER_DATA = 2, + /** + * Number of events in the group. Value is a uint32_t. + */ + CUPTI_EVENT_GROUP_ATTR_NUM_EVENTS = 3, + /** + * Enumerates events in the group. Value is a pointer to buffer of + * size sizeof(CUpti_EventID) * num_of_events in the eventgroup. + * num_of_events can be queried using + * CUPTI_EVENT_GROUP_ATTR_NUM_EVENTS. + */ + CUPTI_EVENT_GROUP_ATTR_EVENTS = 4, + /** + * Number of instances of the domain bound to this event group that + * will be counted. Value is a uint32_t. + */ + CUPTI_EVENT_GROUP_ATTR_INSTANCE_COUNT = 5, + /** + * Event group scope can be set to CUPTI_EVENT_PROFILING_SCOPE_DEVICE or + * CUPTI_EVENT_PROFILING_SCOPE_CONTEXT for an eventGroup, before + * adding any event. + * Sets the scope of eventgroup as CUPTI_EVENT_PROFILING_SCOPE_DEVICE or + * CUPTI_EVENT_PROFILING_SCOPE_CONTEXT when the scope of the events + * that will be added is CUPTI_EVENT_PROFILING_SCOPE_BOTH. + * If profiling scope of event is either + * CUPTI_EVENT_PROFILING_SCOPE_DEVICE or CUPTI_EVENT_PROFILING_SCOPE_CONTEXT + * then setting this attribute will not affect the default scope. + * It is not allowed to add events of different scope to same eventgroup. + * Value is a uint32_t. + */ + CUPTI_EVENT_GROUP_ATTR_PROFILING_SCOPE = 6, + CUPTI_EVENT_GROUP_ATTR_FORCE_INT = 0x7fffffff, +} CUpti_EventGroupAttribute; + +/** +* \brief Profiling scope for event. +* +* Profiling scope of event indicates if the event can be collected at context +* scope or device scope or both i.e. it can be collected at any of context or +* device scope. +*/ +typedef enum { + /** + * Event is collected at context scope. + */ + CUPTI_EVENT_PROFILING_SCOPE_CONTEXT = 0, + /** + * Event is collected at device scope. + */ + CUPTI_EVENT_PROFILING_SCOPE_DEVICE = 1, + /** + * Event can be collected at device or context scope. + * The scope can be set using \ref cuptiEventGroupSetAttribute API. + */ + CUPTI_EVENT_PROFILING_SCOPE_BOTH = 2, + CUPTI_EVENT_PROFILING_SCOPE_FORCE_INT = 0x7fffffff +} CUpti_EventProfilingScope; + +/** + * \brief Event attributes. + * + * Event attributes. These attributes can be read using \ref + * cuptiEventGetAttribute. + */ +typedef enum { + /** + * Event name. Value is a null terminated const c-string. + */ + CUPTI_EVENT_ATTR_NAME = 0, + /** + * Short description of event. Value is a null terminated const + * c-string. + */ + CUPTI_EVENT_ATTR_SHORT_DESCRIPTION = 1, + /** + * Long description of event. Value is a null terminated const + * c-string. + */ + CUPTI_EVENT_ATTR_LONG_DESCRIPTION = 2, + /** + * Category of event. Value is CUpti_EventCategory. + */ + CUPTI_EVENT_ATTR_CATEGORY = 3, + /** + * Profiling scope of the events. It can be either device or context or both. + * Value is a \ref CUpti_EventProfilingScope. + */ + CUPTI_EVENT_ATTR_PROFILING_SCOPE = 5, + + CUPTI_EVENT_ATTR_FORCE_INT = 0x7fffffff, +} CUpti_EventAttribute; + +/** + * \brief Event collection modes. + * + * The event collection mode determines the period over which the + * events within the enabled event groups will be collected. + */ +typedef enum { + /** + * Events are collected for the entire duration between the + * cuptiEventGroupEnable and cuptiEventGroupDisable calls. + * Event values are reset when the events are read. + * For CUDA toolkit v6.0 and older this was the default mode. + */ + CUPTI_EVENT_COLLECTION_MODE_CONTINUOUS = 0, + /** + * Events are collected only for the durations of kernel executions + * that occur between the cuptiEventGroupEnable and + * cuptiEventGroupDisable calls. Event collection begins when a + * kernel execution begins, and stops when kernel execution + * completes. Event values are reset to zero when each kernel + * execution begins. If multiple kernel executions occur between the + * cuptiEventGroupEnable and cuptiEventGroupDisable calls then the + * event values must be read after each kernel launch if those + * events need to be associated with the specific kernel launch. + * Note that collection in this mode may significantly change the + * overall performance characteristics of the application because + * kernel executions that occur between the cuptiEventGroupEnable and + * cuptiEventGroupDisable calls are serialized on the GPU. + * This is the default mode from CUDA toolkit v6.5 + */ + CUPTI_EVENT_COLLECTION_MODE_KERNEL = 1, + CUPTI_EVENT_COLLECTION_MODE_FORCE_INT = 0x7fffffff +} CUpti_EventCollectionMode; + +/** + * \brief An event category. + * + * Each event is assigned to a category that represents the general + * type of the event. A event's category is accessed using \ref + * cuptiEventGetAttribute and the CUPTI_EVENT_ATTR_CATEGORY attribute. + */ +typedef enum { + /** + * An instruction related event. + */ + CUPTI_EVENT_CATEGORY_INSTRUCTION = 0, + /** + * A memory related event. + */ + CUPTI_EVENT_CATEGORY_MEMORY = 1, + /** + * A cache related event. + */ + CUPTI_EVENT_CATEGORY_CACHE = 2, + /** + * A profile-trigger event. + */ + CUPTI_EVENT_CATEGORY_PROFILE_TRIGGER = 3, + /** + * A system event. + */ + CUPTI_EVENT_CATEGORY_SYSTEM = 4, + CUPTI_EVENT_CATEGORY_FORCE_INT = 0x7fffffff +} CUpti_EventCategory; + +/** + * \brief The overflow value for a CUPTI event. + * + * The CUPTI event value that indicates an overflow. + */ +#define CUPTI_EVENT_OVERFLOW ((uint64_t)0xFFFFFFFFFFFFFFFFULL) + +/** + * \brief The value that indicates the event value is invalid + */ +#define CUPTI_EVENT_INVALID ((uint64_t)0xFFFFFFFFFFFFFFFEULL) + +/** + * \brief Flags for cuptiEventGroupReadEvent an + * cuptiEventGroupReadAllEvents. + * + * Flags for \ref cuptiEventGroupReadEvent an \ref + * cuptiEventGroupReadAllEvents. + */ +typedef enum { + /** + * No flags. + */ + CUPTI_EVENT_READ_FLAG_NONE = 0, + CUPTI_EVENT_READ_FLAG_FORCE_INT = 0x7fffffff, +} CUpti_ReadEventFlags; + + +/** + * \brief A set of event groups. + * + * A set of event groups. When returned by \ref + * cuptiEventGroupSetsCreate and \ref cuptiMetricCreateEventGroupSets + * a set indicates that event groups that can be enabled at the same + * time (i.e. all the events in the set can be collected + * simultaneously). + */ +typedef struct { + /** + * The number of event groups in the set. + */ + uint32_t numEventGroups; + /** + * An array of \p numEventGroups event groups. + */ + CUpti_EventGroup *eventGroups; +} CUpti_EventGroupSet; + +/** + * \brief A set of event group sets. + * + * A set of event group sets. When returned by \ref + * cuptiEventGroupSetsCreate and \ref cuptiMetricCreateEventGroupSets + * a CUpti_EventGroupSets indicates the number of passes required to + * collect all the events, and the event groups that should be + * collected during each pass. + */ +typedef struct { + /** + * Number of event group sets. + */ + uint32_t numSets; + /** + * An array of \p numSets event group sets. + */ + CUpti_EventGroupSet *sets; +} CUpti_EventGroupSets; + +/** + * \brief Set the event collection mode. + * + * Set the event collection mode for a \p context. The \p mode + * controls the event collection behavior of all events in event + * groups created in the \p context. This API is invalid in kernel + * replay mode. + * \note \b Thread-safety: this function is thread safe. + * + * \param context The context + * \param mode The event collection mode + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_CONTEXT + * \retval CUPTI_ERROR_INVALID_OPERATION if called when replay mode is enabled + * \retval CUPTI_ERROR_NOT_SUPPORTED if mode is not supported on the device + */ + +CUptiResult CUPTIAPI cuptiSetEventCollectionMode(CUcontext context, + CUpti_EventCollectionMode mode); + +/** + * \brief Read a device attribute. + * + * Read a device attribute and return it in \p *value. + * \note \b Thread-safety: this function is thread safe. + * + * \param device The CUDA device + * \param attrib The attribute to read + * \param valueSize Size of buffer pointed by the value, and + * returns the number of bytes written to \p value + * \param value Returns the value of the attribute + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_DEVICE + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p valueSize or \p value + * is NULL, or if \p attrib is not a device attribute + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT For non-c-string + * attribute values, indicates that the \p value buffer is too small + * to hold the attribute value. + */ +CUptiResult CUPTIAPI cuptiDeviceGetAttribute(CUdevice device, + CUpti_DeviceAttribute attrib, + size_t *valueSize, + void *value); + +/** + * \brief Get the number of domains for a device. + * + * Returns the number of domains in \p numDomains for a device. + * \note \b Thread-safety: this function is thread safe. + * + * \param device The CUDA device + * \param numDomains Returns the number of domains + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_DEVICE + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p numDomains is NULL + */ +CUptiResult CUPTIAPI cuptiDeviceGetNumEventDomains(CUdevice device, + uint32_t *numDomains); + +/** + * \brief Get the event domains for a device. + * + * Returns the event domains IDs in \p domainArray for a device. The + * size of the \p domainArray buffer is given by \p + * *arraySizeBytes. The size of the \p domainArray buffer must be at + * least \p numdomains * sizeof(CUpti_EventDomainID) or else all + * domains will not be returned. The value returned in \p + * *arraySizeBytes contains the number of bytes returned in \p + * domainArray. + * \note \b Thread-safety: this function is thread safe. + * + * \param device The CUDA device + * \param arraySizeBytes The size of \p domainArray in bytes, and + * returns the number of bytes written to \p domainArray + * \param domainArray Returns the IDs of the event domains for the device + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_DEVICE + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p arraySizeBytes or + * \p domainArray are NULL + */ +CUptiResult CUPTIAPI cuptiDeviceEnumEventDomains(CUdevice device, + size_t *arraySizeBytes, + CUpti_EventDomainID *domainArray); + +/** + * \brief Read an event domain attribute. + * + * Returns an event domain attribute in \p *value. The size of the \p + * value buffer is given by \p *valueSize. The value returned in \p + * *valueSize contains the number of bytes returned in \p value. + * + * If the attribute value is a c-string that is longer than \p + * *valueSize, then only the first \p *valueSize characters will be + * returned and there will be no terminating null byte. + * \note \b Thread-safety: this function is thread safe. + * + * \param device The CUDA device + * \param eventDomain ID of the event domain + * \param attrib The event domain attribute to read + * \param valueSize The size of the \p value buffer in bytes, and + * returns the number of bytes written to \p value + * \param value Returns the attribute's value + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_DEVICE + * \retval CUPTI_ERROR_INVALID_EVENT_DOMAIN_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p valueSize or \p value + * is NULL, or if \p attrib is not an event domain attribute + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT For non-c-string + * attribute values, indicates that the \p value buffer is too small + * to hold the attribute value. + */ +CUptiResult CUPTIAPI cuptiDeviceGetEventDomainAttribute(CUdevice device, + CUpti_EventDomainID eventDomain, + CUpti_EventDomainAttribute attrib, + size_t *valueSize, + void *value); + +/** + * \brief Get the number of event domains available on any device. + * + * Returns the total number of event domains available on any + * CUDA-capable device. + * \note \b Thread-safety: this function is thread safe. + * + * \param numDomains Returns the number of domains + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p numDomains is NULL + */ +CUptiResult CUPTIAPI cuptiGetNumEventDomains(uint32_t *numDomains); + +/** + * \brief Get the event domains available on any device. + * + * Returns all the event domains available on any CUDA-capable device. + * Event domain IDs are returned in \p domainArray. The size of the \p + * domainArray buffer is given by \p *arraySizeBytes. The size of the + * \p domainArray buffer must be at least \p numDomains * + * sizeof(CUpti_EventDomainID) or all domains will not be + * returned. The value returned in \p *arraySizeBytes contains the + * number of bytes returned in \p domainArray. + * \note \b Thread-safety: this function is thread safe. + * + * \param arraySizeBytes The size of \p domainArray in bytes, and + * returns the number of bytes written to \p domainArray + * \param domainArray Returns all the event domains + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p arraySizeBytes or + * \p domainArray are NULL + */ +CUptiResult CUPTIAPI cuptiEnumEventDomains(size_t *arraySizeBytes, + CUpti_EventDomainID *domainArray); + +/** + * \brief Read an event domain attribute. + * + * Returns an event domain attribute in \p *value. The size of the \p + * value buffer is given by \p *valueSize. The value returned in \p + * *valueSize contains the number of bytes returned in \p value. + * + * If the attribute value is a c-string that is longer than \p + * *valueSize, then only the first \p *valueSize characters will be + * returned and there will be no terminating null byte. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventDomain ID of the event domain + * \param attrib The event domain attribute to read + * \param valueSize The size of the \p value buffer in bytes, and + * returns the number of bytes written to \p value + * \param value Returns the attribute's value + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_EVENT_DOMAIN_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p valueSize or \p value + * is NULL, or if \p attrib is not an event domain attribute + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT For non-c-string + * attribute values, indicates that the \p value buffer is too small + * to hold the attribute value. + */ +CUptiResult CUPTIAPI cuptiEventDomainGetAttribute(CUpti_EventDomainID eventDomain, + CUpti_EventDomainAttribute attrib, + size_t *valueSize, + void *value); + +/** + * \brief Get number of events in a domain. + * + * Returns the number of events in \p numEvents for a domain. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventDomain ID of the event domain + * \param numEvents Returns the number of events in the domain + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_EVENT_DOMAIN_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p numEvents is NULL + */ +CUptiResult CUPTIAPI cuptiEventDomainGetNumEvents(CUpti_EventDomainID eventDomain, + uint32_t *numEvents); + +/** + * \brief Get the events in a domain. + * + * Returns the event IDs in \p eventArray for a domain. The size of + * the \p eventArray buffer is given by \p *arraySizeBytes. The size + * of the \p eventArray buffer must be at least \p numdomainevents * + * sizeof(CUpti_EventID) or else all events will not be returned. The + * value returned in \p *arraySizeBytes contains the number of bytes + * returned in \p eventArray. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventDomain ID of the event domain + * \param arraySizeBytes The size of \p eventArray in bytes, and + * returns the number of bytes written to \p eventArray + * \param eventArray Returns the IDs of the events in the domain + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_EVENT_DOMAIN_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p arraySizeBytes or \p + * eventArray are NULL + */ +CUptiResult CUPTIAPI cuptiEventDomainEnumEvents(CUpti_EventDomainID eventDomain, + size_t *arraySizeBytes, + CUpti_EventID *eventArray); + +/** + * \brief Get an event attribute. + * + * Returns an event attribute in \p *value. The size of the \p + * value buffer is given by \p *valueSize. The value returned in \p + * *valueSize contains the number of bytes returned in \p value. + * + * If the attribute value is a c-string that is longer than \p + * *valueSize, then only the first \p *valueSize characters will be + * returned and there will be no terminating null byte. + * \note \b Thread-safety: this function is thread safe. + * + * \param event ID of the event + * \param attrib The event attribute to read + * \param valueSize The size of the \p value buffer in bytes, and + * returns the number of bytes written to \p value + * \param value Returns the attribute's value + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_EVENT_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p valueSize or \p value + * is NULL, or if \p attrib is not an event attribute + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT For non-c-string + * attribute values, indicates that the \p value buffer is too small + * to hold the attribute value. + */ +CUptiResult CUPTIAPI cuptiEventGetAttribute(CUpti_EventID event, + CUpti_EventAttribute attrib, + size_t *valueSize, + void *value); + +/** + * \brief Find an event by name. + * + * Find an event by name and return the event ID in \p *event. + * \note \b Thread-safety: this function is thread safe. + * + * \param device The CUDA device + * \param eventName The name of the event to find + * \param event Returns the ID of the found event or undefined if + * unable to find the event + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_DEVICE + * \retval CUPTI_ERROR_INVALID_EVENT_NAME if unable to find an event + * with name \p eventName. In this case \p *event is undefined + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventName or \p event are NULL + */ +CUptiResult CUPTIAPI cuptiEventGetIdFromName(CUdevice device, + const char *eventName, + CUpti_EventID *event); + +/** + * \brief Create a new event group for a context. + * + * Creates a new event group for \p context and returns the new group + * in \p *eventGroup. + * \note \p flags are reserved for future use and should be set to zero. + * \note \b Thread-safety: this function is thread safe. + * + * \param context The context for the event group + * \param eventGroup Returns the new event group + * \param flags Reserved - must be zero + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_CONTEXT + * \retval CUPTI_ERROR_OUT_OF_MEMORY + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroup is NULL + */ +CUptiResult CUPTIAPI cuptiEventGroupCreate(CUcontext context, + CUpti_EventGroup *eventGroup, + uint32_t flags); + +/** + * \brief Destroy an event group. + * + * Destroy an \p eventGroup and free its resources. An event group + * cannot be destroyed if it is enabled. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventGroup The event group to destroy + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_OPERATION if the event group is enabled + * \retval CUPTI_ERROR_INVALID_PARAMETER if eventGroup is NULL + */ +CUptiResult CUPTIAPI cuptiEventGroupDestroy(CUpti_EventGroup eventGroup); + +/** + * \brief Read an event group attribute. + * + * Read an event group attribute and return it in \p *value. + * \note \b Thread-safety: this function is thread safe but client + * must guard against simultaneous destruction or modification of \p + * eventGroup (for example, client must guard against simultaneous + * calls to \ref cuptiEventGroupDestroy, \ref cuptiEventGroupAddEvent, + * etc.), and must guard against simultaneous destruction of the + * context in which \p eventGroup was created (for example, client + * must guard against simultaneous calls to cudaDeviceReset, + * cuCtxDestroy, etc.). + * + * \param eventGroup The event group + * \param attrib The attribute to read + * \param valueSize Size of buffer pointed by the value, and + * returns the number of bytes written to \p value + * \param value Returns the value of the attribute + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p valueSize or \p value + * is NULL, or if \p attrib is not an eventgroup attribute + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT For non-c-string + * attribute values, indicates that the \p value buffer is too small + * to hold the attribute value. + */ +CUptiResult CUPTIAPI cuptiEventGroupGetAttribute(CUpti_EventGroup eventGroup, + CUpti_EventGroupAttribute attrib, + size_t *valueSize, + void *value); + +/** + * \brief Write an event group attribute. + * + * Write an event group attribute. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventGroup The event group + * \param attrib The attribute to write + * \param valueSize The size, in bytes, of the value + * \param value The attribute value to write + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p valueSize or \p value + * is NULL, or if \p attrib is not an event group attribute, or if + * \p attrib is not a writable attribute + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT Indicates that + * the \p value buffer is too small to hold the attribute value. + */ +CUptiResult CUPTIAPI cuptiEventGroupSetAttribute(CUpti_EventGroup eventGroup, + CUpti_EventGroupAttribute attrib, + size_t valueSize, + void *value); + +/** + * \brief Add an event to an event group. + * + * Add an event to an event group. The event add can fail for a number of reasons: + * \li The event group is enabled + * \li The event does not belong to the same event domain as the + * events that are already in the event group + * \li Device limitations on the events that can belong to the same group + * \li The event group is full + * + * \note \b Thread-safety: this function is thread safe. + * + * \param eventGroup The event group + * \param event The event to add to the group + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_EVENT_ID + * \retval CUPTI_ERROR_OUT_OF_MEMORY + * \retval CUPTI_ERROR_INVALID_OPERATION if \p eventGroup is enabled + * \retval CUPTI_ERROR_NOT_COMPATIBLE if \p event belongs to a + * different event domain than the events already in \p eventGroup, or + * if a device limitation prevents \p event from being collected at + * the same time as the events already in \p eventGroup + * \retval CUPTI_ERROR_MAX_LIMIT_REACHED if \p eventGroup is full + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroup is NULL + */ +CUptiResult CUPTIAPI cuptiEventGroupAddEvent(CUpti_EventGroup eventGroup, + CUpti_EventID event); + +/** + * \brief Remove an event from an event group. + * + * Remove \p event from the an event group. The event cannot be + * removed if the event group is enabled. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventGroup The event group + * \param event The event to remove from the group + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_EVENT_ID + * \retval CUPTI_ERROR_INVALID_OPERATION if \p eventGroup is enabled + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroup is NULL + */ +CUptiResult CUPTIAPI cuptiEventGroupRemoveEvent(CUpti_EventGroup eventGroup, + CUpti_EventID event); + +/** + * \brief Remove all events from an event group. + * + * Remove all events from an event group. Events cannot be removed if + * the event group is enabled. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventGroup The event group + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_OPERATION if \p eventGroup is enabled + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroup is NULL + */ +CUptiResult CUPTIAPI cuptiEventGroupRemoveAllEvents(CUpti_EventGroup eventGroup); + +/** + * \brief Zero all the event counts in an event group. + * + * Zero all the event counts in an event group. + * \note \b Thread-safety: this function is thread safe but client + * must guard against simultaneous destruction or modification of \p + * eventGroup (for example, client must guard against simultaneous + * calls to \ref cuptiEventGroupDestroy, \ref cuptiEventGroupAddEvent, + * etc.), and must guard against simultaneous destruction of the + * context in which \p eventGroup was created (for example, client + * must guard against simultaneous calls to cudaDeviceReset, + * cuCtxDestroy, etc.). + * + * \param eventGroup The event group + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_HARDWARE + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroup is NULL + */ +CUptiResult CUPTIAPI cuptiEventGroupResetAllEvents(CUpti_EventGroup eventGroup); + +/** + * \brief Enable an event group. + * + * Enable an event group. Enabling an event group zeros the value of + * all the events in the group and then starts collection of those + * events. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventGroup The event group + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_HARDWARE + * \retval CUPTI_ERROR_NOT_READY if \p eventGroup does not contain any events + * \retval CUPTI_ERROR_NOT_COMPATIBLE if \p eventGroup cannot be + * enabled due to other already enabled event groups + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroup is NULL + * \retval CUPTI_ERROR_HARDWARE_BUSY if another client is profiling + * and hardware is busy + */ +CUptiResult CUPTIAPI cuptiEventGroupEnable(CUpti_EventGroup eventGroup); + +/** + * \brief Disable an event group. + * + * Disable an event group. Disabling an event group stops collection + * of events contained in the group. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventGroup The event group + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_HARDWARE + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroup is NULL + */ +CUptiResult CUPTIAPI cuptiEventGroupDisable(CUpti_EventGroup eventGroup); + +/** + * \brief Read the value for an event in an event group. + * + * Read the value for an event in an event group. The event value is + * returned in the \p eventValueBuffer buffer. \p + * eventValueBufferSizeBytes indicates the size of the \p + * eventValueBuffer buffer. The buffer must be at least sizeof(uint64) + * if ::CUPTI_EVENT_GROUP_ATTR_PROFILE_ALL_DOMAIN_INSTANCES is not set + * on the group containing the event. The buffer must be at least + * (sizeof(uint64) * number of domain instances) if + * ::CUPTI_EVENT_GROUP_ATTR_PROFILE_ALL_DOMAIN_INSTANCES is set on the + * group. + * + * If any instance of an event counter overflows, the value returned + * for that event instance will be ::CUPTI_EVENT_OVERFLOW. + * + * The only allowed value for \p flags is ::CUPTI_EVENT_READ_FLAG_NONE. + * + * Reading an event from a disabled event group is not allowed. After + * being read, an event's value is reset to zero. + * \note \b Thread-safety: this function is thread safe but client + * must guard against simultaneous destruction or modification of \p + * eventGroup (for example, client must guard against simultaneous + * calls to \ref cuptiEventGroupDestroy, \ref cuptiEventGroupAddEvent, + * etc.), and must guard against simultaneous destruction of the + * context in which \p eventGroup was created (for example, client + * must guard against simultaneous calls to cudaDeviceReset, + * cuCtxDestroy, etc.). If \ref cuptiEventGroupResetAllEvents is + * called simultaneously with this function, then returned event + * values are undefined. + * + * \param eventGroup The event group + * \param flags Flags controlling the reading mode + * \param event The event to read + * \param eventValueBufferSizeBytes The size of \p eventValueBuffer + * in bytes, and returns the number of bytes written to \p + * eventValueBuffer + * \param eventValueBuffer Returns the event value(s) + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_EVENT_ID + * \retval CUPTI_ERROR_HARDWARE + * \retval CUPTI_ERROR_INVALID_OPERATION if \p eventGroup is disabled + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroup, \p + * eventValueBufferSizeBytes or \p eventValueBuffer is NULL + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT if size of \p eventValueBuffer + * is not sufficient + */ +CUptiResult CUPTIAPI cuptiEventGroupReadEvent(CUpti_EventGroup eventGroup, + CUpti_ReadEventFlags flags, + CUpti_EventID event, + size_t *eventValueBufferSizeBytes, + uint64_t *eventValueBuffer); + +/** + * \brief Read the values for all the events in an event group. + * + * Read the values for all the events in an event group. The event + * values are returned in the \p eventValueBuffer buffer. \p + * eventValueBufferSizeBytes indicates the size of \p + * eventValueBuffer. The buffer must be at least (sizeof(uint64) * + * number of events in group) if + * ::CUPTI_EVENT_GROUP_ATTR_PROFILE_ALL_DOMAIN_INSTANCES is not set on + * the group containing the events. The buffer must be at least + * (sizeof(uint64) * number of domain instances * number of events in + * group) if ::CUPTI_EVENT_GROUP_ATTR_PROFILE_ALL_DOMAIN_INSTANCES is + * set on the group. + * + * The data format returned in \p eventValueBuffer is: + * - domain instance 0: event0 event1 ... eventN + * - domain instance 1: event0 event1 ... eventN + * - ... + * - domain instance M: event0 event1 ... eventN + * + * The event order in \p eventValueBuffer is returned in \p + * eventIdArray. The size of \p eventIdArray is specified in \p + * eventIdArraySizeBytes. The size should be at least + * (sizeof(CUpti_EventID) * number of events in group). + * + * If any instance of any event counter overflows, the value returned + * for that event instance will be ::CUPTI_EVENT_OVERFLOW. + * + * The only allowed value for \p flags is ::CUPTI_EVENT_READ_FLAG_NONE. + * + * Reading events from a disabled event group is not allowed. After + * being read, an event's value is reset to zero. + * \note \b Thread-safety: this function is thread safe but client + * must guard against simultaneous destruction or modification of \p + * eventGroup (for example, client must guard against simultaneous + * calls to \ref cuptiEventGroupDestroy, \ref cuptiEventGroupAddEvent, + * etc.), and must guard against simultaneous destruction of the + * context in which \p eventGroup was created (for example, client + * must guard against simultaneous calls to cudaDeviceReset, + * cuCtxDestroy, etc.). If \ref cuptiEventGroupResetAllEvents is + * called simultaneously with this function, then returned event + * values are undefined. + * + * \param eventGroup The event group + * \param flags Flags controlling the reading mode + * \param eventValueBufferSizeBytes The size of \p eventValueBuffer in + * bytes, and returns the number of bytes written to \p + * eventValueBuffer + * \param eventValueBuffer Returns the event values + * \param eventIdArraySizeBytes The size of \p eventIdArray in bytes, + * and returns the number of bytes written to \p eventIdArray + * \param eventIdArray Returns the IDs of the events in the same order + * as the values return in eventValueBuffer. + * \param numEventIdsRead Returns the number of event IDs returned + * in \p eventIdArray + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_HARDWARE + * \retval CUPTI_ERROR_INVALID_OPERATION if \p eventGroup is disabled + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroup, \p + * eventValueBufferSizeBytes, \p eventValueBuffer, \p + * eventIdArraySizeBytes, \p eventIdArray or \p numEventIdsRead is + * NULL + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT if size of \p eventValueBuffer + * or \p eventIdArray is not sufficient + */ +CUptiResult CUPTIAPI cuptiEventGroupReadAllEvents(CUpti_EventGroup eventGroup, + CUpti_ReadEventFlags flags, + size_t *eventValueBufferSizeBytes, + uint64_t *eventValueBuffer, + size_t *eventIdArraySizeBytes, + CUpti_EventID *eventIdArray, + size_t *numEventIdsRead); + +/** + * \brief For a set of events, get the grouping that indicates the + * number of passes and the event groups necessary to collect the + * events. + * + * The number of events that can be collected simultaneously varies by + * device and by the type of the events. When events can be collected + * simultaneously, they may need to be grouped into multiple event + * groups because they are from different event domains. This function + * takes a set of events and determines how many passes are required + * to collect all those events, and which events can be collected + * simultaneously in each pass. + * + * The CUpti_EventGroupSets returned in \p eventGroupPasses indicates + * how many passes are required to collect the events with the \p + * numSets field. Within each event group set, the \p sets array + * indicates the event groups that should be collected on each pass. + * \note \b Thread-safety: this function is thread safe, but client + * must guard against another thread simultaneously destroying \p + * context. + * + * \param context The context for event collection + * \param eventIdArraySizeBytes Size of \p eventIdArray in bytes + * \param eventIdArray Array of event IDs that need to be grouped + * \param eventGroupPasses Returns a CUpti_EventGroupSets object that + * indicates the number of passes required to collect the events and + * the events to collect on each pass + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_CONTEXT + * \retval CUPTI_ERROR_INVALID_EVENT_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventIdArray or + * \p eventGroupPasses is NULL + */ +CUptiResult CUPTIAPI cuptiEventGroupSetsCreate(CUcontext context, + size_t eventIdArraySizeBytes, + CUpti_EventID *eventIdArray, + CUpti_EventGroupSets **eventGroupPasses); + +/** + * \brief Destroy a event group sets object. + * + * Destroy a CUpti_EventGroupSets object. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventGroupSets The object to destroy + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_OPERATION if any of the event groups + * contained in the sets is enabled + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroupSets is NULL + */ +CUptiResult CUPTIAPI cuptiEventGroupSetsDestroy(CUpti_EventGroupSets *eventGroupSets); + + +/** + * \brief Enable an event group set. + * + * Enable a set of event groups. Enabling a set of event groups zeros the value of + * all the events in all the groups and then starts collection of those events. + * \note \b Thread-safety: this function is thread safe. + * + * \param eventGroupSet The pointer to the event group set + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_HARDWARE + * \retval CUPTI_ERROR_NOT_READY if \p eventGroup does not contain any events + * \retval CUPTI_ERROR_NOT_COMPATIBLE if \p eventGroup cannot be + * enabled due to other already enabled event groups + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroupSet is NULL + * \retval CUPTI_ERROR_HARDWARE_BUSY if other client is profiling and hardware is + * busy + */ +CUptiResult CUPTIAPI cuptiEventGroupSetEnable(CUpti_EventGroupSet *eventGroupSet); + +/** + * \brief Disable an event group set. + * + * Disable a set of event groups. Disabling a set of event groups + * stops collection of events contained in the groups. + * \note \b Thread-safety: this function is thread safe. + * \note \b If this call fails, some of the event groups in the set may be disabled + * and other event groups may remain enabled. + * + * \param eventGroupSet The pointer to the event group set + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_HARDWARE + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventGroupSet is NULL + */ +CUptiResult CUPTIAPI cuptiEventGroupSetDisable(CUpti_EventGroupSet *eventGroupSet); + +/** + * \brief Enable kernel replay mode. + * + * Set profiling mode for the context to replay mode. In this mode, + * any number of events can be collected in one run of the kernel. The + * event collection mode will automatically switch to + * CUPTI_EVENT_COLLECTION_MODE_KERNEL. In this mode, \ref + * cuptiSetEventCollectionMode will return + * CUPTI_ERROR_INVALID_OPERATION. + * \note \b Kernels might take longer to run if many events are enabled. + * \note \b Thread-safety: this function is thread safe. + * + * \param context The context + * \retval CUPTI_SUCCESS + */ +CUptiResult CUPTIAPI cuptiEnableKernelReplayMode(CUcontext context); + +/** + * \brief Disable kernel replay mode. + * + * Set profiling mode for the context to non-replay (default) + * mode. Event collection mode will be set to + * CUPTI_EVENT_COLLECTION_MODE_KERNEL. All previously enabled + * event groups and event group sets will be disabled. + * \note \b Thread-safety: this function is thread safe. + * + * \param context The context + * \retval CUPTI_SUCCESS + */ +CUptiResult CUPTIAPI cuptiDisableKernelReplayMode(CUcontext context); + +/** + * \brief Function type for getting updates on kernel replay. + * + * \param kernelName The mangled kernel name + * \param numReplaysDone Number of replays done so far + * \param customData Pointer of any custom data passed in when subscribing + */ +typedef void (CUPTIAPI *CUpti_KernelReplayUpdateFunc)( + const char *kernelName, + int numReplaysDone, + void *customData); + +/** + * \brief Subscribe to kernel replay updates. + * + * When subscribed, the function pointer passed in will be called each time a + * kernel run is finished during kernel replay. Previously subscribed function + * pointer will be replaced. Pass in NULL as the function pointer unsubscribes + * the update. + * + * \param updateFunc The update function pointer + * \param customData Pointer to any custom data + * \retval CUPTI_SUCCESS + */ +CUptiResult CUPTIAPI cuptiKernelReplaySubscribeUpdate(CUpti_KernelReplayUpdateFunc updateFunc, void *customData); + +/** @} */ /* END CUPTI_EVENT_API */ + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /*_CUPTI_EVENTS_H_*/ + + diff --git a/cuda_toolkit/include/cupti_metrics.h b/cuda_toolkit/include/cupti_metrics.h new file mode 100644 index 0000000000000000000000000000000000000000..e66145c8a58e099d9299508ae74067fcd64719d6 --- /dev/null +++ b/cuda_toolkit/include/cupti_metrics.h @@ -0,0 +1,825 @@ +/* + * Copyright 2011-2020 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(_CUPTI_METRIC_H_) +#define _CUPTI_METRIC_H_ + +#include +#include +#include +#include + +#ifndef CUPTIAPI +#ifdef _WIN32 +#define CUPTIAPI __stdcall +#else +#define CUPTIAPI +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +/** + * \defgroup CUPTI_METRIC_API CUPTI Metric API + * Functions, types, and enums that implement the CUPTI Metric API. + * + * \note CUPTI metric API from the header cupti_metrics.h are not supported on devices + * with compute capability 7.5 and higher (i.e. Turing and later GPU architectures). + * These API will be deprecated in a future CUDA release. These are replaced by + * Profiling API in the header cupti_profiler_target.h and Perfworks metrics API + * in the headers nvperf_host.h and nvperf_target.h which are supported on + * devices with compute capability 7.0 and higher (i.e. Volta and later GPU + * architectures). + * + * @{ + */ + +/** + * \brief ID for a metric. + * + * A metric provides a measure of some aspect of the device. + */ +typedef uint32_t CUpti_MetricID; + +/** + * \brief A metric category. + * + * Each metric is assigned to a category that represents the general + * type of the metric. A metric's category is accessed using \ref + * cuptiMetricGetAttribute and the CUPTI_METRIC_ATTR_CATEGORY + * attribute. + */ +typedef enum { + /** + * A memory related metric. + */ + CUPTI_METRIC_CATEGORY_MEMORY = 0, + /** + * An instruction related metric. + */ + CUPTI_METRIC_CATEGORY_INSTRUCTION = 1, + /** + * A multiprocessor related metric. + */ + CUPTI_METRIC_CATEGORY_MULTIPROCESSOR = 2, + /** + * A cache related metric. + */ + CUPTI_METRIC_CATEGORY_CACHE = 3, + /** + * A texture related metric. + */ + CUPTI_METRIC_CATEGORY_TEXTURE = 4, + /** + *A Nvlink related metric. + */ + CUPTI_METRIC_CATEGORY_NVLINK = 5, + /** + *A PCIe related metric. + */ + CUPTI_METRIC_CATEGORY_PCIE = 6, + CUPTI_METRIC_CATEGORY_FORCE_INT = 0x7fffffff, +} CUpti_MetricCategory; + +/** + * \brief A metric evaluation mode. + * + * A metric can be evaluated per hardware instance to know the load balancing + * across instances of a domain or the metric can be evaluated in aggregate mode + * when the events involved in metric evaluation are from different event + * domains. It might be possible to evaluate some metrics in both + * modes for convenience. A metric's evaluation mode is accessed using \ref + * CUpti_MetricEvaluationMode and the CUPTI_METRIC_ATTR_EVALUATION_MODE + * attribute. + */ +typedef enum { + /** + * If this bit is set, the metric can be profiled for each instance of the + * domain. The event values passed to \ref cuptiMetricGetValue can contain + * values for one instance of the domain. And \ref cuptiMetricGetValue can + * be called for each instance. + */ + CUPTI_METRIC_EVALUATION_MODE_PER_INSTANCE = 1, + /** + * If this bit is set, the metric can be profiled over all instances. The + * event values passed to \ref cuptiMetricGetValue can be aggregated values + * of events for all instances of the domain. + */ + CUPTI_METRIC_EVALUATION_MODE_AGGREGATE = 1 << 1, + CUPTI_METRIC_EVALUATION_MODE_FORCE_INT = 0x7fffffff, +} CUpti_MetricEvaluationMode; + +/** + * \brief Kinds of metric values. + * + * Metric values can be one of several different kinds. Corresponding + * to each kind is a member of the CUpti_MetricValue union. The metric + * value returned by \ref cuptiMetricGetValue should be accessed using + * the appropriate member of that union based on its value kind. + */ +typedef enum { + /** + * The metric value is a 64-bit double. + */ + CUPTI_METRIC_VALUE_KIND_DOUBLE = 0, + /** + * The metric value is a 64-bit unsigned integer. + */ + CUPTI_METRIC_VALUE_KIND_UINT64 = 1, + /** + * The metric value is a percentage represented by a 64-bit + * double. For example, 57.5% is represented by the value 57.5. + */ + CUPTI_METRIC_VALUE_KIND_PERCENT = 2, + /** + * The metric value is a throughput represented by a 64-bit + * integer. The unit for throughput values is bytes/second. + */ + CUPTI_METRIC_VALUE_KIND_THROUGHPUT = 3, + /** + * The metric value is a 64-bit signed integer. + */ + CUPTI_METRIC_VALUE_KIND_INT64 = 4, + /** + * The metric value is a utilization level, as represented by + * CUpti_MetricValueUtilizationLevel. + */ + CUPTI_METRIC_VALUE_KIND_UTILIZATION_LEVEL = 5, + + CUPTI_METRIC_VALUE_KIND_FORCE_INT = 0x7fffffff +} CUpti_MetricValueKind; + +/** + * \brief Enumeration of utilization levels for metrics values of kind + * CUPTI_METRIC_VALUE_KIND_UTILIZATION_LEVEL. Utilization values can + * vary from IDLE (0) to MAX (10) but the enumeration only provides + * specific names for a few values. + */ +typedef enum { + CUPTI_METRIC_VALUE_UTILIZATION_IDLE = 0, + CUPTI_METRIC_VALUE_UTILIZATION_LOW = 2, + CUPTI_METRIC_VALUE_UTILIZATION_MID = 5, + CUPTI_METRIC_VALUE_UTILIZATION_HIGH = 8, + CUPTI_METRIC_VALUE_UTILIZATION_MAX = 10, + CUPTI_METRIC_VALUE_UTILIZATION_FORCE_INT = 0x7fffffff +} CUpti_MetricValueUtilizationLevel; + +/** + * \brief Metric attributes. + * + * Metric attributes describe properties of a metric. These attributes + * can be read using \ref cuptiMetricGetAttribute. + */ +typedef enum { + /** + * Metric name. Value is a null terminated const c-string. + */ + CUPTI_METRIC_ATTR_NAME = 0, + /** + * Short description of metric. Value is a null terminated const c-string. + */ + CUPTI_METRIC_ATTR_SHORT_DESCRIPTION = 1, + /** + * Long description of metric. Value is a null terminated const c-string. + */ + CUPTI_METRIC_ATTR_LONG_DESCRIPTION = 2, + /** + * Category of the metric. Value is of type CUpti_MetricCategory. + */ + CUPTI_METRIC_ATTR_CATEGORY = 3, + /** + * Value type of the metric. Value is of type CUpti_MetricValueKind. + */ + CUPTI_METRIC_ATTR_VALUE_KIND = 4, + /** + * Metric evaluation mode. Value is of type CUpti_MetricEvaluationMode. + */ + CUPTI_METRIC_ATTR_EVALUATION_MODE = 5, + CUPTI_METRIC_ATTR_FORCE_INT = 0x7fffffff, +} CUpti_MetricAttribute; + +/** + * \brief A metric value. + * + * Metric values can be one of several different kinds. Corresponding + * to each kind is a member of the CUpti_MetricValue union. The metric + * value returned by \ref cuptiMetricGetValue should be accessed using + * the appropriate member of that union based on its value kind. + */ +typedef union { + /* + * Value for CUPTI_METRIC_VALUE_KIND_DOUBLE. + */ + double metricValueDouble; + /* + * Value for CUPTI_METRIC_VALUE_KIND_UINT64. + */ + uint64_t metricValueUint64; + /* + * Value for CUPTI_METRIC_VALUE_KIND_INT64. + */ + int64_t metricValueInt64; + /* + * Value for CUPTI_METRIC_VALUE_KIND_PERCENT. For example, 57.5% is + * represented by the value 57.5. + */ + double metricValuePercent; + /* + * Value for CUPTI_METRIC_VALUE_KIND_THROUGHPUT. The unit for + * throughput values is bytes/second. + */ + uint64_t metricValueThroughput; + /* + * Value for CUPTI_METRIC_VALUE_KIND_UTILIZATION_LEVEL. + */ + CUpti_MetricValueUtilizationLevel metricValueUtilizationLevel; +} CUpti_MetricValue; + +/** + * \brief Device class. + * + * Enumeration of device classes for metric property + * CUPTI_METRIC_PROPERTY_DEVICE_CLASS. + */ +typedef enum { + CUPTI_METRIC_PROPERTY_DEVICE_CLASS_TESLA = 0, + CUPTI_METRIC_PROPERTY_DEVICE_CLASS_QUADRO = 1, + CUPTI_METRIC_PROPERTY_DEVICE_CLASS_GEFORCE = 2, + CUPTI_METRIC_PROPERTY_DEVICE_CLASS_TEGRA = 3, +} CUpti_MetricPropertyDeviceClass; + +/** + * \brief Metric device properties. + * + * Metric device properties describe device properties which are needed for a metric. + * Some of these properties can be collected using cuDeviceGetAttribute. + */ +typedef enum { + /* + * Number of multiprocessors on a device. This can be collected + * using value of \param CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT of + * cuDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_MULTIPROCESSOR_COUNT, + /* + * Maximum number of warps on a multiprocessor. This can be + * collected using ratio of value of \param + * CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR and \param + * CU_DEVICE_ATTRIBUTE_WARP_SIZE of cuDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_WARPS_PER_MULTIPROCESSOR, + /* + * GPU Time for kernel in ns. This should be profiled using CUPTI + * Activity API. + */ + CUPTI_METRIC_PROPERTY_KERNEL_GPU_TIME, + /* + * Clock rate for device in KHz. This should be collected using + * value of \param CU_DEVICE_ATTRIBUTE_CLOCK_RATE of + * cuDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_CLOCK_RATE, + /* + * Number of Frame buffer units for device. This should be collected + * using value of \param CUPTI_DEVICE_ATTRIBUTE_MAX_FRAME_BUFFERS of + * cuptiDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_FRAME_BUFFER_COUNT, + /* + * Global memory bandwidth in KBytes/sec. This should be collected + * using value of \param CUPTI_DEVICE_ATTR_GLOBAL_MEMORY_BANDWIDTH + * of cuptiDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_GLOBAL_MEMORY_BANDWIDTH, + /* + * PCIE link rate in Mega bits/sec. This should be collected using + * value of \param CUPTI_DEVICE_ATTR_PCIE_LINK_RATE of + * cuptiDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_PCIE_LINK_RATE, + /* + * PCIE link width for device. This should be collected using + * value of \param CUPTI_DEVICE_ATTR_PCIE_LINK_WIDTH of + * cuptiDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_PCIE_LINK_WIDTH, + /* + * PCIE generation for device. This should be collected using + * value of \param CUPTI_DEVICE_ATTR_PCIE_GEN of + * cuptiDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_PCIE_GEN, + /* + * The device class. This should be collected using + * value of \param CUPTI_DEVICE_ATTR_DEVICE_CLASS of + * cuptiDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_DEVICE_CLASS, + /* + * Peak single precision floating point operations that + * can be performed in one cycle by the device. + * This should be collected using value of + * \param CUPTI_DEVICE_ATTR_FLOP_SP_PER_CYCLE of + * cuptiDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_FLOP_SP_PER_CYCLE, + /* + * Peak double precision floating point operations that + * can be performed in one cycle by the device. + * This should be collected using value of + * \param CUPTI_DEVICE_ATTR_FLOP_DP_PER_CYCLE of + * cuptiDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_FLOP_DP_PER_CYCLE, + /* + * Number of L2 units on a device. This can be collected + * using value of \param CUPTI_DEVICE_ATTR_MAX_L2_UNITS of + * cuDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_L2_UNITS, + /* + * Whether ECC support is enabled on the device. This can be + * collected using value of \param CU_DEVICE_ATTRIBUTE_ECC_ENABLED of + * cuDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_ECC_ENABLED, + /* + * Peak half precision floating point operations that + * can be performed in one cycle by the device. + * This should be collected using value of + * \param CUPTI_DEVICE_ATTR_FLOP_HP_PER_CYCLE of + * cuptiDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_FLOP_HP_PER_CYCLE, + /* + * NVLINK Bandwitdh for device. This should be collected + * using value of \param CUPTI_DEVICE_ATTR_GPU_CPU_NVLINK_BW of + * cuptiDeviceGetAttribute. + */ + CUPTI_METRIC_PROPERTY_GPU_CPU_NVLINK_BANDWIDTH, +} CUpti_MetricPropertyID; + +/** + * \brief Get the total number of metrics available on any device. + * + * Returns the total number of metrics available on any CUDA-capable + * devices. + * + * \param numMetrics Returns the number of metrics + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p numMetrics is NULL +*/ +CUptiResult CUPTIAPI cuptiGetNumMetrics(uint32_t *numMetrics); + +/** + * \brief Get all the metrics available on any device. + * + * Returns the metric IDs in \p metricArray for all CUDA-capable + * devices. The size of the \p metricArray buffer is given by \p + * *arraySizeBytes. The size of the \p metricArray buffer must be at + * least \p numMetrics * sizeof(CUpti_MetricID) or all metric IDs will + * not be returned. The value returned in \p *arraySizeBytes contains + * the number of bytes returned in \p metricArray. + * + * \param arraySizeBytes The size of \p metricArray in bytes, and + * returns the number of bytes written to \p metricArray + * \param metricArray Returns the IDs of the metrics + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p arraySizeBytes or + * \p metricArray are NULL +*/ +CUptiResult CUPTIAPI cuptiEnumMetrics(size_t *arraySizeBytes, + CUpti_MetricID *metricArray); + +/** + * \brief Get the number of metrics for a device. + * + * Returns the number of metrics available for a device. + * + * \param device The CUDA device + * \param numMetrics Returns the number of metrics available for the + * device + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_DEVICE + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p numMetrics is NULL + */ +CUptiResult CUPTIAPI cuptiDeviceGetNumMetrics(CUdevice device, + uint32_t *numMetrics); + +/** + * \brief Get the metrics for a device. + * + * Returns the metric IDs in \p metricArray for a device. The size of + * the \p metricArray buffer is given by \p *arraySizeBytes. The size + * of the \p metricArray buffer must be at least \p numMetrics * + * sizeof(CUpti_MetricID) or else all metric IDs will not be + * returned. The value returned in \p *arraySizeBytes contains the + * number of bytes returned in \p metricArray. + * + * \param device The CUDA device + * \param arraySizeBytes The size of \p metricArray in bytes, and + * returns the number of bytes written to \p metricArray + * \param metricArray Returns the IDs of the metrics for the device + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_DEVICE + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p arraySizeBytes or + * \p metricArray are NULL + */ +CUptiResult CUPTIAPI cuptiDeviceEnumMetrics(CUdevice device, + size_t *arraySizeBytes, + CUpti_MetricID *metricArray); + +/** + * \brief Get a metric attribute. + * + * Returns a metric attribute in \p *value. The size of the \p + * value buffer is given by \p *valueSize. The value returned in \p + * *valueSize contains the number of bytes returned in \p value. + * + * If the attribute value is a c-string that is longer than \p + * *valueSize, then only the first \p *valueSize characters will be + * returned and there will be no terminating null byte. + * + * \param metric ID of the metric + * \param attrib The metric attribute to read + * \param valueSize The size of the \p value buffer in bytes, and + * returns the number of bytes written to \p value + * \param value Returns the attribute's value + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_METRIC_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p valueSize or \p value + * is NULL, or if \p attrib is not a metric attribute + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT For non-c-string + * attribute values, indicates that the \p value buffer is too small + * to hold the attribute value. + */ +CUptiResult CUPTIAPI cuptiMetricGetAttribute(CUpti_MetricID metric, + CUpti_MetricAttribute attrib, + size_t *valueSize, + void *value); + +/** + * \brief Find an metric by name. + * + * Find a metric by name and return the metric ID in \p *metric. + * + * \param device The CUDA device + * \param metricName The name of metric to find + * \param metric Returns the ID of the found metric or undefined if + * unable to find the metric + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_DEVICE + * \retval CUPTI_ERROR_INVALID_METRIC_NAME if unable to find a metric + * with name \p metricName. In this case \p *metric is undefined + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p metricName or \p + * metric are NULL. + */ +CUptiResult CUPTIAPI cuptiMetricGetIdFromName(CUdevice device, + const char *metricName, + CUpti_MetricID *metric); + +/** + * \brief Get number of events required to calculate a metric. + * + * Returns the number of events in \p numEvents that are required to + * calculate a metric. + * + * \param metric ID of the metric + * \param numEvents Returns the number of events required for the metric + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_METRIC_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p numEvents is NULL + */ +CUptiResult CUPTIAPI cuptiMetricGetNumEvents(CUpti_MetricID metric, + uint32_t *numEvents); + +/** + * \brief Get the events required to calculating a metric. + * + * Gets the event IDs in \p eventIdArray required to calculate a \p + * metric. The size of the \p eventIdArray buffer is given by \p + * *eventIdArraySizeBytes and must be at least \p numEvents * + * sizeof(CUpti_EventID) or all events will not be returned. The value + * returned in \p *eventIdArraySizeBytes contains the number of bytes + * returned in \p eventIdArray. + * + * \param metric ID of the metric + * \param eventIdArraySizeBytes The size of \p eventIdArray in bytes, + * and returns the number of bytes written to \p eventIdArray + * \param eventIdArray Returns the IDs of the events required to + * calculate \p metric + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_METRIC_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventIdArraySizeBytes or \p + * eventIdArray are NULL. + */ +CUptiResult CUPTIAPI cuptiMetricEnumEvents(CUpti_MetricID metric, + size_t *eventIdArraySizeBytes, + CUpti_EventID *eventIdArray); + +/** + * \brief Get number of properties required to calculate a metric. + * + * Returns the number of properties in \p numProp that are required to + * calculate a metric. + * + * \param metric ID of the metric + * \param numProp Returns the number of properties required for the + * metric + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_METRIC_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p numProp is NULL + */ +CUptiResult CUPTIAPI cuptiMetricGetNumProperties(CUpti_MetricID metric, + uint32_t *numProp); + +/** + * \brief Get the properties required to calculating a metric. + * + * Gets the property IDs in \p propIdArray required to calculate a \p + * metric. The size of the \p propIdArray buffer is given by \p + * *propIdArraySizeBytes and must be at least \p numProp * + * sizeof(CUpti_DeviceAttribute) or all properties will not be + * returned. The value returned in \p *propIdArraySizeBytes contains + * the number of bytes returned in \p propIdArray. + * + * \param metric ID of the metric + * \param propIdArraySizeBytes The size of \p propIdArray in bytes, + * and returns the number of bytes written to \p propIdArray + * \param propIdArray Returns the IDs of the properties required to + * calculate \p metric + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_METRIC_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p propIdArraySizeBytes or \p + * propIdArray are NULL. + */ +CUptiResult CUPTIAPI cuptiMetricEnumProperties(CUpti_MetricID metric, + size_t *propIdArraySizeBytes, + CUpti_MetricPropertyID *propIdArray); + + +/** + * \brief For a metric get the groups of events that must be collected + * in the same pass. + * + * For a metric get the groups of events that must be collected in the + * same pass to ensure that the metric is calculated correctly. If the + * events are not collected as specified then the metric value may be + * inaccurate. + * + * The function returns NULL if a metric does not have any required + * event group. In this case the events needed for the metric can be + * grouped in any manner for collection. + * + * \param context The context for event collection + * \param metric The metric ID + * \param eventGroupSets Returns a CUpti_EventGroupSets object that + * indicates the events that must be collected in the same pass to + * ensure the metric is calculated correctly. Returns NULL if no + * grouping is required for metric + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_METRIC_ID + */ +CUptiResult CUPTIAPI cuptiMetricGetRequiredEventGroupSets(CUcontext context, + CUpti_MetricID metric, + CUpti_EventGroupSets **eventGroupSets); + +/** + * \brief For a set of metrics, get the grouping that indicates the + * number of passes and the event groups necessary to collect the + * events required for those metrics. + * + * For a set of metrics, get the grouping that indicates the number of + * passes and the event groups necessary to collect the events + * required for those metrics. + * + * \see cuptiEventGroupSetsCreate for details on event group set + * creation. + * + * \param context The context for event collection + * \param metricIdArraySizeBytes Size of the metricIdArray in bytes + * \param metricIdArray Array of metric IDs + * \param eventGroupPasses Returns a CUpti_EventGroupSets object that + * indicates the number of passes required to collect the events and + * the events to collect on each pass + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_CONTEXT + * \retval CUPTI_ERROR_INVALID_METRIC_ID + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p metricIdArray or + * \p eventGroupPasses is NULL + */ +CUptiResult CUPTIAPI cuptiMetricCreateEventGroupSets(CUcontext context, + size_t metricIdArraySizeBytes, + CUpti_MetricID *metricIdArray, + CUpti_EventGroupSets **eventGroupPasses); + +/** + * \brief Calculate the value for a metric. + * + * Use the events collected for a metric to calculate the metric + * value. Metric value evaluation depends on the evaluation mode + * \ref CUpti_MetricEvaluationMode that the metric supports. + * If a metric has evaluation mode as CUPTI_METRIC_EVALUATION_MODE_PER_INSTANCE, + * then it assumes that the input event value is for one domain instance. + * If a metric has evaluation mode as CUPTI_METRIC_EVALUATION_MODE_AGGREGATE, + * it assumes that input event values are + * normalized to represent all domain instances on a device. For the + * most accurate metric collection, the events required for the metric + * should be collected for all profiled domain instances. For example, + * to collect all instances of an event, set the + * CUPTI_EVENT_GROUP_ATTR_PROFILE_ALL_DOMAIN_INSTANCES attribute on + * the group containing the event to 1. The normalized value for the + * event is then: (\p sum_event_values * \p totalInstanceCount) / \p + * instanceCount, where \p sum_event_values is the summation of the + * event values across all profiled domain instances, \p + * totalInstanceCount is obtained from querying + * CUPTI_EVENT_DOMAIN_ATTR_TOTAL_INSTANCE_COUNT and \p instanceCount + * is obtained from querying CUPTI_EVENT_GROUP_ATTR_INSTANCE_COUNT (or + * CUPTI_EVENT_DOMAIN_ATTR_INSTANCE_COUNT). + * + * \param device The CUDA device that the metric is being calculated for + * \param metric The metric ID + * \param eventIdArraySizeBytes The size of \p eventIdArray in bytes + * \param eventIdArray The event IDs required to calculate \p metric + * \param eventValueArraySizeBytes The size of \p eventValueArray in bytes + * \param eventValueArray The normalized event values required to + * calculate \p metric. The values must be order to match the order of + * events in \p eventIdArray + * \param timeDuration The duration over which the events were + * collected, in ns + * \param metricValue Returns the value for the metric + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_METRIC_ID + * \retval CUPTI_ERROR_INVALID_OPERATION + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT if the + * eventIdArray does not contain all the events needed for metric + * \retval CUPTI_ERROR_INVALID_EVENT_VALUE if any of the + * event values required for the metric is CUPTI_EVENT_OVERFLOW + * \retval CUPTI_ERROR_INVALID_METRIC_VALUE if the computed metric value + * cannot be represented in the metric's value type. For example, + * if the metric value type is unsigned and the computed metric value is negative + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p metricValue, + * \p eventIdArray or \p eventValueArray is NULL + */ +CUptiResult CUPTIAPI cuptiMetricGetValue(CUdevice device, + CUpti_MetricID metric, + size_t eventIdArraySizeBytes, + CUpti_EventID *eventIdArray, + size_t eventValueArraySizeBytes, + uint64_t *eventValueArray, + uint64_t timeDuration, + CUpti_MetricValue *metricValue); + +/** + * \brief Calculate the value for a metric. + * + * Use the events and properties collected for a metric to calculate + * the metric value. Metric value evaluation depends on the evaluation + * mode \ref CUpti_MetricEvaluationMode that the metric supports. If + * a metric has evaluation mode as + * CUPTI_METRIC_EVALUATION_MODE_PER_INSTANCE, then it assumes that the + * input event value is for one domain instance. If a metric has + * evaluation mode as CUPTI_METRIC_EVALUATION_MODE_AGGREGATE, it + * assumes that input event values are normalized to represent all + * domain instances on a device. For the most accurate metric + * collection, the events required for the metric should be collected + * for all profiled domain instances. For example, to collect all + * instances of an event, set the + * CUPTI_EVENT_GROUP_ATTR_PROFILE_ALL_DOMAIN_INSTANCES attribute on + * the group containing the event to 1. The normalized value for the + * event is then: (\p sum_event_values * \p totalInstanceCount) / \p + * instanceCount, where \p sum_event_values is the summation of the + * event values across all profiled domain instances, \p + * totalInstanceCount is obtained from querying + * CUPTI_EVENT_DOMAIN_ATTR_TOTAL_INSTANCE_COUNT and \p instanceCount + * is obtained from querying CUPTI_EVENT_GROUP_ATTR_INSTANCE_COUNT (or + * CUPTI_EVENT_DOMAIN_ATTR_INSTANCE_COUNT). + * + * \param metric The metric ID + * \param eventIdArraySizeBytes The size of \p eventIdArray in bytes + * \param eventIdArray The event IDs required to calculate \p metric + * \param eventValueArraySizeBytes The size of \p eventValueArray in bytes + * \param eventValueArray The normalized event values required to + * calculate \p metric. The values must be order to match the order of + * events in \p eventIdArray + * \param propIdArraySizeBytes The size of \p propIdArray in bytes + * \param propIdArray The metric property IDs required to calculate \p metric + * \param propValueArraySizeBytes The size of \p propValueArray in bytes + * \param propValueArray The metric property values required to + * calculate \p metric. The values must be order to match the order of + * metric properties in \p propIdArray + * \param metricValue Returns the value for the metric + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_NOT_INITIALIZED + * \retval CUPTI_ERROR_INVALID_METRIC_ID + * \retval CUPTI_ERROR_INVALID_OPERATION + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT if the + * eventIdArray does not contain all the events needed for metric + * \retval CUPTI_ERROR_INVALID_EVENT_VALUE if any of the + * event values required for the metric is CUPTI_EVENT_OVERFLOW + * \retval CUPTI_ERROR_NOT_COMPATIBLE if the computed metric value + * cannot be represented in the metric's value type. For example, + * if the metric value type is unsigned and the computed metric value is negative + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p metricValue, + * \p eventIdArray or \p eventValueArray is NULL + */ +CUptiResult CUPTIAPI cuptiMetricGetValue2(CUpti_MetricID metric, + size_t eventIdArraySizeBytes, + CUpti_EventID *eventIdArray, + size_t eventValueArraySizeBytes, + uint64_t *eventValueArray, + size_t propIdArraySizeBytes, + CUpti_MetricPropertyID *propIdArray, + size_t propValueArraySizeBytes, + uint64_t *propValueArray, + CUpti_MetricValue *metricValue); + +/** @} */ /* END CUPTI_METRIC_API */ + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /*_CUPTI_METRIC_H_*/ + + diff --git a/cuda_toolkit/include/cupti_nvtx_cbid.h b/cuda_toolkit/include/cupti_nvtx_cbid.h new file mode 100644 index 0000000000000000000000000000000000000000..251d3e3a1930f11621e2cc220ae9ea1e9447b087 --- /dev/null +++ b/cuda_toolkit/include/cupti_nvtx_cbid.h @@ -0,0 +1,111 @@ +/* + * Copyright 2013-2017 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +typedef enum { + CUPTI_CBID_NVTX_INVALID = 0, + CUPTI_CBID_NVTX_nvtxMarkA = 1, + CUPTI_CBID_NVTX_nvtxMarkW = 2, + CUPTI_CBID_NVTX_nvtxMarkEx = 3, + CUPTI_CBID_NVTX_nvtxRangeStartA = 4, + CUPTI_CBID_NVTX_nvtxRangeStartW = 5, + CUPTI_CBID_NVTX_nvtxRangeStartEx = 6, + CUPTI_CBID_NVTX_nvtxRangeEnd = 7, + CUPTI_CBID_NVTX_nvtxRangePushA = 8, + CUPTI_CBID_NVTX_nvtxRangePushW = 9, + CUPTI_CBID_NVTX_nvtxRangePushEx = 10, + CUPTI_CBID_NVTX_nvtxRangePop = 11, + CUPTI_CBID_NVTX_nvtxNameCategoryA = 12, + CUPTI_CBID_NVTX_nvtxNameCategoryW = 13, + CUPTI_CBID_NVTX_nvtxNameOsThreadA = 14, + CUPTI_CBID_NVTX_nvtxNameOsThreadW = 15, + CUPTI_CBID_NVTX_nvtxNameCuDeviceA = 16, + CUPTI_CBID_NVTX_nvtxNameCuDeviceW = 17, + CUPTI_CBID_NVTX_nvtxNameCuContextA = 18, + CUPTI_CBID_NVTX_nvtxNameCuContextW = 19, + CUPTI_CBID_NVTX_nvtxNameCuStreamA = 20, + CUPTI_CBID_NVTX_nvtxNameCuStreamW = 21, + CUPTI_CBID_NVTX_nvtxNameCuEventA = 22, + CUPTI_CBID_NVTX_nvtxNameCuEventW = 23, + CUPTI_CBID_NVTX_nvtxNameCudaDeviceA = 24, + CUPTI_CBID_NVTX_nvtxNameCudaDeviceW = 25, + CUPTI_CBID_NVTX_nvtxNameCudaStreamA = 26, + CUPTI_CBID_NVTX_nvtxNameCudaStreamW = 27, + CUPTI_CBID_NVTX_nvtxNameCudaEventA = 28, + CUPTI_CBID_NVTX_nvtxNameCudaEventW = 29, + CUPTI_CBID_NVTX_nvtxDomainMarkEx = 30, + CUPTI_CBID_NVTX_nvtxDomainRangeStartEx = 31, + CUPTI_CBID_NVTX_nvtxDomainRangeEnd = 32, + CUPTI_CBID_NVTX_nvtxDomainRangePushEx = 33, + CUPTI_CBID_NVTX_nvtxDomainRangePop = 34, + CUPTI_CBID_NVTX_nvtxDomainResourceCreate = 35, + CUPTI_CBID_NVTX_nvtxDomainResourceDestroy = 36, + CUPTI_CBID_NVTX_nvtxDomainNameCategoryA = 37, + CUPTI_CBID_NVTX_nvtxDomainNameCategoryW = 38, + CUPTI_CBID_NVTX_nvtxDomainRegisterStringA = 39, + CUPTI_CBID_NVTX_nvtxDomainRegisterStringW = 40, + CUPTI_CBID_NVTX_nvtxDomainCreateA = 41, + CUPTI_CBID_NVTX_nvtxDomainCreateW = 42, + CUPTI_CBID_NVTX_nvtxDomainDestroy = 43, + CUPTI_CBID_NVTX_nvtxDomainSyncUserCreate = 44, + CUPTI_CBID_NVTX_nvtxDomainSyncUserDestroy = 45, + CUPTI_CBID_NVTX_nvtxDomainSyncUserAcquireStart = 46, + CUPTI_CBID_NVTX_nvtxDomainSyncUserAcquireFailed = 47, + CUPTI_CBID_NVTX_nvtxDomainSyncUserAcquireSuccess = 48, + CUPTI_CBID_NVTX_nvtxDomainSyncUserReleasing = 49, + CUPTI_CBID_NVTX_SIZE, + CUPTI_CBID_NVTX_FORCE_INT = 0x7fffffff +} CUpti_nvtx_api_trace_cbid; + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif diff --git a/cuda_toolkit/include/cupti_pcsampling.h b/cuda_toolkit/include/cupti_pcsampling.h new file mode 100644 index 0000000000000000000000000000000000000000..4741729608a2171436cad10a55583f6f3a38da97 --- /dev/null +++ b/cuda_toolkit/include/cupti_pcsampling.h @@ -0,0 +1,936 @@ +/* + * Copyright 2020-2022 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(_CUPTI_PCSAMPLING_H_) +#define _CUPTI_PCSAMPLING_H_ + +#include +#include +#include +#include "cupti_result.h" +#include "cupti_common.h" + + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +/** + * \defgroup CUPTI_PCSAMPLING_API CUPTI PC Sampling API + * Functions, types, and enums that implement the CUPTI PC Sampling API. + * @{ + */ + +#ifndef CUPTI_PCSAMPLING_STRUCT_SIZE +#define CUPTI_PCSAMPLING_STRUCT_SIZE(type_, lastfield_) (offsetof(type_, lastfield_) + sizeof(((type_*)0)->lastfield_)) +#endif + +#ifndef CUPTI_STALL_REASON_STRING_SIZE +#define CUPTI_STALL_REASON_STRING_SIZE 128 +#endif + +/** + * \brief PC Sampling collection mode + */ +typedef enum +{ + /** + * INVALID Value + */ + CUPTI_PC_SAMPLING_COLLECTION_MODE_INVALID = 0, + /** + * Continuous mode. Kernels are not serialized in this mode. + */ + CUPTI_PC_SAMPLING_COLLECTION_MODE_CONTINUOUS = 1, + /** + * Serialized mode. Kernels are serialized in this mode. + */ + CUPTI_PC_SAMPLING_COLLECTION_MODE_KERNEL_SERIALIZED = 2, +} CUpti_PCSamplingCollectionMode; + +/** + * \brief PC Sampling stall reasons + */ +typedef struct PACKED_ALIGNMENT +{ + /** + * [r] Collected stall reason index + */ + uint32_t pcSamplingStallReasonIndex; + /** + * [r] Number of times the PC was sampled with the stallReason. + */ + uint32_t samples; +} CUpti_PCSamplingStallReason; + +/** + * \brief PC Sampling data + */ +typedef struct PACKED_ALIGNMENT +{ + /** + * [w] Size of the data structure. + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [r] Unique cubin id + */ + uint64_t cubinCrc; + /** + * [r] PC offset + */ + uint64_t pcOffset; + /** + * The function's unique symbol index in the module. + */ + uint32_t functionIndex; + /** + * Padding + */ + uint32_t pad; + /** + * [r] The function name. This name string might be shared across all the records + * including records from activity APIs representing the same function, and so it should not be + * modified or freed until post processing of all the records is done. Once done, it is user’s responsibility to + * free the memory using free() function. + */ + char* functionName; + /** + * [r] Collected stall reason count + */ + size_t stallReasonCount; + /** + * [r] Stall reason id + * Total samples + */ + CUpti_PCSamplingStallReason *stallReason; + /** + * The correlation ID of the kernel to which this result is associated. Only valid for serialized mode of pc sampling collection. + * For continous mode of collection the correlationId will be set to 0. + */ + uint32_t correlationId; +} CUpti_PCSamplingPCData; + +/** + * \brief PC Sampling output data format + */ +typedef enum +{ + CUPTI_PC_SAMPLING_OUTPUT_DATA_FORMAT_INVALID = 0, + /** + * HW buffer data will be parsed during collection of data + */ + CUPTI_PC_SAMPLING_OUTPUT_DATA_FORMAT_PARSED = 1, +} CUpti_PCSamplingOutputDataFormat; + +/** + * \brief Collected PC Sampling data + * + */ +typedef struct PACKED_ALIGNMENT +{ + /** + * [w] Size of the data structure. + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Number of PCs to be collected + */ + size_t collectNumPcs; + /** + * [r] Number of samples collected across all PCs. + * It includes samples for user modules, samples for non-user kernels and dropped samples. + * It includes counts for all non selected stall reasons. + * CUPTI does not provide PC records for non-user kernels. + * CUPTI does not provide PC records for instructions for which all selected stall reason metrics counts are zero. + */ + uint64_t totalSamples; + /** + * [r] Number of samples that were dropped by hardware due to backpressure/overflow. + */ + uint64_t droppedSamples; + /** + * [r] Number of PCs collected + */ + size_t totalNumPcs; + /** + * [r] Number of PCs available for collection + */ + size_t remainingNumPcs; + /** + * [r] Unique identifier for each range. + * Data collected across multiple ranges in multiple buffers can be identified using range id. + */ + uint64_t rangeId; + /** + * [r] Profiled PC data + * This data struct should have enough memory to collect number of PCs mentioned in \brief collectNumPcs + */ + CUpti_PCSamplingPCData *pPcData; + /** + * [r] Number of samples collected across all non user kernels PCs. + * It includes samples for non-user kernels. + * It includes counts for all non selected stall reasons as well. + * CUPTI does not provide PC records for non-user kernels. + */ + uint64_t nonUsrKernelsTotalSamples; + + /** + * [r] Status of the hardware buffer. + * CUPTI returns the error code CUPTI_ERROR_OUT_OF_MEMORY when hardware buffer is full. + * When hardware buffer is full, user will get pc data as 0. To mitigate this issue, one or more of the below options can be tried: + * 1. Increase the hardware buffer size using the attribute CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_HARDWARE_BUFFER_SIZE + * 2. Decrease the thread sleep span using the attribute CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_WORKER_THREAD_PERIODIC_SLEEP_SPAN + * 3. Decrease the sampling frequency using the attribute CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_SAMPLING_PERIOD + */ + uint8_t hardwareBufferFull; +} CUpti_PCSamplingData; + +/** + * \brief PC Sampling configuration attributes + * + * PC Sampling configuration attribute types. These attributes can be read + * using \ref cuptiPCSamplingGetConfigurationAttribute and can be written + * using \ref cuptiPCSamplingSetConfigurationAttribute. Attributes marked + * [r] can only be read using \ref cuptiPCSamplingGetConfigurationAttribute + * [w] can only be written using \ref cuptiPCSamplingSetConfigurationAttribute + * [rw] can be read using \ref cuptiPCSamplingGetConfigurationAttribute and + * written using \ref cuptiPCSamplingSetConfigurationAttribute + */ +typedef enum +{ + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_INVALID = 0, + /** + * [rw] Sampling period for PC Sampling. + * DEFAULT - CUPTI defined value based on number of SMs + * Valid values for the sampling + * periods are between 5 to 31 both inclusive. This will set the + * sampling period to (2^samplingPeriod) cycles. + * For e.g. for sampling period = 5 to 31, cycles = 32, 64, 128,..., 2^31 + * Value is a uint32_t + */ + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_SAMPLING_PERIOD = 1, + /** + * [w] Number of stall reasons to collect. + * DEFAULT - All stall reasons will be collected + * Value is a size_t + * [w] Stall reasons to collect + * DEFAULT - All stall reasons will be collected + * Input value should be a pointer pointing to array of stall reason indexes + * containing all the stall reason indexes to collect. + */ + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_STALL_REASON = 2, + /** + * [rw] Size of SW buffer for raw PC counter data downloaded from HW buffer + * DEFAULT - 1 MB, which can accommodate approximately 5500 PCs + * with all stall reasons + * Approximately it takes 16 Bytes (and some fixed size memory) + * to accommodate one PC with one stall reason + * For e.g. 1 PC with 1 stall reason = 32 Bytes + * 1 PC with 2 stall reason = 48 Bytes + * 1 PC with 4 stall reason = 96 Bytes + * Value is a size_t + */ + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_SCRATCH_BUFFER_SIZE = 3, + /** + * [rw] Size of HW buffer in bytes + * DEFAULT - 512 MB + * If sampling period is too less, HW buffer can overflow + * and drop PC data + * Value is a size_t + */ + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_HARDWARE_BUFFER_SIZE = 4, + /** + * [rw] PC Sampling collection mode + * DEFAULT - CUPTI_PC_SAMPLING_COLLECTION_MODE_CONTINUOUS + * Input value should be of type \ref CUpti_PCSamplingCollectionMode. + */ + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_COLLECTION_MODE = 5, + /** + * [rw] Control over PC Sampling data collection range + * Default - 0 + * 1 - Allows user to start and stop PC Sampling using APIs - + * \ref cuptiPCSamplingStart() - Start PC Sampling + * \ref cuptiPCSamplingStop() - Stop PC Sampling + * Value is a uint32_t + */ + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_ENABLE_START_STOP_CONTROL = 6, + /** + * [w] Value for output data format + * Default - CUPTI_PC_SAMPLING_OUTPUT_DATA_FORMAT_PARSED + * Input value should be of type \ref CUpti_PCSamplingOutputDataFormat. + */ + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_OUTPUT_DATA_FORMAT = 7, + /** + * [w] Data buffer to hold collected PC Sampling data PARSED_DATA + * Default - none. + * Buffer type is void * which can point to PARSED_DATA + * Refer \ref CUpti_PCSamplingData for buffer format for PARSED_DATA + */ + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_SAMPLING_DATA_BUFFER = 8, + /** + * [rw] Control sleep time of the worker threads created by CUPTI for various PC sampling operations. + * CUPTI creates multiple worker threads to offload certain operations to these threads. This includes decoding of HW data to + * the CUPTI PC sampling data and correlating PC data to SASS instructions. CUPTI wakes up these threads periodically. + * Default - 100 milliseconds. + * Value is a uint32_t + */ + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_WORKER_THREAD_PERIODIC_SLEEP_SPAN = 9, + CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_FORCE_INT = 0x7fffffff, +} CUpti_PCSamplingConfigurationAttributeType; + +/** + * \brief PC sampling configuration information structure + * + * This structure provides \ref CUpti_PCSamplingConfigurationAttributeType which can be configured + * or queried for PC sampling configuration + */ +typedef struct +{ + /** + * Refer \ref CUpti_PCSamplingConfigurationAttributeType for all supported attribute types + */ + CUpti_PCSamplingConfigurationAttributeType attributeType; + /* + * Configure or query status for \p attributeType + * CUPTI_SUCCESS for valid \p attributeType and \p attributeData + * CUPTI_ERROR_INVALID_OPERATION if \p attributeData is not valid + * CUPTI_ERROR_INVALID_PARAMETER if \p attributeType is not valid + */ + CUptiResult attributeStatus; + union + { + /** + * Invalid Value + */ + struct + { + uint64_t data[3]; + } invalidData; + /** + * Refer \ref CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_SAMPLING_PERIOD + */ + struct + { + uint32_t samplingPeriod; + } samplingPeriodData; + /** + * Refer \ref CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_STALL_REASON + */ + struct + { + size_t stallReasonCount; + uint32_t *pStallReasonIndex; + } stallReasonData; + /** + * Refer \ref CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_SCRATCH_BUFFER_SIZE + */ + struct + { + size_t scratchBufferSize; + } scratchBufferSizeData; + /** + * Refer \ref CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_HARDWARE_BUFFER_SIZE + */ + struct + { + size_t hardwareBufferSize; + } hardwareBufferSizeData; + /** + * Refer \ref CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_COLLECTION_MODE + */ + struct + { + CUpti_PCSamplingCollectionMode collectionMode; + } collectionModeData; + /** + * Refer \ref CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_ENABLE_START_STOP_CONTROL + */ + struct + { + uint32_t enableStartStopControl; + } enableStartStopControlData; + /** + * Refer \ref CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_OUTPUT_DATA_FORMAT + */ + struct + { + CUpti_PCSamplingOutputDataFormat outputDataFormat; + } outputDataFormatData; + /** + * Refer \ref CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_SAMPLING_DATA_BUFFER + */ + struct + { + void *samplingDataBuffer; + } samplingDataBufferData; + /** + * Refer \ref CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_WORKER_THREAD_PERIODIC_SLEEP_SPAN + */ + struct + { + uint32_t workerThreadPeriodicSleepSpan; + } workerThreadPeriodicSleepSpanData; + + } attributeData; +} CUpti_PCSamplingConfigurationInfo; + +/** + * \brief PC sampling configuration structure + * + * This structure configures PC sampling using \ref cuptiPCSamplingSetConfigurationAttribute + * and queries PC sampling default configuration using \ref cuptiPCSamplingGetConfigurationAttribute + */ +typedef struct +{ + /** + * [w] Size of the data structure i.e. CUpti_PCSamplingConfigurationInfoParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Assign to NULL + */ + void* pPriv; + /** + * [w] CUcontext + */ + CUcontext ctx; + /** + * [w] Number of attributes to configure using \ref cuptiPCSamplingSetConfigurationAttribute or query + * using \ref cuptiPCSamplingGetConfigurationAttribute + */ + size_t numAttributes; + /** + * Refer \ref CUpti_PCSamplingConfigurationInfo + */ + CUpti_PCSamplingConfigurationInfo *pPCSamplingConfigurationInfo; +} CUpti_PCSamplingConfigurationInfoParams; +#define CUpti_PCSamplingConfigurationInfoParamsSize CUPTI_PCSAMPLING_STRUCT_SIZE(CUpti_PCSamplingConfigurationInfoParams,pPCSamplingConfigurationInfo) + +/** + * \brief Write PC Sampling configuration attribute. + * + * \param pParams A pointer to \ref CUpti_PCSamplingConfigurationInfoParams + * containing PC sampling configuration. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_OPERATION if this API is called with + * some invalid \p attrib. + * \retval CUPTI_ERROR_INVALID_PARAMETER if attribute \p value is not valid + * or any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device + * does not support the API + */ +CUptiResult CUPTIAPI cuptiPCSamplingSetConfigurationAttribute(CUpti_PCSamplingConfigurationInfoParams *pParams); + +/** + * \brief Read PC Sampling configuration attribute. + * + * \param pParams A pointer to \ref CUpti_PCSamplingConfigurationInfoParams + * containing PC sampling configuration. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_OPERATION if this API is called with + * some invalid attribute. + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p attrib is not valid + * or any \p pParams is not valid + * \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT indicates that + * the \p value buffer is too small to hold the attribute value + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device + * does not support the API + */ +CUptiResult CUPTIAPI cuptiPCSamplingGetConfigurationAttribute(CUpti_PCSamplingConfigurationInfoParams *pParams); + +/** + * \brief Params for cuptiPCSamplingEnable + */ +typedef struct +{ + /** + * [w] Size of the data structure i.e. CUpti_PCSamplingGetDataParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Assign to NULL + */ + void* pPriv; + /** + * [w] CUcontext + */ + CUcontext ctx; + /** + * \param pcSamplingData Data buffer to hold collected PC Sampling data PARSED_DATA + * Buffer type is void * which can point to PARSED_DATA + * Refer \ref CUpti_PCSamplingData for buffer format for PARSED_DATA + */ + void *pcSamplingData; +} CUpti_PCSamplingGetDataParams; +#define CUpti_PCSamplingGetDataParamsSize CUPTI_PCSAMPLING_STRUCT_SIZE(CUpti_PCSamplingGetDataParams, pcSamplingData) +/** + * \brief Flush GPU PC sampling data periodically. + * + * Flushing of GPU PC Sampling data is required at following point to maintain uniqueness of PCs: + * For \brief CUPTI_PC_SAMPLING_COLLECTION_MODE_CONTINUOUS, after every module load-unload-load + * For \brief CUPTI_PC_SAMPLING_COLLECTION_MODE_KERNEL_SERIALIZED, after every kernel ends + * If configuration option \brief CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_ENABLE_START_STOP_CONTROL + * is enabled, then after every range end i.e. \brief cuptiPCSamplingStop() + * + * If application is profiled in \brief CUPTI_PC_SAMPLING_COLLECTION_MODE_CONTINUOUS, with disabled + * \brief CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_ENABLE_START_STOP_CONTROL, and there is no module unload, + * user can collect data in two ways: + * Use \brief cuptiPCSamplingGetData() API periodically + * Use \brief cuptiPCSamplingDisable() on application exit and read GPU PC sampling data from sampling + * data buffer passed during configuration. + * Note: In case, \brief cuptiPCSamplingGetData() API is not called periodically, then sampling data buffer + * passed during configuration should be large enough to hold all PCs data. + * \brief cuptiPCSamplingGetData() API never does device synchronization. + * It is possible that when the API is called there is some unconsumed data from the HW buffer. In this case + * CUPTI provides only the data available with it at that moment. + * + * \param pParams A pointer to \ref CUpti_PCSamplingGetDataParams + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_OPERATION if this API is called without + * enabling PC sampling. + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device + * \retval CUPTI_ERROR_OUT_OF_MEMORY indicates that the HW buffer is full + * does not support the API + */ +CUptiResult CUPTIAPI cuptiPCSamplingGetData(CUpti_PCSamplingGetDataParams *pParams); + +/** + * \brief Params for cuptiPCSamplingEnable + */ +typedef struct +{ + /** + * [w] Size of the data structure i.e. CUpti_PCSamplingEnableParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Assign to NULL + */ + void* pPriv; + /** + * [w] CUcontext + */ + CUcontext ctx; +} CUpti_PCSamplingEnableParams; +#define CUpti_PCSamplingEnableParamsSize CUPTI_PCSAMPLING_STRUCT_SIZE(CUpti_PCSamplingEnableParams, ctx) + +/** + * \brief Enable PC sampling. + * + * \param pParams A pointer to \ref CUpti_PCSamplingEnableParams + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device + * does not support the API + */ +CUptiResult CUPTIAPI cuptiPCSamplingEnable(CUpti_PCSamplingEnableParams *pParams); + +/** + * \brief Params for cuptiPCSamplingDisable + */ +typedef struct +{ + /** + * [w] Size of the data structure i.e. CUpti_PCSamplingDisableParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Assign to NULL + */ + void* pPriv; + /** + * [w] CUcontext + */ + CUcontext ctx; +} CUpti_PCSamplingDisableParams; +#define CUpti_PCSamplingDisableParamsSize CUPTI_PCSAMPLING_STRUCT_SIZE(CUpti_PCSamplingDisableParams, ctx) + +/** + * \brief Disable PC sampling. + * + * For application which doesn't destroy the CUDA context explicitly, + * this API does the PC Sampling tear-down, joins threads and copies PC records in the buffer provided + * during the PC sampling configuration. PC records which can't be accommodated in the buffer are discarded. + * + * \param pParams A pointer to \ref CUpti_PCSamplingDisableParams + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device + * does not support the API + */ +CUptiResult CUPTIAPI cuptiPCSamplingDisable(CUpti_PCSamplingDisableParams *pParams); + +/** + * \brief Params for cuptiPCSamplingStart + */ +typedef struct +{ + /** + * [w] Size of the data structure i.e. CUpti_PCSamplingStartParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Assign to NULL + */ + void* pPriv; + /** + * [w] CUcontext + */ + CUcontext ctx; +} CUpti_PCSamplingStartParams; +#define CUpti_PCSamplingStartParamsSize CUPTI_PCSAMPLING_STRUCT_SIZE(CUpti_PCSamplingStartParams, ctx) + +/** + * \brief Start PC sampling. + * + * User can collect PC Sampling data for user-defined range specified by Start/Stop APIs. + * This API can be used to mark starting of range. Set configuration option + * \brief CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_ENABLE_START_STOP_CONTROL to use this API. + * + * \param pParams A pointer to \ref CUpti_PCSamplingStartParams + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_OPERATION if this API is called with + * incorrect PC Sampling configuration. + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device + * does not support the API + */ +CUptiResult CUPTIAPI cuptiPCSamplingStart(CUpti_PCSamplingStartParams *pParams); + +/** + * \brief Params for cuptiPCSamplingStop + */ +typedef struct +{ + /** + * [w] Size of the data structure i.e. CUpti_PCSamplingStopParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Assign to NULL + */ + void* pPriv; + /** + * [w] CUcontext + */ + CUcontext ctx; +} CUpti_PCSamplingStopParams; +#define CUpti_PCSamplingStopParamsSize CUPTI_PCSAMPLING_STRUCT_SIZE(CUpti_PCSamplingStopParams, ctx) + +/** + * \brief Stop PC sampling. + * + * User can collect PC Sampling data for user-defined range specified by Start/Stop APIs. + * This API can be used to mark end of range. Set configuration option + * \brief CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_ENABLE_START_STOP_CONTROL to use this API. + * + * \param pParams A pointer to \ref CUpti_PCSamplingStopParams + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_OPERATION if this API is called with + * incorrect PC Sampling configuration. + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device + * does not support the API + */ +CUptiResult CUPTIAPI cuptiPCSamplingStop(CUpti_PCSamplingStopParams *pParams); + +/** + * \brief Params for cuptiPCSamplingGetNumStallReasons + */ +typedef struct +{ + /** + * [w] Size of the data structure i.e. CUpti_PCSamplingGetNumStallReasonsParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Assign to NULL + */ + void* pPriv; + /** + * [w] CUcontext + */ + CUcontext ctx; + /** + * [r] Number of stall reasons + */ + size_t *numStallReasons; +} CUpti_PCSamplingGetNumStallReasonsParams; +#define CUpti_PCSamplingGetNumStallReasonsParamsSize CUPTI_PCSAMPLING_STRUCT_SIZE(CUpti_PCSamplingGetNumStallReasonsParams, numStallReasons) + +/** + * \brief Get PC sampling stall reason count. + * + * \param pParams A pointer to \ref CUpti_PCSamplingGetNumStallReasonsParams + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device + * does not support the API + */ +CUptiResult CUPTIAPI cuptiPCSamplingGetNumStallReasons(CUpti_PCSamplingGetNumStallReasonsParams *pParams); + +/** + * \brief Params for cuptiPCSamplingGetStallReasons + */ +typedef struct +{ + /** + * [w] Size of the data structure i.e. CUpti_PCSamplingGetStallReasonsParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Assign to NULL + */ + void* pPriv; + /** + * [w] CUcontext + */ + CUcontext ctx; + /** + * [w] Number of stall reasons + */ + size_t numStallReasons; + /** + * [r] Stall reason index + */ + uint32_t *stallReasonIndex; + /** + * [r] Stall reasons name + */ + char **stallReasons; +} CUpti_PCSamplingGetStallReasonsParams; +#define CUpti_PCSamplingGetStallReasonsParamsSize CUPTI_PCSAMPLING_STRUCT_SIZE(CUpti_PCSamplingGetStallReasonsParams, stallReasons) + +/** + * \brief Get PC sampling stall reasons. + * + * \param pParams A pointer to \ref CUpti_PCSamplingGetStallReasonsParams + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device + * does not support the API + */ +CUptiResult CUPTIAPI cuptiPCSamplingGetStallReasons(CUpti_PCSamplingGetStallReasonsParams *pParams); + + +/** + * \brief Params for cuptiGetSassToSourceCorrelation + */ +typedef struct CUpti_GetSassToSourceCorrelationParams { + /** + * [w] Size of the data structure i.e. CUpti_GetSassToSourceCorrelationParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Pointer to cubin binary where function belongs. + */ + const void* cubin; + /** + * [w] Function name to which PC belongs. + */ + const char *functionName; + /** + * [w] Size of cubin binary. + */ + size_t cubinSize; + /** + * [r] Line number in the source code. + */ + uint32_t lineNumber; + /** + * [w] PC offset + */ + uint64_t pcOffset; + /** + * [r] Path for the source file. + */ + char *fileName; + /** + * [r] Path for the directory of source file. + */ + char *dirName; +} CUpti_GetSassToSourceCorrelationParams; + +#define CUpti_GetSassToSourceCorrelationParamsSize CUPTI_PCSAMPLING_STRUCT_SIZE(CUpti_GetSassToSourceCorrelationParams, dirName) + +/** + * \brief SASS to Source correlation. + * + * \param pParams A pointer to \ref CUpti_GetSassToSourceCorrelationParams + * + * It is expected from user to free allocated memory for fileName and dirName after use. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if either of the parameters cubin or functionName + * is NULL or cubinSize is zero or size field is not set correctly. + * \retval CUPTI_ERROR_INVALID_MODULE provided cubin is invalid. + * \retval CUPTI_ERROR_UNKNOWN an internal error occurred. + * This error code is also used for cases when the function is not present in the module. + * A better error code will be returned in the future release. + */ +CUptiResult CUPTIAPI cuptiGetSassToSourceCorrelation(CUpti_GetSassToSourceCorrelationParams *pParams); + +/** + * \brief Params for cuptiGetCubinCrc + */ +typedef struct { + /** + * [w] Size of configuration structure. + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * [w] Size of cubin binary. + */ + size_t cubinSize; + /** + * [w] Pointer to cubin binary + */ + const void* cubin; + /** + * [r] Computed CRC will be stored in it. + */ + uint64_t cubinCrc; +} CUpti_GetCubinCrcParams; +#define CUpti_GetCubinCrcParamsSize CUPTI_PCSAMPLING_STRUCT_SIZE(CUpti_GetCubinCrcParams, cubinCrc) + +/** + * \brief Get the CRC of cubin. + * + * This function returns the CRC of provided cubin binary. + * + * \param pParams A pointer to \ref CUpti_GetCubinCrcParams + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if parameter cubin is NULL or + * provided cubinSize is zero or size field is not set. + */ +CUptiResult CUPTIAPI cuptiGetCubinCrc(CUpti_GetCubinCrcParams *pParams); + +/** + * \brief Function type for callback used by CUPTI to request crc of + * loaded module. + * + * This callback function ask for crc of provided module in function. + * The provided crc will be stored in PC sampling records i.e. in the field 'cubinCrc' of the PC sampling + * struct CUpti_PCSamplingPCData. The CRC is uses during the offline source correlation to uniquely identify the module. + * + * \param cubin The pointer to cubin binary + * \param cubinSize The size of cubin binary. + * \param cubinCrc Returns the computed crc of cubin. + */ +typedef void (CUPTIAPI *CUpti_ComputeCrcCallbackFunc)( + const void* cubin, + size_t cubinSize, + uint64_t *cubinCrc); + +/** + * \brief Register callback function with CUPTI to use + * your own algorithm to compute cubin crc. + * + * This function registers a callback function and it gets called + * from CUPTI when a CUDA module is loaded. + * + * \param funcComputeCubinCrc callback is invoked when a CUDA module + * is loaded. + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p funcComputeCubinCrc is NULL. + */ +CUptiResult CUPTIAPI cuptiRegisterComputeCrcCallback(CUpti_ComputeCrcCallbackFunc funcComputeCubinCrc); + +/** @} */ /* END CUPTI_PCSAMPLING_API */ + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /*_CUPTI_PCSAMPLING_H_*/ diff --git a/cuda_toolkit/include/cupti_pcsampling_util.h b/cuda_toolkit/include/cupti_pcsampling_util.h new file mode 100644 index 0000000000000000000000000000000000000000..0652e9e2cd29539b35f5b5ceb1b6ce65553f3991 --- /dev/null +++ b/cuda_toolkit/include/cupti_pcsampling_util.h @@ -0,0 +1,402 @@ +#if !defined(_CUPTI_PCSAMPLING_UTIL_H_) +#define _CUPTI_PCSAMPLING_UTIL_H_ + +#include +#include + +#include + +#ifndef CUPTI_UTIL_STRUCT_SIZE +#define CUPTI_UTIL_STRUCT_SIZE(type_, lastfield_) (offsetof(type_, lastfield_) + sizeof(((type_*)0)->lastfield_)) +#endif + +#ifndef CHECK_PC_SAMPLING_STRUCT_FIELD_EXISTS +#define CHECK_PC_SAMPLING_STRUCT_FIELD_EXISTS(type, member, structSize) \ + (offsetof(type, member) < structSize) +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__GNUC__) + #pragma GCC visibility push(default) +#endif + +namespace CUPTI { namespace PcSamplingUtil { + +/** + * \defgroup CUPTI_PCSAMPLING_UTILITY CUPTI PC Sampling Utility API + * Functions, types, and enums that implement the CUPTI PC Sampling Utility API. + * @{ + */ + +/** + * \brief Header info will be stored in file. + */ +typedef struct PACKED_ALIGNMENT { + /** + * Version of file format. + */ + uint32_t version; + /** + * Total number of buffers present in the file. + */ + uint32_t totalBuffers; +} Header; + +/** + * \brief BufferInfo will be stored in the file for every buffer + * i.e for every call of UtilDumpPcSamplingBufferInFile() API. + */ +typedef struct PACKED_ALIGNMENT { + /** + * Total number of PC records. + */ + uint64_t recordCount; + /** + * Count of all stall reasons supported on the GPU + */ + size_t numStallReasons; + /** + * Total number of stall reasons in single record. + */ + uint64_t numSelectedStallReasons; + /** + * Buffer size in Bytes. + */ + uint64_t bufferByteSize; +} BufferInfo; + +/** + * \brief All available stall reasons name and respective indexes + * will be stored in it. + */ +typedef struct PACKED_ALIGNMENT { + /** + * Number of all available stall reasons + */ + size_t numStallReasons; + /** + * Stall reasons names of all available stall reasons + */ + char **stallReasons; + /** + * Stall reason index of all available stall reasons + */ + uint32_t *stallReasonIndex; +} PcSamplingStallReasons; + +/** + * \brief CUPTI PC sampling buffer types. + * + */ +typedef enum { + /** + * Invalid buffer type. + */ + PC_SAMPLING_BUFFER_INVALID = 0, + /** + * Refers to CUpti_PCSamplingData buffer. + */ + PC_SAMPLING_BUFFER_PC_TO_COUNTER_DATA = 1 +} PcSamplingBufferType; + +/** + * \brief CUPTI PC sampling utility API result codes. + * + * Error and result codes returned by CUPTI PC sampling utility API. + */ +typedef enum { + /** + * No error + */ + CUPTI_UTIL_SUCCESS = 0, + /** + * One or more of the parameters are invalid. + */ + CUPTI_UTIL_ERROR_INVALID_PARAMETER = 1, + /** + * Unable to create a new file + */ + CUPTI_UTIL_ERROR_UNABLE_TO_CREATE_FILE = 2, + /** + * Unable to open a file + */ + CUPTI_UTIL_ERROR_UNABLE_TO_OPEN_FILE = 3, + /** + * Read or write operation failed + */ + CUPTI_UTIL_ERROR_READ_WRITE_OPERATION_FAILED = 4, + /** + * Provided file handle is corrupted. + */ + CUPTI_UTIL_ERROR_FILE_HANDLE_CORRUPTED = 5, + /** + * seek operation failed. + */ + CUPTI_UTIL_ERROR_SEEK_OPERATION_FAILED = 6, + /** + * Unable to allocate enough memory to perform the requested + * operation. + */ + CUPTI_UTIL_ERROR_OUT_OF_MEMORY = 7, + /** + * An unknown internal error has occurred. + */ + CUPTI_UTIL_ERROR_UNKNOWN = 999, + CUPTI_UTIL_ERROR_FORCE_INT = 0x7fffffff +} CUptiUtilResult; + +/** + * \brief Params for \ref CuptiUtilPutPcSampData + */ +typedef struct { + /** + * Size of the data structure i.e. CUpti_PCSamplingDisableParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * Type of buffer to store in file + */ + PcSamplingBufferType bufferType; + /** + * PC sampling buffer. + */ + void *pSamplingData; + /** + * Number of configured attributes + */ + size_t numAttributes; + /** + * Refer \ref CUpti_PCSamplingConfigurationInfo + * It is expected to provide configuration details of at least + * CUPTI_PC_SAMPLING_CONFIGURATION_ATTR_TYPE_STALL_REASON attribute. + */ + CUpti_PCSamplingConfigurationInfo *pPCSamplingConfigurationInfo; + /** + * Refer \ref PcSamplingStallReasons. + */ + PcSamplingStallReasons *pPcSamplingStallReasons; + /** + * File name to store buffer into it. + */ + const char* fileName; +} CUptiUtil_PutPcSampDataParams; +#define CUptiUtil_PutPcSampDataParamsSize CUPTI_UTIL_STRUCT_SIZE(CUptiUtil_PutPcSampDataParams, fileName) + +/** + * \brief Dump PC sampling data into the file. + * + * This API can be called multiple times. + * It will append buffer in the file. + * For every buffer it will store BufferInfo + * so that before retrieving data it will help to allocate buffer + * to store retrieved data. + * This API creates file if file does not present. + * If stallReasonIndex or stallReasons pointer of \ref CUptiUtil_PutPcSampDataParams is NULL + * then stall reasons data will not be stored in file. + * It is expected to store all available stall reason data at least once to refer it during + * offline correlation. + * + * \retval CUPTI_UTIL_SUCCESS + * \retval CUPTI_UTIL_ERROR_INVALID_PARAMETER error out if buffer type is invalid + * or if either of pSamplingData, pParams pointer is NULL or stall reason configuration details not provided + * or filename is empty. + * \retval CUPTI_UTIL_ERROR_UNABLE_TO_CREATE_FILE + * \retval CUPTI_UTIL_ERROR_UNABLE_TO_OPEN_FILE + * \retval CUPTI_UTIL_ERROR_READ_WRITE_OPERATION_FAILED + */ +CUptiUtilResult CUPTIUTILAPI CuptiUtilPutPcSampData(CUptiUtil_PutPcSampDataParams *pParams); + +/** + * \brief Params for \ref CuptiUtilGetHeaderData + */ +typedef struct { + /** + * Size of the data structure i.e. CUpti_PCSamplingDisableParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * File handle. + */ + std::ifstream *fileHandler; + /** + * Header Info. + */ + Header headerInfo; + +} CUptiUtil_GetHeaderDataParams; +#define CUptiUtil_GetHeaderDataParamsSize CUPTI_UTIL_STRUCT_SIZE(CUptiUtil_GetHeaderDataParams, headerInfo) + +/** + * \brief Get header data of file. + * + * This API must be called once initially while retrieving data from file. + * \ref Header structure, it gives info about total number + * of buffers present in the file. + * + * \retval CUPTI_UTIL_SUCCESS + * \retval CUPTI_UTIL_ERROR_INVALID_PARAMETER error out if either of pParam or fileHandle is NULL or param struct size is incorrect. + * \retval CUPTI_UTIL_ERROR_FILE_HANDLE_CORRUPTED file handle is not in good state to read data from file + * \retval CUPTI_UTIL_ERROR_READ_WRITE_OPERATION_FAILED failed to read data from file. + */ +CUptiUtilResult CUPTIUTILAPI CuptiUtilGetHeaderData(CUptiUtil_GetHeaderDataParams *pParams); + +/** + * \brief Params for \ref CuptiUtilGetBufferInfo + */ +typedef struct { + /** + * Size of the data structure i.e. CUpti_PCSamplingDisableParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * File handle. + */ + std::ifstream *fileHandler; + /** + * Buffer Info. + */ + BufferInfo bufferInfoData; +} CUptiUtil_GetBufferInfoParams; +#define CUptiUtil_GetBufferInfoParamsSize CUPTI_UTIL_STRUCT_SIZE(CUptiUtil_GetBufferInfoParams, bufferInfoData) + +/** + * \brief Get buffer info data of file. + * + * This API must be called every time before calling CuptiUtilGetPcSampData API. + * \ref BufferInfo structure, it gives info about recordCount and stallReasonCount + * of every record in the buffer. This will help to allocate exact buffer to retrieve data into it. + * + * \retval CUPTI_UTIL_SUCCESS + * \retval CUPTI_UTIL_ERROR_INVALID_PARAMETER error out if either of pParam or fileHandle is NULL or param struct size is incorrect. + * \retval CUPTI_UTIL_ERROR_FILE_HANDLE_CORRUPTED file handle is not in good state to read data from file. + * \retval CUPTI_UTIL_ERROR_READ_WRITE_OPERATION_FAILED failed to read data from file. + */ +CUptiUtilResult CUPTIUTILAPI CuptiUtilGetBufferInfo(CUptiUtil_GetBufferInfoParams *pParams); + +/** + * \brief Params for \ref CuptiUtilGetPcSampData + */ +typedef struct { + /** + * Size of the data structure i.e. CUpti_PCSamplingDisableParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * File handle. + */ + std::ifstream *fileHandler; + /** + * Type of buffer to store in file + */ + PcSamplingBufferType bufferType; + /** + * Pointer to collected buffer info using \ref CuptiUtilGetBufferInfo + */ + BufferInfo *pBufferInfoData; + /** + * Pointer to allocated memory to store retrieved data from file. + */ + void *pSamplingData; + /** + * Number of configuration attributes + */ + size_t numAttributes; + /** + * Refer \ref CUpti_PCSamplingConfigurationInfo + */ + CUpti_PCSamplingConfigurationInfo *pPCSamplingConfigurationInfo; + /** + * Refer \ref PcSamplingStallReasons. + * For stallReasons field of \ref PcSamplingStallReasons it is expected to + * allocate memory for each string element of array. + */ + PcSamplingStallReasons *pPcSamplingStallReasons; +} CUptiUtil_GetPcSampDataParams; +#define CUptiUtil_GetPcSampDataParamsSize CUPTI_UTIL_STRUCT_SIZE(CUptiUtil_GetPcSampDataParams, pPcSamplingStallReasons) + +/** + * \brief Retrieve PC sampling data from file into allocated buffer. + * + * This API must be called after CuptiUtilGetBufferInfo API. + * It will retrieve data from file into allocated buffer. + * + * \retval CUPTI_UTIL_SUCCESS + * \retval CUPTI_UTIL_ERROR_INVALID_PARAMETER error out if buffer type is invalid + * or if either of pSampData, pParams is NULL. If pPcSamplingStallReasons is not NULL then + * error out if either of stallReasonIndex, stallReasons or stallReasons array element pointer is NULL. + * or filename is empty. + * \retval CUPTI_UTIL_ERROR_READ_WRITE_OPERATION_FAILED + * \retval CUPTI_UTIL_ERROR_FILE_HANDLE_CORRUPTED file handle is not in good state to read data from file. + */ +CUptiUtilResult CUPTIUTILAPI CuptiUtilGetPcSampData(CUptiUtil_GetPcSampDataParams *pParams); + +/** + * \brief Params for \ref CuptiUtilMergePcSampData + */ +typedef struct +{ + /** + * Size of the data structure i.e. CUpti_PCSamplingDisableParamsSize + * CUPTI client should set the size of the structure. It will be used in CUPTI to check what fields are + * available in the structure. Used to preserve backward compatibility. + */ + size_t size; + /** + * Number of buffers to merge. + */ + size_t numberOfBuffers; + /** + * Pointer to array of buffers to merge + */ + CUpti_PCSamplingData *PcSampDataBuffer; + /** + * Pointer to array of merged buffers as per the range id. + */ + CUpti_PCSamplingData **MergedPcSampDataBuffers; + /** + * Number of merged buffers. + */ + size_t *numMergedBuffer; +} CUptiUtil_MergePcSampDataParams; +#define CUptiUtil_MergePcSampDataParamsSize CUPTI_UTIL_STRUCT_SIZE(CUptiUtil_MergePcSampDataParams, numMergedBuffer) + +/** + * \brief Merge PC sampling data range id wise. + * + * This API merge PC sampling data range id wise. + * It allocates memory for merged data and fill data in it + * and provide buffer pointer in MergedPcSampDataBuffers field. + * It is expected from user to free merge data buffers after use. + * + * \retval CUPTI_UTIL_SUCCESS + * \retval CUPTI_UTIL_ERROR_INVALID_PARAMETER error out if param struct size is invalid + * or count of buffers to merge is invalid i.e less than 1 + * or either of PcSampDataBuffer, MergedPcSampDataBuffers, numMergedBuffer is NULL + * \retval CUPTI_UTIL_ERROR_OUT_OF_MEMORY Unable to allocate memory for merged buffer. + */ +CUptiUtilResult CUPTIUTILAPI CuptiUtilMergePcSampData(CUptiUtil_MergePcSampDataParams *pParams); + +/** @} */ /* END CUPTI_PCSAMPLING_UTILITY */ + +} } + +#if defined(__GNUC__) + #pragma GCC visibility pop +#endif + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/cuda_toolkit/include/cupti_profiler_target.h b/cuda_toolkit/include/cupti_profiler_target.h new file mode 100644 index 0000000000000000000000000000000000000000..274171c7b30e44b3ba16da87f149937b2c43381c --- /dev/null +++ b/cuda_toolkit/include/cupti_profiler_target.h @@ -0,0 +1,601 @@ +/* + * Copyright 2011-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(_CUPTI_PROFILER_TARGET_H_) +#define _CUPTI_PROFILER_TARGET_H_ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +/** + * \defgroup CUPTI_PROFILER_API CUPTI Profiling API + * Functions, types, and enums that implement the CUPTI Profiling API. + * @{ + */ +#ifndef CUPTI_PROFILER_STRUCT_SIZE +#define CUPTI_PROFILER_STRUCT_SIZE(type_, lastfield_) (offsetof(type_, lastfield_) + sizeof(((type_*)0)->lastfield_)) +#endif + +/** + * \brief Profiler range attribute + * + * A metric enabled in the session's configuration is collected separately per unique range-stack in the pass. + * This is an attribute to collect metrics around each kernel in a profiling session or in an user defined range. + */ +typedef enum +{ + /** + * Invalid value + */ + CUPTI_Range_INVALID, + /** + * Ranges are auto defined around each kernel in a profiling session + */ + CUPTI_AutoRange, + /** + * A range in which metric data to be collected is defined by the user + */ + CUPTI_UserRange, + /** + * Range count + */ + CUPTI_Range_COUNT, +} CUpti_ProfilerRange; + +/** + * \brief Profiler replay attribute + * + * For metrics which require multipass collection, a replay of the GPU kernel(s) is required. + * This is an attribute which specify how the replay of the kernel(s) to be measured is done. + */ +typedef enum +{ + /** + * Invalid Value + */ + CUPTI_Replay_INVALID, + /** + * Replay is done by CUPTI user around the process + */ + CUPTI_ApplicationReplay, + /** + * Replay is done around kernel implicitly by CUPTI + */ + CUPTI_KernelReplay, + /** + * Replay is done by CUPTI user within a process + */ + CUPTI_UserReplay, + /** + * Replay count + */ + CUPTI_Replay_COUNT, +} CUpti_ProfilerReplayMode; + +/** + * \brief Default parameter for cuptiProfilerInitialize + */ +typedef struct CUpti_Profiler_Initialize_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_Initialize_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + +} CUpti_Profiler_Initialize_Params; +#define CUpti_Profiler_Initialize_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_Initialize_Params, pPriv) + +/** + * \brief Default parameter for cuptiProfilerDeInitialize + */ +typedef struct CUpti_Profiler_DeInitialize_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_DeInitialize_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + +} CUpti_Profiler_DeInitialize_Params; +#define CUpti_Profiler_DeInitialize_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_DeInitialize_Params, pPriv) + +/** + * \brief Initializes the profiler interface + * + * Loads the required libraries in the process address space. + * Sets up the hooks with the CUDA driver. + */ +CUptiResult CUPTIAPI cuptiProfilerInitialize(CUpti_Profiler_Initialize_Params *pParams); + +/** + * \brief DeInitializes the profiler interface + */ +CUptiResult CUPTIAPI cuptiProfilerDeInitialize(CUpti_Profiler_DeInitialize_Params *pParams); + +/** + * \brief Input parameter to define the counterDataImage + */ +typedef struct CUpti_Profiler_CounterDataImageOptions +{ + size_t structSize; //!< [in] CUpti_Profiler_CounterDataImageOptions_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + const uint8_t* pCounterDataPrefix; /**< [in] Address of CounterDataPrefix generated from NVPW_CounterDataBuilder_GetCounterDataPrefix(). + Must be align(8).*/ + size_t counterDataPrefixSize; //!< [in] Size of CounterDataPrefix generated from NVPW_CounterDataBuilder_GetCounterDataPrefix(). + uint32_t maxNumRanges; //!< [in] Maximum number of ranges that can be profiled + uint32_t maxNumRangeTreeNodes; //!< [in] Maximum number of RangeTree nodes; must be >= maxNumRanges + uint32_t maxRangeNameLength; //!< [in] Maximum string length of each RangeName, including the trailing NULL character +} CUpti_Profiler_CounterDataImageOptions; +#define CUpti_Profiler_CounterDataImageOptions_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_CounterDataImageOptions, maxRangeNameLength) + +/** + * \brief Params for cuptiProfilerCounterDataImageCalculateSize + */ +typedef struct CUpti_Profiler_CounterDataImage_CalculateSize_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_CounterDataImage_CalculateSize_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + size_t sizeofCounterDataImageOptions; //!< [in] CUpti_Profiler_CounterDataImageOptions_STRUCT_SIZE + const CUpti_Profiler_CounterDataImageOptions* pOptions; //!< [in] Pointer to Counter Data Image Options + size_t counterDataImageSize; //!< [out] +} CUpti_Profiler_CounterDataImage_CalculateSize_Params; +#define CUpti_Profiler_CounterDataImage_CalculateSize_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_CounterDataImage_CalculateSize_Params, counterDataImageSize) + +/** + * \brief Params for cuptiProfilerCounterDataImageInitialize + */ +typedef struct CUpti_Profiler_CounterDataImage_Initialize_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_CounterDataImage_Initialize_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + size_t sizeofCounterDataImageOptions; //!< [in] CUpti_Profiler_CounterDataImageOptions_STRUCT_SIZE + const CUpti_Profiler_CounterDataImageOptions* pOptions; //!< [in] Pointer to Counter Data Image Options + size_t counterDataImageSize; //!< [in] Size calculated from cuptiProfilerCounterDataImageCalculateSize + uint8_t* pCounterDataImage; //!< [in] The buffer to be initialized. +} CUpti_Profiler_CounterDataImage_Initialize_Params; +#define CUpti_Profiler_CounterDataImage_Initialize_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_CounterDataImage_Initialize_Params, pCounterDataImage) + +/** + * \brief A CounterData image allocates space for values for each counter for each range. + * + * User borne the resposibility of managing the counterDataImage allocations. + * CounterDataPrefix contains meta data about the metrics that will be stored in counterDataImage. + * Use these APIs to calculate the allocation size and initialize counterData image. + */ +CUptiResult cuptiProfilerCounterDataImageCalculateSize(CUpti_Profiler_CounterDataImage_CalculateSize_Params* pParams); +CUptiResult cuptiProfilerCounterDataImageInitialize(CUpti_Profiler_CounterDataImage_Initialize_Params* pParams); + +/** + * \brief Params for cuptiProfilerCounterDataImageCalculateScratchBufferSize + */ +typedef struct CUpti_Profiler_CounterDataImage_CalculateScratchBufferSize_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_CounterDataImage_CalculateScratchBufferSize_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + size_t counterDataImageSize; //!< [in] size calculated from cuptiProfilerCounterDataImageCalculateSize + uint8_t* pCounterDataImage; //!< [in] + size_t counterDataScratchBufferSize; //!< [out] +} CUpti_Profiler_CounterDataImage_CalculateScratchBufferSize_Params; +#define CUpti_Profiler_CounterDataImage_CalculateScratchBufferSize_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_CounterDataImage_CalculateScratchBufferSize_Params, counterDataScratchBufferSize) + +/** + * \brief Params for cuptiProfilerCounterDataImageInitializeScratchBuffer + */ +typedef struct CUpti_Profiler_CounterDataImage_InitializeScratchBuffer_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_CounterDataImage_InitializeScratchBuffer_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + size_t counterDataImageSize; //!< [in] size calculated from cuptiProfilerCounterDataImageCalculateSize + uint8_t* pCounterDataImage; //!< [in] + size_t counterDataScratchBufferSize; //!< [in] size calculated using cuptiProfilerCounterDataImageCalculateScratchBufferSize + uint8_t* pCounterDataScratchBuffer; //!< [in] the scratch buffer to be initialized. +} CUpti_Profiler_CounterDataImage_InitializeScratchBuffer_Params; +#define CUpti_Profiler_CounterDataImage_InitializeScratchBuffer_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_CounterDataImage_InitializeScratchBuffer_Params, pCounterDataScratchBuffer) + +/** + * \brief A temporary storage for CounterData image needed for internal operations + * + * Use these APIs to calculate the allocation size and initialize counterData image scratch buffer. + */ +CUptiResult cuptiProfilerCounterDataImageCalculateScratchBufferSize(CUpti_Profiler_CounterDataImage_CalculateScratchBufferSize_Params* pParams); +CUptiResult cuptiProfilerCounterDataImageInitializeScratchBuffer(CUpti_Profiler_CounterDataImage_InitializeScratchBuffer_Params* pParams); + +/** + * \brief Params for cuptiProfilerBeginSession + */ +typedef struct CUpti_Profiler_BeginSession_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_BeginSession_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used + size_t counterDataImageSize; //!< [in] size calculated from cuptiProfilerCounterDataImageCalculateSize + uint8_t* pCounterDataImage; //!< [in] address of CounterDataImage + size_t counterDataScratchBufferSize; //!< [in] size calculated from cuptiProfilerCounterDataImageInitializeScratchBuffer + uint8_t* pCounterDataScratchBuffer; //!< [in] address of CounterDataImage scratch buffer + uint8_t bDumpCounterDataInFile; //!< [in] [optional] + const char* pCounterDataFilePath; //!< [in] [optional] + CUpti_ProfilerRange range; //!< [in] CUpti_ProfilerRange + CUpti_ProfilerReplayMode replayMode; //!< [in] CUpti_ProfilerReplayMode + /* Replay options, required when replay is done by cupti user */ + size_t maxRangesPerPass; //!< [in] Maximum number of ranges that can be recorded in a single pass. + size_t maxLaunchesPerPass; //!< [in] Maximum number of kernel launches that can be recorded in a single pass; must be >= maxRangesPerPass. + +} CUpti_Profiler_BeginSession_Params; +#define CUpti_Profiler_BeginSession_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_BeginSession_Params, maxLaunchesPerPass) +/** + * \brief Params for cuptiProfilerEndSession + */ +typedef struct CUpti_Profiler_EndSession_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_EndSession_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used +} CUpti_Profiler_EndSession_Params; +#define CUpti_Profiler_EndSession_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_EndSession_Params, ctx) + +/** + * \brief Begin profiling session sets up the profiling on the device + * + * Although, it doesn't start the profiling but GPU resources needed for profiling are allocated. + * Outside of a session, the GPU will return to its normal operating state. + */ +CUptiResult CUPTIAPI cuptiProfilerBeginSession(CUpti_Profiler_BeginSession_Params* pParams); +/** + * \brief Ends profiling session + * + * Frees up the GPU resources acquired for profiling. + * Outside of a session, the GPU will return to it's normal operating state. + */ +CUptiResult CUPTIAPI cuptiProfilerEndSession(CUpti_Profiler_EndSession_Params* pParams); + +/** + * \brief Params for cuptiProfilerSetConfig + */ +typedef struct CUpti_Profiler_SetConfig_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_SetConfig_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used + const uint8_t* pConfig; //!< [in] Config created by NVPW_RawMetricsConfig_GetConfigImage(). Must be align(8). + size_t configSize; //!< [in] size of config + uint16_t minNestingLevel; //!< [in] the lowest nesting level to be profiled; must be >= 1 + uint16_t numNestingLevels; //!< [in] the number of nesting levels to profile; must be >= 1 + size_t passIndex; //!< [in] Set this to zero for in-app replay; set this to the output of EndPass() for application replay + uint16_t targetNestingLevel; //!< [in] Set this to minNestingLevel for in-app replay; set this to the output of EndPass() for application +} CUpti_Profiler_SetConfig_Params; + +#define CUpti_Profiler_SetConfig_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_SetConfig_Params, targetNestingLevel) + +/** + * \brief Params for cuptiProfilerUnsetConfig + */ +typedef struct CUpti_Profiler_UnsetConfig_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_UnsetConfig_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used +} CUpti_Profiler_UnsetConfig_Params; +#define CUpti_Profiler_UnsetConfig_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_UnsetConfig_Params, ctx) + +/** + * \brief Set metrics configuration to be profiled + * + * Use these APIs to set the config to profile in a session. It can be used for advanced cases such as where multiple + * configurations are collected into a single CounterData Image on the need basis, without restarting the session. + */ +CUptiResult CUPTIAPI cuptiProfilerSetConfig(CUpti_Profiler_SetConfig_Params* pParams); +/** + * \brief Unset metrics configuration profiled + * + */ +CUptiResult CUPTIAPI cuptiProfilerUnsetConfig(CUpti_Profiler_UnsetConfig_Params* pParams); + +/** + * \brief Params for cuptiProfilerBeginPass + */ +typedef struct CUpti_Profiler_BeginPass_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_BeginPass_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used +} CUpti_Profiler_BeginPass_Params; +#define CUpti_Profiler_BeginPass_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_BeginPass_Params, ctx) + +/** + * \brief Params for cuptiProfilerEndPass + */ +typedef struct CUpti_Profiler_EndPass_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_EndPass_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used + uint16_t targetNestingLevel; //! [out] The targetNestingLevel that will be collected by the *next* BeginPass. + size_t passIndex; //!< [out] The passIndex that will be collected by the *next* BeginPass + uint8_t allPassesSubmitted; //!< [out] becomes true when the last pass has been queued to the GPU +} CUpti_Profiler_EndPass_Params; +#define CUpti_Profiler_EndPass_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_EndPass_Params, allPassesSubmitted) + +/** + * \brief Replay API: used for multipass collection. + + * These APIs are used if user chooses to replay by itself \ref CUPTI_UserReplay or \ref CUPTI_ApplicationReplay + * for multipass collection of the metrics configurations. + * It's a no-op in case of \ref CUPTI_KernelReplay. + */ +CUptiResult cuptiProfilerBeginPass(CUpti_Profiler_BeginPass_Params* pParams); + +/** + * \brief Replay API: used for multipass collection. + + * These APIs are used if user chooses to replay by itself \ref CUPTI_UserReplay or \ref CUPTI_ApplicationReplay + * for multipass collection of the metrics configurations. + * Its a no-op in case of \ref CUPTI_KernelReplay. + * Returns information for next pass. + */ +CUptiResult cuptiProfilerEndPass(CUpti_Profiler_EndPass_Params* pParams); + +/** + * \brief Params for cuptiProfilerEnableProfiling + */ +typedef struct CUpti_Profiler_EnableProfiling_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_EnableProfiling_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used +} CUpti_Profiler_EnableProfiling_Params; +#define CUpti_Profiler_EnableProfiling_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_EnableProfiling_Params, ctx) + +/** + * \brief Params for cuptiProfilerDisableProfiling + */ +typedef struct CUpti_Profiler_DisableProfiling_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_DisableProfiling_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used +} CUpti_Profiler_DisableProfiling_Params; +#define CUpti_Profiler_DisableProfiling_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_DisableProfiling_Params, ctx) + +/** + * \brief Enables Profiling + * + * In \ref CUPTI_AutoRange, these APIs are used to enable/disable profiling for the kernels to be executed in + * a profiling session. + */ +CUptiResult CUPTIAPI cuptiProfilerEnableProfiling(CUpti_Profiler_EnableProfiling_Params* pParams); + +/** + * \brief Disable Profiling + * + * In \ref CUPTI_AutoRange, these APIs are used to enable/disable profiling for the kernels to be executed in + * a profiling session. + */ +CUptiResult CUPTIAPI cuptiProfilerDisableProfiling(CUpti_Profiler_DisableProfiling_Params* pParams); + +/** + * \brief Params for cuptiProfilerIsPassCollected + */ +typedef struct CUpti_Profiler_IsPassCollected_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_IsPassCollected_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used + size_t numRangesDropped; //!< [out] number of ranges whose data was dropped in the processed pass + size_t numTraceBytesDropped; //!< [out] number of bytes not written to TraceBuffer due to buffer full + uint8_t onePassCollected; //!< [out] true if a pass was successfully decoded + uint8_t allPassesCollected; //!< [out] becomes true when the last pass has been decoded +} CUpti_Profiler_IsPassCollected_Params; +#define CUpti_Profiler_IsPassCollected_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_IsPassCollected_Params, allPassesCollected) + +/** + * \brief Asynchronous call to query if the submitted pass to GPU is collected + * + */ +CUptiResult CUPTIAPI cuptiProfilerIsPassCollected(CUpti_Profiler_IsPassCollected_Params* pParams); + +/** + * \brief Params for cuptiProfilerFlushCounterData + */ +typedef struct CUpti_Profiler_FlushCounterData_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_FlushCounterData_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used + size_t numRangesDropped; //!< [out] number of ranges whose data was dropped in the processed passes + size_t numTraceBytesDropped; //!< [out] number of bytes not written to TraceBuffer due to buffer full +} CUpti_Profiler_FlushCounterData_Params; +#define CUpti_Profiler_FlushCounterData_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_FlushCounterData_Params, numTraceBytesDropped) + +/** + * \brief Decode all the submitted passes + * + * Flush Counter data API to ensure every pass is decoded into the counterDataImage passed at beginSession. + * This will cause the CPU/GPU sync to collect all the undecoded pass. + */ +CUptiResult CUPTIAPI cuptiProfilerFlushCounterData(CUpti_Profiler_FlushCounterData_Params* pParams); + +typedef struct CUpti_Profiler_PushRange_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_PushRange_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used + const char* pRangeName; //!< [in] specifies the range for subsequent launches; must not be NULL + size_t rangeNameLength; //!< [in] assign to strlen(pRangeName) if known; if set to zero, the library will call strlen() +} CUpti_Profiler_PushRange_Params; +#define CUpti_Profiler_PushRange_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_PushRange_Params, rangeNameLength) + +typedef struct CUpti_Profiler_PopRange_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_PopRange_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used +} CUpti_Profiler_PopRange_Params; +#define CUpti_Profiler_PopRange_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_PopRange_Params, ctx) + + +/** + * \brief Range API's : Push user range + * + * Counter data is collected per unique range-stack. Identified by a string label passsed by the user. + * It's an invalid operation in case of \ref CUPTI_AutoRange. + */ +CUptiResult CUPTIAPI cuptiProfilerPushRange(CUpti_Profiler_PushRange_Params *pParams); + +/** + * \brief Range API's : Pop user range + * + * Counter data is collected per unique range-stack. Identified by a string label passsed by the user. + * It's an invalid operation in case of \ref CUPTI_AutoRange. + */ +CUptiResult CUPTIAPI cuptiProfilerPopRange(CUpti_Profiler_PopRange_Params *pParams); + +/** + * \brief Params for cuptiProfilerGetCounterAvailability + */ +typedef struct CUpti_Profiler_GetCounterAvailability_Params +{ + size_t structSize; //!< [in] CUpti_Profiler_GetCounterAvailability_Params_STRUCT_SIZE + void* pPriv; //!< [in] assign to NULL + CUcontext ctx; //!< [in] if NULL, the current CUcontext is used + size_t counterAvailabilityImageSize; //!< [in/out] If `pCounterAvailabilityImage` is NULL, then the required size is returned in + //!< `counterAvailabilityImageSize`, otherwise `counterAvailabilityImageSize` should be set to the size of + //!< `pCounterAvailabilityImage`, and on return it would be overwritten with number of actual bytes copied + uint8_t* pCounterAvailabilityImage; //!< [in] buffer receiving counter availability image, may be NULL +} CUpti_Profiler_GetCounterAvailability_Params; +#define CUpti_Profiler_GetCounterAvailability_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_GetCounterAvailability_Params, pCounterAvailabilityImage) + +/** + * \brief Query counter availibility + * + * Use this API to query counter availability information in a buffer which can be used to filter unavailable raw metrics on host. + * Note: This API may fail, if any profiling or sampling session is active on the specified context or its device. + */ +CUptiResult CUPTIAPI cuptiProfilerGetCounterAvailability(CUpti_Profiler_GetCounterAvailability_Params *pParams); + +/// Generic support level enum for CUPTI +typedef enum +{ + CUPTI_PROFILER_CONFIGURATION_UNKNOWN = 0, //!< Configuration support level unknown - either detection code errored out before setting this value, or unable to determine it + CUPTI_PROFILER_CONFIGURATION_UNSUPPORTED, //!< Profiling is unavailable. For specific feature fields, this means that the current configuration of this feature does not work with profiling. For instance, SLI-enabled devices do not support profiling, and this value would be returned for SLI on an SLI-enabled device. + CUPTI_PROFILER_CONFIGURATION_DISABLED, //!< Profiling would be available for this configuration, but was disabled by the system + CUPTI_PROFILER_CONFIGURATION_SUPPORTED //!< Profiling is supported. For specific feature fields, this means that the current configuration of this feature works with profiling. For instance, SLI-enabled devices do not support profiling, and this value would only be returned for devices which are not SLI-enabled. +} CUpti_Profiler_Support_Level; + +/** + * \brief Profiler API types + */ +typedef enum +{ + CUPTI_PROFILER_RANGE_PROFILING = 0, //!< CUPTI APIs for range based profiling (cuptiProfiler*) + CUPTI_PROFILER_PC_SAMPLING, //!< CUPTI APIs collecting pc sampling data (cuptiPcSampling*) + CUPTI_PROFILER_SASS_METRICS, //!< CUPTI APIs collecting SASS metrics data (cuptiSassMetrics*) + CUPTI_PROFILER_UNKNOWN +} CUpti_Profiler_API; + +/** + * \brief Params for cuptiProfilerDeviceSupported + */ +typedef struct +{ + size_t structSize; //!< [in] Must be CUpti_Profiler_DeviceSupported_Params_STRUCT_SIZE + void *pPriv; //!< [in] assign to NULL + CUdevice cuDevice; //!< [in] if NULL, the current CUcontext is used + + CUpti_Profiler_Support_Level isSupported; //!< [out] overall SUPPORTED / UNSUPPORTED flag representing whether Profiling and PC Sampling APIs work on the given device and configuration. SUPPORTED if all following flags are SUPPORTED, UNSUPPORTED otherwise. + + CUpti_Profiler_Support_Level architecture; //!< [out] SUPPORTED if the device architecture level supports the Profiling API (Compute Capability >= 7.0), UNSUPPORTED otherwise + CUpti_Profiler_Support_Level sli; //!< [out] SUPPORTED if SLI is not enabled, UNSUPPORTED otherwise + CUpti_Profiler_Support_Level vGpu; //!< [out] SUPPORTED if vGPU is supported and profiling is enabled, DISABLED if profiling is supported but not enabled, UNSUPPORTED otherwise + CUpti_Profiler_Support_Level confidentialCompute; //!< [out] SUPPORTED if confidential compute is not enabled, UNSUPPORTED otherwise + CUpti_Profiler_Support_Level cmp; //!< [out] SUPPORTED if not NVIDIA Crypto Mining Processors (CMP), UNSUPPORTED otherwise + CUpti_Profiler_Support_Level wsl; //!< [out] SUPPORTED if WSL supported, UNSUPPORTED otherwise + CUpti_Profiler_API api; //!< [in] the CUPTI API type for which device support will be checked +} CUpti_Profiler_DeviceSupported_Params; +#define CUpti_Profiler_DeviceSupported_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Profiler_DeviceSupported_Params, api) + +/** + * \brief Query device compatibility with Profiling API + * + * Use this call to determine whether a compute device and configuration are compatible with the Profiling API. + * If the configuration does not support profiling, one of several flags will indicate why. + */ +CUptiResult CUPTIAPI cuptiProfilerDeviceSupported(CUpti_Profiler_DeviceSupported_Params *pParams); + +/** @} */ /* END CUPTI_METRIC_API */ +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*_CUPTI_PROFILER_TARGET_H_*/ diff --git a/cuda_toolkit/include/cupti_result.h b/cuda_toolkit/include/cupti_result.h new file mode 100644 index 0000000000000000000000000000000000000000..8e6a0f86c43147592793127869a945e454560e37 --- /dev/null +++ b/cuda_toolkit/include/cupti_result.h @@ -0,0 +1,346 @@ +/* + * Copyright 2010-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(_CUPTI_RESULT_H_) +#define _CUPTI_RESULT_H_ + +#ifndef CUPTIAPI +#ifdef _WIN32 +#define CUPTIAPI __stdcall +#else +#define CUPTIAPI +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +/** + * \defgroup CUPTI_RESULT_API CUPTI Result Codes + * Error and result codes returned by CUPTI functions. + * @{ + */ + +/** + * \brief CUPTI result codes. + * + * Error and result codes returned by CUPTI functions. + */ +typedef enum { + /** + * No error. + */ + CUPTI_SUCCESS = 0, + /** + * One or more of the parameters is invalid. + */ + CUPTI_ERROR_INVALID_PARAMETER = 1, + /** + * The device does not correspond to a valid CUDA device. + */ + CUPTI_ERROR_INVALID_DEVICE = 2, + /** + * The context is NULL or not valid. + */ + CUPTI_ERROR_INVALID_CONTEXT = 3, + /** + * The event domain id is invalid. + */ + CUPTI_ERROR_INVALID_EVENT_DOMAIN_ID = 4, + /** + * The event id is invalid. + */ + CUPTI_ERROR_INVALID_EVENT_ID = 5, + /** + * The event name is invalid. + */ + CUPTI_ERROR_INVALID_EVENT_NAME = 6, + /** + * The current operation cannot be performed due to dependency on + * other factors. + */ + CUPTI_ERROR_INVALID_OPERATION = 7, + /** + * Unable to allocate enough memory to perform the requested + * operation. + */ + CUPTI_ERROR_OUT_OF_MEMORY = 8, + /** + * An error occurred on the performance monitoring hardware. + */ + CUPTI_ERROR_HARDWARE = 9, + /** + * The output buffer size is not sufficient to return all + * requested data. + */ + CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT = 10, + /** + * API is not implemented. + */ + CUPTI_ERROR_API_NOT_IMPLEMENTED = 11, + /** + * The maximum limit is reached. + */ + CUPTI_ERROR_MAX_LIMIT_REACHED = 12, + /** + * The object is not yet ready to perform the requested operation. + */ + CUPTI_ERROR_NOT_READY = 13, + /** + * The current operation is not compatible with the current state + * of the object + */ + CUPTI_ERROR_NOT_COMPATIBLE = 14, + /** + * CUPTI is unable to initialize its connection to the CUDA + * driver. + */ + CUPTI_ERROR_NOT_INITIALIZED = 15, + /** + * The metric id is invalid. + */ + CUPTI_ERROR_INVALID_METRIC_ID = 16, + /** + * The metric name is invalid. + */ + CUPTI_ERROR_INVALID_METRIC_NAME = 17, + /** + * The queue is empty. + */ + CUPTI_ERROR_QUEUE_EMPTY = 18, + /** + * Invalid handle (internal?). + */ + CUPTI_ERROR_INVALID_HANDLE = 19, + /** + * Invalid stream. + */ + CUPTI_ERROR_INVALID_STREAM = 20, + /** + * Invalid kind. + */ + CUPTI_ERROR_INVALID_KIND = 21, + /** + * Invalid event value. + */ + CUPTI_ERROR_INVALID_EVENT_VALUE = 22, + /** + * CUPTI is disabled due to conflicts with other enabled profilers + */ + CUPTI_ERROR_DISABLED = 23, + /** + * Invalid module. + */ + CUPTI_ERROR_INVALID_MODULE = 24, + /** + * Invalid metric value. + */ + CUPTI_ERROR_INVALID_METRIC_VALUE = 25, + /** + * The performance monitoring hardware is in use by other client. + */ + CUPTI_ERROR_HARDWARE_BUSY = 26, + /** + * The attempted operation is not supported on the current + * system or device. + */ + CUPTI_ERROR_NOT_SUPPORTED = 27, + /** + * Unified memory profiling is not supported on the system. + * Potential reason could be unsupported OS or architecture. + */ + CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED = 28, + /** + * Unified memory profiling is not supported on the device + */ + CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED_ON_DEVICE = 29, + /** + * Unified memory profiling is not supported on a multi-GPU + * configuration without P2P support between any pair of devices + */ + CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED_ON_NON_P2P_DEVICES = 30, + /** + * Unified memory profiling is not supported under the + * Multi-Process Service (MPS) environment. CUDA 7.5 removes this + * restriction. + */ + CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED_WITH_MPS = 31, + /** + * In CUDA 9.0, devices with compute capability 7.0 don't + * support CDP tracing + */ + CUPTI_ERROR_CDP_TRACING_NOT_SUPPORTED = 32, + /** + * Profiling on virtualized GPU is not supported. + */ + CUPTI_ERROR_VIRTUALIZED_DEVICE_NOT_SUPPORTED = 33, + /** + * Profiling results might be incorrect for CUDA applications + * compiled with nvcc version older than 9.0 for devices with + * compute capability 6.0 and 6.1. + * Profiling session will continue and CUPTI will notify it using this error code. + * User is advised to recompile the application code with nvcc version 9.0 or later. + * Ignore this warning if code is already compiled with the recommended nvcc version. + */ + CUPTI_ERROR_CUDA_COMPILER_NOT_COMPATIBLE = 34, + /** + * User doesn't have sufficient privileges which are required to + * start the profiling session. + * One possible reason for this may be that the NVIDIA driver or your system + * administrator may have restricted access to the NVIDIA GPU performance counters. + * To learn how to resolve this issue and find more information, please visit + * https://developer.nvidia.com/CUPTI_ERROR_INSUFFICIENT_PRIVILEGES + */ + CUPTI_ERROR_INSUFFICIENT_PRIVILEGES = 35, + /** + * Legacy CUPTI Profiling API i.e. event API from the header cupti_events.h and + * metric API from the header cupti_metrics.h are not compatible with the + * Profiling API in the header cupti_profiler_target.h and Perfworks metrics API + * in the headers nvperf_host.h and nvperf_target.h. + */ + CUPTI_ERROR_OLD_PROFILER_API_INITIALIZED = 36, + /** + * Missing definition of the OpenACC API routine in the linked OpenACC library. + * + * One possible reason is that OpenACC library is linked statically in the + * user application, which might not have the definition of all the OpenACC + * API routines needed for the OpenACC profiling, as compiler might ignore + * definitions for the functions not used in the application. This issue + * can be mitigated by linking the OpenACC library dynamically. + */ + CUPTI_ERROR_OPENACC_UNDEFINED_ROUTINE = 37, + /** + * Legacy CUPTI Profiling API i.e. event API from the header cupti_events.h and + * metric API from the header cupti_metrics.h are not supported on devices with + * compute capability 7.5 and higher (i.e. Turing and later GPU architectures). + * These API will be deprecated in a future CUDA release. These are replaced by + * Profiling API in the header cupti_profiler_target.h and Perfworks metrics API + * in the headers nvperf_host.h and nvperf_target.h. + */ + CUPTI_ERROR_LEGACY_PROFILER_NOT_SUPPORTED = 38, + /** + * CUPTI doesn't allow multiple callback subscribers. Only a single subscriber + * can be registered at a time. + * Same error code is used when application is launched using NVIDIA tools + * like nvprof, Visual Profiler, Nsight Systems, Nsight Compute, cuda-gdb and + * cuda-memcheck. + */ + CUPTI_ERROR_MULTIPLE_SUBSCRIBERS_NOT_SUPPORTED = 39, + /** + * Profiling on virtualized GPU is not allowed by hypervisor. + */ + CUPTI_ERROR_VIRTUALIZED_DEVICE_INSUFFICIENT_PRIVILEGES = 40, + /** + * Profiling and tracing are not allowed when confidential computing mode + * is enabled. + */ + CUPTI_ERROR_CONFIDENTIAL_COMPUTING_NOT_SUPPORTED = 41, + /** + * CUPTI does not support NVIDIA Crypto Mining Processors (CMP). + * For more information, please visit https://developer.nvidia.com/ERR_NVCMPGPU + */ + CUPTI_ERROR_CMP_DEVICE_NOT_SUPPORTED = 42, + /** + * An unknown internal error has occurred. + */ + CUPTI_ERROR_UNKNOWN = 999, + CUPTI_ERROR_FORCE_INT = 0x7fffffff +} CUptiResult; + +/** + * \brief Get the descriptive string for a CUptiResult. + * + * Return the descriptive string for a CUptiResult in \p *str. + * \note \b Thread-safety: this function is thread safe. + * + * \param result The result to get the string for + * \param str Returns the string + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p str is NULL or \p + * result is not a valid CUptiResult + */ +CUptiResult CUPTIAPI cuptiGetResultString(CUptiResult result, const char **str); + +/** + * @brief Get the descriptive message corresponding to error codes returned + * by CUPTI. + * + * Return the descriptive error message for a CUptiResult in \p *str. + * \note \b Thread-safety: this function is thread safe. + * + * \param result The result to get the descriptive error message for + * \param str Returns the error message string + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p str is NULL or \p + * result is not a valid CUptiResult + * + */ + +CUptiResult CUPTIAPI cuptiGetErrorMessage(CUptiResult result, const char **str); + +/** @} */ /* END CUPTI_RESULT_API */ + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /*_CUPTI_RESULT_H_*/ + + diff --git a/cuda_toolkit/include/cupti_runtime_cbid.h b/cuda_toolkit/include/cupti_runtime_cbid.h new file mode 100644 index 0000000000000000000000000000000000000000..bfa1ba07e249cb200615a36dc8ae3ad1cfd90103 --- /dev/null +++ b/cuda_toolkit/include/cupti_runtime_cbid.h @@ -0,0 +1,481 @@ + +// ************************************************************************* +// Definitions of indices for API functions, unique across entire API +// ************************************************************************* + +// This file is generated. Any changes you make will be lost during the next clean build. +// CUDA public interface, for type definitions and cu* function prototypes + +typedef enum CUpti_runtime_api_trace_cbid_enum { + CUPTI_RUNTIME_TRACE_CBID_INVALID = 0, + CUPTI_RUNTIME_TRACE_CBID_cudaDriverGetVersion_v3020 = 1, + CUPTI_RUNTIME_TRACE_CBID_cudaRuntimeGetVersion_v3020 = 2, + CUPTI_RUNTIME_TRACE_CBID_cudaGetDeviceCount_v3020 = 3, + CUPTI_RUNTIME_TRACE_CBID_cudaGetDeviceProperties_v3020 = 4, + CUPTI_RUNTIME_TRACE_CBID_cudaChooseDevice_v3020 = 5, + CUPTI_RUNTIME_TRACE_CBID_cudaGetChannelDesc_v3020 = 6, + CUPTI_RUNTIME_TRACE_CBID_cudaCreateChannelDesc_v3020 = 7, + CUPTI_RUNTIME_TRACE_CBID_cudaConfigureCall_v3020 = 8, + CUPTI_RUNTIME_TRACE_CBID_cudaSetupArgument_v3020 = 9, + CUPTI_RUNTIME_TRACE_CBID_cudaGetLastError_v3020 = 10, + CUPTI_RUNTIME_TRACE_CBID_cudaPeekAtLastError_v3020 = 11, + CUPTI_RUNTIME_TRACE_CBID_cudaGetErrorString_v3020 = 12, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunch_v3020 = 13, + CUPTI_RUNTIME_TRACE_CBID_cudaFuncSetCacheConfig_v3020 = 14, + CUPTI_RUNTIME_TRACE_CBID_cudaFuncGetAttributes_v3020 = 15, + CUPTI_RUNTIME_TRACE_CBID_cudaSetDevice_v3020 = 16, + CUPTI_RUNTIME_TRACE_CBID_cudaGetDevice_v3020 = 17, + CUPTI_RUNTIME_TRACE_CBID_cudaSetValidDevices_v3020 = 18, + CUPTI_RUNTIME_TRACE_CBID_cudaSetDeviceFlags_v3020 = 19, + CUPTI_RUNTIME_TRACE_CBID_cudaMalloc_v3020 = 20, + CUPTI_RUNTIME_TRACE_CBID_cudaMallocPitch_v3020 = 21, + CUPTI_RUNTIME_TRACE_CBID_cudaFree_v3020 = 22, + CUPTI_RUNTIME_TRACE_CBID_cudaMallocArray_v3020 = 23, + CUPTI_RUNTIME_TRACE_CBID_cudaFreeArray_v3020 = 24, + CUPTI_RUNTIME_TRACE_CBID_cudaMallocHost_v3020 = 25, + CUPTI_RUNTIME_TRACE_CBID_cudaFreeHost_v3020 = 26, + CUPTI_RUNTIME_TRACE_CBID_cudaHostAlloc_v3020 = 27, + CUPTI_RUNTIME_TRACE_CBID_cudaHostGetDevicePointer_v3020 = 28, + CUPTI_RUNTIME_TRACE_CBID_cudaHostGetFlags_v3020 = 29, + CUPTI_RUNTIME_TRACE_CBID_cudaMemGetInfo_v3020 = 30, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy_v3020 = 31, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2D_v3020 = 32, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToArray_v3020 = 33, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DToArray_v3020 = 34, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromArray_v3020 = 35, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DFromArray_v3020 = 36, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyArrayToArray_v3020 = 37, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DArrayToArray_v3020 = 38, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToSymbol_v3020 = 39, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromSymbol_v3020 = 40, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyAsync_v3020 = 41, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToArrayAsync_v3020 = 42, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromArrayAsync_v3020 = 43, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DAsync_v3020 = 44, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DToArrayAsync_v3020 = 45, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DFromArrayAsync_v3020 = 46, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToSymbolAsync_v3020 = 47, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromSymbolAsync_v3020 = 48, + CUPTI_RUNTIME_TRACE_CBID_cudaMemset_v3020 = 49, + CUPTI_RUNTIME_TRACE_CBID_cudaMemset2D_v3020 = 50, + CUPTI_RUNTIME_TRACE_CBID_cudaMemsetAsync_v3020 = 51, + CUPTI_RUNTIME_TRACE_CBID_cudaMemset2DAsync_v3020 = 52, + CUPTI_RUNTIME_TRACE_CBID_cudaGetSymbolAddress_v3020 = 53, + CUPTI_RUNTIME_TRACE_CBID_cudaGetSymbolSize_v3020 = 54, + CUPTI_RUNTIME_TRACE_CBID_cudaBindTexture_v3020 = 55, + CUPTI_RUNTIME_TRACE_CBID_cudaBindTexture2D_v3020 = 56, + CUPTI_RUNTIME_TRACE_CBID_cudaBindTextureToArray_v3020 = 57, + CUPTI_RUNTIME_TRACE_CBID_cudaUnbindTexture_v3020 = 58, + CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureAlignmentOffset_v3020 = 59, + CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureReference_v3020 = 60, + CUPTI_RUNTIME_TRACE_CBID_cudaBindSurfaceToArray_v3020 = 61, + CUPTI_RUNTIME_TRACE_CBID_cudaGetSurfaceReference_v3020 = 62, + CUPTI_RUNTIME_TRACE_CBID_cudaGLSetGLDevice_v3020 = 63, + CUPTI_RUNTIME_TRACE_CBID_cudaGLRegisterBufferObject_v3020 = 64, + CUPTI_RUNTIME_TRACE_CBID_cudaGLMapBufferObject_v3020 = 65, + CUPTI_RUNTIME_TRACE_CBID_cudaGLUnmapBufferObject_v3020 = 66, + CUPTI_RUNTIME_TRACE_CBID_cudaGLUnregisterBufferObject_v3020 = 67, + CUPTI_RUNTIME_TRACE_CBID_cudaGLSetBufferObjectMapFlags_v3020 = 68, + CUPTI_RUNTIME_TRACE_CBID_cudaGLMapBufferObjectAsync_v3020 = 69, + CUPTI_RUNTIME_TRACE_CBID_cudaGLUnmapBufferObjectAsync_v3020 = 70, + CUPTI_RUNTIME_TRACE_CBID_cudaWGLGetDevice_v3020 = 71, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsGLRegisterImage_v3020 = 72, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsGLRegisterBuffer_v3020 = 73, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsUnregisterResource_v3020 = 74, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsResourceSetMapFlags_v3020 = 75, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsMapResources_v3020 = 76, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsUnmapResources_v3020 = 77, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsResourceGetMappedPointer_v3020 = 78, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsSubResourceGetMappedArray_v3020 = 79, + CUPTI_RUNTIME_TRACE_CBID_cudaVDPAUGetDevice_v3020 = 80, + CUPTI_RUNTIME_TRACE_CBID_cudaVDPAUSetVDPAUDevice_v3020 = 81, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsVDPAURegisterVideoSurface_v3020 = 82, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsVDPAURegisterOutputSurface_v3020 = 83, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D11GetDevice_v3020 = 84, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D11GetDevices_v3020 = 85, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D11SetDirect3DDevice_v3020 = 86, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsD3D11RegisterResource_v3020 = 87, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10GetDevice_v3020 = 88, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10GetDevices_v3020 = 89, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10SetDirect3DDevice_v3020 = 90, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsD3D10RegisterResource_v3020 = 91, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10RegisterResource_v3020 = 92, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10UnregisterResource_v3020 = 93, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10MapResources_v3020 = 94, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10UnmapResources_v3020 = 95, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceSetMapFlags_v3020 = 96, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceGetSurfaceDimensions_v3020 = 97, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceGetMappedArray_v3020 = 98, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceGetMappedPointer_v3020 = 99, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceGetMappedSize_v3020 = 100, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceGetMappedPitch_v3020 = 101, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9GetDevice_v3020 = 102, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9GetDevices_v3020 = 103, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9SetDirect3DDevice_v3020 = 104, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9GetDirect3DDevice_v3020 = 105, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsD3D9RegisterResource_v3020 = 106, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9RegisterResource_v3020 = 107, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9UnregisterResource_v3020 = 108, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9MapResources_v3020 = 109, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9UnmapResources_v3020 = 110, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceSetMapFlags_v3020 = 111, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceGetSurfaceDimensions_v3020 = 112, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceGetMappedArray_v3020 = 113, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceGetMappedPointer_v3020 = 114, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceGetMappedSize_v3020 = 115, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceGetMappedPitch_v3020 = 116, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9Begin_v3020 = 117, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9End_v3020 = 118, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9RegisterVertexBuffer_v3020 = 119, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9UnregisterVertexBuffer_v3020 = 120, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9MapVertexBuffer_v3020 = 121, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D9UnmapVertexBuffer_v3020 = 122, + CUPTI_RUNTIME_TRACE_CBID_cudaThreadExit_v3020 = 123, + CUPTI_RUNTIME_TRACE_CBID_cudaSetDoubleForDevice_v3020 = 124, + CUPTI_RUNTIME_TRACE_CBID_cudaSetDoubleForHost_v3020 = 125, + CUPTI_RUNTIME_TRACE_CBID_cudaThreadSynchronize_v3020 = 126, + CUPTI_RUNTIME_TRACE_CBID_cudaThreadGetLimit_v3020 = 127, + CUPTI_RUNTIME_TRACE_CBID_cudaThreadSetLimit_v3020 = 128, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamCreate_v3020 = 129, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamDestroy_v3020 = 130, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamSynchronize_v3020 = 131, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamQuery_v3020 = 132, + CUPTI_RUNTIME_TRACE_CBID_cudaEventCreate_v3020 = 133, + CUPTI_RUNTIME_TRACE_CBID_cudaEventCreateWithFlags_v3020 = 134, + CUPTI_RUNTIME_TRACE_CBID_cudaEventRecord_v3020 = 135, + CUPTI_RUNTIME_TRACE_CBID_cudaEventDestroy_v3020 = 136, + CUPTI_RUNTIME_TRACE_CBID_cudaEventSynchronize_v3020 = 137, + CUPTI_RUNTIME_TRACE_CBID_cudaEventQuery_v3020 = 138, + CUPTI_RUNTIME_TRACE_CBID_cudaEventElapsedTime_v3020 = 139, + CUPTI_RUNTIME_TRACE_CBID_cudaMalloc3D_v3020 = 140, + CUPTI_RUNTIME_TRACE_CBID_cudaMalloc3DArray_v3020 = 141, + CUPTI_RUNTIME_TRACE_CBID_cudaMemset3D_v3020 = 142, + CUPTI_RUNTIME_TRACE_CBID_cudaMemset3DAsync_v3020 = 143, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3D_v3020 = 144, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DAsync_v3020 = 145, + CUPTI_RUNTIME_TRACE_CBID_cudaThreadSetCacheConfig_v3020 = 146, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamWaitEvent_v3020 = 147, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D11GetDirect3DDevice_v3020 = 148, + CUPTI_RUNTIME_TRACE_CBID_cudaD3D10GetDirect3DDevice_v3020 = 149, + CUPTI_RUNTIME_TRACE_CBID_cudaThreadGetCacheConfig_v3020 = 150, + CUPTI_RUNTIME_TRACE_CBID_cudaPointerGetAttributes_v4000 = 151, + CUPTI_RUNTIME_TRACE_CBID_cudaHostRegister_v4000 = 152, + CUPTI_RUNTIME_TRACE_CBID_cudaHostUnregister_v4000 = 153, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceCanAccessPeer_v4000 = 154, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceEnablePeerAccess_v4000 = 155, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceDisablePeerAccess_v4000 = 156, + CUPTI_RUNTIME_TRACE_CBID_cudaPeerRegister_v4000 = 157, + CUPTI_RUNTIME_TRACE_CBID_cudaPeerUnregister_v4000 = 158, + CUPTI_RUNTIME_TRACE_CBID_cudaPeerGetDevicePointer_v4000 = 159, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyPeer_v4000 = 160, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyPeerAsync_v4000 = 161, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DPeer_v4000 = 162, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DPeerAsync_v4000 = 163, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceReset_v3020 = 164, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSynchronize_v3020 = 165, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetLimit_v3020 = 166, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSetLimit_v3020 = 167, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetCacheConfig_v3020 = 168, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSetCacheConfig_v3020 = 169, + CUPTI_RUNTIME_TRACE_CBID_cudaProfilerInitialize_v4000 = 170, + CUPTI_RUNTIME_TRACE_CBID_cudaProfilerStart_v4000 = 171, + CUPTI_RUNTIME_TRACE_CBID_cudaProfilerStop_v4000 = 172, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetByPCIBusId_v4010 = 173, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetPCIBusId_v4010 = 174, + CUPTI_RUNTIME_TRACE_CBID_cudaGLGetDevices_v4010 = 175, + CUPTI_RUNTIME_TRACE_CBID_cudaIpcGetEventHandle_v4010 = 176, + CUPTI_RUNTIME_TRACE_CBID_cudaIpcOpenEventHandle_v4010 = 177, + CUPTI_RUNTIME_TRACE_CBID_cudaIpcGetMemHandle_v4010 = 178, + CUPTI_RUNTIME_TRACE_CBID_cudaIpcOpenMemHandle_v4010 = 179, + CUPTI_RUNTIME_TRACE_CBID_cudaIpcCloseMemHandle_v4010 = 180, + CUPTI_RUNTIME_TRACE_CBID_cudaArrayGetInfo_v4010 = 181, + CUPTI_RUNTIME_TRACE_CBID_cudaFuncSetSharedMemConfig_v4020 = 182, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetSharedMemConfig_v4020 = 183, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSetSharedMemConfig_v4020 = 184, + CUPTI_RUNTIME_TRACE_CBID_cudaCreateTextureObject_v5000 = 185, + CUPTI_RUNTIME_TRACE_CBID_cudaDestroyTextureObject_v5000 = 186, + CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureObjectResourceDesc_v5000 = 187, + CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureObjectTextureDesc_v5000 = 188, + CUPTI_RUNTIME_TRACE_CBID_cudaCreateSurfaceObject_v5000 = 189, + CUPTI_RUNTIME_TRACE_CBID_cudaDestroySurfaceObject_v5000 = 190, + CUPTI_RUNTIME_TRACE_CBID_cudaGetSurfaceObjectResourceDesc_v5000 = 191, + CUPTI_RUNTIME_TRACE_CBID_cudaMallocMipmappedArray_v5000 = 192, + CUPTI_RUNTIME_TRACE_CBID_cudaGetMipmappedArrayLevel_v5000 = 193, + CUPTI_RUNTIME_TRACE_CBID_cudaFreeMipmappedArray_v5000 = 194, + CUPTI_RUNTIME_TRACE_CBID_cudaBindTextureToMipmappedArray_v5000 = 195, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsResourceGetMappedMipmappedArray_v5000 = 196, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamAddCallback_v5000 = 197, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamCreateWithFlags_v5000 = 198, + CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureObjectResourceViewDesc_v5000 = 199, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetAttribute_v5000 = 200, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamDestroy_v5050 = 201, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamCreateWithPriority_v5050 = 202, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetPriority_v5050 = 203, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetFlags_v5050 = 204, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetStreamPriorityRange_v5050 = 205, + CUPTI_RUNTIME_TRACE_CBID_cudaMallocManaged_v6000 = 206, + CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyMaxActiveBlocksPerMultiprocessor_v6000 = 207, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamAttachMemAsync_v6000 = 208, + CUPTI_RUNTIME_TRACE_CBID_cudaGetErrorName_v6050 = 209, + CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyMaxActiveBlocksPerMultiprocessor_v6050 = 210, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunchKernel_v7000 = 211, + CUPTI_RUNTIME_TRACE_CBID_cudaGetDeviceFlags_v7000 = 212, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunch_ptsz_v7000 = 213, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunchKernel_ptsz_v7000 = 214, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy_ptds_v7000 = 215, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2D_ptds_v7000 = 216, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToArray_ptds_v7000 = 217, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DToArray_ptds_v7000 = 218, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromArray_ptds_v7000 = 219, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DFromArray_ptds_v7000 = 220, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyArrayToArray_ptds_v7000 = 221, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DArrayToArray_ptds_v7000 = 222, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToSymbol_ptds_v7000 = 223, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromSymbol_ptds_v7000 = 224, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyAsync_ptsz_v7000 = 225, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToArrayAsync_ptsz_v7000 = 226, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromArrayAsync_ptsz_v7000 = 227, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DAsync_ptsz_v7000 = 228, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DToArrayAsync_ptsz_v7000 = 229, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DFromArrayAsync_ptsz_v7000 = 230, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToSymbolAsync_ptsz_v7000 = 231, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromSymbolAsync_ptsz_v7000 = 232, + CUPTI_RUNTIME_TRACE_CBID_cudaMemset_ptds_v7000 = 233, + CUPTI_RUNTIME_TRACE_CBID_cudaMemset2D_ptds_v7000 = 234, + CUPTI_RUNTIME_TRACE_CBID_cudaMemsetAsync_ptsz_v7000 = 235, + CUPTI_RUNTIME_TRACE_CBID_cudaMemset2DAsync_ptsz_v7000 = 236, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetPriority_ptsz_v7000 = 237, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetFlags_ptsz_v7000 = 238, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamSynchronize_ptsz_v7000 = 239, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamQuery_ptsz_v7000 = 240, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamAttachMemAsync_ptsz_v7000 = 241, + CUPTI_RUNTIME_TRACE_CBID_cudaEventRecord_ptsz_v7000 = 242, + CUPTI_RUNTIME_TRACE_CBID_cudaMemset3D_ptds_v7000 = 243, + CUPTI_RUNTIME_TRACE_CBID_cudaMemset3DAsync_ptsz_v7000 = 244, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3D_ptds_v7000 = 245, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DAsync_ptsz_v7000 = 246, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamWaitEvent_ptsz_v7000 = 247, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamAddCallback_ptsz_v7000 = 248, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DPeer_ptds_v7000 = 249, + CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DPeerAsync_ptsz_v7000 = 250, + CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags_v7000 = 251, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPrefetchAsync_v8000 = 252, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPrefetchAsync_ptsz_v8000 = 253, + CUPTI_RUNTIME_TRACE_CBID_cudaMemAdvise_v8000 = 254, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetP2PAttribute_v8000 = 255, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsEGLRegisterImage_v7000 = 256, + CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamConsumerConnect_v7000 = 257, + CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamConsumerDisconnect_v7000 = 258, + CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamConsumerAcquireFrame_v7000 = 259, + CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamConsumerReleaseFrame_v7000 = 260, + CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamProducerConnect_v7000 = 261, + CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamProducerDisconnect_v7000 = 262, + CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamProducerPresentFrame_v7000 = 263, + CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamProducerReturnFrame_v7000 = 264, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsResourceGetMappedEglFrame_v7000 = 265, + CUPTI_RUNTIME_TRACE_CBID_cudaMemRangeGetAttribute_v8000 = 266, + CUPTI_RUNTIME_TRACE_CBID_cudaMemRangeGetAttributes_v8000 = 267, + CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamConsumerConnectWithFlags_v7000 = 268, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernel_v9000 = 269, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernel_ptsz_v9000 = 270, + CUPTI_RUNTIME_TRACE_CBID_cudaEventCreateFromEGLSync_v9000 = 271, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernelMultiDevice_v9000 = 272, + CUPTI_RUNTIME_TRACE_CBID_cudaFuncSetAttribute_v9000 = 273, + CUPTI_RUNTIME_TRACE_CBID_cudaImportExternalMemory_v10000 = 274, + CUPTI_RUNTIME_TRACE_CBID_cudaExternalMemoryGetMappedBuffer_v10000 = 275, + CUPTI_RUNTIME_TRACE_CBID_cudaExternalMemoryGetMappedMipmappedArray_v10000 = 276, + CUPTI_RUNTIME_TRACE_CBID_cudaDestroyExternalMemory_v10000 = 277, + CUPTI_RUNTIME_TRACE_CBID_cudaImportExternalSemaphore_v10000 = 278, + CUPTI_RUNTIME_TRACE_CBID_cudaSignalExternalSemaphoresAsync_v10000 = 279, + CUPTI_RUNTIME_TRACE_CBID_cudaSignalExternalSemaphoresAsync_ptsz_v10000 = 280, + CUPTI_RUNTIME_TRACE_CBID_cudaWaitExternalSemaphoresAsync_v10000 = 281, + CUPTI_RUNTIME_TRACE_CBID_cudaWaitExternalSemaphoresAsync_ptsz_v10000 = 282, + CUPTI_RUNTIME_TRACE_CBID_cudaDestroyExternalSemaphore_v10000 = 283, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunchHostFunc_v10000 = 284, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunchHostFunc_ptsz_v10000 = 285, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphCreate_v10000 = 286, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphKernelNodeGetParams_v10000 = 287, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphKernelNodeSetParams_v10000 = 288, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddKernelNode_v10000 = 289, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemcpyNode_v10000 = 290, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemcpyNodeGetParams_v10000 = 291, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemcpyNodeSetParams_v10000 = 292, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemsetNode_v10000 = 293, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemsetNodeGetParams_v10000 = 294, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemsetNodeSetParams_v10000 = 295, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddHostNode_v10000 = 296, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphHostNodeGetParams_v10000 = 297, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddChildGraphNode_v10000 = 298, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphChildGraphNodeGetGraph_v10000 = 299, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddEmptyNode_v10000 = 300, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphClone_v10000 = 301, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeFindInClone_v10000 = 302, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetType_v10000 = 303, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphGetRootNodes_v10000 = 304, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetDependencies_v10000 = 305, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetDependentNodes_v10000 = 306, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddDependencies_v10000 = 307, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphRemoveDependencies_v10000 = 308, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphDestroyNode_v10000 = 309, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphInstantiate_v10000 = 310, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphLaunch_v10000 = 311, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphLaunch_ptsz_v10000 = 312, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecDestroy_v10000 = 313, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphDestroy_v10000 = 314, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamBeginCapture_v10000 = 315, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamBeginCapture_ptsz_v10000 = 316, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamIsCapturing_v10000 = 317, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamIsCapturing_ptsz_v10000 = 318, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamEndCapture_v10000 = 319, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamEndCapture_ptsz_v10000 = 320, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphHostNodeSetParams_v10000 = 321, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphGetNodes_v10000 = 322, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphGetEdges_v10000 = 323, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_v10010 = 324, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_ptsz_v10010 = 325, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecKernelNodeSetParams_v10010 = 326, + CUPTI_RUNTIME_TRACE_CBID_cudaThreadExchangeStreamCaptureMode_v10010 = 327, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetNvSciSyncAttributes_v10020 = 328, + CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyAvailableDynamicSMemPerBlock_v10200 = 329, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamSetFlags_v10200 = 330, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamSetFlags_ptsz_v10200 = 331, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecMemcpyNodeSetParams_v10020 = 332, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecMemsetNodeSetParams_v10020 = 333, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecHostNodeSetParams_v10020 = 334, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecUpdate_v10020 = 335, + CUPTI_RUNTIME_TRACE_CBID_cudaGetFuncBySymbol_v11000 = 336, + CUPTI_RUNTIME_TRACE_CBID_cudaCtxResetPersistingL2Cache_v11000 = 337, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphKernelNodeCopyAttributes_v11000 = 338, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphKernelNodeGetAttribute_v11000 = 339, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphKernelNodeSetAttribute_v11000 = 340, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamCopyAttributes_v11000 = 341, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamCopyAttributes_ptsz_v11000 = 342, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetAttribute_v11000 = 343, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetAttribute_ptsz_v11000 = 344, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamSetAttribute_v11000 = 345, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamSetAttribute_ptsz_v11000 = 346, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetTexture1DLinearMaxWidth_v11010 = 347, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphUpload_v10000 = 348, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphUpload_ptsz_v10000 = 349, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemcpyNodeToSymbol_v11010 = 350, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemcpyNodeFromSymbol_v11010 = 351, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemcpyNode1D_v11010 = 352, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemcpyNodeSetParamsToSymbol_v11010 = 353, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemcpyNodeSetParamsFromSymbol_v11010 = 354, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemcpyNodeSetParams1D_v11010 = 355, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecMemcpyNodeSetParamsToSymbol_v11010 = 356, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecMemcpyNodeSetParamsFromSymbol_v11010 = 357, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecMemcpyNodeSetParams1D_v11010 = 358, + CUPTI_RUNTIME_TRACE_CBID_cudaArrayGetSparseProperties_v11010 = 359, + CUPTI_RUNTIME_TRACE_CBID_cudaMipmappedArrayGetSparseProperties_v11010 = 360, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecChildGraphNodeSetParams_v11010 = 361, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddEventRecordNode_v11010 = 362, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphEventRecordNodeGetEvent_v11010 = 363, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphEventRecordNodeSetEvent_v11010 = 364, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddEventWaitNode_v11010 = 365, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphEventWaitNodeGetEvent_v11010 = 366, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphEventWaitNodeSetEvent_v11010 = 367, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecEventRecordNodeSetEvent_v11010 = 368, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecEventWaitNodeSetEvent_v11010 = 369, + CUPTI_RUNTIME_TRACE_CBID_cudaEventRecordWithFlags_v11010 = 370, + CUPTI_RUNTIME_TRACE_CBID_cudaEventRecordWithFlags_ptsz_v11010 = 371, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetDefaultMemPool_v11020 = 372, + CUPTI_RUNTIME_TRACE_CBID_cudaMallocAsync_v11020 = 373, + CUPTI_RUNTIME_TRACE_CBID_cudaMallocAsync_ptsz_v11020 = 374, + CUPTI_RUNTIME_TRACE_CBID_cudaFreeAsync_v11020 = 375, + CUPTI_RUNTIME_TRACE_CBID_cudaFreeAsync_ptsz_v11020 = 376, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolTrimTo_v11020 = 377, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolSetAttribute_v11020 = 378, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolGetAttribute_v11020 = 379, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolSetAccess_v11020 = 380, + CUPTI_RUNTIME_TRACE_CBID_cudaArrayGetPlane_v11020 = 381, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolGetAccess_v11020 = 382, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolCreate_v11020 = 383, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolDestroy_v11020 = 384, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSetMemPool_v11020 = 385, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetMemPool_v11020 = 386, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolExportToShareableHandle_v11020 = 387, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolImportFromShareableHandle_v11020 = 388, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolExportPointer_v11020 = 389, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolImportPointer_v11020 = 390, + CUPTI_RUNTIME_TRACE_CBID_cudaMallocFromPoolAsync_v11020 = 391, + CUPTI_RUNTIME_TRACE_CBID_cudaMallocFromPoolAsync_ptsz_v11020 = 392, + CUPTI_RUNTIME_TRACE_CBID_cudaSignalExternalSemaphoresAsync_v2_v11020 = 393, + CUPTI_RUNTIME_TRACE_CBID_cudaSignalExternalSemaphoresAsync_v2_ptsz_v11020 = 394, + CUPTI_RUNTIME_TRACE_CBID_cudaWaitExternalSemaphoresAsync_v2_v11020 = 395, + CUPTI_RUNTIME_TRACE_CBID_cudaWaitExternalSemaphoresAsync_v2_ptsz_v11020 = 396, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddExternalSemaphoresSignalNode_v11020 = 397, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExternalSemaphoresSignalNodeGetParams_v11020 = 398, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExternalSemaphoresSignalNodeSetParams_v11020 = 399, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddExternalSemaphoresWaitNode_v11020 = 400, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExternalSemaphoresWaitNodeGetParams_v11020 = 401, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExternalSemaphoresWaitNodeSetParams_v11020 = 402, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecExternalSemaphoresSignalNodeSetParams_v11020 = 403, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecExternalSemaphoresWaitNodeSetParams_v11020 = 404, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceFlushGPUDirectRDMAWrites_v11030 = 405, + CUPTI_RUNTIME_TRACE_CBID_cudaGetDriverEntryPoint_v11030 = 406, + CUPTI_RUNTIME_TRACE_CBID_cudaGetDriverEntryPoint_ptsz_v11030 = 407, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphDebugDotPrint_v11030 = 408, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_v2_v11030 = 409, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_v2_ptsz_v11030 = 410, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamUpdateCaptureDependencies_v11030 = 411, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamUpdateCaptureDependencies_ptsz_v11030 = 412, + CUPTI_RUNTIME_TRACE_CBID_cudaUserObjectCreate_v11030 = 413, + CUPTI_RUNTIME_TRACE_CBID_cudaUserObjectRetain_v11030 = 414, + CUPTI_RUNTIME_TRACE_CBID_cudaUserObjectRelease_v11030 = 415, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphRetainUserObject_v11030 = 416, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphReleaseUserObject_v11030 = 417, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphInstantiateWithFlags_v11040 = 418, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemAllocNode_v11040 = 419, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemAllocNodeGetParams_v11040 = 420, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemFreeNode_v11040 = 421, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemFreeNodeGetParams_v11040 = 422, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGraphMemTrim_v11040 = 423, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetGraphMemAttribute_v11040 = 424, + CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSetGraphMemAttribute_v11040 = 425, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeSetEnabled_v11060 = 426, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetEnabled_v11060 = 427, + CUPTI_RUNTIME_TRACE_CBID_cudaArrayGetMemoryRequirements_v11060 = 428, + CUPTI_RUNTIME_TRACE_CBID_cudaMipmappedArrayGetMemoryRequirements_v11060 = 429, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunchKernelExC_v11060 = 430, + CUPTI_RUNTIME_TRACE_CBID_cudaLaunchKernelExC_ptsz_v11060 = 431, + CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyMaxPotentialClusterSize_v11070 = 432, + CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyMaxActiveClusters_v11070 = 433, + CUPTI_RUNTIME_TRACE_CBID_cudaCreateTextureObject_v2_v11080 = 434, + CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureObjectTextureDesc_v2_v11080 = 435, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphInstantiateWithParams_v12000 = 436, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphInstantiateWithParams_ptsz_v12000 = 437, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecGetFlags_v12000 = 438, + CUPTI_RUNTIME_TRACE_CBID_cudaGetKernel_v12000 = 439, + CUPTI_RUNTIME_TRACE_CBID_cudaGetDeviceProperties_v2_v12000 = 440, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetId_v12000 = 441, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetId_ptsz_v12000 = 442, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphInstantiate_v12000 = 443, + CUPTI_RUNTIME_TRACE_CBID_cudaInitDevice_v12000 = 444, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddNode_v12020 = 445, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeSetParams_v12020 = 446, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecNodeSetParams_v12020 = 447, + CUPTI_RUNTIME_TRACE_CBID_cudaMemAdvise_v2_v12020 = 448, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPrefetchAsync_v2_v12020 = 449, + CUPTI_RUNTIME_TRACE_CBID_cudaMemPrefetchAsync_v2_ptsz_v12020 = 450, + CUPTI_RUNTIME_TRACE_CBID_cudaFuncGetName_v12030 = 451, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamBeginCaptureToGraph_v12030 = 452, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamBeginCaptureToGraph_ptsz_v12030 = 453, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphConditionalHandleCreate_v12030 = 454, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphGetEdges_v2_v12030 = 455, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetDependencies_v2_v12030 = 456, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetDependentNodes_v2_v12030 = 457, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddDependencies_v2_v12030 = 458, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphRemoveDependencies_v2_v12030 = 459, + CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddNode_v2_v12030 = 460, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_v3_v12030 = 461, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_v3_ptsz_v12030 = 462, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamUpdateCaptureDependencies_v2_v12030 = 463, + CUPTI_RUNTIME_TRACE_CBID_cudaStreamUpdateCaptureDependencies_v2_ptsz_v12030 = 464, + CUPTI_RUNTIME_TRACE_CBID_cuda465_v12040 = 465, + CUPTI_RUNTIME_TRACE_CBID_cuda466_v12040 = 466, + CUPTI_RUNTIME_TRACE_CBID_cudaFuncGetParamInfo_v12040 = 467, + CUPTI_RUNTIME_TRACE_CBID_SIZE = 468, + CUPTI_RUNTIME_TRACE_CBID_FORCE_INT = 0x7fffffff +} CUpti_runtime_api_trace_cbid; + diff --git a/cuda_toolkit/include/cupti_sass_metrics.h b/cuda_toolkit/include/cupti_sass_metrics.h new file mode 100644 index 0000000000000000000000000000000000000000..931014b16b46e3a57c0039722ae12f0bc9e3c348 --- /dev/null +++ b/cuda_toolkit/include/cupti_sass_metrics.h @@ -0,0 +1,436 @@ +/* + * Copyright 2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(_CUPTI_SASS_METRICS_H_) +#define _CUPTI_SASS_METRICS_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +/** + * \defgroup CUPTI_SASS_METRICS_API CUPTI SASS Metrics API + * Functions, types, and enums that implement the CUPTI SASS Metrics API. + * @{ + */ + +typedef enum +{ + /// SASS metric data will be collected at GPU level. + /// In CUpti_SassMetricsGetDataProperties_Params struct the numOfInstances will be equal to 1 + CUPTI_SASS_METRICS_OUTPUT_GRANULARITY_GPU = 0, + + /// SASS metric data will be collected at SM level + /// In CUpti_SassMetricsGetDataProperties_Params struct the numOfInstances will be equal to number of SMs in the GPU + CUPTI_SASS_METRICS_OUTPUT_GRANULARITY_SM = 1, + + /// SASS metric data will be collected at SM sub-partition level + /// In CUpti_SassMetricsGetDataProperties_Params struct the numOfInstances will be equal to number of SM sub-partitions in the GPU + CUPTI_SASS_METRICS_OUTPUT_GRANULARITY_SMSP = 2, + + CUPTI_SASS_METRICS_OUTPUT_GRANULARITY_INVALID +} CUpti_SassMetrics_OutputGranularity; + +typedef struct CUpti_SassMetrics_MetricDetails +{ + /// unique ID for the SASS metric + uint64_t metricId; + /// metric name + const char* pMetricName; + /// metric description + const char* pMetricDescription; +} CUpti_SassMetrics_MetricDetails; + +/** + * \brief Params for cuptiSassMetricsGetNumOfMetrics + */ +typedef struct CUpti_SassMetrics_GetNumOfMetrics_Params +{ + /// [in] should be equal to CUpti_SassMetrics_GetNumOfMetrics_Params_STRUCT_SIZE + size_t structSize; + /// [in] assign to NULL + void* pPriv; + /// [in] chip name for which metrics will be queried + const char* pChipName; + /// [out] number of metrics supported for the queried chip + size_t numOfMetrics; +} CUpti_SassMetrics_GetNumOfMetrics_Params; + +#define CUpti_SassMetrics_GetNumOfMetrics_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_SassMetrics_GetNumOfMetrics_Params, numOfMetrics) + +/** + * \brief Get the number of supported SASS metrics for the chip. + * + * \param pParams A pointer to \ref CUpti_SassMetrics_GetNumOfMetrics_Params + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device doesn't support SASS metric collection + */ +CUptiResult CUPTIAPI cuptiSassMetricsGetNumOfMetrics(CUpti_SassMetrics_GetNumOfMetrics_Params* pParams); + +/** + * \brief Params for cuptiSassMetricsGetMetrics + */ +typedef struct CUpti_SassMetrics_GetMetrics_Params +{ + /// [in] should be equal to CUpti_SassMetrics_GetMetrics_Params_STRUCT_SIZE + size_t structSize; + /// [in] assign to NULL + void* pPriv; + /// [in] chip name for which metrics will be queried + const char* pChipName; + /// [in] number of metrics supported for the queried chip (can be queried using cuptiSassMetricsGetNumOfMetrics()) + size_t numOfMetrics; + /// [out] list of metrics supported for queried chip + CUpti_SassMetrics_MetricDetails* pMetricsList; +} CUpti_SassMetrics_GetMetrics_Params; +#define CUpti_SassMetrics_GetMetrics_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_SassMetrics_GetMetrics_Params, pMetricsList) + +/** + * \brief Get the list of all supported SASS metrics for the chip. + * + * \param pParams A pointer to \ref CUpti_SassMetrics_GetMetrics_Params + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device doesn't support SASS metric collection + */ +CUptiResult CUPTIAPI cuptiSassMetricsGetMetrics(CUpti_SassMetrics_GetMetrics_Params* pParams); + +/** + * \brief Params for cuptiSassMetricsGetProperties + */ +typedef struct CUpti_SassMetrics_GetProperties_Params +{ + /// [in] should be equal to CUpti_SassMetrics_GetProperties_Params_STRUCT_SIZE + size_t structSize; + /// [in] assign to NULL + void* pPriv; + /// [in] chip name for which metric will be queried + const char* pChipName; + /// [in] metric name + const char* pMetricName; + /// [out] returns the metric ID and the metric description + CUpti_SassMetrics_MetricDetails metric; +} CUpti_SassMetrics_GetProperties_Params; +#define CUpti_SassMetrics_GetProperties_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_SassMetrics_GetProperties_Params, metric) + +/** + * \brief Get metric properties for the queried metric. + * For a given metric the results will be put in CUpti_SassMetrics_MetricDetails which + * stores metric ID, description of the metric. + * + * \param pParams A pointer to \ref CUpti_SassMetrics_GetProperties_Params + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device doesn't support SASS metric data collection + */ +CUptiResult CUPTIAPI cuptiSassMetricsGetProperties(CUpti_SassMetrics_GetProperties_Params *pParams); + +typedef struct CUpti_SassMetrics_Config +{ + /// [in] unique id for the SASS metric, can be queried using cuptiSassMetricsGetProperties() + uint64_t metricId; + /// [in] CUpti_SassMetrics_OutputGranularity + uint8_t outputGranularity; +} CUpti_SassMetrics_Config; + +/** + * \brief Params for cuptiSassMetricsSetConfig + */ +typedef struct CUpti_SassMetricsSetConfig_Params +{ + /// [in] equal to CUpti_SassMetricsSetConfig_Params_STRUCT_SIZE + size_t structSize; + /// [in] assign to NULL + void* pPriv; + /// [in] num of metric configs, will be equal to number of metrics queried + size_t numOfMetricConfig; + /// [in] list of metric config generated for given sass metrics + CUpti_SassMetrics_Config* pConfigs; + /// [in] device index for which config will be set, user can call this once for + /// the device on which the the SASS metric data will be collected + uint32_t deviceIndex; +} CUpti_SassMetricsSetConfig_Params; +#define CUpti_SassMetricsSetConfig_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_SassMetricsSetConfig_Params, deviceIndex) + +/** + * \brief Set config for the SASS metric data collection for a device. + * User need to call this API before calling any of the SASS metric data collection APIs. + * Each set config API call need to be followed by cuptiSassPatchingUnSetConfig API + * before calling the cuptiSassMetricsSetConfig() API again for the same device. + * + * \param pParams A pointer to \ref CUpti_SassMetricsSetConfig_Params + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_INVALID_CONTEXT if any cuda context has not been created prior to this API call + * \retval CUPTI_ERROR_INVALID_OPERATION if this is called multiple times for the device without calling unset config API + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device doesn't support SASS metric data collection + */ +CUptiResult CUPTIAPI cuptiSassMetricsSetConfig(CUpti_SassMetricsSetConfig_Params *pParams); + +/** + * \brief Params for cuptiSassMetricsUnsetConfig + */ +typedef struct CUpti_SassMetricsUnsetConfig_Params +{ + /// [in] equal to CUpti_SassMetricsUnsetConfig_Params_STRUCT_SIZE + size_t structSize; + /// [in] assign to NULL + void* pPriv; + /// [in] device index for which SASS metric data collection config will get reset, user need to call this API for + /// all the devices on which the the SASS metric data collection have been configured. + uint32_t deviceIndex; +} CUpti_SassMetricsUnsetConfig_Params; +#define CUpti_SassMetricsUnsetConfig_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_SassMetricsUnsetConfig_Params, deviceIndex) + +/** + * \brief Unset config API will reset the SASS metric data collection configuration for the device. + * Once this API called CUPTI will deallocate all the memory allocated and remove all + * the configuration for SASS metric data collection. User can only call this API for a device where + * cuptiSassMetricsSetConfig() API has been called earlier for the device. + * + * \param pParams A pointer to \ref CUpti_SassMetricsSetConfig_Params + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_INVALID_CONTEXT if any cuda context has not been created prior to this API call + * \retval CUPTI_ERROR_INVALID_OPERATION if this is called multiple times for the device without calling set config API + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device doesn't support SASS metric data collection + */ +CUptiResult CUPTIAPI cuptiSassMetricsUnsetConfig(CUpti_SassMetricsUnsetConfig_Params *pParams); + +/** + * \brief Params for cuptiSassMetricsEnable + */ +typedef struct CUpti_SassMetricsEnable_Params +{ + /// [in] equal to CUpti_SassMetricsEnable_Params_STRUCT_SIZE + size_t structSize; + /// [in] assign to NULL + void* pPriv; + /// [in] CUDA context on which SASS metric data collection will be enabled. + /// If set NULL, default context will be consider for SASS metric data collection. + CUcontext ctx; + /// [in] if false, all the functions will patched regardless of their execution with cuptiSassMetricsEnable() API call. + /// when this parameter is set to true, metric data collection for the function will be done at the very first execution in the enable/disble + /// range. + uint8_t enableLazyPatching; +} CUpti_SassMetricsEnable_Params; +#define CUpti_SassMetricsEnable_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_SassMetricsEnable_Params, enableLazyPatching) + +/** + * \brief Sass metric data collection enable API will mark the start of a range, between which kernel + * will be profiled for SASS metrics. + * + * \param pParams A pointer to \ref CUpti_SassMetricsEnable_Params + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device doesn't support SASS metric data collection + * \retval CUPTI_ERROR_INVALID_CONTEXT if any cuda context has not been created prior to this API call + * \retval CUPTI_ERROR_INVALID_OPERATION if this API is called multiple times for a cuda context without calling + * cuptiSassMetricsDisable() API or called before cuptiSassMetricsSetConfig() API call. + */ +CUptiResult CUPTIAPI cuptiSassMetricsEnable(CUpti_SassMetricsEnable_Params* pParams); + +/** + * \brief Params for cuptiSassMetricsDisable + */ +typedef struct CUpti_SassMetricsDisable_Params +{ + /// [in] equal to CUpti_SassMetricsDisable_Params_STRUCT_SIZE + size_t structSize; + /// [in] assign to NULL + void* pPriv; + /// [in] CUDA context on which SASS metric data collection will be disabled. + /// If set NULL, default context will be consider for SASS metric data collection. + CUcontext ctx; + /// [out] Num of dropped SASS records will be equal to numOfPatchedInstructions * numOfInstances. + /// Number of dropped records will be zero when data is flushed prior to calling the disable API. + size_t numOfDroppedRecords; +} CUpti_SassMetricsDisable_Params; +#define CUpti_SassMetricsDisable_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_SassMetricsDisable_Params, numOfDroppedRecords) + +/** + * \brief SASS metric data collection disable API will mark the end of a range, any kernel launched after this + * API call will not be profiled for the SASS metrics. + * + * \param pParams A pointer to \ref CUpti_SassMetricsDisable_Params + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device doesn't support SASS metric data collection + * \retval CUPTI_ERROR_INVALID_CONTEXT if any cuda context has not been created prior to this API call + * \retval CUPTI_ERROR_INVALID_OPERATION if this API is called multiple times for a cuda context without calling + * cuptiSassMetricsEnable() API or called before cuptiSassMetricsSetConfig() API call. + */ +CUptiResult CUPTIAPI cuptiSassMetricsDisable(CUpti_SassMetricsDisable_Params* pParams); + +/** + * \brief Params for cuptiSassMetricsGetDataProperties + */ +typedef struct CUpti_SassMetricsGetDataProperties_Params +{ + /// [in] equal to CUpti_SassMetricsGetDataProperties_Params_STRUCT_SIZE + size_t structSize; + /// [in] assign to NULL + void* pPriv; + /// [in] CUDA context on which SASS metric data collection was enabled. + /// If set NULL, default context will be consider for SASS metric data collection. + CUcontext ctx; + /// [out] total number of SASS records has been collected + size_t numOfPatchedInstructionRecords; + /// [out] number of instances for each metric value per instruction. + /// This will depend on CUpti_SassPatching_OutputGranularity level set for the metric config. + size_t numOfInstances; +} CUpti_SassMetricsGetDataProperties_Params; + +#define CUpti_SassMetricsGetDataProperties_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_SassMetricsGetDataProperties_Params, numOfInstances) +/** + * \brief SASS metric data properties API will give the data regarding number of instances of a metric + * value and number of SASS instruction data has been collected. The number of instances of a metric + * will vary as per user set the output granularity level with CUpti_SassMetrics_OutputGranularity value. + * User need to allocate memory for retriving the SASS data using cuptiSassMetricsFlushData() API. + * + * \param pParams A pointer to \ref CUpti_SassMetricsGetDataProperties_Params + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device doesn't support SASS metric data collection + * \retval CUPTI_ERROR_INVALID_OPERATION if this API is called outside the enable/disable range. + */ +CUptiResult CUPTIAPI cuptiSassMetricsGetDataProperties(CUpti_SassMetricsGetDataProperties_Params* pParams); + +typedef struct CUpti_SassMetrics_InstanceValue +{ + // unique id of the metric + uint64_t metricId; + // metric value + uint64_t value; +} CUpti_SassMetrics_InstanceValue; +#define CUpti_SassMetrics_InstanceValue_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_SassMetrics_InstanceValue, value) + +typedef struct CUpti_SassMetrics_Data +{ + /// [in] equal to CUpti_SassMetricsFlushData_Params_STRUCT_SIZE + size_t structSize; + /// [in] assign to NULL + void* pPriv; + /// [out] Unique cubin id + uint32_t cubinCrc; + /// [out] function's unique symbol index in the module. + uint32_t functionIndex; + /// [out] The function name + const char* functionName; + /// [out] pc offset for the function in a module + uint32_t pcOffset; + /// [out] array of size equal to number of instances per metric, which contains the metric ID and metric value. + CUpti_SassMetrics_InstanceValue* pInstanceValues; +} CUpti_SassMetrics_Data; + +/** + * \brief Params for cuptiSassMetricsFlushData + */ +typedef struct CUpti_SassMetricsFlushData_Params +{ + /// [in] equal to CUpti_SassMetricsFlushData_Params_STRUCT_SIZE + size_t structSize; + /// [in] assign to NULL + void* pPriv; + /// [in] CUDA context on which SASS metric data collection was enabled. + /// If set NULL, default context will be consider for SASS metric data collection. + CUcontext ctx; + /// [in] number of patched instruction record will be retrived, user can call cuptiSassMetricsGetDataProperties() + /// for getting total number of records available. + size_t numOfPatchedInstructionRecords; + /// [in] number of patched instruction record instances for a metric, user can call cuptiSassMetricsGetDataProperties() + /// for getting total number of instances for each record per metric available. + size_t numOfInstances; + /// [out] + CUpti_SassMetrics_Data* pMetricsData; +} CUpti_SassMetricsFlushData_Params; +#define CUpti_SassMetricsFlushData_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_SassMetricsFlushData_Params, numOfInstances) + +/** + * \brief Flush SASS metrics data from CUPTI internal buffer to the user buffer. + * User needs to allocate the buffer for retrieving the data. The number of records collected + * can be queried using the API cuptiSassMetricsGetDataProperties(). + * + * \param pParams A pointer to \ref CUpti_SassMetricsFlushData_Params + * + * \retval CUPTI_SUCCESS + * \retval CUPTI_ERROR_INVALID_PARAMETER if any \p pParams is not valid + * \retval CUPTI_ERROR_NOT_SUPPORTED indicates that the system/device doesn't support SASS metric data collection. + * \retval CUPTI_ERROR_INVALID_OPERATION if this API is called outside the enable/disable range. + */ +CUptiResult CUPTIAPI cuptiSassMetricsFlushData(CUpti_SassMetricsFlushData_Params* pParams); + +/** @} */ /* END CUPTI_SASS_METRICS_API */ + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // _CUPTI_SASS_METRICS_H_ \ No newline at end of file diff --git a/cuda_toolkit/include/cupti_target.h b/cuda_toolkit/include/cupti_target.h new file mode 100644 index 0000000000000000000000000000000000000000..9193a8fed010b6db1bb3049d85a73cbaad7139a9 --- /dev/null +++ b/cuda_toolkit/include/cupti_target.h @@ -0,0 +1,43 @@ +#if !defined(_CUPTI_TARGET_H_) +#define _CUPTI_TARGET_H_ + +/* +CUPTI profiler target API's +This file contains the CUPTI profiling API's. +*/ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +#ifndef CUPTI_PROFILER_STRUCT_SIZE +#define CUPTI_PROFILER_STRUCT_SIZE(type_, lastfield_) (offsetof(type_, lastfield_) + sizeof(((type_*)0)->lastfield_)) +#endif + +typedef struct CUpti_Device_GetChipName_Params +{ + size_t structSize; //!< [in] + void* pPriv; //!< [in] assign to NULL + + size_t deviceIndex; //!< [in] + const char* pChipName; //!< [out] +} CUpti_Device_GetChipName_Params; + +#define CUpti_Device_GetChipName_Params_STRUCT_SIZE CUPTI_PROFILER_STRUCT_SIZE(CUpti_Device_GetChipName_Params, pChipName) +CUptiResult CUPTIAPI cuptiDeviceGetChipName(CUpti_Device_GetChipName_Params *pParams); + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif +#endif diff --git a/cuda_toolkit/include/cupti_version.h b/cuda_toolkit/include/cupti_version.h new file mode 100644 index 0000000000000000000000000000000000000000..fd9833825f1eb96082cf99b0a3dd21561a073e4b --- /dev/null +++ b/cuda_toolkit/include/cupti_version.h @@ -0,0 +1,134 @@ +/* + * Copyright 2010-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(_CUPTI_VERSION_H_) +#define _CUPTI_VERSION_H_ + +#include +#include + +#ifndef CUPTIAPI +#ifdef _WIN32 +#define CUPTIAPI __stdcall +#else +#define CUPTIAPI +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +/** + * \defgroup CUPTI_VERSION_API CUPTI Version + * Function and macro to determine the CUPTI version. + * @{ + */ + +/** + * \brief The API version for this implementation of CUPTI. + * + * The API version for this implementation of CUPTI. This define along + * with \ref cuptiGetVersion can be used to dynamically detect if the + * version of CUPTI compiled against matches the version of the loaded + * CUPTI library. + * + * v1 : CUDAToolsSDK 4.0 + * v2 : CUDAToolsSDK 4.1 + * v3 : CUDA Toolkit 5.0 + * v4 : CUDA Toolkit 5.5 + * v5 : CUDA Toolkit 6.0 + * v6 : CUDA Toolkit 6.5 + * v7 : CUDA Toolkit 6.5(with sm_52 support) + * v8 : CUDA Toolkit 7.0 + * v9 : CUDA Toolkit 8.0 + * v10 : CUDA Toolkit 9.0 + * v11 : CUDA Toolkit 9.1 + * v12 : CUDA Toolkit 10.0, 10.1 and 10.2 + * v13 : CUDA Toolkit 11.0 + * v14 : CUDA Toolkit 11.1 + * v15 : CUDA Toolkit 11.2, 11.3 and 11.4 + * v16 : CUDA Toolkit 11.5 + * v17 : CUDA Toolkit 11.6 + * v18 : CUDA Toolkit 11.8 + * v19 : CUDA Toolkit 12.0 + * v20 : CUDA Toolkit 12.2 + * v21 : CUDA Toolkit 12.3 + * v22 : CUDA Toolkit 12.4 + */ +#define CUPTI_API_VERSION 22 + +/** + * \brief Get the CUPTI API version. + * + * Return the API version in \p *version. + * + * \param version Returns the version + * + * \retval CUPTI_SUCCESS on success + * \retval CUPTI_ERROR_INVALID_PARAMETER if \p version is NULL + * \sa CUPTI_API_VERSION + */ +CUptiResult CUPTIAPI cuptiGetVersion(uint32_t *version); + +/** @} */ /* END CUPTI_VERSION_API */ + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /*_CUPTI_VERSION_H_*/ diff --git a/cuda_toolkit/include/curand.h b/cuda_toolkit/include/curand.h new file mode 100644 index 0000000000000000000000000000000000000000..bfa060bd389d74e0e1d606c0b451a9ed8837fc91 --- /dev/null +++ b/cuda_toolkit/include/curand.h @@ -0,0 +1,1077 @@ + + /* Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(CURAND_H_) +#define CURAND_H_ + +/** + * \defgroup HOST Host API + * + * @{ + */ +#ifndef __CUDACC_RTC__ +#include +#endif + +#ifndef CURANDAPI +#ifdef _WIN32 +#define CURANDAPI __stdcall +#else +#define CURANDAPI +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +#define CURAND_VER_MAJOR 10 +#define CURAND_VER_MINOR 3 +#define CURAND_VER_PATCH 5 +#define CURAND_VER_BUILD 147 +#define CURAND_VERSION (CURAND_VER_MAJOR * 1000 + \ + CURAND_VER_MINOR * 100 + \ + CURAND_VER_PATCH) +/* CURAND Host API datatypes */ + +/** + * @{ + */ + +/** + * CURAND function call status types + */ +enum curandStatus { + CURAND_STATUS_SUCCESS = 0, ///< No errors + CURAND_STATUS_VERSION_MISMATCH = 100, ///< Header file and linked library version do not match + CURAND_STATUS_NOT_INITIALIZED = 101, ///< Generator not initialized + CURAND_STATUS_ALLOCATION_FAILED = 102, ///< Memory allocation failed + CURAND_STATUS_TYPE_ERROR = 103, ///< Generator is wrong type + CURAND_STATUS_OUT_OF_RANGE = 104, ///< Argument out of range + CURAND_STATUS_LENGTH_NOT_MULTIPLE = 105, ///< Length requested is not a multple of dimension + CURAND_STATUS_DOUBLE_PRECISION_REQUIRED = 106, ///< GPU does not have double precision required by MRG32k3a + CURAND_STATUS_LAUNCH_FAILURE = 201, ///< Kernel launch failure + CURAND_STATUS_PREEXISTING_FAILURE = 202, ///< Preexisting failure on library entry + CURAND_STATUS_INITIALIZATION_FAILED = 203, ///< Initialization of CUDA failed + CURAND_STATUS_ARCH_MISMATCH = 204, ///< Architecture mismatch, GPU does not support requested feature + CURAND_STATUS_INTERNAL_ERROR = 999 ///< Internal library error +}; + +/* + * CURAND function call status types +*/ +/** \cond UNHIDE_TYPEDEFS */ +typedef enum curandStatus curandStatus_t; +/** \endcond */ + +/** + * CURAND generator types + */ +enum curandRngType { + CURAND_RNG_TEST = 0, + CURAND_RNG_PSEUDO_DEFAULT = 100, ///< Default pseudorandom generator + CURAND_RNG_PSEUDO_XORWOW = 101, ///< XORWOW pseudorandom generator + CURAND_RNG_PSEUDO_MRG32K3A = 121, ///< MRG32k3a pseudorandom generator + CURAND_RNG_PSEUDO_MTGP32 = 141, ///< Mersenne Twister MTGP32 pseudorandom generator + CURAND_RNG_PSEUDO_MT19937 = 142, ///< Mersenne Twister MT19937 pseudorandom generator + CURAND_RNG_PSEUDO_PHILOX4_32_10 = 161, ///< PHILOX-4x32-10 pseudorandom generator + CURAND_RNG_QUASI_DEFAULT = 200, ///< Default quasirandom generator + CURAND_RNG_QUASI_SOBOL32 = 201, ///< Sobol32 quasirandom generator + CURAND_RNG_QUASI_SCRAMBLED_SOBOL32 = 202, ///< Scrambled Sobol32 quasirandom generator + CURAND_RNG_QUASI_SOBOL64 = 203, ///< Sobol64 quasirandom generator + CURAND_RNG_QUASI_SCRAMBLED_SOBOL64 = 204 ///< Scrambled Sobol64 quasirandom generator +}; + +/* + * CURAND generator types + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef enum curandRngType curandRngType_t; +/** \endcond */ + +/** + * CURAND ordering of results in memory + */ +enum curandOrdering { + CURAND_ORDERING_PSEUDO_BEST = 100, ///< Best ordering for pseudorandom results + CURAND_ORDERING_PSEUDO_DEFAULT = 101, ///< Specific default thread sequence for pseudorandom results, same as CURAND_ORDERING_PSEUDO_BEST + CURAND_ORDERING_PSEUDO_SEEDED = 102, ///< Specific seeding pattern for fast lower quality pseudorandom results + CURAND_ORDERING_PSEUDO_LEGACY = 103, ///< Specific legacy sequence for pseudorandom results, guaranteed to remain the same for all cuRAND release + CURAND_ORDERING_PSEUDO_DYNAMIC = 104, ///< Specific ordering adjusted to the device it is being executed on, provides the best performance + CURAND_ORDERING_QUASI_DEFAULT = 201 ///< Specific n-dimensional ordering for quasirandom results +}; + +/* + * CURAND ordering of results in memory + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef enum curandOrdering curandOrdering_t; +/** \endcond */ + +/** + * CURAND choice of direction vector set + */ +enum curandDirectionVectorSet { + CURAND_DIRECTION_VECTORS_32_JOEKUO6 = 101, ///< Specific set of 32-bit direction vectors generated from polynomials recommended by S. Joe and F. Y. Kuo, for up to 20,000 dimensions + CURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6 = 102, ///< Specific set of 32-bit direction vectors generated from polynomials recommended by S. Joe and F. Y. Kuo, for up to 20,000 dimensions, and scrambled + CURAND_DIRECTION_VECTORS_64_JOEKUO6 = 103, ///< Specific set of 64-bit direction vectors generated from polynomials recommended by S. Joe and F. Y. Kuo, for up to 20,000 dimensions + CURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6 = 104 ///< Specific set of 64-bit direction vectors generated from polynomials recommended by S. Joe and F. Y. Kuo, for up to 20,000 dimensions, and scrambled +}; + +/* + * CURAND choice of direction vector set + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef enum curandDirectionVectorSet curandDirectionVectorSet_t; +/** \endcond */ + +/** + * CURAND array of 32-bit direction vectors + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef unsigned int curandDirectionVectors32_t[32]; +/** \endcond */ + + /** + * CURAND array of 64-bit direction vectors + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef unsigned long long curandDirectionVectors64_t[64]; +/** \endcond **/ + +/** + * CURAND generator (opaque) + */ +struct curandGenerator_st; + +/** + * CURAND generator + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandGenerator_st *curandGenerator_t; +/** \endcond */ + +/** + * CURAND distribution + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef double curandDistribution_st; +typedef curandDistribution_st *curandDistribution_t; +typedef struct curandDistributionShift_st *curandDistributionShift_t; +/** \endcond */ +/** + * CURAND distribution M2 + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandDistributionM2Shift_st *curandDistributionM2Shift_t; +typedef struct curandHistogramM2_st *curandHistogramM2_t; +typedef unsigned int curandHistogramM2K_st; +typedef curandHistogramM2K_st *curandHistogramM2K_t; +typedef curandDistribution_st curandHistogramM2V_st; +typedef curandHistogramM2V_st *curandHistogramM2V_t; + +typedef struct curandDiscreteDistribution_st *curandDiscreteDistribution_t; +/** \endcond */ + +/* + * CURAND METHOD + */ +/** \cond UNHIDE_ENUMS */ +enum curandMethod { + CURAND_CHOOSE_BEST = 0, // choose best depends on args + CURAND_ITR = 1, + CURAND_KNUTH = 2, + CURAND_HITR = 3, + CURAND_M1 = 4, + CURAND_M2 = 5, + CURAND_BINARY_SEARCH = 6, + CURAND_DISCRETE_GAUSS = 7, + CURAND_REJECTION = 8, + CURAND_DEVICE_API = 9, + CURAND_FAST_REJECTION = 10, + CURAND_3RD = 11, + CURAND_DEFINITION = 12, + CURAND_POISSON = 13 +}; + +typedef enum curandMethod curandMethod_t; +/** \endcond */ + + +#ifndef __CUDACC_RTC__ + +/** + * @} + */ + +/** + * \brief Create new random number generator. + * + * Creates a new random number generator of type \p rng_type + * and returns it in \p *generator. + * + * Legal values for \p rng_type are: + * - CURAND_RNG_PSEUDO_DEFAULT + * - CURAND_RNG_PSEUDO_XORWOW + * - CURAND_RNG_PSEUDO_MRG32K3A + * - CURAND_RNG_PSEUDO_MTGP32 + * - CURAND_RNG_PSEUDO_MT19937 + * - CURAND_RNG_PSEUDO_PHILOX4_32_10 + * - CURAND_RNG_QUASI_DEFAULT + * - CURAND_RNG_QUASI_SOBOL32 + * - CURAND_RNG_QUASI_SCRAMBLED_SOBOL32 + * - CURAND_RNG_QUASI_SOBOL64 + * - CURAND_RNG_QUASI_SCRAMBLED_SOBOL64 + * + * When \p rng_type is CURAND_RNG_PSEUDO_DEFAULT, the type chosen + * is CURAND_RNG_PSEUDO_XORWOW. \n + * When \p rng_type is CURAND_RNG_QUASI_DEFAULT, + * the type chosen is CURAND_RNG_QUASI_SOBOL32. + * + * The default values for \p rng_type = CURAND_RNG_PSEUDO_XORWOW are: + * - \p seed = 0 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_PSEUDO_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_PSEUDO_MRG32K3A are: + * - \p seed = 0 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_PSEUDO_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_PSEUDO_MTGP32 are: + * - \p seed = 0 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_PSEUDO_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_PSEUDO_MT19937 are: + * - \p seed = 0 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_PSEUDO_DEFAULT + * + * * The default values for \p rng_type = CURAND_RNG_PSEUDO_PHILOX4_32_10 are: + * - \p seed = 0 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_PSEUDO_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_QUASI_SOBOL32 are: + * - \p dimensions = 1 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_QUASI_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_QUASI_SOBOL64 are: + * - \p dimensions = 1 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_QUASI_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_QUASI_SCRAMBBLED_SOBOL32 are: + * - \p dimensions = 1 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_QUASI_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_QUASI_SCRAMBLED_SOBOL64 are: + * - \p dimensions = 1 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_QUASI_DEFAULT + * + * \param generator - Pointer to generator + * \param rng_type - Type of generator to create + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED, if memory could not be allocated \n + * - CURAND_STATUS_INITIALIZATION_FAILED if there was a problem setting up the GPU \n + * - CURAND_STATUS_VERSION_MISMATCH if the header file version does not match the + * dynamically linked library version \n + * - CURAND_STATUS_TYPE_ERROR if the value for \p rng_type is invalid \n + * - CURAND_STATUS_SUCCESS if generator was created successfully \n + * + */ +curandStatus_t CURANDAPI +curandCreateGenerator(curandGenerator_t *generator, curandRngType_t rng_type); + +/** + * \brief Create new host CPU random number generator. + * + * Creates a new host CPU random number generator of type \p rng_type + * and returns it in \p *generator. + * + * Legal values for \p rng_type are: + * - CURAND_RNG_PSEUDO_DEFAULT + * - CURAND_RNG_PSEUDO_XORWOW + * - CURAND_RNG_PSEUDO_MRG32K3A + * - CURAND_RNG_PSEUDO_MTGP32 + * - CURAND_RNG_PSEUDO_MT19937 + * - CURAND_RNG_PSEUDO_PHILOX4_32_10 + * - CURAND_RNG_QUASI_DEFAULT + * - CURAND_RNG_QUASI_SOBOL32 + * + * When \p rng_type is CURAND_RNG_PSEUDO_DEFAULT, the type chosen + * is CURAND_RNG_PSEUDO_XORWOW. \n + * When \p rng_type is CURAND_RNG_QUASI_DEFAULT, + * the type chosen is CURAND_RNG_QUASI_SOBOL32. + * + * The default values for \p rng_type = CURAND_RNG_PSEUDO_XORWOW are: + * - \p seed = 0 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_PSEUDO_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_PSEUDO_MRG32K3A are: + * - \p seed = 0 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_PSEUDO_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_PSEUDO_MTGP32 are: + * - \p seed = 0 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_PSEUDO_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_PSEUDO_MT19937 are: + * - \p seed = 0 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_PSEUDO_DEFAULT + * + * * The default values for \p rng_type = CURAND_RNG_PSEUDO_PHILOX4_32_10 are: + * - \p seed = 0 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_PSEUDO_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_QUASI_SOBOL32 are: + * - \p dimensions = 1 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_QUASI_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_QUASI_SOBOL64 are: + * - \p dimensions = 1 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_QUASI_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_QUASI_SCRAMBLED_SOBOL32 are: + * - \p dimensions = 1 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_QUASI_DEFAULT + * + * The default values for \p rng_type = CURAND_RNG_QUASI_SCRAMBLED_SOBOL64 are: + * - \p dimensions = 1 + * - \p offset = 0 + * - \p ordering = CURAND_ORDERING_QUASI_DEFAULT + * + * \param generator - Pointer to generator + * \param rng_type - Type of generator to create + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_INITIALIZATION_FAILED if there was a problem setting up the GPU \n + * - CURAND_STATUS_VERSION_MISMATCH if the header file version does not match the + * dynamically linked library version \n + * - CURAND_STATUS_TYPE_ERROR if the value for \p rng_type is invalid \n + * - CURAND_STATUS_SUCCESS if generator was created successfully \n + */ +curandStatus_t CURANDAPI +curandCreateGeneratorHost(curandGenerator_t *generator, curandRngType_t rng_type); + +/** + * \brief Destroy an existing generator. + * + * Destroy an existing generator and free all memory associated with its state. + * + * \param generator - Generator to destroy + * + * \return + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_SUCCESS if generator was destroyed successfully \n + */ +curandStatus_t CURANDAPI +curandDestroyGenerator(curandGenerator_t generator); + +/** + * \brief Return the version number of the library. + * + * Return in \p *version the version number of the dynamically linked CURAND + * library. The format is the same as CUDART_VERSION from the CUDA Runtime. + * The only supported configuration is CURAND version equal to CUDA Runtime + * version. + * + * \param version - CURAND library version + * + * \return + * - CURAND_STATUS_SUCCESS if the version number was successfully returned \n + */ +curandStatus_t CURANDAPI +curandGetVersion(int *version); + +/** +* \brief Return the value of the curand property. +* +* Return in \p *value the number for the property described by \p type of the +* dynamically linked CURAND library. +* +* \param type - CUDA library property +* \param value - integer value for the requested property +* +* \return +* - CURAND_STATUS_SUCCESS if the property value was successfully returned \n +* - CURAND_STATUS_OUT_OF_RANGE if the property type is not recognized \n +*/ +curandStatus_t CURANDAPI +curandGetProperty(libraryPropertyType type, int *value); + + +/** + * \brief Set the current stream for CURAND kernel launches. + * + * Set the current stream for CURAND kernel launches. All library functions + * will use this stream until set again. + * + * \param generator - Generator to modify + * \param stream - Stream to use or ::NULL for null stream + * + * \return + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_SUCCESS if stream was set successfully \n + */ +curandStatus_t CURANDAPI +curandSetStream(curandGenerator_t generator, cudaStream_t stream); + +/** + * \brief Set the seed value of the pseudo-random number generator. + * + * Set the seed value of the pseudorandom number generator. + * All values of seed are valid. Different seeds will produce different sequences. + * Different seeds will often not be statistically correlated with each other, + * but some pairs of seed values may generate sequences which are statistically correlated. + * + * \param generator - Generator to modify + * \param seed - Seed value + * + * \return + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_TYPE_ERROR if the generator is not a pseudorandom number generator \n + * - CURAND_STATUS_SUCCESS if generator seed was set successfully \n + */ +curandStatus_t CURANDAPI +curandSetPseudoRandomGeneratorSeed(curandGenerator_t generator, unsigned long long seed); + +/** + * \brief Set the absolute offset of the pseudo or quasirandom number generator. + * + * Set the absolute offset of the pseudo or quasirandom number generator. + * + * All values of offset are valid. The offset position is absolute, not + * relative to the current position in the sequence. + * + * \param generator - Generator to modify + * \param offset - Absolute offset position + * + * \return + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_SUCCESS if generator offset was set successfully \n + */ +curandStatus_t CURANDAPI +curandSetGeneratorOffset(curandGenerator_t generator, unsigned long long offset); + +/** + * \brief Set the ordering of results of the pseudo or quasirandom number generator. + * + * Set the ordering of results of the pseudo or quasirandom number generator. + * + * Legal values of \p order for pseudorandom generators are: + * - CURAND_ORDERING_PSEUDO_DEFAULT + * - CURAND_ORDERING_PSEUDO_BEST + * - CURAND_ORDERING_PSEUDO_SEEDED + * - CURAND_ORDERING_PSEUDO_LEGACY + * + * Legal values of \p order for quasirandom generators are: + * - CURAND_ORDERING_QUASI_DEFAULT + * + * \param generator - Generator to modify + * \param order - Ordering of results + * + * \return + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_OUT_OF_RANGE if the ordering is not valid \n + * - CURAND_STATUS_SUCCESS if generator ordering was set successfully \n + */ +curandStatus_t CURANDAPI +curandSetGeneratorOrdering(curandGenerator_t generator, curandOrdering_t order); + +/** + * \brief Set the number of dimensions. + * + * Set the number of dimensions to be generated by the quasirandom number + * generator. + * + * Legal values for \p num_dimensions are 1 to 20000. + * + * \param generator - Generator to modify + * \param num_dimensions - Number of dimensions + * + * \return + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_OUT_OF_RANGE if num_dimensions is not valid \n + * - CURAND_STATUS_TYPE_ERROR if the generator is not a quasirandom number generator \n + * - CURAND_STATUS_SUCCESS if generator ordering was set successfully \n + */ +curandStatus_t CURANDAPI +curandSetQuasiRandomGeneratorDimensions(curandGenerator_t generator, unsigned int num_dimensions); + +/** + * \brief Generate 32-bit pseudo or quasirandom numbers. + * + * Use \p generator to generate \p num 32-bit results into the device memory at + * \p outputPtr. The device memory must have been previously allocated and be + * large enough to hold all the results. Launches are done with the stream + * set using ::curandSetStream(), or the null stream if no stream has been set. + * + * Results are 32-bit values with every bit random. + * + * \param generator - Generator to use + * \param outputPtr - Pointer to device memory to store CUDA-generated results, or + * Pointer to host memory to store CPU-generated results + * \param num - Number of random 32-bit values to generate + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is + * not a multiple of the quasirandom dimension \n + * - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason \n + * - CURAND_STATUS_TYPE_ERROR if the generator is a 64 bit quasirandom generator. + * (use ::curandGenerateLongLong() with 64 bit quasirandom generators) + * - CURAND_STATUS_SUCCESS if the results were generated successfully \n + */ +curandStatus_t CURANDAPI +curandGenerate(curandGenerator_t generator, unsigned int *outputPtr, size_t num); + +/** + * \brief Generate 64-bit quasirandom numbers. + * + * Use \p generator to generate \p num 64-bit results into the device memory at + * \p outputPtr. The device memory must have been previously allocated and be + * large enough to hold all the results. Launches are done with the stream + * set using ::curandSetStream(), or the null stream if no stream has been set. + * + * Results are 64-bit values with every bit random. + * + * \param generator - Generator to use + * \param outputPtr - Pointer to device memory to store CUDA-generated results, or + * Pointer to host memory to store CPU-generated results + * \param num - Number of random 64-bit values to generate + * + * \return + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is + * not a multiple of the quasirandom dimension \n + * - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason \n + * - CURAND_STATUS_TYPE_ERROR if the generator is not a 64 bit quasirandom generator\n + * - CURAND_STATUS_SUCCESS if the results were generated successfully \n + */ +curandStatus_t CURANDAPI +curandGenerateLongLong(curandGenerator_t generator, unsigned long long *outputPtr, size_t num); + +/** + * \brief Generate uniformly distributed floats. + * + * Use \p generator to generate \p num float results into the device memory at + * \p outputPtr. The device memory must have been previously allocated and be + * large enough to hold all the results. Launches are done with the stream + * set using ::curandSetStream(), or the null stream if no stream has been set. + * + * Results are 32-bit floating point values between \p 0.0f and \p 1.0f, + * excluding \p 0.0f and including \p 1.0f. + * + * \param generator - Generator to use + * \param outputPtr - Pointer to device memory to store CUDA-generated results, or + * Pointer to host memory to store CPU-generated results + * \param num - Number of floats to generate + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason \n + * - CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is + * not a multiple of the quasirandom dimension \n + * - CURAND_STATUS_SUCCESS if the results were generated successfully \n + */ +curandStatus_t CURANDAPI +curandGenerateUniform(curandGenerator_t generator, float *outputPtr, size_t num); + +/** + * \brief Generate uniformly distributed doubles. + * + * Use \p generator to generate \p num double results into the device memory at + * \p outputPtr. The device memory must have been previously allocated and be + * large enough to hold all the results. Launches are done with the stream + * set using ::curandSetStream(), or the null stream if no stream has been set. + * + * Results are 64-bit double precision floating point values between + * \p 0.0 and \p 1.0, excluding \p 0.0 and including \p 1.0. + * + * \param generator - Generator to use + * \param outputPtr - Pointer to device memory to store CUDA-generated results, or + * Pointer to host memory to store CPU-generated results + * \param num - Number of doubles to generate + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason \n + * - CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is + * not a multiple of the quasirandom dimension \n + * - CURAND_STATUS_DOUBLE_PRECISION_REQUIRED if the GPU does not support double precision \n + * - CURAND_STATUS_SUCCESS if the results were generated successfully \n + */ +curandStatus_t CURANDAPI +curandGenerateUniformDouble(curandGenerator_t generator, double *outputPtr, size_t num); + +/** + * \brief Generate normally distributed doubles. + * + * Use \p generator to generate \p n float results into the device memory at + * \p outputPtr. The device memory must have been previously allocated and be + * large enough to hold all the results. Launches are done with the stream + * set using ::curandSetStream(), or the null stream if no stream has been set. + * + * Results are 32-bit floating point values with mean \p mean and standard + * deviation \p stddev. + * + * Normally distributed results are generated from pseudorandom generators + * with a Box-Muller transform, and so require \p n to be even. + * Quasirandom generators use an inverse cumulative distribution + * function to preserve dimensionality. + * + * There may be slight numerical differences between results generated + * on the GPU with generators created with ::curandCreateGenerator() + * and results calculated on the CPU with generators created with + * ::curandCreateGeneratorHost(). These differences arise because of + * differences in results for transcendental functions. In addition, + * future versions of CURAND may use newer versions of the CUDA math + * library, so different versions of CURAND may give slightly different + * numerical values. + * + * \param generator - Generator to use + * \param outputPtr - Pointer to device memory to store CUDA-generated results, or + * Pointer to host memory to store CPU-generated results + * \param n - Number of floats to generate + * \param mean - Mean of normal distribution + * \param stddev - Standard deviation of normal distribution + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason \n + * - CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is + * not a multiple of the quasirandom dimension, or is not a multiple + * of two for pseudorandom generators \n + * - CURAND_STATUS_SUCCESS if the results were generated successfully \n + */ +curandStatus_t CURANDAPI +curandGenerateNormal(curandGenerator_t generator, float *outputPtr, + size_t n, float mean, float stddev); + +/** + * \brief Generate normally distributed doubles. + * + * Use \p generator to generate \p n double results into the device memory at + * \p outputPtr. The device memory must have been previously allocated and be + * large enough to hold all the results. Launches are done with the stream + * set using ::curandSetStream(), or the null stream if no stream has been set. + * + * Results are 64-bit floating point values with mean \p mean and standard + * deviation \p stddev. + * + * Normally distributed results are generated from pseudorandom generators + * with a Box-Muller transform, and so require \p n to be even. + * Quasirandom generators use an inverse cumulative distribution + * function to preserve dimensionality. + * + * There may be slight numerical differences between results generated + * on the GPU with generators created with ::curandCreateGenerator() + * and results calculated on the CPU with generators created with + * ::curandCreateGeneratorHost(). These differences arise because of + * differences in results for transcendental functions. In addition, + * future versions of CURAND may use newer versions of the CUDA math + * library, so different versions of CURAND may give slightly different + * numerical values. + * + * \param generator - Generator to use + * \param outputPtr - Pointer to device memory to store CUDA-generated results, or + * Pointer to host memory to store CPU-generated results + * \param n - Number of doubles to generate + * \param mean - Mean of normal distribution + * \param stddev - Standard deviation of normal distribution + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason \n + * - CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is + * not a multiple of the quasirandom dimension, or is not a multiple + * of two for pseudorandom generators \n + * - CURAND_STATUS_DOUBLE_PRECISION_REQUIRED if the GPU does not support double precision \n + * - CURAND_STATUS_SUCCESS if the results were generated successfully \n + */ +curandStatus_t CURANDAPI +curandGenerateNormalDouble(curandGenerator_t generator, double *outputPtr, + size_t n, double mean, double stddev); + +/** + * \brief Generate log-normally distributed floats. + * + * Use \p generator to generate \p n float results into the device memory at + * \p outputPtr. The device memory must have been previously allocated and be + * large enough to hold all the results. Launches are done with the stream + * set using ::curandSetStream(), or the null stream if no stream has been set. + * + * Results are 32-bit floating point values with log-normal distribution based on + * an associated normal distribution with mean \p mean and standard deviation \p stddev. + * + * Normally distributed results are generated from pseudorandom generators + * with a Box-Muller transform, and so require \p n to be even. + * Quasirandom generators use an inverse cumulative distribution + * function to preserve dimensionality. + * The normally distributed results are transformed into log-normal distribution. + * + * There may be slight numerical differences between results generated + * on the GPU with generators created with ::curandCreateGenerator() + * and results calculated on the CPU with generators created with + * ::curandCreateGeneratorHost(). These differences arise because of + * differences in results for transcendental functions. In addition, + * future versions of CURAND may use newer versions of the CUDA math + * library, so different versions of CURAND may give slightly different + * numerical values. + * + * \param generator - Generator to use + * \param outputPtr - Pointer to device memory to store CUDA-generated results, or + * Pointer to host memory to store CPU-generated results + * \param n - Number of floats to generate + * \param mean - Mean of associated normal distribution + * \param stddev - Standard deviation of associated normal distribution + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason \n + * - CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is + * not a multiple of the quasirandom dimension, or is not a multiple + * of two for pseudorandom generators \n + * - CURAND_STATUS_SUCCESS if the results were generated successfully \n + */ +curandStatus_t CURANDAPI +curandGenerateLogNormal(curandGenerator_t generator, float *outputPtr, + size_t n, float mean, float stddev); + +/** + * \brief Generate log-normally distributed doubles. + * + * Use \p generator to generate \p n double results into the device memory at + * \p outputPtr. The device memory must have been previously allocated and be + * large enough to hold all the results. Launches are done with the stream + * set using ::curandSetStream(), or the null stream if no stream has been set. + * + * Results are 64-bit floating point values with log-normal distribution based on + * an associated normal distribution with mean \p mean and standard deviation \p stddev. + * + * Normally distributed results are generated from pseudorandom generators + * with a Box-Muller transform, and so require \p n to be even. + * Quasirandom generators use an inverse cumulative distribution + * function to preserve dimensionality. + * The normally distributed results are transformed into log-normal distribution. + * + * There may be slight numerical differences between results generated + * on the GPU with generators created with ::curandCreateGenerator() + * and results calculated on the CPU with generators created with + * ::curandCreateGeneratorHost(). These differences arise because of + * differences in results for transcendental functions. In addition, + * future versions of CURAND may use newer versions of the CUDA math + * library, so different versions of CURAND may give slightly different + * numerical values. + * + * \param generator - Generator to use + * \param outputPtr - Pointer to device memory to store CUDA-generated results, or + * Pointer to host memory to store CPU-generated results + * \param n - Number of doubles to generate + * \param mean - Mean of normal distribution + * \param stddev - Standard deviation of normal distribution + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason \n + * - CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is + * not a multiple of the quasirandom dimension, or is not a multiple + * of two for pseudorandom generators \n + * - CURAND_STATUS_DOUBLE_PRECISION_REQUIRED if the GPU does not support double precision \n + * - CURAND_STATUS_SUCCESS if the results were generated successfully \n + */ +curandStatus_t CURANDAPI +curandGenerateLogNormalDouble(curandGenerator_t generator, double *outputPtr, + size_t n, double mean, double stddev); + +/** + * \brief Construct the histogram array for a Poisson distribution. + * + * Construct the histogram array for the Poisson distribution with lambda \p lambda. + * For lambda greater than 2000, an approximation with a normal distribution is used. + * + * \param lambda - lambda for the Poisson distribution + * + * + * \param discrete_distribution - pointer to the histogram in device memory + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_DOUBLE_PRECISION_REQUIRED if the GPU does not support double precision \n + * - CURAND_STATUS_INITIALIZATION_FAILED if there was a problem setting up the GPU \n + * - CURAND_STATUS_NOT_INITIALIZED if the distribution pointer was null \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_OUT_OF_RANGE if lambda is non-positive or greater than 400,000 \n + * - CURAND_STATUS_SUCCESS if the histogram was generated successfully \n + */ + +curandStatus_t CURANDAPI +curandCreatePoissonDistribution(double lambda, curandDiscreteDistribution_t *discrete_distribution); + + + +/** + * \brief Destroy the histogram array for a discrete distribution (e.g. Poisson). + * + * Destroy the histogram array for a discrete distribution created by curandCreatePoissonDistribution. + * + * \param discrete_distribution - pointer to device memory where the histogram is stored + * + * \return + * - CURAND_STATUS_NOT_INITIALIZED if the histogram was never created \n + * - CURAND_STATUS_SUCCESS if the histogram was destroyed successfully \n + */ +curandStatus_t CURANDAPI +curandDestroyDistribution(curandDiscreteDistribution_t discrete_distribution); + + +/** + * \brief Generate Poisson-distributed unsigned ints. + * + * Use \p generator to generate \p n unsigned int results into device memory at + * \p outputPtr. The device memory must have been previously allocated and must be + * large enough to hold all the results. Launches are done with the stream + * set using ::curandSetStream(), or the null stream if no stream has been set. + * + * Results are 32-bit unsigned int point values with Poisson distribution, with lambda \p lambda. + * + * \param generator - Generator to use + * \param outputPtr - Pointer to device memory to store CUDA-generated results, or + * Pointer to host memory to store CPU-generated results + * \param n - Number of unsigned ints to generate + * \param lambda - lambda for the Poisson distribution + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason \n + * - CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is + * not a multiple of the quasirandom dimension\n + * - CURAND_STATUS_DOUBLE_PRECISION_REQUIRED if the GPU or sm does not support double precision \n + * - CURAND_STATUS_OUT_OF_RANGE if lambda is non-positive or greater than 400,000 \n + * - CURAND_STATUS_SUCCESS if the results were generated successfully \n + */ + +curandStatus_t CURANDAPI +curandGeneratePoisson(curandGenerator_t generator, unsigned int *outputPtr, + size_t n, double lambda); +// just for internal usage +curandStatus_t CURANDAPI +curandGeneratePoissonMethod(curandGenerator_t generator, unsigned int *outputPtr, + size_t n, double lambda, curandMethod_t method); + + +curandStatus_t CURANDAPI +curandGenerateBinomial(curandGenerator_t generator, unsigned int *outputPtr, + size_t num, unsigned int n, double p); +// just for internal usage +curandStatus_t CURANDAPI +curandGenerateBinomialMethod(curandGenerator_t generator, + unsigned int *outputPtr, + size_t num, unsigned int n, double p, + curandMethod_t method); + + +/** + * \brief Setup starting states. + * + * Generate the starting state of the generator. This function is + * automatically called by generation functions such as + * ::curandGenerate() and ::curandGenerateUniform(). + * It can be called manually for performance testing reasons to separate + * timings for starting state generation and random number generation. + * + * \param generator - Generator to update + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if memory could not be allocated \n + * - CURAND_STATUS_NOT_INITIALIZED if the generator was never created \n + * - CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from + * a previous kernel launch \n + * - CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason \n + * - CURAND_STATUS_SUCCESS if the seeds were generated successfully \n + */ +curandStatus_t CURANDAPI +curandGenerateSeeds(curandGenerator_t generator); + +/** + * \brief Get direction vectors for 32-bit quasirandom number generation. + * + * Get a pointer to an array of direction vectors that can be used + * for quasirandom number generation. The resulting pointer will + * reference an array of direction vectors in host memory. + * + * The array contains vectors for many dimensions. Each dimension + * has 32 vectors. Each individual vector is an unsigned int. + * + * Legal values for \p set are: + * - CURAND_DIRECTION_VECTORS_32_JOEKUO6 (20,000 dimensions) + * - CURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6 (20,000 dimensions) + * + * \param vectors - Address of pointer in which to return direction vectors + * \param set - Which set of direction vectors to use + * + * \return + * - CURAND_STATUS_OUT_OF_RANGE if the choice of set is invalid \n + * - CURAND_STATUS_SUCCESS if the pointer was set successfully \n + */ +curandStatus_t CURANDAPI +curandGetDirectionVectors32(curandDirectionVectors32_t *vectors[], curandDirectionVectorSet_t set); + +/** + * \brief Get scramble constants for 32-bit scrambled Sobol' . + * + * Get a pointer to an array of scramble constants that can be used + * for quasirandom number generation. The resulting pointer will + * reference an array of unsinged ints in host memory. + * + * The array contains constants for many dimensions. Each dimension + * has a single unsigned int constant. + * + * \param constants - Address of pointer in which to return scramble constants + * + * \return + * - CURAND_STATUS_SUCCESS if the pointer was set successfully \n + */ +curandStatus_t CURANDAPI +curandGetScrambleConstants32(unsigned int * * constants); + +/** + * \brief Get direction vectors for 64-bit quasirandom number generation. + * + * Get a pointer to an array of direction vectors that can be used + * for quasirandom number generation. The resulting pointer will + * reference an array of direction vectors in host memory. + * + * The array contains vectors for many dimensions. Each dimension + * has 64 vectors. Each individual vector is an unsigned long long. + * + * Legal values for \p set are: + * - CURAND_DIRECTION_VECTORS_64_JOEKUO6 (20,000 dimensions) + * - CURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6 (20,000 dimensions) + * + * \param vectors - Address of pointer in which to return direction vectors + * \param set - Which set of direction vectors to use + * + * \return + * - CURAND_STATUS_OUT_OF_RANGE if the choice of set is invalid \n + * - CURAND_STATUS_SUCCESS if the pointer was set successfully \n + */ +curandStatus_t CURANDAPI +curandGetDirectionVectors64(curandDirectionVectors64_t *vectors[], curandDirectionVectorSet_t set); + +/** + * \brief Get scramble constants for 64-bit scrambled Sobol' . + * + * Get a pointer to an array of scramble constants that can be used + * for quasirandom number generation. The resulting pointer will + * reference an array of unsinged long longs in host memory. + * + * The array contains constants for many dimensions. Each dimension + * has a single unsigned long long constant. + * + * \param constants - Address of pointer in which to return scramble constants + * + * \return + * - CURAND_STATUS_SUCCESS if the pointer was set successfully \n + */ +curandStatus_t CURANDAPI +curandGetScrambleConstants64(unsigned long long * * constants); + +/** @} */ + +#endif // __CUDACC_RTC__ + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + + +#endif /* !defined(CURAND_H_) */ diff --git a/cuda_toolkit/include/curand_discrete.h b/cuda_toolkit/include/curand_discrete.h new file mode 100644 index 0000000000000000000000000000000000000000..76c7432a4292e80086964d473ab22a911627dd05 --- /dev/null +++ b/cuda_toolkit/include/curand_discrete.h @@ -0,0 +1,87 @@ + /* Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(CURANDDISCRETE_H_) +#define CURANDDISCRETE_H_ + +struct curandDistributionShift_st { + curandDistribution_t probability; + curandDistribution_t host_probability; + unsigned int shift; + unsigned int length; + unsigned int host_gen; +}; + +struct curandHistogramM2_st { + curandHistogramM2V_t V; + curandHistogramM2V_t host_V; + curandHistogramM2K_t K; + curandHistogramM2K_t host_K; + unsigned int host_gen; +}; + + +struct curandDistributionM2Shift_st { + curandHistogramM2_t histogram; + curandHistogramM2_t host_histogram; + unsigned int shift; + unsigned int length; + unsigned int host_gen; +}; + +struct curandDiscreteDistribution_st { + curandDiscreteDistribution_t self_host_ptr; + curandDistributionM2Shift_t M2; + curandDistributionM2Shift_t host_M2; + double stddev; + double mean; + curandMethod_t method; + unsigned int host_gen; +}; + +#endif // !defined(CURANDDISCRETE_H_) diff --git a/cuda_toolkit/include/curand_discrete2.h b/cuda_toolkit/include/curand_discrete2.h new file mode 100644 index 0000000000000000000000000000000000000000..c4b103b7d3ae6ded548e0dcf861cfdb54801c1da --- /dev/null +++ b/cuda_toolkit/include/curand_discrete2.h @@ -0,0 +1,253 @@ + + /* Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + + +#if !defined(CURAND_DISCRETE_H_) +#define CURAND_DISCRETE_H_ + +/** + * \defgroup DEVICE Device API + * + * @{ + */ + +#ifndef __CUDACC_RTC__ +#include +#endif // __CUDACC_RTC__ + +#include "curand_mrg32k3a.h" +#include "curand_mtgp32_kernel.h" +#include "curand_philox4x32_x.h" + + +template +QUALIFIERS unsigned int _curand_discrete(T x, curandDiscreteDistribution_t discrete_distribution){ + if (discrete_distribution->method == CURAND_M2){ + return _curand_M2_double(x, discrete_distribution->M2); + } + return (unsigned int)((discrete_distribution->stddev * _curand_normal_icdf_double(x)) + discrete_distribution->mean + 0.5); +} + + +template +QUALIFIERS unsigned int curand__discrete(STATE state, curandDiscreteDistribution_t discrete_distribution){ + if (discrete_distribution->method == CURAND_M2){ + return curand_M2_double(state, discrete_distribution->M2); + } + return (unsigned int)((discrete_distribution->stddev * curand_normal_double(state)) + discrete_distribution->mean + 0.5); //Round to nearest +} + +template +QUALIFIERS uint4 curand__discrete4(STATE state, curandDiscreteDistribution_t discrete_distribution){ + if (discrete_distribution->method == CURAND_M2){ + return curand_M2_double4(state, discrete_distribution->M2); + } + double4 _res; + uint4 result; + _res = curand_normal4_double(state); + result.x = (unsigned int)((discrete_distribution->stddev * _res.x) + discrete_distribution->mean + 0.5); //Round to nearest + result.y = (unsigned int)((discrete_distribution->stddev * _res.y) + discrete_distribution->mean + 0.5); //Round to nearest + result.z = (unsigned int)((discrete_distribution->stddev * _res.z) + discrete_distribution->mean + 0.5); //Round to nearest + result.w = (unsigned int)((discrete_distribution->stddev * _res.w) + discrete_distribution->mean + 0.5); //Round to nearest + return result; +} + +/* + * \brief Return a discrete distributed unsigned int from a XORWOW generator. + * + * Return a single discrete distributed unsigned int derived from a + * distribution defined by \p discrete_distribution from the XORWOW generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param discrete_distribution - ancillary structure for discrete distribution + * + * \return unsigned int distributed by distribution defined by \p discrete_distribution. + */ +QUALIFIERS unsigned int curand_discrete(curandStateXORWOW_t *state, curandDiscreteDistribution_t discrete_distribution) +{ + return curand__discrete(state, discrete_distribution); +} + +/* + * \brief Return a discrete distributed unsigned int from a Philox4_32_10 generator. + * + * Return a single discrete distributed unsigned int derived from a + * distribution defined by \p discrete_distribution from the Philox4_32_10 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param discrete_distribution - ancillary structure for discrete distribution + * + * \return unsigned int distributed by distribution defined by \p discrete_distribution. + */ +QUALIFIERS unsigned int curand_discrete(curandStatePhilox4_32_10_t *state, curandDiscreteDistribution_t discrete_distribution) +{ + return curand__discrete(state, discrete_distribution); +} + +/* + * \brief Return four discrete distributed unsigned ints from a Philox4_32_10 generator. + * + * Return four single discrete distributed unsigned ints derived from a + * distribution defined by \p discrete_distribution from the Philox4_32_10 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param discrete_distribution - ancillary structure for discrete distribution + * + * \return unsigned int distributed by distribution defined by \p discrete_distribution. + */ +QUALIFIERS uint4 curand_discrete4(curandStatePhilox4_32_10_t *state, curandDiscreteDistribution_t discrete_distribution) +{ + return curand__discrete4(state, discrete_distribution); +} +/* + * \brief Return a discrete distributed unsigned int from a MRG32k3a generator. + * + * Re turn a single discrete distributed unsigned int derived from a + * distribution defined by \p discrete_distribution from the MRG32k3a generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param discrete_distribution - ancillary structure for discrete distribution + * + * \return unsigned int distributed by distribution defined by \p discrete_distribution. + */ +QUALIFIERS unsigned int curand_discrete(curandStateMRG32k3a_t *state, curandDiscreteDistribution_t discrete_distribution) +{ + return curand__discrete(state, discrete_distribution); +} + +/* + * \brief Return a discrete distributed unsigned int from a MTGP32 generator. + * + * Return a single discrete distributed unsigned int derived from a + * distribution defined by \p discrete_distribution from the MTGP32 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param discrete_distribution - ancillary structure for discrete distribution + * + * \return unsigned int distributed by distribution defined by \p discrete_distribution. + */ +QUALIFIERS unsigned int curand_discrete(curandStateMtgp32_t *state, curandDiscreteDistribution_t discrete_distribution) +{ + return curand__discrete(state, discrete_distribution); +} + +/* + * \brief Return a discrete distributed unsigned int from a Sobol32 generator. + * + * Return a single discrete distributed unsigned int derived from a + * distribution defined by \p discrete_distribution from the Sobol32 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param discrete_distribution - ancillary structure for discrete distribution + * + * \return unsigned int distributed by distribution defined by \p discrete_distribution. + */ +QUALIFIERS unsigned int curand_discrete(curandStateSobol32_t *state, curandDiscreteDistribution_t discrete_distribution) +{ + return curand__discrete(state, discrete_distribution); +} + +/* + * \brief Return a discrete distributed unsigned int from a scrambled Sobol32 generator. + * + * Return a single discrete distributed unsigned int derived from a + * distribution defined by \p discrete_distribution from the scrambled Sobol32 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param discrete_distribution - ancillary structure for discrete distribution + * + * \return unsigned int distributed by distribution defined by \p discrete_distribution. + */ +QUALIFIERS unsigned int curand_discrete(curandStateScrambledSobol32_t *state, curandDiscreteDistribution_t discrete_distribution) +{ + return curand__discrete(state, discrete_distribution); +} + +/* + * \brief Return a discrete distributed unsigned int from a Sobol64 generator. + * + * Return a single discrete distributed unsigned int derived from a + * distribution defined by \p discrete_distribution from the Sobol64 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param discrete_distribution - ancillary structure for discrete distribution + * + * \return unsigned int distributed by distribution defined by \p discrete_distribution. + */ +QUALIFIERS unsigned int curand_discrete(curandStateSobol64_t *state, curandDiscreteDistribution_t discrete_distribution) +{ + return curand__discrete(state, discrete_distribution); +} + +/* + * \brief Return a discrete distributed unsigned int from a scrambled Sobol64 generator. + * + * Return a single discrete distributed unsigned int derived from a + * distribution defined by \p discrete_distribution from the scrambled Sobol64 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param discrete_distribution - ancillary structure for discrete distribution + * + * \return unsigned int distributed by distribution defined by \p discrete_distribution. + */ +QUALIFIERS unsigned int curand_discrete(curandStateScrambledSobol64_t *state, curandDiscreteDistribution_t discrete_distribution) +{ + return curand__discrete(state, discrete_distribution); +} + +#endif // !defined(CURAND_DISCRETE_H_) diff --git a/cuda_toolkit/include/curand_globals.h b/cuda_toolkit/include/curand_globals.h new file mode 100644 index 0000000000000000000000000000000000000000..24bec7b213ba71941fcb5b8742f35f4b1716c7da --- /dev/null +++ b/cuda_toolkit/include/curand_globals.h @@ -0,0 +1,93 @@ + /* Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ +#ifndef CURAND_GLOBALS_H +#define CURAND_GLOBALS_H + +#define MAX_XOR_N (5) +#define SKIPAHEAD_BLOCKSIZE (4) +#define SKIPAHEAD_MASK ((1< + +#ifdef __CUDACC_RTC__ +#define CURAND_DETAIL_USE_CUDA_STL +#endif + +#if __cplusplus >= 201103L +# ifdef CURAND_DETAIL_USE_CUDA_STL +# define CURAND_STD cuda::std +# include +# else +# define CURAND_STD std +# include +# endif // CURAND_DETAIL_USE_CUDA_STL +#else +// To support C++03 compilation +# define CURAND_STD curand_detail +namespace curand_detail { + template + struct enable_if {}; + + template + struct enable_if { typedef T type; }; + + template + struct is_same { static const bool value = false; }; + + template + struct is_same { static const bool value = true; }; +} // namespace curand_detail +#endif // __cplusplus >= 201103L + +#ifndef __CUDACC_RTC__ +#include +#endif // __CUDACC_RTC__ + +#include "curand.h" +#include "curand_discrete.h" +#include "curand_precalc.h" +#include "curand_mrg32k3a.h" +#include "curand_mtgp32_kernel.h" +#include "curand_philox4x32_x.h" +#include "curand_globals.h" + +/* Test RNG */ +/* This generator uses the formula: + x_n = x_(n-1) + 1 mod 2^32 + x_0 = (unsigned int)seed * 3 + Subsequences are spaced 31337 steps apart. +*/ +struct curandStateTest { + unsigned int v; +}; + +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandStateTest curandStateTest_t; +/** \endcond */ + +/* XORSHIFT FAMILY RNGs */ +/* These generators are a family proposed by Marsaglia. They keep state + in 32 bit chunks, then use repeated shift and xor operations to scramble + the bits. The following generators are a combination of a simple Weyl + generator with an N variable XORSHIFT generator. +*/ + +/* XORSHIFT RNG */ +/* This generator uses the xorwow formula of +www.jstatsoft.org/v08/i14/paper page 5 +Has period 2^192 - 2^32. +*/ +/** + * CURAND XORWOW state + */ +struct curandStateXORWOW; + +/* + * Implementation details not in reference documentation */ +struct curandStateXORWOW { + unsigned int d, v[5]; + int boxmuller_flag; + int boxmuller_flag_double; + float boxmuller_extra; + double boxmuller_extra_double; +}; + +/* + * CURAND XORWOW state + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandStateXORWOW curandStateXORWOW_t; + +#define EXTRA_FLAG_NORMAL 0x00000001 +#define EXTRA_FLAG_LOG_NORMAL 0x00000002 +/** \endcond */ + +/* Combined Multiple Recursive Generators */ +/* These generators are a family proposed by L'Ecuyer. They keep state + in sets of doubles, then use repeated modular arithmetic multiply operations + to scramble the bits in each set, and combine the result. +*/ + +/* MRG32k3a RNG */ +/* This generator uses the MRG32k3A formula of +http://www.iro.umontreal.ca/~lecuyer/myftp/streams00/c++/streams4.pdf +Has period 2^191. +*/ + +/* moduli for the recursions */ +/** \cond UNHIDE_DEFINES */ +#define MRG32K3A_MOD1 4294967087. +#define MRG32K3A_MOD2 4294944443. + +/* Constants used in generation */ + +#define MRG32K3A_A12 1403580. +#define MRG32K3A_A13N 810728. +#define MRG32K3A_A21 527612. +#define MRG32K3A_A23N 1370589. +#define MRG32K3A_NORM (2.3283065498378288e-10) +// +// #define MRG32K3A_BITS_NORM ((double)((POW32_DOUBLE-1.0)/MOD1)) +// above constant, used verbatim, rounds differently on some host systems. +#define MRG32K3A_BITS_NORM 1.000000048662 + +/** \endcond */ + + + + +/** + * CURAND MRG32K3A state + */ +struct curandStateMRG32k3a; + +/* Implementation details not in reference documentation */ +struct curandStateMRG32k3a { + unsigned int s1[3]; + unsigned int s2[3]; + int boxmuller_flag; + int boxmuller_flag_double; + float boxmuller_extra; + double boxmuller_extra_double; +}; + +/* + * CURAND MRG32K3A state + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandStateMRG32k3a curandStateMRG32k3a_t; +/** \endcond */ + +/* SOBOL QRNG */ +/** + * CURAND Sobol32 state + */ +struct curandStateSobol32; + +/* Implementation details not in reference documentation */ +struct curandStateSobol32 { + unsigned int i, x, c; + unsigned int direction_vectors[32]; +}; + +/* + * CURAND Sobol32 state + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandStateSobol32 curandStateSobol32_t; +/** \endcond */ + +/** + * CURAND Scrambled Sobol32 state + */ +struct curandStateScrambledSobol32; + +/* Implementation details not in reference documentation */ +struct curandStateScrambledSobol32 { + unsigned int i, x, c; + unsigned int direction_vectors[32]; +}; + +/* + * CURAND Scrambled Sobol32 state + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandStateScrambledSobol32 curandStateScrambledSobol32_t; +/** \endcond */ + +/** + * CURAND Sobol64 state + */ +struct curandStateSobol64; + +/* Implementation details not in reference documentation */ +struct curandStateSobol64 { + unsigned long long i, x, c; + unsigned long long direction_vectors[64]; +}; + +/* + * CURAND Sobol64 state + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandStateSobol64 curandStateSobol64_t; +/** \endcond */ + +/** + * CURAND Scrambled Sobol64 state + */ +struct curandStateScrambledSobol64; + +/* Implementation details not in reference documentation */ +struct curandStateScrambledSobol64 { + unsigned long long i, x, c; + unsigned long long direction_vectors[64]; +}; + +/* + * CURAND Scrambled Sobol64 state + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandStateScrambledSobol64 curandStateScrambledSobol64_t; +/** \endcond */ + +/* + * Default RNG + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandStateXORWOW curandState_t; +typedef struct curandStateXORWOW curandState; +/** \endcond */ + +/****************************************************************************/ +/* Utility functions needed by RNGs */ +/****************************************************************************/ +/** \cond UNHIDE_UTILITIES */ +/* + multiply vector by matrix, store in result + matrix is n x n, measured in 32 bit units + matrix is stored in row major order + vector and result cannot be same pointer +*/ +template +QUALIFIERS void __curand_matvec_inplace(unsigned int *vector, unsigned int *matrix) +{ + unsigned int result[N] = { 0 }; + for(int i = 0; i < N; i++) { + #ifdef __CUDA_ARCH__ + #pragma unroll 16 + #endif + for(int j = 0; j < 32; j++) { + if(vector[i] & (1 << j)) { + for(int k = 0; k < N; k++) { + result[k] ^= matrix[N * (i * 32 + j) + k]; + } + } + } + } + for(int i = 0; i < N; i++) { + vector[i] = result[i]; + } +} + +QUALIFIERS void __curand_matvec(unsigned int *vector, unsigned int *matrix, + unsigned int *result, int n) +{ + for(int i = 0; i < n; i++) { + result[i] = 0; + } + for(int i = 0; i < n; i++) { + for(int j = 0; j < 32; j++) { + if(vector[i] & (1 << j)) { + for(int k = 0; k < n; k++) { + result[k] ^= matrix[n * (i * 32 + j) + k]; + } + } + } + } +} + +/* generate identity matrix */ +QUALIFIERS void __curand_matidentity(unsigned int *matrix, int n) +{ + int r; + for(int i = 0; i < n * 32; i++) { + for(int j = 0; j < n; j++) { + r = i & 31; + if(i / 32 == j) { + matrix[i * n + j] = (1 << r); + } else { + matrix[i * n + j] = 0; + } + } + } +} + +/* multiply matrixA by matrixB, store back in matrixA + matrixA and matrixB must not be same matrix */ +QUALIFIERS void __curand_matmat(unsigned int *matrixA, unsigned int *matrixB, int n) +{ + unsigned int result[MAX_XOR_N]; + for(int i = 0; i < n * 32; i++) { + __curand_matvec(matrixA + i * n, matrixB, result, n); + for(int j = 0; j < n; j++) { + matrixA[i * n + j] = result[j]; + } + } +} + +/* copy vectorA to vector */ +QUALIFIERS void __curand_veccopy(unsigned int *vector, unsigned int *vectorA, int n) +{ + for(int i = 0; i < n; i++) { + vector[i] = vectorA[i]; + } +} + +/* copy matrixA to matrix */ +QUALIFIERS void __curand_matcopy(unsigned int *matrix, unsigned int *matrixA, int n) +{ + for(int i = 0; i < n * n * 32; i++) { + matrix[i] = matrixA[i]; + } +} + +/* compute matrixA to power p, store result in matrix */ +QUALIFIERS void __curand_matpow(unsigned int *matrix, unsigned int *matrixA, + unsigned long long p, int n) +{ + unsigned int matrixR[MAX_XOR_N * MAX_XOR_N * 32]; + unsigned int matrixS[MAX_XOR_N * MAX_XOR_N * 32]; + __curand_matidentity(matrix, n); + __curand_matcopy(matrixR, matrixA, n); + while(p) { + if(p & 1) { + __curand_matmat(matrix, matrixR, n); + } + __curand_matcopy(matrixS, matrixR, n); + __curand_matmat(matrixR, matrixS, n); + p >>= 1; + } +} + +/****************************************************************************/ +/* Utility functions needed by MRG32k3a RNG */ +/* Matrix operations modulo some integer less than 2**32, done in */ +/* double precision floating point, with care not to overflow 53 bits */ +/****************************************************************************/ + +/* return i mod m. */ +/* assumes i and m are integers represented accurately in doubles */ + +QUALIFIERS double curand_MRGmod(double i, double m) +{ + double quo; + double rem; + quo = floor(i/m); + rem = i - (quo*m); + if (rem < 0.0) rem += m; + return rem; +} + +/* Multiplication modulo m. Inputs i and j less than 2**32 */ +/* Ensure intermediate results do not exceed 2**53 */ + +QUALIFIERS double curand_MRGmodMul(double i, double j, double m) +{ + double tempHi; + double tempLo; + + tempHi = floor(i/131072.0); + tempLo = i - (tempHi*131072.0); + tempLo = curand_MRGmod( curand_MRGmod( (tempHi * j), m) * 131072.0 + curand_MRGmod(tempLo * j, m),m); + + if (tempLo < 0.0) tempLo += m; + return tempLo; +} + +/* multiply 3 by 3 matrices of doubles, modulo m */ + +QUALIFIERS void curand_MRGmatMul3x3(unsigned int i1[][3],unsigned int i2[][3],unsigned int o[][3],double m) +{ + int i,j; + double temp[3][3]; + for (i=0; i<3; i++){ + for (j=0; j<3; j++){ + temp[i][j] = ( curand_MRGmodMul(i1[i][0], i2[0][j], m) + + curand_MRGmodMul(i1[i][1], i2[1][j], m) + + curand_MRGmodMul(i1[i][2], i2[2][j], m)); + temp[i][j] = curand_MRGmod( temp[i][j], m ); + } + } + for (i=0; i<3; i++){ + for (j=0; j<3; j++){ + o[i][j] = (unsigned int)temp[i][j]; + } + } +} + +/* multiply 3 by 3 matrix times 3 by 1 vector of doubles, modulo m */ + +QUALIFIERS void curand_MRGmatVecMul3x3( unsigned int i[][3], unsigned int v[], double m) +{ + int k; + double t[3]; + for (k = 0; k < 3; k++) { + t[k] = ( curand_MRGmodMul(i[k][0], v[0], m) + + curand_MRGmodMul(i[k][1], v[1], m) + + curand_MRGmodMul(i[k][2], v[2], m) ); + t[k] = curand_MRGmod( t[k], m ); + } + for (k = 0; k < 3; k++) { + v[k] = (unsigned int)t[k]; + } + +} + +/* raise a 3 by 3 matrix of doubles to a 64 bit integer power pow, modulo m */ +/* input is index zero of an array of 3 by 3 matrices m, */ +/* each m = m[0]**(2**index) */ + +QUALIFIERS void curand_MRGmatPow3x3( unsigned int in[][3][3], unsigned int o[][3], double m, unsigned long long pow ) +{ + int i,j; + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) { + o[i][j] = 0; + if ( i == j ) o[i][j] = 1; + } + } + i = 0; + curand_MRGmatVecMul3x3(o,o[0],m); + while (pow) { + if ( pow & 1ll ) { + curand_MRGmatMul3x3(in[i], o, o, m); + } + i++; + pow >>= 1; + } +} + +/* raise a 3 by 3 matrix of doubles to the power */ +/* 2 to the power (pow modulo 191), modulo m */ + +QUALIFIERS void curnand_MRGmatPow2Pow3x3( double in[][3], double o[][3], double m, unsigned long pow ) +{ + unsigned int temp[3][3]; + int i,j; + pow = pow % 191; + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) { + temp[i][j] = (unsigned int)in[i][j]; + } + } + while (pow) { + curand_MRGmatMul3x3(temp, temp, temp, m); + pow--; + } + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) { + o[i][j] = temp[i][j]; + } + } +} + +/** \endcond */ + +/****************************************************************************/ +/* Kernel implementations of RNGs */ +/****************************************************************************/ + +/* Test RNG */ + +QUALIFIERS void curand_init(unsigned long long seed, + unsigned long long subsequence, + unsigned long long offset, + curandStateTest_t *state) +{ + state->v = (unsigned int)(seed * 3) + (unsigned int)(subsequence * 31337) + \ + (unsigned int)offset; +} + + +QUALIFIERS unsigned int curand(curandStateTest_t *state) +{ + unsigned int r = state->v++; + return r; +} + +QUALIFIERS void skipahead(unsigned long long n, curandStateTest_t *state) +{ + state->v += (unsigned int)n; +} + +/* XORWOW RNG */ + +template +QUALIFIERS void __curand_generate_skipahead_matrix_xor(unsigned int matrix[]) +{ + T state; + // Generate matrix that advances one step + // matrix has n * n * 32 32-bit elements + // solve for matrix by stepping single bit states + for(int i = 0; i < 32 * n; i++) { + state.d = 0; + for(int j = 0; j < n; j++) { + state.v[j] = 0; + } + state.v[i / 32] = (1 << (i & 31)); + curand(&state); + for(int j = 0; j < n; j++) { + matrix[i * n + j] = state.v[j]; + } + } +} + +template +QUALIFIERS void _skipahead_scratch(unsigned long long x, T *state, unsigned int *scratch) +{ + // unsigned int matrix[n * n * 32]; + unsigned int *matrix = scratch; + // unsigned int matrixA[n * n * 32]; + unsigned int *matrixA = scratch + (n * n * 32); + // unsigned int vector[n]; + unsigned int *vector = scratch + (n * n * 32) + (n * n * 32); + // unsigned int result[n]; + unsigned int *result = scratch + (n * n * 32) + (n * n * 32) + n; + unsigned long long p = x; + for(int i = 0; i < n; i++) { + vector[i] = state->v[i]; + } + int matrix_num = 0; + while(p && (matrix_num < PRECALC_NUM_MATRICES - 1)) { + for(unsigned int t = 0; t < (p & PRECALC_BLOCK_MASK); t++) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __curand_matvec(vector, precalc_xorwow_offset_matrix[matrix_num], result, n); +, + __curand_matvec(vector, precalc_xorwow_offset_matrix_host[matrix_num], result, n); +) + __curand_veccopy(vector, result, n); + } + p >>= PRECALC_BLOCK_SIZE; + matrix_num++; + } + if(p) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __curand_matcopy(matrix, precalc_xorwow_offset_matrix[PRECALC_NUM_MATRICES - 1], n); + __curand_matcopy(matrixA, precalc_xorwow_offset_matrix[PRECALC_NUM_MATRICES - 1], n); +, + __curand_matcopy(matrix, precalc_xorwow_offset_matrix_host[PRECALC_NUM_MATRICES - 1], n); + __curand_matcopy(matrixA, precalc_xorwow_offset_matrix_host[PRECALC_NUM_MATRICES - 1], n); +) + } + while(p) { + for(unsigned int t = 0; t < (p & SKIPAHEAD_MASK); t++) { + __curand_matvec(vector, matrixA, result, n); + __curand_veccopy(vector, result, n); + } + p >>= SKIPAHEAD_BLOCKSIZE; + if(p) { + for(int i = 0; i < SKIPAHEAD_BLOCKSIZE; i++) { + __curand_matmat(matrix, matrixA, n); + __curand_matcopy(matrixA, matrix, n); + } + } + } + for(int i = 0; i < n; i++) { + state->v[i] = vector[i]; + } + state->d += 362437 * (unsigned int)x; +} + +template +QUALIFIERS void _skipahead_sequence_scratch(unsigned long long x, T *state, unsigned int *scratch) +{ + // unsigned int matrix[n * n * 32]; + unsigned int *matrix = scratch; + // unsigned int matrixA[n * n * 32]; + unsigned int *matrixA = scratch + (n * n * 32); + // unsigned int vector[n]; + unsigned int *vector = scratch + (n * n * 32) + (n * n * 32); + // unsigned int result[n]; + unsigned int *result = scratch + (n * n * 32) + (n * n * 32) + n; + unsigned long long p = x; + for(int i = 0; i < n; i++) { + vector[i] = state->v[i]; + } + int matrix_num = 0; + while(p && matrix_num < PRECALC_NUM_MATRICES - 1) { + for(unsigned int t = 0; t < (p & PRECALC_BLOCK_MASK); t++) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __curand_matvec(vector, precalc_xorwow_matrix[matrix_num], result, n); +, + __curand_matvec(vector, precalc_xorwow_matrix_host[matrix_num], result, n); +) + __curand_veccopy(vector, result, n); + } + p >>= PRECALC_BLOCK_SIZE; + matrix_num++; + } + if(p) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __curand_matcopy(matrix, precalc_xorwow_matrix[PRECALC_NUM_MATRICES - 1], n); + __curand_matcopy(matrixA, precalc_xorwow_matrix[PRECALC_NUM_MATRICES - 1], n); +, + __curand_matcopy(matrix, precalc_xorwow_matrix_host[PRECALC_NUM_MATRICES - 1], n); + __curand_matcopy(matrixA, precalc_xorwow_matrix_host[PRECALC_NUM_MATRICES - 1], n); +) + } + while(p) { + for(unsigned int t = 0; t < (p & SKIPAHEAD_MASK); t++) { + __curand_matvec(vector, matrixA, result, n); + __curand_veccopy(vector, result, n); + } + p >>= SKIPAHEAD_BLOCKSIZE; + if(p) { + for(int i = 0; i < SKIPAHEAD_BLOCKSIZE; i++) { + __curand_matmat(matrix, matrixA, n); + __curand_matcopy(matrixA, matrix, n); + } + } + } + for(int i = 0; i < n; i++) { + state->v[i] = vector[i]; + } + /* No update of state->d needed, guaranteed to be a multiple of 2^32 */ +} + +template +QUALIFIERS void _skipahead_inplace(const unsigned long long x, T *state) +{ + unsigned long long p = x; + int matrix_num = 0; + while(p) { + for(unsigned int t = 0; t < (p & PRECALC_BLOCK_MASK); t++) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __curand_matvec_inplace(state->v, precalc_xorwow_offset_matrix[matrix_num]); +, + __curand_matvec_inplace(state->v, precalc_xorwow_offset_matrix_host[matrix_num]); +) + } + p >>= PRECALC_BLOCK_SIZE; + matrix_num++; + } + state->d += 362437 * (unsigned int)x; +} + +template +QUALIFIERS void _skipahead_sequence_inplace(unsigned long long x, T *state) +{ + int matrix_num = 0; + while(x) { + for(unsigned int t = 0; t < (x & PRECALC_BLOCK_MASK); t++) { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + __curand_matvec_inplace(state->v, precalc_xorwow_matrix[matrix_num]); +, + __curand_matvec_inplace(state->v, precalc_xorwow_matrix_host[matrix_num]); +) + } + x >>= PRECALC_BLOCK_SIZE; + matrix_num++; + } + /* No update of state->d needed, guaranteed to be a multiple of 2^32 */ +} + +/** + * \brief Update XORWOW state to skip \p n elements. + * + * Update the XORWOW state in \p state to skip ahead \p n elements. + * + * All values of \p n are valid. Large values require more computation and so + * will take more time to complete. + * + * \param n - Number of elements to skip + * \param state - Pointer to state to update + */ +QUALIFIERS void skipahead(unsigned long long n, curandStateXORWOW_t *state) +{ + _skipahead_inplace(n, state); +} + +/** + * \brief Update XORWOW state to skip ahead \p n subsequences. + * + * Update the XORWOW state in \p state to skip ahead \p n subsequences. Each + * subsequence is \xmlonly267\endxmlonly elements long, so this means the function will skip ahead + * \xmlonly267\endxmlonly * n elements. + * + * All values of \p n are valid. Large values require more computation and so + * will take more time to complete. + * + * \param n - Number of subsequences to skip + * \param state - Pointer to state to update + */ +QUALIFIERS void skipahead_sequence(unsigned long long n, curandStateXORWOW_t *state) +{ + _skipahead_sequence_inplace(n, state); +} + +QUALIFIERS void _curand_init_scratch(unsigned long long seed, + unsigned long long subsequence, + unsigned long long offset, + curandStateXORWOW_t *state, + unsigned int *scratch) +{ + // Break up seed, apply salt + // Constants are arbitrary nonzero values + unsigned int s0 = ((unsigned int)seed) ^ 0xaad26b49UL; + unsigned int s1 = (unsigned int)(seed >> 32) ^ 0xf7dcefddUL; + // Simple multiplication to mix up bits + // Constants are arbitrary odd values + unsigned int t0 = 1099087573UL * s0; + unsigned int t1 = 2591861531UL * s1; + state->d = 6615241 + t1 + t0; + state->v[0] = 123456789UL + t0; + state->v[1] = 362436069UL ^ t0; + state->v[2] = 521288629UL + t1; + state->v[3] = 88675123UL ^ t1; + state->v[4] = 5783321UL + t0; + _skipahead_sequence_scratch(subsequence, state, scratch); + _skipahead_scratch(offset, state, scratch); + state->boxmuller_flag = 0; + state->boxmuller_flag_double = 0; + state->boxmuller_extra = 0.f; + state->boxmuller_extra_double = 0.; +} + +QUALIFIERS void _curand_init_inplace(unsigned long long seed, + unsigned long long subsequence, + unsigned long long offset, + curandStateXORWOW_t *state) +{ + // Break up seed, apply salt + // Constants are arbitrary nonzero values + unsigned int s0 = ((unsigned int)seed) ^ 0xaad26b49UL; + unsigned int s1 = (unsigned int)(seed >> 32) ^ 0xf7dcefddUL; + // Simple multiplication to mix up bits + // Constants are arbitrary odd values + unsigned int t0 = 1099087573UL * s0; + unsigned int t1 = 2591861531UL * s1; + state->d = 6615241 + t1 + t0; + state->v[0] = 123456789UL + t0; + state->v[1] = 362436069UL ^ t0; + state->v[2] = 521288629UL + t1; + state->v[3] = 88675123UL ^ t1; + state->v[4] = 5783321UL + t0; + _skipahead_sequence_inplace(subsequence, state); + _skipahead_inplace(offset, state); + state->boxmuller_flag = 0; + state->boxmuller_flag_double = 0; + state->boxmuller_extra = 0.f; + state->boxmuller_extra_double = 0.; +} + +/** + * \brief Initialize XORWOW state. + * + * Initialize XORWOW state in \p state with the given \p seed, \p subsequence, + * and \p offset. + * + * All input values of \p seed, \p subsequence, and \p offset are legal. Large + * values for \p subsequence and \p offset require more computation and so will + * take more time to complete. + * + * A value of 0 for \p seed sets the state to the values of the original + * published version of the \p xorwow algorithm. + * + * \param seed - Arbitrary bits to use as a seed + * \param subsequence - Subsequence to start at + * \param offset - Absolute offset into sequence + * \param state - Pointer to state to initialize + */ +QUALIFIERS void curand_init(unsigned long long seed, + unsigned long long subsequence, + unsigned long long offset, + curandStateXORWOW_t *state) +{ + _curand_init_inplace(seed, subsequence, offset, state); +} + +/** + * \brief Return 32-bits of pseudorandomness from an XORWOW generator. + * + * Return 32-bits of pseudorandomness from the XORWOW generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * + * \return 32-bits of pseudorandomness as an unsigned int, all bits valid to use. + */ +QUALIFIERS unsigned int curand(curandStateXORWOW_t *state) +{ + unsigned int t; + t = (state->v[0] ^ (state->v[0] >> 2)); + state->v[0] = state->v[1]; + state->v[1] = state->v[2]; + state->v[2] = state->v[3]; + state->v[3] = state->v[4]; + state->v[4] = (state->v[4] ^ (state->v[4] <<4)) ^ (t ^ (t << 1)); + state->d += 362437; + return state->v[4] + state->d; +} + + +/** + * \brief Return 32-bits of pseudorandomness from an Philox4_32_10 generator. + * + * Return 32-bits of pseudorandomness from the Philox4_32_10 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * + * \return 32-bits of pseudorandomness as an unsigned int, all bits valid to use. + */ + +QUALIFIERS unsigned int curand(curandStatePhilox4_32_10_t *state) +{ + // Maintain the invariant: output[STATE] is always "good" and + // is the next value to be returned by curand. + unsigned int ret; + switch(state->STATE++){ + default: + ret = state->output.x; + break; + case 1: + ret = state->output.y; + break; + case 2: + ret = state->output.z; + break; + case 3: + ret = state->output.w; + break; + } + if(state->STATE == 4){ + Philox_State_Incr(state); + state->output = curand_Philox4x32_10(state->ctr,state->key); + state->STATE = 0; + } + return ret; +} + +/** + * \brief Return tuple of 4 32-bit pseudorandoms from a Philox4_32_10 generator. + * + * Return 128 bits of pseudorandomness from the Philox4_32_10 generator in \p state, + * increment position of generator by four. + * + * \param state - Pointer to state to update + * + * \return 128-bits of pseudorandomness as a uint4, all bits valid to use. + */ + +QUALIFIERS uint4 curand4(curandStatePhilox4_32_10_t *state) +{ + uint4 r; + + uint4 tmp = state->output; + Philox_State_Incr(state); + state->output= curand_Philox4x32_10(state->ctr,state->key); + switch(state->STATE){ + case 0: + return tmp; + case 1: + r.x = tmp.y; + r.y = tmp.z; + r.z = tmp.w; + r.w = state->output.x; + break; + case 2: + r.x = tmp.z; + r.y = tmp.w; + r.z = state->output.x; + r.w = state->output.y; + break; + case 3: + r.x = tmp.w; + r.y = state->output.x; + r.z = state->output.y; + r.w = state->output.z; + break; + default: + // NOT possible but needed to avoid compiler warnings + return tmp; + } + return r; +} + +/** + * \brief Update Philox4_32_10 state to skip \p n elements. + * + * Update the Philox4_32_10 state in \p state to skip ahead \p n elements. + * + * All values of \p n are valid. + * + * \param n - Number of elements to skip + * \param state - Pointer to state to update + */ +QUALIFIERS void skipahead(unsigned long long n, curandStatePhilox4_32_10_t *state) +{ + state->STATE += (n & 3); + n /= 4; + if( state->STATE > 3 ){ + n += 1; + state->STATE -= 4; + } + Philox_State_Incr(state, n); + state->output = curand_Philox4x32_10(state->ctr,state->key); +} + +/** + * \brief Update Philox4_32_10 state to skip ahead \p n subsequences. + * + * Update the Philox4_32_10 state in \p state to skip ahead \p n subsequences. Each + * subsequence is \xmlonly266\endxmlonly elements long, so this means the function will skip ahead + * \xmlonly266\endxmlonly * n elements. + * + * All values of \p n are valid. + * + * \param n - Number of subsequences to skip + * \param state - Pointer to state to update + */ +QUALIFIERS void skipahead_sequence(unsigned long long n, curandStatePhilox4_32_10_t *state) +{ + Philox_State_Incr_hi(state, n); + state->output = curand_Philox4x32_10(state->ctr,state->key); +} + +/** + * \brief Initialize Philox4_32_10 state. + * + * Initialize Philox4_32_10 state in \p state with the given \p seed, p\ subsequence, + * and \p offset. + * + * All input values for \p seed, \p subseqence and \p offset are legal. Each of the + * \xmlonly264\endxmlonly possible + * values of seed selects an independent sequence of length + * \xmlonly2130\endxmlonly. + * The first + * \xmlonly266 * subsequence + offset\endxmlonly. + * values of the sequence are skipped. + * I.e., subsequences are of length + * \xmlonly266\endxmlonly. + * + * \param seed - Arbitrary bits to use as a seed + * \param subsequence - Subsequence to start at + * \param offset - Absolute offset into subsequence + * \param state - Pointer to state to initialize + */ +QUALIFIERS void curand_init(unsigned long long seed, + unsigned long long subsequence, + unsigned long long offset, + curandStatePhilox4_32_10_t *state) +{ + state->ctr = make_uint4(0, 0, 0, 0); + state->key.x = (unsigned int)seed; + state->key.y = (unsigned int)(seed>>32); + state->STATE = 0; + state->boxmuller_flag = 0; + state->boxmuller_flag_double = 0; + state->boxmuller_extra = 0.f; + state->boxmuller_extra_double = 0.; + skipahead_sequence(subsequence, state); + skipahead(offset, state); +} + + +/* MRG32k3a RNG */ + +/* Base generator for MRG32k3a */ +QUALIFIERS unsigned long long __curand_umad(GCC_UNUSED_PARAMETER unsigned int a, GCC_UNUSED_PARAMETER unsigned int b, GCC_UNUSED_PARAMETER unsigned long long c) +{ + unsigned long long r = 0; +NV_IF_TARGET(NV_PROVIDES_SM_61, + asm("mad.wide.u32 %0, %1, %2, %3;" + : "=l"(r) : "r"(a), "r"(b), "l"(c)); +) + return r; +} +QUALIFIERS unsigned long long __curand_umul(GCC_UNUSED_PARAMETER unsigned int a, GCC_UNUSED_PARAMETER unsigned int b) +{ + unsigned long long r = 0; +NV_IF_TARGET(NV_PROVIDES_SM_61, + asm("mul.wide.u32 %0, %1, %2;" + : "=l"(r) : "r"(a), "r"(b)); +) + return r; +} +QUALIFIERS double curand_MRG32k3a (curandStateMRG32k3a_t *state) +{ +NV_IF_TARGET(NV_PROVIDES_SM_61, + const unsigned int m1 = 4294967087u; + const unsigned int m2 = 4294944443u; + const unsigned int m1c = 209u; + const unsigned int m2c = 22853u; + const unsigned int a12 = 1403580u; + const unsigned int a13n = 810728u; + const unsigned int a21 = 527612u; + const unsigned int a23n = 1370589u; + + unsigned long long p1; + unsigned long long p2; + const unsigned long long p3 = __curand_umul(a13n, m1 - state->s1[0]); + p1 = __curand_umad(a12, state->s1[1], p3); + + // Putting addition inside and changing umul to umad + // slowed this function down on GV100 + p1 = __curand_umul(p1 >> 32, m1c) + (p1 & 0xffffffff); + if (p1 >= m1) p1 -= m1; + + state->s1[0] = state->s1[1]; state->s1[1] = state->s1[2]; state->s1[2] = p1; + const unsigned long long p4 = __curand_umul(a23n, m2 - state->s2[0]); + p2 = __curand_umad(a21, state->s2[2], p4); + + // Putting addition inside and changing umul to umad + // slowed this function down on GV100 + p2 = __curand_umul(p2 >> 32, m2c) + (p2 & 0xffffffff); + p2 = __curand_umul(p2 >> 32, m2c) + (p2 & 0xffffffff); + if (p2 >= m2) p2 -= m2; + + state->s2[0] = state->s2[1]; state->s2[1] = state->s2[2]; state->s2[2] = p2; + + const unsigned int p5 = (unsigned int)p1 - (unsigned int)p2; + if(p1 <= p2) return p5 + m1; + return p5; +) +NV_IF_TARGET(NV_IS_DEVICE, +/* nj's implementation */ + const double m1 = 4294967087.; + const double m2 = 4294944443.; + const double a12 = 1403580.; + const double a13n = 810728.; + const double a21 = 527612.; + const double a23n = 1370589.; + + const double rh1 = 2.3283065498378290e-010; /* (1.0 / m1)__hi */ + const double rl1 = -1.7354913086174288e-026; /* (1.0 / m1)__lo */ + const double rh2 = 2.3283188252407387e-010; /* (1.0 / m2)__hi */ + const double rl2 = 2.4081018096503646e-026; /* (1.0 / m2)__lo */ + + double q; + double p1; + double p2; + p1 = a12 * state->s1[1] - a13n * state->s1[0]; + q = trunc (fma (p1, rh1, p1 * rl1)); + p1 -= q * m1; + if (p1 < 0.0) p1 += m1; + state->s1[0] = state->s1[1]; state->s1[1] = state->s1[2]; state->s1[2] = (unsigned int)p1; + p2 = a21 * state->s2[2] - a23n * state->s2[0]; + q = trunc (fma (p2, rh2, p2 * rl2)); + p2 -= q * m2; + if (p2 < 0.0) p2 += m2; + state->s2[0] = state->s2[1]; state->s2[1] = state->s2[2]; state->s2[2] = (unsigned int)p2; + if (p1 <= p2) return (p1 - p2 + m1); + else return (p1 - p2); +) +/* end nj's implementation */ + double p1; + double p2; + double r; + p1 = (MRG32K3A_A12 * state->s1[1]) - (MRG32K3A_A13N * state->s1[0]); + p1 = curand_MRGmod(p1, MRG32K3A_MOD1); + if (p1 < 0.0) p1 += MRG32K3A_MOD1; + state->s1[0] = state->s1[1]; + state->s1[1] = state->s1[2]; + state->s1[2] = (unsigned int)p1; + p2 = (MRG32K3A_A21 * state->s2[2]) - (MRG32K3A_A23N * state->s2[0]); + p2 = curand_MRGmod(p2, MRG32K3A_MOD2); + if (p2 < 0) p2 += MRG32K3A_MOD2; + state->s2[0] = state->s2[1]; + state->s2[1] = state->s2[2]; + state->s2[2] = (unsigned int)p2; + r = p1 - p2; + if (r <= 0) r += MRG32K3A_MOD1; + return r; +} + + +/** + * \brief Return 32-bits of pseudorandomness from an MRG32k3a generator. + * + * Return 32-bits of pseudorandomness from the MRG32k3a generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * + * \return 32-bits of pseudorandomness as an unsigned int, all bits valid to use. + */ +QUALIFIERS unsigned int curand(curandStateMRG32k3a_t *state) +{ + double dRet; + dRet = (double)curand_MRG32k3a(state)*(double)MRG32K3A_BITS_NORM; + return (unsigned int)dRet; +} + + + +/** + * \brief Update MRG32k3a state to skip \p n elements. + * + * Update the MRG32k3a state in \p state to skip ahead \p n elements. + * + * All values of \p n are valid. Large values require more computation and so + * will take more time to complete. + * + * \param n - Number of elements to skip + * \param state - Pointer to state to update + */ +QUALIFIERS void skipahead(unsigned long long n, curandStateMRG32k3a_t *state) +{ + unsigned int t[3][3]; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + curand_MRGmatPow3x3( mrg32k3aM1, t, MRG32K3A_MOD1, n); + curand_MRGmatVecMul3x3( t, state->s1, MRG32K3A_MOD1); + curand_MRGmatPow3x3(mrg32k3aM2, t, MRG32K3A_MOD2, n); + curand_MRGmatVecMul3x3( t, state->s2, MRG32K3A_MOD2); +, + curand_MRGmatPow3x3( mrg32k3aM1Host, t, MRG32K3A_MOD1, n); + curand_MRGmatVecMul3x3( t, state->s1, MRG32K3A_MOD1); + curand_MRGmatPow3x3(mrg32k3aM2Host, t, MRG32K3A_MOD2, n); + curand_MRGmatVecMul3x3( t, state->s2, MRG32K3A_MOD2); +) +} + +/** + * \brief Update MRG32k3a state to skip ahead \p n subsequences. + * + * Update the MRG32k3a state in \p state to skip ahead \p n subsequences. Each + * subsequence is \xmlonly2127\endxmlonly + * + * \xmlonly276\endxmlonly elements long, so this means the function will skip ahead + * \xmlonly267\endxmlonly * n elements. + * + * Valid values of \p n are 0 to \xmlonly251\endxmlonly. Note \p n will be masked to 51 bits + * + * \param n - Number of subsequences to skip + * \param state - Pointer to state to update + */ +QUALIFIERS void skipahead_subsequence(unsigned long long n, curandStateMRG32k3a_t *state) +{ + unsigned int t[3][3]; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + curand_MRGmatPow3x3( mrg32k3aM1SubSeq, t, MRG32K3A_MOD1, n); + curand_MRGmatVecMul3x3( t, state->s1, MRG32K3A_MOD1); + curand_MRGmatPow3x3( mrg32k3aM2SubSeq, t, MRG32K3A_MOD2, n); + curand_MRGmatVecMul3x3( t, state->s2, MRG32K3A_MOD2); +, + curand_MRGmatPow3x3( mrg32k3aM1SubSeqHost, t, MRG32K3A_MOD1, n); + curand_MRGmatVecMul3x3( t, state->s1, MRG32K3A_MOD1); + curand_MRGmatPow3x3( mrg32k3aM2SubSeqHost, t, MRG32K3A_MOD2, n); + curand_MRGmatVecMul3x3( t, state->s2, MRG32K3A_MOD2); +) +} + +/** + * \brief Update MRG32k3a state to skip ahead \p n sequences. + * + * Update the MRG32k3a state in \p state to skip ahead \p n sequences. Each + * sequence is \xmlonly2127\endxmlonly elements long, so this means the function will skip ahead + * \xmlonly2127\endxmlonly * n elements. + * + * All values of \p n are valid. Large values require more computation and so + * will take more time to complete. + * + * \param n - Number of sequences to skip + * \param state - Pointer to state to update + */ +QUALIFIERS void skipahead_sequence(unsigned long long n, curandStateMRG32k3a_t *state) +{ + unsigned int t[3][3]; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + curand_MRGmatPow3x3( mrg32k3aM1Seq, t, MRG32K3A_MOD1, n); + curand_MRGmatVecMul3x3( t, state->s1, MRG32K3A_MOD1); + curand_MRGmatPow3x3( mrg32k3aM2Seq, t, MRG32K3A_MOD2, n); + curand_MRGmatVecMul3x3( t, state->s2, MRG32K3A_MOD2); +, + curand_MRGmatPow3x3( mrg32k3aM1SeqHost, t, MRG32K3A_MOD1, n); + curand_MRGmatVecMul3x3( t, state->s1, MRG32K3A_MOD1); + curand_MRGmatPow3x3( mrg32k3aM2SeqHost, t, MRG32K3A_MOD2, n); + curand_MRGmatVecMul3x3( t, state->s2, MRG32K3A_MOD2); +) +} + + +/** + * \brief Initialize MRG32k3a state. + * + * Initialize MRG32k3a state in \p state with the given \p seed, \p subsequence, + * and \p offset. + * + * All input values of \p seed, \p subsequence, and \p offset are legal. + * \p subsequence will be truncated to 51 bits to avoid running into the next sequence + * + * A value of 0 for \p seed sets the state to the values of the original + * published version of the \p MRG32k3a algorithm. + * + * \param seed - Arbitrary bits to use as a seed + * \param subsequence - Subsequence to start at + * \param offset - Absolute offset into sequence + * \param state - Pointer to state to initialize + */ +QUALIFIERS void curand_init(unsigned long long seed, + unsigned long long subsequence, + unsigned long long offset, + curandStateMRG32k3a_t *state) +{ + int i; + for ( i=0; i<3; i++ ) { + state->s1[i] = 12345u; + state->s2[i] = 12345u; + } + if (seed != 0ull) { + unsigned int x1 = ((unsigned int)seed) ^ 0x55555555UL; + unsigned int x2 = (unsigned int)((seed >> 32) ^ 0xAAAAAAAAUL); + state->s1[0] = (unsigned int)curand_MRGmodMul(x1, state->s1[0], MRG32K3A_MOD1); + state->s1[1] = (unsigned int)curand_MRGmodMul(x2, state->s1[1], MRG32K3A_MOD1); + state->s1[2] = (unsigned int)curand_MRGmodMul(x1, state->s1[2], MRG32K3A_MOD1); + state->s2[0] = (unsigned int)curand_MRGmodMul(x2, state->s2[0], MRG32K3A_MOD2); + state->s2[1] = (unsigned int)curand_MRGmodMul(x1, state->s2[1], MRG32K3A_MOD2); + state->s2[2] = (unsigned int)curand_MRGmodMul(x2, state->s2[2], MRG32K3A_MOD2); + } + skipahead_subsequence( subsequence, state ); + skipahead( offset, state ); + state->boxmuller_flag = 0; + state->boxmuller_flag_double = 0; + state->boxmuller_extra = 0.f; + state->boxmuller_extra_double = 0.; +} + +/** + * \brief Update Sobol32 state to skip \p n elements. + * + * Update the Sobol32 state in \p state to skip ahead \p n elements. + * + * All values of \p n are valid. + * + * \param n - Number of elements to skip + * \param state - Pointer to state to update + */ +template +QUALIFIERS +typename CURAND_STD::enable_if::value || CURAND_STD::is_same::value>::type +skipahead(unsigned int n, T state) +{ + unsigned int i_gray; + state->x = state->c; + state->i += n; + /* Convert state->i to gray code */ + i_gray = state->i ^ (state->i >> 1); + for(unsigned int k = 0; k < 32; k++) { + if(i_gray & (1 << k)) { + state->x ^= state->direction_vectors[k]; + } + } + return; +} + +/** + * \brief Update Sobol64 state to skip \p n elements. + * + * Update the Sobol64 state in \p state to skip ahead \p n elements. + * + * All values of \p n are valid. + * + * \param n - Number of elements to skip + * \param state - Pointer to state to update + */ +template +QUALIFIERS +typename CURAND_STD::enable_if::value || CURAND_STD::is_same::value>::type +skipahead(unsigned long long n, T state) +{ + unsigned long long i_gray; + state->x = state->c; + state->i += n; + /* Convert state->i to gray code */ + i_gray = state->i ^ (state->i >> 1); + for(unsigned k = 0; k < 64; k++) { + if(i_gray & (1ULL << k)) { + state->x ^= state->direction_vectors[k]; + } + } + return; +} + +/** + * \brief Initialize Sobol32 state. + * + * Initialize Sobol32 state in \p state with the given \p direction \p vectors and + * \p offset. + * + * The direction vector is a device pointer to an array of 32 unsigned ints. + * All input values of \p offset are legal. + * + * \param direction_vectors - Pointer to array of 32 unsigned ints representing the + * direction vectors for the desired dimension + * \param offset - Absolute offset into sequence + * \param state - Pointer to state to initialize + */ +QUALIFIERS void curand_init(curandDirectionVectors32_t direction_vectors, + unsigned int offset, + curandStateSobol32_t *state) +{ + state->i = 0; + state->c = 0; + for(int i = 0; i < 32; i++) { + state->direction_vectors[i] = direction_vectors[i]; + } + state->x = 0; + skipahead(offset, state); +} +/** + * \brief Initialize Scrambled Sobol32 state. + * + * Initialize Sobol32 state in \p state with the given \p direction \p vectors and + * \p offset. + * + * The direction vector is a device pointer to an array of 32 unsigned ints. + * All input values of \p offset are legal. + * + * \param direction_vectors - Pointer to array of 32 unsigned ints representing the + direction vectors for the desired dimension + * \param scramble_c Scramble constant + * \param offset - Absolute offset into sequence + * \param state - Pointer to state to initialize + */ +QUALIFIERS void curand_init(curandDirectionVectors32_t direction_vectors, + unsigned int scramble_c, + unsigned int offset, + curandStateScrambledSobol32_t *state) +{ + state->i = 0; + state->c = scramble_c; + for(int i = 0; i < 32; i++) { + state->direction_vectors[i] = direction_vectors[i]; + } + state->x = state->c; + skipahead(offset, state); +} + +QUALIFIERS int __curand_find_trailing_zero(unsigned int x) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + int y = __ffs(~x); + if(y) + return y - 1; + return 31; +, + int i = 1; + while(x & 1) { + i++; + x >>= 1; + } + i = i - 1; + return i == 32 ? 31 : i; +) +} + +QUALIFIERS int __curand_find_trailing_zero(unsigned long long x) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + int y = __ffsll(~x); + if(y) + return y - 1; + return 63; +, + int i = 1; + while(x & 1) { + i++; + x >>= 1; + } + i = i - 1; + return i == 64 ? 63 : i; +) +} + +/** + * \brief Initialize Sobol64 state. + * + * Initialize Sobol64 state in \p state with the given \p direction \p vectors and + * \p offset. + * + * The direction vector is a device pointer to an array of 64 unsigned long longs. + * All input values of \p offset are legal. + * + * \param direction_vectors - Pointer to array of 64 unsigned long longs representing the + direction vectors for the desired dimension + * \param offset - Absolute offset into sequence + * \param state - Pointer to state to initialize + */ +QUALIFIERS void curand_init(curandDirectionVectors64_t direction_vectors, + unsigned long long offset, + curandStateSobol64_t *state) +{ + state->i = 0; + state->c = 0; + for(int i = 0; i < 64; i++) { + state->direction_vectors[i] = direction_vectors[i]; + } + state->x = 0; + skipahead(offset, state); +} + +/** + * \brief Initialize Scrambled Sobol64 state. + * + * Initialize Sobol64 state in \p state with the given \p direction \p vectors and + * \p offset. + * + * The direction vector is a device pointer to an array of 64 unsigned long longs. + * All input values of \p offset are legal. + * + * \param direction_vectors - Pointer to array of 64 unsigned long longs representing the + direction vectors for the desired dimension + * \param scramble_c Scramble constant + * \param offset - Absolute offset into sequence + * \param state - Pointer to state to initialize + */ +QUALIFIERS void curand_init(curandDirectionVectors64_t direction_vectors, + unsigned long long scramble_c, + unsigned long long offset, + curandStateScrambledSobol64_t *state) +{ + state->i = 0; + state->c = scramble_c; + for(int i = 0; i < 64; i++) { + state->direction_vectors[i] = direction_vectors[i]; + } + state->x = state->c; + skipahead(offset, state); +} + +/** + * \brief Return 32-bits of quasirandomness from a Sobol32 generator. + * + * Return 32-bits of quasirandomness from the Sobol32 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * + * \return 32-bits of quasirandomness as an unsigned int, all bits valid to use. + */ + +QUALIFIERS unsigned int curand(curandStateSobol32_t * state) +{ + /* Moving from i to i+1 element in gray code is flipping one bit, + the trailing zero bit of i + */ + unsigned int res = state->x; + state->x ^= state->direction_vectors[__curand_find_trailing_zero(state->i)]; + state->i ++; + return res; +} + +/** + * \brief Return 32-bits of quasirandomness from a scrambled Sobol32 generator. + * + * Return 32-bits of quasirandomness from the scrambled Sobol32 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * + * \return 32-bits of quasirandomness as an unsigned int, all bits valid to use. + */ + +QUALIFIERS unsigned int curand(curandStateScrambledSobol32_t * state) +{ + /* Moving from i to i+1 element in gray code is flipping one bit, + the trailing zero bit of i + */ + unsigned int res = state->x; + state->x ^= state->direction_vectors[__curand_find_trailing_zero(state->i)]; + state->i ++; + return res; +} + +/** + * \brief Return 64-bits of quasirandomness from a Sobol64 generator. + * + * Return 64-bits of quasirandomness from the Sobol64 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * + * \return 64-bits of quasirandomness as an unsigned long long, all bits valid to use. + */ + +QUALIFIERS unsigned long long curand(curandStateSobol64_t * state) +{ + /* Moving from i to i+1 element in gray code is flipping one bit, + the trailing zero bit of i + */ + unsigned long long res = state->x; + state->x ^= state->direction_vectors[__curand_find_trailing_zero(state->i)]; + state->i ++; + return res; +} + +/** + * \brief Return 64-bits of quasirandomness from a scrambled Sobol64 generator. + * + * Return 64-bits of quasirandomness from the scrambled Sobol32 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * + * \return 64-bits of quasirandomness as an unsigned long long, all bits valid to use. + */ + +QUALIFIERS unsigned long long curand(curandStateScrambledSobol64_t * state) +{ + /* Moving from i to i+1 element in gray code is flipping one bit, + the trailing zero bit of i + */ + unsigned long long res = state->x; + state->x ^= state->direction_vectors[__curand_find_trailing_zero(state->i)]; + state->i ++; + return res; +} + +#include "curand_uniform.h" +#include "curand_normal.h" +#include "curand_lognormal.h" +#include "curand_poisson.h" +#include "curand_discrete2.h" + +__device__ static inline unsigned int *__get_precalculated_matrix(int n) +{ + if(n == 0) { + return precalc_xorwow_matrix[n]; + } + if(n == 2) { + return precalc_xorwow_offset_matrix[n]; + } + return precalc_xorwow_matrix[n]; +} + +#ifndef __CUDACC_RTC__ +__host__ static inline unsigned int *__get_precalculated_matrix_host(int n) +{ + if(n == 1) { + return precalc_xorwow_matrix_host[n]; + } + if(n == 3) { + return precalc_xorwow_offset_matrix_host[n]; + } + return precalc_xorwow_matrix_host[n]; +} +#endif // #ifndef __CUDACC_RTC__ + +__device__ static inline unsigned int *__get_mrg32k3a_matrix(int n) +{ + if(n == 0) { + return mrg32k3aM1[n][0]; + } + if(n == 2) { + return mrg32k3aM2[n][0]; + } + if(n == 4) { + return mrg32k3aM1SubSeq[n][0]; + } + if(n == 6) { + return mrg32k3aM2SubSeq[n][0]; + } + if(n == 8) { + return mrg32k3aM1Seq[n][0]; + } + if(n == 10) { + return mrg32k3aM2Seq[n][0]; + } + return mrg32k3aM1[n][0]; +} + +#ifndef __CUDACC_RTC__ +__host__ static inline unsigned int *__get_mrg32k3a_matrix_host(int n) +{ + if(n == 1) { + return mrg32k3aM1Host[n][0]; + } + if(n == 3) { + return mrg32k3aM2Host[n][0]; + } + if(n == 5) { + return mrg32k3aM1SubSeqHost[n][0]; + } + if(n == 7) { + return mrg32k3aM2SubSeqHost[n][0]; + } + if(n == 9) { + return mrg32k3aM1SeqHost[n][0]; + } + if(n == 11) { + return mrg32k3aM2SeqHost[n][0]; + } + return mrg32k3aM1Host[n][0]; +} + +__host__ static inline double *__get__cr_lgamma_table_host(void) { + return __cr_lgamma_table; +} +#endif // #ifndef __CUDACC_RTC__ + +/** @} */ + +#endif // !defined(CURAND_KERNEL_H_) diff --git a/cuda_toolkit/include/curand_lognormal.h b/cuda_toolkit/include/curand_lognormal.h new file mode 100644 index 0000000000000000000000000000000000000000..4ad116c2a90f19ae9b66f7a2f2efb33faedb8008 --- /dev/null +++ b/cuda_toolkit/include/curand_lognormal.h @@ -0,0 +1,697 @@ + + /* Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + + +#if !defined(CURAND_LOGNORMAL_H_) +#define CURAND_LOGNORMAL_H_ + +/** + * \defgroup DEVICE Device API + * + * @{ + */ + +#ifndef __CUDACC_RTC__ +#include +#endif // __CUDACC_RTC__ + +#include "curand_mrg32k3a.h" +#include "curand_mtgp32_kernel.h" +#include "curand_philox4x32_x.h" + +/** + * \brief Return a log-normally distributed float from an XORWOW generator. + * + * Return a single log-normally distributed float derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the XORWOW generator in \p state, + * increment position of generator by one. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, transforms them to log-normal distribution, + * then returns them one at a time. + * See ::curand_log_normal2() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float curand_log_normal(curandStateXORWOW_t *state, float mean, float stddev) +{ + if(state->boxmuller_flag != EXTRA_FLAG_LOG_NORMAL) { + unsigned int x, y; + x = curand(state); + y = curand(state); + float2 v = _curand_box_muller(x, y); + state->boxmuller_extra = expf(mean + (stddev * v.y)); + state->boxmuller_flag = EXTRA_FLAG_LOG_NORMAL; + return expf(mean + (stddev * v.x)); + } + state->boxmuller_flag = 0; + return state->boxmuller_extra; +} + +/** + * \brief Return a log-normally distributed float from an Philox4_32_10 generator. + * + * Return a single log-normally distributed float derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the Philox4_32_10 generator in \p state, + * increment position of generator by one. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, transforms them to log-normal distribution, + * then returns them one at a time. + * See ::curand_log_normal2() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float with mean \p mean and standard deviation \p stddev + */ + +QUALIFIERS float curand_log_normal(curandStatePhilox4_32_10_t *state, float mean, float stddev) +{ + if(state->boxmuller_flag != EXTRA_FLAG_LOG_NORMAL) { + unsigned int x, y; + x = curand(state); + y = curand(state); + float2 v = _curand_box_muller(x, y); + state->boxmuller_extra = expf(mean + (stddev * v.y)); + state->boxmuller_flag = EXTRA_FLAG_LOG_NORMAL; + return expf(mean + (stddev * v.x)); + } + state->boxmuller_flag = 0; + return state->boxmuller_extra; +} + +/** + * \brief Return two normally distributed floats from an XORWOW generator. + * + * Return two log-normally distributed floats derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the XORWOW generator in \p state, + * increment position of generator by two. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, then transforms them to log-normal. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float2 where each element is from a + * distribution with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float2 curand_log_normal2(curandStateXORWOW_t *state, float mean, float stddev) +{ + float2 v = curand_box_muller(state); + v.x = expf(mean + (stddev * v.x)); + v.y = expf(mean + (stddev * v.y)); + return v; +} + +/** + * \brief Return two normally distributed floats from an Philox4_32_10 generator. + * + * Return two log-normally distributed floats derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the Philox4_32_10 generator in \p state, + * increment position of generator by two. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, then transforms them to log-normal. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float2 where each element is from a + * distribution with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float2 curand_log_normal2(curandStatePhilox4_32_10_t *state, float mean, float stddev) +{ + float2 v = curand_box_muller(state); + v.x = expf(mean + (stddev * v.x)); + v.y = expf(mean + (stddev * v.y)); + return v; +} +/** + * \brief Return four normally distributed floats from an Philox4_32_10 generator. + * + * Return four log-normally distributed floats derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the Philox4_32_10 generator in \p state, + * increment position of generator by four. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, then transforms them to log-normal. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float4 where each element is from a + * distribution with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float4 curand_log_normal4(curandStatePhilox4_32_10_t *state, float mean, float stddev) +{ + float4 v = curand_box_muller4(state); + v.x = expf(mean + (stddev * v.x)); + v.y = expf(mean + (stddev * v.y)); + v.z = expf(mean + (stddev * v.z)); + v.w = expf(mean + (stddev * v.w)); + return v; +} + +/** + * \brief Return a log-normally distributed float from an MRG32k3a generator. + * + * Return a single log-normally distributed float derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the MRG32k3a generator in \p state, + * increment position of generator by one. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, transforms them to log-normal distribution, + * then returns them one at a time. + * See ::curand_log_normal2() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float curand_log_normal(curandStateMRG32k3a_t *state, float mean, float stddev) +{ + if(state->boxmuller_flag != EXTRA_FLAG_LOG_NORMAL) { + float2 v = curand_box_muller_mrg(state); + state->boxmuller_extra = expf(mean + (stddev * v.y)); + state->boxmuller_flag = EXTRA_FLAG_LOG_NORMAL; + return expf(mean + (stddev * v.x)); + } + state->boxmuller_flag = 0; + return state->boxmuller_extra; +} + +/** + * \brief Return two normally distributed floats from an MRG32k3a generator. + * + * Return two log-normally distributed floats derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the MRG32k3a generator in \p state, + * increment position of generator by two. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, then transforms them to log-normal. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float2 where each element is from a + * distribution with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float2 curand_log_normal2(curandStateMRG32k3a_t *state, float mean, float stddev) +{ + float2 v = curand_box_muller_mrg(state); + v.x = expf(mean + (stddev * v.x)); + v.y = expf(mean + (stddev * v.y)); + return v; +} + +/** + * \brief Return a log-normally distributed float from an MTGP32 generator. + * + * Return a single log-normally distributed float derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the MTGP32 generator in \p state, + * increment position of generator. + * + * The implementation uses the inverse cumulative distribution function + * to generate a normally distributed result, then transforms the result + * to log-normal. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float curand_log_normal(curandStateMtgp32_t *state, float mean, float stddev) +{ + return expf(mean + (stddev * _curand_normal_icdf(curand(state)))); +} + +/** + * \brief Return a log-normally distributed float from a Sobol32 generator. + * + * Return a single log-normally distributed float derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the Sobol32 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate a normally distributed result, then transforms the result + * to log-normal. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float curand_log_normal(curandStateSobol32_t *state, float mean, float stddev) +{ + return expf(mean + (stddev * _curand_normal_icdf(curand(state)))); +} +/** + * \brief Return a log-normally distributed float from a scrambled Sobol32 generator. + * + * Return a single log-normally distributed float derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the scrambled Sobol32 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate a normally distributed result, then transforms the result + * to log-normal. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float curand_log_normal(curandStateScrambledSobol32_t *state, float mean, float stddev) +{ + return expf(mean + (stddev * _curand_normal_icdf(curand(state)))); +} + +/** + * \brief Return a log-normally distributed float from a Sobol64 generator. + * + * Return a single log-normally distributed float derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the Sobol64 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results, then converts to log-normal + * distribution. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float curand_log_normal(curandStateSobol64_t *state, float mean, float stddev) +{ + return expf(mean + (stddev * _curand_normal_icdf(curand(state)))); +} + +/** + * \brief Return a log-normally distributed float from a scrambled Sobol64 generator. + * + * Return a single log-normally distributed float derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the scrambled Sobol64 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results, then converts to log-normal + * distribution. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed float with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS float curand_log_normal(curandStateScrambledSobol64_t *state, float mean, float stddev) +{ + return expf(mean + (stddev * _curand_normal_icdf(curand(state)))); +} + +/** + * \brief Return a log-normally distributed double from an XORWOW generator. + * + * Return a single normally distributed double derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the XORWOW generator in \p state, + * increment position of generator. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, transforms them to log-normal distribution, + * then returns them one at a time. + * See ::curand_log_normal2_double() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double with mean \p mean and standard deviation \p stddev + */ + +QUALIFIERS double curand_log_normal_double(curandStateXORWOW_t *state, double mean, double stddev) +{ + if(state->boxmuller_flag_double != EXTRA_FLAG_LOG_NORMAL) { + unsigned int x0, x1, y0, y1; + x0 = curand(state); + x1 = curand(state); + y0 = curand(state); + y1 = curand(state); + double2 v = _curand_box_muller_double(x0, x1, y0, y1); + state->boxmuller_extra_double = exp(mean + (stddev * v.y)); + state->boxmuller_flag_double = EXTRA_FLAG_LOG_NORMAL; + return exp(mean + (stddev * v.x)); + } + state->boxmuller_flag_double = 0; + return state->boxmuller_extra_double; +} + +/** + * \brief Return a log-normally distributed double from an Philox4_32_10 generator. + * + * Return a single normally distributed double derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the Philox4_32_10 generator in \p state, + * increment position of generator. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, transforms them to log-normal distribution, + * then returns them one at a time. + * See ::curand_log_normal2_double() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double with mean \p mean and standard deviation \p stddev + */ + +QUALIFIERS double curand_log_normal_double(curandStatePhilox4_32_10_t *state, double mean, double stddev) +{ + if(state->boxmuller_flag_double != EXTRA_FLAG_LOG_NORMAL) { + uint4 _x; + _x = curand4(state); + double2 v = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w); + state->boxmuller_extra_double = exp(mean + (stddev * v.y)); + state->boxmuller_flag_double = EXTRA_FLAG_LOG_NORMAL; + return exp(mean + (stddev * v.x)); + } + state->boxmuller_flag_double = 0; + return state->boxmuller_extra_double; +} + + +/** + * \brief Return two log-normally distributed doubles from an XORWOW generator. + * + * Return two log-normally distributed doubles derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the XORWOW generator in \p state, + * increment position of generator by two. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, and transforms them to log-normal distribution,. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double2 where each element is from a + * distribution with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS double2 curand_log_normal2_double(curandStateXORWOW_t *state, double mean, double stddev) +{ + double2 v = curand_box_muller_double(state); + v.x = exp(mean + (stddev * v.x)); + v.y = exp(mean + (stddev * v.y)); + return v; +} + +/** + * \brief Return two log-normally distributed doubles from an Philox4_32_10 generator. + * + * Return two log-normally distributed doubles derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the Philox4_32_10 generator in \p state, + * increment position of generator by four. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, and transforms them to log-normal distribution,. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double4 where each element is from a + * distribution with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS double2 curand_log_normal2_double(curandStatePhilox4_32_10_t *state, double mean, double stddev) +{ + double2 v = curand_box_muller2_double(state); + v.x = exp(mean + (stddev * v.x)); + v.y = exp(mean + (stddev * v.y)); + return v; +} +// nor part of API +QUALIFIERS double4 curand_log_normal4_double(curandStatePhilox4_32_10_t *state, double mean, double stddev) +{ + double4 v = curand_box_muller4_double(state); + v.x = exp(mean + (stddev * v.x)); + v.y = exp(mean + (stddev * v.y)); + v.z = exp(mean + (stddev * v.z)); + v.w = exp(mean + (stddev * v.w)); + return v; +} + +/** + * \brief Return a log-normally distributed double from an MRG32k3a generator. + * + * Return a single normally distributed double derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the MRG32k3a generator in \p state, + * increment position of generator. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, transforms them to log-normal distribution, + * then returns them one at a time. + * See ::curand_log_normal2_double() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS double curand_log_normal_double(curandStateMRG32k3a_t *state, double mean, double stddev) +{ + if(state->boxmuller_flag_double != EXTRA_FLAG_LOG_NORMAL) { + double2 v = curand_box_muller_mrg_double(state); + state->boxmuller_extra_double = exp(mean + (stddev * v.y)); + state->boxmuller_flag_double = EXTRA_FLAG_LOG_NORMAL; + return exp(mean + (stddev * v.x)); + } + state->boxmuller_flag_double = 0; + return state->boxmuller_extra_double; +} + +/** + * \brief Return two log-normally distributed doubles from an MRG32k3a generator. + * + * Return two log-normally distributed doubles derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the MRG32k3a generator in \p state, + * increment position of generator by two. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, and transforms them to log-normal distribution,. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double2 where each element is from a + * distribution with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS double2 curand_log_normal2_double(curandStateMRG32k3a_t *state, double mean, double stddev) +{ + double2 v = curand_box_muller_mrg_double(state); + v.x = exp(mean + (stddev * v.x)); + v.y = exp(mean + (stddev * v.y)); + return v; +} + +/** + * \brief Return a log-normally distributed double from an MTGP32 generator. + * + * Return a single log-normally distributed double derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the MTGP32 generator in \p state, + * increment position of generator. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results, and transforms them into + * log-normal distribution. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS double curand_log_normal_double(curandStateMtgp32_t *state, double mean, double stddev) +{ + return exp(mean + (stddev * _curand_normal_icdf_double(curand(state)))); +} + +/** + * \brief Return a log-normally distributed double from a Sobol32 generator. + * + * Return a single log-normally distributed double derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the Sobol32 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results, and transforms them into + * log-normal distribution. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS double curand_log_normal_double(curandStateSobol32_t *state, double mean, double stddev) +{ + return exp(mean + (stddev * _curand_normal_icdf_double(curand(state)))); +} + +/** + * \brief Return a log-normally distributed double from a scrambled Sobol32 generator. + * + * Return a single log-normally distributed double derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the scrambled Sobol32 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results, and transforms them into + * log-normal distribution. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS double curand_log_normal_double(curandStateScrambledSobol32_t *state, double mean, double stddev) +{ + return exp(mean + (stddev * _curand_normal_icdf_double(curand(state)))); +} + +/** + * \brief Return a log-normally distributed double from a Sobol64 generator. + * + * Return a single normally distributed double derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the Sobol64 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS double curand_log_normal_double(curandStateSobol64_t *state, double mean, double stddev) +{ + return exp(mean + (stddev * _curand_normal_icdf_double(curand(state)))); +} + +/** + * \brief Return a log-normally distributed double from a scrambled Sobol64 generator. + * + * Return a single normally distributed double derived from a normal + * distribution with mean \p mean and standard deviation \p stddev + * from the scrambled Sobol64 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * \param mean - Mean of the related normal distribution + * \param stddev - Standard deviation of the related normal distribution + * + * \return Log-normally distributed double with mean \p mean and standard deviation \p stddev + */ +QUALIFIERS double curand_log_normal_double(curandStateScrambledSobol64_t *state, double mean, double stddev) +{ + return exp(mean + (stddev * _curand_normal_icdf_double(curand(state)))); +} + +#endif // !defined(CURAND_LOGNORMAL_H_) diff --git a/cuda_toolkit/include/curand_mrg32k3a.h b/cuda_toolkit/include/curand_mrg32k3a.h new file mode 100644 index 0000000000000000000000000000000000000000..5566d695fd6fbbd98de8c170ccbeec064a72aebf --- /dev/null +++ b/cuda_toolkit/include/curand_mrg32k3a.h @@ -0,0 +1,3721 @@ +/* + * Copyright 2010-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ +#if !defined(CURAND_MRG32K3A_MATRICES_H_) +#define CURAND_MRG32K3A_MATRICES_H_ + +#if defined(__CUDACC_RDC__) && (__cplusplus >= 201703L) && defined(__cpp_inline_variables) +#define CURAND_MRG32K3A_MATRICES_DEVICE_QUALIFIERS inline __device__ +#else +#define CURAND_MRG32K3A_MATRICES_DEVICE_QUALIFIERS static __device__ +#endif + +#if (__cplusplus >= 201703L) && defined(__cpp_inline_variables) +#define CURAND_MRG32K3A_MATRICES_HOST_QUALIFIERS inline +#else +#define CURAND_MRG32K3A_MATRICES_HOST_QUALIFIERS static +#endif + + /* base matrices */ + + /* these are not actually used in the runtime code. They are */ + /* used in computing the skipahead matrices, and are included */ + /* for reference */ + /* + double M1[3][3] = { 0., 1., 0., + 0., 0., 1., + -810728., 1403580., 0. }; + + double M2[3][3] = { 0., 1., 0., + 0., 0., 1., + -1370589., 0., 527612. }; + + */ + + /* Base matrices to power 2 to the power n, n the first array index, from 0..63 */ +CURAND_MRG32K3A_MATRICES_DEVICE_QUALIFIERS unsigned int mrg32k3aM1[64][3][3] = { + { + { 0u, 1u, 0u }, + { 0u, 0u, 1u }, + { 4294156359u, 1403580u, 0u } + }, + { + { 0u, 0u, 1u }, + { 4294156359u, 1403580u, 0u }, + { 0u, 4294156359u, 1403580u } + }, + { + { 0u, 4294156359u, 1403580u }, + { 244671815u, 2941890554u, 4294156359u }, + { 149925673u, 489343630u, 2941890554u } + }, + { + { 1527363550u, 2758233149u, 1831234280u }, + { 4072640363u, 939574583u, 2758233149u }, + { 2064391165u, 3228066636u, 939574583u } + }, + { + { 736416029u, 2961816100u, 342112271u }, + { 387300998u, 1062452522u, 2961816100u }, + { 2955879160u, 340793741u, 1062452522u } + }, + { + { 1243502014u, 2218748291u, 1709215645u }, + { 2019641772u, 3847560959u, 2218748291u }, + { 3866010231u, 2305448679u, 3847560959u } + }, + { + { 3241775219u, 3453352062u, 3721871040u }, + { 4062454730u, 3015754u, 3453352062u }, + { 919711945u, 613405362u, 3015754u } + }, + { + { 1955221006u, 1414472808u, 1746037714u }, + { 3653507277u, 1644962013u, 1414472808u }, + { 3501544776u, 2336229602u, 1644962013u } + }, + { + { 1170096663u, 49135452u, 3441537107u }, + { 1857945175u, 1649398389u, 49135452u }, + { 333002869u, 3109147376u, 1649398389u } + }, + { + { 2299034194u, 2297111910u, 862649200u }, + { 1399961132u, 996706937u, 2297111910u }, + { 3439056503u, 1481993076u, 996706937u } + }, + { + { 4146310528u, 458782589u, 1007330283u }, + { 4241015765u, 3979619964u, 458782589u }, + { 553886495u, 2186897562u, 3979619964u } + }, + { + { 3630027893u, 2130448350u, 292773857u }, + { 1392525159u, 1299285967u, 2130448350u }, + { 2589171163u, 1217405758u, 1299285967u } + }, + { + { 892409263u, 1999175811u, 2979225418u }, + { 1996163538u, 2148702503u, 1999175811u }, + { 3922720782u, 103819730u, 2148702503u } + }, + { + { 1586003016u, 2114210471u, 3240775579u }, + { 2777288607u, 1400478398u, 2114210471u }, + { 3018215420u, 535326008u, 1400478398u } + }, + { + { 2188531273u, 1783231160u, 3576659343u }, + { 1908318389u, 379210133u, 1783231160u }, + { 554369329u, 250053591u, 379210133u } + }, + { + { 4022841636u, 3951951872u, 2143424240u }, + { 1046219306u, 1591992468u, 3951951872u }, + { 1510277444u, 381333958u, 1591992468u } + }, + { + { 2256493727u, 3715182130u, 642697923u }, + { 3615342722u, 3975008370u, 3715182130u }, + { 2405650329u, 754337639u, 3975008370u } + }, + { + { 1286664224u, 627406673u, 963516608u }, + { 1541344588u, 460768826u, 627406673u }, + { 1089892553u, 2717717970u, 460768826u } + }, + { + { 2956342842u, 3471097641u, 2353092905u }, + { 2996150472u, 420480221u, 3471097641u }, + { 2221681883u, 372736411u, 420480221u } + }, + { + { 420492906u, 153526651u, 3499730988u }, + { 2662640502u, 3278195133u, 153526651u }, + { 4086436419u, 2510762118u, 3278195133u } + }, + { + { 3310184147u, 2228376089u, 823220763u }, + { 3992771814u, 1693168425u, 2228376089u }, + { 2295790366u, 1401872772u, 1693168425u } + }, + { + { 2529428830u, 1497104068u, 4253248635u }, + { 3746310018u, 630867741u, 1497104068u }, + { 627043435u, 721725795u, 630867741u } + }, + { + { 2571072593u, 3039669025u, 1591031831u }, + { 526054481u, 661344445u, 3039669025u }, + { 4246010312u, 735391270u, 661344445u } + }, + { + { 1847312821u, 4042890210u, 4241772463u }, + { 606605705u, 2644799309u, 4042890210u }, + { 2658402822u, 1342278931u, 2644799309u } + }, + { + { 2409846784u, 1096138313u, 1416249993u }, + { 1501878241u, 138013862u, 1096138313u }, + { 1617749306u, 1975136163u, 138013862u } + }, + { + { 599453422u, 73950522u, 2965395603u }, + { 55354701u, 3855242202u, 73950522u }, + { 3981734504u, 3354399019u, 3855242202u } + }, + { + { 4271076381u, 813410089u, 3461955319u }, + { 1044920137u, 3029005516u, 813410089u }, + { 3501837362u, 3321539504u, 3029005516u } + }, + { + { 3058183515u, 941408572u, 1783998098u }, + { 1546486080u, 4116985007u, 941408572u }, + { 2247500745u, 1460625377u, 4116985007u } + }, + { + { 4216782514u, 3352801941u, 2315095646u }, + { 639029973u, 94451952u, 3352801941u }, + { 1242898773u, 3964593332u, 94451952u } + }, + { + { 2264905138u, 1926285644u, 1108147171u }, + { 2390706911u, 385258225u, 1926285644u }, + { 3569882325u, 3728744670u, 385258225u } + }, + { + { 270679073u, 1065683096u, 2992662885u }, + { 4196917281u, 2886425156u, 1065683096u }, + { 749134119u, 1849148167u, 2886425156u } + }, + { + { 35689930u, 1378151623u, 951629713u }, + { 673810920u, 948843427u, 1378151623u }, + { 3808868984u, 927013635u, 948843427u } + }, + { + { 1891490872u, 1130489594u, 3734864133u }, + { 1457450350u, 3362920032u, 1130489594u }, + { 638998846u, 1401175590u, 3362920032u } + }, + { + { 2254459023u, 2384691454u, 1730098031u }, + { 2844861718u, 1807491073u, 2384691454u }, + { 351423668u, 1570264155u, 1807491073u } + }, + { + { 3047429268u, 4245359555u, 2449575498u }, + { 1797081212u, 1237196477u, 4245359555u }, + { 143400628u, 3663731096u, 1237196477u } + }, + { + { 3313321106u, 4263819658u, 1047529624u }, + { 3719941673u, 3155049403u, 4263819658u }, + { 1981313839u, 4281524426u, 3155049403u } + }, + { + { 2005252417u, 3263186729u, 1535805957u }, + { 2951515865u, 1729281525u, 3263186729u }, + { 1141249417u, 2268963059u, 1729281525u } + }, + { + { 2367065164u, 83908466u, 4294308508u }, + { 1352516724u, 1416676049u, 83908466u }, + { 1040867745u, 1304732377u, 1416676049u } + }, + { + { 3214147257u, 1434230503u, 2944821434u }, + { 2753040912u, 4041536918u, 1434230503u }, + { 1317260239u, 338830578u, 4041536918u } + }, + { + { 300628476u, 2054743463u, 1499597869u }, + { 1762244284u, 1422043015u, 2054743463u }, + { 3581125669u, 1207561803u, 1422043015u } + }, + { + { 4171745404u, 4064983592u, 1934508265u }, + { 3049723261u, 1744636487u, 4064983592u }, + { 947753516u, 3952135907u, 1744636487u } + }, + { + { 1625369148u, 3577024659u, 2778677259u }, + { 1729967818u, 1049600974u, 3577024659u }, + { 2089137344u, 1569794605u, 1049600974u } + }, + { + { 1373068765u, 3958611830u, 569117280u }, + { 410042396u, 3551255470u, 3958611830u }, + { 869476379u, 1680625376u, 3551255470u } + }, + { + { 2108618602u, 2543645250u, 913717833u }, + { 2111984988u, 1012482542u, 2543645250u }, + { 2545745615u, 3141042890u, 1012482542u } + }, + { + { 1157293598u, 584852249u, 2272893205u }, + { 1631801979u, 3013855247u, 584852249u }, + { 3977310441u, 82049263u, 3013855247u } + }, + { + { 3580234334u, 3137526662u, 2403875621u }, + { 3580869206u, 3670086228u, 3137526662u }, + { 656744553u, 1764904195u, 3670086228u } + }, + { + { 2792496861u, 3634185196u, 3887031679u }, + { 3601823850u, 3464838365u, 3634185196u }, + { 3136165138u, 2842987937u, 3464838365u } + }, + { + { 1362557480u, 3230022138u, 4278720212u }, + { 3427386258u, 3848976950u, 3230022138u }, + { 2109817045u, 2441486578u, 3848976950u } + }, + { + { 1198519135u, 2007945401u, 3868481u }, + { 3335076429u, 2082683147u, 2007945401u }, + { 2341088247u, 888193479u, 2082683147u } + }, + { + { 3473925387u, 3193380570u, 565138859u }, + { 307060547u, 782210925u, 3193380570u }, + { 167617770u, 2180014252u, 782210925u } + }, + { + { 3811588895u, 3303532086u, 2766583698u }, + { 908630605u, 2665400165u, 3303532086u }, + { 2499994113u, 3316180851u, 2665400165u } + }, + { + { 4288926968u, 3033075037u, 1505732852u }, + { 1531633406u, 645804125u, 3033075037u }, + { 2942690261u, 2205365640u, 645804125u } + }, + { + { 3976196483u, 3651411522u, 1652430357u }, + { 1690405883u, 1294990760u, 3651411522u }, + { 209339647u, 3088484327u, 1294990760u } + }, + { + { 3171589548u, 2291131070u, 2093793287u }, + { 2997812074u, 4093879780u, 2291131070u }, + { 3255666800u, 858124816u, 4093879780u } + }, + { + { 4113016361u, 2999667479u, 3995043314u }, + { 1333973326u, 4007774239u, 2999667479u }, + { 3322921863u, 4278103786u, 4007774239u } + }, + { + { 925786347u, 2109676036u, 1879981040u }, + { 1701566570u, 1489702270u, 2109676036u }, + { 2719807628u, 158549605u, 1489702270u } + }, + { + { 2255405265u, 3460246357u, 218033453u }, + { 2135115875u, 359516994u, 3460246357u }, + { 3568862459u, 3114762683u, 359516994u } + }, + { + { 773148471u, 4117539411u, 3073622315u }, + { 3807175775u, 186466108u, 4117539411u }, + { 2842197411u, 651334129u, 186466108u } + }, + { + { 615242951u, 1475251263u, 3586439101u }, + { 1693917167u, 3058812486u, 1475251263u }, + { 568701600u, 1164226398u, 3058812486u } + }, + { + { 1632636204u, 15370275u, 2061555515u }, + { 4187505695u, 1741164221u, 15370275u }, + { 2882176274u, 3978412194u, 1741164221u } + }, + { + { 3446066703u, 344820524u, 74213775u }, + { 1008543583u, 2579620192u, 344820524u }, + { 3753911358u, 1538453821u, 2579620192u } + }, + { + { 3600859892u, 1269921024u, 4069458760u }, + { 2050939727u, 2222725697u, 1269921024u }, + { 3208347646u, 690898125u, 2222725697u } + }, + { + { 599407451u, 2806239788u, 1742216102u }, + { 975123999u, 764869161u, 2806239788u }, + { 2729710367u, 1845257036u, 764869161u } + }, + { + { 967330218u, 3464884028u, 3444447102u }, + { 580449578u, 1343714307u, 3464884028u }, + { 1775329096u, 4027221761u, 1343714307u } + } + }; + +#ifndef __CUDACC_RTC__ +CURAND_MRG32K3A_MATRICES_HOST_QUALIFIERS unsigned int mrg32k3aM1Host[64][3][3] = { + { + { 0u, 1u, 0u }, + { 0u, 0u, 1u }, + { 4294156359u, 1403580u, 0u } + }, + { + { 0u, 0u, 1u }, + { 4294156359u, 1403580u, 0u }, + { 0u, 4294156359u, 1403580u } + }, + { + { 0u, 4294156359u, 1403580u }, + { 244671815u, 2941890554u, 4294156359u }, + { 149925673u, 489343630u, 2941890554u } + }, + { + { 1527363550u, 2758233149u, 1831234280u }, + { 4072640363u, 939574583u, 2758233149u }, + { 2064391165u, 3228066636u, 939574583u } + }, + { + { 736416029u, 2961816100u, 342112271u }, + { 387300998u, 1062452522u, 2961816100u }, + { 2955879160u, 340793741u, 1062452522u } + }, + { + { 1243502014u, 2218748291u, 1709215645u }, + { 2019641772u, 3847560959u, 2218748291u }, + { 3866010231u, 2305448679u, 3847560959u } + }, + { + { 3241775219u, 3453352062u, 3721871040u }, + { 4062454730u, 3015754u, 3453352062u }, + { 919711945u, 613405362u, 3015754u } + }, + { + { 1955221006u, 1414472808u, 1746037714u }, + { 3653507277u, 1644962013u, 1414472808u }, + { 3501544776u, 2336229602u, 1644962013u } + }, + { + { 1170096663u, 49135452u, 3441537107u }, + { 1857945175u, 1649398389u, 49135452u }, + { 333002869u, 3109147376u, 1649398389u } + }, + { + { 2299034194u, 2297111910u, 862649200u }, + { 1399961132u, 996706937u, 2297111910u }, + { 3439056503u, 1481993076u, 996706937u } + }, + { + { 4146310528u, 458782589u, 1007330283u }, + { 4241015765u, 3979619964u, 458782589u }, + { 553886495u, 2186897562u, 3979619964u } + }, + { + { 3630027893u, 2130448350u, 292773857u }, + { 1392525159u, 1299285967u, 2130448350u }, + { 2589171163u, 1217405758u, 1299285967u } + }, + { + { 892409263u, 1999175811u, 2979225418u }, + { 1996163538u, 2148702503u, 1999175811u }, + { 3922720782u, 103819730u, 2148702503u } + }, + { + { 1586003016u, 2114210471u, 3240775579u }, + { 2777288607u, 1400478398u, 2114210471u }, + { 3018215420u, 535326008u, 1400478398u } + }, + { + { 2188531273u, 1783231160u, 3576659343u }, + { 1908318389u, 379210133u, 1783231160u }, + { 554369329u, 250053591u, 379210133u } + }, + { + { 4022841636u, 3951951872u, 2143424240u }, + { 1046219306u, 1591992468u, 3951951872u }, + { 1510277444u, 381333958u, 1591992468u } + }, + { + { 2256493727u, 3715182130u, 642697923u }, + { 3615342722u, 3975008370u, 3715182130u }, + { 2405650329u, 754337639u, 3975008370u } + }, + { + { 1286664224u, 627406673u, 963516608u }, + { 1541344588u, 460768826u, 627406673u }, + { 1089892553u, 2717717970u, 460768826u } + }, + { + { 2956342842u, 3471097641u, 2353092905u }, + { 2996150472u, 420480221u, 3471097641u }, + { 2221681883u, 372736411u, 420480221u } + }, + { + { 420492906u, 153526651u, 3499730988u }, + { 2662640502u, 3278195133u, 153526651u }, + { 4086436419u, 2510762118u, 3278195133u } + }, + { + { 3310184147u, 2228376089u, 823220763u }, + { 3992771814u, 1693168425u, 2228376089u }, + { 2295790366u, 1401872772u, 1693168425u } + }, + { + { 2529428830u, 1497104068u, 4253248635u }, + { 3746310018u, 630867741u, 1497104068u }, + { 627043435u, 721725795u, 630867741u } + }, + { + { 2571072593u, 3039669025u, 1591031831u }, + { 526054481u, 661344445u, 3039669025u }, + { 4246010312u, 735391270u, 661344445u } + }, + { + { 1847312821u, 4042890210u, 4241772463u }, + { 606605705u, 2644799309u, 4042890210u }, + { 2658402822u, 1342278931u, 2644799309u } + }, + { + { 2409846784u, 1096138313u, 1416249993u }, + { 1501878241u, 138013862u, 1096138313u }, + { 1617749306u, 1975136163u, 138013862u } + }, + { + { 599453422u, 73950522u, 2965395603u }, + { 55354701u, 3855242202u, 73950522u }, + { 3981734504u, 3354399019u, 3855242202u } + }, + { + { 4271076381u, 813410089u, 3461955319u }, + { 1044920137u, 3029005516u, 813410089u }, + { 3501837362u, 3321539504u, 3029005516u } + }, + { + { 3058183515u, 941408572u, 1783998098u }, + { 1546486080u, 4116985007u, 941408572u }, + { 2247500745u, 1460625377u, 4116985007u } + }, + { + { 4216782514u, 3352801941u, 2315095646u }, + { 639029973u, 94451952u, 3352801941u }, + { 1242898773u, 3964593332u, 94451952u } + }, + { + { 2264905138u, 1926285644u, 1108147171u }, + { 2390706911u, 385258225u, 1926285644u }, + { 3569882325u, 3728744670u, 385258225u } + }, + { + { 270679073u, 1065683096u, 2992662885u }, + { 4196917281u, 2886425156u, 1065683096u }, + { 749134119u, 1849148167u, 2886425156u } + }, + { + { 35689930u, 1378151623u, 951629713u }, + { 673810920u, 948843427u, 1378151623u }, + { 3808868984u, 927013635u, 948843427u } + }, + { + { 1891490872u, 1130489594u, 3734864133u }, + { 1457450350u, 3362920032u, 1130489594u }, + { 638998846u, 1401175590u, 3362920032u } + }, + { + { 2254459023u, 2384691454u, 1730098031u }, + { 2844861718u, 1807491073u, 2384691454u }, + { 351423668u, 1570264155u, 1807491073u } + }, + { + { 3047429268u, 4245359555u, 2449575498u }, + { 1797081212u, 1237196477u, 4245359555u }, + { 143400628u, 3663731096u, 1237196477u } + }, + { + { 3313321106u, 4263819658u, 1047529624u }, + { 3719941673u, 3155049403u, 4263819658u }, + { 1981313839u, 4281524426u, 3155049403u } + }, + { + { 2005252417u, 3263186729u, 1535805957u }, + { 2951515865u, 1729281525u, 3263186729u }, + { 1141249417u, 2268963059u, 1729281525u } + }, + { + { 2367065164u, 83908466u, 4294308508u }, + { 1352516724u, 1416676049u, 83908466u }, + { 1040867745u, 1304732377u, 1416676049u } + }, + { + { 3214147257u, 1434230503u, 2944821434u }, + { 2753040912u, 4041536918u, 1434230503u }, + { 1317260239u, 338830578u, 4041536918u } + }, + { + { 300628476u, 2054743463u, 1499597869u }, + { 1762244284u, 1422043015u, 2054743463u }, + { 3581125669u, 1207561803u, 1422043015u } + }, + { + { 4171745404u, 4064983592u, 1934508265u }, + { 3049723261u, 1744636487u, 4064983592u }, + { 947753516u, 3952135907u, 1744636487u } + }, + { + { 1625369148u, 3577024659u, 2778677259u }, + { 1729967818u, 1049600974u, 3577024659u }, + { 2089137344u, 1569794605u, 1049600974u } + }, + { + { 1373068765u, 3958611830u, 569117280u }, + { 410042396u, 3551255470u, 3958611830u }, + { 869476379u, 1680625376u, 3551255470u } + }, + { + { 2108618602u, 2543645250u, 913717833u }, + { 2111984988u, 1012482542u, 2543645250u }, + { 2545745615u, 3141042890u, 1012482542u } + }, + { + { 1157293598u, 584852249u, 2272893205u }, + { 1631801979u, 3013855247u, 584852249u }, + { 3977310441u, 82049263u, 3013855247u } + }, + { + { 3580234334u, 3137526662u, 2403875621u }, + { 3580869206u, 3670086228u, 3137526662u }, + { 656744553u, 1764904195u, 3670086228u } + }, + { + { 2792496861u, 3634185196u, 3887031679u }, + { 3601823850u, 3464838365u, 3634185196u }, + { 3136165138u, 2842987937u, 3464838365u } + }, + { + { 1362557480u, 3230022138u, 4278720212u }, + { 3427386258u, 3848976950u, 3230022138u }, + { 2109817045u, 2441486578u, 3848976950u } + }, + { + { 1198519135u, 2007945401u, 3868481u }, + { 3335076429u, 2082683147u, 2007945401u }, + { 2341088247u, 888193479u, 2082683147u } + }, + { + { 3473925387u, 3193380570u, 565138859u }, + { 307060547u, 782210925u, 3193380570u }, + { 167617770u, 2180014252u, 782210925u } + }, + { + { 3811588895u, 3303532086u, 2766583698u }, + { 908630605u, 2665400165u, 3303532086u }, + { 2499994113u, 3316180851u, 2665400165u } + }, + { + { 4288926968u, 3033075037u, 1505732852u }, + { 1531633406u, 645804125u, 3033075037u }, + { 2942690261u, 2205365640u, 645804125u } + }, + { + { 3976196483u, 3651411522u, 1652430357u }, + { 1690405883u, 1294990760u, 3651411522u }, + { 209339647u, 3088484327u, 1294990760u } + }, + { + { 3171589548u, 2291131070u, 2093793287u }, + { 2997812074u, 4093879780u, 2291131070u }, + { 3255666800u, 858124816u, 4093879780u } + }, + { + { 4113016361u, 2999667479u, 3995043314u }, + { 1333973326u, 4007774239u, 2999667479u }, + { 3322921863u, 4278103786u, 4007774239u } + }, + { + { 925786347u, 2109676036u, 1879981040u }, + { 1701566570u, 1489702270u, 2109676036u }, + { 2719807628u, 158549605u, 1489702270u } + }, + { + { 2255405265u, 3460246357u, 218033453u }, + { 2135115875u, 359516994u, 3460246357u }, + { 3568862459u, 3114762683u, 359516994u } + }, + { + { 773148471u, 4117539411u, 3073622315u }, + { 3807175775u, 186466108u, 4117539411u }, + { 2842197411u, 651334129u, 186466108u } + }, + { + { 615242951u, 1475251263u, 3586439101u }, + { 1693917167u, 3058812486u, 1475251263u }, + { 568701600u, 1164226398u, 3058812486u } + }, + { + { 1632636204u, 15370275u, 2061555515u }, + { 4187505695u, 1741164221u, 15370275u }, + { 2882176274u, 3978412194u, 1741164221u } + }, + { + { 3446066703u, 344820524u, 74213775u }, + { 1008543583u, 2579620192u, 344820524u }, + { 3753911358u, 1538453821u, 2579620192u } + }, + { + { 3600859892u, 1269921024u, 4069458760u }, + { 2050939727u, 2222725697u, 1269921024u }, + { 3208347646u, 690898125u, 2222725697u } + }, + { + { 599407451u, 2806239788u, 1742216102u }, + { 975123999u, 764869161u, 2806239788u }, + { 2729710367u, 1845257036u, 764869161u } + }, + { + { 967330218u, 3464884028u, 3444447102u }, + { 580449578u, 1343714307u, 3464884028u }, + { 1775329096u, 4027221761u, 1343714307u } + } + }; +#endif // ifndef __CUDACC_RTC__ + +CURAND_MRG32K3A_MATRICES_DEVICE_QUALIFIERS unsigned int mrg32k3aM2[64][3][3] = { + { + { 0u, 1u, 0u }, + { 0u, 0u, 1u }, + { 4293573854u, 0u, 527612u } + }, + { + { 0u, 0u, 1u }, + { 4293573854u, 0u, 527612u }, + { 2706407399u, 4293573854u, 3497978192u } + }, + { + { 2706407399u, 4293573854u, 3497978192u }, + { 1431525864u, 2706407399u, 3281754271u }, + { 97673890u, 1431525864u, 1673476130u } + }, + { + { 3405842137u, 2680076935u, 893509979u }, + { 4035147174u, 3405842137u, 3280220074u }, + { 2623373296u, 4035147174u, 361718588u } + }, + { + { 818368950u, 3790774567u, 3542344109u }, + { 1817134745u, 818368950u, 3321940838u }, + { 3493477402u, 1817134745u, 2854655037u } + }, + { + { 498682467u, 2928649385u, 811441367u }, + { 1777037472u, 498682467u, 479207863u }, + { 3058260025u, 1777037472u, 1528225099u } + }, + { + { 3893311647u, 3140922085u, 64039185u }, + { 82107183u, 3893311647u, 2655465224u }, + { 1674879036u, 82107183u, 1089381262u } + }, + { + { 28639152u, 3496041927u, 2231910770u }, + { 3174683233u, 28639152u, 2828785870u }, + { 3681140872u, 3174683233u, 3910194649u } + }, + { + { 1463826069u, 300842059u, 3313769518u }, + { 1799677538u, 1463826069u, 3174861078u }, + { 1882279394u, 1799677538u, 3509975160u } + }, + { + { 2092194020u, 184076987u, 2202401252u }, + { 3103629604u, 2092194020u, 3409560232u }, + { 4257445059u, 3103629604u, 2390202783u } + }, + { + { 812917091u, 2574011276u, 4168802395u }, + { 209817750u, 812917091u, 2974870628u }, + { 3238802184u, 209817750u, 3692836406u } + }, + { + { 477309738u, 3314523413u, 3442242150u }, + { 2755731404u, 477309738u, 2782713347u }, + { 1606221490u, 2755731404u, 1033463096u } + }, + { + { 2155469603u, 3326516116u, 3843369786u }, + { 288604458u, 2155469603u, 571673571u }, + { 1501677614u, 288604458u, 2928213494u } + }, + { + { 2082469029u, 749754403u, 3963963316u }, + { 2764859700u, 2082469029u, 3576428059u }, + { 2840894706u, 2764859700u, 1782279859u } + }, + { + { 3760163766u, 1041986082u, 1799196192u }, + { 1022129134u, 3760163766u, 1332558840u }, + { 276873446u, 1022129134u, 3979423632u } + }, + { + { 1021313167u, 1312544548u, 1716381787u }, + { 3037868518u, 1021313167u, 199085085u }, + { 2582787611u, 3037868518u, 3539882179u } + }, + { + { 2569413030u, 1631336015u, 2594942403u }, + { 1030618503u, 2569413030u, 3467650326u }, + { 1998739584u, 1030618503u, 3174552073u } + }, + { + { 2334639309u, 3114094203u, 601680947u }, + { 2110199318u, 2334639309u, 678342865u }, + { 1649523168u, 2110199318u, 2154948056u } + }, + { + { 563657176u, 191330473u, 1641595774u }, + { 780563537u, 563657176u, 3029522338u }, + { 2037330914u, 780563537u, 2084602709u } + }, + { + { 3414769923u, 1968799026u, 2238126504u }, + { 832866376u, 3414769923u, 3754780168u }, + { 2165145850u, 832866376u, 1594768331u } + }, + { + { 1646861218u, 2317984620u, 2301581548u }, + { 2672536210u, 1646861218u, 359763062u }, + { 2391283983u, 2672536210u, 1885870777u } + }, + { + { 841254072u, 3765813448u, 1635365181u }, + { 2013240130u, 841254072u, 605925849u }, + { 3743932305u, 2013240130u, 400681955u } + }, + { + { 1930213004u, 2072952279u, 3077694794u }, + { 3579956569u, 1930213004u, 2478539210u }, + { 1960229502u, 3579956569u, 1455652656u } + }, + { + { 1097613522u, 1784540933u, 1194440107u }, + { 321747515u, 1097613522u, 1225209584u }, + { 74521379u, 321747515u, 4288531000u } + }, + { + { 143812745u, 3254530816u, 3514348856u }, + { 769295000u, 143812745u, 2468210728u }, + { 1927161272u, 769295000u, 522705580u } + }, + { + { 2692035063u, 2596905012u, 1643240704u }, + { 1103432342u, 2692035063u, 1446182108u }, + { 4161111774u, 1103432342u, 3076435551u } + }, + { + { 2375319030u, 1391532370u, 3742334018u }, + { 1202100604u, 2375319030u, 4098434768u }, + { 2327872488u, 1202100604u, 1471526950u } + }, + { + { 4269164791u, 2795313144u, 2507855960u }, + { 4245372460u, 4269164791u, 4094914553u }, + { 3873219634u, 4245372460u, 1473695507u } + }, + { + { 513890845u, 1208902926u, 2870530442u }, + { 1984873167u, 513890845u, 1257532340u }, + { 1212627640u, 1984873167u, 2354363842u } + }, + { + { 1848364568u, 1552116673u, 3496528455u }, + { 4160778291u, 1848364568u, 141769900u }, + { 3611019106u, 4160778291u, 596424080u } + }, + { + { 364070020u, 3520039729u, 837362349u }, + { 2544671570u, 364070020u, 2188646679u }, + { 163978331u, 2544671570u, 672947816u } + }, + { + { 1192700714u, 3968150021u, 298357363u }, + { 635565666u, 1192700714u, 2589432341u }, + { 2548654227u, 635565666u, 3531570992u } + }, + { + { 2709640529u, 676525399u, 875361870u }, + { 1315499519u, 2709640529u, 3842690720u }, + { 3300994644u, 1315499519u, 2446760804u } + }, + { + { 2742149264u, 1410604392u, 3032350755u }, + { 3774935330u, 2742149264u, 597633965u }, + { 4085935803u, 3774935330u, 3952463556u } + }, + { + { 3878579563u, 845297523u, 1721916511u }, + { 2077922420u, 3878579563u, 3651360351u }, + { 2177255734u, 2077922420u, 3791239282u } + }, + { + { 1570315355u, 4252790045u, 3522351060u }, + { 2324624266u, 1570315355u, 3594939336u }, + { 1725087354u, 2324624266u, 1338343327u } + }, + { + { 2305761589u, 381933244u, 3663579047u }, + { 1355307047u, 2305761589u, 313617972u }, + { 992174375u, 1355307047u, 3881593435u } + }, + { + { 1667857811u, 1564715297u, 2263851601u }, + { 3791771273u, 1667857811u, 4196134923u }, + { 3347975047u, 3791771273u, 615040705u } + }, + { + { 4093947334u, 3454015638u, 2815567716u }, + { 4261953004u, 4093947334u, 3973733876u }, + { 2979573134u, 4261953004u, 3757047667u } + }, + { + { 250120061u, 570149551u, 1513430926u }, + { 3178644752u, 250120061u, 1701869032u }, + { 4172515680u, 3178644752u, 4213855850u } + }, + { + { 4158106802u, 3062358456u, 1815738463u }, + { 1379176112u, 4158106802u, 3926509890u }, + { 2842564878u, 1379176112u, 2852219546u } + }, + { + { 931848746u, 256263523u, 2633569246u }, + { 3284646837u, 931848746u, 2567084715u }, + { 415258465u, 3284646837u, 2017565947u } + }, + { + { 1648005210u, 1032291296u, 3987397422u }, + { 1831496020u, 1648005210u, 2829448427u }, + { 1821082272u, 1831496020u, 2917140265u } + }, + { + { 4161327077u, 489964129u, 3870847744u }, + { 1669447863u, 4161327077u, 4292947198u }, + { 1522417114u, 1669447863u, 2652286672u } + }, + { + { 1270934555u, 3136631324u, 505612043u }, + { 2981474723u, 1270934555u, 2528619024u }, + { 625182639u, 2981474723u, 1008985039u } + }, + { + { 280996820u, 143706137u, 3013099060u }, + { 1797675893u, 280996820u, 3743985508u }, + { 1123794455u, 1797675893u, 2460119169u } + }, + { + { 919218027u, 4154920441u, 1125672685u }, + { 3933041881u, 919218027u, 474242849u }, + { 564891116u, 3933041881u, 2263904321u } + }, + { + { 2920112852u, 1965329198u, 1177141043u }, + { 2135250851u, 2920112852u, 969184056u }, + { 296035385u, 2135250851u, 4267827987u } + }, + { + { 1481142942u, 4120754772u, 1088557292u }, + { 265491023u, 1481142942u, 2860005744u }, + { 301796252u, 265491023u, 1935975979u } + }, + { + { 2111859033u, 2813610100u, 1001476468u }, + { 73849832u, 2111859033u, 3980799998u }, + { 3330206241u, 73849832u, 1933943506u } + }, + { + { 1781286360u, 3661231931u, 3509383709u }, + { 2753158871u, 1781286360u, 3119883109u }, + { 3576525143u, 2753158871u, 551079002u } + }, + { + { 1185024844u, 587779104u, 1004942725u }, + { 3763632860u, 1185024844u, 947424568u }, + { 3811666068u, 3763632860u, 2352253462u } + }, + { + { 1310227170u, 218138208u, 3172947233u }, + { 766129426u, 1310227170u, 1808643264u }, + { 2226659371u, 766129426u, 3853798112u } + }, + { + { 2230902378u, 4243560874u, 2491962392u }, + { 3836629116u, 2230902378u, 3637515403u }, + { 2846140932u, 3836629116u, 3083355464u } + }, + { + { 999448569u, 1464488480u, 3344426626u }, + { 946166795u, 999448569u, 340856814u }, + { 3686999436u, 946166795u, 3231079441u } + }, + { + { 1226155368u, 3477563770u, 550006884u }, + { 2378667355u, 1226155368u, 1493409040u }, + { 260364836u, 2378667355u, 4133888397u } + }, + { + { 1277901832u, 310796286u, 2818511068u }, + { 3088910653u, 1277901832u, 3303406025u }, + { 2507911914u, 3088910653u, 3712928074u } + }, + { + { 481918378u, 339570348u, 1728801469u }, + { 1623163429u, 481918378u, 2209094694u }, + { 3146982514u, 1623163429u, 508445538u } + }, + { + { 3138921230u, 2381863183u, 1992357430u }, + { 1024510915u, 3138921230u, 2122851650u }, + { 1453455184u, 1024510915u, 941946604u } + }, + { + { 2465372719u, 1391015357u, 3328905025u }, + { 1821933605u, 2465372719u, 1343489680u }, + { 3648970313u, 1821933605u, 1816599716u } + }, + { + { 118634664u, 3358712512u, 2492792220u }, + { 348833376u, 118634664u, 2495544591u }, + { 3235582254u, 348833376u, 4043157504u } + }, + { + { 2303067090u, 3371139074u, 1967771133u }, + { 598630070u, 2303067090u, 1819012637u }, + { 2049250561u, 598630070u, 4093044926u } + }, + { + { 3035321857u, 3971176093u, 226779704u }, + { 3361614254u, 3035321857u, 2807125404u }, + { 326640887u, 3361614254u, 3147308542u } + }, + { + { 1774298149u, 4179629947u, 3145006948u }, + { 1688753503u, 1774298149u, 94869516u }, + { 2327946901u, 1688753503u, 2786835219u } + } + }; + +#ifndef __CUDACC_RTC__ +CURAND_MRG32K3A_MATRICES_HOST_QUALIFIERS unsigned int mrg32k3aM2Host[64][3][3] = { + { + { 0u, 1u, 0u }, + { 0u, 0u, 1u }, + { 4293573854u, 0u, 527612u } + }, + { + { 0u, 0u, 1u }, + { 4293573854u, 0u, 527612u }, + { 2706407399u, 4293573854u, 3497978192u } + }, + { + { 2706407399u, 4293573854u, 3497978192u }, + { 1431525864u, 2706407399u, 3281754271u }, + { 97673890u, 1431525864u, 1673476130u } + }, + { + { 3405842137u, 2680076935u, 893509979u }, + { 4035147174u, 3405842137u, 3280220074u }, + { 2623373296u, 4035147174u, 361718588u } + }, + { + { 818368950u, 3790774567u, 3542344109u }, + { 1817134745u, 818368950u, 3321940838u }, + { 3493477402u, 1817134745u, 2854655037u } + }, + { + { 498682467u, 2928649385u, 811441367u }, + { 1777037472u, 498682467u, 479207863u }, + { 3058260025u, 1777037472u, 1528225099u } + }, + { + { 3893311647u, 3140922085u, 64039185u }, + { 82107183u, 3893311647u, 2655465224u }, + { 1674879036u, 82107183u, 1089381262u } + }, + { + { 28639152u, 3496041927u, 2231910770u }, + { 3174683233u, 28639152u, 2828785870u }, + { 3681140872u, 3174683233u, 3910194649u } + }, + { + { 1463826069u, 300842059u, 3313769518u }, + { 1799677538u, 1463826069u, 3174861078u }, + { 1882279394u, 1799677538u, 3509975160u } + }, + { + { 2092194020u, 184076987u, 2202401252u }, + { 3103629604u, 2092194020u, 3409560232u }, + { 4257445059u, 3103629604u, 2390202783u } + }, + { + { 812917091u, 2574011276u, 4168802395u }, + { 209817750u, 812917091u, 2974870628u }, + { 3238802184u, 209817750u, 3692836406u } + }, + { + { 477309738u, 3314523413u, 3442242150u }, + { 2755731404u, 477309738u, 2782713347u }, + { 1606221490u, 2755731404u, 1033463096u } + }, + { + { 2155469603u, 3326516116u, 3843369786u }, + { 288604458u, 2155469603u, 571673571u }, + { 1501677614u, 288604458u, 2928213494u } + }, + { + { 2082469029u, 749754403u, 3963963316u }, + { 2764859700u, 2082469029u, 3576428059u }, + { 2840894706u, 2764859700u, 1782279859u } + }, + { + { 3760163766u, 1041986082u, 1799196192u }, + { 1022129134u, 3760163766u, 1332558840u }, + { 276873446u, 1022129134u, 3979423632u } + }, + { + { 1021313167u, 1312544548u, 1716381787u }, + { 3037868518u, 1021313167u, 199085085u }, + { 2582787611u, 3037868518u, 3539882179u } + }, + { + { 2569413030u, 1631336015u, 2594942403u }, + { 1030618503u, 2569413030u, 3467650326u }, + { 1998739584u, 1030618503u, 3174552073u } + }, + { + { 2334639309u, 3114094203u, 601680947u }, + { 2110199318u, 2334639309u, 678342865u }, + { 1649523168u, 2110199318u, 2154948056u } + }, + { + { 563657176u, 191330473u, 1641595774u }, + { 780563537u, 563657176u, 3029522338u }, + { 2037330914u, 780563537u, 2084602709u } + }, + { + { 3414769923u, 1968799026u, 2238126504u }, + { 832866376u, 3414769923u, 3754780168u }, + { 2165145850u, 832866376u, 1594768331u } + }, + { + { 1646861218u, 2317984620u, 2301581548u }, + { 2672536210u, 1646861218u, 359763062u }, + { 2391283983u, 2672536210u, 1885870777u } + }, + { + { 841254072u, 3765813448u, 1635365181u }, + { 2013240130u, 841254072u, 605925849u }, + { 3743932305u, 2013240130u, 400681955u } + }, + { + { 1930213004u, 2072952279u, 3077694794u }, + { 3579956569u, 1930213004u, 2478539210u }, + { 1960229502u, 3579956569u, 1455652656u } + }, + { + { 1097613522u, 1784540933u, 1194440107u }, + { 321747515u, 1097613522u, 1225209584u }, + { 74521379u, 321747515u, 4288531000u } + }, + { + { 143812745u, 3254530816u, 3514348856u }, + { 769295000u, 143812745u, 2468210728u }, + { 1927161272u, 769295000u, 522705580u } + }, + { + { 2692035063u, 2596905012u, 1643240704u }, + { 1103432342u, 2692035063u, 1446182108u }, + { 4161111774u, 1103432342u, 3076435551u } + }, + { + { 2375319030u, 1391532370u, 3742334018u }, + { 1202100604u, 2375319030u, 4098434768u }, + { 2327872488u, 1202100604u, 1471526950u } + }, + { + { 4269164791u, 2795313144u, 2507855960u }, + { 4245372460u, 4269164791u, 4094914553u }, + { 3873219634u, 4245372460u, 1473695507u } + }, + { + { 513890845u, 1208902926u, 2870530442u }, + { 1984873167u, 513890845u, 1257532340u }, + { 1212627640u, 1984873167u, 2354363842u } + }, + { + { 1848364568u, 1552116673u, 3496528455u }, + { 4160778291u, 1848364568u, 141769900u }, + { 3611019106u, 4160778291u, 596424080u } + }, + { + { 364070020u, 3520039729u, 837362349u }, + { 2544671570u, 364070020u, 2188646679u }, + { 163978331u, 2544671570u, 672947816u } + }, + { + { 1192700714u, 3968150021u, 298357363u }, + { 635565666u, 1192700714u, 2589432341u }, + { 2548654227u, 635565666u, 3531570992u } + }, + { + { 2709640529u, 676525399u, 875361870u }, + { 1315499519u, 2709640529u, 3842690720u }, + { 3300994644u, 1315499519u, 2446760804u } + }, + { + { 2742149264u, 1410604392u, 3032350755u }, + { 3774935330u, 2742149264u, 597633965u }, + { 4085935803u, 3774935330u, 3952463556u } + }, + { + { 3878579563u, 845297523u, 1721916511u }, + { 2077922420u, 3878579563u, 3651360351u }, + { 2177255734u, 2077922420u, 3791239282u } + }, + { + { 1570315355u, 4252790045u, 3522351060u }, + { 2324624266u, 1570315355u, 3594939336u }, + { 1725087354u, 2324624266u, 1338343327u } + }, + { + { 2305761589u, 381933244u, 3663579047u }, + { 1355307047u, 2305761589u, 313617972u }, + { 992174375u, 1355307047u, 3881593435u } + }, + { + { 1667857811u, 1564715297u, 2263851601u }, + { 3791771273u, 1667857811u, 4196134923u }, + { 3347975047u, 3791771273u, 615040705u } + }, + { + { 4093947334u, 3454015638u, 2815567716u }, + { 4261953004u, 4093947334u, 3973733876u }, + { 2979573134u, 4261953004u, 3757047667u } + }, + { + { 250120061u, 570149551u, 1513430926u }, + { 3178644752u, 250120061u, 1701869032u }, + { 4172515680u, 3178644752u, 4213855850u } + }, + { + { 4158106802u, 3062358456u, 1815738463u }, + { 1379176112u, 4158106802u, 3926509890u }, + { 2842564878u, 1379176112u, 2852219546u } + }, + { + { 931848746u, 256263523u, 2633569246u }, + { 3284646837u, 931848746u, 2567084715u }, + { 415258465u, 3284646837u, 2017565947u } + }, + { + { 1648005210u, 1032291296u, 3987397422u }, + { 1831496020u, 1648005210u, 2829448427u }, + { 1821082272u, 1831496020u, 2917140265u } + }, + { + { 4161327077u, 489964129u, 3870847744u }, + { 1669447863u, 4161327077u, 4292947198u }, + { 1522417114u, 1669447863u, 2652286672u } + }, + { + { 1270934555u, 3136631324u, 505612043u }, + { 2981474723u, 1270934555u, 2528619024u }, + { 625182639u, 2981474723u, 1008985039u } + }, + { + { 280996820u, 143706137u, 3013099060u }, + { 1797675893u, 280996820u, 3743985508u }, + { 1123794455u, 1797675893u, 2460119169u } + }, + { + { 919218027u, 4154920441u, 1125672685u }, + { 3933041881u, 919218027u, 474242849u }, + { 564891116u, 3933041881u, 2263904321u } + }, + { + { 2920112852u, 1965329198u, 1177141043u }, + { 2135250851u, 2920112852u, 969184056u }, + { 296035385u, 2135250851u, 4267827987u } + }, + { + { 1481142942u, 4120754772u, 1088557292u }, + { 265491023u, 1481142942u, 2860005744u }, + { 301796252u, 265491023u, 1935975979u } + }, + { + { 2111859033u, 2813610100u, 1001476468u }, + { 73849832u, 2111859033u, 3980799998u }, + { 3330206241u, 73849832u, 1933943506u } + }, + { + { 1781286360u, 3661231931u, 3509383709u }, + { 2753158871u, 1781286360u, 3119883109u }, + { 3576525143u, 2753158871u, 551079002u } + }, + { + { 1185024844u, 587779104u, 1004942725u }, + { 3763632860u, 1185024844u, 947424568u }, + { 3811666068u, 3763632860u, 2352253462u } + }, + { + { 1310227170u, 218138208u, 3172947233u }, + { 766129426u, 1310227170u, 1808643264u }, + { 2226659371u, 766129426u, 3853798112u } + }, + { + { 2230902378u, 4243560874u, 2491962392u }, + { 3836629116u, 2230902378u, 3637515403u }, + { 2846140932u, 3836629116u, 3083355464u } + }, + { + { 999448569u, 1464488480u, 3344426626u }, + { 946166795u, 999448569u, 340856814u }, + { 3686999436u, 946166795u, 3231079441u } + }, + { + { 1226155368u, 3477563770u, 550006884u }, + { 2378667355u, 1226155368u, 1493409040u }, + { 260364836u, 2378667355u, 4133888397u } + }, + { + { 1277901832u, 310796286u, 2818511068u }, + { 3088910653u, 1277901832u, 3303406025u }, + { 2507911914u, 3088910653u, 3712928074u } + }, + { + { 481918378u, 339570348u, 1728801469u }, + { 1623163429u, 481918378u, 2209094694u }, + { 3146982514u, 1623163429u, 508445538u } + }, + { + { 3138921230u, 2381863183u, 1992357430u }, + { 1024510915u, 3138921230u, 2122851650u }, + { 1453455184u, 1024510915u, 941946604u } + }, + { + { 2465372719u, 1391015357u, 3328905025u }, + { 1821933605u, 2465372719u, 1343489680u }, + { 3648970313u, 1821933605u, 1816599716u } + }, + { + { 118634664u, 3358712512u, 2492792220u }, + { 348833376u, 118634664u, 2495544591u }, + { 3235582254u, 348833376u, 4043157504u } + }, + { + { 2303067090u, 3371139074u, 1967771133u }, + { 598630070u, 2303067090u, 1819012637u }, + { 2049250561u, 598630070u, 4093044926u } + }, + { + { 3035321857u, 3971176093u, 226779704u }, + { 3361614254u, 3035321857u, 2807125404u }, + { 326640887u, 3361614254u, 3147308542u } + }, + { + { 1774298149u, 4179629947u, 3145006948u }, + { 1688753503u, 1774298149u, 94869516u }, + { 2327946901u, 1688753503u, 2786835219u } + } + }; + +#endif // ifndef __CUDACC_RTC__ + +/*Base matrices to power (2 to the power 76) to power 2 to power n + 1u, n the first array index, from 0..63*/ + +CURAND_MRG32K3A_MATRICES_DEVICE_QUALIFIERS unsigned int mrg32k3aM1SubSeq[56][3][3] = { + { + { 82758667u, 1871391091u, 4127413238u }, + { 3672831523u, 69195019u, 1871391091u }, + { 3672091415u, 3528743235u, 69195019u } + }, + { + { 3361372532u, 2329303404u, 99651939u }, + { 2008671965u, 2931758910u, 2329303404u }, + { 1113529483u, 2374097189u, 2931758910u } + }, + { + { 1831590873u, 1588259595u, 1314332382u }, + { 2385989343u, 2508077280u, 1588259595u }, + { 1787615788u, 661437137u, 2508077280u } + }, + { + { 2326052247u, 4183591379u, 4049009082u }, + { 2604529491u, 1453913233u, 4183591379u }, + { 2311925423u, 1805360390u, 1453913233u } + }, + { + { 3956367490u, 604461629u, 1257432102u }, + { 794711716u, 1155867175u, 604461629u }, + { 1777070788u, 429445904u, 1155867175u } + }, + { + { 1686241617u, 1257046062u, 1427609439u }, + { 490376081u, 387798431u, 1257046062u }, + { 235551485u, 1312672615u, 387798431u } + }, + { + { 2362447880u, 3445363024u, 3160262066u }, + { 2426867845u, 4194339866u, 3445363024u }, + { 1046144413u, 4177893681u, 4194339866u } + }, + { + { 4251175413u, 3559576374u, 3107663662u }, + { 697539134u, 1909472435u, 3559576374u }, + { 280754246u, 375835695u, 1909472435u } + }, + { + { 1099512970u, 712404985u, 1571467521u }, + { 546519870u, 1135109300u, 712404985u }, + { 3325312332u, 2352874613u, 1135109300u } + }, + { + { 1945425936u, 1653045514u, 381988982u }, + { 3733376326u, 414410025u, 1653045514u }, + { 1181583679u, 1185848176u, 414410025u } + }, + { + { 2526336124u, 3019211015u, 4215964965u }, + { 2683163472u, 4188191530u, 3019211015u }, + { 2964651598u, 293801056u, 4188191530u } + }, + { + { 1444052678u, 2253324417u, 39719589u }, + { 1880267534u, 2391992038u, 2253324417u }, + { 987740265u, 3691889508u, 2391992038u } + }, + { + { 166599066u, 2335494420u, 1232261118u }, + { 2227597731u, 2570600780u, 2335494420u }, + { 2700034538u, 3460843234u, 2570600780u } + }, + { + { 2511338360u, 1188954576u, 1251401239u }, + { 2511664974u, 292276982u, 1188954576u }, + { 697844082u, 3093661552u, 292276982u } + }, + { + { 3624650744u, 51993077u, 3540268009u }, + { 3252828938u, 3710319575u, 51993077u }, + { 2858628849u, 3910069381u, 3710319575u } + }, + { + { 655966702u, 754002362u, 1646581402u }, + { 1958331075u, 475572423u, 754002362u }, + { 3248619000u, 3228514800u, 475572423u } + }, + { + { 2760311307u, 4166372813u, 741596417u }, + { 2282679206u, 3090782630u, 4166372813u }, + { 3242468721u, 1628442374u, 3090782630u } + }, + { + { 4265279407u, 3532111852u, 1754687396u }, + { 500404765u, 2603727025u, 3532111852u }, + { 1428367254u, 3149485478u, 2603727025u } + }, + { + { 2873769531u, 2081104178u, 596284397u }, + { 4153800443u, 1261269623u, 2081104178u }, + { 3967600061u, 1830023157u, 1261269623u } + }, + { + { 278611533u, 2229285304u, 3443204327u }, + { 3110641420u, 77498444u, 2229285304u }, + { 3904070810u, 1070507239u, 77498444u } + }, + { + { 544639534u, 568528663u, 2177189807u }, + { 2475829068u, 121482268u, 568528663u }, + { 876978915u, 3116647617u, 121482268u } + }, + { + { 1547862823u, 2404658587u, 4191448009u }, + { 2158188804u, 2976916793u, 2404658587u }, + { 168571747u, 1691884706u, 2976916793u } + }, + { + { 3208213311u, 4212638780u, 3235157352u }, + { 671148556u, 2951207765u, 4212638780u }, + { 2075145516u, 2395485231u, 2951207765u } + }, + { + { 4080517315u, 2133433101u, 4043998180u }, + { 2044221845u, 867670560u, 2133433101u }, + { 834432416u, 3613001199u, 867670560u } + }, + { + { 4102885735u, 1319434267u, 2678775073u }, + { 740092580u, 607380970u, 1319434267u }, + { 2198271844u, 2610193258u, 607380970u } + }, + { + { 1165218048u, 1317690360u, 1189150958u }, + { 399240205u, 2507168618u, 1317690360u }, + { 2988334517u, 2687593413u, 2507168618u } + }, + { + { 1028861702u, 4082006648u, 338232527u }, + { 1888486946u, 1842080991u, 4082006648u }, + { 3903826366u, 3109935091u, 1842080991u } + }, + { + { 614134826u, 2261996505u, 2888080641u }, + { 710199359u, 2773979788u, 2261996505u }, + { 1144301620u, 2554371815u, 2773979788u } + }, + { + { 4056173823u, 1285620078u, 357420018u }, + { 2423072612u, 2309408315u, 1285620078u }, + { 1533175115u, 2760088020u, 2309408315u } + }, + { + { 4264130267u, 815015434u, 3142242173u }, + { 180649975u, 2500813569u, 815015434u }, + { 3378723563u, 829683767u, 2500813569u } + }, + { + { 4174387531u, 1030729435u, 2812778314u }, + { 1752988797u, 4044178729u, 1030729435u }, + { 467969301u, 554748104u, 4044178729u } + }, + { + { 1348429235u, 2928743274u, 3776082629u }, + { 3607529209u, 3069812185u, 2928743274u }, + { 2542432347u, 3208181168u, 3069812185u } + }, + { + { 4064845753u, 668285756u, 3816217625u }, + { 3713143233u, 1380634204u, 668285756u }, + { 3533700508u, 1192551435u, 1380634204u } + }, + { + { 1515684518u, 1706771705u, 728123349u }, + { 3174850469u, 2057456462u, 1706771705u }, + { 3410402985u, 2897339640u, 2057456462u } + }, + { + { 3082272717u, 531091457u, 1390161328u }, + { 3895139973u, 2171402857u, 531091457u }, + { 4030688141u, 3049703400u, 2171402857u } + }, + { + { 1241147206u, 3193892819u, 1244284192u }, + { 65180262u, 4065669017u, 3193892819u }, + { 1484817937u, 3661081858u, 4065669017u } + }, + { + { 1438760812u, 3491341751u, 3414470157u }, + { 2805337292u, 272266053u, 3491341751u }, + { 824109230u, 3202556526u, 272266053u } + }, + { + { 135412706u, 3627115412u, 2345042216u }, + { 1565169824u, 2166856449u, 3627115412u }, + { 1026946745u, 3467845248u, 2166856449u } + }, + { + { 1889419951u, 3256876154u, 1240505488u }, + { 1254783743u, 989966800u, 3256876154u }, + { 1995297400u, 3692472918u, 989966800u } + }, + { + { 3206226875u, 285700890u, 496017472u }, + { 2515316194u, 2129675196u, 285700890u }, + { 1863853990u, 2673457552u, 2129675196u } + }, + { + { 4163770641u, 255160418u, 772100749u }, + { 1987092456u, 3237660221u, 255160418u }, + { 1394381051u, 4216039401u, 3237660221u } + }, + { + { 2133915627u, 2713747584u, 627765421u }, + { 2300605925u, 35690583u, 2713747584u }, + { 2918902946u, 2638220304u, 35690583u } + }, + { + { 2587549655u, 998684270u, 4292130625u }, + { 1791772791u, 2820705344u, 998684270u }, + { 124590158u, 3831143549u, 2820705344u } + }, + { + { 978482299u, 3200877282u, 497605289u }, + { 3717741518u, 3737164414u, 3200877282u }, + { 4046686626u, 861393946u, 3737164414u } + }, + { + { 2665561897u, 300934584u, 3179822945u }, + { 893043137u, 2031413512u, 300934584u }, + { 3806926970u, 2413249929u, 2031413512u } + }, + { + { 1417581911u, 3071835354u, 2575196237u }, + { 4101127251u, 1375339216u, 3071835354u }, + { 847617977u, 3632503316u, 1375339216u } + }, + { + { 2747488994u, 3296604805u, 898095468u }, + { 1742777145u, 219265369u, 3296604805u }, + { 823714885u, 667779292u, 219265369u } + }, + { + { 2640209692u, 3040506537u, 3626115220u }, + { 161827078u, 852668118u, 3040506537u }, + { 3856381322u, 3360242076u, 852668118u } + }, + { + { 3734246393u, 4151553160u, 4177051283u }, + { 266522866u, 1731798531u, 4151553160u }, + { 632196679u, 3864297722u, 1731798531u } + }, + { + { 1694175127u, 1087914338u, 2384195794u }, + { 2764925057u, 505782858u, 1087914338u }, + { 3235634082u, 807915248u, 505782858u } + }, + { + { 2402749950u, 2353776151u, 75909174u }, + { 890570951u, 1752665661u, 2353776151u }, + { 3120241607u, 3862435696u, 1752665661u } + } + }; + +#ifndef __CUDACC_RTC__ +CURAND_MRG32K3A_MATRICES_HOST_QUALIFIERS unsigned int mrg32k3aM1SubSeqHost[56][3][3] = { + { + { 82758667u, 1871391091u, 4127413238u }, + { 3672831523u, 69195019u, 1871391091u }, + { 3672091415u, 3528743235u, 69195019u } + }, + { + { 3361372532u, 2329303404u, 99651939u }, + { 2008671965u, 2931758910u, 2329303404u }, + { 1113529483u, 2374097189u, 2931758910u } + }, + { + { 1831590873u, 1588259595u, 1314332382u }, + { 2385989343u, 2508077280u, 1588259595u }, + { 1787615788u, 661437137u, 2508077280u } + }, + { + { 2326052247u, 4183591379u, 4049009082u }, + { 2604529491u, 1453913233u, 4183591379u }, + { 2311925423u, 1805360390u, 1453913233u } + }, + { + { 3956367490u, 604461629u, 1257432102u }, + { 794711716u, 1155867175u, 604461629u }, + { 1777070788u, 429445904u, 1155867175u } + }, + { + { 1686241617u, 1257046062u, 1427609439u }, + { 490376081u, 387798431u, 1257046062u }, + { 235551485u, 1312672615u, 387798431u } + }, + { + { 2362447880u, 3445363024u, 3160262066u }, + { 2426867845u, 4194339866u, 3445363024u }, + { 1046144413u, 4177893681u, 4194339866u } + }, + { + { 4251175413u, 3559576374u, 3107663662u }, + { 697539134u, 1909472435u, 3559576374u }, + { 280754246u, 375835695u, 1909472435u } + }, + { + { 1099512970u, 712404985u, 1571467521u }, + { 546519870u, 1135109300u, 712404985u }, + { 3325312332u, 2352874613u, 1135109300u } + }, + { + { 1945425936u, 1653045514u, 381988982u }, + { 3733376326u, 414410025u, 1653045514u }, + { 1181583679u, 1185848176u, 414410025u } + }, + { + { 2526336124u, 3019211015u, 4215964965u }, + { 2683163472u, 4188191530u, 3019211015u }, + { 2964651598u, 293801056u, 4188191530u } + }, + { + { 1444052678u, 2253324417u, 39719589u }, + { 1880267534u, 2391992038u, 2253324417u }, + { 987740265u, 3691889508u, 2391992038u } + }, + { + { 166599066u, 2335494420u, 1232261118u }, + { 2227597731u, 2570600780u, 2335494420u }, + { 2700034538u, 3460843234u, 2570600780u } + }, + { + { 2511338360u, 1188954576u, 1251401239u }, + { 2511664974u, 292276982u, 1188954576u }, + { 697844082u, 3093661552u, 292276982u } + }, + { + { 3624650744u, 51993077u, 3540268009u }, + { 3252828938u, 3710319575u, 51993077u }, + { 2858628849u, 3910069381u, 3710319575u } + }, + { + { 655966702u, 754002362u, 1646581402u }, + { 1958331075u, 475572423u, 754002362u }, + { 3248619000u, 3228514800u, 475572423u } + }, + { + { 2760311307u, 4166372813u, 741596417u }, + { 2282679206u, 3090782630u, 4166372813u }, + { 3242468721u, 1628442374u, 3090782630u } + }, + { + { 4265279407u, 3532111852u, 1754687396u }, + { 500404765u, 2603727025u, 3532111852u }, + { 1428367254u, 3149485478u, 2603727025u } + }, + { + { 2873769531u, 2081104178u, 596284397u }, + { 4153800443u, 1261269623u, 2081104178u }, + { 3967600061u, 1830023157u, 1261269623u } + }, + { + { 278611533u, 2229285304u, 3443204327u }, + { 3110641420u, 77498444u, 2229285304u }, + { 3904070810u, 1070507239u, 77498444u } + }, + { + { 544639534u, 568528663u, 2177189807u }, + { 2475829068u, 121482268u, 568528663u }, + { 876978915u, 3116647617u, 121482268u } + }, + { + { 1547862823u, 2404658587u, 4191448009u }, + { 2158188804u, 2976916793u, 2404658587u }, + { 168571747u, 1691884706u, 2976916793u } + }, + { + { 3208213311u, 4212638780u, 3235157352u }, + { 671148556u, 2951207765u, 4212638780u }, + { 2075145516u, 2395485231u, 2951207765u } + }, + { + { 4080517315u, 2133433101u, 4043998180u }, + { 2044221845u, 867670560u, 2133433101u }, + { 834432416u, 3613001199u, 867670560u } + }, + { + { 4102885735u, 1319434267u, 2678775073u }, + { 740092580u, 607380970u, 1319434267u }, + { 2198271844u, 2610193258u, 607380970u } + }, + { + { 1165218048u, 1317690360u, 1189150958u }, + { 399240205u, 2507168618u, 1317690360u }, + { 2988334517u, 2687593413u, 2507168618u } + }, + { + { 1028861702u, 4082006648u, 338232527u }, + { 1888486946u, 1842080991u, 4082006648u }, + { 3903826366u, 3109935091u, 1842080991u } + }, + { + { 614134826u, 2261996505u, 2888080641u }, + { 710199359u, 2773979788u, 2261996505u }, + { 1144301620u, 2554371815u, 2773979788u } + }, + { + { 4056173823u, 1285620078u, 357420018u }, + { 2423072612u, 2309408315u, 1285620078u }, + { 1533175115u, 2760088020u, 2309408315u } + }, + { + { 4264130267u, 815015434u, 3142242173u }, + { 180649975u, 2500813569u, 815015434u }, + { 3378723563u, 829683767u, 2500813569u } + }, + { + { 4174387531u, 1030729435u, 2812778314u }, + { 1752988797u, 4044178729u, 1030729435u }, + { 467969301u, 554748104u, 4044178729u } + }, + { + { 1348429235u, 2928743274u, 3776082629u }, + { 3607529209u, 3069812185u, 2928743274u }, + { 2542432347u, 3208181168u, 3069812185u } + }, + { + { 4064845753u, 668285756u, 3816217625u }, + { 3713143233u, 1380634204u, 668285756u }, + { 3533700508u, 1192551435u, 1380634204u } + }, + { + { 1515684518u, 1706771705u, 728123349u }, + { 3174850469u, 2057456462u, 1706771705u }, + { 3410402985u, 2897339640u, 2057456462u } + }, + { + { 3082272717u, 531091457u, 1390161328u }, + { 3895139973u, 2171402857u, 531091457u }, + { 4030688141u, 3049703400u, 2171402857u } + }, + { + { 1241147206u, 3193892819u, 1244284192u }, + { 65180262u, 4065669017u, 3193892819u }, + { 1484817937u, 3661081858u, 4065669017u } + }, + { + { 1438760812u, 3491341751u, 3414470157u }, + { 2805337292u, 272266053u, 3491341751u }, + { 824109230u, 3202556526u, 272266053u } + }, + { + { 135412706u, 3627115412u, 2345042216u }, + { 1565169824u, 2166856449u, 3627115412u }, + { 1026946745u, 3467845248u, 2166856449u } + }, + { + { 1889419951u, 3256876154u, 1240505488u }, + { 1254783743u, 989966800u, 3256876154u }, + { 1995297400u, 3692472918u, 989966800u } + }, + { + { 3206226875u, 285700890u, 496017472u }, + { 2515316194u, 2129675196u, 285700890u }, + { 1863853990u, 2673457552u, 2129675196u } + }, + { + { 4163770641u, 255160418u, 772100749u }, + { 1987092456u, 3237660221u, 255160418u }, + { 1394381051u, 4216039401u, 3237660221u } + }, + { + { 2133915627u, 2713747584u, 627765421u }, + { 2300605925u, 35690583u, 2713747584u }, + { 2918902946u, 2638220304u, 35690583u } + }, + { + { 2587549655u, 998684270u, 4292130625u }, + { 1791772791u, 2820705344u, 998684270u }, + { 124590158u, 3831143549u, 2820705344u } + }, + { + { 978482299u, 3200877282u, 497605289u }, + { 3717741518u, 3737164414u, 3200877282u }, + { 4046686626u, 861393946u, 3737164414u } + }, + { + { 2665561897u, 300934584u, 3179822945u }, + { 893043137u, 2031413512u, 300934584u }, + { 3806926970u, 2413249929u, 2031413512u } + }, + { + { 1417581911u, 3071835354u, 2575196237u }, + { 4101127251u, 1375339216u, 3071835354u }, + { 847617977u, 3632503316u, 1375339216u } + }, + { + { 2747488994u, 3296604805u, 898095468u }, + { 1742777145u, 219265369u, 3296604805u }, + { 823714885u, 667779292u, 219265369u } + }, + { + { 2640209692u, 3040506537u, 3626115220u }, + { 161827078u, 852668118u, 3040506537u }, + { 3856381322u, 3360242076u, 852668118u } + }, + { + { 3734246393u, 4151553160u, 4177051283u }, + { 266522866u, 1731798531u, 4151553160u }, + { 632196679u, 3864297722u, 1731798531u } + }, + { + { 1694175127u, 1087914338u, 2384195794u }, + { 2764925057u, 505782858u, 1087914338u }, + { 3235634082u, 807915248u, 505782858u } + }, + { + { 2402749950u, 2353776151u, 75909174u }, + { 890570951u, 1752665661u, 2353776151u }, + { 3120241607u, 3862435696u, 1752665661u } + } + }; +#endif // #ifndef __CUDACC_RTC__ + +CURAND_MRG32K3A_MATRICES_DEVICE_QUALIFIERS unsigned int mrg32k3aM2SubSeq[56][3][3] = { + { + { 1511326704u, 3759209742u, 1610795712u }, + { 4292754251u, 1511326704u, 3889917532u }, + { 3859662829u, 4292754251u, 3708466080u } + }, + { + { 972103006u, 964807713u, 878035866u }, + { 4248550197u, 972103006u, 1926628839u }, + { 1448629089u, 4248550197u, 3196114006u } + }, + { + { 3497384788u, 3174249442u, 3182508868u }, + { 3864816447u, 3497384788u, 3038399593u }, + { 2546884738u, 3864816447u, 2980208068u } + }, + { + { 1776335558u, 1189944887u, 4095757548u }, + { 3813600746u, 1776335558u, 789475914u }, + { 4119698302u, 3813600746u, 2145357457u } + }, + { + { 4022832294u, 4130146837u, 1942923647u }, + { 1675130777u, 4022832294u, 916677004u }, + { 4089786548u, 1675130777u, 116540512u } + }, + { + { 165639584u, 1205513289u, 2037453462u }, + { 1444587280u, 165639584u, 161923120u }, + { 2617085459u, 1444587280u, 2006913311u } + }, + { + { 3458099202u, 3062421748u, 4052486999u }, + { 1064270720u, 3458099202u, 230768332u }, + { 4056228301u, 1064270720u, 2219267779u } + }, + { + { 296275263u, 3452455838u, 2081462173u }, + { 1789143993u, 296275263u, 3463234943u }, + { 2097389984u, 1789143993u, 3447191459u } + }, + { + { 2828288883u, 3866690251u, 410553827u }, + { 1587005542u, 2828288883u, 1469478670u }, + { 2766486018u, 1587005542u, 2627363449u } + }, + { + { 3288027530u, 412403981u, 2458742268u }, + { 4267121909u, 3288027530u, 138566505u }, + { 420803572u, 4267121909u, 4094554844u } + }, + { + { 3844599430u, 2430152838u, 3283485436u }, + { 2486244684u, 3844599430u, 4252427633u }, + { 3560842909u, 2486244684u, 3960267499u } + }, + { + { 67933059u, 1294996291u, 2657888382u }, + { 513233413u, 67933059u, 1379805031u }, + { 44564058u, 513233413u, 86971645u } + }, + { + { 2732588524u, 1866530072u, 818237694u }, + { 2540507736u, 2732588524u, 3257104212u }, + { 1164400003u, 2540507736u, 1124501551u } + }, + { + { 4199239222u, 3155848463u, 2121388468u }, + { 1135554501u, 4199239222u, 2056492193u }, + { 3251740389u, 1135554501u, 2343537248u } + }, + { + { 550710036u, 500329021u, 1075236085u }, + { 356444753u, 550710036u, 1634965500u }, + { 58733535u, 356444753u, 1261552815u } + }, + { + { 708689546u, 419139045u, 2012018174u }, + { 706488081u, 708689546u, 1113760995u }, + { 585555005u, 706488081u, 76092226u } + }, + { + { 1293182265u, 3168473803u, 366230236u }, + { 3319068849u, 1293182265u, 1085259665u }, + { 1675229290u, 3319068849u, 3912300371u } + }, + { + { 3186089068u, 4188864734u, 1211781402u }, + { 756122322u, 3186089068u, 578262892u }, + { 2518961174u, 756122322u, 1658665581u } + }, + { + { 1347291439u, 2050427676u, 736113023u }, + { 4102191254u, 1347291439u, 878627148u }, + { 1293500383u, 4102191254u, 745646810u } + }, + { + { 4196897331u, 3436564969u, 1900167098u }, + { 3108887846u, 4196897331u, 2697923227u }, + { 1405263476u, 3108887846u, 314631094u } + }, + { + { 958383622u, 3694638688u, 1150087061u }, + { 3770009830u, 958383622u, 793326651u }, + { 533700213u, 3770009830u, 1513734026u } + }, + { + { 4119603367u, 3479396923u, 3534176399u }, + { 3765397477u, 4119603367u, 1458031003u }, + { 3380901602u, 3765397477u, 2684083587u } + }, + { + { 980937351u, 2094378936u, 448446028u }, + { 1421333909u, 980937351u, 3405683645u }, + { 323724368u, 1421333909u, 338680738u } + }, + { + { 2942968846u, 4293637338u, 3549906544u }, + { 527851489u, 2942968846u, 3852871282u }, + { 4209198933u, 527851489u, 1091268872u } + }, + { + { 1975983015u, 2092556693u, 611187071u }, + { 3982652344u, 1975983015u, 3001736262u }, + { 2055073597u, 3982652344u, 1875181995u } + }, + { + { 2970221269u, 880904779u, 2447465272u }, + { 2888742196u, 2970221269u, 3521651749u }, + { 3019977656u, 2888742196u, 2712717326u } + }, + { + { 419134859u, 2976059897u, 747864206u }, + { 4101695717u, 419134859u, 4264593116u }, + { 2657991148u, 4101695717u, 2542621682u } + }, + { + { 4043135299u, 1612983166u, 1149778656u }, + { 1267010518u, 4043135299u, 3496325546u }, + { 3094232897u, 1267010518u, 2949176293u } + }, + { + { 3949395794u, 1774568686u, 2123036003u }, + { 2182983404u, 3949395794u, 2355671350u }, + { 2820933455u, 2182983404u, 513963325u } + }, + { + { 3046911698u, 2576744453u, 2492729814u }, + { 4277866093u, 3046911698u, 3146977604u }, + { 2249371766u, 4277866093u, 3622293976u } + }, + { + { 1391529818u, 423458502u, 2587125255u }, + { 3536237833u, 1391529818u, 985347517u }, + { 157623850u, 3536237833u, 1015566287u } + }, + { + { 48329260u, 2599277669u, 821961664u }, + { 902187690u, 48329260u, 1716556555u }, + { 4019658974u, 902187690u, 950730510u } + }, + { + { 1318489562u, 1530977112u, 3713577419u }, + { 4270158447u, 1318489562u, 1654940598u }, + { 2679964938u, 4270158447u, 1337075195u } + }, + { + { 770600793u, 3249576224u, 3578552768u }, + { 2710443459u, 770600793u, 2990852339u }, + { 3098163705u, 2710443459u, 522138188u } + }, + { + { 2803285489u, 1922250286u, 3164022812u }, + { 477609731u, 2803285489u, 2140252218u }, + { 2252852611u, 477609731u, 3058519788u } + }, + { + { 208329741u, 3633562083u, 3548346666u }, + { 3892091460u, 208329741u, 516833304u }, + { 3440632377u, 3892091460u, 1638833719u } + }, + { + { 1816075033u, 3570111203u, 959489356u }, + { 3482051486u, 1816075033u, 861657108u }, + { 3119495098u, 3482051486u, 2576849579u } + }, + { + { 4240216888u, 2891584407u, 2102314945u }, + { 4064489450u, 4240216888u, 1427441010u }, + { 2441164913u, 4064489450u, 3558527186u } + }, + { + { 2918371295u, 65155283u, 3469357011u }, + { 3579773554u, 2918371295u, 3494391959u }, + { 3266584309u, 3579773554u, 3837485479u } + }, + { + { 2959420453u, 1365016881u, 4082486022u }, + { 236489012u, 2959420453u, 3802558529u }, + { 2687043642u, 236489012u, 2547086826u } + }, + { + { 4185325422u, 2762854843u, 3200044912u }, + { 3664909559u, 4185325422u, 3543921700u }, + { 4240262918u, 3664909559u, 2853212443u } + }, + { + { 2618500928u, 4237264351u, 1470046497u }, + { 1893990098u, 2618500928u, 2982567031u }, + { 3017062825u, 1893990098u, 3195556801u } + }, + { + { 1868464655u, 3407681142u, 1652841784u }, + { 1678569574u, 1868464655u, 4162480901u }, + { 1477016185u, 1678569574u, 4145063890u } + }, + { + { 792188465u, 4251338402u, 2219407026u }, + { 3840340879u, 792188465u, 3493367465u }, + { 2979958414u, 3840340879u, 2338974139u } + }, + { + { 478845700u, 2378167062u, 882114621u }, + { 1674533845u, 478845700u, 3572905305u }, + { 3571222880u, 1674533845u, 1242316901u } + }, + { + { 2636090868u, 1972761498u, 71690719u }, + { 1228103463u, 2636090868u, 1280685025u }, + { 3741735502u, 1228103463u, 994061750u } + }, + { + { 1156725261u, 1100755307u, 221922891u }, + { 2892200461u, 1156725261u, 1505716533u }, + { 2287613563u, 2892200461u, 3689457190u } + }, + { + { 1387244644u, 3135090808u, 1243609165u }, + { 1724967466u, 1387244644u, 3296353235u }, + { 1064364031u, 1724967466u, 2107521044u } + }, + { + { 2822471992u, 2034317853u, 2071407475u }, + { 170903528u, 2822471992u, 1322162887u }, + { 2524982332u, 170903528u, 2656231333u } + }, + { + { 3653936868u, 3893194049u, 2484299328u }, + { 1313746234u, 3653936868u, 1705346273u }, + { 1397638018u, 1313746234u, 4015529545u } + }, + { + { 4129760842u, 1671665759u, 1677834656u }, + { 3200005334u, 4129760842u, 3486207172u }, + { 2850728736u, 3200005334u, 3076201597u } + } + }; + +#ifndef __CUDACC_RTC__ +CURAND_MRG32K3A_MATRICES_HOST_QUALIFIERS unsigned int mrg32k3aM2SubSeqHost[56][3][3] = { + { + { 1511326704u, 3759209742u, 1610795712u }, + { 4292754251u, 1511326704u, 3889917532u }, + { 3859662829u, 4292754251u, 3708466080u } + }, + { + { 972103006u, 964807713u, 878035866u }, + { 4248550197u, 972103006u, 1926628839u }, + { 1448629089u, 4248550197u, 3196114006u } + }, + { + { 3497384788u, 3174249442u, 3182508868u }, + { 3864816447u, 3497384788u, 3038399593u }, + { 2546884738u, 3864816447u, 2980208068u } + }, + { + { 1776335558u, 1189944887u, 4095757548u }, + { 3813600746u, 1776335558u, 789475914u }, + { 4119698302u, 3813600746u, 2145357457u } + }, + { + { 4022832294u, 4130146837u, 1942923647u }, + { 1675130777u, 4022832294u, 916677004u }, + { 4089786548u, 1675130777u, 116540512u } + }, + { + { 165639584u, 1205513289u, 2037453462u }, + { 1444587280u, 165639584u, 161923120u }, + { 2617085459u, 1444587280u, 2006913311u } + }, + { + { 3458099202u, 3062421748u, 4052486999u }, + { 1064270720u, 3458099202u, 230768332u }, + { 4056228301u, 1064270720u, 2219267779u } + }, + { + { 296275263u, 3452455838u, 2081462173u }, + { 1789143993u, 296275263u, 3463234943u }, + { 2097389984u, 1789143993u, 3447191459u } + }, + { + { 2828288883u, 3866690251u, 410553827u }, + { 1587005542u, 2828288883u, 1469478670u }, + { 2766486018u, 1587005542u, 2627363449u } + }, + { + { 3288027530u, 412403981u, 2458742268u }, + { 4267121909u, 3288027530u, 138566505u }, + { 420803572u, 4267121909u, 4094554844u } + }, + { + { 3844599430u, 2430152838u, 3283485436u }, + { 2486244684u, 3844599430u, 4252427633u }, + { 3560842909u, 2486244684u, 3960267499u } + }, + { + { 67933059u, 1294996291u, 2657888382u }, + { 513233413u, 67933059u, 1379805031u }, + { 44564058u, 513233413u, 86971645u } + }, + { + { 2732588524u, 1866530072u, 818237694u }, + { 2540507736u, 2732588524u, 3257104212u }, + { 1164400003u, 2540507736u, 1124501551u } + }, + { + { 4199239222u, 3155848463u, 2121388468u }, + { 1135554501u, 4199239222u, 2056492193u }, + { 3251740389u, 1135554501u, 2343537248u } + }, + { + { 550710036u, 500329021u, 1075236085u }, + { 356444753u, 550710036u, 1634965500u }, + { 58733535u, 356444753u, 1261552815u } + }, + { + { 708689546u, 419139045u, 2012018174u }, + { 706488081u, 708689546u, 1113760995u }, + { 585555005u, 706488081u, 76092226u } + }, + { + { 1293182265u, 3168473803u, 366230236u }, + { 3319068849u, 1293182265u, 1085259665u }, + { 1675229290u, 3319068849u, 3912300371u } + }, + { + { 3186089068u, 4188864734u, 1211781402u }, + { 756122322u, 3186089068u, 578262892u }, + { 2518961174u, 756122322u, 1658665581u } + }, + { + { 1347291439u, 2050427676u, 736113023u }, + { 4102191254u, 1347291439u, 878627148u }, + { 1293500383u, 4102191254u, 745646810u } + }, + { + { 4196897331u, 3436564969u, 1900167098u }, + { 3108887846u, 4196897331u, 2697923227u }, + { 1405263476u, 3108887846u, 314631094u } + }, + { + { 958383622u, 3694638688u, 1150087061u }, + { 3770009830u, 958383622u, 793326651u }, + { 533700213u, 3770009830u, 1513734026u } + }, + { + { 4119603367u, 3479396923u, 3534176399u }, + { 3765397477u, 4119603367u, 1458031003u }, + { 3380901602u, 3765397477u, 2684083587u } + }, + { + { 980937351u, 2094378936u, 448446028u }, + { 1421333909u, 980937351u, 3405683645u }, + { 323724368u, 1421333909u, 338680738u } + }, + { + { 2942968846u, 4293637338u, 3549906544u }, + { 527851489u, 2942968846u, 3852871282u }, + { 4209198933u, 527851489u, 1091268872u } + }, + { + { 1975983015u, 2092556693u, 611187071u }, + { 3982652344u, 1975983015u, 3001736262u }, + { 2055073597u, 3982652344u, 1875181995u } + }, + { + { 2970221269u, 880904779u, 2447465272u }, + { 2888742196u, 2970221269u, 3521651749u }, + { 3019977656u, 2888742196u, 2712717326u } + }, + { + { 419134859u, 2976059897u, 747864206u }, + { 4101695717u, 419134859u, 4264593116u }, + { 2657991148u, 4101695717u, 2542621682u } + }, + { + { 4043135299u, 1612983166u, 1149778656u }, + { 1267010518u, 4043135299u, 3496325546u }, + { 3094232897u, 1267010518u, 2949176293u } + }, + { + { 3949395794u, 1774568686u, 2123036003u }, + { 2182983404u, 3949395794u, 2355671350u }, + { 2820933455u, 2182983404u, 513963325u } + }, + { + { 3046911698u, 2576744453u, 2492729814u }, + { 4277866093u, 3046911698u, 3146977604u }, + { 2249371766u, 4277866093u, 3622293976u } + }, + { + { 1391529818u, 423458502u, 2587125255u }, + { 3536237833u, 1391529818u, 985347517u }, + { 157623850u, 3536237833u, 1015566287u } + }, + { + { 48329260u, 2599277669u, 821961664u }, + { 902187690u, 48329260u, 1716556555u }, + { 4019658974u, 902187690u, 950730510u } + }, + { + { 1318489562u, 1530977112u, 3713577419u }, + { 4270158447u, 1318489562u, 1654940598u }, + { 2679964938u, 4270158447u, 1337075195u } + }, + { + { 770600793u, 3249576224u, 3578552768u }, + { 2710443459u, 770600793u, 2990852339u }, + { 3098163705u, 2710443459u, 522138188u } + }, + { + { 2803285489u, 1922250286u, 3164022812u }, + { 477609731u, 2803285489u, 2140252218u }, + { 2252852611u, 477609731u, 3058519788u } + }, + { + { 208329741u, 3633562083u, 3548346666u }, + { 3892091460u, 208329741u, 516833304u }, + { 3440632377u, 3892091460u, 1638833719u } + }, + { + { 1816075033u, 3570111203u, 959489356u }, + { 3482051486u, 1816075033u, 861657108u }, + { 3119495098u, 3482051486u, 2576849579u } + }, + { + { 4240216888u, 2891584407u, 2102314945u }, + { 4064489450u, 4240216888u, 1427441010u }, + { 2441164913u, 4064489450u, 3558527186u } + }, + { + { 2918371295u, 65155283u, 3469357011u }, + { 3579773554u, 2918371295u, 3494391959u }, + { 3266584309u, 3579773554u, 3837485479u } + }, + { + { 2959420453u, 1365016881u, 4082486022u }, + { 236489012u, 2959420453u, 3802558529u }, + { 2687043642u, 236489012u, 2547086826u } + }, + { + { 4185325422u, 2762854843u, 3200044912u }, + { 3664909559u, 4185325422u, 3543921700u }, + { 4240262918u, 3664909559u, 2853212443u } + }, + { + { 2618500928u, 4237264351u, 1470046497u }, + { 1893990098u, 2618500928u, 2982567031u }, + { 3017062825u, 1893990098u, 3195556801u } + }, + { + { 1868464655u, 3407681142u, 1652841784u }, + { 1678569574u, 1868464655u, 4162480901u }, + { 1477016185u, 1678569574u, 4145063890u } + }, + { + { 792188465u, 4251338402u, 2219407026u }, + { 3840340879u, 792188465u, 3493367465u }, + { 2979958414u, 3840340879u, 2338974139u } + }, + { + { 478845700u, 2378167062u, 882114621u }, + { 1674533845u, 478845700u, 3572905305u }, + { 3571222880u, 1674533845u, 1242316901u } + }, + { + { 2636090868u, 1972761498u, 71690719u }, + { 1228103463u, 2636090868u, 1280685025u }, + { 3741735502u, 1228103463u, 994061750u } + }, + { + { 1156725261u, 1100755307u, 221922891u }, + { 2892200461u, 1156725261u, 1505716533u }, + { 2287613563u, 2892200461u, 3689457190u } + }, + { + { 1387244644u, 3135090808u, 1243609165u }, + { 1724967466u, 1387244644u, 3296353235u }, + { 1064364031u, 1724967466u, 2107521044u } + }, + { + { 2822471992u, 2034317853u, 2071407475u }, + { 170903528u, 2822471992u, 1322162887u }, + { 2524982332u, 170903528u, 2656231333u } + }, + { + { 3653936868u, 3893194049u, 2484299328u }, + { 1313746234u, 3653936868u, 1705346273u }, + { 1397638018u, 1313746234u, 4015529545u } + }, + { + { 4129760842u, 1671665759u, 1677834656u }, + { 3200005334u, 4129760842u, 3486207172u }, + { 2850728736u, 3200005334u, 3076201597u } + } + }; +#endif // #ifndef __CUDACC_RTC__ + /*Base matrices to power (2 to the power 127) to power 2 to power n+1u, n the first array index, from 0..63*/ + +CURAND_MRG32K3A_MATRICES_DEVICE_QUALIFIERS unsigned int mrg32k3aM1Seq[64][3][3] = { + { + { 2427906178u, 3580155704u, 949770784u }, + { 226153695u, 1230515664u, 3580155704u }, + { 1988835001u, 986791581u, 1230515664u } + }, + { + { 1774047142u, 3199155377u, 3106427820u }, + { 1901920839u, 4290900039u, 3199155377u }, + { 4178980191u, 280623348u, 4290900039u } + }, + { + { 3567524348u, 1934119675u, 3188270128u }, + { 2997767678u, 826363896u, 1934119675u }, + { 262952343u, 614326610u, 826363896u } + }, + { + { 1625613062u, 4288164505u, 2481284279u }, + { 4273461426u, 1177260757u, 4288164505u }, + { 305959988u, 4017252267u, 1177260757u } + }, + { + { 337929267u, 333342539u, 418300166u }, + { 2944208672u, 379097734u, 333342539u }, + { 2084056909u, 3625475947u, 379097734u } + }, + { + { 1189899255u, 1307754719u, 1214919992u }, + { 3736721708u, 3514751918u, 1307754719u }, + { 732435953u, 2021244538u, 3514751918u } + }, + { + { 4089172695u, 1533534334u, 525643282u }, + { 1497577018u, 1335684482u, 1533534334u }, + { 2079007086u, 3977541427u, 1335684482u } + }, + { + { 3075256652u, 2762754934u, 3846844247u }, + { 3057872364u, 3274545167u, 2762754934u }, + { 4028573983u, 938934351u, 3274545167u } + }, + { + { 2597859300u, 2880151048u, 2523330453u }, + { 1121709186u, 175667448u, 2880151048u }, + { 4182510911u, 1723133625u, 175667448u } + }, + { + { 484148868u, 1404283933u, 2982534313u }, + { 3736767353u, 3179865161u, 1404283933u }, + { 391120388u, 3758716888u, 3179865161u } + }, + { + { 2138867468u, 1128973399u, 2133702321u }, + { 1613561693u, 3622350766u, 1128973399u }, + { 1500151924u, 3759983985u, 3622350766u } + }, + { + { 3027706760u, 3786576552u, 2698781808u }, + { 2810527099u, 90498489u, 3786576552u }, + { 4220122612u, 1855245979u, 90498489u } + }, + { + { 3739389517u, 1110440720u, 917457922u }, + { 2163873618u, 3707591763u, 1110440720u }, + { 2667061910u, 2533383962u, 3707591763u } + }, + { + { 1545226000u, 1812182123u, 3693349190u }, + { 3422065122u, 3291428549u, 1812182123u }, + { 1193168720u, 2072837757u, 3291428549u } + }, + { + { 3230096243u, 2131723358u, 3262178024u }, + { 2882890127u, 4088518247u, 2131723358u }, + { 3991553306u, 1282224087u, 4088518247u } + }, + { + { 301207261u, 1722796810u, 3697719854u }, + { 3350228505u, 3410986694u, 1722796810u }, + { 3684514720u, 2846958957u, 3410986694u } + }, + { + { 1532963114u, 4236235786u, 3871128158u }, + { 3540401964u, 1285250577u, 4236235786u }, + { 1105070646u, 2764245175u, 1285250577u } + }, + { + { 210906218u, 3068599594u, 3034582784u }, + { 340633153u, 4004365908u, 3068599594u }, + { 4238928187u, 2299166464u, 4004365908u } + }, + { + { 2274701639u, 3955606166u, 3081246407u }, + { 3199954992u, 3948054919u, 3955606166u }, + { 2399101442u, 3438340286u, 3948054919u } + }, + { + { 504137100u, 1182303684u, 201533985u }, + { 4188299661u, 3042453580u, 1182303684u }, + { 2578519273u, 2674782930u, 3042453580u } + }, + { + { 1382964588u, 2578452047u, 3140440866u }, + { 261861891u, 1076783073u, 2578452047u }, + { 1634588989u, 164438428u, 1076783073u } + }, + { + { 2529186343u, 526867394u, 3102803247u }, + { 2687252475u, 2908898908u, 526867394u }, + { 1213100579u, 86050422u, 2908898908u } + }, + { + { 2690118316u, 538108523u, 790337895u }, + { 4193870709u, 1053552056u, 538108523u }, + { 1635227281u, 4002399925u, 1053552056u } + }, + { + { 2123712957u, 4205383007u, 1812304090u }, + { 1095349745u, 166243972u, 4205383007u }, + { 428569070u, 2128782357u, 166243972u } + }, + { + { 1330151766u, 3569679412u, 4107175982u }, + { 3808641551u, 3621125056u, 3569679412u }, + { 4262164578u, 1927692878u, 3621125056u } + }, + { + { 3606295184u, 2442739556u, 3894922338u }, + { 1629626641u, 2729678535u, 2442739556u }, + { 3379124758u, 4279360935u, 2729678535u } + }, + { + { 1052092278u, 4249024666u, 919210106u }, + { 3253349463u, 3629539480u, 4249024666u }, + { 852514024u, 4025926501u, 3629539480u } + }, + { + { 12394571u, 1252747620u, 2133571953u }, + { 4227339509u, 3197545170u, 1252747620u }, + { 1884529704u, 1976203831u, 3197545170u } + }, + { + { 2986331025u, 2671019282u, 2847338542u }, + { 3173738401u, 3542657885u, 2671019282u }, + { 745203060u, 1546667401u, 3542657885u } + }, + { + { 2613012997u, 2311336951u, 2911336433u }, + { 1493974713u, 92565032u, 2311336951u }, + { 2786645250u, 257065974u, 92565032u } + }, + { + { 3424925004u, 2776053372u, 2204068573u }, + { 3770626858u, 2509257810u, 2776053372u }, + { 2979919489u, 1146336783u, 2509257810u } + }, + { + { 1474384834u, 827894421u, 515339473u }, + { 1373055755u, 1949809417u, 827894421u }, + { 3088339524u, 1194193824u, 1949809417u } + }, + { + { 1825805135u, 1289872272u, 3700877161u }, + { 3433422861u, 4062509844u, 1289872272u }, + { 3019008744u, 2060641859u, 4062509844u } + }, + { + { 3842597153u, 4253338264u, 3424495942u }, + { 698444416u, 60268595u, 4253338264u }, + { 4096010585u, 47309624u, 60268595u } + }, + { + { 2662288323u, 2043518992u, 1593435980u }, + { 1330201507u, 3618850300u, 2043518992u }, + { 2538793204u, 271787962u, 3618850300u } + }, + { + { 741020448u, 997594656u, 2398808739u }, + { 1160477043u, 1522130854u, 997594656u }, + { 3036916315u, 2847712653u, 1522130854u } + }, + { + { 2654964886u, 1889728930u, 53329096u }, + { 2042322941u, 1621136330u, 1889728930u }, + { 1553642730u, 784545882u, 1621136330u } + }, + { + { 1715219514u, 2831829177u, 929124824u }, + { 997274536u, 404228189u, 2831829177u }, + { 1386575385u, 4107238699u, 404228189u } + }, + { + { 3928131551u, 2912523524u, 1840499723u }, + { 4216003022u, 2970489088u, 2912523524u }, + { 1158689953u, 1425511081u, 2970489088u } + }, + { + { 2807004452u, 2510299562u, 271603006u }, + { 2505735035u, 2370490899u, 2510299562u }, + { 10873814u, 2450376936u, 2370490899u } + }, + { + { 2000734342u, 1113679064u, 2502160539u }, + { 1475266926u, 2787925323u, 1113679064u }, + { 1475797635u, 3044470744u, 2787925323u } + }, + { + { 1457157056u, 1252556678u, 3073232607u }, + { 1926798761u, 3639907189u, 1252556678u }, + { 2067740348u, 2256217204u, 3639907189u } + }, + { + { 3740999688u, 1035400458u, 3162437311u }, + { 4126312242u, 686702830u, 1035400458u }, + { 1699805291u, 667792040u, 686702830u } + }, + { + { 2422495016u, 3203768688u, 1858240466u }, + { 848719394u, 4092709154u, 3203768688u }, + { 659945473u, 1863075174u, 4092709154u } + }, + { + { 246817944u, 871751352u, 2834051003u }, + { 3976202597u, 3721214025u, 871751352u }, + { 783929942u, 745295675u, 3721214025u } + }, + { + { 3811740424u, 3603608092u, 2365398362u }, + { 3826150877u, 2906557036u, 3603608092u }, + { 2300510686u, 966815948u, 2906557036u } + }, + { + { 2816329160u, 18201123u, 3367710570u }, + { 437309679u, 2220769388u, 18201123u }, + { 1346863388u, 705296543u, 2220769388u } + }, + { + { 3310028953u, 1662315499u, 132645114u }, + { 2572908401u, 3105849797u, 1662315499u }, + { 1937586849u, 1735620028u, 3105849797u } + }, + { + { 461386353u, 1359675853u, 3599822966u }, + { 106675209u, 2044154050u, 1359675853u }, + { 1787730088u, 1149892630u, 2044154050u } + }, + { + { 3303902397u, 345146034u, 1417149696u }, + { 2231869247u, 1116882637u, 345146034u }, + { 1846832385u, 79626976u, 1116882637u } + }, + { + { 2765049417u, 3117782790u, 1805260159u }, + { 3796182890u, 1101141726u, 3117782790u }, + { 224270120u, 1004001443u, 1101141726u } + }, + { + { 89118668u, 2494198515u, 1356989069u }, + { 2490435731u, 997151755u, 2494198515u }, + { 1175528637u, 3444341166u, 997151755u } + }, + { + { 2340639019u, 510225634u, 286119182u }, + { 2045217287u, 1194574818u, 510225634u }, + { 2662281592u, 1728500627u, 1194574818u } + }, + { + { 210787847u, 1189120688u, 2848040407u }, + { 1087786165u, 2343328484u, 1189120688u }, + { 3465141330u, 2893041005u, 2343328484u } + }, + { + { 3438170226u, 3236285682u, 962036916u }, + { 2873263091u, 215280489u, 3236285682u }, + { 730413847u, 1474823842u, 215280489u } + }, + { + { 1566461658u, 133010024u, 2886695328u }, + { 2835827516u, 653809404u, 133010024u }, + { 3082882924u, 3710942807u, 653809404u } + }, + { + { 4201558916u, 1263786956u, 326001602u }, + { 762846463u, 621546357u, 1263786956u }, + { 2697142404u, 1156650856u, 621546357u } + }, + { + { 2655768102u, 2339029465u, 2430211448u }, + { 2669906627u, 403962847u, 2339029465u }, + { 1483118807u, 639660658u, 403962847u } + }, + { + { 3508595200u, 4228486662u, 754946994u }, + { 1913148390u, 3500531602u, 4228486662u }, + { 24637u, 3773159052u, 3500531602u } + }, + { + { 4024866227u, 1143874914u, 3205058469u }, + { 2970344133u, 2873927273u, 1143874914u }, + { 2167114735u, 4095476435u, 2873927273u } + }, + { + { 1479401095u, 2958366486u, 3027708794u }, + { 2704486034u, 3574053987u, 2958366486u }, + { 3630964515u, 1276667706u, 3574053987u } + }, + { + { 2035927380u, 1363628533u, 818363998u }, + { 3023327955u, 3968427114u, 1363628533u }, + { 1284825950u, 2871663372u, 3968427114u } + }, + { + { 3827747418u, 3897287251u, 4106993377u }, + { 1527779946u, 3221052941u, 3897287251u }, + { 4178727866u, 4281160673u, 3221052941u } + }, + { + { 1174358892u, 2835476193u, 959978619u }, + { 850076464u, 3774782533u, 2835476193u }, + { 3880910680u, 3237990203u, 3774782533u } + } + }; + +#ifndef __CUDACC_RTC__ +CURAND_MRG32K3A_MATRICES_HOST_QUALIFIERS unsigned int mrg32k3aM1SeqHost[64][3][3] = { + { + { 2427906178u, 3580155704u, 949770784u }, + { 226153695u, 1230515664u, 3580155704u }, + { 1988835001u, 986791581u, 1230515664u } + }, + { + { 1774047142u, 3199155377u, 3106427820u }, + { 1901920839u, 4290900039u, 3199155377u }, + { 4178980191u, 280623348u, 4290900039u } + }, + { + { 3567524348u, 1934119675u, 3188270128u }, + { 2997767678u, 826363896u, 1934119675u }, + { 262952343u, 614326610u, 826363896u } + }, + { + { 1625613062u, 4288164505u, 2481284279u }, + { 4273461426u, 1177260757u, 4288164505u }, + { 305959988u, 4017252267u, 1177260757u } + }, + { + { 337929267u, 333342539u, 418300166u }, + { 2944208672u, 379097734u, 333342539u }, + { 2084056909u, 3625475947u, 379097734u } + }, + { + { 1189899255u, 1307754719u, 1214919992u }, + { 3736721708u, 3514751918u, 1307754719u }, + { 732435953u, 2021244538u, 3514751918u } + }, + { + { 4089172695u, 1533534334u, 525643282u }, + { 1497577018u, 1335684482u, 1533534334u }, + { 2079007086u, 3977541427u, 1335684482u } + }, + { + { 3075256652u, 2762754934u, 3846844247u }, + { 3057872364u, 3274545167u, 2762754934u }, + { 4028573983u, 938934351u, 3274545167u } + }, + { + { 2597859300u, 2880151048u, 2523330453u }, + { 1121709186u, 175667448u, 2880151048u }, + { 4182510911u, 1723133625u, 175667448u } + }, + { + { 484148868u, 1404283933u, 2982534313u }, + { 3736767353u, 3179865161u, 1404283933u }, + { 391120388u, 3758716888u, 3179865161u } + }, + { + { 2138867468u, 1128973399u, 2133702321u }, + { 1613561693u, 3622350766u, 1128973399u }, + { 1500151924u, 3759983985u, 3622350766u } + }, + { + { 3027706760u, 3786576552u, 2698781808u }, + { 2810527099u, 90498489u, 3786576552u }, + { 4220122612u, 1855245979u, 90498489u } + }, + { + { 3739389517u, 1110440720u, 917457922u }, + { 2163873618u, 3707591763u, 1110440720u }, + { 2667061910u, 2533383962u, 3707591763u } + }, + { + { 1545226000u, 1812182123u, 3693349190u }, + { 3422065122u, 3291428549u, 1812182123u }, + { 1193168720u, 2072837757u, 3291428549u } + }, + { + { 3230096243u, 2131723358u, 3262178024u }, + { 2882890127u, 4088518247u, 2131723358u }, + { 3991553306u, 1282224087u, 4088518247u } + }, + { + { 301207261u, 1722796810u, 3697719854u }, + { 3350228505u, 3410986694u, 1722796810u }, + { 3684514720u, 2846958957u, 3410986694u } + }, + { + { 1532963114u, 4236235786u, 3871128158u }, + { 3540401964u, 1285250577u, 4236235786u }, + { 1105070646u, 2764245175u, 1285250577u } + }, + { + { 210906218u, 3068599594u, 3034582784u }, + { 340633153u, 4004365908u, 3068599594u }, + { 4238928187u, 2299166464u, 4004365908u } + }, + { + { 2274701639u, 3955606166u, 3081246407u }, + { 3199954992u, 3948054919u, 3955606166u }, + { 2399101442u, 3438340286u, 3948054919u } + }, + { + { 504137100u, 1182303684u, 201533985u }, + { 4188299661u, 3042453580u, 1182303684u }, + { 2578519273u, 2674782930u, 3042453580u } + }, + { + { 1382964588u, 2578452047u, 3140440866u }, + { 261861891u, 1076783073u, 2578452047u }, + { 1634588989u, 164438428u, 1076783073u } + }, + { + { 2529186343u, 526867394u, 3102803247u }, + { 2687252475u, 2908898908u, 526867394u }, + { 1213100579u, 86050422u, 2908898908u } + }, + { + { 2690118316u, 538108523u, 790337895u }, + { 4193870709u, 1053552056u, 538108523u }, + { 1635227281u, 4002399925u, 1053552056u } + }, + { + { 2123712957u, 4205383007u, 1812304090u }, + { 1095349745u, 166243972u, 4205383007u }, + { 428569070u, 2128782357u, 166243972u } + }, + { + { 1330151766u, 3569679412u, 4107175982u }, + { 3808641551u, 3621125056u, 3569679412u }, + { 4262164578u, 1927692878u, 3621125056u } + }, + { + { 3606295184u, 2442739556u, 3894922338u }, + { 1629626641u, 2729678535u, 2442739556u }, + { 3379124758u, 4279360935u, 2729678535u } + }, + { + { 1052092278u, 4249024666u, 919210106u }, + { 3253349463u, 3629539480u, 4249024666u }, + { 852514024u, 4025926501u, 3629539480u } + }, + { + { 12394571u, 1252747620u, 2133571953u }, + { 4227339509u, 3197545170u, 1252747620u }, + { 1884529704u, 1976203831u, 3197545170u } + }, + { + { 2986331025u, 2671019282u, 2847338542u }, + { 3173738401u, 3542657885u, 2671019282u }, + { 745203060u, 1546667401u, 3542657885u } + }, + { + { 2613012997u, 2311336951u, 2911336433u }, + { 1493974713u, 92565032u, 2311336951u }, + { 2786645250u, 257065974u, 92565032u } + }, + { + { 3424925004u, 2776053372u, 2204068573u }, + { 3770626858u, 2509257810u, 2776053372u }, + { 2979919489u, 1146336783u, 2509257810u } + }, + { + { 1474384834u, 827894421u, 515339473u }, + { 1373055755u, 1949809417u, 827894421u }, + { 3088339524u, 1194193824u, 1949809417u } + }, + { + { 1825805135u, 1289872272u, 3700877161u }, + { 3433422861u, 4062509844u, 1289872272u }, + { 3019008744u, 2060641859u, 4062509844u } + }, + { + { 3842597153u, 4253338264u, 3424495942u }, + { 698444416u, 60268595u, 4253338264u }, + { 4096010585u, 47309624u, 60268595u } + }, + { + { 2662288323u, 2043518992u, 1593435980u }, + { 1330201507u, 3618850300u, 2043518992u }, + { 2538793204u, 271787962u, 3618850300u } + }, + { + { 741020448u, 997594656u, 2398808739u }, + { 1160477043u, 1522130854u, 997594656u }, + { 3036916315u, 2847712653u, 1522130854u } + }, + { + { 2654964886u, 1889728930u, 53329096u }, + { 2042322941u, 1621136330u, 1889728930u }, + { 1553642730u, 784545882u, 1621136330u } + }, + { + { 1715219514u, 2831829177u, 929124824u }, + { 997274536u, 404228189u, 2831829177u }, + { 1386575385u, 4107238699u, 404228189u } + }, + { + { 3928131551u, 2912523524u, 1840499723u }, + { 4216003022u, 2970489088u, 2912523524u }, + { 1158689953u, 1425511081u, 2970489088u } + }, + { + { 2807004452u, 2510299562u, 271603006u }, + { 2505735035u, 2370490899u, 2510299562u }, + { 10873814u, 2450376936u, 2370490899u } + }, + { + { 2000734342u, 1113679064u, 2502160539u }, + { 1475266926u, 2787925323u, 1113679064u }, + { 1475797635u, 3044470744u, 2787925323u } + }, + { + { 1457157056u, 1252556678u, 3073232607u }, + { 1926798761u, 3639907189u, 1252556678u }, + { 2067740348u, 2256217204u, 3639907189u } + }, + { + { 3740999688u, 1035400458u, 3162437311u }, + { 4126312242u, 686702830u, 1035400458u }, + { 1699805291u, 667792040u, 686702830u } + }, + { + { 2422495016u, 3203768688u, 1858240466u }, + { 848719394u, 4092709154u, 3203768688u }, + { 659945473u, 1863075174u, 4092709154u } + }, + { + { 246817944u, 871751352u, 2834051003u }, + { 3976202597u, 3721214025u, 871751352u }, + { 783929942u, 745295675u, 3721214025u } + }, + { + { 3811740424u, 3603608092u, 2365398362u }, + { 3826150877u, 2906557036u, 3603608092u }, + { 2300510686u, 966815948u, 2906557036u } + }, + { + { 2816329160u, 18201123u, 3367710570u }, + { 437309679u, 2220769388u, 18201123u }, + { 1346863388u, 705296543u, 2220769388u } + }, + { + { 3310028953u, 1662315499u, 132645114u }, + { 2572908401u, 3105849797u, 1662315499u }, + { 1937586849u, 1735620028u, 3105849797u } + }, + { + { 461386353u, 1359675853u, 3599822966u }, + { 106675209u, 2044154050u, 1359675853u }, + { 1787730088u, 1149892630u, 2044154050u } + }, + { + { 3303902397u, 345146034u, 1417149696u }, + { 2231869247u, 1116882637u, 345146034u }, + { 1846832385u, 79626976u, 1116882637u } + }, + { + { 2765049417u, 3117782790u, 1805260159u }, + { 3796182890u, 1101141726u, 3117782790u }, + { 224270120u, 1004001443u, 1101141726u } + }, + { + { 89118668u, 2494198515u, 1356989069u }, + { 2490435731u, 997151755u, 2494198515u }, + { 1175528637u, 3444341166u, 997151755u } + }, + { + { 2340639019u, 510225634u, 286119182u }, + { 2045217287u, 1194574818u, 510225634u }, + { 2662281592u, 1728500627u, 1194574818u } + }, + { + { 210787847u, 1189120688u, 2848040407u }, + { 1087786165u, 2343328484u, 1189120688u }, + { 3465141330u, 2893041005u, 2343328484u } + }, + { + { 3438170226u, 3236285682u, 962036916u }, + { 2873263091u, 215280489u, 3236285682u }, + { 730413847u, 1474823842u, 215280489u } + }, + { + { 1566461658u, 133010024u, 2886695328u }, + { 2835827516u, 653809404u, 133010024u }, + { 3082882924u, 3710942807u, 653809404u } + }, + { + { 4201558916u, 1263786956u, 326001602u }, + { 762846463u, 621546357u, 1263786956u }, + { 2697142404u, 1156650856u, 621546357u } + }, + { + { 2655768102u, 2339029465u, 2430211448u }, + { 2669906627u, 403962847u, 2339029465u }, + { 1483118807u, 639660658u, 403962847u } + }, + { + { 3508595200u, 4228486662u, 754946994u }, + { 1913148390u, 3500531602u, 4228486662u }, + { 24637u, 3773159052u, 3500531602u } + }, + { + { 4024866227u, 1143874914u, 3205058469u }, + { 2970344133u, 2873927273u, 1143874914u }, + { 2167114735u, 4095476435u, 2873927273u } + }, + { + { 1479401095u, 2958366486u, 3027708794u }, + { 2704486034u, 3574053987u, 2958366486u }, + { 3630964515u, 1276667706u, 3574053987u } + }, + { + { 2035927380u, 1363628533u, 818363998u }, + { 3023327955u, 3968427114u, 1363628533u }, + { 1284825950u, 2871663372u, 3968427114u } + }, + { + { 3827747418u, 3897287251u, 4106993377u }, + { 1527779946u, 3221052941u, 3897287251u }, + { 4178727866u, 4281160673u, 3221052941u } + }, + { + { 1174358892u, 2835476193u, 959978619u }, + { 850076464u, 3774782533u, 2835476193u }, + { 3880910680u, 3237990203u, 3774782533u } + } + }; +#endif // #ifndef __CUDACC_RTC__ + +CURAND_MRG32K3A_MATRICES_DEVICE_QUALIFIERS unsigned int mrg32k3aM2Seq[64][3][3] = { + { + { 1464411153u, 277697599u, 1610723613u }, + { 32183930u, 1464411153u, 1022607788u }, + { 2824425944u, 32183930u, 2093834863u } + }, + { + { 3492361727u, 1027004383u, 3167429889u }, + { 3674905362u, 3492361727u, 3572939265u }, + { 4270409313u, 3674905362u, 698814233u } + }, + { + { 880482061u, 205175925u, 4070445105u }, + { 2208329119u, 880482061u, 1933248566u }, + { 3741227945u, 2208329119u, 3962062826u } + }, + { + { 4184605179u, 1189429800u, 567967482u }, + { 107217966u, 4184605179u, 784865788u }, + { 549462420u, 107217966u, 3134382704u } + }, + { + { 2732536445u, 1231107067u, 3374588386u }, + { 409954030u, 2732536445u, 1044831206u }, + { 3398162498u, 409954030u, 3505648581u } + }, + { + { 2169560691u, 1076348534u, 637306236u }, + { 3704346564u, 2169560691u, 293694496u }, + { 632453145u, 3704346564u, 1609425246u } + }, + { + { 372115891u, 3928812480u, 2830541169u }, + { 3056527841u, 372115891u, 1924239834u }, + { 3044937468u, 3056527841u, 547142630u } + }, + { + { 1660852083u, 3635660815u, 1389092450u }, + { 1025573319u, 1660852083u, 3276803366u }, + { 4036331438u, 1025573319u, 4092197741u } + }, + { + { 1360732901u, 2887812973u, 4101068693u }, + { 52572783u, 1360732901u, 112458461u }, + { 2636566855u, 52572783u, 1136777988u } + }, + { + { 3455696508u, 536919193u, 3978804036u }, + { 3094157668u, 3455696508u, 3821833900u }, + { 2278849016u, 3094157668u, 2531965909u } + }, + { + { 2125991744u, 890897326u, 3790557569u }, + { 1433592392u, 2125991744u, 3671109604u }, + { 808215503u, 1433592392u, 2446306581u } + }, + { + { 3524411799u, 932865240u, 1838275365u }, + { 1789634890u, 3524411799u, 4130736474u }, + { 2252266098u, 1789634890u, 3048775967u } + }, + { + { 1773339925u, 948403862u, 1999624391u }, + { 983864203u, 1773339925u, 3734776305u }, + { 314407045u, 983864203u, 2648614071u } + }, + { + { 321802921u, 1099164995u, 2112167358u }, + { 3760936985u, 321802921u, 1003573324u }, + { 3758858458u, 3760936985u, 4014658840u } + }, + { + { 2196438580u, 805386227u, 4266375092u }, + { 4124675351u, 2196438580u, 2527961345u }, + { 94452540u, 4124675351u, 2825656399u } + }, + { + { 66735368u, 2228005807u, 4186703168u }, + { 2624855312u, 66735368u, 2708679078u }, + { 4098470056u, 2624855312u, 1773862183u } + }, + { + { 3072642883u, 2746897053u, 2690305546u }, + { 1105106652u, 3072642883u, 4047666135u }, + { 2862886282u, 1105106652u, 3597347398u } + }, + { + { 232906611u, 3873338256u, 4051554873u }, + { 3027413363u, 232906611u, 3159432673u }, + { 3872967050u, 3027413363u, 987156327u } + }, + { + { 1160686753u, 3676603152u, 1635979789u }, + { 1447386846u, 1160686753u, 2670438424u }, + { 816212890u, 1447386846u, 4288868534u } + }, + { + { 3825238244u, 1445162354u, 2362389441u }, + { 3440193648u, 3825238244u, 3520937545u }, + { 2652790808u, 3440193648u, 405299994u } + }, + { + { 1984094858u, 532165989u, 2027397575u }, + { 1455977136u, 1984094858u, 2433255524u }, + { 1039994763u, 1455977136u, 2069333087u } + }, + { + { 3680843319u, 2332949611u, 3516795313u }, + { 2033851810u, 3680843319u, 3843367307u }, + { 3686294589u, 2033851810u, 3912995069u } + }, + { + { 967423689u, 1724183394u, 635932799u }, + { 641380480u, 967423689u, 2145297779u }, + { 1723000412u, 641380480u, 455633660u } + }, + { + { 2130938335u, 1534972306u, 2511584766u }, + { 273828453u, 2130938335u, 3112810093u }, + { 4084843716u, 273828453u, 1399334152u } + }, + { + { 168278549u, 541167592u, 190177712u }, + { 403188859u, 168278549u, 2092073970u }, + { 58789558u, 403188859u, 2777887189u } + }, + { + { 634843389u, 4082275720u, 2092828966u }, + { 351187677u, 634843389u, 1312056270u }, + { 3347241070u, 351187677u, 2417192332u } + }, + { + { 443276110u, 1113643788u, 271102234u }, + { 3083745876u, 443276110u, 3370743767u }, + { 4200577503u, 3083745876u, 3298601960u } + }, + { + { 3533393557u, 764977733u, 3400275098u }, + { 144639933u, 3533393557u, 2646475951u }, + { 77963866u, 144639933u, 3794766611u } + }, + { + { 4064854722u, 1198665008u, 2872196602u }, + { 3274748603u, 4064854722u, 4164637970u }, + { 4238693771u, 3274748603u, 1981721347u } + }, + { + { 2279220396u, 2355957139u, 1417574285u }, + { 885864931u, 2279220396u, 1344421653u }, + { 1895527787u, 885864931u, 3726919367u } + }, + { + { 2898100178u, 2427331008u, 348923199u }, + { 3175444953u, 2898100178u, 4290541487u }, + { 246118669u, 3175444953u, 3410622769u } + }, + { + { 284442065u, 4064194676u, 2295560707u }, + { 4182706556u, 284442065u, 3696899246u }, + { 1201342255u, 4182706556u, 1145356382u } + }, + { + { 656615546u, 442908965u, 3724738272u }, + { 1624967553u, 656615546u, 798014134u }, + { 1157949454u, 1624967553u, 496247378u } + }, + { + { 265689579u, 675056541u, 3009083380u }, + { 3820679930u, 265689579u, 2961990151u }, + { 562287964u, 3820679930u, 1853486796u } + }, + { + { 1675739167u, 2319843005u, 760605578u }, + { 4161492847u, 1675739167u, 226142150u }, + { 1017447188u, 4161492847u, 3431158427u } + }, + { + { 1759873736u, 2334568602u, 2154570180u }, + { 1812793060u, 1759873736u, 2111094408u }, + { 1168460586u, 1812793060u, 2495653141u } + }, + { + { 317621194u, 868104288u, 664971082u }, + { 2340275074u, 317621194u, 2168960688u }, + { 725706104u, 2340275074u, 3532023115u } + }, + { + { 3926931954u, 2907684453u, 615601328u }, + { 1132340715u, 3926931954u, 676995757u }, + { 1154819290u, 1132340715u, 1662727700u } + }, + { + { 3921782078u, 3376494857u, 2969567377u }, + { 475345024u, 3921782078u, 4206379953u }, + { 1795936544u, 475345024u, 934679595u } + }, + { + { 3119292228u, 741613041u, 2083352304u }, + { 1047885963u, 3119292228u, 1581078542u }, + { 1065969969u, 1047885963u, 661718928u } + }, + { + { 3643472111u, 2870554228u, 3995474529u }, + { 3804264051u, 3643472111u, 1366457944u }, + { 1246805564u, 3804264051u, 993186530u } + }, + { + { 796711791u, 3878204845u, 3160293932u }, + { 255632881u, 796711791u, 3778927111u }, + { 3472564181u, 255632881u, 388382377u } + }, + { + { 1776984101u, 1742284034u, 3449763933u }, + { 1349354417u, 1776984101u, 1264780832u }, + { 715722511u, 1349354417u, 1213319489u } + }, + { + { 4261866865u, 1914382786u, 201872335u }, + { 614207188u, 4261866865u, 1853554849u }, + { 2046042882u, 614207188u, 3193186353u } + }, + { + { 2210205512u, 2847073169u, 3324925707u }, + { 1251969297u, 2210205512u, 3491451503u }, + { 470400916u, 1251969297u, 2184392547u } + }, + { + { 1523590942u, 2391111113u, 68341529u }, + { 295466806u, 1523590942u, 4143310876u }, + { 3527253079u, 295466806u, 4059123142u } + }, + { + { 1406902110u, 3735012720u, 1774518130u }, + { 1814959027u, 1406902110u, 1560544267u }, + { 346472965u, 1814959027u, 964257199u } + }, + { + { 855309653u, 4208503105u, 1518467541u }, + { 2025248418u, 855309653u, 4148125749u }, + { 1349947330u, 2025248418u, 1168504873u } + }, + { + { 2375338156u, 3629519168u, 409696181u }, + { 252401654u, 2375338156u, 3992097193u }, + { 2793725401u, 252401654u, 1350184085u } + }, + { + { 873141039u, 3885583138u, 361604799u }, + { 3554143374u, 873141039u, 894746180u }, + { 1919765327u, 3554143374u, 876210854u } + }, + { + { 246368794u, 1703793169u, 2317362874u }, + { 2300930144u, 246368794u, 2560214589u }, + { 2016163623u, 2300930144u, 1504276775u } + }, + { + { 1574610921u, 2147546631u, 4103450226u }, + { 107416526u, 1574610921u, 1773803959u }, + { 1402542742u, 107416526u, 550063800u } + }, + { + { 363388665u, 592194244u, 1746615522u }, + { 2637234667u, 363388665u, 4031408742u }, + { 2895130475u, 2637234667u, 296510335u } + }, + { + { 3997368560u, 3047771871u, 3178383826u }, + { 1160174754u, 3997368560u, 4027094919u }, + { 1234984211u, 1160174754u, 4226264344u } + }, + { + { 3303179301u, 4243968063u, 3235964171u }, + { 1776841674u, 3303179301u, 2867287469u }, + { 1500495759u, 1776841674u, 1708226553u } + }, + { + { 1482944153u, 3192311574u, 354466071u }, + { 3932773012u, 1482944153u, 389193591u }, + { 3350181058u, 3932773012u, 3398059015u } + }, + { + { 640968550u, 3226860971u, 922372912u }, + { 1254989667u, 640968550u, 2383815228u }, + { 2027371896u, 1254989667u, 2925300409u } + }, + { + { 2313146046u, 3910187183u, 1377591475u }, + { 1689291784u, 2313146046u, 4255405993u }, + { 1650609719u, 1689291784u, 1897624297u } + }, + { + { 3656310954u, 882924050u, 2702189958u }, + { 3185020283u, 3656310954u, 1923190496u }, + { 2449669145u, 3185020283u, 4235849984u } + }, + { + { 377232416u, 1498446142u, 4229103619u }, + { 3926377906u, 377232416u, 600268838u }, + { 511317726u, 3926377906u, 216160452u } + }, + { + { 1969399344u, 3273966859u, 4220943579u }, + { 3952111894u, 1969399344u, 575096961u }, + { 3815277103u, 3952111894u, 792177412u } + }, + { + { 2957238169u, 1410010554u, 1523740068u }, + { 3949237584u, 2957238169u, 74149658u }, + { 2564746147u, 3949237584u, 2557663578u } + }, + { + { 3377318569u, 1927835240u, 2556102508u }, + { 3022040116u, 3377318569u, 2549406364u }, + { 2387074241u, 3022040116u, 1477293711u } + }, + { + { 257306870u, 1748489735u, 547809226u }, + { 3708493374u, 257306870u, 4183546362u }, + { 4435502u, 3708493374u, 1607696753u } + } + }; + +#ifndef __CUDACC_RTC__ +CURAND_MRG32K3A_MATRICES_HOST_QUALIFIERS unsigned int mrg32k3aM2SeqHost[64][3][3] = { + { + { 1464411153u, 277697599u, 1610723613u }, + { 32183930u, 1464411153u, 1022607788u }, + { 2824425944u, 32183930u, 2093834863u } + }, + { + { 3492361727u, 1027004383u, 3167429889u }, + { 3674905362u, 3492361727u, 3572939265u }, + { 4270409313u, 3674905362u, 698814233u } + }, + { + { 880482061u, 205175925u, 4070445105u }, + { 2208329119u, 880482061u, 1933248566u }, + { 3741227945u, 2208329119u, 3962062826u } + }, + { + { 4184605179u, 1189429800u, 567967482u }, + { 107217966u, 4184605179u, 784865788u }, + { 549462420u, 107217966u, 3134382704u } + }, + { + { 2732536445u, 1231107067u, 3374588386u }, + { 409954030u, 2732536445u, 1044831206u }, + { 3398162498u, 409954030u, 3505648581u } + }, + { + { 2169560691u, 1076348534u, 637306236u }, + { 3704346564u, 2169560691u, 293694496u }, + { 632453145u, 3704346564u, 1609425246u } + }, + { + { 372115891u, 3928812480u, 2830541169u }, + { 3056527841u, 372115891u, 1924239834u }, + { 3044937468u, 3056527841u, 547142630u } + }, + { + { 1660852083u, 3635660815u, 1389092450u }, + { 1025573319u, 1660852083u, 3276803366u }, + { 4036331438u, 1025573319u, 4092197741u } + }, + { + { 1360732901u, 2887812973u, 4101068693u }, + { 52572783u, 1360732901u, 112458461u }, + { 2636566855u, 52572783u, 1136777988u } + }, + { + { 3455696508u, 536919193u, 3978804036u }, + { 3094157668u, 3455696508u, 3821833900u }, + { 2278849016u, 3094157668u, 2531965909u } + }, + { + { 2125991744u, 890897326u, 3790557569u }, + { 1433592392u, 2125991744u, 3671109604u }, + { 808215503u, 1433592392u, 2446306581u } + }, + { + { 3524411799u, 932865240u, 1838275365u }, + { 1789634890u, 3524411799u, 4130736474u }, + { 2252266098u, 1789634890u, 3048775967u } + }, + { + { 1773339925u, 948403862u, 1999624391u }, + { 983864203u, 1773339925u, 3734776305u }, + { 314407045u, 983864203u, 2648614071u } + }, + { + { 321802921u, 1099164995u, 2112167358u }, + { 3760936985u, 321802921u, 1003573324u }, + { 3758858458u, 3760936985u, 4014658840u } + }, + { + { 2196438580u, 805386227u, 4266375092u }, + { 4124675351u, 2196438580u, 2527961345u }, + { 94452540u, 4124675351u, 2825656399u } + }, + { + { 66735368u, 2228005807u, 4186703168u }, + { 2624855312u, 66735368u, 2708679078u }, + { 4098470056u, 2624855312u, 1773862183u } + }, + { + { 3072642883u, 2746897053u, 2690305546u }, + { 1105106652u, 3072642883u, 4047666135u }, + { 2862886282u, 1105106652u, 3597347398u } + }, + { + { 232906611u, 3873338256u, 4051554873u }, + { 3027413363u, 232906611u, 3159432673u }, + { 3872967050u, 3027413363u, 987156327u } + }, + { + { 1160686753u, 3676603152u, 1635979789u }, + { 1447386846u, 1160686753u, 2670438424u }, + { 816212890u, 1447386846u, 4288868534u } + }, + { + { 3825238244u, 1445162354u, 2362389441u }, + { 3440193648u, 3825238244u, 3520937545u }, + { 2652790808u, 3440193648u, 405299994u } + }, + { + { 1984094858u, 532165989u, 2027397575u }, + { 1455977136u, 1984094858u, 2433255524u }, + { 1039994763u, 1455977136u, 2069333087u } + }, + { + { 3680843319u, 2332949611u, 3516795313u }, + { 2033851810u, 3680843319u, 3843367307u }, + { 3686294589u, 2033851810u, 3912995069u } + }, + { + { 967423689u, 1724183394u, 635932799u }, + { 641380480u, 967423689u, 2145297779u }, + { 1723000412u, 641380480u, 455633660u } + }, + { + { 2130938335u, 1534972306u, 2511584766u }, + { 273828453u, 2130938335u, 3112810093u }, + { 4084843716u, 273828453u, 1399334152u } + }, + { + { 168278549u, 541167592u, 190177712u }, + { 403188859u, 168278549u, 2092073970u }, + { 58789558u, 403188859u, 2777887189u } + }, + { + { 634843389u, 4082275720u, 2092828966u }, + { 351187677u, 634843389u, 1312056270u }, + { 3347241070u, 351187677u, 2417192332u } + }, + { + { 443276110u, 1113643788u, 271102234u }, + { 3083745876u, 443276110u, 3370743767u }, + { 4200577503u, 3083745876u, 3298601960u } + }, + { + { 3533393557u, 764977733u, 3400275098u }, + { 144639933u, 3533393557u, 2646475951u }, + { 77963866u, 144639933u, 3794766611u } + }, + { + { 4064854722u, 1198665008u, 2872196602u }, + { 3274748603u, 4064854722u, 4164637970u }, + { 4238693771u, 3274748603u, 1981721347u } + }, + { + { 2279220396u, 2355957139u, 1417574285u }, + { 885864931u, 2279220396u, 1344421653u }, + { 1895527787u, 885864931u, 3726919367u } + }, + { + { 2898100178u, 2427331008u, 348923199u }, + { 3175444953u, 2898100178u, 4290541487u }, + { 246118669u, 3175444953u, 3410622769u } + }, + { + { 284442065u, 4064194676u, 2295560707u }, + { 4182706556u, 284442065u, 3696899246u }, + { 1201342255u, 4182706556u, 1145356382u } + }, + { + { 656615546u, 442908965u, 3724738272u }, + { 1624967553u, 656615546u, 798014134u }, + { 1157949454u, 1624967553u, 496247378u } + }, + { + { 265689579u, 675056541u, 3009083380u }, + { 3820679930u, 265689579u, 2961990151u }, + { 562287964u, 3820679930u, 1853486796u } + }, + { + { 1675739167u, 2319843005u, 760605578u }, + { 4161492847u, 1675739167u, 226142150u }, + { 1017447188u, 4161492847u, 3431158427u } + }, + { + { 1759873736u, 2334568602u, 2154570180u }, + { 1812793060u, 1759873736u, 2111094408u }, + { 1168460586u, 1812793060u, 2495653141u } + }, + { + { 317621194u, 868104288u, 664971082u }, + { 2340275074u, 317621194u, 2168960688u }, + { 725706104u, 2340275074u, 3532023115u } + }, + { + { 3926931954u, 2907684453u, 615601328u }, + { 1132340715u, 3926931954u, 676995757u }, + { 1154819290u, 1132340715u, 1662727700u } + }, + { + { 3921782078u, 3376494857u, 2969567377u }, + { 475345024u, 3921782078u, 4206379953u }, + { 1795936544u, 475345024u, 934679595u } + }, + { + { 3119292228u, 741613041u, 2083352304u }, + { 1047885963u, 3119292228u, 1581078542u }, + { 1065969969u, 1047885963u, 661718928u } + }, + { + { 3643472111u, 2870554228u, 3995474529u }, + { 3804264051u, 3643472111u, 1366457944u }, + { 1246805564u, 3804264051u, 993186530u } + }, + { + { 796711791u, 3878204845u, 3160293932u }, + { 255632881u, 796711791u, 3778927111u }, + { 3472564181u, 255632881u, 388382377u } + }, + { + { 1776984101u, 1742284034u, 3449763933u }, + { 1349354417u, 1776984101u, 1264780832u }, + { 715722511u, 1349354417u, 1213319489u } + }, + { + { 4261866865u, 1914382786u, 201872335u }, + { 614207188u, 4261866865u, 1853554849u }, + { 2046042882u, 614207188u, 3193186353u } + }, + { + { 2210205512u, 2847073169u, 3324925707u }, + { 1251969297u, 2210205512u, 3491451503u }, + { 470400916u, 1251969297u, 2184392547u } + }, + { + { 1523590942u, 2391111113u, 68341529u }, + { 295466806u, 1523590942u, 4143310876u }, + { 3527253079u, 295466806u, 4059123142u } + }, + { + { 1406902110u, 3735012720u, 1774518130u }, + { 1814959027u, 1406902110u, 1560544267u }, + { 346472965u, 1814959027u, 964257199u } + }, + { + { 855309653u, 4208503105u, 1518467541u }, + { 2025248418u, 855309653u, 4148125749u }, + { 1349947330u, 2025248418u, 1168504873u } + }, + { + { 2375338156u, 3629519168u, 409696181u }, + { 252401654u, 2375338156u, 3992097193u }, + { 2793725401u, 252401654u, 1350184085u } + }, + { + { 873141039u, 3885583138u, 361604799u }, + { 3554143374u, 873141039u, 894746180u }, + { 1919765327u, 3554143374u, 876210854u } + }, + { + { 246368794u, 1703793169u, 2317362874u }, + { 2300930144u, 246368794u, 2560214589u }, + { 2016163623u, 2300930144u, 1504276775u } + }, + { + { 1574610921u, 2147546631u, 4103450226u }, + { 107416526u, 1574610921u, 1773803959u }, + { 1402542742u, 107416526u, 550063800u } + }, + { + { 363388665u, 592194244u, 1746615522u }, + { 2637234667u, 363388665u, 4031408742u }, + { 2895130475u, 2637234667u, 296510335u } + }, + { + { 3997368560u, 3047771871u, 3178383826u }, + { 1160174754u, 3997368560u, 4027094919u }, + { 1234984211u, 1160174754u, 4226264344u } + }, + { + { 3303179301u, 4243968063u, 3235964171u }, + { 1776841674u, 3303179301u, 2867287469u }, + { 1500495759u, 1776841674u, 1708226553u } + }, + { + { 1482944153u, 3192311574u, 354466071u }, + { 3932773012u, 1482944153u, 389193591u }, + { 3350181058u, 3932773012u, 3398059015u } + }, + { + { 640968550u, 3226860971u, 922372912u }, + { 1254989667u, 640968550u, 2383815228u }, + { 2027371896u, 1254989667u, 2925300409u } + }, + { + { 2313146046u, 3910187183u, 1377591475u }, + { 1689291784u, 2313146046u, 4255405993u }, + { 1650609719u, 1689291784u, 1897624297u } + }, + { + { 3656310954u, 882924050u, 2702189958u }, + { 3185020283u, 3656310954u, 1923190496u }, + { 2449669145u, 3185020283u, 4235849984u } + }, + { + { 377232416u, 1498446142u, 4229103619u }, + { 3926377906u, 377232416u, 600268838u }, + { 511317726u, 3926377906u, 216160452u } + }, + { + { 1969399344u, 3273966859u, 4220943579u }, + { 3952111894u, 1969399344u, 575096961u }, + { 3815277103u, 3952111894u, 792177412u } + }, + { + { 2957238169u, 1410010554u, 1523740068u }, + { 3949237584u, 2957238169u, 74149658u }, + { 2564746147u, 3949237584u, 2557663578u } + }, + { + { 3377318569u, 1927835240u, 2556102508u }, + { 3022040116u, 3377318569u, 2549406364u }, + { 2387074241u, 3022040116u, 1477293711u } + }, + { + { 257306870u, 1748489735u, 547809226u }, + { 3708493374u, 257306870u, 4183546362u }, + { 4435502u, 3708493374u, 1607696753u } + } + }; +#endif // ifndef __CUDACC_RTC__ + +#ifdef CURAND_MRG32K3A_MATRICES_DEVICE_QUALIFIERS +#undef CURAND_MRG32K3A_MATRICES_DEVICE_QUALIFIERS +#endif + +#ifdef CURAND_MRG32K3A_MATRICES_HOST_QUALIFIERS +#undef CURAND_MRG32K3A_MATRICES_HOST_QUALIFIERS +#endif + +#endif /* !defined(CURAND_MRG32K3A_MATRICES_H_) */ diff --git a/cuda_toolkit/include/curand_mtgp32.h b/cuda_toolkit/include/curand_mtgp32.h new file mode 100644 index 0000000000000000000000000000000000000000..bc6260f921ef47fc745c2965bd329111903bd029 --- /dev/null +++ b/cuda_toolkit/include/curand_mtgp32.h @@ -0,0 +1,210 @@ +/* + * Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#ifndef CURAND_MTGP32_H +#define CURAND_MTGP32_H +/* + * @file curand_mtgp32.h + * + * @brief Mersenne Twister for Graphic Processors (mtgp32), which + * generates 32-bit unsigned integers and single precision floating + * point numbers based on IEEE 754 format. + * + * @author Mutsuo Saito (Hiroshima University) + * @author Makoto Matsumoto (Hiroshima University) + * + */ +/* + * Copyright (c) 2009, 2010 Mutsuo Saito, Makoto Matsumoto and Hiroshima + * University. All rights reserved. + * Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima + * University and University of Tokyo. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the Hiroshima University nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#define MTGPDC_MEXP 11213 +#define MTGPDC_N 351 +#define MTGPDC_FLOOR_2P 256 +#define MTGPDC_CEIL_2P 512 +#define MTGPDC_PARAM_TABLE mtgp32dc_params_fast_11213 +#define MTGP32_STATE_SIZE 1024 +#define MTGP32_STATE_MASK 1023 +#define CURAND_NUM_MTGP32_PARAMS 200 +#define MEXP 11213 +#define THREAD_NUM MTGPDC_FLOOR_2P +#define LARGE_SIZE (THREAD_NUM * 3) +#define TBL_SIZE 16 + +/** + * \addtogroup DEVICE Device API + * + * @{ + */ + +/* + * \struct MTGP32_PARAMS_FAST_T + * MTGP32 parameters. + * Some element is redundant to keep structure simple. + * + * \b pos is a pick up position which is selected to have good + * performance on graphic processors. 3 < \b pos < Q, where Q is a + * maximum number such that the size of status array - Q is a power of + * 2. For example, when \b mexp is 44497, size of 32-bit status array + * is 696, and Q is 184, then \b pos is between 4 and 183. This means + * 512 parallel calculations is allowed when \b mexp is 44497. + * + * \b poly_sha1 is SHA1 digest of the characteristic polynomial of + * state transition function. SHA1 is calculated based on printing + * form of the polynomial. This is important when we use parameters + * generated by the dynamic creator which + * + * \b mask This is a mask to make the dimension of state space have + * just Mersenne Prime. This is redundant. + */ + +struct mtgp32_params_fast; + +struct mtgp32_params_fast { + int mexp; /*< Mersenne exponent. This is redundant. */ + int pos; /*< pick up position. */ + int sh1; /*< shift value 1. 0 < sh1 < 32. */ + int sh2; /*< shift value 2. 0 < sh2 < 32. */ + unsigned int tbl[16]; /*< a small matrix. */ + unsigned int tmp_tbl[16]; /*< a small matrix for tempering. */ + unsigned int flt_tmp_tbl[16]; /*< a small matrix for tempering and + converting to float. */ + unsigned int mask; /*< This is a mask for state space */ + unsigned char poly_sha1[21]; /*< SHA1 digest */ +}; + +/** \cond UNHIDE_TYPEDEFS */ +typedef struct mtgp32_params_fast mtgp32_params_fast_t; +/** \endcond */ + +/* + * Generator Parameters. + */ +struct mtgp32_kernel_params; +struct mtgp32_kernel_params { + unsigned int pos_tbl[CURAND_NUM_MTGP32_PARAMS]; + unsigned int param_tbl[CURAND_NUM_MTGP32_PARAMS][TBL_SIZE]; + unsigned int temper_tbl[CURAND_NUM_MTGP32_PARAMS][TBL_SIZE]; + unsigned int single_temper_tbl[CURAND_NUM_MTGP32_PARAMS][TBL_SIZE]; + unsigned int sh1_tbl[CURAND_NUM_MTGP32_PARAMS]; + unsigned int sh2_tbl[CURAND_NUM_MTGP32_PARAMS]; + unsigned int mask[1]; +}; + +/** \cond UNHIDE_TYPEDEFS */ +typedef struct mtgp32_kernel_params mtgp32_kernel_params_t; +/** \endcond */ + + + +/* + * kernel I/O + * This structure must be initialized before first use. + */ + +/* MTGP (Mersenne Twister) RNG */ +/* This generator uses the Mersenne Twister algorithm of + * http://arxiv.org/abs/1005.4973v2 + * Has period 2^11213. +*/ + +/** + * CURAND MTGP32 state + */ +struct curandStateMtgp32; + +struct curandStateMtgp32 { + unsigned int s[MTGP32_STATE_SIZE]; + int offset; + int pIdx; + mtgp32_kernel_params_t * k; +}; + +/* + * CURAND MTGP32 state + */ +/** \cond UNHIDE_TYPEDEFS */ +typedef struct curandStateMtgp32 curandStateMtgp32_t; +/** \endcond */ + +/** @} */ + +#endif + diff --git a/cuda_toolkit/include/curand_mtgp32_host.h b/cuda_toolkit/include/curand_mtgp32_host.h new file mode 100644 index 0000000000000000000000000000000000000000..eb5d8ca6ee598197e7e762462f7950ad3c436ac2 --- /dev/null +++ b/cuda_toolkit/include/curand_mtgp32_host.h @@ -0,0 +1,516 @@ +/* + * Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/* + * curand_mtgp32_host.h + * + * + * MTGP32-11213 + * + * Mersenne Twister RNG for the GPU + * + * The period of generated integers is 211213-1. + * + * This code generates 32-bit unsigned integers, and + * single precision floating point numbers uniformly distributed + * in the range [1, 2). (float r; 1.0 <= r < 2.0) + */ + +/* + * Copyright (c) 2009, 2010 Mutsuo Saito, Makoto Matsumoto and Hiroshima + * University. All rights reserved. + * Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima + * University and University of Tokyo. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the Hiroshima University nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#if !defined CURAND_MTGP32_HOST_H +#define CURAND_MTGP32_HOST_H + +#if !defined(QUALIFIERS) +#define QUALIFIERS static inline __device__ +#endif + +#include +#include +#include +#include +#include "curand.h" +#include "curand_mtgp32.h" +#include "curand_mtgp32dc_p_11213.h" + + +/** + * \addtogroup DEVICE Device API + * + * @{ + */ + +static const unsigned int non_zero = 0x4d544750; + +/* + * This function represents a function used in the initialization + * by mtgp32_init_by_array() and mtgp32_init_by_str(). + * @param[in] x 32-bit integer + * @return 32-bit integer + */ +static __forceinline__ unsigned int ini_func1(unsigned int x) { + return (x ^ (x >> 27)) * (1664525); +} + +/* + * This function represents a function used in the initialization + * by mtgp32_init_by_array() and mtgp32_init_by_str(). + * @param[in] x 32-bit integer + * @return 32-bit integer + */ +static __forceinline__ unsigned int ini_func2(unsigned int x) { + return (x ^ (x >> 27)) * (1566083941); +} + +/* + * This function initializes the internal state array with a 32-bit + * integer seed. The allocated memory should be freed by calling + * mtgp32_free(). \b para should be one of the elements in the + * parameter table (mtgp32-param-ref.c). + * + * This function is call by cuda program, because cuda program uses + * another structure and another allocation method. + * + * @param[out] array MTGP internal status vector. + * @param[in] para parameter structure + * @param[in] seed a 32-bit integer used as the seed. + */ +static __forceinline__ __host__ +void mtgp32_init_state(unsigned int state[], + const mtgp32_params_fast_t *para, unsigned int seed) { + int i; + int size = para->mexp / 32 + 1; + unsigned int hidden_seed; + unsigned int tmp; + hidden_seed = para->tbl[4] ^ (para->tbl[8] << 16); + tmp = hidden_seed; + tmp += tmp >> 16; + tmp += tmp >> 8; + memset(state, tmp & 0xff, sizeof(unsigned int) * size); + state[0] = seed; + state[1] = hidden_seed; + for (i = 1; i < size; i++) { + state[i] ^= (1812433253) * (state[i - 1] ^ (state[i - 1] >> 30)) + i; + } +} + +/* + * This function initializes the internal state array + * with a 32-bit integer array. \b para should be one of the elements in + * the parameter table (mtgp32-param-ref.c). + * + * @param[out] mtgp32 MTGP structure. + * @param[in] para parameter structure + * @param[in] array a 32-bit integer array used as a seed. + * @param[in] length length of the array. + * @return CURAND_STATUS_SUCCESS + */ +static __forceinline__ __host__ +int mtgp32_init_by_array(unsigned int state[], + const mtgp32_params_fast_t *para, + unsigned int *array, int length) { + int i, j, count; + unsigned int r; + int lag; + int mid; + int size = para->mexp / 32 + 1; + unsigned int hidden_seed; + unsigned int tmp; + + if (size >= 623) { + lag = 11; + } else if (size >= 68) { + lag = 7; + } else if (size >= 39) { + lag = 5; + } else { + lag = 3; + } + mid = (size - lag) / 2; + + hidden_seed = para->tbl[4] ^ (para->tbl[8] << 16); + tmp = hidden_seed; + tmp += tmp >> 16; + tmp += tmp >> 8; + memset(state, tmp & 0xff, sizeof(unsigned int) * size); + state[0] = hidden_seed; + + if (length + 1 > size) { + count = length + 1; + } else { + count = size; + } + r = ini_func1(state[0] ^ state[mid] ^ state[size - 1]); + state[mid] += r; + r += length; + state[(mid + lag) % size] += r; + state[0] = r; + i = 1; + count--; + for (i = 1, j = 0; (j < count) && (j < length); j++) { + r = ini_func1(state[i] ^ state[(i + mid) % size] + ^ state[(i + size - 1) % size]); + state[(i + mid) % size] += r; + r += array[j] + i; + state[(i + mid + lag) % size] += r; + state[i] = r; + i = (i + 1) % size; + } + for (; j < count; j++) { + r = ini_func1(state[i] ^ state[(i + mid) % size] + ^ state[(i + size - 1) % size]); + state[(i + mid) % size] += r; + r += i; + state[(i + mid + lag) % size] += r; + state[i] = r; + i = (i + 1) % size; + } + for (j = 0; j < size; j++) { + r = ini_func2(state[i] + state[(i + mid) % size] + + state[(i + size - 1) % size]); + state[(i + mid) % size] ^= r; + r -= i; + state[(i + mid + lag) % size] ^= r; + state[i] = r; + i = (i + 1) % size; + } + if (state[size - 1] == 0) { + state[size - 1] = non_zero; + } + return 0; +} + +/* + * This function initializes the internal state array + * with a character array. \b para should be one of the elements in + * the parameter table (mtgp32-param-ref.c). + * This is the same algorithm with mtgp32_init_by_array(), but hope to + * be more useful. + * + * @param[out] mtgp32 MTGP structure. + * @param[in] para parameter structure + * @param[in] array a character array used as a seed. (terminated by zero.) + * @return memory allocation result. if 0 then O.K. + */ +static __forceinline__ __host__ +int mtgp32_init_by_str(unsigned int state[], + const mtgp32_params_fast_t *para, unsigned char *array) { + int i, j, count; + unsigned int r; + int lag; + int mid; + int size = para->mexp / 32 + 1; + int length = (unsigned int)strlen((char *)array); + unsigned int hidden_seed; + unsigned int tmp; + + if (size >= 623) { + lag = 11; + } else if (size >= 68) { + lag = 7; + } else if (size >= 39) { + lag = 5; + } else { + lag = 3; + } + mid = (size - lag) / 2; + + hidden_seed = para->tbl[4] ^ (para->tbl[8] << 16); + tmp = hidden_seed; + tmp += tmp >> 16; + tmp += tmp >> 8; + memset(state, tmp & 0xff, sizeof(unsigned int) * size); + state[0] = hidden_seed; + + if (length + 1 > size) { + count = length + 1; + } else { + count = size; + } + r = ini_func1(state[0] ^ state[mid] ^ state[size - 1]); + state[mid] += r; + r += length; + state[(mid + lag) % size] += r; + state[0] = r; + i = 1; + count--; + for (i = 1, j = 0; (j < count) && (j < length); j++) { + r = ini_func1(state[i] ^ state[(i + mid) % size] + ^ state[(i + size - 1) % size]); + state[(i + mid) % size] += r; + r += array[j] + i; + state[(i + mid + lag) % size] += r; + state[i] = r; + i = (i + 1) % size; + } + for (; j < count; j++) { + r = ini_func1(state[i] ^ state[(i + mid) % size] + ^ state[(i + size - 1) % size]); + state[(i + mid) % size] += r; + r += i; + state[(i + mid + lag) % size] += r; + state[i] = r; + i = (i + 1) % size; + } + for (j = 0; j < size; j++) { + r = ini_func2(state[i] + state[(i + mid) % size] + + state[(i + size - 1) % size]); + state[(i + mid) % size] ^= r; + r -= i; + state[(i + mid + lag) % size] ^= r; + state[i] = r; + i = (i + 1) % size; + } + if (state[size - 1] == 0) { + state[size - 1] = non_zero; + } + return 0; +} + +template +static __forceinline__ __host__ +curandStatus_t curandMakeMTGP32ConstantsImpl(const mtgp32_params_fast_t params[], ParamsType * p, const int block_num) +{ + const int size1 = sizeof(unsigned int) * block_num; + const int size2 = sizeof(unsigned int) * block_num * TBL_SIZE; + unsigned int *h_pos_tbl; + unsigned int *h_sh1_tbl; + unsigned int *h_sh2_tbl; + unsigned int *h_param_tbl; + unsigned int *h_temper_tbl; + unsigned int *h_single_temper_tbl; + unsigned int *h_mask; + curandStatus_t status = CURAND_STATUS_SUCCESS; + + h_pos_tbl = (unsigned int *)malloc(size1); + h_sh1_tbl = (unsigned int *)malloc(size1); + h_sh2_tbl = (unsigned int *)malloc(size1); + h_param_tbl = (unsigned int *)malloc(size2); + h_temper_tbl = (unsigned int *)malloc(size2); + h_single_temper_tbl = (unsigned int *)malloc(size2); + h_mask = (unsigned int *)malloc(sizeof(unsigned int)); + if (h_pos_tbl == NULL + || h_sh1_tbl == NULL + || h_sh2_tbl == NULL + || h_param_tbl == NULL + || h_temper_tbl == NULL + || h_single_temper_tbl == NULL + || h_mask == NULL) { + if (h_pos_tbl != NULL) free(h_pos_tbl); + if (h_sh1_tbl != NULL) free(h_sh1_tbl); + if (h_sh2_tbl != NULL) free(h_sh2_tbl); + if (h_param_tbl != NULL) free(h_param_tbl); + if (h_temper_tbl != NULL) free(h_temper_tbl); + if (h_single_temper_tbl != NULL) free(h_single_temper_tbl); + if (h_mask != NULL) free(h_mask); + status = CURAND_STATUS_ALLOCATION_FAILED; + } else { + + h_mask[0] = params[0].mask; + for (int i = 0; i < block_num; i++) { + h_pos_tbl[i] = params[i].pos; + h_sh1_tbl[i] = params[i].sh1; + h_sh2_tbl[i] = params[i].sh2; + for (int j = 0; j < TBL_SIZE; j++) { + h_param_tbl[i * TBL_SIZE + j] = params[i].tbl[j]; + h_temper_tbl[i * TBL_SIZE + j] = params[i].tmp_tbl[j]; + h_single_temper_tbl[i * TBL_SIZE + j] = params[i].flt_tmp_tbl[j]; + } + } + if (cudaMemcpy( p->pos_tbl, + h_pos_tbl, size1, cudaMemcpyHostToDevice) != cudaSuccess) + { + status = CURAND_STATUS_INITIALIZATION_FAILED; + } else + if (cudaMemcpy( p->sh1_tbl, + h_sh1_tbl, size1, cudaMemcpyHostToDevice) != cudaSuccess) + { + status = CURAND_STATUS_INITIALIZATION_FAILED; + } else + if (cudaMemcpy( p->sh2_tbl, + h_sh2_tbl, size1, cudaMemcpyHostToDevice) != cudaSuccess) + { + status = CURAND_STATUS_INITIALIZATION_FAILED; + } else + if (cudaMemcpy( p->param_tbl, + h_param_tbl, size2, cudaMemcpyHostToDevice) != cudaSuccess) + { + status = CURAND_STATUS_INITIALIZATION_FAILED; + } else + if (cudaMemcpy( p->temper_tbl, + h_temper_tbl, size2, cudaMemcpyHostToDevice) != cudaSuccess) + { + status = CURAND_STATUS_INITIALIZATION_FAILED; + } else + if (cudaMemcpy( p->single_temper_tbl, + h_single_temper_tbl, size2, cudaMemcpyHostToDevice) != cudaSuccess) + { + status = CURAND_STATUS_INITIALIZATION_FAILED; + } else + if (cudaMemcpy( p->mask, + h_mask, sizeof(unsigned int), cudaMemcpyHostToDevice) != cudaSuccess) + { + status = CURAND_STATUS_INITIALIZATION_FAILED; + } + } + if (h_pos_tbl != NULL) free(h_pos_tbl); + if (h_sh1_tbl != NULL) free(h_sh1_tbl); + if (h_sh2_tbl != NULL) free(h_sh2_tbl); + if (h_param_tbl != NULL) free(h_param_tbl); + if (h_temper_tbl != NULL) free(h_temper_tbl); + if (h_single_temper_tbl != NULL)free(h_single_temper_tbl); + if (h_mask != NULL) free(h_mask); + return status; +} + +/** + * \brief Set up constant parameters for the mtgp32 generator + * + * This host-side helper function re-organizes CURAND_NUM_MTGP32_PARAMS sets of + * generator parameters for use by kernel functions and copies the + * result to the specified location in device memory. + * + * \param params - Pointer to an array of type mtgp32_params_fast_t in host memory + * \param p - pointer to a structure of type mtgp32_kernel_params_t in device memory. + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if host memory could not be allocated + * - CURAND_STATUS_INITIALIZATION_FAILED if the copy to device memory failed + * - CURAND_STATUS_SUCCESS otherwise + */ +static __forceinline__ __host__ +curandStatus_t curandMakeMTGP32Constants(const mtgp32_params_fast_t params[], mtgp32_kernel_params_t * p) +{ + return curandMakeMTGP32ConstantsImpl(params, p, CURAND_NUM_MTGP32_PARAMS); +} + +/** + * \brief Set up initial states for the mtgp32 generator + * + * This host-side helper function initializes a number of states (one parameter set per state) for + * an mtgp32 generator. To accomplish this it allocates a state array in host memory, + * initializes that array, and copies the result to device memory. + * + * \param s - pointer to an array of states in device memory + * \param params - Pointer to an array of type mtgp32_params_fast_t in host memory + * \param k - pointer to a structure of type mtgp32_kernel_params_t in device memory + * \param n - number of parameter sets/states to initialize + * \param seed - seed value + * + * \return + * - CURAND_STATUS_ALLOCATION_FAILED if host memory state could not be allocated + * - CURAND_STATUS_INITIALIZATION_FAILED if the copy to device memory failed + * - CURAND_STATUS_SUCCESS otherwise + */ +static __forceinline__ __host__ +curandStatus_t CURANDAPI curandMakeMTGP32KernelState(curandStateMtgp32_t *s, + mtgp32_params_fast_t params[], + mtgp32_kernel_params_t *k, + int n, + unsigned long long seed) +{ + int i; + curandStatus_t status = CURAND_STATUS_SUCCESS; + curandStateMtgp32_t *h_status =(curandStateMtgp32_t *) malloc(sizeof(curandStateMtgp32_t) * n); + if (h_status == NULL) { + status = CURAND_STATUS_ALLOCATION_FAILED; + } else { + seed = seed ^ (seed >> 32); + for (i = 0; i < n; i++) { + mtgp32_init_state(&(h_status[i].s[0]), ¶ms[i],(unsigned int)seed + i + 1); + h_status[i].offset = 0; + h_status[i].pIdx = i; + h_status[i].k = k; + } + if (cudaMemcpy(s, h_status, + sizeof(curandStateMtgp32_t) * n, + cudaMemcpyHostToDevice) != cudaSuccess) { + status = CURAND_STATUS_INITIALIZATION_FAILED; + } + } + free(h_status); + return status; +} + +/** @} */ + +#endif + + diff --git a/cuda_toolkit/include/curand_mtgp32_kernel.h b/cuda_toolkit/include/curand_mtgp32_kernel.h new file mode 100644 index 0000000000000000000000000000000000000000..7e0c58442c1f5d093077e5ed843bbd594693c447 --- /dev/null +++ b/cuda_toolkit/include/curand_mtgp32_kernel.h @@ -0,0 +1,386 @@ +/* + * Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/* + * curand_mtgp32_kernel.h + * + * + * MTGP32-11213 + * + * Mersenne Twister RNG for the GPU + * + * The period of generated integers is 211213-1. + * + * This code generates 32-bit unsigned integers, and + * single precision floating point numbers uniformly distributed + * in the range [1, 2). (float r; 1.0 <= r < 2.0) + */ + +/* + * Copyright (c) 2009, 2010 Mutsuo Saito, Makoto Matsumoto and Hiroshima + * University. All rights reserved. + * Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima + * University and University of Tokyo. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the Hiroshima University nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#if !defined CURAND_MTGP32_KERNEL_H +#define CURAND_MTGP32_KERNEL_H + +#if !defined(QUALIFIERS) +#define QUALIFIERS static __forceinline__ __device__ +#endif + +#ifndef __CUDACC_RTC__ +#include +#include +#include +#include +#endif // ifndef __CUDACC_RTC__ +#include +#include "curand.h" +#include "curand_mtgp32.h" + +/** + * \addtogroup DEVICE Device API + * + * @{ + */ + +#ifndef __CUDA_ARCH__ +// define blockDim and threadIdx for host compatibility call +extern const dim3 blockDim; +extern const uint3 threadIdx; +#endif + + +/* + * The function of the recursion formula calculation. + * + * @param[in] X1 the farthest part of state array. + * @param[in] X2 the second farthest part of state array. + * @param[in] Y a part of state array. + * @param[in] bid block id. + * @return output + */ +QUALIFIERS unsigned int para_rec(mtgp32_kernel_params_t * k,unsigned int X1, unsigned int X2, unsigned int Y, int bid) { + unsigned int X = (X1 & k->mask[0]) ^ X2; + unsigned int MAT; + + X ^= X << k->sh1_tbl[bid]; + Y = X ^ (Y >> k->sh2_tbl[bid]); + MAT = k->param_tbl[bid][Y & 0x0f]; + return Y ^ MAT; +} + +/* + * The tempering function. + * + * @param[in] V the output value should be tempered. + * @param[in] T the tempering helper value. + * @param[in] bid block id. + * @return the tempered value. + */ +QUALIFIERS unsigned int temper(mtgp32_kernel_params_t * k,unsigned int V, unsigned int T, int bid) { + unsigned int MAT; + + T ^= T >> 16; + T ^= T >> 8; + MAT = k->temper_tbl[bid][T & 0x0f]; + return V ^ MAT; +} + +/* + * The tempering and converting function. + * By using the preset table, converting to IEEE format + * and tempering are done simultaneously. + * + * @param[in] V the output value should be tempered. + * @param[in] T the tempering helper value. + * @param[in] bid block id. + * @return the tempered and converted value. + */ +QUALIFIERS unsigned int temper_single(mtgp32_kernel_params_t * k,unsigned int V, unsigned int T, int bid) { + unsigned int MAT; + unsigned int r; + + T ^= T >> 16; + T ^= T >> 8; + MAT = k->single_temper_tbl[bid][T & 0x0f]; + r = (V >> 9) ^ MAT; + return r; +} + +/** + * \brief Return 32-bits of pseudorandomness from a mtgp32 generator. + * + * Return 32-bits of pseudorandomness from the mtgp32 generator in \p state, + * increment position of generator by the number of threads in the block. + * Note the number of threads in the block can not exceed 256. + * + * \param state - Pointer to state to update + * + * \return 32-bits of pseudorandomness as an unsigned int, all bits valid to use. + */ +QUALIFIERS unsigned int curand(curandStateMtgp32_t *state) +{ + unsigned int t; + unsigned int d; + int pos = state->k->pos_tbl[state->pIdx]; + unsigned int r; + unsigned int o; + + d = blockDim.z * blockDim.y * blockDim.x; + //assert( d <= 256 ); + t = (blockDim.z * blockDim.y * threadIdx.z) + (blockDim.x * threadIdx.y) + threadIdx.x; + r = para_rec(state->k, state->s[(t + state->offset) & MTGP32_STATE_MASK], + state->s[(t + state->offset + 1) & MTGP32_STATE_MASK], + state->s[(t + state->offset + pos) & MTGP32_STATE_MASK], + state->pIdx); + + state->s[(t + state->offset + MTGPDC_N) & MTGP32_STATE_MASK] = r; + o = temper(state->k, r, + state->s[(t + state->offset + pos -1) & MTGP32_STATE_MASK], + state->pIdx); +NV_IF_TARGET(NV_IS_DEVICE, + __syncthreads(); +) + if (t == 0) + { + state->offset = (state->offset + d) & MTGP32_STATE_MASK; + } +NV_IF_TARGET(NV_IS_DEVICE, + __syncthreads(); +) + return o; + +} +/** + * \brief Return 32-bits of pseudorandomness from a specific position in a mtgp32 generator. + * + * Return 32-bits of pseudorandomness from position \p index of the mtgp32 generator in \p state, + * increment position of generator by \p n positions, which must be the total number of positions + * upddated in the state by the thread block, for this invocation. + * + * Note : + * Thread indices must range from 0...\ n - 1. + * The number of positions updated may not exceed 256. + * A thread block may update more than one state, but a given state may not be updated by more than one thread block. + * + * \param state - Pointer to state to update + * \param index - Index (0..255) of the position within the state to draw from and update + * \param n - The total number of postions in this state that are being updated by this invocation + * + * \return 32-bits of pseudorandomness as an unsigned int, all bits valid to use. + */ +QUALIFIERS unsigned int curand_mtgp32_specific(curandStateMtgp32_t *state, unsigned char index, unsigned char n) +{ + unsigned int t; + int pos = state->k->pos_tbl[state->pIdx]; + unsigned int r; + unsigned int o; + + t = index; + r = para_rec(state->k, state->s[(t + state->offset) & MTGP32_STATE_MASK], + state->s[(t + state->offset + 1) & MTGP32_STATE_MASK], + state->s[(t + state->offset + pos) & MTGP32_STATE_MASK], + state->pIdx); + + state->s[(t + state->offset + MTGPDC_N) & MTGP32_STATE_MASK] = r; + o = temper(state->k, r, + state->s[(t + state->offset + pos -1) & MTGP32_STATE_MASK], + state->pIdx); +NV_IF_TARGET(NV_IS_DEVICE, + __syncthreads(); +) + if (index == 0) + { + state->offset = (state->offset + n) & MTGP32_STATE_MASK; + } +NV_IF_TARGET(NV_IS_DEVICE, + __syncthreads(); +) + return o; +} +/** + * \brief Return a uniformly distributed float from a mtgp32 generator. + * + * Return a uniformly distributed float between \p 0.0f and \p 1.0f + * from the mtgp32 generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * Note: This alternate derivation of a uniform float is provided for completeness + * with the original source + * + * \param state - Pointer to state to update + * + * \return uniformly distributed float between \p 0.0f and \p 1.0f + */ +QUALIFIERS float curand_mtgp32_single(curandStateMtgp32_t *state) +{ + unsigned int t; + unsigned int d; + int pos = state->k->pos_tbl[state->pIdx]; + unsigned int r; + unsigned int o_u; + float o_f; + + + t = blockDim.z * blockDim.y; + d = t * blockDim.x; + //assert( d <= 256 ); + t += threadIdx.x; + r = para_rec(state->k, state->s[(t + state->offset) & MTGP32_STATE_MASK], + state->s[(t + state->offset + 1) & MTGP32_STATE_MASK], + state->s[(t + state->offset + pos) & MTGP32_STATE_MASK], + state->pIdx); + + state->s[t] = r; + o_u = temper_single(state->k, r, + state->s[(t + state->offset + pos -1) & MTGP32_STATE_MASK], + state->pIdx); +NV_IF_TARGET(NV_IS_DEVICE, + __syncthreads(); +) + if (threadIdx.x == 0) + { + state->offset = (state->offset + d) & MTGP32_STATE_MASK; + } +NV_IF_TARGET(NV_IS_DEVICE, + __syncthreads(); +) + memcpy(&o_f, &o_u, sizeof(o_u)); + return o_f; +} + +/** + * \brief Return a uniformly distributed float from a specific position in a mtgp32 generator. + * + * Return a uniformly distributed float between \p 0.0f and \p 1.0f + * from position \p index of the mtgp32 generator in \p state, and + * increment position of generator by \p n positions, which must be the total number of positions + * upddated in the state by the thread block, for this invocation. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * Note 1: + * Thread indices must range from 0...\p n - 1. + * The number of positions updated may not exceed 256. + * A thread block may update more than one state, but a given state may not be updated by more than one thread block. + * + * Note 2: This alternate derivation of a uniform float is provided for completeness + * with the original source + * + * \param state - Pointer to state to update + * \param index - Index (0..255) of the position within the state to draw from and update + * \param n - The total number of postions in this state that are being updated by this invocation + * + * \return uniformly distributed float between \p 0.0f and \p 1.0f + */ +QUALIFIERS float curand_mtgp32_single_specific(curandStateMtgp32_t *state, unsigned char index, unsigned char n) +{ + unsigned int t; + int pos = state->k->pos_tbl[state->pIdx]; + unsigned int r; + unsigned int o_u; + float o_f; + + t = index; + r = para_rec(state->k, state->s[(t + state->offset) & MTGP32_STATE_MASK], + state->s[(t + state->offset + 1) & MTGP32_STATE_MASK], + state->s[(t + state->offset + pos) & MTGP32_STATE_MASK], + state->pIdx); + + state->s[t] = r; + o_u = temper_single(state->k, r, + state->s[(t + state->offset + pos -1) & MTGP32_STATE_MASK], + state->pIdx); +NV_IF_TARGET(NV_IS_DEVICE, + __syncthreads(); +) + if (threadIdx.x == 0) + { + state->offset = (state->offset + n) & MTGP32_STATE_MASK; + } +NV_IF_TARGET(NV_IS_DEVICE, + __syncthreads(); +) + memcpy(&o_f, &o_u, sizeof(o_u)); + return o_f; +} + +/** @} */ + +#endif diff --git a/cuda_toolkit/include/curand_mtgp32dc_p_11213.h b/cuda_toolkit/include/curand_mtgp32dc_p_11213.h new file mode 100644 index 0000000000000000000000000000000000000000..5334e586bfb5776659cae07b51e06239ab4495d1 --- /dev/null +++ b/cuda_toolkit/include/curand_mtgp32dc_p_11213.h @@ -0,0 +1,11710 @@ +/* + * Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/* + * Multiple sets of generator parameters for Mersenne Twister + * with period 2**11213 -1 + */ +/* + * Copyright (c) 2009, 2010 Mutsuo Saito, Makoto Matsumoto and Hiroshima + * University. All rights reserved. + * Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima + * University and University of Tokyo. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the Hiroshima University nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if !defined CURAND_MTGP32DC_P_11213_H +#define CURAND_MTGP32DC_P_11213_H + +#include "curand_mtgp32.h" + + +#if (__cplusplus >= 201703L) && defined(__cpp_inline_variables) +inline const int mtgpdc_params_11213_num = 200; +#else +static const int mtgpdc_params_11213_num = 200; +#endif + +#if (__cplusplus >= 201703L) && defined(__cpp_inline_variables) +inline mtgp32_params_fast_t mtgp32dc_params_fast_11213[] +#else +static mtgp32_params_fast_t mtgp32dc_params_fast_11213[] +#endif + = { + { + /* No.0 delta:1599 weight:665 */ + 11213, + 88, + 19, + 5, + {(0x00000000), + (0xaba4d62c), + (0xbb076f87), + (0x10a3b9ab), + (0x22000000), + (0x89a4d62c), + (0x99076f87), + (0x32a3b9ab), + (0x000095ba), + (0xaba44396), + (0xbb07fa3d), + (0x10a32c11), + (0x220095ba), + (0x89a44396), + (0x9907fa3d), + (0x32a32c11)}, + {(0x00000000), + (0x06100000), + (0x25d80000), + (0x23c80000), + (0x282c0000), + (0x2e3c0000), + (0x0df40000), + (0x0be40000), + (0x3302de00), + (0x3512de00), + (0x16dade00), + (0x10cade00), + (0x1b2ede00), + (0x1d3ede00), + (0x3ef6de00), + (0x38e6de00)}, + {(0x3f800000), + (0x3f830800), + (0x3f92ec00), + (0x3f91e400), + (0x3f941600), + (0x3f971e00), + (0x3f86fa00), + (0x3f85f200), + (0x3f99816f), + (0x3f9a896f), + (0x3f8b6d6f), + (0x3f88656f), + (0x3f8d976f), + (0x3f8e9f6f), + (0x3f9f7b6f), + (0x3f9c736f)}, + (0xfff80000), + {0xcb,0xb0,0x3f,0xaa,0x65,0x0d,0xbd,0x1c,0x8c,0xc2, + 0x91,0x00,0x87,0x25,0x7f,0xf8,0x6f,0x23,0xf2,0x18,0x00} + }, + { + /* No.1 delta:1185 weight:1129 */ + 11213, + 84, + 15, + 12, + {(0x00000000), + (0x9a975707), + (0x75c21b11), + (0xef554c16), + (0x15500019), + (0x8fc7571e), + (0x60921b08), + (0xfa054c0f), + (0x0000d269), + (0x9a97856e), + (0x75c2c978), + (0xef559e7f), + (0x1550d270), + (0x8fc78577), + (0x6092c961), + (0xfa059e66)}, + {(0x00000000), + (0x00646c00), + (0x0810f000), + (0x08749c00), + (0x37028000), + (0x3766ec00), + (0x3f127000), + (0x3f761c00), + (0x00505e00), + (0x00343200), + (0x0840ae00), + (0x0824c200), + (0x3752de00), + (0x3736b200), + (0x3f422e00), + (0x3f264200)}, + {(0x3f800000), + (0x3f803236), + (0x3f840878), + (0x3f843a4e), + (0x3f9b8140), + (0x3f9bb376), + (0x3f9f8938), + (0x3f9fbb0e), + (0x3f80282f), + (0x3f801a19), + (0x3f842057), + (0x3f841261), + (0x3f9ba96f), + (0x3f9b9b59), + (0x3f9fa117), + (0x3f9f9321)}, + (0xfff80000), + {0x53,0xe0,0x89,0xe0,0x47,0x42,0x00,0xbd,0xe9,0x04, + 0xc9,0x11,0x5c,0xe3,0x97,0x94,0x94,0xd8,0xbb,0xfc,0x00} + }, + { + /* No.2 delta:2848 weight:755 */ + 11213, + 25, + 4, + 18, + {(0x00000000), + (0x507cbad4), + (0xe742103b), + (0xb73eaaef), + (0x71c00027), + (0x21bcbaf3), + (0x9682101c), + (0xc6feaac8), + (0x0000dd6c), + (0x507c67b8), + (0xe742cd57), + (0xb73e7783), + (0x71c0dd4b), + (0x21bc679f), + (0x9682cd70), + (0xc6fe77a4)}, + {(0x00000000), + (0x04210200), + (0x08040000), + (0x0c250200), + (0x11400000), + (0x15610200), + (0x19440000), + (0x1d650200), + (0x206f1e00), + (0x244e1c00), + (0x286b1e00), + (0x2c4a1c00), + (0x312f1e00), + (0x350e1c00), + (0x392b1e00), + (0x3d0a1c00)}, + {(0x3f800000), + (0x3f821081), + (0x3f840200), + (0x3f861281), + (0x3f88a000), + (0x3f8ab081), + (0x3f8ca200), + (0x3f8eb281), + (0x3f90378f), + (0x3f92270e), + (0x3f94358f), + (0x3f96250e), + (0x3f98978f), + (0x3f9a870e), + (0x3f9c958f), + (0x3f9e850e)}, + (0xfff80000), + {0x9e,0x64,0xa3,0x28,0x10,0x66,0x35,0x72,0xe3,0x07, + 0xf7,0xcf,0x5a,0xe3,0x57,0x6f,0x90,0x0c,0x28,0x79,0x00} + }, + { + /* No.3 delta:1100 weight:1261 */ + 11213, + 42, + 20, + 9, + {(0x00000000), + (0x3ef0ef20), + (0x9fddd9ea), + (0xa12d36ca), + (0x10300036), + (0x2ec0ef16), + (0x8fedd9dc), + (0xb11d36fc), + (0x00005ced), + (0x3ef0b3cd), + (0x9fdd8507), + (0xa12d6a27), + (0x10305cdb), + (0x2ec0b3fb), + (0x8fed8531), + (0xb11d6a11)}, + {(0x00000000), + (0x24470c00), + (0x00268200), + (0x24618e00), + (0x00530000), + (0x24140c00), + (0x00758200), + (0x24328e00), + (0x105c5e00), + (0x341b5200), + (0x107adc00), + (0x343dd000), + (0x100f5e00), + (0x34485200), + (0x1029dc00), + (0x346ed000)}, + {(0x3f800000), + (0x3f922386), + (0x3f801341), + (0x3f9230c7), + (0x3f802980), + (0x3f920a06), + (0x3f803ac1), + (0x3f921947), + (0x3f882e2f), + (0x3f9a0da9), + (0x3f883d6e), + (0x3f9a1ee8), + (0x3f8807af), + (0x3f9a2429), + (0x3f8814ee), + (0x3f9a3768)}, + (0xfff80000), + {0x9b,0x1d,0x8b,0x59,0x56,0x8e,0x7b,0x75,0x24,0x4a, + 0xaf,0x49,0x6e,0xcf,0xcb,0x5d,0x67,0x00,0x31,0xac,0x00} + }, + { + /* No.4 delta:5389 weight:1871 */ + 11213, + 22, + 1, + 5, + {(0x00000000), + (0xb004feb9), + (0x03b7c894), + (0xb3b3362d), + (0x0750004d), + (0xb754fef4), + (0x04e7c8d9), + (0xb4e33660), + (0x000049e4), + (0xb004b75d), + (0x03b78170), + (0xb3b37fc9), + (0x075049a9), + (0xb754b710), + (0x04e7813d), + (0xb4e37f84)}, + {(0x00000000), + (0x48698800), + (0x04010000), + (0x4c688800), + (0x60340000), + (0x285d8800), + (0x64350000), + (0x2c5c8800), + (0x20065e00), + (0x686fd600), + (0x24075e00), + (0x6c6ed600), + (0x40325e00), + (0x085bd600), + (0x44335e00), + (0x0c5ad600)}, + {(0x3f800000), + (0x3fa434c4), + (0x3f820080), + (0x3fa63444), + (0x3fb01a00), + (0x3f942ec4), + (0x3fb21a80), + (0x3f962e44), + (0x3f90032f), + (0x3fb437eb), + (0x3f9203af), + (0x3fb6376b), + (0x3fa0192f), + (0x3f842deb), + (0x3fa219af), + (0x3f862d6b)}, + (0xfff80000), + {0xbb,0x80,0x47,0x21,0x2c,0xbd,0xd4,0x7b,0xf3,0xb3, + 0xbd,0x4d,0x05,0x36,0xf5,0x4d,0xe7,0x89,0xdc,0x11,0x00} + }, + { + /* No.5 delta:2280 weight:1243 */ + 11213, + 11, + 16, + 1, + {(0x00000000), + (0x646a361c), + (0xe36e4823), + (0x87047e3f), + (0x2b20005f), + (0x4f4a3643), + (0xc84e487c), + (0xac247e60), + (0x0000caac), + (0x646afcb0), + (0xe36e828f), + (0x8704b493), + (0x2b20caf3), + (0x4f4afcef), + (0xc84e82d0), + (0xac24b4cc)}, + {(0x00000000), + (0xd49c4200), + (0x0b98f000), + (0xdf04b200), + (0x24007200), + (0xf09c3000), + (0x2f988200), + (0xfb04c000), + (0x5d311e00), + (0x89ad5c00), + (0x56a9ee00), + (0x8235ac00), + (0x79316c00), + (0xadad2e00), + (0x72a99c00), + (0xa635de00)}, + {(0x3f800000), + (0x3fea4e21), + (0x3f85cc78), + (0x3fef8259), + (0x3f920039), + (0x3ff84e18), + (0x3f97cc41), + (0x3ffd8260), + (0x3fae988f), + (0x3fc4d6ae), + (0x3fab54f7), + (0x3fc11ad6), + (0x3fbc98b6), + (0x3fd6d697), + (0x3fb954ce), + (0x3fd31aef)}, + (0xfff80000), + {0x24,0x94,0x81,0x62,0xb4,0x6f,0x10,0x4e,0x66,0xd1, + 0xb4,0xdd,0xa0,0x92,0x2e,0xdf,0x8d,0x6b,0x03,0xa3,0x00} + }, + { + /* No.6 delta:722 weight:1357 */ + 11213, + 76, + 16, + 6, + {(0x00000000), + (0x1bb96b3c), + (0x7c6323a4), + (0x67da4898), + (0x22400061), + (0x39f96b5d), + (0x5e2323c5), + (0x459a48f9), + (0x00004c61), + (0x1bb9275d), + (0x7c636fc5), + (0x67da04f9), + (0x22404c00), + (0x39f9273c), + (0x5e236fa4), + (0x459a0498)}, + {(0x00000000), + (0x08258800), + (0x1042c000), + (0x18674800), + (0x00203000), + (0x0805b800), + (0x1062f000), + (0x18477800), + (0x70c01e00), + (0x78e59600), + (0x6082de00), + (0x68a75600), + (0x70e02e00), + (0x78c5a600), + (0x60a2ee00), + (0x68876600)}, + {(0x3f800000), + (0x3f8412c4), + (0x3f882160), + (0x3f8c33a4), + (0x3f801018), + (0x3f8402dc), + (0x3f883178), + (0x3f8c23bc), + (0x3fb8600f), + (0x3fbc72cb), + (0x3fb0416f), + (0x3fb453ab), + (0x3fb87017), + (0x3fbc62d3), + (0x3fb05177), + (0x3fb443b3)}, + (0xfff80000), + {0x06,0x1a,0x0a,0x3e,0x05,0xb0,0xd2,0xab,0x76,0xef, + 0xe5,0xf6,0xe4,0x09,0x02,0x41,0x4b,0x21,0xef,0x76,0x00} + }, + { + /* No.7 delta:3952 weight:825 */ + 11213, + 11, + 15, + 16, + {(0x00000000), + (0xa49b7ddb), + (0xbc75e45f), + (0x18ee9984), + (0x75600076), + (0xd1fb7dad), + (0xc915e429), + (0x6d8e99f2), + (0x0000c4f9), + (0xa49bb922), + (0xbc7520a6), + (0x18ee5d7d), + (0x7560c48f), + (0xd1fbb954), + (0xc91520d0), + (0x6d8e5d0b)}, + {(0x00000000), + (0xf0015000), + (0x0a4c2c00), + (0xfa4d7c00), + (0x0482b000), + (0xf483e000), + (0x0ece9c00), + (0xfecfcc00), + (0x45105e00), + (0xb5110e00), + (0x4f5c7200), + (0xbf5d2200), + (0x4192ee00), + (0xb193be00), + (0x4bdec200), + (0xbbdf9200)}, + {(0x3f800000), + (0x3ff800a8), + (0x3f852616), + (0x3ffd26be), + (0x3f824158), + (0x3ffa41f0), + (0x3f87674e), + (0x3fff67e6), + (0x3fa2882f), + (0x3fda8887), + (0x3fa7ae39), + (0x3fdfae91), + (0x3fa0c977), + (0x3fd8c9df), + (0x3fa5ef61), + (0x3fddefc9)}, + (0xfff80000), + {0xa9,0x6f,0x34,0xf9,0xdd,0xff,0x0a,0x48,0x3c,0x3f, + 0x3e,0x6f,0x74,0x70,0x37,0x33,0x19,0xe4,0x24,0x9b,0x00} + }, + { + /* No.8 delta:4274 weight:1347 */ + 11213, + 42, + 6, + 11, + {(0x00000000), + (0x311b3c94), + (0xa1e0c93f), + (0x90fbf5ab), + (0x3c600082), + (0x0d7b3c16), + (0x9d80c9bd), + (0xac9bf529), + (0x0000b622), + (0x311b8ab6), + (0xa1e07f1d), + (0x90fb4389), + (0x3c60b6a0), + (0x0d7b8a34), + (0x9d807f9f), + (0xac9b430b)}, + {(0x00000000), + (0x80000000), + (0x00000000), + (0x80000000), + (0xc0000000), + (0x40000000), + (0xc0000000), + (0x40000000), + (0x20001e00), + (0xa0001e00), + (0x20001e00), + (0xa0001e00), + (0xe0001e00), + (0x60001e00), + (0xe0001e00), + (0x60001e00)}, + {(0x3f800000), + (0x3fc00000), + (0x3f800000), + (0x3fc00000), + (0x3fe00000), + (0x3fa00000), + (0x3fe00000), + (0x3fa00000), + (0x3f90000f), + (0x3fd0000f), + (0x3f90000f), + (0x3fd0000f), + (0x3ff0000f), + (0x3fb0000f), + (0x3ff0000f), + (0x3fb0000f)}, + (0xfff80000), + {0x3c,0x5a,0x73,0x0e,0xab,0x68,0x32,0x57,0x6f,0xe6, + 0x1d,0x93,0x6e,0xbd,0xef,0x1a,0x6f,0x25,0x1f,0x70,0x00} + }, + { + /* No.9 delta:1902 weight:1001 */ + 11213, + 60, + 6, + 11, + {(0x00000000), + (0xbc8ed6c0), + (0x4d9fbb3d), + (0xf1116dfd), + (0x8e70009d), + (0x32fed65d), + (0xc3efbba0), + (0x7f616d60), + (0x0000a00a), + (0xbc8e76ca), + (0x4d9f1b37), + (0xf111cdf7), + (0x8e70a097), + (0x32fe7657), + (0xc3ef1baa), + (0x7f61cd6a)}, + {(0x00000000), + (0xc0400400), + (0x00220000), + (0xc0620400), + (0x303e0000), + (0xf07e0400), + (0x301c0000), + (0xf05c0400), + (0x40021e00), + (0x80421a00), + (0x40201e00), + (0x80601a00), + (0x703c1e00), + (0xb07c1a00), + (0x701e1e00), + (0xb05e1a00)}, + {(0x3f800000), + (0x3fe02002), + (0x3f801100), + (0x3fe03102), + (0x3f981f00), + (0x3ff83f02), + (0x3f980e00), + (0x3ff82e02), + (0x3fa0010f), + (0x3fc0210d), + (0x3fa0100f), + (0x3fc0300d), + (0x3fb81e0f), + (0x3fd83e0d), + (0x3fb80f0f), + (0x3fd82f0d)}, + (0xfff80000), + {0x83,0x62,0x6c,0x11,0xe4,0x19,0x2b,0x9b,0x87,0x4d, + 0x8e,0x68,0xde,0x69,0x56,0xc5,0x44,0x33,0x4f,0x20,0x00} + }, + { + /* No.10 delta:1148 weight:927 */ + 11213, + 45, + 12, + 13, + {(0x00000000), + (0x06bc3338), + (0xdde8b9f9), + (0xdb548ac1), + (0xfb2000a5), + (0xfd9c339d), + (0x26c8b95c), + (0x20748a64), + (0x0000a4ec), + (0x06bc97d4), + (0xdde81d15), + (0xdb542e2d), + (0xfb20a449), + (0xfd9c9771), + (0x26c81db0), + (0x20742e88)}, + {(0x00000000), + (0x0c494c00), + (0x42040c00), + (0x4e4d4000), + (0x20090800), + (0x2c404400), + (0x620d0400), + (0x6e444800), + (0x10409e00), + (0x1c09d200), + (0x52449200), + (0x5e0dde00), + (0x30499600), + (0x3c00da00), + (0x724d9a00), + (0x7e04d600)}, + {(0x3f800000), + (0x3f8624a6), + (0x3fa10206), + (0x3fa726a0), + (0x3f900484), + (0x3f962022), + (0x3fb10682), + (0x3fb72224), + (0x3f88204f), + (0x3f8e04e9), + (0x3fa92249), + (0x3faf06ef), + (0x3f9824cb), + (0x3f9e006d), + (0x3fb926cd), + (0x3fbf026b)}, + (0xfff80000), + {0xf8,0x39,0x8a,0x36,0x0f,0x90,0x4f,0x3c,0x04,0x0c, + 0x0a,0x02,0xd4,0x04,0x1b,0xc9,0xc4,0x8e,0x15,0x55,0x00} + }, + { + /* No.11 delta:2163 weight:1669 */ + 11213, + 80, + 6, + 9, + {(0x00000000), + (0x247f444d), + (0xb70a5ab0), + (0x93751efd), + (0xc44000b5), + (0xe03f44f8), + (0x734a5a05), + (0x57351e48), + (0x0000554f), + (0x247f1102), + (0xb70a0fff), + (0x93754bb2), + (0xc44055fa), + (0xe03f11b7), + (0x734a0f4a), + (0x57354b07)}, + {(0x00000000), + (0x30200a00), + (0x106c0000), + (0x204c0a00), + (0x00180400), + (0x30380e00), + (0x10740400), + (0x20540e00), + (0x100a1e00), + (0x202a1400), + (0x00661e00), + (0x30461400), + (0x10121a00), + (0x20321000), + (0x007e1a00), + (0x305e1000)}, + {(0x3f800000), + (0x3f981005), + (0x3f883600), + (0x3f902605), + (0x3f800c02), + (0x3f981c07), + (0x3f883a02), + (0x3f902a07), + (0x3f88050f), + (0x3f90150a), + (0x3f80330f), + (0x3f98230a), + (0x3f88090d), + (0x3f901908), + (0x3f803f0d), + (0x3f982f08)}, + (0xfff80000), + {0x98,0xb0,0x30,0x32,0xcf,0x75,0x63,0xeb,0x3a,0xb6, + 0x4f,0x70,0x47,0x4e,0x6a,0xd1,0x7b,0x40,0xbd,0x90,0x00} + }, + { + /* No.12 delta:4985 weight:689 */ + 11213, + 81, + 8, + 18, + {(0x00000000), + (0xcdcab880), + (0xdedf1226), + (0x1315aaa6), + (0xd17000c6), + (0x1cbab846), + (0x0faf12e0), + (0xc265aa60), + (0x0000b647), + (0xcdca0ec7), + (0xdedfa461), + (0x13151ce1), + (0xd170b681), + (0x1cba0e01), + (0x0fafa4a7), + (0xc2651c27)}, + {(0x00000000), + (0x601c0000), + (0x08780000), + (0x68640000), + (0x00740000), + (0x60680000), + (0x080c0000), + (0x68100000), + (0x00a01e00), + (0x60bc1e00), + (0x08d81e00), + (0x68c41e00), + (0x00d41e00), + (0x60c81e00), + (0x08ac1e00), + (0x68b01e00)}, + {(0x3f800000), + (0x3fb00e00), + (0x3f843c00), + (0x3fb43200), + (0x3f803a00), + (0x3fb03400), + (0x3f840600), + (0x3fb40800), + (0x3f80500f), + (0x3fb05e0f), + (0x3f846c0f), + (0x3fb4620f), + (0x3f806a0f), + (0x3fb0640f), + (0x3f84560f), + (0x3fb4580f)}, + (0xfff80000), + {0x90,0xf2,0x51,0xc2,0x2d,0xc4,0x52,0x73,0x15,0xfa, + 0xeb,0xc3,0x64,0x51,0x48,0xf7,0xb1,0x26,0x38,0xb4,0x00} + }, + { + /* No.13 delta:6473 weight:513 */ + 11213, + 16, + 1, + 19, + {(0x00000000), + (0x2310a4f2), + (0x91c8cf8c), + (0xb2d86b7e), + (0x89c000d1), + (0xaad0a423), + (0x1808cf5d), + (0x3b186baf), + (0x0000f299), + (0x2310566b), + (0x91c83d15), + (0xb2d899e7), + (0x89c0f248), + (0xaad056ba), + (0x18083dc4), + (0x3b189936)}, + {(0x00000000), + (0x4c020000), + (0xa6800000), + (0xea820000), + (0x15000000), + (0x59020000), + (0xb3800000), + (0xff820000), + (0x29201e00), + (0x65221e00), + (0x8fa01e00), + (0xc3a21e00), + (0x3c201e00), + (0x70221e00), + (0x9aa01e00), + (0xd6a21e00)}, + {(0x3f800000), + (0x3fa60100), + (0x3fd34000), + (0x3ff54100), + (0x3f8a8000), + (0x3fac8100), + (0x3fd9c000), + (0x3fffc100), + (0x3f94900f), + (0x3fb2910f), + (0x3fc7d00f), + (0x3fe1d10f), + (0x3f9e100f), + (0x3fb8110f), + (0x3fcd500f), + (0x3feb510f)}, + (0xfff80000), + {0x89,0x7c,0x3c,0xc6,0x3d,0x0a,0xad,0xf2,0xa0,0xf5, + 0x0a,0x4c,0x4e,0x83,0xc5,0x45,0xdb,0xcb,0xb5,0x98,0x00} + }, + { + /* No.14 delta:1389 weight:725 */ + 11213, + 63, + 14, + 18, + {(0x00000000), + (0x81c7909c), + (0xecb46b0c), + (0x6d73fb90), + (0xf33000ef), + (0x72f79073), + (0x1f846be3), + (0x9e43fb7f), + (0x0000e902), + (0x81c7799e), + (0xecb4820e), + (0x6d731292), + (0xf330e9ed), + (0x72f77971), + (0x1f8482e1), + (0x9e43127d)}, + {(0x00000000), + (0x09001000), + (0x02010000), + (0x0b011000), + (0x00201800), + (0x09200800), + (0x02211800), + (0x0b210800), + (0x30039e00), + (0x39038e00), + (0x32029e00), + (0x3b028e00), + (0x30238600), + (0x39239600), + (0x32228600), + (0x3b229600)}, + {(0x3f800000), + (0x3f848008), + (0x3f810080), + (0x3f858088), + (0x3f80100c), + (0x3f849004), + (0x3f81108c), + (0x3f859084), + (0x3f9801cf), + (0x3f9c81c7), + (0x3f99014f), + (0x3f9d8147), + (0x3f9811c3), + (0x3f9c91cb), + (0x3f991143), + (0x3f9d914b)}, + (0xfff80000), + {0xb7,0x0b,0xee,0xcb,0xc6,0x29,0x7c,0xe3,0xc5,0x58, + 0x71,0xe7,0x4b,0xe5,0xc9,0x63,0xbd,0xa4,0x75,0xc7,0x00} + }, + { + /* No.15 delta:8365 weight:1135 */ + 11213, + 38, + 28, + 1, + {(0x00000000), + (0xe56c7b3b), + (0x759d951b), + (0x90f1ee20), + (0x1a6000fa), + (0xff0c7bc1), + (0x6ffd95e1), + (0x8a91eeda), + (0x00004474), + (0xe56c3f4f), + (0x759dd16f), + (0x90f1aa54), + (0x1a60448e), + (0xff0c3fb5), + (0x6ffdd195), + (0x8a91aaae)}, + {(0x00000000), + (0xc0410a00), + (0xe70c0400), + (0x274d0e00), + (0xfa3e8000), + (0x3a7f8a00), + (0x1d328400), + (0xdd738e00), + (0x20801e00), + (0xe0c11400), + (0xc78c1a00), + (0x07cd1000), + (0xdabe9e00), + (0x1aff9400), + (0x3db29a00), + (0xfdf39000)}, + {(0x3f800000), + (0x3fe02085), + (0x3ff38602), + (0x3f93a687), + (0x3ffd1f40), + (0x3f9d3fc5), + (0x3f8e9942), + (0x3feeb9c7), + (0x3f90400f), + (0x3ff0608a), + (0x3fe3c60d), + (0x3f83e688), + (0x3fed5f4f), + (0x3f8d7fca), + (0x3f9ed94d), + (0x3ffef9c8)}, + (0xfff80000), + {0xd2,0xa4,0x8f,0xf8,0x54,0x0f,0xe3,0x14,0x17,0xeb, + 0x17,0x78,0x41,0x78,0x69,0xbb,0x4b,0x01,0x85,0x8e,0x00} + }, + { + /* No.16 delta:6253 weight:641 */ + 11213, + 3, + 30, + 2, + {(0x00000000), + (0x83a2a3cb), + (0x52e0a64c), + (0xd1420587), + (0x9850010b), + (0x1bf2a2c0), + (0xcab0a747), + (0x4912048c), + (0x0000aaa5), + (0x83a2096e), + (0x52e00ce9), + (0xd142af22), + (0x9850abae), + (0x1bf20865), + (0xcab00de2), + (0x4912ae29)}, + {(0x00000000), + (0xe9100000), + (0x94d00000), + (0x7dc00000), + (0xdbcc0000), + (0x32dc0000), + (0x4f1c0000), + (0xa60c0000), + (0x09d01e00), + (0xe0c01e00), + (0x9d001e00), + (0x74101e00), + (0xd21c1e00), + (0x3b0c1e00), + (0x46cc1e00), + (0xafdc1e00)}, + {(0x3f800000), + (0x3ff48800), + (0x3fca6800), + (0x3fbee000), + (0x3fede600), + (0x3f996e00), + (0x3fa78e00), + (0x3fd30600), + (0x3f84e80f), + (0x3ff0600f), + (0x3fce800f), + (0x3fba080f), + (0x3fe90e0f), + (0x3f9d860f), + (0x3fa3660f), + (0x3fd7ee0f)}, + (0xfff80000), + {0xa6,0xc6,0x12,0x64,0xaf,0x79,0x40,0x50,0x7b,0xb9, + 0xa9,0xfa,0x9a,0xc0,0x7a,0xaf,0x63,0x83,0x39,0x6c,0x00} + }, + { + /* No.17 delta:5329 weight:467 */ + 11213, + 55, + 1, + 16, + {(0x00000000), + (0x2ce39cc8), + (0x6312ea87), + (0x4ff1764f), + (0x9ef00113), + (0xb2139ddb), + (0xfde2eb94), + (0xd101775c), + (0x00007ddc), + (0x2ce3e114), + (0x6312975b), + (0x4ff10b93), + (0x9ef07ccf), + (0xb213e007), + (0xfde29648), + (0xd1010a80)}, + {(0x00000000), + (0x0c021000), + (0xe3400000), + (0xef421000), + (0x02000000), + (0x0e021000), + (0xe1400000), + (0xed421000), + (0x50a01e00), + (0x5ca20e00), + (0xb3e01e00), + (0xbfe20e00), + (0x52a01e00), + (0x5ea20e00), + (0xb1e01e00), + (0xbde20e00)}, + {(0x3f800000), + (0x3f860108), + (0x3ff1a000), + (0x3ff7a108), + (0x3f810000), + (0x3f870108), + (0x3ff0a000), + (0x3ff6a108), + (0x3fa8500f), + (0x3fae5107), + (0x3fd9f00f), + (0x3fdff107), + (0x3fa9500f), + (0x3faf5107), + (0x3fd8f00f), + (0x3fdef107)}, + (0xfff80000), + {0xe4,0xb8,0x1d,0x0f,0x15,0xe2,0xd6,0xd2,0x30,0x67, + 0x18,0x06,0x38,0xd0,0x63,0x09,0x4d,0xc1,0xaa,0x48,0x00} + }, + { + /* No.18 delta:3046 weight:699 */ + 11213, + 9, + 9, + 15, + {(0x00000000), + (0x228294e5), + (0xc1861e7b), + (0xe3048a9e), + (0x6250012a), + (0x40d295cf), + (0xa3d61f51), + (0x81548bb4), + (0x00005800), + (0x2282cce5), + (0xc186467b), + (0xe304d29e), + (0x6250592a), + (0x40d2cdcf), + (0xa3d64751), + (0x8154d3b4)}, + {(0x00000000), + (0x57910c00), + (0xd07cc400), + (0x87edc800), + (0xa8036800), + (0xff926400), + (0x787fac00), + (0x2feea000), + (0x00521e00), + (0x57c31200), + (0xd02eda00), + (0x87bfd600), + (0xa8517600), + (0xffc07a00), + (0x782db200), + (0x2fbcbe00)}, + {(0x3f800000), + (0x3fabc886), + (0x3fe83e62), + (0x3fc3f6e4), + (0x3fd401b4), + (0x3fffc932), + (0x3fbc3fd6), + (0x3f97f750), + (0x3f80290f), + (0x3fabe189), + (0x3fe8176d), + (0x3fc3dfeb), + (0x3fd428bb), + (0x3fffe03d), + (0x3fbc16d9), + (0x3f97de5f)}, + (0xfff80000), + {0x3d,0xb7,0x41,0x11,0xf8,0x6e,0xe6,0x89,0x71,0x95, + 0x3b,0x7c,0x3a,0x38,0x60,0x12,0x4c,0xec,0xaa,0x83,0x00} + }, + { + /* No.19 delta:786 weight:1431 */ + 11213, + 75, + 17, + 6, + {(0x00000000), + (0x819ee5dc), + (0x4ffaa079), + (0xce6445a5), + (0xe6300137), + (0x67aee4eb), + (0xa9caa14e), + (0x28544492), + (0x00008a74), + (0x819e6fa8), + (0x4ffa2a0d), + (0xce64cfd1), + (0xe6308b43), + (0x67ae6e9f), + (0xa9ca2b3a), + (0x2854cee6)}, + {(0x00000000), + (0x98018000), + (0x20039800), + (0xb8021800), + (0x40104000), + (0xd811c000), + (0x6013d800), + (0xf8125800), + (0x00033e00), + (0x9802be00), + (0x2000a600), + (0xb8012600), + (0x40137e00), + (0xd812fe00), + (0x6010e600), + (0xf8116600)}, + {(0x3f800000), + (0x3fcc00c0), + (0x3f9001cc), + (0x3fdc010c), + (0x3fa00820), + (0x3fec08e0), + (0x3fb009ec), + (0x3ffc092c), + (0x3f80019f), + (0x3fcc015f), + (0x3f900053), + (0x3fdc0093), + (0x3fa009bf), + (0x3fec097f), + (0x3fb00873), + (0x3ffc08b3)}, + (0xfff80000), + {0x90,0xc1,0xc9,0xe7,0xea,0xaf,0xd9,0x5b,0x1f,0x93, + 0x8d,0xcd,0x9b,0xf4,0xbb,0x91,0x58,0xb2,0x03,0x70,0x00} + }, + { + /* No.20 delta:846 weight:909 */ + 11213, + 70, + 15, + 6, + {(0x00000000), + (0xc56d80c5), + (0x4bb862e9), + (0x8ed5e22c), + (0x92e00143), + (0x578d8186), + (0xd95863aa), + (0x1c35e36f), + (0x000095b5), + (0xc56d1570), + (0x4bb8f75c), + (0x8ed57799), + (0x92e094f6), + (0x578d1433), + (0xd958f61f), + (0x1c3576da)}, + {(0x00000000), + (0x20642000), + (0x2530d800), + (0x0554f800), + (0x01a05200), + (0x21c47200), + (0x24908a00), + (0x04f4aa00), + (0x00521e00), + (0x20363e00), + (0x2562c600), + (0x0506e600), + (0x01f24c00), + (0x21966c00), + (0x24c29400), + (0x04a6b400)}, + {(0x3f800000), + (0x3f903210), + (0x3f92986c), + (0x3f82aa7c), + (0x3f80d029), + (0x3f90e239), + (0x3f924845), + (0x3f827a55), + (0x3f80290f), + (0x3f901b1f), + (0x3f92b163), + (0x3f828373), + (0x3f80f926), + (0x3f90cb36), + (0x3f92614a), + (0x3f82535a)}, + (0xfff80000), + {0xd6,0xb1,0xe1,0x27,0x40,0x54,0x48,0x67,0x71,0xe5, + 0x2a,0x38,0xbf,0xa7,0x93,0x82,0x17,0xcd,0x71,0x33,0x00} + }, + { + /* No.21 delta:1909 weight:729 */ + 11213, + 63, + 15, + 17, + {(0x00000000), + (0x3c495454), + (0xf3a1ddf0), + (0xcfe889a4), + (0x1b200159), + (0x2769550d), + (0xe881dca9), + (0xd4c888fd), + (0x0000cd3b), + (0x3c49996f), + (0xf3a110cb), + (0xcfe8449f), + (0x1b20cc62), + (0x27699836), + (0xe8811192), + (0xd4c845c6)}, + {(0x00000000), + (0x08027000), + (0x9651d400), + (0x9e53a400), + (0x0040a400), + (0x0842d400), + (0x96117000), + (0x9e130000), + (0x006e9e00), + (0x086cee00), + (0x963f4a00), + (0x9e3d3a00), + (0x002e3a00), + (0x082c4a00), + (0x967fee00), + (0x9e7d9e00)}, + {(0x3f800000), + (0x3f840138), + (0x3fcb28ea), + (0x3fcf29d2), + (0x3f802052), + (0x3f84216a), + (0x3fcb08b8), + (0x3fcf0980), + (0x3f80374f), + (0x3f843677), + (0x3fcb1fa5), + (0x3fcf1e9d), + (0x3f80171d), + (0x3f841625), + (0x3fcb3ff7), + (0x3fcf3ecf)}, + (0xfff80000), + {0xc8,0xdc,0x70,0x0a,0x23,0xa5,0x20,0x35,0xa2,0xd7, + 0xd1,0x53,0xfc,0xe0,0xc1,0xde,0xc0,0x2b,0x65,0x4d,0x00} + }, + { + /* No.22 delta:2420 weight:985 */ + 11213, + 32, + 7, + 15, + {(0x00000000), + (0xd25d9ecf), + (0xb1288d77), + (0x637513b8), + (0xc3700160), + (0x112d9faf), + (0x72588c17), + (0xa00512d8), + (0x000093d5), + (0xd25d0d1a), + (0xb1281ea2), + (0x6375806d), + (0xc37092b5), + (0x112d0c7a), + (0x72581fc2), + (0xa005810d)}, + {(0x00000000), + (0x10134200), + (0x028b0000), + (0x12984200), + (0x50480000), + (0x405b4200), + (0x52c30000), + (0x42d04200), + (0x10ee5e00), + (0x00fd1c00), + (0x12655e00), + (0x02761c00), + (0x40a65e00), + (0x50b51c00), + (0x422d5e00), + (0x523e1c00)}, + {(0x3f800000), + (0x3f8809a1), + (0x3f814580), + (0x3f894c21), + (0x3fa82400), + (0x3fa02da1), + (0x3fa96180), + (0x3fa16821), + (0x3f88772f), + (0x3f807e8e), + (0x3f8932af), + (0x3f813b0e), + (0x3fa0532f), + (0x3fa85a8e), + (0x3fa116af), + (0x3fa91f0e)}, + (0xfff80000), + {0xd0,0xc2,0xd1,0x3e,0x09,0x41,0xc7,0x9c,0x09,0x33, + 0x25,0x5f,0x84,0x21,0xc4,0xcc,0xc5,0x43,0x2a,0x14,0x00} + }, + { + /* No.23 delta:985 weight:863 */ + 11213, + 70, + 12, + 10, + {(0x00000000), + (0x6e6163b2), + (0xa3cecdea), + (0xcdafae58), + (0xb670017d), + (0xd81162cf), + (0x15becc97), + (0x7bdfaf25), + (0x0000d554), + (0x6e61b6e6), + (0xa3ce18be), + (0xcdaf7b0c), + (0xb670d429), + (0xd811b79b), + (0x15be19c3), + (0x7bdf7a71)}, + {(0x00000000), + (0x0338d800), + (0x00545800), + (0x036c8000), + (0x01521000), + (0x026ac800), + (0x01064800), + (0x023e9000), + (0x0020de00), + (0x03180600), + (0x00748600), + (0x034c5e00), + (0x0172ce00), + (0x024a1600), + (0x01269600), + (0x021e4e00)}, + {(0x3f800000), + (0x3f819c6c), + (0x3f802a2c), + (0x3f81b640), + (0x3f80a908), + (0x3f813564), + (0x3f808324), + (0x3f811f48), + (0x3f80106f), + (0x3f818c03), + (0x3f803a43), + (0x3f81a62f), + (0x3f80b967), + (0x3f81250b), + (0x3f80934b), + (0x3f810f27)}, + (0xfff80000), + {0x57,0xda,0x1e,0x1e,0x0f,0xc1,0x5c,0xac,0x32,0x8f, + 0xe4,0x94,0x24,0xf0,0x86,0x24,0x1b,0xde,0x44,0x16,0x00} + }, + { + /* No.24 delta:1573 weight:1043 */ + 11213, + 58, + 21, + 2, + {(0x00000000), + (0xa6c80c3d), + (0x3502d818), + (0x93cad425), + (0xda700189), + (0x7cb80db4), + (0xef72d991), + (0x49bad5ac), + (0x0000cb8c), + (0xa6c8c7b1), + (0x35021394), + (0x93ca1fa9), + (0xda70ca05), + (0x7cb8c638), + (0xef72121d), + (0x49ba1e20)}, + {(0x00000000), + (0xd66f0400), + (0x014ca600), + (0xd723a200), + (0x00442a00), + (0xd62b2e00), + (0x01088c00), + (0xd7678800), + (0x0c835e00), + (0xdaec5a00), + (0x0dcff800), + (0xdba0fc00), + (0x0cc77400), + (0xdaa87000), + (0x0d8bd200), + (0xdbe4d600)}, + {(0x3f800000), + (0x3feb3782), + (0x3f80a653), + (0x3feb91d1), + (0x3f802215), + (0x3feb1597), + (0x3f808446), + (0x3febb3c4), + (0x3f8641af), + (0x3fed762d), + (0x3f86e7fc), + (0x3fedd07e), + (0x3f8663ba), + (0x3fed5438), + (0x3f86c5e9), + (0x3fedf26b)}, + (0xfff80000), + {0xd3,0x5b,0x43,0x3f,0x00,0x55,0xf8,0x40,0xfe,0x8f, + 0xd0,0xe0,0xac,0x48,0x50,0xf2,0x50,0x2a,0xb7,0xcf,0x00} + }, + { + /* No.25 delta:1860 weight:1169 */ + 11213, + 33, + 7, + 10, + {(0x00000000), + (0x3f9ccf17), + (0xcdd7a2a1), + (0xf24b6db6), + (0xf9c00195), + (0xc65cce82), + (0x3417a334), + (0x0b8b6c23), + (0x00006c32), + (0x3f9ca325), + (0xcdd7ce93), + (0xf24b0184), + (0xf9c06da7), + (0xc65ca2b0), + (0x3417cf06), + (0x0b8b0011)}, + {(0x00000000), + (0x043a0400), + (0x00714000), + (0x044b4400), + (0x10408400), + (0x147a8000), + (0x1031c400), + (0x140bc000), + (0x70049e00), + (0x743e9a00), + (0x7075de00), + (0x744fda00), + (0x60441a00), + (0x647e1e00), + (0x60355a00), + (0x640f5e00)}, + {(0x3f800000), + (0x3f821d02), + (0x3f8038a0), + (0x3f8225a2), + (0x3f882042), + (0x3f8a3d40), + (0x3f8818e2), + (0x3f8a05e0), + (0x3fb8024f), + (0x3fba1f4d), + (0x3fb83aef), + (0x3fba27ed), + (0x3fb0220d), + (0x3fb23f0f), + (0x3fb01aad), + (0x3fb207af)}, + (0xfff80000), + {0x6f,0x6a,0x15,0x14,0x9e,0x4e,0xca,0xcd,0xe1,0xfb, + 0x26,0x23,0xa0,0xa9,0x21,0x22,0xca,0x8c,0x68,0x8f,0x00} + }, + { + /* No.26 delta:2274 weight:1019 */ + 11213, + 18, + 7, + 13, + {(0x00000000), + (0x83f4f835), + (0x34e8f3fa), + (0xb71c0bcf), + (0xf21001a3), + (0x71e4f996), + (0xc6f8f259), + (0x450c0a6c), + (0x00009d49), + (0x83f4657c), + (0x34e86eb3), + (0xb71c9686), + (0xf2109cea), + (0x71e464df), + (0xc6f86f10), + (0x450c9725)}, + {(0x00000000), + (0x69050000), + (0x0b0a1800), + (0x620f1800), + (0x41a06000), + (0x28a56000), + (0x4aaa7800), + (0x23af7800), + (0x046b1e00), + (0x6d6e1e00), + (0x0f610600), + (0x66640600), + (0x45cb7e00), + (0x2cce7e00), + (0x4ec16600), + (0x27c46600)}, + {(0x3f800000), + (0x3fb48280), + (0x3f85850c), + (0x3fb1078c), + (0x3fa0d030), + (0x3f9452b0), + (0x3fa5553c), + (0x3f91d7bc), + (0x3f82358f), + (0x3fb6b70f), + (0x3f87b083), + (0x3fb33203), + (0x3fa2e5bf), + (0x3f96673f), + (0x3fa760b3), + (0x3f93e233)}, + (0xfff80000), + {0x6c,0xda,0xe3,0x3d,0xac,0x72,0x40,0x41,0xca,0xa3, + 0xf7,0xdf,0xff,0x2d,0x57,0xea,0x1f,0x8d,0x6c,0x04,0x00} + }, + { + /* No.27 delta:2503 weight:711 */ + 11213, + 9, + 12, + 13, + {(0x00000000), + (0xc54f7f87), + (0x6904a950), + (0xac4bd6d7), + (0x85c001bc), + (0x408f7e3b), + (0xecc4a8ec), + (0x298bd76b), + (0x00007b77), + (0xc54f04f0), + (0x6904d227), + (0xac4bada0), + (0x85c07acb), + (0x408f054c), + (0xecc4d39b), + (0x298bac1c)}, + {(0x00000000), + (0xc7002c00), + (0x5a61c800), + (0x9d61e400), + (0x12013800), + (0xd5011400), + (0x4860f000), + (0x8f60dc00), + (0xc8c01e00), + (0x0fc03200), + (0x92a1d600), + (0x55a1fa00), + (0xdac12600), + (0x1dc10a00), + (0x80a0ee00), + (0x47a0c200)}, + {(0x3f800000), + (0x3fe38016), + (0x3fad30e4), + (0x3fceb0f2), + (0x3f89009c), + (0x3fea808a), + (0x3fa43078), + (0x3fc7b06e), + (0x3fe4600f), + (0x3f87e019), + (0x3fc950eb), + (0x3faad0fd), + (0x3fed6093), + (0x3f8ee085), + (0x3fc05077), + (0x3fa3d061)}, + (0xfff80000), + {0xd6,0xd3,0xee,0x8e,0x9a,0x94,0x64,0x4c,0x3a,0x7b, + 0x1d,0x2f,0x64,0xef,0x67,0x33,0x0d,0x49,0x2e,0x20,0x00} + }, + { + /* No.28 delta:1642 weight:1597 */ + 11213, + 14, + 16, + 3, + {(0x00000000), + (0x8147d21a), + (0x627aba0f), + (0xe33d6815), + (0x279001c1), + (0xa6d7d3db), + (0x45eabbce), + (0xc4ad69d4), + (0x0000f4d1), + (0x814726cb), + (0x627a4ede), + (0xe33d9cc4), + (0x2790f510), + (0xa6d7270a), + (0x45ea4f1f), + (0xc4ad9d05)}, + {(0x00000000), + (0x210c6a00), + (0x0071b800), + (0x217dd200), + (0xcc021a00), + (0xed0e7000), + (0xcc73a200), + (0xed7fc800), + (0x41b2de00), + (0x60beb400), + (0x41c36600), + (0x60cf0c00), + (0x8db0c400), + (0xacbcae00), + (0x8dc17c00), + (0xaccd1600)}, + {(0x3f800000), + (0x3f908635), + (0x3f8038dc), + (0x3f90bee9), + (0x3fe6010d), + (0x3ff68738), + (0x3fe639d1), + (0x3ff6bfe4), + (0x3fa0d96f), + (0x3fb05f5a), + (0x3fa0e1b3), + (0x3fb06786), + (0x3fc6d862), + (0x3fd65e57), + (0x3fc6e0be), + (0x3fd6668b)}, + (0xfff80000), + {0x58,0xce,0x35,0x39,0xc0,0x04,0xad,0xd6,0xdd,0xb7, + 0x5d,0xf1,0xac,0xf9,0x85,0xea,0x3f,0x74,0x52,0x6d,0x00} + }, + { + /* No.29 delta:1888 weight:1763 */ + 11213, + 91, + 4, + 2, + {(0x00000000), + (0xa620066e), + (0x498ca8fb), + (0xefacae95), + (0xc3f001d3), + (0x65d007bd), + (0x8a7ca928), + (0x2c5caf46), + (0x0000927c), + (0xa6209412), + (0x498c3a87), + (0xefac3ce9), + (0xc3f093af), + (0x65d095c1), + (0x8a7c3b54), + (0x2c5c3d3a)}, + {(0x00000000), + (0x29909200), + (0x0074c600), + (0x29e45400), + (0x400e7000), + (0x699ee200), + (0x407ab600), + (0x69ea2400), + (0x44029e00), + (0x6d920c00), + (0x44765800), + (0x6de6ca00), + (0x040cee00), + (0x2d9c7c00), + (0x04782800), + (0x2de8ba00)}, + {(0x3f800000), + (0x3f94c849), + (0x3f803a63), + (0x3f94f22a), + (0x3fa00738), + (0x3fb4cf71), + (0x3fa03d5b), + (0x3fb4f512), + (0x3fa2014f), + (0x3fb6c906), + (0x3fa23b2c), + (0x3fb6f365), + (0x3f820677), + (0x3f96ce3e), + (0x3f823c14), + (0x3f96f45d)}, + (0xfff80000), + {0xbf,0x14,0xa8,0x90,0x29,0x75,0x15,0xde,0x68,0x12, + 0x39,0xb3,0x6e,0x2f,0xcb,0x19,0x1f,0xe6,0x2c,0x9b,0x00} + }, + { + /* No.30 delta:1194 weight:873 */ + 11213, + 90, + 10, + 14, + {(0x00000000), + (0xdd216696), + (0x738a5c01), + (0xaeab3a97), + (0x402001ec), + (0x9d01677a), + (0x33aa5ded), + (0xee8b3b7b), + (0x0000c5c9), + (0xdd21a35f), + (0x738a99c8), + (0xaeabff5e), + (0x4020c425), + (0x9d01a2b3), + (0x33aa9824), + (0xee8bfeb2)}, + {(0x00000000), + (0x193a0000), + (0x07a49000), + (0x1e9e9000), + (0x00658800), + (0x195f8800), + (0x07c11800), + (0x1efb1800), + (0x4456fe00), + (0x5d6cfe00), + (0x43f26e00), + (0x5ac86e00), + (0x44337600), + (0x5d097600), + (0x4397e600), + (0x5aade600)}, + {(0x3f800000), + (0x3f8c9d00), + (0x3f83d248), + (0x3f8f4f48), + (0x3f8032c4), + (0x3f8cafc4), + (0x3f83e08c), + (0x3f8f7d8c), + (0x3fa22b7f), + (0x3faeb67f), + (0x3fa1f937), + (0x3fad6437), + (0x3fa219bb), + (0x3fae84bb), + (0x3fa1cbf3), + (0x3fad56f3)}, + (0xfff80000), + {0x45,0xbe,0xc0,0x65,0xca,0x28,0x44,0x0e,0x06,0x4e, + 0xa0,0xbf,0x48,0xa8,0x8e,0x39,0x64,0x68,0xe1,0x30,0x00} + }, + { + /* No.31 delta:1509 weight:1313 */ + 11213, + 86, + 6, + 7, + {(0x00000000), + (0x41d73f34), + (0x0930d7f4), + (0x48e7e8c0), + (0x65b001f9), + (0x24673ecd), + (0x6c80d60d), + (0x2d57e939), + (0x00008ad2), + (0x41d7b5e6), + (0x09305d26), + (0x48e76212), + (0x65b08b2b), + (0x2467b41f), + (0x6c805cdf), + (0x2d5763eb)}, + {(0x00000000), + (0x02010000), + (0x10332000), + (0x12322000), + (0x10030000), + (0x12020000), + (0x00302000), + (0x02312000), + (0x403a9e00), + (0x423b9e00), + (0x5009be00), + (0x5208be00), + (0x50399e00), + (0x52389e00), + (0x400abe00), + (0x420bbe00)}, + {(0x3f800000), + (0x3f810080), + (0x3f881990), + (0x3f891910), + (0x3f880180), + (0x3f890100), + (0x3f801810), + (0x3f811890), + (0x3fa01d4f), + (0x3fa11dcf), + (0x3fa804df), + (0x3fa9045f), + (0x3fa81ccf), + (0x3fa91c4f), + (0x3fa0055f), + (0x3fa105df)}, + (0xfff80000), + {0x9f,0xb2,0x3a,0xbb,0xab,0xbd,0xc1,0x43,0x82,0x94, + 0x1f,0x8e,0xdf,0x89,0xbb,0xf6,0xee,0x6a,0x10,0x54,0x00} + }, + { + /* No.32 delta:3454 weight:869 */ + 11213, + 36, + 3, + 15, + {(0x00000000), + (0x1709ea04), + (0x8e9b8c43), + (0x99926647), + (0xdd100203), + (0xca19e807), + (0x538b8e40), + (0x44826444), + (0x0000f3b3), + (0x170919b7), + (0x8e9b7ff0), + (0x999295f4), + (0xdd10f1b0), + (0xca191bb4), + (0x538b7df3), + (0x448297f7)}, + {(0x00000000), + (0x28228000), + (0x1fc10000), + (0x37e38000), + (0x00400000), + (0x28628000), + (0x1f810000), + (0x37a38000), + (0x12b01e00), + (0x3a929e00), + (0x0d711e00), + (0x25539e00), + (0x12f01e00), + (0x3ad29e00), + (0x0d311e00), + (0x25139e00)}, + {(0x3f800000), + (0x3f941140), + (0x3f8fe080), + (0x3f9bf1c0), + (0x3f802000), + (0x3f943140), + (0x3f8fc080), + (0x3f9bd1c0), + (0x3f89580f), + (0x3f9d494f), + (0x3f86b88f), + (0x3f92a9cf), + (0x3f89780f), + (0x3f9d694f), + (0x3f86988f), + (0x3f9289cf)}, + (0xfff80000), + {0xbd,0x88,0xcf,0x70,0x9b,0x4f,0x1b,0xe7,0xe6,0xab, + 0x62,0x27,0x66,0xaf,0x36,0xbb,0x10,0x8b,0x27,0xd7,0x00} + }, + { + /* No.33 delta:1105 weight:1263 */ + 11213, + 40, + 9, + 3, + {(0x00000000), + (0x4406f6da), + (0xf592d5cb), + (0xb1942311), + (0xe0900211), + (0xa496f4cb), + (0x1502d7da), + (0x51042100), + (0x0000075b), + (0x4406f181), + (0xf592d290), + (0xb194244a), + (0xe090054a), + (0xa496f390), + (0x1502d081), + (0x5104265b)}, + {(0x00000000), + (0x10151000), + (0x10640000), + (0x00711000), + (0x20081800), + (0x301d0800), + (0x306c1800), + (0x20790800), + (0x00025e00), + (0x10174e00), + (0x10665e00), + (0x00734e00), + (0x200a4600), + (0x301f5600), + (0x306e4600), + (0x207b5600)}, + {(0x3f800000), + (0x3f880a88), + (0x3f883200), + (0x3f803888), + (0x3f90040c), + (0x3f980e84), + (0x3f98360c), + (0x3f903c84), + (0x3f80012f), + (0x3f880ba7), + (0x3f88332f), + (0x3f8039a7), + (0x3f900523), + (0x3f980fab), + (0x3f983723), + (0x3f903dab)}, + (0xfff80000), + {0x13,0x48,0x32,0x45,0xca,0x30,0xd6,0xa0,0xae,0xd3, + 0x68,0x38,0x03,0x61,0x73,0x81,0x24,0xd8,0x43,0xf3,0x00} + }, + { + /* No.34 delta:7663 weight:713 */ + 11213, + 62, + 2, + 15, + {(0x00000000), + (0x9fe7bf95), + (0x7e1ef3d4), + (0xe1f94c41), + (0x32e00221), + (0xad07bdb4), + (0x4cfef1f5), + (0xd3194e60), + (0x00005fc6), + (0x9fe7e053), + (0x7e1eac12), + (0xe1f91387), + (0x32e05de7), + (0xad07e272), + (0x4cfeae33), + (0xd31911a6)}, + {(0x00000000), + (0x00000000), + (0x00000000), + (0x00000000), + (0x20000000), + (0x20000000), + (0x20000000), + (0x20000000), + (0x50001e00), + (0x50001e00), + (0x50001e00), + (0x50001e00), + (0x70001e00), + (0x70001e00), + (0x70001e00), + (0x70001e00)}, + {(0x3f800000), + (0x3f800000), + (0x3f800000), + (0x3f800000), + (0x3f900000), + (0x3f900000), + (0x3f900000), + (0x3f900000), + (0x3fa8000f), + (0x3fa8000f), + (0x3fa8000f), + (0x3fa8000f), + (0x3fb8000f), + (0x3fb8000f), + (0x3fb8000f), + (0x3fb8000f)}, + (0xfff80000), + {0x05,0x3c,0xe6,0xed,0x20,0xd0,0x5e,0x82,0xc3,0x47, + 0x89,0x62,0x9a,0x00,0x4f,0xdf,0x8a,0xe2,0x89,0xe4,0x00} + }, + { + /* No.35 delta:1045 weight:1387 */ + 11213, + 66, + 18, + 8, + {(0x00000000), + (0xcc054daa), + (0x64ce00f1), + (0xa8cb4d5b), + (0xc6200238), + (0x0a254f92), + (0xa2ee02c9), + (0x6eeb4f63), + (0x00006fce), + (0xcc052264), + (0x64ce6f3f), + (0xa8cb2295), + (0xc6206df6), + (0x0a25205c), + (0xa2ee6d07), + (0x6eeb20ad)}, + {(0x00000000), + (0xd07d1a00), + (0x08927800), + (0xd8ef6200), + (0x00a4c000), + (0xd0d9da00), + (0x0836b800), + (0xd84ba200), + (0x00025e00), + (0xd07f4400), + (0x08902600), + (0xd8ed3c00), + (0x00a69e00), + (0xd0db8400), + (0x0834e600), + (0xd849fc00)}, + {(0x3f800000), + (0x3fe83e8d), + (0x3f84493c), + (0x3fec77b1), + (0x3f805260), + (0x3fe86ced), + (0x3f841b5c), + (0x3fec25d1), + (0x3f80012f), + (0x3fe83fa2), + (0x3f844813), + (0x3fec769e), + (0x3f80534f), + (0x3fe86dc2), + (0x3f841a73), + (0x3fec24fe)}, + (0xfff80000), + {0x53,0xdb,0x48,0x5e,0x80,0xb8,0xf7,0x7d,0xd4,0x43, + 0xc8,0x11,0x1f,0x88,0x87,0x4f,0x05,0x24,0x64,0x44,0x00} + }, + { + /* No.36 delta:2076 weight:1703 */ + 11213, + 75, + 9, + 2, + {(0x00000000), + (0xc42d5e09), + (0x3ecbb703), + (0xfae6e90a), + (0xe9b00243), + (0x2d9d5c4a), + (0xd77bb540), + (0x1356eb49), + (0x00003832), + (0xc42d663b), + (0x3ecb8f31), + (0xfae6d138), + (0xe9b03a71), + (0x2d9d6478), + (0xd77b8d72), + (0x1356d37b)}, + {(0x00000000), + (0x003c8000), + (0x00700000), + (0x004c8000), + (0x00080000), + (0x00348000), + (0x00780000), + (0x00448000), + (0x00021e00), + (0x003e9e00), + (0x00721e00), + (0x004e9e00), + (0x000a1e00), + (0x00369e00), + (0x007a1e00), + (0x00469e00)}, + {(0x3f800000), + (0x3f801e40), + (0x3f803800), + (0x3f802640), + (0x3f800400), + (0x3f801a40), + (0x3f803c00), + (0x3f802240), + (0x3f80010f), + (0x3f801f4f), + (0x3f80390f), + (0x3f80274f), + (0x3f80050f), + (0x3f801b4f), + (0x3f803d0f), + (0x3f80234f)}, + (0xfff80000), + {0x83,0xeb,0x26,0xe2,0x25,0xfd,0x8b,0x40,0xfc,0xd8, + 0x09,0x63,0xa1,0xb0,0x60,0x56,0xec,0x05,0xc2,0x27,0x00} + }, + { + /* No.37 delta:2017 weight:1375 */ + 11213, + 20, + 23, + 4, + {(0x00000000), + (0xf3dee608), + (0x43968c18), + (0xb0486a10), + (0x82100252), + (0x71cee45a), + (0xc1868e4a), + (0x32586842), + (0x0000b8e9), + (0xf3de5ee1), + (0x439634f1), + (0xb048d2f9), + (0x8210babb), + (0x71ce5cb3), + (0xc18636a3), + (0x3258d0ab)}, + {(0x00000000), + (0x0f350000), + (0x08b40000), + (0x07810000), + (0x20c1a000), + (0x2ff4a000), + (0x2875a000), + (0x2740a000), + (0x201c1e00), + (0x2f291e00), + (0x28a81e00), + (0x279d1e00), + (0x00ddbe00), + (0x0fe8be00), + (0x0869be00), + (0x075cbe00)}, + {(0x3f800000), + (0x3f879a80), + (0x3f845a00), + (0x3f83c080), + (0x3f9060d0), + (0x3f97fa50), + (0x3f943ad0), + (0x3f93a050), + (0x3f900e0f), + (0x3f97948f), + (0x3f94540f), + (0x3f93ce8f), + (0x3f806edf), + (0x3f87f45f), + (0x3f8434df), + (0x3f83ae5f)}, + (0xfff80000), + {0x64,0x1e,0x04,0xb6,0x86,0x5e,0xd5,0x07,0x5c,0xb3, + 0xbe,0x3a,0x1b,0xc8,0xe4,0x45,0x9e,0xc4,0xcf,0x11,0x00} + }, + { + /* No.38 delta:2221 weight:1197 */ + 11213, + 37, + 24, + 7, + {(0x00000000), + (0x4fb7bfce), + (0x968c3f7b), + (0xd93b80b5), + (0x11300267), + (0x5e87bda9), + (0x87bc3d1c), + (0xc80b82d2), + (0x000002b3), + (0x4fb7bd7d), + (0x968c3dc8), + (0xd93b8206), + (0x113000d4), + (0x5e87bf1a), + (0x87bc3faf), + (0xc80b8061)}, + {(0x00000000), + (0x207f2400), + (0x0138c000), + (0x2147e400), + (0x00160000), + (0x20692400), + (0x012ec000), + (0x2151e400), + (0x30127e00), + (0x106d5a00), + (0x312abe00), + (0x11559a00), + (0x30047e00), + (0x107b5a00), + (0x313cbe00), + (0x11439a00)}, + {(0x3f800000), + (0x3f903f92), + (0x3f809c60), + (0x3f90a3f2), + (0x3f800b00), + (0x3f903492), + (0x3f809760), + (0x3f90a8f2), + (0x3f98093f), + (0x3f8836ad), + (0x3f98955f), + (0x3f88aacd), + (0x3f98023f), + (0x3f883dad), + (0x3f989e5f), + (0x3f88a1cd)}, + (0xfff80000), + {0x56,0x6e,0x0e,0xb6,0x39,0x79,0xe8,0x2f,0xdb,0x3a, + 0xb8,0xa6,0xb7,0x15,0xb4,0x26,0x23,0x62,0x6c,0x7b,0x00} + }, + { + /* No.39 delta:3255 weight:871 */ + 11213, + 59, + 27, + 3, + {(0x00000000), + (0xd9be1e48), + (0x75016ef8), + (0xacbf70b0), + (0x0e00027a), + (0xd7be1c32), + (0x7b016c82), + (0xa2bf72ca), + (0x00004209), + (0xd9be5c41), + (0x75012cf1), + (0xacbf32b9), + (0x0e004073), + (0xd7be5e3b), + (0x7b012e8b), + (0xa2bf30c3)}, + {(0x00000000), + (0x14ad8000), + (0x05013000), + (0x11acb000), + (0x092e2000), + (0x1d83a000), + (0x0c2f1000), + (0x18829000), + (0x07501e00), + (0x13fd9e00), + (0x02512e00), + (0x16fcae00), + (0x0e7e3e00), + (0x1ad3be00), + (0x0b7f0e00), + (0x1fd28e00)}, + {(0x3f800000), + (0x3f8a56c0), + (0x3f828098), + (0x3f88d658), + (0x3f849710), + (0x3f8ec1d0), + (0x3f861788), + (0x3f8c4148), + (0x3f83a80f), + (0x3f89fecf), + (0x3f812897), + (0x3f8b7e57), + (0x3f873f1f), + (0x3f8d69df), + (0x3f85bf87), + (0x3f8fe947)}, + (0xfff80000), + {0xde,0x46,0xf8,0xe9,0xab,0x16,0xb9,0x71,0xfd,0x07, + 0x49,0x31,0xbb,0x29,0xb9,0xce,0xd3,0x1e,0x43,0x2e,0x00} + }, + { + /* No.40 delta:3532 weight:1325 */ + 11213, + 8, + 11, + 4, + {(0x00000000), + (0xe314ffbd), + (0x98f9b31f), + (0x7bed4ca2), + (0x71b0028c), + (0x92a4fd31), + (0xe949b193), + (0x0a5d4e2e), + (0x0000e823), + (0xe314179e), + (0x98f95b3c), + (0x7beda481), + (0x71b0eaaf), + (0x92a41512), + (0xe94959b0), + (0x0a5da60d)}, + {(0x00000000), + (0x0c000000), + (0x0a800000), + (0x06800000), + (0x16100000), + (0x1a100000), + (0x1c900000), + (0x10900000), + (0x95801e00), + (0x99801e00), + (0x9f001e00), + (0x93001e00), + (0x83901e00), + (0x8f901e00), + (0x89101e00), + (0x85101e00)}, + {(0x3f800000), + (0x3f860000), + (0x3f854000), + (0x3f834000), + (0x3f8b0800), + (0x3f8d0800), + (0x3f8e4800), + (0x3f884800), + (0x3fcac00f), + (0x3fccc00f), + (0x3fcf800f), + (0x3fc9800f), + (0x3fc1c80f), + (0x3fc7c80f), + (0x3fc4880f), + (0x3fc2880f)}, + (0xfff80000), + {0xc3,0xa5,0xf2,0x8c,0xb3,0x3e,0xd2,0x53,0x92,0x0c, + 0x01,0x4a,0x5c,0x0a,0x47,0xe9,0x85,0xa2,0xf5,0x7f,0x00} + }, + { + /* No.41 delta:5222 weight:1281 */ + 11213, + 90, + 27, + 2, + {(0x00000000), + (0xf1807db4), + (0x9f84df41), + (0x6e04a2f5), + (0x04200296), + (0xf5a07f22), + (0x9ba4ddd7), + (0x6a24a063), + (0x00005700), + (0xf1802ab4), + (0x9f848841), + (0x6e04f5f5), + (0x04205596), + (0xf5a02822), + (0x9ba48ad7), + (0x6a24f763)}, + {(0x00000000), + (0xe9519000), + (0x1a06a800), + (0xf3573800), + (0x0d032000), + (0xe452b000), + (0x17058800), + (0xfe541800), + (0x036ade00), + (0xea3b4e00), + (0x196c7600), + (0xf03de600), + (0x0e69fe00), + (0xe7386e00), + (0x146f5600), + (0xfd3ec600)}, + {(0x3f800000), + (0x3ff4a8c8), + (0x3f8d0354), + (0x3ff9ab9c), + (0x3f868190), + (0x3ff22958), + (0x3f8b82c4), + (0x3fff2a0c), + (0x3f81b56f), + (0x3ff51da7), + (0x3f8cb63b), + (0x3ff81ef3), + (0x3f8734ff), + (0x3ff39c37), + (0x3f8a37ab), + (0x3ffe9f63)}, + (0xfff80000), + {0x08,0x0d,0xba,0x61,0x69,0x6b,0x70,0x44,0xbf,0x27, + 0x4a,0xe9,0xcb,0x98,0x26,0xb9,0xb3,0x5d,0x82,0x3d,0x00} + }, + { + /* No.42 delta:1107 weight:1153 */ + 11213, + 48, + 16, + 10, + {(0x00000000), + (0x6adad7b8), + (0x649ee9f9), + (0x0e443e41), + (0x1b2002a0), + (0x71fad518), + (0x7fbeeb59), + (0x15643ce1), + (0x0000f400), + (0x6ada23b8), + (0x649e1df9), + (0x0e44ca41), + (0x1b20f6a0), + (0x71fa2118), + (0x7fbe1f59), + (0x1564c8e1)}, + {(0x00000000), + (0x09409c00), + (0x0060c000), + (0x09205c00), + (0x04104a00), + (0x0d50d600), + (0x04708a00), + (0x0d301600), + (0x00087e00), + (0x0948e200), + (0x0068be00), + (0x09282200), + (0x04183400), + (0x0d58a800), + (0x0478f400), + (0x0d386800)}, + {(0x3f800000), + (0x3f84a04e), + (0x3f803060), + (0x3f84902e), + (0x3f820825), + (0x3f86a86b), + (0x3f823845), + (0x3f86980b), + (0x3f80043f), + (0x3f84a471), + (0x3f80345f), + (0x3f849411), + (0x3f820c1a), + (0x3f86ac54), + (0x3f823c7a), + (0x3f869c34)}, + (0xfff80000), + {0xb4,0xff,0xa8,0x22,0xa3,0x34,0x7b,0xfd,0xd4,0xca, + 0xef,0x82,0x97,0x4e,0x9d,0x89,0xeb,0xb2,0x55,0x2c,0x00} + }, + { + /* No.43 delta:3289 weight:739 */ + 11213, + 90, + 3, + 15, + {(0x00000000), + (0x12510afd), + (0xc2094a89), + (0xd0584074), + (0x5ce002b7), + (0x4eb1084a), + (0x9ee9483e), + (0x8cb842c3), + (0x00009dee), + (0x12519713), + (0xc209d767), + (0xd058dd9a), + (0x5ce09f59), + (0x4eb195a4), + (0x9ee9d5d0), + (0x8cb8df2d)}, + {(0x00000000), + (0x0c230400), + (0x033c0000), + (0x0f1f0400), + (0x03b08000), + (0x0f938400), + (0x008c8000), + (0x0caf8400), + (0x08705e00), + (0x04535a00), + (0x0b4c5e00), + (0x076f5a00), + (0x0bc0de00), + (0x07e3da00), + (0x08fcde00), + (0x04dfda00)}, + {(0x3f800000), + (0x3f861182), + (0x3f819e00), + (0x3f878f82), + (0x3f81d840), + (0x3f87c9c2), + (0x3f804640), + (0x3f8657c2), + (0x3f84382f), + (0x3f8229ad), + (0x3f85a62f), + (0x3f83b7ad), + (0x3f85e06f), + (0x3f83f1ed), + (0x3f847e6f), + (0x3f826fed)}, + (0xfff80000), + {0x47,0xd8,0xbd,0x66,0xb2,0xe8,0x3c,0x2c,0x45,0x90, + 0x88,0x27,0x9c,0x8f,0x27,0x40,0xc8,0xd9,0x0e,0xd6,0x00} + }, + { + /* No.44 delta:1477 weight:1191 */ + 11213, + 33, + 20, + 2, + {(0x00000000), + (0x3f4d49c2), + (0xdca457bf), + (0xe3e91e7d), + (0x5d5002cf), + (0x621d4b0d), + (0x81f45570), + (0xbeb91cb2), + (0x0000c277), + (0x3f4d8bb5), + (0xdca495c8), + (0xe3e9dc0a), + (0x5d50c0b8), + (0x621d897a), + (0x81f49707), + (0xbeb9dec5)}, + {(0x00000000), + (0x0275b800), + (0x7149c400), + (0x733c7c00), + (0x1058c000), + (0x122d7800), + (0x61110400), + (0x6364bc00), + (0x006f3e00), + (0x021a8600), + (0x7126fa00), + (0x73534200), + (0x1037fe00), + (0x12424600), + (0x617e3a00), + (0x630b8200)}, + {(0x3f800000), + (0x3f813adc), + (0x3fb8a4e2), + (0x3fb99e3e), + (0x3f882c60), + (0x3f8916bc), + (0x3fb08882), + (0x3fb1b25e), + (0x3f80379f), + (0x3f810d43), + (0x3fb8937d), + (0x3fb9a9a1), + (0x3f881bff), + (0x3f892123), + (0x3fb0bf1d), + (0x3fb185c1)}, + (0xfff80000), + {0x43,0xbd,0xc4,0xf1,0xb1,0xd7,0x24,0x47,0xc5,0xd0, + 0xa4,0xbc,0xc9,0x66,0xb3,0x4b,0x26,0xd1,0x26,0x85,0x00} + }, + { + /* No.45 delta:1261 weight:1353 */ + 11213, + 24, + 18, + 5, + {(0x00000000), + (0xabac4677), + (0x903dfbe7), + (0x3b91bd90), + (0xf83002d0), + (0x539c44a7), + (0x680df937), + (0xc3a1bf40), + (0x00004840), + (0xabac0e37), + (0x903db3a7), + (0x3b91f5d0), + (0xf8304a90), + (0x539c0ce7), + (0x680db177), + (0xc3a1f700)}, + {(0x00000000), + (0x00762800), + (0x200acc00), + (0x207ce400), + (0x6ea81000), + (0x6ede3800), + (0x4ea2dc00), + (0x4ed4f400), + (0x004e1e00), + (0x00383600), + (0x2044d200), + (0x2032fa00), + (0x6ee60e00), + (0x6e902600), + (0x4eecc200), + (0x4e9aea00)}, + {(0x3f800000), + (0x3f803b14), + (0x3f900566), + (0x3f903e72), + (0x3fb75408), + (0x3fb76f1c), + (0x3fa7516e), + (0x3fa76a7a), + (0x3f80270f), + (0x3f801c1b), + (0x3f902269), + (0x3f90197d), + (0x3fb77307), + (0x3fb74813), + (0x3fa77661), + (0x3fa74d75)}, + (0xfff80000), + {0x1c,0x79,0xc4,0xaf,0x4a,0xca,0x6f,0x97,0x73,0x87, + 0xe2,0xfa,0x1b,0x02,0x4e,0xfc,0xc2,0xc5,0x85,0xa8,0x00} + }, + { + /* No.46 delta:2871 weight:1351 */ + 11213, + 24, + 4, + 11, + {(0x00000000), + (0x5f7bd2a5), + (0x9b479801), + (0xc43c4aa4), + (0x793002ea), + (0x264bd04f), + (0xe2779aeb), + (0xbd0c484e), + (0x0000737e), + (0x5f7ba1db), + (0x9b47eb7f), + (0xc43c39da), + (0x79307194), + (0x264ba331), + (0xe277e995), + (0xbd0c3b30)}, + {(0x00000000), + (0x0a8c0000), + (0x10810000), + (0x1a0d0000), + (0x00600800), + (0x0aec0800), + (0x10e10800), + (0x1a6d0800), + (0x40101e00), + (0x4a9c1e00), + (0x50911e00), + (0x5a1d1e00), + (0x40701600), + (0x4afc1600), + (0x50f11600), + (0x5a7d1600)}, + {(0x3f800000), + (0x3f854600), + (0x3f884080), + (0x3f8d0680), + (0x3f803004), + (0x3f857604), + (0x3f887084), + (0x3f8d3684), + (0x3fa0080f), + (0x3fa54e0f), + (0x3fa8488f), + (0x3fad0e8f), + (0x3fa0380b), + (0x3fa57e0b), + (0x3fa8788b), + (0x3fad3e8b)}, + (0xfff80000), + {0x23,0xc7,0xec,0x47,0xae,0x9d,0xf4,0x29,0xa3,0xce, + 0x13,0x6c,0x06,0x67,0x5b,0x3a,0xb2,0xac,0x33,0xdb,0x00} + }, + { + /* No.47 delta:4370 weight:1245 */ + 11213, + 26, + 30, + 4, + {(0x00000000), + (0x1af999ae), + (0x1bfe6053), + (0x0107f9fd), + (0xb1f002f1), + (0xab099b5f), + (0xaa0e62a2), + (0xb0f7fb0c), + (0x0000281b), + (0x1af9b1b5), + (0x1bfe4848), + (0x0107d1e6), + (0xb1f02aea), + (0xab09b344), + (0xaa0e4ab9), + (0xb0f7d317)}, + {(0x00000000), + (0x0c201000), + (0x03140000), + (0x0f341000), + (0xe4200800), + (0xe8001800), + (0xe7340800), + (0xeb141800), + (0x08001e00), + (0x04200e00), + (0x0b141e00), + (0x07340e00), + (0xec201600), + (0xe0000600), + (0xef341600), + (0xe3140600)}, + {(0x3f800000), + (0x3f861008), + (0x3f818a00), + (0x3f879a08), + (0x3ff21004), + (0x3ff4000c), + (0x3ff39a04), + (0x3ff58a0c), + (0x3f84000f), + (0x3f821007), + (0x3f858a0f), + (0x3f839a07), + (0x3ff6100b), + (0x3ff00003), + (0x3ff79a0b), + (0x3ff18a03)}, + (0xfff80000), + {0x98,0x58,0x06,0x9e,0x81,0x14,0x32,0xd7,0x93,0x32, + 0x65,0xc8,0x13,0x43,0x02,0x53,0x1e,0xd3,0xaf,0x94,0x00} + }, + { + /* No.48 delta:1177 weight:859 */ + 11213, + 75, + 13, + 16, + {(0x00000000), + (0x8e9ecf83), + (0xb438b3ee), + (0x3aa67c6d), + (0xbd800305), + (0x331ecc86), + (0x09b8b0eb), + (0x87267f68), + (0x0000d641), + (0x8e9e19c2), + (0xb43865af), + (0x3aa6aa2c), + (0xbd80d544), + (0x331e1ac7), + (0x09b866aa), + (0x8726a929)}, + {(0x00000000), + (0x0f7d1c00), + (0x76262000), + (0x795b3c00), + (0x41532000), + (0x4e2e3c00), + (0x37750000), + (0x38081c00), + (0x00429e00), + (0x0f3f8200), + (0x7664be00), + (0x7919a200), + (0x4111be00), + (0x4e6ca200), + (0x37379e00), + (0x384a8200)}, + {(0x3f800000), + (0x3f87be8e), + (0x3fbb1310), + (0x3fbcad9e), + (0x3fa0a990), + (0x3fa7171e), + (0x3f9bba80), + (0x3f9c040e), + (0x3f80214f), + (0x3f879fc1), + (0x3fbb325f), + (0x3fbc8cd1), + (0x3fa088df), + (0x3fa73651), + (0x3f9b9bcf), + (0x3f9c2541)}, + (0xfff80000), + {0xc9,0xe0,0x77,0x04,0x4f,0x92,0x96,0xd4,0x05,0xdc, + 0x3e,0x3c,0xa6,0xf3,0x8e,0x2d,0xdb,0xf2,0x8c,0xe4,0x00} + }, + { + /* No.49 delta:3224 weight:947 */ + 11213, + 65, + 7, + 13, + {(0x00000000), + (0x9221eadf), + (0x5003b0d0), + (0xc2225a0f), + (0x0d800317), + (0x9fa1e9c8), + (0x5d83b3c7), + (0xcfa25918), + (0x00005031), + (0x9221baee), + (0x5003e0e1), + (0xc2220a3e), + (0x0d805326), + (0x9fa1b9f9), + (0x5d83e3f6), + (0xcfa20929)}, + {(0x00000000), + (0x00400800), + (0x60600000), + (0x60200800), + (0x00000000), + (0x00400800), + (0x60600000), + (0x60200800), + (0x30101e00), + (0x30501600), + (0x50701e00), + (0x50301600), + (0x30101e00), + (0x30501600), + (0x50701e00), + (0x50301600)}, + {(0x3f800000), + (0x3f802004), + (0x3fb03000), + (0x3fb01004), + (0x3f800000), + (0x3f802004), + (0x3fb03000), + (0x3fb01004), + (0x3f98080f), + (0x3f98280b), + (0x3fa8380f), + (0x3fa8180b), + (0x3f98080f), + (0x3f98280b), + (0x3fa8380f), + (0x3fa8180b)}, + (0xfff80000), + {0xc1,0x70,0x72,0x7f,0xb1,0x1e,0x6e,0xc5,0xec,0xcc, + 0x69,0xd8,0x0b,0xba,0x4e,0x2c,0x73,0x46,0x81,0x52,0x00} + }, + { + /* No.50 delta:6665 weight:1221 */ + 11213, + 84, + 1, + 9, + {(0x00000000), + (0xbdb9b41e), + (0x9876c465), + (0x25cf707b), + (0x25c0032f), + (0x9879b731), + (0xbdb6c74a), + (0x000f7354), + (0x00003009), + (0xbdb98417), + (0x9876f46c), + (0x25cf4072), + (0x25c03326), + (0x98798738), + (0xbdb6f743), + (0x000f435d)}, + {(0x00000000), + (0x51000000), + (0x20000000), + (0x71000000), + (0x04200000), + (0x55200000), + (0x24200000), + (0x75200000), + (0x17201e00), + (0x46201e00), + (0x37201e00), + (0x66201e00), + (0x13001e00), + (0x42001e00), + (0x33001e00), + (0x62001e00)}, + {(0x3f800000), + (0x3fa88000), + (0x3f900000), + (0x3fb88000), + (0x3f821000), + (0x3faa9000), + (0x3f921000), + (0x3fba9000), + (0x3f8b900f), + (0x3fa3100f), + (0x3f9b900f), + (0x3fb3100f), + (0x3f89800f), + (0x3fa1000f), + (0x3f99800f), + (0x3fb1000f)}, + (0xfff80000), + {0xdf,0xd6,0xd2,0xb4,0x0a,0xa4,0x35,0xbe,0x0f,0xa6, + 0x48,0x42,0xfe,0x0c,0x0f,0xa3,0xa9,0x64,0x1b,0x93,0x00} + }, + { + /* No.51 delta:6604 weight:1075 */ + 11213, + 61, + 3, + 13, + {(0x00000000), + (0xe7ec9698), + (0xdc943f6e), + (0x3b78a9f6), + (0xdf600330), + (0x388c95a8), + (0x03f43c5e), + (0xe418aac6), + (0x000058c3), + (0xe7ecce5b), + (0xdc9467ad), + (0x3b78f135), + (0xdf605bf3), + (0x388ccd6b), + (0x03f4649d), + (0xe418f205)}, + {(0x00000000), + (0x80000000), + (0x50000000), + (0xd0000000), + (0x20000000), + (0xa0000000), + (0x70000000), + (0xf0000000), + (0x00001e00), + (0x80001e00), + (0x50001e00), + (0xd0001e00), + (0x20001e00), + (0xa0001e00), + (0x70001e00), + (0xf0001e00)}, + {(0x3f800000), + (0x3fc00000), + (0x3fa80000), + (0x3fe80000), + (0x3f900000), + (0x3fd00000), + (0x3fb80000), + (0x3ff80000), + (0x3f80000f), + (0x3fc0000f), + (0x3fa8000f), + (0x3fe8000f), + (0x3f90000f), + (0x3fd0000f), + (0x3fb8000f), + (0x3ff8000f)}, + (0xfff80000), + {0xf2,0x95,0xcc,0x96,0x13,0xa0,0x75,0xc2,0xea,0x1a, + 0x5c,0x2d,0xcc,0x41,0x22,0xf8,0x87,0x8d,0x52,0xc0,0x00} + }, + { + /* No.52 delta:980 weight:1115 */ + 11213, + 75, + 17, + 12, + {(0x00000000), + (0x619af787), + (0x463e8326), + (0x27a474a1), + (0xc5c00348), + (0xa45af4cf), + (0x83fe806e), + (0xe26477e9), + (0x00008ae3), + (0x619a7d64), + (0x463e09c5), + (0x27a4fe42), + (0xc5c089ab), + (0xa45a7e2c), + (0x83fe0a8d), + (0xe264fd0a)}, + {(0x00000000), + (0x107c1400), + (0x81204400), + (0x915c5000), + (0x00113400), + (0x106d2000), + (0x81317000), + (0x914d6400), + (0x000ede00), + (0x1072ca00), + (0x812e9a00), + (0x91528e00), + (0x001fea00), + (0x1063fe00), + (0x813fae00), + (0x9143ba00)}, + {(0x3f800000), + (0x3f883e0a), + (0x3fc09022), + (0x3fc8ae28), + (0x3f80089a), + (0x3f883690), + (0x3fc098b8), + (0x3fc8a6b2), + (0x3f80076f), + (0x3f883965), + (0x3fc0974d), + (0x3fc8a947), + (0x3f800ff5), + (0x3f8831ff), + (0x3fc09fd7), + (0x3fc8a1dd)}, + (0xfff80000), + {0x31,0x3b,0x59,0xba,0x4b,0xfa,0x15,0x6d,0x68,0x38, + 0xd0,0x59,0x4b,0xc5,0xee,0xd6,0xd1,0x72,0x77,0x56,0x00} + }, + { + /* No.53 delta:2128 weight:1031 */ + 11213, + 90, + 18, + 10, + {(0x00000000), + (0x54ddf61b), + (0x3289e26b), + (0x66541470), + (0x8c500359), + (0xd88df542), + (0xbed9e132), + (0xea041729), + (0x0000fb30), + (0x54dd0d2b), + (0x3289195b), + (0x6654ef40), + (0x8c50f869), + (0xd88d0e72), + (0xbed91a02), + (0xea04ec19)}, + {(0x00000000), + (0x80710000), + (0x704e0000), + (0xf03f0000), + (0x40450000), + (0xc0340000), + (0x300b0000), + (0xb07a0000), + (0x000c1e00), + (0x807d1e00), + (0x70421e00), + (0xf0331e00), + (0x40491e00), + (0xc0381e00), + (0x30071e00), + (0xb0761e00)}, + {(0x3f800000), + (0x3fc03880), + (0x3fb82700), + (0x3ff81f80), + (0x3fa02280), + (0x3fe01a00), + (0x3f980580), + (0x3fd83d00), + (0x3f80060f), + (0x3fc03e8f), + (0x3fb8210f), + (0x3ff8198f), + (0x3fa0248f), + (0x3fe01c0f), + (0x3f98038f), + (0x3fd83b0f)}, + (0xfff80000), + {0x2c,0x15,0xc7,0x91,0x8f,0xe7,0xba,0x43,0x56,0x9b, + 0xf8,0xd4,0x59,0xf2,0x0c,0x4e,0xf2,0x42,0x9a,0xfe,0x00} + }, + { + /* No.54 delta:2047 weight:935 */ + 11213, + 73, + 6, + 15, + {(0x00000000), + (0x1b3e4d84), + (0x40583cec), + (0x5b667168), + (0x82600363), + (0x995e4ee7), + (0xc2383f8f), + (0xd906720b), + (0x000025e9), + (0x1b3e686d), + (0x40581905), + (0x5b665481), + (0x8260268a), + (0x995e6b0e), + (0xc2381a66), + (0xd90657e2)}, + {(0x00000000), + (0x00524000), + (0x52804000), + (0x52d20000), + (0x00232000), + (0x00716000), + (0x52a36000), + (0x52f12000), + (0x21c51e00), + (0x21975e00), + (0x73455e00), + (0x73171e00), + (0x21e63e00), + (0x21b47e00), + (0x73667e00), + (0x73343e00)}, + {(0x3f800000), + (0x3f802920), + (0x3fa94020), + (0x3fa96900), + (0x3f801190), + (0x3f8038b0), + (0x3fa951b0), + (0x3fa97890), + (0x3f90e28f), + (0x3f90cbaf), + (0x3fb9a2af), + (0x3fb98b8f), + (0x3f90f31f), + (0x3f90da3f), + (0x3fb9b33f), + (0x3fb99a1f)}, + (0xfff80000), + {0x67,0xd5,0xbe,0x19,0x7f,0x4e,0x37,0xca,0xeb,0x0b, + 0x09,0x52,0xc2,0x91,0x23,0x02,0xb9,0xa6,0xdd,0x1e,0x00} + }, + { + /* No.55 delta:1367 weight:1089 */ + 11213, + 30, + 14, + 10, + {(0x00000000), + (0x3d4e7360), + (0xd47d559c), + (0xe93326fc), + (0x10e00371), + (0x2dae7011), + (0xc49d56ed), + (0xf9d3258d), + (0x0000f71b), + (0x3d4e847b), + (0xd47da287), + (0xe933d1e7), + (0x10e0f46a), + (0x2dae870a), + (0xc49da1f6), + (0xf9d3d296)}, + {(0x00000000), + (0x6b729000), + (0x206f1800), + (0x4b1d8800), + (0x00501a00), + (0x6b228a00), + (0x203f0200), + (0x4b4d9200), + (0x20103e00), + (0x4b62ae00), + (0x007f2600), + (0x6b0db600), + (0x20402400), + (0x4b32b400), + (0x002f3c00), + (0x6b5dac00)}, + {(0x3f800000), + (0x3fb5b948), + (0x3f90378c), + (0x3fa58ec4), + (0x3f80280d), + (0x3fb59145), + (0x3f901f81), + (0x3fa5a6c9), + (0x3f90081f), + (0x3fa5b157), + (0x3f803f93), + (0x3fb586db), + (0x3f902012), + (0x3fa5995a), + (0x3f80179e), + (0x3fb5aed6)}, + (0xfff80000), + {0x74,0x06,0xc4,0x94,0x50,0xc8,0x89,0xd9,0x6c,0x24, + 0x1b,0x4e,0x7f,0x96,0xbe,0x0a,0xb0,0xbb,0xa9,0x75,0x00} + }, + { + /* No.56 delta:1232 weight:1251 */ + 11213, + 56, + 20, + 8, + {(0x00000000), + (0x303bfd65), + (0x96ea74b0), + (0xa6d189d5), + (0x1d200385), + (0x2d1bfee0), + (0x8bca7735), + (0xbbf18a50), + (0x0000e0a3), + (0x303b1dc6), + (0x96ea9413), + (0xa6d16976), + (0x1d20e326), + (0x2d1b1e43), + (0x8bca9796), + (0xbbf16af3)}, + {(0x00000000), + (0x0e9c1400), + (0x00661e00), + (0x0efa0a00), + (0x20125000), + (0x2e8e4400), + (0x20744e00), + (0x2ee85a00), + (0x001abe00), + (0x0e86aa00), + (0x007ca000), + (0x0ee0b400), + (0x2008ee00), + (0x2e94fa00), + (0x206ef000), + (0x2ef2e400)}, + {(0x3f800000), + (0x3f874e0a), + (0x3f80330f), + (0x3f877d05), + (0x3f900928), + (0x3f974722), + (0x3f903a27), + (0x3f97742d), + (0x3f800d5f), + (0x3f874355), + (0x3f803e50), + (0x3f87705a), + (0x3f900477), + (0x3f974a7d), + (0x3f903778), + (0x3f977972)}, + (0xfff80000), + {0x9f,0xb8,0x5c,0x52,0x53,0x38,0x40,0xed,0x9b,0x43, + 0xe8,0x89,0x8c,0xd0,0x44,0x25,0x4b,0xbf,0xca,0xd0,0x00} + }, + { + /* No.57 delta:1379 weight:873 */ + 11213, + 89, + 13, + 1, + {(0x00000000), + (0xfacfdd0b), + (0x22ecafbf), + (0xd82372b4), + (0x85500390), + (0x7f9fde9b), + (0xa7bcac2f), + (0x5d737124), + (0x0000d423), + (0xfacf0928), + (0x22ec7b9c), + (0xd823a697), + (0x8550d7b3), + (0x7f9f0ab8), + (0xa7bc780c), + (0x5d73a507)}, + {(0x00000000), + (0x2c081000), + (0x05201800), + (0x29280800), + (0x20e00400), + (0x0ce81400), + (0x25c01c00), + (0x09c80c00), + (0x11481e00), + (0x3d400e00), + (0x14680600), + (0x38601600), + (0x31a81a00), + (0x1da00a00), + (0x34880200), + (0x18801200)}, + {(0x3f800000), + (0x3f960408), + (0x3f82900c), + (0x3f949404), + (0x3f907002), + (0x3f86740a), + (0x3f92e00e), + (0x3f84e406), + (0x3f88a40f), + (0x3f9ea007), + (0x3f8a3403), + (0x3f9c300b), + (0x3f98d40d), + (0x3f8ed005), + (0x3f9a4401), + (0x3f8c4009)}, + (0xfff80000), + {0x08,0x0f,0x24,0x9d,0x3a,0xba,0x6d,0xb4,0xb0,0x1a, + 0x1c,0x4b,0x44,0xe7,0x44,0xf7,0xc9,0x4a,0x5f,0x97,0x00} + }, + { + /* No.58 delta:904 weight:1097 */ + 11213, + 60, + 16, + 2, + {(0x00000000), + (0xda86476d), + (0x6c05798d), + (0xb6833ee0), + (0xb72003ae), + (0x6da644c3), + (0xdb257a23), + (0x01a33d4e), + (0x00001489), + (0xda8653e4), + (0x6c056d04), + (0xb6832a69), + (0xb7201727), + (0x6da6504a), + (0xdb256eaa), + (0x01a329c7)}, + {(0x00000000), + (0x0c74f000), + (0x0059a800), + (0x0c2d5800), + (0x02445000), + (0x0e30a000), + (0x021df800), + (0x0e690800), + (0x0902de00), + (0x05762e00), + (0x095b7600), + (0x052f8600), + (0x0b468e00), + (0x07327e00), + (0x0b1f2600), + (0x076bd600)}, + {(0x3f800000), + (0x3f863a78), + (0x3f802cd4), + (0x3f8616ac), + (0x3f812228), + (0x3f871850), + (0x3f810efc), + (0x3f873484), + (0x3f84816f), + (0x3f82bb17), + (0x3f84adbb), + (0x3f8297c3), + (0x3f85a347), + (0x3f83993f), + (0x3f858f93), + (0x3f83b5eb)}, + (0xfff80000), + {0xb8,0xe0,0xa0,0x3b,0x2e,0x11,0x17,0x83,0x7b,0x75, + 0x85,0x89,0xfa,0x1e,0x49,0xb4,0x5c,0xe6,0xb8,0xc1,0x00} + }, + { + /* No.59 delta:7724 weight:1539 */ + 11213, + 42, + 28, + 4, + {(0x00000000), + (0xdfefef22), + (0x804185a4), + (0x5fae6a86), + (0x54b003b3), + (0x8b5fec91), + (0xd4f18617), + (0x0b1e6935), + (0x00009211), + (0xdfef7d33), + (0x804117b5), + (0x5faef897), + (0x54b091a2), + (0x8b5f7e80), + (0xd4f11406), + (0x0b1efb24)}, + {(0x00000000), + (0x38020000), + (0x08014000), + (0x30034000), + (0x04000800), + (0x3c020800), + (0x0c014800), + (0x34034800), + (0x08001e00), + (0x30021e00), + (0x00015e00), + (0x38035e00), + (0x0c001600), + (0x34021600), + (0x04015600), + (0x3c035600)}, + {(0x3f800000), + (0x3f9c0100), + (0x3f8400a0), + (0x3f9801a0), + (0x3f820004), + (0x3f9e0104), + (0x3f8600a4), + (0x3f9a01a4), + (0x3f84000f), + (0x3f98010f), + (0x3f8000af), + (0x3f9c01af), + (0x3f86000b), + (0x3f9a010b), + (0x3f8200ab), + (0x3f9e01ab)}, + (0xfff80000), + {0x91,0xba,0x8c,0xac,0x44,0xa7,0x81,0xa7,0xed,0x37, + 0x7e,0x8d,0xaf,0xe5,0x08,0xe6,0xc7,0x1d,0xfd,0xe5,0x00} + }, + { + /* No.60 delta:2411 weight:1317 */ + 11213, + 13, + 24, + 5, + {(0x00000000), + (0x9dd3ce8f), + (0x90da0878), + (0x0d09c6f7), + (0xad8003cf), + (0x3053cd40), + (0x3d5a0bb7), + (0xa089c538), + (0x0000bcb0), + (0x9dd3723f), + (0x90dab4c8), + (0x0d097a47), + (0xad80bf7f), + (0x305371f0), + (0x3d5ab707), + (0xa0897988)}, + {(0x00000000), + (0x4c0b9800), + (0x0fa54000), + (0x43aed800), + (0x0067c000), + (0x4c6c5800), + (0x0fc28000), + (0x43c91800), + (0x0a105e00), + (0x461bc600), + (0x05b51e00), + (0x49be8600), + (0x0a779e00), + (0x467c0600), + (0x05d2de00), + (0x49d94600)}, + {(0x3f800000), + (0x3fa605cc), + (0x3f87d2a0), + (0x3fa1d76c), + (0x3f8033e0), + (0x3fa6362c), + (0x3f87e140), + (0x3fa1e48c), + (0x3f85082f), + (0x3fa30de3), + (0x3f82da8f), + (0x3fa4df43), + (0x3f853bcf), + (0x3fa33e03), + (0x3f82e96f), + (0x3fa4eca3)}, + (0xfff80000), + {0xac,0x0b,0xb8,0x4d,0x6f,0xbd,0x47,0x8b,0x3f,0x9c, + 0x92,0xd0,0x32,0xf9,0x89,0x38,0xda,0x67,0xea,0xbe,0x00} + }, + { + /* No.61 delta:1265 weight:827 */ + 11213, + 52, + 17, + 15, + {(0x00000000), + (0xa4b47608), + (0x36bc0fca), + (0x920879c2), + (0xdeb003d6), + (0x7a0475de), + (0xe80c0c1c), + (0x4cb87a14), + (0x0000fbcf), + (0xa4b48dc7), + (0x36bcf405), + (0x9208820d), + (0xdeb0f819), + (0x7a048e11), + (0xe80cf7d3), + (0x4cb881db)}, + {(0x00000000), + (0x0813ae00), + (0x20151000), + (0x2806be00), + (0x4029c000), + (0x483a6e00), + (0x603cd000), + (0x682f7e00), + (0x52035e00), + (0x5a10f000), + (0x72164e00), + (0x7a05e000), + (0x122a9e00), + (0x1a393000), + (0x323f8e00), + (0x3a2c2000)}, + {(0x3f800000), + (0x3f8409d7), + (0x3f900a88), + (0x3f94035f), + (0x3fa014e0), + (0x3fa41d37), + (0x3fb01e68), + (0x3fb417bf), + (0x3fa901af), + (0x3fad0878), + (0x3fb90b27), + (0x3fbd02f0), + (0x3f89154f), + (0x3f8d1c98), + (0x3f991fc7), + (0x3f9d1610)}, + (0xfff80000), + {0xb2,0x25,0x08,0xf6,0xcd,0xda,0xfa,0xdb,0x2f,0xe7, + 0x81,0x83,0x7f,0xb8,0x75,0x05,0xff,0x2c,0x1a,0x80,0x00} + }, + { + /* No.62 delta:3397 weight:1223 */ + 11213, + 44, + 3, + 7, + {(0x00000000), + (0x89ffcb3c), + (0xafe67560), + (0x2619be5c), + (0xf79003e8), + (0x7e6fc8d4), + (0x58767688), + (0xd189bdb4), + (0x0000dcdc), + (0x89ff17e0), + (0xafe6a9bc), + (0x26196280), + (0xf790df34), + (0x7e6f1408), + (0x5876aa54), + (0xd1896168)}, + {(0x00000000), + (0x00710000), + (0xb00e0800), + (0xb07f0800), + (0x90120000), + (0x90630000), + (0x201c0800), + (0x206d0800), + (0x40091e00), + (0x40781e00), + (0xf0071600), + (0xf0761600), + (0xd01b1e00), + (0xd06a1e00), + (0x60151600), + (0x60641600)}, + {(0x3f800000), + (0x3f803880), + (0x3fd80704), + (0x3fd83f84), + (0x3fc80900), + (0x3fc83180), + (0x3f900e04), + (0x3f903684), + (0x3fa0048f), + (0x3fa03c0f), + (0x3ff8038b), + (0x3ff83b0b), + (0x3fe80d8f), + (0x3fe8350f), + (0x3fb00a8b), + (0x3fb0320b)}, + (0xfff80000), + {0x65,0x92,0xc9,0x30,0xd4,0x39,0xe2,0xf8,0x3a,0x06, + 0x72,0x5a,0xf0,0xe9,0x6f,0x1d,0x41,0xb8,0x38,0xcb,0x00} + }, + { + /* No.63 delta:1253 weight:1063 */ + 11213, + 40, + 15, + 8, + {(0x00000000), + (0xf0f1fa2b), + (0xc095cbf9), + (0x306431d2), + (0x84c003f6), + (0x7431f9dd), + (0x4455c80f), + (0xb4a43224), + (0x000041b7), + (0xf0f1bb9c), + (0xc0958a4e), + (0x30647065), + (0x84c04241), + (0x7431b86a), + (0x445589b8), + (0xb4a47393)}, + {(0x00000000), + (0x000f4800), + (0x00c47000), + (0x00cb3800), + (0x001ec000), + (0x00118800), + (0x00dab000), + (0x00d5f800), + (0xc01d9e00), + (0xc012d600), + (0xc0d9ee00), + (0xc0d6a600), + (0xc0035e00), + (0xc00c1600), + (0xc0c72e00), + (0xc0c86600)}, + {(0x3f800000), + (0x3f8007a4), + (0x3f806238), + (0x3f80659c), + (0x3f800f60), + (0x3f8008c4), + (0x3f806d58), + (0x3f806afc), + (0x3fe00ecf), + (0x3fe0096b), + (0x3fe06cf7), + (0x3fe06b53), + (0x3fe001af), + (0x3fe0060b), + (0x3fe06397), + (0x3fe06433)}, + (0xfff80000), + {0x6a,0x42,0x24,0x72,0x49,0x2e,0x6c,0xc6,0x39,0xde, + 0x29,0x45,0x5e,0xba,0x3b,0xda,0xc6,0xb7,0x79,0xd2,0x00} + }, + { + /* No.64 delta:5028 weight:833 */ + 11213, + 40, + 3, + 16, + {(0x00000000), + (0x0fda9709), + (0xdb5d90d9), + (0xd48707d0), + (0x78500401), + (0x778a9308), + (0xa30d94d8), + (0xacd703d1), + (0x00000aa4), + (0x0fda9dad), + (0xdb5d9a7d), + (0xd4870d74), + (0x78500ea5), + (0x778a99ac), + (0xa30d9e7c), + (0xacd70975)}, + {(0x00000000), + (0x19200000), + (0x83a00000), + (0x9a800000), + (0x00800000), + (0x19a00000), + (0x83200000), + (0x9a000000), + (0x41001e00), + (0x58201e00), + (0xc2a01e00), + (0xdb801e00), + (0x41801e00), + (0x58a01e00), + (0xc2201e00), + (0xdb001e00)}, + {(0x3f800000), + (0x3f8c9000), + (0x3fc1d000), + (0x3fcd4000), + (0x3f804000), + (0x3f8cd000), + (0x3fc19000), + (0x3fcd0000), + (0x3fa0800f), + (0x3fac100f), + (0x3fe1500f), + (0x3fedc00f), + (0x3fa0c00f), + (0x3fac500f), + (0x3fe1100f), + (0x3fed800f)}, + (0xfff80000), + {0x7f,0xa7,0x79,0xc1,0x02,0x5a,0xb9,0x48,0xd7,0xc2, + 0x1b,0xde,0x64,0x28,0xca,0x0c,0xa1,0xb8,0xbd,0x71,0x00} + }, + { + /* No.65 delta:1199 weight:1181 */ + 11213, + 35, + 20, + 9, + {(0x00000000), + (0xf97f5fb7), + (0x820665df), + (0x7b793a68), + (0xeda00417), + (0x14df5ba0), + (0x6fa661c8), + (0x96d93e7f), + (0x0000be8a), + (0xf97fe13d), + (0x8206db55), + (0x7b7984e2), + (0xeda0ba9d), + (0x14dfe52a), + (0x6fa6df42), + (0x96d980f5)}, + {(0x00000000), + (0x0c163000), + (0x000c1000), + (0x0c1a2000), + (0xc0028000), + (0xcc14b000), + (0xc00e9000), + (0xcc18a000), + (0x7101de00), + (0x7d17ee00), + (0x710dce00), + (0x7d1bfe00), + (0xb1035e00), + (0xbd156e00), + (0xb10f4e00), + (0xbd197e00)}, + {(0x3f800000), + (0x3f860b18), + (0x3f800608), + (0x3f860d10), + (0x3fe00140), + (0x3fe60a58), + (0x3fe00748), + (0x3fe60c50), + (0x3fb880ef), + (0x3fbe8bf7), + (0x3fb886e7), + (0x3fbe8dff), + (0x3fd881af), + (0x3fde8ab7), + (0x3fd887a7), + (0x3fde8cbf)}, + (0xfff80000), + {0x44,0x09,0x7e,0x16,0x6a,0x0b,0xbf,0xd6,0xf6,0x83, + 0xc1,0x33,0x24,0x8d,0x24,0x40,0xc5,0xee,0xb0,0xd2,0x00} + }, + { + /* No.66 delta:1553 weight:539 */ + 11213, + 26, + 13, + 19, + {(0x00000000), + (0xc75eb6dc), + (0xfa4bc661), + (0x3d1570bd), + (0x6f600428), + (0xa83eb2f4), + (0x952bc249), + (0x52757495), + (0x0000df90), + (0xc75e694c), + (0xfa4b19f1), + (0x3d15af2d), + (0x6f60dbb8), + (0xa83e6d64), + (0x952b1dd9), + (0x5275ab05)}, + {(0x00000000), + (0x00521800), + (0x20647400), + (0x20366c00), + (0x60dc1800), + (0x608e0000), + (0x40b86c00), + (0x40ea7400), + (0x10341e00), + (0x10660600), + (0x30506a00), + (0x30027200), + (0x70e80600), + (0x70ba1e00), + (0x508c7200), + (0x50de6a00)}, + {(0x3f800000), + (0x3f80290c), + (0x3f90323a), + (0x3f901b36), + (0x3fb06e0c), + (0x3fb04700), + (0x3fa05c36), + (0x3fa0753a), + (0x3f881a0f), + (0x3f883303), + (0x3f982835), + (0x3f980139), + (0x3fb87403), + (0x3fb85d0f), + (0x3fa84639), + (0x3fa86f35)}, + (0xfff80000), + {0xe3,0x81,0xfe,0x0e,0xae,0xa6,0x17,0x99,0xb5,0xdc, + 0x36,0xa3,0xa9,0x84,0x5e,0xac,0xaf,0x0b,0xa6,0x5e,0x00} + }, + { + /* No.67 delta:1370 weight:1349 */ + 11213, + 50, + 8, + 4, + {(0x00000000), + (0xf2eee92e), + (0x184a48a6), + (0xeaa4a188), + (0x3cb00439), + (0xce5eed17), + (0x24fa4c9f), + (0xd614a5b1), + (0x0000c236), + (0xf2ee2b18), + (0x184a8a90), + (0xeaa463be), + (0x3cb0c60f), + (0xce5e2f21), + (0x24fa8ea9), + (0xd6146787)}, + {(0x00000000), + (0x40028000), + (0x70014000), + (0x3003c000), + (0x20002000), + (0x6002a000), + (0x50016000), + (0x1003e000), + (0x10001e00), + (0x50029e00), + (0x60015e00), + (0x2003de00), + (0x30003e00), + (0x7002be00), + (0x40017e00), + (0x0003fe00)}, + {(0x3f800000), + (0x3fa00140), + (0x3fb800a0), + (0x3f9801e0), + (0x3f900010), + (0x3fb00150), + (0x3fa800b0), + (0x3f8801f0), + (0x3f88000f), + (0x3fa8014f), + (0x3fb000af), + (0x3f9001ef), + (0x3f98001f), + (0x3fb8015f), + (0x3fa000bf), + (0x3f8001ff)}, + (0xfff80000), + {0xce,0xab,0xcf,0x53,0x4e,0xc1,0xc1,0xd0,0x64,0x84, + 0xd7,0xc3,0xad,0x13,0xad,0xf4,0xf7,0x14,0xe1,0xd6,0x00} + }, + { + /* No.68 delta:1769 weight:1053 */ + 11213, + 44, + 23, + 7, + {(0x00000000), + (0x1c10f784), + (0xb81f8711), + (0xa40f7095), + (0xd0d00449), + (0xccc0f3cd), + (0x68cf8358), + (0x74df74dc), + (0x00006582), + (0x1c109206), + (0xb81fe293), + (0xa40f1517), + (0xd0d061cb), + (0xccc0964f), + (0x68cfe6da), + (0x74df115e)}, + {(0x00000000), + (0x009da000), + (0x40746000), + (0x40e9c000), + (0x00028400), + (0x009f2400), + (0x4076e400), + (0x40eb4400), + (0x700bbe00), + (0x70961e00), + (0x307fde00), + (0x30e27e00), + (0x70093a00), + (0x70949a00), + (0x307d5a00), + (0x30e0fa00)}, + {(0x3f800000), + (0x3f804ed0), + (0x3fa03a30), + (0x3fa074e0), + (0x3f800142), + (0x3f804f92), + (0x3fa03b72), + (0x3fa075a2), + (0x3fb805df), + (0x3fb84b0f), + (0x3f983fef), + (0x3f98713f), + (0x3fb8049d), + (0x3fb84a4d), + (0x3f983ead), + (0x3f98707d)}, + (0xfff80000), + {0x25,0xc5,0x2b,0x7e,0x94,0x70,0x50,0xab,0x68,0x79, + 0xe0,0x34,0x49,0x1e,0xd3,0x2a,0xe2,0x9f,0xef,0x26,0x00} + }, + { + /* No.69 delta:1887 weight:1253 */ + 11213, + 64, + 9, + 8, + {(0x00000000), + (0x4cbf4fb8), + (0xcc209ffc), + (0x809fd044), + (0x7e700455), + (0x32cf4bed), + (0xb2509ba9), + (0xfeefd411), + (0x0000612d), + (0x4cbf2e95), + (0xcc20fed1), + (0x809fb169), + (0x7e706578), + (0x32cf2ac0), + (0xb250fa84), + (0xfeefb53c)}, + {(0x00000000), + (0x50090000), + (0x00035000), + (0x500a5000), + (0x04019000), + (0x54089000), + (0x0402c000), + (0x540bc000), + (0x05027e00), + (0x550b7e00), + (0x05012e00), + (0x55082e00), + (0x0103ee00), + (0x510aee00), + (0x0100be00), + (0x5109be00)}, + {(0x3f800000), + (0x3fa80480), + (0x3f8001a8), + (0x3fa80528), + (0x3f8200c8), + (0x3faa0448), + (0x3f820160), + (0x3faa05e0), + (0x3f82813f), + (0x3faa85bf), + (0x3f828097), + (0x3faa8417), + (0x3f8081f7), + (0x3fa88577), + (0x3f80805f), + (0x3fa884df)}, + (0xfff80000), + {0x1f,0x11,0x3a,0x53,0x30,0xf5,0x3a,0x92,0x69,0x8f, + 0x5e,0x40,0x86,0x58,0x16,0xa4,0x7f,0x33,0x04,0xc6,0x00} + }, + { + /* No.70 delta:1651 weight:1401 */ + 11213, + 35, + 9, + 8, + {(0x00000000), + (0xcaa73bcd), + (0x48ffa480), + (0x82589f4d), + (0x0b600460), + (0xc1c73fad), + (0x439fa0e0), + (0x89389b2d), + (0x0000d8fb), + (0xcaa7e336), + (0x48ff7c7b), + (0x825847b6), + (0x0b60dc9b), + (0xc1c7e756), + (0x439f781b), + (0x893843d6)}, + {(0x00000000), + (0x90604200), + (0x20222000), + (0xb0426200), + (0x5023a800), + (0xc043ea00), + (0x70018800), + (0xe061ca00), + (0x16031e00), + (0x86635c00), + (0x36213e00), + (0xa6417c00), + (0x4620b600), + (0xd640f400), + (0x66029600), + (0xf662d400)}, + {(0x3f800000), + (0x3fc83021), + (0x3f901110), + (0x3fd82131), + (0x3fa811d4), + (0x3fe021f5), + (0x3fb800c4), + (0x3ff030e5), + (0x3f8b018f), + (0x3fc331ae), + (0x3f9b109f), + (0x3fd320be), + (0x3fa3105b), + (0x3feb207a), + (0x3fb3014b), + (0x3ffb316a)}, + (0xfff80000), + {0xf7,0xac,0x3b,0x82,0x60,0x2e,0xa2,0x38,0xd5,0xbd, + 0x9e,0x07,0x19,0x05,0x37,0x68,0xa8,0x2b,0xcc,0x5b,0x00} + }, + { + /* No.71 delta:805 weight:1559 */ + 11213, + 85, + 17, + 2, + {(0x00000000), + (0x4ea39f4b), + (0xeedcca5e), + (0xa07f5515), + (0x1a80047d), + (0x54239b36), + (0xf45cce23), + (0xbaff5168), + (0x000051a3), + (0x4ea3cee8), + (0xeedc9bfd), + (0xa07f04b6), + (0x1a8055de), + (0x5423ca95), + (0xf45c9f80), + (0xbaff00cb)}, + {(0x00000000), + (0x0879e800), + (0x10141400), + (0x186dfc00), + (0x006c0800), + (0x0815e000), + (0x10781c00), + (0x1801f400), + (0x40237e00), + (0x485a9600), + (0x50376a00), + (0x584e8200), + (0x404f7600), + (0x48369e00), + (0x505b6200), + (0x58228a00)}, + {(0x3f800000), + (0x3f843cf4), + (0x3f880a0a), + (0x3f8c36fe), + (0x3f803604), + (0x3f840af0), + (0x3f883c0e), + (0x3f8c00fa), + (0x3fa011bf), + (0x3fa42d4b), + (0x3fa81bb5), + (0x3fac2741), + (0x3fa027bb), + (0x3fa41b4f), + (0x3fa82db1), + (0x3fac1145)}, + (0xfff80000), + {0x81,0x81,0xe0,0x37,0x51,0x1b,0x87,0x01,0xa3,0x40, + 0x70,0xd0,0xb9,0x63,0xbb,0xc0,0xe9,0x49,0x0b,0x62,0x00} + }, + { + /* No.72 delta:1929 weight:1383 */ + 11213, + 77, + 8, + 10, + {(0x00000000), + (0x9625646a), + (0xa06390e5), + (0x3646f48f), + (0x6c400487), + (0xfa6560ed), + (0xcc239462), + (0x5a06f008), + (0x00006232), + (0x96250658), + (0xa063f2d7), + (0x364696bd), + (0x6c4066b5), + (0xfa6502df), + (0xcc23f650), + (0x5a06923a)}, + {(0x00000000), + (0x60350000), + (0x08a08000), + (0x68958000), + (0x00120000), + (0x60270000), + (0x08b28000), + (0x68878000), + (0x60021e00), + (0x00371e00), + (0x68a29e00), + (0x08979e00), + (0x60101e00), + (0x00251e00), + (0x68b09e00), + (0x08859e00)}, + {(0x3f800000), + (0x3fb01a80), + (0x3f845040), + (0x3fb44ac0), + (0x3f800900), + (0x3fb01380), + (0x3f845940), + (0x3fb443c0), + (0x3fb0010f), + (0x3f801b8f), + (0x3fb4514f), + (0x3f844bcf), + (0x3fb0080f), + (0x3f80128f), + (0x3fb4584f), + (0x3f8442cf)}, + (0xfff80000), + {0xec,0xe8,0xd6,0x3f,0xf0,0x4f,0x6e,0xc9,0x92,0xb9, + 0x0b,0xf3,0x46,0x01,0x83,0x06,0xba,0xbb,0xfc,0x3c,0x00} + }, + { + /* No.73 delta:1312 weight:1037 */ + 11213, + 79, + 14, + 13, + {(0x00000000), + (0x3c3b4194), + (0x3b4a522a), + (0x077113be), + (0x70e00495), + (0x4cdb4501), + (0x4baa56bf), + (0x7791172b), + (0x00001842), + (0x3c3b59d6), + (0x3b4a4a68), + (0x07710bfc), + (0x70e01cd7), + (0x4cdb5d43), + (0x4baa4efd), + (0x77910f69)}, + {(0x00000000), + (0x5e1d3000), + (0x08002800), + (0x561d1800), + (0x00404000), + (0x5e5d7000), + (0x08406800), + (0x565d5800), + (0xa7841e00), + (0xf9992e00), + (0xaf843600), + (0xf1990600), + (0xa7c45e00), + (0xf9d96e00), + (0xafc47600), + (0xf1d94600)}, + {(0x3f800000), + (0x3faf0e98), + (0x3f840014), + (0x3fab0e8c), + (0x3f802020), + (0x3faf2eb8), + (0x3f842034), + (0x3fab2eac), + (0x3fd3c20f), + (0x3ffccc97), + (0x3fd7c21b), + (0x3ff8cc83), + (0x3fd3e22f), + (0x3ffcecb7), + (0x3fd7e23b), + (0x3ff8eca3)}, + (0xfff80000), + {0xe5,0x84,0x28,0x6a,0xc7,0xb8,0xff,0x35,0x7e,0x4a, + 0xd0,0x29,0x99,0x65,0xc9,0xf9,0x00,0xb5,0xa5,0x73,0x00} + }, + { + /* No.74 delta:1274 weight:753 */ + 11213, + 83, + 10, + 18, + {(0x00000000), + (0xdb6fd096), + (0x7bead936), + (0xa08509a0), + (0x059004a2), + (0xdeffd434), + (0x7e7add94), + (0xa5150d02), + (0x00003dd4), + (0xdb6fed42), + (0x7beae4e2), + (0xa0853474), + (0x05903976), + (0xdeffe9e0), + (0x7e7ae040), + (0xa51530d6)}, + {(0x00000000), + (0x0862a000), + (0x20176000), + (0x2875c000), + (0x21182000), + (0x297a8000), + (0x010f4000), + (0x096de000), + (0x100c1e00), + (0x186ebe00), + (0x301b7e00), + (0x3879de00), + (0x31143e00), + (0x39769e00), + (0x11035e00), + (0x1961fe00)}, + {(0x3f800000), + (0x3f843150), + (0x3f900bb0), + (0x3f943ae0), + (0x3f908c10), + (0x3f94bd40), + (0x3f8087a0), + (0x3f84b6f0), + (0x3f88060f), + (0x3f8c375f), + (0x3f980dbf), + (0x3f9c3cef), + (0x3f988a1f), + (0x3f9cbb4f), + (0x3f8881af), + (0x3f8cb0ff)}, + (0xfff80000), + {0x94,0x6b,0xe1,0x97,0xcf,0xd7,0x1d,0x69,0x3d,0xf1, + 0xd3,0x31,0x9b,0x3f,0x74,0x40,0xe4,0x78,0x37,0x93,0x00} + }, + { + /* No.75 delta:3240 weight:999 */ + 11213, + 25, + 3, + 14, + {(0x00000000), + (0x5231ede5), + (0x75f41157), + (0x27c5fcb2), + (0x231004bc), + (0x7121e959), + (0x56e415eb), + (0x04d5f80e), + (0x000014a2), + (0x5231f947), + (0x75f405f5), + (0x27c5e810), + (0x2310101e), + (0x7121fdfb), + (0x56e40149), + (0x04d5ecac)}, + {(0x00000000), + (0x09c10000), + (0x50f28000), + (0x59338000), + (0x12424000), + (0x1b834000), + (0x42b0c000), + (0x4b71c000), + (0x02361e00), + (0x0bf71e00), + (0x52c49e00), + (0x5b059e00), + (0x10745e00), + (0x19b55e00), + (0x4086de00), + (0x4947de00)}, + {(0x3f800000), + (0x3f84e080), + (0x3fa87940), + (0x3fac99c0), + (0x3f892120), + (0x3f8dc1a0), + (0x3fa15860), + (0x3fa5b8e0), + (0x3f811b0f), + (0x3f85fb8f), + (0x3fa9624f), + (0x3fad82cf), + (0x3f883a2f), + (0x3f8cdaaf), + (0x3fa0436f), + (0x3fa4a3ef)}, + (0xfff80000), + {0x22,0xa1,0x8f,0x2e,0x7e,0xb0,0x8f,0x95,0xab,0x7b, + 0xe4,0x15,0x6f,0x5a,0x78,0x2a,0xeb,0x47,0xfe,0xa6,0x00} + }, + { + /* No.76 delta:1884 weight:1457 */ + 11213, + 11, + 13, + 3, + {(0x00000000), + (0xb165bd1d), + (0x1f5b5cd1), + (0xae3ee1cc), + (0x07b004ca), + (0xb6d5b9d7), + (0x18eb581b), + (0xa98ee506), + (0x00000ebc), + (0xb165b3a1), + (0x1f5b526d), + (0xae3eef70), + (0x07b00a76), + (0xb6d5b76b), + (0x18eb56a7), + (0xa98eebba)}, + {(0x00000000), + (0x2a1ef400), + (0x43091000), + (0x6917e400), + (0x05182000), + (0x2f06d400), + (0x46113000), + (0x6c0fc400), + (0x20c41e00), + (0x0adaea00), + (0x63cd0e00), + (0x49d3fa00), + (0x25dc3e00), + (0x0fc2ca00), + (0x66d52e00), + (0x4ccbda00)}, + {(0x3f800000), + (0x3f950f7a), + (0x3fa18488), + (0x3fb48bf2), + (0x3f828c10), + (0x3f97836a), + (0x3fa30898), + (0x3fb607e2), + (0x3f90620f), + (0x3f856d75), + (0x3fb1e687), + (0x3fa4e9fd), + (0x3f92ee1f), + (0x3f87e165), + (0x3fb36a97), + (0x3fa665ed)}, + (0xfff80000), + {0x5f,0x66,0x78,0x0e,0x66,0x3f,0x37,0x9d,0x75,0xa2, + 0x49,0x78,0xb7,0x8c,0xf1,0x7c,0x84,0xf3,0xab,0x84,0x00} + }, + { + /* No.77 delta:1037 weight:1439 */ + 11213, + 43, + 15, + 7, + {(0x00000000), + (0x3b7738f7), + (0x2ee7f42b), + (0x1590ccdc), + (0x8c3004de), + (0xb7473c29), + (0xa2d7f0f5), + (0x99a0c802), + (0x0000b3f9), + (0x3b778b0e), + (0x2ee747d2), + (0x15907f25), + (0x8c30b727), + (0xb7478fd0), + (0xa2d7430c), + (0x99a07bfb)}, + {(0x00000000), + (0x20009400), + (0x70030800), + (0x50039c00), + (0x90011600), + (0xb0018200), + (0xe0021e00), + (0xc0028a00), + (0x40005e00), + (0x6000ca00), + (0x30035600), + (0x1003c200), + (0xd0014800), + (0xf001dc00), + (0xa0024000), + (0x8002d400)}, + {(0x3f800000), + (0x3f90004a), + (0x3fb80184), + (0x3fa801ce), + (0x3fc8008b), + (0x3fd800c1), + (0x3ff0010f), + (0x3fe00145), + (0x3fa0002f), + (0x3fb00065), + (0x3f9801ab), + (0x3f8801e1), + (0x3fe800a4), + (0x3ff800ee), + (0x3fd00120), + (0x3fc0016a)}, + (0xfff80000), + {0x4d,0xd9,0x1c,0xbc,0x61,0x94,0x41,0xb3,0x64,0x5a, + 0xe0,0x27,0x21,0x33,0x58,0x8a,0x3a,0x27,0xe7,0x61,0x00} + }, + { + /* No.78 delta:3771 weight:1149 */ + 11213, + 67, + 6, + 13, + {(0x00000000), + (0xeb935e7e), + (0x12dd9004), + (0xf94ece7a), + (0x518004ec), + (0xba135a92), + (0x435d94e8), + (0xa8ceca96), + (0x00002915), + (0xeb93776b), + (0x12ddb911), + (0xf94ee76f), + (0x51802df9), + (0xba137387), + (0x435dbdfd), + (0xa8cee383)}, + {(0x00000000), + (0x00600000), + (0x005c0000), + (0x003c0000), + (0xa7000000), + (0xa7600000), + (0xa75c0000), + (0xa73c0000), + (0x00381e00), + (0x00581e00), + (0x00641e00), + (0x00041e00), + (0xa7381e00), + (0xa7581e00), + (0xa7641e00), + (0xa7041e00)}, + {(0x3f800000), + (0x3f803000), + (0x3f802e00), + (0x3f801e00), + (0x3fd38000), + (0x3fd3b000), + (0x3fd3ae00), + (0x3fd39e00), + (0x3f801c0f), + (0x3f802c0f), + (0x3f80320f), + (0x3f80020f), + (0x3fd39c0f), + (0x3fd3ac0f), + (0x3fd3b20f), + (0x3fd3820f)}, + (0xfff80000), + {0x61,0xb9,0x79,0x4a,0xf6,0x0b,0x90,0x19,0x41,0xed, + 0xc7,0x02,0x30,0x6e,0x66,0x3a,0xa0,0x21,0x38,0x4d,0x00} + }, + { + /* No.79 delta:8905 weight:995 */ + 11213, + 37, + 2, + 14, + {(0x00000000), + (0xc386d224), + (0xa19cefca), + (0x621a3dee), + (0x73c004f0), + (0xb046d6d4), + (0xd25ceb3a), + (0x11da391e), + (0x00006023), + (0xc386b207), + (0xa19c8fe9), + (0x621a5dcd), + (0x73c064d3), + (0xb046b6f7), + (0xd25c8b19), + (0x11da593d)}, + {(0x00000000), + (0x50000000), + (0x60000000), + (0x30000000), + (0x00000000), + (0x50000000), + (0x60000000), + (0x30000000), + (0x10001e00), + (0x40001e00), + (0x70001e00), + (0x20001e00), + (0x10001e00), + (0x40001e00), + (0x70001e00), + (0x20001e00)}, + {(0x3f800000), + (0x3fa80000), + (0x3fb00000), + (0x3f980000), + (0x3f800000), + (0x3fa80000), + (0x3fb00000), + (0x3f980000), + (0x3f88000f), + (0x3fa0000f), + (0x3fb8000f), + (0x3f90000f), + (0x3f88000f), + (0x3fa0000f), + (0x3fb8000f), + (0x3f90000f)}, + (0xfff80000), + {0xcd,0x77,0xa6,0x4e,0x16,0x97,0x82,0x51,0x40,0x8c, + 0x23,0x3d,0x69,0x41,0x55,0xf4,0x6d,0xb5,0x97,0xc4,0x00} + }, + { + /* No.80 delta:1084 weight:1327 */ + 11213, + 41, + 20, + 7, + {(0x00000000), + (0x03b0124c), + (0x2709d148), + (0x24b9c304), + (0xd150050f), + (0xd2e01743), + (0xf659d447), + (0xf5e9c60b), + (0x0000e5a0), + (0x03b0f7ec), + (0x270934e8), + (0x24b926a4), + (0xd150e0af), + (0xd2e0f2e3), + (0xf65931e7), + (0xf5e923ab)}, + {(0x00000000), + (0x58fc3200), + (0x70059800), + (0x28f9aa00), + (0x00443a00), + (0x58b80800), + (0x7041a200), + (0x28bd9000), + (0x60225e00), + (0x38de6c00), + (0x1027c600), + (0x48dbf400), + (0x60666400), + (0x389a5600), + (0x1063fc00), + (0x489fce00)}, + {(0x3f800000), + (0x3fac7e19), + (0x3fb802cc), + (0x3f947cd5), + (0x3f80221d), + (0x3fac5c04), + (0x3fb820d1), + (0x3f945ec8), + (0x3fb0112f), + (0x3f9c6f36), + (0x3f8813e3), + (0x3fa46dfa), + (0x3fb03332), + (0x3f9c4d2b), + (0x3f8831fe), + (0x3fa44fe7)}, + (0xfff80000), + {0x17,0x06,0xb5,0x56,0x08,0x24,0x02,0x45,0x7d,0xec, + 0xaa,0x6e,0xee,0x42,0x3d,0x61,0xec,0x7b,0x95,0xda,0x00} + }, + { + /* No.81 delta:2107 weight:929 */ + 11213, + 68, + 7, + 13, + {(0x00000000), + (0xa2680084), + (0x72c07011), + (0xd0a87095), + (0xe9c00518), + (0x4ba8059c), + (0x9b007509), + (0x3968758d), + (0x000019d6), + (0xa2681952), + (0x72c069c7), + (0xd0a86943), + (0xe9c01cce), + (0x4ba81c4a), + (0x9b006cdf), + (0x39686c5b)}, + {(0x00000000), + (0x06214000), + (0x50182000), + (0x56396000), + (0x004c0000), + (0x066d4000), + (0x50542000), + (0x56756000), + (0x003abe00), + (0x061bfe00), + (0x50229e00), + (0x5603de00), + (0x0076be00), + (0x0657fe00), + (0x506e9e00), + (0x564fde00)}, + {(0x3f800000), + (0x3f8310a0), + (0x3fa80c10), + (0x3fab1cb0), + (0x3f802600), + (0x3f8336a0), + (0x3fa82a10), + (0x3fab3ab0), + (0x3f801d5f), + (0x3f830dff), + (0x3fa8114f), + (0x3fab01ef), + (0x3f803b5f), + (0x3f832bff), + (0x3fa8374f), + (0x3fab27ef)}, + (0xfff80000), + {0x06,0xc1,0x16,0x3a,0x4b,0xf5,0xcc,0xe4,0x06,0xc5, + 0x47,0x64,0xd8,0x26,0x6e,0xa3,0xd2,0xe3,0xfc,0x67,0x00} + }, + { + /* No.82 delta:1653 weight:993 */ + 11213, + 67, + 15, + 1, + {(0x00000000), + (0x205bddc2), + (0x51a5fb05), + (0x71fe26c7), + (0xbc800525), + (0x9cdbd8e7), + (0xed25fe20), + (0xcd7e23e2), + (0x0000ae60), + (0x205b73a2), + (0x51a55565), + (0x71fe88a7), + (0xbc80ab45), + (0x9cdb7687), + (0xed255040), + (0xcd7e8d82)}, + {(0x00000000), + (0x200d8e00), + (0x01004000), + (0x210dce00), + (0x1710c000), + (0x371d4e00), + (0x16108000), + (0x361d0e00), + (0x00409e00), + (0x204d1000), + (0x0140de00), + (0x214d5000), + (0x17505e00), + (0x375dd000), + (0x16501e00), + (0x365d9000)}, + {(0x3f800000), + (0x3f9006c7), + (0x3f808020), + (0x3f9086e7), + (0x3f8b8860), + (0x3f9b8ea7), + (0x3f8b0840), + (0x3f9b0e87), + (0x3f80204f), + (0x3f902688), + (0x3f80a06f), + (0x3f90a6a8), + (0x3f8ba82f), + (0x3f9baee8), + (0x3f8b280f), + (0x3f9b2ec8)}, + (0xfff80000), + {0x31,0x5a,0x14,0x56,0x22,0x69,0x71,0xb4,0xed,0xe9, + 0x57,0x3c,0xb3,0xa3,0xc2,0xd8,0x5c,0x3b,0xf9,0x7a,0x00} + }, + { + /* No.83 delta:2591 weight:1355 */ + 11213, + 78, + 3, + 3, + {(0x00000000), + (0x3fa6f3ae), + (0x11561526), + (0x2ef0e688), + (0x3f40053d), + (0x00e6f693), + (0x2e16101b), + (0x11b0e3b5), + (0x000038dd), + (0x3fa6cb73), + (0x11562dfb), + (0x2ef0de55), + (0x3f403de0), + (0x00e6ce4e), + (0x2e1628c6), + (0x11b0db68)}, + {(0x00000000), + (0x88264000), + (0x60420000), + (0xe8644000), + (0x20102000), + (0xa8366000), + (0x40522000), + (0xc8746000), + (0x00791e00), + (0x885f5e00), + (0x603b1e00), + (0xe81d5e00), + (0x20693e00), + (0xa84f7e00), + (0x402b3e00), + (0xc80d7e00)}, + {(0x3f800000), + (0x3fc41320), + (0x3fb02100), + (0x3ff43220), + (0x3f900810), + (0x3fd41b30), + (0x3fa02910), + (0x3fe43a30), + (0x3f803c8f), + (0x3fc42faf), + (0x3fb01d8f), + (0x3ff40eaf), + (0x3f90349f), + (0x3fd427bf), + (0x3fa0159f), + (0x3fe406bf)}, + (0xfff80000), + {0x95,0xde,0xea,0xd2,0x91,0x96,0x3a,0x31,0x18,0xb4, + 0x29,0x3c,0x05,0x83,0x13,0x20,0xa6,0xbb,0xfa,0x90,0x00} + }, + { + /* No.84 delta:1724 weight:1387 */ + 11213, + 31, + 24, + 7, + {(0x00000000), + (0x6f77a064), + (0x9d4e3ea4), + (0xf2399ec0), + (0xdab00543), + (0xb5c7a527), + (0x47fe3be7), + (0x28899b83), + (0x0000ba57), + (0x6f771a33), + (0x9d4e84f3), + (0xf2392497), + (0xdab0bf14), + (0xb5c71f70), + (0x47fe81b0), + (0x288921d4)}, + {(0x00000000), + (0x4052c800), + (0x403d7000), + (0x006fb800), + (0x01748400), + (0x41264c00), + (0x4149f400), + (0x011b3c00), + (0x30183e00), + (0x704af600), + (0x70254e00), + (0x30778600), + (0x316cba00), + (0x713e7200), + (0x7151ca00), + (0x31030200)}, + {(0x3f800000), + (0x3fa02964), + (0x3fa01eb8), + (0x3f8037dc), + (0x3f80ba42), + (0x3fa09326), + (0x3fa0a4fa), + (0x3f808d9e), + (0x3f980c1f), + (0x3fb8257b), + (0x3fb812a7), + (0x3f983bc3), + (0x3f98b65d), + (0x3fb89f39), + (0x3fb8a8e5), + (0x3f988181)}, + (0xfff80000), + {0x24,0x42,0xb5,0x8a,0x26,0x25,0x0b,0x43,0xb5,0xa1, + 0xfd,0xf3,0xef,0xe4,0x58,0x1d,0x2f,0x82,0x54,0xe1,0x00} + }, + { + /* No.85 delta:1315 weight:1167 */ + 11213, + 28, + 18, + 8, + {(0x00000000), + (0x7039a7b2), + (0x655a69d6), + (0x1563ce64), + (0x55800552), + (0x25b9a2e0), + (0x30da6c84), + (0x40e3cb36), + (0x0000db22), + (0x70397c90), + (0x655ab2f4), + (0x15631546), + (0x5580de70), + (0x25b979c2), + (0x30dab7a6), + (0x40e31014)}, + {(0x00000000), + (0x091ae000), + (0xc01fd200), + (0xc9053200), + (0x60072600), + (0x691dc600), + (0xa018f400), + (0xa9021400), + (0x40083e00), + (0x4912de00), + (0x8017ec00), + (0x890d0c00), + (0x200f1800), + (0x2915f800), + (0xe010ca00), + (0xe90a2a00)}, + {(0x3f800000), + (0x3f848d70), + (0x3fe00fe9), + (0x3fe48299), + (0x3fb00393), + (0x3fb48ee3), + (0x3fd00c7a), + (0x3fd4810a), + (0x3fa0041f), + (0x3fa4896f), + (0x3fc00bf6), + (0x3fc48686), + (0x3f90078c), + (0x3f948afc), + (0x3ff00865), + (0x3ff48515)}, + (0xfff80000), + {0x54,0x00,0xe5,0x09,0x83,0x8a,0xa3,0xac,0xe2,0x03, + 0xe4,0x5f,0x87,0xaa,0x93,0x3c,0x49,0xef,0xf1,0x12,0x00} + }, + { + /* No.86 delta:1805 weight:1023 */ + 11213, + 40, + 17, + 1, + {(0x00000000), + (0xd727963d), + (0x760f18b0), + (0xa1288e8d), + (0xe2d00563), + (0x35f7935e), + (0x94df1dd3), + (0x43f88bee), + (0x0000c942), + (0xd7275f7f), + (0x760fd1f2), + (0xa12847cf), + (0xe2d0cc21), + (0x35f75a1c), + (0x94dfd491), + (0x43f842ac)}, + {(0x00000000), + (0x207c0400), + (0x56934000), + (0x76ef4400), + (0x00009e00), + (0x207c9a00), + (0x5693de00), + (0x76efda00), + (0x20009e00), + (0x007c9a00), + (0x7693de00), + (0x56efda00), + (0x20000000), + (0x007c0400), + (0x76934000), + (0x56ef4400)}, + {(0x3f800000), + (0x3f903e02), + (0x3fab49a0), + (0x3fbb77a2), + (0x3f80004f), + (0x3f903e4d), + (0x3fab49ef), + (0x3fbb77ed), + (0x3f90004f), + (0x3f803e4d), + (0x3fbb49ef), + (0x3fab77ed), + (0x3f900000), + (0x3f803e02), + (0x3fbb49a0), + (0x3fab77a2)}, + (0xfff80000), + {0xc8,0x53,0x9a,0xab,0x96,0xd8,0xe7,0x02,0xe6,0xf1, + 0x74,0x36,0x00,0x32,0x32,0x6e,0x36,0xe4,0x78,0x88,0x00} + }, + { + /* No.87 delta:2165 weight:1423 */ + 11213, + 29, + 6, + 7, + {(0x00000000), + (0xb0a4f75d), + (0xd99a0020), + (0x693ef77d), + (0x0010057f), + (0xb0b4f222), + (0xd98a055f), + (0x692ef202), + (0x00002860), + (0xb0a4df3d), + (0xd99a2840), + (0x693edf1d), + (0x00102d1f), + (0xb0b4da42), + (0xd98a2d3f), + (0x692eda62)}, + {(0x00000000), + (0x00c02000), + (0x10102000), + (0x10d00000), + (0x700c0000), + (0x70cc2000), + (0x601c2000), + (0x60dc0000), + (0x00701e00), + (0x00b03e00), + (0x10603e00), + (0x10a01e00), + (0x707c1e00), + (0x70bc3e00), + (0x606c3e00), + (0x60ac1e00)}, + {(0x3f800000), + (0x3f806010), + (0x3f880810), + (0x3f886800), + (0x3fb80600), + (0x3fb86610), + (0x3fb00e10), + (0x3fb06e00), + (0x3f80380f), + (0x3f80581f), + (0x3f88301f), + (0x3f88500f), + (0x3fb83e0f), + (0x3fb85e1f), + (0x3fb0361f), + (0x3fb0560f)}, + (0xfff80000), + {0xc8,0x26,0xe1,0xb8,0xbd,0xd2,0x06,0x99,0x21,0x8b, + 0xa2,0x82,0x21,0x08,0x66,0x43,0x39,0x7d,0x22,0x3f,0x00} + }, + { + /* No.88 delta:2728 weight:929 */ + 11213, + 9, + 5, + 12, + {(0x00000000), + (0xba91b8b7), + (0x1f94657f), + (0xa505ddc8), + (0xc8900581), + (0x7201bd36), + (0xd70460fe), + (0x6d95d849), + (0x00009507), + (0xba912db0), + (0x1f94f078), + (0xa50548cf), + (0xc8909086), + (0x72012831), + (0xd704f5f9), + (0x6d954d4e)}, + {(0x00000000), + (0x74d60000), + (0x48810000), + (0x3c570000), + (0x07840000), + (0x73520000), + (0x4f050000), + (0x3bd30000), + (0xa0019e00), + (0xd4d79e00), + (0xe8809e00), + (0x9c569e00), + (0xa7859e00), + (0xd3539e00), + (0xef049e00), + (0x9bd29e00)}, + {(0x3f800000), + (0x3fba6b00), + (0x3fa44080), + (0x3f9e2b80), + (0x3f83c200), + (0x3fb9a900), + (0x3fa78280), + (0x3f9de980), + (0x3fd000cf), + (0x3fea6bcf), + (0x3ff4404f), + (0x3fce2b4f), + (0x3fd3c2cf), + (0x3fe9a9cf), + (0x3ff7824f), + (0x3fcde94f)}, + (0xfff80000), + {0xef,0x82,0x25,0x92,0x4d,0x84,0x32,0xcc,0x51,0x79, + 0xa6,0xf1,0xa8,0xb8,0xd3,0xc8,0xf4,0x1f,0x61,0x14,0x00} + }, + { + /* No.89 delta:1302 weight:829 */ + 11213, + 52, + 17, + 15, + {(0x00000000), + (0xff9c667b), + (0x076e42cb), + (0xf8f224b0), + (0x5a200593), + (0xa5bc63e8), + (0x5d4e4758), + (0xa2d22123), + (0x0000fbe9), + (0xff9c9d92), + (0x076eb922), + (0xf8f2df59), + (0x5a20fe7a), + (0xa5bc9801), + (0x5d4ebcb1), + (0xa2d2daca)}, + {(0x00000000), + (0x168c2000), + (0x08819000), + (0x1e0db000), + (0x8400d800), + (0x928cf800), + (0x8c814800), + (0x9a0d6800), + (0x0a023e00), + (0x1c8e1e00), + (0x0283ae00), + (0x140f8e00), + (0x8e02e600), + (0x988ec600), + (0x86837600), + (0x900f5600)}, + {(0x3f800000), + (0x3f8b4610), + (0x3f8440c8), + (0x3f8f06d8), + (0x3fc2006c), + (0x3fc9467c), + (0x3fc640a4), + (0x3fcd06b4), + (0x3f85011f), + (0x3f8e470f), + (0x3f8141d7), + (0x3f8a07c7), + (0x3fc70173), + (0x3fcc4763), + (0x3fc341bb), + (0x3fc807ab)}, + (0xfff80000), + {0x44,0x22,0x55,0x0c,0x46,0x02,0x05,0x6b,0x49,0xa7, + 0x79,0xcc,0xa0,0x5b,0x5c,0xeb,0x82,0xb3,0x48,0x1e,0x00} + }, + { + /* No.90 delta:1794 weight:683 */ + 11213, + 71, + 7, + 3, + {(0x00000000), + (0x28fcb37c), + (0x3de27e63), + (0x151ecd1f), + (0x99d005af), + (0xb12cb6d3), + (0xa4327bcc), + (0x8ccec8b0), + (0x0000473d), + (0x28fcf441), + (0x3de2395e), + (0x151e8a22), + (0x99d04292), + (0xb12cf1ee), + (0xa4323cf1), + (0x8cce8f8d)}, + {(0x00000000), + (0x00170000), + (0x00059200), + (0x00129200), + (0x61088000), + (0x611f8000), + (0x610d1200), + (0x611a1200), + (0x22825e00), + (0x22955e00), + (0x2287cc00), + (0x2290cc00), + (0x438ade00), + (0x439dde00), + (0x438f4c00), + (0x43984c00)}, + {(0x3f800000), + (0x3f800b80), + (0x3f8002c9), + (0x3f800949), + (0x3fb08440), + (0x3fb08fc0), + (0x3fb08689), + (0x3fb08d09), + (0x3f91412f), + (0x3f914aaf), + (0x3f9143e6), + (0x3f914866), + (0x3fa1c56f), + (0x3fa1ceef), + (0x3fa1c7a6), + (0x3fa1cc26)}, + (0xfff80000), + {0x63,0x96,0x53,0x66,0x89,0x8f,0x5a,0x0f,0x8c,0x80, + 0x0a,0x9a,0x17,0xd9,0x66,0x91,0xf8,0x92,0x97,0x62,0x00} + }, + { + /* No.91 delta:10527 weight:393 */ + 11213, + 5, + 2, + 19, + {(0x00000000), + (0x9ea45304), + (0x56ae02a1), + (0xc80a51a5), + (0x9ad005b9), + (0x047456bd), + (0xcc7e0718), + (0x52da541c), + (0x0000c554), + (0x9ea49650), + (0x56aec7f5), + (0xc80a94f1), + (0x9ad0c0ed), + (0x047493e9), + (0xcc7ec24c), + (0x52da9148)}, + {(0x00000000), + (0x64000000), + (0x0f800000), + (0x6b800000), + (0x00000000), + (0x64000000), + (0x0f800000), + (0x6b800000), + (0x00001e00), + (0x64001e00), + (0x0f801e00), + (0x6b801e00), + (0x00001e00), + (0x64001e00), + (0x0f801e00), + (0x6b801e00)}, + {(0x3f800000), + (0x3fb20000), + (0x3f87c000), + (0x3fb5c000), + (0x3f800000), + (0x3fb20000), + (0x3f87c000), + (0x3fb5c000), + (0x3f80000f), + (0x3fb2000f), + (0x3f87c00f), + (0x3fb5c00f), + (0x3f80000f), + (0x3fb2000f), + (0x3f87c00f), + (0x3fb5c00f)}, + (0xfff80000), + {0xd2,0x73,0xa3,0x8b,0x1a,0x90,0xef,0x94,0xe3,0x4a, + 0x16,0x2f,0x38,0x48,0xd9,0x68,0xf2,0xdf,0xe5,0xab,0x00} + }, + { + /* No.92 delta:2494 weight:1233 */ + 11213, + 7, + 21, + 4, + {(0x00000000), + (0x67c6fdcf), + (0x39165a15), + (0x5ed0a7da), + (0xa11005c0), + (0xc6d6f80f), + (0x98065fd5), + (0xffc0a21a), + (0x0000cdee), + (0x67c63021), + (0x391697fb), + (0x5ed06a34), + (0xa110c82e), + (0xc6d635e1), + (0x9806923b), + (0xffc06ff4)}, + {(0x00000000), + (0xc64d0800), + (0x67f58000), + (0xa1b88800), + (0x11ca8200), + (0xd7878a00), + (0x763f0200), + (0xb0720a00), + (0x4eb51e00), + (0x88f81600), + (0x29409e00), + (0xef0d9600), + (0x5f7f9c00), + (0x99329400), + (0x388a1c00), + (0xfec71400)}, + {(0x3f800000), + (0x3fe32684), + (0x3fb3fac0), + (0x3fd0dc44), + (0x3f88e541), + (0x3febc3c5), + (0x3fbb1f81), + (0x3fd83905), + (0x3fa75a8f), + (0x3fc47c0b), + (0x3f94a04f), + (0x3ff786cb), + (0x3fafbfce), + (0x3fcc994a), + (0x3f9c450e), + (0x3fff638a)}, + (0xfff80000), + {0x9e,0xa5,0x58,0x0a,0xe1,0x2c,0x68,0x94,0x2b,0x3f, + 0x4b,0xcd,0xe6,0xee,0x21,0x60,0xf3,0xf9,0x28,0xef,0x00} + }, + { + /* No.93 delta:2858 weight:713 */ + 11213, + 6, + 11, + 15, + {(0x00000000), + (0xce341fc2), + (0x74808815), + (0xbab497d7), + (0x396005de), + (0xf7541a1c), + (0x4de08dcb), + (0x83d49209), + (0x0000dee4), + (0xce34c126), + (0x748056f1), + (0xbab44933), + (0x3960db3a), + (0xf754c4f8), + (0x4de0532f), + (0x83d44ced)}, + {(0x00000000), + (0x0af25000), + (0x0c419c00), + (0x06b3cc00), + (0x82144400), + (0x88e61400), + (0x8e55d800), + (0x84a78800), + (0xe0053e00), + (0xeaf76e00), + (0xec44a200), + (0xe6b6f200), + (0x62117a00), + (0x68e32a00), + (0x6e50e600), + (0x64a2b600)}, + {(0x3f800000), + (0x3f857928), + (0x3f8620ce), + (0x3f8359e6), + (0x3fc10a22), + (0x3fc4730a), + (0x3fc72aec), + (0x3fc253c4), + (0x3ff0029f), + (0x3ff57bb7), + (0x3ff62251), + (0x3ff35b79), + (0x3fb108bd), + (0x3fb47195), + (0x3fb72873), + (0x3fb2515b)}, + (0xfff80000), + {0x67,0xfb,0x7b,0xdf,0x91,0xd7,0xa6,0xcb,0xfa,0x0c, + 0x9c,0xcf,0x32,0x59,0xd4,0x14,0x88,0x02,0x20,0xbd,0x00} + }, + { + /* No.94 delta:1428 weight:871 */ + 11213, + 51, + 24, + 3, + {(0x00000000), + (0x4055c0f5), + (0x3f9446d5), + (0x7fc18620), + (0xbd5005e5), + (0xfd05c510), + (0x82c44330), + (0xc29183c5), + (0x0000a8c2), + (0x40556837), + (0x3f94ee17), + (0x7fc12ee2), + (0xbd50ad27), + (0xfd056dd2), + (0x82c4ebf2), + (0xc2912b07)}, + {(0x00000000), + (0x6064a000), + (0x4ef89000), + (0x2e9c3000), + (0x08a1d000), + (0x68c57000), + (0x46594000), + (0x263de000), + (0x0c127e00), + (0x6c76de00), + (0x42eaee00), + (0x228e4e00), + (0x04b3ae00), + (0x64d70e00), + (0x4a4b3e00), + (0x2a2f9e00)}, + {(0x3f800000), + (0x3fb03250), + (0x3fa77c48), + (0x3f974e18), + (0x3f8450e8), + (0x3fb462b8), + (0x3fa32ca0), + (0x3f931ef0), + (0x3f86093f), + (0x3fb63b6f), + (0x3fa17577), + (0x3f914727), + (0x3f8259d7), + (0x3fb26b87), + (0x3fa5259f), + (0x3f9517cf)}, + (0xfff80000), + {0xfc,0xe1,0x89,0x6f,0x64,0xe4,0x4b,0x42,0xe3,0x27, + 0xa3,0x38,0x46,0x33,0x4f,0xf6,0x63,0x31,0xbb,0x80,0x00} + }, + { + /* No.95 delta:1914 weight:999 */ + 11213, + 43, + 8, + 13, + {(0x00000000), + (0x9c0723c5), + (0xc882db89), + (0x5485f84c), + (0x994005f3), + (0x05472636), + (0x51c2de7a), + (0xcdc5fdbf), + (0x000019bd), + (0x9c073a78), + (0xc882c234), + (0x5485e1f1), + (0x99401c4e), + (0x05473f8b), + (0x51c2c7c7), + (0xcdc5e402)}, + {(0x00000000), + (0x5061f000), + (0x105bc000), + (0x403a3000), + (0x00740400), + (0x5015f400), + (0x102fc400), + (0x404e3400), + (0x041c1e00), + (0x547dee00), + (0x1447de00), + (0x44262e00), + (0x04681a00), + (0x5409ea00), + (0x1433da00), + (0x44522a00)}, + {(0x3f800000), + (0x3fa830f8), + (0x3f882de0), + (0x3fa01d18), + (0x3f803a02), + (0x3fa80afa), + (0x3f8817e2), + (0x3fa0271a), + (0x3f820e0f), + (0x3faa3ef7), + (0x3f8a23ef), + (0x3fa21317), + (0x3f82340d), + (0x3faa04f5), + (0x3f8a19ed), + (0x3fa22915)}, + (0xfff80000), + {0xbf,0x5e,0xb4,0x48,0x47,0x8e,0xcb,0x36,0x4b,0x6a, + 0xc7,0x2c,0x1c,0xc9,0xdc,0x0d,0x4b,0x46,0x15,0xdf,0x00} + }, + { + /* No.96 delta:1078 weight:1383 */ + 11213, + 93, + 22, + 5, + {(0x00000000), + (0x4598c5d2), + (0x2a3c70f7), + (0x6fa4b525), + (0xf4e0060f), + (0xb178c3dd), + (0xdedc76f8), + (0x9b44b32a), + (0x0000ee71), + (0x45982ba3), + (0x2a3c9e86), + (0x6fa45b54), + (0xf4e0e87e), + (0xb1782dac), + (0xdedc9889), + (0x9b445d5b)}, + {(0x00000000), + (0x40220000), + (0x20738000), + (0x60518000), + (0x007e2000), + (0x405c2000), + (0x200da000), + (0x602fa000), + (0x80035e00), + (0xc0215e00), + (0xa070de00), + (0xe052de00), + (0x807d7e00), + (0xc05f7e00), + (0xa00efe00), + (0xe02cfe00)}, + {(0x3f800000), + (0x3fa01100), + (0x3f9039c0), + (0x3fb028c0), + (0x3f803f10), + (0x3fa02e10), + (0x3f9006d0), + (0x3fb017d0), + (0x3fc001af), + (0x3fe010af), + (0x3fd0386f), + (0x3ff0296f), + (0x3fc03ebf), + (0x3fe02fbf), + (0x3fd0077f), + (0x3ff0167f)}, + (0xfff80000), + {0xf7,0x01,0xdc,0x94,0xdb,0xfe,0x75,0xe3,0x41,0x0d, + 0xa7,0xcf,0xdb,0xc4,0xf8,0x63,0x39,0xf1,0x73,0x83,0x00} + }, + { + /* No.97 delta:1680 weight:855 */ + 11213, + 56, + 11, + 18, + {(0x00000000), + (0xed377fcb), + (0x935b7bcf), + (0x7e6c0404), + (0xb1b0061d), + (0x5c8779d6), + (0x22eb7dd2), + (0xcfdc0219), + (0x0000dc19), + (0xed37a3d2), + (0x935ba7d6), + (0x7e6cd81d), + (0xb1b0da04), + (0x5c87a5cf), + (0x22eba1cb), + (0xcfdcde00)}, + {(0x00000000), + (0x10100000), + (0x201c0000), + (0x300c0000), + (0x30000000), + (0x20100000), + (0x101c0000), + (0x000c0000), + (0x40051e00), + (0x50151e00), + (0x60191e00), + (0x70091e00), + (0x70051e00), + (0x60151e00), + (0x50191e00), + (0x40091e00)}, + {(0x3f800000), + (0x3f880800), + (0x3f900e00), + (0x3f980600), + (0x3f980000), + (0x3f900800), + (0x3f880e00), + (0x3f800600), + (0x3fa0028f), + (0x3fa80a8f), + (0x3fb00c8f), + (0x3fb8048f), + (0x3fb8028f), + (0x3fb00a8f), + (0x3fa80c8f), + (0x3fa0048f)}, + (0xfff80000), + {0xa7,0x90,0x32,0xf0,0xe5,0x54,0x81,0x86,0xda,0xa2, + 0x04,0x5e,0xda,0xe5,0xcd,0x25,0x97,0x20,0x5f,0xd8,0x00} + }, + { + /* No.98 delta:4818 weight:1887 */ + 11213, + 73, + 1, + 4, + {(0x00000000), + (0xf3234424), + (0xe4236cf9), + (0x170028dd), + (0x62d00623), + (0x91f34207), + (0x86f36ada), + (0x75d02efe), + (0x00003707), + (0xf3237323), + (0xe4235bfe), + (0x17001fda), + (0x62d03124), + (0x91f37500), + (0x86f35ddd), + (0x75d019f9)}, + {(0x00000000), + (0x40550000), + (0x40300000), + (0x00650000), + (0x7a81c000), + (0x3ad4c000), + (0x3ab1c000), + (0x7ae4c000), + (0x54351e00), + (0x14601e00), + (0x14051e00), + (0x54501e00), + (0x2eb4de00), + (0x6ee1de00), + (0x6e84de00), + (0x2ed1de00)}, + {(0x3f800000), + (0x3fa02a80), + (0x3fa01800), + (0x3f803280), + (0x3fbd40e0), + (0x3f9d6a60), + (0x3f9d58e0), + (0x3fbd7260), + (0x3faa1a8f), + (0x3f8a300f), + (0x3f8a028f), + (0x3faa280f), + (0x3f975a6f), + (0x3fb770ef), + (0x3fb7426f), + (0x3f9768ef)}, + (0xfff80000), + {0x78,0x4c,0x48,0x62,0xcb,0x43,0x6e,0xae,0x79,0x3f, + 0xa2,0x90,0xc7,0xd5,0xf6,0x2c,0x3a,0x94,0xf6,0x88,0x00} + }, + { + /* No.99 delta:4941 weight:807 */ + 11213, + 35, + 6, + 17, + {(0x00000000), + (0xceb13d37), + (0x6cab25b0), + (0xa21a1887), + (0x2d100639), + (0xe3a13b0e), + (0x41bb2389), + (0x8f0a1ebe), + (0x00002bd0), + (0xceb116e7), + (0x6cab0e60), + (0xa21a3357), + (0x2d102de9), + (0xe3a110de), + (0x41bb0859), + (0x8f0a356e)}, + {(0x00000000), + (0x07201000), + (0x42300200), + (0x45101200), + (0x40000000), + (0x47201000), + (0x02300200), + (0x05101200), + (0x70001e00), + (0x77200e00), + (0x32301c00), + (0x35100c00), + (0x30001e00), + (0x37200e00), + (0x72301c00), + (0x75100c00)}, + {(0x3f800000), + (0x3f839008), + (0x3fa11801), + (0x3fa28809), + (0x3fa00000), + (0x3fa39008), + (0x3f811801), + (0x3f828809), + (0x3fb8000f), + (0x3fbb9007), + (0x3f99180e), + (0x3f9a8806), + (0x3f98000f), + (0x3f9b9007), + (0x3fb9180e), + (0x3fba8806)}, + (0xfff80000), + {0x47,0x35,0x44,0x50,0x63,0x4a,0x6a,0xcd,0x53,0x03, + 0xdd,0x48,0x13,0x12,0x80,0xdf,0x0e,0x77,0xfa,0xf3,0x00} + }, + { + /* No.100 delta:1308 weight:863 */ + 11213, + 86, + 13, + 14, + {(0x00000000), + (0xc5ba19cb), + (0x67d04c0f), + (0xa26a55c4), + (0x36300642), + (0xf38a1f89), + (0x51e04a4d), + (0x945a5386), + (0x0000f011), + (0xc5bae9da), + (0x67d0bc1e), + (0xa26aa5d5), + (0x3630f653), + (0xf38aef98), + (0x51e0ba5c), + (0x945aa397)}, + {(0x00000000), + (0x09233a00), + (0x40645e00), + (0x49476400), + (0x1030a000), + (0x19139a00), + (0x5054fe00), + (0x5977c400), + (0x30c05e00), + (0x39e36400), + (0x70a40000), + (0x79873a00), + (0x20f0fe00), + (0x29d3c400), + (0x6094a000), + (0x69b79a00)}, + {(0x3f800000), + (0x3f84919d), + (0x3fa0322f), + (0x3fa4a3b2), + (0x3f881850), + (0x3f8c89cd), + (0x3fa82a7f), + (0x3facbbe2), + (0x3f98602f), + (0x3f9cf1b2), + (0x3fb85200), + (0x3fbcc39d), + (0x3f90787f), + (0x3f94e9e2), + (0x3fb04a50), + (0x3fb4dbcd)}, + (0xfff80000), + {0xbe,0xe1,0xe6,0x46,0x8d,0x04,0x11,0x44,0x1a,0x37, + 0x82,0xd9,0x6f,0xd6,0x9e,0xd5,0x25,0x58,0x1e,0xae,0x00} + }, + { + /* No.101 delta:3747 weight:693 */ + 11213, + 93, + 7, + 18, + {(0x00000000), + (0x34b395ad), + (0x437cf2d0), + (0x77cf677d), + (0xa770065c), + (0x93c393f1), + (0xe40cf48c), + (0xd0bf6121), + (0x0000f47f), + (0x34b361d2), + (0x437c06af), + (0x77cf9302), + (0xa770f223), + (0x93c3678e), + (0xe40c00f3), + (0xd0bf955e)}, + {(0x00000000), + (0x40700000), + (0x00580000), + (0x40280000), + (0x40680000), + (0x00180000), + (0x40300000), + (0x00400000), + (0x21601e00), + (0x61101e00), + (0x21381e00), + (0x61481e00), + (0x61081e00), + (0x21781e00), + (0x61501e00), + (0x21201e00)}, + {(0x3f800000), + (0x3fa03800), + (0x3f802c00), + (0x3fa01400), + (0x3fa03400), + (0x3f800c00), + (0x3fa01800), + (0x3f802000), + (0x3f90b00f), + (0x3fb0880f), + (0x3f909c0f), + (0x3fb0a40f), + (0x3fb0840f), + (0x3f90bc0f), + (0x3fb0a80f), + (0x3f90900f)}, + (0xfff80000), + {0xe2,0xf1,0x5a,0xc6,0xba,0x8b,0xae,0x08,0x43,0xcc, + 0x54,0xa6,0xe9,0x8f,0x81,0x0a,0x85,0xe3,0x5e,0xef,0x00} + }, + { + /* No.102 delta:3462 weight:1273 */ + 11213, + 55, + 23, + 8, + {(0x00000000), + (0xc3cc98c8), + (0xca3b10a5), + (0x09f7886d), + (0x18300660), + (0xdbfc9ea8), + (0xd20b16c5), + (0x11c78e0d), + (0x000030c4), + (0xc3cca80c), + (0xca3b2061), + (0x09f7b8a9), + (0x183036a4), + (0xdbfcae6c), + (0xd20b2601), + (0x11c7bec9)}, + {(0x00000000), + (0x08000000), + (0x00800000), + (0x08800000), + (0x88200000), + (0x80200000), + (0x88a00000), + (0x80a00000), + (0x03201e00), + (0x0b201e00), + (0x03a01e00), + (0x0ba01e00), + (0x8b001e00), + (0x83001e00), + (0x8b801e00), + (0x83801e00)}, + {(0x3f800000), + (0x3f840000), + (0x3f804000), + (0x3f844000), + (0x3fc41000), + (0x3fc01000), + (0x3fc45000), + (0x3fc05000), + (0x3f81900f), + (0x3f85900f), + (0x3f81d00f), + (0x3f85d00f), + (0x3fc5800f), + (0x3fc1800f), + (0x3fc5c00f), + (0x3fc1c00f)}, + (0xfff80000), + {0x43,0x1f,0x6f,0x01,0x80,0xf4,0x2e,0x31,0xcd,0xc1, + 0xb9,0x2f,0x6b,0x5c,0x0e,0x0b,0x35,0xa5,0x70,0x7e,0x00} + }, + { + /* No.103 delta:5054 weight:1635 */ + 11213, + 64, + 1, + 2, + {(0x00000000), + (0x4f30581d), + (0x5542c11f), + (0x1a729902), + (0x9da00670), + (0xd2905e6d), + (0xc8e2c76f), + (0x87d29f72), + (0x00007e47), + (0x4f30265a), + (0x5542bf58), + (0x1a72e745), + (0x9da07837), + (0xd290202a), + (0xc8e2b928), + (0x87d2e135)}, + {(0x00000000), + (0x0be21000), + (0x55018000), + (0x5ee39000), + (0x83944800), + (0x88765800), + (0xd695c800), + (0xdd77d800), + (0x00669e00), + (0x0b848e00), + (0x55671e00), + (0x5e850e00), + (0x83f2d600), + (0x8810c600), + (0xd6f35600), + (0xdd114600)}, + {(0x3f800000), + (0x3f85f108), + (0x3faa80c0), + (0x3faf71c8), + (0x3fc1ca24), + (0x3fc43b2c), + (0x3feb4ae4), + (0x3feebbec), + (0x3f80334f), + (0x3f85c247), + (0x3faab38f), + (0x3faf4287), + (0x3fc1f96b), + (0x3fc40863), + (0x3feb79ab), + (0x3fee88a3)}, + (0xfff80000), + {0x44,0x10,0x9f,0x8c,0xd9,0xbc,0x8e,0xb6,0xd5,0x14, + 0x72,0x32,0xdd,0xf2,0x3c,0xea,0xb3,0x38,0xb9,0x31,0x00} + }, + { + /* No.104 delta:2496 weight:907 */ + 11213, + 79, + 15, + 14, + {(0x00000000), + (0x5c0202d2), + (0x1c3f4858), + (0x403d4a8a), + (0xd2f0068f), + (0x8ef2045d), + (0xcecf4ed7), + (0x92cd4c05), + (0x0000d76d), + (0x5c02d5bf), + (0x1c3f9f35), + (0x403d9de7), + (0xd2f0d1e2), + (0x8ef2d330), + (0xcecf99ba), + (0x92cd9b68)}, + {(0x00000000), + (0x6b8d0400), + (0x1053a000), + (0x7bdea400), + (0x19807000), + (0x720d7400), + (0x09d3d000), + (0x625ed400), + (0x08441e00), + (0x63c91a00), + (0x1817be00), + (0x739aba00), + (0x11c46e00), + (0x7a496a00), + (0x0197ce00), + (0x6a1aca00)}, + {(0x3f800000), + (0x3fb5c682), + (0x3f8829d0), + (0x3fbdef52), + (0x3f8cc038), + (0x3fb906ba), + (0x3f84e9e8), + (0x3fb12f6a), + (0x3f84220f), + (0x3fb1e48d), + (0x3f8c0bdf), + (0x3fb9cd5d), + (0x3f88e237), + (0x3fbd24b5), + (0x3f80cbe7), + (0x3fb50d65)}, + (0xfff80000), + {0xb7,0xe4,0x3c,0x74,0x28,0xb1,0x2f,0xa4,0x5c,0x37, + 0xb1,0x69,0xd9,0x95,0x83,0xd9,0xa6,0x36,0x5b,0x12,0x00} + }, + { + /* No.105 delta:1174 weight:1019 */ + 11213, + 91, + 17, + 14, + {(0x00000000), + (0xa83f2177), + (0xa0b43c75), + (0x088b1d02), + (0x43300696), + (0xeb0f27e1), + (0xe3843ae3), + (0x4bbb1b94), + (0x00007f34), + (0xa83f5e43), + (0xa0b44341), + (0x088b6236), + (0x433079a2), + (0xeb0f58d5), + (0xe38445d7), + (0x4bbb64a0)}, + {(0x00000000), + (0x0115c000), + (0x90090000), + (0x911cc000), + (0x10422000), + (0x1157e000), + (0x804b2000), + (0x815ee000), + (0x10393e00), + (0x112cfe00), + (0x80303e00), + (0x8125fe00), + (0x007b1e00), + (0x016ede00), + (0x90721e00), + (0x9167de00)}, + {(0x3f800000), + (0x3f808ae0), + (0x3fc80480), + (0x3fc88e60), + (0x3f882110), + (0x3f88abf0), + (0x3fc02590), + (0x3fc0af70), + (0x3f881c9f), + (0x3f88967f), + (0x3fc0181f), + (0x3fc092ff), + (0x3f803d8f), + (0x3f80b76f), + (0x3fc8390f), + (0x3fc8b3ef)}, + (0xfff80000), + {0xe2,0x4f,0x2f,0xcb,0x05,0x76,0xce,0x0b,0xc7,0x7b, + 0xcc,0x65,0x06,0xce,0x2c,0x0c,0x3c,0xb6,0x2c,0x79,0x00} + }, + { + /* No.106 delta:1564 weight:925 */ + 11213, + 40, + 9, + 1, + {(0x00000000), + (0xd288f412), + (0x0b33c7cb), + (0xd9bb33d9), + (0xe0d006a8), + (0x3258f2ba), + (0xebe3c163), + (0x396b3571), + (0x00004470), + (0xd288b062), + (0x0b3383bb), + (0xd9bb77a9), + (0xe0d042d8), + (0x3258b6ca), + (0xebe38513), + (0x396b7101)}, + {(0x00000000), + (0x46794000), + (0x004d0000), + (0x46344000), + (0x007f0200), + (0x46064200), + (0x00320200), + (0x464b4200), + (0x00235e00), + (0x465a1e00), + (0x006e5e00), + (0x46171e00), + (0x005c5c00), + (0x46251c00), + (0x00115c00), + (0x46681c00)}, + {(0x3f800000), + (0x3fa33ca0), + (0x3f802680), + (0x3fa31a20), + (0x3f803f81), + (0x3fa30321), + (0x3f801901), + (0x3fa325a1), + (0x3f8011af), + (0x3fa32d0f), + (0x3f80372f), + (0x3fa30b8f), + (0x3f802e2e), + (0x3fa3128e), + (0x3f8008ae), + (0x3fa3340e)}, + (0xfff80000), + {0xc1,0x6e,0x8a,0x33,0x35,0x9f,0x07,0x03,0x76,0x11, + 0xe5,0x21,0xc3,0xdb,0x18,0x40,0x05,0xa0,0xd6,0x4c,0x00} + }, + { + /* No.107 delta:3386 weight:1851 */ + 11213, + 48, + 2, + 6, + {(0x00000000), + (0x5199ee9c), + (0x0606c085), + (0x579f2e19), + (0xe08006b0), + (0xb119e82c), + (0xe686c635), + (0xb71f28a9), + (0x000086be), + (0x51996822), + (0x0606463b), + (0x579fa8a7), + (0xe080800e), + (0xb1196e92), + (0xe686408b), + (0xb71fae17)}, + {(0x00000000), + (0x08250000), + (0x0a400800), + (0x02650800), + (0x10040000), + (0x18210000), + (0x1a440800), + (0x12610800), + (0x01081e00), + (0x092d1e00), + (0x0b481600), + (0x036d1600), + (0x110c1e00), + (0x19291e00), + (0x1b4c1600), + (0x13691600)}, + {(0x3f800000), + (0x3f841280), + (0x3f852004), + (0x3f813284), + (0x3f880200), + (0x3f8c1080), + (0x3f8d2204), + (0x3f893084), + (0x3f80840f), + (0x3f84968f), + (0x3f85a40b), + (0x3f81b68b), + (0x3f88860f), + (0x3f8c948f), + (0x3f8da60b), + (0x3f89b48b)}, + (0xfff80000), + {0x29,0x35,0xcb,0x9b,0x48,0x71,0x31,0x12,0x0b,0x2e, + 0xd3,0x98,0x06,0x50,0x05,0x3b,0xac,0x89,0x1a,0xaf,0x00} + }, + { + /* No.108 delta:2469 weight:1251 */ + 11213, + 31, + 7, + 1, + {(0x00000000), + (0x4efca9a0), + (0x3a920750), + (0x746eaef0), + (0x958006ce), + (0xdb7caf6e), + (0xaf12019e), + (0xe1eea83e), + (0x0000ee3c), + (0x4efc479c), + (0x3a92e96c), + (0x746e40cc), + (0x9580e8f2), + (0xdb7c4152), + (0xaf12efa2), + (0xe1ee4602)}, + {(0x00000000), + (0x405c0000), + (0x004ba200), + (0x4017a200), + (0x00600000), + (0x403c0000), + (0x002ba200), + (0x4077a200), + (0x80481e00), + (0xc0141e00), + (0x8003bc00), + (0xc05fbc00), + (0x80281e00), + (0xc0741e00), + (0x8063bc00), + (0xc03fbc00)}, + {(0x3f800000), + (0x3fa02e00), + (0x3f8025d1), + (0x3fa00bd1), + (0x3f803000), + (0x3fa01e00), + (0x3f8015d1), + (0x3fa03bd1), + (0x3fc0240f), + (0x3fe00a0f), + (0x3fc001de), + (0x3fe02fde), + (0x3fc0140f), + (0x3fe03a0f), + (0x3fc031de), + (0x3fe01fde)}, + (0xfff80000), + {0x05,0x56,0x79,0x8d,0xa1,0x79,0x94,0x9b,0xfd,0xfa, + 0xd1,0xd9,0x42,0x04,0x4f,0x21,0x8e,0xdb,0xe7,0xa3,0x00} + }, + { + /* No.109 delta:997 weight:681 */ + 11213, + 71, + 19, + 5, + {(0x00000000), + (0x21e405bb), + (0x4f97981d), + (0x6e739da6), + (0x01d006d7), + (0x2034036c), + (0x4e479eca), + (0x6fa39b71), + (0x0000e6b0), + (0x21e4e30b), + (0x4f977ead), + (0x6e737b16), + (0x01d0e067), + (0x2034e5dc), + (0x4e47787a), + (0x6fa37dc1)}, + {(0x00000000), + (0x40267000), + (0x0682d000), + (0x46a4a000), + (0x11832000), + (0x51a55000), + (0x1701f000), + (0x57278000), + (0x40581e00), + (0x007e6e00), + (0x46dace00), + (0x06fcbe00), + (0x51db3e00), + (0x11fd4e00), + (0x5759ee00), + (0x177f9e00)}, + {(0x3f800000), + (0x3fa01338), + (0x3f834168), + (0x3fa35250), + (0x3f88c190), + (0x3fa8d2a8), + (0x3f8b80f8), + (0x3fab93c0), + (0x3fa02c0f), + (0x3f803f37), + (0x3fa36d67), + (0x3f837e5f), + (0x3fa8ed9f), + (0x3f88fea7), + (0x3fabacf7), + (0x3f8bbfcf)}, + (0xfff80000), + {0x33,0x76,0x14,0x81,0x56,0x54,0xf0,0x4f,0x12,0x90, + 0xf4,0x03,0x95,0x9c,0x1a,0x38,0x51,0x80,0x32,0xaa,0x00} + }, + { + /* No.110 delta:2599 weight:829 */ + 11213, + 8, + 11, + 14, + {(0x00000000), + (0x4654c25e), + (0xa8eaa1d6), + (0xeebe6388), + (0x52a006e9), + (0x14f4c4b7), + (0xfa4aa73f), + (0xbc1e6561), + (0x000019ff), + (0x4654dba1), + (0xa8eab829), + (0xeebe7a77), + (0x52a01f16), + (0x14f4dd48), + (0xfa4abec0), + (0xbc1e7c9e)}, + {(0x00000000), + (0xfe272000), + (0x8207f000), + (0x7c20d000), + (0x4e344800), + (0xb0136800), + (0xcc33b800), + (0x32149800), + (0x01611e00), + (0xff463e00), + (0x8366ee00), + (0x7d41ce00), + (0x4f555600), + (0xb1727600), + (0xcd52a600), + (0x33758600)}, + {(0x3f800000), + (0x3fff1390), + (0x3fc103f8), + (0x3fbe1068), + (0x3fa71a24), + (0x3fd809b4), + (0x3fe619dc), + (0x3f990a4c), + (0x3f80b08f), + (0x3fffa31f), + (0x3fc1b377), + (0x3fbea0e7), + (0x3fa7aaab), + (0x3fd8b93b), + (0x3fe6a953), + (0x3f99bac3)}, + (0xfff80000), + {0xe0,0x6d,0x93,0xcf,0x6d,0x0f,0xa4,0xf7,0x93,0x3e, + 0x67,0xb4,0x20,0xb8,0x51,0x3a,0xe3,0xcd,0xf5,0xf9,0x00} + }, + { + /* No.111 delta:2048 weight:1649 */ + 11213, + 12, + 8, + 4, + {(0x00000000), + (0xbf40afc5), + (0xdef9c9b1), + (0x61b96674), + (0xfee006f8), + (0x41a0a93d), + (0x2019cf49), + (0x9f59608c), + (0x000056c5), + (0xbf40f900), + (0xdef99f74), + (0x61b930b1), + (0xfee0503d), + (0x41a0fff8), + (0x2019998c), + (0x9f593649)}, + {(0x00000000), + (0x2fa10c00), + (0x020b0000), + (0x2daa0c00), + (0x020ae000), + (0x2dabec00), + (0x0001e000), + (0x2fa0ec00), + (0x28021e00), + (0x07a31200), + (0x2a091e00), + (0x05a81200), + (0x2a08fe00), + (0x05a9f200), + (0x2803fe00), + (0x07a2f200)}, + {(0x3f800000), + (0x3f97d086), + (0x3f810580), + (0x3f96d506), + (0x3f810570), + (0x3f96d5f6), + (0x3f8000f0), + (0x3f97d076), + (0x3f94010f), + (0x3f83d189), + (0x3f95048f), + (0x3f82d409), + (0x3f95047f), + (0x3f82d4f9), + (0x3f9401ff), + (0x3f83d179)}, + (0xfff80000), + {0x4a,0x15,0xe8,0xf1,0x59,0x83,0x8e,0x52,0x8a,0x24, + 0xa4,0xb5,0x5d,0xfb,0x87,0xe0,0x22,0xe3,0x18,0x37,0x00} + }, + { + /* No.112 delta:2152 weight:1369 */ + 11213, + 81, + 6, + 10, + {(0x00000000), + (0xfbea0aeb), + (0xba6ad14d), + (0x4180dba6), + (0x21e00705), + (0xda0a0dee), + (0x9b8ad648), + (0x6060dca3), + (0x00003510), + (0xfbea3ffb), + (0xba6ae45d), + (0x4180eeb6), + (0x21e03215), + (0xda0a38fe), + (0x9b8ae358), + (0x6060e9b3)}, + {(0x00000000), + (0x01428000), + (0x04604000), + (0x0522c000), + (0x00081000), + (0x014a9000), + (0x04685000), + (0x052ad000), + (0x20261e00), + (0x21649e00), + (0x24465e00), + (0x2504de00), + (0x202e0e00), + (0x216c8e00), + (0x244e4e00), + (0x250cce00)}, + {(0x3f800000), + (0x3f80a140), + (0x3f823020), + (0x3f829160), + (0x3f800408), + (0x3f80a548), + (0x3f823428), + (0x3f829568), + (0x3f90130f), + (0x3f90b24f), + (0x3f92232f), + (0x3f92826f), + (0x3f901707), + (0x3f90b647), + (0x3f922727), + (0x3f928667)}, + (0xfff80000), + {0xfd,0x72,0xaa,0xc7,0x20,0x44,0x28,0xe5,0x03,0x3e, + 0xf9,0x6d,0xad,0x9f,0x51,0x0c,0x87,0xf6,0x43,0x0f,0x00} + }, + { + /* No.113 delta:1871 weight:1215 */ + 11213, + 61, + 14, + 10, + {(0x00000000), + (0x11856d8d), + (0xaac84415), + (0xbb4d2998), + (0xae00071a), + (0xbf856a97), + (0x04c8430f), + (0x154d2e82), + (0x0000cc65), + (0x1185a1e8), + (0xaac88870), + (0xbb4de5fd), + (0xae00cb7f), + (0xbf85a6f2), + (0x04c88f6a), + (0x154de2e7)}, + {(0x00000000), + (0x006d0000), + (0x00b10000), + (0x00dc0000), + (0x04490000), + (0x04240000), + (0x04f80000), + (0x04950000), + (0x00421e00), + (0x002f1e00), + (0x00f31e00), + (0x009e1e00), + (0x040b1e00), + (0x04661e00), + (0x04ba1e00), + (0x04d71e00)}, + {(0x3f800000), + (0x3f803680), + (0x3f805880), + (0x3f806e00), + (0x3f822480), + (0x3f821200), + (0x3f827c00), + (0x3f824a80), + (0x3f80210f), + (0x3f80178f), + (0x3f80798f), + (0x3f804f0f), + (0x3f82058f), + (0x3f82330f), + (0x3f825d0f), + (0x3f826b8f)}, + (0xfff80000), + {0x98,0xdb,0x7c,0xec,0x90,0x27,0x75,0x69,0x6c,0x3d, + 0x4c,0xec,0xa2,0x8e,0xab,0xef,0xd1,0x0c,0xbd,0x8c,0x00} + }, + { + /* No.114 delta:1950 weight:1011 */ + 11213, + 20, + 16, + 13, + {(0x00000000), + (0xbdc99be3), + (0xaafee229), + (0x173779ca), + (0x7300072e), + (0xcec99ccd), + (0xd9fee507), + (0x64377ee4), + (0x0000b504), + (0xbdc92ee7), + (0xaafe572d), + (0x1737ccce), + (0x7300b22a), + (0xcec929c9), + (0xd9fe5003), + (0x6437cbe0)}, + {(0x00000000), + (0x016ec000), + (0x8ce40000), + (0x8d8ac000), + (0x1c548000), + (0x1d3a4000), + (0x90b08000), + (0x91de4000), + (0x00869e00), + (0x01e85e00), + (0x8c629e00), + (0x8d0c5e00), + (0x1cd21e00), + (0x1dbcde00), + (0x90361e00), + (0x9158de00)}, + {(0x3f800000), + (0x3f80b760), + (0x3fc67200), + (0x3fc6c560), + (0x3f8e2a40), + (0x3f8e9d20), + (0x3fc85840), + (0x3fc8ef20), + (0x3f80434f), + (0x3f80f42f), + (0x3fc6314f), + (0x3fc6862f), + (0x3f8e690f), + (0x3f8ede6f), + (0x3fc81b0f), + (0x3fc8ac6f)}, + (0xfff80000), + {0xa7,0x22,0x09,0x2a,0x46,0xe2,0xa3,0x13,0x26,0x8f, + 0xa5,0xc6,0x28,0x12,0x57,0xb4,0x27,0x86,0xf1,0x1d,0x00} + }, + { + /* No.115 delta:1732 weight:1445 */ + 11213, + 29, + 17, + 7, + {(0x00000000), + (0xdb25076c), + (0x9bf7e9d5), + (0x40d2eeb9), + (0x95f00737), + (0x4ed5005b), + (0x0e07eee2), + (0xd522e98e), + (0x0000f5f0), + (0xdb25f29c), + (0x9bf71c25), + (0x40d21b49), + (0x95f0f2c7), + (0x4ed5f5ab), + (0x0e071b12), + (0xd5221c7e)}, + {(0x00000000), + (0x481e0000), + (0x80040000), + (0xc81a0000), + (0x007d0000), + (0x48630000), + (0x80790000), + (0xc8670000), + (0x40121e00), + (0x080c1e00), + (0xc0161e00), + (0x88081e00), + (0x406f1e00), + (0x08711e00), + (0xc06b1e00), + (0x88751e00)}, + {(0x3f800000), + (0x3fa40f00), + (0x3fc00200), + (0x3fe40d00), + (0x3f803e80), + (0x3fa43180), + (0x3fc03c80), + (0x3fe43380), + (0x3fa0090f), + (0x3f84060f), + (0x3fe00b0f), + (0x3fc4040f), + (0x3fa0378f), + (0x3f84388f), + (0x3fe0358f), + (0x3fc43a8f)}, + (0xfff80000), + {0xc2,0xbe,0xe6,0x5f,0xf5,0x28,0x34,0x1c,0x5e,0x2d, + 0xdb,0x99,0x36,0x5d,0x04,0x52,0x9e,0x76,0x9e,0xd5,0x00} + }, + { + /* No.116 delta:1707 weight:1245 */ + 11213, + 30, + 22, + 3, + {(0x00000000), + (0x0a5f3de8), + (0xcb7a16d6), + (0xc1252b3e), + (0xfcd0074b), + (0xf68f3aa3), + (0x37aa119d), + (0x3df52c75), + (0x00003bff), + (0x0a5f0617), + (0xcb7a2d29), + (0xc12510c1), + (0xfcd03cb4), + (0xf68f015c), + (0x37aa2a62), + (0x3df5178a)}, + {(0x00000000), + (0x402e8e00), + (0x0073d000), + (0x405d5e00), + (0x206d4000), + (0x6043ce00), + (0x201e9000), + (0x60301e00), + (0xd21dfe00), + (0x92337000), + (0xd26e2e00), + (0x9240a000), + (0xf270be00), + (0xb25e3000), + (0xf2036e00), + (0xb22de000)}, + {(0x3f800000), + (0x3fa01747), + (0x3f8039e8), + (0x3fa02eaf), + (0x3f9036a0), + (0x3fb021e7), + (0x3f900f48), + (0x3fb0180f), + (0x3fe90eff), + (0x3fc919b8), + (0x3fe93717), + (0x3fc92050), + (0x3ff9385f), + (0x3fd92f18), + (0x3ff901b7), + (0x3fd916f0)}, + (0xfff80000), + {0x30,0x04,0x85,0xba,0x89,0x2d,0x19,0x39,0x57,0x1c, + 0x54,0xa8,0xb5,0x0a,0x05,0x27,0x14,0x6a,0xed,0xe0,0x00} + }, + { + /* No.117 delta:2917 weight:1743 */ + 11213, + 37, + 3, + 6, + {(0x00000000), + (0x501b23d2), + (0x2770f82a), + (0x776bdbf8), + (0x67300751), + (0x372b2483), + (0x4040ff7b), + (0x105bdca9), + (0x000038d9), + (0x501b1b0b), + (0x2770c0f3), + (0x776be321), + (0x67303f88), + (0x372b1c5a), + (0x4040c7a2), + (0x105be470)}, + {(0x00000000), + (0x20542200), + (0x40387800), + (0x606c5a00), + (0x14402000), + (0x34140200), + (0x54785800), + (0x742c7a00), + (0x1840de00), + (0x3814fc00), + (0x5878a600), + (0x782c8400), + (0x0c00fe00), + (0x2c54dc00), + (0x4c388600), + (0x6c6ca400)}, + {(0x3f800000), + (0x3f902a11), + (0x3fa01c3c), + (0x3fb0362d), + (0x3f8a2010), + (0x3f9a0a01), + (0x3faa3c2c), + (0x3fba163d), + (0x3f8c206f), + (0x3f9c0a7e), + (0x3fac3c53), + (0x3fbc1642), + (0x3f86007f), + (0x3f962a6e), + (0x3fa61c43), + (0x3fb63652)}, + (0xfff80000), + {0x86,0x60,0xf6,0x24,0x0e,0xff,0xd7,0xe9,0x32,0x8f, + 0xa0,0x96,0x77,0x67,0x0e,0xec,0x2e,0x00,0x3b,0x13,0x00} + }, + { + /* No.118 delta:983 weight:1587 */ + 11213, + 62, + 19, + 4, + {(0x00000000), + (0x08eb784a), + (0x736759ff), + (0x7b8c21b5), + (0x0ca0076b), + (0x044b7f21), + (0x7fc75e94), + (0x772c26de), + (0x0000d939), + (0x08eba173), + (0x736780c6), + (0x7b8cf88c), + (0x0ca0de52), + (0x044ba618), + (0x7fc787ad), + (0x772cffe7)}, + {(0x00000000), + (0x041eba00), + (0x20637000), + (0x247dca00), + (0x20110000), + (0x240fba00), + (0x00727000), + (0x046cca00), + (0x10001e00), + (0x141ea400), + (0x30636e00), + (0x347dd400), + (0x30111e00), + (0x340fa400), + (0x10726e00), + (0x146cd400)}, + {(0x3f800000), + (0x3f820f5d), + (0x3f9031b8), + (0x3f923ee5), + (0x3f900880), + (0x3f9207dd), + (0x3f803938), + (0x3f823665), + (0x3f88000f), + (0x3f8a0f52), + (0x3f9831b7), + (0x3f9a3eea), + (0x3f98088f), + (0x3f9a07d2), + (0x3f883937), + (0x3f8a366a)}, + (0xfff80000), + {0x70,0x7f,0x78,0xb3,0x65,0x02,0xe0,0xb9,0x55,0x49, + 0xd9,0x60,0xa8,0xa5,0xd3,0x10,0x3b,0x08,0x55,0xfd,0x00} + }, + { + /* No.119 delta:1397 weight:1065 */ + 11213, + 57, + 14, + 11, + {(0x00000000), + (0x5e421ddc), + (0x638787c4), + (0x3dc59a18), + (0x8e00077d), + (0xd0421aa1), + (0xed8780b9), + (0xb3c59d65), + (0x0000840f), + (0x5e4299d3), + (0x638703cb), + (0x3dc51e17), + (0x8e008372), + (0xd0429eae), + (0xed8704b6), + (0xb3c5196a)}, + {(0x00000000), + (0x08e5ec00), + (0x245ea400), + (0x2cbb4800), + (0x00688000), + (0x088d6c00), + (0x24362400), + (0x2cd3c800), + (0x00111e00), + (0x08f4f200), + (0x244fba00), + (0x2caa5600), + (0x00799e00), + (0x089c7200), + (0x24273a00), + (0x2cc2d600)}, + {(0x3f800000), + (0x3f8472f6), + (0x3f922f52), + (0x3f965da4), + (0x3f803440), + (0x3f8446b6), + (0x3f921b12), + (0x3f9669e4), + (0x3f80088f), + (0x3f847a79), + (0x3f9227dd), + (0x3f96552b), + (0x3f803ccf), + (0x3f844e39), + (0x3f92139d), + (0x3f96616b)}, + (0xfff80000), + {0x72,0xeb,0x0e,0x84,0xe7,0xef,0x0c,0xb3,0x72,0xaf, + 0x80,0x06,0xbc,0xf9,0x33,0xf7,0x21,0x72,0x27,0x28,0x00} + }, + { + /* No.120 delta:1392 weight:827 */ + 11213, + 46, + 15, + 17, + {(0x00000000), + (0xa557bf77), + (0x097f4c89), + (0xac28f3fe), + (0xffa0078b), + (0x5af7b8fc), + (0xf6df4b02), + (0x5388f475), + (0x00006249), + (0xa557dd3e), + (0x097f2ec0), + (0xac2891b7), + (0xffa065c2), + (0x5af7dab5), + (0xf6df294b), + (0x5388963c)}, + {(0x00000000), + (0x68748400), + (0x4200ae00), + (0x2a742a00), + (0x1c086000), + (0x747ce400), + (0x5e08ce00), + (0x367c4a00), + (0x0046fe00), + (0x68327a00), + (0x42465000), + (0x2a32d400), + (0x1c4e9e00), + (0x743a1a00), + (0x5e4e3000), + (0x363ab400)}, + {(0x3f800000), + (0x3fb43a42), + (0x3fa10057), + (0x3f953a15), + (0x3f8e0430), + (0x3fba3e72), + (0x3faf0467), + (0x3f9b3e25), + (0x3f80237f), + (0x3fb4193d), + (0x3fa12328), + (0x3f95196a), + (0x3f8e274f), + (0x3fba1d0d), + (0x3faf2718), + (0x3f9b1d5a)}, + (0xfff80000), + {0x7c,0xb2,0x6a,0xff,0x78,0xfa,0xd6,0x78,0xf9,0xba, + 0x77,0x1d,0x84,0xb3,0xbb,0xcb,0xac,0xdf,0x51,0x54,0x00} + }, + { + /* No.121 delta:1663 weight:775 */ + 11213, + 82, + 9, + 17, + {(0x00000000), + (0x1fe0e7a6), + (0x67406a7f), + (0x78a08dd9), + (0xda30079d), + (0xc5d0e03b), + (0xbd706de2), + (0xa2908a44), + (0x000076e4), + (0x1fe09142), + (0x67401c9b), + (0x78a0fb3d), + (0xda307179), + (0xc5d096df), + (0xbd701b06), + (0xa290fca0)}, + {(0x00000000), + (0x100e1000), + (0x20734000), + (0x307d5000), + (0x5008e200), + (0x4006f200), + (0x707ba200), + (0x6075b200), + (0x3242de00), + (0x224cce00), + (0x12319e00), + (0x023f8e00), + (0x624a3c00), + (0x72442c00), + (0x42397c00), + (0x52376c00)}, + {(0x3f800000), + (0x3f880708), + (0x3f9039a0), + (0x3f983ea8), + (0x3fa80471), + (0x3fa00379), + (0x3fb83dd1), + (0x3fb03ad9), + (0x3f99216f), + (0x3f912667), + (0x3f8918cf), + (0x3f811fc7), + (0x3fb1251e), + (0x3fb92216), + (0x3fa11cbe), + (0x3fa91bb6)}, + (0xfff80000), + {0xa3,0xd8,0x55,0xcd,0x98,0xdc,0x68,0x95,0x68,0xdf, + 0xcf,0x56,0x03,0x2a,0x94,0x75,0x10,0xec,0x0a,0x47,0x00} + }, + { + /* No.122 delta:1328 weight:751 */ + 11213, + 67, + 14, + 18, + {(0x00000000), + (0x76bc3aa8), + (0xc37bdc20), + (0xb5c7e688), + (0x38b007ab), + (0x4e0c3d03), + (0xfbcbdb8b), + (0x8d77e123), + (0x0000bd02), + (0x76bc87aa), + (0xc37b6122), + (0xb5c75b8a), + (0x38b0baa9), + (0x4e0c8001), + (0xfbcb6689), + (0x8d775c21)}, + {(0x00000000), + (0x1112c200), + (0x18038000), + (0x09114200), + (0x00065000), + (0x11149200), + (0x1805d000), + (0x09171200), + (0x6001de00), + (0x71131c00), + (0x78025e00), + (0x69109c00), + (0x60078e00), + (0x71154c00), + (0x78040e00), + (0x6916cc00)}, + {(0x3f800000), + (0x3f888961), + (0x3f8c01c0), + (0x3f8488a1), + (0x3f800328), + (0x3f888a49), + (0x3f8c02e8), + (0x3f848b89), + (0x3fb000ef), + (0x3fb8898e), + (0x3fbc012f), + (0x3fb4884e), + (0x3fb003c7), + (0x3fb88aa6), + (0x3fbc0207), + (0x3fb48b66)}, + (0xfff80000), + {0x18,0x30,0x32,0x35,0xe2,0xb4,0xcd,0x94,0x5e,0x6b, + 0xe6,0x78,0x0b,0x92,0x24,0xbf,0x7c,0xc5,0xbd,0xe2,0x00} + }, + { + /* No.123 delta:1657 weight:573 */ + 11213, + 70, + 8, + 19, + {(0x00000000), + (0xfd59bd60), + (0xe0041fb5), + (0x1d5da2d5), + (0x836007b6), + (0x7e39bad6), + (0x63641803), + (0x9e3da563), + (0x0000b1f6), + (0xfd590c96), + (0xe004ae43), + (0x1d5d1323), + (0x8360b640), + (0x7e390b20), + (0x6364a9f5), + (0x9e3d1495)}, + {(0x00000000), + (0x57b14800), + (0x5868a400), + (0x0fd9ec00), + (0x084c7000), + (0x5ffd3800), + (0x5024d400), + (0x07959c00), + (0x10121e00), + (0x47a35600), + (0x487aba00), + (0x1fcbf200), + (0x185e6e00), + (0x4fef2600), + (0x4036ca00), + (0x17878200)}, + {(0x3f800000), + (0x3fabd8a4), + (0x3fac3452), + (0x3f87ecf6), + (0x3f842638), + (0x3faffe9c), + (0x3fa8126a), + (0x3f83cace), + (0x3f88090f), + (0x3fa3d1ab), + (0x3fa43d5d), + (0x3f8fe5f9), + (0x3f8c2f37), + (0x3fa7f793), + (0x3fa01b65), + (0x3f8bc3c1)}, + (0xfff80000), + {0x0b,0xcb,0xeb,0x33,0x75,0x01,0x5e,0xeb,0x92,0xfb, + 0x37,0xae,0xe0,0x31,0x80,0xa9,0x06,0x42,0x2b,0xd5,0x00} + }, + { + /* No.124 delta:1016 weight:1635 */ + 11213, + 80, + 18, + 2, + {(0x00000000), + (0x65b814ab), + (0x0b7c8e4e), + (0x6ec49ae5), + (0xe3e007c1), + (0x8658136a), + (0xe89c898f), + (0x8d249d24), + (0x00008bf0), + (0x65b89f5b), + (0x0b7c05be), + (0x6ec41115), + (0xe3e08c31), + (0x8658989a), + (0xe89c027f), + (0x8d2416d4)}, + {(0x00000000), + (0x110f9000), + (0x08401000), + (0x194f8000), + (0x20040000), + (0x310b9000), + (0x28441000), + (0x394b8000), + (0x00025e00), + (0x110dce00), + (0x08424e00), + (0x194dde00), + (0x20065e00), + (0x3109ce00), + (0x28464e00), + (0x3949de00)}, + {(0x3f800000), + (0x3f8887c8), + (0x3f842008), + (0x3f8ca7c0), + (0x3f900200), + (0x3f9885c8), + (0x3f942208), + (0x3f9ca5c0), + (0x3f80012f), + (0x3f8886e7), + (0x3f842127), + (0x3f8ca6ef), + (0x3f90032f), + (0x3f9884e7), + (0x3f942327), + (0x3f9ca4ef)}, + (0xfff80000), + {0xe8,0x1c,0x9d,0xcc,0x4a,0x97,0xc0,0xae,0x9d,0xce, + 0x1a,0xa4,0x45,0x9f,0x41,0xc4,0x83,0xd9,0x62,0x72,0x00} + }, + { + /* No.125 delta:1214 weight:1175 */ + 11213, + 28, + 16, + 7, + {(0x00000000), + (0x7b11b46d), + (0x3e529f7c), + (0x45432b11), + (0x05a007d2), + (0x7eb1b3bf), + (0x3bf298ae), + (0x40e32cc3), + (0x00001cdb), + (0x7b11a8b6), + (0x3e5283a7), + (0x454337ca), + (0x05a01b09), + (0x7eb1af64), + (0x3bf28475), + (0x40e33018)}, + {(0x00000000), + (0x4460cc00), + (0x50de6c00), + (0x14bea000), + (0x43011e00), + (0x0761d200), + (0x13df7200), + (0x57bfbe00), + (0x41807e00), + (0x05e0b200), + (0x115e1200), + (0x553ede00), + (0x02816000), + (0x46e1ac00), + (0x525f0c00), + (0x163fc000)}, + {(0x3f800000), + (0x3fa23066), + (0x3fa86f36), + (0x3f8a5f50), + (0x3fa1808f), + (0x3f83b0e9), + (0x3f89efb9), + (0x3fabdfdf), + (0x3fa0c03f), + (0x3f82f059), + (0x3f88af09), + (0x3faa9f6f), + (0x3f8140b0), + (0x3fa370d6), + (0x3fa92f86), + (0x3f8b1fe0)}, + (0xfff80000), + {0x5c,0x4c,0x7f,0xad,0xc2,0x0a,0xe3,0x36,0x3a,0x3f, + 0x3e,0x28,0x97,0x26,0xce,0xab,0xdb,0x12,0x07,0x20,0x00} + }, + { + /* No.126 delta:962 weight:1245 */ + 11213, + 78, + 18, + 5, + {(0x00000000), + (0xee0a807e), + (0xe937683b), + (0x073de845), + (0x14f007e9), + (0xfafa8797), + (0xfdc76fd2), + (0x13cdefac), + (0x0000f676), + (0xee0a7608), + (0xe9379e4d), + (0x073d1e33), + (0x14f0f19f), + (0xfafa71e1), + (0xfdc799a4), + (0x13cd19da)}, + {(0x00000000), + (0xb028bc00), + (0x08652400), + (0xb84d9800), + (0x14028600), + (0xa42a3a00), + (0x1c67a200), + (0xac4f1e00), + (0x00023e00), + (0xb02a8200), + (0x08671a00), + (0xb84fa600), + (0x1400b800), + (0xa4280400), + (0x1c659c00), + (0xac4d2000)}, + {(0x3f800000), + (0x3fd8145e), + (0x3f843292), + (0x3fdc26cc), + (0x3f8a0143), + (0x3fd2151d), + (0x3f8e33d1), + (0x3fd6278f), + (0x3f80011f), + (0x3fd81541), + (0x3f84338d), + (0x3fdc27d3), + (0x3f8a005c), + (0x3fd21402), + (0x3f8e32ce), + (0x3fd62690)}, + (0xfff80000), + {0x1f,0xae,0x0b,0x7d,0x23,0x0c,0x6e,0xd6,0x26,0xa9, + 0x92,0xbc,0x8f,0x01,0x36,0x36,0x07,0xe9,0x2c,0x7c,0x00} + }, + { + /* No.127 delta:4656 weight:1185 */ + 11213, + 57, + 4, + 13, + {(0x00000000), + (0x7d46d3c2), + (0x107426fc), + (0x6d32f53e), + (0x832007fe), + (0xfe66d43c), + (0x93542102), + (0xee12f2c0), + (0x00009ac7), + (0x7d464905), + (0x1074bc3b), + (0x6d326ff9), + (0x83209d39), + (0xfe664efb), + (0x9354bbc5), + (0xee126807)}, + {(0x00000000), + (0x18401000), + (0x14000000), + (0x0c401000), + (0x00000000), + (0x18401000), + (0x14000000), + (0x0c401000), + (0x10001e00), + (0x08400e00), + (0x04001e00), + (0x1c400e00), + (0x10001e00), + (0x08400e00), + (0x04001e00), + (0x1c400e00)}, + {(0x3f800000), + (0x3f8c2008), + (0x3f8a0000), + (0x3f862008), + (0x3f800000), + (0x3f8c2008), + (0x3f8a0000), + (0x3f862008), + (0x3f88000f), + (0x3f842007), + (0x3f82000f), + (0x3f8e2007), + (0x3f88000f), + (0x3f842007), + (0x3f82000f), + (0x3f8e2007)}, + (0xfff80000), + {0x2b,0xf5,0xba,0x2c,0x06,0x65,0xd9,0xae,0x19,0x02, + 0xa4,0xb4,0xe6,0x92,0x03,0x77,0xb7,0xb8,0x8c,0x23,0x00} + }, + { + /* No.128 delta:2214 weight:1371 */ + 11213, + 43, + 23, + 2, + {(0x00000000), + (0xe454d1ab), + (0x80c8a6d9), + (0x649c7772), + (0xb0f00808), + (0x54a4d9a3), + (0x3038aed1), + (0xd46c7f7a), + (0x00004f07), + (0xe4549eac), + (0x80c8e9de), + (0x649c3875), + (0xb0f0470f), + (0x54a496a4), + (0x3038e1d6), + (0xd46c307d)}, + {(0x00000000), + (0xca494000), + (0x00538000), + (0xca1ac000), + (0x10bd2000), + (0xdaf46000), + (0x10eea000), + (0xdaa7e000), + (0x18905e00), + (0xd2d91e00), + (0x18c3de00), + (0xd28a9e00), + (0x082d7e00), + (0xc2643e00), + (0x087efe00), + (0xc237be00)}, + {(0x3f800000), + (0x3fe524a0), + (0x3f8029c0), + (0x3fe50d60), + (0x3f885e90), + (0x3fed7a30), + (0x3f887750), + (0x3fed53f0), + (0x3f8c482f), + (0x3fe96c8f), + (0x3f8c61ef), + (0x3fe9454f), + (0x3f8416bf), + (0x3fe1321f), + (0x3f843f7f), + (0x3fe11bdf)}, + (0xfff80000), + {0xf5,0xb9,0x08,0x2c,0x6d,0x40,0xb0,0x38,0xb5,0x70, + 0x83,0x86,0xbb,0x54,0xe7,0x5e,0x64,0xf3,0x40,0x61,0x00} + }, + { + /* No.129 delta:886 weight:915 */ + 11213, + 70, + 12, + 5, + {(0x00000000), + (0x242c5090), + (0x10199a60), + (0x3435caf0), + (0xe9d00810), + (0xcdfc5880), + (0xf9c99270), + (0xdde5c2e0), + (0x00003567), + (0x242c65f7), + (0x1019af07), + (0x3435ff97), + (0xe9d03d77), + (0xcdfc6de7), + (0xf9c9a717), + (0xdde5f787)}, + {(0x00000000), + (0x004e4000), + (0x1009c000), + (0x10478000), + (0x0e025000), + (0x0e4c1000), + (0x1e0b9000), + (0x1e45d000), + (0x10345e00), + (0x107a1e00), + (0x003d9e00), + (0x0073de00), + (0x1e360e00), + (0x1e784e00), + (0x0e3fce00), + (0x0e718e00)}, + {(0x3f800000), + (0x3f802720), + (0x3f8804e0), + (0x3f8823c0), + (0x3f870128), + (0x3f872608), + (0x3f8f05c8), + (0x3f8f22e8), + (0x3f881a2f), + (0x3f883d0f), + (0x3f801ecf), + (0x3f8039ef), + (0x3f8f1b07), + (0x3f8f3c27), + (0x3f871fe7), + (0x3f8738c7)}, + (0xfff80000), + {0xae,0x65,0xce,0x51,0xe8,0x63,0xb5,0x45,0x7a,0xb5, + 0x06,0x3b,0x06,0x88,0x6c,0x62,0x83,0x37,0xc8,0xb9,0x00} + }, + { + /* No.130 delta:2602 weight:1519 */ + 11213, + 18, + 4, + 6, + {(0x00000000), + (0x4fa484d0), + (0x546a6e84), + (0x1bceea54), + (0x4a400828), + (0x05e48cf8), + (0x1e2a66ac), + (0x518ee27c), + (0x0000bda0), + (0x4fa43970), + (0x546ad324), + (0x1bce57f4), + (0x4a40b588), + (0x05e43158), + (0x1e2adb0c), + (0x518e5fdc)}, + {(0x00000000), + (0x13081400), + (0x928e3000), + (0x81862400), + (0x010e0000), + (0x12061400), + (0x93803000), + (0x80882400), + (0x10581e00), + (0x03500a00), + (0x82d62e00), + (0x91de3a00), + (0x11561e00), + (0x025e0a00), + (0x83d82e00), + (0x90d03a00)}, + {(0x3f800000), + (0x3f89840a), + (0x3fc94718), + (0x3fc0c312), + (0x3f808700), + (0x3f89030a), + (0x3fc9c018), + (0x3fc04412), + (0x3f882c0f), + (0x3f81a805), + (0x3fc16b17), + (0x3fc8ef1d), + (0x3f88ab0f), + (0x3f812f05), + (0x3fc1ec17), + (0x3fc8681d)}, + (0xfff80000), + {0x13,0xcb,0x05,0x11,0x83,0xac,0xeb,0x2f,0xe5,0x15, + 0x1a,0x0e,0x87,0xa3,0x4d,0xac,0x2b,0xc0,0xb1,0xf3,0x00} + }, + { + /* No.131 delta:1006 weight:1303 */ + 11213, + 69, + 16, + 7, + {(0x00000000), + (0xeb61a85a), + (0x9e89b6f4), + (0x75e81eae), + (0x4cc00837), + (0xa7a1a06d), + (0xd249bec3), + (0x39281699), + (0x00006d8a), + (0xeb61c5d0), + (0x9e89db7e), + (0x75e87324), + (0x4cc065bd), + (0xa7a1cde7), + (0xd249d349), + (0x39287b13)}, + {(0x00000000), + (0x20bcb000), + (0x51807000), + (0x713cc000), + (0x02a2a000), + (0x221e1000), + (0x5322d000), + (0x739e6000), + (0x00067e00), + (0x20bace00), + (0x51860e00), + (0x713abe00), + (0x02a4de00), + (0x22186e00), + (0x5324ae00), + (0x73981e00)}, + {(0x3f800000), + (0x3f905e58), + (0x3fa8c038), + (0x3fb89e60), + (0x3f815150), + (0x3f910f08), + (0x3fa99168), + (0x3fb9cf30), + (0x3f80033f), + (0x3f905d67), + (0x3fa8c307), + (0x3fb89d5f), + (0x3f81526f), + (0x3f910c37), + (0x3fa99257), + (0x3fb9cc0f)}, + (0xfff80000), + {0xbc,0xf3,0x6a,0x80,0xa6,0xee,0x61,0x78,0xa8,0x3d, + 0x8c,0xee,0x29,0x1b,0x5e,0xfd,0x0b,0xf8,0x0f,0x41,0x00} + }, + { + /* No.132 delta:2899 weight:1651 */ + 11213, + 57, + 3, + 7, + {(0x00000000), + (0x7a913b6d), + (0xeed573ba), + (0x944448d7), + (0xfbd00846), + (0x8141332b), + (0x15057bfc), + (0x6f944091), + (0x00003675), + (0x7a910d18), + (0xeed545cf), + (0x94447ea2), + (0xfbd03e33), + (0x8141055e), + (0x15054d89), + (0x6f9476e4)}, + {(0x00000000), + (0x28410000), + (0x92350000), + (0xba740000), + (0x00601000), + (0x28211000), + (0x92551000), + (0xba141000), + (0x20161e00), + (0x08571e00), + (0xb2231e00), + (0x9a621e00), + (0x20760e00), + (0x08370e00), + (0xb2430e00), + (0x9a020e00)}, + {(0x3f800000), + (0x3f942080), + (0x3fc91a80), + (0x3fdd3a00), + (0x3f803008), + (0x3f941088), + (0x3fc92a88), + (0x3fdd0a08), + (0x3f900b0f), + (0x3f842b8f), + (0x3fd9118f), + (0x3fcd310f), + (0x3f903b07), + (0x3f841b87), + (0x3fd92187), + (0x3fcd0107)}, + (0xfff80000), + {0xa3,0x9f,0x64,0xc5,0x74,0x6d,0x2d,0x17,0xe7,0x4d, + 0x9a,0xaf,0xeb,0xb2,0x24,0x54,0x22,0x7a,0x93,0x8c,0x00} + }, + { + /* No.133 delta:1681 weight:1015 */ + 11213, + 83, + 12, + 13, + {(0x00000000), + (0x9193fd4c), + (0x375d8e7c), + (0xa6ce7330), + (0xbf90085d), + (0x2e03f511), + (0x88cd8621), + (0x195e7b6d), + (0x0000af07), + (0x9193524b), + (0x375d217b), + (0xa6cedc37), + (0xbf90a75a), + (0x2e035a16), + (0x88cd2926), + (0x195ed46a)}, + {(0x00000000), + (0x10740800), + (0x200dc000), + (0x3079c800), + (0x2056f800), + (0x3022f000), + (0x005b3800), + (0x102f3000), + (0x20031e00), + (0x30771600), + (0x000ede00), + (0x107ad600), + (0x0055e600), + (0x1021ee00), + (0x20582600), + (0x302c2e00)}, + {(0x3f800000), + (0x3f883a04), + (0x3f9006e0), + (0x3f983ce4), + (0x3f902b7c), + (0x3f981178), + (0x3f802d9c), + (0x3f881798), + (0x3f90018f), + (0x3f983b8b), + (0x3f80076f), + (0x3f883d6b), + (0x3f802af3), + (0x3f8810f7), + (0x3f902c13), + (0x3f981617)}, + (0xfff80000), + {0x5d,0xf8,0x9e,0x34,0xb8,0x35,0x07,0x7f,0xd2,0xe0, + 0x4f,0x6e,0x48,0xe9,0xdf,0x81,0x9d,0xf1,0x95,0x7a,0x00} + }, + { + /* No.134 delta:2863 weight:755 */ + 11213, + 84, + 6, + 17, + {(0x00000000), + (0x61047d07), + (0x957fb46d), + (0xf47bc96a), + (0x58f00860), + (0x39f47567), + (0xcd8fbc0d), + (0xac8bc10a), + (0x0000e9c0), + (0x610494c7), + (0x957f5dad), + (0xf47b20aa), + (0x58f0e1a0), + (0x39f49ca7), + (0xcd8f55cd), + (0xac8b28ca)}, + {(0x00000000), + (0x007c0000), + (0x13020000), + (0x137e0000), + (0x00020000), + (0x007e0000), + (0x13000000), + (0x137c0000), + (0x20401e00), + (0x203c1e00), + (0x33421e00), + (0x333e1e00), + (0x20421e00), + (0x203e1e00), + (0x33401e00), + (0x333c1e00)}, + {(0x3f800000), + (0x3f803e00), + (0x3f898100), + (0x3f89bf00), + (0x3f800100), + (0x3f803f00), + (0x3f898000), + (0x3f89be00), + (0x3f90200f), + (0x3f901e0f), + (0x3f99a10f), + (0x3f999f0f), + (0x3f90210f), + (0x3f901f0f), + (0x3f99a00f), + (0x3f999e0f)}, + (0xfff80000), + {0xcf,0x5c,0xa5,0xf4,0x7e,0x51,0x25,0xe8,0xf1,0x2b, + 0x6a,0x13,0xd4,0x31,0xca,0x76,0x97,0x3d,0x44,0x1a,0x00} + }, + { + /* No.135 delta:1967 weight:665 */ + 11213, + 19, + 12, + 19, + {(0x00000000), + (0xabbc4cf0), + (0xdf51c626), + (0x74ed8ad6), + (0x74a00878), + (0xdf1c4488), + (0xabf1ce5e), + (0x004d82ae), + (0x0000858b), + (0xabbcc97b), + (0xdf5143ad), + (0x74ed0f5d), + (0x74a08df3), + (0xdf1cc103), + (0xabf14bd5), + (0x004d0725)}, + {(0x00000000), + (0x41001800), + (0x004bc000), + (0x414bd800), + (0x8b86e200), + (0xca86fa00), + (0x8bcd2200), + (0xcacd3a00), + (0x70061e00), + (0x31060600), + (0x704dde00), + (0x314dc600), + (0xfb80fc00), + (0xba80e400), + (0xfbcb3c00), + (0xbacb2400)}, + {(0x3f800000), + (0x3fa0800c), + (0x3f8025e0), + (0x3fa0a5ec), + (0x3fc5c371), + (0x3fe5437d), + (0x3fc5e691), + (0x3fe5669d), + (0x3fb8030f), + (0x3f988303), + (0x3fb826ef), + (0x3f98a6e3), + (0x3ffdc07e), + (0x3fdd4072), + (0x3ffde59e), + (0x3fdd6592)}, + (0xfff80000), + {0xa2,0xe2,0xa5,0xe0,0x11,0x34,0xcb,0xf8,0xfc,0xa2, + 0x71,0xc6,0xbf,0xe2,0xc1,0x23,0x58,0x95,0xf4,0x86,0x00} + }, + { + /* No.136 delta:918 weight:1551 */ + 11213, + 47, + 18, + 4, + {(0x00000000), + (0x09adadc4), + (0xf017020b), + (0xf9baafcf), + (0x03300880), + (0x0a9da544), + (0xf3270a8b), + (0xfa8aa74f), + (0x0000cfe7), + (0x09ad6223), + (0xf017cdec), + (0xf9ba6028), + (0x0330c767), + (0x0a9d6aa3), + (0xf327c56c), + (0xfa8a68a8)}, + {(0x00000000), + (0x18747400), + (0x204c5200), + (0x38382600), + (0x10026c00), + (0x08761800), + (0x304e3e00), + (0x283a4a00), + (0x10011e00), + (0x08756a00), + (0x304d4c00), + (0x28393800), + (0x00037200), + (0x18770600), + (0x204f2000), + (0x383b5400)}, + {(0x3f800000), + (0x3f8c3a3a), + (0x3f902629), + (0x3f9c1c13), + (0x3f880136), + (0x3f843b0c), + (0x3f98271f), + (0x3f941d25), + (0x3f88008f), + (0x3f843ab5), + (0x3f9826a6), + (0x3f941c9c), + (0x3f8001b9), + (0x3f8c3b83), + (0x3f902790), + (0x3f9c1daa)}, + (0xfff80000), + {0xfd,0x25,0x81,0xf4,0x6f,0xd2,0x73,0x0c,0x1d,0xf8, + 0x3c,0x0b,0xd2,0x33,0xf7,0x54,0x12,0xcd,0x88,0xa9,0x00} + }, + { + /* No.137 delta:4265 weight:777 */ + 11213, + 70, + 4, + 16, + {(0x00000000), + (0xab4eac1a), + (0x41078fcd), + (0xea4923d7), + (0x9d20089e), + (0x366ea484), + (0xdc278753), + (0x77692b49), + (0x0000022a), + (0xab4eae30), + (0x41078de7), + (0xea4921fd), + (0x9d200ab4), + (0x366ea6ae), + (0xdc278579), + (0x77692963)}, + {(0x00000000), + (0x39400800), + (0x00500000), + (0x39100800), + (0x002c0000), + (0x396c0800), + (0x007c0000), + (0x393c0800), + (0x5e881e00), + (0x67c81600), + (0x5ed81e00), + (0x67981600), + (0x5ea41e00), + (0x67e41600), + (0x5ef41e00), + (0x67b41600)}, + {(0x3f800000), + (0x3f9ca004), + (0x3f802800), + (0x3f9c8804), + (0x3f801600), + (0x3f9cb604), + (0x3f803e00), + (0x3f9c9e04), + (0x3faf440f), + (0x3fb3e40b), + (0x3faf6c0f), + (0x3fb3cc0b), + (0x3faf520f), + (0x3fb3f20b), + (0x3faf7a0f), + (0x3fb3da0b)}, + (0xfff80000), + {0x67,0x39,0x69,0x46,0xb6,0xab,0xda,0x03,0x1a,0xb9, + 0x33,0x5c,0x43,0x1d,0xc4,0x88,0x65,0xf4,0x6e,0x7c,0x00} + }, + { + /* No.138 delta:2916 weight:1245 */ + 11213, + 12, + 4, + 11, + {(0x00000000), + (0x8bd9bb70), + (0x6536d8cf), + (0xeeef63bf), + (0x83c008a3), + (0x0819b3d3), + (0xe6f6d06c), + (0x6d2f6b1c), + (0x00006357), + (0x8bd9d827), + (0x6536bb98), + (0xeeef00e8), + (0x83c06bf4), + (0x0819d084), + (0xe6f6b33b), + (0x6d2f084b)}, + {(0x00000000), + (0x10b20000), + (0x0c210800), + (0x1c930800), + (0x29540000), + (0x39e60000), + (0x25750800), + (0x35c70800), + (0x02001e00), + (0x12b21e00), + (0x0e211600), + (0x1e931600), + (0x2b541e00), + (0x3be61e00), + (0x27751600), + (0x37c71600)}, + {(0x3f800000), + (0x3f885900), + (0x3f861084), + (0x3f8e4984), + (0x3f94aa00), + (0x3f9cf300), + (0x3f92ba84), + (0x3f9ae384), + (0x3f81000f), + (0x3f89590f), + (0x3f87108b), + (0x3f8f498b), + (0x3f95aa0f), + (0x3f9df30f), + (0x3f93ba8b), + (0x3f9be38b)}, + (0xfff80000), + {0xf3,0xfa,0x1e,0x93,0x8b,0xfb,0x73,0xc0,0xf1,0x10, + 0x33,0xac,0x5f,0x6b,0x3c,0x07,0xa2,0x98,0x75,0xed,0x00} + }, + { + /* No.139 delta:2344 weight:1631 */ + 11213, + 19, + 8, + 7, + {(0x00000000), + (0xfee0d62f), + (0x304aad76), + (0xceaa7b59), + (0x871008b7), + (0x79f0de98), + (0xb75aa5c1), + (0x49ba73ee), + (0x00003b80), + (0xfee0edaf), + (0x304a96f6), + (0xceaa40d9), + (0x87103337), + (0x79f0e518), + (0xb75a9e41), + (0x49ba486e)}, + {(0x00000000), + (0x05204400), + (0x00640000), + (0x05444400), + (0x00510400), + (0x05714000), + (0x00350400), + (0x05154000), + (0x32861e00), + (0x37a65a00), + (0x32e21e00), + (0x37c25a00), + (0x32d71a00), + (0x37f75e00), + (0x32b31a00), + (0x37935e00)}, + {(0x3f800000), + (0x3f829022), + (0x3f803200), + (0x3f82a222), + (0x3f802882), + (0x3f82b8a0), + (0x3f801a82), + (0x3f828aa0), + (0x3f99430f), + (0x3f9bd32d), + (0x3f99710f), + (0x3f9be12d), + (0x3f996b8d), + (0x3f9bfbaf), + (0x3f99598d), + (0x3f9bc9af)}, + (0xfff80000), + {0xaf,0x4b,0x20,0xda,0xcd,0xb1,0xdf,0x23,0x89,0x9b, + 0x9d,0xaf,0x0b,0x97,0x1e,0x9f,0x61,0xe7,0xfc,0x34,0x00} + }, + { + /* No.140 delta:8901 weight:1275 */ + 11213, + 67, + 29, + 1, + {(0x00000000), + (0x10b888fe), + (0xd0c6c2fc), + (0xc07e4a02), + (0x93a008cd), + (0x83188033), + (0x4366ca31), + (0x53de42cf), + (0x00009412), + (0x10b81cec), + (0xd0c656ee), + (0xc07ede10), + (0x93a09cdf), + (0x83181421), + (0x43665e23), + (0x53ded6dd)}, + {(0x00000000), + (0xd4620000), + (0x7a000000), + (0xae620000), + (0x01000000), + (0xd5620000), + (0x7b000000), + (0xaf620000), + (0x20a01e00), + (0xf4c21e00), + (0x5aa01e00), + (0x8ec21e00), + (0x21a01e00), + (0xf5c21e00), + (0x5ba01e00), + (0x8fc21e00)}, + {(0x3f800000), + (0x3fea3100), + (0x3fbd0000), + (0x3fd73100), + (0x3f808000), + (0x3feab100), + (0x3fbd8000), + (0x3fd7b100), + (0x3f90500f), + (0x3ffa610f), + (0x3fad500f), + (0x3fc7610f), + (0x3f90d00f), + (0x3ffae10f), + (0x3fadd00f), + (0x3fc7e10f)}, + (0xfff80000), + {0x57,0x96,0xba,0x7d,0x3b,0x31,0xd7,0xac,0xb2,0xe9, + 0x75,0xcd,0xdb,0x72,0x76,0x05,0x30,0x7f,0xd3,0xa0,0x00} + }, + { + /* No.141 delta:3341 weight:741 */ + 11213, + 28, + 3, + 17, + {(0x00000000), + (0xac86815e), + (0xed762180), + (0x41f0a0de), + (0x81a008df), + (0x2d268981), + (0x6cd6295f), + (0xc050a801), + (0x00004e54), + (0xac86cf0a), + (0xed766fd4), + (0x41f0ee8a), + (0x81a0468b), + (0x2d26c7d5), + (0x6cd6670b), + (0xc050e655)}, + {(0x00000000), + (0x9a110000), + (0x0f440000), + (0x95550000), + (0x70020000), + (0xea130000), + (0x7f460000), + (0xe5570000), + (0x21561e00), + (0xbb471e00), + (0x2e121e00), + (0xb4031e00), + (0x51541e00), + (0xcb451e00), + (0x5e101e00), + (0xc4011e00)}, + {(0x3f800000), + (0x3fcd0880), + (0x3f87a200), + (0x3fcaaa80), + (0x3fb80100), + (0x3ff50980), + (0x3fbfa300), + (0x3ff2ab80), + (0x3f90ab0f), + (0x3fdda38f), + (0x3f97090f), + (0x3fda018f), + (0x3fa8aa0f), + (0x3fe5a28f), + (0x3faf080f), + (0x3fe2008f)}, + (0xfff80000), + {0xcc,0x1d,0x62,0xab,0x61,0x1e,0xfc,0xe5,0x74,0x60, + 0xa2,0x5f,0xd0,0xfe,0xff,0x0e,0xfb,0x75,0x83,0x88,0x00} + }, + { + /* No.142 delta:5114 weight:1233 */ + 11213, + 35, + 30, + 3, + {(0x00000000), + (0xb9cd2997), + (0xab1ac509), + (0x12d7ec9e), + (0x5b2008ea), + (0xe2ed217d), + (0xf03acde3), + (0x49f7e474), + (0x0000ef9a), + (0xb9cdc60d), + (0xab1a2a93), + (0x12d70304), + (0x5b20e770), + (0xe2edcee7), + (0xf03a2279), + (0x49f70bee)}, + {(0x00000000), + (0xaef05000), + (0x2d801000), + (0x83704000), + (0x2390a000), + (0x8d60f000), + (0x0e10b000), + (0xa0e0e000), + (0x01001e00), + (0xaff04e00), + (0x2c800e00), + (0x82705e00), + (0x2290be00), + (0x8c60ee00), + (0x0f10ae00), + (0xa1e0fe00)}, + {(0x3f800000), + (0x3fd77828), + (0x3f96c008), + (0x3fc1b820), + (0x3f91c850), + (0x3fc6b078), + (0x3f870858), + (0x3fd07070), + (0x3f80800f), + (0x3fd7f827), + (0x3f964007), + (0x3fc1382f), + (0x3f91485f), + (0x3fc63077), + (0x3f878857), + (0x3fd0f07f)}, + (0xfff80000), + {0xce,0x51,0x4c,0x65,0x7a,0xae,0xbf,0x6f,0xd6,0x0b, + 0x0c,0x85,0x1c,0x15,0xe3,0xbf,0x9f,0x2b,0xa1,0x5d,0x00} + }, + { + /* No.143 delta:2115 weight:1465 */ + 11213, + 11, + 20, + 4, + {(0x00000000), + (0x34795048), + (0x0b9d244e), + (0x3fe47406), + (0xc90008f2), + (0xfd7958ba), + (0xc29d2cbc), + (0xf6e47cf4), + (0x00008680), + (0x3479d6c8), + (0x0b9da2ce), + (0x3fe4f286), + (0xc9008e72), + (0xfd79de3a), + (0xc29daa3c), + (0xf6e4fa74)}, + {(0x00000000), + (0xc1592000), + (0x16984000), + (0xd7c16000), + (0x21226800), + (0xe07b4800), + (0x37ba2800), + (0xf6e30800), + (0x08345e00), + (0xc96d7e00), + (0x1eac1e00), + (0xdff53e00), + (0x29163600), + (0xe84f1600), + (0x3f8e7600), + (0xfed75600)}, + {(0x3f800000), + (0x3fe0ac90), + (0x3f8b4c20), + (0x3febe0b0), + (0x3f909134), + (0x3ff03da4), + (0x3f9bdd14), + (0x3ffb7184), + (0x3f841a2f), + (0x3fe4b6bf), + (0x3f8f560f), + (0x3feffa9f), + (0x3f948b1b), + (0x3ff4278b), + (0x3f9fc73b), + (0x3fff6bab)}, + (0xfff80000), + {0x5f,0xfb,0xd7,0xc9,0x75,0x94,0x0e,0x84,0xfd,0x2b, + 0xc3,0xaf,0xdd,0x54,0xe4,0x81,0x96,0x14,0x65,0x90,0x00} + }, + { + /* No.144 delta:1074 weight:843 */ + 11213, + 50, + 20, + 11, + {(0x00000000), + (0xa8afcf6f), + (0x497c3b6e), + (0xe1d3f401), + (0xa0800909), + (0x082fc666), + (0xe9fc3267), + (0x4153fd08), + (0x0000ec80), + (0xa8af23ef), + (0x497cd7ee), + (0xe1d31881), + (0xa080e589), + (0x082f2ae6), + (0xe9fcdee7), + (0x41531188)}, + {(0x00000000), + (0x00081200), + (0xd0708400), + (0xd0789600), + (0x70302a00), + (0x70383800), + (0xa040ae00), + (0xa048bc00), + (0x1040fe00), + (0x1048ec00), + (0xc0307a00), + (0xc0386800), + (0x6070d400), + (0x6078c600), + (0xb0005000), + (0xb0084200)}, + {(0x3f800000), + (0x3f800409), + (0x3fe83842), + (0x3fe83c4b), + (0x3fb81815), + (0x3fb81c1c), + (0x3fd02057), + (0x3fd0245e), + (0x3f88207f), + (0x3f882476), + (0x3fe0183d), + (0x3fe01c34), + (0x3fb0386a), + (0x3fb03c63), + (0x3fd80028), + (0x3fd80421)}, + (0xfff80000), + {0x95,0xfe,0x49,0x06,0x5e,0xae,0xca,0x7d,0x0a,0xce, + 0xf9,0x80,0x70,0xc2,0x03,0xa9,0x1c,0xc3,0x16,0x85,0x00} + }, + { + /* No.145 delta:2918 weight:721 */ + 11213, + 86, + 4, + 18, + {(0x00000000), + (0x3bebda5d), + (0x18b70390), + (0x235cd9cd), + (0x2c60091c), + (0x178bd341), + (0x34d70a8c), + (0x0f3cd0d1), + (0x00004f75), + (0x3beb9528), + (0x18b74ce5), + (0x235c96b8), + (0x2c604669), + (0x178b9c34), + (0x34d745f9), + (0x0f3c9fa4)}, + {(0x00000000), + (0x1e710200), + (0x09800000), + (0x17f10200), + (0x00c00000), + (0x1eb10200), + (0x09400000), + (0x17310200), + (0x30431e00), + (0x2e321c00), + (0x39c31e00), + (0x27b21c00), + (0x30831e00), + (0x2ef21c00), + (0x39031e00), + (0x27721c00)}, + {(0x3f800000), + (0x3f8f3881), + (0x3f84c000), + (0x3f8bf881), + (0x3f806000), + (0x3f8f5881), + (0x3f84a000), + (0x3f8b9881), + (0x3f98218f), + (0x3f97190e), + (0x3f9ce18f), + (0x3f93d90e), + (0x3f98418f), + (0x3f97790e), + (0x3f9c818f), + (0x3f93b90e)}, + (0xfff80000), + {0x3c,0x75,0x1b,0x34,0x56,0x7d,0x5c,0xdd,0x5a,0x41, + 0xb9,0x82,0x6d,0x1d,0xc3,0x11,0x62,0x1e,0xea,0x73,0x00} + }, + { + /* No.146 delta:2588 weight:993 */ + 11213, + 77, + 8, + 11, + {(0x00000000), + (0x29b76eba), + (0xb5519d7b), + (0x9ce6f3c1), + (0xac000920), + (0x85b7679a), + (0x1951945b), + (0x30e6fae1), + (0x00002499), + (0x29b74a23), + (0xb551b9e2), + (0x9ce6d758), + (0xac002db9), + (0x85b74303), + (0x1951b0c2), + (0x30e6de78)}, + {(0x00000000), + (0x00350000), + (0x086a0000), + (0x085f0000), + (0x085c0000), + (0x08690000), + (0x00360000), + (0x00030000), + (0x00519e00), + (0x00649e00), + (0x083b9e00), + (0x080e9e00), + (0x080d9e00), + (0x08389e00), + (0x00679e00), + (0x00529e00)}, + {(0x3f800000), + (0x3f801a80), + (0x3f843500), + (0x3f842f80), + (0x3f842e00), + (0x3f843480), + (0x3f801b00), + (0x3f800180), + (0x3f8028cf), + (0x3f80324f), + (0x3f841dcf), + (0x3f84074f), + (0x3f8406cf), + (0x3f841c4f), + (0x3f8033cf), + (0x3f80294f)}, + (0xfff80000), + {0x78,0x89,0x90,0x85,0x2f,0x08,0xc7,0x62,0xed,0x99, + 0x04,0xfb,0xe5,0x26,0x8d,0x20,0x08,0xbc,0xe0,0x01,0x00} + }, + { + /* No.147 delta:1196 weight:1067 */ + 11213, + 65, + 15, + 11, + {(0x00000000), + (0xe3c8118c), + (0x346df077), + (0xd7a5e1fb), + (0xff500936), + (0x1c9818ba), + (0xcb3df941), + (0x28f5e8cd), + (0x000057eb), + (0xe3c84667), + (0x346da79c), + (0xd7a5b610), + (0xff505edd), + (0x1c984f51), + (0xcb3daeaa), + (0x28f5bf26)}, + {(0x00000000), + (0x00411800), + (0x0c060000), + (0x0c471800), + (0x260a4800), + (0x264b5000), + (0x2a0c4800), + (0x2a4d5000), + (0x0003de00), + (0x0042c600), + (0x0c05de00), + (0x0c44c600), + (0x26099600), + (0x26488e00), + (0x2a0f9600), + (0x2a4e8e00)}, + {(0x3f800000), + (0x3f80208c), + (0x3f860300), + (0x3f86238c), + (0x3f930524), + (0x3f9325a8), + (0x3f950624), + (0x3f9526a8), + (0x3f8001ef), + (0x3f802163), + (0x3f8602ef), + (0x3f862263), + (0x3f9304cb), + (0x3f932447), + (0x3f9507cb), + (0x3f952747)}, + (0xfff80000), + {0x1f,0x15,0xcd,0x92,0x4b,0xcd,0x46,0xa5,0x75,0xd5, + 0x6e,0xf4,0x6d,0x40,0x10,0x3c,0xa0,0xd0,0x56,0x85,0x00} + }, + { + /* No.148 delta:995 weight:1397 */ + 11213, + 48, + 20, + 6, + {(0x00000000), + (0x81afe9a5), + (0xc7e54dd3), + (0x464aa476), + (0x42100942), + (0xc3bfe0e7), + (0x85f54491), + (0x045aad34), + (0x0000d573), + (0x81af3cd6), + (0xc7e598a0), + (0x464a7105), + (0x4210dc31), + (0xc3bf3594), + (0x85f591e2), + (0x045a7847)}, + {(0x00000000), + (0x0c8d6800), + (0x00660a00), + (0x0ceb6200), + (0x0190c600), + (0x0d1dae00), + (0x01f6cc00), + (0x0d7ba400), + (0x00423e00), + (0x0ccf5600), + (0x00243400), + (0x0ca95c00), + (0x01d2f800), + (0x0d5f9000), + (0x01b4f200), + (0x0d399a00)}, + {(0x3f800000), + (0x3f8646b4), + (0x3f803305), + (0x3f8675b1), + (0x3f80c863), + (0x3f868ed7), + (0x3f80fb66), + (0x3f86bdd2), + (0x3f80211f), + (0x3f8667ab), + (0x3f80121a), + (0x3f8654ae), + (0x3f80e97c), + (0x3f86afc8), + (0x3f80da79), + (0x3f869ccd)}, + (0xfff80000), + {0x89,0x5d,0x4d,0xfa,0x78,0x98,0x8a,0x59,0x89,0x1d, + 0x43,0x6d,0x08,0x21,0x0f,0x15,0xef,0xea,0xed,0x4f,0x00} + }, + { + /* No.149 delta:1807 weight:1017 */ + 11213, + 25, + 17, + 13, + {(0x00000000), + (0x95fafe23), + (0x258e5d0f), + (0xb074a32c), + (0x5b000950), + (0xcefaf773), + (0x7e8e545f), + (0xeb74aa7c), + (0x00007b8f), + (0x95fa85ac), + (0x258e2680), + (0xb074d8a3), + (0x5b0072df), + (0xcefa8cfc), + (0x7e8e2fd0), + (0xeb74d1f3)}, + {(0x00000000), + (0x40690000), + (0x107c4000), + (0x50154000), + (0x0061b000), + (0x4008b000), + (0x101df000), + (0x5074f000), + (0x10221e00), + (0x504b1e00), + (0x005e5e00), + (0x40375e00), + (0x1043ae00), + (0x502aae00), + (0x003fee00), + (0x4056ee00)}, + {(0x3f800000), + (0x3fa03480), + (0x3f883e20), + (0x3fa80aa0), + (0x3f8030d8), + (0x3fa00458), + (0x3f880ef8), + (0x3fa83a78), + (0x3f88110f), + (0x3fa8258f), + (0x3f802f2f), + (0x3fa01baf), + (0x3f8821d7), + (0x3fa81557), + (0x3f801ff7), + (0x3fa02b77)}, + (0xfff80000), + {0x29,0x89,0x68,0x24,0x4a,0xc0,0x9c,0xf5,0x79,0x14, + 0xc1,0x26,0xaa,0x3d,0xbf,0x1f,0xc1,0xbc,0x78,0x97,0x00} + }, + { + /* No.150 delta:2642 weight:975 */ + 11213, + 44, + 4, + 15, + {(0x00000000), + (0x3cf7745b), + (0x8a251fd4), + (0xb6d26b8f), + (0xc580096c), + (0xf9777d37), + (0x4fa516b8), + (0x735262e3), + (0x00007ddf), + (0x3cf70984), + (0x8a25620b), + (0xb6d21650), + (0xc58074b3), + (0xf97700e8), + (0x4fa56b67), + (0x73521f3c)}, + {(0x00000000), + (0x52780000), + (0x13600000), + (0x41180000), + (0x08cc0000), + (0x5ab40000), + (0x1bac0000), + (0x49d40000), + (0x02401e00), + (0x50381e00), + (0x11201e00), + (0x43581e00), + (0x0a8c1e00), + (0x58f41e00), + (0x19ec1e00), + (0x4b941e00)}, + {(0x3f800000), + (0x3fa93c00), + (0x3f89b000), + (0x3fa08c00), + (0x3f846600), + (0x3fad5a00), + (0x3f8dd600), + (0x3fa4ea00), + (0x3f81200f), + (0x3fa81c0f), + (0x3f88900f), + (0x3fa1ac0f), + (0x3f85460f), + (0x3fac7a0f), + (0x3f8cf60f), + (0x3fa5ca0f)}, + (0xfff80000), + {0x1c,0x8b,0x81,0x2c,0x97,0xf0,0xd6,0x0f,0xeb,0x28, + 0x7e,0xbd,0x56,0xe1,0x95,0x03,0x72,0xd1,0x0a,0x96,0x00} + }, + { + /* No.151 delta:962 weight:1023 */ + 11213, + 78, + 12, + 10, + {(0x00000000), + (0x171b50e0), + (0x997dbf57), + (0x8e66efb7), + (0x22d00977), + (0x35cb5997), + (0xbbadb620), + (0xacb6e6c0), + (0x00001c87), + (0x171b4c67), + (0x997da3d0), + (0x8e66f330), + (0x22d015f0), + (0x35cb4510), + (0xbbadaaa7), + (0xacb6fa47)}, + {(0x00000000), + (0x21821c00), + (0x10102200), + (0x31923e00), + (0x60023000), + (0x41802c00), + (0x70121200), + (0x51900e00), + (0xc100de00), + (0xe082c200), + (0xd110fc00), + (0xf092e000), + (0xa102ee00), + (0x8080f200), + (0xb112cc00), + (0x9090d000)}, + {(0x3f800000), + (0x3f90c10e), + (0x3f880811), + (0x3f98c91f), + (0x3fb00118), + (0x3fa0c016), + (0x3fb80909), + (0x3fa8c807), + (0x3fe0806f), + (0x3ff04161), + (0x3fe8887e), + (0x3ff84970), + (0x3fd08177), + (0x3fc04079), + (0x3fd88966), + (0x3fc84868)}, + (0xfff80000), + {0xb1,0xe6,0xdf,0x01,0xdd,0xa2,0x07,0x31,0x50,0x37, + 0xbf,0x34,0x2a,0x6d,0xfe,0xe7,0x69,0x32,0x01,0x60,0x00} + }, + { + /* No.152 delta:1302 weight:1041 */ + 11213, + 55, + 10, + 13, + {(0x00000000), + (0xd0556a8d), + (0x5e4d31d5), + (0x8e185b58), + (0xe6600989), + (0x36356304), + (0xb82d385c), + (0x687852d1), + (0x000019bb), + (0xd0557336), + (0x5e4d286e), + (0x8e1842e3), + (0xe6601032), + (0x36357abf), + (0xb82d21e7), + (0x68784b6a)}, + {(0x00000000), + (0x627c4000), + (0x3034a000), + (0x5248e000), + (0x00038000), + (0x627fc000), + (0x30372000), + (0x524b6000), + (0x80519e00), + (0xe22dde00), + (0xb0653e00), + (0xd2197e00), + (0x80521e00), + (0xe22e5e00), + (0xb066be00), + (0xd21afe00)}, + {(0x3f800000), + (0x3fb13e20), + (0x3f981a50), + (0x3fa92470), + (0x3f8001c0), + (0x3fb13fe0), + (0x3f981b90), + (0x3fa925b0), + (0x3fc028cf), + (0x3ff116ef), + (0x3fd8329f), + (0x3fe90cbf), + (0x3fc0290f), + (0x3ff1172f), + (0x3fd8335f), + (0x3fe90d7f)}, + (0xfff80000), + {0x9e,0x26,0x73,0xd6,0xbe,0x9b,0x5f,0x7d,0x6b,0x71, + 0x07,0x55,0x14,0xdf,0x70,0x0c,0x4a,0x9a,0xdd,0x23,0x00} + }, + { + /* No.153 delta:1084 weight:1123 */ + 11213, + 86, + 22, + 10, + {(0x00000000), + (0xa2a5f5b9), + (0x2b421269), + (0x89e7e7d0), + (0x54300991), + (0xf695fc28), + (0x7f721bf8), + (0xddd7ee41), + (0x0000dc1c), + (0xa2a529a5), + (0x2b42ce75), + (0x89e73bcc), + (0x5430d58d), + (0xf6952034), + (0x7f72c7e4), + (0xddd7325d)}, + {(0x00000000), + (0x40cc0000), + (0x50668000), + (0x10aa8000), + (0x0069f000), + (0x40a5f000), + (0x500f7000), + (0x10c37000), + (0x00131e00), + (0x40df1e00), + (0x50759e00), + (0x10b99e00), + (0x007aee00), + (0x40b6ee00), + (0x501c6e00), + (0x10d06e00)}, + {(0x3f800000), + (0x3fa06600), + (0x3fa83340), + (0x3f885540), + (0x3f8034f8), + (0x3fa052f8), + (0x3fa807b8), + (0x3f8861b8), + (0x3f80098f), + (0x3fa06f8f), + (0x3fa83acf), + (0x3f885ccf), + (0x3f803d77), + (0x3fa05b77), + (0x3fa80e37), + (0x3f886837)}, + (0xfff80000), + {0x27,0x0a,0x3f,0xdb,0x36,0x65,0x8b,0x9c,0x6c,0x3d, + 0xb3,0x81,0x6b,0x82,0xdc,0xaf,0x77,0xa0,0x5a,0x41,0x00} + }, + { + /* No.154 delta:1218 weight:1125 */ + 11213, + 33, + 17, + 9, + {(0x00000000), + (0xbc510269), + (0x187fd997), + (0xa42edbfe), + (0xb2d009a5), + (0x0e810bcc), + (0xaaafd032), + (0x16fed25b), + (0x00008c92), + (0xbc518efb), + (0x187f5505), + (0xa42e576c), + (0xb2d08537), + (0x0e81875e), + (0xaaaf5ca0), + (0x16fe5ec9)}, + {(0x00000000), + (0x4674aa00), + (0x20885800), + (0x66fcf200), + (0x010e8000), + (0x477a2a00), + (0x2186d800), + (0x67f27200), + (0x02c2be00), + (0x44b61400), + (0x224ae600), + (0x643e4c00), + (0x03cc3e00), + (0x45b89400), + (0x23446600), + (0x6530cc00)}, + {(0x3f800000), + (0x3fa33a55), + (0x3f90442c), + (0x3fb37e79), + (0x3f808740), + (0x3fa3bd15), + (0x3f90c36c), + (0x3fb3f939), + (0x3f81615f), + (0x3fa25b0a), + (0x3f912573), + (0x3fb21f26), + (0x3f81e61f), + (0x3fa2dc4a), + (0x3f91a233), + (0x3fb29866)}, + (0xfff80000), + {0xcd,0xbe,0xfa,0xd2,0x8e,0x1c,0x9f,0x67,0x49,0xe4, + 0xe4,0x6c,0xb2,0xe3,0x01,0xb2,0x56,0x77,0x18,0x40,0x00} + }, + { + /* No.155 delta:2783 weight:955 */ + 11213, + 59, + 3, + 7, + {(0x00000000), + (0xac2382ba), + (0x6ff1673d), + (0xc3d2e587), + (0x37a009b6), + (0x9b838b0c), + (0x58516e8b), + (0xf472ec31), + (0x0000a5f6), + (0xac23274c), + (0x6ff1c2cb), + (0xc3d24071), + (0x37a0ac40), + (0x9b832efa), + (0x5851cb7d), + (0xf47249c7)}, + {(0x00000000), + (0x14228400), + (0x00948000), + (0x14b60400), + (0x206a8400), + (0x34480000), + (0x20fe0400), + (0x34dc8000), + (0x40481e00), + (0x546a9a00), + (0x40dc9e00), + (0x54fe1a00), + (0x60229a00), + (0x74001e00), + (0x60b61a00), + (0x74949e00)}, + {(0x3f800000), + (0x3f8a1142), + (0x3f804a40), + (0x3f8a5b02), + (0x3f903542), + (0x3f9a2400), + (0x3f907f02), + (0x3f9a6e40), + (0x3fa0240f), + (0x3faa354d), + (0x3fa06e4f), + (0x3faa7f0d), + (0x3fb0114d), + (0x3fba000f), + (0x3fb05b0d), + (0x3fba4a4f)}, + (0xfff80000), + {0x12,0x6b,0xe6,0x1a,0xef,0x03,0x6a,0x5a,0xeb,0x44, + 0xd4,0xe8,0x31,0x17,0x3d,0x9b,0xd7,0xd8,0xc8,0xd2,0x00} + }, + { + /* No.156 delta:2681 weight:1401 */ + 11213, + 11, + 22, + 2, + {(0x00000000), + (0xfcaff0c3), + (0xee10c3a9), + (0x12bf336a), + (0x1ea009c1), + (0xe20ff902), + (0xf0b0ca68), + (0x0c1f3aab), + (0x0000a3d9), + (0xfcaf531a), + (0xee106070), + (0x12bf90b3), + (0x1ea0aa18), + (0xe20f5adb), + (0xf0b069b1), + (0x0c1f9972)}, + {(0x00000000), + (0x8f318000), + (0x0c949000), + (0x83a51000), + (0x61378000), + (0xee060000), + (0x6da31000), + (0xe2929000), + (0x4044de00), + (0xcf755e00), + (0x4cd04e00), + (0xc3e1ce00), + (0x21735e00), + (0xae42de00), + (0x2de7ce00), + (0xa2d64e00)}, + {(0x3f800000), + (0x3fc798c0), + (0x3f864a48), + (0x3fc1d288), + (0x3fb09bc0), + (0x3ff70300), + (0x3fb6d188), + (0x3ff14948), + (0x3fa0226f), + (0x3fe7baaf), + (0x3fa66827), + (0x3fe1f0e7), + (0x3f90b9af), + (0x3fd7216f), + (0x3f96f3e7), + (0x3fd16b27)}, + (0xfff80000), + {0x83,0x73,0xde,0x94,0x03,0x6f,0x08,0x85,0xc8,0x3c, + 0xf2,0x9a,0xb2,0x9d,0x8f,0xfe,0x34,0x78,0xe6,0x25,0x00} + }, + { + /* No.157 delta:4633 weight:903 */ + 11213, + 70, + 1, + 8, + {(0x00000000), + (0x4732d8c0), + (0x2145def8), + (0x66770638), + (0x8ec009da), + (0xc9f2d11a), + (0xaf85d722), + (0xe8b70fe2), + (0x000031b0), + (0x4732e970), + (0x2145ef48), + (0x66773788), + (0x8ec0386a), + (0xc9f2e0aa), + (0xaf85e692), + (0xe8b73e52)}, + {(0x00000000), + (0x10400000), + (0x24640000), + (0x34240000), + (0x81100000), + (0x91500000), + (0xa5740000), + (0xb5340000), + (0x08431e00), + (0x18031e00), + (0x2c271e00), + (0x3c671e00), + (0x89531e00), + (0x99131e00), + (0xad371e00), + (0xbd771e00)}, + {(0x3f800000), + (0x3f882000), + (0x3f923200), + (0x3f9a1200), + (0x3fc08800), + (0x3fc8a800), + (0x3fd2ba00), + (0x3fda9a00), + (0x3f84218f), + (0x3f8c018f), + (0x3f96138f), + (0x3f9e338f), + (0x3fc4a98f), + (0x3fcc898f), + (0x3fd69b8f), + (0x3fdebb8f)}, + (0xfff80000), + {0xdd,0x87,0x76,0x32,0x84,0x88,0x7a,0x5f,0x52,0x09, + 0x1f,0x36,0xae,0xfa,0x7b,0x5d,0xb4,0x87,0x91,0x59,0x00} + }, + { + /* No.158 delta:1376 weight:811 */ + 11213, + 58, + 16, + 14, + {(0x00000000), + (0xdc5d3a0a), + (0x023cad01), + (0xde61970b), + (0x286009e2), + (0xf43d33e8), + (0x2a5ca4e3), + (0xf6019ee9), + (0x00009c42), + (0xdc5da648), + (0x023c3143), + (0xde610b49), + (0x286095a0), + (0xf43dafaa), + (0x2a5c38a1), + (0xf60102ab)}, + {(0x00000000), + (0x50081000), + (0x305e0000), + (0x60561000), + (0x10324000), + (0x403a5000), + (0x206c4000), + (0x70645000), + (0x20011e00), + (0x70090e00), + (0x105f1e00), + (0x40570e00), + (0x30335e00), + (0x603b4e00), + (0x006d5e00), + (0x50654e00)}, + {(0x3f800000), + (0x3fa80408), + (0x3f982f00), + (0x3fb02b08), + (0x3f881920), + (0x3fa01d28), + (0x3f903620), + (0x3fb83228), + (0x3f90008f), + (0x3fb80487), + (0x3f882f8f), + (0x3fa02b87), + (0x3f9819af), + (0x3fb01da7), + (0x3f8036af), + (0x3fa832a7)}, + (0xfff80000), + {0x96,0xe0,0xc6,0xef,0x7f,0x51,0x3c,0x13,0xd3,0x63, + 0x80,0x54,0xc8,0x09,0xcc,0x33,0x8e,0x9a,0x15,0x91,0x00} + }, + { + /* No.159 delta:1647 weight:1099 */ + 11213, + 91, + 19, + 1, + {(0x00000000), + (0xeffea95b), + (0x587a7fdf), + (0xb784d684), + (0xe5b009ff), + (0x0a4ea0a4), + (0xbdca7620), + (0x5234df7b), + (0x00008677), + (0xeffe2f2c), + (0x587af9a8), + (0xb78450f3), + (0xe5b08f88), + (0x0a4e26d3), + (0xbdcaf057), + (0x5234590c)}, + {(0x00000000), + (0xc3463c00), + (0x20814400), + (0xe3c77800), + (0x04036400), + (0xc7455800), + (0x24822000), + (0xe7c41c00), + (0x66201e00), + (0xa5662200), + (0x46a15a00), + (0x85e76600), + (0x62237a00), + (0xa1654600), + (0x42a23e00), + (0x81e40200)}, + {(0x3f800000), + (0x3fe1a31e), + (0x3f9040a2), + (0x3ff1e3bc), + (0x3f8201b2), + (0x3fe3a2ac), + (0x3f924110), + (0x3ff3e20e), + (0x3fb3100f), + (0x3fd2b311), + (0x3fa350ad), + (0x3fc2f3b3), + (0x3fb111bd), + (0x3fd0b2a3), + (0x3fa1511f), + (0x3fc0f201)}, + (0xfff80000), + {0x6f,0x70,0x62,0xec,0x14,0x82,0xd2,0xb9,0xc0,0x8d, + 0xdc,0xae,0x07,0x77,0xb8,0x94,0x3f,0xc9,0xfa,0xe1,0x00} + }, + { + /* No.160 delta:2967 weight:901 */ + 11213, + 53, + 18, + 1, + {(0x00000000), + (0xaa302b40), + (0x85ec337a), + (0x2fdc183a), + (0x3dd00a0a), + (0x97e0214a), + (0xb83c3970), + (0x120c1230), + (0x00008c9b), + (0xaa30a7db), + (0x85ecbfe1), + (0x2fdc94a1), + (0x3dd08691), + (0x97e0add1), + (0xb83cb5eb), + (0x120c9eab)}, + {(0x00000000), + (0x0e4c0c00), + (0x81a28000), + (0x8fee8c00), + (0x01009400), + (0x0f4c9800), + (0x80a21400), + (0x8eee1800), + (0x09031e00), + (0x074f1200), + (0x88a19e00), + (0x86ed9200), + (0x08038a00), + (0x064f8600), + (0x89a10a00), + (0x87ed0600)}, + {(0x3f800000), + (0x3f872606), + (0x3fc0d140), + (0x3fc7f746), + (0x3f80804a), + (0x3f87a64c), + (0x3fc0510a), + (0x3fc7770c), + (0x3f84818f), + (0x3f83a789), + (0x3fc450cf), + (0x3fc376c9), + (0x3f8401c5), + (0x3f8327c3), + (0x3fc4d085), + (0x3fc3f683)}, + (0xfff80000), + {0xa5,0x57,0xd6,0x41,0xd4,0x56,0x49,0x1c,0xe3,0x86, + 0x35,0xfc,0x5c,0xaf,0xd9,0xba,0x3e,0xfe,0x47,0xfa,0x00} + }, + { + /* No.161 delta:1285 weight:1009 */ + 11213, + 44, + 22, + 9, + {(0x00000000), + (0xbd887100), + (0x6d55a627), + (0xd0ddd727), + (0x18000a1d), + (0xa5887b1d), + (0x7555ac3a), + (0xc8dddd3a), + (0x0000acfa), + (0xbd88ddfa), + (0x6d550add), + (0xd0dd7bdd), + (0x1800a6e7), + (0xa588d7e7), + (0x755500c0), + (0xc8dd71c0)}, + {(0x00000000), + (0x0fe36000), + (0x0045f000), + (0x0fa69000), + (0x121a2000), + (0x1df94000), + (0x125fd000), + (0x1dbcb000), + (0x00371e00), + (0x0fd47e00), + (0x0072ee00), + (0x0f918e00), + (0x122d3e00), + (0x1dce5e00), + (0x1268ce00), + (0x1d8bae00)}, + {(0x3f800000), + (0x3f87f1b0), + (0x3f8022f8), + (0x3f87d348), + (0x3f890d10), + (0x3f8efca0), + (0x3f892fe8), + (0x3f8ede58), + (0x3f801b8f), + (0x3f87ea3f), + (0x3f803977), + (0x3f87c8c7), + (0x3f89169f), + (0x3f8ee72f), + (0x3f893467), + (0x3f8ec5d7)}, + (0xfff80000), + {0xb3,0x0a,0x52,0x2b,0xc3,0xf3,0x8a,0x0b,0x60,0xcf, + 0x50,0x81,0xc0,0x03,0x13,0x44,0x56,0xfd,0xe5,0x6c,0x00} + }, + { + /* No.162 delta:3653 weight:1321 */ + 11213, + 77, + 4, + 1, + {(0x00000000), + (0x09eb7b50), + (0x4a578b30), + (0x43bcf060), + (0xc4b00a20), + (0xcd5b7170), + (0x8ee78110), + (0x870cfa40), + (0x000030d1), + (0x09eb4b81), + (0x4a57bbe1), + (0x43bcc0b1), + (0xc4b03af1), + (0xcd5b41a1), + (0x8ee7b1c1), + (0x870cca91)}, + {(0x00000000), + (0x20630000), + (0x00492000), + (0x202a2000), + (0x400a0000), + (0x60690000), + (0x40432000), + (0x60202000), + (0xc0027e00), + (0xe0617e00), + (0xc04b5e00), + (0xe0285e00), + (0x80087e00), + (0xa06b7e00), + (0x80415e00), + (0xa0225e00)}, + {(0x3f800000), + (0x3f903180), + (0x3f802490), + (0x3f901510), + (0x3fa00500), + (0x3fb03480), + (0x3fa02190), + (0x3fb01010), + (0x3fe0013f), + (0x3ff030bf), + (0x3fe025af), + (0x3ff0142f), + (0x3fc0043f), + (0x3fd035bf), + (0x3fc020af), + (0x3fd0112f)}, + (0xfff80000), + {0xed,0x0f,0x9e,0x5d,0x4b,0x7d,0x2e,0x4f,0xf8,0xa4, + 0xba,0x23,0xdc,0x1a,0x0e,0x40,0xa9,0xff,0xbf,0xfa,0x00} + }, + { + /* No.163 delta:1515 weight:829 */ + 11213, + 59, + 16, + 13, + {(0x00000000), + (0xd192fecc), + (0x1c86d46e), + (0xcd142aa2), + (0xeb900a31), + (0x3a02f4fd), + (0xf716de5f), + (0x26842093), + (0x00009c7b), + (0xd19262b7), + (0x1c864815), + (0xcd14b6d9), + (0xeb90964a), + (0x3a026886), + (0xf7164224), + (0x2684bce8)}, + {(0x00000000), + (0xc9688000), + (0x08400200), + (0xc1288200), + (0x082d4800), + (0xc145c800), + (0x006d4a00), + (0xc905ca00), + (0x312c1e00), + (0xf8449e00), + (0x396c1c00), + (0xf0049c00), + (0x39015600), + (0xf069d600), + (0x31415400), + (0xf829d400)}, + {(0x3f800000), + (0x3fe4b440), + (0x3f842001), + (0x3fe09441), + (0x3f8416a4), + (0x3fe0a2e4), + (0x3f8036a5), + (0x3fe482e5), + (0x3f98960f), + (0x3ffc224f), + (0x3f9cb60e), + (0x3ff8024e), + (0x3f9c80ab), + (0x3ff834eb), + (0x3f98a0aa), + (0x3ffc14ea)}, + (0xfff80000), + {0xe7,0xaa,0x57,0x85,0x45,0x30,0x30,0xea,0x81,0x55, + 0x14,0xf3,0xe1,0x42,0x5a,0xfc,0x05,0x1e,0xd3,0xf0,0x00} + }, + { + /* No.164 delta:5942 weight:1403 */ + 11213, + 49, + 28, + 3, + {(0x00000000), + (0x96bbff16), + (0x0e2dd758), + (0x9896284e), + (0xb5700a46), + (0x23cbf550), + (0xbb5ddd1e), + (0x2de62208), + (0x0000f8d9), + (0x96bb07cf), + (0x0e2d2f81), + (0x9896d097), + (0xb570f29f), + (0x23cb0d89), + (0xbb5d25c7), + (0x2de6dad1)}, + {(0x00000000), + (0x44940000), + (0x03b80000), + (0x472c0000), + (0x48600000), + (0x0cf40000), + (0x4bd80000), + (0x0f4c0000), + (0x00801e00), + (0x44141e00), + (0x03381e00), + (0x47ac1e00), + (0x48e01e00), + (0x0c741e00), + (0x4b581e00), + (0x0fcc1e00)}, + {(0x3f800000), + (0x3fa24a00), + (0x3f81dc00), + (0x3fa39600), + (0x3fa43000), + (0x3f867a00), + (0x3fa5ec00), + (0x3f87a600), + (0x3f80400f), + (0x3fa20a0f), + (0x3f819c0f), + (0x3fa3d60f), + (0x3fa4700f), + (0x3f863a0f), + (0x3fa5ac0f), + (0x3f87e60f)}, + (0xfff80000), + {0x76,0xb3,0x89,0x96,0x29,0x62,0x6a,0x7b,0xe7,0x6f, + 0x4a,0x6c,0x1f,0xbf,0x96,0x66,0x8d,0x45,0x5d,0x5c,0x00} + }, + { + /* No.165 delta:1776 weight:1045 */ + 11213, + 74, + 10, + 13, + {(0x00000000), + (0x24c994e7), + (0x7e990c2c), + (0x5a5098cb), + (0xb9000a51), + (0x9dc99eb6), + (0xc799067d), + (0xe350929a), + (0x0000dbdf), + (0x24c94f38), + (0x7e99d7f3), + (0x5a504314), + (0xb900d18e), + (0x9dc94569), + (0xc799dda2), + (0xe3504945)}, + {(0x00000000), + (0x00764000), + (0x000d4000), + (0x007b0000), + (0x102e6000), + (0x10582000), + (0x10232000), + (0x10556000), + (0x10065e00), + (0x10701e00), + (0x100b1e00), + (0x107d5e00), + (0x00283e00), + (0x005e7e00), + (0x00257e00), + (0x00533e00)}, + {(0x3f800000), + (0x3f803b20), + (0x3f8006a0), + (0x3f803d80), + (0x3f881730), + (0x3f882c10), + (0x3f881190), + (0x3f882ab0), + (0x3f88032f), + (0x3f88380f), + (0x3f88058f), + (0x3f883eaf), + (0x3f80141f), + (0x3f802f3f), + (0x3f8012bf), + (0x3f80299f)}, + (0xfff80000), + {0xfb,0xa8,0xac,0x3b,0xfe,0x8d,0xcc,0xf9,0x64,0x79, + 0xa4,0xdb,0x6d,0x8f,0x8a,0x6e,0xb9,0x91,0x4e,0xb0,0x00} + }, + { + /* No.166 delta:1278 weight:1311 */ + 11213, + 38, + 18, + 10, + {(0x00000000), + (0x1aa51933), + (0x7654762b), + (0x6cf16f18), + (0x06100a69), + (0x1cb5135a), + (0x70447c42), + (0x6ae16571), + (0x0000bdcd), + (0x1aa5a4fe), + (0x7654cbe6), + (0x6cf1d2d5), + (0x0610b7a4), + (0x1cb5ae97), + (0x7044c18f), + (0x6ae1d8bc)}, + {(0x00000000), + (0x1c020c00), + (0x10065600), + (0x0c045a00), + (0xa4030000), + (0xb8010c00), + (0xb4055600), + (0xa8075a00), + (0x51205e00), + (0x4d225200), + (0x41260800), + (0x5d240400), + (0xf5235e00), + (0xe9215200), + (0xe5250800), + (0xf9270400)}, + {(0x3f800000), + (0x3f8e0106), + (0x3f88032b), + (0x3f86022d), + (0x3fd20180), + (0x3fdc0086), + (0x3fda02ab), + (0x3fd403ad), + (0x3fa8902f), + (0x3fa69129), + (0x3fa09304), + (0x3fae9202), + (0x3ffa91af), + (0x3ff490a9), + (0x3ff29284), + (0x3ffc9382)}, + (0xfff80000), + {0xe2,0x4b,0xe1,0x7f,0x94,0x30,0x00,0x2c,0x65,0x3e, + 0x59,0x45,0xfa,0x87,0x44,0x25,0xe1,0x2d,0xb7,0xdb,0x00} + }, + { + /* No.167 delta:1582 weight:743 */ + 11213, + 80, + 9, + 17, + {(0x00000000), + (0xf8f257fd), + (0x26c7fb3f), + (0xde35acc2), + (0xba900a7d), + (0x42625d80), + (0x9c57f142), + (0x64a5a6bf), + (0x00008157), + (0xf8f2d6aa), + (0x26c77a68), + (0xde352d95), + (0xba908b2a), + (0x4262dcd7), + (0x9c577015), + (0x64a527e8)}, + {(0x00000000), + (0x884f0000), + (0x11035000), + (0x994c5000), + (0x2a02a800), + (0xa24da800), + (0x3b01f800), + (0xb34ef800), + (0x10041e00), + (0x984b1e00), + (0x01074e00), + (0x89484e00), + (0x3a06b600), + (0xb249b600), + (0x2b05e600), + (0xa34ae600)}, + {(0x3f800000), + (0x3fc42780), + (0x3f8881a8), + (0x3fcca628), + (0x3f950154), + (0x3fd126d4), + (0x3f9d80fc), + (0x3fd9a77c), + (0x3f88020f), + (0x3fcc258f), + (0x3f8083a7), + (0x3fc4a427), + (0x3f9d035b), + (0x3fd924db), + (0x3f9582f3), + (0x3fd1a573)}, + (0xfff80000), + {0xad,0x7a,0xb9,0x26,0x28,0x43,0xfc,0x1a,0x71,0x9d, + 0xfe,0xb1,0x4c,0x75,0x45,0xcd,0x8d,0xf2,0x4d,0x01,0x00} + }, + { + /* No.168 delta:7619 weight:787 */ + 11213, + 59, + 26, + 1, + {(0x00000000), + (0x98e8b6d9), + (0x521f6a74), + (0xcaf7dcad), + (0x53d00a8d), + (0xcb38bc54), + (0x01cf60f9), + (0x9927d620), + (0x0000f72a), + (0x98e841f3), + (0x521f9d5e), + (0xcaf72b87), + (0x53d0fda7), + (0xcb384b7e), + (0x01cf97d3), + (0x9927210a)}, + {(0x00000000), + (0x4e200000), + (0x70542000), + (0x3e742000), + (0x13942000), + (0x5db42000), + (0x63c00000), + (0x2de00000), + (0x08001e00), + (0x46201e00), + (0x78543e00), + (0x36743e00), + (0x1b943e00), + (0x55b43e00), + (0x6bc01e00), + (0x25e01e00)}, + {(0x3f800000), + (0x3fa71000), + (0x3fb82a10), + (0x3f9f3a10), + (0x3f89ca10), + (0x3faeda10), + (0x3fb1e000), + (0x3f96f000), + (0x3f84000f), + (0x3fa3100f), + (0x3fbc2a1f), + (0x3f9b3a1f), + (0x3f8dca1f), + (0x3faada1f), + (0x3fb5e00f), + (0x3f92f00f)}, + (0xfff80000), + {0xc1,0xeb,0x15,0xa4,0x17,0x5a,0x94,0xa3,0xdd,0x5b, + 0x7e,0x69,0x12,0x88,0xd9,0x94,0x36,0x81,0x7c,0x98,0x00} + }, + { + /* No.169 delta:1710 weight:1097 */ + 11213, + 57, + 14, + 11, + {(0x00000000), + (0x5e421ddc), + (0x638787c4), + (0x3dc59a18), + (0x8e000a9d), + (0xd0421741), + (0xed878d59), + (0xb3c59085), + (0x0000840f), + (0x5e4299d3), + (0x638703cb), + (0x3dc51e17), + (0x8e008e92), + (0xd042934e), + (0xed870956), + (0xb3c5148a)}, + {(0x00000000), + (0x4a752000), + (0xd0784000), + (0x9a0d6000), + (0x004c4000), + (0x4a396000), + (0xd0340000), + (0x9a412000), + (0x00005e00), + (0x4a757e00), + (0xd0781e00), + (0x9a0d3e00), + (0x004c1e00), + (0x4a393e00), + (0xd0345e00), + (0x9a417e00)}, + {(0x3f800000), + (0x3fa53a90), + (0x3fe83c20), + (0x3fcd06b0), + (0x3f802620), + (0x3fa51cb0), + (0x3fe81a00), + (0x3fcd2090), + (0x3f80002f), + (0x3fa53abf), + (0x3fe83c0f), + (0x3fcd069f), + (0x3f80260f), + (0x3fa51c9f), + (0x3fe81a2f), + (0x3fcd20bf)}, + (0xfff80000), + {0x63,0xf7,0x0a,0xee,0x1d,0x41,0x31,0xa9,0xfd,0x48, + 0x35,0xb8,0x86,0xd8,0xf7,0x25,0x29,0x14,0xb0,0x12,0x00} + }, + { + /* No.170 delta:4372 weight:995 */ + 11213, + 28, + 7, + 15, + {(0x00000000), + (0x655fb5a5), + (0x87997101), + (0xe2c6c4a4), + (0x59f00aaa), + (0x3cafbf0f), + (0xde697bab), + (0xbb36ce0e), + (0x0000365d), + (0x655f83f8), + (0x8799475c), + (0xe2c6f2f9), + (0x59f03cf7), + (0x3caf8952), + (0xde694df6), + (0xbb36f853)}, + {(0x00000000), + (0x81898800), + (0xd202e000), + (0x538b6800), + (0x08d64000), + (0x895fc800), + (0xdad4a000), + (0x5b5d2800), + (0x004a5e00), + (0x81c3d600), + (0xd248be00), + (0x53c13600), + (0x089c1e00), + (0x89159600), + (0xda9efe00), + (0x5b177600)}, + {(0x3f800000), + (0x3fc0c4c4), + (0x3fe90170), + (0x3fa9c5b4), + (0x3f846b20), + (0x3fc4afe4), + (0x3fed6a50), + (0x3fadae94), + (0x3f80252f), + (0x3fc0e1eb), + (0x3fe9245f), + (0x3fa9e09b), + (0x3f844e0f), + (0x3fc48acb), + (0x3fed4f7f), + (0x3fad8bbb)}, + (0xfff80000), + {0x89,0xf5,0x02,0x8f,0x88,0xdf,0x79,0x2c,0xc5,0x67, + 0x1f,0x9e,0xd5,0x1b,0xd9,0x5a,0x79,0x7f,0xca,0x71,0x00} + }, + { + /* No.171 delta:3023 weight:1549 */ + 11213, + 32, + 3, + 5, + {(0x00000000), + (0x3b134609), + (0x5b97bf87), + (0x6084f98e), + (0xdbb00aba), + (0xe0a34cb3), + (0x8027b53d), + (0xbb34f334), + (0x00000ea9), + (0x3b1348a0), + (0x5b97b12e), + (0x6084f727), + (0xdbb00413), + (0xe0a3421a), + (0x8027bb94), + (0xbb34fd9d)}, + {(0x00000000), + (0x04030000), + (0x00c10000), + (0x04c20000), + (0x304a8000), + (0x34498000), + (0x308b8000), + (0x34888000), + (0x00679e00), + (0x04649e00), + (0x00a69e00), + (0x04a59e00), + (0x302d1e00), + (0x342e1e00), + (0x30ec1e00), + (0x34ef1e00)}, + {(0x3f800000), + (0x3f820180), + (0x3f806080), + (0x3f826100), + (0x3f982540), + (0x3f9a24c0), + (0x3f9845c0), + (0x3f9a4440), + (0x3f8033cf), + (0x3f82324f), + (0x3f80534f), + (0x3f8252cf), + (0x3f98168f), + (0x3f9a170f), + (0x3f98760f), + (0x3f9a778f)}, + (0xfff80000), + {0x6a,0x8d,0xed,0xda,0x5f,0x16,0x85,0xea,0xd9,0x4c, + 0x66,0x31,0xe2,0x9c,0xc6,0x66,0x6d,0x10,0xa0,0xf9,0x00} + }, + { + /* No.172 delta:892 weight:1461 */ + 11213, + 41, + 18, + 4, + {(0x00000000), + (0x51c43b00), + (0x7d71cf7d), + (0x2cb5f47d), + (0x03f00ac3), + (0x523431c3), + (0x7e81c5be), + (0x2f45febe), + (0x0000fa3d), + (0x51c4c13d), + (0x7d713540), + (0x2cb50e40), + (0x03f0f0fe), + (0x5234cbfe), + (0x7e813f83), + (0x2f450483)}, + {(0x00000000), + (0x40672000), + (0x00508c00), + (0x4037ac00), + (0x00402000), + (0x40270000), + (0x0010ac00), + (0x40778c00), + (0x0e881e00), + (0x4eef3e00), + (0x0ed89200), + (0x4ebfb200), + (0x0ec83e00), + (0x4eaf1e00), + (0x0e98b200), + (0x4eff9200)}, + {(0x3f800000), + (0x3fa03390), + (0x3f802846), + (0x3fa01bd6), + (0x3f802010), + (0x3fa01380), + (0x3f800856), + (0x3fa03bc6), + (0x3f87440f), + (0x3fa7779f), + (0x3f876c49), + (0x3fa75fd9), + (0x3f87641f), + (0x3fa7578f), + (0x3f874c59), + (0x3fa77fc9)}, + (0xfff80000), + {0xc5,0x69,0xaf,0xb6,0xea,0x60,0x78,0x16,0x94,0x3a, + 0x36,0x01,0x5a,0xe7,0x99,0xcd,0x09,0x6a,0xda,0xea,0x00} + }, + { + /* No.173 delta:1013 weight:1115 */ + 11213, + 91, + 19, + 8, + {(0x00000000), + (0xd6aede60), + (0xdfd2815a), + (0x097c5f3a), + (0xbc400ad0), + (0x6aeed4b0), + (0x63928b8a), + (0xb53c55ea), + (0x000003b3), + (0xd6aeddd3), + (0xdfd282e9), + (0x097c5c89), + (0xbc400963), + (0x6aeed703), + (0x63928839), + (0xb53c5659)}, + {(0x00000000), + (0x24590000), + (0x08c14000), + (0x2c984000), + (0x80083800), + (0xa4513800), + (0x88c97800), + (0xac907800), + (0x50c09e00), + (0x74999e00), + (0x5801de00), + (0x7c58de00), + (0xd0c8a600), + (0xf491a600), + (0xd809e600), + (0xfc50e600)}, + {(0x3f800000), + (0x3f922c80), + (0x3f8460a0), + (0x3f964c20), + (0x3fc0041c), + (0x3fd2289c), + (0x3fc464bc), + (0x3fd6483c), + (0x3fa8604f), + (0x3fba4ccf), + (0x3fac00ef), + (0x3fbe2c6f), + (0x3fe86453), + (0x3ffa48d3), + (0x3fec04f3), + (0x3ffe2873)}, + (0xfff80000), + {0x55,0x6c,0x5c,0x20,0xdd,0xbb,0xa3,0xad,0x56,0x67, + 0x8f,0xcf,0xc9,0xb4,0xc5,0x0f,0x66,0xf7,0xb5,0xcc,0x00} + }, + { + /* No.174 delta:2582 weight:887 */ + 11213, + 40, + 4, + 1, + {(0x00000000), + (0x70c0d1b0), + (0x83972550), + (0xf357f4e0), + (0xbbc00ae0), + (0xcb00db50), + (0x38572fb0), + (0x4897fe00), + (0x0000df80), + (0x70c00e30), + (0x8397fad0), + (0xf3572b60), + (0xbbc0d560), + (0xcb0004d0), + (0x3857f030), + (0x48972180)}, + {(0x00000000), + (0x00b20200), + (0x00430000), + (0x00f10200), + (0x40024000), + (0x40b04200), + (0x40414000), + (0x40f34200), + (0x6401de00), + (0x64b3dc00), + (0x6442de00), + (0x64f0dc00), + (0x24039e00), + (0x24b19c00), + (0x24409e00), + (0x24f29c00)}, + {(0x3f800000), + (0x3f805901), + (0x3f802180), + (0x3f807881), + (0x3fa00120), + (0x3fa05821), + (0x3fa020a0), + (0x3fa079a1), + (0x3fb200ef), + (0x3fb259ee), + (0x3fb2216f), + (0x3fb2786e), + (0x3f9201cf), + (0x3f9258ce), + (0x3f92204f), + (0x3f92794e)}, + (0xfff80000), + {0x4c,0x34,0x96,0xf1,0x70,0xe5,0x52,0xb1,0x4d,0x38, + 0xa6,0x34,0x26,0x09,0x5c,0x6c,0x92,0xe6,0x3e,0xcb,0x00} + }, + { + /* No.175 delta:1962 weight:1531 */ + 11213, + 11, + 19, + 4, + {(0x00000000), + (0x91291aaa), + (0xdc02bffd), + (0x4d2ba557), + (0x1fc00af5), + (0x8ee9105f), + (0xc3c2b508), + (0x52ebafa2), + (0x0000add4), + (0x9129b77e), + (0xdc021229), + (0x4d2b0883), + (0x1fc0a721), + (0x8ee9bd8b), + (0xc3c218dc), + (0x52eb0276)}, + {(0x00000000), + (0x09ff0c00), + (0x09141600), + (0x00eb1a00), + (0x7510e000), + (0x7cefec00), + (0x7c04f600), + (0x75fbfa00), + (0x05509e00), + (0x0caf9200), + (0x0c448800), + (0x05bb8400), + (0x70407e00), + (0x79bf7200), + (0x79546800), + (0x70ab6400)}, + {(0x3f800000), + (0x3f84ff86), + (0x3f848a0b), + (0x3f80758d), + (0x3fba8870), + (0x3fbe77f6), + (0x3fbe027b), + (0x3fbafdfd), + (0x3f82a84f), + (0x3f8657c9), + (0x3f862244), + (0x3f82ddc2), + (0x3fb8203f), + (0x3fbcdfb9), + (0x3fbcaa34), + (0x3fb855b2)}, + (0xfff80000), + {0x6f,0x40,0xbd,0xae,0x48,0xc1,0x7d,0x5b,0x99,0x1a, + 0x4e,0x57,0x61,0x39,0x1e,0x68,0xb1,0xf7,0xc0,0xaa,0x00} + }, + { + /* No.176 delta:2277 weight:543 */ + 11213, + 33, + 7, + 19, + {(0x00000000), + (0x8044010b), + (0x62414b11), + (0xe2054a1a), + (0xbb700b06), + (0x3b340a0d), + (0xd9314017), + (0x5975411c), + (0x000099a5), + (0x804498ae), + (0x6241d2b4), + (0xe205d3bf), + (0xbb7092a3), + (0x3b3493a8), + (0xd931d9b2), + (0x5975d8b9)}, + {(0x00000000), + (0x0c3e0800), + (0x80be4000), + (0x8c804800), + (0x00483000), + (0x0c763800), + (0x80f67000), + (0x8cc87800), + (0x00791e00), + (0x0c471600), + (0x80c75e00), + (0x8cf95600), + (0x00312e00), + (0x0c0f2600), + (0x808f6e00), + (0x8cb16600)}, + {(0x3f800000), + (0x3f861f04), + (0x3fc05f20), + (0x3fc64024), + (0x3f802418), + (0x3f863b1c), + (0x3fc07b38), + (0x3fc6643c), + (0x3f803c8f), + (0x3f86238b), + (0x3fc063af), + (0x3fc67cab), + (0x3f801897), + (0x3f860793), + (0x3fc047b7), + (0x3fc658b3)}, + (0xfff80000), + {0xfc,0x12,0x23,0x4e,0x03,0xa3,0xf6,0xfd,0x28,0xb5, + 0xf1,0x0e,0x0a,0x5d,0xed,0x4a,0xd6,0x0c,0xfa,0x9a,0x00} + }, + { + /* No.177 delta:1331 weight:1179 */ + 11213, + 60, + 21, + 4, + {(0x00000000), + (0x8e46be68), + (0x9cb3a5d7), + (0x12f51bbf), + (0x3e600b12), + (0xb026b57a), + (0xa2d3aec5), + (0x2c9510ad), + (0x0000942c), + (0x8e462a44), + (0x9cb331fb), + (0x12f58f93), + (0x3e609f3e), + (0xb0262156), + (0xa2d33ae9), + (0x2c958481)}, + {(0x00000000), + (0x0940a800), + (0x388c9000), + (0x31cc3800), + (0x00608000), + (0x09202800), + (0x38ec1000), + (0x31acb800), + (0x005c7e00), + (0x091cd600), + (0x38d0ee00), + (0x31904600), + (0x003cfe00), + (0x097c5600), + (0x38b06e00), + (0x31f0c600)}, + {(0x3f800000), + (0x3f84a054), + (0x3f9c4648), + (0x3f98e61c), + (0x3f803040), + (0x3f849014), + (0x3f9c7608), + (0x3f98d65c), + (0x3f802e3f), + (0x3f848e6b), + (0x3f9c6877), + (0x3f98c823), + (0x3f801e7f), + (0x3f84be2b), + (0x3f9c5837), + (0x3f98f863)}, + (0xfff80000), + {0x71,0x3a,0xb0,0x71,0xe1,0x95,0x3c,0xba,0x23,0x00, + 0x7a,0xc6,0x93,0x4a,0xb7,0xb8,0xeb,0x00,0x24,0x8e,0x00} + }, + { + /* No.178 delta:3213 weight:657 */ + 11213, + 46, + 22, + 1, + {(0x00000000), + (0x53fdf1b0), + (0x32502578), + (0x61add4c8), + (0x46c00b28), + (0x153dfa98), + (0x74902e50), + (0x276ddfe0), + (0x00006d70), + (0x53fd9cc0), + (0x32504808), + (0x61adb9b8), + (0x46c06658), + (0x153d97e8), + (0x74904320), + (0x276db290)}, + {(0x00000000), + (0x44633a00), + (0x44038600), + (0x0060bc00), + (0x1819c200), + (0x5c7af800), + (0x5c1a4400), + (0x18797e00), + (0x21eade00), + (0x6589e400), + (0x65e95800), + (0x218a6200), + (0x39f31c00), + (0x7d902600), + (0x7df09a00), + (0x3993a000)}, + {(0x3f800000), + (0x3fa2319d), + (0x3fa201c3), + (0x3f80305e), + (0x3f8c0ce1), + (0x3fae3d7c), + (0x3fae0d22), + (0x3f8c3cbf), + (0x3f90f56f), + (0x3fb2c4f2), + (0x3fb2f4ac), + (0x3f90c531), + (0x3f9cf98e), + (0x3fbec813), + (0x3fbef84d), + (0x3f9cc9d0)}, + (0xfff80000), + {0x92,0xb2,0x66,0x1e,0x08,0xb8,0x0b,0x02,0x41,0xdc, + 0x45,0x04,0x59,0x65,0x0b,0x55,0x82,0x05,0xeb,0x6d,0x00} + }, + { + /* No.179 delta:4972 weight:1077 */ + 11213, + 16, + 7, + 11, + {(0x00000000), + (0xcf8962a9), + (0xb6d797a1), + (0x795ef508), + (0xfbb00b36), + (0x3439699f), + (0x4d679c97), + (0x82eefe3e), + (0x0000d59e), + (0xcf89b737), + (0xb6d7423f), + (0x795e2096), + (0xfbb0dea8), + (0x3439bc01), + (0x4d674909), + (0x82ee2ba0)}, + {(0x00000000), + (0x01000000), + (0x08000000), + (0x09000000), + (0x41800000), + (0x40800000), + (0x49800000), + (0x48800000), + (0x06801e00), + (0x07801e00), + (0x0e801e00), + (0x0f801e00), + (0x47001e00), + (0x46001e00), + (0x4f001e00), + (0x4e001e00)}, + {(0x3f800000), + (0x3f808000), + (0x3f840000), + (0x3f848000), + (0x3fa0c000), + (0x3fa04000), + (0x3fa4c000), + (0x3fa44000), + (0x3f83400f), + (0x3f83c00f), + (0x3f87400f), + (0x3f87c00f), + (0x3fa3800f), + (0x3fa3000f), + (0x3fa7800f), + (0x3fa7000f)}, + (0xfff80000), + {0x55,0xe1,0xc9,0x26,0x74,0x2c,0xed,0x5c,0x7b,0x89, + 0xe7,0x1d,0x6f,0x5d,0x02,0xe5,0x4a,0x19,0x8c,0x04,0x00} + }, + { + /* No.180 delta:2285 weight:1529 */ + 11213, + 16, + 5, + 9, + {(0x00000000), + (0x5766ef3b), + (0xaca2499c), + (0xfbc4a6a7), + (0x63800b4f), + (0x34e6e474), + (0xcf2242d3), + (0x9844ade8), + (0x0000a19a), + (0x57664ea1), + (0xaca2e806), + (0xfbc4073d), + (0x6380aad5), + (0x34e645ee), + (0xcf22e349), + (0x98440c72)}, + {(0x00000000), + (0x1901c200), + (0x88118000), + (0x91104200), + (0x02ef8000), + (0x1bee4200), + (0x8afe0000), + (0x93ffc200), + (0x3087be00), + (0x29867c00), + (0xb8963e00), + (0xa197fc00), + (0x32683e00), + (0x2b69fc00), + (0xba79be00), + (0xa3787c00)}, + {(0x3f800000), + (0x3f8c80e1), + (0x3fc408c0), + (0x3fc88821), + (0x3f8177c0), + (0x3f8df721), + (0x3fc57f00), + (0x3fc9ffe1), + (0x3f9843df), + (0x3f94c33e), + (0x3fdc4b1f), + (0x3fd0cbfe), + (0x3f99341f), + (0x3f95b4fe), + (0x3fdd3cdf), + (0x3fd1bc3e)}, + (0xfff80000), + {0x4b,0xb0,0xb5,0xae,0x6b,0x5e,0xea,0x44,0x3b,0xd2, + 0xcf,0xf3,0x8a,0x8d,0xff,0x98,0xeb,0xce,0xa2,0x22,0x00} + }, + { + /* No.181 delta:1320 weight:1461 */ + 11213, + 52, + 21, + 2, + {(0x00000000), + (0x2f3716e3), + (0x0af6f7a8), + (0x25c1e14b), + (0x67900b5a), + (0x48a71db9), + (0x6d66fcf2), + (0x4251ea11), + (0x0000adb5), + (0x2f37bb56), + (0x0af65a1d), + (0x25c14cfe), + (0x6790a6ef), + (0x48a7b00c), + (0x6d665147), + (0x425147a4)}, + {(0x00000000), + (0xc0295e00), + (0x1040c000), + (0xd0699e00), + (0x20fc7200), + (0xe0d52c00), + (0x30bcb200), + (0xf095ec00), + (0x10a2fe00), + (0xd08ba000), + (0x00e23e00), + (0xc0cb6000), + (0x305e8c00), + (0xf077d200), + (0x201e4c00), + (0xe0371200)}, + {(0x3f800000), + (0x3fe014af), + (0x3f882060), + (0x3fe834cf), + (0x3f907e39), + (0x3ff06a96), + (0x3f985e59), + (0x3ff84af6), + (0x3f88517f), + (0x3fe845d0), + (0x3f80711f), + (0x3fe065b0), + (0x3f982f46), + (0x3ff83be9), + (0x3f900f26), + (0x3ff01b89)}, + (0xfff80000), + {0xf7,0x30,0xe4,0xa1,0xb6,0x2c,0xff,0x05,0x23,0x13, + 0xd1,0x56,0xd7,0x7a,0x22,0x24,0xae,0xf7,0x34,0x52,0x00} + }, + { + /* No.182 delta:789 weight:1509 */ + 11213, + 74, + 16, + 6, + {(0x00000000), + (0xe416060b), + (0xd6bfa624), + (0x32a9a02f), + (0x56500b61), + (0xb2460d6a), + (0x80efad45), + (0x64f9ab4e), + (0x0000ce80), + (0xe416c88b), + (0xd6bf68a4), + (0x32a96eaf), + (0x5650c5e1), + (0xb246c3ea), + (0x80ef63c5), + (0x64f965ce)}, + {(0x00000000), + (0x804c0800), + (0x107ad000), + (0x9036d800), + (0x0055c400), + (0x8019cc00), + (0x102f1400), + (0x90631c00), + (0x00033e00), + (0x804f3600), + (0x1079ee00), + (0x9035e600), + (0x0056fa00), + (0x801af200), + (0x102c2a00), + (0x90602200)}, + {(0x3f800000), + (0x3fc02604), + (0x3f883d68), + (0x3fc81b6c), + (0x3f802ae2), + (0x3fc00ce6), + (0x3f88178a), + (0x3fc8318e), + (0x3f80019f), + (0x3fc0279b), + (0x3f883cf7), + (0x3fc81af3), + (0x3f802b7d), + (0x3fc00d79), + (0x3f881615), + (0x3fc83011)}, + (0xfff80000), + {0xa2,0xea,0x48,0x1e,0xb3,0x8f,0x99,0x75,0xba,0x12, + 0x9c,0xbf,0xf3,0xa0,0xb8,0x5d,0xc8,0x38,0xc4,0x74,0x00} + }, + { + /* No.183 delta:1268 weight:1109 */ + 11213, + 42, + 13, + 11, + {(0x00000000), + (0xf7ba01fd), + (0xaa8773ac), + (0x5d3d7251), + (0xa5b00b7d), + (0x520a0a80), + (0x0f3778d1), + (0xf88d792c), + (0x0000aaa0), + (0xf7baab5d), + (0xaa87d90c), + (0x5d3dd8f1), + (0xa5b0a1dd), + (0x520aa020), + (0x0f37d271), + (0xf88dd38c)}, + {(0x00000000), + (0x92abc000), + (0x00443800), + (0x92eff800), + (0x00c12000), + (0x926ae000), + (0x00851800), + (0x922ed800), + (0x02a3be00), + (0x90087e00), + (0x02e78600), + (0x904c4600), + (0x02629e00), + (0x90c95e00), + (0x0226a600), + (0x908d6600)}, + {(0x3f800000), + (0x3fc955e0), + (0x3f80221c), + (0x3fc977fc), + (0x3f806090), + (0x3fc93570), + (0x3f80428c), + (0x3fc9176c), + (0x3f8151df), + (0x3fc8043f), + (0x3f8173c3), + (0x3fc82623), + (0x3f81314f), + (0x3fc864af), + (0x3f811353), + (0x3fc846b3)}, + (0xfff80000), + {0xb0,0x87,0xce,0x22,0xcb,0xa4,0x10,0xdc,0xdb,0x3e, + 0x3c,0x67,0xae,0x3f,0xc0,0x11,0xf3,0xec,0xe2,0x06,0x00} + }, + { + /* No.184 delta:1092 weight:1295 */ + 11213, + 91, + 17, + 8, + {(0x00000000), + (0x2fa2608e), + (0x8f680761), + (0xa0ca67ef), + (0x13a00b8a), + (0x3c026b04), + (0x9cc80ceb), + (0xb36a6c65), + (0x00007f70), + (0x2fa21ffe), + (0x8f687811), + (0xa0ca189f), + (0x13a074fa), + (0x3c021474), + (0x9cc8739b), + (0xb36a1315)}, + {(0x00000000), + (0x089d6000), + (0x1a00e200), + (0x129d8200), + (0x40df4000), + (0x48422000), + (0x5adfa200), + (0x5242c200), + (0x01a6de00), + (0x093bbe00), + (0x1ba63c00), + (0x133b5c00), + (0x41799e00), + (0x49e4fe00), + (0x5b797c00), + (0x53e41c00)}, + {(0x3f800000), + (0x3f844eb0), + (0x3f8d0071), + (0x3f894ec1), + (0x3fa06fa0), + (0x3fa42110), + (0x3fad6fd1), + (0x3fa92161), + (0x3f80d36f), + (0x3f849ddf), + (0x3f8dd31e), + (0x3f899dae), + (0x3fa0bccf), + (0x3fa4f27f), + (0x3fadbcbe), + (0x3fa9f20e)}, + (0xfff80000), + {0xbd,0xb1,0x02,0x3f,0x46,0x65,0xe7,0x62,0xbf,0x9e, + 0x12,0xaa,0x33,0xbe,0x0c,0x5d,0x89,0x02,0x2c,0x11,0x00} + }, + { + /* No.185 delta:8146 weight:1071 */ + 11213, + 66, + 28, + 1, + {(0x00000000), + (0xc3e3a60c), + (0x80c000cd), + (0x4323a6c1), + (0xda800b97), + (0x1963ad9b), + (0x5a400b5a), + (0x99a3ad56), + (0x000058ad), + (0xc3e3fea1), + (0x80c05860), + (0x4323fe6c), + (0xda80533a), + (0x1963f536), + (0x5a4053f7), + (0x99a3f5fb)}, + {(0x00000000), + (0x89d10a00), + (0x403c0200), + (0xc9ed0800), + (0x53520000), + (0xda830a00), + (0x136e0200), + (0x9abf0800), + (0x61609e00), + (0xe8b19400), + (0x215c9c00), + (0xa88d9600), + (0x32329e00), + (0xbbe39400), + (0x720e9c00), + (0xfbdf9600)}, + {(0x3f800000), + (0x3fc4e885), + (0x3fa01e01), + (0x3fe4f684), + (0x3fa9a900), + (0x3fed4185), + (0x3f89b701), + (0x3fcd5f84), + (0x3fb0b04f), + (0x3ff458ca), + (0x3f90ae4e), + (0x3fd446cb), + (0x3f99194f), + (0x3fddf1ca), + (0x3fb9074e), + (0x3ffdefcb)}, + (0xfff80000), + {0xf7,0x3c,0x9c,0x40,0x28,0xb5,0xbe,0xbf,0x2e,0x97, + 0xa1,0x61,0x3b,0x82,0x2a,0x82,0x3c,0xa0,0xf4,0x90,0x00} + }, + { + /* No.186 delta:2697 weight:1957 */ + 11213, + 43, + 3, + 3, + {(0x00000000), + (0x7a0a48fc), + (0x29a53edd), + (0x53af7621), + (0x08f00ba0), + (0x72fa435c), + (0x2155357d), + (0x5b5f7d81), + (0x0000132f), + (0x7a0a5bd3), + (0x29a52df2), + (0x53af650e), + (0x08f0188f), + (0x72fa5073), + (0x21552652), + (0x5b5f6eae)}, + {(0x00000000), + (0xa2021000), + (0x1c21a000), + (0xbe23b000), + (0x00408000), + (0xa2429000), + (0x1c612000), + (0xbe633000), + (0x40201e00), + (0xe2220e00), + (0x5c01be00), + (0xfe03ae00), + (0x40609e00), + (0xe2628e00), + (0x5c413e00), + (0xfe432e00)}, + {(0x3f800000), + (0x3fd10108), + (0x3f8e10d0), + (0x3fdf11d8), + (0x3f802040), + (0x3fd12148), + (0x3f8e3090), + (0x3fdf3198), + (0x3fa0100f), + (0x3ff11107), + (0x3fae00df), + (0x3fff01d7), + (0x3fa0304f), + (0x3ff13147), + (0x3fae209f), + (0x3fff2197)}, + (0xfff80000), + {0x1a,0x79,0x8f,0xb2,0xec,0xc2,0xee,0xfc,0x66,0xa6, + 0x37,0x12,0x4d,0x78,0x6e,0xa1,0xb0,0x60,0x86,0x37,0x00} + }, + { + /* No.187 delta:2420 weight:1355 */ + 11213, + 28, + 24, + 3, + {(0x00000000), + (0x9580742c), + (0xce45a063), + (0x5bc5d44f), + (0x33f00bbf), + (0xa6707f93), + (0xfdb5abdc), + (0x6835dff0), + (0x000009ba), + (0x95807d96), + (0xce45a9d9), + (0x5bc5ddf5), + (0x33f00205), + (0xa6707629), + (0xfdb5a266), + (0x6835d64a)}, + {(0x00000000), + (0x40bf0200), + (0x00440200), + (0x40fb0000), + (0x3411d000), + (0x74aed200), + (0x3455d200), + (0x74ead000), + (0x9082de00), + (0xd03ddc00), + (0x90c6dc00), + (0xd079de00), + (0xa4930e00), + (0xe42c0c00), + (0xa4d70c00), + (0xe4680e00)}, + {(0x3f800000), + (0x3fa05f81), + (0x3f802201), + (0x3fa07d80), + (0x3f9a08e8), + (0x3fba5769), + (0x3f9a2ae9), + (0x3fba7568), + (0x3fc8416f), + (0x3fe81eee), + (0x3fc8636e), + (0x3fe83cef), + (0x3fd24987), + (0x3ff21606), + (0x3fd26b86), + (0x3ff23407)}, + (0xfff80000), + {0x20,0xe4,0x7d,0x6c,0xc4,0xf9,0x2b,0x4a,0x56,0x18, + 0x64,0xa0,0x86,0x2c,0x45,0x4a,0x42,0x3a,0x22,0x49,0x00} + }, + { + /* No.188 delta:1841 weight:735 */ + 11213, + 62, + 10, + 18, + {(0x00000000), + (0x179a1ef2), + (0x535f148e), + (0x44c50a7c), + (0x33700bc3), + (0x24ea1531), + (0x602f1f4d), + (0x77b501bf), + (0x0000df3e), + (0x179ac1cc), + (0x535fcbb0), + (0x44c5d542), + (0x3370d4fd), + (0x24eaca0f), + (0x602fc073), + (0x77b5de81)}, + {(0x00000000), + (0x30b90000), + (0x083c0000), + (0x38850000), + (0x40070000), + (0x70be0000), + (0x483b0000), + (0x78820000), + (0x10651e00), + (0x20dc1e00), + (0x18591e00), + (0x28e01e00), + (0x50621e00), + (0x60db1e00), + (0x585e1e00), + (0x68e71e00)}, + {(0x3f800000), + (0x3f985c80), + (0x3f841e00), + (0x3f9c4280), + (0x3fa00380), + (0x3fb85f00), + (0x3fa41d80), + (0x3fbc4100), + (0x3f88328f), + (0x3f906e0f), + (0x3f8c2c8f), + (0x3f94700f), + (0x3fa8310f), + (0x3fb06d8f), + (0x3fac2f0f), + (0x3fb4738f)}, + (0xfff80000), + {0x09,0x19,0x78,0xe9,0x81,0xea,0xdf,0x95,0x46,0x6b, + 0x4f,0xa1,0xca,0x2b,0xbc,0x8a,0x0b,0xaa,0x44,0xb8,0x00} + }, + { + /* No.189 delta:3318 weight:1469 */ + 11213, + 81, + 3, + 7, + {(0x00000000), + (0xfe728280), + (0xcc048331), + (0x327601b1), + (0x42200bd8), + (0xbc528958), + (0x8e2488e9), + (0x70560a69), + (0x0000d1a0), + (0xfe725320), + (0xcc045291), + (0x3276d011), + (0x4220da78), + (0xbc5258f8), + (0x8e245949), + (0x7056dbc9)}, + {(0x00000000), + (0x12010000), + (0x53002000), + (0x41012000), + (0x20414000), + (0x32404000), + (0x73416000), + (0x61406000), + (0x20321e00), + (0x32331e00), + (0x73323e00), + (0x61333e00), + (0x00735e00), + (0x12725e00), + (0x53737e00), + (0x41727e00)}, + {(0x3f800000), + (0x3f890080), + (0x3fa98010), + (0x3fa08090), + (0x3f9020a0), + (0x3f992020), + (0x3fb9a0b0), + (0x3fb0a030), + (0x3f90190f), + (0x3f99198f), + (0x3fb9991f), + (0x3fb0999f), + (0x3f8039af), + (0x3f89392f), + (0x3fa9b9bf), + (0x3fa0b93f)}, + (0xfff80000), + {0x0f,0xe8,0x93,0xf4,0x0e,0x7e,0xaf,0xe0,0x5d,0x20, + 0x58,0x92,0x06,0x7d,0x5b,0x05,0x6b,0x8a,0x33,0xbb,0x00} + }, + { + /* No.190 delta:1194 weight:821 */ + 11213, + 72, + 11, + 16, + {(0x00000000), + (0x44a385c2), + (0xca99870f), + (0x8e3a02cd), + (0x06c00be8), + (0x42638e2a), + (0xcc598ce7), + (0x88fa0925), + (0x00007bbf), + (0x44a3fe7d), + (0xca99fcb0), + (0x8e3a7972), + (0x06c07057), + (0x4263f595), + (0xcc59f758), + (0x88fa729a)}, + {(0x00000000), + (0x00527800), + (0x302f0400), + (0x307d7c00), + (0x20017000), + (0x20530800), + (0x102e7400), + (0x107c0c00), + (0x10429e00), + (0x1010e600), + (0x206d9a00), + (0x203fe200), + (0x3043ee00), + (0x30119600), + (0x006cea00), + (0x003e9200)}, + {(0x3f800000), + (0x3f80293c), + (0x3f981782), + (0x3f983ebe), + (0x3f9000b8), + (0x3f902984), + (0x3f88173a), + (0x3f883e06), + (0x3f88214f), + (0x3f880873), + (0x3f9036cd), + (0x3f901ff1), + (0x3f9821f7), + (0x3f9808cb), + (0x3f803675), + (0x3f801f49)}, + (0xfff80000), + {0xba,0xb7,0xd5,0xc8,0xec,0x6d,0xc1,0x0c,0x19,0x38, + 0x0f,0x27,0x93,0x3b,0xd8,0x74,0xa1,0x4e,0x45,0x89,0x00} + }, + { + /* No.191 delta:1166 weight:1045 */ + 11213, + 40, + 11, + 9, + {(0x00000000), + (0x212f4af4), + (0xf0432caf), + (0xd16c665b), + (0x11d00bf5), + (0x30ff4101), + (0xe193275a), + (0xc0bc6dae), + (0x0000755f), + (0x212f3fab), + (0xf04359f0), + (0xd16c1304), + (0x11d07eaa), + (0x30ff345e), + (0xe1935205), + (0xc0bc18f1)}, + {(0x00000000), + (0x08528000), + (0x70084000), + (0x785ac000), + (0x00196000), + (0x084be000), + (0x70112000), + (0x7843a000), + (0x0024fe00), + (0x08767e00), + (0x702cbe00), + (0x787e3e00), + (0x003d9e00), + (0x086f1e00), + (0x7035de00), + (0x78675e00)}, + {(0x3f800000), + (0x3f842940), + (0x3fb80420), + (0x3fbc2d60), + (0x3f800cb0), + (0x3f8425f0), + (0x3fb80890), + (0x3fbc21d0), + (0x3f80127f), + (0x3f843b3f), + (0x3fb8165f), + (0x3fbc3f1f), + (0x3f801ecf), + (0x3f84378f), + (0x3fb81aef), + (0x3fbc33af)}, + (0xfff80000), + {0xbf,0xbb,0x3f,0x17,0x6e,0x1a,0x3b,0x45,0x9b,0x2a, + 0x22,0x6a,0xf9,0xf5,0xba,0x97,0x3b,0x8a,0xec,0xd6,0x00} + }, + { + /* No.192 delta:4742 weight:1471 */ + 11213, + 27, + 4, + 6, + {(0x00000000), + (0x7fe173b6), + (0x51169f27), + (0x2ef7ec91), + (0x0a300c00), + (0x75d17fb6), + (0x5b269327), + (0x24c7e091), + (0x00001d00), + (0x7fe16eb6), + (0x51168227), + (0x2ef7f191), + (0x0a301100), + (0x75d162b6), + (0x5b268e27), + (0x24c7fd91)}, + {(0x00000000), + (0x41420000), + (0x00010000), + (0x41430000), + (0x29040000), + (0x68460000), + (0x29050000), + (0x68470000), + (0x00009e00), + (0x41429e00), + (0x00019e00), + (0x41439e00), + (0x29049e00), + (0x68469e00), + (0x29059e00), + (0x68479e00)}, + {(0x3f800000), + (0x3fa0a100), + (0x3f800080), + (0x3fa0a180), + (0x3f948200), + (0x3fb42300), + (0x3f948280), + (0x3fb42380), + (0x3f80004f), + (0x3fa0a14f), + (0x3f8000cf), + (0x3fa0a1cf), + (0x3f94824f), + (0x3fb4234f), + (0x3f9482cf), + (0x3fb423cf)}, + (0xfff80000), + {0xb4,0x7f,0x09,0x23,0xa8,0x3f,0x5e,0x9d,0x3e,0x97, + 0x19,0x94,0x35,0x0d,0xdb,0x3e,0xb7,0x43,0x15,0xd0,0x00} + }, + { + /* No.193 delta:3962 weight:1171 */ + 11213, + 92, + 2, + 13, + {(0x00000000), + (0x76b1ced9), + (0x928504d8), + (0xe434ca01), + (0x7b300c1a), + (0x0d81c2c3), + (0xe9b508c2), + (0x9f04c61b), + (0x0000b2d9), + (0x76b17c00), + (0x9285b601), + (0xe43478d8), + (0x7b30bec3), + (0x0d81701a), + (0xe9b5ba1b), + (0x9f0474c2)}, + {(0x00000000), + (0x08400000), + (0x06400000), + (0x0e000000), + (0x01200000), + (0x09600000), + (0x07600000), + (0x0f200000), + (0x04c01e00), + (0x0c801e00), + (0x02801e00), + (0x0ac01e00), + (0x05e01e00), + (0x0da01e00), + (0x03a01e00), + (0x0be01e00)}, + {(0x3f800000), + (0x3f842000), + (0x3f832000), + (0x3f870000), + (0x3f809000), + (0x3f84b000), + (0x3f83b000), + (0x3f879000), + (0x3f82600f), + (0x3f86400f), + (0x3f81400f), + (0x3f85600f), + (0x3f82f00f), + (0x3f86d00f), + (0x3f81d00f), + (0x3f85f00f)}, + (0xfff80000), + {0xdf,0x8e,0xab,0x00,0xdb,0xdc,0xe0,0x7a,0xb0,0x4c, + 0x05,0x23,0x25,0x58,0x15,0xac,0x74,0x97,0x22,0x21,0x00} + }, + { + /* No.194 delta:2215 weight:1499 */ + 11213, + 63, + 26, + 4, + {(0x00000000), + (0xad5d413b), + (0x166ef61d), + (0xbb33b726), + (0x9e000c20), + (0x335d4d1b), + (0x886efa3d), + (0x2533bb06), + (0x000077be), + (0xad5d3685), + (0x166e81a3), + (0xbb33c098), + (0x9e007b9e), + (0x335d3aa5), + (0x886e8d83), + (0x2533ccb8)}, + {(0x00000000), + (0x10720800), + (0x60810000), + (0x70f30800), + (0x300c0000), + (0x207e0800), + (0x508d0000), + (0x40ff0800), + (0x20023e00), + (0x30703600), + (0x40833e00), + (0x50f13600), + (0x100e3e00), + (0x007c3600), + (0x708f3e00), + (0x60fd3600)}, + {(0x3f800000), + (0x3f883904), + (0x3fb04080), + (0x3fb87984), + (0x3f980600), + (0x3f903f04), + (0x3fa84680), + (0x3fa07f84), + (0x3f90011f), + (0x3f98381b), + (0x3fa0419f), + (0x3fa8789b), + (0x3f88071f), + (0x3f803e1b), + (0x3fb8479f), + (0x3fb07e9b)}, + (0xfff80000), + {0x31,0xb8,0x64,0x9a,0xae,0xad,0xc8,0xf8,0x53,0x9b, + 0x64,0x2d,0x8c,0xb0,0xd2,0xa7,0x8e,0x2e,0xb2,0xc8,0x00} + }, + { + /* No.195 delta:1215 weight:463 */ + 11213, + 60, + 13, + 19, + {(0x00000000), + (0x60520e47), + (0xae8c1b90), + (0xcede15d7), + (0xc1c00c35), + (0xa1920272), + (0x6f4c17a5), + (0x0f1e19e2), + (0x0000fd60), + (0x6052f327), + (0xae8ce6f0), + (0xcedee8b7), + (0xc1c0f155), + (0xa192ff12), + (0x6f4ceac5), + (0x0f1ee482)}, + {(0x00000000), + (0x02e00000), + (0x10cd1200), + (0x122d1200), + (0x14101800), + (0x16f01800), + (0x04dd0a00), + (0x063d0a00), + (0x0057be00), + (0x02b7be00), + (0x109aac00), + (0x127aac00), + (0x1447a600), + (0x16a7a600), + (0x048ab400), + (0x066ab400)}, + {(0x3f800000), + (0x3f817000), + (0x3f886689), + (0x3f891689), + (0x3f8a080c), + (0x3f8b780c), + (0x3f826e85), + (0x3f831e85), + (0x3f802bdf), + (0x3f815bdf), + (0x3f884d56), + (0x3f893d56), + (0x3f8a23d3), + (0x3f8b53d3), + (0x3f82455a), + (0x3f83355a)}, + (0xfff80000), + {0x67,0xca,0xf4,0x9a,0x13,0x78,0x64,0xbc,0x60,0x6d, + 0x5b,0x5f,0x48,0x61,0x94,0x6f,0xdf,0x81,0x2c,0xe1,0x00} + }, + { + /* No.196 delta:939 weight:857 */ + 11213, + 51, + 11, + 2, + {(0x00000000), + (0xa61e8990), + (0x67d50999), + (0xc1cb8009), + (0xa3f00c49), + (0x05ee85d9), + (0xc42505d0), + (0x623b8c40), + (0x00000381), + (0xa61e8a11), + (0x67d50a18), + (0xc1cb8388), + (0xa3f00fc8), + (0x05ee8658), + (0xc4250651), + (0x623b8fc1)}, + {(0x00000000), + (0x08105000), + (0x0002b000), + (0x0812e000), + (0x90084c00), + (0x98181c00), + (0x900afc00), + (0x981aac00), + (0x01007e00), + (0x09102e00), + (0x0102ce00), + (0x09129e00), + (0x91083200), + (0x99186200), + (0x910a8200), + (0x991ad200)}, + {(0x3f800000), + (0x3f840828), + (0x3f800158), + (0x3f840970), + (0x3fc80426), + (0x3fcc0c0e), + (0x3fc8057e), + (0x3fcc0d56), + (0x3f80803f), + (0x3f848817), + (0x3f808167), + (0x3f84894f), + (0x3fc88419), + (0x3fcc8c31), + (0x3fc88541), + (0x3fcc8d69)}, + (0xfff80000), + {0x2c,0x79,0x20,0x40,0xe3,0x10,0xb7,0x11,0xcb,0xf4, + 0xba,0x4e,0xee,0x8b,0x5f,0x86,0xa9,0xdb,0x06,0x27,0x00} + }, + { + /* No.197 delta:1583 weight:1233 */ + 11213, + 26, + 20, + 8, + {(0x00000000), + (0x33fe7f24), + (0x88809fc9), + (0xbb7ee0ed), + (0x68600c55), + (0x5b9e7371), + (0xe0e0939c), + (0xd31eecb8), + (0x0000a12e), + (0x33fede0a), + (0x88803ee7), + (0xbb7e41c3), + (0x6860ad7b), + (0x5b9ed25f), + (0xe0e032b2), + (0xd31e4d96)}, + {(0x00000000), + (0x08750800), + (0x82099800), + (0x8a7c9000), + (0x40e2b000), + (0x4897b800), + (0xc2eb2800), + (0xca9e2000), + (0x004a5e00), + (0x083f5600), + (0x8243c600), + (0x8a36ce00), + (0x40a8ee00), + (0x48dde600), + (0xc2a17600), + (0xcad47e00)}, + {(0x3f800000), + (0x3f843a84), + (0x3fc104cc), + (0x3fc53e48), + (0x3fa07158), + (0x3fa44bdc), + (0x3fe17594), + (0x3fe54f10), + (0x3f80252f), + (0x3f841fab), + (0x3fc121e3), + (0x3fc51b67), + (0x3fa05477), + (0x3fa46ef3), + (0x3fe150bb), + (0x3fe56a3f)}, + (0xfff80000), + {0xb0,0x71,0x91,0x64,0xda,0x74,0xb8,0xc6,0x16,0x8c, + 0x5a,0x7e,0x26,0xea,0x75,0x3a,0x0b,0xa4,0xd9,0x97,0x00} + }, + { + /* No.198 delta:1565 weight:813 */ + 11213, + 89, + 7, + 10, + {(0x00000000), + (0x98a83f1e), + (0xcb779281), + (0x53dfad9f), + (0x20400c6a), + (0xb8e83374), + (0xeb379eeb), + (0x739fa1f5), + (0x000092fc), + (0x98a8ade2), + (0xcb77007d), + (0x53df3f63), + (0x20409e96), + (0xb8e8a188), + (0xeb370c17), + (0x739f3309)}, + {(0x00000000), + (0x467a0c00), + (0x04059800), + (0x427f9400), + (0x01093800), + (0x47733400), + (0x050ca000), + (0x4376ac00), + (0xc0e0fe00), + (0x869af200), + (0xc4e56600), + (0x829f6a00), + (0xc1e9c600), + (0x8793ca00), + (0xc5ec5e00), + (0x83965200)}, + {(0x3f800000), + (0x3fa33d06), + (0x3f8202cc), + (0x3fa13fca), + (0x3f80849c), + (0x3fa3b99a), + (0x3f828650), + (0x3fa1bb56), + (0x3fe0707f), + (0x3fc34d79), + (0x3fe272b3), + (0x3fc14fb5), + (0x3fe0f4e3), + (0x3fc3c9e5), + (0x3fe2f62f), + (0x3fc1cb29)}, + (0xfff80000), + {0x32,0x19,0xd6,0x71,0xe2,0x9d,0xf7,0x99,0x34,0xa0, + 0x5f,0x9a,0xcd,0x9f,0x42,0x5a,0x43,0x47,0xee,0xb2,0x00} + }, + { + /* No.199 delta:3921 weight:921 */ + 11213, + 49, + 3, + 15, + {(0x00000000), + (0xbb75ffa8), + (0xa0b33e2a), + (0x1bc6c182), + (0x9a200c78), + (0x2155f3d0), + (0x3a933252), + (0x81e6cdfa), + (0x000015a3), + (0xbb75ea0b), + (0xa0b32b89), + (0x1bc6d421), + (0x9a2019db), + (0x2155e673), + (0x3a9327f1), + (0x81e6d859)}, + {(0x00000000), + (0x45540800), + (0x07840400), + (0x42d00c00), + (0x08200000), + (0x4d740800), + (0x0fa40400), + (0x4af00c00), + (0x02201e00), + (0x47741600), + (0x05a41a00), + (0x40f01200), + (0x0a001e00), + (0x4f541600), + (0x0d841a00), + (0x48d01200)}, + {(0x3f800000), + (0x3fa2aa04), + (0x3f83c202), + (0x3fa16806), + (0x3f841000), + (0x3fa6ba04), + (0x3f87d202), + (0x3fa57806), + (0x3f81100f), + (0x3fa3ba0b), + (0x3f82d20d), + (0x3fa07809), + (0x3f85000f), + (0x3fa7aa0b), + (0x3f86c20d), + (0x3fa46809)}, + (0xfff80000), + {0x86,0x1e,0x5b,0xa8,0x8e,0x65,0x6f,0xc0,0xbc,0x92, + 0x81,0x1c,0x6d,0xbd,0x0f,0xd4,0x7e,0x57,0x5f,0x75,0x00} + } +}; + +#endif + + diff --git a/cuda_toolkit/include/curand_normal.h b/cuda_toolkit/include/curand_normal.h new file mode 100644 index 0000000000000000000000000000000000000000..3921fd57f700ebac16e4efb6672c2cdfd5ee11bd --- /dev/null +++ b/cuda_toolkit/include/curand_normal.h @@ -0,0 +1,840 @@ + + /* Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + + +#if !defined(CURAND_NORMAL_H_) +#define CURAND_NORMAL_H_ + +/** + * \defgroup DEVICE Device API + * + * @{ + */ + +#ifndef __CUDACC_RTC__ +#include +#endif // __CUDACC_RTC__ +#include + +#include "curand_mrg32k3a.h" +#include "curand_mtgp32_kernel.h" +#include "curand_philox4x32_x.h" +#include "curand_normal_static.h" + +QUALIFIERS float2 _curand_box_muller(unsigned int x, unsigned int y) +{ + float2 result; + float u = x * CURAND_2POW32_INV + (CURAND_2POW32_INV/2); + float v = y * CURAND_2POW32_INV_2PI + (CURAND_2POW32_INV_2PI/2); + float s; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + s = sqrtf(-2.0f * logf(u)); + __sincosf(v, &result.x, &result.y); +, + s = sqrtf(-2.0f * logf(u)); + result.x = sinf(v); + result.y = cosf(v); +) + result.x *= s; + result.y *= s; + return result; +} + +QUALIFIERS float2 curand_box_muller_mrg(curandStateMRG32k3a_t * state) +{ + float x, y; + x = curand_uniform(state); + y = curand_uniform(state) * CURAND_2PI; + float2 result; + float s; +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + s = sqrtf(-2.0f * logf(x)); + __sincosf(y, &result.x, &result.y); +, + s = sqrtf(-2.0f * logf(x)); + result.x = sinf(y); + result.y = cosf(y); +) + result.x *= s; + result.y *= s; + return result; +} + +QUALIFIERS double2 +_curand_box_muller_double(unsigned int x0, unsigned int x1, + unsigned int y0, unsigned int y1) +{ + double2 result; + unsigned long long zx = (unsigned long long)x0 ^ + ((unsigned long long)x1 << (53 - 32)); + double u = zx * CURAND_2POW53_INV_DOUBLE + (CURAND_2POW53_INV_DOUBLE/2.0); + unsigned long long zy = (unsigned long long)y0 ^ + ((unsigned long long)y1 << (53 - 32)); + double v = zy * (CURAND_2POW53_INV_DOUBLE*2.0) + CURAND_2POW53_INV_DOUBLE; + double s = sqrt(-2.0 * log(u)); + +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + sincospi(v, &result.x, &result.y); +, + result.x = sin(v*CURAND_PI_DOUBLE); + result.y = cos(v*CURAND_PI_DOUBLE); +) + result.x *= s; + result.y *= s; + + return result; +} + +QUALIFIERS double2 +curand_box_muller_mrg_double(curandStateMRG32k3a_t * state) +{ + double x, y; + double2 result; + x = curand_uniform_double(state); + y = curand_uniform_double(state) * 2.0; + + double s = sqrt(-2.0 * log(x)); +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + sincospi(y, &result.x, &result.y); +, + result.x = sin(y*CURAND_PI_DOUBLE); + result.y = cos(y*CURAND_PI_DOUBLE); +) + result.x *= s; + result.y *= s; + return result; +} + +template +QUALIFIERS float2 curand_box_muller(R *state) +{ + float2 result; + unsigned int x = curand(state); + unsigned int y = curand(state); + result = _curand_box_muller(x, y); + return result; +} + +template +QUALIFIERS float4 curand_box_muller4(R *state) +{ + float4 result; + float2 _result; + uint4 x = curand4(state); + //unsigned int y = curand(state); + _result = _curand_box_muller(x.x, x.y); + result.x = _result.x; + result.y = _result.y; + _result = _curand_box_muller(x.z, x.w); + result.z = _result.x; + result.w = _result.y; + return result; +} + +template +QUALIFIERS double2 curand_box_muller_double(R *state) +{ + double2 result; + unsigned int x0 = curand(state); + unsigned int x1 = curand(state); + unsigned int y0 = curand(state); + unsigned int y1 = curand(state); + result = _curand_box_muller_double(x0, x1, y0, y1); + return result; +} + +template +QUALIFIERS double2 curand_box_muller2_double(R *state) +{ + double2 result; + uint4 _x; + _x = curand4(state); + result = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w); + return result; +} + + +template +QUALIFIERS double4 curand_box_muller4_double(R *state) +{ + double4 result; + double2 _res1; + double2 _res2; + uint4 _x; + uint4 _y; + _x = curand4(state); + _y = curand4(state); + _res1 = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w); + _res2 = _curand_box_muller_double(_y.x, _y.y, _y.z, _y.w); + result.x = _res1.x; + result.y = _res1.y; + result.z = _res2.x; + result.w = _res2.y; + return result; +} + +//QUALIFIERS float _curand_normal_icdf(unsigned int x) +//{ +//#if __CUDA_ARCH__ > 0 || defined(HOST_HAVE_ERFCINVF) +// float s = CURAND_SQRT2; +// // Mirror to avoid loss of precision +// if(x > 0x80000000UL) { +// x = 0xffffffffUL - x; +// s = -s; +// } +// float p = x * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f); +// // p is in (0, 0.5], 2p is in (0, 1] +// return s * erfcinvf(2.0f * p); +//#else +// x++; //suppress warnings +// return 0.0f; +//#endif +//} +// +//QUALIFIERS float _curand_normal_icdf(unsigned long long x) +//{ +//#if __CUDA_ARCH__ > 0 || defined(HOST_HAVE_ERFCINVF) +// unsigned int t = (unsigned int)(x >> 32); +// float s = CURAND_SQRT2; +// // Mirror to avoid loss of precision +// if(t > 0x80000000UL) { +// t = 0xffffffffUL - t; +// s = -s; +// } +// float p = t * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f); +// // p is in (0, 0.5], 2p is in (0, 1] +// return s * erfcinvf(2.0f * p); +//#else +// x++; +// return 0.0f; +//#endif +//} +// +//QUALIFIERS double _curand_normal_icdf_double(unsigned int x) +//{ +//#if __CUDA_ARCH__ > 0 || defined(HOST_HAVE_ERFCINVF) +// double s = CURAND_SQRT2_DOUBLE; +// // Mirror to avoid loss of precision +// if(x > 0x80000000UL) { +// x = 0xffffffffUL - x; +// s = -s; +// } +// double p = x * CURAND_2POW32_INV_DOUBLE + (CURAND_2POW32_INV_DOUBLE/2.0); +// // p is in (0, 0.5], 2p is in (0, 1] +// return s * erfcinv(2.0 * p); +//#else +// x++; +// return 0.0; +//#endif +//} +// +//QUALIFIERS double _curand_normal_icdf_double(unsigned long long x) +//{ +//#if __CUDA_ARCH__ > 0 || defined(HOST_HAVE_ERFCINVF) +// double s = CURAND_SQRT2_DOUBLE; +// x >>= 11; +// // Mirror to avoid loss of precision +// if(x > 0x10000000000000UL) { +// x = 0x1fffffffffffffUL - x; +// s = -s; +// } +// double p = x * CURAND_2POW53_INV_DOUBLE + (CURAND_2POW53_INV_DOUBLE/2.0); +// // p is in (0, 0.5], 2p is in (0, 1] +// return s * erfcinv(2.0 * p); +//#else +// x++; +// return 0.0; +//#endif +//} +// + +/** + * \brief Return a normally distributed float from an XORWOW generator. + * + * Return a single normally distributed float with mean \p 0.0f and + * standard deviation \p 1.0f from the XORWOW generator in \p state, + * increment position of generator by one. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, then returns them one at a time. + * See ::curand_normal2() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float curand_normal(curandStateXORWOW_t *state) +{ + if(state->boxmuller_flag != EXTRA_FLAG_NORMAL) { + unsigned int x, y; + x = curand(state); + y = curand(state); + float2 v = _curand_box_muller(x, y); + state->boxmuller_extra = v.y; + state->boxmuller_flag = EXTRA_FLAG_NORMAL; + return v.x; + } + state->boxmuller_flag = 0; + return state->boxmuller_extra; +} + +/** + * \brief Return a normally distributed float from an Philox4_32_10 generator. + * + * Return a single normally distributed float with mean \p 0.0f and + * standard deviation \p 1.0f from the Philox4_32_10 generator in \p state, + * increment position of generator by one. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, then returns them one at a time. + * See ::curand_normal2() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f + */ + +QUALIFIERS float curand_normal(curandStatePhilox4_32_10_t *state) +{ + if(state->boxmuller_flag != EXTRA_FLAG_NORMAL) { + unsigned int x, y; + x = curand(state); + y = curand(state); + float2 v = _curand_box_muller(x, y); + state->boxmuller_extra = v.y; + state->boxmuller_flag = EXTRA_FLAG_NORMAL; + return v.x; + } + state->boxmuller_flag = 0; + return state->boxmuller_extra; +} + + + +/** + * \brief Return a normally distributed float from an MRG32k3a generator. + * + * Return a single normally distributed float with mean \p 0.0f and + * standard deviation \p 1.0f from the MRG32k3a generator in \p state, + * increment position of generator by one. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, then returns them one at a time. + * See ::curand_normal2() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float curand_normal(curandStateMRG32k3a_t *state) +{ + if(state->boxmuller_flag != EXTRA_FLAG_NORMAL) { + float2 v = curand_box_muller_mrg(state); + state->boxmuller_extra = v.y; + state->boxmuller_flag = EXTRA_FLAG_NORMAL; + return v.x; + } + state->boxmuller_flag = 0; + return state->boxmuller_extra; +} + +/** + * \brief Return two normally distributed floats from an XORWOW generator. + * + * Return two normally distributed floats with mean \p 0.0f and + * standard deviation \p 1.0f from the XORWOW generator in \p state, + * increment position of generator by two. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float2 where each element is from a + * distribution with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float2 curand_normal2(curandStateXORWOW_t *state) +{ + return curand_box_muller(state); +} +/** + * \brief Return two normally distributed floats from an Philox4_32_10 generator. + * + * Return two normally distributed floats with mean \p 0.0f and + * standard deviation \p 1.0f from the Philox4_32_10 generator in \p state, + * increment position of generator by two. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float2 where each element is from a + * distribution with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float2 curand_normal2(curandStatePhilox4_32_10_t *state) +{ + return curand_box_muller(state); +} + +/** + * \brief Return four normally distributed floats from an Philox4_32_10 generator. + * + * Return four normally distributed floats with mean \p 0.0f and + * standard deviation \p 1.0f from the Philox4_32_10 generator in \p state, + * increment position of generator by four. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float2 where each element is from a + * distribution with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float4 curand_normal4(curandStatePhilox4_32_10_t *state) +{ + return curand_box_muller4(state); +} + + + +/** + * \brief Return two normally distributed floats from an MRG32k3a generator. + * + * Return two normally distributed floats with mean \p 0.0f and + * standard deviation \p 1.0f from the MRG32k3a generator in \p state, + * increment position of generator by two. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float2 where each element is from a + * distribution with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float2 curand_normal2(curandStateMRG32k3a_t *state) +{ + return curand_box_muller_mrg(state); +} + +/** + * \brief Return a normally distributed float from a MTGP32 generator. + * + * Return a single normally distributed float with mean \p 0.0f and + * standard deviation \p 1.0f from the MTGP32 generator in \p state, + * increment position of generator. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float curand_normal(curandStateMtgp32_t *state) +{ + return _curand_normal_icdf(curand(state)); +} +/** + * \brief Return a normally distributed float from a Sobol32 generator. + * + * Return a single normally distributed float with mean \p 0.0f and + * standard deviation \p 1.0f from the Sobol32 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float curand_normal(curandStateSobol32_t *state) +{ + return _curand_normal_icdf(curand(state)); +} + +/** + * \brief Return a normally distributed float from a scrambled Sobol32 generator. + * + * Return a single normally distributed float with mean \p 0.0f and + * standard deviation \p 1.0f from the scrambled Sobol32 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float curand_normal(curandStateScrambledSobol32_t *state) +{ + return _curand_normal_icdf(curand(state)); +} + +/** + * \brief Return a normally distributed float from a Sobol64 generator. + * + * Return a single normally distributed float with mean \p 0.0f and + * standard deviation \p 1.0f from the Sobol64 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float curand_normal(curandStateSobol64_t *state) +{ + return _curand_normal_icdf(curand(state)); +} + +/** + * \brief Return a normally distributed float from a scrambled Sobol64 generator. + * + * Return a single normally distributed float with mean \p 0.0f and + * standard deviation \p 1.0f from the scrambled Sobol64 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed float with mean \p 0.0f and standard deviation \p 1.0f + */ +QUALIFIERS float curand_normal(curandStateScrambledSobol64_t *state) +{ + return _curand_normal_icdf(curand(state)); +} + +/** + * \brief Return a normally distributed double from an XORWOW generator. + * + * Return a single normally distributed double with mean \p 0.0 and + * standard deviation \p 1.0 from the XORWOW generator in \p state, + * increment position of generator. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, then returns them one at a time. + * See ::curand_normal2_double() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0 + */ +QUALIFIERS double curand_normal_double(curandStateXORWOW_t *state) +{ + if(state->boxmuller_flag_double != EXTRA_FLAG_NORMAL) { + unsigned int x0, x1, y0, y1; + x0 = curand(state); + x1 = curand(state); + y0 = curand(state); + y1 = curand(state); + double2 v = _curand_box_muller_double(x0, x1, y0, y1); + state->boxmuller_extra_double = v.y; + state->boxmuller_flag_double = EXTRA_FLAG_NORMAL; + return v.x; + } + state->boxmuller_flag_double = 0; + return state->boxmuller_extra_double; +} + +/** + * \brief Return a normally distributed double from an Philox4_32_10 generator. + * + * Return a single normally distributed double with mean \p 0.0 and + * standard deviation \p 1.0 from the Philox4_32_10 generator in \p state, + * increment position of generator. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, then returns them one at a time. + * See ::curand_normal2_double() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0 + */ + +QUALIFIERS double curand_normal_double(curandStatePhilox4_32_10_t *state) +{ + if(state->boxmuller_flag_double != EXTRA_FLAG_NORMAL) { + uint4 _x; + _x = curand4(state); + double2 v = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w); + state->boxmuller_extra_double = v.y; + state->boxmuller_flag_double = EXTRA_FLAG_NORMAL; + return v.x; + } + state->boxmuller_flag_double = 0; + return state->boxmuller_extra_double; +} + + +/** + * \brief Return a normally distributed double from an MRG32k3a generator. + * + * Return a single normally distributed double with mean \p 0.0 and + * standard deviation \p 1.0 from the XORWOW generator in \p state, + * increment position of generator. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results, then returns them one at a time. + * See ::curand_normal2_double() for a more efficient version that returns + * both results at once. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0 + */ +QUALIFIERS double curand_normal_double(curandStateMRG32k3a_t *state) +{ + if(state->boxmuller_flag_double != EXTRA_FLAG_NORMAL) { + double2 v = curand_box_muller_mrg_double(state); + state->boxmuller_extra_double = v.y; + state->boxmuller_flag_double = EXTRA_FLAG_NORMAL; + return v.x; + } + state->boxmuller_flag_double = 0; + return state->boxmuller_extra_double; +} + +/** + * \brief Return two normally distributed doubles from an XORWOW generator. + * + * Return two normally distributed doubles with mean \p 0.0 and + * standard deviation \p 1.0 from the XORWOW generator in \p state, + * increment position of generator by 2. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double2 where each element is from a + * distribution with mean \p 0.0 and standard deviation \p 1.0 + */ +QUALIFIERS double2 curand_normal2_double(curandStateXORWOW_t *state) +{ + return curand_box_muller_double(state); +} + +/** + * \brief Return two normally distributed doubles from an Philox4_32_10 generator. + * + * Return two normally distributed doubles with mean \p 0.0 and + * standard deviation \p 1.0 from the Philox4_32_10 generator in \p state, + * increment position of generator by 2. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double2 where each element is from a + * distribution with mean \p 0.0 and standard deviation \p 1.0 + */ +QUALIFIERS double2 curand_normal2_double(curandStatePhilox4_32_10_t *state) +{ + uint4 _x; + double2 result; + + _x = curand4(state); + double2 v1 = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w); + result.x = v1.x; + result.y = v1.y; + + return result; +} + + // not a part of API +QUALIFIERS double4 curand_normal4_double(curandStatePhilox4_32_10_t *state) +{ + uint4 _x; + uint4 _y; + double4 result; + + _x = curand4(state); + _y = curand4(state); + double2 v1 = _curand_box_muller_double(_x.x, _x.y, _x.z, _x.w); + double2 v2 = _curand_box_muller_double(_y.x, _y.y, _y.z, _y.w); + result.x = v1.x; + result.y = v1.y; + result.z = v2.x; + result.w = v2.y; + + return result; +} + + +/** + * \brief Return two normally distributed doubles from an MRG32k3a generator. + * + * Return two normally distributed doubles with mean \p 0.0 and + * standard deviation \p 1.0 from the MRG32k3a generator in \p state, + * increment position of generator. + * + * The implementation uses a Box-Muller transform to generate two + * normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double2 where each element is from a + * distribution with mean \p 0.0 and standard deviation \p 1.0 + */ +QUALIFIERS double2 curand_normal2_double(curandStateMRG32k3a_t *state) +{ + return curand_box_muller_mrg_double(state); +} + +/** + * \brief Return a normally distributed double from an MTGP32 generator. + * + * Return a single normally distributed double with mean \p 0.0 and + * standard deviation \p 1.0 from the MTGP32 generator in \p state, + * increment position of generator. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0 + */ +QUALIFIERS double curand_normal_double(curandStateMtgp32_t *state) +{ + return _curand_normal_icdf_double(curand(state)); +} + +/** + * \brief Return a normally distributed double from an Sobol32 generator. + * + * Return a single normally distributed double with mean \p 0.0 and + * standard deviation \p 1.0 from the Sobol32 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0 + */ +QUALIFIERS double curand_normal_double(curandStateSobol32_t *state) +{ + return _curand_normal_icdf_double(curand(state)); +} + +/** + * \brief Return a normally distributed double from a scrambled Sobol32 generator. + * + * Return a single normally distributed double with mean \p 0.0 and + * standard deviation \p 1.0 from the scrambled Sobol32 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0 + */ +QUALIFIERS double curand_normal_double(curandStateScrambledSobol32_t *state) +{ + return _curand_normal_icdf_double(curand(state)); +} + +/** + * \brief Return a normally distributed double from a Sobol64 generator. + * + * Return a single normally distributed double with mean \p 0.0 and + * standard deviation \p 1.0 from the Sobol64 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0 + */ +QUALIFIERS double curand_normal_double(curandStateSobol64_t *state) +{ + return _curand_normal_icdf_double(curand(state)); +} + +/** + * \brief Return a normally distributed double from a scrambled Sobol64 generator. + * + * Return a single normally distributed double with mean \p 0.0 and + * standard deviation \p 1.0 from the scrambled Sobol64 generator in \p state, + * increment position of generator by one. + * + * The implementation uses the inverse cumulative distribution function + * to generate normally distributed results. + * + * \param state - Pointer to state to update + * + * \return Normally distributed double with mean \p 0.0 and standard deviation \p 1.0 + */ +QUALIFIERS double curand_normal_double(curandStateScrambledSobol64_t *state) +{ + return _curand_normal_icdf_double(curand(state)); +} +#endif // !defined(CURAND_NORMAL_H_) diff --git a/cuda_toolkit/include/curand_normal_static.h b/cuda_toolkit/include/curand_normal_static.h new file mode 100644 index 0000000000000000000000000000000000000000..aebb6492702b294ac6f3538bcd6dab53374e4548 --- /dev/null +++ b/cuda_toolkit/include/curand_normal_static.h @@ -0,0 +1,134 @@ + /* Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ +#ifndef CURAND_NORMAL_STATIC_H +#define CURAND_NORMAL_STATIC_H + +#define QUALIFIERS_STATIC __host__ __device__ __forceinline__ + +#include +#if defined(HOST_HAVE_ERFCINVF) + #define IF_DEVICE_OR_HAVE_ERFCINVF(t, f) _NV_BLOCK_EXPAND(t) +#else + #define IF_DEVICE_OR_HAVE_ERFCINVF(t, f) NV_IF_ELSE_TARGET(NV_IS_DEVICE, t, f) +#endif + +QUALIFIERS_STATIC float _curand_normal_icdf(unsigned int x) +{ +IF_DEVICE_OR_HAVE_ERFCINVF( + float s = CURAND_SQRT2; + // Mirror to avoid loss of precision + if(x > 0x80000000UL) { + x = 0xffffffffUL - x; + s = -s; + } + float p = x * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f); + // p is in (0, 0.5], 2p is in (0, 1] + return s * erfcinvf(2.0f * p); +, + x++; //suppress warnings + return 0.0f; +) +} + +QUALIFIERS_STATIC float _curand_normal_icdf(unsigned long long x) +{ +IF_DEVICE_OR_HAVE_ERFCINVF( + unsigned int t = (unsigned int)(x >> 32); + float s = CURAND_SQRT2; + // Mirror to avoid loss of precision + if(t > 0x80000000UL) { + t = 0xffffffffUL - t; + s = -s; + } + float p = t * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f); + // p is in (0 - 0.5] 2p is in (0 - 1] + return s * erfcinvf(2.0f * p); +, + x++; + return 0.0f; +) +} + +QUALIFIERS_STATIC double _curand_normal_icdf_double(unsigned int x) +{ +IF_DEVICE_OR_HAVE_ERFCINVF( + double s = CURAND_SQRT2_DOUBLE; + // Mirror to avoid loss of precision + if(x > 0x80000000UL) { + x = 0xffffffffUL - x; + s = -s; + } + double p = x * CURAND_2POW32_INV_DOUBLE + (CURAND_2POW32_INV_DOUBLE/2.0); + // p is in (0 - 0.5] 2p is in (0 - 1] + return s * erfcinv(2.0 * p); +, + x++; + return 0.0; +) +} + +QUALIFIERS_STATIC double _curand_normal_icdf_double(unsigned long long x) +{ +IF_DEVICE_OR_HAVE_ERFCINVF( + double s = CURAND_SQRT2_DOUBLE; + x >>= 11; + // Mirror to avoid loss of precision + if(x > 0x10000000000000UL) { + x = 0x1fffffffffffffUL - x; + s = -s; + } + double p = x * CURAND_2POW53_INV_DOUBLE + (CURAND_2POW53_INV_DOUBLE/2.0); + // p is in (0 - 0.5] 2p is in (0 - 1] + return s * erfcinv(2.0 * p); +, + x++; + return 0.0; +) +} +#undef QUALIFIERS_STATIC +#endif diff --git a/cuda_toolkit/include/curand_philox4x32_x.h b/cuda_toolkit/include/curand_philox4x32_x.h new file mode 100644 index 0000000000000000000000000000000000000000..8ffad9c62130f0a0ced79895547215b7cad13446 --- /dev/null +++ b/cuda_toolkit/include/curand_philox4x32_x.h @@ -0,0 +1,195 @@ +/* Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ +/* + Copyright 2010-2011, D. E. Shaw Research. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions, and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of D. E. Shaw Research nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CURAND_PHILOX4X32_X__H_ +#define CURAND_PHILOX4X32_X__H_ +#include + +#if !defined(QUALIFIERS) +#define QUALIFIERS static __forceinline__ __device__ +#endif + +#define PHILOX_W32_0 (0x9E3779B9) +#define PHILOX_W32_1 (0xBB67AE85) +#define PHILOX_M4x32_0 (0xD2511F53) +#define PHILOX_M4x32_1 (0xCD9E8D57) + +struct curandStatePhilox4_32_10 { + uint4 ctr; + uint4 output; + uint2 key; + unsigned int STATE; + int boxmuller_flag; + int boxmuller_flag_double; + float boxmuller_extra; + double boxmuller_extra_double; +}; + +typedef struct curandStatePhilox4_32_10 curandStatePhilox4_32_10_t; + + +QUALIFIERS void Philox_State_Incr(curandStatePhilox4_32_10_t* s, unsigned long long n) +{ + unsigned int nlo = (unsigned int)(n); + unsigned int nhi = (unsigned int)(n>>32); + + s->ctr.x += nlo; + if( s->ctr.x < nlo ) + nhi++; + + s->ctr.y += nhi; + if(nhi <= s->ctr.y) + return; + if(++s->ctr.z) return; + ++s->ctr.w; +} + +QUALIFIERS void Philox_State_Incr_hi(curandStatePhilox4_32_10_t* s, unsigned long long n) +{ + unsigned int nlo = (unsigned int)(n); + unsigned int nhi = (unsigned int)(n>>32); + + s->ctr.z += nlo; + if( s->ctr.z < nlo ) + nhi++; + + s->ctr.w += nhi; +} + + + +QUALIFIERS void Philox_State_Incr(curandStatePhilox4_32_10_t* s) +{ + if(++s->ctr.x) return; + if(++s->ctr.y) return; + if(++s->ctr.z) return; + ++s->ctr.w; +} + + +QUALIFIERS unsigned int mulhilo32(unsigned int a, unsigned int b, unsigned int* hip) +{ +NV_IF_ELSE_TARGET(NV_IS_HOST, + // host code + unsigned long long product = ((unsigned long long)a) * ((unsigned long long)b); + *hip = product >> 32; + return (unsigned int)product; +, + // device code + *hip = __umulhi(a,b); + return a*b; +) +} + +QUALIFIERS uint4 _philox4x32round(uint4 ctr, uint2 key) +{ + unsigned int hi0; + unsigned int hi1; + unsigned int lo0 = mulhilo32(PHILOX_M4x32_0, ctr.x, &hi0); + unsigned int lo1 = mulhilo32(PHILOX_M4x32_1, ctr.z, &hi1); + + uint4 ret = {hi1^ctr.y^key.x, lo1, hi0^ctr.w^key.y, lo0}; + return ret; +} + +QUALIFIERS uint4 curand_Philox4x32_10( uint4 c, uint2 k) +{ + c = _philox4x32round(c, k); // 1 + k.x += PHILOX_W32_0; k.y += PHILOX_W32_1; + c = _philox4x32round(c, k); // 2 + k.x += PHILOX_W32_0; k.y += PHILOX_W32_1; + c = _philox4x32round(c, k); // 3 + k.x += PHILOX_W32_0; k.y += PHILOX_W32_1; + c = _philox4x32round(c, k); // 4 + k.x += PHILOX_W32_0; k.y += PHILOX_W32_1; + c = _philox4x32round(c, k); // 5 + k.x += PHILOX_W32_0; k.y += PHILOX_W32_1; + c = _philox4x32round(c, k); // 6 + k.x += PHILOX_W32_0; k.y += PHILOX_W32_1; + c = _philox4x32round(c, k); // 7 + k.x += PHILOX_W32_0; k.y += PHILOX_W32_1; + c = _philox4x32round(c, k); // 8 + k.x += PHILOX_W32_0; k.y += PHILOX_W32_1; + c = _philox4x32round(c, k); // 9 + k.x += PHILOX_W32_0; k.y += PHILOX_W32_1; + return _philox4x32round(c, k); // 10 +} + + +#endif diff --git a/cuda_toolkit/include/curand_poisson.h b/cuda_toolkit/include/curand_poisson.h new file mode 100644 index 0000000000000000000000000000000000000000..f375d572261c9f12f7006a4d9f8b05a878fc18e7 --- /dev/null +++ b/cuda_toolkit/include/curand_poisson.h @@ -0,0 +1,763 @@ + + /* Copyright 2010-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + + +#if !defined(CURAND_POISSON_H_) +#define CURAND_POISSON_H_ + +/** + * \defgroup DEVICE Device API + * + * @{ + */ + +#ifndef __CUDACC_RTC__ +#include +#endif // __CUDACC_RTC__ + +#include + +#include "curand_mrg32k3a.h" +#include "curand_mtgp32_kernel.h" +#include "curand_philox4x32_x.h" + +#define CR_CUDART_PI 3.1415926535897931e+0 +#define CR_CUDART_TWO_TO_52 4503599627370496.0 + + +QUALIFIERS float __cr_rsqrt(float a) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm ("rsqrt.approx.f32.ftz %0, %1;" : "=f"(a) : "f"(a)); +, + a = 1.0f / sqrtf (a); +) + return a; +} + +QUALIFIERS float __cr_exp (float a) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + a = a * 1.4426950408889634074; + asm ("ex2.approx.f32.ftz %0, %1;" : "=f"(a) : "f"(a)); +, + a = expf (a); +) + return a; +} + +QUALIFIERS float __cr_log (float a) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm ("lg2.approx.f32.ftz %0, %1;" : "=f"(a) : "f"(a)); + a = a * 0.69314718055994530942; +, + a = logf (a); +) + return a; +} + +QUALIFIERS float __cr_rcp (float a) +{ +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + asm ("rcp.approx.f32.ftz %0, %1;" : "=f"(a) : "f"(a)); +, + a = 1.0f / a; +) + return a; +} + +/* Computes regularized gamma function: gammainc(a,x)/gamma(a) */ +QUALIFIERS float __cr_pgammainc (float a, float x) +{ + float t, alpha, beta; + + /* First level parametrization constants */ + float ma1 = 1.43248035075540910f, + ma2 = 0.12400979329415655f, + ma3 = 0.00025361074907033f, + mb1 = 0.21096734870196546f, + mb2 = 1.97381164089999420f, + mb3 = 0.94201734077887530f; + + /* Second level parametrization constants (depends only on a) */ + + alpha = __cr_rsqrt (a - ma2); + alpha = ma1 * alpha + ma3; + beta = __cr_rsqrt (a - mb2); + beta = mb1 * beta + mb3; + + /* Final approximation (depends on a and x) */ + + t = a - x; + t = alpha * t - beta; + t = 1.0f + __cr_exp (t); + t = t * t; + t = __cr_rcp (t); + + /* Negative a,x or a,x=NAN requires special handling */ + //t = !(x > 0 && a >= 0) ? 0.0 : t; + + return t; +} + +/* Computes inverse of pgammainc */ +QUALIFIERS float __cr_pgammaincinv (float a, float y) +{ + float t, alpha, beta; + + /* First level parametrization constants */ + + float ma1 = 1.43248035075540910f, + ma2 = 0.12400979329415655f, + ma3 = 0.00025361074907033f, + mb1 = 0.21096734870196546f, + mb2 = 1.97381164089999420f, + mb3 = 0.94201734077887530f; + + /* Second level parametrization constants (depends only on a) */ + + alpha = __cr_rsqrt (a - ma2); + alpha = ma1 * alpha + ma3; + beta = __cr_rsqrt (a - mb2); + beta = mb1 * beta + mb3; + + /* Final approximation (depends on a and y) */ + + t = __cr_rsqrt (y) - 1.0f; + t = __cr_log (t); + t = beta + t; + t = - t * __cr_rcp (alpha) + a; + /* Negative a,x or a,x=NAN requires special handling */ + //t = !(y > 0 && a >= 0) ? 0.0 : t; + return t; +} + +#if defined(__CUDACC_RDC__) && (__cplusplus >= 201703L) && defined(__cpp_inline_variables) +inline __constant__ double __cr_lgamma_table [] = { +#else +static __constant__ double __cr_lgamma_table [] = { +#endif + 0.000000000000000000e-1, + 0.000000000000000000e-1, + 6.931471805599453094e-1, + 1.791759469228055001e0, + 3.178053830347945620e0, + 4.787491742782045994e0, + 6.579251212010100995e0, + 8.525161361065414300e0, + 1.060460290274525023e1 +}; + + +QUALIFIERS double __cr_lgamma_integer(int a) +{ + double s; + double t; + double fa = fabs((float)a); + double sum; + + if (a > 8) { + /* Stirling approximation; coefficients from Hart et al, "Computer + * Approximations", Wiley 1968. Approximation 5404. + */ + s = 1.0 / fa; + t = s * s; + sum = -0.1633436431e-2; + sum = sum * t + 0.83645878922e-3; + sum = sum * t - 0.5951896861197e-3; + sum = sum * t + 0.793650576493454e-3; + sum = sum * t - 0.277777777735865004e-2; + sum = sum * t + 0.833333333333331018375e-1; + sum = sum * s + 0.918938533204672; + s = 0.5 * log (fa); + t = fa - 0.5; + s = s * t; + t = s - fa; + s = s + sum; + t = t + s; + return t; + } else { +NV_IF_ELSE_TARGET(NV_IS_DEVICE, + return __cr_lgamma_table [(int) fa-1]; +, + switch(a) { + case 1: return 0.000000000000000000e-1; + case 2: return 0.000000000000000000e-1; + case 3: return 6.931471805599453094e-1; + case 4: return 1.791759469228055001e0; + case 5: return 3.178053830347945620e0; + case 6: return 4.787491742782045994e0; + case 7: return 6.579251212010100995e0; + case 8: return 8.525161361065414300e0; + default: return 1.060460290274525023e1; + } +) + } +} + +#define KNUTH_FLOAT_CONST 60.0 +template +// Donald E. Knuth Seminumerical Algorithms. The Art of Computer Programming, Volume 2 +QUALIFIERS unsigned int curand_poisson_knuth(T *state, float lambda) +{ + unsigned int k = 0; + float p = expf(lambda); + do{ + k++; + p *= curand_uniform(state); + }while (p > 1.0); + return k-1; +} + +template +// Donald E. Knuth Seminumerical Algorithms. The Art of Computer Programming, Volume 2 +QUALIFIERS uint4 curand_poisson_knuth4(T *state, float lambda) +{ + uint4 k = {0,0,0,0}; + float exp_lambda = expf(lambda); + float4 p={ exp_lambda,exp_lambda,exp_lambda,exp_lambda }; + do{ + k.x++; + p.x *= curand_uniform(state); + }while (p.x > 1.0); + do{ + k.y++; + p.y *= curand_uniform(state); + }while (p.y > 1.0); + do{ + k.z++; + p.z *= curand_uniform(state); + }while (p.z > 1.0); + do{ + k.w++; + p.w *= curand_uniform(state); + }while (p.w > 1.0); + + k.x--; + k.y--; + k.z--; + k.w--; + return k; +} + +template +// Marsaglia, Tsang, Wang Journal of Statistical Software, square histogram. +QUALIFIERS unsigned int _curand_M2_double(T x, curandDistributionM2Shift_t distributionM2) +{ + double u = _curand_uniform_double(x); + int j = (int) floor(distributionM2->length*u); + + double histogramVj; + unsigned int histogramKj; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_35, + histogramVj = __ldg( &(distributionM2->histogram->V[j])); + histogramKj = __ldg( &(distributionM2->histogram->K[j])); +, + histogramVj = distributionM2->histogram->V[j]; + histogramKj = distributionM2->histogram->K[j]; +) + //if (u < distributionM2->histogram->V[j]) return distributionM2->shift + j; + //return distributionM2->shift + distributionM2->histogram->K[j]; + if (u < histogramVj) return distributionM2->shift + j; + return distributionM2->shift + histogramKj; +} + +template +// Marsaglia, Tsang, Wang Journal of Statistical Software, square histogram. +QUALIFIERS uint4 _curand_M2_double4(T x, curandDistributionM2Shift_t distributionM2) +{ + double4 u; + uint4 result = {0,0,0,0}; + int4 flag = {1,1,1,1}; + + u.x = _curand_uniform_double(x.x); + u.y = _curand_uniform_double(x.y); + u.z = _curand_uniform_double(x.z); + u.w = _curand_uniform_double(x.w); + + int4 j; + j.x = (int) floor(distributionM2->length*u.x); + j.y = (int) floor(distributionM2->length*u.y); + j.z = (int) floor(distributionM2->length*u.z); + j.w = (int) floor(distributionM2->length*u.w); +// int result; + + double histogramVjx; + double histogramVjy; + double histogramVjz; + double histogramVjw; + unsigned int histogramKjx; + unsigned int histogramKjy; + unsigned int histogramKjz; + unsigned int histogramKjw; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_35, + histogramVjx = __ldg( &(distributionM2->histogram->V[j.x])); + histogramVjy = __ldg( &(distributionM2->histogram->V[j.y])); + histogramVjz = __ldg( &(distributionM2->histogram->V[j.z])); + histogramVjw = __ldg( &(distributionM2->histogram->V[j.w])); + + histogramKjx = __ldg( &(distributionM2->histogram->K[j.x])); + histogramKjy = __ldg( &(distributionM2->histogram->K[j.y])); + histogramKjz = __ldg( &(distributionM2->histogram->K[j.z])); + histogramKjw = __ldg( &(distributionM2->histogram->K[j.w])); +, + histogramVjx = distributionM2->histogram->V[j.x]; + histogramVjy = distributionM2->histogram->V[j.y]; + histogramVjz = distributionM2->histogram->V[j.z]; + histogramVjw = distributionM2->histogram->V[j.w]; + + histogramKjx = distributionM2->histogram->K[j.x]; + histogramKjy = distributionM2->histogram->K[j.y]; + histogramKjz = distributionM2->histogram->K[j.z]; + histogramKjw = distributionM2->histogram->K[j.w]; +) + + if (u.x < histogramVjx){ result.x = distributionM2->shift + j.x; flag.x = 0; } + if (u.y < histogramVjy){ result.y = distributionM2->shift + j.y; flag.y = 0; } + if (u.z < histogramVjz){ result.z = distributionM2->shift + j.z; flag.z = 0; } + if (u.w < histogramVjw){ result.w = distributionM2->shift + j.w; flag.w = 0; } + //return distributionM2->shift + distributionM2->histogram->K[j]; + + if(flag.x) result.x = distributionM2->shift + histogramKjx; + if(flag.y) result.y = distributionM2->shift + histogramKjy; + if(flag.z) result.z = distributionM2->shift + histogramKjz; + if(flag.w) result.w = distributionM2->shift + histogramKjw; + + return result; +} + +template +QUALIFIERS unsigned int curand_M2_double(STATE *state, curandDistributionM2Shift_t distributionM2) +{ + return _curand_M2_double(curand(state), distributionM2); +} + +template +QUALIFIERS uint4 curand_M2_double4(STATE *state, curandDistributionM2Shift_t distributionM2) +{ + return _curand_M2_double4(curand4(state), distributionM2); +} + + +template +QUALIFIERS unsigned int _curand_binary_search_double(T x, curandDistributionShift_t distribution) +{ + double u = _curand_uniform_double(x); + int min = 0; + int max = distribution->length-1; + do{ + int mid = (max + min)/2; + double probability_mid; +NV_IF_ELSE_TARGET(NV_PROVIDES_SM_35, + probability_mid = __ldg( &(distribution->probability[mid])); +, + probability_mid = distribution->probability[mid]; +) + if (u <= probability_mid){ + max = mid; + }else{ + min = mid+1; + } + }while (min < max); + return distribution->shift + min; +} + +template +QUALIFIERS unsigned int curand_binary_search_double(STATE *state, curandDistributionShift_t distribution) +{ + return _curand_binary_search_double(curand(state), distribution); +} + +// Generates uniformly distributed double values in range (0.0; 1.0) from uniformly distributed +// unsigned int. We can't use standard _curand_uniform_double since it can generate 1.0. +// This is required only for _curand_poisson_ITR_double. +QUALIFIERS double _curand_uniform_double_excluding_one(unsigned int x) +{ + return x * CURAND_2POW32_INV_DOUBLE + (CURAND_2POW32_INV_DOUBLE/2.0); +} + +// Overload for unsigned long long. +// This is required only for _curand_poisson_ITR_double. +QUALIFIERS double _curand_uniform_double_excluding_one(unsigned long long x) +{ + return (x >> 11) * CURAND_2POW53_INV_DOUBLE + (CURAND_2POW53_INV_DOUBLE/4.0); +} + +#define MAGIC_DOUBLE_CONST 500.0 +template +//George S. Fishman Discrete-event simulation: modeling, programming, and analysis +QUALIFIERS unsigned int _curand_poisson_ITR_double(T x, double lambda) +{ + double L,p = 1.0; + double q = 1.0; + unsigned int k = 0; + int pow=0; + // This algorithm requires u to be in (0;1) range, however, _curand_uniform_double + // returns a number in range (0;1]. If u is 1.0 the inner loop never ends. The + // following operation transforms the range from (0;1] to (0;1). + double u = _curand_uniform_double_excluding_one(x); + do{ + if (lambda > (double)(pow+MAGIC_DOUBLE_CONST)){ + L = exp(-MAGIC_DOUBLE_CONST); + }else{ + L = exp((double)(pow - lambda)); + } + p *= L; + q *= L; + pow += (int) MAGIC_DOUBLE_CONST; + while (u > q){ + k++; + p *= ((double)lambda / (double) k); + q += p; + } + }while((double)pow < lambda); + return k; +} + +template +/* Rejection Method for Poisson distribution based on gammainc approximation */ +QUALIFIERS unsigned int curand_poisson_gammainc(T state, float lambda){ + float y, x, t, z,v; + float logl = __cr_log (lambda); + while (true) { + y = curand_uniform (state); + x = __cr_pgammaincinv (lambda, y); + x = floorf (x); + z = curand_uniform (state); + v = (__cr_pgammainc (lambda, x + 1.0f) - __cr_pgammainc (lambda, x)) * 1.3f; + z = z*v; + t = (float)__cr_exp (-lambda + x * logl - (float)__cr_lgamma_integer ((int)(1.0f + x))); + if ((z < t) && (v>=1e-20)) + break; + } + return (unsigned int)x; +} + +template +/* Rejection Method for Poisson distribution based on gammainc approximation */ +QUALIFIERS uint4 curand_poisson_gammainc4(T state, float lambda){ + uint4 result; + float y, x, t, z,v; + float logl = __cr_log (lambda); + while (true) { + y = curand_uniform(state); + x = __cr_pgammaincinv (lambda, y); + x = floorf (x); + z = curand_uniform (state); + v = (__cr_pgammainc (lambda, x + 1.0f) - __cr_pgammainc (lambda, x)) * 1.3f; + z = z*v; + t = (float)__cr_exp (-lambda + x * logl - (float)__cr_lgamma_integer ((int)(1.0f + x))); + if ((z < t) && (v>=1e-20)) + break; + } + result.x = (unsigned int)x; + + while (true) { + y = curand_uniform(state); + x = __cr_pgammaincinv (lambda, y); + x = floorf (x); + z = curand_uniform (state); + v = (__cr_pgammainc (lambda, x + 1.0f) - __cr_pgammainc (lambda, x)) * 1.3f; + z = z*v; + t = (float)__cr_exp (-lambda + x * logl - (float)__cr_lgamma_integer ((int)(1.0f + x))); + if ((z < t) && (v>=1e-20)) + break; + } + result.y = (unsigned int)x; + + while (true) { + y = curand_uniform(state); + x = __cr_pgammaincinv (lambda, y); + x = floorf (x); + z = curand_uniform (state); + v = (__cr_pgammainc (lambda, x + 1.0f) - __cr_pgammainc (lambda, x)) * 1.3f; + z = z*v; + t = (float)__cr_exp (-lambda + x * logl - (float)__cr_lgamma_integer ((int)(1.0f + x))); + if ((z < t) && (v>=1e-20)) + break; + } + result.z = (unsigned int)x; + + while (true) { + y = curand_uniform(state); + x = __cr_pgammaincinv (lambda, y); + x = floorf (x); + z = curand_uniform (state); + v = (__cr_pgammainc (lambda, x + 1.0f) - __cr_pgammainc (lambda, x)) * 1.3f; + z = z*v; + t = (float)__cr_exp (-lambda + x * logl - (float)__cr_lgamma_integer ((int)(1.0f + x))); + if ((z < t) && (v>=1e-20)) + break; + } + result.w = (unsigned int)x; + + return result; +} +// Note below that the round to nearest integer, where needed,is done in line with code that +// assumes the range of values is < 2**32 + +template +QUALIFIERS unsigned int _curand_poisson(T x, double lambda) +{ + if (lambda < 1000) + return _curand_poisson_ITR_double(x, lambda); + return (unsigned int)((sqrt(lambda) * _curand_normal_icdf_double(x)) + lambda + 0.5); //Round to nearest +} + +template +QUALIFIERS unsigned int _curand_poisson_from_normal(T x, double lambda) +{ + return (unsigned int)((sqrt(lambda) * _curand_normal_icdf(x)) + lambda + 0.5); //Round to nearest +} + +template +QUALIFIERS unsigned int curand_poisson_from_normal(STATE state, double lambda) +{ + return (unsigned int)((sqrt(lambda) * curand_normal(state)) + lambda + 0.5); //Round to nearest +} + +template +QUALIFIERS uint4 curand_poisson_from_normal4(STATE state, double lambda) +{ + uint4 result; + float4 _res; + + _res = curand_normal4(state); + + result.x = (unsigned int)((sqrt(lambda) * _res.x) + lambda + 0.5); //Round to nearest + result.y = (unsigned int)((sqrt(lambda) * _res.y) + lambda + 0.5); //Round to nearest + result.z = (unsigned int)((sqrt(lambda) * _res.z) + lambda + 0.5); //Round to nearest + result.w = (unsigned int)((sqrt(lambda) * _res.w) + lambda + 0.5); //Round to nearest + return result; //Round to nearest +} + +/** + * \brief Return a Poisson-distributed unsigned int from a XORWOW generator. + * + * Return a single unsigned int from a Poisson + * distribution with lambda \p lambda from the XORWOW generator in \p state, + * increment the position of the generator by a variable amount, depending + * on the algorithm used. + * + * \param state - Pointer to state to update + * \param lambda - Lambda of the Poisson distribution + * + * \return Poisson-distributed unsigned int with lambda \p lambda + */ +QUALIFIERS unsigned int curand_poisson(curandStateXORWOW_t *state, double lambda) +{ + if (lambda < 64) + return curand_poisson_knuth(state, (float)lambda); + if (lambda > 4000) + return (unsigned int)((sqrt(lambda) * curand_normal_double(state)) + lambda + 0.5); //Round to nearest + return curand_poisson_gammainc(state, (float)lambda); +} + +/** + * \brief Return a Poisson-distributed unsigned int from a Philox4_32_10 generator. + * + * Return a single unsigned int from a Poisson + * distribution with lambda \p lambda from the Philox4_32_10 generator in \p state, + * increment the position of the generator by a variable amount, depending + * on the algorithm used. + * + * \param state - Pointer to state to update + * \param lambda - Lambda of the Poisson distribution + * + * \return Poisson-distributed unsigned int with lambda \p lambda + */ +QUALIFIERS unsigned int curand_poisson(curandStatePhilox4_32_10_t *state, double lambda) +{ + if (lambda < 64) + return curand_poisson_knuth(state, (float)lambda); + if (lambda > 4000) + return (unsigned int)((sqrt(lambda) * curand_normal_double(state)) + lambda + 0.5); //Round to nearest + return curand_poisson_gammainc(state, (float)lambda); +} +/** + * \brief Return four Poisson-distributed unsigned ints from a Philox4_32_10 generator. + * + * Return a four unsigned ints from a Poisson + * distribution with lambda \p lambda from the Philox4_32_10 generator in \p state, + * increment the position of the generator by a variable amount, depending + * on the algorithm used. + * + * \param state - Pointer to state to update + * \param lambda - Lambda of the Poisson distribution + * + * \return Poisson-distributed unsigned int with lambda \p lambda + */ +QUALIFIERS uint4 curand_poisson4(curandStatePhilox4_32_10_t *state, double lambda) +{ + uint4 result; + double4 _res; + if (lambda < 64) + return curand_poisson_knuth4(state, (float)lambda); + if (lambda > 4000) { + _res = curand_normal4_double(state); + result.x = (unsigned int)((sqrt(lambda) * _res.x) + lambda + 0.5); //Round to nearest + result.y = (unsigned int)((sqrt(lambda) * _res.y) + lambda + 0.5); //Round to nearest + result.z = (unsigned int)((sqrt(lambda) * _res.z) + lambda + 0.5); //Round to nearest + result.w = (unsigned int)((sqrt(lambda) * _res.w) + lambda + 0.5); //Round to nearest + return result; + } + return curand_poisson_gammainc4(state, (float)lambda); +} + + + +/** + * \brief Return a Poisson-distributed unsigned int from a MRG32k3A generator. + * + * Return a single unsigned int from a Poisson + * distribution with lambda \p lambda from the MRG32k3a generator in \p state, + * increment the position of the generator by a variable amount, depending + * on the algorithm used. + * + * \param state - Pointer to state to update + * \param lambda - Lambda of the Poisson distribution + * + * \return Poisson-distributed unsigned int with lambda \p lambda + */ +QUALIFIERS unsigned int curand_poisson(curandStateMRG32k3a_t *state, double lambda) +{ + if (lambda < 64) + return curand_poisson_knuth(state, (float)lambda); + if (lambda > 4000) + return (unsigned int)((sqrt(lambda) * curand_normal_double(state)) + lambda + 0.5); //Round to nearest + return curand_poisson_gammainc(state, (float)lambda); +} + +/** + * \brief Return a Poisson-distributed unsigned int from a MTGP32 generator. + * + * Return a single int from a Poisson + * distribution with lambda \p lambda from the MTGP32 generator in \p state, + * increment the position of the generator by one. + * + * \param state - Pointer to state to update + * \param lambda - Lambda of the Poisson distribution + * + * \return Poisson-distributed unsigned int with lambda \p lambda + */ +QUALIFIERS unsigned int curand_poisson(curandStateMtgp32_t *state, double lambda) +{ + return _curand_poisson(curand(state), lambda); +} + +/** + * \brief Return a Poisson-distributed unsigned int from a Sobol32 generator. + * + * Return a single unsigned int from a Poisson + * distribution with lambda \p lambda from the Sobol32 generator in \p state, + * increment the position of the generator by one. + * + * \param state - Pointer to state to update + * \param lambda - Lambda of the Poisson distribution + * + * \return Poisson-distributed unsigned int with lambda \p lambda + */ + +QUALIFIERS unsigned int curand_poisson(curandStateSobol32_t *state, double lambda) +{ + return _curand_poisson(curand(state), lambda); +} + +/** + * \brief Return a Poisson-distributed unsigned int from a scrambled Sobol32 generator. + * + * Return a single unsigned int from a Poisson + * distribution with lambda \p lambda from the scrambled Sobol32 generator in \p state, + * increment the position of the generator by one. + * + * \param state - Pointer to state to update + * \param lambda - Lambda of the Poisson distribution + * + * \return Poisson-distributed unsigned int with lambda \p lambda + */ +QUALIFIERS unsigned int curand_poisson(curandStateScrambledSobol32_t *state, double lambda) +{ + return _curand_poisson(curand(state), lambda); +} + +/** + * \brief Return a Poisson-distributed unsigned int from a Sobol64 generator. + * + * Return a single unsigned int from a Poisson + * distribution with lambda \p lambda from the Sobol64 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param lambda - Lambda of the Poisson distribution + * + * \return Poisson-distributed unsigned int with lambda \p lambda + */ +QUALIFIERS unsigned int curand_poisson(curandStateSobol64_t *state, double lambda) +{ + return _curand_poisson(curand(state), lambda); +} + +/** + * \brief Return a Poisson-distributed unsigned int from a scrambled Sobol64 generator. + * + * Return a single unsigned int from a Poisson + * distribution with lambda \p lambda from the scrambled Sobol64 generator in \p state, + * increment position of generator by one. + * + * \param state - Pointer to state to update + * \param lambda - Lambda of the Poisson distribution + * + * \return Poisson-distributed unsigned int with lambda \p lambda + */ +QUALIFIERS unsigned int curand_poisson(curandStateScrambledSobol64_t *state, double lambda) +{ + return _curand_poisson(curand(state), lambda); +} +#endif // !defined(CURAND_POISSON_H_) diff --git a/cuda_toolkit/include/curand_precalc.h b/cuda_toolkit/include/curand_precalc.h new file mode 100644 index 0000000000000000000000000000000000000000..f49be636292eae61300799915d5c2ebe02409f15 --- /dev/null +++ b/cuda_toolkit/include/curand_precalc.h @@ -0,0 +1,3548 @@ +/* Copyright 2010-2012 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ +#if !defined(CURAND_XORWOW_PRECALCULATED_H_) +#define CURAND_XORWOW_PRECALCULATED_H_ + +#define PRECALC_NUM_MATRICES (32) +#define PRECALC_BLOCK_SIZE (2) +#define PRECALC_BLOCK_MASK ((1<= 201703L) && defined(__cpp_inline_variables) +#define CURAND_XORWOW_PRECALCULATED_DEVICE_QUALIFIERS inline __device__ +#else +#define CURAND_XORWOW_PRECALCULATED_DEVICE_QUALIFIERS static __device__ +#endif + +#if (__cplusplus >= 201703L) && defined(__cpp_inline_variables) +#define CURAND_XORWOW_PRECALCULATED_HOST_QUALIFIERS inline +#else +#define CURAND_XORWOW_PRECALCULATED_HOST_QUALIFIERS static +#endif +CURAND_XORWOW_PRECALCULATED_DEVICE_QUALIFIERS unsigned int precalc_xorwow_matrix[32][800] = { +{ +850664906UL, 2293210629UL, 1517805917UL, 1215500405UL, 1612415445UL, 645388200UL, 824349799UL, 3517232886UL, 4075591755UL, 3089899292UL, 4249786064UL, 3811424903UL, 1100783479UL, 53649761UL, 2817264826UL, 3159462529UL, 1654848550UL, 950025444UL, 3095510002UL, 4080567211UL, 4111078399UL, 3241719305UL, 2788212779UL, 4256963770UL, 2426893717UL, 4190211142UL, 1420776905UL, 3780537969UL, 1102912875UL, 1657948873UL, 3354905256UL, 2519610308UL, +515777663UL, 3396785394UL, 1832603711UL, 1154211550UL, 1915690212UL, 1933919046UL, 789578337UL, 337961173UL, 1359089498UL, 2249086205UL, 3417955173UL, 862571348UL, 528120760UL, 1265685672UL, 1970052076UL, 3585976752UL, 3645339918UL, 312171257UL, 1360991400UL, 1994321680UL, 2327168468UL, 2540437053UL, 1180483641UL, 2217962701UL, 182726833UL, 590204372UL, 1904496495UL, 2545607041UL, 3697978033UL, 1084030545UL, 3397906968UL, 2192325323UL, +2704204176UL, 1069092002UL, 2364406907UL, 1578647245UL, 3561974633UL, 3437665426UL, 1464127305UL, 1616628807UL, 2243114101UL, 3639967880UL, 1702613633UL, 2437350057UL, 39991274UL, 2024323584UL, 3795072940UL, 3604530798UL, 443099203UL, 643536212UL, 1919517328UL, 3931285769UL, 427935569UL, 276421624UL, 2492081750UL, 262729512UL, 3088549877UL, 2922650665UL, 1816283755UL, 4246096489UL, 842575914UL, 1460435650UL, 3050522190UL, 2640849794UL, +3697925816UL, 3465779075UL, 3856929655UL, 1365559780UL, 2897029415UL, 2747033756UL, 3611830629UL, 1891542518UL, 1897590206UL, 437451803UL, 677924906UL, 123809117UL, 3940574372UL, 687640291UL, 3488484529UL, 470218446UL, 1092571016UL, 1537938503UL, 1073323937UL, 611300083UL, 3809285994UL, 3975678726UL, 925845389UL, 2514775760UL, 2859302390UL, 2761919483UL, 993285307UL, 164095287UL, 3736193671UL, 2078946336UL, 1418537059UL, 1202525920UL, +4234029440UL, 1313593624UL, 2484428922UL, 1833969372UL, 661495122UL, 2217907395UL, 2795045321UL, 2950835531UL, 1402379354UL, 351314168UL, 1902476749UL, 1914974334UL, 2873973176UL, 1321203603UL, 3316118265UL, 3282193947UL, 1342191737UL, 793441242UL, 3281524559UL, 296088733UL, 487851702UL, 712098215UL, 1388727135UL, 1705533557UL, 3557800292UL, 399729516UL, 1355829467UL, 291276309UL, 421164833UL, 1318404599UL, 2064519128UL, 1161612642UL, +2076623594UL, 850664906UL, 2293210629UL, 1517805917UL, 1215500405UL, 3847487204UL, 645388200UL, 824349799UL, 3517232886UL, 4075591755UL, 2755872609UL, 4249786064UL, 3811424903UL, 1100783479UL, 53649761UL, 1417544262UL, 3159462529UL, 1654848550UL, 950025444UL, 3095510002UL, 1908900347UL, 4111078399UL, 3241719305UL, 2788212779UL, 4256963770UL, 3750258343UL, 4190211142UL, 1420776905UL, 3780537969UL, 1102912875UL, 1690550UL, 3354905256UL, +2519610308UL, 515777663UL, 3396785394UL, 2658162202UL, 1154211550UL, 1915690212UL, 1933919046UL, 789578337UL, 189880016UL, 1359089498UL, 2249086205UL, 3417955173UL, 862571348UL, 998719835UL, 1265685672UL, 1970052076UL, 3585976752UL, 3645339918UL, 2973042959UL, 1360991400UL, 1994321680UL, 2327168468UL, 2540437053UL, 2283905032UL, 2217962701UL, 182726833UL, 590204372UL, 1904496495UL, 110719262UL, 3697978033UL, 1084030545UL, 3397906968UL, +2192325323UL, 4133333579UL, 1069092002UL, 2364406907UL, 1578647245UL, 3561974633UL, 3629845331UL, 1464127305UL, 1616628807UL, 2243114101UL, 3639967880UL, 3256744141UL, 2437350057UL, 39991274UL, 2024323584UL, 3795072940UL, 1024703328UL, 443099203UL, 643536212UL, 1919517328UL, 3931285769UL, 2755167056UL, 276421624UL, 2492081750UL, 262729512UL, 3088549877UL, 2817867653UL, 1816283755UL, 4246096489UL, 842575914UL, 1460435650UL, 2276077438UL, +2640849794UL, 3697925816UL, 3465779075UL, 3856929655UL, 130551477UL, 2897029415UL, 2747033756UL, 3611830629UL, 1891542518UL, 804565809UL, 437451803UL, 677924906UL, 123809117UL, 3940574372UL, 2446610749UL, 3488484529UL, 470218446UL, 1092571016UL, 1537938503UL, 1502147484UL, 611300083UL, 3809285994UL, 3975678726UL, 925845389UL, 872826112UL, 2859302390UL, 2761919483UL, 993285307UL, 164095287UL, 3901654538UL, 2078946336UL, 1418537059UL, +1202525920UL, 4234029440UL, 704759480UL, 2484428922UL, 1833969372UL, 661495122UL, 2217907395UL, 3287413716UL, 2950835531UL, 1402379354UL, 351314168UL, 1902476749UL, 2033316109UL, 2873973176UL, 1321203603UL, 3316118265UL, 3282193947UL, 1316780684UL, 793441242UL, 3281524559UL, 296088733UL, 487851702UL, 314311643UL, 1388727135UL, 1705533557UL, 3557800292UL, 399729516UL, 1660074989UL, 291276309UL, 421164833UL, 1318404599UL, 2064519128UL, +3156334112UL, 2076623594UL, 850664906UL, 2293210629UL, 1517805917UL, 335452425UL, 3847487204UL, 645388200UL, 824349799UL, 3517232886UL, 954487767UL, 2755872609UL, 4249786064UL, 3811424903UL, 1100783479UL, 3408594583UL, 1417544262UL, 3159462529UL, 1654848550UL, 950025444UL, 324339737UL, 1908900347UL, 4111078399UL, 3241719305UL, 2788212779UL, 1890540205UL, 3750258343UL, 4190211142UL, 1420776905UL, 3780537969UL, 3716648585UL, 1690550UL, +3354905256UL, 2519610308UL, 515777663UL, 3758156132UL, 2658162202UL, 1154211550UL, 1915690212UL, 1933919046UL, 844149171UL, 189880016UL, 1359089498UL, 2249086205UL, 3417955173UL, 1031812215UL, 998719835UL, 1265685672UL, 1970052076UL, 3585976752UL, 3174204115UL, 2973042959UL, 1360991400UL, 1994321680UL, 2327168468UL, 714016907UL, 2283905032UL, 2217962701UL, 182726833UL, 590204372UL, 2151450260UL, 110719262UL, 3697978033UL, 1084030545UL, +3397906968UL, 767772303UL, 4133333579UL, 1069092002UL, 2364406907UL, 1578647245UL, 42955292UL, 3629845331UL, 1464127305UL, 1616628807UL, 2243114101UL, 3222189776UL, 3256744141UL, 2437350057UL, 39991274UL, 2024323584UL, 3142424684UL, 1024703328UL, 443099203UL, 643536212UL, 1919517328UL, 918511196UL, 2755167056UL, 276421624UL, 2492081750UL, 262729512UL, 4246877536UL, 2817867653UL, 1816283755UL, 4246096489UL, 842575914UL, 1425765936UL, +2276077438UL, 2640849794UL, 3697925816UL, 3465779075UL, 1491702526UL, 130551477UL, 2897029415UL, 2747033756UL, 3611830629UL, 1844578694UL, 804565809UL, 437451803UL, 677924906UL, 123809117UL, 3419189841UL, 2446610749UL, 3488484529UL, 470218446UL, 1092571016UL, 3272535988UL, 1502147484UL, 611300083UL, 3809285994UL, 3975678726UL, 2853681168UL, 872826112UL, 2859302390UL, 2761919483UL, 993285307UL, 1434560128UL, 3901654538UL, 2078946336UL, +1418537059UL, 1202525920UL, 2530097881UL, 704759480UL, 2484428922UL, 1833969372UL, 661495122UL, 503878844UL, 3287413716UL, 2950835531UL, 1402379354UL, 351314168UL, 4131886119UL, 2033316109UL, 2873973176UL, 1321203603UL, 3316118265UL, 237900321UL, 1316780684UL, 793441242UL, 3281524559UL, 296088733UL, 1730738847UL, 314311643UL, 1388727135UL, 1705533557UL, 3557800292UL, 1553835665UL, 1660074989UL, 291276309UL, 421164833UL, 1318404599UL, +964731488UL, 3156334112UL, 2076623594UL, 850664906UL, 2293210629UL, 1105350579UL, 335452425UL, 3847487204UL, 645388200UL, 824349799UL, 2789953706UL, 954487767UL, 2755872609UL, 4249786064UL, 3811424903UL, 3937839949UL, 3408594583UL, 1417544262UL, 3159462529UL, 1654848550UL, 624060530UL, 324339737UL, 1908900347UL, 4111078399UL, 3241719305UL, 2294919498UL, 1890540205UL, 3750258343UL, 4190211142UL, 1420776905UL, 2279133729UL, 3716648585UL, +1690550UL, 3354905256UL, 2519610308UL, 3563975602UL, 3758156132UL, 2658162202UL, 1154211550UL, 1915690212UL, 3505586122UL, 844149171UL, 189880016UL, 1359089498UL, 2249086205UL, 2389487504UL, 1031812215UL, 998719835UL, 1265685672UL, 1970052076UL, 2798611919UL, 3174204115UL, 2973042959UL, 1360991400UL, 1994321680UL, 1684134678UL, 714016907UL, 2283905032UL, 2217962701UL, 182726833UL, 1734988742UL, 2151450260UL, 110719262UL, 3697978033UL, +1084030545UL, 159906818UL, 767772303UL, 4133333579UL, 1069092002UL, 2364406907UL, 1290801202UL, 42955292UL, 3629845331UL, 1464127305UL, 1616628807UL, 987794861UL, 3222189776UL, 3256744141UL, 2437350057UL, 39991274UL, 3644076751UL, 3142424684UL, 1024703328UL, 443099203UL, 643536212UL, 1487589384UL, 918511196UL, 2755167056UL, 276421624UL, 2492081750UL, 137688638UL, 4246877536UL, 2817867653UL, 1816283755UL, 4246096489UL, 1518475380UL, +1425765936UL, 2276077438UL, 2640849794UL, 3697925816UL, 4226506771UL, 1491702526UL, 130551477UL, 2897029415UL, 2747033756UL, 2033599579UL, 1844578694UL, 804565809UL, 437451803UL, 677924906UL, 2749065512UL, 3419189841UL, 2446610749UL, 3488484529UL, 470218446UL, 290444026UL, 3272535988UL, 1502147484UL, 611300083UL, 3809285994UL, 2546040767UL, 2853681168UL, 872826112UL, 2859302390UL, 2761919483UL, 4097961150UL, 1434560128UL, 3901654538UL, +2078946336UL, 1418537059UL, 2725734455UL, 2530097881UL, 704759480UL, 2484428922UL, 1833969372UL, 3999408333UL, 503878844UL, 3287413716UL, 2950835531UL, 1402379354UL, 3861442503UL, 4131886119UL, 2033316109UL, 2873973176UL, 1321203603UL, 1267331405UL, 237900321UL, 1316780684UL, 793441242UL, 3281524559UL, 1273427916UL, 1730738847UL, 314311643UL, 1388727135UL, 1705533557UL, 1474310231UL, 1553835665UL, 1660074989UL, 291276309UL, 421164833UL, +3884815658UL, 3088049345UL, 3307042227UL, 3228948601UL, 1717605083UL, 1864502063UL, 3799516572UL, 2372822470UL, 2691586476UL, 1172840854UL, 1577099080UL, 870101866UL, 2139291021UL, 406996656UL, 255568268UL, 897760202UL, 674745664UL, 885214361UL, 3753233375UL, 3015215223UL, 1711461259UL, 3241363282UL, 2125360928UL, 2493601640UL, 2350228245UL, 3434627328UL, 2095642963UL, 3360932494UL, 3287396242UL, 4070512427UL, 3415702664UL, 1958354224UL, +3280206940UL, 3929504236UL, 3390499817UL, 4144225735UL, 3621750606UL, 3205006592UL, 3495743785UL, 269239326UL, 2181299371UL, 2898796651UL, 2613623219UL, 3988711298UL, 2162437858UL, 949553433UL, 3289670000UL, 3559525307UL, 3366925567UL, 2112148665UL, 955626393UL, 1790865381UL, 699223558UL, 3889584301UL, 1020750250UL, 4105283899UL, 2295851818UL, 4045668915UL, 2224770025UL, 766386910UL, 4265157386UL, 89139307UL, 2099710177UL, 1012450874UL, +1875492446UL, 1927399417UL, 767450812UL, 654474783UL, 4265293038UL, 4041215389UL, 4102336947UL, 4263617328UL, 2135826340UL, 2317231535UL, 3773895729UL, 403151111UL, 1400693138UL, 4255050194UL, 755369466UL, 2325764302UL, 2617301159UL, 4165707294UL, 1206304709UL, 2415645397UL, 4276004841UL, 1457022279UL, 662660652UL, 795140282UL, 828519889UL, 805830562UL, 1179976369UL, 2212548232UL, 755708248UL, 1034682071UL, 899950902UL, 1906046264UL, +1861009040UL, 310711525UL, 920739741UL, 2322414272UL, 3179236470UL, 81822135UL, 4111390320UL, 1800166783UL, 112253014UL, 688771939UL, 1050990794UL, 3124647483UL, 287052171UL, 1363630156UL, 3447798279UL, 1405733552UL, 3075862538UL, 1682808202UL, 1595154222UL, 1173705692UL, 680713285UL, 2748212230UL, 568610527UL, 3434965538UL, 1114942930UL, 2835858745UL, 2575992250UL, 3243355150UL, 2127580225UL, 1855934450UL, 3915941751UL, 2228679809UL, +1514780124UL, 1506688039UL, 1033083295UL, 793807083UL, 1120681149UL, 4105670165UL, 3999570340UL, 2083020131UL, 1213356023UL, 3684882757UL, 3375797774UL, 3577986103UL, 2092046164UL, 2593847443UL, 1826450612UL, 367828409UL, 3198272513UL, 1941316667UL, 943707510UL, 907134807UL, 2020457947UL, 1462193665UL, 2964617539UL, 4216491663UL, 2625270800UL, 2395371467UL, 3691003028UL, 3659016793UL, 2381847054UL, 3513105567UL, 3013019506UL, 2731245927UL, +}, +{ +1680024716UL, 2112340059UL, 3387475367UL, 2080916186UL, 1431532386UL, 3907378472UL, 2636491350UL, 2176128529UL, 2236616671UL, 3736851460UL, 2604001339UL, 3893075234UL, 3495918635UL, 4116370522UL, 1384310379UL, 3660102574UL, 2030233939UL, 2759207091UL, 49347923UL, 97526506UL, 2566932710UL, 1566181275UL, 3127827248UL, 578401670UL, 1499229308UL, 2581732444UL, 279715551UL, 809690877UL, 1438444015UL, 878935323UL, 1495277039UL, 3417305339UL, +2858903785UL, 3074075088UL, 603749086UL, 2370669734UL, 391683868UL, 3933465331UL, 2884128106UL, 1478317876UL, 1864988335UL, 2925823809UL, 4133578805UL, 218104493UL, 368652174UL, 1998600344UL, 1109346044UL, 1716435313UL, 415435111UL, 91393686UL, 2536620737UL, 1440068573UL, 481874870UL, 142128108UL, 988825519UL, 2077118779UL, 2858045339UL, 4068162251UL, 115593872UL, 1364244587UL, 3550167006UL, 3728768059UL, 1772423685UL, 2504624145UL, +248732306UL, 1412607307UL, 4081166331UL, 154438218UL, 1652901877UL, 3932533490UL, 3142799969UL, 3154073676UL, 3112018078UL, 2757873595UL, 2364830126UL, 2855791484UL, 793851407UL, 507785167UL, 263713916UL, 4060700051UL, 3291978358UL, 1584226715UL, 2546417990UL, 450747961UL, 2951067700UL, 2706009093UL, 1788578194UL, 4030171132UL, 2610979903UL, 573420740UL, 4269115622UL, 2180305819UL, 2646894726UL, 716649335UL, 3875715683UL, 853428184UL, +2436760738UL, 4190071217UL, 2754423535UL, 540698101UL, 4082489821UL, 741976046UL, 267559495UL, 1591532642UL, 2500610323UL, 3203248679UL, 147312102UL, 2772368222UL, 1412987047UL, 2295185573UL, 1932341300UL, 898396308UL, 1837129999UL, 3113914292UL, 2613354524UL, 3141601915UL, 276087167UL, 1887389351UL, 757801450UL, 3752353732UL, 2745818074UL, 1442953464UL, 3802648347UL, 223728071UL, 2169947402UL, 1338125300UL, 3642174036UL, 2794462634UL, +2326349851UL, 862746036UL, 3577092599UL, 627103363UL, 552173564UL, 4142604459UL, 2310329406UL, 583522272UL, 189323282UL, 1217612313UL, 73550248UL, 2434692829UL, 2757269706UL, 2392210091UL, 3032922600UL, 3573904125UL, 2897178037UL, 2632631469UL, 3085332665UL, 3775619904UL, 2563291734UL, 1351375865UL, 4043427793UL, 1803743084UL, 3112116579UL, 522940594UL, 2690374983UL, 2613871529UL, 3810037031UL, 1765642390UL, 534554747UL, 1930852049UL, +2264349344UL, 1680024716UL, 2112340059UL, 3387475367UL, 2080916186UL, 75966494UL, 3907378472UL, 2636491350UL, 2176128529UL, 2236616671UL, 2372987046UL, 2604001339UL, 3893075234UL, 3495918635UL, 4116370522UL, 534929913UL, 3660102574UL, 2030233939UL, 2759207091UL, 49347923UL, 987575186UL, 2566932710UL, 1566181275UL, 3127827248UL, 578401670UL, 3731513754UL, 2581732444UL, 279715551UL, 809690877UL, 1438444015UL, 2185866850UL, 1495277039UL, +3417305339UL, 2858903785UL, 3074075088UL, 4198538376UL, 2370669734UL, 391683868UL, 3933465331UL, 2884128106UL, 1400216510UL, 1864988335UL, 2925823809UL, 4133578805UL, 218104493UL, 2798390374UL, 1998600344UL, 1109346044UL, 1716435313UL, 415435111UL, 1892535124UL, 2536620737UL, 1440068573UL, 481874870UL, 142128108UL, 329082740UL, 2077118779UL, 2858045339UL, 4068162251UL, 115593872UL, 2644000449UL, 3550167006UL, 3728768059UL, 1772423685UL, +2504624145UL, 2140118619UL, 1412607307UL, 4081166331UL, 154438218UL, 1652901877UL, 3804911318UL, 3142799969UL, 3154073676UL, 3112018078UL, 2757873595UL, 50297646UL, 2855791484UL, 793851407UL, 507785167UL, 263713916UL, 3324588195UL, 3291978358UL, 1584226715UL, 2546417990UL, 450747961UL, 3455625012UL, 2706009093UL, 1788578194UL, 4030171132UL, 2610979903UL, 3835380965UL, 4269115622UL, 2180305819UL, 2646894726UL, 716649335UL, 2607142354UL, +853428184UL, 2436760738UL, 4190071217UL, 2754423535UL, 456808691UL, 4082489821UL, 741976046UL, 267559495UL, 1591532642UL, 2722205042UL, 3203248679UL, 147312102UL, 2772368222UL, 1412987047UL, 1950543946UL, 1932341300UL, 898396308UL, 1837129999UL, 3113914292UL, 428616392UL, 3141601915UL, 276087167UL, 1887389351UL, 757801450UL, 963534966UL, 2745818074UL, 1442953464UL, 3802648347UL, 223728071UL, 229039300UL, 1338125300UL, 3642174036UL, +2794462634UL, 2326349851UL, 206115203UL, 3577092599UL, 627103363UL, 552173564UL, 4142604459UL, 1492461846UL, 583522272UL, 189323282UL, 1217612313UL, 73550248UL, 3552211807UL, 2757269706UL, 2392210091UL, 3032922600UL, 3573904125UL, 810640644UL, 2632631469UL, 3085332665UL, 3775619904UL, 2563291734UL, 922608790UL, 4043427793UL, 1803743084UL, 3112116579UL, 522940594UL, 1785093944UL, 2613871529UL, 3810037031UL, 1765642390UL, 534554747UL, +3528050076UL, 2264349344UL, 1680024716UL, 2112340059UL, 3387475367UL, 3295682653UL, 75966494UL, 3907378472UL, 2636491350UL, 2176128529UL, 3574915532UL, 2372987046UL, 2604001339UL, 3893075234UL, 3495918635UL, 1280296085UL, 534929913UL, 3660102574UL, 2030233939UL, 2759207091UL, 299776535UL, 987575186UL, 2566932710UL, 1566181275UL, 3127827248UL, 3874691533UL, 3731513754UL, 2581732444UL, 279715551UL, 809690877UL, 3100791084UL, 2185866850UL, +1495277039UL, 3417305339UL, 2858903785UL, 1310351481UL, 4198538376UL, 2370669734UL, 391683868UL, 3933465331UL, 2749085130UL, 1400216510UL, 1864988335UL, 2925823809UL, 4133578805UL, 3352814594UL, 2798390374UL, 1998600344UL, 1109346044UL, 1716435313UL, 1571752941UL, 1892535124UL, 2536620737UL, 1440068573UL, 481874870UL, 2485033697UL, 329082740UL, 2077118779UL, 2858045339UL, 4068162251UL, 3837440666UL, 2644000449UL, 3550167006UL, 3728768059UL, +1772423685UL, 1176559812UL, 2140118619UL, 1412607307UL, 4081166331UL, 154438218UL, 2902622972UL, 3804911318UL, 3142799969UL, 3154073676UL, 3112018078UL, 2403391233UL, 50297646UL, 2855791484UL, 793851407UL, 507785167UL, 2351826747UL, 3324588195UL, 3291978358UL, 1584226715UL, 2546417990UL, 746876926UL, 3455625012UL, 2706009093UL, 1788578194UL, 4030171132UL, 3779307353UL, 3835380965UL, 4269115622UL, 2180305819UL, 2646894726UL, 2602235234UL, +2607142354UL, 853428184UL, 2436760738UL, 4190071217UL, 2066757692UL, 456808691UL, 4082489821UL, 741976046UL, 267559495UL, 3001080633UL, 2722205042UL, 3203248679UL, 147312102UL, 2772368222UL, 89950260UL, 1950543946UL, 1932341300UL, 898396308UL, 1837129999UL, 947911286UL, 428616392UL, 3141601915UL, 276087167UL, 1887389351UL, 2583987247UL, 963534966UL, 2745818074UL, 1442953464UL, 3802648347UL, 4229124441UL, 229039300UL, 1338125300UL, +3642174036UL, 2794462634UL, 2472155633UL, 206115203UL, 3577092599UL, 627103363UL, 552173564UL, 2586882739UL, 1492461846UL, 583522272UL, 189323282UL, 1217612313UL, 3501549884UL, 3552211807UL, 2757269706UL, 2392210091UL, 3032922600UL, 740675778UL, 810640644UL, 2632631469UL, 3085332665UL, 3775619904UL, 3643289881UL, 922608790UL, 4043427793UL, 1803743084UL, 3112116579UL, 2213337398UL, 1785093944UL, 2613871529UL, 3810037031UL, 1765642390UL, +762472016UL, 3528050076UL, 2264349344UL, 1680024716UL, 2112340059UL, 1372272974UL, 3295682653UL, 75966494UL, 3907378472UL, 2636491350UL, 3117471955UL, 3574915532UL, 2372987046UL, 2604001339UL, 3893075234UL, 915576383UL, 1280296085UL, 534929913UL, 3660102574UL, 2030233939UL, 346368350UL, 299776535UL, 987575186UL, 2566932710UL, 1566181275UL, 3535223896UL, 3874691533UL, 3731513754UL, 2581732444UL, 279715551UL, 2456894951UL, 3100791084UL, +2185866850UL, 1495277039UL, 3417305339UL, 1618871086UL, 1310351481UL, 4198538376UL, 2370669734UL, 391683868UL, 2009676005UL, 2749085130UL, 1400216510UL, 1864988335UL, 2925823809UL, 58955107UL, 3352814594UL, 2798390374UL, 1998600344UL, 1109346044UL, 3273979614UL, 1571752941UL, 1892535124UL, 2536620737UL, 1440068573UL, 1174168447UL, 2485033697UL, 329082740UL, 2077118779UL, 2858045339UL, 4062921629UL, 3837440666UL, 2644000449UL, 3550167006UL, +3728768059UL, 2642133401UL, 1176559812UL, 2140118619UL, 1412607307UL, 4081166331UL, 3124905304UL, 2902622972UL, 3804911318UL, 3142799969UL, 3154073676UL, 1449454613UL, 2403391233UL, 50297646UL, 2855791484UL, 793851407UL, 3514201526UL, 2351826747UL, 3324588195UL, 3291978358UL, 1584226715UL, 3636681672UL, 746876926UL, 3455625012UL, 2706009093UL, 1788578194UL, 3451519459UL, 3779307353UL, 3835380965UL, 4269115622UL, 2180305819UL, 3987989524UL, +2602235234UL, 2607142354UL, 853428184UL, 2436760738UL, 2151617107UL, 2066757692UL, 456808691UL, 4082489821UL, 741976046UL, 3590081269UL, 3001080633UL, 2722205042UL, 3203248679UL, 147312102UL, 3432947806UL, 89950260UL, 1950543946UL, 1932341300UL, 898396308UL, 3828432864UL, 947911286UL, 428616392UL, 3141601915UL, 276087167UL, 2517666433UL, 2583987247UL, 963534966UL, 2745818074UL, 1442953464UL, 2223986807UL, 4229124441UL, 229039300UL, +1338125300UL, 3642174036UL, 1053796945UL, 2472155633UL, 206115203UL, 3577092599UL, 627103363UL, 1113276084UL, 2586882739UL, 1492461846UL, 583522272UL, 189323282UL, 1490604990UL, 3501549884UL, 3552211807UL, 2757269706UL, 2392210091UL, 3545407532UL, 740675778UL, 810640644UL, 2632631469UL, 3085332665UL, 755862267UL, 3643289881UL, 922608790UL, 4043427793UL, 1803743084UL, 1954166630UL, 2213337398UL, 1785093944UL, 2613871529UL, 3810037031UL, +3042935707UL, 3162182177UL, 2791346436UL, 1901925289UL, 863100941UL, 3367519168UL, 1972623238UL, 3664303070UL, 604922059UL, 3026817982UL, 1436412310UL, 4096180631UL, 1597561857UL, 4206212303UL, 4127914332UL, 3228677359UL, 3985733659UL, 3597290113UL, 4251197894UL, 3451370603UL, 609679338UL, 3360835257UL, 1372239885UL, 638572328UL, 3806422284UL, 3974147336UL, 1804280837UL, 4209089291UL, 2021797469UL, 3557188838UL, 409727186UL, 2114649178UL, +687702120UL, 2542445992UL, 1235991799UL, 460479179UL, 2008348175UL, 887884478UL, 3942327811UL, 2999928223UL, 4171339789UL, 2286339235UL, 1293442231UL, 1575942850UL, 76122475UL, 1440527701UL, 2006558403UL, 1544148172UL, 895899367UL, 681826913UL, 4094701935UL, 3995413790UL, 1027509154UL, 2264990896UL, 1938238113UL, 213430250UL, 222469320UL, 609726517UL, 3581538106UL, 492802663UL, 120480843UL, 1720004062UL, 1132674507UL, 911082758UL, +2909148131UL, 566658805UL, 3964114445UL, 3483602509UL, 1793438750UL, 165562604UL, 3641830063UL, 2394205521UL, 3404874822UL, 1672998096UL, 916151953UL, 1141264477UL, 3171661340UL, 3803396219UL, 3018337382UL, 1863902683UL, 2474641928UL, 3250365071UL, 3897886220UL, 1219701051UL, 51332576UL, 1358614881UL, 1707407492UL, 3670647816UL, 923357625UL, 343687395UL, 3991339686UL, 3913575403UL, 1267727936UL, 4001357856UL, 3820224848UL, 2942896724UL, +3505936742UL, 1403285299UL, 1992762049UL, 567748449UL, 2202721585UL, 2781324216UL, 1724850068UL, 2408314541UL, 3073975813UL, 3992810029UL, 2475242354UL, 540562053UL, 2185198943UL, 3759352041UL, 3373885614UL, 1132999410UL, 1097554565UL, 4089342358UL, 3239542922UL, 2451748646UL, 407290679UL, 3188103200UL, 1708016248UL, 26848241UL, 2796711130UL, 3090711568UL, 4068389322UL, 3420916085UL, 3137567033UL, 2877819818UL, 22133454UL, 4629160UL, +3703695249UL, 1920151708UL, 1175452162UL, 130015299UL, 3331834713UL, 1099225384UL, 689254331UL, 1851083761UL, 2654970209UL, 3259297936UL, 3742819314UL, 3524284766UL, 2291819083UL, 3494031861UL, 16242889UL, 3545082774UL, 1997878108UL, 777447699UL, 4244916543UL, 3508640253UL, 3782278393UL, 2107258964UL, 2139074576UL, 1383217899UL, 2337934322UL, 3181899620UL, 1285955765UL, 2989610020UL, 3326862146UL, 1168587380UL, 801203532UL, 3020809957UL, +}, +{ +3810471203UL, 1017064446UL, 1595207573UL, 441087832UL, 3326746890UL, 3294064431UL, 167972517UL, 3625210015UL, 1011845006UL, 2980240819UL, 1778354660UL, 3041730987UL, 1598611350UL, 2015169745UL, 2321724978UL, 3390812967UL, 2432904511UL, 113261909UL, 3957193232UL, 3806115908UL, 2965828929UL, 2035392295UL, 3500116619UL, 2881232416UL, 1672212265UL, 1607201428UL, 425148945UL, 1262591961UL, 2221781268UL, 4215047456UL, 2148245850UL, 2787488981UL, +1077262192UL, 2085467561UL, 3053954888UL, 3584435116UL, 3013084787UL, 287099941UL, 1290407232UL, 4078552287UL, 2658945475UL, 4251530898UL, 2403086478UL, 2884923598UL, 3545110453UL, 4105390090UL, 343200643UL, 3189888821UL, 4086304363UL, 3466483195UL, 259435633UL, 2846377387UL, 497258846UL, 272775541UL, 985737911UL, 2957688879UL, 2180784344UL, 3434619542UL, 3643384838UL, 2228652440UL, 3107480718UL, 2208729807UL, 596436263UL, 3255120711UL, +3248886970UL, 519242965UL, 602979109UL, 1619614UL, 1391563565UL, 56262588UL, 1584463910UL, 1849038201UL, 728022295UL, 848624947UL, 1813827408UL, 428214945UL, 1246345586UL, 4213351865UL, 168985863UL, 456608054UL, 4277869380UL, 3886828599UL, 2264054549UL, 3110967170UL, 3138175314UL, 2649164828UL, 3369378320UL, 3648350039UL, 3524848759UL, 1468470706UL, 3558859222UL, 2669673235UL, 831851874UL, 4285651092UL, 4224147373UL, 1088456706UL, +231954609UL, 3118005852UL, 225508069UL, 883105389UL, 856371341UL, 2001356578UL, 639336670UL, 2363501707UL, 3622399552UL, 4024065226UL, 1093546838UL, 4263608561UL, 1852072422UL, 425195042UL, 2441102396UL, 296426333UL, 384641750UL, 3559334435UL, 1757327033UL, 1016016207UL, 3595686646UL, 24777793UL, 623926105UL, 2169195923UL, 1779396793UL, 646997837UL, 1459728476UL, 2644865980UL, 1994581089UL, 3956278544UL, 919592580UL, 2153558858UL, +2029633394UL, 3837501009UL, 4016560170UL, 484838096UL, 3652199054UL, 1971790561UL, 605295089UL, 637470291UL, 278970544UL, 3574824693UL, 295866521UL, 1755035156UL, 2542341803UL, 1588716357UL, 1502596918UL, 4124554133UL, 3547049843UL, 1768033045UL, 1531734630UL, 101448323UL, 3233017580UL, 1793222944UL, 3187853500UL, 186000900UL, 803444571UL, 2820254958UL, 2009384608UL, 2384668855UL, 2222812920UL, 633608665UL, 2028480056UL, 1258028235UL, +545095949UL, 3810471203UL, 1017064446UL, 1595207573UL, 441087832UL, 899068662UL, 3294064431UL, 167972517UL, 3625210015UL, 1011845006UL, 3951305793UL, 1778354660UL, 3041730987UL, 1598611350UL, 2015169745UL, 1885149424UL, 3390812967UL, 2432904511UL, 113261909UL, 3957193232UL, 3953443155UL, 2965828929UL, 2035392295UL, 3500116619UL, 2881232416UL, 329153573UL, 1607201428UL, 425148945UL, 1262591961UL, 2221781268UL, 78028761UL, 2148245850UL, +2787488981UL, 1077262192UL, 2085467561UL, 647235899UL, 3584435116UL, 3013084787UL, 287099941UL, 1290407232UL, 1467385694UL, 2658945475UL, 4251530898UL, 2403086478UL, 2884923598UL, 3489351040UL, 4105390090UL, 343200643UL, 3189888821UL, 4086304363UL, 3521512280UL, 259435633UL, 2846377387UL, 497258846UL, 272775541UL, 1367093111UL, 2957688879UL, 2180784344UL, 3434619542UL, 3643384838UL, 411877686UL, 3107480718UL, 2208729807UL, 596436263UL, +3255120711UL, 584605030UL, 519242965UL, 602979109UL, 1619614UL, 1391563565UL, 3902518209UL, 1584463910UL, 1849038201UL, 728022295UL, 848624947UL, 1932969318UL, 428214945UL, 1246345586UL, 4213351865UL, 168985863UL, 2770345237UL, 4277869380UL, 3886828599UL, 2264054549UL, 3110967170UL, 2953581033UL, 2649164828UL, 3369378320UL, 3648350039UL, 3524848759UL, 2380353977UL, 3558859222UL, 2669673235UL, 831851874UL, 4285651092UL, 1214052447UL, +1088456706UL, 231954609UL, 3118005852UL, 225508069UL, 1766983646UL, 856371341UL, 2001356578UL, 639336670UL, 2363501707UL, 1782816591UL, 4024065226UL, 1093546838UL, 4263608561UL, 1852072422UL, 1149716600UL, 2441102396UL, 296426333UL, 384641750UL, 3559334435UL, 2391309970UL, 1016016207UL, 3595686646UL, 24777793UL, 623926105UL, 362098678UL, 1779396793UL, 646997837UL, 1459728476UL, 2644865980UL, 3238673748UL, 3956278544UL, 919592580UL, +2153558858UL, 2029633394UL, 115778559UL, 4016560170UL, 484838096UL, 3652199054UL, 1971790561UL, 737357475UL, 637470291UL, 278970544UL, 3574824693UL, 295866521UL, 3989745853UL, 2542341803UL, 1588716357UL, 1502596918UL, 4124554133UL, 3016849744UL, 1768033045UL, 1531734630UL, 101448323UL, 3233017580UL, 4157527581UL, 3187853500UL, 186000900UL, 803444571UL, 2820254958UL, 1980528062UL, 2384668855UL, 2222812920UL, 633608665UL, 2028480056UL, +3166710281UL, 545095949UL, 3810471203UL, 1017064446UL, 1595207573UL, 693962828UL, 899068662UL, 3294064431UL, 167972517UL, 3625210015UL, 1486040398UL, 3951305793UL, 1778354660UL, 3041730987UL, 1598611350UL, 2859363132UL, 1885149424UL, 3390812967UL, 2432904511UL, 113261909UL, 664880478UL, 3953443155UL, 2965828929UL, 2035392295UL, 3500116619UL, 558081801UL, 329153573UL, 1607201428UL, 425148945UL, 1262591961UL, 3716247699UL, 78028761UL, +2148245850UL, 2787488981UL, 1077262192UL, 4206362947UL, 647235899UL, 3584435116UL, 3013084787UL, 287099941UL, 2536781098UL, 1467385694UL, 2658945475UL, 4251530898UL, 2403086478UL, 3075072413UL, 3489351040UL, 4105390090UL, 343200643UL, 3189888821UL, 2540485172UL, 3521512280UL, 259435633UL, 2846377387UL, 497258846UL, 2442427327UL, 1367093111UL, 2957688879UL, 2180784344UL, 3434619542UL, 1593967423UL, 411877686UL, 3107480718UL, 2208729807UL, +596436263UL, 1048686529UL, 584605030UL, 519242965UL, 602979109UL, 1619614UL, 2072745381UL, 3902518209UL, 1584463910UL, 1849038201UL, 728022295UL, 846033949UL, 1932969318UL, 428214945UL, 1246345586UL, 4213351865UL, 1066373275UL, 2770345237UL, 4277869380UL, 3886828599UL, 2264054549UL, 1877859690UL, 2953581033UL, 2649164828UL, 3369378320UL, 3648350039UL, 2537763389UL, 2380353977UL, 3558859222UL, 2669673235UL, 831851874UL, 522748140UL, +1214052447UL, 1088456706UL, 231954609UL, 3118005852UL, 1381269315UL, 1766983646UL, 856371341UL, 2001356578UL, 639336670UL, 667275675UL, 1782816591UL, 4024065226UL, 1093546838UL, 4263608561UL, 2057337961UL, 1149716600UL, 2441102396UL, 296426333UL, 384641750UL, 340523210UL, 2391309970UL, 1016016207UL, 3595686646UL, 24777793UL, 3094832341UL, 362098678UL, 1779396793UL, 646997837UL, 1459728476UL, 1169681568UL, 3238673748UL, 3956278544UL, +919592580UL, 2153558858UL, 388335108UL, 115778559UL, 4016560170UL, 484838096UL, 3652199054UL, 1764858181UL, 737357475UL, 637470291UL, 278970544UL, 3574824693UL, 3671458900UL, 3989745853UL, 2542341803UL, 1588716357UL, 1502596918UL, 2102871406UL, 3016849744UL, 1768033045UL, 1531734630UL, 101448323UL, 3964942332UL, 4157527581UL, 3187853500UL, 186000900UL, 803444571UL, 3425652083UL, 1980528062UL, 2384668855UL, 2222812920UL, 633608665UL, +3035373876UL, 3166710281UL, 545095949UL, 3810471203UL, 1017064446UL, 669282349UL, 693962828UL, 899068662UL, 3294064431UL, 167972517UL, 2007256988UL, 1486040398UL, 3951305793UL, 1778354660UL, 3041730987UL, 2827768941UL, 2859363132UL, 1885149424UL, 3390812967UL, 2432904511UL, 3700915653UL, 664880478UL, 3953443155UL, 2965828929UL, 2035392295UL, 1461208330UL, 558081801UL, 329153573UL, 1607201428UL, 425148945UL, 1700881129UL, 3716247699UL, +78028761UL, 2148245850UL, 2787488981UL, 2706775080UL, 4206362947UL, 647235899UL, 3584435116UL, 3013084787UL, 2958545221UL, 2536781098UL, 1467385694UL, 2658945475UL, 4251530898UL, 2241012567UL, 3075072413UL, 3489351040UL, 4105390090UL, 343200643UL, 490164649UL, 2540485172UL, 3521512280UL, 259435633UL, 2846377387UL, 4073611831UL, 2442427327UL, 1367093111UL, 2957688879UL, 2180784344UL, 1835510773UL, 1593967423UL, 411877686UL, 3107480718UL, +2208729807UL, 3306732468UL, 1048686529UL, 584605030UL, 519242965UL, 602979109UL, 2978864605UL, 2072745381UL, 3902518209UL, 1584463910UL, 1849038201UL, 3284115169UL, 846033949UL, 1932969318UL, 428214945UL, 1246345586UL, 194166002UL, 1066373275UL, 2770345237UL, 4277869380UL, 3886828599UL, 1874087886UL, 1877859690UL, 2953581033UL, 2649164828UL, 3369378320UL, 4145454028UL, 2537763389UL, 2380353977UL, 3558859222UL, 2669673235UL, 739345884UL, +522748140UL, 1214052447UL, 1088456706UL, 231954609UL, 3605603781UL, 1381269315UL, 1766983646UL, 856371341UL, 2001356578UL, 2049940324UL, 667275675UL, 1782816591UL, 4024065226UL, 1093546838UL, 152524382UL, 2057337961UL, 1149716600UL, 2441102396UL, 296426333UL, 3195130788UL, 340523210UL, 2391309970UL, 1016016207UL, 3595686646UL, 180492441UL, 3094832341UL, 362098678UL, 1779396793UL, 646997837UL, 2458167607UL, 1169681568UL, 3238673748UL, +3956278544UL, 919592580UL, 3421005218UL, 388335108UL, 115778559UL, 4016560170UL, 484838096UL, 2649676374UL, 1764858181UL, 737357475UL, 637470291UL, 278970544UL, 2236401278UL, 3671458900UL, 3989745853UL, 2542341803UL, 1588716357UL, 1241570134UL, 2102871406UL, 3016849744UL, 1768033045UL, 1531734630UL, 1765654724UL, 3964942332UL, 4157527581UL, 3187853500UL, 186000900UL, 2189716659UL, 3425652083UL, 1980528062UL, 2384668855UL, 2222812920UL, +3955466207UL, 2426547616UL, 3846752458UL, 3015538636UL, 2342593365UL, 3613176865UL, 3484860981UL, 4278370194UL, 1979143878UL, 1159739458UL, 3714038404UL, 396530346UL, 3276617756UL, 3293940597UL, 4050183149UL, 1418571985UL, 402563753UL, 2702853013UL, 2289900621UL, 2267058511UL, 3482161995UL, 3375026019UL, 1988640267UL, 3674438074UL, 4124612310UL, 1057883705UL, 434730475UL, 3210959778UL, 4102029739UL, 2140938750UL, 3176753074UL, 2356971512UL, +3969685288UL, 1556275580UL, 2648433428UL, 3959375381UL, 478841344UL, 1496991528UL, 3309714981UL, 569990368UL, 3660587501UL, 2550379574UL, 1177519842UL, 2652707373UL, 543943404UL, 1912551128UL, 2278132032UL, 1484596780UL, 3570913985UL, 2982401320UL, 1413776035UL, 3177275459UL, 3036211597UL, 1091740466UL, 3448424311UL, 1445187645UL, 3205024875UL, 3135795254UL, 823738729UL, 3742134467UL, 4066657438UL, 1226311678UL, 2403605393UL, 537573634UL, +3457409768UL, 1940233423UL, 1761431281UL, 1129427309UL, 2443661283UL, 3200814257UL, 4094866249UL, 2666869754UL, 604785127UL, 2213464116UL, 3002782918UL, 468024929UL, 2490681314UL, 3666681384UL, 1583346053UL, 3049668798UL, 3592153237UL, 2573082448UL, 3082970021UL, 1461796708UL, 832526980UL, 3728763274UL, 355291229UL, 4029588456UL, 832358279UL, 2125298737UL, 3681181038UL, 3245535160UL, 1333342738UL, 1868897492UL, 446790068UL, 1278093154UL, +2090118615UL, 4158925515UL, 4062165914UL, 822726809UL, 1154960183UL, 286518382UL, 1170424276UL, 2554691236UL, 3674133415UL, 2765714969UL, 2330865375UL, 1908307334UL, 3537287082UL, 410252600UL, 3977128218UL, 424210327UL, 2919071615UL, 2715518134UL, 64568844UL, 480972649UL, 2488797168UL, 1302817038UL, 2213995265UL, 4229997295UL, 2200797852UL, 109368057UL, 3033807022UL, 1907400078UL, 645977948UL, 1410909090UL, 3700787906UL, 3375062371UL, +629087832UL, 1344281719UL, 4249981139UL, 3457543297UL, 1218556849UL, 864222854UL, 1458445945UL, 914545469UL, 3451164212UL, 1088025757UL, 1129933985UL, 953788883UL, 2406172924UL, 170364546UL, 3505490646UL, 1027553899UL, 2864067776UL, 436854871UL, 1342782209UL, 761167471UL, 2660173631UL, 4159507498UL, 4172028400UL, 2442254644UL, 2110123720UL, 2315991253UL, 873066601UL, 1725470559UL, 3831299052UL, 678672031UL, 1585431329UL, 3495750550UL, +}, +{ +1998393432UL, 2665389278UL, 3989307699UL, 3267631636UL, 3861682977UL, 3243522970UL, 1243992413UL, 2200497260UL, 3821883021UL, 4187123083UL, 3451270040UL, 3044132745UL, 2101287249UL, 2340839784UL, 227040990UL, 1724350416UL, 3228881240UL, 3123386528UL, 4279362126UL, 3098224464UL, 2635534069UL, 3622906431UL, 206207480UL, 1894245533UL, 2152374527UL, 1011223653UL, 7271757UL, 2972858087UL, 207942127UL, 3355362797UL, 2593296740UL, 174093751UL, +3713822176UL, 4212355586UL, 3335605224UL, 1171716408UL, 2867257989UL, 1522213957UL, 2016192462UL, 4229688395UL, 2174928148UL, 1468226225UL, 3938290338UL, 493240317UL, 3229423344UL, 2585475729UL, 3112454413UL, 1881171707UL, 2555908056UL, 1997546352UL, 380428329UL, 3341885423UL, 3307510279UL, 3519476676UL, 3613100811UL, 2555826262UL, 109341943UL, 2382715395UL, 3883409616UL, 1593551879UL, 2163678014UL, 3379783137UL, 2810374300UL, 1516064864UL, +561144874UL, 316017838UL, 1899237567UL, 70857401UL, 3435185465UL, 4234661323UL, 2580352177UL, 32879620UL, 4171670150UL, 1986234067UL, 3589478191UL, 2073132526UL, 2603712175UL, 377997975UL, 2474419397UL, 3110698341UL, 812664089UL, 1778922726UL, 1686111212UL, 972784138UL, 3936486236UL, 2711468739UL, 423435866UL, 1661961159UL, 802312780UL, 1868728136UL, 1760295704UL, 3357409828UL, 215039860UL, 683184627UL, 4019111064UL, 3609261689UL, +2167554309UL, 1831085281UL, 3389357802UL, 4193421575UL, 628277197UL, 2900207619UL, 993609502UL, 3429627083UL, 2636466084UL, 3652352199UL, 1780133580UL, 1670387713UL, 4086070210UL, 4004540729UL, 783029246UL, 2165667566UL, 1739001057UL, 377639972UL, 1102689625UL, 1945278055UL, 3941185940UL, 3685368326UL, 1881761572UL, 2201338934UL, 801752UL, 2729497735UL, 492844690UL, 2998826141UL, 3844964457UL, 3679088359UL, 2196391660UL, 4222269404UL, +357321611UL, 3727170055UL, 1819614072UL, 2348798457UL, 4294366646UL, 1952884323UL, 3574345216UL, 2040734807UL, 232392443UL, 4183498179UL, 2614866055UL, 112120292UL, 3624018350UL, 3340709877UL, 3097507723UL, 1268833488UL, 3570501956UL, 3338260086UL, 293812421UL, 3683058169UL, 1147960351UL, 283731890UL, 2171233479UL, 1830154455UL, 4036602681UL, 1996981699UL, 132803834UL, 40256165UL, 2158110401UL, 3575159090UL, 3196553513UL, 3559872992UL, +3402884675UL, 1998393432UL, 2665389278UL, 3989307699UL, 3267631636UL, 3617519767UL, 3243522970UL, 1243992413UL, 2200497260UL, 3821883021UL, 3715729085UL, 3451270040UL, 3044132745UL, 2101287249UL, 2340839784UL, 3173635549UL, 1724350416UL, 3228881240UL, 3123386528UL, 4279362126UL, 2287520039UL, 2635534069UL, 3622906431UL, 206207480UL, 1894245533UL, 96723416UL, 1011223653UL, 7271757UL, 2972858087UL, 207942127UL, 1668335352UL, 2593296740UL, +174093751UL, 3713822176UL, 4212355586UL, 49226793UL, 1171716408UL, 2867257989UL, 1522213957UL, 2016192462UL, 118712412UL, 2174928148UL, 1468226225UL, 3938290338UL, 493240317UL, 3788174304UL, 2585475729UL, 3112454413UL, 1881171707UL, 2555908056UL, 3351139844UL, 380428329UL, 3341885423UL, 3307510279UL, 3519476676UL, 1368994724UL, 2555826262UL, 109341943UL, 2382715395UL, 3883409616UL, 1561509458UL, 2163678014UL, 3379783137UL, 2810374300UL, +1516064864UL, 2313252274UL, 316017838UL, 1899237567UL, 70857401UL, 3435185465UL, 2585770746UL, 2580352177UL, 32879620UL, 4171670150UL, 1986234067UL, 3317983509UL, 2073132526UL, 2603712175UL, 377997975UL, 2474419397UL, 908728599UL, 812664089UL, 1778922726UL, 1686111212UL, 972784138UL, 1992540005UL, 2711468739UL, 423435866UL, 1661961159UL, 802312780UL, 907108769UL, 1760295704UL, 3357409828UL, 215039860UL, 683184627UL, 2806826652UL, +3609261689UL, 2167554309UL, 1831085281UL, 3389357802UL, 2755692689UL, 628277197UL, 2900207619UL, 993609502UL, 3429627083UL, 3605915742UL, 3652352199UL, 1780133580UL, 1670387713UL, 4086070210UL, 3717326627UL, 783029246UL, 2165667566UL, 1739001057UL, 377639972UL, 2355216626UL, 1945278055UL, 3941185940UL, 3685368326UL, 1881761572UL, 4024097818UL, 801752UL, 2729497735UL, 492844690UL, 2998826141UL, 2719601647UL, 3679088359UL, 2196391660UL, +4222269404UL, 357321611UL, 1319821972UL, 1819614072UL, 2348798457UL, 4294366646UL, 1952884323UL, 3573866689UL, 2040734807UL, 232392443UL, 4183498179UL, 2614866055UL, 440744432UL, 3624018350UL, 3340709877UL, 3097507723UL, 1268833488UL, 224895395UL, 3338260086UL, 293812421UL, 3683058169UL, 1147960351UL, 3433425235UL, 2171233479UL, 1830154455UL, 4036602681UL, 1996981699UL, 2875889721UL, 40256165UL, 2158110401UL, 3575159090UL, 3196553513UL, +1094082574UL, 3402884675UL, 1998393432UL, 2665389278UL, 3989307699UL, 4068940467UL, 3617519767UL, 3243522970UL, 1243992413UL, 2200497260UL, 441678457UL, 3715729085UL, 3451270040UL, 3044132745UL, 2101287249UL, 2181502237UL, 3173635549UL, 1724350416UL, 3228881240UL, 3123386528UL, 1968352124UL, 2287520039UL, 2635534069UL, 3622906431UL, 206207480UL, 2065093599UL, 96723416UL, 1011223653UL, 7271757UL, 2972858087UL, 1094044749UL, 1668335352UL, +2593296740UL, 174093751UL, 3713822176UL, 2887397643UL, 49226793UL, 1171716408UL, 2867257989UL, 1522213957UL, 984348433UL, 118712412UL, 2174928148UL, 1468226225UL, 3938290338UL, 2279430036UL, 3788174304UL, 2585475729UL, 3112454413UL, 1881171707UL, 4247636500UL, 3351139844UL, 380428329UL, 3341885423UL, 3307510279UL, 2887754196UL, 1368994724UL, 2555826262UL, 109341943UL, 2382715395UL, 2836761616UL, 1561509458UL, 2163678014UL, 3379783137UL, +2810374300UL, 1635278016UL, 2313252274UL, 316017838UL, 1899237567UL, 70857401UL, 3481535811UL, 2585770746UL, 2580352177UL, 32879620UL, 4171670150UL, 2248003250UL, 3317983509UL, 2073132526UL, 2603712175UL, 377997975UL, 3286162818UL, 908728599UL, 812664089UL, 1778922726UL, 1686111212UL, 4024815755UL, 1992540005UL, 2711468739UL, 423435866UL, 1661961159UL, 2257259057UL, 907108769UL, 1760295704UL, 3357409828UL, 215039860UL, 3917391198UL, +2806826652UL, 3609261689UL, 2167554309UL, 1831085281UL, 4238043113UL, 2755692689UL, 628277197UL, 2900207619UL, 993609502UL, 2036092353UL, 3605915742UL, 3652352199UL, 1780133580UL, 1670387713UL, 118446953UL, 3717326627UL, 783029246UL, 2165667566UL, 1739001057UL, 203160626UL, 2355216626UL, 1945278055UL, 3941185940UL, 3685368326UL, 546361979UL, 4024097818UL, 801752UL, 2729497735UL, 492844690UL, 1023017124UL, 2719601647UL, 3679088359UL, +2196391660UL, 4222269404UL, 621859651UL, 1319821972UL, 1819614072UL, 2348798457UL, 4294366646UL, 1114888560UL, 3573866689UL, 2040734807UL, 232392443UL, 4183498179UL, 3959504609UL, 440744432UL, 3624018350UL, 3340709877UL, 3097507723UL, 3613295037UL, 224895395UL, 3338260086UL, 293812421UL, 3683058169UL, 1655305863UL, 3433425235UL, 2171233479UL, 1830154455UL, 4036602681UL, 3731384097UL, 2875889721UL, 40256165UL, 2158110401UL, 3575159090UL, +1847744924UL, 1094082574UL, 3402884675UL, 1998393432UL, 2665389278UL, 3781866777UL, 4068940467UL, 3617519767UL, 3243522970UL, 1243992413UL, 2723708256UL, 441678457UL, 3715729085UL, 3451270040UL, 3044132745UL, 4013832842UL, 2181502237UL, 3173635549UL, 1724350416UL, 3228881240UL, 2092292494UL, 1968352124UL, 2287520039UL, 2635534069UL, 3622906431UL, 3186333458UL, 2065093599UL, 96723416UL, 1011223653UL, 7271757UL, 649658033UL, 1094044749UL, +1668335352UL, 2593296740UL, 174093751UL, 4159420309UL, 2887397643UL, 49226793UL, 1171716408UL, 2867257989UL, 2590077953UL, 984348433UL, 118712412UL, 2174928148UL, 1468226225UL, 1065322711UL, 2279430036UL, 3788174304UL, 2585475729UL, 3112454413UL, 3932517386UL, 4247636500UL, 3351139844UL, 380428329UL, 3341885423UL, 1285273904UL, 2887754196UL, 1368994724UL, 2555826262UL, 109341943UL, 2318470582UL, 2836761616UL, 1561509458UL, 2163678014UL, +3379783137UL, 674658583UL, 1635278016UL, 2313252274UL, 316017838UL, 1899237567UL, 2192372173UL, 3481535811UL, 2585770746UL, 2580352177UL, 32879620UL, 300323274UL, 2248003250UL, 3317983509UL, 2073132526UL, 2603712175UL, 3086543917UL, 3286162818UL, 908728599UL, 812664089UL, 1778922726UL, 2263290659UL, 4024815755UL, 1992540005UL, 2711468739UL, 423435866UL, 819027349UL, 2257259057UL, 907108769UL, 1760295704UL, 3357409828UL, 1142221093UL, +3917391198UL, 2806826652UL, 3609261689UL, 2167554309UL, 4108155875UL, 4238043113UL, 2755692689UL, 628277197UL, 2900207619UL, 3041719497UL, 2036092353UL, 3605915742UL, 3652352199UL, 1780133580UL, 2397410862UL, 118446953UL, 3717326627UL, 783029246UL, 2165667566UL, 2721690354UL, 203160626UL, 2355216626UL, 1945278055UL, 3941185940UL, 2768842108UL, 546361979UL, 4024097818UL, 801752UL, 2729497735UL, 4045063232UL, 1023017124UL, 2719601647UL, +3679088359UL, 2196391660UL, 2666107451UL, 621859651UL, 1319821972UL, 1819614072UL, 2348798457UL, 3555102623UL, 1114888560UL, 3573866689UL, 2040734807UL, 232392443UL, 3359040541UL, 3959504609UL, 440744432UL, 3624018350UL, 3340709877UL, 1477919696UL, 3613295037UL, 224895395UL, 3338260086UL, 293812421UL, 4210187101UL, 1655305863UL, 3433425235UL, 2171233479UL, 1830154455UL, 4150241150UL, 3731384097UL, 2875889721UL, 40256165UL, 2158110401UL, +3350246687UL, 455561037UL, 2250400255UL, 3192153445UL, 3258870230UL, 1500391873UL, 4142878334UL, 1155955691UL, 1483275844UL, 4189436981UL, 323745948UL, 1976017426UL, 2804626790UL, 2717553615UL, 2315409034UL, 954508235UL, 3845175920UL, 3999878682UL, 1247696432UL, 1743319509UL, 2998248398UL, 3694350012UL, 4072006361UL, 191306987UL, 2816321878UL, 1324077734UL, 1083060006UL, 3406855480UL, 1619622379UL, 2160350UL, 3302238190UL, 3368021261UL, +3685228564UL, 3863934685UL, 771728612UL, 854205233UL, 2304696695UL, 421449207UL, 1265752117UL, 3852292419UL, 305345788UL, 1540622105UL, 1904883477UL, 833469256UL, 134406680UL, 3012455058UL, 4035477953UL, 2925192459UL, 1559200592UL, 3851612860UL, 718484562UL, 1377960276UL, 1586892849UL, 1361298269UL, 3417917896UL, 1281324499UL, 1012538763UL, 1350578667UL, 3946475598UL, 2982283954UL, 3548792804UL, 284542749UL, 1194648577UL, 3087899716UL, +3966595444UL, 2088330116UL, 3641652062UL, 327128507UL, 593906557UL, 1092448919UL, 2459189516UL, 4053392241UL, 3356198248UL, 2352376508UL, 470648997UL, 1017041256UL, 3234172340UL, 3928191489UL, 3266226858UL, 4219289150UL, 1229098319UL, 4275351308UL, 2720777751UL, 3566728718UL, 638322822UL, 2369792461UL, 2869492261UL, 3120083828UL, 1890399556UL, 3309991008UL, 3785452464UL, 4128660314UL, 3726791982UL, 167177896UL, 461294981UL, 3988638998UL, +2937794823UL, 3981029822UL, 1111681402UL, 2015965721UL, 7261806UL, 2669786265UL, 1083582734UL, 3270228881UL, 3892235938UL, 2695872715UL, 4246051290UL, 3214293333UL, 343604199UL, 3215604888UL, 661024127UL, 2931754053UL, 3787840039UL, 2053363765UL, 363432336UL, 112334132UL, 2871797223UL, 138911320UL, 3981126938UL, 2027332192UL, 1804730644UL, 590150270UL, 641538574UL, 6802174UL, 3551446076UL, 3908480472UL, 1004531022UL, 2097228524UL, +1919074232UL, 154482247UL, 121437972UL, 1215661323UL, 1178068273UL, 1097220699UL, 2823681422UL, 262636065UL, 2943371149UL, 1768780720UL, 3866040605UL, 1855991583UL, 3988248086UL, 629223947UL, 3380612330UL, 3552916762UL, 197596340UL, 573801686UL, 2049230598UL, 2910471867UL, 2686314264UL, 1726228846UL, 3516983332UL, 726840185UL, 1241204222UL, 2237574317UL, 70568042UL, 1932610099UL, 2221862221UL, 1510378092UL, 4050391637UL, 4077539568UL, +}, +{ +3872117793UL, 803220151UL, 70843412UL, 1661103032UL, 1976811457UL, 2186373604UL, 564259972UL, 1475436923UL, 2260980893UL, 4245534505UL, 1075107552UL, 3692990573UL, 370098873UL, 4045905424UL, 2420395420UL, 2332395402UL, 207483321UL, 622317750UL, 3004242500UL, 833623111UL, 3151161301UL, 1629139881UL, 352228793UL, 2439953368UL, 3183333619UL, 2703537080UL, 3218957129UL, 3164695888UL, 1741641842UL, 963394141UL, 4241612717UL, 1034476784UL, +2035880432UL, 3977821313UL, 1543311495UL, 3010014356UL, 1638490901UL, 2364265378UL, 3420329129UL, 333361555UL, 1133565821UL, 1450937015UL, 616059115UL, 3216393887UL, 3041978455UL, 3990855695UL, 1238628750UL, 512746184UL, 3256670217UL, 1616316512UL, 2791405051UL, 93474487UL, 2865892488UL, 1901471398UL, 2930857966UL, 2178431077UL, 2325598341UL, 3189256113UL, 1302432091UL, 808592927UL, 2945846737UL, 3487931071UL, 2018175258UL, 752981057UL, +1097082589UL, 1307115286UL, 175147508UL, 3611190164UL, 850238914UL, 3318706185UL, 199743319UL, 328621708UL, 3183670050UL, 3609998315UL, 4075306371UL, 3554549067UL, 2119566187UL, 1498503842UL, 1261870696UL, 2216745780UL, 950288337UL, 1117344941UL, 2150569143UL, 2899286760UL, 1594966374UL, 888858617UL, 35840654UL, 2829539211UL, 2511395669UL, 3607190544UL, 3278412778UL, 2249895907UL, 1320858068UL, 3576889788UL, 266766189UL, 1522426851UL, +1903494122UL, 1928370573UL, 2628132591UL, 3322025904UL, 220280169UL, 433606853UL, 1428961479UL, 986074592UL, 2128892987UL, 467697583UL, 1616913929UL, 325674890UL, 444442578UL, 649166208UL, 1689709565UL, 1493452467UL, 2222122038UL, 121114616UL, 2134348225UL, 3512035688UL, 1283058921UL, 4230441398UL, 3701238559UL, 337534132UL, 1418548715UL, 1190006478UL, 500654385UL, 1766924757UL, 1944680746UL, 940574010UL, 922744002UL, 186142284UL, +3131162902UL, 1693891092UL, 3031823448UL, 2143051534UL, 1429025284UL, 1487843160UL, 3606456133UL, 2079235652UL, 2447285474UL, 2669283767UL, 3232117829UL, 2490054343UL, 3225501736UL, 2911340385UL, 382319031UL, 1516937595UL, 622543191UL, 1388990570UL, 1749179860UL, 1924483707UL, 2593474505UL, 472539197UL, 122872799UL, 2586347240UL, 880588515UL, 4046335279UL, 1712182607UL, 4270737941UL, 1336703451UL, 3390078162UL, 382216945UL, 3733326081UL, +460422073UL, 3872117793UL, 803220151UL, 70843412UL, 1661103032UL, 250339760UL, 2186373604UL, 564259972UL, 1475436923UL, 2260980893UL, 657986735UL, 1075107552UL, 3692990573UL, 370098873UL, 4045905424UL, 3201950123UL, 2332395402UL, 207483321UL, 622317750UL, 3004242500UL, 3732213278UL, 3151161301UL, 1629139881UL, 352228793UL, 2439953368UL, 3572618926UL, 2703537080UL, 3218957129UL, 3164695888UL, 1741641842UL, 685933373UL, 4241612717UL, +1034476784UL, 2035880432UL, 3977821313UL, 3855995181UL, 3010014356UL, 1638490901UL, 2364265378UL, 3420329129UL, 2355603679UL, 1133565821UL, 1450937015UL, 616059115UL, 3216393887UL, 1733804102UL, 3990855695UL, 1238628750UL, 512746184UL, 3256670217UL, 2651059231UL, 2791405051UL, 93474487UL, 2865892488UL, 1901471398UL, 2113461797UL, 2178431077UL, 2325598341UL, 3189256113UL, 1302432091UL, 2986990416UL, 2945846737UL, 3487931071UL, 2018175258UL, +752981057UL, 2428033310UL, 1307115286UL, 175147508UL, 3611190164UL, 850238914UL, 1033628405UL, 199743319UL, 328621708UL, 3183670050UL, 3609998315UL, 4024297327UL, 3554549067UL, 2119566187UL, 1498503842UL, 1261870696UL, 290361143UL, 950288337UL, 1117344941UL, 2150569143UL, 2899286760UL, 168826051UL, 888858617UL, 35840654UL, 2829539211UL, 2511395669UL, 2890882060UL, 3278412778UL, 2249895907UL, 1320858068UL, 3576889788UL, 1794920145UL, +1522426851UL, 1903494122UL, 1928370573UL, 2628132591UL, 1251697758UL, 220280169UL, 433606853UL, 1428961479UL, 986074592UL, 2707115661UL, 467697583UL, 1616913929UL, 325674890UL, 444442578UL, 122781510UL, 1689709565UL, 1493452467UL, 2222122038UL, 121114616UL, 3425723636UL, 3512035688UL, 1283058921UL, 4230441398UL, 3701238559UL, 1646155473UL, 1418548715UL, 1190006478UL, 500654385UL, 1766924757UL, 3920475367UL, 940574010UL, 922744002UL, +186142284UL, 3131162902UL, 54639113UL, 3031823448UL, 2143051534UL, 1429025284UL, 1487843160UL, 4152687885UL, 2079235652UL, 2447285474UL, 2669283767UL, 3232117829UL, 1601035152UL, 3225501736UL, 2911340385UL, 382319031UL, 1516937595UL, 3508441679UL, 1388990570UL, 1749179860UL, 1924483707UL, 2593474505UL, 2835403456UL, 122872799UL, 2586347240UL, 880588515UL, 4046335279UL, 2958058367UL, 4270737941UL, 1336703451UL, 3390078162UL, 382216945UL, +450517882UL, 460422073UL, 3872117793UL, 803220151UL, 70843412UL, 2066343874UL, 250339760UL, 2186373604UL, 564259972UL, 1475436923UL, 1683787449UL, 657986735UL, 1075107552UL, 3692990573UL, 370098873UL, 2615082840UL, 3201950123UL, 2332395402UL, 207483321UL, 622317750UL, 2655424371UL, 3732213278UL, 3151161301UL, 1629139881UL, 352228793UL, 3236724760UL, 3572618926UL, 2703537080UL, 3218957129UL, 3164695888UL, 9775065UL, 685933373UL, +4241612717UL, 1034476784UL, 2035880432UL, 1621920075UL, 3855995181UL, 3010014356UL, 1638490901UL, 2364265378UL, 1509475888UL, 2355603679UL, 1133565821UL, 1450937015UL, 616059115UL, 3666188236UL, 1733804102UL, 3990855695UL, 1238628750UL, 512746184UL, 3900473826UL, 2651059231UL, 2791405051UL, 93474487UL, 2865892488UL, 222759186UL, 2113461797UL, 2178431077UL, 2325598341UL, 3189256113UL, 2505499508UL, 2986990416UL, 2945846737UL, 3487931071UL, +2018175258UL, 2766733928UL, 2428033310UL, 1307115286UL, 175147508UL, 3611190164UL, 1909211603UL, 1033628405UL, 199743319UL, 328621708UL, 3183670050UL, 1680331218UL, 4024297327UL, 3554549067UL, 2119566187UL, 1498503842UL, 3516256046UL, 290361143UL, 950288337UL, 1117344941UL, 2150569143UL, 3182619063UL, 168826051UL, 888858617UL, 35840654UL, 2829539211UL, 645798943UL, 2890882060UL, 3278412778UL, 2249895907UL, 1320858068UL, 1436708568UL, +1794920145UL, 1522426851UL, 1903494122UL, 1928370573UL, 3693049252UL, 1251697758UL, 220280169UL, 433606853UL, 1428961479UL, 3724415861UL, 2707115661UL, 467697583UL, 1616913929UL, 325674890UL, 1448052253UL, 122781510UL, 1689709565UL, 1493452467UL, 2222122038UL, 2177448198UL, 3425723636UL, 3512035688UL, 1283058921UL, 4230441398UL, 3050940272UL, 1646155473UL, 1418548715UL, 1190006478UL, 500654385UL, 1106232UL, 3920475367UL, 940574010UL, +922744002UL, 186142284UL, 4144806511UL, 54639113UL, 3031823448UL, 2143051534UL, 1429025284UL, 2067453848UL, 4152687885UL, 2079235652UL, 2447285474UL, 2669283767UL, 428527087UL, 1601035152UL, 3225501736UL, 2911340385UL, 382319031UL, 2565464472UL, 3508441679UL, 1388990570UL, 1749179860UL, 1924483707UL, 1737735237UL, 2835403456UL, 122872799UL, 2586347240UL, 880588515UL, 597822462UL, 2958058367UL, 4270737941UL, 1336703451UL, 3390078162UL, +2532634475UL, 450517882UL, 460422073UL, 3872117793UL, 803220151UL, 801648827UL, 2066343874UL, 250339760UL, 2186373604UL, 564259972UL, 3417948976UL, 1683787449UL, 657986735UL, 1075107552UL, 3692990573UL, 2235306692UL, 2615082840UL, 3201950123UL, 2332395402UL, 207483321UL, 699310933UL, 2655424371UL, 3732213278UL, 3151161301UL, 1629139881UL, 1152704006UL, 3236724760UL, 3572618926UL, 2703537080UL, 3218957129UL, 2726926336UL, 9775065UL, +685933373UL, 4241612717UL, 1034476784UL, 2398119652UL, 1621920075UL, 3855995181UL, 3010014356UL, 1638490901UL, 252854480UL, 1509475888UL, 2355603679UL, 1133565821UL, 1450937015UL, 2655911639UL, 3666188236UL, 1733804102UL, 3990855695UL, 1238628750UL, 1115900497UL, 3900473826UL, 2651059231UL, 2791405051UL, 93474487UL, 1862985957UL, 222759186UL, 2113461797UL, 2178431077UL, 2325598341UL, 4179075132UL, 2505499508UL, 2986990416UL, 2945846737UL, +3487931071UL, 564667776UL, 2766733928UL, 2428033310UL, 1307115286UL, 175147508UL, 1759077815UL, 1909211603UL, 1033628405UL, 199743319UL, 328621708UL, 2552816198UL, 1680331218UL, 4024297327UL, 3554549067UL, 2119566187UL, 2267805778UL, 3516256046UL, 290361143UL, 950288337UL, 1117344941UL, 2897506172UL, 3182619063UL, 168826051UL, 888858617UL, 35840654UL, 2035476068UL, 645798943UL, 2890882060UL, 3278412778UL, 2249895907UL, 3278449102UL, +1436708568UL, 1794920145UL, 1522426851UL, 1903494122UL, 1500763736UL, 3693049252UL, 1251697758UL, 220280169UL, 433606853UL, 3914497854UL, 3724415861UL, 2707115661UL, 467697583UL, 1616913929UL, 918435305UL, 1448052253UL, 122781510UL, 1689709565UL, 1493452467UL, 609575172UL, 2177448198UL, 3425723636UL, 3512035688UL, 1283058921UL, 3661181550UL, 3050940272UL, 1646155473UL, 1418548715UL, 1190006478UL, 1047301661UL, 1106232UL, 3920475367UL, +940574010UL, 922744002UL, 2510633517UL, 4144806511UL, 54639113UL, 3031823448UL, 2143051534UL, 3242814908UL, 2067453848UL, 4152687885UL, 2079235652UL, 2447285474UL, 736638210UL, 428527087UL, 1601035152UL, 3225501736UL, 2911340385UL, 1849570436UL, 2565464472UL, 3508441679UL, 1388990570UL, 1749179860UL, 84517579UL, 1737735237UL, 2835403456UL, 122872799UL, 2586347240UL, 4002124614UL, 597822462UL, 2958058367UL, 4270737941UL, 1336703451UL, +3078170472UL, 1186434751UL, 700631413UL, 1497890797UL, 1195347450UL, 2560167391UL, 1116697259UL, 1254138573UL, 747913260UL, 240954704UL, 3107512667UL, 360584144UL, 3422778960UL, 3516528389UL, 3301260366UL, 1254513537UL, 122269053UL, 1579582456UL, 873334104UL, 3918835024UL, 1731872444UL, 1974410416UL, 1811172641UL, 4172523062UL, 4092675777UL, 4124987343UL, 1936078756UL, 1757348689UL, 2694415512UL, 128641660UL, 1744777659UL, 3173116729UL, +983733754UL, 1430789547UL, 701906842UL, 3367232568UL, 3266433501UL, 3572590347UL, 1453272962UL, 2106553114UL, 993786201UL, 2149441250UL, 1295181065UL, 2962229026UL, 3709052556UL, 3255608941UL, 3677730029UL, 483873127UL, 102227292UL, 2626265293UL, 2018984578UL, 2266388762UL, 1191709548UL, 2152725916UL, 583672623UL, 2230473473UL, 1995194269UL, 1740347812UL, 2558095372UL, 3070195183UL, 3023333227UL, 2497183195UL, 1908755188UL, 773027539UL, +3646876518UL, 2272586839UL, 493318726UL, 2107067517UL, 2000805278UL, 2530829636UL, 3183628745UL, 677565332UL, 1497629423UL, 82094920UL, 2214054433UL, 2635367545UL, 470855467UL, 2184853389UL, 2942188934UL, 188335670UL, 3656661644UL, 1883526235UL, 3990873975UL, 1490784356UL, 4047548172UL, 3149642641UL, 3289988179UL, 2590918909UL, 2893039564UL, 2350687346UL, 4252624874UL, 15372456UL, 1614496594UL, 2364847678UL, 2604511825UL, 422365460UL, +4195174772UL, 3266964836UL, 2008671995UL, 54038434UL, 781948549UL, 1276017666UL, 2756376612UL, 2436825273UL, 1711863836UL, 3541493950UL, 3821378841UL, 1007557618UL, 345375815UL, 2081905201UL, 2227278118UL, 1185927141UL, 1082173792UL, 3567361925UL, 1940465859UL, 541632942UL, 1830210248UL, 3757851982UL, 775883450UL, 1666577465UL, 1004944607UL, 878440834UL, 2146344131UL, 4195798476UL, 370164841UL, 3649112729UL, 37066142UL, 2311278904UL, +1935745497UL, 2304799402UL, 4107299626UL, 1348526232UL, 2473609635UL, 3284032699UL, 2374292786UL, 1762329186UL, 857978496UL, 1039346432UL, 2621413355UL, 29961014UL, 3582263091UL, 4268542513UL, 3890612190UL, 3096173646UL, 2026544230UL, 3856142618UL, 2347115934UL, 319800326UL, 3255916105UL, 2430273059UL, 823505311UL, 874255188UL, 1401925393UL, 4203707857UL, 4259159566UL, 2606881118UL, 1978288664UL, 1447576038UL, 3860341401UL, 412510348UL, +}, +{ +4052471963UL, 683640040UL, 3043876021UL, 3466644483UL, 4222418025UL, 3035140128UL, 1466027937UL, 18198088UL, 3410320851UL, 3040963721UL, 488404231UL, 3157371815UL, 769336092UL, 3240417718UL, 808582581UL, 2075839263UL, 835026995UL, 3123726486UL, 3284240985UL, 1898453053UL, 3606056482UL, 512836002UL, 2715428547UL, 4182302879UL, 1644882480UL, 3160187826UL, 390292489UL, 980889545UL, 2776206633UL, 2482799995UL, 617042280UL, 3501667414UL, +689451808UL, 497018701UL, 238525753UL, 3890163301UL, 896679896UL, 1544533015UL, 3412477225UL, 3116575138UL, 4250402651UL, 3990990746UL, 819056741UL, 1459334146UL, 158377590UL, 3444755752UL, 8230450UL, 1378706455UL, 684191332UL, 3217423797UL, 2842520097UL, 1631477948UL, 2591254230UL, 959644473UL, 1020694107UL, 1748401915UL, 3452514983UL, 3892766171UL, 1227786994UL, 2086180800UL, 2394613217UL, 2091953150UL, 870094953UL, 2306851481UL, +571550601UL, 488878212UL, 873197214UL, 2630100528UL, 2067476907UL, 2162307009UL, 2026119728UL, 115875280UL, 2905867426UL, 248774881UL, 3110900450UL, 2236032812UL, 1888510348UL, 708001855UL, 996960491UL, 3514196956UL, 1407967546UL, 1826568876UL, 3659618284UL, 2614104317UL, 2230066308UL, 1055135881UL, 2537437343UL, 1858044413UL, 2608594891UL, 2750681169UL, 3241939420UL, 3966440877UL, 2375002886UL, 2417753441UL, 1405878685UL, 1081133199UL, +1496940727UL, 382467042UL, 2745477587UL, 1209424459UL, 811187075UL, 1385604734UL, 2623887355UL, 3443875720UL, 394141555UL, 4142998949UL, 4195414618UL, 1489846841UL, 2253433808UL, 1171450286UL, 84131191UL, 4387588UL, 2641405140UL, 3525405389UL, 3273000909UL, 423660319UL, 2366546732UL, 3698878607UL, 2161119729UL, 4263629085UL, 3029102089UL, 2692507376UL, 3266869596UL, 1658012061UL, 1960169440UL, 1002311379UL, 3724446882UL, 2004188516UL, +999513506UL, 2200093802UL, 4141037460UL, 351865836UL, 412875013UL, 1535823315UL, 3880657632UL, 3109944987UL, 3207577548UL, 3462087941UL, 584875517UL, 2635241084UL, 3834145971UL, 1693380373UL, 3524443732UL, 934775214UL, 1960588847UL, 2226778032UL, 1044609478UL, 12199016UL, 1120582000UL, 226430296UL, 665553142UL, 2570993348UL, 1685535237UL, 3325420136UL, 3925248326UL, 2855346376UL, 1205558328UL, 808835317UL, 3295908896UL, 4170076136UL, +2438272365UL, 4052471963UL, 683640040UL, 3043876021UL, 3466644483UL, 1385549869UL, 3035140128UL, 1466027937UL, 18198088UL, 3410320851UL, 2171386836UL, 488404231UL, 3157371815UL, 769336092UL, 3240417718UL, 2921774554UL, 2075839263UL, 835026995UL, 3123726486UL, 3284240985UL, 72352110UL, 3606056482UL, 512836002UL, 2715428547UL, 4182302879UL, 3869483469UL, 3160187826UL, 390292489UL, 980889545UL, 2776206633UL, 1385691983UL, 617042280UL, +3501667414UL, 689451808UL, 497018701UL, 2600411809UL, 3890163301UL, 896679896UL, 1544533015UL, 3412477225UL, 356556378UL, 4250402651UL, 3990990746UL, 819056741UL, 1459334146UL, 199003993UL, 3444755752UL, 8230450UL, 1378706455UL, 684191332UL, 1750733272UL, 2842520097UL, 1631477948UL, 2591254230UL, 959644473UL, 2113375576UL, 1748401915UL, 3452514983UL, 3892766171UL, 1227786994UL, 275473920UL, 2394613217UL, 2091953150UL, 870094953UL, +2306851481UL, 897057645UL, 488878212UL, 873197214UL, 2630100528UL, 2067476907UL, 944114068UL, 2026119728UL, 115875280UL, 2905867426UL, 248774881UL, 989201307UL, 2236032812UL, 1888510348UL, 708001855UL, 996960491UL, 2121706374UL, 1407967546UL, 1826568876UL, 3659618284UL, 2614104317UL, 2931815032UL, 1055135881UL, 2537437343UL, 1858044413UL, 2608594891UL, 1423973935UL, 3241939420UL, 3966440877UL, 2375002886UL, 2417753441UL, 2514473440UL, +1081133199UL, 1496940727UL, 382467042UL, 2745477587UL, 81977310UL, 811187075UL, 1385604734UL, 2623887355UL, 3443875720UL, 2100629879UL, 4142998949UL, 4195414618UL, 1489846841UL, 2253433808UL, 337182869UL, 84131191UL, 4387588UL, 2641405140UL, 3525405389UL, 661876463UL, 423660319UL, 2366546732UL, 3698878607UL, 2161119729UL, 309510684UL, 3029102089UL, 2692507376UL, 3266869596UL, 1658012061UL, 11119541UL, 1002311379UL, 3724446882UL, +2004188516UL, 999513506UL, 3486722046UL, 4141037460UL, 351865836UL, 412875013UL, 1535823315UL, 2818130700UL, 3109944987UL, 3207577548UL, 3462087941UL, 584875517UL, 322875622UL, 3834145971UL, 1693380373UL, 3524443732UL, 934775214UL, 3879414752UL, 2226778032UL, 1044609478UL, 12199016UL, 1120582000UL, 4207259464UL, 665553142UL, 2570993348UL, 1685535237UL, 3325420136UL, 553869152UL, 2855346376UL, 1205558328UL, 808835317UL, 3295908896UL, +470585896UL, 2438272365UL, 4052471963UL, 683640040UL, 3043876021UL, 1588419572UL, 1385549869UL, 3035140128UL, 1466027937UL, 18198088UL, 363815288UL, 2171386836UL, 488404231UL, 3157371815UL, 769336092UL, 2464768302UL, 2921774554UL, 2075839263UL, 835026995UL, 3123726486UL, 4229246330UL, 72352110UL, 3606056482UL, 512836002UL, 2715428547UL, 319830805UL, 3869483469UL, 3160187826UL, 390292489UL, 980889545UL, 2966401462UL, 1385691983UL, +617042280UL, 3501667414UL, 689451808UL, 4047377762UL, 2600411809UL, 3890163301UL, 896679896UL, 1544533015UL, 764316452UL, 356556378UL, 4250402651UL, 3990990746UL, 819056741UL, 965331966UL, 199003993UL, 3444755752UL, 8230450UL, 1378706455UL, 51902971UL, 1750733272UL, 2842520097UL, 1631477948UL, 2591254230UL, 426039404UL, 2113375576UL, 1748401915UL, 3452514983UL, 3892766171UL, 2833368447UL, 275473920UL, 2394613217UL, 2091953150UL, +870094953UL, 3524323828UL, 897057645UL, 488878212UL, 873197214UL, 2630100528UL, 3939852929UL, 944114068UL, 2026119728UL, 115875280UL, 2905867426UL, 3192643919UL, 989201307UL, 2236032812UL, 1888510348UL, 708001855UL, 2166012172UL, 2121706374UL, 1407967546UL, 1826568876UL, 3659618284UL, 135277096UL, 2931815032UL, 1055135881UL, 2537437343UL, 1858044413UL, 2588429924UL, 1423973935UL, 3241939420UL, 3966440877UL, 2375002886UL, 2477142003UL, +2514473440UL, 1081133199UL, 1496940727UL, 382467042UL, 1760129281UL, 81977310UL, 811187075UL, 1385604734UL, 2623887355UL, 4070531513UL, 2100629879UL, 4142998949UL, 4195414618UL, 1489846841UL, 2688068550UL, 337182869UL, 84131191UL, 4387588UL, 2641405140UL, 1837403234UL, 661876463UL, 423660319UL, 2366546732UL, 3698878607UL, 2916121190UL, 309510684UL, 3029102089UL, 2692507376UL, 3266869596UL, 303422295UL, 11119541UL, 1002311379UL, +3724446882UL, 2004188516UL, 2652711421UL, 3486722046UL, 4141037460UL, 351865836UL, 412875013UL, 113149471UL, 2818130700UL, 3109944987UL, 3207577548UL, 3462087941UL, 1443140792UL, 322875622UL, 3834145971UL, 1693380373UL, 3524443732UL, 901891935UL, 3879414752UL, 2226778032UL, 1044609478UL, 12199016UL, 2213168758UL, 4207259464UL, 665553142UL, 2570993348UL, 1685535237UL, 1114492412UL, 553869152UL, 2855346376UL, 1205558328UL, 808835317UL, +3266626294UL, 470585896UL, 2438272365UL, 4052471963UL, 683640040UL, 3581539398UL, 1588419572UL, 1385549869UL, 3035140128UL, 1466027937UL, 4075470388UL, 363815288UL, 2171386836UL, 488404231UL, 3157371815UL, 2759472233UL, 2464768302UL, 2921774554UL, 2075839263UL, 835026995UL, 1030654310UL, 4229246330UL, 72352110UL, 3606056482UL, 512836002UL, 961858496UL, 319830805UL, 3869483469UL, 3160187826UL, 390292489UL, 2366221117UL, 2966401462UL, +1385691983UL, 617042280UL, 3501667414UL, 295865937UL, 4047377762UL, 2600411809UL, 3890163301UL, 896679896UL, 21714884UL, 764316452UL, 356556378UL, 4250402651UL, 3990990746UL, 1012967081UL, 965331966UL, 199003993UL, 3444755752UL, 8230450UL, 1255302023UL, 51902971UL, 1750733272UL, 2842520097UL, 1631477948UL, 2321320272UL, 426039404UL, 2113375576UL, 1748401915UL, 3452514983UL, 2847013518UL, 2833368447UL, 275473920UL, 2394613217UL, +2091953150UL, 1250695522UL, 3524323828UL, 897057645UL, 488878212UL, 873197214UL, 1452317325UL, 3939852929UL, 944114068UL, 2026119728UL, 115875280UL, 4061820350UL, 3192643919UL, 989201307UL, 2236032812UL, 1888510348UL, 3986446165UL, 2166012172UL, 2121706374UL, 1407967546UL, 1826568876UL, 2910745432UL, 135277096UL, 2931815032UL, 1055135881UL, 2537437343UL, 2976455307UL, 2588429924UL, 1423973935UL, 3241939420UL, 3966440877UL, 2418897705UL, +2477142003UL, 2514473440UL, 1081133199UL, 1496940727UL, 1321648771UL, 1760129281UL, 81977310UL, 811187075UL, 1385604734UL, 17644628UL, 4070531513UL, 2100629879UL, 4142998949UL, 4195414618UL, 2697310527UL, 2688068550UL, 337182869UL, 84131191UL, 4387588UL, 1724191700UL, 1837403234UL, 661876463UL, 423660319UL, 2366546732UL, 693430992UL, 2916121190UL, 309510684UL, 3029102089UL, 2692507376UL, 3917396098UL, 303422295UL, 11119541UL, +1002311379UL, 3724446882UL, 841468294UL, 2652711421UL, 3486722046UL, 4141037460UL, 351865836UL, 1733384185UL, 113149471UL, 2818130700UL, 3109944987UL, 3207577548UL, 2326233100UL, 1443140792UL, 322875622UL, 3834145971UL, 1693380373UL, 1580706359UL, 901891935UL, 3879414752UL, 2226778032UL, 1044609478UL, 3805470822UL, 2213168758UL, 4207259464UL, 665553142UL, 2570993348UL, 3406548636UL, 1114492412UL, 553869152UL, 2855346376UL, 1205558328UL, +4287831475UL, 1329654114UL, 2347235746UL, 2477803138UL, 2962371859UL, 3610024283UL, 4197266903UL, 1162294689UL, 1746713323UL, 2815058477UL, 2152552186UL, 4214791071UL, 2382522482UL, 3713914466UL, 3974765132UL, 348354997UL, 1670276150UL, 2173074887UL, 381736894UL, 3866219357UL, 1919366695UL, 3635118824UL, 2298653261UL, 3534332682UL, 1627699897UL, 4168636618UL, 3787938690UL, 2144231271UL, 2067679462UL, 217001062UL, 2308928337UL, 1620415125UL, +3526559172UL, 749451561UL, 2456947371UL, 3543607786UL, 1893824735UL, 962598819UL, 2332807164UL, 1691114891UL, 2543992233UL, 2914780639UL, 1610287145UL, 1700599697UL, 3185174208UL, 552323208UL, 2367242224UL, 3797136972UL, 3415066418UL, 2468049249UL, 1677937401UL, 40445671UL, 2886682530UL, 2585715434UL, 194932329UL, 2994003812UL, 3099556382UL, 680852222UL, 135838738UL, 1371063256UL, 995454898UL, 3754526418UL, 803635682UL, 634588682UL, +3869250783UL, 2442285521UL, 1455637058UL, 570621479UL, 2512681851UL, 1220136924UL, 750260121UL, 2909903038UL, 1582019728UL, 955115170UL, 1608265445UL, 2157390890UL, 2303678604UL, 1568394164UL, 831914289UL, 1971271392UL, 1294799854UL, 1489945167UL, 442427880UL, 1305083700UL, 1211218668UL, 2380073713UL, 2798736785UL, 2193524273UL, 3227386915UL, 1636588977UL, 3612937642UL, 435113647UL, 1591761830UL, 536210039UL, 2475747073UL, 4223795480UL, +1786737271UL, 1444661534UL, 3249410301UL, 3333695212UL, 4169107188UL, 3280638635UL, 702659930UL, 1444127970UL, 225340755UL, 2255629368UL, 746584456UL, 3965677674UL, 2671132955UL, 2080717656UL, 2145343886UL, 3712441197UL, 368422910UL, 1297685674UL, 4076123901UL, 26214470UL, 2948764826UL, 40503299UL, 1198194334UL, 2100063637UL, 1966331612UL, 2189582064UL, 2064696934UL, 1797550642UL, 3469793941UL, 2868963812UL, 851437659UL, 240918534UL, +365060070UL, 3530600064UL, 39695324UL, 1753898837UL, 1286976449UL, 3131971360UL, 2406485219UL, 3365373704UL, 3224113403UL, 1651742834UL, 587601940UL, 1574206085UL, 3739575036UL, 1413669616UL, 38172232UL, 293127854UL, 4126190109UL, 1891744061UL, 787878666UL, 456643669UL, 4228710325UL, 2025132037UL, 1492133135UL, 3122840937UL, 969442079UL, 3272420439UL, 3836126369UL, 1877655562UL, 2766212758UL, 3867984746UL, 3348077578UL, 1841216706UL, +}, +{ +1676507466UL, 1017841240UL, 2992644565UL, 476936158UL, 2468072723UL, 3113105154UL, 1154120402UL, 460889625UL, 1942263502UL, 1761593999UL, 3020908939UL, 3078194866UL, 310971889UL, 1644896012UL, 3756044556UL, 3549937583UL, 3710822994UL, 3554313733UL, 2174654326UL, 4251063242UL, 2340485150UL, 950951909UL, 4288936895UL, 3744348848UL, 706644559UL, 1085927825UL, 1595992020UL, 3288724966UL, 1367247946UL, 2950094970UL, 3925419886UL, 2628739022UL, +2528254629UL, 3582224789UL, 3907345559UL, 3373329273UL, 4255542251UL, 1185418446UL, 4018656113UL, 2854344020UL, 1381160022UL, 3642438773UL, 4284399225UL, 935780030UL, 4142412144UL, 1263328494UL, 1154237693UL, 2684443667UL, 3067549398UL, 4253090033UL, 1251034970UL, 1874233020UL, 3222830495UL, 3866931656UL, 286048055UL, 3146635362UL, 1436483376UL, 2821876495UL, 3927829532UL, 2648886905UL, 2142862852UL, 1368937545UL, 2647327844UL, 1072219385UL, +2621337706UL, 3543274652UL, 911792564UL, 1204178178UL, 4127214323UL, 2821691380UL, 3101998294UL, 730811902UL, 1989156224UL, 2872353003UL, 278290276UL, 1390223786UL, 2657819643UL, 552729795UL, 1736270535UL, 2759207116UL, 1897013739UL, 3657020278UL, 1387364861UL, 1966588302UL, 1049203087UL, 486446521UL, 3675999281UL, 714737345UL, 686837530UL, 85509025UL, 3609089773UL, 2117061768UL, 3935682560UL, 3859508784UL, 4105287041UL, 1808988481UL, +83680601UL, 1464326680UL, 1657693523UL, 3318062731UL, 1391154023UL, 234460119UL, 3551348221UL, 2245244809UL, 3635923821UL, 2814385745UL, 3497626257UL, 916790795UL, 245338628UL, 2514528380UL, 3711787525UL, 2239286063UL, 1054058916UL, 3963706010UL, 3176203796UL, 2230543409UL, 2173597546UL, 3786733892UL, 1396036965UL, 1038764273UL, 2032556038UL, 3216540537UL, 3298170974UL, 1008892557UL, 141155464UL, 1863766055UL, 3931110690UL, 191299053UL, +2019139711UL, 2409528317UL, 739418419UL, 1377144055UL, 2876702705UL, 3911939673UL, 1197696462UL, 2814009721UL, 600813233UL, 1535885024UL, 1486280357UL, 3084650548UL, 2324695947UL, 2293284974UL, 2036339249UL, 3465600153UL, 1624446108UL, 327866771UL, 3356772175UL, 1826625240UL, 1947102360UL, 3661848193UL, 1421374867UL, 3228945021UL, 1358646008UL, 1067180174UL, 2190741258UL, 643362354UL, 109899594UL, 2064362635UL, 3249674888UL, 2165543887UL, +4180291913UL, 1676507466UL, 1017841240UL, 2992644565UL, 476936158UL, 3608467942UL, 3113105154UL, 1154120402UL, 460889625UL, 1942263502UL, 1862994005UL, 3020908939UL, 3078194866UL, 310971889UL, 1644896012UL, 693774191UL, 3549937583UL, 3710822994UL, 3554313733UL, 2174654326UL, 37658897UL, 2340485150UL, 950951909UL, 4288936895UL, 3744348848UL, 2258231402UL, 1085927825UL, 1595992020UL, 3288724966UL, 1367247946UL, 3850509554UL, 3925419886UL, +2628739022UL, 2528254629UL, 3582224789UL, 3124287811UL, 3373329273UL, 4255542251UL, 1185418446UL, 4018656113UL, 1989726178UL, 1381160022UL, 3642438773UL, 4284399225UL, 935780030UL, 3622052196UL, 1263328494UL, 1154237693UL, 2684443667UL, 3067549398UL, 2786224913UL, 1251034970UL, 1874233020UL, 3222830495UL, 3866931656UL, 1529490307UL, 3146635362UL, 1436483376UL, 2821876495UL, 3927829532UL, 979247444UL, 2142862852UL, 1368937545UL, 2647327844UL, +1072219385UL, 294065371UL, 3543274652UL, 911792564UL, 1204178178UL, 4127214323UL, 103582737UL, 3101998294UL, 730811902UL, 1989156224UL, 2872353003UL, 1885087777UL, 1390223786UL, 2657819643UL, 552729795UL, 1736270535UL, 3325206451UL, 1897013739UL, 3657020278UL, 1387364861UL, 1966588302UL, 2117065739UL, 486446521UL, 3675999281UL, 714737345UL, 686837530UL, 3946214694UL, 3609089773UL, 2117061768UL, 3935682560UL, 3859508784UL, 2916136885UL, +1808988481UL, 83680601UL, 1464326680UL, 1657693523UL, 3438751781UL, 1391154023UL, 234460119UL, 3551348221UL, 2245244809UL, 3948410079UL, 2814385745UL, 3497626257UL, 916790795UL, 245338628UL, 1767303496UL, 3711787525UL, 2239286063UL, 1054058916UL, 3963706010UL, 4140631909UL, 2230543409UL, 2173597546UL, 3786733892UL, 1396036965UL, 1116033475UL, 2032556038UL, 3216540537UL, 3298170974UL, 1008892557UL, 667272562UL, 1863766055UL, 3931110690UL, +191299053UL, 2019139711UL, 272901326UL, 739418419UL, 1377144055UL, 2876702705UL, 3911939673UL, 3839312742UL, 2814009721UL, 600813233UL, 1535885024UL, 1486280357UL, 4256065219UL, 2324695947UL, 2293284974UL, 2036339249UL, 3465600153UL, 1215859603UL, 327866771UL, 3356772175UL, 1826625240UL, 1947102360UL, 4240407984UL, 1421374867UL, 3228945021UL, 1358646008UL, 1067180174UL, 4100357988UL, 643362354UL, 109899594UL, 2064362635UL, 3249674888UL, +2898852084UL, 4180291913UL, 1676507466UL, 1017841240UL, 2992644565UL, 1569683812UL, 3608467942UL, 3113105154UL, 1154120402UL, 460889625UL, 966040649UL, 1862994005UL, 3020908939UL, 3078194866UL, 310971889UL, 786634113UL, 693774191UL, 3549937583UL, 3710822994UL, 3554313733UL, 1578429713UL, 37658897UL, 2340485150UL, 950951909UL, 4288936895UL, 2528123823UL, 2258231402UL, 1085927825UL, 1595992020UL, 3288724966UL, 3544041088UL, 3850509554UL, +3925419886UL, 2628739022UL, 2528254629UL, 2562145937UL, 3124287811UL, 3373329273UL, 4255542251UL, 1185418446UL, 3693565710UL, 1989726178UL, 1381160022UL, 3642438773UL, 4284399225UL, 3271478204UL, 3622052196UL, 1263328494UL, 1154237693UL, 2684443667UL, 3615401444UL, 2786224913UL, 1251034970UL, 1874233020UL, 3222830495UL, 2572413057UL, 1529490307UL, 3146635362UL, 1436483376UL, 2821876495UL, 3993894153UL, 979247444UL, 2142862852UL, 1368937545UL, +2647327844UL, 1353904396UL, 294065371UL, 3543274652UL, 911792564UL, 1204178178UL, 3165709748UL, 103582737UL, 3101998294UL, 730811902UL, 1989156224UL, 893293786UL, 1885087777UL, 1390223786UL, 2657819643UL, 552729795UL, 3388458110UL, 3325206451UL, 1897013739UL, 3657020278UL, 1387364861UL, 3025318046UL, 2117065739UL, 486446521UL, 3675999281UL, 714737345UL, 2085926890UL, 3946214694UL, 3609089773UL, 2117061768UL, 3935682560UL, 868009118UL, +2916136885UL, 1808988481UL, 83680601UL, 1464326680UL, 797410789UL, 3438751781UL, 1391154023UL, 234460119UL, 3551348221UL, 4068940987UL, 3948410079UL, 2814385745UL, 3497626257UL, 916790795UL, 3722456098UL, 1767303496UL, 3711787525UL, 2239286063UL, 1054058916UL, 2030352819UL, 4140631909UL, 2230543409UL, 2173597546UL, 3786733892UL, 3211336683UL, 1116033475UL, 2032556038UL, 3216540537UL, 3298170974UL, 2589589144UL, 667272562UL, 1863766055UL, +3931110690UL, 191299053UL, 1139480458UL, 272901326UL, 739418419UL, 1377144055UL, 2876702705UL, 1954361769UL, 3839312742UL, 2814009721UL, 600813233UL, 1535885024UL, 3587775605UL, 4256065219UL, 2324695947UL, 2293284974UL, 2036339249UL, 1534849280UL, 1215859603UL, 327866771UL, 3356772175UL, 1826625240UL, 720372669UL, 4240407984UL, 1421374867UL, 3228945021UL, 1358646008UL, 3409069246UL, 4100357988UL, 643362354UL, 109899594UL, 2064362635UL, +4243434294UL, 2898852084UL, 4180291913UL, 1676507466UL, 1017841240UL, 3243922356UL, 1569683812UL, 3608467942UL, 3113105154UL, 1154120402UL, 1479311403UL, 966040649UL, 1862994005UL, 3020908939UL, 3078194866UL, 1556392996UL, 786634113UL, 693774191UL, 3549937583UL, 3710822994UL, 920664071UL, 1578429713UL, 37658897UL, 2340485150UL, 950951909UL, 740197415UL, 2528123823UL, 2258231402UL, 1085927825UL, 1595992020UL, 2580760267UL, 3544041088UL, +3850509554UL, 3925419886UL, 2628739022UL, 3867556156UL, 2562145937UL, 3124287811UL, 3373329273UL, 4255542251UL, 3185271749UL, 3693565710UL, 1989726178UL, 1381160022UL, 3642438773UL, 3042165367UL, 3271478204UL, 3622052196UL, 1263328494UL, 1154237693UL, 1016814036UL, 3615401444UL, 2786224913UL, 1251034970UL, 1874233020UL, 2956086971UL, 2572413057UL, 1529490307UL, 3146635362UL, 1436483376UL, 1513970396UL, 3993894153UL, 979247444UL, 2142862852UL, +1368937545UL, 3275665128UL, 1353904396UL, 294065371UL, 3543274652UL, 911792564UL, 2209636872UL, 3165709748UL, 103582737UL, 3101998294UL, 730811902UL, 965151434UL, 893293786UL, 1885087777UL, 1390223786UL, 2657819643UL, 3278634059UL, 3388458110UL, 3325206451UL, 1897013739UL, 3657020278UL, 4293473749UL, 3025318046UL, 2117065739UL, 486446521UL, 3675999281UL, 620561205UL, 2085926890UL, 3946214694UL, 3609089773UL, 2117061768UL, 163384588UL, +868009118UL, 2916136885UL, 1808988481UL, 83680601UL, 10243015UL, 797410789UL, 3438751781UL, 1391154023UL, 234460119UL, 1278218413UL, 4068940987UL, 3948410079UL, 2814385745UL, 3497626257UL, 1233272798UL, 3722456098UL, 1767303496UL, 3711787525UL, 2239286063UL, 3968895688UL, 2030352819UL, 4140631909UL, 2230543409UL, 2173597546UL, 2866251044UL, 3211336683UL, 1116033475UL, 2032556038UL, 3216540537UL, 4233849723UL, 2589589144UL, 667272562UL, +1863766055UL, 3931110690UL, 2468422423UL, 1139480458UL, 272901326UL, 739418419UL, 1377144055UL, 4240143411UL, 1954361769UL, 3839312742UL, 2814009721UL, 600813233UL, 3976840004UL, 3587775605UL, 4256065219UL, 2324695947UL, 2293284974UL, 437604123UL, 1534849280UL, 1215859603UL, 327866771UL, 3356772175UL, 2757237699UL, 720372669UL, 4240407984UL, 1421374867UL, 3228945021UL, 3284801305UL, 3409069246UL, 4100357988UL, 643362354UL, 109899594UL, +1301585321UL, 2528806870UL, 1838904064UL, 448772403UL, 1097849740UL, 1899994097UL, 618309123UL, 1911948510UL, 2309256224UL, 1861398151UL, 905306403UL, 1067595802UL, 36868624UL, 3780886191UL, 835126206UL, 3190251977UL, 2672497726UL, 2085944002UL, 2912993968UL, 2493776706UL, 667136329UL, 1474890786UL, 2383346554UL, 943528949UL, 3376706013UL, 2495573574UL, 144956345UL, 793159960UL, 1591274917UL, 477107637UL, 1383815442UL, 67384899UL, +2355242218UL, 1687409818UL, 3801093871UL, 2108217811UL, 3455908733UL, 4172160797UL, 3935534685UL, 631067839UL, 1187677548UL, 2280856137UL, 3020767646UL, 2063176246UL, 3736904984UL, 2952933848UL, 2975164686UL, 4144473303UL, 34670977UL, 1250976509UL, 3484166554UL, 1532744745UL, 225700994UL, 1878713627UL, 2122358980UL, 1456610194UL, 2917522161UL, 2818947075UL, 102678939UL, 53743858UL, 2095250656UL, 4023979225UL, 3094092874UL, 4128760696UL, +3411610028UL, 3020200609UL, 2225866341UL, 586320946UL, 63813522UL, 1238216159UL, 2825692263UL, 2169937231UL, 3298517640UL, 1542128261UL, 2205544184UL, 1258655704UL, 2629012083UL, 4113650203UL, 3198617867UL, 2742310794UL, 3372657381UL, 3115904410UL, 1948638822UL, 1123521744UL, 1080429281UL, 4086706732UL, 4142693211UL, 817377147UL, 2570194641UL, 26001503UL, 2861456160UL, 4185725555UL, 2573003804UL, 1618628779UL, 2588489212UL, 3996192609UL, +1555844274UL, 1003123505UL, 1326350123UL, 1130583849UL, 3017128756UL, 74119042UL, 4041266437UL, 1938014170UL, 3528465794UL, 4203969698UL, 1913054398UL, 3617979809UL, 2218810167UL, 2453899816UL, 1997423206UL, 477446533UL, 303090065UL, 757937082UL, 1523238256UL, 3140505311UL, 1422588701UL, 3642014639UL, 1740624195UL, 1276017154UL, 3072526193UL, 3675105122UL, 1335122682UL, 4080595263UL, 2308519420UL, 3299182769UL, 1461978532UL, 3098694217UL, +2982399822UL, 3088698511UL, 586759229UL, 3548750902UL, 1449857891UL, 2866451663UL, 2525162286UL, 57294602UL, 4107991297UL, 1214672265UL, 2940391280UL, 4285346034UL, 3338216759UL, 737207923UL, 4264163846UL, 59219141UL, 2300024654UL, 1876616814UL, 1976543605UL, 783571061UL, 1724699622UL, 1967524469UL, 1650309916UL, 3322257631UL, 3975521122UL, 273342162UL, 1156754241UL, 185315896UL, 3368133921UL, 66314655UL, 4153777915UL, 3519901897UL, +}, +{ +3672467167UL, 68684525UL, 1738833632UL, 3081329135UL, 2583806115UL, 2291130512UL, 503032614UL, 3658059597UL, 571493931UL, 685537959UL, 3498787788UL, 422428426UL, 3879256913UL, 1173158320UL, 4000800121UL, 298972869UL, 1718342816UL, 2541691685UL, 2490502642UL, 2321452806UL, 4223212804UL, 1812334632UL, 3717655725UL, 4238191852UL, 3001307165UL, 2621896355UL, 2572404999UL, 3590094954UL, 760765206UL, 2293618001UL, 1392353032UL, 1733137169UL, +2674005018UL, 4067961151UL, 1505710487UL, 451078217UL, 2591688848UL, 12635611UL, 507045428UL, 694822241UL, 1789383090UL, 1140183890UL, 1720695967UL, 1994318191UL, 3340349873UL, 2793804971UL, 1054433135UL, 2345087879UL, 3179939285UL, 1651968615UL, 1793223686UL, 1055357758UL, 914271617UL, 483007580UL, 2127727816UL, 2754998083UL, 3179053982UL, 598442002UL, 1950227301UL, 213053613UL, 3566888111UL, 2832258993UL, 4260365359UL, 443662829UL, +1706542890UL, 3852730296UL, 3643260763UL, 2163607277UL, 1812905006UL, 171529637UL, 215187467UL, 2369406909UL, 1929000706UL, 2572441025UL, 2133955541UL, 810692262UL, 1337974799UL, 4030350704UL, 2159178715UL, 3769451556UL, 1026825278UL, 593628480UL, 1817383139UL, 878832429UL, 2253876350UL, 203612980UL, 2102950440UL, 3407143936UL, 1912362251UL, 1595387637UL, 2827580539UL, 305467658UL, 3292706746UL, 44135525UL, 4001933553UL, 3697343089UL, +760470915UL, 587414402UL, 1419378814UL, 2852774010UL, 3891626781UL, 2757016765UL, 1090707384UL, 3997074427UL, 1047182100UL, 2855539022UL, 36229159UL, 1591415533UL, 3471572739UL, 1237952140UL, 2614469314UL, 213338525UL, 886212578UL, 2620301943UL, 713590207UL, 2430496777UL, 1198164420UL, 2644841698UL, 3654164701UL, 36283572UL, 1461695896UL, 1770331341UL, 1641501876UL, 3470919184UL, 3181021559UL, 3053795110UL, 3533531372UL, 3134337355UL, +668308383UL, 388340999UL, 3221275220UL, 1589659138UL, 294382235UL, 1447443579UL, 690177534UL, 1799726917UL, 2838977761UL, 4172949119UL, 2360858031UL, 159385920UL, 2248389027UL, 1790015671UL, 3925738275UL, 1049918544UL, 4107349511UL, 1619955951UL, 4188275966UL, 1672572975UL, 2672697497UL, 1863413666UL, 747724021UL, 4037561738UL, 1605940213UL, 445253292UL, 3362434828UL, 610898209UL, 1473244091UL, 735444769UL, 1540599852UL, 2449351720UL, +1032410949UL, 3672467167UL, 68684525UL, 1738833632UL, 3081329135UL, 519684794UL, 2291130512UL, 503032614UL, 3658059597UL, 571493931UL, 2400186105UL, 3498787788UL, 422428426UL, 3879256913UL, 1173158320UL, 4120704752UL, 298972869UL, 1718342816UL, 2541691685UL, 2490502642UL, 1686027891UL, 4223212804UL, 1812334632UL, 3717655725UL, 4238191852UL, 642431972UL, 2621896355UL, 2572404999UL, 3590094954UL, 760765206UL, 2949609717UL, 1392353032UL, +1733137169UL, 2674005018UL, 4067961151UL, 1526077846UL, 451078217UL, 2591688848UL, 12635611UL, 507045428UL, 2417951415UL, 1789383090UL, 1140183890UL, 1720695967UL, 1994318191UL, 3465605863UL, 2793804971UL, 1054433135UL, 2345087879UL, 3179939285UL, 3079297626UL, 1793223686UL, 1055357758UL, 914271617UL, 483007580UL, 306802527UL, 2754998083UL, 3179053982UL, 598442002UL, 1950227301UL, 2473418737UL, 3566888111UL, 2832258993UL, 4260365359UL, +443662829UL, 2097776414UL, 3852730296UL, 3643260763UL, 2163607277UL, 1812905006UL, 3957721904UL, 215187467UL, 2369406909UL, 1929000706UL, 2572441025UL, 3779486126UL, 810692262UL, 1337974799UL, 4030350704UL, 2159178715UL, 1127012865UL, 1026825278UL, 593628480UL, 1817383139UL, 878832429UL, 361018423UL, 203612980UL, 2102950440UL, 3407143936UL, 1912362251UL, 1475218277UL, 2827580539UL, 305467658UL, 3292706746UL, 44135525UL, 1900092336UL, +3697343089UL, 760470915UL, 587414402UL, 1419378814UL, 343303227UL, 3891626781UL, 2757016765UL, 1090707384UL, 3997074427UL, 745490961UL, 2855539022UL, 36229159UL, 1591415533UL, 3471572739UL, 3920625546UL, 2614469314UL, 213338525UL, 886212578UL, 2620301943UL, 827771411UL, 2430496777UL, 1198164420UL, 2644841698UL, 3654164701UL, 2747674190UL, 1461695896UL, 1770331341UL, 1641501876UL, 3470919184UL, 919857376UL, 3053795110UL, 3533531372UL, +3134337355UL, 668308383UL, 201138876UL, 3221275220UL, 1589659138UL, 294382235UL, 1447443579UL, 4211579707UL, 1799726917UL, 2838977761UL, 4172949119UL, 2360858031UL, 416103844UL, 2248389027UL, 1790015671UL, 3925738275UL, 1049918544UL, 3481887924UL, 1619955951UL, 4188275966UL, 1672572975UL, 2672697497UL, 564854400UL, 747724021UL, 4037561738UL, 1605940213UL, 445253292UL, 604900912UL, 610898209UL, 1473244091UL, 735444769UL, 1540599852UL, +3036173307UL, 1032410949UL, 3672467167UL, 68684525UL, 1738833632UL, 973022696UL, 519684794UL, 2291130512UL, 503032614UL, 3658059597UL, 1500301452UL, 2400186105UL, 3498787788UL, 422428426UL, 3879256913UL, 3923611748UL, 4120704752UL, 298972869UL, 1718342816UL, 2541691685UL, 2323881484UL, 1686027891UL, 4223212804UL, 1812334632UL, 3717655725UL, 2109094458UL, 642431972UL, 2621896355UL, 2572404999UL, 3590094954UL, 1837882537UL, 2949609717UL, +1392353032UL, 1733137169UL, 2674005018UL, 3252348987UL, 1526077846UL, 451078217UL, 2591688848UL, 12635611UL, 3971261781UL, 2417951415UL, 1789383090UL, 1140183890UL, 1720695967UL, 2906966040UL, 3465605863UL, 2793804971UL, 1054433135UL, 2345087879UL, 915518921UL, 3079297626UL, 1793223686UL, 1055357758UL, 914271617UL, 791633499UL, 306802527UL, 2754998083UL, 3179053982UL, 598442002UL, 324402573UL, 2473418737UL, 3566888111UL, 2832258993UL, +4260365359UL, 2168046398UL, 2097776414UL, 3852730296UL, 3643260763UL, 2163607277UL, 2595175979UL, 3957721904UL, 215187467UL, 2369406909UL, 1929000706UL, 657446369UL, 3779486126UL, 810692262UL, 1337974799UL, 4030350704UL, 1865557469UL, 1127012865UL, 1026825278UL, 593628480UL, 1817383139UL, 3414354529UL, 361018423UL, 203612980UL, 2102950440UL, 3407143936UL, 1739372987UL, 1475218277UL, 2827580539UL, 305467658UL, 3292706746UL, 825045562UL, +1900092336UL, 3697343089UL, 760470915UL, 587414402UL, 2000637694UL, 343303227UL, 3891626781UL, 2757016765UL, 1090707384UL, 4015377800UL, 745490961UL, 2855539022UL, 36229159UL, 1591415533UL, 2208656873UL, 3920625546UL, 2614469314UL, 213338525UL, 886212578UL, 2729976209UL, 827771411UL, 2430496777UL, 1198164420UL, 2644841698UL, 1922667440UL, 2747674190UL, 1461695896UL, 1770331341UL, 1641501876UL, 357535311UL, 919857376UL, 3053795110UL, +3533531372UL, 3134337355UL, 1004072597UL, 201138876UL, 3221275220UL, 1589659138UL, 294382235UL, 1148950143UL, 4211579707UL, 1799726917UL, 2838977761UL, 4172949119UL, 892664404UL, 416103844UL, 2248389027UL, 1790015671UL, 3925738275UL, 2612357890UL, 3481887924UL, 1619955951UL, 4188275966UL, 1672572975UL, 2005534713UL, 564854400UL, 747724021UL, 4037561738UL, 1605940213UL, 2620990454UL, 604900912UL, 610898209UL, 1473244091UL, 735444769UL, +3571225334UL, 3036173307UL, 1032410949UL, 3672467167UL, 68684525UL, 3327351604UL, 973022696UL, 519684794UL, 2291130512UL, 503032614UL, 3814902238UL, 1500301452UL, 2400186105UL, 3498787788UL, 422428426UL, 1756753750UL, 3923611748UL, 4120704752UL, 298972869UL, 1718342816UL, 652903081UL, 2323881484UL, 1686027891UL, 4223212804UL, 1812334632UL, 1599640566UL, 2109094458UL, 642431972UL, 2621896355UL, 2572404999UL, 1668409355UL, 1837882537UL, +2949609717UL, 1392353032UL, 1733137169UL, 3691709793UL, 3252348987UL, 1526077846UL, 451078217UL, 2591688848UL, 3353622601UL, 3971261781UL, 2417951415UL, 1789383090UL, 1140183890UL, 4113853791UL, 2906966040UL, 3465605863UL, 2793804971UL, 1054433135UL, 2195882948UL, 915518921UL, 3079297626UL, 1793223686UL, 1055357758UL, 898713552UL, 791633499UL, 306802527UL, 2754998083UL, 3179053982UL, 2469350088UL, 324402573UL, 2473418737UL, 3566888111UL, +2832258993UL, 1377718274UL, 2168046398UL, 2097776414UL, 3852730296UL, 3643260763UL, 3492388484UL, 2595175979UL, 3957721904UL, 215187467UL, 2369406909UL, 4243449339UL, 657446369UL, 3779486126UL, 810692262UL, 1337974799UL, 3960230785UL, 1865557469UL, 1127012865UL, 1026825278UL, 593628480UL, 732793312UL, 3414354529UL, 361018423UL, 203612980UL, 2102950440UL, 2401792405UL, 1739372987UL, 1475218277UL, 2827580539UL, 305467658UL, 2454275289UL, +825045562UL, 1900092336UL, 3697343089UL, 760470915UL, 2146882409UL, 2000637694UL, 343303227UL, 3891626781UL, 2757016765UL, 3997473261UL, 4015377800UL, 745490961UL, 2855539022UL, 36229159UL, 2375394427UL, 2208656873UL, 3920625546UL, 2614469314UL, 213338525UL, 2055366274UL, 2729976209UL, 827771411UL, 2430496777UL, 1198164420UL, 1789631187UL, 1922667440UL, 2747674190UL, 1461695896UL, 1770331341UL, 4284442852UL, 357535311UL, 919857376UL, +3053795110UL, 3533531372UL, 2124270060UL, 1004072597UL, 201138876UL, 3221275220UL, 1589659138UL, 1418386120UL, 1148950143UL, 4211579707UL, 1799726917UL, 2838977761UL, 3540708069UL, 892664404UL, 416103844UL, 2248389027UL, 1790015671UL, 3936883UL, 2612357890UL, 3481887924UL, 1619955951UL, 4188275966UL, 2963623483UL, 2005534713UL, 564854400UL, 747724021UL, 4037561738UL, 3431155922UL, 2620990454UL, 604900912UL, 610898209UL, 1473244091UL, +3880001339UL, 2879060316UL, 3300897679UL, 3960972039UL, 3201086624UL, 3814462934UL, 3426650044UL, 1930881632UL, 1981178788UL, 2956279691UL, 4272406256UL, 372705521UL, 1359389771UL, 1590302979UL, 3940206208UL, 3817999127UL, 2527835456UL, 2739078164UL, 716997849UL, 3235607043UL, 2550297745UL, 3688700200UL, 354502605UL, 2285793656UL, 2339138034UL, 3912354142UL, 2262255668UL, 469322622UL, 1319943359UL, 1916101235UL, 200441823UL, 509436982UL, +2160284593UL, 1687919695UL, 4153615582UL, 495735041UL, 3694469424UL, 2086893117UL, 4223008799UL, 105344742UL, 1698033424UL, 1149223145UL, 4183918790UL, 4176151950UL, 415739351UL, 817762972UL, 3768072560UL, 1931430949UL, 2698979439UL, 3481477932UL, 1994322914UL, 4078299950UL, 1268233995UL, 3254069145UL, 91029129UL, 498234704UL, 1636613942UL, 3710087092UL, 3876816560UL, 3510446387UL, 3870169008UL, 1370156410UL, 2442498047UL, 2324396523UL, +1258730334UL, 621954739UL, 1053015373UL, 491820717UL, 3386515432UL, 2203703266UL, 120167176UL, 2383669740UL, 1038666440UL, 2927342870UL, 3583197824UL, 1236241846UL, 2474675929UL, 679052891UL, 2451259584UL, 2177706146UL, 606842882UL, 3546980104UL, 2289281509UL, 353873434UL, 2041926837UL, 1238346748UL, 2729109726UL, 2843938395UL, 2938124210UL, 2554443866UL, 1494477920UL, 693378319UL, 2020963566UL, 2000385949UL, 3744098787UL, 650307220UL, +2631327075UL, 1529128757UL, 595871428UL, 3206666562UL, 458062987UL, 875238192UL, 3729317374UL, 1368843921UL, 3478430230UL, 3234384578UL, 3232435428UL, 321359326UL, 994274524UL, 361184397UL, 4285497594UL, 915263578UL, 1486882838UL, 9988613UL, 829077170UL, 677216046UL, 4141828204UL, 165804609UL, 1086678519UL, 2933434608UL, 1351662802UL, 2640085040UL, 2611502932UL, 2033698714UL, 2008873254UL, 3995557835UL, 1020873906UL, 67873555UL, +2230337823UL, 1263800417UL, 1148712155UL, 3985159589UL, 2979503513UL, 2854714997UL, 1539343345UL, 2751484352UL, 1569100732UL, 2020758949UL, 2126757134UL, 3426641899UL, 2808587825UL, 1953320148UL, 1096398464UL, 1502907172UL, 3751230087UL, 765557661UL, 765290990UL, 3056075500UL, 2040620632UL, 422573751UL, 3613558930UL, 1741145769UL, 273531216UL, 837238736UL, 494297893UL, 2903251124UL, 1636782182UL, 4256592784UL, 3652746656UL, 4258393217UL, +}, +{ +2657510202UL, 270297201UL, 2970166904UL, 3151626326UL, 973127447UL, 1523852613UL, 598650578UL, 10289043UL, 1138773500UL, 1379558769UL, 2202575480UL, 1622690708UL, 181345079UL, 228706650UL, 2807760507UL, 3061024281UL, 2310359315UL, 3094465578UL, 4062753882UL, 2744510393UL, 3844622451UL, 1759718963UL, 2393602744UL, 977540509UL, 870449791UL, 1484134272UL, 2838962253UL, 3079492430UL, 2617141201UL, 3744868057UL, 994295425UL, 1302594555UL, +277777192UL, 1793039043UL, 1620482692UL, 2518563014UL, 1163760339UL, 2709515777UL, 4220588138UL, 531143270UL, 2528377633UL, 931694828UL, 1472659070UL, 900489303UL, 3538137811UL, 3849822545UL, 1304182427UL, 2423451948UL, 587259647UL, 296795227UL, 3843393378UL, 100570026UL, 1824916038UL, 3155192628UL, 1205830295UL, 2205840913UL, 2598785234UL, 2138099222UL, 1585588098UL, 1304106911UL, 2443465671UL, 3007665864UL, 3350433156UL, 3623458138UL, +629407548UL, 3209244941UL, 2102270358UL, 952701496UL, 2715374730UL, 2142960491UL, 2566649458UL, 2386659994UL, 4201648072UL, 367516884UL, 211986877UL, 3970312395UL, 4153651951UL, 3794120671UL, 614826776UL, 769672874UL, 2218713182UL, 236114529UL, 1614697510UL, 2420862368UL, 3471485219UL, 3080341429UL, 2394724619UL, 3585194114UL, 1394678495UL, 2137969611UL, 3955498999UL, 2765569351UL, 3084915757UL, 765232390UL, 1406483345UL, 2796499268UL, +2491128017UL, 1052428931UL, 1713430644UL, 3921576513UL, 3753414774UL, 973530327UL, 2545412294UL, 1841110931UL, 1174406073UL, 1104865218UL, 1586606252UL, 2612244473UL, 1407875673UL, 1823397519UL, 2613642581UL, 3163449384UL, 3129975397UL, 2059184961UL, 818092118UL, 3182607992UL, 1658516909UL, 2467681581UL, 1065789733UL, 799857247UL, 2492902195UL, 168866110UL, 2251316716UL, 1607684829UL, 2347941418UL, 2382781983UL, 3298500129UL, 3609200925UL, +3060374324UL, 2602420483UL, 2357812057UL, 3739699403UL, 3260652552UL, 205015857UL, 1936033273UL, 3955997259UL, 821264237UL, 1882720491UL, 159294165UL, 3197657094UL, 528058988UL, 2768830342UL, 805087358UL, 896645931UL, 1360375456UL, 3417488932UL, 3863200799UL, 4033907887UL, 983658874UL, 1828706965UL, 875027318UL, 1310362653UL, 3711487613UL, 4148261033UL, 3145162047UL, 485182003UL, 2633647498UL, 1369395018UL, 4163384029UL, 1827719274UL, +270658892UL, 2657510202UL, 270297201UL, 2970166904UL, 3151626326UL, 499420828UL, 1523852613UL, 598650578UL, 10289043UL, 1138773500UL, 640170086UL, 2202575480UL, 1622690708UL, 181345079UL, 228706650UL, 3957853780UL, 3061024281UL, 2310359315UL, 3094465578UL, 4062753882UL, 2049506087UL, 3844622451UL, 1759718963UL, 2393602744UL, 977540509UL, 2346891936UL, 1484134272UL, 2838962253UL, 3079492430UL, 2617141201UL, 2112540708UL, 994295425UL, +1302594555UL, 277777192UL, 1793039043UL, 981072592UL, 2518563014UL, 1163760339UL, 2709515777UL, 4220588138UL, 1992965594UL, 2528377633UL, 931694828UL, 1472659070UL, 900489303UL, 32461040UL, 3849822545UL, 1304182427UL, 2423451948UL, 587259647UL, 3728056788UL, 3843393378UL, 100570026UL, 1824916038UL, 3155192628UL, 1194916233UL, 2205840913UL, 2598785234UL, 2138099222UL, 1585588098UL, 2944318376UL, 2443465671UL, 3007665864UL, 3350433156UL, +3623458138UL, 1413669939UL, 3209244941UL, 2102270358UL, 952701496UL, 2715374730UL, 826676012UL, 2566649458UL, 2386659994UL, 4201648072UL, 367516884UL, 4272143576UL, 3970312395UL, 4153651951UL, 3794120671UL, 614826776UL, 4106382849UL, 2218713182UL, 236114529UL, 1614697510UL, 2420862368UL, 138091237UL, 3080341429UL, 2394724619UL, 3585194114UL, 1394678495UL, 2113895281UL, 3955498999UL, 2765569351UL, 3084915757UL, 765232390UL, 2247301699UL, +2796499268UL, 2491128017UL, 1052428931UL, 1713430644UL, 1076867271UL, 3753414774UL, 973530327UL, 2545412294UL, 1841110931UL, 3427639042UL, 1104865218UL, 1586606252UL, 2612244473UL, 1407875673UL, 2159805028UL, 2613642581UL, 3163449384UL, 3129975397UL, 2059184961UL, 1251595655UL, 3182607992UL, 1658516909UL, 2467681581UL, 1065789733UL, 524065102UL, 2492902195UL, 168866110UL, 2251316716UL, 1607684829UL, 877205873UL, 2382781983UL, 3298500129UL, +3609200925UL, 3060374324UL, 1983477493UL, 2357812057UL, 3739699403UL, 3260652552UL, 205015857UL, 3578808491UL, 3955997259UL, 821264237UL, 1882720491UL, 159294165UL, 3639531297UL, 528058988UL, 2768830342UL, 805087358UL, 896645931UL, 2309781073UL, 3417488932UL, 3863200799UL, 4033907887UL, 983658874UL, 3756437847UL, 875027318UL, 1310362653UL, 3711487613UL, 4148261033UL, 3264363953UL, 485182003UL, 2633647498UL, 1369395018UL, 4163384029UL, +184614728UL, 270658892UL, 2657510202UL, 270297201UL, 2970166904UL, 884907665UL, 499420828UL, 1523852613UL, 598650578UL, 10289043UL, 2023902217UL, 640170086UL, 2202575480UL, 1622690708UL, 181345079UL, 1358722197UL, 3957853780UL, 3061024281UL, 2310359315UL, 3094465578UL, 4156960892UL, 2049506087UL, 3844622451UL, 1759718963UL, 2393602744UL, 1018272187UL, 2346891936UL, 1484134272UL, 2838962253UL, 3079492430UL, 663361761UL, 2112540708UL, +994295425UL, 1302594555UL, 277777192UL, 4201292427UL, 981072592UL, 2518563014UL, 1163760339UL, 2709515777UL, 3301905324UL, 1992965594UL, 2528377633UL, 931694828UL, 1472659070UL, 3170286187UL, 32461040UL, 3849822545UL, 1304182427UL, 2423451948UL, 166213287UL, 3728056788UL, 3843393378UL, 100570026UL, 1824916038UL, 1534589402UL, 1194916233UL, 2205840913UL, 2598785234UL, 2138099222UL, 767439709UL, 2944318376UL, 2443465671UL, 3007665864UL, +3350433156UL, 257274072UL, 1413669939UL, 3209244941UL, 2102270358UL, 952701496UL, 893224047UL, 826676012UL, 2566649458UL, 2386659994UL, 4201648072UL, 1336000731UL, 4272143576UL, 3970312395UL, 4153651951UL, 3794120671UL, 2381517352UL, 4106382849UL, 2218713182UL, 236114529UL, 1614697510UL, 2427291612UL, 138091237UL, 3080341429UL, 2394724619UL, 3585194114UL, 1339840651UL, 2113895281UL, 3955498999UL, 2765569351UL, 3084915757UL, 1920073265UL, +2247301699UL, 2796499268UL, 2491128017UL, 1052428931UL, 1720704700UL, 1076867271UL, 3753414774UL, 973530327UL, 2545412294UL, 655938239UL, 3427639042UL, 1104865218UL, 1586606252UL, 2612244473UL, 748629647UL, 2159805028UL, 2613642581UL, 3163449384UL, 3129975397UL, 1868740512UL, 1251595655UL, 3182607992UL, 1658516909UL, 2467681581UL, 3092135795UL, 524065102UL, 2492902195UL, 168866110UL, 2251316716UL, 229376275UL, 877205873UL, 2382781983UL, +3298500129UL, 3609200925UL, 1270454086UL, 1983477493UL, 2357812057UL, 3739699403UL, 3260652552UL, 3976376418UL, 3578808491UL, 3955997259UL, 821264237UL, 1882720491UL, 2211365699UL, 3639531297UL, 528058988UL, 2768830342UL, 805087358UL, 1351870678UL, 2309781073UL, 3417488932UL, 3863200799UL, 4033907887UL, 2317721807UL, 3756437847UL, 875027318UL, 1310362653UL, 3711487613UL, 1929459086UL, 3264363953UL, 485182003UL, 2633647498UL, 1369395018UL, +2141675718UL, 184614728UL, 270658892UL, 2657510202UL, 270297201UL, 3337954073UL, 884907665UL, 499420828UL, 1523852613UL, 598650578UL, 3874207188UL, 2023902217UL, 640170086UL, 2202575480UL, 1622690708UL, 2020255059UL, 1358722197UL, 3957853780UL, 3061024281UL, 2310359315UL, 753738868UL, 4156960892UL, 2049506087UL, 3844622451UL, 1759718963UL, 1672276116UL, 1018272187UL, 2346891936UL, 1484134272UL, 2838962253UL, 1680679979UL, 663361761UL, +2112540708UL, 994295425UL, 1302594555UL, 1941500850UL, 4201292427UL, 981072592UL, 2518563014UL, 1163760339UL, 184357645UL, 3301905324UL, 1992965594UL, 2528377633UL, 931694828UL, 3462653134UL, 3170286187UL, 32461040UL, 3849822545UL, 1304182427UL, 396808784UL, 166213287UL, 3728056788UL, 3843393378UL, 100570026UL, 876691173UL, 1534589402UL, 1194916233UL, 2205840913UL, 2598785234UL, 4286653520UL, 767439709UL, 2944318376UL, 2443465671UL, +3007665864UL, 2793587144UL, 257274072UL, 1413669939UL, 3209244941UL, 2102270358UL, 2792966616UL, 893224047UL, 826676012UL, 2566649458UL, 2386659994UL, 798757973UL, 1336000731UL, 4272143576UL, 3970312395UL, 4153651951UL, 2930383268UL, 2381517352UL, 4106382849UL, 2218713182UL, 236114529UL, 1936008889UL, 2427291612UL, 138091237UL, 3080341429UL, 2394724619UL, 4157586029UL, 1339840651UL, 2113895281UL, 3955498999UL, 2765569351UL, 2243544114UL, +1920073265UL, 2247301699UL, 2796499268UL, 2491128017UL, 3372810009UL, 1720704700UL, 1076867271UL, 3753414774UL, 973530327UL, 484392041UL, 655938239UL, 3427639042UL, 1104865218UL, 1586606252UL, 1373046326UL, 748629647UL, 2159805028UL, 2613642581UL, 3163449384UL, 1558595520UL, 1868740512UL, 1251595655UL, 3182607992UL, 1658516909UL, 3503432306UL, 3092135795UL, 524065102UL, 2492902195UL, 168866110UL, 4106973392UL, 229376275UL, 877205873UL, +2382781983UL, 3298500129UL, 2366096961UL, 1270454086UL, 1983477493UL, 2357812057UL, 3739699403UL, 4223323197UL, 3976376418UL, 3578808491UL, 3955997259UL, 821264237UL, 1581729952UL, 2211365699UL, 3639531297UL, 528058988UL, 2768830342UL, 3946263978UL, 1351870678UL, 2309781073UL, 3417488932UL, 3863200799UL, 3948072426UL, 2317721807UL, 3756437847UL, 875027318UL, 1310362653UL, 3439391360UL, 1929459086UL, 3264363953UL, 485182003UL, 2633647498UL, +3576868480UL, 2527748673UL, 3116247125UL, 4020801612UL, 2594734840UL, 3308177137UL, 665011257UL, 40118275UL, 3584569179UL, 3399729283UL, 3867174947UL, 658488234UL, 1099195903UL, 2274511402UL, 1872529118UL, 2518961094UL, 2633598693UL, 4160728307UL, 449442630UL, 164837956UL, 1010805767UL, 605336924UL, 1178031445UL, 3949359502UL, 2585151633UL, 611885521UL, 293204651UL, 3389557188UL, 1172294301UL, 2503819061UL, 659842653UL, 504992348UL, +3762165683UL, 1799777932UL, 4161843209UL, 1924622448UL, 1006263939UL, 115233249UL, 2775142171UL, 3228632586UL, 885407023UL, 2514866293UL, 3615088636UL, 2488824172UL, 2631364137UL, 1454226414UL, 3888177876UL, 70646265UL, 2291458600UL, 2370783730UL, 1566625834UL, 3652033806UL, 4136806683UL, 2819973124UL, 3207365429UL, 989185345UL, 3343822313UL, 2580472874UL, 4077285847UL, 4032963783UL, 2883518039UL, 2253593637UL, 904631114UL, 2654790756UL, +2967911632UL, 2131672564UL, 1594073414UL, 2370718497UL, 3769371275UL, 1547951748UL, 2473303924UL, 651625138UL, 2159175883UL, 4062995539UL, 696224922UL, 3388626509UL, 100118553UL, 770731124UL, 2149458689UL, 3223175313UL, 3524052514UL, 2651241522UL, 78236806UL, 3212708723UL, 1045780878UL, 2257575290UL, 3709360831UL, 966829465UL, 61269250UL, 405063245UL, 331731998UL, 2472078870UL, 1138237364UL, 1135091387UL, 3245001409UL, 3817992705UL, +1738939574UL, 1397617581UL, 2896546651UL, 4207083421UL, 3802162100UL, 391930524UL, 1326819828UL, 85308067UL, 3235336831UL, 686989692UL, 1947564282UL, 842881662UL, 2887279866UL, 3850666935UL, 2001895525UL, 2673649961UL, 2106555006UL, 1762053005UL, 2334552700UL, 26094213UL, 1184502058UL, 2048598709UL, 4039640450UL, 1439363714UL, 1022688817UL, 1053169108UL, 170896272UL, 444231850UL, 1500204748UL, 1077470703UL, 1630597179UL, 1382588806UL, +138805391UL, 1636536505UL, 3118018426UL, 3461152216UL, 2486547351UL, 2045361316UL, 2976067436UL, 468876399UL, 1407419455UL, 3226137264UL, 414206328UL, 1011039713UL, 3537947031UL, 2359787831UL, 258556532UL, 3615987029UL, 3372097337UL, 3586352388UL, 1056198830UL, 1852291192UL, 3888893481UL, 746156045UL, 4203877603UL, 297851145UL, 2615507398UL, 1141098641UL, 1881412583UL, 3014341741UL, 2125186797UL, 229307235UL, 3476606674UL, 3553854689UL, +}, +{ +3768542219UL, 2777948797UL, 3328832678UL, 3488502819UL, 2708053041UL, 2217907094UL, 2133505056UL, 2218961277UL, 2148551748UL, 1420045625UL, 1709182366UL, 1816409641UL, 3791695288UL, 4207813971UL, 22588497UL, 2211317602UL, 616238454UL, 2394270012UL, 3212896041UL, 213408768UL, 2199328374UL, 3188624050UL, 811443809UL, 2818548979UL, 3150758902UL, 2022548260UL, 2462701924UL, 3793704672UL, 2358080321UL, 483288372UL, 450033142UL, 772942770UL, +2224873625UL, 241543410UL, 312552314UL, 1268067149UL, 915918620UL, 3906238422UL, 132545832UL, 3486041298UL, 2414090506UL, 3798383292UL, 2257004699UL, 130309284UL, 1158673651UL, 152325583UL, 3499865580UL, 4094273597UL, 1029041593UL, 93538481UL, 3963199522UL, 4215066819UL, 2851084137UL, 950351173UL, 2758084052UL, 3408506640UL, 2468905351UL, 3982226741UL, 3591899344UL, 2972879639UL, 3321078070UL, 252381865UL, 409397320UL, 741653003UL, +1936712854UL, 1198684021UL, 922916691UL, 10413506UL, 3546896248UL, 1704703870UL, 1479762464UL, 104399432UL, 4144557684UL, 68239720UL, 2666028745UL, 362625839UL, 2591539911UL, 2837165752UL, 2180226515UL, 4076543943UL, 2956460273UL, 312410753UL, 2566731139UL, 2532653524UL, 2399030172UL, 207904356UL, 354574195UL, 485696336UL, 3816686234UL, 3016971115UL, 4272692603UL, 2352732136UL, 33493163UL, 780255811UL, 4092242980UL, 4121521600UL, +2119254314UL, 42767673UL, 1081488778UL, 2757446871UL, 2267513620UL, 3472164720UL, 2750308207UL, 1707164045UL, 3125591821UL, 3236687597UL, 299194858UL, 537384087UL, 1695155491UL, 2078250102UL, 1705861659UL, 2416322096UL, 1692335914UL, 1178915980UL, 3405431297UL, 4059323309UL, 2014660182UL, 3847682866UL, 4037583683UL, 2629253995UL, 867809161UL, 2167953720UL, 2290558548UL, 417635396UL, 53496289UL, 1890906570UL, 2842247580UL, 807266805UL, +1226139132UL, 2067929784UL, 1697038549UL, 3312131466UL, 1234311530UL, 3199840935UL, 4185078776UL, 1807030355UL, 215385887UL, 845421530UL, 1350380353UL, 4209181096UL, 2576197887UL, 1275262872UL, 2806513944UL, 2718623701UL, 2779287384UL, 71403197UL, 219220133UL, 2181111477UL, 2000396844UL, 3595837555UL, 1232425455UL, 2630647391UL, 3280867676UL, 2622740782UL, 1578938469UL, 3624564545UL, 992324522UL, 3056113148UL, 3473635768UL, 3664935418UL, +1786902552UL, 3768542219UL, 2777948797UL, 3328832678UL, 3488502819UL, 2530862473UL, 2217907094UL, 2133505056UL, 2218961277UL, 2148551748UL, 4050672856UL, 1709182366UL, 1816409641UL, 3791695288UL, 4207813971UL, 4175126713UL, 2211317602UL, 616238454UL, 2394270012UL, 3212896041UL, 732700649UL, 2199328374UL, 3188624050UL, 811443809UL, 2818548979UL, 972036137UL, 2022548260UL, 2462701924UL, 3793704672UL, 2358080321UL, 1200725173UL, 450033142UL, +772942770UL, 2224873625UL, 241543410UL, 1907109304UL, 1268067149UL, 915918620UL, 3906238422UL, 132545832UL, 301668366UL, 2414090506UL, 3798383292UL, 2257004699UL, 130309284UL, 1228520287UL, 152325583UL, 3499865580UL, 4094273597UL, 1029041593UL, 3267460249UL, 3963199522UL, 4215066819UL, 2851084137UL, 950351173UL, 47361585UL, 3408506640UL, 2468905351UL, 3982226741UL, 3591899344UL, 1878226915UL, 3321078070UL, 252381865UL, 409397320UL, +741653003UL, 1716437506UL, 1198684021UL, 922916691UL, 10413506UL, 3546896248UL, 1591998796UL, 1479762464UL, 104399432UL, 4144557684UL, 68239720UL, 3810955599UL, 362625839UL, 2591539911UL, 2837165752UL, 2180226515UL, 3908378015UL, 2956460273UL, 312410753UL, 2566731139UL, 2532653524UL, 687490649UL, 207904356UL, 354574195UL, 485696336UL, 3816686234UL, 378445403UL, 4272692603UL, 2352732136UL, 33493163UL, 780255811UL, 1303281526UL, +4121521600UL, 2119254314UL, 42767673UL, 1081488778UL, 1734311274UL, 2267513620UL, 3472164720UL, 2750308207UL, 1707164045UL, 4212588163UL, 3236687597UL, 299194858UL, 537384087UL, 1695155491UL, 2250704950UL, 1705861659UL, 2416322096UL, 1692335914UL, 1178915980UL, 677982197UL, 4059323309UL, 2014660182UL, 3847682866UL, 4037583683UL, 1765435945UL, 867809161UL, 2167953720UL, 2290558548UL, 417635396UL, 2125103002UL, 1890906570UL, 2842247580UL, +807266805UL, 1226139132UL, 2056644398UL, 1697038549UL, 3312131466UL, 1234311530UL, 3199840935UL, 3063718636UL, 1807030355UL, 215385887UL, 845421530UL, 1350380353UL, 3610667273UL, 2576197887UL, 1275262872UL, 2806513944UL, 2718623701UL, 2492912955UL, 71403197UL, 219220133UL, 2181111477UL, 2000396844UL, 3465351710UL, 1232425455UL, 2630647391UL, 3280867676UL, 2622740782UL, 1331873639UL, 3624564545UL, 992324522UL, 3056113148UL, 3473635768UL, +782257020UL, 1786902552UL, 3768542219UL, 2777948797UL, 3328832678UL, 856888454UL, 2530862473UL, 2217907094UL, 2133505056UL, 2218961277UL, 3752437534UL, 4050672856UL, 1709182366UL, 1816409641UL, 3791695288UL, 1581813910UL, 4175126713UL, 2211317602UL, 616238454UL, 2394270012UL, 1796414157UL, 732700649UL, 2199328374UL, 3188624050UL, 811443809UL, 4225173324UL, 972036137UL, 2022548260UL, 2462701924UL, 3793704672UL, 1410793611UL, 1200725173UL, +450033142UL, 772942770UL, 2224873625UL, 3889840648UL, 1907109304UL, 1268067149UL, 915918620UL, 3906238422UL, 1249098244UL, 301668366UL, 2414090506UL, 3798383292UL, 2257004699UL, 1620796656UL, 1228520287UL, 152325583UL, 3499865580UL, 4094273597UL, 82853050UL, 3267460249UL, 3963199522UL, 4215066819UL, 2851084137UL, 1212493334UL, 47361585UL, 3408506640UL, 2468905351UL, 3982226741UL, 3195419905UL, 1878226915UL, 3321078070UL, 252381865UL, +409397320UL, 1584154733UL, 1716437506UL, 1198684021UL, 922916691UL, 10413506UL, 1734068880UL, 1591998796UL, 1479762464UL, 104399432UL, 4144557684UL, 1973878859UL, 3810955599UL, 362625839UL, 2591539911UL, 2837165752UL, 1727282404UL, 3908378015UL, 2956460273UL, 312410753UL, 2566731139UL, 3656295687UL, 687490649UL, 207904356UL, 354574195UL, 485696336UL, 355953909UL, 378445403UL, 4272692603UL, 2352732136UL, 33493163UL, 3784169684UL, +1303281526UL, 4121521600UL, 2119254314UL, 42767673UL, 2331527847UL, 1734311274UL, 2267513620UL, 3472164720UL, 2750308207UL, 820692528UL, 4212588163UL, 3236687597UL, 299194858UL, 537384087UL, 781151234UL, 2250704950UL, 1705861659UL, 2416322096UL, 1692335914UL, 4288008793UL, 677982197UL, 4059323309UL, 2014660182UL, 3847682866UL, 3328850880UL, 1765435945UL, 867809161UL, 2167953720UL, 2290558548UL, 542850707UL, 2125103002UL, 1890906570UL, +2842247580UL, 807266805UL, 3803006390UL, 2056644398UL, 1697038549UL, 3312131466UL, 1234311530UL, 809106036UL, 3063718636UL, 1807030355UL, 215385887UL, 845421530UL, 654189622UL, 3610667273UL, 2576197887UL, 1275262872UL, 2806513944UL, 1517875462UL, 2492912955UL, 71403197UL, 219220133UL, 2181111477UL, 3826277490UL, 3465351710UL, 1232425455UL, 2630647391UL, 3280867676UL, 3343597872UL, 1331873639UL, 3624564545UL, 992324522UL, 3056113148UL, +3725661598UL, 782257020UL, 1786902552UL, 3768542219UL, 2777948797UL, 3392298403UL, 856888454UL, 2530862473UL, 2217907094UL, 2133505056UL, 4160889036UL, 3752437534UL, 4050672856UL, 1709182366UL, 1816409641UL, 1282922706UL, 1581813910UL, 4175126713UL, 2211317602UL, 616238454UL, 3806252779UL, 1796414157UL, 732700649UL, 2199328374UL, 3188624050UL, 983474330UL, 4225173324UL, 972036137UL, 2022548260UL, 2462701924UL, 880446667UL, 1410793611UL, +1200725173UL, 450033142UL, 772942770UL, 3179870546UL, 3889840648UL, 1907109304UL, 1268067149UL, 915918620UL, 4261932110UL, 1249098244UL, 301668366UL, 2414090506UL, 3798383292UL, 471794009UL, 1620796656UL, 1228520287UL, 152325583UL, 3499865580UL, 1275109063UL, 82853050UL, 3267460249UL, 3963199522UL, 4215066819UL, 4209882674UL, 1212493334UL, 47361585UL, 3408506640UL, 2468905351UL, 1324785625UL, 3195419905UL, 1878226915UL, 3321078070UL, +252381865UL, 4259927884UL, 1584154733UL, 1716437506UL, 1198684021UL, 922916691UL, 1800164165UL, 1734068880UL, 1591998796UL, 1479762464UL, 104399432UL, 2774114308UL, 1973878859UL, 3810955599UL, 362625839UL, 2591539911UL, 2126614872UL, 1727282404UL, 3908378015UL, 2956460273UL, 312410753UL, 4098052715UL, 3656295687UL, 687490649UL, 207904356UL, 354574195UL, 937379582UL, 355953909UL, 378445403UL, 4272692603UL, 2352732136UL, 2694800574UL, +3784169684UL, 1303281526UL, 4121521600UL, 2119254314UL, 1741415022UL, 2331527847UL, 1734311274UL, 2267513620UL, 3472164720UL, 480821513UL, 820692528UL, 4212588163UL, 3236687597UL, 299194858UL, 1128762168UL, 781151234UL, 2250704950UL, 1705861659UL, 2416322096UL, 160918735UL, 4288008793UL, 677982197UL, 4059323309UL, 2014660182UL, 3354205317UL, 3328850880UL, 1765435945UL, 867809161UL, 2167953720UL, 3363861382UL, 542850707UL, 2125103002UL, +1890906570UL, 2842247580UL, 2459935488UL, 3803006390UL, 2056644398UL, 1697038549UL, 3312131466UL, 2378675900UL, 809106036UL, 3063718636UL, 1807030355UL, 215385887UL, 3528413525UL, 654189622UL, 3610667273UL, 2576197887UL, 1275262872UL, 993221887UL, 1517875462UL, 2492912955UL, 71403197UL, 219220133UL, 1805256638UL, 3826277490UL, 3465351710UL, 1232425455UL, 2630647391UL, 3718538519UL, 3343597872UL, 1331873639UL, 3624564545UL, 992324522UL, +3490576382UL, 2532191937UL, 1108692984UL, 802110050UL, 3984561242UL, 1973015939UL, 1351080551UL, 2382044123UL, 2393286227UL, 860228704UL, 179528099UL, 3569709850UL, 233527199UL, 3657599850UL, 3269634908UL, 3278075383UL, 4037814788UL, 952837871UL, 2050210570UL, 2376157484UL, 2566048929UL, 4200278597UL, 123440514UL, 573557299UL, 1585379806UL, 4012659271UL, 4000306490UL, 2508478465UL, 970078629UL, 4064973573UL, 645149301UL, 109544347UL, +647594029UL, 2097163688UL, 1515080116UL, 2142799649UL, 2519702653UL, 3122920796UL, 1952249156UL, 3932382760UL, 2155292687UL, 2517875978UL, 249059416UL, 4282787227UL, 2595461065UL, 1004349415UL, 2151451255UL, 2510715277UL, 3004500356UL, 3410567758UL, 344538405UL, 1946747709UL, 470298928UL, 1033671146UL, 4207801290UL, 1411375630UL, 3419808553UL, 3218285984UL, 3584735265UL, 811222695UL, 3898833227UL, 3535298390UL, 3764741581UL, 3927026520UL, +2850086968UL, 2818485449UL, 1963038474UL, 1871366998UL, 1900570117UL, 997663534UL, 746627295UL, 1827737271UL, 3814054979UL, 728285698UL, 1696496343UL, 1696888597UL, 1010837663UL, 1756050352UL, 785994134UL, 1436861536UL, 1949153732UL, 2360018842UL, 1703393654UL, 2248338006UL, 3884572674UL, 789998735UL, 1155994673UL, 2022469457UL, 223162974UL, 309571006UL, 725482797UL, 3909032036UL, 2531190541UL, 373676789UL, 1061107200UL, 4231921550UL, +558635876UL, 2773807977UL, 1860218585UL, 1150041015UL, 2252812038UL, 2413330952UL, 191909567UL, 3518171813UL, 3513416318UL, 2679253717UL, 3850755687UL, 1564154710UL, 324714884UL, 1600953447UL, 4095583159UL, 1796641692UL, 2518000547UL, 3621187982UL, 501166402UL, 2112782420UL, 1704276185UL, 2249859782UL, 3754293422UL, 1942321901UL, 1851019104UL, 240158224UL, 3181132144UL, 2281632719UL, 808029657UL, 1721710011UL, 2287207169UL, 3044484177UL, +2363339534UL, 805273402UL, 3696016147UL, 3549191229UL, 3353631259UL, 2946802391UL, 383414270UL, 300735554UL, 471515206UL, 1907815837UL, 1576327662UL, 3825043525UL, 2817119733UL, 1973847200UL, 1398317206UL, 2221853087UL, 501440864UL, 642467132UL, 494410179UL, 1191241925UL, 3549838846UL, 3621239619UL, 2640266286UL, 4140123024UL, 315957218UL, 3696758268UL, 2502777875UL, 2150738616UL, 1570099119UL, 2598276767UL, 3585886712UL, 230047417UL, +}, +{ +220882755UL, 630187688UL, 2600079656UL, 3103815531UL, 4259457395UL, 306940008UL, 760977254UL, 558299017UL, 73879495UL, 2342545344UL, 572800511UL, 3922797738UL, 3754011306UL, 698257357UL, 1274843132UL, 1455757442UL, 1014649591UL, 3205662508UL, 2997738251UL, 613949432UL, 2267018388UL, 2925762681UL, 3702061213UL, 299380602UL, 1711070497UL, 4140032336UL, 4134705925UL, 2836703879UL, 3776863395UL, 507121465UL, 3480792188UL, 1862887216UL, +247780795UL, 2528677869UL, 2881446422UL, 271754977UL, 833498724UL, 1489102731UL, 3636156177UL, 1839744487UL, 2011839858UL, 2353400914UL, 510437606UL, 561141583UL, 2979592314UL, 3844268262UL, 3011027242UL, 3113817193UL, 3491178377UL, 1448376742UL, 2478683391UL, 2597550150UL, 699310968UL, 1979488062UL, 277591964UL, 1312002175UL, 168047351UL, 1826859926UL, 2030631355UL, 3097860388UL, 1950614326UL, 4070838751UL, 4454933UL, 1890661188UL, +3929835227UL, 1008498572UL, 3301557438UL, 3906313590UL, 1240635175UL, 280935563UL, 113509402UL, 226900299UL, 1246395851UL, 1220916742UL, 2651515540UL, 2058590162UL, 1983114332UL, 2040467861UL, 780818345UL, 544262576UL, 2826997265UL, 349354812UL, 2360120613UL, 1181324247UL, 2380347783UL, 3938729706UL, 1610628643UL, 2008635822UL, 2937909233UL, 1583978206UL, 3589167073UL, 1942470196UL, 402177406UL, 2636510744UL, 3709747478UL, 2428569572UL, +4071828137UL, 2880315633UL, 1433558231UL, 1137076031UL, 3833202201UL, 2378168250UL, 1412413704UL, 3349323744UL, 1740721660UL, 3155643175UL, 2580327273UL, 3020661883UL, 1658910832UL, 2065649368UL, 3277572880UL, 3795585437UL, 1266185861UL, 2925935368UL, 4147230645UL, 203577834UL, 2230529041UL, 2864778434UL, 270386174UL, 2867122465UL, 2676624544UL, 2035972330UL, 500973884UL, 2983028740UL, 117131866UL, 1456450936UL, 429171245UL, 3921563262UL, +342800398UL, 255116920UL, 1219580025UL, 1549741331UL, 3832317567UL, 3750096895UL, 4036554472UL, 4099775516UL, 1451717480UL, 149159438UL, 3593827664UL, 1406572509UL, 27774796UL, 1138983585UL, 1577536190UL, 978350835UL, 2704344602UL, 95204061UL, 1507155668UL, 304760810UL, 1981315657UL, 3139306913UL, 3908131532UL, 3767856445UL, 3851422551UL, 2018732047UL, 2474676116UL, 2745551516UL, 1585868430UL, 1125303733UL, 3147584753UL, 2368921260UL, +1524991519UL, 220882755UL, 630187688UL, 2600079656UL, 3103815531UL, 2671841243UL, 306940008UL, 760977254UL, 558299017UL, 73879495UL, 1196617651UL, 572800511UL, 3922797738UL, 3754011306UL, 698257357UL, 1982654891UL, 1455757442UL, 1014649591UL, 3205662508UL, 2997738251UL, 3769735713UL, 2267018388UL, 2925762681UL, 3702061213UL, 299380602UL, 2224634157UL, 4140032336UL, 4134705925UL, 2836703879UL, 3776863395UL, 1027030708UL, 3480792188UL, +1862887216UL, 247780795UL, 2528677869UL, 300214141UL, 271754977UL, 833498724UL, 1489102731UL, 3636156177UL, 1683033001UL, 2011839858UL, 2353400914UL, 510437606UL, 561141583UL, 2832813585UL, 3844268262UL, 3011027242UL, 3113817193UL, 3491178377UL, 316500941UL, 2478683391UL, 2597550150UL, 699310968UL, 1979488062UL, 4092049617UL, 1312002175UL, 168047351UL, 1826859926UL, 2030631355UL, 2797906491UL, 1950614326UL, 4070838751UL, 4454933UL, +1890661188UL, 2602196847UL, 1008498572UL, 3301557438UL, 3906313590UL, 1240635175UL, 946440664UL, 113509402UL, 226900299UL, 1246395851UL, 1220916742UL, 1314772486UL, 2058590162UL, 1983114332UL, 2040467861UL, 780818345UL, 3064382079UL, 2826997265UL, 349354812UL, 2360120613UL, 1181324247UL, 3434653713UL, 3938729706UL, 1610628643UL, 2008635822UL, 2937909233UL, 2815835447UL, 3589167073UL, 1942470196UL, 402177406UL, 2636510744UL, 865459039UL, +2428569572UL, 4071828137UL, 2880315633UL, 1433558231UL, 1582478959UL, 3833202201UL, 2378168250UL, 1412413704UL, 3349323744UL, 3686787615UL, 3155643175UL, 2580327273UL, 3020661883UL, 1658910832UL, 3152644489UL, 3277572880UL, 3795585437UL, 1266185861UL, 2925935368UL, 3101079227UL, 203577834UL, 2230529041UL, 2864778434UL, 270386174UL, 3024925346UL, 2676624544UL, 2035972330UL, 500973884UL, 2983028740UL, 974511421UL, 1456450936UL, 429171245UL, +3921563262UL, 342800398UL, 1540218139UL, 1219580025UL, 1549741331UL, 3832317567UL, 3750096895UL, 2195381148UL, 4099775516UL, 1451717480UL, 149159438UL, 3593827664UL, 3715984838UL, 27774796UL, 1138983585UL, 1577536190UL, 978350835UL, 2060213898UL, 95204061UL, 1507155668UL, 304760810UL, 1981315657UL, 774471092UL, 3908131532UL, 3767856445UL, 3851422551UL, 2018732047UL, 1649125731UL, 2745551516UL, 1585868430UL, 1125303733UL, 3147584753UL, +1661721342UL, 1524991519UL, 220882755UL, 630187688UL, 2600079656UL, 3647143842UL, 2671841243UL, 306940008UL, 760977254UL, 558299017UL, 3406011854UL, 1196617651UL, 572800511UL, 3922797738UL, 3754011306UL, 2314291278UL, 1982654891UL, 1455757442UL, 1014649591UL, 3205662508UL, 3471741326UL, 3769735713UL, 2267018388UL, 2925762681UL, 3702061213UL, 1593850639UL, 2224634157UL, 4140032336UL, 4134705925UL, 2836703879UL, 3918266498UL, 1027030708UL, +3480792188UL, 1862887216UL, 247780795UL, 3383776045UL, 300214141UL, 271754977UL, 833498724UL, 1489102731UL, 2477093804UL, 1683033001UL, 2011839858UL, 2353400914UL, 510437606UL, 2361664959UL, 2832813585UL, 3844268262UL, 3011027242UL, 3113817193UL, 1468705704UL, 316500941UL, 2478683391UL, 2597550150UL, 699310968UL, 1593029686UL, 4092049617UL, 1312002175UL, 168047351UL, 1826859926UL, 3922295193UL, 2797906491UL, 1950614326UL, 4070838751UL, +4454933UL, 485374579UL, 2602196847UL, 1008498572UL, 3301557438UL, 3906313590UL, 2102043683UL, 946440664UL, 113509402UL, 226900299UL, 1246395851UL, 2635764090UL, 1314772486UL, 2058590162UL, 1983114332UL, 2040467861UL, 354791UL, 3064382079UL, 2826997265UL, 349354812UL, 2360120613UL, 2126504772UL, 3434653713UL, 3938729706UL, 1610628643UL, 2008635822UL, 2400061949UL, 2815835447UL, 3589167073UL, 1942470196UL, 402177406UL, 806469309UL, +865459039UL, 2428569572UL, 4071828137UL, 2880315633UL, 2512200928UL, 1582478959UL, 3833202201UL, 2378168250UL, 1412413704UL, 2767451252UL, 3686787615UL, 3155643175UL, 2580327273UL, 3020661883UL, 1040874588UL, 3152644489UL, 3277572880UL, 3795585437UL, 1266185861UL, 238446394UL, 3101079227UL, 203577834UL, 2230529041UL, 2864778434UL, 653319712UL, 3024925346UL, 2676624544UL, 2035972330UL, 500973884UL, 3839534784UL, 974511421UL, 1456450936UL, +429171245UL, 3921563262UL, 602320448UL, 1540218139UL, 1219580025UL, 1549741331UL, 3832317567UL, 1068872823UL, 2195381148UL, 4099775516UL, 1451717480UL, 149159438UL, 1699607068UL, 3715984838UL, 27774796UL, 1138983585UL, 1577536190UL, 837921790UL, 2060213898UL, 95204061UL, 1507155668UL, 304760810UL, 1446133066UL, 774471092UL, 3908131532UL, 3767856445UL, 3851422551UL, 2672625648UL, 1649125731UL, 2745551516UL, 1585868430UL, 1125303733UL, +2181520384UL, 1661721342UL, 1524991519UL, 220882755UL, 630187688UL, 1599074811UL, 3647143842UL, 2671841243UL, 306940008UL, 760977254UL, 3020017536UL, 3406011854UL, 1196617651UL, 572800511UL, 3922797738UL, 810584907UL, 2314291278UL, 1982654891UL, 1455757442UL, 1014649591UL, 1775783567UL, 3471741326UL, 3769735713UL, 2267018388UL, 2925762681UL, 319055602UL, 1593850639UL, 2224634157UL, 4140032336UL, 4134705925UL, 2794599326UL, 3918266498UL, +1027030708UL, 3480792188UL, 1862887216UL, 659607854UL, 3383776045UL, 300214141UL, 271754977UL, 833498724UL, 4054679386UL, 2477093804UL, 1683033001UL, 2011839858UL, 2353400914UL, 283191425UL, 2361664959UL, 2832813585UL, 3844268262UL, 3011027242UL, 137688840UL, 1468705704UL, 316500941UL, 2478683391UL, 2597550150UL, 1468220070UL, 1593029686UL, 4092049617UL, 1312002175UL, 168047351UL, 1602414610UL, 3922295193UL, 2797906491UL, 1950614326UL, +4070838751UL, 3858763082UL, 485374579UL, 2602196847UL, 1008498572UL, 3301557438UL, 2719858709UL, 2102043683UL, 946440664UL, 113509402UL, 226900299UL, 798285817UL, 2635764090UL, 1314772486UL, 2058590162UL, 1983114332UL, 2526463430UL, 354791UL, 3064382079UL, 2826997265UL, 349354812UL, 249430921UL, 2126504772UL, 3434653713UL, 3938729706UL, 1610628643UL, 967431506UL, 2400061949UL, 2815835447UL, 3589167073UL, 1942470196UL, 669129162UL, +806469309UL, 865459039UL, 2428569572UL, 4071828137UL, 3447449944UL, 2512200928UL, 1582478959UL, 3833202201UL, 2378168250UL, 1945768856UL, 2767451252UL, 3686787615UL, 3155643175UL, 2580327273UL, 2905624117UL, 1040874588UL, 3152644489UL, 3277572880UL, 3795585437UL, 3869959934UL, 238446394UL, 3101079227UL, 203577834UL, 2230529041UL, 1087760616UL, 653319712UL, 3024925346UL, 2676624544UL, 2035972330UL, 741014356UL, 3839534784UL, 974511421UL, +1456450936UL, 429171245UL, 598362053UL, 602320448UL, 1540218139UL, 1219580025UL, 1549741331UL, 401740328UL, 1068872823UL, 2195381148UL, 4099775516UL, 1451717480UL, 412110161UL, 1699607068UL, 3715984838UL, 27774796UL, 1138983585UL, 1531670562UL, 837921790UL, 2060213898UL, 95204061UL, 1507155668UL, 90279751UL, 1446133066UL, 774471092UL, 3908131532UL, 3767856445UL, 1136546910UL, 2672625648UL, 1649125731UL, 2745551516UL, 1585868430UL, +857721974UL, 1470900829UL, 64550776UL, 3252081369UL, 1649342279UL, 378546910UL, 3444980597UL, 3134750739UL, 1010105258UL, 1395608241UL, 1003208120UL, 3960524028UL, 3200241620UL, 3079969898UL, 1508044775UL, 4153769914UL, 2838198142UL, 773928818UL, 25836261UL, 3812652461UL, 3870603819UL, 931071963UL, 2565579710UL, 2930918109UL, 1091097445UL, 2223628368UL, 2934719684UL, 430797922UL, 2102409587UL, 720592077UL, 1675280068UL, 2578226918UL, +1316600845UL, 3427946098UL, 682896800UL, 1861125007UL, 251332674UL, 1502078012UL, 3020904394UL, 1458399451UL, 3088315263UL, 1635399147UL, 3605560130UL, 1755669804UL, 3754169290UL, 962708070UL, 3896576937UL, 3764679740UL, 2707457262UL, 3082551065UL, 1558451132UL, 1046028905UL, 3206335691UL, 731828142UL, 1765772975UL, 1195727587UL, 2664218451UL, 4234957963UL, 4073757168UL, 3230123616UL, 683981262UL, 607599877UL, 3659273671UL, 3230354324UL, +3393069074UL, 3250708814UL, 2229361194UL, 3923623619UL, 4093221649UL, 2441971643UL, 1787414237UL, 3603907850UL, 2254399656UL, 3508336126UL, 3578571587UL, 2383062806UL, 1012097006UL, 4250629546UL, 2086981615UL, 4190388250UL, 1399942361UL, 400707931UL, 3159618664UL, 2129750192UL, 911779896UL, 2736829998UL, 1909644954UL, 2168355517UL, 1583901478UL, 3468891177UL, 509297602UL, 769296769UL, 1865028750UL, 43276967UL, 3375387845UL, 2647467777UL, +1544731454UL, 3479333955UL, 4279441447UL, 485490313UL, 3523606596UL, 2880752852UL, 1946443431UL, 3760803481UL, 3115278477UL, 3693898557UL, 2387822435UL, 334412170UL, 2054111717UL, 269013084UL, 170401553UL, 3456013554UL, 3395842846UL, 508189059UL, 3398715186UL, 3862791669UL, 2741070272UL, 65318715UL, 1933435210UL, 4086198650UL, 3033193928UL, 1242412691UL, 3397363281UL, 3187419149UL, 1019508117UL, 562380742UL, 961415837UL, 2990412400UL, +3597720222UL, 2754100415UL, 1793508822UL, 966564784UL, 1875616532UL, 394646945UL, 1386107842UL, 2750810827UL, 2931007937UL, 3356489930UL, 2358364634UL, 3703772713UL, 3188884403UL, 2793590498UL, 3285138686UL, 515002680UL, 521510516UL, 887213583UL, 1873460781UL, 1583027667UL, 613895001UL, 557578628UL, 1892686243UL, 1974572772UL, 595831726UL, 229299738UL, 3847982294UL, 448248098UL, 1493822844UL, 3326405260UL, 2752463855UL, 128616819UL, +}, +{ +2014765631UL, 3938779303UL, 1811986049UL, 2101875601UL, 887194972UL, 3966228860UL, 3450775746UL, 4026039255UL, 4082308025UL, 432404123UL, 3181099213UL, 1228097256UL, 2368258457UL, 2953933351UL, 2582232464UL, 1657799516UL, 3525421629UL, 3927364159UL, 978138132UL, 3603597064UL, 342571522UL, 2100072168UL, 676229632UL, 2062864895UL, 3713317279UL, 4255773013UL, 1179492389UL, 3501226604UL, 1641801113UL, 2066614519UL, 3303232023UL, 1717768923UL, +2333501450UL, 4246883128UL, 1655087824UL, 1547897374UL, 754215285UL, 2832638094UL, 1365153701UL, 3309513970UL, 765738141UL, 1177808869UL, 324127419UL, 1171195868UL, 3494966448UL, 1714410667UL, 3645762436UL, 603810292UL, 489970006UL, 3126166124UL, 1616642501UL, 2646836239UL, 734727001UL, 118064420UL, 1164195304UL, 3692353914UL, 2267623847UL, 405457397UL, 2510437259UL, 3245015882UL, 2110859730UL, 967046702UL, 265790493UL, 3007163818UL, +3178475505UL, 1784447992UL, 3662964942UL, 1509963062UL, 1867864652UL, 1377871790UL, 4185567242UL, 657897796UL, 1762205546UL, 3895944199UL, 693988565UL, 2359023506UL, 1667660316UL, 478341078UL, 1898651054UL, 2352226314UL, 202416031UL, 855532642UL, 2290137962UL, 1573485803UL, 3675269487UL, 2346740592UL, 3111005795UL, 1741227661UL, 1222572879UL, 2176146608UL, 1595608675UL, 197451178UL, 1729118168UL, 876472937UL, 3201705210UL, 2315408645UL, +699968623UL, 2185639066UL, 3960900430UL, 539499973UL, 4226318752UL, 266371152UL, 2714506838UL, 945022093UL, 1378798863UL, 1925020181UL, 574417318UL, 1341455098UL, 3664225722UL, 3020780778UL, 3256613994UL, 2081255019UL, 3082744844UL, 3572803922UL, 1726854692UL, 1167777002UL, 557257486UL, 3577067012UL, 3806913480UL, 1578577194UL, 2631896730UL, 3937479909UL, 826138924UL, 670145071UL, 832017019UL, 715875283UL, 2008704579UL, 804955545UL, +4184114494UL, 867004874UL, 3586861289UL, 1190193155UL, 3288754776UL, 2271906590UL, 2007547109UL, 2206084232UL, 1621944575UL, 973990634UL, 3981493346UL, 1972746975UL, 1040348653UL, 2895228417UL, 691038334UL, 775610724UL, 3837025597UL, 714850057UL, 2912426839UL, 774555258UL, 3553866253UL, 2096154755UL, 1645117543UL, 3401470072UL, 2056183169UL, 2029528044UL, 3145728013UL, 1090530001UL, 49523828UL, 2228313334UL, 4013648604UL, 4289025873UL, +2749397923UL, 2014765631UL, 3938779303UL, 1811986049UL, 2101875601UL, 1575247143UL, 3966228860UL, 3450775746UL, 4026039255UL, 4082308025UL, 532118065UL, 3181099213UL, 1228097256UL, 2368258457UL, 2953933351UL, 896129082UL, 1657799516UL, 3525421629UL, 3927364159UL, 978138132UL, 3403930517UL, 342571522UL, 2100072168UL, 676229632UL, 2062864895UL, 38934050UL, 4255773013UL, 1179492389UL, 3501226604UL, 1641801113UL, 4195983797UL, 3303232023UL, +1717768923UL, 2333501450UL, 4246883128UL, 2854551758UL, 1547897374UL, 754215285UL, 2832638094UL, 1365153701UL, 1406220165UL, 765738141UL, 1177808869UL, 324127419UL, 1171195868UL, 625985592UL, 1714410667UL, 3645762436UL, 603810292UL, 489970006UL, 344948229UL, 1616642501UL, 2646836239UL, 734727001UL, 118064420UL, 3360380275UL, 3692353914UL, 2267623847UL, 405457397UL, 2510437259UL, 3697919521UL, 2110859730UL, 967046702UL, 265790493UL, +3007163818UL, 1395299303UL, 1784447992UL, 3662964942UL, 1509963062UL, 1867864652UL, 849544728UL, 4185567242UL, 657897796UL, 1762205546UL, 3895944199UL, 1219998053UL, 2359023506UL, 1667660316UL, 478341078UL, 1898651054UL, 943166064UL, 202416031UL, 855532642UL, 2290137962UL, 1573485803UL, 4238971908UL, 2346740592UL, 3111005795UL, 1741227661UL, 1222572879UL, 2670048596UL, 1595608675UL, 197451178UL, 1729118168UL, 876472937UL, 94688481UL, +2315408645UL, 699968623UL, 2185639066UL, 3960900430UL, 1224638706UL, 4226318752UL, 266371152UL, 2714506838UL, 945022093UL, 2683523818UL, 1925020181UL, 574417318UL, 1341455098UL, 3664225722UL, 1168593559UL, 3256613994UL, 2081255019UL, 3082744844UL, 3572803922UL, 2816021735UL, 1167777002UL, 557257486UL, 3577067012UL, 3806913480UL, 740433434UL, 2631896730UL, 3937479909UL, 826138924UL, 670145071UL, 4127240538UL, 715875283UL, 2008704579UL, +804955545UL, 4184114494UL, 1692532062UL, 3586861289UL, 1190193155UL, 3288754776UL, 2271906590UL, 922306057UL, 2206084232UL, 1621944575UL, 973990634UL, 3981493346UL, 3555073644UL, 1040348653UL, 2895228417UL, 691038334UL, 775610724UL, 1798939042UL, 714850057UL, 2912426839UL, 774555258UL, 3553866253UL, 4209859609UL, 1645117543UL, 3401470072UL, 2056183169UL, 2029528044UL, 2169159734UL, 1090530001UL, 49523828UL, 2228313334UL, 4013648604UL, +1499948031UL, 2749397923UL, 2014765631UL, 3938779303UL, 1811986049UL, 2169095159UL, 1575247143UL, 3966228860UL, 3450775746UL, 4026039255UL, 1220311069UL, 532118065UL, 3181099213UL, 1228097256UL, 2368258457UL, 649921441UL, 896129082UL, 1657799516UL, 3525421629UL, 3927364159UL, 2546335470UL, 3403930517UL, 342571522UL, 2100072168UL, 676229632UL, 3090148374UL, 38934050UL, 4255773013UL, 1179492389UL, 3501226604UL, 2613176152UL, 4195983797UL, +3303232023UL, 1717768923UL, 2333501450UL, 3923041739UL, 2854551758UL, 1547897374UL, 754215285UL, 2832638094UL, 731392091UL, 1406220165UL, 765738141UL, 1177808869UL, 324127419UL, 12876722UL, 625985592UL, 1714410667UL, 3645762436UL, 603810292UL, 2789313462UL, 344948229UL, 1616642501UL, 2646836239UL, 734727001UL, 3369486664UL, 3360380275UL, 3692353914UL, 2267623847UL, 405457397UL, 4284067044UL, 3697919521UL, 2110859730UL, 967046702UL, +265790493UL, 2779045063UL, 1395299303UL, 1784447992UL, 3662964942UL, 1509963062UL, 3233239196UL, 849544728UL, 4185567242UL, 657897796UL, 1762205546UL, 2086953994UL, 1219998053UL, 2359023506UL, 1667660316UL, 478341078UL, 4137166515UL, 943166064UL, 202416031UL, 855532642UL, 2290137962UL, 1053737970UL, 4238971908UL, 2346740592UL, 3111005795UL, 1741227661UL, 3570501235UL, 2670048596UL, 1595608675UL, 197451178UL, 1729118168UL, 4162077327UL, +94688481UL, 2315408645UL, 699968623UL, 2185639066UL, 2842562270UL, 1224638706UL, 4226318752UL, 266371152UL, 2714506838UL, 755620309UL, 2683523818UL, 1925020181UL, 574417318UL, 1341455098UL, 3323621213UL, 1168593559UL, 3256613994UL, 2081255019UL, 3082744844UL, 3845230416UL, 2816021735UL, 1167777002UL, 557257486UL, 3577067012UL, 66225918UL, 740433434UL, 2631896730UL, 3937479909UL, 826138924UL, 522548622UL, 4127240538UL, 715875283UL, +2008704579UL, 804955545UL, 22190845UL, 1692532062UL, 3586861289UL, 1190193155UL, 3288754776UL, 610751818UL, 922306057UL, 2206084232UL, 1621944575UL, 973990634UL, 1771882567UL, 3555073644UL, 1040348653UL, 2895228417UL, 691038334UL, 149995790UL, 1798939042UL, 714850057UL, 2912426839UL, 774555258UL, 2020442761UL, 4209859609UL, 1645117543UL, 3401470072UL, 2056183169UL, 460813741UL, 2169159734UL, 1090530001UL, 49523828UL, 2228313334UL, +504317288UL, 1499948031UL, 2749397923UL, 2014765631UL, 3938779303UL, 1175469033UL, 2169095159UL, 1575247143UL, 3966228860UL, 3450775746UL, 1032079910UL, 1220311069UL, 532118065UL, 3181099213UL, 1228097256UL, 3353583885UL, 649921441UL, 896129082UL, 1657799516UL, 3525421629UL, 2830418357UL, 2546335470UL, 3403930517UL, 342571522UL, 2100072168UL, 1099053459UL, 3090148374UL, 38934050UL, 4255773013UL, 1179492389UL, 1634035942UL, 2613176152UL, +4195983797UL, 3303232023UL, 1717768923UL, 4175785502UL, 3923041739UL, 2854551758UL, 1547897374UL, 754215285UL, 3674851127UL, 731392091UL, 1406220165UL, 765738141UL, 1177808869UL, 776475327UL, 12876722UL, 625985592UL, 1714410667UL, 3645762436UL, 759189800UL, 2789313462UL, 344948229UL, 1616642501UL, 2646836239UL, 1228911282UL, 3369486664UL, 3360380275UL, 3692353914UL, 2267623847UL, 3058856811UL, 4284067044UL, 3697919521UL, 2110859730UL, +967046702UL, 3601311392UL, 2779045063UL, 1395299303UL, 1784447992UL, 3662964942UL, 284169442UL, 3233239196UL, 849544728UL, 4185567242UL, 657897796UL, 905886381UL, 2086953994UL, 1219998053UL, 2359023506UL, 1667660316UL, 2784311626UL, 4137166515UL, 943166064UL, 202416031UL, 855532642UL, 895862877UL, 1053737970UL, 4238971908UL, 2346740592UL, 3111005795UL, 1509264114UL, 3570501235UL, 2670048596UL, 1595608675UL, 197451178UL, 3653040124UL, +4162077327UL, 94688481UL, 2315408645UL, 699968623UL, 1071988392UL, 2842562270UL, 1224638706UL, 4226318752UL, 266371152UL, 4214356293UL, 755620309UL, 2683523818UL, 1925020181UL, 574417318UL, 119162126UL, 3323621213UL, 1168593559UL, 3256613994UL, 2081255019UL, 1317924999UL, 3845230416UL, 2816021735UL, 1167777002UL, 557257486UL, 638058809UL, 66225918UL, 740433434UL, 2631896730UL, 3937479909UL, 411228024UL, 522548622UL, 4127240538UL, +715875283UL, 2008704579UL, 2246049355UL, 22190845UL, 1692532062UL, 3586861289UL, 1190193155UL, 4078828073UL, 610751818UL, 922306057UL, 2206084232UL, 1621944575UL, 907181435UL, 1771882567UL, 3555073644UL, 1040348653UL, 2895228417UL, 940846326UL, 149995790UL, 1798939042UL, 714850057UL, 2912426839UL, 3345560812UL, 2020442761UL, 4209859609UL, 1645117543UL, 3401470072UL, 2036328600UL, 460813741UL, 2169159734UL, 1090530001UL, 49523828UL, +510136795UL, 2233313725UL, 1046048857UL, 700202384UL, 926275751UL, 4104982908UL, 3910999868UL, 1125213128UL, 492681420UL, 3891914731UL, 956545470UL, 115696875UL, 2957144177UL, 77090391UL, 467732901UL, 2599813105UL, 3888976883UL, 2098926023UL, 2844817051UL, 2069408123UL, 2239429902UL, 3793992219UL, 3020240490UL, 1721698056UL, 3012473888UL, 1537226153UL, 725991171UL, 61376035UL, 381912667UL, 3904514327UL, 40015731UL, 4263210119UL, +2876064791UL, 2732785471UL, 2934318283UL, 3134934287UL, 3161129365UL, 3789733734UL, 2954419388UL, 2742205850UL, 3488450208UL, 3252908703UL, 410643191UL, 3246033194UL, 2846558783UL, 828879673UL, 2428687670UL, 389617242UL, 63987225UL, 439842832UL, 2635895570UL, 3468152776UL, 4086700701UL, 3370617315UL, 2400127386UL, 4266992260UL, 3026019128UL, 4225721108UL, 1328114488UL, 2808680961UL, 3574018824UL, 4060262451UL, 2329039960UL, 1165344648UL, +3635963149UL, 2414703792UL, 2269100254UL, 832995451UL, 2143875746UL, 1031309981UL, 2129333746UL, 2606784227UL, 805236091UL, 666141116UL, 2749351381UL, 53998350UL, 2270447972UL, 2092784991UL, 877961283UL, 3019419608UL, 2438459472UL, 2273921167UL, 332279281UL, 3759993687UL, 2465113760UL, 3732237006UL, 322823266UL, 491053374UL, 686619591UL, 4192648122UL, 4118497267UL, 1948902148UL, 988375775UL, 2098328675UL, 3107501958UL, 2979856583UL, +2274193457UL, 6179961UL, 188209161UL, 1491245003UL, 3005972885UL, 1658799053UL, 3420802262UL, 2128792168UL, 3272743598UL, 4163716849UL, 817350318UL, 3372322557UL, 1525295885UL, 490587460UL, 3634834949UL, 2584809384UL, 3638373352UL, 2603765126UL, 3223396315UL, 4021061386UL, 2143780551UL, 248332433UL, 3654752967UL, 27201989UL, 3994156272UL, 5505477UL, 4260955724UL, 1175998822UL, 2665646240UL, 866875674UL, 3569324422UL, 202962714UL, +896177244UL, 3146417201UL, 1168925859UL, 2228636445UL, 105395449UL, 2567482935UL, 1301265751UL, 3739617610UL, 2486939910UL, 1891847857UL, 2647840744UL, 1141826566UL, 3360553996UL, 4267671927UL, 2546157872UL, 1143297884UL, 2049385137UL, 4288036836UL, 3347190546UL, 3480408604UL, 2756408254UL, 2396048567UL, 1151717877UL, 2211243289UL, 4221659024UL, 21773193UL, 1665317870UL, 3116384869UL, 3231689469UL, 3689471824UL, 1520574310UL, 463615415UL, +}, +{ +2647200400UL, 1592194261UL, 1289872755UL, 2079982087UL, 3431487085UL, 1101851783UL, 3373292799UL, 2148994262UL, 2785319928UL, 3206527339UL, 2731839331UL, 1280366172UL, 1146205735UL, 2930495205UL, 2876978398UL, 3885758458UL, 2062812458UL, 2448488486UL, 192141900UL, 3861696664UL, 2677929258UL, 3606729729UL, 2920965773UL, 1156521508UL, 3168665640UL, 298794036UL, 957896625UL, 2606719899UL, 3699219026UL, 3120096333UL, 2531109351UL, 1920936462UL, +2848868175UL, 1406404729UL, 2956672675UL, 1376226240UL, 3667482110UL, 2551426756UL, 3433640449UL, 2603906744UL, 4217864690UL, 47671552UL, 2993859190UL, 1269153270UL, 3463588775UL, 1655126430UL, 3453916724UL, 2157890969UL, 252769449UL, 1583335064UL, 2560819344UL, 52639671UL, 39618615UL, 313192112UL, 2625914283UL, 2964928555UL, 4226359627UL, 4141969666UL, 183405146UL, 1455378225UL, 2994063945UL, 3146629795UL, 2992956289UL, 368634554UL, +4110058153UL, 1156556441UL, 3690317172UL, 906928962UL, 3773042217UL, 948650679UL, 4134172918UL, 2922802573UL, 1417921660UL, 291400676UL, 3120733115UL, 3225369425UL, 3200455006UL, 2207799613UL, 1766261260UL, 914727455UL, 1927023103UL, 572959294UL, 3447057855UL, 4042691162UL, 840021910UL, 4187195325UL, 3627831667UL, 1671506539UL, 242673485UL, 3330397756UL, 776552069UL, 684550924UL, 261597601UL, 1857936262UL, 1022869402UL, 4209077103UL, +14248159UL, 2366156245UL, 1910356465UL, 2020463550UL, 873419743UL, 4290775093UL, 3670978210UL, 1726974037UL, 784115717UL, 3574834402UL, 357805142UL, 3820795621UL, 1854247318UL, 1161642656UL, 3977404318UL, 2054677775UL, 1737374322UL, 2852015019UL, 4277252452UL, 1392810771UL, 3742661504UL, 1900815804UL, 1965911170UL, 3540183220UL, 2106191537UL, 3606954134UL, 2108636204UL, 2981827052UL, 2506861567UL, 184003599UL, 3319252632UL, 1370913077UL, +940955681UL, 2244100002UL, 3683661822UL, 3215832318UL, 3463899341UL, 134577035UL, 3404365179UL, 2262494389UL, 88039196UL, 114405083UL, 1071449574UL, 4008494055UL, 765981248UL, 758357266UL, 2564125377UL, 901977407UL, 955156196UL, 3900980822UL, 134031448UL, 2566915950UL, 3445833537UL, 3138903399UL, 2113076217UL, 713587277UL, 3396078039UL, 3987657193UL, 3004104774UL, 800324742UL, 652529813UL, 3999083342UL, 486108562UL, 2103591900UL, +104743736UL, 2647200400UL, 1592194261UL, 1289872755UL, 2079982087UL, 552781204UL, 1101851783UL, 3373292799UL, 2148994262UL, 2785319928UL, 1222851809UL, 2731839331UL, 1280366172UL, 1146205735UL, 2930495205UL, 942360591UL, 3885758458UL, 2062812458UL, 2448488486UL, 192141900UL, 1909229999UL, 2677929258UL, 3606729729UL, 2920965773UL, 1156521508UL, 2995805883UL, 298794036UL, 957896625UL, 2606719899UL, 3699219026UL, 2447513005UL, 2531109351UL, +1920936462UL, 2848868175UL, 1406404729UL, 2751142611UL, 1376226240UL, 3667482110UL, 2551426756UL, 3433640449UL, 3724189478UL, 4217864690UL, 47671552UL, 2993859190UL, 1269153270UL, 2144136371UL, 1655126430UL, 3453916724UL, 2157890969UL, 252769449UL, 2959496542UL, 2560819344UL, 52639671UL, 39618615UL, 313192112UL, 2367743540UL, 2964928555UL, 4226359627UL, 4141969666UL, 183405146UL, 2006751422UL, 2994063945UL, 3146629795UL, 2992956289UL, +368634554UL, 1529794973UL, 1156556441UL, 3690317172UL, 906928962UL, 3773042217UL, 2005599428UL, 4134172918UL, 2922802573UL, 1417921660UL, 291400676UL, 2664982078UL, 3225369425UL, 3200455006UL, 2207799613UL, 1766261260UL, 2623711877UL, 1927023103UL, 572959294UL, 3447057855UL, 4042691162UL, 3510199782UL, 4187195325UL, 3627831667UL, 1671506539UL, 242673485UL, 1978730938UL, 776552069UL, 684550924UL, 261597601UL, 1857936262UL, 3273582958UL, +4209077103UL, 14248159UL, 2366156245UL, 1910356465UL, 457933823UL, 873419743UL, 4290775093UL, 3670978210UL, 1726974037UL, 1414288023UL, 3574834402UL, 357805142UL, 3820795621UL, 1854247318UL, 2679386897UL, 3977404318UL, 2054677775UL, 1737374322UL, 2852015019UL, 2411291453UL, 1392810771UL, 3742661504UL, 1900815804UL, 1965911170UL, 3719529323UL, 2106191537UL, 3606954134UL, 2108636204UL, 2981827052UL, 3702357099UL, 184003599UL, 3319252632UL, +1370913077UL, 940955681UL, 4262675711UL, 3683661822UL, 3215832318UL, 3463899341UL, 134577035UL, 3494669542UL, 2262494389UL, 88039196UL, 114405083UL, 1071449574UL, 1060831201UL, 765981248UL, 758357266UL, 2564125377UL, 901977407UL, 3003279383UL, 3900980822UL, 134031448UL, 2566915950UL, 3445833537UL, 2846863035UL, 2113076217UL, 713587277UL, 3396078039UL, 3987657193UL, 2067196130UL, 800324742UL, 652529813UL, 3999083342UL, 486108562UL, +2321935002UL, 104743736UL, 2647200400UL, 1592194261UL, 1289872755UL, 466892855UL, 552781204UL, 1101851783UL, 3373292799UL, 2148994262UL, 3078568050UL, 1222851809UL, 2731839331UL, 1280366172UL, 1146205735UL, 1710937426UL, 942360591UL, 3885758458UL, 2062812458UL, 2448488486UL, 3418446265UL, 1909229999UL, 2677929258UL, 3606729729UL, 2920965773UL, 1103324742UL, 2995805883UL, 298794036UL, 957896625UL, 2606719899UL, 675602173UL, 2447513005UL, +2531109351UL, 1920936462UL, 2848868175UL, 1509959171UL, 2751142611UL, 1376226240UL, 3667482110UL, 2551426756UL, 2447143807UL, 3724189478UL, 4217864690UL, 47671552UL, 2993859190UL, 2821422976UL, 2144136371UL, 1655126430UL, 3453916724UL, 2157890969UL, 3665277070UL, 2959496542UL, 2560819344UL, 52639671UL, 39618615UL, 2817859210UL, 2367743540UL, 2964928555UL, 4226359627UL, 4141969666UL, 2856219617UL, 2006751422UL, 2994063945UL, 3146629795UL, +2992956289UL, 3176479073UL, 1529794973UL, 1156556441UL, 3690317172UL, 906928962UL, 97899274UL, 2005599428UL, 4134172918UL, 2922802573UL, 1417921660UL, 1492426675UL, 2664982078UL, 3225369425UL, 3200455006UL, 2207799613UL, 2275640124UL, 2623711877UL, 1927023103UL, 572959294UL, 3447057855UL, 1036984002UL, 3510199782UL, 4187195325UL, 3627831667UL, 1671506539UL, 1827895694UL, 1978730938UL, 776552069UL, 684550924UL, 261597601UL, 3493571621UL, +3273582958UL, 4209077103UL, 14248159UL, 2366156245UL, 211745521UL, 457933823UL, 873419743UL, 4290775093UL, 3670978210UL, 1909994881UL, 1414288023UL, 3574834402UL, 357805142UL, 3820795621UL, 1911700755UL, 2679386897UL, 3977404318UL, 2054677775UL, 1737374322UL, 213019511UL, 2411291453UL, 1392810771UL, 3742661504UL, 1900815804UL, 237536256UL, 3719529323UL, 2106191537UL, 3606954134UL, 2108636204UL, 665423205UL, 3702357099UL, 184003599UL, +3319252632UL, 1370913077UL, 3583034472UL, 4262675711UL, 3683661822UL, 3215832318UL, 3463899341UL, 4027471772UL, 3494669542UL, 2262494389UL, 88039196UL, 114405083UL, 3580272354UL, 1060831201UL, 765981248UL, 758357266UL, 2564125377UL, 2592170747UL, 3003279383UL, 3900980822UL, 134031448UL, 2566915950UL, 1722483656UL, 2846863035UL, 2113076217UL, 713587277UL, 3396078039UL, 244197359UL, 2067196130UL, 800324742UL, 652529813UL, 3999083342UL, +2310369213UL, 2321935002UL, 104743736UL, 2647200400UL, 1592194261UL, 1610483859UL, 466892855UL, 552781204UL, 1101851783UL, 3373292799UL, 2617595614UL, 3078568050UL, 1222851809UL, 2731839331UL, 1280366172UL, 808483717UL, 1710937426UL, 942360591UL, 3885758458UL, 2062812458UL, 3260452154UL, 3418446265UL, 1909229999UL, 2677929258UL, 3606729729UL, 341113837UL, 1103324742UL, 2995805883UL, 298794036UL, 957896625UL, 2309730124UL, 675602173UL, +2447513005UL, 2531109351UL, 1920936462UL, 2268824429UL, 1509959171UL, 2751142611UL, 1376226240UL, 3667482110UL, 2745634237UL, 2447143807UL, 3724189478UL, 4217864690UL, 47671552UL, 2787057737UL, 2821422976UL, 2144136371UL, 1655126430UL, 3453916724UL, 339095616UL, 3665277070UL, 2959496542UL, 2560819344UL, 52639671UL, 3200765881UL, 2817859210UL, 2367743540UL, 2964928555UL, 4226359627UL, 3206913703UL, 2856219617UL, 2006751422UL, 2994063945UL, +3146629795UL, 1042016834UL, 3176479073UL, 1529794973UL, 1156556441UL, 3690317172UL, 171871257UL, 97899274UL, 2005599428UL, 4134172918UL, 2922802573UL, 1501051393UL, 1492426675UL, 2664982078UL, 3225369425UL, 3200455006UL, 1356823782UL, 2275640124UL, 2623711877UL, 1927023103UL, 572959294UL, 319456586UL, 1036984002UL, 3510199782UL, 4187195325UL, 3627831667UL, 3026392291UL, 1827895694UL, 1978730938UL, 776552069UL, 684550924UL, 2862336749UL, +3493571621UL, 3273582958UL, 4209077103UL, 14248159UL, 1597498830UL, 211745521UL, 457933823UL, 873419743UL, 4290775093UL, 2990300609UL, 1909994881UL, 1414288023UL, 3574834402UL, 357805142UL, 1957211849UL, 1911700755UL, 2679386897UL, 3977404318UL, 2054677775UL, 1006075205UL, 213019511UL, 2411291453UL, 1392810771UL, 3742661504UL, 1443139437UL, 237536256UL, 3719529323UL, 2106191537UL, 3606954134UL, 2671394121UL, 665423205UL, 3702357099UL, +184003599UL, 3319252632UL, 1632983188UL, 3583034472UL, 4262675711UL, 3683661822UL, 3215832318UL, 4080585934UL, 4027471772UL, 3494669542UL, 2262494389UL, 88039196UL, 677218369UL, 3580272354UL, 1060831201UL, 765981248UL, 758357266UL, 1277026792UL, 2592170747UL, 3003279383UL, 3900980822UL, 134031448UL, 4189207981UL, 1722483656UL, 2846863035UL, 2113076217UL, 713587277UL, 2098603934UL, 244197359UL, 2067196130UL, 800324742UL, 652529813UL, +1307843279UL, 3205610699UL, 1606722715UL, 2749781905UL, 3500078806UL, 320007706UL, 4092615096UL, 608085660UL, 1869480444UL, 459160631UL, 3657609957UL, 1944540526UL, 2184854884UL, 3497113751UL, 2817682182UL, 3367276652UL, 2069300794UL, 1466691974UL, 3078806052UL, 3998756116UL, 2068892089UL, 1789981386UL, 4196184114UL, 4004623319UL, 3029515569UL, 3206332209UL, 3424306963UL, 1805804276UL, 899469644UL, 1149853995UL, 903917909UL, 1185042552UL, +447265042UL, 3579272434UL, 116409560UL, 2211704275UL, 1237721838UL, 3636618157UL, 3191931082UL, 2430339315UL, 3551966793UL, 1533877057UL, 1700891210UL, 3317627852UL, 828148584UL, 1733460943UL, 3866870689UL, 3970886915UL, 1624935507UL, 3236099078UL, 4209593953UL, 1951283095UL, 1579020365UL, 1165668813UL, 1423097998UL, 1294879824UL, 3406063424UL, 3313007028UL, 2090501113UL, 842064167UL, 729587893UL, 2949702260UL, 2099637920UL, 260436310UL, +1056109549UL, 657874983UL, 2734575906UL, 4088958435UL, 3265216971UL, 1081848592UL, 2593212854UL, 4028921684UL, 2868974814UL, 2299228627UL, 49944924UL, 955114665UL, 2844328062UL, 885136505UL, 4262681333UL, 977883895UL, 998890598UL, 2026602293UL, 87852872UL, 2197997810UL, 910583259UL, 3151223623UL, 3960726944UL, 1778982325UL, 3322631234UL, 2940402694UL, 1619768059UL, 1592832128UL, 1434542537UL, 2107314297UL, 1170789408UL, 3357335254UL, +3317662644UL, 1409884338UL, 73741139UL, 1093507243UL, 329113525UL, 4199840577UL, 442295615UL, 3348669654UL, 435948047UL, 1154137005UL, 3151357655UL, 2101029905UL, 2430218233UL, 2474305449UL, 2316834456UL, 1736616135UL, 1575712778UL, 370866908UL, 4256943043UL, 2805503887UL, 1099763491UL, 2473785999UL, 3215573143UL, 472701386UL, 3070116154UL, 3969279119UL, 3331310102UL, 3932945670UL, 1502564397UL, 1294139579UL, 3073834823UL, 3115143551UL, +3602082994UL, 3707103500UL, 2570195094UL, 1268510174UL, 3561337287UL, 112422529UL, 1483304061UL, 3712148969UL, 3729628891UL, 2741131557UL, 4035019342UL, 2395091348UL, 208448216UL, 607199897UL, 4049058939UL, 3463267226UL, 3821711834UL, 1697628853UL, 691151709UL, 3014869414UL, 11610545UL, 3895793639UL, 3019679196UL, 1246664817UL, 753245113UL, 2236232962UL, 4172861179UL, 4030183420UL, 2367787106UL, 2209331085UL, 4170801007UL, 3609895913UL, +}, +{ +930278208UL, 223382535UL, 720499309UL, 2613473585UL, 4173439516UL, 2132019243UL, 468054579UL, 1141433627UL, 1328639101UL, 3222455434UL, 4023859457UL, 892124224UL, 2940688706UL, 2894552260UL, 1595432126UL, 2558709596UL, 2057191226UL, 1116728192UL, 3767370344UL, 1457278707UL, 3171850455UL, 3733161247UL, 149922078UL, 3860652874UL, 743952057UL, 1024625539UL, 3982786483UL, 2077838781UL, 3713742913UL, 2790452624UL, 3014482913UL, 2928857967UL, +476371337UL, 611803300UL, 3000092437UL, 57069608UL, 1554852195UL, 1406780525UL, 2288998898UL, 460131340UL, 3945168588UL, 18495216UL, 547882902UL, 1624966119UL, 2229423551UL, 1492565146UL, 706052879UL, 2733955743UL, 1450476708UL, 2565285196UL, 2491601298UL, 850297175UL, 331472128UL, 3275065709UL, 3154247398UL, 1364512871UL, 1193063601UL, 579449294UL, 4097747196UL, 3572372000UL, 2712499116UL, 1172861307UL, 3964137156UL, 1300564854UL, +1057993198UL, 2785733262UL, 3548277076UL, 2572944411UL, 3299232577UL, 2031854568UL, 2468534978UL, 602097973UL, 2068619195UL, 2639336890UL, 1694467033UL, 1581263823UL, 809076686UL, 2892861850UL, 4042078087UL, 3178152001UL, 706023882UL, 3236709493UL, 3603158102UL, 2575690800UL, 2831218686UL, 2492604085UL, 207296828UL, 1561595438UL, 2961967115UL, 3304283504UL, 835276604UL, 3005485731UL, 58946395UL, 3979071161UL, 1560535337UL, 2679058432UL, +1061627241UL, 1142692919UL, 1476802977UL, 1306619165UL, 1297953898UL, 4282928317UL, 3630719944UL, 2305895643UL, 2656730970UL, 916308118UL, 4160016206UL, 3541795573UL, 4222235077UL, 1289754532UL, 1963633184UL, 3595798857UL, 2273299603UL, 1687478595UL, 2249344966UL, 2267127964UL, 2201115693UL, 917609614UL, 3731921025UL, 1634893875UL, 3039440017UL, 1122674005UL, 2906728840UL, 921166852UL, 3525309936UL, 633872502UL, 821930665UL, 3861074060UL, +3309559821UL, 304858441UL, 1530517912UL, 1140212033UL, 3168869568UL, 3223449972UL, 1343718360UL, 2831361172UL, 1723616626UL, 3675867172UL, 2586694335UL, 2374941766UL, 387033391UL, 1528180036UL, 1561421035UL, 2735360720UL, 3952587140UL, 13543969UL, 3987997725UL, 4273177532UL, 2200558169UL, 461920718UL, 459441276UL, 4225054447UL, 2248193798UL, 1103878063UL, 3027778665UL, 1844457031UL, 1364117386UL, 1575430424UL, 2276483962UL, 2665252582UL, +1572038262UL, 930278208UL, 223382535UL, 720499309UL, 2613473585UL, 4025056228UL, 2132019243UL, 468054579UL, 1141433627UL, 1328639101UL, 304940359UL, 4023859457UL, 892124224UL, 2940688706UL, 2894552260UL, 2006939659UL, 2558709596UL, 2057191226UL, 1116728192UL, 3767370344UL, 3026555841UL, 3171850455UL, 3733161247UL, 149922078UL, 3860652874UL, 2068299929UL, 1024625539UL, 3982786483UL, 2077838781UL, 3713742913UL, 2512419366UL, 3014482913UL, +2928857967UL, 476371337UL, 611803300UL, 259065762UL, 57069608UL, 1554852195UL, 1406780525UL, 2288998898UL, 2261401631UL, 3945168588UL, 18495216UL, 547882902UL, 1624966119UL, 3049748661UL, 1492565146UL, 706052879UL, 2733955743UL, 1450476708UL, 910808481UL, 2491601298UL, 850297175UL, 331472128UL, 3275065709UL, 3877736250UL, 1364512871UL, 1193063601UL, 579449294UL, 4097747196UL, 3029512053UL, 2712499116UL, 1172861307UL, 3964137156UL, +1300564854UL, 2398462790UL, 2785733262UL, 3548277076UL, 2572944411UL, 3299232577UL, 3497485227UL, 2468534978UL, 602097973UL, 2068619195UL, 2639336890UL, 4271191874UL, 1581263823UL, 809076686UL, 2892861850UL, 4042078087UL, 3046259144UL, 706023882UL, 3236709493UL, 3603158102UL, 2575690800UL, 591682100UL, 2492604085UL, 207296828UL, 1561595438UL, 2961967115UL, 3885379584UL, 835276604UL, 3005485731UL, 58946395UL, 3979071161UL, 2784795951UL, +2679058432UL, 1061627241UL, 1142692919UL, 1476802977UL, 2864266022UL, 1297953898UL, 4282928317UL, 3630719944UL, 2305895643UL, 3374260620UL, 916308118UL, 4160016206UL, 3541795573UL, 4222235077UL, 3025355241UL, 1963633184UL, 3595798857UL, 2273299603UL, 1687478595UL, 4115795122UL, 2267127964UL, 2201115693UL, 917609614UL, 3731921025UL, 2905712346UL, 3039440017UL, 1122674005UL, 2906728840UL, 921166852UL, 2881663141UL, 633872502UL, 821930665UL, +3861074060UL, 3309559821UL, 2816533968UL, 1530517912UL, 1140212033UL, 3168869568UL, 3223449972UL, 1894667948UL, 2831361172UL, 1723616626UL, 3675867172UL, 2586694335UL, 3974041178UL, 387033391UL, 1528180036UL, 1561421035UL, 2735360720UL, 2014321457UL, 13543969UL, 3987997725UL, 4273177532UL, 2200558169UL, 2259553303UL, 459441276UL, 4225054447UL, 2248193798UL, 1103878063UL, 3889361594UL, 1844457031UL, 1364117386UL, 1575430424UL, 2276483962UL, +3302182736UL, 1572038262UL, 930278208UL, 223382535UL, 720499309UL, 4173186621UL, 4025056228UL, 2132019243UL, 468054579UL, 1141433627UL, 2396654717UL, 304940359UL, 4023859457UL, 892124224UL, 2940688706UL, 2903529759UL, 2006939659UL, 2558709596UL, 2057191226UL, 1116728192UL, 715931354UL, 3026555841UL, 3171850455UL, 3733161247UL, 149922078UL, 3342675578UL, 2068299929UL, 1024625539UL, 3982786483UL, 2077838781UL, 1157097180UL, 2512419366UL, +3014482913UL, 2928857967UL, 476371337UL, 2192872017UL, 259065762UL, 57069608UL, 1554852195UL, 1406780525UL, 4165039782UL, 2261401631UL, 3945168588UL, 18495216UL, 547882902UL, 2453072030UL, 3049748661UL, 1492565146UL, 706052879UL, 2733955743UL, 2233423433UL, 910808481UL, 2491601298UL, 850297175UL, 331472128UL, 1154483111UL, 3877736250UL, 1364512871UL, 1193063601UL, 579449294UL, 690173400UL, 3029512053UL, 2712499116UL, 1172861307UL, +3964137156UL, 2683130322UL, 2398462790UL, 2785733262UL, 3548277076UL, 2572944411UL, 4075824857UL, 3497485227UL, 2468534978UL, 602097973UL, 2068619195UL, 2711665545UL, 4271191874UL, 1581263823UL, 809076686UL, 2892861850UL, 3558962856UL, 3046259144UL, 706023882UL, 3236709493UL, 3603158102UL, 274706518UL, 591682100UL, 2492604085UL, 207296828UL, 1561595438UL, 1532885415UL, 3885379584UL, 835276604UL, 3005485731UL, 58946395UL, 4143205928UL, +2784795951UL, 2679058432UL, 1061627241UL, 1142692919UL, 2539503297UL, 2864266022UL, 1297953898UL, 4282928317UL, 3630719944UL, 3333189589UL, 3374260620UL, 916308118UL, 4160016206UL, 3541795573UL, 1771535488UL, 3025355241UL, 1963633184UL, 3595798857UL, 2273299603UL, 1735171204UL, 4115795122UL, 2267127964UL, 2201115693UL, 917609614UL, 4220503034UL, 2905712346UL, 3039440017UL, 1122674005UL, 2906728840UL, 868453017UL, 2881663141UL, 633872502UL, +821930665UL, 3861074060UL, 1928586970UL, 2816533968UL, 1530517912UL, 1140212033UL, 3168869568UL, 1082127627UL, 1894667948UL, 2831361172UL, 1723616626UL, 3675867172UL, 496773835UL, 3974041178UL, 387033391UL, 1528180036UL, 1561421035UL, 2763161987UL, 2014321457UL, 13543969UL, 3987997725UL, 4273177532UL, 2110570579UL, 2259553303UL, 459441276UL, 4225054447UL, 2248193798UL, 53021618UL, 3889361594UL, 1844457031UL, 1364117386UL, 1575430424UL, +1105247032UL, 3302182736UL, 1572038262UL, 930278208UL, 223382535UL, 2159964170UL, 4173186621UL, 4025056228UL, 2132019243UL, 468054579UL, 1397544344UL, 2396654717UL, 304940359UL, 4023859457UL, 892124224UL, 2800429255UL, 2903529759UL, 2006939659UL, 2558709596UL, 2057191226UL, 296054924UL, 715931354UL, 3026555841UL, 3171850455UL, 3733161247UL, 863280930UL, 3342675578UL, 2068299929UL, 1024625539UL, 3982786483UL, 949122664UL, 1157097180UL, +2512419366UL, 3014482913UL, 2928857967UL, 2585465463UL, 2192872017UL, 259065762UL, 57069608UL, 1554852195UL, 3650462338UL, 4165039782UL, 2261401631UL, 3945168588UL, 18495216UL, 524715648UL, 2453072030UL, 3049748661UL, 1492565146UL, 706052879UL, 123143857UL, 2233423433UL, 910808481UL, 2491601298UL, 850297175UL, 3272095697UL, 1154483111UL, 3877736250UL, 1364512871UL, 1193063601UL, 2394240337UL, 690173400UL, 3029512053UL, 2712499116UL, +1172861307UL, 598335483UL, 2683130322UL, 2398462790UL, 2785733262UL, 3548277076UL, 678275336UL, 4075824857UL, 3497485227UL, 2468534978UL, 602097973UL, 1861912463UL, 2711665545UL, 4271191874UL, 1581263823UL, 809076686UL, 3324887617UL, 3558962856UL, 3046259144UL, 706023882UL, 3236709493UL, 1776103512UL, 274706518UL, 591682100UL, 2492604085UL, 207296828UL, 1739697610UL, 1532885415UL, 3885379584UL, 835276604UL, 3005485731UL, 2931144546UL, +4143205928UL, 2784795951UL, 2679058432UL, 1061627241UL, 1487949699UL, 2539503297UL, 2864266022UL, 1297953898UL, 4282928317UL, 4101955339UL, 3333189589UL, 3374260620UL, 916308118UL, 4160016206UL, 376029432UL, 1771535488UL, 3025355241UL, 1963633184UL, 3595798857UL, 2826786027UL, 1735171204UL, 4115795122UL, 2267127964UL, 2201115693UL, 2572535497UL, 4220503034UL, 2905712346UL, 3039440017UL, 1122674005UL, 2482828099UL, 868453017UL, 2881663141UL, +633872502UL, 821930665UL, 2579406681UL, 1928586970UL, 2816533968UL, 1530517912UL, 1140212033UL, 2547368381UL, 1082127627UL, 1894667948UL, 2831361172UL, 1723616626UL, 1903980411UL, 496773835UL, 3974041178UL, 387033391UL, 1528180036UL, 2681142643UL, 2763161987UL, 2014321457UL, 13543969UL, 3987997725UL, 2583502227UL, 2110570579UL, 2259553303UL, 459441276UL, 4225054447UL, 177868402UL, 53021618UL, 3889361594UL, 1844457031UL, 1364117386UL, +2369166739UL, 240269378UL, 689700242UL, 297384154UL, 1052178701UL, 2154172820UL, 614713903UL, 3000863907UL, 3916962502UL, 94341217UL, 2609111975UL, 1621831476UL, 4260159710UL, 694869580UL, 1708268072UL, 2751452128UL, 3843916827UL, 3400387883UL, 2394104046UL, 2348934617UL, 3263438569UL, 3818556032UL, 1695621950UL, 410888855UL, 347231182UL, 612084657UL, 1858306225UL, 3024940417UL, 2482215564UL, 2728249904UL, 2825132299UL, 329106327UL, +3333110741UL, 2742025573UL, 2947035922UL, 3758718780UL, 2191527983UL, 864130510UL, 2586839659UL, 662702978UL, 817620197UL, 2888275812UL, 3372817000UL, 2982240654UL, 2211025418UL, 2043458594UL, 498221898UL, 1559803796UL, 209509183UL, 3004637012UL, 2204871924UL, 2445352606UL, 4026842262UL, 3211433366UL, 3533095828UL, 4172447076UL, 865408944UL, 2797639687UL, 3201749441UL, 1286664278UL, 1158271235UL, 2641361834UL, 4261559289UL, 3643706696UL, +2017210420UL, 2067296744UL, 3548126272UL, 3846378526UL, 3885857009UL, 3013926193UL, 368948443UL, 3839554625UL, 2032663713UL, 4185819024UL, 4279332940UL, 137321733UL, 3515190288UL, 4281845500UL, 2738024944UL, 3350239126UL, 1456676856UL, 1246688651UL, 2478709188UL, 12570320UL, 989306366UL, 2347610707UL, 2849134988UL, 2351681449UL, 4063448910UL, 1193872626UL, 3645565330UL, 1863134777UL, 1345198234UL, 2504863006UL, 3815974850UL, 3075495578UL, +2400383333UL, 2727346254UL, 985812393UL, 1432182882UL, 3668977714UL, 231840487UL, 647229148UL, 274547428UL, 2856186783UL, 1273158535UL, 900081267UL, 1566366419UL, 562584841UL, 2247144789UL, 3522587233UL, 1686032132UL, 586483076UL, 1207387616UL, 3040778905UL, 2532774045UL, 3681992451UL, 1034866888UL, 4029685195UL, 3307070989UL, 2412903766UL, 3156200186UL, 2625083166UL, 4148004113UL, 1756566287UL, 2319065855UL, 2924909429UL, 3050022486UL, +2464491722UL, 1137782196UL, 2749457821UL, 790410752UL, 3511746957UL, 2277733721UL, 2871407058UL, 3858561909UL, 2176119631UL, 952943025UL, 2987154266UL, 120799539UL, 2862346597UL, 3689389598UL, 3329995989UL, 715438735UL, 1035277216UL, 3079684809UL, 677298106UL, 2364292665UL, 4110165256UL, 4096954153UL, 356732100UL, 2361282903UL, 4050817284UL, 2010946835UL, 1824397679UL, 4087204231UL, 4178036725UL, 4197370951UL, 503070461UL, 1879838906UL, +}, +{ +4117851084UL, 2941903397UL, 1156439261UL, 1922510465UL, 2925632294UL, 2272105738UL, 641404242UL, 3414739418UL, 2602896978UL, 672876430UL, 1998875331UL, 1325970749UL, 1633717408UL, 3567722815UL, 2088144733UL, 95705225UL, 580635702UL, 3543633503UL, 1469889369UL, 239816045UL, 2254984383UL, 1632695776UL, 2033839470UL, 4117902893UL, 509938588UL, 1291002316UL, 3600816069UL, 2962644092UL, 4269959520UL, 3161890066UL, 1908855486UL, 1177948589UL, +473118979UL, 3205649854UL, 2027137481UL, 227656706UL, 1485922673UL, 3380103860UL, 2080286336UL, 2588604114UL, 1727893393UL, 3602757903UL, 3126385963UL, 2101893784UL, 3058515017UL, 833779022UL, 719369683UL, 3768029740UL, 1123855192UL, 2580550821UL, 3694463505UL, 1137588651UL, 1724433728UL, 3847324234UL, 2368689516UL, 1226895255UL, 1126753016UL, 2557024841UL, 3187601018UL, 3790080711UL, 2423256074UL, 2463913828UL, 1753321774UL, 1621519784UL, +3456900204UL, 3550875802UL, 3783120790UL, 2740104077UL, 2010858632UL, 1569277627UL, 1492853575UL, 2182681191UL, 3866043645UL, 2566155095UL, 770150438UL, 2482504045UL, 3916834400UL, 222960658UL, 342285296UL, 3354506276UL, 1371039946UL, 3717269950UL, 3632913684UL, 2557531969UL, 3934379214UL, 1732115898UL, 1598596195UL, 1180866173UL, 3526785234UL, 2740387380UL, 3540138766UL, 338607286UL, 3262593182UL, 2413619772UL, 2248013920UL, 3557851982UL, +2470276596UL, 1549877186UL, 447909575UL, 4010548064UL, 282941857UL, 3418249797UL, 3300699992UL, 1957423733UL, 2615274674UL, 370155667UL, 1109991145UL, 933065597UL, 3947818943UL, 3221736239UL, 402503017UL, 4016454981UL, 3640556350UL, 243947268UL, 1175418215UL, 2752078014UL, 371928981UL, 3354635500UL, 3471578165UL, 2735623932UL, 445067764UL, 2732367763UL, 3225606514UL, 1214718589UL, 2197756425UL, 2134958042UL, 680726116UL, 3098695319UL, +2103463364UL, 4058022972UL, 2428195541UL, 2433504485UL, 4042288512UL, 2383438250UL, 3821638336UL, 2375226348UL, 806148488UL, 197247918UL, 768984129UL, 412771011UL, 4020619856UL, 3030619444UL, 3242554868UL, 282156707UL, 3718880754UL, 2938924979UL, 4189583150UL, 1604586306UL, 1245779881UL, 4006389745UL, 2437150739UL, 1749517801UL, 2903749036UL, 1247308303UL, 2580023735UL, 2457849017UL, 342934950UL, 216040419UL, 3176519601UL, 4151509434UL, +2404801649UL, 4117851084UL, 2941903397UL, 1156439261UL, 1922510465UL, 14864453UL, 2272105738UL, 641404242UL, 3414739418UL, 2602896978UL, 2179417586UL, 1998875331UL, 1325970749UL, 1633717408UL, 3567722815UL, 428880410UL, 95705225UL, 580635702UL, 3543633503UL, 1469889369UL, 3132946201UL, 2254984383UL, 1632695776UL, 2033839470UL, 4117902893UL, 3029657560UL, 1291002316UL, 3600816069UL, 2962644092UL, 4269959520UL, 397442545UL, 1908855486UL, +1177948589UL, 473118979UL, 3205649854UL, 990384909UL, 227656706UL, 1485922673UL, 3380103860UL, 2080286336UL, 3295033100UL, 1727893393UL, 3602757903UL, 3126385963UL, 2101893784UL, 1132286601UL, 833779022UL, 719369683UL, 3768029740UL, 1123855192UL, 283414013UL, 3694463505UL, 1137588651UL, 1724433728UL, 3847324234UL, 1735742473UL, 1226895255UL, 1126753016UL, 2557024841UL, 3187601018UL, 2090644528UL, 2423256074UL, 2463913828UL, 1753321774UL, +1621519784UL, 1037552449UL, 3550875802UL, 3783120790UL, 2740104077UL, 2010858632UL, 3730461081UL, 1492853575UL, 2182681191UL, 3866043645UL, 2566155095UL, 2782805925UL, 2482504045UL, 3916834400UL, 222960658UL, 342285296UL, 2406892654UL, 1371039946UL, 3717269950UL, 3632913684UL, 2557531969UL, 4071148456UL, 1732115898UL, 1598596195UL, 1180866173UL, 3526785234UL, 1110366522UL, 3540138766UL, 338607286UL, 3262593182UL, 2413619772UL, 995824548UL, +3557851982UL, 2470276596UL, 1549877186UL, 447909575UL, 2962194596UL, 282941857UL, 3418249797UL, 3300699992UL, 1957423733UL, 1859612288UL, 370155667UL, 1109991145UL, 933065597UL, 3947818943UL, 3005912276UL, 402503017UL, 4016454981UL, 3640556350UL, 243947268UL, 2884057401UL, 2752078014UL, 371928981UL, 3354635500UL, 3471578165UL, 908942821UL, 445067764UL, 2732367763UL, 3225606514UL, 1214718589UL, 4104754911UL, 2134958042UL, 680726116UL, +3098695319UL, 2103463364UL, 2946640978UL, 2428195541UL, 2433504485UL, 4042288512UL, 2383438250UL, 1252490765UL, 2375226348UL, 806148488UL, 197247918UL, 768984129UL, 2578888115UL, 4020619856UL, 3030619444UL, 3242554868UL, 282156707UL, 3433259466UL, 2938924979UL, 4189583150UL, 1604586306UL, 1245779881UL, 616758943UL, 2437150739UL, 1749517801UL, 2903749036UL, 1247308303UL, 2722580830UL, 2457849017UL, 342934950UL, 216040419UL, 3176519601UL, +545097903UL, 2404801649UL, 4117851084UL, 2941903397UL, 1156439261UL, 1253296096UL, 14864453UL, 2272105738UL, 641404242UL, 3414739418UL, 2989955985UL, 2179417586UL, 1998875331UL, 1325970749UL, 1633717408UL, 1896726594UL, 428880410UL, 95705225UL, 580635702UL, 3543633503UL, 3294258049UL, 3132946201UL, 2254984383UL, 1632695776UL, 2033839470UL, 829668922UL, 3029657560UL, 1291002316UL, 3600816069UL, 2962644092UL, 715635401UL, 397442545UL, +1908855486UL, 1177948589UL, 473118979UL, 443010703UL, 990384909UL, 227656706UL, 1485922673UL, 3380103860UL, 727464961UL, 3295033100UL, 1727893393UL, 3602757903UL, 3126385963UL, 3020775130UL, 1132286601UL, 833779022UL, 719369683UL, 3768029740UL, 2215591597UL, 283414013UL, 3694463505UL, 1137588651UL, 1724433728UL, 2124955521UL, 1735742473UL, 1226895255UL, 1126753016UL, 2557024841UL, 1719121879UL, 2090644528UL, 2423256074UL, 2463913828UL, +1753321774UL, 1283364713UL, 1037552449UL, 3550875802UL, 3783120790UL, 2740104077UL, 3326764615UL, 3730461081UL, 1492853575UL, 2182681191UL, 3866043645UL, 1353658829UL, 2782805925UL, 2482504045UL, 3916834400UL, 222960658UL, 2681616579UL, 2406892654UL, 1371039946UL, 3717269950UL, 3632913684UL, 2373372484UL, 4071148456UL, 1732115898UL, 1598596195UL, 1180866173UL, 3787873944UL, 1110366522UL, 3540138766UL, 338607286UL, 3262593182UL, 1714619779UL, +995824548UL, 3557851982UL, 2470276596UL, 1549877186UL, 2342751414UL, 2962194596UL, 282941857UL, 3418249797UL, 3300699992UL, 2080590834UL, 1859612288UL, 370155667UL, 1109991145UL, 933065597UL, 4126279826UL, 3005912276UL, 402503017UL, 4016454981UL, 3640556350UL, 618040940UL, 2884057401UL, 2752078014UL, 371928981UL, 3354635500UL, 2952377979UL, 908942821UL, 445067764UL, 2732367763UL, 3225606514UL, 935181950UL, 4104754911UL, 2134958042UL, +680726116UL, 3098695319UL, 652514936UL, 2946640978UL, 2428195541UL, 2433504485UL, 4042288512UL, 1834165243UL, 1252490765UL, 2375226348UL, 806148488UL, 197247918UL, 1459523569UL, 2578888115UL, 4020619856UL, 3030619444UL, 3242554868UL, 2222750155UL, 3433259466UL, 2938924979UL, 4189583150UL, 1604586306UL, 400149547UL, 616758943UL, 2437150739UL, 1749517801UL, 2903749036UL, 571531698UL, 2722580830UL, 2457849017UL, 342934950UL, 216040419UL, +3302138698UL, 545097903UL, 2404801649UL, 4117851084UL, 2941903397UL, 2926001994UL, 1253296096UL, 14864453UL, 2272105738UL, 641404242UL, 2446601571UL, 2989955985UL, 2179417586UL, 1998875331UL, 1325970749UL, 2470418771UL, 1896726594UL, 428880410UL, 95705225UL, 580635702UL, 95529058UL, 3294258049UL, 3132946201UL, 2254984383UL, 1632695776UL, 3381575123UL, 829668922UL, 3029657560UL, 1291002316UL, 3600816069UL, 332821128UL, 715635401UL, +397442545UL, 1908855486UL, 1177948589UL, 3324147260UL, 443010703UL, 990384909UL, 227656706UL, 1485922673UL, 3468390490UL, 727464961UL, 3295033100UL, 1727893393UL, 3602757903UL, 3849734062UL, 3020775130UL, 1132286601UL, 833779022UL, 719369683UL, 3336941985UL, 2215591597UL, 283414013UL, 3694463505UL, 1137588651UL, 1245145305UL, 2124955521UL, 1735742473UL, 1226895255UL, 1126753016UL, 1536376839UL, 1719121879UL, 2090644528UL, 2423256074UL, +2463913828UL, 4035794571UL, 1283364713UL, 1037552449UL, 3550875802UL, 3783120790UL, 4233012781UL, 3326764615UL, 3730461081UL, 1492853575UL, 2182681191UL, 654850701UL, 1353658829UL, 2782805925UL, 2482504045UL, 3916834400UL, 1556782509UL, 2681616579UL, 2406892654UL, 1371039946UL, 3717269950UL, 1227526114UL, 2373372484UL, 4071148456UL, 1732115898UL, 1598596195UL, 1777009717UL, 3787873944UL, 1110366522UL, 3540138766UL, 338607286UL, 1161080599UL, +1714619779UL, 995824548UL, 3557851982UL, 2470276596UL, 3162659171UL, 2342751414UL, 2962194596UL, 282941857UL, 3418249797UL, 1032034511UL, 2080590834UL, 1859612288UL, 370155667UL, 1109991145UL, 2568097099UL, 4126279826UL, 3005912276UL, 402503017UL, 4016454981UL, 3196575353UL, 618040940UL, 2884057401UL, 2752078014UL, 371928981UL, 4223799564UL, 2952377979UL, 908942821UL, 445067764UL, 2732367763UL, 174723563UL, 935181950UL, 4104754911UL, +2134958042UL, 680726116UL, 649687363UL, 652514936UL, 2946640978UL, 2428195541UL, 2433504485UL, 3735735592UL, 1834165243UL, 1252490765UL, 2375226348UL, 806148488UL, 3720638976UL, 1459523569UL, 2578888115UL, 4020619856UL, 3030619444UL, 283333114UL, 2222750155UL, 3433259466UL, 2938924979UL, 4189583150UL, 870522428UL, 400149547UL, 616758943UL, 2437150739UL, 1749517801UL, 999295363UL, 571531698UL, 2722580830UL, 2457849017UL, 342934950UL, +3151292467UL, 2839665217UL, 2452261456UL, 208520727UL, 2269948412UL, 344787478UL, 3987474076UL, 3770524881UL, 2718719281UL, 2537804795UL, 850790212UL, 639946566UL, 2073602691UL, 2316769983UL, 3577216077UL, 3538374748UL, 61447995UL, 3718817085UL, 1476398788UL, 3239144530UL, 3595014456UL, 454482110UL, 286330934UL, 2119173159UL, 1693518756UL, 1464218560UL, 1201825197UL, 1112746405UL, 2988579776UL, 1626663767UL, 2236015969UL, 4018896468UL, +1885926862UL, 671386673UL, 1583086162UL, 1114723892UL, 2936863300UL, 2620955107UL, 2628074015UL, 426673611UL, 3370181092UL, 3462245129UL, 3590185736UL, 2630441788UL, 171626554UL, 3647663038UL, 880996914UL, 1155913149UL, 2653278555UL, 508978149UL, 2031872445UL, 3041145171UL, 1339819022UL, 127509725UL, 1336955078UL, 727702092UL, 693349672UL, 999665905UL, 2287631318UL, 961427722UL, 3355851447UL, 821851136UL, 2370998072UL, 4027450519UL, +2054803464UL, 144596514UL, 3295312213UL, 2579322479UL, 2982266864UL, 4275468400UL, 179988815UL, 2123828208UL, 1486957870UL, 2484928010UL, 288096701UL, 1211834301UL, 1819157080UL, 3569000238UL, 4164201803UL, 3042117433UL, 2741571248UL, 3688451311UL, 29376415UL, 437788821UL, 994675658UL, 1014591996UL, 296335443UL, 363551454UL, 2628890394UL, 332401256UL, 2288239762UL, 3766239385UL, 317162173UL, 3721125104UL, 2296650899UL, 56428392UL, +3900411067UL, 2303724992UL, 3735005983UL, 1377320198UL, 612032498UL, 1171213235UL, 2494454628UL, 1894368149UL, 4124860986UL, 1694123597UL, 2306091209UL, 2075278956UL, 3898366152UL, 937522278UL, 32800830UL, 324902076UL, 2365753207UL, 2251160429UL, 1692543836UL, 2920424644UL, 119047416UL, 1821685115UL, 1486296407UL, 3055580738UL, 3711421730UL, 1522703457UL, 1422399573UL, 2515073038UL, 3788816887UL, 3490575947UL, 2395299159UL, 4248373284UL, +3383561277UL, 3128107243UL, 2344292809UL, 1806504793UL, 3087395022UL, 4113720664UL, 2749262038UL, 395148869UL, 1331347439UL, 2682558741UL, 1253966763UL, 4204248490UL, 2083995727UL, 2717069903UL, 4144872894UL, 1857751053UL, 2166276701UL, 1419950839UL, 1145170701UL, 3225260742UL, 211743500UL, 2746391743UL, 3333387219UL, 4115426799UL, 3801457092UL, 3327614811UL, 1460971336UL, 2256342146UL, 3186427137UL, 2684216499UL, 1035644397UL, 2948948308UL, +}, +{ +216975964UL, 4145824263UL, 2147471723UL, 4154469597UL, 161744273UL, 1299764439UL, 3468614543UL, 4190517158UL, 4124232403UL, 754999274UL, 208153182UL, 1442063188UL, 2940825403UL, 729331312UL, 2124186505UL, 1136411459UL, 1083787490UL, 442264548UL, 442338468UL, 464589685UL, 3509461223UL, 4241734851UL, 370778328UL, 4003105058UL, 3163637982UL, 3747133182UL, 1433548371UL, 1876378240UL, 536564977UL, 1171222160UL, 3268902719UL, 2725776746UL, +1547771137UL, 2818791461UL, 4129042013UL, 2677094853UL, 1594765197UL, 1556725424UL, 569252594UL, 2640731848UL, 2947042710UL, 2633188904UL, 1640957370UL, 1806863786UL, 2803403654UL, 2632220187UL, 2740076538UL, 383549855UL, 3211856699UL, 3933793958UL, 1988232112UL, 404006876UL, 1369488120UL, 1963339964UL, 609604643UL, 2488118016UL, 3936354252UL, 1980115609UL, 189069630UL, 860670414UL, 85775513UL, 2447581620UL, 886385122UL, 3047212472UL, +2470718978UL, 4044569663UL, 430717074UL, 1598133481UL, 1905362808UL, 2981511487UL, 1842297666UL, 2992320857UL, 1682119455UL, 1753461544UL, 700013801UL, 3025873251UL, 3413358770UL, 1673092091UL, 113651375UL, 2618875026UL, 1479752146UL, 81598739UL, 1530418117UL, 962911586UL, 778994423UL, 3944331100UL, 4116504755UL, 480712357UL, 1078821437UL, 1091665476UL, 3696871260UL, 2074607518UL, 3226459752UL, 3767432525UL, 768289441UL, 3142741843UL, +2969151790UL, 1814889320UL, 2122849610UL, 451935137UL, 2784993892UL, 1836517944UL, 1565951586UL, 1663606442UL, 1578543925UL, 33407321UL, 1445768530UL, 2156093253UL, 3164165477UL, 3093293932UL, 298945371UL, 2558835427UL, 1386275152UL, 2649603495UL, 893605644UL, 1147537351UL, 1889670166UL, 3203610476UL, 2598985714UL, 966335150UL, 3384227644UL, 2584671737UL, 552770393UL, 2430097209UL, 3085150053UL, 3633667948UL, 1319147485UL, 1999467843UL, +3676133150UL, 2314789604UL, 1443760911UL, 1552954684UL, 2411684219UL, 3708965016UL, 2607719926UL, 484007519UL, 491681421UL, 2498192461UL, 6342020UL, 4226570819UL, 2329860147UL, 1097040622UL, 1270325434UL, 2572535504UL, 918592905UL, 193599782UL, 4223250613UL, 1640082589UL, 1817957216UL, 2937344769UL, 3768793871UL, 2982566292UL, 1607453458UL, 4096207317UL, 696907828UL, 2431936270UL, 627206620UL, 3267100287UL, 1161821973UL, 2322099303UL, +1700245615UL, 216975964UL, 4145824263UL, 2147471723UL, 4154469597UL, 2836499116UL, 1299764439UL, 3468614543UL, 4190517158UL, 4124232403UL, 2176257299UL, 208153182UL, 1442063188UL, 2940825403UL, 729331312UL, 2954254860UL, 1136411459UL, 1083787490UL, 442264548UL, 442338468UL, 3098695824UL, 3509461223UL, 4241734851UL, 370778328UL, 4003105058UL, 2963948505UL, 3747133182UL, 1433548371UL, 1876378240UL, 536564977UL, 1565224991UL, 3268902719UL, +2725776746UL, 1547771137UL, 2818791461UL, 2118790546UL, 2677094853UL, 1594765197UL, 1556725424UL, 569252594UL, 610771792UL, 2947042710UL, 2633188904UL, 1640957370UL, 1806863786UL, 2121022793UL, 2632220187UL, 2740076538UL, 383549855UL, 3211856699UL, 14274926UL, 1988232112UL, 404006876UL, 1369488120UL, 1963339964UL, 1661081792UL, 2488118016UL, 3936354252UL, 1980115609UL, 189069630UL, 595192504UL, 85775513UL, 2447581620UL, 886385122UL, +3047212472UL, 1596069326UL, 4044569663UL, 430717074UL, 1598133481UL, 1905362808UL, 2670961612UL, 1842297666UL, 2992320857UL, 1682119455UL, 1753461544UL, 1121764918UL, 3025873251UL, 3413358770UL, 1673092091UL, 113651375UL, 1721474883UL, 1479752146UL, 81598739UL, 1530418117UL, 962911586UL, 3478535046UL, 3944331100UL, 4116504755UL, 480712357UL, 1078821437UL, 1456786415UL, 3696871260UL, 2074607518UL, 3226459752UL, 3767432525UL, 2947648865UL, +3142741843UL, 2969151790UL, 1814889320UL, 2122849610UL, 3367879697UL, 2784993892UL, 1836517944UL, 1565951586UL, 1663606442UL, 2621366329UL, 33407321UL, 1445768530UL, 2156093253UL, 3164165477UL, 619266142UL, 298945371UL, 2558835427UL, 1386275152UL, 2649603495UL, 97967685UL, 1147537351UL, 1889670166UL, 3203610476UL, 2598985714UL, 504495866UL, 3384227644UL, 2584671737UL, 552770393UL, 2430097209UL, 2168477293UL, 3633667948UL, 1319147485UL, +1999467843UL, 3676133150UL, 2755203144UL, 1443760911UL, 1552954684UL, 2411684219UL, 3708965016UL, 2301846628UL, 484007519UL, 491681421UL, 2498192461UL, 6342020UL, 318325395UL, 2329860147UL, 1097040622UL, 1270325434UL, 2572535504UL, 3458698828UL, 193599782UL, 4223250613UL, 1640082589UL, 1817957216UL, 1861636211UL, 3768793871UL, 2982566292UL, 1607453458UL, 4096207317UL, 1871072589UL, 2431936270UL, 627206620UL, 3267100287UL, 1161821973UL, +3904037207UL, 1700245615UL, 216975964UL, 4145824263UL, 2147471723UL, 2789343849UL, 2836499116UL, 1299764439UL, 3468614543UL, 4190517158UL, 639361502UL, 2176257299UL, 208153182UL, 1442063188UL, 2940825403UL, 2962998954UL, 2954254860UL, 1136411459UL, 1083787490UL, 442264548UL, 1812626669UL, 3098695824UL, 3509461223UL, 4241734851UL, 370778328UL, 1673951193UL, 2963948505UL, 3747133182UL, 1433548371UL, 1876378240UL, 3651623536UL, 1565224991UL, +3268902719UL, 2725776746UL, 1547771137UL, 1938402968UL, 2118790546UL, 2677094853UL, 1594765197UL, 1556725424UL, 3267956202UL, 610771792UL, 2947042710UL, 2633188904UL, 1640957370UL, 1448040688UL, 2121022793UL, 2632220187UL, 2740076538UL, 383549855UL, 300148175UL, 14274926UL, 1988232112UL, 404006876UL, 1369488120UL, 3313508750UL, 1661081792UL, 2488118016UL, 3936354252UL, 1980115609UL, 2631341293UL, 595192504UL, 85775513UL, 2447581620UL, +886385122UL, 2465820467UL, 1596069326UL, 4044569663UL, 430717074UL, 1598133481UL, 4191772516UL, 2670961612UL, 1842297666UL, 2992320857UL, 1682119455UL, 997741285UL, 1121764918UL, 3025873251UL, 3413358770UL, 1673092091UL, 1493832846UL, 1721474883UL, 1479752146UL, 81598739UL, 1530418117UL, 2762019274UL, 3478535046UL, 3944331100UL, 4116504755UL, 480712357UL, 448437372UL, 1456786415UL, 3696871260UL, 2074607518UL, 3226459752UL, 2507199309UL, +2947648865UL, 3142741843UL, 2969151790UL, 1814889320UL, 2268952501UL, 3367879697UL, 2784993892UL, 1836517944UL, 1565951586UL, 377207573UL, 2621366329UL, 33407321UL, 1445768530UL, 2156093253UL, 1325490318UL, 619266142UL, 298945371UL, 2558835427UL, 1386275152UL, 2662699426UL, 97967685UL, 1147537351UL, 1889670166UL, 3203610476UL, 1999783658UL, 504495866UL, 3384227644UL, 2584671737UL, 552770393UL, 1562106652UL, 2168477293UL, 3633667948UL, +1319147485UL, 1999467843UL, 2037219988UL, 2755203144UL, 1443760911UL, 1552954684UL, 2411684219UL, 1579607443UL, 2301846628UL, 484007519UL, 491681421UL, 2498192461UL, 745333677UL, 318325395UL, 2329860147UL, 1097040622UL, 1270325434UL, 208017379UL, 3458698828UL, 193599782UL, 4223250613UL, 1640082589UL, 4049245262UL, 1861636211UL, 3768793871UL, 2982566292UL, 1607453458UL, 2058912455UL, 1871072589UL, 2431936270UL, 627206620UL, 3267100287UL, +1186015034UL, 3904037207UL, 1700245615UL, 216975964UL, 4145824263UL, 2422827462UL, 2789343849UL, 2836499116UL, 1299764439UL, 3468614543UL, 2084839633UL, 639361502UL, 2176257299UL, 208153182UL, 1442063188UL, 4065931048UL, 2962998954UL, 2954254860UL, 1136411459UL, 1083787490UL, 465529524UL, 1812626669UL, 3098695824UL, 3509461223UL, 4241734851UL, 3818602366UL, 1673951193UL, 2963948505UL, 3747133182UL, 1433548371UL, 2475307467UL, 3651623536UL, +1565224991UL, 3268902719UL, 2725776746UL, 2374226870UL, 1938402968UL, 2118790546UL, 2677094853UL, 1594765197UL, 348828658UL, 3267956202UL, 610771792UL, 2947042710UL, 2633188904UL, 1713124265UL, 1448040688UL, 2121022793UL, 2632220187UL, 2740076538UL, 1400362266UL, 300148175UL, 14274926UL, 1988232112UL, 404006876UL, 3662575932UL, 3313508750UL, 1661081792UL, 2488118016UL, 3936354252UL, 3100635752UL, 2631341293UL, 595192504UL, 85775513UL, +2447581620UL, 2417839883UL, 2465820467UL, 1596069326UL, 4044569663UL, 430717074UL, 1093503127UL, 4191772516UL, 2670961612UL, 1842297666UL, 2992320857UL, 3292586028UL, 997741285UL, 1121764918UL, 3025873251UL, 3413358770UL, 222522839UL, 1493832846UL, 1721474883UL, 1479752146UL, 81598739UL, 3132900738UL, 2762019274UL, 3478535046UL, 3944331100UL, 4116504755UL, 3429405501UL, 448437372UL, 1456786415UL, 3696871260UL, 2074607518UL, 1492852861UL, +2507199309UL, 2947648865UL, 3142741843UL, 2969151790UL, 2186889362UL, 2268952501UL, 3367879697UL, 2784993892UL, 1836517944UL, 3169157745UL, 377207573UL, 2621366329UL, 33407321UL, 1445768530UL, 4266168148UL, 1325490318UL, 619266142UL, 298945371UL, 2558835427UL, 1447045944UL, 2662699426UL, 97967685UL, 1147537351UL, 1889670166UL, 3354555370UL, 1999783658UL, 504495866UL, 3384227644UL, 2584671737UL, 2489662408UL, 1562106652UL, 2168477293UL, +3633667948UL, 1319147485UL, 3353555249UL, 2037219988UL, 2755203144UL, 1443760911UL, 1552954684UL, 4137514176UL, 1579607443UL, 2301846628UL, 484007519UL, 491681421UL, 164627749UL, 745333677UL, 318325395UL, 2329860147UL, 1097040622UL, 3587444362UL, 208017379UL, 3458698828UL, 193599782UL, 4223250613UL, 1102471426UL, 4049245262UL, 1861636211UL, 3768793871UL, 2982566292UL, 1941698603UL, 2058912455UL, 1871072589UL, 2431936270UL, 627206620UL, +2511999766UL, 1406946444UL, 1571284360UL, 1416792763UL, 1774410400UL, 1655066897UL, 740531687UL, 2852637013UL, 1574342442UL, 3931672444UL, 2887289502UL, 3588598337UL, 1607795590UL, 1893126336UL, 4113959952UL, 250670029UL, 89330705UL, 2198706475UL, 133060312UL, 4033807246UL, 2161604768UL, 3871950931UL, 1820516188UL, 828316231UL, 3126087794UL, 3740050736UL, 543577819UL, 1589693651UL, 4210480257UL, 3844498352UL, 96010254UL, 2888517657UL, +2931088981UL, 2307454606UL, 2411141663UL, 4193964276UL, 918899600UL, 888509951UL, 3023902229UL, 1371276096UL, 2107726407UL, 3863079906UL, 3849297291UL, 1512401618UL, 3098628219UL, 487705749UL, 492891601UL, 345791371UL, 3230138831UL, 1022138839UL, 974682588UL, 3677932604UL, 2054641860UL, 3303576494UL, 1416653965UL, 1119635666UL, 1907978487UL, 4269977208UL, 2047880336UL, 205698774UL, 2401894999UL, 3253173123UL, 2603439113UL, 1295808319UL, +2965198050UL, 1718424301UL, 1605627562UL, 2860017421UL, 1619060227UL, 1130717786UL, 2992070906UL, 2964091191UL, 3192265220UL, 3860528275UL, 45139953UL, 3914023193UL, 1253834497UL, 3885013544UL, 3793695046UL, 3632364934UL, 4127361980UL, 3323804519UL, 4117285262UL, 4171102020UL, 1863837906UL, 2848174924UL, 1731389076UL, 2514130112UL, 3539384422UL, 2950752200UL, 1138137434UL, 4147328087UL, 3345958235UL, 2305097760UL, 974161669UL, 1739611700UL, +2522036172UL, 1196649816UL, 2395301283UL, 911135539UL, 1029496076UL, 1786766951UL, 1802412425UL, 3485017668UL, 2837835718UL, 1951207514UL, 1447650206UL, 2289702688UL, 2517625074UL, 2408021138UL, 2022522416UL, 719777136UL, 417238676UL, 1865171065UL, 801820378UL, 2836941189UL, 1148226009UL, 1713866138UL, 64608707UL, 1458585813UL, 3581572089UL, 2251042907UL, 1818903516UL, 3278072806UL, 2838874249UL, 2665607605UL, 3360214955UL, 2185961451UL, +410342713UL, 364484774UL, 2887998484UL, 2100888426UL, 1394314931UL, 1362560504UL, 3487221127UL, 3140021092UL, 3168968161UL, 1613267484UL, 290430673UL, 2588210538UL, 2493788232UL, 2641638765UL, 2971195072UL, 2749469779UL, 692014176UL, 3268150742UL, 387451740UL, 461249727UL, 3579417331UL, 3738405845UL, 385445455UL, 1464799053UL, 2786433795UL, 3370371952UL, 675344511UL, 4049011269UL, 2196568686UL, 4166285481UL, 2547135972UL, 119952106UL, +}, +{ +2307933966UL, 145940188UL, 4247815717UL, 2995341855UL, 3245382498UL, 1213200792UL, 232910392UL, 2718014238UL, 918321585UL, 3583102265UL, 3176078796UL, 937696513UL, 266558688UL, 1520650260UL, 3655025189UL, 1653323191UL, 538426778UL, 491545855UL, 4064663509UL, 2788350755UL, 3941259490UL, 3471552693UL, 1851151228UL, 3279627338UL, 845228710UL, 29883500UL, 1503432309UL, 593880175UL, 2488716480UL, 828058076UL, 3287933183UL, 3510981973UL, +3970051135UL, 3803049980UL, 898259836UL, 2890959433UL, 234437380UL, 201835406UL, 1523016285UL, 2419577439UL, 2943482079UL, 4219300984UL, 1490698759UL, 533411805UL, 1644926459UL, 4097374623UL, 265292490UL, 2694560848UL, 285667083UL, 1563945375UL, 3128365011UL, 95277844UL, 2938824634UL, 2717708621UL, 3374928056UL, 3672802273UL, 3445399260UL, 2422205637UL, 1106030557UL, 1269805720UL, 1781057614UL, 3491203689UL, 2454028630UL, 2158698380UL, +2578431870UL, 3540412661UL, 2206372988UL, 3138025266UL, 474100503UL, 3310048546UL, 126856999UL, 3144057206UL, 917199551UL, 3549528813UL, 343855771UL, 391118877UL, 1900257963UL, 1616289477UL, 3663959751UL, 1887891784UL, 697303016UL, 1346369879UL, 3634838543UL, 909311683UL, 3534738830UL, 2676838865UL, 3020679234UL, 1248902118UL, 1517698896UL, 414632197UL, 199589058UL, 2922557451UL, 3915079510UL, 1309075563UL, 3836275459UL, 2549095941UL, +1643088840UL, 1153547003UL, 2254144060UL, 3585420425UL, 915059870UL, 2410951596UL, 1876156254UL, 2384812180UL, 3893647829UL, 4119002503UL, 1535078752UL, 3888310943UL, 1483731374UL, 3915992153UL, 3662664617UL, 1065246672UL, 2307959656UL, 1845927873UL, 2075990232UL, 1346396900UL, 4218283385UL, 3427468026UL, 1518645158UL, 3092538772UL, 3383570452UL, 1317710387UL, 3390054918UL, 4222595168UL, 2468387909UL, 3864538174UL, 2442851586UL, 1858344050UL, +1537617445UL, 1090881039UL, 2055021834UL, 4011332463UL, 2797336692UL, 280272261UL, 3350338577UL, 1682666744UL, 1256176165UL, 2017003515UL, 3666229067UL, 4288064377UL, 3407437449UL, 2957152445UL, 3557139753UL, 4106922773UL, 2612653316UL, 3491950269UL, 1107293753UL, 2926461368UL, 1433860998UL, 1975669351UL, 1680462513UL, 4283282673UL, 168788571UL, 57021447UL, 3888396304UL, 2218068386UL, 2170981202UL, 1587568797UL, 2097820654UL, 1308061343UL, +4096726326UL, 2307933966UL, 145940188UL, 4247815717UL, 2995341855UL, 2894586378UL, 1213200792UL, 232910392UL, 2718014238UL, 918321585UL, 520434726UL, 3176078796UL, 937696513UL, 266558688UL, 1520650260UL, 645408471UL, 1653323191UL, 538426778UL, 491545855UL, 4064663509UL, 2605358672UL, 3941259490UL, 3471552693UL, 1851151228UL, 3279627338UL, 1290188176UL, 29883500UL, 1503432309UL, 593880175UL, 2488716480UL, 1172244224UL, 3287933183UL, +3510981973UL, 3970051135UL, 3803049980UL, 3836242189UL, 2890959433UL, 234437380UL, 201835406UL, 1523016285UL, 1720566850UL, 2943482079UL, 4219300984UL, 1490698759UL, 533411805UL, 982587365UL, 4097374623UL, 265292490UL, 2694560848UL, 285667083UL, 3905392425UL, 3128365011UL, 95277844UL, 2938824634UL, 2717708621UL, 262111126UL, 3672802273UL, 3445399260UL, 2422205637UL, 1106030557UL, 233401560UL, 1781057614UL, 3491203689UL, 2454028630UL, +2158698380UL, 3314008662UL, 3540412661UL, 2206372988UL, 3138025266UL, 474100503UL, 1150191741UL, 126856999UL, 3144057206UL, 917199551UL, 3549528813UL, 84516590UL, 391118877UL, 1900257963UL, 1616289477UL, 3663959751UL, 2831036790UL, 697303016UL, 1346369879UL, 3634838543UL, 909311683UL, 2206291004UL, 2676838865UL, 3020679234UL, 1248902118UL, 1517698896UL, 882506847UL, 199589058UL, 2922557451UL, 3915079510UL, 1309075563UL, 3675129276UL, +2549095941UL, 1643088840UL, 1153547003UL, 2254144060UL, 1702669516UL, 915059870UL, 2410951596UL, 1876156254UL, 2384812180UL, 393602062UL, 4119002503UL, 1535078752UL, 3888310943UL, 1483731374UL, 1135074988UL, 3662664617UL, 1065246672UL, 2307959656UL, 1845927873UL, 883002610UL, 1346396900UL, 4218283385UL, 3427468026UL, 1518645158UL, 1478839081UL, 3383570452UL, 1317710387UL, 3390054918UL, 4222595168UL, 3009846855UL, 3864538174UL, 2442851586UL, +1858344050UL, 1537617445UL, 2419526192UL, 2055021834UL, 4011332463UL, 2797336692UL, 280272261UL, 2937342669UL, 1682666744UL, 1256176165UL, 2017003515UL, 3666229067UL, 3563024742UL, 3407437449UL, 2957152445UL, 3557139753UL, 4106922773UL, 610182860UL, 3491950269UL, 1107293753UL, 2926461368UL, 1433860998UL, 2493047579UL, 1680462513UL, 4283282673UL, 168788571UL, 57021447UL, 2151356582UL, 2218068386UL, 2170981202UL, 1587568797UL, 2097820654UL, +2738927570UL, 4096726326UL, 2307933966UL, 145940188UL, 4247815717UL, 1887236689UL, 2894586378UL, 1213200792UL, 232910392UL, 2718014238UL, 2028538736UL, 520434726UL, 3176078796UL, 937696513UL, 266558688UL, 305624632UL, 645408471UL, 1653323191UL, 538426778UL, 491545855UL, 4188864445UL, 2605358672UL, 3941259490UL, 3471552693UL, 1851151228UL, 1720039364UL, 1290188176UL, 29883500UL, 1503432309UL, 593880175UL, 2595662526UL, 1172244224UL, +3287933183UL, 3510981973UL, 3970051135UL, 2763703998UL, 3836242189UL, 2890959433UL, 234437380UL, 201835406UL, 2652280530UL, 1720566850UL, 2943482079UL, 4219300984UL, 1490698759UL, 1968049758UL, 982587365UL, 4097374623UL, 265292490UL, 2694560848UL, 1165326939UL, 3905392425UL, 3128365011UL, 95277844UL, 2938824634UL, 2521869983UL, 262111126UL, 3672802273UL, 3445399260UL, 2422205637UL, 395183943UL, 233401560UL, 1781057614UL, 3491203689UL, +2454028630UL, 249721174UL, 3314008662UL, 3540412661UL, 2206372988UL, 3138025266UL, 1644439373UL, 1150191741UL, 126856999UL, 3144057206UL, 917199551UL, 1997133400UL, 84516590UL, 391118877UL, 1900257963UL, 1616289477UL, 3843764922UL, 2831036790UL, 697303016UL, 1346369879UL, 3634838543UL, 1901125181UL, 2206291004UL, 2676838865UL, 3020679234UL, 1248902118UL, 344347894UL, 882506847UL, 199589058UL, 2922557451UL, 3915079510UL, 2919277604UL, +3675129276UL, 2549095941UL, 1643088840UL, 1153547003UL, 3305575634UL, 1702669516UL, 915059870UL, 2410951596UL, 1876156254UL, 1416053196UL, 393602062UL, 4119002503UL, 1535078752UL, 3888310943UL, 3993632377UL, 1135074988UL, 3662664617UL, 1065246672UL, 2307959656UL, 1044670394UL, 883002610UL, 1346396900UL, 4218283385UL, 3427468026UL, 1792832168UL, 1478839081UL, 3383570452UL, 1317710387UL, 3390054918UL, 1596709924UL, 3009846855UL, 3864538174UL, +2442851586UL, 1858344050UL, 2428482265UL, 2419526192UL, 2055021834UL, 4011332463UL, 2797336692UL, 424213503UL, 2937342669UL, 1682666744UL, 1256176165UL, 2017003515UL, 717473071UL, 3563024742UL, 3407437449UL, 2957152445UL, 3557139753UL, 3319575432UL, 610182860UL, 3491950269UL, 1107293753UL, 2926461368UL, 3052637648UL, 2493047579UL, 1680462513UL, 4283282673UL, 168788571UL, 1401253163UL, 2151356582UL, 2218068386UL, 2170981202UL, 1587568797UL, +3994937670UL, 2738927570UL, 4096726326UL, 2307933966UL, 145940188UL, 3928146647UL, 1887236689UL, 2894586378UL, 1213200792UL, 232910392UL, 833120806UL, 2028538736UL, 520434726UL, 3176078796UL, 937696513UL, 3704968451UL, 305624632UL, 645408471UL, 1653323191UL, 538426778UL, 939335571UL, 4188864445UL, 2605358672UL, 3941259490UL, 3471552693UL, 2168499975UL, 1720039364UL, 1290188176UL, 29883500UL, 1503432309UL, 524387655UL, 2595662526UL, +1172244224UL, 3287933183UL, 3510981973UL, 2444664749UL, 2763703998UL, 3836242189UL, 2890959433UL, 234437380UL, 3272987579UL, 2652280530UL, 1720566850UL, 2943482079UL, 4219300984UL, 1045589319UL, 1968049758UL, 982587365UL, 4097374623UL, 265292490UL, 1077412791UL, 1165326939UL, 3905392425UL, 3128365011UL, 95277844UL, 2896038035UL, 2521869983UL, 262111126UL, 3672802273UL, 3445399260UL, 4273256145UL, 395183943UL, 233401560UL, 1781057614UL, +3491203689UL, 8343453UL, 249721174UL, 3314008662UL, 3540412661UL, 2206372988UL, 3738630867UL, 1644439373UL, 1150191741UL, 126856999UL, 3144057206UL, 65169501UL, 1997133400UL, 84516590UL, 391118877UL, 1900257963UL, 2914085557UL, 3843764922UL, 2831036790UL, 697303016UL, 1346369879UL, 2007568079UL, 1901125181UL, 2206291004UL, 2676838865UL, 3020679234UL, 2097032931UL, 344347894UL, 882506847UL, 199589058UL, 2922557451UL, 3740400148UL, +2919277604UL, 3675129276UL, 2549095941UL, 1643088840UL, 199560818UL, 3305575634UL, 1702669516UL, 915059870UL, 2410951596UL, 117939268UL, 1416053196UL, 393602062UL, 4119002503UL, 1535078752UL, 4281599711UL, 3993632377UL, 1135074988UL, 3662664617UL, 1065246672UL, 2854253374UL, 1044670394UL, 883002610UL, 1346396900UL, 4218283385UL, 803910659UL, 1792832168UL, 1478839081UL, 3383570452UL, 1317710387UL, 1311168874UL, 1596709924UL, 3009846855UL, +3864538174UL, 2442851586UL, 1967982878UL, 2428482265UL, 2419526192UL, 2055021834UL, 4011332463UL, 2725198749UL, 424213503UL, 2937342669UL, 1682666744UL, 1256176165UL, 713350501UL, 717473071UL, 3563024742UL, 3407437449UL, 2957152445UL, 2363682828UL, 3319575432UL, 610182860UL, 3491950269UL, 1107293753UL, 3429638328UL, 3052637648UL, 2493047579UL, 1680462513UL, 4283282673UL, 2672311163UL, 1401253163UL, 2151356582UL, 2218068386UL, 2170981202UL, +431601500UL, 4193143261UL, 2985267149UL, 1556712183UL, 4135181832UL, 285960576UL, 81711096UL, 57066962UL, 2646151573UL, 3692824605UL, 485132216UL, 2799654118UL, 903527523UL, 1210637484UL, 3195346614UL, 599540837UL, 1410108963UL, 3723542120UL, 1350764011UL, 1717225239UL, 239736775UL, 3946934722UL, 420024332UL, 589304817UL, 1331122625UL, 4294403247UL, 2009397371UL, 844641869UL, 166387728UL, 4093361096UL, 2342369656UL, 3958170613UL, +1660376297UL, 1259528150UL, 4240809115UL, 2875563845UL, 2613790323UL, 2869665108UL, 1414690635UL, 944649070UL, 3539368342UL, 199532147UL, 2707660205UL, 2258475730UL, 771169023UL, 158544851UL, 588872178UL, 2002019277UL, 4225148852UL, 641266809UL, 2133909450UL, 330112418UL, 1815776319UL, 1949213618UL, 3868452239UL, 2702722715UL, 2491030937UL, 468812562UL, 3226259052UL, 199165016UL, 436679774UL, 881956108UL, 1098105661UL, 68909298UL, +248572829UL, 339224422UL, 553849953UL, 3054752668UL, 701934162UL, 1898925107UL, 749060575UL, 987950022UL, 4040401060UL, 684345838UL, 3449205676UL, 2583450513UL, 433795092UL, 3559011048UL, 293161429UL, 3947766299UL, 3491895171UL, 1651265910UL, 1216468759UL, 1625512737UL, 412235874UL, 893680794UL, 2582820523UL, 1514322840UL, 2348781204UL, 2720801933UL, 3364999370UL, 2822073391UL, 2627166519UL, 3805500773UL, 177760590UL, 2210728920UL, +3136345252UL, 3226658259UL, 3982978003UL, 86264452UL, 536816704UL, 3489051867UL, 2161950016UL, 1375640747UL, 4116957650UL, 3676292350UL, 3001078542UL, 1379688752UL, 3059678152UL, 3740664918UL, 475697670UL, 539253230UL, 1256048653UL, 3819847913UL, 141216227UL, 3888391528UL, 3567424851UL, 4131097532UL, 2142453586UL, 3606575354UL, 3689715433UL, 2318212425UL, 3026095399UL, 2451038695UL, 4052322172UL, 1861782452UL, 3032216562UL, 4078403318UL, +2636775961UL, 2188864067UL, 3276459319UL, 2230349722UL, 3939784264UL, 831216291UL, 2483460713UL, 2571551493UL, 484276565UL, 3173595164UL, 4177831244UL, 4132249231UL, 2116763555UL, 1420812998UL, 2121017321UL, 2855491215UL, 1630144518UL, 2489688364UL, 411521312UL, 3713786536UL, 4177871972UL, 690465497UL, 855092147UL, 4271606539UL, 1265108699UL, 3757106624UL, 3151574897UL, 670335437UL, 3099376310UL, 3946436509UL, 1795346235UL, 4013409945UL, +}, +{ +650684252UL, 2220445579UL, 537394374UL, 571322423UL, 2781663439UL, 899394682UL, 364129622UL, 328438826UL, 1219862153UL, 830435885UL, 3278649457UL, 3072225531UL, 2838645991UL, 3150905380UL, 1251952499UL, 1751415553UL, 2034088483UL, 1437197870UL, 1907624878UL, 1786974150UL, 4207811086UL, 768131803UL, 2713210999UL, 4004509777UL, 3510764535UL, 2740991637UL, 3000313526UL, 1355959320UL, 938244439UL, 4093313692UL, 2476002145UL, 835527260UL, +2084758949UL, 4223775017UL, 91645393UL, 2251723899UL, 3159477758UL, 2008655575UL, 912220875UL, 1525327655UL, 2067948386UL, 2006141522UL, 450235614UL, 3945671083UL, 2852189452UL, 3804118704UL, 3302604345UL, 1712745267UL, 349281154UL, 19331179UL, 3423301791UL, 416995358UL, 2049170698UL, 684574142UL, 3271042138UL, 3438668017UL, 1645378852UL, 1995123150UL, 1835887948UL, 2347182898UL, 3828432892UL, 3710259931UL, 713144773UL, 3246285450UL, +2196135622UL, 1611287338UL, 2845388948UL, 3690657633UL, 2403178686UL, 2946296994UL, 2180908599UL, 3072014497UL, 3436535724UL, 2948908116UL, 3080353236UL, 1669938872UL, 3572731079UL, 1100892983UL, 308060688UL, 3092946261UL, 2725115972UL, 887278263UL, 991869336UL, 3597899723UL, 3454505181UL, 1108269267UL, 851855066UL, 1940998002UL, 3539084542UL, 3102161424UL, 965450940UL, 1942363226UL, 1430246588UL, 1368971075UL, 4251556311UL, 642683738UL, +3035789355UL, 1829444044UL, 4234626091UL, 671403403UL, 2809844786UL, 2251172733UL, 970188857UL, 3910072565UL, 1131847479UL, 3397535176UL, 3290884849UL, 861868157UL, 2811422184UL, 3280310458UL, 3502085520UL, 1499698865UL, 2446269873UL, 236680785UL, 1896103604UL, 1179896471UL, 83960622UL, 3303129336UL, 1191373247UL, 177898275UL, 3077388457UL, 1022975703UL, 2535144448UL, 8680269UL, 3602435630UL, 1810825915UL, 2293529378UL, 2307085218UL, +483894148UL, 2872435038UL, 2043868156UL, 3038491874UL, 3786518530UL, 3606440668UL, 3336713377UL, 120183042UL, 86901386UL, 2233164457UL, 2881782972UL, 3135264768UL, 2294460421UL, 2996668315UL, 658184098UL, 3558825846UL, 2386173040UL, 1950463910UL, 551627788UL, 2464303444UL, 893474565UL, 3277869222UL, 2852725906UL, 1191310725UL, 2398932683UL, 4164956002UL, 1689291769UL, 2619288187UL, 3429362702UL, 3205668166UL, 1668126623UL, 955771270UL, +2106753333UL, 650684252UL, 2220445579UL, 537394374UL, 571322423UL, 2369694095UL, 899394682UL, 364129622UL, 328438826UL, 1219862153UL, 4195985755UL, 3278649457UL, 3072225531UL, 2838645991UL, 3150905380UL, 2389919UL, 1751415553UL, 2034088483UL, 1437197870UL, 1907624878UL, 1516966376UL, 4207811086UL, 768131803UL, 2713210999UL, 4004509777UL, 1955929377UL, 2740991637UL, 3000313526UL, 1355959320UL, 938244439UL, 4263287583UL, 2476002145UL, +835527260UL, 2084758949UL, 4223775017UL, 110659216UL, 2251723899UL, 3159477758UL, 2008655575UL, 912220875UL, 2378803214UL, 2067948386UL, 2006141522UL, 450235614UL, 3945671083UL, 4112321452UL, 3804118704UL, 3302604345UL, 1712745267UL, 349281154UL, 3834044005UL, 3423301791UL, 416995358UL, 2049170698UL, 684574142UL, 3651360887UL, 3438668017UL, 1645378852UL, 1995123150UL, 1835887948UL, 1022257616UL, 3828432892UL, 3710259931UL, 713144773UL, +3246285450UL, 2485142597UL, 1611287338UL, 2845388948UL, 3690657633UL, 2403178686UL, 2201888000UL, 2180908599UL, 3072014497UL, 3436535724UL, 2948908116UL, 1647734358UL, 1669938872UL, 3572731079UL, 1100892983UL, 308060688UL, 592016509UL, 2725115972UL, 887278263UL, 991869336UL, 3597899723UL, 819708104UL, 1108269267UL, 851855066UL, 1940998002UL, 3539084542UL, 3156419045UL, 965450940UL, 1942363226UL, 1430246588UL, 1368971075UL, 224112021UL, +642683738UL, 3035789355UL, 1829444044UL, 4234626091UL, 314715303UL, 2809844786UL, 2251172733UL, 970188857UL, 3910072565UL, 155628632UL, 3397535176UL, 3290884849UL, 861868157UL, 2811422184UL, 1847583676UL, 3502085520UL, 1499698865UL, 2446269873UL, 236680785UL, 3698448762UL, 1179896471UL, 83960622UL, 3303129336UL, 1191373247UL, 1567908030UL, 3077388457UL, 1022975703UL, 2535144448UL, 8680269UL, 3979982957UL, 1810825915UL, 2293529378UL, +2307085218UL, 483894148UL, 4003402870UL, 2043868156UL, 3038491874UL, 3786518530UL, 3606440668UL, 3062185402UL, 120183042UL, 86901386UL, 2233164457UL, 2881782972UL, 3345668738UL, 2294460421UL, 2996668315UL, 658184098UL, 3558825846UL, 2121278529UL, 1950463910UL, 551627788UL, 2464303444UL, 893474565UL, 183176481UL, 2852725906UL, 1191310725UL, 2398932683UL, 4164956002UL, 788617081UL, 2619288187UL, 3429362702UL, 3205668166UL, 1668126623UL, +29124108UL, 2106753333UL, 650684252UL, 2220445579UL, 537394374UL, 725338795UL, 2369694095UL, 899394682UL, 364129622UL, 328438826UL, 1727397396UL, 4195985755UL, 3278649457UL, 3072225531UL, 2838645991UL, 583924693UL, 2389919UL, 1751415553UL, 2034088483UL, 1437197870UL, 1017611325UL, 1516966376UL, 4207811086UL, 768131803UL, 2713210999UL, 761144580UL, 1955929377UL, 2740991637UL, 3000313526UL, 1355959320UL, 840696976UL, 4263287583UL, +2476002145UL, 835527260UL, 2084758949UL, 3729075247UL, 110659216UL, 2251723899UL, 3159477758UL, 2008655575UL, 4127907945UL, 2378803214UL, 2067948386UL, 2006141522UL, 450235614UL, 3240776806UL, 4112321452UL, 3804118704UL, 3302604345UL, 1712745267UL, 1079549936UL, 3834044005UL, 3423301791UL, 416995358UL, 2049170698UL, 3913510119UL, 3651360887UL, 3438668017UL, 1645378852UL, 1995123150UL, 841590980UL, 1022257616UL, 3828432892UL, 3710259931UL, +713144773UL, 1272133892UL, 2485142597UL, 1611287338UL, 2845388948UL, 3690657633UL, 3083851146UL, 2201888000UL, 2180908599UL, 3072014497UL, 3436535724UL, 4162521870UL, 1647734358UL, 1669938872UL, 3572731079UL, 1100892983UL, 986584939UL, 592016509UL, 2725115972UL, 887278263UL, 991869336UL, 2711883653UL, 819708104UL, 1108269267UL, 851855066UL, 1940998002UL, 4050477073UL, 3156419045UL, 965450940UL, 1942363226UL, 1430246588UL, 4285490865UL, +224112021UL, 642683738UL, 3035789355UL, 1829444044UL, 4197159994UL, 314715303UL, 2809844786UL, 2251172733UL, 970188857UL, 3018833494UL, 155628632UL, 3397535176UL, 3290884849UL, 861868157UL, 2883971818UL, 1847583676UL, 3502085520UL, 1499698865UL, 2446269873UL, 2621709156UL, 3698448762UL, 1179896471UL, 83960622UL, 3303129336UL, 2192966710UL, 1567908030UL, 3077388457UL, 1022975703UL, 2535144448UL, 95661399UL, 3979982957UL, 1810825915UL, +2293529378UL, 2307085218UL, 485952375UL, 4003402870UL, 2043868156UL, 3038491874UL, 3786518530UL, 575288835UL, 3062185402UL, 120183042UL, 86901386UL, 2233164457UL, 2864966512UL, 3345668738UL, 2294460421UL, 2996668315UL, 658184098UL, 2892259673UL, 2121278529UL, 1950463910UL, 551627788UL, 2464303444UL, 2699734841UL, 183176481UL, 2852725906UL, 1191310725UL, 2398932683UL, 3505505465UL, 788617081UL, 2619288187UL, 3429362702UL, 3205668166UL, +2157859363UL, 29124108UL, 2106753333UL, 650684252UL, 2220445579UL, 978263237UL, 725338795UL, 2369694095UL, 899394682UL, 364129622UL, 3795063930UL, 1727397396UL, 4195985755UL, 3278649457UL, 3072225531UL, 1996768476UL, 583924693UL, 2389919UL, 1751415553UL, 2034088483UL, 1069211024UL, 1017611325UL, 1516966376UL, 4207811086UL, 768131803UL, 1365857736UL, 761144580UL, 1955929377UL, 2740991637UL, 3000313526UL, 1057560595UL, 840696976UL, +4263287583UL, 2476002145UL, 835527260UL, 76517292UL, 3729075247UL, 110659216UL, 2251723899UL, 3159477758UL, 3272987770UL, 4127907945UL, 2378803214UL, 2067948386UL, 2006141522UL, 1223694226UL, 3240776806UL, 4112321452UL, 3804118704UL, 3302604345UL, 2218568154UL, 1079549936UL, 3834044005UL, 3423301791UL, 416995358UL, 3661322119UL, 3913510119UL, 3651360887UL, 3438668017UL, 1645378852UL, 3606917602UL, 841590980UL, 1022257616UL, 3828432892UL, +3710259931UL, 1270853142UL, 1272133892UL, 2485142597UL, 1611287338UL, 2845388948UL, 131877212UL, 3083851146UL, 2201888000UL, 2180908599UL, 3072014497UL, 2459348479UL, 4162521870UL, 1647734358UL, 1669938872UL, 3572731079UL, 4285199726UL, 986584939UL, 592016509UL, 2725115972UL, 887278263UL, 3824306591UL, 2711883653UL, 819708104UL, 1108269267UL, 851855066UL, 190839383UL, 4050477073UL, 3156419045UL, 965450940UL, 1942363226UL, 1750931697UL, +4285490865UL, 224112021UL, 642683738UL, 3035789355UL, 1544088048UL, 4197159994UL, 314715303UL, 2809844786UL, 2251172733UL, 3155072709UL, 3018833494UL, 155628632UL, 3397535176UL, 3290884849UL, 4153861738UL, 2883971818UL, 1847583676UL, 3502085520UL, 1499698865UL, 1780983485UL, 2621709156UL, 3698448762UL, 1179896471UL, 83960622UL, 3849402190UL, 2192966710UL, 1567908030UL, 3077388457UL, 1022975703UL, 1639944917UL, 95661399UL, 3979982957UL, +1810825915UL, 2293529378UL, 3477014442UL, 485952375UL, 4003402870UL, 2043868156UL, 3038491874UL, 1482314580UL, 575288835UL, 3062185402UL, 120183042UL, 86901386UL, 3129494022UL, 2864966512UL, 3345668738UL, 2294460421UL, 2996668315UL, 1986664970UL, 2892259673UL, 2121278529UL, 1950463910UL, 551627788UL, 3105369079UL, 2699734841UL, 183176481UL, 2852725906UL, 1191310725UL, 3154591925UL, 3505505465UL, 788617081UL, 2619288187UL, 3429362702UL, +4204415531UL, 1321048315UL, 4247243973UL, 3085535935UL, 114618345UL, 2126710176UL, 1857709117UL, 3744103666UL, 304437872UL, 2388303947UL, 1802971382UL, 2099900439UL, 2543837819UL, 593111133UL, 3788847386UL, 1479546758UL, 4095492150UL, 240996968UL, 3423191009UL, 2666077260UL, 884572403UL, 2988847666UL, 928827215UL, 2549465610UL, 2773670136UL, 708214104UL, 2594951780UL, 1076989709UL, 2850313793UL, 1401578686UL, 4100639899UL, 2353261688UL, +1323066237UL, 31664438UL, 951240198UL, 3676836716UL, 3633113483UL, 3262159382UL, 981784748UL, 1172850762UL, 3106238289UL, 3118297408UL, 4207023277UL, 3362324732UL, 844983306UL, 3790928628UL, 4156848237UL, 2638267501UL, 1494090858UL, 3955182404UL, 1193294064UL, 4035152789UL, 2971914580UL, 2865046609UL, 3782329083UL, 120288587UL, 3300482994UL, 4268540970UL, 4183426205UL, 3572724103UL, 3287140971UL, 3038086532UL, 3210919007UL, 2171998100UL, +3958495101UL, 1589679371UL, 2880366694UL, 827575211UL, 1343189406UL, 364332706UL, 866065087UL, 33080625UL, 4284492640UL, 2277479989UL, 4110331130UL, 430538110UL, 3549886335UL, 3734345920UL, 3780943339UL, 638033279UL, 2684714509UL, 945721631UL, 49994267UL, 2394351381UL, 1996532760UL, 3201422203UL, 3509459657UL, 4118609520UL, 632454166UL, 696027759UL, 901486290UL, 1230453723UL, 4225865813UL, 4072619256UL, 3111686961UL, 1487480830UL, +4112016561UL, 1577020285UL, 2765241900UL, 2496609620UL, 1731271292UL, 6970479UL, 2936359283UL, 1541124937UL, 3705956773UL, 2349695021UL, 2247551804UL, 3759489710UL, 1321217706UL, 379586757UL, 2008242014UL, 1138475935UL, 3044902216UL, 1917596533UL, 2905651936UL, 3320601534UL, 1468557693UL, 4101437636UL, 374575138UL, 730079080UL, 995340259UL, 1430552870UL, 3860649629UL, 541396702UL, 3413070856UL, 3052797396UL, 3591116740UL, 2811484252UL, +2464310183UL, 1597327051UL, 3288232619UL, 1564716093UL, 2838386049UL, 264313861UL, 881377066UL, 4165178494UL, 1069189853UL, 1045737884UL, 2072266205UL, 2700673629UL, 2338724235UL, 837702541UL, 2603464957UL, 1548182143UL, 3565539962UL, 38172869UL, 1949065935UL, 3628598166UL, 2788698071UL, 3531182193UL, 1367529788UL, 3902468811UL, 1215323634UL, 1117475027UL, 3901912129UL, 2678279671UL, 597953858UL, 4082485755UL, 3696533122UL, 1078703353UL, +}, +{ +590004384UL, 3025338414UL, 1764374188UL, 20686172UL, 932343559UL, 1798441768UL, 1013577341UL, 4275903797UL, 853441141UL, 1065980978UL, 3665193407UL, 1555165047UL, 2962781443UL, 1822487181UL, 3329200135UL, 1527094489UL, 3805115799UL, 2252376033UL, 2137546519UL, 3632426270UL, 2439842864UL, 2525211849UL, 602876448UL, 1488163727UL, 3169015136UL, 832084039UL, 81097112UL, 994974428UL, 1945411347UL, 1020609213UL, 2863240894UL, 1639194881UL, +3078842449UL, 1885382385UL, 2595105518UL, 3857547190UL, 3654577058UL, 3853111480UL, 2237941224UL, 625422255UL, 3292783340UL, 750206381UL, 1002246874UL, 900879607UL, 820635221UL, 3318328110UL, 3980484559UL, 3924790669UL, 4260574943UL, 3658381114UL, 3673068643UL, 1319175627UL, 3620071157UL, 3914274380UL, 3310864044UL, 1529070914UL, 1760958838UL, 818806045UL, 3056976418UL, 2337737150UL, 2061530784UL, 1036243443UL, 2058675708UL, 1932546035UL, +1604709219UL, 1317296740UL, 2505350414UL, 624826181UL, 2710208816UL, 2208469912UL, 1930700024UL, 3769953790UL, 2092911082UL, 520309780UL, 3787727278UL, 684095804UL, 3697683979UL, 111440289UL, 4043494885UL, 1571375993UL, 1828801775UL, 3589061974UL, 3016563679UL, 2026002784UL, 3810490061UL, 2634997537UL, 2715287551UL, 1973545003UL, 3407971274UL, 3239387641UL, 2479429785UL, 324785401UL, 2622755198UL, 1525605325UL, 3280412074UL, 2453630352UL, +726090704UL, 4170024046UL, 248003549UL, 3319518538UL, 1331224401UL, 1203416669UL, 3497395173UL, 2465693133UL, 15303334UL, 267163358UL, 627307819UL, 294350450UL, 3691559013UL, 2491765952UL, 839609873UL, 1598505629UL, 3905396753UL, 583168080UL, 281403302UL, 1658629464UL, 1498139453UL, 2860737994UL, 148007837UL, 1439496901UL, 3226624586UL, 1708925351UL, 195473107UL, 1150552649UL, 2856922985UL, 1853471286UL, 1286593394UL, 2025932254UL, +1300583198UL, 3169702837UL, 1255226060UL, 3482666699UL, 1515557266UL, 1964035766UL, 1604627993UL, 641427670UL, 450188959UL, 1095230428UL, 293179001UL, 1293554079UL, 3022335608UL, 610535626UL, 1329467104UL, 3717935497UL, 1252385485UL, 441595535UL, 2937045243UL, 2846877561UL, 668719121UL, 3604154741UL, 1150714166UL, 1689640190UL, 2219487087UL, 2445975095UL, 3492083575UL, 377195836UL, 2727989292UL, 2460040634UL, 2910322481UL, 399050881UL, +3601292788UL, 590004384UL, 3025338414UL, 1764374188UL, 20686172UL, 3576058865UL, 1798441768UL, 1013577341UL, 4275903797UL, 853441141UL, 3862104007UL, 3665193407UL, 1555165047UL, 2962781443UL, 1822487181UL, 1058917817UL, 1527094489UL, 3805115799UL, 2252376033UL, 2137546519UL, 780594798UL, 2439842864UL, 2525211849UL, 602876448UL, 1488163727UL, 642430472UL, 832084039UL, 81097112UL, 994974428UL, 1945411347UL, 2231598766UL, 2863240894UL, +1639194881UL, 3078842449UL, 1885382385UL, 2387524763UL, 3857547190UL, 3654577058UL, 3853111480UL, 2237941224UL, 991026264UL, 3292783340UL, 750206381UL, 1002246874UL, 900879607UL, 1178067772UL, 3318328110UL, 3980484559UL, 3924790669UL, 4260574943UL, 1964983082UL, 3673068643UL, 1319175627UL, 3620071157UL, 3914274380UL, 992141498UL, 1529070914UL, 1760958838UL, 818806045UL, 3056976418UL, 3295305429UL, 2061530784UL, 1036243443UL, 2058675708UL, +1932546035UL, 3724542133UL, 1317296740UL, 2505350414UL, 624826181UL, 2710208816UL, 3359715256UL, 1930700024UL, 3769953790UL, 2092911082UL, 520309780UL, 1979908015UL, 684095804UL, 3697683979UL, 111440289UL, 4043494885UL, 3256907235UL, 1828801775UL, 3589061974UL, 3016563679UL, 2026002784UL, 1967781780UL, 2634997537UL, 2715287551UL, 1973545003UL, 3407971274UL, 391604110UL, 2479429785UL, 324785401UL, 2622755198UL, 1525605325UL, 462777294UL, +2453630352UL, 726090704UL, 4170024046UL, 248003549UL, 3125444318UL, 1331224401UL, 1203416669UL, 3497395173UL, 2465693133UL, 1610778556UL, 267163358UL, 627307819UL, 294350450UL, 3691559013UL, 3302305047UL, 839609873UL, 1598505629UL, 3905396753UL, 583168080UL, 1502262581UL, 1658629464UL, 1498139453UL, 2860737994UL, 148007837UL, 2973368511UL, 3226624586UL, 1708925351UL, 195473107UL, 1150552649UL, 522423348UL, 1853471286UL, 1286593394UL, +2025932254UL, 1300583198UL, 555770116UL, 1255226060UL, 3482666699UL, 1515557266UL, 1964035766UL, 877073175UL, 641427670UL, 450188959UL, 1095230428UL, 293179001UL, 4216364784UL, 3022335608UL, 610535626UL, 1329467104UL, 3717935497UL, 1665384485UL, 441595535UL, 2937045243UL, 2846877561UL, 668719121UL, 978801343UL, 1150714166UL, 1689640190UL, 2219487087UL, 2445975095UL, 3819595050UL, 377195836UL, 2727989292UL, 2460040634UL, 2910322481UL, +1200428010UL, 3601292788UL, 590004384UL, 3025338414UL, 1764374188UL, 3586255253UL, 3576058865UL, 1798441768UL, 1013577341UL, 4275903797UL, 1511067357UL, 3862104007UL, 3665193407UL, 1555165047UL, 2962781443UL, 2749766525UL, 1058917817UL, 1527094489UL, 3805115799UL, 2252376033UL, 817362043UL, 780594798UL, 2439842864UL, 2525211849UL, 602876448UL, 2309049006UL, 642430472UL, 832084039UL, 81097112UL, 994974428UL, 3148197354UL, 2231598766UL, +2863240894UL, 1639194881UL, 3078842449UL, 311769962UL, 2387524763UL, 3857547190UL, 3654577058UL, 3853111480UL, 1888597091UL, 991026264UL, 3292783340UL, 750206381UL, 1002246874UL, 2904195378UL, 1178067772UL, 3318328110UL, 3980484559UL, 3924790669UL, 4265386540UL, 1964983082UL, 3673068643UL, 1319175627UL, 3620071157UL, 1635921454UL, 992141498UL, 1529070914UL, 1760958838UL, 818806045UL, 3002614702UL, 3295305429UL, 2061530784UL, 1036243443UL, +2058675708UL, 2534375036UL, 3724542133UL, 1317296740UL, 2505350414UL, 624826181UL, 3042995618UL, 3359715256UL, 1930700024UL, 3769953790UL, 2092911082UL, 1870611696UL, 1979908015UL, 684095804UL, 3697683979UL, 111440289UL, 1111193348UL, 3256907235UL, 1828801775UL, 3589061974UL, 3016563679UL, 2203918092UL, 1967781780UL, 2634997537UL, 2715287551UL, 1973545003UL, 17967467UL, 391604110UL, 2479429785UL, 324785401UL, 2622755198UL, 3993572289UL, +462777294UL, 2453630352UL, 726090704UL, 4170024046UL, 813760479UL, 3125444318UL, 1331224401UL, 1203416669UL, 3497395173UL, 2528908686UL, 1610778556UL, 267163358UL, 627307819UL, 294350450UL, 4252461657UL, 3302305047UL, 839609873UL, 1598505629UL, 3905396753UL, 3407593947UL, 1502262581UL, 1658629464UL, 1498139453UL, 2860737994UL, 1137070983UL, 2973368511UL, 3226624586UL, 1708925351UL, 195473107UL, 1973834367UL, 522423348UL, 1853471286UL, +1286593394UL, 2025932254UL, 1636839834UL, 555770116UL, 1255226060UL, 3482666699UL, 1515557266UL, 4244619305UL, 877073175UL, 641427670UL, 450188959UL, 1095230428UL, 710341587UL, 4216364784UL, 3022335608UL, 610535626UL, 1329467104UL, 262034293UL, 1665384485UL, 441595535UL, 2937045243UL, 2846877561UL, 1059914271UL, 978801343UL, 1150714166UL, 1689640190UL, 2219487087UL, 258315233UL, 3819595050UL, 377195836UL, 2727989292UL, 2460040634UL, +1828274968UL, 1200428010UL, 3601292788UL, 590004384UL, 3025338414UL, 3487643146UL, 3586255253UL, 3576058865UL, 1798441768UL, 1013577341UL, 3609472816UL, 1511067357UL, 3862104007UL, 3665193407UL, 1555165047UL, 4188135767UL, 2749766525UL, 1058917817UL, 1527094489UL, 3805115799UL, 1547526585UL, 817362043UL, 780594798UL, 2439842864UL, 2525211849UL, 3949139098UL, 2309049006UL, 642430472UL, 832084039UL, 81097112UL, 2619711743UL, 3148197354UL, +2231598766UL, 2863240894UL, 1639194881UL, 3018692935UL, 311769962UL, 2387524763UL, 3857547190UL, 3654577058UL, 2418052942UL, 1888597091UL, 991026264UL, 3292783340UL, 750206381UL, 2501986418UL, 2904195378UL, 1178067772UL, 3318328110UL, 3980484559UL, 655757623UL, 4265386540UL, 1964983082UL, 3673068643UL, 1319175627UL, 1539823819UL, 1635921454UL, 992141498UL, 1529070914UL, 1760958838UL, 1840073710UL, 3002614702UL, 3295305429UL, 2061530784UL, +1036243443UL, 2212957003UL, 2534375036UL, 3724542133UL, 1317296740UL, 2505350414UL, 2754670042UL, 3042995618UL, 3359715256UL, 1930700024UL, 3769953790UL, 3307920786UL, 1870611696UL, 1979908015UL, 684095804UL, 3697683979UL, 326641529UL, 1111193348UL, 3256907235UL, 1828801775UL, 3589061974UL, 1408835557UL, 2203918092UL, 1967781780UL, 2634997537UL, 2715287551UL, 1958610929UL, 17967467UL, 391604110UL, 2479429785UL, 324785401UL, 3833051255UL, +3993572289UL, 462777294UL, 2453630352UL, 726090704UL, 1236380896UL, 813760479UL, 3125444318UL, 1331224401UL, 1203416669UL, 728276857UL, 2528908686UL, 1610778556UL, 267163358UL, 627307819UL, 4276734917UL, 4252461657UL, 3302305047UL, 839609873UL, 1598505629UL, 3827653659UL, 3407593947UL, 1502262581UL, 1658629464UL, 1498139453UL, 3636064463UL, 1137070983UL, 2973368511UL, 3226624586UL, 1708925351UL, 2288771247UL, 1973834367UL, 522423348UL, +1853471286UL, 1286593394UL, 798364204UL, 1636839834UL, 555770116UL, 1255226060UL, 3482666699UL, 2385578475UL, 4244619305UL, 877073175UL, 641427670UL, 450188959UL, 3502743047UL, 710341587UL, 4216364784UL, 3022335608UL, 610535626UL, 2388448039UL, 262034293UL, 1665384485UL, 441595535UL, 2937045243UL, 3028160550UL, 1059914271UL, 978801343UL, 1150714166UL, 1689640190UL, 169488023UL, 258315233UL, 3819595050UL, 377195836UL, 2727989292UL, +837094660UL, 3531987448UL, 1901453576UL, 3312447598UL, 1036467641UL, 2243300650UL, 3148869460UL, 1886274644UL, 4076707689UL, 257110870UL, 3118463831UL, 1165161057UL, 1118846497UL, 3446934363UL, 1514176098UL, 1362957326UL, 2629874126UL, 791374320UL, 1015673947UL, 4252955786UL, 2409207780UL, 3831311130UL, 1654475922UL, 3682733431UL, 780405105UL, 4059616372UL, 503333525UL, 1471514828UL, 2526848791UL, 607539645UL, 730408454UL, 1574159005UL, +1777808061UL, 1296178310UL, 1078855633UL, 878462103UL, 269337411UL, 750735378UL, 2599590920UL, 4206153248UL, 939121991UL, 3061289971UL, 2543431563UL, 1684736054UL, 2319658494UL, 77300347UL, 3222569207UL, 3882064339UL, 2201120493UL, 289098227UL, 3934209124UL, 2407620042UL, 2713079957UL, 2812644841UL, 115993752UL, 2545688211UL, 774350907UL, 939749505UL, 2242588062UL, 960853876UL, 296665594UL, 1367312411UL, 3370351589UL, 711706404UL, +3331136631UL, 1370376958UL, 2322438166UL, 577115138UL, 1472236592UL, 4029835216UL, 1122502809UL, 3490426739UL, 1930206806UL, 2074277138UL, 1360950220UL, 3797708387UL, 2007430804UL, 2257239461UL, 3889012648UL, 710165871UL, 763101711UL, 728019024UL, 652403220UL, 2517020147UL, 1801290767UL, 1478810019UL, 1057288808UL, 2879821959UL, 3916870020UL, 1480362189UL, 919816752UL, 375872647UL, 3236906236UL, 1504223782UL, 128306943UL, 1355826533UL, +2656243649UL, 390454690UL, 3848250363UL, 377480950UL, 358651174UL, 1337795904UL, 1925462532UL, 2421843219UL, 173144626UL, 886649902UL, 402617827UL, 932830871UL, 742712936UL, 4033430386UL, 1409945926UL, 3617206544UL, 2383446356UL, 3452204096UL, 615486157UL, 720696019UL, 1730134434UL, 3918468503UL, 1629431965UL, 2174079220UL, 325852294UL, 234479771UL, 1490297289UL, 3579002992UL, 3538738636UL, 139386548UL, 3067789050UL, 2078261059UL, +3552654276UL, 1774602596UL, 2105142163UL, 2768099869UL, 2265044995UL, 3680536732UL, 3601322356UL, 2848878442UL, 1166743022UL, 3508176959UL, 2186695985UL, 550278868UL, 3324775634UL, 384537301UL, 1019044102UL, 3354263542UL, 1942540686UL, 922714337UL, 3097711558UL, 3074228403UL, 3565076630UL, 3459053081UL, 4128383906UL, 1114387332UL, 2101424539UL, 1192649508UL, 58778130UL, 1651798895UL, 1752063480UL, 1728826905UL, 2225187635UL, 2463770127UL, +}, +{ +1978406995UL, 576106282UL, 2238958298UL, 2073551095UL, 624788087UL, 4231569260UL, 1853272808UL, 238274694UL, 2389334758UL, 410188028UL, 2293786099UL, 4243662908UL, 2317700970UL, 4050493361UL, 2348206908UL, 485250660UL, 1212732903UL, 169414736UL, 292623762UL, 1602229231UL, 2466348869UL, 3063669700UL, 1872890881UL, 1887188929UL, 3447638989UL, 162521682UL, 1470651713UL, 4036975255UL, 3423782623UL, 4043724693UL, 1686690883UL, 2610958712UL, +35940353UL, 78593759UL, 1565950713UL, 1304303952UL, 2004267248UL, 1417268036UL, 3328228522UL, 789915977UL, 2567452041UL, 3564175714UL, 1838409932UL, 1455795236UL, 22377452UL, 455201131UL, 3340286965UL, 184599544UL, 4102076073UL, 4007870762UL, 1470247063UL, 1579231003UL, 3544385556UL, 3408973464UL, 3759098465UL, 3243598964UL, 532452279UL, 1172265732UL, 3520978258UL, 2880513876UL, 41188252UL, 1663974668UL, 3444236420UL, 338981290UL, +2140558860UL, 3310465688UL, 552673362UL, 3277110106UL, 948036400UL, 1346056406UL, 3257468427UL, 4008294878UL, 3788890535UL, 2414511414UL, 3539325895UL, 3025695322UL, 3727849930UL, 3922840362UL, 535899902UL, 665898223UL, 1456499692UL, 354208792UL, 247894771UL, 2093316680UL, 2945209002UL, 1029298544UL, 976007759UL, 394966955UL, 1843302845UL, 3689202777UL, 1999949614UL, 1070472810UL, 4233404701UL, 667526747UL, 2313963966UL, 3519400667UL, +1548274317UL, 3272402139UL, 2570038689UL, 892260481UL, 3547254358UL, 1540409404UL, 3687395534UL, 3751445920UL, 546406228UL, 2167638865UL, 4234783150UL, 806401261UL, 1351195286UL, 1085913868UL, 3109267901UL, 1882610112UL, 1568734773UL, 239430641UL, 3971361190UL, 383932711UL, 149541490UL, 196701535UL, 108079452UL, 888590964UL, 1708559652UL, 3196290573UL, 2115587458UL, 3198525248UL, 3580113911UL, 3098818120UL, 4271558926UL, 3208851696UL, +3354604918UL, 3536923694UL, 1087345822UL, 2292802521UL, 3500230819UL, 411564772UL, 2408049547UL, 1215342690UL, 1707182109UL, 774540619UL, 1613606757UL, 836141085UL, 1061962136UL, 348765795UL, 2852610966UL, 3526215991UL, 2708801073UL, 3467537935UL, 472234793UL, 3944263763UL, 1782219410UL, 502724699UL, 3525703395UL, 1756411033UL, 1358811278UL, 3938603279UL, 3701976555UL, 3259537961UL, 628617330UL, 1553932236UL, 1974037630UL, 2090519666UL, +2185028543UL, 1978406995UL, 576106282UL, 2238958298UL, 2073551095UL, 638634424UL, 4231569260UL, 1853272808UL, 238274694UL, 2389334758UL, 3808551433UL, 2293786099UL, 4243662908UL, 2317700970UL, 4050493361UL, 957981276UL, 485250660UL, 1212732903UL, 169414736UL, 292623762UL, 1956197178UL, 2466348869UL, 3063669700UL, 1872890881UL, 1887188929UL, 1162224455UL, 162521682UL, 1470651713UL, 4036975255UL, 3423782623UL, 3243414978UL, 1686690883UL, +2610958712UL, 35940353UL, 78593759UL, 1648686849UL, 1304303952UL, 2004267248UL, 1417268036UL, 3328228522UL, 3740797237UL, 2567452041UL, 3564175714UL, 1838409932UL, 1455795236UL, 1045087636UL, 455201131UL, 3340286965UL, 184599544UL, 4102076073UL, 2685677331UL, 1470247063UL, 1579231003UL, 3544385556UL, 3408973464UL, 3832799869UL, 3243598964UL, 532452279UL, 1172265732UL, 3520978258UL, 531684354UL, 41188252UL, 1663974668UL, 3444236420UL, +338981290UL, 1286622338UL, 3310465688UL, 552673362UL, 3277110106UL, 948036400UL, 2987864230UL, 3257468427UL, 4008294878UL, 3788890535UL, 2414511414UL, 2613137548UL, 3025695322UL, 3727849930UL, 3922840362UL, 535899902UL, 3288883992UL, 1456499692UL, 354208792UL, 247894771UL, 2093316680UL, 3775770224UL, 1029298544UL, 976007759UL, 394966955UL, 1843302845UL, 1484214934UL, 1999949614UL, 1070472810UL, 4233404701UL, 667526747UL, 3708951530UL, +3519400667UL, 1548274317UL, 3272402139UL, 2570038689UL, 3457725296UL, 3547254358UL, 1540409404UL, 3687395534UL, 3751445920UL, 181641144UL, 2167638865UL, 4234783150UL, 806401261UL, 1351195286UL, 3457819598UL, 3109267901UL, 1882610112UL, 1568734773UL, 239430641UL, 4037392309UL, 383932711UL, 149541490UL, 196701535UL, 108079452UL, 1724276622UL, 1708559652UL, 3196290573UL, 2115587458UL, 3198525248UL, 3784683125UL, 3098818120UL, 4271558926UL, +3208851696UL, 3354604918UL, 149872004UL, 1087345822UL, 2292802521UL, 3500230819UL, 411564772UL, 4068437023UL, 1215342690UL, 1707182109UL, 774540619UL, 1613606757UL, 1062624488UL, 1061962136UL, 348765795UL, 2852610966UL, 3526215991UL, 1518538195UL, 3467537935UL, 472234793UL, 3944263763UL, 1782219410UL, 1835413488UL, 3525703395UL, 1756411033UL, 1358811278UL, 3938603279UL, 1054245423UL, 3259537961UL, 628617330UL, 1553932236UL, 1974037630UL, +2030751433UL, 2185028543UL, 1978406995UL, 576106282UL, 2238958298UL, 3877268821UL, 638634424UL, 4231569260UL, 1853272808UL, 238274694UL, 2482404724UL, 3808551433UL, 2293786099UL, 4243662908UL, 2317700970UL, 1955227186UL, 957981276UL, 485250660UL, 1212732903UL, 169414736UL, 1333246101UL, 1956197178UL, 2466348869UL, 3063669700UL, 1872890881UL, 3662049503UL, 1162224455UL, 162521682UL, 1470651713UL, 4036975255UL, 3593925064UL, 3243414978UL, +1686690883UL, 2610958712UL, 35940353UL, 2530174792UL, 1648686849UL, 1304303952UL, 2004267248UL, 1417268036UL, 1299827381UL, 3740797237UL, 2567452041UL, 3564175714UL, 1838409932UL, 4221368409UL, 1045087636UL, 455201131UL, 3340286965UL, 184599544UL, 486448047UL, 2685677331UL, 1470247063UL, 1579231003UL, 3544385556UL, 1404931688UL, 3832799869UL, 3243598964UL, 532452279UL, 1172265732UL, 3373048034UL, 531684354UL, 41188252UL, 1663974668UL, +3444236420UL, 1375188728UL, 1286622338UL, 3310465688UL, 552673362UL, 3277110106UL, 655980467UL, 2987864230UL, 3257468427UL, 4008294878UL, 3788890535UL, 763995173UL, 2613137548UL, 3025695322UL, 3727849930UL, 3922840362UL, 1850434657UL, 3288883992UL, 1456499692UL, 354208792UL, 247894771UL, 3440471938UL, 3775770224UL, 1029298544UL, 976007759UL, 394966955UL, 3298245949UL, 1484214934UL, 1999949614UL, 1070472810UL, 4233404701UL, 3788558253UL, +3708951530UL, 3519400667UL, 1548274317UL, 3272402139UL, 3117201719UL, 3457725296UL, 3547254358UL, 1540409404UL, 3687395534UL, 3871454027UL, 181641144UL, 2167638865UL, 4234783150UL, 806401261UL, 1627904858UL, 3457819598UL, 3109267901UL, 1882610112UL, 1568734773UL, 3178105921UL, 4037392309UL, 383932711UL, 149541490UL, 196701535UL, 424324376UL, 1724276622UL, 1708559652UL, 3196290573UL, 2115587458UL, 2946026327UL, 3784683125UL, 3098818120UL, +4271558926UL, 3208851696UL, 2551504859UL, 149872004UL, 1087345822UL, 2292802521UL, 3500230819UL, 3055410013UL, 4068437023UL, 1215342690UL, 1707182109UL, 774540619UL, 2466902579UL, 1062624488UL, 1061962136UL, 348765795UL, 2852610966UL, 355211123UL, 1518538195UL, 3467537935UL, 472234793UL, 3944263763UL, 3159176627UL, 1835413488UL, 3525703395UL, 1756411033UL, 1358811278UL, 2153206130UL, 1054245423UL, 3259537961UL, 628617330UL, 1553932236UL, +1741202495UL, 2030751433UL, 2185028543UL, 1978406995UL, 576106282UL, 2832311581UL, 3877268821UL, 638634424UL, 4231569260UL, 1853272808UL, 3103974717UL, 2482404724UL, 3808551433UL, 2293786099UL, 4243662908UL, 2607780401UL, 1955227186UL, 957981276UL, 485250660UL, 1212732903UL, 3214649174UL, 1333246101UL, 1956197178UL, 2466348869UL, 3063669700UL, 2428387069UL, 3662049503UL, 1162224455UL, 162521682UL, 1470651713UL, 3563435961UL, 3593925064UL, +3243414978UL, 1686690883UL, 2610958712UL, 1021669488UL, 2530174792UL, 1648686849UL, 1304303952UL, 2004267248UL, 1150095671UL, 1299827381UL, 3740797237UL, 2567452041UL, 3564175714UL, 1992360540UL, 4221368409UL, 1045087636UL, 455201131UL, 3340286965UL, 3795860292UL, 486448047UL, 2685677331UL, 1470247063UL, 1579231003UL, 3012017918UL, 1404931688UL, 3832799869UL, 3243598964UL, 532452279UL, 2740401823UL, 3373048034UL, 531684354UL, 41188252UL, +1663974668UL, 1239982773UL, 1375188728UL, 1286622338UL, 3310465688UL, 552673362UL, 2159084435UL, 655980467UL, 2987864230UL, 3257468427UL, 4008294878UL, 1526518186UL, 763995173UL, 2613137548UL, 3025695322UL, 3727849930UL, 4161669345UL, 1850434657UL, 3288883992UL, 1456499692UL, 354208792UL, 1648970767UL, 3440471938UL, 3775770224UL, 1029298544UL, 976007759UL, 292829454UL, 3298245949UL, 1484214934UL, 1999949614UL, 1070472810UL, 949984087UL, +3788558253UL, 3708951530UL, 3519400667UL, 1548274317UL, 3691975282UL, 3117201719UL, 3457725296UL, 3547254358UL, 1540409404UL, 3414085332UL, 3871454027UL, 181641144UL, 2167638865UL, 4234783150UL, 487427004UL, 1627904858UL, 3457819598UL, 3109267901UL, 1882610112UL, 2942538550UL, 3178105921UL, 4037392309UL, 383932711UL, 149541490UL, 528605550UL, 424324376UL, 1724276622UL, 1708559652UL, 3196290573UL, 2042399752UL, 2946026327UL, 3784683125UL, +3098818120UL, 4271558926UL, 2493686919UL, 2551504859UL, 149872004UL, 1087345822UL, 2292802521UL, 3257357826UL, 3055410013UL, 4068437023UL, 1215342690UL, 1707182109UL, 1101368233UL, 2466902579UL, 1062624488UL, 1061962136UL, 348765795UL, 377675640UL, 355211123UL, 1518538195UL, 3467537935UL, 472234793UL, 1918362523UL, 3159176627UL, 1835413488UL, 3525703395UL, 1756411033UL, 490591069UL, 2153206130UL, 1054245423UL, 3259537961UL, 628617330UL, +2464143505UL, 3547421156UL, 4181103091UL, 1646291356UL, 2711273600UL, 2961799099UL, 1443009342UL, 2191618308UL, 1193143275UL, 1858488142UL, 3741304147UL, 1479629752UL, 214641634UL, 1601114903UL, 3032545707UL, 5784133UL, 1466424840UL, 2251379876UL, 4054080092UL, 2965144328UL, 644228426UL, 1397556958UL, 422190032UL, 3059134799UL, 3779253493UL, 1314537880UL, 867798895UL, 3819721559UL, 3588436937UL, 670021879UL, 1070365654UL, 3339455790UL, +2963659516UL, 1662488399UL, 2336157317UL, 3427798652UL, 2782719134UL, 1317842084UL, 1576308528UL, 1129452059UL, 3400565954UL, 84977051UL, 3689257381UL, 3289717503UL, 3535165628UL, 3982356490UL, 173255911UL, 1929987033UL, 4221790572UL, 3473317939UL, 749060417UL, 2711561754UL, 316719217UL, 2359410057UL, 2014271053UL, 1432982162UL, 2107582322UL, 1899811989UL, 1394115707UL, 1134266213UL, 2334994542UL, 2475488907UL, 3238562415UL, 2410379210UL, +4147209396UL, 2446286513UL, 2194020199UL, 3068194593UL, 797186100UL, 1299000541UL, 1870322719UL, 2944499140UL, 1045779179UL, 2735528787UL, 3057750264UL, 2607876894UL, 1595833743UL, 3327636115UL, 3520489322UL, 3864068029UL, 3153522810UL, 2609437702UL, 1360208295UL, 2062444770UL, 3927110355UL, 1524755299UL, 1708215998UL, 3587488663UL, 2813888113UL, 686192293UL, 1078633032UL, 3066910876UL, 793688350UL, 3613674912UL, 387713910UL, 2660476731UL, +3032509241UL, 2353038709UL, 2212424333UL, 2110412913UL, 3631228061UL, 2765134272UL, 4025821789UL, 3324834269UL, 187577732UL, 1568270802UL, 2098502315UL, 2472645526UL, 2986813860UL, 1621191378UL, 3891512282UL, 1561648319UL, 2690491944UL, 3075246584UL, 3202791012UL, 315381589UL, 3645907425UL, 3532420114UL, 802256935UL, 1270128258UL, 2695868207UL, 4075358890UL, 3888212208UL, 510396943UL, 3683116722UL, 3943939501UL, 146061942UL, 733291914UL, +1402325031UL, 672641124UL, 2817168601UL, 2622398925UL, 3641379870UL, 2969146913UL, 4232866548UL, 1694492034UL, 3065141682UL, 234404736UL, 1921499010UL, 2300706258UL, 1304904939UL, 207802178UL, 2674605425UL, 2688377241UL, 2674991105UL, 2585496531UL, 2358858923UL, 2578793432UL, 3275116043UL, 228073476UL, 2936443283UL, 3713102344UL, 1629243323UL, 209348683UL, 3730808488UL, 275442226UL, 223820143UL, 2365614109UL, 3017206322UL, 1906208795UL, +}, +{ +1545504510UL, 1985586093UL, 2005504076UL, 2487099791UL, 2348737867UL, 2254755902UL, 3789154730UL, 3268946922UL, 99552511UL, 1369361877UL, 1888041043UL, 3105269579UL, 4044127396UL, 2380045264UL, 2970234287UL, 293292961UL, 1811276320UL, 1083136897UL, 3016497500UL, 950611584UL, 2165628367UL, 4140133899UL, 2402926185UL, 990501164UL, 2185997143UL, 1769871204UL, 721625457UL, 567446962UL, 1695515231UL, 1848699963UL, 4163520111UL, 2316975723UL, +4268269680UL, 1021066723UL, 517434635UL, 3827063239UL, 3483118065UL, 760366769UL, 3072996795UL, 3548263896UL, 2131401627UL, 4167855065UL, 410255606UL, 1992500865UL, 1322267629UL, 1599293552UL, 2389387938UL, 3721625360UL, 216375429UL, 2002236178UL, 1834631738UL, 1585275126UL, 3879559071UL, 2517667239UL, 1397456303UL, 4095227658UL, 589002062UL, 137665950UL, 3933018338UL, 1519132173UL, 3566494128UL, 3914066872UL, 3233332246UL, 855336825UL, +1882502420UL, 1081015168UL, 4148374722UL, 1683880703UL, 1161266344UL, 99374978UL, 733926790UL, 3520260556UL, 3643143173UL, 927318029UL, 398003191UL, 3472026294UL, 3518018860UL, 2319507998UL, 2650129369UL, 3781620600UL, 1294634949UL, 3977318486UL, 3068540117UL, 3732334866UL, 740308004UL, 1988900647UL, 2936479173UL, 2348744493UL, 1357856242UL, 3842428732UL, 3746094733UL, 214260739UL, 3493892012UL, 2358001919UL, 1775614809UL, 952871363UL, +1216985499UL, 2706067772UL, 1008517818UL, 4189424856UL, 1260334069UL, 2420035836UL, 311831945UL, 3409272605UL, 4266242510UL, 3590716427UL, 537257045UL, 3153762469UL, 1620749663UL, 3338743851UL, 3644831936UL, 3243426619UL, 783551642UL, 1305153827UL, 2026979662UL, 3164955857UL, 4082645339UL, 1633544228UL, 3389303153UL, 440623817UL, 204979344UL, 1674764841UL, 633231391UL, 4180702701UL, 1953210184UL, 2534954734UL, 4252100558UL, 2993632630UL, +4050264705UL, 678445398UL, 1502035091UL, 302442688UL, 493504779UL, 2321459487UL, 1141171231UL, 1507727159UL, 672678623UL, 4046722895UL, 65675127UL, 2936731189UL, 441159654UL, 832039862UL, 2252252769UL, 3090962795UL, 2839688755UL, 645344032UL, 2921087914UL, 2264738834UL, 2341060101UL, 778789539UL, 737962654UL, 2859693559UL, 2784310535UL, 493247978UL, 185832691UL, 3321631011UL, 641506549UL, 2652806878UL, 480335604UL, 2908694258UL, +984807024UL, 1545504510UL, 1985586093UL, 2005504076UL, 2487099791UL, 127488455UL, 2254755902UL, 3789154730UL, 3268946922UL, 99552511UL, 2160330513UL, 1888041043UL, 3105269579UL, 4044127396UL, 2380045264UL, 3185912634UL, 293292961UL, 1811276320UL, 1083136897UL, 3016497500UL, 116883339UL, 2165628367UL, 4140133899UL, 2402926185UL, 990501164UL, 4099344218UL, 1769871204UL, 721625457UL, 567446962UL, 1695515231UL, 1218419978UL, 4163520111UL, +2316975723UL, 4268269680UL, 1021066723UL, 237254804UL, 3827063239UL, 3483118065UL, 760366769UL, 3072996795UL, 1020639813UL, 2131401627UL, 4167855065UL, 410255606UL, 1992500865UL, 1887858126UL, 1599293552UL, 2389387938UL, 3721625360UL, 216375429UL, 2096265248UL, 1834631738UL, 1585275126UL, 3879559071UL, 2517667239UL, 3267338158UL, 4095227658UL, 589002062UL, 137665950UL, 3933018338UL, 3823062902UL, 3566494128UL, 3914066872UL, 3233332246UL, +855336825UL, 3240858503UL, 1081015168UL, 4148374722UL, 1683880703UL, 1161266344UL, 4034899335UL, 733926790UL, 3520260556UL, 3643143173UL, 927318029UL, 2130442867UL, 3472026294UL, 3518018860UL, 2319507998UL, 2650129369UL, 253769320UL, 1294634949UL, 3977318486UL, 3068540117UL, 3732334866UL, 3100107703UL, 1988900647UL, 2936479173UL, 2348744493UL, 1357856242UL, 477065277UL, 3746094733UL, 214260739UL, 3493892012UL, 2358001919UL, 52055911UL, +952871363UL, 1216985499UL, 2706067772UL, 1008517818UL, 2820619262UL, 1260334069UL, 2420035836UL, 311831945UL, 3409272605UL, 2066128794UL, 3590716427UL, 537257045UL, 3153762469UL, 1620749663UL, 2261931254UL, 3644831936UL, 3243426619UL, 783551642UL, 1305153827UL, 3937339872UL, 3164955857UL, 4082645339UL, 1633544228UL, 3389303153UL, 3304461891UL, 204979344UL, 1674764841UL, 633231391UL, 4180702701UL, 2649553051UL, 2534954734UL, 4252100558UL, +2993632630UL, 4050264705UL, 3777379050UL, 1502035091UL, 302442688UL, 493504779UL, 2321459487UL, 1795212504UL, 1507727159UL, 672678623UL, 4046722895UL, 65675127UL, 2810951967UL, 441159654UL, 832039862UL, 2252252769UL, 3090962795UL, 3317253399UL, 645344032UL, 2921087914UL, 2264738834UL, 2341060101UL, 1431934790UL, 737962654UL, 2859693559UL, 2784310535UL, 493247978UL, 555655767UL, 3321631011UL, 641506549UL, 2652806878UL, 480335604UL, +1837415425UL, 984807024UL, 1545504510UL, 1985586093UL, 2005504076UL, 2274320195UL, 127488455UL, 2254755902UL, 3789154730UL, 3268946922UL, 3812459919UL, 2160330513UL, 1888041043UL, 3105269579UL, 4044127396UL, 2341347785UL, 3185912634UL, 293292961UL, 1811276320UL, 1083136897UL, 825098089UL, 116883339UL, 2165628367UL, 4140133899UL, 2402926185UL, 4124720284UL, 4099344218UL, 1769871204UL, 721625457UL, 567446962UL, 3598160577UL, 1218419978UL, +4163520111UL, 2316975723UL, 4268269680UL, 923374392UL, 237254804UL, 3827063239UL, 3483118065UL, 760366769UL, 2263405553UL, 1020639813UL, 2131401627UL, 4167855065UL, 410255606UL, 3382265961UL, 1887858126UL, 1599293552UL, 2389387938UL, 3721625360UL, 3440586186UL, 2096265248UL, 1834631738UL, 1585275126UL, 3879559071UL, 711626863UL, 3267338158UL, 4095227658UL, 589002062UL, 137665950UL, 1190761134UL, 3823062902UL, 3566494128UL, 3914066872UL, +3233332246UL, 3844456625UL, 3240858503UL, 1081015168UL, 4148374722UL, 1683880703UL, 589447946UL, 4034899335UL, 733926790UL, 3520260556UL, 3643143173UL, 3202263729UL, 2130442867UL, 3472026294UL, 3518018860UL, 2319507998UL, 3458685425UL, 253769320UL, 1294634949UL, 3977318486UL, 3068540117UL, 702365700UL, 3100107703UL, 1988900647UL, 2936479173UL, 2348744493UL, 969926974UL, 477065277UL, 3746094733UL, 214260739UL, 3493892012UL, 2890740482UL, +52055911UL, 952871363UL, 1216985499UL, 2706067772UL, 1079370138UL, 2820619262UL, 1260334069UL, 2420035836UL, 311831945UL, 701108525UL, 2066128794UL, 3590716427UL, 537257045UL, 3153762469UL, 2900214585UL, 2261931254UL, 3644831936UL, 3243426619UL, 783551642UL, 3143067452UL, 3937339872UL, 3164955857UL, 4082645339UL, 1633544228UL, 1680728882UL, 3304461891UL, 204979344UL, 1674764841UL, 633231391UL, 689425572UL, 2649553051UL, 2534954734UL, +4252100558UL, 2993632630UL, 865432399UL, 3777379050UL, 1502035091UL, 302442688UL, 493504779UL, 1282312650UL, 1795212504UL, 1507727159UL, 672678623UL, 4046722895UL, 976003271UL, 2810951967UL, 441159654UL, 832039862UL, 2252252769UL, 726554843UL, 3317253399UL, 645344032UL, 2921087914UL, 2264738834UL, 1325395107UL, 1431934790UL, 737962654UL, 2859693559UL, 2784310535UL, 3876486226UL, 555655767UL, 3321631011UL, 641506549UL, 2652806878UL, +3848380198UL, 1837415425UL, 984807024UL, 1545504510UL, 1985586093UL, 3711682090UL, 2274320195UL, 127488455UL, 2254755902UL, 3789154730UL, 1595223697UL, 3812459919UL, 2160330513UL, 1888041043UL, 3105269579UL, 2773455385UL, 2341347785UL, 3185912634UL, 293292961UL, 1811276320UL, 3280464626UL, 825098089UL, 116883339UL, 2165628367UL, 4140133899UL, 3092114881UL, 4124720284UL, 4099344218UL, 1769871204UL, 721625457UL, 1514083147UL, 3598160577UL, +1218419978UL, 4163520111UL, 2316975723UL, 200993429UL, 923374392UL, 237254804UL, 3827063239UL, 3483118065UL, 677187089UL, 2263405553UL, 1020639813UL, 2131401627UL, 4167855065UL, 1892382552UL, 3382265961UL, 1887858126UL, 1599293552UL, 2389387938UL, 4153928364UL, 3440586186UL, 2096265248UL, 1834631738UL, 1585275126UL, 3348317504UL, 711626863UL, 3267338158UL, 4095227658UL, 589002062UL, 3125839176UL, 1190761134UL, 3823062902UL, 3566494128UL, +3914066872UL, 1320578396UL, 3844456625UL, 3240858503UL, 1081015168UL, 4148374722UL, 258762412UL, 589447946UL, 4034899335UL, 733926790UL, 3520260556UL, 4290301810UL, 3202263729UL, 2130442867UL, 3472026294UL, 3518018860UL, 2904238635UL, 3458685425UL, 253769320UL, 1294634949UL, 3977318486UL, 2517006218UL, 702365700UL, 3100107703UL, 1988900647UL, 2936479173UL, 3227096174UL, 969926974UL, 477065277UL, 3746094733UL, 214260739UL, 3868449115UL, +2890740482UL, 52055911UL, 952871363UL, 1216985499UL, 2857823043UL, 1079370138UL, 2820619262UL, 1260334069UL, 2420035836UL, 1843837226UL, 701108525UL, 2066128794UL, 3590716427UL, 537257045UL, 1202524172UL, 2900214585UL, 2261931254UL, 3644831936UL, 3243426619UL, 2113758468UL, 3143067452UL, 3937339872UL, 3164955857UL, 4082645339UL, 3987431298UL, 1680728882UL, 3304461891UL, 204979344UL, 1674764841UL, 2684386058UL, 689425572UL, 2649553051UL, +2534954734UL, 4252100558UL, 3511996574UL, 865432399UL, 3777379050UL, 1502035091UL, 302442688UL, 970989610UL, 1282312650UL, 1795212504UL, 1507727159UL, 672678623UL, 3080995547UL, 976003271UL, 2810951967UL, 441159654UL, 832039862UL, 2670291295UL, 726554843UL, 3317253399UL, 645344032UL, 2921087914UL, 3039207936UL, 1325395107UL, 1431934790UL, 737962654UL, 2859693559UL, 2452474228UL, 3876486226UL, 555655767UL, 3321631011UL, 641506549UL, +712394572UL, 931322445UL, 3691485988UL, 77755644UL, 3585967569UL, 1546642657UL, 1074481665UL, 1211742891UL, 2405208503UL, 1015438825UL, 3187019083UL, 2194891243UL, 1305917012UL, 3737279586UL, 2633137983UL, 1924729261UL, 72781059UL, 1412697099UL, 3828782214UL, 1637665425UL, 4170514983UL, 2248277352UL, 3793164712UL, 2365683667UL, 1287488796UL, 3240061130UL, 2411573225UL, 3237771995UL, 901649504UL, 4107276625UL, 1613775409UL, 741888560UL, +332459303UL, 850991886UL, 3249391248UL, 3550484151UL, 3689717953UL, 233288631UL, 2496730550UL, 3221264250UL, 3172144573UL, 1429937065UL, 1776357872UL, 1084763904UL, 1993209913UL, 4142869218UL, 3130780078UL, 18180577UL, 2819625557UL, 1978393449UL, 372704074UL, 3919523286UL, 1777756963UL, 188652529UL, 411213996UL, 62282979UL, 3775037518UL, 2534579861UL, 2966280971UL, 3863833471UL, 3228893189UL, 3123894696UL, 362579125UL, 1232030882UL, +575379775UL, 1019196436UL, 1914161190UL, 3649246842UL, 2192095564UL, 2368224476UL, 138396720UL, 1299868479UL, 507152626UL, 2129033575UL, 3801624222UL, 623352301UL, 1551535796UL, 3848329776UL, 2727905150UL, 1109499603UL, 3222756581UL, 3914846131UL, 3207366497UL, 3216028717UL, 3712661572UL, 1970542UL, 1320230637UL, 2583706801UL, 1341029904UL, 1903168049UL, 1244252579UL, 1885511879UL, 2426625042UL, 3082846847UL, 3858784104UL, 2263210027UL, +130350645UL, 956540733UL, 776729371UL, 2266749094UL, 2220603773UL, 2556170531UL, 263980324UL, 802194348UL, 697108594UL, 3634984969UL, 4251738712UL, 1831444758UL, 1209156358UL, 3089957258UL, 4195548426UL, 3641578987UL, 990686800UL, 2391278490UL, 2233755358UL, 1739784005UL, 2458544650UL, 340925249UL, 2442887806UL, 3503407512UL, 3058778909UL, 3619026333UL, 2289286518UL, 1296212011UL, 3879317178UL, 1210295163UL, 3113210467UL, 1578990986UL, +641384071UL, 2437977832UL, 1689385197UL, 1323268226UL, 861337916UL, 3532905860UL, 3735971843UL, 2294673483UL, 1032787575UL, 1868992735UL, 4260308791UL, 2091311463UL, 2354047234UL, 1005300697UL, 29821726UL, 2790044161UL, 3154591207UL, 1370229266UL, 3464848205UL, 3855301526UL, 544374401UL, 101012897UL, 4214903025UL, 1310520049UL, 14884434UL, 1438288148UL, 2118574986UL, 2360002070UL, 512167778UL, 4186534704UL, 3633828199UL, 493600836UL, +}, +{ +2932801042UL, 4101748508UL, 3363559072UL, 1213475638UL, 2400369070UL, 1726749444UL, 3175844814UL, 2600020277UL, 3779799804UL, 1886667522UL, 1228105891UL, 589138388UL, 3960459504UL, 450669757UL, 3773736740UL, 2107201112UL, 1437834675UL, 3618095315UL, 3662453347UL, 968349971UL, 1891706458UL, 2333451375UL, 4242907074UL, 3265111057UL, 3648168902UL, 4137035018UL, 105573058UL, 2075999861UL, 1053920954UL, 3768713177UL, 1836088599UL, 2015103258UL, +2649187541UL, 2717894301UL, 534937136UL, 3492326400UL, 2406499346UL, 617315838UL, 1384748442UL, 519804615UL, 524657043UL, 832148261UL, 156272480UL, 394759604UL, 2428809631UL, 3401589884UL, 2588359262UL, 3826333418UL, 2427993050UL, 3254067543UL, 2570694144UL, 2876613091UL, 2883884893UL, 613070434UL, 1599903665UL, 3476967713UL, 1729385632UL, 207879231UL, 1256308247UL, 2538975486UL, 2550001448UL, 1820975095UL, 915640692UL, 1633749116UL, +1294669585UL, 3257901643UL, 3193347552UL, 3369630539UL, 285165240UL, 2337727802UL, 1854640523UL, 1034379307UL, 1206304638UL, 889104297UL, 3084078942UL, 3485609519UL, 3903898589UL, 4274630316UL, 3290195566UL, 2071163950UL, 775170461UL, 551343738UL, 164916146UL, 1678786363UL, 123960948UL, 2721608023UL, 3463122611UL, 1525791510UL, 1531697627UL, 1457848578UL, 665433501UL, 1784274031UL, 3436850186UL, 3976095421UL, 383031580UL, 2146948399UL, +3137780800UL, 410458873UL, 381977170UL, 4264728702UL, 1515223147UL, 3358033956UL, 139804933UL, 438534588UL, 901342240UL, 1536972976UL, 184570377UL, 681864510UL, 844333847UL, 2515362910UL, 917461167UL, 2538721219UL, 4268394152UL, 680292330UL, 3420438710UL, 3784725677UL, 1983802086UL, 4165891809UL, 2369490764UL, 3808530114UL, 3391499460UL, 2509287180UL, 970129219UL, 2492785859UL, 3611863290UL, 1303524794UL, 2991964551UL, 1828774928UL, +3950385781UL, 3251583775UL, 14901408UL, 1890180396UL, 1306701779UL, 3161784071UL, 637842485UL, 2830070006UL, 3867491336UL, 1594948357UL, 2579795132UL, 479188700UL, 806498245UL, 3905876458UL, 3499065005UL, 3168076042UL, 769094339UL, 3769363696UL, 1241457026UL, 1073618847UL, 251335726UL, 2574341631UL, 2534047421UL, 3151952274UL, 534046859UL, 3264754113UL, 1325368288UL, 2131927230UL, 3229420672UL, 336348290UL, 3768781638UL, 2593952436UL, +849969290UL, 2932801042UL, 4101748508UL, 3363559072UL, 1213475638UL, 1710895496UL, 1726749444UL, 3175844814UL, 2600020277UL, 3779799804UL, 4044580435UL, 1228105891UL, 589138388UL, 3960459504UL, 450669757UL, 4253882965UL, 2107201112UL, 1437834675UL, 3618095315UL, 3662453347UL, 3625360228UL, 1891706458UL, 2333451375UL, 4242907074UL, 3265111057UL, 3638586625UL, 4137035018UL, 105573058UL, 2075999861UL, 1053920954UL, 3014895241UL, 1836088599UL, +2015103258UL, 2649187541UL, 2717894301UL, 701652515UL, 3492326400UL, 2406499346UL, 617315838UL, 1384748442UL, 1142040801UL, 524657043UL, 832148261UL, 156272480UL, 394759604UL, 944890908UL, 3401589884UL, 2588359262UL, 3826333418UL, 2427993050UL, 337891051UL, 2570694144UL, 2876613091UL, 2883884893UL, 613070434UL, 659063916UL, 3476967713UL, 1729385632UL, 207879231UL, 1256308247UL, 311608860UL, 2550001448UL, 1820975095UL, 915640692UL, +1633749116UL, 1772334285UL, 3257901643UL, 3193347552UL, 3369630539UL, 285165240UL, 2627441892UL, 1854640523UL, 1034379307UL, 1206304638UL, 889104297UL, 2289660031UL, 3485609519UL, 3903898589UL, 4274630316UL, 3290195566UL, 3572160580UL, 775170461UL, 551343738UL, 164916146UL, 1678786363UL, 3109616684UL, 2721608023UL, 3463122611UL, 1525791510UL, 1531697627UL, 3660976089UL, 665433501UL, 1784274031UL, 3436850186UL, 3976095421UL, 1696775162UL, +2146948399UL, 3137780800UL, 410458873UL, 381977170UL, 1669455215UL, 1515223147UL, 3358033956UL, 139804933UL, 438534588UL, 1738237971UL, 1536972976UL, 184570377UL, 681864510UL, 844333847UL, 770765754UL, 917461167UL, 2538721219UL, 4268394152UL, 680292330UL, 1993152157UL, 3784725677UL, 1983802086UL, 4165891809UL, 2369490764UL, 3411542022UL, 3391499460UL, 2509287180UL, 970129219UL, 2492785859UL, 1869391890UL, 1303524794UL, 2991964551UL, +1828774928UL, 3950385781UL, 4139486157UL, 14901408UL, 1890180396UL, 1306701779UL, 3161784071UL, 174545194UL, 2830070006UL, 3867491336UL, 1594948357UL, 2579795132UL, 4132973523UL, 806498245UL, 3905876458UL, 3499065005UL, 3168076042UL, 538076966UL, 3769363696UL, 1241457026UL, 1073618847UL, 251335726UL, 2085586137UL, 2534047421UL, 3151952274UL, 534046859UL, 3264754113UL, 643987981UL, 2131927230UL, 3229420672UL, 336348290UL, 3768781638UL, +3468816701UL, 849969290UL, 2932801042UL, 4101748508UL, 3363559072UL, 2524943673UL, 1710895496UL, 1726749444UL, 3175844814UL, 2600020277UL, 3677241699UL, 4044580435UL, 1228105891UL, 589138388UL, 3960459504UL, 3903077887UL, 4253882965UL, 2107201112UL, 1437834675UL, 3618095315UL, 2362822379UL, 3625360228UL, 1891706458UL, 2333451375UL, 4242907074UL, 2289503940UL, 3638586625UL, 4137035018UL, 105573058UL, 2075999861UL, 1299938293UL, 3014895241UL, +1836088599UL, 2015103258UL, 2649187541UL, 3727003343UL, 701652515UL, 3492326400UL, 2406499346UL, 617315838UL, 1627975589UL, 1142040801UL, 524657043UL, 832148261UL, 156272480UL, 3658645823UL, 944890908UL, 3401589884UL, 2588359262UL, 3826333418UL, 3645806126UL, 337891051UL, 2570694144UL, 2876613091UL, 2883884893UL, 2866570997UL, 659063916UL, 3476967713UL, 1729385632UL, 207879231UL, 298556768UL, 311608860UL, 2550001448UL, 1820975095UL, +915640692UL, 1014996737UL, 1772334285UL, 3257901643UL, 3193347552UL, 3369630539UL, 96395889UL, 2627441892UL, 1854640523UL, 1034379307UL, 1206304638UL, 2546521293UL, 2289660031UL, 3485609519UL, 3903898589UL, 4274630316UL, 2360048518UL, 3572160580UL, 775170461UL, 551343738UL, 164916146UL, 2068601014UL, 3109616684UL, 2721608023UL, 3463122611UL, 1525791510UL, 1228011534UL, 3660976089UL, 665433501UL, 1784274031UL, 3436850186UL, 1620580129UL, +1696775162UL, 2146948399UL, 3137780800UL, 410458873UL, 2753059283UL, 1669455215UL, 1515223147UL, 3358033956UL, 139804933UL, 2786429190UL, 1738237971UL, 1536972976UL, 184570377UL, 681864510UL, 358796749UL, 770765754UL, 917461167UL, 2538721219UL, 4268394152UL, 2355846025UL, 1993152157UL, 3784725677UL, 1983802086UL, 4165891809UL, 360259050UL, 3411542022UL, 3391499460UL, 2509287180UL, 970129219UL, 4055494275UL, 1869391890UL, 1303524794UL, +2991964551UL, 1828774928UL, 3508750618UL, 4139486157UL, 14901408UL, 1890180396UL, 1306701779UL, 3684762156UL, 174545194UL, 2830070006UL, 3867491336UL, 1594948357UL, 702781070UL, 4132973523UL, 806498245UL, 3905876458UL, 3499065005UL, 1372989388UL, 538076966UL, 3769363696UL, 1241457026UL, 1073618847UL, 3579114424UL, 2085586137UL, 2534047421UL, 3151952274UL, 534046859UL, 1882037168UL, 643987981UL, 2131927230UL, 3229420672UL, 336348290UL, +555833786UL, 3468816701UL, 849969290UL, 2932801042UL, 4101748508UL, 1095934625UL, 2524943673UL, 1710895496UL, 1726749444UL, 3175844814UL, 2287140069UL, 3677241699UL, 4044580435UL, 1228105891UL, 589138388UL, 1596938176UL, 3903077887UL, 4253882965UL, 2107201112UL, 1437834675UL, 2605388022UL, 2362822379UL, 3625360228UL, 1891706458UL, 2333451375UL, 174003035UL, 2289503940UL, 3638586625UL, 4137035018UL, 105573058UL, 697023108UL, 1299938293UL, +3014895241UL, 1836088599UL, 2015103258UL, 4128339205UL, 3727003343UL, 701652515UL, 3492326400UL, 2406499346UL, 426422678UL, 1627975589UL, 1142040801UL, 524657043UL, 832148261UL, 2461054373UL, 3658645823UL, 944890908UL, 3401589884UL, 2588359262UL, 3184255074UL, 3645806126UL, 337891051UL, 2570694144UL, 2876613091UL, 187151044UL, 2866570997UL, 659063916UL, 3476967713UL, 1729385632UL, 2811989057UL, 298556768UL, 311608860UL, 2550001448UL, +1820975095UL, 1806779934UL, 1014996737UL, 1772334285UL, 3257901643UL, 3193347552UL, 2145947779UL, 96395889UL, 2627441892UL, 1854640523UL, 1034379307UL, 2748996070UL, 2546521293UL, 2289660031UL, 3485609519UL, 3903898589UL, 452746826UL, 2360048518UL, 3572160580UL, 775170461UL, 551343738UL, 669098691UL, 2068601014UL, 3109616684UL, 2721608023UL, 3463122611UL, 22889155UL, 1228011534UL, 3660976089UL, 665433501UL, 1784274031UL, 227705324UL, +1620580129UL, 1696775162UL, 2146948399UL, 3137780800UL, 4267814323UL, 2753059283UL, 1669455215UL, 1515223147UL, 3358033956UL, 2806778033UL, 2786429190UL, 1738237971UL, 1536972976UL, 184570377UL, 3310279262UL, 358796749UL, 770765754UL, 917461167UL, 2538721219UL, 2247224091UL, 2355846025UL, 1993152157UL, 3784725677UL, 1983802086UL, 2399541755UL, 360259050UL, 3411542022UL, 3391499460UL, 2509287180UL, 2335541531UL, 4055494275UL, 1869391890UL, +1303524794UL, 2991964551UL, 392724462UL, 3508750618UL, 4139486157UL, 14901408UL, 1890180396UL, 2513331299UL, 3684762156UL, 174545194UL, 2830070006UL, 3867491336UL, 1887131931UL, 702781070UL, 4132973523UL, 806498245UL, 3905876458UL, 2263606492UL, 1372989388UL, 538076966UL, 3769363696UL, 1241457026UL, 170472774UL, 3579114424UL, 2085586137UL, 2534047421UL, 3151952274UL, 1488165272UL, 1882037168UL, 643987981UL, 2131927230UL, 3229420672UL, +1158405862UL, 1469009373UL, 4117356830UL, 4063868500UL, 2006417445UL, 2976934394UL, 2683607933UL, 3174943272UL, 2099974138UL, 2250858961UL, 205251124UL, 84783688UL, 1551294676UL, 224349432UL, 1893741756UL, 3680361724UL, 561624088UL, 251553631UL, 1654870642UL, 2195380145UL, 866503297UL, 1814519294UL, 905566144UL, 727763043UL, 1910034093UL, 1876316198UL, 3031876716UL, 2783769690UL, 2649650479UL, 2024342098UL, 2170858649UL, 2186613759UL, +2688207487UL, 881594599UL, 1010953695UL, 2768977700UL, 3341020856UL, 2446339960UL, 2648757147UL, 1317083878UL, 3301541769UL, 3574285525UL, 3331294407UL, 712581268UL, 3612116700UL, 3510601489UL, 2569879282UL, 3772968052UL, 332485239UL, 280920979UL, 716834274UL, 1863623285UL, 654670865UL, 1706917935UL, 1598315563UL, 2486805657UL, 2295746319UL, 635609792UL, 55141757UL, 4089183045UL, 145257162UL, 1921789879UL, 2833550514UL, 3798992859UL, +1532875864UL, 3668053062UL, 2749191097UL, 3412220447UL, 3383752088UL, 3191842833UL, 4167387125UL, 2438940746UL, 1453011669UL, 2747298308UL, 1057877757UL, 399006034UL, 132680506UL, 31671249UL, 1070386969UL, 2415113777UL, 3720335676UL, 3416473189UL, 1476808053UL, 785398955UL, 3335661823UL, 315496929UL, 1421907623UL, 1802371914UL, 3049258946UL, 1773374729UL, 382902076UL, 3262814446UL, 1774244917UL, 4064677234UL, 2281551331UL, 3019541390UL, +2445483046UL, 3059154103UL, 2147309319UL, 566587847UL, 216051987UL, 521013398UL, 2721884570UL, 3325443529UL, 1921922591UL, 1643064709UL, 1155714395UL, 1737031844UL, 2117338012UL, 1876262536UL, 3589621009UL, 3800806613UL, 1102108318UL, 1376914700UL, 539544394UL, 799741508UL, 1192097712UL, 2894663754UL, 567276527UL, 106814343UL, 3985577014UL, 422246623UL, 126568764UL, 4008211389UL, 4037889581UL, 2185357423UL, 2239644921UL, 2116447019UL, +1249715620UL, 2095747493UL, 4063243162UL, 3059330950UL, 1045571624UL, 1150656233UL, 3024439196UL, 3981904623UL, 1743764595UL, 4220253496UL, 3322182853UL, 2132911849UL, 2074342674UL, 198749193UL, 574306951UL, 3563262292UL, 3832626833UL, 2349475213UL, 182567249UL, 1530390173UL, 2066055611UL, 2609802571UL, 1392638962UL, 1495846580UL, 2356952332UL, 4029921749UL, 1731839848UL, 527880959UL, 1204112231UL, 938004695UL, 294300378UL, 1855457892UL, +}, +{ +1438083560UL, 1727969469UL, 703174449UL, 1296281193UL, 1386452240UL, 3304170302UL, 3048300096UL, 277697908UL, 2675939661UL, 3382564518UL, 1639425457UL, 2210719281UL, 3173605115UL, 1685375802UL, 1317820682UL, 1960916541UL, 4230888182UL, 1924357010UL, 3322827982UL, 1663716994UL, 976583570UL, 4146230815UL, 525755678UL, 3608894680UL, 1715438458UL, 1519478303UL, 2845291872UL, 1115405802UL, 2468673244UL, 2289739992UL, 46988928UL, 2559411080UL, +2466723374UL, 2995303634UL, 3871022237UL, 1794652692UL, 2424766096UL, 2849910020UL, 978542234UL, 1667051478UL, 3393290740UL, 1508376445UL, 4090541488UL, 1314139749UL, 1271060027UL, 3272019878UL, 4032394060UL, 757805987UL, 619143288UL, 1165760536UL, 225099797UL, 871754591UL, 2065691940UL, 2016593817UL, 1705071529UL, 2559080067UL, 2048856253UL, 3217759224UL, 2691334730UL, 1576829868UL, 3356759591UL, 1570481357UL, 1097065360UL, 852561431UL, +3559721965UL, 1403648739UL, 1772347635UL, 1196457607UL, 462142253UL, 761176322UL, 2209893444UL, 217724244UL, 3356132814UL, 2838131962UL, 3571552868UL, 1197135963UL, 3239010986UL, 2612283238UL, 2606429155UL, 2194090162UL, 4256137634UL, 935551404UL, 3057660021UL, 866672836UL, 1119670384UL, 1757615349UL, 649402076UL, 2814108193UL, 3312658713UL, 2627947214UL, 2982267121UL, 486762785UL, 2746076238UL, 2134737126UL, 4106010468UL, 3151832629UL, +2419694200UL, 2803791741UL, 2100250718UL, 3171079849UL, 1874606681UL, 1884940331UL, 926257211UL, 1940082331UL, 1024435222UL, 609478334UL, 2501896844UL, 518643063UL, 4285619138UL, 1054300997UL, 4024681853UL, 2287236199UL, 2891891855UL, 1519666047UL, 1919500932UL, 3880316442UL, 1994336737UL, 1025147784UL, 3433493260UL, 1647319600UL, 3298872174UL, 3744513628UL, 2918990402UL, 2649193481UL, 234630674UL, 1963357481UL, 1118148435UL, 2658522312UL, +2563194501UL, 2238556876UL, 1210050812UL, 748709882UL, 3894824022UL, 2575692519UL, 436044710UL, 3465014792UL, 3686094502UL, 2963529475UL, 3251316066UL, 2834750227UL, 789471563UL, 853201732UL, 4119014483UL, 1312738151UL, 2018934495UL, 542908921UL, 732294449UL, 2519981401UL, 1663929229UL, 4041419972UL, 3038382188UL, 3182489020UL, 353453260UL, 4074472601UL, 1187952022UL, 2118553383UL, 1068338764UL, 3699144039UL, 3129056770UL, 1419222328UL, +2666827910UL, 1438083560UL, 1727969469UL, 703174449UL, 1296281193UL, 2134413940UL, 3304170302UL, 3048300096UL, 277697908UL, 2675939661UL, 3817858752UL, 1639425457UL, 2210719281UL, 3173605115UL, 1685375802UL, 2587083472UL, 1960916541UL, 4230888182UL, 1924357010UL, 3322827982UL, 2582901426UL, 976583570UL, 4146230815UL, 525755678UL, 3608894680UL, 524232549UL, 1519478303UL, 2845291872UL, 1115405802UL, 2468673244UL, 591800699UL, 46988928UL, +2559411080UL, 2466723374UL, 2995303634UL, 2307625850UL, 1794652692UL, 2424766096UL, 2849910020UL, 978542234UL, 1284927074UL, 3393290740UL, 1508376445UL, 4090541488UL, 1314139749UL, 3508281898UL, 3272019878UL, 4032394060UL, 757805987UL, 619143288UL, 1846615167UL, 225099797UL, 871754591UL, 2065691940UL, 2016593817UL, 1193455869UL, 2559080067UL, 2048856253UL, 3217759224UL, 2691334730UL, 2665708717UL, 3356759591UL, 1570481357UL, 1097065360UL, +852561431UL, 1652864273UL, 1403648739UL, 1772347635UL, 1196457607UL, 462142253UL, 1222855287UL, 2209893444UL, 217724244UL, 3356132814UL, 2838131962UL, 3060983219UL, 1197135963UL, 3239010986UL, 2612283238UL, 2606429155UL, 4171729370UL, 4256137634UL, 935551404UL, 3057660021UL, 866672836UL, 75618353UL, 1757615349UL, 649402076UL, 2814108193UL, 3312658713UL, 3975515213UL, 2982267121UL, 486762785UL, 2746076238UL, 2134737126UL, 3251020123UL, +3151832629UL, 2419694200UL, 2803791741UL, 2100250718UL, 624531676UL, 1874606681UL, 1884940331UL, 926257211UL, 1940082331UL, 3678479182UL, 609478334UL, 2501896844UL, 518643063UL, 4285619138UL, 1725899979UL, 4024681853UL, 2287236199UL, 2891891855UL, 1519666047UL, 702508101UL, 3880316442UL, 1994336737UL, 1025147784UL, 3433493260UL, 4212959134UL, 3298872174UL, 3744513628UL, 2918990402UL, 2649193481UL, 1782150764UL, 1963357481UL, 1118148435UL, +2658522312UL, 2563194501UL, 3330122355UL, 1210050812UL, 748709882UL, 3894824022UL, 2575692519UL, 637240921UL, 3465014792UL, 3686094502UL, 2963529475UL, 3251316066UL, 1510158901UL, 789471563UL, 853201732UL, 4119014483UL, 1312738151UL, 3018953017UL, 542908921UL, 732294449UL, 2519981401UL, 1663929229UL, 2696317636UL, 3038382188UL, 3182489020UL, 353453260UL, 4074472601UL, 4249950407UL, 2118553383UL, 1068338764UL, 3699144039UL, 3129056770UL, +2334590922UL, 2666827910UL, 1438083560UL, 1727969469UL, 703174449UL, 1679528518UL, 2134413940UL, 3304170302UL, 3048300096UL, 277697908UL, 3417107827UL, 3817858752UL, 1639425457UL, 2210719281UL, 3173605115UL, 1858788112UL, 2587083472UL, 1960916541UL, 4230888182UL, 1924357010UL, 3692988029UL, 2582901426UL, 976583570UL, 4146230815UL, 525755678UL, 1122319464UL, 524232549UL, 1519478303UL, 2845291872UL, 1115405802UL, 205855120UL, 591800699UL, +46988928UL, 2559411080UL, 2466723374UL, 3358512221UL, 2307625850UL, 1794652692UL, 2424766096UL, 2849910020UL, 2865273283UL, 1284927074UL, 3393290740UL, 1508376445UL, 4090541488UL, 2453941323UL, 3508281898UL, 3272019878UL, 4032394060UL, 757805987UL, 3191753865UL, 1846615167UL, 225099797UL, 871754591UL, 2065691940UL, 1301630578UL, 1193455869UL, 2559080067UL, 2048856253UL, 3217759224UL, 3858428004UL, 2665708717UL, 3356759591UL, 1570481357UL, +1097065360UL, 3550687085UL, 1652864273UL, 1403648739UL, 1772347635UL, 1196457607UL, 2158802672UL, 1222855287UL, 2209893444UL, 217724244UL, 3356132814UL, 1954043011UL, 3060983219UL, 1197135963UL, 3239010986UL, 2612283238UL, 2156334822UL, 4171729370UL, 4256137634UL, 935551404UL, 3057660021UL, 3331206175UL, 75618353UL, 1757615349UL, 649402076UL, 2814108193UL, 1313890357UL, 3975515213UL, 2982267121UL, 486762785UL, 2746076238UL, 2023213803UL, +3251020123UL, 3151832629UL, 2419694200UL, 2803791741UL, 392313450UL, 624531676UL, 1874606681UL, 1884940331UL, 926257211UL, 3369012310UL, 3678479182UL, 609478334UL, 2501896844UL, 518643063UL, 3638013610UL, 1725899979UL, 4024681853UL, 2287236199UL, 2891891855UL, 429282096UL, 702508101UL, 3880316442UL, 1994336737UL, 1025147784UL, 1217486411UL, 4212959134UL, 3298872174UL, 3744513628UL, 2918990402UL, 1279832521UL, 1782150764UL, 1963357481UL, +1118148435UL, 2658522312UL, 2379123622UL, 3330122355UL, 1210050812UL, 748709882UL, 3894824022UL, 3987054169UL, 637240921UL, 3465014792UL, 3686094502UL, 2963529475UL, 2167876400UL, 1510158901UL, 789471563UL, 853201732UL, 4119014483UL, 1746447311UL, 3018953017UL, 542908921UL, 732294449UL, 2519981401UL, 1908715414UL, 2696317636UL, 3038382188UL, 3182489020UL, 353453260UL, 2132930364UL, 4249950407UL, 2118553383UL, 1068338764UL, 3699144039UL, +433893434UL, 2334590922UL, 2666827910UL, 1438083560UL, 1727969469UL, 1154725669UL, 1679528518UL, 2134413940UL, 3304170302UL, 3048300096UL, 31944135UL, 3417107827UL, 3817858752UL, 1639425457UL, 2210719281UL, 4203237786UL, 1858788112UL, 2587083472UL, 1960916541UL, 4230888182UL, 2712081548UL, 3692988029UL, 2582901426UL, 976583570UL, 4146230815UL, 3948659885UL, 1122319464UL, 524232549UL, 1519478303UL, 2845291872UL, 2881616509UL, 205855120UL, +591800699UL, 46988928UL, 2559411080UL, 3645011109UL, 3358512221UL, 2307625850UL, 1794652692UL, 2424766096UL, 3667888476UL, 2865273283UL, 1284927074UL, 3393290740UL, 1508376445UL, 1605429636UL, 2453941323UL, 3508281898UL, 3272019878UL, 4032394060UL, 3904681057UL, 3191753865UL, 1846615167UL, 225099797UL, 871754591UL, 696516502UL, 1301630578UL, 1193455869UL, 2559080067UL, 2048856253UL, 2589248412UL, 3858428004UL, 2665708717UL, 3356759591UL, +1570481357UL, 1884333722UL, 3550687085UL, 1652864273UL, 1403648739UL, 1772347635UL, 3418430008UL, 2158802672UL, 1222855287UL, 2209893444UL, 217724244UL, 4164333189UL, 1954043011UL, 3060983219UL, 1197135963UL, 3239010986UL, 2300947859UL, 2156334822UL, 4171729370UL, 4256137634UL, 935551404UL, 1258856668UL, 3331206175UL, 75618353UL, 1757615349UL, 649402076UL, 772455867UL, 1313890357UL, 3975515213UL, 2982267121UL, 486762785UL, 3671941628UL, +2023213803UL, 3251020123UL, 3151832629UL, 2419694200UL, 4264015999UL, 392313450UL, 624531676UL, 1874606681UL, 1884940331UL, 2460787316UL, 3369012310UL, 3678479182UL, 609478334UL, 2501896844UL, 2131090271UL, 3638013610UL, 1725899979UL, 4024681853UL, 2287236199UL, 455349830UL, 429282096UL, 702508101UL, 3880316442UL, 1994336737UL, 1727894434UL, 1217486411UL, 4212959134UL, 3298872174UL, 3744513628UL, 1120563681UL, 1279832521UL, 1782150764UL, +1963357481UL, 1118148435UL, 3362151087UL, 2379123622UL, 3330122355UL, 1210050812UL, 748709882UL, 2506587900UL, 3987054169UL, 637240921UL, 3465014792UL, 3686094502UL, 1265652315UL, 2167876400UL, 1510158901UL, 789471563UL, 853201732UL, 3472479264UL, 1746447311UL, 3018953017UL, 542908921UL, 732294449UL, 659090240UL, 1908715414UL, 2696317636UL, 3038382188UL, 3182489020UL, 174113867UL, 2132930364UL, 4249950407UL, 2118553383UL, 1068338764UL, +4115132848UL, 1714842877UL, 1153237667UL, 1015943026UL, 2014412384UL, 2478393613UL, 1340079052UL, 167685322UL, 1848482402UL, 3252973254UL, 638064461UL, 1599254200UL, 2525050247UL, 2813349060UL, 2415037971UL, 3274852801UL, 3415369586UL, 3216396500UL, 3147792606UL, 438338168UL, 2326605175UL, 2846648724UL, 3871841623UL, 287840506UL, 3218295001UL, 2562000356UL, 574276928UL, 418096348UL, 1798854554UL, 1913561074UL, 2025706546UL, 41907788UL, +3535708035UL, 1240819558UL, 208810147UL, 4062740265UL, 451865782UL, 2652508890UL, 3579720859UL, 1243967909UL, 2191937647UL, 2473947838UL, 1847359263UL, 2496539569UL, 4061942257UL, 1372849161UL, 2016697844UL, 1827460131UL, 1135062647UL, 1255573479UL, 3506657283UL, 3699699807UL, 3087913374UL, 1196140869UL, 4095306490UL, 830793530UL, 1289366065UL, 3268392251UL, 4119035690UL, 1631012325UL, 3410799501UL, 1470209122UL, 3057922764UL, 2895379380UL, +2654121201UL, 1984999545UL, 2258412956UL, 4267137150UL, 3396740662UL, 2480013857UL, 3845856317UL, 3669454152UL, 2438423716UL, 3191341994UL, 1571280634UL, 1423782557UL, 3279999352UL, 1886288620UL, 205278284UL, 793062897UL, 112852083UL, 69164746UL, 2218046933UL, 4206182754UL, 3021072495UL, 2157753215UL, 2875773583UL, 1453706073UL, 168681204UL, 3905840714UL, 4098714445UL, 3410804508UL, 1737239929UL, 1613207828UL, 2987997090UL, 1869303136UL, +3348561687UL, 3391148819UL, 1680062950UL, 4150476788UL, 2340622122UL, 11331065UL, 2250669421UL, 3003852975UL, 2145739501UL, 1627177260UL, 994260425UL, 1479134620UL, 2315299915UL, 1268765340UL, 285960682UL, 3801150032UL, 3948820512UL, 1677682247UL, 1735541155UL, 1914753931UL, 1965156079UL, 1875233710UL, 681418791UL, 2077804400UL, 1963479724UL, 2447942398UL, 269798686UL, 2740088859UL, 1974178779UL, 3373487761UL, 2879779843UL, 157827737UL, +3855390825UL, 2779173093UL, 2359181541UL, 3508102362UL, 4001266348UL, 3949912729UL, 3232414439UL, 472195874UL, 57835121UL, 1854343116UL, 3020785997UL, 2024437594UL, 2182964208UL, 3379376555UL, 1213864603UL, 307833006UL, 1029130725UL, 545051507UL, 4001695571UL, 2258480284UL, 896286117UL, 355474524UL, 2514583184UL, 2997458384UL, 3278715462UL, 1675341954UL, 3603020014UL, 2318410671UL, 2152785892UL, 4285597912UL, 35655711UL, 2087100216UL, +}, +{ +1671155UL, 472949658UL, 148656515UL, 1640075411UL, 930771231UL, 1601854390UL, 471598090UL, 2013359012UL, 3708325970UL, 1688441844UL, 736452516UL, 100585026UL, 1154373750UL, 4029833741UL, 3409420465UL, 192349301UL, 3804215437UL, 909027311UL, 2896874106UL, 3567276364UL, 1319305666UL, 3858990362UL, 3155018279UL, 3756192170UL, 3567813642UL, 228734829UL, 577956164UL, 2078807284UL, 1005987081UL, 1464380935UL, 112604551UL, 3865074232UL, +3776350052UL, 1112767766UL, 2947509331UL, 910887552UL, 4127297396UL, 851240323UL, 3136588838UL, 1639013085UL, 1154068086UL, 639126620UL, 2501600773UL, 3174842042UL, 3456593672UL, 80596481UL, 126970446UL, 2184239961UL, 1448001095UL, 689252599UL, 1087028487UL, 2905348107UL, 2502009404UL, 2156595397UL, 2149975474UL, 2201723284UL, 3908202640UL, 754508313UL, 2321393187UL, 787043244UL, 2575809693UL, 4172462501UL, 2322897687UL, 1899992264UL, +1854136781UL, 3575249683UL, 2939319477UL, 901605762UL, 676398674UL, 2849283587UL, 2992300101UL, 1513271778UL, 2797164148UL, 1914019034UL, 1889341710UL, 2739211008UL, 1954453463UL, 3279391005UL, 2899313529UL, 1412533980UL, 1291505093UL, 2884603001UL, 564097935UL, 3552741248UL, 2809901827UL, 1263126330UL, 860214490UL, 2168366043UL, 2681035029UL, 3226888214UL, 2902522885UL, 554804421UL, 1571065517UL, 3322453053UL, 4144256215UL, 126415290UL, +980853251UL, 1531963815UL, 3237470129UL, 1465444883UL, 2031491001UL, 2205009469UL, 1046577915UL, 828927962UL, 2170245718UL, 1090142292UL, 1667375106UL, 2522840205UL, 4047872402UL, 3862734726UL, 91588630UL, 3122782857UL, 929883614UL, 694999008UL, 1472139068UL, 1246663706UL, 3500613893UL, 4200173807UL, 186199942UL, 3890621040UL, 229752655UL, 1011692880UL, 2791828564UL, 2677625011UL, 791005643UL, 1754509337UL, 2321492983UL, 3512328605UL, +1294405891UL, 2845189858UL, 434175992UL, 3155484007UL, 2306406482UL, 3197931140UL, 22971924UL, 1521633702UL, 2366802562UL, 399245037UL, 2833224222UL, 2507478835UL, 3231711673UL, 3784114896UL, 1927919696UL, 783802899UL, 3408133710UL, 2278711709UL, 3001078924UL, 1223320630UL, 3246830042UL, 943189685UL, 4062534962UL, 1039971013UL, 2342241593UL, 3551623946UL, 322017346UL, 3585779636UL, 81127429UL, 3549929990UL, 2886997195UL, 1746081951UL, +4169018554UL, 1671155UL, 472949658UL, 148656515UL, 1640075411UL, 3772042754UL, 1601854390UL, 471598090UL, 2013359012UL, 3708325970UL, 321630853UL, 736452516UL, 100585026UL, 1154373750UL, 4029833741UL, 1926754199UL, 192349301UL, 3804215437UL, 909027311UL, 2896874106UL, 1138131968UL, 1319305666UL, 3858990362UL, 3155018279UL, 3756192170UL, 2489094664UL, 228734829UL, 577956164UL, 2078807284UL, 1005987081UL, 2678967510UL, 112604551UL, +3865074232UL, 3776350052UL, 1112767766UL, 626049886UL, 910887552UL, 4127297396UL, 851240323UL, 3136588838UL, 2142891352UL, 1154068086UL, 639126620UL, 2501600773UL, 3174842042UL, 3342870442UL, 80596481UL, 126970446UL, 2184239961UL, 1448001095UL, 3399719246UL, 1087028487UL, 2905348107UL, 2502009404UL, 2156595397UL, 14860817UL, 2201723284UL, 3908202640UL, 754508313UL, 2321393187UL, 90540547UL, 2575809693UL, 4172462501UL, 2322897687UL, +1899992264UL, 56239065UL, 3575249683UL, 2939319477UL, 901605762UL, 676398674UL, 412461711UL, 2992300101UL, 1513271778UL, 2797164148UL, 1914019034UL, 3660190396UL, 2739211008UL, 1954453463UL, 3279391005UL, 2899313529UL, 4193503742UL, 1291505093UL, 2884603001UL, 564097935UL, 3552741248UL, 2124229268UL, 1263126330UL, 860214490UL, 2168366043UL, 2681035029UL, 4086980935UL, 2902522885UL, 554804421UL, 1571065517UL, 3322453053UL, 1821678887UL, +126415290UL, 980853251UL, 1531963815UL, 3237470129UL, 2099629264UL, 2031491001UL, 2205009469UL, 1046577915UL, 828927962UL, 3447807375UL, 1090142292UL, 1667375106UL, 2522840205UL, 4047872402UL, 2255362927UL, 91588630UL, 3122782857UL, 929883614UL, 694999008UL, 4135967848UL, 1246663706UL, 3500613893UL, 4200173807UL, 186199942UL, 4182379872UL, 229752655UL, 1011692880UL, 2791828564UL, 2677625011UL, 397062412UL, 1754509337UL, 2321492983UL, +3512328605UL, 1294405891UL, 1028843071UL, 434175992UL, 3155484007UL, 2306406482UL, 3197931140UL, 3217107401UL, 1521633702UL, 2366802562UL, 399245037UL, 2833224222UL, 76017436UL, 3231711673UL, 3784114896UL, 1927919696UL, 783802899UL, 2157090897UL, 2278711709UL, 3001078924UL, 1223320630UL, 3246830042UL, 1197195551UL, 4062534962UL, 1039971013UL, 2342241593UL, 3551623946UL, 63853850UL, 3585779636UL, 81127429UL, 3549929990UL, 2886997195UL, +1335910186UL, 4169018554UL, 1671155UL, 472949658UL, 148656515UL, 3600963048UL, 3772042754UL, 1601854390UL, 471598090UL, 2013359012UL, 1181513377UL, 321630853UL, 736452516UL, 100585026UL, 1154373750UL, 2323956092UL, 1926754199UL, 192349301UL, 3804215437UL, 909027311UL, 2993842723UL, 1138131968UL, 1319305666UL, 3858990362UL, 3155018279UL, 2288945270UL, 2489094664UL, 228734829UL, 577956164UL, 2078807284UL, 1924581773UL, 2678967510UL, +112604551UL, 3865074232UL, 3776350052UL, 2127459222UL, 626049886UL, 910887552UL, 4127297396UL, 851240323UL, 547797457UL, 2142891352UL, 1154068086UL, 639126620UL, 2501600773UL, 2391654498UL, 3342870442UL, 80596481UL, 126970446UL, 2184239961UL, 824575673UL, 3399719246UL, 1087028487UL, 2905348107UL, 2502009404UL, 740197255UL, 14860817UL, 2201723284UL, 3908202640UL, 754508313UL, 4133980283UL, 90540547UL, 2575809693UL, 4172462501UL, +2322897687UL, 831222037UL, 56239065UL, 3575249683UL, 2939319477UL, 901605762UL, 1998632674UL, 412461711UL, 2992300101UL, 1513271778UL, 2797164148UL, 969149327UL, 3660190396UL, 2739211008UL, 1954453463UL, 3279391005UL, 1267183547UL, 4193503742UL, 1291505093UL, 2884603001UL, 564097935UL, 3378471970UL, 2124229268UL, 1263126330UL, 860214490UL, 2168366043UL, 867190357UL, 4086980935UL, 2902522885UL, 554804421UL, 1571065517UL, 497580674UL, +1821678887UL, 126415290UL, 980853251UL, 1531963815UL, 2259090956UL, 2099629264UL, 2031491001UL, 2205009469UL, 1046577915UL, 30458798UL, 3447807375UL, 1090142292UL, 1667375106UL, 2522840205UL, 748518306UL, 2255362927UL, 91588630UL, 3122782857UL, 929883614UL, 1016302700UL, 4135967848UL, 1246663706UL, 3500613893UL, 4200173807UL, 4149573092UL, 4182379872UL, 229752655UL, 1011692880UL, 2791828564UL, 2890696349UL, 397062412UL, 1754509337UL, +2321492983UL, 3512328605UL, 3005148093UL, 1028843071UL, 434175992UL, 3155484007UL, 2306406482UL, 1417194283UL, 3217107401UL, 1521633702UL, 2366802562UL, 399245037UL, 665389310UL, 76017436UL, 3231711673UL, 3784114896UL, 1927919696UL, 37004463UL, 2157090897UL, 2278711709UL, 3001078924UL, 1223320630UL, 1281902891UL, 1197195551UL, 4062534962UL, 1039971013UL, 2342241593UL, 836721481UL, 63853850UL, 3585779636UL, 81127429UL, 3549929990UL, +2541553478UL, 1335910186UL, 4169018554UL, 1671155UL, 472949658UL, 2086411677UL, 3600963048UL, 3772042754UL, 1601854390UL, 471598090UL, 3297781744UL, 1181513377UL, 321630853UL, 736452516UL, 100585026UL, 2296508711UL, 2323956092UL, 1926754199UL, 192349301UL, 3804215437UL, 314399580UL, 2993842723UL, 1138131968UL, 1319305666UL, 3858990362UL, 584746730UL, 2288945270UL, 2489094664UL, 228734829UL, 577956164UL, 3868048239UL, 1924581773UL, +2678967510UL, 112604551UL, 3865074232UL, 2091950990UL, 2127459222UL, 626049886UL, 910887552UL, 4127297396UL, 2494071916UL, 547797457UL, 2142891352UL, 1154068086UL, 639126620UL, 1159991153UL, 2391654498UL, 3342870442UL, 80596481UL, 126970446UL, 2276453681UL, 824575673UL, 3399719246UL, 1087028487UL, 2905348107UL, 874278393UL, 740197255UL, 14860817UL, 2201723284UL, 3908202640UL, 1189317351UL, 4133980283UL, 90540547UL, 2575809693UL, +4172462501UL, 746169572UL, 831222037UL, 56239065UL, 3575249683UL, 2939319477UL, 4148988439UL, 1998632674UL, 412461711UL, 2992300101UL, 1513271778UL, 1078781767UL, 969149327UL, 3660190396UL, 2739211008UL, 1954453463UL, 369522045UL, 1267183547UL, 4193503742UL, 1291505093UL, 2884603001UL, 2820350438UL, 3378471970UL, 2124229268UL, 1263126330UL, 860214490UL, 793306335UL, 867190357UL, 4086980935UL, 2902522885UL, 554804421UL, 1472297125UL, +497580674UL, 1821678887UL, 126415290UL, 980853251UL, 1628231485UL, 2259090956UL, 2099629264UL, 2031491001UL, 2205009469UL, 2562996945UL, 30458798UL, 3447807375UL, 1090142292UL, 1667375106UL, 3513508401UL, 748518306UL, 2255362927UL, 91588630UL, 3122782857UL, 435869165UL, 1016302700UL, 4135967848UL, 1246663706UL, 3500613893UL, 4156110437UL, 4149573092UL, 4182379872UL, 229752655UL, 1011692880UL, 1150278253UL, 2890696349UL, 397062412UL, +1754509337UL, 2321492983UL, 1126835971UL, 3005148093UL, 1028843071UL, 434175992UL, 3155484007UL, 4169948411UL, 1417194283UL, 3217107401UL, 1521633702UL, 2366802562UL, 1629830655UL, 665389310UL, 76017436UL, 3231711673UL, 3784114896UL, 2523153991UL, 37004463UL, 2157090897UL, 2278711709UL, 3001078924UL, 3770048208UL, 1281902891UL, 1197195551UL, 4062534962UL, 1039971013UL, 2710590100UL, 836721481UL, 63853850UL, 3585779636UL, 81127429UL, +3850118466UL, 1883009417UL, 1027645619UL, 2766570701UL, 529436174UL, 4182542040UL, 2027954186UL, 1551970336UL, 2476537298UL, 1601343216UL, 3847258834UL, 14764974UL, 2173280370UL, 4148127270UL, 2818930089UL, 4238274314UL, 1291010651UL, 276452076UL, 192067464UL, 4086351393UL, 37573517UL, 48008720UL, 1641547972UL, 3144774960UL, 2159884108UL, 4260412239UL, 4072883650UL, 801704944UL, 2475958420UL, 2719220408UL, 555871884UL, 3338968445UL, +1704817873UL, 1960791083UL, 3785650808UL, 948722806UL, 3591229899UL, 1776225011UL, 4086658524UL, 2675451845UL, 308053697UL, 3514232055UL, 2575301108UL, 1970226110UL, 3926325352UL, 770275431UL, 1432667716UL, 671201644UL, 1008866625UL, 1151827040UL, 11061406UL, 3492749345UL, 2398090284UL, 2479688660UL, 2275263177UL, 2452696627UL, 3239880878UL, 3206200433UL, 1520851097UL, 1517432473UL, 1468198490UL, 1756343506UL, 2477348626UL, 3684701600UL, +3173720911UL, 1034531154UL, 4092116810UL, 3546516359UL, 2085136160UL, 643024588UL, 1462240654UL, 1877398196UL, 3615581878UL, 1419408410UL, 3581360976UL, 1731324772UL, 1377343320UL, 3848152825UL, 2213533588UL, 2484549569UL, 2043594863UL, 224490427UL, 1298974897UL, 4279011954UL, 3970331393UL, 3795364604UL, 285230552UL, 2893090686UL, 2399312639UL, 2638905215UL, 3481427245UL, 3477537504UL, 2609821731UL, 867675919UL, 3395750357UL, 1969593211UL, +2390932014UL, 3164333009UL, 3032345429UL, 3054196992UL, 1655295657UL, 193598641UL, 1267960637UL, 1599091894UL, 3377410805UL, 1529073346UL, 1949183620UL, 1575927573UL, 1493246650UL, 2285478895UL, 797817618UL, 1736047766UL, 1537439339UL, 1422940895UL, 2210817855UL, 2888194544UL, 800138109UL, 1689425315UL, 87966703UL, 3800446188UL, 137301285UL, 3334431104UL, 1776710491UL, 4010349050UL, 2577018472UL, 3083459223UL, 672158271UL, 3379478560UL, +2445459713UL, 918903140UL, 2577376693UL, 273150303UL, 2300393435UL, 3529750006UL, 3941920515UL, 2590879584UL, 2005940914UL, 2533952036UL, 2918638361UL, 1907638097UL, 959011520UL, 1477207871UL, 2141548481UL, 2065858781UL, 3145892196UL, 3679867589UL, 1295127682UL, 1325838381UL, 3482593404UL, 1212565985UL, 3404887017UL, 709111097UL, 1714185234UL, 561489165UL, 3545430079UL, 359778601UL, 3034684349UL, 2235482356UL, 2263913966UL, 1397371482UL, +}, +{ +170295791UL, 2753410803UL, 2200994594UL, 14686027UL, 3460333923UL, 1523230564UL, 393272614UL, 1632665034UL, 2139771608UL, 2436912103UL, 375335282UL, 667585308UL, 3651645415UL, 1403132103UL, 4146144245UL, 786890392UL, 1349234364UL, 1278024517UL, 84921263UL, 3758850381UL, 4213552796UL, 2355655048UL, 1636349912UL, 172797504UL, 2490691729UL, 1233059003UL, 2593048824UL, 942056581UL, 953415060UL, 4250104075UL, 787552244UL, 1995239637UL, +2482815609UL, 767530774UL, 773778243UL, 841396894UL, 2718419035UL, 3363828032UL, 737774143UL, 4128182656UL, 2335090807UL, 1421795969UL, 2322011430UL, 2808330380UL, 2207840656UL, 1646731611UL, 492284258UL, 2339383764UL, 3439685708UL, 2316859204UL, 4055048437UL, 1700143892UL, 2980557654UL, 1353917552UL, 548777318UL, 1077538998UL, 2650679367UL, 2853583947UL, 2721899692UL, 4253535213UL, 3375043688UL, 3489699354UL, 2401362855UL, 3391605246UL, +914273272UL, 3060460082UL, 1409014396UL, 3313834796UL, 461914731UL, 82334736UL, 3200344474UL, 2743316601UL, 842885927UL, 613943741UL, 96056919UL, 3116963503UL, 305659983UL, 132158360UL, 239064402UL, 849530381UL, 543215927UL, 4250983939UL, 2719881954UL, 1950301886UL, 2760008207UL, 853237881UL, 3875675156UL, 1753566841UL, 1446648300UL, 1663885236UL, 2155720472UL, 1902508987UL, 4246118829UL, 383661834UL, 2420221467UL, 156828838UL, +2919782856UL, 499968148UL, 2538550321UL, 65231340UL, 1589837081UL, 3654438263UL, 467304037UL, 1000159563UL, 622643461UL, 1410713407UL, 491953742UL, 1003597552UL, 1972701846UL, 1534343952UL, 1934888620UL, 4214562113UL, 4154375443UL, 3612899079UL, 2132948514UL, 2599819225UL, 2676649952UL, 3147375990UL, 533258319UL, 3323553423UL, 4203909276UL, 668602384UL, 3979162921UL, 2360530772UL, 162121513UL, 8968884UL, 3647746035UL, 2830313226UL, +1736955603UL, 78142012UL, 1643270604UL, 1571637938UL, 4065571991UL, 2071640825UL, 2715113082UL, 3826814783UL, 1067370024UL, 1810581550UL, 2354204343UL, 3798962263UL, 1664654967UL, 3740539785UL, 3746164996UL, 4280983219UL, 3313400832UL, 3305556349UL, 4226011346UL, 839676594UL, 1785445494UL, 1248107478UL, 904240268UL, 3484988721UL, 2290931247UL, 2109493967UL, 3895901626UL, 1494555863UL, 3251796061UL, 40877237UL, 2914051470UL, 2810210896UL, +1428826975UL, 170295791UL, 2753410803UL, 2200994594UL, 14686027UL, 3263438011UL, 1523230564UL, 393272614UL, 1632665034UL, 2139771608UL, 1847095655UL, 375335282UL, 667585308UL, 3651645415UL, 1403132103UL, 1888152231UL, 786890392UL, 1349234364UL, 1278024517UL, 84921263UL, 317409190UL, 4213552796UL, 2355655048UL, 1636349912UL, 172797504UL, 891435579UL, 1233059003UL, 2593048824UL, 942056581UL, 953415060UL, 1606837225UL, 787552244UL, +1995239637UL, 2482815609UL, 767530774UL, 723338833UL, 841396894UL, 2718419035UL, 3363828032UL, 737774143UL, 1043554448UL, 2335090807UL, 1421795969UL, 2322011430UL, 2808330380UL, 2754923978UL, 1646731611UL, 492284258UL, 2339383764UL, 3439685708UL, 3985616488UL, 4055048437UL, 1700143892UL, 2980557654UL, 1353917552UL, 588678041UL, 1077538998UL, 2650679367UL, 2853583947UL, 2721899692UL, 992549416UL, 3375043688UL, 3489699354UL, 2401362855UL, +3391605246UL, 2111206241UL, 3060460082UL, 1409014396UL, 3313834796UL, 461914731UL, 749987143UL, 3200344474UL, 2743316601UL, 842885927UL, 613943741UL, 1572013294UL, 3116963503UL, 305659983UL, 132158360UL, 239064402UL, 2802105766UL, 543215927UL, 4250983939UL, 2719881954UL, 1950301886UL, 1025784309UL, 853237881UL, 3875675156UL, 1753566841UL, 1446648300UL, 2265992307UL, 2155720472UL, 1902508987UL, 4246118829UL, 383661834UL, 1291267638UL, +156828838UL, 2919782856UL, 499968148UL, 2538550321UL, 2108151330UL, 1589837081UL, 3654438263UL, 467304037UL, 1000159563UL, 611554173UL, 1410713407UL, 491953742UL, 1003597552UL, 1972701846UL, 1548061756UL, 1934888620UL, 4214562113UL, 4154375443UL, 3612899079UL, 3599839935UL, 2599819225UL, 2676649952UL, 3147375990UL, 533258319UL, 4213499273UL, 4203909276UL, 668602384UL, 3979162921UL, 2360530772UL, 197252548UL, 8968884UL, 3647746035UL, +2830313226UL, 1736955603UL, 791687787UL, 1643270604UL, 1571637938UL, 4065571991UL, 2071640825UL, 2026290282UL, 3826814783UL, 1067370024UL, 1810581550UL, 2354204343UL, 2679791787UL, 1664654967UL, 3740539785UL, 3746164996UL, 4280983219UL, 1690075221UL, 3305556349UL, 4226011346UL, 839676594UL, 1785445494UL, 935893161UL, 904240268UL, 3484988721UL, 2290931247UL, 2109493967UL, 1497667362UL, 1494555863UL, 3251796061UL, 40877237UL, 2914051470UL, +1936503212UL, 1428826975UL, 170295791UL, 2753410803UL, 2200994594UL, 3416506072UL, 3263438011UL, 1523230564UL, 393272614UL, 1632665034UL, 3223475136UL, 1847095655UL, 375335282UL, 667585308UL, 3651645415UL, 1628711405UL, 1888152231UL, 786890392UL, 1349234364UL, 1278024517UL, 3955811679UL, 317409190UL, 4213552796UL, 2355655048UL, 1636349912UL, 2875036620UL, 891435579UL, 1233059003UL, 2593048824UL, 942056581UL, 2852399035UL, 1606837225UL, +787552244UL, 1995239637UL, 2482815609UL, 3849697041UL, 723338833UL, 841396894UL, 2718419035UL, 3363828032UL, 2914796626UL, 1043554448UL, 2335090807UL, 1421795969UL, 2322011430UL, 1088985845UL, 2754923978UL, 1646731611UL, 492284258UL, 2339383764UL, 2345741058UL, 3985616488UL, 4055048437UL, 1700143892UL, 2980557654UL, 3047950756UL, 588678041UL, 1077538998UL, 2650679367UL, 2853583947UL, 1902113580UL, 992549416UL, 3375043688UL, 3489699354UL, +2401362855UL, 2822431025UL, 2111206241UL, 3060460082UL, 1409014396UL, 3313834796UL, 3661696135UL, 749987143UL, 3200344474UL, 2743316601UL, 842885927UL, 3902266797UL, 1572013294UL, 3116963503UL, 305659983UL, 132158360UL, 2399116869UL, 2802105766UL, 543215927UL, 4250983939UL, 2719881954UL, 1909593430UL, 1025784309UL, 853237881UL, 3875675156UL, 1753566841UL, 315928539UL, 2265992307UL, 2155720472UL, 1902508987UL, 4246118829UL, 4054781820UL, +1291267638UL, 156828838UL, 2919782856UL, 499968148UL, 2746436642UL, 2108151330UL, 1589837081UL, 3654438263UL, 467304037UL, 2376244866UL, 611554173UL, 1410713407UL, 491953742UL, 1003597552UL, 961109680UL, 1548061756UL, 1934888620UL, 4214562113UL, 4154375443UL, 3318608531UL, 3599839935UL, 2599819225UL, 2676649952UL, 3147375990UL, 3197943734UL, 4213499273UL, 4203909276UL, 668602384UL, 3979162921UL, 4241359084UL, 197252548UL, 8968884UL, +3647746035UL, 2830313226UL, 2057817762UL, 791687787UL, 1643270604UL, 1571637938UL, 4065571991UL, 961587641UL, 2026290282UL, 3826814783UL, 1067370024UL, 1810581550UL, 1525669339UL, 2679791787UL, 1664654967UL, 3740539785UL, 3746164996UL, 3971185743UL, 1690075221UL, 3305556349UL, 4226011346UL, 839676594UL, 4017546432UL, 935893161UL, 904240268UL, 3484988721UL, 2290931247UL, 2887434676UL, 1497667362UL, 1494555863UL, 3251796061UL, 40877237UL, +675451622UL, 1936503212UL, 1428826975UL, 170295791UL, 2753410803UL, 13691728UL, 3416506072UL, 3263438011UL, 1523230564UL, 393272614UL, 2875584734UL, 3223475136UL, 1847095655UL, 375335282UL, 667585308UL, 192306502UL, 1628711405UL, 1888152231UL, 786890392UL, 1349234364UL, 511851370UL, 3955811679UL, 317409190UL, 4213552796UL, 2355655048UL, 131052067UL, 2875036620UL, 891435579UL, 1233059003UL, 2593048824UL, 2915307792UL, 2852399035UL, +1606837225UL, 787552244UL, 1995239637UL, 886016481UL, 3849697041UL, 723338833UL, 841396894UL, 2718419035UL, 1765948302UL, 2914796626UL, 1043554448UL, 2335090807UL, 1421795969UL, 4270899906UL, 1088985845UL, 2754923978UL, 1646731611UL, 492284258UL, 1723935335UL, 2345741058UL, 3985616488UL, 4055048437UL, 1700143892UL, 2254566160UL, 3047950756UL, 588678041UL, 1077538998UL, 2650679367UL, 1004539894UL, 1902113580UL, 992549416UL, 3375043688UL, +3489699354UL, 2030140735UL, 2822431025UL, 2111206241UL, 3060460082UL, 1409014396UL, 3053214877UL, 3661696135UL, 749987143UL, 3200344474UL, 2743316601UL, 398855857UL, 3902266797UL, 1572013294UL, 3116963503UL, 305659983UL, 1626072332UL, 2399116869UL, 2802105766UL, 543215927UL, 4250983939UL, 1149058742UL, 1909593430UL, 1025784309UL, 853237881UL, 3875675156UL, 2709854504UL, 315928539UL, 2265992307UL, 2155720472UL, 1902508987UL, 4065691077UL, +4054781820UL, 1291267638UL, 156828838UL, 2919782856UL, 1004764391UL, 2746436642UL, 2108151330UL, 1589837081UL, 3654438263UL, 2380382984UL, 2376244866UL, 611554173UL, 1410713407UL, 491953742UL, 3149407591UL, 961109680UL, 1548061756UL, 1934888620UL, 4214562113UL, 1555853416UL, 3318608531UL, 3599839935UL, 2599819225UL, 2676649952UL, 1902647993UL, 3197943734UL, 4213499273UL, 4203909276UL, 668602384UL, 2188341510UL, 4241359084UL, 197252548UL, +8968884UL, 3647746035UL, 629654524UL, 2057817762UL, 791687787UL, 1643270604UL, 1571637938UL, 3066487639UL, 961587641UL, 2026290282UL, 3826814783UL, 1067370024UL, 2223613942UL, 1525669339UL, 2679791787UL, 1664654967UL, 3740539785UL, 3902060288UL, 3971185743UL, 1690075221UL, 3305556349UL, 4226011346UL, 3135081672UL, 4017546432UL, 935893161UL, 904240268UL, 3484988721UL, 2448752416UL, 2887434676UL, 1497667362UL, 1494555863UL, 3251796061UL, +1037186927UL, 1608759110UL, 3873834254UL, 59242551UL, 487334743UL, 2580513180UL, 3704829028UL, 3859157573UL, 3452402004UL, 783668920UL, 2394905786UL, 3179497902UL, 2576105629UL, 1552362163UL, 2138613992UL, 224944469UL, 3876873579UL, 3402518289UL, 1709606949UL, 4255868112UL, 1249055439UL, 3395879908UL, 2957760102UL, 346905231UL, 590629983UL, 1171021480UL, 4051081465UL, 3913643946UL, 3115845768UL, 1021908139UL, 2556028362UL, 3828177651UL, +2870156105UL, 899722025UL, 661756192UL, 3775551864UL, 1288569751UL, 3751947667UL, 3064664685UL, 2559273148UL, 2660772417UL, 2448044253UL, 3054357327UL, 3434913868UL, 1444728572UL, 3010819186UL, 3010362527UL, 1709131033UL, 3425689752UL, 2849921358UL, 3518017065UL, 3845809665UL, 3245724553UL, 1008739837UL, 3274032925UL, 2567688974UL, 1981389077UL, 1108638127UL, 470206543UL, 1097339633UL, 1714430226UL, 2321268672UL, 1149373331UL, 294569671UL, +4264586290UL, 4270574127UL, 2522456947UL, 230975563UL, 131504269UL, 541738544UL, 1380704847UL, 2946408074UL, 282744860UL, 246858261UL, 2037373985UL, 1769191691UL, 2174871838UL, 2097427065UL, 492251656UL, 1252290304UL, 3616248100UL, 3213248383UL, 1847973756UL, 647347869UL, 3015847616UL, 299045987UL, 866593289UL, 2009367463UL, 2448831631UL, 337965200UL, 1210654808UL, 1694878225UL, 853507918UL, 3373825966UL, 4262812941UL, 4279525028UL, +338822858UL, 1038097567UL, 3996799911UL, 755960212UL, 149304151UL, 1599868486UL, 4021605447UL, 3040297322UL, 3891899828UL, 1711866076UL, 900840696UL, 3675688669UL, 3070862438UL, 2611308185UL, 2359948129UL, 1158552196UL, 2094484627UL, 3077606843UL, 2119537593UL, 427023787UL, 3632076073UL, 2670551310UL, 3396099733UL, 1066081183UL, 1817788918UL, 324769315UL, 656687887UL, 202117575UL, 3106428593UL, 3730407212UL, 1661316263UL, 1215084998UL, +2025391552UL, 664352483UL, 1914686594UL, 9439399UL, 2548190484UL, 3127972014UL, 4008228378UL, 2645735658UL, 2191361716UL, 2211450148UL, 1863406291UL, 1179298131UL, 241880428UL, 2330159770UL, 3490494273UL, 1337382890UL, 747522461UL, 1060348557UL, 3618051469UL, 991193538UL, 1604905367UL, 2595102954UL, 1460144089UL, 3990194961UL, 44265425UL, 896268152UL, 9333748UL, 2850675977UL, 941433385UL, 2483544989UL, 3443750079UL, 2488690792UL, +}, +{ +824297644UL, 239464654UL, 4133652405UL, 1611614045UL, 102133367UL, 1780659362UL, 114934718UL, 3793050817UL, 3286619856UL, 1323742990UL, 3487325492UL, 468742651UL, 271433491UL, 3474195023UL, 479173886UL, 3282693508UL, 978269731UL, 1826990521UL, 3664994445UL, 1943608646UL, 2356793330UL, 2228748670UL, 4238523810UL, 2467714013UL, 1732683390UL, 2345218001UL, 3371637369UL, 1073602848UL, 844797255UL, 3881048480UL, 509186599UL, 1399427071UL, +3815270778UL, 1505666412UL, 2616384981UL, 2990167853UL, 3716581225UL, 3063486812UL, 1568307898UL, 3262882991UL, 1455926070UL, 3011806226UL, 3803364927UL, 849372289UL, 2382885729UL, 3071102985UL, 3838244574UL, 3219174218UL, 847830757UL, 1414310383UL, 3679389549UL, 1558413907UL, 2211822428UL, 339810803UL, 1051648907UL, 76928699UL, 3174194320UL, 3920525151UL, 2010088097UL, 4111092791UL, 3537133983UL, 1701410561UL, 3036563175UL, 4010986440UL, +1749862952UL, 159833659UL, 3406940095UL, 1041601178UL, 4005001553UL, 1663515026UL, 1728511107UL, 1496728329UL, 2359970426UL, 530862749UL, 3797637507UL, 2550923758UL, 1450321218UL, 21682904UL, 936804838UL, 3832989199UL, 3063256293UL, 3991708711UL, 986539283UL, 3775232150UL, 2867283706UL, 747477232UL, 946349345UL, 1010022077UL, 188204104UL, 2526787171UL, 2816843760UL, 1776005940UL, 2819738500UL, 1155856699UL, 2191793692UL, 3802193350UL, +1163036922UL, 645032560UL, 3122679267UL, 3311719932UL, 3757073707UL, 2464258247UL, 1360425558UL, 387981241UL, 1714916540UL, 411019237UL, 2248466094UL, 2878213113UL, 2742600760UL, 2763650927UL, 2526526309UL, 1093836264UL, 3819986000UL, 3754388150UL, 1731831799UL, 1441137152UL, 1625850961UL, 1182084155UL, 1596226376UL, 2389499892UL, 3923360808UL, 2439159233UL, 1623373213UL, 2513747479UL, 3651587995UL, 1040867254UL, 4208484711UL, 3489019765UL, +2141904813UL, 3666280633UL, 970464748UL, 2970978888UL, 1376163015UL, 1218588624UL, 2721249823UL, 707915046UL, 4262557484UL, 3237019195UL, 744279211UL, 364567144UL, 1997174860UL, 3215512870UL, 2758022574UL, 2677818352UL, 4198422061UL, 3016017869UL, 2243997977UL, 1029293722UL, 1820056287UL, 1090825999UL, 4135403724UL, 299239527UL, 874620372UL, 2995368704UL, 3219627293UL, 2431393692UL, 3470601754UL, 1809177571UL, 37446335UL, 1619184385UL, +675901368UL, 824297644UL, 239464654UL, 4133652405UL, 1611614045UL, 1918718045UL, 1780659362UL, 114934718UL, 3793050817UL, 3286619856UL, 3566342809UL, 3487325492UL, 468742651UL, 271433491UL, 3474195023UL, 77797025UL, 3282693508UL, 978269731UL, 1826990521UL, 3664994445UL, 1455182612UL, 2356793330UL, 2228748670UL, 4238523810UL, 2467714013UL, 1081984526UL, 2345218001UL, 3371637369UL, 1073602848UL, 844797255UL, 4125413817UL, 509186599UL, +1399427071UL, 3815270778UL, 1505666412UL, 891823593UL, 2990167853UL, 3716581225UL, 3063486812UL, 1568307898UL, 1753181930UL, 1455926070UL, 3011806226UL, 3803364927UL, 849372289UL, 4211525266UL, 3071102985UL, 3838244574UL, 3219174218UL, 847830757UL, 774013898UL, 3679389549UL, 1558413907UL, 2211822428UL, 339810803UL, 2282783575UL, 76928699UL, 3174194320UL, 3920525151UL, 2010088097UL, 3894905215UL, 3537133983UL, 1701410561UL, 3036563175UL, +4010986440UL, 676262036UL, 159833659UL, 3406940095UL, 1041601178UL, 4005001553UL, 3470687799UL, 1728511107UL, 1496728329UL, 2359970426UL, 530862749UL, 3081565689UL, 2550923758UL, 1450321218UL, 21682904UL, 936804838UL, 951873872UL, 3063256293UL, 3991708711UL, 986539283UL, 3775232150UL, 487381835UL, 747477232UL, 946349345UL, 1010022077UL, 188204104UL, 2898848241UL, 2816843760UL, 1776005940UL, 2819738500UL, 1155856699UL, 2432683643UL, +3802193350UL, 1163036922UL, 645032560UL, 3122679267UL, 22749078UL, 3757073707UL, 2464258247UL, 1360425558UL, 387981241UL, 3652130062UL, 411019237UL, 2248466094UL, 2878213113UL, 2742600760UL, 811608089UL, 2526526309UL, 1093836264UL, 3819986000UL, 3754388150UL, 415809552UL, 1441137152UL, 1625850961UL, 1182084155UL, 1596226376UL, 202609936UL, 3923360808UL, 2439159233UL, 1623373213UL, 2513747479UL, 4149563237UL, 1040867254UL, 4208484711UL, +3489019765UL, 2141904813UL, 718806958UL, 970464748UL, 2970978888UL, 1376163015UL, 1218588624UL, 2307367700UL, 707915046UL, 4262557484UL, 3237019195UL, 744279211UL, 1876395939UL, 1997174860UL, 3215512870UL, 2758022574UL, 2677818352UL, 2276158677UL, 3016017869UL, 2243997977UL, 1029293722UL, 1820056287UL, 3605618012UL, 4135403724UL, 299239527UL, 874620372UL, 2995368704UL, 872126519UL, 2431393692UL, 3470601754UL, 1809177571UL, 37446335UL, +2365355125UL, 675901368UL, 824297644UL, 239464654UL, 4133652405UL, 8139161UL, 1918718045UL, 1780659362UL, 114934718UL, 3793050817UL, 2424418256UL, 3566342809UL, 3487325492UL, 468742651UL, 271433491UL, 542129690UL, 77797025UL, 3282693508UL, 978269731UL, 1826990521UL, 2963435579UL, 1455182612UL, 2356793330UL, 2228748670UL, 4238523810UL, 2373300657UL, 1081984526UL, 2345218001UL, 3371637369UL, 1073602848UL, 2948610237UL, 4125413817UL, +509186599UL, 1399427071UL, 3815270778UL, 2870251133UL, 891823593UL, 2990167853UL, 3716581225UL, 3063486812UL, 2347504584UL, 1753181930UL, 1455926070UL, 3011806226UL, 3803364927UL, 3956554065UL, 4211525266UL, 3071102985UL, 3838244574UL, 3219174218UL, 2018597841UL, 774013898UL, 3679389549UL, 1558413907UL, 2211822428UL, 56072605UL, 2282783575UL, 76928699UL, 3174194320UL, 3920525151UL, 268031035UL, 3894905215UL, 3537133983UL, 1701410561UL, +3036563175UL, 366935627UL, 676262036UL, 159833659UL, 3406940095UL, 1041601178UL, 4125224603UL, 3470687799UL, 1728511107UL, 1496728329UL, 2359970426UL, 3570997128UL, 3081565689UL, 2550923758UL, 1450321218UL, 21682904UL, 604517910UL, 951873872UL, 3063256293UL, 3991708711UL, 986539283UL, 2414780630UL, 487381835UL, 747477232UL, 946349345UL, 1010022077UL, 3820353604UL, 2898848241UL, 2816843760UL, 1776005940UL, 2819738500UL, 1192624235UL, +2432683643UL, 3802193350UL, 1163036922UL, 645032560UL, 4050277201UL, 22749078UL, 3757073707UL, 2464258247UL, 1360425558UL, 1933406988UL, 3652130062UL, 411019237UL, 2248466094UL, 2878213113UL, 37869698UL, 811608089UL, 2526526309UL, 1093836264UL, 3819986000UL, 3999750910UL, 415809552UL, 1441137152UL, 1625850961UL, 1182084155UL, 1186617400UL, 202609936UL, 3923360808UL, 2439159233UL, 1623373213UL, 4226729056UL, 4149563237UL, 1040867254UL, +4208484711UL, 3489019765UL, 3728140516UL, 718806958UL, 970464748UL, 2970978888UL, 1376163015UL, 1307011711UL, 2307367700UL, 707915046UL, 4262557484UL, 3237019195UL, 4014387080UL, 1876395939UL, 1997174860UL, 3215512870UL, 2758022574UL, 1696763772UL, 2276158677UL, 3016017869UL, 2243997977UL, 1029293722UL, 1444214949UL, 3605618012UL, 4135403724UL, 299239527UL, 874620372UL, 1524158085UL, 872126519UL, 2431393692UL, 3470601754UL, 1809177571UL, +163166369UL, 2365355125UL, 675901368UL, 824297644UL, 239464654UL, 1626558353UL, 8139161UL, 1918718045UL, 1780659362UL, 114934718UL, 1885224714UL, 2424418256UL, 3566342809UL, 3487325492UL, 468742651UL, 1101039917UL, 542129690UL, 77797025UL, 3282693508UL, 978269731UL, 3659653445UL, 2963435579UL, 1455182612UL, 2356793330UL, 2228748670UL, 539062188UL, 2373300657UL, 1081984526UL, 2345218001UL, 3371637369UL, 2825652803UL, 2948610237UL, +4125413817UL, 509186599UL, 1399427071UL, 3197034620UL, 2870251133UL, 891823593UL, 2990167853UL, 3716581225UL, 3773712182UL, 2347504584UL, 1753181930UL, 1455926070UL, 3011806226UL, 3260276773UL, 3956554065UL, 4211525266UL, 3071102985UL, 3838244574UL, 201639236UL, 2018597841UL, 774013898UL, 3679389549UL, 1558413907UL, 2830702673UL, 56072605UL, 2282783575UL, 76928699UL, 3174194320UL, 1677734845UL, 268031035UL, 3894905215UL, 3537133983UL, +1701410561UL, 4240866153UL, 366935627UL, 676262036UL, 159833659UL, 3406940095UL, 4245889153UL, 4125224603UL, 3470687799UL, 1728511107UL, 1496728329UL, 3650277906UL, 3570997128UL, 3081565689UL, 2550923758UL, 1450321218UL, 3392011930UL, 604517910UL, 951873872UL, 3063256293UL, 3991708711UL, 2876003834UL, 2414780630UL, 487381835UL, 747477232UL, 946349345UL, 982266944UL, 3820353604UL, 2898848241UL, 2816843760UL, 1776005940UL, 3677715064UL, +1192624235UL, 2432683643UL, 3802193350UL, 1163036922UL, 1226669337UL, 4050277201UL, 22749078UL, 3757073707UL, 2464258247UL, 4197532785UL, 1933406988UL, 3652130062UL, 411019237UL, 2248466094UL, 3209426720UL, 37869698UL, 811608089UL, 2526526309UL, 1093836264UL, 535856568UL, 3999750910UL, 415809552UL, 1441137152UL, 1625850961UL, 2181491119UL, 1186617400UL, 202609936UL, 3923360808UL, 2439159233UL, 1823827533UL, 4226729056UL, 4149563237UL, +1040867254UL, 4208484711UL, 1101917521UL, 3728140516UL, 718806958UL, 970464748UL, 2970978888UL, 1574663259UL, 1307011711UL, 2307367700UL, 707915046UL, 4262557484UL, 2164217930UL, 4014387080UL, 1876395939UL, 1997174860UL, 3215512870UL, 1335157953UL, 1696763772UL, 2276158677UL, 3016017869UL, 2243997977UL, 324788481UL, 1444214949UL, 3605618012UL, 4135403724UL, 299239527UL, 4190629945UL, 1524158085UL, 872126519UL, 2431393692UL, 3470601754UL, +3701018280UL, 671547257UL, 4029965023UL, 1026428282UL, 1584875796UL, 3537698406UL, 3731126476UL, 2419795330UL, 993551117UL, 2126319514UL, 3557113304UL, 1014047757UL, 1407120210UL, 1977537539UL, 1338958570UL, 3249585389UL, 3661503659UL, 4240815680UL, 1866933898UL, 3205442033UL, 4247144816UL, 1422846419UL, 3847421981UL, 1383632066UL, 3589322376UL, 1816906043UL, 1310944471UL, 3646822098UL, 799529013UL, 3350558751UL, 2552899295UL, 4281235599UL, +4069668296UL, 4123814877UL, 3289565353UL, 1512974699UL, 111908081UL, 2535556715UL, 333570815UL, 3638041929UL, 1942569446UL, 20945397UL, 3784826827UL, 200406456UL, 2640512138UL, 38390336UL, 436784052UL, 3062106345UL, 1675333627UL, 709613078UL, 3479720979UL, 2726065658UL, 4072312748UL, 797389139UL, 3492082903UL, 3792395750UL, 983473383UL, 2984788349UL, 2030282907UL, 2246686378UL, 2451087141UL, 1799640566UL, 2182694041UL, 3226819076UL, +3573153299UL, 3658670545UL, 1197013516UL, 777601408UL, 4271704548UL, 1192713934UL, 1628497069UL, 681025927UL, 4078910773UL, 619496169UL, 1534725146UL, 1881987408UL, 2283881479UL, 1090218673UL, 4169123978UL, 2352195985UL, 2640116078UL, 3869558100UL, 2859177954UL, 3329803656UL, 4048903941UL, 1636589748UL, 2095007175UL, 4169840880UL, 2953611537UL, 2413740464UL, 3029624235UL, 778662441UL, 422412779UL, 412103280UL, 1701569571UL, 564088645UL, +469973310UL, 254302146UL, 3963642101UL, 555781470UL, 2983576224UL, 1757897888UL, 1420763962UL, 2176323176UL, 916790568UL, 3057610889UL, 196828641UL, 1435167402UL, 325046353UL, 1337309066UL, 2691769282UL, 3572566918UL, 2910149226UL, 3659418019UL, 2511762503UL, 3869838339UL, 1413312151UL, 1939339596UL, 801124461UL, 760477862UL, 2416958233UL, 3439465675UL, 3561763524UL, 1760392811UL, 1582406751UL, 1203071257UL, 755811399UL, 2675585013UL, +1150664766UL, 3515765747UL, 3419135844UL, 2076543342UL, 1191918544UL, 3644819073UL, 2195875022UL, 2909071148UL, 3385707813UL, 1151273265UL, 1467337419UL, 3570589492UL, 3742049917UL, 1609858615UL, 2964509119UL, 3747960348UL, 2825858640UL, 101501715UL, 1234710482UL, 750428334UL, 2870070395UL, 416615350UL, 4054039387UL, 3807926874UL, 3035407103UL, 1644560291UL, 2490941295UL, 963796562UL, 3233132139UL, 2590859502UL, 2845243609UL, 964355909UL, +}, +{ +2882980002UL, 2211288683UL, 872766101UL, 3713771728UL, 1429983118UL, 2069599564UL, 827699420UL, 1288565883UL, 2985727214UL, 3873174741UL, 2138389854UL, 3915615927UL, 2759028650UL, 3120611541UL, 385953581UL, 189931252UL, 2044235060UL, 4214733958UL, 1899137741UL, 1973215178UL, 494148492UL, 1550568689UL, 3646957712UL, 3764784141UL, 1114556979UL, 1411407684UL, 1194906295UL, 1718808623UL, 1809627046UL, 1413570172UL, 180837718UL, 2588730975UL, +1481586714UL, 2836300053UL, 1967135375UL, 4010897189UL, 3392273121UL, 3466021198UL, 1182364160UL, 1364130321UL, 1795412556UL, 330320182UL, 1165093128UL, 2125767818UL, 904192995UL, 51833064UL, 232302906UL, 1834422179UL, 476731510UL, 3484170517UL, 2373156680UL, 2610500049UL, 1688364249UL, 463611489UL, 3759685710UL, 62038708UL, 2357334250UL, 1230002441UL, 520303451UL, 3009758047UL, 1882263827UL, 2524779298UL, 1736323157UL, 3883037541UL, +1103650182UL, 1137565179UL, 3112310886UL, 3524287283UL, 3064002681UL, 4106308847UL, 3180534967UL, 2463036338UL, 1859639515UL, 1319061987UL, 354419222UL, 4108171950UL, 601260554UL, 705389180UL, 4081137445UL, 3461353436UL, 399768111UL, 3963945521UL, 2094962544UL, 630762046UL, 369047181UL, 3495709267UL, 3525452874UL, 314919391UL, 2152657907UL, 881476500UL, 3565507827UL, 2594931381UL, 579458905UL, 1767988684UL, 2678728511UL, 3416503939UL, +4150612567UL, 1015748208UL, 2059142720UL, 2725183490UL, 2998421769UL, 1644667445UL, 4221112143UL, 456578131UL, 3881530201UL, 190710543UL, 1721255927UL, 2274887963UL, 187713135UL, 2209254952UL, 2185750138UL, 2992229399UL, 482133467UL, 2758198810UL, 15147949UL, 536333711UL, 2296185346UL, 1103433779UL, 1573407789UL, 1357843567UL, 2927153963UL, 4157295398UL, 533935893UL, 3567030810UL, 1900900411UL, 509578395UL, 3810017456UL, 2134110040UL, +3347323570UL, 3497032747UL, 201278263UL, 3933249682UL, 3849960474UL, 2509123202UL, 3445521167UL, 1355284593UL, 2444811561UL, 2751112324UL, 1116246614UL, 511213077UL, 3412599909UL, 1712118363UL, 54054007UL, 442729047UL, 3077267414UL, 1532701769UL, 181534938UL, 1278069867UL, 3847149992UL, 2305860479UL, 4146252420UL, 2047690303UL, 361856758UL, 452490341UL, 636885000UL, 1733216839UL, 3788548638UL, 1094285639UL, 1349356222UL, 2760444511UL, +976767752UL, 2882980002UL, 2211288683UL, 872766101UL, 3713771728UL, 895830110UL, 2069599564UL, 827699420UL, 1288565883UL, 2985727214UL, 3377496544UL, 2138389854UL, 3915615927UL, 2759028650UL, 3120611541UL, 3254971483UL, 189931252UL, 2044235060UL, 4214733958UL, 1899137741UL, 2095055586UL, 494148492UL, 1550568689UL, 3646957712UL, 3764784141UL, 2869825005UL, 1411407684UL, 1194906295UL, 1718808623UL, 1809627046UL, 907760376UL, 180837718UL, +2588730975UL, 1481586714UL, 2836300053UL, 639229964UL, 4010897189UL, 3392273121UL, 3466021198UL, 1182364160UL, 3006792787UL, 1795412556UL, 330320182UL, 1165093128UL, 2125767818UL, 253264555UL, 51833064UL, 232302906UL, 1834422179UL, 476731510UL, 4284481518UL, 2373156680UL, 2610500049UL, 1688364249UL, 463611489UL, 4133115610UL, 62038708UL, 2357334250UL, 1230002441UL, 520303451UL, 1497001150UL, 1882263827UL, 2524779298UL, 1736323157UL, +3883037541UL, 3541909847UL, 1137565179UL, 3112310886UL, 3524287283UL, 3064002681UL, 3193060438UL, 3180534967UL, 2463036338UL, 1859639515UL, 1319061987UL, 111871878UL, 4108171950UL, 601260554UL, 705389180UL, 4081137445UL, 742999102UL, 399768111UL, 3963945521UL, 2094962544UL, 630762046UL, 3219207950UL, 3495709267UL, 3525452874UL, 314919391UL, 2152657907UL, 720863934UL, 3565507827UL, 2594931381UL, 579458905UL, 1767988684UL, 3958525287UL, +3416503939UL, 4150612567UL, 1015748208UL, 2059142720UL, 4227838648UL, 2998421769UL, 1644667445UL, 4221112143UL, 456578131UL, 302729329UL, 190710543UL, 1721255927UL, 2274887963UL, 187713135UL, 1293706587UL, 2185750138UL, 2992229399UL, 482133467UL, 2758198810UL, 2514965671UL, 536333711UL, 2296185346UL, 1103433779UL, 1573407789UL, 2237639577UL, 2927153963UL, 4157295398UL, 533935893UL, 3567030810UL, 3793156627UL, 509578395UL, 3810017456UL, +2134110040UL, 3347323570UL, 1358364UL, 201278263UL, 3933249682UL, 3849960474UL, 2509123202UL, 628476542UL, 1355284593UL, 2444811561UL, 2751112324UL, 1116246614UL, 3421170828UL, 3412599909UL, 1712118363UL, 54054007UL, 442729047UL, 325825294UL, 1532701769UL, 181534938UL, 1278069867UL, 3847149992UL, 2785457372UL, 4146252420UL, 2047690303UL, 361856758UL, 452490341UL, 1099532083UL, 1733216839UL, 3788548638UL, 1094285639UL, 1349356222UL, +3047068265UL, 976767752UL, 2882980002UL, 2211288683UL, 872766101UL, 366378371UL, 895830110UL, 2069599564UL, 827699420UL, 1288565883UL, 962962884UL, 3377496544UL, 2138389854UL, 3915615927UL, 2759028650UL, 3742489931UL, 3254971483UL, 189931252UL, 2044235060UL, 4214733958UL, 3073407497UL, 2095055586UL, 494148492UL, 1550568689UL, 3646957712UL, 758370067UL, 2869825005UL, 1411407684UL, 1194906295UL, 1718808623UL, 636166267UL, 907760376UL, +180837718UL, 2588730975UL, 1481586714UL, 705382583UL, 639229964UL, 4010897189UL, 3392273121UL, 3466021198UL, 3815622040UL, 3006792787UL, 1795412556UL, 330320182UL, 1165093128UL, 2956382339UL, 253264555UL, 51833064UL, 232302906UL, 1834422179UL, 3665645898UL, 4284481518UL, 2373156680UL, 2610500049UL, 1688364249UL, 2565987890UL, 4133115610UL, 62038708UL, 2357334250UL, 1230002441UL, 2397198293UL, 1497001150UL, 1882263827UL, 2524779298UL, +1736323157UL, 817630445UL, 3541909847UL, 1137565179UL, 3112310886UL, 3524287283UL, 1356492703UL, 3193060438UL, 3180534967UL, 2463036338UL, 1859639515UL, 3963974342UL, 111871878UL, 4108171950UL, 601260554UL, 705389180UL, 1776439965UL, 742999102UL, 399768111UL, 3963945521UL, 2094962544UL, 2007137733UL, 3219207950UL, 3495709267UL, 3525452874UL, 314919391UL, 3877039785UL, 720863934UL, 3565507827UL, 2594931381UL, 579458905UL, 2919403199UL, +3958525287UL, 3416503939UL, 4150612567UL, 1015748208UL, 960765392UL, 4227838648UL, 2998421769UL, 1644667445UL, 4221112143UL, 2402062799UL, 302729329UL, 190710543UL, 1721255927UL, 2274887963UL, 3958481548UL, 1293706587UL, 2185750138UL, 2992229399UL, 482133467UL, 3838280UL, 2514965671UL, 536333711UL, 2296185346UL, 1103433779UL, 3675282065UL, 2237639577UL, 2927153963UL, 4157295398UL, 533935893UL, 4172021805UL, 3793156627UL, 509578395UL, +3810017456UL, 2134110040UL, 3608998517UL, 1358364UL, 201278263UL, 3933249682UL, 3849960474UL, 2445690023UL, 628476542UL, 1355284593UL, 2444811561UL, 2751112324UL, 507378026UL, 3421170828UL, 3412599909UL, 1712118363UL, 54054007UL, 770634305UL, 325825294UL, 1532701769UL, 181534938UL, 1278069867UL, 4055596097UL, 2785457372UL, 4146252420UL, 2047690303UL, 361856758UL, 3439427065UL, 1099532083UL, 1733216839UL, 3788548638UL, 1094285639UL, +1633234274UL, 3047068265UL, 976767752UL, 2882980002UL, 2211288683UL, 3763615153UL, 366378371UL, 895830110UL, 2069599564UL, 827699420UL, 2457443913UL, 962962884UL, 3377496544UL, 2138389854UL, 3915615927UL, 3290989016UL, 3742489931UL, 3254971483UL, 189931252UL, 2044235060UL, 4275822963UL, 3073407497UL, 2095055586UL, 494148492UL, 1550568689UL, 1043420085UL, 758370067UL, 2869825005UL, 1411407684UL, 1194906295UL, 676378812UL, 636166267UL, +907760376UL, 180837718UL, 2588730975UL, 2971715054UL, 705382583UL, 639229964UL, 4010897189UL, 3392273121UL, 795184546UL, 3815622040UL, 3006792787UL, 1795412556UL, 330320182UL, 1990804460UL, 2956382339UL, 253264555UL, 51833064UL, 232302906UL, 836875615UL, 3665645898UL, 4284481518UL, 2373156680UL, 2610500049UL, 98106795UL, 2565987890UL, 4133115610UL, 62038708UL, 2357334250UL, 2761212145UL, 2397198293UL, 1497001150UL, 1882263827UL, +2524779298UL, 2381031747UL, 817630445UL, 3541909847UL, 1137565179UL, 3112310886UL, 2501374726UL, 1356492703UL, 3193060438UL, 3180534967UL, 2463036338UL, 3671733096UL, 3963974342UL, 111871878UL, 4108171950UL, 601260554UL, 1017043724UL, 1776439965UL, 742999102UL, 399768111UL, 3963945521UL, 2177838102UL, 2007137733UL, 3219207950UL, 3495709267UL, 3525452874UL, 3254054416UL, 3877039785UL, 720863934UL, 3565507827UL, 2594931381UL, 1994293489UL, +2919403199UL, 3958525287UL, 3416503939UL, 4150612567UL, 1976960210UL, 960765392UL, 4227838648UL, 2998421769UL, 1644667445UL, 2896792687UL, 2402062799UL, 302729329UL, 190710543UL, 1721255927UL, 2914584080UL, 3958481548UL, 1293706587UL, 2185750138UL, 2992229399UL, 810756083UL, 3838280UL, 2514965671UL, 536333711UL, 2296185346UL, 1776509588UL, 3675282065UL, 2237639577UL, 2927153963UL, 4157295398UL, 2048779551UL, 4172021805UL, 3793156627UL, +509578395UL, 3810017456UL, 3042185034UL, 3608998517UL, 1358364UL, 201278263UL, 3933249682UL, 3551449718UL, 2445690023UL, 628476542UL, 1355284593UL, 2444811561UL, 3480611728UL, 507378026UL, 3421170828UL, 3412599909UL, 1712118363UL, 1268921331UL, 770634305UL, 325825294UL, 1532701769UL, 181534938UL, 2645357587UL, 4055596097UL, 2785457372UL, 4146252420UL, 2047690303UL, 1994855609UL, 3439427065UL, 1099532083UL, 1733216839UL, 3788548638UL, +3516588243UL, 4058132193UL, 3940172101UL, 4043964688UL, 3377150021UL, 1381463736UL, 3320280180UL, 931260821UL, 2754727582UL, 1286176949UL, 1661126244UL, 2301263887UL, 2255977851UL, 1122646603UL, 1767549201UL, 162324152UL, 425506096UL, 3777762686UL, 13687528UL, 710105607UL, 1092739920UL, 2930179533UL, 568855389UL, 2476208631UL, 964360978UL, 2011445117UL, 3887128674UL, 2799005525UL, 2479086439UL, 814368438UL, 2018629666UL, 909662384UL, +231589584UL, 1422241284UL, 4035938208UL, 3570985552UL, 660700421UL, 603857869UL, 567385627UL, 3232044670UL, 291307502UL, 947817625UL, 3466590280UL, 3080261993UL, 947835229UL, 2925888682UL, 1817591844UL, 2652420575UL, 4150903445UL, 4055627313UL, 1715025966UL, 505331227UL, 1863531052UL, 2928506098UL, 947547681UL, 1117344443UL, 781457023UL, 607542746UL, 241559360UL, 3797150797UL, 105381589UL, 361541961UL, 3393121650UL, 3840152184UL, +2873171161UL, 3030026082UL, 1115171192UL, 1718221281UL, 96787532UL, 2556617898UL, 1237726058UL, 2876298621UL, 1052881200UL, 461661595UL, 2632346030UL, 1775614319UL, 2454951319UL, 3691637824UL, 4018448825UL, 1610472965UL, 3076493165UL, 1364200430UL, 2011206580UL, 1066672050UL, 706141458UL, 2064189273UL, 346938484UL, 2964350202UL, 3731612957UL, 2506635528UL, 2007045393UL, 3312126930UL, 2602035453UL, 988876930UL, 2960173442UL, 559685520UL, +2719943441UL, 891699839UL, 1151651090UL, 1223301894UL, 3666960271UL, 1330825927UL, 1681770552UL, 38877327UL, 3803211467UL, 4000053051UL, 3552560459UL, 3510286057UL, 2606732870UL, 721190747UL, 1933504723UL, 3110735238UL, 2333178561UL, 1577381363UL, 595257962UL, 4120745072UL, 960219089UL, 2591080970UL, 3354222743UL, 47827627UL, 3759509914UL, 304815919UL, 2643673615UL, 1381570381UL, 2103367217UL, 2440936991UL, 2376721005UL, 1483630814UL, +3137202706UL, 3075255640UL, 1743649605UL, 3649754571UL, 2550788713UL, 4281983459UL, 904183710UL, 4243944530UL, 2742129811UL, 3363501626UL, 3670239155UL, 4233018118UL, 2615012385UL, 1420298161UL, 1251344091UL, 2172588631UL, 1243035186UL, 1724496237UL, 762022558UL, 8747231UL, 334416849UL, 1219880856UL, 187900356UL, 2527057367UL, 1730455958UL, 3240238410UL, 906024910UL, 2351575735UL, 4207748622UL, 936139767UL, 1984289988UL, 285939331UL, +}, +{ +4246897171UL, 2217508286UL, 4117450683UL, 4110626546UL, 3753823387UL, 3977667932UL, 623718443UL, 2276396692UL, 3772091798UL, 2272323453UL, 710314822UL, 3733316262UL, 1497955597UL, 700242668UL, 3582720207UL, 1247731879UL, 336477088UL, 532374143UL, 1123157198UL, 123828173UL, 272472192UL, 2142741093UL, 2557920990UL, 4209595119UL, 2807266578UL, 1516814248UL, 4250883502UL, 1967663703UL, 215335417UL, 1252724071UL, 4267389372UL, 94668579UL, +1980152960UL, 968677393UL, 1237744359UL, 63833646UL, 2488747616UL, 700459471UL, 744977323UL, 40829823UL, 955400639UL, 37187948UL, 53133706UL, 2014551043UL, 1664982537UL, 3342787122UL, 1549278321UL, 1245110464UL, 3424539081UL, 2180485253UL, 2757636973UL, 3590044052UL, 2712703548UL, 1366894959UL, 1777449151UL, 1538653374UL, 168718075UL, 2435805251UL, 588815465UL, 3166271130UL, 3164200096UL, 417809976UL, 623036767UL, 340121872UL, +1792214783UL, 56330125UL, 3268029211UL, 1117100306UL, 345899179UL, 1547071836UL, 3657965225UL, 4109701299UL, 664937685UL, 2627187961UL, 149301108UL, 1764003230UL, 3177910586UL, 3081492846UL, 2295419724UL, 2553420882UL, 1506534805UL, 971284719UL, 3224921758UL, 3336906843UL, 1507395478UL, 1224379418UL, 4117299702UL, 1973783225UL, 3609783242UL, 4186900040UL, 3715175536UL, 3904547465UL, 459692505UL, 3546328518UL, 3071448159UL, 1300375875UL, +1805392236UL, 3072717072UL, 99113127UL, 4281059076UL, 1658649136UL, 1974081931UL, 3940966682UL, 2092428023UL, 4014384840UL, 1546542514UL, 1130620125UL, 4117533767UL, 3372991735UL, 3537429957UL, 2704347564UL, 2300583688UL, 915286167UL, 1553874575UL, 3466388216UL, 701000054UL, 349103195UL, 1554395274UL, 3140941933UL, 2874072684UL, 2630572105UL, 2794301280UL, 321399291UL, 1158058020UL, 3570908149UL, 122802750UL, 3012686842UL, 2588402967UL, +3420589812UL, 581016671UL, 193235885UL, 1558092297UL, 1233353728UL, 1080743465UL, 3292663441UL, 2188057155UL, 2715412992UL, 4274317234UL, 1657504087UL, 2554269340UL, 1079741964UL, 922252155UL, 569761460UL, 3215661310UL, 2450710288UL, 2491078689UL, 632504591UL, 2169581755UL, 2552457727UL, 2554414735UL, 3347573916UL, 681756629UL, 801451286UL, 3504956478UL, 1308297539UL, 3602650700UL, 3530372129UL, 4117441036UL, 1827438812UL, 2852602217UL, +570161747UL, 4246897171UL, 2217508286UL, 4117450683UL, 4110626546UL, 756072139UL, 3977667932UL, 623718443UL, 2276396692UL, 3772091798UL, 3829898369UL, 710314822UL, 3733316262UL, 1497955597UL, 700242668UL, 757539371UL, 1247731879UL, 336477088UL, 532374143UL, 1123157198UL, 2374238409UL, 272472192UL, 2142741093UL, 2557920990UL, 4209595119UL, 1632439709UL, 1516814248UL, 4250883502UL, 1967663703UL, 215335417UL, 1267642920UL, 4267389372UL, +94668579UL, 1980152960UL, 968677393UL, 2252616933UL, 63833646UL, 2488747616UL, 700459471UL, 744977323UL, 2711054317UL, 955400639UL, 37187948UL, 53133706UL, 2014551043UL, 1664498234UL, 3342787122UL, 1549278321UL, 1245110464UL, 3424539081UL, 496150741UL, 2757636973UL, 3590044052UL, 2712703548UL, 1366894959UL, 2066534443UL, 1538653374UL, 168718075UL, 2435805251UL, 588815465UL, 318307195UL, 3164200096UL, 417809976UL, 623036767UL, +340121872UL, 3426055217UL, 56330125UL, 3268029211UL, 1117100306UL, 345899179UL, 979486044UL, 3657965225UL, 4109701299UL, 664937685UL, 2627187961UL, 2747102301UL, 1764003230UL, 3177910586UL, 3081492846UL, 2295419724UL, 1088606857UL, 1506534805UL, 971284719UL, 3224921758UL, 3336906843UL, 984983218UL, 1224379418UL, 4117299702UL, 1973783225UL, 3609783242UL, 1044785427UL, 3715175536UL, 3904547465UL, 459692505UL, 3546328518UL, 2096978494UL, +1300375875UL, 1805392236UL, 3072717072UL, 99113127UL, 972796497UL, 1658649136UL, 1974081931UL, 3940966682UL, 2092428023UL, 2914458983UL, 1546542514UL, 1130620125UL, 4117533767UL, 3372991735UL, 947968718UL, 2704347564UL, 2300583688UL, 915286167UL, 1553874575UL, 2124709798UL, 701000054UL, 349103195UL, 1554395274UL, 3140941933UL, 2569019225UL, 2630572105UL, 2794301280UL, 321399291UL, 1158058020UL, 4051601694UL, 122802750UL, 3012686842UL, +2588402967UL, 3420589812UL, 1738150581UL, 193235885UL, 1558092297UL, 1233353728UL, 1080743465UL, 1527068788UL, 2188057155UL, 2715412992UL, 4274317234UL, 1657504087UL, 1543089352UL, 1079741964UL, 922252155UL, 569761460UL, 3215661310UL, 2869922986UL, 2491078689UL, 632504591UL, 2169581755UL, 2552457727UL, 2807462748UL, 3347573916UL, 681756629UL, 801451286UL, 3504956478UL, 3400676931UL, 3602650700UL, 3530372129UL, 4117441036UL, 1827438812UL, +4056234054UL, 570161747UL, 4246897171UL, 2217508286UL, 4117450683UL, 3321376103UL, 756072139UL, 3977667932UL, 623718443UL, 2276396692UL, 1340008665UL, 3829898369UL, 710314822UL, 3733316262UL, 1497955597UL, 2098292377UL, 757539371UL, 1247731879UL, 336477088UL, 532374143UL, 2210327641UL, 2374238409UL, 272472192UL, 2142741093UL, 2557920990UL, 3502520226UL, 1632439709UL, 1516814248UL, 4250883502UL, 1967663703UL, 499168780UL, 1267642920UL, +4267389372UL, 94668579UL, 1980152960UL, 2695928666UL, 2252616933UL, 63833646UL, 2488747616UL, 700459471UL, 4181471443UL, 2711054317UL, 955400639UL, 37187948UL, 53133706UL, 441944403UL, 1664498234UL, 3342787122UL, 1549278321UL, 1245110464UL, 2271611585UL, 496150741UL, 2757636973UL, 3590044052UL, 2712703548UL, 3009817799UL, 2066534443UL, 1538653374UL, 168718075UL, 2435805251UL, 734763537UL, 318307195UL, 3164200096UL, 417809976UL, +623036767UL, 4002728646UL, 3426055217UL, 56330125UL, 3268029211UL, 1117100306UL, 1435987728UL, 979486044UL, 3657965225UL, 4109701299UL, 664937685UL, 815527474UL, 2747102301UL, 1764003230UL, 3177910586UL, 3081492846UL, 63383766UL, 1088606857UL, 1506534805UL, 971284719UL, 3224921758UL, 2331024939UL, 984983218UL, 1224379418UL, 4117299702UL, 1973783225UL, 3998070267UL, 1044785427UL, 3715175536UL, 3904547465UL, 459692505UL, 2582830990UL, +2096978494UL, 1300375875UL, 1805392236UL, 3072717072UL, 321154403UL, 972796497UL, 1658649136UL, 1974081931UL, 3940966682UL, 3789726976UL, 2914458983UL, 1546542514UL, 1130620125UL, 4117533767UL, 3440681546UL, 947968718UL, 2704347564UL, 2300583688UL, 915286167UL, 474021937UL, 2124709798UL, 701000054UL, 349103195UL, 1554395274UL, 702752814UL, 2569019225UL, 2630572105UL, 2794301280UL, 321399291UL, 2406346046UL, 4051601694UL, 122802750UL, +3012686842UL, 2588402967UL, 1782259321UL, 1738150581UL, 193235885UL, 1558092297UL, 1233353728UL, 3935919190UL, 1527068788UL, 2188057155UL, 2715412992UL, 4274317234UL, 1722541048UL, 1543089352UL, 1079741964UL, 922252155UL, 569761460UL, 3384000986UL, 2869922986UL, 2491078689UL, 632504591UL, 2169581755UL, 3451609034UL, 2807462748UL, 3347573916UL, 681756629UL, 801451286UL, 2643408064UL, 3400676931UL, 3602650700UL, 3530372129UL, 4117441036UL, +3635077251UL, 4056234054UL, 570161747UL, 4246897171UL, 2217508286UL, 2364796923UL, 3321376103UL, 756072139UL, 3977667932UL, 623718443UL, 3792539489UL, 1340008665UL, 3829898369UL, 710314822UL, 3733316262UL, 876419217UL, 2098292377UL, 757539371UL, 1247731879UL, 336477088UL, 3307300788UL, 2210327641UL, 2374238409UL, 272472192UL, 2142741093UL, 4142392723UL, 3502520226UL, 1632439709UL, 1516814248UL, 4250883502UL, 3551852862UL, 499168780UL, +1267642920UL, 4267389372UL, 94668579UL, 1177286958UL, 2695928666UL, 2252616933UL, 63833646UL, 2488747616UL, 3571573975UL, 4181471443UL, 2711054317UL, 955400639UL, 37187948UL, 1485050393UL, 441944403UL, 1664498234UL, 3342787122UL, 1549278321UL, 518707274UL, 2271611585UL, 496150741UL, 2757636973UL, 3590044052UL, 305206687UL, 3009817799UL, 2066534443UL, 1538653374UL, 168718075UL, 1914032206UL, 734763537UL, 318307195UL, 3164200096UL, +417809976UL, 2062496275UL, 4002728646UL, 3426055217UL, 56330125UL, 3268029211UL, 1878869053UL, 1435987728UL, 979486044UL, 3657965225UL, 4109701299UL, 1558853775UL, 815527474UL, 2747102301UL, 1764003230UL, 3177910586UL, 681877401UL, 63383766UL, 1088606857UL, 1506534805UL, 971284719UL, 2546285777UL, 2331024939UL, 984983218UL, 1224379418UL, 4117299702UL, 539292757UL, 3998070267UL, 1044785427UL, 3715175536UL, 3904547465UL, 3854154565UL, +2582830990UL, 2096978494UL, 1300375875UL, 1805392236UL, 2586804198UL, 321154403UL, 972796497UL, 1658649136UL, 1974081931UL, 1718873863UL, 3789726976UL, 2914458983UL, 1546542514UL, 1130620125UL, 477866180UL, 3440681546UL, 947968718UL, 2704347564UL, 2300583688UL, 56071603UL, 474021937UL, 2124709798UL, 701000054UL, 349103195UL, 2431577249UL, 702752814UL, 2569019225UL, 2630572105UL, 2794301280UL, 211758134UL, 2406346046UL, 4051601694UL, +122802750UL, 3012686842UL, 2470642374UL, 1782259321UL, 1738150581UL, 193235885UL, 1558092297UL, 852353933UL, 3935919190UL, 1527068788UL, 2188057155UL, 2715412992UL, 543290606UL, 1722541048UL, 1543089352UL, 1079741964UL, 922252155UL, 1146820965UL, 3384000986UL, 2869922986UL, 2491078689UL, 632504591UL, 2936494996UL, 3451609034UL, 2807462748UL, 3347573916UL, 681756629UL, 3428474076UL, 2643408064UL, 3400676931UL, 3602650700UL, 3530372129UL, +3558016488UL, 304167301UL, 3073812276UL, 1253385329UL, 801639697UL, 1346336854UL, 3880416830UL, 1110804934UL, 2500585706UL, 1294233475UL, 1964132477UL, 1625651370UL, 2732590160UL, 310054807UL, 3350133555UL, 800839525UL, 3435579932UL, 2120216654UL, 407780291UL, 1228117799UL, 513334510UL, 1423091447UL, 3698882838UL, 2556406643UL, 1536483608UL, 998695315UL, 1619514015UL, 4197375975UL, 892985909UL, 993665758UL, 4160405430UL, 2379977763UL, +1423742790UL, 4286808034UL, 479280944UL, 3611297256UL, 3481820363UL, 1261889958UL, 455298115UL, 3955764756UL, 2406161837UL, 185873336UL, 3382956716UL, 3556168427UL, 3988426650UL, 2917586591UL, 1248672474UL, 2925146191UL, 1416331075UL, 290755159UL, 2845168299UL, 3301422441UL, 3771816588UL, 491352430UL, 2461746382UL, 1591975949UL, 604909111UL, 3595669760UL, 4079314041UL, 258321046UL, 1352583874UL, 999018951UL, 3150079914UL, 113122510UL, +743303046UL, 3205496412UL, 4267738054UL, 2567402806UL, 2181107494UL, 3266354249UL, 1941487496UL, 2742084900UL, 3758785335UL, 732694221UL, 2052988791UL, 1759288229UL, 1094292464UL, 1582835026UL, 2817864273UL, 666443657UL, 419482443UL, 2877435004UL, 2944696351UL, 2523539432UL, 301119182UL, 998264713UL, 2314419254UL, 3610447393UL, 1139414242UL, 1486351830UL, 3207929489UL, 384633091UL, 4056367270UL, 2348418835UL, 3773781885UL, 1963929818UL, +804929680UL, 1511023454UL, 3915948102UL, 1371942526UL, 2586212526UL, 130122933UL, 2030859646UL, 3730011315UL, 118408868UL, 632704878UL, 3559959612UL, 2926361713UL, 1401386286UL, 599210027UL, 2315051975UL, 157809758UL, 1148939942UL, 3060024350UL, 1464284678UL, 3209480975UL, 3961060416UL, 3481639206UL, 4113344379UL, 3475766200UL, 130581501UL, 1844026536UL, 2661594012UL, 3145812007UL, 3233175620UL, 2549419093UL, 2612966733UL, 1348260920UL, +740167863UL, 226231218UL, 2631972701UL, 2148020402UL, 3399479414UL, 1074946996UL, 30872114UL, 1342415612UL, 1071408471UL, 1141719547UL, 332346805UL, 1473336719UL, 4207932404UL, 3668838170UL, 3154502882UL, 3892070442UL, 2812790310UL, 13931822UL, 1150258251UL, 2369539473UL, 640926011UL, 2991135002UL, 2410382633UL, 548200125UL, 3977740663UL, 1245837867UL, 2378569399UL, 1561469990UL, 2437445882UL, 214387770UL, 3329587833UL, 281635893UL, +}, +{ +1720103319UL, 2201367526UL, 1415072072UL, 2446588589UL, 2195586017UL, 3817930623UL, 653121934UL, 2766514657UL, 765921436UL, 630082485UL, 2990883045UL, 3304472999UL, 471385134UL, 4097977544UL, 3749829028UL, 3587534772UL, 1064359851UL, 800061060UL, 2844220510UL, 389838005UL, 3681318140UL, 1515923235UL, 1885079324UL, 713031018UL, 1962734763UL, 2288160004UL, 1983331336UL, 1247350521UL, 4208372034UL, 1444837930UL, 3549494305UL, 4169715512UL, +701313302UL, 1118275019UL, 3118975645UL, 4153969630UL, 3516491181UL, 3601057044UL, 2509222288UL, 223064937UL, 899123842UL, 2574531231UL, 1386928111UL, 3790651401UL, 1300768348UL, 2038833061UL, 3736517792UL, 3850203561UL, 1679542285UL, 3391273474UL, 3862995487UL, 3118056386UL, 47128429UL, 2977525950UL, 3236389548UL, 1937040839UL, 4223233198UL, 2105119262UL, 721111284UL, 331726226UL, 68419013UL, 2575393464UL, 3648293304UL, 1448878851UL, +4186783614UL, 3696899986UL, 1270877069UL, 3351263117UL, 3918639273UL, 1472902162UL, 2767482392UL, 3549853842UL, 2353191576UL, 3353325530UL, 3072485271UL, 2689121900UL, 2335686695UL, 246689858UL, 2946177636UL, 1677728066UL, 1455723263UL, 3447540996UL, 2143976172UL, 1779511280UL, 3667361203UL, 1575502035UL, 849872082UL, 3527265600UL, 1443266215UL, 1320668722UL, 458373857UL, 3862342513UL, 699597603UL, 685707268UL, 948502001UL, 2501058653UL, +2254562046UL, 2210683894UL, 29088679UL, 1456231200UL, 2764392560UL, 4138068372UL, 3094591474UL, 1093749152UL, 1668875176UL, 3133003149UL, 4128702884UL, 652852832UL, 2211671337UL, 2231125160UL, 131729558UL, 3845605816UL, 3769660625UL, 1696592453UL, 728353643UL, 2751201502UL, 3496971733UL, 3349166522UL, 1005919830UL, 3411089601UL, 3754493523UL, 1994945529UL, 1604309774UL, 2083609686UL, 833983349UL, 2600153513UL, 1677348112UL, 207321473UL, +1051990507UL, 2135039620UL, 4239461390UL, 1574144998UL, 1070761856UL, 1990807569UL, 112704720UL, 2506523299UL, 2827487353UL, 4130754901UL, 1943274185UL, 3913701053UL, 1014850621UL, 3662772872UL, 4115124063UL, 1760146762UL, 3254829227UL, 800302547UL, 3602066837UL, 975658158UL, 2880018391UL, 714134831UL, 2696483406UL, 2351365577UL, 2811011071UL, 3505407160UL, 54109504UL, 424967367UL, 3759525737UL, 1726627246UL, 1110539071UL, 2339755764UL, +3356877114UL, 1720103319UL, 2201367526UL, 1415072072UL, 2446588589UL, 2499136377UL, 3817930623UL, 653121934UL, 2766514657UL, 765921436UL, 3794433488UL, 2990883045UL, 3304472999UL, 471385134UL, 4097977544UL, 3618516788UL, 3587534772UL, 1064359851UL, 800061060UL, 2844220510UL, 2319780070UL, 3681318140UL, 1515923235UL, 1885079324UL, 713031018UL, 11705290UL, 2288160004UL, 1983331336UL, 1247350521UL, 4208372034UL, 2508892029UL, 3549494305UL, +4169715512UL, 701313302UL, 1118275019UL, 1430522809UL, 4153969630UL, 3516491181UL, 3601057044UL, 2509222288UL, 1917025539UL, 899123842UL, 2574531231UL, 1386928111UL, 3790651401UL, 1219040401UL, 2038833061UL, 3736517792UL, 3850203561UL, 1679542285UL, 671522957UL, 3862995487UL, 3118056386UL, 47128429UL, 2977525950UL, 2762831063UL, 1937040839UL, 4223233198UL, 2105119262UL, 721111284UL, 1386688457UL, 68419013UL, 2575393464UL, 3648293304UL, +1448878851UL, 466405406UL, 3696899986UL, 1270877069UL, 3351263117UL, 3918639273UL, 94103836UL, 2767482392UL, 3549853842UL, 2353191576UL, 3353325530UL, 349361794UL, 2689121900UL, 2335686695UL, 246689858UL, 2946177636UL, 3232050945UL, 1455723263UL, 3447540996UL, 2143976172UL, 1779511280UL, 542837628UL, 1575502035UL, 849872082UL, 3527265600UL, 1443266215UL, 1867394883UL, 458373857UL, 3862342513UL, 699597603UL, 685707268UL, 4210562190UL, +2501058653UL, 2254562046UL, 2210683894UL, 29088679UL, 3647972960UL, 2764392560UL, 4138068372UL, 3094591474UL, 1093749152UL, 312511475UL, 3133003149UL, 4128702884UL, 652852832UL, 2211671337UL, 145492343UL, 131729558UL, 3845605816UL, 3769660625UL, 1696592453UL, 4223421915UL, 2751201502UL, 3496971733UL, 3349166522UL, 1005919830UL, 1656802049UL, 3754493523UL, 1994945529UL, 1604309774UL, 2083609686UL, 3032348100UL, 2600153513UL, 1677348112UL, +207321473UL, 1051990507UL, 3349078950UL, 4239461390UL, 1574144998UL, 1070761856UL, 1990807569UL, 2970449178UL, 2506523299UL, 2827487353UL, 4130754901UL, 1943274185UL, 445467699UL, 1014850621UL, 3662772872UL, 4115124063UL, 1760146762UL, 3738518624UL, 800302547UL, 3602066837UL, 975658158UL, 2880018391UL, 1553758240UL, 2696483406UL, 2351365577UL, 2811011071UL, 3505407160UL, 1259180427UL, 424967367UL, 3759525737UL, 1726627246UL, 1110539071UL, +2863575420UL, 3356877114UL, 1720103319UL, 2201367526UL, 1415072072UL, 1463388387UL, 2499136377UL, 3817930623UL, 653121934UL, 2766514657UL, 526940162UL, 3794433488UL, 2990883045UL, 3304472999UL, 471385134UL, 594057325UL, 3618516788UL, 3587534772UL, 1064359851UL, 800061060UL, 1001523010UL, 2319780070UL, 3681318140UL, 1515923235UL, 1885079324UL, 255576756UL, 11705290UL, 2288160004UL, 1983331336UL, 1247350521UL, 1108575113UL, 2508892029UL, +3549494305UL, 4169715512UL, 701313302UL, 524281295UL, 1430522809UL, 4153969630UL, 3516491181UL, 3601057044UL, 1816283752UL, 1917025539UL, 899123842UL, 2574531231UL, 1386928111UL, 1530966640UL, 1219040401UL, 2038833061UL, 3736517792UL, 3850203561UL, 1855689726UL, 671522957UL, 3862995487UL, 3118056386UL, 47128429UL, 1718476461UL, 2762831063UL, 1937040839UL, 4223233198UL, 2105119262UL, 176166283UL, 1386688457UL, 68419013UL, 2575393464UL, +3648293304UL, 4069820559UL, 466405406UL, 3696899986UL, 1270877069UL, 3351263117UL, 1645545933UL, 94103836UL, 2767482392UL, 3549853842UL, 2353191576UL, 4163887784UL, 349361794UL, 2689121900UL, 2335686695UL, 246689858UL, 1246040634UL, 3232050945UL, 1455723263UL, 3447540996UL, 2143976172UL, 2111249329UL, 542837628UL, 1575502035UL, 849872082UL, 3527265600UL, 1836050084UL, 1867394883UL, 458373857UL, 3862342513UL, 699597603UL, 3139537113UL, +4210562190UL, 2501058653UL, 2254562046UL, 2210683894UL, 3997617191UL, 3647972960UL, 2764392560UL, 4138068372UL, 3094591474UL, 2664795910UL, 312511475UL, 3133003149UL, 4128702884UL, 652852832UL, 1658020144UL, 145492343UL, 131729558UL, 3845605816UL, 3769660625UL, 2822578949UL, 4223421915UL, 2751201502UL, 3496971733UL, 3349166522UL, 1582873482UL, 1656802049UL, 3754493523UL, 1994945529UL, 1604309774UL, 1113569720UL, 3032348100UL, 2600153513UL, +1677348112UL, 207321473UL, 3169983987UL, 3349078950UL, 4239461390UL, 1574144998UL, 1070761856UL, 1308776367UL, 2970449178UL, 2506523299UL, 2827487353UL, 4130754901UL, 1403493846UL, 445467699UL, 1014850621UL, 3662772872UL, 4115124063UL, 340210579UL, 3738518624UL, 800302547UL, 3602066837UL, 975658158UL, 3367770843UL, 1553758240UL, 2696483406UL, 2351365577UL, 2811011071UL, 4162875353UL, 1259180427UL, 424967367UL, 3759525737UL, 1726627246UL, +1341806135UL, 2863575420UL, 3356877114UL, 1720103319UL, 2201367526UL, 2232383995UL, 1463388387UL, 2499136377UL, 3817930623UL, 653121934UL, 1756183481UL, 526940162UL, 3794433488UL, 2990883045UL, 3304472999UL, 2185125572UL, 594057325UL, 3618516788UL, 3587534772UL, 1064359851UL, 2933544964UL, 1001523010UL, 2319780070UL, 3681318140UL, 1515923235UL, 4147783641UL, 255576756UL, 11705290UL, 2288160004UL, 1983331336UL, 956739400UL, 1108575113UL, +2508892029UL, 3549494305UL, 4169715512UL, 142273913UL, 524281295UL, 1430522809UL, 4153969630UL, 3516491181UL, 986032639UL, 1816283752UL, 1917025539UL, 899123842UL, 2574531231UL, 1508271110UL, 1530966640UL, 1219040401UL, 2038833061UL, 3736517792UL, 458417668UL, 1855689726UL, 671522957UL, 3862995487UL, 3118056386UL, 284266432UL, 1718476461UL, 2762831063UL, 1937040839UL, 4223233198UL, 1605514069UL, 176166283UL, 1386688457UL, 68419013UL, +2575393464UL, 3650747541UL, 4069820559UL, 466405406UL, 3696899986UL, 1270877069UL, 678590674UL, 1645545933UL, 94103836UL, 2767482392UL, 3549853842UL, 398179945UL, 4163887784UL, 349361794UL, 2689121900UL, 2335686695UL, 3853658293UL, 1246040634UL, 3232050945UL, 1455723263UL, 3447540996UL, 2657693810UL, 2111249329UL, 542837628UL, 1575502035UL, 849872082UL, 2061659800UL, 1836050084UL, 1867394883UL, 458373857UL, 3862342513UL, 730568629UL, +3139537113UL, 4210562190UL, 2501058653UL, 2254562046UL, 449510786UL, 3997617191UL, 3647972960UL, 2764392560UL, 4138068372UL, 1939679536UL, 2664795910UL, 312511475UL, 3133003149UL, 4128702884UL, 4057510355UL, 1658020144UL, 145492343UL, 131729558UL, 3845605816UL, 3235632110UL, 2822578949UL, 4223421915UL, 2751201502UL, 3496971733UL, 4258920219UL, 1582873482UL, 1656802049UL, 3754493523UL, 1994945529UL, 1073499993UL, 1113569720UL, 3032348100UL, +2600153513UL, 1677348112UL, 3152835240UL, 3169983987UL, 3349078950UL, 4239461390UL, 1574144998UL, 2548972357UL, 1308776367UL, 2970449178UL, 2506523299UL, 2827487353UL, 2908066033UL, 1403493846UL, 445467699UL, 1014850621UL, 3662772872UL, 1685925089UL, 340210579UL, 3738518624UL, 800302547UL, 3602066837UL, 2264692610UL, 3367770843UL, 1553758240UL, 2696483406UL, 2351365577UL, 1686022564UL, 4162875353UL, 1259180427UL, 424967367UL, 3759525737UL, +70326173UL, 3028074555UL, 2568586198UL, 2513473964UL, 2923109510UL, 2265392251UL, 3760490867UL, 147487099UL, 386755149UL, 2152759137UL, 2716532213UL, 1153507474UL, 627929575UL, 847454712UL, 2426916452UL, 3861548980UL, 209825268UL, 1090299778UL, 1876886461UL, 976019203UL, 4290216337UL, 2278290065UL, 3302814528UL, 1567440061UL, 1874857224UL, 3794588915UL, 3218569451UL, 2335365199UL, 1959651923UL, 3366000689UL, 2374428382UL, 2126784887UL, +4123272655UL, 274837369UL, 1413111935UL, 1754627204UL, 1863684635UL, 4170025739UL, 2150019850UL, 4250751856UL, 3601214212UL, 2024081043UL, 334808859UL, 3921757513UL, 3870643644UL, 2864810945UL, 1004431888UL, 4283279830UL, 873365350UL, 2479791433UL, 3393478881UL, 3373502257UL, 1882140107UL, 2546676519UL, 1208428915UL, 268043238UL, 2292710623UL, 770651064UL, 2330160036UL, 2476488258UL, 2496037992UL, 118721504UL, 2289499985UL, 987994743UL, +3610346256UL, 3371795927UL, 2681434550UL, 2213200417UL, 3729194378UL, 1657623395UL, 402983380UL, 3618058500UL, 3487743585UL, 965523531UL, 819256729UL, 2544660729UL, 3273986506UL, 60894411UL, 1779152929UL, 3598159279UL, 3429317853UL, 2246402362UL, 3761392367UL, 3921798306UL, 947928110UL, 2394097908UL, 4004330264UL, 1180759989UL, 1624349051UL, 1750929499UL, 3889184770UL, 2052097704UL, 4092981046UL, 2913733578UL, 4241980897UL, 1127407450UL, +950788009UL, 2105033320UL, 473205730UL, 981905310UL, 2888856914UL, 798112239UL, 3377889612UL, 2273659507UL, 1157471194UL, 4269212574UL, 3575306012UL, 116024754UL, 1432668659UL, 1079598649UL, 3882002482UL, 3838480186UL, 823643071UL, 1244220618UL, 1227720039UL, 1343395654UL, 4277277976UL, 2612321540UL, 3013674017UL, 3658064522UL, 2573775167UL, 142767236UL, 2545708383UL, 1740478937UL, 809036862UL, 1492188594UL, 1294286248UL, 1093543858UL, +2944418375UL, 2981996479UL, 4067464923UL, 3071157685UL, 1938984450UL, 81707323UL, 337713546UL, 1849381296UL, 3447450393UL, 3551106302UL, 3394545269UL, 3167744716UL, 1815294624UL, 3244728913UL, 2462138247UL, 2286711732UL, 3023116169UL, 707366723UL, 1314169762UL, 1511231537UL, 2227622993UL, 2876600706UL, 4271030726UL, 2020521540UL, 2966596767UL, 3964589247UL, 1291306737UL, 883851756UL, 1355819080UL, 2834319249UL, 3825063450UL, 4205423325UL, +}, +{ +525214560UL, 1972466543UL, 1542775297UL, 3030388145UL, 2623763324UL, 1445252054UL, 2315649878UL, 2940376435UL, 1322155857UL, 2007925719UL, 899111545UL, 3946601974UL, 720416639UL, 566341007UL, 3830971140UL, 2379218430UL, 946001131UL, 324551023UL, 3792134824UL, 2419222364UL, 2507004728UL, 4050415702UL, 2934667964UL, 3435655480UL, 3738151878UL, 340092998UL, 429296098UL, 3804978739UL, 1547120540UL, 976306993UL, 1134820236UL, 288696971UL, +292350374UL, 423348923UL, 4250561112UL, 1380146522UL, 646098313UL, 3081299572UL, 3633231429UL, 2348008746UL, 3250735726UL, 3495239618UL, 1083361876UL, 2660545988UL, 97607299UL, 741626628UL, 2451882102UL, 607936604UL, 1566190301UL, 3752644837UL, 1626575269UL, 2569947980UL, 120166892UL, 1936167922UL, 2964570009UL, 2601765059UL, 2550590348UL, 1491574373UL, 1916644920UL, 2955888714UL, 3900360190UL, 396836243UL, 2417234534UL, 4219822777UL, +3017031315UL, 3848370775UL, 4113753945UL, 1038708316UL, 1227041843UL, 1287656330UL, 594136009UL, 1679465955UL, 1127853612UL, 445673212UL, 2491164616UL, 4234959779UL, 3670094401UL, 2810998507UL, 2091885715UL, 4213376041UL, 3724691332UL, 1428205363UL, 2351471476UL, 1863345709UL, 3172242044UL, 1435176883UL, 925973933UL, 3166951436UL, 2056462416UL, 489417029UL, 4029854347UL, 3002516723UL, 1597712463UL, 1200457469UL, 3909654542UL, 1352519428UL, +13398705UL, 3919269221UL, 371331154UL, 332347636UL, 3726033518UL, 2407091731UL, 2926199215UL, 3054175446UL, 3208807730UL, 584793525UL, 2706493003UL, 561190823UL, 2412132195UL, 2488492462UL, 3149885896UL, 3512276852UL, 2843032269UL, 2485506176UL, 4025325347UL, 4152622551UL, 4022346903UL, 331746013UL, 197533993UL, 3658414685UL, 2670729696UL, 3290854172UL, 2251426444UL, 3569225076UL, 2466203243UL, 658184940UL, 518096293UL, 52156682UL, +2398958685UL, 745491615UL, 3723004242UL, 2847276077UL, 1857504125UL, 633035220UL, 4057593658UL, 2783467746UL, 3122875931UL, 446601186UL, 2786851490UL, 261950076UL, 2843506874UL, 745391893UL, 1404094021UL, 2234513997UL, 315083019UL, 645865358UL, 2862243948UL, 1204315994UL, 3701151065UL, 663411328UL, 1924727700UL, 1905843757UL, 1483930049UL, 449616818UL, 3793968150UL, 1840668755UL, 1671024110UL, 4079375869UL, 4171670660UL, 2585904968UL, +3886777251UL, 525214560UL, 1972466543UL, 1542775297UL, 3030388145UL, 2530126952UL, 1445252054UL, 2315649878UL, 2940376435UL, 1322155857UL, 1599103627UL, 899111545UL, 3946601974UL, 720416639UL, 566341007UL, 4070101360UL, 2379218430UL, 946001131UL, 324551023UL, 3792134824UL, 2445126690UL, 2507004728UL, 4050415702UL, 2934667964UL, 3435655480UL, 2968121571UL, 340092998UL, 429296098UL, 3804978739UL, 1547120540UL, 3901803457UL, 1134820236UL, +288696971UL, 292350374UL, 423348923UL, 1589814289UL, 1380146522UL, 646098313UL, 3081299572UL, 3633231429UL, 670777956UL, 3250735726UL, 3495239618UL, 1083361876UL, 2660545988UL, 4050232394UL, 741626628UL, 2451882102UL, 607936604UL, 1566190301UL, 1132827700UL, 1626575269UL, 2569947980UL, 120166892UL, 1936167922UL, 1280520333UL, 2601765059UL, 2550590348UL, 1491574373UL, 1916644920UL, 1073889810UL, 3900360190UL, 396836243UL, 2417234534UL, +4219822777UL, 1754651820UL, 3848370775UL, 4113753945UL, 1038708316UL, 1227041843UL, 464826842UL, 594136009UL, 1679465955UL, 1127853612UL, 445673212UL, 4198686893UL, 4234959779UL, 3670094401UL, 2810998507UL, 2091885715UL, 416103731UL, 3724691332UL, 1428205363UL, 2351471476UL, 1863345709UL, 2637470915UL, 1435176883UL, 925973933UL, 3166951436UL, 2056462416UL, 2546319147UL, 4029854347UL, 3002516723UL, 1597712463UL, 1200457469UL, 681365672UL, +1352519428UL, 13398705UL, 3919269221UL, 371331154UL, 742849231UL, 3726033518UL, 2407091731UL, 2926199215UL, 3054175446UL, 1323833820UL, 584793525UL, 2706493003UL, 561190823UL, 2412132195UL, 3747238187UL, 3149885896UL, 3512276852UL, 2843032269UL, 2485506176UL, 3817319503UL, 4152622551UL, 4022346903UL, 331746013UL, 197533993UL, 99009902UL, 2670729696UL, 3290854172UL, 2251426444UL, 3569225076UL, 4199909720UL, 658184940UL, 518096293UL, +52156682UL, 2398958685UL, 1648201186UL, 3723004242UL, 2847276077UL, 1857504125UL, 633035220UL, 1394668680UL, 2783467746UL, 3122875931UL, 446601186UL, 2786851490UL, 2590549096UL, 2843506874UL, 745391893UL, 1404094021UL, 2234513997UL, 347299411UL, 645865358UL, 2862243948UL, 1204315994UL, 3701151065UL, 4028305509UL, 1924727700UL, 1905843757UL, 1483930049UL, 449616818UL, 2251238906UL, 1840668755UL, 1671024110UL, 4079375869UL, 4171670660UL, +4080554282UL, 3886777251UL, 525214560UL, 1972466543UL, 1542775297UL, 3280177496UL, 2530126952UL, 1445252054UL, 2315649878UL, 2940376435UL, 2094983509UL, 1599103627UL, 899111545UL, 3946601974UL, 720416639UL, 1446566513UL, 4070101360UL, 2379218430UL, 946001131UL, 324551023UL, 2945613775UL, 2445126690UL, 2507004728UL, 4050415702UL, 2934667964UL, 2815036731UL, 2968121571UL, 340092998UL, 429296098UL, 3804978739UL, 3298867574UL, 3901803457UL, +1134820236UL, 288696971UL, 292350374UL, 3280367987UL, 1589814289UL, 1380146522UL, 646098313UL, 3081299572UL, 2536311658UL, 670777956UL, 3250735726UL, 3495239618UL, 1083361876UL, 3726225049UL, 4050232394UL, 741626628UL, 2451882102UL, 607936604UL, 3460165725UL, 1132827700UL, 1626575269UL, 2569947980UL, 120166892UL, 2961109404UL, 1280520333UL, 2601765059UL, 2550590348UL, 1491574373UL, 755823086UL, 1073889810UL, 3900360190UL, 396836243UL, +2417234534UL, 3036027780UL, 1754651820UL, 3848370775UL, 4113753945UL, 1038708316UL, 3784147349UL, 464826842UL, 594136009UL, 1679465955UL, 1127853612UL, 2128970592UL, 4198686893UL, 4234959779UL, 3670094401UL, 2810998507UL, 421961324UL, 416103731UL, 3724691332UL, 1428205363UL, 2351471476UL, 3407618159UL, 2637470915UL, 1435176883UL, 925973933UL, 3166951436UL, 1274860184UL, 2546319147UL, 4029854347UL, 3002516723UL, 1597712463UL, 671480036UL, +681365672UL, 1352519428UL, 13398705UL, 3919269221UL, 1150967289UL, 742849231UL, 3726033518UL, 2407091731UL, 2926199215UL, 3106945136UL, 1323833820UL, 584793525UL, 2706493003UL, 561190823UL, 2013357219UL, 3747238187UL, 3149885896UL, 3512276852UL, 2843032269UL, 3595347994UL, 3817319503UL, 4152622551UL, 4022346903UL, 331746013UL, 367216863UL, 99009902UL, 2670729696UL, 3290854172UL, 2251426444UL, 3130148315UL, 4199909720UL, 658184940UL, +518096293UL, 52156682UL, 3004378899UL, 1648201186UL, 3723004242UL, 2847276077UL, 1857504125UL, 253542783UL, 1394668680UL, 2783467746UL, 3122875931UL, 446601186UL, 1228837642UL, 2590549096UL, 2843506874UL, 745391893UL, 1404094021UL, 1324404436UL, 347299411UL, 645865358UL, 2862243948UL, 1204315994UL, 1455458347UL, 4028305509UL, 1924727700UL, 1905843757UL, 1483930049UL, 330348422UL, 2251238906UL, 1840668755UL, 1671024110UL, 4079375869UL, +606568968UL, 4080554282UL, 3886777251UL, 525214560UL, 1972466543UL, 1703103913UL, 3280177496UL, 2530126952UL, 1445252054UL, 2315649878UL, 3946153427UL, 2094983509UL, 1599103627UL, 899111545UL, 3946601974UL, 2053673584UL, 1446566513UL, 4070101360UL, 2379218430UL, 946001131UL, 4184236551UL, 2945613775UL, 2445126690UL, 2507004728UL, 4050415702UL, 3890831500UL, 2815036731UL, 2968121571UL, 340092998UL, 429296098UL, 228493148UL, 3298867574UL, +3901803457UL, 1134820236UL, 288696971UL, 2321943990UL, 3280367987UL, 1589814289UL, 1380146522UL, 646098313UL, 1765624343UL, 2536311658UL, 670777956UL, 3250735726UL, 3495239618UL, 1772431608UL, 3726225049UL, 4050232394UL, 741626628UL, 2451882102UL, 3386124330UL, 3460165725UL, 1132827700UL, 1626575269UL, 2569947980UL, 860947846UL, 2961109404UL, 1280520333UL, 2601765059UL, 2550590348UL, 2298495740UL, 755823086UL, 1073889810UL, 3900360190UL, +396836243UL, 2702634902UL, 3036027780UL, 1754651820UL, 3848370775UL, 4113753945UL, 3836550212UL, 3784147349UL, 464826842UL, 594136009UL, 1679465955UL, 1500399122UL, 2128970592UL, 4198686893UL, 4234959779UL, 3670094401UL, 1632934875UL, 421961324UL, 416103731UL, 3724691332UL, 1428205363UL, 2330377177UL, 3407618159UL, 2637470915UL, 1435176883UL, 925973933UL, 2558479866UL, 1274860184UL, 2546319147UL, 4029854347UL, 3002516723UL, 1331271216UL, +671480036UL, 681365672UL, 1352519428UL, 13398705UL, 1532459856UL, 1150967289UL, 742849231UL, 3726033518UL, 2407091731UL, 1766120506UL, 3106945136UL, 1323833820UL, 584793525UL, 2706493003UL, 3817434387UL, 2013357219UL, 3747238187UL, 3149885896UL, 3512276852UL, 203757UL, 3595347994UL, 3817319503UL, 4152622551UL, 4022346903UL, 3438004885UL, 367216863UL, 99009902UL, 2670729696UL, 3290854172UL, 1092092654UL, 3130148315UL, 4199909720UL, +658184940UL, 518096293UL, 982576981UL, 3004378899UL, 1648201186UL, 3723004242UL, 2847276077UL, 33113683UL, 253542783UL, 1394668680UL, 2783467746UL, 3122875931UL, 3109404671UL, 1228837642UL, 2590549096UL, 2843506874UL, 745391893UL, 809710525UL, 1324404436UL, 347299411UL, 645865358UL, 2862243948UL, 3652256751UL, 1455458347UL, 4028305509UL, 1924727700UL, 1905843757UL, 2035132481UL, 330348422UL, 2251238906UL, 1840668755UL, 1671024110UL, +3593348393UL, 4151905045UL, 3398483770UL, 611142788UL, 1798029112UL, 2747225670UL, 2894981396UL, 2117120651UL, 3087941624UL, 416876364UL, 700011792UL, 63929447UL, 822005210UL, 3483417647UL, 3513365134UL, 3071572873UL, 1925919001UL, 2778688996UL, 3079943255UL, 1252316311UL, 91270196UL, 3469862149UL, 156659741UL, 1342755036UL, 3821302858UL, 1790046971UL, 289329863UL, 1357914395UL, 4143182690UL, 2590503919UL, 3242437796UL, 1341085928UL, +2685277054UL, 727602392UL, 2581493226UL, 3216496864UL, 2171373196UL, 3767765187UL, 1895767358UL, 1029452326UL, 851913526UL, 1746266839UL, 3370323171UL, 648118190UL, 3244211645UL, 2623946928UL, 3859087079UL, 384443034UL, 2026989771UL, 802104797UL, 2201121552UL, 725742304UL, 1673563239UL, 4045658814UL, 2682764476UL, 3032306650UL, 2725871420UL, 3467522540UL, 534803010UL, 1135606913UL, 871336950UL, 937160030UL, 3384357161UL, 641566845UL, +2267407903UL, 331847343UL, 787968740UL, 2673012251UL, 2066357778UL, 2740382722UL, 1638377946UL, 2260504282UL, 3513172717UL, 238548903UL, 2203496688UL, 630532448UL, 3702112076UL, 2635952931UL, 3344713216UL, 139406056UL, 2369004628UL, 3547213209UL, 2944858950UL, 1231203228UL, 616949630UL, 2619739101UL, 89360251UL, 2364353701UL, 1025345607UL, 4177965685UL, 62274372UL, 3059207586UL, 3303376016UL, 2919795870UL, 3676526103UL, 2689781822UL, +1062293263UL, 2684605838UL, 863975243UL, 723728777UL, 1057919510UL, 1708017843UL, 4264127977UL, 3013938022UL, 3958746896UL, 328415103UL, 1117948849UL, 751056929UL, 2442147201UL, 1781170563UL, 765377308UL, 961452970UL, 4247303973UL, 2233034754UL, 86997820UL, 3495561473UL, 3075957349UL, 3152032365UL, 1220657606UL, 708134514UL, 26714613UL, 3749542051UL, 1640668224UL, 2252760600UL, 1635050662UL, 947216628UL, 3612773344UL, 4089189500UL, +3647048119UL, 979491227UL, 4149824933UL, 3160885292UL, 2808843788UL, 998859510UL, 3903167193UL, 1728999561UL, 3673946130UL, 279338980UL, 2507635299UL, 1614929524UL, 302060483UL, 2874453052UL, 3798613814UL, 2013436766UL, 3514754020UL, 2923162106UL, 2658720327UL, 3498579091UL, 3292220096UL, 3796129102UL, 1907288796UL, 2820663603UL, 4276052248UL, 247755133UL, 2088596201UL, 3154955976UL, 3309397641UL, 3606171919UL, 1356791029UL, 1030266022UL, +}, +{ +3868946146UL, 1938156793UL, 1877502872UL, 1408917625UL, 1549117911UL, 2465501566UL, 4218547770UL, 2942249332UL, 2731789075UL, 2366036899UL, 1312641799UL, 2243363271UL, 2238839307UL, 384814263UL, 1552361757UL, 3521369641UL, 431721717UL, 3089625732UL, 1023760034UL, 53847139UL, 2240881978UL, 3178046414UL, 145135653UL, 1580878781UL, 3500228040UL, 3360910006UL, 3285542950UL, 3330062556UL, 2870158227UL, 1481496810UL, 4222704363UL, 2973046526UL, +435155769UL, 3234730070UL, 3306545960UL, 2539776908UL, 3991420334UL, 125389349UL, 2397544348UL, 2504790975UL, 886432257UL, 1804136430UL, 1506551086UL, 219847214UL, 890282686UL, 1489840806UL, 2536942497UL, 87527661UL, 1822718904UL, 3984956867UL, 2334419518UL, 4065487054UL, 992104547UL, 1566792845UL, 1068226712UL, 2622731799UL, 921431708UL, 2833392639UL, 640267449UL, 324907409UL, 3911698049UL, 2108189994UL, 1623761598UL, 52771719UL, +467926435UL, 2811768106UL, 3760723083UL, 906402727UL, 3438479463UL, 2064004404UL, 988123982UL, 563076447UL, 2979641383UL, 1366086397UL, 2078608605UL, 3868491514UL, 1077957067UL, 615363273UL, 1388831706UL, 1586480552UL, 4216838311UL, 3587550780UL, 2057048927UL, 2814838921UL, 2454041809UL, 180612020UL, 930406098UL, 4286819113UL, 2756562967UL, 3404265234UL, 3844482428UL, 467484533UL, 4122644954UL, 3517116598UL, 1887163240UL, 4217569180UL, +4191149652UL, 2756931330UL, 3702787956UL, 152166773UL, 146763911UL, 536678737UL, 481385008UL, 3681433244UL, 1194909733UL, 3713568496UL, 3927837202UL, 846842608UL, 687314083UL, 1144793694UL, 1062075916UL, 3017627145UL, 1296695243UL, 981862419UL, 2363304726UL, 3242788356UL, 3359957762UL, 4249190787UL, 1697910336UL, 3286799886UL, 1063822293UL, 3246091430UL, 743808559UL, 2137668568UL, 2812072749UL, 2303791182UL, 3161789548UL, 2911126624UL, +4087873192UL, 1813622227UL, 1272618849UL, 1882292328UL, 3861455677UL, 2921641470UL, 3079812494UL, 2814569163UL, 1975646942UL, 2826176621UL, 1896904368UL, 831552834UL, 2935863403UL, 449217054UL, 3688067832UL, 1048877596UL, 1613227043UL, 553867520UL, 3682575786UL, 3058863948UL, 4200858129UL, 4131625UL, 2434123776UL, 2235627905UL, 2905358693UL, 3429312266UL, 3363231514UL, 1182242507UL, 2792234422UL, 1843330053UL, 4192875151UL, 1088813348UL, +357805687UL, 3868946146UL, 1938156793UL, 1877502872UL, 1408917625UL, 30638250UL, 2465501566UL, 4218547770UL, 2942249332UL, 2731789075UL, 448998968UL, 1312641799UL, 2243363271UL, 2238839307UL, 384814263UL, 2229663001UL, 3521369641UL, 431721717UL, 3089625732UL, 1023760034UL, 790771414UL, 2240881978UL, 3178046414UL, 145135653UL, 1580878781UL, 847577516UL, 3360910006UL, 3285542950UL, 3330062556UL, 2870158227UL, 112738978UL, 4222704363UL, +2973046526UL, 435155769UL, 3234730070UL, 1135073835UL, 2539776908UL, 3991420334UL, 125389349UL, 2397544348UL, 1243128255UL, 886432257UL, 1804136430UL, 1506551086UL, 219847214UL, 875051553UL, 1489840806UL, 2536942497UL, 87527661UL, 1822718904UL, 1883615145UL, 2334419518UL, 4065487054UL, 992104547UL, 1566792845UL, 1037132511UL, 2622731799UL, 921431708UL, 2833392639UL, 640267449UL, 504304037UL, 3911698049UL, 2108189994UL, 1623761598UL, +52771719UL, 3969520254UL, 2811768106UL, 3760723083UL, 906402727UL, 3438479463UL, 3707538496UL, 988123982UL, 563076447UL, 2979641383UL, 1366086397UL, 3577913613UL, 3868491514UL, 1077957067UL, 615363273UL, 1388831706UL, 903353909UL, 4216838311UL, 3587550780UL, 2057048927UL, 2814838921UL, 3532304828UL, 180612020UL, 930406098UL, 4286819113UL, 2756562967UL, 1950528802UL, 3844482428UL, 467484533UL, 4122644954UL, 3517116598UL, 139409766UL, +4217569180UL, 4191149652UL, 2756931330UL, 3702787956UL, 504815033UL, 146763911UL, 536678737UL, 481385008UL, 3681433244UL, 2166865052UL, 3713568496UL, 3927837202UL, 846842608UL, 687314083UL, 135403542UL, 1062075916UL, 3017627145UL, 1296695243UL, 981862419UL, 2405232584UL, 3242788356UL, 3359957762UL, 4249190787UL, 1697910336UL, 3517294012UL, 1063822293UL, 3246091430UL, 743808559UL, 2137668568UL, 2962825355UL, 2303791182UL, 3161789548UL, +2911126624UL, 4087873192UL, 2344237973UL, 1272618849UL, 1882292328UL, 3861455677UL, 2921641470UL, 1062672856UL, 2814569163UL, 1975646942UL, 2826176621UL, 1896904368UL, 3172875195UL, 2935863403UL, 449217054UL, 3688067832UL, 1048877596UL, 983648949UL, 553867520UL, 3682575786UL, 3058863948UL, 4200858129UL, 2552994282UL, 2434123776UL, 2235627905UL, 2905358693UL, 3429312266UL, 461707508UL, 1182242507UL, 2792234422UL, 1843330053UL, 4192875151UL, +2557078297UL, 357805687UL, 3868946146UL, 1938156793UL, 1877502872UL, 1178921294UL, 30638250UL, 2465501566UL, 4218547770UL, 2942249332UL, 2597087237UL, 448998968UL, 1312641799UL, 2243363271UL, 2238839307UL, 3465588695UL, 2229663001UL, 3521369641UL, 431721717UL, 3089625732UL, 2420359327UL, 790771414UL, 2240881978UL, 3178046414UL, 145135653UL, 3411014139UL, 847577516UL, 3360910006UL, 3285542950UL, 3330062556UL, 4257518865UL, 112738978UL, +4222704363UL, 2973046526UL, 435155769UL, 1154160505UL, 1135073835UL, 2539776908UL, 3991420334UL, 125389349UL, 1396475349UL, 1243128255UL, 886432257UL, 1804136430UL, 1506551086UL, 3727497731UL, 875051553UL, 1489840806UL, 2536942497UL, 87527661UL, 2521823325UL, 1883615145UL, 2334419518UL, 4065487054UL, 992104547UL, 3431387970UL, 1037132511UL, 2622731799UL, 921431708UL, 2833392639UL, 780276883UL, 504304037UL, 3911698049UL, 2108189994UL, +1623761598UL, 1832564202UL, 3969520254UL, 2811768106UL, 3760723083UL, 906402727UL, 2319993554UL, 3707538496UL, 988123982UL, 563076447UL, 2979641383UL, 3703509163UL, 3577913613UL, 3868491514UL, 1077957067UL, 615363273UL, 3925135746UL, 903353909UL, 4216838311UL, 3587550780UL, 2057048927UL, 2129250845UL, 3532304828UL, 180612020UL, 930406098UL, 4286819113UL, 571849466UL, 1950528802UL, 3844482428UL, 467484533UL, 4122644954UL, 3696836546UL, +139409766UL, 4217569180UL, 4191149652UL, 2756931330UL, 84389584UL, 504815033UL, 146763911UL, 536678737UL, 481385008UL, 281139563UL, 2166865052UL, 3713568496UL, 3927837202UL, 846842608UL, 2123715146UL, 135403542UL, 1062075916UL, 3017627145UL, 1296695243UL, 4206227732UL, 2405232584UL, 3242788356UL, 3359957762UL, 4249190787UL, 2766470555UL, 3517294012UL, 1063822293UL, 3246091430UL, 743808559UL, 2821229002UL, 2962825355UL, 2303791182UL, +3161789548UL, 2911126624UL, 503886017UL, 2344237973UL, 1272618849UL, 1882292328UL, 3861455677UL, 4158985014UL, 1062672856UL, 2814569163UL, 1975646942UL, 2826176621UL, 4118784229UL, 3172875195UL, 2935863403UL, 449217054UL, 3688067832UL, 3556237148UL, 983648949UL, 553867520UL, 3682575786UL, 3058863948UL, 3200838331UL, 2552994282UL, 2434123776UL, 2235627905UL, 2905358693UL, 4178312045UL, 461707508UL, 1182242507UL, 2792234422UL, 1843330053UL, +3597816691UL, 2557078297UL, 357805687UL, 3868946146UL, 1938156793UL, 2168462050UL, 1178921294UL, 30638250UL, 2465501566UL, 4218547770UL, 4101101381UL, 2597087237UL, 448998968UL, 1312641799UL, 2243363271UL, 313553894UL, 3465588695UL, 2229663001UL, 3521369641UL, 431721717UL, 737541534UL, 2420359327UL, 790771414UL, 2240881978UL, 3178046414UL, 326569272UL, 3411014139UL, 847577516UL, 3360910006UL, 3285542950UL, 3098408987UL, 4257518865UL, +112738978UL, 4222704363UL, 2973046526UL, 3668411828UL, 1154160505UL, 1135073835UL, 2539776908UL, 3991420334UL, 2902976896UL, 1396475349UL, 1243128255UL, 886432257UL, 1804136430UL, 2162242501UL, 3727497731UL, 875051553UL, 1489840806UL, 2536942497UL, 2238214198UL, 2521823325UL, 1883615145UL, 2334419518UL, 4065487054UL, 1081167745UL, 3431387970UL, 1037132511UL, 2622731799UL, 921431708UL, 2612105434UL, 780276883UL, 504304037UL, 3911698049UL, +2108189994UL, 2518535877UL, 1832564202UL, 3969520254UL, 2811768106UL, 3760723083UL, 2894544992UL, 2319993554UL, 3707538496UL, 988123982UL, 563076447UL, 719340658UL, 3703509163UL, 3577913613UL, 3868491514UL, 1077957067UL, 2371417985UL, 3925135746UL, 903353909UL, 4216838311UL, 3587550780UL, 3146473377UL, 2129250845UL, 3532304828UL, 180612020UL, 930406098UL, 1054512059UL, 571849466UL, 1950528802UL, 3844482428UL, 467484533UL, 1437844285UL, +3696836546UL, 139409766UL, 4217569180UL, 4191149652UL, 1161452915UL, 84389584UL, 504815033UL, 146763911UL, 536678737UL, 3965987378UL, 281139563UL, 2166865052UL, 3713568496UL, 3927837202UL, 2566873330UL, 2123715146UL, 135403542UL, 1062075916UL, 3017627145UL, 3204726297UL, 4206227732UL, 2405232584UL, 3242788356UL, 3359957762UL, 2338319494UL, 2766470555UL, 3517294012UL, 1063822293UL, 3246091430UL, 1531757306UL, 2821229002UL, 2962825355UL, +2303791182UL, 3161789548UL, 2778326467UL, 503886017UL, 2344237973UL, 1272618849UL, 1882292328UL, 1725075819UL, 4158985014UL, 1062672856UL, 2814569163UL, 1975646942UL, 3822868823UL, 4118784229UL, 3172875195UL, 2935863403UL, 449217054UL, 2465297154UL, 3556237148UL, 983648949UL, 553867520UL, 3682575786UL, 4023654874UL, 3200838331UL, 2552994282UL, 2434123776UL, 2235627905UL, 3063253867UL, 4178312045UL, 461707508UL, 1182242507UL, 2792234422UL, +3673318927UL, 1249828417UL, 2772427670UL, 1052324962UL, 3106530204UL, 2843183862UL, 630633945UL, 4140139503UL, 1659674037UL, 1096812757UL, 1376150732UL, 2328468653UL, 1410746620UL, 4025107990UL, 3335632421UL, 2754906610UL, 1615859006UL, 285467698UL, 4013475548UL, 1287384555UL, 1191111485UL, 1999165134UL, 2396354947UL, 1628158236UL, 3586708909UL, 228664781UL, 2501369720UL, 2516229872UL, 2977432606UL, 1745869751UL, 750661412UL, 1142144084UL, +2705268946UL, 1728488244UL, 589587862UL, 3604281130UL, 3217245915UL, 2061424631UL, 1918958878UL, 1162850007UL, 438550637UL, 1774088146UL, 3237803593UL, 827476363UL, 404982536UL, 2344744845UL, 3416436851UL, 369597250UL, 287618335UL, 1349740180UL, 3489688427UL, 417859991UL, 3229729092UL, 3214122057UL, 3955335849UL, 3014669381UL, 2178319957UL, 1259991234UL, 2689513541UL, 2628816894UL, 3734652479UL, 4202568782UL, 3149274749UL, 497295490UL, +3427602420UL, 3229774907UL, 59257138UL, 856364156UL, 429586733UL, 1800559699UL, 1300239050UL, 1311125646UL, 257421988UL, 3749074142UL, 1648939149UL, 1914174865UL, 105489877UL, 3599116888UL, 2695725484UL, 1543985792UL, 3210070699UL, 1867126432UL, 3088920410UL, 953084407UL, 2185095866UL, 1427606476UL, 1572442276UL, 3322674991UL, 3578824788UL, 1156246244UL, 2938200612UL, 3409545464UL, 215820858UL, 2279282461UL, 3861049095UL, 1589517366UL, +208707366UL, 2741570297UL, 440313302UL, 864288468UL, 1564945290UL, 1050929272UL, 3037450392UL, 1101323242UL, 1200278943UL, 3005564105UL, 3847988630UL, 3251750599UL, 2608433412UL, 3106720723UL, 1522694503UL, 3857782840UL, 4282681349UL, 2229263718UL, 4106780914UL, 125648941UL, 1933617693UL, 2971178569UL, 3537872030UL, 448962137UL, 652123777UL, 2393871920UL, 3938047691UL, 244410098UL, 3110791961UL, 3122318189UL, 877378106UL, 3683644255UL, +4279094311UL, 3638987055UL, 667681197UL, 1679868535UL, 1938378101UL, 1331340184UL, 734163051UL, 3409564713UL, 955108672UL, 3969637663UL, 156515523UL, 1871394552UL, 590275639UL, 3237133664UL, 898438533UL, 2291347006UL, 644781653UL, 3575493549UL, 1206698159UL, 2484805619UL, 2931447110UL, 2411269190UL, 3866437145UL, 161562563UL, 3077166456UL, 792874130UL, 3193406610UL, 2500233218UL, 596837225UL, 3667458052UL, 3239960816UL, 2271901243UL, +}, +{ +3975736867UL, 2402230281UL, 4092718962UL, 3100052505UL, 3277909563UL, 2827154828UL, 1067483357UL, 3495429909UL, 426635932UL, 2702495453UL, 725679489UL, 3705541400UL, 1308182381UL, 27549785UL, 3000675918UL, 2982141597UL, 1090931027UL, 755020243UL, 3986354189UL, 2529541113UL, 452574019UL, 2384876926UL, 2147764179UL, 1360907484UL, 2072364695UL, 3034185952UL, 2765119653UL, 3279755577UL, 3828140333UL, 582568392UL, 4228353628UL, 701214306UL, +2460043371UL, 3943376509UL, 2443090800UL, 2481277520UL, 859309333UL, 2928621220UL, 1933644685UL, 3803162893UL, 3310629548UL, 2361261213UL, 790233558UL, 2517540072UL, 2823327610UL, 2952921690UL, 3295251862UL, 1089451775UL, 2637751681UL, 1648031370UL, 1343061717UL, 2355026672UL, 67684812UL, 4019593497UL, 2636283634UL, 1051433451UL, 51111285UL, 15338687UL, 3779021741UL, 3987886044UL, 70037785UL, 2009147353UL, 4236701871UL, 928261128UL, +2185183571UL, 2793993680UL, 2975111058UL, 3730415022UL, 3316612678UL, 823585671UL, 4153354125UL, 509071385UL, 2056228251UL, 4034784810UL, 96820040UL, 169863045UL, 932848332UL, 2282651407UL, 747279843UL, 1387211022UL, 2410099142UL, 3394315084UL, 3191572807UL, 4073182500UL, 3768455462UL, 3712420663UL, 3000991259UL, 249137656UL, 2477445202UL, 3952155443UL, 392730170UL, 4208559971UL, 24751401UL, 661761054UL, 1574175475UL, 2715927647UL, +985309803UL, 2570053358UL, 619269634UL, 3890591314UL, 1129119636UL, 3133886450UL, 328788870UL, 3449809720UL, 1380118080UL, 2719792059UL, 691527418UL, 3487733607UL, 3819095050UL, 3367871088UL, 709089170UL, 1057897966UL, 1938975941UL, 4082466714UL, 251564920UL, 3083496965UL, 1040123365UL, 295024253UL, 2788334176UL, 3430095934UL, 3641758945UL, 2029993123UL, 3231254260UL, 150555625UL, 2270671577UL, 2032382533UL, 2088497043UL, 1392075576UL, +644811077UL, 2122632989UL, 3224165725UL, 1571908345UL, 2558692460UL, 1493305706UL, 4064652450UL, 448105905UL, 699188129UL, 2017324335UL, 4286307548UL, 2415725473UL, 3976741021UL, 3526784185UL, 2882973520UL, 3420335125UL, 2034028744UL, 1425242390UL, 982315917UL, 2614735561UL, 2439972944UL, 2518992720UL, 3792239985UL, 3260669732UL, 2586472751UL, 3432756715UL, 1318634102UL, 3722487277UL, 3037304631UL, 433233786UL, 3750002877UL, 2504731459UL, +1111327015UL, 3975736867UL, 2402230281UL, 4092718962UL, 3100052505UL, 3521430425UL, 2827154828UL, 1067483357UL, 3495429909UL, 426635932UL, 2034644068UL, 725679489UL, 3705541400UL, 1308182381UL, 27549785UL, 3001720496UL, 2982141597UL, 1090931027UL, 755020243UL, 3986354189UL, 307638580UL, 452574019UL, 2384876926UL, 2147764179UL, 1360907484UL, 1701580099UL, 3034185952UL, 2765119653UL, 3279755577UL, 3828140333UL, 2659043235UL, 4228353628UL, +701214306UL, 2460043371UL, 3943376509UL, 2084857792UL, 2481277520UL, 859309333UL, 2928621220UL, 1933644685UL, 4152646669UL, 3310629548UL, 2361261213UL, 790233558UL, 2517540072UL, 481283060UL, 2952921690UL, 3295251862UL, 1089451775UL, 2637751681UL, 2915212660UL, 1343061717UL, 2355026672UL, 67684812UL, 4019593497UL, 3290479436UL, 1051433451UL, 51111285UL, 15338687UL, 3779021741UL, 1430944862UL, 70037785UL, 2009147353UL, 4236701871UL, +928261128UL, 2063919641UL, 2793993680UL, 2975111058UL, 3730415022UL, 3316612678UL, 2373806232UL, 4153354125UL, 509071385UL, 2056228251UL, 4034784810UL, 1912268707UL, 169863045UL, 932848332UL, 2282651407UL, 747279843UL, 3712980941UL, 2410099142UL, 3394315084UL, 3191572807UL, 4073182500UL, 4262344652UL, 3712420663UL, 3000991259UL, 249137656UL, 2477445202UL, 3374467273UL, 392730170UL, 4208559971UL, 24751401UL, 661761054UL, 1670592959UL, +2715927647UL, 985309803UL, 2570053358UL, 619269634UL, 830547082UL, 1129119636UL, 3133886450UL, 328788870UL, 3449809720UL, 202644333UL, 2719792059UL, 691527418UL, 3487733607UL, 3819095050UL, 1400269159UL, 709089170UL, 1057897966UL, 1938975941UL, 4082466714UL, 3393893128UL, 3083496965UL, 1040123365UL, 295024253UL, 2788334176UL, 1219456UL, 3641758945UL, 2029993123UL, 3231254260UL, 150555625UL, 3713963210UL, 2032382533UL, 2088497043UL, +1392075576UL, 644811077UL, 3733090890UL, 3224165725UL, 1571908345UL, 2558692460UL, 1493305706UL, 1678929187UL, 448105905UL, 699188129UL, 2017324335UL, 4286307548UL, 3368868963UL, 3976741021UL, 3526784185UL, 2882973520UL, 3420335125UL, 3233347584UL, 1425242390UL, 982315917UL, 2614735561UL, 2439972944UL, 4172908214UL, 3792239985UL, 3260669732UL, 2586472751UL, 3432756715UL, 1926157640UL, 3722487277UL, 3037304631UL, 433233786UL, 3750002877UL, +625648993UL, 1111327015UL, 3975736867UL, 2402230281UL, 4092718962UL, 1349560774UL, 3521430425UL, 2827154828UL, 1067483357UL, 3495429909UL, 2808148912UL, 2034644068UL, 725679489UL, 3705541400UL, 1308182381UL, 212242504UL, 3001720496UL, 2982141597UL, 1090931027UL, 755020243UL, 2510536004UL, 307638580UL, 452574019UL, 2384876926UL, 2147764179UL, 3227931749UL, 1701580099UL, 3034185952UL, 2765119653UL, 3279755577UL, 1054678914UL, 2659043235UL, +4228353628UL, 701214306UL, 2460043371UL, 381309305UL, 2084857792UL, 2481277520UL, 859309333UL, 2928621220UL, 891630344UL, 4152646669UL, 3310629548UL, 2361261213UL, 790233558UL, 1490030690UL, 481283060UL, 2952921690UL, 3295251862UL, 1089451775UL, 2025962691UL, 2915212660UL, 1343061717UL, 2355026672UL, 67684812UL, 2217081575UL, 3290479436UL, 1051433451UL, 51111285UL, 15338687UL, 3455020635UL, 1430944862UL, 70037785UL, 2009147353UL, +4236701871UL, 1155691935UL, 2063919641UL, 2793993680UL, 2975111058UL, 3730415022UL, 403147571UL, 2373806232UL, 4153354125UL, 509071385UL, 2056228251UL, 444685935UL, 1912268707UL, 169863045UL, 932848332UL, 2282651407UL, 2077207745UL, 3712980941UL, 2410099142UL, 3394315084UL, 3191572807UL, 640536184UL, 4262344652UL, 3712420663UL, 3000991259UL, 249137656UL, 368243227UL, 3374467273UL, 392730170UL, 4208559971UL, 24751401UL, 495648080UL, +1670592959UL, 2715927647UL, 985309803UL, 2570053358UL, 2181488546UL, 830547082UL, 1129119636UL, 3133886450UL, 328788870UL, 2497762979UL, 202644333UL, 2719792059UL, 691527418UL, 3487733607UL, 1976943620UL, 1400269159UL, 709089170UL, 1057897966UL, 1938975941UL, 2071351862UL, 3393893128UL, 3083496965UL, 1040123365UL, 295024253UL, 1440317859UL, 1219456UL, 3641758945UL, 2029993123UL, 3231254260UL, 952956380UL, 3713963210UL, 2032382533UL, +2088497043UL, 1392075576UL, 4180475645UL, 3733090890UL, 3224165725UL, 1571908345UL, 2558692460UL, 3482549931UL, 1678929187UL, 448105905UL, 699188129UL, 2017324335UL, 2431113987UL, 3368868963UL, 3976741021UL, 3526784185UL, 2882973520UL, 1900625235UL, 3233347584UL, 1425242390UL, 982315917UL, 2614735561UL, 1128074864UL, 4172908214UL, 3792239985UL, 3260669732UL, 2586472751UL, 4095880420UL, 1926157640UL, 3722487277UL, 3037304631UL, 433233786UL, +2927295412UL, 625648993UL, 1111327015UL, 3975736867UL, 2402230281UL, 259216032UL, 1349560774UL, 3521430425UL, 2827154828UL, 1067483357UL, 989690947UL, 2808148912UL, 2034644068UL, 725679489UL, 3705541400UL, 588787520UL, 212242504UL, 3001720496UL, 2982141597UL, 1090931027UL, 1235811382UL, 2510536004UL, 307638580UL, 452574019UL, 2384876926UL, 3536994565UL, 3227931749UL, 1701580099UL, 3034185952UL, 2765119653UL, 463890041UL, 1054678914UL, +2659043235UL, 4228353628UL, 701214306UL, 3085494195UL, 381309305UL, 2084857792UL, 2481277520UL, 859309333UL, 3760199179UL, 891630344UL, 4152646669UL, 3310629548UL, 2361261213UL, 2550680915UL, 1490030690UL, 481283060UL, 2952921690UL, 3295251862UL, 4195487760UL, 2025962691UL, 2915212660UL, 1343061717UL, 2355026672UL, 339445869UL, 2217081575UL, 3290479436UL, 1051433451UL, 51111285UL, 1113202216UL, 3455020635UL, 1430944862UL, 70037785UL, +2009147353UL, 3982848623UL, 1155691935UL, 2063919641UL, 2793993680UL, 2975111058UL, 1725337613UL, 403147571UL, 2373806232UL, 4153354125UL, 509071385UL, 1474832043UL, 444685935UL, 1912268707UL, 169863045UL, 932848332UL, 1500855137UL, 2077207745UL, 3712980941UL, 2410099142UL, 3394315084UL, 2800379966UL, 640536184UL, 4262344652UL, 3712420663UL, 3000991259UL, 1028021485UL, 368243227UL, 3374467273UL, 392730170UL, 4208559971UL, 108468246UL, +495648080UL, 1670592959UL, 2715927647UL, 985309803UL, 61959589UL, 2181488546UL, 830547082UL, 1129119636UL, 3133886450UL, 3912020361UL, 2497762979UL, 202644333UL, 2719792059UL, 691527418UL, 1984193076UL, 1976943620UL, 1400269159UL, 709089170UL, 1057897966UL, 2381612490UL, 2071351862UL, 3393893128UL, 3083496965UL, 1040123365UL, 391784014UL, 1440317859UL, 1219456UL, 3641758945UL, 2029993123UL, 2260373342UL, 952956380UL, 3713963210UL, +2032382533UL, 2088497043UL, 135943164UL, 4180475645UL, 3733090890UL, 3224165725UL, 1571908345UL, 2660287325UL, 3482549931UL, 1678929187UL, 448105905UL, 699188129UL, 4104693318UL, 2431113987UL, 3368868963UL, 3976741021UL, 3526784185UL, 113762138UL, 1900625235UL, 3233347584UL, 1425242390UL, 982315917UL, 599246177UL, 1128074864UL, 4172908214UL, 3792239985UL, 3260669732UL, 2309689974UL, 4095880420UL, 1926157640UL, 3722487277UL, 3037304631UL, +3765223460UL, 866296319UL, 1169380319UL, 2919436659UL, 3370646420UL, 1866719277UL, 3226685069UL, 4252262342UL, 1835269960UL, 1170376930UL, 1357078768UL, 269175192UL, 3826888026UL, 3430363541UL, 1920758494UL, 51532769UL, 2919489927UL, 1568325914UL, 3184357856UL, 43519013UL, 2108988015UL, 1398495041UL, 2844640139UL, 2317092036UL, 1774750014UL, 2690907136UL, 1834465421UL, 1106469655UL, 2149810726UL, 4265420439UL, 2048218411UL, 1399986034UL, +1361619115UL, 2504769226UL, 913700780UL, 2382994726UL, 4292849877UL, 1381838410UL, 250258264UL, 1828569640UL, 1732718872UL, 1869949326UL, 835188347UL, 4180489913UL, 3049522050UL, 535168392UL, 3972173823UL, 2763844722UL, 3401884753UL, 3750694101UL, 851518496UL, 1015521371UL, 1511969218UL, 1597622074UL, 3810841601UL, 3326003776UL, 3141062630UL, 552856274UL, 4059179808UL, 175647012UL, 3893497501UL, 1805118717UL, 1064213711UL, 2310866839UL, +1397146463UL, 1798096676UL, 279868399UL, 1926726615UL, 2773068510UL, 347721208UL, 4099183723UL, 509136218UL, 2833615756UL, 3960499694UL, 4236258712UL, 1765641675UL, 535748563UL, 354515646UL, 3307314159UL, 3160079941UL, 3252681800UL, 2568363625UL, 3818514182UL, 3738662353UL, 899056999UL, 2531772068UL, 647726503UL, 2895823632UL, 393777910UL, 1759531813UL, 2363148604UL, 2931477989UL, 3381169914UL, 3877595131UL, 2375539210UL, 557544627UL, +273611522UL, 2717517554UL, 1935966767UL, 1738732887UL, 29153600UL, 20993454UL, 3758163226UL, 1692844400UL, 2176938194UL, 378940221UL, 2888599759UL, 1173120554UL, 2732575460UL, 3912766812UL, 522606644UL, 1925230852UL, 3887440328UL, 2111843275UL, 3549473366UL, 922916775UL, 2889744544UL, 2970467682UL, 3039277863UL, 990580154UL, 55435595UL, 1665634070UL, 3043418336UL, 2792050230UL, 2762503138UL, 1402344059UL, 2099263558UL, 3945248675UL, +3925566467UL, 2413979948UL, 463637252UL, 3768636616UL, 3374572388UL, 2217956879UL, 791988933UL, 382210765UL, 1715859444UL, 3462446413UL, 971427992UL, 3255404695UL, 2001750035UL, 2214129237UL, 320812374UL, 3688098101UL, 920365480UL, 2819401059UL, 2932570681UL, 3749857130UL, 523943786UL, 1271514748UL, 4078439472UL, 3501181265UL, 2475869985UL, 1797996951UL, 2300820710UL, 3994893924UL, 1739992082UL, 2475950326UL, 3780826558UL, 1018851411UL, +}, + +}; +#ifndef __CUDACC_RTC__ +CURAND_XORWOW_PRECALCULATED_HOST_QUALIFIERS unsigned int precalc_xorwow_matrix_host[32][800] = { +{ +850664906UL, 2293210629UL, 1517805917UL, 1215500405UL, 1612415445UL, 645388200UL, 824349799UL, 3517232886UL, 4075591755UL, 3089899292UL, 4249786064UL, 3811424903UL, 1100783479UL, 53649761UL, 2817264826UL, 3159462529UL, 1654848550UL, 950025444UL, 3095510002UL, 4080567211UL, 4111078399UL, 3241719305UL, 2788212779UL, 4256963770UL, 2426893717UL, 4190211142UL, 1420776905UL, 3780537969UL, 1102912875UL, 1657948873UL, 3354905256UL, 2519610308UL, +515777663UL, 3396785394UL, 1832603711UL, 1154211550UL, 1915690212UL, 1933919046UL, 789578337UL, 337961173UL, 1359089498UL, 2249086205UL, 3417955173UL, 862571348UL, 528120760UL, 1265685672UL, 1970052076UL, 3585976752UL, 3645339918UL, 312171257UL, 1360991400UL, 1994321680UL, 2327168468UL, 2540437053UL, 1180483641UL, 2217962701UL, 182726833UL, 590204372UL, 1904496495UL, 2545607041UL, 3697978033UL, 1084030545UL, 3397906968UL, 2192325323UL, +2704204176UL, 1069092002UL, 2364406907UL, 1578647245UL, 3561974633UL, 3437665426UL, 1464127305UL, 1616628807UL, 2243114101UL, 3639967880UL, 1702613633UL, 2437350057UL, 39991274UL, 2024323584UL, 3795072940UL, 3604530798UL, 443099203UL, 643536212UL, 1919517328UL, 3931285769UL, 427935569UL, 276421624UL, 2492081750UL, 262729512UL, 3088549877UL, 2922650665UL, 1816283755UL, 4246096489UL, 842575914UL, 1460435650UL, 3050522190UL, 2640849794UL, +3697925816UL, 3465779075UL, 3856929655UL, 1365559780UL, 2897029415UL, 2747033756UL, 3611830629UL, 1891542518UL, 1897590206UL, 437451803UL, 677924906UL, 123809117UL, 3940574372UL, 687640291UL, 3488484529UL, 470218446UL, 1092571016UL, 1537938503UL, 1073323937UL, 611300083UL, 3809285994UL, 3975678726UL, 925845389UL, 2514775760UL, 2859302390UL, 2761919483UL, 993285307UL, 164095287UL, 3736193671UL, 2078946336UL, 1418537059UL, 1202525920UL, +4234029440UL, 1313593624UL, 2484428922UL, 1833969372UL, 661495122UL, 2217907395UL, 2795045321UL, 2950835531UL, 1402379354UL, 351314168UL, 1902476749UL, 1914974334UL, 2873973176UL, 1321203603UL, 3316118265UL, 3282193947UL, 1342191737UL, 793441242UL, 3281524559UL, 296088733UL, 487851702UL, 712098215UL, 1388727135UL, 1705533557UL, 3557800292UL, 399729516UL, 1355829467UL, 291276309UL, 421164833UL, 1318404599UL, 2064519128UL, 1161612642UL, +2076623594UL, 850664906UL, 2293210629UL, 1517805917UL, 1215500405UL, 3847487204UL, 645388200UL, 824349799UL, 3517232886UL, 4075591755UL, 2755872609UL, 4249786064UL, 3811424903UL, 1100783479UL, 53649761UL, 1417544262UL, 3159462529UL, 1654848550UL, 950025444UL, 3095510002UL, 1908900347UL, 4111078399UL, 3241719305UL, 2788212779UL, 4256963770UL, 3750258343UL, 4190211142UL, 1420776905UL, 3780537969UL, 1102912875UL, 1690550UL, 3354905256UL, +2519610308UL, 515777663UL, 3396785394UL, 2658162202UL, 1154211550UL, 1915690212UL, 1933919046UL, 789578337UL, 189880016UL, 1359089498UL, 2249086205UL, 3417955173UL, 862571348UL, 998719835UL, 1265685672UL, 1970052076UL, 3585976752UL, 3645339918UL, 2973042959UL, 1360991400UL, 1994321680UL, 2327168468UL, 2540437053UL, 2283905032UL, 2217962701UL, 182726833UL, 590204372UL, 1904496495UL, 110719262UL, 3697978033UL, 1084030545UL, 3397906968UL, +2192325323UL, 4133333579UL, 1069092002UL, 2364406907UL, 1578647245UL, 3561974633UL, 3629845331UL, 1464127305UL, 1616628807UL, 2243114101UL, 3639967880UL, 3256744141UL, 2437350057UL, 39991274UL, 2024323584UL, 3795072940UL, 1024703328UL, 443099203UL, 643536212UL, 1919517328UL, 3931285769UL, 2755167056UL, 276421624UL, 2492081750UL, 262729512UL, 3088549877UL, 2817867653UL, 1816283755UL, 4246096489UL, 842575914UL, 1460435650UL, 2276077438UL, +2640849794UL, 3697925816UL, 3465779075UL, 3856929655UL, 130551477UL, 2897029415UL, 2747033756UL, 3611830629UL, 1891542518UL, 804565809UL, 437451803UL, 677924906UL, 123809117UL, 3940574372UL, 2446610749UL, 3488484529UL, 470218446UL, 1092571016UL, 1537938503UL, 1502147484UL, 611300083UL, 3809285994UL, 3975678726UL, 925845389UL, 872826112UL, 2859302390UL, 2761919483UL, 993285307UL, 164095287UL, 3901654538UL, 2078946336UL, 1418537059UL, +1202525920UL, 4234029440UL, 704759480UL, 2484428922UL, 1833969372UL, 661495122UL, 2217907395UL, 3287413716UL, 2950835531UL, 1402379354UL, 351314168UL, 1902476749UL, 2033316109UL, 2873973176UL, 1321203603UL, 3316118265UL, 3282193947UL, 1316780684UL, 793441242UL, 3281524559UL, 296088733UL, 487851702UL, 314311643UL, 1388727135UL, 1705533557UL, 3557800292UL, 399729516UL, 1660074989UL, 291276309UL, 421164833UL, 1318404599UL, 2064519128UL, +3156334112UL, 2076623594UL, 850664906UL, 2293210629UL, 1517805917UL, 335452425UL, 3847487204UL, 645388200UL, 824349799UL, 3517232886UL, 954487767UL, 2755872609UL, 4249786064UL, 3811424903UL, 1100783479UL, 3408594583UL, 1417544262UL, 3159462529UL, 1654848550UL, 950025444UL, 324339737UL, 1908900347UL, 4111078399UL, 3241719305UL, 2788212779UL, 1890540205UL, 3750258343UL, 4190211142UL, 1420776905UL, 3780537969UL, 3716648585UL, 1690550UL, +3354905256UL, 2519610308UL, 515777663UL, 3758156132UL, 2658162202UL, 1154211550UL, 1915690212UL, 1933919046UL, 844149171UL, 189880016UL, 1359089498UL, 2249086205UL, 3417955173UL, 1031812215UL, 998719835UL, 1265685672UL, 1970052076UL, 3585976752UL, 3174204115UL, 2973042959UL, 1360991400UL, 1994321680UL, 2327168468UL, 714016907UL, 2283905032UL, 2217962701UL, 182726833UL, 590204372UL, 2151450260UL, 110719262UL, 3697978033UL, 1084030545UL, +3397906968UL, 767772303UL, 4133333579UL, 1069092002UL, 2364406907UL, 1578647245UL, 42955292UL, 3629845331UL, 1464127305UL, 1616628807UL, 2243114101UL, 3222189776UL, 3256744141UL, 2437350057UL, 39991274UL, 2024323584UL, 3142424684UL, 1024703328UL, 443099203UL, 643536212UL, 1919517328UL, 918511196UL, 2755167056UL, 276421624UL, 2492081750UL, 262729512UL, 4246877536UL, 2817867653UL, 1816283755UL, 4246096489UL, 842575914UL, 1425765936UL, +2276077438UL, 2640849794UL, 3697925816UL, 3465779075UL, 1491702526UL, 130551477UL, 2897029415UL, 2747033756UL, 3611830629UL, 1844578694UL, 804565809UL, 437451803UL, 677924906UL, 123809117UL, 3419189841UL, 2446610749UL, 3488484529UL, 470218446UL, 1092571016UL, 3272535988UL, 1502147484UL, 611300083UL, 3809285994UL, 3975678726UL, 2853681168UL, 872826112UL, 2859302390UL, 2761919483UL, 993285307UL, 1434560128UL, 3901654538UL, 2078946336UL, +1418537059UL, 1202525920UL, 2530097881UL, 704759480UL, 2484428922UL, 1833969372UL, 661495122UL, 503878844UL, 3287413716UL, 2950835531UL, 1402379354UL, 351314168UL, 4131886119UL, 2033316109UL, 2873973176UL, 1321203603UL, 3316118265UL, 237900321UL, 1316780684UL, 793441242UL, 3281524559UL, 296088733UL, 1730738847UL, 314311643UL, 1388727135UL, 1705533557UL, 3557800292UL, 1553835665UL, 1660074989UL, 291276309UL, 421164833UL, 1318404599UL, +964731488UL, 3156334112UL, 2076623594UL, 850664906UL, 2293210629UL, 1105350579UL, 335452425UL, 3847487204UL, 645388200UL, 824349799UL, 2789953706UL, 954487767UL, 2755872609UL, 4249786064UL, 3811424903UL, 3937839949UL, 3408594583UL, 1417544262UL, 3159462529UL, 1654848550UL, 624060530UL, 324339737UL, 1908900347UL, 4111078399UL, 3241719305UL, 2294919498UL, 1890540205UL, 3750258343UL, 4190211142UL, 1420776905UL, 2279133729UL, 3716648585UL, +1690550UL, 3354905256UL, 2519610308UL, 3563975602UL, 3758156132UL, 2658162202UL, 1154211550UL, 1915690212UL, 3505586122UL, 844149171UL, 189880016UL, 1359089498UL, 2249086205UL, 2389487504UL, 1031812215UL, 998719835UL, 1265685672UL, 1970052076UL, 2798611919UL, 3174204115UL, 2973042959UL, 1360991400UL, 1994321680UL, 1684134678UL, 714016907UL, 2283905032UL, 2217962701UL, 182726833UL, 1734988742UL, 2151450260UL, 110719262UL, 3697978033UL, +1084030545UL, 159906818UL, 767772303UL, 4133333579UL, 1069092002UL, 2364406907UL, 1290801202UL, 42955292UL, 3629845331UL, 1464127305UL, 1616628807UL, 987794861UL, 3222189776UL, 3256744141UL, 2437350057UL, 39991274UL, 3644076751UL, 3142424684UL, 1024703328UL, 443099203UL, 643536212UL, 1487589384UL, 918511196UL, 2755167056UL, 276421624UL, 2492081750UL, 137688638UL, 4246877536UL, 2817867653UL, 1816283755UL, 4246096489UL, 1518475380UL, +1425765936UL, 2276077438UL, 2640849794UL, 3697925816UL, 4226506771UL, 1491702526UL, 130551477UL, 2897029415UL, 2747033756UL, 2033599579UL, 1844578694UL, 804565809UL, 437451803UL, 677924906UL, 2749065512UL, 3419189841UL, 2446610749UL, 3488484529UL, 470218446UL, 290444026UL, 3272535988UL, 1502147484UL, 611300083UL, 3809285994UL, 2546040767UL, 2853681168UL, 872826112UL, 2859302390UL, 2761919483UL, 4097961150UL, 1434560128UL, 3901654538UL, +2078946336UL, 1418537059UL, 2725734455UL, 2530097881UL, 704759480UL, 2484428922UL, 1833969372UL, 3999408333UL, 503878844UL, 3287413716UL, 2950835531UL, 1402379354UL, 3861442503UL, 4131886119UL, 2033316109UL, 2873973176UL, 1321203603UL, 1267331405UL, 237900321UL, 1316780684UL, 793441242UL, 3281524559UL, 1273427916UL, 1730738847UL, 314311643UL, 1388727135UL, 1705533557UL, 1474310231UL, 1553835665UL, 1660074989UL, 291276309UL, 421164833UL, +3884815658UL, 3088049345UL, 3307042227UL, 3228948601UL, 1717605083UL, 1864502063UL, 3799516572UL, 2372822470UL, 2691586476UL, 1172840854UL, 1577099080UL, 870101866UL, 2139291021UL, 406996656UL, 255568268UL, 897760202UL, 674745664UL, 885214361UL, 3753233375UL, 3015215223UL, 1711461259UL, 3241363282UL, 2125360928UL, 2493601640UL, 2350228245UL, 3434627328UL, 2095642963UL, 3360932494UL, 3287396242UL, 4070512427UL, 3415702664UL, 1958354224UL, +3280206940UL, 3929504236UL, 3390499817UL, 4144225735UL, 3621750606UL, 3205006592UL, 3495743785UL, 269239326UL, 2181299371UL, 2898796651UL, 2613623219UL, 3988711298UL, 2162437858UL, 949553433UL, 3289670000UL, 3559525307UL, 3366925567UL, 2112148665UL, 955626393UL, 1790865381UL, 699223558UL, 3889584301UL, 1020750250UL, 4105283899UL, 2295851818UL, 4045668915UL, 2224770025UL, 766386910UL, 4265157386UL, 89139307UL, 2099710177UL, 1012450874UL, +1875492446UL, 1927399417UL, 767450812UL, 654474783UL, 4265293038UL, 4041215389UL, 4102336947UL, 4263617328UL, 2135826340UL, 2317231535UL, 3773895729UL, 403151111UL, 1400693138UL, 4255050194UL, 755369466UL, 2325764302UL, 2617301159UL, 4165707294UL, 1206304709UL, 2415645397UL, 4276004841UL, 1457022279UL, 662660652UL, 795140282UL, 828519889UL, 805830562UL, 1179976369UL, 2212548232UL, 755708248UL, 1034682071UL, 899950902UL, 1906046264UL, +1861009040UL, 310711525UL, 920739741UL, 2322414272UL, 3179236470UL, 81822135UL, 4111390320UL, 1800166783UL, 112253014UL, 688771939UL, 1050990794UL, 3124647483UL, 287052171UL, 1363630156UL, 3447798279UL, 1405733552UL, 3075862538UL, 1682808202UL, 1595154222UL, 1173705692UL, 680713285UL, 2748212230UL, 568610527UL, 3434965538UL, 1114942930UL, 2835858745UL, 2575992250UL, 3243355150UL, 2127580225UL, 1855934450UL, 3915941751UL, 2228679809UL, +1514780124UL, 1506688039UL, 1033083295UL, 793807083UL, 1120681149UL, 4105670165UL, 3999570340UL, 2083020131UL, 1213356023UL, 3684882757UL, 3375797774UL, 3577986103UL, 2092046164UL, 2593847443UL, 1826450612UL, 367828409UL, 3198272513UL, 1941316667UL, 943707510UL, 907134807UL, 2020457947UL, 1462193665UL, 2964617539UL, 4216491663UL, 2625270800UL, 2395371467UL, 3691003028UL, 3659016793UL, 2381847054UL, 3513105567UL, 3013019506UL, 2731245927UL, +}, +{ +1680024716UL, 2112340059UL, 3387475367UL, 2080916186UL, 1431532386UL, 3907378472UL, 2636491350UL, 2176128529UL, 2236616671UL, 3736851460UL, 2604001339UL, 3893075234UL, 3495918635UL, 4116370522UL, 1384310379UL, 3660102574UL, 2030233939UL, 2759207091UL, 49347923UL, 97526506UL, 2566932710UL, 1566181275UL, 3127827248UL, 578401670UL, 1499229308UL, 2581732444UL, 279715551UL, 809690877UL, 1438444015UL, 878935323UL, 1495277039UL, 3417305339UL, +2858903785UL, 3074075088UL, 603749086UL, 2370669734UL, 391683868UL, 3933465331UL, 2884128106UL, 1478317876UL, 1864988335UL, 2925823809UL, 4133578805UL, 218104493UL, 368652174UL, 1998600344UL, 1109346044UL, 1716435313UL, 415435111UL, 91393686UL, 2536620737UL, 1440068573UL, 481874870UL, 142128108UL, 988825519UL, 2077118779UL, 2858045339UL, 4068162251UL, 115593872UL, 1364244587UL, 3550167006UL, 3728768059UL, 1772423685UL, 2504624145UL, +248732306UL, 1412607307UL, 4081166331UL, 154438218UL, 1652901877UL, 3932533490UL, 3142799969UL, 3154073676UL, 3112018078UL, 2757873595UL, 2364830126UL, 2855791484UL, 793851407UL, 507785167UL, 263713916UL, 4060700051UL, 3291978358UL, 1584226715UL, 2546417990UL, 450747961UL, 2951067700UL, 2706009093UL, 1788578194UL, 4030171132UL, 2610979903UL, 573420740UL, 4269115622UL, 2180305819UL, 2646894726UL, 716649335UL, 3875715683UL, 853428184UL, +2436760738UL, 4190071217UL, 2754423535UL, 540698101UL, 4082489821UL, 741976046UL, 267559495UL, 1591532642UL, 2500610323UL, 3203248679UL, 147312102UL, 2772368222UL, 1412987047UL, 2295185573UL, 1932341300UL, 898396308UL, 1837129999UL, 3113914292UL, 2613354524UL, 3141601915UL, 276087167UL, 1887389351UL, 757801450UL, 3752353732UL, 2745818074UL, 1442953464UL, 3802648347UL, 223728071UL, 2169947402UL, 1338125300UL, 3642174036UL, 2794462634UL, +2326349851UL, 862746036UL, 3577092599UL, 627103363UL, 552173564UL, 4142604459UL, 2310329406UL, 583522272UL, 189323282UL, 1217612313UL, 73550248UL, 2434692829UL, 2757269706UL, 2392210091UL, 3032922600UL, 3573904125UL, 2897178037UL, 2632631469UL, 3085332665UL, 3775619904UL, 2563291734UL, 1351375865UL, 4043427793UL, 1803743084UL, 3112116579UL, 522940594UL, 2690374983UL, 2613871529UL, 3810037031UL, 1765642390UL, 534554747UL, 1930852049UL, +2264349344UL, 1680024716UL, 2112340059UL, 3387475367UL, 2080916186UL, 75966494UL, 3907378472UL, 2636491350UL, 2176128529UL, 2236616671UL, 2372987046UL, 2604001339UL, 3893075234UL, 3495918635UL, 4116370522UL, 534929913UL, 3660102574UL, 2030233939UL, 2759207091UL, 49347923UL, 987575186UL, 2566932710UL, 1566181275UL, 3127827248UL, 578401670UL, 3731513754UL, 2581732444UL, 279715551UL, 809690877UL, 1438444015UL, 2185866850UL, 1495277039UL, +3417305339UL, 2858903785UL, 3074075088UL, 4198538376UL, 2370669734UL, 391683868UL, 3933465331UL, 2884128106UL, 1400216510UL, 1864988335UL, 2925823809UL, 4133578805UL, 218104493UL, 2798390374UL, 1998600344UL, 1109346044UL, 1716435313UL, 415435111UL, 1892535124UL, 2536620737UL, 1440068573UL, 481874870UL, 142128108UL, 329082740UL, 2077118779UL, 2858045339UL, 4068162251UL, 115593872UL, 2644000449UL, 3550167006UL, 3728768059UL, 1772423685UL, +2504624145UL, 2140118619UL, 1412607307UL, 4081166331UL, 154438218UL, 1652901877UL, 3804911318UL, 3142799969UL, 3154073676UL, 3112018078UL, 2757873595UL, 50297646UL, 2855791484UL, 793851407UL, 507785167UL, 263713916UL, 3324588195UL, 3291978358UL, 1584226715UL, 2546417990UL, 450747961UL, 3455625012UL, 2706009093UL, 1788578194UL, 4030171132UL, 2610979903UL, 3835380965UL, 4269115622UL, 2180305819UL, 2646894726UL, 716649335UL, 2607142354UL, +853428184UL, 2436760738UL, 4190071217UL, 2754423535UL, 456808691UL, 4082489821UL, 741976046UL, 267559495UL, 1591532642UL, 2722205042UL, 3203248679UL, 147312102UL, 2772368222UL, 1412987047UL, 1950543946UL, 1932341300UL, 898396308UL, 1837129999UL, 3113914292UL, 428616392UL, 3141601915UL, 276087167UL, 1887389351UL, 757801450UL, 963534966UL, 2745818074UL, 1442953464UL, 3802648347UL, 223728071UL, 229039300UL, 1338125300UL, 3642174036UL, +2794462634UL, 2326349851UL, 206115203UL, 3577092599UL, 627103363UL, 552173564UL, 4142604459UL, 1492461846UL, 583522272UL, 189323282UL, 1217612313UL, 73550248UL, 3552211807UL, 2757269706UL, 2392210091UL, 3032922600UL, 3573904125UL, 810640644UL, 2632631469UL, 3085332665UL, 3775619904UL, 2563291734UL, 922608790UL, 4043427793UL, 1803743084UL, 3112116579UL, 522940594UL, 1785093944UL, 2613871529UL, 3810037031UL, 1765642390UL, 534554747UL, +3528050076UL, 2264349344UL, 1680024716UL, 2112340059UL, 3387475367UL, 3295682653UL, 75966494UL, 3907378472UL, 2636491350UL, 2176128529UL, 3574915532UL, 2372987046UL, 2604001339UL, 3893075234UL, 3495918635UL, 1280296085UL, 534929913UL, 3660102574UL, 2030233939UL, 2759207091UL, 299776535UL, 987575186UL, 2566932710UL, 1566181275UL, 3127827248UL, 3874691533UL, 3731513754UL, 2581732444UL, 279715551UL, 809690877UL, 3100791084UL, 2185866850UL, +1495277039UL, 3417305339UL, 2858903785UL, 1310351481UL, 4198538376UL, 2370669734UL, 391683868UL, 3933465331UL, 2749085130UL, 1400216510UL, 1864988335UL, 2925823809UL, 4133578805UL, 3352814594UL, 2798390374UL, 1998600344UL, 1109346044UL, 1716435313UL, 1571752941UL, 1892535124UL, 2536620737UL, 1440068573UL, 481874870UL, 2485033697UL, 329082740UL, 2077118779UL, 2858045339UL, 4068162251UL, 3837440666UL, 2644000449UL, 3550167006UL, 3728768059UL, +1772423685UL, 1176559812UL, 2140118619UL, 1412607307UL, 4081166331UL, 154438218UL, 2902622972UL, 3804911318UL, 3142799969UL, 3154073676UL, 3112018078UL, 2403391233UL, 50297646UL, 2855791484UL, 793851407UL, 507785167UL, 2351826747UL, 3324588195UL, 3291978358UL, 1584226715UL, 2546417990UL, 746876926UL, 3455625012UL, 2706009093UL, 1788578194UL, 4030171132UL, 3779307353UL, 3835380965UL, 4269115622UL, 2180305819UL, 2646894726UL, 2602235234UL, +2607142354UL, 853428184UL, 2436760738UL, 4190071217UL, 2066757692UL, 456808691UL, 4082489821UL, 741976046UL, 267559495UL, 3001080633UL, 2722205042UL, 3203248679UL, 147312102UL, 2772368222UL, 89950260UL, 1950543946UL, 1932341300UL, 898396308UL, 1837129999UL, 947911286UL, 428616392UL, 3141601915UL, 276087167UL, 1887389351UL, 2583987247UL, 963534966UL, 2745818074UL, 1442953464UL, 3802648347UL, 4229124441UL, 229039300UL, 1338125300UL, +3642174036UL, 2794462634UL, 2472155633UL, 206115203UL, 3577092599UL, 627103363UL, 552173564UL, 2586882739UL, 1492461846UL, 583522272UL, 189323282UL, 1217612313UL, 3501549884UL, 3552211807UL, 2757269706UL, 2392210091UL, 3032922600UL, 740675778UL, 810640644UL, 2632631469UL, 3085332665UL, 3775619904UL, 3643289881UL, 922608790UL, 4043427793UL, 1803743084UL, 3112116579UL, 2213337398UL, 1785093944UL, 2613871529UL, 3810037031UL, 1765642390UL, +762472016UL, 3528050076UL, 2264349344UL, 1680024716UL, 2112340059UL, 1372272974UL, 3295682653UL, 75966494UL, 3907378472UL, 2636491350UL, 3117471955UL, 3574915532UL, 2372987046UL, 2604001339UL, 3893075234UL, 915576383UL, 1280296085UL, 534929913UL, 3660102574UL, 2030233939UL, 346368350UL, 299776535UL, 987575186UL, 2566932710UL, 1566181275UL, 3535223896UL, 3874691533UL, 3731513754UL, 2581732444UL, 279715551UL, 2456894951UL, 3100791084UL, +2185866850UL, 1495277039UL, 3417305339UL, 1618871086UL, 1310351481UL, 4198538376UL, 2370669734UL, 391683868UL, 2009676005UL, 2749085130UL, 1400216510UL, 1864988335UL, 2925823809UL, 58955107UL, 3352814594UL, 2798390374UL, 1998600344UL, 1109346044UL, 3273979614UL, 1571752941UL, 1892535124UL, 2536620737UL, 1440068573UL, 1174168447UL, 2485033697UL, 329082740UL, 2077118779UL, 2858045339UL, 4062921629UL, 3837440666UL, 2644000449UL, 3550167006UL, +3728768059UL, 2642133401UL, 1176559812UL, 2140118619UL, 1412607307UL, 4081166331UL, 3124905304UL, 2902622972UL, 3804911318UL, 3142799969UL, 3154073676UL, 1449454613UL, 2403391233UL, 50297646UL, 2855791484UL, 793851407UL, 3514201526UL, 2351826747UL, 3324588195UL, 3291978358UL, 1584226715UL, 3636681672UL, 746876926UL, 3455625012UL, 2706009093UL, 1788578194UL, 3451519459UL, 3779307353UL, 3835380965UL, 4269115622UL, 2180305819UL, 3987989524UL, +2602235234UL, 2607142354UL, 853428184UL, 2436760738UL, 2151617107UL, 2066757692UL, 456808691UL, 4082489821UL, 741976046UL, 3590081269UL, 3001080633UL, 2722205042UL, 3203248679UL, 147312102UL, 3432947806UL, 89950260UL, 1950543946UL, 1932341300UL, 898396308UL, 3828432864UL, 947911286UL, 428616392UL, 3141601915UL, 276087167UL, 2517666433UL, 2583987247UL, 963534966UL, 2745818074UL, 1442953464UL, 2223986807UL, 4229124441UL, 229039300UL, +1338125300UL, 3642174036UL, 1053796945UL, 2472155633UL, 206115203UL, 3577092599UL, 627103363UL, 1113276084UL, 2586882739UL, 1492461846UL, 583522272UL, 189323282UL, 1490604990UL, 3501549884UL, 3552211807UL, 2757269706UL, 2392210091UL, 3545407532UL, 740675778UL, 810640644UL, 2632631469UL, 3085332665UL, 755862267UL, 3643289881UL, 922608790UL, 4043427793UL, 1803743084UL, 1954166630UL, 2213337398UL, 1785093944UL, 2613871529UL, 3810037031UL, +3042935707UL, 3162182177UL, 2791346436UL, 1901925289UL, 863100941UL, 3367519168UL, 1972623238UL, 3664303070UL, 604922059UL, 3026817982UL, 1436412310UL, 4096180631UL, 1597561857UL, 4206212303UL, 4127914332UL, 3228677359UL, 3985733659UL, 3597290113UL, 4251197894UL, 3451370603UL, 609679338UL, 3360835257UL, 1372239885UL, 638572328UL, 3806422284UL, 3974147336UL, 1804280837UL, 4209089291UL, 2021797469UL, 3557188838UL, 409727186UL, 2114649178UL, +687702120UL, 2542445992UL, 1235991799UL, 460479179UL, 2008348175UL, 887884478UL, 3942327811UL, 2999928223UL, 4171339789UL, 2286339235UL, 1293442231UL, 1575942850UL, 76122475UL, 1440527701UL, 2006558403UL, 1544148172UL, 895899367UL, 681826913UL, 4094701935UL, 3995413790UL, 1027509154UL, 2264990896UL, 1938238113UL, 213430250UL, 222469320UL, 609726517UL, 3581538106UL, 492802663UL, 120480843UL, 1720004062UL, 1132674507UL, 911082758UL, +2909148131UL, 566658805UL, 3964114445UL, 3483602509UL, 1793438750UL, 165562604UL, 3641830063UL, 2394205521UL, 3404874822UL, 1672998096UL, 916151953UL, 1141264477UL, 3171661340UL, 3803396219UL, 3018337382UL, 1863902683UL, 2474641928UL, 3250365071UL, 3897886220UL, 1219701051UL, 51332576UL, 1358614881UL, 1707407492UL, 3670647816UL, 923357625UL, 343687395UL, 3991339686UL, 3913575403UL, 1267727936UL, 4001357856UL, 3820224848UL, 2942896724UL, +3505936742UL, 1403285299UL, 1992762049UL, 567748449UL, 2202721585UL, 2781324216UL, 1724850068UL, 2408314541UL, 3073975813UL, 3992810029UL, 2475242354UL, 540562053UL, 2185198943UL, 3759352041UL, 3373885614UL, 1132999410UL, 1097554565UL, 4089342358UL, 3239542922UL, 2451748646UL, 407290679UL, 3188103200UL, 1708016248UL, 26848241UL, 2796711130UL, 3090711568UL, 4068389322UL, 3420916085UL, 3137567033UL, 2877819818UL, 22133454UL, 4629160UL, +3703695249UL, 1920151708UL, 1175452162UL, 130015299UL, 3331834713UL, 1099225384UL, 689254331UL, 1851083761UL, 2654970209UL, 3259297936UL, 3742819314UL, 3524284766UL, 2291819083UL, 3494031861UL, 16242889UL, 3545082774UL, 1997878108UL, 777447699UL, 4244916543UL, 3508640253UL, 3782278393UL, 2107258964UL, 2139074576UL, 1383217899UL, 2337934322UL, 3181899620UL, 1285955765UL, 2989610020UL, 3326862146UL, 1168587380UL, 801203532UL, 3020809957UL, +}, +{ +3810471203UL, 1017064446UL, 1595207573UL, 441087832UL, 3326746890UL, 3294064431UL, 167972517UL, 3625210015UL, 1011845006UL, 2980240819UL, 1778354660UL, 3041730987UL, 1598611350UL, 2015169745UL, 2321724978UL, 3390812967UL, 2432904511UL, 113261909UL, 3957193232UL, 3806115908UL, 2965828929UL, 2035392295UL, 3500116619UL, 2881232416UL, 1672212265UL, 1607201428UL, 425148945UL, 1262591961UL, 2221781268UL, 4215047456UL, 2148245850UL, 2787488981UL, +1077262192UL, 2085467561UL, 3053954888UL, 3584435116UL, 3013084787UL, 287099941UL, 1290407232UL, 4078552287UL, 2658945475UL, 4251530898UL, 2403086478UL, 2884923598UL, 3545110453UL, 4105390090UL, 343200643UL, 3189888821UL, 4086304363UL, 3466483195UL, 259435633UL, 2846377387UL, 497258846UL, 272775541UL, 985737911UL, 2957688879UL, 2180784344UL, 3434619542UL, 3643384838UL, 2228652440UL, 3107480718UL, 2208729807UL, 596436263UL, 3255120711UL, +3248886970UL, 519242965UL, 602979109UL, 1619614UL, 1391563565UL, 56262588UL, 1584463910UL, 1849038201UL, 728022295UL, 848624947UL, 1813827408UL, 428214945UL, 1246345586UL, 4213351865UL, 168985863UL, 456608054UL, 4277869380UL, 3886828599UL, 2264054549UL, 3110967170UL, 3138175314UL, 2649164828UL, 3369378320UL, 3648350039UL, 3524848759UL, 1468470706UL, 3558859222UL, 2669673235UL, 831851874UL, 4285651092UL, 4224147373UL, 1088456706UL, +231954609UL, 3118005852UL, 225508069UL, 883105389UL, 856371341UL, 2001356578UL, 639336670UL, 2363501707UL, 3622399552UL, 4024065226UL, 1093546838UL, 4263608561UL, 1852072422UL, 425195042UL, 2441102396UL, 296426333UL, 384641750UL, 3559334435UL, 1757327033UL, 1016016207UL, 3595686646UL, 24777793UL, 623926105UL, 2169195923UL, 1779396793UL, 646997837UL, 1459728476UL, 2644865980UL, 1994581089UL, 3956278544UL, 919592580UL, 2153558858UL, +2029633394UL, 3837501009UL, 4016560170UL, 484838096UL, 3652199054UL, 1971790561UL, 605295089UL, 637470291UL, 278970544UL, 3574824693UL, 295866521UL, 1755035156UL, 2542341803UL, 1588716357UL, 1502596918UL, 4124554133UL, 3547049843UL, 1768033045UL, 1531734630UL, 101448323UL, 3233017580UL, 1793222944UL, 3187853500UL, 186000900UL, 803444571UL, 2820254958UL, 2009384608UL, 2384668855UL, 2222812920UL, 633608665UL, 2028480056UL, 1258028235UL, +545095949UL, 3810471203UL, 1017064446UL, 1595207573UL, 441087832UL, 899068662UL, 3294064431UL, 167972517UL, 3625210015UL, 1011845006UL, 3951305793UL, 1778354660UL, 3041730987UL, 1598611350UL, 2015169745UL, 1885149424UL, 3390812967UL, 2432904511UL, 113261909UL, 3957193232UL, 3953443155UL, 2965828929UL, 2035392295UL, 3500116619UL, 2881232416UL, 329153573UL, 1607201428UL, 425148945UL, 1262591961UL, 2221781268UL, 78028761UL, 2148245850UL, +2787488981UL, 1077262192UL, 2085467561UL, 647235899UL, 3584435116UL, 3013084787UL, 287099941UL, 1290407232UL, 1467385694UL, 2658945475UL, 4251530898UL, 2403086478UL, 2884923598UL, 3489351040UL, 4105390090UL, 343200643UL, 3189888821UL, 4086304363UL, 3521512280UL, 259435633UL, 2846377387UL, 497258846UL, 272775541UL, 1367093111UL, 2957688879UL, 2180784344UL, 3434619542UL, 3643384838UL, 411877686UL, 3107480718UL, 2208729807UL, 596436263UL, +3255120711UL, 584605030UL, 519242965UL, 602979109UL, 1619614UL, 1391563565UL, 3902518209UL, 1584463910UL, 1849038201UL, 728022295UL, 848624947UL, 1932969318UL, 428214945UL, 1246345586UL, 4213351865UL, 168985863UL, 2770345237UL, 4277869380UL, 3886828599UL, 2264054549UL, 3110967170UL, 2953581033UL, 2649164828UL, 3369378320UL, 3648350039UL, 3524848759UL, 2380353977UL, 3558859222UL, 2669673235UL, 831851874UL, 4285651092UL, 1214052447UL, +1088456706UL, 231954609UL, 3118005852UL, 225508069UL, 1766983646UL, 856371341UL, 2001356578UL, 639336670UL, 2363501707UL, 1782816591UL, 4024065226UL, 1093546838UL, 4263608561UL, 1852072422UL, 1149716600UL, 2441102396UL, 296426333UL, 384641750UL, 3559334435UL, 2391309970UL, 1016016207UL, 3595686646UL, 24777793UL, 623926105UL, 362098678UL, 1779396793UL, 646997837UL, 1459728476UL, 2644865980UL, 3238673748UL, 3956278544UL, 919592580UL, +2153558858UL, 2029633394UL, 115778559UL, 4016560170UL, 484838096UL, 3652199054UL, 1971790561UL, 737357475UL, 637470291UL, 278970544UL, 3574824693UL, 295866521UL, 3989745853UL, 2542341803UL, 1588716357UL, 1502596918UL, 4124554133UL, 3016849744UL, 1768033045UL, 1531734630UL, 101448323UL, 3233017580UL, 4157527581UL, 3187853500UL, 186000900UL, 803444571UL, 2820254958UL, 1980528062UL, 2384668855UL, 2222812920UL, 633608665UL, 2028480056UL, +3166710281UL, 545095949UL, 3810471203UL, 1017064446UL, 1595207573UL, 693962828UL, 899068662UL, 3294064431UL, 167972517UL, 3625210015UL, 1486040398UL, 3951305793UL, 1778354660UL, 3041730987UL, 1598611350UL, 2859363132UL, 1885149424UL, 3390812967UL, 2432904511UL, 113261909UL, 664880478UL, 3953443155UL, 2965828929UL, 2035392295UL, 3500116619UL, 558081801UL, 329153573UL, 1607201428UL, 425148945UL, 1262591961UL, 3716247699UL, 78028761UL, +2148245850UL, 2787488981UL, 1077262192UL, 4206362947UL, 647235899UL, 3584435116UL, 3013084787UL, 287099941UL, 2536781098UL, 1467385694UL, 2658945475UL, 4251530898UL, 2403086478UL, 3075072413UL, 3489351040UL, 4105390090UL, 343200643UL, 3189888821UL, 2540485172UL, 3521512280UL, 259435633UL, 2846377387UL, 497258846UL, 2442427327UL, 1367093111UL, 2957688879UL, 2180784344UL, 3434619542UL, 1593967423UL, 411877686UL, 3107480718UL, 2208729807UL, +596436263UL, 1048686529UL, 584605030UL, 519242965UL, 602979109UL, 1619614UL, 2072745381UL, 3902518209UL, 1584463910UL, 1849038201UL, 728022295UL, 846033949UL, 1932969318UL, 428214945UL, 1246345586UL, 4213351865UL, 1066373275UL, 2770345237UL, 4277869380UL, 3886828599UL, 2264054549UL, 1877859690UL, 2953581033UL, 2649164828UL, 3369378320UL, 3648350039UL, 2537763389UL, 2380353977UL, 3558859222UL, 2669673235UL, 831851874UL, 522748140UL, +1214052447UL, 1088456706UL, 231954609UL, 3118005852UL, 1381269315UL, 1766983646UL, 856371341UL, 2001356578UL, 639336670UL, 667275675UL, 1782816591UL, 4024065226UL, 1093546838UL, 4263608561UL, 2057337961UL, 1149716600UL, 2441102396UL, 296426333UL, 384641750UL, 340523210UL, 2391309970UL, 1016016207UL, 3595686646UL, 24777793UL, 3094832341UL, 362098678UL, 1779396793UL, 646997837UL, 1459728476UL, 1169681568UL, 3238673748UL, 3956278544UL, +919592580UL, 2153558858UL, 388335108UL, 115778559UL, 4016560170UL, 484838096UL, 3652199054UL, 1764858181UL, 737357475UL, 637470291UL, 278970544UL, 3574824693UL, 3671458900UL, 3989745853UL, 2542341803UL, 1588716357UL, 1502596918UL, 2102871406UL, 3016849744UL, 1768033045UL, 1531734630UL, 101448323UL, 3964942332UL, 4157527581UL, 3187853500UL, 186000900UL, 803444571UL, 3425652083UL, 1980528062UL, 2384668855UL, 2222812920UL, 633608665UL, +3035373876UL, 3166710281UL, 545095949UL, 3810471203UL, 1017064446UL, 669282349UL, 693962828UL, 899068662UL, 3294064431UL, 167972517UL, 2007256988UL, 1486040398UL, 3951305793UL, 1778354660UL, 3041730987UL, 2827768941UL, 2859363132UL, 1885149424UL, 3390812967UL, 2432904511UL, 3700915653UL, 664880478UL, 3953443155UL, 2965828929UL, 2035392295UL, 1461208330UL, 558081801UL, 329153573UL, 1607201428UL, 425148945UL, 1700881129UL, 3716247699UL, +78028761UL, 2148245850UL, 2787488981UL, 2706775080UL, 4206362947UL, 647235899UL, 3584435116UL, 3013084787UL, 2958545221UL, 2536781098UL, 1467385694UL, 2658945475UL, 4251530898UL, 2241012567UL, 3075072413UL, 3489351040UL, 4105390090UL, 343200643UL, 490164649UL, 2540485172UL, 3521512280UL, 259435633UL, 2846377387UL, 4073611831UL, 2442427327UL, 1367093111UL, 2957688879UL, 2180784344UL, 1835510773UL, 1593967423UL, 411877686UL, 3107480718UL, +2208729807UL, 3306732468UL, 1048686529UL, 584605030UL, 519242965UL, 602979109UL, 2978864605UL, 2072745381UL, 3902518209UL, 1584463910UL, 1849038201UL, 3284115169UL, 846033949UL, 1932969318UL, 428214945UL, 1246345586UL, 194166002UL, 1066373275UL, 2770345237UL, 4277869380UL, 3886828599UL, 1874087886UL, 1877859690UL, 2953581033UL, 2649164828UL, 3369378320UL, 4145454028UL, 2537763389UL, 2380353977UL, 3558859222UL, 2669673235UL, 739345884UL, +522748140UL, 1214052447UL, 1088456706UL, 231954609UL, 3605603781UL, 1381269315UL, 1766983646UL, 856371341UL, 2001356578UL, 2049940324UL, 667275675UL, 1782816591UL, 4024065226UL, 1093546838UL, 152524382UL, 2057337961UL, 1149716600UL, 2441102396UL, 296426333UL, 3195130788UL, 340523210UL, 2391309970UL, 1016016207UL, 3595686646UL, 180492441UL, 3094832341UL, 362098678UL, 1779396793UL, 646997837UL, 2458167607UL, 1169681568UL, 3238673748UL, +3956278544UL, 919592580UL, 3421005218UL, 388335108UL, 115778559UL, 4016560170UL, 484838096UL, 2649676374UL, 1764858181UL, 737357475UL, 637470291UL, 278970544UL, 2236401278UL, 3671458900UL, 3989745853UL, 2542341803UL, 1588716357UL, 1241570134UL, 2102871406UL, 3016849744UL, 1768033045UL, 1531734630UL, 1765654724UL, 3964942332UL, 4157527581UL, 3187853500UL, 186000900UL, 2189716659UL, 3425652083UL, 1980528062UL, 2384668855UL, 2222812920UL, +3955466207UL, 2426547616UL, 3846752458UL, 3015538636UL, 2342593365UL, 3613176865UL, 3484860981UL, 4278370194UL, 1979143878UL, 1159739458UL, 3714038404UL, 396530346UL, 3276617756UL, 3293940597UL, 4050183149UL, 1418571985UL, 402563753UL, 2702853013UL, 2289900621UL, 2267058511UL, 3482161995UL, 3375026019UL, 1988640267UL, 3674438074UL, 4124612310UL, 1057883705UL, 434730475UL, 3210959778UL, 4102029739UL, 2140938750UL, 3176753074UL, 2356971512UL, +3969685288UL, 1556275580UL, 2648433428UL, 3959375381UL, 478841344UL, 1496991528UL, 3309714981UL, 569990368UL, 3660587501UL, 2550379574UL, 1177519842UL, 2652707373UL, 543943404UL, 1912551128UL, 2278132032UL, 1484596780UL, 3570913985UL, 2982401320UL, 1413776035UL, 3177275459UL, 3036211597UL, 1091740466UL, 3448424311UL, 1445187645UL, 3205024875UL, 3135795254UL, 823738729UL, 3742134467UL, 4066657438UL, 1226311678UL, 2403605393UL, 537573634UL, +3457409768UL, 1940233423UL, 1761431281UL, 1129427309UL, 2443661283UL, 3200814257UL, 4094866249UL, 2666869754UL, 604785127UL, 2213464116UL, 3002782918UL, 468024929UL, 2490681314UL, 3666681384UL, 1583346053UL, 3049668798UL, 3592153237UL, 2573082448UL, 3082970021UL, 1461796708UL, 832526980UL, 3728763274UL, 355291229UL, 4029588456UL, 832358279UL, 2125298737UL, 3681181038UL, 3245535160UL, 1333342738UL, 1868897492UL, 446790068UL, 1278093154UL, +2090118615UL, 4158925515UL, 4062165914UL, 822726809UL, 1154960183UL, 286518382UL, 1170424276UL, 2554691236UL, 3674133415UL, 2765714969UL, 2330865375UL, 1908307334UL, 3537287082UL, 410252600UL, 3977128218UL, 424210327UL, 2919071615UL, 2715518134UL, 64568844UL, 480972649UL, 2488797168UL, 1302817038UL, 2213995265UL, 4229997295UL, 2200797852UL, 109368057UL, 3033807022UL, 1907400078UL, 645977948UL, 1410909090UL, 3700787906UL, 3375062371UL, +629087832UL, 1344281719UL, 4249981139UL, 3457543297UL, 1218556849UL, 864222854UL, 1458445945UL, 914545469UL, 3451164212UL, 1088025757UL, 1129933985UL, 953788883UL, 2406172924UL, 170364546UL, 3505490646UL, 1027553899UL, 2864067776UL, 436854871UL, 1342782209UL, 761167471UL, 2660173631UL, 4159507498UL, 4172028400UL, 2442254644UL, 2110123720UL, 2315991253UL, 873066601UL, 1725470559UL, 3831299052UL, 678672031UL, 1585431329UL, 3495750550UL, +}, +{ +1998393432UL, 2665389278UL, 3989307699UL, 3267631636UL, 3861682977UL, 3243522970UL, 1243992413UL, 2200497260UL, 3821883021UL, 4187123083UL, 3451270040UL, 3044132745UL, 2101287249UL, 2340839784UL, 227040990UL, 1724350416UL, 3228881240UL, 3123386528UL, 4279362126UL, 3098224464UL, 2635534069UL, 3622906431UL, 206207480UL, 1894245533UL, 2152374527UL, 1011223653UL, 7271757UL, 2972858087UL, 207942127UL, 3355362797UL, 2593296740UL, 174093751UL, +3713822176UL, 4212355586UL, 3335605224UL, 1171716408UL, 2867257989UL, 1522213957UL, 2016192462UL, 4229688395UL, 2174928148UL, 1468226225UL, 3938290338UL, 493240317UL, 3229423344UL, 2585475729UL, 3112454413UL, 1881171707UL, 2555908056UL, 1997546352UL, 380428329UL, 3341885423UL, 3307510279UL, 3519476676UL, 3613100811UL, 2555826262UL, 109341943UL, 2382715395UL, 3883409616UL, 1593551879UL, 2163678014UL, 3379783137UL, 2810374300UL, 1516064864UL, +561144874UL, 316017838UL, 1899237567UL, 70857401UL, 3435185465UL, 4234661323UL, 2580352177UL, 32879620UL, 4171670150UL, 1986234067UL, 3589478191UL, 2073132526UL, 2603712175UL, 377997975UL, 2474419397UL, 3110698341UL, 812664089UL, 1778922726UL, 1686111212UL, 972784138UL, 3936486236UL, 2711468739UL, 423435866UL, 1661961159UL, 802312780UL, 1868728136UL, 1760295704UL, 3357409828UL, 215039860UL, 683184627UL, 4019111064UL, 3609261689UL, +2167554309UL, 1831085281UL, 3389357802UL, 4193421575UL, 628277197UL, 2900207619UL, 993609502UL, 3429627083UL, 2636466084UL, 3652352199UL, 1780133580UL, 1670387713UL, 4086070210UL, 4004540729UL, 783029246UL, 2165667566UL, 1739001057UL, 377639972UL, 1102689625UL, 1945278055UL, 3941185940UL, 3685368326UL, 1881761572UL, 2201338934UL, 801752UL, 2729497735UL, 492844690UL, 2998826141UL, 3844964457UL, 3679088359UL, 2196391660UL, 4222269404UL, +357321611UL, 3727170055UL, 1819614072UL, 2348798457UL, 4294366646UL, 1952884323UL, 3574345216UL, 2040734807UL, 232392443UL, 4183498179UL, 2614866055UL, 112120292UL, 3624018350UL, 3340709877UL, 3097507723UL, 1268833488UL, 3570501956UL, 3338260086UL, 293812421UL, 3683058169UL, 1147960351UL, 283731890UL, 2171233479UL, 1830154455UL, 4036602681UL, 1996981699UL, 132803834UL, 40256165UL, 2158110401UL, 3575159090UL, 3196553513UL, 3559872992UL, +3402884675UL, 1998393432UL, 2665389278UL, 3989307699UL, 3267631636UL, 3617519767UL, 3243522970UL, 1243992413UL, 2200497260UL, 3821883021UL, 3715729085UL, 3451270040UL, 3044132745UL, 2101287249UL, 2340839784UL, 3173635549UL, 1724350416UL, 3228881240UL, 3123386528UL, 4279362126UL, 2287520039UL, 2635534069UL, 3622906431UL, 206207480UL, 1894245533UL, 96723416UL, 1011223653UL, 7271757UL, 2972858087UL, 207942127UL, 1668335352UL, 2593296740UL, +174093751UL, 3713822176UL, 4212355586UL, 49226793UL, 1171716408UL, 2867257989UL, 1522213957UL, 2016192462UL, 118712412UL, 2174928148UL, 1468226225UL, 3938290338UL, 493240317UL, 3788174304UL, 2585475729UL, 3112454413UL, 1881171707UL, 2555908056UL, 3351139844UL, 380428329UL, 3341885423UL, 3307510279UL, 3519476676UL, 1368994724UL, 2555826262UL, 109341943UL, 2382715395UL, 3883409616UL, 1561509458UL, 2163678014UL, 3379783137UL, 2810374300UL, +1516064864UL, 2313252274UL, 316017838UL, 1899237567UL, 70857401UL, 3435185465UL, 2585770746UL, 2580352177UL, 32879620UL, 4171670150UL, 1986234067UL, 3317983509UL, 2073132526UL, 2603712175UL, 377997975UL, 2474419397UL, 908728599UL, 812664089UL, 1778922726UL, 1686111212UL, 972784138UL, 1992540005UL, 2711468739UL, 423435866UL, 1661961159UL, 802312780UL, 907108769UL, 1760295704UL, 3357409828UL, 215039860UL, 683184627UL, 2806826652UL, +3609261689UL, 2167554309UL, 1831085281UL, 3389357802UL, 2755692689UL, 628277197UL, 2900207619UL, 993609502UL, 3429627083UL, 3605915742UL, 3652352199UL, 1780133580UL, 1670387713UL, 4086070210UL, 3717326627UL, 783029246UL, 2165667566UL, 1739001057UL, 377639972UL, 2355216626UL, 1945278055UL, 3941185940UL, 3685368326UL, 1881761572UL, 4024097818UL, 801752UL, 2729497735UL, 492844690UL, 2998826141UL, 2719601647UL, 3679088359UL, 2196391660UL, +4222269404UL, 357321611UL, 1319821972UL, 1819614072UL, 2348798457UL, 4294366646UL, 1952884323UL, 3573866689UL, 2040734807UL, 232392443UL, 4183498179UL, 2614866055UL, 440744432UL, 3624018350UL, 3340709877UL, 3097507723UL, 1268833488UL, 224895395UL, 3338260086UL, 293812421UL, 3683058169UL, 1147960351UL, 3433425235UL, 2171233479UL, 1830154455UL, 4036602681UL, 1996981699UL, 2875889721UL, 40256165UL, 2158110401UL, 3575159090UL, 3196553513UL, +1094082574UL, 3402884675UL, 1998393432UL, 2665389278UL, 3989307699UL, 4068940467UL, 3617519767UL, 3243522970UL, 1243992413UL, 2200497260UL, 441678457UL, 3715729085UL, 3451270040UL, 3044132745UL, 2101287249UL, 2181502237UL, 3173635549UL, 1724350416UL, 3228881240UL, 3123386528UL, 1968352124UL, 2287520039UL, 2635534069UL, 3622906431UL, 206207480UL, 2065093599UL, 96723416UL, 1011223653UL, 7271757UL, 2972858087UL, 1094044749UL, 1668335352UL, +2593296740UL, 174093751UL, 3713822176UL, 2887397643UL, 49226793UL, 1171716408UL, 2867257989UL, 1522213957UL, 984348433UL, 118712412UL, 2174928148UL, 1468226225UL, 3938290338UL, 2279430036UL, 3788174304UL, 2585475729UL, 3112454413UL, 1881171707UL, 4247636500UL, 3351139844UL, 380428329UL, 3341885423UL, 3307510279UL, 2887754196UL, 1368994724UL, 2555826262UL, 109341943UL, 2382715395UL, 2836761616UL, 1561509458UL, 2163678014UL, 3379783137UL, +2810374300UL, 1635278016UL, 2313252274UL, 316017838UL, 1899237567UL, 70857401UL, 3481535811UL, 2585770746UL, 2580352177UL, 32879620UL, 4171670150UL, 2248003250UL, 3317983509UL, 2073132526UL, 2603712175UL, 377997975UL, 3286162818UL, 908728599UL, 812664089UL, 1778922726UL, 1686111212UL, 4024815755UL, 1992540005UL, 2711468739UL, 423435866UL, 1661961159UL, 2257259057UL, 907108769UL, 1760295704UL, 3357409828UL, 215039860UL, 3917391198UL, +2806826652UL, 3609261689UL, 2167554309UL, 1831085281UL, 4238043113UL, 2755692689UL, 628277197UL, 2900207619UL, 993609502UL, 2036092353UL, 3605915742UL, 3652352199UL, 1780133580UL, 1670387713UL, 118446953UL, 3717326627UL, 783029246UL, 2165667566UL, 1739001057UL, 203160626UL, 2355216626UL, 1945278055UL, 3941185940UL, 3685368326UL, 546361979UL, 4024097818UL, 801752UL, 2729497735UL, 492844690UL, 1023017124UL, 2719601647UL, 3679088359UL, +2196391660UL, 4222269404UL, 621859651UL, 1319821972UL, 1819614072UL, 2348798457UL, 4294366646UL, 1114888560UL, 3573866689UL, 2040734807UL, 232392443UL, 4183498179UL, 3959504609UL, 440744432UL, 3624018350UL, 3340709877UL, 3097507723UL, 3613295037UL, 224895395UL, 3338260086UL, 293812421UL, 3683058169UL, 1655305863UL, 3433425235UL, 2171233479UL, 1830154455UL, 4036602681UL, 3731384097UL, 2875889721UL, 40256165UL, 2158110401UL, 3575159090UL, +1847744924UL, 1094082574UL, 3402884675UL, 1998393432UL, 2665389278UL, 3781866777UL, 4068940467UL, 3617519767UL, 3243522970UL, 1243992413UL, 2723708256UL, 441678457UL, 3715729085UL, 3451270040UL, 3044132745UL, 4013832842UL, 2181502237UL, 3173635549UL, 1724350416UL, 3228881240UL, 2092292494UL, 1968352124UL, 2287520039UL, 2635534069UL, 3622906431UL, 3186333458UL, 2065093599UL, 96723416UL, 1011223653UL, 7271757UL, 649658033UL, 1094044749UL, +1668335352UL, 2593296740UL, 174093751UL, 4159420309UL, 2887397643UL, 49226793UL, 1171716408UL, 2867257989UL, 2590077953UL, 984348433UL, 118712412UL, 2174928148UL, 1468226225UL, 1065322711UL, 2279430036UL, 3788174304UL, 2585475729UL, 3112454413UL, 3932517386UL, 4247636500UL, 3351139844UL, 380428329UL, 3341885423UL, 1285273904UL, 2887754196UL, 1368994724UL, 2555826262UL, 109341943UL, 2318470582UL, 2836761616UL, 1561509458UL, 2163678014UL, +3379783137UL, 674658583UL, 1635278016UL, 2313252274UL, 316017838UL, 1899237567UL, 2192372173UL, 3481535811UL, 2585770746UL, 2580352177UL, 32879620UL, 300323274UL, 2248003250UL, 3317983509UL, 2073132526UL, 2603712175UL, 3086543917UL, 3286162818UL, 908728599UL, 812664089UL, 1778922726UL, 2263290659UL, 4024815755UL, 1992540005UL, 2711468739UL, 423435866UL, 819027349UL, 2257259057UL, 907108769UL, 1760295704UL, 3357409828UL, 1142221093UL, +3917391198UL, 2806826652UL, 3609261689UL, 2167554309UL, 4108155875UL, 4238043113UL, 2755692689UL, 628277197UL, 2900207619UL, 3041719497UL, 2036092353UL, 3605915742UL, 3652352199UL, 1780133580UL, 2397410862UL, 118446953UL, 3717326627UL, 783029246UL, 2165667566UL, 2721690354UL, 203160626UL, 2355216626UL, 1945278055UL, 3941185940UL, 2768842108UL, 546361979UL, 4024097818UL, 801752UL, 2729497735UL, 4045063232UL, 1023017124UL, 2719601647UL, +3679088359UL, 2196391660UL, 2666107451UL, 621859651UL, 1319821972UL, 1819614072UL, 2348798457UL, 3555102623UL, 1114888560UL, 3573866689UL, 2040734807UL, 232392443UL, 3359040541UL, 3959504609UL, 440744432UL, 3624018350UL, 3340709877UL, 1477919696UL, 3613295037UL, 224895395UL, 3338260086UL, 293812421UL, 4210187101UL, 1655305863UL, 3433425235UL, 2171233479UL, 1830154455UL, 4150241150UL, 3731384097UL, 2875889721UL, 40256165UL, 2158110401UL, +3350246687UL, 455561037UL, 2250400255UL, 3192153445UL, 3258870230UL, 1500391873UL, 4142878334UL, 1155955691UL, 1483275844UL, 4189436981UL, 323745948UL, 1976017426UL, 2804626790UL, 2717553615UL, 2315409034UL, 954508235UL, 3845175920UL, 3999878682UL, 1247696432UL, 1743319509UL, 2998248398UL, 3694350012UL, 4072006361UL, 191306987UL, 2816321878UL, 1324077734UL, 1083060006UL, 3406855480UL, 1619622379UL, 2160350UL, 3302238190UL, 3368021261UL, +3685228564UL, 3863934685UL, 771728612UL, 854205233UL, 2304696695UL, 421449207UL, 1265752117UL, 3852292419UL, 305345788UL, 1540622105UL, 1904883477UL, 833469256UL, 134406680UL, 3012455058UL, 4035477953UL, 2925192459UL, 1559200592UL, 3851612860UL, 718484562UL, 1377960276UL, 1586892849UL, 1361298269UL, 3417917896UL, 1281324499UL, 1012538763UL, 1350578667UL, 3946475598UL, 2982283954UL, 3548792804UL, 284542749UL, 1194648577UL, 3087899716UL, +3966595444UL, 2088330116UL, 3641652062UL, 327128507UL, 593906557UL, 1092448919UL, 2459189516UL, 4053392241UL, 3356198248UL, 2352376508UL, 470648997UL, 1017041256UL, 3234172340UL, 3928191489UL, 3266226858UL, 4219289150UL, 1229098319UL, 4275351308UL, 2720777751UL, 3566728718UL, 638322822UL, 2369792461UL, 2869492261UL, 3120083828UL, 1890399556UL, 3309991008UL, 3785452464UL, 4128660314UL, 3726791982UL, 167177896UL, 461294981UL, 3988638998UL, +2937794823UL, 3981029822UL, 1111681402UL, 2015965721UL, 7261806UL, 2669786265UL, 1083582734UL, 3270228881UL, 3892235938UL, 2695872715UL, 4246051290UL, 3214293333UL, 343604199UL, 3215604888UL, 661024127UL, 2931754053UL, 3787840039UL, 2053363765UL, 363432336UL, 112334132UL, 2871797223UL, 138911320UL, 3981126938UL, 2027332192UL, 1804730644UL, 590150270UL, 641538574UL, 6802174UL, 3551446076UL, 3908480472UL, 1004531022UL, 2097228524UL, +1919074232UL, 154482247UL, 121437972UL, 1215661323UL, 1178068273UL, 1097220699UL, 2823681422UL, 262636065UL, 2943371149UL, 1768780720UL, 3866040605UL, 1855991583UL, 3988248086UL, 629223947UL, 3380612330UL, 3552916762UL, 197596340UL, 573801686UL, 2049230598UL, 2910471867UL, 2686314264UL, 1726228846UL, 3516983332UL, 726840185UL, 1241204222UL, 2237574317UL, 70568042UL, 1932610099UL, 2221862221UL, 1510378092UL, 4050391637UL, 4077539568UL, +}, +{ +3872117793UL, 803220151UL, 70843412UL, 1661103032UL, 1976811457UL, 2186373604UL, 564259972UL, 1475436923UL, 2260980893UL, 4245534505UL, 1075107552UL, 3692990573UL, 370098873UL, 4045905424UL, 2420395420UL, 2332395402UL, 207483321UL, 622317750UL, 3004242500UL, 833623111UL, 3151161301UL, 1629139881UL, 352228793UL, 2439953368UL, 3183333619UL, 2703537080UL, 3218957129UL, 3164695888UL, 1741641842UL, 963394141UL, 4241612717UL, 1034476784UL, +2035880432UL, 3977821313UL, 1543311495UL, 3010014356UL, 1638490901UL, 2364265378UL, 3420329129UL, 333361555UL, 1133565821UL, 1450937015UL, 616059115UL, 3216393887UL, 3041978455UL, 3990855695UL, 1238628750UL, 512746184UL, 3256670217UL, 1616316512UL, 2791405051UL, 93474487UL, 2865892488UL, 1901471398UL, 2930857966UL, 2178431077UL, 2325598341UL, 3189256113UL, 1302432091UL, 808592927UL, 2945846737UL, 3487931071UL, 2018175258UL, 752981057UL, +1097082589UL, 1307115286UL, 175147508UL, 3611190164UL, 850238914UL, 3318706185UL, 199743319UL, 328621708UL, 3183670050UL, 3609998315UL, 4075306371UL, 3554549067UL, 2119566187UL, 1498503842UL, 1261870696UL, 2216745780UL, 950288337UL, 1117344941UL, 2150569143UL, 2899286760UL, 1594966374UL, 888858617UL, 35840654UL, 2829539211UL, 2511395669UL, 3607190544UL, 3278412778UL, 2249895907UL, 1320858068UL, 3576889788UL, 266766189UL, 1522426851UL, +1903494122UL, 1928370573UL, 2628132591UL, 3322025904UL, 220280169UL, 433606853UL, 1428961479UL, 986074592UL, 2128892987UL, 467697583UL, 1616913929UL, 325674890UL, 444442578UL, 649166208UL, 1689709565UL, 1493452467UL, 2222122038UL, 121114616UL, 2134348225UL, 3512035688UL, 1283058921UL, 4230441398UL, 3701238559UL, 337534132UL, 1418548715UL, 1190006478UL, 500654385UL, 1766924757UL, 1944680746UL, 940574010UL, 922744002UL, 186142284UL, +3131162902UL, 1693891092UL, 3031823448UL, 2143051534UL, 1429025284UL, 1487843160UL, 3606456133UL, 2079235652UL, 2447285474UL, 2669283767UL, 3232117829UL, 2490054343UL, 3225501736UL, 2911340385UL, 382319031UL, 1516937595UL, 622543191UL, 1388990570UL, 1749179860UL, 1924483707UL, 2593474505UL, 472539197UL, 122872799UL, 2586347240UL, 880588515UL, 4046335279UL, 1712182607UL, 4270737941UL, 1336703451UL, 3390078162UL, 382216945UL, 3733326081UL, +460422073UL, 3872117793UL, 803220151UL, 70843412UL, 1661103032UL, 250339760UL, 2186373604UL, 564259972UL, 1475436923UL, 2260980893UL, 657986735UL, 1075107552UL, 3692990573UL, 370098873UL, 4045905424UL, 3201950123UL, 2332395402UL, 207483321UL, 622317750UL, 3004242500UL, 3732213278UL, 3151161301UL, 1629139881UL, 352228793UL, 2439953368UL, 3572618926UL, 2703537080UL, 3218957129UL, 3164695888UL, 1741641842UL, 685933373UL, 4241612717UL, +1034476784UL, 2035880432UL, 3977821313UL, 3855995181UL, 3010014356UL, 1638490901UL, 2364265378UL, 3420329129UL, 2355603679UL, 1133565821UL, 1450937015UL, 616059115UL, 3216393887UL, 1733804102UL, 3990855695UL, 1238628750UL, 512746184UL, 3256670217UL, 2651059231UL, 2791405051UL, 93474487UL, 2865892488UL, 1901471398UL, 2113461797UL, 2178431077UL, 2325598341UL, 3189256113UL, 1302432091UL, 2986990416UL, 2945846737UL, 3487931071UL, 2018175258UL, +752981057UL, 2428033310UL, 1307115286UL, 175147508UL, 3611190164UL, 850238914UL, 1033628405UL, 199743319UL, 328621708UL, 3183670050UL, 3609998315UL, 4024297327UL, 3554549067UL, 2119566187UL, 1498503842UL, 1261870696UL, 290361143UL, 950288337UL, 1117344941UL, 2150569143UL, 2899286760UL, 168826051UL, 888858617UL, 35840654UL, 2829539211UL, 2511395669UL, 2890882060UL, 3278412778UL, 2249895907UL, 1320858068UL, 3576889788UL, 1794920145UL, +1522426851UL, 1903494122UL, 1928370573UL, 2628132591UL, 1251697758UL, 220280169UL, 433606853UL, 1428961479UL, 986074592UL, 2707115661UL, 467697583UL, 1616913929UL, 325674890UL, 444442578UL, 122781510UL, 1689709565UL, 1493452467UL, 2222122038UL, 121114616UL, 3425723636UL, 3512035688UL, 1283058921UL, 4230441398UL, 3701238559UL, 1646155473UL, 1418548715UL, 1190006478UL, 500654385UL, 1766924757UL, 3920475367UL, 940574010UL, 922744002UL, +186142284UL, 3131162902UL, 54639113UL, 3031823448UL, 2143051534UL, 1429025284UL, 1487843160UL, 4152687885UL, 2079235652UL, 2447285474UL, 2669283767UL, 3232117829UL, 1601035152UL, 3225501736UL, 2911340385UL, 382319031UL, 1516937595UL, 3508441679UL, 1388990570UL, 1749179860UL, 1924483707UL, 2593474505UL, 2835403456UL, 122872799UL, 2586347240UL, 880588515UL, 4046335279UL, 2958058367UL, 4270737941UL, 1336703451UL, 3390078162UL, 382216945UL, +450517882UL, 460422073UL, 3872117793UL, 803220151UL, 70843412UL, 2066343874UL, 250339760UL, 2186373604UL, 564259972UL, 1475436923UL, 1683787449UL, 657986735UL, 1075107552UL, 3692990573UL, 370098873UL, 2615082840UL, 3201950123UL, 2332395402UL, 207483321UL, 622317750UL, 2655424371UL, 3732213278UL, 3151161301UL, 1629139881UL, 352228793UL, 3236724760UL, 3572618926UL, 2703537080UL, 3218957129UL, 3164695888UL, 9775065UL, 685933373UL, +4241612717UL, 1034476784UL, 2035880432UL, 1621920075UL, 3855995181UL, 3010014356UL, 1638490901UL, 2364265378UL, 1509475888UL, 2355603679UL, 1133565821UL, 1450937015UL, 616059115UL, 3666188236UL, 1733804102UL, 3990855695UL, 1238628750UL, 512746184UL, 3900473826UL, 2651059231UL, 2791405051UL, 93474487UL, 2865892488UL, 222759186UL, 2113461797UL, 2178431077UL, 2325598341UL, 3189256113UL, 2505499508UL, 2986990416UL, 2945846737UL, 3487931071UL, +2018175258UL, 2766733928UL, 2428033310UL, 1307115286UL, 175147508UL, 3611190164UL, 1909211603UL, 1033628405UL, 199743319UL, 328621708UL, 3183670050UL, 1680331218UL, 4024297327UL, 3554549067UL, 2119566187UL, 1498503842UL, 3516256046UL, 290361143UL, 950288337UL, 1117344941UL, 2150569143UL, 3182619063UL, 168826051UL, 888858617UL, 35840654UL, 2829539211UL, 645798943UL, 2890882060UL, 3278412778UL, 2249895907UL, 1320858068UL, 1436708568UL, +1794920145UL, 1522426851UL, 1903494122UL, 1928370573UL, 3693049252UL, 1251697758UL, 220280169UL, 433606853UL, 1428961479UL, 3724415861UL, 2707115661UL, 467697583UL, 1616913929UL, 325674890UL, 1448052253UL, 122781510UL, 1689709565UL, 1493452467UL, 2222122038UL, 2177448198UL, 3425723636UL, 3512035688UL, 1283058921UL, 4230441398UL, 3050940272UL, 1646155473UL, 1418548715UL, 1190006478UL, 500654385UL, 1106232UL, 3920475367UL, 940574010UL, +922744002UL, 186142284UL, 4144806511UL, 54639113UL, 3031823448UL, 2143051534UL, 1429025284UL, 2067453848UL, 4152687885UL, 2079235652UL, 2447285474UL, 2669283767UL, 428527087UL, 1601035152UL, 3225501736UL, 2911340385UL, 382319031UL, 2565464472UL, 3508441679UL, 1388990570UL, 1749179860UL, 1924483707UL, 1737735237UL, 2835403456UL, 122872799UL, 2586347240UL, 880588515UL, 597822462UL, 2958058367UL, 4270737941UL, 1336703451UL, 3390078162UL, +2532634475UL, 450517882UL, 460422073UL, 3872117793UL, 803220151UL, 801648827UL, 2066343874UL, 250339760UL, 2186373604UL, 564259972UL, 3417948976UL, 1683787449UL, 657986735UL, 1075107552UL, 3692990573UL, 2235306692UL, 2615082840UL, 3201950123UL, 2332395402UL, 207483321UL, 699310933UL, 2655424371UL, 3732213278UL, 3151161301UL, 1629139881UL, 1152704006UL, 3236724760UL, 3572618926UL, 2703537080UL, 3218957129UL, 2726926336UL, 9775065UL, +685933373UL, 4241612717UL, 1034476784UL, 2398119652UL, 1621920075UL, 3855995181UL, 3010014356UL, 1638490901UL, 252854480UL, 1509475888UL, 2355603679UL, 1133565821UL, 1450937015UL, 2655911639UL, 3666188236UL, 1733804102UL, 3990855695UL, 1238628750UL, 1115900497UL, 3900473826UL, 2651059231UL, 2791405051UL, 93474487UL, 1862985957UL, 222759186UL, 2113461797UL, 2178431077UL, 2325598341UL, 4179075132UL, 2505499508UL, 2986990416UL, 2945846737UL, +3487931071UL, 564667776UL, 2766733928UL, 2428033310UL, 1307115286UL, 175147508UL, 1759077815UL, 1909211603UL, 1033628405UL, 199743319UL, 328621708UL, 2552816198UL, 1680331218UL, 4024297327UL, 3554549067UL, 2119566187UL, 2267805778UL, 3516256046UL, 290361143UL, 950288337UL, 1117344941UL, 2897506172UL, 3182619063UL, 168826051UL, 888858617UL, 35840654UL, 2035476068UL, 645798943UL, 2890882060UL, 3278412778UL, 2249895907UL, 3278449102UL, +1436708568UL, 1794920145UL, 1522426851UL, 1903494122UL, 1500763736UL, 3693049252UL, 1251697758UL, 220280169UL, 433606853UL, 3914497854UL, 3724415861UL, 2707115661UL, 467697583UL, 1616913929UL, 918435305UL, 1448052253UL, 122781510UL, 1689709565UL, 1493452467UL, 609575172UL, 2177448198UL, 3425723636UL, 3512035688UL, 1283058921UL, 3661181550UL, 3050940272UL, 1646155473UL, 1418548715UL, 1190006478UL, 1047301661UL, 1106232UL, 3920475367UL, +940574010UL, 922744002UL, 2510633517UL, 4144806511UL, 54639113UL, 3031823448UL, 2143051534UL, 3242814908UL, 2067453848UL, 4152687885UL, 2079235652UL, 2447285474UL, 736638210UL, 428527087UL, 1601035152UL, 3225501736UL, 2911340385UL, 1849570436UL, 2565464472UL, 3508441679UL, 1388990570UL, 1749179860UL, 84517579UL, 1737735237UL, 2835403456UL, 122872799UL, 2586347240UL, 4002124614UL, 597822462UL, 2958058367UL, 4270737941UL, 1336703451UL, +3078170472UL, 1186434751UL, 700631413UL, 1497890797UL, 1195347450UL, 2560167391UL, 1116697259UL, 1254138573UL, 747913260UL, 240954704UL, 3107512667UL, 360584144UL, 3422778960UL, 3516528389UL, 3301260366UL, 1254513537UL, 122269053UL, 1579582456UL, 873334104UL, 3918835024UL, 1731872444UL, 1974410416UL, 1811172641UL, 4172523062UL, 4092675777UL, 4124987343UL, 1936078756UL, 1757348689UL, 2694415512UL, 128641660UL, 1744777659UL, 3173116729UL, +983733754UL, 1430789547UL, 701906842UL, 3367232568UL, 3266433501UL, 3572590347UL, 1453272962UL, 2106553114UL, 993786201UL, 2149441250UL, 1295181065UL, 2962229026UL, 3709052556UL, 3255608941UL, 3677730029UL, 483873127UL, 102227292UL, 2626265293UL, 2018984578UL, 2266388762UL, 1191709548UL, 2152725916UL, 583672623UL, 2230473473UL, 1995194269UL, 1740347812UL, 2558095372UL, 3070195183UL, 3023333227UL, 2497183195UL, 1908755188UL, 773027539UL, +3646876518UL, 2272586839UL, 493318726UL, 2107067517UL, 2000805278UL, 2530829636UL, 3183628745UL, 677565332UL, 1497629423UL, 82094920UL, 2214054433UL, 2635367545UL, 470855467UL, 2184853389UL, 2942188934UL, 188335670UL, 3656661644UL, 1883526235UL, 3990873975UL, 1490784356UL, 4047548172UL, 3149642641UL, 3289988179UL, 2590918909UL, 2893039564UL, 2350687346UL, 4252624874UL, 15372456UL, 1614496594UL, 2364847678UL, 2604511825UL, 422365460UL, +4195174772UL, 3266964836UL, 2008671995UL, 54038434UL, 781948549UL, 1276017666UL, 2756376612UL, 2436825273UL, 1711863836UL, 3541493950UL, 3821378841UL, 1007557618UL, 345375815UL, 2081905201UL, 2227278118UL, 1185927141UL, 1082173792UL, 3567361925UL, 1940465859UL, 541632942UL, 1830210248UL, 3757851982UL, 775883450UL, 1666577465UL, 1004944607UL, 878440834UL, 2146344131UL, 4195798476UL, 370164841UL, 3649112729UL, 37066142UL, 2311278904UL, +1935745497UL, 2304799402UL, 4107299626UL, 1348526232UL, 2473609635UL, 3284032699UL, 2374292786UL, 1762329186UL, 857978496UL, 1039346432UL, 2621413355UL, 29961014UL, 3582263091UL, 4268542513UL, 3890612190UL, 3096173646UL, 2026544230UL, 3856142618UL, 2347115934UL, 319800326UL, 3255916105UL, 2430273059UL, 823505311UL, 874255188UL, 1401925393UL, 4203707857UL, 4259159566UL, 2606881118UL, 1978288664UL, 1447576038UL, 3860341401UL, 412510348UL, +}, +{ +4052471963UL, 683640040UL, 3043876021UL, 3466644483UL, 4222418025UL, 3035140128UL, 1466027937UL, 18198088UL, 3410320851UL, 3040963721UL, 488404231UL, 3157371815UL, 769336092UL, 3240417718UL, 808582581UL, 2075839263UL, 835026995UL, 3123726486UL, 3284240985UL, 1898453053UL, 3606056482UL, 512836002UL, 2715428547UL, 4182302879UL, 1644882480UL, 3160187826UL, 390292489UL, 980889545UL, 2776206633UL, 2482799995UL, 617042280UL, 3501667414UL, +689451808UL, 497018701UL, 238525753UL, 3890163301UL, 896679896UL, 1544533015UL, 3412477225UL, 3116575138UL, 4250402651UL, 3990990746UL, 819056741UL, 1459334146UL, 158377590UL, 3444755752UL, 8230450UL, 1378706455UL, 684191332UL, 3217423797UL, 2842520097UL, 1631477948UL, 2591254230UL, 959644473UL, 1020694107UL, 1748401915UL, 3452514983UL, 3892766171UL, 1227786994UL, 2086180800UL, 2394613217UL, 2091953150UL, 870094953UL, 2306851481UL, +571550601UL, 488878212UL, 873197214UL, 2630100528UL, 2067476907UL, 2162307009UL, 2026119728UL, 115875280UL, 2905867426UL, 248774881UL, 3110900450UL, 2236032812UL, 1888510348UL, 708001855UL, 996960491UL, 3514196956UL, 1407967546UL, 1826568876UL, 3659618284UL, 2614104317UL, 2230066308UL, 1055135881UL, 2537437343UL, 1858044413UL, 2608594891UL, 2750681169UL, 3241939420UL, 3966440877UL, 2375002886UL, 2417753441UL, 1405878685UL, 1081133199UL, +1496940727UL, 382467042UL, 2745477587UL, 1209424459UL, 811187075UL, 1385604734UL, 2623887355UL, 3443875720UL, 394141555UL, 4142998949UL, 4195414618UL, 1489846841UL, 2253433808UL, 1171450286UL, 84131191UL, 4387588UL, 2641405140UL, 3525405389UL, 3273000909UL, 423660319UL, 2366546732UL, 3698878607UL, 2161119729UL, 4263629085UL, 3029102089UL, 2692507376UL, 3266869596UL, 1658012061UL, 1960169440UL, 1002311379UL, 3724446882UL, 2004188516UL, +999513506UL, 2200093802UL, 4141037460UL, 351865836UL, 412875013UL, 1535823315UL, 3880657632UL, 3109944987UL, 3207577548UL, 3462087941UL, 584875517UL, 2635241084UL, 3834145971UL, 1693380373UL, 3524443732UL, 934775214UL, 1960588847UL, 2226778032UL, 1044609478UL, 12199016UL, 1120582000UL, 226430296UL, 665553142UL, 2570993348UL, 1685535237UL, 3325420136UL, 3925248326UL, 2855346376UL, 1205558328UL, 808835317UL, 3295908896UL, 4170076136UL, +2438272365UL, 4052471963UL, 683640040UL, 3043876021UL, 3466644483UL, 1385549869UL, 3035140128UL, 1466027937UL, 18198088UL, 3410320851UL, 2171386836UL, 488404231UL, 3157371815UL, 769336092UL, 3240417718UL, 2921774554UL, 2075839263UL, 835026995UL, 3123726486UL, 3284240985UL, 72352110UL, 3606056482UL, 512836002UL, 2715428547UL, 4182302879UL, 3869483469UL, 3160187826UL, 390292489UL, 980889545UL, 2776206633UL, 1385691983UL, 617042280UL, +3501667414UL, 689451808UL, 497018701UL, 2600411809UL, 3890163301UL, 896679896UL, 1544533015UL, 3412477225UL, 356556378UL, 4250402651UL, 3990990746UL, 819056741UL, 1459334146UL, 199003993UL, 3444755752UL, 8230450UL, 1378706455UL, 684191332UL, 1750733272UL, 2842520097UL, 1631477948UL, 2591254230UL, 959644473UL, 2113375576UL, 1748401915UL, 3452514983UL, 3892766171UL, 1227786994UL, 275473920UL, 2394613217UL, 2091953150UL, 870094953UL, +2306851481UL, 897057645UL, 488878212UL, 873197214UL, 2630100528UL, 2067476907UL, 944114068UL, 2026119728UL, 115875280UL, 2905867426UL, 248774881UL, 989201307UL, 2236032812UL, 1888510348UL, 708001855UL, 996960491UL, 2121706374UL, 1407967546UL, 1826568876UL, 3659618284UL, 2614104317UL, 2931815032UL, 1055135881UL, 2537437343UL, 1858044413UL, 2608594891UL, 1423973935UL, 3241939420UL, 3966440877UL, 2375002886UL, 2417753441UL, 2514473440UL, +1081133199UL, 1496940727UL, 382467042UL, 2745477587UL, 81977310UL, 811187075UL, 1385604734UL, 2623887355UL, 3443875720UL, 2100629879UL, 4142998949UL, 4195414618UL, 1489846841UL, 2253433808UL, 337182869UL, 84131191UL, 4387588UL, 2641405140UL, 3525405389UL, 661876463UL, 423660319UL, 2366546732UL, 3698878607UL, 2161119729UL, 309510684UL, 3029102089UL, 2692507376UL, 3266869596UL, 1658012061UL, 11119541UL, 1002311379UL, 3724446882UL, +2004188516UL, 999513506UL, 3486722046UL, 4141037460UL, 351865836UL, 412875013UL, 1535823315UL, 2818130700UL, 3109944987UL, 3207577548UL, 3462087941UL, 584875517UL, 322875622UL, 3834145971UL, 1693380373UL, 3524443732UL, 934775214UL, 3879414752UL, 2226778032UL, 1044609478UL, 12199016UL, 1120582000UL, 4207259464UL, 665553142UL, 2570993348UL, 1685535237UL, 3325420136UL, 553869152UL, 2855346376UL, 1205558328UL, 808835317UL, 3295908896UL, +470585896UL, 2438272365UL, 4052471963UL, 683640040UL, 3043876021UL, 1588419572UL, 1385549869UL, 3035140128UL, 1466027937UL, 18198088UL, 363815288UL, 2171386836UL, 488404231UL, 3157371815UL, 769336092UL, 2464768302UL, 2921774554UL, 2075839263UL, 835026995UL, 3123726486UL, 4229246330UL, 72352110UL, 3606056482UL, 512836002UL, 2715428547UL, 319830805UL, 3869483469UL, 3160187826UL, 390292489UL, 980889545UL, 2966401462UL, 1385691983UL, +617042280UL, 3501667414UL, 689451808UL, 4047377762UL, 2600411809UL, 3890163301UL, 896679896UL, 1544533015UL, 764316452UL, 356556378UL, 4250402651UL, 3990990746UL, 819056741UL, 965331966UL, 199003993UL, 3444755752UL, 8230450UL, 1378706455UL, 51902971UL, 1750733272UL, 2842520097UL, 1631477948UL, 2591254230UL, 426039404UL, 2113375576UL, 1748401915UL, 3452514983UL, 3892766171UL, 2833368447UL, 275473920UL, 2394613217UL, 2091953150UL, +870094953UL, 3524323828UL, 897057645UL, 488878212UL, 873197214UL, 2630100528UL, 3939852929UL, 944114068UL, 2026119728UL, 115875280UL, 2905867426UL, 3192643919UL, 989201307UL, 2236032812UL, 1888510348UL, 708001855UL, 2166012172UL, 2121706374UL, 1407967546UL, 1826568876UL, 3659618284UL, 135277096UL, 2931815032UL, 1055135881UL, 2537437343UL, 1858044413UL, 2588429924UL, 1423973935UL, 3241939420UL, 3966440877UL, 2375002886UL, 2477142003UL, +2514473440UL, 1081133199UL, 1496940727UL, 382467042UL, 1760129281UL, 81977310UL, 811187075UL, 1385604734UL, 2623887355UL, 4070531513UL, 2100629879UL, 4142998949UL, 4195414618UL, 1489846841UL, 2688068550UL, 337182869UL, 84131191UL, 4387588UL, 2641405140UL, 1837403234UL, 661876463UL, 423660319UL, 2366546732UL, 3698878607UL, 2916121190UL, 309510684UL, 3029102089UL, 2692507376UL, 3266869596UL, 303422295UL, 11119541UL, 1002311379UL, +3724446882UL, 2004188516UL, 2652711421UL, 3486722046UL, 4141037460UL, 351865836UL, 412875013UL, 113149471UL, 2818130700UL, 3109944987UL, 3207577548UL, 3462087941UL, 1443140792UL, 322875622UL, 3834145971UL, 1693380373UL, 3524443732UL, 901891935UL, 3879414752UL, 2226778032UL, 1044609478UL, 12199016UL, 2213168758UL, 4207259464UL, 665553142UL, 2570993348UL, 1685535237UL, 1114492412UL, 553869152UL, 2855346376UL, 1205558328UL, 808835317UL, +3266626294UL, 470585896UL, 2438272365UL, 4052471963UL, 683640040UL, 3581539398UL, 1588419572UL, 1385549869UL, 3035140128UL, 1466027937UL, 4075470388UL, 363815288UL, 2171386836UL, 488404231UL, 3157371815UL, 2759472233UL, 2464768302UL, 2921774554UL, 2075839263UL, 835026995UL, 1030654310UL, 4229246330UL, 72352110UL, 3606056482UL, 512836002UL, 961858496UL, 319830805UL, 3869483469UL, 3160187826UL, 390292489UL, 2366221117UL, 2966401462UL, +1385691983UL, 617042280UL, 3501667414UL, 295865937UL, 4047377762UL, 2600411809UL, 3890163301UL, 896679896UL, 21714884UL, 764316452UL, 356556378UL, 4250402651UL, 3990990746UL, 1012967081UL, 965331966UL, 199003993UL, 3444755752UL, 8230450UL, 1255302023UL, 51902971UL, 1750733272UL, 2842520097UL, 1631477948UL, 2321320272UL, 426039404UL, 2113375576UL, 1748401915UL, 3452514983UL, 2847013518UL, 2833368447UL, 275473920UL, 2394613217UL, +2091953150UL, 1250695522UL, 3524323828UL, 897057645UL, 488878212UL, 873197214UL, 1452317325UL, 3939852929UL, 944114068UL, 2026119728UL, 115875280UL, 4061820350UL, 3192643919UL, 989201307UL, 2236032812UL, 1888510348UL, 3986446165UL, 2166012172UL, 2121706374UL, 1407967546UL, 1826568876UL, 2910745432UL, 135277096UL, 2931815032UL, 1055135881UL, 2537437343UL, 2976455307UL, 2588429924UL, 1423973935UL, 3241939420UL, 3966440877UL, 2418897705UL, +2477142003UL, 2514473440UL, 1081133199UL, 1496940727UL, 1321648771UL, 1760129281UL, 81977310UL, 811187075UL, 1385604734UL, 17644628UL, 4070531513UL, 2100629879UL, 4142998949UL, 4195414618UL, 2697310527UL, 2688068550UL, 337182869UL, 84131191UL, 4387588UL, 1724191700UL, 1837403234UL, 661876463UL, 423660319UL, 2366546732UL, 693430992UL, 2916121190UL, 309510684UL, 3029102089UL, 2692507376UL, 3917396098UL, 303422295UL, 11119541UL, +1002311379UL, 3724446882UL, 841468294UL, 2652711421UL, 3486722046UL, 4141037460UL, 351865836UL, 1733384185UL, 113149471UL, 2818130700UL, 3109944987UL, 3207577548UL, 2326233100UL, 1443140792UL, 322875622UL, 3834145971UL, 1693380373UL, 1580706359UL, 901891935UL, 3879414752UL, 2226778032UL, 1044609478UL, 3805470822UL, 2213168758UL, 4207259464UL, 665553142UL, 2570993348UL, 3406548636UL, 1114492412UL, 553869152UL, 2855346376UL, 1205558328UL, +4287831475UL, 1329654114UL, 2347235746UL, 2477803138UL, 2962371859UL, 3610024283UL, 4197266903UL, 1162294689UL, 1746713323UL, 2815058477UL, 2152552186UL, 4214791071UL, 2382522482UL, 3713914466UL, 3974765132UL, 348354997UL, 1670276150UL, 2173074887UL, 381736894UL, 3866219357UL, 1919366695UL, 3635118824UL, 2298653261UL, 3534332682UL, 1627699897UL, 4168636618UL, 3787938690UL, 2144231271UL, 2067679462UL, 217001062UL, 2308928337UL, 1620415125UL, +3526559172UL, 749451561UL, 2456947371UL, 3543607786UL, 1893824735UL, 962598819UL, 2332807164UL, 1691114891UL, 2543992233UL, 2914780639UL, 1610287145UL, 1700599697UL, 3185174208UL, 552323208UL, 2367242224UL, 3797136972UL, 3415066418UL, 2468049249UL, 1677937401UL, 40445671UL, 2886682530UL, 2585715434UL, 194932329UL, 2994003812UL, 3099556382UL, 680852222UL, 135838738UL, 1371063256UL, 995454898UL, 3754526418UL, 803635682UL, 634588682UL, +3869250783UL, 2442285521UL, 1455637058UL, 570621479UL, 2512681851UL, 1220136924UL, 750260121UL, 2909903038UL, 1582019728UL, 955115170UL, 1608265445UL, 2157390890UL, 2303678604UL, 1568394164UL, 831914289UL, 1971271392UL, 1294799854UL, 1489945167UL, 442427880UL, 1305083700UL, 1211218668UL, 2380073713UL, 2798736785UL, 2193524273UL, 3227386915UL, 1636588977UL, 3612937642UL, 435113647UL, 1591761830UL, 536210039UL, 2475747073UL, 4223795480UL, +1786737271UL, 1444661534UL, 3249410301UL, 3333695212UL, 4169107188UL, 3280638635UL, 702659930UL, 1444127970UL, 225340755UL, 2255629368UL, 746584456UL, 3965677674UL, 2671132955UL, 2080717656UL, 2145343886UL, 3712441197UL, 368422910UL, 1297685674UL, 4076123901UL, 26214470UL, 2948764826UL, 40503299UL, 1198194334UL, 2100063637UL, 1966331612UL, 2189582064UL, 2064696934UL, 1797550642UL, 3469793941UL, 2868963812UL, 851437659UL, 240918534UL, +365060070UL, 3530600064UL, 39695324UL, 1753898837UL, 1286976449UL, 3131971360UL, 2406485219UL, 3365373704UL, 3224113403UL, 1651742834UL, 587601940UL, 1574206085UL, 3739575036UL, 1413669616UL, 38172232UL, 293127854UL, 4126190109UL, 1891744061UL, 787878666UL, 456643669UL, 4228710325UL, 2025132037UL, 1492133135UL, 3122840937UL, 969442079UL, 3272420439UL, 3836126369UL, 1877655562UL, 2766212758UL, 3867984746UL, 3348077578UL, 1841216706UL, +}, +{ +1676507466UL, 1017841240UL, 2992644565UL, 476936158UL, 2468072723UL, 3113105154UL, 1154120402UL, 460889625UL, 1942263502UL, 1761593999UL, 3020908939UL, 3078194866UL, 310971889UL, 1644896012UL, 3756044556UL, 3549937583UL, 3710822994UL, 3554313733UL, 2174654326UL, 4251063242UL, 2340485150UL, 950951909UL, 4288936895UL, 3744348848UL, 706644559UL, 1085927825UL, 1595992020UL, 3288724966UL, 1367247946UL, 2950094970UL, 3925419886UL, 2628739022UL, +2528254629UL, 3582224789UL, 3907345559UL, 3373329273UL, 4255542251UL, 1185418446UL, 4018656113UL, 2854344020UL, 1381160022UL, 3642438773UL, 4284399225UL, 935780030UL, 4142412144UL, 1263328494UL, 1154237693UL, 2684443667UL, 3067549398UL, 4253090033UL, 1251034970UL, 1874233020UL, 3222830495UL, 3866931656UL, 286048055UL, 3146635362UL, 1436483376UL, 2821876495UL, 3927829532UL, 2648886905UL, 2142862852UL, 1368937545UL, 2647327844UL, 1072219385UL, +2621337706UL, 3543274652UL, 911792564UL, 1204178178UL, 4127214323UL, 2821691380UL, 3101998294UL, 730811902UL, 1989156224UL, 2872353003UL, 278290276UL, 1390223786UL, 2657819643UL, 552729795UL, 1736270535UL, 2759207116UL, 1897013739UL, 3657020278UL, 1387364861UL, 1966588302UL, 1049203087UL, 486446521UL, 3675999281UL, 714737345UL, 686837530UL, 85509025UL, 3609089773UL, 2117061768UL, 3935682560UL, 3859508784UL, 4105287041UL, 1808988481UL, +83680601UL, 1464326680UL, 1657693523UL, 3318062731UL, 1391154023UL, 234460119UL, 3551348221UL, 2245244809UL, 3635923821UL, 2814385745UL, 3497626257UL, 916790795UL, 245338628UL, 2514528380UL, 3711787525UL, 2239286063UL, 1054058916UL, 3963706010UL, 3176203796UL, 2230543409UL, 2173597546UL, 3786733892UL, 1396036965UL, 1038764273UL, 2032556038UL, 3216540537UL, 3298170974UL, 1008892557UL, 141155464UL, 1863766055UL, 3931110690UL, 191299053UL, +2019139711UL, 2409528317UL, 739418419UL, 1377144055UL, 2876702705UL, 3911939673UL, 1197696462UL, 2814009721UL, 600813233UL, 1535885024UL, 1486280357UL, 3084650548UL, 2324695947UL, 2293284974UL, 2036339249UL, 3465600153UL, 1624446108UL, 327866771UL, 3356772175UL, 1826625240UL, 1947102360UL, 3661848193UL, 1421374867UL, 3228945021UL, 1358646008UL, 1067180174UL, 2190741258UL, 643362354UL, 109899594UL, 2064362635UL, 3249674888UL, 2165543887UL, +4180291913UL, 1676507466UL, 1017841240UL, 2992644565UL, 476936158UL, 3608467942UL, 3113105154UL, 1154120402UL, 460889625UL, 1942263502UL, 1862994005UL, 3020908939UL, 3078194866UL, 310971889UL, 1644896012UL, 693774191UL, 3549937583UL, 3710822994UL, 3554313733UL, 2174654326UL, 37658897UL, 2340485150UL, 950951909UL, 4288936895UL, 3744348848UL, 2258231402UL, 1085927825UL, 1595992020UL, 3288724966UL, 1367247946UL, 3850509554UL, 3925419886UL, +2628739022UL, 2528254629UL, 3582224789UL, 3124287811UL, 3373329273UL, 4255542251UL, 1185418446UL, 4018656113UL, 1989726178UL, 1381160022UL, 3642438773UL, 4284399225UL, 935780030UL, 3622052196UL, 1263328494UL, 1154237693UL, 2684443667UL, 3067549398UL, 2786224913UL, 1251034970UL, 1874233020UL, 3222830495UL, 3866931656UL, 1529490307UL, 3146635362UL, 1436483376UL, 2821876495UL, 3927829532UL, 979247444UL, 2142862852UL, 1368937545UL, 2647327844UL, +1072219385UL, 294065371UL, 3543274652UL, 911792564UL, 1204178178UL, 4127214323UL, 103582737UL, 3101998294UL, 730811902UL, 1989156224UL, 2872353003UL, 1885087777UL, 1390223786UL, 2657819643UL, 552729795UL, 1736270535UL, 3325206451UL, 1897013739UL, 3657020278UL, 1387364861UL, 1966588302UL, 2117065739UL, 486446521UL, 3675999281UL, 714737345UL, 686837530UL, 3946214694UL, 3609089773UL, 2117061768UL, 3935682560UL, 3859508784UL, 2916136885UL, +1808988481UL, 83680601UL, 1464326680UL, 1657693523UL, 3438751781UL, 1391154023UL, 234460119UL, 3551348221UL, 2245244809UL, 3948410079UL, 2814385745UL, 3497626257UL, 916790795UL, 245338628UL, 1767303496UL, 3711787525UL, 2239286063UL, 1054058916UL, 3963706010UL, 4140631909UL, 2230543409UL, 2173597546UL, 3786733892UL, 1396036965UL, 1116033475UL, 2032556038UL, 3216540537UL, 3298170974UL, 1008892557UL, 667272562UL, 1863766055UL, 3931110690UL, +191299053UL, 2019139711UL, 272901326UL, 739418419UL, 1377144055UL, 2876702705UL, 3911939673UL, 3839312742UL, 2814009721UL, 600813233UL, 1535885024UL, 1486280357UL, 4256065219UL, 2324695947UL, 2293284974UL, 2036339249UL, 3465600153UL, 1215859603UL, 327866771UL, 3356772175UL, 1826625240UL, 1947102360UL, 4240407984UL, 1421374867UL, 3228945021UL, 1358646008UL, 1067180174UL, 4100357988UL, 643362354UL, 109899594UL, 2064362635UL, 3249674888UL, +2898852084UL, 4180291913UL, 1676507466UL, 1017841240UL, 2992644565UL, 1569683812UL, 3608467942UL, 3113105154UL, 1154120402UL, 460889625UL, 966040649UL, 1862994005UL, 3020908939UL, 3078194866UL, 310971889UL, 786634113UL, 693774191UL, 3549937583UL, 3710822994UL, 3554313733UL, 1578429713UL, 37658897UL, 2340485150UL, 950951909UL, 4288936895UL, 2528123823UL, 2258231402UL, 1085927825UL, 1595992020UL, 3288724966UL, 3544041088UL, 3850509554UL, +3925419886UL, 2628739022UL, 2528254629UL, 2562145937UL, 3124287811UL, 3373329273UL, 4255542251UL, 1185418446UL, 3693565710UL, 1989726178UL, 1381160022UL, 3642438773UL, 4284399225UL, 3271478204UL, 3622052196UL, 1263328494UL, 1154237693UL, 2684443667UL, 3615401444UL, 2786224913UL, 1251034970UL, 1874233020UL, 3222830495UL, 2572413057UL, 1529490307UL, 3146635362UL, 1436483376UL, 2821876495UL, 3993894153UL, 979247444UL, 2142862852UL, 1368937545UL, +2647327844UL, 1353904396UL, 294065371UL, 3543274652UL, 911792564UL, 1204178178UL, 3165709748UL, 103582737UL, 3101998294UL, 730811902UL, 1989156224UL, 893293786UL, 1885087777UL, 1390223786UL, 2657819643UL, 552729795UL, 3388458110UL, 3325206451UL, 1897013739UL, 3657020278UL, 1387364861UL, 3025318046UL, 2117065739UL, 486446521UL, 3675999281UL, 714737345UL, 2085926890UL, 3946214694UL, 3609089773UL, 2117061768UL, 3935682560UL, 868009118UL, +2916136885UL, 1808988481UL, 83680601UL, 1464326680UL, 797410789UL, 3438751781UL, 1391154023UL, 234460119UL, 3551348221UL, 4068940987UL, 3948410079UL, 2814385745UL, 3497626257UL, 916790795UL, 3722456098UL, 1767303496UL, 3711787525UL, 2239286063UL, 1054058916UL, 2030352819UL, 4140631909UL, 2230543409UL, 2173597546UL, 3786733892UL, 3211336683UL, 1116033475UL, 2032556038UL, 3216540537UL, 3298170974UL, 2589589144UL, 667272562UL, 1863766055UL, +3931110690UL, 191299053UL, 1139480458UL, 272901326UL, 739418419UL, 1377144055UL, 2876702705UL, 1954361769UL, 3839312742UL, 2814009721UL, 600813233UL, 1535885024UL, 3587775605UL, 4256065219UL, 2324695947UL, 2293284974UL, 2036339249UL, 1534849280UL, 1215859603UL, 327866771UL, 3356772175UL, 1826625240UL, 720372669UL, 4240407984UL, 1421374867UL, 3228945021UL, 1358646008UL, 3409069246UL, 4100357988UL, 643362354UL, 109899594UL, 2064362635UL, +4243434294UL, 2898852084UL, 4180291913UL, 1676507466UL, 1017841240UL, 3243922356UL, 1569683812UL, 3608467942UL, 3113105154UL, 1154120402UL, 1479311403UL, 966040649UL, 1862994005UL, 3020908939UL, 3078194866UL, 1556392996UL, 786634113UL, 693774191UL, 3549937583UL, 3710822994UL, 920664071UL, 1578429713UL, 37658897UL, 2340485150UL, 950951909UL, 740197415UL, 2528123823UL, 2258231402UL, 1085927825UL, 1595992020UL, 2580760267UL, 3544041088UL, +3850509554UL, 3925419886UL, 2628739022UL, 3867556156UL, 2562145937UL, 3124287811UL, 3373329273UL, 4255542251UL, 3185271749UL, 3693565710UL, 1989726178UL, 1381160022UL, 3642438773UL, 3042165367UL, 3271478204UL, 3622052196UL, 1263328494UL, 1154237693UL, 1016814036UL, 3615401444UL, 2786224913UL, 1251034970UL, 1874233020UL, 2956086971UL, 2572413057UL, 1529490307UL, 3146635362UL, 1436483376UL, 1513970396UL, 3993894153UL, 979247444UL, 2142862852UL, +1368937545UL, 3275665128UL, 1353904396UL, 294065371UL, 3543274652UL, 911792564UL, 2209636872UL, 3165709748UL, 103582737UL, 3101998294UL, 730811902UL, 965151434UL, 893293786UL, 1885087777UL, 1390223786UL, 2657819643UL, 3278634059UL, 3388458110UL, 3325206451UL, 1897013739UL, 3657020278UL, 4293473749UL, 3025318046UL, 2117065739UL, 486446521UL, 3675999281UL, 620561205UL, 2085926890UL, 3946214694UL, 3609089773UL, 2117061768UL, 163384588UL, +868009118UL, 2916136885UL, 1808988481UL, 83680601UL, 10243015UL, 797410789UL, 3438751781UL, 1391154023UL, 234460119UL, 1278218413UL, 4068940987UL, 3948410079UL, 2814385745UL, 3497626257UL, 1233272798UL, 3722456098UL, 1767303496UL, 3711787525UL, 2239286063UL, 3968895688UL, 2030352819UL, 4140631909UL, 2230543409UL, 2173597546UL, 2866251044UL, 3211336683UL, 1116033475UL, 2032556038UL, 3216540537UL, 4233849723UL, 2589589144UL, 667272562UL, +1863766055UL, 3931110690UL, 2468422423UL, 1139480458UL, 272901326UL, 739418419UL, 1377144055UL, 4240143411UL, 1954361769UL, 3839312742UL, 2814009721UL, 600813233UL, 3976840004UL, 3587775605UL, 4256065219UL, 2324695947UL, 2293284974UL, 437604123UL, 1534849280UL, 1215859603UL, 327866771UL, 3356772175UL, 2757237699UL, 720372669UL, 4240407984UL, 1421374867UL, 3228945021UL, 3284801305UL, 3409069246UL, 4100357988UL, 643362354UL, 109899594UL, +1301585321UL, 2528806870UL, 1838904064UL, 448772403UL, 1097849740UL, 1899994097UL, 618309123UL, 1911948510UL, 2309256224UL, 1861398151UL, 905306403UL, 1067595802UL, 36868624UL, 3780886191UL, 835126206UL, 3190251977UL, 2672497726UL, 2085944002UL, 2912993968UL, 2493776706UL, 667136329UL, 1474890786UL, 2383346554UL, 943528949UL, 3376706013UL, 2495573574UL, 144956345UL, 793159960UL, 1591274917UL, 477107637UL, 1383815442UL, 67384899UL, +2355242218UL, 1687409818UL, 3801093871UL, 2108217811UL, 3455908733UL, 4172160797UL, 3935534685UL, 631067839UL, 1187677548UL, 2280856137UL, 3020767646UL, 2063176246UL, 3736904984UL, 2952933848UL, 2975164686UL, 4144473303UL, 34670977UL, 1250976509UL, 3484166554UL, 1532744745UL, 225700994UL, 1878713627UL, 2122358980UL, 1456610194UL, 2917522161UL, 2818947075UL, 102678939UL, 53743858UL, 2095250656UL, 4023979225UL, 3094092874UL, 4128760696UL, +3411610028UL, 3020200609UL, 2225866341UL, 586320946UL, 63813522UL, 1238216159UL, 2825692263UL, 2169937231UL, 3298517640UL, 1542128261UL, 2205544184UL, 1258655704UL, 2629012083UL, 4113650203UL, 3198617867UL, 2742310794UL, 3372657381UL, 3115904410UL, 1948638822UL, 1123521744UL, 1080429281UL, 4086706732UL, 4142693211UL, 817377147UL, 2570194641UL, 26001503UL, 2861456160UL, 4185725555UL, 2573003804UL, 1618628779UL, 2588489212UL, 3996192609UL, +1555844274UL, 1003123505UL, 1326350123UL, 1130583849UL, 3017128756UL, 74119042UL, 4041266437UL, 1938014170UL, 3528465794UL, 4203969698UL, 1913054398UL, 3617979809UL, 2218810167UL, 2453899816UL, 1997423206UL, 477446533UL, 303090065UL, 757937082UL, 1523238256UL, 3140505311UL, 1422588701UL, 3642014639UL, 1740624195UL, 1276017154UL, 3072526193UL, 3675105122UL, 1335122682UL, 4080595263UL, 2308519420UL, 3299182769UL, 1461978532UL, 3098694217UL, +2982399822UL, 3088698511UL, 586759229UL, 3548750902UL, 1449857891UL, 2866451663UL, 2525162286UL, 57294602UL, 4107991297UL, 1214672265UL, 2940391280UL, 4285346034UL, 3338216759UL, 737207923UL, 4264163846UL, 59219141UL, 2300024654UL, 1876616814UL, 1976543605UL, 783571061UL, 1724699622UL, 1967524469UL, 1650309916UL, 3322257631UL, 3975521122UL, 273342162UL, 1156754241UL, 185315896UL, 3368133921UL, 66314655UL, 4153777915UL, 3519901897UL, +}, +{ +3672467167UL, 68684525UL, 1738833632UL, 3081329135UL, 2583806115UL, 2291130512UL, 503032614UL, 3658059597UL, 571493931UL, 685537959UL, 3498787788UL, 422428426UL, 3879256913UL, 1173158320UL, 4000800121UL, 298972869UL, 1718342816UL, 2541691685UL, 2490502642UL, 2321452806UL, 4223212804UL, 1812334632UL, 3717655725UL, 4238191852UL, 3001307165UL, 2621896355UL, 2572404999UL, 3590094954UL, 760765206UL, 2293618001UL, 1392353032UL, 1733137169UL, +2674005018UL, 4067961151UL, 1505710487UL, 451078217UL, 2591688848UL, 12635611UL, 507045428UL, 694822241UL, 1789383090UL, 1140183890UL, 1720695967UL, 1994318191UL, 3340349873UL, 2793804971UL, 1054433135UL, 2345087879UL, 3179939285UL, 1651968615UL, 1793223686UL, 1055357758UL, 914271617UL, 483007580UL, 2127727816UL, 2754998083UL, 3179053982UL, 598442002UL, 1950227301UL, 213053613UL, 3566888111UL, 2832258993UL, 4260365359UL, 443662829UL, +1706542890UL, 3852730296UL, 3643260763UL, 2163607277UL, 1812905006UL, 171529637UL, 215187467UL, 2369406909UL, 1929000706UL, 2572441025UL, 2133955541UL, 810692262UL, 1337974799UL, 4030350704UL, 2159178715UL, 3769451556UL, 1026825278UL, 593628480UL, 1817383139UL, 878832429UL, 2253876350UL, 203612980UL, 2102950440UL, 3407143936UL, 1912362251UL, 1595387637UL, 2827580539UL, 305467658UL, 3292706746UL, 44135525UL, 4001933553UL, 3697343089UL, +760470915UL, 587414402UL, 1419378814UL, 2852774010UL, 3891626781UL, 2757016765UL, 1090707384UL, 3997074427UL, 1047182100UL, 2855539022UL, 36229159UL, 1591415533UL, 3471572739UL, 1237952140UL, 2614469314UL, 213338525UL, 886212578UL, 2620301943UL, 713590207UL, 2430496777UL, 1198164420UL, 2644841698UL, 3654164701UL, 36283572UL, 1461695896UL, 1770331341UL, 1641501876UL, 3470919184UL, 3181021559UL, 3053795110UL, 3533531372UL, 3134337355UL, +668308383UL, 388340999UL, 3221275220UL, 1589659138UL, 294382235UL, 1447443579UL, 690177534UL, 1799726917UL, 2838977761UL, 4172949119UL, 2360858031UL, 159385920UL, 2248389027UL, 1790015671UL, 3925738275UL, 1049918544UL, 4107349511UL, 1619955951UL, 4188275966UL, 1672572975UL, 2672697497UL, 1863413666UL, 747724021UL, 4037561738UL, 1605940213UL, 445253292UL, 3362434828UL, 610898209UL, 1473244091UL, 735444769UL, 1540599852UL, 2449351720UL, +1032410949UL, 3672467167UL, 68684525UL, 1738833632UL, 3081329135UL, 519684794UL, 2291130512UL, 503032614UL, 3658059597UL, 571493931UL, 2400186105UL, 3498787788UL, 422428426UL, 3879256913UL, 1173158320UL, 4120704752UL, 298972869UL, 1718342816UL, 2541691685UL, 2490502642UL, 1686027891UL, 4223212804UL, 1812334632UL, 3717655725UL, 4238191852UL, 642431972UL, 2621896355UL, 2572404999UL, 3590094954UL, 760765206UL, 2949609717UL, 1392353032UL, +1733137169UL, 2674005018UL, 4067961151UL, 1526077846UL, 451078217UL, 2591688848UL, 12635611UL, 507045428UL, 2417951415UL, 1789383090UL, 1140183890UL, 1720695967UL, 1994318191UL, 3465605863UL, 2793804971UL, 1054433135UL, 2345087879UL, 3179939285UL, 3079297626UL, 1793223686UL, 1055357758UL, 914271617UL, 483007580UL, 306802527UL, 2754998083UL, 3179053982UL, 598442002UL, 1950227301UL, 2473418737UL, 3566888111UL, 2832258993UL, 4260365359UL, +443662829UL, 2097776414UL, 3852730296UL, 3643260763UL, 2163607277UL, 1812905006UL, 3957721904UL, 215187467UL, 2369406909UL, 1929000706UL, 2572441025UL, 3779486126UL, 810692262UL, 1337974799UL, 4030350704UL, 2159178715UL, 1127012865UL, 1026825278UL, 593628480UL, 1817383139UL, 878832429UL, 361018423UL, 203612980UL, 2102950440UL, 3407143936UL, 1912362251UL, 1475218277UL, 2827580539UL, 305467658UL, 3292706746UL, 44135525UL, 1900092336UL, +3697343089UL, 760470915UL, 587414402UL, 1419378814UL, 343303227UL, 3891626781UL, 2757016765UL, 1090707384UL, 3997074427UL, 745490961UL, 2855539022UL, 36229159UL, 1591415533UL, 3471572739UL, 3920625546UL, 2614469314UL, 213338525UL, 886212578UL, 2620301943UL, 827771411UL, 2430496777UL, 1198164420UL, 2644841698UL, 3654164701UL, 2747674190UL, 1461695896UL, 1770331341UL, 1641501876UL, 3470919184UL, 919857376UL, 3053795110UL, 3533531372UL, +3134337355UL, 668308383UL, 201138876UL, 3221275220UL, 1589659138UL, 294382235UL, 1447443579UL, 4211579707UL, 1799726917UL, 2838977761UL, 4172949119UL, 2360858031UL, 416103844UL, 2248389027UL, 1790015671UL, 3925738275UL, 1049918544UL, 3481887924UL, 1619955951UL, 4188275966UL, 1672572975UL, 2672697497UL, 564854400UL, 747724021UL, 4037561738UL, 1605940213UL, 445253292UL, 604900912UL, 610898209UL, 1473244091UL, 735444769UL, 1540599852UL, +3036173307UL, 1032410949UL, 3672467167UL, 68684525UL, 1738833632UL, 973022696UL, 519684794UL, 2291130512UL, 503032614UL, 3658059597UL, 1500301452UL, 2400186105UL, 3498787788UL, 422428426UL, 3879256913UL, 3923611748UL, 4120704752UL, 298972869UL, 1718342816UL, 2541691685UL, 2323881484UL, 1686027891UL, 4223212804UL, 1812334632UL, 3717655725UL, 2109094458UL, 642431972UL, 2621896355UL, 2572404999UL, 3590094954UL, 1837882537UL, 2949609717UL, +1392353032UL, 1733137169UL, 2674005018UL, 3252348987UL, 1526077846UL, 451078217UL, 2591688848UL, 12635611UL, 3971261781UL, 2417951415UL, 1789383090UL, 1140183890UL, 1720695967UL, 2906966040UL, 3465605863UL, 2793804971UL, 1054433135UL, 2345087879UL, 915518921UL, 3079297626UL, 1793223686UL, 1055357758UL, 914271617UL, 791633499UL, 306802527UL, 2754998083UL, 3179053982UL, 598442002UL, 324402573UL, 2473418737UL, 3566888111UL, 2832258993UL, +4260365359UL, 2168046398UL, 2097776414UL, 3852730296UL, 3643260763UL, 2163607277UL, 2595175979UL, 3957721904UL, 215187467UL, 2369406909UL, 1929000706UL, 657446369UL, 3779486126UL, 810692262UL, 1337974799UL, 4030350704UL, 1865557469UL, 1127012865UL, 1026825278UL, 593628480UL, 1817383139UL, 3414354529UL, 361018423UL, 203612980UL, 2102950440UL, 3407143936UL, 1739372987UL, 1475218277UL, 2827580539UL, 305467658UL, 3292706746UL, 825045562UL, +1900092336UL, 3697343089UL, 760470915UL, 587414402UL, 2000637694UL, 343303227UL, 3891626781UL, 2757016765UL, 1090707384UL, 4015377800UL, 745490961UL, 2855539022UL, 36229159UL, 1591415533UL, 2208656873UL, 3920625546UL, 2614469314UL, 213338525UL, 886212578UL, 2729976209UL, 827771411UL, 2430496777UL, 1198164420UL, 2644841698UL, 1922667440UL, 2747674190UL, 1461695896UL, 1770331341UL, 1641501876UL, 357535311UL, 919857376UL, 3053795110UL, +3533531372UL, 3134337355UL, 1004072597UL, 201138876UL, 3221275220UL, 1589659138UL, 294382235UL, 1148950143UL, 4211579707UL, 1799726917UL, 2838977761UL, 4172949119UL, 892664404UL, 416103844UL, 2248389027UL, 1790015671UL, 3925738275UL, 2612357890UL, 3481887924UL, 1619955951UL, 4188275966UL, 1672572975UL, 2005534713UL, 564854400UL, 747724021UL, 4037561738UL, 1605940213UL, 2620990454UL, 604900912UL, 610898209UL, 1473244091UL, 735444769UL, +3571225334UL, 3036173307UL, 1032410949UL, 3672467167UL, 68684525UL, 3327351604UL, 973022696UL, 519684794UL, 2291130512UL, 503032614UL, 3814902238UL, 1500301452UL, 2400186105UL, 3498787788UL, 422428426UL, 1756753750UL, 3923611748UL, 4120704752UL, 298972869UL, 1718342816UL, 652903081UL, 2323881484UL, 1686027891UL, 4223212804UL, 1812334632UL, 1599640566UL, 2109094458UL, 642431972UL, 2621896355UL, 2572404999UL, 1668409355UL, 1837882537UL, +2949609717UL, 1392353032UL, 1733137169UL, 3691709793UL, 3252348987UL, 1526077846UL, 451078217UL, 2591688848UL, 3353622601UL, 3971261781UL, 2417951415UL, 1789383090UL, 1140183890UL, 4113853791UL, 2906966040UL, 3465605863UL, 2793804971UL, 1054433135UL, 2195882948UL, 915518921UL, 3079297626UL, 1793223686UL, 1055357758UL, 898713552UL, 791633499UL, 306802527UL, 2754998083UL, 3179053982UL, 2469350088UL, 324402573UL, 2473418737UL, 3566888111UL, +2832258993UL, 1377718274UL, 2168046398UL, 2097776414UL, 3852730296UL, 3643260763UL, 3492388484UL, 2595175979UL, 3957721904UL, 215187467UL, 2369406909UL, 4243449339UL, 657446369UL, 3779486126UL, 810692262UL, 1337974799UL, 3960230785UL, 1865557469UL, 1127012865UL, 1026825278UL, 593628480UL, 732793312UL, 3414354529UL, 361018423UL, 203612980UL, 2102950440UL, 2401792405UL, 1739372987UL, 1475218277UL, 2827580539UL, 305467658UL, 2454275289UL, +825045562UL, 1900092336UL, 3697343089UL, 760470915UL, 2146882409UL, 2000637694UL, 343303227UL, 3891626781UL, 2757016765UL, 3997473261UL, 4015377800UL, 745490961UL, 2855539022UL, 36229159UL, 2375394427UL, 2208656873UL, 3920625546UL, 2614469314UL, 213338525UL, 2055366274UL, 2729976209UL, 827771411UL, 2430496777UL, 1198164420UL, 1789631187UL, 1922667440UL, 2747674190UL, 1461695896UL, 1770331341UL, 4284442852UL, 357535311UL, 919857376UL, +3053795110UL, 3533531372UL, 2124270060UL, 1004072597UL, 201138876UL, 3221275220UL, 1589659138UL, 1418386120UL, 1148950143UL, 4211579707UL, 1799726917UL, 2838977761UL, 3540708069UL, 892664404UL, 416103844UL, 2248389027UL, 1790015671UL, 3936883UL, 2612357890UL, 3481887924UL, 1619955951UL, 4188275966UL, 2963623483UL, 2005534713UL, 564854400UL, 747724021UL, 4037561738UL, 3431155922UL, 2620990454UL, 604900912UL, 610898209UL, 1473244091UL, +3880001339UL, 2879060316UL, 3300897679UL, 3960972039UL, 3201086624UL, 3814462934UL, 3426650044UL, 1930881632UL, 1981178788UL, 2956279691UL, 4272406256UL, 372705521UL, 1359389771UL, 1590302979UL, 3940206208UL, 3817999127UL, 2527835456UL, 2739078164UL, 716997849UL, 3235607043UL, 2550297745UL, 3688700200UL, 354502605UL, 2285793656UL, 2339138034UL, 3912354142UL, 2262255668UL, 469322622UL, 1319943359UL, 1916101235UL, 200441823UL, 509436982UL, +2160284593UL, 1687919695UL, 4153615582UL, 495735041UL, 3694469424UL, 2086893117UL, 4223008799UL, 105344742UL, 1698033424UL, 1149223145UL, 4183918790UL, 4176151950UL, 415739351UL, 817762972UL, 3768072560UL, 1931430949UL, 2698979439UL, 3481477932UL, 1994322914UL, 4078299950UL, 1268233995UL, 3254069145UL, 91029129UL, 498234704UL, 1636613942UL, 3710087092UL, 3876816560UL, 3510446387UL, 3870169008UL, 1370156410UL, 2442498047UL, 2324396523UL, +1258730334UL, 621954739UL, 1053015373UL, 491820717UL, 3386515432UL, 2203703266UL, 120167176UL, 2383669740UL, 1038666440UL, 2927342870UL, 3583197824UL, 1236241846UL, 2474675929UL, 679052891UL, 2451259584UL, 2177706146UL, 606842882UL, 3546980104UL, 2289281509UL, 353873434UL, 2041926837UL, 1238346748UL, 2729109726UL, 2843938395UL, 2938124210UL, 2554443866UL, 1494477920UL, 693378319UL, 2020963566UL, 2000385949UL, 3744098787UL, 650307220UL, +2631327075UL, 1529128757UL, 595871428UL, 3206666562UL, 458062987UL, 875238192UL, 3729317374UL, 1368843921UL, 3478430230UL, 3234384578UL, 3232435428UL, 321359326UL, 994274524UL, 361184397UL, 4285497594UL, 915263578UL, 1486882838UL, 9988613UL, 829077170UL, 677216046UL, 4141828204UL, 165804609UL, 1086678519UL, 2933434608UL, 1351662802UL, 2640085040UL, 2611502932UL, 2033698714UL, 2008873254UL, 3995557835UL, 1020873906UL, 67873555UL, +2230337823UL, 1263800417UL, 1148712155UL, 3985159589UL, 2979503513UL, 2854714997UL, 1539343345UL, 2751484352UL, 1569100732UL, 2020758949UL, 2126757134UL, 3426641899UL, 2808587825UL, 1953320148UL, 1096398464UL, 1502907172UL, 3751230087UL, 765557661UL, 765290990UL, 3056075500UL, 2040620632UL, 422573751UL, 3613558930UL, 1741145769UL, 273531216UL, 837238736UL, 494297893UL, 2903251124UL, 1636782182UL, 4256592784UL, 3652746656UL, 4258393217UL, +}, +{ +2657510202UL, 270297201UL, 2970166904UL, 3151626326UL, 973127447UL, 1523852613UL, 598650578UL, 10289043UL, 1138773500UL, 1379558769UL, 2202575480UL, 1622690708UL, 181345079UL, 228706650UL, 2807760507UL, 3061024281UL, 2310359315UL, 3094465578UL, 4062753882UL, 2744510393UL, 3844622451UL, 1759718963UL, 2393602744UL, 977540509UL, 870449791UL, 1484134272UL, 2838962253UL, 3079492430UL, 2617141201UL, 3744868057UL, 994295425UL, 1302594555UL, +277777192UL, 1793039043UL, 1620482692UL, 2518563014UL, 1163760339UL, 2709515777UL, 4220588138UL, 531143270UL, 2528377633UL, 931694828UL, 1472659070UL, 900489303UL, 3538137811UL, 3849822545UL, 1304182427UL, 2423451948UL, 587259647UL, 296795227UL, 3843393378UL, 100570026UL, 1824916038UL, 3155192628UL, 1205830295UL, 2205840913UL, 2598785234UL, 2138099222UL, 1585588098UL, 1304106911UL, 2443465671UL, 3007665864UL, 3350433156UL, 3623458138UL, +629407548UL, 3209244941UL, 2102270358UL, 952701496UL, 2715374730UL, 2142960491UL, 2566649458UL, 2386659994UL, 4201648072UL, 367516884UL, 211986877UL, 3970312395UL, 4153651951UL, 3794120671UL, 614826776UL, 769672874UL, 2218713182UL, 236114529UL, 1614697510UL, 2420862368UL, 3471485219UL, 3080341429UL, 2394724619UL, 3585194114UL, 1394678495UL, 2137969611UL, 3955498999UL, 2765569351UL, 3084915757UL, 765232390UL, 1406483345UL, 2796499268UL, +2491128017UL, 1052428931UL, 1713430644UL, 3921576513UL, 3753414774UL, 973530327UL, 2545412294UL, 1841110931UL, 1174406073UL, 1104865218UL, 1586606252UL, 2612244473UL, 1407875673UL, 1823397519UL, 2613642581UL, 3163449384UL, 3129975397UL, 2059184961UL, 818092118UL, 3182607992UL, 1658516909UL, 2467681581UL, 1065789733UL, 799857247UL, 2492902195UL, 168866110UL, 2251316716UL, 1607684829UL, 2347941418UL, 2382781983UL, 3298500129UL, 3609200925UL, +3060374324UL, 2602420483UL, 2357812057UL, 3739699403UL, 3260652552UL, 205015857UL, 1936033273UL, 3955997259UL, 821264237UL, 1882720491UL, 159294165UL, 3197657094UL, 528058988UL, 2768830342UL, 805087358UL, 896645931UL, 1360375456UL, 3417488932UL, 3863200799UL, 4033907887UL, 983658874UL, 1828706965UL, 875027318UL, 1310362653UL, 3711487613UL, 4148261033UL, 3145162047UL, 485182003UL, 2633647498UL, 1369395018UL, 4163384029UL, 1827719274UL, +270658892UL, 2657510202UL, 270297201UL, 2970166904UL, 3151626326UL, 499420828UL, 1523852613UL, 598650578UL, 10289043UL, 1138773500UL, 640170086UL, 2202575480UL, 1622690708UL, 181345079UL, 228706650UL, 3957853780UL, 3061024281UL, 2310359315UL, 3094465578UL, 4062753882UL, 2049506087UL, 3844622451UL, 1759718963UL, 2393602744UL, 977540509UL, 2346891936UL, 1484134272UL, 2838962253UL, 3079492430UL, 2617141201UL, 2112540708UL, 994295425UL, +1302594555UL, 277777192UL, 1793039043UL, 981072592UL, 2518563014UL, 1163760339UL, 2709515777UL, 4220588138UL, 1992965594UL, 2528377633UL, 931694828UL, 1472659070UL, 900489303UL, 32461040UL, 3849822545UL, 1304182427UL, 2423451948UL, 587259647UL, 3728056788UL, 3843393378UL, 100570026UL, 1824916038UL, 3155192628UL, 1194916233UL, 2205840913UL, 2598785234UL, 2138099222UL, 1585588098UL, 2944318376UL, 2443465671UL, 3007665864UL, 3350433156UL, +3623458138UL, 1413669939UL, 3209244941UL, 2102270358UL, 952701496UL, 2715374730UL, 826676012UL, 2566649458UL, 2386659994UL, 4201648072UL, 367516884UL, 4272143576UL, 3970312395UL, 4153651951UL, 3794120671UL, 614826776UL, 4106382849UL, 2218713182UL, 236114529UL, 1614697510UL, 2420862368UL, 138091237UL, 3080341429UL, 2394724619UL, 3585194114UL, 1394678495UL, 2113895281UL, 3955498999UL, 2765569351UL, 3084915757UL, 765232390UL, 2247301699UL, +2796499268UL, 2491128017UL, 1052428931UL, 1713430644UL, 1076867271UL, 3753414774UL, 973530327UL, 2545412294UL, 1841110931UL, 3427639042UL, 1104865218UL, 1586606252UL, 2612244473UL, 1407875673UL, 2159805028UL, 2613642581UL, 3163449384UL, 3129975397UL, 2059184961UL, 1251595655UL, 3182607992UL, 1658516909UL, 2467681581UL, 1065789733UL, 524065102UL, 2492902195UL, 168866110UL, 2251316716UL, 1607684829UL, 877205873UL, 2382781983UL, 3298500129UL, +3609200925UL, 3060374324UL, 1983477493UL, 2357812057UL, 3739699403UL, 3260652552UL, 205015857UL, 3578808491UL, 3955997259UL, 821264237UL, 1882720491UL, 159294165UL, 3639531297UL, 528058988UL, 2768830342UL, 805087358UL, 896645931UL, 2309781073UL, 3417488932UL, 3863200799UL, 4033907887UL, 983658874UL, 3756437847UL, 875027318UL, 1310362653UL, 3711487613UL, 4148261033UL, 3264363953UL, 485182003UL, 2633647498UL, 1369395018UL, 4163384029UL, +184614728UL, 270658892UL, 2657510202UL, 270297201UL, 2970166904UL, 884907665UL, 499420828UL, 1523852613UL, 598650578UL, 10289043UL, 2023902217UL, 640170086UL, 2202575480UL, 1622690708UL, 181345079UL, 1358722197UL, 3957853780UL, 3061024281UL, 2310359315UL, 3094465578UL, 4156960892UL, 2049506087UL, 3844622451UL, 1759718963UL, 2393602744UL, 1018272187UL, 2346891936UL, 1484134272UL, 2838962253UL, 3079492430UL, 663361761UL, 2112540708UL, +994295425UL, 1302594555UL, 277777192UL, 4201292427UL, 981072592UL, 2518563014UL, 1163760339UL, 2709515777UL, 3301905324UL, 1992965594UL, 2528377633UL, 931694828UL, 1472659070UL, 3170286187UL, 32461040UL, 3849822545UL, 1304182427UL, 2423451948UL, 166213287UL, 3728056788UL, 3843393378UL, 100570026UL, 1824916038UL, 1534589402UL, 1194916233UL, 2205840913UL, 2598785234UL, 2138099222UL, 767439709UL, 2944318376UL, 2443465671UL, 3007665864UL, +3350433156UL, 257274072UL, 1413669939UL, 3209244941UL, 2102270358UL, 952701496UL, 893224047UL, 826676012UL, 2566649458UL, 2386659994UL, 4201648072UL, 1336000731UL, 4272143576UL, 3970312395UL, 4153651951UL, 3794120671UL, 2381517352UL, 4106382849UL, 2218713182UL, 236114529UL, 1614697510UL, 2427291612UL, 138091237UL, 3080341429UL, 2394724619UL, 3585194114UL, 1339840651UL, 2113895281UL, 3955498999UL, 2765569351UL, 3084915757UL, 1920073265UL, +2247301699UL, 2796499268UL, 2491128017UL, 1052428931UL, 1720704700UL, 1076867271UL, 3753414774UL, 973530327UL, 2545412294UL, 655938239UL, 3427639042UL, 1104865218UL, 1586606252UL, 2612244473UL, 748629647UL, 2159805028UL, 2613642581UL, 3163449384UL, 3129975397UL, 1868740512UL, 1251595655UL, 3182607992UL, 1658516909UL, 2467681581UL, 3092135795UL, 524065102UL, 2492902195UL, 168866110UL, 2251316716UL, 229376275UL, 877205873UL, 2382781983UL, +3298500129UL, 3609200925UL, 1270454086UL, 1983477493UL, 2357812057UL, 3739699403UL, 3260652552UL, 3976376418UL, 3578808491UL, 3955997259UL, 821264237UL, 1882720491UL, 2211365699UL, 3639531297UL, 528058988UL, 2768830342UL, 805087358UL, 1351870678UL, 2309781073UL, 3417488932UL, 3863200799UL, 4033907887UL, 2317721807UL, 3756437847UL, 875027318UL, 1310362653UL, 3711487613UL, 1929459086UL, 3264363953UL, 485182003UL, 2633647498UL, 1369395018UL, +2141675718UL, 184614728UL, 270658892UL, 2657510202UL, 270297201UL, 3337954073UL, 884907665UL, 499420828UL, 1523852613UL, 598650578UL, 3874207188UL, 2023902217UL, 640170086UL, 2202575480UL, 1622690708UL, 2020255059UL, 1358722197UL, 3957853780UL, 3061024281UL, 2310359315UL, 753738868UL, 4156960892UL, 2049506087UL, 3844622451UL, 1759718963UL, 1672276116UL, 1018272187UL, 2346891936UL, 1484134272UL, 2838962253UL, 1680679979UL, 663361761UL, +2112540708UL, 994295425UL, 1302594555UL, 1941500850UL, 4201292427UL, 981072592UL, 2518563014UL, 1163760339UL, 184357645UL, 3301905324UL, 1992965594UL, 2528377633UL, 931694828UL, 3462653134UL, 3170286187UL, 32461040UL, 3849822545UL, 1304182427UL, 396808784UL, 166213287UL, 3728056788UL, 3843393378UL, 100570026UL, 876691173UL, 1534589402UL, 1194916233UL, 2205840913UL, 2598785234UL, 4286653520UL, 767439709UL, 2944318376UL, 2443465671UL, +3007665864UL, 2793587144UL, 257274072UL, 1413669939UL, 3209244941UL, 2102270358UL, 2792966616UL, 893224047UL, 826676012UL, 2566649458UL, 2386659994UL, 798757973UL, 1336000731UL, 4272143576UL, 3970312395UL, 4153651951UL, 2930383268UL, 2381517352UL, 4106382849UL, 2218713182UL, 236114529UL, 1936008889UL, 2427291612UL, 138091237UL, 3080341429UL, 2394724619UL, 4157586029UL, 1339840651UL, 2113895281UL, 3955498999UL, 2765569351UL, 2243544114UL, +1920073265UL, 2247301699UL, 2796499268UL, 2491128017UL, 3372810009UL, 1720704700UL, 1076867271UL, 3753414774UL, 973530327UL, 484392041UL, 655938239UL, 3427639042UL, 1104865218UL, 1586606252UL, 1373046326UL, 748629647UL, 2159805028UL, 2613642581UL, 3163449384UL, 1558595520UL, 1868740512UL, 1251595655UL, 3182607992UL, 1658516909UL, 3503432306UL, 3092135795UL, 524065102UL, 2492902195UL, 168866110UL, 4106973392UL, 229376275UL, 877205873UL, +2382781983UL, 3298500129UL, 2366096961UL, 1270454086UL, 1983477493UL, 2357812057UL, 3739699403UL, 4223323197UL, 3976376418UL, 3578808491UL, 3955997259UL, 821264237UL, 1581729952UL, 2211365699UL, 3639531297UL, 528058988UL, 2768830342UL, 3946263978UL, 1351870678UL, 2309781073UL, 3417488932UL, 3863200799UL, 3948072426UL, 2317721807UL, 3756437847UL, 875027318UL, 1310362653UL, 3439391360UL, 1929459086UL, 3264363953UL, 485182003UL, 2633647498UL, +3576868480UL, 2527748673UL, 3116247125UL, 4020801612UL, 2594734840UL, 3308177137UL, 665011257UL, 40118275UL, 3584569179UL, 3399729283UL, 3867174947UL, 658488234UL, 1099195903UL, 2274511402UL, 1872529118UL, 2518961094UL, 2633598693UL, 4160728307UL, 449442630UL, 164837956UL, 1010805767UL, 605336924UL, 1178031445UL, 3949359502UL, 2585151633UL, 611885521UL, 293204651UL, 3389557188UL, 1172294301UL, 2503819061UL, 659842653UL, 504992348UL, +3762165683UL, 1799777932UL, 4161843209UL, 1924622448UL, 1006263939UL, 115233249UL, 2775142171UL, 3228632586UL, 885407023UL, 2514866293UL, 3615088636UL, 2488824172UL, 2631364137UL, 1454226414UL, 3888177876UL, 70646265UL, 2291458600UL, 2370783730UL, 1566625834UL, 3652033806UL, 4136806683UL, 2819973124UL, 3207365429UL, 989185345UL, 3343822313UL, 2580472874UL, 4077285847UL, 4032963783UL, 2883518039UL, 2253593637UL, 904631114UL, 2654790756UL, +2967911632UL, 2131672564UL, 1594073414UL, 2370718497UL, 3769371275UL, 1547951748UL, 2473303924UL, 651625138UL, 2159175883UL, 4062995539UL, 696224922UL, 3388626509UL, 100118553UL, 770731124UL, 2149458689UL, 3223175313UL, 3524052514UL, 2651241522UL, 78236806UL, 3212708723UL, 1045780878UL, 2257575290UL, 3709360831UL, 966829465UL, 61269250UL, 405063245UL, 331731998UL, 2472078870UL, 1138237364UL, 1135091387UL, 3245001409UL, 3817992705UL, +1738939574UL, 1397617581UL, 2896546651UL, 4207083421UL, 3802162100UL, 391930524UL, 1326819828UL, 85308067UL, 3235336831UL, 686989692UL, 1947564282UL, 842881662UL, 2887279866UL, 3850666935UL, 2001895525UL, 2673649961UL, 2106555006UL, 1762053005UL, 2334552700UL, 26094213UL, 1184502058UL, 2048598709UL, 4039640450UL, 1439363714UL, 1022688817UL, 1053169108UL, 170896272UL, 444231850UL, 1500204748UL, 1077470703UL, 1630597179UL, 1382588806UL, +138805391UL, 1636536505UL, 3118018426UL, 3461152216UL, 2486547351UL, 2045361316UL, 2976067436UL, 468876399UL, 1407419455UL, 3226137264UL, 414206328UL, 1011039713UL, 3537947031UL, 2359787831UL, 258556532UL, 3615987029UL, 3372097337UL, 3586352388UL, 1056198830UL, 1852291192UL, 3888893481UL, 746156045UL, 4203877603UL, 297851145UL, 2615507398UL, 1141098641UL, 1881412583UL, 3014341741UL, 2125186797UL, 229307235UL, 3476606674UL, 3553854689UL, +}, +{ +3768542219UL, 2777948797UL, 3328832678UL, 3488502819UL, 2708053041UL, 2217907094UL, 2133505056UL, 2218961277UL, 2148551748UL, 1420045625UL, 1709182366UL, 1816409641UL, 3791695288UL, 4207813971UL, 22588497UL, 2211317602UL, 616238454UL, 2394270012UL, 3212896041UL, 213408768UL, 2199328374UL, 3188624050UL, 811443809UL, 2818548979UL, 3150758902UL, 2022548260UL, 2462701924UL, 3793704672UL, 2358080321UL, 483288372UL, 450033142UL, 772942770UL, +2224873625UL, 241543410UL, 312552314UL, 1268067149UL, 915918620UL, 3906238422UL, 132545832UL, 3486041298UL, 2414090506UL, 3798383292UL, 2257004699UL, 130309284UL, 1158673651UL, 152325583UL, 3499865580UL, 4094273597UL, 1029041593UL, 93538481UL, 3963199522UL, 4215066819UL, 2851084137UL, 950351173UL, 2758084052UL, 3408506640UL, 2468905351UL, 3982226741UL, 3591899344UL, 2972879639UL, 3321078070UL, 252381865UL, 409397320UL, 741653003UL, +1936712854UL, 1198684021UL, 922916691UL, 10413506UL, 3546896248UL, 1704703870UL, 1479762464UL, 104399432UL, 4144557684UL, 68239720UL, 2666028745UL, 362625839UL, 2591539911UL, 2837165752UL, 2180226515UL, 4076543943UL, 2956460273UL, 312410753UL, 2566731139UL, 2532653524UL, 2399030172UL, 207904356UL, 354574195UL, 485696336UL, 3816686234UL, 3016971115UL, 4272692603UL, 2352732136UL, 33493163UL, 780255811UL, 4092242980UL, 4121521600UL, +2119254314UL, 42767673UL, 1081488778UL, 2757446871UL, 2267513620UL, 3472164720UL, 2750308207UL, 1707164045UL, 3125591821UL, 3236687597UL, 299194858UL, 537384087UL, 1695155491UL, 2078250102UL, 1705861659UL, 2416322096UL, 1692335914UL, 1178915980UL, 3405431297UL, 4059323309UL, 2014660182UL, 3847682866UL, 4037583683UL, 2629253995UL, 867809161UL, 2167953720UL, 2290558548UL, 417635396UL, 53496289UL, 1890906570UL, 2842247580UL, 807266805UL, +1226139132UL, 2067929784UL, 1697038549UL, 3312131466UL, 1234311530UL, 3199840935UL, 4185078776UL, 1807030355UL, 215385887UL, 845421530UL, 1350380353UL, 4209181096UL, 2576197887UL, 1275262872UL, 2806513944UL, 2718623701UL, 2779287384UL, 71403197UL, 219220133UL, 2181111477UL, 2000396844UL, 3595837555UL, 1232425455UL, 2630647391UL, 3280867676UL, 2622740782UL, 1578938469UL, 3624564545UL, 992324522UL, 3056113148UL, 3473635768UL, 3664935418UL, +1786902552UL, 3768542219UL, 2777948797UL, 3328832678UL, 3488502819UL, 2530862473UL, 2217907094UL, 2133505056UL, 2218961277UL, 2148551748UL, 4050672856UL, 1709182366UL, 1816409641UL, 3791695288UL, 4207813971UL, 4175126713UL, 2211317602UL, 616238454UL, 2394270012UL, 3212896041UL, 732700649UL, 2199328374UL, 3188624050UL, 811443809UL, 2818548979UL, 972036137UL, 2022548260UL, 2462701924UL, 3793704672UL, 2358080321UL, 1200725173UL, 450033142UL, +772942770UL, 2224873625UL, 241543410UL, 1907109304UL, 1268067149UL, 915918620UL, 3906238422UL, 132545832UL, 301668366UL, 2414090506UL, 3798383292UL, 2257004699UL, 130309284UL, 1228520287UL, 152325583UL, 3499865580UL, 4094273597UL, 1029041593UL, 3267460249UL, 3963199522UL, 4215066819UL, 2851084137UL, 950351173UL, 47361585UL, 3408506640UL, 2468905351UL, 3982226741UL, 3591899344UL, 1878226915UL, 3321078070UL, 252381865UL, 409397320UL, +741653003UL, 1716437506UL, 1198684021UL, 922916691UL, 10413506UL, 3546896248UL, 1591998796UL, 1479762464UL, 104399432UL, 4144557684UL, 68239720UL, 3810955599UL, 362625839UL, 2591539911UL, 2837165752UL, 2180226515UL, 3908378015UL, 2956460273UL, 312410753UL, 2566731139UL, 2532653524UL, 687490649UL, 207904356UL, 354574195UL, 485696336UL, 3816686234UL, 378445403UL, 4272692603UL, 2352732136UL, 33493163UL, 780255811UL, 1303281526UL, +4121521600UL, 2119254314UL, 42767673UL, 1081488778UL, 1734311274UL, 2267513620UL, 3472164720UL, 2750308207UL, 1707164045UL, 4212588163UL, 3236687597UL, 299194858UL, 537384087UL, 1695155491UL, 2250704950UL, 1705861659UL, 2416322096UL, 1692335914UL, 1178915980UL, 677982197UL, 4059323309UL, 2014660182UL, 3847682866UL, 4037583683UL, 1765435945UL, 867809161UL, 2167953720UL, 2290558548UL, 417635396UL, 2125103002UL, 1890906570UL, 2842247580UL, +807266805UL, 1226139132UL, 2056644398UL, 1697038549UL, 3312131466UL, 1234311530UL, 3199840935UL, 3063718636UL, 1807030355UL, 215385887UL, 845421530UL, 1350380353UL, 3610667273UL, 2576197887UL, 1275262872UL, 2806513944UL, 2718623701UL, 2492912955UL, 71403197UL, 219220133UL, 2181111477UL, 2000396844UL, 3465351710UL, 1232425455UL, 2630647391UL, 3280867676UL, 2622740782UL, 1331873639UL, 3624564545UL, 992324522UL, 3056113148UL, 3473635768UL, +782257020UL, 1786902552UL, 3768542219UL, 2777948797UL, 3328832678UL, 856888454UL, 2530862473UL, 2217907094UL, 2133505056UL, 2218961277UL, 3752437534UL, 4050672856UL, 1709182366UL, 1816409641UL, 3791695288UL, 1581813910UL, 4175126713UL, 2211317602UL, 616238454UL, 2394270012UL, 1796414157UL, 732700649UL, 2199328374UL, 3188624050UL, 811443809UL, 4225173324UL, 972036137UL, 2022548260UL, 2462701924UL, 3793704672UL, 1410793611UL, 1200725173UL, +450033142UL, 772942770UL, 2224873625UL, 3889840648UL, 1907109304UL, 1268067149UL, 915918620UL, 3906238422UL, 1249098244UL, 301668366UL, 2414090506UL, 3798383292UL, 2257004699UL, 1620796656UL, 1228520287UL, 152325583UL, 3499865580UL, 4094273597UL, 82853050UL, 3267460249UL, 3963199522UL, 4215066819UL, 2851084137UL, 1212493334UL, 47361585UL, 3408506640UL, 2468905351UL, 3982226741UL, 3195419905UL, 1878226915UL, 3321078070UL, 252381865UL, +409397320UL, 1584154733UL, 1716437506UL, 1198684021UL, 922916691UL, 10413506UL, 1734068880UL, 1591998796UL, 1479762464UL, 104399432UL, 4144557684UL, 1973878859UL, 3810955599UL, 362625839UL, 2591539911UL, 2837165752UL, 1727282404UL, 3908378015UL, 2956460273UL, 312410753UL, 2566731139UL, 3656295687UL, 687490649UL, 207904356UL, 354574195UL, 485696336UL, 355953909UL, 378445403UL, 4272692603UL, 2352732136UL, 33493163UL, 3784169684UL, +1303281526UL, 4121521600UL, 2119254314UL, 42767673UL, 2331527847UL, 1734311274UL, 2267513620UL, 3472164720UL, 2750308207UL, 820692528UL, 4212588163UL, 3236687597UL, 299194858UL, 537384087UL, 781151234UL, 2250704950UL, 1705861659UL, 2416322096UL, 1692335914UL, 4288008793UL, 677982197UL, 4059323309UL, 2014660182UL, 3847682866UL, 3328850880UL, 1765435945UL, 867809161UL, 2167953720UL, 2290558548UL, 542850707UL, 2125103002UL, 1890906570UL, +2842247580UL, 807266805UL, 3803006390UL, 2056644398UL, 1697038549UL, 3312131466UL, 1234311530UL, 809106036UL, 3063718636UL, 1807030355UL, 215385887UL, 845421530UL, 654189622UL, 3610667273UL, 2576197887UL, 1275262872UL, 2806513944UL, 1517875462UL, 2492912955UL, 71403197UL, 219220133UL, 2181111477UL, 3826277490UL, 3465351710UL, 1232425455UL, 2630647391UL, 3280867676UL, 3343597872UL, 1331873639UL, 3624564545UL, 992324522UL, 3056113148UL, +3725661598UL, 782257020UL, 1786902552UL, 3768542219UL, 2777948797UL, 3392298403UL, 856888454UL, 2530862473UL, 2217907094UL, 2133505056UL, 4160889036UL, 3752437534UL, 4050672856UL, 1709182366UL, 1816409641UL, 1282922706UL, 1581813910UL, 4175126713UL, 2211317602UL, 616238454UL, 3806252779UL, 1796414157UL, 732700649UL, 2199328374UL, 3188624050UL, 983474330UL, 4225173324UL, 972036137UL, 2022548260UL, 2462701924UL, 880446667UL, 1410793611UL, +1200725173UL, 450033142UL, 772942770UL, 3179870546UL, 3889840648UL, 1907109304UL, 1268067149UL, 915918620UL, 4261932110UL, 1249098244UL, 301668366UL, 2414090506UL, 3798383292UL, 471794009UL, 1620796656UL, 1228520287UL, 152325583UL, 3499865580UL, 1275109063UL, 82853050UL, 3267460249UL, 3963199522UL, 4215066819UL, 4209882674UL, 1212493334UL, 47361585UL, 3408506640UL, 2468905351UL, 1324785625UL, 3195419905UL, 1878226915UL, 3321078070UL, +252381865UL, 4259927884UL, 1584154733UL, 1716437506UL, 1198684021UL, 922916691UL, 1800164165UL, 1734068880UL, 1591998796UL, 1479762464UL, 104399432UL, 2774114308UL, 1973878859UL, 3810955599UL, 362625839UL, 2591539911UL, 2126614872UL, 1727282404UL, 3908378015UL, 2956460273UL, 312410753UL, 4098052715UL, 3656295687UL, 687490649UL, 207904356UL, 354574195UL, 937379582UL, 355953909UL, 378445403UL, 4272692603UL, 2352732136UL, 2694800574UL, +3784169684UL, 1303281526UL, 4121521600UL, 2119254314UL, 1741415022UL, 2331527847UL, 1734311274UL, 2267513620UL, 3472164720UL, 480821513UL, 820692528UL, 4212588163UL, 3236687597UL, 299194858UL, 1128762168UL, 781151234UL, 2250704950UL, 1705861659UL, 2416322096UL, 160918735UL, 4288008793UL, 677982197UL, 4059323309UL, 2014660182UL, 3354205317UL, 3328850880UL, 1765435945UL, 867809161UL, 2167953720UL, 3363861382UL, 542850707UL, 2125103002UL, +1890906570UL, 2842247580UL, 2459935488UL, 3803006390UL, 2056644398UL, 1697038549UL, 3312131466UL, 2378675900UL, 809106036UL, 3063718636UL, 1807030355UL, 215385887UL, 3528413525UL, 654189622UL, 3610667273UL, 2576197887UL, 1275262872UL, 993221887UL, 1517875462UL, 2492912955UL, 71403197UL, 219220133UL, 1805256638UL, 3826277490UL, 3465351710UL, 1232425455UL, 2630647391UL, 3718538519UL, 3343597872UL, 1331873639UL, 3624564545UL, 992324522UL, +3490576382UL, 2532191937UL, 1108692984UL, 802110050UL, 3984561242UL, 1973015939UL, 1351080551UL, 2382044123UL, 2393286227UL, 860228704UL, 179528099UL, 3569709850UL, 233527199UL, 3657599850UL, 3269634908UL, 3278075383UL, 4037814788UL, 952837871UL, 2050210570UL, 2376157484UL, 2566048929UL, 4200278597UL, 123440514UL, 573557299UL, 1585379806UL, 4012659271UL, 4000306490UL, 2508478465UL, 970078629UL, 4064973573UL, 645149301UL, 109544347UL, +647594029UL, 2097163688UL, 1515080116UL, 2142799649UL, 2519702653UL, 3122920796UL, 1952249156UL, 3932382760UL, 2155292687UL, 2517875978UL, 249059416UL, 4282787227UL, 2595461065UL, 1004349415UL, 2151451255UL, 2510715277UL, 3004500356UL, 3410567758UL, 344538405UL, 1946747709UL, 470298928UL, 1033671146UL, 4207801290UL, 1411375630UL, 3419808553UL, 3218285984UL, 3584735265UL, 811222695UL, 3898833227UL, 3535298390UL, 3764741581UL, 3927026520UL, +2850086968UL, 2818485449UL, 1963038474UL, 1871366998UL, 1900570117UL, 997663534UL, 746627295UL, 1827737271UL, 3814054979UL, 728285698UL, 1696496343UL, 1696888597UL, 1010837663UL, 1756050352UL, 785994134UL, 1436861536UL, 1949153732UL, 2360018842UL, 1703393654UL, 2248338006UL, 3884572674UL, 789998735UL, 1155994673UL, 2022469457UL, 223162974UL, 309571006UL, 725482797UL, 3909032036UL, 2531190541UL, 373676789UL, 1061107200UL, 4231921550UL, +558635876UL, 2773807977UL, 1860218585UL, 1150041015UL, 2252812038UL, 2413330952UL, 191909567UL, 3518171813UL, 3513416318UL, 2679253717UL, 3850755687UL, 1564154710UL, 324714884UL, 1600953447UL, 4095583159UL, 1796641692UL, 2518000547UL, 3621187982UL, 501166402UL, 2112782420UL, 1704276185UL, 2249859782UL, 3754293422UL, 1942321901UL, 1851019104UL, 240158224UL, 3181132144UL, 2281632719UL, 808029657UL, 1721710011UL, 2287207169UL, 3044484177UL, +2363339534UL, 805273402UL, 3696016147UL, 3549191229UL, 3353631259UL, 2946802391UL, 383414270UL, 300735554UL, 471515206UL, 1907815837UL, 1576327662UL, 3825043525UL, 2817119733UL, 1973847200UL, 1398317206UL, 2221853087UL, 501440864UL, 642467132UL, 494410179UL, 1191241925UL, 3549838846UL, 3621239619UL, 2640266286UL, 4140123024UL, 315957218UL, 3696758268UL, 2502777875UL, 2150738616UL, 1570099119UL, 2598276767UL, 3585886712UL, 230047417UL, +}, +{ +220882755UL, 630187688UL, 2600079656UL, 3103815531UL, 4259457395UL, 306940008UL, 760977254UL, 558299017UL, 73879495UL, 2342545344UL, 572800511UL, 3922797738UL, 3754011306UL, 698257357UL, 1274843132UL, 1455757442UL, 1014649591UL, 3205662508UL, 2997738251UL, 613949432UL, 2267018388UL, 2925762681UL, 3702061213UL, 299380602UL, 1711070497UL, 4140032336UL, 4134705925UL, 2836703879UL, 3776863395UL, 507121465UL, 3480792188UL, 1862887216UL, +247780795UL, 2528677869UL, 2881446422UL, 271754977UL, 833498724UL, 1489102731UL, 3636156177UL, 1839744487UL, 2011839858UL, 2353400914UL, 510437606UL, 561141583UL, 2979592314UL, 3844268262UL, 3011027242UL, 3113817193UL, 3491178377UL, 1448376742UL, 2478683391UL, 2597550150UL, 699310968UL, 1979488062UL, 277591964UL, 1312002175UL, 168047351UL, 1826859926UL, 2030631355UL, 3097860388UL, 1950614326UL, 4070838751UL, 4454933UL, 1890661188UL, +3929835227UL, 1008498572UL, 3301557438UL, 3906313590UL, 1240635175UL, 280935563UL, 113509402UL, 226900299UL, 1246395851UL, 1220916742UL, 2651515540UL, 2058590162UL, 1983114332UL, 2040467861UL, 780818345UL, 544262576UL, 2826997265UL, 349354812UL, 2360120613UL, 1181324247UL, 2380347783UL, 3938729706UL, 1610628643UL, 2008635822UL, 2937909233UL, 1583978206UL, 3589167073UL, 1942470196UL, 402177406UL, 2636510744UL, 3709747478UL, 2428569572UL, +4071828137UL, 2880315633UL, 1433558231UL, 1137076031UL, 3833202201UL, 2378168250UL, 1412413704UL, 3349323744UL, 1740721660UL, 3155643175UL, 2580327273UL, 3020661883UL, 1658910832UL, 2065649368UL, 3277572880UL, 3795585437UL, 1266185861UL, 2925935368UL, 4147230645UL, 203577834UL, 2230529041UL, 2864778434UL, 270386174UL, 2867122465UL, 2676624544UL, 2035972330UL, 500973884UL, 2983028740UL, 117131866UL, 1456450936UL, 429171245UL, 3921563262UL, +342800398UL, 255116920UL, 1219580025UL, 1549741331UL, 3832317567UL, 3750096895UL, 4036554472UL, 4099775516UL, 1451717480UL, 149159438UL, 3593827664UL, 1406572509UL, 27774796UL, 1138983585UL, 1577536190UL, 978350835UL, 2704344602UL, 95204061UL, 1507155668UL, 304760810UL, 1981315657UL, 3139306913UL, 3908131532UL, 3767856445UL, 3851422551UL, 2018732047UL, 2474676116UL, 2745551516UL, 1585868430UL, 1125303733UL, 3147584753UL, 2368921260UL, +1524991519UL, 220882755UL, 630187688UL, 2600079656UL, 3103815531UL, 2671841243UL, 306940008UL, 760977254UL, 558299017UL, 73879495UL, 1196617651UL, 572800511UL, 3922797738UL, 3754011306UL, 698257357UL, 1982654891UL, 1455757442UL, 1014649591UL, 3205662508UL, 2997738251UL, 3769735713UL, 2267018388UL, 2925762681UL, 3702061213UL, 299380602UL, 2224634157UL, 4140032336UL, 4134705925UL, 2836703879UL, 3776863395UL, 1027030708UL, 3480792188UL, +1862887216UL, 247780795UL, 2528677869UL, 300214141UL, 271754977UL, 833498724UL, 1489102731UL, 3636156177UL, 1683033001UL, 2011839858UL, 2353400914UL, 510437606UL, 561141583UL, 2832813585UL, 3844268262UL, 3011027242UL, 3113817193UL, 3491178377UL, 316500941UL, 2478683391UL, 2597550150UL, 699310968UL, 1979488062UL, 4092049617UL, 1312002175UL, 168047351UL, 1826859926UL, 2030631355UL, 2797906491UL, 1950614326UL, 4070838751UL, 4454933UL, +1890661188UL, 2602196847UL, 1008498572UL, 3301557438UL, 3906313590UL, 1240635175UL, 946440664UL, 113509402UL, 226900299UL, 1246395851UL, 1220916742UL, 1314772486UL, 2058590162UL, 1983114332UL, 2040467861UL, 780818345UL, 3064382079UL, 2826997265UL, 349354812UL, 2360120613UL, 1181324247UL, 3434653713UL, 3938729706UL, 1610628643UL, 2008635822UL, 2937909233UL, 2815835447UL, 3589167073UL, 1942470196UL, 402177406UL, 2636510744UL, 865459039UL, +2428569572UL, 4071828137UL, 2880315633UL, 1433558231UL, 1582478959UL, 3833202201UL, 2378168250UL, 1412413704UL, 3349323744UL, 3686787615UL, 3155643175UL, 2580327273UL, 3020661883UL, 1658910832UL, 3152644489UL, 3277572880UL, 3795585437UL, 1266185861UL, 2925935368UL, 3101079227UL, 203577834UL, 2230529041UL, 2864778434UL, 270386174UL, 3024925346UL, 2676624544UL, 2035972330UL, 500973884UL, 2983028740UL, 974511421UL, 1456450936UL, 429171245UL, +3921563262UL, 342800398UL, 1540218139UL, 1219580025UL, 1549741331UL, 3832317567UL, 3750096895UL, 2195381148UL, 4099775516UL, 1451717480UL, 149159438UL, 3593827664UL, 3715984838UL, 27774796UL, 1138983585UL, 1577536190UL, 978350835UL, 2060213898UL, 95204061UL, 1507155668UL, 304760810UL, 1981315657UL, 774471092UL, 3908131532UL, 3767856445UL, 3851422551UL, 2018732047UL, 1649125731UL, 2745551516UL, 1585868430UL, 1125303733UL, 3147584753UL, +1661721342UL, 1524991519UL, 220882755UL, 630187688UL, 2600079656UL, 3647143842UL, 2671841243UL, 306940008UL, 760977254UL, 558299017UL, 3406011854UL, 1196617651UL, 572800511UL, 3922797738UL, 3754011306UL, 2314291278UL, 1982654891UL, 1455757442UL, 1014649591UL, 3205662508UL, 3471741326UL, 3769735713UL, 2267018388UL, 2925762681UL, 3702061213UL, 1593850639UL, 2224634157UL, 4140032336UL, 4134705925UL, 2836703879UL, 3918266498UL, 1027030708UL, +3480792188UL, 1862887216UL, 247780795UL, 3383776045UL, 300214141UL, 271754977UL, 833498724UL, 1489102731UL, 2477093804UL, 1683033001UL, 2011839858UL, 2353400914UL, 510437606UL, 2361664959UL, 2832813585UL, 3844268262UL, 3011027242UL, 3113817193UL, 1468705704UL, 316500941UL, 2478683391UL, 2597550150UL, 699310968UL, 1593029686UL, 4092049617UL, 1312002175UL, 168047351UL, 1826859926UL, 3922295193UL, 2797906491UL, 1950614326UL, 4070838751UL, +4454933UL, 485374579UL, 2602196847UL, 1008498572UL, 3301557438UL, 3906313590UL, 2102043683UL, 946440664UL, 113509402UL, 226900299UL, 1246395851UL, 2635764090UL, 1314772486UL, 2058590162UL, 1983114332UL, 2040467861UL, 354791UL, 3064382079UL, 2826997265UL, 349354812UL, 2360120613UL, 2126504772UL, 3434653713UL, 3938729706UL, 1610628643UL, 2008635822UL, 2400061949UL, 2815835447UL, 3589167073UL, 1942470196UL, 402177406UL, 806469309UL, +865459039UL, 2428569572UL, 4071828137UL, 2880315633UL, 2512200928UL, 1582478959UL, 3833202201UL, 2378168250UL, 1412413704UL, 2767451252UL, 3686787615UL, 3155643175UL, 2580327273UL, 3020661883UL, 1040874588UL, 3152644489UL, 3277572880UL, 3795585437UL, 1266185861UL, 238446394UL, 3101079227UL, 203577834UL, 2230529041UL, 2864778434UL, 653319712UL, 3024925346UL, 2676624544UL, 2035972330UL, 500973884UL, 3839534784UL, 974511421UL, 1456450936UL, +429171245UL, 3921563262UL, 602320448UL, 1540218139UL, 1219580025UL, 1549741331UL, 3832317567UL, 1068872823UL, 2195381148UL, 4099775516UL, 1451717480UL, 149159438UL, 1699607068UL, 3715984838UL, 27774796UL, 1138983585UL, 1577536190UL, 837921790UL, 2060213898UL, 95204061UL, 1507155668UL, 304760810UL, 1446133066UL, 774471092UL, 3908131532UL, 3767856445UL, 3851422551UL, 2672625648UL, 1649125731UL, 2745551516UL, 1585868430UL, 1125303733UL, +2181520384UL, 1661721342UL, 1524991519UL, 220882755UL, 630187688UL, 1599074811UL, 3647143842UL, 2671841243UL, 306940008UL, 760977254UL, 3020017536UL, 3406011854UL, 1196617651UL, 572800511UL, 3922797738UL, 810584907UL, 2314291278UL, 1982654891UL, 1455757442UL, 1014649591UL, 1775783567UL, 3471741326UL, 3769735713UL, 2267018388UL, 2925762681UL, 319055602UL, 1593850639UL, 2224634157UL, 4140032336UL, 4134705925UL, 2794599326UL, 3918266498UL, +1027030708UL, 3480792188UL, 1862887216UL, 659607854UL, 3383776045UL, 300214141UL, 271754977UL, 833498724UL, 4054679386UL, 2477093804UL, 1683033001UL, 2011839858UL, 2353400914UL, 283191425UL, 2361664959UL, 2832813585UL, 3844268262UL, 3011027242UL, 137688840UL, 1468705704UL, 316500941UL, 2478683391UL, 2597550150UL, 1468220070UL, 1593029686UL, 4092049617UL, 1312002175UL, 168047351UL, 1602414610UL, 3922295193UL, 2797906491UL, 1950614326UL, +4070838751UL, 3858763082UL, 485374579UL, 2602196847UL, 1008498572UL, 3301557438UL, 2719858709UL, 2102043683UL, 946440664UL, 113509402UL, 226900299UL, 798285817UL, 2635764090UL, 1314772486UL, 2058590162UL, 1983114332UL, 2526463430UL, 354791UL, 3064382079UL, 2826997265UL, 349354812UL, 249430921UL, 2126504772UL, 3434653713UL, 3938729706UL, 1610628643UL, 967431506UL, 2400061949UL, 2815835447UL, 3589167073UL, 1942470196UL, 669129162UL, +806469309UL, 865459039UL, 2428569572UL, 4071828137UL, 3447449944UL, 2512200928UL, 1582478959UL, 3833202201UL, 2378168250UL, 1945768856UL, 2767451252UL, 3686787615UL, 3155643175UL, 2580327273UL, 2905624117UL, 1040874588UL, 3152644489UL, 3277572880UL, 3795585437UL, 3869959934UL, 238446394UL, 3101079227UL, 203577834UL, 2230529041UL, 1087760616UL, 653319712UL, 3024925346UL, 2676624544UL, 2035972330UL, 741014356UL, 3839534784UL, 974511421UL, +1456450936UL, 429171245UL, 598362053UL, 602320448UL, 1540218139UL, 1219580025UL, 1549741331UL, 401740328UL, 1068872823UL, 2195381148UL, 4099775516UL, 1451717480UL, 412110161UL, 1699607068UL, 3715984838UL, 27774796UL, 1138983585UL, 1531670562UL, 837921790UL, 2060213898UL, 95204061UL, 1507155668UL, 90279751UL, 1446133066UL, 774471092UL, 3908131532UL, 3767856445UL, 1136546910UL, 2672625648UL, 1649125731UL, 2745551516UL, 1585868430UL, +857721974UL, 1470900829UL, 64550776UL, 3252081369UL, 1649342279UL, 378546910UL, 3444980597UL, 3134750739UL, 1010105258UL, 1395608241UL, 1003208120UL, 3960524028UL, 3200241620UL, 3079969898UL, 1508044775UL, 4153769914UL, 2838198142UL, 773928818UL, 25836261UL, 3812652461UL, 3870603819UL, 931071963UL, 2565579710UL, 2930918109UL, 1091097445UL, 2223628368UL, 2934719684UL, 430797922UL, 2102409587UL, 720592077UL, 1675280068UL, 2578226918UL, +1316600845UL, 3427946098UL, 682896800UL, 1861125007UL, 251332674UL, 1502078012UL, 3020904394UL, 1458399451UL, 3088315263UL, 1635399147UL, 3605560130UL, 1755669804UL, 3754169290UL, 962708070UL, 3896576937UL, 3764679740UL, 2707457262UL, 3082551065UL, 1558451132UL, 1046028905UL, 3206335691UL, 731828142UL, 1765772975UL, 1195727587UL, 2664218451UL, 4234957963UL, 4073757168UL, 3230123616UL, 683981262UL, 607599877UL, 3659273671UL, 3230354324UL, +3393069074UL, 3250708814UL, 2229361194UL, 3923623619UL, 4093221649UL, 2441971643UL, 1787414237UL, 3603907850UL, 2254399656UL, 3508336126UL, 3578571587UL, 2383062806UL, 1012097006UL, 4250629546UL, 2086981615UL, 4190388250UL, 1399942361UL, 400707931UL, 3159618664UL, 2129750192UL, 911779896UL, 2736829998UL, 1909644954UL, 2168355517UL, 1583901478UL, 3468891177UL, 509297602UL, 769296769UL, 1865028750UL, 43276967UL, 3375387845UL, 2647467777UL, +1544731454UL, 3479333955UL, 4279441447UL, 485490313UL, 3523606596UL, 2880752852UL, 1946443431UL, 3760803481UL, 3115278477UL, 3693898557UL, 2387822435UL, 334412170UL, 2054111717UL, 269013084UL, 170401553UL, 3456013554UL, 3395842846UL, 508189059UL, 3398715186UL, 3862791669UL, 2741070272UL, 65318715UL, 1933435210UL, 4086198650UL, 3033193928UL, 1242412691UL, 3397363281UL, 3187419149UL, 1019508117UL, 562380742UL, 961415837UL, 2990412400UL, +3597720222UL, 2754100415UL, 1793508822UL, 966564784UL, 1875616532UL, 394646945UL, 1386107842UL, 2750810827UL, 2931007937UL, 3356489930UL, 2358364634UL, 3703772713UL, 3188884403UL, 2793590498UL, 3285138686UL, 515002680UL, 521510516UL, 887213583UL, 1873460781UL, 1583027667UL, 613895001UL, 557578628UL, 1892686243UL, 1974572772UL, 595831726UL, 229299738UL, 3847982294UL, 448248098UL, 1493822844UL, 3326405260UL, 2752463855UL, 128616819UL, +}, +{ +2014765631UL, 3938779303UL, 1811986049UL, 2101875601UL, 887194972UL, 3966228860UL, 3450775746UL, 4026039255UL, 4082308025UL, 432404123UL, 3181099213UL, 1228097256UL, 2368258457UL, 2953933351UL, 2582232464UL, 1657799516UL, 3525421629UL, 3927364159UL, 978138132UL, 3603597064UL, 342571522UL, 2100072168UL, 676229632UL, 2062864895UL, 3713317279UL, 4255773013UL, 1179492389UL, 3501226604UL, 1641801113UL, 2066614519UL, 3303232023UL, 1717768923UL, +2333501450UL, 4246883128UL, 1655087824UL, 1547897374UL, 754215285UL, 2832638094UL, 1365153701UL, 3309513970UL, 765738141UL, 1177808869UL, 324127419UL, 1171195868UL, 3494966448UL, 1714410667UL, 3645762436UL, 603810292UL, 489970006UL, 3126166124UL, 1616642501UL, 2646836239UL, 734727001UL, 118064420UL, 1164195304UL, 3692353914UL, 2267623847UL, 405457397UL, 2510437259UL, 3245015882UL, 2110859730UL, 967046702UL, 265790493UL, 3007163818UL, +3178475505UL, 1784447992UL, 3662964942UL, 1509963062UL, 1867864652UL, 1377871790UL, 4185567242UL, 657897796UL, 1762205546UL, 3895944199UL, 693988565UL, 2359023506UL, 1667660316UL, 478341078UL, 1898651054UL, 2352226314UL, 202416031UL, 855532642UL, 2290137962UL, 1573485803UL, 3675269487UL, 2346740592UL, 3111005795UL, 1741227661UL, 1222572879UL, 2176146608UL, 1595608675UL, 197451178UL, 1729118168UL, 876472937UL, 3201705210UL, 2315408645UL, +699968623UL, 2185639066UL, 3960900430UL, 539499973UL, 4226318752UL, 266371152UL, 2714506838UL, 945022093UL, 1378798863UL, 1925020181UL, 574417318UL, 1341455098UL, 3664225722UL, 3020780778UL, 3256613994UL, 2081255019UL, 3082744844UL, 3572803922UL, 1726854692UL, 1167777002UL, 557257486UL, 3577067012UL, 3806913480UL, 1578577194UL, 2631896730UL, 3937479909UL, 826138924UL, 670145071UL, 832017019UL, 715875283UL, 2008704579UL, 804955545UL, +4184114494UL, 867004874UL, 3586861289UL, 1190193155UL, 3288754776UL, 2271906590UL, 2007547109UL, 2206084232UL, 1621944575UL, 973990634UL, 3981493346UL, 1972746975UL, 1040348653UL, 2895228417UL, 691038334UL, 775610724UL, 3837025597UL, 714850057UL, 2912426839UL, 774555258UL, 3553866253UL, 2096154755UL, 1645117543UL, 3401470072UL, 2056183169UL, 2029528044UL, 3145728013UL, 1090530001UL, 49523828UL, 2228313334UL, 4013648604UL, 4289025873UL, +2749397923UL, 2014765631UL, 3938779303UL, 1811986049UL, 2101875601UL, 1575247143UL, 3966228860UL, 3450775746UL, 4026039255UL, 4082308025UL, 532118065UL, 3181099213UL, 1228097256UL, 2368258457UL, 2953933351UL, 896129082UL, 1657799516UL, 3525421629UL, 3927364159UL, 978138132UL, 3403930517UL, 342571522UL, 2100072168UL, 676229632UL, 2062864895UL, 38934050UL, 4255773013UL, 1179492389UL, 3501226604UL, 1641801113UL, 4195983797UL, 3303232023UL, +1717768923UL, 2333501450UL, 4246883128UL, 2854551758UL, 1547897374UL, 754215285UL, 2832638094UL, 1365153701UL, 1406220165UL, 765738141UL, 1177808869UL, 324127419UL, 1171195868UL, 625985592UL, 1714410667UL, 3645762436UL, 603810292UL, 489970006UL, 344948229UL, 1616642501UL, 2646836239UL, 734727001UL, 118064420UL, 3360380275UL, 3692353914UL, 2267623847UL, 405457397UL, 2510437259UL, 3697919521UL, 2110859730UL, 967046702UL, 265790493UL, +3007163818UL, 1395299303UL, 1784447992UL, 3662964942UL, 1509963062UL, 1867864652UL, 849544728UL, 4185567242UL, 657897796UL, 1762205546UL, 3895944199UL, 1219998053UL, 2359023506UL, 1667660316UL, 478341078UL, 1898651054UL, 943166064UL, 202416031UL, 855532642UL, 2290137962UL, 1573485803UL, 4238971908UL, 2346740592UL, 3111005795UL, 1741227661UL, 1222572879UL, 2670048596UL, 1595608675UL, 197451178UL, 1729118168UL, 876472937UL, 94688481UL, +2315408645UL, 699968623UL, 2185639066UL, 3960900430UL, 1224638706UL, 4226318752UL, 266371152UL, 2714506838UL, 945022093UL, 2683523818UL, 1925020181UL, 574417318UL, 1341455098UL, 3664225722UL, 1168593559UL, 3256613994UL, 2081255019UL, 3082744844UL, 3572803922UL, 2816021735UL, 1167777002UL, 557257486UL, 3577067012UL, 3806913480UL, 740433434UL, 2631896730UL, 3937479909UL, 826138924UL, 670145071UL, 4127240538UL, 715875283UL, 2008704579UL, +804955545UL, 4184114494UL, 1692532062UL, 3586861289UL, 1190193155UL, 3288754776UL, 2271906590UL, 922306057UL, 2206084232UL, 1621944575UL, 973990634UL, 3981493346UL, 3555073644UL, 1040348653UL, 2895228417UL, 691038334UL, 775610724UL, 1798939042UL, 714850057UL, 2912426839UL, 774555258UL, 3553866253UL, 4209859609UL, 1645117543UL, 3401470072UL, 2056183169UL, 2029528044UL, 2169159734UL, 1090530001UL, 49523828UL, 2228313334UL, 4013648604UL, +1499948031UL, 2749397923UL, 2014765631UL, 3938779303UL, 1811986049UL, 2169095159UL, 1575247143UL, 3966228860UL, 3450775746UL, 4026039255UL, 1220311069UL, 532118065UL, 3181099213UL, 1228097256UL, 2368258457UL, 649921441UL, 896129082UL, 1657799516UL, 3525421629UL, 3927364159UL, 2546335470UL, 3403930517UL, 342571522UL, 2100072168UL, 676229632UL, 3090148374UL, 38934050UL, 4255773013UL, 1179492389UL, 3501226604UL, 2613176152UL, 4195983797UL, +3303232023UL, 1717768923UL, 2333501450UL, 3923041739UL, 2854551758UL, 1547897374UL, 754215285UL, 2832638094UL, 731392091UL, 1406220165UL, 765738141UL, 1177808869UL, 324127419UL, 12876722UL, 625985592UL, 1714410667UL, 3645762436UL, 603810292UL, 2789313462UL, 344948229UL, 1616642501UL, 2646836239UL, 734727001UL, 3369486664UL, 3360380275UL, 3692353914UL, 2267623847UL, 405457397UL, 4284067044UL, 3697919521UL, 2110859730UL, 967046702UL, +265790493UL, 2779045063UL, 1395299303UL, 1784447992UL, 3662964942UL, 1509963062UL, 3233239196UL, 849544728UL, 4185567242UL, 657897796UL, 1762205546UL, 2086953994UL, 1219998053UL, 2359023506UL, 1667660316UL, 478341078UL, 4137166515UL, 943166064UL, 202416031UL, 855532642UL, 2290137962UL, 1053737970UL, 4238971908UL, 2346740592UL, 3111005795UL, 1741227661UL, 3570501235UL, 2670048596UL, 1595608675UL, 197451178UL, 1729118168UL, 4162077327UL, +94688481UL, 2315408645UL, 699968623UL, 2185639066UL, 2842562270UL, 1224638706UL, 4226318752UL, 266371152UL, 2714506838UL, 755620309UL, 2683523818UL, 1925020181UL, 574417318UL, 1341455098UL, 3323621213UL, 1168593559UL, 3256613994UL, 2081255019UL, 3082744844UL, 3845230416UL, 2816021735UL, 1167777002UL, 557257486UL, 3577067012UL, 66225918UL, 740433434UL, 2631896730UL, 3937479909UL, 826138924UL, 522548622UL, 4127240538UL, 715875283UL, +2008704579UL, 804955545UL, 22190845UL, 1692532062UL, 3586861289UL, 1190193155UL, 3288754776UL, 610751818UL, 922306057UL, 2206084232UL, 1621944575UL, 973990634UL, 1771882567UL, 3555073644UL, 1040348653UL, 2895228417UL, 691038334UL, 149995790UL, 1798939042UL, 714850057UL, 2912426839UL, 774555258UL, 2020442761UL, 4209859609UL, 1645117543UL, 3401470072UL, 2056183169UL, 460813741UL, 2169159734UL, 1090530001UL, 49523828UL, 2228313334UL, +504317288UL, 1499948031UL, 2749397923UL, 2014765631UL, 3938779303UL, 1175469033UL, 2169095159UL, 1575247143UL, 3966228860UL, 3450775746UL, 1032079910UL, 1220311069UL, 532118065UL, 3181099213UL, 1228097256UL, 3353583885UL, 649921441UL, 896129082UL, 1657799516UL, 3525421629UL, 2830418357UL, 2546335470UL, 3403930517UL, 342571522UL, 2100072168UL, 1099053459UL, 3090148374UL, 38934050UL, 4255773013UL, 1179492389UL, 1634035942UL, 2613176152UL, +4195983797UL, 3303232023UL, 1717768923UL, 4175785502UL, 3923041739UL, 2854551758UL, 1547897374UL, 754215285UL, 3674851127UL, 731392091UL, 1406220165UL, 765738141UL, 1177808869UL, 776475327UL, 12876722UL, 625985592UL, 1714410667UL, 3645762436UL, 759189800UL, 2789313462UL, 344948229UL, 1616642501UL, 2646836239UL, 1228911282UL, 3369486664UL, 3360380275UL, 3692353914UL, 2267623847UL, 3058856811UL, 4284067044UL, 3697919521UL, 2110859730UL, +967046702UL, 3601311392UL, 2779045063UL, 1395299303UL, 1784447992UL, 3662964942UL, 284169442UL, 3233239196UL, 849544728UL, 4185567242UL, 657897796UL, 905886381UL, 2086953994UL, 1219998053UL, 2359023506UL, 1667660316UL, 2784311626UL, 4137166515UL, 943166064UL, 202416031UL, 855532642UL, 895862877UL, 1053737970UL, 4238971908UL, 2346740592UL, 3111005795UL, 1509264114UL, 3570501235UL, 2670048596UL, 1595608675UL, 197451178UL, 3653040124UL, +4162077327UL, 94688481UL, 2315408645UL, 699968623UL, 1071988392UL, 2842562270UL, 1224638706UL, 4226318752UL, 266371152UL, 4214356293UL, 755620309UL, 2683523818UL, 1925020181UL, 574417318UL, 119162126UL, 3323621213UL, 1168593559UL, 3256613994UL, 2081255019UL, 1317924999UL, 3845230416UL, 2816021735UL, 1167777002UL, 557257486UL, 638058809UL, 66225918UL, 740433434UL, 2631896730UL, 3937479909UL, 411228024UL, 522548622UL, 4127240538UL, +715875283UL, 2008704579UL, 2246049355UL, 22190845UL, 1692532062UL, 3586861289UL, 1190193155UL, 4078828073UL, 610751818UL, 922306057UL, 2206084232UL, 1621944575UL, 907181435UL, 1771882567UL, 3555073644UL, 1040348653UL, 2895228417UL, 940846326UL, 149995790UL, 1798939042UL, 714850057UL, 2912426839UL, 3345560812UL, 2020442761UL, 4209859609UL, 1645117543UL, 3401470072UL, 2036328600UL, 460813741UL, 2169159734UL, 1090530001UL, 49523828UL, +510136795UL, 2233313725UL, 1046048857UL, 700202384UL, 926275751UL, 4104982908UL, 3910999868UL, 1125213128UL, 492681420UL, 3891914731UL, 956545470UL, 115696875UL, 2957144177UL, 77090391UL, 467732901UL, 2599813105UL, 3888976883UL, 2098926023UL, 2844817051UL, 2069408123UL, 2239429902UL, 3793992219UL, 3020240490UL, 1721698056UL, 3012473888UL, 1537226153UL, 725991171UL, 61376035UL, 381912667UL, 3904514327UL, 40015731UL, 4263210119UL, +2876064791UL, 2732785471UL, 2934318283UL, 3134934287UL, 3161129365UL, 3789733734UL, 2954419388UL, 2742205850UL, 3488450208UL, 3252908703UL, 410643191UL, 3246033194UL, 2846558783UL, 828879673UL, 2428687670UL, 389617242UL, 63987225UL, 439842832UL, 2635895570UL, 3468152776UL, 4086700701UL, 3370617315UL, 2400127386UL, 4266992260UL, 3026019128UL, 4225721108UL, 1328114488UL, 2808680961UL, 3574018824UL, 4060262451UL, 2329039960UL, 1165344648UL, +3635963149UL, 2414703792UL, 2269100254UL, 832995451UL, 2143875746UL, 1031309981UL, 2129333746UL, 2606784227UL, 805236091UL, 666141116UL, 2749351381UL, 53998350UL, 2270447972UL, 2092784991UL, 877961283UL, 3019419608UL, 2438459472UL, 2273921167UL, 332279281UL, 3759993687UL, 2465113760UL, 3732237006UL, 322823266UL, 491053374UL, 686619591UL, 4192648122UL, 4118497267UL, 1948902148UL, 988375775UL, 2098328675UL, 3107501958UL, 2979856583UL, +2274193457UL, 6179961UL, 188209161UL, 1491245003UL, 3005972885UL, 1658799053UL, 3420802262UL, 2128792168UL, 3272743598UL, 4163716849UL, 817350318UL, 3372322557UL, 1525295885UL, 490587460UL, 3634834949UL, 2584809384UL, 3638373352UL, 2603765126UL, 3223396315UL, 4021061386UL, 2143780551UL, 248332433UL, 3654752967UL, 27201989UL, 3994156272UL, 5505477UL, 4260955724UL, 1175998822UL, 2665646240UL, 866875674UL, 3569324422UL, 202962714UL, +896177244UL, 3146417201UL, 1168925859UL, 2228636445UL, 105395449UL, 2567482935UL, 1301265751UL, 3739617610UL, 2486939910UL, 1891847857UL, 2647840744UL, 1141826566UL, 3360553996UL, 4267671927UL, 2546157872UL, 1143297884UL, 2049385137UL, 4288036836UL, 3347190546UL, 3480408604UL, 2756408254UL, 2396048567UL, 1151717877UL, 2211243289UL, 4221659024UL, 21773193UL, 1665317870UL, 3116384869UL, 3231689469UL, 3689471824UL, 1520574310UL, 463615415UL, +}, +{ +2647200400UL, 1592194261UL, 1289872755UL, 2079982087UL, 3431487085UL, 1101851783UL, 3373292799UL, 2148994262UL, 2785319928UL, 3206527339UL, 2731839331UL, 1280366172UL, 1146205735UL, 2930495205UL, 2876978398UL, 3885758458UL, 2062812458UL, 2448488486UL, 192141900UL, 3861696664UL, 2677929258UL, 3606729729UL, 2920965773UL, 1156521508UL, 3168665640UL, 298794036UL, 957896625UL, 2606719899UL, 3699219026UL, 3120096333UL, 2531109351UL, 1920936462UL, +2848868175UL, 1406404729UL, 2956672675UL, 1376226240UL, 3667482110UL, 2551426756UL, 3433640449UL, 2603906744UL, 4217864690UL, 47671552UL, 2993859190UL, 1269153270UL, 3463588775UL, 1655126430UL, 3453916724UL, 2157890969UL, 252769449UL, 1583335064UL, 2560819344UL, 52639671UL, 39618615UL, 313192112UL, 2625914283UL, 2964928555UL, 4226359627UL, 4141969666UL, 183405146UL, 1455378225UL, 2994063945UL, 3146629795UL, 2992956289UL, 368634554UL, +4110058153UL, 1156556441UL, 3690317172UL, 906928962UL, 3773042217UL, 948650679UL, 4134172918UL, 2922802573UL, 1417921660UL, 291400676UL, 3120733115UL, 3225369425UL, 3200455006UL, 2207799613UL, 1766261260UL, 914727455UL, 1927023103UL, 572959294UL, 3447057855UL, 4042691162UL, 840021910UL, 4187195325UL, 3627831667UL, 1671506539UL, 242673485UL, 3330397756UL, 776552069UL, 684550924UL, 261597601UL, 1857936262UL, 1022869402UL, 4209077103UL, +14248159UL, 2366156245UL, 1910356465UL, 2020463550UL, 873419743UL, 4290775093UL, 3670978210UL, 1726974037UL, 784115717UL, 3574834402UL, 357805142UL, 3820795621UL, 1854247318UL, 1161642656UL, 3977404318UL, 2054677775UL, 1737374322UL, 2852015019UL, 4277252452UL, 1392810771UL, 3742661504UL, 1900815804UL, 1965911170UL, 3540183220UL, 2106191537UL, 3606954134UL, 2108636204UL, 2981827052UL, 2506861567UL, 184003599UL, 3319252632UL, 1370913077UL, +940955681UL, 2244100002UL, 3683661822UL, 3215832318UL, 3463899341UL, 134577035UL, 3404365179UL, 2262494389UL, 88039196UL, 114405083UL, 1071449574UL, 4008494055UL, 765981248UL, 758357266UL, 2564125377UL, 901977407UL, 955156196UL, 3900980822UL, 134031448UL, 2566915950UL, 3445833537UL, 3138903399UL, 2113076217UL, 713587277UL, 3396078039UL, 3987657193UL, 3004104774UL, 800324742UL, 652529813UL, 3999083342UL, 486108562UL, 2103591900UL, +104743736UL, 2647200400UL, 1592194261UL, 1289872755UL, 2079982087UL, 552781204UL, 1101851783UL, 3373292799UL, 2148994262UL, 2785319928UL, 1222851809UL, 2731839331UL, 1280366172UL, 1146205735UL, 2930495205UL, 942360591UL, 3885758458UL, 2062812458UL, 2448488486UL, 192141900UL, 1909229999UL, 2677929258UL, 3606729729UL, 2920965773UL, 1156521508UL, 2995805883UL, 298794036UL, 957896625UL, 2606719899UL, 3699219026UL, 2447513005UL, 2531109351UL, +1920936462UL, 2848868175UL, 1406404729UL, 2751142611UL, 1376226240UL, 3667482110UL, 2551426756UL, 3433640449UL, 3724189478UL, 4217864690UL, 47671552UL, 2993859190UL, 1269153270UL, 2144136371UL, 1655126430UL, 3453916724UL, 2157890969UL, 252769449UL, 2959496542UL, 2560819344UL, 52639671UL, 39618615UL, 313192112UL, 2367743540UL, 2964928555UL, 4226359627UL, 4141969666UL, 183405146UL, 2006751422UL, 2994063945UL, 3146629795UL, 2992956289UL, +368634554UL, 1529794973UL, 1156556441UL, 3690317172UL, 906928962UL, 3773042217UL, 2005599428UL, 4134172918UL, 2922802573UL, 1417921660UL, 291400676UL, 2664982078UL, 3225369425UL, 3200455006UL, 2207799613UL, 1766261260UL, 2623711877UL, 1927023103UL, 572959294UL, 3447057855UL, 4042691162UL, 3510199782UL, 4187195325UL, 3627831667UL, 1671506539UL, 242673485UL, 1978730938UL, 776552069UL, 684550924UL, 261597601UL, 1857936262UL, 3273582958UL, +4209077103UL, 14248159UL, 2366156245UL, 1910356465UL, 457933823UL, 873419743UL, 4290775093UL, 3670978210UL, 1726974037UL, 1414288023UL, 3574834402UL, 357805142UL, 3820795621UL, 1854247318UL, 2679386897UL, 3977404318UL, 2054677775UL, 1737374322UL, 2852015019UL, 2411291453UL, 1392810771UL, 3742661504UL, 1900815804UL, 1965911170UL, 3719529323UL, 2106191537UL, 3606954134UL, 2108636204UL, 2981827052UL, 3702357099UL, 184003599UL, 3319252632UL, +1370913077UL, 940955681UL, 4262675711UL, 3683661822UL, 3215832318UL, 3463899341UL, 134577035UL, 3494669542UL, 2262494389UL, 88039196UL, 114405083UL, 1071449574UL, 1060831201UL, 765981248UL, 758357266UL, 2564125377UL, 901977407UL, 3003279383UL, 3900980822UL, 134031448UL, 2566915950UL, 3445833537UL, 2846863035UL, 2113076217UL, 713587277UL, 3396078039UL, 3987657193UL, 2067196130UL, 800324742UL, 652529813UL, 3999083342UL, 486108562UL, +2321935002UL, 104743736UL, 2647200400UL, 1592194261UL, 1289872755UL, 466892855UL, 552781204UL, 1101851783UL, 3373292799UL, 2148994262UL, 3078568050UL, 1222851809UL, 2731839331UL, 1280366172UL, 1146205735UL, 1710937426UL, 942360591UL, 3885758458UL, 2062812458UL, 2448488486UL, 3418446265UL, 1909229999UL, 2677929258UL, 3606729729UL, 2920965773UL, 1103324742UL, 2995805883UL, 298794036UL, 957896625UL, 2606719899UL, 675602173UL, 2447513005UL, +2531109351UL, 1920936462UL, 2848868175UL, 1509959171UL, 2751142611UL, 1376226240UL, 3667482110UL, 2551426756UL, 2447143807UL, 3724189478UL, 4217864690UL, 47671552UL, 2993859190UL, 2821422976UL, 2144136371UL, 1655126430UL, 3453916724UL, 2157890969UL, 3665277070UL, 2959496542UL, 2560819344UL, 52639671UL, 39618615UL, 2817859210UL, 2367743540UL, 2964928555UL, 4226359627UL, 4141969666UL, 2856219617UL, 2006751422UL, 2994063945UL, 3146629795UL, +2992956289UL, 3176479073UL, 1529794973UL, 1156556441UL, 3690317172UL, 906928962UL, 97899274UL, 2005599428UL, 4134172918UL, 2922802573UL, 1417921660UL, 1492426675UL, 2664982078UL, 3225369425UL, 3200455006UL, 2207799613UL, 2275640124UL, 2623711877UL, 1927023103UL, 572959294UL, 3447057855UL, 1036984002UL, 3510199782UL, 4187195325UL, 3627831667UL, 1671506539UL, 1827895694UL, 1978730938UL, 776552069UL, 684550924UL, 261597601UL, 3493571621UL, +3273582958UL, 4209077103UL, 14248159UL, 2366156245UL, 211745521UL, 457933823UL, 873419743UL, 4290775093UL, 3670978210UL, 1909994881UL, 1414288023UL, 3574834402UL, 357805142UL, 3820795621UL, 1911700755UL, 2679386897UL, 3977404318UL, 2054677775UL, 1737374322UL, 213019511UL, 2411291453UL, 1392810771UL, 3742661504UL, 1900815804UL, 237536256UL, 3719529323UL, 2106191537UL, 3606954134UL, 2108636204UL, 665423205UL, 3702357099UL, 184003599UL, +3319252632UL, 1370913077UL, 3583034472UL, 4262675711UL, 3683661822UL, 3215832318UL, 3463899341UL, 4027471772UL, 3494669542UL, 2262494389UL, 88039196UL, 114405083UL, 3580272354UL, 1060831201UL, 765981248UL, 758357266UL, 2564125377UL, 2592170747UL, 3003279383UL, 3900980822UL, 134031448UL, 2566915950UL, 1722483656UL, 2846863035UL, 2113076217UL, 713587277UL, 3396078039UL, 244197359UL, 2067196130UL, 800324742UL, 652529813UL, 3999083342UL, +2310369213UL, 2321935002UL, 104743736UL, 2647200400UL, 1592194261UL, 1610483859UL, 466892855UL, 552781204UL, 1101851783UL, 3373292799UL, 2617595614UL, 3078568050UL, 1222851809UL, 2731839331UL, 1280366172UL, 808483717UL, 1710937426UL, 942360591UL, 3885758458UL, 2062812458UL, 3260452154UL, 3418446265UL, 1909229999UL, 2677929258UL, 3606729729UL, 341113837UL, 1103324742UL, 2995805883UL, 298794036UL, 957896625UL, 2309730124UL, 675602173UL, +2447513005UL, 2531109351UL, 1920936462UL, 2268824429UL, 1509959171UL, 2751142611UL, 1376226240UL, 3667482110UL, 2745634237UL, 2447143807UL, 3724189478UL, 4217864690UL, 47671552UL, 2787057737UL, 2821422976UL, 2144136371UL, 1655126430UL, 3453916724UL, 339095616UL, 3665277070UL, 2959496542UL, 2560819344UL, 52639671UL, 3200765881UL, 2817859210UL, 2367743540UL, 2964928555UL, 4226359627UL, 3206913703UL, 2856219617UL, 2006751422UL, 2994063945UL, +3146629795UL, 1042016834UL, 3176479073UL, 1529794973UL, 1156556441UL, 3690317172UL, 171871257UL, 97899274UL, 2005599428UL, 4134172918UL, 2922802573UL, 1501051393UL, 1492426675UL, 2664982078UL, 3225369425UL, 3200455006UL, 1356823782UL, 2275640124UL, 2623711877UL, 1927023103UL, 572959294UL, 319456586UL, 1036984002UL, 3510199782UL, 4187195325UL, 3627831667UL, 3026392291UL, 1827895694UL, 1978730938UL, 776552069UL, 684550924UL, 2862336749UL, +3493571621UL, 3273582958UL, 4209077103UL, 14248159UL, 1597498830UL, 211745521UL, 457933823UL, 873419743UL, 4290775093UL, 2990300609UL, 1909994881UL, 1414288023UL, 3574834402UL, 357805142UL, 1957211849UL, 1911700755UL, 2679386897UL, 3977404318UL, 2054677775UL, 1006075205UL, 213019511UL, 2411291453UL, 1392810771UL, 3742661504UL, 1443139437UL, 237536256UL, 3719529323UL, 2106191537UL, 3606954134UL, 2671394121UL, 665423205UL, 3702357099UL, +184003599UL, 3319252632UL, 1632983188UL, 3583034472UL, 4262675711UL, 3683661822UL, 3215832318UL, 4080585934UL, 4027471772UL, 3494669542UL, 2262494389UL, 88039196UL, 677218369UL, 3580272354UL, 1060831201UL, 765981248UL, 758357266UL, 1277026792UL, 2592170747UL, 3003279383UL, 3900980822UL, 134031448UL, 4189207981UL, 1722483656UL, 2846863035UL, 2113076217UL, 713587277UL, 2098603934UL, 244197359UL, 2067196130UL, 800324742UL, 652529813UL, +1307843279UL, 3205610699UL, 1606722715UL, 2749781905UL, 3500078806UL, 320007706UL, 4092615096UL, 608085660UL, 1869480444UL, 459160631UL, 3657609957UL, 1944540526UL, 2184854884UL, 3497113751UL, 2817682182UL, 3367276652UL, 2069300794UL, 1466691974UL, 3078806052UL, 3998756116UL, 2068892089UL, 1789981386UL, 4196184114UL, 4004623319UL, 3029515569UL, 3206332209UL, 3424306963UL, 1805804276UL, 899469644UL, 1149853995UL, 903917909UL, 1185042552UL, +447265042UL, 3579272434UL, 116409560UL, 2211704275UL, 1237721838UL, 3636618157UL, 3191931082UL, 2430339315UL, 3551966793UL, 1533877057UL, 1700891210UL, 3317627852UL, 828148584UL, 1733460943UL, 3866870689UL, 3970886915UL, 1624935507UL, 3236099078UL, 4209593953UL, 1951283095UL, 1579020365UL, 1165668813UL, 1423097998UL, 1294879824UL, 3406063424UL, 3313007028UL, 2090501113UL, 842064167UL, 729587893UL, 2949702260UL, 2099637920UL, 260436310UL, +1056109549UL, 657874983UL, 2734575906UL, 4088958435UL, 3265216971UL, 1081848592UL, 2593212854UL, 4028921684UL, 2868974814UL, 2299228627UL, 49944924UL, 955114665UL, 2844328062UL, 885136505UL, 4262681333UL, 977883895UL, 998890598UL, 2026602293UL, 87852872UL, 2197997810UL, 910583259UL, 3151223623UL, 3960726944UL, 1778982325UL, 3322631234UL, 2940402694UL, 1619768059UL, 1592832128UL, 1434542537UL, 2107314297UL, 1170789408UL, 3357335254UL, +3317662644UL, 1409884338UL, 73741139UL, 1093507243UL, 329113525UL, 4199840577UL, 442295615UL, 3348669654UL, 435948047UL, 1154137005UL, 3151357655UL, 2101029905UL, 2430218233UL, 2474305449UL, 2316834456UL, 1736616135UL, 1575712778UL, 370866908UL, 4256943043UL, 2805503887UL, 1099763491UL, 2473785999UL, 3215573143UL, 472701386UL, 3070116154UL, 3969279119UL, 3331310102UL, 3932945670UL, 1502564397UL, 1294139579UL, 3073834823UL, 3115143551UL, +3602082994UL, 3707103500UL, 2570195094UL, 1268510174UL, 3561337287UL, 112422529UL, 1483304061UL, 3712148969UL, 3729628891UL, 2741131557UL, 4035019342UL, 2395091348UL, 208448216UL, 607199897UL, 4049058939UL, 3463267226UL, 3821711834UL, 1697628853UL, 691151709UL, 3014869414UL, 11610545UL, 3895793639UL, 3019679196UL, 1246664817UL, 753245113UL, 2236232962UL, 4172861179UL, 4030183420UL, 2367787106UL, 2209331085UL, 4170801007UL, 3609895913UL, +}, +{ +930278208UL, 223382535UL, 720499309UL, 2613473585UL, 4173439516UL, 2132019243UL, 468054579UL, 1141433627UL, 1328639101UL, 3222455434UL, 4023859457UL, 892124224UL, 2940688706UL, 2894552260UL, 1595432126UL, 2558709596UL, 2057191226UL, 1116728192UL, 3767370344UL, 1457278707UL, 3171850455UL, 3733161247UL, 149922078UL, 3860652874UL, 743952057UL, 1024625539UL, 3982786483UL, 2077838781UL, 3713742913UL, 2790452624UL, 3014482913UL, 2928857967UL, +476371337UL, 611803300UL, 3000092437UL, 57069608UL, 1554852195UL, 1406780525UL, 2288998898UL, 460131340UL, 3945168588UL, 18495216UL, 547882902UL, 1624966119UL, 2229423551UL, 1492565146UL, 706052879UL, 2733955743UL, 1450476708UL, 2565285196UL, 2491601298UL, 850297175UL, 331472128UL, 3275065709UL, 3154247398UL, 1364512871UL, 1193063601UL, 579449294UL, 4097747196UL, 3572372000UL, 2712499116UL, 1172861307UL, 3964137156UL, 1300564854UL, +1057993198UL, 2785733262UL, 3548277076UL, 2572944411UL, 3299232577UL, 2031854568UL, 2468534978UL, 602097973UL, 2068619195UL, 2639336890UL, 1694467033UL, 1581263823UL, 809076686UL, 2892861850UL, 4042078087UL, 3178152001UL, 706023882UL, 3236709493UL, 3603158102UL, 2575690800UL, 2831218686UL, 2492604085UL, 207296828UL, 1561595438UL, 2961967115UL, 3304283504UL, 835276604UL, 3005485731UL, 58946395UL, 3979071161UL, 1560535337UL, 2679058432UL, +1061627241UL, 1142692919UL, 1476802977UL, 1306619165UL, 1297953898UL, 4282928317UL, 3630719944UL, 2305895643UL, 2656730970UL, 916308118UL, 4160016206UL, 3541795573UL, 4222235077UL, 1289754532UL, 1963633184UL, 3595798857UL, 2273299603UL, 1687478595UL, 2249344966UL, 2267127964UL, 2201115693UL, 917609614UL, 3731921025UL, 1634893875UL, 3039440017UL, 1122674005UL, 2906728840UL, 921166852UL, 3525309936UL, 633872502UL, 821930665UL, 3861074060UL, +3309559821UL, 304858441UL, 1530517912UL, 1140212033UL, 3168869568UL, 3223449972UL, 1343718360UL, 2831361172UL, 1723616626UL, 3675867172UL, 2586694335UL, 2374941766UL, 387033391UL, 1528180036UL, 1561421035UL, 2735360720UL, 3952587140UL, 13543969UL, 3987997725UL, 4273177532UL, 2200558169UL, 461920718UL, 459441276UL, 4225054447UL, 2248193798UL, 1103878063UL, 3027778665UL, 1844457031UL, 1364117386UL, 1575430424UL, 2276483962UL, 2665252582UL, +1572038262UL, 930278208UL, 223382535UL, 720499309UL, 2613473585UL, 4025056228UL, 2132019243UL, 468054579UL, 1141433627UL, 1328639101UL, 304940359UL, 4023859457UL, 892124224UL, 2940688706UL, 2894552260UL, 2006939659UL, 2558709596UL, 2057191226UL, 1116728192UL, 3767370344UL, 3026555841UL, 3171850455UL, 3733161247UL, 149922078UL, 3860652874UL, 2068299929UL, 1024625539UL, 3982786483UL, 2077838781UL, 3713742913UL, 2512419366UL, 3014482913UL, +2928857967UL, 476371337UL, 611803300UL, 259065762UL, 57069608UL, 1554852195UL, 1406780525UL, 2288998898UL, 2261401631UL, 3945168588UL, 18495216UL, 547882902UL, 1624966119UL, 3049748661UL, 1492565146UL, 706052879UL, 2733955743UL, 1450476708UL, 910808481UL, 2491601298UL, 850297175UL, 331472128UL, 3275065709UL, 3877736250UL, 1364512871UL, 1193063601UL, 579449294UL, 4097747196UL, 3029512053UL, 2712499116UL, 1172861307UL, 3964137156UL, +1300564854UL, 2398462790UL, 2785733262UL, 3548277076UL, 2572944411UL, 3299232577UL, 3497485227UL, 2468534978UL, 602097973UL, 2068619195UL, 2639336890UL, 4271191874UL, 1581263823UL, 809076686UL, 2892861850UL, 4042078087UL, 3046259144UL, 706023882UL, 3236709493UL, 3603158102UL, 2575690800UL, 591682100UL, 2492604085UL, 207296828UL, 1561595438UL, 2961967115UL, 3885379584UL, 835276604UL, 3005485731UL, 58946395UL, 3979071161UL, 2784795951UL, +2679058432UL, 1061627241UL, 1142692919UL, 1476802977UL, 2864266022UL, 1297953898UL, 4282928317UL, 3630719944UL, 2305895643UL, 3374260620UL, 916308118UL, 4160016206UL, 3541795573UL, 4222235077UL, 3025355241UL, 1963633184UL, 3595798857UL, 2273299603UL, 1687478595UL, 4115795122UL, 2267127964UL, 2201115693UL, 917609614UL, 3731921025UL, 2905712346UL, 3039440017UL, 1122674005UL, 2906728840UL, 921166852UL, 2881663141UL, 633872502UL, 821930665UL, +3861074060UL, 3309559821UL, 2816533968UL, 1530517912UL, 1140212033UL, 3168869568UL, 3223449972UL, 1894667948UL, 2831361172UL, 1723616626UL, 3675867172UL, 2586694335UL, 3974041178UL, 387033391UL, 1528180036UL, 1561421035UL, 2735360720UL, 2014321457UL, 13543969UL, 3987997725UL, 4273177532UL, 2200558169UL, 2259553303UL, 459441276UL, 4225054447UL, 2248193798UL, 1103878063UL, 3889361594UL, 1844457031UL, 1364117386UL, 1575430424UL, 2276483962UL, +3302182736UL, 1572038262UL, 930278208UL, 223382535UL, 720499309UL, 4173186621UL, 4025056228UL, 2132019243UL, 468054579UL, 1141433627UL, 2396654717UL, 304940359UL, 4023859457UL, 892124224UL, 2940688706UL, 2903529759UL, 2006939659UL, 2558709596UL, 2057191226UL, 1116728192UL, 715931354UL, 3026555841UL, 3171850455UL, 3733161247UL, 149922078UL, 3342675578UL, 2068299929UL, 1024625539UL, 3982786483UL, 2077838781UL, 1157097180UL, 2512419366UL, +3014482913UL, 2928857967UL, 476371337UL, 2192872017UL, 259065762UL, 57069608UL, 1554852195UL, 1406780525UL, 4165039782UL, 2261401631UL, 3945168588UL, 18495216UL, 547882902UL, 2453072030UL, 3049748661UL, 1492565146UL, 706052879UL, 2733955743UL, 2233423433UL, 910808481UL, 2491601298UL, 850297175UL, 331472128UL, 1154483111UL, 3877736250UL, 1364512871UL, 1193063601UL, 579449294UL, 690173400UL, 3029512053UL, 2712499116UL, 1172861307UL, +3964137156UL, 2683130322UL, 2398462790UL, 2785733262UL, 3548277076UL, 2572944411UL, 4075824857UL, 3497485227UL, 2468534978UL, 602097973UL, 2068619195UL, 2711665545UL, 4271191874UL, 1581263823UL, 809076686UL, 2892861850UL, 3558962856UL, 3046259144UL, 706023882UL, 3236709493UL, 3603158102UL, 274706518UL, 591682100UL, 2492604085UL, 207296828UL, 1561595438UL, 1532885415UL, 3885379584UL, 835276604UL, 3005485731UL, 58946395UL, 4143205928UL, +2784795951UL, 2679058432UL, 1061627241UL, 1142692919UL, 2539503297UL, 2864266022UL, 1297953898UL, 4282928317UL, 3630719944UL, 3333189589UL, 3374260620UL, 916308118UL, 4160016206UL, 3541795573UL, 1771535488UL, 3025355241UL, 1963633184UL, 3595798857UL, 2273299603UL, 1735171204UL, 4115795122UL, 2267127964UL, 2201115693UL, 917609614UL, 4220503034UL, 2905712346UL, 3039440017UL, 1122674005UL, 2906728840UL, 868453017UL, 2881663141UL, 633872502UL, +821930665UL, 3861074060UL, 1928586970UL, 2816533968UL, 1530517912UL, 1140212033UL, 3168869568UL, 1082127627UL, 1894667948UL, 2831361172UL, 1723616626UL, 3675867172UL, 496773835UL, 3974041178UL, 387033391UL, 1528180036UL, 1561421035UL, 2763161987UL, 2014321457UL, 13543969UL, 3987997725UL, 4273177532UL, 2110570579UL, 2259553303UL, 459441276UL, 4225054447UL, 2248193798UL, 53021618UL, 3889361594UL, 1844457031UL, 1364117386UL, 1575430424UL, +1105247032UL, 3302182736UL, 1572038262UL, 930278208UL, 223382535UL, 2159964170UL, 4173186621UL, 4025056228UL, 2132019243UL, 468054579UL, 1397544344UL, 2396654717UL, 304940359UL, 4023859457UL, 892124224UL, 2800429255UL, 2903529759UL, 2006939659UL, 2558709596UL, 2057191226UL, 296054924UL, 715931354UL, 3026555841UL, 3171850455UL, 3733161247UL, 863280930UL, 3342675578UL, 2068299929UL, 1024625539UL, 3982786483UL, 949122664UL, 1157097180UL, +2512419366UL, 3014482913UL, 2928857967UL, 2585465463UL, 2192872017UL, 259065762UL, 57069608UL, 1554852195UL, 3650462338UL, 4165039782UL, 2261401631UL, 3945168588UL, 18495216UL, 524715648UL, 2453072030UL, 3049748661UL, 1492565146UL, 706052879UL, 123143857UL, 2233423433UL, 910808481UL, 2491601298UL, 850297175UL, 3272095697UL, 1154483111UL, 3877736250UL, 1364512871UL, 1193063601UL, 2394240337UL, 690173400UL, 3029512053UL, 2712499116UL, +1172861307UL, 598335483UL, 2683130322UL, 2398462790UL, 2785733262UL, 3548277076UL, 678275336UL, 4075824857UL, 3497485227UL, 2468534978UL, 602097973UL, 1861912463UL, 2711665545UL, 4271191874UL, 1581263823UL, 809076686UL, 3324887617UL, 3558962856UL, 3046259144UL, 706023882UL, 3236709493UL, 1776103512UL, 274706518UL, 591682100UL, 2492604085UL, 207296828UL, 1739697610UL, 1532885415UL, 3885379584UL, 835276604UL, 3005485731UL, 2931144546UL, +4143205928UL, 2784795951UL, 2679058432UL, 1061627241UL, 1487949699UL, 2539503297UL, 2864266022UL, 1297953898UL, 4282928317UL, 4101955339UL, 3333189589UL, 3374260620UL, 916308118UL, 4160016206UL, 376029432UL, 1771535488UL, 3025355241UL, 1963633184UL, 3595798857UL, 2826786027UL, 1735171204UL, 4115795122UL, 2267127964UL, 2201115693UL, 2572535497UL, 4220503034UL, 2905712346UL, 3039440017UL, 1122674005UL, 2482828099UL, 868453017UL, 2881663141UL, +633872502UL, 821930665UL, 2579406681UL, 1928586970UL, 2816533968UL, 1530517912UL, 1140212033UL, 2547368381UL, 1082127627UL, 1894667948UL, 2831361172UL, 1723616626UL, 1903980411UL, 496773835UL, 3974041178UL, 387033391UL, 1528180036UL, 2681142643UL, 2763161987UL, 2014321457UL, 13543969UL, 3987997725UL, 2583502227UL, 2110570579UL, 2259553303UL, 459441276UL, 4225054447UL, 177868402UL, 53021618UL, 3889361594UL, 1844457031UL, 1364117386UL, +2369166739UL, 240269378UL, 689700242UL, 297384154UL, 1052178701UL, 2154172820UL, 614713903UL, 3000863907UL, 3916962502UL, 94341217UL, 2609111975UL, 1621831476UL, 4260159710UL, 694869580UL, 1708268072UL, 2751452128UL, 3843916827UL, 3400387883UL, 2394104046UL, 2348934617UL, 3263438569UL, 3818556032UL, 1695621950UL, 410888855UL, 347231182UL, 612084657UL, 1858306225UL, 3024940417UL, 2482215564UL, 2728249904UL, 2825132299UL, 329106327UL, +3333110741UL, 2742025573UL, 2947035922UL, 3758718780UL, 2191527983UL, 864130510UL, 2586839659UL, 662702978UL, 817620197UL, 2888275812UL, 3372817000UL, 2982240654UL, 2211025418UL, 2043458594UL, 498221898UL, 1559803796UL, 209509183UL, 3004637012UL, 2204871924UL, 2445352606UL, 4026842262UL, 3211433366UL, 3533095828UL, 4172447076UL, 865408944UL, 2797639687UL, 3201749441UL, 1286664278UL, 1158271235UL, 2641361834UL, 4261559289UL, 3643706696UL, +2017210420UL, 2067296744UL, 3548126272UL, 3846378526UL, 3885857009UL, 3013926193UL, 368948443UL, 3839554625UL, 2032663713UL, 4185819024UL, 4279332940UL, 137321733UL, 3515190288UL, 4281845500UL, 2738024944UL, 3350239126UL, 1456676856UL, 1246688651UL, 2478709188UL, 12570320UL, 989306366UL, 2347610707UL, 2849134988UL, 2351681449UL, 4063448910UL, 1193872626UL, 3645565330UL, 1863134777UL, 1345198234UL, 2504863006UL, 3815974850UL, 3075495578UL, +2400383333UL, 2727346254UL, 985812393UL, 1432182882UL, 3668977714UL, 231840487UL, 647229148UL, 274547428UL, 2856186783UL, 1273158535UL, 900081267UL, 1566366419UL, 562584841UL, 2247144789UL, 3522587233UL, 1686032132UL, 586483076UL, 1207387616UL, 3040778905UL, 2532774045UL, 3681992451UL, 1034866888UL, 4029685195UL, 3307070989UL, 2412903766UL, 3156200186UL, 2625083166UL, 4148004113UL, 1756566287UL, 2319065855UL, 2924909429UL, 3050022486UL, +2464491722UL, 1137782196UL, 2749457821UL, 790410752UL, 3511746957UL, 2277733721UL, 2871407058UL, 3858561909UL, 2176119631UL, 952943025UL, 2987154266UL, 120799539UL, 2862346597UL, 3689389598UL, 3329995989UL, 715438735UL, 1035277216UL, 3079684809UL, 677298106UL, 2364292665UL, 4110165256UL, 4096954153UL, 356732100UL, 2361282903UL, 4050817284UL, 2010946835UL, 1824397679UL, 4087204231UL, 4178036725UL, 4197370951UL, 503070461UL, 1879838906UL, +}, +{ +4117851084UL, 2941903397UL, 1156439261UL, 1922510465UL, 2925632294UL, 2272105738UL, 641404242UL, 3414739418UL, 2602896978UL, 672876430UL, 1998875331UL, 1325970749UL, 1633717408UL, 3567722815UL, 2088144733UL, 95705225UL, 580635702UL, 3543633503UL, 1469889369UL, 239816045UL, 2254984383UL, 1632695776UL, 2033839470UL, 4117902893UL, 509938588UL, 1291002316UL, 3600816069UL, 2962644092UL, 4269959520UL, 3161890066UL, 1908855486UL, 1177948589UL, +473118979UL, 3205649854UL, 2027137481UL, 227656706UL, 1485922673UL, 3380103860UL, 2080286336UL, 2588604114UL, 1727893393UL, 3602757903UL, 3126385963UL, 2101893784UL, 3058515017UL, 833779022UL, 719369683UL, 3768029740UL, 1123855192UL, 2580550821UL, 3694463505UL, 1137588651UL, 1724433728UL, 3847324234UL, 2368689516UL, 1226895255UL, 1126753016UL, 2557024841UL, 3187601018UL, 3790080711UL, 2423256074UL, 2463913828UL, 1753321774UL, 1621519784UL, +3456900204UL, 3550875802UL, 3783120790UL, 2740104077UL, 2010858632UL, 1569277627UL, 1492853575UL, 2182681191UL, 3866043645UL, 2566155095UL, 770150438UL, 2482504045UL, 3916834400UL, 222960658UL, 342285296UL, 3354506276UL, 1371039946UL, 3717269950UL, 3632913684UL, 2557531969UL, 3934379214UL, 1732115898UL, 1598596195UL, 1180866173UL, 3526785234UL, 2740387380UL, 3540138766UL, 338607286UL, 3262593182UL, 2413619772UL, 2248013920UL, 3557851982UL, +2470276596UL, 1549877186UL, 447909575UL, 4010548064UL, 282941857UL, 3418249797UL, 3300699992UL, 1957423733UL, 2615274674UL, 370155667UL, 1109991145UL, 933065597UL, 3947818943UL, 3221736239UL, 402503017UL, 4016454981UL, 3640556350UL, 243947268UL, 1175418215UL, 2752078014UL, 371928981UL, 3354635500UL, 3471578165UL, 2735623932UL, 445067764UL, 2732367763UL, 3225606514UL, 1214718589UL, 2197756425UL, 2134958042UL, 680726116UL, 3098695319UL, +2103463364UL, 4058022972UL, 2428195541UL, 2433504485UL, 4042288512UL, 2383438250UL, 3821638336UL, 2375226348UL, 806148488UL, 197247918UL, 768984129UL, 412771011UL, 4020619856UL, 3030619444UL, 3242554868UL, 282156707UL, 3718880754UL, 2938924979UL, 4189583150UL, 1604586306UL, 1245779881UL, 4006389745UL, 2437150739UL, 1749517801UL, 2903749036UL, 1247308303UL, 2580023735UL, 2457849017UL, 342934950UL, 216040419UL, 3176519601UL, 4151509434UL, +2404801649UL, 4117851084UL, 2941903397UL, 1156439261UL, 1922510465UL, 14864453UL, 2272105738UL, 641404242UL, 3414739418UL, 2602896978UL, 2179417586UL, 1998875331UL, 1325970749UL, 1633717408UL, 3567722815UL, 428880410UL, 95705225UL, 580635702UL, 3543633503UL, 1469889369UL, 3132946201UL, 2254984383UL, 1632695776UL, 2033839470UL, 4117902893UL, 3029657560UL, 1291002316UL, 3600816069UL, 2962644092UL, 4269959520UL, 397442545UL, 1908855486UL, +1177948589UL, 473118979UL, 3205649854UL, 990384909UL, 227656706UL, 1485922673UL, 3380103860UL, 2080286336UL, 3295033100UL, 1727893393UL, 3602757903UL, 3126385963UL, 2101893784UL, 1132286601UL, 833779022UL, 719369683UL, 3768029740UL, 1123855192UL, 283414013UL, 3694463505UL, 1137588651UL, 1724433728UL, 3847324234UL, 1735742473UL, 1226895255UL, 1126753016UL, 2557024841UL, 3187601018UL, 2090644528UL, 2423256074UL, 2463913828UL, 1753321774UL, +1621519784UL, 1037552449UL, 3550875802UL, 3783120790UL, 2740104077UL, 2010858632UL, 3730461081UL, 1492853575UL, 2182681191UL, 3866043645UL, 2566155095UL, 2782805925UL, 2482504045UL, 3916834400UL, 222960658UL, 342285296UL, 2406892654UL, 1371039946UL, 3717269950UL, 3632913684UL, 2557531969UL, 4071148456UL, 1732115898UL, 1598596195UL, 1180866173UL, 3526785234UL, 1110366522UL, 3540138766UL, 338607286UL, 3262593182UL, 2413619772UL, 995824548UL, +3557851982UL, 2470276596UL, 1549877186UL, 447909575UL, 2962194596UL, 282941857UL, 3418249797UL, 3300699992UL, 1957423733UL, 1859612288UL, 370155667UL, 1109991145UL, 933065597UL, 3947818943UL, 3005912276UL, 402503017UL, 4016454981UL, 3640556350UL, 243947268UL, 2884057401UL, 2752078014UL, 371928981UL, 3354635500UL, 3471578165UL, 908942821UL, 445067764UL, 2732367763UL, 3225606514UL, 1214718589UL, 4104754911UL, 2134958042UL, 680726116UL, +3098695319UL, 2103463364UL, 2946640978UL, 2428195541UL, 2433504485UL, 4042288512UL, 2383438250UL, 1252490765UL, 2375226348UL, 806148488UL, 197247918UL, 768984129UL, 2578888115UL, 4020619856UL, 3030619444UL, 3242554868UL, 282156707UL, 3433259466UL, 2938924979UL, 4189583150UL, 1604586306UL, 1245779881UL, 616758943UL, 2437150739UL, 1749517801UL, 2903749036UL, 1247308303UL, 2722580830UL, 2457849017UL, 342934950UL, 216040419UL, 3176519601UL, +545097903UL, 2404801649UL, 4117851084UL, 2941903397UL, 1156439261UL, 1253296096UL, 14864453UL, 2272105738UL, 641404242UL, 3414739418UL, 2989955985UL, 2179417586UL, 1998875331UL, 1325970749UL, 1633717408UL, 1896726594UL, 428880410UL, 95705225UL, 580635702UL, 3543633503UL, 3294258049UL, 3132946201UL, 2254984383UL, 1632695776UL, 2033839470UL, 829668922UL, 3029657560UL, 1291002316UL, 3600816069UL, 2962644092UL, 715635401UL, 397442545UL, +1908855486UL, 1177948589UL, 473118979UL, 443010703UL, 990384909UL, 227656706UL, 1485922673UL, 3380103860UL, 727464961UL, 3295033100UL, 1727893393UL, 3602757903UL, 3126385963UL, 3020775130UL, 1132286601UL, 833779022UL, 719369683UL, 3768029740UL, 2215591597UL, 283414013UL, 3694463505UL, 1137588651UL, 1724433728UL, 2124955521UL, 1735742473UL, 1226895255UL, 1126753016UL, 2557024841UL, 1719121879UL, 2090644528UL, 2423256074UL, 2463913828UL, +1753321774UL, 1283364713UL, 1037552449UL, 3550875802UL, 3783120790UL, 2740104077UL, 3326764615UL, 3730461081UL, 1492853575UL, 2182681191UL, 3866043645UL, 1353658829UL, 2782805925UL, 2482504045UL, 3916834400UL, 222960658UL, 2681616579UL, 2406892654UL, 1371039946UL, 3717269950UL, 3632913684UL, 2373372484UL, 4071148456UL, 1732115898UL, 1598596195UL, 1180866173UL, 3787873944UL, 1110366522UL, 3540138766UL, 338607286UL, 3262593182UL, 1714619779UL, +995824548UL, 3557851982UL, 2470276596UL, 1549877186UL, 2342751414UL, 2962194596UL, 282941857UL, 3418249797UL, 3300699992UL, 2080590834UL, 1859612288UL, 370155667UL, 1109991145UL, 933065597UL, 4126279826UL, 3005912276UL, 402503017UL, 4016454981UL, 3640556350UL, 618040940UL, 2884057401UL, 2752078014UL, 371928981UL, 3354635500UL, 2952377979UL, 908942821UL, 445067764UL, 2732367763UL, 3225606514UL, 935181950UL, 4104754911UL, 2134958042UL, +680726116UL, 3098695319UL, 652514936UL, 2946640978UL, 2428195541UL, 2433504485UL, 4042288512UL, 1834165243UL, 1252490765UL, 2375226348UL, 806148488UL, 197247918UL, 1459523569UL, 2578888115UL, 4020619856UL, 3030619444UL, 3242554868UL, 2222750155UL, 3433259466UL, 2938924979UL, 4189583150UL, 1604586306UL, 400149547UL, 616758943UL, 2437150739UL, 1749517801UL, 2903749036UL, 571531698UL, 2722580830UL, 2457849017UL, 342934950UL, 216040419UL, +3302138698UL, 545097903UL, 2404801649UL, 4117851084UL, 2941903397UL, 2926001994UL, 1253296096UL, 14864453UL, 2272105738UL, 641404242UL, 2446601571UL, 2989955985UL, 2179417586UL, 1998875331UL, 1325970749UL, 2470418771UL, 1896726594UL, 428880410UL, 95705225UL, 580635702UL, 95529058UL, 3294258049UL, 3132946201UL, 2254984383UL, 1632695776UL, 3381575123UL, 829668922UL, 3029657560UL, 1291002316UL, 3600816069UL, 332821128UL, 715635401UL, +397442545UL, 1908855486UL, 1177948589UL, 3324147260UL, 443010703UL, 990384909UL, 227656706UL, 1485922673UL, 3468390490UL, 727464961UL, 3295033100UL, 1727893393UL, 3602757903UL, 3849734062UL, 3020775130UL, 1132286601UL, 833779022UL, 719369683UL, 3336941985UL, 2215591597UL, 283414013UL, 3694463505UL, 1137588651UL, 1245145305UL, 2124955521UL, 1735742473UL, 1226895255UL, 1126753016UL, 1536376839UL, 1719121879UL, 2090644528UL, 2423256074UL, +2463913828UL, 4035794571UL, 1283364713UL, 1037552449UL, 3550875802UL, 3783120790UL, 4233012781UL, 3326764615UL, 3730461081UL, 1492853575UL, 2182681191UL, 654850701UL, 1353658829UL, 2782805925UL, 2482504045UL, 3916834400UL, 1556782509UL, 2681616579UL, 2406892654UL, 1371039946UL, 3717269950UL, 1227526114UL, 2373372484UL, 4071148456UL, 1732115898UL, 1598596195UL, 1777009717UL, 3787873944UL, 1110366522UL, 3540138766UL, 338607286UL, 1161080599UL, +1714619779UL, 995824548UL, 3557851982UL, 2470276596UL, 3162659171UL, 2342751414UL, 2962194596UL, 282941857UL, 3418249797UL, 1032034511UL, 2080590834UL, 1859612288UL, 370155667UL, 1109991145UL, 2568097099UL, 4126279826UL, 3005912276UL, 402503017UL, 4016454981UL, 3196575353UL, 618040940UL, 2884057401UL, 2752078014UL, 371928981UL, 4223799564UL, 2952377979UL, 908942821UL, 445067764UL, 2732367763UL, 174723563UL, 935181950UL, 4104754911UL, +2134958042UL, 680726116UL, 649687363UL, 652514936UL, 2946640978UL, 2428195541UL, 2433504485UL, 3735735592UL, 1834165243UL, 1252490765UL, 2375226348UL, 806148488UL, 3720638976UL, 1459523569UL, 2578888115UL, 4020619856UL, 3030619444UL, 283333114UL, 2222750155UL, 3433259466UL, 2938924979UL, 4189583150UL, 870522428UL, 400149547UL, 616758943UL, 2437150739UL, 1749517801UL, 999295363UL, 571531698UL, 2722580830UL, 2457849017UL, 342934950UL, +3151292467UL, 2839665217UL, 2452261456UL, 208520727UL, 2269948412UL, 344787478UL, 3987474076UL, 3770524881UL, 2718719281UL, 2537804795UL, 850790212UL, 639946566UL, 2073602691UL, 2316769983UL, 3577216077UL, 3538374748UL, 61447995UL, 3718817085UL, 1476398788UL, 3239144530UL, 3595014456UL, 454482110UL, 286330934UL, 2119173159UL, 1693518756UL, 1464218560UL, 1201825197UL, 1112746405UL, 2988579776UL, 1626663767UL, 2236015969UL, 4018896468UL, +1885926862UL, 671386673UL, 1583086162UL, 1114723892UL, 2936863300UL, 2620955107UL, 2628074015UL, 426673611UL, 3370181092UL, 3462245129UL, 3590185736UL, 2630441788UL, 171626554UL, 3647663038UL, 880996914UL, 1155913149UL, 2653278555UL, 508978149UL, 2031872445UL, 3041145171UL, 1339819022UL, 127509725UL, 1336955078UL, 727702092UL, 693349672UL, 999665905UL, 2287631318UL, 961427722UL, 3355851447UL, 821851136UL, 2370998072UL, 4027450519UL, +2054803464UL, 144596514UL, 3295312213UL, 2579322479UL, 2982266864UL, 4275468400UL, 179988815UL, 2123828208UL, 1486957870UL, 2484928010UL, 288096701UL, 1211834301UL, 1819157080UL, 3569000238UL, 4164201803UL, 3042117433UL, 2741571248UL, 3688451311UL, 29376415UL, 437788821UL, 994675658UL, 1014591996UL, 296335443UL, 363551454UL, 2628890394UL, 332401256UL, 2288239762UL, 3766239385UL, 317162173UL, 3721125104UL, 2296650899UL, 56428392UL, +3900411067UL, 2303724992UL, 3735005983UL, 1377320198UL, 612032498UL, 1171213235UL, 2494454628UL, 1894368149UL, 4124860986UL, 1694123597UL, 2306091209UL, 2075278956UL, 3898366152UL, 937522278UL, 32800830UL, 324902076UL, 2365753207UL, 2251160429UL, 1692543836UL, 2920424644UL, 119047416UL, 1821685115UL, 1486296407UL, 3055580738UL, 3711421730UL, 1522703457UL, 1422399573UL, 2515073038UL, 3788816887UL, 3490575947UL, 2395299159UL, 4248373284UL, +3383561277UL, 3128107243UL, 2344292809UL, 1806504793UL, 3087395022UL, 4113720664UL, 2749262038UL, 395148869UL, 1331347439UL, 2682558741UL, 1253966763UL, 4204248490UL, 2083995727UL, 2717069903UL, 4144872894UL, 1857751053UL, 2166276701UL, 1419950839UL, 1145170701UL, 3225260742UL, 211743500UL, 2746391743UL, 3333387219UL, 4115426799UL, 3801457092UL, 3327614811UL, 1460971336UL, 2256342146UL, 3186427137UL, 2684216499UL, 1035644397UL, 2948948308UL, +}, +{ +216975964UL, 4145824263UL, 2147471723UL, 4154469597UL, 161744273UL, 1299764439UL, 3468614543UL, 4190517158UL, 4124232403UL, 754999274UL, 208153182UL, 1442063188UL, 2940825403UL, 729331312UL, 2124186505UL, 1136411459UL, 1083787490UL, 442264548UL, 442338468UL, 464589685UL, 3509461223UL, 4241734851UL, 370778328UL, 4003105058UL, 3163637982UL, 3747133182UL, 1433548371UL, 1876378240UL, 536564977UL, 1171222160UL, 3268902719UL, 2725776746UL, +1547771137UL, 2818791461UL, 4129042013UL, 2677094853UL, 1594765197UL, 1556725424UL, 569252594UL, 2640731848UL, 2947042710UL, 2633188904UL, 1640957370UL, 1806863786UL, 2803403654UL, 2632220187UL, 2740076538UL, 383549855UL, 3211856699UL, 3933793958UL, 1988232112UL, 404006876UL, 1369488120UL, 1963339964UL, 609604643UL, 2488118016UL, 3936354252UL, 1980115609UL, 189069630UL, 860670414UL, 85775513UL, 2447581620UL, 886385122UL, 3047212472UL, +2470718978UL, 4044569663UL, 430717074UL, 1598133481UL, 1905362808UL, 2981511487UL, 1842297666UL, 2992320857UL, 1682119455UL, 1753461544UL, 700013801UL, 3025873251UL, 3413358770UL, 1673092091UL, 113651375UL, 2618875026UL, 1479752146UL, 81598739UL, 1530418117UL, 962911586UL, 778994423UL, 3944331100UL, 4116504755UL, 480712357UL, 1078821437UL, 1091665476UL, 3696871260UL, 2074607518UL, 3226459752UL, 3767432525UL, 768289441UL, 3142741843UL, +2969151790UL, 1814889320UL, 2122849610UL, 451935137UL, 2784993892UL, 1836517944UL, 1565951586UL, 1663606442UL, 1578543925UL, 33407321UL, 1445768530UL, 2156093253UL, 3164165477UL, 3093293932UL, 298945371UL, 2558835427UL, 1386275152UL, 2649603495UL, 893605644UL, 1147537351UL, 1889670166UL, 3203610476UL, 2598985714UL, 966335150UL, 3384227644UL, 2584671737UL, 552770393UL, 2430097209UL, 3085150053UL, 3633667948UL, 1319147485UL, 1999467843UL, +3676133150UL, 2314789604UL, 1443760911UL, 1552954684UL, 2411684219UL, 3708965016UL, 2607719926UL, 484007519UL, 491681421UL, 2498192461UL, 6342020UL, 4226570819UL, 2329860147UL, 1097040622UL, 1270325434UL, 2572535504UL, 918592905UL, 193599782UL, 4223250613UL, 1640082589UL, 1817957216UL, 2937344769UL, 3768793871UL, 2982566292UL, 1607453458UL, 4096207317UL, 696907828UL, 2431936270UL, 627206620UL, 3267100287UL, 1161821973UL, 2322099303UL, +1700245615UL, 216975964UL, 4145824263UL, 2147471723UL, 4154469597UL, 2836499116UL, 1299764439UL, 3468614543UL, 4190517158UL, 4124232403UL, 2176257299UL, 208153182UL, 1442063188UL, 2940825403UL, 729331312UL, 2954254860UL, 1136411459UL, 1083787490UL, 442264548UL, 442338468UL, 3098695824UL, 3509461223UL, 4241734851UL, 370778328UL, 4003105058UL, 2963948505UL, 3747133182UL, 1433548371UL, 1876378240UL, 536564977UL, 1565224991UL, 3268902719UL, +2725776746UL, 1547771137UL, 2818791461UL, 2118790546UL, 2677094853UL, 1594765197UL, 1556725424UL, 569252594UL, 610771792UL, 2947042710UL, 2633188904UL, 1640957370UL, 1806863786UL, 2121022793UL, 2632220187UL, 2740076538UL, 383549855UL, 3211856699UL, 14274926UL, 1988232112UL, 404006876UL, 1369488120UL, 1963339964UL, 1661081792UL, 2488118016UL, 3936354252UL, 1980115609UL, 189069630UL, 595192504UL, 85775513UL, 2447581620UL, 886385122UL, +3047212472UL, 1596069326UL, 4044569663UL, 430717074UL, 1598133481UL, 1905362808UL, 2670961612UL, 1842297666UL, 2992320857UL, 1682119455UL, 1753461544UL, 1121764918UL, 3025873251UL, 3413358770UL, 1673092091UL, 113651375UL, 1721474883UL, 1479752146UL, 81598739UL, 1530418117UL, 962911586UL, 3478535046UL, 3944331100UL, 4116504755UL, 480712357UL, 1078821437UL, 1456786415UL, 3696871260UL, 2074607518UL, 3226459752UL, 3767432525UL, 2947648865UL, +3142741843UL, 2969151790UL, 1814889320UL, 2122849610UL, 3367879697UL, 2784993892UL, 1836517944UL, 1565951586UL, 1663606442UL, 2621366329UL, 33407321UL, 1445768530UL, 2156093253UL, 3164165477UL, 619266142UL, 298945371UL, 2558835427UL, 1386275152UL, 2649603495UL, 97967685UL, 1147537351UL, 1889670166UL, 3203610476UL, 2598985714UL, 504495866UL, 3384227644UL, 2584671737UL, 552770393UL, 2430097209UL, 2168477293UL, 3633667948UL, 1319147485UL, +1999467843UL, 3676133150UL, 2755203144UL, 1443760911UL, 1552954684UL, 2411684219UL, 3708965016UL, 2301846628UL, 484007519UL, 491681421UL, 2498192461UL, 6342020UL, 318325395UL, 2329860147UL, 1097040622UL, 1270325434UL, 2572535504UL, 3458698828UL, 193599782UL, 4223250613UL, 1640082589UL, 1817957216UL, 1861636211UL, 3768793871UL, 2982566292UL, 1607453458UL, 4096207317UL, 1871072589UL, 2431936270UL, 627206620UL, 3267100287UL, 1161821973UL, +3904037207UL, 1700245615UL, 216975964UL, 4145824263UL, 2147471723UL, 2789343849UL, 2836499116UL, 1299764439UL, 3468614543UL, 4190517158UL, 639361502UL, 2176257299UL, 208153182UL, 1442063188UL, 2940825403UL, 2962998954UL, 2954254860UL, 1136411459UL, 1083787490UL, 442264548UL, 1812626669UL, 3098695824UL, 3509461223UL, 4241734851UL, 370778328UL, 1673951193UL, 2963948505UL, 3747133182UL, 1433548371UL, 1876378240UL, 3651623536UL, 1565224991UL, +3268902719UL, 2725776746UL, 1547771137UL, 1938402968UL, 2118790546UL, 2677094853UL, 1594765197UL, 1556725424UL, 3267956202UL, 610771792UL, 2947042710UL, 2633188904UL, 1640957370UL, 1448040688UL, 2121022793UL, 2632220187UL, 2740076538UL, 383549855UL, 300148175UL, 14274926UL, 1988232112UL, 404006876UL, 1369488120UL, 3313508750UL, 1661081792UL, 2488118016UL, 3936354252UL, 1980115609UL, 2631341293UL, 595192504UL, 85775513UL, 2447581620UL, +886385122UL, 2465820467UL, 1596069326UL, 4044569663UL, 430717074UL, 1598133481UL, 4191772516UL, 2670961612UL, 1842297666UL, 2992320857UL, 1682119455UL, 997741285UL, 1121764918UL, 3025873251UL, 3413358770UL, 1673092091UL, 1493832846UL, 1721474883UL, 1479752146UL, 81598739UL, 1530418117UL, 2762019274UL, 3478535046UL, 3944331100UL, 4116504755UL, 480712357UL, 448437372UL, 1456786415UL, 3696871260UL, 2074607518UL, 3226459752UL, 2507199309UL, +2947648865UL, 3142741843UL, 2969151790UL, 1814889320UL, 2268952501UL, 3367879697UL, 2784993892UL, 1836517944UL, 1565951586UL, 377207573UL, 2621366329UL, 33407321UL, 1445768530UL, 2156093253UL, 1325490318UL, 619266142UL, 298945371UL, 2558835427UL, 1386275152UL, 2662699426UL, 97967685UL, 1147537351UL, 1889670166UL, 3203610476UL, 1999783658UL, 504495866UL, 3384227644UL, 2584671737UL, 552770393UL, 1562106652UL, 2168477293UL, 3633667948UL, +1319147485UL, 1999467843UL, 2037219988UL, 2755203144UL, 1443760911UL, 1552954684UL, 2411684219UL, 1579607443UL, 2301846628UL, 484007519UL, 491681421UL, 2498192461UL, 745333677UL, 318325395UL, 2329860147UL, 1097040622UL, 1270325434UL, 208017379UL, 3458698828UL, 193599782UL, 4223250613UL, 1640082589UL, 4049245262UL, 1861636211UL, 3768793871UL, 2982566292UL, 1607453458UL, 2058912455UL, 1871072589UL, 2431936270UL, 627206620UL, 3267100287UL, +1186015034UL, 3904037207UL, 1700245615UL, 216975964UL, 4145824263UL, 2422827462UL, 2789343849UL, 2836499116UL, 1299764439UL, 3468614543UL, 2084839633UL, 639361502UL, 2176257299UL, 208153182UL, 1442063188UL, 4065931048UL, 2962998954UL, 2954254860UL, 1136411459UL, 1083787490UL, 465529524UL, 1812626669UL, 3098695824UL, 3509461223UL, 4241734851UL, 3818602366UL, 1673951193UL, 2963948505UL, 3747133182UL, 1433548371UL, 2475307467UL, 3651623536UL, +1565224991UL, 3268902719UL, 2725776746UL, 2374226870UL, 1938402968UL, 2118790546UL, 2677094853UL, 1594765197UL, 348828658UL, 3267956202UL, 610771792UL, 2947042710UL, 2633188904UL, 1713124265UL, 1448040688UL, 2121022793UL, 2632220187UL, 2740076538UL, 1400362266UL, 300148175UL, 14274926UL, 1988232112UL, 404006876UL, 3662575932UL, 3313508750UL, 1661081792UL, 2488118016UL, 3936354252UL, 3100635752UL, 2631341293UL, 595192504UL, 85775513UL, +2447581620UL, 2417839883UL, 2465820467UL, 1596069326UL, 4044569663UL, 430717074UL, 1093503127UL, 4191772516UL, 2670961612UL, 1842297666UL, 2992320857UL, 3292586028UL, 997741285UL, 1121764918UL, 3025873251UL, 3413358770UL, 222522839UL, 1493832846UL, 1721474883UL, 1479752146UL, 81598739UL, 3132900738UL, 2762019274UL, 3478535046UL, 3944331100UL, 4116504755UL, 3429405501UL, 448437372UL, 1456786415UL, 3696871260UL, 2074607518UL, 1492852861UL, +2507199309UL, 2947648865UL, 3142741843UL, 2969151790UL, 2186889362UL, 2268952501UL, 3367879697UL, 2784993892UL, 1836517944UL, 3169157745UL, 377207573UL, 2621366329UL, 33407321UL, 1445768530UL, 4266168148UL, 1325490318UL, 619266142UL, 298945371UL, 2558835427UL, 1447045944UL, 2662699426UL, 97967685UL, 1147537351UL, 1889670166UL, 3354555370UL, 1999783658UL, 504495866UL, 3384227644UL, 2584671737UL, 2489662408UL, 1562106652UL, 2168477293UL, +3633667948UL, 1319147485UL, 3353555249UL, 2037219988UL, 2755203144UL, 1443760911UL, 1552954684UL, 4137514176UL, 1579607443UL, 2301846628UL, 484007519UL, 491681421UL, 164627749UL, 745333677UL, 318325395UL, 2329860147UL, 1097040622UL, 3587444362UL, 208017379UL, 3458698828UL, 193599782UL, 4223250613UL, 1102471426UL, 4049245262UL, 1861636211UL, 3768793871UL, 2982566292UL, 1941698603UL, 2058912455UL, 1871072589UL, 2431936270UL, 627206620UL, +2511999766UL, 1406946444UL, 1571284360UL, 1416792763UL, 1774410400UL, 1655066897UL, 740531687UL, 2852637013UL, 1574342442UL, 3931672444UL, 2887289502UL, 3588598337UL, 1607795590UL, 1893126336UL, 4113959952UL, 250670029UL, 89330705UL, 2198706475UL, 133060312UL, 4033807246UL, 2161604768UL, 3871950931UL, 1820516188UL, 828316231UL, 3126087794UL, 3740050736UL, 543577819UL, 1589693651UL, 4210480257UL, 3844498352UL, 96010254UL, 2888517657UL, +2931088981UL, 2307454606UL, 2411141663UL, 4193964276UL, 918899600UL, 888509951UL, 3023902229UL, 1371276096UL, 2107726407UL, 3863079906UL, 3849297291UL, 1512401618UL, 3098628219UL, 487705749UL, 492891601UL, 345791371UL, 3230138831UL, 1022138839UL, 974682588UL, 3677932604UL, 2054641860UL, 3303576494UL, 1416653965UL, 1119635666UL, 1907978487UL, 4269977208UL, 2047880336UL, 205698774UL, 2401894999UL, 3253173123UL, 2603439113UL, 1295808319UL, +2965198050UL, 1718424301UL, 1605627562UL, 2860017421UL, 1619060227UL, 1130717786UL, 2992070906UL, 2964091191UL, 3192265220UL, 3860528275UL, 45139953UL, 3914023193UL, 1253834497UL, 3885013544UL, 3793695046UL, 3632364934UL, 4127361980UL, 3323804519UL, 4117285262UL, 4171102020UL, 1863837906UL, 2848174924UL, 1731389076UL, 2514130112UL, 3539384422UL, 2950752200UL, 1138137434UL, 4147328087UL, 3345958235UL, 2305097760UL, 974161669UL, 1739611700UL, +2522036172UL, 1196649816UL, 2395301283UL, 911135539UL, 1029496076UL, 1786766951UL, 1802412425UL, 3485017668UL, 2837835718UL, 1951207514UL, 1447650206UL, 2289702688UL, 2517625074UL, 2408021138UL, 2022522416UL, 719777136UL, 417238676UL, 1865171065UL, 801820378UL, 2836941189UL, 1148226009UL, 1713866138UL, 64608707UL, 1458585813UL, 3581572089UL, 2251042907UL, 1818903516UL, 3278072806UL, 2838874249UL, 2665607605UL, 3360214955UL, 2185961451UL, +410342713UL, 364484774UL, 2887998484UL, 2100888426UL, 1394314931UL, 1362560504UL, 3487221127UL, 3140021092UL, 3168968161UL, 1613267484UL, 290430673UL, 2588210538UL, 2493788232UL, 2641638765UL, 2971195072UL, 2749469779UL, 692014176UL, 3268150742UL, 387451740UL, 461249727UL, 3579417331UL, 3738405845UL, 385445455UL, 1464799053UL, 2786433795UL, 3370371952UL, 675344511UL, 4049011269UL, 2196568686UL, 4166285481UL, 2547135972UL, 119952106UL, +}, +{ +2307933966UL, 145940188UL, 4247815717UL, 2995341855UL, 3245382498UL, 1213200792UL, 232910392UL, 2718014238UL, 918321585UL, 3583102265UL, 3176078796UL, 937696513UL, 266558688UL, 1520650260UL, 3655025189UL, 1653323191UL, 538426778UL, 491545855UL, 4064663509UL, 2788350755UL, 3941259490UL, 3471552693UL, 1851151228UL, 3279627338UL, 845228710UL, 29883500UL, 1503432309UL, 593880175UL, 2488716480UL, 828058076UL, 3287933183UL, 3510981973UL, +3970051135UL, 3803049980UL, 898259836UL, 2890959433UL, 234437380UL, 201835406UL, 1523016285UL, 2419577439UL, 2943482079UL, 4219300984UL, 1490698759UL, 533411805UL, 1644926459UL, 4097374623UL, 265292490UL, 2694560848UL, 285667083UL, 1563945375UL, 3128365011UL, 95277844UL, 2938824634UL, 2717708621UL, 3374928056UL, 3672802273UL, 3445399260UL, 2422205637UL, 1106030557UL, 1269805720UL, 1781057614UL, 3491203689UL, 2454028630UL, 2158698380UL, +2578431870UL, 3540412661UL, 2206372988UL, 3138025266UL, 474100503UL, 3310048546UL, 126856999UL, 3144057206UL, 917199551UL, 3549528813UL, 343855771UL, 391118877UL, 1900257963UL, 1616289477UL, 3663959751UL, 1887891784UL, 697303016UL, 1346369879UL, 3634838543UL, 909311683UL, 3534738830UL, 2676838865UL, 3020679234UL, 1248902118UL, 1517698896UL, 414632197UL, 199589058UL, 2922557451UL, 3915079510UL, 1309075563UL, 3836275459UL, 2549095941UL, +1643088840UL, 1153547003UL, 2254144060UL, 3585420425UL, 915059870UL, 2410951596UL, 1876156254UL, 2384812180UL, 3893647829UL, 4119002503UL, 1535078752UL, 3888310943UL, 1483731374UL, 3915992153UL, 3662664617UL, 1065246672UL, 2307959656UL, 1845927873UL, 2075990232UL, 1346396900UL, 4218283385UL, 3427468026UL, 1518645158UL, 3092538772UL, 3383570452UL, 1317710387UL, 3390054918UL, 4222595168UL, 2468387909UL, 3864538174UL, 2442851586UL, 1858344050UL, +1537617445UL, 1090881039UL, 2055021834UL, 4011332463UL, 2797336692UL, 280272261UL, 3350338577UL, 1682666744UL, 1256176165UL, 2017003515UL, 3666229067UL, 4288064377UL, 3407437449UL, 2957152445UL, 3557139753UL, 4106922773UL, 2612653316UL, 3491950269UL, 1107293753UL, 2926461368UL, 1433860998UL, 1975669351UL, 1680462513UL, 4283282673UL, 168788571UL, 57021447UL, 3888396304UL, 2218068386UL, 2170981202UL, 1587568797UL, 2097820654UL, 1308061343UL, +4096726326UL, 2307933966UL, 145940188UL, 4247815717UL, 2995341855UL, 2894586378UL, 1213200792UL, 232910392UL, 2718014238UL, 918321585UL, 520434726UL, 3176078796UL, 937696513UL, 266558688UL, 1520650260UL, 645408471UL, 1653323191UL, 538426778UL, 491545855UL, 4064663509UL, 2605358672UL, 3941259490UL, 3471552693UL, 1851151228UL, 3279627338UL, 1290188176UL, 29883500UL, 1503432309UL, 593880175UL, 2488716480UL, 1172244224UL, 3287933183UL, +3510981973UL, 3970051135UL, 3803049980UL, 3836242189UL, 2890959433UL, 234437380UL, 201835406UL, 1523016285UL, 1720566850UL, 2943482079UL, 4219300984UL, 1490698759UL, 533411805UL, 982587365UL, 4097374623UL, 265292490UL, 2694560848UL, 285667083UL, 3905392425UL, 3128365011UL, 95277844UL, 2938824634UL, 2717708621UL, 262111126UL, 3672802273UL, 3445399260UL, 2422205637UL, 1106030557UL, 233401560UL, 1781057614UL, 3491203689UL, 2454028630UL, +2158698380UL, 3314008662UL, 3540412661UL, 2206372988UL, 3138025266UL, 474100503UL, 1150191741UL, 126856999UL, 3144057206UL, 917199551UL, 3549528813UL, 84516590UL, 391118877UL, 1900257963UL, 1616289477UL, 3663959751UL, 2831036790UL, 697303016UL, 1346369879UL, 3634838543UL, 909311683UL, 2206291004UL, 2676838865UL, 3020679234UL, 1248902118UL, 1517698896UL, 882506847UL, 199589058UL, 2922557451UL, 3915079510UL, 1309075563UL, 3675129276UL, +2549095941UL, 1643088840UL, 1153547003UL, 2254144060UL, 1702669516UL, 915059870UL, 2410951596UL, 1876156254UL, 2384812180UL, 393602062UL, 4119002503UL, 1535078752UL, 3888310943UL, 1483731374UL, 1135074988UL, 3662664617UL, 1065246672UL, 2307959656UL, 1845927873UL, 883002610UL, 1346396900UL, 4218283385UL, 3427468026UL, 1518645158UL, 1478839081UL, 3383570452UL, 1317710387UL, 3390054918UL, 4222595168UL, 3009846855UL, 3864538174UL, 2442851586UL, +1858344050UL, 1537617445UL, 2419526192UL, 2055021834UL, 4011332463UL, 2797336692UL, 280272261UL, 2937342669UL, 1682666744UL, 1256176165UL, 2017003515UL, 3666229067UL, 3563024742UL, 3407437449UL, 2957152445UL, 3557139753UL, 4106922773UL, 610182860UL, 3491950269UL, 1107293753UL, 2926461368UL, 1433860998UL, 2493047579UL, 1680462513UL, 4283282673UL, 168788571UL, 57021447UL, 2151356582UL, 2218068386UL, 2170981202UL, 1587568797UL, 2097820654UL, +2738927570UL, 4096726326UL, 2307933966UL, 145940188UL, 4247815717UL, 1887236689UL, 2894586378UL, 1213200792UL, 232910392UL, 2718014238UL, 2028538736UL, 520434726UL, 3176078796UL, 937696513UL, 266558688UL, 305624632UL, 645408471UL, 1653323191UL, 538426778UL, 491545855UL, 4188864445UL, 2605358672UL, 3941259490UL, 3471552693UL, 1851151228UL, 1720039364UL, 1290188176UL, 29883500UL, 1503432309UL, 593880175UL, 2595662526UL, 1172244224UL, +3287933183UL, 3510981973UL, 3970051135UL, 2763703998UL, 3836242189UL, 2890959433UL, 234437380UL, 201835406UL, 2652280530UL, 1720566850UL, 2943482079UL, 4219300984UL, 1490698759UL, 1968049758UL, 982587365UL, 4097374623UL, 265292490UL, 2694560848UL, 1165326939UL, 3905392425UL, 3128365011UL, 95277844UL, 2938824634UL, 2521869983UL, 262111126UL, 3672802273UL, 3445399260UL, 2422205637UL, 395183943UL, 233401560UL, 1781057614UL, 3491203689UL, +2454028630UL, 249721174UL, 3314008662UL, 3540412661UL, 2206372988UL, 3138025266UL, 1644439373UL, 1150191741UL, 126856999UL, 3144057206UL, 917199551UL, 1997133400UL, 84516590UL, 391118877UL, 1900257963UL, 1616289477UL, 3843764922UL, 2831036790UL, 697303016UL, 1346369879UL, 3634838543UL, 1901125181UL, 2206291004UL, 2676838865UL, 3020679234UL, 1248902118UL, 344347894UL, 882506847UL, 199589058UL, 2922557451UL, 3915079510UL, 2919277604UL, +3675129276UL, 2549095941UL, 1643088840UL, 1153547003UL, 3305575634UL, 1702669516UL, 915059870UL, 2410951596UL, 1876156254UL, 1416053196UL, 393602062UL, 4119002503UL, 1535078752UL, 3888310943UL, 3993632377UL, 1135074988UL, 3662664617UL, 1065246672UL, 2307959656UL, 1044670394UL, 883002610UL, 1346396900UL, 4218283385UL, 3427468026UL, 1792832168UL, 1478839081UL, 3383570452UL, 1317710387UL, 3390054918UL, 1596709924UL, 3009846855UL, 3864538174UL, +2442851586UL, 1858344050UL, 2428482265UL, 2419526192UL, 2055021834UL, 4011332463UL, 2797336692UL, 424213503UL, 2937342669UL, 1682666744UL, 1256176165UL, 2017003515UL, 717473071UL, 3563024742UL, 3407437449UL, 2957152445UL, 3557139753UL, 3319575432UL, 610182860UL, 3491950269UL, 1107293753UL, 2926461368UL, 3052637648UL, 2493047579UL, 1680462513UL, 4283282673UL, 168788571UL, 1401253163UL, 2151356582UL, 2218068386UL, 2170981202UL, 1587568797UL, +3994937670UL, 2738927570UL, 4096726326UL, 2307933966UL, 145940188UL, 3928146647UL, 1887236689UL, 2894586378UL, 1213200792UL, 232910392UL, 833120806UL, 2028538736UL, 520434726UL, 3176078796UL, 937696513UL, 3704968451UL, 305624632UL, 645408471UL, 1653323191UL, 538426778UL, 939335571UL, 4188864445UL, 2605358672UL, 3941259490UL, 3471552693UL, 2168499975UL, 1720039364UL, 1290188176UL, 29883500UL, 1503432309UL, 524387655UL, 2595662526UL, +1172244224UL, 3287933183UL, 3510981973UL, 2444664749UL, 2763703998UL, 3836242189UL, 2890959433UL, 234437380UL, 3272987579UL, 2652280530UL, 1720566850UL, 2943482079UL, 4219300984UL, 1045589319UL, 1968049758UL, 982587365UL, 4097374623UL, 265292490UL, 1077412791UL, 1165326939UL, 3905392425UL, 3128365011UL, 95277844UL, 2896038035UL, 2521869983UL, 262111126UL, 3672802273UL, 3445399260UL, 4273256145UL, 395183943UL, 233401560UL, 1781057614UL, +3491203689UL, 8343453UL, 249721174UL, 3314008662UL, 3540412661UL, 2206372988UL, 3738630867UL, 1644439373UL, 1150191741UL, 126856999UL, 3144057206UL, 65169501UL, 1997133400UL, 84516590UL, 391118877UL, 1900257963UL, 2914085557UL, 3843764922UL, 2831036790UL, 697303016UL, 1346369879UL, 2007568079UL, 1901125181UL, 2206291004UL, 2676838865UL, 3020679234UL, 2097032931UL, 344347894UL, 882506847UL, 199589058UL, 2922557451UL, 3740400148UL, +2919277604UL, 3675129276UL, 2549095941UL, 1643088840UL, 199560818UL, 3305575634UL, 1702669516UL, 915059870UL, 2410951596UL, 117939268UL, 1416053196UL, 393602062UL, 4119002503UL, 1535078752UL, 4281599711UL, 3993632377UL, 1135074988UL, 3662664617UL, 1065246672UL, 2854253374UL, 1044670394UL, 883002610UL, 1346396900UL, 4218283385UL, 803910659UL, 1792832168UL, 1478839081UL, 3383570452UL, 1317710387UL, 1311168874UL, 1596709924UL, 3009846855UL, +3864538174UL, 2442851586UL, 1967982878UL, 2428482265UL, 2419526192UL, 2055021834UL, 4011332463UL, 2725198749UL, 424213503UL, 2937342669UL, 1682666744UL, 1256176165UL, 713350501UL, 717473071UL, 3563024742UL, 3407437449UL, 2957152445UL, 2363682828UL, 3319575432UL, 610182860UL, 3491950269UL, 1107293753UL, 3429638328UL, 3052637648UL, 2493047579UL, 1680462513UL, 4283282673UL, 2672311163UL, 1401253163UL, 2151356582UL, 2218068386UL, 2170981202UL, +431601500UL, 4193143261UL, 2985267149UL, 1556712183UL, 4135181832UL, 285960576UL, 81711096UL, 57066962UL, 2646151573UL, 3692824605UL, 485132216UL, 2799654118UL, 903527523UL, 1210637484UL, 3195346614UL, 599540837UL, 1410108963UL, 3723542120UL, 1350764011UL, 1717225239UL, 239736775UL, 3946934722UL, 420024332UL, 589304817UL, 1331122625UL, 4294403247UL, 2009397371UL, 844641869UL, 166387728UL, 4093361096UL, 2342369656UL, 3958170613UL, +1660376297UL, 1259528150UL, 4240809115UL, 2875563845UL, 2613790323UL, 2869665108UL, 1414690635UL, 944649070UL, 3539368342UL, 199532147UL, 2707660205UL, 2258475730UL, 771169023UL, 158544851UL, 588872178UL, 2002019277UL, 4225148852UL, 641266809UL, 2133909450UL, 330112418UL, 1815776319UL, 1949213618UL, 3868452239UL, 2702722715UL, 2491030937UL, 468812562UL, 3226259052UL, 199165016UL, 436679774UL, 881956108UL, 1098105661UL, 68909298UL, +248572829UL, 339224422UL, 553849953UL, 3054752668UL, 701934162UL, 1898925107UL, 749060575UL, 987950022UL, 4040401060UL, 684345838UL, 3449205676UL, 2583450513UL, 433795092UL, 3559011048UL, 293161429UL, 3947766299UL, 3491895171UL, 1651265910UL, 1216468759UL, 1625512737UL, 412235874UL, 893680794UL, 2582820523UL, 1514322840UL, 2348781204UL, 2720801933UL, 3364999370UL, 2822073391UL, 2627166519UL, 3805500773UL, 177760590UL, 2210728920UL, +3136345252UL, 3226658259UL, 3982978003UL, 86264452UL, 536816704UL, 3489051867UL, 2161950016UL, 1375640747UL, 4116957650UL, 3676292350UL, 3001078542UL, 1379688752UL, 3059678152UL, 3740664918UL, 475697670UL, 539253230UL, 1256048653UL, 3819847913UL, 141216227UL, 3888391528UL, 3567424851UL, 4131097532UL, 2142453586UL, 3606575354UL, 3689715433UL, 2318212425UL, 3026095399UL, 2451038695UL, 4052322172UL, 1861782452UL, 3032216562UL, 4078403318UL, +2636775961UL, 2188864067UL, 3276459319UL, 2230349722UL, 3939784264UL, 831216291UL, 2483460713UL, 2571551493UL, 484276565UL, 3173595164UL, 4177831244UL, 4132249231UL, 2116763555UL, 1420812998UL, 2121017321UL, 2855491215UL, 1630144518UL, 2489688364UL, 411521312UL, 3713786536UL, 4177871972UL, 690465497UL, 855092147UL, 4271606539UL, 1265108699UL, 3757106624UL, 3151574897UL, 670335437UL, 3099376310UL, 3946436509UL, 1795346235UL, 4013409945UL, +}, +{ +650684252UL, 2220445579UL, 537394374UL, 571322423UL, 2781663439UL, 899394682UL, 364129622UL, 328438826UL, 1219862153UL, 830435885UL, 3278649457UL, 3072225531UL, 2838645991UL, 3150905380UL, 1251952499UL, 1751415553UL, 2034088483UL, 1437197870UL, 1907624878UL, 1786974150UL, 4207811086UL, 768131803UL, 2713210999UL, 4004509777UL, 3510764535UL, 2740991637UL, 3000313526UL, 1355959320UL, 938244439UL, 4093313692UL, 2476002145UL, 835527260UL, +2084758949UL, 4223775017UL, 91645393UL, 2251723899UL, 3159477758UL, 2008655575UL, 912220875UL, 1525327655UL, 2067948386UL, 2006141522UL, 450235614UL, 3945671083UL, 2852189452UL, 3804118704UL, 3302604345UL, 1712745267UL, 349281154UL, 19331179UL, 3423301791UL, 416995358UL, 2049170698UL, 684574142UL, 3271042138UL, 3438668017UL, 1645378852UL, 1995123150UL, 1835887948UL, 2347182898UL, 3828432892UL, 3710259931UL, 713144773UL, 3246285450UL, +2196135622UL, 1611287338UL, 2845388948UL, 3690657633UL, 2403178686UL, 2946296994UL, 2180908599UL, 3072014497UL, 3436535724UL, 2948908116UL, 3080353236UL, 1669938872UL, 3572731079UL, 1100892983UL, 308060688UL, 3092946261UL, 2725115972UL, 887278263UL, 991869336UL, 3597899723UL, 3454505181UL, 1108269267UL, 851855066UL, 1940998002UL, 3539084542UL, 3102161424UL, 965450940UL, 1942363226UL, 1430246588UL, 1368971075UL, 4251556311UL, 642683738UL, +3035789355UL, 1829444044UL, 4234626091UL, 671403403UL, 2809844786UL, 2251172733UL, 970188857UL, 3910072565UL, 1131847479UL, 3397535176UL, 3290884849UL, 861868157UL, 2811422184UL, 3280310458UL, 3502085520UL, 1499698865UL, 2446269873UL, 236680785UL, 1896103604UL, 1179896471UL, 83960622UL, 3303129336UL, 1191373247UL, 177898275UL, 3077388457UL, 1022975703UL, 2535144448UL, 8680269UL, 3602435630UL, 1810825915UL, 2293529378UL, 2307085218UL, +483894148UL, 2872435038UL, 2043868156UL, 3038491874UL, 3786518530UL, 3606440668UL, 3336713377UL, 120183042UL, 86901386UL, 2233164457UL, 2881782972UL, 3135264768UL, 2294460421UL, 2996668315UL, 658184098UL, 3558825846UL, 2386173040UL, 1950463910UL, 551627788UL, 2464303444UL, 893474565UL, 3277869222UL, 2852725906UL, 1191310725UL, 2398932683UL, 4164956002UL, 1689291769UL, 2619288187UL, 3429362702UL, 3205668166UL, 1668126623UL, 955771270UL, +2106753333UL, 650684252UL, 2220445579UL, 537394374UL, 571322423UL, 2369694095UL, 899394682UL, 364129622UL, 328438826UL, 1219862153UL, 4195985755UL, 3278649457UL, 3072225531UL, 2838645991UL, 3150905380UL, 2389919UL, 1751415553UL, 2034088483UL, 1437197870UL, 1907624878UL, 1516966376UL, 4207811086UL, 768131803UL, 2713210999UL, 4004509777UL, 1955929377UL, 2740991637UL, 3000313526UL, 1355959320UL, 938244439UL, 4263287583UL, 2476002145UL, +835527260UL, 2084758949UL, 4223775017UL, 110659216UL, 2251723899UL, 3159477758UL, 2008655575UL, 912220875UL, 2378803214UL, 2067948386UL, 2006141522UL, 450235614UL, 3945671083UL, 4112321452UL, 3804118704UL, 3302604345UL, 1712745267UL, 349281154UL, 3834044005UL, 3423301791UL, 416995358UL, 2049170698UL, 684574142UL, 3651360887UL, 3438668017UL, 1645378852UL, 1995123150UL, 1835887948UL, 1022257616UL, 3828432892UL, 3710259931UL, 713144773UL, +3246285450UL, 2485142597UL, 1611287338UL, 2845388948UL, 3690657633UL, 2403178686UL, 2201888000UL, 2180908599UL, 3072014497UL, 3436535724UL, 2948908116UL, 1647734358UL, 1669938872UL, 3572731079UL, 1100892983UL, 308060688UL, 592016509UL, 2725115972UL, 887278263UL, 991869336UL, 3597899723UL, 819708104UL, 1108269267UL, 851855066UL, 1940998002UL, 3539084542UL, 3156419045UL, 965450940UL, 1942363226UL, 1430246588UL, 1368971075UL, 224112021UL, +642683738UL, 3035789355UL, 1829444044UL, 4234626091UL, 314715303UL, 2809844786UL, 2251172733UL, 970188857UL, 3910072565UL, 155628632UL, 3397535176UL, 3290884849UL, 861868157UL, 2811422184UL, 1847583676UL, 3502085520UL, 1499698865UL, 2446269873UL, 236680785UL, 3698448762UL, 1179896471UL, 83960622UL, 3303129336UL, 1191373247UL, 1567908030UL, 3077388457UL, 1022975703UL, 2535144448UL, 8680269UL, 3979982957UL, 1810825915UL, 2293529378UL, +2307085218UL, 483894148UL, 4003402870UL, 2043868156UL, 3038491874UL, 3786518530UL, 3606440668UL, 3062185402UL, 120183042UL, 86901386UL, 2233164457UL, 2881782972UL, 3345668738UL, 2294460421UL, 2996668315UL, 658184098UL, 3558825846UL, 2121278529UL, 1950463910UL, 551627788UL, 2464303444UL, 893474565UL, 183176481UL, 2852725906UL, 1191310725UL, 2398932683UL, 4164956002UL, 788617081UL, 2619288187UL, 3429362702UL, 3205668166UL, 1668126623UL, +29124108UL, 2106753333UL, 650684252UL, 2220445579UL, 537394374UL, 725338795UL, 2369694095UL, 899394682UL, 364129622UL, 328438826UL, 1727397396UL, 4195985755UL, 3278649457UL, 3072225531UL, 2838645991UL, 583924693UL, 2389919UL, 1751415553UL, 2034088483UL, 1437197870UL, 1017611325UL, 1516966376UL, 4207811086UL, 768131803UL, 2713210999UL, 761144580UL, 1955929377UL, 2740991637UL, 3000313526UL, 1355959320UL, 840696976UL, 4263287583UL, +2476002145UL, 835527260UL, 2084758949UL, 3729075247UL, 110659216UL, 2251723899UL, 3159477758UL, 2008655575UL, 4127907945UL, 2378803214UL, 2067948386UL, 2006141522UL, 450235614UL, 3240776806UL, 4112321452UL, 3804118704UL, 3302604345UL, 1712745267UL, 1079549936UL, 3834044005UL, 3423301791UL, 416995358UL, 2049170698UL, 3913510119UL, 3651360887UL, 3438668017UL, 1645378852UL, 1995123150UL, 841590980UL, 1022257616UL, 3828432892UL, 3710259931UL, +713144773UL, 1272133892UL, 2485142597UL, 1611287338UL, 2845388948UL, 3690657633UL, 3083851146UL, 2201888000UL, 2180908599UL, 3072014497UL, 3436535724UL, 4162521870UL, 1647734358UL, 1669938872UL, 3572731079UL, 1100892983UL, 986584939UL, 592016509UL, 2725115972UL, 887278263UL, 991869336UL, 2711883653UL, 819708104UL, 1108269267UL, 851855066UL, 1940998002UL, 4050477073UL, 3156419045UL, 965450940UL, 1942363226UL, 1430246588UL, 4285490865UL, +224112021UL, 642683738UL, 3035789355UL, 1829444044UL, 4197159994UL, 314715303UL, 2809844786UL, 2251172733UL, 970188857UL, 3018833494UL, 155628632UL, 3397535176UL, 3290884849UL, 861868157UL, 2883971818UL, 1847583676UL, 3502085520UL, 1499698865UL, 2446269873UL, 2621709156UL, 3698448762UL, 1179896471UL, 83960622UL, 3303129336UL, 2192966710UL, 1567908030UL, 3077388457UL, 1022975703UL, 2535144448UL, 95661399UL, 3979982957UL, 1810825915UL, +2293529378UL, 2307085218UL, 485952375UL, 4003402870UL, 2043868156UL, 3038491874UL, 3786518530UL, 575288835UL, 3062185402UL, 120183042UL, 86901386UL, 2233164457UL, 2864966512UL, 3345668738UL, 2294460421UL, 2996668315UL, 658184098UL, 2892259673UL, 2121278529UL, 1950463910UL, 551627788UL, 2464303444UL, 2699734841UL, 183176481UL, 2852725906UL, 1191310725UL, 2398932683UL, 3505505465UL, 788617081UL, 2619288187UL, 3429362702UL, 3205668166UL, +2157859363UL, 29124108UL, 2106753333UL, 650684252UL, 2220445579UL, 978263237UL, 725338795UL, 2369694095UL, 899394682UL, 364129622UL, 3795063930UL, 1727397396UL, 4195985755UL, 3278649457UL, 3072225531UL, 1996768476UL, 583924693UL, 2389919UL, 1751415553UL, 2034088483UL, 1069211024UL, 1017611325UL, 1516966376UL, 4207811086UL, 768131803UL, 1365857736UL, 761144580UL, 1955929377UL, 2740991637UL, 3000313526UL, 1057560595UL, 840696976UL, +4263287583UL, 2476002145UL, 835527260UL, 76517292UL, 3729075247UL, 110659216UL, 2251723899UL, 3159477758UL, 3272987770UL, 4127907945UL, 2378803214UL, 2067948386UL, 2006141522UL, 1223694226UL, 3240776806UL, 4112321452UL, 3804118704UL, 3302604345UL, 2218568154UL, 1079549936UL, 3834044005UL, 3423301791UL, 416995358UL, 3661322119UL, 3913510119UL, 3651360887UL, 3438668017UL, 1645378852UL, 3606917602UL, 841590980UL, 1022257616UL, 3828432892UL, +3710259931UL, 1270853142UL, 1272133892UL, 2485142597UL, 1611287338UL, 2845388948UL, 131877212UL, 3083851146UL, 2201888000UL, 2180908599UL, 3072014497UL, 2459348479UL, 4162521870UL, 1647734358UL, 1669938872UL, 3572731079UL, 4285199726UL, 986584939UL, 592016509UL, 2725115972UL, 887278263UL, 3824306591UL, 2711883653UL, 819708104UL, 1108269267UL, 851855066UL, 190839383UL, 4050477073UL, 3156419045UL, 965450940UL, 1942363226UL, 1750931697UL, +4285490865UL, 224112021UL, 642683738UL, 3035789355UL, 1544088048UL, 4197159994UL, 314715303UL, 2809844786UL, 2251172733UL, 3155072709UL, 3018833494UL, 155628632UL, 3397535176UL, 3290884849UL, 4153861738UL, 2883971818UL, 1847583676UL, 3502085520UL, 1499698865UL, 1780983485UL, 2621709156UL, 3698448762UL, 1179896471UL, 83960622UL, 3849402190UL, 2192966710UL, 1567908030UL, 3077388457UL, 1022975703UL, 1639944917UL, 95661399UL, 3979982957UL, +1810825915UL, 2293529378UL, 3477014442UL, 485952375UL, 4003402870UL, 2043868156UL, 3038491874UL, 1482314580UL, 575288835UL, 3062185402UL, 120183042UL, 86901386UL, 3129494022UL, 2864966512UL, 3345668738UL, 2294460421UL, 2996668315UL, 1986664970UL, 2892259673UL, 2121278529UL, 1950463910UL, 551627788UL, 3105369079UL, 2699734841UL, 183176481UL, 2852725906UL, 1191310725UL, 3154591925UL, 3505505465UL, 788617081UL, 2619288187UL, 3429362702UL, +4204415531UL, 1321048315UL, 4247243973UL, 3085535935UL, 114618345UL, 2126710176UL, 1857709117UL, 3744103666UL, 304437872UL, 2388303947UL, 1802971382UL, 2099900439UL, 2543837819UL, 593111133UL, 3788847386UL, 1479546758UL, 4095492150UL, 240996968UL, 3423191009UL, 2666077260UL, 884572403UL, 2988847666UL, 928827215UL, 2549465610UL, 2773670136UL, 708214104UL, 2594951780UL, 1076989709UL, 2850313793UL, 1401578686UL, 4100639899UL, 2353261688UL, +1323066237UL, 31664438UL, 951240198UL, 3676836716UL, 3633113483UL, 3262159382UL, 981784748UL, 1172850762UL, 3106238289UL, 3118297408UL, 4207023277UL, 3362324732UL, 844983306UL, 3790928628UL, 4156848237UL, 2638267501UL, 1494090858UL, 3955182404UL, 1193294064UL, 4035152789UL, 2971914580UL, 2865046609UL, 3782329083UL, 120288587UL, 3300482994UL, 4268540970UL, 4183426205UL, 3572724103UL, 3287140971UL, 3038086532UL, 3210919007UL, 2171998100UL, +3958495101UL, 1589679371UL, 2880366694UL, 827575211UL, 1343189406UL, 364332706UL, 866065087UL, 33080625UL, 4284492640UL, 2277479989UL, 4110331130UL, 430538110UL, 3549886335UL, 3734345920UL, 3780943339UL, 638033279UL, 2684714509UL, 945721631UL, 49994267UL, 2394351381UL, 1996532760UL, 3201422203UL, 3509459657UL, 4118609520UL, 632454166UL, 696027759UL, 901486290UL, 1230453723UL, 4225865813UL, 4072619256UL, 3111686961UL, 1487480830UL, +4112016561UL, 1577020285UL, 2765241900UL, 2496609620UL, 1731271292UL, 6970479UL, 2936359283UL, 1541124937UL, 3705956773UL, 2349695021UL, 2247551804UL, 3759489710UL, 1321217706UL, 379586757UL, 2008242014UL, 1138475935UL, 3044902216UL, 1917596533UL, 2905651936UL, 3320601534UL, 1468557693UL, 4101437636UL, 374575138UL, 730079080UL, 995340259UL, 1430552870UL, 3860649629UL, 541396702UL, 3413070856UL, 3052797396UL, 3591116740UL, 2811484252UL, +2464310183UL, 1597327051UL, 3288232619UL, 1564716093UL, 2838386049UL, 264313861UL, 881377066UL, 4165178494UL, 1069189853UL, 1045737884UL, 2072266205UL, 2700673629UL, 2338724235UL, 837702541UL, 2603464957UL, 1548182143UL, 3565539962UL, 38172869UL, 1949065935UL, 3628598166UL, 2788698071UL, 3531182193UL, 1367529788UL, 3902468811UL, 1215323634UL, 1117475027UL, 3901912129UL, 2678279671UL, 597953858UL, 4082485755UL, 3696533122UL, 1078703353UL, +}, +{ +590004384UL, 3025338414UL, 1764374188UL, 20686172UL, 932343559UL, 1798441768UL, 1013577341UL, 4275903797UL, 853441141UL, 1065980978UL, 3665193407UL, 1555165047UL, 2962781443UL, 1822487181UL, 3329200135UL, 1527094489UL, 3805115799UL, 2252376033UL, 2137546519UL, 3632426270UL, 2439842864UL, 2525211849UL, 602876448UL, 1488163727UL, 3169015136UL, 832084039UL, 81097112UL, 994974428UL, 1945411347UL, 1020609213UL, 2863240894UL, 1639194881UL, +3078842449UL, 1885382385UL, 2595105518UL, 3857547190UL, 3654577058UL, 3853111480UL, 2237941224UL, 625422255UL, 3292783340UL, 750206381UL, 1002246874UL, 900879607UL, 820635221UL, 3318328110UL, 3980484559UL, 3924790669UL, 4260574943UL, 3658381114UL, 3673068643UL, 1319175627UL, 3620071157UL, 3914274380UL, 3310864044UL, 1529070914UL, 1760958838UL, 818806045UL, 3056976418UL, 2337737150UL, 2061530784UL, 1036243443UL, 2058675708UL, 1932546035UL, +1604709219UL, 1317296740UL, 2505350414UL, 624826181UL, 2710208816UL, 2208469912UL, 1930700024UL, 3769953790UL, 2092911082UL, 520309780UL, 3787727278UL, 684095804UL, 3697683979UL, 111440289UL, 4043494885UL, 1571375993UL, 1828801775UL, 3589061974UL, 3016563679UL, 2026002784UL, 3810490061UL, 2634997537UL, 2715287551UL, 1973545003UL, 3407971274UL, 3239387641UL, 2479429785UL, 324785401UL, 2622755198UL, 1525605325UL, 3280412074UL, 2453630352UL, +726090704UL, 4170024046UL, 248003549UL, 3319518538UL, 1331224401UL, 1203416669UL, 3497395173UL, 2465693133UL, 15303334UL, 267163358UL, 627307819UL, 294350450UL, 3691559013UL, 2491765952UL, 839609873UL, 1598505629UL, 3905396753UL, 583168080UL, 281403302UL, 1658629464UL, 1498139453UL, 2860737994UL, 148007837UL, 1439496901UL, 3226624586UL, 1708925351UL, 195473107UL, 1150552649UL, 2856922985UL, 1853471286UL, 1286593394UL, 2025932254UL, +1300583198UL, 3169702837UL, 1255226060UL, 3482666699UL, 1515557266UL, 1964035766UL, 1604627993UL, 641427670UL, 450188959UL, 1095230428UL, 293179001UL, 1293554079UL, 3022335608UL, 610535626UL, 1329467104UL, 3717935497UL, 1252385485UL, 441595535UL, 2937045243UL, 2846877561UL, 668719121UL, 3604154741UL, 1150714166UL, 1689640190UL, 2219487087UL, 2445975095UL, 3492083575UL, 377195836UL, 2727989292UL, 2460040634UL, 2910322481UL, 399050881UL, +3601292788UL, 590004384UL, 3025338414UL, 1764374188UL, 20686172UL, 3576058865UL, 1798441768UL, 1013577341UL, 4275903797UL, 853441141UL, 3862104007UL, 3665193407UL, 1555165047UL, 2962781443UL, 1822487181UL, 1058917817UL, 1527094489UL, 3805115799UL, 2252376033UL, 2137546519UL, 780594798UL, 2439842864UL, 2525211849UL, 602876448UL, 1488163727UL, 642430472UL, 832084039UL, 81097112UL, 994974428UL, 1945411347UL, 2231598766UL, 2863240894UL, +1639194881UL, 3078842449UL, 1885382385UL, 2387524763UL, 3857547190UL, 3654577058UL, 3853111480UL, 2237941224UL, 991026264UL, 3292783340UL, 750206381UL, 1002246874UL, 900879607UL, 1178067772UL, 3318328110UL, 3980484559UL, 3924790669UL, 4260574943UL, 1964983082UL, 3673068643UL, 1319175627UL, 3620071157UL, 3914274380UL, 992141498UL, 1529070914UL, 1760958838UL, 818806045UL, 3056976418UL, 3295305429UL, 2061530784UL, 1036243443UL, 2058675708UL, +1932546035UL, 3724542133UL, 1317296740UL, 2505350414UL, 624826181UL, 2710208816UL, 3359715256UL, 1930700024UL, 3769953790UL, 2092911082UL, 520309780UL, 1979908015UL, 684095804UL, 3697683979UL, 111440289UL, 4043494885UL, 3256907235UL, 1828801775UL, 3589061974UL, 3016563679UL, 2026002784UL, 1967781780UL, 2634997537UL, 2715287551UL, 1973545003UL, 3407971274UL, 391604110UL, 2479429785UL, 324785401UL, 2622755198UL, 1525605325UL, 462777294UL, +2453630352UL, 726090704UL, 4170024046UL, 248003549UL, 3125444318UL, 1331224401UL, 1203416669UL, 3497395173UL, 2465693133UL, 1610778556UL, 267163358UL, 627307819UL, 294350450UL, 3691559013UL, 3302305047UL, 839609873UL, 1598505629UL, 3905396753UL, 583168080UL, 1502262581UL, 1658629464UL, 1498139453UL, 2860737994UL, 148007837UL, 2973368511UL, 3226624586UL, 1708925351UL, 195473107UL, 1150552649UL, 522423348UL, 1853471286UL, 1286593394UL, +2025932254UL, 1300583198UL, 555770116UL, 1255226060UL, 3482666699UL, 1515557266UL, 1964035766UL, 877073175UL, 641427670UL, 450188959UL, 1095230428UL, 293179001UL, 4216364784UL, 3022335608UL, 610535626UL, 1329467104UL, 3717935497UL, 1665384485UL, 441595535UL, 2937045243UL, 2846877561UL, 668719121UL, 978801343UL, 1150714166UL, 1689640190UL, 2219487087UL, 2445975095UL, 3819595050UL, 377195836UL, 2727989292UL, 2460040634UL, 2910322481UL, +1200428010UL, 3601292788UL, 590004384UL, 3025338414UL, 1764374188UL, 3586255253UL, 3576058865UL, 1798441768UL, 1013577341UL, 4275903797UL, 1511067357UL, 3862104007UL, 3665193407UL, 1555165047UL, 2962781443UL, 2749766525UL, 1058917817UL, 1527094489UL, 3805115799UL, 2252376033UL, 817362043UL, 780594798UL, 2439842864UL, 2525211849UL, 602876448UL, 2309049006UL, 642430472UL, 832084039UL, 81097112UL, 994974428UL, 3148197354UL, 2231598766UL, +2863240894UL, 1639194881UL, 3078842449UL, 311769962UL, 2387524763UL, 3857547190UL, 3654577058UL, 3853111480UL, 1888597091UL, 991026264UL, 3292783340UL, 750206381UL, 1002246874UL, 2904195378UL, 1178067772UL, 3318328110UL, 3980484559UL, 3924790669UL, 4265386540UL, 1964983082UL, 3673068643UL, 1319175627UL, 3620071157UL, 1635921454UL, 992141498UL, 1529070914UL, 1760958838UL, 818806045UL, 3002614702UL, 3295305429UL, 2061530784UL, 1036243443UL, +2058675708UL, 2534375036UL, 3724542133UL, 1317296740UL, 2505350414UL, 624826181UL, 3042995618UL, 3359715256UL, 1930700024UL, 3769953790UL, 2092911082UL, 1870611696UL, 1979908015UL, 684095804UL, 3697683979UL, 111440289UL, 1111193348UL, 3256907235UL, 1828801775UL, 3589061974UL, 3016563679UL, 2203918092UL, 1967781780UL, 2634997537UL, 2715287551UL, 1973545003UL, 17967467UL, 391604110UL, 2479429785UL, 324785401UL, 2622755198UL, 3993572289UL, +462777294UL, 2453630352UL, 726090704UL, 4170024046UL, 813760479UL, 3125444318UL, 1331224401UL, 1203416669UL, 3497395173UL, 2528908686UL, 1610778556UL, 267163358UL, 627307819UL, 294350450UL, 4252461657UL, 3302305047UL, 839609873UL, 1598505629UL, 3905396753UL, 3407593947UL, 1502262581UL, 1658629464UL, 1498139453UL, 2860737994UL, 1137070983UL, 2973368511UL, 3226624586UL, 1708925351UL, 195473107UL, 1973834367UL, 522423348UL, 1853471286UL, +1286593394UL, 2025932254UL, 1636839834UL, 555770116UL, 1255226060UL, 3482666699UL, 1515557266UL, 4244619305UL, 877073175UL, 641427670UL, 450188959UL, 1095230428UL, 710341587UL, 4216364784UL, 3022335608UL, 610535626UL, 1329467104UL, 262034293UL, 1665384485UL, 441595535UL, 2937045243UL, 2846877561UL, 1059914271UL, 978801343UL, 1150714166UL, 1689640190UL, 2219487087UL, 258315233UL, 3819595050UL, 377195836UL, 2727989292UL, 2460040634UL, +1828274968UL, 1200428010UL, 3601292788UL, 590004384UL, 3025338414UL, 3487643146UL, 3586255253UL, 3576058865UL, 1798441768UL, 1013577341UL, 3609472816UL, 1511067357UL, 3862104007UL, 3665193407UL, 1555165047UL, 4188135767UL, 2749766525UL, 1058917817UL, 1527094489UL, 3805115799UL, 1547526585UL, 817362043UL, 780594798UL, 2439842864UL, 2525211849UL, 3949139098UL, 2309049006UL, 642430472UL, 832084039UL, 81097112UL, 2619711743UL, 3148197354UL, +2231598766UL, 2863240894UL, 1639194881UL, 3018692935UL, 311769962UL, 2387524763UL, 3857547190UL, 3654577058UL, 2418052942UL, 1888597091UL, 991026264UL, 3292783340UL, 750206381UL, 2501986418UL, 2904195378UL, 1178067772UL, 3318328110UL, 3980484559UL, 655757623UL, 4265386540UL, 1964983082UL, 3673068643UL, 1319175627UL, 1539823819UL, 1635921454UL, 992141498UL, 1529070914UL, 1760958838UL, 1840073710UL, 3002614702UL, 3295305429UL, 2061530784UL, +1036243443UL, 2212957003UL, 2534375036UL, 3724542133UL, 1317296740UL, 2505350414UL, 2754670042UL, 3042995618UL, 3359715256UL, 1930700024UL, 3769953790UL, 3307920786UL, 1870611696UL, 1979908015UL, 684095804UL, 3697683979UL, 326641529UL, 1111193348UL, 3256907235UL, 1828801775UL, 3589061974UL, 1408835557UL, 2203918092UL, 1967781780UL, 2634997537UL, 2715287551UL, 1958610929UL, 17967467UL, 391604110UL, 2479429785UL, 324785401UL, 3833051255UL, +3993572289UL, 462777294UL, 2453630352UL, 726090704UL, 1236380896UL, 813760479UL, 3125444318UL, 1331224401UL, 1203416669UL, 728276857UL, 2528908686UL, 1610778556UL, 267163358UL, 627307819UL, 4276734917UL, 4252461657UL, 3302305047UL, 839609873UL, 1598505629UL, 3827653659UL, 3407593947UL, 1502262581UL, 1658629464UL, 1498139453UL, 3636064463UL, 1137070983UL, 2973368511UL, 3226624586UL, 1708925351UL, 2288771247UL, 1973834367UL, 522423348UL, +1853471286UL, 1286593394UL, 798364204UL, 1636839834UL, 555770116UL, 1255226060UL, 3482666699UL, 2385578475UL, 4244619305UL, 877073175UL, 641427670UL, 450188959UL, 3502743047UL, 710341587UL, 4216364784UL, 3022335608UL, 610535626UL, 2388448039UL, 262034293UL, 1665384485UL, 441595535UL, 2937045243UL, 3028160550UL, 1059914271UL, 978801343UL, 1150714166UL, 1689640190UL, 169488023UL, 258315233UL, 3819595050UL, 377195836UL, 2727989292UL, +837094660UL, 3531987448UL, 1901453576UL, 3312447598UL, 1036467641UL, 2243300650UL, 3148869460UL, 1886274644UL, 4076707689UL, 257110870UL, 3118463831UL, 1165161057UL, 1118846497UL, 3446934363UL, 1514176098UL, 1362957326UL, 2629874126UL, 791374320UL, 1015673947UL, 4252955786UL, 2409207780UL, 3831311130UL, 1654475922UL, 3682733431UL, 780405105UL, 4059616372UL, 503333525UL, 1471514828UL, 2526848791UL, 607539645UL, 730408454UL, 1574159005UL, +1777808061UL, 1296178310UL, 1078855633UL, 878462103UL, 269337411UL, 750735378UL, 2599590920UL, 4206153248UL, 939121991UL, 3061289971UL, 2543431563UL, 1684736054UL, 2319658494UL, 77300347UL, 3222569207UL, 3882064339UL, 2201120493UL, 289098227UL, 3934209124UL, 2407620042UL, 2713079957UL, 2812644841UL, 115993752UL, 2545688211UL, 774350907UL, 939749505UL, 2242588062UL, 960853876UL, 296665594UL, 1367312411UL, 3370351589UL, 711706404UL, +3331136631UL, 1370376958UL, 2322438166UL, 577115138UL, 1472236592UL, 4029835216UL, 1122502809UL, 3490426739UL, 1930206806UL, 2074277138UL, 1360950220UL, 3797708387UL, 2007430804UL, 2257239461UL, 3889012648UL, 710165871UL, 763101711UL, 728019024UL, 652403220UL, 2517020147UL, 1801290767UL, 1478810019UL, 1057288808UL, 2879821959UL, 3916870020UL, 1480362189UL, 919816752UL, 375872647UL, 3236906236UL, 1504223782UL, 128306943UL, 1355826533UL, +2656243649UL, 390454690UL, 3848250363UL, 377480950UL, 358651174UL, 1337795904UL, 1925462532UL, 2421843219UL, 173144626UL, 886649902UL, 402617827UL, 932830871UL, 742712936UL, 4033430386UL, 1409945926UL, 3617206544UL, 2383446356UL, 3452204096UL, 615486157UL, 720696019UL, 1730134434UL, 3918468503UL, 1629431965UL, 2174079220UL, 325852294UL, 234479771UL, 1490297289UL, 3579002992UL, 3538738636UL, 139386548UL, 3067789050UL, 2078261059UL, +3552654276UL, 1774602596UL, 2105142163UL, 2768099869UL, 2265044995UL, 3680536732UL, 3601322356UL, 2848878442UL, 1166743022UL, 3508176959UL, 2186695985UL, 550278868UL, 3324775634UL, 384537301UL, 1019044102UL, 3354263542UL, 1942540686UL, 922714337UL, 3097711558UL, 3074228403UL, 3565076630UL, 3459053081UL, 4128383906UL, 1114387332UL, 2101424539UL, 1192649508UL, 58778130UL, 1651798895UL, 1752063480UL, 1728826905UL, 2225187635UL, 2463770127UL, +}, +{ +1978406995UL, 576106282UL, 2238958298UL, 2073551095UL, 624788087UL, 4231569260UL, 1853272808UL, 238274694UL, 2389334758UL, 410188028UL, 2293786099UL, 4243662908UL, 2317700970UL, 4050493361UL, 2348206908UL, 485250660UL, 1212732903UL, 169414736UL, 292623762UL, 1602229231UL, 2466348869UL, 3063669700UL, 1872890881UL, 1887188929UL, 3447638989UL, 162521682UL, 1470651713UL, 4036975255UL, 3423782623UL, 4043724693UL, 1686690883UL, 2610958712UL, +35940353UL, 78593759UL, 1565950713UL, 1304303952UL, 2004267248UL, 1417268036UL, 3328228522UL, 789915977UL, 2567452041UL, 3564175714UL, 1838409932UL, 1455795236UL, 22377452UL, 455201131UL, 3340286965UL, 184599544UL, 4102076073UL, 4007870762UL, 1470247063UL, 1579231003UL, 3544385556UL, 3408973464UL, 3759098465UL, 3243598964UL, 532452279UL, 1172265732UL, 3520978258UL, 2880513876UL, 41188252UL, 1663974668UL, 3444236420UL, 338981290UL, +2140558860UL, 3310465688UL, 552673362UL, 3277110106UL, 948036400UL, 1346056406UL, 3257468427UL, 4008294878UL, 3788890535UL, 2414511414UL, 3539325895UL, 3025695322UL, 3727849930UL, 3922840362UL, 535899902UL, 665898223UL, 1456499692UL, 354208792UL, 247894771UL, 2093316680UL, 2945209002UL, 1029298544UL, 976007759UL, 394966955UL, 1843302845UL, 3689202777UL, 1999949614UL, 1070472810UL, 4233404701UL, 667526747UL, 2313963966UL, 3519400667UL, +1548274317UL, 3272402139UL, 2570038689UL, 892260481UL, 3547254358UL, 1540409404UL, 3687395534UL, 3751445920UL, 546406228UL, 2167638865UL, 4234783150UL, 806401261UL, 1351195286UL, 1085913868UL, 3109267901UL, 1882610112UL, 1568734773UL, 239430641UL, 3971361190UL, 383932711UL, 149541490UL, 196701535UL, 108079452UL, 888590964UL, 1708559652UL, 3196290573UL, 2115587458UL, 3198525248UL, 3580113911UL, 3098818120UL, 4271558926UL, 3208851696UL, +3354604918UL, 3536923694UL, 1087345822UL, 2292802521UL, 3500230819UL, 411564772UL, 2408049547UL, 1215342690UL, 1707182109UL, 774540619UL, 1613606757UL, 836141085UL, 1061962136UL, 348765795UL, 2852610966UL, 3526215991UL, 2708801073UL, 3467537935UL, 472234793UL, 3944263763UL, 1782219410UL, 502724699UL, 3525703395UL, 1756411033UL, 1358811278UL, 3938603279UL, 3701976555UL, 3259537961UL, 628617330UL, 1553932236UL, 1974037630UL, 2090519666UL, +2185028543UL, 1978406995UL, 576106282UL, 2238958298UL, 2073551095UL, 638634424UL, 4231569260UL, 1853272808UL, 238274694UL, 2389334758UL, 3808551433UL, 2293786099UL, 4243662908UL, 2317700970UL, 4050493361UL, 957981276UL, 485250660UL, 1212732903UL, 169414736UL, 292623762UL, 1956197178UL, 2466348869UL, 3063669700UL, 1872890881UL, 1887188929UL, 1162224455UL, 162521682UL, 1470651713UL, 4036975255UL, 3423782623UL, 3243414978UL, 1686690883UL, +2610958712UL, 35940353UL, 78593759UL, 1648686849UL, 1304303952UL, 2004267248UL, 1417268036UL, 3328228522UL, 3740797237UL, 2567452041UL, 3564175714UL, 1838409932UL, 1455795236UL, 1045087636UL, 455201131UL, 3340286965UL, 184599544UL, 4102076073UL, 2685677331UL, 1470247063UL, 1579231003UL, 3544385556UL, 3408973464UL, 3832799869UL, 3243598964UL, 532452279UL, 1172265732UL, 3520978258UL, 531684354UL, 41188252UL, 1663974668UL, 3444236420UL, +338981290UL, 1286622338UL, 3310465688UL, 552673362UL, 3277110106UL, 948036400UL, 2987864230UL, 3257468427UL, 4008294878UL, 3788890535UL, 2414511414UL, 2613137548UL, 3025695322UL, 3727849930UL, 3922840362UL, 535899902UL, 3288883992UL, 1456499692UL, 354208792UL, 247894771UL, 2093316680UL, 3775770224UL, 1029298544UL, 976007759UL, 394966955UL, 1843302845UL, 1484214934UL, 1999949614UL, 1070472810UL, 4233404701UL, 667526747UL, 3708951530UL, +3519400667UL, 1548274317UL, 3272402139UL, 2570038689UL, 3457725296UL, 3547254358UL, 1540409404UL, 3687395534UL, 3751445920UL, 181641144UL, 2167638865UL, 4234783150UL, 806401261UL, 1351195286UL, 3457819598UL, 3109267901UL, 1882610112UL, 1568734773UL, 239430641UL, 4037392309UL, 383932711UL, 149541490UL, 196701535UL, 108079452UL, 1724276622UL, 1708559652UL, 3196290573UL, 2115587458UL, 3198525248UL, 3784683125UL, 3098818120UL, 4271558926UL, +3208851696UL, 3354604918UL, 149872004UL, 1087345822UL, 2292802521UL, 3500230819UL, 411564772UL, 4068437023UL, 1215342690UL, 1707182109UL, 774540619UL, 1613606757UL, 1062624488UL, 1061962136UL, 348765795UL, 2852610966UL, 3526215991UL, 1518538195UL, 3467537935UL, 472234793UL, 3944263763UL, 1782219410UL, 1835413488UL, 3525703395UL, 1756411033UL, 1358811278UL, 3938603279UL, 1054245423UL, 3259537961UL, 628617330UL, 1553932236UL, 1974037630UL, +2030751433UL, 2185028543UL, 1978406995UL, 576106282UL, 2238958298UL, 3877268821UL, 638634424UL, 4231569260UL, 1853272808UL, 238274694UL, 2482404724UL, 3808551433UL, 2293786099UL, 4243662908UL, 2317700970UL, 1955227186UL, 957981276UL, 485250660UL, 1212732903UL, 169414736UL, 1333246101UL, 1956197178UL, 2466348869UL, 3063669700UL, 1872890881UL, 3662049503UL, 1162224455UL, 162521682UL, 1470651713UL, 4036975255UL, 3593925064UL, 3243414978UL, +1686690883UL, 2610958712UL, 35940353UL, 2530174792UL, 1648686849UL, 1304303952UL, 2004267248UL, 1417268036UL, 1299827381UL, 3740797237UL, 2567452041UL, 3564175714UL, 1838409932UL, 4221368409UL, 1045087636UL, 455201131UL, 3340286965UL, 184599544UL, 486448047UL, 2685677331UL, 1470247063UL, 1579231003UL, 3544385556UL, 1404931688UL, 3832799869UL, 3243598964UL, 532452279UL, 1172265732UL, 3373048034UL, 531684354UL, 41188252UL, 1663974668UL, +3444236420UL, 1375188728UL, 1286622338UL, 3310465688UL, 552673362UL, 3277110106UL, 655980467UL, 2987864230UL, 3257468427UL, 4008294878UL, 3788890535UL, 763995173UL, 2613137548UL, 3025695322UL, 3727849930UL, 3922840362UL, 1850434657UL, 3288883992UL, 1456499692UL, 354208792UL, 247894771UL, 3440471938UL, 3775770224UL, 1029298544UL, 976007759UL, 394966955UL, 3298245949UL, 1484214934UL, 1999949614UL, 1070472810UL, 4233404701UL, 3788558253UL, +3708951530UL, 3519400667UL, 1548274317UL, 3272402139UL, 3117201719UL, 3457725296UL, 3547254358UL, 1540409404UL, 3687395534UL, 3871454027UL, 181641144UL, 2167638865UL, 4234783150UL, 806401261UL, 1627904858UL, 3457819598UL, 3109267901UL, 1882610112UL, 1568734773UL, 3178105921UL, 4037392309UL, 383932711UL, 149541490UL, 196701535UL, 424324376UL, 1724276622UL, 1708559652UL, 3196290573UL, 2115587458UL, 2946026327UL, 3784683125UL, 3098818120UL, +4271558926UL, 3208851696UL, 2551504859UL, 149872004UL, 1087345822UL, 2292802521UL, 3500230819UL, 3055410013UL, 4068437023UL, 1215342690UL, 1707182109UL, 774540619UL, 2466902579UL, 1062624488UL, 1061962136UL, 348765795UL, 2852610966UL, 355211123UL, 1518538195UL, 3467537935UL, 472234793UL, 3944263763UL, 3159176627UL, 1835413488UL, 3525703395UL, 1756411033UL, 1358811278UL, 2153206130UL, 1054245423UL, 3259537961UL, 628617330UL, 1553932236UL, +1741202495UL, 2030751433UL, 2185028543UL, 1978406995UL, 576106282UL, 2832311581UL, 3877268821UL, 638634424UL, 4231569260UL, 1853272808UL, 3103974717UL, 2482404724UL, 3808551433UL, 2293786099UL, 4243662908UL, 2607780401UL, 1955227186UL, 957981276UL, 485250660UL, 1212732903UL, 3214649174UL, 1333246101UL, 1956197178UL, 2466348869UL, 3063669700UL, 2428387069UL, 3662049503UL, 1162224455UL, 162521682UL, 1470651713UL, 3563435961UL, 3593925064UL, +3243414978UL, 1686690883UL, 2610958712UL, 1021669488UL, 2530174792UL, 1648686849UL, 1304303952UL, 2004267248UL, 1150095671UL, 1299827381UL, 3740797237UL, 2567452041UL, 3564175714UL, 1992360540UL, 4221368409UL, 1045087636UL, 455201131UL, 3340286965UL, 3795860292UL, 486448047UL, 2685677331UL, 1470247063UL, 1579231003UL, 3012017918UL, 1404931688UL, 3832799869UL, 3243598964UL, 532452279UL, 2740401823UL, 3373048034UL, 531684354UL, 41188252UL, +1663974668UL, 1239982773UL, 1375188728UL, 1286622338UL, 3310465688UL, 552673362UL, 2159084435UL, 655980467UL, 2987864230UL, 3257468427UL, 4008294878UL, 1526518186UL, 763995173UL, 2613137548UL, 3025695322UL, 3727849930UL, 4161669345UL, 1850434657UL, 3288883992UL, 1456499692UL, 354208792UL, 1648970767UL, 3440471938UL, 3775770224UL, 1029298544UL, 976007759UL, 292829454UL, 3298245949UL, 1484214934UL, 1999949614UL, 1070472810UL, 949984087UL, +3788558253UL, 3708951530UL, 3519400667UL, 1548274317UL, 3691975282UL, 3117201719UL, 3457725296UL, 3547254358UL, 1540409404UL, 3414085332UL, 3871454027UL, 181641144UL, 2167638865UL, 4234783150UL, 487427004UL, 1627904858UL, 3457819598UL, 3109267901UL, 1882610112UL, 2942538550UL, 3178105921UL, 4037392309UL, 383932711UL, 149541490UL, 528605550UL, 424324376UL, 1724276622UL, 1708559652UL, 3196290573UL, 2042399752UL, 2946026327UL, 3784683125UL, +3098818120UL, 4271558926UL, 2493686919UL, 2551504859UL, 149872004UL, 1087345822UL, 2292802521UL, 3257357826UL, 3055410013UL, 4068437023UL, 1215342690UL, 1707182109UL, 1101368233UL, 2466902579UL, 1062624488UL, 1061962136UL, 348765795UL, 377675640UL, 355211123UL, 1518538195UL, 3467537935UL, 472234793UL, 1918362523UL, 3159176627UL, 1835413488UL, 3525703395UL, 1756411033UL, 490591069UL, 2153206130UL, 1054245423UL, 3259537961UL, 628617330UL, +2464143505UL, 3547421156UL, 4181103091UL, 1646291356UL, 2711273600UL, 2961799099UL, 1443009342UL, 2191618308UL, 1193143275UL, 1858488142UL, 3741304147UL, 1479629752UL, 214641634UL, 1601114903UL, 3032545707UL, 5784133UL, 1466424840UL, 2251379876UL, 4054080092UL, 2965144328UL, 644228426UL, 1397556958UL, 422190032UL, 3059134799UL, 3779253493UL, 1314537880UL, 867798895UL, 3819721559UL, 3588436937UL, 670021879UL, 1070365654UL, 3339455790UL, +2963659516UL, 1662488399UL, 2336157317UL, 3427798652UL, 2782719134UL, 1317842084UL, 1576308528UL, 1129452059UL, 3400565954UL, 84977051UL, 3689257381UL, 3289717503UL, 3535165628UL, 3982356490UL, 173255911UL, 1929987033UL, 4221790572UL, 3473317939UL, 749060417UL, 2711561754UL, 316719217UL, 2359410057UL, 2014271053UL, 1432982162UL, 2107582322UL, 1899811989UL, 1394115707UL, 1134266213UL, 2334994542UL, 2475488907UL, 3238562415UL, 2410379210UL, +4147209396UL, 2446286513UL, 2194020199UL, 3068194593UL, 797186100UL, 1299000541UL, 1870322719UL, 2944499140UL, 1045779179UL, 2735528787UL, 3057750264UL, 2607876894UL, 1595833743UL, 3327636115UL, 3520489322UL, 3864068029UL, 3153522810UL, 2609437702UL, 1360208295UL, 2062444770UL, 3927110355UL, 1524755299UL, 1708215998UL, 3587488663UL, 2813888113UL, 686192293UL, 1078633032UL, 3066910876UL, 793688350UL, 3613674912UL, 387713910UL, 2660476731UL, +3032509241UL, 2353038709UL, 2212424333UL, 2110412913UL, 3631228061UL, 2765134272UL, 4025821789UL, 3324834269UL, 187577732UL, 1568270802UL, 2098502315UL, 2472645526UL, 2986813860UL, 1621191378UL, 3891512282UL, 1561648319UL, 2690491944UL, 3075246584UL, 3202791012UL, 315381589UL, 3645907425UL, 3532420114UL, 802256935UL, 1270128258UL, 2695868207UL, 4075358890UL, 3888212208UL, 510396943UL, 3683116722UL, 3943939501UL, 146061942UL, 733291914UL, +1402325031UL, 672641124UL, 2817168601UL, 2622398925UL, 3641379870UL, 2969146913UL, 4232866548UL, 1694492034UL, 3065141682UL, 234404736UL, 1921499010UL, 2300706258UL, 1304904939UL, 207802178UL, 2674605425UL, 2688377241UL, 2674991105UL, 2585496531UL, 2358858923UL, 2578793432UL, 3275116043UL, 228073476UL, 2936443283UL, 3713102344UL, 1629243323UL, 209348683UL, 3730808488UL, 275442226UL, 223820143UL, 2365614109UL, 3017206322UL, 1906208795UL, +}, +{ +1545504510UL, 1985586093UL, 2005504076UL, 2487099791UL, 2348737867UL, 2254755902UL, 3789154730UL, 3268946922UL, 99552511UL, 1369361877UL, 1888041043UL, 3105269579UL, 4044127396UL, 2380045264UL, 2970234287UL, 293292961UL, 1811276320UL, 1083136897UL, 3016497500UL, 950611584UL, 2165628367UL, 4140133899UL, 2402926185UL, 990501164UL, 2185997143UL, 1769871204UL, 721625457UL, 567446962UL, 1695515231UL, 1848699963UL, 4163520111UL, 2316975723UL, +4268269680UL, 1021066723UL, 517434635UL, 3827063239UL, 3483118065UL, 760366769UL, 3072996795UL, 3548263896UL, 2131401627UL, 4167855065UL, 410255606UL, 1992500865UL, 1322267629UL, 1599293552UL, 2389387938UL, 3721625360UL, 216375429UL, 2002236178UL, 1834631738UL, 1585275126UL, 3879559071UL, 2517667239UL, 1397456303UL, 4095227658UL, 589002062UL, 137665950UL, 3933018338UL, 1519132173UL, 3566494128UL, 3914066872UL, 3233332246UL, 855336825UL, +1882502420UL, 1081015168UL, 4148374722UL, 1683880703UL, 1161266344UL, 99374978UL, 733926790UL, 3520260556UL, 3643143173UL, 927318029UL, 398003191UL, 3472026294UL, 3518018860UL, 2319507998UL, 2650129369UL, 3781620600UL, 1294634949UL, 3977318486UL, 3068540117UL, 3732334866UL, 740308004UL, 1988900647UL, 2936479173UL, 2348744493UL, 1357856242UL, 3842428732UL, 3746094733UL, 214260739UL, 3493892012UL, 2358001919UL, 1775614809UL, 952871363UL, +1216985499UL, 2706067772UL, 1008517818UL, 4189424856UL, 1260334069UL, 2420035836UL, 311831945UL, 3409272605UL, 4266242510UL, 3590716427UL, 537257045UL, 3153762469UL, 1620749663UL, 3338743851UL, 3644831936UL, 3243426619UL, 783551642UL, 1305153827UL, 2026979662UL, 3164955857UL, 4082645339UL, 1633544228UL, 3389303153UL, 440623817UL, 204979344UL, 1674764841UL, 633231391UL, 4180702701UL, 1953210184UL, 2534954734UL, 4252100558UL, 2993632630UL, +4050264705UL, 678445398UL, 1502035091UL, 302442688UL, 493504779UL, 2321459487UL, 1141171231UL, 1507727159UL, 672678623UL, 4046722895UL, 65675127UL, 2936731189UL, 441159654UL, 832039862UL, 2252252769UL, 3090962795UL, 2839688755UL, 645344032UL, 2921087914UL, 2264738834UL, 2341060101UL, 778789539UL, 737962654UL, 2859693559UL, 2784310535UL, 493247978UL, 185832691UL, 3321631011UL, 641506549UL, 2652806878UL, 480335604UL, 2908694258UL, +984807024UL, 1545504510UL, 1985586093UL, 2005504076UL, 2487099791UL, 127488455UL, 2254755902UL, 3789154730UL, 3268946922UL, 99552511UL, 2160330513UL, 1888041043UL, 3105269579UL, 4044127396UL, 2380045264UL, 3185912634UL, 293292961UL, 1811276320UL, 1083136897UL, 3016497500UL, 116883339UL, 2165628367UL, 4140133899UL, 2402926185UL, 990501164UL, 4099344218UL, 1769871204UL, 721625457UL, 567446962UL, 1695515231UL, 1218419978UL, 4163520111UL, +2316975723UL, 4268269680UL, 1021066723UL, 237254804UL, 3827063239UL, 3483118065UL, 760366769UL, 3072996795UL, 1020639813UL, 2131401627UL, 4167855065UL, 410255606UL, 1992500865UL, 1887858126UL, 1599293552UL, 2389387938UL, 3721625360UL, 216375429UL, 2096265248UL, 1834631738UL, 1585275126UL, 3879559071UL, 2517667239UL, 3267338158UL, 4095227658UL, 589002062UL, 137665950UL, 3933018338UL, 3823062902UL, 3566494128UL, 3914066872UL, 3233332246UL, +855336825UL, 3240858503UL, 1081015168UL, 4148374722UL, 1683880703UL, 1161266344UL, 4034899335UL, 733926790UL, 3520260556UL, 3643143173UL, 927318029UL, 2130442867UL, 3472026294UL, 3518018860UL, 2319507998UL, 2650129369UL, 253769320UL, 1294634949UL, 3977318486UL, 3068540117UL, 3732334866UL, 3100107703UL, 1988900647UL, 2936479173UL, 2348744493UL, 1357856242UL, 477065277UL, 3746094733UL, 214260739UL, 3493892012UL, 2358001919UL, 52055911UL, +952871363UL, 1216985499UL, 2706067772UL, 1008517818UL, 2820619262UL, 1260334069UL, 2420035836UL, 311831945UL, 3409272605UL, 2066128794UL, 3590716427UL, 537257045UL, 3153762469UL, 1620749663UL, 2261931254UL, 3644831936UL, 3243426619UL, 783551642UL, 1305153827UL, 3937339872UL, 3164955857UL, 4082645339UL, 1633544228UL, 3389303153UL, 3304461891UL, 204979344UL, 1674764841UL, 633231391UL, 4180702701UL, 2649553051UL, 2534954734UL, 4252100558UL, +2993632630UL, 4050264705UL, 3777379050UL, 1502035091UL, 302442688UL, 493504779UL, 2321459487UL, 1795212504UL, 1507727159UL, 672678623UL, 4046722895UL, 65675127UL, 2810951967UL, 441159654UL, 832039862UL, 2252252769UL, 3090962795UL, 3317253399UL, 645344032UL, 2921087914UL, 2264738834UL, 2341060101UL, 1431934790UL, 737962654UL, 2859693559UL, 2784310535UL, 493247978UL, 555655767UL, 3321631011UL, 641506549UL, 2652806878UL, 480335604UL, +1837415425UL, 984807024UL, 1545504510UL, 1985586093UL, 2005504076UL, 2274320195UL, 127488455UL, 2254755902UL, 3789154730UL, 3268946922UL, 3812459919UL, 2160330513UL, 1888041043UL, 3105269579UL, 4044127396UL, 2341347785UL, 3185912634UL, 293292961UL, 1811276320UL, 1083136897UL, 825098089UL, 116883339UL, 2165628367UL, 4140133899UL, 2402926185UL, 4124720284UL, 4099344218UL, 1769871204UL, 721625457UL, 567446962UL, 3598160577UL, 1218419978UL, +4163520111UL, 2316975723UL, 4268269680UL, 923374392UL, 237254804UL, 3827063239UL, 3483118065UL, 760366769UL, 2263405553UL, 1020639813UL, 2131401627UL, 4167855065UL, 410255606UL, 3382265961UL, 1887858126UL, 1599293552UL, 2389387938UL, 3721625360UL, 3440586186UL, 2096265248UL, 1834631738UL, 1585275126UL, 3879559071UL, 711626863UL, 3267338158UL, 4095227658UL, 589002062UL, 137665950UL, 1190761134UL, 3823062902UL, 3566494128UL, 3914066872UL, +3233332246UL, 3844456625UL, 3240858503UL, 1081015168UL, 4148374722UL, 1683880703UL, 589447946UL, 4034899335UL, 733926790UL, 3520260556UL, 3643143173UL, 3202263729UL, 2130442867UL, 3472026294UL, 3518018860UL, 2319507998UL, 3458685425UL, 253769320UL, 1294634949UL, 3977318486UL, 3068540117UL, 702365700UL, 3100107703UL, 1988900647UL, 2936479173UL, 2348744493UL, 969926974UL, 477065277UL, 3746094733UL, 214260739UL, 3493892012UL, 2890740482UL, +52055911UL, 952871363UL, 1216985499UL, 2706067772UL, 1079370138UL, 2820619262UL, 1260334069UL, 2420035836UL, 311831945UL, 701108525UL, 2066128794UL, 3590716427UL, 537257045UL, 3153762469UL, 2900214585UL, 2261931254UL, 3644831936UL, 3243426619UL, 783551642UL, 3143067452UL, 3937339872UL, 3164955857UL, 4082645339UL, 1633544228UL, 1680728882UL, 3304461891UL, 204979344UL, 1674764841UL, 633231391UL, 689425572UL, 2649553051UL, 2534954734UL, +4252100558UL, 2993632630UL, 865432399UL, 3777379050UL, 1502035091UL, 302442688UL, 493504779UL, 1282312650UL, 1795212504UL, 1507727159UL, 672678623UL, 4046722895UL, 976003271UL, 2810951967UL, 441159654UL, 832039862UL, 2252252769UL, 726554843UL, 3317253399UL, 645344032UL, 2921087914UL, 2264738834UL, 1325395107UL, 1431934790UL, 737962654UL, 2859693559UL, 2784310535UL, 3876486226UL, 555655767UL, 3321631011UL, 641506549UL, 2652806878UL, +3848380198UL, 1837415425UL, 984807024UL, 1545504510UL, 1985586093UL, 3711682090UL, 2274320195UL, 127488455UL, 2254755902UL, 3789154730UL, 1595223697UL, 3812459919UL, 2160330513UL, 1888041043UL, 3105269579UL, 2773455385UL, 2341347785UL, 3185912634UL, 293292961UL, 1811276320UL, 3280464626UL, 825098089UL, 116883339UL, 2165628367UL, 4140133899UL, 3092114881UL, 4124720284UL, 4099344218UL, 1769871204UL, 721625457UL, 1514083147UL, 3598160577UL, +1218419978UL, 4163520111UL, 2316975723UL, 200993429UL, 923374392UL, 237254804UL, 3827063239UL, 3483118065UL, 677187089UL, 2263405553UL, 1020639813UL, 2131401627UL, 4167855065UL, 1892382552UL, 3382265961UL, 1887858126UL, 1599293552UL, 2389387938UL, 4153928364UL, 3440586186UL, 2096265248UL, 1834631738UL, 1585275126UL, 3348317504UL, 711626863UL, 3267338158UL, 4095227658UL, 589002062UL, 3125839176UL, 1190761134UL, 3823062902UL, 3566494128UL, +3914066872UL, 1320578396UL, 3844456625UL, 3240858503UL, 1081015168UL, 4148374722UL, 258762412UL, 589447946UL, 4034899335UL, 733926790UL, 3520260556UL, 4290301810UL, 3202263729UL, 2130442867UL, 3472026294UL, 3518018860UL, 2904238635UL, 3458685425UL, 253769320UL, 1294634949UL, 3977318486UL, 2517006218UL, 702365700UL, 3100107703UL, 1988900647UL, 2936479173UL, 3227096174UL, 969926974UL, 477065277UL, 3746094733UL, 214260739UL, 3868449115UL, +2890740482UL, 52055911UL, 952871363UL, 1216985499UL, 2857823043UL, 1079370138UL, 2820619262UL, 1260334069UL, 2420035836UL, 1843837226UL, 701108525UL, 2066128794UL, 3590716427UL, 537257045UL, 1202524172UL, 2900214585UL, 2261931254UL, 3644831936UL, 3243426619UL, 2113758468UL, 3143067452UL, 3937339872UL, 3164955857UL, 4082645339UL, 3987431298UL, 1680728882UL, 3304461891UL, 204979344UL, 1674764841UL, 2684386058UL, 689425572UL, 2649553051UL, +2534954734UL, 4252100558UL, 3511996574UL, 865432399UL, 3777379050UL, 1502035091UL, 302442688UL, 970989610UL, 1282312650UL, 1795212504UL, 1507727159UL, 672678623UL, 3080995547UL, 976003271UL, 2810951967UL, 441159654UL, 832039862UL, 2670291295UL, 726554843UL, 3317253399UL, 645344032UL, 2921087914UL, 3039207936UL, 1325395107UL, 1431934790UL, 737962654UL, 2859693559UL, 2452474228UL, 3876486226UL, 555655767UL, 3321631011UL, 641506549UL, +712394572UL, 931322445UL, 3691485988UL, 77755644UL, 3585967569UL, 1546642657UL, 1074481665UL, 1211742891UL, 2405208503UL, 1015438825UL, 3187019083UL, 2194891243UL, 1305917012UL, 3737279586UL, 2633137983UL, 1924729261UL, 72781059UL, 1412697099UL, 3828782214UL, 1637665425UL, 4170514983UL, 2248277352UL, 3793164712UL, 2365683667UL, 1287488796UL, 3240061130UL, 2411573225UL, 3237771995UL, 901649504UL, 4107276625UL, 1613775409UL, 741888560UL, +332459303UL, 850991886UL, 3249391248UL, 3550484151UL, 3689717953UL, 233288631UL, 2496730550UL, 3221264250UL, 3172144573UL, 1429937065UL, 1776357872UL, 1084763904UL, 1993209913UL, 4142869218UL, 3130780078UL, 18180577UL, 2819625557UL, 1978393449UL, 372704074UL, 3919523286UL, 1777756963UL, 188652529UL, 411213996UL, 62282979UL, 3775037518UL, 2534579861UL, 2966280971UL, 3863833471UL, 3228893189UL, 3123894696UL, 362579125UL, 1232030882UL, +575379775UL, 1019196436UL, 1914161190UL, 3649246842UL, 2192095564UL, 2368224476UL, 138396720UL, 1299868479UL, 507152626UL, 2129033575UL, 3801624222UL, 623352301UL, 1551535796UL, 3848329776UL, 2727905150UL, 1109499603UL, 3222756581UL, 3914846131UL, 3207366497UL, 3216028717UL, 3712661572UL, 1970542UL, 1320230637UL, 2583706801UL, 1341029904UL, 1903168049UL, 1244252579UL, 1885511879UL, 2426625042UL, 3082846847UL, 3858784104UL, 2263210027UL, +130350645UL, 956540733UL, 776729371UL, 2266749094UL, 2220603773UL, 2556170531UL, 263980324UL, 802194348UL, 697108594UL, 3634984969UL, 4251738712UL, 1831444758UL, 1209156358UL, 3089957258UL, 4195548426UL, 3641578987UL, 990686800UL, 2391278490UL, 2233755358UL, 1739784005UL, 2458544650UL, 340925249UL, 2442887806UL, 3503407512UL, 3058778909UL, 3619026333UL, 2289286518UL, 1296212011UL, 3879317178UL, 1210295163UL, 3113210467UL, 1578990986UL, +641384071UL, 2437977832UL, 1689385197UL, 1323268226UL, 861337916UL, 3532905860UL, 3735971843UL, 2294673483UL, 1032787575UL, 1868992735UL, 4260308791UL, 2091311463UL, 2354047234UL, 1005300697UL, 29821726UL, 2790044161UL, 3154591207UL, 1370229266UL, 3464848205UL, 3855301526UL, 544374401UL, 101012897UL, 4214903025UL, 1310520049UL, 14884434UL, 1438288148UL, 2118574986UL, 2360002070UL, 512167778UL, 4186534704UL, 3633828199UL, 493600836UL, +}, +{ +2932801042UL, 4101748508UL, 3363559072UL, 1213475638UL, 2400369070UL, 1726749444UL, 3175844814UL, 2600020277UL, 3779799804UL, 1886667522UL, 1228105891UL, 589138388UL, 3960459504UL, 450669757UL, 3773736740UL, 2107201112UL, 1437834675UL, 3618095315UL, 3662453347UL, 968349971UL, 1891706458UL, 2333451375UL, 4242907074UL, 3265111057UL, 3648168902UL, 4137035018UL, 105573058UL, 2075999861UL, 1053920954UL, 3768713177UL, 1836088599UL, 2015103258UL, +2649187541UL, 2717894301UL, 534937136UL, 3492326400UL, 2406499346UL, 617315838UL, 1384748442UL, 519804615UL, 524657043UL, 832148261UL, 156272480UL, 394759604UL, 2428809631UL, 3401589884UL, 2588359262UL, 3826333418UL, 2427993050UL, 3254067543UL, 2570694144UL, 2876613091UL, 2883884893UL, 613070434UL, 1599903665UL, 3476967713UL, 1729385632UL, 207879231UL, 1256308247UL, 2538975486UL, 2550001448UL, 1820975095UL, 915640692UL, 1633749116UL, +1294669585UL, 3257901643UL, 3193347552UL, 3369630539UL, 285165240UL, 2337727802UL, 1854640523UL, 1034379307UL, 1206304638UL, 889104297UL, 3084078942UL, 3485609519UL, 3903898589UL, 4274630316UL, 3290195566UL, 2071163950UL, 775170461UL, 551343738UL, 164916146UL, 1678786363UL, 123960948UL, 2721608023UL, 3463122611UL, 1525791510UL, 1531697627UL, 1457848578UL, 665433501UL, 1784274031UL, 3436850186UL, 3976095421UL, 383031580UL, 2146948399UL, +3137780800UL, 410458873UL, 381977170UL, 4264728702UL, 1515223147UL, 3358033956UL, 139804933UL, 438534588UL, 901342240UL, 1536972976UL, 184570377UL, 681864510UL, 844333847UL, 2515362910UL, 917461167UL, 2538721219UL, 4268394152UL, 680292330UL, 3420438710UL, 3784725677UL, 1983802086UL, 4165891809UL, 2369490764UL, 3808530114UL, 3391499460UL, 2509287180UL, 970129219UL, 2492785859UL, 3611863290UL, 1303524794UL, 2991964551UL, 1828774928UL, +3950385781UL, 3251583775UL, 14901408UL, 1890180396UL, 1306701779UL, 3161784071UL, 637842485UL, 2830070006UL, 3867491336UL, 1594948357UL, 2579795132UL, 479188700UL, 806498245UL, 3905876458UL, 3499065005UL, 3168076042UL, 769094339UL, 3769363696UL, 1241457026UL, 1073618847UL, 251335726UL, 2574341631UL, 2534047421UL, 3151952274UL, 534046859UL, 3264754113UL, 1325368288UL, 2131927230UL, 3229420672UL, 336348290UL, 3768781638UL, 2593952436UL, +849969290UL, 2932801042UL, 4101748508UL, 3363559072UL, 1213475638UL, 1710895496UL, 1726749444UL, 3175844814UL, 2600020277UL, 3779799804UL, 4044580435UL, 1228105891UL, 589138388UL, 3960459504UL, 450669757UL, 4253882965UL, 2107201112UL, 1437834675UL, 3618095315UL, 3662453347UL, 3625360228UL, 1891706458UL, 2333451375UL, 4242907074UL, 3265111057UL, 3638586625UL, 4137035018UL, 105573058UL, 2075999861UL, 1053920954UL, 3014895241UL, 1836088599UL, +2015103258UL, 2649187541UL, 2717894301UL, 701652515UL, 3492326400UL, 2406499346UL, 617315838UL, 1384748442UL, 1142040801UL, 524657043UL, 832148261UL, 156272480UL, 394759604UL, 944890908UL, 3401589884UL, 2588359262UL, 3826333418UL, 2427993050UL, 337891051UL, 2570694144UL, 2876613091UL, 2883884893UL, 613070434UL, 659063916UL, 3476967713UL, 1729385632UL, 207879231UL, 1256308247UL, 311608860UL, 2550001448UL, 1820975095UL, 915640692UL, +1633749116UL, 1772334285UL, 3257901643UL, 3193347552UL, 3369630539UL, 285165240UL, 2627441892UL, 1854640523UL, 1034379307UL, 1206304638UL, 889104297UL, 2289660031UL, 3485609519UL, 3903898589UL, 4274630316UL, 3290195566UL, 3572160580UL, 775170461UL, 551343738UL, 164916146UL, 1678786363UL, 3109616684UL, 2721608023UL, 3463122611UL, 1525791510UL, 1531697627UL, 3660976089UL, 665433501UL, 1784274031UL, 3436850186UL, 3976095421UL, 1696775162UL, +2146948399UL, 3137780800UL, 410458873UL, 381977170UL, 1669455215UL, 1515223147UL, 3358033956UL, 139804933UL, 438534588UL, 1738237971UL, 1536972976UL, 184570377UL, 681864510UL, 844333847UL, 770765754UL, 917461167UL, 2538721219UL, 4268394152UL, 680292330UL, 1993152157UL, 3784725677UL, 1983802086UL, 4165891809UL, 2369490764UL, 3411542022UL, 3391499460UL, 2509287180UL, 970129219UL, 2492785859UL, 1869391890UL, 1303524794UL, 2991964551UL, +1828774928UL, 3950385781UL, 4139486157UL, 14901408UL, 1890180396UL, 1306701779UL, 3161784071UL, 174545194UL, 2830070006UL, 3867491336UL, 1594948357UL, 2579795132UL, 4132973523UL, 806498245UL, 3905876458UL, 3499065005UL, 3168076042UL, 538076966UL, 3769363696UL, 1241457026UL, 1073618847UL, 251335726UL, 2085586137UL, 2534047421UL, 3151952274UL, 534046859UL, 3264754113UL, 643987981UL, 2131927230UL, 3229420672UL, 336348290UL, 3768781638UL, +3468816701UL, 849969290UL, 2932801042UL, 4101748508UL, 3363559072UL, 2524943673UL, 1710895496UL, 1726749444UL, 3175844814UL, 2600020277UL, 3677241699UL, 4044580435UL, 1228105891UL, 589138388UL, 3960459504UL, 3903077887UL, 4253882965UL, 2107201112UL, 1437834675UL, 3618095315UL, 2362822379UL, 3625360228UL, 1891706458UL, 2333451375UL, 4242907074UL, 2289503940UL, 3638586625UL, 4137035018UL, 105573058UL, 2075999861UL, 1299938293UL, 3014895241UL, +1836088599UL, 2015103258UL, 2649187541UL, 3727003343UL, 701652515UL, 3492326400UL, 2406499346UL, 617315838UL, 1627975589UL, 1142040801UL, 524657043UL, 832148261UL, 156272480UL, 3658645823UL, 944890908UL, 3401589884UL, 2588359262UL, 3826333418UL, 3645806126UL, 337891051UL, 2570694144UL, 2876613091UL, 2883884893UL, 2866570997UL, 659063916UL, 3476967713UL, 1729385632UL, 207879231UL, 298556768UL, 311608860UL, 2550001448UL, 1820975095UL, +915640692UL, 1014996737UL, 1772334285UL, 3257901643UL, 3193347552UL, 3369630539UL, 96395889UL, 2627441892UL, 1854640523UL, 1034379307UL, 1206304638UL, 2546521293UL, 2289660031UL, 3485609519UL, 3903898589UL, 4274630316UL, 2360048518UL, 3572160580UL, 775170461UL, 551343738UL, 164916146UL, 2068601014UL, 3109616684UL, 2721608023UL, 3463122611UL, 1525791510UL, 1228011534UL, 3660976089UL, 665433501UL, 1784274031UL, 3436850186UL, 1620580129UL, +1696775162UL, 2146948399UL, 3137780800UL, 410458873UL, 2753059283UL, 1669455215UL, 1515223147UL, 3358033956UL, 139804933UL, 2786429190UL, 1738237971UL, 1536972976UL, 184570377UL, 681864510UL, 358796749UL, 770765754UL, 917461167UL, 2538721219UL, 4268394152UL, 2355846025UL, 1993152157UL, 3784725677UL, 1983802086UL, 4165891809UL, 360259050UL, 3411542022UL, 3391499460UL, 2509287180UL, 970129219UL, 4055494275UL, 1869391890UL, 1303524794UL, +2991964551UL, 1828774928UL, 3508750618UL, 4139486157UL, 14901408UL, 1890180396UL, 1306701779UL, 3684762156UL, 174545194UL, 2830070006UL, 3867491336UL, 1594948357UL, 702781070UL, 4132973523UL, 806498245UL, 3905876458UL, 3499065005UL, 1372989388UL, 538076966UL, 3769363696UL, 1241457026UL, 1073618847UL, 3579114424UL, 2085586137UL, 2534047421UL, 3151952274UL, 534046859UL, 1882037168UL, 643987981UL, 2131927230UL, 3229420672UL, 336348290UL, +555833786UL, 3468816701UL, 849969290UL, 2932801042UL, 4101748508UL, 1095934625UL, 2524943673UL, 1710895496UL, 1726749444UL, 3175844814UL, 2287140069UL, 3677241699UL, 4044580435UL, 1228105891UL, 589138388UL, 1596938176UL, 3903077887UL, 4253882965UL, 2107201112UL, 1437834675UL, 2605388022UL, 2362822379UL, 3625360228UL, 1891706458UL, 2333451375UL, 174003035UL, 2289503940UL, 3638586625UL, 4137035018UL, 105573058UL, 697023108UL, 1299938293UL, +3014895241UL, 1836088599UL, 2015103258UL, 4128339205UL, 3727003343UL, 701652515UL, 3492326400UL, 2406499346UL, 426422678UL, 1627975589UL, 1142040801UL, 524657043UL, 832148261UL, 2461054373UL, 3658645823UL, 944890908UL, 3401589884UL, 2588359262UL, 3184255074UL, 3645806126UL, 337891051UL, 2570694144UL, 2876613091UL, 187151044UL, 2866570997UL, 659063916UL, 3476967713UL, 1729385632UL, 2811989057UL, 298556768UL, 311608860UL, 2550001448UL, +1820975095UL, 1806779934UL, 1014996737UL, 1772334285UL, 3257901643UL, 3193347552UL, 2145947779UL, 96395889UL, 2627441892UL, 1854640523UL, 1034379307UL, 2748996070UL, 2546521293UL, 2289660031UL, 3485609519UL, 3903898589UL, 452746826UL, 2360048518UL, 3572160580UL, 775170461UL, 551343738UL, 669098691UL, 2068601014UL, 3109616684UL, 2721608023UL, 3463122611UL, 22889155UL, 1228011534UL, 3660976089UL, 665433501UL, 1784274031UL, 227705324UL, +1620580129UL, 1696775162UL, 2146948399UL, 3137780800UL, 4267814323UL, 2753059283UL, 1669455215UL, 1515223147UL, 3358033956UL, 2806778033UL, 2786429190UL, 1738237971UL, 1536972976UL, 184570377UL, 3310279262UL, 358796749UL, 770765754UL, 917461167UL, 2538721219UL, 2247224091UL, 2355846025UL, 1993152157UL, 3784725677UL, 1983802086UL, 2399541755UL, 360259050UL, 3411542022UL, 3391499460UL, 2509287180UL, 2335541531UL, 4055494275UL, 1869391890UL, +1303524794UL, 2991964551UL, 392724462UL, 3508750618UL, 4139486157UL, 14901408UL, 1890180396UL, 2513331299UL, 3684762156UL, 174545194UL, 2830070006UL, 3867491336UL, 1887131931UL, 702781070UL, 4132973523UL, 806498245UL, 3905876458UL, 2263606492UL, 1372989388UL, 538076966UL, 3769363696UL, 1241457026UL, 170472774UL, 3579114424UL, 2085586137UL, 2534047421UL, 3151952274UL, 1488165272UL, 1882037168UL, 643987981UL, 2131927230UL, 3229420672UL, +1158405862UL, 1469009373UL, 4117356830UL, 4063868500UL, 2006417445UL, 2976934394UL, 2683607933UL, 3174943272UL, 2099974138UL, 2250858961UL, 205251124UL, 84783688UL, 1551294676UL, 224349432UL, 1893741756UL, 3680361724UL, 561624088UL, 251553631UL, 1654870642UL, 2195380145UL, 866503297UL, 1814519294UL, 905566144UL, 727763043UL, 1910034093UL, 1876316198UL, 3031876716UL, 2783769690UL, 2649650479UL, 2024342098UL, 2170858649UL, 2186613759UL, +2688207487UL, 881594599UL, 1010953695UL, 2768977700UL, 3341020856UL, 2446339960UL, 2648757147UL, 1317083878UL, 3301541769UL, 3574285525UL, 3331294407UL, 712581268UL, 3612116700UL, 3510601489UL, 2569879282UL, 3772968052UL, 332485239UL, 280920979UL, 716834274UL, 1863623285UL, 654670865UL, 1706917935UL, 1598315563UL, 2486805657UL, 2295746319UL, 635609792UL, 55141757UL, 4089183045UL, 145257162UL, 1921789879UL, 2833550514UL, 3798992859UL, +1532875864UL, 3668053062UL, 2749191097UL, 3412220447UL, 3383752088UL, 3191842833UL, 4167387125UL, 2438940746UL, 1453011669UL, 2747298308UL, 1057877757UL, 399006034UL, 132680506UL, 31671249UL, 1070386969UL, 2415113777UL, 3720335676UL, 3416473189UL, 1476808053UL, 785398955UL, 3335661823UL, 315496929UL, 1421907623UL, 1802371914UL, 3049258946UL, 1773374729UL, 382902076UL, 3262814446UL, 1774244917UL, 4064677234UL, 2281551331UL, 3019541390UL, +2445483046UL, 3059154103UL, 2147309319UL, 566587847UL, 216051987UL, 521013398UL, 2721884570UL, 3325443529UL, 1921922591UL, 1643064709UL, 1155714395UL, 1737031844UL, 2117338012UL, 1876262536UL, 3589621009UL, 3800806613UL, 1102108318UL, 1376914700UL, 539544394UL, 799741508UL, 1192097712UL, 2894663754UL, 567276527UL, 106814343UL, 3985577014UL, 422246623UL, 126568764UL, 4008211389UL, 4037889581UL, 2185357423UL, 2239644921UL, 2116447019UL, +1249715620UL, 2095747493UL, 4063243162UL, 3059330950UL, 1045571624UL, 1150656233UL, 3024439196UL, 3981904623UL, 1743764595UL, 4220253496UL, 3322182853UL, 2132911849UL, 2074342674UL, 198749193UL, 574306951UL, 3563262292UL, 3832626833UL, 2349475213UL, 182567249UL, 1530390173UL, 2066055611UL, 2609802571UL, 1392638962UL, 1495846580UL, 2356952332UL, 4029921749UL, 1731839848UL, 527880959UL, 1204112231UL, 938004695UL, 294300378UL, 1855457892UL, +}, +{ +1438083560UL, 1727969469UL, 703174449UL, 1296281193UL, 1386452240UL, 3304170302UL, 3048300096UL, 277697908UL, 2675939661UL, 3382564518UL, 1639425457UL, 2210719281UL, 3173605115UL, 1685375802UL, 1317820682UL, 1960916541UL, 4230888182UL, 1924357010UL, 3322827982UL, 1663716994UL, 976583570UL, 4146230815UL, 525755678UL, 3608894680UL, 1715438458UL, 1519478303UL, 2845291872UL, 1115405802UL, 2468673244UL, 2289739992UL, 46988928UL, 2559411080UL, +2466723374UL, 2995303634UL, 3871022237UL, 1794652692UL, 2424766096UL, 2849910020UL, 978542234UL, 1667051478UL, 3393290740UL, 1508376445UL, 4090541488UL, 1314139749UL, 1271060027UL, 3272019878UL, 4032394060UL, 757805987UL, 619143288UL, 1165760536UL, 225099797UL, 871754591UL, 2065691940UL, 2016593817UL, 1705071529UL, 2559080067UL, 2048856253UL, 3217759224UL, 2691334730UL, 1576829868UL, 3356759591UL, 1570481357UL, 1097065360UL, 852561431UL, +3559721965UL, 1403648739UL, 1772347635UL, 1196457607UL, 462142253UL, 761176322UL, 2209893444UL, 217724244UL, 3356132814UL, 2838131962UL, 3571552868UL, 1197135963UL, 3239010986UL, 2612283238UL, 2606429155UL, 2194090162UL, 4256137634UL, 935551404UL, 3057660021UL, 866672836UL, 1119670384UL, 1757615349UL, 649402076UL, 2814108193UL, 3312658713UL, 2627947214UL, 2982267121UL, 486762785UL, 2746076238UL, 2134737126UL, 4106010468UL, 3151832629UL, +2419694200UL, 2803791741UL, 2100250718UL, 3171079849UL, 1874606681UL, 1884940331UL, 926257211UL, 1940082331UL, 1024435222UL, 609478334UL, 2501896844UL, 518643063UL, 4285619138UL, 1054300997UL, 4024681853UL, 2287236199UL, 2891891855UL, 1519666047UL, 1919500932UL, 3880316442UL, 1994336737UL, 1025147784UL, 3433493260UL, 1647319600UL, 3298872174UL, 3744513628UL, 2918990402UL, 2649193481UL, 234630674UL, 1963357481UL, 1118148435UL, 2658522312UL, +2563194501UL, 2238556876UL, 1210050812UL, 748709882UL, 3894824022UL, 2575692519UL, 436044710UL, 3465014792UL, 3686094502UL, 2963529475UL, 3251316066UL, 2834750227UL, 789471563UL, 853201732UL, 4119014483UL, 1312738151UL, 2018934495UL, 542908921UL, 732294449UL, 2519981401UL, 1663929229UL, 4041419972UL, 3038382188UL, 3182489020UL, 353453260UL, 4074472601UL, 1187952022UL, 2118553383UL, 1068338764UL, 3699144039UL, 3129056770UL, 1419222328UL, +2666827910UL, 1438083560UL, 1727969469UL, 703174449UL, 1296281193UL, 2134413940UL, 3304170302UL, 3048300096UL, 277697908UL, 2675939661UL, 3817858752UL, 1639425457UL, 2210719281UL, 3173605115UL, 1685375802UL, 2587083472UL, 1960916541UL, 4230888182UL, 1924357010UL, 3322827982UL, 2582901426UL, 976583570UL, 4146230815UL, 525755678UL, 3608894680UL, 524232549UL, 1519478303UL, 2845291872UL, 1115405802UL, 2468673244UL, 591800699UL, 46988928UL, +2559411080UL, 2466723374UL, 2995303634UL, 2307625850UL, 1794652692UL, 2424766096UL, 2849910020UL, 978542234UL, 1284927074UL, 3393290740UL, 1508376445UL, 4090541488UL, 1314139749UL, 3508281898UL, 3272019878UL, 4032394060UL, 757805987UL, 619143288UL, 1846615167UL, 225099797UL, 871754591UL, 2065691940UL, 2016593817UL, 1193455869UL, 2559080067UL, 2048856253UL, 3217759224UL, 2691334730UL, 2665708717UL, 3356759591UL, 1570481357UL, 1097065360UL, +852561431UL, 1652864273UL, 1403648739UL, 1772347635UL, 1196457607UL, 462142253UL, 1222855287UL, 2209893444UL, 217724244UL, 3356132814UL, 2838131962UL, 3060983219UL, 1197135963UL, 3239010986UL, 2612283238UL, 2606429155UL, 4171729370UL, 4256137634UL, 935551404UL, 3057660021UL, 866672836UL, 75618353UL, 1757615349UL, 649402076UL, 2814108193UL, 3312658713UL, 3975515213UL, 2982267121UL, 486762785UL, 2746076238UL, 2134737126UL, 3251020123UL, +3151832629UL, 2419694200UL, 2803791741UL, 2100250718UL, 624531676UL, 1874606681UL, 1884940331UL, 926257211UL, 1940082331UL, 3678479182UL, 609478334UL, 2501896844UL, 518643063UL, 4285619138UL, 1725899979UL, 4024681853UL, 2287236199UL, 2891891855UL, 1519666047UL, 702508101UL, 3880316442UL, 1994336737UL, 1025147784UL, 3433493260UL, 4212959134UL, 3298872174UL, 3744513628UL, 2918990402UL, 2649193481UL, 1782150764UL, 1963357481UL, 1118148435UL, +2658522312UL, 2563194501UL, 3330122355UL, 1210050812UL, 748709882UL, 3894824022UL, 2575692519UL, 637240921UL, 3465014792UL, 3686094502UL, 2963529475UL, 3251316066UL, 1510158901UL, 789471563UL, 853201732UL, 4119014483UL, 1312738151UL, 3018953017UL, 542908921UL, 732294449UL, 2519981401UL, 1663929229UL, 2696317636UL, 3038382188UL, 3182489020UL, 353453260UL, 4074472601UL, 4249950407UL, 2118553383UL, 1068338764UL, 3699144039UL, 3129056770UL, +2334590922UL, 2666827910UL, 1438083560UL, 1727969469UL, 703174449UL, 1679528518UL, 2134413940UL, 3304170302UL, 3048300096UL, 277697908UL, 3417107827UL, 3817858752UL, 1639425457UL, 2210719281UL, 3173605115UL, 1858788112UL, 2587083472UL, 1960916541UL, 4230888182UL, 1924357010UL, 3692988029UL, 2582901426UL, 976583570UL, 4146230815UL, 525755678UL, 1122319464UL, 524232549UL, 1519478303UL, 2845291872UL, 1115405802UL, 205855120UL, 591800699UL, +46988928UL, 2559411080UL, 2466723374UL, 3358512221UL, 2307625850UL, 1794652692UL, 2424766096UL, 2849910020UL, 2865273283UL, 1284927074UL, 3393290740UL, 1508376445UL, 4090541488UL, 2453941323UL, 3508281898UL, 3272019878UL, 4032394060UL, 757805987UL, 3191753865UL, 1846615167UL, 225099797UL, 871754591UL, 2065691940UL, 1301630578UL, 1193455869UL, 2559080067UL, 2048856253UL, 3217759224UL, 3858428004UL, 2665708717UL, 3356759591UL, 1570481357UL, +1097065360UL, 3550687085UL, 1652864273UL, 1403648739UL, 1772347635UL, 1196457607UL, 2158802672UL, 1222855287UL, 2209893444UL, 217724244UL, 3356132814UL, 1954043011UL, 3060983219UL, 1197135963UL, 3239010986UL, 2612283238UL, 2156334822UL, 4171729370UL, 4256137634UL, 935551404UL, 3057660021UL, 3331206175UL, 75618353UL, 1757615349UL, 649402076UL, 2814108193UL, 1313890357UL, 3975515213UL, 2982267121UL, 486762785UL, 2746076238UL, 2023213803UL, +3251020123UL, 3151832629UL, 2419694200UL, 2803791741UL, 392313450UL, 624531676UL, 1874606681UL, 1884940331UL, 926257211UL, 3369012310UL, 3678479182UL, 609478334UL, 2501896844UL, 518643063UL, 3638013610UL, 1725899979UL, 4024681853UL, 2287236199UL, 2891891855UL, 429282096UL, 702508101UL, 3880316442UL, 1994336737UL, 1025147784UL, 1217486411UL, 4212959134UL, 3298872174UL, 3744513628UL, 2918990402UL, 1279832521UL, 1782150764UL, 1963357481UL, +1118148435UL, 2658522312UL, 2379123622UL, 3330122355UL, 1210050812UL, 748709882UL, 3894824022UL, 3987054169UL, 637240921UL, 3465014792UL, 3686094502UL, 2963529475UL, 2167876400UL, 1510158901UL, 789471563UL, 853201732UL, 4119014483UL, 1746447311UL, 3018953017UL, 542908921UL, 732294449UL, 2519981401UL, 1908715414UL, 2696317636UL, 3038382188UL, 3182489020UL, 353453260UL, 2132930364UL, 4249950407UL, 2118553383UL, 1068338764UL, 3699144039UL, +433893434UL, 2334590922UL, 2666827910UL, 1438083560UL, 1727969469UL, 1154725669UL, 1679528518UL, 2134413940UL, 3304170302UL, 3048300096UL, 31944135UL, 3417107827UL, 3817858752UL, 1639425457UL, 2210719281UL, 4203237786UL, 1858788112UL, 2587083472UL, 1960916541UL, 4230888182UL, 2712081548UL, 3692988029UL, 2582901426UL, 976583570UL, 4146230815UL, 3948659885UL, 1122319464UL, 524232549UL, 1519478303UL, 2845291872UL, 2881616509UL, 205855120UL, +591800699UL, 46988928UL, 2559411080UL, 3645011109UL, 3358512221UL, 2307625850UL, 1794652692UL, 2424766096UL, 3667888476UL, 2865273283UL, 1284927074UL, 3393290740UL, 1508376445UL, 1605429636UL, 2453941323UL, 3508281898UL, 3272019878UL, 4032394060UL, 3904681057UL, 3191753865UL, 1846615167UL, 225099797UL, 871754591UL, 696516502UL, 1301630578UL, 1193455869UL, 2559080067UL, 2048856253UL, 2589248412UL, 3858428004UL, 2665708717UL, 3356759591UL, +1570481357UL, 1884333722UL, 3550687085UL, 1652864273UL, 1403648739UL, 1772347635UL, 3418430008UL, 2158802672UL, 1222855287UL, 2209893444UL, 217724244UL, 4164333189UL, 1954043011UL, 3060983219UL, 1197135963UL, 3239010986UL, 2300947859UL, 2156334822UL, 4171729370UL, 4256137634UL, 935551404UL, 1258856668UL, 3331206175UL, 75618353UL, 1757615349UL, 649402076UL, 772455867UL, 1313890357UL, 3975515213UL, 2982267121UL, 486762785UL, 3671941628UL, +2023213803UL, 3251020123UL, 3151832629UL, 2419694200UL, 4264015999UL, 392313450UL, 624531676UL, 1874606681UL, 1884940331UL, 2460787316UL, 3369012310UL, 3678479182UL, 609478334UL, 2501896844UL, 2131090271UL, 3638013610UL, 1725899979UL, 4024681853UL, 2287236199UL, 455349830UL, 429282096UL, 702508101UL, 3880316442UL, 1994336737UL, 1727894434UL, 1217486411UL, 4212959134UL, 3298872174UL, 3744513628UL, 1120563681UL, 1279832521UL, 1782150764UL, +1963357481UL, 1118148435UL, 3362151087UL, 2379123622UL, 3330122355UL, 1210050812UL, 748709882UL, 2506587900UL, 3987054169UL, 637240921UL, 3465014792UL, 3686094502UL, 1265652315UL, 2167876400UL, 1510158901UL, 789471563UL, 853201732UL, 3472479264UL, 1746447311UL, 3018953017UL, 542908921UL, 732294449UL, 659090240UL, 1908715414UL, 2696317636UL, 3038382188UL, 3182489020UL, 174113867UL, 2132930364UL, 4249950407UL, 2118553383UL, 1068338764UL, +4115132848UL, 1714842877UL, 1153237667UL, 1015943026UL, 2014412384UL, 2478393613UL, 1340079052UL, 167685322UL, 1848482402UL, 3252973254UL, 638064461UL, 1599254200UL, 2525050247UL, 2813349060UL, 2415037971UL, 3274852801UL, 3415369586UL, 3216396500UL, 3147792606UL, 438338168UL, 2326605175UL, 2846648724UL, 3871841623UL, 287840506UL, 3218295001UL, 2562000356UL, 574276928UL, 418096348UL, 1798854554UL, 1913561074UL, 2025706546UL, 41907788UL, +3535708035UL, 1240819558UL, 208810147UL, 4062740265UL, 451865782UL, 2652508890UL, 3579720859UL, 1243967909UL, 2191937647UL, 2473947838UL, 1847359263UL, 2496539569UL, 4061942257UL, 1372849161UL, 2016697844UL, 1827460131UL, 1135062647UL, 1255573479UL, 3506657283UL, 3699699807UL, 3087913374UL, 1196140869UL, 4095306490UL, 830793530UL, 1289366065UL, 3268392251UL, 4119035690UL, 1631012325UL, 3410799501UL, 1470209122UL, 3057922764UL, 2895379380UL, +2654121201UL, 1984999545UL, 2258412956UL, 4267137150UL, 3396740662UL, 2480013857UL, 3845856317UL, 3669454152UL, 2438423716UL, 3191341994UL, 1571280634UL, 1423782557UL, 3279999352UL, 1886288620UL, 205278284UL, 793062897UL, 112852083UL, 69164746UL, 2218046933UL, 4206182754UL, 3021072495UL, 2157753215UL, 2875773583UL, 1453706073UL, 168681204UL, 3905840714UL, 4098714445UL, 3410804508UL, 1737239929UL, 1613207828UL, 2987997090UL, 1869303136UL, +3348561687UL, 3391148819UL, 1680062950UL, 4150476788UL, 2340622122UL, 11331065UL, 2250669421UL, 3003852975UL, 2145739501UL, 1627177260UL, 994260425UL, 1479134620UL, 2315299915UL, 1268765340UL, 285960682UL, 3801150032UL, 3948820512UL, 1677682247UL, 1735541155UL, 1914753931UL, 1965156079UL, 1875233710UL, 681418791UL, 2077804400UL, 1963479724UL, 2447942398UL, 269798686UL, 2740088859UL, 1974178779UL, 3373487761UL, 2879779843UL, 157827737UL, +3855390825UL, 2779173093UL, 2359181541UL, 3508102362UL, 4001266348UL, 3949912729UL, 3232414439UL, 472195874UL, 57835121UL, 1854343116UL, 3020785997UL, 2024437594UL, 2182964208UL, 3379376555UL, 1213864603UL, 307833006UL, 1029130725UL, 545051507UL, 4001695571UL, 2258480284UL, 896286117UL, 355474524UL, 2514583184UL, 2997458384UL, 3278715462UL, 1675341954UL, 3603020014UL, 2318410671UL, 2152785892UL, 4285597912UL, 35655711UL, 2087100216UL, +}, +{ +1671155UL, 472949658UL, 148656515UL, 1640075411UL, 930771231UL, 1601854390UL, 471598090UL, 2013359012UL, 3708325970UL, 1688441844UL, 736452516UL, 100585026UL, 1154373750UL, 4029833741UL, 3409420465UL, 192349301UL, 3804215437UL, 909027311UL, 2896874106UL, 3567276364UL, 1319305666UL, 3858990362UL, 3155018279UL, 3756192170UL, 3567813642UL, 228734829UL, 577956164UL, 2078807284UL, 1005987081UL, 1464380935UL, 112604551UL, 3865074232UL, +3776350052UL, 1112767766UL, 2947509331UL, 910887552UL, 4127297396UL, 851240323UL, 3136588838UL, 1639013085UL, 1154068086UL, 639126620UL, 2501600773UL, 3174842042UL, 3456593672UL, 80596481UL, 126970446UL, 2184239961UL, 1448001095UL, 689252599UL, 1087028487UL, 2905348107UL, 2502009404UL, 2156595397UL, 2149975474UL, 2201723284UL, 3908202640UL, 754508313UL, 2321393187UL, 787043244UL, 2575809693UL, 4172462501UL, 2322897687UL, 1899992264UL, +1854136781UL, 3575249683UL, 2939319477UL, 901605762UL, 676398674UL, 2849283587UL, 2992300101UL, 1513271778UL, 2797164148UL, 1914019034UL, 1889341710UL, 2739211008UL, 1954453463UL, 3279391005UL, 2899313529UL, 1412533980UL, 1291505093UL, 2884603001UL, 564097935UL, 3552741248UL, 2809901827UL, 1263126330UL, 860214490UL, 2168366043UL, 2681035029UL, 3226888214UL, 2902522885UL, 554804421UL, 1571065517UL, 3322453053UL, 4144256215UL, 126415290UL, +980853251UL, 1531963815UL, 3237470129UL, 1465444883UL, 2031491001UL, 2205009469UL, 1046577915UL, 828927962UL, 2170245718UL, 1090142292UL, 1667375106UL, 2522840205UL, 4047872402UL, 3862734726UL, 91588630UL, 3122782857UL, 929883614UL, 694999008UL, 1472139068UL, 1246663706UL, 3500613893UL, 4200173807UL, 186199942UL, 3890621040UL, 229752655UL, 1011692880UL, 2791828564UL, 2677625011UL, 791005643UL, 1754509337UL, 2321492983UL, 3512328605UL, +1294405891UL, 2845189858UL, 434175992UL, 3155484007UL, 2306406482UL, 3197931140UL, 22971924UL, 1521633702UL, 2366802562UL, 399245037UL, 2833224222UL, 2507478835UL, 3231711673UL, 3784114896UL, 1927919696UL, 783802899UL, 3408133710UL, 2278711709UL, 3001078924UL, 1223320630UL, 3246830042UL, 943189685UL, 4062534962UL, 1039971013UL, 2342241593UL, 3551623946UL, 322017346UL, 3585779636UL, 81127429UL, 3549929990UL, 2886997195UL, 1746081951UL, +4169018554UL, 1671155UL, 472949658UL, 148656515UL, 1640075411UL, 3772042754UL, 1601854390UL, 471598090UL, 2013359012UL, 3708325970UL, 321630853UL, 736452516UL, 100585026UL, 1154373750UL, 4029833741UL, 1926754199UL, 192349301UL, 3804215437UL, 909027311UL, 2896874106UL, 1138131968UL, 1319305666UL, 3858990362UL, 3155018279UL, 3756192170UL, 2489094664UL, 228734829UL, 577956164UL, 2078807284UL, 1005987081UL, 2678967510UL, 112604551UL, +3865074232UL, 3776350052UL, 1112767766UL, 626049886UL, 910887552UL, 4127297396UL, 851240323UL, 3136588838UL, 2142891352UL, 1154068086UL, 639126620UL, 2501600773UL, 3174842042UL, 3342870442UL, 80596481UL, 126970446UL, 2184239961UL, 1448001095UL, 3399719246UL, 1087028487UL, 2905348107UL, 2502009404UL, 2156595397UL, 14860817UL, 2201723284UL, 3908202640UL, 754508313UL, 2321393187UL, 90540547UL, 2575809693UL, 4172462501UL, 2322897687UL, +1899992264UL, 56239065UL, 3575249683UL, 2939319477UL, 901605762UL, 676398674UL, 412461711UL, 2992300101UL, 1513271778UL, 2797164148UL, 1914019034UL, 3660190396UL, 2739211008UL, 1954453463UL, 3279391005UL, 2899313529UL, 4193503742UL, 1291505093UL, 2884603001UL, 564097935UL, 3552741248UL, 2124229268UL, 1263126330UL, 860214490UL, 2168366043UL, 2681035029UL, 4086980935UL, 2902522885UL, 554804421UL, 1571065517UL, 3322453053UL, 1821678887UL, +126415290UL, 980853251UL, 1531963815UL, 3237470129UL, 2099629264UL, 2031491001UL, 2205009469UL, 1046577915UL, 828927962UL, 3447807375UL, 1090142292UL, 1667375106UL, 2522840205UL, 4047872402UL, 2255362927UL, 91588630UL, 3122782857UL, 929883614UL, 694999008UL, 4135967848UL, 1246663706UL, 3500613893UL, 4200173807UL, 186199942UL, 4182379872UL, 229752655UL, 1011692880UL, 2791828564UL, 2677625011UL, 397062412UL, 1754509337UL, 2321492983UL, +3512328605UL, 1294405891UL, 1028843071UL, 434175992UL, 3155484007UL, 2306406482UL, 3197931140UL, 3217107401UL, 1521633702UL, 2366802562UL, 399245037UL, 2833224222UL, 76017436UL, 3231711673UL, 3784114896UL, 1927919696UL, 783802899UL, 2157090897UL, 2278711709UL, 3001078924UL, 1223320630UL, 3246830042UL, 1197195551UL, 4062534962UL, 1039971013UL, 2342241593UL, 3551623946UL, 63853850UL, 3585779636UL, 81127429UL, 3549929990UL, 2886997195UL, +1335910186UL, 4169018554UL, 1671155UL, 472949658UL, 148656515UL, 3600963048UL, 3772042754UL, 1601854390UL, 471598090UL, 2013359012UL, 1181513377UL, 321630853UL, 736452516UL, 100585026UL, 1154373750UL, 2323956092UL, 1926754199UL, 192349301UL, 3804215437UL, 909027311UL, 2993842723UL, 1138131968UL, 1319305666UL, 3858990362UL, 3155018279UL, 2288945270UL, 2489094664UL, 228734829UL, 577956164UL, 2078807284UL, 1924581773UL, 2678967510UL, +112604551UL, 3865074232UL, 3776350052UL, 2127459222UL, 626049886UL, 910887552UL, 4127297396UL, 851240323UL, 547797457UL, 2142891352UL, 1154068086UL, 639126620UL, 2501600773UL, 2391654498UL, 3342870442UL, 80596481UL, 126970446UL, 2184239961UL, 824575673UL, 3399719246UL, 1087028487UL, 2905348107UL, 2502009404UL, 740197255UL, 14860817UL, 2201723284UL, 3908202640UL, 754508313UL, 4133980283UL, 90540547UL, 2575809693UL, 4172462501UL, +2322897687UL, 831222037UL, 56239065UL, 3575249683UL, 2939319477UL, 901605762UL, 1998632674UL, 412461711UL, 2992300101UL, 1513271778UL, 2797164148UL, 969149327UL, 3660190396UL, 2739211008UL, 1954453463UL, 3279391005UL, 1267183547UL, 4193503742UL, 1291505093UL, 2884603001UL, 564097935UL, 3378471970UL, 2124229268UL, 1263126330UL, 860214490UL, 2168366043UL, 867190357UL, 4086980935UL, 2902522885UL, 554804421UL, 1571065517UL, 497580674UL, +1821678887UL, 126415290UL, 980853251UL, 1531963815UL, 2259090956UL, 2099629264UL, 2031491001UL, 2205009469UL, 1046577915UL, 30458798UL, 3447807375UL, 1090142292UL, 1667375106UL, 2522840205UL, 748518306UL, 2255362927UL, 91588630UL, 3122782857UL, 929883614UL, 1016302700UL, 4135967848UL, 1246663706UL, 3500613893UL, 4200173807UL, 4149573092UL, 4182379872UL, 229752655UL, 1011692880UL, 2791828564UL, 2890696349UL, 397062412UL, 1754509337UL, +2321492983UL, 3512328605UL, 3005148093UL, 1028843071UL, 434175992UL, 3155484007UL, 2306406482UL, 1417194283UL, 3217107401UL, 1521633702UL, 2366802562UL, 399245037UL, 665389310UL, 76017436UL, 3231711673UL, 3784114896UL, 1927919696UL, 37004463UL, 2157090897UL, 2278711709UL, 3001078924UL, 1223320630UL, 1281902891UL, 1197195551UL, 4062534962UL, 1039971013UL, 2342241593UL, 836721481UL, 63853850UL, 3585779636UL, 81127429UL, 3549929990UL, +2541553478UL, 1335910186UL, 4169018554UL, 1671155UL, 472949658UL, 2086411677UL, 3600963048UL, 3772042754UL, 1601854390UL, 471598090UL, 3297781744UL, 1181513377UL, 321630853UL, 736452516UL, 100585026UL, 2296508711UL, 2323956092UL, 1926754199UL, 192349301UL, 3804215437UL, 314399580UL, 2993842723UL, 1138131968UL, 1319305666UL, 3858990362UL, 584746730UL, 2288945270UL, 2489094664UL, 228734829UL, 577956164UL, 3868048239UL, 1924581773UL, +2678967510UL, 112604551UL, 3865074232UL, 2091950990UL, 2127459222UL, 626049886UL, 910887552UL, 4127297396UL, 2494071916UL, 547797457UL, 2142891352UL, 1154068086UL, 639126620UL, 1159991153UL, 2391654498UL, 3342870442UL, 80596481UL, 126970446UL, 2276453681UL, 824575673UL, 3399719246UL, 1087028487UL, 2905348107UL, 874278393UL, 740197255UL, 14860817UL, 2201723284UL, 3908202640UL, 1189317351UL, 4133980283UL, 90540547UL, 2575809693UL, +4172462501UL, 746169572UL, 831222037UL, 56239065UL, 3575249683UL, 2939319477UL, 4148988439UL, 1998632674UL, 412461711UL, 2992300101UL, 1513271778UL, 1078781767UL, 969149327UL, 3660190396UL, 2739211008UL, 1954453463UL, 369522045UL, 1267183547UL, 4193503742UL, 1291505093UL, 2884603001UL, 2820350438UL, 3378471970UL, 2124229268UL, 1263126330UL, 860214490UL, 793306335UL, 867190357UL, 4086980935UL, 2902522885UL, 554804421UL, 1472297125UL, +497580674UL, 1821678887UL, 126415290UL, 980853251UL, 1628231485UL, 2259090956UL, 2099629264UL, 2031491001UL, 2205009469UL, 2562996945UL, 30458798UL, 3447807375UL, 1090142292UL, 1667375106UL, 3513508401UL, 748518306UL, 2255362927UL, 91588630UL, 3122782857UL, 435869165UL, 1016302700UL, 4135967848UL, 1246663706UL, 3500613893UL, 4156110437UL, 4149573092UL, 4182379872UL, 229752655UL, 1011692880UL, 1150278253UL, 2890696349UL, 397062412UL, +1754509337UL, 2321492983UL, 1126835971UL, 3005148093UL, 1028843071UL, 434175992UL, 3155484007UL, 4169948411UL, 1417194283UL, 3217107401UL, 1521633702UL, 2366802562UL, 1629830655UL, 665389310UL, 76017436UL, 3231711673UL, 3784114896UL, 2523153991UL, 37004463UL, 2157090897UL, 2278711709UL, 3001078924UL, 3770048208UL, 1281902891UL, 1197195551UL, 4062534962UL, 1039971013UL, 2710590100UL, 836721481UL, 63853850UL, 3585779636UL, 81127429UL, +3850118466UL, 1883009417UL, 1027645619UL, 2766570701UL, 529436174UL, 4182542040UL, 2027954186UL, 1551970336UL, 2476537298UL, 1601343216UL, 3847258834UL, 14764974UL, 2173280370UL, 4148127270UL, 2818930089UL, 4238274314UL, 1291010651UL, 276452076UL, 192067464UL, 4086351393UL, 37573517UL, 48008720UL, 1641547972UL, 3144774960UL, 2159884108UL, 4260412239UL, 4072883650UL, 801704944UL, 2475958420UL, 2719220408UL, 555871884UL, 3338968445UL, +1704817873UL, 1960791083UL, 3785650808UL, 948722806UL, 3591229899UL, 1776225011UL, 4086658524UL, 2675451845UL, 308053697UL, 3514232055UL, 2575301108UL, 1970226110UL, 3926325352UL, 770275431UL, 1432667716UL, 671201644UL, 1008866625UL, 1151827040UL, 11061406UL, 3492749345UL, 2398090284UL, 2479688660UL, 2275263177UL, 2452696627UL, 3239880878UL, 3206200433UL, 1520851097UL, 1517432473UL, 1468198490UL, 1756343506UL, 2477348626UL, 3684701600UL, +3173720911UL, 1034531154UL, 4092116810UL, 3546516359UL, 2085136160UL, 643024588UL, 1462240654UL, 1877398196UL, 3615581878UL, 1419408410UL, 3581360976UL, 1731324772UL, 1377343320UL, 3848152825UL, 2213533588UL, 2484549569UL, 2043594863UL, 224490427UL, 1298974897UL, 4279011954UL, 3970331393UL, 3795364604UL, 285230552UL, 2893090686UL, 2399312639UL, 2638905215UL, 3481427245UL, 3477537504UL, 2609821731UL, 867675919UL, 3395750357UL, 1969593211UL, +2390932014UL, 3164333009UL, 3032345429UL, 3054196992UL, 1655295657UL, 193598641UL, 1267960637UL, 1599091894UL, 3377410805UL, 1529073346UL, 1949183620UL, 1575927573UL, 1493246650UL, 2285478895UL, 797817618UL, 1736047766UL, 1537439339UL, 1422940895UL, 2210817855UL, 2888194544UL, 800138109UL, 1689425315UL, 87966703UL, 3800446188UL, 137301285UL, 3334431104UL, 1776710491UL, 4010349050UL, 2577018472UL, 3083459223UL, 672158271UL, 3379478560UL, +2445459713UL, 918903140UL, 2577376693UL, 273150303UL, 2300393435UL, 3529750006UL, 3941920515UL, 2590879584UL, 2005940914UL, 2533952036UL, 2918638361UL, 1907638097UL, 959011520UL, 1477207871UL, 2141548481UL, 2065858781UL, 3145892196UL, 3679867589UL, 1295127682UL, 1325838381UL, 3482593404UL, 1212565985UL, 3404887017UL, 709111097UL, 1714185234UL, 561489165UL, 3545430079UL, 359778601UL, 3034684349UL, 2235482356UL, 2263913966UL, 1397371482UL, +}, +{ +170295791UL, 2753410803UL, 2200994594UL, 14686027UL, 3460333923UL, 1523230564UL, 393272614UL, 1632665034UL, 2139771608UL, 2436912103UL, 375335282UL, 667585308UL, 3651645415UL, 1403132103UL, 4146144245UL, 786890392UL, 1349234364UL, 1278024517UL, 84921263UL, 3758850381UL, 4213552796UL, 2355655048UL, 1636349912UL, 172797504UL, 2490691729UL, 1233059003UL, 2593048824UL, 942056581UL, 953415060UL, 4250104075UL, 787552244UL, 1995239637UL, +2482815609UL, 767530774UL, 773778243UL, 841396894UL, 2718419035UL, 3363828032UL, 737774143UL, 4128182656UL, 2335090807UL, 1421795969UL, 2322011430UL, 2808330380UL, 2207840656UL, 1646731611UL, 492284258UL, 2339383764UL, 3439685708UL, 2316859204UL, 4055048437UL, 1700143892UL, 2980557654UL, 1353917552UL, 548777318UL, 1077538998UL, 2650679367UL, 2853583947UL, 2721899692UL, 4253535213UL, 3375043688UL, 3489699354UL, 2401362855UL, 3391605246UL, +914273272UL, 3060460082UL, 1409014396UL, 3313834796UL, 461914731UL, 82334736UL, 3200344474UL, 2743316601UL, 842885927UL, 613943741UL, 96056919UL, 3116963503UL, 305659983UL, 132158360UL, 239064402UL, 849530381UL, 543215927UL, 4250983939UL, 2719881954UL, 1950301886UL, 2760008207UL, 853237881UL, 3875675156UL, 1753566841UL, 1446648300UL, 1663885236UL, 2155720472UL, 1902508987UL, 4246118829UL, 383661834UL, 2420221467UL, 156828838UL, +2919782856UL, 499968148UL, 2538550321UL, 65231340UL, 1589837081UL, 3654438263UL, 467304037UL, 1000159563UL, 622643461UL, 1410713407UL, 491953742UL, 1003597552UL, 1972701846UL, 1534343952UL, 1934888620UL, 4214562113UL, 4154375443UL, 3612899079UL, 2132948514UL, 2599819225UL, 2676649952UL, 3147375990UL, 533258319UL, 3323553423UL, 4203909276UL, 668602384UL, 3979162921UL, 2360530772UL, 162121513UL, 8968884UL, 3647746035UL, 2830313226UL, +1736955603UL, 78142012UL, 1643270604UL, 1571637938UL, 4065571991UL, 2071640825UL, 2715113082UL, 3826814783UL, 1067370024UL, 1810581550UL, 2354204343UL, 3798962263UL, 1664654967UL, 3740539785UL, 3746164996UL, 4280983219UL, 3313400832UL, 3305556349UL, 4226011346UL, 839676594UL, 1785445494UL, 1248107478UL, 904240268UL, 3484988721UL, 2290931247UL, 2109493967UL, 3895901626UL, 1494555863UL, 3251796061UL, 40877237UL, 2914051470UL, 2810210896UL, +1428826975UL, 170295791UL, 2753410803UL, 2200994594UL, 14686027UL, 3263438011UL, 1523230564UL, 393272614UL, 1632665034UL, 2139771608UL, 1847095655UL, 375335282UL, 667585308UL, 3651645415UL, 1403132103UL, 1888152231UL, 786890392UL, 1349234364UL, 1278024517UL, 84921263UL, 317409190UL, 4213552796UL, 2355655048UL, 1636349912UL, 172797504UL, 891435579UL, 1233059003UL, 2593048824UL, 942056581UL, 953415060UL, 1606837225UL, 787552244UL, +1995239637UL, 2482815609UL, 767530774UL, 723338833UL, 841396894UL, 2718419035UL, 3363828032UL, 737774143UL, 1043554448UL, 2335090807UL, 1421795969UL, 2322011430UL, 2808330380UL, 2754923978UL, 1646731611UL, 492284258UL, 2339383764UL, 3439685708UL, 3985616488UL, 4055048437UL, 1700143892UL, 2980557654UL, 1353917552UL, 588678041UL, 1077538998UL, 2650679367UL, 2853583947UL, 2721899692UL, 992549416UL, 3375043688UL, 3489699354UL, 2401362855UL, +3391605246UL, 2111206241UL, 3060460082UL, 1409014396UL, 3313834796UL, 461914731UL, 749987143UL, 3200344474UL, 2743316601UL, 842885927UL, 613943741UL, 1572013294UL, 3116963503UL, 305659983UL, 132158360UL, 239064402UL, 2802105766UL, 543215927UL, 4250983939UL, 2719881954UL, 1950301886UL, 1025784309UL, 853237881UL, 3875675156UL, 1753566841UL, 1446648300UL, 2265992307UL, 2155720472UL, 1902508987UL, 4246118829UL, 383661834UL, 1291267638UL, +156828838UL, 2919782856UL, 499968148UL, 2538550321UL, 2108151330UL, 1589837081UL, 3654438263UL, 467304037UL, 1000159563UL, 611554173UL, 1410713407UL, 491953742UL, 1003597552UL, 1972701846UL, 1548061756UL, 1934888620UL, 4214562113UL, 4154375443UL, 3612899079UL, 3599839935UL, 2599819225UL, 2676649952UL, 3147375990UL, 533258319UL, 4213499273UL, 4203909276UL, 668602384UL, 3979162921UL, 2360530772UL, 197252548UL, 8968884UL, 3647746035UL, +2830313226UL, 1736955603UL, 791687787UL, 1643270604UL, 1571637938UL, 4065571991UL, 2071640825UL, 2026290282UL, 3826814783UL, 1067370024UL, 1810581550UL, 2354204343UL, 2679791787UL, 1664654967UL, 3740539785UL, 3746164996UL, 4280983219UL, 1690075221UL, 3305556349UL, 4226011346UL, 839676594UL, 1785445494UL, 935893161UL, 904240268UL, 3484988721UL, 2290931247UL, 2109493967UL, 1497667362UL, 1494555863UL, 3251796061UL, 40877237UL, 2914051470UL, +1936503212UL, 1428826975UL, 170295791UL, 2753410803UL, 2200994594UL, 3416506072UL, 3263438011UL, 1523230564UL, 393272614UL, 1632665034UL, 3223475136UL, 1847095655UL, 375335282UL, 667585308UL, 3651645415UL, 1628711405UL, 1888152231UL, 786890392UL, 1349234364UL, 1278024517UL, 3955811679UL, 317409190UL, 4213552796UL, 2355655048UL, 1636349912UL, 2875036620UL, 891435579UL, 1233059003UL, 2593048824UL, 942056581UL, 2852399035UL, 1606837225UL, +787552244UL, 1995239637UL, 2482815609UL, 3849697041UL, 723338833UL, 841396894UL, 2718419035UL, 3363828032UL, 2914796626UL, 1043554448UL, 2335090807UL, 1421795969UL, 2322011430UL, 1088985845UL, 2754923978UL, 1646731611UL, 492284258UL, 2339383764UL, 2345741058UL, 3985616488UL, 4055048437UL, 1700143892UL, 2980557654UL, 3047950756UL, 588678041UL, 1077538998UL, 2650679367UL, 2853583947UL, 1902113580UL, 992549416UL, 3375043688UL, 3489699354UL, +2401362855UL, 2822431025UL, 2111206241UL, 3060460082UL, 1409014396UL, 3313834796UL, 3661696135UL, 749987143UL, 3200344474UL, 2743316601UL, 842885927UL, 3902266797UL, 1572013294UL, 3116963503UL, 305659983UL, 132158360UL, 2399116869UL, 2802105766UL, 543215927UL, 4250983939UL, 2719881954UL, 1909593430UL, 1025784309UL, 853237881UL, 3875675156UL, 1753566841UL, 315928539UL, 2265992307UL, 2155720472UL, 1902508987UL, 4246118829UL, 4054781820UL, +1291267638UL, 156828838UL, 2919782856UL, 499968148UL, 2746436642UL, 2108151330UL, 1589837081UL, 3654438263UL, 467304037UL, 2376244866UL, 611554173UL, 1410713407UL, 491953742UL, 1003597552UL, 961109680UL, 1548061756UL, 1934888620UL, 4214562113UL, 4154375443UL, 3318608531UL, 3599839935UL, 2599819225UL, 2676649952UL, 3147375990UL, 3197943734UL, 4213499273UL, 4203909276UL, 668602384UL, 3979162921UL, 4241359084UL, 197252548UL, 8968884UL, +3647746035UL, 2830313226UL, 2057817762UL, 791687787UL, 1643270604UL, 1571637938UL, 4065571991UL, 961587641UL, 2026290282UL, 3826814783UL, 1067370024UL, 1810581550UL, 1525669339UL, 2679791787UL, 1664654967UL, 3740539785UL, 3746164996UL, 3971185743UL, 1690075221UL, 3305556349UL, 4226011346UL, 839676594UL, 4017546432UL, 935893161UL, 904240268UL, 3484988721UL, 2290931247UL, 2887434676UL, 1497667362UL, 1494555863UL, 3251796061UL, 40877237UL, +675451622UL, 1936503212UL, 1428826975UL, 170295791UL, 2753410803UL, 13691728UL, 3416506072UL, 3263438011UL, 1523230564UL, 393272614UL, 2875584734UL, 3223475136UL, 1847095655UL, 375335282UL, 667585308UL, 192306502UL, 1628711405UL, 1888152231UL, 786890392UL, 1349234364UL, 511851370UL, 3955811679UL, 317409190UL, 4213552796UL, 2355655048UL, 131052067UL, 2875036620UL, 891435579UL, 1233059003UL, 2593048824UL, 2915307792UL, 2852399035UL, +1606837225UL, 787552244UL, 1995239637UL, 886016481UL, 3849697041UL, 723338833UL, 841396894UL, 2718419035UL, 1765948302UL, 2914796626UL, 1043554448UL, 2335090807UL, 1421795969UL, 4270899906UL, 1088985845UL, 2754923978UL, 1646731611UL, 492284258UL, 1723935335UL, 2345741058UL, 3985616488UL, 4055048437UL, 1700143892UL, 2254566160UL, 3047950756UL, 588678041UL, 1077538998UL, 2650679367UL, 1004539894UL, 1902113580UL, 992549416UL, 3375043688UL, +3489699354UL, 2030140735UL, 2822431025UL, 2111206241UL, 3060460082UL, 1409014396UL, 3053214877UL, 3661696135UL, 749987143UL, 3200344474UL, 2743316601UL, 398855857UL, 3902266797UL, 1572013294UL, 3116963503UL, 305659983UL, 1626072332UL, 2399116869UL, 2802105766UL, 543215927UL, 4250983939UL, 1149058742UL, 1909593430UL, 1025784309UL, 853237881UL, 3875675156UL, 2709854504UL, 315928539UL, 2265992307UL, 2155720472UL, 1902508987UL, 4065691077UL, +4054781820UL, 1291267638UL, 156828838UL, 2919782856UL, 1004764391UL, 2746436642UL, 2108151330UL, 1589837081UL, 3654438263UL, 2380382984UL, 2376244866UL, 611554173UL, 1410713407UL, 491953742UL, 3149407591UL, 961109680UL, 1548061756UL, 1934888620UL, 4214562113UL, 1555853416UL, 3318608531UL, 3599839935UL, 2599819225UL, 2676649952UL, 1902647993UL, 3197943734UL, 4213499273UL, 4203909276UL, 668602384UL, 2188341510UL, 4241359084UL, 197252548UL, +8968884UL, 3647746035UL, 629654524UL, 2057817762UL, 791687787UL, 1643270604UL, 1571637938UL, 3066487639UL, 961587641UL, 2026290282UL, 3826814783UL, 1067370024UL, 2223613942UL, 1525669339UL, 2679791787UL, 1664654967UL, 3740539785UL, 3902060288UL, 3971185743UL, 1690075221UL, 3305556349UL, 4226011346UL, 3135081672UL, 4017546432UL, 935893161UL, 904240268UL, 3484988721UL, 2448752416UL, 2887434676UL, 1497667362UL, 1494555863UL, 3251796061UL, +1037186927UL, 1608759110UL, 3873834254UL, 59242551UL, 487334743UL, 2580513180UL, 3704829028UL, 3859157573UL, 3452402004UL, 783668920UL, 2394905786UL, 3179497902UL, 2576105629UL, 1552362163UL, 2138613992UL, 224944469UL, 3876873579UL, 3402518289UL, 1709606949UL, 4255868112UL, 1249055439UL, 3395879908UL, 2957760102UL, 346905231UL, 590629983UL, 1171021480UL, 4051081465UL, 3913643946UL, 3115845768UL, 1021908139UL, 2556028362UL, 3828177651UL, +2870156105UL, 899722025UL, 661756192UL, 3775551864UL, 1288569751UL, 3751947667UL, 3064664685UL, 2559273148UL, 2660772417UL, 2448044253UL, 3054357327UL, 3434913868UL, 1444728572UL, 3010819186UL, 3010362527UL, 1709131033UL, 3425689752UL, 2849921358UL, 3518017065UL, 3845809665UL, 3245724553UL, 1008739837UL, 3274032925UL, 2567688974UL, 1981389077UL, 1108638127UL, 470206543UL, 1097339633UL, 1714430226UL, 2321268672UL, 1149373331UL, 294569671UL, +4264586290UL, 4270574127UL, 2522456947UL, 230975563UL, 131504269UL, 541738544UL, 1380704847UL, 2946408074UL, 282744860UL, 246858261UL, 2037373985UL, 1769191691UL, 2174871838UL, 2097427065UL, 492251656UL, 1252290304UL, 3616248100UL, 3213248383UL, 1847973756UL, 647347869UL, 3015847616UL, 299045987UL, 866593289UL, 2009367463UL, 2448831631UL, 337965200UL, 1210654808UL, 1694878225UL, 853507918UL, 3373825966UL, 4262812941UL, 4279525028UL, +338822858UL, 1038097567UL, 3996799911UL, 755960212UL, 149304151UL, 1599868486UL, 4021605447UL, 3040297322UL, 3891899828UL, 1711866076UL, 900840696UL, 3675688669UL, 3070862438UL, 2611308185UL, 2359948129UL, 1158552196UL, 2094484627UL, 3077606843UL, 2119537593UL, 427023787UL, 3632076073UL, 2670551310UL, 3396099733UL, 1066081183UL, 1817788918UL, 324769315UL, 656687887UL, 202117575UL, 3106428593UL, 3730407212UL, 1661316263UL, 1215084998UL, +2025391552UL, 664352483UL, 1914686594UL, 9439399UL, 2548190484UL, 3127972014UL, 4008228378UL, 2645735658UL, 2191361716UL, 2211450148UL, 1863406291UL, 1179298131UL, 241880428UL, 2330159770UL, 3490494273UL, 1337382890UL, 747522461UL, 1060348557UL, 3618051469UL, 991193538UL, 1604905367UL, 2595102954UL, 1460144089UL, 3990194961UL, 44265425UL, 896268152UL, 9333748UL, 2850675977UL, 941433385UL, 2483544989UL, 3443750079UL, 2488690792UL, +}, +{ +824297644UL, 239464654UL, 4133652405UL, 1611614045UL, 102133367UL, 1780659362UL, 114934718UL, 3793050817UL, 3286619856UL, 1323742990UL, 3487325492UL, 468742651UL, 271433491UL, 3474195023UL, 479173886UL, 3282693508UL, 978269731UL, 1826990521UL, 3664994445UL, 1943608646UL, 2356793330UL, 2228748670UL, 4238523810UL, 2467714013UL, 1732683390UL, 2345218001UL, 3371637369UL, 1073602848UL, 844797255UL, 3881048480UL, 509186599UL, 1399427071UL, +3815270778UL, 1505666412UL, 2616384981UL, 2990167853UL, 3716581225UL, 3063486812UL, 1568307898UL, 3262882991UL, 1455926070UL, 3011806226UL, 3803364927UL, 849372289UL, 2382885729UL, 3071102985UL, 3838244574UL, 3219174218UL, 847830757UL, 1414310383UL, 3679389549UL, 1558413907UL, 2211822428UL, 339810803UL, 1051648907UL, 76928699UL, 3174194320UL, 3920525151UL, 2010088097UL, 4111092791UL, 3537133983UL, 1701410561UL, 3036563175UL, 4010986440UL, +1749862952UL, 159833659UL, 3406940095UL, 1041601178UL, 4005001553UL, 1663515026UL, 1728511107UL, 1496728329UL, 2359970426UL, 530862749UL, 3797637507UL, 2550923758UL, 1450321218UL, 21682904UL, 936804838UL, 3832989199UL, 3063256293UL, 3991708711UL, 986539283UL, 3775232150UL, 2867283706UL, 747477232UL, 946349345UL, 1010022077UL, 188204104UL, 2526787171UL, 2816843760UL, 1776005940UL, 2819738500UL, 1155856699UL, 2191793692UL, 3802193350UL, +1163036922UL, 645032560UL, 3122679267UL, 3311719932UL, 3757073707UL, 2464258247UL, 1360425558UL, 387981241UL, 1714916540UL, 411019237UL, 2248466094UL, 2878213113UL, 2742600760UL, 2763650927UL, 2526526309UL, 1093836264UL, 3819986000UL, 3754388150UL, 1731831799UL, 1441137152UL, 1625850961UL, 1182084155UL, 1596226376UL, 2389499892UL, 3923360808UL, 2439159233UL, 1623373213UL, 2513747479UL, 3651587995UL, 1040867254UL, 4208484711UL, 3489019765UL, +2141904813UL, 3666280633UL, 970464748UL, 2970978888UL, 1376163015UL, 1218588624UL, 2721249823UL, 707915046UL, 4262557484UL, 3237019195UL, 744279211UL, 364567144UL, 1997174860UL, 3215512870UL, 2758022574UL, 2677818352UL, 4198422061UL, 3016017869UL, 2243997977UL, 1029293722UL, 1820056287UL, 1090825999UL, 4135403724UL, 299239527UL, 874620372UL, 2995368704UL, 3219627293UL, 2431393692UL, 3470601754UL, 1809177571UL, 37446335UL, 1619184385UL, +675901368UL, 824297644UL, 239464654UL, 4133652405UL, 1611614045UL, 1918718045UL, 1780659362UL, 114934718UL, 3793050817UL, 3286619856UL, 3566342809UL, 3487325492UL, 468742651UL, 271433491UL, 3474195023UL, 77797025UL, 3282693508UL, 978269731UL, 1826990521UL, 3664994445UL, 1455182612UL, 2356793330UL, 2228748670UL, 4238523810UL, 2467714013UL, 1081984526UL, 2345218001UL, 3371637369UL, 1073602848UL, 844797255UL, 4125413817UL, 509186599UL, +1399427071UL, 3815270778UL, 1505666412UL, 891823593UL, 2990167853UL, 3716581225UL, 3063486812UL, 1568307898UL, 1753181930UL, 1455926070UL, 3011806226UL, 3803364927UL, 849372289UL, 4211525266UL, 3071102985UL, 3838244574UL, 3219174218UL, 847830757UL, 774013898UL, 3679389549UL, 1558413907UL, 2211822428UL, 339810803UL, 2282783575UL, 76928699UL, 3174194320UL, 3920525151UL, 2010088097UL, 3894905215UL, 3537133983UL, 1701410561UL, 3036563175UL, +4010986440UL, 676262036UL, 159833659UL, 3406940095UL, 1041601178UL, 4005001553UL, 3470687799UL, 1728511107UL, 1496728329UL, 2359970426UL, 530862749UL, 3081565689UL, 2550923758UL, 1450321218UL, 21682904UL, 936804838UL, 951873872UL, 3063256293UL, 3991708711UL, 986539283UL, 3775232150UL, 487381835UL, 747477232UL, 946349345UL, 1010022077UL, 188204104UL, 2898848241UL, 2816843760UL, 1776005940UL, 2819738500UL, 1155856699UL, 2432683643UL, +3802193350UL, 1163036922UL, 645032560UL, 3122679267UL, 22749078UL, 3757073707UL, 2464258247UL, 1360425558UL, 387981241UL, 3652130062UL, 411019237UL, 2248466094UL, 2878213113UL, 2742600760UL, 811608089UL, 2526526309UL, 1093836264UL, 3819986000UL, 3754388150UL, 415809552UL, 1441137152UL, 1625850961UL, 1182084155UL, 1596226376UL, 202609936UL, 3923360808UL, 2439159233UL, 1623373213UL, 2513747479UL, 4149563237UL, 1040867254UL, 4208484711UL, +3489019765UL, 2141904813UL, 718806958UL, 970464748UL, 2970978888UL, 1376163015UL, 1218588624UL, 2307367700UL, 707915046UL, 4262557484UL, 3237019195UL, 744279211UL, 1876395939UL, 1997174860UL, 3215512870UL, 2758022574UL, 2677818352UL, 2276158677UL, 3016017869UL, 2243997977UL, 1029293722UL, 1820056287UL, 3605618012UL, 4135403724UL, 299239527UL, 874620372UL, 2995368704UL, 872126519UL, 2431393692UL, 3470601754UL, 1809177571UL, 37446335UL, +2365355125UL, 675901368UL, 824297644UL, 239464654UL, 4133652405UL, 8139161UL, 1918718045UL, 1780659362UL, 114934718UL, 3793050817UL, 2424418256UL, 3566342809UL, 3487325492UL, 468742651UL, 271433491UL, 542129690UL, 77797025UL, 3282693508UL, 978269731UL, 1826990521UL, 2963435579UL, 1455182612UL, 2356793330UL, 2228748670UL, 4238523810UL, 2373300657UL, 1081984526UL, 2345218001UL, 3371637369UL, 1073602848UL, 2948610237UL, 4125413817UL, +509186599UL, 1399427071UL, 3815270778UL, 2870251133UL, 891823593UL, 2990167853UL, 3716581225UL, 3063486812UL, 2347504584UL, 1753181930UL, 1455926070UL, 3011806226UL, 3803364927UL, 3956554065UL, 4211525266UL, 3071102985UL, 3838244574UL, 3219174218UL, 2018597841UL, 774013898UL, 3679389549UL, 1558413907UL, 2211822428UL, 56072605UL, 2282783575UL, 76928699UL, 3174194320UL, 3920525151UL, 268031035UL, 3894905215UL, 3537133983UL, 1701410561UL, +3036563175UL, 366935627UL, 676262036UL, 159833659UL, 3406940095UL, 1041601178UL, 4125224603UL, 3470687799UL, 1728511107UL, 1496728329UL, 2359970426UL, 3570997128UL, 3081565689UL, 2550923758UL, 1450321218UL, 21682904UL, 604517910UL, 951873872UL, 3063256293UL, 3991708711UL, 986539283UL, 2414780630UL, 487381835UL, 747477232UL, 946349345UL, 1010022077UL, 3820353604UL, 2898848241UL, 2816843760UL, 1776005940UL, 2819738500UL, 1192624235UL, +2432683643UL, 3802193350UL, 1163036922UL, 645032560UL, 4050277201UL, 22749078UL, 3757073707UL, 2464258247UL, 1360425558UL, 1933406988UL, 3652130062UL, 411019237UL, 2248466094UL, 2878213113UL, 37869698UL, 811608089UL, 2526526309UL, 1093836264UL, 3819986000UL, 3999750910UL, 415809552UL, 1441137152UL, 1625850961UL, 1182084155UL, 1186617400UL, 202609936UL, 3923360808UL, 2439159233UL, 1623373213UL, 4226729056UL, 4149563237UL, 1040867254UL, +4208484711UL, 3489019765UL, 3728140516UL, 718806958UL, 970464748UL, 2970978888UL, 1376163015UL, 1307011711UL, 2307367700UL, 707915046UL, 4262557484UL, 3237019195UL, 4014387080UL, 1876395939UL, 1997174860UL, 3215512870UL, 2758022574UL, 1696763772UL, 2276158677UL, 3016017869UL, 2243997977UL, 1029293722UL, 1444214949UL, 3605618012UL, 4135403724UL, 299239527UL, 874620372UL, 1524158085UL, 872126519UL, 2431393692UL, 3470601754UL, 1809177571UL, +163166369UL, 2365355125UL, 675901368UL, 824297644UL, 239464654UL, 1626558353UL, 8139161UL, 1918718045UL, 1780659362UL, 114934718UL, 1885224714UL, 2424418256UL, 3566342809UL, 3487325492UL, 468742651UL, 1101039917UL, 542129690UL, 77797025UL, 3282693508UL, 978269731UL, 3659653445UL, 2963435579UL, 1455182612UL, 2356793330UL, 2228748670UL, 539062188UL, 2373300657UL, 1081984526UL, 2345218001UL, 3371637369UL, 2825652803UL, 2948610237UL, +4125413817UL, 509186599UL, 1399427071UL, 3197034620UL, 2870251133UL, 891823593UL, 2990167853UL, 3716581225UL, 3773712182UL, 2347504584UL, 1753181930UL, 1455926070UL, 3011806226UL, 3260276773UL, 3956554065UL, 4211525266UL, 3071102985UL, 3838244574UL, 201639236UL, 2018597841UL, 774013898UL, 3679389549UL, 1558413907UL, 2830702673UL, 56072605UL, 2282783575UL, 76928699UL, 3174194320UL, 1677734845UL, 268031035UL, 3894905215UL, 3537133983UL, +1701410561UL, 4240866153UL, 366935627UL, 676262036UL, 159833659UL, 3406940095UL, 4245889153UL, 4125224603UL, 3470687799UL, 1728511107UL, 1496728329UL, 3650277906UL, 3570997128UL, 3081565689UL, 2550923758UL, 1450321218UL, 3392011930UL, 604517910UL, 951873872UL, 3063256293UL, 3991708711UL, 2876003834UL, 2414780630UL, 487381835UL, 747477232UL, 946349345UL, 982266944UL, 3820353604UL, 2898848241UL, 2816843760UL, 1776005940UL, 3677715064UL, +1192624235UL, 2432683643UL, 3802193350UL, 1163036922UL, 1226669337UL, 4050277201UL, 22749078UL, 3757073707UL, 2464258247UL, 4197532785UL, 1933406988UL, 3652130062UL, 411019237UL, 2248466094UL, 3209426720UL, 37869698UL, 811608089UL, 2526526309UL, 1093836264UL, 535856568UL, 3999750910UL, 415809552UL, 1441137152UL, 1625850961UL, 2181491119UL, 1186617400UL, 202609936UL, 3923360808UL, 2439159233UL, 1823827533UL, 4226729056UL, 4149563237UL, +1040867254UL, 4208484711UL, 1101917521UL, 3728140516UL, 718806958UL, 970464748UL, 2970978888UL, 1574663259UL, 1307011711UL, 2307367700UL, 707915046UL, 4262557484UL, 2164217930UL, 4014387080UL, 1876395939UL, 1997174860UL, 3215512870UL, 1335157953UL, 1696763772UL, 2276158677UL, 3016017869UL, 2243997977UL, 324788481UL, 1444214949UL, 3605618012UL, 4135403724UL, 299239527UL, 4190629945UL, 1524158085UL, 872126519UL, 2431393692UL, 3470601754UL, +3701018280UL, 671547257UL, 4029965023UL, 1026428282UL, 1584875796UL, 3537698406UL, 3731126476UL, 2419795330UL, 993551117UL, 2126319514UL, 3557113304UL, 1014047757UL, 1407120210UL, 1977537539UL, 1338958570UL, 3249585389UL, 3661503659UL, 4240815680UL, 1866933898UL, 3205442033UL, 4247144816UL, 1422846419UL, 3847421981UL, 1383632066UL, 3589322376UL, 1816906043UL, 1310944471UL, 3646822098UL, 799529013UL, 3350558751UL, 2552899295UL, 4281235599UL, +4069668296UL, 4123814877UL, 3289565353UL, 1512974699UL, 111908081UL, 2535556715UL, 333570815UL, 3638041929UL, 1942569446UL, 20945397UL, 3784826827UL, 200406456UL, 2640512138UL, 38390336UL, 436784052UL, 3062106345UL, 1675333627UL, 709613078UL, 3479720979UL, 2726065658UL, 4072312748UL, 797389139UL, 3492082903UL, 3792395750UL, 983473383UL, 2984788349UL, 2030282907UL, 2246686378UL, 2451087141UL, 1799640566UL, 2182694041UL, 3226819076UL, +3573153299UL, 3658670545UL, 1197013516UL, 777601408UL, 4271704548UL, 1192713934UL, 1628497069UL, 681025927UL, 4078910773UL, 619496169UL, 1534725146UL, 1881987408UL, 2283881479UL, 1090218673UL, 4169123978UL, 2352195985UL, 2640116078UL, 3869558100UL, 2859177954UL, 3329803656UL, 4048903941UL, 1636589748UL, 2095007175UL, 4169840880UL, 2953611537UL, 2413740464UL, 3029624235UL, 778662441UL, 422412779UL, 412103280UL, 1701569571UL, 564088645UL, +469973310UL, 254302146UL, 3963642101UL, 555781470UL, 2983576224UL, 1757897888UL, 1420763962UL, 2176323176UL, 916790568UL, 3057610889UL, 196828641UL, 1435167402UL, 325046353UL, 1337309066UL, 2691769282UL, 3572566918UL, 2910149226UL, 3659418019UL, 2511762503UL, 3869838339UL, 1413312151UL, 1939339596UL, 801124461UL, 760477862UL, 2416958233UL, 3439465675UL, 3561763524UL, 1760392811UL, 1582406751UL, 1203071257UL, 755811399UL, 2675585013UL, +1150664766UL, 3515765747UL, 3419135844UL, 2076543342UL, 1191918544UL, 3644819073UL, 2195875022UL, 2909071148UL, 3385707813UL, 1151273265UL, 1467337419UL, 3570589492UL, 3742049917UL, 1609858615UL, 2964509119UL, 3747960348UL, 2825858640UL, 101501715UL, 1234710482UL, 750428334UL, 2870070395UL, 416615350UL, 4054039387UL, 3807926874UL, 3035407103UL, 1644560291UL, 2490941295UL, 963796562UL, 3233132139UL, 2590859502UL, 2845243609UL, 964355909UL, +}, +{ +2882980002UL, 2211288683UL, 872766101UL, 3713771728UL, 1429983118UL, 2069599564UL, 827699420UL, 1288565883UL, 2985727214UL, 3873174741UL, 2138389854UL, 3915615927UL, 2759028650UL, 3120611541UL, 385953581UL, 189931252UL, 2044235060UL, 4214733958UL, 1899137741UL, 1973215178UL, 494148492UL, 1550568689UL, 3646957712UL, 3764784141UL, 1114556979UL, 1411407684UL, 1194906295UL, 1718808623UL, 1809627046UL, 1413570172UL, 180837718UL, 2588730975UL, +1481586714UL, 2836300053UL, 1967135375UL, 4010897189UL, 3392273121UL, 3466021198UL, 1182364160UL, 1364130321UL, 1795412556UL, 330320182UL, 1165093128UL, 2125767818UL, 904192995UL, 51833064UL, 232302906UL, 1834422179UL, 476731510UL, 3484170517UL, 2373156680UL, 2610500049UL, 1688364249UL, 463611489UL, 3759685710UL, 62038708UL, 2357334250UL, 1230002441UL, 520303451UL, 3009758047UL, 1882263827UL, 2524779298UL, 1736323157UL, 3883037541UL, +1103650182UL, 1137565179UL, 3112310886UL, 3524287283UL, 3064002681UL, 4106308847UL, 3180534967UL, 2463036338UL, 1859639515UL, 1319061987UL, 354419222UL, 4108171950UL, 601260554UL, 705389180UL, 4081137445UL, 3461353436UL, 399768111UL, 3963945521UL, 2094962544UL, 630762046UL, 369047181UL, 3495709267UL, 3525452874UL, 314919391UL, 2152657907UL, 881476500UL, 3565507827UL, 2594931381UL, 579458905UL, 1767988684UL, 2678728511UL, 3416503939UL, +4150612567UL, 1015748208UL, 2059142720UL, 2725183490UL, 2998421769UL, 1644667445UL, 4221112143UL, 456578131UL, 3881530201UL, 190710543UL, 1721255927UL, 2274887963UL, 187713135UL, 2209254952UL, 2185750138UL, 2992229399UL, 482133467UL, 2758198810UL, 15147949UL, 536333711UL, 2296185346UL, 1103433779UL, 1573407789UL, 1357843567UL, 2927153963UL, 4157295398UL, 533935893UL, 3567030810UL, 1900900411UL, 509578395UL, 3810017456UL, 2134110040UL, +3347323570UL, 3497032747UL, 201278263UL, 3933249682UL, 3849960474UL, 2509123202UL, 3445521167UL, 1355284593UL, 2444811561UL, 2751112324UL, 1116246614UL, 511213077UL, 3412599909UL, 1712118363UL, 54054007UL, 442729047UL, 3077267414UL, 1532701769UL, 181534938UL, 1278069867UL, 3847149992UL, 2305860479UL, 4146252420UL, 2047690303UL, 361856758UL, 452490341UL, 636885000UL, 1733216839UL, 3788548638UL, 1094285639UL, 1349356222UL, 2760444511UL, +976767752UL, 2882980002UL, 2211288683UL, 872766101UL, 3713771728UL, 895830110UL, 2069599564UL, 827699420UL, 1288565883UL, 2985727214UL, 3377496544UL, 2138389854UL, 3915615927UL, 2759028650UL, 3120611541UL, 3254971483UL, 189931252UL, 2044235060UL, 4214733958UL, 1899137741UL, 2095055586UL, 494148492UL, 1550568689UL, 3646957712UL, 3764784141UL, 2869825005UL, 1411407684UL, 1194906295UL, 1718808623UL, 1809627046UL, 907760376UL, 180837718UL, +2588730975UL, 1481586714UL, 2836300053UL, 639229964UL, 4010897189UL, 3392273121UL, 3466021198UL, 1182364160UL, 3006792787UL, 1795412556UL, 330320182UL, 1165093128UL, 2125767818UL, 253264555UL, 51833064UL, 232302906UL, 1834422179UL, 476731510UL, 4284481518UL, 2373156680UL, 2610500049UL, 1688364249UL, 463611489UL, 4133115610UL, 62038708UL, 2357334250UL, 1230002441UL, 520303451UL, 1497001150UL, 1882263827UL, 2524779298UL, 1736323157UL, +3883037541UL, 3541909847UL, 1137565179UL, 3112310886UL, 3524287283UL, 3064002681UL, 3193060438UL, 3180534967UL, 2463036338UL, 1859639515UL, 1319061987UL, 111871878UL, 4108171950UL, 601260554UL, 705389180UL, 4081137445UL, 742999102UL, 399768111UL, 3963945521UL, 2094962544UL, 630762046UL, 3219207950UL, 3495709267UL, 3525452874UL, 314919391UL, 2152657907UL, 720863934UL, 3565507827UL, 2594931381UL, 579458905UL, 1767988684UL, 3958525287UL, +3416503939UL, 4150612567UL, 1015748208UL, 2059142720UL, 4227838648UL, 2998421769UL, 1644667445UL, 4221112143UL, 456578131UL, 302729329UL, 190710543UL, 1721255927UL, 2274887963UL, 187713135UL, 1293706587UL, 2185750138UL, 2992229399UL, 482133467UL, 2758198810UL, 2514965671UL, 536333711UL, 2296185346UL, 1103433779UL, 1573407789UL, 2237639577UL, 2927153963UL, 4157295398UL, 533935893UL, 3567030810UL, 3793156627UL, 509578395UL, 3810017456UL, +2134110040UL, 3347323570UL, 1358364UL, 201278263UL, 3933249682UL, 3849960474UL, 2509123202UL, 628476542UL, 1355284593UL, 2444811561UL, 2751112324UL, 1116246614UL, 3421170828UL, 3412599909UL, 1712118363UL, 54054007UL, 442729047UL, 325825294UL, 1532701769UL, 181534938UL, 1278069867UL, 3847149992UL, 2785457372UL, 4146252420UL, 2047690303UL, 361856758UL, 452490341UL, 1099532083UL, 1733216839UL, 3788548638UL, 1094285639UL, 1349356222UL, +3047068265UL, 976767752UL, 2882980002UL, 2211288683UL, 872766101UL, 366378371UL, 895830110UL, 2069599564UL, 827699420UL, 1288565883UL, 962962884UL, 3377496544UL, 2138389854UL, 3915615927UL, 2759028650UL, 3742489931UL, 3254971483UL, 189931252UL, 2044235060UL, 4214733958UL, 3073407497UL, 2095055586UL, 494148492UL, 1550568689UL, 3646957712UL, 758370067UL, 2869825005UL, 1411407684UL, 1194906295UL, 1718808623UL, 636166267UL, 907760376UL, +180837718UL, 2588730975UL, 1481586714UL, 705382583UL, 639229964UL, 4010897189UL, 3392273121UL, 3466021198UL, 3815622040UL, 3006792787UL, 1795412556UL, 330320182UL, 1165093128UL, 2956382339UL, 253264555UL, 51833064UL, 232302906UL, 1834422179UL, 3665645898UL, 4284481518UL, 2373156680UL, 2610500049UL, 1688364249UL, 2565987890UL, 4133115610UL, 62038708UL, 2357334250UL, 1230002441UL, 2397198293UL, 1497001150UL, 1882263827UL, 2524779298UL, +1736323157UL, 817630445UL, 3541909847UL, 1137565179UL, 3112310886UL, 3524287283UL, 1356492703UL, 3193060438UL, 3180534967UL, 2463036338UL, 1859639515UL, 3963974342UL, 111871878UL, 4108171950UL, 601260554UL, 705389180UL, 1776439965UL, 742999102UL, 399768111UL, 3963945521UL, 2094962544UL, 2007137733UL, 3219207950UL, 3495709267UL, 3525452874UL, 314919391UL, 3877039785UL, 720863934UL, 3565507827UL, 2594931381UL, 579458905UL, 2919403199UL, +3958525287UL, 3416503939UL, 4150612567UL, 1015748208UL, 960765392UL, 4227838648UL, 2998421769UL, 1644667445UL, 4221112143UL, 2402062799UL, 302729329UL, 190710543UL, 1721255927UL, 2274887963UL, 3958481548UL, 1293706587UL, 2185750138UL, 2992229399UL, 482133467UL, 3838280UL, 2514965671UL, 536333711UL, 2296185346UL, 1103433779UL, 3675282065UL, 2237639577UL, 2927153963UL, 4157295398UL, 533935893UL, 4172021805UL, 3793156627UL, 509578395UL, +3810017456UL, 2134110040UL, 3608998517UL, 1358364UL, 201278263UL, 3933249682UL, 3849960474UL, 2445690023UL, 628476542UL, 1355284593UL, 2444811561UL, 2751112324UL, 507378026UL, 3421170828UL, 3412599909UL, 1712118363UL, 54054007UL, 770634305UL, 325825294UL, 1532701769UL, 181534938UL, 1278069867UL, 4055596097UL, 2785457372UL, 4146252420UL, 2047690303UL, 361856758UL, 3439427065UL, 1099532083UL, 1733216839UL, 3788548638UL, 1094285639UL, +1633234274UL, 3047068265UL, 976767752UL, 2882980002UL, 2211288683UL, 3763615153UL, 366378371UL, 895830110UL, 2069599564UL, 827699420UL, 2457443913UL, 962962884UL, 3377496544UL, 2138389854UL, 3915615927UL, 3290989016UL, 3742489931UL, 3254971483UL, 189931252UL, 2044235060UL, 4275822963UL, 3073407497UL, 2095055586UL, 494148492UL, 1550568689UL, 1043420085UL, 758370067UL, 2869825005UL, 1411407684UL, 1194906295UL, 676378812UL, 636166267UL, +907760376UL, 180837718UL, 2588730975UL, 2971715054UL, 705382583UL, 639229964UL, 4010897189UL, 3392273121UL, 795184546UL, 3815622040UL, 3006792787UL, 1795412556UL, 330320182UL, 1990804460UL, 2956382339UL, 253264555UL, 51833064UL, 232302906UL, 836875615UL, 3665645898UL, 4284481518UL, 2373156680UL, 2610500049UL, 98106795UL, 2565987890UL, 4133115610UL, 62038708UL, 2357334250UL, 2761212145UL, 2397198293UL, 1497001150UL, 1882263827UL, +2524779298UL, 2381031747UL, 817630445UL, 3541909847UL, 1137565179UL, 3112310886UL, 2501374726UL, 1356492703UL, 3193060438UL, 3180534967UL, 2463036338UL, 3671733096UL, 3963974342UL, 111871878UL, 4108171950UL, 601260554UL, 1017043724UL, 1776439965UL, 742999102UL, 399768111UL, 3963945521UL, 2177838102UL, 2007137733UL, 3219207950UL, 3495709267UL, 3525452874UL, 3254054416UL, 3877039785UL, 720863934UL, 3565507827UL, 2594931381UL, 1994293489UL, +2919403199UL, 3958525287UL, 3416503939UL, 4150612567UL, 1976960210UL, 960765392UL, 4227838648UL, 2998421769UL, 1644667445UL, 2896792687UL, 2402062799UL, 302729329UL, 190710543UL, 1721255927UL, 2914584080UL, 3958481548UL, 1293706587UL, 2185750138UL, 2992229399UL, 810756083UL, 3838280UL, 2514965671UL, 536333711UL, 2296185346UL, 1776509588UL, 3675282065UL, 2237639577UL, 2927153963UL, 4157295398UL, 2048779551UL, 4172021805UL, 3793156627UL, +509578395UL, 3810017456UL, 3042185034UL, 3608998517UL, 1358364UL, 201278263UL, 3933249682UL, 3551449718UL, 2445690023UL, 628476542UL, 1355284593UL, 2444811561UL, 3480611728UL, 507378026UL, 3421170828UL, 3412599909UL, 1712118363UL, 1268921331UL, 770634305UL, 325825294UL, 1532701769UL, 181534938UL, 2645357587UL, 4055596097UL, 2785457372UL, 4146252420UL, 2047690303UL, 1994855609UL, 3439427065UL, 1099532083UL, 1733216839UL, 3788548638UL, +3516588243UL, 4058132193UL, 3940172101UL, 4043964688UL, 3377150021UL, 1381463736UL, 3320280180UL, 931260821UL, 2754727582UL, 1286176949UL, 1661126244UL, 2301263887UL, 2255977851UL, 1122646603UL, 1767549201UL, 162324152UL, 425506096UL, 3777762686UL, 13687528UL, 710105607UL, 1092739920UL, 2930179533UL, 568855389UL, 2476208631UL, 964360978UL, 2011445117UL, 3887128674UL, 2799005525UL, 2479086439UL, 814368438UL, 2018629666UL, 909662384UL, +231589584UL, 1422241284UL, 4035938208UL, 3570985552UL, 660700421UL, 603857869UL, 567385627UL, 3232044670UL, 291307502UL, 947817625UL, 3466590280UL, 3080261993UL, 947835229UL, 2925888682UL, 1817591844UL, 2652420575UL, 4150903445UL, 4055627313UL, 1715025966UL, 505331227UL, 1863531052UL, 2928506098UL, 947547681UL, 1117344443UL, 781457023UL, 607542746UL, 241559360UL, 3797150797UL, 105381589UL, 361541961UL, 3393121650UL, 3840152184UL, +2873171161UL, 3030026082UL, 1115171192UL, 1718221281UL, 96787532UL, 2556617898UL, 1237726058UL, 2876298621UL, 1052881200UL, 461661595UL, 2632346030UL, 1775614319UL, 2454951319UL, 3691637824UL, 4018448825UL, 1610472965UL, 3076493165UL, 1364200430UL, 2011206580UL, 1066672050UL, 706141458UL, 2064189273UL, 346938484UL, 2964350202UL, 3731612957UL, 2506635528UL, 2007045393UL, 3312126930UL, 2602035453UL, 988876930UL, 2960173442UL, 559685520UL, +2719943441UL, 891699839UL, 1151651090UL, 1223301894UL, 3666960271UL, 1330825927UL, 1681770552UL, 38877327UL, 3803211467UL, 4000053051UL, 3552560459UL, 3510286057UL, 2606732870UL, 721190747UL, 1933504723UL, 3110735238UL, 2333178561UL, 1577381363UL, 595257962UL, 4120745072UL, 960219089UL, 2591080970UL, 3354222743UL, 47827627UL, 3759509914UL, 304815919UL, 2643673615UL, 1381570381UL, 2103367217UL, 2440936991UL, 2376721005UL, 1483630814UL, +3137202706UL, 3075255640UL, 1743649605UL, 3649754571UL, 2550788713UL, 4281983459UL, 904183710UL, 4243944530UL, 2742129811UL, 3363501626UL, 3670239155UL, 4233018118UL, 2615012385UL, 1420298161UL, 1251344091UL, 2172588631UL, 1243035186UL, 1724496237UL, 762022558UL, 8747231UL, 334416849UL, 1219880856UL, 187900356UL, 2527057367UL, 1730455958UL, 3240238410UL, 906024910UL, 2351575735UL, 4207748622UL, 936139767UL, 1984289988UL, 285939331UL, +}, +{ +4246897171UL, 2217508286UL, 4117450683UL, 4110626546UL, 3753823387UL, 3977667932UL, 623718443UL, 2276396692UL, 3772091798UL, 2272323453UL, 710314822UL, 3733316262UL, 1497955597UL, 700242668UL, 3582720207UL, 1247731879UL, 336477088UL, 532374143UL, 1123157198UL, 123828173UL, 272472192UL, 2142741093UL, 2557920990UL, 4209595119UL, 2807266578UL, 1516814248UL, 4250883502UL, 1967663703UL, 215335417UL, 1252724071UL, 4267389372UL, 94668579UL, +1980152960UL, 968677393UL, 1237744359UL, 63833646UL, 2488747616UL, 700459471UL, 744977323UL, 40829823UL, 955400639UL, 37187948UL, 53133706UL, 2014551043UL, 1664982537UL, 3342787122UL, 1549278321UL, 1245110464UL, 3424539081UL, 2180485253UL, 2757636973UL, 3590044052UL, 2712703548UL, 1366894959UL, 1777449151UL, 1538653374UL, 168718075UL, 2435805251UL, 588815465UL, 3166271130UL, 3164200096UL, 417809976UL, 623036767UL, 340121872UL, +1792214783UL, 56330125UL, 3268029211UL, 1117100306UL, 345899179UL, 1547071836UL, 3657965225UL, 4109701299UL, 664937685UL, 2627187961UL, 149301108UL, 1764003230UL, 3177910586UL, 3081492846UL, 2295419724UL, 2553420882UL, 1506534805UL, 971284719UL, 3224921758UL, 3336906843UL, 1507395478UL, 1224379418UL, 4117299702UL, 1973783225UL, 3609783242UL, 4186900040UL, 3715175536UL, 3904547465UL, 459692505UL, 3546328518UL, 3071448159UL, 1300375875UL, +1805392236UL, 3072717072UL, 99113127UL, 4281059076UL, 1658649136UL, 1974081931UL, 3940966682UL, 2092428023UL, 4014384840UL, 1546542514UL, 1130620125UL, 4117533767UL, 3372991735UL, 3537429957UL, 2704347564UL, 2300583688UL, 915286167UL, 1553874575UL, 3466388216UL, 701000054UL, 349103195UL, 1554395274UL, 3140941933UL, 2874072684UL, 2630572105UL, 2794301280UL, 321399291UL, 1158058020UL, 3570908149UL, 122802750UL, 3012686842UL, 2588402967UL, +3420589812UL, 581016671UL, 193235885UL, 1558092297UL, 1233353728UL, 1080743465UL, 3292663441UL, 2188057155UL, 2715412992UL, 4274317234UL, 1657504087UL, 2554269340UL, 1079741964UL, 922252155UL, 569761460UL, 3215661310UL, 2450710288UL, 2491078689UL, 632504591UL, 2169581755UL, 2552457727UL, 2554414735UL, 3347573916UL, 681756629UL, 801451286UL, 3504956478UL, 1308297539UL, 3602650700UL, 3530372129UL, 4117441036UL, 1827438812UL, 2852602217UL, +570161747UL, 4246897171UL, 2217508286UL, 4117450683UL, 4110626546UL, 756072139UL, 3977667932UL, 623718443UL, 2276396692UL, 3772091798UL, 3829898369UL, 710314822UL, 3733316262UL, 1497955597UL, 700242668UL, 757539371UL, 1247731879UL, 336477088UL, 532374143UL, 1123157198UL, 2374238409UL, 272472192UL, 2142741093UL, 2557920990UL, 4209595119UL, 1632439709UL, 1516814248UL, 4250883502UL, 1967663703UL, 215335417UL, 1267642920UL, 4267389372UL, +94668579UL, 1980152960UL, 968677393UL, 2252616933UL, 63833646UL, 2488747616UL, 700459471UL, 744977323UL, 2711054317UL, 955400639UL, 37187948UL, 53133706UL, 2014551043UL, 1664498234UL, 3342787122UL, 1549278321UL, 1245110464UL, 3424539081UL, 496150741UL, 2757636973UL, 3590044052UL, 2712703548UL, 1366894959UL, 2066534443UL, 1538653374UL, 168718075UL, 2435805251UL, 588815465UL, 318307195UL, 3164200096UL, 417809976UL, 623036767UL, +340121872UL, 3426055217UL, 56330125UL, 3268029211UL, 1117100306UL, 345899179UL, 979486044UL, 3657965225UL, 4109701299UL, 664937685UL, 2627187961UL, 2747102301UL, 1764003230UL, 3177910586UL, 3081492846UL, 2295419724UL, 1088606857UL, 1506534805UL, 971284719UL, 3224921758UL, 3336906843UL, 984983218UL, 1224379418UL, 4117299702UL, 1973783225UL, 3609783242UL, 1044785427UL, 3715175536UL, 3904547465UL, 459692505UL, 3546328518UL, 2096978494UL, +1300375875UL, 1805392236UL, 3072717072UL, 99113127UL, 972796497UL, 1658649136UL, 1974081931UL, 3940966682UL, 2092428023UL, 2914458983UL, 1546542514UL, 1130620125UL, 4117533767UL, 3372991735UL, 947968718UL, 2704347564UL, 2300583688UL, 915286167UL, 1553874575UL, 2124709798UL, 701000054UL, 349103195UL, 1554395274UL, 3140941933UL, 2569019225UL, 2630572105UL, 2794301280UL, 321399291UL, 1158058020UL, 4051601694UL, 122802750UL, 3012686842UL, +2588402967UL, 3420589812UL, 1738150581UL, 193235885UL, 1558092297UL, 1233353728UL, 1080743465UL, 1527068788UL, 2188057155UL, 2715412992UL, 4274317234UL, 1657504087UL, 1543089352UL, 1079741964UL, 922252155UL, 569761460UL, 3215661310UL, 2869922986UL, 2491078689UL, 632504591UL, 2169581755UL, 2552457727UL, 2807462748UL, 3347573916UL, 681756629UL, 801451286UL, 3504956478UL, 3400676931UL, 3602650700UL, 3530372129UL, 4117441036UL, 1827438812UL, +4056234054UL, 570161747UL, 4246897171UL, 2217508286UL, 4117450683UL, 3321376103UL, 756072139UL, 3977667932UL, 623718443UL, 2276396692UL, 1340008665UL, 3829898369UL, 710314822UL, 3733316262UL, 1497955597UL, 2098292377UL, 757539371UL, 1247731879UL, 336477088UL, 532374143UL, 2210327641UL, 2374238409UL, 272472192UL, 2142741093UL, 2557920990UL, 3502520226UL, 1632439709UL, 1516814248UL, 4250883502UL, 1967663703UL, 499168780UL, 1267642920UL, +4267389372UL, 94668579UL, 1980152960UL, 2695928666UL, 2252616933UL, 63833646UL, 2488747616UL, 700459471UL, 4181471443UL, 2711054317UL, 955400639UL, 37187948UL, 53133706UL, 441944403UL, 1664498234UL, 3342787122UL, 1549278321UL, 1245110464UL, 2271611585UL, 496150741UL, 2757636973UL, 3590044052UL, 2712703548UL, 3009817799UL, 2066534443UL, 1538653374UL, 168718075UL, 2435805251UL, 734763537UL, 318307195UL, 3164200096UL, 417809976UL, +623036767UL, 4002728646UL, 3426055217UL, 56330125UL, 3268029211UL, 1117100306UL, 1435987728UL, 979486044UL, 3657965225UL, 4109701299UL, 664937685UL, 815527474UL, 2747102301UL, 1764003230UL, 3177910586UL, 3081492846UL, 63383766UL, 1088606857UL, 1506534805UL, 971284719UL, 3224921758UL, 2331024939UL, 984983218UL, 1224379418UL, 4117299702UL, 1973783225UL, 3998070267UL, 1044785427UL, 3715175536UL, 3904547465UL, 459692505UL, 2582830990UL, +2096978494UL, 1300375875UL, 1805392236UL, 3072717072UL, 321154403UL, 972796497UL, 1658649136UL, 1974081931UL, 3940966682UL, 3789726976UL, 2914458983UL, 1546542514UL, 1130620125UL, 4117533767UL, 3440681546UL, 947968718UL, 2704347564UL, 2300583688UL, 915286167UL, 474021937UL, 2124709798UL, 701000054UL, 349103195UL, 1554395274UL, 702752814UL, 2569019225UL, 2630572105UL, 2794301280UL, 321399291UL, 2406346046UL, 4051601694UL, 122802750UL, +3012686842UL, 2588402967UL, 1782259321UL, 1738150581UL, 193235885UL, 1558092297UL, 1233353728UL, 3935919190UL, 1527068788UL, 2188057155UL, 2715412992UL, 4274317234UL, 1722541048UL, 1543089352UL, 1079741964UL, 922252155UL, 569761460UL, 3384000986UL, 2869922986UL, 2491078689UL, 632504591UL, 2169581755UL, 3451609034UL, 2807462748UL, 3347573916UL, 681756629UL, 801451286UL, 2643408064UL, 3400676931UL, 3602650700UL, 3530372129UL, 4117441036UL, +3635077251UL, 4056234054UL, 570161747UL, 4246897171UL, 2217508286UL, 2364796923UL, 3321376103UL, 756072139UL, 3977667932UL, 623718443UL, 3792539489UL, 1340008665UL, 3829898369UL, 710314822UL, 3733316262UL, 876419217UL, 2098292377UL, 757539371UL, 1247731879UL, 336477088UL, 3307300788UL, 2210327641UL, 2374238409UL, 272472192UL, 2142741093UL, 4142392723UL, 3502520226UL, 1632439709UL, 1516814248UL, 4250883502UL, 3551852862UL, 499168780UL, +1267642920UL, 4267389372UL, 94668579UL, 1177286958UL, 2695928666UL, 2252616933UL, 63833646UL, 2488747616UL, 3571573975UL, 4181471443UL, 2711054317UL, 955400639UL, 37187948UL, 1485050393UL, 441944403UL, 1664498234UL, 3342787122UL, 1549278321UL, 518707274UL, 2271611585UL, 496150741UL, 2757636973UL, 3590044052UL, 305206687UL, 3009817799UL, 2066534443UL, 1538653374UL, 168718075UL, 1914032206UL, 734763537UL, 318307195UL, 3164200096UL, +417809976UL, 2062496275UL, 4002728646UL, 3426055217UL, 56330125UL, 3268029211UL, 1878869053UL, 1435987728UL, 979486044UL, 3657965225UL, 4109701299UL, 1558853775UL, 815527474UL, 2747102301UL, 1764003230UL, 3177910586UL, 681877401UL, 63383766UL, 1088606857UL, 1506534805UL, 971284719UL, 2546285777UL, 2331024939UL, 984983218UL, 1224379418UL, 4117299702UL, 539292757UL, 3998070267UL, 1044785427UL, 3715175536UL, 3904547465UL, 3854154565UL, +2582830990UL, 2096978494UL, 1300375875UL, 1805392236UL, 2586804198UL, 321154403UL, 972796497UL, 1658649136UL, 1974081931UL, 1718873863UL, 3789726976UL, 2914458983UL, 1546542514UL, 1130620125UL, 477866180UL, 3440681546UL, 947968718UL, 2704347564UL, 2300583688UL, 56071603UL, 474021937UL, 2124709798UL, 701000054UL, 349103195UL, 2431577249UL, 702752814UL, 2569019225UL, 2630572105UL, 2794301280UL, 211758134UL, 2406346046UL, 4051601694UL, +122802750UL, 3012686842UL, 2470642374UL, 1782259321UL, 1738150581UL, 193235885UL, 1558092297UL, 852353933UL, 3935919190UL, 1527068788UL, 2188057155UL, 2715412992UL, 543290606UL, 1722541048UL, 1543089352UL, 1079741964UL, 922252155UL, 1146820965UL, 3384000986UL, 2869922986UL, 2491078689UL, 632504591UL, 2936494996UL, 3451609034UL, 2807462748UL, 3347573916UL, 681756629UL, 3428474076UL, 2643408064UL, 3400676931UL, 3602650700UL, 3530372129UL, +3558016488UL, 304167301UL, 3073812276UL, 1253385329UL, 801639697UL, 1346336854UL, 3880416830UL, 1110804934UL, 2500585706UL, 1294233475UL, 1964132477UL, 1625651370UL, 2732590160UL, 310054807UL, 3350133555UL, 800839525UL, 3435579932UL, 2120216654UL, 407780291UL, 1228117799UL, 513334510UL, 1423091447UL, 3698882838UL, 2556406643UL, 1536483608UL, 998695315UL, 1619514015UL, 4197375975UL, 892985909UL, 993665758UL, 4160405430UL, 2379977763UL, +1423742790UL, 4286808034UL, 479280944UL, 3611297256UL, 3481820363UL, 1261889958UL, 455298115UL, 3955764756UL, 2406161837UL, 185873336UL, 3382956716UL, 3556168427UL, 3988426650UL, 2917586591UL, 1248672474UL, 2925146191UL, 1416331075UL, 290755159UL, 2845168299UL, 3301422441UL, 3771816588UL, 491352430UL, 2461746382UL, 1591975949UL, 604909111UL, 3595669760UL, 4079314041UL, 258321046UL, 1352583874UL, 999018951UL, 3150079914UL, 113122510UL, +743303046UL, 3205496412UL, 4267738054UL, 2567402806UL, 2181107494UL, 3266354249UL, 1941487496UL, 2742084900UL, 3758785335UL, 732694221UL, 2052988791UL, 1759288229UL, 1094292464UL, 1582835026UL, 2817864273UL, 666443657UL, 419482443UL, 2877435004UL, 2944696351UL, 2523539432UL, 301119182UL, 998264713UL, 2314419254UL, 3610447393UL, 1139414242UL, 1486351830UL, 3207929489UL, 384633091UL, 4056367270UL, 2348418835UL, 3773781885UL, 1963929818UL, +804929680UL, 1511023454UL, 3915948102UL, 1371942526UL, 2586212526UL, 130122933UL, 2030859646UL, 3730011315UL, 118408868UL, 632704878UL, 3559959612UL, 2926361713UL, 1401386286UL, 599210027UL, 2315051975UL, 157809758UL, 1148939942UL, 3060024350UL, 1464284678UL, 3209480975UL, 3961060416UL, 3481639206UL, 4113344379UL, 3475766200UL, 130581501UL, 1844026536UL, 2661594012UL, 3145812007UL, 3233175620UL, 2549419093UL, 2612966733UL, 1348260920UL, +740167863UL, 226231218UL, 2631972701UL, 2148020402UL, 3399479414UL, 1074946996UL, 30872114UL, 1342415612UL, 1071408471UL, 1141719547UL, 332346805UL, 1473336719UL, 4207932404UL, 3668838170UL, 3154502882UL, 3892070442UL, 2812790310UL, 13931822UL, 1150258251UL, 2369539473UL, 640926011UL, 2991135002UL, 2410382633UL, 548200125UL, 3977740663UL, 1245837867UL, 2378569399UL, 1561469990UL, 2437445882UL, 214387770UL, 3329587833UL, 281635893UL, +}, +{ +1720103319UL, 2201367526UL, 1415072072UL, 2446588589UL, 2195586017UL, 3817930623UL, 653121934UL, 2766514657UL, 765921436UL, 630082485UL, 2990883045UL, 3304472999UL, 471385134UL, 4097977544UL, 3749829028UL, 3587534772UL, 1064359851UL, 800061060UL, 2844220510UL, 389838005UL, 3681318140UL, 1515923235UL, 1885079324UL, 713031018UL, 1962734763UL, 2288160004UL, 1983331336UL, 1247350521UL, 4208372034UL, 1444837930UL, 3549494305UL, 4169715512UL, +701313302UL, 1118275019UL, 3118975645UL, 4153969630UL, 3516491181UL, 3601057044UL, 2509222288UL, 223064937UL, 899123842UL, 2574531231UL, 1386928111UL, 3790651401UL, 1300768348UL, 2038833061UL, 3736517792UL, 3850203561UL, 1679542285UL, 3391273474UL, 3862995487UL, 3118056386UL, 47128429UL, 2977525950UL, 3236389548UL, 1937040839UL, 4223233198UL, 2105119262UL, 721111284UL, 331726226UL, 68419013UL, 2575393464UL, 3648293304UL, 1448878851UL, +4186783614UL, 3696899986UL, 1270877069UL, 3351263117UL, 3918639273UL, 1472902162UL, 2767482392UL, 3549853842UL, 2353191576UL, 3353325530UL, 3072485271UL, 2689121900UL, 2335686695UL, 246689858UL, 2946177636UL, 1677728066UL, 1455723263UL, 3447540996UL, 2143976172UL, 1779511280UL, 3667361203UL, 1575502035UL, 849872082UL, 3527265600UL, 1443266215UL, 1320668722UL, 458373857UL, 3862342513UL, 699597603UL, 685707268UL, 948502001UL, 2501058653UL, +2254562046UL, 2210683894UL, 29088679UL, 1456231200UL, 2764392560UL, 4138068372UL, 3094591474UL, 1093749152UL, 1668875176UL, 3133003149UL, 4128702884UL, 652852832UL, 2211671337UL, 2231125160UL, 131729558UL, 3845605816UL, 3769660625UL, 1696592453UL, 728353643UL, 2751201502UL, 3496971733UL, 3349166522UL, 1005919830UL, 3411089601UL, 3754493523UL, 1994945529UL, 1604309774UL, 2083609686UL, 833983349UL, 2600153513UL, 1677348112UL, 207321473UL, +1051990507UL, 2135039620UL, 4239461390UL, 1574144998UL, 1070761856UL, 1990807569UL, 112704720UL, 2506523299UL, 2827487353UL, 4130754901UL, 1943274185UL, 3913701053UL, 1014850621UL, 3662772872UL, 4115124063UL, 1760146762UL, 3254829227UL, 800302547UL, 3602066837UL, 975658158UL, 2880018391UL, 714134831UL, 2696483406UL, 2351365577UL, 2811011071UL, 3505407160UL, 54109504UL, 424967367UL, 3759525737UL, 1726627246UL, 1110539071UL, 2339755764UL, +3356877114UL, 1720103319UL, 2201367526UL, 1415072072UL, 2446588589UL, 2499136377UL, 3817930623UL, 653121934UL, 2766514657UL, 765921436UL, 3794433488UL, 2990883045UL, 3304472999UL, 471385134UL, 4097977544UL, 3618516788UL, 3587534772UL, 1064359851UL, 800061060UL, 2844220510UL, 2319780070UL, 3681318140UL, 1515923235UL, 1885079324UL, 713031018UL, 11705290UL, 2288160004UL, 1983331336UL, 1247350521UL, 4208372034UL, 2508892029UL, 3549494305UL, +4169715512UL, 701313302UL, 1118275019UL, 1430522809UL, 4153969630UL, 3516491181UL, 3601057044UL, 2509222288UL, 1917025539UL, 899123842UL, 2574531231UL, 1386928111UL, 3790651401UL, 1219040401UL, 2038833061UL, 3736517792UL, 3850203561UL, 1679542285UL, 671522957UL, 3862995487UL, 3118056386UL, 47128429UL, 2977525950UL, 2762831063UL, 1937040839UL, 4223233198UL, 2105119262UL, 721111284UL, 1386688457UL, 68419013UL, 2575393464UL, 3648293304UL, +1448878851UL, 466405406UL, 3696899986UL, 1270877069UL, 3351263117UL, 3918639273UL, 94103836UL, 2767482392UL, 3549853842UL, 2353191576UL, 3353325530UL, 349361794UL, 2689121900UL, 2335686695UL, 246689858UL, 2946177636UL, 3232050945UL, 1455723263UL, 3447540996UL, 2143976172UL, 1779511280UL, 542837628UL, 1575502035UL, 849872082UL, 3527265600UL, 1443266215UL, 1867394883UL, 458373857UL, 3862342513UL, 699597603UL, 685707268UL, 4210562190UL, +2501058653UL, 2254562046UL, 2210683894UL, 29088679UL, 3647972960UL, 2764392560UL, 4138068372UL, 3094591474UL, 1093749152UL, 312511475UL, 3133003149UL, 4128702884UL, 652852832UL, 2211671337UL, 145492343UL, 131729558UL, 3845605816UL, 3769660625UL, 1696592453UL, 4223421915UL, 2751201502UL, 3496971733UL, 3349166522UL, 1005919830UL, 1656802049UL, 3754493523UL, 1994945529UL, 1604309774UL, 2083609686UL, 3032348100UL, 2600153513UL, 1677348112UL, +207321473UL, 1051990507UL, 3349078950UL, 4239461390UL, 1574144998UL, 1070761856UL, 1990807569UL, 2970449178UL, 2506523299UL, 2827487353UL, 4130754901UL, 1943274185UL, 445467699UL, 1014850621UL, 3662772872UL, 4115124063UL, 1760146762UL, 3738518624UL, 800302547UL, 3602066837UL, 975658158UL, 2880018391UL, 1553758240UL, 2696483406UL, 2351365577UL, 2811011071UL, 3505407160UL, 1259180427UL, 424967367UL, 3759525737UL, 1726627246UL, 1110539071UL, +2863575420UL, 3356877114UL, 1720103319UL, 2201367526UL, 1415072072UL, 1463388387UL, 2499136377UL, 3817930623UL, 653121934UL, 2766514657UL, 526940162UL, 3794433488UL, 2990883045UL, 3304472999UL, 471385134UL, 594057325UL, 3618516788UL, 3587534772UL, 1064359851UL, 800061060UL, 1001523010UL, 2319780070UL, 3681318140UL, 1515923235UL, 1885079324UL, 255576756UL, 11705290UL, 2288160004UL, 1983331336UL, 1247350521UL, 1108575113UL, 2508892029UL, +3549494305UL, 4169715512UL, 701313302UL, 524281295UL, 1430522809UL, 4153969630UL, 3516491181UL, 3601057044UL, 1816283752UL, 1917025539UL, 899123842UL, 2574531231UL, 1386928111UL, 1530966640UL, 1219040401UL, 2038833061UL, 3736517792UL, 3850203561UL, 1855689726UL, 671522957UL, 3862995487UL, 3118056386UL, 47128429UL, 1718476461UL, 2762831063UL, 1937040839UL, 4223233198UL, 2105119262UL, 176166283UL, 1386688457UL, 68419013UL, 2575393464UL, +3648293304UL, 4069820559UL, 466405406UL, 3696899986UL, 1270877069UL, 3351263117UL, 1645545933UL, 94103836UL, 2767482392UL, 3549853842UL, 2353191576UL, 4163887784UL, 349361794UL, 2689121900UL, 2335686695UL, 246689858UL, 1246040634UL, 3232050945UL, 1455723263UL, 3447540996UL, 2143976172UL, 2111249329UL, 542837628UL, 1575502035UL, 849872082UL, 3527265600UL, 1836050084UL, 1867394883UL, 458373857UL, 3862342513UL, 699597603UL, 3139537113UL, +4210562190UL, 2501058653UL, 2254562046UL, 2210683894UL, 3997617191UL, 3647972960UL, 2764392560UL, 4138068372UL, 3094591474UL, 2664795910UL, 312511475UL, 3133003149UL, 4128702884UL, 652852832UL, 1658020144UL, 145492343UL, 131729558UL, 3845605816UL, 3769660625UL, 2822578949UL, 4223421915UL, 2751201502UL, 3496971733UL, 3349166522UL, 1582873482UL, 1656802049UL, 3754493523UL, 1994945529UL, 1604309774UL, 1113569720UL, 3032348100UL, 2600153513UL, +1677348112UL, 207321473UL, 3169983987UL, 3349078950UL, 4239461390UL, 1574144998UL, 1070761856UL, 1308776367UL, 2970449178UL, 2506523299UL, 2827487353UL, 4130754901UL, 1403493846UL, 445467699UL, 1014850621UL, 3662772872UL, 4115124063UL, 340210579UL, 3738518624UL, 800302547UL, 3602066837UL, 975658158UL, 3367770843UL, 1553758240UL, 2696483406UL, 2351365577UL, 2811011071UL, 4162875353UL, 1259180427UL, 424967367UL, 3759525737UL, 1726627246UL, +1341806135UL, 2863575420UL, 3356877114UL, 1720103319UL, 2201367526UL, 2232383995UL, 1463388387UL, 2499136377UL, 3817930623UL, 653121934UL, 1756183481UL, 526940162UL, 3794433488UL, 2990883045UL, 3304472999UL, 2185125572UL, 594057325UL, 3618516788UL, 3587534772UL, 1064359851UL, 2933544964UL, 1001523010UL, 2319780070UL, 3681318140UL, 1515923235UL, 4147783641UL, 255576756UL, 11705290UL, 2288160004UL, 1983331336UL, 956739400UL, 1108575113UL, +2508892029UL, 3549494305UL, 4169715512UL, 142273913UL, 524281295UL, 1430522809UL, 4153969630UL, 3516491181UL, 986032639UL, 1816283752UL, 1917025539UL, 899123842UL, 2574531231UL, 1508271110UL, 1530966640UL, 1219040401UL, 2038833061UL, 3736517792UL, 458417668UL, 1855689726UL, 671522957UL, 3862995487UL, 3118056386UL, 284266432UL, 1718476461UL, 2762831063UL, 1937040839UL, 4223233198UL, 1605514069UL, 176166283UL, 1386688457UL, 68419013UL, +2575393464UL, 3650747541UL, 4069820559UL, 466405406UL, 3696899986UL, 1270877069UL, 678590674UL, 1645545933UL, 94103836UL, 2767482392UL, 3549853842UL, 398179945UL, 4163887784UL, 349361794UL, 2689121900UL, 2335686695UL, 3853658293UL, 1246040634UL, 3232050945UL, 1455723263UL, 3447540996UL, 2657693810UL, 2111249329UL, 542837628UL, 1575502035UL, 849872082UL, 2061659800UL, 1836050084UL, 1867394883UL, 458373857UL, 3862342513UL, 730568629UL, +3139537113UL, 4210562190UL, 2501058653UL, 2254562046UL, 449510786UL, 3997617191UL, 3647972960UL, 2764392560UL, 4138068372UL, 1939679536UL, 2664795910UL, 312511475UL, 3133003149UL, 4128702884UL, 4057510355UL, 1658020144UL, 145492343UL, 131729558UL, 3845605816UL, 3235632110UL, 2822578949UL, 4223421915UL, 2751201502UL, 3496971733UL, 4258920219UL, 1582873482UL, 1656802049UL, 3754493523UL, 1994945529UL, 1073499993UL, 1113569720UL, 3032348100UL, +2600153513UL, 1677348112UL, 3152835240UL, 3169983987UL, 3349078950UL, 4239461390UL, 1574144998UL, 2548972357UL, 1308776367UL, 2970449178UL, 2506523299UL, 2827487353UL, 2908066033UL, 1403493846UL, 445467699UL, 1014850621UL, 3662772872UL, 1685925089UL, 340210579UL, 3738518624UL, 800302547UL, 3602066837UL, 2264692610UL, 3367770843UL, 1553758240UL, 2696483406UL, 2351365577UL, 1686022564UL, 4162875353UL, 1259180427UL, 424967367UL, 3759525737UL, +70326173UL, 3028074555UL, 2568586198UL, 2513473964UL, 2923109510UL, 2265392251UL, 3760490867UL, 147487099UL, 386755149UL, 2152759137UL, 2716532213UL, 1153507474UL, 627929575UL, 847454712UL, 2426916452UL, 3861548980UL, 209825268UL, 1090299778UL, 1876886461UL, 976019203UL, 4290216337UL, 2278290065UL, 3302814528UL, 1567440061UL, 1874857224UL, 3794588915UL, 3218569451UL, 2335365199UL, 1959651923UL, 3366000689UL, 2374428382UL, 2126784887UL, +4123272655UL, 274837369UL, 1413111935UL, 1754627204UL, 1863684635UL, 4170025739UL, 2150019850UL, 4250751856UL, 3601214212UL, 2024081043UL, 334808859UL, 3921757513UL, 3870643644UL, 2864810945UL, 1004431888UL, 4283279830UL, 873365350UL, 2479791433UL, 3393478881UL, 3373502257UL, 1882140107UL, 2546676519UL, 1208428915UL, 268043238UL, 2292710623UL, 770651064UL, 2330160036UL, 2476488258UL, 2496037992UL, 118721504UL, 2289499985UL, 987994743UL, +3610346256UL, 3371795927UL, 2681434550UL, 2213200417UL, 3729194378UL, 1657623395UL, 402983380UL, 3618058500UL, 3487743585UL, 965523531UL, 819256729UL, 2544660729UL, 3273986506UL, 60894411UL, 1779152929UL, 3598159279UL, 3429317853UL, 2246402362UL, 3761392367UL, 3921798306UL, 947928110UL, 2394097908UL, 4004330264UL, 1180759989UL, 1624349051UL, 1750929499UL, 3889184770UL, 2052097704UL, 4092981046UL, 2913733578UL, 4241980897UL, 1127407450UL, +950788009UL, 2105033320UL, 473205730UL, 981905310UL, 2888856914UL, 798112239UL, 3377889612UL, 2273659507UL, 1157471194UL, 4269212574UL, 3575306012UL, 116024754UL, 1432668659UL, 1079598649UL, 3882002482UL, 3838480186UL, 823643071UL, 1244220618UL, 1227720039UL, 1343395654UL, 4277277976UL, 2612321540UL, 3013674017UL, 3658064522UL, 2573775167UL, 142767236UL, 2545708383UL, 1740478937UL, 809036862UL, 1492188594UL, 1294286248UL, 1093543858UL, +2944418375UL, 2981996479UL, 4067464923UL, 3071157685UL, 1938984450UL, 81707323UL, 337713546UL, 1849381296UL, 3447450393UL, 3551106302UL, 3394545269UL, 3167744716UL, 1815294624UL, 3244728913UL, 2462138247UL, 2286711732UL, 3023116169UL, 707366723UL, 1314169762UL, 1511231537UL, 2227622993UL, 2876600706UL, 4271030726UL, 2020521540UL, 2966596767UL, 3964589247UL, 1291306737UL, 883851756UL, 1355819080UL, 2834319249UL, 3825063450UL, 4205423325UL, +}, +{ +525214560UL, 1972466543UL, 1542775297UL, 3030388145UL, 2623763324UL, 1445252054UL, 2315649878UL, 2940376435UL, 1322155857UL, 2007925719UL, 899111545UL, 3946601974UL, 720416639UL, 566341007UL, 3830971140UL, 2379218430UL, 946001131UL, 324551023UL, 3792134824UL, 2419222364UL, 2507004728UL, 4050415702UL, 2934667964UL, 3435655480UL, 3738151878UL, 340092998UL, 429296098UL, 3804978739UL, 1547120540UL, 976306993UL, 1134820236UL, 288696971UL, +292350374UL, 423348923UL, 4250561112UL, 1380146522UL, 646098313UL, 3081299572UL, 3633231429UL, 2348008746UL, 3250735726UL, 3495239618UL, 1083361876UL, 2660545988UL, 97607299UL, 741626628UL, 2451882102UL, 607936604UL, 1566190301UL, 3752644837UL, 1626575269UL, 2569947980UL, 120166892UL, 1936167922UL, 2964570009UL, 2601765059UL, 2550590348UL, 1491574373UL, 1916644920UL, 2955888714UL, 3900360190UL, 396836243UL, 2417234534UL, 4219822777UL, +3017031315UL, 3848370775UL, 4113753945UL, 1038708316UL, 1227041843UL, 1287656330UL, 594136009UL, 1679465955UL, 1127853612UL, 445673212UL, 2491164616UL, 4234959779UL, 3670094401UL, 2810998507UL, 2091885715UL, 4213376041UL, 3724691332UL, 1428205363UL, 2351471476UL, 1863345709UL, 3172242044UL, 1435176883UL, 925973933UL, 3166951436UL, 2056462416UL, 489417029UL, 4029854347UL, 3002516723UL, 1597712463UL, 1200457469UL, 3909654542UL, 1352519428UL, +13398705UL, 3919269221UL, 371331154UL, 332347636UL, 3726033518UL, 2407091731UL, 2926199215UL, 3054175446UL, 3208807730UL, 584793525UL, 2706493003UL, 561190823UL, 2412132195UL, 2488492462UL, 3149885896UL, 3512276852UL, 2843032269UL, 2485506176UL, 4025325347UL, 4152622551UL, 4022346903UL, 331746013UL, 197533993UL, 3658414685UL, 2670729696UL, 3290854172UL, 2251426444UL, 3569225076UL, 2466203243UL, 658184940UL, 518096293UL, 52156682UL, +2398958685UL, 745491615UL, 3723004242UL, 2847276077UL, 1857504125UL, 633035220UL, 4057593658UL, 2783467746UL, 3122875931UL, 446601186UL, 2786851490UL, 261950076UL, 2843506874UL, 745391893UL, 1404094021UL, 2234513997UL, 315083019UL, 645865358UL, 2862243948UL, 1204315994UL, 3701151065UL, 663411328UL, 1924727700UL, 1905843757UL, 1483930049UL, 449616818UL, 3793968150UL, 1840668755UL, 1671024110UL, 4079375869UL, 4171670660UL, 2585904968UL, +3886777251UL, 525214560UL, 1972466543UL, 1542775297UL, 3030388145UL, 2530126952UL, 1445252054UL, 2315649878UL, 2940376435UL, 1322155857UL, 1599103627UL, 899111545UL, 3946601974UL, 720416639UL, 566341007UL, 4070101360UL, 2379218430UL, 946001131UL, 324551023UL, 3792134824UL, 2445126690UL, 2507004728UL, 4050415702UL, 2934667964UL, 3435655480UL, 2968121571UL, 340092998UL, 429296098UL, 3804978739UL, 1547120540UL, 3901803457UL, 1134820236UL, +288696971UL, 292350374UL, 423348923UL, 1589814289UL, 1380146522UL, 646098313UL, 3081299572UL, 3633231429UL, 670777956UL, 3250735726UL, 3495239618UL, 1083361876UL, 2660545988UL, 4050232394UL, 741626628UL, 2451882102UL, 607936604UL, 1566190301UL, 1132827700UL, 1626575269UL, 2569947980UL, 120166892UL, 1936167922UL, 1280520333UL, 2601765059UL, 2550590348UL, 1491574373UL, 1916644920UL, 1073889810UL, 3900360190UL, 396836243UL, 2417234534UL, +4219822777UL, 1754651820UL, 3848370775UL, 4113753945UL, 1038708316UL, 1227041843UL, 464826842UL, 594136009UL, 1679465955UL, 1127853612UL, 445673212UL, 4198686893UL, 4234959779UL, 3670094401UL, 2810998507UL, 2091885715UL, 416103731UL, 3724691332UL, 1428205363UL, 2351471476UL, 1863345709UL, 2637470915UL, 1435176883UL, 925973933UL, 3166951436UL, 2056462416UL, 2546319147UL, 4029854347UL, 3002516723UL, 1597712463UL, 1200457469UL, 681365672UL, +1352519428UL, 13398705UL, 3919269221UL, 371331154UL, 742849231UL, 3726033518UL, 2407091731UL, 2926199215UL, 3054175446UL, 1323833820UL, 584793525UL, 2706493003UL, 561190823UL, 2412132195UL, 3747238187UL, 3149885896UL, 3512276852UL, 2843032269UL, 2485506176UL, 3817319503UL, 4152622551UL, 4022346903UL, 331746013UL, 197533993UL, 99009902UL, 2670729696UL, 3290854172UL, 2251426444UL, 3569225076UL, 4199909720UL, 658184940UL, 518096293UL, +52156682UL, 2398958685UL, 1648201186UL, 3723004242UL, 2847276077UL, 1857504125UL, 633035220UL, 1394668680UL, 2783467746UL, 3122875931UL, 446601186UL, 2786851490UL, 2590549096UL, 2843506874UL, 745391893UL, 1404094021UL, 2234513997UL, 347299411UL, 645865358UL, 2862243948UL, 1204315994UL, 3701151065UL, 4028305509UL, 1924727700UL, 1905843757UL, 1483930049UL, 449616818UL, 2251238906UL, 1840668755UL, 1671024110UL, 4079375869UL, 4171670660UL, +4080554282UL, 3886777251UL, 525214560UL, 1972466543UL, 1542775297UL, 3280177496UL, 2530126952UL, 1445252054UL, 2315649878UL, 2940376435UL, 2094983509UL, 1599103627UL, 899111545UL, 3946601974UL, 720416639UL, 1446566513UL, 4070101360UL, 2379218430UL, 946001131UL, 324551023UL, 2945613775UL, 2445126690UL, 2507004728UL, 4050415702UL, 2934667964UL, 2815036731UL, 2968121571UL, 340092998UL, 429296098UL, 3804978739UL, 3298867574UL, 3901803457UL, +1134820236UL, 288696971UL, 292350374UL, 3280367987UL, 1589814289UL, 1380146522UL, 646098313UL, 3081299572UL, 2536311658UL, 670777956UL, 3250735726UL, 3495239618UL, 1083361876UL, 3726225049UL, 4050232394UL, 741626628UL, 2451882102UL, 607936604UL, 3460165725UL, 1132827700UL, 1626575269UL, 2569947980UL, 120166892UL, 2961109404UL, 1280520333UL, 2601765059UL, 2550590348UL, 1491574373UL, 755823086UL, 1073889810UL, 3900360190UL, 396836243UL, +2417234534UL, 3036027780UL, 1754651820UL, 3848370775UL, 4113753945UL, 1038708316UL, 3784147349UL, 464826842UL, 594136009UL, 1679465955UL, 1127853612UL, 2128970592UL, 4198686893UL, 4234959779UL, 3670094401UL, 2810998507UL, 421961324UL, 416103731UL, 3724691332UL, 1428205363UL, 2351471476UL, 3407618159UL, 2637470915UL, 1435176883UL, 925973933UL, 3166951436UL, 1274860184UL, 2546319147UL, 4029854347UL, 3002516723UL, 1597712463UL, 671480036UL, +681365672UL, 1352519428UL, 13398705UL, 3919269221UL, 1150967289UL, 742849231UL, 3726033518UL, 2407091731UL, 2926199215UL, 3106945136UL, 1323833820UL, 584793525UL, 2706493003UL, 561190823UL, 2013357219UL, 3747238187UL, 3149885896UL, 3512276852UL, 2843032269UL, 3595347994UL, 3817319503UL, 4152622551UL, 4022346903UL, 331746013UL, 367216863UL, 99009902UL, 2670729696UL, 3290854172UL, 2251426444UL, 3130148315UL, 4199909720UL, 658184940UL, +518096293UL, 52156682UL, 3004378899UL, 1648201186UL, 3723004242UL, 2847276077UL, 1857504125UL, 253542783UL, 1394668680UL, 2783467746UL, 3122875931UL, 446601186UL, 1228837642UL, 2590549096UL, 2843506874UL, 745391893UL, 1404094021UL, 1324404436UL, 347299411UL, 645865358UL, 2862243948UL, 1204315994UL, 1455458347UL, 4028305509UL, 1924727700UL, 1905843757UL, 1483930049UL, 330348422UL, 2251238906UL, 1840668755UL, 1671024110UL, 4079375869UL, +606568968UL, 4080554282UL, 3886777251UL, 525214560UL, 1972466543UL, 1703103913UL, 3280177496UL, 2530126952UL, 1445252054UL, 2315649878UL, 3946153427UL, 2094983509UL, 1599103627UL, 899111545UL, 3946601974UL, 2053673584UL, 1446566513UL, 4070101360UL, 2379218430UL, 946001131UL, 4184236551UL, 2945613775UL, 2445126690UL, 2507004728UL, 4050415702UL, 3890831500UL, 2815036731UL, 2968121571UL, 340092998UL, 429296098UL, 228493148UL, 3298867574UL, +3901803457UL, 1134820236UL, 288696971UL, 2321943990UL, 3280367987UL, 1589814289UL, 1380146522UL, 646098313UL, 1765624343UL, 2536311658UL, 670777956UL, 3250735726UL, 3495239618UL, 1772431608UL, 3726225049UL, 4050232394UL, 741626628UL, 2451882102UL, 3386124330UL, 3460165725UL, 1132827700UL, 1626575269UL, 2569947980UL, 860947846UL, 2961109404UL, 1280520333UL, 2601765059UL, 2550590348UL, 2298495740UL, 755823086UL, 1073889810UL, 3900360190UL, +396836243UL, 2702634902UL, 3036027780UL, 1754651820UL, 3848370775UL, 4113753945UL, 3836550212UL, 3784147349UL, 464826842UL, 594136009UL, 1679465955UL, 1500399122UL, 2128970592UL, 4198686893UL, 4234959779UL, 3670094401UL, 1632934875UL, 421961324UL, 416103731UL, 3724691332UL, 1428205363UL, 2330377177UL, 3407618159UL, 2637470915UL, 1435176883UL, 925973933UL, 2558479866UL, 1274860184UL, 2546319147UL, 4029854347UL, 3002516723UL, 1331271216UL, +671480036UL, 681365672UL, 1352519428UL, 13398705UL, 1532459856UL, 1150967289UL, 742849231UL, 3726033518UL, 2407091731UL, 1766120506UL, 3106945136UL, 1323833820UL, 584793525UL, 2706493003UL, 3817434387UL, 2013357219UL, 3747238187UL, 3149885896UL, 3512276852UL, 203757UL, 3595347994UL, 3817319503UL, 4152622551UL, 4022346903UL, 3438004885UL, 367216863UL, 99009902UL, 2670729696UL, 3290854172UL, 1092092654UL, 3130148315UL, 4199909720UL, +658184940UL, 518096293UL, 982576981UL, 3004378899UL, 1648201186UL, 3723004242UL, 2847276077UL, 33113683UL, 253542783UL, 1394668680UL, 2783467746UL, 3122875931UL, 3109404671UL, 1228837642UL, 2590549096UL, 2843506874UL, 745391893UL, 809710525UL, 1324404436UL, 347299411UL, 645865358UL, 2862243948UL, 3652256751UL, 1455458347UL, 4028305509UL, 1924727700UL, 1905843757UL, 2035132481UL, 330348422UL, 2251238906UL, 1840668755UL, 1671024110UL, +3593348393UL, 4151905045UL, 3398483770UL, 611142788UL, 1798029112UL, 2747225670UL, 2894981396UL, 2117120651UL, 3087941624UL, 416876364UL, 700011792UL, 63929447UL, 822005210UL, 3483417647UL, 3513365134UL, 3071572873UL, 1925919001UL, 2778688996UL, 3079943255UL, 1252316311UL, 91270196UL, 3469862149UL, 156659741UL, 1342755036UL, 3821302858UL, 1790046971UL, 289329863UL, 1357914395UL, 4143182690UL, 2590503919UL, 3242437796UL, 1341085928UL, +2685277054UL, 727602392UL, 2581493226UL, 3216496864UL, 2171373196UL, 3767765187UL, 1895767358UL, 1029452326UL, 851913526UL, 1746266839UL, 3370323171UL, 648118190UL, 3244211645UL, 2623946928UL, 3859087079UL, 384443034UL, 2026989771UL, 802104797UL, 2201121552UL, 725742304UL, 1673563239UL, 4045658814UL, 2682764476UL, 3032306650UL, 2725871420UL, 3467522540UL, 534803010UL, 1135606913UL, 871336950UL, 937160030UL, 3384357161UL, 641566845UL, +2267407903UL, 331847343UL, 787968740UL, 2673012251UL, 2066357778UL, 2740382722UL, 1638377946UL, 2260504282UL, 3513172717UL, 238548903UL, 2203496688UL, 630532448UL, 3702112076UL, 2635952931UL, 3344713216UL, 139406056UL, 2369004628UL, 3547213209UL, 2944858950UL, 1231203228UL, 616949630UL, 2619739101UL, 89360251UL, 2364353701UL, 1025345607UL, 4177965685UL, 62274372UL, 3059207586UL, 3303376016UL, 2919795870UL, 3676526103UL, 2689781822UL, +1062293263UL, 2684605838UL, 863975243UL, 723728777UL, 1057919510UL, 1708017843UL, 4264127977UL, 3013938022UL, 3958746896UL, 328415103UL, 1117948849UL, 751056929UL, 2442147201UL, 1781170563UL, 765377308UL, 961452970UL, 4247303973UL, 2233034754UL, 86997820UL, 3495561473UL, 3075957349UL, 3152032365UL, 1220657606UL, 708134514UL, 26714613UL, 3749542051UL, 1640668224UL, 2252760600UL, 1635050662UL, 947216628UL, 3612773344UL, 4089189500UL, +3647048119UL, 979491227UL, 4149824933UL, 3160885292UL, 2808843788UL, 998859510UL, 3903167193UL, 1728999561UL, 3673946130UL, 279338980UL, 2507635299UL, 1614929524UL, 302060483UL, 2874453052UL, 3798613814UL, 2013436766UL, 3514754020UL, 2923162106UL, 2658720327UL, 3498579091UL, 3292220096UL, 3796129102UL, 1907288796UL, 2820663603UL, 4276052248UL, 247755133UL, 2088596201UL, 3154955976UL, 3309397641UL, 3606171919UL, 1356791029UL, 1030266022UL, +}, +{ +3868946146UL, 1938156793UL, 1877502872UL, 1408917625UL, 1549117911UL, 2465501566UL, 4218547770UL, 2942249332UL, 2731789075UL, 2366036899UL, 1312641799UL, 2243363271UL, 2238839307UL, 384814263UL, 1552361757UL, 3521369641UL, 431721717UL, 3089625732UL, 1023760034UL, 53847139UL, 2240881978UL, 3178046414UL, 145135653UL, 1580878781UL, 3500228040UL, 3360910006UL, 3285542950UL, 3330062556UL, 2870158227UL, 1481496810UL, 4222704363UL, 2973046526UL, +435155769UL, 3234730070UL, 3306545960UL, 2539776908UL, 3991420334UL, 125389349UL, 2397544348UL, 2504790975UL, 886432257UL, 1804136430UL, 1506551086UL, 219847214UL, 890282686UL, 1489840806UL, 2536942497UL, 87527661UL, 1822718904UL, 3984956867UL, 2334419518UL, 4065487054UL, 992104547UL, 1566792845UL, 1068226712UL, 2622731799UL, 921431708UL, 2833392639UL, 640267449UL, 324907409UL, 3911698049UL, 2108189994UL, 1623761598UL, 52771719UL, +467926435UL, 2811768106UL, 3760723083UL, 906402727UL, 3438479463UL, 2064004404UL, 988123982UL, 563076447UL, 2979641383UL, 1366086397UL, 2078608605UL, 3868491514UL, 1077957067UL, 615363273UL, 1388831706UL, 1586480552UL, 4216838311UL, 3587550780UL, 2057048927UL, 2814838921UL, 2454041809UL, 180612020UL, 930406098UL, 4286819113UL, 2756562967UL, 3404265234UL, 3844482428UL, 467484533UL, 4122644954UL, 3517116598UL, 1887163240UL, 4217569180UL, +4191149652UL, 2756931330UL, 3702787956UL, 152166773UL, 146763911UL, 536678737UL, 481385008UL, 3681433244UL, 1194909733UL, 3713568496UL, 3927837202UL, 846842608UL, 687314083UL, 1144793694UL, 1062075916UL, 3017627145UL, 1296695243UL, 981862419UL, 2363304726UL, 3242788356UL, 3359957762UL, 4249190787UL, 1697910336UL, 3286799886UL, 1063822293UL, 3246091430UL, 743808559UL, 2137668568UL, 2812072749UL, 2303791182UL, 3161789548UL, 2911126624UL, +4087873192UL, 1813622227UL, 1272618849UL, 1882292328UL, 3861455677UL, 2921641470UL, 3079812494UL, 2814569163UL, 1975646942UL, 2826176621UL, 1896904368UL, 831552834UL, 2935863403UL, 449217054UL, 3688067832UL, 1048877596UL, 1613227043UL, 553867520UL, 3682575786UL, 3058863948UL, 4200858129UL, 4131625UL, 2434123776UL, 2235627905UL, 2905358693UL, 3429312266UL, 3363231514UL, 1182242507UL, 2792234422UL, 1843330053UL, 4192875151UL, 1088813348UL, +357805687UL, 3868946146UL, 1938156793UL, 1877502872UL, 1408917625UL, 30638250UL, 2465501566UL, 4218547770UL, 2942249332UL, 2731789075UL, 448998968UL, 1312641799UL, 2243363271UL, 2238839307UL, 384814263UL, 2229663001UL, 3521369641UL, 431721717UL, 3089625732UL, 1023760034UL, 790771414UL, 2240881978UL, 3178046414UL, 145135653UL, 1580878781UL, 847577516UL, 3360910006UL, 3285542950UL, 3330062556UL, 2870158227UL, 112738978UL, 4222704363UL, +2973046526UL, 435155769UL, 3234730070UL, 1135073835UL, 2539776908UL, 3991420334UL, 125389349UL, 2397544348UL, 1243128255UL, 886432257UL, 1804136430UL, 1506551086UL, 219847214UL, 875051553UL, 1489840806UL, 2536942497UL, 87527661UL, 1822718904UL, 1883615145UL, 2334419518UL, 4065487054UL, 992104547UL, 1566792845UL, 1037132511UL, 2622731799UL, 921431708UL, 2833392639UL, 640267449UL, 504304037UL, 3911698049UL, 2108189994UL, 1623761598UL, +52771719UL, 3969520254UL, 2811768106UL, 3760723083UL, 906402727UL, 3438479463UL, 3707538496UL, 988123982UL, 563076447UL, 2979641383UL, 1366086397UL, 3577913613UL, 3868491514UL, 1077957067UL, 615363273UL, 1388831706UL, 903353909UL, 4216838311UL, 3587550780UL, 2057048927UL, 2814838921UL, 3532304828UL, 180612020UL, 930406098UL, 4286819113UL, 2756562967UL, 1950528802UL, 3844482428UL, 467484533UL, 4122644954UL, 3517116598UL, 139409766UL, +4217569180UL, 4191149652UL, 2756931330UL, 3702787956UL, 504815033UL, 146763911UL, 536678737UL, 481385008UL, 3681433244UL, 2166865052UL, 3713568496UL, 3927837202UL, 846842608UL, 687314083UL, 135403542UL, 1062075916UL, 3017627145UL, 1296695243UL, 981862419UL, 2405232584UL, 3242788356UL, 3359957762UL, 4249190787UL, 1697910336UL, 3517294012UL, 1063822293UL, 3246091430UL, 743808559UL, 2137668568UL, 2962825355UL, 2303791182UL, 3161789548UL, +2911126624UL, 4087873192UL, 2344237973UL, 1272618849UL, 1882292328UL, 3861455677UL, 2921641470UL, 1062672856UL, 2814569163UL, 1975646942UL, 2826176621UL, 1896904368UL, 3172875195UL, 2935863403UL, 449217054UL, 3688067832UL, 1048877596UL, 983648949UL, 553867520UL, 3682575786UL, 3058863948UL, 4200858129UL, 2552994282UL, 2434123776UL, 2235627905UL, 2905358693UL, 3429312266UL, 461707508UL, 1182242507UL, 2792234422UL, 1843330053UL, 4192875151UL, +2557078297UL, 357805687UL, 3868946146UL, 1938156793UL, 1877502872UL, 1178921294UL, 30638250UL, 2465501566UL, 4218547770UL, 2942249332UL, 2597087237UL, 448998968UL, 1312641799UL, 2243363271UL, 2238839307UL, 3465588695UL, 2229663001UL, 3521369641UL, 431721717UL, 3089625732UL, 2420359327UL, 790771414UL, 2240881978UL, 3178046414UL, 145135653UL, 3411014139UL, 847577516UL, 3360910006UL, 3285542950UL, 3330062556UL, 4257518865UL, 112738978UL, +4222704363UL, 2973046526UL, 435155769UL, 1154160505UL, 1135073835UL, 2539776908UL, 3991420334UL, 125389349UL, 1396475349UL, 1243128255UL, 886432257UL, 1804136430UL, 1506551086UL, 3727497731UL, 875051553UL, 1489840806UL, 2536942497UL, 87527661UL, 2521823325UL, 1883615145UL, 2334419518UL, 4065487054UL, 992104547UL, 3431387970UL, 1037132511UL, 2622731799UL, 921431708UL, 2833392639UL, 780276883UL, 504304037UL, 3911698049UL, 2108189994UL, +1623761598UL, 1832564202UL, 3969520254UL, 2811768106UL, 3760723083UL, 906402727UL, 2319993554UL, 3707538496UL, 988123982UL, 563076447UL, 2979641383UL, 3703509163UL, 3577913613UL, 3868491514UL, 1077957067UL, 615363273UL, 3925135746UL, 903353909UL, 4216838311UL, 3587550780UL, 2057048927UL, 2129250845UL, 3532304828UL, 180612020UL, 930406098UL, 4286819113UL, 571849466UL, 1950528802UL, 3844482428UL, 467484533UL, 4122644954UL, 3696836546UL, +139409766UL, 4217569180UL, 4191149652UL, 2756931330UL, 84389584UL, 504815033UL, 146763911UL, 536678737UL, 481385008UL, 281139563UL, 2166865052UL, 3713568496UL, 3927837202UL, 846842608UL, 2123715146UL, 135403542UL, 1062075916UL, 3017627145UL, 1296695243UL, 4206227732UL, 2405232584UL, 3242788356UL, 3359957762UL, 4249190787UL, 2766470555UL, 3517294012UL, 1063822293UL, 3246091430UL, 743808559UL, 2821229002UL, 2962825355UL, 2303791182UL, +3161789548UL, 2911126624UL, 503886017UL, 2344237973UL, 1272618849UL, 1882292328UL, 3861455677UL, 4158985014UL, 1062672856UL, 2814569163UL, 1975646942UL, 2826176621UL, 4118784229UL, 3172875195UL, 2935863403UL, 449217054UL, 3688067832UL, 3556237148UL, 983648949UL, 553867520UL, 3682575786UL, 3058863948UL, 3200838331UL, 2552994282UL, 2434123776UL, 2235627905UL, 2905358693UL, 4178312045UL, 461707508UL, 1182242507UL, 2792234422UL, 1843330053UL, +3597816691UL, 2557078297UL, 357805687UL, 3868946146UL, 1938156793UL, 2168462050UL, 1178921294UL, 30638250UL, 2465501566UL, 4218547770UL, 4101101381UL, 2597087237UL, 448998968UL, 1312641799UL, 2243363271UL, 313553894UL, 3465588695UL, 2229663001UL, 3521369641UL, 431721717UL, 737541534UL, 2420359327UL, 790771414UL, 2240881978UL, 3178046414UL, 326569272UL, 3411014139UL, 847577516UL, 3360910006UL, 3285542950UL, 3098408987UL, 4257518865UL, +112738978UL, 4222704363UL, 2973046526UL, 3668411828UL, 1154160505UL, 1135073835UL, 2539776908UL, 3991420334UL, 2902976896UL, 1396475349UL, 1243128255UL, 886432257UL, 1804136430UL, 2162242501UL, 3727497731UL, 875051553UL, 1489840806UL, 2536942497UL, 2238214198UL, 2521823325UL, 1883615145UL, 2334419518UL, 4065487054UL, 1081167745UL, 3431387970UL, 1037132511UL, 2622731799UL, 921431708UL, 2612105434UL, 780276883UL, 504304037UL, 3911698049UL, +2108189994UL, 2518535877UL, 1832564202UL, 3969520254UL, 2811768106UL, 3760723083UL, 2894544992UL, 2319993554UL, 3707538496UL, 988123982UL, 563076447UL, 719340658UL, 3703509163UL, 3577913613UL, 3868491514UL, 1077957067UL, 2371417985UL, 3925135746UL, 903353909UL, 4216838311UL, 3587550780UL, 3146473377UL, 2129250845UL, 3532304828UL, 180612020UL, 930406098UL, 1054512059UL, 571849466UL, 1950528802UL, 3844482428UL, 467484533UL, 1437844285UL, +3696836546UL, 139409766UL, 4217569180UL, 4191149652UL, 1161452915UL, 84389584UL, 504815033UL, 146763911UL, 536678737UL, 3965987378UL, 281139563UL, 2166865052UL, 3713568496UL, 3927837202UL, 2566873330UL, 2123715146UL, 135403542UL, 1062075916UL, 3017627145UL, 3204726297UL, 4206227732UL, 2405232584UL, 3242788356UL, 3359957762UL, 2338319494UL, 2766470555UL, 3517294012UL, 1063822293UL, 3246091430UL, 1531757306UL, 2821229002UL, 2962825355UL, +2303791182UL, 3161789548UL, 2778326467UL, 503886017UL, 2344237973UL, 1272618849UL, 1882292328UL, 1725075819UL, 4158985014UL, 1062672856UL, 2814569163UL, 1975646942UL, 3822868823UL, 4118784229UL, 3172875195UL, 2935863403UL, 449217054UL, 2465297154UL, 3556237148UL, 983648949UL, 553867520UL, 3682575786UL, 4023654874UL, 3200838331UL, 2552994282UL, 2434123776UL, 2235627905UL, 3063253867UL, 4178312045UL, 461707508UL, 1182242507UL, 2792234422UL, +3673318927UL, 1249828417UL, 2772427670UL, 1052324962UL, 3106530204UL, 2843183862UL, 630633945UL, 4140139503UL, 1659674037UL, 1096812757UL, 1376150732UL, 2328468653UL, 1410746620UL, 4025107990UL, 3335632421UL, 2754906610UL, 1615859006UL, 285467698UL, 4013475548UL, 1287384555UL, 1191111485UL, 1999165134UL, 2396354947UL, 1628158236UL, 3586708909UL, 228664781UL, 2501369720UL, 2516229872UL, 2977432606UL, 1745869751UL, 750661412UL, 1142144084UL, +2705268946UL, 1728488244UL, 589587862UL, 3604281130UL, 3217245915UL, 2061424631UL, 1918958878UL, 1162850007UL, 438550637UL, 1774088146UL, 3237803593UL, 827476363UL, 404982536UL, 2344744845UL, 3416436851UL, 369597250UL, 287618335UL, 1349740180UL, 3489688427UL, 417859991UL, 3229729092UL, 3214122057UL, 3955335849UL, 3014669381UL, 2178319957UL, 1259991234UL, 2689513541UL, 2628816894UL, 3734652479UL, 4202568782UL, 3149274749UL, 497295490UL, +3427602420UL, 3229774907UL, 59257138UL, 856364156UL, 429586733UL, 1800559699UL, 1300239050UL, 1311125646UL, 257421988UL, 3749074142UL, 1648939149UL, 1914174865UL, 105489877UL, 3599116888UL, 2695725484UL, 1543985792UL, 3210070699UL, 1867126432UL, 3088920410UL, 953084407UL, 2185095866UL, 1427606476UL, 1572442276UL, 3322674991UL, 3578824788UL, 1156246244UL, 2938200612UL, 3409545464UL, 215820858UL, 2279282461UL, 3861049095UL, 1589517366UL, +208707366UL, 2741570297UL, 440313302UL, 864288468UL, 1564945290UL, 1050929272UL, 3037450392UL, 1101323242UL, 1200278943UL, 3005564105UL, 3847988630UL, 3251750599UL, 2608433412UL, 3106720723UL, 1522694503UL, 3857782840UL, 4282681349UL, 2229263718UL, 4106780914UL, 125648941UL, 1933617693UL, 2971178569UL, 3537872030UL, 448962137UL, 652123777UL, 2393871920UL, 3938047691UL, 244410098UL, 3110791961UL, 3122318189UL, 877378106UL, 3683644255UL, +4279094311UL, 3638987055UL, 667681197UL, 1679868535UL, 1938378101UL, 1331340184UL, 734163051UL, 3409564713UL, 955108672UL, 3969637663UL, 156515523UL, 1871394552UL, 590275639UL, 3237133664UL, 898438533UL, 2291347006UL, 644781653UL, 3575493549UL, 1206698159UL, 2484805619UL, 2931447110UL, 2411269190UL, 3866437145UL, 161562563UL, 3077166456UL, 792874130UL, 3193406610UL, 2500233218UL, 596837225UL, 3667458052UL, 3239960816UL, 2271901243UL, +}, +{ +3975736867UL, 2402230281UL, 4092718962UL, 3100052505UL, 3277909563UL, 2827154828UL, 1067483357UL, 3495429909UL, 426635932UL, 2702495453UL, 725679489UL, 3705541400UL, 1308182381UL, 27549785UL, 3000675918UL, 2982141597UL, 1090931027UL, 755020243UL, 3986354189UL, 2529541113UL, 452574019UL, 2384876926UL, 2147764179UL, 1360907484UL, 2072364695UL, 3034185952UL, 2765119653UL, 3279755577UL, 3828140333UL, 582568392UL, 4228353628UL, 701214306UL, +2460043371UL, 3943376509UL, 2443090800UL, 2481277520UL, 859309333UL, 2928621220UL, 1933644685UL, 3803162893UL, 3310629548UL, 2361261213UL, 790233558UL, 2517540072UL, 2823327610UL, 2952921690UL, 3295251862UL, 1089451775UL, 2637751681UL, 1648031370UL, 1343061717UL, 2355026672UL, 67684812UL, 4019593497UL, 2636283634UL, 1051433451UL, 51111285UL, 15338687UL, 3779021741UL, 3987886044UL, 70037785UL, 2009147353UL, 4236701871UL, 928261128UL, +2185183571UL, 2793993680UL, 2975111058UL, 3730415022UL, 3316612678UL, 823585671UL, 4153354125UL, 509071385UL, 2056228251UL, 4034784810UL, 96820040UL, 169863045UL, 932848332UL, 2282651407UL, 747279843UL, 1387211022UL, 2410099142UL, 3394315084UL, 3191572807UL, 4073182500UL, 3768455462UL, 3712420663UL, 3000991259UL, 249137656UL, 2477445202UL, 3952155443UL, 392730170UL, 4208559971UL, 24751401UL, 661761054UL, 1574175475UL, 2715927647UL, +985309803UL, 2570053358UL, 619269634UL, 3890591314UL, 1129119636UL, 3133886450UL, 328788870UL, 3449809720UL, 1380118080UL, 2719792059UL, 691527418UL, 3487733607UL, 3819095050UL, 3367871088UL, 709089170UL, 1057897966UL, 1938975941UL, 4082466714UL, 251564920UL, 3083496965UL, 1040123365UL, 295024253UL, 2788334176UL, 3430095934UL, 3641758945UL, 2029993123UL, 3231254260UL, 150555625UL, 2270671577UL, 2032382533UL, 2088497043UL, 1392075576UL, +644811077UL, 2122632989UL, 3224165725UL, 1571908345UL, 2558692460UL, 1493305706UL, 4064652450UL, 448105905UL, 699188129UL, 2017324335UL, 4286307548UL, 2415725473UL, 3976741021UL, 3526784185UL, 2882973520UL, 3420335125UL, 2034028744UL, 1425242390UL, 982315917UL, 2614735561UL, 2439972944UL, 2518992720UL, 3792239985UL, 3260669732UL, 2586472751UL, 3432756715UL, 1318634102UL, 3722487277UL, 3037304631UL, 433233786UL, 3750002877UL, 2504731459UL, +1111327015UL, 3975736867UL, 2402230281UL, 4092718962UL, 3100052505UL, 3521430425UL, 2827154828UL, 1067483357UL, 3495429909UL, 426635932UL, 2034644068UL, 725679489UL, 3705541400UL, 1308182381UL, 27549785UL, 3001720496UL, 2982141597UL, 1090931027UL, 755020243UL, 3986354189UL, 307638580UL, 452574019UL, 2384876926UL, 2147764179UL, 1360907484UL, 1701580099UL, 3034185952UL, 2765119653UL, 3279755577UL, 3828140333UL, 2659043235UL, 4228353628UL, +701214306UL, 2460043371UL, 3943376509UL, 2084857792UL, 2481277520UL, 859309333UL, 2928621220UL, 1933644685UL, 4152646669UL, 3310629548UL, 2361261213UL, 790233558UL, 2517540072UL, 481283060UL, 2952921690UL, 3295251862UL, 1089451775UL, 2637751681UL, 2915212660UL, 1343061717UL, 2355026672UL, 67684812UL, 4019593497UL, 3290479436UL, 1051433451UL, 51111285UL, 15338687UL, 3779021741UL, 1430944862UL, 70037785UL, 2009147353UL, 4236701871UL, +928261128UL, 2063919641UL, 2793993680UL, 2975111058UL, 3730415022UL, 3316612678UL, 2373806232UL, 4153354125UL, 509071385UL, 2056228251UL, 4034784810UL, 1912268707UL, 169863045UL, 932848332UL, 2282651407UL, 747279843UL, 3712980941UL, 2410099142UL, 3394315084UL, 3191572807UL, 4073182500UL, 4262344652UL, 3712420663UL, 3000991259UL, 249137656UL, 2477445202UL, 3374467273UL, 392730170UL, 4208559971UL, 24751401UL, 661761054UL, 1670592959UL, +2715927647UL, 985309803UL, 2570053358UL, 619269634UL, 830547082UL, 1129119636UL, 3133886450UL, 328788870UL, 3449809720UL, 202644333UL, 2719792059UL, 691527418UL, 3487733607UL, 3819095050UL, 1400269159UL, 709089170UL, 1057897966UL, 1938975941UL, 4082466714UL, 3393893128UL, 3083496965UL, 1040123365UL, 295024253UL, 2788334176UL, 1219456UL, 3641758945UL, 2029993123UL, 3231254260UL, 150555625UL, 3713963210UL, 2032382533UL, 2088497043UL, +1392075576UL, 644811077UL, 3733090890UL, 3224165725UL, 1571908345UL, 2558692460UL, 1493305706UL, 1678929187UL, 448105905UL, 699188129UL, 2017324335UL, 4286307548UL, 3368868963UL, 3976741021UL, 3526784185UL, 2882973520UL, 3420335125UL, 3233347584UL, 1425242390UL, 982315917UL, 2614735561UL, 2439972944UL, 4172908214UL, 3792239985UL, 3260669732UL, 2586472751UL, 3432756715UL, 1926157640UL, 3722487277UL, 3037304631UL, 433233786UL, 3750002877UL, +625648993UL, 1111327015UL, 3975736867UL, 2402230281UL, 4092718962UL, 1349560774UL, 3521430425UL, 2827154828UL, 1067483357UL, 3495429909UL, 2808148912UL, 2034644068UL, 725679489UL, 3705541400UL, 1308182381UL, 212242504UL, 3001720496UL, 2982141597UL, 1090931027UL, 755020243UL, 2510536004UL, 307638580UL, 452574019UL, 2384876926UL, 2147764179UL, 3227931749UL, 1701580099UL, 3034185952UL, 2765119653UL, 3279755577UL, 1054678914UL, 2659043235UL, +4228353628UL, 701214306UL, 2460043371UL, 381309305UL, 2084857792UL, 2481277520UL, 859309333UL, 2928621220UL, 891630344UL, 4152646669UL, 3310629548UL, 2361261213UL, 790233558UL, 1490030690UL, 481283060UL, 2952921690UL, 3295251862UL, 1089451775UL, 2025962691UL, 2915212660UL, 1343061717UL, 2355026672UL, 67684812UL, 2217081575UL, 3290479436UL, 1051433451UL, 51111285UL, 15338687UL, 3455020635UL, 1430944862UL, 70037785UL, 2009147353UL, +4236701871UL, 1155691935UL, 2063919641UL, 2793993680UL, 2975111058UL, 3730415022UL, 403147571UL, 2373806232UL, 4153354125UL, 509071385UL, 2056228251UL, 444685935UL, 1912268707UL, 169863045UL, 932848332UL, 2282651407UL, 2077207745UL, 3712980941UL, 2410099142UL, 3394315084UL, 3191572807UL, 640536184UL, 4262344652UL, 3712420663UL, 3000991259UL, 249137656UL, 368243227UL, 3374467273UL, 392730170UL, 4208559971UL, 24751401UL, 495648080UL, +1670592959UL, 2715927647UL, 985309803UL, 2570053358UL, 2181488546UL, 830547082UL, 1129119636UL, 3133886450UL, 328788870UL, 2497762979UL, 202644333UL, 2719792059UL, 691527418UL, 3487733607UL, 1976943620UL, 1400269159UL, 709089170UL, 1057897966UL, 1938975941UL, 2071351862UL, 3393893128UL, 3083496965UL, 1040123365UL, 295024253UL, 1440317859UL, 1219456UL, 3641758945UL, 2029993123UL, 3231254260UL, 952956380UL, 3713963210UL, 2032382533UL, +2088497043UL, 1392075576UL, 4180475645UL, 3733090890UL, 3224165725UL, 1571908345UL, 2558692460UL, 3482549931UL, 1678929187UL, 448105905UL, 699188129UL, 2017324335UL, 2431113987UL, 3368868963UL, 3976741021UL, 3526784185UL, 2882973520UL, 1900625235UL, 3233347584UL, 1425242390UL, 982315917UL, 2614735561UL, 1128074864UL, 4172908214UL, 3792239985UL, 3260669732UL, 2586472751UL, 4095880420UL, 1926157640UL, 3722487277UL, 3037304631UL, 433233786UL, +2927295412UL, 625648993UL, 1111327015UL, 3975736867UL, 2402230281UL, 259216032UL, 1349560774UL, 3521430425UL, 2827154828UL, 1067483357UL, 989690947UL, 2808148912UL, 2034644068UL, 725679489UL, 3705541400UL, 588787520UL, 212242504UL, 3001720496UL, 2982141597UL, 1090931027UL, 1235811382UL, 2510536004UL, 307638580UL, 452574019UL, 2384876926UL, 3536994565UL, 3227931749UL, 1701580099UL, 3034185952UL, 2765119653UL, 463890041UL, 1054678914UL, +2659043235UL, 4228353628UL, 701214306UL, 3085494195UL, 381309305UL, 2084857792UL, 2481277520UL, 859309333UL, 3760199179UL, 891630344UL, 4152646669UL, 3310629548UL, 2361261213UL, 2550680915UL, 1490030690UL, 481283060UL, 2952921690UL, 3295251862UL, 4195487760UL, 2025962691UL, 2915212660UL, 1343061717UL, 2355026672UL, 339445869UL, 2217081575UL, 3290479436UL, 1051433451UL, 51111285UL, 1113202216UL, 3455020635UL, 1430944862UL, 70037785UL, +2009147353UL, 3982848623UL, 1155691935UL, 2063919641UL, 2793993680UL, 2975111058UL, 1725337613UL, 403147571UL, 2373806232UL, 4153354125UL, 509071385UL, 1474832043UL, 444685935UL, 1912268707UL, 169863045UL, 932848332UL, 1500855137UL, 2077207745UL, 3712980941UL, 2410099142UL, 3394315084UL, 2800379966UL, 640536184UL, 4262344652UL, 3712420663UL, 3000991259UL, 1028021485UL, 368243227UL, 3374467273UL, 392730170UL, 4208559971UL, 108468246UL, +495648080UL, 1670592959UL, 2715927647UL, 985309803UL, 61959589UL, 2181488546UL, 830547082UL, 1129119636UL, 3133886450UL, 3912020361UL, 2497762979UL, 202644333UL, 2719792059UL, 691527418UL, 1984193076UL, 1976943620UL, 1400269159UL, 709089170UL, 1057897966UL, 2381612490UL, 2071351862UL, 3393893128UL, 3083496965UL, 1040123365UL, 391784014UL, 1440317859UL, 1219456UL, 3641758945UL, 2029993123UL, 2260373342UL, 952956380UL, 3713963210UL, +2032382533UL, 2088497043UL, 135943164UL, 4180475645UL, 3733090890UL, 3224165725UL, 1571908345UL, 2660287325UL, 3482549931UL, 1678929187UL, 448105905UL, 699188129UL, 4104693318UL, 2431113987UL, 3368868963UL, 3976741021UL, 3526784185UL, 113762138UL, 1900625235UL, 3233347584UL, 1425242390UL, 982315917UL, 599246177UL, 1128074864UL, 4172908214UL, 3792239985UL, 3260669732UL, 2309689974UL, 4095880420UL, 1926157640UL, 3722487277UL, 3037304631UL, +3765223460UL, 866296319UL, 1169380319UL, 2919436659UL, 3370646420UL, 1866719277UL, 3226685069UL, 4252262342UL, 1835269960UL, 1170376930UL, 1357078768UL, 269175192UL, 3826888026UL, 3430363541UL, 1920758494UL, 51532769UL, 2919489927UL, 1568325914UL, 3184357856UL, 43519013UL, 2108988015UL, 1398495041UL, 2844640139UL, 2317092036UL, 1774750014UL, 2690907136UL, 1834465421UL, 1106469655UL, 2149810726UL, 4265420439UL, 2048218411UL, 1399986034UL, +1361619115UL, 2504769226UL, 913700780UL, 2382994726UL, 4292849877UL, 1381838410UL, 250258264UL, 1828569640UL, 1732718872UL, 1869949326UL, 835188347UL, 4180489913UL, 3049522050UL, 535168392UL, 3972173823UL, 2763844722UL, 3401884753UL, 3750694101UL, 851518496UL, 1015521371UL, 1511969218UL, 1597622074UL, 3810841601UL, 3326003776UL, 3141062630UL, 552856274UL, 4059179808UL, 175647012UL, 3893497501UL, 1805118717UL, 1064213711UL, 2310866839UL, +1397146463UL, 1798096676UL, 279868399UL, 1926726615UL, 2773068510UL, 347721208UL, 4099183723UL, 509136218UL, 2833615756UL, 3960499694UL, 4236258712UL, 1765641675UL, 535748563UL, 354515646UL, 3307314159UL, 3160079941UL, 3252681800UL, 2568363625UL, 3818514182UL, 3738662353UL, 899056999UL, 2531772068UL, 647726503UL, 2895823632UL, 393777910UL, 1759531813UL, 2363148604UL, 2931477989UL, 3381169914UL, 3877595131UL, 2375539210UL, 557544627UL, +273611522UL, 2717517554UL, 1935966767UL, 1738732887UL, 29153600UL, 20993454UL, 3758163226UL, 1692844400UL, 2176938194UL, 378940221UL, 2888599759UL, 1173120554UL, 2732575460UL, 3912766812UL, 522606644UL, 1925230852UL, 3887440328UL, 2111843275UL, 3549473366UL, 922916775UL, 2889744544UL, 2970467682UL, 3039277863UL, 990580154UL, 55435595UL, 1665634070UL, 3043418336UL, 2792050230UL, 2762503138UL, 1402344059UL, 2099263558UL, 3945248675UL, +3925566467UL, 2413979948UL, 463637252UL, 3768636616UL, 3374572388UL, 2217956879UL, 791988933UL, 382210765UL, 1715859444UL, 3462446413UL, 971427992UL, 3255404695UL, 2001750035UL, 2214129237UL, 320812374UL, 3688098101UL, 920365480UL, 2819401059UL, 2932570681UL, 3749857130UL, 523943786UL, 1271514748UL, 4078439472UL, 3501181265UL, 2475869985UL, 1797996951UL, 2300820710UL, 3994893924UL, 1739992082UL, 2475950326UL, 3780826558UL, 1018851411UL, +}, + +}; +#endif +CURAND_XORWOW_PRECALCULATED_DEVICE_QUALIFIERS unsigned int precalc_xorwow_offset_matrix[32][800] = { +{ +0UL, 0UL, 0UL, 0UL, 3UL, 0UL, 0UL, 0UL, 0UL, 6UL, 0UL, 0UL, 0UL, 0UL, 15UL, 0UL, 0UL, 0UL, 0UL, 30UL, 0UL, 0UL, 0UL, 0UL, 60UL, 0UL, 0UL, 0UL, 0UL, 120UL, 0UL, 0UL, +0UL, 0UL, 240UL, 0UL, 0UL, 0UL, 0UL, 480UL, 0UL, 0UL, 0UL, 0UL, 960UL, 0UL, 0UL, 0UL, 0UL, 1920UL, 0UL, 0UL, 0UL, 0UL, 3840UL, 0UL, 0UL, 0UL, 0UL, 7680UL, 0UL, 0UL, 0UL, 0UL, +15360UL, 0UL, 0UL, 0UL, 0UL, 30720UL, 0UL, 0UL, 0UL, 0UL, 61440UL, 0UL, 0UL, 0UL, 0UL, 122880UL, 0UL, 0UL, 0UL, 0UL, 245760UL, 0UL, 0UL, 0UL, 0UL, 491520UL, 0UL, 0UL, 0UL, 0UL, 983040UL, 0UL, +0UL, 0UL, 0UL, 1966080UL, 0UL, 0UL, 0UL, 0UL, 3932160UL, 0UL, 0UL, 0UL, 0UL, 7864320UL, 0UL, 0UL, 0UL, 0UL, 15728640UL, 0UL, 0UL, 0UL, 0UL, 31457280UL, 0UL, 0UL, 0UL, 0UL, 62914560UL, 0UL, 0UL, 0UL, +0UL, 125829120UL, 0UL, 0UL, 0UL, 0UL, 251658240UL, 0UL, 0UL, 0UL, 0UL, 503316480UL, 0UL, 0UL, 0UL, 0UL, 1006632960UL, 0UL, 0UL, 0UL, 0UL, 2013265920UL, 0UL, 0UL, 0UL, 0UL, 4026531840UL, 0UL, 0UL, 0UL, 0UL, 3758096384UL, +1UL, 0UL, 0UL, 0UL, 0UL, 2UL, 0UL, 0UL, 0UL, 0UL, 4UL, 0UL, 0UL, 0UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 16UL, 0UL, 0UL, 0UL, 0UL, 32UL, 0UL, 0UL, 0UL, 0UL, 64UL, 0UL, +0UL, 0UL, 0UL, 128UL, 0UL, 0UL, 0UL, 0UL, 256UL, 0UL, 0UL, 0UL, 0UL, 512UL, 0UL, 0UL, 0UL, 0UL, 1024UL, 0UL, 0UL, 0UL, 0UL, 2048UL, 0UL, 0UL, 0UL, 0UL, 4096UL, 0UL, 0UL, 0UL, +0UL, 8192UL, 0UL, 0UL, 0UL, 0UL, 16384UL, 0UL, 0UL, 0UL, 0UL, 32768UL, 0UL, 0UL, 0UL, 0UL, 65536UL, 0UL, 0UL, 0UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 262144UL, 0UL, 0UL, 0UL, 0UL, 524288UL, +0UL, 0UL, 0UL, 0UL, 1048576UL, 0UL, 0UL, 0UL, 0UL, 2097152UL, 0UL, 0UL, 0UL, 0UL, 4194304UL, 0UL, 0UL, 0UL, 0UL, 8388608UL, 0UL, 0UL, 0UL, 0UL, 16777216UL, 0UL, 0UL, 0UL, 0UL, 33554432UL, 0UL, 0UL, +0UL, 0UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 134217728UL, 0UL, 0UL, 0UL, 0UL, 268435456UL, 0UL, 0UL, 0UL, 0UL, 536870912UL, 0UL, 0UL, 0UL, 0UL, 1073741824UL, 0UL, 0UL, 0UL, 0UL, 2147483648UL, 0UL, 0UL, 0UL, 0UL, +0UL, 1UL, 0UL, 0UL, 0UL, 0UL, 2UL, 0UL, 0UL, 0UL, 0UL, 4UL, 0UL, 0UL, 0UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 16UL, 0UL, 0UL, 0UL, 0UL, 32UL, 0UL, 0UL, 0UL, 0UL, 64UL, +0UL, 0UL, 0UL, 0UL, 128UL, 0UL, 0UL, 0UL, 0UL, 256UL, 0UL, 0UL, 0UL, 0UL, 512UL, 0UL, 0UL, 0UL, 0UL, 1024UL, 0UL, 0UL, 0UL, 0UL, 2048UL, 0UL, 0UL, 0UL, 0UL, 4096UL, 0UL, 0UL, +0UL, 0UL, 8192UL, 0UL, 0UL, 0UL, 0UL, 16384UL, 0UL, 0UL, 0UL, 0UL, 32768UL, 0UL, 0UL, 0UL, 0UL, 65536UL, 0UL, 0UL, 0UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 262144UL, 0UL, 0UL, 0UL, 0UL, +524288UL, 0UL, 0UL, 0UL, 0UL, 1048576UL, 0UL, 0UL, 0UL, 0UL, 2097152UL, 0UL, 0UL, 0UL, 0UL, 4194304UL, 0UL, 0UL, 0UL, 0UL, 8388608UL, 0UL, 0UL, 0UL, 0UL, 16777216UL, 0UL, 0UL, 0UL, 0UL, 33554432UL, 0UL, +0UL, 0UL, 0UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 134217728UL, 0UL, 0UL, 0UL, 0UL, 268435456UL, 0UL, 0UL, 0UL, 0UL, 536870912UL, 0UL, 0UL, 0UL, 0UL, 1073741824UL, 0UL, 0UL, 0UL, 0UL, 2147483648UL, 0UL, 0UL, 0UL, +0UL, 0UL, 1UL, 0UL, 0UL, 0UL, 0UL, 2UL, 0UL, 0UL, 0UL, 0UL, 4UL, 0UL, 0UL, 0UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 16UL, 0UL, 0UL, 0UL, 0UL, 32UL, 0UL, 0UL, 0UL, 0UL, +64UL, 0UL, 0UL, 0UL, 0UL, 128UL, 0UL, 0UL, 0UL, 0UL, 256UL, 0UL, 0UL, 0UL, 0UL, 512UL, 0UL, 0UL, 0UL, 0UL, 1024UL, 0UL, 0UL, 0UL, 0UL, 2048UL, 0UL, 0UL, 0UL, 0UL, 4096UL, 0UL, +0UL, 0UL, 0UL, 8192UL, 0UL, 0UL, 0UL, 0UL, 16384UL, 0UL, 0UL, 0UL, 0UL, 32768UL, 0UL, 0UL, 0UL, 0UL, 65536UL, 0UL, 0UL, 0UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 262144UL, 0UL, 0UL, 0UL, +0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 1048576UL, 0UL, 0UL, 0UL, 0UL, 2097152UL, 0UL, 0UL, 0UL, 0UL, 4194304UL, 0UL, 0UL, 0UL, 0UL, 8388608UL, 0UL, 0UL, 0UL, 0UL, 16777216UL, 0UL, 0UL, 0UL, 0UL, 33554432UL, +0UL, 0UL, 0UL, 0UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 134217728UL, 0UL, 0UL, 0UL, 0UL, 268435456UL, 0UL, 0UL, 0UL, 0UL, 536870912UL, 0UL, 0UL, 0UL, 0UL, 1073741824UL, 0UL, 0UL, 0UL, 0UL, 2147483648UL, 0UL, 0UL, +0UL, 0UL, 0UL, 1UL, 17UL, 0UL, 0UL, 0UL, 2UL, 34UL, 0UL, 0UL, 0UL, 4UL, 68UL, 0UL, 0UL, 0UL, 8UL, 136UL, 0UL, 0UL, 0UL, 16UL, 272UL, 0UL, 0UL, 0UL, 32UL, 544UL, 0UL, 0UL, +0UL, 64UL, 1088UL, 0UL, 0UL, 0UL, 128UL, 2176UL, 0UL, 0UL, 0UL, 256UL, 4352UL, 0UL, 0UL, 0UL, 512UL, 8704UL, 0UL, 0UL, 0UL, 1024UL, 17408UL, 0UL, 0UL, 0UL, 2048UL, 34816UL, 0UL, 0UL, 0UL, 4096UL, +69632UL, 0UL, 0UL, 0UL, 8192UL, 139264UL, 0UL, 0UL, 0UL, 16384UL, 278528UL, 0UL, 0UL, 0UL, 32768UL, 557056UL, 0UL, 0UL, 0UL, 65536UL, 1114112UL, 0UL, 0UL, 0UL, 131072UL, 2228224UL, 0UL, 0UL, 0UL, 262144UL, 4456448UL, 0UL, +0UL, 0UL, 524288UL, 8912896UL, 0UL, 0UL, 0UL, 1048576UL, 17825792UL, 0UL, 0UL, 0UL, 2097152UL, 35651584UL, 0UL, 0UL, 0UL, 4194304UL, 71303168UL, 0UL, 0UL, 0UL, 8388608UL, 142606336UL, 0UL, 0UL, 0UL, 16777216UL, 285212672UL, 0UL, 0UL, 0UL, +33554432UL, 570425344UL, 0UL, 0UL, 0UL, 67108864UL, 1140850688UL, 0UL, 0UL, 0UL, 134217728UL, 2281701376UL, 0UL, 0UL, 0UL, 268435456UL, 268435456UL, 0UL, 0UL, 0UL, 536870912UL, 536870912UL, 0UL, 0UL, 0UL, 1073741824UL, 1073741824UL, 0UL, 0UL, 0UL, 2147483648UL, 2147483648UL, +}, +{ +0UL, 3UL, 51UL, 771UL, 13107UL, 0UL, 6UL, 102UL, 1542UL, 26214UL, 0UL, 15UL, 255UL, 3855UL, 65535UL, 0UL, 30UL, 510UL, 7710UL, 131070UL, 0UL, 60UL, 1020UL, 15420UL, 262140UL, 0UL, 120UL, 2040UL, 30840UL, 524280UL, 0UL, 240UL, +4080UL, 61680UL, 1048560UL, 0UL, 480UL, 8160UL, 123360UL, 2097120UL, 0UL, 960UL, 16320UL, 246720UL, 4194240UL, 0UL, 1920UL, 32640UL, 493440UL, 8388480UL, 0UL, 3840UL, 65280UL, 986880UL, 16776960UL, 0UL, 7680UL, 130560UL, 1973760UL, 33553920UL, 0UL, 15360UL, 261120UL, 3947520UL, +67107840UL, 0UL, 30720UL, 522240UL, 7895040UL, 134215680UL, 0UL, 61440UL, 1044480UL, 15790080UL, 268431360UL, 0UL, 122880UL, 2088960UL, 31580160UL, 536862720UL, 0UL, 245760UL, 4177920UL, 63160320UL, 1073725440UL, 0UL, 491520UL, 8355840UL, 126320640UL, 2147450880UL, 0UL, 983040UL, 16711680UL, 252641280UL, 4294901760UL, 0UL, +1966080UL, 33423360UL, 505282560UL, 4294836224UL, 0UL, 3932160UL, 66846720UL, 1010565120UL, 4294705152UL, 0UL, 7864320UL, 133693440UL, 2021130240UL, 4294443008UL, 0UL, 15728640UL, 267386880UL, 4042260480UL, 4293918720UL, 0UL, 31457280UL, 534773760UL, 3789553664UL, 4292870144UL, 0UL, 62914560UL, 1069547520UL, 3284140032UL, 4290772992UL, 0UL, 125829120UL, 2139095040UL, +2273312768UL, 4286578688UL, 0UL, 251658240UL, 4278190080UL, 251658240UL, 4278190080UL, 0UL, 503316480UL, 4261412864UL, 503316480UL, 4261412864UL, 0UL, 1006632960UL, 4227858432UL, 1006632960UL, 4227858432UL, 0UL, 2013265920UL, 4160749568UL, 2013265920UL, 4160749568UL, 0UL, 4026531840UL, 4026531840UL, 4026531840UL, 4026531840UL, 0UL, 3758096384UL, 3758096384UL, 3758096384UL, 3758096384UL, +0UL, 0UL, 3UL, 51UL, 771UL, 0UL, 0UL, 6UL, 102UL, 1542UL, 0UL, 0UL, 15UL, 255UL, 3855UL, 0UL, 0UL, 30UL, 510UL, 7710UL, 0UL, 0UL, 60UL, 1020UL, 15420UL, 0UL, 0UL, 120UL, 2040UL, 30840UL, 0UL, 0UL, +240UL, 4080UL, 61680UL, 0UL, 0UL, 480UL, 8160UL, 123360UL, 0UL, 0UL, 960UL, 16320UL, 246720UL, 0UL, 0UL, 1920UL, 32640UL, 493440UL, 0UL, 0UL, 3840UL, 65280UL, 986880UL, 0UL, 0UL, 7680UL, 130560UL, 1973760UL, 0UL, 0UL, 15360UL, 261120UL, +3947520UL, 0UL, 0UL, 30720UL, 522240UL, 7895040UL, 0UL, 0UL, 61440UL, 1044480UL, 15790080UL, 0UL, 0UL, 122880UL, 2088960UL, 31580160UL, 0UL, 0UL, 245760UL, 4177920UL, 63160320UL, 0UL, 0UL, 491520UL, 8355840UL, 126320640UL, 0UL, 0UL, 983040UL, 16711680UL, 252641280UL, 0UL, +0UL, 1966080UL, 33423360UL, 505282560UL, 0UL, 0UL, 3932160UL, 66846720UL, 1010565120UL, 0UL, 0UL, 7864320UL, 133693440UL, 2021130240UL, 0UL, 0UL, 15728640UL, 267386880UL, 4042260480UL, 0UL, 0UL, 31457280UL, 534773760UL, 3789553664UL, 0UL, 0UL, 62914560UL, 1069547520UL, 3284140032UL, 0UL, 0UL, 125829120UL, +2139095040UL, 2273312768UL, 0UL, 0UL, 251658240UL, 4278190080UL, 251658240UL, 0UL, 0UL, 503316480UL, 4261412864UL, 503316480UL, 0UL, 0UL, 1006632960UL, 4227858432UL, 1006632960UL, 0UL, 0UL, 2013265920UL, 4160749568UL, 2013265920UL, 0UL, 0UL, 4026531840UL, 4026531840UL, 4026531840UL, 0UL, 0UL, 3758096384UL, 3758096384UL, 3758096384UL, +0UL, 0UL, 0UL, 3UL, 51UL, 0UL, 0UL, 0UL, 6UL, 102UL, 0UL, 0UL, 0UL, 15UL, 255UL, 0UL, 0UL, 0UL, 30UL, 510UL, 0UL, 0UL, 0UL, 60UL, 1020UL, 0UL, 0UL, 0UL, 120UL, 2040UL, 0UL, 0UL, +0UL, 240UL, 4080UL, 0UL, 0UL, 0UL, 480UL, 8160UL, 0UL, 0UL, 0UL, 960UL, 16320UL, 0UL, 0UL, 0UL, 1920UL, 32640UL, 0UL, 0UL, 0UL, 3840UL, 65280UL, 0UL, 0UL, 0UL, 7680UL, 130560UL, 0UL, 0UL, 0UL, 15360UL, +261120UL, 0UL, 0UL, 0UL, 30720UL, 522240UL, 0UL, 0UL, 0UL, 61440UL, 1044480UL, 0UL, 0UL, 0UL, 122880UL, 2088960UL, 0UL, 0UL, 0UL, 245760UL, 4177920UL, 0UL, 0UL, 0UL, 491520UL, 8355840UL, 0UL, 0UL, 0UL, 983040UL, 16711680UL, 0UL, +0UL, 0UL, 1966080UL, 33423360UL, 0UL, 0UL, 0UL, 3932160UL, 66846720UL, 0UL, 0UL, 0UL, 7864320UL, 133693440UL, 0UL, 0UL, 0UL, 15728640UL, 267386880UL, 0UL, 0UL, 0UL, 31457280UL, 534773760UL, 0UL, 0UL, 0UL, 62914560UL, 1069547520UL, 0UL, 0UL, 0UL, +125829120UL, 2139095040UL, 0UL, 0UL, 0UL, 251658240UL, 4278190080UL, 0UL, 0UL, 0UL, 503316480UL, 4261412864UL, 0UL, 0UL, 0UL, 1006632960UL, 4227858432UL, 0UL, 0UL, 0UL, 2013265920UL, 4160749568UL, 0UL, 0UL, 0UL, 4026531840UL, 4026531840UL, 0UL, 0UL, 0UL, 3758096384UL, 3758096384UL, +0UL, 0UL, 0UL, 0UL, 3UL, 0UL, 0UL, 0UL, 0UL, 6UL, 0UL, 0UL, 0UL, 0UL, 15UL, 0UL, 0UL, 0UL, 0UL, 30UL, 0UL, 0UL, 0UL, 0UL, 60UL, 0UL, 0UL, 0UL, 0UL, 120UL, 0UL, 0UL, +0UL, 0UL, 240UL, 0UL, 0UL, 0UL, 0UL, 480UL, 0UL, 0UL, 0UL, 0UL, 960UL, 0UL, 0UL, 0UL, 0UL, 1920UL, 0UL, 0UL, 0UL, 0UL, 3840UL, 0UL, 0UL, 0UL, 0UL, 7680UL, 0UL, 0UL, 0UL, 0UL, +15360UL, 0UL, 0UL, 0UL, 0UL, 30720UL, 0UL, 0UL, 0UL, 0UL, 61440UL, 0UL, 0UL, 0UL, 0UL, 122880UL, 0UL, 0UL, 0UL, 0UL, 245760UL, 0UL, 0UL, 0UL, 0UL, 491520UL, 0UL, 0UL, 0UL, 0UL, 983040UL, 0UL, +0UL, 0UL, 0UL, 1966080UL, 0UL, 0UL, 0UL, 0UL, 3932160UL, 0UL, 0UL, 0UL, 0UL, 7864320UL, 0UL, 0UL, 0UL, 0UL, 15728640UL, 0UL, 0UL, 0UL, 0UL, 31457280UL, 0UL, 0UL, 0UL, 0UL, 62914560UL, 0UL, 0UL, 0UL, +0UL, 125829120UL, 0UL, 0UL, 0UL, 0UL, 251658240UL, 0UL, 0UL, 0UL, 0UL, 503316480UL, 0UL, 0UL, 0UL, 0UL, 1006632960UL, 0UL, 0UL, 0UL, 0UL, 2013265920UL, 0UL, 0UL, 0UL, 0UL, 4026531840UL, 0UL, 0UL, 0UL, 0UL, 3758096384UL, +1UL, 17UL, 257UL, 4369UL, 65537UL, 2UL, 34UL, 514UL, 8738UL, 131074UL, 4UL, 68UL, 1028UL, 17476UL, 262148UL, 8UL, 136UL, 2056UL, 34952UL, 524296UL, 16UL, 272UL, 4112UL, 69904UL, 1048592UL, 32UL, 544UL, 8224UL, 139808UL, 2097184UL, 64UL, 1088UL, +16448UL, 279616UL, 4194368UL, 128UL, 2176UL, 32896UL, 559232UL, 8388736UL, 256UL, 4352UL, 65792UL, 1118464UL, 16777472UL, 512UL, 8704UL, 131584UL, 2236928UL, 33554944UL, 1024UL, 17408UL, 263168UL, 4473856UL, 67109888UL, 2048UL, 34816UL, 526336UL, 8947712UL, 134219776UL, 4096UL, 69632UL, 1052672UL, 17895424UL, +268439552UL, 8192UL, 139264UL, 2105344UL, 35790848UL, 536879104UL, 16384UL, 278528UL, 4210688UL, 71581696UL, 1073758208UL, 32768UL, 557056UL, 8421376UL, 143163392UL, 2147516416UL, 65536UL, 1114112UL, 16842752UL, 286326784UL, 65536UL, 131072UL, 2228224UL, 33685504UL, 572653568UL, 131072UL, 262144UL, 4456448UL, 67371008UL, 1145307136UL, 262144UL, 524288UL, +8912896UL, 134742016UL, 2290614272UL, 524288UL, 1048576UL, 17825792UL, 269484032UL, 286261248UL, 1048576UL, 2097152UL, 35651584UL, 538968064UL, 572522496UL, 2097152UL, 4194304UL, 71303168UL, 1077936128UL, 1145044992UL, 4194304UL, 8388608UL, 142606336UL, 2155872256UL, 2290089984UL, 8388608UL, 16777216UL, 285212672UL, 16777216UL, 285212672UL, 16777216UL, 33554432UL, 570425344UL, 33554432UL, +570425344UL, 33554432UL, 67108864UL, 1140850688UL, 67108864UL, 1140850688UL, 67108864UL, 134217728UL, 2281701376UL, 134217728UL, 2281701376UL, 134217728UL, 268435456UL, 268435456UL, 268435456UL, 268435456UL, 268435456UL, 536870912UL, 536870912UL, 536870912UL, 536870912UL, 536870912UL, 1073741824UL, 1073741824UL, 1073741824UL, 1073741824UL, 1073741824UL, 2147483648UL, 2147483648UL, 2147483648UL, 2147483648UL, 2147483648UL, +}, +{ +85009117UL, 335741939UL, 1412632518UL, 386859243UL, 1741437244UL, 152139416UL, 403047142UL, 2556825231UL, 505087203UL, 4287193174UL, 335609039UL, 336528191UL, 1425998811UL, 456920088UL, 2832198590UL, 724748988UL, 3625845630UL, 1509824181UL, 3330088197UL, 2710488401UL, 1431742057UL, 1077674236UL, 1140592489UL, 2096905276UL, 3007294393UL, 2863484114UL, 1081606648UL, 1207443154UL, 972585080UL, 2793363314UL, 1432000919UL, 1089470704UL, +1341132452UL, 3019109363UL, 2362285522UL, 1790260014UL, 2178941408UL, 2682264904UL, 1743251430UL, 429603751UL, 359294556UL, 62915520UL, 1069562512UL, 3486502860UL, 859207501UL, 3939814584UL, 125831040UL, 2139125024UL, 2678038424UL, 1718415002UL, 363436400UL, 251662080UL, 4278250048UL, 1061109552UL, 3436830004UL, 3948098272UL, 503324160UL, 4261532800UL, 2122219104UL, 2310257256UL, 380003776UL, 1006648320UL, 4228098304UL, 4244438208UL, +3278337232UL, 3981233024UL, 2013296640UL, 4161229312UL, 4193909120UL, 2530142624UL, 446273280UL, 4026593280UL, 4027491328UL, 871625472UL, 4254978880UL, 4113772032UL, 3758219264UL, 3760015360UL, 2011686400UL, 3946555008UL, 711351296UL, 3221471232UL, 3225063424UL, 4291808256UL, 108481792UL, 2496444416UL, 2147975168UL, 2155159552UL, 4020213760UL, 485399040UL, 3919147008UL, 983040UL, 15351808UL, 255799296UL, 3923588096UL, 322101248UL, +1966080UL, 299139072UL, 511598592UL, 3283773440UL, 3865427968UL, 3932160UL, 4087939072UL, 1023197184UL, 1467273216UL, 214663168UL, 7864320UL, 4149346304UL, 2046394368UL, 3202981888UL, 3650551808UL, 3236954112UL, 1050935296UL, 871563264UL, 2916302848UL, 1932394496UL, 2447376384UL, 1833435136UL, 2011561984UL, 2342944768UL, 643563520UL, 868220928UL, 177209344UL, 4291559424UL, 122486784UL, 2360868864UL, 2004877312UL, 85983232UL, +4019716096UL, 3734634496UL, 3647995904UL, 1056964608UL, 3661627392UL, 254803968UL, 2905866240UL, 1658847232UL, 2113929216UL, 3028287488UL, 3730833408UL, 2322071552UL, 3586129920UL, 4227858432UL, 1761607680UL, 2092957696UL, 80740352UL, 2071986176UL, 4160749568UL, 3523215360UL, 964689920UL, 429916160UL, 3875536896UL, 4026531840UL, 2751463424UL, 1929379840UL, 4081057792UL, 503316480UL, 3758096384UL, 2281701376UL, 4127195136UL, 3397386240UL, +1316635UL, 85009117UL, 335741939UL, 1412632518UL, 386859243UL, 1580547UL, 152139416UL, 403047142UL, 2556825231UL, 505087203UL, 1317672UL, 335609039UL, 336528191UL, 1425998811UL, 456920088UL, 1574501UL, 724748988UL, 3625845630UL, 1509824181UL, 3330088197UL, 15612UL, 1431742057UL, 1077674236UL, 1140592489UL, 2096905276UL, 31224UL, 2863484114UL, 1081606648UL, 1207443154UL, 972585080UL, 62451UL, 1432000919UL, +1089470704UL, 1341132452UL, 3019109363UL, 124902UL, 1790260014UL, 2178941408UL, 2682264904UL, 1743251430UL, 249804UL, 359294556UL, 62915520UL, 1069562512UL, 3486502860UL, 499608UL, 3939814584UL, 125831040UL, 2139125024UL, 2678038424UL, 999216UL, 363436400UL, 251662080UL, 4278250048UL, 1061109552UL, 3223223904UL, 3948098272UL, 503324160UL, 4261532800UL, 2122219104UL, 1077738688UL, 380003776UL, 1006648320UL, 4228098304UL, +4244438208UL, 1081735552UL, 3981233024UL, 2013296640UL, 4161229312UL, 4193909120UL, 1089729280UL, 446273280UL, 4026593280UL, 4027491328UL, 871625472UL, 2179458560UL, 4113772032UL, 3758219264UL, 3760015360UL, 2011686400UL, 63949824UL, 711351296UL, 3221471232UL, 3225063424UL, 4291808256UL, 127899648UL, 2496444416UL, 2147975168UL, 2155159552UL, 4020213760UL, 255799296UL, 3919147008UL, 983040UL, 15351808UL, 255799296UL, 3732824064UL, +322101248UL, 1966080UL, 299139072UL, 511598592UL, 2096939008UL, 3865427968UL, 3932160UL, 4087939072UL, 1023197184UL, 972652544UL, 214663168UL, 7864320UL, 4149346304UL, 2046394368UL, 3019046912UL, 3650551808UL, 3236954112UL, 1050935296UL, 871563264UL, 1743126528UL, 1932394496UL, 2447376384UL, 1833435136UL, 2011561984UL, 3486253056UL, 643563520UL, 868220928UL, 177209344UL, 4291559424UL, 2677538816UL, 2360868864UL, 2004877312UL, +85983232UL, 4019716096UL, 1060110336UL, 3647995904UL, 1056964608UL, 3661627392UL, 254803968UL, 3193962496UL, 1658847232UL, 2113929216UL, 3028287488UL, 3730833408UL, 3166699520UL, 3586129920UL, 4227858432UL, 1761607680UL, 2092957696UL, 3112173568UL, 2071986176UL, 4160749568UL, 3523215360UL, 964689920UL, 1929379840UL, 3875536896UL, 4026531840UL, 2751463424UL, 1929379840UL, 4127195136UL, 503316480UL, 3758096384UL, 2281701376UL, 4127195136UL, +332854UL, 1316635UL, 85009117UL, 335741939UL, 1412632518UL, 596079UL, 1580547UL, 152139416UL, 403047142UL, 2556825231UL, 1316075UL, 1317672UL, 335609039UL, 336528191UL, 1425998811UL, 2824661UL, 1574501UL, 724748988UL, 3625845630UL, 1509824181UL, 5571497UL, 15612UL, 1431742057UL, 1077674236UL, 1140592489UL, 11142994UL, 31224UL, 2863484114UL, 1081606648UL, 1207443154UL, 22285988UL, 62451UL, +1432000919UL, 1089470704UL, 1341132452UL, 44571976UL, 124902UL, 1790260014UL, 2178941408UL, 2682264904UL, 89143952UL, 249804UL, 359294556UL, 62915520UL, 1069562512UL, 178287904UL, 499608UL, 3939814584UL, 125831040UL, 2139125024UL, 356575808UL, 999216UL, 363436400UL, 251662080UL, 4278250048UL, 713151616UL, 3223223904UL, 3948098272UL, 503324160UL, 4261532800UL, 1426303232UL, 1077738688UL, 380003776UL, 1006648320UL, +4228098304UL, 2852606464UL, 1081735552UL, 3981233024UL, 2013296640UL, 4161229312UL, 1410245632UL, 1089729280UL, 446273280UL, 4026593280UL, 4027491328UL, 1746749440UL, 2179458560UL, 4113772032UL, 3758219264UL, 3760015360UL, 272273408UL, 63949824UL, 711351296UL, 3221471232UL, 3225063424UL, 3765772288UL, 127899648UL, 2496444416UL, 2147975168UL, 2155159552UL, 15351808UL, 255799296UL, 3919147008UL, 983040UL, 15351808UL, 3251929088UL, +3732824064UL, 322101248UL, 1966080UL, 299139072UL, 1135149056UL, 2096939008UL, 3865427968UL, 3932160UL, 4087939072UL, 1196556288UL, 972652544UL, 214663168UL, 7864320UL, 4149346304UL, 1319370752UL, 3019046912UL, 3650551808UL, 3236954112UL, 1050935296UL, 2638741504UL, 1743126528UL, 1932394496UL, 2447376384UL, 1833435136UL, 982515712UL, 3486253056UL, 643563520UL, 868220928UL, 177209344UL, 1965031424UL, 2677538816UL, 2360868864UL, +2004877312UL, 85983232UL, 3930062848UL, 1060110336UL, 3647995904UL, 1056964608UL, 3661627392UL, 3565158400UL, 3193962496UL, 1658847232UL, 2113929216UL, 3028287488UL, 2835349504UL, 3166699520UL, 3586129920UL, 4227858432UL, 1761607680UL, 1375731712UL, 3112173568UL, 2071986176UL, 4160749568UL, 3523215360UL, 2751463424UL, 1929379840UL, 3875536896UL, 4026531840UL, 2751463424UL, 2281701376UL, 4127195136UL, 503316480UL, 3758096384UL, 2281701376UL, +5123UL, 332854UL, 1316635UL, 85009117UL, 335741939UL, 6150UL, 596079UL, 1580547UL, 152139416UL, 403047142UL, 5135UL, 1316075UL, 1317672UL, 335609039UL, 336528191UL, 6174UL, 2824661UL, 1574501UL, 724748988UL, 3625845630UL, 60UL, 5571497UL, 15612UL, 1431742057UL, 1077674236UL, 120UL, 11142994UL, 31224UL, 2863484114UL, 1081606648UL, 240UL, 22285988UL, +62451UL, 1432000919UL, 1089470704UL, 480UL, 44571976UL, 124902UL, 1790260014UL, 2178941408UL, 960UL, 89143952UL, 249804UL, 359294556UL, 62915520UL, 1920UL, 178287904UL, 499608UL, 3939814584UL, 125831040UL, 3840UL, 356575808UL, 999216UL, 363436400UL, 251662080UL, 7680UL, 713151616UL, 3223223904UL, 3948098272UL, 503324160UL, 15360UL, 1426303232UL, 1077738688UL, 380003776UL, +1006648320UL, 30720UL, 2852606464UL, 1081735552UL, 3981233024UL, 2013296640UL, 61440UL, 1410245632UL, 1089729280UL, 446273280UL, 4026593280UL, 122880UL, 1746749440UL, 2179458560UL, 4113772032UL, 3758219264UL, 245760UL, 272273408UL, 63949824UL, 711351296UL, 3221471232UL, 491520UL, 3765772288UL, 127899648UL, 2496444416UL, 2147975168UL, 983040UL, 15351808UL, 255799296UL, 3919147008UL, 983040UL, 3223191552UL, +3251929088UL, 3732824064UL, 322101248UL, 1966080UL, 1077673984UL, 1135149056UL, 2096939008UL, 3865427968UL, 3932160UL, 1081606144UL, 1196556288UL, 972652544UL, 214663168UL, 7864320UL, 1089470464UL, 1319370752UL, 3019046912UL, 3650551808UL, 3236954112UL, 2178940928UL, 2638741504UL, 1743126528UL, 1932394496UL, 2447376384UL, 62914560UL, 982515712UL, 3486253056UL, 643563520UL, 868220928UL, 125829120UL, 1965031424UL, 2677538816UL, +2360868864UL, 2004877312UL, 251658240UL, 3930062848UL, 1060110336UL, 3647995904UL, 1056964608UL, 503316480UL, 3565158400UL, 3193962496UL, 1658847232UL, 2113929216UL, 1006632960UL, 2835349504UL, 3166699520UL, 3586129920UL, 4227858432UL, 2013265920UL, 1375731712UL, 3112173568UL, 2071986176UL, 4160749568UL, 4026531840UL, 2751463424UL, 1929379840UL, 3875536896UL, 4026531840UL, 3758096384UL, 2281701376UL, 4127195136UL, 503316480UL, 3758096384UL, +201392209UL, 3423671362UL, 218366296UL, 3713336838UL, 206572594UL, 402785186UL, 2552372100UL, 436928947UL, 3130605370UL, 463476848UL, 262468UL, 4461835UL, 68158800UL, 1158700908UL, 20971524UL, 524680UL, 8919318UL, 136513955UL, 2316537326UL, 25165852UL, 3222274064UL, 3239051564UL, 3494187077UL, 3558090985UL, 3221225500UL, 2149580832UL, 2183135832UL, 2693406858UL, 2821214674UL, 2147483704UL, 4194368UL, 71304368UL, +1091846420UL, 1347462055UL, 64UL, 8388736UL, 142608736UL, 2183692840UL, 2694924110UL, 3221225600UL, 16777472UL, 285217472UL, 72418384UL, 1094880924UL, 1342177536UL, 33554944UL, 570434944UL, 144836768UL, 2189761848UL, 2684355072UL, 67109888UL, 1140869888UL, 289673536UL, 84556400UL, 1073742848UL, 134219776UL, 2281739776UL, 579347072UL, 169112800UL, 2147485696UL, 268439552UL, 268512256UL, 1158694144UL, 69790144UL, +4096UL, 536879104UL, 537024512UL, 2317388288UL, 3360805760UL, 8192UL, 1073758208UL, 1074049024UL, 339809280UL, 1352902400UL, 16384UL, 2147516416UL, 2148098048UL, 3900844032UL, 1632062976UL, 32768UL, 65536UL, 1228800UL, 17059840UL, 311335936UL, 65536UL, 131072UL, 2457600UL, 34119680UL, 622671872UL, 131072UL, 262144UL, 4915200UL, 68239360UL, 1245343744UL, 262144UL, 524288UL, +9830400UL, 136478720UL, 2490687488UL, 524288UL, 1048576UL, 288096256UL, 272957440UL, 954843136UL, 3222274048UL, 2097152UL, 3797417984UL, 545914880UL, 2983428096UL, 2149580800UL, 4194304UL, 78643200UL, 1091829760UL, 2745630720UL, 4194304UL, 3229614080UL, 3378511872UL, 1109917696UL, 2270035968UL, 8388608UL, 1358954496UL, 1119879168UL, 1414529024UL, 513540096UL, 16777216UL, 2717908992UL, 2239758336UL, 2829058048UL, +1027080192UL, 33554432UL, 1140850688UL, 184549376UL, 1363148800UL, 2054160384UL, 3288334336UL, 2281701376UL, 369098752UL, 2726297600UL, 4108320768UL, 2281701376UL, 268435456UL, 738197504UL, 2231369728UL, 968884224UL, 3959422976UL, 536870912UL, 1476395008UL, 167772160UL, 3011510272UL, 3355443200UL, 1073741824UL, 2952790016UL, 335544320UL, 1728053248UL, 2147483648UL, 2147483648UL, 1610612736UL, 3892314112UL, 503316480UL, 0UL, +}, +{ +1939838472UL, 1412147404UL, 166205219UL, 1757484276UL, 2905930693UL, 2345662040UL, 2845657161UL, 253454719UL, 2661974169UL, 303781080UL, 4075331504UL, 31014156UL, 244538930UL, 3752264221UL, 992575155UL, 219309525UL, 246620060UL, 215640989UL, 4125020723UL, 2016731730UL, 3236558869UL, 297169276UL, 3293566751UL, 1867504216UL, 210423272UL, 2531663658UL, 499723753UL, 1730625896UL, 189236880UL, 3388575408UL, 2433358422UL, 1368961148UL, +3134096848UL, 2827836415UL, 3888822753UL, 4172043647UL, 3379360748UL, 2651760955UL, 1345081091UL, 627692776UL, 189423917UL, 1927379456UL, 4004336944UL, 2995932065UL, 1882016234UL, 2551113616UL, 1576396048UL, 1299792730UL, 2151240795UL, 2154814108UL, 4292139924UL, 3555849728UL, 943986992UL, 3169912733UL, 2631635779UL, 3478094562UL, 1285558544UL, 3716074330UL, 2780749859UL, 3911106510UL, 4175656994UL, 1731832828UL, 1275401375UL, 937322456UL, +3802094750UL, 1145506936UL, 1008905193UL, 1718801768UL, 645739137UL, 1356219146UL, 827886816UL, 1722154800UL, 2242776733UL, 754630810UL, 772070504UL, 249481170UL, 2608123425UL, 2087201889UL, 3200968096UL, 3292110026UL, 841433255UL, 477543427UL, 1878882709UL, 705347364UL, 4003860146UL, 3194913138UL, 2616490007UL, 357561212UL, 2446098297UL, 2955680594UL, 2512991743UL, 637464579UL, 1209132455UL, 1341312804UL, 612108672UL, 2455017713UL, +1749147666UL, 4020226825UL, 2873924220UL, 499405095UL, 1837614076UL, 1227604028UL, 714577577UL, 165950208UL, 442290261UL, 489077752UL, 216760440UL, 42151250UL, 426862080UL, 2810242474UL, 4112075489UL, 3514761468UL, 4101921371UL, 982512636UL, 500792667UL, 4286077681UL, 198050301UL, 1858712743UL, 2913642493UL, 3547545255UL, 3981929169UL, 2944140287UL, 2286578015UL, 3422343167UL, 1239123295UL, 2026367394UL, 3269986302UL, 3028402878UL, +2709637886UL, 1096011710UL, 294584132UL, 3086749695UL, 3324400975UL, 1164394495UL, 4290155855UL, 543687304UL, 4008517630UL, 836370334UL, 1876426750UL, 2362048414UL, 3578325264UL, 3221487612UL, 2671154748UL, 3395518460UL, 2018383420UL, 2131029536UL, 2165829624UL, 697661816UL, 1336049656UL, 3309365624UL, 4259639360UL, 3423548400UL, 2416417776UL, 1633698800UL, 1630071792UL, 41950336UL, 3423478496UL, 2885608160UL, 3943744224UL, 677380832UL, +4179285363UL, 1939838472UL, 1412147404UL, 166205219UL, 1757484276UL, 3838244595UL, 2345662040UL, 2845657161UL, 253454719UL, 2661974169UL, 138737288UL, 4075331504UL, 31014156UL, 244538930UL, 3752264221UL, 1503392345UL, 219309525UL, 246620060UL, 215640989UL, 4125020723UL, 1759481152UL, 3236558869UL, 297169276UL, 3293566751UL, 1867504216UL, 3898070400UL, 2531663658UL, 499723753UL, 1730625896UL, 189236880UL, 2610231010UL, 2433358422UL, +1368961148UL, 3134096848UL, 2827836415UL, 3903474593UL, 4172043647UL, 3379360748UL, 2651760955UL, 1345081091UL, 1267864331UL, 189423917UL, 1927379456UL, 4004336944UL, 2995932065UL, 3452816347UL, 2551113616UL, 1576396048UL, 1299792730UL, 2151240795UL, 1222520631UL, 4292139924UL, 3555849728UL, 943986992UL, 3169912733UL, 3260130211UL, 3478094562UL, 1285558544UL, 3716074330UL, 2780749859UL, 3039362306UL, 4175656994UL, 1731832828UL, 1275401375UL, +937322456UL, 3236754932UL, 1145506936UL, 1008905193UL, 1718801768UL, 645739137UL, 1358079399UL, 827886816UL, 1722154800UL, 2242776733UL, 754630810UL, 1748663943UL, 249481170UL, 2608123425UL, 2087201889UL, 3200968096UL, 698076610UL, 841433255UL, 477543427UL, 1878882709UL, 705347364UL, 3692794996UL, 3194913138UL, 2616490007UL, 357561212UL, 2446098297UL, 2771068186UL, 2512991743UL, 637464579UL, 1209132455UL, 1341312804UL, 27937268UL, +2455017713UL, 1749147666UL, 4020226825UL, 2873924220UL, 1673040956UL, 1837614076UL, 1227604028UL, 714577577UL, 165950208UL, 528340088UL, 489077752UL, 216760440UL, 42151250UL, 426862080UL, 1646215396UL, 4112075489UL, 3514761468UL, 4101921371UL, 982512636UL, 2095821304UL, 4286077681UL, 198050301UL, 1858712743UL, 2913642493UL, 277300160UL, 3981929169UL, 2944140287UL, 2286578015UL, 3422343167UL, 1178044288UL, 2026367394UL, 3269986302UL, +3028402878UL, 2709637886UL, 2234191616UL, 294584132UL, 3086749695UL, 3324400975UL, 1164394495UL, 136978944UL, 543687304UL, 4008517630UL, 836370334UL, 1876426750UL, 3275253760UL, 3578325264UL, 3221487612UL, 2671154748UL, 3395518460UL, 3942394880UL, 2131029536UL, 2165829624UL, 697661816UL, 1336049656UL, 3265045504UL, 4259639360UL, 3423548400UL, 2416417776UL, 1633698800UL, 3943712768UL, 41950336UL, 3423478496UL, 2885608160UL, 3943744224UL, +2293593009UL, 4179285363UL, 1939838472UL, 1412147404UL, 166205219UL, 715714152UL, 3838244595UL, 2345662040UL, 2845657161UL, 253454719UL, 3758048260UL, 138737288UL, 4075331504UL, 31014156UL, 244538930UL, 370671650UL, 1503392345UL, 219309525UL, 246620060UL, 215640989UL, 2219162331UL, 1759481152UL, 3236558869UL, 297169276UL, 3293566751UL, 135243402UL, 3898070400UL, 2531663658UL, 499723753UL, 1730625896UL, 3142293713UL, 2610231010UL, +2433358422UL, 1368961148UL, 3134096848UL, 486949791UL, 3903474593UL, 4172043647UL, 3379360748UL, 2651760955UL, 3172880550UL, 1267864331UL, 189423917UL, 1927379456UL, 4004336944UL, 191463910UL, 3452816347UL, 2551113616UL, 1576396048UL, 1299792730UL, 4411574UL, 1222520631UL, 4292139924UL, 3555849728UL, 943986992UL, 3073348038UL, 3260130211UL, 3478094562UL, 1285558544UL, 3716074330UL, 3098363790UL, 3039362306UL, 4175656994UL, 1731832828UL, +1275401375UL, 468159532UL, 3236754932UL, 1145506936UL, 1008905193UL, 1718801768UL, 1092964081UL, 1358079399UL, 827886816UL, 1722154800UL, 2242776733UL, 53128947UL, 1748663943UL, 249481170UL, 2608123425UL, 2087201889UL, 1960144614UL, 698076610UL, 841433255UL, 477543427UL, 1878882709UL, 1505419004UL, 3692794996UL, 3194913138UL, 2616490007UL, 357561212UL, 2823143358UL, 2771068186UL, 2512991743UL, 637464579UL, 1209132455UL, 1991737212UL, +27937268UL, 2455017713UL, 1749147666UL, 4020226825UL, 2907896812UL, 1673040956UL, 1837614076UL, 1227604028UL, 714577577UL, 3633969112UL, 528340088UL, 489077752UL, 216760440UL, 42151250UL, 2886728356UL, 1646215396UL, 4112075489UL, 3514761468UL, 4101921371UL, 3507686008UL, 2095821304UL, 4286077681UL, 198050301UL, 1858712743UL, 1463806912UL, 277300160UL, 3981929169UL, 2944140287UL, 2286578015UL, 4137888640UL, 1178044288UL, 2026367394UL, +3269986302UL, 3028402878UL, 1276820224UL, 2234191616UL, 294584132UL, 3086749695UL, 3324400975UL, 4274031104UL, 136978944UL, 543687304UL, 4008517630UL, 836370334UL, 2978609152UL, 3275253760UL, 3578325264UL, 3221487612UL, 2671154748UL, 2296777728UL, 3942394880UL, 2131029536UL, 2165829624UL, 697661816UL, 1086645248UL, 3265045504UL, 4259639360UL, 3423548400UL, 2416417776UL, 2295121920UL, 3943712768UL, 41950336UL, 3423478496UL, 2885608160UL, +3290486993UL, 2293593009UL, 4179285363UL, 1939838472UL, 1412147404UL, 3718742914UL, 715714152UL, 3838244595UL, 2345662040UL, 2845657161UL, 3251034248UL, 3758048260UL, 138737288UL, 4075331504UL, 31014156UL, 2257801369UL, 370671650UL, 1503392345UL, 219309525UL, 246620060UL, 1375177854UL, 2219162331UL, 1759481152UL, 3236558869UL, 297169276UL, 2981812236UL, 135243402UL, 3898070400UL, 2531663658UL, 499723753UL, 1103465850UL, 3142293713UL, +2610231010UL, 2433358422UL, 1368961148UL, 2570001060UL, 486949791UL, 3903474593UL, 4172043647UL, 3379360748UL, 1922171925UL, 3172880550UL, 1267864331UL, 189423917UL, 1927379456UL, 1359812359UL, 191463910UL, 3452816347UL, 2551113616UL, 1576396048UL, 2518549525UL, 4411574UL, 1222520631UL, 4292139924UL, 3555849728UL, 949028615UL, 3073348038UL, 3260130211UL, 3478094562UL, 1285558544UL, 4113039486UL, 3098363790UL, 3039362306UL, 4175656994UL, +1731832828UL, 1827471372UL, 468159532UL, 3236754932UL, 1145506936UL, 1008905193UL, 1626341859UL, 1092964081UL, 1358079399UL, 827886816UL, 1722154800UL, 1069547583UL, 53128947UL, 1748663943UL, 249481170UL, 2608123425UL, 3162506114UL, 1960144614UL, 698076610UL, 841433255UL, 477543427UL, 3641706484UL, 1505419004UL, 3692794996UL, 3194913138UL, 2616490007UL, 3623882586UL, 2823143358UL, 2771068186UL, 2512991743UL, 637464579UL, 16785012UL, +1991737212UL, 27937268UL, 2455017713UL, 1749147666UL, 2348825660UL, 2907896812UL, 1673040956UL, 1837614076UL, 1227604028UL, 2579527800UL, 3633969112UL, 528340088UL, 489077752UL, 216760440UL, 3628134628UL, 2886728356UL, 1646215396UL, 4112075489UL, 3514761468UL, 1602085368UL, 3507686008UL, 2095821304UL, 4286077681UL, 198050301UL, 2501362624UL, 1463806912UL, 277300160UL, 3981929169UL, 2944140287UL, 4112467840UL, 4137888640UL, 1178044288UL, +2026367394UL, 3269986302UL, 3356184320UL, 1276820224UL, 2234191616UL, 294584132UL, 3086749695UL, 366387712UL, 4274031104UL, 136978944UL, 543687304UL, 4008517630UL, 1006135296UL, 2978609152UL, 3275253760UL, 3578325264UL, 3221487612UL, 3104844800UL, 2296777728UL, 3942394880UL, 2131029536UL, 2165829624UL, 1874371584UL, 1086645248UL, 3265045504UL, 4259639360UL, 3423548400UL, 2975352832UL, 2295121920UL, 3943712768UL, 41950336UL, 3423478496UL, +989898496UL, 3410688577UL, 2331788830UL, 3546482013UL, 813828841UL, 1865093068UL, 3265457506UL, 3795669738UL, 2119696024UL, 4285651426UL, 3333834629UL, 3451487261UL, 2090324595UL, 1816963648UL, 932961512UL, 2470761029UL, 3401764108UL, 3421619354UL, 4199624502UL, 589386372UL, 879396240UL, 3372470254UL, 2693109296UL, 2424215996UL, 38442268UL, 1882087724UL, 171397600UL, 2024561281UL, 183095586UL, 3282207272UL, 3402177296UL, 1859195498UL, +413109947UL, 2839537944UL, 1632143648UL, 3742715856UL, 388696500UL, 1748703733UL, 3563198567UL, 3826785440UL, 2896086528UL, 3989037829UL, 1478787788UL, 1390277813UL, 2123320736UL, 3416516800UL, 2056564203UL, 2584895011UL, 1605192736UL, 2475623616UL, 3856499712UL, 3439657984UL, 708088129UL, 1501395566UL, 1302184960UL, 1360092352UL, 1645630430UL, 1425230387UL, 3369488824UL, 2979863936UL, 869212432UL, 150548847UL, 1097557362UL, 655939640UL, +316553344UL, 3761918508UL, 3958338094UL, 141744600UL, 1412214640UL, 1859689984UL, 3200680981UL, 3883058679UL, 999801880UL, 3946079738UL, 1876072704UL, 194381849UL, 2177533995UL, 1584707624UL, 3053768410UL, 2593051904UL, 3458076673UL, 4047442835UL, 3545972808UL, 3441793178UL, 194975744UL, 1731731470UL, 4168755162UL, 2628944732UL, 2125675784UL, 3119906816UL, 960774145UL, 2646626078UL, 2152793157UL, 3049156634UL, 672464896UL, 3046932493UL, +3700727536UL, 2152335477UL, 575986696UL, 671940608UL, 2208366608UL, 1454456125UL, 937760016UL, 4103979069UL, 2737668096UL, 1179779104UL, 1030912634UL, 1041902112UL, 2032909434UL, 2274230272UL, 2089025605UL, 3050632421UL, 2428784965UL, 140658149UL, 4254138368UL, 1745354889UL, 711584249UL, 2746523017UL, 2551006457UL, 1100808192UL, 1494221073UL, 3422999489UL, 2696954129UL, 976716737UL, 2653421568UL, 3806331426UL, 3690047362UL, 1481392674UL, +3817015170UL, 2353004544UL, 286262340UL, 2300534532UL, 4206449732UL, 15339268UL, 2894069760UL, 488376456UL, 1489927688UL, 1196583048UL, 652746248UL, 2214592512UL, 69904UL, 1006205200UL, 2322628880UL, 1229515024UL, 2617245696UL, 3423527456UL, 1964953120UL, 4260938272UL, 386199072UL, 1744830464UL, 1342444608UL, 1069330496UL, 2138592320UL, 3185897536UL, 1073741824UL, 1342493824UL, 3780942976UL, 1771066496UL, 2189433984UL, 2147483648UL, +}, +{ +1804684571UL, 2106089606UL, 1533056158UL, 2870216110UL, 3618155659UL, 3789871366UL, 4246691682UL, 3667072763UL, 1212241769UL, 3152390668UL, 2973497449UL, 2958641966UL, 2088805328UL, 717518631UL, 2401090860UL, 3606967204UL, 952637656UL, 59827581UL, 1291486682UL, 1499453515UL, 2053994857UL, 563998083UL, 4094000396UL, 1163546899UL, 1003843565UL, 654565639UL, 1070907026UL, 4217851863UL, 426034251UL, 1721352737UL, 278404469UL, 3899800390UL, +1063362170UL, 1162348262UL, 3153545093UL, 3249996223UL, 186674553UL, 2616406148UL, 3137968354UL, 1282784965UL, 1495068058UL, 3033760361UL, 2278144523UL, 3192245769UL, 719586342UL, 2602548287UL, 3386583150UL, 355354345UL, 3252815848UL, 2178056037UL, 2283016801UL, 3005955037UL, 3340254490UL, 802791670UL, 251122316UL, 3705188626UL, 1252262272UL, 3989036796UL, 3527490452UL, 2047131255UL, 1447170583UL, 3373930285UL, 2895037457UL, 209341805UL, +1820357643UL, 3712392731UL, 685796521UL, 1322920440UL, 814388470UL, 1357857147UL, 434430265UL, 2650681935UL, 1371566728UL, 58783716UL, 2273435933UL, 3498513198UL, 792571900UL, 1447808772UL, 3513385860UL, 99175889UL, 1105434360UL, 1484146625UL, 3327194068UL, 242672513UL, 3552105593UL, 1425844616UL, 2871928454UL, 1124633561UL, 607610433UL, 2130018608UL, 1610235673UL, 2844230432UL, 2748082340UL, 994392866UL, 450823250UL, 2912535126UL, +2574390988UL, 3974009252UL, 78696582UL, 649682891UL, 3980917176UL, 3221419689UL, 960695436UL, 729221508UL, 358358845UL, 3392407691UL, 472711005UL, 295914899UL, 3005191796UL, 3078521977UL, 3370011868UL, 509135340UL, 1965939519UL, 2086465877UL, 2457949822UL, 1324152522UL, 762289386UL, 3618693997UL, 233730715UL, 2873984650UL, 31168606UL, 3367142977UL, 2851851305UL, 3251660053UL, 4209768406UL, 3298190175UL, 901235185UL, 1564391510UL, +2352686527UL, 1008150482UL, 578573310UL, 3462447127UL, 2482873876UL, 1790221257UL, 2255375608UL, 2335345651UL, 1381450613UL, 2866805101UL, 1495073163UL, 519905259UL, 3184556473UL, 1076378339UL, 2692926127UL, 970097715UL, 4013407916UL, 4014350363UL, 2476927059UL, 1989070516UL, 2640060069UL, 1987784589UL, 1880989003UL, 3861138803UL, 451743296UL, 1987067871UL, 1975657871UL, 3397816882UL, 2309900530UL, 4108425851UL, 4063867233UL, 3319482186UL, +2621772886UL, 1804684571UL, 2106089606UL, 1533056158UL, 2870216110UL, 611557097UL, 3789871366UL, 4246691682UL, 3667072763UL, 1212241769UL, 3389551988UL, 2973497449UL, 2958641966UL, 2088805328UL, 717518631UL, 2460955430UL, 3606967204UL, 952637656UL, 59827581UL, 1291486682UL, 3531087304UL, 2053994857UL, 563998083UL, 4094000396UL, 1163546899UL, 1242934125UL, 654565639UL, 1070907026UL, 4217851863UL, 426034251UL, 3034416129UL, 278404469UL, +3899800390UL, 1063362170UL, 1162348262UL, 4258714417UL, 3249996223UL, 186674553UL, 2616406148UL, 3137968354UL, 639885806UL, 1495068058UL, 3033760361UL, 2278144523UL, 3192245769UL, 4159910300UL, 2602548287UL, 3386583150UL, 355354345UL, 3252815848UL, 1555885880UL, 2283016801UL, 3005955037UL, 3340254490UL, 802791670UL, 2948774612UL, 3705188626UL, 1252262272UL, 3989036796UL, 3527490452UL, 2107826711UL, 1447170583UL, 3373930285UL, 2895037457UL, +209341805UL, 3763367196UL, 3712392731UL, 685796521UL, 1322920440UL, 814388470UL, 1986168339UL, 434430265UL, 2650681935UL, 1371566728UL, 58783716UL, 1423189187UL, 3498513198UL, 792571900UL, 1447808772UL, 3513385860UL, 315969823UL, 1105434360UL, 1484146625UL, 3327194068UL, 242672513UL, 3336228275UL, 1425844616UL, 2871928454UL, 1124633561UL, 607610433UL, 1762052458UL, 1610235673UL, 2844230432UL, 2748082340UL, 994392866UL, 3771702243UL, +2912535126UL, 2574390988UL, 3974009252UL, 78696582UL, 1626628844UL, 3980917176UL, 3221419689UL, 960695436UL, 729221508UL, 382092233UL, 3392407691UL, 472711005UL, 295914899UL, 3005191796UL, 514297204UL, 3370011868UL, 509135340UL, 1965939519UL, 2086465877UL, 3975975091UL, 1324152522UL, 762289386UL, 3618693997UL, 233730715UL, 455322516UL, 31168606UL, 3367142977UL, 2851851305UL, 3251660053UL, 3952189603UL, 3298190175UL, 901235185UL, +1564391510UL, 2352686527UL, 826181452UL, 578573310UL, 3462447127UL, 2482873876UL, 1790221257UL, 1529242773UL, 2335345651UL, 1381450613UL, 2866805101UL, 1495073163UL, 877718651UL, 3184556473UL, 1076378339UL, 2692926127UL, 970097715UL, 299344245UL, 4014350363UL, 2476927059UL, 1989070516UL, 2640060069UL, 3844531327UL, 1880989003UL, 3861138803UL, 451743296UL, 1987067871UL, 3272848161UL, 3397816882UL, 2309900530UL, 4108425851UL, 4063867233UL, +834288064UL, 2621772886UL, 1804684571UL, 2106089606UL, 1533056158UL, 304865970UL, 611557097UL, 3789871366UL, 4246691682UL, 3667072763UL, 2728206193UL, 3389551988UL, 2973497449UL, 2958641966UL, 2088805328UL, 3895037582UL, 2460955430UL, 3606967204UL, 952637656UL, 59827581UL, 2349212526UL, 3531087304UL, 2053994857UL, 563998083UL, 4094000396UL, 4028900485UL, 1242934125UL, 654565639UL, 1070907026UL, 4217851863UL, 1663452176UL, 3034416129UL, +278404469UL, 3899800390UL, 1063362170UL, 2721441405UL, 4258714417UL, 3249996223UL, 186674553UL, 2616406148UL, 4228837490UL, 639885806UL, 1495068058UL, 3033760361UL, 2278144523UL, 2820661772UL, 4159910300UL, 2602548287UL, 3386583150UL, 355354345UL, 1815256314UL, 1555885880UL, 2283016801UL, 3005955037UL, 3340254490UL, 2166514144UL, 2948774612UL, 3705188626UL, 1252262272UL, 3989036796UL, 751187322UL, 2107826711UL, 1447170583UL, 3373930285UL, +2895037457UL, 2809311944UL, 3763367196UL, 3712392731UL, 685796521UL, 1322920440UL, 936300677UL, 1986168339UL, 434430265UL, 2650681935UL, 1371566728UL, 1308015359UL, 1423189187UL, 3498513198UL, 792571900UL, 1447808772UL, 3065349526UL, 315969823UL, 1105434360UL, 1484146625UL, 3327194068UL, 1038676789UL, 3336228275UL, 1425844616UL, 2871928454UL, 1124633561UL, 2956422231UL, 1762052458UL, 1610235673UL, 2844230432UL, 2748082340UL, 3603862093UL, +3771702243UL, 2912535126UL, 2574390988UL, 3974009252UL, 1691332448UL, 1626628844UL, 3980917176UL, 3221419689UL, 960695436UL, 3120142427UL, 382092233UL, 3392407691UL, 472711005UL, 295914899UL, 4101686983UL, 514297204UL, 3370011868UL, 509135340UL, 1965939519UL, 3015736706UL, 3975975091UL, 1324152522UL, 762289386UL, 3618693997UL, 2395097989UL, 455322516UL, 31168606UL, 3367142977UL, 2851851305UL, 30511955UL, 3952189603UL, 3298190175UL, +901235185UL, 1564391510UL, 2606298633UL, 826181452UL, 578573310UL, 3462447127UL, 2482873876UL, 4159642946UL, 1529242773UL, 2335345651UL, 1381450613UL, 2866805101UL, 1782913669UL, 877718651UL, 3184556473UL, 1076378339UL, 2692926127UL, 1730328819UL, 299344245UL, 4014350363UL, 2476927059UL, 1989070516UL, 1425685614UL, 3844531327UL, 1880989003UL, 3861138803UL, 451743296UL, 889237383UL, 3272848161UL, 3397816882UL, 2309900530UL, 4108425851UL, +1155723231UL, 834288064UL, 2621772886UL, 1804684571UL, 2106089606UL, 2387009004UL, 304865970UL, 611557097UL, 3789871366UL, 4246691682UL, 1405709661UL, 2728206193UL, 3389551988UL, 2973497449UL, 2958641966UL, 3183906006UL, 3895037582UL, 2460955430UL, 3606967204UL, 952637656UL, 1345432763UL, 2349212526UL, 3531087304UL, 2053994857UL, 563998083UL, 3749011414UL, 4028900485UL, 1242934125UL, 654565639UL, 1070907026UL, 1072342672UL, 1663452176UL, +3034416129UL, 278404469UL, 3899800390UL, 3566652188UL, 2721441405UL, 4258714417UL, 3249996223UL, 186674553UL, 4001263143UL, 4228837490UL, 639885806UL, 1495068058UL, 3033760361UL, 4278332644UL, 2820661772UL, 4159910300UL, 2602548287UL, 3386583150UL, 838831089UL, 1815256314UL, 1555885880UL, 2283016801UL, 3005955037UL, 3377397178UL, 2166514144UL, 2948774612UL, 3705188626UL, 1252262272UL, 2414422575UL, 751187322UL, 2107826711UL, 1447170583UL, +3373930285UL, 1253755033UL, 2809311944UL, 3763367196UL, 3712392731UL, 685796521UL, 3238624475UL, 936300677UL, 1986168339UL, 434430265UL, 2650681935UL, 1642290570UL, 1308015359UL, 1423189187UL, 3498513198UL, 792571900UL, 173318140UL, 3065349526UL, 315969823UL, 1105434360UL, 1484146625UL, 4103797777UL, 1038676789UL, 3336228275UL, 1425844616UL, 2871928454UL, 1797745765UL, 2956422231UL, 1762052458UL, 1610235673UL, 2844230432UL, 2180656608UL, +3603862093UL, 3771702243UL, 2912535126UL, 2574390988UL, 1183098390UL, 1691332448UL, 1626628844UL, 3980917176UL, 3221419689UL, 2645203959UL, 3120142427UL, 382092233UL, 3392407691UL, 472711005UL, 1659659070UL, 4101686983UL, 514297204UL, 3370011868UL, 509135340UL, 483888155UL, 3015736706UL, 3975975091UL, 1324152522UL, 762289386UL, 1259948064UL, 2395097989UL, 455322516UL, 31168606UL, 3367142977UL, 339990414UL, 30511955UL, 3952189603UL, +3298190175UL, 901235185UL, 3097920065UL, 2606298633UL, 826181452UL, 578573310UL, 3462447127UL, 1548039839UL, 4159642946UL, 1529242773UL, 2335345651UL, 1381450613UL, 2173079994UL, 1782913669UL, 877718651UL, 3184556473UL, 1076378339UL, 1570275057UL, 1730328819UL, 299344245UL, 4014350363UL, 2476927059UL, 1845882881UL, 1425685614UL, 3844531327UL, 1880989003UL, 3861138803UL, 1322409081UL, 889237383UL, 3272848161UL, 3397816882UL, 2309900530UL, +3505447982UL, 3430136873UL, 1319796589UL, 4202423979UL, 3184732284UL, 2910356648UL, 2534615223UL, 3854465731UL, 768821792UL, 2205052576UL, 1348983754UL, 1300250188UL, 2919181738UL, 2520178732UL, 3967243685UL, 2646012002UL, 1784678658UL, 741302051UL, 3464753547UL, 194213376UL, 1482799064UL, 3009673860UL, 680824208UL, 741966796UL, 2381283369UL, 3022877171UL, 1619439814UL, 3961433610UL, 1331297670UL, 1100110820UL, 1311672539UL, 1122110615UL, +4056004850UL, 3413790176UL, 3148768822UL, 1242592694UL, 2925975727UL, 1879285134UL, 334328879UL, 1318235222UL, 3140739559UL, 401691770UL, 3604288404UL, 3686496908UL, 770670945UL, 199139043UL, 2092710473UL, 3914528993UL, 700991333UL, 2375775811UL, 858137308UL, 3490050165UL, 2389078291UL, 1615607459UL, 3027969809UL, 820012549UL, 2085659484UL, 2654485136UL, 2630408646UL, 196481396UL, 1119673274UL, 1026209692UL, 726501622UL, 2940737143UL, +3559571163UL, 2288027726UL, 1039212708UL, 929664536UL, 1061981465UL, 186058675UL, 3537656152UL, 844176796UL, 2996217992UL, 1545798611UL, 3031020656UL, 2248030435UL, 1665857580UL, 2905758082UL, 1269201312UL, 3031275084UL, 4034872841UL, 983632400UL, 4188503190UL, 757119675UL, 2105920865UL, 4281032819UL, 2917801076UL, 3900010013UL, 3910997169UL, 1729751422UL, 562313247UL, 3070846353UL, 2564238664UL, 4050540186UL, 4258833501UL, 2270666053UL, +2207128401UL, 2990540001UL, 797768898UL, 2288390225UL, 3230323685UL, 1974727440UL, 3327301426UL, 289857826UL, 3565889868UL, 2791014422UL, 2021097820UL, 3350378271UL, 3673707591UL, 2610067927UL, 4255789547UL, 2682856590UL, 12563128UL, 1397542366UL, 237149400UL, 2233707508UL, 3875573245UL, 2097374144UL, 175320773UL, 4103445984UL, 4089284323UL, 3610168130UL, 3084915964UL, 680145366UL, 2571684685UL, 1132894909UL, 104640024UL, 193765521UL, +2338202907UL, 895271448UL, 11499099UL, 1798066417UL, 1297412626UL, 2511347162UL, 3140535007UL, 2129963538UL, 700683199UL, 2609700278UL, 2953463279UL, 2290844145UL, 1871316353UL, 3993801787UL, 2219413182UL, 2954453701UL, 231283580UL, 1375331115UL, 207723994UL, 1799562537UL, 2056553564UL, 2513609799UL, 3542459627UL, 3173012714UL, 3923404932UL, 217877755UL, 2095124912UL, 192024370UL, 1168134987UL, 1889598668UL, 3014873069UL, 2033573343UL, +}, +{ +3465348660UL, 3623545008UL, 3505902593UL, 838034830UL, 1338018789UL, 2595329276UL, 3367746385UL, 3197935201UL, 1439351946UL, 3585085571UL, 4165798087UL, 3634792639UL, 2359485974UL, 2772582925UL, 1110186203UL, 3771562484UL, 1508694157UL, 1564641206UL, 2801985736UL, 2446107936UL, 3849126897UL, 1842973671UL, 944408104UL, 2624631280UL, 2729080685UL, 3737368614UL, 858809173UL, 2289802345UL, 2428186575UL, 3114742765UL, 716011303UL, 3443810690UL, +814132610UL, 517432787UL, 614445393UL, 2930433345UL, 291178098UL, 2117644502UL, 2749446703UL, 311745701UL, 365684723UL, 1705418876UL, 2213749318UL, 4011417220UL, 1842575651UL, 988348831UL, 94258998UL, 2771150272UL, 498058526UL, 1344827813UL, 2961955291UL, 262703473UL, 1404034822UL, 1566595865UL, 2522381203UL, 1706522206UL, 1203054806UL, 1273801539UL, 2070583465UL, 3913449936UL, 3231505231UL, 619636751UL, 3746997351UL, 4103027837UL, +1205468203UL, 3355878253UL, 3433356888UL, 107785753UL, 2779092609UL, 1869691566UL, 2555219983UL, 903319808UL, 3273374169UL, 2538926990UL, 979533870UL, 1356500860UL, 1661983738UL, 1380761625UL, 2919458459UL, 1041142798UL, 1430817627UL, 517007606UL, 1421570516UL, 2371447300UL, 2985632691UL, 3684889351UL, 3873926653UL, 788770697UL, 1854750277UL, 209332297UL, 1137299679UL, 848527832UL, 3850486924UL, 4179307312UL, 2764470693UL, 1353191605UL, +4166891919UL, 2074703841UL, 3373997532UL, 2013528640UL, 701389744UL, 841917592UL, 2065742268UL, 2721848192UL, 2566956680UL, 3122896007UL, 1090761479UL, 921859028UL, 4086736376UL, 1837462309UL, 2579826431UL, 2436217134UL, 839037727UL, 1072086642UL, 614518622UL, 3764758228UL, 1501128342UL, 3669108708UL, 1601407381UL, 2899014005UL, 3268308948UL, 3337564231UL, 1986911578UL, 3379194930UL, 1950365753UL, 2098537451UL, 51515980UL, 1176526086UL, +3213391582UL, 1059745735UL, 2273586703UL, 376085505UL, 1493749800UL, 3970342143UL, 1620925244UL, 2165301314UL, 2332030190UL, 1864098798UL, 276747442UL, 2776569227UL, 2992780663UL, 3027279789UL, 1074555384UL, 3481518659UL, 2499703783UL, 661805703UL, 3782305562UL, 9186074UL, 2357407210UL, 2355922343UL, 2024733363UL, 485434612UL, 862379913UL, 1029706268UL, 1512726310UL, 3834948354UL, 1435892840UL, 3297980694UL, 2831553800UL, 2111416471UL, +711321697UL, 3465348660UL, 3623545008UL, 3505902593UL, 838034830UL, 1553436793UL, 2595329276UL, 3367746385UL, 3197935201UL, 1439351946UL, 3198044157UL, 4165798087UL, 3634792639UL, 2359485974UL, 2772582925UL, 836042976UL, 3771562484UL, 1508694157UL, 1564641206UL, 2801985736UL, 1190371491UL, 3849126897UL, 1842973671UL, 944408104UL, 2624631280UL, 410746791UL, 3737368614UL, 858809173UL, 2289802345UL, 2428186575UL, 1542325976UL, 716011303UL, +3443810690UL, 814132610UL, 517432787UL, 1649301063UL, 2930433345UL, 291178098UL, 2117644502UL, 2749446703UL, 3955511579UL, 365684723UL, 1705418876UL, 2213749318UL, 4011417220UL, 2753632862UL, 988348831UL, 94258998UL, 2771150272UL, 498058526UL, 3314106168UL, 2961955291UL, 262703473UL, 1404034822UL, 1566595865UL, 3590367097UL, 1706522206UL, 1203054806UL, 1273801539UL, 2070583465UL, 2340683261UL, 3231505231UL, 619636751UL, 3746997351UL, +4103027837UL, 2785398766UL, 3355878253UL, 3433356888UL, 107785753UL, 2779092609UL, 1608451840UL, 2555219983UL, 903319808UL, 3273374169UL, 2538926990UL, 645164419UL, 1356500860UL, 1661983738UL, 1380761625UL, 2919458459UL, 2260224548UL, 1430817627UL, 517007606UL, 1421570516UL, 2371447300UL, 1636004496UL, 3684889351UL, 3873926653UL, 788770697UL, 1854750277UL, 1345251011UL, 1137299679UL, 848527832UL, 3850486924UL, 4179307312UL, 3576574608UL, +1353191605UL, 4166891919UL, 2074703841UL, 3373997532UL, 183447754UL, 701389744UL, 841917592UL, 2065742268UL, 2721848192UL, 2109289891UL, 3122896007UL, 1090761479UL, 921859028UL, 4086736376UL, 2212730874UL, 2579826431UL, 2436217134UL, 839037727UL, 1072086642UL, 55934784UL, 3764758228UL, 1501128342UL, 3669108708UL, 1601407381UL, 516550987UL, 3268308948UL, 3337564231UL, 1986911578UL, 3379194930UL, 3973484473UL, 2098537451UL, 51515980UL, +1176526086UL, 3213391582UL, 4251661633UL, 2273586703UL, 376085505UL, 1493749800UL, 3970342143UL, 3190791788UL, 2165301314UL, 2332030190UL, 1864098798UL, 276747442UL, 2991976613UL, 2992780663UL, 3027279789UL, 1074555384UL, 3481518659UL, 1399789494UL, 661805703UL, 3782305562UL, 9186074UL, 2357407210UL, 1942736967UL, 2024733363UL, 485434612UL, 862379913UL, 1029706268UL, 4122704494UL, 3834948354UL, 1435892840UL, 3297980694UL, 2831553800UL, +1210092654UL, 711321697UL, 3465348660UL, 3623545008UL, 3505902593UL, 3443231198UL, 1553436793UL, 2595329276UL, 3367746385UL, 3197935201UL, 1304974987UL, 3198044157UL, 4165798087UL, 3634792639UL, 2359485974UL, 3518323362UL, 836042976UL, 3771562484UL, 1508694157UL, 1564641206UL, 3577633375UL, 1190371491UL, 3849126897UL, 1842973671UL, 944408104UL, 1854555112UL, 410746791UL, 3737368614UL, 858809173UL, 2289802345UL, 3622671731UL, 1542325976UL, +716011303UL, 3443810690UL, 814132610UL, 296197011UL, 1649301063UL, 2930433345UL, 291178098UL, 2117644502UL, 1056271538UL, 3955511579UL, 365684723UL, 1705418876UL, 2213749318UL, 1258535671UL, 2753632862UL, 988348831UL, 94258998UL, 2771150272UL, 3669902097UL, 3314106168UL, 2961955291UL, 262703473UL, 1404034822UL, 1654433938UL, 3590367097UL, 1706522206UL, 1203054806UL, 1273801539UL, 2448138887UL, 2340683261UL, 3231505231UL, 619636751UL, +3746997351UL, 1454088394UL, 2785398766UL, 3355878253UL, 3433356888UL, 107785753UL, 689323470UL, 1608451840UL, 2555219983UL, 903319808UL, 3273374169UL, 1603842392UL, 645164419UL, 1356500860UL, 1661983738UL, 1380761625UL, 2814639423UL, 2260224548UL, 1430817627UL, 517007606UL, 1421570516UL, 1938805701UL, 1636004496UL, 3684889351UL, 3873926653UL, 788770697UL, 4238900666UL, 1345251011UL, 1137299679UL, 848527832UL, 3850486924UL, 108793827UL, +3576574608UL, 1353191605UL, 4166891919UL, 2074703841UL, 3780897861UL, 183447754UL, 701389744UL, 841917592UL, 2065742268UL, 3036602746UL, 2109289891UL, 3122896007UL, 1090761479UL, 921859028UL, 3499985398UL, 2212730874UL, 2579826431UL, 2436217134UL, 839037727UL, 3520354700UL, 55934784UL, 3764758228UL, 1501128342UL, 3669108708UL, 1601010847UL, 516550987UL, 3268308948UL, 3337564231UL, 1986911578UL, 2704241781UL, 3973484473UL, 2098537451UL, +51515980UL, 1176526086UL, 3602010532UL, 4251661633UL, 2273586703UL, 376085505UL, 1493749800UL, 2922957328UL, 3190791788UL, 2165301314UL, 2332030190UL, 1864098798UL, 1649666443UL, 2991976613UL, 2992780663UL, 3027279789UL, 1074555384UL, 2848531519UL, 1399789494UL, 661805703UL, 3782305562UL, 9186074UL, 320781315UL, 1942736967UL, 2024733363UL, 485434612UL, 862379913UL, 3598892066UL, 4122704494UL, 3834948354UL, 1435892840UL, 3297980694UL, +545184652UL, 1210092654UL, 711321697UL, 3465348660UL, 3623545008UL, 1173753045UL, 3443231198UL, 1553436793UL, 2595329276UL, 3367746385UL, 2444634476UL, 1304974987UL, 3198044157UL, 4165798087UL, 3634792639UL, 1837035806UL, 3518323362UL, 836042976UL, 3771562484UL, 1508694157UL, 2899021294UL, 3577633375UL, 1190371491UL, 3849126897UL, 1842973671UL, 1614215215UL, 1854555112UL, 410746791UL, 3737368614UL, 858809173UL, 525745365UL, 3622671731UL, +1542325976UL, 716011303UL, 3443810690UL, 566299749UL, 296197011UL, 1649301063UL, 2930433345UL, 291178098UL, 1987532525UL, 1056271538UL, 3955511579UL, 365684723UL, 1705418876UL, 2321222760UL, 1258535671UL, 2753632862UL, 988348831UL, 94258998UL, 2986060366UL, 3669902097UL, 3314106168UL, 2961955291UL, 262703473UL, 604452796UL, 1654433938UL, 3590367097UL, 1706522206UL, 1203054806UL, 1894894069UL, 2448138887UL, 2340683261UL, 3231505231UL, +619636751UL, 6680729UL, 1454088394UL, 2785398766UL, 3355878253UL, 3433356888UL, 2025591660UL, 689323470UL, 1608451840UL, 2555219983UL, 903319808UL, 3430384385UL, 1603842392UL, 645164419UL, 1356500860UL, 1661983738UL, 2108736152UL, 2814639423UL, 2260224548UL, 1430817627UL, 517007606UL, 2973658959UL, 1938805701UL, 1636004496UL, 3684889351UL, 3873926653UL, 2283691941UL, 4238900666UL, 1345251011UL, 1137299679UL, 848527832UL, 45551112UL, +108793827UL, 3576574608UL, 1353191605UL, 4166891919UL, 3776615962UL, 3780897861UL, 183447754UL, 701389744UL, 841917592UL, 3830639316UL, 3036602746UL, 2109289891UL, 3122896007UL, 1090761479UL, 1931255897UL, 3499985398UL, 2212730874UL, 2579826431UL, 2436217134UL, 3272166055UL, 3520354700UL, 55934784UL, 3764758228UL, 1501128342UL, 1567864246UL, 1601010847UL, 516550987UL, 3268308948UL, 3337564231UL, 3918802424UL, 2704241781UL, 3973484473UL, +2098537451UL, 51515980UL, 3551394489UL, 3602010532UL, 4251661633UL, 2273586703UL, 376085505UL, 885459498UL, 2922957328UL, 3190791788UL, 2165301314UL, 2332030190UL, 3197056515UL, 1649666443UL, 2991976613UL, 2992780663UL, 3027279789UL, 2385348906UL, 2848531519UL, 1399789494UL, 661805703UL, 3782305562UL, 2163075465UL, 320781315UL, 1942736967UL, 2024733363UL, 485434612UL, 2680597981UL, 3598892066UL, 4122704494UL, 3834948354UL, 1435892840UL, +2499644163UL, 2704575422UL, 2579557838UL, 673530532UL, 493730767UL, 1124557747UL, 1908629439UL, 2821949504UL, 1743112513UL, 2849457841UL, 2344409314UL, 3479159262UL, 4260973770UL, 2991970754UL, 3812641863UL, 2229319917UL, 2466968521UL, 1766353737UL, 3216591612UL, 2113272648UL, 364370737UL, 1893001758UL, 2608875275UL, 4224057183UL, 3546705413UL, 1999778009UL, 348872225UL, 2470564216UL, 1417878284UL, 2709790112UL, 3579129936UL, 2137971615UL, +4046639861UL, 2841156930UL, 391544737UL, 2056567354UL, 737657378UL, 3877904725UL, 578930752UL, 1759172471UL, 3383278785UL, 1047197514UL, 649468151UL, 3452867243UL, 1792089520UL, 63936215UL, 3909143729UL, 3753489875UL, 734314122UL, 2490530916UL, 3043874586UL, 1504812057UL, 59001199UL, 2493748676UL, 2552438622UL, 1889694845UL, 3715397860UL, 2817245010UL, 3841049206UL, 816106718UL, 2176130406UL, 640254735UL, 12376903UL, 3000264936UL, +3304116079UL, 1620334094UL, 2109391765UL, 1348210951UL, 2237645681UL, 1207768272UL, 1562894669UL, 2156631655UL, 1387193235UL, 3154858817UL, 633510901UL, 2312190757UL, 402878244UL, 2501565021UL, 2984409334UL, 4167491216UL, 3614267292UL, 3078552271UL, 971722322UL, 3065543880UL, 2307584190UL, 491480322UL, 2068673112UL, 1929780632UL, 178549964UL, 983979983UL, 2769314886UL, 4214442042UL, 2977609682UL, 25450683UL, 3075212658UL, 1571149568UL, +3531670561UL, 42782504UL, 425601306UL, 428715214UL, 497250251UL, 693520802UL, 166426814UL, 1786382125UL, 2712003995UL, 3610802197UL, 2076490757UL, 404822980UL, 3953184772UL, 1655231947UL, 3594351577UL, 3068232274UL, 3771730346UL, 4110519574UL, 3534704897UL, 2375277865UL, 3597780202UL, 3472676002UL, 1350276449UL, 3218248239UL, 3589255283UL, 3253132633UL, 1769885529UL, 3792812294UL, 120332643UL, 1219374788UL, 3608889019UL, 2386099811UL, +858495304UL, 1284785543UL, 331370962UL, 2259419662UL, 2519864134UL, 3194739432UL, 2669074511UL, 2565559140UL, 3378072004UL, 2647801475UL, 265068954UL, 1464416963UL, 1232787612UL, 4160089759UL, 2510685972UL, 670300081UL, 2509357766UL, 1981891975UL, 4161588397UL, 1371924626UL, 44760868UL, 634955171UL, 1187096933UL, 3324788972UL, 3576888559UL, 2801347752UL, 3730298395UL, 1702170762UL, 4206083415UL, 741409141UL, 3649731355UL, 1025429529UL, +}, +{ +91444490UL, 628576944UL, 4069219862UL, 2253058925UL, 492354082UL, 1191182242UL, 1565180119UL, 2257613723UL, 456055162UL, 605712223UL, 953365104UL, 3104638527UL, 1133984729UL, 2662828416UL, 2134948274UL, 1921384447UL, 843719355UL, 588432962UL, 1734575434UL, 2924140067UL, 483396548UL, 3848838894UL, 3155476556UL, 1760928304UL, 4168059840UL, 3279827269UL, 2644461735UL, 4168565656UL, 3951563569UL, 1276805504UL, 1708974143UL, 1878547888UL, +3465220024UL, 3062086782UL, 2801401651UL, 1510428126UL, 716404149UL, 1646021208UL, 3534932385UL, 1186585561UL, 651997355UL, 282914223UL, 352224857UL, 3764407517UL, 1059868753UL, 1971798134UL, 978904005UL, 976413661UL, 4039544152UL, 498989693UL, 2565125471UL, 2782642813UL, 3537961025UL, 1194967362UL, 169217024UL, 3491609UL, 1319592872UL, 1630206561UL, 2497130840UL, 1685008996UL, 2828944016UL, 3301346775UL, 2893072371UL, 2606559798UL, +4026138031UL, 2664450619UL, 691091062UL, 1079640113UL, 1417637732UL, 4081852209UL, 2197910648UL, 2310382370UL, 1000957047UL, 959936499UL, 2844551811UL, 2272766890UL, 31122394UL, 2742925483UL, 1121884686UL, 57929089UL, 2468361281UL, 2982007782UL, 2371576893UL, 177782593UL, 3603584577UL, 672057044UL, 2108452841UL, 1671338057UL, 3386908223UL, 1243029765UL, 805157552UL, 1271858417UL, 1621249501UL, 1804851492UL, 1321010403UL, 751773221UL, +1517221627UL, 822709871UL, 104533154UL, 3578182264UL, 640541709UL, 421086624UL, 4233576392UL, 3729339369UL, 197460644UL, 773140636UL, 2158026018UL, 1756785611UL, 4011575991UL, 3569445500UL, 736117181UL, 2456162322UL, 1168189787UL, 3651312675UL, 1070291988UL, 268231205UL, 541474497UL, 3316168972UL, 3546990856UL, 830417208UL, 725960194UL, 2044207227UL, 3188997938UL, 2383298579UL, 3350316374UL, 3575011225UL, 1553111865UL, 1285013027UL, +749371711UL, 766611716UL, 598195098UL, 2139882719UL, 2062405428UL, 3634702446UL, 3015263295UL, 223311969UL, 2622859522UL, 3888492701UL, 2955257225UL, 582625650UL, 3563756446UL, 2886083960UL, 1907546514UL, 454650902UL, 3287277541UL, 625828138UL, 2991888140UL, 1935326370UL, 4031152256UL, 702881509UL, 1427632724UL, 1345475301UL, 2577560804UL, 2858595147UL, 2533191188UL, 185662179UL, 536505093UL, 3747894147UL, 111551030UL, 370373207UL, +2293908590UL, 91444490UL, 628576944UL, 4069219862UL, 2253058925UL, 1671484924UL, 1191182242UL, 1565180119UL, 2257613723UL, 456055162UL, 3411094744UL, 953365104UL, 3104638527UL, 1133984729UL, 2662828416UL, 2000630022UL, 1921384447UL, 843719355UL, 588432962UL, 1734575434UL, 3293926122UL, 483396548UL, 3848838894UL, 3155476556UL, 1760928304UL, 146876953UL, 3279827269UL, 2644461735UL, 4168565656UL, 3951563569UL, 3976156700UL, 1708974143UL, +1878547888UL, 3465220024UL, 3062086782UL, 1999154400UL, 1510428126UL, 716404149UL, 1646021208UL, 3534932385UL, 2479551429UL, 651997355UL, 282914223UL, 352224857UL, 3764407517UL, 1275979651UL, 1971798134UL, 978904005UL, 976413661UL, 4039544152UL, 300654823UL, 2565125471UL, 2782642813UL, 3537961025UL, 1194967362UL, 3123973648UL, 3491609UL, 1319592872UL, 1630206561UL, 2497130840UL, 1437913158UL, 2828944016UL, 3301346775UL, 2893072371UL, +2606559798UL, 2153172585UL, 2664450619UL, 691091062UL, 1079640113UL, 1417637732UL, 17137237UL, 2197910648UL, 2310382370UL, 1000957047UL, 959936499UL, 802137134UL, 2272766890UL, 31122394UL, 2742925483UL, 1121884686UL, 3909775167UL, 2468361281UL, 2982007782UL, 2371576893UL, 177782593UL, 3319492525UL, 672057044UL, 2108452841UL, 1671338057UL, 3386908223UL, 1878151473UL, 805157552UL, 1271858417UL, 1621249501UL, 1804851492UL, 3215921223UL, +751773221UL, 1517221627UL, 822709871UL, 104533154UL, 361845001UL, 640541709UL, 421086624UL, 4233576392UL, 3729339369UL, 2655936801UL, 773140636UL, 2158026018UL, 1756785611UL, 4011575991UL, 587202971UL, 736117181UL, 2456162322UL, 1168189787UL, 3651312675UL, 2517883370UL, 268231205UL, 541474497UL, 3316168972UL, 3546990856UL, 2037251305UL, 725960194UL, 2044207227UL, 3188997938UL, 2383298579UL, 2665008587UL, 3575011225UL, 1553111865UL, +1285013027UL, 749371711UL, 2163964019UL, 598195098UL, 2139882719UL, 2062405428UL, 3634702446UL, 2788202059UL, 223311969UL, 2622859522UL, 3888492701UL, 2955257225UL, 740986174UL, 3563756446UL, 2886083960UL, 1907546514UL, 454650902UL, 2426323587UL, 625828138UL, 2991888140UL, 1935326370UL, 4031152256UL, 1831149435UL, 1427632724UL, 1345475301UL, 2577560804UL, 2858595147UL, 3977153945UL, 185662179UL, 536505093UL, 3747894147UL, 111551030UL, +4131587422UL, 2293908590UL, 91444490UL, 628576944UL, 4069219862UL, 2408189350UL, 1671484924UL, 1191182242UL, 1565180119UL, 2257613723UL, 1338069254UL, 3411094744UL, 953365104UL, 3104638527UL, 1133984729UL, 631497759UL, 2000630022UL, 1921384447UL, 843719355UL, 588432962UL, 3280318959UL, 3293926122UL, 483396548UL, 3848838894UL, 3155476556UL, 1777918163UL, 146876953UL, 3279827269UL, 2644461735UL, 4168565656UL, 2786264663UL, 3976156700UL, +1708974143UL, 1878547888UL, 3465220024UL, 2793923820UL, 1999154400UL, 1510428126UL, 716404149UL, 1646021208UL, 3102243824UL, 2479551429UL, 651997355UL, 282914223UL, 352224857UL, 3767702588UL, 1275979651UL, 1971798134UL, 978904005UL, 976413661UL, 1951622548UL, 300654823UL, 2565125471UL, 2782642813UL, 3537961025UL, 2186817324UL, 3123973648UL, 3491609UL, 1319592872UL, 1630206561UL, 1075424534UL, 1437913158UL, 2828944016UL, 3301346775UL, +2893072371UL, 207992406UL, 2153172585UL, 2664450619UL, 691091062UL, 1079640113UL, 3114255216UL, 17137237UL, 2197910648UL, 2310382370UL, 1000957047UL, 2548008553UL, 802137134UL, 2272766890UL, 31122394UL, 2742925483UL, 4069482373UL, 3909775167UL, 2468361281UL, 2982007782UL, 2371576893UL, 2807823912UL, 3319492525UL, 672057044UL, 2108452841UL, 1671338057UL, 12831353UL, 1878151473UL, 805157552UL, 1271858417UL, 1621249501UL, 461887094UL, +3215921223UL, 751773221UL, 1517221627UL, 822709871UL, 1317394918UL, 361845001UL, 640541709UL, 421086624UL, 4233576392UL, 3385587450UL, 2655936801UL, 773140636UL, 2158026018UL, 1756785611UL, 1475601973UL, 587202971UL, 736117181UL, 2456162322UL, 1168189787UL, 911455077UL, 2517883370UL, 268231205UL, 541474497UL, 3316168972UL, 1500275507UL, 2037251305UL, 725960194UL, 2044207227UL, 3188997938UL, 2036633808UL, 2665008587UL, 3575011225UL, +1553111865UL, 1285013027UL, 87868216UL, 2163964019UL, 598195098UL, 2139882719UL, 2062405428UL, 517907301UL, 2788202059UL, 223311969UL, 2622859522UL, 3888492701UL, 3926046234UL, 740986174UL, 3563756446UL, 2886083960UL, 1907546514UL, 1911066215UL, 2426323587UL, 625828138UL, 2991888140UL, 1935326370UL, 2031853435UL, 1831149435UL, 1427632724UL, 1345475301UL, 2577560804UL, 3509674153UL, 3977153945UL, 185662179UL, 536505093UL, 3747894147UL, +1711714600UL, 4131587422UL, 2293908590UL, 91444490UL, 628576944UL, 3370678255UL, 2408189350UL, 1671484924UL, 1191182242UL, 1565180119UL, 3786239592UL, 1338069254UL, 3411094744UL, 953365104UL, 3104638527UL, 3659647225UL, 631497759UL, 2000630022UL, 1921384447UL, 843719355UL, 3364831282UL, 3280318959UL, 3293926122UL, 483396548UL, 3848838894UL, 3131266478UL, 1777918163UL, 146876953UL, 3279827269UL, 2644461735UL, 4156372383UL, 2786264663UL, +3976156700UL, 1708974143UL, 1878547888UL, 2168041590UL, 2793923820UL, 1999154400UL, 1510428126UL, 716404149UL, 3392113666UL, 3102243824UL, 2479551429UL, 651997355UL, 282914223UL, 2085613514UL, 3767702588UL, 1275979651UL, 1971798134UL, 978904005UL, 503506384UL, 1951622548UL, 300654823UL, 2565125471UL, 2782642813UL, 1458431750UL, 2186817324UL, 3123973648UL, 3491609UL, 1319592872UL, 452433679UL, 1075424534UL, 1437913158UL, 2828944016UL, +3301346775UL, 2333281307UL, 207992406UL, 2153172585UL, 2664450619UL, 691091062UL, 3553502652UL, 3114255216UL, 17137237UL, 2197910648UL, 2310382370UL, 3153689868UL, 2548008553UL, 802137134UL, 2272766890UL, 31122394UL, 468580641UL, 4069482373UL, 3909775167UL, 2468361281UL, 2982007782UL, 1445286890UL, 2807823912UL, 3319492525UL, 672057044UL, 2108452841UL, 1755577669UL, 12831353UL, 1878151473UL, 805157552UL, 1271858417UL, 2623540912UL, +461887094UL, 3215921223UL, 751773221UL, 1517221627UL, 3922191946UL, 1317394918UL, 361845001UL, 640541709UL, 421086624UL, 2173849516UL, 3385587450UL, 2655936801UL, 773140636UL, 2158026018UL, 1085377158UL, 1475601973UL, 587202971UL, 736117181UL, 2456162322UL, 2158960374UL, 911455077UL, 2517883370UL, 268231205UL, 541474497UL, 943191315UL, 1500275507UL, 2037251305UL, 725960194UL, 2044207227UL, 2481150802UL, 2036633808UL, 2665008587UL, +3575011225UL, 1553111865UL, 2301231777UL, 87868216UL, 2163964019UL, 598195098UL, 2139882719UL, 2007840238UL, 517907301UL, 2788202059UL, 223311969UL, 2622859522UL, 151920263UL, 3926046234UL, 740986174UL, 3563756446UL, 2886083960UL, 1338937928UL, 1911066215UL, 2426323587UL, 625828138UL, 2991888140UL, 2652286195UL, 2031853435UL, 1831149435UL, 1427632724UL, 1345475301UL, 289801789UL, 3509674153UL, 3977153945UL, 185662179UL, 536505093UL, +2727322952UL, 3980498348UL, 2529622213UL, 1903052964UL, 3564714651UL, 2281240568UL, 533384122UL, 277613480UL, 1815540358UL, 282763841UL, 3669112623UL, 2572859425UL, 195220178UL, 1210883545UL, 2359703600UL, 1187537824UL, 675732974UL, 325036095UL, 708091465UL, 2556854604UL, 701006284UL, 2378459191UL, 1863513103UL, 2690918197UL, 4237307694UL, 1356483501UL, 2160905652UL, 521809106UL, 974368613UL, 3136010957UL, 2722488678UL, 3711515637UL, +2296341459UL, 4233729945UL, 1196247571UL, 3031398071UL, 515543502UL, 1314129776UL, 3235373306UL, 1303165859UL, 1820568009UL, 559099351UL, 186876368UL, 1076102111UL, 1218809551UL, 1790301111UL, 4130210229UL, 768125358UL, 1132864749UL, 4262563773UL, 2294411020UL, 4092943985UL, 2558108246UL, 3737664949UL, 2219923393UL, 724326159UL, 4134105682UL, 4188752746UL, 3615233671UL, 1526018731UL, 2281637916UL, 2459490295UL, 3637342666UL, 777862587UL, +39962002UL, 3772005832UL, 997473319UL, 574843584UL, 3356551974UL, 1265234427UL, 1698059437UL, 534747571UL, 1465532164UL, 3263029035UL, 534512444UL, 2343092827UL, 2375685652UL, 2497926141UL, 2377933621UL, 2212335180UL, 261114084UL, 172755755UL, 2737085495UL, 2225257145UL, 148605658UL, 1353911796UL, 357753009UL, 1778732943UL, 497635558UL, 4136467976UL, 2837964962UL, 4045039047UL, 2485296762UL, 1587587183UL, 4042904168UL, 3184240963UL, +2393293696UL, 915444966UL, 2299938515UL, 3351580749UL, 506575598UL, 1541916825UL, 3465300401UL, 525927458UL, 681152801UL, 331660975UL, 3624685846UL, 2994172100UL, 3274369082UL, 3638287602UL, 815689760UL, 1710961092UL, 2775607076UL, 2175058103UL, 3252688367UL, 2936890483UL, 2746319120UL, 2736754UL, 1646031035UL, 2448701214UL, 2886833213UL, 3689830606UL, 3292798106UL, 300773646UL, 3125160783UL, 1247453205UL, 2746275624UL, 4011063775UL, +904135764UL, 876847374UL, 366267234UL, 2541269205UL, 131376648UL, 1805948133UL, 3383589530UL, 2350119829UL, 2513170439UL, 4096158499UL, 4229211520UL, 2992048272UL, 1338522080UL, 1187391335UL, 2898563453UL, 2163088451UL, 1417971677UL, 2047421551UL, 902282791UL, 1143943232UL, 3568431811UL, 4059861993UL, 193362198UL, 2509297125UL, 3968551582UL, 2175686117UL, 3568936881UL, 1853177468UL, 2134063169UL, 2919389416UL, 1124914545UL, 1209806738UL, +}, +{ +1199972651UL, 1035834631UL, 3177798370UL, 860834162UL, 3741677748UL, 3780327829UL, 1693730265UL, 1643429511UL, 559568669UL, 2758650294UL, 647308222UL, 3901603996UL, 1778653821UL, 3618523672UL, 2154201067UL, 4261179460UL, 3285764480UL, 3334002738UL, 3215795953UL, 91368462UL, 1883994950UL, 1506873376UL, 1527780962UL, 4046354597UL, 4081676034UL, 2389066602UL, 1574939945UL, 427845396UL, 2714836263UL, 1259019491UL, 2493238133UL, 2584034689UL, +3151382431UL, 2171033919UL, 176883719UL, 2031844862UL, 1272380790UL, 1298975901UL, 4087222847UL, 1524000054UL, 311436877UL, 3627785554UL, 1889491722UL, 2938069193UL, 2771940687UL, 2756955968UL, 4289348777UL, 263514583UL, 887207028UL, 3522902525UL, 2273246349UL, 835377715UL, 2897243319UL, 204645450UL, 1775911983UL, 639470242UL, 2856296318UL, 3032942383UL, 2845501282UL, 1979082575UL, 202834023UL, 1876303820UL, 1434703409UL, 4240524132UL, +848853780UL, 4188621628UL, 928095314UL, 876412914UL, 3446576392UL, 3235688990UL, 4021419931UL, 2483628986UL, 3155781890UL, 399997246UL, 1642535200UL, 3872575068UL, 1577956550UL, 3606228634UL, 609914462UL, 653194726UL, 4048067248UL, 2500767965UL, 1125167825UL, 3707628088UL, 1819135158UL, 1875618971UL, 3865851141UL, 328215079UL, 1695889194UL, 2040280471UL, 3384684457UL, 2540504961UL, 293050253UL, 525570078UL, 2655676443UL, 1392199429UL, +3370444585UL, 1937915855UL, 2229636250UL, 247937142UL, 2534538765UL, 365841057UL, 2449431033UL, 2456532429UL, 101910696UL, 1247069485UL, 1523958293UL, 2473285670UL, 473709728UL, 3026667113UL, 2071968844UL, 324025193UL, 423064436UL, 3870800061UL, 3977393138UL, 3632553233UL, 352757977UL, 1584833348UL, 3173248650UL, 1159857686UL, 1501841977UL, 1751860798UL, 617281070UL, 1958012761UL, 4031667102UL, 3232142321UL, 3087428595UL, 2380824676UL, +1194087757UL, 1542961747UL, 4163350364UL, 1721646249UL, 1672791861UL, 2900511710UL, 24973500UL, 1705444176UL, 713642505UL, 3017719513UL, 2090715200UL, 3521434070UL, 37117223UL, 1948295454UL, 3055840561UL, 3476120789UL, 3994249388UL, 527899063UL, 4285770666UL, 1075524023UL, 2594223535UL, 392943522UL, 171012646UL, 3515750082UL, 3414659054UL, 3501852926UL, 1493283737UL, 2662104279UL, 2033464928UL, 90134967UL, 363058647UL, 3289266998UL, +2470752727UL, 1199972651UL, 1035834631UL, 3177798370UL, 860834162UL, 1791097822UL, 3780327829UL, 1693730265UL, 1643429511UL, 559568669UL, 3503319486UL, 647308222UL, 3901603996UL, 1778653821UL, 3618523672UL, 4294594427UL, 4261179460UL, 3285764480UL, 3334002738UL, 3215795953UL, 212518363UL, 1883994950UL, 1506873376UL, 1527780962UL, 4046354597UL, 2398655600UL, 2389066602UL, 1574939945UL, 427845396UL, 2714836263UL, 2744363872UL, 2493238133UL, +2584034689UL, 3151382431UL, 2171033919UL, 2787053497UL, 2031844862UL, 1272380790UL, 1298975901UL, 4087222847UL, 2342953154UL, 311436877UL, 3627785554UL, 1889491722UL, 2938069193UL, 2026656505UL, 2756955968UL, 4289348777UL, 263514583UL, 887207028UL, 2097276163UL, 2273246349UL, 835377715UL, 2897243319UL, 204645450UL, 4233399907UL, 639470242UL, 2856296318UL, 3032942383UL, 2845501282UL, 28260330UL, 202834023UL, 1876303820UL, 1434703409UL, +4240524132UL, 2455670466UL, 4188621628UL, 928095314UL, 876412914UL, 3446576392UL, 117581687UL, 4021419931UL, 2483628986UL, 3155781890UL, 399997246UL, 4254101087UL, 3872575068UL, 1577956550UL, 3606228634UL, 609914462UL, 4003279048UL, 4048067248UL, 2500767965UL, 1125167825UL, 3707628088UL, 922020515UL, 1875618971UL, 3865851141UL, 328215079UL, 1695889194UL, 625773097UL, 3384684457UL, 2540504961UL, 293050253UL, 525570078UL, 2592805114UL, +1392199429UL, 3370444585UL, 1937915855UL, 2229636250UL, 3190958614UL, 2534538765UL, 365841057UL, 2449431033UL, 2456532429UL, 3778669305UL, 1247069485UL, 1523958293UL, 2473285670UL, 473709728UL, 720895889UL, 2071968844UL, 324025193UL, 423064436UL, 3870800061UL, 3535536111UL, 3632553233UL, 352757977UL, 1584833348UL, 3173248650UL, 2649344603UL, 1501841977UL, 1751860798UL, 617281070UL, 1958012761UL, 778965559UL, 3232142321UL, 3087428595UL, +2380824676UL, 1194087757UL, 3880222002UL, 4163350364UL, 1721646249UL, 1672791861UL, 2900511710UL, 702936770UL, 1705444176UL, 713642505UL, 3017719513UL, 2090715200UL, 1477858694UL, 37117223UL, 1948295454UL, 3055840561UL, 3476120789UL, 464173532UL, 527899063UL, 4285770666UL, 1075524023UL, 2594223535UL, 2872629966UL, 171012646UL, 3515750082UL, 3414659054UL, 3501852926UL, 1631555059UL, 2662104279UL, 2033464928UL, 90134967UL, 363058647UL, +4112991722UL, 2470752727UL, 1199972651UL, 1035834631UL, 3177798370UL, 4152098951UL, 1791097822UL, 3780327829UL, 1693730265UL, 1643429511UL, 153020604UL, 3503319486UL, 647308222UL, 3901603996UL, 1778653821UL, 221887019UL, 4294594427UL, 4261179460UL, 3285764480UL, 3334002738UL, 3340918862UL, 212518363UL, 1883994950UL, 1506873376UL, 1527780962UL, 430180116UL, 2398655600UL, 2389066602UL, 1574939945UL, 427845396UL, 1683639957UL, 2744363872UL, +2493238133UL, 2584034689UL, 3151382431UL, 752704472UL, 2787053497UL, 2031844862UL, 1272380790UL, 1298975901UL, 1528220628UL, 2342953154UL, 311436877UL, 3627785554UL, 1889491722UL, 2576495467UL, 2026656505UL, 2756955968UL, 4289348777UL, 263514583UL, 3778019638UL, 2097276163UL, 2273246349UL, 835377715UL, 2897243319UL, 1060067446UL, 4233399907UL, 639470242UL, 2856296318UL, 3032942383UL, 2351047932UL, 28260330UL, 202834023UL, 1876303820UL, +1434703409UL, 3094305336UL, 2455670466UL, 4188621628UL, 928095314UL, 876412914UL, 3785385583UL, 117581687UL, 4021419931UL, 2483628986UL, 3155781890UL, 1867816730UL, 4254101087UL, 3872575068UL, 1577956550UL, 3606228634UL, 3081878598UL, 4003279048UL, 4048067248UL, 2500767965UL, 1125167825UL, 928465955UL, 922020515UL, 1875618971UL, 3865851141UL, 328215079UL, 173810260UL, 625773097UL, 3384684457UL, 2540504961UL, 293050253UL, 2645143254UL, +2592805114UL, 1392199429UL, 3370444585UL, 1937915855UL, 162781360UL, 3190958614UL, 2534538765UL, 365841057UL, 2449431033UL, 3105377832UL, 3778669305UL, 1247069485UL, 1523958293UL, 2473285670UL, 800971948UL, 720895889UL, 2071968844UL, 324025193UL, 423064436UL, 52577992UL, 3535536111UL, 3632553233UL, 352757977UL, 1584833348UL, 3305908059UL, 2649344603UL, 1501841977UL, 1751860798UL, 617281070UL, 264880505UL, 778965559UL, 3232142321UL, +3087428595UL, 2380824676UL, 1127761012UL, 3880222002UL, 4163350364UL, 1721646249UL, 1672791861UL, 2368512339UL, 702936770UL, 1705444176UL, 713642505UL, 3017719513UL, 197200752UL, 1477858694UL, 37117223UL, 1948295454UL, 3055840561UL, 1588372042UL, 464173532UL, 527899063UL, 4285770666UL, 1075524023UL, 2124039914UL, 2872629966UL, 171012646UL, 3515750082UL, 3414659054UL, 818571456UL, 1631555059UL, 2662104279UL, 2033464928UL, 90134967UL, +952712086UL, 4112991722UL, 2470752727UL, 1199972651UL, 1035834631UL, 888975816UL, 4152098951UL, 1791097822UL, 3780327829UL, 1693730265UL, 3406785510UL, 153020604UL, 3503319486UL, 647308222UL, 3901603996UL, 3753248472UL, 221887019UL, 4294594427UL, 4261179460UL, 3285764480UL, 1861431346UL, 3340918862UL, 212518363UL, 1883994950UL, 1506873376UL, 2695939612UL, 430180116UL, 2398655600UL, 2389066602UL, 1574939945UL, 2852159074UL, 1683639957UL, +2744363872UL, 2493238133UL, 2584034689UL, 1952065633UL, 752704472UL, 2787053497UL, 2031844862UL, 1272380790UL, 3530505866UL, 1528220628UL, 2342953154UL, 311436877UL, 3627785554UL, 3410473245UL, 2576495467UL, 2026656505UL, 2756955968UL, 4289348777UL, 2856163034UL, 3778019638UL, 2097276163UL, 2273246349UL, 835377715UL, 3127280755UL, 1060067446UL, 4233399907UL, 639470242UL, 2856296318UL, 2615775011UL, 2351047932UL, 28260330UL, 202834023UL, +1876303820UL, 619308202UL, 3094305336UL, 2455670466UL, 4188621628UL, 928095314UL, 3764894047UL, 3785385583UL, 117581687UL, 4021419931UL, 2483628986UL, 3759839215UL, 1867816730UL, 4254101087UL, 3872575068UL, 1577956550UL, 1687107439UL, 3081878598UL, 4003279048UL, 4048067248UL, 2500767965UL, 2804044146UL, 928465955UL, 922020515UL, 1875618971UL, 3865851141UL, 2359176389UL, 173810260UL, 625773097UL, 3384684457UL, 2540504961UL, 3665420733UL, +2645143254UL, 2592805114UL, 1392199429UL, 3370444585UL, 1604709429UL, 162781360UL, 3190958614UL, 2534538765UL, 365841057UL, 3843585067UL, 3105377832UL, 3778669305UL, 1247069485UL, 1523958293UL, 293374051UL, 800971948UL, 720895889UL, 2071968844UL, 324025193UL, 3342361801UL, 52577992UL, 3535536111UL, 3632553233UL, 352757977UL, 1386594581UL, 3305908059UL, 2649344603UL, 1501841977UL, 1751860798UL, 3160423601UL, 264880505UL, 778965559UL, +3232142321UL, 3087428595UL, 3814775120UL, 1127761012UL, 3880222002UL, 4163350364UL, 1721646249UL, 3640773034UL, 2368512339UL, 702936770UL, 1705444176UL, 713642505UL, 1717761787UL, 197200752UL, 1477858694UL, 37117223UL, 1948295454UL, 896215772UL, 1588372042UL, 464173532UL, 527899063UL, 4285770666UL, 3441409029UL, 2124039914UL, 2872629966UL, 171012646UL, 3515750082UL, 2216687886UL, 818571456UL, 1631555059UL, 2662104279UL, 2033464928UL, +369438400UL, 329003658UL, 1503365029UL, 4215790910UL, 3264377550UL, 733526983UL, 2935318632UL, 1792331479UL, 608347530UL, 392723097UL, 1330445854UL, 3473004271UL, 1267636682UL, 2150566972UL, 2664910943UL, 2591861637UL, 409769584UL, 2943326880UL, 3746302819UL, 3162268832UL, 1028663260UL, 3206607045UL, 832105292UL, 2119405275UL, 538318455UL, 2981192295UL, 861775416UL, 609718403UL, 3531204230UL, 1904759571UL, 1262633751UL, 2375133081UL, +460454984UL, 946700253UL, 3763898311UL, 1571175213UL, 3124410107UL, 2413420216UL, 2664177543UL, 3241803820UL, 3968067371UL, 1234860999UL, 1130471500UL, 772727786UL, 247203117UL, 576455235UL, 246297007UL, 2027348597UL, 764933887UL, 3812479771UL, 1825807084UL, 4072281412UL, 2156865781UL, 1286484847UL, 1966749063UL, 2479269303UL, 423506843UL, 3070938758UL, 653091413UL, 2267423132UL, 2004263526UL, 1374490719UL, 3871990628UL, 841138314UL, +1260317857UL, 3887432433UL, 4025147569UL, 764233331UL, 1794763428UL, 3005903468UL, 877926770UL, 2466593927UL, 2971729561UL, 3203070565UL, 4198500026UL, 815665759UL, 2434508139UL, 1840456368UL, 2279000427UL, 17077200UL, 3178380570UL, 990304199UL, 3578008580UL, 1965763660UL, 1640352477UL, 750159594UL, 2047409402UL, 3576308245UL, 544920564UL, 1730124869UL, 1194761386UL, 3280315505UL, 147334027UL, 2870674244UL, 2076860776UL, 1100947675UL, +2482772161UL, 401966468UL, 1610650855UL, 193868446UL, 3808157106UL, 1509130117UL, 1324484736UL, 3852893217UL, 1059179497UL, 4053543778UL, 2557844172UL, 3282312002UL, 682550058UL, 4281899173UL, 137171998UL, 3239159214UL, 2258610918UL, 426724741UL, 3502660993UL, 135977383UL, 429929363UL, 3984458137UL, 964026748UL, 2182019070UL, 3836562946UL, 515026869UL, 359030455UL, 1301694917UL, 2300414803UL, 2364654981UL, 3804876710UL, 171119249UL, +2646785698UL, 4283509387UL, 3628087763UL, 1748227044UL, 3037141234UL, 3000413256UL, 23007314UL, 3598880509UL, 4160517314UL, 112205578UL, 1677675411UL, 734881643UL, 2830770338UL, 3470317145UL, 3306806569UL, 2635040943UL, 2671367560UL, 3528996498UL, 3878886478UL, 3114253828UL, 2721384408UL, 3175226991UL, 1393767271UL, 2651623266UL, 3767978376UL, 1269699398UL, 1100964192UL, 4169085845UL, 2086718107UL, 1286251099UL, 764751784UL, 3006878591UL, +}, +{ +2565473087UL, 1149521056UL, 3529037691UL, 630435548UL, 73598765UL, 1467331930UL, 3988027050UL, 2771962200UL, 91261543UL, 980989218UL, 2227515435UL, 236831608UL, 2872772569UL, 2330469327UL, 1654035853UL, 2883791516UL, 4170143763UL, 126418114UL, 127789935UL, 2114249438UL, 2933346767UL, 639483386UL, 1532399845UL, 2182422151UL, 741069317UL, 2376371063UL, 3398508789UL, 3828295651UL, 3963199356UL, 4156483769UL, 4206759111UL, 1266176088UL, +3210273687UL, 432131993UL, 667709537UL, 874477513UL, 2304714957UL, 629309008UL, 116453438UL, 3051811727UL, 3490241985UL, 3355968243UL, 2304043871UL, 2724990029UL, 1095724699UL, 2408437363UL, 1433161037UL, 3245468546UL, 2494529842UL, 4204170637UL, 1966342448UL, 3092333073UL, 1861880941UL, 3990012367UL, 3710334908UL, 2526395471UL, 1884691351UL, 2145882162UL, 2561288457UL, 2253122309UL, 1154858044UL, 1643256991UL, 3172857504UL, 1096492713UL, +2848827103UL, 799826424UL, 3094672168UL, 3535834360UL, 4213256737UL, 1131757994UL, 520495112UL, 575315345UL, 3823364867UL, 2424349582UL, 3604795017UL, 310789314UL, 4207205257UL, 553462404UL, 2918228443UL, 2568360580UL, 3863565851UL, 874197736UL, 3329267685UL, 1186352580UL, 3928193054UL, 1780200631UL, 4088289456UL, 3323217870UL, 2758854947UL, 3111637417UL, 990374143UL, 2080149357UL, 4047813631UL, 2019887940UL, 578660736UL, 2145680301UL, +2328411541UL, 1572704242UL, 405739686UL, 1869350271UL, 2046317220UL, 4021497634UL, 1385163990UL, 1935250885UL, 1132987169UL, 581690993UL, 3172043012UL, 628071512UL, 2851125739UL, 2735324847UL, 2847267504UL, 3408334906UL, 3352976111UL, 706277272UL, 2971786942UL, 2811957324UL, 3578703606UL, 1126685543UL, 2671169997UL, 31952251UL, 2802110464UL, 2391618856UL, 3031260674UL, 1165714541UL, 2411388800UL, 2825634835UL, 101928462UL, 477629709UL, +4257022506UL, 3281706767UL, 2576087732UL, 736533968UL, 2543083137UL, 3430523686UL, 3272172013UL, 3056925798UL, 341993500UL, 406782950UL, 1770032304UL, 125786076UL, 1321359723UL, 2901696227UL, 1890958265UL, 3610842776UL, 1772227311UL, 1564088598UL, 914173231UL, 3734092059UL, 1652333721UL, 2386645282UL, 329706426UL, 1022239203UL, 1832393502UL, 4064995802UL, 3497852986UL, 1046436763UL, 366391010UL, 2237068647UL, 2887356463UL, 304718827UL, +3969799795UL, 2565473087UL, 1149521056UL, 3529037691UL, 630435548UL, 3758124054UL, 1467331930UL, 3988027050UL, 2771962200UL, 91261543UL, 836545831UL, 2227515435UL, 236831608UL, 2872772569UL, 2330469327UL, 3439193753UL, 2883791516UL, 4170143763UL, 126418114UL, 127789935UL, 1648940583UL, 2933346767UL, 639483386UL, 1532399845UL, 2182422151UL, 2470139222UL, 2376371063UL, 3398508789UL, 3828295651UL, 3963199356UL, 2997263135UL, 4206759111UL, +1266176088UL, 3210273687UL, 432131993UL, 2416600665UL, 874477513UL, 2304714957UL, 629309008UL, 116453438UL, 2586542760UL, 3490241985UL, 3355968243UL, 2304043871UL, 2724990029UL, 452934545UL, 2408437363UL, 1433161037UL, 3245468546UL, 2494529842UL, 2244403710UL, 1966342448UL, 3092333073UL, 1861880941UL, 3990012367UL, 2774994234UL, 2526395471UL, 1884691351UL, 2145882162UL, 2561288457UL, 2303702146UL, 1154858044UL, 1643256991UL, 3172857504UL, +1096492713UL, 130979316UL, 799826424UL, 3094672168UL, 3535834360UL, 4213256737UL, 935499492UL, 520495112UL, 575315345UL, 3823364867UL, 2424349582UL, 2272973265UL, 310789314UL, 4207205257UL, 553462404UL, 2918228443UL, 2613016888UL, 3863565851UL, 874197736UL, 3329267685UL, 1186352580UL, 4106984978UL, 1780200631UL, 4088289456UL, 3323217870UL, 2758854947UL, 1559861146UL, 990374143UL, 2080149357UL, 4047813631UL, 2019887940UL, 1133329900UL, +2145680301UL, 2328411541UL, 1572704242UL, 405739686UL, 63633520UL, 2046317220UL, 4021497634UL, 1385163990UL, 1935250885UL, 1762959503UL, 581690993UL, 3172043012UL, 628071512UL, 2851125739UL, 3726073981UL, 2847267504UL, 3408334906UL, 3352976111UL, 706277272UL, 3817450114UL, 2811957324UL, 3578703606UL, 1126685543UL, 2671169997UL, 2749086326UL, 2802110464UL, 2391618856UL, 3031260674UL, 1165714541UL, 2210258428UL, 2825634835UL, 101928462UL, +477629709UL, 4257022506UL, 2679409844UL, 2576087732UL, 736533968UL, 2543083137UL, 3430523686UL, 1122549807UL, 3056925798UL, 341993500UL, 406782950UL, 1770032304UL, 2617760292UL, 1321359723UL, 2901696227UL, 1890958265UL, 3610842776UL, 2666109620UL, 1564088598UL, 914173231UL, 3734092059UL, 1652333721UL, 3456779008UL, 329706426UL, 1022239203UL, 1832393502UL, 4064995802UL, 4006865520UL, 1046436763UL, 366391010UL, 2237068647UL, 2887356463UL, +1479646555UL, 3969799795UL, 2565473087UL, 1149521056UL, 3529037691UL, 2379195579UL, 3758124054UL, 1467331930UL, 3988027050UL, 2771962200UL, 1796797949UL, 836545831UL, 2227515435UL, 236831608UL, 2872772569UL, 544017308UL, 3439193753UL, 2883791516UL, 4170143763UL, 126418114UL, 3811390247UL, 1648940583UL, 2933346767UL, 639483386UL, 1532399845UL, 4165970043UL, 2470139222UL, 2376371063UL, 3398508789UL, 3828295651UL, 4066952157UL, 2997263135UL, +4206759111UL, 1266176088UL, 3210273687UL, 560560354UL, 2416600665UL, 874477513UL, 2304714957UL, 629309008UL, 2010844440UL, 2586542760UL, 3490241985UL, 3355968243UL, 2304043871UL, 855615381UL, 452934545UL, 2408437363UL, 1433161037UL, 3245468546UL, 3813880871UL, 2244403710UL, 1966342448UL, 3092333073UL, 1861880941UL, 3334256651UL, 2774994234UL, 2526395471UL, 1884691351UL, 2145882162UL, 3500193798UL, 2303702146UL, 1154858044UL, 1643256991UL, +3172857504UL, 3480843206UL, 130979316UL, 799826424UL, 3094672168UL, 3535834360UL, 915442396UL, 935499492UL, 520495112UL, 575315345UL, 3823364867UL, 2876158574UL, 2272973265UL, 310789314UL, 4207205257UL, 553462404UL, 2184663001UL, 2613016888UL, 3863565851UL, 874197736UL, 3329267685UL, 3447734684UL, 4106984978UL, 1780200631UL, 4088289456UL, 3323217870UL, 2748493470UL, 1559861146UL, 990374143UL, 2080149357UL, 4047813631UL, 2728282767UL, +1133329900UL, 2145680301UL, 2328411541UL, 1572704242UL, 3396987326UL, 63633520UL, 2046317220UL, 4021497634UL, 1385163990UL, 1582181054UL, 1762959503UL, 581690993UL, 3172043012UL, 628071512UL, 2790170929UL, 3726073981UL, 2847267504UL, 3408334906UL, 3352976111UL, 1211075015UL, 3817450114UL, 2811957324UL, 3578703606UL, 1126685543UL, 1946225412UL, 2749086326UL, 2802110464UL, 2391618856UL, 3031260674UL, 453222948UL, 2210258428UL, 2825634835UL, +101928462UL, 477629709UL, 410621659UL, 2679409844UL, 2576087732UL, 736533968UL, 2543083137UL, 1101977922UL, 1122549807UL, 3056925798UL, 341993500UL, 406782950UL, 3057489804UL, 2617760292UL, 1321359723UL, 2901696227UL, 1890958265UL, 4035843698UL, 2666109620UL, 1564088598UL, 914173231UL, 3734092059UL, 908525903UL, 3456779008UL, 329706426UL, 1022239203UL, 1832393502UL, 4024857205UL, 4006865520UL, 1046436763UL, 366391010UL, 2237068647UL, +1564059380UL, 1479646555UL, 3969799795UL, 2565473087UL, 1149521056UL, 2808155917UL, 2379195579UL, 3758124054UL, 1467331930UL, 3988027050UL, 810008243UL, 1796797949UL, 836545831UL, 2227515435UL, 236831608UL, 608273331UL, 544017308UL, 3439193753UL, 2883791516UL, 4170143763UL, 3309288977UL, 3811390247UL, 1648940583UL, 2933346767UL, 639483386UL, 1685761277UL, 4165970043UL, 2470139222UL, 2376371063UL, 3398508789UL, 4275493636UL, 4066952157UL, +2997263135UL, 4206759111UL, 1266176088UL, 333592630UL, 560560354UL, 2416600665UL, 874477513UL, 2304714957UL, 1438974661UL, 2010844440UL, 2586542760UL, 3490241985UL, 3355968243UL, 2556368068UL, 855615381UL, 452934545UL, 2408437363UL, 1433161037UL, 4061232080UL, 3813880871UL, 2244403710UL, 1966342448UL, 3092333073UL, 3412770364UL, 3334256651UL, 2774994234UL, 2526395471UL, 1884691351UL, 1414627588UL, 3500193798UL, 2303702146UL, 1154858044UL, +1643256991UL, 2245958719UL, 3480843206UL, 130979316UL, 799826424UL, 3094672168UL, 2214560871UL, 915442396UL, 935499492UL, 520495112UL, 575315345UL, 3894763683UL, 2876158574UL, 2272973265UL, 310789314UL, 4207205257UL, 3203740771UL, 2184663001UL, 2613016888UL, 3863565851UL, 874197736UL, 3371653768UL, 3447734684UL, 4106984978UL, 1780200631UL, 4088289456UL, 378312754UL, 2748493470UL, 1559861146UL, 990374143UL, 2080149357UL, 554816113UL, +2728282767UL, 1133329900UL, 2145680301UL, 2328411541UL, 4249979994UL, 3396987326UL, 63633520UL, 2046317220UL, 4021497634UL, 4185731269UL, 1582181054UL, 1762959503UL, 581690993UL, 3172043012UL, 3142596028UL, 2790170929UL, 3726073981UL, 2847267504UL, 3408334906UL, 2556911142UL, 1211075015UL, 3817450114UL, 2811957324UL, 3578703606UL, 1480672978UL, 1946225412UL, 2749086326UL, 2802110464UL, 2391618856UL, 3986823297UL, 453222948UL, 2210258428UL, +2825634835UL, 101928462UL, 26373721UL, 410621659UL, 2679409844UL, 2576087732UL, 736533968UL, 888001208UL, 1101977922UL, 1122549807UL, 3056925798UL, 341993500UL, 3243663736UL, 3057489804UL, 2617760292UL, 1321359723UL, 2901696227UL, 1652018736UL, 4035843698UL, 2666109620UL, 1564088598UL, 914173231UL, 1857869366UL, 908525903UL, 3456779008UL, 329706426UL, 1022239203UL, 2622178179UL, 4024857205UL, 4006865520UL, 1046436763UL, 366391010UL, +3722250905UL, 2880126367UL, 4102186560UL, 1642831571UL, 2222486636UL, 2572764729UL, 2046028516UL, 3507603612UL, 1703451134UL, 89818497UL, 1961701523UL, 3704300476UL, 3563143931UL, 1609575644UL, 1599081111UL, 1047838539UL, 2779312926UL, 2065354728UL, 956677756UL, 2073145924UL, 726634994UL, 119064196UL, 2046275296UL, 2105141632UL, 1023267361UL, 1204528080UL, 623740611UL, 1419328884UL, 933734693UL, 2030900835UL, 2556538268UL, 1672647866UL, +3125658368UL, 2221217376UL, 1097330641UL, 3214790630UL, 4276041578UL, 2397216525UL, 3916900004UL, 330223096UL, 3915966823UL, 2646760259UL, 1724289351UL, 4015221358UL, 2338587000UL, 110922222UL, 2314933196UL, 4026908935UL, 3272487985UL, 2685115305UL, 84271650UL, 731354215UL, 2358136447UL, 1069348214UL, 2676811333UL, 1386266810UL, 1364512901UL, 4154449904UL, 3469122709UL, 54276972UL, 560967905UL, 2363475740UL, 331250049UL, 3024074455UL, +186605617UL, 389582566UL, 1258386782UL, 703909543UL, 3968367083UL, 1553533794UL, 3699576213UL, 1145761343UL, 921983735UL, 3573813763UL, 1280477631UL, 3365842435UL, 1618458494UL, 2621328991UL, 1534006198UL, 2307669227UL, 4192335609UL, 1338050203UL, 785284052UL, 4227164890UL, 2874735332UL, 3655821191UL, 2911684671UL, 3266454200UL, 2679968625UL, 1191162601UL, 456550349UL, 1143881236UL, 3560103440UL, 2253437876UL, 3683014001UL, 1087142366UL, +1462192975UL, 1076595768UL, 3227872159UL, 1842092988UL, 148227073UL, 3812110998UL, 1317300278UL, 3068446245UL, 3376284001UL, 3164402992UL, 2730404635UL, 2848239579UL, 3008959791UL, 2901849226UL, 1234485739UL, 869158554UL, 245101118UL, 1724974650UL, 3851803199UL, 922411232UL, 3046280696UL, 3284392523UL, 3528264590UL, 2802364078UL, 381450957UL, 1741009694UL, 4222244451UL, 102929888UL, 1668474417UL, 3881791214UL, 1429483134UL, 1938365051UL, +1023690708UL, 3333855520UL, 3238705869UL, 2602245525UL, 3059586169UL, 720438965UL, 2120786297UL, 453980990UL, 1048501876UL, 4060576583UL, 3537810796UL, 3892882814UL, 691572481UL, 3899584121UL, 1582529013UL, 3260326865UL, 2358704826UL, 1607030801UL, 1035900449UL, 3442507859UL, 1406737127UL, 249758705UL, 1535363329UL, 893329207UL, 51912312UL, 3440532856UL, 3736385218UL, 295452658UL, 2379709553UL, 1647382020UL, 2363679860UL, 2998779887UL, +}, +{ +4209102573UL, 2387104994UL, 1221484586UL, 1726143957UL, 3263877318UL, 3362559187UL, 282442925UL, 2418524976UL, 3196072648UL, 3174695999UL, 2072047145UL, 2985823503UL, 2132951745UL, 2298545297UL, 2495977670UL, 1397656146UL, 2086257884UL, 3834366725UL, 3862532368UL, 3583329522UL, 1543996818UL, 2192688115UL, 3081427696UL, 2656520743UL, 8772004UL, 2476324234UL, 3600148050UL, 1168683794UL, 3219143568UL, 108768238UL, 1339513738UL, 447593731UL, +2742877256UL, 2488536667UL, 4189834432UL, 808657962UL, 2422880287UL, 390864786UL, 3381554683UL, 760628048UL, 353395922UL, 3577556262UL, 2482413928UL, 507756643UL, 839344953UL, 3505184848UL, 3945044582UL, 2414915836UL, 2313624497UL, 1832728088UL, 2036999647UL, 1369090013UL, 3264575895UL, 1096327239UL, 3483440128UL, 3999302048UL, 2761563885UL, 2882627112UL, 3126073009UL, 1749658776UL, 3152482044UL, 3040022505UL, 3249451214UL, 2933713956UL, +2861715096UL, 1314806730UL, 932941454UL, 4276317539UL, 343449784UL, 1913556027UL, 1493892363UL, 2539517630UL, 2046391233UL, 3046108187UL, 28742917UL, 4009448584UL, 530945117UL, 3165875131UL, 1018448712UL, 110256395UL, 3550192264UL, 1279873435UL, 2276349621UL, 517650895UL, 1957973772UL, 619869608UL, 4260458157UL, 2281748739UL, 2489253174UL, 2220997989UL, 3787481606UL, 508630251UL, 3761850170UL, 3992979014UL, 2298047038UL, 3506428315UL, +1279341556UL, 3293496518UL, 1313470495UL, 1021100687UL, 3113171268UL, 798494760UL, 2981622008UL, 4152623583UL, 576409629UL, 2312811213UL, 992326282UL, 261645450UL, 1818084365UL, 3357150904UL, 144093UL, 1937589359UL, 2016990596UL, 4273422066UL, 588267732UL, 3592151118UL, 3846596932UL, 1198111464UL, 944363907UL, 1288613766UL, 1707163456UL, 4020906747UL, 1161127694UL, 2303844076UL, 2632591611UL, 3877442490UL, 2453788473UL, 1725876694UL, +1193989740UL, 2650581453UL, 1937459187UL, 361099994UL, 3566745727UL, 3658112707UL, 3612317412UL, 2684702277UL, 2880928862UL, 2044313931UL, 1866044828UL, 3528429465UL, 130421713UL, 2658878825UL, 1566180833UL, 1572228417UL, 531947625UL, 3774861000UL, 1894712110UL, 1319199233UL, 865634052UL, 2602102379UL, 3389730171UL, 3878969250UL, 107983959UL, 1601930856UL, 2511728925UL, 2146946013UL, 497511195UL, 720616881UL, 699892123UL, 2404505137UL, +2656498433UL, 4209102573UL, 2387104994UL, 1221484586UL, 1726143957UL, 1267363185UL, 3362559187UL, 282442925UL, 2418524976UL, 3196072648UL, 2942944206UL, 2072047145UL, 2985823503UL, 2132951745UL, 2298545297UL, 4079341490UL, 1397656146UL, 2086257884UL, 3834366725UL, 3862532368UL, 3991197972UL, 1543996818UL, 2192688115UL, 3081427696UL, 2656520743UL, 825853576UL, 2476324234UL, 3600148050UL, 1168683794UL, 3219143568UL, 528751585UL, 1339513738UL, +447593731UL, 2742877256UL, 2488536667UL, 4025362081UL, 808657962UL, 2422880287UL, 390864786UL, 3381554683UL, 2682225618UL, 353395922UL, 3577556262UL, 2482413928UL, 507756643UL, 3979211244UL, 3505184848UL, 3945044582UL, 2414915836UL, 2313624497UL, 1841224078UL, 2036999647UL, 1369090013UL, 3264575895UL, 1096327239UL, 607843308UL, 3999302048UL, 2761563885UL, 2882627112UL, 3126073009UL, 1241524975UL, 3152482044UL, 3040022505UL, 3249451214UL, +2933713956UL, 420486142UL, 1314806730UL, 932941454UL, 4276317539UL, 343449784UL, 2231505736UL, 1493892363UL, 2539517630UL, 2046391233UL, 3046108187UL, 2351652097UL, 4009448584UL, 530945117UL, 3165875131UL, 1018448712UL, 1683392491UL, 3550192264UL, 1279873435UL, 2276349621UL, 517650895UL, 4036312766UL, 619869608UL, 4260458157UL, 2281748739UL, 2489253174UL, 1686790154UL, 3787481606UL, 508630251UL, 3761850170UL, 3992979014UL, 1745325013UL, +3506428315UL, 1279341556UL, 3293496518UL, 1313470495UL, 3066312306UL, 3113171268UL, 798494760UL, 2981622008UL, 4152623583UL, 3871822467UL, 2312811213UL, 992326282UL, 261645450UL, 1818084365UL, 3681154045UL, 144093UL, 1937589359UL, 2016990596UL, 4273422066UL, 2361898985UL, 3592151118UL, 3846596932UL, 1198111464UL, 944363907UL, 2866279694UL, 1707163456UL, 4020906747UL, 1161127694UL, 2303844076UL, 3044280908UL, 3877442490UL, 2453788473UL, +1725876694UL, 1193989740UL, 2049617934UL, 1937459187UL, 361099994UL, 3566745727UL, 3658112707UL, 934740227UL, 2684702277UL, 2880928862UL, 2044313931UL, 1866044828UL, 1814569183UL, 130421713UL, 2658878825UL, 1566180833UL, 1572228417UL, 1784679035UL, 3774861000UL, 1894712110UL, 1319199233UL, 865634052UL, 283642947UL, 3389730171UL, 3878969250UL, 107983959UL, 1601930856UL, 3698217362UL, 2146946013UL, 497511195UL, 720616881UL, 699892123UL, +2117385156UL, 2656498433UL, 4209102573UL, 2387104994UL, 1221484586UL, 3495886368UL, 1267363185UL, 3362559187UL, 282442925UL, 2418524976UL, 3489510655UL, 2942944206UL, 2072047145UL, 2985823503UL, 2132951745UL, 885541635UL, 4079341490UL, 1397656146UL, 2086257884UL, 3834366725UL, 1049969755UL, 3991197972UL, 1543996818UL, 2192688115UL, 3081427696UL, 2141948440UL, 825853576UL, 2476324234UL, 3600148050UL, 1168683794UL, 5160254UL, 528751585UL, +1339513738UL, 447593731UL, 2742877256UL, 3033397497UL, 4025362081UL, 808657962UL, 2422880287UL, 390864786UL, 3191593886UL, 2682225618UL, 353395922UL, 3577556262UL, 2482413928UL, 1185107868UL, 3979211244UL, 3505184848UL, 3945044582UL, 2414915836UL, 3030493909UL, 1841224078UL, 2036999647UL, 1369090013UL, 3264575895UL, 3054343366UL, 607843308UL, 3999302048UL, 2761563885UL, 2882627112UL, 3912854189UL, 1241524975UL, 3152482044UL, 3040022505UL, +3249451214UL, 55140065UL, 420486142UL, 1314806730UL, 932941454UL, 4276317539UL, 1055315026UL, 2231505736UL, 1493892363UL, 2539517630UL, 2046391233UL, 4174985470UL, 2351652097UL, 4009448584UL, 530945117UL, 3165875131UL, 2168411768UL, 1683392491UL, 3550192264UL, 1279873435UL, 2276349621UL, 1875092822UL, 4036312766UL, 619869608UL, 4260458157UL, 2281748739UL, 98823023UL, 1686790154UL, 3787481606UL, 508630251UL, 3761850170UL, 2636025017UL, +1745325013UL, 3506428315UL, 1279341556UL, 3293496518UL, 978338993UL, 3066312306UL, 3113171268UL, 798494760UL, 2981622008UL, 2712384846UL, 3871822467UL, 2312811213UL, 992326282UL, 261645450UL, 66982935UL, 3681154045UL, 144093UL, 1937589359UL, 2016990596UL, 3390191329UL, 2361898985UL, 3592151118UL, 3846596932UL, 1198111464UL, 1857959320UL, 2866279694UL, 1707163456UL, 4020906747UL, 1161127694UL, 913091437UL, 3044280908UL, 3877442490UL, +2453788473UL, 1725876694UL, 4254455215UL, 2049617934UL, 1937459187UL, 361099994UL, 3566745727UL, 2914687409UL, 934740227UL, 2684702277UL, 2880928862UL, 2044313931UL, 1515195925UL, 1814569183UL, 130421713UL, 2658878825UL, 1566180833UL, 2753417020UL, 1784679035UL, 3774861000UL, 1894712110UL, 1319199233UL, 287161774UL, 283642947UL, 3389730171UL, 3878969250UL, 107983959UL, 3057929912UL, 3698217362UL, 2146946013UL, 497511195UL, 720616881UL, +3570251850UL, 2117385156UL, 2656498433UL, 4209102573UL, 2387104994UL, 2940868252UL, 3495886368UL, 1267363185UL, 3362559187UL, 282442925UL, 2510419746UL, 3489510655UL, 2942944206UL, 2072047145UL, 2985823503UL, 978430777UL, 885541635UL, 4079341490UL, 1397656146UL, 2086257884UL, 134380865UL, 1049969755UL, 3991197972UL, 1543996818UL, 2192688115UL, 1205081471UL, 2141948440UL, 825853576UL, 2476324234UL, 3600148050UL, 228461601UL, 5160254UL, +528751585UL, 1339513738UL, 447593731UL, 2852356745UL, 3033397497UL, 4025362081UL, 808657962UL, 2422880287UL, 3287655095UL, 3191593886UL, 2682225618UL, 353395922UL, 3577556262UL, 2542841784UL, 1185107868UL, 3979211244UL, 3505184848UL, 3945044582UL, 2905156498UL, 3030493909UL, 1841224078UL, 2036999647UL, 1369090013UL, 4246605417UL, 3054343366UL, 607843308UL, 3999302048UL, 2761563885UL, 3611911899UL, 3912854189UL, 1241524975UL, 3152482044UL, +3040022505UL, 3215633820UL, 55140065UL, 420486142UL, 1314806730UL, 932941454UL, 2708752494UL, 1055315026UL, 2231505736UL, 1493892363UL, 2539517630UL, 962728637UL, 4174985470UL, 2351652097UL, 4009448584UL, 530945117UL, 3370859357UL, 2168411768UL, 1683392491UL, 3550192264UL, 1279873435UL, 3028448904UL, 1875092822UL, 4036312766UL, 619869608UL, 4260458157UL, 199178828UL, 98823023UL, 1686790154UL, 3787481606UL, 508630251UL, 4205010983UL, +2636025017UL, 1745325013UL, 3506428315UL, 1279341556UL, 683127445UL, 978338993UL, 3066312306UL, 3113171268UL, 798494760UL, 2823693013UL, 2712384846UL, 3871822467UL, 2312811213UL, 992326282UL, 3701928286UL, 66982935UL, 3681154045UL, 144093UL, 1937589359UL, 1117717039UL, 3390191329UL, 2361898985UL, 3592151118UL, 3846596932UL, 1072660054UL, 1857959320UL, 2866279694UL, 1707163456UL, 4020906747UL, 2503116219UL, 913091437UL, 3044280908UL, +3877442490UL, 2453788473UL, 1815274499UL, 4254455215UL, 2049617934UL, 1937459187UL, 361099994UL, 3771108073UL, 2914687409UL, 934740227UL, 2684702277UL, 2880928862UL, 3591322975UL, 1515195925UL, 1814569183UL, 130421713UL, 2658878825UL, 354587729UL, 2753417020UL, 1784679035UL, 3774861000UL, 1894712110UL, 1799044969UL, 287161774UL, 283642947UL, 3389730171UL, 3878969250UL, 1229815186UL, 3057929912UL, 3698217362UL, 2146946013UL, 497511195UL, +3121882901UL, 426537369UL, 3852284416UL, 4050544256UL, 3148944089UL, 878474231UL, 1369575859UL, 2206199765UL, 870626886UL, 494668165UL, 613011290UL, 3246772867UL, 1040178461UL, 2396959353UL, 2105449571UL, 456758967UL, 4134137960UL, 3525051481UL, 3633445497UL, 2895048060UL, 2008411846UL, 2194012253UL, 2326112129UL, 2956901044UL, 2297039362UL, 3400824024UL, 42139718UL, 4212208866UL, 3874761488UL, 2361955811UL, 1890446075UL, 864533345UL, +474524842UL, 2283847731UL, 283971243UL, 3607219686UL, 280870706UL, 4188549522UL, 659660119UL, 2460943922UL, 4252134362UL, 922033031UL, 3615474721UL, 1691563300UL, 3002653770UL, 2414043617UL, 2251931324UL, 752654714UL, 4188343161UL, 305594960UL, 1320443323UL, 797027061UL, 2347530104UL, 3608843538UL, 2717312892UL, 1841295453UL, 1574467161UL, 823626340UL, 2244853583UL, 2648217758UL, 141742826UL, 1605436472UL, 745763543UL, 3275460028UL, +3166960370UL, 2655678693UL, 3964037210UL, 945054703UL, 998173049UL, 1014527437UL, 3424443612UL, 281835352UL, 826817508UL, 260462513UL, 2849967970UL, 3447294061UL, 3670173947UL, 2430650055UL, 4134905457UL, 3798172627UL, 2156572681UL, 2600148034UL, 2773013892UL, 3290397106UL, 1740507705UL, 3450254627UL, 3613087060UL, 440045928UL, 1230555006UL, 980805434UL, 2107958250UL, 526555374UL, 3150741277UL, 4283672024UL, 193019043UL, 786035243UL, +3002832578UL, 3938336183UL, 4209865002UL, 1005950967UL, 3533346582UL, 3196886974UL, 83962845UL, 1882902787UL, 3595687446UL, 2927597311UL, 2728550762UL, 2750900392UL, 1474254316UL, 1509832112UL, 1763262792UL, 2706181276UL, 538294991UL, 353565565UL, 18133995UL, 1719731406UL, 3311085516UL, 2018821960UL, 300367686UL, 2628312935UL, 1151449661UL, 2178805970UL, 3288321196UL, 535051857UL, 1623270973UL, 2761151808UL, 2701048972UL, 317681607UL, +2281427601UL, 719748170UL, 351452298UL, 2191958596UL, 4000232015UL, 335837771UL, 4158081521UL, 3779404077UL, 1998444133UL, 3849605095UL, 1532231791UL, 2930266419UL, 4203951289UL, 748423654UL, 1993082867UL, 451159852UL, 488781053UL, 2438982775UL, 2222815270UL, 543209242UL, 1241562465UL, 2868868009UL, 4201052877UL, 2438841764UL, 2151708682UL, 2426958921UL, 1520654642UL, 1990098337UL, 1070792755UL, 2308394635UL, 1442389785UL, 705615044UL, +}, +{ +973368008UL, 1221885324UL, 2086331970UL, 2323744198UL, 280145759UL, 1795442656UL, 2984366093UL, 3532172763UL, 323888669UL, 851950179UL, 4198638255UL, 899943985UL, 4087912561UL, 2935341503UL, 1443752852UL, 3991058999UL, 3547259355UL, 35779889UL, 1076308344UL, 4075444807UL, 186174448UL, 3542284780UL, 660388677UL, 2777400132UL, 1092226205UL, 2418702276UL, 1307933032UL, 1940510003UL, 1932005362UL, 4016036211UL, 387339882UL, 2969593895UL, +3453134349UL, 1382709098UL, 1795814140UL, 1588159469UL, 1216733801UL, 2227378121UL, 2063027627UL, 582454582UL, 3364657275UL, 3466973302UL, 484564303UL, 1489261596UL, 2270291560UL, 2008178784UL, 2284268924UL, 2229317366UL, 644797709UL, 1213921542UL, 99331403UL, 3027640949UL, 1137722852UL, 2991506109UL, 1432805987UL, 931795812UL, 1075567424UL, 28963219UL, 1462245461UL, 3781444706UL, 521233400UL, 1891915904UL, 3774338085UL, 1635359313UL, +2356111795UL, 4121073768UL, 1045110727UL, 2822507066UL, 1087914587UL, 3744509525UL, 911370656UL, 181884066UL, 1944539735UL, 290356444UL, 3598887471UL, 4236934380UL, 3224468239UL, 457546246UL, 4119337570UL, 37700432UL, 655783844UL, 1423101410UL, 1693002969UL, 3287768267UL, 928748421UL, 4074128009UL, 3081088543UL, 2882833790UL, 3180154875UL, 1094657682UL, 2388253717UL, 4173455215UL, 794709427UL, 3363292346UL, 67786868UL, 3786597763UL, +380587236UL, 2345941620UL, 560232318UL, 2137123833UL, 619747082UL, 1050293267UL, 2537845069UL, 1407302835UL, 433399526UL, 1083185007UL, 1893842085UL, 3711748584UL, 4225838280UL, 3863317129UL, 2043467942UL, 2799650657UL, 3590486611UL, 1231938950UL, 215905995UL, 155811669UL, 806806587UL, 2732631168UL, 1621659281UL, 632403616UL, 401165422UL, 2661074778UL, 4156963191UL, 3691812937UL, 3767271627UL, 2834948318UL, 2877210497UL, 2420260153UL, +733172233UL, 1771708940UL, 3102718549UL, 2468707423UL, 1857088312UL, 3176535032UL, 1908570295UL, 3966666208UL, 605079895UL, 2982506620UL, 3721694730UL, 1640691570UL, 3764975545UL, 3257514114UL, 1826578604UL, 1358557411UL, 4049610348UL, 615820785UL, 3355718142UL, 1734641780UL, 2958744617UL, 274522187UL, 3198436002UL, 4077346785UL, 2890101344UL, 4012464346UL, 1288365365UL, 96583076UL, 2656389382UL, 1858181040UL, 2717010340UL, 2032153178UL, +349324012UL, 973368008UL, 1221885324UL, 2086331970UL, 2323744198UL, 253685576UL, 1795442656UL, 2984366093UL, 3532172763UL, 323888669UL, 248935329UL, 4198638255UL, 899943985UL, 4087912561UL, 2935341503UL, 3213394756UL, 3991058999UL, 3547259355UL, 35779889UL, 1076308344UL, 1987715385UL, 186174448UL, 3542284780UL, 660388677UL, 2777400132UL, 2071022105UL, 2418702276UL, 1307933032UL, 1940510003UL, 1932005362UL, 144370664UL, 387339882UL, +2969593895UL, 3453134349UL, 1382709098UL, 2394736611UL, 1588159469UL, 1216733801UL, 2227378121UL, 2063027627UL, 4064263898UL, 3364657275UL, 3466973302UL, 484564303UL, 1489261596UL, 3405101812UL, 2008178784UL, 2284268924UL, 2229317366UL, 644797709UL, 2560273821UL, 99331403UL, 3027640949UL, 1137722852UL, 2991506109UL, 1446442417UL, 931795812UL, 1075567424UL, 28963219UL, 1462245461UL, 1201513613UL, 521233400UL, 1891915904UL, 3774338085UL, +1635359313UL, 2815447944UL, 4121073768UL, 1045110727UL, 2822507066UL, 1087914587UL, 2485035329UL, 911370656UL, 181884066UL, 1944539735UL, 290356444UL, 2078819341UL, 4236934380UL, 3224468239UL, 457546246UL, 4119337570UL, 2666895496UL, 655783844UL, 1423101410UL, 1693002969UL, 3287768267UL, 3595439673UL, 4074128009UL, 3081088543UL, 2882833790UL, 3180154875UL, 872453917UL, 2388253717UL, 4173455215UL, 794709427UL, 3363292346UL, 4188764388UL, +3786597763UL, 380587236UL, 2345941620UL, 560232318UL, 625538006UL, 619747082UL, 1050293267UL, 2537845069UL, 1407302835UL, 2128289331UL, 1083185007UL, 1893842085UL, 3711748584UL, 4225838280UL, 2486133065UL, 2043467942UL, 2799650657UL, 3590486611UL, 1231938950UL, 928582681UL, 155811669UL, 806806587UL, 2732631168UL, 1621659281UL, 1163969880UL, 401165422UL, 2661074778UL, 4156963191UL, 3691812937UL, 2322579561UL, 2834948318UL, 2877210497UL, +2420260153UL, 733172233UL, 170239236UL, 3102718549UL, 2468707423UL, 1857088312UL, 3176535032UL, 3868693408UL, 3966666208UL, 605079895UL, 2982506620UL, 3721694730UL, 2066859537UL, 3764975545UL, 3257514114UL, 1826578604UL, 1358557411UL, 2964604045UL, 615820785UL, 3355718142UL, 1734641780UL, 2958744617UL, 4091225681UL, 3198436002UL, 4077346785UL, 2890101344UL, 4012464346UL, 2612861218UL, 96583076UL, 2656389382UL, 1858181040UL, 2717010340UL, +3639170895UL, 349324012UL, 973368008UL, 1221885324UL, 2086331970UL, 2258432445UL, 253685576UL, 1795442656UL, 2984366093UL, 3532172763UL, 3831166882UL, 248935329UL, 4198638255UL, 899943985UL, 4087912561UL, 715173523UL, 3213394756UL, 3991058999UL, 3547259355UL, 35779889UL, 2393072396UL, 1987715385UL, 186174448UL, 3542284780UL, 660388677UL, 3731857267UL, 2071022105UL, 2418702276UL, 1307933032UL, 1940510003UL, 4262274779UL, 144370664UL, +387339882UL, 2969593895UL, 3453134349UL, 1923698215UL, 2394736611UL, 1588159469UL, 1216733801UL, 2227378121UL, 2907069566UL, 4064263898UL, 3364657275UL, 3466973302UL, 484564303UL, 2234542580UL, 3405101812UL, 2008178784UL, 2284268924UL, 2229317366UL, 1349323372UL, 2560273821UL, 99331403UL, 3027640949UL, 1137722852UL, 4200786664UL, 1446442417UL, 931795812UL, 1075567424UL, 28963219UL, 1659632304UL, 1201513613UL, 521233400UL, 1891915904UL, +3774338085UL, 763590809UL, 2815447944UL, 4121073768UL, 1045110727UL, 2822507066UL, 4131040734UL, 2485035329UL, 911370656UL, 181884066UL, 1944539735UL, 4104473807UL, 2078819341UL, 4236934380UL, 3224468239UL, 457546246UL, 1241850776UL, 2666895496UL, 655783844UL, 1423101410UL, 1693002969UL, 2025898966UL, 3595439673UL, 4074128009UL, 3081088543UL, 2882833790UL, 218474476UL, 872453917UL, 2388253717UL, 4173455215UL, 794709427UL, 250328312UL, +4188764388UL, 3786597763UL, 380587236UL, 2345941620UL, 1937652040UL, 625538006UL, 619747082UL, 1050293267UL, 2537845069UL, 1140055765UL, 2128289331UL, 1083185007UL, 1893842085UL, 3711748584UL, 2298055548UL, 2486133065UL, 2043467942UL, 2799650657UL, 3590486611UL, 1235949580UL, 928582681UL, 155811669UL, 806806587UL, 2732631168UL, 4046198728UL, 1163969880UL, 401165422UL, 2661074778UL, 4156963191UL, 2003518762UL, 2322579561UL, 2834948318UL, +2877210497UL, 2420260153UL, 326741418UL, 170239236UL, 3102718549UL, 2468707423UL, 1857088312UL, 3936056808UL, 3868693408UL, 3966666208UL, 605079895UL, 2982506620UL, 2354705582UL, 2066859537UL, 3764975545UL, 3257514114UL, 1826578604UL, 3017501686UL, 2964604045UL, 615820785UL, 3355718142UL, 1734641780UL, 1681548103UL, 4091225681UL, 3198436002UL, 4077346785UL, 2890101344UL, 416470693UL, 2612861218UL, 96583076UL, 2656389382UL, 1858181040UL, +3104217288UL, 3639170895UL, 349324012UL, 973368008UL, 1221885324UL, 601524567UL, 2258432445UL, 253685576UL, 1795442656UL, 2984366093UL, 1875491903UL, 3831166882UL, 248935329UL, 4198638255UL, 899943985UL, 2182697927UL, 715173523UL, 3213394756UL, 3991058999UL, 3547259355UL, 1472237612UL, 2393072396UL, 1987715385UL, 186174448UL, 3542284780UL, 2160848139UL, 3731857267UL, 2071022105UL, 2418702276UL, 1307933032UL, 3815354311UL, 4262274779UL, +144370664UL, 387339882UL, 2969593895UL, 4240850623UL, 1923698215UL, 2394736611UL, 1588159469UL, 1216733801UL, 322523795UL, 2907069566UL, 4064263898UL, 3364657275UL, 3466973302UL, 2920715858UL, 2234542580UL, 3405101812UL, 2008178784UL, 2284268924UL, 1936025139UL, 1349323372UL, 2560273821UL, 99331403UL, 3027640949UL, 859541953UL, 4200786664UL, 1446442417UL, 931795812UL, 1075567424UL, 1876635772UL, 1659632304UL, 1201513613UL, 521233400UL, +1891915904UL, 3949233865UL, 763590809UL, 2815447944UL, 4121073768UL, 1045110727UL, 2522258582UL, 4131040734UL, 2485035329UL, 911370656UL, 181884066UL, 2467886009UL, 4104473807UL, 2078819341UL, 4236934380UL, 3224468239UL, 603014155UL, 1241850776UL, 2666895496UL, 655783844UL, 1423101410UL, 673119756UL, 2025898966UL, 3595439673UL, 4074128009UL, 3081088543UL, 4100445818UL, 218474476UL, 872453917UL, 2388253717UL, 4173455215UL, 2395519424UL, +250328312UL, 4188764388UL, 3786597763UL, 380587236UL, 4292608797UL, 1937652040UL, 625538006UL, 619747082UL, 1050293267UL, 2989616803UL, 1140055765UL, 2128289331UL, 1083185007UL, 1893842085UL, 3313934002UL, 2298055548UL, 2486133065UL, 2043467942UL, 2799650657UL, 1804808801UL, 1235949580UL, 928582681UL, 155811669UL, 806806587UL, 2864892828UL, 4046198728UL, 1163969880UL, 401165422UL, 2661074778UL, 2946769376UL, 2003518762UL, 2322579561UL, +2834948318UL, 2877210497UL, 2647485275UL, 326741418UL, 170239236UL, 3102718549UL, 2468707423UL, 2520336801UL, 3936056808UL, 3868693408UL, 3966666208UL, 605079895UL, 2949706551UL, 2354705582UL, 2066859537UL, 3764975545UL, 3257514114UL, 495003693UL, 3017501686UL, 2964604045UL, 615820785UL, 3355718142UL, 3799230297UL, 1681548103UL, 4091225681UL, 3198436002UL, 4077346785UL, 258363842UL, 416470693UL, 2612861218UL, 96583076UL, 2656389382UL, +2198085634UL, 1607235362UL, 694172175UL, 4194347563UL, 2665732891UL, 3419430286UL, 597070176UL, 2749480905UL, 3937535348UL, 3639873850UL, 2050067843UL, 4045290683UL, 2964298196UL, 3631595287UL, 1409808193UL, 121765438UL, 2129412744UL, 2497437101UL, 2664102876UL, 1773441464UL, 1708052456UL, 2923764322UL, 3350385352UL, 1592204280UL, 1118221370UL, 3416016313UL, 116121364UL, 1179473397UL, 1497519022UL, 902569114UL, 3840281863UL, 2783662797UL, +1712084322UL, 1982884601UL, 3625797892UL, 4222938993UL, 3231134134UL, 3046745397UL, 446484563UL, 1133869192UL, 2622178726UL, 3881085862UL, 4012894217UL, 391734322UL, 2089696890UL, 1304197030UL, 2663978386UL, 1685998658UL, 4238620912UL, 448351665UL, 2724524045UL, 1038754164UL, 413586547UL, 3107681687UL, 1454664365UL, 3353731192UL, 128440996UL, 565817989UL, 127978294UL, 1043863326UL, 1747369107UL, 2772246481UL, 172569313UL, 2740699699UL, +3417082503UL, 2103702630UL, 2139566116UL, 1378864710UL, 2444170529UL, 3234220221UL, 3974870858UL, 1965162347UL, 956763257UL, 3932467825UL, 1077337271UL, 4084837149UL, 3699147465UL, 1882164226UL, 236113740UL, 3116302858UL, 2730529598UL, 3449804672UL, 4002370655UL, 2011573068UL, 1551746089UL, 3917496971UL, 2852603UL, 1682999535UL, 2764817908UL, 2489487254UL, 261936311UL, 3122421452UL, 1199382345UL, 2617247590UL, 1909026938UL, 3156073069UL, +1492533764UL, 97847107UL, 1260892586UL, 187242945UL, 1286471861UL, 1763024967UL, 127723419UL, 210606273UL, 228546401UL, 3249879676UL, 482069954UL, 383075106UL, 3263105259UL, 2242748676UL, 1105681409UL, 4033144425UL, 4017983282UL, 1670425353UL, 4040882785UL, 1780687273UL, 1405678015UL, 3076115981UL, 2713472488UL, 286336494UL, 3664225263UL, 502759060UL, 777620620UL, 635590826UL, 132236203UL, 1866406173UL, 1235046453UL, 2859554298UL, +121814656UL, 944976320UL, 1946494170UL, 2548097575UL, 415384946UL, 3934685646UL, 1507032178UL, 1383654007UL, 2906269630UL, 566005756UL, 3118733139UL, 2969075870UL, 1834096359UL, 3263358416UL, 1322979710UL, 904583023UL, 3582075094UL, 2298898632UL, 2491891941UL, 660351763UL, 2548592542UL, 3009200751UL, 2116595110UL, 2623212287UL, 4167133624UL, 196759529UL, 3038645579UL, 1769704552UL, 1713233322UL, 2127497999UL, 3849458221UL, 3769872265UL, +}, +{ +51082211UL, 3347503176UL, 3221768777UL, 2986163981UL, 3937460013UL, 1716372908UL, 4132024211UL, 3035957293UL, 1791036224UL, 4214815056UL, 1645540011UL, 2629793790UL, 3185505897UL, 1855718954UL, 495459467UL, 1728339314UL, 2318396341UL, 3396602050UL, 3273624616UL, 2625973148UL, 1762905939UL, 1706358553UL, 1088424264UL, 2764318930UL, 1026127380UL, 1128004134UL, 2724553694UL, 41981087UL, 2304966004UL, 1342745986UL, 3425554050UL, 3537673465UL, +752263676UL, 280905885UL, 929399589UL, 4090689526UL, 2141254732UL, 1469491656UL, 2593100469UL, 1096008340UL, 3316809312UL, 1698245188UL, 1656427920UL, 3081873338UL, 1750515301UL, 3850483440UL, 4081834419UL, 1225164947UL, 1244139942UL, 1972663124UL, 116832506UL, 3097397897UL, 961156503UL, 1899056660UL, 1659173175UL, 1890464921UL, 1891872926UL, 191259956UL, 1735304734UL, 4246751855UL, 4285601625UL, 1495519933UL, 3398829761UL, 997567482UL, +2277782972UL, 1286922996UL, 3120709698UL, 15569196UL, 191501283UL, 3916619528UL, 1552075789UL, 4259725643UL, 2837166910UL, 2231584792UL, 1912204495UL, 2597304083UL, 4147585653UL, 1021482843UL, 2003417305UL, 186794491UL, 3608172979UL, 1991038123UL, 97515853UL, 34341352UL, 4163491231UL, 1046079304UL, 4105813389UL, 3589099183UL, 3970004064UL, 3899560802UL, 4148331147UL, 2267137817UL, 85024486UL, 3019925981UL, 3069231953UL, 1563669137UL, +314080592UL, 2943111861UL, 2838243982UL, 726216848UL, 2621853102UL, 2355885175UL, 3359668856UL, 1111296541UL, 2330283124UL, 3626558972UL, 4290084148UL, 1632078UL, 1047440803UL, 1350377197UL, 2490578842UL, 2366345698UL, 1628128899UL, 860259543UL, 1937956234UL, 2833820527UL, 329818923UL, 648489148UL, 1791961202UL, 1652322723UL, 1513419073UL, 149629345UL, 2468961221UL, 3711837973UL, 2377333831UL, 1434755773UL, 3808719305UL, 2513270108UL, +2701064683UL, 3097011724UL, 303393137UL, 1346302239UL, 1852307302UL, 850106025UL, 2473124483UL, 2853497268UL, 3786573704UL, 2604101162UL, 1446573486UL, 506925220UL, 3138967488UL, 2973528682UL, 2752811123UL, 2890321579UL, 1037196362UL, 1335670403UL, 1560253777UL, 1437495434UL, 2700525242UL, 4259933972UL, 3870707795UL, 4141538580UL, 3375331039UL, 3081538601UL, 3129978494UL, 3689191993UL, 1933431212UL, 2196145886UL, 87814045UL, 878611347UL, +812542698UL, 51082211UL, 3347503176UL, 3221768777UL, 2986163981UL, 277257023UL, 1716372908UL, 4132024211UL, 3035957293UL, 1791036224UL, 2713916211UL, 1645540011UL, 2629793790UL, 3185505897UL, 1855718954UL, 3800150234UL, 1728339314UL, 2318396341UL, 3396602050UL, 3273624616UL, 2530282967UL, 1762905939UL, 1706358553UL, 1088424264UL, 2764318930UL, 4224669506UL, 1128004134UL, 2724553694UL, 41981087UL, 2304966004UL, 484289311UL, 3425554050UL, +3537673465UL, 752263676UL, 280905885UL, 657028134UL, 4090689526UL, 2141254732UL, 1469491656UL, 2593100469UL, 2089385540UL, 3316809312UL, 1698245188UL, 1656427920UL, 3081873338UL, 2750354264UL, 3850483440UL, 4081834419UL, 1225164947UL, 1244139942UL, 3432605739UL, 116832506UL, 3097397897UL, 961156503UL, 1899056660UL, 2234120716UL, 1890464921UL, 1891872926UL, 191259956UL, 1735304734UL, 125359575UL, 4285601625UL, 1495519933UL, 3398829761UL, +997567482UL, 4034254942UL, 1286922996UL, 3120709698UL, 15569196UL, 191501283UL, 2090684174UL, 1552075789UL, 4259725643UL, 2837166910UL, 2231584792UL, 3412758413UL, 2597304083UL, 4147585653UL, 1021482843UL, 2003417305UL, 2464533361UL, 3608172979UL, 1991038123UL, 97515853UL, 34341352UL, 2634732952UL, 1046079304UL, 4105813389UL, 3589099183UL, 3970004064UL, 4263828421UL, 4148331147UL, 2267137817UL, 85024486UL, 3019925981UL, 3229477751UL, +1563669137UL, 314080592UL, 2943111861UL, 2838243982UL, 1274664774UL, 2621853102UL, 2355885175UL, 3359668856UL, 1111296541UL, 1615234696UL, 3626558972UL, 4290084148UL, 1632078UL, 1047440803UL, 623898652UL, 2490578842UL, 2366345698UL, 1628128899UL, 860259543UL, 2097114662UL, 2833820527UL, 329818923UL, 648489148UL, 1791961202UL, 1730000077UL, 1513419073UL, 149629345UL, 2468961221UL, 3711837973UL, 3255238414UL, 1434755773UL, 3808719305UL, +2513270108UL, 2701064683UL, 1635042488UL, 303393137UL, 1346302239UL, 1852307302UL, 850106025UL, 3523245944UL, 2853497268UL, 3786573704UL, 2604101162UL, 1446573486UL, 1011238489UL, 3138967488UL, 2973528682UL, 2752811123UL, 2890321579UL, 1044586909UL, 1335670403UL, 1560253777UL, 1437495434UL, 2700525242UL, 608940900UL, 3870707795UL, 4141538580UL, 3375331039UL, 3081538601UL, 728626935UL, 3689191993UL, 1933431212UL, 2196145886UL, 87814045UL, +646732047UL, 812542698UL, 51082211UL, 3347503176UL, 3221768777UL, 1783601443UL, 277257023UL, 1716372908UL, 4132024211UL, 3035957293UL, 3363442238UL, 2713916211UL, 1645540011UL, 2629793790UL, 3185505897UL, 2066587565UL, 3800150234UL, 1728339314UL, 2318396341UL, 3396602050UL, 2279941522UL, 2530282967UL, 1762905939UL, 1706358553UL, 1088424264UL, 2989326347UL, 4224669506UL, 1128004134UL, 2724553694UL, 41981087UL, 2348931916UL, 484289311UL, +3425554050UL, 3537673465UL, 752263676UL, 3169550883UL, 657028134UL, 4090689526UL, 2141254732UL, 1469491656UL, 1152943917UL, 2089385540UL, 3316809312UL, 1698245188UL, 1656427920UL, 1808689833UL, 2750354264UL, 3850483440UL, 4081834419UL, 1225164947UL, 2422106046UL, 3432605739UL, 116832506UL, 3097397897UL, 961156503UL, 1581804167UL, 2234120716UL, 1890464921UL, 1891872926UL, 191259956UL, 4113708001UL, 125359575UL, 4285601625UL, 1495519933UL, +3398829761UL, 3473435310UL, 4034254942UL, 1286922996UL, 3120709698UL, 15569196UL, 3122200488UL, 2090684174UL, 1552075789UL, 4259725643UL, 2837166910UL, 2838170407UL, 3412758413UL, 2597304083UL, 4147585653UL, 1021482843UL, 954000150UL, 2464533361UL, 3608172979UL, 1991038123UL, 97515853UL, 3832321348UL, 2634732952UL, 1046079304UL, 4105813389UL, 3589099183UL, 1288675572UL, 4263828421UL, 4148331147UL, 2267137817UL, 85024486UL, 1080403742UL, +3229477751UL, 1563669137UL, 314080592UL, 2943111861UL, 3357655593UL, 1274664774UL, 2621853102UL, 2355885175UL, 3359668856UL, 3722440291UL, 1615234696UL, 3626558972UL, 4290084148UL, 1632078UL, 4263556325UL, 623898652UL, 2490578842UL, 2366345698UL, 1628128899UL, 3623136669UL, 2097114662UL, 2833820527UL, 329818923UL, 648489148UL, 592747007UL, 1730000077UL, 1513419073UL, 149629345UL, 2468961221UL, 3766709284UL, 3255238414UL, 1434755773UL, +3808719305UL, 2513270108UL, 1958651003UL, 1635042488UL, 303393137UL, 1346302239UL, 1852307302UL, 579487408UL, 3523245944UL, 2853497268UL, 3786573704UL, 2604101162UL, 4183724981UL, 1011238489UL, 3138967488UL, 2973528682UL, 2752811123UL, 3074709397UL, 1044586909UL, 1335670403UL, 1560253777UL, 1437495434UL, 1237099522UL, 608940900UL, 3870707795UL, 4141538580UL, 3375331039UL, 2032507604UL, 728626935UL, 3689191993UL, 1933431212UL, 2196145886UL, +4008131891UL, 646732047UL, 812542698UL, 51082211UL, 3347503176UL, 3622107037UL, 1783601443UL, 277257023UL, 1716372908UL, 4132024211UL, 1264285659UL, 3363442238UL, 2713916211UL, 1645540011UL, 2629793790UL, 2179309595UL, 2066587565UL, 3800150234UL, 1728339314UL, 2318396341UL, 580990822UL, 2279941522UL, 2530282967UL, 1762905939UL, 1706358553UL, 2826056883UL, 2989326347UL, 4224669506UL, 1128004134UL, 2724553694UL, 1486392636UL, 2348931916UL, +484289311UL, 3425554050UL, 3537673465UL, 2497657189UL, 3169550883UL, 657028134UL, 4090689526UL, 2141254732UL, 1019244016UL, 1152943917UL, 2089385540UL, 3316809312UL, 1698245188UL, 2921739456UL, 1808689833UL, 2750354264UL, 3850483440UL, 4081834419UL, 108425527UL, 2422106046UL, 3432605739UL, 116832506UL, 3097397897UL, 3902994002UL, 1581804167UL, 2234120716UL, 1890464921UL, 1891872926UL, 3428861050UL, 4113708001UL, 125359575UL, 4285601625UL, +1495519933UL, 3350053832UL, 3473435310UL, 4034254942UL, 1286922996UL, 3120709698UL, 2906201347UL, 3122200488UL, 2090684174UL, 1552075789UL, 4259725643UL, 1965598685UL, 2838170407UL, 3412758413UL, 2597304083UL, 4147585653UL, 3335631208UL, 954000150UL, 2464533361UL, 3608172979UL, 1991038123UL, 3788034599UL, 3832321348UL, 2634732952UL, 1046079304UL, 4105813389UL, 2362460804UL, 1288675572UL, 4263828421UL, 4148331147UL, 2267137817UL, 2767331798UL, +1080403742UL, 3229477751UL, 1563669137UL, 314080592UL, 1737897403UL, 3357655593UL, 1274664774UL, 2621853102UL, 2355885175UL, 57997639UL, 3722440291UL, 1615234696UL, 3626558972UL, 4290084148UL, 3703113369UL, 4263556325UL, 623898652UL, 2490578842UL, 2366345698UL, 73788443UL, 3623136669UL, 2097114662UL, 2833820527UL, 329818923UL, 253042650UL, 592747007UL, 1730000077UL, 1513419073UL, 149629345UL, 4248302934UL, 3766709284UL, 3255238414UL, +1434755773UL, 3808719305UL, 3698431827UL, 1958651003UL, 1635042488UL, 303393137UL, 1346302239UL, 3872433842UL, 579487408UL, 3523245944UL, 2853497268UL, 3786573704UL, 3459185849UL, 4183724981UL, 1011238489UL, 3138967488UL, 2973528682UL, 2605373899UL, 3074709397UL, 1044586909UL, 1335670403UL, 1560253777UL, 4069724875UL, 1237099522UL, 608940900UL, 3870707795UL, 4141538580UL, 2550307954UL, 2032507604UL, 728626935UL, 3689191993UL, 1933431212UL, +1177640824UL, 4168589688UL, 1361487780UL, 2649612520UL, 2181448948UL, 2176288560UL, 947907377UL, 3772487849UL, 2002599877UL, 3353450532UL, 2013145251UL, 2357912348UL, 2316997609UL, 2355480213UL, 255142205UL, 751273749UL, 4049362748UL, 1434168014UL, 2069693747UL, 6910933UL, 1352778547UL, 2413649875UL, 4238683558UL, 484497407UL, 522555106UL, 1848417180UL, 3001805499UL, 2264939603UL, 3606143565UL, 1782482647UL, 2955918436UL, 3471474379UL, +2814133839UL, 3779337475UL, 3522102195UL, 1551792178UL, 3742001759UL, 3433504551UL, 472918932UL, 3835854229UL, 4259163014UL, 4103952359UL, 1989474190UL, 1792448078UL, 1517735224UL, 1958036884UL, 2277922531UL, 2856192348UL, 4294188732UL, 2674247971UL, 643649427UL, 3847742408UL, 1512435795UL, 4236693554UL, 1749045838UL, 397093640UL, 2940663643UL, 4156440725UL, 188785143UL, 3894740830UL, 897618321UL, 3333498692UL, 1623924612UL, 4111607062UL, +2242558573UL, 1565861815UL, 1177957654UL, 4129621176UL, 2232443247UL, 3216995984UL, 3313294700UL, 791442469UL, 1782204490UL, 2452634246UL, 1288014576UL, 1347365377UL, 112254281UL, 2044140398UL, 2479591984UL, 3293701920UL, 1062335151UL, 1397230369UL, 2460086085UL, 2412349474UL, 1252633202UL, 3704541545UL, 2132499200UL, 2202058121UL, 1981543691UL, 2683673516UL, 1198109770UL, 4279157703UL, 2224504258UL, 2188868731UL, 769314834UL, 601313429UL, +3595357440UL, 561383123UL, 3444949507UL, 2127327734UL, 2865252582UL, 4181002098UL, 2408426518UL, 309361635UL, 2377703815UL, 1109219406UL, 406287309UL, 1750179098UL, 3619129839UL, 937928728UL, 884423945UL, 928407281UL, 4173634172UL, 1492070114UL, 2706943441UL, 1365883971UL, 3076484301UL, 744370087UL, 4004118884UL, 2199449568UL, 879458863UL, 3197725005UL, 3590586547UL, 59693002UL, 3614114662UL, 1499386564UL, 2914582708UL, 3751842429UL, +947438603UL, 1986129491UL, 3747112289UL, 833777768UL, 2231649410UL, 1841607849UL, 3526253103UL, 3797105813UL, 1291185911UL, 3188408549UL, 3311027691UL, 3983681758UL, 2246511800UL, 1271525377UL, 2996265908UL, 2396071405UL, 902427181UL, 164636454UL, 2459631341UL, 635349368UL, 463309029UL, 1409367654UL, 849052250UL, 3221786769UL, 2310288531UL, 2919204855UL, 1263130532UL, 1215722704UL, 3497322658UL, 2840687222UL, 2185004161UL, 1507335864UL, +}, +{ +2052557448UL, 2879065999UL, 22933757UL, 2160014758UL, 3736092460UL, 3556641619UL, 1350613766UL, 2107757927UL, 309323868UL, 3452852627UL, 3424626316UL, 545651740UL, 1935764720UL, 2349926457UL, 3546577033UL, 862046434UL, 167198649UL, 338290297UL, 1145807303UL, 1571276102UL, 883549156UL, 907871968UL, 638566313UL, 678764227UL, 3795356864UL, 3306095271UL, 1452688488UL, 621126888UL, 1838613968UL, 2054107827UL, 1785040579UL, 454879400UL, +1952849106UL, 1907701866UL, 1639495252UL, 1623968604UL, 2997422000UL, 2633878652UL, 1036670775UL, 2191465943UL, 3053533585UL, 1654709920UL, 1950620393UL, 4177745509UL, 1742007818UL, 2888573892UL, 2825965566UL, 1399790365UL, 1307674482UL, 310692416UL, 384880529UL, 3497622676UL, 1024664651UL, 1541456182UL, 1904670217UL, 1008618602UL, 2816673160UL, 684112698UL, 3332034744UL, 3646613828UL, 962627614UL, 3072103948UL, 3713153075UL, 476323310UL, +3243124597UL, 126319837UL, 2155412848UL, 228580793UL, 2142696490UL, 3442722759UL, 2689599232UL, 426191419UL, 3157759186UL, 100239709UL, 494534049UL, 1259677734UL, 2889209278UL, 1754641396UL, 1057778427UL, 2133253617UL, 1298500018UL, 3340348062UL, 3967049659UL, 2927469144UL, 1503854147UL, 2271956463UL, 3004309866UL, 260248338UL, 2570702480UL, 2067671015UL, 3168497089UL, 361311552UL, 2123195373UL, 2825457193UL, 2599488181UL, 507483626UL, +1201669979UL, 910763802UL, 4158584821UL, 3116016424UL, 3375736126UL, 2857697336UL, 3112473104UL, 2683465481UL, 1495348009UL, 681020485UL, 4044713962UL, 2443109893UL, 129994063UL, 1710251126UL, 820410567UL, 601527649UL, 1007603132UL, 2096580480UL, 1942768885UL, 1984297765UL, 1888157243UL, 960265104UL, 527990410UL, 1572910026UL, 1106822080UL, 1472807331UL, 2465011897UL, 3139401215UL, 3705452371UL, 393081842UL, 3826516196UL, 2576499701UL, +4130037087UL, 4155028170UL, 2188282304UL, 2949056849UL, 1138928618UL, 858751984UL, 3735375571UL, 496972334UL, 830265621UL, 1355757111UL, 909444416UL, 1337622259UL, 2616327935UL, 2337227347UL, 2139876075UL, 4269663356UL, 796316592UL, 1893005585UL, 3958551664UL, 1746456069UL, 2430709714UL, 4025417573UL, 3333292799UL, 1833607331UL, 3864559081UL, 3415700826UL, 3291421244UL, 1987321873UL, 1792851165UL, 505718946UL, 3755903648UL, 3351468604UL, +4035552813UL, 2052557448UL, 2879065999UL, 22933757UL, 2160014758UL, 2321387515UL, 3556641619UL, 1350613766UL, 2107757927UL, 309323868UL, 1850700415UL, 3424626316UL, 545651740UL, 1935764720UL, 2349926457UL, 979047283UL, 862046434UL, 167198649UL, 338290297UL, 1145807303UL, 4201635137UL, 883549156UL, 907871968UL, 638566313UL, 678764227UL, 2637527083UL, 3306095271UL, 1452688488UL, 621126888UL, 1838613968UL, 117966344UL, 1785040579UL, +454879400UL, 1952849106UL, 1907701866UL, 733998186UL, 1623968604UL, 2997422000UL, 2633878652UL, 1036670775UL, 3360491537UL, 3053533585UL, 1654709920UL, 1950620393UL, 4177745509UL, 1716078578UL, 2888573892UL, 2825965566UL, 1399790365UL, 1307674482UL, 2776111761UL, 384880529UL, 3497622676UL, 1024664651UL, 1541456182UL, 618916624UL, 1008618602UL, 2816673160UL, 684112698UL, 3332034744UL, 3340690804UL, 962627614UL, 3072103948UL, 3713153075UL, +476323310UL, 902990902UL, 126319837UL, 2155412848UL, 228580793UL, 2142696490UL, 4254301999UL, 2689599232UL, 426191419UL, 3157759186UL, 100239709UL, 3216403640UL, 1259677734UL, 2889209278UL, 1754641396UL, 1057778427UL, 3221479262UL, 1298500018UL, 3340348062UL, 3967049659UL, 2927469144UL, 3926654939UL, 2271956463UL, 3004309866UL, 260248338UL, 2570702480UL, 1879451653UL, 3168497089UL, 361311552UL, 2123195373UL, 2825457193UL, 341920668UL, +507483626UL, 1201669979UL, 910763802UL, 4158584821UL, 3748705813UL, 3375736126UL, 2857697336UL, 3112473104UL, 2683465481UL, 3336305747UL, 681020485UL, 4044713962UL, 2443109893UL, 129994063UL, 2578353596UL, 820410567UL, 601527649UL, 1007603132UL, 2096580480UL, 3155251071UL, 1984297765UL, 1888157243UL, 960265104UL, 527990410UL, 2548692624UL, 1106822080UL, 1472807331UL, 2465011897UL, 3139401215UL, 736629379UL, 393081842UL, 3826516196UL, +2576499701UL, 4130037087UL, 2440227627UL, 2188282304UL, 2949056849UL, 1138928618UL, 858751984UL, 191805249UL, 496972334UL, 830265621UL, 1355757111UL, 909444416UL, 396738554UL, 2616327935UL, 2337227347UL, 2139876075UL, 4269663356UL, 3932761947UL, 1893005585UL, 3958551664UL, 1746456069UL, 2430709714UL, 3171160829UL, 3333292799UL, 1833607331UL, 3864559081UL, 3415700826UL, 1332800826UL, 1987321873UL, 1792851165UL, 505718946UL, 3755903648UL, +1770588062UL, 4035552813UL, 2052557448UL, 2879065999UL, 22933757UL, 3159941473UL, 2321387515UL, 3556641619UL, 1350613766UL, 2107757927UL, 2669366188UL, 1850700415UL, 3424626316UL, 545651740UL, 1935764720UL, 3252475208UL, 979047283UL, 862046434UL, 167198649UL, 338290297UL, 771814471UL, 4201635137UL, 883549156UL, 907871968UL, 638566313UL, 184144160UL, 2637527083UL, 3306095271UL, 1452688488UL, 621126888UL, 4275587594UL, 117966344UL, +1785040579UL, 454879400UL, 1952849106UL, 3806424990UL, 733998186UL, 1623968604UL, 2997422000UL, 2633878652UL, 2670843077UL, 3360491537UL, 3053533585UL, 1654709920UL, 1950620393UL, 3541927406UL, 1716078578UL, 2888573892UL, 2825965566UL, 1399790365UL, 3184295779UL, 2776111761UL, 384880529UL, 3497622676UL, 1024664651UL, 723804135UL, 618916624UL, 1008618602UL, 2816673160UL, 684112698UL, 3275521308UL, 3340690804UL, 962627614UL, 3072103948UL, +3713153075UL, 2023106558UL, 902990902UL, 126319837UL, 2155412848UL, 228580793UL, 3978575748UL, 4254301999UL, 2689599232UL, 426191419UL, 3157759186UL, 2446138116UL, 3216403640UL, 1259677734UL, 2889209278UL, 1754641396UL, 1706032491UL, 3221479262UL, 1298500018UL, 3340348062UL, 3967049659UL, 3805001240UL, 3926654939UL, 2271956463UL, 3004309866UL, 260248338UL, 294480880UL, 1879451653UL, 3168497089UL, 361311552UL, 2123195373UL, 2080604411UL, +341920668UL, 507483626UL, 1201669979UL, 910763802UL, 2012149356UL, 3748705813UL, 3375736126UL, 2857697336UL, 3112473104UL, 2935748807UL, 3336305747UL, 681020485UL, 4044713962UL, 2443109893UL, 2862982895UL, 2578353596UL, 820410567UL, 601527649UL, 1007603132UL, 1890290066UL, 3155251071UL, 1984297765UL, 1888157243UL, 960265104UL, 41870487UL, 2548692624UL, 1106822080UL, 1472807331UL, 2465011897UL, 2382974023UL, 736629379UL, 393081842UL, +3826516196UL, 2576499701UL, 4219335149UL, 2440227627UL, 2188282304UL, 2949056849UL, 1138928618UL, 3785297102UL, 191805249UL, 496972334UL, 830265621UL, 1355757111UL, 3962907313UL, 396738554UL, 2616327935UL, 2337227347UL, 2139876075UL, 552154011UL, 3932761947UL, 1893005585UL, 3958551664UL, 1746456069UL, 895507243UL, 3171160829UL, 3333292799UL, 1833607331UL, 3864559081UL, 3564325554UL, 1332800826UL, 1987321873UL, 1792851165UL, 505718946UL, +3245448088UL, 1770588062UL, 4035552813UL, 2052557448UL, 2879065999UL, 3602157977UL, 3159941473UL, 2321387515UL, 3556641619UL, 1350613766UL, 4101259055UL, 2669366188UL, 1850700415UL, 3424626316UL, 545651740UL, 2873707882UL, 3252475208UL, 979047283UL, 862046434UL, 167198649UL, 654196140UL, 771814471UL, 4201635137UL, 883549156UL, 907871968UL, 191965184UL, 184144160UL, 2637527083UL, 3306095271UL, 1452688488UL, 1562736568UL, 4275587594UL, +117966344UL, 1785040579UL, 454879400UL, 3484019450UL, 3806424990UL, 733998186UL, 1623968604UL, 2997422000UL, 273316614UL, 2670843077UL, 3360491537UL, 3053533585UL, 1654709920UL, 591311873UL, 3541927406UL, 1716078578UL, 2888573892UL, 2825965566UL, 2277117038UL, 3184295779UL, 2776111761UL, 384880529UL, 3497622676UL, 1086566797UL, 723804135UL, 618916624UL, 1008618602UL, 2816673160UL, 3344392942UL, 3275521308UL, 3340690804UL, 962627614UL, +3072103948UL, 2910444460UL, 2023106558UL, 902990902UL, 126319837UL, 2155412848UL, 337119596UL, 3978575748UL, 4254301999UL, 2689599232UL, 426191419UL, 3471778695UL, 2446138116UL, 3216403640UL, 1259677734UL, 2889209278UL, 4102983766UL, 1706032491UL, 3221479262UL, 1298500018UL, 3340348062UL, 2940293024UL, 3805001240UL, 3926654939UL, 2271956463UL, 3004309866UL, 3634668003UL, 294480880UL, 1879451653UL, 3168497089UL, 361311552UL, 3417679321UL, +2080604411UL, 341920668UL, 507483626UL, 1201669979UL, 3174274528UL, 2012149356UL, 3748705813UL, 3375736126UL, 2857697336UL, 3929686609UL, 2935748807UL, 3336305747UL, 681020485UL, 4044713962UL, 405011299UL, 2862982895UL, 2578353596UL, 820410567UL, 601527649UL, 4281957726UL, 1890290066UL, 3155251071UL, 1984297765UL, 1888157243UL, 1978308818UL, 41870487UL, 2548692624UL, 1106822080UL, 1472807331UL, 3701147046UL, 2382974023UL, 736629379UL, +393081842UL, 3826516196UL, 3225163595UL, 4219335149UL, 2440227627UL, 2188282304UL, 2949056849UL, 3894577191UL, 3785297102UL, 191805249UL, 496972334UL, 830265621UL, 4293577013UL, 3962907313UL, 396738554UL, 2616327935UL, 2337227347UL, 3701032380UL, 552154011UL, 3932761947UL, 1893005585UL, 3958551664UL, 4148575672UL, 895507243UL, 3171160829UL, 3333292799UL, 1833607331UL, 1596419195UL, 3564325554UL, 1332800826UL, 1987321873UL, 1792851165UL, +3663406943UL, 3892533309UL, 247565591UL, 953356243UL, 4103354183UL, 1908418768UL, 3915294912UL, 2390669489UL, 3865260287UL, 1818313429UL, 557880278UL, 2499771815UL, 2618380525UL, 732785004UL, 1414011135UL, 2858311749UL, 3871596970UL, 2428464498UL, 645476041UL, 683035653UL, 4079609082UL, 2404111028UL, 3332056297UL, 3054547484UL, 3616426087UL, 1311379849UL, 3682136336UL, 3795847093UL, 1509718393UL, 541389178UL, 1103876446UL, 2549442278UL, +3656600574UL, 3019560735UL, 523610761UL, 3889482885UL, 3080739216UL, 2359120072UL, 1034857006UL, 63567637UL, 1520176098UL, 1741685274UL, 2330217396UL, 1429674399UL, 517809884UL, 2653145241UL, 868296581UL, 646514407UL, 3166145188UL, 3023629813UL, 2333851648UL, 2967365394UL, 1828821737UL, 3333092181UL, 445460259UL, 2682093551UL, 3655100102UL, 2592872076UL, 1588368999UL, 3964958220UL, 755397374UL, 1912970603UL, 396253754UL, 4260038354UL, +1530898510UL, 2396805917UL, 3327501452UL, 4235709361UL, 2762163349UL, 553869167UL, 3162483580UL, 1611891352UL, 248738605UL, 3403092967UL, 2194464420UL, 113420452UL, 1752444845UL, 3770903547UL, 2397481985UL, 2866414964UL, 2555678075UL, 2796010061UL, 762034588UL, 2679383682UL, 1848516655UL, 3857720381UL, 1119111363UL, 1829110546UL, 2183620391UL, 1743838702UL, 3363053704UL, 2212810289UL, 966205413UL, 3897281091UL, 2148139678UL, 2690229390UL, +427450194UL, 3516115778UL, 1864991059UL, 134448489UL, 3397232480UL, 3999530682UL, 1927036992UL, 3170864927UL, 3879295489UL, 134554462UL, 3447324105UL, 86678510UL, 1656551206UL, 2844494044UL, 2469678938UL, 2885597732UL, 2715483555UL, 3566904604UL, 462585182UL, 1922457093UL, 3035264235UL, 2866504077UL, 2031456720UL, 1598555964UL, 2569915450UL, 3947972758UL, 290683210UL, 2465427488UL, 3504862176UL, 793156806UL, 1722326752UL, 2706215067UL, +3818976191UL, 2007064241UL, 552144413UL, 2692866408UL, 3975075075UL, 4293828741UL, 1123460373UL, 960845744UL, 1855626484UL, 1876934434UL, 1343778249UL, 912185207UL, 127278206UL, 4168930635UL, 340393978UL, 65814528UL, 2552086271UL, 2507474816UL, 1240220220UL, 1761964455UL, 2204917500UL, 4088965101UL, 1079310398UL, 3071460742UL, 2188549805UL, 1064733776UL, 4191719087UL, 3221046115UL, 3772395288UL, 883516842UL, 2077853840UL, 229484673UL, +}, +{ +448889887UL, 3508620909UL, 4164289950UL, 155254859UL, 298319697UL, 980080883UL, 3500794888UL, 3974907245UL, 682778656UL, 382798811UL, 1500342771UL, 3942535492UL, 1039809505UL, 2126581011UL, 561192171UL, 4046277638UL, 840733718UL, 1694555864UL, 241216466UL, 4182349979UL, 2525929010UL, 386794637UL, 349755829UL, 2959959729UL, 686974318UL, 3243688353UL, 3911051908UL, 3917458620UL, 441833800UL, 3164548257UL, 584185450UL, 450132281UL, +3528356519UL, 4275666503UL, 1317069624UL, 817077137UL, 2945430988UL, 1532878265UL, 2542155552UL, 3348614029UL, 1419611574UL, 1245233100UL, 1981161828UL, 1161647342UL, 2781439556UL, 3896025436UL, 2349200248UL, 1213899699UL, 860301545UL, 1590934964UL, 3371591516UL, 2850926464UL, 2774569126UL, 907316453UL, 3541736952UL, 3572719697UL, 278602945UL, 4257620354UL, 3396349537UL, 3144949411UL, 191271983UL, 2974056951UL, 2743594803UL, 1119054633UL, +815666748UL, 920991498UL, 187861899UL, 2008325469UL, 1548504646UL, 3749744762UL, 993523345UL, 1171349070UL, 4105576982UL, 1559471848UL, 2656434170UL, 2795453957UL, 3357293755UL, 4260164297UL, 2211998873UL, 1783238785UL, 2831224398UL, 1704939914UL, 2626903427UL, 1148581053UL, 849777796UL, 4219173763UL, 694869701UL, 1297370017UL, 3573985711UL, 1739242781UL, 3680794431UL, 400850360UL, 909653264UL, 1496585542UL, 460982606UL, 828640603UL, +3993062500UL, 2145047281UL, 1587836828UL, 912583500UL, 1234319994UL, 4276951314UL, 485282908UL, 1903750880UL, 1667769214UL, 3950976882UL, 3711912938UL, 3626058764UL, 627857875UL, 436470402UL, 1753727232UL, 50241405UL, 206782941UL, 612110492UL, 954016857UL, 2567547031UL, 3360482779UL, 820704062UL, 412722485UL, 2044763466UL, 1915626743UL, 2703000434UL, 2755090057UL, 53587450UL, 2457122208UL, 1397065983UL, 2822294224UL, 3024827428UL, +2201149820UL, 699377793UL, 157099022UL, 2792298089UL, 3927835437UL, 1095494739UL, 1230723791UL, 2740420278UL, 2518077381UL, 3674832547UL, 2375246835UL, 923451748UL, 3665432731UL, 1577970518UL, 2643388181UL, 4050379756UL, 1145072065UL, 1632232822UL, 2365350332UL, 1126185680UL, 930842061UL, 3816331201UL, 1624573114UL, 3809118349UL, 1187817320UL, 945407897UL, 63630679UL, 1852369563UL, 971772965UL, 2229069035UL, 2320405193UL, 3474864049UL, +1666937976UL, 448889887UL, 3508620909UL, 4164289950UL, 155254859UL, 3157319819UL, 980080883UL, 3500794888UL, 3974907245UL, 682778656UL, 3201604042UL, 1500342771UL, 3942535492UL, 1039809505UL, 2126581011UL, 3235144326UL, 4046277638UL, 840733718UL, 1694555864UL, 241216466UL, 2728337326UL, 2525929010UL, 386794637UL, 349755829UL, 2959959729UL, 20820947UL, 3243688353UL, 3911051908UL, 3917458620UL, 441833800UL, 4143649787UL, 584185450UL, +450132281UL, 3528356519UL, 4275666503UL, 3541347868UL, 817077137UL, 2945430988UL, 1532878265UL, 2542155552UL, 3199458552UL, 1419611574UL, 1245233100UL, 1981161828UL, 1161647342UL, 958085276UL, 3896025436UL, 2349200248UL, 1213899699UL, 860301545UL, 1701089635UL, 3371591516UL, 2850926464UL, 2774569126UL, 907316453UL, 1529987826UL, 3572719697UL, 278602945UL, 4257620354UL, 3396349537UL, 4120000342UL, 191271983UL, 2974056951UL, 2743594803UL, +1119054633UL, 4255116655UL, 920991498UL, 187861899UL, 2008325469UL, 1548504646UL, 100038488UL, 993523345UL, 1171349070UL, 4105576982UL, 1559471848UL, 2523523381UL, 2795453957UL, 3357293755UL, 4260164297UL, 2211998873UL, 3644225670UL, 2831224398UL, 1704939914UL, 2626903427UL, 1148581053UL, 1292003378UL, 4219173763UL, 694869701UL, 1297370017UL, 3573985711UL, 2510138592UL, 3680794431UL, 400850360UL, 909653264UL, 1496585542UL, 1738256576UL, +828640603UL, 3993062500UL, 2145047281UL, 1587836828UL, 3478998519UL, 1234319994UL, 4276951314UL, 485282908UL, 1903750880UL, 746205619UL, 3950976882UL, 3711912938UL, 3626058764UL, 627857875UL, 954627753UL, 1753727232UL, 50241405UL, 206782941UL, 612110492UL, 2251018875UL, 2567547031UL, 3360482779UL, 820704062UL, 412722485UL, 2120077037UL, 1915626743UL, 2703000434UL, 2755090057UL, 53587450UL, 2696843657UL, 1397065983UL, 2822294224UL, +3024827428UL, 2201149820UL, 3308142895UL, 157099022UL, 2792298089UL, 3927835437UL, 1095494739UL, 730099534UL, 2740420278UL, 2518077381UL, 3674832547UL, 2375246835UL, 2126745526UL, 3665432731UL, 1577970518UL, 2643388181UL, 4050379756UL, 2987545029UL, 1632232822UL, 2365350332UL, 1126185680UL, 930842061UL, 3140947362UL, 1624573114UL, 3809118349UL, 1187817320UL, 945407897UL, 1282799903UL, 1852369563UL, 971772965UL, 2229069035UL, 2320405193UL, +670134249UL, 1666937976UL, 448889887UL, 3508620909UL, 4164289950UL, 127045110UL, 3157319819UL, 980080883UL, 3500794888UL, 3974907245UL, 2740953010UL, 3201604042UL, 1500342771UL, 3942535492UL, 1039809505UL, 306788856UL, 3235144326UL, 4046277638UL, 840733718UL, 1694555864UL, 2260304655UL, 2728337326UL, 2525929010UL, 386794637UL, 349755829UL, 3842816805UL, 20820947UL, 3243688353UL, 3911051908UL, 3917458620UL, 3398227861UL, 4143649787UL, +584185450UL, 450132281UL, 3528356519UL, 550401017UL, 3541347868UL, 817077137UL, 2945430988UL, 1532878265UL, 1045681234UL, 3199458552UL, 1419611574UL, 1245233100UL, 1981161828UL, 1153297031UL, 958085276UL, 3896025436UL, 2349200248UL, 1213899699UL, 1451842347UL, 1701089635UL, 3371591516UL, 2850926464UL, 2774569126UL, 1269128107UL, 1529987826UL, 3572719697UL, 278602945UL, 4257620354UL, 2479560493UL, 4120000342UL, 191271983UL, 2974056951UL, +2743594803UL, 4081110580UL, 4255116655UL, 920991498UL, 187861899UL, 2008325469UL, 1300371976UL, 100038488UL, 993523345UL, 1171349070UL, 4105576982UL, 3010753279UL, 2523523381UL, 2795453957UL, 3357293755UL, 4260164297UL, 207153762UL, 3644225670UL, 2831224398UL, 1704939914UL, 2626903427UL, 916783095UL, 1292003378UL, 4219173763UL, 694869701UL, 1297370017UL, 3388725608UL, 2510138592UL, 3680794431UL, 400850360UL, 909653264UL, 2421730678UL, +1738256576UL, 828640603UL, 3993062500UL, 2145047281UL, 2123619770UL, 3478998519UL, 1234319994UL, 4276951314UL, 485282908UL, 4002661777UL, 746205619UL, 3950976882UL, 3711912938UL, 3626058764UL, 1230937254UL, 954627753UL, 1753727232UL, 50241405UL, 206782941UL, 460314337UL, 2251018875UL, 2567547031UL, 3360482779UL, 820704062UL, 1339598718UL, 2120077037UL, 1915626743UL, 2703000434UL, 2755090057UL, 660730207UL, 2696843657UL, 1397065983UL, +2822294224UL, 3024827428UL, 126840648UL, 3308142895UL, 157099022UL, 2792298089UL, 3927835437UL, 2192535935UL, 730099534UL, 2740420278UL, 2518077381UL, 3674832547UL, 1879512787UL, 2126745526UL, 3665432731UL, 1577970518UL, 2643388181UL, 832572764UL, 2987545029UL, 1632232822UL, 2365350332UL, 1126185680UL, 3248646182UL, 3140947362UL, 1624573114UL, 3809118349UL, 1187817320UL, 4270855000UL, 1282799903UL, 1852369563UL, 971772965UL, 2229069035UL, +3735782785UL, 670134249UL, 1666937976UL, 448889887UL, 3508620909UL, 3681408470UL, 127045110UL, 3157319819UL, 980080883UL, 3500794888UL, 3967872553UL, 2740953010UL, 3201604042UL, 1500342771UL, 3942535492UL, 613854690UL, 306788856UL, 3235144326UL, 4046277638UL, 840733718UL, 3957877023UL, 2260304655UL, 2728337326UL, 2525929010UL, 386794637UL, 1779451936UL, 3842816805UL, 20820947UL, 3243688353UL, 3911051908UL, 688470429UL, 3398227861UL, +4143649787UL, 584185450UL, 450132281UL, 3381050556UL, 550401017UL, 3541347868UL, 817077137UL, 2945430988UL, 1859551669UL, 1045681234UL, 3199458552UL, 1419611574UL, 1245233100UL, 53681099UL, 1153297031UL, 958085276UL, 3896025436UL, 2349200248UL, 1796144514UL, 1451842347UL, 1701089635UL, 3371591516UL, 2850926464UL, 1337394836UL, 1269128107UL, 1529987826UL, 3572719697UL, 278602945UL, 46913829UL, 2479560493UL, 4120000342UL, 191271983UL, +2974056951UL, 1361976701UL, 4081110580UL, 4255116655UL, 920991498UL, 187861899UL, 1237191391UL, 1300371976UL, 100038488UL, 993523345UL, 1171349070UL, 3168325479UL, 3010753279UL, 2523523381UL, 2795453957UL, 3357293755UL, 2142853843UL, 207153762UL, 3644225670UL, 2831224398UL, 1704939914UL, 2369686128UL, 916783095UL, 1292003378UL, 4219173763UL, 694869701UL, 4150182218UL, 3388725608UL, 2510138592UL, 3680794431UL, 400850360UL, 654034492UL, +2421730678UL, 1738256576UL, 828640603UL, 3993062500UL, 84735560UL, 2123619770UL, 3478998519UL, 1234319994UL, 4276951314UL, 2545204994UL, 4002661777UL, 746205619UL, 3950976882UL, 3711912938UL, 426068544UL, 1230937254UL, 954627753UL, 1753727232UL, 50241405UL, 589286339UL, 460314337UL, 2251018875UL, 2567547031UL, 3360482779UL, 3279873953UL, 1339598718UL, 2120077037UL, 1915626743UL, 2703000434UL, 2720159887UL, 660730207UL, 2696843657UL, +1397065983UL, 2822294224UL, 3536645029UL, 126840648UL, 3308142895UL, 157099022UL, 2792298089UL, 485214530UL, 2192535935UL, 730099534UL, 2740420278UL, 2518077381UL, 418832171UL, 1879512787UL, 2126745526UL, 3665432731UL, 1577970518UL, 721018UL, 832572764UL, 2987545029UL, 1632232822UL, 2365350332UL, 1769688764UL, 3248646182UL, 3140947362UL, 1624573114UL, 3809118349UL, 3561012744UL, 4270855000UL, 1282799903UL, 1852369563UL, 971772965UL, +2160782957UL, 105464019UL, 2131462864UL, 335205049UL, 3271229551UL, 1374396416UL, 4269753677UL, 1984596635UL, 37563880UL, 3956352262UL, 2168603656UL, 311623712UL, 1593371323UL, 351020595UL, 3439337532UL, 3130874657UL, 3613343327UL, 695789539UL, 609797513UL, 53642143UL, 1479027519UL, 1588831722UL, 262810641UL, 3418379977UL, 530167431UL, 1962487963UL, 2410103328UL, 3360114680UL, 3548827677UL, 2735238248UL, 2136058369UL, 4013192489UL, +4106245442UL, 2155966460UL, 3653971354UL, 1230293148UL, 3966689348UL, 3455336684UL, 3594979856UL, 3178937309UL, 3983796170UL, 3617590004UL, 1727358326UL, 1121418876UL, 1022562029UL, 2437823131UL, 2733424381UL, 452731958UL, 2983755220UL, 1674750403UL, 3110921909UL, 3514365950UL, 2193238341UL, 2073801740UL, 669573402UL, 1824298084UL, 22336337UL, 3366446304UL, 1536043612UL, 2502297553UL, 1409641611UL, 2399583184UL, 2593245170UL, 716832039UL, +4286149460UL, 814849965UL, 4239224908UL, 2453627262UL, 976385355UL, 1846129423UL, 52096201UL, 88835472UL, 2621770794UL, 2491757130UL, 1849417480UL, 576668065UL, 2186701850UL, 3357019214UL, 442191324UL, 3662645846UL, 3653766782UL, 2254203663UL, 1169821059UL, 3735427676UL, 2246044748UL, 2635264668UL, 2647842566UL, 1435695450UL, 1658777934UL, 2927080369UL, 1341088646UL, 3565982642UL, 221661496UL, 3246988243UL, 2718455491UL, 483517148UL, +4181332651UL, 1143646375UL, 1720449423UL, 331164544UL, 539836322UL, 3485371630UL, 1110077273UL, 4088985694UL, 145720169UL, 2382276586UL, 4276410795UL, 2051956774UL, 936524156UL, 15415192UL, 1815949694UL, 272696290UL, 1495465483UL, 3102030383UL, 3546078241UL, 3272619595UL, 759699322UL, 1161486824UL, 1146281812UL, 4194130649UL, 3936306436UL, 4077338125UL, 2127551216UL, 2995077453UL, 209698652UL, 3836657987UL, 1782152220UL, 1642490089UL, +3695579542UL, 537862234UL, 1696168156UL, 4022607UL, 3642864269UL, 54404878UL, 2925910542UL, 3444042482UL, 1931288691UL, 2269375687UL, 614870298UL, 1139082272UL, 3672546472UL, 3255845763UL, 2987873616UL, 3436501734UL, 380553853UL, 750118352UL, 750708138UL, 488564982UL, 2936846643UL, 3460652101UL, 3085496886UL, 3734224010UL, 523359404UL, 2751912206UL, 3302219188UL, 2729509827UL, 1995554251UL, 2288103059UL, 3289667468UL, 2860301591UL, +}, +{ +3481653941UL, 2111903071UL, 3569014882UL, 1149634763UL, 4206972571UL, 2948781360UL, 2576820949UL, 2587099571UL, 3987042644UL, 4255777336UL, 2829594348UL, 3832744490UL, 3554499754UL, 787920018UL, 695635693UL, 2746034685UL, 2078139227UL, 1144320548UL, 4020978225UL, 449503505UL, 3004993826UL, 2045843139UL, 1604631401UL, 148449881UL, 457819243UL, 4089112489UL, 1713441237UL, 1790909556UL, 3334464951UL, 3070008305UL, 811825474UL, 4089105370UL, +708239097UL, 1494832299UL, 2074902973UL, 468898217UL, 1722559700UL, 2499754488UL, 2267939270UL, 650114709UL, 549502184UL, 4040463514UL, 4228169080UL, 4094284819UL, 1599334548UL, 2992525399UL, 2107053637UL, 197348940UL, 1669884894UL, 3982326753UL, 4259099320UL, 1862793542UL, 1751219817UL, 2701271514UL, 2507353222UL, 1488339939UL, 4246544316UL, 3978321870UL, 132720476UL, 3020305599UL, 154822619UL, 2595474066UL, 1654579304UL, 1997335204UL, +891320674UL, 3153502700UL, 601607977UL, 2695457160UL, 4137981809UL, 37584248UL, 1674050253UL, 1805619463UL, 676369068UL, 2294902904UL, 658143166UL, 141452045UL, 2383327493UL, 1222336195UL, 2628962123UL, 2378299402UL, 2724274090UL, 1783957650UL, 453206569UL, 3190116972UL, 1480368955UL, 1145768764UL, 3628222572UL, 3108689607UL, 182547022UL, 360165920UL, 3378423016UL, 1443723222UL, 2843274258UL, 1597581683UL, 664283285UL, 258077235UL, +3071875976UL, 240688930UL, 988895736UL, 2965351284UL, 91332032UL, 941306162UL, 2464278288UL, 3493666272UL, 2437043750UL, 2356658919UL, 24726067UL, 3025656863UL, 1343636659UL, 2408295270UL, 3097408183UL, 461428710UL, 2449005423UL, 3220070834UL, 1418517867UL, 907095008UL, 428073188UL, 1938061314UL, 2094361729UL, 2570445990UL, 346999411UL, 990247709UL, 1630488660UL, 2574142591UL, 1466590284UL, 1906935236UL, 1592544037UL, 4168163186UL, +2773942807UL, 939392801UL, 1610069434UL, 1935303983UL, 2962954128UL, 2490925509UL, 4103025390UL, 3614258069UL, 174125899UL, 4113855120UL, 2449365101UL, 3384244363UL, 4115219971UL, 3187664453UL, 4021992190UL, 2959372973UL, 2946571025UL, 2144945539UL, 388172915UL, 1125615727UL, 881693338UL, 3313110562UL, 859388069UL, 177786360UL, 4134747901UL, 616417204UL, 2104495620UL, 783302897UL, 512784708UL, 1295821322UL, 3810209448UL, 2966899912UL, +2390608767UL, 3481653941UL, 2111903071UL, 3569014882UL, 1149634763UL, 1385372463UL, 2948781360UL, 2576820949UL, 2587099571UL, 3987042644UL, 2251144849UL, 2829594348UL, 3832744490UL, 3554499754UL, 787920018UL, 73007125UL, 2746034685UL, 2078139227UL, 1144320548UL, 4020978225UL, 2729117517UL, 3004993826UL, 2045843139UL, 1604631401UL, 148449881UL, 3343221736UL, 4089112489UL, 1713441237UL, 1790909556UL, 3334464951UL, 1920962856UL, 811825474UL, +4089105370UL, 708239097UL, 1494832299UL, 2485576001UL, 468898217UL, 1722559700UL, 2499754488UL, 2267939270UL, 2271486862UL, 549502184UL, 4040463514UL, 4228169080UL, 4094284819UL, 3177940420UL, 2992525399UL, 2107053637UL, 197348940UL, 1669884894UL, 3596140613UL, 4259099320UL, 1862793542UL, 1751219817UL, 2701271514UL, 1357847339UL, 1488339939UL, 4246544316UL, 3978321870UL, 132720476UL, 344033794UL, 154822619UL, 2595474066UL, 1654579304UL, +1997335204UL, 1849659590UL, 3153502700UL, 601607977UL, 2695457160UL, 4137981809UL, 3559496104UL, 1674050253UL, 1805619463UL, 676369068UL, 2294902904UL, 1583197657UL, 141452045UL, 2383327493UL, 1222336195UL, 2628962123UL, 3486106126UL, 2724274090UL, 1783957650UL, 453206569UL, 3190116972UL, 1939413704UL, 1145768764UL, 3628222572UL, 3108689607UL, 182547022UL, 2911760834UL, 3378423016UL, 1443723222UL, 2843274258UL, 1597581683UL, 3599911248UL, +258077235UL, 3071875976UL, 240688930UL, 988895736UL, 4263328855UL, 91332032UL, 941306162UL, 2464278288UL, 3493666272UL, 1561559932UL, 2356658919UL, 24726067UL, 3025656863UL, 1343636659UL, 257301433UL, 3097408183UL, 461428710UL, 2449005423UL, 3220070834UL, 3544357262UL, 907095008UL, 428073188UL, 1938061314UL, 2094361729UL, 4112109825UL, 346999411UL, 990247709UL, 1630488660UL, 2574142591UL, 1466763688UL, 1906935236UL, 1592544037UL, +4168163186UL, 2773942807UL, 3608227467UL, 1610069434UL, 1935303983UL, 2962954128UL, 2490925509UL, 825197245UL, 3614258069UL, 174125899UL, 4113855120UL, 2449365101UL, 167881680UL, 4115219971UL, 3187664453UL, 4021992190UL, 2959372973UL, 1971633162UL, 2144945539UL, 388172915UL, 1125615727UL, 881693338UL, 223946687UL, 859388069UL, 177786360UL, 4134747901UL, 616417204UL, 722598357UL, 783302897UL, 512784708UL, 1295821322UL, 3810209448UL, +1589703161UL, 2390608767UL, 3481653941UL, 2111903071UL, 3569014882UL, 2520719089UL, 1385372463UL, 2948781360UL, 2576820949UL, 2587099571UL, 1427210741UL, 2251144849UL, 2829594348UL, 3832744490UL, 3554499754UL, 1257461820UL, 73007125UL, 2746034685UL, 2078139227UL, 1144320548UL, 3065859797UL, 2729117517UL, 3004993826UL, 2045843139UL, 1604631401UL, 36092756UL, 3343221736UL, 4089112489UL, 1713441237UL, 1790909556UL, 1504385586UL, 1920962856UL, +811825474UL, 4089105370UL, 708239097UL, 4135459720UL, 2485576001UL, 468898217UL, 1722559700UL, 2499754488UL, 1392696606UL, 2271486862UL, 549502184UL, 4040463514UL, 4228169080UL, 2521060775UL, 3177940420UL, 2992525399UL, 2107053637UL, 197348940UL, 4225425195UL, 3596140613UL, 4259099320UL, 1862793542UL, 1751219817UL, 3752827533UL, 1357847339UL, 1488339939UL, 4246544316UL, 3978321870UL, 270743120UL, 344033794UL, 154822619UL, 2595474066UL, +1654579304UL, 986127123UL, 1849659590UL, 3153502700UL, 601607977UL, 2695457160UL, 437034992UL, 3559496104UL, 1674050253UL, 1805619463UL, 676369068UL, 956939381UL, 1583197657UL, 141452045UL, 2383327493UL, 1222336195UL, 3287498300UL, 3486106126UL, 2724274090UL, 1783957650UL, 453206569UL, 3610364652UL, 1939413704UL, 1145768764UL, 3628222572UL, 3108689607UL, 708259891UL, 2911760834UL, 3378423016UL, 1443723222UL, 2843274258UL, 1498209005UL, +3599911248UL, 258077235UL, 3071875976UL, 240688930UL, 3815218922UL, 4263328855UL, 91332032UL, 941306162UL, 2464278288UL, 3018835600UL, 1561559932UL, 2356658919UL, 24726067UL, 3025656863UL, 368313673UL, 257301433UL, 3097408183UL, 461428710UL, 2449005423UL, 3690066046UL, 3544357262UL, 907095008UL, 428073188UL, 1938061314UL, 2274317748UL, 4112109825UL, 346999411UL, 990247709UL, 1630488660UL, 1584471638UL, 1466763688UL, 1906935236UL, +1592544037UL, 4168163186UL, 473837206UL, 3608227467UL, 1610069434UL, 1935303983UL, 2962954128UL, 391171548UL, 825197245UL, 3614258069UL, 174125899UL, 4113855120UL, 2095676907UL, 167881680UL, 4115219971UL, 3187664453UL, 4021992190UL, 4246237180UL, 1971633162UL, 2144945539UL, 388172915UL, 1125615727UL, 3158677395UL, 223946687UL, 859388069UL, 177786360UL, 4134747901UL, 4017781965UL, 722598357UL, 783302897UL, 512784708UL, 1295821322UL, +3908594844UL, 1589703161UL, 2390608767UL, 3481653941UL, 2111903071UL, 2713757719UL, 2520719089UL, 1385372463UL, 2948781360UL, 2576820949UL, 638075690UL, 1427210741UL, 2251144849UL, 2829594348UL, 3832744490UL, 2871270139UL, 1257461820UL, 73007125UL, 2746034685UL, 2078139227UL, 1974062189UL, 3065859797UL, 2729117517UL, 3004993826UL, 2045843139UL, 772058252UL, 36092756UL, 3343221736UL, 4089112489UL, 1713441237UL, 2172680702UL, 1504385586UL, +1920962856UL, 811825474UL, 4089105370UL, 1822881146UL, 4135459720UL, 2485576001UL, 468898217UL, 1722559700UL, 3429640856UL, 1392696606UL, 2271486862UL, 549502184UL, 4040463514UL, 3072935276UL, 2521060775UL, 3177940420UL, 2992525399UL, 2107053637UL, 1114377646UL, 4225425195UL, 3596140613UL, 4259099320UL, 1862793542UL, 1439724658UL, 3752827533UL, 1357847339UL, 1488339939UL, 4246544316UL, 1051119047UL, 270743120UL, 344033794UL, 154822619UL, +2595474066UL, 3143800435UL, 986127123UL, 1849659590UL, 3153502700UL, 601607977UL, 2334441739UL, 437034992UL, 3559496104UL, 1674050253UL, 1805619463UL, 455274178UL, 956939381UL, 1583197657UL, 141452045UL, 2383327493UL, 1520979444UL, 3287498300UL, 3486106126UL, 2724274090UL, 1783957650UL, 2212706740UL, 3610364652UL, 1939413704UL, 1145768764UL, 3628222572UL, 2719501850UL, 708259891UL, 2911760834UL, 3378423016UL, 1443723222UL, 2678486648UL, +1498209005UL, 3599911248UL, 258077235UL, 3071875976UL, 513762712UL, 3815218922UL, 4263328855UL, 91332032UL, 941306162UL, 3000922309UL, 3018835600UL, 1561559932UL, 2356658919UL, 24726067UL, 3626352172UL, 368313673UL, 257301433UL, 3097408183UL, 461428710UL, 2370224855UL, 3690066046UL, 3544357262UL, 907095008UL, 428073188UL, 2279237523UL, 2274317748UL, 4112109825UL, 346999411UL, 990247709UL, 896290404UL, 1584471638UL, 1466763688UL, +1906935236UL, 1592544037UL, 2387522308UL, 473837206UL, 3608227467UL, 1610069434UL, 1935303983UL, 4120978868UL, 391171548UL, 825197245UL, 3614258069UL, 174125899UL, 2940674123UL, 2095676907UL, 167881680UL, 4115219971UL, 3187664453UL, 456143482UL, 4246237180UL, 1971633162UL, 2144945539UL, 388172915UL, 4041481385UL, 3158677395UL, 223946687UL, 859388069UL, 177786360UL, 3094936989UL, 4017781965UL, 722598357UL, 783302897UL, 512784708UL, +4078350595UL, 2002159085UL, 3374931831UL, 1327513052UL, 4231642441UL, 2398594140UL, 2750176655UL, 2377078716UL, 3051451207UL, 2923556938UL, 392203913UL, 970480700UL, 1611278056UL, 1212903807UL, 85815670UL, 2398261756UL, 1052760308UL, 175807153UL, 2617028873UL, 1862087601UL, 1824020594UL, 3770624867UL, 141863380UL, 2090619424UL, 3994019338UL, 2363183556UL, 3095139522UL, 1792884692UL, 3026343485UL, 2320955816UL, 145789343UL, 214170401UL, +2926373126UL, 3858640613UL, 2188241463UL, 459887603UL, 2117474937UL, 2514234285UL, 1454156613UL, 1675396814UL, 4188979068UL, 1584843874UL, 3594779833UL, 563029256UL, 28681425UL, 446949770UL, 3498545218UL, 435874305UL, 3448653884UL, 863509898UL, 2247299904UL, 4211345429UL, 971855563UL, 1475394960UL, 3401692834UL, 167361776UL, 496249436UL, 1465278889UL, 780336162UL, 2108770597UL, 1806981510UL, 3677875653UL, 1890122303UL, 16399665UL, +2747394159UL, 2098019492UL, 1597583332UL, 1763649529UL, 1286079969UL, 1846278877UL, 1016796923UL, 959676917UL, 3091540766UL, 1626192266UL, 780987350UL, 1102963422UL, 2507002232UL, 691766944UL, 193328868UL, 981596600UL, 2384820612UL, 3149668778UL, 1691569420UL, 2852237957UL, 893819979UL, 2572584243UL, 216077070UL, 1267249886UL, 2572508880UL, 1706489454UL, 2391561733UL, 2608477467UL, 209783612UL, 765896849UL, 3617020328UL, 3488800100UL, +2237655981UL, 2095308189UL, 963275857UL, 3563488318UL, 1865487834UL, 480006810UL, 18562439UL, 1025913188UL, 3368592397UL, 374648713UL, 2421713724UL, 2705651398UL, 3098059650UL, 1109934605UL, 3085839620UL, 3184266772UL, 2359972463UL, 862934481UL, 3624479194UL, 3574284465UL, 2700143837UL, 2468083868UL, 3798800988UL, 4116964911UL, 1832002264UL, 4276154871UL, 3256889524UL, 4036954281UL, 697729046UL, 886223984UL, 2196986730UL, 1157617208UL, +1995907944UL, 398452318UL, 3523714364UL, 613570866UL, 2962430983UL, 1408814780UL, 892117129UL, 4173164219UL, 3894076479UL, 2721348430UL, 555734931UL, 1869034419UL, 336114876UL, 3142554871UL, 3349604636UL, 3450290892UL, 955122895UL, 2202902910UL, 2558366468UL, 1701182712UL, 283197682UL, 1865942385UL, 2027648778UL, 2285857699UL, 880475184UL, 958651279UL, 169534250UL, 3842420528UL, 1568559789UL, 2986618464UL, 2568345525UL, 3081082692UL, +}, +{ +575494427UL, 2773243709UL, 4009191487UL, 3877909663UL, 2252044261UL, 1328043370UL, 1407136778UL, 3204434425UL, 3881653592UL, 1481049819UL, 2939203697UL, 889352935UL, 628666312UL, 165199023UL, 2949092155UL, 1116804589UL, 998930334UL, 4144153491UL, 4191022348UL, 9022505UL, 4033326555UL, 2329569601UL, 824756145UL, 3501916851UL, 1481410328UL, 1970954319UL, 4022176157UL, 2356841052UL, 3783173734UL, 3649102345UL, 3205430658UL, 1460938436UL, +280282398UL, 3262135457UL, 4055383786UL, 28522973UL, 1100901182UL, 4048609665UL, 994490185UL, 2888527367UL, 3591919750UL, 65093467UL, 399797207UL, 3377740861UL, 3103183487UL, 3696509979UL, 866353724UL, 3847992271UL, 2821933890UL, 1491144079UL, 1702442928UL, 1271285504UL, 636444475UL, 2465430290UL, 2440306765UL, 2651443172UL, 2895101023UL, 43843628UL, 518479547UL, 3708355608UL, 2313400729UL, 3786408564UL, 2823763904UL, 3267560272UL, +524168411UL, 2580824843UL, 2687886610UL, 785942949UL, 2624395631UL, 3713348903UL, 4104123478UL, 2234056629UL, 2683158959UL, 1805382347UL, 1645702909UL, 382688861UL, 2843792951UL, 39122499UL, 2765954033UL, 3033237617UL, 784228054UL, 1680611136UL, 2306036746UL, 892707919UL, 3825738103UL, 1289362844UL, 3462989616UL, 484526950UL, 178560970UL, 1863413515UL, 71290794UL, 1716785670UL, 3881310302UL, 2826977504UL, 2312744076UL, 1000001815UL, +1580868938UL, 3808984884UL, 2521899773UL, 738699928UL, 2244576791UL, 1833964269UL, 1361345793UL, 2934763305UL, 2944705940UL, 2334116476UL, 674208214UL, 587191877UL, 271361277UL, 1639419136UL, 2742744205UL, 2556530506UL, 3764115510UL, 861410771UL, 3473658359UL, 2879790483UL, 1497452846UL, 1101855458UL, 2268199923UL, 1766359872UL, 480532790UL, 2926891626UL, 1366888524UL, 2262816900UL, 620045088UL, 2279182738UL, 2479688463UL, 427385986UL, +271096497UL, 1999040724UL, 1980388138UL, 3104550456UL, 2496325717UL, 2941450111UL, 1784373495UL, 4020221165UL, 2567325850UL, 2636190539UL, 2764516078UL, 2285887821UL, 2395930109UL, 1867061176UL, 665795763UL, 3869868300UL, 4033135159UL, 2589983679UL, 682593183UL, 1254600537UL, 1701095863UL, 3738080583UL, 369734429UL, 2231641462UL, 1866531599UL, 1317004965UL, 466053171UL, 2320346625UL, 485850108UL, 1279183025UL, 423884362UL, 1878291714UL, +228799661UL, 575494427UL, 2773243709UL, 4009191487UL, 3877909663UL, 1392246100UL, 1328043370UL, 1407136778UL, 3204434425UL, 3881653592UL, 303018213UL, 2939203697UL, 889352935UL, 628666312UL, 165199023UL, 691563049UL, 1116804589UL, 998930334UL, 4144153491UL, 4191022348UL, 2882458100UL, 4033326555UL, 2329569601UL, 824756145UL, 3501916851UL, 3512382126UL, 1970954319UL, 4022176157UL, 2356841052UL, 3783173734UL, 3277915742UL, 3205430658UL, +1460938436UL, 280282398UL, 3262135457UL, 416160861UL, 28522973UL, 1100901182UL, 4048609665UL, 994490185UL, 2206150488UL, 3591919750UL, 65093467UL, 399797207UL, 3377740861UL, 3954301001UL, 3696509979UL, 866353724UL, 3847992271UL, 2821933890UL, 482325742UL, 1702442928UL, 1271285504UL, 636444475UL, 2465430290UL, 476965483UL, 2651443172UL, 2895101023UL, 43843628UL, 518479547UL, 2354104222UL, 2313400729UL, 3786408564UL, 2823763904UL, +3267560272UL, 1682576095UL, 2580824843UL, 2687886610UL, 785942949UL, 2624395631UL, 3219885224UL, 4104123478UL, 2234056629UL, 2683158959UL, 1805382347UL, 4143809855UL, 382688861UL, 2843792951UL, 39122499UL, 2765954033UL, 2870716981UL, 784228054UL, 1680611136UL, 2306036746UL, 892707919UL, 2648492467UL, 1289362844UL, 3462989616UL, 484526950UL, 178560970UL, 3047404165UL, 71290794UL, 1716785670UL, 3881310302UL, 2826977504UL, 2439325884UL, +1000001815UL, 1580868938UL, 3808984884UL, 2521899773UL, 2222792732UL, 2244576791UL, 1833964269UL, 1361345793UL, 2934763305UL, 655108124UL, 2334116476UL, 674208214UL, 587191877UL, 271361277UL, 1403491312UL, 2742744205UL, 2556530506UL, 3764115510UL, 861410771UL, 2748819627UL, 2879790483UL, 1497452846UL, 1101855458UL, 2268199923UL, 2646753562UL, 480532790UL, 2926891626UL, 1366888524UL, 2262816900UL, 691077353UL, 2279182738UL, 2479688463UL, +427385986UL, 271096497UL, 357444234UL, 1980388138UL, 3104550456UL, 2496325717UL, 2941450111UL, 717953620UL, 4020221165UL, 2567325850UL, 2636190539UL, 2764516078UL, 588189150UL, 2395930109UL, 1867061176UL, 665795763UL, 3869868300UL, 2245339306UL, 2589983679UL, 682593183UL, 1254600537UL, 1701095863UL, 3193417815UL, 369734429UL, 2231641462UL, 1866531599UL, 1317004965UL, 1295326133UL, 2320346625UL, 485850108UL, 1279183025UL, 423884362UL, +1310342080UL, 228799661UL, 575494427UL, 2773243709UL, 4009191487UL, 3178129190UL, 1392246100UL, 1328043370UL, 1407136778UL, 3204434425UL, 558594993UL, 303018213UL, 2939203697UL, 889352935UL, 628666312UL, 3995857198UL, 691563049UL, 1116804589UL, 998930334UL, 4144153491UL, 2375099047UL, 2882458100UL, 4033326555UL, 2329569601UL, 824756145UL, 3031828205UL, 3512382126UL, 1970954319UL, 4022176157UL, 2356841052UL, 1599294097UL, 3277915742UL, +3205430658UL, 1460938436UL, 280282398UL, 2438973535UL, 416160861UL, 28522973UL, 1100901182UL, 4048609665UL, 2989609671UL, 2206150488UL, 3591919750UL, 65093467UL, 399797207UL, 183644195UL, 3954301001UL, 3696509979UL, 866353724UL, 3847992271UL, 1244421011UL, 482325742UL, 1702442928UL, 1271285504UL, 636444475UL, 3659422961UL, 476965483UL, 2651443172UL, 2895101023UL, 43843628UL, 2230230933UL, 2354104222UL, 2313400729UL, 3786408564UL, +2823763904UL, 4146329709UL, 1682576095UL, 2580824843UL, 2687886610UL, 785942949UL, 126345381UL, 3219885224UL, 4104123478UL, 2234056629UL, 2683158959UL, 1734650983UL, 4143809855UL, 382688861UL, 2843792951UL, 39122499UL, 3527484969UL, 2870716981UL, 784228054UL, 1680611136UL, 2306036746UL, 1606477743UL, 2648492467UL, 1289362844UL, 3462989616UL, 484526950UL, 3730796296UL, 3047404165UL, 71290794UL, 1716785670UL, 3881310302UL, 4233965062UL, +2439325884UL, 1000001815UL, 1580868938UL, 3808984884UL, 1228341642UL, 2222792732UL, 2244576791UL, 1833964269UL, 1361345793UL, 3313812192UL, 655108124UL, 2334116476UL, 674208214UL, 587191877UL, 1531247446UL, 1403491312UL, 2742744205UL, 2556530506UL, 3764115510UL, 2419989900UL, 2748819627UL, 2879790483UL, 1497452846UL, 1101855458UL, 1430402656UL, 2646753562UL, 480532790UL, 2926891626UL, 1366888524UL, 1848714433UL, 691077353UL, 2279182738UL, +2479688463UL, 427385986UL, 3906690631UL, 357444234UL, 1980388138UL, 3104550456UL, 2496325717UL, 2272350403UL, 717953620UL, 4020221165UL, 2567325850UL, 2636190539UL, 1950604113UL, 588189150UL, 2395930109UL, 1867061176UL, 665795763UL, 1735147895UL, 2245339306UL, 2589983679UL, 682593183UL, 1254600537UL, 1518037357UL, 3193417815UL, 369734429UL, 2231641462UL, 1866531599UL, 1751783137UL, 1295326133UL, 2320346625UL, 485850108UL, 1279183025UL, +149835864UL, 1310342080UL, 228799661UL, 575494427UL, 2773243709UL, 1505829825UL, 3178129190UL, 1392246100UL, 1328043370UL, 1407136778UL, 856233019UL, 558594993UL, 303018213UL, 2939203697UL, 889352935UL, 625515593UL, 3995857198UL, 691563049UL, 1116804589UL, 998930334UL, 3264640128UL, 2375099047UL, 2882458100UL, 4033326555UL, 2329569601UL, 1824812377UL, 3031828205UL, 3512382126UL, 1970954319UL, 4022176157UL, 3682468973UL, 1599294097UL, +3277915742UL, 3205430658UL, 1460938436UL, 2034940270UL, 2438973535UL, 416160861UL, 28522973UL, 1100901182UL, 3534874298UL, 2989609671UL, 2206150488UL, 3591919750UL, 65093467UL, 2231373121UL, 183644195UL, 3954301001UL, 3696509979UL, 866353724UL, 1479968372UL, 1244421011UL, 482325742UL, 1702442928UL, 1271285504UL, 3834022401UL, 3659422961UL, 476965483UL, 2651443172UL, 2895101023UL, 1042443120UL, 2230230933UL, 2354104222UL, 2313400729UL, +3786408564UL, 2940290545UL, 4146329709UL, 1682576095UL, 2580824843UL, 2687886610UL, 895602439UL, 126345381UL, 3219885224UL, 4104123478UL, 2234056629UL, 3633565082UL, 1734650983UL, 4143809855UL, 382688861UL, 2843792951UL, 3076342354UL, 3527484969UL, 2870716981UL, 784228054UL, 1680611136UL, 3667923304UL, 1606477743UL, 2648492467UL, 1289362844UL, 3462989616UL, 1338592032UL, 3730796296UL, 3047404165UL, 71290794UL, 1716785670UL, 995728648UL, +4233965062UL, 2439325884UL, 1000001815UL, 1580868938UL, 1245957136UL, 1228341642UL, 2222792732UL, 2244576791UL, 1833964269UL, 2899552190UL, 3313812192UL, 655108124UL, 2334116476UL, 674208214UL, 1154789946UL, 1531247446UL, 1403491312UL, 2742744205UL, 2556530506UL, 1668620496UL, 2419989900UL, 2748819627UL, 2879790483UL, 1497452846UL, 177853954UL, 1430402656UL, 2646753562UL, 480532790UL, 2926891626UL, 3179057526UL, 1848714433UL, 691077353UL, +2279182738UL, 2479688463UL, 1988854710UL, 3906690631UL, 357444234UL, 1980388138UL, 3104550456UL, 1772857305UL, 2272350403UL, 717953620UL, 4020221165UL, 2567325850UL, 3129906484UL, 1950604113UL, 588189150UL, 2395930109UL, 1867061176UL, 2248975336UL, 1735147895UL, 2245339306UL, 2589983679UL, 682593183UL, 3087155398UL, 1518037357UL, 3193417815UL, 369734429UL, 2231641462UL, 1858424931UL, 1751783137UL, 1295326133UL, 2320346625UL, 485850108UL, +2471611230UL, 107369761UL, 2623559579UL, 4256589070UL, 2365810185UL, 907910243UL, 3901832478UL, 2068079364UL, 2072842987UL, 401440347UL, 1707255913UL, 1450112231UL, 2618898012UL, 600446000UL, 788321632UL, 4119629235UL, 2648781584UL, 1927659116UL, 171372782UL, 1789511950UL, 2648296999UL, 3558619514UL, 1819608632UL, 1392007708UL, 2918513974UL, 2270003900UL, 784021820UL, 1379044539UL, 591935962UL, 1638390839UL, 10832053UL, 3946625290UL, +2916913801UL, 2718331169UL, 1595482738UL, 1294279402UL, 19889234UL, 1374364843UL, 571354125UL, 3357938719UL, 2337506269UL, 905453029UL, 2504232400UL, 258673393UL, 2590342355UL, 3308443353UL, 3359617898UL, 2686453711UL, 932545954UL, 509832408UL, 820508114UL, 431186194UL, 3434866166UL, 1108455121UL, 2802986572UL, 893446102UL, 3248197798UL, 1797985531UL, 3952804303UL, 558601278UL, 1813674114UL, 311050994UL, 425175161UL, 1125527204UL, +1597986581UL, 2282580210UL, 1659733126UL, 2080660004UL, 4121079137UL, 3373787661UL, 1902252724UL, 2669993847UL, 2450915273UL, 2155525933UL, 2139535914UL, 274595185UL, 1890506924UL, 2631794527UL, 1423530517UL, 4027031002UL, 1085427968UL, 2402514206UL, 3591455043UL, 2513094696UL, 2338347202UL, 1168222597UL, 3922339535UL, 3991725466UL, 2774598759UL, 3478721168UL, 3676766916UL, 179748891UL, 2911159372UL, 191101265UL, 3389843262UL, 3093358663UL, +2333576084UL, 1056514165UL, 2987497874UL, 2502331872UL, 2027710028UL, 2338525812UL, 3904906078UL, 806669884UL, 596300960UL, 1993055778UL, 1541809402UL, 3578865742UL, 652348267UL, 3332532764UL, 2656602623UL, 2037214047UL, 323260312UL, 3310408133UL, 4037617529UL, 137297627UL, 1236501991UL, 495817051UL, 481150309UL, 3067841968UL, 3120347176UL, 714354848UL, 1554632062UL, 2522324107UL, 4274051212UL, 2180914534UL, 1261686356UL, 3569290041UL, +1801431819UL, 4286755560UL, 2749452442UL, 829235089UL, 2243153325UL, 2525168177UL, 1486881882UL, 585653228UL, 3288336688UL, 2734161045UL, 30430534UL, 714492313UL, 2582732426UL, 595577790UL, 1463554287UL, 1949506865UL, 4210942156UL, 2008105540UL, 4055753132UL, 2530320603UL, 319064177UL, 2305067982UL, 3825716413UL, 1543867515UL, 108979478UL, 3089716545UL, 2921391708UL, 2403595525UL, 3783697766UL, 2313991047UL, 3302598706UL, 1318323763UL, +}, +{ +1470380360UL, 3057428612UL, 2756676297UL, 1633786556UL, 4246459918UL, 2557524017UL, 1857180133UL, 618903690UL, 2475611092UL, 2621430634UL, 2084292404UL, 1698607774UL, 1788956972UL, 3375072220UL, 1499167056UL, 1218814632UL, 3699503479UL, 588281768UL, 3603925285UL, 1187721841UL, 1307962320UL, 2562217840UL, 3882506958UL, 2387033730UL, 2097027049UL, 1593669125UL, 1899433035UL, 4039983902UL, 1546854551UL, 1073191673UL, 3368453769UL, 3074694838UL, +534637095UL, 1860006723UL, 3416402670UL, 802354899UL, 3998709605UL, 3944315555UL, 3454226397UL, 1648185195UL, 488532673UL, 3063734121UL, 1318974867UL, 187087202UL, 200160693UL, 4170479404UL, 782764886UL, 4007973657UL, 1651636372UL, 3084151528UL, 2085263921UL, 2424937940UL, 230704223UL, 3342587983UL, 1093085714UL, 683877298UL, 3635026316UL, 3839461209UL, 2977567556UL, 3947448199UL, 3767172681UL, 1350679624UL, 3541409523UL, 3975162472UL, +2459379316UL, 3287828387UL, 1565768431UL, 3149625429UL, 1328627497UL, 2156355750UL, 112739894UL, 4052025045UL, 1396839113UL, 212349044UL, 110706825UL, 2185320852UL, 2540909191UL, 2129623107UL, 3515174750UL, 2669147508UL, 1243549180UL, 3996575850UL, 149304348UL, 2755670869UL, 930137412UL, 350687475UL, 1512442864UL, 3764389325UL, 3489308665UL, 276147411UL, 2268414314UL, 30674096UL, 3202650841UL, 3446821592UL, 3341145621UL, 3749209259UL, +674361204UL, 1384681012UL, 2716655878UL, 454169262UL, 289282175UL, 966029495UL, 3052791893UL, 3111969089UL, 1151599976UL, 3620936019UL, 1877909034UL, 1953262994UL, 4240669039UL, 1857402256UL, 3337397349UL, 2392730459UL, 1158928694UL, 1757447952UL, 2682284750UL, 2796982914UL, 1203210173UL, 797579212UL, 1645601877UL, 3579805998UL, 797556690UL, 4106236617UL, 1379943929UL, 129105346UL, 3950170317UL, 723231430UL, 88997404UL, 2591283275UL, +359831168UL, 306903531UL, 1987846974UL, 2654779951UL, 3724360049UL, 1693615498UL, 1095306415UL, 3586751806UL, 2045807380UL, 2779363615UL, 2912940562UL, 1557518560UL, 3620536996UL, 1723152132UL, 4087191232UL, 1042907094UL, 3210303305UL, 1536493323UL, 4094765090UL, 575328723UL, 359319532UL, 2458971265UL, 3159207510UL, 387883436UL, 2521400838UL, 2359639886UL, 261289463UL, 2094643916UL, 2269112547UL, 2387198764UL, 3619233779UL, 3019052785UL, +2910774311UL, 1470380360UL, 3057428612UL, 2756676297UL, 1633786556UL, 386502519UL, 2557524017UL, 1857180133UL, 618903690UL, 2475611092UL, 30080431UL, 2084292404UL, 1698607774UL, 1788956972UL, 3375072220UL, 1158684464UL, 1218814632UL, 3699503479UL, 588281768UL, 3603925285UL, 238328161UL, 1307962320UL, 2562217840UL, 3882506958UL, 2387033730UL, 3010587639UL, 1593669125UL, 1899433035UL, 4039983902UL, 1546854551UL, 4192218972UL, 3368453769UL, +3074694838UL, 534637095UL, 1860006723UL, 652336168UL, 802354899UL, 3998709605UL, 3944315555UL, 3454226397UL, 1926499185UL, 488532673UL, 3063734121UL, 1318974867UL, 187087202UL, 1106075322UL, 4170479404UL, 782764886UL, 4007973657UL, 1651636372UL, 2404132022UL, 2085263921UL, 2424937940UL, 230704223UL, 3342587983UL, 918664020UL, 683877298UL, 3635026316UL, 3839461209UL, 2977567556UL, 1943458501UL, 3767172681UL, 1350679624UL, 3541409523UL, +3975162472UL, 276593262UL, 3287828387UL, 1565768431UL, 3149625429UL, 1328627497UL, 1428675465UL, 112739894UL, 4052025045UL, 1396839113UL, 212349044UL, 4056830215UL, 2185320852UL, 2540909191UL, 2129623107UL, 3515174750UL, 1542171596UL, 1243549180UL, 3996575850UL, 149304348UL, 2755670869UL, 3578672658UL, 350687475UL, 1512442864UL, 3764389325UL, 3489308665UL, 1546094236UL, 2268414314UL, 30674096UL, 3202650841UL, 3446821592UL, 2954172575UL, +3749209259UL, 674361204UL, 1384681012UL, 2716655878UL, 3784818668UL, 289282175UL, 966029495UL, 3052791893UL, 3111969089UL, 4157356036UL, 3620936019UL, 1877909034UL, 1953262994UL, 4240669039UL, 558548232UL, 3337397349UL, 2392730459UL, 1158928694UL, 1757447952UL, 2764253876UL, 2796982914UL, 1203210173UL, 797579212UL, 1645601877UL, 1754284241UL, 797556690UL, 4106236617UL, 1379943929UL, 129105346UL, 1072954804UL, 723231430UL, 88997404UL, +2591283275UL, 359831168UL, 3790749526UL, 1987846974UL, 2654779951UL, 3724360049UL, 1693615498UL, 529478744UL, 3586751806UL, 2045807380UL, 2779363615UL, 2912940562UL, 3883779003UL, 3620536996UL, 1723152132UL, 4087191232UL, 1042907094UL, 2510614710UL, 1536493323UL, 4094765090UL, 575328723UL, 359319532UL, 4185709932UL, 3159207510UL, 387883436UL, 2521400838UL, 2359639886UL, 143795416UL, 2094643916UL, 2269112547UL, 2387198764UL, 3619233779UL, +2856133500UL, 2910774311UL, 1470380360UL, 3057428612UL, 2756676297UL, 1184346658UL, 386502519UL, 2557524017UL, 1857180133UL, 618903690UL, 113530176UL, 30080431UL, 2084292404UL, 1698607774UL, 1788956972UL, 1446640841UL, 1158684464UL, 1218814632UL, 3699503479UL, 588281768UL, 145530757UL, 238328161UL, 1307962320UL, 2562217840UL, 3882506958UL, 2145494995UL, 3010587639UL, 1593669125UL, 1899433035UL, 4039983902UL, 1668183055UL, 4192218972UL, +3368453769UL, 3074694838UL, 534637095UL, 1759744354UL, 652336168UL, 802354899UL, 3998709605UL, 3944315555UL, 3058692249UL, 1926499185UL, 488532673UL, 3063734121UL, 1318974867UL, 728549366UL, 1106075322UL, 4170479404UL, 782764886UL, 4007973657UL, 3270440405UL, 2404132022UL, 2085263921UL, 2424937940UL, 230704223UL, 3329510499UL, 918664020UL, 683877298UL, 3635026316UL, 3839461209UL, 79335966UL, 1943458501UL, 3767172681UL, 1350679624UL, +3541409523UL, 925084463UL, 276593262UL, 3287828387UL, 1565768431UL, 3149625429UL, 3775346659UL, 1428675465UL, 112739894UL, 4052025045UL, 1396839113UL, 865124022UL, 4056830215UL, 2185320852UL, 2540909191UL, 2129623107UL, 408329043UL, 1542171596UL, 1243549180UL, 3996575850UL, 149304348UL, 3549625626UL, 3578672658UL, 350687475UL, 1512442864UL, 3764389325UL, 2745315161UL, 1546094236UL, 2268414314UL, 30674096UL, 3202650841UL, 1591955495UL, +2954172575UL, 3749209259UL, 674361204UL, 1384681012UL, 4064148122UL, 3784818668UL, 289282175UL, 966029495UL, 3052791893UL, 1370867977UL, 4157356036UL, 3620936019UL, 1877909034UL, 1953262994UL, 4021792514UL, 558548232UL, 3337397349UL, 2392730459UL, 1158928694UL, 3155295174UL, 2764253876UL, 2796982914UL, 1203210173UL, 797579212UL, 3928348491UL, 1754284241UL, 797556690UL, 4106236617UL, 1379943929UL, 535801204UL, 1072954804UL, 723231430UL, +88997404UL, 2591283275UL, 3834650337UL, 3790749526UL, 1987846974UL, 2654779951UL, 3724360049UL, 1042046499UL, 529478744UL, 3586751806UL, 2045807380UL, 2779363615UL, 1125934487UL, 3883779003UL, 3620536996UL, 1723152132UL, 4087191232UL, 234512721UL, 2510614710UL, 1536493323UL, 4094765090UL, 575328723UL, 3997395999UL, 4185709932UL, 3159207510UL, 387883436UL, 2521400838UL, 3125399953UL, 143795416UL, 2094643916UL, 2269112547UL, 2387198764UL, +652167990UL, 2856133500UL, 2910774311UL, 1470380360UL, 3057428612UL, 2132157457UL, 1184346658UL, 386502519UL, 2557524017UL, 1857180133UL, 4131611047UL, 113530176UL, 30080431UL, 2084292404UL, 1698607774UL, 391246724UL, 1446640841UL, 1158684464UL, 1218814632UL, 3699503479UL, 2411874184UL, 145530757UL, 238328161UL, 1307962320UL, 2562217840UL, 2812151676UL, 2145494995UL, 3010587639UL, 1593669125UL, 1899433035UL, 2422208371UL, 1668183055UL, +4192218972UL, 3368453769UL, 3074694838UL, 2148785858UL, 1759744354UL, 652336168UL, 802354899UL, 3998709605UL, 1781938823UL, 3058692249UL, 1926499185UL, 488532673UL, 3063734121UL, 3539633540UL, 728549366UL, 1106075322UL, 4170479404UL, 782764886UL, 2780824417UL, 3270440405UL, 2404132022UL, 2085263921UL, 2424937940UL, 1908513596UL, 3329510499UL, 918664020UL, 683877298UL, 3635026316UL, 2918953355UL, 79335966UL, 1943458501UL, 3767172681UL, +1350679624UL, 341369607UL, 925084463UL, 276593262UL, 3287828387UL, 1565768431UL, 1957429498UL, 3775346659UL, 1428675465UL, 112739894UL, 4052025045UL, 1847440090UL, 865124022UL, 4056830215UL, 2185320852UL, 2540909191UL, 3477402775UL, 408329043UL, 1542171596UL, 1243549180UL, 3996575850UL, 179432054UL, 3549625626UL, 3578672658UL, 350687475UL, 1512442864UL, 2118138924UL, 2745315161UL, 1546094236UL, 2268414314UL, 30674096UL, 2317064191UL, +1591955495UL, 2954172575UL, 3749209259UL, 674361204UL, 3286542168UL, 4064148122UL, 3784818668UL, 289282175UL, 966029495UL, 1327408800UL, 1370867977UL, 4157356036UL, 3620936019UL, 1877909034UL, 405707683UL, 4021792514UL, 558548232UL, 3337397349UL, 2392730459UL, 3244675609UL, 3155295174UL, 2764253876UL, 2796982914UL, 1203210173UL, 2274948223UL, 3928348491UL, 1754284241UL, 797556690UL, 4106236617UL, 2665938417UL, 535801204UL, 1072954804UL, +723231430UL, 88997404UL, 3006584290UL, 3834650337UL, 3790749526UL, 1987846974UL, 2654779951UL, 4271242910UL, 1042046499UL, 529478744UL, 3586751806UL, 2045807380UL, 2283867237UL, 1125934487UL, 3883779003UL, 3620536996UL, 1723152132UL, 1761178713UL, 234512721UL, 2510614710UL, 1536493323UL, 4094765090UL, 2361030279UL, 3997395999UL, 4185709932UL, 3159207510UL, 387883436UL, 3979684113UL, 3125399953UL, 143795416UL, 2094643916UL, 2269112547UL, +1499026790UL, 2673871071UL, 3817604600UL, 2996498142UL, 1211396713UL, 4016438754UL, 992969238UL, 2196610884UL, 1333868752UL, 2722471337UL, 2178395143UL, 533478044UL, 291720336UL, 3552502714UL, 1060260388UL, 1389737501UL, 3508724089UL, 3106493936UL, 2013154532UL, 3169850047UL, 3773175439UL, 3604033115UL, 4234678017UL, 2903156223UL, 3832188501UL, 2874956773UL, 4283805552UL, 3664062691UL, 1974738248UL, 925764827UL, 1750660924UL, 141239116UL, +3273085573UL, 2427940522UL, 1962727892UL, 2493949152UL, 1043482688UL, 2345076260UL, 2209086707UL, 3642865193UL, 3119873884UL, 571850463UL, 1599484831UL, 76923002UL, 3077572436UL, 4086821865UL, 1523654720UL, 480304732UL, 476538774UL, 2169116383UL, 4033618691UL, 2819753414UL, 2856326003UL, 747450871UL, 1851448547UL, 713503330UL, 3709263622UL, 781002495UL, 1968749577UL, 2933719965UL, 4057398020UL, 3406593497UL, 689436820UL, 2935729647UL, +2030357428UL, 2075940397UL, 1830631914UL, 1093330800UL, 1706624613UL, 1805612947UL, 4257097124UL, 3233604448UL, 159450674UL, 1050507045UL, 566046625UL, 2253420120UL, 904902042UL, 1830037922UL, 4081490982UL, 1427186514UL, 2535536470UL, 3869316947UL, 4097476542UL, 930420754UL, 2519255367UL, 49908928UL, 454325685UL, 888118139UL, 3453892181UL, 1263601461UL, 1236190782UL, 674943665UL, 1648077470UL, 429399730UL, 2904879506UL, 3718410520UL, +1802183310UL, 1872553091UL, 605480672UL, 774749173UL, 3200570514UL, 181210046UL, 2560898144UL, 3947027625UL, 1535243167UL, 324801283UL, 4234744788UL, 746560316UL, 2456297875UL, 3925756080UL, 533997731UL, 3919796086UL, 662975152UL, 864661066UL, 1070894403UL, 1020445801UL, 1511298602UL, 4221508348UL, 3577952702UL, 4122306502UL, 2012051572UL, 1616168260UL, 2456901413UL, 2717726537UL, 840264605UL, 2687215223UL, 2174960097UL, 1239122603UL, +2890231920UL, 3365350767UL, 3998868598UL, 563137220UL, 893868530UL, 3400632172UL, 1538627830UL, 2812510298UL, 496662288UL, 2317289974UL, 2252393722UL, 1221289032UL, 2418100559UL, 402670890UL, 1528570045UL, 3160531718UL, 1806492066UL, 3211663975UL, 3617025598UL, 3664580463UL, 1338638297UL, 341637330UL, 2097019728UL, 4031221207UL, 503636424UL, 3883416740UL, 1530237682UL, 1152125396UL, 2845384901UL, 332460372UL, 457364876UL, 1738239808UL, +}, +{ +1118787884UL, 1884590246UL, 1007052798UL, 3717680750UL, 1609263052UL, 2486654530UL, 2761168910UL, 163554565UL, 3928803020UL, 2632714628UL, 1386788970UL, 2621928183UL, 2855206157UL, 2989018213UL, 1836814260UL, 4197635108UL, 1030118238UL, 2789863793UL, 2063944689UL, 1647608366UL, 255485979UL, 3657534664UL, 1317185871UL, 2410074449UL, 3971156607UL, 907575923UL, 4132859581UL, 416269582UL, 877554291UL, 633895348UL, 2236014545UL, 992386759UL, +3971362318UL, 2173597771UL, 1673339632UL, 1371742490UL, 2033574313UL, 3809530180UL, 319182848UL, 1562235776UL, 463522324UL, 1482338913UL, 1816432405UL, 3278626272UL, 1335179249UL, 171265751UL, 2249118654UL, 1153849045UL, 3013179633UL, 1450352108UL, 1267908572UL, 1138658121UL, 623675874UL, 3608469129UL, 978093004UL, 1283228910UL, 1810859539UL, 1179125634UL, 2939039286UL, 3862213960UL, 1168357273UL, 376788629UL, 314507445UL, 219039712UL, +463080619UL, 2994990779UL, 1035692306UL, 2228303916UL, 1280244913UL, 1965417315UL, 1815095408UL, 939691799UL, 3080056566UL, 3741305118UL, 1495905100UL, 65327713UL, 3884301346UL, 2536445014UL, 1503280354UL, 3398924419UL, 3678532805UL, 2616964783UL, 3168581019UL, 3553322118UL, 3023259169UL, 480342712UL, 451634742UL, 3562778450UL, 1943708078UL, 660077747UL, 434714388UL, 2369278293UL, 2894425895UL, 1919542250UL, 2469130567UL, 551196237UL, +4193980239UL, 2952382875UL, 3311173667UL, 2856797012UL, 2845888917UL, 1669184098UL, 3928626091UL, 2491577076UL, 3719464032UL, 2151963814UL, 3474431449UL, 3971510537UL, 3695841119UL, 2215238146UL, 3668152847UL, 1974578319UL, 2328185090UL, 2096356935UL, 3973692455UL, 3954842437UL, 422675402UL, 477894725UL, 3398641827UL, 1366451030UL, 1354642198UL, 3029840461UL, 35700837UL, 2937170986UL, 1336296570UL, 3508313874UL, 587724229UL, 2051237478UL, +3539754304UL, 1946154432UL, 2463932452UL, 144772179UL, 353408424UL, 3493806256UL, 3782958493UL, 1957797444UL, 228084488UL, 192277278UL, 3612092522UL, 2235069734UL, 467407503UL, 3391861572UL, 847810786UL, 1838763654UL, 2272109211UL, 3018265496UL, 4249218445UL, 1722760791UL, 3484353162UL, 3906437663UL, 4208966227UL, 2352549740UL, 714311566UL, 1346246305UL, 2865157059UL, 2989587005UL, 3946819548UL, 3109244860UL, 3885124598UL, 3314346978UL, +952826829UL, 1118787884UL, 1884590246UL, 1007052798UL, 3717680750UL, 1521451317UL, 2486654530UL, 2761168910UL, 163554565UL, 3928803020UL, 2299046195UL, 1386788970UL, 2621928183UL, 2855206157UL, 2989018213UL, 3048269905UL, 4197635108UL, 1030118238UL, 2789863793UL, 2063944689UL, 1814057352UL, 255485979UL, 3657534664UL, 1317185871UL, 2410074449UL, 4041610788UL, 907575923UL, 4132859581UL, 416269582UL, 877554291UL, 2338964683UL, 2236014545UL, +992386759UL, 3971362318UL, 2173597771UL, 579340117UL, 1371742490UL, 2033574313UL, 3809530180UL, 319182848UL, 3090313228UL, 463522324UL, 1482338913UL, 1816432405UL, 3278626272UL, 2418220643UL, 171265751UL, 2249118654UL, 1153849045UL, 3013179633UL, 2738647190UL, 1267908572UL, 1138658121UL, 623675874UL, 3608469129UL, 3096087202UL, 1283228910UL, 1810859539UL, 1179125634UL, 2939039286UL, 2601862091UL, 1168357273UL, 376788629UL, 314507445UL, +219039712UL, 1174181426UL, 2994990779UL, 1035692306UL, 2228303916UL, 1280244913UL, 752017703UL, 1815095408UL, 939691799UL, 3080056566UL, 3741305118UL, 126135654UL, 65327713UL, 3884301346UL, 2536445014UL, 1503280354UL, 955981361UL, 3678532805UL, 2616964783UL, 3168581019UL, 3553322118UL, 3772187171UL, 480342712UL, 451634742UL, 3562778450UL, 1943708078UL, 1466950454UL, 434714388UL, 2369278293UL, 2894425895UL, 1919542250UL, 317862862UL, +551196237UL, 4193980239UL, 2952382875UL, 3311173667UL, 12728591UL, 2845888917UL, 1669184098UL, 3928626091UL, 2491577076UL, 2742989641UL, 2151963814UL, 3474431449UL, 3971510537UL, 3695841119UL, 1005662613UL, 3668152847UL, 1974578319UL, 2328185090UL, 2096356935UL, 3629684995UL, 3954842437UL, 422675402UL, 477894725UL, 3398641827UL, 209352768UL, 1354642198UL, 3029840461UL, 35700837UL, 2937170986UL, 1660777984UL, 3508313874UL, 587724229UL, +2051237478UL, 3539754304UL, 3631430985UL, 2463932452UL, 144772179UL, 353408424UL, 3493806256UL, 3616422021UL, 1957797444UL, 228084488UL, 192277278UL, 3612092522UL, 3638977910UL, 467407503UL, 3391861572UL, 847810786UL, 1838763654UL, 2427237699UL, 3018265496UL, 4249218445UL, 1722760791UL, 3484353162UL, 2322365400UL, 4208966227UL, 2352549740UL, 714311566UL, 1346246305UL, 954101391UL, 2989587005UL, 3946819548UL, 3109244860UL, 3885124598UL, +420941376UL, 952826829UL, 1118787884UL, 1884590246UL, 1007052798UL, 539759724UL, 1521451317UL, 2486654530UL, 2761168910UL, 163554565UL, 1954997983UL, 2299046195UL, 1386788970UL, 2621928183UL, 2855206157UL, 3104695189UL, 3048269905UL, 4197635108UL, 1030118238UL, 2789863793UL, 3556473570UL, 1814057352UL, 255485979UL, 3657534664UL, 1317185871UL, 3004205219UL, 4041610788UL, 907575923UL, 4132859581UL, 416269582UL, 2980178044UL, 2338964683UL, +2236014545UL, 992386759UL, 3971362318UL, 2573125018UL, 579340117UL, 1371742490UL, 2033574313UL, 3809530180UL, 766585731UL, 3090313228UL, 463522324UL, 1482338913UL, 1816432405UL, 3101578277UL, 2418220643UL, 171265751UL, 2249118654UL, 1153849045UL, 2143267892UL, 2738647190UL, 1267908572UL, 1138658121UL, 623675874UL, 2944231951UL, 3096087202UL, 1283228910UL, 1810859539UL, 1179125634UL, 374714364UL, 2601862091UL, 1168357273UL, 376788629UL, +314507445UL, 1710922505UL, 1174181426UL, 2994990779UL, 1035692306UL, 2228303916UL, 3222680885UL, 752017703UL, 1815095408UL, 939691799UL, 3080056566UL, 1985366287UL, 126135654UL, 65327713UL, 3884301346UL, 2536445014UL, 3002467868UL, 955981361UL, 3678532805UL, 2616964783UL, 3168581019UL, 2173417616UL, 3772187171UL, 480342712UL, 451634742UL, 3562778450UL, 236095606UL, 1466950454UL, 434714388UL, 2369278293UL, 2894425895UL, 1766257461UL, +317862862UL, 551196237UL, 4193980239UL, 2952382875UL, 2416349742UL, 12728591UL, 2845888917UL, 1669184098UL, 3928626091UL, 2346338391UL, 2742989641UL, 2151963814UL, 3474431449UL, 3971510537UL, 942354812UL, 1005662613UL, 3668152847UL, 1974578319UL, 2328185090UL, 3234982376UL, 3629684995UL, 3954842437UL, 422675402UL, 477894725UL, 2931444539UL, 209352768UL, 1354642198UL, 3029840461UL, 35700837UL, 3388567298UL, 1660777984UL, 3508313874UL, +587724229UL, 2051237478UL, 1770178720UL, 3631430985UL, 2463932452UL, 144772179UL, 353408424UL, 3783114255UL, 3616422021UL, 1957797444UL, 228084488UL, 192277278UL, 611095909UL, 3638977910UL, 467407503UL, 3391861572UL, 847810786UL, 1413548572UL, 2427237699UL, 3018265496UL, 4249218445UL, 1722760791UL, 1487262638UL, 2322365400UL, 4208966227UL, 2352549740UL, 714311566UL, 1378213368UL, 954101391UL, 2989587005UL, 3946819548UL, 3109244860UL, +4183748384UL, 420941376UL, 952826829UL, 1118787884UL, 1884590246UL, 2199811809UL, 539759724UL, 1521451317UL, 2486654530UL, 2761168910UL, 1100080647UL, 1954997983UL, 2299046195UL, 1386788970UL, 2621928183UL, 916352763UL, 3104695189UL, 3048269905UL, 4197635108UL, 1030118238UL, 369866139UL, 3556473570UL, 1814057352UL, 255485979UL, 3657534664UL, 2916985473UL, 3004205219UL, 4041610788UL, 907575923UL, 4132859581UL, 3856599532UL, 2980178044UL, +2338964683UL, 2236014545UL, 992386759UL, 3393662326UL, 2573125018UL, 579340117UL, 1371742490UL, 2033574313UL, 1938766053UL, 766585731UL, 3090313228UL, 463522324UL, 1482338913UL, 2122086302UL, 3101578277UL, 2418220643UL, 171265751UL, 2249118654UL, 952602228UL, 2143267892UL, 2738647190UL, 1267908572UL, 1138658121UL, 1808026803UL, 2944231951UL, 3096087202UL, 1283228910UL, 1810859539UL, 3881666794UL, 374714364UL, 2601862091UL, 1168357273UL, +376788629UL, 728738466UL, 1710922505UL, 1174181426UL, 2994990779UL, 1035692306UL, 74930675UL, 3222680885UL, 752017703UL, 1815095408UL, 939691799UL, 3404352271UL, 1985366287UL, 126135654UL, 65327713UL, 3884301346UL, 1822629733UL, 3002467868UL, 955981361UL, 3678532805UL, 2616964783UL, 3865359567UL, 2173417616UL, 3772187171UL, 480342712UL, 451634742UL, 1099609112UL, 236095606UL, 1466950454UL, 434714388UL, 2369278293UL, 2671873359UL, +1766257461UL, 317862862UL, 551196237UL, 4193980239UL, 2006763654UL, 2416349742UL, 12728591UL, 2845888917UL, 1669184098UL, 2492983893UL, 2346338391UL, 2742989641UL, 2151963814UL, 3474431449UL, 2095232649UL, 942354812UL, 1005662613UL, 3668152847UL, 1974578319UL, 1748794756UL, 3234982376UL, 3629684995UL, 3954842437UL, 422675402UL, 2291986911UL, 2931444539UL, 209352768UL, 1354642198UL, 3029840461UL, 3772709822UL, 3388567298UL, 1660777984UL, +3508313874UL, 587724229UL, 2759789003UL, 1770178720UL, 3631430985UL, 2463932452UL, 144772179UL, 1572181309UL, 3783114255UL, 3616422021UL, 1957797444UL, 228084488UL, 4106643586UL, 611095909UL, 3638977910UL, 467407503UL, 3391861572UL, 927151111UL, 1413548572UL, 2427237699UL, 3018265496UL, 4249218445UL, 692575565UL, 1487262638UL, 2322365400UL, 4208966227UL, 2352549740UL, 1281886506UL, 1378213368UL, 954101391UL, 2989587005UL, 3946819548UL, +1861811740UL, 1484768905UL, 359662140UL, 4058479705UL, 1306547382UL, 514617018UL, 1685692791UL, 3370601554UL, 2920029077UL, 447798803UL, 3124262580UL, 1841693810UL, 583764638UL, 853545489UL, 2614348705UL, 1445696741UL, 4226719361UL, 1299450005UL, 7404137UL, 3158806368UL, 3487160245UL, 1410910965UL, 3697116584UL, 4272452035UL, 832215403UL, 4190877996UL, 2360539465UL, 1011144434UL, 546018244UL, 613443074UL, 2523894977UL, 998991923UL, +2569220540UL, 4221264346UL, 2627827148UL, 2606458015UL, 261584257UL, 4172552877UL, 1174774061UL, 1040006970UL, 2378868955UL, 1539192255UL, 1322624483UL, 3221782707UL, 3352886416UL, 3634686692UL, 65447704UL, 3962131218UL, 839088053UL, 4154193716UL, 1211888926UL, 319402483UL, 3922826413UL, 3799829447UL, 623726612UL, 1586183272UL, 1853729462UL, 2621029589UL, 708558605UL, 1618007233UL, 2784732545UL, 953859039UL, 921654620UL, 477148727UL, +3592256598UL, 2772318818UL, 1460772911UL, 1309227716UL, 3484274262UL, 3425161241UL, 1677052569UL, 2238155114UL, 2828087292UL, 2361598991UL, 4283732706UL, 1530059373UL, 1564048492UL, 243829114UL, 104328994UL, 3080249237UL, 2054985396UL, 408961407UL, 2978652320UL, 2412674552UL, 3794618070UL, 3644862703UL, 2095186402UL, 3294126752UL, 2970218740UL, 1800713612UL, 3806665216UL, 3990918051UL, 142666452UL, 531078813UL, 1079142774UL, 3437358350UL, +635943961UL, 255576894UL, 2991317718UL, 1208676456UL, 247449774UL, 454879171UL, 113230697UL, 3064123371UL, 336269028UL, 1137083842UL, 959568850UL, 2508623991UL, 3338418112UL, 2660268938UL, 1318010299UL, 3950178561UL, 1078499199UL, 1176289535UL, 3875152821UL, 1984420952UL, 1134199826UL, 2944539174UL, 3667625203UL, 2034152216UL, 1648355307UL, 2376447620UL, 2967418253UL, 185143450UL, 889002925UL, 3999315013UL, 661455858UL, 4026799358UL, +3626504428UL, 3544795311UL, 3642718771UL, 2467387138UL, 1034249749UL, 2051371333UL, 4251353248UL, 1575036366UL, 751400924UL, 2906720214UL, 1210002606UL, 916508568UL, 1728487600UL, 2478884914UL, 3081526615UL, 1867135009UL, 1955998382UL, 701713417UL, 512784398UL, 1255240210UL, 3665676113UL, 1771754697UL, 4000392442UL, 3342268855UL, 2677221913UL, 369054145UL, 4011912082UL, 748537647UL, 1626721797UL, 852497405UL, 168721778UL, 3091138383UL, +}, +{ +3781228998UL, 1787582256UL, 838267218UL, 2710632450UL, 690892139UL, 2484870604UL, 4151302318UL, 1844787776UL, 727768263UL, 1075391038UL, 1842903369UL, 2927332301UL, 3246688068UL, 1234715005UL, 2906526190UL, 3369636401UL, 3091858538UL, 3320767682UL, 920496809UL, 1406803705UL, 3163880457UL, 1540551653UL, 2733620168UL, 2588558057UL, 147277542UL, 803170440UL, 821275940UL, 3897549272UL, 151390608UL, 951639139UL, 904639695UL, 1106545578UL, +1514893712UL, 998760135UL, 2557458623UL, 4109877399UL, 578824730UL, 2174064027UL, 3352513900UL, 3206168298UL, 911932439UL, 2030004973UL, 3283902592UL, 3755877921UL, 250434692UL, 352122318UL, 977153640UL, 642640734UL, 2555395772UL, 2307695537UL, 2593565626UL, 3738143618UL, 734614254UL, 3276420511UL, 2636087597UL, 4157371578UL, 1082026387UL, 429736987UL, 3755125580UL, 1935957937UL, 3300547146UL, 3089498232UL, 4167244256UL, 1619189426UL, +1094447351UL, 1061842570UL, 3666470174UL, 810916769UL, 2263633079UL, 3863543843UL, 1804937521UL, 2774236887UL, 2858593613UL, 961498236UL, 1515309045UL, 1564424234UL, 2276602447UL, 2540994858UL, 78621171UL, 3575132456UL, 2958793283UL, 387554009UL, 688827573UL, 3833764146UL, 2611524056UL, 2296780370UL, 2411775612UL, 3790615886UL, 3399757437UL, 1385198595UL, 1005364336UL, 2093159919UL, 2091827252UL, 1461775197UL, 4225171212UL, 1185831033UL, +12264437UL, 1313835999UL, 556653278UL, 917105970UL, 1471530347UL, 2010243509UL, 3097827138UL, 1399987735UL, 273352191UL, 2505795417UL, 1336824946UL, 3358720963UL, 2874295267UL, 2282349617UL, 3478581038UL, 4027859424UL, 713597958UL, 4059691816UL, 2812811116UL, 2291324146UL, 932688463UL, 3001334051UL, 2028368589UL, 830582457UL, 3964293916UL, 4276849132UL, 1828058403UL, 1351688755UL, 2113265048UL, 42517349UL, 3100438883UL, 1137792178UL, +1479076106UL, 463377892UL, 3964913740UL, 2422362185UL, 436113863UL, 2044139049UL, 4197323265UL, 3275185975UL, 2655265571UL, 1674107588UL, 1496360114UL, 3642050139UL, 1739051417UL, 2393774399UL, 250035802UL, 10186306UL, 263338568UL, 3899157617UL, 3679157076UL, 2258085991UL, 1407319575UL, 899008067UL, 3679828833UL, 711086272UL, 2952963707UL, 3373894808UL, 445540851UL, 3405637490UL, 1343291195UL, 730888681UL, 507768703UL, 3473963321UL, +1779803564UL, 3781228998UL, 1787582256UL, 838267218UL, 2710632450UL, 2431224659UL, 2484870604UL, 4151302318UL, 1844787776UL, 727768263UL, 4012573268UL, 1842903369UL, 2927332301UL, 3246688068UL, 1234715005UL, 3405161215UL, 3369636401UL, 3091858538UL, 3320767682UL, 920496809UL, 400609988UL, 3163880457UL, 1540551653UL, 2733620168UL, 2588558057UL, 2137935937UL, 803170440UL, 821275940UL, 3897549272UL, 151390608UL, 194431797UL, 904639695UL, +1106545578UL, 1514893712UL, 998760135UL, 62528087UL, 4109877399UL, 578824730UL, 2174064027UL, 3352513900UL, 3495516649UL, 911932439UL, 2030004973UL, 3283902592UL, 3755877921UL, 1774462108UL, 352122318UL, 977153640UL, 642640734UL, 2555395772UL, 756528792UL, 2593565626UL, 3738143618UL, 734614254UL, 3276420511UL, 4086313763UL, 4157371578UL, 1082026387UL, 429736987UL, 3755125580UL, 526056489UL, 3300547146UL, 3089498232UL, 4167244256UL, +1619189426UL, 82235109UL, 1061842570UL, 3666470174UL, 810916769UL, 2263633079UL, 1110270726UL, 1804937521UL, 2774236887UL, 2858593613UL, 961498236UL, 1840197918UL, 1564424234UL, 2276602447UL, 2540994858UL, 78621171UL, 3690913528UL, 2958793283UL, 387554009UL, 688827573UL, 3833764146UL, 3626285597UL, 2296780370UL, 2411775612UL, 3790615886UL, 3399757437UL, 1561545830UL, 1005364336UL, 2093159919UL, 2091827252UL, 1461775197UL, 63358970UL, +1185831033UL, 12264437UL, 1313835999UL, 556653278UL, 3918754976UL, 1471530347UL, 2010243509UL, 3097827138UL, 1399987735UL, 2767111911UL, 2505795417UL, 1336824946UL, 3358720963UL, 2874295267UL, 902314853UL, 3478581038UL, 4027859424UL, 713597958UL, 4059691816UL, 1462989647UL, 2291324146UL, 932688463UL, 3001334051UL, 2028368589UL, 3594712587UL, 3964293916UL, 4276849132UL, 1828058403UL, 1351688755UL, 2571513800UL, 42517349UL, 3100438883UL, +1137792178UL, 1479076106UL, 140519541UL, 3964913740UL, 2422362185UL, 436113863UL, 2044139049UL, 226785542UL, 3275185975UL, 2655265571UL, 1674107588UL, 1496360114UL, 46428973UL, 1739051417UL, 2393774399UL, 250035802UL, 10186306UL, 4118320101UL, 3899157617UL, 3679157076UL, 2258085991UL, 1407319575UL, 4267866849UL, 3679828833UL, 711086272UL, 2952963707UL, 3373894808UL, 3662249794UL, 3405637490UL, 1343291195UL, 730888681UL, 507768703UL, +2930510271UL, 1779803564UL, 3781228998UL, 1787582256UL, 838267218UL, 1817693489UL, 2431224659UL, 2484870604UL, 4151302318UL, 1844787776UL, 1788220652UL, 4012573268UL, 1842903369UL, 2927332301UL, 3246688068UL, 2050648011UL, 3405161215UL, 3369636401UL, 3091858538UL, 3320767682UL, 241001958UL, 400609988UL, 3163880457UL, 1540551653UL, 2733620168UL, 3857223520UL, 2137935937UL, 803170440UL, 821275940UL, 3897549272UL, 1451986523UL, 194431797UL, +904639695UL, 1106545578UL, 1514893712UL, 4147878244UL, 62528087UL, 4109877399UL, 578824730UL, 2174064027UL, 461571251UL, 3495516649UL, 911932439UL, 2030004973UL, 3283902592UL, 1580354765UL, 1774462108UL, 352122318UL, 977153640UL, 642640734UL, 1019387737UL, 756528792UL, 2593565626UL, 3738143618UL, 734614254UL, 999431451UL, 4086313763UL, 4157371578UL, 1082026387UL, 429736987UL, 140091634UL, 526056489UL, 3300547146UL, 3089498232UL, +4167244256UL, 3202763095UL, 82235109UL, 1061842570UL, 3666470174UL, 810916769UL, 3663992550UL, 1110270726UL, 1804937521UL, 2774236887UL, 2858593613UL, 2203639366UL, 1840197918UL, 1564424234UL, 2276602447UL, 2540994858UL, 978199281UL, 3690913528UL, 2958793283UL, 387554009UL, 688827573UL, 375113876UL, 3626285597UL, 2296780370UL, 2411775612UL, 3790615886UL, 1277897939UL, 1561545830UL, 1005364336UL, 2093159919UL, 2091827252UL, 1631078873UL, +63358970UL, 1185831033UL, 12264437UL, 1313835999UL, 3872277948UL, 3918754976UL, 1471530347UL, 2010243509UL, 3097827138UL, 1291836608UL, 2767111911UL, 2505795417UL, 1336824946UL, 3358720963UL, 3954754615UL, 902314853UL, 3478581038UL, 4027859424UL, 713597958UL, 2198246306UL, 1462989647UL, 2291324146UL, 932688463UL, 3001334051UL, 2374736511UL, 3594712587UL, 3964293916UL, 4276849132UL, 1828058403UL, 3619038368UL, 2571513800UL, 42517349UL, +3100438883UL, 1137792178UL, 1146435746UL, 140519541UL, 3964913740UL, 2422362185UL, 436113863UL, 3460540392UL, 226785542UL, 3275185975UL, 2655265571UL, 1674107588UL, 1288223861UL, 46428973UL, 1739051417UL, 2393774399UL, 250035802UL, 1986226858UL, 4118320101UL, 3899157617UL, 3679157076UL, 2258085991UL, 551117761UL, 4267866849UL, 3679828833UL, 711086272UL, 2952963707UL, 1667866621UL, 3662249794UL, 3405637490UL, 1343291195UL, 730888681UL, +2381246695UL, 2930510271UL, 1779803564UL, 3781228998UL, 1787582256UL, 1236367773UL, 1817693489UL, 2431224659UL, 2484870604UL, 4151302318UL, 2902321811UL, 1788220652UL, 4012573268UL, 1842903369UL, 2927332301UL, 1185539274UL, 2050648011UL, 3405161215UL, 3369636401UL, 3091858538UL, 4240555382UL, 241001958UL, 400609988UL, 3163880457UL, 1540551653UL, 2539098607UL, 3857223520UL, 2137935937UL, 803170440UL, 821275940UL, 3485313735UL, 1451986523UL, +194431797UL, 904639695UL, 1106545578UL, 1633417190UL, 4147878244UL, 62528087UL, 4109877399UL, 578824730UL, 3671726812UL, 461571251UL, 3495516649UL, 911932439UL, 2030004973UL, 2002341352UL, 1580354765UL, 1774462108UL, 352122318UL, 977153640UL, 170033402UL, 1019387737UL, 756528792UL, 2593565626UL, 3738143618UL, 4160516213UL, 999431451UL, 4086313763UL, 4157371578UL, 1082026387UL, 1423352480UL, 140091634UL, 526056489UL, 3300547146UL, +3089498232UL, 4266971502UL, 3202763095UL, 82235109UL, 1061842570UL, 3666470174UL, 945994616UL, 3663992550UL, 1110270726UL, 1804937521UL, 2774236887UL, 3776581315UL, 2203639366UL, 1840197918UL, 1564424234UL, 2276602447UL, 928117829UL, 978199281UL, 3690913528UL, 2958793283UL, 387554009UL, 2817496615UL, 375113876UL, 3626285597UL, 2296780370UL, 2411775612UL, 1346030561UL, 1277897939UL, 1561545830UL, 1005364336UL, 2093159919UL, 821902776UL, +1631078873UL, 63358970UL, 1185831033UL, 12264437UL, 3192617499UL, 3872277948UL, 3918754976UL, 1471530347UL, 2010243509UL, 4011062105UL, 1291836608UL, 2767111911UL, 2505795417UL, 1336824946UL, 1593119272UL, 3954754615UL, 902314853UL, 3478581038UL, 4027859424UL, 1163079365UL, 2198246306UL, 1462989647UL, 2291324146UL, 932688463UL, 4018333691UL, 2374736511UL, 3594712587UL, 3964293916UL, 4276849132UL, 3902062310UL, 3619038368UL, 2571513800UL, +42517349UL, 3100438883UL, 1645455709UL, 1146435746UL, 140519541UL, 3964913740UL, 2422362185UL, 3338363150UL, 3460540392UL, 226785542UL, 3275185975UL, 2655265571UL, 3789582441UL, 1288223861UL, 46428973UL, 1739051417UL, 2393774399UL, 2257001236UL, 1986226858UL, 4118320101UL, 3899157617UL, 3679157076UL, 3707520907UL, 551117761UL, 4267866849UL, 3679828833UL, 711086272UL, 570153549UL, 1667866621UL, 3662249794UL, 3405637490UL, 1343291195UL, +112368058UL, 2615115584UL, 2865130041UL, 357584504UL, 528807633UL, 1816055434UL, 2854850066UL, 190222907UL, 1014915859UL, 3472967123UL, 2605782564UL, 3353130066UL, 540430076UL, 2087143725UL, 1571283916UL, 1604766425UL, 934199876UL, 3359569795UL, 4168578472UL, 1745876717UL, 277026333UL, 2679446726UL, 3582165485UL, 3954458991UL, 2615245404UL, 2410035461UL, 3442004248UL, 2814474875UL, 1734556428UL, 2653422310UL, 4033890533UL, 2373774914UL, +3011118469UL, 1276695464UL, 2995405818UL, 782363735UL, 2242531852UL, 4206829780UL, 1486885236UL, 3764707851UL, 1945614253UL, 1147926733UL, 701960774UL, 3435251514UL, 3626050187UL, 3587799538UL, 2399216643UL, 3217822006UL, 3600044386UL, 648239752UL, 2997947488UL, 1754097052UL, 4109638936UL, 3413714077UL, 1038375790UL, 3394259389UL, 2284776380UL, 2711956471UL, 1278424040UL, 1272230764UL, 3980809660UL, 1983901240UL, 894405781UL, 582621606UL, +1274260631UL, 763432985UL, 1862236664UL, 10249416UL, 3838574116UL, 1912270458UL, 3491686662UL, 2696669149UL, 312119069UL, 1812714569UL, 2729307370UL, 3045249652UL, 303684944UL, 503720764UL, 4029412414UL, 4101616421UL, 3484358948UL, 1261027935UL, 145713434UL, 2918444923UL, 2099546237UL, 3173693583UL, 3498398823UL, 3769717769UL, 2860220116UL, 2919562911UL, 1221047715UL, 1749384742UL, 1018968146UL, 2771587474UL, 2746107326UL, 1182859751UL, +2403805226UL, 2206395932UL, 1500348209UL, 1762634532UL, 3017223998UL, 2043185588UL, 2124568729UL, 1619852613UL, 3248258238UL, 3393223375UL, 644860154UL, 2465108160UL, 2358875673UL, 3643741304UL, 1891106916UL, 416443047UL, 3298583974UL, 1030877276UL, 2839390034UL, 4181398645UL, 1845333999UL, 3643365079UL, 1993116780UL, 1763857175UL, 1951718545UL, 3785659537UL, 4156412284UL, 4138026128UL, 3480291142UL, 54280556UL, 4169041146UL, 3130638398UL, +3236816184UL, 3559898998UL, 916420843UL, 938920758UL, 3425021599UL, 1528477728UL, 3597939783UL, 3516249439UL, 936528538UL, 4174817780UL, 2541489033UL, 3962368135UL, 2054336507UL, 2610093970UL, 3613025255UL, 3583905994UL, 2990129491UL, 332823408UL, 2505138276UL, 3811707598UL, 373987627UL, 4263703898UL, 1668946560UL, 3213253899UL, 2673819338UL, 1631405099UL, 3127443274UL, 549232331UL, 21447814UL, 1647238011UL, 3093799993UL, 1922712395UL, +}, +{ +4224788259UL, 3569487556UL, 1080137041UL, 2788623569UL, 856160888UL, 2195536417UL, 3030463035UL, 2906439247UL, 896055051UL, 1967105456UL, 2093562169UL, 2919742950UL, 546374698UL, 1372591815UL, 3773616637UL, 349073007UL, 1331102855UL, 3035367896UL, 1222622311UL, 2266618592UL, 74466398UL, 1140488004UL, 855606859UL, 3803728487UL, 3589743162UL, 2748402856UL, 1044387368UL, 1494850922UL, 2242660891UL, 3111566003UL, 2013737074UL, 163276737UL, +1526772858UL, 3047139947UL, 3150695453UL, 2583795468UL, 3628272447UL, 305282258UL, 2151108134UL, 2905708853UL, 1052800761UL, 3354632338UL, 1017036861UL, 2453680791UL, 2673902555UL, 1622154585UL, 2893733051UL, 3888482522UL, 306284440UL, 3245137245UL, 3480776670UL, 2865396581UL, 3571456526UL, 3284891766UL, 1393584874UL, 1057867320UL, 2888126310UL, 3302325443UL, 4135187530UL, 1770789166UL, 1615533805UL, 1438727397UL, 2921922012UL, 3156703516UL, +435047591UL, 2999350446UL, 575044884UL, 1001339111UL, 625824120UL, 2489346227UL, 2104489492UL, 2494528446UL, 1141458836UL, 4048430074UL, 2599022749UL, 2438694106UL, 1443850072UL, 3321658999UL, 87870515UL, 958195816UL, 380666771UL, 3062272732UL, 4178548642UL, 4274603044UL, 888566831UL, 3386636024UL, 1636806704UL, 2400069397UL, 3003029365UL, 1953620944UL, 3278772216UL, 1562778171UL, 2767090642UL, 14436957UL, 913966574UL, 1724553886UL, +2015261135UL, 4191296122UL, 1688939147UL, 110865735UL, 2913800286UL, 4131469475UL, 315962755UL, 1531174227UL, 1226678476UL, 3446400266UL, 3896297836UL, 539834883UL, 2871306264UL, 3333932675UL, 2229436010UL, 1928458456UL, 464682640UL, 1786180352UL, 162599143UL, 817038005UL, 3146256537UL, 1676400403UL, 2484731087UL, 702610427UL, 4005124049UL, 1691076958UL, 1268494739UL, 4093608833UL, 3757213737UL, 2627839929UL, 2884764386UL, 1548110665UL, +3361745333UL, 3955318088UL, 3264527857UL, 3969225726UL, 968269281UL, 2630991382UL, 2716444139UL, 1071781623UL, 3704437685UL, 1511193802UL, 843840414UL, 1277966236UL, 4141095880UL, 715016637UL, 1255888181UL, 1321941951UL, 1180174408UL, 1021629824UL, 3395369301UL, 3912221525UL, 2611782663UL, 4038117717UL, 2253029302UL, 974431991UL, 347200257UL, 886823557UL, 2275848777UL, 3732452739UL, 3708953729UL, 2688020866UL, 4185175489UL, 99605353UL, +2387945286UL, 4224788259UL, 3569487556UL, 1080137041UL, 2788623569UL, 238715294UL, 2195536417UL, 3030463035UL, 2906439247UL, 896055051UL, 3061240402UL, 2093562169UL, 2919742950UL, 546374698UL, 1372591815UL, 851057115UL, 349073007UL, 1331102855UL, 3035367896UL, 1222622311UL, 3305595574UL, 74466398UL, 1140488004UL, 855606859UL, 3803728487UL, 3838112757UL, 2748402856UL, 1044387368UL, 1494850922UL, 2242660891UL, 1038286760UL, 2013737074UL, +163276737UL, 1526772858UL, 3047139947UL, 3518918891UL, 2583795468UL, 3628272447UL, 305282258UL, 2151108134UL, 3555155951UL, 1052800761UL, 3354632338UL, 1017036861UL, 2453680791UL, 2394691836UL, 1622154585UL, 2893733051UL, 3888482522UL, 306284440UL, 2055552069UL, 3480776670UL, 2865396581UL, 3571456526UL, 3284891766UL, 1179339312UL, 1057867320UL, 2888126310UL, 3302325443UL, 4135187530UL, 683364318UL, 1615533805UL, 1438727397UL, 2921922012UL, +3156703516UL, 1333086260UL, 2999350446UL, 575044884UL, 1001339111UL, 625824120UL, 576119652UL, 2104489492UL, 2494528446UL, 1141458836UL, 4048430074UL, 786660788UL, 2438694106UL, 1443850072UL, 3321658999UL, 87870515UL, 457955380UL, 380666771UL, 3062272732UL, 4178548642UL, 4274603044UL, 2256710588UL, 3386636024UL, 1636806704UL, 2400069397UL, 3003029365UL, 3733049985UL, 3278772216UL, 1562778171UL, 2767090642UL, 14436957UL, 530062778UL, +1724553886UL, 2015261135UL, 4191296122UL, 1688939147UL, 2981240708UL, 2913800286UL, 4131469475UL, 315962755UL, 1531174227UL, 2433363617UL, 3446400266UL, 3896297836UL, 539834883UL, 2871306264UL, 2597546929UL, 2229436010UL, 1928458456UL, 464682640UL, 1786180352UL, 1165821797UL, 817038005UL, 3146256537UL, 1676400403UL, 2484731087UL, 3239493343UL, 4005124049UL, 1691076958UL, 1268494739UL, 4093608833UL, 2088690204UL, 2627839929UL, 2884764386UL, +1548110665UL, 3361745333UL, 1075350364UL, 3264527857UL, 3969225726UL, 968269281UL, 2630991382UL, 4103280359UL, 1071781623UL, 3704437685UL, 1511193802UL, 843840414UL, 1340474980UL, 4141095880UL, 715016637UL, 1255888181UL, 1321941951UL, 2512565938UL, 1021629824UL, 3395369301UL, 3912221525UL, 2611782663UL, 2287272047UL, 2253029302UL, 974431991UL, 347200257UL, 886823557UL, 3775715445UL, 3732452739UL, 3708953729UL, 2688020866UL, 4185175489UL, +2151114047UL, 2387945286UL, 4224788259UL, 3569487556UL, 1080137041UL, 879682447UL, 238715294UL, 2195536417UL, 3030463035UL, 2906439247UL, 3975397430UL, 3061240402UL, 2093562169UL, 2919742950UL, 546374698UL, 1928060945UL, 851057115UL, 349073007UL, 1331102855UL, 3035367896UL, 1148668613UL, 3305595574UL, 74466398UL, 1140488004UL, 855606859UL, 917923571UL, 3838112757UL, 2748402856UL, 1044387368UL, 1494850922UL, 995791756UL, 1038286760UL, +2013737074UL, 163276737UL, 1526772858UL, 1944370085UL, 3518918891UL, 2583795468UL, 3628272447UL, 305282258UL, 685261037UL, 3555155951UL, 1052800761UL, 3354632338UL, 1017036861UL, 1620076466UL, 2394691836UL, 1622154585UL, 2893733051UL, 3888482522UL, 4119309151UL, 2055552069UL, 3480776670UL, 2865396581UL, 3571456526UL, 4008552940UL, 1179339312UL, 1057867320UL, 2888126310UL, 3302325443UL, 2359989247UL, 683364318UL, 1615533805UL, 1438727397UL, +2921922012UL, 2092991022UL, 1333086260UL, 2999350446UL, 575044884UL, 1001339111UL, 2406217399UL, 576119652UL, 2104489492UL, 2494528446UL, 1141458836UL, 1856565466UL, 786660788UL, 2438694106UL, 1443850072UL, 3321658999UL, 2752588925UL, 457955380UL, 380666771UL, 3062272732UL, 4178548642UL, 1354877973UL, 2256710588UL, 3386636024UL, 1636806704UL, 2400069397UL, 2275777233UL, 3733049985UL, 3278772216UL, 1562778171UL, 2767090642UL, 3438624166UL, +530062778UL, 1724553886UL, 2015261135UL, 4191296122UL, 3842215040UL, 2981240708UL, 2913800286UL, 4131469475UL, 315962755UL, 2891870900UL, 2433363617UL, 3446400266UL, 3896297836UL, 539834883UL, 1390877376UL, 2597546929UL, 2229436010UL, 1928458456UL, 464682640UL, 1405678725UL, 1165821797UL, 817038005UL, 3146256537UL, 1676400403UL, 9522151UL, 3239493343UL, 4005124049UL, 1691076958UL, 1268494739UL, 4076978821UL, 2088690204UL, 2627839929UL, +2884764386UL, 1548110665UL, 3713129550UL, 1075350364UL, 3264527857UL, 3969225726UL, 968269281UL, 2669129178UL, 4103280359UL, 1071781623UL, 3704437685UL, 1511193802UL, 2032747975UL, 1340474980UL, 4141095880UL, 715016637UL, 1255888181UL, 1290704077UL, 2512565938UL, 1021629824UL, 3395369301UL, 3912221525UL, 767420943UL, 2287272047UL, 2253029302UL, 974431991UL, 347200257UL, 940587649UL, 3775715445UL, 3732452739UL, 3708953729UL, 2688020866UL, +1603856534UL, 2151114047UL, 2387945286UL, 4224788259UL, 3569487556UL, 4060395365UL, 879682447UL, 238715294UL, 2195536417UL, 3030463035UL, 774839173UL, 3975397430UL, 3061240402UL, 2093562169UL, 2919742950UL, 77503099UL, 1928060945UL, 851057115UL, 349073007UL, 1331102855UL, 4216140027UL, 1148668613UL, 3305595574UL, 74466398UL, 1140488004UL, 1728766104UL, 917923571UL, 3838112757UL, 2748402856UL, 1044387368UL, 1408900577UL, 995791756UL, +1038286760UL, 2013737074UL, 163276737UL, 936142172UL, 1944370085UL, 3518918891UL, 2583795468UL, 3628272447UL, 1701372078UL, 685261037UL, 3555155951UL, 1052800761UL, 3354632338UL, 2951922777UL, 1620076466UL, 2394691836UL, 1622154585UL, 2893733051UL, 2494523614UL, 4119309151UL, 2055552069UL, 3480776670UL, 2865396581UL, 3031455484UL, 4008552940UL, 1179339312UL, 1057867320UL, 2888126310UL, 2970791558UL, 2359989247UL, 683364318UL, 1615533805UL, +1438727397UL, 3697460033UL, 2092991022UL, 1333086260UL, 2999350446UL, 575044884UL, 2712063736UL, 2406217399UL, 576119652UL, 2104489492UL, 2494528446UL, 1096189230UL, 1856565466UL, 786660788UL, 2438694106UL, 1443850072UL, 3615481975UL, 2752588925UL, 457955380UL, 380666771UL, 3062272732UL, 2387056252UL, 1354877973UL, 2256710588UL, 3386636024UL, 1636806704UL, 517188972UL, 2275777233UL, 3733049985UL, 3278772216UL, 1562778171UL, 3436331606UL, +3438624166UL, 530062778UL, 1724553886UL, 2015261135UL, 1711407722UL, 3842215040UL, 2981240708UL, 2913800286UL, 4131469475UL, 878455086UL, 2891870900UL, 2433363617UL, 3446400266UL, 3896297836UL, 4251949215UL, 1390877376UL, 2597546929UL, 2229436010UL, 1928458456UL, 719826541UL, 1405678725UL, 1165821797UL, 817038005UL, 3146256537UL, 3883590627UL, 9522151UL, 3239493343UL, 4005124049UL, 1691076958UL, 893183073UL, 4076978821UL, 2088690204UL, +2627839929UL, 2884764386UL, 3312769297UL, 3713129550UL, 1075350364UL, 3264527857UL, 3969225726UL, 4161107579UL, 2669129178UL, 4103280359UL, 1071781623UL, 3704437685UL, 1400940789UL, 2032747975UL, 1340474980UL, 4141095880UL, 715016637UL, 1705234794UL, 1290704077UL, 2512565938UL, 1021629824UL, 3395369301UL, 2934074199UL, 767420943UL, 2287272047UL, 2253029302UL, 974431991UL, 3060035390UL, 940587649UL, 3775715445UL, 3732452739UL, 3708953729UL, +3489160434UL, 3200799223UL, 340420813UL, 2539294182UL, 2619616318UL, 456806966UL, 4272538790UL, 2994564124UL, 2757588894UL, 3493053179UL, 2946195469UL, 1402305257UL, 2266356503UL, 3512914478UL, 273195440UL, 3579761455UL, 862317458UL, 1894959361UL, 42596779UL, 376641729UL, 782820755UL, 716528645UL, 222675565UL, 4038035195UL, 311038326UL, 395780597UL, 2025474869UL, 404396572UL, 4138962756UL, 2441107014UL, 3525378401UL, 947085768UL, +3758218091UL, 3185789607UL, 638283508UL, 3802505926UL, 830259842UL, 1086400881UL, 3444485UL, 142418107UL, 4283468141UL, 1669846189UL, 955065888UL, 3864384467UL, 73139517UL, 136809048UL, 1444329434UL, 174974637UL, 3303183786UL, 282216656UL, 3114827080UL, 3811060015UL, 1610640996UL, 3824096289UL, 1123437514UL, 3826582808UL, 39407702UL, 2437666463UL, 2454206642UL, 830758422UL, 4190092654UL, 1941090912UL, 224373276UL, 3704201239UL, +3284012568UL, 4056152539UL, 1022047941UL, 1077111803UL, 3028336675UL, 3207391465UL, 3459202233UL, 1991240724UL, 4184491520UL, 1851863093UL, 1038639595UL, 1392247730UL, 2113875749UL, 1162388509UL, 2629935260UL, 3545260772UL, 991928712UL, 4064775043UL, 4180493781UL, 2134685922UL, 642853690UL, 290065503UL, 1629968UL, 3150373868UL, 3110755428UL, 2254306163UL, 421928533UL, 11426979UL, 3042809169UL, 786868170UL, 1287942583UL, 1851107769UL, +1444903906UL, 4150950197UL, 3737798306UL, 2848738554UL, 505924220UL, 2944131627UL, 2639930627UL, 1339887691UL, 2382166850UL, 2668971315UL, 3944739049UL, 2217612340UL, 4142682607UL, 997824216UL, 123465626UL, 844518179UL, 1161486362UL, 2706162053UL, 2966530827UL, 4103639053UL, 1837121393UL, 909648429UL, 298619078UL, 2057042454UL, 3613272637UL, 3609349032UL, 1664428748UL, 1871510359UL, 58508710UL, 1079418100UL, 3278870121UL, 3821562746UL, +16654909UL, 2530580589UL, 3361874982UL, 629910009UL, 2124761646UL, 2508133604UL, 1954315500UL, 3019833617UL, 141617625UL, 1653192078UL, 1541695589UL, 1223978475UL, 3875963510UL, 3028691587UL, 3450826564UL, 2185849120UL, 1956475624UL, 3053842172UL, 3550887830UL, 2672339803UL, 176823785UL, 913229929UL, 681399502UL, 2256486297UL, 2881672598UL, 597153273UL, 2782767695UL, 1133158067UL, 4126077325UL, 3456027404UL, 754062201UL, 4069172986UL, +}, +{ +2441935114UL, 3465447683UL, 2897229686UL, 3845380309UL, 1199633364UL, 495424232UL, 2490548037UL, 581670528UL, 2467171733UL, 2200094863UL, 2163927790UL, 3895792830UL, 2097210789UL, 1606544633UL, 1305562517UL, 4072525389UL, 3256142090UL, 349440478UL, 3920932491UL, 2462464051UL, 1075951496UL, 2835763703UL, 1593198055UL, 2380945625UL, 543531323UL, 3182766507UL, 2927484354UL, 2877470578UL, 4153923603UL, 2443156156UL, 1168544900UL, 888955615UL, +3605412824UL, 1336677864UL, 3256116974UL, 2884036014UL, 4070749843UL, 2989661773UL, 1095584023UL, 1370834065UL, 3534389580UL, 312378113UL, 3190819203UL, 1247574926UL, 2046019470UL, 3536918510UL, 1479030180UL, 847820646UL, 3992973956UL, 3827223401UL, 4113429617UL, 3504933502UL, 295000614UL, 2238923504UL, 3485717254UL, 290246351UL, 1064210816UL, 2848539559UL, 2617134888UL, 422213010UL, 2796674561UL, 3568250500UL, 2736237915UL, 3950756060UL, +1527249993UL, 3603540278UL, 4115393386UL, 2851621193UL, 4230341156UL, 905168850UL, 3916344126UL, 1496013046UL, 206343742UL, 2894205125UL, 1082918859UL, 2746480417UL, 3077328661UL, 1209440053UL, 3258293856UL, 1032236533UL, 3043332566UL, 446879604UL, 587022214UL, 1614371566UL, 3040899994UL, 3686422145UL, 937325128UL, 1968833679UL, 169086151UL, 4075432555UL, 1196046411UL, 3101745581UL, 4228079966UL, 2942213563UL, 1195005323UL, 1673491641UL, +1762746534UL, 3641827252UL, 694590905UL, 1828365460UL, 513716230UL, 3106485486UL, 2441593994UL, 4044462965UL, 3628121101UL, 3957990629UL, 179764922UL, 579361186UL, 3474393871UL, 2474241006UL, 4031850878UL, 3120409532UL, 4011587898UL, 3682942579UL, 3257272830UL, 3097029759UL, 2652540191UL, 1128762588UL, 1040256382UL, 2743736716UL, 334893087UL, 1892049031UL, 2603159239UL, 3712772023UL, 2126593224UL, 3465793906UL, 3180780589UL, 725740783UL, +3728108967UL, 573931936UL, 137996587UL, 110756053UL, 3984787930UL, 3773232816UL, 3406981985UL, 1783088630UL, 2080089781UL, 195827466UL, 1409073281UL, 867635355UL, 3049533211UL, 486687054UL, 2570137956UL, 527522011UL, 1084454084UL, 1019222771UL, 1415565066UL, 650794786UL, 629618803UL, 1237709131UL, 1241899078UL, 2751644247UL, 2792313337UL, 649402117UL, 275078659UL, 752459111UL, 2173220853UL, 3207031798UL, 821073585UL, 3005400729UL, +1085152012UL, 2441935114UL, 3465447683UL, 2897229686UL, 3845380309UL, 3573898488UL, 495424232UL, 2490548037UL, 581670528UL, 2467171733UL, 1208279791UL, 2163927790UL, 3895792830UL, 2097210789UL, 1606544633UL, 2148733343UL, 4072525389UL, 3256142090UL, 349440478UL, 3920932491UL, 657289255UL, 1075951496UL, 2835763703UL, 1593198055UL, 2380945625UL, 149487931UL, 3182766507UL, 2927484354UL, 2877470578UL, 4153923603UL, 606130344UL, 1168544900UL, +888955615UL, 3605412824UL, 1336677864UL, 53448770UL, 2884036014UL, 4070749843UL, 2989661773UL, 1095584023UL, 2766144383UL, 3534389580UL, 312378113UL, 3190819203UL, 1247574926UL, 1530609481UL, 3536918510UL, 1479030180UL, 847820646UL, 3992973956UL, 154171325UL, 4113429617UL, 3504933502UL, 295000614UL, 2238923504UL, 282708664UL, 290246351UL, 1064210816UL, 2848539559UL, 2617134888UL, 36906646UL, 2796674561UL, 3568250500UL, 2736237915UL, +3950756060UL, 3416260072UL, 3603540278UL, 4115393386UL, 2851621193UL, 4230341156UL, 448215287UL, 3916344126UL, 1496013046UL, 206343742UL, 2894205125UL, 2420861244UL, 2746480417UL, 3077328661UL, 1209440053UL, 3258293856UL, 2545287695UL, 3043332566UL, 446879604UL, 587022214UL, 1614371566UL, 958587333UL, 3686422145UL, 937325128UL, 1968833679UL, 169086151UL, 154576725UL, 1196046411UL, 3101745581UL, 4228079966UL, 2942213563UL, 2487464668UL, +1673491641UL, 1762746534UL, 3641827252UL, 694590905UL, 3754606623UL, 513716230UL, 3106485486UL, 2441593994UL, 4044462965UL, 3064108377UL, 3957990629UL, 179764922UL, 579361186UL, 3474393871UL, 2138270428UL, 4031850878UL, 3120409532UL, 4011587898UL, 3682942579UL, 4015980199UL, 3097029759UL, 2652540191UL, 1128762588UL, 1040256382UL, 3908621649UL, 334893087UL, 1892049031UL, 2603159239UL, 3712772023UL, 3291038350UL, 3465793906UL, 3180780589UL, +725740783UL, 3728108967UL, 436976908UL, 137996587UL, 110756053UL, 3984787930UL, 3773232816UL, 1000054791UL, 1783088630UL, 2080089781UL, 195827466UL, 1409073281UL, 3036813614UL, 3049533211UL, 486687054UL, 2570137956UL, 527522011UL, 3669951690UL, 1019222771UL, 1415565066UL, 650794786UL, 629618803UL, 4140569538UL, 1241899078UL, 2751644247UL, 2792313337UL, 649402117UL, 2946582304UL, 752459111UL, 2173220853UL, 3207031798UL, 821073585UL, +1738142977UL, 1085152012UL, 2441935114UL, 3465447683UL, 2897229686UL, 2707197334UL, 3573898488UL, 495424232UL, 2490548037UL, 581670528UL, 2365865647UL, 1208279791UL, 2163927790UL, 3895792830UL, 2097210789UL, 3219551420UL, 2148733343UL, 4072525389UL, 3256142090UL, 349440478UL, 3706519197UL, 657289255UL, 1075951496UL, 2835763703UL, 1593198055UL, 2200084531UL, 149487931UL, 3182766507UL, 2927484354UL, 2877470578UL, 2394288661UL, 606130344UL, +1168544900UL, 888955615UL, 3605412824UL, 1503975597UL, 53448770UL, 2884036014UL, 4070749843UL, 2989661773UL, 243605110UL, 2766144383UL, 3534389580UL, 312378113UL, 3190819203UL, 2398088088UL, 1530609481UL, 3536918510UL, 1479030180UL, 847820646UL, 2940281320UL, 154171325UL, 4113429617UL, 3504933502UL, 295000614UL, 3078701806UL, 282708664UL, 290246351UL, 1064210816UL, 2848539559UL, 3960345380UL, 36906646UL, 2796674561UL, 3568250500UL, +2736237915UL, 2657034787UL, 3416260072UL, 3603540278UL, 4115393386UL, 2851621193UL, 3847740427UL, 448215287UL, 3916344126UL, 1496013046UL, 206343742UL, 3419083433UL, 2420861244UL, 2746480417UL, 3077328661UL, 1209440053UL, 3824237152UL, 2545287695UL, 3043332566UL, 446879604UL, 587022214UL, 506352928UL, 958587333UL, 3686422145UL, 937325128UL, 1968833679UL, 1808935939UL, 154576725UL, 1196046411UL, 3101745581UL, 4228079966UL, 709576348UL, +2487464668UL, 1673491641UL, 1762746534UL, 3641827252UL, 3968332142UL, 3754606623UL, 513716230UL, 3106485486UL, 2441593994UL, 1453443785UL, 3064108377UL, 3957990629UL, 179764922UL, 579361186UL, 1454621561UL, 2138270428UL, 4031850878UL, 3120409532UL, 4011587898UL, 898119245UL, 4015980199UL, 3097029759UL, 2652540191UL, 1128762588UL, 1131456853UL, 3908621649UL, 334893087UL, 1892049031UL, 2603159239UL, 4280222837UL, 3291038350UL, 3465793906UL, +3180780589UL, 725740783UL, 1515867399UL, 436976908UL, 137996587UL, 110756053UL, 3984787930UL, 1295994548UL, 1000054791UL, 1783088630UL, 2080089781UL, 195827466UL, 252558267UL, 3036813614UL, 3049533211UL, 486687054UL, 2570137956UL, 786434419UL, 3669951690UL, 1019222771UL, 1415565066UL, 650794786UL, 1316734597UL, 4140569538UL, 1241899078UL, 2751644247UL, 2792313337UL, 4014748337UL, 2946582304UL, 752459111UL, 2173220853UL, 3207031798UL, +2903407363UL, 1738142977UL, 1085152012UL, 2441935114UL, 3465447683UL, 1082984764UL, 2707197334UL, 3573898488UL, 495424232UL, 2490548037UL, 240094068UL, 2365865647UL, 1208279791UL, 2163927790UL, 3895792830UL, 1107651215UL, 3219551420UL, 2148733343UL, 4072525389UL, 3256142090UL, 681942656UL, 3706519197UL, 657289255UL, 1075951496UL, 2835763703UL, 2172774506UL, 2200084531UL, 149487931UL, 3182766507UL, 2927484354UL, 3069592433UL, 2394288661UL, +606130344UL, 1168544900UL, 888955615UL, 757163746UL, 1503975597UL, 53448770UL, 2884036014UL, 4070749843UL, 1705538727UL, 243605110UL, 2766144383UL, 3534389580UL, 312378113UL, 2256467250UL, 2398088088UL, 1530609481UL, 3536918510UL, 1479030180UL, 1360826079UL, 2940281320UL, 154171325UL, 4113429617UL, 3504933502UL, 714934244UL, 3078701806UL, 282708664UL, 290246351UL, 1064210816UL, 3694453051UL, 3960345380UL, 36906646UL, 2796674561UL, +3568250500UL, 3400481963UL, 2657034787UL, 3416260072UL, 3603540278UL, 4115393386UL, 1466632735UL, 3847740427UL, 448215287UL, 3916344126UL, 1496013046UL, 2893537514UL, 3419083433UL, 2420861244UL, 2746480417UL, 3077328661UL, 2815979224UL, 3824237152UL, 2545287695UL, 3043332566UL, 446879604UL, 3719452721UL, 506352928UL, 958587333UL, 3686422145UL, 937325128UL, 2653904510UL, 1808935939UL, 154576725UL, 1196046411UL, 3101745581UL, 425411544UL, +709576348UL, 2487464668UL, 1673491641UL, 1762746534UL, 1960605594UL, 3968332142UL, 3754606623UL, 513716230UL, 3106485486UL, 2881551071UL, 1453443785UL, 3064108377UL, 3957990629UL, 179764922UL, 1408218536UL, 1454621561UL, 2138270428UL, 4031850878UL, 3120409532UL, 3700386494UL, 898119245UL, 4015980199UL, 3097029759UL, 2652540191UL, 2181464767UL, 1131456853UL, 3908621649UL, 334893087UL, 1892049031UL, 4220220071UL, 4280222837UL, 3291038350UL, +3465793906UL, 3180780589UL, 1737123182UL, 1515867399UL, 436976908UL, 137996587UL, 110756053UL, 1360813614UL, 1295994548UL, 1000054791UL, 1783088630UL, 2080089781UL, 1019367341UL, 252558267UL, 3036813614UL, 3049533211UL, 486687054UL, 387915679UL, 786434419UL, 3669951690UL, 1019222771UL, 1415565066UL, 4267042909UL, 1316734597UL, 4140569538UL, 1241899078UL, 2751644247UL, 3622120385UL, 4014748337UL, 2946582304UL, 752459111UL, 2173220853UL, +1128460687UL, 2268047031UL, 239933818UL, 4141570430UL, 1318816940UL, 2378987660UL, 731877825UL, 3950952879UL, 2975574698UL, 2938375136UL, 431933385UL, 154404673UL, 2020658234UL, 846815781UL, 822137193UL, 1057315444UL, 3632584082UL, 3263363094UL, 942201956UL, 2704683551UL, 1768107067UL, 4009446092UL, 3090701064UL, 701246680UL, 3548419575UL, 3873366129UL, 1639833080UL, 2401253373UL, 66597794UL, 2515774132UL, 516246524UL, 4232115668UL, +34426096UL, 2206423458UL, 3628832867UL, 2776950121UL, 2782943544UL, 2058958317UL, 1805852726UL, 2151415233UL, 2940074103UL, 2318397273UL, 3067676663UL, 3127709351UL, 71509976UL, 115529187UL, 1841252918UL, 2217805156UL, 733917373UL, 2432474677UL, 1416887641UL, 1895320369UL, 2779694586UL, 510547269UL, 2614743018UL, 759552691UL, 2264773752UL, 305497497UL, 1082013785UL, 1681067734UL, 1085957001UL, 846460632UL, 2824079919UL, 1820633139UL, +3686495295UL, 3978521319UL, 1734452426UL, 4105472656UL, 1771256166UL, 1578071897UL, 1972844727UL, 2048372515UL, 3002132226UL, 1889169118UL, 2932142799UL, 2166712623UL, 592016143UL, 1116895096UL, 889321536UL, 375621825UL, 2935845994UL, 1982459859UL, 3336799370UL, 294519309UL, 2661638345UL, 1089335942UL, 227150969UL, 1454919198UL, 3780503305UL, 1862290968UL, 1491836299UL, 766546986UL, 3638407467UL, 925906735UL, 208891816UL, 236714698UL, +2853181150UL, 3889751556UL, 2161215392UL, 853579433UL, 2131555681UL, 1396396345UL, 1088128136UL, 978252562UL, 2134024308UL, 2429920974UL, 1159468871UL, 2395949266UL, 1441791888UL, 916521377UL, 3950270431UL, 2663319810UL, 3873120593UL, 2080989388UL, 2896532502UL, 3176181708UL, 1736685126UL, 4081767288UL, 3515770288UL, 1371473598UL, 1491850178UL, 4284949727UL, 2774513541UL, 1541596000UL, 3948112869UL, 2114538326UL, 2641532252UL, 1837244955UL, +2292505300UL, 3179787565UL, 639953781UL, 785902378UL, 3852544833UL, 553508260UL, 23014564UL, 106722100UL, 2705412979UL, 3449440367UL, 950636401UL, 870804158UL, 629831074UL, 424163855UL, 373653940UL, 2739378330UL, 377730945UL, 418426029UL, 267367218UL, 554678849UL, 4222664331UL, 3346048120UL, 1870226737UL, 2435616108UL, 3747040233UL, 698046507UL, 1671346285UL, 4127293033UL, 568612264UL, 3467142937UL, 1627988025UL, 1305525598UL, +}, +{ +2246605826UL, 215030128UL, 871645668UL, 3402612852UL, 423273439UL, 316965236UL, 47416561UL, 1470716454UL, 2288582385UL, 2021890755UL, 2148091363UL, 167227868UL, 3085506034UL, 3365950545UL, 1170282137UL, 1345986409UL, 197195155UL, 2644113318UL, 2491271090UL, 2597072003UL, 170335901UL, 2540851884UL, 2584420407UL, 3609142920UL, 3052130502UL, 4018095157UL, 2850805299UL, 2777821400UL, 110647395UL, 3262987676UL, 1447103309UL, 3632575579UL, +3243210595UL, 1892770504UL, 4214485953UL, 38676169UL, 2431628817UL, 2836918800UL, 272023527UL, 2825888902UL, 2794421955UL, 2354379386UL, 452404203UL, 584718212UL, 1915053836UL, 1455821656UL, 4264066935UL, 1150980581UL, 3792433350UL, 3104909316UL, 441521402UL, 3807587668UL, 275969953UL, 3970844623UL, 3323695518UL, 3909107329UL, 290225599UL, 957520066UL, 4048181850UL, 2623778463UL, 1957371891UL, 540091753UL, 3072448879UL, 2386916346UL, +392549194UL, 1261391184UL, 4137605148UL, 314807135UL, 2916930821UL, 3168561018UL, 2332027308UL, 1967082817UL, 1849256214UL, 1141134412UL, 1206824012UL, 2088102210UL, 4170914605UL, 3399892824UL, 59190648UL, 1657183299UL, 1314626253UL, 500606287UL, 413229420UL, 1245395908UL, 664681UL, 2726979120UL, 3408998445UL, 2318397638UL, 1882820077UL, 2073055266UL, 4262833629UL, 1348801932UL, 229857331UL, 3086071450UL, 1327801028UL, 812015573UL, +2214355282UL, 2232635690UL, 3162540418UL, 2049877621UL, 470752564UL, 2527480795UL, 1285499716UL, 220173566UL, 4239277569UL, 788168494UL, 3748855859UL, 1360707769UL, 449512212UL, 1238219398UL, 2880205975UL, 2755133627UL, 372409230UL, 411800575UL, 2455333195UL, 4080817864UL, 3556684908UL, 2857940866UL, 1969081563UL, 2526852668UL, 1026062474UL, 1849785784UL, 3552290093UL, 4214448UL, 460332681UL, 30890894UL, 1108618048UL, 272438799UL, +3339891045UL, 1512685591UL, 1310038443UL, 2431938882UL, 1478442144UL, 2804640700UL, 3426381347UL, 861206186UL, 290322827UL, 2736623609UL, 327318125UL, 1922859957UL, 1939922519UL, 3539608908UL, 3442377433UL, 3868710131UL, 2244493875UL, 47774461UL, 3858864626UL, 3294523981UL, 1798515481UL, 565017248UL, 2633378137UL, 811307482UL, 1743357106UL, 419676111UL, 1688841846UL, 1799884674UL, 1720546272UL, 3900863156UL, 3506303345UL, 1719438472UL, +576775454UL, 2246605826UL, 215030128UL, 871645668UL, 3402612852UL, 619000856UL, 316965236UL, 47416561UL, 1470716454UL, 2288582385UL, 3464704266UL, 2148091363UL, 167227868UL, 3085506034UL, 3365950545UL, 901169164UL, 1345986409UL, 197195155UL, 2644113318UL, 2491271090UL, 3243741640UL, 170335901UL, 2540851884UL, 2584420407UL, 3609142920UL, 2051834116UL, 4018095157UL, 2850805299UL, 2777821400UL, 110647395UL, 2822981113UL, 1447103309UL, +3632575579UL, 3243210595UL, 1892770504UL, 1947501555UL, 38676169UL, 2431628817UL, 2836918800UL, 272023527UL, 4010280501UL, 2794421955UL, 2354379386UL, 452404203UL, 584718212UL, 3991257933UL, 1455821656UL, 4264066935UL, 1150980581UL, 3792433350UL, 2151631692UL, 441521402UL, 3807587668UL, 275969953UL, 3970844623UL, 3965914153UL, 3909107329UL, 290225599UL, 957520066UL, 4048181850UL, 4011285909UL, 1957371891UL, 540091753UL, 3072448879UL, +2386916346UL, 1347453316UL, 1261391184UL, 4137605148UL, 314807135UL, 2916930821UL, 840822698UL, 2332027308UL, 1967082817UL, 1849256214UL, 1141134412UL, 960593185UL, 2088102210UL, 4170914605UL, 3399892824UL, 59190648UL, 2261593014UL, 1314626253UL, 500606287UL, 413229420UL, 1245395908UL, 3401527918UL, 2726979120UL, 3408998445UL, 2318397638UL, 1882820077UL, 1683077666UL, 4262833629UL, 1348801932UL, 229857331UL, 3086071450UL, 3363644507UL, +812015573UL, 2214355282UL, 2232635690UL, 3162540418UL, 3579858747UL, 470752564UL, 2527480795UL, 1285499716UL, 220173566UL, 2294101261UL, 788168494UL, 3748855859UL, 1360707769UL, 449512212UL, 28595866UL, 2880205975UL, 2755133627UL, 372409230UL, 411800575UL, 1905311140UL, 4080817864UL, 3556684908UL, 2857940866UL, 1969081563UL, 148561593UL, 1026062474UL, 1849785784UL, 3552290093UL, 4214448UL, 2237247821UL, 30890894UL, 1108618048UL, +272438799UL, 3339891045UL, 169576507UL, 1310038443UL, 2431938882UL, 1478442144UL, 2804640700UL, 4119485855UL, 861206186UL, 290322827UL, 2736623609UL, 327318125UL, 3408620608UL, 1939922519UL, 3539608908UL, 3442377433UL, 3868710131UL, 1188056275UL, 47774461UL, 3858864626UL, 3294523981UL, 1798515481UL, 1228896851UL, 2633378137UL, 811307482UL, 1743357106UL, 419676111UL, 3111013241UL, 1799884674UL, 1720546272UL, 3900863156UL, 3506303345UL, +1474164586UL, 576775454UL, 2246605826UL, 215030128UL, 871645668UL, 2968519387UL, 619000856UL, 316965236UL, 47416561UL, 1470716454UL, 9648980UL, 3464704266UL, 2148091363UL, 167227868UL, 3085506034UL, 1505294373UL, 901169164UL, 1345986409UL, 197195155UL, 2644113318UL, 1227359150UL, 3243741640UL, 170335901UL, 2540851884UL, 2584420407UL, 1205921163UL, 2051834116UL, 4018095157UL, 2850805299UL, 2777821400UL, 2967529310UL, 2822981113UL, +1447103309UL, 3632575579UL, 3243210595UL, 532996977UL, 1947501555UL, 38676169UL, 2431628817UL, 2836918800UL, 1761031313UL, 4010280501UL, 2794421955UL, 2354379386UL, 452404203UL, 1222630846UL, 3991257933UL, 1455821656UL, 4264066935UL, 1150980581UL, 2344548386UL, 2151631692UL, 441521402UL, 3807587668UL, 275969953UL, 963889269UL, 3965914153UL, 3909107329UL, 290225599UL, 957520066UL, 4176220201UL, 4011285909UL, 1957371891UL, 540091753UL, +3072448879UL, 1810164615UL, 1347453316UL, 1261391184UL, 4137605148UL, 314807135UL, 2672526663UL, 840822698UL, 2332027308UL, 1967082817UL, 1849256214UL, 734862208UL, 960593185UL, 2088102210UL, 4170914605UL, 3399892824UL, 2471507530UL, 2261593014UL, 1314626253UL, 500606287UL, 413229420UL, 970185057UL, 3401527918UL, 2726979120UL, 3408998445UL, 2318397638UL, 708987193UL, 1683077666UL, 4262833629UL, 1348801932UL, 229857331UL, 749849397UL, +3363644507UL, 812015573UL, 2214355282UL, 2232635690UL, 2901095495UL, 3579858747UL, 470752564UL, 2527480795UL, 1285499716UL, 941862108UL, 2294101261UL, 788168494UL, 3748855859UL, 1360707769UL, 3818227212UL, 28595866UL, 2880205975UL, 2755133627UL, 372409230UL, 570110534UL, 1905311140UL, 4080817864UL, 3556684908UL, 2857940866UL, 2253777974UL, 148561593UL, 1026062474UL, 1849785784UL, 3552290093UL, 1525559608UL, 2237247821UL, 30890894UL, +1108618048UL, 272438799UL, 3996203631UL, 169576507UL, 1310038443UL, 2431938882UL, 1478442144UL, 2857841871UL, 4119485855UL, 861206186UL, 290322827UL, 2736623609UL, 1184217272UL, 3408620608UL, 1939922519UL, 3539608908UL, 3442377433UL, 1263700272UL, 1188056275UL, 47774461UL, 3858864626UL, 3294523981UL, 2611619UL, 1228896851UL, 2633378137UL, 811307482UL, 1743357106UL, 1930089302UL, 3111013241UL, 1799884674UL, 1720546272UL, 3900863156UL, +2370003471UL, 1474164586UL, 576775454UL, 2246605826UL, 215030128UL, 540197019UL, 2968519387UL, 619000856UL, 316965236UL, 47416561UL, 3585128733UL, 9648980UL, 3464704266UL, 2148091363UL, 167227868UL, 509283324UL, 1505294373UL, 901169164UL, 1345986409UL, 197195155UL, 3983525470UL, 1227359150UL, 3243741640UL, 170335901UL, 2540851884UL, 2812935262UL, 1205921163UL, 2051834116UL, 4018095157UL, 2850805299UL, 2798430304UL, 2967529310UL, +2822981113UL, 1447103309UL, 3632575579UL, 389184524UL, 532996977UL, 1947501555UL, 38676169UL, 2431628817UL, 1055068556UL, 1761031313UL, 4010280501UL, 2794421955UL, 2354379386UL, 965687576UL, 1222630846UL, 3991257933UL, 1455821656UL, 4264066935UL, 1551000086UL, 2344548386UL, 2151631692UL, 441521402UL, 3807587668UL, 3701529910UL, 963889269UL, 3965914153UL, 3909107329UL, 290225599UL, 1771599976UL, 4176220201UL, 4011285909UL, 1957371891UL, +540091753UL, 1670159873UL, 1810164615UL, 1347453316UL, 1261391184UL, 4137605148UL, 4191698993UL, 2672526663UL, 840822698UL, 2332027308UL, 1967082817UL, 3098515331UL, 734862208UL, 960593185UL, 2088102210UL, 4170914605UL, 2470055060UL, 2471507530UL, 2261593014UL, 1314626253UL, 500606287UL, 1100764382UL, 970185057UL, 3401527918UL, 2726979120UL, 3408998445UL, 4100198161UL, 708987193UL, 1683077666UL, 4262833629UL, 1348801932UL, 3744209503UL, +749849397UL, 3363644507UL, 812015573UL, 2214355282UL, 3217409412UL, 2901095495UL, 3579858747UL, 470752564UL, 2527480795UL, 552979949UL, 941862108UL, 2294101261UL, 788168494UL, 3748855859UL, 2355231228UL, 3818227212UL, 28595866UL, 2880205975UL, 2755133627UL, 833553378UL, 570110534UL, 1905311140UL, 4080817864UL, 3556684908UL, 4124102038UL, 2253777974UL, 148561593UL, 1026062474UL, 1849785784UL, 656329297UL, 1525559608UL, 2237247821UL, +30890894UL, 1108618048UL, 1464443032UL, 3996203631UL, 169576507UL, 1310038443UL, 2431938882UL, 2100788071UL, 2857841871UL, 4119485855UL, 861206186UL, 290322827UL, 3653047356UL, 1184217272UL, 3408620608UL, 1939922519UL, 3539608908UL, 4267170500UL, 1263700272UL, 1188056275UL, 47774461UL, 3858864626UL, 1046565728UL, 2611619UL, 1228896851UL, 2633378137UL, 811307482UL, 1312393456UL, 1930089302UL, 3111013241UL, 1799884674UL, 1720546272UL, +1199041144UL, 2406753856UL, 2108495166UL, 2126345981UL, 1524975128UL, 1269232392UL, 3162531748UL, 3076707658UL, 1736955170UL, 1036221745UL, 1232435193UL, 3945348482UL, 1057631163UL, 520376289UL, 4154435769UL, 1280565077UL, 1865705876UL, 1030078366UL, 1140849319UL, 1769263412UL, 1161866807UL, 2768552980UL, 561022685UL, 2712685799UL, 1501252058UL, 3608433719UL, 3138564149UL, 4093654128UL, 1218455911UL, 892700607UL, 2012017510UL, 3568315757UL, +4002239824UL, 1754440379UL, 2641708101UL, 1027390781UL, 199831087UL, 1261208885UL, 2058433786UL, 2101649235UL, 220966013UL, 3445375335UL, 1100438514UL, 4075559840UL, 4244062658UL, 3417249884UL, 150102478UL, 3337395219UL, 2464869101UL, 3720375949UL, 93353579UL, 2329780067UL, 777826834UL, 2745626035UL, 2984812746UL, 568848158UL, 1593919595UL, 1166619196UL, 96177504UL, 305329591UL, 4271176854UL, 3829149188UL, 1551058535UL, 2828280993UL, +1367551996UL, 4208083082UL, 2260803683UL, 3118708147UL, 434935608UL, 702805370UL, 3544156958UL, 792712531UL, 231019757UL, 136272259UL, 4049968615UL, 2722527811UL, 603697698UL, 2891035509UL, 4270409302UL, 1220615076UL, 1932569338UL, 1084454986UL, 468729683UL, 2377913518UL, 2068946556UL, 530579176UL, 1422294615UL, 4032799503UL, 2065706770UL, 604700228UL, 98049660UL, 3182511353UL, 935830212UL, 1938107848UL, 1266035034UL, 957505506UL, +2758220503UL, 1805223938UL, 3393041584UL, 3958541336UL, 2695487012UL, 3355668819UL, 276889675UL, 3098939423UL, 415941187UL, 180737121UL, 2638873657UL, 1103150707UL, 4255168358UL, 2736183195UL, 1275942292UL, 2687807236UL, 538129710UL, 3337005391UL, 3941968393UL, 1113153386UL, 3813628384UL, 1775835369UL, 296314749UL, 1697642748UL, 3614403315UL, 1953056095UL, 2102878063UL, 3161706344UL, 2207159580UL, 3078233525UL, 3836286614UL, 886914072UL, +1884037075UL, 4135819784UL, 1616380780UL, 1672616998UL, 3879848699UL, 2277472209UL, 3933249848UL, 2428044648UL, 2876076879UL, 165724720UL, 2277165385UL, 1984963196UL, 1456923194UL, 2406217222UL, 3388886718UL, 47522558UL, 1903557801UL, 1959641458UL, 2325355446UL, 3251147398UL, 2266553941UL, 2243962024UL, 1420017618UL, 1791159474UL, 1793406225UL, 601509698UL, 3207357979UL, 1189285184UL, 148538800UL, 2077251302UL, 3267239327UL, 2851475997UL, +}, +{ +2628162153UL, 3861478870UL, 2769884494UL, 3423483820UL, 1118276924UL, 536776894UL, 3742490940UL, 550084334UL, 2441329856UL, 2604618499UL, 2308745810UL, 1178166365UL, 1345165241UL, 4039508109UL, 1246601384UL, 3843182157UL, 2200144237UL, 91750284UL, 4290064840UL, 3363597477UL, 3243492274UL, 4271100308UL, 4186328336UL, 2291901989UL, 1834723222UL, 372220743UL, 2190417067UL, 2624886324UL, 3567647862UL, 1591175369UL, 2278087682UL, 2461678432UL, +232820452UL, 2714694382UL, 3070258434UL, 2412655444UL, 2667664607UL, 249083056UL, 4166379751UL, 1360927521UL, 2247816079UL, 3253689753UL, 1563674427UL, 1914999382UL, 2101454952UL, 1067816947UL, 1098201917UL, 4054175236UL, 1805828534UL, 1815913104UL, 738357340UL, 2597170030UL, 1689737432UL, 2004663483UL, 1160995461UL, 1008175050UL, 2004702919UL, 4258654415UL, 938972594UL, 2121583885UL, 2208729114UL, 276726877UL, 3973538591UL, 2991069145UL, +2345655326UL, 2980162173UL, 1915611444UL, 2332104940UL, 2382102873UL, 2324437093UL, 2640563452UL, 2680619359UL, 3413490949UL, 2140843463UL, 2424016743UL, 3735508133UL, 3421831326UL, 4037977349UL, 3721506282UL, 510431975UL, 1014707294UL, 1378686477UL, 1939678832UL, 2223101760UL, 2067687989UL, 309274614UL, 276596103UL, 3757624719UL, 1212251468UL, 2649271847UL, 4140361758UL, 2634738350UL, 2029358730UL, 3205861896UL, 3090549771UL, 3775019657UL, +2018542036UL, 3675805680UL, 3946144023UL, 331655838UL, 326568491UL, 1867863527UL, 1550945400UL, 3087000670UL, 2342003578UL, 3949479453UL, 586483056UL, 147951307UL, 503062740UL, 3823927166UL, 2789767841UL, 3121654578UL, 634238762UL, 4084629478UL, 3878778788UL, 435990088UL, 1724770389UL, 1403031256UL, 1334135626UL, 1096780503UL, 3288769545UL, 2793293893UL, 80675548UL, 1637232257UL, 1856565474UL, 2675485635UL, 1961165681UL, 1647512786UL, +4190102851UL, 4081320784UL, 2853183400UL, 3812341867UL, 278236392UL, 1700614299UL, 2765246084UL, 3846866009UL, 1220806787UL, 3655684157UL, 1133921183UL, 2779125219UL, 523552281UL, 703813725UL, 3110126767UL, 823843890UL, 290243102UL, 821297176UL, 364959993UL, 3381862130UL, 2305271841UL, 356059263UL, 2558018765UL, 3235968999UL, 1070598970UL, 2444411636UL, 3636221117UL, 4275517214UL, 4035198865UL, 3339014315UL, 2911872812UL, 4049586122UL, +4211583637UL, 2628162153UL, 3861478870UL, 2769884494UL, 3423483820UL, 3254616321UL, 536776894UL, 3742490940UL, 550084334UL, 2441329856UL, 1909596092UL, 2308745810UL, 1178166365UL, 1345165241UL, 4039508109UL, 1349347043UL, 3843182157UL, 2200144237UL, 91750284UL, 4290064840UL, 803098068UL, 3243492274UL, 4271100308UL, 4186328336UL, 2291901989UL, 2575673198UL, 372220743UL, 2190417067UL, 2624886324UL, 3567647862UL, 132569424UL, 2278087682UL, +2461678432UL, 232820452UL, 2714694382UL, 3490648253UL, 2412655444UL, 2667664607UL, 249083056UL, 4166379751UL, 3503294711UL, 2247816079UL, 3253689753UL, 1563674427UL, 1914999382UL, 3121933565UL, 1067816947UL, 1098201917UL, 4054175236UL, 1805828534UL, 816420552UL, 738357340UL, 2597170030UL, 1689737432UL, 2004663483UL, 397934907UL, 1008175050UL, 2004702919UL, 4258654415UL, 938972594UL, 156733019UL, 2208729114UL, 276726877UL, 3973538591UL, +2991069145UL, 2470446383UL, 2980162173UL, 1915611444UL, 2332104940UL, 2382102873UL, 3265195583UL, 2640563452UL, 2680619359UL, 3413490949UL, 2140843463UL, 142464483UL, 3735508133UL, 3421831326UL, 4037977349UL, 3721506282UL, 1898668265UL, 1014707294UL, 1378686477UL, 1939678832UL, 2223101760UL, 4085776926UL, 309274614UL, 276596103UL, 3757624719UL, 1212251468UL, 1116423339UL, 4140361758UL, 2634738350UL, 2029358730UL, 3205861896UL, 880658361UL, +3775019657UL, 2018542036UL, 3675805680UL, 3946144023UL, 839516623UL, 326568491UL, 1867863527UL, 1550945400UL, 3087000670UL, 420309880UL, 3949479453UL, 586483056UL, 147951307UL, 503062740UL, 416618471UL, 2789767841UL, 3121654578UL, 634238762UL, 4084629478UL, 1120413065UL, 435990088UL, 1724770389UL, 1403031256UL, 1334135626UL, 240966420UL, 3288769545UL, 2793293893UL, 80675548UL, 1637232257UL, 1785064235UL, 2675485635UL, 1961165681UL, +1647512786UL, 4190102851UL, 2775407492UL, 2853183400UL, 3812341867UL, 278236392UL, 1700614299UL, 2439624528UL, 3846866009UL, 1220806787UL, 3655684157UL, 1133921183UL, 366933679UL, 523552281UL, 703813725UL, 3110126767UL, 823843890UL, 132468066UL, 821297176UL, 364959993UL, 3381862130UL, 2305271841UL, 1048450041UL, 2558018765UL, 3235968999UL, 1070598970UL, 2444411636UL, 1699430013UL, 4275517214UL, 4035198865UL, 3339014315UL, 2911872812UL, +324524850UL, 4211583637UL, 2628162153UL, 3861478870UL, 2769884494UL, 1995585079UL, 3254616321UL, 536776894UL, 3742490940UL, 550084334UL, 2121458511UL, 1909596092UL, 2308745810UL, 1178166365UL, 1345165241UL, 3067877274UL, 1349347043UL, 3843182157UL, 2200144237UL, 91750284UL, 1246148630UL, 803098068UL, 3243492274UL, 4271100308UL, 4186328336UL, 2932236493UL, 2575673198UL, 372220743UL, 2190417067UL, 2624886324UL, 3945294599UL, 132569424UL, +2278087682UL, 2461678432UL, 232820452UL, 3341915918UL, 3490648253UL, 2412655444UL, 2667664607UL, 249083056UL, 2307336284UL, 3503294711UL, 2247816079UL, 3253689753UL, 1563674427UL, 1717494311UL, 3121933565UL, 1067816947UL, 1098201917UL, 4054175236UL, 971917867UL, 816420552UL, 738357340UL, 2597170030UL, 1689737432UL, 243915062UL, 397934907UL, 1008175050UL, 2004702919UL, 4258654415UL, 1807067458UL, 156733019UL, 2208729114UL, 276726877UL, +3973538591UL, 1909483753UL, 2470446383UL, 2980162173UL, 1915611444UL, 2332104940UL, 3454651559UL, 3265195583UL, 2640563452UL, 2680619359UL, 3413490949UL, 462852932UL, 142464483UL, 3735508133UL, 3421831326UL, 4037977349UL, 1372088341UL, 1898668265UL, 1014707294UL, 1378686477UL, 1939678832UL, 752503486UL, 4085776926UL, 309274614UL, 276596103UL, 3757624719UL, 4193030119UL, 1116423339UL, 4140361758UL, 2634738350UL, 2029358730UL, 1725105892UL, +880658361UL, 3775019657UL, 2018542036UL, 3675805680UL, 3496508290UL, 839516623UL, 326568491UL, 1867863527UL, 1550945400UL, 2685835387UL, 420309880UL, 3949479453UL, 586483056UL, 147951307UL, 1639139280UL, 416618471UL, 2789767841UL, 3121654578UL, 634238762UL, 3622035469UL, 1120413065UL, 435990088UL, 1724770389UL, 1403031256UL, 3548817929UL, 240966420UL, 3288769545UL, 2793293893UL, 80675548UL, 3119506726UL, 1785064235UL, 2675485635UL, +1961165681UL, 1647512786UL, 4019542081UL, 2775407492UL, 2853183400UL, 3812341867UL, 278236392UL, 3487875111UL, 2439624528UL, 3846866009UL, 1220806787UL, 3655684157UL, 3303554633UL, 366933679UL, 523552281UL, 703813725UL, 3110126767UL, 2477354049UL, 132468066UL, 821297176UL, 364959993UL, 3381862130UL, 4065162466UL, 1048450041UL, 2558018765UL, 3235968999UL, 1070598970UL, 191819556UL, 1699430013UL, 4275517214UL, 4035198865UL, 3339014315UL, +3588518026UL, 324524850UL, 4211583637UL, 2628162153UL, 3861478870UL, 3361198093UL, 1995585079UL, 3254616321UL, 536776894UL, 3742490940UL, 3912424229UL, 2121458511UL, 1909596092UL, 2308745810UL, 1178166365UL, 1882174246UL, 3067877274UL, 1349347043UL, 3843182157UL, 2200144237UL, 1210030640UL, 1246148630UL, 803098068UL, 3243492274UL, 4271100308UL, 402141998UL, 2932236493UL, 2575673198UL, 372220743UL, 2190417067UL, 1883679642UL, 3945294599UL, +132569424UL, 2278087682UL, 2461678432UL, 708189294UL, 3341915918UL, 3490648253UL, 2412655444UL, 2667664607UL, 2871800434UL, 2307336284UL, 3503294711UL, 2247816079UL, 3253689753UL, 2113837945UL, 1717494311UL, 3121933565UL, 1067816947UL, 1098201917UL, 1041869160UL, 971917867UL, 816420552UL, 738357340UL, 2597170030UL, 2306273930UL, 243915062UL, 397934907UL, 1008175050UL, 2004702919UL, 2345434637UL, 1807067458UL, 156733019UL, 2208729114UL, +276726877UL, 2452083872UL, 1909483753UL, 2470446383UL, 2980162173UL, 1915611444UL, 2043489400UL, 3454651559UL, 3265195583UL, 2640563452UL, 2680619359UL, 2845757473UL, 462852932UL, 142464483UL, 3735508133UL, 3421831326UL, 25103542UL, 1372088341UL, 1898668265UL, 1014707294UL, 1378686477UL, 2680788341UL, 752503486UL, 4085776926UL, 309274614UL, 276596103UL, 3663266970UL, 4193030119UL, 1116423339UL, 4140361758UL, 2634738350UL, 453005903UL, +1725105892UL, 880658361UL, 3775019657UL, 2018542036UL, 2601909713UL, 3496508290UL, 839516623UL, 326568491UL, 1867863527UL, 3474340574UL, 2685835387UL, 420309880UL, 3949479453UL, 586483056UL, 297934218UL, 1639139280UL, 416618471UL, 2789767841UL, 3121654578UL, 958889718UL, 3622035469UL, 1120413065UL, 435990088UL, 1724770389UL, 2589603756UL, 3548817929UL, 240966420UL, 3288769545UL, 2793293893UL, 972899860UL, 3119506726UL, 1785064235UL, +2675485635UL, 1961165681UL, 2576799764UL, 4019542081UL, 2775407492UL, 2853183400UL, 3812341867UL, 159345352UL, 3487875111UL, 2439624528UL, 3846866009UL, 1220806787UL, 3367080935UL, 3303554633UL, 366933679UL, 523552281UL, 703813725UL, 1717395617UL, 2477354049UL, 132468066UL, 821297176UL, 364959993UL, 1088290332UL, 4065162466UL, 1048450041UL, 2558018765UL, 3235968999UL, 285340039UL, 191819556UL, 1699430013UL, 4275517214UL, 4035198865UL, +3544133220UL, 285121978UL, 1175302919UL, 4101282768UL, 513236580UL, 890655666UL, 3051849972UL, 2315486379UL, 3067287276UL, 3134806925UL, 3926373006UL, 2502825498UL, 461387883UL, 770459119UL, 3121636621UL, 1243065093UL, 1612354797UL, 659033930UL, 621176955UL, 214256518UL, 371573588UL, 1168438671UL, 1233027650UL, 1984255965UL, 659404177UL, 1218841419UL, 1226193512UL, 4247589702UL, 334814687UL, 980422670UL, 2518384561UL, 4041002302UL, +1203659320UL, 509643440UL, 2528499450UL, 1512213710UL, 4052651069UL, 1378025938UL, 3436277168UL, 2797728577UL, 463383787UL, 1184681947UL, 283482187UL, 2421891582UL, 3200080903UL, 373817869UL, 452807139UL, 2002545143UL, 1068199574UL, 3390998240UL, 377559317UL, 1548403713UL, 1580741080UL, 253591624UL, 759280679UL, 2174360733UL, 1687952097UL, 1325235423UL, 3856575909UL, 652218568UL, 4130230594UL, 3757998028UL, 1349431618UL, 2870775414UL, +229741978UL, 1900794007UL, 201310771UL, 4075023260UL, 3390078853UL, 3572716207UL, 1959949436UL, 1000128498UL, 1636575064UL, 241058867UL, 2075461870UL, 1819342070UL, 619233032UL, 3164328001UL, 4280892071UL, 4219074185UL, 2719764611UL, 3827656652UL, 4062556527UL, 621515766UL, 2542375627UL, 3901998596UL, 2295087430UL, 2880672054UL, 2940372823UL, 2318642706UL, 914614262UL, 2549699597UL, 2907475284UL, 3901259809UL, 2663167002UL, 3775306719UL, +2212887565UL, 1271873285UL, 3673659531UL, 3856609875UL, 1195785209UL, 1204338358UL, 2785362544UL, 2398696803UL, 3038377816UL, 4288025143UL, 262511310UL, 4151907455UL, 924716723UL, 3298769960UL, 2065938273UL, 3277412030UL, 122636766UL, 2164055077UL, 1000638739UL, 2044933533UL, 2935604716UL, 2772787255UL, 3727331409UL, 1315627932UL, 2610657438UL, 832931652UL, 452359900UL, 681035792UL, 3312648046UL, 1059435047UL, 1489639114UL, 3647631796UL, +417952902UL, 731020350UL, 2847472725UL, 2779076784UL, 2674295324UL, 487600023UL, 2925909449UL, 3997011591UL, 3697231318UL, 967300591UL, 2310856069UL, 684710043UL, 811911286UL, 4174732177UL, 1010656728UL, 702780279UL, 920081774UL, 1578296057UL, 944734808UL, 2884038169UL, 2885919611UL, 2633474915UL, 2508946673UL, 3579216621UL, 656143887UL, 426108406UL, 2166202683UL, 991797657UL, 706498590UL, 561168186UL, 1144619335UL, 3136206425UL, +}, +{ +3600072515UL, 651444872UL, 2348224675UL, 1684848433UL, 1913333701UL, 3413467790UL, 1567802204UL, 2125206188UL, 2463158656UL, 2251055204UL, 4132590383UL, 3192977084UL, 3718261822UL, 3431519430UL, 3506690867UL, 1313208797UL, 637811069UL, 12802085UL, 3456408080UL, 166617386UL, 1764224523UL, 4016338923UL, 2225367442UL, 2461647273UL, 3137989854UL, 373730087UL, 3013524828UL, 242949418UL, 3443491410UL, 3671816408UL, 2391000148UL, 3964107377UL, +716535366UL, 1884597979UL, 3917515811UL, 3441985401UL, 2472173593UL, 4034695117UL, 2486526143UL, 1658764329UL, 1873516415UL, 884116165UL, 814992460UL, 1069506245UL, 3797556389UL, 838088473UL, 2279863068UL, 1002637017UL, 4174541774UL, 644478743UL, 4138151954UL, 4030442072UL, 297710349UL, 3507828614UL, 1403493362UL, 3132267322UL, 227377796UL, 388148240UL, 2760904473UL, 352998924UL, 1603734504UL, 1528807885UL, 2283620218UL, 737730350UL, +2761342715UL, 809367801UL, 1667936422UL, 1510238771UL, 3762862328UL, 1171532060UL, 647580587UL, 1460988169UL, 3944640945UL, 2331043627UL, 1965076564UL, 2913596196UL, 2960957119UL, 1316491503UL, 3086954934UL, 3471945989UL, 2485431762UL, 692294537UL, 3148362914UL, 3371415765UL, 2990795967UL, 706771848UL, 3734467362UL, 2768750385UL, 2061275631UL, 3935582473UL, 1449841372UL, 1239527551UL, 592595530UL, 1685341001UL, 3352323357UL, 4147988039UL, +4003871917UL, 4035869533UL, 3022833195UL, 1266052547UL, 1429645393UL, 565106475UL, 327014810UL, 348739711UL, 3262918351UL, 915509292UL, 397356303UL, 3248246752UL, 1122821778UL, 2373765260UL, 1795464380UL, 3485315196UL, 1731529670UL, 86888382UL, 2789587372UL, 850847993UL, 1794523220UL, 577288126UL, 1996569530UL, 909222664UL, 2601642298UL, 1469035973UL, 2727135938UL, 3467853736UL, 633292505UL, 756260381UL, 41782389UL, 226724724UL, +3633968708UL, 1695315503UL, 1846857904UL, 3185630605UL, 823108172UL, 3609336496UL, 3422558797UL, 2865413534UL, 564221408UL, 591845835UL, 2498463433UL, 3573926554UL, 1336639597UL, 4180084026UL, 3195588503UL, 2822864841UL, 1916459886UL, 2073158796UL, 56968669UL, 1234765864UL, 2456093821UL, 3500058416UL, 3146725645UL, 3295822468UL, 4135196531UL, 628000231UL, 745509757UL, 4143543278UL, 1941480444UL, 3607603517UL, 2288239329UL, 1991437813UL, +4081693775UL, 3600072515UL, 651444872UL, 2348224675UL, 1684848433UL, 3748890341UL, 3413467790UL, 1567802204UL, 2125206188UL, 2463158656UL, 1516568259UL, 4132590383UL, 3192977084UL, 3718261822UL, 3431519430UL, 461466951UL, 1313208797UL, 637811069UL, 12802085UL, 3456408080UL, 3444149988UL, 1764224523UL, 4016338923UL, 2225367442UL, 2461647273UL, 2594402002UL, 373730087UL, 3013524828UL, 242949418UL, 3443491410UL, 2740782133UL, 2391000148UL, +3964107377UL, 716535366UL, 1884597979UL, 3161911677UL, 3441985401UL, 2472173593UL, 4034695117UL, 2486526143UL, 3623045141UL, 1873516415UL, 884116165UL, 814992460UL, 1069506245UL, 1053106195UL, 838088473UL, 2279863068UL, 1002637017UL, 4174541774UL, 1806935386UL, 4138151954UL, 4030442072UL, 297710349UL, 3507828614UL, 2328331779UL, 3132267322UL, 227377796UL, 388148240UL, 2760904473UL, 3654577129UL, 1603734504UL, 1528807885UL, 2283620218UL, +737730350UL, 2134741424UL, 809367801UL, 1667936422UL, 1510238771UL, 3762862328UL, 4084104273UL, 647580587UL, 1460988169UL, 3944640945UL, 2331043627UL, 3458437694UL, 2913596196UL, 2960957119UL, 1316491503UL, 3086954934UL, 2404530503UL, 2485431762UL, 692294537UL, 3148362914UL, 3371415765UL, 3697728317UL, 706771848UL, 3734467362UL, 2768750385UL, 2061275631UL, 1337146928UL, 1449841372UL, 1239527551UL, 592595530UL, 1685341001UL, 3121493408UL, +4147988039UL, 4003871917UL, 4035869533UL, 3022833195UL, 2709537023UL, 1429645393UL, 565106475UL, 327014810UL, 348739711UL, 1278935671UL, 915509292UL, 397356303UL, 3248246752UL, 1122821778UL, 1086107506UL, 1795464380UL, 3485315196UL, 1731529670UL, 86888382UL, 3645735256UL, 850847993UL, 1794523220UL, 577288126UL, 1996569530UL, 1126950UL, 2601642298UL, 1469035973UL, 2727135938UL, 3467853736UL, 3668777652UL, 756260381UL, 41782389UL, +226724724UL, 3633968708UL, 738274780UL, 1846857904UL, 3185630605UL, 823108172UL, 3609336496UL, 3371270228UL, 2865413534UL, 564221408UL, 591845835UL, 2498463433UL, 4157618574UL, 1336639597UL, 4180084026UL, 3195588503UL, 2822864841UL, 3844986377UL, 2073158796UL, 56968669UL, 1234765864UL, 2456093821UL, 1001761927UL, 3146725645UL, 3295822468UL, 4135196531UL, 628000231UL, 541676954UL, 4143543278UL, 1941480444UL, 3607603517UL, 2288239329UL, +1068806322UL, 4081693775UL, 3600072515UL, 651444872UL, 2348224675UL, 47991343UL, 3748890341UL, 3413467790UL, 1567802204UL, 2125206188UL, 2662653600UL, 1516568259UL, 4132590383UL, 3192977084UL, 3718261822UL, 2554440323UL, 461466951UL, 1313208797UL, 637811069UL, 12802085UL, 982676468UL, 3444149988UL, 1764224523UL, 4016338923UL, 2225367442UL, 451503008UL, 2594402002UL, 373730087UL, 3013524828UL, 242949418UL, 1086137206UL, 2740782133UL, +2391000148UL, 3964107377UL, 716535366UL, 731470002UL, 3161911677UL, 3441985401UL, 2472173593UL, 4034695117UL, 44456710UL, 3623045141UL, 1873516415UL, 884116165UL, 814992460UL, 4004771121UL, 1053106195UL, 838088473UL, 2279863068UL, 1002637017UL, 1587145121UL, 1806935386UL, 4138151954UL, 4030442072UL, 297710349UL, 2570695340UL, 2328331779UL, 3132267322UL, 227377796UL, 388148240UL, 3570998746UL, 3654577129UL, 1603734504UL, 1528807885UL, +2283620218UL, 188017185UL, 2134741424UL, 809367801UL, 1667936422UL, 1510238771UL, 1503613101UL, 4084104273UL, 647580587UL, 1460988169UL, 3944640945UL, 3301866374UL, 3458437694UL, 2913596196UL, 2960957119UL, 1316491503UL, 2674694926UL, 2404530503UL, 2485431762UL, 692294537UL, 3148362914UL, 1645995464UL, 3697728317UL, 706771848UL, 3734467362UL, 2768750385UL, 670964862UL, 1337146928UL, 1449841372UL, 1239527551UL, 592595530UL, 4204421245UL, +3121493408UL, 4147988039UL, 4003871917UL, 4035869533UL, 3652555523UL, 2709537023UL, 1429645393UL, 565106475UL, 327014810UL, 2716443687UL, 1278935671UL, 915509292UL, 397356303UL, 3248246752UL, 204830047UL, 1086107506UL, 1795464380UL, 3485315196UL, 1731529670UL, 662578255UL, 3645735256UL, 850847993UL, 1794523220UL, 577288126UL, 4237140216UL, 1126950UL, 2601642298UL, 1469035973UL, 2727135938UL, 92392213UL, 3668777652UL, 756260381UL, +41782389UL, 226724724UL, 1123105466UL, 738274780UL, 1846857904UL, 3185630605UL, 823108172UL, 2880110296UL, 3371270228UL, 2865413534UL, 564221408UL, 591845835UL, 2356214088UL, 4157618574UL, 1336639597UL, 4180084026UL, 3195588503UL, 4266261353UL, 3844986377UL, 2073158796UL, 56968669UL, 1234765864UL, 3166457679UL, 1001761927UL, 3146725645UL, 3295822468UL, 4135196531UL, 496099322UL, 541676954UL, 4143543278UL, 1941480444UL, 3607603517UL, +2578543796UL, 1068806322UL, 4081693775UL, 3600072515UL, 651444872UL, 1131603264UL, 47991343UL, 3748890341UL, 3413467790UL, 1567802204UL, 2823058381UL, 2662653600UL, 1516568259UL, 4132590383UL, 3192977084UL, 4247798474UL, 2554440323UL, 461466951UL, 1313208797UL, 637811069UL, 2744898822UL, 982676468UL, 3444149988UL, 1764224523UL, 4016338923UL, 2845667517UL, 451503008UL, 2594402002UL, 373730087UL, 3013524828UL, 3442521115UL, 1086137206UL, +2740782133UL, 2391000148UL, 3964107377UL, 4060067791UL, 731470002UL, 3161911677UL, 3441985401UL, 2472173593UL, 4227407417UL, 44456710UL, 3623045141UL, 1873516415UL, 884116165UL, 2550700713UL, 4004771121UL, 1053106195UL, 838088473UL, 2279863068UL, 1296332348UL, 1587145121UL, 1806935386UL, 4138151954UL, 4030442072UL, 2552496880UL, 2570695340UL, 2328331779UL, 3132267322UL, 227377796UL, 3887816270UL, 3570998746UL, 3654577129UL, 1603734504UL, +1528807885UL, 3365552060UL, 188017185UL, 2134741424UL, 809367801UL, 1667936422UL, 1358744245UL, 1503613101UL, 4084104273UL, 647580587UL, 1460988169UL, 2318828416UL, 3301866374UL, 3458437694UL, 2913596196UL, 2960957119UL, 49464436UL, 2674694926UL, 2404530503UL, 2485431762UL, 692294537UL, 1803418945UL, 1645995464UL, 3697728317UL, 706771848UL, 3734467362UL, 2407932841UL, 670964862UL, 1337146928UL, 1449841372UL, 1239527551UL, 1124552917UL, +4204421245UL, 3121493408UL, 4147988039UL, 4003871917UL, 3542256025UL, 3652555523UL, 2709537023UL, 1429645393UL, 565106475UL, 2063548817UL, 2716443687UL, 1278935671UL, 915509292UL, 397356303UL, 1049916999UL, 204830047UL, 1086107506UL, 1795464380UL, 3485315196UL, 2183256184UL, 662578255UL, 3645735256UL, 850847993UL, 1794523220UL, 2943700388UL, 4237140216UL, 1126950UL, 2601642298UL, 1469035973UL, 535075238UL, 92392213UL, 3668777652UL, +756260381UL, 41782389UL, 1043025574UL, 1123105466UL, 738274780UL, 1846857904UL, 3185630605UL, 3324487649UL, 2880110296UL, 3371270228UL, 2865413534UL, 564221408UL, 2528599862UL, 2356214088UL, 4157618574UL, 1336639597UL, 4180084026UL, 592094844UL, 4266261353UL, 3844986377UL, 2073158796UL, 56968669UL, 629503707UL, 3166457679UL, 1001761927UL, 3146725645UL, 3295822468UL, 2725304934UL, 496099322UL, 541676954UL, 4143543278UL, 1941480444UL, +3557859116UL, 31832949UL, 3805791401UL, 4056283801UL, 242812250UL, 4072988068UL, 2316479446UL, 2260433816UL, 2211372380UL, 2039672698UL, 2947948280UL, 4106140026UL, 342600216UL, 98745656UL, 2541799209UL, 926067404UL, 2733213159UL, 3163537903UL, 2800370126UL, 2099121446UL, 1279545581UL, 3699822446UL, 3764095615UL, 690503808UL, 3799637505UL, 1000641330UL, 242588257UL, 3657834529UL, 824791208UL, 2529299371UL, 4081898575UL, 2120338882UL, +1273883107UL, 1680877886UL, 1253060582UL, 1760259553UL, 2250763915UL, 31780198UL, 2511451445UL, 3102141340UL, 861489797UL, 105854693UL, 70927387UL, 2725671050UL, 688282241UL, 2622257646UL, 3466254816UL, 1905008219UL, 2980966436UL, 2154356718UL, 1075686806UL, 1966147415UL, 2357249256UL, 2684600972UL, 400926709UL, 523449509UL, 2891602783UL, 673425710UL, 3766475216UL, 2319843954UL, 3471794777UL, 13838840UL, 1908374660UL, 3839606132UL, +3829795513UL, 3403561639UL, 1369780874UL, 4276407916UL, 3217619UL, 1284482371UL, 2020138237UL, 2804427294UL, 1194369854UL, 1094800747UL, 2119081501UL, 726494474UL, 490750173UL, 1117517565UL, 3498786968UL, 2163060528UL, 696718831UL, 2780121254UL, 1286646297UL, 1594539045UL, 411215116UL, 1407268753UL, 2759136967UL, 2179483407UL, 2088977769UL, 2737453188UL, 2411478102UL, 3112688013UL, 4112484868UL, 429293789UL, 426390687UL, 3158027863UL, +2601897382UL, 1546855515UL, 4258208908UL, 3691263847UL, 2394986813UL, 1986623921UL, 2632462203UL, 3551311099UL, 3309482741UL, 2632571927UL, 1200010240UL, 554555739UL, 4119397989UL, 622818813UL, 3116222066UL, 1801867255UL, 2738500841UL, 1452697246UL, 733457482UL, 1680421668UL, 1035766144UL, 468847991UL, 3606474156UL, 2612692123UL, 730556693UL, 859096521UL, 4005878655UL, 1138273887UL, 2182363629UL, 2710579590UL, 3345140092UL, 2562710857UL, +3859276724UL, 2318176233UL, 3964665794UL, 3295219265UL, 3037789445UL, 371545704UL, 3434130670UL, 3686032092UL, 19964088UL, 340386179UL, 2147090894UL, 1446742483UL, 3083526520UL, 561888846UL, 2903328518UL, 1524465288UL, 360120037UL, 2031515996UL, 1516035872UL, 2752848969UL, 1094251072UL, 984159948UL, 369999653UL, 864602622UL, 2402584241UL, 3028363830UL, 252580667UL, 480470405UL, 3201548259UL, 2739036185UL, 2198549891UL, 1978812013UL, +}, +{ +2546657140UL, 2771792972UL, 3371698159UL, 1137313111UL, 2399264952UL, 1204642544UL, 2090179262UL, 2948712987UL, 2908027331UL, 498636511UL, 2292804841UL, 1480836858UL, 2826016727UL, 196495965UL, 2168559184UL, 3910150715UL, 320076735UL, 3144753899UL, 3199094529UL, 1165806050UL, 728308199UL, 2322528104UL, 2891334400UL, 561853019UL, 4161870615UL, 1348321971UL, 2461357166UL, 1216229488UL, 1392766290UL, 3060494848UL, 3282469664UL, 1866493654UL, +2351421557UL, 4195620347UL, 1512242723UL, 478174598UL, 1087303780UL, 471631659UL, 2599553643UL, 791527994UL, 563537164UL, 1238109907UL, 3218421602UL, 133222502UL, 4182363220UL, 305688802UL, 2666439314UL, 2408520958UL, 787389550UL, 4226450542UL, 4107143646UL, 4103547035UL, 1840887424UL, 2686247491UL, 334267386UL, 3772035402UL, 3436827662UL, 1411515743UL, 2193739735UL, 1892746640UL, 4163192062UL, 2921191805UL, 1011310614UL, 2178118214UL, +33647321UL, 1121452997UL, 507942677UL, 2542792587UL, 351339975UL, 1586639416UL, 1918003826UL, 2513357034UL, 2747854573UL, 606238275UL, 1132105249UL, 574593993UL, 2655425816UL, 1680556547UL, 1831942411UL, 2587194016UL, 90710116UL, 4291431098UL, 1899367028UL, 3251152898UL, 3297078396UL, 2712235924UL, 1546135008UL, 897753268UL, 1619454780UL, 938130143UL, 1828916640UL, 3620488958UL, 1822437033UL, 172584228UL, 1853048226UL, 3659288522UL, +3623450763UL, 1893292786UL, 851522142UL, 3411705687UL, 4106341088UL, 4109830348UL, 1193339049UL, 878885723UL, 2964062476UL, 2320209608UL, 1777678953UL, 2886897705UL, 3856938396UL, 252913914UL, 3648685154UL, 544382669UL, 2631141468UL, 1524405364UL, 1848509666UL, 580646927UL, 2451560151UL, 181916967UL, 1426301928UL, 1652422182UL, 2625099169UL, 176664750UL, 1582626255UL, 1675120608UL, 2571617898UL, 2096572277UL, 2471745846UL, 419906507UL, +886861124UL, 1974832558UL, 3157060904UL, 216000225UL, 746978071UL, 1424984058UL, 1457979883UL, 809822177UL, 3833178010UL, 3926414726UL, 1423462846UL, 3024443248UL, 4067020014UL, 2881559869UL, 1376840097UL, 548130303UL, 1118013762UL, 1309103114UL, 2227304261UL, 4205319357UL, 228947246UL, 2167410411UL, 620496852UL, 2724112116UL, 705259153UL, 3499686911UL, 3085999115UL, 2447267299UL, 4190122199UL, 1091465954UL, 1233728238UL, 39711865UL, +1076751044UL, 2546657140UL, 2771792972UL, 3371698159UL, 1137313111UL, 3857150586UL, 1204642544UL, 2090179262UL, 2948712987UL, 2908027331UL, 368199414UL, 2292804841UL, 1480836858UL, 2826016727UL, 196495965UL, 3235583934UL, 3910150715UL, 320076735UL, 3144753899UL, 3199094529UL, 1374597050UL, 728308199UL, 2322528104UL, 2891334400UL, 561853019UL, 1515915224UL, 1348321971UL, 2461357166UL, 1216229488UL, 1392766290UL, 15252704UL, 3282469664UL, +1866493654UL, 2351421557UL, 4195620347UL, 192355609UL, 478174598UL, 1087303780UL, 471631659UL, 2599553643UL, 1725604263UL, 563537164UL, 1238109907UL, 3218421602UL, 133222502UL, 305098282UL, 305688802UL, 2666439314UL, 2408520958UL, 787389550UL, 3195522899UL, 4107143646UL, 4103547035UL, 1840887424UL, 2686247491UL, 1565529892UL, 3772035402UL, 3436827662UL, 1411515743UL, 2193739735UL, 1848198417UL, 4163192062UL, 2921191805UL, 1011310614UL, +2178118214UL, 3474206203UL, 1121452997UL, 507942677UL, 2542792587UL, 351339975UL, 3599278861UL, 1918003826UL, 2513357034UL, 2747854573UL, 606238275UL, 446979745UL, 574593993UL, 2655425816UL, 1680556547UL, 1831942411UL, 3338512802UL, 90710116UL, 4291431098UL, 1899367028UL, 3251152898UL, 1006512939UL, 2712235924UL, 1546135008UL, 897753268UL, 1619454780UL, 1429190743UL, 1828916640UL, 3620488958UL, 1822437033UL, 172584228UL, 2529855020UL, +3659288522UL, 3623450763UL, 1893292786UL, 851522142UL, 1417935793UL, 4106341088UL, 4109830348UL, 1193339049UL, 878885723UL, 1886400637UL, 2320209608UL, 1777678953UL, 2886897705UL, 3856938396UL, 1813134786UL, 3648685154UL, 544382669UL, 2631141468UL, 1524405364UL, 687661410UL, 580646927UL, 2451560151UL, 181916967UL, 1426301928UL, 1463347373UL, 2625099169UL, 176664750UL, 1582626255UL, 1675120608UL, 3387060344UL, 2096572277UL, 2471745846UL, +419906507UL, 886861124UL, 4209699955UL, 3157060904UL, 216000225UL, 746978071UL, 1424984058UL, 3063941448UL, 809822177UL, 3833178010UL, 3926414726UL, 1423462846UL, 750559587UL, 4067020014UL, 2881559869UL, 1376840097UL, 548130303UL, 4056763004UL, 1309103114UL, 2227304261UL, 4205319357UL, 228947246UL, 774411056UL, 620496852UL, 2724112116UL, 705259153UL, 3499686911UL, 2486247387UL, 2447267299UL, 4190122199UL, 1091465954UL, 1233728238UL, +54639263UL, 1076751044UL, 2546657140UL, 2771792972UL, 3371698159UL, 1152150303UL, 3857150586UL, 1204642544UL, 2090179262UL, 2948712987UL, 452427847UL, 368199414UL, 2292804841UL, 1480836858UL, 2826016727UL, 1929008184UL, 3235583934UL, 3910150715UL, 320076735UL, 3144753899UL, 895636897UL, 1374597050UL, 728308199UL, 2322528104UL, 2891334400UL, 1871824871UL, 1515915224UL, 1348321971UL, 2461357166UL, 1216229488UL, 3170568098UL, 15252704UL, +3282469664UL, 1866493654UL, 2351421557UL, 4253216490UL, 192355609UL, 478174598UL, 1087303780UL, 471631659UL, 4230260400UL, 1725604263UL, 563537164UL, 1238109907UL, 3218421602UL, 960481514UL, 305098282UL, 305688802UL, 2666439314UL, 2408520958UL, 242741163UL, 3195522899UL, 4107143646UL, 4103547035UL, 1840887424UL, 2768321503UL, 1565529892UL, 3772035402UL, 3436827662UL, 1411515743UL, 545362965UL, 1848198417UL, 4163192062UL, 2921191805UL, +1011310614UL, 1196775493UL, 3474206203UL, 1121452997UL, 507942677UL, 2542792587UL, 1948892535UL, 3599278861UL, 1918003826UL, 2513357034UL, 2747854573UL, 4172793632UL, 446979745UL, 574593993UL, 2655425816UL, 1680556547UL, 2986869736UL, 3338512802UL, 90710116UL, 4291431098UL, 1899367028UL, 3376952160UL, 1006512939UL, 2712235924UL, 1546135008UL, 897753268UL, 2061577225UL, 1429190743UL, 1828916640UL, 3620488958UL, 1822437033UL, 4221327184UL, +2529855020UL, 3659288522UL, 3623450763UL, 1893292786UL, 16446898UL, 1417935793UL, 4106341088UL, 4109830348UL, 1193339049UL, 2895194326UL, 1886400637UL, 2320209608UL, 1777678953UL, 2886897705UL, 117861450UL, 1813134786UL, 3648685154UL, 544382669UL, 2631141468UL, 1105253905UL, 687661410UL, 580646927UL, 2451560151UL, 181916967UL, 1605087684UL, 1463347373UL, 2625099169UL, 176664750UL, 1582626255UL, 1993431057UL, 3387060344UL, 2096572277UL, +2471745846UL, 419906507UL, 3219719670UL, 4209699955UL, 3157060904UL, 216000225UL, 746978071UL, 3304126047UL, 3063941448UL, 809822177UL, 3833178010UL, 3926414726UL, 4061584738UL, 750559587UL, 4067020014UL, 2881559869UL, 1376840097UL, 973425409UL, 4056763004UL, 1309103114UL, 2227304261UL, 4205319357UL, 939664759UL, 774411056UL, 620496852UL, 2724112116UL, 705259153UL, 176172666UL, 2486247387UL, 2447267299UL, 4190122199UL, 1091465954UL, +300145620UL, 54639263UL, 1076751044UL, 2546657140UL, 2771792972UL, 188149161UL, 1152150303UL, 3857150586UL, 1204642544UL, 2090179262UL, 626100323UL, 452427847UL, 368199414UL, 2292804841UL, 1480836858UL, 2700509669UL, 1929008184UL, 3235583934UL, 3910150715UL, 320076735UL, 1715326239UL, 895636897UL, 1374597050UL, 728308199UL, 2322528104UL, 2356051490UL, 1871824871UL, 1515915224UL, 1348321971UL, 2461357166UL, 243332180UL, 3170568098UL, +15252704UL, 3282469664UL, 1866493654UL, 4079212881UL, 4253216490UL, 192355609UL, 478174598UL, 1087303780UL, 3787911270UL, 4230260400UL, 1725604263UL, 563537164UL, 1238109907UL, 1147223471UL, 960481514UL, 305098282UL, 305688802UL, 2666439314UL, 1503870433UL, 242741163UL, 3195522899UL, 4107143646UL, 4103547035UL, 4041516761UL, 2768321503UL, 1565529892UL, 3772035402UL, 3436827662UL, 3952861918UL, 545362965UL, 1848198417UL, 4163192062UL, +2921191805UL, 793561655UL, 1196775493UL, 3474206203UL, 1121452997UL, 507942677UL, 3788690254UL, 1948892535UL, 3599278861UL, 1918003826UL, 2513357034UL, 3301940062UL, 4172793632UL, 446979745UL, 574593993UL, 2655425816UL, 667233719UL, 2986869736UL, 3338512802UL, 90710116UL, 4291431098UL, 2027122085UL, 3376952160UL, 1006512939UL, 2712235924UL, 1546135008UL, 2609276017UL, 2061577225UL, 1429190743UL, 1828916640UL, 3620488958UL, 1603195641UL, +4221327184UL, 2529855020UL, 3659288522UL, 3623450763UL, 2313432963UL, 16446898UL, 1417935793UL, 4106341088UL, 4109830348UL, 4106013120UL, 2895194326UL, 1886400637UL, 2320209608UL, 1777678953UL, 1952597964UL, 117861450UL, 1813134786UL, 3648685154UL, 544382669UL, 3108229631UL, 1105253905UL, 687661410UL, 580646927UL, 2451560151UL, 1160575897UL, 1605087684UL, 1463347373UL, 2625099169UL, 176664750UL, 1998534134UL, 1993431057UL, 3387060344UL, +2096572277UL, 2471745846UL, 2246406696UL, 3219719670UL, 4209699955UL, 3157060904UL, 216000225UL, 902956869UL, 3304126047UL, 3063941448UL, 809822177UL, 3833178010UL, 815366736UL, 4061584738UL, 750559587UL, 4067020014UL, 2881559869UL, 350775477UL, 973425409UL, 4056763004UL, 1309103114UL, 2227304261UL, 2047915817UL, 939664759UL, 774411056UL, 620496852UL, 2724112116UL, 3593903529UL, 176172666UL, 2486247387UL, 2447267299UL, 4190122199UL, +1450746791UL, 1521739409UL, 272699299UL, 4113952664UL, 1408743622UL, 4082014187UL, 2454446462UL, 1401621236UL, 2050232096UL, 4204834821UL, 2413497685UL, 1032465253UL, 4276089655UL, 1737267711UL, 3335718398UL, 1924071395UL, 1560525661UL, 3064183869UL, 1775038231UL, 89761304UL, 489201378UL, 1236489133UL, 2774076159UL, 822652970UL, 1583752702UL, 1781766972UL, 2238480533UL, 3428349870UL, 3344555477UL, 2251934941UL, 2533404243UL, 3651295253UL, +2359372862UL, 704049384UL, 3238382362UL, 2405156187UL, 2572833624UL, 531907732UL, 2240111412UL, 4102445586UL, 849739856UL, 3649572083UL, 3317634415UL, 1141345331UL, 1118528358UL, 1664181643UL, 648360156UL, 1364897187UL, 289264571UL, 1625825195UL, 1075970578UL, 3925373833UL, 2780782646UL, 727038162UL, 2824687935UL, 3844230994UL, 2070739238UL, 2437298873UL, 1837327520UL, 4248571219UL, 183041221UL, 3759390508UL, 3881974011UL, 658115161UL, +560642175UL, 32860408UL, 1321227669UL, 1380454450UL, 1676524786UL, 476585241UL, 4034481274UL, 1110506516UL, 815601591UL, 2009522227UL, 2168306897UL, 1856639149UL, 1328281664UL, 2710915389UL, 1886116025UL, 2074502324UL, 23109943UL, 670045122UL, 2926671795UL, 4269143768UL, 2688621201UL, 1618605914UL, 1541217762UL, 4273045819UL, 1029546542UL, 3663663567UL, 1402692384UL, 109336276UL, 2446546057UL, 2225682064UL, 3535545430UL, 3847123891UL, +369718877UL, 3411726117UL, 703735748UL, 3139527634UL, 22388546UL, 998860697UL, 2532911305UL, 1532808237UL, 4170332196UL, 1131906845UL, 1814343609UL, 4161931326UL, 1185668213UL, 1903273604UL, 3466154373UL, 3988139604UL, 1079368270UL, 991305574UL, 898158502UL, 2898908951UL, 651161128UL, 1952607949UL, 1221528540UL, 29979722UL, 3006846808UL, 2911550178UL, 2569412437UL, 1460616937UL, 2127921978UL, 3689931108UL, 950505297UL, 3469337654UL, +3180457017UL, 2316433735UL, 1464678429UL, 2867173456UL, 391248106UL, 3622065314UL, 2143251073UL, 860219584UL, 323835636UL, 340886643UL, 1805485977UL, 109344001UL, 1537119779UL, 1795626099UL, 2568079633UL, 3048040562UL, 1204069532UL, 2488753091UL, 2160014198UL, 3132782711UL, 1266102795UL, 91252225UL, 2018366053UL, 39675212UL, 979320891UL, 343397131UL, 814470367UL, 366655857UL, 3287033048UL, 3379301026UL, 1566381433UL, 3431153818UL, +}, +{ +2234324389UL, 1682296894UL, 3526681456UL, 3988544681UL, 1315506584UL, 1754723911UL, 3607564438UL, 3764062195UL, 3408328234UL, 2385116969UL, 3827569659UL, 4104590721UL, 2612634189UL, 1762747544UL, 1676800931UL, 1814546108UL, 2684685172UL, 1659194343UL, 3381624140UL, 2286640580UL, 688245437UL, 2593335056UL, 1657668516UL, 1161309746UL, 3390664973UL, 2460564382UL, 2811435329UL, 2169200311UL, 2768093584UL, 4288309691UL, 1341061221UL, 1361417084UL, +3060155336UL, 2526021346UL, 1037055386UL, 890124736UL, 2185462193UL, 765141735UL, 1841745804UL, 3562499272UL, 1437907207UL, 2127475991UL, 2845453063UL, 4007976206UL, 4160093314UL, 2717704308UL, 4193767498UL, 1667876711UL, 3477753188UL, 3150367681UL, 3224086539UL, 231347764UL, 2737121599UL, 1230656103UL, 4168131490UL, 1463860373UL, 2760968409UL, 2579133178UL, 2309591728UL, 2958907244UL, 1041094855UL, 685134804UL, 3861095208UL, 1088109135UL, +815655228UL, 2618003265UL, 3454840568UL, 1668276240UL, 1668403077UL, 663034899UL, 4020374281UL, 1896863688UL, 677285319UL, 4047674693UL, 4098535894UL, 2038783953UL, 236635760UL, 3641273565UL, 3568356824UL, 3405704765UL, 186484522UL, 3626346451UL, 3653227559UL, 281949942UL, 1847600066UL, 4168753288UL, 1723123703UL, 3600798445UL, 4267802363UL, 2947454105UL, 468768748UL, 2745777741UL, 26635454UL, 837186232UL, 206931043UL, 2601865569UL, +2021732453UL, 3171165636UL, 786833002UL, 116631308UL, 1604778670UL, 437644814UL, 2437761489UL, 3573139998UL, 2637030522UL, 972076738UL, 4075927397UL, 1427554739UL, 597414077UL, 559325169UL, 1774857312UL, 224593737UL, 3697511293UL, 3905126277UL, 2446278950UL, 1847061846UL, 333176687UL, 2988562696UL, 3623938567UL, 2389910304UL, 4273100167UL, 1673622334UL, 2163644598UL, 3666601063UL, 3971760462UL, 4176957983UL, 565952761UL, 566996714UL, +103136762UL, 3648349163UL, 115456167UL, 3265051494UL, 2826313040UL, 1898888678UL, 3921049266UL, 1276809956UL, 4051866478UL, 959265349UL, 851980436UL, 3105565302UL, 2905096898UL, 342438530UL, 3428101638UL, 912389587UL, 2306839396UL, 3613297213UL, 200159550UL, 3406974927UL, 832121231UL, 2998593393UL, 1242069873UL, 1464281204UL, 1828082526UL, 2620095350UL, 3727900009UL, 986958825UL, 3332332947UL, 1610600284UL, 3193282615UL, 1873987353UL, +537698841UL, 2234324389UL, 1682296894UL, 3526681456UL, 3988544681UL, 1112334635UL, 1754723911UL, 3607564438UL, 3764062195UL, 3408328234UL, 2702680798UL, 3827569659UL, 4104590721UL, 2612634189UL, 1762747544UL, 1596420149UL, 1814546108UL, 2684685172UL, 1659194343UL, 3381624140UL, 2424233156UL, 688245437UL, 2593335056UL, 1657668516UL, 1161309746UL, 260803614UL, 2460564382UL, 2811435329UL, 2169200311UL, 2768093584UL, 1426048416UL, 1341061221UL, +1361417084UL, 3060155336UL, 2526021346UL, 688976997UL, 890124736UL, 2185462193UL, 765141735UL, 1841745804UL, 1113361455UL, 1437907207UL, 2127475991UL, 2845453063UL, 4007976206UL, 1719248425UL, 2717704308UL, 4193767498UL, 1667876711UL, 3477753188UL, 449353539UL, 3224086539UL, 231347764UL, 2737121599UL, 1230656103UL, 2122699205UL, 1463860373UL, 2760968409UL, 2579133178UL, 2309591728UL, 4017154219UL, 1041094855UL, 685134804UL, 3861095208UL, +1088109135UL, 3954527144UL, 2618003265UL, 3454840568UL, 1668276240UL, 1668403077UL, 3235241899UL, 4020374281UL, 1896863688UL, 677285319UL, 4047674693UL, 4043186819UL, 2038783953UL, 236635760UL, 3641273565UL, 3568356824UL, 3946220303UL, 186484522UL, 3626346451UL, 3653227559UL, 281949942UL, 1896524045UL, 4168753288UL, 1723123703UL, 3600798445UL, 4267802363UL, 412498526UL, 468768748UL, 2745777741UL, 26635454UL, 837186232UL, 1473941762UL, +2601865569UL, 2021732453UL, 3171165636UL, 786833002UL, 3461566768UL, 1604778670UL, 437644814UL, 2437761489UL, 3573139998UL, 306196591UL, 972076738UL, 4075927397UL, 1427554739UL, 597414077UL, 2401305323UL, 1774857312UL, 224593737UL, 3697511293UL, 3905126277UL, 1527832817UL, 1847061846UL, 333176687UL, 2988562696UL, 3623938567UL, 2731158470UL, 4273100167UL, 1673622334UL, 2163644598UL, 3666601063UL, 1991088422UL, 4176957983UL, 565952761UL, +566996714UL, 103136762UL, 1639884175UL, 115456167UL, 3265051494UL, 2826313040UL, 1898888678UL, 2976556877UL, 1276809956UL, 4051866478UL, 959265349UL, 851980436UL, 2482970929UL, 2905096898UL, 342438530UL, 3428101638UL, 912389587UL, 2716490551UL, 3613297213UL, 200159550UL, 3406974927UL, 832121231UL, 2865829307UL, 1242069873UL, 1464281204UL, 1828082526UL, 2620095350UL, 3671861666UL, 986958825UL, 3332332947UL, 1610600284UL, 3193282615UL, +164496953UL, 537698841UL, 2234324389UL, 1682296894UL, 3526681456UL, 486931321UL, 1112334635UL, 1754723911UL, 3607564438UL, 3764062195UL, 898439171UL, 2702680798UL, 3827569659UL, 4104590721UL, 2612634189UL, 1703436382UL, 1596420149UL, 1814546108UL, 2684685172UL, 1659194343UL, 3421607784UL, 2424233156UL, 688245437UL, 2593335056UL, 1657668516UL, 362342820UL, 260803614UL, 2460564382UL, 2811435329UL, 2169200311UL, 4248717010UL, 1426048416UL, +1341061221UL, 1361417084UL, 3060155336UL, 2693026827UL, 688976997UL, 890124736UL, 2185462193UL, 765141735UL, 2445632748UL, 1113361455UL, 1437907207UL, 2127475991UL, 2845453063UL, 1830953748UL, 1719248425UL, 2717704308UL, 4193767498UL, 1667876711UL, 2469362144UL, 449353539UL, 3224086539UL, 231347764UL, 2737121599UL, 2917779591UL, 2122699205UL, 1463860373UL, 2760968409UL, 2579133178UL, 2600345316UL, 4017154219UL, 1041094855UL, 685134804UL, +3861095208UL, 3682591427UL, 3954527144UL, 2618003265UL, 3454840568UL, 1668276240UL, 988400088UL, 3235241899UL, 4020374281UL, 1896863688UL, 677285319UL, 2749516227UL, 4043186819UL, 2038783953UL, 236635760UL, 3641273565UL, 4073317913UL, 3946220303UL, 186484522UL, 3626346451UL, 3653227559UL, 872336642UL, 1896524045UL, 4168753288UL, 1723123703UL, 3600798445UL, 524095357UL, 412498526UL, 468768748UL, 2745777741UL, 26635454UL, 840544541UL, +1473941762UL, 2601865569UL, 2021732453UL, 3171165636UL, 1058640324UL, 3461566768UL, 1604778670UL, 437644814UL, 2437761489UL, 3615438045UL, 306196591UL, 972076738UL, 4075927397UL, 1427554739UL, 2369367008UL, 2401305323UL, 1774857312UL, 224593737UL, 3697511293UL, 4186564433UL, 1527832817UL, 1847061846UL, 333176687UL, 2988562696UL, 4039340326UL, 2731158470UL, 4273100167UL, 1673622334UL, 2163644598UL, 307949376UL, 1991088422UL, 4176957983UL, +565952761UL, 566996714UL, 4159448552UL, 1639884175UL, 115456167UL, 3265051494UL, 2826313040UL, 2698725478UL, 2976556877UL, 1276809956UL, 4051866478UL, 959265349UL, 293029699UL, 2482970929UL, 2905096898UL, 342438530UL, 3428101638UL, 4172766741UL, 2716490551UL, 3613297213UL, 200159550UL, 3406974927UL, 3723281866UL, 2865829307UL, 1242069873UL, 1464281204UL, 1828082526UL, 3304191156UL, 3671861666UL, 986958825UL, 3332332947UL, 1610600284UL, +2370407607UL, 164496953UL, 537698841UL, 2234324389UL, 1682296894UL, 826891606UL, 486931321UL, 1112334635UL, 1754723911UL, 3607564438UL, 3598993552UL, 898439171UL, 2702680798UL, 3827569659UL, 4104590721UL, 1421852097UL, 1703436382UL, 1596420149UL, 1814546108UL, 2684685172UL, 4090587429UL, 3421607784UL, 2424233156UL, 688245437UL, 2593335056UL, 4151905751UL, 362342820UL, 260803614UL, 2460564382UL, 2811435329UL, 2402832015UL, 4248717010UL, +1426048416UL, 1341061221UL, 1361417084UL, 1629089021UL, 2693026827UL, 688976997UL, 890124736UL, 2185462193UL, 303105066UL, 2445632748UL, 1113361455UL, 1437907207UL, 2127475991UL, 62024604UL, 1830953748UL, 1719248425UL, 2717704308UL, 4193767498UL, 667433630UL, 2469362144UL, 449353539UL, 3224086539UL, 231347764UL, 3918249451UL, 2917779591UL, 2122699205UL, 1463860373UL, 2760968409UL, 4274016442UL, 2600345316UL, 4017154219UL, 1041094855UL, +685134804UL, 643006688UL, 3682591427UL, 3954527144UL, 2618003265UL, 3454840568UL, 4180665518UL, 988400088UL, 3235241899UL, 4020374281UL, 1896863688UL, 3678687414UL, 2749516227UL, 4043186819UL, 2038783953UL, 236635760UL, 2880089648UL, 4073317913UL, 3946220303UL, 186484522UL, 3626346451UL, 2454620114UL, 872336642UL, 1896524045UL, 4168753288UL, 1723123703UL, 2692406059UL, 524095357UL, 412498526UL, 468768748UL, 2745777741UL, 918726515UL, +840544541UL, 1473941762UL, 2601865569UL, 2021732453UL, 3534238020UL, 1058640324UL, 3461566768UL, 1604778670UL, 437644814UL, 2894699005UL, 3615438045UL, 306196591UL, 972076738UL, 4075927397UL, 3468671461UL, 2369367008UL, 2401305323UL, 1774857312UL, 224593737UL, 2734827022UL, 4186564433UL, 1527832817UL, 1847061846UL, 333176687UL, 2437714719UL, 4039340326UL, 2731158470UL, 4273100167UL, 1673622334UL, 196072958UL, 307949376UL, 1991088422UL, +4176957983UL, 565952761UL, 847200194UL, 4159448552UL, 1639884175UL, 115456167UL, 3265051494UL, 2503079777UL, 2698725478UL, 2976556877UL, 1276809956UL, 4051866478UL, 2731665893UL, 293029699UL, 2482970929UL, 2905096898UL, 342438530UL, 581060953UL, 4172766741UL, 2716490551UL, 3613297213UL, 200159550UL, 4222335623UL, 3723281866UL, 2865829307UL, 1242069873UL, 1464281204UL, 1080647953UL, 3304191156UL, 3671861666UL, 986958825UL, 3332332947UL, +920422540UL, 3656094274UL, 4036161427UL, 2157099981UL, 1855437762UL, 1385781426UL, 199192882UL, 489599802UL, 3472601685UL, 717544078UL, 2241742884UL, 3951326913UL, 3590866192UL, 1087524220UL, 3517385549UL, 360484251UL, 2718513148UL, 1386577185UL, 1833613127UL, 2926418589UL, 1652463225UL, 548895720UL, 1343026759UL, 1797789098UL, 3229783023UL, 1745843414UL, 200554865UL, 2442780740UL, 2359926428UL, 2970332116UL, 3097392757UL, 134294482UL, +936225458UL, 1968264650UL, 64868134UL, 3821668262UL, 2502175363UL, 1623767635UL, 2936073062UL, 1991791011UL, 2971174068UL, 3142195911UL, 2874818345UL, 2192526584UL, 496586185UL, 2491564144UL, 2415210641UL, 314307270UL, 2936737494UL, 557604388UL, 1067914024UL, 3270690738UL, 375601880UL, 962749065UL, 3610467620UL, 402112984UL, 1432929499UL, 3872957776UL, 3971384069UL, 2223968592UL, 407083609UL, 2178236674UL, 1806303230UL, 3397564470UL, +12158764UL, 415570813UL, 4033667395UL, 3687406137UL, 801878150UL, 953500350UL, 3667783172UL, 1203668106UL, 902418194UL, 779786150UL, 774683730UL, 2870261992UL, 509192460UL, 1961621392UL, 1064906432UL, 3665710891UL, 1733725153UL, 1887608856UL, 1314631523UL, 4097239005UL, 29074501UL, 3472521950UL, 4040841657UL, 532128023UL, 2333441401UL, 1671717886UL, 1678544416UL, 1218347584UL, 3680929567UL, 4025753853UL, 2810948711UL, 1846100306UL, +3377469279UL, 3144481747UL, 2625781306UL, 730632118UL, 3162408393UL, 3423660386UL, 1364968369UL, 4270900402UL, 1075484840UL, 2892932277UL, 3700635052UL, 3853022563UL, 281755151UL, 1530909868UL, 2364069707UL, 2361723426UL, 738500028UL, 1401903990UL, 1543704261UL, 2442916222UL, 1076190609UL, 1882477803UL, 740024557UL, 1591015439UL, 2730909167UL, 2723330839UL, 1637373491UL, 3777799860UL, 2921269571UL, 3698591972UL, 3997463570UL, 3877862147UL, +1912888417UL, 3365137165UL, 3465700492UL, 771243134UL, 4037723169UL, 1715894739UL, 1025821874UL, 1924958945UL, 3382242859UL, 121591031UL, 483980724UL, 546523388UL, 2446882279UL, 856267778UL, 578739009UL, 2978085488UL, 480884914UL, 966764808UL, 457039953UL, 3817520708UL, 1113646451UL, 2503896910UL, 3507840816UL, 717151671UL, 4149352573UL, 1568869830UL, 395015863UL, 773165995UL, 1853682362UL, 2861368846UL, 1884368812UL, 1250092101UL, +}, +{ +916910638UL, 961623451UL, 1193013401UL, 1016438484UL, 4091279871UL, 287282633UL, 8590725UL, 3575333670UL, 324340905UL, 3133751747UL, 2840894649UL, 2980503178UL, 1111215768UL, 2783846375UL, 72516413UL, 4158424384UL, 2184094569UL, 2305724254UL, 4057093054UL, 1407652993UL, 3105191537UL, 768505376UL, 298782270UL, 993926164UL, 2694730042UL, 1479658113UL, 2376490281UL, 2767906402UL, 1619969256UL, 3256472015UL, 2563843533UL, 2974784738UL, +2529307107UL, 4289918826UL, 3105587575UL, 3748950898UL, 2182744253UL, 431888679UL, 3780324902UL, 2525978209UL, 54545903UL, 1688749940UL, 2394884334UL, 3477656171UL, 263834270UL, 1562965459UL, 804704330UL, 4185729868UL, 138898835UL, 2113063150UL, 327612841UL, 1252226275UL, 935318076UL, 2956823075UL, 4095101181UL, 1510586062UL, 156282440UL, 3386839706UL, 2294393752UL, 1306167091UL, 4005033667UL, 651716500UL, 4115192738UL, 123027719UL, +3873547487UL, 2910637335UL, 2571924586UL, 3489608656UL, 956791985UL, 2467423726UL, 3214531645UL, 2054232851UL, 49634692UL, 377192215UL, 1865068750UL, 2479252980UL, 3481787748UL, 3243507737UL, 605491073UL, 4062466752UL, 988602517UL, 1539348794UL, 1555068617UL, 2657884010UL, 460334294UL, 4240766479UL, 3639800790UL, 253377117UL, 3969136265UL, 488705329UL, 1722560286UL, 2289159295UL, 1025876008UL, 2927117896UL, 767521707UL, 2047999999UL, +4260853571UL, 2079302241UL, 2409677301UL, 1087552976UL, 2363907365UL, 2574464321UL, 2606273241UL, 3716086457UL, 26053603UL, 3162779415UL, 14843078UL, 2614076143UL, 1157531920UL, 2773275636UL, 2338825066UL, 435472225UL, 1399711137UL, 1224374788UL, 2154533280UL, 560135209UL, 935800607UL, 1940258814UL, 3826959530UL, 3423217355UL, 3704934971UL, 3815248829UL, 3878175339UL, 1395508015UL, 3295101527UL, 177901558UL, 4167531389UL, 1375148189UL, +3125377631UL, 557218961UL, 4088880299UL, 3478859071UL, 3687276754UL, 2845114223UL, 1713171361UL, 1756507633UL, 3160807894UL, 2375334470UL, 843542578UL, 1907952570UL, 1544844563UL, 2294372007UL, 3336681376UL, 734347193UL, 102566945UL, 2311037104UL, 4294750194UL, 3572240326UL, 732958152UL, 263733314UL, 2087890678UL, 331542297UL, 3549110380UL, 2073894939UL, 2104101380UL, 3670791368UL, 3122901693UL, 3799823891UL, 3783548253UL, 1102633864UL, +44327348UL, 916910638UL, 961623451UL, 1193013401UL, 1016438484UL, 1873779640UL, 287282633UL, 8590725UL, 3575333670UL, 324340905UL, 1144671533UL, 2840894649UL, 2980503178UL, 1111215768UL, 2783846375UL, 2000673937UL, 4158424384UL, 2184094569UL, 2305724254UL, 4057093054UL, 533488413UL, 3105191537UL, 768505376UL, 298782270UL, 993926164UL, 2015456740UL, 1479658113UL, 2376490281UL, 2767906402UL, 1619969256UL, 3120736988UL, 2563843533UL, +2974784738UL, 2529307107UL, 4289918826UL, 729503771UL, 3748950898UL, 2182744253UL, 431888679UL, 3780324902UL, 373638396UL, 54545903UL, 1688749940UL, 2394884334UL, 3477656171UL, 1083764681UL, 1562965459UL, 804704330UL, 4185729868UL, 138898835UL, 823405282UL, 327612841UL, 1252226275UL, 935318076UL, 2956823075UL, 899234846UL, 1510586062UL, 156282440UL, 3386839706UL, 2294393752UL, 2769934879UL, 4005033667UL, 651716500UL, 4115192738UL, +123027719UL, 3729538641UL, 2910637335UL, 2571924586UL, 3489608656UL, 956791985UL, 139360134UL, 3214531645UL, 2054232851UL, 49634692UL, 377192215UL, 2754746969UL, 2479252980UL, 3481787748UL, 3243507737UL, 605491073UL, 732155706UL, 988602517UL, 1539348794UL, 1555068617UL, 2657884010UL, 3753733088UL, 4240766479UL, 3639800790UL, 253377117UL, 3969136265UL, 3848735787UL, 1722560286UL, 2289159295UL, 1025876008UL, 2927117896UL, 3661948694UL, +2047999999UL, 4260853571UL, 2079302241UL, 2409677301UL, 3421911122UL, 2363907365UL, 2574464321UL, 2606273241UL, 3716086457UL, 2064343322UL, 3162779415UL, 14843078UL, 2614076143UL, 1157531920UL, 826449637UL, 2338825066UL, 435472225UL, 1399711137UL, 1224374788UL, 3770340198UL, 560135209UL, 935800607UL, 1940258814UL, 3826959530UL, 2963586762UL, 3704934971UL, 3815248829UL, 3878175339UL, 1395508015UL, 3721612680UL, 177901558UL, 4167531389UL, +1375148189UL, 3125377631UL, 1023552290UL, 4088880299UL, 3478859071UL, 3687276754UL, 2845114223UL, 3831557301UL, 1756507633UL, 3160807894UL, 2375334470UL, 843542578UL, 2798365898UL, 1544844563UL, 2294372007UL, 3336681376UL, 734347193UL, 1856808621UL, 2311037104UL, 4294750194UL, 3572240326UL, 732958152UL, 1999195012UL, 2087890678UL, 331542297UL, 3549110380UL, 2073894939UL, 3115936764UL, 3670791368UL, 3122901693UL, 3799823891UL, 3783548253UL, +132796150UL, 44327348UL, 916910638UL, 961623451UL, 1193013401UL, 1753944196UL, 1873779640UL, 287282633UL, 8590725UL, 3575333670UL, 1447720209UL, 1144671533UL, 2840894649UL, 2980503178UL, 1111215768UL, 1211945983UL, 2000673937UL, 4158424384UL, 2184094569UL, 2305724254UL, 402617261UL, 533488413UL, 3105191537UL, 768505376UL, 298782270UL, 2915553159UL, 2015456740UL, 1479658113UL, 2376490281UL, 2767906402UL, 3473761811UL, 3120736988UL, +2563843533UL, 2974784738UL, 2529307107UL, 737859212UL, 729503771UL, 3748950898UL, 2182744253UL, 431888679UL, 2013420163UL, 373638396UL, 54545903UL, 1688749940UL, 2394884334UL, 675998523UL, 1083764681UL, 1562965459UL, 804704330UL, 4185729868UL, 1165431355UL, 823405282UL, 327612841UL, 1252226275UL, 935318076UL, 2420680216UL, 899234846UL, 1510586062UL, 156282440UL, 3386839706UL, 2101339651UL, 2769934879UL, 4005033667UL, 651716500UL, +4115192738UL, 112049740UL, 3729538641UL, 2910637335UL, 2571924586UL, 3489608656UL, 305695595UL, 139360134UL, 3214531645UL, 2054232851UL, 49634692UL, 1073828255UL, 2754746969UL, 2479252980UL, 3481787748UL, 3243507737UL, 3392719169UL, 732155706UL, 988602517UL, 1539348794UL, 1555068617UL, 3246776527UL, 3753733088UL, 4240766479UL, 3639800790UL, 253377117UL, 872273450UL, 3848735787UL, 1722560286UL, 2289159295UL, 1025876008UL, 4168154213UL, +3661948694UL, 2047999999UL, 4260853571UL, 2079302241UL, 2380420842UL, 3421911122UL, 2363907365UL, 2574464321UL, 2606273241UL, 3881916078UL, 2064343322UL, 3162779415UL, 14843078UL, 2614076143UL, 473288515UL, 826449637UL, 2338825066UL, 435472225UL, 1399711137UL, 3068538992UL, 3770340198UL, 560135209UL, 935800607UL, 1940258814UL, 1469655183UL, 2963586762UL, 3704934971UL, 3815248829UL, 3878175339UL, 2410602840UL, 3721612680UL, 177901558UL, +4167531389UL, 1375148189UL, 1367577763UL, 1023552290UL, 4088880299UL, 3478859071UL, 3687276754UL, 678224549UL, 3831557301UL, 1756507633UL, 3160807894UL, 2375334470UL, 2884561721UL, 2798365898UL, 1544844563UL, 2294372007UL, 3336681376UL, 1938834658UL, 1856808621UL, 2311037104UL, 4294750194UL, 3572240326UL, 2786764913UL, 1999195012UL, 2087890678UL, 331542297UL, 3549110380UL, 3597797341UL, 3115936764UL, 3670791368UL, 3122901693UL, 3799823891UL, +1271317799UL, 132796150UL, 44327348UL, 916910638UL, 961623451UL, 2427821332UL, 1753944196UL, 1873779640UL, 287282633UL, 8590725UL, 1244012658UL, 1447720209UL, 1144671533UL, 2840894649UL, 2980503178UL, 3548902577UL, 1211945983UL, 2000673937UL, 4158424384UL, 2184094569UL, 2152623453UL, 402617261UL, 533488413UL, 3105191537UL, 768505376UL, 1095141108UL, 2915553159UL, 2015456740UL, 1479658113UL, 2376490281UL, 337998873UL, 3473761811UL, +3120736988UL, 2563843533UL, 2974784738UL, 3087228498UL, 737859212UL, 729503771UL, 3748950898UL, 2182744253UL, 2140410733UL, 2013420163UL, 373638396UL, 54545903UL, 1688749940UL, 528290088UL, 675998523UL, 1083764681UL, 1562965459UL, 804704330UL, 2536362875UL, 1165431355UL, 823405282UL, 327612841UL, 1252226275UL, 4037635314UL, 2420680216UL, 899234846UL, 1510586062UL, 156282440UL, 2012335895UL, 2101339651UL, 2769934879UL, 4005033667UL, +651716500UL, 2552583570UL, 112049740UL, 3729538641UL, 2910637335UL, 2571924586UL, 2436645403UL, 305695595UL, 139360134UL, 3214531645UL, 2054232851UL, 2384286326UL, 1073828255UL, 2754746969UL, 2479252980UL, 3481787748UL, 1948315585UL, 3392719169UL, 732155706UL, 988602517UL, 1539348794UL, 4110558494UL, 3246776527UL, 3753733088UL, 4240766479UL, 3639800790UL, 3627363812UL, 872273450UL, 3848735787UL, 1722560286UL, 2289159295UL, 4122430477UL, +4168154213UL, 3661948694UL, 2047999999UL, 4260853571UL, 1767882442UL, 2380420842UL, 3421911122UL, 2363907365UL, 2574464321UL, 2778622726UL, 3881916078UL, 2064343322UL, 3162779415UL, 14843078UL, 1513897109UL, 473288515UL, 826449637UL, 2338825066UL, 435472225UL, 322954918UL, 3068538992UL, 3770340198UL, 560135209UL, 935800607UL, 345602050UL, 1469655183UL, 2963586762UL, 3704934971UL, 3815248829UL, 3508249920UL, 2410602840UL, 3721612680UL, +177901558UL, 4167531389UL, 2161244150UL, 1367577763UL, 1023552290UL, 4088880299UL, 3478859071UL, 1108183104UL, 678224549UL, 3831557301UL, 1756507633UL, 3160807894UL, 2551630811UL, 2884561721UL, 2798365898UL, 1544844563UL, 2294372007UL, 2520267760UL, 1938834658UL, 1856808621UL, 2311037104UL, 4294750194UL, 2310096003UL, 2786764913UL, 1999195012UL, 2087890678UL, 331542297UL, 1205238749UL, 3597797341UL, 3115936764UL, 3670791368UL, 3122901693UL, +2008141679UL, 2018425028UL, 3435073328UL, 1452813805UL, 1628661138UL, 1323367156UL, 1062553693UL, 4029321700UL, 2772685842UL, 3798388850UL, 1315172209UL, 3930983291UL, 3816791373UL, 529176017UL, 3419610188UL, 3331589216UL, 4016977274UL, 2047089790UL, 3892571923UL, 2363414008UL, 1144631948UL, 3004954882UL, 2558739305UL, 19774033UL, 2525079911UL, 3774885821UL, 2817837373UL, 986111566UL, 1446678953UL, 3238485630UL, 3993748600UL, 1601954599UL, +3100591537UL, 2098009380UL, 3935971261UL, 4202546603UL, 3713465083UL, 3845664764UL, 2466365355UL, 1452340065UL, 2003576531UL, 1013434822UL, 2254608933UL, 783902023UL, 3129770529UL, 129130612UL, 821418228UL, 350036483UL, 3473671510UL, 4128495167UL, 2773832518UL, 683262085UL, 2143353417UL, 256251732UL, 1719056536UL, 2670223618UL, 328467339UL, 1564657740UL, 451231672UL, 2788353006UL, 882900088UL, 3255241056UL, 3198073758UL, 2541070985UL, +1941509325UL, 674933160UL, 207753676UL, 2605303964UL, 1681335994UL, 1143520001UL, 448872632UL, 302917879UL, 1100138495UL, 2058770021UL, 3116955098UL, 2081754747UL, 3734924767UL, 1916718058UL, 3873335960UL, 2740460398UL, 2171157007UL, 27677949UL, 2364721928UL, 175851655UL, 1468083950UL, 3162369526UL, 2441504540UL, 556978295UL, 2372096172UL, 3181101116UL, 2582850132UL, 1101292643UL, 862643740UL, 2095546242UL, 3261953801UL, 748040658UL, +3970037674UL, 819116843UL, 3594523650UL, 1597423019UL, 4109336883UL, 1198282420UL, 2905230517UL, 1729529596UL, 3230132814UL, 3640242164UL, 1899059108UL, 1944906555UL, 3426510495UL, 3035188107UL, 6448083UL, 1093882965UL, 2867500469UL, 3626379157UL, 1849073068UL, 897616501UL, 604221668UL, 1020676159UL, 4083635798UL, 1716022041UL, 3671877965UL, 1738820843UL, 30077467UL, 729231767UL, 3413193248UL, 207000406UL, 3854363185UL, 3302747326UL, +3293643267UL, 2101250157UL, 460131091UL, 4159442595UL, 1133391045UL, 1031215443UL, 4195487944UL, 45931575UL, 2922629291UL, 789302543UL, 3024994662UL, 442525623UL, 2850119076UL, 838309503UL, 2585361734UL, 1020449164UL, 1623631007UL, 955374631UL, 2932467671UL, 3713639221UL, 3019179416UL, 977970472UL, 1817244230UL, 3856774853UL, 1140530868UL, 886199600UL, 1218509766UL, 4001537244UL, 2840913665UL, 2133254364UL, 3332344608UL, 475291624UL, +}, +{ +1854921599UL, 2655519695UL, 3124573588UL, 319882484UL, 603545603UL, 4175512633UL, 141286453UL, 1183670252UL, 1789500145UL, 37351733UL, 3190829323UL, 2782782009UL, 493805446UL, 1228958246UL, 2672482554UL, 2274981421UL, 2935438833UL, 3625733677UL, 3679506394UL, 687805550UL, 134516308UL, 3576789728UL, 965007022UL, 1056542222UL, 2319405423UL, 3944221200UL, 950102624UL, 3848192810UL, 3205299696UL, 82033760UL, 1241913280UL, 1360146137UL, +1675732327UL, 2164452797UL, 3920498715UL, 2226452641UL, 3172047212UL, 1569171738UL, 2631589480UL, 2889660225UL, 2030783667UL, 2237381973UL, 2706217212UL, 3143638386UL, 1733174225UL, 1166820137UL, 3818389960UL, 193959252UL, 2793509934UL, 316291605UL, 2502743884UL, 1963136977UL, 3739017448UL, 25754513UL, 1590156485UL, 1856291967UL, 4143674472UL, 2538785911UL, 2159135699UL, 1908446793UL, 3303325234UL, 2589568800UL, 1193586059UL, 77481069UL, +789413194UL, 2556570543UL, 162987300UL, 1960844609UL, 2973799047UL, 4253906178UL, 315868734UL, 2542622968UL, 3949539136UL, 1479106582UL, 4225431384UL, 1235059630UL, 1533374854UL, 847792023UL, 4031286530UL, 4194276632UL, 164541100UL, 1010135841UL, 143302319UL, 1335585015UL, 1237311692UL, 20896020UL, 344974153UL, 2576803233UL, 3430251730UL, 984163376UL, 2680612471UL, 1276425436UL, 2400671554UL, 1628640140UL, 2161048926UL, 2109177634UL, +998215324UL, 3127793500UL, 1759998050UL, 3105138908UL, 2583746384UL, 2126302368UL, 3258602104UL, 1262742375UL, 3565617377UL, 3726060195UL, 157069329UL, 390662438UL, 3800994052UL, 2007694482UL, 377281730UL, 3251789121UL, 236703173UL, 122782596UL, 775407411UL, 3394010206UL, 4232159202UL, 468321553UL, 2704615220UL, 1332411375UL, 2978494251UL, 989230484UL, 3122841814UL, 2348872707UL, 731335994UL, 541354422UL, 223117443UL, 2225009071UL, +4230058949UL, 1875162926UL, 3897048544UL, 3550177883UL, 2461273592UL, 1046820583UL, 1333727817UL, 1378024753UL, 3686775275UL, 4230752590UL, 64834458UL, 1281467967UL, 729116355UL, 3886390916UL, 65029451UL, 3478506446UL, 1387684482UL, 1172004841UL, 2525409243UL, 1677678908UL, 1704646757UL, 930937262UL, 1088384271UL, 689357059UL, 1754542213UL, 702963842UL, 2864311668UL, 1960202673UL, 1009675673UL, 3742350158UL, 3751269215UL, 3166659283UL, +9090161UL, 1854921599UL, 2655519695UL, 3124573588UL, 319882484UL, 1422536794UL, 4175512633UL, 141286453UL, 1183670252UL, 1789500145UL, 850391877UL, 3190829323UL, 2782782009UL, 493805446UL, 1228958246UL, 837232655UL, 2274981421UL, 2935438833UL, 3625733677UL, 3679506394UL, 955772620UL, 134516308UL, 3576789728UL, 965007022UL, 1056542222UL, 874117013UL, 3944221200UL, 950102624UL, 3848192810UL, 3205299696UL, 543679720UL, 1241913280UL, +1360146137UL, 1675732327UL, 2164452797UL, 1169030022UL, 2226452641UL, 3172047212UL, 1569171738UL, 2631589480UL, 3783543297UL, 2030783667UL, 2237381973UL, 2706217212UL, 3143638386UL, 1560162209UL, 1166820137UL, 3818389960UL, 193959252UL, 2793509934UL, 4258046618UL, 2502743884UL, 1963136977UL, 3739017448UL, 25754513UL, 1204846712UL, 1856291967UL, 4143674472UL, 2538785911UL, 2159135699UL, 3889946075UL, 3303325234UL, 2589568800UL, 1193586059UL, +77481069UL, 969912041UL, 2556570543UL, 162987300UL, 1960844609UL, 2973799047UL, 427583517UL, 315868734UL, 2542622968UL, 3949539136UL, 1479106582UL, 92839917UL, 1235059630UL, 1533374854UL, 847792023UL, 4031286530UL, 1147875681UL, 164541100UL, 1010135841UL, 143302319UL, 1335585015UL, 368616909UL, 20896020UL, 344974153UL, 2576803233UL, 3430251730UL, 1078575783UL, 2680612471UL, 1276425436UL, 2400671554UL, 1628640140UL, 4149623645UL, +2109177634UL, 998215324UL, 3127793500UL, 1759998050UL, 3525419965UL, 2583746384UL, 2126302368UL, 3258602104UL, 1262742375UL, 1996113346UL, 3726060195UL, 157069329UL, 390662438UL, 3800994052UL, 982000497UL, 377281730UL, 3251789121UL, 236703173UL, 122782596UL, 2303768414UL, 3394010206UL, 4232159202UL, 468321553UL, 2704615220UL, 681592492UL, 2978494251UL, 989230484UL, 3122841814UL, 2348872707UL, 4089094260UL, 541354422UL, 223117443UL, +2225009071UL, 4230058949UL, 2754981128UL, 3897048544UL, 3550177883UL, 2461273592UL, 1046820583UL, 668143612UL, 1378024753UL, 3686775275UL, 4230752590UL, 64834458UL, 3765910650UL, 729116355UL, 3886390916UL, 65029451UL, 3478506446UL, 3419111947UL, 1172004841UL, 2525409243UL, 1677678908UL, 1704646757UL, 155635560UL, 1088384271UL, 689357059UL, 1754542213UL, 702963842UL, 2712009967UL, 1960202673UL, 1009675673UL, 3742350158UL, 3751269215UL, +129749802UL, 9090161UL, 1854921599UL, 2655519695UL, 3124573588UL, 809557750UL, 1422536794UL, 4175512633UL, 141286453UL, 1183670252UL, 1739311360UL, 850391877UL, 3190829323UL, 2782782009UL, 493805446UL, 1738527771UL, 837232655UL, 2274981421UL, 2935438833UL, 3625733677UL, 1858071296UL, 955772620UL, 134516308UL, 3576789728UL, 965007022UL, 3367712327UL, 874117013UL, 3944221200UL, 950102624UL, 3848192810UL, 2420548306UL, 543679720UL, +1241913280UL, 1360146137UL, 1675732327UL, 176019367UL, 1169030022UL, 2226452641UL, 3172047212UL, 1569171738UL, 76544055UL, 3783543297UL, 2030783667UL, 2237381973UL, 2706217212UL, 3283985735UL, 1560162209UL, 1166820137UL, 3818389960UL, 193959252UL, 346134252UL, 4258046618UL, 2502743884UL, 1963136977UL, 3739017448UL, 3887005605UL, 1204846712UL, 1856291967UL, 4143674472UL, 2538785911UL, 366578749UL, 3889946075UL, 3303325234UL, 2589568800UL, +1193586059UL, 2917569085UL, 969912041UL, 2556570543UL, 162987300UL, 1960844609UL, 61311938UL, 427583517UL, 315868734UL, 2542622968UL, 3949539136UL, 2278526422UL, 92839917UL, 1235059630UL, 1533374854UL, 847792023UL, 1361054176UL, 1147875681UL, 164541100UL, 1010135841UL, 143302319UL, 1348709332UL, 368616909UL, 20896020UL, 344974153UL, 2576803233UL, 3290873783UL, 1078575783UL, 2680612471UL, 1276425436UL, 2400671554UL, 628790408UL, +4149623645UL, 2109177634UL, 998215324UL, 3127793500UL, 2019336900UL, 3525419965UL, 2583746384UL, 2126302368UL, 3258602104UL, 2858154034UL, 1996113346UL, 3726060195UL, 157069329UL, 390662438UL, 2250549235UL, 982000497UL, 377281730UL, 3251789121UL, 236703173UL, 3487415996UL, 2303768414UL, 3394010206UL, 4232159202UL, 468321553UL, 2773608982UL, 681592492UL, 2978494251UL, 989230484UL, 3122841814UL, 3647638215UL, 4089094260UL, 541354422UL, +223117443UL, 2225009071UL, 2829509947UL, 2754981128UL, 3897048544UL, 3550177883UL, 2461273592UL, 282627696UL, 668143612UL, 1378024753UL, 3686775275UL, 4230752590UL, 1105868822UL, 3765910650UL, 729116355UL, 3886390916UL, 65029451UL, 328554604UL, 3419111947UL, 1172004841UL, 2525409243UL, 1677678908UL, 1395036942UL, 155635560UL, 1088384271UL, 689357059UL, 1754542213UL, 1076601715UL, 2712009967UL, 1960202673UL, 1009675673UL, 3742350158UL, +2581225953UL, 129749802UL, 9090161UL, 1854921599UL, 2655519695UL, 1393282220UL, 809557750UL, 1422536794UL, 4175512633UL, 141286453UL, 2211497169UL, 1739311360UL, 850391877UL, 3190829323UL, 2782782009UL, 2694871802UL, 1738527771UL, 837232655UL, 2274981421UL, 2935438833UL, 3145832503UL, 1858071296UL, 955772620UL, 134516308UL, 3576789728UL, 4045354759UL, 3367712327UL, 874117013UL, 3944221200UL, 950102624UL, 3562634568UL, 2420548306UL, +543679720UL, 1241913280UL, 1360146137UL, 3644280343UL, 176019367UL, 1169030022UL, 2226452641UL, 3172047212UL, 3927720006UL, 76544055UL, 3783543297UL, 2030783667UL, 2237381973UL, 1497233808UL, 3283985735UL, 1560162209UL, 1166820137UL, 3818389960UL, 2344066681UL, 346134252UL, 4258046618UL, 2502743884UL, 1963136977UL, 79988846UL, 3887005605UL, 1204846712UL, 1856291967UL, 4143674472UL, 3967952414UL, 366578749UL, 3889946075UL, 3303325234UL, +2589568800UL, 2193179011UL, 2917569085UL, 969912041UL, 2556570543UL, 162987300UL, 52882655UL, 61311938UL, 427583517UL, 315868734UL, 2542622968UL, 1575831590UL, 2278526422UL, 92839917UL, 1235059630UL, 1533374854UL, 2397068791UL, 1361054176UL, 1147875681UL, 164541100UL, 1010135841UL, 2586368032UL, 1348709332UL, 368616909UL, 20896020UL, 344974153UL, 3445652232UL, 3290873783UL, 1078575783UL, 2680612471UL, 1276425436UL, 3682156544UL, +628790408UL, 4149623645UL, 2109177634UL, 998215324UL, 4049708298UL, 2019336900UL, 3525419965UL, 2583746384UL, 2126302368UL, 1627944270UL, 2858154034UL, 1996113346UL, 3726060195UL, 157069329UL, 1481222640UL, 2250549235UL, 982000497UL, 377281730UL, 3251789121UL, 3564274539UL, 3487415996UL, 2303768414UL, 3394010206UL, 4232159202UL, 3509025997UL, 2773608982UL, 681592492UL, 2978494251UL, 989230484UL, 980252048UL, 3647638215UL, 4089094260UL, +541354422UL, 223117443UL, 543970497UL, 2829509947UL, 2754981128UL, 3897048544UL, 3550177883UL, 2736782140UL, 282627696UL, 668143612UL, 1378024753UL, 3686775275UL, 2728601425UL, 1105868822UL, 3765910650UL, 729116355UL, 3886390916UL, 1866378660UL, 328554604UL, 3419111947UL, 1172004841UL, 2525409243UL, 1506924008UL, 1395036942UL, 155635560UL, 1088384271UL, 689357059UL, 3587092123UL, 1076601715UL, 2712009967UL, 1960202673UL, 1009675673UL, +4292715891UL, 2465250857UL, 3267969665UL, 2459570573UL, 3644463083UL, 1637197500UL, 684559293UL, 3520611957UL, 2976084366UL, 1512112440UL, 1778285193UL, 1849742417UL, 3144801412UL, 3009052859UL, 820829188UL, 1382783871UL, 3373481539UL, 3777016406UL, 266942530UL, 1792334422UL, 4109859515UL, 1468149634UL, 1356457853UL, 623893785UL, 1301686542UL, 441704877UL, 3377795902UL, 879822753UL, 329462927UL, 543858304UL, 2221828617UL, 2996486613UL, +981774202UL, 1032220084UL, 1066536452UL, 1004068806UL, 1336694798UL, 3744375323UL, 3802436665UL, 3366526577UL, 418696462UL, 1776559103UL, 1291965608UL, 1623030339UL, 1443628607UL, 572114324UL, 899621592UL, 332121275UL, 3637616671UL, 457287722UL, 3803043476UL, 408472701UL, 660940326UL, 1209169008UL, 1202511620UL, 2906900959UL, 2600414642UL, 2015874468UL, 2931389161UL, 1760773669UL, 2601299639UL, 543821664UL, 3426280682UL, 1337602255UL, +3334593650UL, 1320885980UL, 3857269540UL, 2548321029UL, 2250001180UL, 673341051UL, 1900184720UL, 731675831UL, 2461790412UL, 2593291320UL, 1640301250UL, 863529987UL, 91627443UL, 2437824309UL, 2834231475UL, 4093270720UL, 1474594761UL, 4186662839UL, 1683556862UL, 1302286991UL, 806676270UL, 703274107UL, 3756759580UL, 674737904UL, 912015048UL, 1823306025UL, 1509430520UL, 3128952761UL, 290841833UL, 3917789380UL, 1022040580UL, 1810054038UL, +334998864UL, 1009274987UL, 310979037UL, 606749827UL, 546291081UL, 3438438313UL, 1840081424UL, 1950680845UL, 4217236364UL, 1814584903UL, 2814353208UL, 194196981UL, 1540331253UL, 3135937654UL, 773351497UL, 1878220007UL, 3097009802UL, 1252607159UL, 1378821846UL, 2741884614UL, 178612659UL, 3656860395UL, 1259606652UL, 3942111545UL, 488406826UL, 3640897405UL, 3419000480UL, 353909713UL, 2996208477UL, 2862593073UL, 108483327UL, 648472258UL, +1060249632UL, 1049865483UL, 430087518UL, 1364157854UL, 3367631180UL, 251313827UL, 2374149836UL, 2109357086UL, 479172068UL, 464775113UL, 1806677787UL, 3488082411UL, 356035738UL, 3080424395UL, 4134646749UL, 369528743UL, 1031004516UL, 2525336414UL, 4189798138UL, 3928909462UL, 568714397UL, 1681832820UL, 1753328641UL, 827357673UL, 1651960551UL, 1798317455UL, 737101952UL, 3257553606UL, 400882781UL, 1473208110UL, 4134183873UL, 2193420912UL, +}, +{ +2483976489UL, 2790651795UL, 3298324523UL, 3508205426UL, 2236819708UL, 917494217UL, 769620837UL, 3411018785UL, 2391335000UL, 1627061280UL, 3356773416UL, 1288706527UL, 4178910717UL, 3636299534UL, 4221874052UL, 3674654381UL, 537787012UL, 4271656840UL, 185820273UL, 1160533598UL, 1862365049UL, 2550353307UL, 1392072847UL, 1870891365UL, 1517453821UL, 524666025UL, 3645751565UL, 2415020247UL, 3691419894UL, 2580450642UL, 2130267479UL, 3636103610UL, +562446539UL, 750696587UL, 97137475UL, 3894066051UL, 2239638596UL, 3256181120UL, 3981041836UL, 774947039UL, 451287677UL, 3618957054UL, 4236303539UL, 1027744929UL, 1497195372UL, 498574915UL, 2164122779UL, 582902291UL, 3040883311UL, 1626221455UL, 1853378UL, 2125490000UL, 3185055972UL, 1607660025UL, 432884530UL, 779476209UL, 124284956UL, 2488937128UL, 2521389012UL, 107485781UL, 2873055013UL, 1171872946UL, 3130489952UL, 4273333914UL, +646240524UL, 3970896645UL, 942009076UL, 4069926418UL, 3129385884UL, 3470469370UL, 388702536UL, 450999415UL, 2995728716UL, 1687173264UL, 3049352827UL, 2648078738UL, 190663705UL, 486809970UL, 424002670UL, 2421764946UL, 2941043524UL, 3841512738UL, 119077561UL, 1801381572UL, 2208680167UL, 2502730219UL, 9899015UL, 2455199230UL, 3755314209UL, 3958460021UL, 3846398898UL, 1405136244UL, 2870563334UL, 821846618UL, 2790899812UL, 863647562UL, +629585032UL, 958925512UL, 1190540209UL, 57251233UL, 2109551995UL, 2294881622UL, 2603370255UL, 3839518646UL, 123838650UL, 3436270690UL, 1637121394UL, 3761101432UL, 954001192UL, 759760236UL, 3268295908UL, 2313083096UL, 630164216UL, 2367213191UL, 3992059381UL, 3292952769UL, 2040774258UL, 1420209005UL, 527547730UL, 1222399440UL, 1515078401UL, 2005580991UL, 645585788UL, 2256370254UL, 3057235502UL, 2870727428UL, 2785498804UL, 333440916UL, +1873686678UL, 2489794553UL, 3726728164UL, 3405629071UL, 3869328595UL, 3081963448UL, 2122133003UL, 1428788181UL, 4141962679UL, 41030733UL, 183716455UL, 36316501UL, 1430796327UL, 1884066707UL, 1216957106UL, 3455082673UL, 1092665987UL, 535070834UL, 3873372533UL, 175757671UL, 3414803303UL, 791028991UL, 3436610906UL, 2950895946UL, 977680845UL, 4224715886UL, 2809442211UL, 4044727083UL, 3035532020UL, 4253187882UL, 969203959UL, 2539482914UL, +813880136UL, 2483976489UL, 2790651795UL, 3298324523UL, 3508205426UL, 49280479UL, 917494217UL, 769620837UL, 3411018785UL, 2391335000UL, 3036738936UL, 3356773416UL, 1288706527UL, 4178910717UL, 3636299534UL, 2294957038UL, 3674654381UL, 537787012UL, 4271656840UL, 185820273UL, 2622722506UL, 1862365049UL, 2550353307UL, 1392072847UL, 1870891365UL, 2838104933UL, 524666025UL, 3645751565UL, 2415020247UL, 3691419894UL, 1295777418UL, 2130267479UL, +3636103610UL, 562446539UL, 750696587UL, 249830932UL, 3894066051UL, 2239638596UL, 3256181120UL, 3981041836UL, 3217398876UL, 451287677UL, 3618957054UL, 4236303539UL, 1027744929UL, 1724964245UL, 498574915UL, 2164122779UL, 582902291UL, 3040883311UL, 3101287841UL, 1853378UL, 2125490000UL, 3185055972UL, 1607660025UL, 1128474163UL, 779476209UL, 124284956UL, 2488937128UL, 2521389012UL, 338597864UL, 2873055013UL, 1171872946UL, 3130489952UL, +4273333914UL, 1557892392UL, 3970896645UL, 942009076UL, 4069926418UL, 3129385884UL, 2688433076UL, 388702536UL, 450999415UL, 2995728716UL, 1687173264UL, 157685189UL, 2648078738UL, 190663705UL, 486809970UL, 424002670UL, 979986388UL, 2941043524UL, 3841512738UL, 119077561UL, 1801381572UL, 2668625968UL, 2502730219UL, 9899015UL, 2455199230UL, 3755314209UL, 2699515741UL, 3846398898UL, 1405136244UL, 2870563334UL, 821846618UL, 505633792UL, +863647562UL, 629585032UL, 958925512UL, 1190540209UL, 2067402799UL, 2109551995UL, 2294881622UL, 2603370255UL, 3839518646UL, 2688067120UL, 3436270690UL, 1637121394UL, 3761101432UL, 954001192UL, 3206166733UL, 3268295908UL, 2313083096UL, 630164216UL, 2367213191UL, 3007494680UL, 3292952769UL, 2040774258UL, 1420209005UL, 527547730UL, 4047406592UL, 1515078401UL, 2005580991UL, 645585788UL, 2256370254UL, 13805572UL, 2870727428UL, 2785498804UL, +333440916UL, 1873686678UL, 1928222740UL, 3726728164UL, 3405629071UL, 3869328595UL, 3081963448UL, 2971423693UL, 1428788181UL, 4141962679UL, 41030733UL, 183716455UL, 4064095256UL, 1430796327UL, 1884066707UL, 1216957106UL, 3455082673UL, 985592757UL, 535070834UL, 3873372533UL, 175757671UL, 3414803303UL, 2159028553UL, 3436610906UL, 2950895946UL, 977680845UL, 4224715886UL, 345462057UL, 4044727083UL, 3035532020UL, 4253187882UL, 969203959UL, +984166534UL, 813880136UL, 2483976489UL, 2790651795UL, 3298324523UL, 1080001158UL, 49280479UL, 917494217UL, 769620837UL, 3411018785UL, 3216598401UL, 3036738936UL, 3356773416UL, 1288706527UL, 4178910717UL, 3311472057UL, 2294957038UL, 3674654381UL, 537787012UL, 4271656840UL, 220045511UL, 2622722506UL, 1862365049UL, 2550353307UL, 1392072847UL, 3057632678UL, 2838104933UL, 524666025UL, 3645751565UL, 2415020247UL, 252304106UL, 1295777418UL, +2130267479UL, 3636103610UL, 562446539UL, 80437039UL, 249830932UL, 3894066051UL, 2239638596UL, 3256181120UL, 117173223UL, 3217398876UL, 451287677UL, 3618957054UL, 4236303539UL, 1986849360UL, 1724964245UL, 498574915UL, 2164122779UL, 582902291UL, 288631030UL, 3101287841UL, 1853378UL, 2125490000UL, 3185055972UL, 824635664UL, 1128474163UL, 779476209UL, 124284956UL, 2488937128UL, 1231646648UL, 338597864UL, 2873055013UL, 1171872946UL, +3130489952UL, 708957725UL, 1557892392UL, 3970896645UL, 942009076UL, 4069926418UL, 2286522565UL, 2688433076UL, 388702536UL, 450999415UL, 2995728716UL, 2523361978UL, 157685189UL, 2648078738UL, 190663705UL, 486809970UL, 151444406UL, 979986388UL, 2941043524UL, 3841512738UL, 119077561UL, 3762447035UL, 2668625968UL, 2502730219UL, 9899015UL, 2455199230UL, 3532439568UL, 2699515741UL, 3846398898UL, 1405136244UL, 2870563334UL, 2242036665UL, +505633792UL, 863647562UL, 629585032UL, 958925512UL, 2618618630UL, 2067402799UL, 2109551995UL, 2294881622UL, 2603370255UL, 2461404010UL, 2688067120UL, 3436270690UL, 1637121394UL, 3761101432UL, 1076814097UL, 3206166733UL, 3268295908UL, 2313083096UL, 630164216UL, 12196305UL, 3007494680UL, 3292952769UL, 2040774258UL, 1420209005UL, 2609377752UL, 4047406592UL, 1515078401UL, 2005580991UL, 645585788UL, 865985176UL, 13805572UL, 2870727428UL, +2785498804UL, 333440916UL, 3735553268UL, 1928222740UL, 3726728164UL, 3405629071UL, 3869328595UL, 501640466UL, 2971423693UL, 1428788181UL, 4141962679UL, 41030733UL, 97561214UL, 4064095256UL, 1430796327UL, 1884066707UL, 1216957106UL, 3840122090UL, 985592757UL, 535070834UL, 3873372533UL, 175757671UL, 3856277268UL, 2159028553UL, 3436610906UL, 2950895946UL, 977680845UL, 3313441827UL, 345462057UL, 4044727083UL, 3035532020UL, 4253187882UL, +3468811573UL, 984166534UL, 813880136UL, 2483976489UL, 2790651795UL, 3733649754UL, 1080001158UL, 49280479UL, 917494217UL, 769620837UL, 3969566450UL, 3216598401UL, 3036738936UL, 3356773416UL, 1288706527UL, 2444128005UL, 3311472057UL, 2294957038UL, 3674654381UL, 537787012UL, 4166109669UL, 220045511UL, 2622722506UL, 1862365049UL, 2550353307UL, 2552992760UL, 3057632678UL, 2838104933UL, 524666025UL, 3645751565UL, 664164441UL, 252304106UL, +1295777418UL, 2130267479UL, 3636103610UL, 3227561061UL, 80437039UL, 249830932UL, 3894066051UL, 2239638596UL, 1071536668UL, 117173223UL, 3217398876UL, 451287677UL, 3618957054UL, 3066415327UL, 1986849360UL, 1724964245UL, 498574915UL, 2164122779UL, 3541914330UL, 288631030UL, 3101287841UL, 1853378UL, 2125490000UL, 2207189978UL, 824635664UL, 1128474163UL, 779476209UL, 124284956UL, 2117633906UL, 1231646648UL, 338597864UL, 2873055013UL, +1171872946UL, 891038594UL, 708957725UL, 1557892392UL, 3970896645UL, 942009076UL, 42952651UL, 2286522565UL, 2688433076UL, 388702536UL, 450999415UL, 2986730356UL, 2523361978UL, 157685189UL, 2648078738UL, 190663705UL, 3058267870UL, 151444406UL, 979986388UL, 2941043524UL, 3841512738UL, 1844101292UL, 3762447035UL, 2668625968UL, 2502730219UL, 9899015UL, 2599582093UL, 3532439568UL, 2699515741UL, 3846398898UL, 1405136244UL, 811001941UL, +2242036665UL, 505633792UL, 863647562UL, 629585032UL, 2722320710UL, 2618618630UL, 2067402799UL, 2109551995UL, 2294881622UL, 1820862072UL, 2461404010UL, 2688067120UL, 3436270690UL, 1637121394UL, 3642978005UL, 1076814097UL, 3206166733UL, 3268295908UL, 2313083096UL, 1900318020UL, 12196305UL, 3007494680UL, 3292952769UL, 2040774258UL, 520848705UL, 2609377752UL, 4047406592UL, 1515078401UL, 2005580991UL, 2530251392UL, 865985176UL, 13805572UL, +2870727428UL, 2785498804UL, 2878984912UL, 3735553268UL, 1928222740UL, 3726728164UL, 3405629071UL, 2717736455UL, 501640466UL, 2971423693UL, 1428788181UL, 4141962679UL, 3704214873UL, 97561214UL, 4064095256UL, 1430796327UL, 1884066707UL, 1721732760UL, 3840122090UL, 985592757UL, 535070834UL, 3873372533UL, 770732059UL, 3856277268UL, 2159028553UL, 3436610906UL, 2950895946UL, 33753949UL, 3313441827UL, 345462057UL, 4044727083UL, 3035532020UL, +4166506071UL, 2719759982UL, 1025532659UL, 3811323959UL, 713457907UL, 1577198020UL, 1719946821UL, 3963262337UL, 1719605451UL, 703663722UL, 1943886497UL, 2916371044UL, 1655862745UL, 109438187UL, 195575943UL, 2572727533UL, 2421761970UL, 1796539813UL, 2020762515UL, 1191344316UL, 2492085516UL, 2778033179UL, 4002316684UL, 1571080685UL, 1157340389UL, 3859584731UL, 3403766082UL, 2292873365UL, 2032258920UL, 1749575450UL, 848549431UL, 1893685820UL, +3510068298UL, 3308906564UL, 1193936308UL, 2561670234UL, 1043148718UL, 2611815896UL, 3832995202UL, 2436487998UL, 3377369330UL, 1174818128UL, 796514731UL, 1985886833UL, 88296218UL, 3032898657UL, 4101301361UL, 1486994584UL, 237792475UL, 1029399834UL, 1708840018UL, 2934039708UL, 1496674948UL, 4243234983UL, 3896751668UL, 1726119825UL, 2706068825UL, 1900013134UL, 2639641919UL, 1433377392UL, 2962655166UL, 1870954268UL, 3873603462UL, 1778084630UL, +2393311756UL, 4135022799UL, 3669603001UL, 811404758UL, 784379778UL, 4283689136UL, 405168660UL, 3873488622UL, 486946690UL, 347427153UL, 2139072474UL, 1143349522UL, 3780264455UL, 2938731842UL, 3864001470UL, 3497981827UL, 2703917008UL, 3222236962UL, 2604106616UL, 1281570367UL, 175937153UL, 433252852UL, 3232065906UL, 1111895932UL, 1027363895UL, 2435093744UL, 4232690481UL, 1940855209UL, 2844613991UL, 2095175619UL, 3479946852UL, 393314401UL, +3625733631UL, 1073779513UL, 2884072879UL, 4089630675UL, 3614205484UL, 1379809260UL, 3980251795UL, 3914556410UL, 3633356126UL, 3030204458UL, 1654727861UL, 3765074811UL, 959734060UL, 842315676UL, 353688341UL, 145655006UL, 1972100601UL, 1456042517UL, 3767579955UL, 4282066379UL, 498998655UL, 4123310742UL, 1801424182UL, 777808179UL, 655425670UL, 588715641UL, 2136252742UL, 1283378143UL, 639191135UL, 3132375783UL, 276649124UL, 2036776039UL, +3352396498UL, 3893441746UL, 3298373918UL, 1024178230UL, 2623051553UL, 1956117442UL, 2955394456UL, 2478945776UL, 3904945720UL, 769232312UL, 2168822980UL, 3715831945UL, 453874622UL, 3351529191UL, 3256151193UL, 808042625UL, 1700919462UL, 1008305347UL, 1518733915UL, 3194328753UL, 2228970756UL, 2604658038UL, 1376476152UL, 2147167203UL, 2585867511UL, 445717950UL, 3595016420UL, 3673970127UL, 3640614546UL, 494944945UL, 152508312UL, 4160926899UL, +}, +{ +3225674336UL, 827428943UL, 2858523441UL, 2447266124UL, 1539223637UL, 2299756421UL, 776912458UL, 279091824UL, 1152725492UL, 3903457284UL, 3987010398UL, 3996115574UL, 839506039UL, 3052513014UL, 28550291UL, 2597814974UL, 2328446377UL, 1961600298UL, 3695276714UL, 1334932648UL, 1141381380UL, 3025370440UL, 997698792UL, 931473445UL, 3091440507UL, 820119215UL, 3586778616UL, 1993126242UL, 4252838072UL, 3033829531UL, 2120026924UL, 65722921UL, +746724958UL, 461423533UL, 1582298542UL, 1564918930UL, 3710935369UL, 419349792UL, 3914061713UL, 2279209938UL, 770031171UL, 2062767935UL, 3373230309UL, 3582372364UL, 2025682996UL, 3352859025UL, 1262632952UL, 3140021482UL, 501370035UL, 2554730117UL, 352450195UL, 1002557127UL, 2813224858UL, 2808406559UL, 290476252UL, 4216846311UL, 1187381982UL, 3131323304UL, 1094330039UL, 2646234280UL, 655242013UL, 1152156402UL, 3658526705UL, 3565043535UL, +693375321UL, 2120064836UL, 3726555752UL, 97387177UL, 546586686UL, 1013492636UL, 3874404446UL, 440995849UL, 1929251266UL, 95137166UL, 564969023UL, 3559119399UL, 3855477390UL, 2439885481UL, 2492213232UL, 2611214170UL, 2054191666UL, 2778642234UL, 2267416277UL, 2194315209UL, 1360165075UL, 1018128176UL, 2841084399UL, 3028189871UL, 3631770575UL, 541021087UL, 1091467742UL, 2743780329UL, 3566538467UL, 1277066122UL, 279582475UL, 2712119598UL, +3296319359UL, 4187226385UL, 1468994750UL, 2946664285UL, 2284913307UL, 740953233UL, 3351500634UL, 1791054313UL, 3355533193UL, 610062694UL, 3089981426UL, 3469441840UL, 3225672476UL, 2223653903UL, 2593994385UL, 548784340UL, 549871569UL, 865468702UL, 1593939385UL, 645229999UL, 1412095765UL, 2814231763UL, 3619658094UL, 877462820UL, 2198765077UL, 1845119421UL, 4144145546UL, 1356681209UL, 848707034UL, 4144513299UL, 3231318896UL, 3382035479UL, +693621410UL, 2821661683UL, 4236142563UL, 680649431UL, 3290999942UL, 200856634UL, 617766412UL, 3194332974UL, 4102392657UL, 2776797278UL, 2932808060UL, 793967937UL, 2149374605UL, 3736514467UL, 3547689148UL, 3744888920UL, 98278184UL, 1497045279UL, 2945126332UL, 4285864315UL, 2791068812UL, 1939995011UL, 56752862UL, 864909862UL, 625377571UL, 2266362085UL, 1050287398UL, 925722519UL, 1008109592UL, 2819528345UL, 3573068613UL, 1915083884UL, +1536828870UL, 3225674336UL, 827428943UL, 2858523441UL, 2447266124UL, 2186287936UL, 2299756421UL, 776912458UL, 279091824UL, 1152725492UL, 1271286102UL, 3987010398UL, 3996115574UL, 839506039UL, 3052513014UL, 1036957208UL, 2597814974UL, 2328446377UL, 1961600298UL, 3695276714UL, 2395157917UL, 1141381380UL, 3025370440UL, 997698792UL, 931473445UL, 2727078785UL, 820119215UL, 3586778616UL, 1993126242UL, 4252838072UL, 1171102868UL, 2120026924UL, +65722921UL, 746724958UL, 461423533UL, 2335086228UL, 1564918930UL, 3710935369UL, 419349792UL, 3914061713UL, 1136716661UL, 770031171UL, 2062767935UL, 3373230309UL, 3582372364UL, 4100328450UL, 3352859025UL, 1262632952UL, 3140021482UL, 501370035UL, 2579000299UL, 352450195UL, 1002557127UL, 2813224858UL, 2808406559UL, 2642514897UL, 4216846311UL, 1187381982UL, 3131323304UL, 1094330039UL, 3092488663UL, 655242013UL, 1152156402UL, 3658526705UL, +3565043535UL, 3280658482UL, 2120064836UL, 3726555752UL, 97387177UL, 546586686UL, 584864345UL, 3874404446UL, 440995849UL, 1929251266UL, 95137166UL, 823950215UL, 3559119399UL, 3855477390UL, 2439885481UL, 2492213232UL, 2297040376UL, 2054191666UL, 2778642234UL, 2267416277UL, 2194315209UL, 573807317UL, 1018128176UL, 2841084399UL, 3028189871UL, 3631770575UL, 2747338726UL, 1091467742UL, 2743780329UL, 3566538467UL, 1277066122UL, 1715139924UL, +2712119598UL, 3296319359UL, 4187226385UL, 1468994750UL, 3361368810UL, 2284913307UL, 740953233UL, 3351500634UL, 1791054313UL, 4290564545UL, 610062694UL, 3089981426UL, 3469441840UL, 3225672476UL, 1010959310UL, 2593994385UL, 548784340UL, 549871569UL, 865468702UL, 1825306744UL, 645229999UL, 1412095765UL, 2814231763UL, 3619658094UL, 3792219969UL, 2198765077UL, 1845119421UL, 4144145546UL, 1356681209UL, 268197516UL, 4144513299UL, 3231318896UL, +3382035479UL, 693621410UL, 2786831464UL, 4236142563UL, 680649431UL, 3290999942UL, 200856634UL, 3822069622UL, 3194332974UL, 4102392657UL, 2776797278UL, 2932808060UL, 525501162UL, 2149374605UL, 3736514467UL, 3547689148UL, 3744888920UL, 3219948462UL, 1497045279UL, 2945126332UL, 4285864315UL, 2791068812UL, 2678467476UL, 56752862UL, 864909862UL, 625377571UL, 2266362085UL, 2258093843UL, 925722519UL, 1008109592UL, 2819528345UL, 3573068613UL, +2743241289UL, 1536828870UL, 3225674336UL, 827428943UL, 2858523441UL, 992128922UL, 2186287936UL, 2299756421UL, 776912458UL, 279091824UL, 2108721702UL, 1271286102UL, 3987010398UL, 3996115574UL, 839506039UL, 1315622698UL, 1036957208UL, 2597814974UL, 2328446377UL, 1961600298UL, 3098343478UL, 2395157917UL, 1141381380UL, 3025370440UL, 997698792UL, 1317753106UL, 2727078785UL, 820119215UL, 3586778616UL, 1993126242UL, 2295599934UL, 1171102868UL, +2120026924UL, 65722921UL, 746724958UL, 3999203443UL, 2335086228UL, 1564918930UL, 3710935369UL, 419349792UL, 1662083910UL, 1136716661UL, 770031171UL, 2062767935UL, 3373230309UL, 3271761171UL, 4100328450UL, 3352859025UL, 1262632952UL, 3140021482UL, 3981040854UL, 2579000299UL, 352450195UL, 1002557127UL, 2813224858UL, 1064251076UL, 2642514897UL, 4216846311UL, 1187381982UL, 3131323304UL, 2077640887UL, 3092488663UL, 655242013UL, 1152156402UL, +3658526705UL, 548941006UL, 3280658482UL, 2120064836UL, 3726555752UL, 97387177UL, 4112878213UL, 584864345UL, 3874404446UL, 440995849UL, 1929251266UL, 227230803UL, 823950215UL, 3559119399UL, 3855477390UL, 2439885481UL, 610498128UL, 2297040376UL, 2054191666UL, 2778642234UL, 2267416277UL, 518192832UL, 573807317UL, 1018128176UL, 2841084399UL, 3028189871UL, 2512871059UL, 2747338726UL, 1091467742UL, 2743780329UL, 3566538467UL, 386661563UL, +1715139924UL, 2712119598UL, 3296319359UL, 4187226385UL, 2508754324UL, 3361368810UL, 2284913307UL, 740953233UL, 3351500634UL, 1296305541UL, 4290564545UL, 610062694UL, 3089981426UL, 3469441840UL, 148510865UL, 1010959310UL, 2593994385UL, 548784340UL, 549871569UL, 124676809UL, 1825306744UL, 645229999UL, 1412095765UL, 2814231763UL, 2540745278UL, 3792219969UL, 2198765077UL, 1845119421UL, 4144145546UL, 3966655401UL, 268197516UL, 4144513299UL, +3231318896UL, 3382035479UL, 1674022032UL, 2786831464UL, 4236142563UL, 680649431UL, 3290999942UL, 4065303704UL, 3822069622UL, 3194332974UL, 4102392657UL, 2776797278UL, 3735376922UL, 525501162UL, 2149374605UL, 3736514467UL, 3547689148UL, 2064870756UL, 3219948462UL, 1497045279UL, 2945126332UL, 4285864315UL, 2389978045UL, 2678467476UL, 56752862UL, 864909862UL, 625377571UL, 2308006661UL, 2258093843UL, 925722519UL, 1008109592UL, 2819528345UL, +2927186231UL, 2743241289UL, 1536828870UL, 3225674336UL, 827428943UL, 1583633720UL, 992128922UL, 2186287936UL, 2299756421UL, 776912458UL, 298217241UL, 2108721702UL, 1271286102UL, 3987010398UL, 3996115574UL, 1041730366UL, 1315622698UL, 1036957208UL, 2597814974UL, 2328446377UL, 1386688725UL, 3098343478UL, 2395157917UL, 1141381380UL, 3025370440UL, 2292273773UL, 1317753106UL, 2727078785UL, 820119215UL, 3586778616UL, 206996196UL, 2295599934UL, +1171102868UL, 2120026924UL, 65722921UL, 3271158508UL, 3999203443UL, 2335086228UL, 1564918930UL, 3710935369UL, 3305544914UL, 1662083910UL, 1136716661UL, 770031171UL, 2062767935UL, 4244195826UL, 3271761171UL, 4100328450UL, 3352859025UL, 1262632952UL, 3581040310UL, 3981040854UL, 2579000299UL, 352450195UL, 1002557127UL, 1789606594UL, 1064251076UL, 2642514897UL, 4216846311UL, 1187381982UL, 1519386238UL, 2077640887UL, 3092488663UL, 655242013UL, +1152156402UL, 3732146227UL, 548941006UL, 3280658482UL, 2120064836UL, 3726555752UL, 2631398817UL, 4112878213UL, 584864345UL, 3874404446UL, 440995849UL, 3541162446UL, 227230803UL, 823950215UL, 3559119399UL, 3855477390UL, 560704260UL, 610498128UL, 2297040376UL, 2054191666UL, 2778642234UL, 1614756373UL, 518192832UL, 573807317UL, 1018128176UL, 2841084399UL, 927011949UL, 2512871059UL, 2747338726UL, 1091467742UL, 2743780329UL, 566198434UL, +386661563UL, 1715139924UL, 2712119598UL, 3296319359UL, 520529825UL, 2508754324UL, 3361368810UL, 2284913307UL, 740953233UL, 2414584088UL, 1296305541UL, 4290564545UL, 610062694UL, 3089981426UL, 120496553UL, 148510865UL, 1010959310UL, 2593994385UL, 548784340UL, 3206664898UL, 124676809UL, 1825306744UL, 645229999UL, 1412095765UL, 821445348UL, 2540745278UL, 3792219969UL, 2198765077UL, 1845119421UL, 3434574619UL, 3966655401UL, 268197516UL, +4144513299UL, 3231318896UL, 3856935910UL, 1674022032UL, 2786831464UL, 4236142563UL, 680649431UL, 3331403374UL, 4065303704UL, 3822069622UL, 3194332974UL, 4102392657UL, 2194924932UL, 3735376922UL, 525501162UL, 2149374605UL, 3736514467UL, 2041458481UL, 2064870756UL, 3219948462UL, 1497045279UL, 2945126332UL, 3515890044UL, 2389978045UL, 2678467476UL, 56752862UL, 864909862UL, 1009125580UL, 2308006661UL, 2258093843UL, 925722519UL, 1008109592UL, +4166824654UL, 3399481064UL, 3848337172UL, 841675162UL, 2388734555UL, 3373081217UL, 1627287001UL, 1958651480UL, 1771323855UL, 2126620758UL, 3879967947UL, 1885140905UL, 806066092UL, 2168342987UL, 3778265278UL, 943582962UL, 3895768303UL, 337928214UL, 3677576461UL, 1884088203UL, 2629440785UL, 2357038005UL, 2362450760UL, 2080907681UL, 2644383608UL, 4153875040UL, 794977307UL, 2675637463UL, 2655426076UL, 3481699657UL, 2262369403UL, 1038608931UL, +4210267953UL, 2376694315UL, 2661705117UL, 3994997027UL, 2994346963UL, 4074343171UL, 833108024UL, 3562046155UL, 1113632369UL, 3087093963UL, 2115712884UL, 2778607581UL, 2702162487UL, 1347693590UL, 4271098334UL, 2746712394UL, 1629623802UL, 1932973152UL, 3077074108UL, 1338011180UL, 848785806UL, 1834095770UL, 4017238UL, 2661097500UL, 2935787683UL, 1214195119UL, 3099491937UL, 3868451396UL, 1063740008UL, 2768962809UL, 2554721244UL, 695479209UL, +2634119800UL, 1379839034UL, 2653377927UL, 921934002UL, 3586936843UL, 3035369677UL, 769283110UL, 2417935220UL, 3330084607UL, 2020519519UL, 2546176786UL, 1523223165UL, 3654065096UL, 1835059231UL, 2776263618UL, 3837173427UL, 3236141295UL, 1184415634UL, 157448610UL, 2474336972UL, 3313035876UL, 309195150UL, 2288837115UL, 548743307UL, 528342914UL, 1527562212UL, 554918643UL, 2739291918UL, 2630873849UL, 155419923UL, 226845272UL, 1343735931UL, +3106346884UL, 4177975386UL, 2515480406UL, 2049734808UL, 2802879609UL, 1805234272UL, 317920918UL, 745796250UL, 3816657414UL, 4198378080UL, 3057334192UL, 503016924UL, 2027816790UL, 579332504UL, 3037999504UL, 2857298788UL, 911046668UL, 1170775701UL, 2369720UL, 3364839261UL, 1462383461UL, 181600856UL, 1315241696UL, 2861043792UL, 3549404088UL, 3974245218UL, 4141518566UL, 1195336199UL, 2291064152UL, 3287203016UL, 3867432937UL, 2593766219UL, +2114273192UL, 3716228986UL, 410286941UL, 2497285113UL, 1338500439UL, 3748757692UL, 2315519304UL, 545570554UL, 1519868916UL, 679216320UL, 3264840479UL, 4083041163UL, 261878334UL, 2370312122UL, 1408058272UL, 1287635274UL, 3433241543UL, 3923613754UL, 2423502603UL, 3948993135UL, 1418484161UL, 230113502UL, 1766447938UL, 3101286974UL, 917358979UL, 2836128279UL, 2859079881UL, 3162688352UL, 2158281644UL, 154509481UL, 2409785274UL, 3096379437UL, +}, +{ +2456954827UL, 2895978734UL, 1621803157UL, 230462381UL, 4046364119UL, 716597790UL, 2031510641UL, 2208319977UL, 1107910846UL, 3379950723UL, 3628284249UL, 1393263274UL, 3842378742UL, 768116962UL, 1782906996UL, 3022943801UL, 510040722UL, 2180373447UL, 1294989632UL, 1659724107UL, 953774117UL, 500296619UL, 2269873184UL, 3215368465UL, 3933601613UL, 2401810535UL, 3568992417UL, 617528376UL, 2437412983UL, 2921242388UL, 2311040363UL, 3695847323UL, +1609309841UL, 3222455492UL, 1108155620UL, 397599239UL, 3344183623UL, 1159383441UL, 81554651UL, 4223302962UL, 2812031899UL, 2613176831UL, 2967803832UL, 3560382993UL, 670173062UL, 2361031672UL, 1745444335UL, 2067906079UL, 3019908371UL, 2662226130UL, 2962440272UL, 3053411095UL, 92212044UL, 1041941495UL, 4116546365UL, 2094375399UL, 3992554702UL, 216246182UL, 2271736480UL, 1006434362UL, 4104644208UL, 2543874803UL, 1310440964UL, 1956002873UL, +1485192936UL, 3027546418UL, 448786402UL, 749040342UL, 406538664UL, 2522826782UL, 3681979470UL, 3941253886UL, 672615054UL, 3655479714UL, 392178376UL, 1619518340UL, 1639889010UL, 666186812UL, 4094569743UL, 2947917117UL, 3308938954UL, 1572886498UL, 1065510431UL, 2158389109UL, 1583642689UL, 1763046973UL, 3578310229UL, 4106948216UL, 58659757UL, 691952777UL, 3394715763UL, 3333944006UL, 3020203798UL, 3598064251UL, 3151881711UL, 2071056894UL, +1263790655UL, 4188233031UL, 4230429856UL, 3088041549UL, 3031631424UL, 3912597408UL, 1768734847UL, 1975027092UL, 3976493733UL, 2376551740UL, 1137628506UL, 535767974UL, 3105256806UL, 15427398UL, 2472341690UL, 685997424UL, 1374644561UL, 2446214061UL, 2844847931UL, 1058649390UL, 1581230869UL, 1725846082UL, 3062699842UL, 1116400547UL, 1095426642UL, 2940190462UL, 4276038488UL, 2091764667UL, 4074059985UL, 98163536UL, 4157153745UL, 32476821UL, +2354284775UL, 752663757UL, 2987293678UL, 1119786914UL, 3019442904UL, 111185876UL, 3569592548UL, 3991775183UL, 3161418733UL, 3973354577UL, 1650454973UL, 426129509UL, 3659038742UL, 1387393667UL, 543731583UL, 781586523UL, 917315276UL, 832142534UL, 3911092159UL, 325250500UL, 2735441676UL, 163564958UL, 1002098855UL, 337936437UL, 1869530240UL, 2233969733UL, 4108076124UL, 3255026725UL, 4072134049UL, 2083771067UL, 1559589006UL, 1845121907UL, +466036013UL, 2456954827UL, 2895978734UL, 1621803157UL, 230462381UL, 2022150409UL, 716597790UL, 2031510641UL, 2208319977UL, 1107910846UL, 1838834877UL, 3628284249UL, 1393263274UL, 3842378742UL, 768116962UL, 2303040715UL, 3022943801UL, 510040722UL, 2180373447UL, 1294989632UL, 3074858415UL, 953774117UL, 500296619UL, 2269873184UL, 3215368465UL, 3531413908UL, 2401810535UL, 3568992417UL, 617528376UL, 2437412983UL, 1730632320UL, 2311040363UL, +3695847323UL, 1609309841UL, 3222455492UL, 3189359980UL, 397599239UL, 3344183623UL, 1159383441UL, 81554651UL, 1933731121UL, 2812031899UL, 2613176831UL, 2967803832UL, 3560382993UL, 758113139UL, 2361031672UL, 1745444335UL, 2067906079UL, 3019908371UL, 3537991495UL, 2962440272UL, 3053411095UL, 92212044UL, 1041941495UL, 2653519981UL, 2094375399UL, 3992554702UL, 216246182UL, 2271736480UL, 695350220UL, 4104644208UL, 2543874803UL, 1310440964UL, +1956002873UL, 3373048130UL, 3027546418UL, 448786402UL, 749040342UL, 406538664UL, 4081844472UL, 3681979470UL, 3941253886UL, 672615054UL, 3655479714UL, 197563239UL, 1619518340UL, 1639889010UL, 666186812UL, 4094569743UL, 2518320719UL, 3308938954UL, 1572886498UL, 1065510431UL, 2158389109UL, 3320483696UL, 1763046973UL, 3578310229UL, 4106948216UL, 58659757UL, 3412172826UL, 3394715763UL, 3333944006UL, 3020203798UL, 3598064251UL, 1693717788UL, +2071056894UL, 1263790655UL, 4188233031UL, 4230429856UL, 2564478937UL, 3031631424UL, 3912597408UL, 1768734847UL, 1975027092UL, 3546175061UL, 2376551740UL, 1137628506UL, 535767974UL, 3105256806UL, 450760279UL, 2472341690UL, 685997424UL, 1374644561UL, 2446214061UL, 1873063065UL, 1058649390UL, 1581230869UL, 1725846082UL, 3062699842UL, 813496775UL, 1095426642UL, 2940190462UL, 4276038488UL, 2091764667UL, 3857233976UL, 98163536UL, 4157153745UL, +32476821UL, 2354284775UL, 3115605568UL, 2987293678UL, 1119786914UL, 3019442904UL, 111185876UL, 996447434UL, 3991775183UL, 3161418733UL, 3973354577UL, 1650454973UL, 1089784804UL, 3659038742UL, 1387393667UL, 543731583UL, 781586523UL, 2711412312UL, 832142534UL, 3911092159UL, 325250500UL, 2735441676UL, 3563501139UL, 1002098855UL, 337936437UL, 1869530240UL, 2233969733UL, 1156926454UL, 3255026725UL, 4072134049UL, 2083771067UL, 1559589006UL, +3832870112UL, 466036013UL, 2456954827UL, 2895978734UL, 1621803157UL, 2340808859UL, 2022150409UL, 716597790UL, 2031510641UL, 2208319977UL, 1823993818UL, 1838834877UL, 3628284249UL, 1393263274UL, 3842378742UL, 2489609764UL, 2303040715UL, 3022943801UL, 510040722UL, 2180373447UL, 4204167795UL, 3074858415UL, 953774117UL, 500296619UL, 2269873184UL, 2320314628UL, 3531413908UL, 2401810535UL, 3568992417UL, 617528376UL, 712451843UL, 1730632320UL, +2311040363UL, 3695847323UL, 1609309841UL, 3224192365UL, 3189359980UL, 397599239UL, 3344183623UL, 1159383441UL, 758272390UL, 1933731121UL, 2812031899UL, 2613176831UL, 2967803832UL, 3986798661UL, 758113139UL, 2361031672UL, 1745444335UL, 2067906079UL, 3814344052UL, 3537991495UL, 2962440272UL, 3053411095UL, 92212044UL, 817573506UL, 2653519981UL, 2094375399UL, 3992554702UL, 216246182UL, 2456924809UL, 695350220UL, 4104644208UL, 2543874803UL, +1310440964UL, 1151286621UL, 3373048130UL, 3027546418UL, 448786402UL, 749040342UL, 637572176UL, 4081844472UL, 3681979470UL, 3941253886UL, 672615054UL, 3038758846UL, 197563239UL, 1619518340UL, 1639889010UL, 666186812UL, 4254608071UL, 2518320719UL, 3308938954UL, 1572886498UL, 1065510431UL, 3100620860UL, 3320483696UL, 1763046973UL, 3578310229UL, 4106948216UL, 403923766UL, 3412172826UL, 3394715763UL, 3333944006UL, 3020203798UL, 1859724785UL, +1693717788UL, 2071056894UL, 1263790655UL, 4188233031UL, 2908736862UL, 2564478937UL, 3031631424UL, 3912597408UL, 1768734847UL, 966714666UL, 3546175061UL, 2376551740UL, 1137628506UL, 535767974UL, 1561255376UL, 450760279UL, 2472341690UL, 685997424UL, 1374644561UL, 3122124160UL, 1873063065UL, 1058649390UL, 1581230869UL, 1725846082UL, 3791666219UL, 813496775UL, 1095426642UL, 2940190462UL, 4276038488UL, 2802023399UL, 3857233976UL, 98163536UL, +4157153745UL, 32476821UL, 1640659450UL, 3115605568UL, 2987293678UL, 1119786914UL, 3019442904UL, 4278091706UL, 996447434UL, 3991775183UL, 3161418733UL, 3973354577UL, 3398421232UL, 1089784804UL, 3659038742UL, 1387393667UL, 543731583UL, 1694361696UL, 2711412312UL, 832142534UL, 3911092159UL, 325250500UL, 166035542UL, 3563501139UL, 1002098855UL, 337936437UL, 1869530240UL, 1306446339UL, 1156926454UL, 3255026725UL, 4072134049UL, 2083771067UL, +61899937UL, 3832870112UL, 466036013UL, 2456954827UL, 2895978734UL, 767569205UL, 2340808859UL, 2022150409UL, 716597790UL, 2031510641UL, 1690074863UL, 1823993818UL, 1838834877UL, 3628284249UL, 1393263274UL, 546011580UL, 2489609764UL, 2303040715UL, 3022943801UL, 510040722UL, 825252468UL, 4204167795UL, 3074858415UL, 953774117UL, 500296619UL, 1952242515UL, 2320314628UL, 3531413908UL, 2401810535UL, 3568992417UL, 4254767597UL, 712451843UL, +1730632320UL, 2311040363UL, 3695847323UL, 2393864919UL, 3224192365UL, 3189359980UL, 397599239UL, 3344183623UL, 1759399025UL, 758272390UL, 1933731121UL, 2812031899UL, 2613176831UL, 2809078783UL, 3986798661UL, 758113139UL, 2361031672UL, 1745444335UL, 1223235915UL, 3814344052UL, 3537991495UL, 2962440272UL, 3053411095UL, 3711100000UL, 817573506UL, 2653519981UL, 2094375399UL, 3992554702UL, 2987412942UL, 2456924809UL, 695350220UL, 4104644208UL, +2543874803UL, 2746231792UL, 1151286621UL, 3373048130UL, 3027546418UL, 448786402UL, 801157439UL, 637572176UL, 4081844472UL, 3681979470UL, 3941253886UL, 975875511UL, 3038758846UL, 197563239UL, 1619518340UL, 1639889010UL, 3137491209UL, 4254608071UL, 2518320719UL, 3308938954UL, 1572886498UL, 631178204UL, 3100620860UL, 3320483696UL, 1763046973UL, 3578310229UL, 3338308117UL, 403923766UL, 3412172826UL, 3394715763UL, 3333944006UL, 37220448UL, +1859724785UL, 1693717788UL, 2071056894UL, 1263790655UL, 228419012UL, 2908736862UL, 2564478937UL, 3031631424UL, 3912597408UL, 3862306448UL, 966714666UL, 3546175061UL, 2376551740UL, 1137628506UL, 1114919961UL, 1561255376UL, 450760279UL, 2472341690UL, 685997424UL, 2456661198UL, 3122124160UL, 1873063065UL, 1058649390UL, 1581230869UL, 2996925693UL, 3791666219UL, 813496775UL, 1095426642UL, 2940190462UL, 1642720015UL, 2802023399UL, 3857233976UL, +98163536UL, 4157153745UL, 1578965959UL, 1640659450UL, 3115605568UL, 2987293678UL, 1119786914UL, 1748408698UL, 4278091706UL, 996447434UL, 3991775183UL, 3161418733UL, 4123935663UL, 3398421232UL, 1089784804UL, 3659038742UL, 1387393667UL, 770706529UL, 1694361696UL, 2711412312UL, 832142534UL, 3911092159UL, 335435644UL, 166035542UL, 3563501139UL, 1002098855UL, 337936437UL, 2961857543UL, 1306446339UL, 1156926454UL, 3255026725UL, 4072134049UL, +1717290230UL, 1323146393UL, 2156340433UL, 2065716367UL, 2597996276UL, 3402032152UL, 779574284UL, 2369501052UL, 2316224856UL, 2720986136UL, 3016786025UL, 2916554213UL, 3476215746UL, 1132150235UL, 2619889920UL, 1279664685UL, 679206534UL, 4014394509UL, 3624968312UL, 1480455625UL, 725015758UL, 707677352UL, 3764409715UL, 1938306480UL, 2171474419UL, 3379664161UL, 684262379UL, 2142433069UL, 43407198UL, 1398850259UL, 2059135843UL, 240266749UL, +3788738212UL, 118513026UL, 820245055UL, 1152812311UL, 1398373423UL, 3188977726UL, 872620936UL, 2084649448UL, 807979538UL, 819501992UL, 615447916UL, 3393148006UL, 1765623964UL, 2514767257UL, 3711360450UL, 2941886951UL, 3739102698UL, 4022385962UL, 2306039667UL, 3321267290UL, 2179238310UL, 3192652502UL, 2118792870UL, 2571142127UL, 761776508UL, 873010906UL, 1609627751UL, 4260021041UL, 1747852747UL, 960771906UL, 2647903291UL, 77475681UL, +1282566533UL, 4022186916UL, 2681128032UL, 1554542462UL, 3181701944UL, 1168469070UL, 74236514UL, 2806532232UL, 3981048887UL, 1888842784UL, 2888607878UL, 1763028723UL, 701886756UL, 4124077776UL, 3738147505UL, 4066663138UL, 3816449863UL, 921061872UL, 2956972182UL, 3159072916UL, 3337110888UL, 3552795700UL, 2281281091UL, 671098116UL, 1282750020UL, 1008618197UL, 2363767765UL, 1812013295UL, 1854965999UL, 131027176UL, 666394000UL, 2062217824UL, +1763334218UL, 551118598UL, 1277961175UL, 3523893635UL, 1855881150UL, 2067903393UL, 2590963277UL, 3214508854UL, 1604911832UL, 1906690475UL, 389417851UL, 2711591984UL, 427723436UL, 1039703630UL, 639602991UL, 444779318UL, 2722002973UL, 3927985419UL, 1297446054UL, 298277450UL, 656022205UL, 134304205UL, 3847728042UL, 3339100423UL, 407022043UL, 1282443442UL, 3173884578UL, 1417906094UL, 2364502739UL, 2158353472UL, 2402775649UL, 1807696073UL, +2837535198UL, 705887737UL, 2129202688UL, 3853676283UL, 1388329793UL, 875153687UL, 2367465660UL, 2763058233UL, 2500632304UL, 2196920062UL, 491306883UL, 277753357UL, 3868415380UL, 324867643UL, 3654474955UL, 2569410351UL, 1128175417UL, 1853572398UL, 1133201743UL, 662085935UL, 2263514999UL, 3077768113UL, 3309730620UL, 3602394176UL, 3747458070UL, 188422725UL, 813812450UL, 1502276531UL, 3909138356UL, 2766044599UL, 3760928321UL, 573108836UL, +}, +{ +1240264181UL, 1624064648UL, 3039823158UL, 2013985253UL, 1473300299UL, 2762062141UL, 3273470484UL, 1889745445UL, 2516996174UL, 3190376531UL, 996186898UL, 3893981177UL, 1268272590UL, 3226095713UL, 153038465UL, 2184871198UL, 3224094011UL, 2526518401UL, 1738960059UL, 1187560605UL, 4194384320UL, 2837011297UL, 3638232350UL, 367907454UL, 574009898UL, 1948901330UL, 60430044UL, 1569835584UL, 3160561697UL, 321792583UL, 3179087993UL, 1936928378UL, +412346905UL, 4020812489UL, 2603392174UL, 3499496781UL, 1499441233UL, 1062415256UL, 1347130973UL, 1823246794UL, 3411391800UL, 4253618056UL, 1507733072UL, 1605629518UL, 1503312494UL, 8035741UL, 4038904206UL, 2408545792UL, 969543501UL, 954847087UL, 956553276UL, 3096241999UL, 2566194741UL, 84678421UL, 3882676079UL, 2483934330UL, 3673546814UL, 2461422466UL, 620385599UL, 898325340UL, 2145883445UL, 3653728520UL, 3744850294UL, 2441124935UL, +904854507UL, 3216304963UL, 2373268568UL, 2354362010UL, 1245572787UL, 2894748714UL, 2889136188UL, 3716879184UL, 1766013949UL, 1305712667UL, 1227530310UL, 4051221847UL, 925440190UL, 1508686692UL, 1104647879UL, 1496666754UL, 3300504219UL, 127787091UL, 1528394637UL, 1739640835UL, 2475711496UL, 3792639955UL, 1450796299UL, 1634217367UL, 3289785095UL, 2149949989UL, 811612039UL, 1750779366UL, 1157474938UL, 514004414UL, 2264909096UL, 3730411668UL, +3308882513UL, 1834571716UL, 378288317UL, 3800023701UL, 763396788UL, 1597708317UL, 983953861UL, 94566098UL, 1548157668UL, 3755427117UL, 1646496505UL, 3748241449UL, 3439805936UL, 2321644449UL, 3805706235UL, 4220083901UL, 1069923823UL, 2984004391UL, 3824885361UL, 1967477766UL, 218978249UL, 348955028UL, 3188651823UL, 1008338679UL, 2331688720UL, 1562995454UL, 1837179689UL, 3033872688UL, 3007293665UL, 1759522678UL, 319754369UL, 2763991927UL, +1983149629UL, 1353197132UL, 1489552694UL, 2990539062UL, 3244609108UL, 669775440UL, 886127995UL, 1636688014UL, 1251222487UL, 2351883247UL, 3261502906UL, 3139614137UL, 3203790139UL, 2777648095UL, 3693390579UL, 3540514982UL, 3200191735UL, 750726325UL, 1014534145UL, 2091792357UL, 3931704474UL, 1383925867UL, 2038878506UL, 2247134268UL, 2840132188UL, 61137652UL, 1162051299UL, 399657268UL, 1682018695UL, 2640231287UL, 1733438115UL, 3611823506UL, +2077891037UL, 1240264181UL, 1624064648UL, 3039823158UL, 2013985253UL, 4188888201UL, 2762062141UL, 3273470484UL, 1889745445UL, 2516996174UL, 2621448256UL, 996186898UL, 3893981177UL, 1268272590UL, 3226095713UL, 952803645UL, 2184871198UL, 3224094011UL, 2526518401UL, 1738960059UL, 738368399UL, 4194384320UL, 2837011297UL, 3638232350UL, 367907454UL, 3772812520UL, 1948901330UL, 60430044UL, 1569835584UL, 3160561697UL, 1655622513UL, 3179087993UL, +1936928378UL, 412346905UL, 4020812489UL, 3754224996UL, 3499496781UL, 1499441233UL, 1062415256UL, 1347130973UL, 1167581269UL, 3411391800UL, 4253618056UL, 1507733072UL, 1605629518UL, 1867781671UL, 8035741UL, 4038904206UL, 2408545792UL, 969543501UL, 3189323143UL, 956553276UL, 3096241999UL, 2566194741UL, 84678421UL, 996778900UL, 2483934330UL, 3673546814UL, 2461422466UL, 620385599UL, 3129088144UL, 2145883445UL, 3653728520UL, 3744850294UL, +2441124935UL, 4230756652UL, 3216304963UL, 2373268568UL, 2354362010UL, 1245572787UL, 1600525238UL, 2889136188UL, 3716879184UL, 1766013949UL, 1305712667UL, 59908073UL, 4051221847UL, 925440190UL, 1508686692UL, 1104647879UL, 2931214731UL, 3300504219UL, 127787091UL, 1528394637UL, 1739640835UL, 62963469UL, 3792639955UL, 1450796299UL, 1634217367UL, 3289785095UL, 667987389UL, 811612039UL, 1750779366UL, 1157474938UL, 514004414UL, 2737193098UL, +3730411668UL, 3308882513UL, 1834571716UL, 378288317UL, 3452657469UL, 763396788UL, 1597708317UL, 983953861UL, 94566098UL, 2752347916UL, 3755427117UL, 1646496505UL, 3748241449UL, 3439805936UL, 4222757079UL, 3805706235UL, 4220083901UL, 1069923823UL, 2984004391UL, 3887639520UL, 1967477766UL, 218978249UL, 348955028UL, 3188651823UL, 4168456281UL, 2331688720UL, 1562995454UL, 1837179689UL, 3033872688UL, 814903833UL, 1759522678UL, 319754369UL, +2763991927UL, 1983149629UL, 3818528075UL, 1489552694UL, 2990539062UL, 3244609108UL, 669775440UL, 1004789460UL, 1636688014UL, 1251222487UL, 2351883247UL, 3261502906UL, 4143823654UL, 3203790139UL, 2777648095UL, 3693390579UL, 3540514982UL, 153421222UL, 750726325UL, 1014534145UL, 2091792357UL, 3931704474UL, 4018591985UL, 2038878506UL, 2247134268UL, 2840132188UL, 61137652UL, 1455028838UL, 399657268UL, 1682018695UL, 2640231287UL, 1733438115UL, +1853142849UL, 2077891037UL, 1240264181UL, 1624064648UL, 3039823158UL, 2235369076UL, 4188888201UL, 2762062141UL, 3273470484UL, 1889745445UL, 3627876603UL, 2621448256UL, 996186898UL, 3893981177UL, 1268272590UL, 2687846008UL, 952803645UL, 2184871198UL, 3224094011UL, 2526518401UL, 861379413UL, 738368399UL, 4194384320UL, 2837011297UL, 3638232350UL, 3753321702UL, 3772812520UL, 1948901330UL, 60430044UL, 1569835584UL, 581506474UL, 1655622513UL, +3179087993UL, 1936928378UL, 412346905UL, 2710043900UL, 3754224996UL, 3499496781UL, 1499441233UL, 1062415256UL, 2704745463UL, 1167581269UL, 3411391800UL, 4253618056UL, 1507733072UL, 4215403465UL, 1867781671UL, 8035741UL, 4038904206UL, 2408545792UL, 3252742933UL, 3189323143UL, 956553276UL, 3096241999UL, 2566194741UL, 1865159158UL, 996778900UL, 2483934330UL, 3673546814UL, 2461422466UL, 3123557619UL, 3129088144UL, 2145883445UL, 3653728520UL, +3744850294UL, 21840044UL, 4230756652UL, 3216304963UL, 2373268568UL, 2354362010UL, 1934462999UL, 1600525238UL, 2889136188UL, 3716879184UL, 1766013949UL, 2822794708UL, 59908073UL, 4051221847UL, 925440190UL, 1508686692UL, 2938291976UL, 2931214731UL, 3300504219UL, 127787091UL, 1528394637UL, 1914923136UL, 62963469UL, 3792639955UL, 1450796299UL, 1634217367UL, 257322213UL, 667987389UL, 811612039UL, 1750779366UL, 1157474938UL, 3083649350UL, +2737193098UL, 3730411668UL, 3308882513UL, 1834571716UL, 2778729422UL, 3452657469UL, 763396788UL, 1597708317UL, 983953861UL, 1337754195UL, 2752347916UL, 3755427117UL, 1646496505UL, 3748241449UL, 3942745717UL, 4222757079UL, 3805706235UL, 4220083901UL, 1069923823UL, 1314928500UL, 3887639520UL, 1967477766UL, 218978249UL, 348955028UL, 3425797638UL, 4168456281UL, 2331688720UL, 1562995454UL, 1837179689UL, 1814071277UL, 814903833UL, 1759522678UL, +319754369UL, 2763991927UL, 1079270448UL, 3818528075UL, 1489552694UL, 2990539062UL, 3244609108UL, 2944573315UL, 1004789460UL, 1636688014UL, 1251222487UL, 2351883247UL, 1356892540UL, 4143823654UL, 3203790139UL, 2777648095UL, 3693390579UL, 983917956UL, 153421222UL, 750726325UL, 1014534145UL, 2091792357UL, 296882400UL, 4018591985UL, 2038878506UL, 2247134268UL, 2840132188UL, 3508266160UL, 1455028838UL, 399657268UL, 1682018695UL, 2640231287UL, +2480988791UL, 1853142849UL, 2077891037UL, 1240264181UL, 1624064648UL, 1741738969UL, 2235369076UL, 4188888201UL, 2762062141UL, 3273470484UL, 3569498651UL, 3627876603UL, 2621448256UL, 996186898UL, 3893981177UL, 4026533880UL, 2687846008UL, 952803645UL, 2184871198UL, 3224094011UL, 1290870737UL, 861379413UL, 738368399UL, 4194384320UL, 2837011297UL, 3833099205UL, 3753321702UL, 3772812520UL, 1948901330UL, 60430044UL, 4131290878UL, 581506474UL, +1655622513UL, 3179087993UL, 1936928378UL, 2379952582UL, 2710043900UL, 3754224996UL, 3499496781UL, 1499441233UL, 593780490UL, 2704745463UL, 1167581269UL, 3411391800UL, 4253618056UL, 621889762UL, 4215403465UL, 1867781671UL, 8035741UL, 4038904206UL, 2045289976UL, 3252742933UL, 3189323143UL, 956553276UL, 3096241999UL, 2188329018UL, 1865159158UL, 996778900UL, 2483934330UL, 3673546814UL, 2717648418UL, 3123557619UL, 3129088144UL, 2145883445UL, +3653728520UL, 1528077261UL, 21840044UL, 4230756652UL, 3216304963UL, 2373268568UL, 803158556UL, 1934462999UL, 1600525238UL, 2889136188UL, 3716879184UL, 161827512UL, 2822794708UL, 59908073UL, 4051221847UL, 925440190UL, 3599942370UL, 2938291976UL, 2931214731UL, 3300504219UL, 127787091UL, 4082579845UL, 1914923136UL, 62963469UL, 3792639955UL, 1450796299UL, 2035446714UL, 257322213UL, 667987389UL, 811612039UL, 1750779366UL, 2344204796UL, +3083649350UL, 2737193098UL, 3730411668UL, 3308882513UL, 2765191583UL, 2778729422UL, 3452657469UL, 763396788UL, 1597708317UL, 1854746879UL, 1337754195UL, 2752347916UL, 3755427117UL, 1646496505UL, 4020292301UL, 3942745717UL, 4222757079UL, 3805706235UL, 4220083901UL, 1408262601UL, 1314928500UL, 3887639520UL, 1967477766UL, 218978249UL, 2173193841UL, 3425797638UL, 4168456281UL, 2331688720UL, 1562995454UL, 2835294077UL, 1814071277UL, 814903833UL, +1759522678UL, 319754369UL, 4048528178UL, 1079270448UL, 3818528075UL, 1489552694UL, 2990539062UL, 787253600UL, 2944573315UL, 1004789460UL, 1636688014UL, 1251222487UL, 3584515216UL, 1356892540UL, 4143823654UL, 3203790139UL, 2777648095UL, 1681621541UL, 983917956UL, 153421222UL, 750726325UL, 1014534145UL, 3951869055UL, 296882400UL, 4018591985UL, 2038878506UL, 2247134268UL, 1990726826UL, 3508266160UL, 1455028838UL, 399657268UL, 1682018695UL, +3360119279UL, 3151120565UL, 3011208718UL, 3694535943UL, 104562665UL, 2827623271UL, 249712003UL, 3413221355UL, 2347164236UL, 3227498378UL, 1805068659UL, 2118219686UL, 1568133029UL, 902801951UL, 175637375UL, 3812819970UL, 2162769758UL, 3845613089UL, 1795179477UL, 171494391UL, 3765826349UL, 1725798906UL, 345463508UL, 2481043227UL, 226569380UL, 3250095421UL, 1085199388UL, 3107594542UL, 4011388155UL, 1092611190UL, 3239339214UL, 4211849464UL, +4109911546UL, 81212018UL, 3691937144UL, 2477407396UL, 3320520455UL, 3070067913UL, 3808621884UL, 252917069UL, 3394860294UL, 1092442235UL, 2876536384UL, 1684120191UL, 431096075UL, 1701716708UL, 639881684UL, 3066183997UL, 3660504927UL, 2047274UL, 3424756424UL, 760932520UL, 2457976057UL, 1705265011UL, 2691137533UL, 3684307557UL, 3532744498UL, 2319162513UL, 1015534908UL, 1907173398UL, 2820698743UL, 1264455116UL, 2323788906UL, 3062240844UL, +1878550513UL, 1717353426UL, 1805673248UL, 62425157UL, 3662381032UL, 1964107209UL, 2559831960UL, 2117844804UL, 1228721677UL, 4240498866UL, 3212920337UL, 2338600301UL, 931588693UL, 2379606585UL, 3643222352UL, 4154645082UL, 1115847065UL, 2079427925UL, 2256943798UL, 2795103368UL, 2688136486UL, 1458062143UL, 1767222217UL, 635424385UL, 284062050UL, 1547163554UL, 3380046528UL, 1145758046UL, 3935976713UL, 4017430175UL, 3863367362UL, 3041367424UL, +303263160UL, 1465965696UL, 3757919837UL, 3083072836UL, 4024514094UL, 1381331179UL, 2393446325UL, 3256476469UL, 4066482738UL, 3437941107UL, 1051266504UL, 921764078UL, 2933305619UL, 1358097211UL, 4100978724UL, 2709958834UL, 574590507UL, 961767386UL, 21100886UL, 753746372UL, 4072632446UL, 733729367UL, 3060214669UL, 289165105UL, 426065754UL, 2036100240UL, 2172365757UL, 502856627UL, 84490194UL, 2630806596UL, 1206161269UL, 1009438449UL, +569581317UL, 1836947000UL, 3125379675UL, 1756936428UL, 3772694822UL, 3670337911UL, 3020603818UL, 2376224883UL, 2539951453UL, 2053395002UL, 3525193914UL, 1991480838UL, 3786481083UL, 873873707UL, 1693894743UL, 2450223985UL, 754878026UL, 1943356492UL, 401524329UL, 759931885UL, 611231307UL, 147950334UL, 599693701UL, 3358729722UL, 3649058074UL, 906423787UL, 1333804225UL, 875187278UL, 1115838692UL, 2476325972UL, 3307226674UL, 3539078918UL, +}, + +}; +#ifndef __CUDACC_RTC__ +CURAND_XORWOW_PRECALCULATED_HOST_QUALIFIERS unsigned int precalc_xorwow_offset_matrix_host[32][800] = { +{ +0UL, 0UL, 0UL, 0UL, 3UL, 0UL, 0UL, 0UL, 0UL, 6UL, 0UL, 0UL, 0UL, 0UL, 15UL, 0UL, 0UL, 0UL, 0UL, 30UL, 0UL, 0UL, 0UL, 0UL, 60UL, 0UL, 0UL, 0UL, 0UL, 120UL, 0UL, 0UL, +0UL, 0UL, 240UL, 0UL, 0UL, 0UL, 0UL, 480UL, 0UL, 0UL, 0UL, 0UL, 960UL, 0UL, 0UL, 0UL, 0UL, 1920UL, 0UL, 0UL, 0UL, 0UL, 3840UL, 0UL, 0UL, 0UL, 0UL, 7680UL, 0UL, 0UL, 0UL, 0UL, +15360UL, 0UL, 0UL, 0UL, 0UL, 30720UL, 0UL, 0UL, 0UL, 0UL, 61440UL, 0UL, 0UL, 0UL, 0UL, 122880UL, 0UL, 0UL, 0UL, 0UL, 245760UL, 0UL, 0UL, 0UL, 0UL, 491520UL, 0UL, 0UL, 0UL, 0UL, 983040UL, 0UL, +0UL, 0UL, 0UL, 1966080UL, 0UL, 0UL, 0UL, 0UL, 3932160UL, 0UL, 0UL, 0UL, 0UL, 7864320UL, 0UL, 0UL, 0UL, 0UL, 15728640UL, 0UL, 0UL, 0UL, 0UL, 31457280UL, 0UL, 0UL, 0UL, 0UL, 62914560UL, 0UL, 0UL, 0UL, +0UL, 125829120UL, 0UL, 0UL, 0UL, 0UL, 251658240UL, 0UL, 0UL, 0UL, 0UL, 503316480UL, 0UL, 0UL, 0UL, 0UL, 1006632960UL, 0UL, 0UL, 0UL, 0UL, 2013265920UL, 0UL, 0UL, 0UL, 0UL, 4026531840UL, 0UL, 0UL, 0UL, 0UL, 3758096384UL, +1UL, 0UL, 0UL, 0UL, 0UL, 2UL, 0UL, 0UL, 0UL, 0UL, 4UL, 0UL, 0UL, 0UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 16UL, 0UL, 0UL, 0UL, 0UL, 32UL, 0UL, 0UL, 0UL, 0UL, 64UL, 0UL, +0UL, 0UL, 0UL, 128UL, 0UL, 0UL, 0UL, 0UL, 256UL, 0UL, 0UL, 0UL, 0UL, 512UL, 0UL, 0UL, 0UL, 0UL, 1024UL, 0UL, 0UL, 0UL, 0UL, 2048UL, 0UL, 0UL, 0UL, 0UL, 4096UL, 0UL, 0UL, 0UL, +0UL, 8192UL, 0UL, 0UL, 0UL, 0UL, 16384UL, 0UL, 0UL, 0UL, 0UL, 32768UL, 0UL, 0UL, 0UL, 0UL, 65536UL, 0UL, 0UL, 0UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 262144UL, 0UL, 0UL, 0UL, 0UL, 524288UL, +0UL, 0UL, 0UL, 0UL, 1048576UL, 0UL, 0UL, 0UL, 0UL, 2097152UL, 0UL, 0UL, 0UL, 0UL, 4194304UL, 0UL, 0UL, 0UL, 0UL, 8388608UL, 0UL, 0UL, 0UL, 0UL, 16777216UL, 0UL, 0UL, 0UL, 0UL, 33554432UL, 0UL, 0UL, +0UL, 0UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 134217728UL, 0UL, 0UL, 0UL, 0UL, 268435456UL, 0UL, 0UL, 0UL, 0UL, 536870912UL, 0UL, 0UL, 0UL, 0UL, 1073741824UL, 0UL, 0UL, 0UL, 0UL, 2147483648UL, 0UL, 0UL, 0UL, 0UL, +0UL, 1UL, 0UL, 0UL, 0UL, 0UL, 2UL, 0UL, 0UL, 0UL, 0UL, 4UL, 0UL, 0UL, 0UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 16UL, 0UL, 0UL, 0UL, 0UL, 32UL, 0UL, 0UL, 0UL, 0UL, 64UL, +0UL, 0UL, 0UL, 0UL, 128UL, 0UL, 0UL, 0UL, 0UL, 256UL, 0UL, 0UL, 0UL, 0UL, 512UL, 0UL, 0UL, 0UL, 0UL, 1024UL, 0UL, 0UL, 0UL, 0UL, 2048UL, 0UL, 0UL, 0UL, 0UL, 4096UL, 0UL, 0UL, +0UL, 0UL, 8192UL, 0UL, 0UL, 0UL, 0UL, 16384UL, 0UL, 0UL, 0UL, 0UL, 32768UL, 0UL, 0UL, 0UL, 0UL, 65536UL, 0UL, 0UL, 0UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 262144UL, 0UL, 0UL, 0UL, 0UL, +524288UL, 0UL, 0UL, 0UL, 0UL, 1048576UL, 0UL, 0UL, 0UL, 0UL, 2097152UL, 0UL, 0UL, 0UL, 0UL, 4194304UL, 0UL, 0UL, 0UL, 0UL, 8388608UL, 0UL, 0UL, 0UL, 0UL, 16777216UL, 0UL, 0UL, 0UL, 0UL, 33554432UL, 0UL, +0UL, 0UL, 0UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 134217728UL, 0UL, 0UL, 0UL, 0UL, 268435456UL, 0UL, 0UL, 0UL, 0UL, 536870912UL, 0UL, 0UL, 0UL, 0UL, 1073741824UL, 0UL, 0UL, 0UL, 0UL, 2147483648UL, 0UL, 0UL, 0UL, +0UL, 0UL, 1UL, 0UL, 0UL, 0UL, 0UL, 2UL, 0UL, 0UL, 0UL, 0UL, 4UL, 0UL, 0UL, 0UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 16UL, 0UL, 0UL, 0UL, 0UL, 32UL, 0UL, 0UL, 0UL, 0UL, +64UL, 0UL, 0UL, 0UL, 0UL, 128UL, 0UL, 0UL, 0UL, 0UL, 256UL, 0UL, 0UL, 0UL, 0UL, 512UL, 0UL, 0UL, 0UL, 0UL, 1024UL, 0UL, 0UL, 0UL, 0UL, 2048UL, 0UL, 0UL, 0UL, 0UL, 4096UL, 0UL, +0UL, 0UL, 0UL, 8192UL, 0UL, 0UL, 0UL, 0UL, 16384UL, 0UL, 0UL, 0UL, 0UL, 32768UL, 0UL, 0UL, 0UL, 0UL, 65536UL, 0UL, 0UL, 0UL, 0UL, 131072UL, 0UL, 0UL, 0UL, 0UL, 262144UL, 0UL, 0UL, 0UL, +0UL, 524288UL, 0UL, 0UL, 0UL, 0UL, 1048576UL, 0UL, 0UL, 0UL, 0UL, 2097152UL, 0UL, 0UL, 0UL, 0UL, 4194304UL, 0UL, 0UL, 0UL, 0UL, 8388608UL, 0UL, 0UL, 0UL, 0UL, 16777216UL, 0UL, 0UL, 0UL, 0UL, 33554432UL, +0UL, 0UL, 0UL, 0UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 134217728UL, 0UL, 0UL, 0UL, 0UL, 268435456UL, 0UL, 0UL, 0UL, 0UL, 536870912UL, 0UL, 0UL, 0UL, 0UL, 1073741824UL, 0UL, 0UL, 0UL, 0UL, 2147483648UL, 0UL, 0UL, +0UL, 0UL, 0UL, 1UL, 17UL, 0UL, 0UL, 0UL, 2UL, 34UL, 0UL, 0UL, 0UL, 4UL, 68UL, 0UL, 0UL, 0UL, 8UL, 136UL, 0UL, 0UL, 0UL, 16UL, 272UL, 0UL, 0UL, 0UL, 32UL, 544UL, 0UL, 0UL, +0UL, 64UL, 1088UL, 0UL, 0UL, 0UL, 128UL, 2176UL, 0UL, 0UL, 0UL, 256UL, 4352UL, 0UL, 0UL, 0UL, 512UL, 8704UL, 0UL, 0UL, 0UL, 1024UL, 17408UL, 0UL, 0UL, 0UL, 2048UL, 34816UL, 0UL, 0UL, 0UL, 4096UL, +69632UL, 0UL, 0UL, 0UL, 8192UL, 139264UL, 0UL, 0UL, 0UL, 16384UL, 278528UL, 0UL, 0UL, 0UL, 32768UL, 557056UL, 0UL, 0UL, 0UL, 65536UL, 1114112UL, 0UL, 0UL, 0UL, 131072UL, 2228224UL, 0UL, 0UL, 0UL, 262144UL, 4456448UL, 0UL, +0UL, 0UL, 524288UL, 8912896UL, 0UL, 0UL, 0UL, 1048576UL, 17825792UL, 0UL, 0UL, 0UL, 2097152UL, 35651584UL, 0UL, 0UL, 0UL, 4194304UL, 71303168UL, 0UL, 0UL, 0UL, 8388608UL, 142606336UL, 0UL, 0UL, 0UL, 16777216UL, 285212672UL, 0UL, 0UL, 0UL, +33554432UL, 570425344UL, 0UL, 0UL, 0UL, 67108864UL, 1140850688UL, 0UL, 0UL, 0UL, 134217728UL, 2281701376UL, 0UL, 0UL, 0UL, 268435456UL, 268435456UL, 0UL, 0UL, 0UL, 536870912UL, 536870912UL, 0UL, 0UL, 0UL, 1073741824UL, 1073741824UL, 0UL, 0UL, 0UL, 2147483648UL, 2147483648UL, +}, +{ +0UL, 3UL, 51UL, 771UL, 13107UL, 0UL, 6UL, 102UL, 1542UL, 26214UL, 0UL, 15UL, 255UL, 3855UL, 65535UL, 0UL, 30UL, 510UL, 7710UL, 131070UL, 0UL, 60UL, 1020UL, 15420UL, 262140UL, 0UL, 120UL, 2040UL, 30840UL, 524280UL, 0UL, 240UL, +4080UL, 61680UL, 1048560UL, 0UL, 480UL, 8160UL, 123360UL, 2097120UL, 0UL, 960UL, 16320UL, 246720UL, 4194240UL, 0UL, 1920UL, 32640UL, 493440UL, 8388480UL, 0UL, 3840UL, 65280UL, 986880UL, 16776960UL, 0UL, 7680UL, 130560UL, 1973760UL, 33553920UL, 0UL, 15360UL, 261120UL, 3947520UL, +67107840UL, 0UL, 30720UL, 522240UL, 7895040UL, 134215680UL, 0UL, 61440UL, 1044480UL, 15790080UL, 268431360UL, 0UL, 122880UL, 2088960UL, 31580160UL, 536862720UL, 0UL, 245760UL, 4177920UL, 63160320UL, 1073725440UL, 0UL, 491520UL, 8355840UL, 126320640UL, 2147450880UL, 0UL, 983040UL, 16711680UL, 252641280UL, 4294901760UL, 0UL, +1966080UL, 33423360UL, 505282560UL, 4294836224UL, 0UL, 3932160UL, 66846720UL, 1010565120UL, 4294705152UL, 0UL, 7864320UL, 133693440UL, 2021130240UL, 4294443008UL, 0UL, 15728640UL, 267386880UL, 4042260480UL, 4293918720UL, 0UL, 31457280UL, 534773760UL, 3789553664UL, 4292870144UL, 0UL, 62914560UL, 1069547520UL, 3284140032UL, 4290772992UL, 0UL, 125829120UL, 2139095040UL, +2273312768UL, 4286578688UL, 0UL, 251658240UL, 4278190080UL, 251658240UL, 4278190080UL, 0UL, 503316480UL, 4261412864UL, 503316480UL, 4261412864UL, 0UL, 1006632960UL, 4227858432UL, 1006632960UL, 4227858432UL, 0UL, 2013265920UL, 4160749568UL, 2013265920UL, 4160749568UL, 0UL, 4026531840UL, 4026531840UL, 4026531840UL, 4026531840UL, 0UL, 3758096384UL, 3758096384UL, 3758096384UL, 3758096384UL, +0UL, 0UL, 3UL, 51UL, 771UL, 0UL, 0UL, 6UL, 102UL, 1542UL, 0UL, 0UL, 15UL, 255UL, 3855UL, 0UL, 0UL, 30UL, 510UL, 7710UL, 0UL, 0UL, 60UL, 1020UL, 15420UL, 0UL, 0UL, 120UL, 2040UL, 30840UL, 0UL, 0UL, +240UL, 4080UL, 61680UL, 0UL, 0UL, 480UL, 8160UL, 123360UL, 0UL, 0UL, 960UL, 16320UL, 246720UL, 0UL, 0UL, 1920UL, 32640UL, 493440UL, 0UL, 0UL, 3840UL, 65280UL, 986880UL, 0UL, 0UL, 7680UL, 130560UL, 1973760UL, 0UL, 0UL, 15360UL, 261120UL, +3947520UL, 0UL, 0UL, 30720UL, 522240UL, 7895040UL, 0UL, 0UL, 61440UL, 1044480UL, 15790080UL, 0UL, 0UL, 122880UL, 2088960UL, 31580160UL, 0UL, 0UL, 245760UL, 4177920UL, 63160320UL, 0UL, 0UL, 491520UL, 8355840UL, 126320640UL, 0UL, 0UL, 983040UL, 16711680UL, 252641280UL, 0UL, +0UL, 1966080UL, 33423360UL, 505282560UL, 0UL, 0UL, 3932160UL, 66846720UL, 1010565120UL, 0UL, 0UL, 7864320UL, 133693440UL, 2021130240UL, 0UL, 0UL, 15728640UL, 267386880UL, 4042260480UL, 0UL, 0UL, 31457280UL, 534773760UL, 3789553664UL, 0UL, 0UL, 62914560UL, 1069547520UL, 3284140032UL, 0UL, 0UL, 125829120UL, +2139095040UL, 2273312768UL, 0UL, 0UL, 251658240UL, 4278190080UL, 251658240UL, 0UL, 0UL, 503316480UL, 4261412864UL, 503316480UL, 0UL, 0UL, 1006632960UL, 4227858432UL, 1006632960UL, 0UL, 0UL, 2013265920UL, 4160749568UL, 2013265920UL, 0UL, 0UL, 4026531840UL, 4026531840UL, 4026531840UL, 0UL, 0UL, 3758096384UL, 3758096384UL, 3758096384UL, +0UL, 0UL, 0UL, 3UL, 51UL, 0UL, 0UL, 0UL, 6UL, 102UL, 0UL, 0UL, 0UL, 15UL, 255UL, 0UL, 0UL, 0UL, 30UL, 510UL, 0UL, 0UL, 0UL, 60UL, 1020UL, 0UL, 0UL, 0UL, 120UL, 2040UL, 0UL, 0UL, +0UL, 240UL, 4080UL, 0UL, 0UL, 0UL, 480UL, 8160UL, 0UL, 0UL, 0UL, 960UL, 16320UL, 0UL, 0UL, 0UL, 1920UL, 32640UL, 0UL, 0UL, 0UL, 3840UL, 65280UL, 0UL, 0UL, 0UL, 7680UL, 130560UL, 0UL, 0UL, 0UL, 15360UL, +261120UL, 0UL, 0UL, 0UL, 30720UL, 522240UL, 0UL, 0UL, 0UL, 61440UL, 1044480UL, 0UL, 0UL, 0UL, 122880UL, 2088960UL, 0UL, 0UL, 0UL, 245760UL, 4177920UL, 0UL, 0UL, 0UL, 491520UL, 8355840UL, 0UL, 0UL, 0UL, 983040UL, 16711680UL, 0UL, +0UL, 0UL, 1966080UL, 33423360UL, 0UL, 0UL, 0UL, 3932160UL, 66846720UL, 0UL, 0UL, 0UL, 7864320UL, 133693440UL, 0UL, 0UL, 0UL, 15728640UL, 267386880UL, 0UL, 0UL, 0UL, 31457280UL, 534773760UL, 0UL, 0UL, 0UL, 62914560UL, 1069547520UL, 0UL, 0UL, 0UL, +125829120UL, 2139095040UL, 0UL, 0UL, 0UL, 251658240UL, 4278190080UL, 0UL, 0UL, 0UL, 503316480UL, 4261412864UL, 0UL, 0UL, 0UL, 1006632960UL, 4227858432UL, 0UL, 0UL, 0UL, 2013265920UL, 4160749568UL, 0UL, 0UL, 0UL, 4026531840UL, 4026531840UL, 0UL, 0UL, 0UL, 3758096384UL, 3758096384UL, +0UL, 0UL, 0UL, 0UL, 3UL, 0UL, 0UL, 0UL, 0UL, 6UL, 0UL, 0UL, 0UL, 0UL, 15UL, 0UL, 0UL, 0UL, 0UL, 30UL, 0UL, 0UL, 0UL, 0UL, 60UL, 0UL, 0UL, 0UL, 0UL, 120UL, 0UL, 0UL, +0UL, 0UL, 240UL, 0UL, 0UL, 0UL, 0UL, 480UL, 0UL, 0UL, 0UL, 0UL, 960UL, 0UL, 0UL, 0UL, 0UL, 1920UL, 0UL, 0UL, 0UL, 0UL, 3840UL, 0UL, 0UL, 0UL, 0UL, 7680UL, 0UL, 0UL, 0UL, 0UL, +15360UL, 0UL, 0UL, 0UL, 0UL, 30720UL, 0UL, 0UL, 0UL, 0UL, 61440UL, 0UL, 0UL, 0UL, 0UL, 122880UL, 0UL, 0UL, 0UL, 0UL, 245760UL, 0UL, 0UL, 0UL, 0UL, 491520UL, 0UL, 0UL, 0UL, 0UL, 983040UL, 0UL, +0UL, 0UL, 0UL, 1966080UL, 0UL, 0UL, 0UL, 0UL, 3932160UL, 0UL, 0UL, 0UL, 0UL, 7864320UL, 0UL, 0UL, 0UL, 0UL, 15728640UL, 0UL, 0UL, 0UL, 0UL, 31457280UL, 0UL, 0UL, 0UL, 0UL, 62914560UL, 0UL, 0UL, 0UL, +0UL, 125829120UL, 0UL, 0UL, 0UL, 0UL, 251658240UL, 0UL, 0UL, 0UL, 0UL, 503316480UL, 0UL, 0UL, 0UL, 0UL, 1006632960UL, 0UL, 0UL, 0UL, 0UL, 2013265920UL, 0UL, 0UL, 0UL, 0UL, 4026531840UL, 0UL, 0UL, 0UL, 0UL, 3758096384UL, +1UL, 17UL, 257UL, 4369UL, 65537UL, 2UL, 34UL, 514UL, 8738UL, 131074UL, 4UL, 68UL, 1028UL, 17476UL, 262148UL, 8UL, 136UL, 2056UL, 34952UL, 524296UL, 16UL, 272UL, 4112UL, 69904UL, 1048592UL, 32UL, 544UL, 8224UL, 139808UL, 2097184UL, 64UL, 1088UL, +16448UL, 279616UL, 4194368UL, 128UL, 2176UL, 32896UL, 559232UL, 8388736UL, 256UL, 4352UL, 65792UL, 1118464UL, 16777472UL, 512UL, 8704UL, 131584UL, 2236928UL, 33554944UL, 1024UL, 17408UL, 263168UL, 4473856UL, 67109888UL, 2048UL, 34816UL, 526336UL, 8947712UL, 134219776UL, 4096UL, 69632UL, 1052672UL, 17895424UL, +268439552UL, 8192UL, 139264UL, 2105344UL, 35790848UL, 536879104UL, 16384UL, 278528UL, 4210688UL, 71581696UL, 1073758208UL, 32768UL, 557056UL, 8421376UL, 143163392UL, 2147516416UL, 65536UL, 1114112UL, 16842752UL, 286326784UL, 65536UL, 131072UL, 2228224UL, 33685504UL, 572653568UL, 131072UL, 262144UL, 4456448UL, 67371008UL, 1145307136UL, 262144UL, 524288UL, +8912896UL, 134742016UL, 2290614272UL, 524288UL, 1048576UL, 17825792UL, 269484032UL, 286261248UL, 1048576UL, 2097152UL, 35651584UL, 538968064UL, 572522496UL, 2097152UL, 4194304UL, 71303168UL, 1077936128UL, 1145044992UL, 4194304UL, 8388608UL, 142606336UL, 2155872256UL, 2290089984UL, 8388608UL, 16777216UL, 285212672UL, 16777216UL, 285212672UL, 16777216UL, 33554432UL, 570425344UL, 33554432UL, +570425344UL, 33554432UL, 67108864UL, 1140850688UL, 67108864UL, 1140850688UL, 67108864UL, 134217728UL, 2281701376UL, 134217728UL, 2281701376UL, 134217728UL, 268435456UL, 268435456UL, 268435456UL, 268435456UL, 268435456UL, 536870912UL, 536870912UL, 536870912UL, 536870912UL, 536870912UL, 1073741824UL, 1073741824UL, 1073741824UL, 1073741824UL, 1073741824UL, 2147483648UL, 2147483648UL, 2147483648UL, 2147483648UL, 2147483648UL, +}, +{ +85009117UL, 335741939UL, 1412632518UL, 386859243UL, 1741437244UL, 152139416UL, 403047142UL, 2556825231UL, 505087203UL, 4287193174UL, 335609039UL, 336528191UL, 1425998811UL, 456920088UL, 2832198590UL, 724748988UL, 3625845630UL, 1509824181UL, 3330088197UL, 2710488401UL, 1431742057UL, 1077674236UL, 1140592489UL, 2096905276UL, 3007294393UL, 2863484114UL, 1081606648UL, 1207443154UL, 972585080UL, 2793363314UL, 1432000919UL, 1089470704UL, +1341132452UL, 3019109363UL, 2362285522UL, 1790260014UL, 2178941408UL, 2682264904UL, 1743251430UL, 429603751UL, 359294556UL, 62915520UL, 1069562512UL, 3486502860UL, 859207501UL, 3939814584UL, 125831040UL, 2139125024UL, 2678038424UL, 1718415002UL, 363436400UL, 251662080UL, 4278250048UL, 1061109552UL, 3436830004UL, 3948098272UL, 503324160UL, 4261532800UL, 2122219104UL, 2310257256UL, 380003776UL, 1006648320UL, 4228098304UL, 4244438208UL, +3278337232UL, 3981233024UL, 2013296640UL, 4161229312UL, 4193909120UL, 2530142624UL, 446273280UL, 4026593280UL, 4027491328UL, 871625472UL, 4254978880UL, 4113772032UL, 3758219264UL, 3760015360UL, 2011686400UL, 3946555008UL, 711351296UL, 3221471232UL, 3225063424UL, 4291808256UL, 108481792UL, 2496444416UL, 2147975168UL, 2155159552UL, 4020213760UL, 485399040UL, 3919147008UL, 983040UL, 15351808UL, 255799296UL, 3923588096UL, 322101248UL, +1966080UL, 299139072UL, 511598592UL, 3283773440UL, 3865427968UL, 3932160UL, 4087939072UL, 1023197184UL, 1467273216UL, 214663168UL, 7864320UL, 4149346304UL, 2046394368UL, 3202981888UL, 3650551808UL, 3236954112UL, 1050935296UL, 871563264UL, 2916302848UL, 1932394496UL, 2447376384UL, 1833435136UL, 2011561984UL, 2342944768UL, 643563520UL, 868220928UL, 177209344UL, 4291559424UL, 122486784UL, 2360868864UL, 2004877312UL, 85983232UL, +4019716096UL, 3734634496UL, 3647995904UL, 1056964608UL, 3661627392UL, 254803968UL, 2905866240UL, 1658847232UL, 2113929216UL, 3028287488UL, 3730833408UL, 2322071552UL, 3586129920UL, 4227858432UL, 1761607680UL, 2092957696UL, 80740352UL, 2071986176UL, 4160749568UL, 3523215360UL, 964689920UL, 429916160UL, 3875536896UL, 4026531840UL, 2751463424UL, 1929379840UL, 4081057792UL, 503316480UL, 3758096384UL, 2281701376UL, 4127195136UL, 3397386240UL, +1316635UL, 85009117UL, 335741939UL, 1412632518UL, 386859243UL, 1580547UL, 152139416UL, 403047142UL, 2556825231UL, 505087203UL, 1317672UL, 335609039UL, 336528191UL, 1425998811UL, 456920088UL, 1574501UL, 724748988UL, 3625845630UL, 1509824181UL, 3330088197UL, 15612UL, 1431742057UL, 1077674236UL, 1140592489UL, 2096905276UL, 31224UL, 2863484114UL, 1081606648UL, 1207443154UL, 972585080UL, 62451UL, 1432000919UL, +1089470704UL, 1341132452UL, 3019109363UL, 124902UL, 1790260014UL, 2178941408UL, 2682264904UL, 1743251430UL, 249804UL, 359294556UL, 62915520UL, 1069562512UL, 3486502860UL, 499608UL, 3939814584UL, 125831040UL, 2139125024UL, 2678038424UL, 999216UL, 363436400UL, 251662080UL, 4278250048UL, 1061109552UL, 3223223904UL, 3948098272UL, 503324160UL, 4261532800UL, 2122219104UL, 1077738688UL, 380003776UL, 1006648320UL, 4228098304UL, +4244438208UL, 1081735552UL, 3981233024UL, 2013296640UL, 4161229312UL, 4193909120UL, 1089729280UL, 446273280UL, 4026593280UL, 4027491328UL, 871625472UL, 2179458560UL, 4113772032UL, 3758219264UL, 3760015360UL, 2011686400UL, 63949824UL, 711351296UL, 3221471232UL, 3225063424UL, 4291808256UL, 127899648UL, 2496444416UL, 2147975168UL, 2155159552UL, 4020213760UL, 255799296UL, 3919147008UL, 983040UL, 15351808UL, 255799296UL, 3732824064UL, +322101248UL, 1966080UL, 299139072UL, 511598592UL, 2096939008UL, 3865427968UL, 3932160UL, 4087939072UL, 1023197184UL, 972652544UL, 214663168UL, 7864320UL, 4149346304UL, 2046394368UL, 3019046912UL, 3650551808UL, 3236954112UL, 1050935296UL, 871563264UL, 1743126528UL, 1932394496UL, 2447376384UL, 1833435136UL, 2011561984UL, 3486253056UL, 643563520UL, 868220928UL, 177209344UL, 4291559424UL, 2677538816UL, 2360868864UL, 2004877312UL, +85983232UL, 4019716096UL, 1060110336UL, 3647995904UL, 1056964608UL, 3661627392UL, 254803968UL, 3193962496UL, 1658847232UL, 2113929216UL, 3028287488UL, 3730833408UL, 3166699520UL, 3586129920UL, 4227858432UL, 1761607680UL, 2092957696UL, 3112173568UL, 2071986176UL, 4160749568UL, 3523215360UL, 964689920UL, 1929379840UL, 3875536896UL, 4026531840UL, 2751463424UL, 1929379840UL, 4127195136UL, 503316480UL, 3758096384UL, 2281701376UL, 4127195136UL, +332854UL, 1316635UL, 85009117UL, 335741939UL, 1412632518UL, 596079UL, 1580547UL, 152139416UL, 403047142UL, 2556825231UL, 1316075UL, 1317672UL, 335609039UL, 336528191UL, 1425998811UL, 2824661UL, 1574501UL, 724748988UL, 3625845630UL, 1509824181UL, 5571497UL, 15612UL, 1431742057UL, 1077674236UL, 1140592489UL, 11142994UL, 31224UL, 2863484114UL, 1081606648UL, 1207443154UL, 22285988UL, 62451UL, +1432000919UL, 1089470704UL, 1341132452UL, 44571976UL, 124902UL, 1790260014UL, 2178941408UL, 2682264904UL, 89143952UL, 249804UL, 359294556UL, 62915520UL, 1069562512UL, 178287904UL, 499608UL, 3939814584UL, 125831040UL, 2139125024UL, 356575808UL, 999216UL, 363436400UL, 251662080UL, 4278250048UL, 713151616UL, 3223223904UL, 3948098272UL, 503324160UL, 4261532800UL, 1426303232UL, 1077738688UL, 380003776UL, 1006648320UL, +4228098304UL, 2852606464UL, 1081735552UL, 3981233024UL, 2013296640UL, 4161229312UL, 1410245632UL, 1089729280UL, 446273280UL, 4026593280UL, 4027491328UL, 1746749440UL, 2179458560UL, 4113772032UL, 3758219264UL, 3760015360UL, 272273408UL, 63949824UL, 711351296UL, 3221471232UL, 3225063424UL, 3765772288UL, 127899648UL, 2496444416UL, 2147975168UL, 2155159552UL, 15351808UL, 255799296UL, 3919147008UL, 983040UL, 15351808UL, 3251929088UL, +3732824064UL, 322101248UL, 1966080UL, 299139072UL, 1135149056UL, 2096939008UL, 3865427968UL, 3932160UL, 4087939072UL, 1196556288UL, 972652544UL, 214663168UL, 7864320UL, 4149346304UL, 1319370752UL, 3019046912UL, 3650551808UL, 3236954112UL, 1050935296UL, 2638741504UL, 1743126528UL, 1932394496UL, 2447376384UL, 1833435136UL, 982515712UL, 3486253056UL, 643563520UL, 868220928UL, 177209344UL, 1965031424UL, 2677538816UL, 2360868864UL, +2004877312UL, 85983232UL, 3930062848UL, 1060110336UL, 3647995904UL, 1056964608UL, 3661627392UL, 3565158400UL, 3193962496UL, 1658847232UL, 2113929216UL, 3028287488UL, 2835349504UL, 3166699520UL, 3586129920UL, 4227858432UL, 1761607680UL, 1375731712UL, 3112173568UL, 2071986176UL, 4160749568UL, 3523215360UL, 2751463424UL, 1929379840UL, 3875536896UL, 4026531840UL, 2751463424UL, 2281701376UL, 4127195136UL, 503316480UL, 3758096384UL, 2281701376UL, +5123UL, 332854UL, 1316635UL, 85009117UL, 335741939UL, 6150UL, 596079UL, 1580547UL, 152139416UL, 403047142UL, 5135UL, 1316075UL, 1317672UL, 335609039UL, 336528191UL, 6174UL, 2824661UL, 1574501UL, 724748988UL, 3625845630UL, 60UL, 5571497UL, 15612UL, 1431742057UL, 1077674236UL, 120UL, 11142994UL, 31224UL, 2863484114UL, 1081606648UL, 240UL, 22285988UL, +62451UL, 1432000919UL, 1089470704UL, 480UL, 44571976UL, 124902UL, 1790260014UL, 2178941408UL, 960UL, 89143952UL, 249804UL, 359294556UL, 62915520UL, 1920UL, 178287904UL, 499608UL, 3939814584UL, 125831040UL, 3840UL, 356575808UL, 999216UL, 363436400UL, 251662080UL, 7680UL, 713151616UL, 3223223904UL, 3948098272UL, 503324160UL, 15360UL, 1426303232UL, 1077738688UL, 380003776UL, +1006648320UL, 30720UL, 2852606464UL, 1081735552UL, 3981233024UL, 2013296640UL, 61440UL, 1410245632UL, 1089729280UL, 446273280UL, 4026593280UL, 122880UL, 1746749440UL, 2179458560UL, 4113772032UL, 3758219264UL, 245760UL, 272273408UL, 63949824UL, 711351296UL, 3221471232UL, 491520UL, 3765772288UL, 127899648UL, 2496444416UL, 2147975168UL, 983040UL, 15351808UL, 255799296UL, 3919147008UL, 983040UL, 3223191552UL, +3251929088UL, 3732824064UL, 322101248UL, 1966080UL, 1077673984UL, 1135149056UL, 2096939008UL, 3865427968UL, 3932160UL, 1081606144UL, 1196556288UL, 972652544UL, 214663168UL, 7864320UL, 1089470464UL, 1319370752UL, 3019046912UL, 3650551808UL, 3236954112UL, 2178940928UL, 2638741504UL, 1743126528UL, 1932394496UL, 2447376384UL, 62914560UL, 982515712UL, 3486253056UL, 643563520UL, 868220928UL, 125829120UL, 1965031424UL, 2677538816UL, +2360868864UL, 2004877312UL, 251658240UL, 3930062848UL, 1060110336UL, 3647995904UL, 1056964608UL, 503316480UL, 3565158400UL, 3193962496UL, 1658847232UL, 2113929216UL, 1006632960UL, 2835349504UL, 3166699520UL, 3586129920UL, 4227858432UL, 2013265920UL, 1375731712UL, 3112173568UL, 2071986176UL, 4160749568UL, 4026531840UL, 2751463424UL, 1929379840UL, 3875536896UL, 4026531840UL, 3758096384UL, 2281701376UL, 4127195136UL, 503316480UL, 3758096384UL, +201392209UL, 3423671362UL, 218366296UL, 3713336838UL, 206572594UL, 402785186UL, 2552372100UL, 436928947UL, 3130605370UL, 463476848UL, 262468UL, 4461835UL, 68158800UL, 1158700908UL, 20971524UL, 524680UL, 8919318UL, 136513955UL, 2316537326UL, 25165852UL, 3222274064UL, 3239051564UL, 3494187077UL, 3558090985UL, 3221225500UL, 2149580832UL, 2183135832UL, 2693406858UL, 2821214674UL, 2147483704UL, 4194368UL, 71304368UL, +1091846420UL, 1347462055UL, 64UL, 8388736UL, 142608736UL, 2183692840UL, 2694924110UL, 3221225600UL, 16777472UL, 285217472UL, 72418384UL, 1094880924UL, 1342177536UL, 33554944UL, 570434944UL, 144836768UL, 2189761848UL, 2684355072UL, 67109888UL, 1140869888UL, 289673536UL, 84556400UL, 1073742848UL, 134219776UL, 2281739776UL, 579347072UL, 169112800UL, 2147485696UL, 268439552UL, 268512256UL, 1158694144UL, 69790144UL, +4096UL, 536879104UL, 537024512UL, 2317388288UL, 3360805760UL, 8192UL, 1073758208UL, 1074049024UL, 339809280UL, 1352902400UL, 16384UL, 2147516416UL, 2148098048UL, 3900844032UL, 1632062976UL, 32768UL, 65536UL, 1228800UL, 17059840UL, 311335936UL, 65536UL, 131072UL, 2457600UL, 34119680UL, 622671872UL, 131072UL, 262144UL, 4915200UL, 68239360UL, 1245343744UL, 262144UL, 524288UL, +9830400UL, 136478720UL, 2490687488UL, 524288UL, 1048576UL, 288096256UL, 272957440UL, 954843136UL, 3222274048UL, 2097152UL, 3797417984UL, 545914880UL, 2983428096UL, 2149580800UL, 4194304UL, 78643200UL, 1091829760UL, 2745630720UL, 4194304UL, 3229614080UL, 3378511872UL, 1109917696UL, 2270035968UL, 8388608UL, 1358954496UL, 1119879168UL, 1414529024UL, 513540096UL, 16777216UL, 2717908992UL, 2239758336UL, 2829058048UL, +1027080192UL, 33554432UL, 1140850688UL, 184549376UL, 1363148800UL, 2054160384UL, 3288334336UL, 2281701376UL, 369098752UL, 2726297600UL, 4108320768UL, 2281701376UL, 268435456UL, 738197504UL, 2231369728UL, 968884224UL, 3959422976UL, 536870912UL, 1476395008UL, 167772160UL, 3011510272UL, 3355443200UL, 1073741824UL, 2952790016UL, 335544320UL, 1728053248UL, 2147483648UL, 2147483648UL, 1610612736UL, 3892314112UL, 503316480UL, 0UL, +}, +{ +1939838472UL, 1412147404UL, 166205219UL, 1757484276UL, 2905930693UL, 2345662040UL, 2845657161UL, 253454719UL, 2661974169UL, 303781080UL, 4075331504UL, 31014156UL, 244538930UL, 3752264221UL, 992575155UL, 219309525UL, 246620060UL, 215640989UL, 4125020723UL, 2016731730UL, 3236558869UL, 297169276UL, 3293566751UL, 1867504216UL, 210423272UL, 2531663658UL, 499723753UL, 1730625896UL, 189236880UL, 3388575408UL, 2433358422UL, 1368961148UL, +3134096848UL, 2827836415UL, 3888822753UL, 4172043647UL, 3379360748UL, 2651760955UL, 1345081091UL, 627692776UL, 189423917UL, 1927379456UL, 4004336944UL, 2995932065UL, 1882016234UL, 2551113616UL, 1576396048UL, 1299792730UL, 2151240795UL, 2154814108UL, 4292139924UL, 3555849728UL, 943986992UL, 3169912733UL, 2631635779UL, 3478094562UL, 1285558544UL, 3716074330UL, 2780749859UL, 3911106510UL, 4175656994UL, 1731832828UL, 1275401375UL, 937322456UL, +3802094750UL, 1145506936UL, 1008905193UL, 1718801768UL, 645739137UL, 1356219146UL, 827886816UL, 1722154800UL, 2242776733UL, 754630810UL, 772070504UL, 249481170UL, 2608123425UL, 2087201889UL, 3200968096UL, 3292110026UL, 841433255UL, 477543427UL, 1878882709UL, 705347364UL, 4003860146UL, 3194913138UL, 2616490007UL, 357561212UL, 2446098297UL, 2955680594UL, 2512991743UL, 637464579UL, 1209132455UL, 1341312804UL, 612108672UL, 2455017713UL, +1749147666UL, 4020226825UL, 2873924220UL, 499405095UL, 1837614076UL, 1227604028UL, 714577577UL, 165950208UL, 442290261UL, 489077752UL, 216760440UL, 42151250UL, 426862080UL, 2810242474UL, 4112075489UL, 3514761468UL, 4101921371UL, 982512636UL, 500792667UL, 4286077681UL, 198050301UL, 1858712743UL, 2913642493UL, 3547545255UL, 3981929169UL, 2944140287UL, 2286578015UL, 3422343167UL, 1239123295UL, 2026367394UL, 3269986302UL, 3028402878UL, +2709637886UL, 1096011710UL, 294584132UL, 3086749695UL, 3324400975UL, 1164394495UL, 4290155855UL, 543687304UL, 4008517630UL, 836370334UL, 1876426750UL, 2362048414UL, 3578325264UL, 3221487612UL, 2671154748UL, 3395518460UL, 2018383420UL, 2131029536UL, 2165829624UL, 697661816UL, 1336049656UL, 3309365624UL, 4259639360UL, 3423548400UL, 2416417776UL, 1633698800UL, 1630071792UL, 41950336UL, 3423478496UL, 2885608160UL, 3943744224UL, 677380832UL, +4179285363UL, 1939838472UL, 1412147404UL, 166205219UL, 1757484276UL, 3838244595UL, 2345662040UL, 2845657161UL, 253454719UL, 2661974169UL, 138737288UL, 4075331504UL, 31014156UL, 244538930UL, 3752264221UL, 1503392345UL, 219309525UL, 246620060UL, 215640989UL, 4125020723UL, 1759481152UL, 3236558869UL, 297169276UL, 3293566751UL, 1867504216UL, 3898070400UL, 2531663658UL, 499723753UL, 1730625896UL, 189236880UL, 2610231010UL, 2433358422UL, +1368961148UL, 3134096848UL, 2827836415UL, 3903474593UL, 4172043647UL, 3379360748UL, 2651760955UL, 1345081091UL, 1267864331UL, 189423917UL, 1927379456UL, 4004336944UL, 2995932065UL, 3452816347UL, 2551113616UL, 1576396048UL, 1299792730UL, 2151240795UL, 1222520631UL, 4292139924UL, 3555849728UL, 943986992UL, 3169912733UL, 3260130211UL, 3478094562UL, 1285558544UL, 3716074330UL, 2780749859UL, 3039362306UL, 4175656994UL, 1731832828UL, 1275401375UL, +937322456UL, 3236754932UL, 1145506936UL, 1008905193UL, 1718801768UL, 645739137UL, 1358079399UL, 827886816UL, 1722154800UL, 2242776733UL, 754630810UL, 1748663943UL, 249481170UL, 2608123425UL, 2087201889UL, 3200968096UL, 698076610UL, 841433255UL, 477543427UL, 1878882709UL, 705347364UL, 3692794996UL, 3194913138UL, 2616490007UL, 357561212UL, 2446098297UL, 2771068186UL, 2512991743UL, 637464579UL, 1209132455UL, 1341312804UL, 27937268UL, +2455017713UL, 1749147666UL, 4020226825UL, 2873924220UL, 1673040956UL, 1837614076UL, 1227604028UL, 714577577UL, 165950208UL, 528340088UL, 489077752UL, 216760440UL, 42151250UL, 426862080UL, 1646215396UL, 4112075489UL, 3514761468UL, 4101921371UL, 982512636UL, 2095821304UL, 4286077681UL, 198050301UL, 1858712743UL, 2913642493UL, 277300160UL, 3981929169UL, 2944140287UL, 2286578015UL, 3422343167UL, 1178044288UL, 2026367394UL, 3269986302UL, +3028402878UL, 2709637886UL, 2234191616UL, 294584132UL, 3086749695UL, 3324400975UL, 1164394495UL, 136978944UL, 543687304UL, 4008517630UL, 836370334UL, 1876426750UL, 3275253760UL, 3578325264UL, 3221487612UL, 2671154748UL, 3395518460UL, 3942394880UL, 2131029536UL, 2165829624UL, 697661816UL, 1336049656UL, 3265045504UL, 4259639360UL, 3423548400UL, 2416417776UL, 1633698800UL, 3943712768UL, 41950336UL, 3423478496UL, 2885608160UL, 3943744224UL, +2293593009UL, 4179285363UL, 1939838472UL, 1412147404UL, 166205219UL, 715714152UL, 3838244595UL, 2345662040UL, 2845657161UL, 253454719UL, 3758048260UL, 138737288UL, 4075331504UL, 31014156UL, 244538930UL, 370671650UL, 1503392345UL, 219309525UL, 246620060UL, 215640989UL, 2219162331UL, 1759481152UL, 3236558869UL, 297169276UL, 3293566751UL, 135243402UL, 3898070400UL, 2531663658UL, 499723753UL, 1730625896UL, 3142293713UL, 2610231010UL, +2433358422UL, 1368961148UL, 3134096848UL, 486949791UL, 3903474593UL, 4172043647UL, 3379360748UL, 2651760955UL, 3172880550UL, 1267864331UL, 189423917UL, 1927379456UL, 4004336944UL, 191463910UL, 3452816347UL, 2551113616UL, 1576396048UL, 1299792730UL, 4411574UL, 1222520631UL, 4292139924UL, 3555849728UL, 943986992UL, 3073348038UL, 3260130211UL, 3478094562UL, 1285558544UL, 3716074330UL, 3098363790UL, 3039362306UL, 4175656994UL, 1731832828UL, +1275401375UL, 468159532UL, 3236754932UL, 1145506936UL, 1008905193UL, 1718801768UL, 1092964081UL, 1358079399UL, 827886816UL, 1722154800UL, 2242776733UL, 53128947UL, 1748663943UL, 249481170UL, 2608123425UL, 2087201889UL, 1960144614UL, 698076610UL, 841433255UL, 477543427UL, 1878882709UL, 1505419004UL, 3692794996UL, 3194913138UL, 2616490007UL, 357561212UL, 2823143358UL, 2771068186UL, 2512991743UL, 637464579UL, 1209132455UL, 1991737212UL, +27937268UL, 2455017713UL, 1749147666UL, 4020226825UL, 2907896812UL, 1673040956UL, 1837614076UL, 1227604028UL, 714577577UL, 3633969112UL, 528340088UL, 489077752UL, 216760440UL, 42151250UL, 2886728356UL, 1646215396UL, 4112075489UL, 3514761468UL, 4101921371UL, 3507686008UL, 2095821304UL, 4286077681UL, 198050301UL, 1858712743UL, 1463806912UL, 277300160UL, 3981929169UL, 2944140287UL, 2286578015UL, 4137888640UL, 1178044288UL, 2026367394UL, +3269986302UL, 3028402878UL, 1276820224UL, 2234191616UL, 294584132UL, 3086749695UL, 3324400975UL, 4274031104UL, 136978944UL, 543687304UL, 4008517630UL, 836370334UL, 2978609152UL, 3275253760UL, 3578325264UL, 3221487612UL, 2671154748UL, 2296777728UL, 3942394880UL, 2131029536UL, 2165829624UL, 697661816UL, 1086645248UL, 3265045504UL, 4259639360UL, 3423548400UL, 2416417776UL, 2295121920UL, 3943712768UL, 41950336UL, 3423478496UL, 2885608160UL, +3290486993UL, 2293593009UL, 4179285363UL, 1939838472UL, 1412147404UL, 3718742914UL, 715714152UL, 3838244595UL, 2345662040UL, 2845657161UL, 3251034248UL, 3758048260UL, 138737288UL, 4075331504UL, 31014156UL, 2257801369UL, 370671650UL, 1503392345UL, 219309525UL, 246620060UL, 1375177854UL, 2219162331UL, 1759481152UL, 3236558869UL, 297169276UL, 2981812236UL, 135243402UL, 3898070400UL, 2531663658UL, 499723753UL, 1103465850UL, 3142293713UL, +2610231010UL, 2433358422UL, 1368961148UL, 2570001060UL, 486949791UL, 3903474593UL, 4172043647UL, 3379360748UL, 1922171925UL, 3172880550UL, 1267864331UL, 189423917UL, 1927379456UL, 1359812359UL, 191463910UL, 3452816347UL, 2551113616UL, 1576396048UL, 2518549525UL, 4411574UL, 1222520631UL, 4292139924UL, 3555849728UL, 949028615UL, 3073348038UL, 3260130211UL, 3478094562UL, 1285558544UL, 4113039486UL, 3098363790UL, 3039362306UL, 4175656994UL, +1731832828UL, 1827471372UL, 468159532UL, 3236754932UL, 1145506936UL, 1008905193UL, 1626341859UL, 1092964081UL, 1358079399UL, 827886816UL, 1722154800UL, 1069547583UL, 53128947UL, 1748663943UL, 249481170UL, 2608123425UL, 3162506114UL, 1960144614UL, 698076610UL, 841433255UL, 477543427UL, 3641706484UL, 1505419004UL, 3692794996UL, 3194913138UL, 2616490007UL, 3623882586UL, 2823143358UL, 2771068186UL, 2512991743UL, 637464579UL, 16785012UL, +1991737212UL, 27937268UL, 2455017713UL, 1749147666UL, 2348825660UL, 2907896812UL, 1673040956UL, 1837614076UL, 1227604028UL, 2579527800UL, 3633969112UL, 528340088UL, 489077752UL, 216760440UL, 3628134628UL, 2886728356UL, 1646215396UL, 4112075489UL, 3514761468UL, 1602085368UL, 3507686008UL, 2095821304UL, 4286077681UL, 198050301UL, 2501362624UL, 1463806912UL, 277300160UL, 3981929169UL, 2944140287UL, 4112467840UL, 4137888640UL, 1178044288UL, +2026367394UL, 3269986302UL, 3356184320UL, 1276820224UL, 2234191616UL, 294584132UL, 3086749695UL, 366387712UL, 4274031104UL, 136978944UL, 543687304UL, 4008517630UL, 1006135296UL, 2978609152UL, 3275253760UL, 3578325264UL, 3221487612UL, 3104844800UL, 2296777728UL, 3942394880UL, 2131029536UL, 2165829624UL, 1874371584UL, 1086645248UL, 3265045504UL, 4259639360UL, 3423548400UL, 2975352832UL, 2295121920UL, 3943712768UL, 41950336UL, 3423478496UL, +989898496UL, 3410688577UL, 2331788830UL, 3546482013UL, 813828841UL, 1865093068UL, 3265457506UL, 3795669738UL, 2119696024UL, 4285651426UL, 3333834629UL, 3451487261UL, 2090324595UL, 1816963648UL, 932961512UL, 2470761029UL, 3401764108UL, 3421619354UL, 4199624502UL, 589386372UL, 879396240UL, 3372470254UL, 2693109296UL, 2424215996UL, 38442268UL, 1882087724UL, 171397600UL, 2024561281UL, 183095586UL, 3282207272UL, 3402177296UL, 1859195498UL, +413109947UL, 2839537944UL, 1632143648UL, 3742715856UL, 388696500UL, 1748703733UL, 3563198567UL, 3826785440UL, 2896086528UL, 3989037829UL, 1478787788UL, 1390277813UL, 2123320736UL, 3416516800UL, 2056564203UL, 2584895011UL, 1605192736UL, 2475623616UL, 3856499712UL, 3439657984UL, 708088129UL, 1501395566UL, 1302184960UL, 1360092352UL, 1645630430UL, 1425230387UL, 3369488824UL, 2979863936UL, 869212432UL, 150548847UL, 1097557362UL, 655939640UL, +316553344UL, 3761918508UL, 3958338094UL, 141744600UL, 1412214640UL, 1859689984UL, 3200680981UL, 3883058679UL, 999801880UL, 3946079738UL, 1876072704UL, 194381849UL, 2177533995UL, 1584707624UL, 3053768410UL, 2593051904UL, 3458076673UL, 4047442835UL, 3545972808UL, 3441793178UL, 194975744UL, 1731731470UL, 4168755162UL, 2628944732UL, 2125675784UL, 3119906816UL, 960774145UL, 2646626078UL, 2152793157UL, 3049156634UL, 672464896UL, 3046932493UL, +3700727536UL, 2152335477UL, 575986696UL, 671940608UL, 2208366608UL, 1454456125UL, 937760016UL, 4103979069UL, 2737668096UL, 1179779104UL, 1030912634UL, 1041902112UL, 2032909434UL, 2274230272UL, 2089025605UL, 3050632421UL, 2428784965UL, 140658149UL, 4254138368UL, 1745354889UL, 711584249UL, 2746523017UL, 2551006457UL, 1100808192UL, 1494221073UL, 3422999489UL, 2696954129UL, 976716737UL, 2653421568UL, 3806331426UL, 3690047362UL, 1481392674UL, +3817015170UL, 2353004544UL, 286262340UL, 2300534532UL, 4206449732UL, 15339268UL, 2894069760UL, 488376456UL, 1489927688UL, 1196583048UL, 652746248UL, 2214592512UL, 69904UL, 1006205200UL, 2322628880UL, 1229515024UL, 2617245696UL, 3423527456UL, 1964953120UL, 4260938272UL, 386199072UL, 1744830464UL, 1342444608UL, 1069330496UL, 2138592320UL, 3185897536UL, 1073741824UL, 1342493824UL, 3780942976UL, 1771066496UL, 2189433984UL, 2147483648UL, +}, +{ +1804684571UL, 2106089606UL, 1533056158UL, 2870216110UL, 3618155659UL, 3789871366UL, 4246691682UL, 3667072763UL, 1212241769UL, 3152390668UL, 2973497449UL, 2958641966UL, 2088805328UL, 717518631UL, 2401090860UL, 3606967204UL, 952637656UL, 59827581UL, 1291486682UL, 1499453515UL, 2053994857UL, 563998083UL, 4094000396UL, 1163546899UL, 1003843565UL, 654565639UL, 1070907026UL, 4217851863UL, 426034251UL, 1721352737UL, 278404469UL, 3899800390UL, +1063362170UL, 1162348262UL, 3153545093UL, 3249996223UL, 186674553UL, 2616406148UL, 3137968354UL, 1282784965UL, 1495068058UL, 3033760361UL, 2278144523UL, 3192245769UL, 719586342UL, 2602548287UL, 3386583150UL, 355354345UL, 3252815848UL, 2178056037UL, 2283016801UL, 3005955037UL, 3340254490UL, 802791670UL, 251122316UL, 3705188626UL, 1252262272UL, 3989036796UL, 3527490452UL, 2047131255UL, 1447170583UL, 3373930285UL, 2895037457UL, 209341805UL, +1820357643UL, 3712392731UL, 685796521UL, 1322920440UL, 814388470UL, 1357857147UL, 434430265UL, 2650681935UL, 1371566728UL, 58783716UL, 2273435933UL, 3498513198UL, 792571900UL, 1447808772UL, 3513385860UL, 99175889UL, 1105434360UL, 1484146625UL, 3327194068UL, 242672513UL, 3552105593UL, 1425844616UL, 2871928454UL, 1124633561UL, 607610433UL, 2130018608UL, 1610235673UL, 2844230432UL, 2748082340UL, 994392866UL, 450823250UL, 2912535126UL, +2574390988UL, 3974009252UL, 78696582UL, 649682891UL, 3980917176UL, 3221419689UL, 960695436UL, 729221508UL, 358358845UL, 3392407691UL, 472711005UL, 295914899UL, 3005191796UL, 3078521977UL, 3370011868UL, 509135340UL, 1965939519UL, 2086465877UL, 2457949822UL, 1324152522UL, 762289386UL, 3618693997UL, 233730715UL, 2873984650UL, 31168606UL, 3367142977UL, 2851851305UL, 3251660053UL, 4209768406UL, 3298190175UL, 901235185UL, 1564391510UL, +2352686527UL, 1008150482UL, 578573310UL, 3462447127UL, 2482873876UL, 1790221257UL, 2255375608UL, 2335345651UL, 1381450613UL, 2866805101UL, 1495073163UL, 519905259UL, 3184556473UL, 1076378339UL, 2692926127UL, 970097715UL, 4013407916UL, 4014350363UL, 2476927059UL, 1989070516UL, 2640060069UL, 1987784589UL, 1880989003UL, 3861138803UL, 451743296UL, 1987067871UL, 1975657871UL, 3397816882UL, 2309900530UL, 4108425851UL, 4063867233UL, 3319482186UL, +2621772886UL, 1804684571UL, 2106089606UL, 1533056158UL, 2870216110UL, 611557097UL, 3789871366UL, 4246691682UL, 3667072763UL, 1212241769UL, 3389551988UL, 2973497449UL, 2958641966UL, 2088805328UL, 717518631UL, 2460955430UL, 3606967204UL, 952637656UL, 59827581UL, 1291486682UL, 3531087304UL, 2053994857UL, 563998083UL, 4094000396UL, 1163546899UL, 1242934125UL, 654565639UL, 1070907026UL, 4217851863UL, 426034251UL, 3034416129UL, 278404469UL, +3899800390UL, 1063362170UL, 1162348262UL, 4258714417UL, 3249996223UL, 186674553UL, 2616406148UL, 3137968354UL, 639885806UL, 1495068058UL, 3033760361UL, 2278144523UL, 3192245769UL, 4159910300UL, 2602548287UL, 3386583150UL, 355354345UL, 3252815848UL, 1555885880UL, 2283016801UL, 3005955037UL, 3340254490UL, 802791670UL, 2948774612UL, 3705188626UL, 1252262272UL, 3989036796UL, 3527490452UL, 2107826711UL, 1447170583UL, 3373930285UL, 2895037457UL, +209341805UL, 3763367196UL, 3712392731UL, 685796521UL, 1322920440UL, 814388470UL, 1986168339UL, 434430265UL, 2650681935UL, 1371566728UL, 58783716UL, 1423189187UL, 3498513198UL, 792571900UL, 1447808772UL, 3513385860UL, 315969823UL, 1105434360UL, 1484146625UL, 3327194068UL, 242672513UL, 3336228275UL, 1425844616UL, 2871928454UL, 1124633561UL, 607610433UL, 1762052458UL, 1610235673UL, 2844230432UL, 2748082340UL, 994392866UL, 3771702243UL, +2912535126UL, 2574390988UL, 3974009252UL, 78696582UL, 1626628844UL, 3980917176UL, 3221419689UL, 960695436UL, 729221508UL, 382092233UL, 3392407691UL, 472711005UL, 295914899UL, 3005191796UL, 514297204UL, 3370011868UL, 509135340UL, 1965939519UL, 2086465877UL, 3975975091UL, 1324152522UL, 762289386UL, 3618693997UL, 233730715UL, 455322516UL, 31168606UL, 3367142977UL, 2851851305UL, 3251660053UL, 3952189603UL, 3298190175UL, 901235185UL, +1564391510UL, 2352686527UL, 826181452UL, 578573310UL, 3462447127UL, 2482873876UL, 1790221257UL, 1529242773UL, 2335345651UL, 1381450613UL, 2866805101UL, 1495073163UL, 877718651UL, 3184556473UL, 1076378339UL, 2692926127UL, 970097715UL, 299344245UL, 4014350363UL, 2476927059UL, 1989070516UL, 2640060069UL, 3844531327UL, 1880989003UL, 3861138803UL, 451743296UL, 1987067871UL, 3272848161UL, 3397816882UL, 2309900530UL, 4108425851UL, 4063867233UL, +834288064UL, 2621772886UL, 1804684571UL, 2106089606UL, 1533056158UL, 304865970UL, 611557097UL, 3789871366UL, 4246691682UL, 3667072763UL, 2728206193UL, 3389551988UL, 2973497449UL, 2958641966UL, 2088805328UL, 3895037582UL, 2460955430UL, 3606967204UL, 952637656UL, 59827581UL, 2349212526UL, 3531087304UL, 2053994857UL, 563998083UL, 4094000396UL, 4028900485UL, 1242934125UL, 654565639UL, 1070907026UL, 4217851863UL, 1663452176UL, 3034416129UL, +278404469UL, 3899800390UL, 1063362170UL, 2721441405UL, 4258714417UL, 3249996223UL, 186674553UL, 2616406148UL, 4228837490UL, 639885806UL, 1495068058UL, 3033760361UL, 2278144523UL, 2820661772UL, 4159910300UL, 2602548287UL, 3386583150UL, 355354345UL, 1815256314UL, 1555885880UL, 2283016801UL, 3005955037UL, 3340254490UL, 2166514144UL, 2948774612UL, 3705188626UL, 1252262272UL, 3989036796UL, 751187322UL, 2107826711UL, 1447170583UL, 3373930285UL, +2895037457UL, 2809311944UL, 3763367196UL, 3712392731UL, 685796521UL, 1322920440UL, 936300677UL, 1986168339UL, 434430265UL, 2650681935UL, 1371566728UL, 1308015359UL, 1423189187UL, 3498513198UL, 792571900UL, 1447808772UL, 3065349526UL, 315969823UL, 1105434360UL, 1484146625UL, 3327194068UL, 1038676789UL, 3336228275UL, 1425844616UL, 2871928454UL, 1124633561UL, 2956422231UL, 1762052458UL, 1610235673UL, 2844230432UL, 2748082340UL, 3603862093UL, +3771702243UL, 2912535126UL, 2574390988UL, 3974009252UL, 1691332448UL, 1626628844UL, 3980917176UL, 3221419689UL, 960695436UL, 3120142427UL, 382092233UL, 3392407691UL, 472711005UL, 295914899UL, 4101686983UL, 514297204UL, 3370011868UL, 509135340UL, 1965939519UL, 3015736706UL, 3975975091UL, 1324152522UL, 762289386UL, 3618693997UL, 2395097989UL, 455322516UL, 31168606UL, 3367142977UL, 2851851305UL, 30511955UL, 3952189603UL, 3298190175UL, +901235185UL, 1564391510UL, 2606298633UL, 826181452UL, 578573310UL, 3462447127UL, 2482873876UL, 4159642946UL, 1529242773UL, 2335345651UL, 1381450613UL, 2866805101UL, 1782913669UL, 877718651UL, 3184556473UL, 1076378339UL, 2692926127UL, 1730328819UL, 299344245UL, 4014350363UL, 2476927059UL, 1989070516UL, 1425685614UL, 3844531327UL, 1880989003UL, 3861138803UL, 451743296UL, 889237383UL, 3272848161UL, 3397816882UL, 2309900530UL, 4108425851UL, +1155723231UL, 834288064UL, 2621772886UL, 1804684571UL, 2106089606UL, 2387009004UL, 304865970UL, 611557097UL, 3789871366UL, 4246691682UL, 1405709661UL, 2728206193UL, 3389551988UL, 2973497449UL, 2958641966UL, 3183906006UL, 3895037582UL, 2460955430UL, 3606967204UL, 952637656UL, 1345432763UL, 2349212526UL, 3531087304UL, 2053994857UL, 563998083UL, 3749011414UL, 4028900485UL, 1242934125UL, 654565639UL, 1070907026UL, 1072342672UL, 1663452176UL, +3034416129UL, 278404469UL, 3899800390UL, 3566652188UL, 2721441405UL, 4258714417UL, 3249996223UL, 186674553UL, 4001263143UL, 4228837490UL, 639885806UL, 1495068058UL, 3033760361UL, 4278332644UL, 2820661772UL, 4159910300UL, 2602548287UL, 3386583150UL, 838831089UL, 1815256314UL, 1555885880UL, 2283016801UL, 3005955037UL, 3377397178UL, 2166514144UL, 2948774612UL, 3705188626UL, 1252262272UL, 2414422575UL, 751187322UL, 2107826711UL, 1447170583UL, +3373930285UL, 1253755033UL, 2809311944UL, 3763367196UL, 3712392731UL, 685796521UL, 3238624475UL, 936300677UL, 1986168339UL, 434430265UL, 2650681935UL, 1642290570UL, 1308015359UL, 1423189187UL, 3498513198UL, 792571900UL, 173318140UL, 3065349526UL, 315969823UL, 1105434360UL, 1484146625UL, 4103797777UL, 1038676789UL, 3336228275UL, 1425844616UL, 2871928454UL, 1797745765UL, 2956422231UL, 1762052458UL, 1610235673UL, 2844230432UL, 2180656608UL, +3603862093UL, 3771702243UL, 2912535126UL, 2574390988UL, 1183098390UL, 1691332448UL, 1626628844UL, 3980917176UL, 3221419689UL, 2645203959UL, 3120142427UL, 382092233UL, 3392407691UL, 472711005UL, 1659659070UL, 4101686983UL, 514297204UL, 3370011868UL, 509135340UL, 483888155UL, 3015736706UL, 3975975091UL, 1324152522UL, 762289386UL, 1259948064UL, 2395097989UL, 455322516UL, 31168606UL, 3367142977UL, 339990414UL, 30511955UL, 3952189603UL, +3298190175UL, 901235185UL, 3097920065UL, 2606298633UL, 826181452UL, 578573310UL, 3462447127UL, 1548039839UL, 4159642946UL, 1529242773UL, 2335345651UL, 1381450613UL, 2173079994UL, 1782913669UL, 877718651UL, 3184556473UL, 1076378339UL, 1570275057UL, 1730328819UL, 299344245UL, 4014350363UL, 2476927059UL, 1845882881UL, 1425685614UL, 3844531327UL, 1880989003UL, 3861138803UL, 1322409081UL, 889237383UL, 3272848161UL, 3397816882UL, 2309900530UL, +3505447982UL, 3430136873UL, 1319796589UL, 4202423979UL, 3184732284UL, 2910356648UL, 2534615223UL, 3854465731UL, 768821792UL, 2205052576UL, 1348983754UL, 1300250188UL, 2919181738UL, 2520178732UL, 3967243685UL, 2646012002UL, 1784678658UL, 741302051UL, 3464753547UL, 194213376UL, 1482799064UL, 3009673860UL, 680824208UL, 741966796UL, 2381283369UL, 3022877171UL, 1619439814UL, 3961433610UL, 1331297670UL, 1100110820UL, 1311672539UL, 1122110615UL, +4056004850UL, 3413790176UL, 3148768822UL, 1242592694UL, 2925975727UL, 1879285134UL, 334328879UL, 1318235222UL, 3140739559UL, 401691770UL, 3604288404UL, 3686496908UL, 770670945UL, 199139043UL, 2092710473UL, 3914528993UL, 700991333UL, 2375775811UL, 858137308UL, 3490050165UL, 2389078291UL, 1615607459UL, 3027969809UL, 820012549UL, 2085659484UL, 2654485136UL, 2630408646UL, 196481396UL, 1119673274UL, 1026209692UL, 726501622UL, 2940737143UL, +3559571163UL, 2288027726UL, 1039212708UL, 929664536UL, 1061981465UL, 186058675UL, 3537656152UL, 844176796UL, 2996217992UL, 1545798611UL, 3031020656UL, 2248030435UL, 1665857580UL, 2905758082UL, 1269201312UL, 3031275084UL, 4034872841UL, 983632400UL, 4188503190UL, 757119675UL, 2105920865UL, 4281032819UL, 2917801076UL, 3900010013UL, 3910997169UL, 1729751422UL, 562313247UL, 3070846353UL, 2564238664UL, 4050540186UL, 4258833501UL, 2270666053UL, +2207128401UL, 2990540001UL, 797768898UL, 2288390225UL, 3230323685UL, 1974727440UL, 3327301426UL, 289857826UL, 3565889868UL, 2791014422UL, 2021097820UL, 3350378271UL, 3673707591UL, 2610067927UL, 4255789547UL, 2682856590UL, 12563128UL, 1397542366UL, 237149400UL, 2233707508UL, 3875573245UL, 2097374144UL, 175320773UL, 4103445984UL, 4089284323UL, 3610168130UL, 3084915964UL, 680145366UL, 2571684685UL, 1132894909UL, 104640024UL, 193765521UL, +2338202907UL, 895271448UL, 11499099UL, 1798066417UL, 1297412626UL, 2511347162UL, 3140535007UL, 2129963538UL, 700683199UL, 2609700278UL, 2953463279UL, 2290844145UL, 1871316353UL, 3993801787UL, 2219413182UL, 2954453701UL, 231283580UL, 1375331115UL, 207723994UL, 1799562537UL, 2056553564UL, 2513609799UL, 3542459627UL, 3173012714UL, 3923404932UL, 217877755UL, 2095124912UL, 192024370UL, 1168134987UL, 1889598668UL, 3014873069UL, 2033573343UL, +}, +{ +3465348660UL, 3623545008UL, 3505902593UL, 838034830UL, 1338018789UL, 2595329276UL, 3367746385UL, 3197935201UL, 1439351946UL, 3585085571UL, 4165798087UL, 3634792639UL, 2359485974UL, 2772582925UL, 1110186203UL, 3771562484UL, 1508694157UL, 1564641206UL, 2801985736UL, 2446107936UL, 3849126897UL, 1842973671UL, 944408104UL, 2624631280UL, 2729080685UL, 3737368614UL, 858809173UL, 2289802345UL, 2428186575UL, 3114742765UL, 716011303UL, 3443810690UL, +814132610UL, 517432787UL, 614445393UL, 2930433345UL, 291178098UL, 2117644502UL, 2749446703UL, 311745701UL, 365684723UL, 1705418876UL, 2213749318UL, 4011417220UL, 1842575651UL, 988348831UL, 94258998UL, 2771150272UL, 498058526UL, 1344827813UL, 2961955291UL, 262703473UL, 1404034822UL, 1566595865UL, 2522381203UL, 1706522206UL, 1203054806UL, 1273801539UL, 2070583465UL, 3913449936UL, 3231505231UL, 619636751UL, 3746997351UL, 4103027837UL, +1205468203UL, 3355878253UL, 3433356888UL, 107785753UL, 2779092609UL, 1869691566UL, 2555219983UL, 903319808UL, 3273374169UL, 2538926990UL, 979533870UL, 1356500860UL, 1661983738UL, 1380761625UL, 2919458459UL, 1041142798UL, 1430817627UL, 517007606UL, 1421570516UL, 2371447300UL, 2985632691UL, 3684889351UL, 3873926653UL, 788770697UL, 1854750277UL, 209332297UL, 1137299679UL, 848527832UL, 3850486924UL, 4179307312UL, 2764470693UL, 1353191605UL, +4166891919UL, 2074703841UL, 3373997532UL, 2013528640UL, 701389744UL, 841917592UL, 2065742268UL, 2721848192UL, 2566956680UL, 3122896007UL, 1090761479UL, 921859028UL, 4086736376UL, 1837462309UL, 2579826431UL, 2436217134UL, 839037727UL, 1072086642UL, 614518622UL, 3764758228UL, 1501128342UL, 3669108708UL, 1601407381UL, 2899014005UL, 3268308948UL, 3337564231UL, 1986911578UL, 3379194930UL, 1950365753UL, 2098537451UL, 51515980UL, 1176526086UL, +3213391582UL, 1059745735UL, 2273586703UL, 376085505UL, 1493749800UL, 3970342143UL, 1620925244UL, 2165301314UL, 2332030190UL, 1864098798UL, 276747442UL, 2776569227UL, 2992780663UL, 3027279789UL, 1074555384UL, 3481518659UL, 2499703783UL, 661805703UL, 3782305562UL, 9186074UL, 2357407210UL, 2355922343UL, 2024733363UL, 485434612UL, 862379913UL, 1029706268UL, 1512726310UL, 3834948354UL, 1435892840UL, 3297980694UL, 2831553800UL, 2111416471UL, +711321697UL, 3465348660UL, 3623545008UL, 3505902593UL, 838034830UL, 1553436793UL, 2595329276UL, 3367746385UL, 3197935201UL, 1439351946UL, 3198044157UL, 4165798087UL, 3634792639UL, 2359485974UL, 2772582925UL, 836042976UL, 3771562484UL, 1508694157UL, 1564641206UL, 2801985736UL, 1190371491UL, 3849126897UL, 1842973671UL, 944408104UL, 2624631280UL, 410746791UL, 3737368614UL, 858809173UL, 2289802345UL, 2428186575UL, 1542325976UL, 716011303UL, +3443810690UL, 814132610UL, 517432787UL, 1649301063UL, 2930433345UL, 291178098UL, 2117644502UL, 2749446703UL, 3955511579UL, 365684723UL, 1705418876UL, 2213749318UL, 4011417220UL, 2753632862UL, 988348831UL, 94258998UL, 2771150272UL, 498058526UL, 3314106168UL, 2961955291UL, 262703473UL, 1404034822UL, 1566595865UL, 3590367097UL, 1706522206UL, 1203054806UL, 1273801539UL, 2070583465UL, 2340683261UL, 3231505231UL, 619636751UL, 3746997351UL, +4103027837UL, 2785398766UL, 3355878253UL, 3433356888UL, 107785753UL, 2779092609UL, 1608451840UL, 2555219983UL, 903319808UL, 3273374169UL, 2538926990UL, 645164419UL, 1356500860UL, 1661983738UL, 1380761625UL, 2919458459UL, 2260224548UL, 1430817627UL, 517007606UL, 1421570516UL, 2371447300UL, 1636004496UL, 3684889351UL, 3873926653UL, 788770697UL, 1854750277UL, 1345251011UL, 1137299679UL, 848527832UL, 3850486924UL, 4179307312UL, 3576574608UL, +1353191605UL, 4166891919UL, 2074703841UL, 3373997532UL, 183447754UL, 701389744UL, 841917592UL, 2065742268UL, 2721848192UL, 2109289891UL, 3122896007UL, 1090761479UL, 921859028UL, 4086736376UL, 2212730874UL, 2579826431UL, 2436217134UL, 839037727UL, 1072086642UL, 55934784UL, 3764758228UL, 1501128342UL, 3669108708UL, 1601407381UL, 516550987UL, 3268308948UL, 3337564231UL, 1986911578UL, 3379194930UL, 3973484473UL, 2098537451UL, 51515980UL, +1176526086UL, 3213391582UL, 4251661633UL, 2273586703UL, 376085505UL, 1493749800UL, 3970342143UL, 3190791788UL, 2165301314UL, 2332030190UL, 1864098798UL, 276747442UL, 2991976613UL, 2992780663UL, 3027279789UL, 1074555384UL, 3481518659UL, 1399789494UL, 661805703UL, 3782305562UL, 9186074UL, 2357407210UL, 1942736967UL, 2024733363UL, 485434612UL, 862379913UL, 1029706268UL, 4122704494UL, 3834948354UL, 1435892840UL, 3297980694UL, 2831553800UL, +1210092654UL, 711321697UL, 3465348660UL, 3623545008UL, 3505902593UL, 3443231198UL, 1553436793UL, 2595329276UL, 3367746385UL, 3197935201UL, 1304974987UL, 3198044157UL, 4165798087UL, 3634792639UL, 2359485974UL, 3518323362UL, 836042976UL, 3771562484UL, 1508694157UL, 1564641206UL, 3577633375UL, 1190371491UL, 3849126897UL, 1842973671UL, 944408104UL, 1854555112UL, 410746791UL, 3737368614UL, 858809173UL, 2289802345UL, 3622671731UL, 1542325976UL, +716011303UL, 3443810690UL, 814132610UL, 296197011UL, 1649301063UL, 2930433345UL, 291178098UL, 2117644502UL, 1056271538UL, 3955511579UL, 365684723UL, 1705418876UL, 2213749318UL, 1258535671UL, 2753632862UL, 988348831UL, 94258998UL, 2771150272UL, 3669902097UL, 3314106168UL, 2961955291UL, 262703473UL, 1404034822UL, 1654433938UL, 3590367097UL, 1706522206UL, 1203054806UL, 1273801539UL, 2448138887UL, 2340683261UL, 3231505231UL, 619636751UL, +3746997351UL, 1454088394UL, 2785398766UL, 3355878253UL, 3433356888UL, 107785753UL, 689323470UL, 1608451840UL, 2555219983UL, 903319808UL, 3273374169UL, 1603842392UL, 645164419UL, 1356500860UL, 1661983738UL, 1380761625UL, 2814639423UL, 2260224548UL, 1430817627UL, 517007606UL, 1421570516UL, 1938805701UL, 1636004496UL, 3684889351UL, 3873926653UL, 788770697UL, 4238900666UL, 1345251011UL, 1137299679UL, 848527832UL, 3850486924UL, 108793827UL, +3576574608UL, 1353191605UL, 4166891919UL, 2074703841UL, 3780897861UL, 183447754UL, 701389744UL, 841917592UL, 2065742268UL, 3036602746UL, 2109289891UL, 3122896007UL, 1090761479UL, 921859028UL, 3499985398UL, 2212730874UL, 2579826431UL, 2436217134UL, 839037727UL, 3520354700UL, 55934784UL, 3764758228UL, 1501128342UL, 3669108708UL, 1601010847UL, 516550987UL, 3268308948UL, 3337564231UL, 1986911578UL, 2704241781UL, 3973484473UL, 2098537451UL, +51515980UL, 1176526086UL, 3602010532UL, 4251661633UL, 2273586703UL, 376085505UL, 1493749800UL, 2922957328UL, 3190791788UL, 2165301314UL, 2332030190UL, 1864098798UL, 1649666443UL, 2991976613UL, 2992780663UL, 3027279789UL, 1074555384UL, 2848531519UL, 1399789494UL, 661805703UL, 3782305562UL, 9186074UL, 320781315UL, 1942736967UL, 2024733363UL, 485434612UL, 862379913UL, 3598892066UL, 4122704494UL, 3834948354UL, 1435892840UL, 3297980694UL, +545184652UL, 1210092654UL, 711321697UL, 3465348660UL, 3623545008UL, 1173753045UL, 3443231198UL, 1553436793UL, 2595329276UL, 3367746385UL, 2444634476UL, 1304974987UL, 3198044157UL, 4165798087UL, 3634792639UL, 1837035806UL, 3518323362UL, 836042976UL, 3771562484UL, 1508694157UL, 2899021294UL, 3577633375UL, 1190371491UL, 3849126897UL, 1842973671UL, 1614215215UL, 1854555112UL, 410746791UL, 3737368614UL, 858809173UL, 525745365UL, 3622671731UL, +1542325976UL, 716011303UL, 3443810690UL, 566299749UL, 296197011UL, 1649301063UL, 2930433345UL, 291178098UL, 1987532525UL, 1056271538UL, 3955511579UL, 365684723UL, 1705418876UL, 2321222760UL, 1258535671UL, 2753632862UL, 988348831UL, 94258998UL, 2986060366UL, 3669902097UL, 3314106168UL, 2961955291UL, 262703473UL, 604452796UL, 1654433938UL, 3590367097UL, 1706522206UL, 1203054806UL, 1894894069UL, 2448138887UL, 2340683261UL, 3231505231UL, +619636751UL, 6680729UL, 1454088394UL, 2785398766UL, 3355878253UL, 3433356888UL, 2025591660UL, 689323470UL, 1608451840UL, 2555219983UL, 903319808UL, 3430384385UL, 1603842392UL, 645164419UL, 1356500860UL, 1661983738UL, 2108736152UL, 2814639423UL, 2260224548UL, 1430817627UL, 517007606UL, 2973658959UL, 1938805701UL, 1636004496UL, 3684889351UL, 3873926653UL, 2283691941UL, 4238900666UL, 1345251011UL, 1137299679UL, 848527832UL, 45551112UL, +108793827UL, 3576574608UL, 1353191605UL, 4166891919UL, 3776615962UL, 3780897861UL, 183447754UL, 701389744UL, 841917592UL, 3830639316UL, 3036602746UL, 2109289891UL, 3122896007UL, 1090761479UL, 1931255897UL, 3499985398UL, 2212730874UL, 2579826431UL, 2436217134UL, 3272166055UL, 3520354700UL, 55934784UL, 3764758228UL, 1501128342UL, 1567864246UL, 1601010847UL, 516550987UL, 3268308948UL, 3337564231UL, 3918802424UL, 2704241781UL, 3973484473UL, +2098537451UL, 51515980UL, 3551394489UL, 3602010532UL, 4251661633UL, 2273586703UL, 376085505UL, 885459498UL, 2922957328UL, 3190791788UL, 2165301314UL, 2332030190UL, 3197056515UL, 1649666443UL, 2991976613UL, 2992780663UL, 3027279789UL, 2385348906UL, 2848531519UL, 1399789494UL, 661805703UL, 3782305562UL, 2163075465UL, 320781315UL, 1942736967UL, 2024733363UL, 485434612UL, 2680597981UL, 3598892066UL, 4122704494UL, 3834948354UL, 1435892840UL, +2499644163UL, 2704575422UL, 2579557838UL, 673530532UL, 493730767UL, 1124557747UL, 1908629439UL, 2821949504UL, 1743112513UL, 2849457841UL, 2344409314UL, 3479159262UL, 4260973770UL, 2991970754UL, 3812641863UL, 2229319917UL, 2466968521UL, 1766353737UL, 3216591612UL, 2113272648UL, 364370737UL, 1893001758UL, 2608875275UL, 4224057183UL, 3546705413UL, 1999778009UL, 348872225UL, 2470564216UL, 1417878284UL, 2709790112UL, 3579129936UL, 2137971615UL, +4046639861UL, 2841156930UL, 391544737UL, 2056567354UL, 737657378UL, 3877904725UL, 578930752UL, 1759172471UL, 3383278785UL, 1047197514UL, 649468151UL, 3452867243UL, 1792089520UL, 63936215UL, 3909143729UL, 3753489875UL, 734314122UL, 2490530916UL, 3043874586UL, 1504812057UL, 59001199UL, 2493748676UL, 2552438622UL, 1889694845UL, 3715397860UL, 2817245010UL, 3841049206UL, 816106718UL, 2176130406UL, 640254735UL, 12376903UL, 3000264936UL, +3304116079UL, 1620334094UL, 2109391765UL, 1348210951UL, 2237645681UL, 1207768272UL, 1562894669UL, 2156631655UL, 1387193235UL, 3154858817UL, 633510901UL, 2312190757UL, 402878244UL, 2501565021UL, 2984409334UL, 4167491216UL, 3614267292UL, 3078552271UL, 971722322UL, 3065543880UL, 2307584190UL, 491480322UL, 2068673112UL, 1929780632UL, 178549964UL, 983979983UL, 2769314886UL, 4214442042UL, 2977609682UL, 25450683UL, 3075212658UL, 1571149568UL, +3531670561UL, 42782504UL, 425601306UL, 428715214UL, 497250251UL, 693520802UL, 166426814UL, 1786382125UL, 2712003995UL, 3610802197UL, 2076490757UL, 404822980UL, 3953184772UL, 1655231947UL, 3594351577UL, 3068232274UL, 3771730346UL, 4110519574UL, 3534704897UL, 2375277865UL, 3597780202UL, 3472676002UL, 1350276449UL, 3218248239UL, 3589255283UL, 3253132633UL, 1769885529UL, 3792812294UL, 120332643UL, 1219374788UL, 3608889019UL, 2386099811UL, +858495304UL, 1284785543UL, 331370962UL, 2259419662UL, 2519864134UL, 3194739432UL, 2669074511UL, 2565559140UL, 3378072004UL, 2647801475UL, 265068954UL, 1464416963UL, 1232787612UL, 4160089759UL, 2510685972UL, 670300081UL, 2509357766UL, 1981891975UL, 4161588397UL, 1371924626UL, 44760868UL, 634955171UL, 1187096933UL, 3324788972UL, 3576888559UL, 2801347752UL, 3730298395UL, 1702170762UL, 4206083415UL, 741409141UL, 3649731355UL, 1025429529UL, +}, +{ +91444490UL, 628576944UL, 4069219862UL, 2253058925UL, 492354082UL, 1191182242UL, 1565180119UL, 2257613723UL, 456055162UL, 605712223UL, 953365104UL, 3104638527UL, 1133984729UL, 2662828416UL, 2134948274UL, 1921384447UL, 843719355UL, 588432962UL, 1734575434UL, 2924140067UL, 483396548UL, 3848838894UL, 3155476556UL, 1760928304UL, 4168059840UL, 3279827269UL, 2644461735UL, 4168565656UL, 3951563569UL, 1276805504UL, 1708974143UL, 1878547888UL, +3465220024UL, 3062086782UL, 2801401651UL, 1510428126UL, 716404149UL, 1646021208UL, 3534932385UL, 1186585561UL, 651997355UL, 282914223UL, 352224857UL, 3764407517UL, 1059868753UL, 1971798134UL, 978904005UL, 976413661UL, 4039544152UL, 498989693UL, 2565125471UL, 2782642813UL, 3537961025UL, 1194967362UL, 169217024UL, 3491609UL, 1319592872UL, 1630206561UL, 2497130840UL, 1685008996UL, 2828944016UL, 3301346775UL, 2893072371UL, 2606559798UL, +4026138031UL, 2664450619UL, 691091062UL, 1079640113UL, 1417637732UL, 4081852209UL, 2197910648UL, 2310382370UL, 1000957047UL, 959936499UL, 2844551811UL, 2272766890UL, 31122394UL, 2742925483UL, 1121884686UL, 57929089UL, 2468361281UL, 2982007782UL, 2371576893UL, 177782593UL, 3603584577UL, 672057044UL, 2108452841UL, 1671338057UL, 3386908223UL, 1243029765UL, 805157552UL, 1271858417UL, 1621249501UL, 1804851492UL, 1321010403UL, 751773221UL, +1517221627UL, 822709871UL, 104533154UL, 3578182264UL, 640541709UL, 421086624UL, 4233576392UL, 3729339369UL, 197460644UL, 773140636UL, 2158026018UL, 1756785611UL, 4011575991UL, 3569445500UL, 736117181UL, 2456162322UL, 1168189787UL, 3651312675UL, 1070291988UL, 268231205UL, 541474497UL, 3316168972UL, 3546990856UL, 830417208UL, 725960194UL, 2044207227UL, 3188997938UL, 2383298579UL, 3350316374UL, 3575011225UL, 1553111865UL, 1285013027UL, +749371711UL, 766611716UL, 598195098UL, 2139882719UL, 2062405428UL, 3634702446UL, 3015263295UL, 223311969UL, 2622859522UL, 3888492701UL, 2955257225UL, 582625650UL, 3563756446UL, 2886083960UL, 1907546514UL, 454650902UL, 3287277541UL, 625828138UL, 2991888140UL, 1935326370UL, 4031152256UL, 702881509UL, 1427632724UL, 1345475301UL, 2577560804UL, 2858595147UL, 2533191188UL, 185662179UL, 536505093UL, 3747894147UL, 111551030UL, 370373207UL, +2293908590UL, 91444490UL, 628576944UL, 4069219862UL, 2253058925UL, 1671484924UL, 1191182242UL, 1565180119UL, 2257613723UL, 456055162UL, 3411094744UL, 953365104UL, 3104638527UL, 1133984729UL, 2662828416UL, 2000630022UL, 1921384447UL, 843719355UL, 588432962UL, 1734575434UL, 3293926122UL, 483396548UL, 3848838894UL, 3155476556UL, 1760928304UL, 146876953UL, 3279827269UL, 2644461735UL, 4168565656UL, 3951563569UL, 3976156700UL, 1708974143UL, +1878547888UL, 3465220024UL, 3062086782UL, 1999154400UL, 1510428126UL, 716404149UL, 1646021208UL, 3534932385UL, 2479551429UL, 651997355UL, 282914223UL, 352224857UL, 3764407517UL, 1275979651UL, 1971798134UL, 978904005UL, 976413661UL, 4039544152UL, 300654823UL, 2565125471UL, 2782642813UL, 3537961025UL, 1194967362UL, 3123973648UL, 3491609UL, 1319592872UL, 1630206561UL, 2497130840UL, 1437913158UL, 2828944016UL, 3301346775UL, 2893072371UL, +2606559798UL, 2153172585UL, 2664450619UL, 691091062UL, 1079640113UL, 1417637732UL, 17137237UL, 2197910648UL, 2310382370UL, 1000957047UL, 959936499UL, 802137134UL, 2272766890UL, 31122394UL, 2742925483UL, 1121884686UL, 3909775167UL, 2468361281UL, 2982007782UL, 2371576893UL, 177782593UL, 3319492525UL, 672057044UL, 2108452841UL, 1671338057UL, 3386908223UL, 1878151473UL, 805157552UL, 1271858417UL, 1621249501UL, 1804851492UL, 3215921223UL, +751773221UL, 1517221627UL, 822709871UL, 104533154UL, 361845001UL, 640541709UL, 421086624UL, 4233576392UL, 3729339369UL, 2655936801UL, 773140636UL, 2158026018UL, 1756785611UL, 4011575991UL, 587202971UL, 736117181UL, 2456162322UL, 1168189787UL, 3651312675UL, 2517883370UL, 268231205UL, 541474497UL, 3316168972UL, 3546990856UL, 2037251305UL, 725960194UL, 2044207227UL, 3188997938UL, 2383298579UL, 2665008587UL, 3575011225UL, 1553111865UL, +1285013027UL, 749371711UL, 2163964019UL, 598195098UL, 2139882719UL, 2062405428UL, 3634702446UL, 2788202059UL, 223311969UL, 2622859522UL, 3888492701UL, 2955257225UL, 740986174UL, 3563756446UL, 2886083960UL, 1907546514UL, 454650902UL, 2426323587UL, 625828138UL, 2991888140UL, 1935326370UL, 4031152256UL, 1831149435UL, 1427632724UL, 1345475301UL, 2577560804UL, 2858595147UL, 3977153945UL, 185662179UL, 536505093UL, 3747894147UL, 111551030UL, +4131587422UL, 2293908590UL, 91444490UL, 628576944UL, 4069219862UL, 2408189350UL, 1671484924UL, 1191182242UL, 1565180119UL, 2257613723UL, 1338069254UL, 3411094744UL, 953365104UL, 3104638527UL, 1133984729UL, 631497759UL, 2000630022UL, 1921384447UL, 843719355UL, 588432962UL, 3280318959UL, 3293926122UL, 483396548UL, 3848838894UL, 3155476556UL, 1777918163UL, 146876953UL, 3279827269UL, 2644461735UL, 4168565656UL, 2786264663UL, 3976156700UL, +1708974143UL, 1878547888UL, 3465220024UL, 2793923820UL, 1999154400UL, 1510428126UL, 716404149UL, 1646021208UL, 3102243824UL, 2479551429UL, 651997355UL, 282914223UL, 352224857UL, 3767702588UL, 1275979651UL, 1971798134UL, 978904005UL, 976413661UL, 1951622548UL, 300654823UL, 2565125471UL, 2782642813UL, 3537961025UL, 2186817324UL, 3123973648UL, 3491609UL, 1319592872UL, 1630206561UL, 1075424534UL, 1437913158UL, 2828944016UL, 3301346775UL, +2893072371UL, 207992406UL, 2153172585UL, 2664450619UL, 691091062UL, 1079640113UL, 3114255216UL, 17137237UL, 2197910648UL, 2310382370UL, 1000957047UL, 2548008553UL, 802137134UL, 2272766890UL, 31122394UL, 2742925483UL, 4069482373UL, 3909775167UL, 2468361281UL, 2982007782UL, 2371576893UL, 2807823912UL, 3319492525UL, 672057044UL, 2108452841UL, 1671338057UL, 12831353UL, 1878151473UL, 805157552UL, 1271858417UL, 1621249501UL, 461887094UL, +3215921223UL, 751773221UL, 1517221627UL, 822709871UL, 1317394918UL, 361845001UL, 640541709UL, 421086624UL, 4233576392UL, 3385587450UL, 2655936801UL, 773140636UL, 2158026018UL, 1756785611UL, 1475601973UL, 587202971UL, 736117181UL, 2456162322UL, 1168189787UL, 911455077UL, 2517883370UL, 268231205UL, 541474497UL, 3316168972UL, 1500275507UL, 2037251305UL, 725960194UL, 2044207227UL, 3188997938UL, 2036633808UL, 2665008587UL, 3575011225UL, +1553111865UL, 1285013027UL, 87868216UL, 2163964019UL, 598195098UL, 2139882719UL, 2062405428UL, 517907301UL, 2788202059UL, 223311969UL, 2622859522UL, 3888492701UL, 3926046234UL, 740986174UL, 3563756446UL, 2886083960UL, 1907546514UL, 1911066215UL, 2426323587UL, 625828138UL, 2991888140UL, 1935326370UL, 2031853435UL, 1831149435UL, 1427632724UL, 1345475301UL, 2577560804UL, 3509674153UL, 3977153945UL, 185662179UL, 536505093UL, 3747894147UL, +1711714600UL, 4131587422UL, 2293908590UL, 91444490UL, 628576944UL, 3370678255UL, 2408189350UL, 1671484924UL, 1191182242UL, 1565180119UL, 3786239592UL, 1338069254UL, 3411094744UL, 953365104UL, 3104638527UL, 3659647225UL, 631497759UL, 2000630022UL, 1921384447UL, 843719355UL, 3364831282UL, 3280318959UL, 3293926122UL, 483396548UL, 3848838894UL, 3131266478UL, 1777918163UL, 146876953UL, 3279827269UL, 2644461735UL, 4156372383UL, 2786264663UL, +3976156700UL, 1708974143UL, 1878547888UL, 2168041590UL, 2793923820UL, 1999154400UL, 1510428126UL, 716404149UL, 3392113666UL, 3102243824UL, 2479551429UL, 651997355UL, 282914223UL, 2085613514UL, 3767702588UL, 1275979651UL, 1971798134UL, 978904005UL, 503506384UL, 1951622548UL, 300654823UL, 2565125471UL, 2782642813UL, 1458431750UL, 2186817324UL, 3123973648UL, 3491609UL, 1319592872UL, 452433679UL, 1075424534UL, 1437913158UL, 2828944016UL, +3301346775UL, 2333281307UL, 207992406UL, 2153172585UL, 2664450619UL, 691091062UL, 3553502652UL, 3114255216UL, 17137237UL, 2197910648UL, 2310382370UL, 3153689868UL, 2548008553UL, 802137134UL, 2272766890UL, 31122394UL, 468580641UL, 4069482373UL, 3909775167UL, 2468361281UL, 2982007782UL, 1445286890UL, 2807823912UL, 3319492525UL, 672057044UL, 2108452841UL, 1755577669UL, 12831353UL, 1878151473UL, 805157552UL, 1271858417UL, 2623540912UL, +461887094UL, 3215921223UL, 751773221UL, 1517221627UL, 3922191946UL, 1317394918UL, 361845001UL, 640541709UL, 421086624UL, 2173849516UL, 3385587450UL, 2655936801UL, 773140636UL, 2158026018UL, 1085377158UL, 1475601973UL, 587202971UL, 736117181UL, 2456162322UL, 2158960374UL, 911455077UL, 2517883370UL, 268231205UL, 541474497UL, 943191315UL, 1500275507UL, 2037251305UL, 725960194UL, 2044207227UL, 2481150802UL, 2036633808UL, 2665008587UL, +3575011225UL, 1553111865UL, 2301231777UL, 87868216UL, 2163964019UL, 598195098UL, 2139882719UL, 2007840238UL, 517907301UL, 2788202059UL, 223311969UL, 2622859522UL, 151920263UL, 3926046234UL, 740986174UL, 3563756446UL, 2886083960UL, 1338937928UL, 1911066215UL, 2426323587UL, 625828138UL, 2991888140UL, 2652286195UL, 2031853435UL, 1831149435UL, 1427632724UL, 1345475301UL, 289801789UL, 3509674153UL, 3977153945UL, 185662179UL, 536505093UL, +2727322952UL, 3980498348UL, 2529622213UL, 1903052964UL, 3564714651UL, 2281240568UL, 533384122UL, 277613480UL, 1815540358UL, 282763841UL, 3669112623UL, 2572859425UL, 195220178UL, 1210883545UL, 2359703600UL, 1187537824UL, 675732974UL, 325036095UL, 708091465UL, 2556854604UL, 701006284UL, 2378459191UL, 1863513103UL, 2690918197UL, 4237307694UL, 1356483501UL, 2160905652UL, 521809106UL, 974368613UL, 3136010957UL, 2722488678UL, 3711515637UL, +2296341459UL, 4233729945UL, 1196247571UL, 3031398071UL, 515543502UL, 1314129776UL, 3235373306UL, 1303165859UL, 1820568009UL, 559099351UL, 186876368UL, 1076102111UL, 1218809551UL, 1790301111UL, 4130210229UL, 768125358UL, 1132864749UL, 4262563773UL, 2294411020UL, 4092943985UL, 2558108246UL, 3737664949UL, 2219923393UL, 724326159UL, 4134105682UL, 4188752746UL, 3615233671UL, 1526018731UL, 2281637916UL, 2459490295UL, 3637342666UL, 777862587UL, +39962002UL, 3772005832UL, 997473319UL, 574843584UL, 3356551974UL, 1265234427UL, 1698059437UL, 534747571UL, 1465532164UL, 3263029035UL, 534512444UL, 2343092827UL, 2375685652UL, 2497926141UL, 2377933621UL, 2212335180UL, 261114084UL, 172755755UL, 2737085495UL, 2225257145UL, 148605658UL, 1353911796UL, 357753009UL, 1778732943UL, 497635558UL, 4136467976UL, 2837964962UL, 4045039047UL, 2485296762UL, 1587587183UL, 4042904168UL, 3184240963UL, +2393293696UL, 915444966UL, 2299938515UL, 3351580749UL, 506575598UL, 1541916825UL, 3465300401UL, 525927458UL, 681152801UL, 331660975UL, 3624685846UL, 2994172100UL, 3274369082UL, 3638287602UL, 815689760UL, 1710961092UL, 2775607076UL, 2175058103UL, 3252688367UL, 2936890483UL, 2746319120UL, 2736754UL, 1646031035UL, 2448701214UL, 2886833213UL, 3689830606UL, 3292798106UL, 300773646UL, 3125160783UL, 1247453205UL, 2746275624UL, 4011063775UL, +904135764UL, 876847374UL, 366267234UL, 2541269205UL, 131376648UL, 1805948133UL, 3383589530UL, 2350119829UL, 2513170439UL, 4096158499UL, 4229211520UL, 2992048272UL, 1338522080UL, 1187391335UL, 2898563453UL, 2163088451UL, 1417971677UL, 2047421551UL, 902282791UL, 1143943232UL, 3568431811UL, 4059861993UL, 193362198UL, 2509297125UL, 3968551582UL, 2175686117UL, 3568936881UL, 1853177468UL, 2134063169UL, 2919389416UL, 1124914545UL, 1209806738UL, +}, +{ +1199972651UL, 1035834631UL, 3177798370UL, 860834162UL, 3741677748UL, 3780327829UL, 1693730265UL, 1643429511UL, 559568669UL, 2758650294UL, 647308222UL, 3901603996UL, 1778653821UL, 3618523672UL, 2154201067UL, 4261179460UL, 3285764480UL, 3334002738UL, 3215795953UL, 91368462UL, 1883994950UL, 1506873376UL, 1527780962UL, 4046354597UL, 4081676034UL, 2389066602UL, 1574939945UL, 427845396UL, 2714836263UL, 1259019491UL, 2493238133UL, 2584034689UL, +3151382431UL, 2171033919UL, 176883719UL, 2031844862UL, 1272380790UL, 1298975901UL, 4087222847UL, 1524000054UL, 311436877UL, 3627785554UL, 1889491722UL, 2938069193UL, 2771940687UL, 2756955968UL, 4289348777UL, 263514583UL, 887207028UL, 3522902525UL, 2273246349UL, 835377715UL, 2897243319UL, 204645450UL, 1775911983UL, 639470242UL, 2856296318UL, 3032942383UL, 2845501282UL, 1979082575UL, 202834023UL, 1876303820UL, 1434703409UL, 4240524132UL, +848853780UL, 4188621628UL, 928095314UL, 876412914UL, 3446576392UL, 3235688990UL, 4021419931UL, 2483628986UL, 3155781890UL, 399997246UL, 1642535200UL, 3872575068UL, 1577956550UL, 3606228634UL, 609914462UL, 653194726UL, 4048067248UL, 2500767965UL, 1125167825UL, 3707628088UL, 1819135158UL, 1875618971UL, 3865851141UL, 328215079UL, 1695889194UL, 2040280471UL, 3384684457UL, 2540504961UL, 293050253UL, 525570078UL, 2655676443UL, 1392199429UL, +3370444585UL, 1937915855UL, 2229636250UL, 247937142UL, 2534538765UL, 365841057UL, 2449431033UL, 2456532429UL, 101910696UL, 1247069485UL, 1523958293UL, 2473285670UL, 473709728UL, 3026667113UL, 2071968844UL, 324025193UL, 423064436UL, 3870800061UL, 3977393138UL, 3632553233UL, 352757977UL, 1584833348UL, 3173248650UL, 1159857686UL, 1501841977UL, 1751860798UL, 617281070UL, 1958012761UL, 4031667102UL, 3232142321UL, 3087428595UL, 2380824676UL, +1194087757UL, 1542961747UL, 4163350364UL, 1721646249UL, 1672791861UL, 2900511710UL, 24973500UL, 1705444176UL, 713642505UL, 3017719513UL, 2090715200UL, 3521434070UL, 37117223UL, 1948295454UL, 3055840561UL, 3476120789UL, 3994249388UL, 527899063UL, 4285770666UL, 1075524023UL, 2594223535UL, 392943522UL, 171012646UL, 3515750082UL, 3414659054UL, 3501852926UL, 1493283737UL, 2662104279UL, 2033464928UL, 90134967UL, 363058647UL, 3289266998UL, +2470752727UL, 1199972651UL, 1035834631UL, 3177798370UL, 860834162UL, 1791097822UL, 3780327829UL, 1693730265UL, 1643429511UL, 559568669UL, 3503319486UL, 647308222UL, 3901603996UL, 1778653821UL, 3618523672UL, 4294594427UL, 4261179460UL, 3285764480UL, 3334002738UL, 3215795953UL, 212518363UL, 1883994950UL, 1506873376UL, 1527780962UL, 4046354597UL, 2398655600UL, 2389066602UL, 1574939945UL, 427845396UL, 2714836263UL, 2744363872UL, 2493238133UL, +2584034689UL, 3151382431UL, 2171033919UL, 2787053497UL, 2031844862UL, 1272380790UL, 1298975901UL, 4087222847UL, 2342953154UL, 311436877UL, 3627785554UL, 1889491722UL, 2938069193UL, 2026656505UL, 2756955968UL, 4289348777UL, 263514583UL, 887207028UL, 2097276163UL, 2273246349UL, 835377715UL, 2897243319UL, 204645450UL, 4233399907UL, 639470242UL, 2856296318UL, 3032942383UL, 2845501282UL, 28260330UL, 202834023UL, 1876303820UL, 1434703409UL, +4240524132UL, 2455670466UL, 4188621628UL, 928095314UL, 876412914UL, 3446576392UL, 117581687UL, 4021419931UL, 2483628986UL, 3155781890UL, 399997246UL, 4254101087UL, 3872575068UL, 1577956550UL, 3606228634UL, 609914462UL, 4003279048UL, 4048067248UL, 2500767965UL, 1125167825UL, 3707628088UL, 922020515UL, 1875618971UL, 3865851141UL, 328215079UL, 1695889194UL, 625773097UL, 3384684457UL, 2540504961UL, 293050253UL, 525570078UL, 2592805114UL, +1392199429UL, 3370444585UL, 1937915855UL, 2229636250UL, 3190958614UL, 2534538765UL, 365841057UL, 2449431033UL, 2456532429UL, 3778669305UL, 1247069485UL, 1523958293UL, 2473285670UL, 473709728UL, 720895889UL, 2071968844UL, 324025193UL, 423064436UL, 3870800061UL, 3535536111UL, 3632553233UL, 352757977UL, 1584833348UL, 3173248650UL, 2649344603UL, 1501841977UL, 1751860798UL, 617281070UL, 1958012761UL, 778965559UL, 3232142321UL, 3087428595UL, +2380824676UL, 1194087757UL, 3880222002UL, 4163350364UL, 1721646249UL, 1672791861UL, 2900511710UL, 702936770UL, 1705444176UL, 713642505UL, 3017719513UL, 2090715200UL, 1477858694UL, 37117223UL, 1948295454UL, 3055840561UL, 3476120789UL, 464173532UL, 527899063UL, 4285770666UL, 1075524023UL, 2594223535UL, 2872629966UL, 171012646UL, 3515750082UL, 3414659054UL, 3501852926UL, 1631555059UL, 2662104279UL, 2033464928UL, 90134967UL, 363058647UL, +4112991722UL, 2470752727UL, 1199972651UL, 1035834631UL, 3177798370UL, 4152098951UL, 1791097822UL, 3780327829UL, 1693730265UL, 1643429511UL, 153020604UL, 3503319486UL, 647308222UL, 3901603996UL, 1778653821UL, 221887019UL, 4294594427UL, 4261179460UL, 3285764480UL, 3334002738UL, 3340918862UL, 212518363UL, 1883994950UL, 1506873376UL, 1527780962UL, 430180116UL, 2398655600UL, 2389066602UL, 1574939945UL, 427845396UL, 1683639957UL, 2744363872UL, +2493238133UL, 2584034689UL, 3151382431UL, 752704472UL, 2787053497UL, 2031844862UL, 1272380790UL, 1298975901UL, 1528220628UL, 2342953154UL, 311436877UL, 3627785554UL, 1889491722UL, 2576495467UL, 2026656505UL, 2756955968UL, 4289348777UL, 263514583UL, 3778019638UL, 2097276163UL, 2273246349UL, 835377715UL, 2897243319UL, 1060067446UL, 4233399907UL, 639470242UL, 2856296318UL, 3032942383UL, 2351047932UL, 28260330UL, 202834023UL, 1876303820UL, +1434703409UL, 3094305336UL, 2455670466UL, 4188621628UL, 928095314UL, 876412914UL, 3785385583UL, 117581687UL, 4021419931UL, 2483628986UL, 3155781890UL, 1867816730UL, 4254101087UL, 3872575068UL, 1577956550UL, 3606228634UL, 3081878598UL, 4003279048UL, 4048067248UL, 2500767965UL, 1125167825UL, 928465955UL, 922020515UL, 1875618971UL, 3865851141UL, 328215079UL, 173810260UL, 625773097UL, 3384684457UL, 2540504961UL, 293050253UL, 2645143254UL, +2592805114UL, 1392199429UL, 3370444585UL, 1937915855UL, 162781360UL, 3190958614UL, 2534538765UL, 365841057UL, 2449431033UL, 3105377832UL, 3778669305UL, 1247069485UL, 1523958293UL, 2473285670UL, 800971948UL, 720895889UL, 2071968844UL, 324025193UL, 423064436UL, 52577992UL, 3535536111UL, 3632553233UL, 352757977UL, 1584833348UL, 3305908059UL, 2649344603UL, 1501841977UL, 1751860798UL, 617281070UL, 264880505UL, 778965559UL, 3232142321UL, +3087428595UL, 2380824676UL, 1127761012UL, 3880222002UL, 4163350364UL, 1721646249UL, 1672791861UL, 2368512339UL, 702936770UL, 1705444176UL, 713642505UL, 3017719513UL, 197200752UL, 1477858694UL, 37117223UL, 1948295454UL, 3055840561UL, 1588372042UL, 464173532UL, 527899063UL, 4285770666UL, 1075524023UL, 2124039914UL, 2872629966UL, 171012646UL, 3515750082UL, 3414659054UL, 818571456UL, 1631555059UL, 2662104279UL, 2033464928UL, 90134967UL, +952712086UL, 4112991722UL, 2470752727UL, 1199972651UL, 1035834631UL, 888975816UL, 4152098951UL, 1791097822UL, 3780327829UL, 1693730265UL, 3406785510UL, 153020604UL, 3503319486UL, 647308222UL, 3901603996UL, 3753248472UL, 221887019UL, 4294594427UL, 4261179460UL, 3285764480UL, 1861431346UL, 3340918862UL, 212518363UL, 1883994950UL, 1506873376UL, 2695939612UL, 430180116UL, 2398655600UL, 2389066602UL, 1574939945UL, 2852159074UL, 1683639957UL, +2744363872UL, 2493238133UL, 2584034689UL, 1952065633UL, 752704472UL, 2787053497UL, 2031844862UL, 1272380790UL, 3530505866UL, 1528220628UL, 2342953154UL, 311436877UL, 3627785554UL, 3410473245UL, 2576495467UL, 2026656505UL, 2756955968UL, 4289348777UL, 2856163034UL, 3778019638UL, 2097276163UL, 2273246349UL, 835377715UL, 3127280755UL, 1060067446UL, 4233399907UL, 639470242UL, 2856296318UL, 2615775011UL, 2351047932UL, 28260330UL, 202834023UL, +1876303820UL, 619308202UL, 3094305336UL, 2455670466UL, 4188621628UL, 928095314UL, 3764894047UL, 3785385583UL, 117581687UL, 4021419931UL, 2483628986UL, 3759839215UL, 1867816730UL, 4254101087UL, 3872575068UL, 1577956550UL, 1687107439UL, 3081878598UL, 4003279048UL, 4048067248UL, 2500767965UL, 2804044146UL, 928465955UL, 922020515UL, 1875618971UL, 3865851141UL, 2359176389UL, 173810260UL, 625773097UL, 3384684457UL, 2540504961UL, 3665420733UL, +2645143254UL, 2592805114UL, 1392199429UL, 3370444585UL, 1604709429UL, 162781360UL, 3190958614UL, 2534538765UL, 365841057UL, 3843585067UL, 3105377832UL, 3778669305UL, 1247069485UL, 1523958293UL, 293374051UL, 800971948UL, 720895889UL, 2071968844UL, 324025193UL, 3342361801UL, 52577992UL, 3535536111UL, 3632553233UL, 352757977UL, 1386594581UL, 3305908059UL, 2649344603UL, 1501841977UL, 1751860798UL, 3160423601UL, 264880505UL, 778965559UL, +3232142321UL, 3087428595UL, 3814775120UL, 1127761012UL, 3880222002UL, 4163350364UL, 1721646249UL, 3640773034UL, 2368512339UL, 702936770UL, 1705444176UL, 713642505UL, 1717761787UL, 197200752UL, 1477858694UL, 37117223UL, 1948295454UL, 896215772UL, 1588372042UL, 464173532UL, 527899063UL, 4285770666UL, 3441409029UL, 2124039914UL, 2872629966UL, 171012646UL, 3515750082UL, 2216687886UL, 818571456UL, 1631555059UL, 2662104279UL, 2033464928UL, +369438400UL, 329003658UL, 1503365029UL, 4215790910UL, 3264377550UL, 733526983UL, 2935318632UL, 1792331479UL, 608347530UL, 392723097UL, 1330445854UL, 3473004271UL, 1267636682UL, 2150566972UL, 2664910943UL, 2591861637UL, 409769584UL, 2943326880UL, 3746302819UL, 3162268832UL, 1028663260UL, 3206607045UL, 832105292UL, 2119405275UL, 538318455UL, 2981192295UL, 861775416UL, 609718403UL, 3531204230UL, 1904759571UL, 1262633751UL, 2375133081UL, +460454984UL, 946700253UL, 3763898311UL, 1571175213UL, 3124410107UL, 2413420216UL, 2664177543UL, 3241803820UL, 3968067371UL, 1234860999UL, 1130471500UL, 772727786UL, 247203117UL, 576455235UL, 246297007UL, 2027348597UL, 764933887UL, 3812479771UL, 1825807084UL, 4072281412UL, 2156865781UL, 1286484847UL, 1966749063UL, 2479269303UL, 423506843UL, 3070938758UL, 653091413UL, 2267423132UL, 2004263526UL, 1374490719UL, 3871990628UL, 841138314UL, +1260317857UL, 3887432433UL, 4025147569UL, 764233331UL, 1794763428UL, 3005903468UL, 877926770UL, 2466593927UL, 2971729561UL, 3203070565UL, 4198500026UL, 815665759UL, 2434508139UL, 1840456368UL, 2279000427UL, 17077200UL, 3178380570UL, 990304199UL, 3578008580UL, 1965763660UL, 1640352477UL, 750159594UL, 2047409402UL, 3576308245UL, 544920564UL, 1730124869UL, 1194761386UL, 3280315505UL, 147334027UL, 2870674244UL, 2076860776UL, 1100947675UL, +2482772161UL, 401966468UL, 1610650855UL, 193868446UL, 3808157106UL, 1509130117UL, 1324484736UL, 3852893217UL, 1059179497UL, 4053543778UL, 2557844172UL, 3282312002UL, 682550058UL, 4281899173UL, 137171998UL, 3239159214UL, 2258610918UL, 426724741UL, 3502660993UL, 135977383UL, 429929363UL, 3984458137UL, 964026748UL, 2182019070UL, 3836562946UL, 515026869UL, 359030455UL, 1301694917UL, 2300414803UL, 2364654981UL, 3804876710UL, 171119249UL, +2646785698UL, 4283509387UL, 3628087763UL, 1748227044UL, 3037141234UL, 3000413256UL, 23007314UL, 3598880509UL, 4160517314UL, 112205578UL, 1677675411UL, 734881643UL, 2830770338UL, 3470317145UL, 3306806569UL, 2635040943UL, 2671367560UL, 3528996498UL, 3878886478UL, 3114253828UL, 2721384408UL, 3175226991UL, 1393767271UL, 2651623266UL, 3767978376UL, 1269699398UL, 1100964192UL, 4169085845UL, 2086718107UL, 1286251099UL, 764751784UL, 3006878591UL, +}, +{ +2565473087UL, 1149521056UL, 3529037691UL, 630435548UL, 73598765UL, 1467331930UL, 3988027050UL, 2771962200UL, 91261543UL, 980989218UL, 2227515435UL, 236831608UL, 2872772569UL, 2330469327UL, 1654035853UL, 2883791516UL, 4170143763UL, 126418114UL, 127789935UL, 2114249438UL, 2933346767UL, 639483386UL, 1532399845UL, 2182422151UL, 741069317UL, 2376371063UL, 3398508789UL, 3828295651UL, 3963199356UL, 4156483769UL, 4206759111UL, 1266176088UL, +3210273687UL, 432131993UL, 667709537UL, 874477513UL, 2304714957UL, 629309008UL, 116453438UL, 3051811727UL, 3490241985UL, 3355968243UL, 2304043871UL, 2724990029UL, 1095724699UL, 2408437363UL, 1433161037UL, 3245468546UL, 2494529842UL, 4204170637UL, 1966342448UL, 3092333073UL, 1861880941UL, 3990012367UL, 3710334908UL, 2526395471UL, 1884691351UL, 2145882162UL, 2561288457UL, 2253122309UL, 1154858044UL, 1643256991UL, 3172857504UL, 1096492713UL, +2848827103UL, 799826424UL, 3094672168UL, 3535834360UL, 4213256737UL, 1131757994UL, 520495112UL, 575315345UL, 3823364867UL, 2424349582UL, 3604795017UL, 310789314UL, 4207205257UL, 553462404UL, 2918228443UL, 2568360580UL, 3863565851UL, 874197736UL, 3329267685UL, 1186352580UL, 3928193054UL, 1780200631UL, 4088289456UL, 3323217870UL, 2758854947UL, 3111637417UL, 990374143UL, 2080149357UL, 4047813631UL, 2019887940UL, 578660736UL, 2145680301UL, +2328411541UL, 1572704242UL, 405739686UL, 1869350271UL, 2046317220UL, 4021497634UL, 1385163990UL, 1935250885UL, 1132987169UL, 581690993UL, 3172043012UL, 628071512UL, 2851125739UL, 2735324847UL, 2847267504UL, 3408334906UL, 3352976111UL, 706277272UL, 2971786942UL, 2811957324UL, 3578703606UL, 1126685543UL, 2671169997UL, 31952251UL, 2802110464UL, 2391618856UL, 3031260674UL, 1165714541UL, 2411388800UL, 2825634835UL, 101928462UL, 477629709UL, +4257022506UL, 3281706767UL, 2576087732UL, 736533968UL, 2543083137UL, 3430523686UL, 3272172013UL, 3056925798UL, 341993500UL, 406782950UL, 1770032304UL, 125786076UL, 1321359723UL, 2901696227UL, 1890958265UL, 3610842776UL, 1772227311UL, 1564088598UL, 914173231UL, 3734092059UL, 1652333721UL, 2386645282UL, 329706426UL, 1022239203UL, 1832393502UL, 4064995802UL, 3497852986UL, 1046436763UL, 366391010UL, 2237068647UL, 2887356463UL, 304718827UL, +3969799795UL, 2565473087UL, 1149521056UL, 3529037691UL, 630435548UL, 3758124054UL, 1467331930UL, 3988027050UL, 2771962200UL, 91261543UL, 836545831UL, 2227515435UL, 236831608UL, 2872772569UL, 2330469327UL, 3439193753UL, 2883791516UL, 4170143763UL, 126418114UL, 127789935UL, 1648940583UL, 2933346767UL, 639483386UL, 1532399845UL, 2182422151UL, 2470139222UL, 2376371063UL, 3398508789UL, 3828295651UL, 3963199356UL, 2997263135UL, 4206759111UL, +1266176088UL, 3210273687UL, 432131993UL, 2416600665UL, 874477513UL, 2304714957UL, 629309008UL, 116453438UL, 2586542760UL, 3490241985UL, 3355968243UL, 2304043871UL, 2724990029UL, 452934545UL, 2408437363UL, 1433161037UL, 3245468546UL, 2494529842UL, 2244403710UL, 1966342448UL, 3092333073UL, 1861880941UL, 3990012367UL, 2774994234UL, 2526395471UL, 1884691351UL, 2145882162UL, 2561288457UL, 2303702146UL, 1154858044UL, 1643256991UL, 3172857504UL, +1096492713UL, 130979316UL, 799826424UL, 3094672168UL, 3535834360UL, 4213256737UL, 935499492UL, 520495112UL, 575315345UL, 3823364867UL, 2424349582UL, 2272973265UL, 310789314UL, 4207205257UL, 553462404UL, 2918228443UL, 2613016888UL, 3863565851UL, 874197736UL, 3329267685UL, 1186352580UL, 4106984978UL, 1780200631UL, 4088289456UL, 3323217870UL, 2758854947UL, 1559861146UL, 990374143UL, 2080149357UL, 4047813631UL, 2019887940UL, 1133329900UL, +2145680301UL, 2328411541UL, 1572704242UL, 405739686UL, 63633520UL, 2046317220UL, 4021497634UL, 1385163990UL, 1935250885UL, 1762959503UL, 581690993UL, 3172043012UL, 628071512UL, 2851125739UL, 3726073981UL, 2847267504UL, 3408334906UL, 3352976111UL, 706277272UL, 3817450114UL, 2811957324UL, 3578703606UL, 1126685543UL, 2671169997UL, 2749086326UL, 2802110464UL, 2391618856UL, 3031260674UL, 1165714541UL, 2210258428UL, 2825634835UL, 101928462UL, +477629709UL, 4257022506UL, 2679409844UL, 2576087732UL, 736533968UL, 2543083137UL, 3430523686UL, 1122549807UL, 3056925798UL, 341993500UL, 406782950UL, 1770032304UL, 2617760292UL, 1321359723UL, 2901696227UL, 1890958265UL, 3610842776UL, 2666109620UL, 1564088598UL, 914173231UL, 3734092059UL, 1652333721UL, 3456779008UL, 329706426UL, 1022239203UL, 1832393502UL, 4064995802UL, 4006865520UL, 1046436763UL, 366391010UL, 2237068647UL, 2887356463UL, +1479646555UL, 3969799795UL, 2565473087UL, 1149521056UL, 3529037691UL, 2379195579UL, 3758124054UL, 1467331930UL, 3988027050UL, 2771962200UL, 1796797949UL, 836545831UL, 2227515435UL, 236831608UL, 2872772569UL, 544017308UL, 3439193753UL, 2883791516UL, 4170143763UL, 126418114UL, 3811390247UL, 1648940583UL, 2933346767UL, 639483386UL, 1532399845UL, 4165970043UL, 2470139222UL, 2376371063UL, 3398508789UL, 3828295651UL, 4066952157UL, 2997263135UL, +4206759111UL, 1266176088UL, 3210273687UL, 560560354UL, 2416600665UL, 874477513UL, 2304714957UL, 629309008UL, 2010844440UL, 2586542760UL, 3490241985UL, 3355968243UL, 2304043871UL, 855615381UL, 452934545UL, 2408437363UL, 1433161037UL, 3245468546UL, 3813880871UL, 2244403710UL, 1966342448UL, 3092333073UL, 1861880941UL, 3334256651UL, 2774994234UL, 2526395471UL, 1884691351UL, 2145882162UL, 3500193798UL, 2303702146UL, 1154858044UL, 1643256991UL, +3172857504UL, 3480843206UL, 130979316UL, 799826424UL, 3094672168UL, 3535834360UL, 915442396UL, 935499492UL, 520495112UL, 575315345UL, 3823364867UL, 2876158574UL, 2272973265UL, 310789314UL, 4207205257UL, 553462404UL, 2184663001UL, 2613016888UL, 3863565851UL, 874197736UL, 3329267685UL, 3447734684UL, 4106984978UL, 1780200631UL, 4088289456UL, 3323217870UL, 2748493470UL, 1559861146UL, 990374143UL, 2080149357UL, 4047813631UL, 2728282767UL, +1133329900UL, 2145680301UL, 2328411541UL, 1572704242UL, 3396987326UL, 63633520UL, 2046317220UL, 4021497634UL, 1385163990UL, 1582181054UL, 1762959503UL, 581690993UL, 3172043012UL, 628071512UL, 2790170929UL, 3726073981UL, 2847267504UL, 3408334906UL, 3352976111UL, 1211075015UL, 3817450114UL, 2811957324UL, 3578703606UL, 1126685543UL, 1946225412UL, 2749086326UL, 2802110464UL, 2391618856UL, 3031260674UL, 453222948UL, 2210258428UL, 2825634835UL, +101928462UL, 477629709UL, 410621659UL, 2679409844UL, 2576087732UL, 736533968UL, 2543083137UL, 1101977922UL, 1122549807UL, 3056925798UL, 341993500UL, 406782950UL, 3057489804UL, 2617760292UL, 1321359723UL, 2901696227UL, 1890958265UL, 4035843698UL, 2666109620UL, 1564088598UL, 914173231UL, 3734092059UL, 908525903UL, 3456779008UL, 329706426UL, 1022239203UL, 1832393502UL, 4024857205UL, 4006865520UL, 1046436763UL, 366391010UL, 2237068647UL, +1564059380UL, 1479646555UL, 3969799795UL, 2565473087UL, 1149521056UL, 2808155917UL, 2379195579UL, 3758124054UL, 1467331930UL, 3988027050UL, 810008243UL, 1796797949UL, 836545831UL, 2227515435UL, 236831608UL, 608273331UL, 544017308UL, 3439193753UL, 2883791516UL, 4170143763UL, 3309288977UL, 3811390247UL, 1648940583UL, 2933346767UL, 639483386UL, 1685761277UL, 4165970043UL, 2470139222UL, 2376371063UL, 3398508789UL, 4275493636UL, 4066952157UL, +2997263135UL, 4206759111UL, 1266176088UL, 333592630UL, 560560354UL, 2416600665UL, 874477513UL, 2304714957UL, 1438974661UL, 2010844440UL, 2586542760UL, 3490241985UL, 3355968243UL, 2556368068UL, 855615381UL, 452934545UL, 2408437363UL, 1433161037UL, 4061232080UL, 3813880871UL, 2244403710UL, 1966342448UL, 3092333073UL, 3412770364UL, 3334256651UL, 2774994234UL, 2526395471UL, 1884691351UL, 1414627588UL, 3500193798UL, 2303702146UL, 1154858044UL, +1643256991UL, 2245958719UL, 3480843206UL, 130979316UL, 799826424UL, 3094672168UL, 2214560871UL, 915442396UL, 935499492UL, 520495112UL, 575315345UL, 3894763683UL, 2876158574UL, 2272973265UL, 310789314UL, 4207205257UL, 3203740771UL, 2184663001UL, 2613016888UL, 3863565851UL, 874197736UL, 3371653768UL, 3447734684UL, 4106984978UL, 1780200631UL, 4088289456UL, 378312754UL, 2748493470UL, 1559861146UL, 990374143UL, 2080149357UL, 554816113UL, +2728282767UL, 1133329900UL, 2145680301UL, 2328411541UL, 4249979994UL, 3396987326UL, 63633520UL, 2046317220UL, 4021497634UL, 4185731269UL, 1582181054UL, 1762959503UL, 581690993UL, 3172043012UL, 3142596028UL, 2790170929UL, 3726073981UL, 2847267504UL, 3408334906UL, 2556911142UL, 1211075015UL, 3817450114UL, 2811957324UL, 3578703606UL, 1480672978UL, 1946225412UL, 2749086326UL, 2802110464UL, 2391618856UL, 3986823297UL, 453222948UL, 2210258428UL, +2825634835UL, 101928462UL, 26373721UL, 410621659UL, 2679409844UL, 2576087732UL, 736533968UL, 888001208UL, 1101977922UL, 1122549807UL, 3056925798UL, 341993500UL, 3243663736UL, 3057489804UL, 2617760292UL, 1321359723UL, 2901696227UL, 1652018736UL, 4035843698UL, 2666109620UL, 1564088598UL, 914173231UL, 1857869366UL, 908525903UL, 3456779008UL, 329706426UL, 1022239203UL, 2622178179UL, 4024857205UL, 4006865520UL, 1046436763UL, 366391010UL, +3722250905UL, 2880126367UL, 4102186560UL, 1642831571UL, 2222486636UL, 2572764729UL, 2046028516UL, 3507603612UL, 1703451134UL, 89818497UL, 1961701523UL, 3704300476UL, 3563143931UL, 1609575644UL, 1599081111UL, 1047838539UL, 2779312926UL, 2065354728UL, 956677756UL, 2073145924UL, 726634994UL, 119064196UL, 2046275296UL, 2105141632UL, 1023267361UL, 1204528080UL, 623740611UL, 1419328884UL, 933734693UL, 2030900835UL, 2556538268UL, 1672647866UL, +3125658368UL, 2221217376UL, 1097330641UL, 3214790630UL, 4276041578UL, 2397216525UL, 3916900004UL, 330223096UL, 3915966823UL, 2646760259UL, 1724289351UL, 4015221358UL, 2338587000UL, 110922222UL, 2314933196UL, 4026908935UL, 3272487985UL, 2685115305UL, 84271650UL, 731354215UL, 2358136447UL, 1069348214UL, 2676811333UL, 1386266810UL, 1364512901UL, 4154449904UL, 3469122709UL, 54276972UL, 560967905UL, 2363475740UL, 331250049UL, 3024074455UL, +186605617UL, 389582566UL, 1258386782UL, 703909543UL, 3968367083UL, 1553533794UL, 3699576213UL, 1145761343UL, 921983735UL, 3573813763UL, 1280477631UL, 3365842435UL, 1618458494UL, 2621328991UL, 1534006198UL, 2307669227UL, 4192335609UL, 1338050203UL, 785284052UL, 4227164890UL, 2874735332UL, 3655821191UL, 2911684671UL, 3266454200UL, 2679968625UL, 1191162601UL, 456550349UL, 1143881236UL, 3560103440UL, 2253437876UL, 3683014001UL, 1087142366UL, +1462192975UL, 1076595768UL, 3227872159UL, 1842092988UL, 148227073UL, 3812110998UL, 1317300278UL, 3068446245UL, 3376284001UL, 3164402992UL, 2730404635UL, 2848239579UL, 3008959791UL, 2901849226UL, 1234485739UL, 869158554UL, 245101118UL, 1724974650UL, 3851803199UL, 922411232UL, 3046280696UL, 3284392523UL, 3528264590UL, 2802364078UL, 381450957UL, 1741009694UL, 4222244451UL, 102929888UL, 1668474417UL, 3881791214UL, 1429483134UL, 1938365051UL, +1023690708UL, 3333855520UL, 3238705869UL, 2602245525UL, 3059586169UL, 720438965UL, 2120786297UL, 453980990UL, 1048501876UL, 4060576583UL, 3537810796UL, 3892882814UL, 691572481UL, 3899584121UL, 1582529013UL, 3260326865UL, 2358704826UL, 1607030801UL, 1035900449UL, 3442507859UL, 1406737127UL, 249758705UL, 1535363329UL, 893329207UL, 51912312UL, 3440532856UL, 3736385218UL, 295452658UL, 2379709553UL, 1647382020UL, 2363679860UL, 2998779887UL, +}, +{ +4209102573UL, 2387104994UL, 1221484586UL, 1726143957UL, 3263877318UL, 3362559187UL, 282442925UL, 2418524976UL, 3196072648UL, 3174695999UL, 2072047145UL, 2985823503UL, 2132951745UL, 2298545297UL, 2495977670UL, 1397656146UL, 2086257884UL, 3834366725UL, 3862532368UL, 3583329522UL, 1543996818UL, 2192688115UL, 3081427696UL, 2656520743UL, 8772004UL, 2476324234UL, 3600148050UL, 1168683794UL, 3219143568UL, 108768238UL, 1339513738UL, 447593731UL, +2742877256UL, 2488536667UL, 4189834432UL, 808657962UL, 2422880287UL, 390864786UL, 3381554683UL, 760628048UL, 353395922UL, 3577556262UL, 2482413928UL, 507756643UL, 839344953UL, 3505184848UL, 3945044582UL, 2414915836UL, 2313624497UL, 1832728088UL, 2036999647UL, 1369090013UL, 3264575895UL, 1096327239UL, 3483440128UL, 3999302048UL, 2761563885UL, 2882627112UL, 3126073009UL, 1749658776UL, 3152482044UL, 3040022505UL, 3249451214UL, 2933713956UL, +2861715096UL, 1314806730UL, 932941454UL, 4276317539UL, 343449784UL, 1913556027UL, 1493892363UL, 2539517630UL, 2046391233UL, 3046108187UL, 28742917UL, 4009448584UL, 530945117UL, 3165875131UL, 1018448712UL, 110256395UL, 3550192264UL, 1279873435UL, 2276349621UL, 517650895UL, 1957973772UL, 619869608UL, 4260458157UL, 2281748739UL, 2489253174UL, 2220997989UL, 3787481606UL, 508630251UL, 3761850170UL, 3992979014UL, 2298047038UL, 3506428315UL, +1279341556UL, 3293496518UL, 1313470495UL, 1021100687UL, 3113171268UL, 798494760UL, 2981622008UL, 4152623583UL, 576409629UL, 2312811213UL, 992326282UL, 261645450UL, 1818084365UL, 3357150904UL, 144093UL, 1937589359UL, 2016990596UL, 4273422066UL, 588267732UL, 3592151118UL, 3846596932UL, 1198111464UL, 944363907UL, 1288613766UL, 1707163456UL, 4020906747UL, 1161127694UL, 2303844076UL, 2632591611UL, 3877442490UL, 2453788473UL, 1725876694UL, +1193989740UL, 2650581453UL, 1937459187UL, 361099994UL, 3566745727UL, 3658112707UL, 3612317412UL, 2684702277UL, 2880928862UL, 2044313931UL, 1866044828UL, 3528429465UL, 130421713UL, 2658878825UL, 1566180833UL, 1572228417UL, 531947625UL, 3774861000UL, 1894712110UL, 1319199233UL, 865634052UL, 2602102379UL, 3389730171UL, 3878969250UL, 107983959UL, 1601930856UL, 2511728925UL, 2146946013UL, 497511195UL, 720616881UL, 699892123UL, 2404505137UL, +2656498433UL, 4209102573UL, 2387104994UL, 1221484586UL, 1726143957UL, 1267363185UL, 3362559187UL, 282442925UL, 2418524976UL, 3196072648UL, 2942944206UL, 2072047145UL, 2985823503UL, 2132951745UL, 2298545297UL, 4079341490UL, 1397656146UL, 2086257884UL, 3834366725UL, 3862532368UL, 3991197972UL, 1543996818UL, 2192688115UL, 3081427696UL, 2656520743UL, 825853576UL, 2476324234UL, 3600148050UL, 1168683794UL, 3219143568UL, 528751585UL, 1339513738UL, +447593731UL, 2742877256UL, 2488536667UL, 4025362081UL, 808657962UL, 2422880287UL, 390864786UL, 3381554683UL, 2682225618UL, 353395922UL, 3577556262UL, 2482413928UL, 507756643UL, 3979211244UL, 3505184848UL, 3945044582UL, 2414915836UL, 2313624497UL, 1841224078UL, 2036999647UL, 1369090013UL, 3264575895UL, 1096327239UL, 607843308UL, 3999302048UL, 2761563885UL, 2882627112UL, 3126073009UL, 1241524975UL, 3152482044UL, 3040022505UL, 3249451214UL, +2933713956UL, 420486142UL, 1314806730UL, 932941454UL, 4276317539UL, 343449784UL, 2231505736UL, 1493892363UL, 2539517630UL, 2046391233UL, 3046108187UL, 2351652097UL, 4009448584UL, 530945117UL, 3165875131UL, 1018448712UL, 1683392491UL, 3550192264UL, 1279873435UL, 2276349621UL, 517650895UL, 4036312766UL, 619869608UL, 4260458157UL, 2281748739UL, 2489253174UL, 1686790154UL, 3787481606UL, 508630251UL, 3761850170UL, 3992979014UL, 1745325013UL, +3506428315UL, 1279341556UL, 3293496518UL, 1313470495UL, 3066312306UL, 3113171268UL, 798494760UL, 2981622008UL, 4152623583UL, 3871822467UL, 2312811213UL, 992326282UL, 261645450UL, 1818084365UL, 3681154045UL, 144093UL, 1937589359UL, 2016990596UL, 4273422066UL, 2361898985UL, 3592151118UL, 3846596932UL, 1198111464UL, 944363907UL, 2866279694UL, 1707163456UL, 4020906747UL, 1161127694UL, 2303844076UL, 3044280908UL, 3877442490UL, 2453788473UL, +1725876694UL, 1193989740UL, 2049617934UL, 1937459187UL, 361099994UL, 3566745727UL, 3658112707UL, 934740227UL, 2684702277UL, 2880928862UL, 2044313931UL, 1866044828UL, 1814569183UL, 130421713UL, 2658878825UL, 1566180833UL, 1572228417UL, 1784679035UL, 3774861000UL, 1894712110UL, 1319199233UL, 865634052UL, 283642947UL, 3389730171UL, 3878969250UL, 107983959UL, 1601930856UL, 3698217362UL, 2146946013UL, 497511195UL, 720616881UL, 699892123UL, +2117385156UL, 2656498433UL, 4209102573UL, 2387104994UL, 1221484586UL, 3495886368UL, 1267363185UL, 3362559187UL, 282442925UL, 2418524976UL, 3489510655UL, 2942944206UL, 2072047145UL, 2985823503UL, 2132951745UL, 885541635UL, 4079341490UL, 1397656146UL, 2086257884UL, 3834366725UL, 1049969755UL, 3991197972UL, 1543996818UL, 2192688115UL, 3081427696UL, 2141948440UL, 825853576UL, 2476324234UL, 3600148050UL, 1168683794UL, 5160254UL, 528751585UL, +1339513738UL, 447593731UL, 2742877256UL, 3033397497UL, 4025362081UL, 808657962UL, 2422880287UL, 390864786UL, 3191593886UL, 2682225618UL, 353395922UL, 3577556262UL, 2482413928UL, 1185107868UL, 3979211244UL, 3505184848UL, 3945044582UL, 2414915836UL, 3030493909UL, 1841224078UL, 2036999647UL, 1369090013UL, 3264575895UL, 3054343366UL, 607843308UL, 3999302048UL, 2761563885UL, 2882627112UL, 3912854189UL, 1241524975UL, 3152482044UL, 3040022505UL, +3249451214UL, 55140065UL, 420486142UL, 1314806730UL, 932941454UL, 4276317539UL, 1055315026UL, 2231505736UL, 1493892363UL, 2539517630UL, 2046391233UL, 4174985470UL, 2351652097UL, 4009448584UL, 530945117UL, 3165875131UL, 2168411768UL, 1683392491UL, 3550192264UL, 1279873435UL, 2276349621UL, 1875092822UL, 4036312766UL, 619869608UL, 4260458157UL, 2281748739UL, 98823023UL, 1686790154UL, 3787481606UL, 508630251UL, 3761850170UL, 2636025017UL, +1745325013UL, 3506428315UL, 1279341556UL, 3293496518UL, 978338993UL, 3066312306UL, 3113171268UL, 798494760UL, 2981622008UL, 2712384846UL, 3871822467UL, 2312811213UL, 992326282UL, 261645450UL, 66982935UL, 3681154045UL, 144093UL, 1937589359UL, 2016990596UL, 3390191329UL, 2361898985UL, 3592151118UL, 3846596932UL, 1198111464UL, 1857959320UL, 2866279694UL, 1707163456UL, 4020906747UL, 1161127694UL, 913091437UL, 3044280908UL, 3877442490UL, +2453788473UL, 1725876694UL, 4254455215UL, 2049617934UL, 1937459187UL, 361099994UL, 3566745727UL, 2914687409UL, 934740227UL, 2684702277UL, 2880928862UL, 2044313931UL, 1515195925UL, 1814569183UL, 130421713UL, 2658878825UL, 1566180833UL, 2753417020UL, 1784679035UL, 3774861000UL, 1894712110UL, 1319199233UL, 287161774UL, 283642947UL, 3389730171UL, 3878969250UL, 107983959UL, 3057929912UL, 3698217362UL, 2146946013UL, 497511195UL, 720616881UL, +3570251850UL, 2117385156UL, 2656498433UL, 4209102573UL, 2387104994UL, 2940868252UL, 3495886368UL, 1267363185UL, 3362559187UL, 282442925UL, 2510419746UL, 3489510655UL, 2942944206UL, 2072047145UL, 2985823503UL, 978430777UL, 885541635UL, 4079341490UL, 1397656146UL, 2086257884UL, 134380865UL, 1049969755UL, 3991197972UL, 1543996818UL, 2192688115UL, 1205081471UL, 2141948440UL, 825853576UL, 2476324234UL, 3600148050UL, 228461601UL, 5160254UL, +528751585UL, 1339513738UL, 447593731UL, 2852356745UL, 3033397497UL, 4025362081UL, 808657962UL, 2422880287UL, 3287655095UL, 3191593886UL, 2682225618UL, 353395922UL, 3577556262UL, 2542841784UL, 1185107868UL, 3979211244UL, 3505184848UL, 3945044582UL, 2905156498UL, 3030493909UL, 1841224078UL, 2036999647UL, 1369090013UL, 4246605417UL, 3054343366UL, 607843308UL, 3999302048UL, 2761563885UL, 3611911899UL, 3912854189UL, 1241524975UL, 3152482044UL, +3040022505UL, 3215633820UL, 55140065UL, 420486142UL, 1314806730UL, 932941454UL, 2708752494UL, 1055315026UL, 2231505736UL, 1493892363UL, 2539517630UL, 962728637UL, 4174985470UL, 2351652097UL, 4009448584UL, 530945117UL, 3370859357UL, 2168411768UL, 1683392491UL, 3550192264UL, 1279873435UL, 3028448904UL, 1875092822UL, 4036312766UL, 619869608UL, 4260458157UL, 199178828UL, 98823023UL, 1686790154UL, 3787481606UL, 508630251UL, 4205010983UL, +2636025017UL, 1745325013UL, 3506428315UL, 1279341556UL, 683127445UL, 978338993UL, 3066312306UL, 3113171268UL, 798494760UL, 2823693013UL, 2712384846UL, 3871822467UL, 2312811213UL, 992326282UL, 3701928286UL, 66982935UL, 3681154045UL, 144093UL, 1937589359UL, 1117717039UL, 3390191329UL, 2361898985UL, 3592151118UL, 3846596932UL, 1072660054UL, 1857959320UL, 2866279694UL, 1707163456UL, 4020906747UL, 2503116219UL, 913091437UL, 3044280908UL, +3877442490UL, 2453788473UL, 1815274499UL, 4254455215UL, 2049617934UL, 1937459187UL, 361099994UL, 3771108073UL, 2914687409UL, 934740227UL, 2684702277UL, 2880928862UL, 3591322975UL, 1515195925UL, 1814569183UL, 130421713UL, 2658878825UL, 354587729UL, 2753417020UL, 1784679035UL, 3774861000UL, 1894712110UL, 1799044969UL, 287161774UL, 283642947UL, 3389730171UL, 3878969250UL, 1229815186UL, 3057929912UL, 3698217362UL, 2146946013UL, 497511195UL, +3121882901UL, 426537369UL, 3852284416UL, 4050544256UL, 3148944089UL, 878474231UL, 1369575859UL, 2206199765UL, 870626886UL, 494668165UL, 613011290UL, 3246772867UL, 1040178461UL, 2396959353UL, 2105449571UL, 456758967UL, 4134137960UL, 3525051481UL, 3633445497UL, 2895048060UL, 2008411846UL, 2194012253UL, 2326112129UL, 2956901044UL, 2297039362UL, 3400824024UL, 42139718UL, 4212208866UL, 3874761488UL, 2361955811UL, 1890446075UL, 864533345UL, +474524842UL, 2283847731UL, 283971243UL, 3607219686UL, 280870706UL, 4188549522UL, 659660119UL, 2460943922UL, 4252134362UL, 922033031UL, 3615474721UL, 1691563300UL, 3002653770UL, 2414043617UL, 2251931324UL, 752654714UL, 4188343161UL, 305594960UL, 1320443323UL, 797027061UL, 2347530104UL, 3608843538UL, 2717312892UL, 1841295453UL, 1574467161UL, 823626340UL, 2244853583UL, 2648217758UL, 141742826UL, 1605436472UL, 745763543UL, 3275460028UL, +3166960370UL, 2655678693UL, 3964037210UL, 945054703UL, 998173049UL, 1014527437UL, 3424443612UL, 281835352UL, 826817508UL, 260462513UL, 2849967970UL, 3447294061UL, 3670173947UL, 2430650055UL, 4134905457UL, 3798172627UL, 2156572681UL, 2600148034UL, 2773013892UL, 3290397106UL, 1740507705UL, 3450254627UL, 3613087060UL, 440045928UL, 1230555006UL, 980805434UL, 2107958250UL, 526555374UL, 3150741277UL, 4283672024UL, 193019043UL, 786035243UL, +3002832578UL, 3938336183UL, 4209865002UL, 1005950967UL, 3533346582UL, 3196886974UL, 83962845UL, 1882902787UL, 3595687446UL, 2927597311UL, 2728550762UL, 2750900392UL, 1474254316UL, 1509832112UL, 1763262792UL, 2706181276UL, 538294991UL, 353565565UL, 18133995UL, 1719731406UL, 3311085516UL, 2018821960UL, 300367686UL, 2628312935UL, 1151449661UL, 2178805970UL, 3288321196UL, 535051857UL, 1623270973UL, 2761151808UL, 2701048972UL, 317681607UL, +2281427601UL, 719748170UL, 351452298UL, 2191958596UL, 4000232015UL, 335837771UL, 4158081521UL, 3779404077UL, 1998444133UL, 3849605095UL, 1532231791UL, 2930266419UL, 4203951289UL, 748423654UL, 1993082867UL, 451159852UL, 488781053UL, 2438982775UL, 2222815270UL, 543209242UL, 1241562465UL, 2868868009UL, 4201052877UL, 2438841764UL, 2151708682UL, 2426958921UL, 1520654642UL, 1990098337UL, 1070792755UL, 2308394635UL, 1442389785UL, 705615044UL, +}, +{ +973368008UL, 1221885324UL, 2086331970UL, 2323744198UL, 280145759UL, 1795442656UL, 2984366093UL, 3532172763UL, 323888669UL, 851950179UL, 4198638255UL, 899943985UL, 4087912561UL, 2935341503UL, 1443752852UL, 3991058999UL, 3547259355UL, 35779889UL, 1076308344UL, 4075444807UL, 186174448UL, 3542284780UL, 660388677UL, 2777400132UL, 1092226205UL, 2418702276UL, 1307933032UL, 1940510003UL, 1932005362UL, 4016036211UL, 387339882UL, 2969593895UL, +3453134349UL, 1382709098UL, 1795814140UL, 1588159469UL, 1216733801UL, 2227378121UL, 2063027627UL, 582454582UL, 3364657275UL, 3466973302UL, 484564303UL, 1489261596UL, 2270291560UL, 2008178784UL, 2284268924UL, 2229317366UL, 644797709UL, 1213921542UL, 99331403UL, 3027640949UL, 1137722852UL, 2991506109UL, 1432805987UL, 931795812UL, 1075567424UL, 28963219UL, 1462245461UL, 3781444706UL, 521233400UL, 1891915904UL, 3774338085UL, 1635359313UL, +2356111795UL, 4121073768UL, 1045110727UL, 2822507066UL, 1087914587UL, 3744509525UL, 911370656UL, 181884066UL, 1944539735UL, 290356444UL, 3598887471UL, 4236934380UL, 3224468239UL, 457546246UL, 4119337570UL, 37700432UL, 655783844UL, 1423101410UL, 1693002969UL, 3287768267UL, 928748421UL, 4074128009UL, 3081088543UL, 2882833790UL, 3180154875UL, 1094657682UL, 2388253717UL, 4173455215UL, 794709427UL, 3363292346UL, 67786868UL, 3786597763UL, +380587236UL, 2345941620UL, 560232318UL, 2137123833UL, 619747082UL, 1050293267UL, 2537845069UL, 1407302835UL, 433399526UL, 1083185007UL, 1893842085UL, 3711748584UL, 4225838280UL, 3863317129UL, 2043467942UL, 2799650657UL, 3590486611UL, 1231938950UL, 215905995UL, 155811669UL, 806806587UL, 2732631168UL, 1621659281UL, 632403616UL, 401165422UL, 2661074778UL, 4156963191UL, 3691812937UL, 3767271627UL, 2834948318UL, 2877210497UL, 2420260153UL, +733172233UL, 1771708940UL, 3102718549UL, 2468707423UL, 1857088312UL, 3176535032UL, 1908570295UL, 3966666208UL, 605079895UL, 2982506620UL, 3721694730UL, 1640691570UL, 3764975545UL, 3257514114UL, 1826578604UL, 1358557411UL, 4049610348UL, 615820785UL, 3355718142UL, 1734641780UL, 2958744617UL, 274522187UL, 3198436002UL, 4077346785UL, 2890101344UL, 4012464346UL, 1288365365UL, 96583076UL, 2656389382UL, 1858181040UL, 2717010340UL, 2032153178UL, +349324012UL, 973368008UL, 1221885324UL, 2086331970UL, 2323744198UL, 253685576UL, 1795442656UL, 2984366093UL, 3532172763UL, 323888669UL, 248935329UL, 4198638255UL, 899943985UL, 4087912561UL, 2935341503UL, 3213394756UL, 3991058999UL, 3547259355UL, 35779889UL, 1076308344UL, 1987715385UL, 186174448UL, 3542284780UL, 660388677UL, 2777400132UL, 2071022105UL, 2418702276UL, 1307933032UL, 1940510003UL, 1932005362UL, 144370664UL, 387339882UL, +2969593895UL, 3453134349UL, 1382709098UL, 2394736611UL, 1588159469UL, 1216733801UL, 2227378121UL, 2063027627UL, 4064263898UL, 3364657275UL, 3466973302UL, 484564303UL, 1489261596UL, 3405101812UL, 2008178784UL, 2284268924UL, 2229317366UL, 644797709UL, 2560273821UL, 99331403UL, 3027640949UL, 1137722852UL, 2991506109UL, 1446442417UL, 931795812UL, 1075567424UL, 28963219UL, 1462245461UL, 1201513613UL, 521233400UL, 1891915904UL, 3774338085UL, +1635359313UL, 2815447944UL, 4121073768UL, 1045110727UL, 2822507066UL, 1087914587UL, 2485035329UL, 911370656UL, 181884066UL, 1944539735UL, 290356444UL, 2078819341UL, 4236934380UL, 3224468239UL, 457546246UL, 4119337570UL, 2666895496UL, 655783844UL, 1423101410UL, 1693002969UL, 3287768267UL, 3595439673UL, 4074128009UL, 3081088543UL, 2882833790UL, 3180154875UL, 872453917UL, 2388253717UL, 4173455215UL, 794709427UL, 3363292346UL, 4188764388UL, +3786597763UL, 380587236UL, 2345941620UL, 560232318UL, 625538006UL, 619747082UL, 1050293267UL, 2537845069UL, 1407302835UL, 2128289331UL, 1083185007UL, 1893842085UL, 3711748584UL, 4225838280UL, 2486133065UL, 2043467942UL, 2799650657UL, 3590486611UL, 1231938950UL, 928582681UL, 155811669UL, 806806587UL, 2732631168UL, 1621659281UL, 1163969880UL, 401165422UL, 2661074778UL, 4156963191UL, 3691812937UL, 2322579561UL, 2834948318UL, 2877210497UL, +2420260153UL, 733172233UL, 170239236UL, 3102718549UL, 2468707423UL, 1857088312UL, 3176535032UL, 3868693408UL, 3966666208UL, 605079895UL, 2982506620UL, 3721694730UL, 2066859537UL, 3764975545UL, 3257514114UL, 1826578604UL, 1358557411UL, 2964604045UL, 615820785UL, 3355718142UL, 1734641780UL, 2958744617UL, 4091225681UL, 3198436002UL, 4077346785UL, 2890101344UL, 4012464346UL, 2612861218UL, 96583076UL, 2656389382UL, 1858181040UL, 2717010340UL, +3639170895UL, 349324012UL, 973368008UL, 1221885324UL, 2086331970UL, 2258432445UL, 253685576UL, 1795442656UL, 2984366093UL, 3532172763UL, 3831166882UL, 248935329UL, 4198638255UL, 899943985UL, 4087912561UL, 715173523UL, 3213394756UL, 3991058999UL, 3547259355UL, 35779889UL, 2393072396UL, 1987715385UL, 186174448UL, 3542284780UL, 660388677UL, 3731857267UL, 2071022105UL, 2418702276UL, 1307933032UL, 1940510003UL, 4262274779UL, 144370664UL, +387339882UL, 2969593895UL, 3453134349UL, 1923698215UL, 2394736611UL, 1588159469UL, 1216733801UL, 2227378121UL, 2907069566UL, 4064263898UL, 3364657275UL, 3466973302UL, 484564303UL, 2234542580UL, 3405101812UL, 2008178784UL, 2284268924UL, 2229317366UL, 1349323372UL, 2560273821UL, 99331403UL, 3027640949UL, 1137722852UL, 4200786664UL, 1446442417UL, 931795812UL, 1075567424UL, 28963219UL, 1659632304UL, 1201513613UL, 521233400UL, 1891915904UL, +3774338085UL, 763590809UL, 2815447944UL, 4121073768UL, 1045110727UL, 2822507066UL, 4131040734UL, 2485035329UL, 911370656UL, 181884066UL, 1944539735UL, 4104473807UL, 2078819341UL, 4236934380UL, 3224468239UL, 457546246UL, 1241850776UL, 2666895496UL, 655783844UL, 1423101410UL, 1693002969UL, 2025898966UL, 3595439673UL, 4074128009UL, 3081088543UL, 2882833790UL, 218474476UL, 872453917UL, 2388253717UL, 4173455215UL, 794709427UL, 250328312UL, +4188764388UL, 3786597763UL, 380587236UL, 2345941620UL, 1937652040UL, 625538006UL, 619747082UL, 1050293267UL, 2537845069UL, 1140055765UL, 2128289331UL, 1083185007UL, 1893842085UL, 3711748584UL, 2298055548UL, 2486133065UL, 2043467942UL, 2799650657UL, 3590486611UL, 1235949580UL, 928582681UL, 155811669UL, 806806587UL, 2732631168UL, 4046198728UL, 1163969880UL, 401165422UL, 2661074778UL, 4156963191UL, 2003518762UL, 2322579561UL, 2834948318UL, +2877210497UL, 2420260153UL, 326741418UL, 170239236UL, 3102718549UL, 2468707423UL, 1857088312UL, 3936056808UL, 3868693408UL, 3966666208UL, 605079895UL, 2982506620UL, 2354705582UL, 2066859537UL, 3764975545UL, 3257514114UL, 1826578604UL, 3017501686UL, 2964604045UL, 615820785UL, 3355718142UL, 1734641780UL, 1681548103UL, 4091225681UL, 3198436002UL, 4077346785UL, 2890101344UL, 416470693UL, 2612861218UL, 96583076UL, 2656389382UL, 1858181040UL, +3104217288UL, 3639170895UL, 349324012UL, 973368008UL, 1221885324UL, 601524567UL, 2258432445UL, 253685576UL, 1795442656UL, 2984366093UL, 1875491903UL, 3831166882UL, 248935329UL, 4198638255UL, 899943985UL, 2182697927UL, 715173523UL, 3213394756UL, 3991058999UL, 3547259355UL, 1472237612UL, 2393072396UL, 1987715385UL, 186174448UL, 3542284780UL, 2160848139UL, 3731857267UL, 2071022105UL, 2418702276UL, 1307933032UL, 3815354311UL, 4262274779UL, +144370664UL, 387339882UL, 2969593895UL, 4240850623UL, 1923698215UL, 2394736611UL, 1588159469UL, 1216733801UL, 322523795UL, 2907069566UL, 4064263898UL, 3364657275UL, 3466973302UL, 2920715858UL, 2234542580UL, 3405101812UL, 2008178784UL, 2284268924UL, 1936025139UL, 1349323372UL, 2560273821UL, 99331403UL, 3027640949UL, 859541953UL, 4200786664UL, 1446442417UL, 931795812UL, 1075567424UL, 1876635772UL, 1659632304UL, 1201513613UL, 521233400UL, +1891915904UL, 3949233865UL, 763590809UL, 2815447944UL, 4121073768UL, 1045110727UL, 2522258582UL, 4131040734UL, 2485035329UL, 911370656UL, 181884066UL, 2467886009UL, 4104473807UL, 2078819341UL, 4236934380UL, 3224468239UL, 603014155UL, 1241850776UL, 2666895496UL, 655783844UL, 1423101410UL, 673119756UL, 2025898966UL, 3595439673UL, 4074128009UL, 3081088543UL, 4100445818UL, 218474476UL, 872453917UL, 2388253717UL, 4173455215UL, 2395519424UL, +250328312UL, 4188764388UL, 3786597763UL, 380587236UL, 4292608797UL, 1937652040UL, 625538006UL, 619747082UL, 1050293267UL, 2989616803UL, 1140055765UL, 2128289331UL, 1083185007UL, 1893842085UL, 3313934002UL, 2298055548UL, 2486133065UL, 2043467942UL, 2799650657UL, 1804808801UL, 1235949580UL, 928582681UL, 155811669UL, 806806587UL, 2864892828UL, 4046198728UL, 1163969880UL, 401165422UL, 2661074778UL, 2946769376UL, 2003518762UL, 2322579561UL, +2834948318UL, 2877210497UL, 2647485275UL, 326741418UL, 170239236UL, 3102718549UL, 2468707423UL, 2520336801UL, 3936056808UL, 3868693408UL, 3966666208UL, 605079895UL, 2949706551UL, 2354705582UL, 2066859537UL, 3764975545UL, 3257514114UL, 495003693UL, 3017501686UL, 2964604045UL, 615820785UL, 3355718142UL, 3799230297UL, 1681548103UL, 4091225681UL, 3198436002UL, 4077346785UL, 258363842UL, 416470693UL, 2612861218UL, 96583076UL, 2656389382UL, +2198085634UL, 1607235362UL, 694172175UL, 4194347563UL, 2665732891UL, 3419430286UL, 597070176UL, 2749480905UL, 3937535348UL, 3639873850UL, 2050067843UL, 4045290683UL, 2964298196UL, 3631595287UL, 1409808193UL, 121765438UL, 2129412744UL, 2497437101UL, 2664102876UL, 1773441464UL, 1708052456UL, 2923764322UL, 3350385352UL, 1592204280UL, 1118221370UL, 3416016313UL, 116121364UL, 1179473397UL, 1497519022UL, 902569114UL, 3840281863UL, 2783662797UL, +1712084322UL, 1982884601UL, 3625797892UL, 4222938993UL, 3231134134UL, 3046745397UL, 446484563UL, 1133869192UL, 2622178726UL, 3881085862UL, 4012894217UL, 391734322UL, 2089696890UL, 1304197030UL, 2663978386UL, 1685998658UL, 4238620912UL, 448351665UL, 2724524045UL, 1038754164UL, 413586547UL, 3107681687UL, 1454664365UL, 3353731192UL, 128440996UL, 565817989UL, 127978294UL, 1043863326UL, 1747369107UL, 2772246481UL, 172569313UL, 2740699699UL, +3417082503UL, 2103702630UL, 2139566116UL, 1378864710UL, 2444170529UL, 3234220221UL, 3974870858UL, 1965162347UL, 956763257UL, 3932467825UL, 1077337271UL, 4084837149UL, 3699147465UL, 1882164226UL, 236113740UL, 3116302858UL, 2730529598UL, 3449804672UL, 4002370655UL, 2011573068UL, 1551746089UL, 3917496971UL, 2852603UL, 1682999535UL, 2764817908UL, 2489487254UL, 261936311UL, 3122421452UL, 1199382345UL, 2617247590UL, 1909026938UL, 3156073069UL, +1492533764UL, 97847107UL, 1260892586UL, 187242945UL, 1286471861UL, 1763024967UL, 127723419UL, 210606273UL, 228546401UL, 3249879676UL, 482069954UL, 383075106UL, 3263105259UL, 2242748676UL, 1105681409UL, 4033144425UL, 4017983282UL, 1670425353UL, 4040882785UL, 1780687273UL, 1405678015UL, 3076115981UL, 2713472488UL, 286336494UL, 3664225263UL, 502759060UL, 777620620UL, 635590826UL, 132236203UL, 1866406173UL, 1235046453UL, 2859554298UL, +121814656UL, 944976320UL, 1946494170UL, 2548097575UL, 415384946UL, 3934685646UL, 1507032178UL, 1383654007UL, 2906269630UL, 566005756UL, 3118733139UL, 2969075870UL, 1834096359UL, 3263358416UL, 1322979710UL, 904583023UL, 3582075094UL, 2298898632UL, 2491891941UL, 660351763UL, 2548592542UL, 3009200751UL, 2116595110UL, 2623212287UL, 4167133624UL, 196759529UL, 3038645579UL, 1769704552UL, 1713233322UL, 2127497999UL, 3849458221UL, 3769872265UL, +}, +{ +51082211UL, 3347503176UL, 3221768777UL, 2986163981UL, 3937460013UL, 1716372908UL, 4132024211UL, 3035957293UL, 1791036224UL, 4214815056UL, 1645540011UL, 2629793790UL, 3185505897UL, 1855718954UL, 495459467UL, 1728339314UL, 2318396341UL, 3396602050UL, 3273624616UL, 2625973148UL, 1762905939UL, 1706358553UL, 1088424264UL, 2764318930UL, 1026127380UL, 1128004134UL, 2724553694UL, 41981087UL, 2304966004UL, 1342745986UL, 3425554050UL, 3537673465UL, +752263676UL, 280905885UL, 929399589UL, 4090689526UL, 2141254732UL, 1469491656UL, 2593100469UL, 1096008340UL, 3316809312UL, 1698245188UL, 1656427920UL, 3081873338UL, 1750515301UL, 3850483440UL, 4081834419UL, 1225164947UL, 1244139942UL, 1972663124UL, 116832506UL, 3097397897UL, 961156503UL, 1899056660UL, 1659173175UL, 1890464921UL, 1891872926UL, 191259956UL, 1735304734UL, 4246751855UL, 4285601625UL, 1495519933UL, 3398829761UL, 997567482UL, +2277782972UL, 1286922996UL, 3120709698UL, 15569196UL, 191501283UL, 3916619528UL, 1552075789UL, 4259725643UL, 2837166910UL, 2231584792UL, 1912204495UL, 2597304083UL, 4147585653UL, 1021482843UL, 2003417305UL, 186794491UL, 3608172979UL, 1991038123UL, 97515853UL, 34341352UL, 4163491231UL, 1046079304UL, 4105813389UL, 3589099183UL, 3970004064UL, 3899560802UL, 4148331147UL, 2267137817UL, 85024486UL, 3019925981UL, 3069231953UL, 1563669137UL, +314080592UL, 2943111861UL, 2838243982UL, 726216848UL, 2621853102UL, 2355885175UL, 3359668856UL, 1111296541UL, 2330283124UL, 3626558972UL, 4290084148UL, 1632078UL, 1047440803UL, 1350377197UL, 2490578842UL, 2366345698UL, 1628128899UL, 860259543UL, 1937956234UL, 2833820527UL, 329818923UL, 648489148UL, 1791961202UL, 1652322723UL, 1513419073UL, 149629345UL, 2468961221UL, 3711837973UL, 2377333831UL, 1434755773UL, 3808719305UL, 2513270108UL, +2701064683UL, 3097011724UL, 303393137UL, 1346302239UL, 1852307302UL, 850106025UL, 2473124483UL, 2853497268UL, 3786573704UL, 2604101162UL, 1446573486UL, 506925220UL, 3138967488UL, 2973528682UL, 2752811123UL, 2890321579UL, 1037196362UL, 1335670403UL, 1560253777UL, 1437495434UL, 2700525242UL, 4259933972UL, 3870707795UL, 4141538580UL, 3375331039UL, 3081538601UL, 3129978494UL, 3689191993UL, 1933431212UL, 2196145886UL, 87814045UL, 878611347UL, +812542698UL, 51082211UL, 3347503176UL, 3221768777UL, 2986163981UL, 277257023UL, 1716372908UL, 4132024211UL, 3035957293UL, 1791036224UL, 2713916211UL, 1645540011UL, 2629793790UL, 3185505897UL, 1855718954UL, 3800150234UL, 1728339314UL, 2318396341UL, 3396602050UL, 3273624616UL, 2530282967UL, 1762905939UL, 1706358553UL, 1088424264UL, 2764318930UL, 4224669506UL, 1128004134UL, 2724553694UL, 41981087UL, 2304966004UL, 484289311UL, 3425554050UL, +3537673465UL, 752263676UL, 280905885UL, 657028134UL, 4090689526UL, 2141254732UL, 1469491656UL, 2593100469UL, 2089385540UL, 3316809312UL, 1698245188UL, 1656427920UL, 3081873338UL, 2750354264UL, 3850483440UL, 4081834419UL, 1225164947UL, 1244139942UL, 3432605739UL, 116832506UL, 3097397897UL, 961156503UL, 1899056660UL, 2234120716UL, 1890464921UL, 1891872926UL, 191259956UL, 1735304734UL, 125359575UL, 4285601625UL, 1495519933UL, 3398829761UL, +997567482UL, 4034254942UL, 1286922996UL, 3120709698UL, 15569196UL, 191501283UL, 2090684174UL, 1552075789UL, 4259725643UL, 2837166910UL, 2231584792UL, 3412758413UL, 2597304083UL, 4147585653UL, 1021482843UL, 2003417305UL, 2464533361UL, 3608172979UL, 1991038123UL, 97515853UL, 34341352UL, 2634732952UL, 1046079304UL, 4105813389UL, 3589099183UL, 3970004064UL, 4263828421UL, 4148331147UL, 2267137817UL, 85024486UL, 3019925981UL, 3229477751UL, +1563669137UL, 314080592UL, 2943111861UL, 2838243982UL, 1274664774UL, 2621853102UL, 2355885175UL, 3359668856UL, 1111296541UL, 1615234696UL, 3626558972UL, 4290084148UL, 1632078UL, 1047440803UL, 623898652UL, 2490578842UL, 2366345698UL, 1628128899UL, 860259543UL, 2097114662UL, 2833820527UL, 329818923UL, 648489148UL, 1791961202UL, 1730000077UL, 1513419073UL, 149629345UL, 2468961221UL, 3711837973UL, 3255238414UL, 1434755773UL, 3808719305UL, +2513270108UL, 2701064683UL, 1635042488UL, 303393137UL, 1346302239UL, 1852307302UL, 850106025UL, 3523245944UL, 2853497268UL, 3786573704UL, 2604101162UL, 1446573486UL, 1011238489UL, 3138967488UL, 2973528682UL, 2752811123UL, 2890321579UL, 1044586909UL, 1335670403UL, 1560253777UL, 1437495434UL, 2700525242UL, 608940900UL, 3870707795UL, 4141538580UL, 3375331039UL, 3081538601UL, 728626935UL, 3689191993UL, 1933431212UL, 2196145886UL, 87814045UL, +646732047UL, 812542698UL, 51082211UL, 3347503176UL, 3221768777UL, 1783601443UL, 277257023UL, 1716372908UL, 4132024211UL, 3035957293UL, 3363442238UL, 2713916211UL, 1645540011UL, 2629793790UL, 3185505897UL, 2066587565UL, 3800150234UL, 1728339314UL, 2318396341UL, 3396602050UL, 2279941522UL, 2530282967UL, 1762905939UL, 1706358553UL, 1088424264UL, 2989326347UL, 4224669506UL, 1128004134UL, 2724553694UL, 41981087UL, 2348931916UL, 484289311UL, +3425554050UL, 3537673465UL, 752263676UL, 3169550883UL, 657028134UL, 4090689526UL, 2141254732UL, 1469491656UL, 1152943917UL, 2089385540UL, 3316809312UL, 1698245188UL, 1656427920UL, 1808689833UL, 2750354264UL, 3850483440UL, 4081834419UL, 1225164947UL, 2422106046UL, 3432605739UL, 116832506UL, 3097397897UL, 961156503UL, 1581804167UL, 2234120716UL, 1890464921UL, 1891872926UL, 191259956UL, 4113708001UL, 125359575UL, 4285601625UL, 1495519933UL, +3398829761UL, 3473435310UL, 4034254942UL, 1286922996UL, 3120709698UL, 15569196UL, 3122200488UL, 2090684174UL, 1552075789UL, 4259725643UL, 2837166910UL, 2838170407UL, 3412758413UL, 2597304083UL, 4147585653UL, 1021482843UL, 954000150UL, 2464533361UL, 3608172979UL, 1991038123UL, 97515853UL, 3832321348UL, 2634732952UL, 1046079304UL, 4105813389UL, 3589099183UL, 1288675572UL, 4263828421UL, 4148331147UL, 2267137817UL, 85024486UL, 1080403742UL, +3229477751UL, 1563669137UL, 314080592UL, 2943111861UL, 3357655593UL, 1274664774UL, 2621853102UL, 2355885175UL, 3359668856UL, 3722440291UL, 1615234696UL, 3626558972UL, 4290084148UL, 1632078UL, 4263556325UL, 623898652UL, 2490578842UL, 2366345698UL, 1628128899UL, 3623136669UL, 2097114662UL, 2833820527UL, 329818923UL, 648489148UL, 592747007UL, 1730000077UL, 1513419073UL, 149629345UL, 2468961221UL, 3766709284UL, 3255238414UL, 1434755773UL, +3808719305UL, 2513270108UL, 1958651003UL, 1635042488UL, 303393137UL, 1346302239UL, 1852307302UL, 579487408UL, 3523245944UL, 2853497268UL, 3786573704UL, 2604101162UL, 4183724981UL, 1011238489UL, 3138967488UL, 2973528682UL, 2752811123UL, 3074709397UL, 1044586909UL, 1335670403UL, 1560253777UL, 1437495434UL, 1237099522UL, 608940900UL, 3870707795UL, 4141538580UL, 3375331039UL, 2032507604UL, 728626935UL, 3689191993UL, 1933431212UL, 2196145886UL, +4008131891UL, 646732047UL, 812542698UL, 51082211UL, 3347503176UL, 3622107037UL, 1783601443UL, 277257023UL, 1716372908UL, 4132024211UL, 1264285659UL, 3363442238UL, 2713916211UL, 1645540011UL, 2629793790UL, 2179309595UL, 2066587565UL, 3800150234UL, 1728339314UL, 2318396341UL, 580990822UL, 2279941522UL, 2530282967UL, 1762905939UL, 1706358553UL, 2826056883UL, 2989326347UL, 4224669506UL, 1128004134UL, 2724553694UL, 1486392636UL, 2348931916UL, +484289311UL, 3425554050UL, 3537673465UL, 2497657189UL, 3169550883UL, 657028134UL, 4090689526UL, 2141254732UL, 1019244016UL, 1152943917UL, 2089385540UL, 3316809312UL, 1698245188UL, 2921739456UL, 1808689833UL, 2750354264UL, 3850483440UL, 4081834419UL, 108425527UL, 2422106046UL, 3432605739UL, 116832506UL, 3097397897UL, 3902994002UL, 1581804167UL, 2234120716UL, 1890464921UL, 1891872926UL, 3428861050UL, 4113708001UL, 125359575UL, 4285601625UL, +1495519933UL, 3350053832UL, 3473435310UL, 4034254942UL, 1286922996UL, 3120709698UL, 2906201347UL, 3122200488UL, 2090684174UL, 1552075789UL, 4259725643UL, 1965598685UL, 2838170407UL, 3412758413UL, 2597304083UL, 4147585653UL, 3335631208UL, 954000150UL, 2464533361UL, 3608172979UL, 1991038123UL, 3788034599UL, 3832321348UL, 2634732952UL, 1046079304UL, 4105813389UL, 2362460804UL, 1288675572UL, 4263828421UL, 4148331147UL, 2267137817UL, 2767331798UL, +1080403742UL, 3229477751UL, 1563669137UL, 314080592UL, 1737897403UL, 3357655593UL, 1274664774UL, 2621853102UL, 2355885175UL, 57997639UL, 3722440291UL, 1615234696UL, 3626558972UL, 4290084148UL, 3703113369UL, 4263556325UL, 623898652UL, 2490578842UL, 2366345698UL, 73788443UL, 3623136669UL, 2097114662UL, 2833820527UL, 329818923UL, 253042650UL, 592747007UL, 1730000077UL, 1513419073UL, 149629345UL, 4248302934UL, 3766709284UL, 3255238414UL, +1434755773UL, 3808719305UL, 3698431827UL, 1958651003UL, 1635042488UL, 303393137UL, 1346302239UL, 3872433842UL, 579487408UL, 3523245944UL, 2853497268UL, 3786573704UL, 3459185849UL, 4183724981UL, 1011238489UL, 3138967488UL, 2973528682UL, 2605373899UL, 3074709397UL, 1044586909UL, 1335670403UL, 1560253777UL, 4069724875UL, 1237099522UL, 608940900UL, 3870707795UL, 4141538580UL, 2550307954UL, 2032507604UL, 728626935UL, 3689191993UL, 1933431212UL, +1177640824UL, 4168589688UL, 1361487780UL, 2649612520UL, 2181448948UL, 2176288560UL, 947907377UL, 3772487849UL, 2002599877UL, 3353450532UL, 2013145251UL, 2357912348UL, 2316997609UL, 2355480213UL, 255142205UL, 751273749UL, 4049362748UL, 1434168014UL, 2069693747UL, 6910933UL, 1352778547UL, 2413649875UL, 4238683558UL, 484497407UL, 522555106UL, 1848417180UL, 3001805499UL, 2264939603UL, 3606143565UL, 1782482647UL, 2955918436UL, 3471474379UL, +2814133839UL, 3779337475UL, 3522102195UL, 1551792178UL, 3742001759UL, 3433504551UL, 472918932UL, 3835854229UL, 4259163014UL, 4103952359UL, 1989474190UL, 1792448078UL, 1517735224UL, 1958036884UL, 2277922531UL, 2856192348UL, 4294188732UL, 2674247971UL, 643649427UL, 3847742408UL, 1512435795UL, 4236693554UL, 1749045838UL, 397093640UL, 2940663643UL, 4156440725UL, 188785143UL, 3894740830UL, 897618321UL, 3333498692UL, 1623924612UL, 4111607062UL, +2242558573UL, 1565861815UL, 1177957654UL, 4129621176UL, 2232443247UL, 3216995984UL, 3313294700UL, 791442469UL, 1782204490UL, 2452634246UL, 1288014576UL, 1347365377UL, 112254281UL, 2044140398UL, 2479591984UL, 3293701920UL, 1062335151UL, 1397230369UL, 2460086085UL, 2412349474UL, 1252633202UL, 3704541545UL, 2132499200UL, 2202058121UL, 1981543691UL, 2683673516UL, 1198109770UL, 4279157703UL, 2224504258UL, 2188868731UL, 769314834UL, 601313429UL, +3595357440UL, 561383123UL, 3444949507UL, 2127327734UL, 2865252582UL, 4181002098UL, 2408426518UL, 309361635UL, 2377703815UL, 1109219406UL, 406287309UL, 1750179098UL, 3619129839UL, 937928728UL, 884423945UL, 928407281UL, 4173634172UL, 1492070114UL, 2706943441UL, 1365883971UL, 3076484301UL, 744370087UL, 4004118884UL, 2199449568UL, 879458863UL, 3197725005UL, 3590586547UL, 59693002UL, 3614114662UL, 1499386564UL, 2914582708UL, 3751842429UL, +947438603UL, 1986129491UL, 3747112289UL, 833777768UL, 2231649410UL, 1841607849UL, 3526253103UL, 3797105813UL, 1291185911UL, 3188408549UL, 3311027691UL, 3983681758UL, 2246511800UL, 1271525377UL, 2996265908UL, 2396071405UL, 902427181UL, 164636454UL, 2459631341UL, 635349368UL, 463309029UL, 1409367654UL, 849052250UL, 3221786769UL, 2310288531UL, 2919204855UL, 1263130532UL, 1215722704UL, 3497322658UL, 2840687222UL, 2185004161UL, 1507335864UL, +}, +{ +2052557448UL, 2879065999UL, 22933757UL, 2160014758UL, 3736092460UL, 3556641619UL, 1350613766UL, 2107757927UL, 309323868UL, 3452852627UL, 3424626316UL, 545651740UL, 1935764720UL, 2349926457UL, 3546577033UL, 862046434UL, 167198649UL, 338290297UL, 1145807303UL, 1571276102UL, 883549156UL, 907871968UL, 638566313UL, 678764227UL, 3795356864UL, 3306095271UL, 1452688488UL, 621126888UL, 1838613968UL, 2054107827UL, 1785040579UL, 454879400UL, +1952849106UL, 1907701866UL, 1639495252UL, 1623968604UL, 2997422000UL, 2633878652UL, 1036670775UL, 2191465943UL, 3053533585UL, 1654709920UL, 1950620393UL, 4177745509UL, 1742007818UL, 2888573892UL, 2825965566UL, 1399790365UL, 1307674482UL, 310692416UL, 384880529UL, 3497622676UL, 1024664651UL, 1541456182UL, 1904670217UL, 1008618602UL, 2816673160UL, 684112698UL, 3332034744UL, 3646613828UL, 962627614UL, 3072103948UL, 3713153075UL, 476323310UL, +3243124597UL, 126319837UL, 2155412848UL, 228580793UL, 2142696490UL, 3442722759UL, 2689599232UL, 426191419UL, 3157759186UL, 100239709UL, 494534049UL, 1259677734UL, 2889209278UL, 1754641396UL, 1057778427UL, 2133253617UL, 1298500018UL, 3340348062UL, 3967049659UL, 2927469144UL, 1503854147UL, 2271956463UL, 3004309866UL, 260248338UL, 2570702480UL, 2067671015UL, 3168497089UL, 361311552UL, 2123195373UL, 2825457193UL, 2599488181UL, 507483626UL, +1201669979UL, 910763802UL, 4158584821UL, 3116016424UL, 3375736126UL, 2857697336UL, 3112473104UL, 2683465481UL, 1495348009UL, 681020485UL, 4044713962UL, 2443109893UL, 129994063UL, 1710251126UL, 820410567UL, 601527649UL, 1007603132UL, 2096580480UL, 1942768885UL, 1984297765UL, 1888157243UL, 960265104UL, 527990410UL, 1572910026UL, 1106822080UL, 1472807331UL, 2465011897UL, 3139401215UL, 3705452371UL, 393081842UL, 3826516196UL, 2576499701UL, +4130037087UL, 4155028170UL, 2188282304UL, 2949056849UL, 1138928618UL, 858751984UL, 3735375571UL, 496972334UL, 830265621UL, 1355757111UL, 909444416UL, 1337622259UL, 2616327935UL, 2337227347UL, 2139876075UL, 4269663356UL, 796316592UL, 1893005585UL, 3958551664UL, 1746456069UL, 2430709714UL, 4025417573UL, 3333292799UL, 1833607331UL, 3864559081UL, 3415700826UL, 3291421244UL, 1987321873UL, 1792851165UL, 505718946UL, 3755903648UL, 3351468604UL, +4035552813UL, 2052557448UL, 2879065999UL, 22933757UL, 2160014758UL, 2321387515UL, 3556641619UL, 1350613766UL, 2107757927UL, 309323868UL, 1850700415UL, 3424626316UL, 545651740UL, 1935764720UL, 2349926457UL, 979047283UL, 862046434UL, 167198649UL, 338290297UL, 1145807303UL, 4201635137UL, 883549156UL, 907871968UL, 638566313UL, 678764227UL, 2637527083UL, 3306095271UL, 1452688488UL, 621126888UL, 1838613968UL, 117966344UL, 1785040579UL, +454879400UL, 1952849106UL, 1907701866UL, 733998186UL, 1623968604UL, 2997422000UL, 2633878652UL, 1036670775UL, 3360491537UL, 3053533585UL, 1654709920UL, 1950620393UL, 4177745509UL, 1716078578UL, 2888573892UL, 2825965566UL, 1399790365UL, 1307674482UL, 2776111761UL, 384880529UL, 3497622676UL, 1024664651UL, 1541456182UL, 618916624UL, 1008618602UL, 2816673160UL, 684112698UL, 3332034744UL, 3340690804UL, 962627614UL, 3072103948UL, 3713153075UL, +476323310UL, 902990902UL, 126319837UL, 2155412848UL, 228580793UL, 2142696490UL, 4254301999UL, 2689599232UL, 426191419UL, 3157759186UL, 100239709UL, 3216403640UL, 1259677734UL, 2889209278UL, 1754641396UL, 1057778427UL, 3221479262UL, 1298500018UL, 3340348062UL, 3967049659UL, 2927469144UL, 3926654939UL, 2271956463UL, 3004309866UL, 260248338UL, 2570702480UL, 1879451653UL, 3168497089UL, 361311552UL, 2123195373UL, 2825457193UL, 341920668UL, +507483626UL, 1201669979UL, 910763802UL, 4158584821UL, 3748705813UL, 3375736126UL, 2857697336UL, 3112473104UL, 2683465481UL, 3336305747UL, 681020485UL, 4044713962UL, 2443109893UL, 129994063UL, 2578353596UL, 820410567UL, 601527649UL, 1007603132UL, 2096580480UL, 3155251071UL, 1984297765UL, 1888157243UL, 960265104UL, 527990410UL, 2548692624UL, 1106822080UL, 1472807331UL, 2465011897UL, 3139401215UL, 736629379UL, 393081842UL, 3826516196UL, +2576499701UL, 4130037087UL, 2440227627UL, 2188282304UL, 2949056849UL, 1138928618UL, 858751984UL, 191805249UL, 496972334UL, 830265621UL, 1355757111UL, 909444416UL, 396738554UL, 2616327935UL, 2337227347UL, 2139876075UL, 4269663356UL, 3932761947UL, 1893005585UL, 3958551664UL, 1746456069UL, 2430709714UL, 3171160829UL, 3333292799UL, 1833607331UL, 3864559081UL, 3415700826UL, 1332800826UL, 1987321873UL, 1792851165UL, 505718946UL, 3755903648UL, +1770588062UL, 4035552813UL, 2052557448UL, 2879065999UL, 22933757UL, 3159941473UL, 2321387515UL, 3556641619UL, 1350613766UL, 2107757927UL, 2669366188UL, 1850700415UL, 3424626316UL, 545651740UL, 1935764720UL, 3252475208UL, 979047283UL, 862046434UL, 167198649UL, 338290297UL, 771814471UL, 4201635137UL, 883549156UL, 907871968UL, 638566313UL, 184144160UL, 2637527083UL, 3306095271UL, 1452688488UL, 621126888UL, 4275587594UL, 117966344UL, +1785040579UL, 454879400UL, 1952849106UL, 3806424990UL, 733998186UL, 1623968604UL, 2997422000UL, 2633878652UL, 2670843077UL, 3360491537UL, 3053533585UL, 1654709920UL, 1950620393UL, 3541927406UL, 1716078578UL, 2888573892UL, 2825965566UL, 1399790365UL, 3184295779UL, 2776111761UL, 384880529UL, 3497622676UL, 1024664651UL, 723804135UL, 618916624UL, 1008618602UL, 2816673160UL, 684112698UL, 3275521308UL, 3340690804UL, 962627614UL, 3072103948UL, +3713153075UL, 2023106558UL, 902990902UL, 126319837UL, 2155412848UL, 228580793UL, 3978575748UL, 4254301999UL, 2689599232UL, 426191419UL, 3157759186UL, 2446138116UL, 3216403640UL, 1259677734UL, 2889209278UL, 1754641396UL, 1706032491UL, 3221479262UL, 1298500018UL, 3340348062UL, 3967049659UL, 3805001240UL, 3926654939UL, 2271956463UL, 3004309866UL, 260248338UL, 294480880UL, 1879451653UL, 3168497089UL, 361311552UL, 2123195373UL, 2080604411UL, +341920668UL, 507483626UL, 1201669979UL, 910763802UL, 2012149356UL, 3748705813UL, 3375736126UL, 2857697336UL, 3112473104UL, 2935748807UL, 3336305747UL, 681020485UL, 4044713962UL, 2443109893UL, 2862982895UL, 2578353596UL, 820410567UL, 601527649UL, 1007603132UL, 1890290066UL, 3155251071UL, 1984297765UL, 1888157243UL, 960265104UL, 41870487UL, 2548692624UL, 1106822080UL, 1472807331UL, 2465011897UL, 2382974023UL, 736629379UL, 393081842UL, +3826516196UL, 2576499701UL, 4219335149UL, 2440227627UL, 2188282304UL, 2949056849UL, 1138928618UL, 3785297102UL, 191805249UL, 496972334UL, 830265621UL, 1355757111UL, 3962907313UL, 396738554UL, 2616327935UL, 2337227347UL, 2139876075UL, 552154011UL, 3932761947UL, 1893005585UL, 3958551664UL, 1746456069UL, 895507243UL, 3171160829UL, 3333292799UL, 1833607331UL, 3864559081UL, 3564325554UL, 1332800826UL, 1987321873UL, 1792851165UL, 505718946UL, +3245448088UL, 1770588062UL, 4035552813UL, 2052557448UL, 2879065999UL, 3602157977UL, 3159941473UL, 2321387515UL, 3556641619UL, 1350613766UL, 4101259055UL, 2669366188UL, 1850700415UL, 3424626316UL, 545651740UL, 2873707882UL, 3252475208UL, 979047283UL, 862046434UL, 167198649UL, 654196140UL, 771814471UL, 4201635137UL, 883549156UL, 907871968UL, 191965184UL, 184144160UL, 2637527083UL, 3306095271UL, 1452688488UL, 1562736568UL, 4275587594UL, +117966344UL, 1785040579UL, 454879400UL, 3484019450UL, 3806424990UL, 733998186UL, 1623968604UL, 2997422000UL, 273316614UL, 2670843077UL, 3360491537UL, 3053533585UL, 1654709920UL, 591311873UL, 3541927406UL, 1716078578UL, 2888573892UL, 2825965566UL, 2277117038UL, 3184295779UL, 2776111761UL, 384880529UL, 3497622676UL, 1086566797UL, 723804135UL, 618916624UL, 1008618602UL, 2816673160UL, 3344392942UL, 3275521308UL, 3340690804UL, 962627614UL, +3072103948UL, 2910444460UL, 2023106558UL, 902990902UL, 126319837UL, 2155412848UL, 337119596UL, 3978575748UL, 4254301999UL, 2689599232UL, 426191419UL, 3471778695UL, 2446138116UL, 3216403640UL, 1259677734UL, 2889209278UL, 4102983766UL, 1706032491UL, 3221479262UL, 1298500018UL, 3340348062UL, 2940293024UL, 3805001240UL, 3926654939UL, 2271956463UL, 3004309866UL, 3634668003UL, 294480880UL, 1879451653UL, 3168497089UL, 361311552UL, 3417679321UL, +2080604411UL, 341920668UL, 507483626UL, 1201669979UL, 3174274528UL, 2012149356UL, 3748705813UL, 3375736126UL, 2857697336UL, 3929686609UL, 2935748807UL, 3336305747UL, 681020485UL, 4044713962UL, 405011299UL, 2862982895UL, 2578353596UL, 820410567UL, 601527649UL, 4281957726UL, 1890290066UL, 3155251071UL, 1984297765UL, 1888157243UL, 1978308818UL, 41870487UL, 2548692624UL, 1106822080UL, 1472807331UL, 3701147046UL, 2382974023UL, 736629379UL, +393081842UL, 3826516196UL, 3225163595UL, 4219335149UL, 2440227627UL, 2188282304UL, 2949056849UL, 3894577191UL, 3785297102UL, 191805249UL, 496972334UL, 830265621UL, 4293577013UL, 3962907313UL, 396738554UL, 2616327935UL, 2337227347UL, 3701032380UL, 552154011UL, 3932761947UL, 1893005585UL, 3958551664UL, 4148575672UL, 895507243UL, 3171160829UL, 3333292799UL, 1833607331UL, 1596419195UL, 3564325554UL, 1332800826UL, 1987321873UL, 1792851165UL, +3663406943UL, 3892533309UL, 247565591UL, 953356243UL, 4103354183UL, 1908418768UL, 3915294912UL, 2390669489UL, 3865260287UL, 1818313429UL, 557880278UL, 2499771815UL, 2618380525UL, 732785004UL, 1414011135UL, 2858311749UL, 3871596970UL, 2428464498UL, 645476041UL, 683035653UL, 4079609082UL, 2404111028UL, 3332056297UL, 3054547484UL, 3616426087UL, 1311379849UL, 3682136336UL, 3795847093UL, 1509718393UL, 541389178UL, 1103876446UL, 2549442278UL, +3656600574UL, 3019560735UL, 523610761UL, 3889482885UL, 3080739216UL, 2359120072UL, 1034857006UL, 63567637UL, 1520176098UL, 1741685274UL, 2330217396UL, 1429674399UL, 517809884UL, 2653145241UL, 868296581UL, 646514407UL, 3166145188UL, 3023629813UL, 2333851648UL, 2967365394UL, 1828821737UL, 3333092181UL, 445460259UL, 2682093551UL, 3655100102UL, 2592872076UL, 1588368999UL, 3964958220UL, 755397374UL, 1912970603UL, 396253754UL, 4260038354UL, +1530898510UL, 2396805917UL, 3327501452UL, 4235709361UL, 2762163349UL, 553869167UL, 3162483580UL, 1611891352UL, 248738605UL, 3403092967UL, 2194464420UL, 113420452UL, 1752444845UL, 3770903547UL, 2397481985UL, 2866414964UL, 2555678075UL, 2796010061UL, 762034588UL, 2679383682UL, 1848516655UL, 3857720381UL, 1119111363UL, 1829110546UL, 2183620391UL, 1743838702UL, 3363053704UL, 2212810289UL, 966205413UL, 3897281091UL, 2148139678UL, 2690229390UL, +427450194UL, 3516115778UL, 1864991059UL, 134448489UL, 3397232480UL, 3999530682UL, 1927036992UL, 3170864927UL, 3879295489UL, 134554462UL, 3447324105UL, 86678510UL, 1656551206UL, 2844494044UL, 2469678938UL, 2885597732UL, 2715483555UL, 3566904604UL, 462585182UL, 1922457093UL, 3035264235UL, 2866504077UL, 2031456720UL, 1598555964UL, 2569915450UL, 3947972758UL, 290683210UL, 2465427488UL, 3504862176UL, 793156806UL, 1722326752UL, 2706215067UL, +3818976191UL, 2007064241UL, 552144413UL, 2692866408UL, 3975075075UL, 4293828741UL, 1123460373UL, 960845744UL, 1855626484UL, 1876934434UL, 1343778249UL, 912185207UL, 127278206UL, 4168930635UL, 340393978UL, 65814528UL, 2552086271UL, 2507474816UL, 1240220220UL, 1761964455UL, 2204917500UL, 4088965101UL, 1079310398UL, 3071460742UL, 2188549805UL, 1064733776UL, 4191719087UL, 3221046115UL, 3772395288UL, 883516842UL, 2077853840UL, 229484673UL, +}, +{ +448889887UL, 3508620909UL, 4164289950UL, 155254859UL, 298319697UL, 980080883UL, 3500794888UL, 3974907245UL, 682778656UL, 382798811UL, 1500342771UL, 3942535492UL, 1039809505UL, 2126581011UL, 561192171UL, 4046277638UL, 840733718UL, 1694555864UL, 241216466UL, 4182349979UL, 2525929010UL, 386794637UL, 349755829UL, 2959959729UL, 686974318UL, 3243688353UL, 3911051908UL, 3917458620UL, 441833800UL, 3164548257UL, 584185450UL, 450132281UL, +3528356519UL, 4275666503UL, 1317069624UL, 817077137UL, 2945430988UL, 1532878265UL, 2542155552UL, 3348614029UL, 1419611574UL, 1245233100UL, 1981161828UL, 1161647342UL, 2781439556UL, 3896025436UL, 2349200248UL, 1213899699UL, 860301545UL, 1590934964UL, 3371591516UL, 2850926464UL, 2774569126UL, 907316453UL, 3541736952UL, 3572719697UL, 278602945UL, 4257620354UL, 3396349537UL, 3144949411UL, 191271983UL, 2974056951UL, 2743594803UL, 1119054633UL, +815666748UL, 920991498UL, 187861899UL, 2008325469UL, 1548504646UL, 3749744762UL, 993523345UL, 1171349070UL, 4105576982UL, 1559471848UL, 2656434170UL, 2795453957UL, 3357293755UL, 4260164297UL, 2211998873UL, 1783238785UL, 2831224398UL, 1704939914UL, 2626903427UL, 1148581053UL, 849777796UL, 4219173763UL, 694869701UL, 1297370017UL, 3573985711UL, 1739242781UL, 3680794431UL, 400850360UL, 909653264UL, 1496585542UL, 460982606UL, 828640603UL, +3993062500UL, 2145047281UL, 1587836828UL, 912583500UL, 1234319994UL, 4276951314UL, 485282908UL, 1903750880UL, 1667769214UL, 3950976882UL, 3711912938UL, 3626058764UL, 627857875UL, 436470402UL, 1753727232UL, 50241405UL, 206782941UL, 612110492UL, 954016857UL, 2567547031UL, 3360482779UL, 820704062UL, 412722485UL, 2044763466UL, 1915626743UL, 2703000434UL, 2755090057UL, 53587450UL, 2457122208UL, 1397065983UL, 2822294224UL, 3024827428UL, +2201149820UL, 699377793UL, 157099022UL, 2792298089UL, 3927835437UL, 1095494739UL, 1230723791UL, 2740420278UL, 2518077381UL, 3674832547UL, 2375246835UL, 923451748UL, 3665432731UL, 1577970518UL, 2643388181UL, 4050379756UL, 1145072065UL, 1632232822UL, 2365350332UL, 1126185680UL, 930842061UL, 3816331201UL, 1624573114UL, 3809118349UL, 1187817320UL, 945407897UL, 63630679UL, 1852369563UL, 971772965UL, 2229069035UL, 2320405193UL, 3474864049UL, +1666937976UL, 448889887UL, 3508620909UL, 4164289950UL, 155254859UL, 3157319819UL, 980080883UL, 3500794888UL, 3974907245UL, 682778656UL, 3201604042UL, 1500342771UL, 3942535492UL, 1039809505UL, 2126581011UL, 3235144326UL, 4046277638UL, 840733718UL, 1694555864UL, 241216466UL, 2728337326UL, 2525929010UL, 386794637UL, 349755829UL, 2959959729UL, 20820947UL, 3243688353UL, 3911051908UL, 3917458620UL, 441833800UL, 4143649787UL, 584185450UL, +450132281UL, 3528356519UL, 4275666503UL, 3541347868UL, 817077137UL, 2945430988UL, 1532878265UL, 2542155552UL, 3199458552UL, 1419611574UL, 1245233100UL, 1981161828UL, 1161647342UL, 958085276UL, 3896025436UL, 2349200248UL, 1213899699UL, 860301545UL, 1701089635UL, 3371591516UL, 2850926464UL, 2774569126UL, 907316453UL, 1529987826UL, 3572719697UL, 278602945UL, 4257620354UL, 3396349537UL, 4120000342UL, 191271983UL, 2974056951UL, 2743594803UL, +1119054633UL, 4255116655UL, 920991498UL, 187861899UL, 2008325469UL, 1548504646UL, 100038488UL, 993523345UL, 1171349070UL, 4105576982UL, 1559471848UL, 2523523381UL, 2795453957UL, 3357293755UL, 4260164297UL, 2211998873UL, 3644225670UL, 2831224398UL, 1704939914UL, 2626903427UL, 1148581053UL, 1292003378UL, 4219173763UL, 694869701UL, 1297370017UL, 3573985711UL, 2510138592UL, 3680794431UL, 400850360UL, 909653264UL, 1496585542UL, 1738256576UL, +828640603UL, 3993062500UL, 2145047281UL, 1587836828UL, 3478998519UL, 1234319994UL, 4276951314UL, 485282908UL, 1903750880UL, 746205619UL, 3950976882UL, 3711912938UL, 3626058764UL, 627857875UL, 954627753UL, 1753727232UL, 50241405UL, 206782941UL, 612110492UL, 2251018875UL, 2567547031UL, 3360482779UL, 820704062UL, 412722485UL, 2120077037UL, 1915626743UL, 2703000434UL, 2755090057UL, 53587450UL, 2696843657UL, 1397065983UL, 2822294224UL, +3024827428UL, 2201149820UL, 3308142895UL, 157099022UL, 2792298089UL, 3927835437UL, 1095494739UL, 730099534UL, 2740420278UL, 2518077381UL, 3674832547UL, 2375246835UL, 2126745526UL, 3665432731UL, 1577970518UL, 2643388181UL, 4050379756UL, 2987545029UL, 1632232822UL, 2365350332UL, 1126185680UL, 930842061UL, 3140947362UL, 1624573114UL, 3809118349UL, 1187817320UL, 945407897UL, 1282799903UL, 1852369563UL, 971772965UL, 2229069035UL, 2320405193UL, +670134249UL, 1666937976UL, 448889887UL, 3508620909UL, 4164289950UL, 127045110UL, 3157319819UL, 980080883UL, 3500794888UL, 3974907245UL, 2740953010UL, 3201604042UL, 1500342771UL, 3942535492UL, 1039809505UL, 306788856UL, 3235144326UL, 4046277638UL, 840733718UL, 1694555864UL, 2260304655UL, 2728337326UL, 2525929010UL, 386794637UL, 349755829UL, 3842816805UL, 20820947UL, 3243688353UL, 3911051908UL, 3917458620UL, 3398227861UL, 4143649787UL, +584185450UL, 450132281UL, 3528356519UL, 550401017UL, 3541347868UL, 817077137UL, 2945430988UL, 1532878265UL, 1045681234UL, 3199458552UL, 1419611574UL, 1245233100UL, 1981161828UL, 1153297031UL, 958085276UL, 3896025436UL, 2349200248UL, 1213899699UL, 1451842347UL, 1701089635UL, 3371591516UL, 2850926464UL, 2774569126UL, 1269128107UL, 1529987826UL, 3572719697UL, 278602945UL, 4257620354UL, 2479560493UL, 4120000342UL, 191271983UL, 2974056951UL, +2743594803UL, 4081110580UL, 4255116655UL, 920991498UL, 187861899UL, 2008325469UL, 1300371976UL, 100038488UL, 993523345UL, 1171349070UL, 4105576982UL, 3010753279UL, 2523523381UL, 2795453957UL, 3357293755UL, 4260164297UL, 207153762UL, 3644225670UL, 2831224398UL, 1704939914UL, 2626903427UL, 916783095UL, 1292003378UL, 4219173763UL, 694869701UL, 1297370017UL, 3388725608UL, 2510138592UL, 3680794431UL, 400850360UL, 909653264UL, 2421730678UL, +1738256576UL, 828640603UL, 3993062500UL, 2145047281UL, 2123619770UL, 3478998519UL, 1234319994UL, 4276951314UL, 485282908UL, 4002661777UL, 746205619UL, 3950976882UL, 3711912938UL, 3626058764UL, 1230937254UL, 954627753UL, 1753727232UL, 50241405UL, 206782941UL, 460314337UL, 2251018875UL, 2567547031UL, 3360482779UL, 820704062UL, 1339598718UL, 2120077037UL, 1915626743UL, 2703000434UL, 2755090057UL, 660730207UL, 2696843657UL, 1397065983UL, +2822294224UL, 3024827428UL, 126840648UL, 3308142895UL, 157099022UL, 2792298089UL, 3927835437UL, 2192535935UL, 730099534UL, 2740420278UL, 2518077381UL, 3674832547UL, 1879512787UL, 2126745526UL, 3665432731UL, 1577970518UL, 2643388181UL, 832572764UL, 2987545029UL, 1632232822UL, 2365350332UL, 1126185680UL, 3248646182UL, 3140947362UL, 1624573114UL, 3809118349UL, 1187817320UL, 4270855000UL, 1282799903UL, 1852369563UL, 971772965UL, 2229069035UL, +3735782785UL, 670134249UL, 1666937976UL, 448889887UL, 3508620909UL, 3681408470UL, 127045110UL, 3157319819UL, 980080883UL, 3500794888UL, 3967872553UL, 2740953010UL, 3201604042UL, 1500342771UL, 3942535492UL, 613854690UL, 306788856UL, 3235144326UL, 4046277638UL, 840733718UL, 3957877023UL, 2260304655UL, 2728337326UL, 2525929010UL, 386794637UL, 1779451936UL, 3842816805UL, 20820947UL, 3243688353UL, 3911051908UL, 688470429UL, 3398227861UL, +4143649787UL, 584185450UL, 450132281UL, 3381050556UL, 550401017UL, 3541347868UL, 817077137UL, 2945430988UL, 1859551669UL, 1045681234UL, 3199458552UL, 1419611574UL, 1245233100UL, 53681099UL, 1153297031UL, 958085276UL, 3896025436UL, 2349200248UL, 1796144514UL, 1451842347UL, 1701089635UL, 3371591516UL, 2850926464UL, 1337394836UL, 1269128107UL, 1529987826UL, 3572719697UL, 278602945UL, 46913829UL, 2479560493UL, 4120000342UL, 191271983UL, +2974056951UL, 1361976701UL, 4081110580UL, 4255116655UL, 920991498UL, 187861899UL, 1237191391UL, 1300371976UL, 100038488UL, 993523345UL, 1171349070UL, 3168325479UL, 3010753279UL, 2523523381UL, 2795453957UL, 3357293755UL, 2142853843UL, 207153762UL, 3644225670UL, 2831224398UL, 1704939914UL, 2369686128UL, 916783095UL, 1292003378UL, 4219173763UL, 694869701UL, 4150182218UL, 3388725608UL, 2510138592UL, 3680794431UL, 400850360UL, 654034492UL, +2421730678UL, 1738256576UL, 828640603UL, 3993062500UL, 84735560UL, 2123619770UL, 3478998519UL, 1234319994UL, 4276951314UL, 2545204994UL, 4002661777UL, 746205619UL, 3950976882UL, 3711912938UL, 426068544UL, 1230937254UL, 954627753UL, 1753727232UL, 50241405UL, 589286339UL, 460314337UL, 2251018875UL, 2567547031UL, 3360482779UL, 3279873953UL, 1339598718UL, 2120077037UL, 1915626743UL, 2703000434UL, 2720159887UL, 660730207UL, 2696843657UL, +1397065983UL, 2822294224UL, 3536645029UL, 126840648UL, 3308142895UL, 157099022UL, 2792298089UL, 485214530UL, 2192535935UL, 730099534UL, 2740420278UL, 2518077381UL, 418832171UL, 1879512787UL, 2126745526UL, 3665432731UL, 1577970518UL, 721018UL, 832572764UL, 2987545029UL, 1632232822UL, 2365350332UL, 1769688764UL, 3248646182UL, 3140947362UL, 1624573114UL, 3809118349UL, 3561012744UL, 4270855000UL, 1282799903UL, 1852369563UL, 971772965UL, +2160782957UL, 105464019UL, 2131462864UL, 335205049UL, 3271229551UL, 1374396416UL, 4269753677UL, 1984596635UL, 37563880UL, 3956352262UL, 2168603656UL, 311623712UL, 1593371323UL, 351020595UL, 3439337532UL, 3130874657UL, 3613343327UL, 695789539UL, 609797513UL, 53642143UL, 1479027519UL, 1588831722UL, 262810641UL, 3418379977UL, 530167431UL, 1962487963UL, 2410103328UL, 3360114680UL, 3548827677UL, 2735238248UL, 2136058369UL, 4013192489UL, +4106245442UL, 2155966460UL, 3653971354UL, 1230293148UL, 3966689348UL, 3455336684UL, 3594979856UL, 3178937309UL, 3983796170UL, 3617590004UL, 1727358326UL, 1121418876UL, 1022562029UL, 2437823131UL, 2733424381UL, 452731958UL, 2983755220UL, 1674750403UL, 3110921909UL, 3514365950UL, 2193238341UL, 2073801740UL, 669573402UL, 1824298084UL, 22336337UL, 3366446304UL, 1536043612UL, 2502297553UL, 1409641611UL, 2399583184UL, 2593245170UL, 716832039UL, +4286149460UL, 814849965UL, 4239224908UL, 2453627262UL, 976385355UL, 1846129423UL, 52096201UL, 88835472UL, 2621770794UL, 2491757130UL, 1849417480UL, 576668065UL, 2186701850UL, 3357019214UL, 442191324UL, 3662645846UL, 3653766782UL, 2254203663UL, 1169821059UL, 3735427676UL, 2246044748UL, 2635264668UL, 2647842566UL, 1435695450UL, 1658777934UL, 2927080369UL, 1341088646UL, 3565982642UL, 221661496UL, 3246988243UL, 2718455491UL, 483517148UL, +4181332651UL, 1143646375UL, 1720449423UL, 331164544UL, 539836322UL, 3485371630UL, 1110077273UL, 4088985694UL, 145720169UL, 2382276586UL, 4276410795UL, 2051956774UL, 936524156UL, 15415192UL, 1815949694UL, 272696290UL, 1495465483UL, 3102030383UL, 3546078241UL, 3272619595UL, 759699322UL, 1161486824UL, 1146281812UL, 4194130649UL, 3936306436UL, 4077338125UL, 2127551216UL, 2995077453UL, 209698652UL, 3836657987UL, 1782152220UL, 1642490089UL, +3695579542UL, 537862234UL, 1696168156UL, 4022607UL, 3642864269UL, 54404878UL, 2925910542UL, 3444042482UL, 1931288691UL, 2269375687UL, 614870298UL, 1139082272UL, 3672546472UL, 3255845763UL, 2987873616UL, 3436501734UL, 380553853UL, 750118352UL, 750708138UL, 488564982UL, 2936846643UL, 3460652101UL, 3085496886UL, 3734224010UL, 523359404UL, 2751912206UL, 3302219188UL, 2729509827UL, 1995554251UL, 2288103059UL, 3289667468UL, 2860301591UL, +}, +{ +3481653941UL, 2111903071UL, 3569014882UL, 1149634763UL, 4206972571UL, 2948781360UL, 2576820949UL, 2587099571UL, 3987042644UL, 4255777336UL, 2829594348UL, 3832744490UL, 3554499754UL, 787920018UL, 695635693UL, 2746034685UL, 2078139227UL, 1144320548UL, 4020978225UL, 449503505UL, 3004993826UL, 2045843139UL, 1604631401UL, 148449881UL, 457819243UL, 4089112489UL, 1713441237UL, 1790909556UL, 3334464951UL, 3070008305UL, 811825474UL, 4089105370UL, +708239097UL, 1494832299UL, 2074902973UL, 468898217UL, 1722559700UL, 2499754488UL, 2267939270UL, 650114709UL, 549502184UL, 4040463514UL, 4228169080UL, 4094284819UL, 1599334548UL, 2992525399UL, 2107053637UL, 197348940UL, 1669884894UL, 3982326753UL, 4259099320UL, 1862793542UL, 1751219817UL, 2701271514UL, 2507353222UL, 1488339939UL, 4246544316UL, 3978321870UL, 132720476UL, 3020305599UL, 154822619UL, 2595474066UL, 1654579304UL, 1997335204UL, +891320674UL, 3153502700UL, 601607977UL, 2695457160UL, 4137981809UL, 37584248UL, 1674050253UL, 1805619463UL, 676369068UL, 2294902904UL, 658143166UL, 141452045UL, 2383327493UL, 1222336195UL, 2628962123UL, 2378299402UL, 2724274090UL, 1783957650UL, 453206569UL, 3190116972UL, 1480368955UL, 1145768764UL, 3628222572UL, 3108689607UL, 182547022UL, 360165920UL, 3378423016UL, 1443723222UL, 2843274258UL, 1597581683UL, 664283285UL, 258077235UL, +3071875976UL, 240688930UL, 988895736UL, 2965351284UL, 91332032UL, 941306162UL, 2464278288UL, 3493666272UL, 2437043750UL, 2356658919UL, 24726067UL, 3025656863UL, 1343636659UL, 2408295270UL, 3097408183UL, 461428710UL, 2449005423UL, 3220070834UL, 1418517867UL, 907095008UL, 428073188UL, 1938061314UL, 2094361729UL, 2570445990UL, 346999411UL, 990247709UL, 1630488660UL, 2574142591UL, 1466590284UL, 1906935236UL, 1592544037UL, 4168163186UL, +2773942807UL, 939392801UL, 1610069434UL, 1935303983UL, 2962954128UL, 2490925509UL, 4103025390UL, 3614258069UL, 174125899UL, 4113855120UL, 2449365101UL, 3384244363UL, 4115219971UL, 3187664453UL, 4021992190UL, 2959372973UL, 2946571025UL, 2144945539UL, 388172915UL, 1125615727UL, 881693338UL, 3313110562UL, 859388069UL, 177786360UL, 4134747901UL, 616417204UL, 2104495620UL, 783302897UL, 512784708UL, 1295821322UL, 3810209448UL, 2966899912UL, +2390608767UL, 3481653941UL, 2111903071UL, 3569014882UL, 1149634763UL, 1385372463UL, 2948781360UL, 2576820949UL, 2587099571UL, 3987042644UL, 2251144849UL, 2829594348UL, 3832744490UL, 3554499754UL, 787920018UL, 73007125UL, 2746034685UL, 2078139227UL, 1144320548UL, 4020978225UL, 2729117517UL, 3004993826UL, 2045843139UL, 1604631401UL, 148449881UL, 3343221736UL, 4089112489UL, 1713441237UL, 1790909556UL, 3334464951UL, 1920962856UL, 811825474UL, +4089105370UL, 708239097UL, 1494832299UL, 2485576001UL, 468898217UL, 1722559700UL, 2499754488UL, 2267939270UL, 2271486862UL, 549502184UL, 4040463514UL, 4228169080UL, 4094284819UL, 3177940420UL, 2992525399UL, 2107053637UL, 197348940UL, 1669884894UL, 3596140613UL, 4259099320UL, 1862793542UL, 1751219817UL, 2701271514UL, 1357847339UL, 1488339939UL, 4246544316UL, 3978321870UL, 132720476UL, 344033794UL, 154822619UL, 2595474066UL, 1654579304UL, +1997335204UL, 1849659590UL, 3153502700UL, 601607977UL, 2695457160UL, 4137981809UL, 3559496104UL, 1674050253UL, 1805619463UL, 676369068UL, 2294902904UL, 1583197657UL, 141452045UL, 2383327493UL, 1222336195UL, 2628962123UL, 3486106126UL, 2724274090UL, 1783957650UL, 453206569UL, 3190116972UL, 1939413704UL, 1145768764UL, 3628222572UL, 3108689607UL, 182547022UL, 2911760834UL, 3378423016UL, 1443723222UL, 2843274258UL, 1597581683UL, 3599911248UL, +258077235UL, 3071875976UL, 240688930UL, 988895736UL, 4263328855UL, 91332032UL, 941306162UL, 2464278288UL, 3493666272UL, 1561559932UL, 2356658919UL, 24726067UL, 3025656863UL, 1343636659UL, 257301433UL, 3097408183UL, 461428710UL, 2449005423UL, 3220070834UL, 3544357262UL, 907095008UL, 428073188UL, 1938061314UL, 2094361729UL, 4112109825UL, 346999411UL, 990247709UL, 1630488660UL, 2574142591UL, 1466763688UL, 1906935236UL, 1592544037UL, +4168163186UL, 2773942807UL, 3608227467UL, 1610069434UL, 1935303983UL, 2962954128UL, 2490925509UL, 825197245UL, 3614258069UL, 174125899UL, 4113855120UL, 2449365101UL, 167881680UL, 4115219971UL, 3187664453UL, 4021992190UL, 2959372973UL, 1971633162UL, 2144945539UL, 388172915UL, 1125615727UL, 881693338UL, 223946687UL, 859388069UL, 177786360UL, 4134747901UL, 616417204UL, 722598357UL, 783302897UL, 512784708UL, 1295821322UL, 3810209448UL, +1589703161UL, 2390608767UL, 3481653941UL, 2111903071UL, 3569014882UL, 2520719089UL, 1385372463UL, 2948781360UL, 2576820949UL, 2587099571UL, 1427210741UL, 2251144849UL, 2829594348UL, 3832744490UL, 3554499754UL, 1257461820UL, 73007125UL, 2746034685UL, 2078139227UL, 1144320548UL, 3065859797UL, 2729117517UL, 3004993826UL, 2045843139UL, 1604631401UL, 36092756UL, 3343221736UL, 4089112489UL, 1713441237UL, 1790909556UL, 1504385586UL, 1920962856UL, +811825474UL, 4089105370UL, 708239097UL, 4135459720UL, 2485576001UL, 468898217UL, 1722559700UL, 2499754488UL, 1392696606UL, 2271486862UL, 549502184UL, 4040463514UL, 4228169080UL, 2521060775UL, 3177940420UL, 2992525399UL, 2107053637UL, 197348940UL, 4225425195UL, 3596140613UL, 4259099320UL, 1862793542UL, 1751219817UL, 3752827533UL, 1357847339UL, 1488339939UL, 4246544316UL, 3978321870UL, 270743120UL, 344033794UL, 154822619UL, 2595474066UL, +1654579304UL, 986127123UL, 1849659590UL, 3153502700UL, 601607977UL, 2695457160UL, 437034992UL, 3559496104UL, 1674050253UL, 1805619463UL, 676369068UL, 956939381UL, 1583197657UL, 141452045UL, 2383327493UL, 1222336195UL, 3287498300UL, 3486106126UL, 2724274090UL, 1783957650UL, 453206569UL, 3610364652UL, 1939413704UL, 1145768764UL, 3628222572UL, 3108689607UL, 708259891UL, 2911760834UL, 3378423016UL, 1443723222UL, 2843274258UL, 1498209005UL, +3599911248UL, 258077235UL, 3071875976UL, 240688930UL, 3815218922UL, 4263328855UL, 91332032UL, 941306162UL, 2464278288UL, 3018835600UL, 1561559932UL, 2356658919UL, 24726067UL, 3025656863UL, 368313673UL, 257301433UL, 3097408183UL, 461428710UL, 2449005423UL, 3690066046UL, 3544357262UL, 907095008UL, 428073188UL, 1938061314UL, 2274317748UL, 4112109825UL, 346999411UL, 990247709UL, 1630488660UL, 1584471638UL, 1466763688UL, 1906935236UL, +1592544037UL, 4168163186UL, 473837206UL, 3608227467UL, 1610069434UL, 1935303983UL, 2962954128UL, 391171548UL, 825197245UL, 3614258069UL, 174125899UL, 4113855120UL, 2095676907UL, 167881680UL, 4115219971UL, 3187664453UL, 4021992190UL, 4246237180UL, 1971633162UL, 2144945539UL, 388172915UL, 1125615727UL, 3158677395UL, 223946687UL, 859388069UL, 177786360UL, 4134747901UL, 4017781965UL, 722598357UL, 783302897UL, 512784708UL, 1295821322UL, +3908594844UL, 1589703161UL, 2390608767UL, 3481653941UL, 2111903071UL, 2713757719UL, 2520719089UL, 1385372463UL, 2948781360UL, 2576820949UL, 638075690UL, 1427210741UL, 2251144849UL, 2829594348UL, 3832744490UL, 2871270139UL, 1257461820UL, 73007125UL, 2746034685UL, 2078139227UL, 1974062189UL, 3065859797UL, 2729117517UL, 3004993826UL, 2045843139UL, 772058252UL, 36092756UL, 3343221736UL, 4089112489UL, 1713441237UL, 2172680702UL, 1504385586UL, +1920962856UL, 811825474UL, 4089105370UL, 1822881146UL, 4135459720UL, 2485576001UL, 468898217UL, 1722559700UL, 3429640856UL, 1392696606UL, 2271486862UL, 549502184UL, 4040463514UL, 3072935276UL, 2521060775UL, 3177940420UL, 2992525399UL, 2107053637UL, 1114377646UL, 4225425195UL, 3596140613UL, 4259099320UL, 1862793542UL, 1439724658UL, 3752827533UL, 1357847339UL, 1488339939UL, 4246544316UL, 1051119047UL, 270743120UL, 344033794UL, 154822619UL, +2595474066UL, 3143800435UL, 986127123UL, 1849659590UL, 3153502700UL, 601607977UL, 2334441739UL, 437034992UL, 3559496104UL, 1674050253UL, 1805619463UL, 455274178UL, 956939381UL, 1583197657UL, 141452045UL, 2383327493UL, 1520979444UL, 3287498300UL, 3486106126UL, 2724274090UL, 1783957650UL, 2212706740UL, 3610364652UL, 1939413704UL, 1145768764UL, 3628222572UL, 2719501850UL, 708259891UL, 2911760834UL, 3378423016UL, 1443723222UL, 2678486648UL, +1498209005UL, 3599911248UL, 258077235UL, 3071875976UL, 513762712UL, 3815218922UL, 4263328855UL, 91332032UL, 941306162UL, 3000922309UL, 3018835600UL, 1561559932UL, 2356658919UL, 24726067UL, 3626352172UL, 368313673UL, 257301433UL, 3097408183UL, 461428710UL, 2370224855UL, 3690066046UL, 3544357262UL, 907095008UL, 428073188UL, 2279237523UL, 2274317748UL, 4112109825UL, 346999411UL, 990247709UL, 896290404UL, 1584471638UL, 1466763688UL, +1906935236UL, 1592544037UL, 2387522308UL, 473837206UL, 3608227467UL, 1610069434UL, 1935303983UL, 4120978868UL, 391171548UL, 825197245UL, 3614258069UL, 174125899UL, 2940674123UL, 2095676907UL, 167881680UL, 4115219971UL, 3187664453UL, 456143482UL, 4246237180UL, 1971633162UL, 2144945539UL, 388172915UL, 4041481385UL, 3158677395UL, 223946687UL, 859388069UL, 177786360UL, 3094936989UL, 4017781965UL, 722598357UL, 783302897UL, 512784708UL, +4078350595UL, 2002159085UL, 3374931831UL, 1327513052UL, 4231642441UL, 2398594140UL, 2750176655UL, 2377078716UL, 3051451207UL, 2923556938UL, 392203913UL, 970480700UL, 1611278056UL, 1212903807UL, 85815670UL, 2398261756UL, 1052760308UL, 175807153UL, 2617028873UL, 1862087601UL, 1824020594UL, 3770624867UL, 141863380UL, 2090619424UL, 3994019338UL, 2363183556UL, 3095139522UL, 1792884692UL, 3026343485UL, 2320955816UL, 145789343UL, 214170401UL, +2926373126UL, 3858640613UL, 2188241463UL, 459887603UL, 2117474937UL, 2514234285UL, 1454156613UL, 1675396814UL, 4188979068UL, 1584843874UL, 3594779833UL, 563029256UL, 28681425UL, 446949770UL, 3498545218UL, 435874305UL, 3448653884UL, 863509898UL, 2247299904UL, 4211345429UL, 971855563UL, 1475394960UL, 3401692834UL, 167361776UL, 496249436UL, 1465278889UL, 780336162UL, 2108770597UL, 1806981510UL, 3677875653UL, 1890122303UL, 16399665UL, +2747394159UL, 2098019492UL, 1597583332UL, 1763649529UL, 1286079969UL, 1846278877UL, 1016796923UL, 959676917UL, 3091540766UL, 1626192266UL, 780987350UL, 1102963422UL, 2507002232UL, 691766944UL, 193328868UL, 981596600UL, 2384820612UL, 3149668778UL, 1691569420UL, 2852237957UL, 893819979UL, 2572584243UL, 216077070UL, 1267249886UL, 2572508880UL, 1706489454UL, 2391561733UL, 2608477467UL, 209783612UL, 765896849UL, 3617020328UL, 3488800100UL, +2237655981UL, 2095308189UL, 963275857UL, 3563488318UL, 1865487834UL, 480006810UL, 18562439UL, 1025913188UL, 3368592397UL, 374648713UL, 2421713724UL, 2705651398UL, 3098059650UL, 1109934605UL, 3085839620UL, 3184266772UL, 2359972463UL, 862934481UL, 3624479194UL, 3574284465UL, 2700143837UL, 2468083868UL, 3798800988UL, 4116964911UL, 1832002264UL, 4276154871UL, 3256889524UL, 4036954281UL, 697729046UL, 886223984UL, 2196986730UL, 1157617208UL, +1995907944UL, 398452318UL, 3523714364UL, 613570866UL, 2962430983UL, 1408814780UL, 892117129UL, 4173164219UL, 3894076479UL, 2721348430UL, 555734931UL, 1869034419UL, 336114876UL, 3142554871UL, 3349604636UL, 3450290892UL, 955122895UL, 2202902910UL, 2558366468UL, 1701182712UL, 283197682UL, 1865942385UL, 2027648778UL, 2285857699UL, 880475184UL, 958651279UL, 169534250UL, 3842420528UL, 1568559789UL, 2986618464UL, 2568345525UL, 3081082692UL, +}, +{ +575494427UL, 2773243709UL, 4009191487UL, 3877909663UL, 2252044261UL, 1328043370UL, 1407136778UL, 3204434425UL, 3881653592UL, 1481049819UL, 2939203697UL, 889352935UL, 628666312UL, 165199023UL, 2949092155UL, 1116804589UL, 998930334UL, 4144153491UL, 4191022348UL, 9022505UL, 4033326555UL, 2329569601UL, 824756145UL, 3501916851UL, 1481410328UL, 1970954319UL, 4022176157UL, 2356841052UL, 3783173734UL, 3649102345UL, 3205430658UL, 1460938436UL, +280282398UL, 3262135457UL, 4055383786UL, 28522973UL, 1100901182UL, 4048609665UL, 994490185UL, 2888527367UL, 3591919750UL, 65093467UL, 399797207UL, 3377740861UL, 3103183487UL, 3696509979UL, 866353724UL, 3847992271UL, 2821933890UL, 1491144079UL, 1702442928UL, 1271285504UL, 636444475UL, 2465430290UL, 2440306765UL, 2651443172UL, 2895101023UL, 43843628UL, 518479547UL, 3708355608UL, 2313400729UL, 3786408564UL, 2823763904UL, 3267560272UL, +524168411UL, 2580824843UL, 2687886610UL, 785942949UL, 2624395631UL, 3713348903UL, 4104123478UL, 2234056629UL, 2683158959UL, 1805382347UL, 1645702909UL, 382688861UL, 2843792951UL, 39122499UL, 2765954033UL, 3033237617UL, 784228054UL, 1680611136UL, 2306036746UL, 892707919UL, 3825738103UL, 1289362844UL, 3462989616UL, 484526950UL, 178560970UL, 1863413515UL, 71290794UL, 1716785670UL, 3881310302UL, 2826977504UL, 2312744076UL, 1000001815UL, +1580868938UL, 3808984884UL, 2521899773UL, 738699928UL, 2244576791UL, 1833964269UL, 1361345793UL, 2934763305UL, 2944705940UL, 2334116476UL, 674208214UL, 587191877UL, 271361277UL, 1639419136UL, 2742744205UL, 2556530506UL, 3764115510UL, 861410771UL, 3473658359UL, 2879790483UL, 1497452846UL, 1101855458UL, 2268199923UL, 1766359872UL, 480532790UL, 2926891626UL, 1366888524UL, 2262816900UL, 620045088UL, 2279182738UL, 2479688463UL, 427385986UL, +271096497UL, 1999040724UL, 1980388138UL, 3104550456UL, 2496325717UL, 2941450111UL, 1784373495UL, 4020221165UL, 2567325850UL, 2636190539UL, 2764516078UL, 2285887821UL, 2395930109UL, 1867061176UL, 665795763UL, 3869868300UL, 4033135159UL, 2589983679UL, 682593183UL, 1254600537UL, 1701095863UL, 3738080583UL, 369734429UL, 2231641462UL, 1866531599UL, 1317004965UL, 466053171UL, 2320346625UL, 485850108UL, 1279183025UL, 423884362UL, 1878291714UL, +228799661UL, 575494427UL, 2773243709UL, 4009191487UL, 3877909663UL, 1392246100UL, 1328043370UL, 1407136778UL, 3204434425UL, 3881653592UL, 303018213UL, 2939203697UL, 889352935UL, 628666312UL, 165199023UL, 691563049UL, 1116804589UL, 998930334UL, 4144153491UL, 4191022348UL, 2882458100UL, 4033326555UL, 2329569601UL, 824756145UL, 3501916851UL, 3512382126UL, 1970954319UL, 4022176157UL, 2356841052UL, 3783173734UL, 3277915742UL, 3205430658UL, +1460938436UL, 280282398UL, 3262135457UL, 416160861UL, 28522973UL, 1100901182UL, 4048609665UL, 994490185UL, 2206150488UL, 3591919750UL, 65093467UL, 399797207UL, 3377740861UL, 3954301001UL, 3696509979UL, 866353724UL, 3847992271UL, 2821933890UL, 482325742UL, 1702442928UL, 1271285504UL, 636444475UL, 2465430290UL, 476965483UL, 2651443172UL, 2895101023UL, 43843628UL, 518479547UL, 2354104222UL, 2313400729UL, 3786408564UL, 2823763904UL, +3267560272UL, 1682576095UL, 2580824843UL, 2687886610UL, 785942949UL, 2624395631UL, 3219885224UL, 4104123478UL, 2234056629UL, 2683158959UL, 1805382347UL, 4143809855UL, 382688861UL, 2843792951UL, 39122499UL, 2765954033UL, 2870716981UL, 784228054UL, 1680611136UL, 2306036746UL, 892707919UL, 2648492467UL, 1289362844UL, 3462989616UL, 484526950UL, 178560970UL, 3047404165UL, 71290794UL, 1716785670UL, 3881310302UL, 2826977504UL, 2439325884UL, +1000001815UL, 1580868938UL, 3808984884UL, 2521899773UL, 2222792732UL, 2244576791UL, 1833964269UL, 1361345793UL, 2934763305UL, 655108124UL, 2334116476UL, 674208214UL, 587191877UL, 271361277UL, 1403491312UL, 2742744205UL, 2556530506UL, 3764115510UL, 861410771UL, 2748819627UL, 2879790483UL, 1497452846UL, 1101855458UL, 2268199923UL, 2646753562UL, 480532790UL, 2926891626UL, 1366888524UL, 2262816900UL, 691077353UL, 2279182738UL, 2479688463UL, +427385986UL, 271096497UL, 357444234UL, 1980388138UL, 3104550456UL, 2496325717UL, 2941450111UL, 717953620UL, 4020221165UL, 2567325850UL, 2636190539UL, 2764516078UL, 588189150UL, 2395930109UL, 1867061176UL, 665795763UL, 3869868300UL, 2245339306UL, 2589983679UL, 682593183UL, 1254600537UL, 1701095863UL, 3193417815UL, 369734429UL, 2231641462UL, 1866531599UL, 1317004965UL, 1295326133UL, 2320346625UL, 485850108UL, 1279183025UL, 423884362UL, +1310342080UL, 228799661UL, 575494427UL, 2773243709UL, 4009191487UL, 3178129190UL, 1392246100UL, 1328043370UL, 1407136778UL, 3204434425UL, 558594993UL, 303018213UL, 2939203697UL, 889352935UL, 628666312UL, 3995857198UL, 691563049UL, 1116804589UL, 998930334UL, 4144153491UL, 2375099047UL, 2882458100UL, 4033326555UL, 2329569601UL, 824756145UL, 3031828205UL, 3512382126UL, 1970954319UL, 4022176157UL, 2356841052UL, 1599294097UL, 3277915742UL, +3205430658UL, 1460938436UL, 280282398UL, 2438973535UL, 416160861UL, 28522973UL, 1100901182UL, 4048609665UL, 2989609671UL, 2206150488UL, 3591919750UL, 65093467UL, 399797207UL, 183644195UL, 3954301001UL, 3696509979UL, 866353724UL, 3847992271UL, 1244421011UL, 482325742UL, 1702442928UL, 1271285504UL, 636444475UL, 3659422961UL, 476965483UL, 2651443172UL, 2895101023UL, 43843628UL, 2230230933UL, 2354104222UL, 2313400729UL, 3786408564UL, +2823763904UL, 4146329709UL, 1682576095UL, 2580824843UL, 2687886610UL, 785942949UL, 126345381UL, 3219885224UL, 4104123478UL, 2234056629UL, 2683158959UL, 1734650983UL, 4143809855UL, 382688861UL, 2843792951UL, 39122499UL, 3527484969UL, 2870716981UL, 784228054UL, 1680611136UL, 2306036746UL, 1606477743UL, 2648492467UL, 1289362844UL, 3462989616UL, 484526950UL, 3730796296UL, 3047404165UL, 71290794UL, 1716785670UL, 3881310302UL, 4233965062UL, +2439325884UL, 1000001815UL, 1580868938UL, 3808984884UL, 1228341642UL, 2222792732UL, 2244576791UL, 1833964269UL, 1361345793UL, 3313812192UL, 655108124UL, 2334116476UL, 674208214UL, 587191877UL, 1531247446UL, 1403491312UL, 2742744205UL, 2556530506UL, 3764115510UL, 2419989900UL, 2748819627UL, 2879790483UL, 1497452846UL, 1101855458UL, 1430402656UL, 2646753562UL, 480532790UL, 2926891626UL, 1366888524UL, 1848714433UL, 691077353UL, 2279182738UL, +2479688463UL, 427385986UL, 3906690631UL, 357444234UL, 1980388138UL, 3104550456UL, 2496325717UL, 2272350403UL, 717953620UL, 4020221165UL, 2567325850UL, 2636190539UL, 1950604113UL, 588189150UL, 2395930109UL, 1867061176UL, 665795763UL, 1735147895UL, 2245339306UL, 2589983679UL, 682593183UL, 1254600537UL, 1518037357UL, 3193417815UL, 369734429UL, 2231641462UL, 1866531599UL, 1751783137UL, 1295326133UL, 2320346625UL, 485850108UL, 1279183025UL, +149835864UL, 1310342080UL, 228799661UL, 575494427UL, 2773243709UL, 1505829825UL, 3178129190UL, 1392246100UL, 1328043370UL, 1407136778UL, 856233019UL, 558594993UL, 303018213UL, 2939203697UL, 889352935UL, 625515593UL, 3995857198UL, 691563049UL, 1116804589UL, 998930334UL, 3264640128UL, 2375099047UL, 2882458100UL, 4033326555UL, 2329569601UL, 1824812377UL, 3031828205UL, 3512382126UL, 1970954319UL, 4022176157UL, 3682468973UL, 1599294097UL, +3277915742UL, 3205430658UL, 1460938436UL, 2034940270UL, 2438973535UL, 416160861UL, 28522973UL, 1100901182UL, 3534874298UL, 2989609671UL, 2206150488UL, 3591919750UL, 65093467UL, 2231373121UL, 183644195UL, 3954301001UL, 3696509979UL, 866353724UL, 1479968372UL, 1244421011UL, 482325742UL, 1702442928UL, 1271285504UL, 3834022401UL, 3659422961UL, 476965483UL, 2651443172UL, 2895101023UL, 1042443120UL, 2230230933UL, 2354104222UL, 2313400729UL, +3786408564UL, 2940290545UL, 4146329709UL, 1682576095UL, 2580824843UL, 2687886610UL, 895602439UL, 126345381UL, 3219885224UL, 4104123478UL, 2234056629UL, 3633565082UL, 1734650983UL, 4143809855UL, 382688861UL, 2843792951UL, 3076342354UL, 3527484969UL, 2870716981UL, 784228054UL, 1680611136UL, 3667923304UL, 1606477743UL, 2648492467UL, 1289362844UL, 3462989616UL, 1338592032UL, 3730796296UL, 3047404165UL, 71290794UL, 1716785670UL, 995728648UL, +4233965062UL, 2439325884UL, 1000001815UL, 1580868938UL, 1245957136UL, 1228341642UL, 2222792732UL, 2244576791UL, 1833964269UL, 2899552190UL, 3313812192UL, 655108124UL, 2334116476UL, 674208214UL, 1154789946UL, 1531247446UL, 1403491312UL, 2742744205UL, 2556530506UL, 1668620496UL, 2419989900UL, 2748819627UL, 2879790483UL, 1497452846UL, 177853954UL, 1430402656UL, 2646753562UL, 480532790UL, 2926891626UL, 3179057526UL, 1848714433UL, 691077353UL, +2279182738UL, 2479688463UL, 1988854710UL, 3906690631UL, 357444234UL, 1980388138UL, 3104550456UL, 1772857305UL, 2272350403UL, 717953620UL, 4020221165UL, 2567325850UL, 3129906484UL, 1950604113UL, 588189150UL, 2395930109UL, 1867061176UL, 2248975336UL, 1735147895UL, 2245339306UL, 2589983679UL, 682593183UL, 3087155398UL, 1518037357UL, 3193417815UL, 369734429UL, 2231641462UL, 1858424931UL, 1751783137UL, 1295326133UL, 2320346625UL, 485850108UL, +2471611230UL, 107369761UL, 2623559579UL, 4256589070UL, 2365810185UL, 907910243UL, 3901832478UL, 2068079364UL, 2072842987UL, 401440347UL, 1707255913UL, 1450112231UL, 2618898012UL, 600446000UL, 788321632UL, 4119629235UL, 2648781584UL, 1927659116UL, 171372782UL, 1789511950UL, 2648296999UL, 3558619514UL, 1819608632UL, 1392007708UL, 2918513974UL, 2270003900UL, 784021820UL, 1379044539UL, 591935962UL, 1638390839UL, 10832053UL, 3946625290UL, +2916913801UL, 2718331169UL, 1595482738UL, 1294279402UL, 19889234UL, 1374364843UL, 571354125UL, 3357938719UL, 2337506269UL, 905453029UL, 2504232400UL, 258673393UL, 2590342355UL, 3308443353UL, 3359617898UL, 2686453711UL, 932545954UL, 509832408UL, 820508114UL, 431186194UL, 3434866166UL, 1108455121UL, 2802986572UL, 893446102UL, 3248197798UL, 1797985531UL, 3952804303UL, 558601278UL, 1813674114UL, 311050994UL, 425175161UL, 1125527204UL, +1597986581UL, 2282580210UL, 1659733126UL, 2080660004UL, 4121079137UL, 3373787661UL, 1902252724UL, 2669993847UL, 2450915273UL, 2155525933UL, 2139535914UL, 274595185UL, 1890506924UL, 2631794527UL, 1423530517UL, 4027031002UL, 1085427968UL, 2402514206UL, 3591455043UL, 2513094696UL, 2338347202UL, 1168222597UL, 3922339535UL, 3991725466UL, 2774598759UL, 3478721168UL, 3676766916UL, 179748891UL, 2911159372UL, 191101265UL, 3389843262UL, 3093358663UL, +2333576084UL, 1056514165UL, 2987497874UL, 2502331872UL, 2027710028UL, 2338525812UL, 3904906078UL, 806669884UL, 596300960UL, 1993055778UL, 1541809402UL, 3578865742UL, 652348267UL, 3332532764UL, 2656602623UL, 2037214047UL, 323260312UL, 3310408133UL, 4037617529UL, 137297627UL, 1236501991UL, 495817051UL, 481150309UL, 3067841968UL, 3120347176UL, 714354848UL, 1554632062UL, 2522324107UL, 4274051212UL, 2180914534UL, 1261686356UL, 3569290041UL, +1801431819UL, 4286755560UL, 2749452442UL, 829235089UL, 2243153325UL, 2525168177UL, 1486881882UL, 585653228UL, 3288336688UL, 2734161045UL, 30430534UL, 714492313UL, 2582732426UL, 595577790UL, 1463554287UL, 1949506865UL, 4210942156UL, 2008105540UL, 4055753132UL, 2530320603UL, 319064177UL, 2305067982UL, 3825716413UL, 1543867515UL, 108979478UL, 3089716545UL, 2921391708UL, 2403595525UL, 3783697766UL, 2313991047UL, 3302598706UL, 1318323763UL, +}, +{ +1470380360UL, 3057428612UL, 2756676297UL, 1633786556UL, 4246459918UL, 2557524017UL, 1857180133UL, 618903690UL, 2475611092UL, 2621430634UL, 2084292404UL, 1698607774UL, 1788956972UL, 3375072220UL, 1499167056UL, 1218814632UL, 3699503479UL, 588281768UL, 3603925285UL, 1187721841UL, 1307962320UL, 2562217840UL, 3882506958UL, 2387033730UL, 2097027049UL, 1593669125UL, 1899433035UL, 4039983902UL, 1546854551UL, 1073191673UL, 3368453769UL, 3074694838UL, +534637095UL, 1860006723UL, 3416402670UL, 802354899UL, 3998709605UL, 3944315555UL, 3454226397UL, 1648185195UL, 488532673UL, 3063734121UL, 1318974867UL, 187087202UL, 200160693UL, 4170479404UL, 782764886UL, 4007973657UL, 1651636372UL, 3084151528UL, 2085263921UL, 2424937940UL, 230704223UL, 3342587983UL, 1093085714UL, 683877298UL, 3635026316UL, 3839461209UL, 2977567556UL, 3947448199UL, 3767172681UL, 1350679624UL, 3541409523UL, 3975162472UL, +2459379316UL, 3287828387UL, 1565768431UL, 3149625429UL, 1328627497UL, 2156355750UL, 112739894UL, 4052025045UL, 1396839113UL, 212349044UL, 110706825UL, 2185320852UL, 2540909191UL, 2129623107UL, 3515174750UL, 2669147508UL, 1243549180UL, 3996575850UL, 149304348UL, 2755670869UL, 930137412UL, 350687475UL, 1512442864UL, 3764389325UL, 3489308665UL, 276147411UL, 2268414314UL, 30674096UL, 3202650841UL, 3446821592UL, 3341145621UL, 3749209259UL, +674361204UL, 1384681012UL, 2716655878UL, 454169262UL, 289282175UL, 966029495UL, 3052791893UL, 3111969089UL, 1151599976UL, 3620936019UL, 1877909034UL, 1953262994UL, 4240669039UL, 1857402256UL, 3337397349UL, 2392730459UL, 1158928694UL, 1757447952UL, 2682284750UL, 2796982914UL, 1203210173UL, 797579212UL, 1645601877UL, 3579805998UL, 797556690UL, 4106236617UL, 1379943929UL, 129105346UL, 3950170317UL, 723231430UL, 88997404UL, 2591283275UL, +359831168UL, 306903531UL, 1987846974UL, 2654779951UL, 3724360049UL, 1693615498UL, 1095306415UL, 3586751806UL, 2045807380UL, 2779363615UL, 2912940562UL, 1557518560UL, 3620536996UL, 1723152132UL, 4087191232UL, 1042907094UL, 3210303305UL, 1536493323UL, 4094765090UL, 575328723UL, 359319532UL, 2458971265UL, 3159207510UL, 387883436UL, 2521400838UL, 2359639886UL, 261289463UL, 2094643916UL, 2269112547UL, 2387198764UL, 3619233779UL, 3019052785UL, +2910774311UL, 1470380360UL, 3057428612UL, 2756676297UL, 1633786556UL, 386502519UL, 2557524017UL, 1857180133UL, 618903690UL, 2475611092UL, 30080431UL, 2084292404UL, 1698607774UL, 1788956972UL, 3375072220UL, 1158684464UL, 1218814632UL, 3699503479UL, 588281768UL, 3603925285UL, 238328161UL, 1307962320UL, 2562217840UL, 3882506958UL, 2387033730UL, 3010587639UL, 1593669125UL, 1899433035UL, 4039983902UL, 1546854551UL, 4192218972UL, 3368453769UL, +3074694838UL, 534637095UL, 1860006723UL, 652336168UL, 802354899UL, 3998709605UL, 3944315555UL, 3454226397UL, 1926499185UL, 488532673UL, 3063734121UL, 1318974867UL, 187087202UL, 1106075322UL, 4170479404UL, 782764886UL, 4007973657UL, 1651636372UL, 2404132022UL, 2085263921UL, 2424937940UL, 230704223UL, 3342587983UL, 918664020UL, 683877298UL, 3635026316UL, 3839461209UL, 2977567556UL, 1943458501UL, 3767172681UL, 1350679624UL, 3541409523UL, +3975162472UL, 276593262UL, 3287828387UL, 1565768431UL, 3149625429UL, 1328627497UL, 1428675465UL, 112739894UL, 4052025045UL, 1396839113UL, 212349044UL, 4056830215UL, 2185320852UL, 2540909191UL, 2129623107UL, 3515174750UL, 1542171596UL, 1243549180UL, 3996575850UL, 149304348UL, 2755670869UL, 3578672658UL, 350687475UL, 1512442864UL, 3764389325UL, 3489308665UL, 1546094236UL, 2268414314UL, 30674096UL, 3202650841UL, 3446821592UL, 2954172575UL, +3749209259UL, 674361204UL, 1384681012UL, 2716655878UL, 3784818668UL, 289282175UL, 966029495UL, 3052791893UL, 3111969089UL, 4157356036UL, 3620936019UL, 1877909034UL, 1953262994UL, 4240669039UL, 558548232UL, 3337397349UL, 2392730459UL, 1158928694UL, 1757447952UL, 2764253876UL, 2796982914UL, 1203210173UL, 797579212UL, 1645601877UL, 1754284241UL, 797556690UL, 4106236617UL, 1379943929UL, 129105346UL, 1072954804UL, 723231430UL, 88997404UL, +2591283275UL, 359831168UL, 3790749526UL, 1987846974UL, 2654779951UL, 3724360049UL, 1693615498UL, 529478744UL, 3586751806UL, 2045807380UL, 2779363615UL, 2912940562UL, 3883779003UL, 3620536996UL, 1723152132UL, 4087191232UL, 1042907094UL, 2510614710UL, 1536493323UL, 4094765090UL, 575328723UL, 359319532UL, 4185709932UL, 3159207510UL, 387883436UL, 2521400838UL, 2359639886UL, 143795416UL, 2094643916UL, 2269112547UL, 2387198764UL, 3619233779UL, +2856133500UL, 2910774311UL, 1470380360UL, 3057428612UL, 2756676297UL, 1184346658UL, 386502519UL, 2557524017UL, 1857180133UL, 618903690UL, 113530176UL, 30080431UL, 2084292404UL, 1698607774UL, 1788956972UL, 1446640841UL, 1158684464UL, 1218814632UL, 3699503479UL, 588281768UL, 145530757UL, 238328161UL, 1307962320UL, 2562217840UL, 3882506958UL, 2145494995UL, 3010587639UL, 1593669125UL, 1899433035UL, 4039983902UL, 1668183055UL, 4192218972UL, +3368453769UL, 3074694838UL, 534637095UL, 1759744354UL, 652336168UL, 802354899UL, 3998709605UL, 3944315555UL, 3058692249UL, 1926499185UL, 488532673UL, 3063734121UL, 1318974867UL, 728549366UL, 1106075322UL, 4170479404UL, 782764886UL, 4007973657UL, 3270440405UL, 2404132022UL, 2085263921UL, 2424937940UL, 230704223UL, 3329510499UL, 918664020UL, 683877298UL, 3635026316UL, 3839461209UL, 79335966UL, 1943458501UL, 3767172681UL, 1350679624UL, +3541409523UL, 925084463UL, 276593262UL, 3287828387UL, 1565768431UL, 3149625429UL, 3775346659UL, 1428675465UL, 112739894UL, 4052025045UL, 1396839113UL, 865124022UL, 4056830215UL, 2185320852UL, 2540909191UL, 2129623107UL, 408329043UL, 1542171596UL, 1243549180UL, 3996575850UL, 149304348UL, 3549625626UL, 3578672658UL, 350687475UL, 1512442864UL, 3764389325UL, 2745315161UL, 1546094236UL, 2268414314UL, 30674096UL, 3202650841UL, 1591955495UL, +2954172575UL, 3749209259UL, 674361204UL, 1384681012UL, 4064148122UL, 3784818668UL, 289282175UL, 966029495UL, 3052791893UL, 1370867977UL, 4157356036UL, 3620936019UL, 1877909034UL, 1953262994UL, 4021792514UL, 558548232UL, 3337397349UL, 2392730459UL, 1158928694UL, 3155295174UL, 2764253876UL, 2796982914UL, 1203210173UL, 797579212UL, 3928348491UL, 1754284241UL, 797556690UL, 4106236617UL, 1379943929UL, 535801204UL, 1072954804UL, 723231430UL, +88997404UL, 2591283275UL, 3834650337UL, 3790749526UL, 1987846974UL, 2654779951UL, 3724360049UL, 1042046499UL, 529478744UL, 3586751806UL, 2045807380UL, 2779363615UL, 1125934487UL, 3883779003UL, 3620536996UL, 1723152132UL, 4087191232UL, 234512721UL, 2510614710UL, 1536493323UL, 4094765090UL, 575328723UL, 3997395999UL, 4185709932UL, 3159207510UL, 387883436UL, 2521400838UL, 3125399953UL, 143795416UL, 2094643916UL, 2269112547UL, 2387198764UL, +652167990UL, 2856133500UL, 2910774311UL, 1470380360UL, 3057428612UL, 2132157457UL, 1184346658UL, 386502519UL, 2557524017UL, 1857180133UL, 4131611047UL, 113530176UL, 30080431UL, 2084292404UL, 1698607774UL, 391246724UL, 1446640841UL, 1158684464UL, 1218814632UL, 3699503479UL, 2411874184UL, 145530757UL, 238328161UL, 1307962320UL, 2562217840UL, 2812151676UL, 2145494995UL, 3010587639UL, 1593669125UL, 1899433035UL, 2422208371UL, 1668183055UL, +4192218972UL, 3368453769UL, 3074694838UL, 2148785858UL, 1759744354UL, 652336168UL, 802354899UL, 3998709605UL, 1781938823UL, 3058692249UL, 1926499185UL, 488532673UL, 3063734121UL, 3539633540UL, 728549366UL, 1106075322UL, 4170479404UL, 782764886UL, 2780824417UL, 3270440405UL, 2404132022UL, 2085263921UL, 2424937940UL, 1908513596UL, 3329510499UL, 918664020UL, 683877298UL, 3635026316UL, 2918953355UL, 79335966UL, 1943458501UL, 3767172681UL, +1350679624UL, 341369607UL, 925084463UL, 276593262UL, 3287828387UL, 1565768431UL, 1957429498UL, 3775346659UL, 1428675465UL, 112739894UL, 4052025045UL, 1847440090UL, 865124022UL, 4056830215UL, 2185320852UL, 2540909191UL, 3477402775UL, 408329043UL, 1542171596UL, 1243549180UL, 3996575850UL, 179432054UL, 3549625626UL, 3578672658UL, 350687475UL, 1512442864UL, 2118138924UL, 2745315161UL, 1546094236UL, 2268414314UL, 30674096UL, 2317064191UL, +1591955495UL, 2954172575UL, 3749209259UL, 674361204UL, 3286542168UL, 4064148122UL, 3784818668UL, 289282175UL, 966029495UL, 1327408800UL, 1370867977UL, 4157356036UL, 3620936019UL, 1877909034UL, 405707683UL, 4021792514UL, 558548232UL, 3337397349UL, 2392730459UL, 3244675609UL, 3155295174UL, 2764253876UL, 2796982914UL, 1203210173UL, 2274948223UL, 3928348491UL, 1754284241UL, 797556690UL, 4106236617UL, 2665938417UL, 535801204UL, 1072954804UL, +723231430UL, 88997404UL, 3006584290UL, 3834650337UL, 3790749526UL, 1987846974UL, 2654779951UL, 4271242910UL, 1042046499UL, 529478744UL, 3586751806UL, 2045807380UL, 2283867237UL, 1125934487UL, 3883779003UL, 3620536996UL, 1723152132UL, 1761178713UL, 234512721UL, 2510614710UL, 1536493323UL, 4094765090UL, 2361030279UL, 3997395999UL, 4185709932UL, 3159207510UL, 387883436UL, 3979684113UL, 3125399953UL, 143795416UL, 2094643916UL, 2269112547UL, +1499026790UL, 2673871071UL, 3817604600UL, 2996498142UL, 1211396713UL, 4016438754UL, 992969238UL, 2196610884UL, 1333868752UL, 2722471337UL, 2178395143UL, 533478044UL, 291720336UL, 3552502714UL, 1060260388UL, 1389737501UL, 3508724089UL, 3106493936UL, 2013154532UL, 3169850047UL, 3773175439UL, 3604033115UL, 4234678017UL, 2903156223UL, 3832188501UL, 2874956773UL, 4283805552UL, 3664062691UL, 1974738248UL, 925764827UL, 1750660924UL, 141239116UL, +3273085573UL, 2427940522UL, 1962727892UL, 2493949152UL, 1043482688UL, 2345076260UL, 2209086707UL, 3642865193UL, 3119873884UL, 571850463UL, 1599484831UL, 76923002UL, 3077572436UL, 4086821865UL, 1523654720UL, 480304732UL, 476538774UL, 2169116383UL, 4033618691UL, 2819753414UL, 2856326003UL, 747450871UL, 1851448547UL, 713503330UL, 3709263622UL, 781002495UL, 1968749577UL, 2933719965UL, 4057398020UL, 3406593497UL, 689436820UL, 2935729647UL, +2030357428UL, 2075940397UL, 1830631914UL, 1093330800UL, 1706624613UL, 1805612947UL, 4257097124UL, 3233604448UL, 159450674UL, 1050507045UL, 566046625UL, 2253420120UL, 904902042UL, 1830037922UL, 4081490982UL, 1427186514UL, 2535536470UL, 3869316947UL, 4097476542UL, 930420754UL, 2519255367UL, 49908928UL, 454325685UL, 888118139UL, 3453892181UL, 1263601461UL, 1236190782UL, 674943665UL, 1648077470UL, 429399730UL, 2904879506UL, 3718410520UL, +1802183310UL, 1872553091UL, 605480672UL, 774749173UL, 3200570514UL, 181210046UL, 2560898144UL, 3947027625UL, 1535243167UL, 324801283UL, 4234744788UL, 746560316UL, 2456297875UL, 3925756080UL, 533997731UL, 3919796086UL, 662975152UL, 864661066UL, 1070894403UL, 1020445801UL, 1511298602UL, 4221508348UL, 3577952702UL, 4122306502UL, 2012051572UL, 1616168260UL, 2456901413UL, 2717726537UL, 840264605UL, 2687215223UL, 2174960097UL, 1239122603UL, +2890231920UL, 3365350767UL, 3998868598UL, 563137220UL, 893868530UL, 3400632172UL, 1538627830UL, 2812510298UL, 496662288UL, 2317289974UL, 2252393722UL, 1221289032UL, 2418100559UL, 402670890UL, 1528570045UL, 3160531718UL, 1806492066UL, 3211663975UL, 3617025598UL, 3664580463UL, 1338638297UL, 341637330UL, 2097019728UL, 4031221207UL, 503636424UL, 3883416740UL, 1530237682UL, 1152125396UL, 2845384901UL, 332460372UL, 457364876UL, 1738239808UL, +}, +{ +1118787884UL, 1884590246UL, 1007052798UL, 3717680750UL, 1609263052UL, 2486654530UL, 2761168910UL, 163554565UL, 3928803020UL, 2632714628UL, 1386788970UL, 2621928183UL, 2855206157UL, 2989018213UL, 1836814260UL, 4197635108UL, 1030118238UL, 2789863793UL, 2063944689UL, 1647608366UL, 255485979UL, 3657534664UL, 1317185871UL, 2410074449UL, 3971156607UL, 907575923UL, 4132859581UL, 416269582UL, 877554291UL, 633895348UL, 2236014545UL, 992386759UL, +3971362318UL, 2173597771UL, 1673339632UL, 1371742490UL, 2033574313UL, 3809530180UL, 319182848UL, 1562235776UL, 463522324UL, 1482338913UL, 1816432405UL, 3278626272UL, 1335179249UL, 171265751UL, 2249118654UL, 1153849045UL, 3013179633UL, 1450352108UL, 1267908572UL, 1138658121UL, 623675874UL, 3608469129UL, 978093004UL, 1283228910UL, 1810859539UL, 1179125634UL, 2939039286UL, 3862213960UL, 1168357273UL, 376788629UL, 314507445UL, 219039712UL, +463080619UL, 2994990779UL, 1035692306UL, 2228303916UL, 1280244913UL, 1965417315UL, 1815095408UL, 939691799UL, 3080056566UL, 3741305118UL, 1495905100UL, 65327713UL, 3884301346UL, 2536445014UL, 1503280354UL, 3398924419UL, 3678532805UL, 2616964783UL, 3168581019UL, 3553322118UL, 3023259169UL, 480342712UL, 451634742UL, 3562778450UL, 1943708078UL, 660077747UL, 434714388UL, 2369278293UL, 2894425895UL, 1919542250UL, 2469130567UL, 551196237UL, +4193980239UL, 2952382875UL, 3311173667UL, 2856797012UL, 2845888917UL, 1669184098UL, 3928626091UL, 2491577076UL, 3719464032UL, 2151963814UL, 3474431449UL, 3971510537UL, 3695841119UL, 2215238146UL, 3668152847UL, 1974578319UL, 2328185090UL, 2096356935UL, 3973692455UL, 3954842437UL, 422675402UL, 477894725UL, 3398641827UL, 1366451030UL, 1354642198UL, 3029840461UL, 35700837UL, 2937170986UL, 1336296570UL, 3508313874UL, 587724229UL, 2051237478UL, +3539754304UL, 1946154432UL, 2463932452UL, 144772179UL, 353408424UL, 3493806256UL, 3782958493UL, 1957797444UL, 228084488UL, 192277278UL, 3612092522UL, 2235069734UL, 467407503UL, 3391861572UL, 847810786UL, 1838763654UL, 2272109211UL, 3018265496UL, 4249218445UL, 1722760791UL, 3484353162UL, 3906437663UL, 4208966227UL, 2352549740UL, 714311566UL, 1346246305UL, 2865157059UL, 2989587005UL, 3946819548UL, 3109244860UL, 3885124598UL, 3314346978UL, +952826829UL, 1118787884UL, 1884590246UL, 1007052798UL, 3717680750UL, 1521451317UL, 2486654530UL, 2761168910UL, 163554565UL, 3928803020UL, 2299046195UL, 1386788970UL, 2621928183UL, 2855206157UL, 2989018213UL, 3048269905UL, 4197635108UL, 1030118238UL, 2789863793UL, 2063944689UL, 1814057352UL, 255485979UL, 3657534664UL, 1317185871UL, 2410074449UL, 4041610788UL, 907575923UL, 4132859581UL, 416269582UL, 877554291UL, 2338964683UL, 2236014545UL, +992386759UL, 3971362318UL, 2173597771UL, 579340117UL, 1371742490UL, 2033574313UL, 3809530180UL, 319182848UL, 3090313228UL, 463522324UL, 1482338913UL, 1816432405UL, 3278626272UL, 2418220643UL, 171265751UL, 2249118654UL, 1153849045UL, 3013179633UL, 2738647190UL, 1267908572UL, 1138658121UL, 623675874UL, 3608469129UL, 3096087202UL, 1283228910UL, 1810859539UL, 1179125634UL, 2939039286UL, 2601862091UL, 1168357273UL, 376788629UL, 314507445UL, +219039712UL, 1174181426UL, 2994990779UL, 1035692306UL, 2228303916UL, 1280244913UL, 752017703UL, 1815095408UL, 939691799UL, 3080056566UL, 3741305118UL, 126135654UL, 65327713UL, 3884301346UL, 2536445014UL, 1503280354UL, 955981361UL, 3678532805UL, 2616964783UL, 3168581019UL, 3553322118UL, 3772187171UL, 480342712UL, 451634742UL, 3562778450UL, 1943708078UL, 1466950454UL, 434714388UL, 2369278293UL, 2894425895UL, 1919542250UL, 317862862UL, +551196237UL, 4193980239UL, 2952382875UL, 3311173667UL, 12728591UL, 2845888917UL, 1669184098UL, 3928626091UL, 2491577076UL, 2742989641UL, 2151963814UL, 3474431449UL, 3971510537UL, 3695841119UL, 1005662613UL, 3668152847UL, 1974578319UL, 2328185090UL, 2096356935UL, 3629684995UL, 3954842437UL, 422675402UL, 477894725UL, 3398641827UL, 209352768UL, 1354642198UL, 3029840461UL, 35700837UL, 2937170986UL, 1660777984UL, 3508313874UL, 587724229UL, +2051237478UL, 3539754304UL, 3631430985UL, 2463932452UL, 144772179UL, 353408424UL, 3493806256UL, 3616422021UL, 1957797444UL, 228084488UL, 192277278UL, 3612092522UL, 3638977910UL, 467407503UL, 3391861572UL, 847810786UL, 1838763654UL, 2427237699UL, 3018265496UL, 4249218445UL, 1722760791UL, 3484353162UL, 2322365400UL, 4208966227UL, 2352549740UL, 714311566UL, 1346246305UL, 954101391UL, 2989587005UL, 3946819548UL, 3109244860UL, 3885124598UL, +420941376UL, 952826829UL, 1118787884UL, 1884590246UL, 1007052798UL, 539759724UL, 1521451317UL, 2486654530UL, 2761168910UL, 163554565UL, 1954997983UL, 2299046195UL, 1386788970UL, 2621928183UL, 2855206157UL, 3104695189UL, 3048269905UL, 4197635108UL, 1030118238UL, 2789863793UL, 3556473570UL, 1814057352UL, 255485979UL, 3657534664UL, 1317185871UL, 3004205219UL, 4041610788UL, 907575923UL, 4132859581UL, 416269582UL, 2980178044UL, 2338964683UL, +2236014545UL, 992386759UL, 3971362318UL, 2573125018UL, 579340117UL, 1371742490UL, 2033574313UL, 3809530180UL, 766585731UL, 3090313228UL, 463522324UL, 1482338913UL, 1816432405UL, 3101578277UL, 2418220643UL, 171265751UL, 2249118654UL, 1153849045UL, 2143267892UL, 2738647190UL, 1267908572UL, 1138658121UL, 623675874UL, 2944231951UL, 3096087202UL, 1283228910UL, 1810859539UL, 1179125634UL, 374714364UL, 2601862091UL, 1168357273UL, 376788629UL, +314507445UL, 1710922505UL, 1174181426UL, 2994990779UL, 1035692306UL, 2228303916UL, 3222680885UL, 752017703UL, 1815095408UL, 939691799UL, 3080056566UL, 1985366287UL, 126135654UL, 65327713UL, 3884301346UL, 2536445014UL, 3002467868UL, 955981361UL, 3678532805UL, 2616964783UL, 3168581019UL, 2173417616UL, 3772187171UL, 480342712UL, 451634742UL, 3562778450UL, 236095606UL, 1466950454UL, 434714388UL, 2369278293UL, 2894425895UL, 1766257461UL, +317862862UL, 551196237UL, 4193980239UL, 2952382875UL, 2416349742UL, 12728591UL, 2845888917UL, 1669184098UL, 3928626091UL, 2346338391UL, 2742989641UL, 2151963814UL, 3474431449UL, 3971510537UL, 942354812UL, 1005662613UL, 3668152847UL, 1974578319UL, 2328185090UL, 3234982376UL, 3629684995UL, 3954842437UL, 422675402UL, 477894725UL, 2931444539UL, 209352768UL, 1354642198UL, 3029840461UL, 35700837UL, 3388567298UL, 1660777984UL, 3508313874UL, +587724229UL, 2051237478UL, 1770178720UL, 3631430985UL, 2463932452UL, 144772179UL, 353408424UL, 3783114255UL, 3616422021UL, 1957797444UL, 228084488UL, 192277278UL, 611095909UL, 3638977910UL, 467407503UL, 3391861572UL, 847810786UL, 1413548572UL, 2427237699UL, 3018265496UL, 4249218445UL, 1722760791UL, 1487262638UL, 2322365400UL, 4208966227UL, 2352549740UL, 714311566UL, 1378213368UL, 954101391UL, 2989587005UL, 3946819548UL, 3109244860UL, +4183748384UL, 420941376UL, 952826829UL, 1118787884UL, 1884590246UL, 2199811809UL, 539759724UL, 1521451317UL, 2486654530UL, 2761168910UL, 1100080647UL, 1954997983UL, 2299046195UL, 1386788970UL, 2621928183UL, 916352763UL, 3104695189UL, 3048269905UL, 4197635108UL, 1030118238UL, 369866139UL, 3556473570UL, 1814057352UL, 255485979UL, 3657534664UL, 2916985473UL, 3004205219UL, 4041610788UL, 907575923UL, 4132859581UL, 3856599532UL, 2980178044UL, +2338964683UL, 2236014545UL, 992386759UL, 3393662326UL, 2573125018UL, 579340117UL, 1371742490UL, 2033574313UL, 1938766053UL, 766585731UL, 3090313228UL, 463522324UL, 1482338913UL, 2122086302UL, 3101578277UL, 2418220643UL, 171265751UL, 2249118654UL, 952602228UL, 2143267892UL, 2738647190UL, 1267908572UL, 1138658121UL, 1808026803UL, 2944231951UL, 3096087202UL, 1283228910UL, 1810859539UL, 3881666794UL, 374714364UL, 2601862091UL, 1168357273UL, +376788629UL, 728738466UL, 1710922505UL, 1174181426UL, 2994990779UL, 1035692306UL, 74930675UL, 3222680885UL, 752017703UL, 1815095408UL, 939691799UL, 3404352271UL, 1985366287UL, 126135654UL, 65327713UL, 3884301346UL, 1822629733UL, 3002467868UL, 955981361UL, 3678532805UL, 2616964783UL, 3865359567UL, 2173417616UL, 3772187171UL, 480342712UL, 451634742UL, 1099609112UL, 236095606UL, 1466950454UL, 434714388UL, 2369278293UL, 2671873359UL, +1766257461UL, 317862862UL, 551196237UL, 4193980239UL, 2006763654UL, 2416349742UL, 12728591UL, 2845888917UL, 1669184098UL, 2492983893UL, 2346338391UL, 2742989641UL, 2151963814UL, 3474431449UL, 2095232649UL, 942354812UL, 1005662613UL, 3668152847UL, 1974578319UL, 1748794756UL, 3234982376UL, 3629684995UL, 3954842437UL, 422675402UL, 2291986911UL, 2931444539UL, 209352768UL, 1354642198UL, 3029840461UL, 3772709822UL, 3388567298UL, 1660777984UL, +3508313874UL, 587724229UL, 2759789003UL, 1770178720UL, 3631430985UL, 2463932452UL, 144772179UL, 1572181309UL, 3783114255UL, 3616422021UL, 1957797444UL, 228084488UL, 4106643586UL, 611095909UL, 3638977910UL, 467407503UL, 3391861572UL, 927151111UL, 1413548572UL, 2427237699UL, 3018265496UL, 4249218445UL, 692575565UL, 1487262638UL, 2322365400UL, 4208966227UL, 2352549740UL, 1281886506UL, 1378213368UL, 954101391UL, 2989587005UL, 3946819548UL, +1861811740UL, 1484768905UL, 359662140UL, 4058479705UL, 1306547382UL, 514617018UL, 1685692791UL, 3370601554UL, 2920029077UL, 447798803UL, 3124262580UL, 1841693810UL, 583764638UL, 853545489UL, 2614348705UL, 1445696741UL, 4226719361UL, 1299450005UL, 7404137UL, 3158806368UL, 3487160245UL, 1410910965UL, 3697116584UL, 4272452035UL, 832215403UL, 4190877996UL, 2360539465UL, 1011144434UL, 546018244UL, 613443074UL, 2523894977UL, 998991923UL, +2569220540UL, 4221264346UL, 2627827148UL, 2606458015UL, 261584257UL, 4172552877UL, 1174774061UL, 1040006970UL, 2378868955UL, 1539192255UL, 1322624483UL, 3221782707UL, 3352886416UL, 3634686692UL, 65447704UL, 3962131218UL, 839088053UL, 4154193716UL, 1211888926UL, 319402483UL, 3922826413UL, 3799829447UL, 623726612UL, 1586183272UL, 1853729462UL, 2621029589UL, 708558605UL, 1618007233UL, 2784732545UL, 953859039UL, 921654620UL, 477148727UL, +3592256598UL, 2772318818UL, 1460772911UL, 1309227716UL, 3484274262UL, 3425161241UL, 1677052569UL, 2238155114UL, 2828087292UL, 2361598991UL, 4283732706UL, 1530059373UL, 1564048492UL, 243829114UL, 104328994UL, 3080249237UL, 2054985396UL, 408961407UL, 2978652320UL, 2412674552UL, 3794618070UL, 3644862703UL, 2095186402UL, 3294126752UL, 2970218740UL, 1800713612UL, 3806665216UL, 3990918051UL, 142666452UL, 531078813UL, 1079142774UL, 3437358350UL, +635943961UL, 255576894UL, 2991317718UL, 1208676456UL, 247449774UL, 454879171UL, 113230697UL, 3064123371UL, 336269028UL, 1137083842UL, 959568850UL, 2508623991UL, 3338418112UL, 2660268938UL, 1318010299UL, 3950178561UL, 1078499199UL, 1176289535UL, 3875152821UL, 1984420952UL, 1134199826UL, 2944539174UL, 3667625203UL, 2034152216UL, 1648355307UL, 2376447620UL, 2967418253UL, 185143450UL, 889002925UL, 3999315013UL, 661455858UL, 4026799358UL, +3626504428UL, 3544795311UL, 3642718771UL, 2467387138UL, 1034249749UL, 2051371333UL, 4251353248UL, 1575036366UL, 751400924UL, 2906720214UL, 1210002606UL, 916508568UL, 1728487600UL, 2478884914UL, 3081526615UL, 1867135009UL, 1955998382UL, 701713417UL, 512784398UL, 1255240210UL, 3665676113UL, 1771754697UL, 4000392442UL, 3342268855UL, 2677221913UL, 369054145UL, 4011912082UL, 748537647UL, 1626721797UL, 852497405UL, 168721778UL, 3091138383UL, +}, +{ +3781228998UL, 1787582256UL, 838267218UL, 2710632450UL, 690892139UL, 2484870604UL, 4151302318UL, 1844787776UL, 727768263UL, 1075391038UL, 1842903369UL, 2927332301UL, 3246688068UL, 1234715005UL, 2906526190UL, 3369636401UL, 3091858538UL, 3320767682UL, 920496809UL, 1406803705UL, 3163880457UL, 1540551653UL, 2733620168UL, 2588558057UL, 147277542UL, 803170440UL, 821275940UL, 3897549272UL, 151390608UL, 951639139UL, 904639695UL, 1106545578UL, +1514893712UL, 998760135UL, 2557458623UL, 4109877399UL, 578824730UL, 2174064027UL, 3352513900UL, 3206168298UL, 911932439UL, 2030004973UL, 3283902592UL, 3755877921UL, 250434692UL, 352122318UL, 977153640UL, 642640734UL, 2555395772UL, 2307695537UL, 2593565626UL, 3738143618UL, 734614254UL, 3276420511UL, 2636087597UL, 4157371578UL, 1082026387UL, 429736987UL, 3755125580UL, 1935957937UL, 3300547146UL, 3089498232UL, 4167244256UL, 1619189426UL, +1094447351UL, 1061842570UL, 3666470174UL, 810916769UL, 2263633079UL, 3863543843UL, 1804937521UL, 2774236887UL, 2858593613UL, 961498236UL, 1515309045UL, 1564424234UL, 2276602447UL, 2540994858UL, 78621171UL, 3575132456UL, 2958793283UL, 387554009UL, 688827573UL, 3833764146UL, 2611524056UL, 2296780370UL, 2411775612UL, 3790615886UL, 3399757437UL, 1385198595UL, 1005364336UL, 2093159919UL, 2091827252UL, 1461775197UL, 4225171212UL, 1185831033UL, +12264437UL, 1313835999UL, 556653278UL, 917105970UL, 1471530347UL, 2010243509UL, 3097827138UL, 1399987735UL, 273352191UL, 2505795417UL, 1336824946UL, 3358720963UL, 2874295267UL, 2282349617UL, 3478581038UL, 4027859424UL, 713597958UL, 4059691816UL, 2812811116UL, 2291324146UL, 932688463UL, 3001334051UL, 2028368589UL, 830582457UL, 3964293916UL, 4276849132UL, 1828058403UL, 1351688755UL, 2113265048UL, 42517349UL, 3100438883UL, 1137792178UL, +1479076106UL, 463377892UL, 3964913740UL, 2422362185UL, 436113863UL, 2044139049UL, 4197323265UL, 3275185975UL, 2655265571UL, 1674107588UL, 1496360114UL, 3642050139UL, 1739051417UL, 2393774399UL, 250035802UL, 10186306UL, 263338568UL, 3899157617UL, 3679157076UL, 2258085991UL, 1407319575UL, 899008067UL, 3679828833UL, 711086272UL, 2952963707UL, 3373894808UL, 445540851UL, 3405637490UL, 1343291195UL, 730888681UL, 507768703UL, 3473963321UL, +1779803564UL, 3781228998UL, 1787582256UL, 838267218UL, 2710632450UL, 2431224659UL, 2484870604UL, 4151302318UL, 1844787776UL, 727768263UL, 4012573268UL, 1842903369UL, 2927332301UL, 3246688068UL, 1234715005UL, 3405161215UL, 3369636401UL, 3091858538UL, 3320767682UL, 920496809UL, 400609988UL, 3163880457UL, 1540551653UL, 2733620168UL, 2588558057UL, 2137935937UL, 803170440UL, 821275940UL, 3897549272UL, 151390608UL, 194431797UL, 904639695UL, +1106545578UL, 1514893712UL, 998760135UL, 62528087UL, 4109877399UL, 578824730UL, 2174064027UL, 3352513900UL, 3495516649UL, 911932439UL, 2030004973UL, 3283902592UL, 3755877921UL, 1774462108UL, 352122318UL, 977153640UL, 642640734UL, 2555395772UL, 756528792UL, 2593565626UL, 3738143618UL, 734614254UL, 3276420511UL, 4086313763UL, 4157371578UL, 1082026387UL, 429736987UL, 3755125580UL, 526056489UL, 3300547146UL, 3089498232UL, 4167244256UL, +1619189426UL, 82235109UL, 1061842570UL, 3666470174UL, 810916769UL, 2263633079UL, 1110270726UL, 1804937521UL, 2774236887UL, 2858593613UL, 961498236UL, 1840197918UL, 1564424234UL, 2276602447UL, 2540994858UL, 78621171UL, 3690913528UL, 2958793283UL, 387554009UL, 688827573UL, 3833764146UL, 3626285597UL, 2296780370UL, 2411775612UL, 3790615886UL, 3399757437UL, 1561545830UL, 1005364336UL, 2093159919UL, 2091827252UL, 1461775197UL, 63358970UL, +1185831033UL, 12264437UL, 1313835999UL, 556653278UL, 3918754976UL, 1471530347UL, 2010243509UL, 3097827138UL, 1399987735UL, 2767111911UL, 2505795417UL, 1336824946UL, 3358720963UL, 2874295267UL, 902314853UL, 3478581038UL, 4027859424UL, 713597958UL, 4059691816UL, 1462989647UL, 2291324146UL, 932688463UL, 3001334051UL, 2028368589UL, 3594712587UL, 3964293916UL, 4276849132UL, 1828058403UL, 1351688755UL, 2571513800UL, 42517349UL, 3100438883UL, +1137792178UL, 1479076106UL, 140519541UL, 3964913740UL, 2422362185UL, 436113863UL, 2044139049UL, 226785542UL, 3275185975UL, 2655265571UL, 1674107588UL, 1496360114UL, 46428973UL, 1739051417UL, 2393774399UL, 250035802UL, 10186306UL, 4118320101UL, 3899157617UL, 3679157076UL, 2258085991UL, 1407319575UL, 4267866849UL, 3679828833UL, 711086272UL, 2952963707UL, 3373894808UL, 3662249794UL, 3405637490UL, 1343291195UL, 730888681UL, 507768703UL, +2930510271UL, 1779803564UL, 3781228998UL, 1787582256UL, 838267218UL, 1817693489UL, 2431224659UL, 2484870604UL, 4151302318UL, 1844787776UL, 1788220652UL, 4012573268UL, 1842903369UL, 2927332301UL, 3246688068UL, 2050648011UL, 3405161215UL, 3369636401UL, 3091858538UL, 3320767682UL, 241001958UL, 400609988UL, 3163880457UL, 1540551653UL, 2733620168UL, 3857223520UL, 2137935937UL, 803170440UL, 821275940UL, 3897549272UL, 1451986523UL, 194431797UL, +904639695UL, 1106545578UL, 1514893712UL, 4147878244UL, 62528087UL, 4109877399UL, 578824730UL, 2174064027UL, 461571251UL, 3495516649UL, 911932439UL, 2030004973UL, 3283902592UL, 1580354765UL, 1774462108UL, 352122318UL, 977153640UL, 642640734UL, 1019387737UL, 756528792UL, 2593565626UL, 3738143618UL, 734614254UL, 999431451UL, 4086313763UL, 4157371578UL, 1082026387UL, 429736987UL, 140091634UL, 526056489UL, 3300547146UL, 3089498232UL, +4167244256UL, 3202763095UL, 82235109UL, 1061842570UL, 3666470174UL, 810916769UL, 3663992550UL, 1110270726UL, 1804937521UL, 2774236887UL, 2858593613UL, 2203639366UL, 1840197918UL, 1564424234UL, 2276602447UL, 2540994858UL, 978199281UL, 3690913528UL, 2958793283UL, 387554009UL, 688827573UL, 375113876UL, 3626285597UL, 2296780370UL, 2411775612UL, 3790615886UL, 1277897939UL, 1561545830UL, 1005364336UL, 2093159919UL, 2091827252UL, 1631078873UL, +63358970UL, 1185831033UL, 12264437UL, 1313835999UL, 3872277948UL, 3918754976UL, 1471530347UL, 2010243509UL, 3097827138UL, 1291836608UL, 2767111911UL, 2505795417UL, 1336824946UL, 3358720963UL, 3954754615UL, 902314853UL, 3478581038UL, 4027859424UL, 713597958UL, 2198246306UL, 1462989647UL, 2291324146UL, 932688463UL, 3001334051UL, 2374736511UL, 3594712587UL, 3964293916UL, 4276849132UL, 1828058403UL, 3619038368UL, 2571513800UL, 42517349UL, +3100438883UL, 1137792178UL, 1146435746UL, 140519541UL, 3964913740UL, 2422362185UL, 436113863UL, 3460540392UL, 226785542UL, 3275185975UL, 2655265571UL, 1674107588UL, 1288223861UL, 46428973UL, 1739051417UL, 2393774399UL, 250035802UL, 1986226858UL, 4118320101UL, 3899157617UL, 3679157076UL, 2258085991UL, 551117761UL, 4267866849UL, 3679828833UL, 711086272UL, 2952963707UL, 1667866621UL, 3662249794UL, 3405637490UL, 1343291195UL, 730888681UL, +2381246695UL, 2930510271UL, 1779803564UL, 3781228998UL, 1787582256UL, 1236367773UL, 1817693489UL, 2431224659UL, 2484870604UL, 4151302318UL, 2902321811UL, 1788220652UL, 4012573268UL, 1842903369UL, 2927332301UL, 1185539274UL, 2050648011UL, 3405161215UL, 3369636401UL, 3091858538UL, 4240555382UL, 241001958UL, 400609988UL, 3163880457UL, 1540551653UL, 2539098607UL, 3857223520UL, 2137935937UL, 803170440UL, 821275940UL, 3485313735UL, 1451986523UL, +194431797UL, 904639695UL, 1106545578UL, 1633417190UL, 4147878244UL, 62528087UL, 4109877399UL, 578824730UL, 3671726812UL, 461571251UL, 3495516649UL, 911932439UL, 2030004973UL, 2002341352UL, 1580354765UL, 1774462108UL, 352122318UL, 977153640UL, 170033402UL, 1019387737UL, 756528792UL, 2593565626UL, 3738143618UL, 4160516213UL, 999431451UL, 4086313763UL, 4157371578UL, 1082026387UL, 1423352480UL, 140091634UL, 526056489UL, 3300547146UL, +3089498232UL, 4266971502UL, 3202763095UL, 82235109UL, 1061842570UL, 3666470174UL, 945994616UL, 3663992550UL, 1110270726UL, 1804937521UL, 2774236887UL, 3776581315UL, 2203639366UL, 1840197918UL, 1564424234UL, 2276602447UL, 928117829UL, 978199281UL, 3690913528UL, 2958793283UL, 387554009UL, 2817496615UL, 375113876UL, 3626285597UL, 2296780370UL, 2411775612UL, 1346030561UL, 1277897939UL, 1561545830UL, 1005364336UL, 2093159919UL, 821902776UL, +1631078873UL, 63358970UL, 1185831033UL, 12264437UL, 3192617499UL, 3872277948UL, 3918754976UL, 1471530347UL, 2010243509UL, 4011062105UL, 1291836608UL, 2767111911UL, 2505795417UL, 1336824946UL, 1593119272UL, 3954754615UL, 902314853UL, 3478581038UL, 4027859424UL, 1163079365UL, 2198246306UL, 1462989647UL, 2291324146UL, 932688463UL, 4018333691UL, 2374736511UL, 3594712587UL, 3964293916UL, 4276849132UL, 3902062310UL, 3619038368UL, 2571513800UL, +42517349UL, 3100438883UL, 1645455709UL, 1146435746UL, 140519541UL, 3964913740UL, 2422362185UL, 3338363150UL, 3460540392UL, 226785542UL, 3275185975UL, 2655265571UL, 3789582441UL, 1288223861UL, 46428973UL, 1739051417UL, 2393774399UL, 2257001236UL, 1986226858UL, 4118320101UL, 3899157617UL, 3679157076UL, 3707520907UL, 551117761UL, 4267866849UL, 3679828833UL, 711086272UL, 570153549UL, 1667866621UL, 3662249794UL, 3405637490UL, 1343291195UL, +112368058UL, 2615115584UL, 2865130041UL, 357584504UL, 528807633UL, 1816055434UL, 2854850066UL, 190222907UL, 1014915859UL, 3472967123UL, 2605782564UL, 3353130066UL, 540430076UL, 2087143725UL, 1571283916UL, 1604766425UL, 934199876UL, 3359569795UL, 4168578472UL, 1745876717UL, 277026333UL, 2679446726UL, 3582165485UL, 3954458991UL, 2615245404UL, 2410035461UL, 3442004248UL, 2814474875UL, 1734556428UL, 2653422310UL, 4033890533UL, 2373774914UL, +3011118469UL, 1276695464UL, 2995405818UL, 782363735UL, 2242531852UL, 4206829780UL, 1486885236UL, 3764707851UL, 1945614253UL, 1147926733UL, 701960774UL, 3435251514UL, 3626050187UL, 3587799538UL, 2399216643UL, 3217822006UL, 3600044386UL, 648239752UL, 2997947488UL, 1754097052UL, 4109638936UL, 3413714077UL, 1038375790UL, 3394259389UL, 2284776380UL, 2711956471UL, 1278424040UL, 1272230764UL, 3980809660UL, 1983901240UL, 894405781UL, 582621606UL, +1274260631UL, 763432985UL, 1862236664UL, 10249416UL, 3838574116UL, 1912270458UL, 3491686662UL, 2696669149UL, 312119069UL, 1812714569UL, 2729307370UL, 3045249652UL, 303684944UL, 503720764UL, 4029412414UL, 4101616421UL, 3484358948UL, 1261027935UL, 145713434UL, 2918444923UL, 2099546237UL, 3173693583UL, 3498398823UL, 3769717769UL, 2860220116UL, 2919562911UL, 1221047715UL, 1749384742UL, 1018968146UL, 2771587474UL, 2746107326UL, 1182859751UL, +2403805226UL, 2206395932UL, 1500348209UL, 1762634532UL, 3017223998UL, 2043185588UL, 2124568729UL, 1619852613UL, 3248258238UL, 3393223375UL, 644860154UL, 2465108160UL, 2358875673UL, 3643741304UL, 1891106916UL, 416443047UL, 3298583974UL, 1030877276UL, 2839390034UL, 4181398645UL, 1845333999UL, 3643365079UL, 1993116780UL, 1763857175UL, 1951718545UL, 3785659537UL, 4156412284UL, 4138026128UL, 3480291142UL, 54280556UL, 4169041146UL, 3130638398UL, +3236816184UL, 3559898998UL, 916420843UL, 938920758UL, 3425021599UL, 1528477728UL, 3597939783UL, 3516249439UL, 936528538UL, 4174817780UL, 2541489033UL, 3962368135UL, 2054336507UL, 2610093970UL, 3613025255UL, 3583905994UL, 2990129491UL, 332823408UL, 2505138276UL, 3811707598UL, 373987627UL, 4263703898UL, 1668946560UL, 3213253899UL, 2673819338UL, 1631405099UL, 3127443274UL, 549232331UL, 21447814UL, 1647238011UL, 3093799993UL, 1922712395UL, +}, +{ +4224788259UL, 3569487556UL, 1080137041UL, 2788623569UL, 856160888UL, 2195536417UL, 3030463035UL, 2906439247UL, 896055051UL, 1967105456UL, 2093562169UL, 2919742950UL, 546374698UL, 1372591815UL, 3773616637UL, 349073007UL, 1331102855UL, 3035367896UL, 1222622311UL, 2266618592UL, 74466398UL, 1140488004UL, 855606859UL, 3803728487UL, 3589743162UL, 2748402856UL, 1044387368UL, 1494850922UL, 2242660891UL, 3111566003UL, 2013737074UL, 163276737UL, +1526772858UL, 3047139947UL, 3150695453UL, 2583795468UL, 3628272447UL, 305282258UL, 2151108134UL, 2905708853UL, 1052800761UL, 3354632338UL, 1017036861UL, 2453680791UL, 2673902555UL, 1622154585UL, 2893733051UL, 3888482522UL, 306284440UL, 3245137245UL, 3480776670UL, 2865396581UL, 3571456526UL, 3284891766UL, 1393584874UL, 1057867320UL, 2888126310UL, 3302325443UL, 4135187530UL, 1770789166UL, 1615533805UL, 1438727397UL, 2921922012UL, 3156703516UL, +435047591UL, 2999350446UL, 575044884UL, 1001339111UL, 625824120UL, 2489346227UL, 2104489492UL, 2494528446UL, 1141458836UL, 4048430074UL, 2599022749UL, 2438694106UL, 1443850072UL, 3321658999UL, 87870515UL, 958195816UL, 380666771UL, 3062272732UL, 4178548642UL, 4274603044UL, 888566831UL, 3386636024UL, 1636806704UL, 2400069397UL, 3003029365UL, 1953620944UL, 3278772216UL, 1562778171UL, 2767090642UL, 14436957UL, 913966574UL, 1724553886UL, +2015261135UL, 4191296122UL, 1688939147UL, 110865735UL, 2913800286UL, 4131469475UL, 315962755UL, 1531174227UL, 1226678476UL, 3446400266UL, 3896297836UL, 539834883UL, 2871306264UL, 3333932675UL, 2229436010UL, 1928458456UL, 464682640UL, 1786180352UL, 162599143UL, 817038005UL, 3146256537UL, 1676400403UL, 2484731087UL, 702610427UL, 4005124049UL, 1691076958UL, 1268494739UL, 4093608833UL, 3757213737UL, 2627839929UL, 2884764386UL, 1548110665UL, +3361745333UL, 3955318088UL, 3264527857UL, 3969225726UL, 968269281UL, 2630991382UL, 2716444139UL, 1071781623UL, 3704437685UL, 1511193802UL, 843840414UL, 1277966236UL, 4141095880UL, 715016637UL, 1255888181UL, 1321941951UL, 1180174408UL, 1021629824UL, 3395369301UL, 3912221525UL, 2611782663UL, 4038117717UL, 2253029302UL, 974431991UL, 347200257UL, 886823557UL, 2275848777UL, 3732452739UL, 3708953729UL, 2688020866UL, 4185175489UL, 99605353UL, +2387945286UL, 4224788259UL, 3569487556UL, 1080137041UL, 2788623569UL, 238715294UL, 2195536417UL, 3030463035UL, 2906439247UL, 896055051UL, 3061240402UL, 2093562169UL, 2919742950UL, 546374698UL, 1372591815UL, 851057115UL, 349073007UL, 1331102855UL, 3035367896UL, 1222622311UL, 3305595574UL, 74466398UL, 1140488004UL, 855606859UL, 3803728487UL, 3838112757UL, 2748402856UL, 1044387368UL, 1494850922UL, 2242660891UL, 1038286760UL, 2013737074UL, +163276737UL, 1526772858UL, 3047139947UL, 3518918891UL, 2583795468UL, 3628272447UL, 305282258UL, 2151108134UL, 3555155951UL, 1052800761UL, 3354632338UL, 1017036861UL, 2453680791UL, 2394691836UL, 1622154585UL, 2893733051UL, 3888482522UL, 306284440UL, 2055552069UL, 3480776670UL, 2865396581UL, 3571456526UL, 3284891766UL, 1179339312UL, 1057867320UL, 2888126310UL, 3302325443UL, 4135187530UL, 683364318UL, 1615533805UL, 1438727397UL, 2921922012UL, +3156703516UL, 1333086260UL, 2999350446UL, 575044884UL, 1001339111UL, 625824120UL, 576119652UL, 2104489492UL, 2494528446UL, 1141458836UL, 4048430074UL, 786660788UL, 2438694106UL, 1443850072UL, 3321658999UL, 87870515UL, 457955380UL, 380666771UL, 3062272732UL, 4178548642UL, 4274603044UL, 2256710588UL, 3386636024UL, 1636806704UL, 2400069397UL, 3003029365UL, 3733049985UL, 3278772216UL, 1562778171UL, 2767090642UL, 14436957UL, 530062778UL, +1724553886UL, 2015261135UL, 4191296122UL, 1688939147UL, 2981240708UL, 2913800286UL, 4131469475UL, 315962755UL, 1531174227UL, 2433363617UL, 3446400266UL, 3896297836UL, 539834883UL, 2871306264UL, 2597546929UL, 2229436010UL, 1928458456UL, 464682640UL, 1786180352UL, 1165821797UL, 817038005UL, 3146256537UL, 1676400403UL, 2484731087UL, 3239493343UL, 4005124049UL, 1691076958UL, 1268494739UL, 4093608833UL, 2088690204UL, 2627839929UL, 2884764386UL, +1548110665UL, 3361745333UL, 1075350364UL, 3264527857UL, 3969225726UL, 968269281UL, 2630991382UL, 4103280359UL, 1071781623UL, 3704437685UL, 1511193802UL, 843840414UL, 1340474980UL, 4141095880UL, 715016637UL, 1255888181UL, 1321941951UL, 2512565938UL, 1021629824UL, 3395369301UL, 3912221525UL, 2611782663UL, 2287272047UL, 2253029302UL, 974431991UL, 347200257UL, 886823557UL, 3775715445UL, 3732452739UL, 3708953729UL, 2688020866UL, 4185175489UL, +2151114047UL, 2387945286UL, 4224788259UL, 3569487556UL, 1080137041UL, 879682447UL, 238715294UL, 2195536417UL, 3030463035UL, 2906439247UL, 3975397430UL, 3061240402UL, 2093562169UL, 2919742950UL, 546374698UL, 1928060945UL, 851057115UL, 349073007UL, 1331102855UL, 3035367896UL, 1148668613UL, 3305595574UL, 74466398UL, 1140488004UL, 855606859UL, 917923571UL, 3838112757UL, 2748402856UL, 1044387368UL, 1494850922UL, 995791756UL, 1038286760UL, +2013737074UL, 163276737UL, 1526772858UL, 1944370085UL, 3518918891UL, 2583795468UL, 3628272447UL, 305282258UL, 685261037UL, 3555155951UL, 1052800761UL, 3354632338UL, 1017036861UL, 1620076466UL, 2394691836UL, 1622154585UL, 2893733051UL, 3888482522UL, 4119309151UL, 2055552069UL, 3480776670UL, 2865396581UL, 3571456526UL, 4008552940UL, 1179339312UL, 1057867320UL, 2888126310UL, 3302325443UL, 2359989247UL, 683364318UL, 1615533805UL, 1438727397UL, +2921922012UL, 2092991022UL, 1333086260UL, 2999350446UL, 575044884UL, 1001339111UL, 2406217399UL, 576119652UL, 2104489492UL, 2494528446UL, 1141458836UL, 1856565466UL, 786660788UL, 2438694106UL, 1443850072UL, 3321658999UL, 2752588925UL, 457955380UL, 380666771UL, 3062272732UL, 4178548642UL, 1354877973UL, 2256710588UL, 3386636024UL, 1636806704UL, 2400069397UL, 2275777233UL, 3733049985UL, 3278772216UL, 1562778171UL, 2767090642UL, 3438624166UL, +530062778UL, 1724553886UL, 2015261135UL, 4191296122UL, 3842215040UL, 2981240708UL, 2913800286UL, 4131469475UL, 315962755UL, 2891870900UL, 2433363617UL, 3446400266UL, 3896297836UL, 539834883UL, 1390877376UL, 2597546929UL, 2229436010UL, 1928458456UL, 464682640UL, 1405678725UL, 1165821797UL, 817038005UL, 3146256537UL, 1676400403UL, 9522151UL, 3239493343UL, 4005124049UL, 1691076958UL, 1268494739UL, 4076978821UL, 2088690204UL, 2627839929UL, +2884764386UL, 1548110665UL, 3713129550UL, 1075350364UL, 3264527857UL, 3969225726UL, 968269281UL, 2669129178UL, 4103280359UL, 1071781623UL, 3704437685UL, 1511193802UL, 2032747975UL, 1340474980UL, 4141095880UL, 715016637UL, 1255888181UL, 1290704077UL, 2512565938UL, 1021629824UL, 3395369301UL, 3912221525UL, 767420943UL, 2287272047UL, 2253029302UL, 974431991UL, 347200257UL, 940587649UL, 3775715445UL, 3732452739UL, 3708953729UL, 2688020866UL, +1603856534UL, 2151114047UL, 2387945286UL, 4224788259UL, 3569487556UL, 4060395365UL, 879682447UL, 238715294UL, 2195536417UL, 3030463035UL, 774839173UL, 3975397430UL, 3061240402UL, 2093562169UL, 2919742950UL, 77503099UL, 1928060945UL, 851057115UL, 349073007UL, 1331102855UL, 4216140027UL, 1148668613UL, 3305595574UL, 74466398UL, 1140488004UL, 1728766104UL, 917923571UL, 3838112757UL, 2748402856UL, 1044387368UL, 1408900577UL, 995791756UL, +1038286760UL, 2013737074UL, 163276737UL, 936142172UL, 1944370085UL, 3518918891UL, 2583795468UL, 3628272447UL, 1701372078UL, 685261037UL, 3555155951UL, 1052800761UL, 3354632338UL, 2951922777UL, 1620076466UL, 2394691836UL, 1622154585UL, 2893733051UL, 2494523614UL, 4119309151UL, 2055552069UL, 3480776670UL, 2865396581UL, 3031455484UL, 4008552940UL, 1179339312UL, 1057867320UL, 2888126310UL, 2970791558UL, 2359989247UL, 683364318UL, 1615533805UL, +1438727397UL, 3697460033UL, 2092991022UL, 1333086260UL, 2999350446UL, 575044884UL, 2712063736UL, 2406217399UL, 576119652UL, 2104489492UL, 2494528446UL, 1096189230UL, 1856565466UL, 786660788UL, 2438694106UL, 1443850072UL, 3615481975UL, 2752588925UL, 457955380UL, 380666771UL, 3062272732UL, 2387056252UL, 1354877973UL, 2256710588UL, 3386636024UL, 1636806704UL, 517188972UL, 2275777233UL, 3733049985UL, 3278772216UL, 1562778171UL, 3436331606UL, +3438624166UL, 530062778UL, 1724553886UL, 2015261135UL, 1711407722UL, 3842215040UL, 2981240708UL, 2913800286UL, 4131469475UL, 878455086UL, 2891870900UL, 2433363617UL, 3446400266UL, 3896297836UL, 4251949215UL, 1390877376UL, 2597546929UL, 2229436010UL, 1928458456UL, 719826541UL, 1405678725UL, 1165821797UL, 817038005UL, 3146256537UL, 3883590627UL, 9522151UL, 3239493343UL, 4005124049UL, 1691076958UL, 893183073UL, 4076978821UL, 2088690204UL, +2627839929UL, 2884764386UL, 3312769297UL, 3713129550UL, 1075350364UL, 3264527857UL, 3969225726UL, 4161107579UL, 2669129178UL, 4103280359UL, 1071781623UL, 3704437685UL, 1400940789UL, 2032747975UL, 1340474980UL, 4141095880UL, 715016637UL, 1705234794UL, 1290704077UL, 2512565938UL, 1021629824UL, 3395369301UL, 2934074199UL, 767420943UL, 2287272047UL, 2253029302UL, 974431991UL, 3060035390UL, 940587649UL, 3775715445UL, 3732452739UL, 3708953729UL, +3489160434UL, 3200799223UL, 340420813UL, 2539294182UL, 2619616318UL, 456806966UL, 4272538790UL, 2994564124UL, 2757588894UL, 3493053179UL, 2946195469UL, 1402305257UL, 2266356503UL, 3512914478UL, 273195440UL, 3579761455UL, 862317458UL, 1894959361UL, 42596779UL, 376641729UL, 782820755UL, 716528645UL, 222675565UL, 4038035195UL, 311038326UL, 395780597UL, 2025474869UL, 404396572UL, 4138962756UL, 2441107014UL, 3525378401UL, 947085768UL, +3758218091UL, 3185789607UL, 638283508UL, 3802505926UL, 830259842UL, 1086400881UL, 3444485UL, 142418107UL, 4283468141UL, 1669846189UL, 955065888UL, 3864384467UL, 73139517UL, 136809048UL, 1444329434UL, 174974637UL, 3303183786UL, 282216656UL, 3114827080UL, 3811060015UL, 1610640996UL, 3824096289UL, 1123437514UL, 3826582808UL, 39407702UL, 2437666463UL, 2454206642UL, 830758422UL, 4190092654UL, 1941090912UL, 224373276UL, 3704201239UL, +3284012568UL, 4056152539UL, 1022047941UL, 1077111803UL, 3028336675UL, 3207391465UL, 3459202233UL, 1991240724UL, 4184491520UL, 1851863093UL, 1038639595UL, 1392247730UL, 2113875749UL, 1162388509UL, 2629935260UL, 3545260772UL, 991928712UL, 4064775043UL, 4180493781UL, 2134685922UL, 642853690UL, 290065503UL, 1629968UL, 3150373868UL, 3110755428UL, 2254306163UL, 421928533UL, 11426979UL, 3042809169UL, 786868170UL, 1287942583UL, 1851107769UL, +1444903906UL, 4150950197UL, 3737798306UL, 2848738554UL, 505924220UL, 2944131627UL, 2639930627UL, 1339887691UL, 2382166850UL, 2668971315UL, 3944739049UL, 2217612340UL, 4142682607UL, 997824216UL, 123465626UL, 844518179UL, 1161486362UL, 2706162053UL, 2966530827UL, 4103639053UL, 1837121393UL, 909648429UL, 298619078UL, 2057042454UL, 3613272637UL, 3609349032UL, 1664428748UL, 1871510359UL, 58508710UL, 1079418100UL, 3278870121UL, 3821562746UL, +16654909UL, 2530580589UL, 3361874982UL, 629910009UL, 2124761646UL, 2508133604UL, 1954315500UL, 3019833617UL, 141617625UL, 1653192078UL, 1541695589UL, 1223978475UL, 3875963510UL, 3028691587UL, 3450826564UL, 2185849120UL, 1956475624UL, 3053842172UL, 3550887830UL, 2672339803UL, 176823785UL, 913229929UL, 681399502UL, 2256486297UL, 2881672598UL, 597153273UL, 2782767695UL, 1133158067UL, 4126077325UL, 3456027404UL, 754062201UL, 4069172986UL, +}, +{ +2441935114UL, 3465447683UL, 2897229686UL, 3845380309UL, 1199633364UL, 495424232UL, 2490548037UL, 581670528UL, 2467171733UL, 2200094863UL, 2163927790UL, 3895792830UL, 2097210789UL, 1606544633UL, 1305562517UL, 4072525389UL, 3256142090UL, 349440478UL, 3920932491UL, 2462464051UL, 1075951496UL, 2835763703UL, 1593198055UL, 2380945625UL, 543531323UL, 3182766507UL, 2927484354UL, 2877470578UL, 4153923603UL, 2443156156UL, 1168544900UL, 888955615UL, +3605412824UL, 1336677864UL, 3256116974UL, 2884036014UL, 4070749843UL, 2989661773UL, 1095584023UL, 1370834065UL, 3534389580UL, 312378113UL, 3190819203UL, 1247574926UL, 2046019470UL, 3536918510UL, 1479030180UL, 847820646UL, 3992973956UL, 3827223401UL, 4113429617UL, 3504933502UL, 295000614UL, 2238923504UL, 3485717254UL, 290246351UL, 1064210816UL, 2848539559UL, 2617134888UL, 422213010UL, 2796674561UL, 3568250500UL, 2736237915UL, 3950756060UL, +1527249993UL, 3603540278UL, 4115393386UL, 2851621193UL, 4230341156UL, 905168850UL, 3916344126UL, 1496013046UL, 206343742UL, 2894205125UL, 1082918859UL, 2746480417UL, 3077328661UL, 1209440053UL, 3258293856UL, 1032236533UL, 3043332566UL, 446879604UL, 587022214UL, 1614371566UL, 3040899994UL, 3686422145UL, 937325128UL, 1968833679UL, 169086151UL, 4075432555UL, 1196046411UL, 3101745581UL, 4228079966UL, 2942213563UL, 1195005323UL, 1673491641UL, +1762746534UL, 3641827252UL, 694590905UL, 1828365460UL, 513716230UL, 3106485486UL, 2441593994UL, 4044462965UL, 3628121101UL, 3957990629UL, 179764922UL, 579361186UL, 3474393871UL, 2474241006UL, 4031850878UL, 3120409532UL, 4011587898UL, 3682942579UL, 3257272830UL, 3097029759UL, 2652540191UL, 1128762588UL, 1040256382UL, 2743736716UL, 334893087UL, 1892049031UL, 2603159239UL, 3712772023UL, 2126593224UL, 3465793906UL, 3180780589UL, 725740783UL, +3728108967UL, 573931936UL, 137996587UL, 110756053UL, 3984787930UL, 3773232816UL, 3406981985UL, 1783088630UL, 2080089781UL, 195827466UL, 1409073281UL, 867635355UL, 3049533211UL, 486687054UL, 2570137956UL, 527522011UL, 1084454084UL, 1019222771UL, 1415565066UL, 650794786UL, 629618803UL, 1237709131UL, 1241899078UL, 2751644247UL, 2792313337UL, 649402117UL, 275078659UL, 752459111UL, 2173220853UL, 3207031798UL, 821073585UL, 3005400729UL, +1085152012UL, 2441935114UL, 3465447683UL, 2897229686UL, 3845380309UL, 3573898488UL, 495424232UL, 2490548037UL, 581670528UL, 2467171733UL, 1208279791UL, 2163927790UL, 3895792830UL, 2097210789UL, 1606544633UL, 2148733343UL, 4072525389UL, 3256142090UL, 349440478UL, 3920932491UL, 657289255UL, 1075951496UL, 2835763703UL, 1593198055UL, 2380945625UL, 149487931UL, 3182766507UL, 2927484354UL, 2877470578UL, 4153923603UL, 606130344UL, 1168544900UL, +888955615UL, 3605412824UL, 1336677864UL, 53448770UL, 2884036014UL, 4070749843UL, 2989661773UL, 1095584023UL, 2766144383UL, 3534389580UL, 312378113UL, 3190819203UL, 1247574926UL, 1530609481UL, 3536918510UL, 1479030180UL, 847820646UL, 3992973956UL, 154171325UL, 4113429617UL, 3504933502UL, 295000614UL, 2238923504UL, 282708664UL, 290246351UL, 1064210816UL, 2848539559UL, 2617134888UL, 36906646UL, 2796674561UL, 3568250500UL, 2736237915UL, +3950756060UL, 3416260072UL, 3603540278UL, 4115393386UL, 2851621193UL, 4230341156UL, 448215287UL, 3916344126UL, 1496013046UL, 206343742UL, 2894205125UL, 2420861244UL, 2746480417UL, 3077328661UL, 1209440053UL, 3258293856UL, 2545287695UL, 3043332566UL, 446879604UL, 587022214UL, 1614371566UL, 958587333UL, 3686422145UL, 937325128UL, 1968833679UL, 169086151UL, 154576725UL, 1196046411UL, 3101745581UL, 4228079966UL, 2942213563UL, 2487464668UL, +1673491641UL, 1762746534UL, 3641827252UL, 694590905UL, 3754606623UL, 513716230UL, 3106485486UL, 2441593994UL, 4044462965UL, 3064108377UL, 3957990629UL, 179764922UL, 579361186UL, 3474393871UL, 2138270428UL, 4031850878UL, 3120409532UL, 4011587898UL, 3682942579UL, 4015980199UL, 3097029759UL, 2652540191UL, 1128762588UL, 1040256382UL, 3908621649UL, 334893087UL, 1892049031UL, 2603159239UL, 3712772023UL, 3291038350UL, 3465793906UL, 3180780589UL, +725740783UL, 3728108967UL, 436976908UL, 137996587UL, 110756053UL, 3984787930UL, 3773232816UL, 1000054791UL, 1783088630UL, 2080089781UL, 195827466UL, 1409073281UL, 3036813614UL, 3049533211UL, 486687054UL, 2570137956UL, 527522011UL, 3669951690UL, 1019222771UL, 1415565066UL, 650794786UL, 629618803UL, 4140569538UL, 1241899078UL, 2751644247UL, 2792313337UL, 649402117UL, 2946582304UL, 752459111UL, 2173220853UL, 3207031798UL, 821073585UL, +1738142977UL, 1085152012UL, 2441935114UL, 3465447683UL, 2897229686UL, 2707197334UL, 3573898488UL, 495424232UL, 2490548037UL, 581670528UL, 2365865647UL, 1208279791UL, 2163927790UL, 3895792830UL, 2097210789UL, 3219551420UL, 2148733343UL, 4072525389UL, 3256142090UL, 349440478UL, 3706519197UL, 657289255UL, 1075951496UL, 2835763703UL, 1593198055UL, 2200084531UL, 149487931UL, 3182766507UL, 2927484354UL, 2877470578UL, 2394288661UL, 606130344UL, +1168544900UL, 888955615UL, 3605412824UL, 1503975597UL, 53448770UL, 2884036014UL, 4070749843UL, 2989661773UL, 243605110UL, 2766144383UL, 3534389580UL, 312378113UL, 3190819203UL, 2398088088UL, 1530609481UL, 3536918510UL, 1479030180UL, 847820646UL, 2940281320UL, 154171325UL, 4113429617UL, 3504933502UL, 295000614UL, 3078701806UL, 282708664UL, 290246351UL, 1064210816UL, 2848539559UL, 3960345380UL, 36906646UL, 2796674561UL, 3568250500UL, +2736237915UL, 2657034787UL, 3416260072UL, 3603540278UL, 4115393386UL, 2851621193UL, 3847740427UL, 448215287UL, 3916344126UL, 1496013046UL, 206343742UL, 3419083433UL, 2420861244UL, 2746480417UL, 3077328661UL, 1209440053UL, 3824237152UL, 2545287695UL, 3043332566UL, 446879604UL, 587022214UL, 506352928UL, 958587333UL, 3686422145UL, 937325128UL, 1968833679UL, 1808935939UL, 154576725UL, 1196046411UL, 3101745581UL, 4228079966UL, 709576348UL, +2487464668UL, 1673491641UL, 1762746534UL, 3641827252UL, 3968332142UL, 3754606623UL, 513716230UL, 3106485486UL, 2441593994UL, 1453443785UL, 3064108377UL, 3957990629UL, 179764922UL, 579361186UL, 1454621561UL, 2138270428UL, 4031850878UL, 3120409532UL, 4011587898UL, 898119245UL, 4015980199UL, 3097029759UL, 2652540191UL, 1128762588UL, 1131456853UL, 3908621649UL, 334893087UL, 1892049031UL, 2603159239UL, 4280222837UL, 3291038350UL, 3465793906UL, +3180780589UL, 725740783UL, 1515867399UL, 436976908UL, 137996587UL, 110756053UL, 3984787930UL, 1295994548UL, 1000054791UL, 1783088630UL, 2080089781UL, 195827466UL, 252558267UL, 3036813614UL, 3049533211UL, 486687054UL, 2570137956UL, 786434419UL, 3669951690UL, 1019222771UL, 1415565066UL, 650794786UL, 1316734597UL, 4140569538UL, 1241899078UL, 2751644247UL, 2792313337UL, 4014748337UL, 2946582304UL, 752459111UL, 2173220853UL, 3207031798UL, +2903407363UL, 1738142977UL, 1085152012UL, 2441935114UL, 3465447683UL, 1082984764UL, 2707197334UL, 3573898488UL, 495424232UL, 2490548037UL, 240094068UL, 2365865647UL, 1208279791UL, 2163927790UL, 3895792830UL, 1107651215UL, 3219551420UL, 2148733343UL, 4072525389UL, 3256142090UL, 681942656UL, 3706519197UL, 657289255UL, 1075951496UL, 2835763703UL, 2172774506UL, 2200084531UL, 149487931UL, 3182766507UL, 2927484354UL, 3069592433UL, 2394288661UL, +606130344UL, 1168544900UL, 888955615UL, 757163746UL, 1503975597UL, 53448770UL, 2884036014UL, 4070749843UL, 1705538727UL, 243605110UL, 2766144383UL, 3534389580UL, 312378113UL, 2256467250UL, 2398088088UL, 1530609481UL, 3536918510UL, 1479030180UL, 1360826079UL, 2940281320UL, 154171325UL, 4113429617UL, 3504933502UL, 714934244UL, 3078701806UL, 282708664UL, 290246351UL, 1064210816UL, 3694453051UL, 3960345380UL, 36906646UL, 2796674561UL, +3568250500UL, 3400481963UL, 2657034787UL, 3416260072UL, 3603540278UL, 4115393386UL, 1466632735UL, 3847740427UL, 448215287UL, 3916344126UL, 1496013046UL, 2893537514UL, 3419083433UL, 2420861244UL, 2746480417UL, 3077328661UL, 2815979224UL, 3824237152UL, 2545287695UL, 3043332566UL, 446879604UL, 3719452721UL, 506352928UL, 958587333UL, 3686422145UL, 937325128UL, 2653904510UL, 1808935939UL, 154576725UL, 1196046411UL, 3101745581UL, 425411544UL, +709576348UL, 2487464668UL, 1673491641UL, 1762746534UL, 1960605594UL, 3968332142UL, 3754606623UL, 513716230UL, 3106485486UL, 2881551071UL, 1453443785UL, 3064108377UL, 3957990629UL, 179764922UL, 1408218536UL, 1454621561UL, 2138270428UL, 4031850878UL, 3120409532UL, 3700386494UL, 898119245UL, 4015980199UL, 3097029759UL, 2652540191UL, 2181464767UL, 1131456853UL, 3908621649UL, 334893087UL, 1892049031UL, 4220220071UL, 4280222837UL, 3291038350UL, +3465793906UL, 3180780589UL, 1737123182UL, 1515867399UL, 436976908UL, 137996587UL, 110756053UL, 1360813614UL, 1295994548UL, 1000054791UL, 1783088630UL, 2080089781UL, 1019367341UL, 252558267UL, 3036813614UL, 3049533211UL, 486687054UL, 387915679UL, 786434419UL, 3669951690UL, 1019222771UL, 1415565066UL, 4267042909UL, 1316734597UL, 4140569538UL, 1241899078UL, 2751644247UL, 3622120385UL, 4014748337UL, 2946582304UL, 752459111UL, 2173220853UL, +1128460687UL, 2268047031UL, 239933818UL, 4141570430UL, 1318816940UL, 2378987660UL, 731877825UL, 3950952879UL, 2975574698UL, 2938375136UL, 431933385UL, 154404673UL, 2020658234UL, 846815781UL, 822137193UL, 1057315444UL, 3632584082UL, 3263363094UL, 942201956UL, 2704683551UL, 1768107067UL, 4009446092UL, 3090701064UL, 701246680UL, 3548419575UL, 3873366129UL, 1639833080UL, 2401253373UL, 66597794UL, 2515774132UL, 516246524UL, 4232115668UL, +34426096UL, 2206423458UL, 3628832867UL, 2776950121UL, 2782943544UL, 2058958317UL, 1805852726UL, 2151415233UL, 2940074103UL, 2318397273UL, 3067676663UL, 3127709351UL, 71509976UL, 115529187UL, 1841252918UL, 2217805156UL, 733917373UL, 2432474677UL, 1416887641UL, 1895320369UL, 2779694586UL, 510547269UL, 2614743018UL, 759552691UL, 2264773752UL, 305497497UL, 1082013785UL, 1681067734UL, 1085957001UL, 846460632UL, 2824079919UL, 1820633139UL, +3686495295UL, 3978521319UL, 1734452426UL, 4105472656UL, 1771256166UL, 1578071897UL, 1972844727UL, 2048372515UL, 3002132226UL, 1889169118UL, 2932142799UL, 2166712623UL, 592016143UL, 1116895096UL, 889321536UL, 375621825UL, 2935845994UL, 1982459859UL, 3336799370UL, 294519309UL, 2661638345UL, 1089335942UL, 227150969UL, 1454919198UL, 3780503305UL, 1862290968UL, 1491836299UL, 766546986UL, 3638407467UL, 925906735UL, 208891816UL, 236714698UL, +2853181150UL, 3889751556UL, 2161215392UL, 853579433UL, 2131555681UL, 1396396345UL, 1088128136UL, 978252562UL, 2134024308UL, 2429920974UL, 1159468871UL, 2395949266UL, 1441791888UL, 916521377UL, 3950270431UL, 2663319810UL, 3873120593UL, 2080989388UL, 2896532502UL, 3176181708UL, 1736685126UL, 4081767288UL, 3515770288UL, 1371473598UL, 1491850178UL, 4284949727UL, 2774513541UL, 1541596000UL, 3948112869UL, 2114538326UL, 2641532252UL, 1837244955UL, +2292505300UL, 3179787565UL, 639953781UL, 785902378UL, 3852544833UL, 553508260UL, 23014564UL, 106722100UL, 2705412979UL, 3449440367UL, 950636401UL, 870804158UL, 629831074UL, 424163855UL, 373653940UL, 2739378330UL, 377730945UL, 418426029UL, 267367218UL, 554678849UL, 4222664331UL, 3346048120UL, 1870226737UL, 2435616108UL, 3747040233UL, 698046507UL, 1671346285UL, 4127293033UL, 568612264UL, 3467142937UL, 1627988025UL, 1305525598UL, +}, +{ +2246605826UL, 215030128UL, 871645668UL, 3402612852UL, 423273439UL, 316965236UL, 47416561UL, 1470716454UL, 2288582385UL, 2021890755UL, 2148091363UL, 167227868UL, 3085506034UL, 3365950545UL, 1170282137UL, 1345986409UL, 197195155UL, 2644113318UL, 2491271090UL, 2597072003UL, 170335901UL, 2540851884UL, 2584420407UL, 3609142920UL, 3052130502UL, 4018095157UL, 2850805299UL, 2777821400UL, 110647395UL, 3262987676UL, 1447103309UL, 3632575579UL, +3243210595UL, 1892770504UL, 4214485953UL, 38676169UL, 2431628817UL, 2836918800UL, 272023527UL, 2825888902UL, 2794421955UL, 2354379386UL, 452404203UL, 584718212UL, 1915053836UL, 1455821656UL, 4264066935UL, 1150980581UL, 3792433350UL, 3104909316UL, 441521402UL, 3807587668UL, 275969953UL, 3970844623UL, 3323695518UL, 3909107329UL, 290225599UL, 957520066UL, 4048181850UL, 2623778463UL, 1957371891UL, 540091753UL, 3072448879UL, 2386916346UL, +392549194UL, 1261391184UL, 4137605148UL, 314807135UL, 2916930821UL, 3168561018UL, 2332027308UL, 1967082817UL, 1849256214UL, 1141134412UL, 1206824012UL, 2088102210UL, 4170914605UL, 3399892824UL, 59190648UL, 1657183299UL, 1314626253UL, 500606287UL, 413229420UL, 1245395908UL, 664681UL, 2726979120UL, 3408998445UL, 2318397638UL, 1882820077UL, 2073055266UL, 4262833629UL, 1348801932UL, 229857331UL, 3086071450UL, 1327801028UL, 812015573UL, +2214355282UL, 2232635690UL, 3162540418UL, 2049877621UL, 470752564UL, 2527480795UL, 1285499716UL, 220173566UL, 4239277569UL, 788168494UL, 3748855859UL, 1360707769UL, 449512212UL, 1238219398UL, 2880205975UL, 2755133627UL, 372409230UL, 411800575UL, 2455333195UL, 4080817864UL, 3556684908UL, 2857940866UL, 1969081563UL, 2526852668UL, 1026062474UL, 1849785784UL, 3552290093UL, 4214448UL, 460332681UL, 30890894UL, 1108618048UL, 272438799UL, +3339891045UL, 1512685591UL, 1310038443UL, 2431938882UL, 1478442144UL, 2804640700UL, 3426381347UL, 861206186UL, 290322827UL, 2736623609UL, 327318125UL, 1922859957UL, 1939922519UL, 3539608908UL, 3442377433UL, 3868710131UL, 2244493875UL, 47774461UL, 3858864626UL, 3294523981UL, 1798515481UL, 565017248UL, 2633378137UL, 811307482UL, 1743357106UL, 419676111UL, 1688841846UL, 1799884674UL, 1720546272UL, 3900863156UL, 3506303345UL, 1719438472UL, +576775454UL, 2246605826UL, 215030128UL, 871645668UL, 3402612852UL, 619000856UL, 316965236UL, 47416561UL, 1470716454UL, 2288582385UL, 3464704266UL, 2148091363UL, 167227868UL, 3085506034UL, 3365950545UL, 901169164UL, 1345986409UL, 197195155UL, 2644113318UL, 2491271090UL, 3243741640UL, 170335901UL, 2540851884UL, 2584420407UL, 3609142920UL, 2051834116UL, 4018095157UL, 2850805299UL, 2777821400UL, 110647395UL, 2822981113UL, 1447103309UL, +3632575579UL, 3243210595UL, 1892770504UL, 1947501555UL, 38676169UL, 2431628817UL, 2836918800UL, 272023527UL, 4010280501UL, 2794421955UL, 2354379386UL, 452404203UL, 584718212UL, 3991257933UL, 1455821656UL, 4264066935UL, 1150980581UL, 3792433350UL, 2151631692UL, 441521402UL, 3807587668UL, 275969953UL, 3970844623UL, 3965914153UL, 3909107329UL, 290225599UL, 957520066UL, 4048181850UL, 4011285909UL, 1957371891UL, 540091753UL, 3072448879UL, +2386916346UL, 1347453316UL, 1261391184UL, 4137605148UL, 314807135UL, 2916930821UL, 840822698UL, 2332027308UL, 1967082817UL, 1849256214UL, 1141134412UL, 960593185UL, 2088102210UL, 4170914605UL, 3399892824UL, 59190648UL, 2261593014UL, 1314626253UL, 500606287UL, 413229420UL, 1245395908UL, 3401527918UL, 2726979120UL, 3408998445UL, 2318397638UL, 1882820077UL, 1683077666UL, 4262833629UL, 1348801932UL, 229857331UL, 3086071450UL, 3363644507UL, +812015573UL, 2214355282UL, 2232635690UL, 3162540418UL, 3579858747UL, 470752564UL, 2527480795UL, 1285499716UL, 220173566UL, 2294101261UL, 788168494UL, 3748855859UL, 1360707769UL, 449512212UL, 28595866UL, 2880205975UL, 2755133627UL, 372409230UL, 411800575UL, 1905311140UL, 4080817864UL, 3556684908UL, 2857940866UL, 1969081563UL, 148561593UL, 1026062474UL, 1849785784UL, 3552290093UL, 4214448UL, 2237247821UL, 30890894UL, 1108618048UL, +272438799UL, 3339891045UL, 169576507UL, 1310038443UL, 2431938882UL, 1478442144UL, 2804640700UL, 4119485855UL, 861206186UL, 290322827UL, 2736623609UL, 327318125UL, 3408620608UL, 1939922519UL, 3539608908UL, 3442377433UL, 3868710131UL, 1188056275UL, 47774461UL, 3858864626UL, 3294523981UL, 1798515481UL, 1228896851UL, 2633378137UL, 811307482UL, 1743357106UL, 419676111UL, 3111013241UL, 1799884674UL, 1720546272UL, 3900863156UL, 3506303345UL, +1474164586UL, 576775454UL, 2246605826UL, 215030128UL, 871645668UL, 2968519387UL, 619000856UL, 316965236UL, 47416561UL, 1470716454UL, 9648980UL, 3464704266UL, 2148091363UL, 167227868UL, 3085506034UL, 1505294373UL, 901169164UL, 1345986409UL, 197195155UL, 2644113318UL, 1227359150UL, 3243741640UL, 170335901UL, 2540851884UL, 2584420407UL, 1205921163UL, 2051834116UL, 4018095157UL, 2850805299UL, 2777821400UL, 2967529310UL, 2822981113UL, +1447103309UL, 3632575579UL, 3243210595UL, 532996977UL, 1947501555UL, 38676169UL, 2431628817UL, 2836918800UL, 1761031313UL, 4010280501UL, 2794421955UL, 2354379386UL, 452404203UL, 1222630846UL, 3991257933UL, 1455821656UL, 4264066935UL, 1150980581UL, 2344548386UL, 2151631692UL, 441521402UL, 3807587668UL, 275969953UL, 963889269UL, 3965914153UL, 3909107329UL, 290225599UL, 957520066UL, 4176220201UL, 4011285909UL, 1957371891UL, 540091753UL, +3072448879UL, 1810164615UL, 1347453316UL, 1261391184UL, 4137605148UL, 314807135UL, 2672526663UL, 840822698UL, 2332027308UL, 1967082817UL, 1849256214UL, 734862208UL, 960593185UL, 2088102210UL, 4170914605UL, 3399892824UL, 2471507530UL, 2261593014UL, 1314626253UL, 500606287UL, 413229420UL, 970185057UL, 3401527918UL, 2726979120UL, 3408998445UL, 2318397638UL, 708987193UL, 1683077666UL, 4262833629UL, 1348801932UL, 229857331UL, 749849397UL, +3363644507UL, 812015573UL, 2214355282UL, 2232635690UL, 2901095495UL, 3579858747UL, 470752564UL, 2527480795UL, 1285499716UL, 941862108UL, 2294101261UL, 788168494UL, 3748855859UL, 1360707769UL, 3818227212UL, 28595866UL, 2880205975UL, 2755133627UL, 372409230UL, 570110534UL, 1905311140UL, 4080817864UL, 3556684908UL, 2857940866UL, 2253777974UL, 148561593UL, 1026062474UL, 1849785784UL, 3552290093UL, 1525559608UL, 2237247821UL, 30890894UL, +1108618048UL, 272438799UL, 3996203631UL, 169576507UL, 1310038443UL, 2431938882UL, 1478442144UL, 2857841871UL, 4119485855UL, 861206186UL, 290322827UL, 2736623609UL, 1184217272UL, 3408620608UL, 1939922519UL, 3539608908UL, 3442377433UL, 1263700272UL, 1188056275UL, 47774461UL, 3858864626UL, 3294523981UL, 2611619UL, 1228896851UL, 2633378137UL, 811307482UL, 1743357106UL, 1930089302UL, 3111013241UL, 1799884674UL, 1720546272UL, 3900863156UL, +2370003471UL, 1474164586UL, 576775454UL, 2246605826UL, 215030128UL, 540197019UL, 2968519387UL, 619000856UL, 316965236UL, 47416561UL, 3585128733UL, 9648980UL, 3464704266UL, 2148091363UL, 167227868UL, 509283324UL, 1505294373UL, 901169164UL, 1345986409UL, 197195155UL, 3983525470UL, 1227359150UL, 3243741640UL, 170335901UL, 2540851884UL, 2812935262UL, 1205921163UL, 2051834116UL, 4018095157UL, 2850805299UL, 2798430304UL, 2967529310UL, +2822981113UL, 1447103309UL, 3632575579UL, 389184524UL, 532996977UL, 1947501555UL, 38676169UL, 2431628817UL, 1055068556UL, 1761031313UL, 4010280501UL, 2794421955UL, 2354379386UL, 965687576UL, 1222630846UL, 3991257933UL, 1455821656UL, 4264066935UL, 1551000086UL, 2344548386UL, 2151631692UL, 441521402UL, 3807587668UL, 3701529910UL, 963889269UL, 3965914153UL, 3909107329UL, 290225599UL, 1771599976UL, 4176220201UL, 4011285909UL, 1957371891UL, +540091753UL, 1670159873UL, 1810164615UL, 1347453316UL, 1261391184UL, 4137605148UL, 4191698993UL, 2672526663UL, 840822698UL, 2332027308UL, 1967082817UL, 3098515331UL, 734862208UL, 960593185UL, 2088102210UL, 4170914605UL, 2470055060UL, 2471507530UL, 2261593014UL, 1314626253UL, 500606287UL, 1100764382UL, 970185057UL, 3401527918UL, 2726979120UL, 3408998445UL, 4100198161UL, 708987193UL, 1683077666UL, 4262833629UL, 1348801932UL, 3744209503UL, +749849397UL, 3363644507UL, 812015573UL, 2214355282UL, 3217409412UL, 2901095495UL, 3579858747UL, 470752564UL, 2527480795UL, 552979949UL, 941862108UL, 2294101261UL, 788168494UL, 3748855859UL, 2355231228UL, 3818227212UL, 28595866UL, 2880205975UL, 2755133627UL, 833553378UL, 570110534UL, 1905311140UL, 4080817864UL, 3556684908UL, 4124102038UL, 2253777974UL, 148561593UL, 1026062474UL, 1849785784UL, 656329297UL, 1525559608UL, 2237247821UL, +30890894UL, 1108618048UL, 1464443032UL, 3996203631UL, 169576507UL, 1310038443UL, 2431938882UL, 2100788071UL, 2857841871UL, 4119485855UL, 861206186UL, 290322827UL, 3653047356UL, 1184217272UL, 3408620608UL, 1939922519UL, 3539608908UL, 4267170500UL, 1263700272UL, 1188056275UL, 47774461UL, 3858864626UL, 1046565728UL, 2611619UL, 1228896851UL, 2633378137UL, 811307482UL, 1312393456UL, 1930089302UL, 3111013241UL, 1799884674UL, 1720546272UL, +1199041144UL, 2406753856UL, 2108495166UL, 2126345981UL, 1524975128UL, 1269232392UL, 3162531748UL, 3076707658UL, 1736955170UL, 1036221745UL, 1232435193UL, 3945348482UL, 1057631163UL, 520376289UL, 4154435769UL, 1280565077UL, 1865705876UL, 1030078366UL, 1140849319UL, 1769263412UL, 1161866807UL, 2768552980UL, 561022685UL, 2712685799UL, 1501252058UL, 3608433719UL, 3138564149UL, 4093654128UL, 1218455911UL, 892700607UL, 2012017510UL, 3568315757UL, +4002239824UL, 1754440379UL, 2641708101UL, 1027390781UL, 199831087UL, 1261208885UL, 2058433786UL, 2101649235UL, 220966013UL, 3445375335UL, 1100438514UL, 4075559840UL, 4244062658UL, 3417249884UL, 150102478UL, 3337395219UL, 2464869101UL, 3720375949UL, 93353579UL, 2329780067UL, 777826834UL, 2745626035UL, 2984812746UL, 568848158UL, 1593919595UL, 1166619196UL, 96177504UL, 305329591UL, 4271176854UL, 3829149188UL, 1551058535UL, 2828280993UL, +1367551996UL, 4208083082UL, 2260803683UL, 3118708147UL, 434935608UL, 702805370UL, 3544156958UL, 792712531UL, 231019757UL, 136272259UL, 4049968615UL, 2722527811UL, 603697698UL, 2891035509UL, 4270409302UL, 1220615076UL, 1932569338UL, 1084454986UL, 468729683UL, 2377913518UL, 2068946556UL, 530579176UL, 1422294615UL, 4032799503UL, 2065706770UL, 604700228UL, 98049660UL, 3182511353UL, 935830212UL, 1938107848UL, 1266035034UL, 957505506UL, +2758220503UL, 1805223938UL, 3393041584UL, 3958541336UL, 2695487012UL, 3355668819UL, 276889675UL, 3098939423UL, 415941187UL, 180737121UL, 2638873657UL, 1103150707UL, 4255168358UL, 2736183195UL, 1275942292UL, 2687807236UL, 538129710UL, 3337005391UL, 3941968393UL, 1113153386UL, 3813628384UL, 1775835369UL, 296314749UL, 1697642748UL, 3614403315UL, 1953056095UL, 2102878063UL, 3161706344UL, 2207159580UL, 3078233525UL, 3836286614UL, 886914072UL, +1884037075UL, 4135819784UL, 1616380780UL, 1672616998UL, 3879848699UL, 2277472209UL, 3933249848UL, 2428044648UL, 2876076879UL, 165724720UL, 2277165385UL, 1984963196UL, 1456923194UL, 2406217222UL, 3388886718UL, 47522558UL, 1903557801UL, 1959641458UL, 2325355446UL, 3251147398UL, 2266553941UL, 2243962024UL, 1420017618UL, 1791159474UL, 1793406225UL, 601509698UL, 3207357979UL, 1189285184UL, 148538800UL, 2077251302UL, 3267239327UL, 2851475997UL, +}, +{ +2628162153UL, 3861478870UL, 2769884494UL, 3423483820UL, 1118276924UL, 536776894UL, 3742490940UL, 550084334UL, 2441329856UL, 2604618499UL, 2308745810UL, 1178166365UL, 1345165241UL, 4039508109UL, 1246601384UL, 3843182157UL, 2200144237UL, 91750284UL, 4290064840UL, 3363597477UL, 3243492274UL, 4271100308UL, 4186328336UL, 2291901989UL, 1834723222UL, 372220743UL, 2190417067UL, 2624886324UL, 3567647862UL, 1591175369UL, 2278087682UL, 2461678432UL, +232820452UL, 2714694382UL, 3070258434UL, 2412655444UL, 2667664607UL, 249083056UL, 4166379751UL, 1360927521UL, 2247816079UL, 3253689753UL, 1563674427UL, 1914999382UL, 2101454952UL, 1067816947UL, 1098201917UL, 4054175236UL, 1805828534UL, 1815913104UL, 738357340UL, 2597170030UL, 1689737432UL, 2004663483UL, 1160995461UL, 1008175050UL, 2004702919UL, 4258654415UL, 938972594UL, 2121583885UL, 2208729114UL, 276726877UL, 3973538591UL, 2991069145UL, +2345655326UL, 2980162173UL, 1915611444UL, 2332104940UL, 2382102873UL, 2324437093UL, 2640563452UL, 2680619359UL, 3413490949UL, 2140843463UL, 2424016743UL, 3735508133UL, 3421831326UL, 4037977349UL, 3721506282UL, 510431975UL, 1014707294UL, 1378686477UL, 1939678832UL, 2223101760UL, 2067687989UL, 309274614UL, 276596103UL, 3757624719UL, 1212251468UL, 2649271847UL, 4140361758UL, 2634738350UL, 2029358730UL, 3205861896UL, 3090549771UL, 3775019657UL, +2018542036UL, 3675805680UL, 3946144023UL, 331655838UL, 326568491UL, 1867863527UL, 1550945400UL, 3087000670UL, 2342003578UL, 3949479453UL, 586483056UL, 147951307UL, 503062740UL, 3823927166UL, 2789767841UL, 3121654578UL, 634238762UL, 4084629478UL, 3878778788UL, 435990088UL, 1724770389UL, 1403031256UL, 1334135626UL, 1096780503UL, 3288769545UL, 2793293893UL, 80675548UL, 1637232257UL, 1856565474UL, 2675485635UL, 1961165681UL, 1647512786UL, +4190102851UL, 4081320784UL, 2853183400UL, 3812341867UL, 278236392UL, 1700614299UL, 2765246084UL, 3846866009UL, 1220806787UL, 3655684157UL, 1133921183UL, 2779125219UL, 523552281UL, 703813725UL, 3110126767UL, 823843890UL, 290243102UL, 821297176UL, 364959993UL, 3381862130UL, 2305271841UL, 356059263UL, 2558018765UL, 3235968999UL, 1070598970UL, 2444411636UL, 3636221117UL, 4275517214UL, 4035198865UL, 3339014315UL, 2911872812UL, 4049586122UL, +4211583637UL, 2628162153UL, 3861478870UL, 2769884494UL, 3423483820UL, 3254616321UL, 536776894UL, 3742490940UL, 550084334UL, 2441329856UL, 1909596092UL, 2308745810UL, 1178166365UL, 1345165241UL, 4039508109UL, 1349347043UL, 3843182157UL, 2200144237UL, 91750284UL, 4290064840UL, 803098068UL, 3243492274UL, 4271100308UL, 4186328336UL, 2291901989UL, 2575673198UL, 372220743UL, 2190417067UL, 2624886324UL, 3567647862UL, 132569424UL, 2278087682UL, +2461678432UL, 232820452UL, 2714694382UL, 3490648253UL, 2412655444UL, 2667664607UL, 249083056UL, 4166379751UL, 3503294711UL, 2247816079UL, 3253689753UL, 1563674427UL, 1914999382UL, 3121933565UL, 1067816947UL, 1098201917UL, 4054175236UL, 1805828534UL, 816420552UL, 738357340UL, 2597170030UL, 1689737432UL, 2004663483UL, 397934907UL, 1008175050UL, 2004702919UL, 4258654415UL, 938972594UL, 156733019UL, 2208729114UL, 276726877UL, 3973538591UL, +2991069145UL, 2470446383UL, 2980162173UL, 1915611444UL, 2332104940UL, 2382102873UL, 3265195583UL, 2640563452UL, 2680619359UL, 3413490949UL, 2140843463UL, 142464483UL, 3735508133UL, 3421831326UL, 4037977349UL, 3721506282UL, 1898668265UL, 1014707294UL, 1378686477UL, 1939678832UL, 2223101760UL, 4085776926UL, 309274614UL, 276596103UL, 3757624719UL, 1212251468UL, 1116423339UL, 4140361758UL, 2634738350UL, 2029358730UL, 3205861896UL, 880658361UL, +3775019657UL, 2018542036UL, 3675805680UL, 3946144023UL, 839516623UL, 326568491UL, 1867863527UL, 1550945400UL, 3087000670UL, 420309880UL, 3949479453UL, 586483056UL, 147951307UL, 503062740UL, 416618471UL, 2789767841UL, 3121654578UL, 634238762UL, 4084629478UL, 1120413065UL, 435990088UL, 1724770389UL, 1403031256UL, 1334135626UL, 240966420UL, 3288769545UL, 2793293893UL, 80675548UL, 1637232257UL, 1785064235UL, 2675485635UL, 1961165681UL, +1647512786UL, 4190102851UL, 2775407492UL, 2853183400UL, 3812341867UL, 278236392UL, 1700614299UL, 2439624528UL, 3846866009UL, 1220806787UL, 3655684157UL, 1133921183UL, 366933679UL, 523552281UL, 703813725UL, 3110126767UL, 823843890UL, 132468066UL, 821297176UL, 364959993UL, 3381862130UL, 2305271841UL, 1048450041UL, 2558018765UL, 3235968999UL, 1070598970UL, 2444411636UL, 1699430013UL, 4275517214UL, 4035198865UL, 3339014315UL, 2911872812UL, +324524850UL, 4211583637UL, 2628162153UL, 3861478870UL, 2769884494UL, 1995585079UL, 3254616321UL, 536776894UL, 3742490940UL, 550084334UL, 2121458511UL, 1909596092UL, 2308745810UL, 1178166365UL, 1345165241UL, 3067877274UL, 1349347043UL, 3843182157UL, 2200144237UL, 91750284UL, 1246148630UL, 803098068UL, 3243492274UL, 4271100308UL, 4186328336UL, 2932236493UL, 2575673198UL, 372220743UL, 2190417067UL, 2624886324UL, 3945294599UL, 132569424UL, +2278087682UL, 2461678432UL, 232820452UL, 3341915918UL, 3490648253UL, 2412655444UL, 2667664607UL, 249083056UL, 2307336284UL, 3503294711UL, 2247816079UL, 3253689753UL, 1563674427UL, 1717494311UL, 3121933565UL, 1067816947UL, 1098201917UL, 4054175236UL, 971917867UL, 816420552UL, 738357340UL, 2597170030UL, 1689737432UL, 243915062UL, 397934907UL, 1008175050UL, 2004702919UL, 4258654415UL, 1807067458UL, 156733019UL, 2208729114UL, 276726877UL, +3973538591UL, 1909483753UL, 2470446383UL, 2980162173UL, 1915611444UL, 2332104940UL, 3454651559UL, 3265195583UL, 2640563452UL, 2680619359UL, 3413490949UL, 462852932UL, 142464483UL, 3735508133UL, 3421831326UL, 4037977349UL, 1372088341UL, 1898668265UL, 1014707294UL, 1378686477UL, 1939678832UL, 752503486UL, 4085776926UL, 309274614UL, 276596103UL, 3757624719UL, 4193030119UL, 1116423339UL, 4140361758UL, 2634738350UL, 2029358730UL, 1725105892UL, +880658361UL, 3775019657UL, 2018542036UL, 3675805680UL, 3496508290UL, 839516623UL, 326568491UL, 1867863527UL, 1550945400UL, 2685835387UL, 420309880UL, 3949479453UL, 586483056UL, 147951307UL, 1639139280UL, 416618471UL, 2789767841UL, 3121654578UL, 634238762UL, 3622035469UL, 1120413065UL, 435990088UL, 1724770389UL, 1403031256UL, 3548817929UL, 240966420UL, 3288769545UL, 2793293893UL, 80675548UL, 3119506726UL, 1785064235UL, 2675485635UL, +1961165681UL, 1647512786UL, 4019542081UL, 2775407492UL, 2853183400UL, 3812341867UL, 278236392UL, 3487875111UL, 2439624528UL, 3846866009UL, 1220806787UL, 3655684157UL, 3303554633UL, 366933679UL, 523552281UL, 703813725UL, 3110126767UL, 2477354049UL, 132468066UL, 821297176UL, 364959993UL, 3381862130UL, 4065162466UL, 1048450041UL, 2558018765UL, 3235968999UL, 1070598970UL, 191819556UL, 1699430013UL, 4275517214UL, 4035198865UL, 3339014315UL, +3588518026UL, 324524850UL, 4211583637UL, 2628162153UL, 3861478870UL, 3361198093UL, 1995585079UL, 3254616321UL, 536776894UL, 3742490940UL, 3912424229UL, 2121458511UL, 1909596092UL, 2308745810UL, 1178166365UL, 1882174246UL, 3067877274UL, 1349347043UL, 3843182157UL, 2200144237UL, 1210030640UL, 1246148630UL, 803098068UL, 3243492274UL, 4271100308UL, 402141998UL, 2932236493UL, 2575673198UL, 372220743UL, 2190417067UL, 1883679642UL, 3945294599UL, +132569424UL, 2278087682UL, 2461678432UL, 708189294UL, 3341915918UL, 3490648253UL, 2412655444UL, 2667664607UL, 2871800434UL, 2307336284UL, 3503294711UL, 2247816079UL, 3253689753UL, 2113837945UL, 1717494311UL, 3121933565UL, 1067816947UL, 1098201917UL, 1041869160UL, 971917867UL, 816420552UL, 738357340UL, 2597170030UL, 2306273930UL, 243915062UL, 397934907UL, 1008175050UL, 2004702919UL, 2345434637UL, 1807067458UL, 156733019UL, 2208729114UL, +276726877UL, 2452083872UL, 1909483753UL, 2470446383UL, 2980162173UL, 1915611444UL, 2043489400UL, 3454651559UL, 3265195583UL, 2640563452UL, 2680619359UL, 2845757473UL, 462852932UL, 142464483UL, 3735508133UL, 3421831326UL, 25103542UL, 1372088341UL, 1898668265UL, 1014707294UL, 1378686477UL, 2680788341UL, 752503486UL, 4085776926UL, 309274614UL, 276596103UL, 3663266970UL, 4193030119UL, 1116423339UL, 4140361758UL, 2634738350UL, 453005903UL, +1725105892UL, 880658361UL, 3775019657UL, 2018542036UL, 2601909713UL, 3496508290UL, 839516623UL, 326568491UL, 1867863527UL, 3474340574UL, 2685835387UL, 420309880UL, 3949479453UL, 586483056UL, 297934218UL, 1639139280UL, 416618471UL, 2789767841UL, 3121654578UL, 958889718UL, 3622035469UL, 1120413065UL, 435990088UL, 1724770389UL, 2589603756UL, 3548817929UL, 240966420UL, 3288769545UL, 2793293893UL, 972899860UL, 3119506726UL, 1785064235UL, +2675485635UL, 1961165681UL, 2576799764UL, 4019542081UL, 2775407492UL, 2853183400UL, 3812341867UL, 159345352UL, 3487875111UL, 2439624528UL, 3846866009UL, 1220806787UL, 3367080935UL, 3303554633UL, 366933679UL, 523552281UL, 703813725UL, 1717395617UL, 2477354049UL, 132468066UL, 821297176UL, 364959993UL, 1088290332UL, 4065162466UL, 1048450041UL, 2558018765UL, 3235968999UL, 285340039UL, 191819556UL, 1699430013UL, 4275517214UL, 4035198865UL, +3544133220UL, 285121978UL, 1175302919UL, 4101282768UL, 513236580UL, 890655666UL, 3051849972UL, 2315486379UL, 3067287276UL, 3134806925UL, 3926373006UL, 2502825498UL, 461387883UL, 770459119UL, 3121636621UL, 1243065093UL, 1612354797UL, 659033930UL, 621176955UL, 214256518UL, 371573588UL, 1168438671UL, 1233027650UL, 1984255965UL, 659404177UL, 1218841419UL, 1226193512UL, 4247589702UL, 334814687UL, 980422670UL, 2518384561UL, 4041002302UL, +1203659320UL, 509643440UL, 2528499450UL, 1512213710UL, 4052651069UL, 1378025938UL, 3436277168UL, 2797728577UL, 463383787UL, 1184681947UL, 283482187UL, 2421891582UL, 3200080903UL, 373817869UL, 452807139UL, 2002545143UL, 1068199574UL, 3390998240UL, 377559317UL, 1548403713UL, 1580741080UL, 253591624UL, 759280679UL, 2174360733UL, 1687952097UL, 1325235423UL, 3856575909UL, 652218568UL, 4130230594UL, 3757998028UL, 1349431618UL, 2870775414UL, +229741978UL, 1900794007UL, 201310771UL, 4075023260UL, 3390078853UL, 3572716207UL, 1959949436UL, 1000128498UL, 1636575064UL, 241058867UL, 2075461870UL, 1819342070UL, 619233032UL, 3164328001UL, 4280892071UL, 4219074185UL, 2719764611UL, 3827656652UL, 4062556527UL, 621515766UL, 2542375627UL, 3901998596UL, 2295087430UL, 2880672054UL, 2940372823UL, 2318642706UL, 914614262UL, 2549699597UL, 2907475284UL, 3901259809UL, 2663167002UL, 3775306719UL, +2212887565UL, 1271873285UL, 3673659531UL, 3856609875UL, 1195785209UL, 1204338358UL, 2785362544UL, 2398696803UL, 3038377816UL, 4288025143UL, 262511310UL, 4151907455UL, 924716723UL, 3298769960UL, 2065938273UL, 3277412030UL, 122636766UL, 2164055077UL, 1000638739UL, 2044933533UL, 2935604716UL, 2772787255UL, 3727331409UL, 1315627932UL, 2610657438UL, 832931652UL, 452359900UL, 681035792UL, 3312648046UL, 1059435047UL, 1489639114UL, 3647631796UL, +417952902UL, 731020350UL, 2847472725UL, 2779076784UL, 2674295324UL, 487600023UL, 2925909449UL, 3997011591UL, 3697231318UL, 967300591UL, 2310856069UL, 684710043UL, 811911286UL, 4174732177UL, 1010656728UL, 702780279UL, 920081774UL, 1578296057UL, 944734808UL, 2884038169UL, 2885919611UL, 2633474915UL, 2508946673UL, 3579216621UL, 656143887UL, 426108406UL, 2166202683UL, 991797657UL, 706498590UL, 561168186UL, 1144619335UL, 3136206425UL, +}, +{ +3600072515UL, 651444872UL, 2348224675UL, 1684848433UL, 1913333701UL, 3413467790UL, 1567802204UL, 2125206188UL, 2463158656UL, 2251055204UL, 4132590383UL, 3192977084UL, 3718261822UL, 3431519430UL, 3506690867UL, 1313208797UL, 637811069UL, 12802085UL, 3456408080UL, 166617386UL, 1764224523UL, 4016338923UL, 2225367442UL, 2461647273UL, 3137989854UL, 373730087UL, 3013524828UL, 242949418UL, 3443491410UL, 3671816408UL, 2391000148UL, 3964107377UL, +716535366UL, 1884597979UL, 3917515811UL, 3441985401UL, 2472173593UL, 4034695117UL, 2486526143UL, 1658764329UL, 1873516415UL, 884116165UL, 814992460UL, 1069506245UL, 3797556389UL, 838088473UL, 2279863068UL, 1002637017UL, 4174541774UL, 644478743UL, 4138151954UL, 4030442072UL, 297710349UL, 3507828614UL, 1403493362UL, 3132267322UL, 227377796UL, 388148240UL, 2760904473UL, 352998924UL, 1603734504UL, 1528807885UL, 2283620218UL, 737730350UL, +2761342715UL, 809367801UL, 1667936422UL, 1510238771UL, 3762862328UL, 1171532060UL, 647580587UL, 1460988169UL, 3944640945UL, 2331043627UL, 1965076564UL, 2913596196UL, 2960957119UL, 1316491503UL, 3086954934UL, 3471945989UL, 2485431762UL, 692294537UL, 3148362914UL, 3371415765UL, 2990795967UL, 706771848UL, 3734467362UL, 2768750385UL, 2061275631UL, 3935582473UL, 1449841372UL, 1239527551UL, 592595530UL, 1685341001UL, 3352323357UL, 4147988039UL, +4003871917UL, 4035869533UL, 3022833195UL, 1266052547UL, 1429645393UL, 565106475UL, 327014810UL, 348739711UL, 3262918351UL, 915509292UL, 397356303UL, 3248246752UL, 1122821778UL, 2373765260UL, 1795464380UL, 3485315196UL, 1731529670UL, 86888382UL, 2789587372UL, 850847993UL, 1794523220UL, 577288126UL, 1996569530UL, 909222664UL, 2601642298UL, 1469035973UL, 2727135938UL, 3467853736UL, 633292505UL, 756260381UL, 41782389UL, 226724724UL, +3633968708UL, 1695315503UL, 1846857904UL, 3185630605UL, 823108172UL, 3609336496UL, 3422558797UL, 2865413534UL, 564221408UL, 591845835UL, 2498463433UL, 3573926554UL, 1336639597UL, 4180084026UL, 3195588503UL, 2822864841UL, 1916459886UL, 2073158796UL, 56968669UL, 1234765864UL, 2456093821UL, 3500058416UL, 3146725645UL, 3295822468UL, 4135196531UL, 628000231UL, 745509757UL, 4143543278UL, 1941480444UL, 3607603517UL, 2288239329UL, 1991437813UL, +4081693775UL, 3600072515UL, 651444872UL, 2348224675UL, 1684848433UL, 3748890341UL, 3413467790UL, 1567802204UL, 2125206188UL, 2463158656UL, 1516568259UL, 4132590383UL, 3192977084UL, 3718261822UL, 3431519430UL, 461466951UL, 1313208797UL, 637811069UL, 12802085UL, 3456408080UL, 3444149988UL, 1764224523UL, 4016338923UL, 2225367442UL, 2461647273UL, 2594402002UL, 373730087UL, 3013524828UL, 242949418UL, 3443491410UL, 2740782133UL, 2391000148UL, +3964107377UL, 716535366UL, 1884597979UL, 3161911677UL, 3441985401UL, 2472173593UL, 4034695117UL, 2486526143UL, 3623045141UL, 1873516415UL, 884116165UL, 814992460UL, 1069506245UL, 1053106195UL, 838088473UL, 2279863068UL, 1002637017UL, 4174541774UL, 1806935386UL, 4138151954UL, 4030442072UL, 297710349UL, 3507828614UL, 2328331779UL, 3132267322UL, 227377796UL, 388148240UL, 2760904473UL, 3654577129UL, 1603734504UL, 1528807885UL, 2283620218UL, +737730350UL, 2134741424UL, 809367801UL, 1667936422UL, 1510238771UL, 3762862328UL, 4084104273UL, 647580587UL, 1460988169UL, 3944640945UL, 2331043627UL, 3458437694UL, 2913596196UL, 2960957119UL, 1316491503UL, 3086954934UL, 2404530503UL, 2485431762UL, 692294537UL, 3148362914UL, 3371415765UL, 3697728317UL, 706771848UL, 3734467362UL, 2768750385UL, 2061275631UL, 1337146928UL, 1449841372UL, 1239527551UL, 592595530UL, 1685341001UL, 3121493408UL, +4147988039UL, 4003871917UL, 4035869533UL, 3022833195UL, 2709537023UL, 1429645393UL, 565106475UL, 327014810UL, 348739711UL, 1278935671UL, 915509292UL, 397356303UL, 3248246752UL, 1122821778UL, 1086107506UL, 1795464380UL, 3485315196UL, 1731529670UL, 86888382UL, 3645735256UL, 850847993UL, 1794523220UL, 577288126UL, 1996569530UL, 1126950UL, 2601642298UL, 1469035973UL, 2727135938UL, 3467853736UL, 3668777652UL, 756260381UL, 41782389UL, +226724724UL, 3633968708UL, 738274780UL, 1846857904UL, 3185630605UL, 823108172UL, 3609336496UL, 3371270228UL, 2865413534UL, 564221408UL, 591845835UL, 2498463433UL, 4157618574UL, 1336639597UL, 4180084026UL, 3195588503UL, 2822864841UL, 3844986377UL, 2073158796UL, 56968669UL, 1234765864UL, 2456093821UL, 1001761927UL, 3146725645UL, 3295822468UL, 4135196531UL, 628000231UL, 541676954UL, 4143543278UL, 1941480444UL, 3607603517UL, 2288239329UL, +1068806322UL, 4081693775UL, 3600072515UL, 651444872UL, 2348224675UL, 47991343UL, 3748890341UL, 3413467790UL, 1567802204UL, 2125206188UL, 2662653600UL, 1516568259UL, 4132590383UL, 3192977084UL, 3718261822UL, 2554440323UL, 461466951UL, 1313208797UL, 637811069UL, 12802085UL, 982676468UL, 3444149988UL, 1764224523UL, 4016338923UL, 2225367442UL, 451503008UL, 2594402002UL, 373730087UL, 3013524828UL, 242949418UL, 1086137206UL, 2740782133UL, +2391000148UL, 3964107377UL, 716535366UL, 731470002UL, 3161911677UL, 3441985401UL, 2472173593UL, 4034695117UL, 44456710UL, 3623045141UL, 1873516415UL, 884116165UL, 814992460UL, 4004771121UL, 1053106195UL, 838088473UL, 2279863068UL, 1002637017UL, 1587145121UL, 1806935386UL, 4138151954UL, 4030442072UL, 297710349UL, 2570695340UL, 2328331779UL, 3132267322UL, 227377796UL, 388148240UL, 3570998746UL, 3654577129UL, 1603734504UL, 1528807885UL, +2283620218UL, 188017185UL, 2134741424UL, 809367801UL, 1667936422UL, 1510238771UL, 1503613101UL, 4084104273UL, 647580587UL, 1460988169UL, 3944640945UL, 3301866374UL, 3458437694UL, 2913596196UL, 2960957119UL, 1316491503UL, 2674694926UL, 2404530503UL, 2485431762UL, 692294537UL, 3148362914UL, 1645995464UL, 3697728317UL, 706771848UL, 3734467362UL, 2768750385UL, 670964862UL, 1337146928UL, 1449841372UL, 1239527551UL, 592595530UL, 4204421245UL, +3121493408UL, 4147988039UL, 4003871917UL, 4035869533UL, 3652555523UL, 2709537023UL, 1429645393UL, 565106475UL, 327014810UL, 2716443687UL, 1278935671UL, 915509292UL, 397356303UL, 3248246752UL, 204830047UL, 1086107506UL, 1795464380UL, 3485315196UL, 1731529670UL, 662578255UL, 3645735256UL, 850847993UL, 1794523220UL, 577288126UL, 4237140216UL, 1126950UL, 2601642298UL, 1469035973UL, 2727135938UL, 92392213UL, 3668777652UL, 756260381UL, +41782389UL, 226724724UL, 1123105466UL, 738274780UL, 1846857904UL, 3185630605UL, 823108172UL, 2880110296UL, 3371270228UL, 2865413534UL, 564221408UL, 591845835UL, 2356214088UL, 4157618574UL, 1336639597UL, 4180084026UL, 3195588503UL, 4266261353UL, 3844986377UL, 2073158796UL, 56968669UL, 1234765864UL, 3166457679UL, 1001761927UL, 3146725645UL, 3295822468UL, 4135196531UL, 496099322UL, 541676954UL, 4143543278UL, 1941480444UL, 3607603517UL, +2578543796UL, 1068806322UL, 4081693775UL, 3600072515UL, 651444872UL, 1131603264UL, 47991343UL, 3748890341UL, 3413467790UL, 1567802204UL, 2823058381UL, 2662653600UL, 1516568259UL, 4132590383UL, 3192977084UL, 4247798474UL, 2554440323UL, 461466951UL, 1313208797UL, 637811069UL, 2744898822UL, 982676468UL, 3444149988UL, 1764224523UL, 4016338923UL, 2845667517UL, 451503008UL, 2594402002UL, 373730087UL, 3013524828UL, 3442521115UL, 1086137206UL, +2740782133UL, 2391000148UL, 3964107377UL, 4060067791UL, 731470002UL, 3161911677UL, 3441985401UL, 2472173593UL, 4227407417UL, 44456710UL, 3623045141UL, 1873516415UL, 884116165UL, 2550700713UL, 4004771121UL, 1053106195UL, 838088473UL, 2279863068UL, 1296332348UL, 1587145121UL, 1806935386UL, 4138151954UL, 4030442072UL, 2552496880UL, 2570695340UL, 2328331779UL, 3132267322UL, 227377796UL, 3887816270UL, 3570998746UL, 3654577129UL, 1603734504UL, +1528807885UL, 3365552060UL, 188017185UL, 2134741424UL, 809367801UL, 1667936422UL, 1358744245UL, 1503613101UL, 4084104273UL, 647580587UL, 1460988169UL, 2318828416UL, 3301866374UL, 3458437694UL, 2913596196UL, 2960957119UL, 49464436UL, 2674694926UL, 2404530503UL, 2485431762UL, 692294537UL, 1803418945UL, 1645995464UL, 3697728317UL, 706771848UL, 3734467362UL, 2407932841UL, 670964862UL, 1337146928UL, 1449841372UL, 1239527551UL, 1124552917UL, +4204421245UL, 3121493408UL, 4147988039UL, 4003871917UL, 3542256025UL, 3652555523UL, 2709537023UL, 1429645393UL, 565106475UL, 2063548817UL, 2716443687UL, 1278935671UL, 915509292UL, 397356303UL, 1049916999UL, 204830047UL, 1086107506UL, 1795464380UL, 3485315196UL, 2183256184UL, 662578255UL, 3645735256UL, 850847993UL, 1794523220UL, 2943700388UL, 4237140216UL, 1126950UL, 2601642298UL, 1469035973UL, 535075238UL, 92392213UL, 3668777652UL, +756260381UL, 41782389UL, 1043025574UL, 1123105466UL, 738274780UL, 1846857904UL, 3185630605UL, 3324487649UL, 2880110296UL, 3371270228UL, 2865413534UL, 564221408UL, 2528599862UL, 2356214088UL, 4157618574UL, 1336639597UL, 4180084026UL, 592094844UL, 4266261353UL, 3844986377UL, 2073158796UL, 56968669UL, 629503707UL, 3166457679UL, 1001761927UL, 3146725645UL, 3295822468UL, 2725304934UL, 496099322UL, 541676954UL, 4143543278UL, 1941480444UL, +3557859116UL, 31832949UL, 3805791401UL, 4056283801UL, 242812250UL, 4072988068UL, 2316479446UL, 2260433816UL, 2211372380UL, 2039672698UL, 2947948280UL, 4106140026UL, 342600216UL, 98745656UL, 2541799209UL, 926067404UL, 2733213159UL, 3163537903UL, 2800370126UL, 2099121446UL, 1279545581UL, 3699822446UL, 3764095615UL, 690503808UL, 3799637505UL, 1000641330UL, 242588257UL, 3657834529UL, 824791208UL, 2529299371UL, 4081898575UL, 2120338882UL, +1273883107UL, 1680877886UL, 1253060582UL, 1760259553UL, 2250763915UL, 31780198UL, 2511451445UL, 3102141340UL, 861489797UL, 105854693UL, 70927387UL, 2725671050UL, 688282241UL, 2622257646UL, 3466254816UL, 1905008219UL, 2980966436UL, 2154356718UL, 1075686806UL, 1966147415UL, 2357249256UL, 2684600972UL, 400926709UL, 523449509UL, 2891602783UL, 673425710UL, 3766475216UL, 2319843954UL, 3471794777UL, 13838840UL, 1908374660UL, 3839606132UL, +3829795513UL, 3403561639UL, 1369780874UL, 4276407916UL, 3217619UL, 1284482371UL, 2020138237UL, 2804427294UL, 1194369854UL, 1094800747UL, 2119081501UL, 726494474UL, 490750173UL, 1117517565UL, 3498786968UL, 2163060528UL, 696718831UL, 2780121254UL, 1286646297UL, 1594539045UL, 411215116UL, 1407268753UL, 2759136967UL, 2179483407UL, 2088977769UL, 2737453188UL, 2411478102UL, 3112688013UL, 4112484868UL, 429293789UL, 426390687UL, 3158027863UL, +2601897382UL, 1546855515UL, 4258208908UL, 3691263847UL, 2394986813UL, 1986623921UL, 2632462203UL, 3551311099UL, 3309482741UL, 2632571927UL, 1200010240UL, 554555739UL, 4119397989UL, 622818813UL, 3116222066UL, 1801867255UL, 2738500841UL, 1452697246UL, 733457482UL, 1680421668UL, 1035766144UL, 468847991UL, 3606474156UL, 2612692123UL, 730556693UL, 859096521UL, 4005878655UL, 1138273887UL, 2182363629UL, 2710579590UL, 3345140092UL, 2562710857UL, +3859276724UL, 2318176233UL, 3964665794UL, 3295219265UL, 3037789445UL, 371545704UL, 3434130670UL, 3686032092UL, 19964088UL, 340386179UL, 2147090894UL, 1446742483UL, 3083526520UL, 561888846UL, 2903328518UL, 1524465288UL, 360120037UL, 2031515996UL, 1516035872UL, 2752848969UL, 1094251072UL, 984159948UL, 369999653UL, 864602622UL, 2402584241UL, 3028363830UL, 252580667UL, 480470405UL, 3201548259UL, 2739036185UL, 2198549891UL, 1978812013UL, +}, +{ +2546657140UL, 2771792972UL, 3371698159UL, 1137313111UL, 2399264952UL, 1204642544UL, 2090179262UL, 2948712987UL, 2908027331UL, 498636511UL, 2292804841UL, 1480836858UL, 2826016727UL, 196495965UL, 2168559184UL, 3910150715UL, 320076735UL, 3144753899UL, 3199094529UL, 1165806050UL, 728308199UL, 2322528104UL, 2891334400UL, 561853019UL, 4161870615UL, 1348321971UL, 2461357166UL, 1216229488UL, 1392766290UL, 3060494848UL, 3282469664UL, 1866493654UL, +2351421557UL, 4195620347UL, 1512242723UL, 478174598UL, 1087303780UL, 471631659UL, 2599553643UL, 791527994UL, 563537164UL, 1238109907UL, 3218421602UL, 133222502UL, 4182363220UL, 305688802UL, 2666439314UL, 2408520958UL, 787389550UL, 4226450542UL, 4107143646UL, 4103547035UL, 1840887424UL, 2686247491UL, 334267386UL, 3772035402UL, 3436827662UL, 1411515743UL, 2193739735UL, 1892746640UL, 4163192062UL, 2921191805UL, 1011310614UL, 2178118214UL, +33647321UL, 1121452997UL, 507942677UL, 2542792587UL, 351339975UL, 1586639416UL, 1918003826UL, 2513357034UL, 2747854573UL, 606238275UL, 1132105249UL, 574593993UL, 2655425816UL, 1680556547UL, 1831942411UL, 2587194016UL, 90710116UL, 4291431098UL, 1899367028UL, 3251152898UL, 3297078396UL, 2712235924UL, 1546135008UL, 897753268UL, 1619454780UL, 938130143UL, 1828916640UL, 3620488958UL, 1822437033UL, 172584228UL, 1853048226UL, 3659288522UL, +3623450763UL, 1893292786UL, 851522142UL, 3411705687UL, 4106341088UL, 4109830348UL, 1193339049UL, 878885723UL, 2964062476UL, 2320209608UL, 1777678953UL, 2886897705UL, 3856938396UL, 252913914UL, 3648685154UL, 544382669UL, 2631141468UL, 1524405364UL, 1848509666UL, 580646927UL, 2451560151UL, 181916967UL, 1426301928UL, 1652422182UL, 2625099169UL, 176664750UL, 1582626255UL, 1675120608UL, 2571617898UL, 2096572277UL, 2471745846UL, 419906507UL, +886861124UL, 1974832558UL, 3157060904UL, 216000225UL, 746978071UL, 1424984058UL, 1457979883UL, 809822177UL, 3833178010UL, 3926414726UL, 1423462846UL, 3024443248UL, 4067020014UL, 2881559869UL, 1376840097UL, 548130303UL, 1118013762UL, 1309103114UL, 2227304261UL, 4205319357UL, 228947246UL, 2167410411UL, 620496852UL, 2724112116UL, 705259153UL, 3499686911UL, 3085999115UL, 2447267299UL, 4190122199UL, 1091465954UL, 1233728238UL, 39711865UL, +1076751044UL, 2546657140UL, 2771792972UL, 3371698159UL, 1137313111UL, 3857150586UL, 1204642544UL, 2090179262UL, 2948712987UL, 2908027331UL, 368199414UL, 2292804841UL, 1480836858UL, 2826016727UL, 196495965UL, 3235583934UL, 3910150715UL, 320076735UL, 3144753899UL, 3199094529UL, 1374597050UL, 728308199UL, 2322528104UL, 2891334400UL, 561853019UL, 1515915224UL, 1348321971UL, 2461357166UL, 1216229488UL, 1392766290UL, 15252704UL, 3282469664UL, +1866493654UL, 2351421557UL, 4195620347UL, 192355609UL, 478174598UL, 1087303780UL, 471631659UL, 2599553643UL, 1725604263UL, 563537164UL, 1238109907UL, 3218421602UL, 133222502UL, 305098282UL, 305688802UL, 2666439314UL, 2408520958UL, 787389550UL, 3195522899UL, 4107143646UL, 4103547035UL, 1840887424UL, 2686247491UL, 1565529892UL, 3772035402UL, 3436827662UL, 1411515743UL, 2193739735UL, 1848198417UL, 4163192062UL, 2921191805UL, 1011310614UL, +2178118214UL, 3474206203UL, 1121452997UL, 507942677UL, 2542792587UL, 351339975UL, 3599278861UL, 1918003826UL, 2513357034UL, 2747854573UL, 606238275UL, 446979745UL, 574593993UL, 2655425816UL, 1680556547UL, 1831942411UL, 3338512802UL, 90710116UL, 4291431098UL, 1899367028UL, 3251152898UL, 1006512939UL, 2712235924UL, 1546135008UL, 897753268UL, 1619454780UL, 1429190743UL, 1828916640UL, 3620488958UL, 1822437033UL, 172584228UL, 2529855020UL, +3659288522UL, 3623450763UL, 1893292786UL, 851522142UL, 1417935793UL, 4106341088UL, 4109830348UL, 1193339049UL, 878885723UL, 1886400637UL, 2320209608UL, 1777678953UL, 2886897705UL, 3856938396UL, 1813134786UL, 3648685154UL, 544382669UL, 2631141468UL, 1524405364UL, 687661410UL, 580646927UL, 2451560151UL, 181916967UL, 1426301928UL, 1463347373UL, 2625099169UL, 176664750UL, 1582626255UL, 1675120608UL, 3387060344UL, 2096572277UL, 2471745846UL, +419906507UL, 886861124UL, 4209699955UL, 3157060904UL, 216000225UL, 746978071UL, 1424984058UL, 3063941448UL, 809822177UL, 3833178010UL, 3926414726UL, 1423462846UL, 750559587UL, 4067020014UL, 2881559869UL, 1376840097UL, 548130303UL, 4056763004UL, 1309103114UL, 2227304261UL, 4205319357UL, 228947246UL, 774411056UL, 620496852UL, 2724112116UL, 705259153UL, 3499686911UL, 2486247387UL, 2447267299UL, 4190122199UL, 1091465954UL, 1233728238UL, +54639263UL, 1076751044UL, 2546657140UL, 2771792972UL, 3371698159UL, 1152150303UL, 3857150586UL, 1204642544UL, 2090179262UL, 2948712987UL, 452427847UL, 368199414UL, 2292804841UL, 1480836858UL, 2826016727UL, 1929008184UL, 3235583934UL, 3910150715UL, 320076735UL, 3144753899UL, 895636897UL, 1374597050UL, 728308199UL, 2322528104UL, 2891334400UL, 1871824871UL, 1515915224UL, 1348321971UL, 2461357166UL, 1216229488UL, 3170568098UL, 15252704UL, +3282469664UL, 1866493654UL, 2351421557UL, 4253216490UL, 192355609UL, 478174598UL, 1087303780UL, 471631659UL, 4230260400UL, 1725604263UL, 563537164UL, 1238109907UL, 3218421602UL, 960481514UL, 305098282UL, 305688802UL, 2666439314UL, 2408520958UL, 242741163UL, 3195522899UL, 4107143646UL, 4103547035UL, 1840887424UL, 2768321503UL, 1565529892UL, 3772035402UL, 3436827662UL, 1411515743UL, 545362965UL, 1848198417UL, 4163192062UL, 2921191805UL, +1011310614UL, 1196775493UL, 3474206203UL, 1121452997UL, 507942677UL, 2542792587UL, 1948892535UL, 3599278861UL, 1918003826UL, 2513357034UL, 2747854573UL, 4172793632UL, 446979745UL, 574593993UL, 2655425816UL, 1680556547UL, 2986869736UL, 3338512802UL, 90710116UL, 4291431098UL, 1899367028UL, 3376952160UL, 1006512939UL, 2712235924UL, 1546135008UL, 897753268UL, 2061577225UL, 1429190743UL, 1828916640UL, 3620488958UL, 1822437033UL, 4221327184UL, +2529855020UL, 3659288522UL, 3623450763UL, 1893292786UL, 16446898UL, 1417935793UL, 4106341088UL, 4109830348UL, 1193339049UL, 2895194326UL, 1886400637UL, 2320209608UL, 1777678953UL, 2886897705UL, 117861450UL, 1813134786UL, 3648685154UL, 544382669UL, 2631141468UL, 1105253905UL, 687661410UL, 580646927UL, 2451560151UL, 181916967UL, 1605087684UL, 1463347373UL, 2625099169UL, 176664750UL, 1582626255UL, 1993431057UL, 3387060344UL, 2096572277UL, +2471745846UL, 419906507UL, 3219719670UL, 4209699955UL, 3157060904UL, 216000225UL, 746978071UL, 3304126047UL, 3063941448UL, 809822177UL, 3833178010UL, 3926414726UL, 4061584738UL, 750559587UL, 4067020014UL, 2881559869UL, 1376840097UL, 973425409UL, 4056763004UL, 1309103114UL, 2227304261UL, 4205319357UL, 939664759UL, 774411056UL, 620496852UL, 2724112116UL, 705259153UL, 176172666UL, 2486247387UL, 2447267299UL, 4190122199UL, 1091465954UL, +300145620UL, 54639263UL, 1076751044UL, 2546657140UL, 2771792972UL, 188149161UL, 1152150303UL, 3857150586UL, 1204642544UL, 2090179262UL, 626100323UL, 452427847UL, 368199414UL, 2292804841UL, 1480836858UL, 2700509669UL, 1929008184UL, 3235583934UL, 3910150715UL, 320076735UL, 1715326239UL, 895636897UL, 1374597050UL, 728308199UL, 2322528104UL, 2356051490UL, 1871824871UL, 1515915224UL, 1348321971UL, 2461357166UL, 243332180UL, 3170568098UL, +15252704UL, 3282469664UL, 1866493654UL, 4079212881UL, 4253216490UL, 192355609UL, 478174598UL, 1087303780UL, 3787911270UL, 4230260400UL, 1725604263UL, 563537164UL, 1238109907UL, 1147223471UL, 960481514UL, 305098282UL, 305688802UL, 2666439314UL, 1503870433UL, 242741163UL, 3195522899UL, 4107143646UL, 4103547035UL, 4041516761UL, 2768321503UL, 1565529892UL, 3772035402UL, 3436827662UL, 3952861918UL, 545362965UL, 1848198417UL, 4163192062UL, +2921191805UL, 793561655UL, 1196775493UL, 3474206203UL, 1121452997UL, 507942677UL, 3788690254UL, 1948892535UL, 3599278861UL, 1918003826UL, 2513357034UL, 3301940062UL, 4172793632UL, 446979745UL, 574593993UL, 2655425816UL, 667233719UL, 2986869736UL, 3338512802UL, 90710116UL, 4291431098UL, 2027122085UL, 3376952160UL, 1006512939UL, 2712235924UL, 1546135008UL, 2609276017UL, 2061577225UL, 1429190743UL, 1828916640UL, 3620488958UL, 1603195641UL, +4221327184UL, 2529855020UL, 3659288522UL, 3623450763UL, 2313432963UL, 16446898UL, 1417935793UL, 4106341088UL, 4109830348UL, 4106013120UL, 2895194326UL, 1886400637UL, 2320209608UL, 1777678953UL, 1952597964UL, 117861450UL, 1813134786UL, 3648685154UL, 544382669UL, 3108229631UL, 1105253905UL, 687661410UL, 580646927UL, 2451560151UL, 1160575897UL, 1605087684UL, 1463347373UL, 2625099169UL, 176664750UL, 1998534134UL, 1993431057UL, 3387060344UL, +2096572277UL, 2471745846UL, 2246406696UL, 3219719670UL, 4209699955UL, 3157060904UL, 216000225UL, 902956869UL, 3304126047UL, 3063941448UL, 809822177UL, 3833178010UL, 815366736UL, 4061584738UL, 750559587UL, 4067020014UL, 2881559869UL, 350775477UL, 973425409UL, 4056763004UL, 1309103114UL, 2227304261UL, 2047915817UL, 939664759UL, 774411056UL, 620496852UL, 2724112116UL, 3593903529UL, 176172666UL, 2486247387UL, 2447267299UL, 4190122199UL, +1450746791UL, 1521739409UL, 272699299UL, 4113952664UL, 1408743622UL, 4082014187UL, 2454446462UL, 1401621236UL, 2050232096UL, 4204834821UL, 2413497685UL, 1032465253UL, 4276089655UL, 1737267711UL, 3335718398UL, 1924071395UL, 1560525661UL, 3064183869UL, 1775038231UL, 89761304UL, 489201378UL, 1236489133UL, 2774076159UL, 822652970UL, 1583752702UL, 1781766972UL, 2238480533UL, 3428349870UL, 3344555477UL, 2251934941UL, 2533404243UL, 3651295253UL, +2359372862UL, 704049384UL, 3238382362UL, 2405156187UL, 2572833624UL, 531907732UL, 2240111412UL, 4102445586UL, 849739856UL, 3649572083UL, 3317634415UL, 1141345331UL, 1118528358UL, 1664181643UL, 648360156UL, 1364897187UL, 289264571UL, 1625825195UL, 1075970578UL, 3925373833UL, 2780782646UL, 727038162UL, 2824687935UL, 3844230994UL, 2070739238UL, 2437298873UL, 1837327520UL, 4248571219UL, 183041221UL, 3759390508UL, 3881974011UL, 658115161UL, +560642175UL, 32860408UL, 1321227669UL, 1380454450UL, 1676524786UL, 476585241UL, 4034481274UL, 1110506516UL, 815601591UL, 2009522227UL, 2168306897UL, 1856639149UL, 1328281664UL, 2710915389UL, 1886116025UL, 2074502324UL, 23109943UL, 670045122UL, 2926671795UL, 4269143768UL, 2688621201UL, 1618605914UL, 1541217762UL, 4273045819UL, 1029546542UL, 3663663567UL, 1402692384UL, 109336276UL, 2446546057UL, 2225682064UL, 3535545430UL, 3847123891UL, +369718877UL, 3411726117UL, 703735748UL, 3139527634UL, 22388546UL, 998860697UL, 2532911305UL, 1532808237UL, 4170332196UL, 1131906845UL, 1814343609UL, 4161931326UL, 1185668213UL, 1903273604UL, 3466154373UL, 3988139604UL, 1079368270UL, 991305574UL, 898158502UL, 2898908951UL, 651161128UL, 1952607949UL, 1221528540UL, 29979722UL, 3006846808UL, 2911550178UL, 2569412437UL, 1460616937UL, 2127921978UL, 3689931108UL, 950505297UL, 3469337654UL, +3180457017UL, 2316433735UL, 1464678429UL, 2867173456UL, 391248106UL, 3622065314UL, 2143251073UL, 860219584UL, 323835636UL, 340886643UL, 1805485977UL, 109344001UL, 1537119779UL, 1795626099UL, 2568079633UL, 3048040562UL, 1204069532UL, 2488753091UL, 2160014198UL, 3132782711UL, 1266102795UL, 91252225UL, 2018366053UL, 39675212UL, 979320891UL, 343397131UL, 814470367UL, 366655857UL, 3287033048UL, 3379301026UL, 1566381433UL, 3431153818UL, +}, +{ +2234324389UL, 1682296894UL, 3526681456UL, 3988544681UL, 1315506584UL, 1754723911UL, 3607564438UL, 3764062195UL, 3408328234UL, 2385116969UL, 3827569659UL, 4104590721UL, 2612634189UL, 1762747544UL, 1676800931UL, 1814546108UL, 2684685172UL, 1659194343UL, 3381624140UL, 2286640580UL, 688245437UL, 2593335056UL, 1657668516UL, 1161309746UL, 3390664973UL, 2460564382UL, 2811435329UL, 2169200311UL, 2768093584UL, 4288309691UL, 1341061221UL, 1361417084UL, +3060155336UL, 2526021346UL, 1037055386UL, 890124736UL, 2185462193UL, 765141735UL, 1841745804UL, 3562499272UL, 1437907207UL, 2127475991UL, 2845453063UL, 4007976206UL, 4160093314UL, 2717704308UL, 4193767498UL, 1667876711UL, 3477753188UL, 3150367681UL, 3224086539UL, 231347764UL, 2737121599UL, 1230656103UL, 4168131490UL, 1463860373UL, 2760968409UL, 2579133178UL, 2309591728UL, 2958907244UL, 1041094855UL, 685134804UL, 3861095208UL, 1088109135UL, +815655228UL, 2618003265UL, 3454840568UL, 1668276240UL, 1668403077UL, 663034899UL, 4020374281UL, 1896863688UL, 677285319UL, 4047674693UL, 4098535894UL, 2038783953UL, 236635760UL, 3641273565UL, 3568356824UL, 3405704765UL, 186484522UL, 3626346451UL, 3653227559UL, 281949942UL, 1847600066UL, 4168753288UL, 1723123703UL, 3600798445UL, 4267802363UL, 2947454105UL, 468768748UL, 2745777741UL, 26635454UL, 837186232UL, 206931043UL, 2601865569UL, +2021732453UL, 3171165636UL, 786833002UL, 116631308UL, 1604778670UL, 437644814UL, 2437761489UL, 3573139998UL, 2637030522UL, 972076738UL, 4075927397UL, 1427554739UL, 597414077UL, 559325169UL, 1774857312UL, 224593737UL, 3697511293UL, 3905126277UL, 2446278950UL, 1847061846UL, 333176687UL, 2988562696UL, 3623938567UL, 2389910304UL, 4273100167UL, 1673622334UL, 2163644598UL, 3666601063UL, 3971760462UL, 4176957983UL, 565952761UL, 566996714UL, +103136762UL, 3648349163UL, 115456167UL, 3265051494UL, 2826313040UL, 1898888678UL, 3921049266UL, 1276809956UL, 4051866478UL, 959265349UL, 851980436UL, 3105565302UL, 2905096898UL, 342438530UL, 3428101638UL, 912389587UL, 2306839396UL, 3613297213UL, 200159550UL, 3406974927UL, 832121231UL, 2998593393UL, 1242069873UL, 1464281204UL, 1828082526UL, 2620095350UL, 3727900009UL, 986958825UL, 3332332947UL, 1610600284UL, 3193282615UL, 1873987353UL, +537698841UL, 2234324389UL, 1682296894UL, 3526681456UL, 3988544681UL, 1112334635UL, 1754723911UL, 3607564438UL, 3764062195UL, 3408328234UL, 2702680798UL, 3827569659UL, 4104590721UL, 2612634189UL, 1762747544UL, 1596420149UL, 1814546108UL, 2684685172UL, 1659194343UL, 3381624140UL, 2424233156UL, 688245437UL, 2593335056UL, 1657668516UL, 1161309746UL, 260803614UL, 2460564382UL, 2811435329UL, 2169200311UL, 2768093584UL, 1426048416UL, 1341061221UL, +1361417084UL, 3060155336UL, 2526021346UL, 688976997UL, 890124736UL, 2185462193UL, 765141735UL, 1841745804UL, 1113361455UL, 1437907207UL, 2127475991UL, 2845453063UL, 4007976206UL, 1719248425UL, 2717704308UL, 4193767498UL, 1667876711UL, 3477753188UL, 449353539UL, 3224086539UL, 231347764UL, 2737121599UL, 1230656103UL, 2122699205UL, 1463860373UL, 2760968409UL, 2579133178UL, 2309591728UL, 4017154219UL, 1041094855UL, 685134804UL, 3861095208UL, +1088109135UL, 3954527144UL, 2618003265UL, 3454840568UL, 1668276240UL, 1668403077UL, 3235241899UL, 4020374281UL, 1896863688UL, 677285319UL, 4047674693UL, 4043186819UL, 2038783953UL, 236635760UL, 3641273565UL, 3568356824UL, 3946220303UL, 186484522UL, 3626346451UL, 3653227559UL, 281949942UL, 1896524045UL, 4168753288UL, 1723123703UL, 3600798445UL, 4267802363UL, 412498526UL, 468768748UL, 2745777741UL, 26635454UL, 837186232UL, 1473941762UL, +2601865569UL, 2021732453UL, 3171165636UL, 786833002UL, 3461566768UL, 1604778670UL, 437644814UL, 2437761489UL, 3573139998UL, 306196591UL, 972076738UL, 4075927397UL, 1427554739UL, 597414077UL, 2401305323UL, 1774857312UL, 224593737UL, 3697511293UL, 3905126277UL, 1527832817UL, 1847061846UL, 333176687UL, 2988562696UL, 3623938567UL, 2731158470UL, 4273100167UL, 1673622334UL, 2163644598UL, 3666601063UL, 1991088422UL, 4176957983UL, 565952761UL, +566996714UL, 103136762UL, 1639884175UL, 115456167UL, 3265051494UL, 2826313040UL, 1898888678UL, 2976556877UL, 1276809956UL, 4051866478UL, 959265349UL, 851980436UL, 2482970929UL, 2905096898UL, 342438530UL, 3428101638UL, 912389587UL, 2716490551UL, 3613297213UL, 200159550UL, 3406974927UL, 832121231UL, 2865829307UL, 1242069873UL, 1464281204UL, 1828082526UL, 2620095350UL, 3671861666UL, 986958825UL, 3332332947UL, 1610600284UL, 3193282615UL, +164496953UL, 537698841UL, 2234324389UL, 1682296894UL, 3526681456UL, 486931321UL, 1112334635UL, 1754723911UL, 3607564438UL, 3764062195UL, 898439171UL, 2702680798UL, 3827569659UL, 4104590721UL, 2612634189UL, 1703436382UL, 1596420149UL, 1814546108UL, 2684685172UL, 1659194343UL, 3421607784UL, 2424233156UL, 688245437UL, 2593335056UL, 1657668516UL, 362342820UL, 260803614UL, 2460564382UL, 2811435329UL, 2169200311UL, 4248717010UL, 1426048416UL, +1341061221UL, 1361417084UL, 3060155336UL, 2693026827UL, 688976997UL, 890124736UL, 2185462193UL, 765141735UL, 2445632748UL, 1113361455UL, 1437907207UL, 2127475991UL, 2845453063UL, 1830953748UL, 1719248425UL, 2717704308UL, 4193767498UL, 1667876711UL, 2469362144UL, 449353539UL, 3224086539UL, 231347764UL, 2737121599UL, 2917779591UL, 2122699205UL, 1463860373UL, 2760968409UL, 2579133178UL, 2600345316UL, 4017154219UL, 1041094855UL, 685134804UL, +3861095208UL, 3682591427UL, 3954527144UL, 2618003265UL, 3454840568UL, 1668276240UL, 988400088UL, 3235241899UL, 4020374281UL, 1896863688UL, 677285319UL, 2749516227UL, 4043186819UL, 2038783953UL, 236635760UL, 3641273565UL, 4073317913UL, 3946220303UL, 186484522UL, 3626346451UL, 3653227559UL, 872336642UL, 1896524045UL, 4168753288UL, 1723123703UL, 3600798445UL, 524095357UL, 412498526UL, 468768748UL, 2745777741UL, 26635454UL, 840544541UL, +1473941762UL, 2601865569UL, 2021732453UL, 3171165636UL, 1058640324UL, 3461566768UL, 1604778670UL, 437644814UL, 2437761489UL, 3615438045UL, 306196591UL, 972076738UL, 4075927397UL, 1427554739UL, 2369367008UL, 2401305323UL, 1774857312UL, 224593737UL, 3697511293UL, 4186564433UL, 1527832817UL, 1847061846UL, 333176687UL, 2988562696UL, 4039340326UL, 2731158470UL, 4273100167UL, 1673622334UL, 2163644598UL, 307949376UL, 1991088422UL, 4176957983UL, +565952761UL, 566996714UL, 4159448552UL, 1639884175UL, 115456167UL, 3265051494UL, 2826313040UL, 2698725478UL, 2976556877UL, 1276809956UL, 4051866478UL, 959265349UL, 293029699UL, 2482970929UL, 2905096898UL, 342438530UL, 3428101638UL, 4172766741UL, 2716490551UL, 3613297213UL, 200159550UL, 3406974927UL, 3723281866UL, 2865829307UL, 1242069873UL, 1464281204UL, 1828082526UL, 3304191156UL, 3671861666UL, 986958825UL, 3332332947UL, 1610600284UL, +2370407607UL, 164496953UL, 537698841UL, 2234324389UL, 1682296894UL, 826891606UL, 486931321UL, 1112334635UL, 1754723911UL, 3607564438UL, 3598993552UL, 898439171UL, 2702680798UL, 3827569659UL, 4104590721UL, 1421852097UL, 1703436382UL, 1596420149UL, 1814546108UL, 2684685172UL, 4090587429UL, 3421607784UL, 2424233156UL, 688245437UL, 2593335056UL, 4151905751UL, 362342820UL, 260803614UL, 2460564382UL, 2811435329UL, 2402832015UL, 4248717010UL, +1426048416UL, 1341061221UL, 1361417084UL, 1629089021UL, 2693026827UL, 688976997UL, 890124736UL, 2185462193UL, 303105066UL, 2445632748UL, 1113361455UL, 1437907207UL, 2127475991UL, 62024604UL, 1830953748UL, 1719248425UL, 2717704308UL, 4193767498UL, 667433630UL, 2469362144UL, 449353539UL, 3224086539UL, 231347764UL, 3918249451UL, 2917779591UL, 2122699205UL, 1463860373UL, 2760968409UL, 4274016442UL, 2600345316UL, 4017154219UL, 1041094855UL, +685134804UL, 643006688UL, 3682591427UL, 3954527144UL, 2618003265UL, 3454840568UL, 4180665518UL, 988400088UL, 3235241899UL, 4020374281UL, 1896863688UL, 3678687414UL, 2749516227UL, 4043186819UL, 2038783953UL, 236635760UL, 2880089648UL, 4073317913UL, 3946220303UL, 186484522UL, 3626346451UL, 2454620114UL, 872336642UL, 1896524045UL, 4168753288UL, 1723123703UL, 2692406059UL, 524095357UL, 412498526UL, 468768748UL, 2745777741UL, 918726515UL, +840544541UL, 1473941762UL, 2601865569UL, 2021732453UL, 3534238020UL, 1058640324UL, 3461566768UL, 1604778670UL, 437644814UL, 2894699005UL, 3615438045UL, 306196591UL, 972076738UL, 4075927397UL, 3468671461UL, 2369367008UL, 2401305323UL, 1774857312UL, 224593737UL, 2734827022UL, 4186564433UL, 1527832817UL, 1847061846UL, 333176687UL, 2437714719UL, 4039340326UL, 2731158470UL, 4273100167UL, 1673622334UL, 196072958UL, 307949376UL, 1991088422UL, +4176957983UL, 565952761UL, 847200194UL, 4159448552UL, 1639884175UL, 115456167UL, 3265051494UL, 2503079777UL, 2698725478UL, 2976556877UL, 1276809956UL, 4051866478UL, 2731665893UL, 293029699UL, 2482970929UL, 2905096898UL, 342438530UL, 581060953UL, 4172766741UL, 2716490551UL, 3613297213UL, 200159550UL, 4222335623UL, 3723281866UL, 2865829307UL, 1242069873UL, 1464281204UL, 1080647953UL, 3304191156UL, 3671861666UL, 986958825UL, 3332332947UL, +920422540UL, 3656094274UL, 4036161427UL, 2157099981UL, 1855437762UL, 1385781426UL, 199192882UL, 489599802UL, 3472601685UL, 717544078UL, 2241742884UL, 3951326913UL, 3590866192UL, 1087524220UL, 3517385549UL, 360484251UL, 2718513148UL, 1386577185UL, 1833613127UL, 2926418589UL, 1652463225UL, 548895720UL, 1343026759UL, 1797789098UL, 3229783023UL, 1745843414UL, 200554865UL, 2442780740UL, 2359926428UL, 2970332116UL, 3097392757UL, 134294482UL, +936225458UL, 1968264650UL, 64868134UL, 3821668262UL, 2502175363UL, 1623767635UL, 2936073062UL, 1991791011UL, 2971174068UL, 3142195911UL, 2874818345UL, 2192526584UL, 496586185UL, 2491564144UL, 2415210641UL, 314307270UL, 2936737494UL, 557604388UL, 1067914024UL, 3270690738UL, 375601880UL, 962749065UL, 3610467620UL, 402112984UL, 1432929499UL, 3872957776UL, 3971384069UL, 2223968592UL, 407083609UL, 2178236674UL, 1806303230UL, 3397564470UL, +12158764UL, 415570813UL, 4033667395UL, 3687406137UL, 801878150UL, 953500350UL, 3667783172UL, 1203668106UL, 902418194UL, 779786150UL, 774683730UL, 2870261992UL, 509192460UL, 1961621392UL, 1064906432UL, 3665710891UL, 1733725153UL, 1887608856UL, 1314631523UL, 4097239005UL, 29074501UL, 3472521950UL, 4040841657UL, 532128023UL, 2333441401UL, 1671717886UL, 1678544416UL, 1218347584UL, 3680929567UL, 4025753853UL, 2810948711UL, 1846100306UL, +3377469279UL, 3144481747UL, 2625781306UL, 730632118UL, 3162408393UL, 3423660386UL, 1364968369UL, 4270900402UL, 1075484840UL, 2892932277UL, 3700635052UL, 3853022563UL, 281755151UL, 1530909868UL, 2364069707UL, 2361723426UL, 738500028UL, 1401903990UL, 1543704261UL, 2442916222UL, 1076190609UL, 1882477803UL, 740024557UL, 1591015439UL, 2730909167UL, 2723330839UL, 1637373491UL, 3777799860UL, 2921269571UL, 3698591972UL, 3997463570UL, 3877862147UL, +1912888417UL, 3365137165UL, 3465700492UL, 771243134UL, 4037723169UL, 1715894739UL, 1025821874UL, 1924958945UL, 3382242859UL, 121591031UL, 483980724UL, 546523388UL, 2446882279UL, 856267778UL, 578739009UL, 2978085488UL, 480884914UL, 966764808UL, 457039953UL, 3817520708UL, 1113646451UL, 2503896910UL, 3507840816UL, 717151671UL, 4149352573UL, 1568869830UL, 395015863UL, 773165995UL, 1853682362UL, 2861368846UL, 1884368812UL, 1250092101UL, +}, +{ +916910638UL, 961623451UL, 1193013401UL, 1016438484UL, 4091279871UL, 287282633UL, 8590725UL, 3575333670UL, 324340905UL, 3133751747UL, 2840894649UL, 2980503178UL, 1111215768UL, 2783846375UL, 72516413UL, 4158424384UL, 2184094569UL, 2305724254UL, 4057093054UL, 1407652993UL, 3105191537UL, 768505376UL, 298782270UL, 993926164UL, 2694730042UL, 1479658113UL, 2376490281UL, 2767906402UL, 1619969256UL, 3256472015UL, 2563843533UL, 2974784738UL, +2529307107UL, 4289918826UL, 3105587575UL, 3748950898UL, 2182744253UL, 431888679UL, 3780324902UL, 2525978209UL, 54545903UL, 1688749940UL, 2394884334UL, 3477656171UL, 263834270UL, 1562965459UL, 804704330UL, 4185729868UL, 138898835UL, 2113063150UL, 327612841UL, 1252226275UL, 935318076UL, 2956823075UL, 4095101181UL, 1510586062UL, 156282440UL, 3386839706UL, 2294393752UL, 1306167091UL, 4005033667UL, 651716500UL, 4115192738UL, 123027719UL, +3873547487UL, 2910637335UL, 2571924586UL, 3489608656UL, 956791985UL, 2467423726UL, 3214531645UL, 2054232851UL, 49634692UL, 377192215UL, 1865068750UL, 2479252980UL, 3481787748UL, 3243507737UL, 605491073UL, 4062466752UL, 988602517UL, 1539348794UL, 1555068617UL, 2657884010UL, 460334294UL, 4240766479UL, 3639800790UL, 253377117UL, 3969136265UL, 488705329UL, 1722560286UL, 2289159295UL, 1025876008UL, 2927117896UL, 767521707UL, 2047999999UL, +4260853571UL, 2079302241UL, 2409677301UL, 1087552976UL, 2363907365UL, 2574464321UL, 2606273241UL, 3716086457UL, 26053603UL, 3162779415UL, 14843078UL, 2614076143UL, 1157531920UL, 2773275636UL, 2338825066UL, 435472225UL, 1399711137UL, 1224374788UL, 2154533280UL, 560135209UL, 935800607UL, 1940258814UL, 3826959530UL, 3423217355UL, 3704934971UL, 3815248829UL, 3878175339UL, 1395508015UL, 3295101527UL, 177901558UL, 4167531389UL, 1375148189UL, +3125377631UL, 557218961UL, 4088880299UL, 3478859071UL, 3687276754UL, 2845114223UL, 1713171361UL, 1756507633UL, 3160807894UL, 2375334470UL, 843542578UL, 1907952570UL, 1544844563UL, 2294372007UL, 3336681376UL, 734347193UL, 102566945UL, 2311037104UL, 4294750194UL, 3572240326UL, 732958152UL, 263733314UL, 2087890678UL, 331542297UL, 3549110380UL, 2073894939UL, 2104101380UL, 3670791368UL, 3122901693UL, 3799823891UL, 3783548253UL, 1102633864UL, +44327348UL, 916910638UL, 961623451UL, 1193013401UL, 1016438484UL, 1873779640UL, 287282633UL, 8590725UL, 3575333670UL, 324340905UL, 1144671533UL, 2840894649UL, 2980503178UL, 1111215768UL, 2783846375UL, 2000673937UL, 4158424384UL, 2184094569UL, 2305724254UL, 4057093054UL, 533488413UL, 3105191537UL, 768505376UL, 298782270UL, 993926164UL, 2015456740UL, 1479658113UL, 2376490281UL, 2767906402UL, 1619969256UL, 3120736988UL, 2563843533UL, +2974784738UL, 2529307107UL, 4289918826UL, 729503771UL, 3748950898UL, 2182744253UL, 431888679UL, 3780324902UL, 373638396UL, 54545903UL, 1688749940UL, 2394884334UL, 3477656171UL, 1083764681UL, 1562965459UL, 804704330UL, 4185729868UL, 138898835UL, 823405282UL, 327612841UL, 1252226275UL, 935318076UL, 2956823075UL, 899234846UL, 1510586062UL, 156282440UL, 3386839706UL, 2294393752UL, 2769934879UL, 4005033667UL, 651716500UL, 4115192738UL, +123027719UL, 3729538641UL, 2910637335UL, 2571924586UL, 3489608656UL, 956791985UL, 139360134UL, 3214531645UL, 2054232851UL, 49634692UL, 377192215UL, 2754746969UL, 2479252980UL, 3481787748UL, 3243507737UL, 605491073UL, 732155706UL, 988602517UL, 1539348794UL, 1555068617UL, 2657884010UL, 3753733088UL, 4240766479UL, 3639800790UL, 253377117UL, 3969136265UL, 3848735787UL, 1722560286UL, 2289159295UL, 1025876008UL, 2927117896UL, 3661948694UL, +2047999999UL, 4260853571UL, 2079302241UL, 2409677301UL, 3421911122UL, 2363907365UL, 2574464321UL, 2606273241UL, 3716086457UL, 2064343322UL, 3162779415UL, 14843078UL, 2614076143UL, 1157531920UL, 826449637UL, 2338825066UL, 435472225UL, 1399711137UL, 1224374788UL, 3770340198UL, 560135209UL, 935800607UL, 1940258814UL, 3826959530UL, 2963586762UL, 3704934971UL, 3815248829UL, 3878175339UL, 1395508015UL, 3721612680UL, 177901558UL, 4167531389UL, +1375148189UL, 3125377631UL, 1023552290UL, 4088880299UL, 3478859071UL, 3687276754UL, 2845114223UL, 3831557301UL, 1756507633UL, 3160807894UL, 2375334470UL, 843542578UL, 2798365898UL, 1544844563UL, 2294372007UL, 3336681376UL, 734347193UL, 1856808621UL, 2311037104UL, 4294750194UL, 3572240326UL, 732958152UL, 1999195012UL, 2087890678UL, 331542297UL, 3549110380UL, 2073894939UL, 3115936764UL, 3670791368UL, 3122901693UL, 3799823891UL, 3783548253UL, +132796150UL, 44327348UL, 916910638UL, 961623451UL, 1193013401UL, 1753944196UL, 1873779640UL, 287282633UL, 8590725UL, 3575333670UL, 1447720209UL, 1144671533UL, 2840894649UL, 2980503178UL, 1111215768UL, 1211945983UL, 2000673937UL, 4158424384UL, 2184094569UL, 2305724254UL, 402617261UL, 533488413UL, 3105191537UL, 768505376UL, 298782270UL, 2915553159UL, 2015456740UL, 1479658113UL, 2376490281UL, 2767906402UL, 3473761811UL, 3120736988UL, +2563843533UL, 2974784738UL, 2529307107UL, 737859212UL, 729503771UL, 3748950898UL, 2182744253UL, 431888679UL, 2013420163UL, 373638396UL, 54545903UL, 1688749940UL, 2394884334UL, 675998523UL, 1083764681UL, 1562965459UL, 804704330UL, 4185729868UL, 1165431355UL, 823405282UL, 327612841UL, 1252226275UL, 935318076UL, 2420680216UL, 899234846UL, 1510586062UL, 156282440UL, 3386839706UL, 2101339651UL, 2769934879UL, 4005033667UL, 651716500UL, +4115192738UL, 112049740UL, 3729538641UL, 2910637335UL, 2571924586UL, 3489608656UL, 305695595UL, 139360134UL, 3214531645UL, 2054232851UL, 49634692UL, 1073828255UL, 2754746969UL, 2479252980UL, 3481787748UL, 3243507737UL, 3392719169UL, 732155706UL, 988602517UL, 1539348794UL, 1555068617UL, 3246776527UL, 3753733088UL, 4240766479UL, 3639800790UL, 253377117UL, 872273450UL, 3848735787UL, 1722560286UL, 2289159295UL, 1025876008UL, 4168154213UL, +3661948694UL, 2047999999UL, 4260853571UL, 2079302241UL, 2380420842UL, 3421911122UL, 2363907365UL, 2574464321UL, 2606273241UL, 3881916078UL, 2064343322UL, 3162779415UL, 14843078UL, 2614076143UL, 473288515UL, 826449637UL, 2338825066UL, 435472225UL, 1399711137UL, 3068538992UL, 3770340198UL, 560135209UL, 935800607UL, 1940258814UL, 1469655183UL, 2963586762UL, 3704934971UL, 3815248829UL, 3878175339UL, 2410602840UL, 3721612680UL, 177901558UL, +4167531389UL, 1375148189UL, 1367577763UL, 1023552290UL, 4088880299UL, 3478859071UL, 3687276754UL, 678224549UL, 3831557301UL, 1756507633UL, 3160807894UL, 2375334470UL, 2884561721UL, 2798365898UL, 1544844563UL, 2294372007UL, 3336681376UL, 1938834658UL, 1856808621UL, 2311037104UL, 4294750194UL, 3572240326UL, 2786764913UL, 1999195012UL, 2087890678UL, 331542297UL, 3549110380UL, 3597797341UL, 3115936764UL, 3670791368UL, 3122901693UL, 3799823891UL, +1271317799UL, 132796150UL, 44327348UL, 916910638UL, 961623451UL, 2427821332UL, 1753944196UL, 1873779640UL, 287282633UL, 8590725UL, 1244012658UL, 1447720209UL, 1144671533UL, 2840894649UL, 2980503178UL, 3548902577UL, 1211945983UL, 2000673937UL, 4158424384UL, 2184094569UL, 2152623453UL, 402617261UL, 533488413UL, 3105191537UL, 768505376UL, 1095141108UL, 2915553159UL, 2015456740UL, 1479658113UL, 2376490281UL, 337998873UL, 3473761811UL, +3120736988UL, 2563843533UL, 2974784738UL, 3087228498UL, 737859212UL, 729503771UL, 3748950898UL, 2182744253UL, 2140410733UL, 2013420163UL, 373638396UL, 54545903UL, 1688749940UL, 528290088UL, 675998523UL, 1083764681UL, 1562965459UL, 804704330UL, 2536362875UL, 1165431355UL, 823405282UL, 327612841UL, 1252226275UL, 4037635314UL, 2420680216UL, 899234846UL, 1510586062UL, 156282440UL, 2012335895UL, 2101339651UL, 2769934879UL, 4005033667UL, +651716500UL, 2552583570UL, 112049740UL, 3729538641UL, 2910637335UL, 2571924586UL, 2436645403UL, 305695595UL, 139360134UL, 3214531645UL, 2054232851UL, 2384286326UL, 1073828255UL, 2754746969UL, 2479252980UL, 3481787748UL, 1948315585UL, 3392719169UL, 732155706UL, 988602517UL, 1539348794UL, 4110558494UL, 3246776527UL, 3753733088UL, 4240766479UL, 3639800790UL, 3627363812UL, 872273450UL, 3848735787UL, 1722560286UL, 2289159295UL, 4122430477UL, +4168154213UL, 3661948694UL, 2047999999UL, 4260853571UL, 1767882442UL, 2380420842UL, 3421911122UL, 2363907365UL, 2574464321UL, 2778622726UL, 3881916078UL, 2064343322UL, 3162779415UL, 14843078UL, 1513897109UL, 473288515UL, 826449637UL, 2338825066UL, 435472225UL, 322954918UL, 3068538992UL, 3770340198UL, 560135209UL, 935800607UL, 345602050UL, 1469655183UL, 2963586762UL, 3704934971UL, 3815248829UL, 3508249920UL, 2410602840UL, 3721612680UL, +177901558UL, 4167531389UL, 2161244150UL, 1367577763UL, 1023552290UL, 4088880299UL, 3478859071UL, 1108183104UL, 678224549UL, 3831557301UL, 1756507633UL, 3160807894UL, 2551630811UL, 2884561721UL, 2798365898UL, 1544844563UL, 2294372007UL, 2520267760UL, 1938834658UL, 1856808621UL, 2311037104UL, 4294750194UL, 2310096003UL, 2786764913UL, 1999195012UL, 2087890678UL, 331542297UL, 1205238749UL, 3597797341UL, 3115936764UL, 3670791368UL, 3122901693UL, +2008141679UL, 2018425028UL, 3435073328UL, 1452813805UL, 1628661138UL, 1323367156UL, 1062553693UL, 4029321700UL, 2772685842UL, 3798388850UL, 1315172209UL, 3930983291UL, 3816791373UL, 529176017UL, 3419610188UL, 3331589216UL, 4016977274UL, 2047089790UL, 3892571923UL, 2363414008UL, 1144631948UL, 3004954882UL, 2558739305UL, 19774033UL, 2525079911UL, 3774885821UL, 2817837373UL, 986111566UL, 1446678953UL, 3238485630UL, 3993748600UL, 1601954599UL, +3100591537UL, 2098009380UL, 3935971261UL, 4202546603UL, 3713465083UL, 3845664764UL, 2466365355UL, 1452340065UL, 2003576531UL, 1013434822UL, 2254608933UL, 783902023UL, 3129770529UL, 129130612UL, 821418228UL, 350036483UL, 3473671510UL, 4128495167UL, 2773832518UL, 683262085UL, 2143353417UL, 256251732UL, 1719056536UL, 2670223618UL, 328467339UL, 1564657740UL, 451231672UL, 2788353006UL, 882900088UL, 3255241056UL, 3198073758UL, 2541070985UL, +1941509325UL, 674933160UL, 207753676UL, 2605303964UL, 1681335994UL, 1143520001UL, 448872632UL, 302917879UL, 1100138495UL, 2058770021UL, 3116955098UL, 2081754747UL, 3734924767UL, 1916718058UL, 3873335960UL, 2740460398UL, 2171157007UL, 27677949UL, 2364721928UL, 175851655UL, 1468083950UL, 3162369526UL, 2441504540UL, 556978295UL, 2372096172UL, 3181101116UL, 2582850132UL, 1101292643UL, 862643740UL, 2095546242UL, 3261953801UL, 748040658UL, +3970037674UL, 819116843UL, 3594523650UL, 1597423019UL, 4109336883UL, 1198282420UL, 2905230517UL, 1729529596UL, 3230132814UL, 3640242164UL, 1899059108UL, 1944906555UL, 3426510495UL, 3035188107UL, 6448083UL, 1093882965UL, 2867500469UL, 3626379157UL, 1849073068UL, 897616501UL, 604221668UL, 1020676159UL, 4083635798UL, 1716022041UL, 3671877965UL, 1738820843UL, 30077467UL, 729231767UL, 3413193248UL, 207000406UL, 3854363185UL, 3302747326UL, +3293643267UL, 2101250157UL, 460131091UL, 4159442595UL, 1133391045UL, 1031215443UL, 4195487944UL, 45931575UL, 2922629291UL, 789302543UL, 3024994662UL, 442525623UL, 2850119076UL, 838309503UL, 2585361734UL, 1020449164UL, 1623631007UL, 955374631UL, 2932467671UL, 3713639221UL, 3019179416UL, 977970472UL, 1817244230UL, 3856774853UL, 1140530868UL, 886199600UL, 1218509766UL, 4001537244UL, 2840913665UL, 2133254364UL, 3332344608UL, 475291624UL, +}, +{ +1854921599UL, 2655519695UL, 3124573588UL, 319882484UL, 603545603UL, 4175512633UL, 141286453UL, 1183670252UL, 1789500145UL, 37351733UL, 3190829323UL, 2782782009UL, 493805446UL, 1228958246UL, 2672482554UL, 2274981421UL, 2935438833UL, 3625733677UL, 3679506394UL, 687805550UL, 134516308UL, 3576789728UL, 965007022UL, 1056542222UL, 2319405423UL, 3944221200UL, 950102624UL, 3848192810UL, 3205299696UL, 82033760UL, 1241913280UL, 1360146137UL, +1675732327UL, 2164452797UL, 3920498715UL, 2226452641UL, 3172047212UL, 1569171738UL, 2631589480UL, 2889660225UL, 2030783667UL, 2237381973UL, 2706217212UL, 3143638386UL, 1733174225UL, 1166820137UL, 3818389960UL, 193959252UL, 2793509934UL, 316291605UL, 2502743884UL, 1963136977UL, 3739017448UL, 25754513UL, 1590156485UL, 1856291967UL, 4143674472UL, 2538785911UL, 2159135699UL, 1908446793UL, 3303325234UL, 2589568800UL, 1193586059UL, 77481069UL, +789413194UL, 2556570543UL, 162987300UL, 1960844609UL, 2973799047UL, 4253906178UL, 315868734UL, 2542622968UL, 3949539136UL, 1479106582UL, 4225431384UL, 1235059630UL, 1533374854UL, 847792023UL, 4031286530UL, 4194276632UL, 164541100UL, 1010135841UL, 143302319UL, 1335585015UL, 1237311692UL, 20896020UL, 344974153UL, 2576803233UL, 3430251730UL, 984163376UL, 2680612471UL, 1276425436UL, 2400671554UL, 1628640140UL, 2161048926UL, 2109177634UL, +998215324UL, 3127793500UL, 1759998050UL, 3105138908UL, 2583746384UL, 2126302368UL, 3258602104UL, 1262742375UL, 3565617377UL, 3726060195UL, 157069329UL, 390662438UL, 3800994052UL, 2007694482UL, 377281730UL, 3251789121UL, 236703173UL, 122782596UL, 775407411UL, 3394010206UL, 4232159202UL, 468321553UL, 2704615220UL, 1332411375UL, 2978494251UL, 989230484UL, 3122841814UL, 2348872707UL, 731335994UL, 541354422UL, 223117443UL, 2225009071UL, +4230058949UL, 1875162926UL, 3897048544UL, 3550177883UL, 2461273592UL, 1046820583UL, 1333727817UL, 1378024753UL, 3686775275UL, 4230752590UL, 64834458UL, 1281467967UL, 729116355UL, 3886390916UL, 65029451UL, 3478506446UL, 1387684482UL, 1172004841UL, 2525409243UL, 1677678908UL, 1704646757UL, 930937262UL, 1088384271UL, 689357059UL, 1754542213UL, 702963842UL, 2864311668UL, 1960202673UL, 1009675673UL, 3742350158UL, 3751269215UL, 3166659283UL, +9090161UL, 1854921599UL, 2655519695UL, 3124573588UL, 319882484UL, 1422536794UL, 4175512633UL, 141286453UL, 1183670252UL, 1789500145UL, 850391877UL, 3190829323UL, 2782782009UL, 493805446UL, 1228958246UL, 837232655UL, 2274981421UL, 2935438833UL, 3625733677UL, 3679506394UL, 955772620UL, 134516308UL, 3576789728UL, 965007022UL, 1056542222UL, 874117013UL, 3944221200UL, 950102624UL, 3848192810UL, 3205299696UL, 543679720UL, 1241913280UL, +1360146137UL, 1675732327UL, 2164452797UL, 1169030022UL, 2226452641UL, 3172047212UL, 1569171738UL, 2631589480UL, 3783543297UL, 2030783667UL, 2237381973UL, 2706217212UL, 3143638386UL, 1560162209UL, 1166820137UL, 3818389960UL, 193959252UL, 2793509934UL, 4258046618UL, 2502743884UL, 1963136977UL, 3739017448UL, 25754513UL, 1204846712UL, 1856291967UL, 4143674472UL, 2538785911UL, 2159135699UL, 3889946075UL, 3303325234UL, 2589568800UL, 1193586059UL, +77481069UL, 969912041UL, 2556570543UL, 162987300UL, 1960844609UL, 2973799047UL, 427583517UL, 315868734UL, 2542622968UL, 3949539136UL, 1479106582UL, 92839917UL, 1235059630UL, 1533374854UL, 847792023UL, 4031286530UL, 1147875681UL, 164541100UL, 1010135841UL, 143302319UL, 1335585015UL, 368616909UL, 20896020UL, 344974153UL, 2576803233UL, 3430251730UL, 1078575783UL, 2680612471UL, 1276425436UL, 2400671554UL, 1628640140UL, 4149623645UL, +2109177634UL, 998215324UL, 3127793500UL, 1759998050UL, 3525419965UL, 2583746384UL, 2126302368UL, 3258602104UL, 1262742375UL, 1996113346UL, 3726060195UL, 157069329UL, 390662438UL, 3800994052UL, 982000497UL, 377281730UL, 3251789121UL, 236703173UL, 122782596UL, 2303768414UL, 3394010206UL, 4232159202UL, 468321553UL, 2704615220UL, 681592492UL, 2978494251UL, 989230484UL, 3122841814UL, 2348872707UL, 4089094260UL, 541354422UL, 223117443UL, +2225009071UL, 4230058949UL, 2754981128UL, 3897048544UL, 3550177883UL, 2461273592UL, 1046820583UL, 668143612UL, 1378024753UL, 3686775275UL, 4230752590UL, 64834458UL, 3765910650UL, 729116355UL, 3886390916UL, 65029451UL, 3478506446UL, 3419111947UL, 1172004841UL, 2525409243UL, 1677678908UL, 1704646757UL, 155635560UL, 1088384271UL, 689357059UL, 1754542213UL, 702963842UL, 2712009967UL, 1960202673UL, 1009675673UL, 3742350158UL, 3751269215UL, +129749802UL, 9090161UL, 1854921599UL, 2655519695UL, 3124573588UL, 809557750UL, 1422536794UL, 4175512633UL, 141286453UL, 1183670252UL, 1739311360UL, 850391877UL, 3190829323UL, 2782782009UL, 493805446UL, 1738527771UL, 837232655UL, 2274981421UL, 2935438833UL, 3625733677UL, 1858071296UL, 955772620UL, 134516308UL, 3576789728UL, 965007022UL, 3367712327UL, 874117013UL, 3944221200UL, 950102624UL, 3848192810UL, 2420548306UL, 543679720UL, +1241913280UL, 1360146137UL, 1675732327UL, 176019367UL, 1169030022UL, 2226452641UL, 3172047212UL, 1569171738UL, 76544055UL, 3783543297UL, 2030783667UL, 2237381973UL, 2706217212UL, 3283985735UL, 1560162209UL, 1166820137UL, 3818389960UL, 193959252UL, 346134252UL, 4258046618UL, 2502743884UL, 1963136977UL, 3739017448UL, 3887005605UL, 1204846712UL, 1856291967UL, 4143674472UL, 2538785911UL, 366578749UL, 3889946075UL, 3303325234UL, 2589568800UL, +1193586059UL, 2917569085UL, 969912041UL, 2556570543UL, 162987300UL, 1960844609UL, 61311938UL, 427583517UL, 315868734UL, 2542622968UL, 3949539136UL, 2278526422UL, 92839917UL, 1235059630UL, 1533374854UL, 847792023UL, 1361054176UL, 1147875681UL, 164541100UL, 1010135841UL, 143302319UL, 1348709332UL, 368616909UL, 20896020UL, 344974153UL, 2576803233UL, 3290873783UL, 1078575783UL, 2680612471UL, 1276425436UL, 2400671554UL, 628790408UL, +4149623645UL, 2109177634UL, 998215324UL, 3127793500UL, 2019336900UL, 3525419965UL, 2583746384UL, 2126302368UL, 3258602104UL, 2858154034UL, 1996113346UL, 3726060195UL, 157069329UL, 390662438UL, 2250549235UL, 982000497UL, 377281730UL, 3251789121UL, 236703173UL, 3487415996UL, 2303768414UL, 3394010206UL, 4232159202UL, 468321553UL, 2773608982UL, 681592492UL, 2978494251UL, 989230484UL, 3122841814UL, 3647638215UL, 4089094260UL, 541354422UL, +223117443UL, 2225009071UL, 2829509947UL, 2754981128UL, 3897048544UL, 3550177883UL, 2461273592UL, 282627696UL, 668143612UL, 1378024753UL, 3686775275UL, 4230752590UL, 1105868822UL, 3765910650UL, 729116355UL, 3886390916UL, 65029451UL, 328554604UL, 3419111947UL, 1172004841UL, 2525409243UL, 1677678908UL, 1395036942UL, 155635560UL, 1088384271UL, 689357059UL, 1754542213UL, 1076601715UL, 2712009967UL, 1960202673UL, 1009675673UL, 3742350158UL, +2581225953UL, 129749802UL, 9090161UL, 1854921599UL, 2655519695UL, 1393282220UL, 809557750UL, 1422536794UL, 4175512633UL, 141286453UL, 2211497169UL, 1739311360UL, 850391877UL, 3190829323UL, 2782782009UL, 2694871802UL, 1738527771UL, 837232655UL, 2274981421UL, 2935438833UL, 3145832503UL, 1858071296UL, 955772620UL, 134516308UL, 3576789728UL, 4045354759UL, 3367712327UL, 874117013UL, 3944221200UL, 950102624UL, 3562634568UL, 2420548306UL, +543679720UL, 1241913280UL, 1360146137UL, 3644280343UL, 176019367UL, 1169030022UL, 2226452641UL, 3172047212UL, 3927720006UL, 76544055UL, 3783543297UL, 2030783667UL, 2237381973UL, 1497233808UL, 3283985735UL, 1560162209UL, 1166820137UL, 3818389960UL, 2344066681UL, 346134252UL, 4258046618UL, 2502743884UL, 1963136977UL, 79988846UL, 3887005605UL, 1204846712UL, 1856291967UL, 4143674472UL, 3967952414UL, 366578749UL, 3889946075UL, 3303325234UL, +2589568800UL, 2193179011UL, 2917569085UL, 969912041UL, 2556570543UL, 162987300UL, 52882655UL, 61311938UL, 427583517UL, 315868734UL, 2542622968UL, 1575831590UL, 2278526422UL, 92839917UL, 1235059630UL, 1533374854UL, 2397068791UL, 1361054176UL, 1147875681UL, 164541100UL, 1010135841UL, 2586368032UL, 1348709332UL, 368616909UL, 20896020UL, 344974153UL, 3445652232UL, 3290873783UL, 1078575783UL, 2680612471UL, 1276425436UL, 3682156544UL, +628790408UL, 4149623645UL, 2109177634UL, 998215324UL, 4049708298UL, 2019336900UL, 3525419965UL, 2583746384UL, 2126302368UL, 1627944270UL, 2858154034UL, 1996113346UL, 3726060195UL, 157069329UL, 1481222640UL, 2250549235UL, 982000497UL, 377281730UL, 3251789121UL, 3564274539UL, 3487415996UL, 2303768414UL, 3394010206UL, 4232159202UL, 3509025997UL, 2773608982UL, 681592492UL, 2978494251UL, 989230484UL, 980252048UL, 3647638215UL, 4089094260UL, +541354422UL, 223117443UL, 543970497UL, 2829509947UL, 2754981128UL, 3897048544UL, 3550177883UL, 2736782140UL, 282627696UL, 668143612UL, 1378024753UL, 3686775275UL, 2728601425UL, 1105868822UL, 3765910650UL, 729116355UL, 3886390916UL, 1866378660UL, 328554604UL, 3419111947UL, 1172004841UL, 2525409243UL, 1506924008UL, 1395036942UL, 155635560UL, 1088384271UL, 689357059UL, 3587092123UL, 1076601715UL, 2712009967UL, 1960202673UL, 1009675673UL, +4292715891UL, 2465250857UL, 3267969665UL, 2459570573UL, 3644463083UL, 1637197500UL, 684559293UL, 3520611957UL, 2976084366UL, 1512112440UL, 1778285193UL, 1849742417UL, 3144801412UL, 3009052859UL, 820829188UL, 1382783871UL, 3373481539UL, 3777016406UL, 266942530UL, 1792334422UL, 4109859515UL, 1468149634UL, 1356457853UL, 623893785UL, 1301686542UL, 441704877UL, 3377795902UL, 879822753UL, 329462927UL, 543858304UL, 2221828617UL, 2996486613UL, +981774202UL, 1032220084UL, 1066536452UL, 1004068806UL, 1336694798UL, 3744375323UL, 3802436665UL, 3366526577UL, 418696462UL, 1776559103UL, 1291965608UL, 1623030339UL, 1443628607UL, 572114324UL, 899621592UL, 332121275UL, 3637616671UL, 457287722UL, 3803043476UL, 408472701UL, 660940326UL, 1209169008UL, 1202511620UL, 2906900959UL, 2600414642UL, 2015874468UL, 2931389161UL, 1760773669UL, 2601299639UL, 543821664UL, 3426280682UL, 1337602255UL, +3334593650UL, 1320885980UL, 3857269540UL, 2548321029UL, 2250001180UL, 673341051UL, 1900184720UL, 731675831UL, 2461790412UL, 2593291320UL, 1640301250UL, 863529987UL, 91627443UL, 2437824309UL, 2834231475UL, 4093270720UL, 1474594761UL, 4186662839UL, 1683556862UL, 1302286991UL, 806676270UL, 703274107UL, 3756759580UL, 674737904UL, 912015048UL, 1823306025UL, 1509430520UL, 3128952761UL, 290841833UL, 3917789380UL, 1022040580UL, 1810054038UL, +334998864UL, 1009274987UL, 310979037UL, 606749827UL, 546291081UL, 3438438313UL, 1840081424UL, 1950680845UL, 4217236364UL, 1814584903UL, 2814353208UL, 194196981UL, 1540331253UL, 3135937654UL, 773351497UL, 1878220007UL, 3097009802UL, 1252607159UL, 1378821846UL, 2741884614UL, 178612659UL, 3656860395UL, 1259606652UL, 3942111545UL, 488406826UL, 3640897405UL, 3419000480UL, 353909713UL, 2996208477UL, 2862593073UL, 108483327UL, 648472258UL, +1060249632UL, 1049865483UL, 430087518UL, 1364157854UL, 3367631180UL, 251313827UL, 2374149836UL, 2109357086UL, 479172068UL, 464775113UL, 1806677787UL, 3488082411UL, 356035738UL, 3080424395UL, 4134646749UL, 369528743UL, 1031004516UL, 2525336414UL, 4189798138UL, 3928909462UL, 568714397UL, 1681832820UL, 1753328641UL, 827357673UL, 1651960551UL, 1798317455UL, 737101952UL, 3257553606UL, 400882781UL, 1473208110UL, 4134183873UL, 2193420912UL, +}, +{ +2483976489UL, 2790651795UL, 3298324523UL, 3508205426UL, 2236819708UL, 917494217UL, 769620837UL, 3411018785UL, 2391335000UL, 1627061280UL, 3356773416UL, 1288706527UL, 4178910717UL, 3636299534UL, 4221874052UL, 3674654381UL, 537787012UL, 4271656840UL, 185820273UL, 1160533598UL, 1862365049UL, 2550353307UL, 1392072847UL, 1870891365UL, 1517453821UL, 524666025UL, 3645751565UL, 2415020247UL, 3691419894UL, 2580450642UL, 2130267479UL, 3636103610UL, +562446539UL, 750696587UL, 97137475UL, 3894066051UL, 2239638596UL, 3256181120UL, 3981041836UL, 774947039UL, 451287677UL, 3618957054UL, 4236303539UL, 1027744929UL, 1497195372UL, 498574915UL, 2164122779UL, 582902291UL, 3040883311UL, 1626221455UL, 1853378UL, 2125490000UL, 3185055972UL, 1607660025UL, 432884530UL, 779476209UL, 124284956UL, 2488937128UL, 2521389012UL, 107485781UL, 2873055013UL, 1171872946UL, 3130489952UL, 4273333914UL, +646240524UL, 3970896645UL, 942009076UL, 4069926418UL, 3129385884UL, 3470469370UL, 388702536UL, 450999415UL, 2995728716UL, 1687173264UL, 3049352827UL, 2648078738UL, 190663705UL, 486809970UL, 424002670UL, 2421764946UL, 2941043524UL, 3841512738UL, 119077561UL, 1801381572UL, 2208680167UL, 2502730219UL, 9899015UL, 2455199230UL, 3755314209UL, 3958460021UL, 3846398898UL, 1405136244UL, 2870563334UL, 821846618UL, 2790899812UL, 863647562UL, +629585032UL, 958925512UL, 1190540209UL, 57251233UL, 2109551995UL, 2294881622UL, 2603370255UL, 3839518646UL, 123838650UL, 3436270690UL, 1637121394UL, 3761101432UL, 954001192UL, 759760236UL, 3268295908UL, 2313083096UL, 630164216UL, 2367213191UL, 3992059381UL, 3292952769UL, 2040774258UL, 1420209005UL, 527547730UL, 1222399440UL, 1515078401UL, 2005580991UL, 645585788UL, 2256370254UL, 3057235502UL, 2870727428UL, 2785498804UL, 333440916UL, +1873686678UL, 2489794553UL, 3726728164UL, 3405629071UL, 3869328595UL, 3081963448UL, 2122133003UL, 1428788181UL, 4141962679UL, 41030733UL, 183716455UL, 36316501UL, 1430796327UL, 1884066707UL, 1216957106UL, 3455082673UL, 1092665987UL, 535070834UL, 3873372533UL, 175757671UL, 3414803303UL, 791028991UL, 3436610906UL, 2950895946UL, 977680845UL, 4224715886UL, 2809442211UL, 4044727083UL, 3035532020UL, 4253187882UL, 969203959UL, 2539482914UL, +813880136UL, 2483976489UL, 2790651795UL, 3298324523UL, 3508205426UL, 49280479UL, 917494217UL, 769620837UL, 3411018785UL, 2391335000UL, 3036738936UL, 3356773416UL, 1288706527UL, 4178910717UL, 3636299534UL, 2294957038UL, 3674654381UL, 537787012UL, 4271656840UL, 185820273UL, 2622722506UL, 1862365049UL, 2550353307UL, 1392072847UL, 1870891365UL, 2838104933UL, 524666025UL, 3645751565UL, 2415020247UL, 3691419894UL, 1295777418UL, 2130267479UL, +3636103610UL, 562446539UL, 750696587UL, 249830932UL, 3894066051UL, 2239638596UL, 3256181120UL, 3981041836UL, 3217398876UL, 451287677UL, 3618957054UL, 4236303539UL, 1027744929UL, 1724964245UL, 498574915UL, 2164122779UL, 582902291UL, 3040883311UL, 3101287841UL, 1853378UL, 2125490000UL, 3185055972UL, 1607660025UL, 1128474163UL, 779476209UL, 124284956UL, 2488937128UL, 2521389012UL, 338597864UL, 2873055013UL, 1171872946UL, 3130489952UL, +4273333914UL, 1557892392UL, 3970896645UL, 942009076UL, 4069926418UL, 3129385884UL, 2688433076UL, 388702536UL, 450999415UL, 2995728716UL, 1687173264UL, 157685189UL, 2648078738UL, 190663705UL, 486809970UL, 424002670UL, 979986388UL, 2941043524UL, 3841512738UL, 119077561UL, 1801381572UL, 2668625968UL, 2502730219UL, 9899015UL, 2455199230UL, 3755314209UL, 2699515741UL, 3846398898UL, 1405136244UL, 2870563334UL, 821846618UL, 505633792UL, +863647562UL, 629585032UL, 958925512UL, 1190540209UL, 2067402799UL, 2109551995UL, 2294881622UL, 2603370255UL, 3839518646UL, 2688067120UL, 3436270690UL, 1637121394UL, 3761101432UL, 954001192UL, 3206166733UL, 3268295908UL, 2313083096UL, 630164216UL, 2367213191UL, 3007494680UL, 3292952769UL, 2040774258UL, 1420209005UL, 527547730UL, 4047406592UL, 1515078401UL, 2005580991UL, 645585788UL, 2256370254UL, 13805572UL, 2870727428UL, 2785498804UL, +333440916UL, 1873686678UL, 1928222740UL, 3726728164UL, 3405629071UL, 3869328595UL, 3081963448UL, 2971423693UL, 1428788181UL, 4141962679UL, 41030733UL, 183716455UL, 4064095256UL, 1430796327UL, 1884066707UL, 1216957106UL, 3455082673UL, 985592757UL, 535070834UL, 3873372533UL, 175757671UL, 3414803303UL, 2159028553UL, 3436610906UL, 2950895946UL, 977680845UL, 4224715886UL, 345462057UL, 4044727083UL, 3035532020UL, 4253187882UL, 969203959UL, +984166534UL, 813880136UL, 2483976489UL, 2790651795UL, 3298324523UL, 1080001158UL, 49280479UL, 917494217UL, 769620837UL, 3411018785UL, 3216598401UL, 3036738936UL, 3356773416UL, 1288706527UL, 4178910717UL, 3311472057UL, 2294957038UL, 3674654381UL, 537787012UL, 4271656840UL, 220045511UL, 2622722506UL, 1862365049UL, 2550353307UL, 1392072847UL, 3057632678UL, 2838104933UL, 524666025UL, 3645751565UL, 2415020247UL, 252304106UL, 1295777418UL, +2130267479UL, 3636103610UL, 562446539UL, 80437039UL, 249830932UL, 3894066051UL, 2239638596UL, 3256181120UL, 117173223UL, 3217398876UL, 451287677UL, 3618957054UL, 4236303539UL, 1986849360UL, 1724964245UL, 498574915UL, 2164122779UL, 582902291UL, 288631030UL, 3101287841UL, 1853378UL, 2125490000UL, 3185055972UL, 824635664UL, 1128474163UL, 779476209UL, 124284956UL, 2488937128UL, 1231646648UL, 338597864UL, 2873055013UL, 1171872946UL, +3130489952UL, 708957725UL, 1557892392UL, 3970896645UL, 942009076UL, 4069926418UL, 2286522565UL, 2688433076UL, 388702536UL, 450999415UL, 2995728716UL, 2523361978UL, 157685189UL, 2648078738UL, 190663705UL, 486809970UL, 151444406UL, 979986388UL, 2941043524UL, 3841512738UL, 119077561UL, 3762447035UL, 2668625968UL, 2502730219UL, 9899015UL, 2455199230UL, 3532439568UL, 2699515741UL, 3846398898UL, 1405136244UL, 2870563334UL, 2242036665UL, +505633792UL, 863647562UL, 629585032UL, 958925512UL, 2618618630UL, 2067402799UL, 2109551995UL, 2294881622UL, 2603370255UL, 2461404010UL, 2688067120UL, 3436270690UL, 1637121394UL, 3761101432UL, 1076814097UL, 3206166733UL, 3268295908UL, 2313083096UL, 630164216UL, 12196305UL, 3007494680UL, 3292952769UL, 2040774258UL, 1420209005UL, 2609377752UL, 4047406592UL, 1515078401UL, 2005580991UL, 645585788UL, 865985176UL, 13805572UL, 2870727428UL, +2785498804UL, 333440916UL, 3735553268UL, 1928222740UL, 3726728164UL, 3405629071UL, 3869328595UL, 501640466UL, 2971423693UL, 1428788181UL, 4141962679UL, 41030733UL, 97561214UL, 4064095256UL, 1430796327UL, 1884066707UL, 1216957106UL, 3840122090UL, 985592757UL, 535070834UL, 3873372533UL, 175757671UL, 3856277268UL, 2159028553UL, 3436610906UL, 2950895946UL, 977680845UL, 3313441827UL, 345462057UL, 4044727083UL, 3035532020UL, 4253187882UL, +3468811573UL, 984166534UL, 813880136UL, 2483976489UL, 2790651795UL, 3733649754UL, 1080001158UL, 49280479UL, 917494217UL, 769620837UL, 3969566450UL, 3216598401UL, 3036738936UL, 3356773416UL, 1288706527UL, 2444128005UL, 3311472057UL, 2294957038UL, 3674654381UL, 537787012UL, 4166109669UL, 220045511UL, 2622722506UL, 1862365049UL, 2550353307UL, 2552992760UL, 3057632678UL, 2838104933UL, 524666025UL, 3645751565UL, 664164441UL, 252304106UL, +1295777418UL, 2130267479UL, 3636103610UL, 3227561061UL, 80437039UL, 249830932UL, 3894066051UL, 2239638596UL, 1071536668UL, 117173223UL, 3217398876UL, 451287677UL, 3618957054UL, 3066415327UL, 1986849360UL, 1724964245UL, 498574915UL, 2164122779UL, 3541914330UL, 288631030UL, 3101287841UL, 1853378UL, 2125490000UL, 2207189978UL, 824635664UL, 1128474163UL, 779476209UL, 124284956UL, 2117633906UL, 1231646648UL, 338597864UL, 2873055013UL, +1171872946UL, 891038594UL, 708957725UL, 1557892392UL, 3970896645UL, 942009076UL, 42952651UL, 2286522565UL, 2688433076UL, 388702536UL, 450999415UL, 2986730356UL, 2523361978UL, 157685189UL, 2648078738UL, 190663705UL, 3058267870UL, 151444406UL, 979986388UL, 2941043524UL, 3841512738UL, 1844101292UL, 3762447035UL, 2668625968UL, 2502730219UL, 9899015UL, 2599582093UL, 3532439568UL, 2699515741UL, 3846398898UL, 1405136244UL, 811001941UL, +2242036665UL, 505633792UL, 863647562UL, 629585032UL, 2722320710UL, 2618618630UL, 2067402799UL, 2109551995UL, 2294881622UL, 1820862072UL, 2461404010UL, 2688067120UL, 3436270690UL, 1637121394UL, 3642978005UL, 1076814097UL, 3206166733UL, 3268295908UL, 2313083096UL, 1900318020UL, 12196305UL, 3007494680UL, 3292952769UL, 2040774258UL, 520848705UL, 2609377752UL, 4047406592UL, 1515078401UL, 2005580991UL, 2530251392UL, 865985176UL, 13805572UL, +2870727428UL, 2785498804UL, 2878984912UL, 3735553268UL, 1928222740UL, 3726728164UL, 3405629071UL, 2717736455UL, 501640466UL, 2971423693UL, 1428788181UL, 4141962679UL, 3704214873UL, 97561214UL, 4064095256UL, 1430796327UL, 1884066707UL, 1721732760UL, 3840122090UL, 985592757UL, 535070834UL, 3873372533UL, 770732059UL, 3856277268UL, 2159028553UL, 3436610906UL, 2950895946UL, 33753949UL, 3313441827UL, 345462057UL, 4044727083UL, 3035532020UL, +4166506071UL, 2719759982UL, 1025532659UL, 3811323959UL, 713457907UL, 1577198020UL, 1719946821UL, 3963262337UL, 1719605451UL, 703663722UL, 1943886497UL, 2916371044UL, 1655862745UL, 109438187UL, 195575943UL, 2572727533UL, 2421761970UL, 1796539813UL, 2020762515UL, 1191344316UL, 2492085516UL, 2778033179UL, 4002316684UL, 1571080685UL, 1157340389UL, 3859584731UL, 3403766082UL, 2292873365UL, 2032258920UL, 1749575450UL, 848549431UL, 1893685820UL, +3510068298UL, 3308906564UL, 1193936308UL, 2561670234UL, 1043148718UL, 2611815896UL, 3832995202UL, 2436487998UL, 3377369330UL, 1174818128UL, 796514731UL, 1985886833UL, 88296218UL, 3032898657UL, 4101301361UL, 1486994584UL, 237792475UL, 1029399834UL, 1708840018UL, 2934039708UL, 1496674948UL, 4243234983UL, 3896751668UL, 1726119825UL, 2706068825UL, 1900013134UL, 2639641919UL, 1433377392UL, 2962655166UL, 1870954268UL, 3873603462UL, 1778084630UL, +2393311756UL, 4135022799UL, 3669603001UL, 811404758UL, 784379778UL, 4283689136UL, 405168660UL, 3873488622UL, 486946690UL, 347427153UL, 2139072474UL, 1143349522UL, 3780264455UL, 2938731842UL, 3864001470UL, 3497981827UL, 2703917008UL, 3222236962UL, 2604106616UL, 1281570367UL, 175937153UL, 433252852UL, 3232065906UL, 1111895932UL, 1027363895UL, 2435093744UL, 4232690481UL, 1940855209UL, 2844613991UL, 2095175619UL, 3479946852UL, 393314401UL, +3625733631UL, 1073779513UL, 2884072879UL, 4089630675UL, 3614205484UL, 1379809260UL, 3980251795UL, 3914556410UL, 3633356126UL, 3030204458UL, 1654727861UL, 3765074811UL, 959734060UL, 842315676UL, 353688341UL, 145655006UL, 1972100601UL, 1456042517UL, 3767579955UL, 4282066379UL, 498998655UL, 4123310742UL, 1801424182UL, 777808179UL, 655425670UL, 588715641UL, 2136252742UL, 1283378143UL, 639191135UL, 3132375783UL, 276649124UL, 2036776039UL, +3352396498UL, 3893441746UL, 3298373918UL, 1024178230UL, 2623051553UL, 1956117442UL, 2955394456UL, 2478945776UL, 3904945720UL, 769232312UL, 2168822980UL, 3715831945UL, 453874622UL, 3351529191UL, 3256151193UL, 808042625UL, 1700919462UL, 1008305347UL, 1518733915UL, 3194328753UL, 2228970756UL, 2604658038UL, 1376476152UL, 2147167203UL, 2585867511UL, 445717950UL, 3595016420UL, 3673970127UL, 3640614546UL, 494944945UL, 152508312UL, 4160926899UL, +}, +{ +3225674336UL, 827428943UL, 2858523441UL, 2447266124UL, 1539223637UL, 2299756421UL, 776912458UL, 279091824UL, 1152725492UL, 3903457284UL, 3987010398UL, 3996115574UL, 839506039UL, 3052513014UL, 28550291UL, 2597814974UL, 2328446377UL, 1961600298UL, 3695276714UL, 1334932648UL, 1141381380UL, 3025370440UL, 997698792UL, 931473445UL, 3091440507UL, 820119215UL, 3586778616UL, 1993126242UL, 4252838072UL, 3033829531UL, 2120026924UL, 65722921UL, +746724958UL, 461423533UL, 1582298542UL, 1564918930UL, 3710935369UL, 419349792UL, 3914061713UL, 2279209938UL, 770031171UL, 2062767935UL, 3373230309UL, 3582372364UL, 2025682996UL, 3352859025UL, 1262632952UL, 3140021482UL, 501370035UL, 2554730117UL, 352450195UL, 1002557127UL, 2813224858UL, 2808406559UL, 290476252UL, 4216846311UL, 1187381982UL, 3131323304UL, 1094330039UL, 2646234280UL, 655242013UL, 1152156402UL, 3658526705UL, 3565043535UL, +693375321UL, 2120064836UL, 3726555752UL, 97387177UL, 546586686UL, 1013492636UL, 3874404446UL, 440995849UL, 1929251266UL, 95137166UL, 564969023UL, 3559119399UL, 3855477390UL, 2439885481UL, 2492213232UL, 2611214170UL, 2054191666UL, 2778642234UL, 2267416277UL, 2194315209UL, 1360165075UL, 1018128176UL, 2841084399UL, 3028189871UL, 3631770575UL, 541021087UL, 1091467742UL, 2743780329UL, 3566538467UL, 1277066122UL, 279582475UL, 2712119598UL, +3296319359UL, 4187226385UL, 1468994750UL, 2946664285UL, 2284913307UL, 740953233UL, 3351500634UL, 1791054313UL, 3355533193UL, 610062694UL, 3089981426UL, 3469441840UL, 3225672476UL, 2223653903UL, 2593994385UL, 548784340UL, 549871569UL, 865468702UL, 1593939385UL, 645229999UL, 1412095765UL, 2814231763UL, 3619658094UL, 877462820UL, 2198765077UL, 1845119421UL, 4144145546UL, 1356681209UL, 848707034UL, 4144513299UL, 3231318896UL, 3382035479UL, +693621410UL, 2821661683UL, 4236142563UL, 680649431UL, 3290999942UL, 200856634UL, 617766412UL, 3194332974UL, 4102392657UL, 2776797278UL, 2932808060UL, 793967937UL, 2149374605UL, 3736514467UL, 3547689148UL, 3744888920UL, 98278184UL, 1497045279UL, 2945126332UL, 4285864315UL, 2791068812UL, 1939995011UL, 56752862UL, 864909862UL, 625377571UL, 2266362085UL, 1050287398UL, 925722519UL, 1008109592UL, 2819528345UL, 3573068613UL, 1915083884UL, +1536828870UL, 3225674336UL, 827428943UL, 2858523441UL, 2447266124UL, 2186287936UL, 2299756421UL, 776912458UL, 279091824UL, 1152725492UL, 1271286102UL, 3987010398UL, 3996115574UL, 839506039UL, 3052513014UL, 1036957208UL, 2597814974UL, 2328446377UL, 1961600298UL, 3695276714UL, 2395157917UL, 1141381380UL, 3025370440UL, 997698792UL, 931473445UL, 2727078785UL, 820119215UL, 3586778616UL, 1993126242UL, 4252838072UL, 1171102868UL, 2120026924UL, +65722921UL, 746724958UL, 461423533UL, 2335086228UL, 1564918930UL, 3710935369UL, 419349792UL, 3914061713UL, 1136716661UL, 770031171UL, 2062767935UL, 3373230309UL, 3582372364UL, 4100328450UL, 3352859025UL, 1262632952UL, 3140021482UL, 501370035UL, 2579000299UL, 352450195UL, 1002557127UL, 2813224858UL, 2808406559UL, 2642514897UL, 4216846311UL, 1187381982UL, 3131323304UL, 1094330039UL, 3092488663UL, 655242013UL, 1152156402UL, 3658526705UL, +3565043535UL, 3280658482UL, 2120064836UL, 3726555752UL, 97387177UL, 546586686UL, 584864345UL, 3874404446UL, 440995849UL, 1929251266UL, 95137166UL, 823950215UL, 3559119399UL, 3855477390UL, 2439885481UL, 2492213232UL, 2297040376UL, 2054191666UL, 2778642234UL, 2267416277UL, 2194315209UL, 573807317UL, 1018128176UL, 2841084399UL, 3028189871UL, 3631770575UL, 2747338726UL, 1091467742UL, 2743780329UL, 3566538467UL, 1277066122UL, 1715139924UL, +2712119598UL, 3296319359UL, 4187226385UL, 1468994750UL, 3361368810UL, 2284913307UL, 740953233UL, 3351500634UL, 1791054313UL, 4290564545UL, 610062694UL, 3089981426UL, 3469441840UL, 3225672476UL, 1010959310UL, 2593994385UL, 548784340UL, 549871569UL, 865468702UL, 1825306744UL, 645229999UL, 1412095765UL, 2814231763UL, 3619658094UL, 3792219969UL, 2198765077UL, 1845119421UL, 4144145546UL, 1356681209UL, 268197516UL, 4144513299UL, 3231318896UL, +3382035479UL, 693621410UL, 2786831464UL, 4236142563UL, 680649431UL, 3290999942UL, 200856634UL, 3822069622UL, 3194332974UL, 4102392657UL, 2776797278UL, 2932808060UL, 525501162UL, 2149374605UL, 3736514467UL, 3547689148UL, 3744888920UL, 3219948462UL, 1497045279UL, 2945126332UL, 4285864315UL, 2791068812UL, 2678467476UL, 56752862UL, 864909862UL, 625377571UL, 2266362085UL, 2258093843UL, 925722519UL, 1008109592UL, 2819528345UL, 3573068613UL, +2743241289UL, 1536828870UL, 3225674336UL, 827428943UL, 2858523441UL, 992128922UL, 2186287936UL, 2299756421UL, 776912458UL, 279091824UL, 2108721702UL, 1271286102UL, 3987010398UL, 3996115574UL, 839506039UL, 1315622698UL, 1036957208UL, 2597814974UL, 2328446377UL, 1961600298UL, 3098343478UL, 2395157917UL, 1141381380UL, 3025370440UL, 997698792UL, 1317753106UL, 2727078785UL, 820119215UL, 3586778616UL, 1993126242UL, 2295599934UL, 1171102868UL, +2120026924UL, 65722921UL, 746724958UL, 3999203443UL, 2335086228UL, 1564918930UL, 3710935369UL, 419349792UL, 1662083910UL, 1136716661UL, 770031171UL, 2062767935UL, 3373230309UL, 3271761171UL, 4100328450UL, 3352859025UL, 1262632952UL, 3140021482UL, 3981040854UL, 2579000299UL, 352450195UL, 1002557127UL, 2813224858UL, 1064251076UL, 2642514897UL, 4216846311UL, 1187381982UL, 3131323304UL, 2077640887UL, 3092488663UL, 655242013UL, 1152156402UL, +3658526705UL, 548941006UL, 3280658482UL, 2120064836UL, 3726555752UL, 97387177UL, 4112878213UL, 584864345UL, 3874404446UL, 440995849UL, 1929251266UL, 227230803UL, 823950215UL, 3559119399UL, 3855477390UL, 2439885481UL, 610498128UL, 2297040376UL, 2054191666UL, 2778642234UL, 2267416277UL, 518192832UL, 573807317UL, 1018128176UL, 2841084399UL, 3028189871UL, 2512871059UL, 2747338726UL, 1091467742UL, 2743780329UL, 3566538467UL, 386661563UL, +1715139924UL, 2712119598UL, 3296319359UL, 4187226385UL, 2508754324UL, 3361368810UL, 2284913307UL, 740953233UL, 3351500634UL, 1296305541UL, 4290564545UL, 610062694UL, 3089981426UL, 3469441840UL, 148510865UL, 1010959310UL, 2593994385UL, 548784340UL, 549871569UL, 124676809UL, 1825306744UL, 645229999UL, 1412095765UL, 2814231763UL, 2540745278UL, 3792219969UL, 2198765077UL, 1845119421UL, 4144145546UL, 3966655401UL, 268197516UL, 4144513299UL, +3231318896UL, 3382035479UL, 1674022032UL, 2786831464UL, 4236142563UL, 680649431UL, 3290999942UL, 4065303704UL, 3822069622UL, 3194332974UL, 4102392657UL, 2776797278UL, 3735376922UL, 525501162UL, 2149374605UL, 3736514467UL, 3547689148UL, 2064870756UL, 3219948462UL, 1497045279UL, 2945126332UL, 4285864315UL, 2389978045UL, 2678467476UL, 56752862UL, 864909862UL, 625377571UL, 2308006661UL, 2258093843UL, 925722519UL, 1008109592UL, 2819528345UL, +2927186231UL, 2743241289UL, 1536828870UL, 3225674336UL, 827428943UL, 1583633720UL, 992128922UL, 2186287936UL, 2299756421UL, 776912458UL, 298217241UL, 2108721702UL, 1271286102UL, 3987010398UL, 3996115574UL, 1041730366UL, 1315622698UL, 1036957208UL, 2597814974UL, 2328446377UL, 1386688725UL, 3098343478UL, 2395157917UL, 1141381380UL, 3025370440UL, 2292273773UL, 1317753106UL, 2727078785UL, 820119215UL, 3586778616UL, 206996196UL, 2295599934UL, +1171102868UL, 2120026924UL, 65722921UL, 3271158508UL, 3999203443UL, 2335086228UL, 1564918930UL, 3710935369UL, 3305544914UL, 1662083910UL, 1136716661UL, 770031171UL, 2062767935UL, 4244195826UL, 3271761171UL, 4100328450UL, 3352859025UL, 1262632952UL, 3581040310UL, 3981040854UL, 2579000299UL, 352450195UL, 1002557127UL, 1789606594UL, 1064251076UL, 2642514897UL, 4216846311UL, 1187381982UL, 1519386238UL, 2077640887UL, 3092488663UL, 655242013UL, +1152156402UL, 3732146227UL, 548941006UL, 3280658482UL, 2120064836UL, 3726555752UL, 2631398817UL, 4112878213UL, 584864345UL, 3874404446UL, 440995849UL, 3541162446UL, 227230803UL, 823950215UL, 3559119399UL, 3855477390UL, 560704260UL, 610498128UL, 2297040376UL, 2054191666UL, 2778642234UL, 1614756373UL, 518192832UL, 573807317UL, 1018128176UL, 2841084399UL, 927011949UL, 2512871059UL, 2747338726UL, 1091467742UL, 2743780329UL, 566198434UL, +386661563UL, 1715139924UL, 2712119598UL, 3296319359UL, 520529825UL, 2508754324UL, 3361368810UL, 2284913307UL, 740953233UL, 2414584088UL, 1296305541UL, 4290564545UL, 610062694UL, 3089981426UL, 120496553UL, 148510865UL, 1010959310UL, 2593994385UL, 548784340UL, 3206664898UL, 124676809UL, 1825306744UL, 645229999UL, 1412095765UL, 821445348UL, 2540745278UL, 3792219969UL, 2198765077UL, 1845119421UL, 3434574619UL, 3966655401UL, 268197516UL, +4144513299UL, 3231318896UL, 3856935910UL, 1674022032UL, 2786831464UL, 4236142563UL, 680649431UL, 3331403374UL, 4065303704UL, 3822069622UL, 3194332974UL, 4102392657UL, 2194924932UL, 3735376922UL, 525501162UL, 2149374605UL, 3736514467UL, 2041458481UL, 2064870756UL, 3219948462UL, 1497045279UL, 2945126332UL, 3515890044UL, 2389978045UL, 2678467476UL, 56752862UL, 864909862UL, 1009125580UL, 2308006661UL, 2258093843UL, 925722519UL, 1008109592UL, +4166824654UL, 3399481064UL, 3848337172UL, 841675162UL, 2388734555UL, 3373081217UL, 1627287001UL, 1958651480UL, 1771323855UL, 2126620758UL, 3879967947UL, 1885140905UL, 806066092UL, 2168342987UL, 3778265278UL, 943582962UL, 3895768303UL, 337928214UL, 3677576461UL, 1884088203UL, 2629440785UL, 2357038005UL, 2362450760UL, 2080907681UL, 2644383608UL, 4153875040UL, 794977307UL, 2675637463UL, 2655426076UL, 3481699657UL, 2262369403UL, 1038608931UL, +4210267953UL, 2376694315UL, 2661705117UL, 3994997027UL, 2994346963UL, 4074343171UL, 833108024UL, 3562046155UL, 1113632369UL, 3087093963UL, 2115712884UL, 2778607581UL, 2702162487UL, 1347693590UL, 4271098334UL, 2746712394UL, 1629623802UL, 1932973152UL, 3077074108UL, 1338011180UL, 848785806UL, 1834095770UL, 4017238UL, 2661097500UL, 2935787683UL, 1214195119UL, 3099491937UL, 3868451396UL, 1063740008UL, 2768962809UL, 2554721244UL, 695479209UL, +2634119800UL, 1379839034UL, 2653377927UL, 921934002UL, 3586936843UL, 3035369677UL, 769283110UL, 2417935220UL, 3330084607UL, 2020519519UL, 2546176786UL, 1523223165UL, 3654065096UL, 1835059231UL, 2776263618UL, 3837173427UL, 3236141295UL, 1184415634UL, 157448610UL, 2474336972UL, 3313035876UL, 309195150UL, 2288837115UL, 548743307UL, 528342914UL, 1527562212UL, 554918643UL, 2739291918UL, 2630873849UL, 155419923UL, 226845272UL, 1343735931UL, +3106346884UL, 4177975386UL, 2515480406UL, 2049734808UL, 2802879609UL, 1805234272UL, 317920918UL, 745796250UL, 3816657414UL, 4198378080UL, 3057334192UL, 503016924UL, 2027816790UL, 579332504UL, 3037999504UL, 2857298788UL, 911046668UL, 1170775701UL, 2369720UL, 3364839261UL, 1462383461UL, 181600856UL, 1315241696UL, 2861043792UL, 3549404088UL, 3974245218UL, 4141518566UL, 1195336199UL, 2291064152UL, 3287203016UL, 3867432937UL, 2593766219UL, +2114273192UL, 3716228986UL, 410286941UL, 2497285113UL, 1338500439UL, 3748757692UL, 2315519304UL, 545570554UL, 1519868916UL, 679216320UL, 3264840479UL, 4083041163UL, 261878334UL, 2370312122UL, 1408058272UL, 1287635274UL, 3433241543UL, 3923613754UL, 2423502603UL, 3948993135UL, 1418484161UL, 230113502UL, 1766447938UL, 3101286974UL, 917358979UL, 2836128279UL, 2859079881UL, 3162688352UL, 2158281644UL, 154509481UL, 2409785274UL, 3096379437UL, +}, +{ +2456954827UL, 2895978734UL, 1621803157UL, 230462381UL, 4046364119UL, 716597790UL, 2031510641UL, 2208319977UL, 1107910846UL, 3379950723UL, 3628284249UL, 1393263274UL, 3842378742UL, 768116962UL, 1782906996UL, 3022943801UL, 510040722UL, 2180373447UL, 1294989632UL, 1659724107UL, 953774117UL, 500296619UL, 2269873184UL, 3215368465UL, 3933601613UL, 2401810535UL, 3568992417UL, 617528376UL, 2437412983UL, 2921242388UL, 2311040363UL, 3695847323UL, +1609309841UL, 3222455492UL, 1108155620UL, 397599239UL, 3344183623UL, 1159383441UL, 81554651UL, 4223302962UL, 2812031899UL, 2613176831UL, 2967803832UL, 3560382993UL, 670173062UL, 2361031672UL, 1745444335UL, 2067906079UL, 3019908371UL, 2662226130UL, 2962440272UL, 3053411095UL, 92212044UL, 1041941495UL, 4116546365UL, 2094375399UL, 3992554702UL, 216246182UL, 2271736480UL, 1006434362UL, 4104644208UL, 2543874803UL, 1310440964UL, 1956002873UL, +1485192936UL, 3027546418UL, 448786402UL, 749040342UL, 406538664UL, 2522826782UL, 3681979470UL, 3941253886UL, 672615054UL, 3655479714UL, 392178376UL, 1619518340UL, 1639889010UL, 666186812UL, 4094569743UL, 2947917117UL, 3308938954UL, 1572886498UL, 1065510431UL, 2158389109UL, 1583642689UL, 1763046973UL, 3578310229UL, 4106948216UL, 58659757UL, 691952777UL, 3394715763UL, 3333944006UL, 3020203798UL, 3598064251UL, 3151881711UL, 2071056894UL, +1263790655UL, 4188233031UL, 4230429856UL, 3088041549UL, 3031631424UL, 3912597408UL, 1768734847UL, 1975027092UL, 3976493733UL, 2376551740UL, 1137628506UL, 535767974UL, 3105256806UL, 15427398UL, 2472341690UL, 685997424UL, 1374644561UL, 2446214061UL, 2844847931UL, 1058649390UL, 1581230869UL, 1725846082UL, 3062699842UL, 1116400547UL, 1095426642UL, 2940190462UL, 4276038488UL, 2091764667UL, 4074059985UL, 98163536UL, 4157153745UL, 32476821UL, +2354284775UL, 752663757UL, 2987293678UL, 1119786914UL, 3019442904UL, 111185876UL, 3569592548UL, 3991775183UL, 3161418733UL, 3973354577UL, 1650454973UL, 426129509UL, 3659038742UL, 1387393667UL, 543731583UL, 781586523UL, 917315276UL, 832142534UL, 3911092159UL, 325250500UL, 2735441676UL, 163564958UL, 1002098855UL, 337936437UL, 1869530240UL, 2233969733UL, 4108076124UL, 3255026725UL, 4072134049UL, 2083771067UL, 1559589006UL, 1845121907UL, +466036013UL, 2456954827UL, 2895978734UL, 1621803157UL, 230462381UL, 2022150409UL, 716597790UL, 2031510641UL, 2208319977UL, 1107910846UL, 1838834877UL, 3628284249UL, 1393263274UL, 3842378742UL, 768116962UL, 2303040715UL, 3022943801UL, 510040722UL, 2180373447UL, 1294989632UL, 3074858415UL, 953774117UL, 500296619UL, 2269873184UL, 3215368465UL, 3531413908UL, 2401810535UL, 3568992417UL, 617528376UL, 2437412983UL, 1730632320UL, 2311040363UL, +3695847323UL, 1609309841UL, 3222455492UL, 3189359980UL, 397599239UL, 3344183623UL, 1159383441UL, 81554651UL, 1933731121UL, 2812031899UL, 2613176831UL, 2967803832UL, 3560382993UL, 758113139UL, 2361031672UL, 1745444335UL, 2067906079UL, 3019908371UL, 3537991495UL, 2962440272UL, 3053411095UL, 92212044UL, 1041941495UL, 2653519981UL, 2094375399UL, 3992554702UL, 216246182UL, 2271736480UL, 695350220UL, 4104644208UL, 2543874803UL, 1310440964UL, +1956002873UL, 3373048130UL, 3027546418UL, 448786402UL, 749040342UL, 406538664UL, 4081844472UL, 3681979470UL, 3941253886UL, 672615054UL, 3655479714UL, 197563239UL, 1619518340UL, 1639889010UL, 666186812UL, 4094569743UL, 2518320719UL, 3308938954UL, 1572886498UL, 1065510431UL, 2158389109UL, 3320483696UL, 1763046973UL, 3578310229UL, 4106948216UL, 58659757UL, 3412172826UL, 3394715763UL, 3333944006UL, 3020203798UL, 3598064251UL, 1693717788UL, +2071056894UL, 1263790655UL, 4188233031UL, 4230429856UL, 2564478937UL, 3031631424UL, 3912597408UL, 1768734847UL, 1975027092UL, 3546175061UL, 2376551740UL, 1137628506UL, 535767974UL, 3105256806UL, 450760279UL, 2472341690UL, 685997424UL, 1374644561UL, 2446214061UL, 1873063065UL, 1058649390UL, 1581230869UL, 1725846082UL, 3062699842UL, 813496775UL, 1095426642UL, 2940190462UL, 4276038488UL, 2091764667UL, 3857233976UL, 98163536UL, 4157153745UL, +32476821UL, 2354284775UL, 3115605568UL, 2987293678UL, 1119786914UL, 3019442904UL, 111185876UL, 996447434UL, 3991775183UL, 3161418733UL, 3973354577UL, 1650454973UL, 1089784804UL, 3659038742UL, 1387393667UL, 543731583UL, 781586523UL, 2711412312UL, 832142534UL, 3911092159UL, 325250500UL, 2735441676UL, 3563501139UL, 1002098855UL, 337936437UL, 1869530240UL, 2233969733UL, 1156926454UL, 3255026725UL, 4072134049UL, 2083771067UL, 1559589006UL, +3832870112UL, 466036013UL, 2456954827UL, 2895978734UL, 1621803157UL, 2340808859UL, 2022150409UL, 716597790UL, 2031510641UL, 2208319977UL, 1823993818UL, 1838834877UL, 3628284249UL, 1393263274UL, 3842378742UL, 2489609764UL, 2303040715UL, 3022943801UL, 510040722UL, 2180373447UL, 4204167795UL, 3074858415UL, 953774117UL, 500296619UL, 2269873184UL, 2320314628UL, 3531413908UL, 2401810535UL, 3568992417UL, 617528376UL, 712451843UL, 1730632320UL, +2311040363UL, 3695847323UL, 1609309841UL, 3224192365UL, 3189359980UL, 397599239UL, 3344183623UL, 1159383441UL, 758272390UL, 1933731121UL, 2812031899UL, 2613176831UL, 2967803832UL, 3986798661UL, 758113139UL, 2361031672UL, 1745444335UL, 2067906079UL, 3814344052UL, 3537991495UL, 2962440272UL, 3053411095UL, 92212044UL, 817573506UL, 2653519981UL, 2094375399UL, 3992554702UL, 216246182UL, 2456924809UL, 695350220UL, 4104644208UL, 2543874803UL, +1310440964UL, 1151286621UL, 3373048130UL, 3027546418UL, 448786402UL, 749040342UL, 637572176UL, 4081844472UL, 3681979470UL, 3941253886UL, 672615054UL, 3038758846UL, 197563239UL, 1619518340UL, 1639889010UL, 666186812UL, 4254608071UL, 2518320719UL, 3308938954UL, 1572886498UL, 1065510431UL, 3100620860UL, 3320483696UL, 1763046973UL, 3578310229UL, 4106948216UL, 403923766UL, 3412172826UL, 3394715763UL, 3333944006UL, 3020203798UL, 1859724785UL, +1693717788UL, 2071056894UL, 1263790655UL, 4188233031UL, 2908736862UL, 2564478937UL, 3031631424UL, 3912597408UL, 1768734847UL, 966714666UL, 3546175061UL, 2376551740UL, 1137628506UL, 535767974UL, 1561255376UL, 450760279UL, 2472341690UL, 685997424UL, 1374644561UL, 3122124160UL, 1873063065UL, 1058649390UL, 1581230869UL, 1725846082UL, 3791666219UL, 813496775UL, 1095426642UL, 2940190462UL, 4276038488UL, 2802023399UL, 3857233976UL, 98163536UL, +4157153745UL, 32476821UL, 1640659450UL, 3115605568UL, 2987293678UL, 1119786914UL, 3019442904UL, 4278091706UL, 996447434UL, 3991775183UL, 3161418733UL, 3973354577UL, 3398421232UL, 1089784804UL, 3659038742UL, 1387393667UL, 543731583UL, 1694361696UL, 2711412312UL, 832142534UL, 3911092159UL, 325250500UL, 166035542UL, 3563501139UL, 1002098855UL, 337936437UL, 1869530240UL, 1306446339UL, 1156926454UL, 3255026725UL, 4072134049UL, 2083771067UL, +61899937UL, 3832870112UL, 466036013UL, 2456954827UL, 2895978734UL, 767569205UL, 2340808859UL, 2022150409UL, 716597790UL, 2031510641UL, 1690074863UL, 1823993818UL, 1838834877UL, 3628284249UL, 1393263274UL, 546011580UL, 2489609764UL, 2303040715UL, 3022943801UL, 510040722UL, 825252468UL, 4204167795UL, 3074858415UL, 953774117UL, 500296619UL, 1952242515UL, 2320314628UL, 3531413908UL, 2401810535UL, 3568992417UL, 4254767597UL, 712451843UL, +1730632320UL, 2311040363UL, 3695847323UL, 2393864919UL, 3224192365UL, 3189359980UL, 397599239UL, 3344183623UL, 1759399025UL, 758272390UL, 1933731121UL, 2812031899UL, 2613176831UL, 2809078783UL, 3986798661UL, 758113139UL, 2361031672UL, 1745444335UL, 1223235915UL, 3814344052UL, 3537991495UL, 2962440272UL, 3053411095UL, 3711100000UL, 817573506UL, 2653519981UL, 2094375399UL, 3992554702UL, 2987412942UL, 2456924809UL, 695350220UL, 4104644208UL, +2543874803UL, 2746231792UL, 1151286621UL, 3373048130UL, 3027546418UL, 448786402UL, 801157439UL, 637572176UL, 4081844472UL, 3681979470UL, 3941253886UL, 975875511UL, 3038758846UL, 197563239UL, 1619518340UL, 1639889010UL, 3137491209UL, 4254608071UL, 2518320719UL, 3308938954UL, 1572886498UL, 631178204UL, 3100620860UL, 3320483696UL, 1763046973UL, 3578310229UL, 3338308117UL, 403923766UL, 3412172826UL, 3394715763UL, 3333944006UL, 37220448UL, +1859724785UL, 1693717788UL, 2071056894UL, 1263790655UL, 228419012UL, 2908736862UL, 2564478937UL, 3031631424UL, 3912597408UL, 3862306448UL, 966714666UL, 3546175061UL, 2376551740UL, 1137628506UL, 1114919961UL, 1561255376UL, 450760279UL, 2472341690UL, 685997424UL, 2456661198UL, 3122124160UL, 1873063065UL, 1058649390UL, 1581230869UL, 2996925693UL, 3791666219UL, 813496775UL, 1095426642UL, 2940190462UL, 1642720015UL, 2802023399UL, 3857233976UL, +98163536UL, 4157153745UL, 1578965959UL, 1640659450UL, 3115605568UL, 2987293678UL, 1119786914UL, 1748408698UL, 4278091706UL, 996447434UL, 3991775183UL, 3161418733UL, 4123935663UL, 3398421232UL, 1089784804UL, 3659038742UL, 1387393667UL, 770706529UL, 1694361696UL, 2711412312UL, 832142534UL, 3911092159UL, 335435644UL, 166035542UL, 3563501139UL, 1002098855UL, 337936437UL, 2961857543UL, 1306446339UL, 1156926454UL, 3255026725UL, 4072134049UL, +1717290230UL, 1323146393UL, 2156340433UL, 2065716367UL, 2597996276UL, 3402032152UL, 779574284UL, 2369501052UL, 2316224856UL, 2720986136UL, 3016786025UL, 2916554213UL, 3476215746UL, 1132150235UL, 2619889920UL, 1279664685UL, 679206534UL, 4014394509UL, 3624968312UL, 1480455625UL, 725015758UL, 707677352UL, 3764409715UL, 1938306480UL, 2171474419UL, 3379664161UL, 684262379UL, 2142433069UL, 43407198UL, 1398850259UL, 2059135843UL, 240266749UL, +3788738212UL, 118513026UL, 820245055UL, 1152812311UL, 1398373423UL, 3188977726UL, 872620936UL, 2084649448UL, 807979538UL, 819501992UL, 615447916UL, 3393148006UL, 1765623964UL, 2514767257UL, 3711360450UL, 2941886951UL, 3739102698UL, 4022385962UL, 2306039667UL, 3321267290UL, 2179238310UL, 3192652502UL, 2118792870UL, 2571142127UL, 761776508UL, 873010906UL, 1609627751UL, 4260021041UL, 1747852747UL, 960771906UL, 2647903291UL, 77475681UL, +1282566533UL, 4022186916UL, 2681128032UL, 1554542462UL, 3181701944UL, 1168469070UL, 74236514UL, 2806532232UL, 3981048887UL, 1888842784UL, 2888607878UL, 1763028723UL, 701886756UL, 4124077776UL, 3738147505UL, 4066663138UL, 3816449863UL, 921061872UL, 2956972182UL, 3159072916UL, 3337110888UL, 3552795700UL, 2281281091UL, 671098116UL, 1282750020UL, 1008618197UL, 2363767765UL, 1812013295UL, 1854965999UL, 131027176UL, 666394000UL, 2062217824UL, +1763334218UL, 551118598UL, 1277961175UL, 3523893635UL, 1855881150UL, 2067903393UL, 2590963277UL, 3214508854UL, 1604911832UL, 1906690475UL, 389417851UL, 2711591984UL, 427723436UL, 1039703630UL, 639602991UL, 444779318UL, 2722002973UL, 3927985419UL, 1297446054UL, 298277450UL, 656022205UL, 134304205UL, 3847728042UL, 3339100423UL, 407022043UL, 1282443442UL, 3173884578UL, 1417906094UL, 2364502739UL, 2158353472UL, 2402775649UL, 1807696073UL, +2837535198UL, 705887737UL, 2129202688UL, 3853676283UL, 1388329793UL, 875153687UL, 2367465660UL, 2763058233UL, 2500632304UL, 2196920062UL, 491306883UL, 277753357UL, 3868415380UL, 324867643UL, 3654474955UL, 2569410351UL, 1128175417UL, 1853572398UL, 1133201743UL, 662085935UL, 2263514999UL, 3077768113UL, 3309730620UL, 3602394176UL, 3747458070UL, 188422725UL, 813812450UL, 1502276531UL, 3909138356UL, 2766044599UL, 3760928321UL, 573108836UL, +}, +{ +1240264181UL, 1624064648UL, 3039823158UL, 2013985253UL, 1473300299UL, 2762062141UL, 3273470484UL, 1889745445UL, 2516996174UL, 3190376531UL, 996186898UL, 3893981177UL, 1268272590UL, 3226095713UL, 153038465UL, 2184871198UL, 3224094011UL, 2526518401UL, 1738960059UL, 1187560605UL, 4194384320UL, 2837011297UL, 3638232350UL, 367907454UL, 574009898UL, 1948901330UL, 60430044UL, 1569835584UL, 3160561697UL, 321792583UL, 3179087993UL, 1936928378UL, +412346905UL, 4020812489UL, 2603392174UL, 3499496781UL, 1499441233UL, 1062415256UL, 1347130973UL, 1823246794UL, 3411391800UL, 4253618056UL, 1507733072UL, 1605629518UL, 1503312494UL, 8035741UL, 4038904206UL, 2408545792UL, 969543501UL, 954847087UL, 956553276UL, 3096241999UL, 2566194741UL, 84678421UL, 3882676079UL, 2483934330UL, 3673546814UL, 2461422466UL, 620385599UL, 898325340UL, 2145883445UL, 3653728520UL, 3744850294UL, 2441124935UL, +904854507UL, 3216304963UL, 2373268568UL, 2354362010UL, 1245572787UL, 2894748714UL, 2889136188UL, 3716879184UL, 1766013949UL, 1305712667UL, 1227530310UL, 4051221847UL, 925440190UL, 1508686692UL, 1104647879UL, 1496666754UL, 3300504219UL, 127787091UL, 1528394637UL, 1739640835UL, 2475711496UL, 3792639955UL, 1450796299UL, 1634217367UL, 3289785095UL, 2149949989UL, 811612039UL, 1750779366UL, 1157474938UL, 514004414UL, 2264909096UL, 3730411668UL, +3308882513UL, 1834571716UL, 378288317UL, 3800023701UL, 763396788UL, 1597708317UL, 983953861UL, 94566098UL, 1548157668UL, 3755427117UL, 1646496505UL, 3748241449UL, 3439805936UL, 2321644449UL, 3805706235UL, 4220083901UL, 1069923823UL, 2984004391UL, 3824885361UL, 1967477766UL, 218978249UL, 348955028UL, 3188651823UL, 1008338679UL, 2331688720UL, 1562995454UL, 1837179689UL, 3033872688UL, 3007293665UL, 1759522678UL, 319754369UL, 2763991927UL, +1983149629UL, 1353197132UL, 1489552694UL, 2990539062UL, 3244609108UL, 669775440UL, 886127995UL, 1636688014UL, 1251222487UL, 2351883247UL, 3261502906UL, 3139614137UL, 3203790139UL, 2777648095UL, 3693390579UL, 3540514982UL, 3200191735UL, 750726325UL, 1014534145UL, 2091792357UL, 3931704474UL, 1383925867UL, 2038878506UL, 2247134268UL, 2840132188UL, 61137652UL, 1162051299UL, 399657268UL, 1682018695UL, 2640231287UL, 1733438115UL, 3611823506UL, +2077891037UL, 1240264181UL, 1624064648UL, 3039823158UL, 2013985253UL, 4188888201UL, 2762062141UL, 3273470484UL, 1889745445UL, 2516996174UL, 2621448256UL, 996186898UL, 3893981177UL, 1268272590UL, 3226095713UL, 952803645UL, 2184871198UL, 3224094011UL, 2526518401UL, 1738960059UL, 738368399UL, 4194384320UL, 2837011297UL, 3638232350UL, 367907454UL, 3772812520UL, 1948901330UL, 60430044UL, 1569835584UL, 3160561697UL, 1655622513UL, 3179087993UL, +1936928378UL, 412346905UL, 4020812489UL, 3754224996UL, 3499496781UL, 1499441233UL, 1062415256UL, 1347130973UL, 1167581269UL, 3411391800UL, 4253618056UL, 1507733072UL, 1605629518UL, 1867781671UL, 8035741UL, 4038904206UL, 2408545792UL, 969543501UL, 3189323143UL, 956553276UL, 3096241999UL, 2566194741UL, 84678421UL, 996778900UL, 2483934330UL, 3673546814UL, 2461422466UL, 620385599UL, 3129088144UL, 2145883445UL, 3653728520UL, 3744850294UL, +2441124935UL, 4230756652UL, 3216304963UL, 2373268568UL, 2354362010UL, 1245572787UL, 1600525238UL, 2889136188UL, 3716879184UL, 1766013949UL, 1305712667UL, 59908073UL, 4051221847UL, 925440190UL, 1508686692UL, 1104647879UL, 2931214731UL, 3300504219UL, 127787091UL, 1528394637UL, 1739640835UL, 62963469UL, 3792639955UL, 1450796299UL, 1634217367UL, 3289785095UL, 667987389UL, 811612039UL, 1750779366UL, 1157474938UL, 514004414UL, 2737193098UL, +3730411668UL, 3308882513UL, 1834571716UL, 378288317UL, 3452657469UL, 763396788UL, 1597708317UL, 983953861UL, 94566098UL, 2752347916UL, 3755427117UL, 1646496505UL, 3748241449UL, 3439805936UL, 4222757079UL, 3805706235UL, 4220083901UL, 1069923823UL, 2984004391UL, 3887639520UL, 1967477766UL, 218978249UL, 348955028UL, 3188651823UL, 4168456281UL, 2331688720UL, 1562995454UL, 1837179689UL, 3033872688UL, 814903833UL, 1759522678UL, 319754369UL, +2763991927UL, 1983149629UL, 3818528075UL, 1489552694UL, 2990539062UL, 3244609108UL, 669775440UL, 1004789460UL, 1636688014UL, 1251222487UL, 2351883247UL, 3261502906UL, 4143823654UL, 3203790139UL, 2777648095UL, 3693390579UL, 3540514982UL, 153421222UL, 750726325UL, 1014534145UL, 2091792357UL, 3931704474UL, 4018591985UL, 2038878506UL, 2247134268UL, 2840132188UL, 61137652UL, 1455028838UL, 399657268UL, 1682018695UL, 2640231287UL, 1733438115UL, +1853142849UL, 2077891037UL, 1240264181UL, 1624064648UL, 3039823158UL, 2235369076UL, 4188888201UL, 2762062141UL, 3273470484UL, 1889745445UL, 3627876603UL, 2621448256UL, 996186898UL, 3893981177UL, 1268272590UL, 2687846008UL, 952803645UL, 2184871198UL, 3224094011UL, 2526518401UL, 861379413UL, 738368399UL, 4194384320UL, 2837011297UL, 3638232350UL, 3753321702UL, 3772812520UL, 1948901330UL, 60430044UL, 1569835584UL, 581506474UL, 1655622513UL, +3179087993UL, 1936928378UL, 412346905UL, 2710043900UL, 3754224996UL, 3499496781UL, 1499441233UL, 1062415256UL, 2704745463UL, 1167581269UL, 3411391800UL, 4253618056UL, 1507733072UL, 4215403465UL, 1867781671UL, 8035741UL, 4038904206UL, 2408545792UL, 3252742933UL, 3189323143UL, 956553276UL, 3096241999UL, 2566194741UL, 1865159158UL, 996778900UL, 2483934330UL, 3673546814UL, 2461422466UL, 3123557619UL, 3129088144UL, 2145883445UL, 3653728520UL, +3744850294UL, 21840044UL, 4230756652UL, 3216304963UL, 2373268568UL, 2354362010UL, 1934462999UL, 1600525238UL, 2889136188UL, 3716879184UL, 1766013949UL, 2822794708UL, 59908073UL, 4051221847UL, 925440190UL, 1508686692UL, 2938291976UL, 2931214731UL, 3300504219UL, 127787091UL, 1528394637UL, 1914923136UL, 62963469UL, 3792639955UL, 1450796299UL, 1634217367UL, 257322213UL, 667987389UL, 811612039UL, 1750779366UL, 1157474938UL, 3083649350UL, +2737193098UL, 3730411668UL, 3308882513UL, 1834571716UL, 2778729422UL, 3452657469UL, 763396788UL, 1597708317UL, 983953861UL, 1337754195UL, 2752347916UL, 3755427117UL, 1646496505UL, 3748241449UL, 3942745717UL, 4222757079UL, 3805706235UL, 4220083901UL, 1069923823UL, 1314928500UL, 3887639520UL, 1967477766UL, 218978249UL, 348955028UL, 3425797638UL, 4168456281UL, 2331688720UL, 1562995454UL, 1837179689UL, 1814071277UL, 814903833UL, 1759522678UL, +319754369UL, 2763991927UL, 1079270448UL, 3818528075UL, 1489552694UL, 2990539062UL, 3244609108UL, 2944573315UL, 1004789460UL, 1636688014UL, 1251222487UL, 2351883247UL, 1356892540UL, 4143823654UL, 3203790139UL, 2777648095UL, 3693390579UL, 983917956UL, 153421222UL, 750726325UL, 1014534145UL, 2091792357UL, 296882400UL, 4018591985UL, 2038878506UL, 2247134268UL, 2840132188UL, 3508266160UL, 1455028838UL, 399657268UL, 1682018695UL, 2640231287UL, +2480988791UL, 1853142849UL, 2077891037UL, 1240264181UL, 1624064648UL, 1741738969UL, 2235369076UL, 4188888201UL, 2762062141UL, 3273470484UL, 3569498651UL, 3627876603UL, 2621448256UL, 996186898UL, 3893981177UL, 4026533880UL, 2687846008UL, 952803645UL, 2184871198UL, 3224094011UL, 1290870737UL, 861379413UL, 738368399UL, 4194384320UL, 2837011297UL, 3833099205UL, 3753321702UL, 3772812520UL, 1948901330UL, 60430044UL, 4131290878UL, 581506474UL, +1655622513UL, 3179087993UL, 1936928378UL, 2379952582UL, 2710043900UL, 3754224996UL, 3499496781UL, 1499441233UL, 593780490UL, 2704745463UL, 1167581269UL, 3411391800UL, 4253618056UL, 621889762UL, 4215403465UL, 1867781671UL, 8035741UL, 4038904206UL, 2045289976UL, 3252742933UL, 3189323143UL, 956553276UL, 3096241999UL, 2188329018UL, 1865159158UL, 996778900UL, 2483934330UL, 3673546814UL, 2717648418UL, 3123557619UL, 3129088144UL, 2145883445UL, +3653728520UL, 1528077261UL, 21840044UL, 4230756652UL, 3216304963UL, 2373268568UL, 803158556UL, 1934462999UL, 1600525238UL, 2889136188UL, 3716879184UL, 161827512UL, 2822794708UL, 59908073UL, 4051221847UL, 925440190UL, 3599942370UL, 2938291976UL, 2931214731UL, 3300504219UL, 127787091UL, 4082579845UL, 1914923136UL, 62963469UL, 3792639955UL, 1450796299UL, 2035446714UL, 257322213UL, 667987389UL, 811612039UL, 1750779366UL, 2344204796UL, +3083649350UL, 2737193098UL, 3730411668UL, 3308882513UL, 2765191583UL, 2778729422UL, 3452657469UL, 763396788UL, 1597708317UL, 1854746879UL, 1337754195UL, 2752347916UL, 3755427117UL, 1646496505UL, 4020292301UL, 3942745717UL, 4222757079UL, 3805706235UL, 4220083901UL, 1408262601UL, 1314928500UL, 3887639520UL, 1967477766UL, 218978249UL, 2173193841UL, 3425797638UL, 4168456281UL, 2331688720UL, 1562995454UL, 2835294077UL, 1814071277UL, 814903833UL, +1759522678UL, 319754369UL, 4048528178UL, 1079270448UL, 3818528075UL, 1489552694UL, 2990539062UL, 787253600UL, 2944573315UL, 1004789460UL, 1636688014UL, 1251222487UL, 3584515216UL, 1356892540UL, 4143823654UL, 3203790139UL, 2777648095UL, 1681621541UL, 983917956UL, 153421222UL, 750726325UL, 1014534145UL, 3951869055UL, 296882400UL, 4018591985UL, 2038878506UL, 2247134268UL, 1990726826UL, 3508266160UL, 1455028838UL, 399657268UL, 1682018695UL, +3360119279UL, 3151120565UL, 3011208718UL, 3694535943UL, 104562665UL, 2827623271UL, 249712003UL, 3413221355UL, 2347164236UL, 3227498378UL, 1805068659UL, 2118219686UL, 1568133029UL, 902801951UL, 175637375UL, 3812819970UL, 2162769758UL, 3845613089UL, 1795179477UL, 171494391UL, 3765826349UL, 1725798906UL, 345463508UL, 2481043227UL, 226569380UL, 3250095421UL, 1085199388UL, 3107594542UL, 4011388155UL, 1092611190UL, 3239339214UL, 4211849464UL, +4109911546UL, 81212018UL, 3691937144UL, 2477407396UL, 3320520455UL, 3070067913UL, 3808621884UL, 252917069UL, 3394860294UL, 1092442235UL, 2876536384UL, 1684120191UL, 431096075UL, 1701716708UL, 639881684UL, 3066183997UL, 3660504927UL, 2047274UL, 3424756424UL, 760932520UL, 2457976057UL, 1705265011UL, 2691137533UL, 3684307557UL, 3532744498UL, 2319162513UL, 1015534908UL, 1907173398UL, 2820698743UL, 1264455116UL, 2323788906UL, 3062240844UL, +1878550513UL, 1717353426UL, 1805673248UL, 62425157UL, 3662381032UL, 1964107209UL, 2559831960UL, 2117844804UL, 1228721677UL, 4240498866UL, 3212920337UL, 2338600301UL, 931588693UL, 2379606585UL, 3643222352UL, 4154645082UL, 1115847065UL, 2079427925UL, 2256943798UL, 2795103368UL, 2688136486UL, 1458062143UL, 1767222217UL, 635424385UL, 284062050UL, 1547163554UL, 3380046528UL, 1145758046UL, 3935976713UL, 4017430175UL, 3863367362UL, 3041367424UL, +303263160UL, 1465965696UL, 3757919837UL, 3083072836UL, 4024514094UL, 1381331179UL, 2393446325UL, 3256476469UL, 4066482738UL, 3437941107UL, 1051266504UL, 921764078UL, 2933305619UL, 1358097211UL, 4100978724UL, 2709958834UL, 574590507UL, 961767386UL, 21100886UL, 753746372UL, 4072632446UL, 733729367UL, 3060214669UL, 289165105UL, 426065754UL, 2036100240UL, 2172365757UL, 502856627UL, 84490194UL, 2630806596UL, 1206161269UL, 1009438449UL, +569581317UL, 1836947000UL, 3125379675UL, 1756936428UL, 3772694822UL, 3670337911UL, 3020603818UL, 2376224883UL, 2539951453UL, 2053395002UL, 3525193914UL, 1991480838UL, 3786481083UL, 873873707UL, 1693894743UL, 2450223985UL, 754878026UL, 1943356492UL, 401524329UL, 759931885UL, 611231307UL, 147950334UL, 599693701UL, 3358729722UL, 3649058074UL, 906423787UL, 1333804225UL, 875187278UL, 1115838692UL, 2476325972UL, 3307226674UL, 3539078918UL, +}, + +}; +#endif + +#ifdef CURAND_XORWOW_PRECALCULATED_DEVICE_QUALIFIERS +#undef CURAND_XORWOW_PRECALCULATED_DEVICE_QUALIFIERS +#endif + +#ifdef CURAND_XORWOW_PRECALCULATED_HOST_QUALIFIERS +#undef CURAND_XORWOW_PRECALCULATED_HOST_QUALIFIERS +#endif + +#endif // CURAND_XORWOW_PRECALCULATED_H_ diff --git a/cuda_toolkit/include/curand_uniform.h b/cuda_toolkit/include/curand_uniform.h new file mode 100644 index 0000000000000000000000000000000000000000..6c83eac026d408803e2eb10bb650020ea3e4118d --- /dev/null +++ b/cuda_toolkit/include/curand_uniform.h @@ -0,0 +1,498 @@ + + /* Copyright 2010-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * The source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * The Licensed Deliverables contained herein are PROPRIETARY and + * CONFIDENTIAL to NVIDIA and are being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + + +#if !defined(CURAND_UNIFORM_H_) +#define CURAND_UNIFORM_H_ + +/** + * \defgroup DEVICE Device API + * + * @{ + */ + +#ifndef __CUDACC_RTC__ +#include +#endif // __CUDACC_RTC__ + +#include "curand_mrg32k3a.h" +#include "curand_mtgp32_kernel.h" +#include "curand_philox4x32_x.h" + + +QUALIFIERS float _curand_uniform(unsigned int x) +{ + return x * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f); +} + +QUALIFIERS float4 _curand_uniform4(uint4 x) +{ + float4 y; + y.x = x.x * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f); + y.y = x.y * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f); + y.z = x.z * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f); + y.w = x.w * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f); + return y; +} + +QUALIFIERS float _curand_uniform(unsigned long long x) +{ + unsigned int t; + t = (unsigned int)(x >> 32); + return t * CURAND_2POW32_INV + (CURAND_2POW32_INV/2.0f); +} + +QUALIFIERS double _curand_uniform_double(unsigned int x) +{ + return x * CURAND_2POW32_INV_DOUBLE + CURAND_2POW32_INV_DOUBLE; +} + +QUALIFIERS double _curand_uniform_double(unsigned long long x) +{ + return (x >> 11) * CURAND_2POW53_INV_DOUBLE + (CURAND_2POW53_INV_DOUBLE/2.0); +} + +QUALIFIERS double _curand_uniform_double_hq(unsigned int x, unsigned int y) +{ + unsigned long long z = (unsigned long long)x ^ + ((unsigned long long)y << (53 - 32)); + return z * CURAND_2POW53_INV_DOUBLE + (CURAND_2POW53_INV_DOUBLE/2.0); +} + +QUALIFIERS float curand_uniform(curandStateTest_t *state) +{ + return _curand_uniform(curand(state)); +} + +QUALIFIERS double curand_uniform_double(curandStateTest_t *state) +{ + return _curand_uniform_double(curand(state)); +} + +/** + * \brief Return a uniformly distributed float from an XORWOW generator. + * + * Return a uniformly distributed float between \p 0.0f and \p 1.0f + * from the XORWOW generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * The implementation may use any number of calls to \p curand() to + * get enough random bits to create the return value. The current + * implementation uses one call. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed float between \p 0.0f and \p 1.0f + */ +QUALIFIERS float curand_uniform(curandStateXORWOW_t *state) +{ + return _curand_uniform(curand(state)); +} + +/** + * \brief Return a uniformly distributed double from an XORWOW generator. + * + * Return a uniformly distributed double between \p 0.0 and \p 1.0 + * from the XORWOW generator in \p state, increment position of generator. + * Output range excludes \p 0.0 but includes \p 1.0. Denormalized floating + * point outputs are never returned. + * + * The implementation may use any number of calls to \p curand() to + * get enough random bits to create the return value. The current + * implementation uses exactly two calls. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed double between \p 0.0 and \p 1.0 + */ +QUALIFIERS double curand_uniform_double(curandStateXORWOW_t *state) +{ + unsigned int x, y; + x = curand(state); + y = curand(state); + return _curand_uniform_double_hq(x, y); +} +/** + * \brief Return a uniformly distributed float from an MRG32k3a generator. + * + * Return a uniformly distributed float between \p 0.0f and \p 1.0f + * from the MRG32k3a generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * The implementation returns up to 23 bits of mantissa, with the minimum + * return value \f$ 2^{-32} \f$ + * + * \param state - Pointer to state to update + * + * \return uniformly distributed float between \p 0.0f and \p 1.0f + */ +QUALIFIERS float curand_uniform(curandStateMRG32k3a_t *state) +{ + return ((float)(curand_MRG32k3a(state)*MRG32K3A_NORM)); +} + +/** + * \brief Return a uniformly distributed double from an MRG32k3a generator. + * + * Return a uniformly distributed double between \p 0.0 and \p 1.0 + * from the MRG32k3a generator in \p state, increment position of generator. + * Output range excludes \p 0.0 but includes \p 1.0. Denormalized floating + * point outputs are never returned. + * + * Note the implementation returns at most 32 random bits of mantissa as + * outlined in the seminal paper by L'Ecuyer. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed double between \p 0.0 and \p 1.0 + */ +QUALIFIERS double curand_uniform_double(curandStateMRG32k3a_t *state) +{ + return curand_MRG32k3a(state)*MRG32K3A_NORM; +} + + + +/** + * \brief Return a uniformly distributed tuple of 2 doubles from an Philox4_32_10 generator. + * + * Return a uniformly distributed 2 doubles (double4) between \p 0.0 and \p 1.0 + * from the Philox4_32_10 generator in \p state, increment position of generator by 4. + * Output range excludes \p 0.0 but includes \p 1.0. Denormalized floating + * point outputs are never returned. + * + * \param state - Pointer to state to update + * + * \return 2 uniformly distributed doubles between \p 0.0 and \p 1.0 + */ + +QUALIFIERS double2 curand_uniform2_double(curandStatePhilox4_32_10_t *state) +{ + uint4 _x; + double2 result; + _x = curand4(state); + result.x = _curand_uniform_double_hq(_x.x,_x.y); + result.y = _curand_uniform_double_hq(_x.z,_x.w); + return result; +} + + +// not a part of API +QUALIFIERS double4 curand_uniform4_double(curandStatePhilox4_32_10_t *state) +{ + uint4 _x, _y; + double4 result; + _x = curand4(state); + _y = curand4(state); + result.x = _curand_uniform_double_hq(_x.x,_x.y); + result.y = _curand_uniform_double_hq(_x.z,_x.w); + result.z = _curand_uniform_double_hq(_y.x,_y.y); + result.w = _curand_uniform_double_hq(_y.z,_y.w); + return result; +} + +/** + * \brief Return a uniformly distributed float from a Philox4_32_10 generator. + * + * Return a uniformly distributed float between \p 0.0f and \p 1.0f + * from the Philox4_32_10 generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed float between \p 0.0 and \p 1.0 + * + */ +QUALIFIERS float curand_uniform(curandStatePhilox4_32_10_t *state) +{ + return _curand_uniform(curand(state)); +} + +/** + * \brief Return a uniformly distributed tuple of 4 floats from a Philox4_32_10 generator. + * + * Return a uniformly distributed 4 floats between \p 0.0f and \p 1.0f + * from the Philox4_32_10 generator in \p state, increment position of generator by 4. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed float between \p 0.0 and \p 1.0 + * + */ +QUALIFIERS float4 curand_uniform4(curandStatePhilox4_32_10_t *state) +{ + return _curand_uniform4(curand4(state)); +} + +/** + * \brief Return a uniformly distributed float from a MTGP32 generator. + * + * Return a uniformly distributed float between \p 0.0f and \p 1.0f + * from the MTGP32 generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed float between \p 0.0f and \p 1.0f + */ +QUALIFIERS float curand_uniform(curandStateMtgp32_t *state) +{ + return _curand_uniform(curand(state)); +} +/** + * \brief Return a uniformly distributed double from a MTGP32 generator. + * + * Return a uniformly distributed double between \p 0.0f and \p 1.0f + * from the MTGP32 generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * Note that the implementation uses only 32 random bits to generate a single double + * precision value. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed double between \p 0.0f and \p 1.0f + */ +QUALIFIERS double curand_uniform_double(curandStateMtgp32_t *state) +{ + return _curand_uniform_double(curand(state)); +} + +/** + * \brief Return a uniformly distributed double from a Philox4_32_10 generator. + * + * Return a uniformly distributed double between \p 0.0f and \p 1.0f + * from the Philox4_32_10 generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * Note that the implementation uses only 32 random bits to generate a single double + * precision value. + * + * \p curand_uniform2_double() is recommended for higher quality uniformly distributed + * double precision values. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed double between \p 0.0f and \p 1.0f + */ + +QUALIFIERS double curand_uniform_double(curandStatePhilox4_32_10_t *state) +{ + return _curand_uniform_double(curand(state)); +} + + +/** + * \brief Return a uniformly distributed float from a Sobol32 generator. + * + * Return a uniformly distributed float between \p 0.0f and \p 1.0f + * from the Sobol32 generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * The implementation is guaranteed to use a single call to \p curand(). + * + * \param state - Pointer to state to update + * + * \return uniformly distributed float between \p 0.0f and \p 1.0f + */ +QUALIFIERS float curand_uniform(curandStateSobol32_t *state) +{ + return _curand_uniform(curand(state)); +} + +/** + * \brief Return a uniformly distributed double from a Sobol32 generator. + * + * Return a uniformly distributed double between \p 0.0 and \p 1.0 + * from the Sobol32 generator in \p state, increment position of generator. + * Output range excludes \p 0.0 but includes \p 1.0. Denormalized floating + * point outputs are never returned. + * + * The implementation is guaranteed to use a single call to \p curand() + * to preserve the quasirandom properties of the sequence. + * + * Note that the implementation uses only 32 random bits to generate a single double + * precision value. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed double between \p 0.0 and \p 1.0 + */ +QUALIFIERS double curand_uniform_double(curandStateSobol32_t *state) +{ + return _curand_uniform_double(curand(state)); +} +/** + * \brief Return a uniformly distributed float from a scrambled Sobol32 generator. + * + * Return a uniformly distributed float between \p 0.0f and \p 1.0f + * from the scrambled Sobol32 generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * The implementation is guaranteed to use a single call to \p curand(). + * + * \param state - Pointer to state to update + * + * \return uniformly distributed float between \p 0.0f and \p 1.0f + */ +QUALIFIERS float curand_uniform(curandStateScrambledSobol32_t *state) +{ + return _curand_uniform(curand(state)); +} + +/** + * \brief Return a uniformly distributed double from a scrambled Sobol32 generator. + * + * Return a uniformly distributed double between \p 0.0 and \p 1.0 + * from the scrambled Sobol32 generator in \p state, increment position of generator. + * Output range excludes \p 0.0 but includes \p 1.0. Denormalized floating + * point outputs are never returned. + * + * The implementation is guaranteed to use a single call to \p curand() + * to preserve the quasirandom properties of the sequence. + * + * Note that the implementation uses only 32 random bits to generate a single double + * precision value. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed double between \p 0.0 and \p 1.0 + */ +QUALIFIERS double curand_uniform_double(curandStateScrambledSobol32_t *state) +{ + return _curand_uniform_double(curand(state)); +} +/** + * \brief Return a uniformly distributed float from a Sobol64 generator. + * + * Return a uniformly distributed float between \p 0.0f and \p 1.0f + * from the Sobol64 generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * The implementation is guaranteed to use a single call to \p curand(). + * + * \param state - Pointer to state to update + * + * \return uniformly distributed float between \p 0.0f and \p 1.0f + */ +QUALIFIERS float curand_uniform(curandStateSobol64_t *state) +{ + return _curand_uniform(curand(state)); +} + +/** + * \brief Return a uniformly distributed double from a Sobol64 generator. + * + * Return a uniformly distributed double between \p 0.0 and \p 1.0 + * from the Sobol64 generator in \p state, increment position of generator. + * Output range excludes \p 0.0 but includes \p 1.0. Denormalized floating + * point outputs are never returned. + * + * The implementation is guaranteed to use a single call to \p curand() + * to preserve the quasirandom properties of the sequence. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed double between \p 0.0 and \p 1.0 + */ +QUALIFIERS double curand_uniform_double(curandStateSobol64_t *state) +{ + return _curand_uniform_double(curand(state)); +} +/** + * \brief Return a uniformly distributed float from a scrambled Sobol64 generator. + * + * Return a uniformly distributed float between \p 0.0f and \p 1.0f + * from the scrambled Sobol64 generator in \p state, increment position of generator. + * Output range excludes \p 0.0f but includes \p 1.0f. Denormalized floating + * point outputs are never returned. + * + * The implementation is guaranteed to use a single call to \p curand(). + * + * \param state - Pointer to state to update + * + * \return uniformly distributed float between \p 0.0f and \p 1.0f + */ +QUALIFIERS float curand_uniform(curandStateScrambledSobol64_t *state) +{ + return _curand_uniform(curand(state)); +} + +/** + * \brief Return a uniformly distributed double from a scrambled Sobol64 generator. + * + * Return a uniformly distributed double between \p 0.0 and \p 1.0 + * from the scrambled Sobol64 generator in \p state, increment position of generator. + * Output range excludes \p 0.0 but includes \p 1.0. Denormalized floating + * point outputs are never returned. + * + * The implementation is guaranteed to use a single call to \p curand() + * to preserve the quasirandom properties of the sequence. + * + * \param state - Pointer to state to update + * + * \return uniformly distributed double between \p 0.0 and \p 1.0 + */ +QUALIFIERS double curand_uniform_double(curandStateScrambledSobol64_t *state) +{ + return _curand_uniform_double(curand(state)); +} + +#endif // !defined(CURAND_UNIFORM_H_) diff --git a/cuda_toolkit/include/cusolverDn.h b/cuda_toolkit/include/cusolverDn.h new file mode 100644 index 0000000000000000000000000000000000000000..6a9eea12ca797bd63ec499ef3336cc129575c318 --- /dev/null +++ b/cuda_toolkit/include/cusolverDn.h @@ -0,0 +1,4927 @@ +/* + * Copyright 2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +/* cuSolverDN : Dense Linear Algebra Library + +*/ + +#if !defined(CUSOLVERDN_H_) + #define CUSOLVERDN_H_ + +struct cusolverDnContext; +typedef struct cusolverDnContext *cusolverDnHandle_t; + +struct syevjInfo; +typedef struct syevjInfo *syevjInfo_t; + +struct gesvdjInfo; +typedef struct gesvdjInfo *gesvdjInfo_t; + +//------------------------------------------------------ +// opaque cusolverDnIRS structure for IRS solver +struct cusolverDnIRSParams; +typedef struct cusolverDnIRSParams *cusolverDnIRSParams_t; + +struct cusolverDnIRSInfos; +typedef struct cusolverDnIRSInfos *cusolverDnIRSInfos_t; +//------------------------------------------------------ + +struct cusolverDnParams; +typedef struct cusolverDnParams *cusolverDnParams_t; + +typedef enum { + CUSOLVERDN_GETRF = 0, + CUSOLVERDN_POTRF = 1 +} cusolverDnFunction_t; + +typedef enum { + CUSOLVER_DETERMINISTIC_RESULTS = 1, + CUSOLVER_ALLOW_NON_DETERMINISTIC_RESULTS = 2 +} cusolverDeterministicMode_t; + + #include + + #include "cuComplex.h" /* import complex data type */ + #include "cublas_v2.h" + #include "cusolver_common.h" + + /*******************************************************************************/ + #ifdef __cplusplus +extern "C" { + #endif + + cusolverStatus_t CUSOLVERAPI cusolverDnCreate(cusolverDnHandle_t *handle); + cusolverStatus_t CUSOLVERAPI cusolverDnDestroy(cusolverDnHandle_t handle); + cusolverStatus_t CUSOLVERAPI + cusolverDnSetStream(cusolverDnHandle_t handle, cudaStream_t streamId); + cusolverStatus_t CUSOLVERAPI + cusolverDnGetStream(cusolverDnHandle_t handle, cudaStream_t *streamId); + + //============================================================ + // Deterministic Mode + //============================================================ + cusolverStatus_t CUSOLVERAPI cusolverDnSetDeterministicMode(cusolverDnHandle_t + handle, cusolverDeterministicMode_t mode); + cusolverStatus_t CUSOLVERAPI cusolverDnGetDeterministicMode(cusolverDnHandle_t + handle, cusolverDeterministicMode_t* mode); + + //============================================================ + // IRS headers + //============================================================ + + // ============================================================================= + // IRS helper function API + // ============================================================================= + cusolverStatus_t CUSOLVERAPI + cusolverDnIRSParamsCreate(cusolverDnIRSParams_t *params_ptr); + + cusolverStatus_t CUSOLVERAPI + cusolverDnIRSParamsDestroy(cusolverDnIRSParams_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSParamsSetRefinementSolver( + cusolverDnIRSParams_t params, + cusolverIRSRefinement_t refinement_solver); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSParamsSetSolverMainPrecision( + cusolverDnIRSParams_t params, + cusolverPrecType_t solver_main_precision); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSParamsSetSolverLowestPrecision( + cusolverDnIRSParams_t params, + cusolverPrecType_t solver_lowest_precision); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSParamsSetSolverPrecisions( + cusolverDnIRSParams_t params, + cusolverPrecType_t solver_main_precision, + cusolverPrecType_t solver_lowest_precision); + + cusolverStatus_t CUSOLVERAPI + cusolverDnIRSParamsSetTol(cusolverDnIRSParams_t params, double val); + + cusolverStatus_t CUSOLVERAPI + cusolverDnIRSParamsSetTolInner(cusolverDnIRSParams_t params, double val); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSParamsSetMaxIters( + cusolverDnIRSParams_t params, + cusolver_int_t maxiters); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSParamsSetMaxItersInner( + cusolverDnIRSParams_t params, + cusolver_int_t maxiters_inner); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSParamsGetMaxIters( + cusolverDnIRSParams_t params, + cusolver_int_t * maxiters); + + cusolverStatus_t CUSOLVERAPI + cusolverDnIRSParamsEnableFallback(cusolverDnIRSParams_t params); + + cusolverStatus_t CUSOLVERAPI + cusolverDnIRSParamsDisableFallback(cusolverDnIRSParams_t params); + + // ============================================================================= + // cusolverDnIRSInfos prototypes + // ============================================================================= + cusolverStatus_t CUSOLVERAPI + cusolverDnIRSInfosDestroy(cusolverDnIRSInfos_t infos); + + cusolverStatus_t CUSOLVERAPI + cusolverDnIRSInfosCreate(cusolverDnIRSInfos_t *infos_ptr); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSInfosGetNiters( + cusolverDnIRSInfos_t infos, + cusolver_int_t * niters); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSInfosGetOuterNiters( + cusolverDnIRSInfos_t infos, + cusolver_int_t * outer_niters); + + cusolverStatus_t CUSOLVERAPI + cusolverDnIRSInfosRequestResidual(cusolverDnIRSInfos_t infos); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSInfosGetResidualHistory( + cusolverDnIRSInfos_t infos, + void ** residual_history); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSInfosGetMaxIters( + cusolverDnIRSInfos_t infos, + cusolver_int_t * maxiters); + + //============================================================ + // IRS functions API + //============================================================ + + /*******************************************************************************/ /* + * [ZZ, ZC, ZK, ZE, ZY, CC, CK, CE, CY, DD, DS, DH, DB, DX, SS, SH, SB, SX]gesv + * users API Prototypes */ + /*******************************************************************************/ + cusolverStatus_t CUSOLVERAPI cusolverDnZZgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZCgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZKgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZEgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZYgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCCgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCEgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCKgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCYgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDDgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDSgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDHgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDBgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDXgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnSSgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnSHgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnSBgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnSXgesv( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + /*******************************************************************************/ + + /*******************************************************************************/ /* + * [ZZ, ZC, ZK, ZE, ZY, CC, CK, CE, CY, DD, DS, DH, DB, DX, SS, SH, SB, SX]gesv_bufferSize + * users API Prototypes */ + /*******************************************************************************/ + cusolverStatus_t CUSOLVERAPI cusolverDnZZgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnZCgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnZKgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnZEgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnZYgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnCCgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnCKgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnCEgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnCYgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnDDgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnDSgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnDHgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnDBgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnDXgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnSSgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnSHgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnSBgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnSXgesv_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + cusolver_int_t * dipiv, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + /*******************************************************************************/ + + /*******************************************************************************/ /* + * [ZZ, ZC, ZK, ZE, ZY, CC, CK, CE, CY, DD, DS, DH, DB, DX, SS, SH, SB, SX]gels + * users API Prototypes */ + /*******************************************************************************/ + cusolverStatus_t CUSOLVERAPI cusolverDnZZgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZCgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZKgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZEgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZYgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCCgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCKgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCEgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCYgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDDgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDSgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDHgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDBgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDXgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnSSgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnSHgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnSBgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnSXgels( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * iter, + cusolver_int_t * d_info); + /*******************************************************************************/ + + /*******************************************************************************/ /* + * [ZZ, ZC, ZK, ZE, ZY, CC, CK, CE, CY, DD, DS, DH, DB, DX, SS, SH, SB, SX]gels_bufferSize + * API prototypes */ + /*******************************************************************************/ + cusolverStatus_t CUSOLVERAPI cusolverDnZZgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnZCgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnZKgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnZEgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnZYgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuDoubleComplex * dA, + cusolver_int_t ldda, + cuDoubleComplex * dB, + cusolver_int_t lddb, + cuDoubleComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnCCgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnCKgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnCEgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnCYgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + cuComplex * dA, + cusolver_int_t ldda, + cuComplex * dB, + cusolver_int_t lddb, + cuComplex * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnDDgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnDSgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnDHgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnDBgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnDXgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + double * dA, + cusolver_int_t ldda, + double * dB, + cusolver_int_t lddb, + double * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnSSgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnSHgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnSBgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnSXgels_bufferSize( + cusolverDnHandle_t handle, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + float * dA, + cusolver_int_t ldda, + float * dB, + cusolver_int_t lddb, + float * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t * lwork_bytes); + /*******************************************************************************/ + + /*******************************************************************************/ /* + * expert users API for IRS Prototypes + * */ + /*******************************************************************************/ + cusolverStatus_t CUSOLVERAPI cusolverDnIRSXgesv( + cusolverDnHandle_t handle, + cusolverDnIRSParams_t gesv_irs_params, + cusolverDnIRSInfos_t gesv_irs_infos, + cusolver_int_t n, + cusolver_int_t nrhs, + void * dA, + cusolver_int_t ldda, + void * dB, + cusolver_int_t lddb, + void * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * niters, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSXgesv_bufferSize( + cusolverDnHandle_t handle, + cusolverDnIRSParams_t params, + cusolver_int_t n, + cusolver_int_t nrhs, + size_t * lwork_bytes); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSXgels( + cusolverDnHandle_t handle, + cusolverDnIRSParams_t gels_irs_params, + cusolverDnIRSInfos_t gels_irs_infos, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + void * dA, + cusolver_int_t ldda, + void * dB, + cusolver_int_t lddb, + void * dX, + cusolver_int_t lddx, + void * dWorkspace, + size_t lwork_bytes, + cusolver_int_t * niters, + cusolver_int_t * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnIRSXgels_bufferSize( + cusolverDnHandle_t handle, + cusolverDnIRSParams_t params, + cusolver_int_t m, + cusolver_int_t n, + cusolver_int_t nrhs, + size_t * lwork_bytes); + /*******************************************************************************/ + + /* Cholesky factorization and its solver */ + cusolverStatus_t CUSOLVERAPI cusolverDnSpotrf_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDpotrf_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCpotrf_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZpotrf_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSpotrf( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float * Workspace, + int Lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnDpotrf( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double * Workspace, + int Lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnCpotrf( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + cuComplex * Workspace, + int Lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnZpotrf( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + cuDoubleComplex * Workspace, + int Lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnSpotrs( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + int nrhs, + const float * A, + int lda, + float * B, + int ldb, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnDpotrs( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + int nrhs, + const double * A, + int lda, + double * B, + int ldb, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnCpotrs( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + int nrhs, + const cuComplex * A, + int lda, + cuComplex * B, + int ldb, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnZpotrs( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + int nrhs, + const cuDoubleComplex *A, + int lda, + cuDoubleComplex * B, + int ldb, + int * devInfo); + + /* batched Cholesky factorization and its solver */ + cusolverStatus_t CUSOLVERAPI cusolverDnSpotrfBatched( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * Aarray[], + int lda, + int * infoArray, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnDpotrfBatched( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * Aarray[], + int lda, + int * infoArray, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnCpotrfBatched( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * Aarray[], + int lda, + int * infoArray, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnZpotrfBatched( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * Aarray[], + int lda, + int * infoArray, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnSpotrsBatched( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + int nrhs, /* only support rhs = 1*/ + float * A[], + int lda, + float * B[], + int ldb, + int * d_info, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnDpotrsBatched( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + int nrhs, /* only support rhs = 1*/ + double * A[], + int lda, + double * B[], + int ldb, + int * d_info, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnCpotrsBatched( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + int nrhs, /* only support rhs = 1*/ + cuComplex * A[], + int lda, + cuComplex * B[], + int ldb, + int * d_info, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnZpotrsBatched( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + int nrhs, /* only support rhs = 1*/ + cuDoubleComplex * A[], + int lda, + cuDoubleComplex * B[], + int ldb, + int * d_info, + int batchSize); + + /* s.p.d. matrix inversion (POTRI) and auxiliary routines (TRTRI and LAUUM) */ + cusolverStatus_t CUSOLVERAPI cusolverDnSpotri_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDpotri_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCpotri_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZpotri_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSpotri( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float * work, + int lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnDpotri( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double * work, + int lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnCpotri( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + cuComplex * work, + int lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnZpotri( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + cuDoubleComplex * work, + int lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnXtrtri_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + cublasDiagType_t diag, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + size_t * workspaceInBytesOnDevice, + size_t * workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXtrtri( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + cublasDiagType_t diag, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + void * bufferOnDevice, + size_t workspaceInBytesOnDevice, + void * bufferOnHost, + size_t workspaceInBytesOnHost, + int * devInfo); + + /* lauum, auxiliar routine for s.p.d matrix inversion */ + cusolverStatus_t CUSOLVERAPI cusolverDnSlauum_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDlauum_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnClauum_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZlauum_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSlauum( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float * work, + int lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnDlauum( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double * work, + int lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnClauum( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + cuComplex * work, + int lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnZlauum( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + cuDoubleComplex * work, + int lwork, + int * devInfo); + + /* LU Factorization */ + cusolverStatus_t CUSOLVERAPI cusolverDnSgetrf_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + float * A, + int lda, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgetrf_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + double * A, + int lda, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgetrf_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + cuComplex * A, + int lda, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgetrf_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + cuDoubleComplex * A, + int lda, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSgetrf( + cusolverDnHandle_t handle, + int m, + int n, + float * A, + int lda, + float * Workspace, + int * devIpiv, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgetrf( + cusolverDnHandle_t handle, + int m, + int n, + double * A, + int lda, + double * Workspace, + int * devIpiv, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgetrf( + cusolverDnHandle_t handle, + int m, + int n, + cuComplex * A, + int lda, + cuComplex * Workspace, + int * devIpiv, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgetrf( + cusolverDnHandle_t handle, + int m, + int n, + cuDoubleComplex * A, + int lda, + cuDoubleComplex * Workspace, + int * devIpiv, + int * devInfo); + + /* Row pivoting */ + cusolverStatus_t CUSOLVERAPI cusolverDnSlaswp( + cusolverDnHandle_t handle, + int n, + float * A, + int lda, + int k1, + int k2, + const int * devIpiv, + int incx); + + cusolverStatus_t CUSOLVERAPI cusolverDnDlaswp( + cusolverDnHandle_t handle, + int n, + double * A, + int lda, + int k1, + int k2, + const int * devIpiv, + int incx); + + cusolverStatus_t CUSOLVERAPI cusolverDnClaswp( + cusolverDnHandle_t handle, + int n, + cuComplex * A, + int lda, + int k1, + int k2, + const int * devIpiv, + int incx); + + cusolverStatus_t CUSOLVERAPI cusolverDnZlaswp( + cusolverDnHandle_t handle, + int n, + cuDoubleComplex * A, + int lda, + int k1, + int k2, + const int * devIpiv, + int incx); + + /* LU solve */ + cusolverStatus_t CUSOLVERAPI cusolverDnSgetrs( + cusolverDnHandle_t handle, + cublasOperation_t trans, + int n, + int nrhs, + const float * A, + int lda, + const int * devIpiv, + float * B, + int ldb, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgetrs( + cusolverDnHandle_t handle, + cublasOperation_t trans, + int n, + int nrhs, + const double * A, + int lda, + const int * devIpiv, + double * B, + int ldb, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgetrs( + cusolverDnHandle_t handle, + cublasOperation_t trans, + int n, + int nrhs, + const cuComplex * A, + int lda, + const int * devIpiv, + cuComplex * B, + int ldb, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgetrs( + cusolverDnHandle_t handle, + cublasOperation_t trans, + int n, + int nrhs, + const cuDoubleComplex *A, + int lda, + const int * devIpiv, + cuDoubleComplex * B, + int ldb, + int * devInfo); + + /* QR factorization */ + cusolverStatus_t CUSOLVERAPI cusolverDnSgeqrf_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + float * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgeqrf_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + double * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgeqrf_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + cuComplex * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgeqrf_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + cuDoubleComplex * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSgeqrf( + cusolverDnHandle_t handle, + int m, + int n, + float * A, + int lda, + float * TAU, + float * Workspace, + int Lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgeqrf( + cusolverDnHandle_t handle, + int m, + int n, + double * A, + int lda, + double * TAU, + double * Workspace, + int Lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgeqrf( + cusolverDnHandle_t handle, + int m, + int n, + cuComplex * A, + int lda, + cuComplex * TAU, + cuComplex * Workspace, + int Lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgeqrf( + cusolverDnHandle_t handle, + int m, + int n, + cuDoubleComplex * A, + int lda, + cuDoubleComplex * TAU, + cuDoubleComplex * Workspace, + int Lwork, + int * devInfo); + + /* generate unitary matrix Q from QR factorization */ + cusolverStatus_t CUSOLVERAPI cusolverDnSorgqr_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int k, + const float * A, + int lda, + const float * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDorgqr_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int k, + const double * A, + int lda, + const double * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCungqr_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int k, + const cuComplex * A, + int lda, + const cuComplex * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZungqr_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int k, + const cuDoubleComplex *A, + int lda, + const cuDoubleComplex *tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSorgqr( + cusolverDnHandle_t handle, + int m, + int n, + int k, + float * A, + int lda, + const float * tau, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDorgqr( + cusolverDnHandle_t handle, + int m, + int n, + int k, + double * A, + int lda, + const double * tau, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCungqr( + cusolverDnHandle_t handle, + int m, + int n, + int k, + cuComplex * A, + int lda, + const cuComplex * tau, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZungqr( + cusolverDnHandle_t handle, + int m, + int n, + int k, + cuDoubleComplex * A, + int lda, + const cuDoubleComplex *tau, + cuDoubleComplex * work, + int lwork, + int * info); + + /* compute Q**T*b in solve min||A*x = b|| */ + cusolverStatus_t CUSOLVERAPI cusolverDnSormqr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasOperation_t trans, + int m, + int n, + int k, + const float * A, + int lda, + const float * tau, + const float * C, + int ldc, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDormqr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasOperation_t trans, + int m, + int n, + int k, + const double * A, + int lda, + const double * tau, + const double * C, + int ldc, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCunmqr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasOperation_t trans, + int m, + int n, + int k, + const cuComplex * A, + int lda, + const cuComplex * tau, + const cuComplex * C, + int ldc, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZunmqr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasOperation_t trans, + int m, + int n, + int k, + const cuDoubleComplex *A, + int lda, + const cuDoubleComplex *tau, + const cuDoubleComplex *C, + int ldc, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSormqr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasOperation_t trans, + int m, + int n, + int k, + const float * A, + int lda, + const float * tau, + float * C, + int ldc, + float * work, + int lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnDormqr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasOperation_t trans, + int m, + int n, + int k, + const double * A, + int lda, + const double * tau, + double * C, + int ldc, + double * work, + int lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnCunmqr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasOperation_t trans, + int m, + int n, + int k, + const cuComplex * A, + int lda, + const cuComplex * tau, + cuComplex * C, + int ldc, + cuComplex * work, + int lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnZunmqr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasOperation_t trans, + int m, + int n, + int k, + const cuDoubleComplex *A, + int lda, + const cuDoubleComplex *tau, + cuDoubleComplex * C, + int ldc, + cuDoubleComplex * work, + int lwork, + int * devInfo); + + /* L*D*L**T,U*D*U**T factorization */ + cusolverStatus_t CUSOLVERAPI cusolverDnSsytrf_bufferSize( + cusolverDnHandle_t handle, + int n, + float * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsytrf_bufferSize( + cusolverDnHandle_t handle, + int n, + double * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCsytrf_bufferSize( + cusolverDnHandle_t handle, + int n, + cuComplex * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZsytrf_bufferSize( + cusolverDnHandle_t handle, + int n, + cuDoubleComplex * A, + int lda, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsytrf( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + int * ipiv, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsytrf( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + int * ipiv, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCsytrf( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + int * ipiv, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZsytrf( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + int * ipiv, + cuDoubleComplex * work, + int lwork, + int * info); + + /* Symmetric indefinite solve (SYTRS) */ + cusolverStatus_t CUSOLVERAPI cusolverDnXsytrs_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + int64_t nrhs, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + const int64_t * ipiv, + cudaDataType dataTypeB, + void * B, + int64_t ldb, + size_t * workspaceInBytesOnDevice, + size_t * workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXsytrs( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int64_t n, + int64_t nrhs, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + const int64_t * ipiv, + cudaDataType dataTypeB, + void * B, + int64_t ldb, + void * bufferOnDevice, + size_t workspaceInBytesOnDevice, + void * bufferOnHost, + size_t workspaceInBytesOnHost, + int * info); + + /* Symmetric indefinite inversion (sytri) */ + cusolverStatus_t CUSOLVERAPI cusolverDnSsytri_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + const int * ipiv, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsytri_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + const int * ipiv, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCsytri_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + const int * ipiv, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZsytri_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + const int * ipiv, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsytri( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + const int * ipiv, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsytri( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + const int * ipiv, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCsytri( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + const int * ipiv, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZsytri( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + const int * ipiv, + cuDoubleComplex * work, + int lwork, + int * info); + + /* bidiagonal factorization */ + cusolverStatus_t CUSOLVERAPI cusolverDnSgebrd_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgebrd_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgebrd_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgebrd_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int * Lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSgebrd( + cusolverDnHandle_t handle, + int m, + int n, + float * A, + int lda, + float * D, + float * E, + float * TAUQ, + float * TAUP, + float * Work, + int Lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgebrd( + cusolverDnHandle_t handle, + int m, + int n, + double * A, + int lda, + double * D, + double * E, + double * TAUQ, + double * TAUP, + double * Work, + int Lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgebrd( + cusolverDnHandle_t handle, + int m, + int n, + cuComplex * A, + int lda, + float * D, + float * E, + cuComplex * TAUQ, + cuComplex * TAUP, + cuComplex * Work, + int Lwork, + int * devInfo); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgebrd( + cusolverDnHandle_t handle, + int m, + int n, + cuDoubleComplex * A, + int lda, + double * D, + double * E, + cuDoubleComplex * TAUQ, + cuDoubleComplex * TAUP, + cuDoubleComplex * Work, + int Lwork, + int * devInfo); + + /* generates one of the unitary matrices Q or P**T determined by GEBRD*/ + cusolverStatus_t CUSOLVERAPI cusolverDnSorgbr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + int m, + int n, + int k, + const float * A, + int lda, + const float * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDorgbr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + int m, + int n, + int k, + const double * A, + int lda, + const double * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCungbr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + int m, + int n, + int k, + const cuComplex * A, + int lda, + const cuComplex * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZungbr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + int m, + int n, + int k, + const cuDoubleComplex *A, + int lda, + const cuDoubleComplex *tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSorgbr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + int m, + int n, + int k, + float * A, + int lda, + const float * tau, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDorgbr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + int m, + int n, + int k, + double * A, + int lda, + const double * tau, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCungbr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + int m, + int n, + int k, + cuComplex * A, + int lda, + const cuComplex * tau, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZungbr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + int m, + int n, + int k, + cuDoubleComplex * A, + int lda, + const cuDoubleComplex *tau, + cuDoubleComplex * work, + int lwork, + int * info); + + /* tridiagonal factorization */ + cusolverStatus_t CUSOLVERAPI cusolverDnSsytrd_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + const float * A, + int lda, + const float * d, + const float * e, + const float * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsytrd_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + const double * A, + int lda, + const double * d, + const double * e, + const double * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnChetrd_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuComplex * A, + int lda, + const float * d, + const float * e, + const cuComplex * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZhetrd_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex *A, + int lda, + const double * d, + const double * e, + const cuDoubleComplex *tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsytrd( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float * d, + float * e, + float * tau, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsytrd( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double * d, + double * e, + double * tau, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnChetrd( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + float * d, + float * e, + cuComplex * tau, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZhetrd( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + double * d, + double * e, + cuDoubleComplex * tau, + cuDoubleComplex * work, + int lwork, + int * info); + + /* generate unitary Q comes from sytrd */ + cusolverStatus_t CUSOLVERAPI cusolverDnSorgtr_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + const float * A, + int lda, + const float * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDorgtr_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + const double * A, + int lda, + const double * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCungtr_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuComplex * A, + int lda, + const cuComplex * tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZungtr_bufferSize( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex *A, + int lda, + const cuDoubleComplex *tau, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSorgtr( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + const float * tau, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDorgtr( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + const double * tau, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCungtr( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + const cuComplex * tau, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZungtr( + cusolverDnHandle_t handle, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + const cuDoubleComplex *tau, + cuDoubleComplex * work, + int lwork, + int * info); + + /* compute op(Q)*C or C*op(Q) where Q comes from sytrd */ + cusolverStatus_t CUSOLVERAPI cusolverDnSormtr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + int m, + int n, + const float * A, + int lda, + const float * tau, + const float * C, + int ldc, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDormtr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + int m, + int n, + const double * A, + int lda, + const double * tau, + const double * C, + int ldc, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCunmtr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + int m, + int n, + const cuComplex * A, + int lda, + const cuComplex * tau, + const cuComplex * C, + int ldc, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZunmtr_bufferSize( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + int m, + int n, + const cuDoubleComplex *A, + int lda, + const cuDoubleComplex *tau, + const cuDoubleComplex *C, + int ldc, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSormtr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + int m, + int n, + float * A, + int lda, + float * tau, + float * C, + int ldc, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDormtr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + int m, + int n, + double * A, + int lda, + double * tau, + double * C, + int ldc, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCunmtr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + int m, + int n, + cuComplex * A, + int lda, + cuComplex * tau, + cuComplex * C, + int ldc, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZunmtr( + cusolverDnHandle_t handle, + cublasSideMode_t side, + cublasFillMode_t uplo, + cublasOperation_t trans, + int m, + int n, + cuDoubleComplex * A, + int lda, + cuDoubleComplex * tau, + cuDoubleComplex * C, + int ldc, + cuDoubleComplex * work, + int lwork, + int * info); + + /* singular value decomposition, A = U * Sigma * V^H */ + cusolverStatus_t CUSOLVERAPI cusolverDnSgesvd_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgesvd_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgesvd_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgesvd_bufferSize( + cusolverDnHandle_t handle, + int m, + int n, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSgesvd( + cusolverDnHandle_t handle, + signed char jobu, + signed char jobvt, + int m, + int n, + float * A, + int lda, + float * S, + float * U, + int ldu, + float * VT, + int ldvt, + float * work, + int lwork, + float * rwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgesvd( + cusolverDnHandle_t handle, + signed char jobu, + signed char jobvt, + int m, + int n, + double * A, + int lda, + double * S, + double * U, + int ldu, + double * VT, + int ldvt, + double * work, + int lwork, + double * rwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgesvd( + cusolverDnHandle_t handle, + signed char jobu, + signed char jobvt, + int m, + int n, + cuComplex * A, + int lda, + float * S, + cuComplex * U, + int ldu, + cuComplex * VT, + int ldvt, + cuComplex * work, + int lwork, + float * rwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgesvd( + cusolverDnHandle_t handle, + signed char jobu, + signed char jobvt, + int m, + int n, + cuDoubleComplex * A, + int lda, + double * S, + cuDoubleComplex * U, + int ldu, + cuDoubleComplex * VT, + int ldvt, + cuDoubleComplex * work, + int lwork, + double * rwork, + int * info); + + /* standard symmetric eigenvalue solver, A*x = lambda*x, by divide-and-conquer + */ + cusolverStatus_t CUSOLVERAPI cusolverDnSsyevd_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const float * A, + int lda, + const float * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsyevd_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const double * A, + int lda, + const double * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCheevd_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const cuComplex * A, + int lda, + const float * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZheevd_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex *A, + int lda, + const double * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsyevd( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float * W, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsyevd( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double * W, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCheevd( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + float * W, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZheevd( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + double * W, + cuDoubleComplex * work, + int lwork, + int * info); + + /* standard selective symmetric eigenvalue solver, A*x = lambda*x, by + * divide-and-conquer */ + cusolverStatus_t CUSOLVERAPI cusolverDnSsyevdx_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + const float * A, + int lda, + float vl, + float vu, + int il, + int iu, + int * meig, + const float * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsyevdx_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + const double * A, + int lda, + double vl, + double vu, + int il, + int iu, + int * meig, + const double * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnCheevdx_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + const cuComplex * A, + int lda, + float vl, + float vu, + int il, + int iu, + int * meig, + const float * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZheevdx_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex *A, + int lda, + double vl, + double vu, + int il, + int iu, + int * meig, + const double * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsyevdx( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float vl, + float vu, + int il, + int iu, + int * meig, + float * W, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsyevdx( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double vl, + double vu, + int il, + int iu, + int * meig, + double * W, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCheevdx( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + float vl, + float vu, + int il, + int iu, + int * meig, + float * W, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZheevdx( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + double vl, + double vu, + int il, + int iu, + int * meig, + double * W, + cuDoubleComplex * work, + int lwork, + int * info); + + /* selective generalized symmetric eigenvalue solver, A*x = lambda*B*x, by + * divide-and-conquer */ + cusolverStatus_t CUSOLVERAPI cusolverDnSsygvdx_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + const float * A, + int lda, + const float * B, + int ldb, + float vl, + float vu, + int il, + int iu, + int * meig, + const float * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsygvdx_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + const double * A, + int lda, + const double * B, + int ldb, + double vl, + double vu, + int il, + int iu, + int * meig, + const double * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnChegvdx_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + const cuComplex * A, + int lda, + const cuComplex * B, + int ldb, + float vl, + float vu, + int il, + int iu, + int * meig, + const float * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZhegvdx_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex *A, + int lda, + const cuDoubleComplex *B, + int ldb, + double vl, + double vu, + int il, + int iu, + int * meig, + const double * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsygvdx( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float * B, + int ldb, + float vl, + float vu, + int il, + int iu, + int * meig, + float * W, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsygvdx( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double * B, + int ldb, + double vl, + double vu, + int il, + int iu, + int * meig, + double * W, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnChegvdx( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + cuComplex * B, + int ldb, + float vl, + float vu, + int il, + int iu, + int * meig, + float * W, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZhegvdx( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + cuDoubleComplex * B, + int ldb, + double vl, + double vu, + int il, + int iu, + int * meig, + double * W, + cuDoubleComplex * work, + int lwork, + int * info); + + /* generalized symmetric eigenvalue solver, A*x = lambda*B*x, by + * divide-and-conquer */ + cusolverStatus_t CUSOLVERAPI cusolverDnSsygvd_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const float * A, + int lda, + const float * B, + int ldb, + const float * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsygvd_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const double * A, + int lda, + const double * B, + int ldb, + const double * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnChegvd_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const cuComplex * A, + int lda, + const cuComplex * B, + int ldb, + const float * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnZhegvd_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex *A, + int lda, + const cuDoubleComplex *B, + int ldb, + const double * W, + int * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsygvd( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float * B, + int ldb, + float * W, + float * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsygvd( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double * B, + int ldb, + double * W, + double * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnChegvd( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + cuComplex * B, + int ldb, + float * W, + cuComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnZhegvd( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + cuDoubleComplex * B, + int ldb, + double * W, + cuDoubleComplex * work, + int lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverDnCreateSyevjInfo(syevjInfo_t *info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDestroySyevjInfo(syevjInfo_t info); + + cusolverStatus_t CUSOLVERAPI + cusolverDnXsyevjSetTolerance(syevjInfo_t info, double tolerance); + + cusolverStatus_t CUSOLVERAPI + cusolverDnXsyevjSetMaxSweeps(syevjInfo_t info, int max_sweeps); + + cusolverStatus_t CUSOLVERAPI + cusolverDnXsyevjSetSortEig(syevjInfo_t info, int sort_eig); + + cusolverStatus_t CUSOLVERAPI cusolverDnXsyevjGetResidual( + cusolverDnHandle_t handle, + syevjInfo_t info, + double * residual); + + cusolverStatus_t CUSOLVERAPI cusolverDnXsyevjGetSweeps( + cusolverDnHandle_t handle, + syevjInfo_t info, + int * executed_sweeps); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsyevjBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const float * A, + int lda, + const float * W, + int * lwork, + syevjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsyevjBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const double * A, + int lda, + const double * W, + int * lwork, + syevjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnCheevjBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const cuComplex * A, + int lda, + const float * W, + int * lwork, + syevjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnZheevjBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex *A, + int lda, + const double * W, + int * lwork, + syevjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsyevjBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float * W, + float * work, + int lwork, + int * info, + syevjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsyevjBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double * W, + double * work, + int lwork, + int * info, + syevjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnCheevjBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + float * W, + cuComplex * work, + int lwork, + int * info, + syevjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnZheevjBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + double * W, + cuDoubleComplex * work, + int lwork, + int * info, + syevjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsyevj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const float * A, + int lda, + const float * W, + int * lwork, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsyevj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const double * A, + int lda, + const double * W, + int * lwork, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnCheevj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const cuComplex * A, + int lda, + const float * W, + int * lwork, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnZheevj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex *A, + int lda, + const double * W, + int * lwork, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsyevj( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float * W, + float * work, + int lwork, + int * info, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsyevj( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double * W, + double * work, + int lwork, + int * info, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnCheevj( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + float * W, + cuComplex * work, + int lwork, + int * info, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnZheevj( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + double * W, + cuDoubleComplex * work, + int lwork, + int * info, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsygvj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const float * A, + int lda, + const float * B, + int ldb, + const float * W, + int * lwork, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsygvj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const double * A, + int lda, + const double * B, + int ldb, + const double * W, + int * lwork, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnChegvj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const cuComplex * A, + int lda, + const cuComplex * B, + int ldb, + const float * W, + int * lwork, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnZhegvj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + const cuDoubleComplex *A, + int lda, + const cuDoubleComplex *B, + int ldb, + const double * W, + int * lwork, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnSsygvj( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + float * A, + int lda, + float * B, + int ldb, + float * W, + float * work, + int lwork, + int * info, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnDsygvj( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + double * A, + int lda, + double * B, + int ldb, + double * W, + double * work, + int lwork, + int * info, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnChegvj( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + cuComplex * A, + int lda, + cuComplex * B, + int ldb, + float * W, + cuComplex * work, + int lwork, + int * info, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnZhegvj( + cusolverDnHandle_t handle, + cusolverEigType_t itype, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int n, + cuDoubleComplex * A, + int lda, + cuDoubleComplex * B, + int ldb, + double * W, + cuDoubleComplex * work, + int lwork, + int * info, + syevjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnCreateGesvdjInfo(gesvdjInfo_t *info); + + cusolverStatus_t CUSOLVERAPI cusolverDnDestroyGesvdjInfo(gesvdjInfo_t info); + + cusolverStatus_t CUSOLVERAPI + cusolverDnXgesvdjSetTolerance(gesvdjInfo_t info, double tolerance); + + cusolverStatus_t CUSOLVERAPI + cusolverDnXgesvdjSetMaxSweeps(gesvdjInfo_t info, int max_sweeps); + + cusolverStatus_t CUSOLVERAPI + cusolverDnXgesvdjSetSortEig(gesvdjInfo_t info, int sort_svd); + + cusolverStatus_t CUSOLVERAPI cusolverDnXgesvdjGetResidual( + cusolverDnHandle_t handle, + gesvdjInfo_t info, + double * residual); + + cusolverStatus_t CUSOLVERAPI cusolverDnXgesvdjGetSweeps( + cusolverDnHandle_t handle, + gesvdjInfo_t info, + int * executed_sweeps); + + cusolverStatus_t CUSOLVERAPI cusolverDnSgesvdjBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int m, + int n, + const float * A, + int lda, + const float * S, + const float * U, + int ldu, + const float * V, + int ldv, + int * lwork, + gesvdjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgesvdjBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int m, + int n, + const double * A, + int lda, + const double * S, + const double * U, + int ldu, + const double * V, + int ldv, + int * lwork, + gesvdjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgesvdjBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int m, + int n, + const cuComplex * A, + int lda, + const float * S, + const cuComplex * U, + int ldu, + const cuComplex * V, + int ldv, + int * lwork, + gesvdjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgesvdjBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int m, + int n, + const cuDoubleComplex *A, + int lda, + const double * S, + const cuDoubleComplex *U, + int ldu, + const cuDoubleComplex *V, + int ldv, + int * lwork, + gesvdjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnSgesvdjBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int m, + int n, + float * A, + int lda, + float * S, + float * U, + int ldu, + float * V, + int ldv, + float * work, + int lwork, + int * info, + gesvdjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgesvdjBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int m, + int n, + double * A, + int lda, + double * S, + double * U, + int ldu, + double * V, + int ldv, + double * work, + int lwork, + int * info, + gesvdjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgesvdjBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int m, + int n, + cuComplex * A, + int lda, + float * S, + cuComplex * U, + int ldu, + cuComplex * V, + int ldv, + cuComplex * work, + int lwork, + int * info, + gesvdjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgesvdjBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int m, + int n, + cuDoubleComplex * A, + int lda, + double * S, + cuDoubleComplex * U, + int ldu, + cuDoubleComplex * V, + int ldv, + cuDoubleComplex * work, + int lwork, + int * info, + gesvdjInfo_t params, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnSgesvdj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int econ, + int m, + int n, + const float * A, + int lda, + const float * S, + const float * U, + int ldu, + const float * V, + int ldv, + int * lwork, + gesvdjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgesvdj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int econ, + int m, + int n, + const double * A, + int lda, + const double * S, + const double * U, + int ldu, + const double * V, + int ldv, + int * lwork, + gesvdjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgesvdj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int econ, + int m, + int n, + const cuComplex * A, + int lda, + const float * S, + const cuComplex * U, + int ldu, + const cuComplex * V, + int ldv, + int * lwork, + gesvdjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgesvdj_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int econ, + int m, + int n, + const cuDoubleComplex *A, + int lda, + const double * S, + const cuDoubleComplex *U, + int ldu, + const cuDoubleComplex *V, + int ldv, + int * lwork, + gesvdjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnSgesvdj( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int econ, + int m, + int n, + float * A, + int lda, + float * S, + float * U, + int ldu, + float * V, + int ldv, + float * work, + int lwork, + int * info, + gesvdjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgesvdj( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int econ, + int m, + int n, + double * A, + int lda, + double * S, + double * U, + int ldu, + double * V, + int ldv, + double * work, + int lwork, + int * info, + gesvdjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgesvdj( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int econ, + int m, + int n, + cuComplex * A, + int lda, + float * S, + cuComplex * U, + int ldu, + cuComplex * V, + int ldv, + cuComplex * work, + int lwork, + int * info, + gesvdjInfo_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgesvdj( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int econ, + int m, + int n, + cuDoubleComplex * A, + int lda, + double * S, + cuDoubleComplex * U, + int ldu, + cuDoubleComplex * V, + int ldv, + cuDoubleComplex * work, + int lwork, + int * info, + gesvdjInfo_t params); + + /* batched approximate SVD */ + + cusolverStatus_t CUSOLVERAPI cusolverDnSgesvdaStridedBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int rank, + int m, + int n, + const float * d_A, + int lda, + long long int strideA, + const float * d_S, + long long int strideS, + const float * d_U, + int ldu, + long long int strideU, + const float * d_V, + int ldv, + long long int strideV, + int * lwork, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgesvdaStridedBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int rank, + int m, + int n, + const double * d_A, + int lda, + long long int strideA, + const double * d_S, + long long int strideS, + const double * d_U, + int ldu, + long long int strideU, + const double * d_V, + int ldv, + long long int strideV, + int * lwork, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgesvdaStridedBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int rank, + int m, + int n, + const cuComplex * d_A, + int lda, + long long int strideA, + const float * d_S, + long long int strideS, + const cuComplex * d_U, + int ldu, + long long int strideU, + const cuComplex * d_V, + int ldv, + long long int strideV, + int * lwork, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgesvdaStridedBatched_bufferSize( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int rank, + int m, + int n, + const cuDoubleComplex *d_A, + int lda, + long long int strideA, + const double * d_S, + long long int strideS, + const cuDoubleComplex *d_U, + int ldu, + long long int strideU, + const cuDoubleComplex *d_V, + int ldv, + long long int strideV, + int * lwork, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnSgesvdaStridedBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int rank, + int m, + int n, + const float * d_A, + int lda, + long long int strideA, + float * d_S, + long long int strideS, + float * d_U, + int ldu, + long long int strideU, + float * d_V, + int ldv, + long long int strideV, + float * d_work, + int lwork, + int * d_info, + double * h_R_nrmF, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnDgesvdaStridedBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int rank, + int m, + int n, + const double * d_A, + int lda, + long long int strideA, + double * d_S, + long long int strideS, + double * d_U, + int ldu, + long long int strideU, + double * d_V, + int ldv, + long long int strideV, + double * d_work, + int lwork, + int * d_info, + double * h_R_nrmF, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnCgesvdaStridedBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int rank, + int m, + int n, + const cuComplex * d_A, + int lda, + long long int strideA, + float * d_S, + long long int strideS, + cuComplex * d_U, + int ldu, + long long int strideU, + cuComplex * d_V, + int ldv, + long long int strideV, + cuComplex * d_work, + int lwork, + int * d_info, + double * h_R_nrmF, + int batchSize); + + cusolverStatus_t CUSOLVERAPI cusolverDnZgesvdaStridedBatched( + cusolverDnHandle_t handle, + cusolverEigMode_t jobz, + int rank, + int m, + int n, + const cuDoubleComplex *d_A, + int lda, + long long int strideA, + double * d_S, + long long int strideS, + cuDoubleComplex * d_U, + int ldu, + long long int strideU, + cuDoubleComplex * d_V, + int ldv, + long long int strideV, + cuDoubleComplex * d_work, + int lwork, + int * d_info, + double * h_R_nrmF, + int batchSize); + + cusolverStatus_t CUSOLVERAPI + cusolverDnCreateParams(cusolverDnParams_t *params); + + cusolverStatus_t CUSOLVERAPI + cusolverDnDestroyParams(cusolverDnParams_t params); + + cusolverStatus_t CUSOLVERAPI cusolverDnSetAdvOptions( + cusolverDnParams_t params, + cusolverDnFunction_t function, + cusolverAlgMode_t algo); + + /* 64-bit API for POTRF */ + CUSOLVER_DEPRECATED(cusolverDnXpotrf_bufferSize) + cusolverStatus_t CUSOLVERAPI cusolverDnPotrf_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType computeType, + size_t * workspaceInBytes); + + CUSOLVER_DEPRECATED(cusolverDnXpotrf) + cusolverStatus_t CUSOLVERAPI cusolverDnPotrf( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + cudaDataType computeType, + void * pBuffer, + size_t workspaceInBytes, + int * info); + + /* 64-bit API for POTRS */ + CUSOLVER_DEPRECATED(cusolverDnXpotrs) + cusolverStatus_t CUSOLVERAPI cusolverDnPotrs( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cublasFillMode_t uplo, + int64_t n, + int64_t nrhs, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType dataTypeB, + void * B, + int64_t ldb, + int * info); + + /* 64-bit API for GEQRF */ + CUSOLVER_DEPRECATED(cusolverDnXgeqrf_bufferSize) + cusolverStatus_t CUSOLVERAPI cusolverDnGeqrf_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType dataTypeTau, + const void * tau, + cudaDataType computeType, + size_t * workspaceInBytes); + + CUSOLVER_DEPRECATED(cusolverDnXgeqrf) + cusolverStatus_t CUSOLVERAPI cusolverDnGeqrf( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + cudaDataType dataTypeTau, + void * tau, + cudaDataType computeType, + void * pBuffer, + size_t workspaceInBytes, + int * info); + + /* 64-bit API for GETRF */ + CUSOLVER_DEPRECATED(cusolverDnXgetrf_bufferSize) + cusolverStatus_t CUSOLVERAPI cusolverDnGetrf_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType computeType, + size_t * workspaceInBytes); + + CUSOLVER_DEPRECATED(cusolverDnXgetrf) + cusolverStatus_t CUSOLVERAPI cusolverDnGetrf( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + int64_t * ipiv, + cudaDataType computeType, + void * pBuffer, + size_t workspaceInBytes, + int * info); + + /* 64-bit API for GETRS */ + CUSOLVER_DEPRECATED(cusolverDnXgetrs) + cusolverStatus_t CUSOLVERAPI cusolverDnGetrs( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cublasOperation_t trans, + int64_t n, + int64_t nrhs, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + const int64_t * ipiv, + cudaDataType dataTypeB, + void * B, + int64_t ldb, + int * info); + + /* 64-bit API for SYEVD */ + CUSOLVER_DEPRECATED(cusolverDnXsyevd_bufferSize) + cusolverStatus_t CUSOLVERAPI cusolverDnSyevd_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType dataTypeW, + const void * W, + cudaDataType computeType, + size_t * workspaceInBytes); + + CUSOLVER_DEPRECATED(cusolverDnXsyevd) + cusolverStatus_t CUSOLVERAPI cusolverDnSyevd( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + cudaDataType dataTypeW, + void * W, + cudaDataType computeType, + void * pBuffer, + size_t workspaceInBytes, + int * info); + + /* 64-bit API for SYEVDX */ + CUSOLVER_DEPRECATED(cusolverDnXsyevdx_bufferSize) + cusolverStatus_t CUSOLVERAPI cusolverDnSyevdx_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + void * vl, + void * vu, + int64_t il, + int64_t iu, + int64_t * h_meig, + cudaDataType dataTypeW, + const void * W, + cudaDataType computeType, + size_t * workspaceInBytes); + + CUSOLVER_DEPRECATED(cusolverDnXsyevdx) + cusolverStatus_t CUSOLVERAPI cusolverDnSyevdx( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + void * vl, + void * vu, + int64_t il, + int64_t iu, + int64_t * meig64, + cudaDataType dataTypeW, + void * W, + cudaDataType computeType, + void * pBuffer, + size_t workspaceInBytes, + int * info); + + /* 64-bit API for GESVD */ + CUSOLVER_DEPRECATED(cusolverDnXgesvd_bufferSize) + cusolverStatus_t CUSOLVERAPI cusolverDnGesvd_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + signed char jobu, + signed char jobvt, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType dataTypeS, + const void * S, + cudaDataType dataTypeU, + const void * U, + int64_t ldu, + cudaDataType dataTypeVT, + const void * VT, + int64_t ldvt, + cudaDataType computeType, + size_t * workspaceInBytes); + + CUSOLVER_DEPRECATED(cusolverDnXgesvd) + cusolverStatus_t CUSOLVERAPI cusolverDnGesvd( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + signed char jobu, + signed char jobvt, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + cudaDataType dataTypeS, + void * S, + cudaDataType dataTypeU, + void * U, + int64_t ldu, + cudaDataType dataTypeVT, + void * VT, + int64_t ldvt, + cudaDataType computeType, + void * pBuffer, + size_t workspaceInBytes, + int * info); + + /* + * new 64-bit API + */ + /* 64-bit API for POTRF */ + cusolverStatus_t CUSOLVERAPI cusolverDnXpotrf_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType computeType, + size_t * workspaceInBytesOnDevice, + size_t * workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXpotrf( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + cudaDataType computeType, + void * bufferOnDevice, + size_t workspaceInBytesOnDevice, + void * bufferOnHost, + size_t workspaceInBytesOnHost, + int * info); + + /* 64-bit API for POTRS */ + cusolverStatus_t CUSOLVERAPI cusolverDnXpotrs( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cublasFillMode_t uplo, + int64_t n, + int64_t nrhs, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType dataTypeB, + void * B, + int64_t ldb, + int * info); + + /* 64-bit API for GEQRF */ + cusolverStatus_t CUSOLVERAPI cusolverDnXgeqrf_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType dataTypeTau, + const void * tau, + cudaDataType computeType, + size_t * workspaceInBytesOnDevice, + size_t * workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXgeqrf( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + cudaDataType dataTypeTau, + void * tau, + cudaDataType computeType, + void * bufferOnDevice, + size_t workspaceInBytesOnDevice, + void * bufferOnHost, + size_t workspaceInBytesOnHost, + int * info); + + /* 64-bit API for GETRF */ + cusolverStatus_t CUSOLVERAPI cusolverDnXgetrf_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType computeType, + size_t * workspaceInBytesOnDevice, + size_t * workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXgetrf( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + int64_t * ipiv, + cudaDataType computeType, + void * bufferOnDevice, + size_t workspaceInBytesOnDevice, + void * bufferOnHost, + size_t workspaceInBytesOnHost, + int * info); + + /* 64-bit API for GETRS */ + cusolverStatus_t CUSOLVERAPI cusolverDnXgetrs( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cublasOperation_t trans, + int64_t n, + int64_t nrhs, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + const int64_t * ipiv, + cudaDataType dataTypeB, + void * B, + int64_t ldb, + int * info); + + /* 64-bit API for SYEVD */ + cusolverStatus_t CUSOLVERAPI cusolverDnXsyevd_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType dataTypeW, + const void * W, + cudaDataType computeType, + size_t * workspaceInBytesOnDevice, + size_t * workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXsyevd( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + cudaDataType dataTypeW, + void * W, + cudaDataType computeType, + void * bufferOnDevice, + size_t workspaceInBytesOnDevice, + void * bufferOnHost, + size_t workspaceInBytesOnHost, + int * info); + + /* 64-bit API for SYEVDX */ + cusolverStatus_t CUSOLVERAPI cusolverDnXsyevdx_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + void * vl, + void * vu, + int64_t il, + int64_t iu, + int64_t * h_meig, + cudaDataType dataTypeW, + const void * W, + cudaDataType computeType, + size_t * workspaceInBytesOnDevice, + size_t * workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXsyevdx( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverEigMode_t jobz, + cusolverEigRange_t range, + cublasFillMode_t uplo, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + void * vl, + void * vu, + int64_t il, + int64_t iu, + int64_t * meig64, + cudaDataType dataTypeW, + void * W, + cudaDataType computeType, + void * bufferOnDevice, + size_t workspaceInBytesOnDevice, + void * bufferOnHost, + size_t workspaceInBytesOnHost, + int * info); + + /* 64-bit API for GESVD */ + cusolverStatus_t CUSOLVERAPI cusolverDnXgesvd_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + signed char jobu, + signed char jobvt, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType dataTypeS, + const void * S, + cudaDataType dataTypeU, + const void * U, + int64_t ldu, + cudaDataType dataTypeVT, + const void * VT, + int64_t ldvt, + cudaDataType computeType, + size_t * workspaceInBytesOnDevice, + size_t * workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXgesvd( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + signed char jobu, + signed char jobvt, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + cudaDataType dataTypeS, + void * S, + cudaDataType dataTypeU, + void * U, + int64_t ldu, + cudaDataType dataTypeVT, + void * VT, + int64_t ldvt, + cudaDataType computeType, + void * bufferOnDevice, + size_t workspaceInBytesOnDevice, + void * bufferOnHost, + size_t workspaceInBytesOnHost, + int * info); + + /* 64-bit API for GESVDP */ + cusolverStatus_t CUSOLVERAPI cusolverDnXgesvdp_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverEigMode_t jobz, + int econ, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType dataTypeS, + const void * S, + cudaDataType dataTypeU, + const void * U, + int64_t ldu, + cudaDataType dataTypeV, + const void * V, + int64_t ldv, + cudaDataType computeType, + size_t * workspaceInBytesOnDevice, + size_t * workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXgesvdp( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverEigMode_t jobz, + int econ, + int64_t m, + int64_t n, + cudaDataType dataTypeA, + void * A, + int64_t lda, + cudaDataType dataTypeS, + void * S, + cudaDataType dataTypeU, + void * U, + int64_t ldu, + cudaDataType dataTypeV, + void * V, + int64_t ldv, + cudaDataType computeType, + void * bufferOnDevice, + size_t workspaceInBytesOnDevice, + void * bufferOnHost, + size_t workspaceInBytesOnHost, + int * d_info, + double * h_err_sigma); + + cusolverStatus_t CUSOLVERAPI cusolverDnXgesvdr_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + signed char jobu, + signed char jobv, + int64_t m, + int64_t n, + int64_t k, + int64_t p, + int64_t niters, + cudaDataType dataTypeA, + const void * A, + int64_t lda, + cudaDataType dataTypeSrand, + const void * Srand, + cudaDataType dataTypeUrand, + const void * Urand, + int64_t ldUrand, + cudaDataType dataTypeVrand, + const void * Vrand, + int64_t ldVrand, + cudaDataType computeType, + size_t * workspaceInBytesOnDevice, + size_t * workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXgesvdr( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + signed char jobu, + signed char jobv, + int64_t m, + int64_t n, + int64_t k, + int64_t p, + int64_t niters, + cudaDataType dataTypeA, + void * A, + int64_t lda, + cudaDataType dataTypeSrand, + void * Srand, + cudaDataType dataTypeUrand, + void * Urand, + int64_t ldUrand, + cudaDataType dataTypeVrand, + void * Vrand, + int64_t ldVrand, + cudaDataType computeType, + void * bufferOnDevice, + size_t workspaceInBytesOnDevice, + void * bufferOnHost, + size_t workspaceInBytesOnHost, + int * d_info); + + cusolverStatus_t CUSOLVERAPI cusolverDnXlarft_bufferSize( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverDirectMode_t direct, + cusolverStorevMode_t storev, + int64_t N, + int64_t K, + cudaDataType dataTypeV, + const void *d_V, + int64_t ldv, + cudaDataType dataTypeTau, + const void *d_tau, + cudaDataType dataTypeT, + void *d_T, + int64_t ldt, + cudaDataType computeType, + size_t *workspaceInBytesOnDevice, + size_t *workspaceInBytesOnHost); + + cusolverStatus_t CUSOLVERAPI cusolverDnXlarft( + cusolverDnHandle_t handle, + cusolverDnParams_t params, + cusolverDirectMode_t direct, + cusolverStorevMode_t storev, + int64_t N, + int64_t K, + cudaDataType dataTypeV, + const void *d_V, + int64_t ldv, + cudaDataType dataTypeTau, + const void *d_tau, + cudaDataType dataTypeT, + void *d_T, + int64_t ldt, + cudaDataType computeType, + void *bufferOnDevice, + size_t workspaceInBytesOnDevice, + void *bufferOnHost, + size_t workspaceInBytesOnHost); + + typedef void (*cusolverDnLoggerCallback_t)( + int logLevel, + const char *functionName, + const char *message); + + cusolverStatus_t CUSOLVERAPI + cusolverDnLoggerSetCallback(cusolverDnLoggerCallback_t callback); + + cusolverStatus_t CUSOLVERAPI cusolverDnLoggerSetFile(FILE *file); + + cusolverStatus_t CUSOLVERAPI cusolverDnLoggerOpenFile(const char *logFile); + + cusolverStatus_t CUSOLVERAPI cusolverDnLoggerSetLevel(int level); + + cusolverStatus_t CUSOLVERAPI cusolverDnLoggerSetMask(int mask); + + cusolverStatus_t CUSOLVERAPI cusolverDnLoggerForceDisable(); + + #if defined(__cplusplus) +} + #endif /* __cplusplus */ + +#endif /* !defined(CUDENSE_H_) */ diff --git a/cuda_toolkit/include/cusolverMg.h b/cuda_toolkit/include/cusolverMg.h new file mode 100644 index 0000000000000000000000000000000000000000..f5078bf4841ee28bf438b1aadafc8bc0f4592023 --- /dev/null +++ b/cuda_toolkit/include/cusolverMg.h @@ -0,0 +1,318 @@ +/* + * Copyright 2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(CUSOLVERMG_H_) + #define CUSOLVERMG_H_ + + #include + #include "cusolverDn.h" + + #if defined(__cplusplus) +extern "C" { + #endif /* __cplusplus */ + + struct cusolverMgContext; + typedef struct cusolverMgContext *cusolverMgHandle_t; + + /** + * \beief This enum decides how 1D device Ids (or process ranks) get mapped to + * a 2D grid. + */ + typedef enum { + + CUDALIBMG_GRID_MAPPING_ROW_MAJOR = 1, + CUDALIBMG_GRID_MAPPING_COL_MAJOR = 0 + + } cusolverMgGridMapping_t; + + /** \brief Opaque structure of the distributed grid */ + typedef void *cudaLibMgGrid_t; + /** \brief Opaque structure of the distributed matrix descriptor */ + typedef void *cudaLibMgMatrixDesc_t; + + cusolverStatus_t CUSOLVERAPI cusolverMgCreate(cusolverMgHandle_t *handle); + + cusolverStatus_t CUSOLVERAPI cusolverMgDestroy(cusolverMgHandle_t handle); + + cusolverStatus_t CUSOLVERAPI cusolverMgDeviceSelect( + cusolverMgHandle_t handle, + int nbDevices, + int deviceId[]); + + /** + * \brief Allocates resources related to the shared memory device grid. + * \param[out] grid the opaque data strcuture that holds the grid + * \param[in] numRowDevices number of devices in the row + * \param[in] numColDevices number of devices in the column + * \param[in] deviceId This array of size height * width stores the + * device-ids of the 2D grid; each entry must correspond to a valid + * gpu or to -1 (denoting CPU). \param[in] mapping whether the 2D grid is in + * row/column major \returns the status code + */ + cusolverStatus_t CUSOLVERAPI cusolverMgCreateDeviceGrid( + cudaLibMgGrid_t * grid, + int32_t numRowDevices, + int32_t numColDevices, + const int32_t deviceId[], + cusolverMgGridMapping_t mapping); + + /** + * \brief Releases the allocated resources related to the distributed grid. + * \param[in] grid the opaque data strcuture that holds the distributed grid + * \returns the status code + */ + cusolverStatus_t CUSOLVERAPI cusolverMgDestroyGrid(cudaLibMgGrid_t grid); + + /** + * \brief Allocates resources related to the distributed matrix descriptor. + * \param[out] desc the opaque data strcuture that holds the descriptor + * \param[in] numRows number of total rows + * \param[in] numCols number of total columns + * \param[in] rowBlockSize row block size + * \param[in] colBlockSize column block size + * \param[in] dataType the data type of each element in cudaDataType + * \param[in] grid the opaque data structure of the distributed grid + * \returns the status code + */ + cusolverStatus_t CUSOLVERAPI cusolverMgCreateMatrixDesc( + cudaLibMgMatrixDesc_t *desc, + int64_t numRows, + int64_t numCols, + int64_t rowBlockSize, + int64_t colBlockSize, + cudaDataType dataType, + const cudaLibMgGrid_t grid); + + /** + * \brief Releases the allocated resources related to the distributed matrix + * descriptor. \param[in] desc the opaque data strcuture that holds the + * descriptor \returns the status code + */ + cusolverStatus_t CUSOLVERAPI + cusolverMgDestroyMatrixDesc(cudaLibMgMatrixDesc_t desc); + + cusolverStatus_t CUSOLVERAPI cusolverMgSyevd_bufferSize( + cusolverMgHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int N, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + void * W, + cudaDataType dataTypeW, + cudaDataType computeType, + int64_t * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverMgSyevd( + cusolverMgHandle_t handle, + cusolverEigMode_t jobz, + cublasFillMode_t uplo, + int N, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + void * W, + cudaDataType dataTypeW, + cudaDataType computeType, + void * array_d_work[], + int64_t lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverMgGetrf_bufferSize( + cusolverMgHandle_t handle, + int M, + int N, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + int * array_d_IPIV[], + cudaDataType computeType, + int64_t * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverMgGetrf( + cusolverMgHandle_t handle, + int M, + int N, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + int * array_d_IPIV[], + cudaDataType computeType, + void * array_d_work[], + int64_t lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverMgGetrs_bufferSize( + cusolverMgHandle_t handle, + cublasOperation_t TRANS, + int N, + int NRHS, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + int * array_d_IPIV[], + void * array_d_B[], + int IB, + int JB, + cudaLibMgMatrixDesc_t descrB, + cudaDataType computeType, + int64_t * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverMgGetrs( + cusolverMgHandle_t handle, + cublasOperation_t TRANS, + int N, + int NRHS, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + int * array_d_IPIV[], + void * array_d_B[], + int IB, + int JB, + cudaLibMgMatrixDesc_t descrB, + cudaDataType computeType, + void * array_d_work[], + int64_t lwork, + int * info); + + cusolverStatus_t CUSOLVERAPI cusolverMgPotrf_bufferSize( + cusolverMgHandle_t handle, + cublasFillMode_t uplo, + int N, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + cudaDataType computeType, + int64_t * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverMgPotrf( + cusolverMgHandle_t handle, + cublasFillMode_t uplo, + int N, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + cudaDataType computeType, + void * array_d_work[], + int64_t lwork, + int * h_info); + + cusolverStatus_t CUSOLVERAPI cusolverMgPotrs_bufferSize( + cusolverMgHandle_t handle, + cublasFillMode_t uplo, + int n, + int nrhs, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + void * array_d_B[], + int IB, + int JB, + cudaLibMgMatrixDesc_t descrB, + cudaDataType computeType, + int64_t * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverMgPotrs( + cusolverMgHandle_t handle, + cublasFillMode_t uplo, + int n, + int nrhs, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + void * array_d_B[], + int IB, + int JB, + cudaLibMgMatrixDesc_t descrB, + cudaDataType computeType, + void * array_d_work[], + int64_t lwork, + int * h_info); + + cusolverStatus_t CUSOLVERAPI cusolverMgPotri_bufferSize( + cusolverMgHandle_t handle, + cublasFillMode_t uplo, + int N, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + cudaDataType computeType, + int64_t * lwork); + + cusolverStatus_t CUSOLVERAPI cusolverMgPotri( + cusolverMgHandle_t handle, + cublasFillMode_t uplo, + int N, + void * array_d_A[], + int IA, + int JA, + cudaLibMgMatrixDesc_t descrA, + cudaDataType computeType, + void * array_d_work[], + int64_t lwork, + int * h_info); + + #if defined(__cplusplus) +} + #endif /* __cplusplus */ + +#endif // CUSOLVERMG_H_ diff --git a/cuda_toolkit/include/cusolverRf.h b/cuda_toolkit/include/cusolverRf.h new file mode 100644 index 0000000000000000000000000000000000000000..30ef7917b8ef4c4a9ab71669fe78a4c22da4b847 --- /dev/null +++ b/cuda_toolkit/include/cusolverRf.h @@ -0,0 +1,339 @@ +/* + * Copyright 1993-2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(CUSOLVERRF_H_) + #define CUSOLVERRF_H_ + + #include "driver_types.h" + #include "cuComplex.h" + #include "cusolver_common.h" + + #if defined(__cplusplus) +extern "C" { + #endif /* __cplusplus */ + + /* CUSOLVERRF mode */ + typedef enum { + CUSOLVERRF_RESET_VALUES_FAST_MODE_OFF = 0, // default + CUSOLVERRF_RESET_VALUES_FAST_MODE_ON = 1 + } cusolverRfResetValuesFastMode_t; + + /* CUSOLVERRF matrix format */ + typedef enum { + CUSOLVERRF_MATRIX_FORMAT_CSR = 0, // default + CUSOLVERRF_MATRIX_FORMAT_CSC = 1 + } cusolverRfMatrixFormat_t; + + /* CUSOLVERRF unit diagonal */ + typedef enum { + CUSOLVERRF_UNIT_DIAGONAL_STORED_L = 0, // default + CUSOLVERRF_UNIT_DIAGONAL_STORED_U = 1, + CUSOLVERRF_UNIT_DIAGONAL_ASSUMED_L = 2, + CUSOLVERRF_UNIT_DIAGONAL_ASSUMED_U = 3 + } cusolverRfUnitDiagonal_t; + + /* CUSOLVERRF factorization algorithm */ + typedef enum { + CUSOLVERRF_FACTORIZATION_ALG0 = 0, // default + CUSOLVERRF_FACTORIZATION_ALG1 = 1, + CUSOLVERRF_FACTORIZATION_ALG2 = 2, + } cusolverRfFactorization_t; + + /* CUSOLVERRF triangular solve algorithm */ + typedef enum { + CUSOLVERRF_TRIANGULAR_SOLVE_ALG1 = 1, // default + CUSOLVERRF_TRIANGULAR_SOLVE_ALG2 = 2, + CUSOLVERRF_TRIANGULAR_SOLVE_ALG3 = 3 + } cusolverRfTriangularSolve_t; + + /* CUSOLVERRF numeric boost report */ + typedef enum { + CUSOLVERRF_NUMERIC_BOOST_NOT_USED = 0, // default + CUSOLVERRF_NUMERIC_BOOST_USED = 1 + } cusolverRfNumericBoostReport_t; + + /* Opaque structure holding CUSOLVERRF library common */ + struct cusolverRfCommon; + typedef struct cusolverRfCommon* cusolverRfHandle_t; + + /* CUSOLVERRF create (allocate memory) and destroy (free memory) in the handle + */ + cusolverStatus_t CUSOLVERAPI cusolverRfCreate(cusolverRfHandle_t* handle); + cusolverStatus_t CUSOLVERAPI cusolverRfDestroy(cusolverRfHandle_t handle); + + /* CUSOLVERRF set and get input format */ + cusolverStatus_t CUSOLVERAPI cusolverRfGetMatrixFormat( + cusolverRfHandle_t handle, + cusolverRfMatrixFormat_t* format, + cusolverRfUnitDiagonal_t* diag); + + cusolverStatus_t CUSOLVERAPI cusolverRfSetMatrixFormat( + cusolverRfHandle_t handle, + cusolverRfMatrixFormat_t format, + cusolverRfUnitDiagonal_t diag); + + /* CUSOLVERRF set and get numeric properties */ + cusolverStatus_t CUSOLVERAPI cusolverRfSetNumericProperties( + cusolverRfHandle_t handle, + double zero, + double boost); + + cusolverStatus_t CUSOLVERAPI cusolverRfGetNumericProperties( + cusolverRfHandle_t handle, + double* zero, + double* boost); + + cusolverStatus_t CUSOLVERAPI cusolverRfGetNumericBoostReport( + cusolverRfHandle_t handle, + cusolverRfNumericBoostReport_t* report); + + /* CUSOLVERRF choose the triangular solve algorithm */ + cusolverStatus_t CUSOLVERAPI cusolverRfSetAlgs( + cusolverRfHandle_t handle, + cusolverRfFactorization_t factAlg, + cusolverRfTriangularSolve_t solveAlg); + + cusolverStatus_t CUSOLVERAPI cusolverRfGetAlgs( + cusolverRfHandle_t handle, + cusolverRfFactorization_t* factAlg, + cusolverRfTriangularSolve_t* solveAlg); + + /* CUSOLVERRF set and get fast mode */ + cusolverStatus_t CUSOLVERAPI cusolverRfGetResetValuesFastMode( + cusolverRfHandle_t handle, + cusolverRfResetValuesFastMode_t* fastMode); + + cusolverStatus_t CUSOLVERAPI cusolverRfSetResetValuesFastMode( + cusolverRfHandle_t handle, + cusolverRfResetValuesFastMode_t fastMode); + + /*** Non-Batched Routines ***/ + /* CUSOLVERRF setup of internal structures from host or device memory */ + cusolverStatus_t CUSOLVERAPI + cusolverRfSetupHost(/* Input (in the host memory) */ + int n, + int nnzA, + int* h_csrRowPtrA, + int* h_csrColIndA, + double* h_csrValA, + int nnzL, + int* h_csrRowPtrL, + int* h_csrColIndL, + double* h_csrValL, + int nnzU, + int* h_csrRowPtrU, + int* h_csrColIndU, + double* h_csrValU, + int* h_P, + int* h_Q, + /* Output */ + cusolverRfHandle_t handle); + + cusolverStatus_t CUSOLVERAPI + cusolverRfSetupDevice(/* Input (in the device memory) */ + int n, + int nnzA, + int* csrRowPtrA, + int* csrColIndA, + double* csrValA, + int nnzL, + int* csrRowPtrL, + int* csrColIndL, + double* csrValL, + int nnzU, + int* csrRowPtrU, + int* csrColIndU, + double* csrValU, + int* P, + int* Q, + /* Output */ + cusolverRfHandle_t handle); + + /* CUSOLVERRF update the matrix values (assuming the reordering, pivoting + and consequently the sparsity pattern of L and U did not change), + and zero out the remaining values. */ + cusolverStatus_t CUSOLVERAPI + cusolverRfResetValues(/* Input (in the device memory) */ + int n, + int nnzA, + int* csrRowPtrA, + int* csrColIndA, + double* csrValA, + int* P, + int* Q, + /* Output */ + cusolverRfHandle_t handle); + + /* CUSOLVERRF analysis (for parallelism) */ + cusolverStatus_t CUSOLVERAPI cusolverRfAnalyze(cusolverRfHandle_t handle); + + /* CUSOLVERRF re-factorization (for parallelism) */ + cusolverStatus_t CUSOLVERAPI cusolverRfRefactor(cusolverRfHandle_t handle); + + /* CUSOLVERRF extraction: Get L & U packed into a single matrix M */ + cusolverStatus_t CUSOLVERAPI + cusolverRfAccessBundledFactorsDevice(/* Input */ + cusolverRfHandle_t handle, + /* Output (in the host memory) */ + int* nnzM, + /* Output (in the device memory) */ + int** Mp, + int** Mi, + double** Mx); + + cusolverStatus_t CUSOLVERAPI + cusolverRfExtractBundledFactorsHost(/* Input */ + cusolverRfHandle_t handle, + /* Output (in the host memory) */ + int* h_nnzM, + int** h_Mp, + int** h_Mi, + double** h_Mx); + + /* CUSOLVERRF extraction: Get L & U individually */ + cusolverStatus_t CUSOLVERAPI + cusolverRfExtractSplitFactorsHost(/* Input */ + cusolverRfHandle_t handle, + /* Output (in the host memory) */ + int* h_nnzL, + int** h_csrRowPtrL, + int** h_csrColIndL, + double** h_csrValL, + int* h_nnzU, + int** h_csrRowPtrU, + int** h_csrColIndU, + double** h_csrValU); + + /* CUSOLVERRF (forward and backward triangular) solves */ + cusolverStatus_t CUSOLVERAPI + cusolverRfSolve(/* Input (in the device memory) */ + cusolverRfHandle_t handle, + int* P, + int* Q, + int nrhs, // only nrhs=1 is supported + double* Temp, // of size ldt*nrhs (ldt>=n) + int ldt, + /* Input/Output (in the device memory) */ + double* XF, + /* Input */ + int ldxf); + + /*** Batched Routines ***/ + /* CUSOLVERRF-batch setup of internal structures from host */ + cusolverStatus_t CUSOLVERAPI + cusolverRfBatchSetupHost(/* Input (in the host memory)*/ + int batchSize, + int n, + int nnzA, + int* h_csrRowPtrA, + int* h_csrColIndA, + double* h_csrValA_array[], + int nnzL, + int* h_csrRowPtrL, + int* h_csrColIndL, + double* h_csrValL, + int nnzU, + int* h_csrRowPtrU, + int* h_csrColIndU, + double* h_csrValU, + int* h_P, + int* h_Q, + /* Output (in the device memory) */ + cusolverRfHandle_t handle); + + /* CUSOLVERRF-batch update the matrix values (assuming the reordering, + pivoting and consequently the sparsity pattern of L and U did not change), + and zero out the remaining values. */ + cusolverStatus_t CUSOLVERAPI + cusolverRfBatchResetValues(/* Input (in the device memory) */ + int batchSize, + int n, + int nnzA, + int* csrRowPtrA, + int* csrColIndA, + double* csrValA_array[], + int* P, + int* Q, + /* Output */ + cusolverRfHandle_t handle); + + /* CUSOLVERRF-batch analysis (for parallelism) */ + cusolverStatus_t CUSOLVERAPI + cusolverRfBatchAnalyze(cusolverRfHandle_t handle); + + /* CUSOLVERRF-batch re-factorization (for parallelism) */ + cusolverStatus_t CUSOLVERAPI + cusolverRfBatchRefactor(cusolverRfHandle_t handle); + + /* CUSOLVERRF-batch (forward and backward triangular) solves */ + cusolverStatus_t CUSOLVERAPI + cusolverRfBatchSolve(/* Input (in the device memory) */ + cusolverRfHandle_t handle, + int* P, + int* Q, + int nrhs, // only nrhs=1 is supported + double* Temp, // of size 2*batchSize*(n*nrhs) + int ldt, // only ldt=n is supported + /* Input/Output (in the device memory) */ + double* XF_array[], + /* Input */ + int ldxf); + + /* CUSOLVERRF-batch obtain the position of zero pivot */ + cusolverStatus_t CUSOLVERAPI + cusolverRfBatchZeroPivot(/* Input */ + cusolverRfHandle_t handle, + /* Output (in the host memory) */ + int* position); + + #if defined(__cplusplus) +} + #endif /* __cplusplus */ + +#endif /* CUSOLVERRF_H_ */ diff --git a/cuda_toolkit/include/cusolverSp.h b/cuda_toolkit/include/cusolverSp.h new file mode 100644 index 0000000000000000000000000000000000000000..fc09a682435716faa1f5dec25b632580719d69e2 --- /dev/null +++ b/cuda_toolkit/include/cusolverSp.h @@ -0,0 +1,923 @@ +/* + * Copyright 2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(CUSOLVERSP_H_) + #define CUSOLVERSP_H_ + + #include "cusparse.h" + #include "cublas_v2.h" + #include "cusolver_common.h" + + #if defined(__cplusplus) +extern "C" { + #endif /* __cplusplus */ + + struct cusolverSpContext; + typedef struct cusolverSpContext *cusolverSpHandle_t; + + struct csrqrInfo; + typedef struct csrqrInfo *csrqrInfo_t; + + cusolverStatus_t CUSOLVERAPI cusolverSpCreate(cusolverSpHandle_t *handle); + cusolverStatus_t CUSOLVERAPI cusolverSpDestroy(cusolverSpHandle_t handle); + cusolverStatus_t CUSOLVERAPI + cusolverSpSetStream(cusolverSpHandle_t handle, cudaStream_t streamId); + cusolverStatus_t CUSOLVERAPI + cusolverSpGetStream(cusolverSpHandle_t handle, cudaStream_t *streamId); + + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrissymHost( + cusolverSpHandle_t handle, + int m, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrEndPtrA, + const int * csrColIndA, + int * issym); + + /* -------- GPU linear solver by LU factorization + * solve A*x = b, A can be singular + * [ls] stands for linear solve + * [v] stands for vector + * [lu] stands for LU factorization + */ + cusolverStatus_t CUSOLVERAPI cusolverSpScsrlsvluHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const float * b, + float tol, + int reorder, + float * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrlsvluHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const double * b, + double tol, + int reorder, + double * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrlsvluHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const cuComplex * b, + float tol, + int reorder, + cuComplex * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrlsvluHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const cuDoubleComplex * b, + double tol, + int reorder, + cuDoubleComplex * x, + int * singularity); + + /* -------- GPU linear solver by QR factorization + * solve A*x = b, A can be singular + * [ls] stands for linear solve + * [v] stands for vector + * [qr] stands for QR factorization + */ + cusolverStatus_t CUSOLVERAPI cusolverSpScsrlsvqr( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const float * b, + float tol, + int reorder, + float * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrlsvqr( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const double * b, + double tol, + int reorder, + double * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrlsvqr( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const cuComplex * b, + float tol, + int reorder, + cuComplex * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrlsvqr( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const cuDoubleComplex * b, + double tol, + int reorder, + cuDoubleComplex * x, + int * singularity); + + /* -------- CPU linear solver by QR factorization + * solve A*x = b, A can be singular + * [ls] stands for linear solve + * [v] stands for vector + * [qr] stands for QR factorization + */ + cusolverStatus_t CUSOLVERAPI cusolverSpScsrlsvqrHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const float * b, + float tol, + int reorder, + float * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrlsvqrHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const double * b, + double tol, + int reorder, + double * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrlsvqrHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const cuComplex * b, + float tol, + int reorder, + cuComplex * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrlsvqrHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const cuDoubleComplex * b, + double tol, + int reorder, + cuDoubleComplex * x, + int * singularity); + + /* -------- CPU linear solver by Cholesky factorization + * solve A*x = b, A can be singular + * [ls] stands for linear solve + * [v] stands for vector + * [chol] stands for Cholesky factorization + * + * Only works for symmetric positive definite matrix. + * The upper part of A is ignored. + */ + cusolverStatus_t CUSOLVERAPI cusolverSpScsrlsvcholHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const float * b, + float tol, + int reorder, + float * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrlsvcholHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const double * b, + double tol, + int reorder, + double * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrlsvcholHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const cuComplex * b, + float tol, + int reorder, + cuComplex * x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrlsvcholHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const cuDoubleComplex * b, + double tol, + int reorder, + cuDoubleComplex * x, + int * singularity); + + /* -------- GPU linear solver by Cholesky factorization + * solve A*x = b, A can be singular + * [ls] stands for linear solve + * [v] stands for vector + * [chol] stands for Cholesky factorization + * + * Only works for symmetric positive definite matrix. + * The upper part of A is ignored. + */ + cusolverStatus_t CUSOLVERAPI cusolverSpScsrlsvchol( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const float * b, + float tol, + int reorder, + // output + float *x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrlsvchol( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const double * b, + double tol, + int reorder, + // output + double *x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrlsvchol( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const cuComplex * b, + float tol, + int reorder, + // output + cuComplex *x, + int * singularity); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrlsvchol( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrVal, + const int * csrRowPtr, + const int * csrColInd, + const cuDoubleComplex * b, + double tol, + int reorder, + // output + cuDoubleComplex *x, + int * singularity); + + /* ----------- CPU least square solver by QR factorization + * solve min|b - A*x| + * [lsq] stands for least square + * [v] stands for vector + * [qr] stands for QR factorization + */ + cusolverStatus_t CUSOLVERAPI cusolverSpScsrlsqvqrHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const float * b, + float tol, + int * rankA, + float * x, + int * p, + float * min_norm); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrlsqvqrHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const double * b, + double tol, + int * rankA, + double * x, + int * p, + double * min_norm); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrlsqvqrHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const cuComplex * b, + float tol, + int * rankA, + cuComplex * x, + int * p, + float * min_norm); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrlsqvqrHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const cuDoubleComplex * b, + double tol, + int * rankA, + cuDoubleComplex * x, + int * p, + double * min_norm); + + /* --------- CPU eigenvalue solver by shift inverse + * solve A*x = lambda * x + * where lambda is the eigenvalue nearest mu0. + * [eig] stands for eigenvalue solver + * [si] stands for shift-inverse + */ + cusolverStatus_t CUSOLVERAPI cusolverSpScsreigvsiHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + float mu0, + const float * x0, + int maxite, + float tol, + float * mu, + float * x); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsreigvsiHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + double mu0, + const double * x0, + int maxite, + double tol, + double * mu, + double * x); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsreigvsiHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuComplex mu0, + const cuComplex * x0, + int maxite, + float tol, + cuComplex * mu, + cuComplex * x); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsreigvsiHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuDoubleComplex mu0, + const cuDoubleComplex * x0, + int maxite, + double tol, + cuDoubleComplex * mu, + cuDoubleComplex * x); + + /* --------- GPU eigenvalue solver by shift inverse + * solve A*x = lambda * x + * where lambda is the eigenvalue nearest mu0. + * [eig] stands for eigenvalue solver + * [si] stands for shift-inverse + */ + cusolverStatus_t CUSOLVERAPI cusolverSpScsreigvsi( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + float mu0, + const float * x0, + int maxite, + float eps, + float * mu, + float * x); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsreigvsi( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + double mu0, + const double * x0, + int maxite, + double eps, + double * mu, + double * x); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsreigvsi( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuComplex mu0, + const cuComplex * x0, + int maxite, + float eps, + cuComplex * mu, + cuComplex * x); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsreigvsi( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuDoubleComplex mu0, + const cuDoubleComplex * x0, + int maxite, + double eps, + cuDoubleComplex * mu, + cuDoubleComplex * x); + + // ----------- enclosed eigenvalues + + cusolverStatus_t CUSOLVERAPI cusolverSpScsreigsHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuComplex left_bottom_corner, + cuComplex right_upper_corner, + int * num_eigs); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsreigsHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuDoubleComplex left_bottom_corner, + cuDoubleComplex right_upper_corner, + int * num_eigs); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsreigsHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuComplex left_bottom_corner, + cuComplex right_upper_corner, + int * num_eigs); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsreigsHost( + cusolverSpHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuDoubleComplex left_bottom_corner, + cuDoubleComplex right_upper_corner, + int * num_eigs); + + /* --------- CPU symrcm + * Symmetric reverse Cuthill McKee permutation + * + */ + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrsymrcmHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + int * p); + + /* --------- CPU symmdq + * Symmetric minimum degree algorithm by quotient graph + * + */ + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrsymmdqHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + int * p); + + /* --------- CPU symmdq + * Symmetric Approximate minimum degree algorithm by quotient graph + * + */ + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrsymamdHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + int * p); + + /* --------- CPU metis + * symmetric reordering + */ + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrmetisndHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + const int64_t * options, + int * p); + + /* --------- CPU zfd + * Zero free diagonal reordering + */ + cusolverStatus_t CUSOLVERAPI cusolverSpScsrzfdHost( + cusolverSpHandle_t handle, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + int * P, + int * numnz); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrzfdHost( + cusolverSpHandle_t handle, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + int * P, + int * numnz); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrzfdHost( + cusolverSpHandle_t handle, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + int * P, + int * numnz); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrzfdHost( + cusolverSpHandle_t handle, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + int * P, + int * numnz); + + /* --------- CPU permuation + * P*A*Q^T + * + */ + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrperm_bufferSizeHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + const int * p, + const int * q, + size_t * bufferSizeInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrpermHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + int * csrRowPtrA, + int * csrColIndA, + const int * p, + const int * q, + int * map, + void * pBuffer); + + /* + * Low-level API: Batched QR + * + */ + + cusolverStatus_t CUSOLVERAPI cusolverSpCreateCsrqrInfo(csrqrInfo_t *info); + + cusolverStatus_t CUSOLVERAPI cusolverSpDestroyCsrqrInfo(csrqrInfo_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrqrAnalysisBatched( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfo_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrBufferInfoBatched( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrVal, + const int * csrRowPtr, + const int * csrColInd, + int batchSize, + csrqrInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrBufferInfoBatched( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrVal, + const int * csrRowPtr, + const int * csrColInd, + int batchSize, + csrqrInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrBufferInfoBatched( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrVal, + const int * csrRowPtr, + const int * csrColInd, + int batchSize, + csrqrInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrBufferInfoBatched( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrVal, + const int * csrRowPtr, + const int * csrColInd, + int batchSize, + csrqrInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrsvBatched( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const float * b, + float * x, + int batchSize, + csrqrInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrsvBatched( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const double * b, + double * x, + int batchSize, + csrqrInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrsvBatched( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const cuComplex * b, + cuComplex * x, + int batchSize, + csrqrInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrsvBatched( + cusolverSpHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + const cuDoubleComplex * b, + cuDoubleComplex * x, + int batchSize, + csrqrInfo_t info, + void * pBuffer); + + #if defined(__cplusplus) +} + #endif /* __cplusplus */ + +#endif // define CUSOLVERSP_H_ diff --git a/cuda_toolkit/include/cusolverSp_LOWLEVEL_PREVIEW.h b/cuda_toolkit/include/cusolverSp_LOWLEVEL_PREVIEW.h new file mode 100644 index 0000000000000000000000000000000000000000..02670ccb77c147a182c64c71152c39e025679d26 --- /dev/null +++ b/cuda_toolkit/include/cusolverSp_LOWLEVEL_PREVIEW.h @@ -0,0 +1,1107 @@ +/* + * Copyright 2015 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(CUSOLVERSP_LOWLEVEL_PREVIEW_H_) + #define CUSOLVERSP_LOWLEVEL_PREVIEW_H_ + + #include "cusolverSp.h" + + #if defined(__cplusplus) +extern "C" { + #endif /* __cplusplus */ + + struct csrluInfoHost; + typedef struct csrluInfoHost *csrluInfoHost_t; + + struct csrqrInfoHost; + typedef struct csrqrInfoHost *csrqrInfoHost_t; + + struct csrcholInfoHost; + typedef struct csrcholInfoHost *csrcholInfoHost_t; + + struct csrcholInfo; + typedef struct csrcholInfo *csrcholInfo_t; + + /* + * Low level API for CPU LU + * + */ + cusolverStatus_t CUSOLVERAPI + cusolverSpCreateCsrluInfoHost(csrluInfoHost_t *info); + + cusolverStatus_t CUSOLVERAPI + cusolverSpDestroyCsrluInfoHost(csrluInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrluAnalysisHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + csrluInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrluBufferInfoHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrluInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrluBufferInfoHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrluInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrluBufferInfoHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrluInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrluBufferInfoHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrluInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrluFactorHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrluInfoHost_t info, + float pivot_threshold, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrluFactorHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrluInfoHost_t info, + double pivot_threshold, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrluFactorHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrluInfoHost_t info, + float pivot_threshold, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrluFactorHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrluInfoHost_t info, + double pivot_threshold, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrluZeroPivotHost( + cusolverSpHandle_t handle, + csrluInfoHost_t info, + float tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrluZeroPivotHost( + cusolverSpHandle_t handle, + csrluInfoHost_t info, + double tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrluZeroPivotHost( + cusolverSpHandle_t handle, + csrluInfoHost_t info, + float tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrluZeroPivotHost( + cusolverSpHandle_t handle, + csrluInfoHost_t info, + double tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrluSolveHost( + cusolverSpHandle_t handle, + int n, + const float * b, + float * x, + csrluInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrluSolveHost( + cusolverSpHandle_t handle, + int n, + const double * b, + double * x, + csrluInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrluSolveHost( + cusolverSpHandle_t handle, + int n, + const cuComplex * b, + cuComplex * x, + csrluInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrluSolveHost( + cusolverSpHandle_t handle, + int n, + const cuDoubleComplex *b, + cuDoubleComplex * x, + csrluInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrluNnzHost( + cusolverSpHandle_t handle, + int * nnzLRef, + int * nnzURef, + csrluInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrluExtractHost( + cusolverSpHandle_t handle, + int * P, + int * Q, + const cusparseMatDescr_t descrL, + float * csrValL, + int * csrRowPtrL, + int * csrColIndL, + const cusparseMatDescr_t descrU, + float * csrValU, + int * csrRowPtrU, + int * csrColIndU, + csrluInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrluExtractHost( + cusolverSpHandle_t handle, + int * P, + int * Q, + const cusparseMatDescr_t descrL, + double * csrValL, + int * csrRowPtrL, + int * csrColIndL, + const cusparseMatDescr_t descrU, + double * csrValU, + int * csrRowPtrU, + int * csrColIndU, + csrluInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrluExtractHost( + cusolverSpHandle_t handle, + int * P, + int * Q, + const cusparseMatDescr_t descrL, + cuComplex * csrValL, + int * csrRowPtrL, + int * csrColIndL, + const cusparseMatDescr_t descrU, + cuComplex * csrValU, + int * csrRowPtrU, + int * csrColIndU, + csrluInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrluExtractHost( + cusolverSpHandle_t handle, + int * P, + int * Q, + const cusparseMatDescr_t descrL, + cuDoubleComplex * csrValL, + int * csrRowPtrL, + int * csrColIndL, + const cusparseMatDescr_t descrU, + cuDoubleComplex * csrValU, + int * csrRowPtrU, + int * csrColIndU, + csrluInfoHost_t info, + void * pBuffer); + + /* + * Low level API for CPU QR + * + */ + cusolverStatus_t CUSOLVERAPI + cusolverSpCreateCsrqrInfoHost(csrqrInfoHost_t *info); + + cusolverStatus_t CUSOLVERAPI + cusolverSpDestroyCsrqrInfoHost(csrqrInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrqrAnalysisHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrBufferInfoHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrBufferInfoHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrBufferInfoHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrBufferInfoHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrSetupHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + float mu, + csrqrInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrSetupHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + double mu, + csrqrInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrSetupHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuComplex mu, + csrqrInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrSetupHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuDoubleComplex mu, + csrqrInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrFactorHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + float * b, + float * x, + csrqrInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrFactorHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + double * b, + double * x, + csrqrInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrFactorHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + cuComplex * b, + cuComplex * x, + csrqrInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrFactorHost( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + cuDoubleComplex * b, + cuDoubleComplex * x, + csrqrInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrZeroPivotHost( + cusolverSpHandle_t handle, + csrqrInfoHost_t info, + float tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrZeroPivotHost( + cusolverSpHandle_t handle, + csrqrInfoHost_t info, + double tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrZeroPivotHost( + cusolverSpHandle_t handle, + csrqrInfoHost_t info, + float tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrZeroPivotHost( + cusolverSpHandle_t handle, + csrqrInfoHost_t info, + double tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrSolveHost( + cusolverSpHandle_t handle, + int m, + int n, + float * b, + float * x, + csrqrInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrSolveHost( + cusolverSpHandle_t handle, + int m, + int n, + double * b, + double * x, + csrqrInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrSolveHost( + cusolverSpHandle_t handle, + int m, + int n, + cuComplex * b, + cuComplex * x, + csrqrInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrSolveHost( + cusolverSpHandle_t handle, + int m, + int n, + cuDoubleComplex * b, + cuDoubleComplex * x, + csrqrInfoHost_t info, + void * pBuffer); + + /* + * Low level API for GPU QR + * + */ + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrqrAnalysis( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfo_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrBufferInfo( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrBufferInfo( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrBufferInfo( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrBufferInfo( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrqrInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrSetup( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + float mu, + csrqrInfo_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrSetup( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + double mu, + csrqrInfo_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrSetup( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuComplex mu, + csrqrInfo_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrSetup( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + cuDoubleComplex mu, + csrqrInfo_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrFactor( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + float * b, + float * x, + csrqrInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrFactor( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + double * b, + double * x, + csrqrInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrFactor( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + cuComplex * b, + cuComplex * x, + csrqrInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrFactor( + cusolverSpHandle_t handle, + int m, + int n, + int nnzA, + cuDoubleComplex * b, + cuDoubleComplex * x, + csrqrInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrZeroPivot( + cusolverSpHandle_t handle, + csrqrInfo_t info, + float tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrZeroPivot( + cusolverSpHandle_t handle, + csrqrInfo_t info, + double tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrZeroPivot( + cusolverSpHandle_t handle, + csrqrInfo_t info, + float tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrZeroPivot( + cusolverSpHandle_t handle, + csrqrInfo_t info, + double tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrqrSolve( + cusolverSpHandle_t handle, + int m, + int n, + float * b, + float * x, + csrqrInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrqrSolve( + cusolverSpHandle_t handle, + int m, + int n, + double * b, + double * x, + csrqrInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrqrSolve( + cusolverSpHandle_t handle, + int m, + int n, + cuComplex * b, + cuComplex * x, + csrqrInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrqrSolve( + cusolverSpHandle_t handle, + int m, + int n, + cuDoubleComplex * b, + cuDoubleComplex * x, + csrqrInfo_t info, + void * pBuffer); + + /* + * Low level API for CPU Cholesky + * + */ + cusolverStatus_t CUSOLVERAPI + cusolverSpCreateCsrcholInfoHost(csrcholInfoHost_t *info); + + cusolverStatus_t CUSOLVERAPI + cusolverSpDestroyCsrcholInfoHost(csrcholInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrcholAnalysisHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfoHost_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrcholBufferInfoHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrcholBufferInfoHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrcholBufferInfoHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrcholBufferInfoHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfoHost_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrcholFactorHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrcholFactorHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrcholFactorHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrcholFactorHost( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrcholZeroPivotHost( + cusolverSpHandle_t handle, + csrcholInfoHost_t info, + float tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrcholZeroPivotHost( + cusolverSpHandle_t handle, + csrcholInfoHost_t info, + double tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrcholZeroPivotHost( + cusolverSpHandle_t handle, + csrcholInfoHost_t info, + float tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrcholZeroPivotHost( + cusolverSpHandle_t handle, + csrcholInfoHost_t info, + double tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrcholSolveHost( + cusolverSpHandle_t handle, + int n, + const float * b, + float * x, + csrcholInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrcholSolveHost( + cusolverSpHandle_t handle, + int n, + const double * b, + double * x, + csrcholInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrcholSolveHost( + cusolverSpHandle_t handle, + int n, + const cuComplex * b, + cuComplex * x, + csrcholInfoHost_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrcholSolveHost( + cusolverSpHandle_t handle, + int n, + const cuDoubleComplex *b, + cuDoubleComplex * x, + csrcholInfoHost_t info, + void * pBuffer); + + /* + * Low level API for GPU Cholesky + * + */ + cusolverStatus_t CUSOLVERAPI cusolverSpCreateCsrcholInfo(csrcholInfo_t *info); + + cusolverStatus_t CUSOLVERAPI cusolverSpDestroyCsrcholInfo(csrcholInfo_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpXcsrcholAnalysis( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfo_t info); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrcholBufferInfo( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrcholBufferInfo( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrcholBufferInfo( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrcholBufferInfo( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfo_t info, + size_t * internalDataInBytes, + size_t * workspaceInBytes); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrcholFactor( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrcholFactor( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrcholFactor( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrcholFactor( + cusolverSpHandle_t handle, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex * csrValA, + const int * csrRowPtrA, + const int * csrColIndA, + csrcholInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrcholZeroPivot( + cusolverSpHandle_t handle, + csrcholInfo_t info, + float tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrcholZeroPivot( + cusolverSpHandle_t handle, + csrcholInfo_t info, + double tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrcholZeroPivot( + cusolverSpHandle_t handle, + csrcholInfo_t info, + float tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrcholZeroPivot( + cusolverSpHandle_t handle, + csrcholInfo_t info, + double tol, + int * position); + + cusolverStatus_t CUSOLVERAPI cusolverSpScsrcholSolve( + cusolverSpHandle_t handle, + int n, + const float * b, + float * x, + csrcholInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrcholSolve( + cusolverSpHandle_t handle, + int n, + const double * b, + double * x, + csrcholInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrcholSolve( + cusolverSpHandle_t handle, + int n, + const cuComplex * b, + cuComplex * x, + csrcholInfo_t info, + void * pBuffer); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrcholSolve( + cusolverSpHandle_t handle, + int n, + const cuDoubleComplex *b, + cuDoubleComplex * x, + csrcholInfo_t info, + void * pBuffer); + + /* + * "diag" is a device array of size N. + * cusolverSpcsrcholDiag returns diag(L) to "diag" where A(P,P) = L*L**T + * "diag" can estimate det(A) because det(A(P,P)) = det(A) = det(L)^2 if A = + * L*L**T. + * + * cusolverSpcsrcholDiag must be called after cusolverSpcsrcholFactor. + * otherwise "diag" is wrong. + */ + cusolverStatus_t CUSOLVERAPI cusolverSpScsrcholDiag( + cusolverSpHandle_t handle, + csrcholInfo_t info, + float * diag); + + cusolverStatus_t CUSOLVERAPI cusolverSpDcsrcholDiag( + cusolverSpHandle_t handle, + csrcholInfo_t info, + double * diag); + + cusolverStatus_t CUSOLVERAPI cusolverSpCcsrcholDiag( + cusolverSpHandle_t handle, + csrcholInfo_t info, + float * diag); + + cusolverStatus_t CUSOLVERAPI cusolverSpZcsrcholDiag( + cusolverSpHandle_t handle, + csrcholInfo_t info, + double * diag); + + #if defined(__cplusplus) +} + #endif /* __cplusplus */ + +#endif // CUSOLVERSP_LOWLEVEL_PREVIEW_H_ diff --git a/cuda_toolkit/include/cusolver_common.h b/cuda_toolkit/include/cusolver_common.h new file mode 100644 index 0000000000000000000000000000000000000000..dfeca21cb337c02adc3a595d93d612715ee3f5ff --- /dev/null +++ b/cuda_toolkit/include/cusolver_common.h @@ -0,0 +1,261 @@ +/* + * Copyright 2014 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(CUSOLVER_COMMON_H_) + #define CUSOLVER_COMMON_H_ + + #include "library_types.h" + + #ifndef CUSOLVERAPI + #ifdef _WIN32 + #define CUSOLVERAPI __stdcall + #else + #define CUSOLVERAPI + #endif + #endif + + #if defined(_MSC_VER) +typedef __int64 int64_t; + #else + #include + #endif + +typedef int cusolver_int_t; + + #define CUSOLVER_VER_MAJOR 11 + #define CUSOLVER_VER_MINOR 6 + #define CUSOLVER_VER_PATCH 1 + #define CUSOLVER_VER_BUILD 9 + #define CUSOLVER_VERSION \ + (CUSOLVER_VER_MAJOR * 1000 + CUSOLVER_VER_MINOR * 100 + CUSOLVER_VER_PATCH) + +//------------------------------------------------------------------------------ + + #if !defined(_MSC_VER) + #define CUSOLVER_CPP_VERSION __cplusplus + #elif _MSC_FULL_VER >= 190024210 // Visual Studio 2015 Update 3 + #define CUSOLVER_CPP_VERSION _MSVC_LANG + #else + #define CUSOLVER_CPP_VERSION 0 + #endif + +//------------------------------------------------------------------------------ + + #if !defined(DISABLE_CUSOLVER_DEPRECATED) + + #if CUSOLVER_CPP_VERSION >= 201402L + + #define CUSOLVER_DEPRECATED(new_func) \ + [[deprecated("please use " #new_func " instead")]] + + #elif defined(_MSC_VER) + + #define CUSOLVER_DEPRECATED(new_func) \ + __declspec(deprecated("please use " #new_func " instead")) + + #elif defined(__INTEL_COMPILER) || defined(__clang__) || \ + (defined(__GNUC__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))) + + #define CUSOLVER_DEPRECATED(new_func) \ + __attribute__((deprecated("please use " #new_func " instead"))) + + #elif defined(__GNUC__) || defined(__xlc__) + + #define CUSOLVER_DEPRECATED(new_func) __attribute__((deprecated)) + + #else + + #define CUSOLVER_DEPRECATED(new_func) + + #endif // defined(__cplusplus) && __cplusplus >= 201402L + //------------------------------------------------------------------------------ + + #if CUSOLVER_CPP_VERSION >= 201703L + + #define CUSOLVER_DEPRECATED_ENUM(new_enum) \ + [[deprecated("please use " #new_enum " instead")]] + + #elif defined(__clang__) || \ + (defined(__GNUC__) && __GNUC__ >= 6 && !defined(__PGI)) + + #define CUSOLVER_DEPRECATED_ENUM(new_enum) \ + __attribute__((deprecated("please use " #new_enum " instead"))) + + #else + + #define CUSOLVER_DEPRECATED_ENUM(new_enum) + + #endif // defined(__cplusplus) && __cplusplus >= 201402L + + #else // defined(DISABLE_CUSOLVER_DEPRECATED) + + #define CUSOLVER_DEPRECATED(new_func) + #define CUSOLVER_DEPRECATED_ENUM(new_enum) + + #endif // !defined(DISABLE_CUSOLVER_DEPRECATED) + + #undef CUSOLVER_CPP_VERSION + + #if defined(__cplusplus) +extern "C" { + #endif /* __cplusplus */ + + typedef enum { + CUSOLVER_STATUS_SUCCESS = 0, + CUSOLVER_STATUS_NOT_INITIALIZED = 1, + CUSOLVER_STATUS_ALLOC_FAILED = 2, + CUSOLVER_STATUS_INVALID_VALUE = 3, + CUSOLVER_STATUS_ARCH_MISMATCH = 4, + CUSOLVER_STATUS_MAPPING_ERROR = 5, + CUSOLVER_STATUS_EXECUTION_FAILED = 6, + CUSOLVER_STATUS_INTERNAL_ERROR = 7, + CUSOLVER_STATUS_MATRIX_TYPE_NOT_SUPPORTED = 8, + CUSOLVER_STATUS_NOT_SUPPORTED = 9, + CUSOLVER_STATUS_ZERO_PIVOT = 10, + CUSOLVER_STATUS_INVALID_LICENSE = 11, + CUSOLVER_STATUS_IRS_PARAMS_NOT_INITIALIZED = 12, + CUSOLVER_STATUS_IRS_PARAMS_INVALID = 13, + CUSOLVER_STATUS_IRS_PARAMS_INVALID_PREC = 14, + CUSOLVER_STATUS_IRS_PARAMS_INVALID_REFINE = 15, + CUSOLVER_STATUS_IRS_PARAMS_INVALID_MAXITER = 16, + CUSOLVER_STATUS_IRS_INTERNAL_ERROR = 20, + CUSOLVER_STATUS_IRS_NOT_SUPPORTED = 21, + CUSOLVER_STATUS_IRS_OUT_OF_RANGE = 22, + CUSOLVER_STATUS_IRS_NRHS_NOT_SUPPORTED_FOR_REFINE_GMRES = 23, + CUSOLVER_STATUS_IRS_INFOS_NOT_INITIALIZED = 25, + CUSOLVER_STATUS_IRS_INFOS_NOT_DESTROYED = 26, + CUSOLVER_STATUS_IRS_MATRIX_SINGULAR = 30, + CUSOLVER_STATUS_INVALID_WORKSPACE = 31 + } cusolverStatus_t; + + typedef enum { + CUSOLVER_EIG_TYPE_1 = 1, + CUSOLVER_EIG_TYPE_2 = 2, + CUSOLVER_EIG_TYPE_3 = 3 + } cusolverEigType_t; + + typedef enum { + CUSOLVER_EIG_MODE_NOVECTOR = 0, + CUSOLVER_EIG_MODE_VECTOR = 1 + } cusolverEigMode_t; + + typedef enum { + CUSOLVER_EIG_RANGE_ALL = 1001, + CUSOLVER_EIG_RANGE_I = 1002, + CUSOLVER_EIG_RANGE_V = 1003, + } cusolverEigRange_t; + + typedef enum { + CUSOLVER_INF_NORM = 104, + CUSOLVER_MAX_NORM = 105, + CUSOLVER_ONE_NORM = 106, + CUSOLVER_FRO_NORM = 107, + } cusolverNorm_t; + + typedef enum { + CUSOLVER_IRS_REFINE_NOT_SET = 1100, + CUSOLVER_IRS_REFINE_NONE = 1101, + CUSOLVER_IRS_REFINE_CLASSICAL = 1102, + CUSOLVER_IRS_REFINE_CLASSICAL_GMRES = 1103, + CUSOLVER_IRS_REFINE_GMRES = 1104, + CUSOLVER_IRS_REFINE_GMRES_GMRES = 1105, + CUSOLVER_IRS_REFINE_GMRES_NOPCOND = 1106, + + CUSOLVER_PREC_DD = 1150, + CUSOLVER_PREC_SS = 1151, + CUSOLVER_PREC_SHT = 1152, + + } cusolverIRSRefinement_t; + + typedef enum { + CUSOLVER_R_8I = 1201, + CUSOLVER_R_8U = 1202, + CUSOLVER_R_64F = 1203, + CUSOLVER_R_32F = 1204, + CUSOLVER_R_16F = 1205, + CUSOLVER_R_16BF = 1206, + CUSOLVER_R_TF32 = 1207, + CUSOLVER_R_AP = 1208, + CUSOLVER_C_8I = 1211, + CUSOLVER_C_8U = 1212, + CUSOLVER_C_64F = 1213, + CUSOLVER_C_32F = 1214, + CUSOLVER_C_16F = 1215, + CUSOLVER_C_16BF = 1216, + CUSOLVER_C_TF32 = 1217, + CUSOLVER_C_AP = 1218, + } cusolverPrecType_t; + + typedef enum { + CUSOLVER_ALG_0 = 0, /* default algorithm */ + CUSOLVER_ALG_1 = 1, + CUSOLVER_ALG_2 = 2 + } cusolverAlgMode_t; + + typedef enum { + CUBLAS_STOREV_COLUMNWISE = 0, + CUBLAS_STOREV_ROWWISE = 1 + } cusolverStorevMode_t; + + typedef enum { + CUBLAS_DIRECT_FORWARD = 0, + CUBLAS_DIRECT_BACKWARD = 1 + } cusolverDirectMode_t; + + cusolverStatus_t CUSOLVERAPI + cusolverGetProperty(libraryPropertyType type, int *value); + + cusolverStatus_t CUSOLVERAPI cusolverGetVersion(int *version); + + #if defined(__cplusplus) +} + #endif /* __cplusplus */ + +#endif // CUSOLVER_COMMON_H_ diff --git a/cuda_toolkit/include/cusparse.h b/cuda_toolkit/include/cusparse.h new file mode 100644 index 0000000000000000000000000000000000000000..bc7bd9916b7c5cad9204021da019515b5ab8d4e4 --- /dev/null +++ b/cuda_toolkit/include/cusparse.h @@ -0,0 +1,6106 @@ +/* + * Copyright 1993-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ +#if !defined(CUSPARSE_H_) +#define CUSPARSE_H_ + +#include // cuComplex +#include // cudaStream_t +#include // CUDA_R_32F +#include // int64_t +#include // FILE* + +#if defined(__cplusplus) +# include // __half +#endif // defined(__cplusplus) + +//############################################################################## +//# CUSPARSE VERSION INFORMATION +//############################################################################## + +#define CUSPARSE_VER_MAJOR 12 +#define CUSPARSE_VER_MINOR 3 +#define CUSPARSE_VER_PATCH 1 +#define CUSPARSE_VER_BUILD 170 +#define CUSPARSE_VERSION (CUSPARSE_VER_MAJOR * 1000 + \ + CUSPARSE_VER_MINOR * 100 + \ + CUSPARSE_VER_PATCH) + +// ############################################################################# +// # BASIC MACROS +// ############################################################################# + +#if !defined(CUSPARSEAPI) +# if defined(_WIN32) +# define CUSPARSEAPI __stdcall +# else +# define CUSPARSEAPI +# endif +#endif + +//------------------------------------------------------------------------------ + +#if !defined(_MSC_VER) +# define CUSPARSE_CPP_VERSION __cplusplus +#elif _MSC_FULL_VER >= 190024210 // Visual Studio 2015 Update 3 +# define CUSPARSE_CPP_VERSION _MSVC_LANG +#else +# define CUSPARSE_CPP_VERSION 0 +#endif + +// ############################################################################# +// # CUSPARSE_DEPRECATED MACRO +// ############################################################################# + +#if !defined(DISABLE_CUSPARSE_DEPRECATED) + +# if CUSPARSE_CPP_VERSION >= 201402L + +# define CUSPARSE_DEPRECATED_REPLACE_WITH(new_func) \ + [[deprecated("please use " #new_func " instead")]] + +# define CUSPARSE_DEPRECATED \ + [[deprecated("The routine will be removed in the next major release")]] + +# define CUSPARSE_DEPRECATED_TYPE \ + [[deprecated("The type will be removed in the next major release")]] + +# define CUSPARSE_DEPRECATED_TYPE_MSVC + +# elif defined(_MSC_VER) + +# define CUSPARSE_DEPRECATED_REPLACE_WITH(new_func) \ + __declspec(deprecated("please use " #new_func " instead")) + +# define CUSPARSE_DEPRECATED \ + __declspec(deprecated( \ + "The routine will be removed in the next major release")) + +# define CUSPARSE_DEPRECATED_TYPE + +# define CUSPARSE_DEPRECATED_TYPE_MSVC + __declspec(deprecated( \ + "The type will be removed in the next major release")) + +# elif defined(__INTEL_COMPILER) || defined(__clang__) || \ + (defined(__GNUC__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))) + +# define CUSPARSE_DEPRECATED_REPLACE_WITH(new_func) \ + __attribute__((deprecated("please use " #new_func " instead"))) + +# define CUSPARSE_DEPRECATED \ + __attribute__((deprecated( \ + "The routine will be removed in the next major release"))) + +# define CUSPARSE_DEPRECATED_TYPE \ + __attribute__((deprecated( \ + "The type will be removed in the next major release"))) + +# define CUSPARSE_DEPRECATED_TYPE_MSVC + +# elif defined(__GNUC__) || defined(__xlc__) + +# define CUSPARSE_DEPRECATED_REPLACE_WITH(new_func) \ + __attribute__((deprecated)) + +# define CUSPARSE_DEPRECATED __attribute__((deprecated)) +# define CUSPARSE_DEPRECATED_TYPE __attribute__((deprecated)) +# define CUSPARSE_DEPRECATED_TYPE_MSVC + +# else + +# define CUSPARSE_DEPRECATED_REPLACE_WITH(new_func) +# define CUSPARSE_DEPRECATED +# define CUSPARSE_DEPRECATED_TYPE +# define CUSPARSE_DEPRECATED_TYPE_MSVC + +# endif // defined(__cplusplus) && __cplusplus >= 201402L +//------------------------------------------------------------------------------ + +# if CUSPARSE_CPP_VERSION >= 201703L + +# define CUSPARSE_DEPRECATED_ENUM_REPLACE_WITH(new_enum) \ + [[deprecated("please use " #new_enum " instead")]] + +# define CUSPARSE_DEPRECATED_ENUM \ + [[deprecated("The enum will be removed in the next major release")]] + +# elif defined(__clang__) || \ + (defined(__GNUC__) && __GNUC__ >= 6 && !defined(__PGI)) + +# define CUSPARSE_DEPRECATED_ENUM_REPLACE_WITH(new_enum) \ + __attribute__((deprecated("please use " #new_enum " instead"))) + +# define CUSPARSE_DEPRECATED_ENUM \ + __attribute__((deprecated( \ + "The enum will be removed in the next major release"))) + +# else + +# define CUSPARSE_DEPRECATED_ENUM_REPLACE_WITH(new_enum) +# define CUSPARSE_DEPRECATED_ENUM + +# endif // defined(__cplusplus) && __cplusplus >= 201402L + +#else // defined(DISABLE_CUSPARSE_DEPRECATED) + +# define CUSPARSE_DEPRECATED_REPLACE_WITH(new_func) +# define CUSPARSE_DEPRECATED +# define CUSPARSE_DEPRECATED_TYPE +# define CUSPARSE_DEPRECATED_TYPE_MSVC +# define CUSPARSE_DEPRECATED_ENUM_REPLACE_WITH(new_enum) +# define CUSPARSE_DEPRECATED_ENUM + +#endif // !defined(DISABLE_CUSPARSE_DEPRECATED) + +#undef CUSPARSE_CPP_VERSION + +//------------------------------------------------------------------------------ + +#if defined(__cplusplus) +extern "C" { +#endif // defined(__cplusplus) + +//############################################################################## +//# OPAQUE DATA STRUCTURES +//############################################################################## + +struct cusparseContext; +typedef struct cusparseContext* cusparseHandle_t; + +struct cusparseMatDescr; +typedef struct cusparseMatDescr* cusparseMatDescr_t; + +struct bsrsv2Info; +typedef CUSPARSE_DEPRECATED_TYPE_MSVC +struct bsrsv2Info* bsrsv2Info_t CUSPARSE_DEPRECATED_TYPE; + +struct bsrsm2Info; +typedef CUSPARSE_DEPRECATED_TYPE_MSVC +struct bsrsm2Info* bsrsm2Info_t CUSPARSE_DEPRECATED_TYPE; + +struct csric02Info; +typedef CUSPARSE_DEPRECATED_TYPE_MSVC +struct csric02Info* csric02Info_t CUSPARSE_DEPRECATED_TYPE; + +struct bsric02Info; +typedef CUSPARSE_DEPRECATED_TYPE_MSVC +struct bsric02Info* bsric02Info_t CUSPARSE_DEPRECATED_TYPE; + +struct csrilu02Info; +typedef CUSPARSE_DEPRECATED_TYPE_MSVC +struct csrilu02Info* csrilu02Info_t CUSPARSE_DEPRECATED_TYPE; + +struct bsrilu02Info; +typedef CUSPARSE_DEPRECATED_TYPE_MSVC +struct bsrilu02Info* bsrilu02Info_t CUSPARSE_DEPRECATED_TYPE; + +struct csru2csrInfo; +typedef CUSPARSE_DEPRECATED_TYPE_MSVC +struct csru2csrInfo* csru2csrInfo_t CUSPARSE_DEPRECATED_TYPE; + +struct cusparseColorInfo; +typedef CUSPARSE_DEPRECATED_TYPE_MSVC +struct cusparseColorInfo* cusparseColorInfo_t CUSPARSE_DEPRECATED_TYPE; + +struct pruneInfo; +typedef CUSPARSE_DEPRECATED_TYPE_MSVC +struct pruneInfo* pruneInfo_t CUSPARSE_DEPRECATED_TYPE; + +//############################################################################## +//# ENUMERATORS +//############################################################################## + +typedef enum { + CUSPARSE_STATUS_SUCCESS = 0, + CUSPARSE_STATUS_NOT_INITIALIZED = 1, + CUSPARSE_STATUS_ALLOC_FAILED = 2, + CUSPARSE_STATUS_INVALID_VALUE = 3, + CUSPARSE_STATUS_ARCH_MISMATCH = 4, + CUSPARSE_STATUS_MAPPING_ERROR = 5, + CUSPARSE_STATUS_EXECUTION_FAILED = 6, + CUSPARSE_STATUS_INTERNAL_ERROR = 7, + CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED = 8, + CUSPARSE_STATUS_ZERO_PIVOT = 9, + CUSPARSE_STATUS_NOT_SUPPORTED = 10, + CUSPARSE_STATUS_INSUFFICIENT_RESOURCES = 11 +} cusparseStatus_t; + +typedef enum { + CUSPARSE_POINTER_MODE_HOST = 0, + CUSPARSE_POINTER_MODE_DEVICE = 1 +} cusparsePointerMode_t; + +typedef enum { + CUSPARSE_ACTION_SYMBOLIC = 0, + CUSPARSE_ACTION_NUMERIC = 1 +} cusparseAction_t; + +typedef enum { + CUSPARSE_MATRIX_TYPE_GENERAL = 0, + CUSPARSE_MATRIX_TYPE_SYMMETRIC = 1, + CUSPARSE_MATRIX_TYPE_HERMITIAN = 2, + CUSPARSE_MATRIX_TYPE_TRIANGULAR = 3 +} cusparseMatrixType_t; + +typedef enum { + CUSPARSE_FILL_MODE_LOWER = 0, + CUSPARSE_FILL_MODE_UPPER = 1 +} cusparseFillMode_t; + +typedef enum { + CUSPARSE_DIAG_TYPE_NON_UNIT = 0, + CUSPARSE_DIAG_TYPE_UNIT = 1 +} cusparseDiagType_t; + +typedef enum { + CUSPARSE_INDEX_BASE_ZERO = 0, + CUSPARSE_INDEX_BASE_ONE = 1 +} cusparseIndexBase_t; + +typedef enum { + CUSPARSE_OPERATION_NON_TRANSPOSE = 0, + CUSPARSE_OPERATION_TRANSPOSE = 1, + CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE = 2 +} cusparseOperation_t; + +typedef enum { + CUSPARSE_DIRECTION_ROW = 0, + CUSPARSE_DIRECTION_COLUMN = 1 +} cusparseDirection_t; + +typedef enum { + CUSPARSE_SOLVE_POLICY_NO_LEVEL = 0, + CUSPARSE_SOLVE_POLICY_USE_LEVEL = 1 +} cusparseSolvePolicy_t CUSPARSE_DEPRECATED_TYPE; + +typedef enum { + CUSPARSE_COLOR_ALG0 = 0, // default + CUSPARSE_COLOR_ALG1 = 1 +} cusparseColorAlg_t CUSPARSE_DEPRECATED_TYPE; + +//############################################################################## +//# INITIALIZATION AND MANAGEMENT ROUTINES +//############################################################################## + +cusparseStatus_t CUSPARSEAPI +cusparseCreate(cusparseHandle_t* handle); + +cusparseStatus_t CUSPARSEAPI +cusparseDestroy(cusparseHandle_t handle); + +cusparseStatus_t CUSPARSEAPI +cusparseGetVersion(cusparseHandle_t handle, + int* version); + +cusparseStatus_t CUSPARSEAPI +cusparseGetProperty(libraryPropertyType type, + int* value); + +const char* CUSPARSEAPI +cusparseGetErrorName(cusparseStatus_t status); + +const char* CUSPARSEAPI +cusparseGetErrorString(cusparseStatus_t status); + +cusparseStatus_t CUSPARSEAPI +cusparseSetStream(cusparseHandle_t handle, + cudaStream_t streamId); + +cusparseStatus_t CUSPARSEAPI +cusparseGetStream(cusparseHandle_t handle, + cudaStream_t* streamId); + +cusparseStatus_t CUSPARSEAPI +cusparseGetPointerMode(cusparseHandle_t handle, + cusparsePointerMode_t* mode); + +cusparseStatus_t CUSPARSEAPI +cusparseSetPointerMode(cusparseHandle_t handle, + cusparsePointerMode_t mode); + +//############################################################################## +//# LOGGING APIs +//############################################################################## + +typedef void (*cusparseLoggerCallback_t)(int logLevel, + const char* functionName, + const char* message); + +cusparseStatus_t CUSPARSEAPI +cusparseLoggerSetCallback(cusparseLoggerCallback_t callback); + +cusparseStatus_t CUSPARSEAPI +cusparseLoggerSetFile(FILE* file); + +cusparseStatus_t CUSPARSEAPI +cusparseLoggerOpenFile(const char* logFile); + +cusparseStatus_t CUSPARSEAPI +cusparseLoggerSetLevel(int level); + +cusparseStatus_t CUSPARSEAPI +cusparseLoggerSetMask(int mask); + +cusparseStatus_t CUSPARSEAPI +cusparseLoggerForceDisable(void); + +//############################################################################## +//# HELPER ROUTINES +//############################################################################## + +cusparseStatus_t CUSPARSEAPI +cusparseCreateMatDescr(cusparseMatDescr_t* descrA); + +cusparseStatus_t CUSPARSEAPI +cusparseDestroyMatDescr(cusparseMatDescr_t descrA); + +cusparseStatus_t CUSPARSEAPI +cusparseSetMatType(cusparseMatDescr_t descrA, + cusparseMatrixType_t type); + +cusparseMatrixType_t CUSPARSEAPI +cusparseGetMatType(const cusparseMatDescr_t descrA); + +cusparseStatus_t CUSPARSEAPI +cusparseSetMatFillMode(cusparseMatDescr_t descrA, + cusparseFillMode_t fillMode); + +cusparseFillMode_t CUSPARSEAPI +cusparseGetMatFillMode(const cusparseMatDescr_t descrA); + +cusparseStatus_t CUSPARSEAPI +cusparseSetMatDiagType(cusparseMatDescr_t descrA, + cusparseDiagType_t diagType); + +cusparseDiagType_t CUSPARSEAPI +cusparseGetMatDiagType(const cusparseMatDescr_t descrA); + +cusparseStatus_t CUSPARSEAPI +cusparseSetMatIndexBase(cusparseMatDescr_t descrA, + cusparseIndexBase_t base); + +cusparseIndexBase_t CUSPARSEAPI +cusparseGetMatIndexBase(const cusparseMatDescr_t descrA); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCreateCsric02Info(csric02Info_t* info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDestroyCsric02Info(csric02Info_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCreateBsric02Info(bsric02Info_t* info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDestroyBsric02Info(bsric02Info_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCreateCsrilu02Info(csrilu02Info_t* info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDestroyCsrilu02Info(csrilu02Info_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCreateBsrilu02Info(bsrilu02Info_t* info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDestroyBsrilu02Info(bsrilu02Info_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCreateBsrsv2Info(bsrsv2Info_t* info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDestroyBsrsv2Info(bsrsv2Info_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCreateBsrsm2Info(bsrsm2Info_t* info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDestroyBsrsm2Info(bsrsm2Info_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCreateCsru2csrInfo(csru2csrInfo_t* info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDestroyCsru2csrInfo(csru2csrInfo_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCreateColorInfo(cusparseColorInfo_t* info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDestroyColorInfo(cusparseColorInfo_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCreatePruneInfo(pruneInfo_t* info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDestroyPruneInfo(pruneInfo_t info); + +//############################################################################## +//# SPARSE LEVEL 2 ROUTINES +//############################################################################## + +cusparseStatus_t CUSPARSEAPI +cusparseSgemvi(cusparseHandle_t handle, + cusparseOperation_t transA, + int m, + int n, + const float* alpha, + const float* A, + int lda, + int nnz, + const float* xVal, + const int* xInd, + const float* beta, + float* y, + cusparseIndexBase_t idxBase, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSgemvi_bufferSize(cusparseHandle_t handle, + cusparseOperation_t transA, + int m, + int n, + int nnz, + int* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseDgemvi(cusparseHandle_t handle, + cusparseOperation_t transA, + int m, + int n, + const double* alpha, + const double* A, + int lda, + int nnz, + const double* xVal, + const int* xInd, + const double* beta, + double* y, + cusparseIndexBase_t idxBase, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDgemvi_bufferSize(cusparseHandle_t handle, + cusparseOperation_t transA, + int m, + int n, + int nnz, + int* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseCgemvi(cusparseHandle_t handle, + cusparseOperation_t transA, + int m, + int n, + const cuComplex* alpha, + const cuComplex* A, + int lda, + int nnz, + const cuComplex* xVal, + const int* xInd, + const cuComplex* beta, + cuComplex* y, + cusparseIndexBase_t idxBase, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCgemvi_bufferSize(cusparseHandle_t handle, + cusparseOperation_t transA, + int m, + int n, + int nnz, + int* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseZgemvi(cusparseHandle_t handle, + cusparseOperation_t transA, + int m, + int n, + const cuDoubleComplex* alpha, + const cuDoubleComplex* A, + int lda, + int nnz, + const cuDoubleComplex* xVal, + const int* xInd, + const cuDoubleComplex* beta, + cuDoubleComplex* y, + cusparseIndexBase_t idxBase, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseZgemvi_bufferSize(cusparseHandle_t handle, + cusparseOperation_t transA, + int m, + int n, + int nnz, + int* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSbsrmv(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nb, + int nnzb, + const float* alpha, + const cusparseMatDescr_t descrA, + const float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + const float* x, + const float* beta, + float* y); + +cusparseStatus_t CUSPARSEAPI +cusparseDbsrmv(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nb, + int nnzb, + const double* alpha, + const cusparseMatDescr_t descrA, + const double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + const double* x, + const double* beta, + double* y); + +cusparseStatus_t CUSPARSEAPI +cusparseCbsrmv(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nb, + int nnzb, + const cuComplex* alpha, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + const cuComplex* x, + const cuComplex* beta, + cuComplex* y); + +cusparseStatus_t CUSPARSEAPI +cusparseZbsrmv(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nb, + int nnzb, + const cuDoubleComplex* alpha, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + const cuDoubleComplex* x, + const cuDoubleComplex* beta, + cuDoubleComplex* y); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrxmv(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int sizeOfMask, + int mb, + int nb, + int nnzb, + const float* alpha, + const cusparseMatDescr_t descrA, + const float* bsrSortedValA, + const int* bsrSortedMaskPtrA, + const int* bsrSortedRowPtrA, + const int* bsrSortedEndPtrA, + const int* bsrSortedColIndA, + int blockDim, + const float* x, + const float* beta, + float* y); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrxmv(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int sizeOfMask, + int mb, + int nb, + int nnzb, + const double* alpha, + const cusparseMatDescr_t descrA, + const double* bsrSortedValA, + const int* bsrSortedMaskPtrA, + const int* bsrSortedRowPtrA, + const int* bsrSortedEndPtrA, + const int* bsrSortedColIndA, + int blockDim, + const double* x, + const double* beta, + double* y); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrxmv(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int sizeOfMask, + int mb, + int nb, + int nnzb, + const cuComplex* alpha, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedValA, + const int* bsrSortedMaskPtrA, + const int* bsrSortedRowPtrA, + const int* bsrSortedEndPtrA, + const int* bsrSortedColIndA, + int blockDim, + const cuComplex* x, + const cuComplex* beta, + cuComplex* y); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrxmv(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int sizeOfMask, + int mb, + int nb, + int nnzb, + const cuDoubleComplex* alpha, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedValA, + const int* bsrSortedMaskPtrA, + const int* bsrSortedRowPtrA, + const int* bsrSortedEndPtrA, + const int* bsrSortedColIndA, + int blockDim, + const cuDoubleComplex* x, + const cuDoubleComplex* beta, + cuDoubleComplex* y); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseXbsrsv2_zeroPivot(cusparseHandle_t handle, + bsrsv2Info_t info, + int* position); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrsv2_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrsv2_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrsv2_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrsv2_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrsv2_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockSize, + bsrsv2Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrsv2_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockSize, + bsrsv2Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrsv2_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockSize, + bsrsv2Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrsv2_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockSize, + bsrsv2Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrsv2_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrsv2_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrsv2_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrsv2_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrsv2_solve(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const float* alpha, + const cusparseMatDescr_t descrA, + const float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + const float* f, + float* x, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrsv2_solve(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const double* alpha, + const cusparseMatDescr_t descrA, + const double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + const double* f, + double* x, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrsv2_solve(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cuComplex* alpha, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + const cuComplex* f, + cuComplex* x, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrsv2_solve(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + int mb, + int nnzb, + const cuDoubleComplex* alpha, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + bsrsv2Info_t info, + const cuDoubleComplex* f, + cuDoubleComplex* x, + cusparseSolvePolicy_t policy, + void* pBuffer); + +//############################################################################## +//# SPARSE LEVEL 3 ROUTINES +//############################################################################## + +cusparseStatus_t CUSPARSEAPI +cusparseSbsrmm(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transB, + int mb, + int n, + int kb, + int nnzb, + const float* alpha, + const cusparseMatDescr_t descrA, + const float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + const int blockSize, + const float* B, + const int ldb, + const float* beta, + float* C, + int ldc); + +cusparseStatus_t CUSPARSEAPI +cusparseDbsrmm(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transB, + int mb, + int n, + int kb, + int nnzb, + const double* alpha, + const cusparseMatDescr_t descrA, + const double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + const int blockSize, + const double* B, + const int ldb, + const double* beta, + double* C, + int ldc); + +cusparseStatus_t CUSPARSEAPI +cusparseCbsrmm(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transB, + int mb, + int n, + int kb, + int nnzb, + const cuComplex* alpha, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + const int blockSize, + const cuComplex* B, + const int ldb, + const cuComplex* beta, + cuComplex* C, + int ldc); + +cusparseStatus_t CUSPARSEAPI +cusparseZbsrmm(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transB, + int mb, + int n, + int kb, + int nnzb, + const cuDoubleComplex* alpha, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + const int blockSize, + const cuDoubleComplex* B, + const int ldb, + const cuDoubleComplex* beta, + cuDoubleComplex* C, + int ldc); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseXbsrsm2_zeroPivot(cusparseHandle_t handle, + bsrsm2Info_t info, + int* position); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrsm2_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrsm2_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrsm2_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrsm2_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrsm2_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transB, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrsm2_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transB, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrsm2_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transB, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrsm2_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transB, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrsm2_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + const float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrsm2_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + const double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrsm2_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrsm2_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrsm2_solve(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const float* alpha, + const cusparseMatDescr_t descrA, + const float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + const float* B, + int ldb, + float* X, + int ldx, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrsm2_solve(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const double* alpha, + const cusparseMatDescr_t descrA, + const double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + const double* B, + int ldb, + double* X, + int ldx, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrsm2_solve(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const cuComplex* alpha, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + const cuComplex* B, + int ldb, + cuComplex* X, + int ldx, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrsm2_solve(cusparseHandle_t handle, + cusparseDirection_t dirA, + cusparseOperation_t transA, + cusparseOperation_t transXY, + int mb, + int n, + int nnzb, + const cuDoubleComplex* alpha, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrsm2Info_t info, + const cuDoubleComplex* B, + int ldb, + cuDoubleComplex* X, + int ldx, + cusparseSolvePolicy_t policy, + void* pBuffer); + +//############################################################################## +//# PRECONDITIONERS +//############################################################################## + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsrilu02_numericBoost(cusparseHandle_t handle, + csrilu02Info_t info, + int enable_boost, + double* tol, + float* boost_val); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsrilu02_numericBoost(cusparseHandle_t handle, + csrilu02Info_t info, + int enable_boost, + double* tol, + double* boost_val); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsrilu02_numericBoost(cusparseHandle_t handle, + csrilu02Info_t info, + int enable_boost, + double* tol, + cuComplex* boost_val); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsrilu02_numericBoost(cusparseHandle_t handle, + csrilu02Info_t info, + int enable_boost, + double* tol, + cuDoubleComplex* boost_val); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseXcsrilu02_zeroPivot(cusparseHandle_t handle, + csrilu02Info_t info, + int* position); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsrilu02_bufferSize(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsrilu02_bufferSize(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsrilu02_bufferSize(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsrilu02_bufferSize(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsrilu02_bufferSizeExt(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + float* csrSortedVal, + const int* csrSortedRowPtr, + const int* csrSortedColInd, + csrilu02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsrilu02_bufferSizeExt(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + double* csrSortedVal, + const int* csrSortedRowPtr, + const int* csrSortedColInd, + csrilu02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsrilu02_bufferSizeExt(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuComplex* csrSortedVal, + const int* csrSortedRowPtr, + const int* csrSortedColInd, + csrilu02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsrilu02_bufferSizeExt(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuDoubleComplex* csrSortedVal, + const int* csrSortedRowPtr, + const int* csrSortedColInd, + csrilu02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsrilu02_analysis(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsrilu02_analysis(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsrilu02_analysis(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsrilu02_analysis(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsrilu02(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + float* csrSortedValA_valM, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsrilu02(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + double* csrSortedValA_valM, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsrilu02(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuComplex* csrSortedValA_valM, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsrilu02(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuDoubleComplex* csrSortedValA_valM, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrilu02_numericBoost(cusparseHandle_t handle, + bsrilu02Info_t info, + int enable_boost, + double* tol, + float* boost_val); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrilu02_numericBoost(cusparseHandle_t handle, + bsrilu02Info_t info, + int enable_boost, + double* tol, + double* boost_val); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrilu02_numericBoost(cusparseHandle_t handle, + bsrilu02Info_t info, + int enable_boost, + double* tol, + cuComplex* boost_val); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrilu02_numericBoost(cusparseHandle_t handle, + bsrilu02Info_t info, + int enable_boost, + double* tol, + cuDoubleComplex* boost_val); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseXbsrilu02_zeroPivot(cusparseHandle_t handle, + bsrilu02Info_t info, + int* position); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrilu02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrilu02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrilu02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrilu02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrilu02_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrilu02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrilu02_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrilu02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrilu02_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrilu02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrilu02_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsrilu02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrilu02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrilu02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrilu02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrilu02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsrilu02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsrilu02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsrilu02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsrilu02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseXcsric02_zeroPivot(cusparseHandle_t handle, + csric02Info_t info, + int* position); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsric02_bufferSize(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsric02_bufferSize(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsric02_bufferSize(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsric02_bufferSize(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsric02_bufferSizeExt(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + float* csrSortedVal, + const int* csrSortedRowPtr, + const int* csrSortedColInd, + csric02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsric02_bufferSizeExt(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + double* csrSortedVal, + const int* csrSortedRowPtr, + const int* csrSortedColInd, + csric02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsric02_bufferSizeExt(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuComplex* csrSortedVal, + const int* csrSortedRowPtr, + const int* csrSortedColInd, + csric02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsric02_bufferSizeExt(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuDoubleComplex* csrSortedVal, + const int* csrSortedRowPtr, + const int* csrSortedColInd, + csric02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsric02_analysis(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsric02_analysis(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsric02_analysis(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsric02_analysis(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsric02(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + float* csrSortedValA_valM, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsric02(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + double* csrSortedValA_valM, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsric02(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuComplex* csrSortedValA_valM, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsric02(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + cuDoubleComplex* csrSortedValA_valM, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + csric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseXbsric02_zeroPivot(cusparseHandle_t handle, + bsric02Info_t info, + int* position); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsric02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsric02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsric02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsric02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + int* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsric02_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsric02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsric02_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsric02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsric02_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsric02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsric02_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockSize, + bsric02Info_t info, + size_t* pBufferSize); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsric02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pInputBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsric02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pInputBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsric02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pInputBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsric02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pInputBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSbsric02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDbsric02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCbsric02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* + bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZbsric02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSgtsv2_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const float* dl, + const float* d, + const float* du, + const float* B, + int ldb, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseDgtsv2_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const double* dl, + const double* d, + const double* du, + const double* B, + int ldb, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseCgtsv2_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const cuComplex* dl, + const cuComplex* d, + const cuComplex* du, + const cuComplex* B, + int ldb, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseZgtsv2_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const cuDoubleComplex* dl, + const cuDoubleComplex* d, + const cuDoubleComplex* du, + const cuDoubleComplex* B, + int ldb, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseSgtsv2(cusparseHandle_t handle, + int m, + int n, + const float* dl, + const float* d, + const float* du, + float* B, + int ldb, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDgtsv2(cusparseHandle_t handle, + int m, + int n, + const double* dl, + const double* d, + const double* du, + double* B, + int ldb, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCgtsv2(cusparseHandle_t handle, + int m, + int n, + const cuComplex* dl, + const cuComplex* d, + const cuComplex* du, + cuComplex* B, + int ldb, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseZgtsv2(cusparseHandle_t handle, + int m, + int n, + const cuDoubleComplex* dl, + const cuDoubleComplex* d, + const cuDoubleComplex* du, + cuDoubleComplex* B, + int ldb, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSgtsv2_nopivot_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const float* dl, + const float* d, + const float* du, + const float* B, + int ldb, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseDgtsv2_nopivot_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const double* dl, + const double* d, + const double* du, + const double* B, + int ldb, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseCgtsv2_nopivot_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const cuComplex* dl, + const cuComplex* d, + const cuComplex* du, + const cuComplex* B, + int ldb, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseZgtsv2_nopivot_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const cuDoubleComplex* dl, + const cuDoubleComplex* d, + const cuDoubleComplex* du, + const cuDoubleComplex* B, + int ldb, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseSgtsv2_nopivot(cusparseHandle_t handle, + int m, + int n, + const float* dl, + const float* d, + const float* du, + float* B, + int ldb, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDgtsv2_nopivot(cusparseHandle_t handle, + int m, + int n, + const double* dl, + const double* d, + const double* du, + double* B, + int ldb, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCgtsv2_nopivot(cusparseHandle_t handle, + int m, + int n, + const cuComplex* dl, + const cuComplex* d, + const cuComplex* du, + cuComplex* B, + int ldb, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseZgtsv2_nopivot(cusparseHandle_t handle, + int m, + int n, + const cuDoubleComplex* dl, + const cuDoubleComplex* d, + const cuDoubleComplex* du, + cuDoubleComplex* B, + int ldb, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSgtsv2StridedBatch_bufferSizeExt(cusparseHandle_t handle, + int m, + const float* dl, + const float* d, + const float* du, + const float* x, + int batchCount, + int batchStride, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseDgtsv2StridedBatch_bufferSizeExt(cusparseHandle_t handle, + int m, + const double* dl, + const double* d, + const double* du, + const double* x, + int batchCount, + int batchStride, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseCgtsv2StridedBatch_bufferSizeExt(cusparseHandle_t handle, + int m, + const cuComplex* dl, + const cuComplex* d, + const cuComplex* du, + const cuComplex* x, + int batchCount, + int batchStride, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseZgtsv2StridedBatch_bufferSizeExt(cusparseHandle_t handle, + int m, + const cuDoubleComplex* dl, + const cuDoubleComplex* d, + const cuDoubleComplex* du, + const cuDoubleComplex* x, + int batchCount, + int batchStride, + size_t* bufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseSgtsv2StridedBatch(cusparseHandle_t handle, + int m, + const float* dl, + const float* d, + const float* du, + float* x, + int batchCount, + int batchStride, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDgtsv2StridedBatch(cusparseHandle_t handle, + int m, + const double* dl, + const double* d, + const double* du, + double* x, + int batchCount, + int batchStride, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCgtsv2StridedBatch(cusparseHandle_t handle, + int m, + const cuComplex* dl, + const cuComplex* d, + const cuComplex* du, + cuComplex* x, + int batchCount, + int batchStride, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseZgtsv2StridedBatch(cusparseHandle_t handle, + int m, + const cuDoubleComplex* dl, + const cuDoubleComplex* d, + const cuDoubleComplex* du, + cuDoubleComplex* x, + int batchCount, + int batchStride, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSgtsvInterleavedBatch_bufferSizeExt(cusparseHandle_t handle, + int algo, + int m, + const float* dl, + const float* d, + const float* du, + const float* x, + int batchCount, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseDgtsvInterleavedBatch_bufferSizeExt(cusparseHandle_t handle, + int algo, + int m, + const double* dl, + const double* d, + const double* du, + const double* x, + int batchCount, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseCgtsvInterleavedBatch_bufferSizeExt(cusparseHandle_t handle, + int algo, + int m, + const cuComplex* dl, + const cuComplex* d, + const cuComplex* du, + const cuComplex* x, + int batchCount, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseZgtsvInterleavedBatch_bufferSizeExt(cusparseHandle_t handle, + int algo, + int m, + const cuDoubleComplex* dl, + const cuDoubleComplex* d, + const cuDoubleComplex* du, + const cuDoubleComplex* x, + int batchCount, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseSgtsvInterleavedBatch(cusparseHandle_t handle, + int algo, + int m, + float* dl, + float* d, + float* du, + float* x, + int batchCount, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDgtsvInterleavedBatch(cusparseHandle_t handle, + int algo, + int m, + double* dl, + double* d, + double* du, + double* x, + int batchCount, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCgtsvInterleavedBatch(cusparseHandle_t handle, + int algo, + int m, + cuComplex* dl, + cuComplex* d, + cuComplex* du, + cuComplex* x, + int batchCount, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseZgtsvInterleavedBatch(cusparseHandle_t handle, + int algo, + int m, + cuDoubleComplex* dl, + cuDoubleComplex* d, + cuDoubleComplex* du, + cuDoubleComplex* x, + int batchCount, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSgpsvInterleavedBatch_bufferSizeExt(cusparseHandle_t handle, + int algo, + int m, + const float* ds, + const float* dl, + const float* d, + const float* du, + const float* dw, + const float* x, + int batchCount, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseDgpsvInterleavedBatch_bufferSizeExt(cusparseHandle_t handle, + int algo, + int m, + const double* ds, + const double* dl, + const double* d, + const double* du, + const double* dw, + const double* x, + int batchCount, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseCgpsvInterleavedBatch_bufferSizeExt(cusparseHandle_t handle, + int algo, + int m, + const cuComplex* ds, + const cuComplex* dl, + const cuComplex* d, + const cuComplex* du, + const cuComplex* dw, + const cuComplex* x, + int batchCount, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseZgpsvInterleavedBatch_bufferSizeExt(cusparseHandle_t handle, + int algo, + int m, + const cuDoubleComplex* ds, + const cuDoubleComplex* dl, + const cuDoubleComplex* d, + const cuDoubleComplex* du, + const cuDoubleComplex* dw, + const cuDoubleComplex* x, + int batchCount, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseSgpsvInterleavedBatch(cusparseHandle_t handle, + int algo, + int m, + float* ds, + float* dl, + float* d, + float* du, + float* dw, + float* x, + int batchCount, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDgpsvInterleavedBatch(cusparseHandle_t handle, + int algo, + int m, + double* ds, + double* dl, + double* d, + double* du, + double* dw, + double* x, + int batchCount, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCgpsvInterleavedBatch(cusparseHandle_t handle, + int algo, + int m, + cuComplex* ds, + cuComplex* dl, + cuComplex* d, + cuComplex* du, + cuComplex* dw, + cuComplex* x, + int batchCount, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseZgpsvInterleavedBatch(cusparseHandle_t handle, + int algo, + int m, + cuDoubleComplex* ds, + cuDoubleComplex* dl, + cuDoubleComplex* d, + cuDoubleComplex* du, + cuDoubleComplex* dw, + cuDoubleComplex* x, + int batchCount, + void* pBuffer); + +//############################################################################## +//# EXTRA ROUTINES +//############################################################################## + +cusparseStatus_t CUSPARSEAPI +cusparseScsrgeam2_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const float* alpha, + const cusparseMatDescr_t descrA, + int nnzA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const float* beta, + const cusparseMatDescr_t descrB, + int nnzB, + const float* csrSortedValB, + const int* csrSortedRowPtrB, + const int* csrSortedColIndB, + const cusparseMatDescr_t descrC, + const float* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseDcsrgeam2_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const double* alpha, + const cusparseMatDescr_t descrA, + int nnzA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const double* beta, + const cusparseMatDescr_t descrB, + int nnzB, + const double* csrSortedValB, + const int* csrSortedRowPtrB, + const int* csrSortedColIndB, + const cusparseMatDescr_t descrC, + const double* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseCcsrgeam2_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const cuComplex* alpha, + const cusparseMatDescr_t descrA, + int nnzA, + const cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const cuComplex* beta, + const cusparseMatDescr_t descrB, + int nnzB, + const cuComplex* csrSortedValB, + const int* csrSortedRowPtrB, + const int* csrSortedColIndB, + const cusparseMatDescr_t descrC, + const cuComplex* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseZcsrgeam2_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const cuDoubleComplex* alpha, + const cusparseMatDescr_t descrA, + int nnzA, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const cuDoubleComplex* beta, + const cusparseMatDescr_t descrB, + int nnzB, + const cuDoubleComplex* csrSortedValB, + const int* csrSortedRowPtrB, + const int* csrSortedColIndB, + const cusparseMatDescr_t descrC, + const cuDoubleComplex* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseXcsrgeam2Nnz(cusparseHandle_t handle, + int m, + int n, + const cusparseMatDescr_t descrA, + int nnzA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const cusparseMatDescr_t descrB, + int nnzB, + const int* csrSortedRowPtrB, + const int* csrSortedColIndB, + const cusparseMatDescr_t descrC, + int* csrSortedRowPtrC, + int* nnzTotalDevHostPtr, + void* workspace); + +cusparseStatus_t CUSPARSEAPI +cusparseScsrgeam2(cusparseHandle_t handle, + int m, + int n, + const float* alpha, + const cusparseMatDescr_t descrA, + int nnzA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const float* beta, + const cusparseMatDescr_t descrB, + int nnzB, + const float* csrSortedValB, + const int* csrSortedRowPtrB, + const int* csrSortedColIndB, + const cusparseMatDescr_t descrC, + float* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDcsrgeam2(cusparseHandle_t handle, + int m, + int n, + const double* alpha, + const cusparseMatDescr_t descrA, + int nnzA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const double* beta, + const cusparseMatDescr_t descrB, + int nnzB, + const double* csrSortedValB, + const int* csrSortedRowPtrB, + const int* csrSortedColIndB, + const cusparseMatDescr_t descrC, + double* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCcsrgeam2(cusparseHandle_t handle, + int m, + int n, + const cuComplex* alpha, + const cusparseMatDescr_t descrA, + int nnzA, + const cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const cuComplex* beta, + const cusparseMatDescr_t descrB, + int nnzB, + const cuComplex* csrSortedValB, + const int* csrSortedRowPtrB, + const int* csrSortedColIndB, + const cusparseMatDescr_t descrC, + cuComplex* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseZcsrgeam2(cusparseHandle_t handle, + int m, + int n, + const cuDoubleComplex* alpha, + const cusparseMatDescr_t descrA, + int nnzA, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const cuDoubleComplex* beta, + const cusparseMatDescr_t descrB, + int nnzB, + const cuDoubleComplex* csrSortedValB, + const int* csrSortedRowPtrB, + const int* csrSortedColIndB, + const cusparseMatDescr_t descrC, + cuDoubleComplex* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC, + void* pBuffer); + +//############################################################################## +//# SPARSE MATRIX REORDERING +//############################################################################## + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsrcolor(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const float* fractionToColor, + int* ncolors, + int* coloring, + int* reordering, + const cusparseColorInfo_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsrcolor(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const double* fractionToColor, + int* ncolors, + int* coloring, + int* reordering, + const cusparseColorInfo_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsrcolor(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const float* fractionToColor, + int* ncolors, + int* coloring, + int* reordering, + const cusparseColorInfo_t info); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsrcolor(cusparseHandle_t handle, + int m, + int nnz, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const double* fractionToColor, + int* ncolors, + int* coloring, + int* reordering, + const cusparseColorInfo_t info); + +//############################################################################## +//# SPARSE FORMAT CONVERSION +//############################################################################## + +cusparseStatus_t CUSPARSEAPI +cusparseSnnz(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const float* A, + int lda, + int* nnzPerRowCol, + int* nnzTotalDevHostPtr); + +cusparseStatus_t CUSPARSEAPI +cusparseDnnz(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const double* A, + int lda, + int* nnzPerRowCol, + int* nnzTotalDevHostPtr); + +cusparseStatus_t CUSPARSEAPI +cusparseCnnz(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuComplex* A, + int lda, + int* nnzPerRowCol, + int* nnzTotalDevHostPtr); + +cusparseStatus_t CUSPARSEAPI +cusparseZnnz(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* A, + int lda, + int* nnzPerRowCol, + int* nnzTotalDevHostPtr); + +//############################################################################## +//# SPARSE FORMAT CONVERSION +//############################################################################## + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSnnz_compress(cusparseHandle_t handle, + int m, + const cusparseMatDescr_t descr, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + int* nnzPerRow, + int* nnzC, + float tol); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDnnz_compress(cusparseHandle_t handle, + int m, + const cusparseMatDescr_t descr, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + int* nnzPerRow, + int* nnzC, + double tol); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCnnz_compress(cusparseHandle_t handle, + int m, + const cusparseMatDescr_t descr, + const cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + int* nnzPerRow, + int* nnzC, + cuComplex tol); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZnnz_compress(cusparseHandle_t handle, + int m, + const cusparseMatDescr_t descr, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + int* nnzPerRow, + int* nnzC, + cuDoubleComplex tol); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsr2csr_compress(cusparseHandle_t handle, + int m, + int n, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedColIndA, + const int* csrSortedRowPtrA, + int nnzA, + const int* nnzPerRow, + float* csrSortedValC, + int* csrSortedColIndC, + int* csrSortedRowPtrC, + float tol); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsr2csr_compress(cusparseHandle_t handle, + int m, + int n, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedColIndA, + const int* csrSortedRowPtrA, + int nnzA, + const int* nnzPerRow, + double* csrSortedValC, + int* csrSortedColIndC, + int* csrSortedRowPtrC, + double tol); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsr2csr_compress(cusparseHandle_t handle, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuComplex* csrSortedValA, + const int* csrSortedColIndA, + const int* csrSortedRowPtrA, + int nnzA, + const int* nnzPerRow, + cuComplex* csrSortedValC, + int* csrSortedColIndC, + int* csrSortedRowPtrC, + cuComplex tol); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsr2csr_compress(cusparseHandle_t handle, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedColIndA, + const int* csrSortedRowPtrA, + int nnzA, + const int* nnzPerRow, + cuDoubleComplex* csrSortedValC, + int* csrSortedColIndC, + int* csrSortedRowPtrC, + cuDoubleComplex tol); + +cusparseStatus_t CUSPARSEAPI +cusparseXcoo2csr(cusparseHandle_t handle, + const int* cooRowInd, + int nnz, + int m, + int* csrSortedRowPtr, + cusparseIndexBase_t idxBase); + +cusparseStatus_t CUSPARSEAPI +cusparseXcsr2coo(cusparseHandle_t handle, + const int* csrSortedRowPtr, + int nnz, + int m, + int* cooRowInd, + cusparseIndexBase_t idxBase); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseXcsr2bsrNnz(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int blockDim, + const cusparseMatDescr_t descrC, + int* bsrSortedRowPtrC, + int* nnzTotalDevHostPtr); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsr2bsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int blockDim, + const cusparseMatDescr_t descrC, + float* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsr2bsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int blockDim, + const cusparseMatDescr_t descrC, + double* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsr2bsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int blockDim, + const cusparseMatDescr_t descrC, + cuComplex* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsr2bsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int blockDim, + const cusparseMatDescr_t descrC, + cuDoubleComplex* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC); + +cusparseStatus_t CUSPARSEAPI +cusparseSbsr2csr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + const cusparseMatDescr_t descrA, + const float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + const cusparseMatDescr_t descrC, + float* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC); + +cusparseStatus_t CUSPARSEAPI +cusparseDbsr2csr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + const cusparseMatDescr_t descrA, + const double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + const cusparseMatDescr_t descrC, + double* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC); + +cusparseStatus_t CUSPARSEAPI +cusparseCbsr2csr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + const cusparseMatDescr_t descrC, + cuComplex* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC); + +cusparseStatus_t CUSPARSEAPI +cusparseZbsr2csr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int blockDim, + const cusparseMatDescr_t descrC, + cuDoubleComplex* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC); + +cusparseStatus_t CUSPARSEAPI +cusparseSgebsr2gebsc_bufferSize(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseDgebsr2gebsc_bufferSize(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseCgebsr2gebsc_bufferSize(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseZgebsr2gebsc_bufferSize(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseSgebsr2gebsc_bufferSizeExt(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseDgebsr2gebsc_bufferSizeExt(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseCgebsr2gebsc_bufferSizeExt(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseZgebsr2gebsc_bufferSizeExt(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSgebsr2gebsc(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + float* bscVal, + int* bscRowInd, + int* bscColPtr, + cusparseAction_t copyValues, + cusparseIndexBase_t idxBase, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDgebsr2gebsc(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + double* bscVal, + int* bscRowInd, + int* bscColPtr, + cusparseAction_t copyValues, + cusparseIndexBase_t idxBase, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCgebsr2gebsc(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + cuComplex* bscVal, + int* bscRowInd, + int* bscColPtr, + cusparseAction_t copyValues, + cusparseIndexBase_t idxBase, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseZgebsr2gebsc(cusparseHandle_t handle, + int mb, + int nb, + int nnzb, + const cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int rowBlockDim, + int colBlockDim, + cuDoubleComplex* bscVal, + int* bscRowInd, + int* bscColPtr, + cusparseAction_t copyValues, + cusparseIndexBase_t idxBase, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseXgebsr2csr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + const cusparseMatDescr_t descrA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDim, + int colBlockDim, + const cusparseMatDescr_t descrC, + int* csrSortedRowPtrC, + int* csrSortedColIndC); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSgebsr2csr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + const cusparseMatDescr_t descrA, + const float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDim, + int colBlockDim, + const cusparseMatDescr_t descrC, + float* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDgebsr2csr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + const cusparseMatDescr_t descrA, + const double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDim, + int colBlockDim, + const cusparseMatDescr_t descrC, + double* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCgebsr2csr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDim, + int colBlockDim, + const cusparseMatDescr_t descrC, + cuComplex* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZgebsr2csr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDim, + int colBlockDim, + const cusparseMatDescr_t descrC, + cuDoubleComplex* csrSortedValC, + int* csrSortedRowPtrC, + int* csrSortedColIndC); + +cusparseStatus_t CUSPARSEAPI +cusparseScsr2gebsr_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int rowBlockDim, + int colBlockDim, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseDcsr2gebsr_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int rowBlockDim, + int colBlockDim, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseCcsr2gebsr_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int rowBlockDim, + int colBlockDim, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseZcsr2gebsr_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int rowBlockDim, + int colBlockDim, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseScsr2gebsr_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int rowBlockDim, + int colBlockDim, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseDcsr2gebsr_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int rowBlockDim, + int colBlockDim, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseCcsr2gebsr_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int rowBlockDim, + int colBlockDim, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseZcsr2gebsr_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + int rowBlockDim, + int colBlockDim, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseXcsr2gebsrNnz(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const cusparseMatDescr_t descrC, + int* bsrSortedRowPtrC, + int rowBlockDim, + int colBlockDim, + int* nnzTotalDevHostPtr, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseScsr2gebsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const cusparseMatDescr_t descrC, + float* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC, + int rowBlockDim, + int colBlockDim, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDcsr2gebsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const cusparseMatDescr_t descrC, + double* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC, + int rowBlockDim, + int colBlockDim, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCcsr2gebsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const cusparseMatDescr_t descrC, + cuComplex* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC, + int rowBlockDim, + int colBlockDim, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseZcsr2gebsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int m, + int n, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const cusparseMatDescr_t descrC, + cuDoubleComplex* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC, + int rowBlockDim, + int colBlockDim, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSgebsr2gebsr_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + int rowBlockDimC, + int colBlockDimC, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseDgebsr2gebsr_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + int rowBlockDimC, + int colBlockDimC, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseCgebsr2gebsr_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + int rowBlockDimC, + int colBlockDimC, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseZgebsr2gebsr_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + int rowBlockDimC, + int colBlockDimC, + int* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseSgebsr2gebsr_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + int rowBlockDimC, + int colBlockDimC, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseDgebsr2gebsr_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + int rowBlockDimC, + int colBlockDimC, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseCgebsr2gebsr_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + int rowBlockDimC, + int colBlockDimC, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseZgebsr2gebsr_bufferSizeExt(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + int rowBlockDimC, + int colBlockDimC, + size_t* pBufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseXgebsr2gebsrNnz(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + const cusparseMatDescr_t descrC, + int* bsrSortedRowPtrC, + int rowBlockDimC, + int colBlockDimC, + int* nnzTotalDevHostPtr, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSgebsr2gebsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const float* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + const cusparseMatDescr_t descrC, + float* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC, + int rowBlockDimC, + int colBlockDimC, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDgebsr2gebsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const double* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + const cusparseMatDescr_t descrC, + double* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC, + int rowBlockDimC, + int colBlockDimC, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCgebsr2gebsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + const cusparseMatDescr_t descrC, + cuComplex* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC, + int rowBlockDimC, + int colBlockDimC, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseZgebsr2gebsr(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedValA, + const int* bsrSortedRowPtrA, + const int* bsrSortedColIndA, + int rowBlockDimA, + int colBlockDimA, + const cusparseMatDescr_t descrC, + cuDoubleComplex* bsrSortedValC, + int* bsrSortedRowPtrC, + int* bsrSortedColIndC, + int rowBlockDimC, + int colBlockDimC, + void* pBuffer); + +//############################################################################## +//# SPARSE MATRIX SORTING +//############################################################################## + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCreateIdentityPermutation(cusparseHandle_t handle, + int n, + int* p); + +cusparseStatus_t CUSPARSEAPI +cusparseXcoosort_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + int nnz, + const int* cooRowsA, + const int* cooColsA, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseXcoosortByRow(cusparseHandle_t handle, + int m, + int n, + int nnz, + int* cooRowsA, + int* cooColsA, + int* P, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseXcoosortByColumn(cusparseHandle_t handle, + int m, + int n, + int nnz, + int* cooRowsA, + int* cooColsA, + int* P, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseXcsrsort_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + int nnz, + const int* csrRowPtrA, + const int* csrColIndA, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseXcsrsort(cusparseHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const int* csrRowPtrA, + int* csrColIndA, + int* P, + void* pBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseXcscsort_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + int nnz, + const int* cscColPtrA, + const int* cscRowIndA, + size_t* pBufferSizeInBytes); + +cusparseStatus_t CUSPARSEAPI +cusparseXcscsort(cusparseHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + const int* cscColPtrA, + int* cscRowIndA, + int* P, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsru2csr_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + int nnz, + float* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + size_t* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsru2csr_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + int nnz, + double* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + size_t* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsru2csr_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + int nnz, + cuComplex* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + size_t* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsru2csr_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + int nnz, + cuDoubleComplex* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + size_t* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsru2csr(cusparseHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + float* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsru2csr(cusparseHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + double* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsru2csr(cusparseHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + cuComplex* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsru2csr(cusparseHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + cuDoubleComplex* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseScsr2csru(cusparseHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + float* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDcsr2csru(cusparseHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + double* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseCcsr2csru(cusparseHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + cuComplex* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseZcsr2csru(cusparseHandle_t handle, + int m, + int n, + int nnz, + const cusparseMatDescr_t descrA, + cuDoubleComplex* csrVal, + const int* csrRowPtr, + int* csrColInd, + csru2csrInfo_t info, + void* pBuffer); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneDense2csr_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const __half* A, + int lda, + const __half* threshold, + const cusparseMatDescr_t descrC, + const __half* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + size_t* pBufferSizeInBytes); +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneDense2csr_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const float* A, + int lda, + const float* threshold, + const cusparseMatDescr_t descrC, + const float* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + size_t* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneDense2csr_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + const double* A, + int lda, + const double* threshold, + const cusparseMatDescr_t descrC, + const double* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + size_t* pBufferSizeInBytes); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneDense2csrNnz(cusparseHandle_t handle, + int m, + int n, + const __half* A, + int lda, + const __half* threshold, + const cusparseMatDescr_t descrC, + int* csrRowPtrC, + int* nnzTotalDevHostPtr, + void* pBuffer); +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneDense2csrNnz(cusparseHandle_t handle, + int m, + int n, + const float* A, + int lda, + const float* threshold, + const cusparseMatDescr_t descrC, + int* csrRowPtrC, + int* nnzTotalDevHostPtr, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneDense2csrNnz(cusparseHandle_t handle, + int m, + int n, + const double* A, + int lda, + const double* threshold, + const cusparseMatDescr_t descrC, + int* csrSortedRowPtrC, + int* nnzTotalDevHostPtr, + void* pBuffer); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneDense2csr(cusparseHandle_t handle, + int m, + int n, + const __half* A, + int lda, + const __half* threshold, + const cusparseMatDescr_t descrC, + __half* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + void* pBuffer); +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneDense2csr(cusparseHandle_t handle, + int m, + int n, + const float* A, + int lda, + const float* threshold, + const cusparseMatDescr_t descrC, + float* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneDense2csr(cusparseHandle_t handle, + int m, + int n, + const double* A, + int lda, + const double* threshold, + const cusparseMatDescr_t descrC, + double* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + void* pBuffer); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneCsr2csr_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const __half* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const __half* threshold, + const cusparseMatDescr_t descrC, + const __half* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + size_t* pBufferSizeInBytes); +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneCsr2csr_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const float* threshold, + const cusparseMatDescr_t descrC, + const float* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + size_t* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneCsr2csr_bufferSizeExt(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const double* threshold, + const cusparseMatDescr_t descrC, + const double* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + size_t* pBufferSizeInBytes); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneCsr2csrNnz(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const __half* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const __half* threshold, + const cusparseMatDescr_t descrC, + int* csrSortedRowPtrC, + int* nnzTotalDevHostPtr, + void* pBuffer); +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneCsr2csrNnz(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const float* threshold, + const cusparseMatDescr_t descrC, + int* csrSortedRowPtrC, + int* nnzTotalDevHostPtr, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneCsr2csrNnz(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const double* threshold, + const cusparseMatDescr_t descrC, + int* csrSortedRowPtrC, + int* nnzTotalDevHostPtr, + void* pBuffer); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneCsr2csr(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const __half* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const __half* threshold, + const cusparseMatDescr_t descrC, + __half* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + void* pBuffer); +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneCsr2csr(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const float* threshold, + const cusparseMatDescr_t descrC, + float* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneCsr2csr(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + const double* threshold, + const cusparseMatDescr_t descrC, + double* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + void* pBuffer); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneDense2csrByPercentage_bufferSizeExt( + cusparseHandle_t handle, + int m, + int n, + const __half* A, + int lda, + float percentage, + const cusparseMatDescr_t descrC, + const __half* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + pruneInfo_t info, + size_t* pBufferSizeInBytes); + +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneDense2csrByPercentage_bufferSizeExt( + cusparseHandle_t handle, + int m, + int n, + const float* A, + int lda, + float percentage, + const cusparseMatDescr_t descrC, + const float* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + pruneInfo_t info, + size_t* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneDense2csrByPercentage_bufferSizeExt( + cusparseHandle_t handle, + int m, + int n, + const double* A, + int lda, + float percentage, + const cusparseMatDescr_t descrC, + const double* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + pruneInfo_t info, + size_t* pBufferSizeInBytes); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneDense2csrNnzByPercentage( + cusparseHandle_t handle, + int m, + int n, + const __half* A, + int lda, + float percentage, + const cusparseMatDescr_t descrC, + int* csrRowPtrC, + int* nnzTotalDevHostPtr, + pruneInfo_t info, + void* pBuffer); +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneDense2csrNnzByPercentage( + cusparseHandle_t handle, + int m, + int n, + const float* A, + int lda, + float percentage, + const cusparseMatDescr_t descrC, + int* csrRowPtrC, + int* nnzTotalDevHostPtr, + pruneInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneDense2csrNnzByPercentage( + cusparseHandle_t handle, + int m, + int n, + const double* A, + int lda, + float percentage, + const cusparseMatDescr_t descrC, + int* csrRowPtrC, + int* nnzTotalDevHostPtr, + pruneInfo_t info, + void* pBuffer); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneDense2csrByPercentage(cusparseHandle_t handle, + int m, + int n, + const __half* A, + int lda, + float percentage, + const cusparseMatDescr_t descrC, + __half* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + pruneInfo_t info, + void* pBuffer); + +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneDense2csrByPercentage(cusparseHandle_t handle, + int m, + int n, + const float* A, + int lda, + float percentage, + const cusparseMatDescr_t descrC, + float* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + pruneInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneDense2csrByPercentage(cusparseHandle_t handle, + int m, + int n, + const double* A, + int lda, + float percentage, + const cusparseMatDescr_t descrC, + double* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + pruneInfo_t info, + void* pBuffer); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneCsr2csrByPercentage_bufferSizeExt( + cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const __half* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + float percentage, + const cusparseMatDescr_t descrC, + const __half* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + pruneInfo_t info, + size_t* pBufferSizeInBytes); + +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneCsr2csrByPercentage_bufferSizeExt( + cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + float percentage, + const cusparseMatDescr_t descrC, + const float* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + pruneInfo_t info, + size_t* pBufferSizeInBytes); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneCsr2csrByPercentage_bufferSizeExt( + cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + float percentage, + const cusparseMatDescr_t descrC, + const double* csrSortedValC, + const int* csrSortedRowPtrC, + const int* csrSortedColIndC, + pruneInfo_t info, + size_t* pBufferSizeInBytes); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneCsr2csrNnzByPercentage( + cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const __half* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + float percentage, + const cusparseMatDescr_t descrC, + int* csrSortedRowPtrC, + int* nnzTotalDevHostPtr, + pruneInfo_t info, + void* pBuffer); + +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneCsr2csrNnzByPercentage( + cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + float percentage, + const cusparseMatDescr_t descrC, + int* csrSortedRowPtrC, + int* nnzTotalDevHostPtr, + pruneInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneCsr2csrNnzByPercentage( + cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + float percentage, + const cusparseMatDescr_t descrC, + int* csrSortedRowPtrC, + int* nnzTotalDevHostPtr, + pruneInfo_t info, + void* pBuffer); + +#if defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseHpruneCsr2csrByPercentage(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const __half* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + float percentage, /* between 0 to 100 */ + const cusparseMatDescr_t descrC, + __half* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + pruneInfo_t info, + void* pBuffer); + +#endif // defined(__cplusplus) + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseSpruneCsr2csrByPercentage(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const float* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + float percentage, + const cusparseMatDescr_t descrC, + float* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + pruneInfo_t info, + void* pBuffer); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseDpruneCsr2csrByPercentage(cusparseHandle_t handle, + int m, + int n, + int nnzA, + const cusparseMatDescr_t descrA, + const double* csrSortedValA, + const int* csrSortedRowPtrA, + const int* csrSortedColIndA, + float percentage, + const cusparseMatDescr_t descrC, + double* csrSortedValC, + const int* csrSortedRowPtrC, + int* csrSortedColIndC, + pruneInfo_t info, + void* pBuffer); + +//############################################################################## +//# CSR2CSC +//############################################################################## + +typedef enum { + CUSPARSE_CSR2CSC_ALG_DEFAULT = 1, + CUSPARSE_CSR2CSC_ALG1 = 1 +} cusparseCsr2CscAlg_t; + +cusparseStatus_t CUSPARSEAPI +cusparseCsr2cscEx2(cusparseHandle_t handle, + int m, + int n, + int nnz, + const void* csrVal, + const int* csrRowPtr, + const int* csrColInd, + void* cscVal, + int* cscColPtr, + int* cscRowInd, + cudaDataType valType, + cusparseAction_t copyValues, + cusparseIndexBase_t idxBase, + cusparseCsr2CscAlg_t alg, + void* buffer); + +cusparseStatus_t CUSPARSEAPI +cusparseCsr2cscEx2_bufferSize(cusparseHandle_t handle, + int m, + int n, + int nnz, + const void* csrVal, + const int* csrRowPtr, + const int* csrColInd, + void* cscVal, + int* cscColPtr, + int* cscRowInd, + cudaDataType valType, + cusparseAction_t copyValues, + cusparseIndexBase_t idxBase, + cusparseCsr2CscAlg_t alg, + size_t* bufferSize); + +// ############################################################################# +// # GENERIC APIs - Enumerators and Opaque Data Structures +// ############################################################################# + +typedef enum { + CUSPARSE_FORMAT_CSR = 1, ///< Compressed Sparse Row (CSR) + CUSPARSE_FORMAT_CSC = 2, ///< Compressed Sparse Column (CSC) + CUSPARSE_FORMAT_COO = 3, ///< Coordinate (COO) - Structure of Arrays + CUSPARSE_FORMAT_BLOCKED_ELL = 5, ///< Blocked ELL + CUSPARSE_FORMAT_BSR = 6, ///< Blocked Compressed Sparse Row (BSR) + CUSPARSE_FORMAT_SLICED_ELLPACK = 7 ///< Sliced ELL +} cusparseFormat_t; + +typedef enum { + CUSPARSE_ORDER_COL = 1, ///< Column-Major Order - Matrix memory layout + CUSPARSE_ORDER_ROW = 2 ///< Row-Major Order - Matrix memory layout +} cusparseOrder_t; + +typedef enum { + CUSPARSE_INDEX_16U = 1, ///< 16-bit unsigned integer for matrix/vector + ///< indices + CUSPARSE_INDEX_32I = 2, ///< 32-bit signed integer for matrix/vector indices + CUSPARSE_INDEX_64I = 3 ///< 64-bit signed integer for matrix/vector indices +} cusparseIndexType_t; + +//------------------------------------------------------------------------------ + +struct cusparseSpVecDescr; +struct cusparseDnVecDescr; +struct cusparseSpMatDescr; +struct cusparseDnMatDescr; + +typedef struct cusparseSpVecDescr* cusparseSpVecDescr_t; +typedef struct cusparseDnVecDescr* cusparseDnVecDescr_t; +typedef struct cusparseSpMatDescr* cusparseSpMatDescr_t; +typedef struct cusparseDnMatDescr* cusparseDnMatDescr_t; + +typedef struct cusparseSpVecDescr const* cusparseConstSpVecDescr_t; +typedef struct cusparseDnVecDescr const* cusparseConstDnVecDescr_t; +typedef struct cusparseSpMatDescr const* cusparseConstSpMatDescr_t; +typedef struct cusparseDnMatDescr const* cusparseConstDnMatDescr_t; + +// ############################################################################# +// # SPARSE VECTOR DESCRIPTOR +// ############################################################################# + +cusparseStatus_t CUSPARSEAPI +cusparseCreateSpVec(cusparseSpVecDescr_t* spVecDescr, + int64_t size, + int64_t nnz, + void* indices, + void* values, + cusparseIndexType_t idxType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCreateConstSpVec(cusparseConstSpVecDescr_t* spVecDescr, + int64_t size, + int64_t nnz, + const void* indices, + const void* values, + cusparseIndexType_t idxType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseDestroySpVec(cusparseConstSpVecDescr_t spVecDescr); + +cusparseStatus_t CUSPARSEAPI +cusparseSpVecGet(cusparseSpVecDescr_t spVecDescr, + int64_t* size, + int64_t* nnz, + void** indices, + void** values, + cusparseIndexType_t* idxType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseConstSpVecGet(cusparseConstSpVecDescr_t spVecDescr, + int64_t* size, + int64_t* nnz, + const void** indices, + const void** values, + cusparseIndexType_t* idxType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseSpVecGetIndexBase(cusparseConstSpVecDescr_t spVecDescr, + cusparseIndexBase_t* idxBase); + +cusparseStatus_t CUSPARSEAPI +cusparseSpVecGetValues(cusparseSpVecDescr_t spVecDescr, + void** values); + +cusparseStatus_t CUSPARSEAPI +cusparseConstSpVecGetValues(cusparseConstSpVecDescr_t spVecDescr, + const void** values); + +cusparseStatus_t CUSPARSEAPI +cusparseSpVecSetValues(cusparseSpVecDescr_t spVecDescr, + void* values); + +// ############################################################################# +// # DENSE VECTOR DESCRIPTOR +// ############################################################################# + +cusparseStatus_t CUSPARSEAPI +cusparseCreateDnVec(cusparseDnVecDescr_t* dnVecDescr, + int64_t size, + void* values, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCreateConstDnVec(cusparseConstDnVecDescr_t* dnVecDescr, + int64_t size, + const void* values, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseDestroyDnVec(cusparseConstDnVecDescr_t dnVecDescr); + +cusparseStatus_t CUSPARSEAPI +cusparseDnVecGet(cusparseDnVecDescr_t dnVecDescr, + int64_t* size, + void** values, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseConstDnVecGet(cusparseConstDnVecDescr_t dnVecDescr, + int64_t* size, + const void** values, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseDnVecGetValues(cusparseDnVecDescr_t dnVecDescr, + void** values); + +cusparseStatus_t CUSPARSEAPI +cusparseConstDnVecGetValues(cusparseConstDnVecDescr_t dnVecDescr, + const void** values); + +cusparseStatus_t CUSPARSEAPI +cusparseDnVecSetValues(cusparseDnVecDescr_t dnVecDescr, + void* values); + +// ############################################################################# +// # SPARSE MATRIX DESCRIPTOR +// ############################################################################# + +cusparseStatus_t CUSPARSEAPI +cusparseDestroySpMat(cusparseConstSpMatDescr_t spMatDescr); + + cusparseStatus_t CUSPARSEAPI +cusparseSpMatGetFormat(cusparseConstSpMatDescr_t spMatDescr, + cusparseFormat_t* format); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMatGetIndexBase(cusparseConstSpMatDescr_t spMatDescr, + cusparseIndexBase_t* idxBase); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMatGetValues(cusparseSpMatDescr_t spMatDescr, + void** values); + +cusparseStatus_t CUSPARSEAPI +cusparseConstSpMatGetValues(cusparseConstSpMatDescr_t spMatDescr, + const void** values); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMatSetValues(cusparseSpMatDescr_t spMatDescr, + void* values); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMatGetSize(cusparseConstSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* nnz); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMatGetStridedBatch(cusparseConstSpMatDescr_t spMatDescr, + int* batchCount); + +cusparseStatus_t CUSPARSEAPI +cusparseCooSetStridedBatch(cusparseSpMatDescr_t spMatDescr, + int batchCount, + int64_t batchStride); + +cusparseStatus_t CUSPARSEAPI +cusparseCsrSetStridedBatch(cusparseSpMatDescr_t spMatDescr, + int batchCount, + int64_t offsetsBatchStride, + int64_t columnsValuesBatchStride); + +cusparseStatus_t CUSPARSEAPI +cusparseBsrSetStridedBatch(cusparseSpMatDescr_t spMatDescr, + int batchCount, + int64_t offsetsBatchStride, + int64_t columnsBatchStride, + int64_t ValuesBatchStride); + +typedef enum { + CUSPARSE_SPMAT_FILL_MODE, + CUSPARSE_SPMAT_DIAG_TYPE +} cusparseSpMatAttribute_t; + +cusparseStatus_t CUSPARSEAPI +cusparseSpMatGetAttribute(cusparseConstSpMatDescr_t spMatDescr, + cusparseSpMatAttribute_t attribute, + void* data, + size_t dataSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMatSetAttribute(cusparseSpMatDescr_t spMatDescr, + cusparseSpMatAttribute_t attribute, + void* data, + size_t dataSize); + +//------------------------------------------------------------------------------ +// ### CSR ### + +cusparseStatus_t CUSPARSEAPI +cusparseCreateCsr(cusparseSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + void* csrRowOffsets, + void* csrColInd, + void* csrValues, + cusparseIndexType_t csrRowOffsetsType, + cusparseIndexType_t csrColIndType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCreateConstCsr(cusparseConstSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + const void* csrRowOffsets, + const void* csrColInd, + const void* csrValues, + cusparseIndexType_t csrRowOffsetsType, + cusparseIndexType_t csrColIndType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCreateCsc(cusparseSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + void* cscColOffsets, + void* cscRowInd, + void* cscValues, + cusparseIndexType_t cscColOffsetsType, + cusparseIndexType_t cscRowIndType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCreateConstCsc(cusparseConstSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + const void* cscColOffsets, + const void* cscRowInd, + const void* cscValues, + cusparseIndexType_t cscColOffsetsType, + cusparseIndexType_t cscRowIndType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCsrGet(cusparseSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* nnz, + void** csrRowOffsets, + void** csrColInd, + void** csrValues, + cusparseIndexType_t* csrRowOffsetsType, + cusparseIndexType_t* csrColIndType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseConstCsrGet(cusparseConstSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* nnz, + const void** csrRowOffsets, + const void** csrColInd, + const void** csrValues, + cusparseIndexType_t* csrRowOffsetsType, + cusparseIndexType_t* csrColIndType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCscGet(cusparseSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* nnz, + void** cscColOffsets, + void** cscRowInd, + void** cscValues, + cusparseIndexType_t* cscColOffsetsType, + cusparseIndexType_t* cscRowIndType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseConstCscGet(cusparseConstSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* nnz, + const void** cscColOffsets, + const void** cscRowInd, + const void** cscValues, + cusparseIndexType_t* cscColOffsetsType, + cusparseIndexType_t* cscRowIndType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCsrSetPointers(cusparseSpMatDescr_t spMatDescr, + void* csrRowOffsets, + void* csrColInd, + void* csrValues); + +cusparseStatus_t CUSPARSEAPI +cusparseCscSetPointers(cusparseSpMatDescr_t spMatDescr, + void* cscColOffsets, + void* cscRowInd, + void* cscValues); + +//------------------------------------------------------------------------------ +// ### BSR ### + +cusparseStatus_t CUSPARSEAPI +cusparseCreateBsr(cusparseSpMatDescr_t* spMatDescr, + int64_t brows, + int64_t bcols, + int64_t bnnz, + int64_t rowBlockSize, + int64_t colBlockSize, + void* bsrRowOffsets, + void* bsrColInd, + void* bsrValues, + cusparseIndexType_t bsrRowOffsetsType, + cusparseIndexType_t bsrColIndType, + cusparseIndexBase_t idxBase, + cudaDataType valueType, + cusparseOrder_t order); + +cusparseStatus_t CUSPARSEAPI +cusparseCreateConstBsr(cusparseConstSpMatDescr_t* spMatDescr, + int64_t brows, + int64_t bcols, + int64_t bnnz, + int64_t rowBlockDim, + int64_t colBlockDim, + const void* bsrRowOffsets, + const void* bsrColInd, + const void* bsrValues, + cusparseIndexType_t bsrRowOffsetsType, + cusparseIndexType_t bsrColIndType, + cusparseIndexBase_t idxBase, + cudaDataType valueType, + cusparseOrder_t order); + +//------------------------------------------------------------------------------ +// ### COO ### + +cusparseStatus_t CUSPARSEAPI +cusparseCreateCoo(cusparseSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + void* cooRowInd, + void* cooColInd, + void* cooValues, + cusparseIndexType_t cooIdxType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCreateConstCoo(cusparseConstSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + const void* cooRowInd, + const void* cooColInd, + const void* cooValues, + cusparseIndexType_t cooIdxType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCooGet(cusparseSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* nnz, + void** cooRowInd, // COO row indices + void** cooColInd, // COO column indices + void** cooValues, // COO values + cusparseIndexType_t* idxType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseConstCooGet(cusparseConstSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* nnz, + const void** cooRowInd, // COO row indices + const void** cooColInd, // COO column indices + const void** cooValues, // COO values + cusparseIndexType_t* idxType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCooSetPointers(cusparseSpMatDescr_t spMatDescr, + void* cooRows, + void* cooColumns, + void* cooValues); + +//------------------------------------------------------------------------------ +// ### BLOCKED ELL ### + +cusparseStatus_t CUSPARSEAPI +cusparseCreateBlockedEll(cusparseSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t ellBlockSize, + int64_t ellCols, + void* ellColInd, + void* ellValue, + cusparseIndexType_t ellIdxType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCreateConstBlockedEll(cusparseConstSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t ellBlockSize, + int64_t ellCols, + const void* ellColInd, + const void* ellValue, + cusparseIndexType_t ellIdxType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseBlockedEllGet(cusparseSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* ellBlockSize, + int64_t* ellCols, + void** ellColInd, + void** ellValue, + cusparseIndexType_t* ellIdxType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseConstBlockedEllGet(cusparseConstSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* ellBlockSize, + int64_t* ellCols, + const void** ellColInd, + const void** ellValue, + cusparseIndexType_t* ellIdxType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType); + +//------------------------------------------------------------------------------ +// ### Sliced ELLPACK ### + +cusparseStatus_t CUSPARSEAPI +cusparseCreateSlicedEll(cusparseSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + int64_t sellValuesSize, + int64_t sliceSize, + void* sellSliceOffsets, + void* sellColInd, + void* sellValues, + cusparseIndexType_t sellSliceOffsetsType, + cusparseIndexType_t sellColIndType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +cusparseStatus_t CUSPARSEAPI +cusparseCreateConstSlicedEll(cusparseConstSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + int64_t sellValuesSize, + int64_t sliceSize, + const void* sellSliceOffsets, + const void* sellColInd, + const void* sellValues, + cusparseIndexType_t sellSliceOffsetsType, + cusparseIndexType_t sellColIndType, + cusparseIndexBase_t idxBase, + cudaDataType valueType); + +// ############################################################################# +// # DENSE MATRIX DESCRIPTOR +// ############################################################################# + +cusparseStatus_t CUSPARSEAPI +cusparseCreateDnMat(cusparseDnMatDescr_t* dnMatDescr, + int64_t rows, + int64_t cols, + int64_t ld, + void* values, + cudaDataType valueType, + cusparseOrder_t order); + +cusparseStatus_t CUSPARSEAPI +cusparseCreateConstDnMat(cusparseConstDnMatDescr_t* dnMatDescr, + int64_t rows, + int64_t cols, + int64_t ld, + const void* values, + cudaDataType valueType, + cusparseOrder_t order); + +cusparseStatus_t CUSPARSEAPI +cusparseDestroyDnMat(cusparseConstDnMatDescr_t dnMatDescr); + +cusparseStatus_t CUSPARSEAPI +cusparseDnMatGet(cusparseDnMatDescr_t dnMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* ld, + void** values, + cudaDataType* type, + cusparseOrder_t* order); + +cusparseStatus_t CUSPARSEAPI +cusparseConstDnMatGet(cusparseConstDnMatDescr_t dnMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* ld, + const void** values, + cudaDataType* type, + cusparseOrder_t* order); + +cusparseStatus_t CUSPARSEAPI +cusparseDnMatGetValues(cusparseDnMatDescr_t dnMatDescr, + void** values); + +cusparseStatus_t CUSPARSEAPI +cusparseConstDnMatGetValues(cusparseConstDnMatDescr_t dnMatDescr, + const void** values); + +cusparseStatus_t CUSPARSEAPI +cusparseDnMatSetValues(cusparseDnMatDescr_t dnMatDescr, + void* values); + +cusparseStatus_t CUSPARSEAPI +cusparseDnMatSetStridedBatch(cusparseDnMatDescr_t dnMatDescr, + int batchCount, + int64_t batchStride); + +cusparseStatus_t CUSPARSEAPI +cusparseDnMatGetStridedBatch(cusparseConstDnMatDescr_t dnMatDescr, + int* batchCount, + int64_t* batchStride); + +// ############################################################################# +// # VECTOR-VECTOR OPERATIONS +// ############################################################################# + +cusparseStatus_t CUSPARSEAPI +cusparseAxpby(cusparseHandle_t handle, + const void* alpha, + cusparseConstSpVecDescr_t vecX, + const void* beta, + cusparseDnVecDescr_t vecY); + +cusparseStatus_t CUSPARSEAPI +cusparseGather(cusparseHandle_t handle, + cusparseConstDnVecDescr_t vecY, + cusparseSpVecDescr_t vecX); + +cusparseStatus_t CUSPARSEAPI +cusparseScatter(cusparseHandle_t handle, + cusparseConstSpVecDescr_t vecX, + cusparseDnVecDescr_t vecY); + +CUSPARSE_DEPRECATED +cusparseStatus_t CUSPARSEAPI +cusparseRot(cusparseHandle_t handle, + const void* c_coeff, + const void* s_coeff, + cusparseSpVecDescr_t vecX, + cusparseDnVecDescr_t vecY); + +cusparseStatus_t CUSPARSEAPI +cusparseSpVV_bufferSize(cusparseHandle_t handle, + cusparseOperation_t opX, + cusparseConstSpVecDescr_t vecX, + cusparseConstDnVecDescr_t vecY, + const void* result, + cudaDataType computeType, + size_t* bufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSpVV(cusparseHandle_t handle, + cusparseOperation_t opX, + cusparseConstSpVecDescr_t vecX, + cusparseConstDnVecDescr_t vecY, + void* result, + cudaDataType computeType, + void* externalBuffer); + +// ############################################################################# +// # SPARSE TO DENSE +// ############################################################################# + +typedef enum { + CUSPARSE_SPARSETODENSE_ALG_DEFAULT = 0 +} cusparseSparseToDenseAlg_t; + +cusparseStatus_t CUSPARSEAPI +cusparseSparseToDense_bufferSize(cusparseHandle_t handle, + cusparseConstSpMatDescr_t matA, + cusparseDnMatDescr_t matB, + cusparseSparseToDenseAlg_t alg, + size_t* bufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSparseToDense(cusparseHandle_t handle, + cusparseConstSpMatDescr_t matA, + cusparseDnMatDescr_t matB, + cusparseSparseToDenseAlg_t alg, + void* externalBuffer); + +// ############################################################################# +// # DENSE TO SPARSE +// ############################################################################# + +typedef enum { + CUSPARSE_DENSETOSPARSE_ALG_DEFAULT = 0 +} cusparseDenseToSparseAlg_t; + +cusparseStatus_t CUSPARSEAPI +cusparseDenseToSparse_bufferSize(cusparseHandle_t handle, + cusparseConstDnMatDescr_t matA, + cusparseSpMatDescr_t matB, + cusparseDenseToSparseAlg_t alg, + size_t* bufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseDenseToSparse_analysis(cusparseHandle_t handle, + cusparseConstDnMatDescr_t matA, + cusparseSpMatDescr_t matB, + cusparseDenseToSparseAlg_t alg, + void* externalBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseDenseToSparse_convert(cusparseHandle_t handle, + cusparseConstDnMatDescr_t matA, + cusparseSpMatDescr_t matB, + cusparseDenseToSparseAlg_t alg, + void* externalBuffer); + +// ############################################################################# +// # SPARSE MATRIX-VECTOR MULTIPLICATION +// ############################################################################# + +typedef enum { + CUSPARSE_SPMV_ALG_DEFAULT = 0, + CUSPARSE_SPMV_CSR_ALG1 = 2, + CUSPARSE_SPMV_CSR_ALG2 = 3, + CUSPARSE_SPMV_COO_ALG1 = 1, + CUSPARSE_SPMV_COO_ALG2 = 4, + CUSPARSE_SPMV_SELL_ALG1 = 5 +} cusparseSpMVAlg_t; + +cusparseStatus_t CUSPARSEAPI +cusparseSpMV(cusparseHandle_t handle, + cusparseOperation_t opA, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnVecDescr_t vecX, + const void* beta, + cusparseDnVecDescr_t vecY, + cudaDataType computeType, + cusparseSpMVAlg_t alg, + void* externalBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMV_bufferSize(cusparseHandle_t handle, + cusparseOperation_t opA, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnVecDescr_t vecX, + const void* beta, + cusparseDnVecDescr_t vecY, + cudaDataType computeType, + cusparseSpMVAlg_t alg, + size_t* bufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMV_preprocess(cusparseHandle_t handle, + cusparseOperation_t opA, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnVecDescr_t vecX, + const void* beta, + cusparseDnVecDescr_t vecY, + cudaDataType computeType, + cusparseSpMVAlg_t alg, + void* externalBuffer); +// ############################################################################# +// # SPARSE TRIANGULAR VECTOR SOLVE +// ############################################################################# + +typedef enum { + CUSPARSE_SPSV_ALG_DEFAULT = 0, +} cusparseSpSVAlg_t; + +typedef enum { + CUSPARSE_SPSV_UPDATE_GENERAL = 0, + CUSPARSE_SPSV_UPDATE_DIAGONAL = 1 +} cusparseSpSVUpdate_t; + +struct cusparseSpSVDescr; +typedef struct cusparseSpSVDescr* cusparseSpSVDescr_t; + +cusparseStatus_t CUSPARSEAPI +cusparseSpSV_createDescr(cusparseSpSVDescr_t* descr); + +cusparseStatus_t CUSPARSEAPI +cusparseSpSV_destroyDescr(cusparseSpSVDescr_t descr); + +cusparseStatus_t CUSPARSEAPI +cusparseSpSV_bufferSize(cusparseHandle_t handle, + cusparseOperation_t opA, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnVecDescr_t vecX, + cusparseDnVecDescr_t vecY, + cudaDataType computeType, + cusparseSpSVAlg_t alg, + cusparseSpSVDescr_t spsvDescr, + size_t* bufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSpSV_analysis(cusparseHandle_t handle, + cusparseOperation_t opA, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnVecDescr_t vecX, + cusparseDnVecDescr_t vecY, + cudaDataType computeType, + cusparseSpSVAlg_t alg, + cusparseSpSVDescr_t spsvDescr, + void* externalBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSpSV_solve(cusparseHandle_t handle, + cusparseOperation_t opA, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnVecDescr_t vecX, + cusparseDnVecDescr_t vecY, + cudaDataType computeType, + cusparseSpSVAlg_t alg, + cusparseSpSVDescr_t spsvDescr); + +cusparseStatus_t CUSPARSEAPI +cusparseSpSV_updateMatrix(cusparseHandle_t handle, + cusparseSpSVDescr_t spsvDescr, + void* newValues, + cusparseSpSVUpdate_t updatePart); + + + +// ############################################################################# +// # SPARSE TRIANGULAR MATRIX SOLVE +// ############################################################################# + +typedef enum { + CUSPARSE_SPSM_ALG_DEFAULT = 0, +} cusparseSpSMAlg_t; + +typedef enum { + CUSPARSE_SPSM_UPDATE_GENERAL = 0, + CUSPARSE_SPSM_UPDATE_DIAGONAL = 1 +} cusparseSpSMUpdate_t; + +struct cusparseSpSMDescr; +typedef struct cusparseSpSMDescr* cusparseSpSMDescr_t; + +cusparseStatus_t CUSPARSEAPI +cusparseSpSM_createDescr(cusparseSpSMDescr_t* descr); + +cusparseStatus_t CUSPARSEAPI +cusparseSpSM_destroyDescr(cusparseSpSMDescr_t descr); + +cusparseStatus_t CUSPARSEAPI +cusparseSpSM_bufferSize(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnMatDescr_t matB, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpSMAlg_t alg, + cusparseSpSMDescr_t spsmDescr, + size_t* bufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSpSM_analysis(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnMatDescr_t matB, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpSMAlg_t alg, + cusparseSpSMDescr_t spsmDescr, + void* externalBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSpSM_solve(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnMatDescr_t matB, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpSMAlg_t alg, + cusparseSpSMDescr_t spsmDescr); + +cusparseStatus_t CUSPARSEAPI +cusparseSpSM_updateMatrix(cusparseHandle_t handle, + cusparseSpSMDescr_t spsmDescr, + void* newValues, + cusparseSpSMUpdate_t updatePart); + +// ############################################################################# +// # SPARSE MATRIX-MATRIX MULTIPLICATION +// ############################################################################# + +typedef enum { + CUSPARSE_SPMM_ALG_DEFAULT = 0, + CUSPARSE_SPMM_COO_ALG1 = 1, + CUSPARSE_SPMM_COO_ALG2 = 2, + CUSPARSE_SPMM_COO_ALG3 = 3, + CUSPARSE_SPMM_COO_ALG4 = 5, + CUSPARSE_SPMM_CSR_ALG1 = 4, + CUSPARSE_SPMM_CSR_ALG2 = 6, + CUSPARSE_SPMM_CSR_ALG3 = 12, + CUSPARSE_SPMM_BLOCKED_ELL_ALG1 = 13 +} cusparseSpMMAlg_t; + +cusparseStatus_t CUSPARSEAPI +cusparseSpMM_bufferSize(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnMatDescr_t matB, + const void* beta, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpMMAlg_t alg, + size_t* bufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMM_preprocess(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnMatDescr_t matB, + const void* beta, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpMMAlg_t alg, + void* externalBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMM(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstDnMatDescr_t matB, + const void* beta, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpMMAlg_t alg, + void* externalBuffer); + +// ############################################################################# +// # SPARSE MATRIX - SPARSE MATRIX MULTIPLICATION (SpGEMM) +// ############################################################################# + +typedef enum { + CUSPARSE_SPGEMM_DEFAULT = 0, + CUSPARSE_SPGEMM_CSR_ALG_DETERMINITIC = 1, + CUSPARSE_SPGEMM_CSR_ALG_NONDETERMINITIC = 2, + CUSPARSE_SPGEMM_ALG1 = 3, + CUSPARSE_SPGEMM_ALG2 = 4, + CUSPARSE_SPGEMM_ALG3 = 5 +} cusparseSpGEMMAlg_t; + +struct cusparseSpGEMMDescr; +typedef struct cusparseSpGEMMDescr* cusparseSpGEMMDescr_t; + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMM_createDescr(cusparseSpGEMMDescr_t* descr); + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMM_destroyDescr(cusparseSpGEMMDescr_t descr); + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMM_workEstimation(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstSpMatDescr_t matB, + const void* beta, + cusparseSpMatDescr_t matC, + cudaDataType computeType, + cusparseSpGEMMAlg_t alg, + cusparseSpGEMMDescr_t spgemmDescr, + size_t* bufferSize1, + void* externalBuffer1); + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMM_getNumProducts(cusparseSpGEMMDescr_t spgemmDescr, + int64_t* num_prods); + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMM_estimateMemory(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstSpMatDescr_t matB, + const void* beta, + cusparseSpMatDescr_t matC, + cudaDataType computeType, + cusparseSpGEMMAlg_t alg, + cusparseSpGEMMDescr_t spgemmDescr, + float chunk_fraction, + size_t* bufferSize3, + void* externalBuffer3, + size_t* bufferSize2); + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMM_compute(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstSpMatDescr_t matB, + const void* beta, + cusparseSpMatDescr_t matC, + cudaDataType computeType, + cusparseSpGEMMAlg_t alg, + cusparseSpGEMMDescr_t spgemmDescr, + size_t* bufferSize2, + void* externalBuffer2); + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMM_copy(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstSpMatDescr_t matB, + const void* beta, + cusparseSpMatDescr_t matC, + cudaDataType computeType, + cusparseSpGEMMAlg_t alg, + cusparseSpGEMMDescr_t spgemmDescr); + +// ############################################################################# +// # SPARSE MATRIX - SPARSE MATRIX MULTIPLICATION (SpGEMM) STRUCTURE REUSE +// ############################################################################# + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMMreuse_workEstimation(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + cusparseConstSpMatDescr_t matA, + cusparseConstSpMatDescr_t matB, + cusparseSpMatDescr_t matC, + cusparseSpGEMMAlg_t alg, + cusparseSpGEMMDescr_t spgemmDescr, + size_t* bufferSize1, + void* externalBuffer1); + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMMreuse_nnz(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + cusparseConstSpMatDescr_t matA, + cusparseConstSpMatDescr_t matB, + cusparseSpMatDescr_t matC, + cusparseSpGEMMAlg_t alg, + cusparseSpGEMMDescr_t spgemmDescr, + size_t* bufferSize2, + void* externalBuffer2, + size_t* bufferSize3, + void* externalBuffer3, + size_t* bufferSize4, + void* externalBuffer4); + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMMreuse_copy(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + cusparseConstSpMatDescr_t matA, + cusparseConstSpMatDescr_t matB, + cusparseSpMatDescr_t matC, + cusparseSpGEMMAlg_t alg, + cusparseSpGEMMDescr_t spgemmDescr, + size_t* bufferSize5, + void* externalBuffer5); + +cusparseStatus_t CUSPARSEAPI +cusparseSpGEMMreuse_compute(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstSpMatDescr_t matA, + cusparseConstSpMatDescr_t matB, + const void* beta, + cusparseSpMatDescr_t matC, + cudaDataType computeType, + cusparseSpGEMMAlg_t alg, + cusparseSpGEMMDescr_t spgemmDescr); + +// ############################################################################# +// # SAMPLED DENSE-DENSE MATRIX MULTIPLICATION +// ############################################################################# + +typedef enum { + CUSPARSE_SDDMM_ALG_DEFAULT = 0 +} cusparseSDDMMAlg_t; + +cusparseStatus_t CUSPARSEAPI +cusparseSDDMM_bufferSize(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstDnMatDescr_t matA, + cusparseConstDnMatDescr_t matB, + const void* beta, + cusparseSpMatDescr_t matC, + cudaDataType computeType, + cusparseSDDMMAlg_t alg, + size_t* bufferSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSDDMM_preprocess(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstDnMatDescr_t matA, + cusparseConstDnMatDescr_t matB, + const void* beta, + cusparseSpMatDescr_t matC, + cudaDataType computeType, + cusparseSDDMMAlg_t alg, + void* externalBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSDDMM(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseConstDnMatDescr_t matA, + cusparseConstDnMatDescr_t matB, + const void* beta, + cusparseSpMatDescr_t matC, + cudaDataType computeType, + cusparseSDDMMAlg_t alg, + void* externalBuffer); + +// ############################################################################# +// # GENERIC APIs WITH CUSTOM OPERATORS (PREVIEW) +// ############################################################################# + +struct cusparseSpMMOpPlan; +typedef struct cusparseSpMMOpPlan* cusparseSpMMOpPlan_t; + +typedef enum { + CUSPARSE_SPMM_OP_ALG_DEFAULT +} cusparseSpMMOpAlg_t; + +cusparseStatus_t CUSPARSEAPI +cusparseSpMMOp_createPlan(cusparseHandle_t handle, + cusparseSpMMOpPlan_t* plan, + cusparseOperation_t opA, + cusparseOperation_t opB, + cusparseConstSpMatDescr_t matA, + cusparseConstDnMatDescr_t matB, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpMMOpAlg_t alg, + const void* addOperationNvvmBuffer, + size_t addOperationBufferSize, + const void* mulOperationNvvmBuffer, + size_t mulOperationBufferSize, + const void* epilogueNvvmBuffer, + size_t epilogueBufferSize, + size_t* SpMMWorkspaceSize); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMMOp(cusparseSpMMOpPlan_t plan, + void* externalBuffer); + +cusparseStatus_t CUSPARSEAPI +cusparseSpMMOp_destroyPlan(cusparseSpMMOpPlan_t plan); + +//------------------------------------------------------------------------------ + +#if defined(__cplusplus) +} // extern "C" +#endif // defined(__cplusplus) + +#undef CUSPARSE_DEPRECATED_REPLACE_WITH +#undef CUSPARSE_DEPRECATED +#undef CUSPARSE_DEPRECATED_TYPE +#undef CUSPARSE_DEPRECATED_TYPE_MSVC +#undef CUSPARSE_DEPRECATED_ENUM_REPLACE_WITH +#undef CUSPARSE_DEPRECATED_ENUM + +#endif // !defined(CUSPARSE_H_) diff --git a/cuda_toolkit/include/cusparse_v2.h b/cuda_toolkit/include/cusparse_v2.h new file mode 100644 index 0000000000000000000000000000000000000000..cf8517746eec2f43ed10d4310e9565e59b83cd0d --- /dev/null +++ b/cuda_toolkit/include/cusparse_v2.h @@ -0,0 +1,54 @@ +/* + * Copyright 1993-2019 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ +#if !defined(CUSPARSE_V2_H_) +#define CUSPARSE_V2_H_ + +#include "cusparse.h" + +#endif diff --git a/cuda_toolkit/include/cwchar b/cuda_toolkit/include/cwchar new file mode 100644 index 0000000000000000000000000000000000000000..71f24a85fe9bf1f4c0724dd44ad8a7e53641b6ff --- /dev/null +++ b/cuda_toolkit/include/cwchar @@ -0,0 +1,196 @@ +// -*- C++ -*- +//===--------------------------- cwchar -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CWCHAR +#define _LIBCUDACXX_CWCHAR + +/* + cwchar synopsis + +Macros: + + NULL + WCHAR_MAX + WCHAR_MIN + WEOF + +namespace std +{ + +Types: + + mbstate_t + size_t + tm + wint_t + +int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...); +int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...); +int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...); +int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...); +int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); +int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99 +int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg); +int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99 +int vwprintf(const wchar_t* restrict format, va_list arg); +int vwscanf(const wchar_t* restrict format, va_list arg); // C99 +int wprintf(const wchar_t* restrict format, ...); +int wscanf(const wchar_t* restrict format, ...); +wint_t fgetwc(FILE* stream); +wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream); +wint_t fputwc(wchar_t c, FILE* stream); +int fputws(const wchar_t* restrict s, FILE* restrict stream); +int fwide(FILE* stream, int mode); +wint_t getwc(FILE* stream); +wint_t getwchar(); +wint_t putwc(wchar_t c, FILE* stream); +wint_t putwchar(wchar_t c); +wint_t ungetwc(wint_t c, FILE* stream); +double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr); +float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99 +long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99 +long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); +long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99 +unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); +unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99 +wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2); +wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); +wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2); +wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); +int wcscmp(const wchar_t* s1, const wchar_t* s2); +int wcscoll(const wchar_t* s1, const wchar_t* s2); +int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n); +size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); +const wchar_t* wcschr(const wchar_t* s, wchar_t c); + wchar_t* wcschr( wchar_t* s, wchar_t c); +size_t wcscspn(const wchar_t* s1, const wchar_t* s2); +size_t wcslen(const wchar_t* s); +const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2); + wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2); +const wchar_t* wcsrchr(const wchar_t* s, wchar_t c); + wchar_t* wcsrchr( wchar_t* s, wchar_t c); +size_t wcsspn(const wchar_t* s1, const wchar_t* s2); +const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2); + wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2); +wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr); +const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n); + wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n); +int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); +wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n); +wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n); +wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n); +size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format, + const tm* restrict timeptr); +wint_t btowc(int c); +int wctob(wint_t c); +int mbsinit(const mbstate_t* ps); +size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps); +size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps); +size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps); +size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len, + mbstate_t* restrict ps); +size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, + mbstate_t* restrict ps); + +} // std + +*/ + +#include <__config> +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::mbstate_t; +using ::size_t; +using ::tm; +using ::wint_t; +using ::FILE; +using ::fwprintf; +using ::fwscanf; +using ::swprintf; +using ::vfwprintf; +using ::vswprintf; +using ::swscanf; +using ::vfwscanf; +using ::vswscanf; +using ::fgetwc; +using ::fgetws; +using ::fputwc; +using ::fputws; +using ::fwide; +using ::getwc; +using ::putwc; +using ::ungetwc; +using ::wcstod; +using ::wcstof; +using ::wcstold; +using ::wcstol; +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +using ::wcstoll; +#endif // _LIBCUDACXX_HAS_NO_LONG_LONG +using ::wcstoul; +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +using ::wcstoull; +#endif // _LIBCUDACXX_HAS_NO_LONG_LONG +using ::wcscpy; +using ::wcsncpy; +using ::wcscat; +using ::wcsncat; +using ::wcscmp; +using ::wcscoll; +using ::wcsncmp; +using ::wcsxfrm; +using ::wcschr; +using ::wcspbrk; +using ::wcsrchr; +using ::wcsstr; +using ::wmemchr; +using ::wcscspn; +using ::wcslen; +using ::wcsspn; +using ::wcstok; +using ::wmemcmp; +using ::wmemcpy; +using ::wmemmove; +using ::wmemset; +using ::wcsftime; +using ::btowc; +using ::wctob; +using ::mbsinit; +using ::mbrlen; +using ::mbrtowc; +using ::wcrtomb; +using ::mbsrtowcs; +using ::wcsrtombs; + +#ifndef _LIBCUDACXX_HAS_NO_STDIN +using ::getwchar; +using ::vwscanf; +using ::wscanf; +#endif + +#ifndef _LIBCUDACXX_HAS_NO_STDOUT +using ::putwchar; +using ::vwprintf; +using ::wprintf; +#endif + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_CWCHAR diff --git a/cuda_toolkit/include/cwctype b/cuda_toolkit/include/cwctype new file mode 100644 index 0000000000000000000000000000000000000000..6000556dfb65d0e163ad1bc0638e5b101053eaf1 --- /dev/null +++ b/cuda_toolkit/include/cwctype @@ -0,0 +1,90 @@ +// -*- C++ -*- +//===--------------------------- cwctype ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_CWCTYPE +#define _LIBCUDACXX_CWCTYPE + +/* + cwctype synopsis + +Macros: + + WEOF + +namespace std +{ + +Types: + + wint_t + wctrans_t + wctype_t + +int iswalnum(wint_t wc); +int iswalpha(wint_t wc); +int iswblank(wint_t wc); // C99 +int iswcntrl(wint_t wc); +int iswdigit(wint_t wc); +int iswgraph(wint_t wc); +int iswlower(wint_t wc); +int iswprint(wint_t wc); +int iswpunct(wint_t wc); +int iswspace(wint_t wc); +int iswupper(wint_t wc); +int iswxdigit(wint_t wc); +int iswctype(wint_t wc, wctype_t desc); +wctype_t wctype(const char* property); +wint_t towlower(wint_t wc); +wint_t towupper(wint_t wc); +wint_t towctrans(wint_t wc, wctrans_t desc); +wctrans_t wctrans(const char* property); + +} // std + +*/ + +#include <__config> +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +using ::wint_t; +using ::wctrans_t; +using ::wctype_t; +using ::iswalnum; +using ::iswalpha; +using ::iswblank; +using ::iswcntrl; +using ::iswdigit; +using ::iswgraph; +using ::iswlower; +using ::iswprint; +using ::iswpunct; +using ::iswspace; +using ::iswupper; +using ::iswxdigit; +using ::iswctype; +using ::wctype; +using ::towlower; +using ::towupper; +using ::towctrans; +using ::wctrans; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_CWCTYPE diff --git a/cuda_toolkit/include/deque b/cuda_toolkit/include/deque new file mode 100644 index 0000000000000000000000000000000000000000..50fc3040c1cac3f144eadf79b0b74a88373057aa --- /dev/null +++ b/cuda_toolkit/include/deque @@ -0,0 +1,3022 @@ +// -*- C++ -*- +//===---------------------------- deque -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_DEQUE +#define _LIBCUDACXX_DEQUE + +/* + deque synopsis + +namespace std +{ + +template > +class deque +{ +public: + // types: + typedef T value_type; + typedef Allocator allocator_type; + + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + typedef implementation-defined iterator; + typedef implementation-defined const_iterator; + typedef typename allocator_type::size_type size_type; + typedef typename allocator_type::difference_type difference_type; + + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // construct/copy/destroy: + deque() noexcept(is_nothrow_default_constructible::value); + explicit deque(const allocator_type& a); + explicit deque(size_type n); + explicit deque(size_type n, const allocator_type& a); // C++14 + deque(size_type n, const value_type& v); + deque(size_type n, const value_type& v, const allocator_type& a); + template + deque(InputIterator f, InputIterator l); + template + deque(InputIterator f, InputIterator l, const allocator_type& a); + deque(const deque& c); + deque(deque&& c) + noexcept(is_nothrow_move_constructible::value); + deque(initializer_list il, const Allocator& a = allocator_type()); + deque(const deque& c, const allocator_type& a); + deque(deque&& c, const allocator_type& a); + ~deque(); + + deque& operator=(const deque& c); + deque& operator=(deque&& c) + noexcept( + allocator_type::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value); + deque& operator=(initializer_list il); + + template + void assign(InputIterator f, InputIterator l); + void assign(size_type n, const value_type& v); + void assign(initializer_list il); + + allocator_type get_allocator() const noexcept; + + // iterators: + + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; + + reverse_iterator rbegin() noexcept; + const_reverse_iterator rbegin() const noexcept; + reverse_iterator rend() noexcept; + const_reverse_iterator rend() const noexcept; + + const_iterator cbegin() const noexcept; + const_iterator cend() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator crend() const noexcept; + + // capacity: + size_type size() const noexcept; + size_type max_size() const noexcept; + void resize(size_type n); + void resize(size_type n, const value_type& v); + void shrink_to_fit(); + bool empty() const noexcept; + + // element access: + reference operator[](size_type i); + const_reference operator[](size_type i) const; + reference at(size_type i); + const_reference at(size_type i) const; + reference front(); + const_reference front() const; + reference back(); + const_reference back() const; + + // modifiers: + void push_front(const value_type& v); + void push_front(value_type&& v); + void push_back(const value_type& v); + void push_back(value_type&& v); + template reference emplace_front(Args&&... args); // reference in C++17 + template reference emplace_back(Args&&... args); // reference in C++17 + template iterator emplace(const_iterator p, Args&&... args); + iterator insert(const_iterator p, const value_type& v); + iterator insert(const_iterator p, value_type&& v); + iterator insert(const_iterator p, size_type n, const value_type& v); + template + iterator insert(const_iterator p, InputIterator f, InputIterator l); + iterator insert(const_iterator p, initializer_list il); + void pop_front(); + void pop_back(); + iterator erase(const_iterator p); + iterator erase(const_iterator f, const_iterator l); + void swap(deque& c) + noexcept(allocator_traits::is_always_equal::value); // C++17 + void clear() noexcept; +}; + +template ::value_type>> + deque(InputIterator, InputIterator, Allocator = Allocator()) + -> deque::value_type, Allocator>; + +template + bool operator==(const deque& x, const deque& y); +template + bool operator< (const deque& x, const deque& y); +template + bool operator!=(const deque& x, const deque& y); +template + bool operator> (const deque& x, const deque& y); +template + bool operator>=(const deque& x, const deque& y); +template + bool operator<=(const deque& x, const deque& y); + +// specialized algorithms: +template + void swap(deque& x, deque& y) + noexcept(noexcept(x.swap(y))); + +template + void erase(deque& c, const U& value); // C++20 +template + void erase_if(deque& c, Predicate pred); // C++20 + +} // std + +*/ + +#include <__config> +#include <__split_buffer> +#include +#include +#include +#include +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template class __deque_base; +template > class _LIBCUDACXX_TEMPLATE_VIS deque; + +template +class _LIBCUDACXX_TEMPLATE_VIS __deque_iterator; + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +copy(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); + +template +_OutputIterator +copy(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r); + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +copy(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r); + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +copy_backward(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); + +template +_OutputIterator +copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r); + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r); + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +move(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); + +template +_OutputIterator +move(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r); + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +move(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r); + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +move_backward(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); + +template +_OutputIterator +move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r); + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r); + +template +struct __deque_block_size { + static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16; +}; + +template ::value +#endif + > +class _LIBCUDACXX_TEMPLATE_VIS __deque_iterator +{ + typedef _MapPointer __map_iterator; +public: + typedef _Pointer pointer; + typedef _DiffType difference_type; +private: + __map_iterator __m_iter_; + pointer __ptr_; + + static const difference_type __block_size; +public: + typedef _ValueType value_type; + typedef random_access_iterator_tag iterator_category; + typedef _Reference reference; + + _LIBCUDACXX_INLINE_VISIBILITY __deque_iterator() noexcept +#if _LIBCUDACXX_STD_VER > 11 + : __m_iter_(nullptr), __ptr_(nullptr) +#endif + {} + + template + _LIBCUDACXX_INLINE_VISIBILITY + __deque_iterator(const __deque_iterator& __it, + typename enable_if::value>::type* = 0) noexcept + : __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {} + + _LIBCUDACXX_INLINE_VISIBILITY reference operator*() const {return *__ptr_;} + _LIBCUDACXX_INLINE_VISIBILITY pointer operator->() const {return __ptr_;} + + _LIBCUDACXX_INLINE_VISIBILITY __deque_iterator& operator++() + { + if (++__ptr_ - *__m_iter_ == __block_size) + { + ++__m_iter_; + __ptr_ = *__m_iter_; + } + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY __deque_iterator operator++(int) + { + __deque_iterator __tmp = *this; + ++(*this); + return __tmp; + } + + _LIBCUDACXX_INLINE_VISIBILITY __deque_iterator& operator--() + { + if (__ptr_ == *__m_iter_) + { + --__m_iter_; + __ptr_ = *__m_iter_ + __block_size; + } + --__ptr_; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY __deque_iterator operator--(int) + { + __deque_iterator __tmp = *this; + --(*this); + return __tmp; + } + + _LIBCUDACXX_INLINE_VISIBILITY __deque_iterator& operator+=(difference_type __n) + { + if (__n != 0) + { + __n += __ptr_ - *__m_iter_; + if (__n > 0) + { + __m_iter_ += __n / __block_size; + __ptr_ = *__m_iter_ + __n % __block_size; + } + else // (__n < 0) + { + difference_type __z = __block_size - 1 - __n; + __m_iter_ -= __z / __block_size; + __ptr_ = *__m_iter_ + (__block_size - 1 - __z % __block_size); + } + } + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY __deque_iterator& operator-=(difference_type __n) + { + return *this += -__n; + } + + _LIBCUDACXX_INLINE_VISIBILITY __deque_iterator operator+(difference_type __n) const + { + __deque_iterator __t(*this); + __t += __n; + return __t; + } + + _LIBCUDACXX_INLINE_VISIBILITY __deque_iterator operator-(difference_type __n) const + { + __deque_iterator __t(*this); + __t -= __n; + return __t; + } + + _LIBCUDACXX_INLINE_VISIBILITY + friend __deque_iterator operator+(difference_type __n, const __deque_iterator& __it) + {return __it + __n;} + + _LIBCUDACXX_INLINE_VISIBILITY + friend difference_type operator-(const __deque_iterator& __x, const __deque_iterator& __y) + { + if (__x != __y) + return (__x.__m_iter_ - __y.__m_iter_) * __block_size + + (__x.__ptr_ - *__x.__m_iter_) + - (__y.__ptr_ - *__y.__m_iter_); + return 0; + } + + _LIBCUDACXX_INLINE_VISIBILITY reference operator[](difference_type __n) const + {return *(*this + __n);} + + _LIBCUDACXX_INLINE_VISIBILITY friend + bool operator==(const __deque_iterator& __x, const __deque_iterator& __y) + {return __x.__ptr_ == __y.__ptr_;} + + _LIBCUDACXX_INLINE_VISIBILITY friend + bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y) + {return !(__x == __y);} + + _LIBCUDACXX_INLINE_VISIBILITY friend + bool operator<(const __deque_iterator& __x, const __deque_iterator& __y) + {return __x.__m_iter_ < __y.__m_iter_ || + (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);} + + _LIBCUDACXX_INLINE_VISIBILITY friend + bool operator>(const __deque_iterator& __x, const __deque_iterator& __y) + {return __y < __x;} + + _LIBCUDACXX_INLINE_VISIBILITY friend + bool operator<=(const __deque_iterator& __x, const __deque_iterator& __y) + {return !(__y < __x);} + + _LIBCUDACXX_INLINE_VISIBILITY friend + bool operator>=(const __deque_iterator& __x, const __deque_iterator& __y) + {return !(__x < __y);} + +private: + _LIBCUDACXX_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) noexcept + : __m_iter_(__m), __ptr_(__p) {} + + template friend class __deque_base; + template friend class _LIBCUDACXX_TEMPLATE_VIS deque; + template + friend class _LIBCUDACXX_TEMPLATE_VIS __deque_iterator; + + template + friend + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> + copy(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); + + template + friend + _OutputIterator + copy(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r); + + template + friend + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> + copy(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r); + + template + friend + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> + copy_backward(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); + + template + friend + _OutputIterator + copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r); + + template + friend + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> + copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r); + + template + friend + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> + move(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); + + template + friend + _OutputIterator + move(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r); + + template + friend + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> + move(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r); + + template + friend + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> + move_backward(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); + + template + friend + _OutputIterator + move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r); + + template + friend + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> + move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r); +}; + +template +const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, + _DiffType, _BlockSize>::__block_size = + __deque_block_size<_ValueType, _DiffType>::value; + +// copy + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +copy(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) +{ + typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2>::difference_type difference_type; + typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2>::pointer pointer; + const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2>::__block_size; + while (__f != __l) + { + pointer __rb = __r.__ptr_; + pointer __re = *__r.__m_iter_ + __block_size; + difference_type __bs = __re - __rb; + difference_type __n = __l - __f; + _RAIter __m = __l; + if (__n > __bs) + { + __n = __bs; + __m = __f + __n; + } + _CUDA_VSTD::copy(__f, __m, __rb); + __f = __m; + __r += __n; + } + return __r; +} + +template +_OutputIterator +copy(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r) +{ + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::difference_type difference_type; + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::pointer pointer; + const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::__block_size; + difference_type __n = __l - __f; + while (__n > 0) + { + pointer __fb = __f.__ptr_; + pointer __fe = *__f.__m_iter_ + __block_size; + difference_type __bs = __fe - __fb; + if (__bs > __n) + { + __bs = __n; + __fe = __fb + __bs; + } + __r = _CUDA_VSTD::copy(__fb, __fe, __r); + __n -= __bs; + __f += __bs; + } + return __r; +} + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +copy(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r) +{ + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::difference_type difference_type; + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::pointer pointer; + const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::__block_size; + difference_type __n = __l - __f; + while (__n > 0) + { + pointer __fb = __f.__ptr_; + pointer __fe = *__f.__m_iter_ + __block_size; + difference_type __bs = __fe - __fb; + if (__bs > __n) + { + __bs = __n; + __fe = __fb + __bs; + } + __r = _CUDA_VSTD::copy(__fb, __fe, __r); + __n -= __bs; + __f += __bs; + } + return __r; +} + +// copy_backward + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +copy_backward(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) +{ + typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2>::difference_type difference_type; + typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2>::pointer pointer; + while (__f != __l) + { + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __rp = _CUDA_VSTD::prev(__r); + pointer __rb = *__rp.__m_iter_; + pointer __re = __rp.__ptr_ + 1; + difference_type __bs = __re - __rb; + difference_type __n = __l - __f; + _RAIter __m = __f; + if (__n > __bs) + { + __n = __bs; + __m = __l - __n; + } + _CUDA_VSTD::copy_backward(__m, __l, __re); + __l = __m; + __r -= __n; + } + return __r; +} + +template +_OutputIterator +copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r) +{ + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::difference_type difference_type; + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::pointer pointer; + difference_type __n = __l - __f; + while (__n > 0) + { + --__l; + pointer __lb = *__l.__m_iter_; + pointer __le = __l.__ptr_ + 1; + difference_type __bs = __le - __lb; + if (__bs > __n) + { + __bs = __n; + __lb = __le - __bs; + } + __r = _CUDA_VSTD::copy_backward(__lb, __le, __r); + __n -= __bs; + __l -= __bs - 1; + } + return __r; +} + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r) +{ + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::difference_type difference_type; + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::pointer pointer; + difference_type __n = __l - __f; + while (__n > 0) + { + --__l; + pointer __lb = *__l.__m_iter_; + pointer __le = __l.__ptr_ + 1; + difference_type __bs = __le - __lb; + if (__bs > __n) + { + __bs = __n; + __lb = __le - __bs; + } + __r = _CUDA_VSTD::copy_backward(__lb, __le, __r); + __n -= __bs; + __l -= __bs - 1; + } + return __r; +} + +// move + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +move(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) +{ + typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2>::difference_type difference_type; + typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2>::pointer pointer; + const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2>::__block_size; + while (__f != __l) + { + pointer __rb = __r.__ptr_; + pointer __re = *__r.__m_iter_ + __block_size; + difference_type __bs = __re - __rb; + difference_type __n = __l - __f; + _RAIter __m = __l; + if (__n > __bs) + { + __n = __bs; + __m = __f + __n; + } + _CUDA_VSTD::move(__f, __m, __rb); + __f = __m; + __r += __n; + } + return __r; +} + +template +_OutputIterator +move(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r) +{ + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::difference_type difference_type; + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::pointer pointer; + const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::__block_size; + difference_type __n = __l - __f; + while (__n > 0) + { + pointer __fb = __f.__ptr_; + pointer __fe = *__f.__m_iter_ + __block_size; + difference_type __bs = __fe - __fb; + if (__bs > __n) + { + __bs = __n; + __fe = __fb + __bs; + } + __r = _CUDA_VSTD::move(__fb, __fe, __r); + __n -= __bs; + __f += __bs; + } + return __r; +} + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +move(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r) +{ + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::difference_type difference_type; + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::pointer pointer; + const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::__block_size; + difference_type __n = __l - __f; + while (__n > 0) + { + pointer __fb = __f.__ptr_; + pointer __fe = *__f.__m_iter_ + __block_size; + difference_type __bs = __fe - __fb; + if (__bs > __n) + { + __bs = __n; + __fe = __fb + __bs; + } + __r = _CUDA_VSTD::move(__fb, __fe, __r); + __n -= __bs; + __f += __bs; + } + return __r; +} + +// move_backward + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +move_backward(_RAIter __f, + _RAIter __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) +{ + typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2>::difference_type difference_type; + typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2>::pointer pointer; + while (__f != __l) + { + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __rp = _CUDA_VSTD::prev(__r); + pointer __rb = *__rp.__m_iter_; + pointer __re = __rp.__ptr_ + 1; + difference_type __bs = __re - __rb; + difference_type __n = __l - __f; + _RAIter __m = __f; + if (__n > __bs) + { + __n = __bs; + __m = __l - __n; + } + _CUDA_VSTD::move_backward(__m, __l, __re); + __l = __m; + __r -= __n; + } + return __r; +} + +template +_OutputIterator +move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + _OutputIterator __r) +{ + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::difference_type difference_type; + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::pointer pointer; + difference_type __n = __l - __f; + while (__n > 0) + { + --__l; + pointer __lb = *__l.__m_iter_; + pointer __le = __l.__ptr_ + 1; + difference_type __bs = __le - __lb; + if (__bs > __n) + { + __bs = __n; + __lb = __le - __bs; + } + __r = _CUDA_VSTD::move_backward(__lb, __le, __r); + __n -= __bs; + __l -= __bs - 1; + } + return __r; +} + +template +__deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> +move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __f, + __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1> __l, + __deque_iterator<_V2, _P2, _R2, _M2, _Diff2, _B2> __r) +{ + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::difference_type difference_type; + typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _Diff1, _B1>::pointer pointer; + difference_type __n = __l - __f; + while (__n > 0) + { + --__l; + pointer __lb = *__l.__m_iter_; + pointer __le = __l.__ptr_ + 1; + difference_type __bs = __le - __lb; + if (__bs > __n) + { + __bs = __n; + __lb = __le - __bs; + } + __r = _CUDA_VSTD::move_backward(__lb, __le, __r); + __n -= __bs; + __l -= __bs - 1; + } + return __r; +} + +template +class __deque_base_common +{ +protected: + _LIBCUDACXX_NORETURN void __throw_length_error() const; + _LIBCUDACXX_NORETURN void __throw_out_of_range() const; +}; + +template +void +__deque_base_common<__b>::__throw_length_error() const +{ + _CUDA_VSTD::__throw_length_error("deque"); +} + +template +void +__deque_base_common<__b>::__throw_out_of_range() const +{ + _CUDA_VSTD::__throw_out_of_range("deque"); +} + +template +class __deque_base + : protected __deque_base_common +{ + __deque_base(const __deque_base& __c); + __deque_base& operator=(const __deque_base& __c); +public: + typedef _Allocator allocator_type; + typedef allocator_traits __alloc_traits; + typedef typename __alloc_traits::size_type size_type; + + typedef _Tp value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename __alloc_traits::difference_type difference_type; + typedef typename __alloc_traits::pointer pointer; + typedef typename __alloc_traits::const_pointer const_pointer; + + static const difference_type __block_size; + + typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator; + typedef allocator_traits<__pointer_allocator> __map_traits; + typedef typename __map_traits::pointer __map_pointer; + typedef typename __rebind_alloc_helper<__alloc_traits, const_pointer>::type __const_pointer_allocator; + typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer; + typedef __split_buffer __map; + + typedef __deque_iterator iterator; + typedef __deque_iterator const_iterator; + + struct __deque_block_range { + explicit __deque_block_range(pointer __b, pointer __e) noexcept : __begin_(__b), __end_(__e) {} + const pointer __begin_; + const pointer __end_; + }; + + struct __deque_range { + iterator __pos_; + const iterator __end_; + + __deque_range(iterator __pos, iterator __e) noexcept + : __pos_(__pos), __end_(__e) {} + + explicit operator bool() const noexcept { + return __pos_ != __end_; + } + + __deque_range begin() const { + return *this; + } + + __deque_range end() const { + return __deque_range(__end_, __end_); + } + __deque_block_range operator*() const noexcept { + if (__pos_.__m_iter_ == __end_.__m_iter_) { + return __deque_block_range(__pos_.__ptr_, __end_.__ptr_); + } + return __deque_block_range(__pos_.__ptr_, *__pos_.__m_iter_ + __block_size); + } + + __deque_range& operator++() noexcept { + if (__pos_.__m_iter_ == __end_.__m_iter_) { + __pos_ = __end_; + } else { + ++__pos_.__m_iter_; + __pos_.__ptr_ = *__pos_.__m_iter_; + } + return *this; + } + + + friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) { + return __lhs.__pos_ == __rhs.__pos_; + } + friend bool operator!=(__deque_range const& __lhs, __deque_range const& __rhs) { + return !(__lhs == __rhs); + } + }; + + + + struct _ConstructTransaction { + _ConstructTransaction(__deque_base* __db, __deque_block_range& __r) + : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {} + + + ~_ConstructTransaction() { + __base_->size() += (__pos_ - __begin_); + } + + pointer __pos_; + const pointer __end_; + private: + const pointer __begin_; + __deque_base * const __base_; + }; + +protected: + __map __map_; + size_type __start_; + __compressed_pair __size_; + + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY size_type& size() {return __size_.first();} + _LIBCUDACXX_INLINE_VISIBILITY + const size_type& size() const noexcept {return __size_.first();} + _LIBCUDACXX_INLINE_VISIBILITY allocator_type& __alloc() {return __size_.second();} + _LIBCUDACXX_INLINE_VISIBILITY + const allocator_type& __alloc() const noexcept {return __size_.second();} + + _LIBCUDACXX_INLINE_VISIBILITY + __deque_base() + noexcept(is_nothrow_default_constructible::value); + _LIBCUDACXX_INLINE_VISIBILITY + explicit __deque_base(const allocator_type& __a); +public: + ~__deque_base(); + + __deque_base(__deque_base&& __c) + noexcept(is_nothrow_move_constructible::value); + __deque_base(__deque_base&& __c, const allocator_type& __a); + + void swap(__deque_base& __c) +#if _LIBCUDACXX_STD_VER >= 14 + noexcept; +#else + noexcept(!__alloc_traits::propagate_on_container_swap::value || + __is_nothrow_swappable::value); +#endif +protected: + void clear() noexcept; + + bool __invariants() const; + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign(__deque_base& __c) + noexcept(__alloc_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value) + { + __map_ = _CUDA_VSTD::move(__c.__map_); + __start_ = __c.__start_; + size() = __c.size(); + __move_assign_alloc(__c); + __c.__start_ = __c.size() = 0; + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__deque_base& __c) + noexcept(!__alloc_traits::propagate_on_container_move_assignment::value || + is_nothrow_move_assignable::value) + {__move_assign_alloc(__c, integral_constant());} + +private: + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__deque_base& __c, true_type) + noexcept(is_nothrow_move_assignable::value) + { + __alloc() = _CUDA_VSTD::move(__c.__alloc()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__deque_base&, false_type) noexcept + {} +}; + +template +const typename __deque_base<_Tp, _Allocator>::difference_type + __deque_base<_Tp, _Allocator>::__block_size = + __deque_block_size::value; + +template +bool +__deque_base<_Tp, _Allocator>::__invariants() const +{ + if (!__map_.__invariants()) + return false; + if (__map_.size() >= size_type(-1) / __block_size) + return false; + for (typename __map::const_iterator __i = __map_.begin(), __e = __map_.end(); + __i != __e; ++__i) + if (*__i == nullptr) + return false; + if (__map_.size() != 0) + { + if (size() >= __map_.size() * __block_size) + return false; + if (__start_ >= __map_.size() * __block_size - size()) + return false; + } + else + { + if (size() != 0) + return false; + if (__start_ != 0) + return false; + } + return true; +} + +template +typename __deque_base<_Tp, _Allocator>::iterator +__deque_base<_Tp, _Allocator>::begin() noexcept +{ + __map_pointer __mp = __map_.begin() + __start_ / __block_size; + return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); +} + +template +typename __deque_base<_Tp, _Allocator>::const_iterator +__deque_base<_Tp, _Allocator>::begin() const noexcept +{ + __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size); + return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); +} + +template +typename __deque_base<_Tp, _Allocator>::iterator +__deque_base<_Tp, _Allocator>::end() noexcept +{ + size_type __p = size() + __start_; + __map_pointer __mp = __map_.begin() + __p / __block_size; + return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); +} + +template +typename __deque_base<_Tp, _Allocator>::const_iterator +__deque_base<_Tp, _Allocator>::end() const noexcept +{ + size_type __p = size() + __start_; + __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size); + return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); +} + +template +inline +__deque_base<_Tp, _Allocator>::__deque_base() + noexcept(is_nothrow_default_constructible::value) + : __start_(0), __size_(0) {} + +template +inline +__deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a) + : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {} + +template +__deque_base<_Tp, _Allocator>::~__deque_base() +{ + clear(); + typename __map::iterator __i = __map_.begin(); + typename __map::iterator __e = __map_.end(); + for (; __i != __e; ++__i) + __alloc_traits::deallocate(__alloc(), *__i, __block_size); +} + +template +__deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c) + noexcept(is_nothrow_move_constructible::value) + : __map_(_CUDA_VSTD::move(__c.__map_)), + __start_(_CUDA_VSTD::move(__c.__start_)), + __size_(_CUDA_VSTD::move(__c.__size_)) +{ + __c.__start_ = 0; + __c.size() = 0; +} + +template +__deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_type& __a) + : __map_(_CUDA_VSTD::move(__c.__map_), __pointer_allocator(__a)), + __start_(_CUDA_VSTD::move(__c.__start_)), + __size_(_CUDA_VSTD::move(__c.size()), __a) +{ + if (__a == __c.__alloc()) + { + __c.__start_ = 0; + __c.size() = 0; + } + else + { + __map_.clear(); + __start_ = 0; + size() = 0; + } +} + +template +void +__deque_base<_Tp, _Allocator>::swap(__deque_base& __c) +#if _LIBCUDACXX_STD_VER >= 14 + noexcept +#else + noexcept(!__alloc_traits::propagate_on_container_swap::value || + __is_nothrow_swappable::value) +#endif +{ + __map_.swap(__c.__map_); + _CUDA_VSTD::swap(__start_, __c.__start_); + _CUDA_VSTD::swap(size(), __c.size()); + __swap_allocator(__alloc(), __c.__alloc()); +} + +template +void +__deque_base<_Tp, _Allocator>::clear() noexcept +{ + allocator_type& __a = __alloc(); + for (iterator __i = begin(), __e = end(); __i != __e; ++__i) + __alloc_traits::destroy(__a, _CUDA_VSTD::addressof(*__i)); + size() = 0; + while (__map_.size() > 2) + { + __alloc_traits::deallocate(__a, __map_.front(), __block_size); + __map_.pop_front(); + } + switch (__map_.size()) + { + case 1: + __start_ = __block_size / 2; + break; + case 2: + __start_ = __block_size; + break; + } +} + +template */> +class _LIBCUDACXX_TEMPLATE_VIS deque + : private __deque_base<_Tp, _Allocator> +{ +public: + // types: + + typedef _Tp value_type; + typedef _Allocator allocator_type; + + static_assert((is_same::value), + "Allocator::value_type must be same type as value_type"); + + typedef __deque_base __base; + + typedef typename __base::__alloc_traits __alloc_traits; + typedef typename __base::reference reference; + typedef typename __base::const_reference const_reference; + typedef typename __base::iterator iterator; + typedef typename __base::const_iterator const_iterator; + typedef typename __base::size_type size_type; + typedef typename __base::difference_type difference_type; + + typedef typename __base::pointer pointer; + typedef typename __base::const_pointer const_pointer; + typedef _CUDA_VSTD::reverse_iterator reverse_iterator; + typedef _CUDA_VSTD::reverse_iterator const_reverse_iterator; + + using typename __base::__deque_range; + using typename __base::__deque_block_range; + using typename __base::_ConstructTransaction; + + // construct/copy/destroy: + _LIBCUDACXX_INLINE_VISIBILITY + deque() + noexcept(is_nothrow_default_constructible::value) + {} + _LIBCUDACXX_INLINE_VISIBILITY explicit deque(const allocator_type& __a) : __base(__a) {} + explicit deque(size_type __n); +#if _LIBCUDACXX_STD_VER > 11 + explicit deque(size_type __n, const _Allocator& __a); +#endif + deque(size_type __n, const value_type& __v); + deque(size_type __n, const value_type& __v, const allocator_type& __a); + template + deque(_InputIter __f, _InputIter __l, + typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0); + template + deque(_InputIter __f, _InputIter __l, const allocator_type& __a, + typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0); + deque(const deque& __c); + deque(const deque& __c, const allocator_type& __a); + + deque& operator=(const deque& __c); + + deque(initializer_list __il); + deque(initializer_list __il, const allocator_type& __a); + + _LIBCUDACXX_INLINE_VISIBILITY + deque& operator=(initializer_list __il) {assign(__il); return *this;} + + _LIBCUDACXX_INLINE_VISIBILITY + deque(deque&& __c) noexcept(is_nothrow_move_constructible<__base>::value); + _LIBCUDACXX_INLINE_VISIBILITY + deque(deque&& __c, const allocator_type& __a); + _LIBCUDACXX_INLINE_VISIBILITY + deque& operator=(deque&& __c) + noexcept(__alloc_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value); + + _LIBCUDACXX_INLINE_VISIBILITY + void assign(initializer_list __il) {assign(__il.begin(), __il.end());} + + template + void assign(_InputIter __f, _InputIter __l, + typename enable_if<__is_cpp17_input_iterator<_InputIter>::value && + !__is_cpp17_random_access_iterator<_InputIter>::value>::type* = 0); + template + void assign(_RAIter __f, _RAIter __l, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); + void assign(size_type __n, const value_type& __v); + + _LIBCUDACXX_INLINE_VISIBILITY + allocator_type get_allocator() const noexcept; + + // iterators: + + _LIBCUDACXX_INLINE_VISIBILITY + iterator begin() noexcept {return __base::begin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator begin() const noexcept {return __base::begin();} + _LIBCUDACXX_INLINE_VISIBILITY + iterator end() noexcept {return __base::end();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator end() const noexcept {return __base::end();} + + _LIBCUDACXX_INLINE_VISIBILITY + reverse_iterator rbegin() noexcept + {return reverse_iterator(__base::end());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator rbegin() const noexcept + {return const_reverse_iterator(__base::end());} + _LIBCUDACXX_INLINE_VISIBILITY + reverse_iterator rend() noexcept + {return reverse_iterator(__base::begin());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator rend() const noexcept + {return const_reverse_iterator(__base::begin());} + + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cbegin() const noexcept + {return __base::begin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cend() const noexcept + {return __base::end();} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator crbegin() const noexcept + {return const_reverse_iterator(__base::end());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator crend() const noexcept + {return const_reverse_iterator(__base::begin());} + + // capacity: + _LIBCUDACXX_INLINE_VISIBILITY + size_type size() const noexcept {return __base::size();} + _LIBCUDACXX_INLINE_VISIBILITY + size_type max_size() const noexcept + {return std::min( + __alloc_traits::max_size(__base::__alloc()), + numeric_limits::max());} + void resize(size_type __n); + void resize(size_type __n, const value_type& __v); + void shrink_to_fit() noexcept; + _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY + bool empty() const noexcept {return __base::size() == 0;} + + // element access: + _LIBCUDACXX_INLINE_VISIBILITY + reference operator[](size_type __i) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + const_reference operator[](size_type __i) const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + reference at(size_type __i); + _LIBCUDACXX_INLINE_VISIBILITY + const_reference at(size_type __i) const; + _LIBCUDACXX_INLINE_VISIBILITY + reference front() noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + const_reference front() const noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + reference back() noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + const_reference back() const noexcept; + + // 23.2.2.3 modifiers: + void push_front(const value_type& __v); + void push_back(const value_type& __v); +#if _LIBCUDACXX_STD_VER > 14 + template reference emplace_front(_Args&&... __args); + template reference emplace_back (_Args&&... __args); +#else + template void emplace_front(_Args&&... __args); + template void emplace_back (_Args&&... __args); +#endif + template iterator emplace(const_iterator __p, _Args&&... __args); + + void push_front(value_type&& __v); + void push_back(value_type&& __v); + iterator insert(const_iterator __p, value_type&& __v); + + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(const_iterator __p, initializer_list __il) + {return insert(__p, __il.begin(), __il.end());} + iterator insert(const_iterator __p, const value_type& __v); + iterator insert(const_iterator __p, size_type __n, const value_type& __v); + template + iterator insert(const_iterator __p, _InputIter __f, _InputIter __l, + typename enable_if<__is_cpp17_input_iterator<_InputIter>::value + &&!__is_cpp17_forward_iterator<_InputIter>::value>::type* = 0); + template + iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l, + typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value + &&!__is_cpp17_bidirectional_iterator<_ForwardIterator>::value>::type* = 0); + template + iterator insert(const_iterator __p, _BiIter __f, _BiIter __l, + typename enable_if<__is_cpp17_bidirectional_iterator<_BiIter>::value>::type* = 0); + + void pop_front(); + void pop_back(); + iterator erase(const_iterator __p); + iterator erase(const_iterator __f, const_iterator __l); + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(deque& __c) +#if _LIBCUDACXX_STD_VER >= 14 + noexcept; +#else + noexcept(!__alloc_traits::propagate_on_container_swap::value || + __is_nothrow_swappable::value); +#endif + _LIBCUDACXX_INLINE_VISIBILITY + void clear() noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + bool __invariants() const {return __base::__invariants();} + + typedef typename __base::__map_const_pointer __map_const_pointer; + + _LIBCUDACXX_INLINE_VISIBILITY + static size_type __recommend_blocks(size_type __n) + { + return __n / __base::__block_size + (__n % __base::__block_size != 0); + } + _LIBCUDACXX_INLINE_VISIBILITY + size_type __capacity() const + { + return __base::__map_.size() == 0 ? 0 : __base::__map_.size() * __base::__block_size - 1; + } + _LIBCUDACXX_INLINE_VISIBILITY + size_type __block_count() const + { + return __base::__map_.size(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + size_type __front_spare() const + { + return __base::__start_; + } + _LIBCUDACXX_INLINE_VISIBILITY + size_type __front_spare_blocks() const { + return __front_spare() / __base::__block_size; + } + _LIBCUDACXX_INLINE_VISIBILITY + size_type __back_spare() const + { + return __capacity() - (__base::__start_ + __base::size()); + } + _LIBCUDACXX_INLINE_VISIBILITY + size_type __back_spare_blocks() const { + return __back_spare() / __base::__block_size; + } + + private: + _LIBCUDACXX_INLINE_VISIBILITY + bool __maybe_remove_front_spare(bool __keep_one = true) { + if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) { + __alloc_traits::deallocate(__base::__alloc(), __base::__map_.front(), + __base::__block_size); + __base::__map_.pop_front(); + __base::__start_ -= __base::__block_size; + return true; + } + return false; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool __maybe_remove_back_spare(bool __keep_one = true) { + if (__back_spare_blocks() >= 2 || (!__keep_one && __back_spare_blocks())) { + __alloc_traits::deallocate(__base::__alloc(), __base::__map_.back(), + __base::__block_size); + __base::__map_.pop_back(); + return true; + } + return false; + } + + template + void __append(_InpIter __f, _InpIter __l, + typename enable_if<__is_cpp17_input_iterator<_InpIter>::value && + !__is_cpp17_forward_iterator<_InpIter>::value>::type* = 0); + template + void __append(_ForIter __f, _ForIter __l, + typename enable_if<__is_cpp17_forward_iterator<_ForIter>::value>::type* = 0); + void __append(size_type __n); + void __append(size_type __n, const value_type& __v); + void __erase_to_end(const_iterator __f); + void __add_front_capacity(); + void __add_front_capacity(size_type __n); + void __add_back_capacity(); + void __add_back_capacity(size_type __n); + iterator __move_and_check(iterator __f, iterator __l, iterator __r, + const_pointer& __vt); + iterator __move_backward_and_check(iterator __f, iterator __l, iterator __r, + const_pointer& __vt); + void __move_construct_and_check(iterator __f, iterator __l, + iterator __r, const_pointer& __vt); + void __move_construct_backward_and_check(iterator __f, iterator __l, + iterator __r, const_pointer& __vt); + + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const deque& __c) + {__copy_assign_alloc(__c, integral_constant());} + + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const deque& __c, true_type) + { + if (__base::__alloc() != __c.__alloc()) + { + clear(); + shrink_to_fit(); + } + __base::__alloc() = __c.__alloc(); + __base::__map_.__alloc() = __c.__map_.__alloc(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const deque&, false_type) + {} + + void __move_assign(deque& __c, true_type) + noexcept(is_nothrow_move_assignable::value); + void __move_assign(deque& __c, false_type); +}; + +#ifndef _LIBCUDACXX_HAS_NO_DEDUCTION_GUIDES +template::value_type>, + class = typename enable_if<__is_allocator<_Alloc>::value, void>::type + > +deque(_InputIterator, _InputIterator) + -> deque::value_type, _Alloc>; + +template::value, void>::type + > +deque(_InputIterator, _InputIterator, _Alloc) + -> deque::value_type, _Alloc>; +#endif + + +template +deque<_Tp, _Allocator>::deque(size_type __n) +{ + if (__n > 0) + __append(__n); +} + +#if _LIBCUDACXX_STD_VER > 11 +template +deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) + : __base(__a) +{ + if (__n > 0) + __append(__n); +} +#endif + +template +deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) +{ + if (__n > 0) + __append(__n, __v); +} + +template +deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v, const allocator_type& __a) + : __base(__a) +{ + if (__n > 0) + __append(__n, __v); +} + +template +template +deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, + typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type*) +{ + __append(__f, __l); +} + +template +template +deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a, + typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type*) + : __base(__a) +{ + __append(__f, __l); +} + +template +deque<_Tp, _Allocator>::deque(const deque& __c) + : __base(__alloc_traits::select_on_container_copy_construction(__c.__alloc())) +{ + __append(__c.begin(), __c.end()); +} + +template +deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a) + : __base(__a) +{ + __append(__c.begin(), __c.end()); +} + +template +deque<_Tp, _Allocator>& +deque<_Tp, _Allocator>::operator=(const deque& __c) +{ + if (this != &__c) + { + __copy_assign_alloc(__c); + assign(__c.begin(), __c.end()); + } + return *this; +} + +template +deque<_Tp, _Allocator>::deque(initializer_list __il) +{ + __append(__il.begin(), __il.end()); +} + +template +deque<_Tp, _Allocator>::deque(initializer_list __il, const allocator_type& __a) + : __base(__a) +{ + __append(__il.begin(), __il.end()); +} + +template +inline +deque<_Tp, _Allocator>::deque(deque&& __c) + noexcept(is_nothrow_move_constructible<__base>::value) + : __base(_CUDA_VSTD::move(__c)) +{ +} + +template +inline +deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a) + : __base(_CUDA_VSTD::move(__c), __a) +{ + if (__a != __c.__alloc()) + { + typedef move_iterator _Ip; + assign(_Ip(__c.begin()), _Ip(__c.end())); + } +} + +template +inline +deque<_Tp, _Allocator>& +deque<_Tp, _Allocator>::operator=(deque&& __c) + noexcept(__alloc_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value) +{ + __move_assign(__c, integral_constant()); + return *this; +} + +template +void +deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) +{ + if (__base::__alloc() != __c.__alloc()) + { + typedef move_iterator _Ip; + assign(_Ip(__c.begin()), _Ip(__c.end())); + } + else + __move_assign(__c, true_type()); +} + +template +void +deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type) + noexcept(is_nothrow_move_assignable::value) +{ + clear(); + shrink_to_fit(); + __base::__move_assign(__c); +} + +template +template +void +deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l, + typename enable_if<__is_cpp17_input_iterator<_InputIter>::value && + !__is_cpp17_random_access_iterator<_InputIter>::value>::type*) +{ + iterator __i = __base::begin(); + iterator __e = __base::end(); + for (; __f != __l && __i != __e; ++__f, (void) ++__i) + *__i = *__f; + if (__f != __l) + __append(__f, __l); + else + __erase_to_end(__i); +} + +template +template +void +deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l, + typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) +{ + if (static_cast(__l - __f) > __base::size()) + { + _RAIter __m = __f + __base::size(); + _CUDA_VSTD::copy(__f, __m, __base::begin()); + __append(__m, __l); + } + else + __erase_to_end(_CUDA_VSTD::copy(__f, __l, __base::begin())); +} + +template +void +deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v) +{ + if (__n > __base::size()) + { + _CUDA_VSTD::fill_n(__base::begin(), __base::size(), __v); + __n -= __base::size(); + __append(__n, __v); + } + else + __erase_to_end(_CUDA_VSTD::fill_n(__base::begin(), __n, __v)); +} + +template +inline +_Allocator +deque<_Tp, _Allocator>::get_allocator() const noexcept +{ + return __base::__alloc(); +} + +template +void +deque<_Tp, _Allocator>::resize(size_type __n) +{ + if (__n > __base::size()) + __append(__n - __base::size()); + else if (__n < __base::size()) + __erase_to_end(__base::begin() + __n); +} + +template +void +deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v) +{ + if (__n > __base::size()) + __append(__n - __base::size(), __v); + else if (__n < __base::size()) + __erase_to_end(__base::begin() + __n); +} + +template +void +deque<_Tp, _Allocator>::shrink_to_fit() noexcept +{ + allocator_type& __a = __base::__alloc(); + if (empty()) + { + while (__base::__map_.size() > 0) + { + __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size); + __base::__map_.pop_back(); + } + __base::__start_ = 0; + } + else + { + __maybe_remove_front_spare(/*__keep_one=*/false); + __maybe_remove_back_spare(/*__keep_one=*/false); + } + __base::__map_.shrink_to_fit(); +} + +template +inline +typename deque<_Tp, _Allocator>::reference +deque<_Tp, _Allocator>::operator[](size_type __i) noexcept +{ + size_type __p = __base::__start_ + __i; + return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); +} + +template +inline +typename deque<_Tp, _Allocator>::const_reference +deque<_Tp, _Allocator>::operator[](size_type __i) const noexcept +{ + size_type __p = __base::__start_ + __i; + return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); +} + +template +inline +typename deque<_Tp, _Allocator>::reference +deque<_Tp, _Allocator>::at(size_type __i) +{ + if (__i >= __base::size()) + __base::__throw_out_of_range(); + size_type __p = __base::__start_ + __i; + return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); +} + +template +inline +typename deque<_Tp, _Allocator>::const_reference +deque<_Tp, _Allocator>::at(size_type __i) const +{ + if (__i >= __base::size()) + __base::__throw_out_of_range(); + size_type __p = __base::__start_ + __i; + return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); +} + +template +inline +typename deque<_Tp, _Allocator>::reference +deque<_Tp, _Allocator>::front() noexcept +{ + return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size) + + __base::__start_ % __base::__block_size); +} + +template +inline +typename deque<_Tp, _Allocator>::const_reference +deque<_Tp, _Allocator>::front() const noexcept +{ + return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size) + + __base::__start_ % __base::__block_size); +} + +template +inline +typename deque<_Tp, _Allocator>::reference +deque<_Tp, _Allocator>::back() noexcept +{ + size_type __p = __base::size() + __base::__start_ - 1; + return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); +} + +template +inline +typename deque<_Tp, _Allocator>::const_reference +deque<_Tp, _Allocator>::back() const noexcept +{ + size_type __p = __base::size() + __base::__start_ - 1; + return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); +} + +template +void +deque<_Tp, _Allocator>::push_back(const value_type& __v) +{ + allocator_type& __a = __base::__alloc(); + if (__back_spare() == 0) + __add_back_capacity(); + // __back_spare() >= 1 + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__base::end()), __v); + ++__base::size(); +} + +template +void +deque<_Tp, _Allocator>::push_front(const value_type& __v) +{ + allocator_type& __a = __base::__alloc(); + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*--__base::begin()), __v); + --__base::__start_; + ++__base::size(); +} + +template +void +deque<_Tp, _Allocator>::push_back(value_type&& __v) +{ + allocator_type& __a = __base::__alloc(); + if (__back_spare() == 0) + __add_back_capacity(); + // __back_spare() >= 1 + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__base::end()), _CUDA_VSTD::move(__v)); + ++__base::size(); +} + +template +template +#if _LIBCUDACXX_STD_VER > 14 +typename deque<_Tp, _Allocator>::reference +#else +void +#endif +deque<_Tp, _Allocator>::emplace_back(_Args&&... __args) +{ + allocator_type& __a = __base::__alloc(); + if (__back_spare() == 0) + __add_back_capacity(); + // __back_spare() >= 1 + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__base::end()), + _CUDA_VSTD::forward<_Args>(__args)...); + ++__base::size(); +#if _LIBCUDACXX_STD_VER > 14 + return *--__base::end(); +#endif +} + +template +void +deque<_Tp, _Allocator>::push_front(value_type&& __v) +{ + allocator_type& __a = __base::__alloc(); + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*--__base::begin()), _CUDA_VSTD::move(__v)); + --__base::__start_; + ++__base::size(); +} + + +template +template +#if _LIBCUDACXX_STD_VER > 14 +typename deque<_Tp, _Allocator>::reference +#else +void +#endif +deque<_Tp, _Allocator>::emplace_front(_Args&&... __args) +{ + allocator_type& __a = __base::__alloc(); + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*--__base::begin()), _CUDA_VSTD::forward<_Args>(__args)...); + --__base::__start_; + ++__base::size(); +#if _LIBCUDACXX_STD_VER > 14 + return *__base::begin(); +#endif +} + +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) +{ + size_type __pos = __p - __base::begin(); + size_type __to_end = __base::size() - __pos; + allocator_type& __a = __base::__alloc(); + if (__pos < __to_end) + { // insert by shifting things backward + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + if (__pos == 0) + { + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*--__base::begin()), _CUDA_VSTD::move(__v)); + --__base::__start_; + ++__base::size(); + } + else + { + iterator __b = __base::begin(); + iterator __bm1 = _CUDA_VSTD::prev(__b); + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__bm1), _CUDA_VSTD::move(*__b)); + --__base::__start_; + ++__base::size(); + if (__pos > 1) + __b = _CUDA_VSTD::move(_CUDA_VSTD::next(__b), __b + __pos, __b); + *__b = _CUDA_VSTD::move(__v); + } + } + else + { // insert by shifting things forward + if (__back_spare() == 0) + __add_back_capacity(); + // __back_capacity >= 1 + size_type __de = __base::size() - __pos; + if (__de == 0) + { + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__base::end()), _CUDA_VSTD::move(__v)); + ++__base::size(); + } + else + { + iterator __e = __base::end(); + iterator __em1 = _CUDA_VSTD::prev(__e); + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__e), _CUDA_VSTD::move(*__em1)); + ++__base::size(); + if (__de > 1) + __e = _CUDA_VSTD::move_backward(__e - __de, __em1, __e); + *--__e = _CUDA_VSTD::move(__v); + } + } + return __base::begin() + __pos; +} + +template +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) +{ + size_type __pos = __p - __base::begin(); + size_type __to_end = __base::size() - __pos; + allocator_type& __a = __base::__alloc(); + if (__pos < __to_end) + { // insert by shifting things backward + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + if (__pos == 0) + { + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*--__base::begin()), _CUDA_VSTD::forward<_Args>(__args)...); + --__base::__start_; + ++__base::size(); + } + else + { + __temp_value __tmp(this->__alloc(), _CUDA_VSTD::forward<_Args>(__args)...); + iterator __b = __base::begin(); + iterator __bm1 = _CUDA_VSTD::prev(__b); + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__bm1), _CUDA_VSTD::move(*__b)); + --__base::__start_; + ++__base::size(); + if (__pos > 1) + __b = _CUDA_VSTD::move(_CUDA_VSTD::next(__b), __b + __pos, __b); + *__b = _CUDA_VSTD::move(__tmp.get()); + } + } + else + { // insert by shifting things forward + if (__back_spare() == 0) + __add_back_capacity(); + // __back_capacity >= 1 + size_type __de = __base::size() - __pos; + if (__de == 0) + { + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__base::end()), _CUDA_VSTD::forward<_Args>(__args)...); + ++__base::size(); + } + else + { + __temp_value __tmp(this->__alloc(), _CUDA_VSTD::forward<_Args>(__args)...); + iterator __e = __base::end(); + iterator __em1 = _CUDA_VSTD::prev(__e); + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__e), _CUDA_VSTD::move(*__em1)); + ++__base::size(); + if (__de > 1) + __e = _CUDA_VSTD::move_backward(__e - __de, __em1, __e); + *--__e = _CUDA_VSTD::move(__tmp.get()); + } + } + return __base::begin() + __pos; +} + + +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) +{ + size_type __pos = __p - __base::begin(); + size_type __to_end = __base::size() - __pos; + allocator_type& __a = __base::__alloc(); + if (__pos < __to_end) + { // insert by shifting things backward + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + if (__pos == 0) + { + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*--__base::begin()), __v); + --__base::__start_; + ++__base::size(); + } + else + { + const_pointer __vt = pointer_traits::pointer_to(__v); + iterator __b = __base::begin(); + iterator __bm1 = _CUDA_VSTD::prev(__b); + if (__vt == pointer_traits::pointer_to(*__b)) + __vt = pointer_traits::pointer_to(*__bm1); + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__bm1), _CUDA_VSTD::move(*__b)); + --__base::__start_; + ++__base::size(); + if (__pos > 1) + __b = __move_and_check(_CUDA_VSTD::next(__b), __b + __pos, __b, __vt); + *__b = *__vt; + } + } + else + { // insert by shifting things forward + if (__back_spare() == 0) + __add_back_capacity(); + // __back_capacity >= 1 + size_type __de = __base::size() - __pos; + if (__de == 0) + { + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__base::end()), __v); + ++__base::size(); + } + else + { + const_pointer __vt = pointer_traits::pointer_to(__v); + iterator __e = __base::end(); + iterator __em1 = _CUDA_VSTD::prev(__e); + if (__vt == pointer_traits::pointer_to(*__em1)) + __vt = pointer_traits::pointer_to(*__e); + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__e), _CUDA_VSTD::move(*__em1)); + ++__base::size(); + if (__de > 1) + __e = __move_backward_and_check(__e - __de, __em1, __e, __vt); + *--__e = *__vt; + } + } + return __base::begin() + __pos; +} + +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v) +{ + size_type __pos = __p - __base::begin(); + size_type __to_end = __base::size() - __pos; + allocator_type& __a = __base::__alloc(); + if (__pos < __to_end) + { // insert by shifting things backward + if (__n > __front_spare()) + __add_front_capacity(__n - __front_spare()); + // __n <= __front_spare() + iterator __old_begin = __base::begin(); + iterator __i = __old_begin; + if (__n > __pos) + { + for (size_type __m = __n - __pos; __m; --__m, --__base::__start_, ++__base::size()) + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*--__i), __v); + __n = __pos; + } + if (__n > 0) + { + const_pointer __vt = pointer_traits::pointer_to(__v); + iterator __obn = __old_begin + __n; + __move_construct_backward_and_check(__old_begin, __obn, __i, __vt); + if (__n < __pos) + __old_begin = __move_and_check(__obn, __old_begin + __pos, __old_begin, __vt); + _CUDA_VSTD::fill_n(__old_begin, __n, *__vt); + } + } + else + { // insert by shifting things forward + size_type __back_capacity = __back_spare(); + if (__n > __back_capacity) + __add_back_capacity(__n - __back_capacity); + // __n <= __back_capacity + iterator __old_end = __base::end(); + iterator __i = __old_end; + size_type __de = __base::size() - __pos; + if (__n > __de) + { + for (size_type __m = __n - __de; __m; --__m, ++__i, ++__base::size()) + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__i), __v); + __n = __de; + } + if (__n > 0) + { + const_pointer __vt = pointer_traits::pointer_to(__v); + iterator __oen = __old_end - __n; + __move_construct_and_check(__oen, __old_end, __i, __vt); + if (__n < __de) + __old_end = __move_backward_and_check(__old_end - __de, __oen, __old_end, __vt); + _CUDA_VSTD::fill_n(__old_end - __n, __n, *__vt); + } + } + return __base::begin() + __pos; +} + +template +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l, + typename enable_if<__is_cpp17_input_iterator<_InputIter>::value + &&!__is_cpp17_forward_iterator<_InputIter>::value>::type*) +{ + __split_buffer __buf(__base::__alloc()); + __buf.__construct_at_end(__f, __l); + typedef typename __split_buffer::iterator __bi; + return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end())); +} + +template +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l, + typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value + &&!__is_cpp17_bidirectional_iterator<_ForwardIterator>::value>::type*) +{ + size_type __n = _CUDA_VSTD::distance(__f, __l); + __split_buffer __buf(__n, 0, __base::__alloc()); + __buf.__construct_at_end(__f, __l); + typedef typename __split_buffer::iterator __fwd; + return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end())); +} + +template +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l, + typename enable_if<__is_cpp17_bidirectional_iterator<_BiIter>::value>::type*) +{ + size_type __n = _CUDA_VSTD::distance(__f, __l); + size_type __pos = __p - __base::begin(); + size_type __to_end = __base::size() - __pos; + allocator_type& __a = __base::__alloc(); + if (__pos < __to_end) + { // insert by shifting things backward + if (__n > __front_spare()) + __add_front_capacity(__n - __front_spare()); + // __n <= __front_spare() + iterator __old_begin = __base::begin(); + iterator __i = __old_begin; + _BiIter __m = __f; + if (__n > __pos) + { + __m = __pos < __n / 2 ? _CUDA_VSTD::prev(__l, __pos) : _CUDA_VSTD::next(__f, __n - __pos); + for (_BiIter __j = __m; __j != __f; --__base::__start_, ++__base::size()) + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*--__i), *--__j); + __n = __pos; + } + if (__n > 0) + { + iterator __obn = __old_begin + __n; + for (iterator __j = __obn; __j != __old_begin;) + { + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*--__i), _CUDA_VSTD::move(*--__j)); + --__base::__start_; + ++__base::size(); + } + if (__n < __pos) + __old_begin = _CUDA_VSTD::move(__obn, __old_begin + __pos, __old_begin); + _CUDA_VSTD::copy(__m, __l, __old_begin); + } + } + else + { // insert by shifting things forward + size_type __back_capacity = __back_spare(); + if (__n > __back_capacity) + __add_back_capacity(__n - __back_capacity); + // __n <= __back_capacity + iterator __old_end = __base::end(); + iterator __i = __old_end; + _BiIter __m = __l; + size_type __de = __base::size() - __pos; + if (__n > __de) + { + __m = __de < __n / 2 ? _CUDA_VSTD::next(__f, __de) : _CUDA_VSTD::prev(__l, __n - __de); + for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__base::size()) + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__i), *__j); + __n = __de; + } + if (__n > 0) + { + iterator __oen = __old_end - __n; + for (iterator __j = __oen; __j != __old_end; ++__i, (void)++__j, ++__base::size()) + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__i), _CUDA_VSTD::move(*__j)); + if (__n < __de) + __old_end = _CUDA_VSTD::move_backward(__old_end - __de, __oen, __old_end); + _CUDA_VSTD::copy_backward(__f, __m, __old_end); + } + } + return __base::begin() + __pos; +} + +template +template +void +deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l, + typename enable_if<__is_cpp17_input_iterator<_InpIter>::value && + !__is_cpp17_forward_iterator<_InpIter>::value>::type*) +{ + for (; __f != __l; ++__f) + emplace_back(*__f); +} + +template +template +void +deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l, + typename enable_if<__is_cpp17_forward_iterator<_ForIter>::value>::type*) +{ + size_type __n = _CUDA_VSTD::distance(__f, __l); + allocator_type& __a = __base::__alloc(); + size_type __back_capacity = __back_spare(); + if (__n > __back_capacity) + __add_back_capacity(__n - __back_capacity); + // __n <= __back_capacity + for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { + _ConstructTransaction __tx(this, __br); + for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) { + __alloc_traits::construct(__a, std::__to_raw_pointer(__tx.__pos_), *__f); + } + } +} + +template +void +deque<_Tp, _Allocator>::__append(size_type __n) +{ + allocator_type& __a = __base::__alloc(); + size_type __back_capacity = __back_spare(); + if (__n > __back_capacity) + __add_back_capacity(__n - __back_capacity); + // __n <= __back_capacity + for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { + _ConstructTransaction __tx(this, __br); + for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { + __alloc_traits::construct(__a, std::__to_raw_pointer(__tx.__pos_)); + } + } +} + +template +void +deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v) +{ + allocator_type& __a = __base::__alloc(); + size_type __back_capacity = __back_spare(); + if (__n > __back_capacity) + __add_back_capacity(__n - __back_capacity); + // __n <= __back_capacity + for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { + _ConstructTransaction __tx(this, __br); + for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { + __alloc_traits::construct(__a, std::__to_raw_pointer(__tx.__pos_), __v); + } + } + +} + +// Create front capacity for one block of elements. +// Strong guarantee. Either do it or don't touch anything. +template +void +deque<_Tp, _Allocator>::__add_front_capacity() +{ + allocator_type& __a = __base::__alloc(); + if (__back_spare() >= __base::__block_size) + { + __base::__start_ += __base::__block_size; + pointer __pt = __base::__map_.back(); + __base::__map_.pop_back(); + __base::__map_.push_front(__pt); + } + // Else if __base::__map_.size() < __base::__map_.capacity() then we need to allocate 1 buffer + else if (__base::__map_.size() < __base::__map_.capacity()) + { // we can put the new buffer into the map, but don't shift things around + // until all buffers are allocated. If we throw, we don't need to fix + // anything up (any added buffers are undetectible) + if (__base::__map_.__front_spare() > 0) + __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); + else + { + __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); + // Done allocating, reorder capacity + pointer __pt = __base::__map_.back(); + __base::__map_.pop_back(); + __base::__map_.push_front(__pt); + } + __base::__start_ = __base::__map_.size() == 1 ? + __base::__block_size / 2 : + __base::__start_ + __base::__block_size; + } + // Else need to allocate 1 buffer, *and* we need to reallocate __map_. + else + { + __split_buffer + __buf(max(2 * __base::__map_.capacity(), 1), + 0, __base::__map_.__alloc()); + + typedef __allocator_destructor<_Allocator> _Dp; + unique_ptr __hold( + __alloc_traits::allocate(__a, __base::__block_size), + _Dp(__a, __base::__block_size)); + __buf.push_back(__hold.get()); + __hold.release(); + + for (typename __base::__map_pointer __i = __base::__map_.begin(); + __i != __base::__map_.end(); ++__i) + __buf.push_back(*__i); + _CUDA_VSTD::swap(__base::__map_.__first_, __buf.__first_); + _CUDA_VSTD::swap(__base::__map_.__begin_, __buf.__begin_); + _CUDA_VSTD::swap(__base::__map_.__end_, __buf.__end_); + _CUDA_VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap()); + __base::__start_ = __base::__map_.size() == 1 ? + __base::__block_size / 2 : + __base::__start_ + __base::__block_size; + } +} + +// Create front capacity for __n elements. +// Strong guarantee. Either do it or don't touch anything. +template +void +deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) +{ + allocator_type& __a = __base::__alloc(); + size_type __nb = __recommend_blocks(__n + __base::__map_.empty()); + // Number of unused blocks at back: + size_type __back_capacity = __back_spare() / __base::__block_size; + __back_capacity = _CUDA_VSTD::min(__back_capacity, __nb); // don't take more than you need + __nb -= __back_capacity; // number of blocks need to allocate + // If __nb == 0, then we have sufficient capacity. + if (__nb == 0) + { + __base::__start_ += __base::__block_size * __back_capacity; + for (; __back_capacity > 0; --__back_capacity) + { + pointer __pt = __base::__map_.back(); + __base::__map_.pop_back(); + __base::__map_.push_front(__pt); + } + } + // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers + else if (__nb <= __base::__map_.capacity() - __base::__map_.size()) + { // we can put the new buffers into the map, but don't shift things around + // until all buffers are allocated. If we throw, we don't need to fix + // anything up (any added buffers are undetectible) + for (; __nb > 0; --__nb, __base::__start_ += __base::__block_size - (__base::__map_.size() == 1)) + { + if (__base::__map_.__front_spare() == 0) + break; + __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); + } + for (; __nb > 0; --__nb, ++__back_capacity) + __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); + // Done allocating, reorder capacity + __base::__start_ += __back_capacity * __base::__block_size; + for (; __back_capacity > 0; --__back_capacity) + { + pointer __pt = __base::__map_.back(); + __base::__map_.pop_back(); + __base::__map_.push_front(__pt); + } + } + // Else need to allocate __nb buffers, *and* we need to reallocate __map_. + else + { + size_type __ds = (__nb + __back_capacity) * __base::__block_size - __base::__map_.empty(); + __split_buffer + __buf(max(2* __base::__map_.capacity(), + __nb + __base::__map_.size()), + 0, __base::__map_.__alloc()); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (; __nb > 0; --__nb) + __buf.push_back(__alloc_traits::allocate(__a, __base::__block_size)); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + for (typename __base::__map_pointer __i = __buf.begin(); + __i != __buf.end(); ++__i) + __alloc_traits::deallocate(__a, *__i, __base::__block_size); + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (; __back_capacity > 0; --__back_capacity) + { + __buf.push_back(__base::__map_.back()); + __base::__map_.pop_back(); + } + for (typename __base::__map_pointer __i = __base::__map_.begin(); + __i != __base::__map_.end(); ++__i) + __buf.push_back(*__i); + _CUDA_VSTD::swap(__base::__map_.__first_, __buf.__first_); + _CUDA_VSTD::swap(__base::__map_.__begin_, __buf.__begin_); + _CUDA_VSTD::swap(__base::__map_.__end_, __buf.__end_); + _CUDA_VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap()); + __base::__start_ += __ds; + } +} + +// Create back capacity for one block of elements. +// Strong guarantee. Either do it or don't touch anything. +template +void +deque<_Tp, _Allocator>::__add_back_capacity() +{ + allocator_type& __a = __base::__alloc(); + if (__front_spare() >= __base::__block_size) + { + __base::__start_ -= __base::__block_size; + pointer __pt = __base::__map_.front(); + __base::__map_.pop_front(); + __base::__map_.push_back(__pt); + } + // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers + else if (__base::__map_.size() < __base::__map_.capacity()) + { // we can put the new buffer into the map, but don't shift things around + // until it is allocated. If we throw, we don't need to fix + // anything up (any added buffers are undetectible) + if (__base::__map_.__back_spare() != 0) + __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); + else + { + __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); + // Done allocating, reorder capacity + pointer __pt = __base::__map_.front(); + __base::__map_.pop_front(); + __base::__map_.push_back(__pt); + } + } + // Else need to allocate 1 buffer, *and* we need to reallocate __map_. + else + { + __split_buffer + __buf(max(2* __base::__map_.capacity(), 1), + __base::__map_.size(), + __base::__map_.__alloc()); + + typedef __allocator_destructor<_Allocator> _Dp; + unique_ptr __hold( + __alloc_traits::allocate(__a, __base::__block_size), + _Dp(__a, __base::__block_size)); + __buf.push_back(__hold.get()); + __hold.release(); + + for (typename __base::__map_pointer __i = __base::__map_.end(); + __i != __base::__map_.begin();) + __buf.push_front(*--__i); + _CUDA_VSTD::swap(__base::__map_.__first_, __buf.__first_); + _CUDA_VSTD::swap(__base::__map_.__begin_, __buf.__begin_); + _CUDA_VSTD::swap(__base::__map_.__end_, __buf.__end_); + _CUDA_VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap()); + } +} + +// Create back capacity for __n elements. +// Strong guarantee. Either do it or don't touch anything. +template +void +deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) +{ + allocator_type& __a = __base::__alloc(); + size_type __nb = __recommend_blocks(__n + __base::__map_.empty()); + // Number of unused blocks at front: + size_type __front_capacity = __front_spare() / __base::__block_size; + __front_capacity = _CUDA_VSTD::min(__front_capacity, __nb); // don't take more than you need + __nb -= __front_capacity; // number of blocks need to allocate + // If __nb == 0, then we have sufficient capacity. + if (__nb == 0) + { + __base::__start_ -= __base::__block_size * __front_capacity; + for (; __front_capacity > 0; --__front_capacity) + { + pointer __pt = __base::__map_.front(); + __base::__map_.pop_front(); + __base::__map_.push_back(__pt); + } + } + // Else if __nb <= __map_.capacity() - __map_.size() then we need to allocate __nb buffers + else if (__nb <= __base::__map_.capacity() - __base::__map_.size()) + { // we can put the new buffers into the map, but don't shift things around + // until all buffers are allocated. If we throw, we don't need to fix + // anything up (any added buffers are undetectible) + for (; __nb > 0; --__nb) + { + if (__base::__map_.__back_spare() == 0) + break; + __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); + } + for (; __nb > 0; --__nb, ++__front_capacity, __base::__start_ += + __base::__block_size - (__base::__map_.size() == 1)) + __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); + // Done allocating, reorder capacity + __base::__start_ -= __base::__block_size * __front_capacity; + for (; __front_capacity > 0; --__front_capacity) + { + pointer __pt = __base::__map_.front(); + __base::__map_.pop_front(); + __base::__map_.push_back(__pt); + } + } + // Else need to allocate __nb buffers, *and* we need to reallocate __map_. + else + { + size_type __ds = __front_capacity * __base::__block_size; + __split_buffer + __buf(max(2* __base::__map_.capacity(), + __nb + __base::__map_.size()), + __base::__map_.size() - __front_capacity, + __base::__map_.__alloc()); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (; __nb > 0; --__nb) + __buf.push_back(__alloc_traits::allocate(__a, __base::__block_size)); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + for (typename __base::__map_pointer __i = __buf.begin(); + __i != __buf.end(); ++__i) + __alloc_traits::deallocate(__a, *__i, __base::__block_size); + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (; __front_capacity > 0; --__front_capacity) + { + __buf.push_back(__base::__map_.front()); + __base::__map_.pop_front(); + } + for (typename __base::__map_pointer __i = __base::__map_.end(); + __i != __base::__map_.begin();) + __buf.push_front(*--__i); + _CUDA_VSTD::swap(__base::__map_.__first_, __buf.__first_); + _CUDA_VSTD::swap(__base::__map_.__begin_, __buf.__begin_); + _CUDA_VSTD::swap(__base::__map_.__end_, __buf.__end_); + _CUDA_VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap()); + __base::__start_ -= __ds; + } +} + +template +void +deque<_Tp, _Allocator>::pop_front() +{ + allocator_type& __a = __base::__alloc(); + __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() + + __base::__start_ / __base::__block_size) + + __base::__start_ % __base::__block_size)); + --__base::size(); + ++__base::__start_; + __maybe_remove_front_spare(); +} + +template +void +deque<_Tp, _Allocator>::pop_back() +{ + _LIBCUDACXX_ASSERT(!empty(), "deque::pop_back called for empty deque"); + allocator_type& __a = __base::__alloc(); + size_type __p = __base::size() + __base::__start_ - 1; + __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() + + __p / __base::__block_size) + + __p % __base::__block_size)); + --__base::size(); + __maybe_remove_back_spare(); +} + +// move assign [__f, __l) to [__r, __r + (__l-__f)). +// If __vt points into [__f, __l), then subtract (__f - __r) from __vt. +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __r, + const_pointer& __vt) +{ + // as if + // for (; __f != __l; ++__f, ++__r) + // *__r = _CUDA_VSTD::move(*__f); + difference_type __n = __l - __f; + while (__n > 0) + { + pointer __fb = __f.__ptr_; + pointer __fe = *__f.__m_iter_ + __base::__block_size; + difference_type __bs = __fe - __fb; + if (__bs > __n) + { + __bs = __n; + __fe = __fb + __bs; + } + if (__fb <= __vt && __vt < __fe) + __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_; + __r = _CUDA_VSTD::move(__fb, __fe, __r); + __n -= __bs; + __f += __bs; + } + return __r; +} + +// move assign [__f, __l) to [__r - (__l-__f), __r) backwards. +// If __vt points into [__f, __l), then add (__r - __l) to __vt. +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, iterator __r, + const_pointer& __vt) +{ + // as if + // while (__f != __l) + // *--__r = _CUDA_VSTD::move(*--__l); + difference_type __n = __l - __f; + while (__n > 0) + { + --__l; + pointer __lb = *__l.__m_iter_; + pointer __le = __l.__ptr_ + 1; + difference_type __bs = __le - __lb; + if (__bs > __n) + { + __bs = __n; + __lb = __le - __bs; + } + if (__lb <= __vt && __vt < __le) + __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_; + __r = _CUDA_VSTD::move_backward(__lb, __le, __r); + __n -= __bs; + __l -= __bs - 1; + } + return __r; +} + +// move construct [__f, __l) to [__r, __r + (__l-__f)). +// If __vt points into [__f, __l), then add (__r - __f) to __vt. +template +void +deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l, + iterator __r, const_pointer& __vt) +{ + allocator_type& __a = __base::__alloc(); + // as if + // for (; __f != __l; ++__r, ++__f, ++__base::size()) + // __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__r), _CUDA_VSTD::move(*__f)); + difference_type __n = __l - __f; + while (__n > 0) + { + pointer __fb = __f.__ptr_; + pointer __fe = *__f.__m_iter_ + __base::__block_size; + difference_type __bs = __fe - __fb; + if (__bs > __n) + { + __bs = __n; + __fe = __fb + __bs; + } + if (__fb <= __vt && __vt < __fe) + __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_; + for (; __fb != __fe; ++__fb, ++__r, ++__base::size()) + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*__r), _CUDA_VSTD::move(*__fb)); + __n -= __bs; + __f += __bs; + } +} + +// move construct [__f, __l) to [__r - (__l-__f), __r) backwards. +// If __vt points into [__f, __l), then subtract (__l - __r) from __vt. +template +void +deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterator __l, + iterator __r, const_pointer& __vt) +{ + allocator_type& __a = __base::__alloc(); + // as if + // for (iterator __j = __l; __j != __f;) + // { + // __alloc_traitsconstruct(__a, _CUDA_VSTD::addressof(*--__r), _CUDA_VSTD::move(*--__j)); + // --__base::__start_; + // ++__base::size(); + // } + difference_type __n = __l - __f; + while (__n > 0) + { + --__l; + pointer __lb = *__l.__m_iter_; + pointer __le = __l.__ptr_ + 1; + difference_type __bs = __le - __lb; + if (__bs > __n) + { + __bs = __n; + __lb = __le - __bs; + } + if (__lb <= __vt && __vt < __le) + __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_; + while (__le != __lb) + { + __alloc_traits::construct(__a, _CUDA_VSTD::addressof(*--__r), _CUDA_VSTD::move(*--__le)); + --__base::__start_; + ++__base::size(); + } + __n -= __bs; + __l -= __bs - 1; + } +} + +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::erase(const_iterator __f) +{ + iterator __b = __base::begin(); + difference_type __pos = __f - __b; + iterator __p = __b + __pos; + allocator_type& __a = __base::__alloc(); + if (static_cast(__pos) <= (__base::size() - 1) / 2) + { // erase from front + _CUDA_VSTD::move_backward(__b, __p, _CUDA_VSTD::next(__p)); + __alloc_traits::destroy(__a, _CUDA_VSTD::addressof(*__b)); + --__base::size(); + ++__base::__start_; + __maybe_remove_front_spare(); + } + else + { // erase from back + iterator __i = _CUDA_VSTD::move(_CUDA_VSTD::next(__p), __base::end(), __p); + __alloc_traits::destroy(__a, _CUDA_VSTD::addressof(*__i)); + --__base::size(); + __maybe_remove_back_spare(); + } + return __base::begin() + __pos; +} + +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) +{ + difference_type __n = __l - __f; + iterator __b = __base::begin(); + difference_type __pos = __f - __b; + iterator __p = __b + __pos; + if (__n > 0) + { + allocator_type& __a = __base::__alloc(); + if (static_cast(__pos) <= (__base::size() - __n) / 2) + { // erase from front + iterator __i = _CUDA_VSTD::move_backward(__b, __p, __p + __n); + for (; __b != __i; ++__b) + __alloc_traits::destroy(__a, _CUDA_VSTD::addressof(*__b)); + __base::size() -= __n; + __base::__start_ += __n; + while (__maybe_remove_front_spare()) { + } + } + else + { // erase from back + iterator __i = _CUDA_VSTD::move(__p + __n, __base::end(), __p); + for (iterator __e = __base::end(); __i != __e; ++__i) + __alloc_traits::destroy(__a, _CUDA_VSTD::addressof(*__i)); + __base::size() -= __n; + while (__maybe_remove_back_spare()) { + } + } + } + return __base::begin() + __pos; +} + +template +void +deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f) +{ + iterator __e = __base::end(); + difference_type __n = __e - __f; + if (__n > 0) + { + allocator_type& __a = __base::__alloc(); + iterator __b = __base::begin(); + difference_type __pos = __f - __b; + for (iterator __p = __b + __pos; __p != __e; ++__p) + __alloc_traits::destroy(__a, _CUDA_VSTD::addressof(*__p)); + __base::size() -= __n; + while (__maybe_remove_back_spare()) { + } + } +} + +template +inline +void +deque<_Tp, _Allocator>::swap(deque& __c) +#if _LIBCUDACXX_STD_VER >= 14 + noexcept +#else + noexcept(!__alloc_traits::propagate_on_container_swap::value || + __is_nothrow_swappable::value) +#endif +{ + __base::swap(__c); +} + +template +inline +void +deque<_Tp, _Allocator>::clear() noexcept +{ + __base::clear(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) +{ + const typename deque<_Tp, _Allocator>::size_type __sz = __x.size(); + return __sz == __y.size() && _CUDA_VSTD::equal(__x.begin(), __x.end(), __y.begin()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) +{ + return !(__x == __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) +{ + return _CUDA_VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) +{ + return __y < __x; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) +{ + return !(__x < __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) +{ + return !(__y < __x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) + noexcept(noexcept(__x.swap(__y))) +{ + __x.swap(__y); +} + +#if _LIBCUDACXX_STD_VER > 17 +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void erase(deque<_Tp, _Allocator>& __c, const _Up& __v) +{ __c.erase(_CUDA_VSTD::remove(__c.begin(), __c.end(), __v), __c.end()); } + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) +{ __c.erase(_CUDA_VSTD::remove_if(__c.begin(), __c.end(), __pred), __c.end()); } +#endif + + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX_DEQUE diff --git a/cuda_toolkit/include/device_atomic_functions.h b/cuda_toolkit/include/device_atomic_functions.h new file mode 100644 index 0000000000000000000000000000000000000000..ec179d418deecd49ee707a6bb838349da451351f --- /dev/null +++ b/cuda_toolkit/include/device_atomic_functions.h @@ -0,0 +1,193 @@ +/* + * Copyright 1993-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__DEVICE_ATOMIC_FUNCTIONS_H__) +#define __DEVICE_ATOMIC_FUNCTIONS_H__ + +//NOTE: For NVRTC, these declarations have been moved into the compiler (to reduce compile time) +#define EXCLUDE_FROM_RTC + +#if defined(__CUDACC_RTC__) +#define __DEVICE_ATOMIC_FUNCTIONS_DECL__ __device__ +#elif defined(_NVHPC_CUDA) +# define __DEVICE_ATOMIC_FUNCTIONS_DECL__ extern __device__ __cudart_builtin__ +#else /* __CUDACC_RTC__ */ +#define __DEVICE_ATOMIC_FUNCTIONS_DECL__ static __inline__ __device__ +#endif /* __CUDACC_RTC__ */ + +#if defined(__cplusplus) && defined(__CUDACC__) + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#include "cuda_runtime_api.h" + +/* Add !defined(_NVHPC_CUDA) to avoid empty function definition in PGI CUDA + * C++ compiler where the macro __CUDA_ARCH__ is not defined. */ +#if !defined(__CUDA_ARCH__) && !defined(_NVHPC_CUDA) +#define __DEF_IF_HOST { } +#else /* !__CUDA_ARCH__ */ +#define __DEF_IF_HOST ; +#endif /* __CUDA_ARCH__ */ + + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicAdd(int *address, int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicAdd(unsigned int *address, unsigned int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicSub(int *address, int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicSub(unsigned int *address, unsigned int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicExch(int *address, int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicExch(unsigned int *address, unsigned int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ float atomicExch(float *address, float val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicMin(int *address, int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicMin(unsigned int *address, unsigned int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicMax(int *address, int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicMax(unsigned int *address, unsigned int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicInc(unsigned int *address, unsigned int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicDec(unsigned int *address, unsigned int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicAnd(int *address, int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicAnd(unsigned int *address, unsigned int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicOr(int *address, int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicOr(unsigned int *address, unsigned int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicXor(int *address, int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicXor(unsigned int *address, unsigned int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicCAS(int *address, int compare, int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicCAS(unsigned int *address, unsigned int compare, unsigned int val) __DEF_IF_HOST + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#include "cuda_runtime_api.h" + +#if defined(_WIN32) +# define __DEPRECATED__(msg) __declspec(deprecated(msg)) +#elif (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5 && !defined(__clang__)))) +# define __DEPRECATED__(msg) __attribute__((deprecated)) +#else +# define __DEPRECATED__(msg) __attribute__((deprecated(msg))) +#endif + +#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 700 +#define __WSB_DEPRECATION_MESSAGE(x) #x"() is not valid on compute_70 and above, and should be replaced with "#x"_sync()."\ + "To continue using "#x"(), specify virtual architecture compute_60 when targeting sm_70 and above, for example, using the pair of compiler options: -arch=compute_60 -code=sm_70." +#elif defined(_NVHPC_CUDA) +#define __WSB_DEPRECATION_MESSAGE(x) #x"() is not valid on cc70 and above, and should be replaced with "#x"_sync()." +#else +#define __WSB_DEPRECATION_MESSAGE(x) #x"() is deprecated in favor of "#x"_sync() and may be removed in a future release (Use -Wno-deprecated-declarations to suppress this warning)." +#endif + +extern "C" +{ +extern __device__ __device_builtin__ __DEPRECATED__(__WSB_DEPRECATION_MESSAGE(__any)) int __any(int cond); +extern __device__ __device_builtin__ __DEPRECATED__(__WSB_DEPRECATION_MESSAGE(__all)) int __all(int cond); +} + + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned long long int atomicAdd(unsigned long long int *address, unsigned long long int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned long long int atomicExch(unsigned long long int *address, unsigned long long int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned long long int atomicCAS(unsigned long long int *address, unsigned long long int compare, unsigned long long int val) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ __DEPRECATED__(__WSB_DEPRECATION_MESSAGE(__any)) bool any(bool cond) __DEF_IF_HOST + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ __DEPRECATED__(__WSB_DEPRECATION_MESSAGE(__all)) bool all(bool cond) __DEF_IF_HOST + +#undef __DEPRECATED__ +#undef __WSB_DEPRECATION_MESSAGE + +#endif /* __cplusplus && __CUDACC__ */ + +#undef __DEF_IF_HOST +#undef __DEVICE_ATOMIC_FUNCTIONS_DECL__ + +#if !defined(__CUDACC_RTC__) && defined(__CUDA_ARCH__) +#include "device_atomic_functions.hpp" +#endif /* !__CUDACC_RTC__ && defined(__CUDA_ARCH__) */ + +#undef EXCLUDE_FROM_RTC + +#endif /* !__DEVICE_ATOMIC_FUNCTIONS_H__ */ diff --git a/cuda_toolkit/include/device_atomic_functions.hpp b/cuda_toolkit/include/device_atomic_functions.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cbe015a24c82ce95a2ab0db6c34c6cf55e019e14 --- /dev/null +++ b/cuda_toolkit/include/device_atomic_functions.hpp @@ -0,0 +1,254 @@ +/* + * Copyright 1993-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__DEVICE_ATOMIC_FUNCTIONS_HPP__) +#define __DEVICE_ATOMIC_FUNCTIONS_HPP__ + +#if defined(__CUDACC_RTC__) +#define __DEVICE_ATOMIC_FUNCTIONS_DECL__ __device__ +#else /* __CUDACC_RTC__ */ +#define __DEVICE_ATOMIC_FUNCTIONS_DECL__ static __inline__ __device__ +#endif /* __CUDACC_RTC__ */ + +#if defined(__cplusplus) && defined(__CUDACC__) + + +extern "C" +{ +extern __device__ __device_builtin__ int __iAtomicAdd(int *address, int val); +extern __device__ __device_builtin__ unsigned int __uAtomicAdd(unsigned int *address, unsigned int val); +extern __device__ __device_builtin__ int __iAtomicExch(int *address, int val); +extern __device__ __device_builtin__ unsigned int __uAtomicExch(unsigned int *address, unsigned int val); +extern __device__ __device_builtin__ float __fAtomicExch(float *address, float val); +extern __device__ __device_builtin__ int __iAtomicMin(int *address, int val); +extern __device__ __device_builtin__ unsigned int __uAtomicMin(unsigned int *address, unsigned int val); +extern __device__ __device_builtin__ int __iAtomicMax(int *address, int val); +extern __device__ __device_builtin__ unsigned int __uAtomicMax(unsigned int *address, unsigned int val); +extern __device__ __device_builtin__ unsigned int __uAtomicInc(unsigned int *address, unsigned int val); +extern __device__ __device_builtin__ unsigned int __uAtomicDec(unsigned int *address, unsigned int val); +extern __device__ __device_builtin__ int __iAtomicAnd(int *address, int val); +extern __device__ __device_builtin__ unsigned int __uAtomicAnd(unsigned int *address, unsigned int val); +extern __device__ __device_builtin__ int __iAtomicOr(int *address, int val); +extern __device__ __device_builtin__ unsigned int __uAtomicOr(unsigned int *address, unsigned int val); +extern __device__ __device_builtin__ int __iAtomicXor(int *address, int val); +extern __device__ __device_builtin__ unsigned int __uAtomicXor(unsigned int *address, unsigned int val); +extern __device__ __device_builtin__ int __iAtomicCAS(int *address, int compare, int val); +extern __device__ __device_builtin__ unsigned int __uAtomicCAS(unsigned int *address, unsigned int compare, unsigned int val); + + +extern __device__ __device_builtin__ unsigned long long int __ullAtomicAdd(unsigned long long int *address, unsigned long long int val); +extern __device__ __device_builtin__ unsigned long long int __ullAtomicExch(unsigned long long int *address, unsigned long long int val); +extern __device__ __device_builtin__ unsigned long long int __ullAtomicCAS(unsigned long long int *address, unsigned long long int compare, unsigned long long int val); +} + + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#include "cuda_runtime_api.h" + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicAdd(int *address, int val) +{ + return __iAtomicAdd(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicAdd(unsigned int *address, unsigned int val) +{ + return __uAtomicAdd(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicSub(int *address, int val) +{ + return __iAtomicAdd(address, (unsigned int)-(int)val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicSub(unsigned int *address, unsigned int val) +{ + return __uAtomicAdd(address, (unsigned int)-(int)val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicExch(int *address, int val) +{ + return __iAtomicExch(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicExch(unsigned int *address, unsigned int val) +{ + return __uAtomicExch(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ float atomicExch(float *address, float val) +{ + return __fAtomicExch(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicMin(int *address, int val) +{ + return __iAtomicMin(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicMin(unsigned int *address, unsigned int val) +{ + return __uAtomicMin(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicMax(int *address, int val) +{ + return __iAtomicMax(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicMax(unsigned int *address, unsigned int val) +{ + return __uAtomicMax(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicInc(unsigned int *address, unsigned int val) +{ + return __uAtomicInc(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicDec(unsigned int *address, unsigned int val) +{ + return __uAtomicDec(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicAnd(int *address, int val) +{ + return __iAtomicAnd(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicAnd(unsigned int *address, unsigned int val) +{ + return __uAtomicAnd(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicOr(int *address, int val) +{ + return __iAtomicOr(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicOr(unsigned int *address, unsigned int val) +{ + return __uAtomicOr(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicXor(int *address, int val) +{ + return __iAtomicXor(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicXor(unsigned int *address, unsigned int val) +{ + return __uAtomicXor(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ int atomicCAS(int *address, int compare, int val) +{ + return __iAtomicCAS(address, compare, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned int atomicCAS(unsigned int *address, unsigned int compare, unsigned int val) +{ + return __uAtomicCAS(address, compare, val); +} + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +#include "cuda_runtime_api.h" + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned long long int atomicAdd(unsigned long long int *address, unsigned long long int val) +{ + return __ullAtomicAdd(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned long long int atomicExch(unsigned long long int *address, unsigned long long int val) +{ + return __ullAtomicExch(address, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ unsigned long long int atomicCAS(unsigned long long int *address, unsigned long long int compare, unsigned long long int val) +{ + return __ullAtomicCAS(address, compare, val); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ bool any(bool cond) +{ + return (bool)__any((int)cond); +} + +__DEVICE_ATOMIC_FUNCTIONS_DECL__ bool all(bool cond) +{ + return (bool)__all((int)cond); +} + +#endif /* __cplusplus && __CUDACC__ */ + +#undef __DEVICE_ATOMIC_FUNCTIONS_DECL__ + +#endif /* !__DEVICE_ATOMIC_FUNCTIONS_HPP__ */ + diff --git a/cuda_toolkit/include/device_double_functions.h b/cuda_toolkit/include/device_double_functions.h new file mode 100644 index 0000000000000000000000000000000000000000..e435ec66264edad33c85b47db075a7896371f3dd --- /dev/null +++ b/cuda_toolkit/include/device_double_functions.h @@ -0,0 +1,65 @@ +/* + * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__) +#if defined(_MSC_VER) +#pragma message("device_double_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.") +#else +#warning "device_double_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead." +#endif +#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_DOUBLE_FUNCTIONS_H_WRAPPER__ +#endif + +#include "crt/device_double_functions.h" + +#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_DOUBLE_FUNCTIONS_H_WRAPPER__) +#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_DOUBLE_FUNCTIONS_H_WRAPPER__ +#endif diff --git a/cuda_toolkit/include/device_functions.h b/cuda_toolkit/include/device_functions.h new file mode 100644 index 0000000000000000000000000000000000000000..bb5089aa0d548cec8db716cd8c2d2186a1eb2e00 --- /dev/null +++ b/cuda_toolkit/include/device_functions.h @@ -0,0 +1,65 @@ +/* + * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__) +#if defined(_MSC_VER) +#pragma message("device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.") +#else +#warning "device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead." +#endif +#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_FUNCTIONS_H_WRAPPER__ +#endif + +#include "crt/device_functions.h" + +#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_FUNCTIONS_H_WRAPPER__) +#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_FUNCTIONS_H_WRAPPER__ +#endif diff --git a/cuda_toolkit/include/device_launch_parameters.h b/cuda_toolkit/include/device_launch_parameters.h new file mode 100644 index 0000000000000000000000000000000000000000..5e6bf11771dfcff78e400d37b39240eb92d5603b --- /dev/null +++ b/cuda_toolkit/include/device_launch_parameters.h @@ -0,0 +1,118 @@ +/* + * Copyright 1993-2012 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__DEVICE_LAUNCH_PARAMETERS_H__) +#define __DEVICE_LAUNCH_PARAMETERS_H__ + +#include "vector_types.h" + +#if !defined(__STORAGE__) + +#if defined(__CUDACC_RTC__) +#define __STORAGE__ \ + extern const __device__ +#else /* !__CUDACC_RTC__ */ +#define __STORAGE__ \ + extern const +#endif /* __CUDACC_RTC__ */ + +#endif /* __STORAGE__ */ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +uint3 __device_builtin__ __STORAGE__ threadIdx; +uint3 __device_builtin__ __STORAGE__ blockIdx; +dim3 __device_builtin__ __STORAGE__ blockDim; +dim3 __device_builtin__ __STORAGE__ gridDim; +int __device_builtin__ __STORAGE__ warpSize; + +#undef __STORAGE__ + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#if !defined(__cudaGet_threadIdx) + +#define __cudaGet_threadIdx() \ + threadIdx + +#endif /* __cudaGet_threadIdx */ + +#if !defined(__cudaGet_blockIdx) + +#define __cudaGet_blockIdx() \ + blockIdx + +#endif /* __cudaGet_blockIdx */ + +#if !defined(__cudaGet_blockDim) + +#define __cudaGet_blockDim() \ + blockDim + +#endif /* __cudaGet_blockDim */ + +#if !defined(__cudaGet_gridDim) + +#define __cudaGet_gridDim() \ + gridDim + +#endif /* __cudaGet_gridDim */ + +#if !defined(__cudaGet_warpSize) + +#define __cudaGet_warpSize() \ + warpSize + +#endif /* __cudaGet_warpSize */ + +#endif /* !__DEVICE_LAUNCH_PARAMETERS_H__ */ diff --git a/cuda_toolkit/include/device_types.h b/cuda_toolkit/include/device_types.h new file mode 100644 index 0000000000000000000000000000000000000000..85dfc54a590a24ed24a5569840c15579dc5ea5ed --- /dev/null +++ b/cuda_toolkit/include/device_types.h @@ -0,0 +1,81 @@ +/* + * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__DEVICE_TYPES_H__) +#define __DEVICE_TYPES_H__ + +#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__) +#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_TYPES_H__ +#endif + +#ifndef __DOXYGEN_ONLY__ +#include "crt/host_defines.h" +#endif + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +enum __device_builtin__ cudaRoundMode +{ + cudaRoundNearest, + cudaRoundZero, + cudaRoundPosInf, + cudaRoundMinInf +}; + +#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_TYPES_H__) +#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_TYPES_H__ +#endif + +#endif /* !__DEVICE_TYPES_H__ */ diff --git a/cuda_toolkit/include/driver_functions.h b/cuda_toolkit/include/driver_functions.h new file mode 100644 index 0000000000000000000000000000000000000000..bb2945d033be27a0702aa17fa862c757d0134832 --- /dev/null +++ b/cuda_toolkit/include/driver_functions.h @@ -0,0 +1,145 @@ +/* + * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__DRIVER_FUNCTIONS_H__) +#define __DRIVER_FUNCTIONS_H__ + +#include "builtin_types.h" +#include "crt/host_defines.h" +#include "driver_types.h" + +/** + * \addtogroup CUDART_MEMORY + * + * @{ + */ + +/** + * \brief Returns a cudaPitchedPtr based on input parameters + * + * Returns a ::cudaPitchedPtr based on the specified input parameters \p d, + * \p p, \p xsz, and \p ysz. + * + * \param d - Pointer to allocated memory + * \param p - Pitch of allocated memory in bytes + * \param xsz - Logical width of allocation in elements + * \param ysz - Logical height of allocation in elements + * + * \return + * ::cudaPitchedPtr specified by \p d, \p p, \p xsz, and \p ysz + * + * \sa make_cudaExtent, make_cudaPos + */ +static __inline__ __host__ struct cudaPitchedPtr make_cudaPitchedPtr(void *d, size_t p, size_t xsz, size_t ysz) +{ + struct cudaPitchedPtr s; + + s.ptr = d; + s.pitch = p; + s.xsize = xsz; + s.ysize = ysz; + + return s; +} + +/** + * \brief Returns a cudaPos based on input parameters + * + * Returns a ::cudaPos based on the specified input parameters \p x, + * \p y, and \p z. + * + * \param x - X position + * \param y - Y position + * \param z - Z position + * + * \return + * ::cudaPos specified by \p x, \p y, and \p z + * + * \sa make_cudaExtent, make_cudaPitchedPtr + */ +static __inline__ __host__ struct cudaPos make_cudaPos(size_t x, size_t y, size_t z) +{ + struct cudaPos p; + + p.x = x; + p.y = y; + p.z = z; + + return p; +} + +/** + * \brief Returns a cudaExtent based on input parameters + * + * Returns a ::cudaExtent based on the specified input parameters \p w, + * \p h, and \p d. + * + * \param w - Width in elements when referring to array memory, in bytes when referring to linear memory + * \param h - Height in elements + * \param d - Depth in elements + * + * \return + * ::cudaExtent specified by \p w, \p h, and \p d + * + * \sa make_cudaPitchedPtr, make_cudaPos + */ +static __inline__ __host__ struct cudaExtent make_cudaExtent(size_t w, size_t h, size_t d) +{ + struct cudaExtent e; + + e.width = w; + e.height = h; + e.depth = d; + + return e; +} + +/** @} */ /* END CUDART_MEMORY */ + +#endif /* !__DRIVER_FUNCTIONS_H__ */ diff --git a/cuda_toolkit/include/driver_types.h b/cuda_toolkit/include/driver_types.h new file mode 100644 index 0000000000000000000000000000000000000000..aa889abfd19830f30e1b50ef82c62393348ce5d4 --- /dev/null +++ b/cuda_toolkit/include/driver_types.h @@ -0,0 +1,3642 @@ +/* + * Copyright 1993-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__DRIVER_TYPES_H__) +#define __DRIVER_TYPES_H__ + +#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__) +#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DRIVER_TYPES_H__ +#endif + +#ifndef __DOXYGEN_ONLY__ +#include "crt/host_defines.h" +#endif +#include "vector_types.h" + + + +#ifndef __CUDACC_RTC_MINIMAL__ +/** + * \defgroup CUDART_TYPES Data types used by CUDA Runtime + * \ingroup CUDART + * + * @{ + */ + +/******************************************************************************* +* * +* TYPE DEFINITIONS USED BY RUNTIME API * +* * +*******************************************************************************/ + +#if !defined(__CUDA_INTERNAL_COMPILATION__) + + +#if !defined(__CUDACC_RTC__) +#include +#include +#endif /* !defined(__CUDACC_RTC__) */ + +#define cudaHostAllocDefault 0x00 /**< Default page-locked allocation flag */ +#define cudaHostAllocPortable 0x01 /**< Pinned memory accessible by all CUDA contexts */ +#define cudaHostAllocMapped 0x02 /**< Map allocation into device space */ +#define cudaHostAllocWriteCombined 0x04 /**< Write-combined memory */ + +#define cudaHostRegisterDefault 0x00 /**< Default host memory registration flag */ +#define cudaHostRegisterPortable 0x01 /**< Pinned memory accessible by all CUDA contexts */ +#define cudaHostRegisterMapped 0x02 /**< Map registered memory into device space */ +#define cudaHostRegisterIoMemory 0x04 /**< Memory-mapped I/O space */ +#define cudaHostRegisterReadOnly 0x08 /**< Memory-mapped read-only */ + +#define cudaPeerAccessDefault 0x00 /**< Default peer addressing enable flag */ + +#define cudaStreamDefault 0x00 /**< Default stream flag */ +#define cudaStreamNonBlocking 0x01 /**< Stream does not synchronize with stream 0 (the NULL stream) */ + + /** + * Legacy stream handle + * + * Stream handle that can be passed as a cudaStream_t to use an implicit stream + * with legacy synchronization behavior. + * + * See details of the \link_sync_behavior + */ +#define cudaStreamLegacy ((cudaStream_t)0x1) + +/** + * Per-thread stream handle + * + * Stream handle that can be passed as a cudaStream_t to use an implicit stream + * with per-thread synchronization behavior. + * + * See details of the \link_sync_behavior + */ +#define cudaStreamPerThread ((cudaStream_t)0x2) + +#define cudaEventDefault 0x00 /**< Default event flag */ +#define cudaEventBlockingSync 0x01 /**< Event uses blocking synchronization */ +#define cudaEventDisableTiming 0x02 /**< Event will not record timing data */ +#define cudaEventInterprocess 0x04 /**< Event is suitable for interprocess use. cudaEventDisableTiming must be set */ + +#define cudaEventRecordDefault 0x00 /**< Default event record flag */ +#define cudaEventRecordExternal 0x01 /**< Event is captured in the graph as an external event node when performing stream capture */ + +#define cudaEventWaitDefault 0x00 /**< Default event wait flag */ +#define cudaEventWaitExternal 0x01 /**< Event is captured in the graph as an external event node when performing stream capture */ + +#define cudaDeviceScheduleAuto 0x00 /**< Device flag - Automatic scheduling */ +#define cudaDeviceScheduleSpin 0x01 /**< Device flag - Spin default scheduling */ +#define cudaDeviceScheduleYield 0x02 /**< Device flag - Yield default scheduling */ +#define cudaDeviceScheduleBlockingSync 0x04 /**< Device flag - Use blocking synchronization */ +#define cudaDeviceBlockingSync 0x04 /**< Device flag - Use blocking synchronization + * \deprecated This flag was deprecated as of CUDA 4.0 and + * replaced with ::cudaDeviceScheduleBlockingSync. */ +#define cudaDeviceScheduleMask 0x07 /**< Device schedule flags mask */ +#define cudaDeviceMapHost 0x08 /**< Device flag - Support mapped pinned allocations */ +#define cudaDeviceLmemResizeToMax 0x10 /**< Device flag - Keep local memory allocation after launch */ +#define cudaDeviceSyncMemops 0x80 /**< Device flag - Ensure synchronous memory operations on this context will synchronize */ +#define cudaDeviceMask 0xff /**< Device flags mask */ + +#define cudaArrayDefault 0x00 /**< Default CUDA array allocation flag */ +#define cudaArrayLayered 0x01 /**< Must be set in cudaMalloc3DArray to create a layered CUDA array */ +#define cudaArraySurfaceLoadStore 0x02 /**< Must be set in cudaMallocArray or cudaMalloc3DArray in order to bind surfaces to the CUDA array */ +#define cudaArrayCubemap 0x04 /**< Must be set in cudaMalloc3DArray to create a cubemap CUDA array */ +#define cudaArrayTextureGather 0x08 /**< Must be set in cudaMallocArray or cudaMalloc3DArray in order to perform texture gather operations on the CUDA array */ +#define cudaArrayColorAttachment 0x20 /**< Must be set in cudaExternalMemoryGetMappedMipmappedArray if the mipmapped array is used as a color target in a graphics API */ +#define cudaArraySparse 0x40 /**< Must be set in cudaMallocArray, cudaMalloc3DArray or cudaMallocMipmappedArray in order to create a sparse CUDA array or CUDA mipmapped array */ +#define cudaArrayDeferredMapping 0x80 /**< Must be set in cudaMallocArray, cudaMalloc3DArray or cudaMallocMipmappedArray in order to create a deferred mapping CUDA array or CUDA mipmapped array */ + +#define cudaIpcMemLazyEnablePeerAccess 0x01 /**< Automatically enable peer access between remote devices as needed */ + +#define cudaMemAttachGlobal 0x01 /**< Memory can be accessed by any stream on any device*/ +#define cudaMemAttachHost 0x02 /**< Memory cannot be accessed by any stream on any device */ +#define cudaMemAttachSingle 0x04 /**< Memory can only be accessed by a single stream on the associated device */ + +#define cudaOccupancyDefault 0x00 /**< Default behavior */ +#define cudaOccupancyDisableCachingOverride 0x01 /**< Assume global caching is enabled and cannot be automatically turned off */ + +#define cudaCpuDeviceId ((int)-1) /**< Device id that represents the CPU */ +#define cudaInvalidDeviceId ((int)-2) /**< Device id that represents an invalid device */ +#define cudaInitDeviceFlagsAreValid 0x01 /**< Tell the CUDA runtime that DeviceFlags is being set in cudaInitDevice call */ +/** + * If set, each kernel launched as part of ::cudaLaunchCooperativeKernelMultiDevice only + * waits for prior work in the stream corresponding to that GPU to complete before the + * kernel begins execution. + */ +#define cudaCooperativeLaunchMultiDeviceNoPreSync 0x01 + +/** + * If set, any subsequent work pushed in a stream that participated in a call to + * ::cudaLaunchCooperativeKernelMultiDevice will only wait for the kernel launched on + * the GPU corresponding to that stream to complete before it begins execution. + */ +#define cudaCooperativeLaunchMultiDeviceNoPostSync 0x02 + +#endif /* !__CUDA_INTERNAL_COMPILATION__ */ + +/** \cond impl_private */ +#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED) +#define __CUDA_DEPRECATED +#elif defined(_MSC_VER) +#define __CUDA_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +#define __CUDA_DEPRECATED __attribute__((deprecated)) +#else +#define __CUDA_DEPRECATED +#endif +/** \endcond impl_private */ + +/******************************************************************************* +* * +* * +* * +*******************************************************************************/ + +/** + * CUDA error types + */ +enum __device_builtin__ cudaError +{ + /** + * The API call returned with no errors. In the case of query calls, this + * also means that the operation being queried is complete (see + * ::cudaEventQuery() and ::cudaStreamQuery()). + */ + cudaSuccess = 0, + + /** + * This indicates that one or more of the parameters passed to the API call + * is not within an acceptable range of values. + */ + cudaErrorInvalidValue = 1, + + /** + * The API call failed because it was unable to allocate enough memory or + * other resources to perform the requested operation. + */ + cudaErrorMemoryAllocation = 2, + + /** + * The API call failed because the CUDA driver and runtime could not be + * initialized. + */ + cudaErrorInitializationError = 3, + + /** + * This indicates that a CUDA Runtime API call cannot be executed because + * it is being called during process shut down, at a point in time after + * CUDA driver has been unloaded. + */ + cudaErrorCudartUnloading = 4, + + /** + * This indicates profiler is not initialized for this run. This can + * happen when the application is running with external profiling tools + * like visual profiler. + */ + cudaErrorProfilerDisabled = 5, + + /** + * \deprecated + * This error return is deprecated as of CUDA 5.0. It is no longer an error + * to attempt to enable/disable the profiling via ::cudaProfilerStart or + * ::cudaProfilerStop without initialization. + */ + cudaErrorProfilerNotInitialized = 6, + + /** + * \deprecated + * This error return is deprecated as of CUDA 5.0. It is no longer an error + * to call cudaProfilerStart() when profiling is already enabled. + */ + cudaErrorProfilerAlreadyStarted = 7, + + /** + * \deprecated + * This error return is deprecated as of CUDA 5.0. It is no longer an error + * to call cudaProfilerStop() when profiling is already disabled. + */ + cudaErrorProfilerAlreadyStopped = 8, + /** + * This indicates that a kernel launch is requesting resources that can + * never be satisfied by the current device. Requesting more shared memory + * per block than the device supports will trigger this error, as will + * requesting too many threads or blocks. See ::cudaDeviceProp for more + * device limitations. + */ + cudaErrorInvalidConfiguration = 9, + + /** + * This indicates that one or more of the pitch-related parameters passed + * to the API call is not within the acceptable range for pitch. + */ + cudaErrorInvalidPitchValue = 12, + + /** + * This indicates that the symbol name/identifier passed to the API call + * is not a valid name or identifier. + */ + cudaErrorInvalidSymbol = 13, + + /** + * This indicates that at least one host pointer passed to the API call is + * not a valid host pointer. + * \deprecated + * This error return is deprecated as of CUDA 10.1. + */ + cudaErrorInvalidHostPointer = 16, + + /** + * This indicates that at least one device pointer passed to the API call is + * not a valid device pointer. + * \deprecated + * This error return is deprecated as of CUDA 10.1. + */ + cudaErrorInvalidDevicePointer = 17, + /** + * This indicates that the texture passed to the API call is not a valid + * texture. + */ + cudaErrorInvalidTexture = 18, + + /** + * This indicates that the texture binding is not valid. This occurs if you + * call ::cudaGetTextureAlignmentOffset() with an unbound texture. + */ + cudaErrorInvalidTextureBinding = 19, + + /** + * This indicates that the channel descriptor passed to the API call is not + * valid. This occurs if the format is not one of the formats specified by + * ::cudaChannelFormatKind, or if one of the dimensions is invalid. + */ + cudaErrorInvalidChannelDescriptor = 20, + + /** + * This indicates that the direction of the memcpy passed to the API call is + * not one of the types specified by ::cudaMemcpyKind. + */ + cudaErrorInvalidMemcpyDirection = 21, + + /** + * This indicated that the user has taken the address of a constant variable, + * which was forbidden up until the CUDA 3.1 release. + * \deprecated + * This error return is deprecated as of CUDA 3.1. Variables in constant + * memory may now have their address taken by the runtime via + * ::cudaGetSymbolAddress(). + */ + cudaErrorAddressOfConstant = 22, + + /** + * This indicated that a texture fetch was not able to be performed. + * This was previously used for device emulation of texture operations. + * \deprecated + * This error return is deprecated as of CUDA 3.1. Device emulation mode was + * removed with the CUDA 3.1 release. + */ + cudaErrorTextureFetchFailed = 23, + + /** + * This indicated that a texture was not bound for access. + * This was previously used for device emulation of texture operations. + * \deprecated + * This error return is deprecated as of CUDA 3.1. Device emulation mode was + * removed with the CUDA 3.1 release. + */ + cudaErrorTextureNotBound = 24, + + /** + * This indicated that a synchronization operation had failed. + * This was previously used for some device emulation functions. + * \deprecated + * This error return is deprecated as of CUDA 3.1. Device emulation mode was + * removed with the CUDA 3.1 release. + */ + cudaErrorSynchronizationError = 25, + /** + * This indicates that a non-float texture was being accessed with linear + * filtering. This is not supported by CUDA. + */ + cudaErrorInvalidFilterSetting = 26, + + /** + * This indicates that an attempt was made to read a non-float texture as a + * normalized float. This is not supported by CUDA. + */ + cudaErrorInvalidNormSetting = 27, + + /** + * Mixing of device and device emulation code was not allowed. + * \deprecated + * This error return is deprecated as of CUDA 3.1. Device emulation mode was + * removed with the CUDA 3.1 release. + */ + cudaErrorMixedDeviceExecution = 28, + + /** + * This indicates that the API call is not yet implemented. Production + * releases of CUDA will never return this error. + * \deprecated + * This error return is deprecated as of CUDA 4.1. + */ + cudaErrorNotYetImplemented = 31, + + /** + * This indicated that an emulated device pointer exceeded the 32-bit address + * range. + * \deprecated + * This error return is deprecated as of CUDA 3.1. Device emulation mode was + * removed with the CUDA 3.1 release. + */ + cudaErrorMemoryValueTooLarge = 32, + /** + * This indicates that the CUDA driver that the application has loaded is a + * stub library. Applications that run with the stub rather than a real + * driver loaded will result in CUDA API returning this error. + */ + cudaErrorStubLibrary = 34, + + /** + * This indicates that the installed NVIDIA CUDA driver is older than the + * CUDA runtime library. This is not a supported configuration. Users should + * install an updated NVIDIA display driver to allow the application to run. + */ + cudaErrorInsufficientDriver = 35, + + /** + * This indicates that the API call requires a newer CUDA driver than the one + * currently installed. Users should install an updated NVIDIA CUDA driver + * to allow the API call to succeed. + */ + cudaErrorCallRequiresNewerDriver = 36, + + /** + * This indicates that the surface passed to the API call is not a valid + * surface. + */ + cudaErrorInvalidSurface = 37, + + /** + * This indicates that multiple global or constant variables (across separate + * CUDA source files in the application) share the same string name. + */ + cudaErrorDuplicateVariableName = 43, + + /** + * This indicates that multiple textures (across separate CUDA source + * files in the application) share the same string name. + */ + cudaErrorDuplicateTextureName = 44, + + /** + * This indicates that multiple surfaces (across separate CUDA source + * files in the application) share the same string name. + */ + cudaErrorDuplicateSurfaceName = 45, + + /** + * This indicates that all CUDA devices are busy or unavailable at the current + * time. Devices are often busy/unavailable due to use of + * ::cudaComputeModeProhibited, ::cudaComputeModeExclusiveProcess, or when long + * running CUDA kernels have filled up the GPU and are blocking new work + * from starting. They can also be unavailable due to memory constraints + * on a device that already has active CUDA work being performed. + */ + cudaErrorDevicesUnavailable = 46, + + /** + * This indicates that the current context is not compatible with this + * the CUDA Runtime. This can only occur if you are using CUDA + * Runtime/Driver interoperability and have created an existing Driver + * context using the driver API. The Driver context may be incompatible + * either because the Driver context was created using an older version + * of the API, because the Runtime API call expects a primary driver + * context and the Driver context is not primary, or because the Driver + * context has been destroyed. Please see \ref CUDART_DRIVER "Interactions + * with the CUDA Driver API" for more information. + */ + cudaErrorIncompatibleDriverContext = 49, + + /** + * The device function being invoked (usually via ::cudaLaunchKernel()) was not + * previously configured via the ::cudaConfigureCall() function. + */ + cudaErrorMissingConfiguration = 52, + + /** + * This indicated that a previous kernel launch failed. This was previously + * used for device emulation of kernel launches. + * \deprecated + * This error return is deprecated as of CUDA 3.1. Device emulation mode was + * removed with the CUDA 3.1 release. + */ + cudaErrorPriorLaunchFailure = 53, + /** + * This error indicates that a device runtime grid launch did not occur + * because the depth of the child grid would exceed the maximum supported + * number of nested grid launches. + */ + cudaErrorLaunchMaxDepthExceeded = 65, + + /** + * This error indicates that a grid launch did not occur because the kernel + * uses file-scoped textures which are unsupported by the device runtime. + * Kernels launched via the device runtime only support textures created with + * the Texture Object API's. + */ + cudaErrorLaunchFileScopedTex = 66, + + /** + * This error indicates that a grid launch did not occur because the kernel + * uses file-scoped surfaces which are unsupported by the device runtime. + * Kernels launched via the device runtime only support surfaces created with + * the Surface Object API's. + */ + cudaErrorLaunchFileScopedSurf = 67, + + /** + * This error indicates that a call to ::cudaDeviceSynchronize made from + * the device runtime failed because the call was made at grid depth greater + * than than either the default (2 levels of grids) or user specified device + * limit ::cudaLimitDevRuntimeSyncDepth. To be able to synchronize on + * launched grids at a greater depth successfully, the maximum nested + * depth at which ::cudaDeviceSynchronize will be called must be specified + * with the ::cudaLimitDevRuntimeSyncDepth limit to the ::cudaDeviceSetLimit + * api before the host-side launch of a kernel using the device runtime. + * Keep in mind that additional levels of sync depth require the runtime + * to reserve large amounts of device memory that cannot be used for + * user allocations. Note that ::cudaDeviceSynchronize made from device + * runtime is only supported on devices of compute capability < 9.0. + */ + cudaErrorSyncDepthExceeded = 68, + + /** + * This error indicates that a device runtime grid launch failed because + * the launch would exceed the limit ::cudaLimitDevRuntimePendingLaunchCount. + * For this launch to proceed successfully, ::cudaDeviceSetLimit must be + * called to set the ::cudaLimitDevRuntimePendingLaunchCount to be higher + * than the upper bound of outstanding launches that can be issued to the + * device runtime. Keep in mind that raising the limit of pending device + * runtime launches will require the runtime to reserve device memory that + * cannot be used for user allocations. + */ + cudaErrorLaunchPendingCountExceeded = 69, + + /** + * The requested device function does not exist or is not compiled for the + * proper device architecture. + */ + cudaErrorInvalidDeviceFunction = 98, + + /** + * This indicates that no CUDA-capable devices were detected by the installed + * CUDA driver. + */ + cudaErrorNoDevice = 100, + + /** + * This indicates that the device ordinal supplied by the user does not + * correspond to a valid CUDA device or that the action requested is + * invalid for the specified device. + */ + cudaErrorInvalidDevice = 101, + + /** + * This indicates that the device doesn't have a valid Grid License. + */ + cudaErrorDeviceNotLicensed = 102, + + /** + * By default, the CUDA runtime may perform a minimal set of self-tests, + * as well as CUDA driver tests, to establish the validity of both. + * Introduced in CUDA 11.2, this error return indicates that at least one + * of these tests has failed and the validity of either the runtime + * or the driver could not be established. + */ + cudaErrorSoftwareValidityNotEstablished = 103, + + /** + * This indicates an internal startup failure in the CUDA runtime. + */ + cudaErrorStartupFailure = 127, + + /** + * This indicates that the device kernel image is invalid. + */ + cudaErrorInvalidKernelImage = 200, + + /** + * This most frequently indicates that there is no context bound to the + * current thread. This can also be returned if the context passed to an + * API call is not a valid handle (such as a context that has had + * ::cuCtxDestroy() invoked on it). This can also be returned if a user + * mixes different API versions (i.e. 3010 context with 3020 API calls). + * See ::cuCtxGetApiVersion() for more details. + */ + cudaErrorDeviceUninitialized = 201, + + /** + * This indicates that the buffer object could not be mapped. + */ + cudaErrorMapBufferObjectFailed = 205, + + /** + * This indicates that the buffer object could not be unmapped. + */ + cudaErrorUnmapBufferObjectFailed = 206, + + /** + * This indicates that the specified array is currently mapped and thus + * cannot be destroyed. + */ + cudaErrorArrayIsMapped = 207, + + /** + * This indicates that the resource is already mapped. + */ + cudaErrorAlreadyMapped = 208, + + /** + * This indicates that there is no kernel image available that is suitable + * for the device. This can occur when a user specifies code generation + * options for a particular CUDA source file that do not include the + * corresponding device configuration. + */ + cudaErrorNoKernelImageForDevice = 209, + + /** + * This indicates that a resource has already been acquired. + */ + cudaErrorAlreadyAcquired = 210, + + /** + * This indicates that a resource is not mapped. + */ + cudaErrorNotMapped = 211, + + /** + * This indicates that a mapped resource is not available for access as an + * array. + */ + cudaErrorNotMappedAsArray = 212, + + /** + * This indicates that a mapped resource is not available for access as a + * pointer. + */ + cudaErrorNotMappedAsPointer = 213, + + /** + * This indicates that an uncorrectable ECC error was detected during + * execution. + */ + cudaErrorECCUncorrectable = 214, + + /** + * This indicates that the ::cudaLimit passed to the API call is not + * supported by the active device. + */ + cudaErrorUnsupportedLimit = 215, + + /** + * This indicates that a call tried to access an exclusive-thread device that + * is already in use by a different thread. + */ + cudaErrorDeviceAlreadyInUse = 216, + + /** + * This error indicates that P2P access is not supported across the given + * devices. + */ + cudaErrorPeerAccessUnsupported = 217, + + /** + * A PTX compilation failed. The runtime may fall back to compiling PTX if + * an application does not contain a suitable binary for the current device. + */ + cudaErrorInvalidPtx = 218, + + /** + * This indicates an error with the OpenGL or DirectX context. + */ + cudaErrorInvalidGraphicsContext = 219, + + /** + * This indicates that an uncorrectable NVLink error was detected during the + * execution. + */ + cudaErrorNvlinkUncorrectable = 220, + + /** + * This indicates that the PTX JIT compiler library was not found. The JIT Compiler + * library is used for PTX compilation. The runtime may fall back to compiling PTX + * if an application does not contain a suitable binary for the current device. + */ + cudaErrorJitCompilerNotFound = 221, + + /** + * This indicates that the provided PTX was compiled with an unsupported toolchain. + * The most common reason for this, is the PTX was generated by a compiler newer + * than what is supported by the CUDA driver and PTX JIT compiler. + */ + cudaErrorUnsupportedPtxVersion = 222, + + /** + * This indicates that the JIT compilation was disabled. The JIT compilation compiles + * PTX. The runtime may fall back to compiling PTX if an application does not contain + * a suitable binary for the current device. + */ + cudaErrorJitCompilationDisabled = 223, + + /** + * This indicates that the provided execution affinity is not supported by the device. + */ + cudaErrorUnsupportedExecAffinity = 224, + + /** + * This indicates that the code to be compiled by the PTX JIT contains + * unsupported call to cudaDeviceSynchronize. + */ + cudaErrorUnsupportedDevSideSync = 225, + + /** + * This indicates that the device kernel source is invalid. + */ + cudaErrorInvalidSource = 300, + + /** + * This indicates that the file specified was not found. + */ + cudaErrorFileNotFound = 301, + + /** + * This indicates that a link to a shared object failed to resolve. + */ + cudaErrorSharedObjectSymbolNotFound = 302, + + /** + * This indicates that initialization of a shared object failed. + */ + cudaErrorSharedObjectInitFailed = 303, + + /** + * This error indicates that an OS call failed. + */ + cudaErrorOperatingSystem = 304, + + /** + * This indicates that a resource handle passed to the API call was not + * valid. Resource handles are opaque types like ::cudaStream_t and + * ::cudaEvent_t. + */ + cudaErrorInvalidResourceHandle = 400, + + /** + * This indicates that a resource required by the API call is not in a + * valid state to perform the requested operation. + */ + cudaErrorIllegalState = 401, + + /** + * This indicates an attempt was made to introspect an object in a way that + * would discard semantically important information. This is either due to + * the object using funtionality newer than the API version used to + * introspect it or omission of optional return arguments. + */ + cudaErrorLossyQuery = 402, + + /** + * This indicates that a named symbol was not found. Examples of symbols + * are global/constant variable names, driver function names, texture names, + * and surface names. + */ + cudaErrorSymbolNotFound = 500, + + /** + * This indicates that asynchronous operations issued previously have not + * completed yet. This result is not actually an error, but must be indicated + * differently than ::cudaSuccess (which indicates completion). Calls that + * may return this value include ::cudaEventQuery() and ::cudaStreamQuery(). + */ + cudaErrorNotReady = 600, + + /** + * The device encountered a load or store instruction on an invalid memory address. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + cudaErrorIllegalAddress = 700, + + /** + * This indicates that a launch did not occur because it did not have + * appropriate resources. Although this error is similar to + * ::cudaErrorInvalidConfiguration, this error usually indicates that the + * user has attempted to pass too many arguments to the device kernel, or the + * kernel launch specifies too many threads for the kernel's register count. + */ + cudaErrorLaunchOutOfResources = 701, + + /** + * This indicates that the device kernel took too long to execute. This can + * only occur if timeouts are enabled - see the device property + * \ref ::cudaDeviceProp::kernelExecTimeoutEnabled "kernelExecTimeoutEnabled" + * for more information. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + cudaErrorLaunchTimeout = 702, + + /** + * This error indicates a kernel launch that uses an incompatible texturing + * mode. + */ + cudaErrorLaunchIncompatibleTexturing = 703, + + /** + * This error indicates that a call to ::cudaDeviceEnablePeerAccess() is + * trying to re-enable peer addressing on from a context which has already + * had peer addressing enabled. + */ + cudaErrorPeerAccessAlreadyEnabled = 704, + + /** + * This error indicates that ::cudaDeviceDisablePeerAccess() is trying to + * disable peer addressing which has not been enabled yet via + * ::cudaDeviceEnablePeerAccess(). + */ + cudaErrorPeerAccessNotEnabled = 705, + + /** + * This indicates that the user has called ::cudaSetValidDevices(), + * ::cudaSetDeviceFlags(), ::cudaD3D9SetDirect3DDevice(), + * ::cudaD3D10SetDirect3DDevice, ::cudaD3D11SetDirect3DDevice(), or + * ::cudaVDPAUSetVDPAUDevice() after initializing the CUDA runtime by + * calling non-device management operations (allocating memory and + * launching kernels are examples of non-device management operations). + * This error can also be returned if using runtime/driver + * interoperability and there is an existing ::CUcontext active on the + * host thread. + */ + cudaErrorSetOnActiveProcess = 708, + + /** + * This error indicates that the context current to the calling thread + * has been destroyed using ::cuCtxDestroy, or is a primary context which + * has not yet been initialized. + */ + cudaErrorContextIsDestroyed = 709, + + /** + * An assert triggered in device code during kernel execution. The device + * cannot be used again. All existing allocations are invalid. To continue + * using CUDA, the process must be terminated and relaunched. + */ + cudaErrorAssert = 710, + + /** + * This error indicates that the hardware resources required to enable + * peer access have been exhausted for one or more of the devices + * passed to ::cudaEnablePeerAccess(). + */ + cudaErrorTooManyPeers = 711, + + /** + * This error indicates that the memory range passed to ::cudaHostRegister() + * has already been registered. + */ + cudaErrorHostMemoryAlreadyRegistered = 712, + + /** + * This error indicates that the pointer passed to ::cudaHostUnregister() + * does not correspond to any currently registered memory region. + */ + cudaErrorHostMemoryNotRegistered = 713, + + /** + * Device encountered an error in the call stack during kernel execution, + * possibly due to stack corruption or exceeding the stack size limit. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + cudaErrorHardwareStackError = 714, + + /** + * The device encountered an illegal instruction during kernel execution + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + cudaErrorIllegalInstruction = 715, + + /** + * The device encountered a load or store instruction + * on a memory address which is not aligned. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + cudaErrorMisalignedAddress = 716, + + /** + * While executing a kernel, the device encountered an instruction + * which can only operate on memory locations in certain address spaces + * (global, shared, or local), but was supplied a memory address not + * belonging to an allowed address space. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + cudaErrorInvalidAddressSpace = 717, + + /** + * The device encountered an invalid program counter. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + cudaErrorInvalidPc = 718, + + /** + * An exception occurred on the device while executing a kernel. Common + * causes include dereferencing an invalid device pointer and accessing + * out of bounds shared memory. Less common cases can be system specific - more + * information about these cases can be found in the system specific user guide. + * This leaves the process in an inconsistent state and any further CUDA work + * will return the same error. To continue using CUDA, the process must be terminated + * and relaunched. + */ + cudaErrorLaunchFailure = 719, + + /** + * This error indicates that the number of blocks launched per grid for a kernel that was + * launched via either ::cudaLaunchCooperativeKernel or ::cudaLaunchCooperativeKernelMultiDevice + * exceeds the maximum number of blocks as allowed by ::cudaOccupancyMaxActiveBlocksPerMultiprocessor + * or ::cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags times the number of multiprocessors + * as specified by the device attribute ::cudaDevAttrMultiProcessorCount. + */ + cudaErrorCooperativeLaunchTooLarge = 720, + + /** + * This error indicates the attempted operation is not permitted. + */ + cudaErrorNotPermitted = 800, + + /** + * This error indicates the attempted operation is not supported + * on the current system or device. + */ + cudaErrorNotSupported = 801, + + /** + * This error indicates that the system is not yet ready to start any CUDA + * work. To continue using CUDA, verify the system configuration is in a + * valid state and all required driver daemons are actively running. + * More information about this error can be found in the system specific + * user guide. + */ + cudaErrorSystemNotReady = 802, + + /** + * This error indicates that there is a mismatch between the versions of + * the display driver and the CUDA driver. Refer to the compatibility documentation + * for supported versions. + */ + cudaErrorSystemDriverMismatch = 803, + + /** + * This error indicates that the system was upgraded to run with forward compatibility + * but the visible hardware detected by CUDA does not support this configuration. + * Refer to the compatibility documentation for the supported hardware matrix or ensure + * that only supported hardware is visible during initialization via the CUDA_VISIBLE_DEVICES + * environment variable. + */ + cudaErrorCompatNotSupportedOnDevice = 804, + + /** + * This error indicates that the MPS client failed to connect to the MPS control daemon or the MPS server. + */ + cudaErrorMpsConnectionFailed = 805, + + /** + * This error indicates that the remote procedural call between the MPS server and the MPS client failed. + */ + cudaErrorMpsRpcFailure = 806, + + /** + * This error indicates that the MPS server is not ready to accept new MPS client requests. + * This error can be returned when the MPS server is in the process of recovering from a fatal failure. + */ + cudaErrorMpsServerNotReady = 807, + + /** + * This error indicates that the hardware resources required to create MPS client have been exhausted. + */ + cudaErrorMpsMaxClientsReached = 808, + + /** + * This error indicates the the hardware resources required to device connections have been exhausted. + */ + cudaErrorMpsMaxConnectionsReached = 809, + + /** + * This error indicates that the MPS client has been terminated by the server. To continue using CUDA, the process must be terminated and relaunched. + */ + cudaErrorMpsClientTerminated = 810, + + /** + * This error indicates, that the program is using CUDA Dynamic Parallelism, but the current configuration, like MPS, does not support it. + */ + cudaErrorCdpNotSupported = 811, + + /** + * This error indicates, that the program contains an unsupported interaction between different versions of CUDA Dynamic Parallelism. + */ + cudaErrorCdpVersionMismatch = 812, + + /** + * The operation is not permitted when the stream is capturing. + */ + cudaErrorStreamCaptureUnsupported = 900, + + /** + * The current capture sequence on the stream has been invalidated due to + * a previous error. + */ + cudaErrorStreamCaptureInvalidated = 901, + + /** + * The operation would have resulted in a merge of two independent capture + * sequences. + */ + cudaErrorStreamCaptureMerge = 902, + + /** + * The capture was not initiated in this stream. + */ + cudaErrorStreamCaptureUnmatched = 903, + + /** + * The capture sequence contains a fork that was not joined to the primary + * stream. + */ + cudaErrorStreamCaptureUnjoined = 904, + + /** + * A dependency would have been created which crosses the capture sequence + * boundary. Only implicit in-stream ordering dependencies are allowed to + * cross the boundary. + */ + cudaErrorStreamCaptureIsolation = 905, + + /** + * The operation would have resulted in a disallowed implicit dependency on + * a current capture sequence from cudaStreamLegacy. + */ + cudaErrorStreamCaptureImplicit = 906, + + /** + * The operation is not permitted on an event which was last recorded in a + * capturing stream. + */ + cudaErrorCapturedEvent = 907, + + /** + * A stream capture sequence not initiated with the ::cudaStreamCaptureModeRelaxed + * argument to ::cudaStreamBeginCapture was passed to ::cudaStreamEndCapture in a + * different thread. + */ + cudaErrorStreamCaptureWrongThread = 908, + + /** + * This indicates that the wait operation has timed out. + */ + cudaErrorTimeout = 909, + + /** + * This error indicates that the graph update was not performed because it included + * changes which violated constraints specific to instantiated graph update. + */ + cudaErrorGraphExecUpdateFailure = 910, + + /** + * This indicates that an async error has occurred in a device outside of CUDA. + * If CUDA was waiting for an external device's signal before consuming shared data, + * the external device signaled an error indicating that the data is not valid for + * consumption. This leaves the process in an inconsistent state and any further CUDA + * work will return the same error. To continue using CUDA, the process must be + * terminated and relaunched. + */ + cudaErrorExternalDevice = 911, + + /** + * This indicates that a kernel launch error has occurred due to cluster + * misconfiguration. + */ + cudaErrorInvalidClusterSize = 912, + + /** + * This indicates that an unknown internal error has occurred. + */ + cudaErrorUnknown = 999 + + /** + * Any unhandled CUDA driver error is added to this value and returned via + * the runtime. Production releases of CUDA should not return such errors. + * \deprecated + * This error return is deprecated as of CUDA 4.1. + */ + , cudaErrorApiFailureBase = 10000 +}; + +/** + * Channel format kind + */ +enum __device_builtin__ cudaChannelFormatKind +{ + cudaChannelFormatKindSigned = 0, /**< Signed channel format */ + cudaChannelFormatKindUnsigned = 1, /**< Unsigned channel format */ + cudaChannelFormatKindFloat = 2, /**< Float channel format */ + cudaChannelFormatKindNone = 3, /**< No channel format */ + cudaChannelFormatKindNV12 = 4, /**< Unsigned 8-bit integers, planar 4:2:0 YUV format */ + cudaChannelFormatKindUnsignedNormalized8X1 = 5, /**< 1 channel unsigned 8-bit normalized integer */ + cudaChannelFormatKindUnsignedNormalized8X2 = 6, /**< 2 channel unsigned 8-bit normalized integer */ + cudaChannelFormatKindUnsignedNormalized8X4 = 7, /**< 4 channel unsigned 8-bit normalized integer */ + cudaChannelFormatKindUnsignedNormalized16X1 = 8, /**< 1 channel unsigned 16-bit normalized integer */ + cudaChannelFormatKindUnsignedNormalized16X2 = 9, /**< 2 channel unsigned 16-bit normalized integer */ + cudaChannelFormatKindUnsignedNormalized16X4 = 10, /**< 4 channel unsigned 16-bit normalized integer */ + cudaChannelFormatKindSignedNormalized8X1 = 11, /**< 1 channel signed 8-bit normalized integer */ + cudaChannelFormatKindSignedNormalized8X2 = 12, /**< 2 channel signed 8-bit normalized integer */ + cudaChannelFormatKindSignedNormalized8X4 = 13, /**< 4 channel signed 8-bit normalized integer */ + cudaChannelFormatKindSignedNormalized16X1 = 14, /**< 1 channel signed 16-bit normalized integer */ + cudaChannelFormatKindSignedNormalized16X2 = 15, /**< 2 channel signed 16-bit normalized integer */ + cudaChannelFormatKindSignedNormalized16X4 = 16, /**< 4 channel signed 16-bit normalized integer */ + cudaChannelFormatKindUnsignedBlockCompressed1 = 17, /**< 4 channel unsigned normalized block-compressed (BC1 compression) format */ + cudaChannelFormatKindUnsignedBlockCompressed1SRGB = 18, /**< 4 channel unsigned normalized block-compressed (BC1 compression) format with sRGB encoding*/ + cudaChannelFormatKindUnsignedBlockCompressed2 = 19, /**< 4 channel unsigned normalized block-compressed (BC2 compression) format */ + cudaChannelFormatKindUnsignedBlockCompressed2SRGB = 20, /**< 4 channel unsigned normalized block-compressed (BC2 compression) format with sRGB encoding */ + cudaChannelFormatKindUnsignedBlockCompressed3 = 21, /**< 4 channel unsigned normalized block-compressed (BC3 compression) format */ + cudaChannelFormatKindUnsignedBlockCompressed3SRGB = 22, /**< 4 channel unsigned normalized block-compressed (BC3 compression) format with sRGB encoding */ + cudaChannelFormatKindUnsignedBlockCompressed4 = 23, /**< 1 channel unsigned normalized block-compressed (BC4 compression) format */ + cudaChannelFormatKindSignedBlockCompressed4 = 24, /**< 1 channel signed normalized block-compressed (BC4 compression) format */ + cudaChannelFormatKindUnsignedBlockCompressed5 = 25, /**< 2 channel unsigned normalized block-compressed (BC5 compression) format */ + cudaChannelFormatKindSignedBlockCompressed5 = 26, /**< 2 channel signed normalized block-compressed (BC5 compression) format */ + cudaChannelFormatKindUnsignedBlockCompressed6H = 27, /**< 3 channel unsigned half-float block-compressed (BC6H compression) format */ + cudaChannelFormatKindSignedBlockCompressed6H = 28, /**< 3 channel signed half-float block-compressed (BC6H compression) format */ + cudaChannelFormatKindUnsignedBlockCompressed7 = 29, /**< 4 channel unsigned normalized block-compressed (BC7 compression) format */ + cudaChannelFormatKindUnsignedBlockCompressed7SRGB = 30 /**< 4 channel unsigned normalized block-compressed (BC7 compression) format with sRGB encoding */ +}; + +/** + * CUDA Channel format descriptor + */ +struct __device_builtin__ cudaChannelFormatDesc +{ + int x; /**< x */ + int y; /**< y */ + int z; /**< z */ + int w; /**< w */ + enum cudaChannelFormatKind f; /**< Channel format kind */ +}; + +/** + * CUDA array + */ +typedef struct cudaArray *cudaArray_t; + +/** + * CUDA array (as source copy argument) + */ +typedef const struct cudaArray *cudaArray_const_t; + +struct cudaArray; + +/** + * CUDA mipmapped array + */ +typedef struct cudaMipmappedArray *cudaMipmappedArray_t; + +/** + * CUDA mipmapped array (as source argument) + */ +typedef const struct cudaMipmappedArray *cudaMipmappedArray_const_t; + +struct cudaMipmappedArray; + +/** + * Indicates that the layered sparse CUDA array or CUDA mipmapped array has a single mip tail region for all layers + */ +#define cudaArraySparsePropertiesSingleMipTail 0x1 + +/** + * Sparse CUDA array and CUDA mipmapped array properties + */ +struct __device_builtin__ cudaArraySparseProperties { + struct { + unsigned int width; /**< Tile width in elements */ + unsigned int height; /**< Tile height in elements */ + unsigned int depth; /**< Tile depth in elements */ + } tileExtent; + unsigned int miptailFirstLevel; /**< First mip level at which the mip tail begins */ + unsigned long long miptailSize; /**< Total size of the mip tail. */ + unsigned int flags; /**< Flags will either be zero or ::cudaArraySparsePropertiesSingleMipTail */ + unsigned int reserved[4]; +}; + +/** + * CUDA array and CUDA mipmapped array memory requirements + */ +struct __device_builtin__ cudaArrayMemoryRequirements { + size_t size; /**< Total size of the array. */ + size_t alignment; /**< Alignment necessary for mapping the array. */ + unsigned int reserved[4]; +}; + +/** + * CUDA memory types + */ +enum __device_builtin__ cudaMemoryType +{ + cudaMemoryTypeUnregistered = 0, /**< Unregistered memory */ + cudaMemoryTypeHost = 1, /**< Host memory */ + cudaMemoryTypeDevice = 2, /**< Device memory */ + cudaMemoryTypeManaged = 3 /**< Managed memory */ +}; + +/** + * CUDA memory copy types + */ +enum __device_builtin__ cudaMemcpyKind +{ + cudaMemcpyHostToHost = 0, /**< Host -> Host */ + cudaMemcpyHostToDevice = 1, /**< Host -> Device */ + cudaMemcpyDeviceToHost = 2, /**< Device -> Host */ + cudaMemcpyDeviceToDevice = 3, /**< Device -> Device */ + cudaMemcpyDefault = 4 /**< Direction of the transfer is inferred from the pointer values. Requires unified virtual addressing */ +}; + +/** + * CUDA Pitched memory pointer + * + * \sa ::make_cudaPitchedPtr + */ +struct __device_builtin__ cudaPitchedPtr +{ + void *ptr; /**< Pointer to allocated memory */ + size_t pitch; /**< Pitch of allocated memory in bytes */ + size_t xsize; /**< Logical width of allocation in elements */ + size_t ysize; /**< Logical height of allocation in elements */ +}; + +/** + * CUDA extent + * + * \sa ::make_cudaExtent + */ +struct __device_builtin__ cudaExtent +{ + size_t width; /**< Width in elements when referring to array memory, in bytes when referring to linear memory */ + size_t height; /**< Height in elements */ + size_t depth; /**< Depth in elements */ +}; + +/** + * CUDA 3D position + * + * \sa ::make_cudaPos + */ +struct __device_builtin__ cudaPos +{ + size_t x; /**< x */ + size_t y; /**< y */ + size_t z; /**< z */ +}; + +/** + * CUDA 3D memory copying parameters + */ +struct __device_builtin__ cudaMemcpy3DParms +{ + cudaArray_t srcArray; /**< Source memory address */ + struct cudaPos srcPos; /**< Source position offset */ + struct cudaPitchedPtr srcPtr; /**< Pitched source memory address */ + + cudaArray_t dstArray; /**< Destination memory address */ + struct cudaPos dstPos; /**< Destination position offset */ + struct cudaPitchedPtr dstPtr; /**< Pitched destination memory address */ + + struct cudaExtent extent; /**< Requested memory copy size */ + enum cudaMemcpyKind kind; /**< Type of transfer */ +}; + +/** + * Memcpy node parameters + */ +struct __device_builtin__ cudaMemcpyNodeParams { + int flags; /**< Must be zero */ + int reserved[3]; /**< Must be zero */ + struct cudaMemcpy3DParms copyParams; /**< Parameters for the memory copy */ +}; + +/** + * CUDA 3D cross-device memory copying parameters + */ +struct __device_builtin__ cudaMemcpy3DPeerParms +{ + cudaArray_t srcArray; /**< Source memory address */ + struct cudaPos srcPos; /**< Source position offset */ + struct cudaPitchedPtr srcPtr; /**< Pitched source memory address */ + int srcDevice; /**< Source device */ + + cudaArray_t dstArray; /**< Destination memory address */ + struct cudaPos dstPos; /**< Destination position offset */ + struct cudaPitchedPtr dstPtr; /**< Pitched destination memory address */ + int dstDevice; /**< Destination device */ + + struct cudaExtent extent; /**< Requested memory copy size */ +}; + +/** + * CUDA Memset node parameters + */ +struct __device_builtin__ cudaMemsetParams { + void *dst; /**< Destination device pointer */ + size_t pitch; /**< Pitch of destination device pointer. Unused if height is 1 */ + unsigned int value; /**< Value to be set */ + unsigned int elementSize; /**< Size of each element in bytes. Must be 1, 2, or 4. */ + size_t width; /**< Width of the row in elements */ + size_t height; /**< Number of rows */ +}; + +/** + * CUDA Memset node parameters + */ +struct __device_builtin__ cudaMemsetParamsV2 { + void *dst; /**< Destination device pointer */ + size_t pitch; /**< Pitch of destination device pointer. Unused if height is 1 */ + unsigned int value; /**< Value to be set */ + unsigned int elementSize; /**< Size of each element in bytes. Must be 1, 2, or 4. */ + size_t width; /**< Width of the row in elements */ + size_t height; /**< Number of rows */ +}; + +/** + * Specifies performance hint with ::cudaAccessPolicyWindow for hitProp and missProp members. + */ +enum __device_builtin__ cudaAccessProperty { + cudaAccessPropertyNormal = 0, /**< Normal cache persistence. */ + cudaAccessPropertyStreaming = 1, /**< Streaming access is less likely to persit from cache. */ + cudaAccessPropertyPersisting = 2 /**< Persisting access is more likely to persist in cache.*/ +}; + +/** + * Specifies an access policy for a window, a contiguous extent of memory + * beginning at base_ptr and ending at base_ptr + num_bytes. + * Partition into many segments and assign segments such that. + * sum of "hit segments" / window == approx. ratio. + * sum of "miss segments" / window == approx 1-ratio. + * Segments and ratio specifications are fitted to the capabilities of + * the architecture. + * Accesses in a hit segment apply the hitProp access policy. + * Accesses in a miss segment apply the missProp access policy. + */ +struct __device_builtin__ cudaAccessPolicyWindow { + void *base_ptr; /**< Starting address of the access policy window. CUDA driver may align it. */ + size_t num_bytes; /**< Size in bytes of the window policy. CUDA driver may restrict the maximum size and alignment. */ + float hitRatio; /**< hitRatio specifies percentage of lines assigned hitProp, rest are assigned missProp. */ + enum cudaAccessProperty hitProp; /**< ::CUaccessProperty set for hit. */ + enum cudaAccessProperty missProp; /**< ::CUaccessProperty set for miss. Must be either NORMAL or STREAMING. */ +}; + +#ifdef _WIN32 +#define CUDART_CB __stdcall +#else +#define CUDART_CB +#endif + +/** + * CUDA host function + * \param userData Argument value passed to the function + */ +typedef void (CUDART_CB *cudaHostFn_t)(void *userData); + +/** + * CUDA host node parameters + */ +struct __device_builtin__ cudaHostNodeParams { + cudaHostFn_t fn; /**< The function to call when the node executes */ + void* userData; /**< Argument to pass to the function */ +}; + +/** + * CUDA host node parameters + */ +struct __device_builtin__ cudaHostNodeParamsV2 { + cudaHostFn_t fn; /**< The function to call when the node executes */ + void* userData; /**< Argument to pass to the function */ +}; + +/** + * Possible stream capture statuses returned by ::cudaStreamIsCapturing + */ +enum __device_builtin__ cudaStreamCaptureStatus { + cudaStreamCaptureStatusNone = 0, /**< Stream is not capturing */ + cudaStreamCaptureStatusActive = 1, /**< Stream is actively capturing */ + cudaStreamCaptureStatusInvalidated = 2 /**< Stream is part of a capture sequence that + has been invalidated, but not terminated */ +}; + +/** + * Possible modes for stream capture thread interactions. For more details see + * ::cudaStreamBeginCapture and ::cudaThreadExchangeStreamCaptureMode + */ +enum __device_builtin__ cudaStreamCaptureMode { + cudaStreamCaptureModeGlobal = 0, + cudaStreamCaptureModeThreadLocal = 1, + cudaStreamCaptureModeRelaxed = 2 +}; + +enum __device_builtin__ cudaSynchronizationPolicy { + cudaSyncPolicyAuto = 1, + cudaSyncPolicySpin = 2, + cudaSyncPolicyYield = 3, + cudaSyncPolicyBlockingSync = 4 +}; + +/** + * Cluster scheduling policies. These may be passed to ::cudaFuncSetAttribute + */ +enum __device_builtin__ cudaClusterSchedulingPolicy { + cudaClusterSchedulingPolicyDefault = 0, /**< the default policy */ + cudaClusterSchedulingPolicySpread = 1, /**< spread the blocks within a cluster to the SMs */ + cudaClusterSchedulingPolicyLoadBalancing = 2 /**< allow the hardware to load-balance the blocks in a cluster to the SMs */ +}; + +/** + * Flags for ::cudaStreamUpdateCaptureDependencies + */ +enum __device_builtin__ cudaStreamUpdateCaptureDependenciesFlags { + cudaStreamAddCaptureDependencies = 0x0, /**< Add new nodes to the dependency set */ + cudaStreamSetCaptureDependencies = 0x1 /**< Replace the dependency set with the new nodes */ +}; + +/** + * Flags for user objects for graphs + */ +enum __device_builtin__ cudaUserObjectFlags { + cudaUserObjectNoDestructorSync = 0x1 /**< Indicates the destructor execution is not synchronized by any CUDA handle. */ +}; + +/** + * Flags for retaining user object references for graphs + */ +enum __device_builtin__ cudaUserObjectRetainFlags { + cudaGraphUserObjectMove = 0x1 /**< Transfer references from the caller rather than creating new references. */ +}; + +/** + * CUDA graphics interop resource + */ +struct cudaGraphicsResource; + +/** + * CUDA graphics interop register flags + */ +enum __device_builtin__ cudaGraphicsRegisterFlags +{ + cudaGraphicsRegisterFlagsNone = 0, /**< Default */ + cudaGraphicsRegisterFlagsReadOnly = 1, /**< CUDA will not write to this resource */ + cudaGraphicsRegisterFlagsWriteDiscard = 2, /**< CUDA will only write to and will not read from this resource */ + cudaGraphicsRegisterFlagsSurfaceLoadStore = 4, /**< CUDA will bind this resource to a surface reference */ + cudaGraphicsRegisterFlagsTextureGather = 8 /**< CUDA will perform texture gather operations on this resource */ +}; + +/** + * CUDA graphics interop map flags + */ +enum __device_builtin__ cudaGraphicsMapFlags +{ + cudaGraphicsMapFlagsNone = 0, /**< Default; Assume resource can be read/written */ + cudaGraphicsMapFlagsReadOnly = 1, /**< CUDA will not write to this resource */ + cudaGraphicsMapFlagsWriteDiscard = 2 /**< CUDA will only write to and will not read from this resource */ +}; + +/** + * CUDA graphics interop array indices for cube maps + */ +enum __device_builtin__ cudaGraphicsCubeFace +{ + cudaGraphicsCubeFacePositiveX = 0x00, /**< Positive X face of cubemap */ + cudaGraphicsCubeFaceNegativeX = 0x01, /**< Negative X face of cubemap */ + cudaGraphicsCubeFacePositiveY = 0x02, /**< Positive Y face of cubemap */ + cudaGraphicsCubeFaceNegativeY = 0x03, /**< Negative Y face of cubemap */ + cudaGraphicsCubeFacePositiveZ = 0x04, /**< Positive Z face of cubemap */ + cudaGraphicsCubeFaceNegativeZ = 0x05 /**< Negative Z face of cubemap */ +}; + +/** + * CUDA resource types + */ +enum __device_builtin__ cudaResourceType +{ + cudaResourceTypeArray = 0x00, /**< Array resource */ + cudaResourceTypeMipmappedArray = 0x01, /**< Mipmapped array resource */ + cudaResourceTypeLinear = 0x02, /**< Linear resource */ + cudaResourceTypePitch2D = 0x03 /**< Pitch 2D resource */ +}; + +/** + * CUDA texture resource view formats + */ +enum __device_builtin__ cudaResourceViewFormat +{ + cudaResViewFormatNone = 0x00, /**< No resource view format (use underlying resource format) */ + cudaResViewFormatUnsignedChar1 = 0x01, /**< 1 channel unsigned 8-bit integers */ + cudaResViewFormatUnsignedChar2 = 0x02, /**< 2 channel unsigned 8-bit integers */ + cudaResViewFormatUnsignedChar4 = 0x03, /**< 4 channel unsigned 8-bit integers */ + cudaResViewFormatSignedChar1 = 0x04, /**< 1 channel signed 8-bit integers */ + cudaResViewFormatSignedChar2 = 0x05, /**< 2 channel signed 8-bit integers */ + cudaResViewFormatSignedChar4 = 0x06, /**< 4 channel signed 8-bit integers */ + cudaResViewFormatUnsignedShort1 = 0x07, /**< 1 channel unsigned 16-bit integers */ + cudaResViewFormatUnsignedShort2 = 0x08, /**< 2 channel unsigned 16-bit integers */ + cudaResViewFormatUnsignedShort4 = 0x09, /**< 4 channel unsigned 16-bit integers */ + cudaResViewFormatSignedShort1 = 0x0a, /**< 1 channel signed 16-bit integers */ + cudaResViewFormatSignedShort2 = 0x0b, /**< 2 channel signed 16-bit integers */ + cudaResViewFormatSignedShort4 = 0x0c, /**< 4 channel signed 16-bit integers */ + cudaResViewFormatUnsignedInt1 = 0x0d, /**< 1 channel unsigned 32-bit integers */ + cudaResViewFormatUnsignedInt2 = 0x0e, /**< 2 channel unsigned 32-bit integers */ + cudaResViewFormatUnsignedInt4 = 0x0f, /**< 4 channel unsigned 32-bit integers */ + cudaResViewFormatSignedInt1 = 0x10, /**< 1 channel signed 32-bit integers */ + cudaResViewFormatSignedInt2 = 0x11, /**< 2 channel signed 32-bit integers */ + cudaResViewFormatSignedInt4 = 0x12, /**< 4 channel signed 32-bit integers */ + cudaResViewFormatHalf1 = 0x13, /**< 1 channel 16-bit floating point */ + cudaResViewFormatHalf2 = 0x14, /**< 2 channel 16-bit floating point */ + cudaResViewFormatHalf4 = 0x15, /**< 4 channel 16-bit floating point */ + cudaResViewFormatFloat1 = 0x16, /**< 1 channel 32-bit floating point */ + cudaResViewFormatFloat2 = 0x17, /**< 2 channel 32-bit floating point */ + cudaResViewFormatFloat4 = 0x18, /**< 4 channel 32-bit floating point */ + cudaResViewFormatUnsignedBlockCompressed1 = 0x19, /**< Block compressed 1 */ + cudaResViewFormatUnsignedBlockCompressed2 = 0x1a, /**< Block compressed 2 */ + cudaResViewFormatUnsignedBlockCompressed3 = 0x1b, /**< Block compressed 3 */ + cudaResViewFormatUnsignedBlockCompressed4 = 0x1c, /**< Block compressed 4 unsigned */ + cudaResViewFormatSignedBlockCompressed4 = 0x1d, /**< Block compressed 4 signed */ + cudaResViewFormatUnsignedBlockCompressed5 = 0x1e, /**< Block compressed 5 unsigned */ + cudaResViewFormatSignedBlockCompressed5 = 0x1f, /**< Block compressed 5 signed */ + cudaResViewFormatUnsignedBlockCompressed6H = 0x20, /**< Block compressed 6 unsigned half-float */ + cudaResViewFormatSignedBlockCompressed6H = 0x21, /**< Block compressed 6 signed half-float */ + cudaResViewFormatUnsignedBlockCompressed7 = 0x22 /**< Block compressed 7 */ +}; + +/** + * CUDA resource descriptor + */ +struct __device_builtin__ cudaResourceDesc { + enum cudaResourceType resType; /**< Resource type */ + + union { + struct { + cudaArray_t array; /**< CUDA array */ + } array; + struct { + cudaMipmappedArray_t mipmap; /**< CUDA mipmapped array */ + } mipmap; + struct { + void *devPtr; /**< Device pointer */ + struct cudaChannelFormatDesc desc; /**< Channel descriptor */ + size_t sizeInBytes; /**< Size in bytes */ + } linear; + struct { + void *devPtr; /**< Device pointer */ + struct cudaChannelFormatDesc desc; /**< Channel descriptor */ + size_t width; /**< Width of the array in elements */ + size_t height; /**< Height of the array in elements */ + size_t pitchInBytes; /**< Pitch between two rows in bytes */ + } pitch2D; + } res; +}; + +/** + * CUDA resource view descriptor + */ +struct __device_builtin__ cudaResourceViewDesc +{ + enum cudaResourceViewFormat format; /**< Resource view format */ + size_t width; /**< Width of the resource view */ + size_t height; /**< Height of the resource view */ + size_t depth; /**< Depth of the resource view */ + unsigned int firstMipmapLevel; /**< First defined mipmap level */ + unsigned int lastMipmapLevel; /**< Last defined mipmap level */ + unsigned int firstLayer; /**< First layer index */ + unsigned int lastLayer; /**< Last layer index */ +}; + +/** + * CUDA pointer attributes + */ +struct __device_builtin__ cudaPointerAttributes +{ + /** + * The type of memory - ::cudaMemoryTypeUnregistered, ::cudaMemoryTypeHost, + * ::cudaMemoryTypeDevice or ::cudaMemoryTypeManaged. + */ + enum cudaMemoryType type; + + /** + * The device against which the memory was allocated or registered. + * If the memory type is ::cudaMemoryTypeDevice then this identifies + * the device on which the memory referred physically resides. If + * the memory type is ::cudaMemoryTypeHost or::cudaMemoryTypeManaged then + * this identifies the device which was current when the memory was allocated + * or registered (and if that device is deinitialized then this allocation + * will vanish with that device's state). + */ + int device; + + /** + * The address which may be dereferenced on the current device to access + * the memory or NULL if no such address exists. + */ + void *devicePointer; + + /** + * The address which may be dereferenced on the host to access the + * memory or NULL if no such address exists. + * + * \note CUDA doesn't check if unregistered memory is allocated so this field + * may contain invalid pointer if an invalid pointer has been passed to CUDA. + */ + void *hostPointer; +}; + +/** + * CUDA function attributes + */ +struct __device_builtin__ cudaFuncAttributes +{ + /** + * The size in bytes of statically-allocated shared memory per block + * required by this function. This does not include dynamically-allocated + * shared memory requested by the user at runtime. + */ + size_t sharedSizeBytes; + + /** + * The size in bytes of user-allocated constant memory required by this + * function. + */ + size_t constSizeBytes; + + /** + * The size in bytes of local memory used by each thread of this function. + */ + size_t localSizeBytes; + + /** + * The maximum number of threads per block, beyond which a launch of the + * function would fail. This number depends on both the function and the + * device on which the function is currently loaded. + */ + int maxThreadsPerBlock; + + /** + * The number of registers used by each thread of this function. + */ + int numRegs; + + /** + * The PTX virtual architecture version for which the function was + * compiled. This value is the major PTX version * 10 + the minor PTX + * version, so a PTX version 1.3 function would return the value 13. + */ + int ptxVersion; + + /** + * The binary architecture version for which the function was compiled. + * This value is the major binary version * 10 + the minor binary version, + * so a binary version 1.3 function would return the value 13. + */ + int binaryVersion; + + /** + * The attribute to indicate whether the function has been compiled with + * user specified option "-Xptxas --dlcm=ca" set. + */ + int cacheModeCA; + + /** + * The maximum size in bytes of dynamic shared memory per block for + * this function. Any launch must have a dynamic shared memory size + * smaller than this value. + */ + int maxDynamicSharedSizeBytes; + + /** + * On devices where the L1 cache and shared memory use the same hardware resources, + * this sets the shared memory carveout preference, in percent of the maximum shared memory. + * Refer to ::cudaDevAttrMaxSharedMemoryPerMultiprocessor. + * This is only a hint, and the driver can choose a different ratio if required to execute the function. + * See ::cudaFuncSetAttribute + */ + int preferredShmemCarveout; + + /** + * If this attribute is set, the kernel must launch with a valid cluster dimension + * specified. + */ + int clusterDimMustBeSet; + + /** + * The required cluster width/height/depth in blocks. The values must either + * all be 0 or all be positive. The validity of the cluster dimensions is + * otherwise checked at launch time. + * + * If the value is set during compile time, it cannot be set at runtime. + * Setting it at runtime should return cudaErrorNotPermitted. + * See ::cudaFuncSetAttribute + */ + int requiredClusterWidth; + int requiredClusterHeight; + int requiredClusterDepth; + + /** + * The block scheduling policy of a function. + * See ::cudaFuncSetAttribute + */ + int clusterSchedulingPolicyPreference; + + /** + * Whether the function can be launched with non-portable cluster size. 1 is + * allowed, 0 is disallowed. A non-portable cluster size may only function + * on the specific SKUs the program is tested on. The launch might fail if + * the program is run on a different hardware platform. + * + * CUDA API provides ::cudaOccupancyMaxActiveClusters to assist with checking + * whether the desired size can be launched on the current device. + * + * Portable Cluster Size + * + * A portable cluster size is guaranteed to be functional on all compute + * capabilities higher than the target compute capability. The portable + * cluster size for sm_90 is 8 blocks per cluster. This value may increase + * for future compute capabilities. + * + * The specific hardware unit may support higher cluster sizes that’s not + * guaranteed to be portable. + * See ::cudaFuncSetAttribute + */ + int nonPortableClusterSizeAllowed; + + /** + * Reserved for future use. + */ + int reserved[16]; +}; + +/** + * CUDA function attributes that can be set using ::cudaFuncSetAttribute + */ +enum __device_builtin__ cudaFuncAttribute +{ + cudaFuncAttributeMaxDynamicSharedMemorySize = 8, /**< Maximum dynamic shared memory size */ + cudaFuncAttributePreferredSharedMemoryCarveout = 9, /**< Preferred shared memory-L1 cache split */ + cudaFuncAttributeClusterDimMustBeSet = 10, /**< Indicator to enforce valid cluster dimension specification on kernel launch */ + cudaFuncAttributeRequiredClusterWidth = 11, /**< Required cluster width */ + cudaFuncAttributeRequiredClusterHeight = 12, /**< Required cluster height */ + cudaFuncAttributeRequiredClusterDepth = 13, /**< Required cluster depth */ + cudaFuncAttributeNonPortableClusterSizeAllowed = 14, /**< Whether non-portable cluster scheduling policy is supported */ + cudaFuncAttributeClusterSchedulingPolicyPreference = 15, /**< Required cluster scheduling policy preference */ + cudaFuncAttributeMax +}; + +/** + * CUDA function cache configurations + */ +enum __device_builtin__ cudaFuncCache +{ + cudaFuncCachePreferNone = 0, /**< Default function cache configuration, no preference */ + cudaFuncCachePreferShared = 1, /**< Prefer larger shared memory and smaller L1 cache */ + cudaFuncCachePreferL1 = 2, /**< Prefer larger L1 cache and smaller shared memory */ + cudaFuncCachePreferEqual = 3 /**< Prefer equal size L1 cache and shared memory */ +}; + +/** + * CUDA shared memory configuration + * \deprecated + */ +enum __device_builtin__ cudaSharedMemConfig +{ + cudaSharedMemBankSizeDefault = 0, + cudaSharedMemBankSizeFourByte = 1, + cudaSharedMemBankSizeEightByte = 2 +}; + +/** + * Shared memory carveout configurations. These may be passed to cudaFuncSetAttribute + */ +enum __device_builtin__ cudaSharedCarveout { + cudaSharedmemCarveoutDefault = -1, /**< No preference for shared memory or L1 (default) */ + cudaSharedmemCarveoutMaxShared = 100, /**< Prefer maximum available shared memory, minimum L1 cache */ + cudaSharedmemCarveoutMaxL1 = 0 /**< Prefer maximum available L1 cache, minimum shared memory */ +}; + +/** + * CUDA device compute modes + */ +enum __device_builtin__ cudaComputeMode +{ + cudaComputeModeDefault = 0, /**< Default compute mode (Multiple threads can use ::cudaSetDevice() with this device) */ + cudaComputeModeExclusive = 1, /**< Compute-exclusive-thread mode (Only one thread in one process will be able to use ::cudaSetDevice() with this device) */ + cudaComputeModeProhibited = 2, /**< Compute-prohibited mode (No threads can use ::cudaSetDevice() with this device) */ + cudaComputeModeExclusiveProcess = 3 /**< Compute-exclusive-process mode (Many threads in one process will be able to use ::cudaSetDevice() with this device) */ +}; + +/** + * CUDA Limits + */ +enum __device_builtin__ cudaLimit +{ + cudaLimitStackSize = 0x00, /**< GPU thread stack size */ + cudaLimitPrintfFifoSize = 0x01, /**< GPU printf FIFO size */ + cudaLimitMallocHeapSize = 0x02, /**< GPU malloc heap size */ + cudaLimitDevRuntimeSyncDepth = 0x03, /**< GPU device runtime synchronize depth */ + cudaLimitDevRuntimePendingLaunchCount = 0x04, /**< GPU device runtime pending launch count */ + cudaLimitMaxL2FetchGranularity = 0x05, /**< A value between 0 and 128 that indicates the maximum fetch granularity of L2 (in Bytes). This is a hint */ + cudaLimitPersistingL2CacheSize = 0x06 /**< A size in bytes for L2 persisting lines cache size */ +}; + +/** + * CUDA Memory Advise values + */ +enum __device_builtin__ cudaMemoryAdvise +{ + cudaMemAdviseSetReadMostly = 1, /**< Data will mostly be read and only occassionally be written to */ + cudaMemAdviseUnsetReadMostly = 2, /**< Undo the effect of ::cudaMemAdviseSetReadMostly */ + cudaMemAdviseSetPreferredLocation = 3, /**< Set the preferred location for the data as the specified device */ + cudaMemAdviseUnsetPreferredLocation = 4, /**< Clear the preferred location for the data */ + cudaMemAdviseSetAccessedBy = 5, /**< Data will be accessed by the specified device, so prevent page faults as much as possible */ + cudaMemAdviseUnsetAccessedBy = 6 /**< Let the Unified Memory subsystem decide on the page faulting policy for the specified device */ +}; + +/** + * CUDA range attributes + */ +enum __device_builtin__ cudaMemRangeAttribute +{ + cudaMemRangeAttributeReadMostly = 1, /**< Whether the range will mostly be read and only occassionally be written to */ + cudaMemRangeAttributePreferredLocation = 2, /**< The preferred location of the range */ + cudaMemRangeAttributeAccessedBy = 3, /**< Memory range has ::cudaMemAdviseSetAccessedBy set for specified device */ + cudaMemRangeAttributeLastPrefetchLocation = 4 /**< The last location to which the range was prefetched */ + , cudaMemRangeAttributePreferredLocationType = 5 /**< The preferred location type of the range */ + , cudaMemRangeAttributePreferredLocationId = 6 /**< The preferred location id of the range */ + , cudaMemRangeAttributeLastPrefetchLocationType = 7 /**< The last location type to which the range was prefetched */ + , cudaMemRangeAttributeLastPrefetchLocationId = 8 /**< The last location id to which the range was prefetched */ +}; + +/** + * CUDA GPUDirect RDMA flush writes APIs supported on the device + */ +enum __device_builtin__ cudaFlushGPUDirectRDMAWritesOptions { + cudaFlushGPUDirectRDMAWritesOptionHost = 1<<0, /**< ::cudaDeviceFlushGPUDirectRDMAWrites() and its CUDA Driver API counterpart are supported on the device. */ + cudaFlushGPUDirectRDMAWritesOptionMemOps = 1<<1 /**< The ::CU_STREAM_WAIT_VALUE_FLUSH flag and the ::CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES MemOp are supported on the CUDA device. */ +}; + +/** + * CUDA GPUDirect RDMA flush writes ordering features of the device + */ +enum __device_builtin__ cudaGPUDirectRDMAWritesOrdering { + cudaGPUDirectRDMAWritesOrderingNone = 0, /**< The device does not natively support ordering of GPUDirect RDMA writes. ::cudaFlushGPUDirectRDMAWrites() can be leveraged if supported. */ + cudaGPUDirectRDMAWritesOrderingOwner = 100, /**< Natively, the device can consistently consume GPUDirect RDMA writes, although other CUDA devices may not. */ + cudaGPUDirectRDMAWritesOrderingAllDevices = 200 /**< Any CUDA device in the system can consistently consume GPUDirect RDMA writes to this device. */ +}; + +/** + * CUDA GPUDirect RDMA flush writes scopes + */ +enum __device_builtin__ cudaFlushGPUDirectRDMAWritesScope { + cudaFlushGPUDirectRDMAWritesToOwner = 100, /**< Blocks until remote writes are visible to the CUDA device context owning the data. */ + cudaFlushGPUDirectRDMAWritesToAllDevices = 200 /**< Blocks until remote writes are visible to all CUDA device contexts. */ +}; + +/** + * CUDA GPUDirect RDMA flush writes targets + */ +enum __device_builtin__ cudaFlushGPUDirectRDMAWritesTarget { + cudaFlushGPUDirectRDMAWritesTargetCurrentDevice /**< Sets the target for ::cudaDeviceFlushGPUDirectRDMAWrites() to the currently active CUDA device context. */ +}; + + +/** + * CUDA device attributes + */ +enum __device_builtin__ cudaDeviceAttr +{ + cudaDevAttrMaxThreadsPerBlock = 1, /**< Maximum number of threads per block */ + cudaDevAttrMaxBlockDimX = 2, /**< Maximum block dimension X */ + cudaDevAttrMaxBlockDimY = 3, /**< Maximum block dimension Y */ + cudaDevAttrMaxBlockDimZ = 4, /**< Maximum block dimension Z */ + cudaDevAttrMaxGridDimX = 5, /**< Maximum grid dimension X */ + cudaDevAttrMaxGridDimY = 6, /**< Maximum grid dimension Y */ + cudaDevAttrMaxGridDimZ = 7, /**< Maximum grid dimension Z */ + cudaDevAttrMaxSharedMemoryPerBlock = 8, /**< Maximum shared memory available per block in bytes */ + cudaDevAttrTotalConstantMemory = 9, /**< Memory available on device for __constant__ variables in a CUDA C kernel in bytes */ + cudaDevAttrWarpSize = 10, /**< Warp size in threads */ + cudaDevAttrMaxPitch = 11, /**< Maximum pitch in bytes allowed by memory copies */ + cudaDevAttrMaxRegistersPerBlock = 12, /**< Maximum number of 32-bit registers available per block */ + cudaDevAttrClockRate = 13, /**< Peak clock frequency in kilohertz */ + cudaDevAttrTextureAlignment = 14, /**< Alignment requirement for textures */ + cudaDevAttrGpuOverlap = 15, /**< Device can possibly copy memory and execute a kernel concurrently */ + cudaDevAttrMultiProcessorCount = 16, /**< Number of multiprocessors on device */ + cudaDevAttrKernelExecTimeout = 17, /**< Specifies whether there is a run time limit on kernels */ + cudaDevAttrIntegrated = 18, /**< Device is integrated with host memory */ + cudaDevAttrCanMapHostMemory = 19, /**< Device can map host memory into CUDA address space */ + cudaDevAttrComputeMode = 20, /**< Compute mode (See ::cudaComputeMode for details) */ + cudaDevAttrMaxTexture1DWidth = 21, /**< Maximum 1D texture width */ + cudaDevAttrMaxTexture2DWidth = 22, /**< Maximum 2D texture width */ + cudaDevAttrMaxTexture2DHeight = 23, /**< Maximum 2D texture height */ + cudaDevAttrMaxTexture3DWidth = 24, /**< Maximum 3D texture width */ + cudaDevAttrMaxTexture3DHeight = 25, /**< Maximum 3D texture height */ + cudaDevAttrMaxTexture3DDepth = 26, /**< Maximum 3D texture depth */ + cudaDevAttrMaxTexture2DLayeredWidth = 27, /**< Maximum 2D layered texture width */ + cudaDevAttrMaxTexture2DLayeredHeight = 28, /**< Maximum 2D layered texture height */ + cudaDevAttrMaxTexture2DLayeredLayers = 29, /**< Maximum layers in a 2D layered texture */ + cudaDevAttrSurfaceAlignment = 30, /**< Alignment requirement for surfaces */ + cudaDevAttrConcurrentKernels = 31, /**< Device can possibly execute multiple kernels concurrently */ + cudaDevAttrEccEnabled = 32, /**< Device has ECC support enabled */ + cudaDevAttrPciBusId = 33, /**< PCI bus ID of the device */ + cudaDevAttrPciDeviceId = 34, /**< PCI device ID of the device */ + cudaDevAttrTccDriver = 35, /**< Device is using TCC driver model */ + cudaDevAttrMemoryClockRate = 36, /**< Peak memory clock frequency in kilohertz */ + cudaDevAttrGlobalMemoryBusWidth = 37, /**< Global memory bus width in bits */ + cudaDevAttrL2CacheSize = 38, /**< Size of L2 cache in bytes */ + cudaDevAttrMaxThreadsPerMultiProcessor = 39, /**< Maximum resident threads per multiprocessor */ + cudaDevAttrAsyncEngineCount = 40, /**< Number of asynchronous engines */ + cudaDevAttrUnifiedAddressing = 41, /**< Device shares a unified address space with the host */ + cudaDevAttrMaxTexture1DLayeredWidth = 42, /**< Maximum 1D layered texture width */ + cudaDevAttrMaxTexture1DLayeredLayers = 43, /**< Maximum layers in a 1D layered texture */ + cudaDevAttrMaxTexture2DGatherWidth = 45, /**< Maximum 2D texture width if cudaArrayTextureGather is set */ + cudaDevAttrMaxTexture2DGatherHeight = 46, /**< Maximum 2D texture height if cudaArrayTextureGather is set */ + cudaDevAttrMaxTexture3DWidthAlt = 47, /**< Alternate maximum 3D texture width */ + cudaDevAttrMaxTexture3DHeightAlt = 48, /**< Alternate maximum 3D texture height */ + cudaDevAttrMaxTexture3DDepthAlt = 49, /**< Alternate maximum 3D texture depth */ + cudaDevAttrPciDomainId = 50, /**< PCI domain ID of the device */ + cudaDevAttrTexturePitchAlignment = 51, /**< Pitch alignment requirement for textures */ + cudaDevAttrMaxTextureCubemapWidth = 52, /**< Maximum cubemap texture width/height */ + cudaDevAttrMaxTextureCubemapLayeredWidth = 53, /**< Maximum cubemap layered texture width/height */ + cudaDevAttrMaxTextureCubemapLayeredLayers = 54, /**< Maximum layers in a cubemap layered texture */ + cudaDevAttrMaxSurface1DWidth = 55, /**< Maximum 1D surface width */ + cudaDevAttrMaxSurface2DWidth = 56, /**< Maximum 2D surface width */ + cudaDevAttrMaxSurface2DHeight = 57, /**< Maximum 2D surface height */ + cudaDevAttrMaxSurface3DWidth = 58, /**< Maximum 3D surface width */ + cudaDevAttrMaxSurface3DHeight = 59, /**< Maximum 3D surface height */ + cudaDevAttrMaxSurface3DDepth = 60, /**< Maximum 3D surface depth */ + cudaDevAttrMaxSurface1DLayeredWidth = 61, /**< Maximum 1D layered surface width */ + cudaDevAttrMaxSurface1DLayeredLayers = 62, /**< Maximum layers in a 1D layered surface */ + cudaDevAttrMaxSurface2DLayeredWidth = 63, /**< Maximum 2D layered surface width */ + cudaDevAttrMaxSurface2DLayeredHeight = 64, /**< Maximum 2D layered surface height */ + cudaDevAttrMaxSurface2DLayeredLayers = 65, /**< Maximum layers in a 2D layered surface */ + cudaDevAttrMaxSurfaceCubemapWidth = 66, /**< Maximum cubemap surface width */ + cudaDevAttrMaxSurfaceCubemapLayeredWidth = 67, /**< Maximum cubemap layered surface width */ + cudaDevAttrMaxSurfaceCubemapLayeredLayers = 68, /**< Maximum layers in a cubemap layered surface */ + cudaDevAttrMaxTexture1DLinearWidth = 69, /**< Maximum 1D linear texture width */ + cudaDevAttrMaxTexture2DLinearWidth = 70, /**< Maximum 2D linear texture width */ + cudaDevAttrMaxTexture2DLinearHeight = 71, /**< Maximum 2D linear texture height */ + cudaDevAttrMaxTexture2DLinearPitch = 72, /**< Maximum 2D linear texture pitch in bytes */ + cudaDevAttrMaxTexture2DMipmappedWidth = 73, /**< Maximum mipmapped 2D texture width */ + cudaDevAttrMaxTexture2DMipmappedHeight = 74, /**< Maximum mipmapped 2D texture height */ + cudaDevAttrComputeCapabilityMajor = 75, /**< Major compute capability version number */ + cudaDevAttrComputeCapabilityMinor = 76, /**< Minor compute capability version number */ + cudaDevAttrMaxTexture1DMipmappedWidth = 77, /**< Maximum mipmapped 1D texture width */ + cudaDevAttrStreamPrioritiesSupported = 78, /**< Device supports stream priorities */ + cudaDevAttrGlobalL1CacheSupported = 79, /**< Device supports caching globals in L1 */ + cudaDevAttrLocalL1CacheSupported = 80, /**< Device supports caching locals in L1 */ + cudaDevAttrMaxSharedMemoryPerMultiprocessor = 81, /**< Maximum shared memory available per multiprocessor in bytes */ + cudaDevAttrMaxRegistersPerMultiprocessor = 82, /**< Maximum number of 32-bit registers available per multiprocessor */ + cudaDevAttrManagedMemory = 83, /**< Device can allocate managed memory on this system */ + cudaDevAttrIsMultiGpuBoard = 84, /**< Device is on a multi-GPU board */ + cudaDevAttrMultiGpuBoardGroupID = 85, /**< Unique identifier for a group of devices on the same multi-GPU board */ + cudaDevAttrHostNativeAtomicSupported = 86, /**< Link between the device and the host supports native atomic operations */ + cudaDevAttrSingleToDoublePrecisionPerfRatio = 87, /**< Ratio of single precision performance (in floating-point operations per second) to double precision performance */ + cudaDevAttrPageableMemoryAccess = 88, /**< Device supports coherently accessing pageable memory without calling cudaHostRegister on it */ + cudaDevAttrConcurrentManagedAccess = 89, /**< Device can coherently access managed memory concurrently with the CPU */ + cudaDevAttrComputePreemptionSupported = 90, /**< Device supports Compute Preemption */ + cudaDevAttrCanUseHostPointerForRegisteredMem = 91, /**< Device can access host registered memory at the same virtual address as the CPU */ + cudaDevAttrReserved92 = 92, + cudaDevAttrReserved93 = 93, + cudaDevAttrReserved94 = 94, + cudaDevAttrCooperativeLaunch = 95, /**< Device supports launching cooperative kernels via ::cudaLaunchCooperativeKernel*/ + cudaDevAttrCooperativeMultiDeviceLaunch = 96, /**< Deprecated, cudaLaunchCooperativeKernelMultiDevice is deprecated. */ + cudaDevAttrMaxSharedMemoryPerBlockOptin = 97, /**< The maximum optin shared memory per block. This value may vary by chip. See ::cudaFuncSetAttribute */ + cudaDevAttrCanFlushRemoteWrites = 98, /**< Device supports flushing of outstanding remote writes. */ + cudaDevAttrHostRegisterSupported = 99, /**< Device supports host memory registration via ::cudaHostRegister. */ + cudaDevAttrPageableMemoryAccessUsesHostPageTables = 100, /**< Device accesses pageable memory via the host's page tables. */ + cudaDevAttrDirectManagedMemAccessFromHost = 101, /**< Host can directly access managed memory on the device without migration. */ + cudaDevAttrMaxBlocksPerMultiprocessor = 106, /**< Maximum number of blocks per multiprocessor */ + cudaDevAttrMaxPersistingL2CacheSize = 108, /**< Maximum L2 persisting lines capacity setting in bytes. */ + cudaDevAttrMaxAccessPolicyWindowSize = 109, /**< Maximum value of cudaAccessPolicyWindow::num_bytes. */ + cudaDevAttrReservedSharedMemoryPerBlock = 111, /**< Shared memory reserved by CUDA driver per block in bytes */ + cudaDevAttrSparseCudaArraySupported = 112, /**< Device supports sparse CUDA arrays and sparse CUDA mipmapped arrays */ + cudaDevAttrHostRegisterReadOnlySupported = 113, /**< Device supports using the ::cudaHostRegister flag cudaHostRegisterReadOnly to register memory that must be mapped as read-only to the GPU */ + cudaDevAttrTimelineSemaphoreInteropSupported = 114, /**< External timeline semaphore interop is supported on the device */ + cudaDevAttrMaxTimelineSemaphoreInteropSupported = 114, /**< Deprecated, External timeline semaphore interop is supported on the device */ + cudaDevAttrMemoryPoolsSupported = 115, /**< Device supports using the ::cudaMallocAsync and ::cudaMemPool family of APIs */ + cudaDevAttrGPUDirectRDMASupported = 116, /**< Device supports GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see https://docs.nvidia.com/cuda/gpudirect-rdma for more information) */ + cudaDevAttrGPUDirectRDMAFlushWritesOptions = 117, /**< The returned attribute shall be interpreted as a bitmask, where the individual bits are listed in the ::cudaFlushGPUDirectRDMAWritesOptions enum */ + cudaDevAttrGPUDirectRDMAWritesOrdering = 118, /**< GPUDirect RDMA writes to the device do not need to be flushed for consumers within the scope indicated by the returned attribute. See ::cudaGPUDirectRDMAWritesOrdering for the numerical values returned here. */ + cudaDevAttrMemoryPoolSupportedHandleTypes = 119, /**< Handle types supported with mempool based IPC */ + cudaDevAttrClusterLaunch = 120, /**< Indicates device supports cluster launch */ + cudaDevAttrDeferredMappingCudaArraySupported = 121, /**< Device supports deferred mapping CUDA arrays and CUDA mipmapped arrays */ + cudaDevAttrReserved122 = 122, + cudaDevAttrReserved123 = 123, + cudaDevAttrReserved124 = 124, + cudaDevAttrIpcEventSupport = 125, /**< Device supports IPC Events. */ + cudaDevAttrMemSyncDomainCount = 126, /**< Number of memory synchronization domains the device supports. */ + cudaDevAttrReserved127 = 127, + cudaDevAttrReserved128 = 128, + cudaDevAttrReserved129 = 129, + cudaDevAttrNumaConfig = 130, /**< NUMA configuration of a device: value is of type cudaDeviceNumaConfig enum */ + cudaDevAttrNumaId = 131, /**< NUMA node ID of the GPU memory */ + cudaDevAttrReserved132 = 132, + cudaDevAttrMpsEnabled = 133, /**< Contexts created on this device will be shared via MPS */ + cudaDevAttrHostNumaId = 134, /**< NUMA ID of the host node closest to the device. Returns -1 when system does not support NUMA. */ + cudaDevAttrMax +}; + +/** + * CUDA memory pool attributes + */ +enum __device_builtin__ cudaMemPoolAttr +{ + /** + * (value type = int) + * Allow cuMemAllocAsync to use memory asynchronously freed + * in another streams as long as a stream ordering dependency + * of the allocating stream on the free action exists. + * Cuda events and null stream interactions can create the required + * stream ordered dependencies. (default enabled) + */ + cudaMemPoolReuseFollowEventDependencies = 0x1, + + /** + * (value type = int) + * Allow reuse of already completed frees when there is no dependency + * between the free and allocation. (default enabled) + */ + cudaMemPoolReuseAllowOpportunistic = 0x2, + + /** + * (value type = int) + * Allow cuMemAllocAsync to insert new stream dependencies + * in order to establish the stream ordering required to reuse + * a piece of memory released by cuFreeAsync (default enabled). + */ + cudaMemPoolReuseAllowInternalDependencies = 0x3, + + + /** + * (value type = cuuint64_t) + * Amount of reserved memory in bytes to hold onto before trying + * to release memory back to the OS. When more than the release + * threshold bytes of memory are held by the memory pool, the + * allocator will try to release memory back to the OS on the + * next call to stream, event or context synchronize. (default 0) + */ + cudaMemPoolAttrReleaseThreshold = 0x4, + + /** + * (value type = cuuint64_t) + * Amount of backing memory currently allocated for the mempool. + */ + cudaMemPoolAttrReservedMemCurrent = 0x5, + + /** + * (value type = cuuint64_t) + * High watermark of backing memory allocated for the mempool since the + * last time it was reset. High watermark can only be reset to zero. + */ + cudaMemPoolAttrReservedMemHigh = 0x6, + + /** + * (value type = cuuint64_t) + * Amount of memory from the pool that is currently in use by the application. + */ + cudaMemPoolAttrUsedMemCurrent = 0x7, + + /** + * (value type = cuuint64_t) + * High watermark of the amount of memory from the pool that was in use by the application since + * the last time it was reset. High watermark can only be reset to zero. + */ + cudaMemPoolAttrUsedMemHigh = 0x8 +}; + +/** + * Specifies the type of location + */ +enum __device_builtin__ cudaMemLocationType { + cudaMemLocationTypeInvalid = 0, + cudaMemLocationTypeDevice = 1 /**< Location is a device location, thus id is a device ordinal */ + , cudaMemLocationTypeHost = 2 /**< Location is host, id is ignored */ + , cudaMemLocationTypeHostNuma = 3 /**< Location is a host NUMA node, thus id is a host NUMA node id */ + , cudaMemLocationTypeHostNumaCurrent = 4 /**< Location is the host NUMA node closest to the current thread's CPU, id is ignored */ +}; + +/** + * Specifies a memory location. + * + * To specify a gpu, set type = ::cudaMemLocationTypeDevice and set id = the gpu's device ordinal. + * To specify a cpu NUMA node, set type = ::cudaMemLocationTypeHostNuma and set id = host NUMA node id. + */ +struct __device_builtin__ cudaMemLocation { + enum cudaMemLocationType type; /**< Specifies the location type, which modifies the meaning of id. */ + int id; /**< identifier for a given this location's ::CUmemLocationType. */ +}; + +/** + * Specifies the memory protection flags for mapping. + */ +enum __device_builtin__ cudaMemAccessFlags { + cudaMemAccessFlagsProtNone = 0, /**< Default, make the address range not accessible */ + cudaMemAccessFlagsProtRead = 1, /**< Make the address range read accessible */ + cudaMemAccessFlagsProtReadWrite = 3 /**< Make the address range read-write accessible */ +}; + +/** + * Memory access descriptor + */ +struct __device_builtin__ cudaMemAccessDesc { + struct cudaMemLocation location; /**< Location on which the request is to change it's accessibility */ + enum cudaMemAccessFlags flags; /**< ::CUmemProt accessibility flags to set on the request */ +}; + +/** + * Defines the allocation types available + */ +enum __device_builtin__ cudaMemAllocationType { + cudaMemAllocationTypeInvalid = 0x0, + /** This allocation type is 'pinned', i.e. cannot migrate from its current + * location while the application is actively using it + */ + cudaMemAllocationTypePinned = 0x1, + cudaMemAllocationTypeMax = 0x7FFFFFFF +}; + +/** + * Flags for specifying particular handle types + */ +enum __device_builtin__ cudaMemAllocationHandleType { + cudaMemHandleTypeNone = 0x0, /**< Does not allow any export mechanism. > */ + cudaMemHandleTypePosixFileDescriptor = 0x1, /**< Allows a file descriptor to be used for exporting. Permitted only on POSIX systems. (int) */ + cudaMemHandleTypeWin32 = 0x2, /**< Allows a Win32 NT handle to be used for exporting. (HANDLE) */ + cudaMemHandleTypeWin32Kmt = 0x4, /**< Allows a Win32 KMT handle to be used for exporting. (D3DKMT_HANDLE) */ + cudaMemHandleTypeFabric = 0x8 /**< Allows a fabric handle to be used for exporting. (cudaMemFabricHandle_t) */ +}; + +/** + * Specifies the properties of allocations made from the pool. + */ +struct __device_builtin__ cudaMemPoolProps { + enum cudaMemAllocationType allocType; /**< Allocation type. Currently must be specified as cudaMemAllocationTypePinned */ + enum cudaMemAllocationHandleType handleTypes; /**< Handle types that will be supported by allocations from the pool. */ + struct cudaMemLocation location; /**< Location allocations should reside. */ + /** + * Windows-specific LPSECURITYATTRIBUTES required when + * ::cudaMemHandleTypeWin32 is specified. This security attribute defines + * the scope of which exported allocations may be tranferred to other + * processes. In all other cases, this field is required to be zero. + */ + void *win32SecurityAttributes; + size_t maxSize; /**< Maximum pool size. When set to 0, defaults to a system dependent value.*/ + unsigned char reserved[56]; /**< reserved for future use, must be 0 */ +}; + +/** + * Opaque data for exporting a pool allocation + */ +struct __device_builtin__ cudaMemPoolPtrExportData { + unsigned char reserved[64]; +}; + +/** + * Memory allocation node parameters + */ +struct __device_builtin__ cudaMemAllocNodeParams { + /** + * in: location where the allocation should reside (specified in ::location). + * ::handleTypes must be ::cudaMemHandleTypeNone. IPC is not supported. + */ + struct cudaMemPoolProps poolProps; /**< in: array of memory access descriptors. Used to describe peer GPU access */ + const struct cudaMemAccessDesc *accessDescs; /**< in: number of memory access descriptors. Must not exceed the number of GPUs. */ + size_t accessDescCount; /**< in: Number of `accessDescs`s */ + size_t bytesize; /**< in: size in bytes of the requested allocation */ + void *dptr; /**< out: address of the allocation returned by CUDA */ +}; + +/** + * Memory allocation node parameters + */ +struct __device_builtin__ cudaMemAllocNodeParamsV2 { + /** + * in: location where the allocation should reside (specified in ::location). + * ::handleTypes must be ::cudaMemHandleTypeNone. IPC is not supported. + */ + struct cudaMemPoolProps poolProps; /**< in: array of memory access descriptors. Used to describe peer GPU access */ + const struct cudaMemAccessDesc *accessDescs; /**< in: number of memory access descriptors. Must not exceed the number of GPUs. */ + size_t accessDescCount; /**< in: Number of `accessDescs`s */ + size_t bytesize; /**< in: size in bytes of the requested allocation */ + void *dptr; /**< out: address of the allocation returned by CUDA */ +}; + +/** + * Memory free node parameters + */ +struct __device_builtin__ cudaMemFreeNodeParams { + void *dptr; /**< in: the pointer to free */ +}; + +/** + * Graph memory attributes + */ +enum __device_builtin__ cudaGraphMemAttributeType { + /** + * (value type = cuuint64_t) + * Amount of memory, in bytes, currently associated with graphs. + */ + cudaGraphMemAttrUsedMemCurrent = 0x0, + + /** + * (value type = cuuint64_t) + * High watermark of memory, in bytes, associated with graphs since the + * last time it was reset. High watermark can only be reset to zero. + */ + cudaGraphMemAttrUsedMemHigh = 0x1, + + /** + * (value type = cuuint64_t) + * Amount of memory, in bytes, currently allocated for use by + * the CUDA graphs asynchronous allocator. + */ + cudaGraphMemAttrReservedMemCurrent = 0x2, + + /** + * (value type = cuuint64_t) + * High watermark of memory, in bytes, currently allocated for use by + * the CUDA graphs asynchronous allocator. + */ + cudaGraphMemAttrReservedMemHigh = 0x3 +}; + +/** + * CUDA device P2P attributes + */ + +enum __device_builtin__ cudaDeviceP2PAttr { + cudaDevP2PAttrPerformanceRank = 1, /**< A relative value indicating the performance of the link between two devices */ + cudaDevP2PAttrAccessSupported = 2, /**< Peer access is enabled */ + cudaDevP2PAttrNativeAtomicSupported = 3, /**< Native atomic operation over the link supported */ + cudaDevP2PAttrCudaArrayAccessSupported = 4 /**< Accessing CUDA arrays over the link supported */ +}; + +/** + * CUDA UUID types + */ +#ifndef CU_UUID_HAS_BEEN_DEFINED +#define CU_UUID_HAS_BEEN_DEFINED +struct __device_builtin__ CUuuid_st { /**< CUDA definition of UUID */ + char bytes[16]; +}; +typedef __device_builtin__ struct CUuuid_st CUuuid; +#endif +typedef __device_builtin__ struct CUuuid_st cudaUUID_t; + +/** + * CUDA device properties + */ +struct __device_builtin__ cudaDeviceProp +{ + char name[256]; /**< ASCII string identifying device */ + cudaUUID_t uuid; /**< 16-byte unique identifier */ + char luid[8]; /**< 8-byte locally unique identifier. Value is undefined on TCC and non-Windows platforms */ + unsigned int luidDeviceNodeMask; /**< LUID device node mask. Value is undefined on TCC and non-Windows platforms */ + size_t totalGlobalMem; /**< Global memory available on device in bytes */ + size_t sharedMemPerBlock; /**< Shared memory available per block in bytes */ + int regsPerBlock; /**< 32-bit registers available per block */ + int warpSize; /**< Warp size in threads */ + size_t memPitch; /**< Maximum pitch in bytes allowed by memory copies */ + int maxThreadsPerBlock; /**< Maximum number of threads per block */ + int maxThreadsDim[3]; /**< Maximum size of each dimension of a block */ + int maxGridSize[3]; /**< Maximum size of each dimension of a grid */ + int clockRate; /**< Deprecated, Clock frequency in kilohertz */ + size_t totalConstMem; /**< Constant memory available on device in bytes */ + int major; /**< Major compute capability */ + int minor; /**< Minor compute capability */ + size_t textureAlignment; /**< Alignment requirement for textures */ + size_t texturePitchAlignment; /**< Pitch alignment requirement for texture references bound to pitched memory */ + int deviceOverlap; /**< Device can concurrently copy memory and execute a kernel. Deprecated. Use instead asyncEngineCount. */ + int multiProcessorCount; /**< Number of multiprocessors on device */ + int kernelExecTimeoutEnabled; /**< Deprecated, Specified whether there is a run time limit on kernels */ + int integrated; /**< Device is integrated as opposed to discrete */ + int canMapHostMemory; /**< Device can map host memory with cudaHostAlloc/cudaHostGetDevicePointer */ + int computeMode; /**< Deprecated, Compute mode (See ::cudaComputeMode) */ + int maxTexture1D; /**< Maximum 1D texture size */ + int maxTexture1DMipmap; /**< Maximum 1D mipmapped texture size */ + int maxTexture1DLinear; /**< Deprecated, do not use. Use cudaDeviceGetTexture1DLinearMaxWidth() or cuDeviceGetTexture1DLinearMaxWidth() instead. */ + int maxTexture2D[2]; /**< Maximum 2D texture dimensions */ + int maxTexture2DMipmap[2]; /**< Maximum 2D mipmapped texture dimensions */ + int maxTexture2DLinear[3]; /**< Maximum dimensions (width, height, pitch) for 2D textures bound to pitched memory */ + int maxTexture2DGather[2]; /**< Maximum 2D texture dimensions if texture gather operations have to be performed */ + int maxTexture3D[3]; /**< Maximum 3D texture dimensions */ + int maxTexture3DAlt[3]; /**< Maximum alternate 3D texture dimensions */ + int maxTextureCubemap; /**< Maximum Cubemap texture dimensions */ + int maxTexture1DLayered[2]; /**< Maximum 1D layered texture dimensions */ + int maxTexture2DLayered[3]; /**< Maximum 2D layered texture dimensions */ + int maxTextureCubemapLayered[2];/**< Maximum Cubemap layered texture dimensions */ + int maxSurface1D; /**< Maximum 1D surface size */ + int maxSurface2D[2]; /**< Maximum 2D surface dimensions */ + int maxSurface3D[3]; /**< Maximum 3D surface dimensions */ + int maxSurface1DLayered[2]; /**< Maximum 1D layered surface dimensions */ + int maxSurface2DLayered[3]; /**< Maximum 2D layered surface dimensions */ + int maxSurfaceCubemap; /**< Maximum Cubemap surface dimensions */ + int maxSurfaceCubemapLayered[2];/**< Maximum Cubemap layered surface dimensions */ + size_t surfaceAlignment; /**< Alignment requirements for surfaces */ + int concurrentKernels; /**< Device can possibly execute multiple kernels concurrently */ + int ECCEnabled; /**< Device has ECC support enabled */ + int pciBusID; /**< PCI bus ID of the device */ + int pciDeviceID; /**< PCI device ID of the device */ + int pciDomainID; /**< PCI domain ID of the device */ + int tccDriver; /**< 1 if device is a Tesla device using TCC driver, 0 otherwise */ + int asyncEngineCount; /**< Number of asynchronous engines */ + int unifiedAddressing; /**< Device shares a unified address space with the host */ + int memoryClockRate; /**< Deprecated, Peak memory clock frequency in kilohertz */ + int memoryBusWidth; /**< Global memory bus width in bits */ + int l2CacheSize; /**< Size of L2 cache in bytes */ + int persistingL2CacheMaxSize; /**< Device's maximum l2 persisting lines capacity setting in bytes */ + int maxThreadsPerMultiProcessor;/**< Maximum resident threads per multiprocessor */ + int streamPrioritiesSupported; /**< Device supports stream priorities */ + int globalL1CacheSupported; /**< Device supports caching globals in L1 */ + int localL1CacheSupported; /**< Device supports caching locals in L1 */ + size_t sharedMemPerMultiprocessor; /**< Shared memory available per multiprocessor in bytes */ + int regsPerMultiprocessor; /**< 32-bit registers available per multiprocessor */ + int managedMemory; /**< Device supports allocating managed memory on this system */ + int isMultiGpuBoard; /**< Device is on a multi-GPU board */ + int multiGpuBoardGroupID; /**< Unique identifier for a group of devices on the same multi-GPU board */ + int hostNativeAtomicSupported; /**< Link between the device and the host supports native atomic operations */ + int singleToDoublePrecisionPerfRatio; /**< Deprecated, Ratio of single precision performance (in floating-point operations per second) to double precision performance */ + int pageableMemoryAccess; /**< Device supports coherently accessing pageable memory without calling cudaHostRegister on it */ + int concurrentManagedAccess; /**< Device can coherently access managed memory concurrently with the CPU */ + int computePreemptionSupported; /**< Device supports Compute Preemption */ + int canUseHostPointerForRegisteredMem; /**< Device can access host registered memory at the same virtual address as the CPU */ + int cooperativeLaunch; /**< Device supports launching cooperative kernels via ::cudaLaunchCooperativeKernel */ + int cooperativeMultiDeviceLaunch; /**< Deprecated, cudaLaunchCooperativeKernelMultiDevice is deprecated. */ + size_t sharedMemPerBlockOptin; /**< Per device maximum shared memory per block usable by special opt in */ + int pageableMemoryAccessUsesHostPageTables; /**< Device accesses pageable memory via the host's page tables */ + int directManagedMemAccessFromHost; /**< Host can directly access managed memory on the device without migration. */ + int maxBlocksPerMultiProcessor; /**< Maximum number of resident blocks per multiprocessor */ + int accessPolicyMaxWindowSize; /**< The maximum value of ::cudaAccessPolicyWindow::num_bytes. */ + size_t reservedSharedMemPerBlock; /**< Shared memory reserved by CUDA driver per block in bytes */ + int hostRegisterSupported; /**< Device supports host memory registration via ::cudaHostRegister. */ + int sparseCudaArraySupported; /**< 1 if the device supports sparse CUDA arrays and sparse CUDA mipmapped arrays, 0 otherwise */ + int hostRegisterReadOnlySupported; /**< Device supports using the ::cudaHostRegister flag cudaHostRegisterReadOnly to register memory that must be mapped as read-only to the GPU */ + int timelineSemaphoreInteropSupported; /**< External timeline semaphore interop is supported on the device */ + int memoryPoolsSupported; /**< 1 if the device supports using the cudaMallocAsync and cudaMemPool family of APIs, 0 otherwise */ + int gpuDirectRDMASupported; /**< 1 if the device supports GPUDirect RDMA APIs, 0 otherwise */ + unsigned int gpuDirectRDMAFlushWritesOptions; /**< Bitmask to be interpreted according to the ::cudaFlushGPUDirectRDMAWritesOptions enum */ + int gpuDirectRDMAWritesOrdering;/**< See the ::cudaGPUDirectRDMAWritesOrdering enum for numerical values */ + unsigned int memoryPoolSupportedHandleTypes; /**< Bitmask of handle types supported with mempool-based IPC */ + int deferredMappingCudaArraySupported; /**< 1 if the device supports deferred mapping CUDA arrays and CUDA mipmapped arrays */ + int ipcEventSupported; /**< Device supports IPC Events. */ + int clusterLaunch; /**< Indicates device supports cluster launch */ + int unifiedFunctionPointers; /**< Indicates device supports unified pointers */ + int reserved2[2]; + int reserved1[1]; /**< Reserved for future use */ + int reserved[60]; /**< Reserved for future use */ +}; + +/** + * CUDA IPC Handle Size + */ +#define CUDA_IPC_HANDLE_SIZE 64 + +/** + * CUDA IPC event handle + */ +typedef __device_builtin__ struct __device_builtin__ cudaIpcEventHandle_st +{ + char reserved[CUDA_IPC_HANDLE_SIZE]; +}cudaIpcEventHandle_t; + +/** + * CUDA IPC memory handle + */ +typedef __device_builtin__ struct __device_builtin__ cudaIpcMemHandle_st +{ + char reserved[CUDA_IPC_HANDLE_SIZE]; +}cudaIpcMemHandle_t; + +/* + * CUDA Mem Fabric Handle + */ +typedef __device_builtin__ struct __device_builtin__ cudaMemFabricHandle_st +{ + char reserved[CUDA_IPC_HANDLE_SIZE]; +}cudaMemFabricHandle_t; + +/** + * External memory handle types + */ +enum __device_builtin__ cudaExternalMemoryHandleType { + /** + * Handle is an opaque file descriptor + */ + cudaExternalMemoryHandleTypeOpaqueFd = 1, + /** + * Handle is an opaque shared NT handle + */ + cudaExternalMemoryHandleTypeOpaqueWin32 = 2, + /** + * Handle is an opaque, globally shared handle + */ + cudaExternalMemoryHandleTypeOpaqueWin32Kmt = 3, + /** + * Handle is a D3D12 heap object + */ + cudaExternalMemoryHandleTypeD3D12Heap = 4, + /** + * Handle is a D3D12 committed resource + */ + cudaExternalMemoryHandleTypeD3D12Resource = 5, + /** + * Handle is a shared NT handle to a D3D11 resource + */ + cudaExternalMemoryHandleTypeD3D11Resource = 6, + /** + * Handle is a globally shared handle to a D3D11 resource + */ + cudaExternalMemoryHandleTypeD3D11ResourceKmt = 7, + /** + * Handle is an NvSciBuf object + */ + cudaExternalMemoryHandleTypeNvSciBuf = 8 +}; + +/** + * Indicates that the external memory object is a dedicated resource + */ +#define cudaExternalMemoryDedicated 0x1 + +/** When the /p flags parameter of ::cudaExternalSemaphoreSignalParams + * contains this flag, it indicates that signaling an external semaphore object + * should skip performing appropriate memory synchronization operations over all + * the external memory objects that are imported as ::cudaExternalMemoryHandleTypeNvSciBuf, + * which otherwise are performed by default to ensure data coherency with other + * importers of the same NvSciBuf memory objects. + */ +#define cudaExternalSemaphoreSignalSkipNvSciBufMemSync 0x01 + +/** When the /p flags parameter of ::cudaExternalSemaphoreWaitParams + * contains this flag, it indicates that waiting an external semaphore object + * should skip performing appropriate memory synchronization operations over all + * the external memory objects that are imported as ::cudaExternalMemoryHandleTypeNvSciBuf, + * which otherwise are performed by default to ensure data coherency with other + * importers of the same NvSciBuf memory objects. + */ +#define cudaExternalSemaphoreWaitSkipNvSciBufMemSync 0x02 + +/** + * When /p flags of ::cudaDeviceGetNvSciSyncAttributes is set to this, + * it indicates that application need signaler specific NvSciSyncAttr + * to be filled by ::cudaDeviceGetNvSciSyncAttributes. + */ +#define cudaNvSciSyncAttrSignal 0x1 + +/** + * When /p flags of ::cudaDeviceGetNvSciSyncAttributes is set to this, + * it indicates that application need waiter specific NvSciSyncAttr + * to be filled by ::cudaDeviceGetNvSciSyncAttributes. + */ +#define cudaNvSciSyncAttrWait 0x2 + +/** + * External memory handle descriptor + */ +struct __device_builtin__ cudaExternalMemoryHandleDesc { + /** + * Type of the handle + */ + enum cudaExternalMemoryHandleType type; + union { + /** + * File descriptor referencing the memory object. Valid + * when type is + * ::cudaExternalMemoryHandleTypeOpaqueFd + */ + int fd; + /** + * Win32 handle referencing the semaphore object. Valid when + * type is one of the following: + * - ::cudaExternalMemoryHandleTypeOpaqueWin32 + * - ::cudaExternalMemoryHandleTypeOpaqueWin32Kmt + * - ::cudaExternalMemoryHandleTypeD3D12Heap + * - ::cudaExternalMemoryHandleTypeD3D12Resource + * - ::cudaExternalMemoryHandleTypeD3D11Resource + * - ::cudaExternalMemoryHandleTypeD3D11ResourceKmt + * Exactly one of 'handle' and 'name' must be non-NULL. If + * type is one of the following: + * ::cudaExternalMemoryHandleTypeOpaqueWin32Kmt + * ::cudaExternalMemoryHandleTypeD3D11ResourceKmt + * then 'name' must be NULL. + */ + struct { + /** + * Valid NT handle. Must be NULL if 'name' is non-NULL + */ + void *handle; + /** + * Name of a valid memory object. + * Must be NULL if 'handle' is non-NULL. + */ + const void *name; + } win32; + /** + * A handle representing NvSciBuf Object. Valid when type + * is ::cudaExternalMemoryHandleTypeNvSciBuf + */ + const void *nvSciBufObject; + } handle; + /** + * Size of the memory allocation + */ + unsigned long long size; + /** + * Flags must either be zero or ::cudaExternalMemoryDedicated + */ + unsigned int flags; +}; + +/** + * External memory buffer descriptor + */ +struct __device_builtin__ cudaExternalMemoryBufferDesc { + /** + * Offset into the memory object where the buffer's base is + */ + unsigned long long offset; + /** + * Size of the buffer + */ + unsigned long long size; + /** + * Flags reserved for future use. Must be zero. + */ + unsigned int flags; +}; + +/** + * External memory mipmap descriptor + */ +struct __device_builtin__ cudaExternalMemoryMipmappedArrayDesc { + /** + * Offset into the memory object where the base level of the + * mipmap chain is. + */ + unsigned long long offset; + /** + * Format of base level of the mipmap chain + */ + struct cudaChannelFormatDesc formatDesc; + /** + * Dimensions of base level of the mipmap chain + */ + struct cudaExtent extent; + /** + * Flags associated with CUDA mipmapped arrays. + * See ::cudaMallocMipmappedArray + */ + unsigned int flags; + /** + * Total number of levels in the mipmap chain + */ + unsigned int numLevels; +}; + +/** + * External semaphore handle types + */ +enum __device_builtin__ cudaExternalSemaphoreHandleType { + /** + * Handle is an opaque file descriptor + */ + cudaExternalSemaphoreHandleTypeOpaqueFd = 1, + /** + * Handle is an opaque shared NT handle + */ + cudaExternalSemaphoreHandleTypeOpaqueWin32 = 2, + /** + * Handle is an opaque, globally shared handle + */ + cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt = 3, + /** + * Handle is a shared NT handle referencing a D3D12 fence object + */ + cudaExternalSemaphoreHandleTypeD3D12Fence = 4, + /** + * Handle is a shared NT handle referencing a D3D11 fence object + */ + cudaExternalSemaphoreHandleTypeD3D11Fence = 5, + /** + * Opaque handle to NvSciSync Object + */ + cudaExternalSemaphoreHandleTypeNvSciSync = 6, + /** + * Handle is a shared NT handle referencing a D3D11 keyed mutex object + */ + cudaExternalSemaphoreHandleTypeKeyedMutex = 7, + /** + * Handle is a shared KMT handle referencing a D3D11 keyed mutex object + */ + cudaExternalSemaphoreHandleTypeKeyedMutexKmt = 8, + /** + * Handle is an opaque handle file descriptor referencing a timeline semaphore + */ + cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd = 9, + /** + * Handle is an opaque handle file descriptor referencing a timeline semaphore + */ + cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 = 10 +}; + +/** + * External semaphore handle descriptor + */ +struct __device_builtin__ cudaExternalSemaphoreHandleDesc { + /** + * Type of the handle + */ + enum cudaExternalSemaphoreHandleType type; + union { + /** + * File descriptor referencing the semaphore object. Valid when + * type is one of the following: + * - ::cudaExternalSemaphoreHandleTypeOpaqueFd + * - ::cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd + */ + int fd; + /** + * Win32 handle referencing the semaphore object. Valid when + * type is one of the following: + * - ::cudaExternalSemaphoreHandleTypeOpaqueWin32 + * - ::cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt + * - ::cudaExternalSemaphoreHandleTypeD3D12Fence + * - ::cudaExternalSemaphoreHandleTypeD3D11Fence + * - ::cudaExternalSemaphoreHandleTypeKeyedMutex + * - ::cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 + * Exactly one of 'handle' and 'name' must be non-NULL. If + * type is one of the following: + * ::cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt + * ::cudaExternalSemaphoreHandleTypeKeyedMutexKmt + * then 'name' must be NULL. + */ + struct { + /** + * Valid NT handle. Must be NULL if 'name' is non-NULL + */ + void *handle; + /** + * Name of a valid synchronization primitive. + * Must be NULL if 'handle' is non-NULL. + */ + const void *name; + } win32; + /** + * Valid NvSciSyncObj. Must be non NULL + */ + const void* nvSciSyncObj; + } handle; + /** + * Flags reserved for the future. Must be zero. + */ + unsigned int flags; +}; + +/** + * External semaphore signal parameters(deprecated) + */ +struct __device_builtin__ cudaExternalSemaphoreSignalParams_v1 { + struct { + /** + * Parameters for fence objects + */ + struct { + /** + * Value of fence to be signaled + */ + unsigned long long value; + } fence; + union { + /** + * Pointer to NvSciSyncFence. Valid if ::cudaExternalSemaphoreHandleType + * is of type ::cudaExternalSemaphoreHandleTypeNvSciSync. + */ + void *fence; + unsigned long long reserved; + } nvSciSync; + /** + * Parameters for keyed mutex objects + */ + struct { + /* + * Value of key to release the mutex with + */ + unsigned long long key; + } keyedMutex; + } params; + /** + * Only when ::cudaExternalSemaphoreSignalParams is used to + * signal a ::cudaExternalSemaphore_t of type + * ::cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is + * ::cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates + * that while signaling the ::cudaExternalSemaphore_t, no memory + * synchronization operations should be performed for any external memory + * object imported as ::cudaExternalMemoryHandleTypeNvSciBuf. + * For all other types of ::cudaExternalSemaphore_t, flags must be zero. + */ + unsigned int flags; +}; + +/** +* External semaphore wait parameters(deprecated) +*/ +struct __device_builtin__ cudaExternalSemaphoreWaitParams_v1 { + struct { + /** + * Parameters for fence objects + */ + struct { + /** + * Value of fence to be waited on + */ + unsigned long long value; + } fence; + union { + /** + * Pointer to NvSciSyncFence. Valid if ::cudaExternalSemaphoreHandleType + * is of type ::cudaExternalSemaphoreHandleTypeNvSciSync. + */ + void *fence; + unsigned long long reserved; + } nvSciSync; + /** + * Parameters for keyed mutex objects + */ + struct { + /** + * Value of key to acquire the mutex with + */ + unsigned long long key; + /** + * Timeout in milliseconds to wait to acquire the mutex + */ + unsigned int timeoutMs; + } keyedMutex; + } params; + /** + * Only when ::cudaExternalSemaphoreSignalParams is used to + * signal a ::cudaExternalSemaphore_t of type + * ::cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is + * ::cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates + * that while waiting for the ::cudaExternalSemaphore_t, no memory + * synchronization operations should be performed for any external memory + * object imported as ::cudaExternalMemoryHandleTypeNvSciBuf. + * For all other types of ::cudaExternalSemaphore_t, flags must be zero. + */ + unsigned int flags; +}; + +/** + * External semaphore signal parameters, compatible with driver type + */ +struct __device_builtin__ cudaExternalSemaphoreSignalParams{ + struct { + /** + * Parameters for fence objects + */ + struct { + /** + * Value of fence to be signaled + */ + unsigned long long value; + } fence; + union { + /** + * Pointer to NvSciSyncFence. Valid if ::cudaExternalSemaphoreHandleType + * is of type ::cudaExternalSemaphoreHandleTypeNvSciSync. + */ + void *fence; + unsigned long long reserved; + } nvSciSync; + /** + * Parameters for keyed mutex objects + */ + struct { + /* + * Value of key to release the mutex with + */ + unsigned long long key; + } keyedMutex; + unsigned int reserved[12]; + } params; + /** + * Only when ::cudaExternalSemaphoreSignalParams is used to + * signal a ::cudaExternalSemaphore_t of type + * ::cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is + * ::cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates + * that while signaling the ::cudaExternalSemaphore_t, no memory + * synchronization operations should be performed for any external memory + * object imported as ::cudaExternalMemoryHandleTypeNvSciBuf. + * For all other types of ::cudaExternalSemaphore_t, flags must be zero. + */ + unsigned int flags; + unsigned int reserved[16]; +}; + +/** + * External semaphore wait parameters, compatible with driver type + */ +struct __device_builtin__ cudaExternalSemaphoreWaitParams { + struct { + /** + * Parameters for fence objects + */ + struct { + /** + * Value of fence to be waited on + */ + unsigned long long value; + } fence; + union { + /** + * Pointer to NvSciSyncFence. Valid if ::cudaExternalSemaphoreHandleType + * is of type ::cudaExternalSemaphoreHandleTypeNvSciSync. + */ + void *fence; + unsigned long long reserved; + } nvSciSync; + /** + * Parameters for keyed mutex objects + */ + struct { + /** + * Value of key to acquire the mutex with + */ + unsigned long long key; + /** + * Timeout in milliseconds to wait to acquire the mutex + */ + unsigned int timeoutMs; + } keyedMutex; + unsigned int reserved[10]; + } params; + /** + * Only when ::cudaExternalSemaphoreSignalParams is used to + * signal a ::cudaExternalSemaphore_t of type + * ::cudaExternalSemaphoreHandleTypeNvSciSync, the valid flag is + * ::cudaExternalSemaphoreSignalSkipNvSciBufMemSync: which indicates + * that while waiting for the ::cudaExternalSemaphore_t, no memory + * synchronization operations should be performed for any external memory + * object imported as ::cudaExternalMemoryHandleTypeNvSciBuf. + * For all other types of ::cudaExternalSemaphore_t, flags must be zero. + */ + unsigned int flags; + unsigned int reserved[16]; +}; + +/******************************************************************************* +* * +* SHORTHAND TYPE DEFINITION USED BY RUNTIME API * +* * +*******************************************************************************/ + +/** + * CUDA Error types + */ +typedef __device_builtin__ enum cudaError cudaError_t; + +/** + * CUDA stream + */ +typedef __device_builtin__ struct CUstream_st *cudaStream_t; + +/** + * CUDA event types + */ +typedef __device_builtin__ struct CUevent_st *cudaEvent_t; + +/** + * CUDA graphics resource types + */ +typedef __device_builtin__ struct cudaGraphicsResource *cudaGraphicsResource_t; + +/** + * CUDA external memory + */ +typedef __device_builtin__ struct CUexternalMemory_st *cudaExternalMemory_t; + +/** + * CUDA external semaphore + */ +typedef __device_builtin__ struct CUexternalSemaphore_st *cudaExternalSemaphore_t; + +/** + * CUDA graph + */ +typedef __device_builtin__ struct CUgraph_st *cudaGraph_t; + +/** + * CUDA graph node. + */ +typedef __device_builtin__ struct CUgraphNode_st *cudaGraphNode_t; + +/** + * CUDA user object for graphs + */ +typedef __device_builtin__ struct CUuserObject_st *cudaUserObject_t; + +/** + * CUDA handle for conditional graph nodes + */ +typedef __device_builtin__ unsigned long long cudaGraphConditionalHandle; + +/** + * CUDA function + */ +typedef __device_builtin__ struct CUfunc_st *cudaFunction_t; + +/** + * CUDA kernel + */ +typedef __device_builtin__ struct CUkern_st *cudaKernel_t; + +/** + * CUDA memory pool + */ +typedef __device_builtin__ struct CUmemPoolHandle_st *cudaMemPool_t; + +/** + * CUDA cooperative group scope + */ +enum __device_builtin__ cudaCGScope { + cudaCGScopeInvalid = 0, /**< Invalid cooperative group scope */ + cudaCGScopeGrid = 1, /**< Scope represented by a grid_group */ + cudaCGScopeMultiGrid = 2 /**< Scope represented by a multi_grid_group */ +}; + +/** + * CUDA launch parameters + */ +struct __device_builtin__ cudaLaunchParams +{ + void *func; /**< Device function symbol */ + dim3 gridDim; /**< Grid dimentions */ + dim3 blockDim; /**< Block dimentions */ + void **args; /**< Arguments */ + size_t sharedMem; /**< Shared memory */ + cudaStream_t stream; /**< Stream identifier */ +}; + +/** + * CUDA GPU kernel node parameters + */ +struct __device_builtin__ cudaKernelNodeParams { + void* func; /**< Kernel to launch */ + dim3 gridDim; /**< Grid dimensions */ + dim3 blockDim; /**< Block dimensions */ + unsigned int sharedMemBytes; /**< Dynamic shared-memory size per thread block in bytes */ + void **kernelParams; /**< Array of pointers to individual kernel arguments*/ + void **extra; /**< Pointer to kernel arguments in the "extra" format */ +}; + +/** + * CUDA GPU kernel node parameters + */ +struct __device_builtin__ cudaKernelNodeParamsV2 { + void* func; /**< Kernel to launch */ + #if !defined(__cplusplus) || __cplusplus >= 201103L + dim3 gridDim; /**< Grid dimensions */ + dim3 blockDim; /**< Block dimensions */ + #else + /* Union members cannot have nontrivial constructors until C++11. */ + uint3 gridDim; /**< Grid dimensions */ + uint3 blockDim; /**< Block dimensions */ + #endif + unsigned int sharedMemBytes; /**< Dynamic shared-memory size per thread block in bytes */ + void **kernelParams; /**< Array of pointers to individual kernel arguments*/ + void **extra; /**< Pointer to kernel arguments in the "extra" format */ +}; + +/** + * External semaphore signal node parameters + */ +struct __device_builtin__ cudaExternalSemaphoreSignalNodeParams { + cudaExternalSemaphore_t* extSemArray; /**< Array of external semaphore handles. */ + const struct cudaExternalSemaphoreSignalParams* paramsArray; /**< Array of external semaphore signal parameters. */ + unsigned int numExtSems; /**< Number of handles and parameters supplied in extSemArray and paramsArray. */ +}; + +/** + * External semaphore signal node parameters + */ +struct __device_builtin__ cudaExternalSemaphoreSignalNodeParamsV2 { + cudaExternalSemaphore_t* extSemArray; /**< Array of external semaphore handles. */ + const struct cudaExternalSemaphoreSignalParams* paramsArray; /**< Array of external semaphore signal parameters. */ + unsigned int numExtSems; /**< Number of handles and parameters supplied in extSemArray and paramsArray. */ +}; + +/** + * External semaphore wait node parameters + */ +struct __device_builtin__ cudaExternalSemaphoreWaitNodeParams { + cudaExternalSemaphore_t* extSemArray; /**< Array of external semaphore handles. */ + const struct cudaExternalSemaphoreWaitParams* paramsArray; /**< Array of external semaphore wait parameters. */ + unsigned int numExtSems; /**< Number of handles and parameters supplied in extSemArray and paramsArray. */ +}; + +/** + * External semaphore wait node parameters + */ +struct __device_builtin__ cudaExternalSemaphoreWaitNodeParamsV2 { + cudaExternalSemaphore_t* extSemArray; /**< Array of external semaphore handles. */ + const struct cudaExternalSemaphoreWaitParams* paramsArray; /**< Array of external semaphore wait parameters. */ + unsigned int numExtSems; /**< Number of handles and parameters supplied in extSemArray and paramsArray. */ +}; + +enum __device_builtin__ cudaGraphConditionalHandleFlags { + cudaGraphCondAssignDefault = 1 /**< Apply default handle value when graph is launched. */ +}; + +/** + * CUDA conditional node types + */ +enum __device_builtin__ cudaGraphConditionalNodeType { + cudaGraphCondTypeIf = 0, /**< Conditional 'if' Node. Body executed once if condition value is non-zero. */ + cudaGraphCondTypeWhile = 1, /**< Conditional 'while' Node. Body executed repeatedly while condition value is non-zero. */ +}; + +/** + * CUDA conditional node parameters + */ +struct __device_builtin__ cudaConditionalNodeParams { + cudaGraphConditionalHandle handle; /**< Conditional node handle. + Handles must be created in advance of creating the node + using ::cudaGraphConditionalHandleCreate. */ + enum cudaGraphConditionalNodeType type; /**< Type of conditional node. */ + unsigned int size; /**< Size of graph output array. Must be 1. */ + cudaGraph_t *phGraph_out; /**< CUDA-owned array populated with conditional node child graphs during creation of the node. + Valid for the lifetime of the conditional node. + The contents of the graph(s) are subject to the following constraints: + + - Allowed node types are kernel nodes, empty nodes, child graphs, memsets, + memcopies, and conditionals. This applies recursively to child graphs and conditional bodies. + - All kernels, including kernels in nested conditionals or child graphs at any level, + must belong to the same CUDA context. + + These graphs may be populated using graph node creation APIs or ::cudaStreamBeginCaptureToGraph. */ +}; + +/** +* CUDA Graph node types +*/ +enum __device_builtin__ cudaGraphNodeType { + cudaGraphNodeTypeKernel = 0x00, /**< GPU kernel node */ + cudaGraphNodeTypeMemcpy = 0x01, /**< Memcpy node */ + cudaGraphNodeTypeMemset = 0x02, /**< Memset node */ + cudaGraphNodeTypeHost = 0x03, /**< Host (executable) node */ + cudaGraphNodeTypeGraph = 0x04, /**< Node which executes an embedded graph */ + cudaGraphNodeTypeEmpty = 0x05, /**< Empty (no-op) node */ + cudaGraphNodeTypeWaitEvent = 0x06, /**< External event wait node */ + cudaGraphNodeTypeEventRecord = 0x07, /**< External event record node */ + cudaGraphNodeTypeExtSemaphoreSignal = 0x08, /**< External semaphore signal node */ + cudaGraphNodeTypeExtSemaphoreWait = 0x09, /**< External semaphore wait node */ + cudaGraphNodeTypeMemAlloc = 0x0a, /**< Memory allocation node */ + cudaGraphNodeTypeMemFree = 0x0b, /**< Memory free node */ + cudaGraphNodeTypeConditional = 0x0d, /**< Conditional node + + May be used to implement a conditional execution path or loop + inside of a graph. The graph(s) contained within the body of the conditional node + can be selectively executed or iterated upon based on the value of a conditional + variable. + + Handles must be created in advance of creating the node + using ::cudaGraphConditionalHandleCreate. + + The following restrictions apply to graphs which contain conditional nodes: + The graph cannot be used in a child node. + Only one instantiation of the graph may exist at any point in time. + The graph cannot be cloned. + + To set the control value, supply a default value when creating the handle and/or + call ::cudaGraphSetConditional from device code.*/ + cudaGraphNodeTypeCount +}; + +/** + * Child graph node parameters + */ +struct __device_builtin__ cudaChildGraphNodeParams { + cudaGraph_t graph; /**< The child graph to clone into the node for node creation, or + a handle to the graph owned by the node for node query */ +}; + +/** + * Event record node parameters + */ +struct __device_builtin__ cudaEventRecordNodeParams { + cudaEvent_t event; /**< The event to record when the node executes */ +}; + +/** + * Event wait node parameters + */ +struct __device_builtin__ cudaEventWaitNodeParams { + cudaEvent_t event; /**< The event to wait on from the node */ +}; + +/** + * Graph node parameters. See ::cudaGraphAddNode. + */ +struct __device_builtin__ cudaGraphNodeParams { + enum cudaGraphNodeType type; /**< Type of the node */ + int reserved0[3]; /**< Reserved. Must be zero. */ + + union { + long long reserved1[29]; /**< Padding. Unused bytes must be zero. */ + struct cudaKernelNodeParamsV2 kernel; /**< Kernel node parameters. */ + struct cudaMemcpyNodeParams memcpy; /**< Memcpy node parameters. */ + struct cudaMemsetParamsV2 memset; /**< Memset node parameters. */ + struct cudaHostNodeParamsV2 host; /**< Host node parameters. */ + struct cudaChildGraphNodeParams graph; /**< Child graph node parameters. */ + struct cudaEventWaitNodeParams eventWait; /**< Event wait node parameters. */ + struct cudaEventRecordNodeParams eventRecord; /**< Event record node parameters. */ + struct cudaExternalSemaphoreSignalNodeParamsV2 extSemSignal; /**< External semaphore signal node parameters. */ + struct cudaExternalSemaphoreWaitNodeParamsV2 extSemWait; /**< External semaphore wait node parameters. */ + struct cudaMemAllocNodeParamsV2 alloc; /**< Memory allocation node parameters. */ + struct cudaMemFreeNodeParams free; /**< Memory free node parameters. */ + struct cudaConditionalNodeParams conditional; /**< Conditional node parameters. */ + }; + + long long reserved2; /**< Reserved bytes. Must be zero. */ +}; + +/** + * Type annotations that can be applied to graph edges as part of ::cudaGraphEdgeData. + */ +typedef __device_builtin__ enum cudaGraphDependencyType_enum { + cudaGraphDependencyTypeDefault = 0, /**< This is an ordinary dependency. */ + cudaGraphDependencyTypeProgrammatic = 1 /**< This dependency type allows the downstream node to + use \c cudaGridDependencySynchronize(). It may only be used + between kernel nodes, and must be used with either the + ::cudaGraphKernelNodePortProgrammatic or + ::cudaGraphKernelNodePortLaunchCompletion outgoing port. */ +} cudaGraphDependencyType; + +/** + * Optional annotation for edges in a CUDA graph. Note, all edges implicitly have annotations and + * default to a zero-initialized value if not specified. A zero-initialized struct indicates a + * standard full serialization of two nodes with memory visibility. + */ +typedef __device_builtin__ struct cudaGraphEdgeData_st { + unsigned char from_port; /**< This indicates when the dependency is triggered from the upstream + node on the edge. The meaning is specfic to the node type. A value + of 0 in all cases means full completion of the upstream node, with + memory visibility to the downstream node or portion thereof + (indicated by \c to_port). +
+ Only kernel nodes define non-zero ports. A kernel node + can use the following output port types: + ::cudaGraphKernelNodePortDefault, ::cudaGraphKernelNodePortProgrammatic, + or ::cudaGraphKernelNodePortLaunchCompletion. */ + unsigned char to_port; /**< This indicates what portion of the downstream node is dependent on + the upstream node or portion thereof (indicated by \c from_port). The + meaning is specific to the node type. A value of 0 in all cases means + the entirety of the downstream node is dependent on the upstream work. +
+ Currently no node types define non-zero ports. Accordingly, this field + must be set to zero. */ + unsigned char type; /**< This should be populated with a value from ::cudaGraphDependencyType. (It + is typed as char due to compiler-specific layout of bitfields.) See + ::cudaGraphDependencyType. */ + unsigned char reserved[5]; /**< These bytes are unused and must be zeroed. This ensures + compatibility if additional fields are added in the future. */ +} cudaGraphEdgeData; + +/** + * This port activates when the kernel has finished executing. + */ +#define cudaGraphKernelNodePortDefault 0 +/** + * This port activates when all blocks of the kernel have performed cudaTriggerProgrammaticLaunchCompletion() + * or have terminated. It must be used with edge type ::cudaGraphDependencyTypeProgrammatic. See also + * ::cudaLaunchAttributeProgrammaticEvent. + */ +#define cudaGraphKernelNodePortProgrammatic 1 +/** + * This port activates when all blocks of the kernel have begun execution. See also + * ::cudaLaunchAttributeLaunchCompletionEvent. + */ +#define cudaGraphKernelNodePortLaunchCompletion 2 + +/** + * CUDA executable (launchable) graph + */ +typedef struct CUgraphExec_st* cudaGraphExec_t; + +/** +* CUDA Graph Update error types +*/ +enum __device_builtin__ cudaGraphExecUpdateResult { + cudaGraphExecUpdateSuccess = 0x0, /**< The update succeeded */ + cudaGraphExecUpdateError = 0x1, /**< The update failed for an unexpected reason which is described in the return value of the function */ + cudaGraphExecUpdateErrorTopologyChanged = 0x2, /**< The update failed because the topology changed */ + cudaGraphExecUpdateErrorNodeTypeChanged = 0x3, /**< The update failed because a node type changed */ + cudaGraphExecUpdateErrorFunctionChanged = 0x4, /**< The update failed because the function of a kernel node changed (CUDA driver < 11.2) */ + cudaGraphExecUpdateErrorParametersChanged = 0x5, /**< The update failed because the parameters changed in a way that is not supported */ + cudaGraphExecUpdateErrorNotSupported = 0x6, /**< The update failed because something about the node is not supported */ + cudaGraphExecUpdateErrorUnsupportedFunctionChange = 0x7, /**< The update failed because the function of a kernel node changed in an unsupported way */ + cudaGraphExecUpdateErrorAttributesChanged = 0x8 /**< The update failed because the node attributes changed in a way that is not supported */ +}; + +/** + * Graph instantiation results +*/ +typedef __device_builtin__ enum cudaGraphInstantiateResult { + cudaGraphInstantiateSuccess = 0, /**< Instantiation succeeded */ + cudaGraphInstantiateError = 1, /**< Instantiation failed for an unexpected reason which is described in the return value of the function */ + cudaGraphInstantiateInvalidStructure = 2, /**< Instantiation failed due to invalid structure, such as cycles */ + cudaGraphInstantiateNodeOperationNotSupported = 3, /**< Instantiation for device launch failed because the graph contained an unsupported operation */ + cudaGraphInstantiateMultipleDevicesNotSupported = 4 /**< Instantiation for device launch failed due to the nodes belonging to different contexts */ +} cudaGraphInstantiateResult; + +/** + * Graph instantiation parameters + */ +typedef __device_builtin__ struct cudaGraphInstantiateParams_st +{ + unsigned long long flags; /**< Instantiation flags */ + cudaStream_t uploadStream; /**< Upload stream */ + cudaGraphNode_t errNode_out; /**< The node which caused instantiation to fail, if any */ + cudaGraphInstantiateResult result_out; /**< Whether instantiation was successful. If it failed, the reason why */ +} cudaGraphInstantiateParams; + +/** + * Result information returned by cudaGraphExecUpdate + */ +typedef __device_builtin__ struct cudaGraphExecUpdateResultInfo_st { + /** + * Gives more specific detail when a cuda graph update fails. + */ + enum cudaGraphExecUpdateResult result; + + /** + * The "to node" of the error edge when the topologies do not match. + * The error node when the error is associated with a specific node. + * NULL when the error is generic. + */ + cudaGraphNode_t errorNode; + + /** + * The from node of error edge when the topologies do not match. Otherwise NULL. + */ + cudaGraphNode_t errorFromNode; +} cudaGraphExecUpdateResultInfo; + +/** + * CUDA device node handle for device-side node update + */ +typedef struct CUgraphDeviceUpdatableNode_st* cudaGraphDeviceNode_t; + +/** + * Specifies the field to update when performing multiple node updates from the device + */ +enum __device_builtin__ cudaGraphKernelNodeField +{ + cudaGraphKernelNodeFieldInvalid = 0, /**< Invalid field */ + cudaGraphKernelNodeFieldGridDim, /**< Grid dimension update */ + cudaGraphKernelNodeFieldParam, /**< Kernel parameter update */ + cudaGraphKernelNodeFieldEnabled /**< Node enable/disable */ +}; + +/** + * Struct to specify a single node update to pass as part of a larger array to ::cudaGraphKernelNodeUpdatesApply + */ +struct __device_builtin__ cudaGraphKernelNodeUpdate { + cudaGraphDeviceNode_t node; /**< Node to update */ + enum cudaGraphKernelNodeField field; /**< Which type of update to apply. Determines how updateData is interpreted */ + union { +#if !defined(__cplusplus) || __cplusplus >= 201103L + dim3 gridDim; /**< Grid dimensions */ +#else + /* Union members cannot have nontrivial constructors until C++11. */ + uint3 gridDim; /**< Grid dimensions */ +#endif + struct { + const void *pValue; /**< Kernel parameter data to write in */ + size_t offset; /**< Offset into the parameter buffer at which to apply the update */ + size_t size; /**< Number of bytes to update */ + } param; /**< Kernel parameter data */ + unsigned int isEnabled; /**< Node enable/disable data. Nonzero if the node should be enabled, 0 if it should be disabled */ + } updateData; /**< Update data to apply. Which field is used depends on field's value */ +}; + +/** + * Flags to specify search options to be used with ::cudaGetDriverEntryPoint + * For more details see ::cuGetProcAddress + */ +enum __device_builtin__ cudaGetDriverEntryPointFlags { + cudaEnableDefault = 0x0, /**< Default search mode for driver symbols. */ + cudaEnableLegacyStream = 0x1, /**< Search for legacy versions of driver symbols. */ + cudaEnablePerThreadDefaultStream = 0x2 /**< Search for per-thread versions of driver symbols. */ +}; + +/** + * Enum for status from obtaining driver entry points, used with ::cudaApiGetDriverEntryPoint + */ +enum __device_builtin__ cudaDriverEntryPointQueryResult { + cudaDriverEntryPointSuccess = 0, /**< Search for symbol found a match */ + cudaDriverEntryPointSymbolNotFound = 1, /**< Search for symbol was not found */ + cudaDriverEntryPointVersionNotSufficent = 2 /**< Search for symbol was found but version wasn't great enough */ +}; + +/** + * CUDA Graph debug write options + */ +enum __device_builtin__ cudaGraphDebugDotFlags { + cudaGraphDebugDotFlagsVerbose = 1<<0, /**< Output all debug data as if every debug flag is enabled */ + cudaGraphDebugDotFlagsKernelNodeParams = 1<<2, /**< Adds cudaKernelNodeParams to output */ + cudaGraphDebugDotFlagsMemcpyNodeParams = 1<<3, /**< Adds cudaMemcpy3DParms to output */ + cudaGraphDebugDotFlagsMemsetNodeParams = 1<<4, /**< Adds cudaMemsetParams to output */ + cudaGraphDebugDotFlagsHostNodeParams = 1<<5, /**< Adds cudaHostNodeParams to output */ + cudaGraphDebugDotFlagsEventNodeParams = 1<<6, /**< Adds cudaEvent_t handle from record and wait nodes to output */ + cudaGraphDebugDotFlagsExtSemasSignalNodeParams = 1<<7, /**< Adds cudaExternalSemaphoreSignalNodeParams values to output */ + cudaGraphDebugDotFlagsExtSemasWaitNodeParams = 1<<8, /**< Adds cudaExternalSemaphoreWaitNodeParams to output */ + cudaGraphDebugDotFlagsKernelNodeAttributes = 1<<9, /**< Adds cudaKernelNodeAttrID values to output */ + cudaGraphDebugDotFlagsHandles = 1<<10 /**< Adds node handles and every kernel function handle to output */ + ,cudaGraphDebugDotFlagsConditionalNodeParams = 1<<15, /**< Adds cudaConditionalNodeParams to output */ +}; + +/** + * Flags for instantiating a graph + */ +enum __device_builtin__ cudaGraphInstantiateFlags { + cudaGraphInstantiateFlagAutoFreeOnLaunch = 1 /**< Automatically free memory allocated in a graph before relaunching. */ + , cudaGraphInstantiateFlagUpload = 2 /**< Automatically upload the graph after instantiation. Only supported by + ::cudaGraphInstantiateWithParams. The upload will be performed using the + stream provided in \p instantiateParams. */ + , cudaGraphInstantiateFlagDeviceLaunch = 4 /**< Instantiate the graph to be launchable from the device. This flag can only + be used on platforms which support unified addressing. This flag cannot be + used in conjunction with cudaGraphInstantiateFlagAutoFreeOnLaunch. */ + , cudaGraphInstantiateFlagUseNodePriority = 8 /**< Run the graph using the per-node priority attributes rather than the + priority of the stream it is launched into. */ +}; + +/** + * Memory Synchronization Domain + * + * A kernel can be launched in a specified memory synchronization domain that affects all memory operations issued by + * that kernel. A memory barrier issued in one domain will only order memory operations in that domain, thus eliminating + * latency increase from memory barriers ordering unrelated traffic. + * + * By default, kernels are launched in domain 0. Kernel launched with ::cudaLaunchMemSyncDomainRemote will have a + * different domain ID. User may also alter the domain ID with ::cudaLaunchMemSyncDomainMap for a specific stream / + * graph node / kernel launch. See ::cudaLaunchAttributeMemSyncDomain, ::cudaStreamSetAttribute, ::cudaLaunchKernelEx, + * ::cudaGraphKernelNodeSetAttribute. + * + * Memory operations done in kernels launched in different domains are considered system-scope distanced. In other + * words, a GPU scoped memory synchronization is not sufficient for memory order to be observed by kernels in another + * memory synchronization domain even if they are on the same GPU. + */ +typedef __device_builtin__ enum cudaLaunchMemSyncDomain { + cudaLaunchMemSyncDomainDefault = 0, /**< Launch kernels in the default domain */ + cudaLaunchMemSyncDomainRemote = 1 /**< Launch kernels in the remote domain */ +} cudaLaunchMemSyncDomain; + +/** + * Memory Synchronization Domain map + * + * See ::cudaLaunchMemSyncDomain. + * + * By default, kernels are launched in domain 0. Kernel launched with ::cudaLaunchMemSyncDomainRemote will have a + * different domain ID. User may also alter the domain ID with ::cudaLaunchMemSyncDomainMap for a specific stream / + * graph node / kernel launch. See ::cudaLaunchAttributeMemSyncDomainMap. + * + * Domain ID range is available through ::cudaDevAttrMemSyncDomainCount. + */ +typedef __device_builtin__ struct cudaLaunchMemSyncDomainMap_st { + unsigned char default_; /**< The default domain ID to use for designated kernels */ + unsigned char remote; /**< The remote domain ID to use for designated kernels */ +} cudaLaunchMemSyncDomainMap; + +/** + * Launch attributes enum; used as id field of ::cudaLaunchAttribute + */ +typedef __device_builtin__ enum cudaLaunchAttributeID { + cudaLaunchAttributeIgnore = 0 /**< Ignored entry, for convenient composition */ + , cudaLaunchAttributeAccessPolicyWindow = 1 /**< Valid for streams, graph nodes, launches. See + ::cudaLaunchAttributeValue::accessPolicyWindow. */ + , cudaLaunchAttributeCooperative = 2 /**< Valid for graph nodes, launches. See + ::cudaLaunchAttributeValue::cooperative. */ + , cudaLaunchAttributeSynchronizationPolicy = 3 /**< Valid for streams. See ::cudaLaunchAttributeValue::syncPolicy. */ + , cudaLaunchAttributeClusterDimension = 4 /**< Valid for graph nodes, launches. See + ::cudaLaunchAttributeValue::clusterDim. */ + , cudaLaunchAttributeClusterSchedulingPolicyPreference = 5 /**< Valid for graph nodes, launches. See + ::cudaLaunchAttributeValue::clusterSchedulingPolicyPreference. */ + , cudaLaunchAttributeProgrammaticStreamSerialization = 6 /**< Valid for launches. Setting + ::cudaLaunchAttributeValue::programmaticStreamSerializationAllowed + to non-0 signals that the kernel will use programmatic + means to resolve its stream dependency, so that the + CUDA runtime should opportunistically allow the grid's + execution to overlap with the previous kernel in the + stream, if that kernel requests the overlap. The + dependent launches can choose to wait on the + dependency using the programmatic sync + (cudaGridDependencySynchronize() or equivalent PTX + instructions). */ + , cudaLaunchAttributeProgrammaticEvent = 7 /**< Valid for launches. Set + ::cudaLaunchAttributeValue::programmaticEvent to + record the event. Event recorded through this launch + attribute is guaranteed to only trigger after all + block in the associated kernel trigger the event. A + block can trigger the event programmatically in a + future CUDA release. A trigger can also be inserted at + the beginning of each block's execution if + triggerAtBlockStart is set to non-0. The dependent + launches can choose to wait on the dependency using + the programmatic sync (cudaGridDependencySynchronize() + or equivalent PTX instructions). Note that dependents + (including the CPU thread calling + cudaEventSynchronize()) are not guaranteed to observe + the release precisely when it is released. For + example, cudaEventSynchronize() may only observe the + event trigger long after the associated kernel has + completed. This recording type is primarily meant for + establishing programmatic dependency between device + tasks. Note also this type of dependency allows, but + does not guarantee, concurrent execution of tasks. +
+ The event supplied must not be an interprocess or + interop event. The event must disable timing (i.e. + must be created with the ::cudaEventDisableTiming flag + set). */ + , cudaLaunchAttributePriority = 8 /**< Valid for streams, graph nodes, launches. See + ::cudaLaunchAttributeValue::priority. */ + , cudaLaunchAttributeMemSyncDomainMap = 9 /**< Valid for streams, graph nodes, launches. See + ::cudaLaunchAttributeValue::memSyncDomainMap. */ + , cudaLaunchAttributeMemSyncDomain = 10 /**< Valid for streams, graph nodes, launches. See + ::cudaLaunchAttributeValue::memSyncDomain. */ + , cudaLaunchAttributeLaunchCompletionEvent = 12 /**< Valid for launches. Set + ::cudaLaunchAttributeValue::launchCompletionEvent to record the + event. +
+ Nominally, the event is triggered once all blocks of the kernel + have begun execution. Currently this is a best effort. If a kernel + B has a launch completion dependency on a kernel A, B may wait + until A is complete. Alternatively, blocks of B may begin before + all blocks of A have begun, for example if B can claim execution + resources unavailable to A (e.g. they run on different GPUs) or + if B is a higher priority than A. + Exercise caution if such an ordering inversion could lead + to deadlock. +
+ A launch completion event is nominally similar to a programmatic + event with \c triggerAtBlockStart set except that it is not + visible to \c cudaGridDependencySynchronize() and can be used with + compute capability less than 9.0. +
+ The event supplied must not be an interprocess or interop event. + The event must disable timing (i.e. must be created with the + ::cudaEventDisableTiming flag set). */ + , cudaLaunchAttributeDeviceUpdatableKernelNode = 13 /**< Valid for graph nodes, launches. This attribute is graphs-only, + and passing it to a launch in a non-capturing stream will result + in an error. +
+ :cudaLaunchAttributeValue::deviceUpdatableKernelNode::deviceUpdatable can + only be set to 0 or 1. Setting the field to 1 indicates that the + corresponding kernel node should be device-updatable. On success, a handle + will be returned via + ::cudaLaunchAttributeValue::deviceUpdatableKernelNode::devNode which can be + passed to the various device-side update functions to update the node's + kernel parameters from within another kernel. For more information on the + types of device updates that can be made, as well as the relevant limitations + thereof, see ::cudaGraphKernelNodeUpdatesApply. +
+ Nodes which are device-updatable have additional restrictions compared to + regular kernel nodes. Firstly, device-updatable nodes cannot be removed + from their graph via ::cudaGraphDestroyNode. Additionally, once opted-in + to this functionality, a node cannot opt out, and any attempt to set the + deviceUpdatable attribute to 0 will result in an error. Device-updatable + kernel nodes also cannot have their attributes copied to/from another kernel + node via ::cudaGraphKernelNodeCopyAttributes. Graphs containing one or more + device-updatable nodes also do not allow multiple instantiation, and neither + the graph nor its instantiated version can be passed to ::cudaGraphExecUpdate. +
+ If a graph contains device-updatable nodes and updates those nodes from the device + from within the graph, the graph must be uploaded with ::cuGraphUpload before it + is launched. For such a graph, if host-side executable graph updates are made to the + device-updatable nodes, the graph must be uploaded before it is launched again. */ +} cudaLaunchAttributeID; + +/** + * Launch attributes union; used as value field of ::cudaLaunchAttribute + */ +typedef __device_builtin__ union cudaLaunchAttributeValue { + char pad[64]; /* Pad to 64 bytes */ + struct cudaAccessPolicyWindow accessPolicyWindow; /**< Value of launch attribute ::cudaLaunchAttributeAccessPolicyWindow. */ + int cooperative; /**< Value of launch attribute ::cudaLaunchAttributeCooperative. Nonzero indicates a cooperative + kernel (see ::cudaLaunchCooperativeKernel). */ + enum cudaSynchronizationPolicy syncPolicy; /**< Value of launch attribute + ::cudaLaunchAttributeSynchronizationPolicy. ::cudaSynchronizationPolicy + for work queued up in this stream. */ + /** + * Value of launch attribute ::cudaLaunchAttributeClusterDimension that + * represents the desired cluster dimensions for the kernel. Opaque type + * with the following fields: + * - \p x - The X dimension of the cluster, in blocks. Must be a divisor + * of the grid X dimension. + * - \p y - The Y dimension of the cluster, in blocks. Must be a divisor + * of the grid Y dimension. + * - \p z - The Z dimension of the cluster, in blocks. Must be a divisor + * of the grid Z dimension. + */ + struct { + unsigned int x; + unsigned int y; + unsigned int z; + } clusterDim; + enum cudaClusterSchedulingPolicy clusterSchedulingPolicyPreference; /**< Value of launch attribute + ::cudaLaunchAttributeClusterSchedulingPolicyPreference. Cluster + scheduling policy preference for the kernel. */ + int programmaticStreamSerializationAllowed; /**< Value of launch attribute + ::cudaLaunchAttributeProgrammaticStreamSerialization. */ + struct { + cudaEvent_t event; /**< Event to fire when all blocks trigger it */ + int flags; /**< Event record flags, see ::cudaEventRecordWithFlags. Does not accept + ::cudaEventRecordExternal. */ + int triggerAtBlockStart; /**< If this is set to non-0, each block launch will automatically trigger the event */ + } programmaticEvent; /**< Value of launch attribute ::cudaLaunchAttributeProgrammaticEvent. */ + int priority; /**< Value of launch attribute ::cudaLaunchAttributePriority. Execution priority of the kernel. */ + cudaLaunchMemSyncDomainMap memSyncDomainMap; /**< Value of launch attribute + ::cudaLaunchAttributeMemSyncDomainMap. See + ::cudaLaunchMemSyncDomainMap. */ + cudaLaunchMemSyncDomain memSyncDomain; /**< Value of launch attribute ::cudaLaunchAttributeMemSyncDomain. See + ::cudaLaunchMemSyncDomain. */ + struct { + cudaEvent_t event; /**< Event to fire when the last block launches */ + int flags; /**< Event record flags, see ::cudaEventRecordWithFlags. Does not accept + ::cudaEventRecordExternal. */ + } launchCompletionEvent; /**< Value of launch attribute ::cudaLaunchAttributeLaunchCompletionEvent. */ + + struct { + int deviceUpdatable; /**< Whether or not the resulting kernel node should be device-updatable. */ + cudaGraphDeviceNode_t devNode; /**< Returns a handle to pass to the various device-side update functions. */ + } deviceUpdatableKernelNode; /**< Value of launch attribute ::CU_LAUNCH_ATTRIBUTE_DEVICE_UPDATABLE_KERNEL_NODE. */ +} cudaLaunchAttributeValue; + +/** + * Launch attribute + */ +typedef __device_builtin__ struct cudaLaunchAttribute_st { + cudaLaunchAttributeID id; /**< Attribute to set */ + char pad[8 - sizeof(cudaLaunchAttributeID)]; + cudaLaunchAttributeValue val; /**< Value of the attribute */ +} cudaLaunchAttribute; + +/** + * CUDA extensible launch configuration + */ +typedef __device_builtin__ struct cudaLaunchConfig_st { + dim3 gridDim; /**< Grid dimensions */ + dim3 blockDim; /**< Block dimensions */ + size_t dynamicSmemBytes; /**< Dynamic shared-memory size per thread block in bytes */ + cudaStream_t stream; /**< Stream identifier */ + cudaLaunchAttribute *attrs; /**< List of attributes; nullable if ::cudaLaunchConfig_t::numAttrs == 0 */ + unsigned int numAttrs; /**< Number of attributes populated in ::cudaLaunchConfig_t::attrs */ +} cudaLaunchConfig_t; + +#define cudaStreamAttrID cudaLaunchAttributeID +#define cudaStreamAttributeAccessPolicyWindow cudaLaunchAttributeAccessPolicyWindow +#define cudaStreamAttributeSynchronizationPolicy cudaLaunchAttributeSynchronizationPolicy +#define cudaStreamAttributeMemSyncDomainMap cudaLaunchAttributeMemSyncDomainMap +#define cudaStreamAttributeMemSyncDomain cudaLaunchAttributeMemSyncDomain +#define cudaStreamAttributePriority cudaLaunchAttributePriority + +#define cudaStreamAttrValue cudaLaunchAttributeValue + +#define cudaKernelNodeAttrID cudaLaunchAttributeID +#define cudaKernelNodeAttributeAccessPolicyWindow cudaLaunchAttributeAccessPolicyWindow +#define cudaKernelNodeAttributeCooperative cudaLaunchAttributeCooperative +#define cudaKernelNodeAttributePriority cudaLaunchAttributePriority +#define cudaKernelNodeAttributeClusterDimension cudaLaunchAttributeClusterDimension +#define cudaKernelNodeAttributeClusterSchedulingPolicyPreference cudaLaunchAttributeClusterSchedulingPolicyPreference +#define cudaKernelNodeAttributeMemSyncDomainMap cudaLaunchAttributeMemSyncDomainMap +#define cudaKernelNodeAttributeMemSyncDomain cudaLaunchAttributeMemSyncDomain +#define cudaKernelNodeAttributeDeviceUpdatableKernelNode cudaLaunchAttributeDeviceUpdatableKernelNode + +#define cudaKernelNodeAttrValue cudaLaunchAttributeValue + +enum __device_builtin__ cudaDeviceNumaConfig { + cudaDeviceNumaConfigNone = 0, /**< The GPU is not a NUMA node */ + cudaDeviceNumaConfigNumaNode, /**< The GPU is a NUMA node, cudaDevAttrNumaId contains its NUMA ID */ +}; + +/** + * CUDA async callback handle + */ +typedef struct cudaAsyncCallbackEntry* cudaAsyncCallbackHandle_t; + +struct cudaAsyncCallbackEntry; + +/** +* Types of async notification that can occur +*/ +typedef __device_builtin__ enum cudaAsyncNotificationType_enum { + cudaAsyncNotificationTypeOverBudget = 0x1 +} cudaAsyncNotificationType; + +/** +* Information describing an async notification event +*/ +typedef __device_builtin__ struct cudaAsyncNotificationInfo +{ + cudaAsyncNotificationType type; + union { + struct { + unsigned long long bytesOverBudget; + } overBudget; + } info; +} cudaAsyncNotificationInfo_t; + +typedef void (*cudaAsyncCallback)(cudaAsyncNotificationInfo_t*, void*, cudaAsyncCallbackHandle_t); + + +/** @} */ +/** @} */ /* END CUDART_TYPES */ + +#endif /* !__CUDACC_RTC_MINIMAL__ */ + +#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DRIVER_TYPES_H__) +#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DRIVER_TYPES_H__ +#endif + +#undef __CUDA_DEPRECATED + + + +#endif /* !__DRIVER_TYPES_H__ */ diff --git a/cuda_toolkit/include/errno.h b/cuda_toolkit/include/errno.h new file mode 100644 index 0000000000000000000000000000000000000000..9e6007b093cc248b65eb06bf218e7966043d662e --- /dev/null +++ b/cuda_toolkit/include/errno.h @@ -0,0 +1,401 @@ +// -*- C++ -*- +//===-------------------------- errno.h -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_ERRNO_H +#define _LIBCUDACXX_ERRNO_H + +/* + errno.h synopsis + +Macros: + + EDOM + EILSEQ // C99 + ERANGE + errno + +*/ + +#include <__config> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include_next + +#ifdef __cplusplus + +#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) + +#ifdef ELAST + +static const int __elast1 = ELAST+1; +static const int __elast2 = ELAST+2; + +#else + +static const int __elast1 = 104; +static const int __elast2 = 105; + +#endif + +#ifdef ENOTRECOVERABLE + +#define EOWNERDEAD __elast1 + +#ifdef ELAST +#undef ELAST +#define ELAST EOWNERDEAD +#endif + +#elif defined(EOWNERDEAD) + +#define ENOTRECOVERABLE __elast1 +#ifdef ELAST +#undef ELAST +#define ELAST ENOTRECOVERABLE +#endif + +#else // defined(EOWNERDEAD) + +#define EOWNERDEAD __elast1 +#define ENOTRECOVERABLE __elast2 +#ifdef ELAST +#undef ELAST +#define ELAST ENOTRECOVERABLE +#endif + +#endif // defined(EOWNERDEAD) + +#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) + +// supply errno values likely to be missing, particularly on Windows + +#ifndef EAFNOSUPPORT +#define EAFNOSUPPORT 9901 +#endif + +#ifndef EADDRINUSE +#define EADDRINUSE 9902 +#endif + +#ifndef EADDRNOTAVAIL +#define EADDRNOTAVAIL 9903 +#endif + +#ifndef EISCONN +#define EISCONN 9904 +#endif + +#ifndef EBADMSG +#define EBADMSG 9905 +#endif + +#ifndef ECONNABORTED +#define ECONNABORTED 9906 +#endif + +#ifndef EALREADY +#define EALREADY 9907 +#endif + +#ifndef ECONNREFUSED +#define ECONNREFUSED 9908 +#endif + +#ifndef ECONNRESET +#define ECONNRESET 9909 +#endif + +#ifndef EDESTADDRREQ +#define EDESTADDRREQ 9910 +#endif + +#ifndef EHOSTUNREACH +#define EHOSTUNREACH 9911 +#endif + +#ifndef EIDRM +#define EIDRM 9912 +#endif + +#ifndef EMSGSIZE +#define EMSGSIZE 9913 +#endif + +#ifndef ENETDOWN +#define ENETDOWN 9914 +#endif + +#ifndef ENETRESET +#define ENETRESET 9915 +#endif + +#ifndef ENETUNREACH +#define ENETUNREACH 9916 +#endif + +#ifndef ENOBUFS +#define ENOBUFS 9917 +#endif + +#ifndef ENOLINK +#define ENOLINK 9918 +#endif + +#ifndef ENODATA +#define ENODATA 9919 +#endif + +#ifndef ENOMSG +#define ENOMSG 9920 +#endif + +#ifndef ENOPROTOOPT +#define ENOPROTOOPT 9921 +#endif + +#ifndef ENOSR +#define ENOSR 9922 +#endif + +#ifndef ENOTSOCK +#define ENOTSOCK 9923 +#endif + +#ifndef ENOSTR +#define ENOSTR 9924 +#endif + +#ifndef ENOTCONN +#define ENOTCONN 9925 +#endif + +#ifndef ENOTSUP +#define ENOTSUP 9926 +#endif + +#ifndef ECANCELED +#define ECANCELED 9927 +#endif + +#ifndef EINPROGRESS +#define EINPROGRESS 9928 +#endif + +#ifndef EOPNOTSUPP +#define EOPNOTSUPP 9929 +#endif + +#ifndef EWOULDBLOCK +#define EWOULDBLOCK 9930 +#endif + +#ifndef EOWNERDEAD +#define EOWNERDEAD 9931 +#endif + +#ifndef EPROTO +#define EPROTO 9932 +#endif + +#ifndef EPROTONOSUPPORT +#define EPROTONOSUPPORT 9933 +#endif + +#ifndef ENOTRECOVERABLE +#define ENOTRECOVERABLE 9934 +#endif + +#ifndef ETIME +#define ETIME 9935 +#endif + +#ifndef ETXTBSY +#define ETXTBSY 9936 +#endif + +#ifndef ETIMEDOUT +#define ETIMEDOUT 9938 +#endif + +#ifndef ELOOP +#define ELOOP 9939 +#endif + +#ifndef EOVERFLOW +#define EOVERFLOW 9940 +#endif + +#ifndef EPROTOTYPE +#define EPROTOTYPE 9941 +#endif + +#ifndef ENOSYS +#define ENOSYS 9942 +#endif + +#ifndef EINVAL +#define EINVAL 9943 +#endif + +#ifndef ERANGE +#define ERANGE 9944 +#endif + +#ifndef EILSEQ +#define EILSEQ 9945 +#endif + +// Windows Mobile doesn't appear to define these: + +#ifndef E2BIG +#define E2BIG 9946 +#endif + +#ifndef EDOM +#define EDOM 9947 +#endif + +#ifndef EFAULT +#define EFAULT 9948 +#endif + +#ifndef EBADF +#define EBADF 9949 +#endif + +#ifndef EPIPE +#define EPIPE 9950 +#endif + +#ifndef EXDEV +#define EXDEV 9951 +#endif + +#ifndef EBUSY +#define EBUSY 9952 +#endif + +#ifndef ENOTEMPTY +#define ENOTEMPTY 9953 +#endif + +#ifndef ENOEXEC +#define ENOEXEC 9954 +#endif + +#ifndef EEXIST +#define EEXIST 9955 +#endif + +#ifndef EFBIG +#define EFBIG 9956 +#endif + +#ifndef ENAMETOOLONG +#define ENAMETOOLONG 9957 +#endif + +#ifndef ENOTTY +#define ENOTTY 9958 +#endif + +#ifndef EINTR +#define EINTR 9959 +#endif + +#ifndef ESPIPE +#define ESPIPE 9960 +#endif + +#ifndef EIO +#define EIO 9961 +#endif + +#ifndef EISDIR +#define EISDIR 9962 +#endif + +#ifndef ECHILD +#define ECHILD 9963 +#endif + +#ifndef ENOLCK +#define ENOLCK 9964 +#endif + +#ifndef ENOSPC +#define ENOSPC 9965 +#endif + +#ifndef ENXIO +#define ENXIO 9966 +#endif + +#ifndef ENODEV +#define ENODEV 9967 +#endif + +#ifndef ENOENT +#define ENOENT 9968 +#endif + +#ifndef ESRCH +#define ESRCH 9969 +#endif + +#ifndef ENOTDIR +#define ENOTDIR 9970 +#endif + +#ifndef ENOMEM +#define ENOMEM 9971 +#endif + +#ifndef EPERM +#define EPERM 9972 +#endif + +#ifndef EACCES +#define EACCES 9973 +#endif + +#ifndef EROFS +#define EROFS 9974 +#endif + +#ifndef EDEADLK +#define EDEADLK 9975 +#endif + +#ifndef EAGAIN +#define EAGAIN 9976 +#endif + +#ifndef ENFILE +#define ENFILE 9977 +#endif + +#ifndef EMFILE +#define EMFILE 9978 +#endif + +#ifndef EMLINK +#define EMLINK 9979 +#endif + +#endif // __cplusplus + +#endif // _LIBCUDACXX_ERRNO_H diff --git a/cuda_toolkit/include/exception b/cuda_toolkit/include/exception new file mode 100644 index 0000000000000000000000000000000000000000..78cba41b9c95d918cbae970baf2a8e05adea78c3 --- /dev/null +++ b/cuda_toolkit/include/exception @@ -0,0 +1,337 @@ +// -*- C++ -*- +//===-------------------------- exception ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_EXCEPTION +#define _LIBCUDACXX_EXCEPTION + +/* + exception synopsis + +namespace std +{ + +class exception +{ +public: + exception() noexcept; + exception(const exception&) noexcept; + exception& operator=(const exception&) noexcept; + virtual ~exception() noexcept; + virtual const char* what() const noexcept; +}; + +class bad_exception + : public exception +{ +public: + bad_exception() noexcept; + bad_exception(const bad_exception&) noexcept; + bad_exception& operator=(const bad_exception&) noexcept; + virtual ~bad_exception() noexcept; + virtual const char* what() const noexcept; +}; + +typedef void (*unexpected_handler)(); +unexpected_handler set_unexpected(unexpected_handler f ) noexcept; +unexpected_handler get_unexpected() noexcept; +[[noreturn]] void unexpected(); + +typedef void (*terminate_handler)(); +terminate_handler set_terminate(terminate_handler f ) noexcept; +terminate_handler get_terminate() noexcept; +[[noreturn]] void terminate() noexcept; + +bool uncaught_exception() noexcept; +int uncaught_exceptions() noexcept; // C++17 + +typedef unspecified exception_ptr; + +exception_ptr current_exception() noexcept; +void rethrow_exception [[noreturn]] (exception_ptr p); +template exception_ptr make_exception_ptr(E e) noexcept; + +class nested_exception +{ +public: + nested_exception() noexcept; + nested_exception(const nested_exception&) noexcept = default; + nested_exception& operator=(const nested_exception&) noexcept = default; + virtual ~nested_exception() = default; + + // access functions + [[noreturn]] void rethrow_nested() const; + exception_ptr nested_ptr() const noexcept; +}; + +template [[noreturn]] void throw_with_nested(T&& t); +template void rethrow_if_nested(const E& e); + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#endif //__cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include "cstddef" +#include "cstdlib" +#include "type_traits" +#include "version" + +#if defined(_LIBCUDACXX_ABI_VCRUNTIME) +#include +#endif +_LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION // purposefully not using versioning namespace + +#if !defined(_LIBCUDACXX_ABI_VCRUNTIME) || defined(__cuda_std__) +class _LIBCUDACXX_EXCEPTION_ABI exception +{ +public: + _LIBCUDACXX_INLINE_VISIBILITY exception() noexcept {} + _LIBCUDACXX_HOST_DEVICE virtual ~exception() noexcept; + _LIBCUDACXX_HOST_DEVICE virtual const char* what() const noexcept; +}; + +class _LIBCUDACXX_EXCEPTION_ABI bad_exception + : public exception +{ +public: + _LIBCUDACXX_INLINE_VISIBILITY bad_exception() noexcept {} + _LIBCUDACXX_HOST_DEVICE virtual ~bad_exception() noexcept; + _LIBCUDACXX_HOST_DEVICE virtual const char* what() const noexcept; +}; +#else // ^^^ !_LIBCUDACXX_ABI_VCRUNTIME || __cuda_std__^^^ / vvv _LIBCUDACXX_ABI_VCRUNTIME vvv +// pull in the exception definition from vcruntime, which lives in namespace std +using ::std::exception; +#endif // !_LIBCUDACXX_ABI_VCRUNTIME + +#if _LIBCUDACXX_STD_VER <= 14 \ + || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) \ + || defined(_LIBCUDACXX_BUILDING_LIBRARY) +typedef void (*unexpected_handler)(); +_LIBCUDACXX_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) noexcept; +_LIBCUDACXX_FUNC_VIS unexpected_handler get_unexpected() noexcept; +_LIBCUDACXX_NORETURN _LIBCUDACXX_FUNC_VIS void unexpected(); +#endif + +typedef void (*terminate_handler)(); +_LIBCUDACXX_FUNC_VIS terminate_handler set_terminate(terminate_handler) noexcept; +_LIBCUDACXX_FUNC_VIS terminate_handler get_terminate() noexcept; +_LIBCUDACXX_NORETURN _LIBCUDACXX_FUNC_VIS void terminate() noexcept; + +_LIBCUDACXX_FUNC_VIS bool uncaught_exception() noexcept; +_LIBCUDACXX_FUNC_VIS _LIBCUDACXX_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() noexcept; + +class _LIBCUDACXX_TYPE_VIS exception_ptr; + +_LIBCUDACXX_FUNC_VIS exception_ptr current_exception() noexcept; +_LIBCUDACXX_NORETURN _LIBCUDACXX_FUNC_VIS void rethrow_exception(exception_ptr); + +#ifndef _LIBCUDACXX_ABI_MICROSOFT + +class _LIBCUDACXX_TYPE_VIS exception_ptr +{ + void* __ptr_; +public: + _LIBCUDACXX_INLINE_VISIBILITY exception_ptr() noexcept : __ptr_() {} + _LIBCUDACXX_INLINE_VISIBILITY exception_ptr(nullptr_t) noexcept : __ptr_() {} + + _LIBCUDACXX_HOST_DEVICE exception_ptr(const exception_ptr&) noexcept; + _LIBCUDACXX_HOST_DEVICE exception_ptr& operator=(const exception_ptr&) noexcept; + _LIBCUDACXX_HOST_DEVICE ~exception_ptr() noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_EXPLICIT operator bool() const noexcept + {return __ptr_ != nullptr;} + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const exception_ptr& __x, const exception_ptr& __y) noexcept + {return __x.__ptr_ == __y.__ptr_;} + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const exception_ptr& __x, const exception_ptr& __y) noexcept + {return !(__x == __y);} + + friend _LIBCUDACXX_FUNC_VIS exception_ptr current_exception() noexcept; + friend _LIBCUDACXX_FUNC_VIS void rethrow_exception(exception_ptr); +}; + +template +_LIBCUDACXX_INLINE_VISIBILITY exception_ptr +make_exception_ptr(_Ep __e) noexcept +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { + throw __e; + } + catch (...) + { + return current_exception(); + } +#else + ((void)__e); + _CUDA_VSTD::abort(); +#endif +} + +#else // _LIBCUDACXX_ABI_MICROSOFT + +class _LIBCUDACXX_EXCEPTION_ABI exception_ptr +{ +#if defined(_LIBCUDACXX_COMPILER_CLANG) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-private-field" +#endif + void* __ptr1_; + void* __ptr2_; +#if defined(_LIBCUDACXX_COMPILER_CLANG) +#pragma clang diagnostic pop +#endif +public: + exception_ptr() noexcept; + exception_ptr(nullptr_t) noexcept; + exception_ptr(const exception_ptr& __other) noexcept; + exception_ptr& operator=(const exception_ptr& __other) noexcept; + exception_ptr& operator=(nullptr_t) noexcept; + ~exception_ptr() noexcept; + _LIBCUDACXX_EXPLICIT operator bool() const noexcept; +}; + +_LIBCUDACXX_FUNC_VIS +bool operator==(const exception_ptr& __x, const exception_ptr& __y) noexcept; + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool operator!=(const exception_ptr& __x, const exception_ptr& __y) noexcept + {return !(__x == __y);} + +_LIBCUDACXX_FUNC_VIS void swap(exception_ptr&, exception_ptr&) noexcept; + +_LIBCUDACXX_FUNC_VIS exception_ptr __copy_exception_ptr(void *__except_, const void* __ptr); +_LIBCUDACXX_FUNC_VIS exception_ptr current_exception() noexcept; +_LIBCUDACXX_NORETURN _LIBCUDACXX_FUNC_VIS void rethrow_exception(exception_ptr p); + +// This is a built-in template function which automagically extracts the required +// information. +template void *__GetExceptionInfo(_E); + +template +_LIBCUDACXX_INLINE_VISIBILITY exception_ptr +make_exception_ptr(_Ep __e) noexcept +{ + return __copy_exception_ptr(_CUDA_VSTD::addressof(__e), __GetExceptionInfo(__e)); +} + +#endif // _LIBCUDACXX_ABI_MICROSOFT +// nested_exception + +class _LIBCUDACXX_EXCEPTION_ABI nested_exception +{ + exception_ptr __ptr_; +public: + _LIBCUDACXX_HOST_DEVICE nested_exception() noexcept; +// nested_exception(const nested_exception&) noexcept = default; +// nested_exception& operator=(const nested_exception&) noexcept = default; + _LIBCUDACXX_HOST_DEVICE virtual ~nested_exception() noexcept; + + // access functions + _LIBCUDACXX_NORETURN _LIBCUDACXX_HOST_DEVICE void rethrow_nested() const; + _LIBCUDACXX_INLINE_VISIBILITY exception_ptr nested_ptr() const noexcept {return __ptr_;} +}; + +template +struct __nested + : public _Tp, + public nested_exception +{ + _LIBCUDACXX_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {} +}; + +#ifndef _LIBCUDACXX_NO_EXCEPTIONS +template +struct __throw_with_nested; + +template +struct __throw_with_nested<_Tp, _Up, true> { + _LIBCUDACXX_NORETURN static inline _LIBCUDACXX_INLINE_VISIBILITY void + __do_throw(_Tp&& __t) + { + throw __nested<_Up>(_CUDA_VSTD::forward<_Tp>(__t)); + } +}; + +template +struct __throw_with_nested<_Tp, _Up, false> { + _LIBCUDACXX_NORETURN static inline _LIBCUDACXX_INLINE_VISIBILITY void + __do_throw(_Tp&& __t) + { + throw _CUDA_VSTD::forward<_Tp>(__t); + } +}; +#endif + +template +_LIBCUDACXX_NORETURN inline _LIBCUDACXX_INLINE_VISIBILITY +void +throw_with_nested(_Tp&& __t) +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + typedef __decay_t<_Tp> _Up; + static_assert( is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible"); + __throw_with_nested<_Tp, _Up, + is_class<_Up>::value && + !is_base_of::value && + !__libcpp_is_final<_Up>::value>:: + __do_throw(_CUDA_VSTD::forward<_Tp>(__t)); +#else + ((void)__t); + // FIXME: Make this abort +#endif +} + +template +struct __can_dynamic_cast : public + _LIBCUDACXX_BOOL_CONSTANT( + is_polymorphic<_From>::value && + (!is_base_of<_To, _From>::value || + is_convertible::value)) +{}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +rethrow_if_nested(const _Ep& __e, + typename enable_if< __can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0) +{ +#if !defined(_LIBCUDACXX_COMPILER_MSVC) + const nested_exception* __nep = dynamic_cast(_CUDA_VSTD::addressof(__e)); + if (__nep) + __nep->rethrow_nested(); +#endif // _LIBCUDACXX_COMPILER_MSVC +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +rethrow_if_nested(const _Ep&, + typename enable_if::value>::type* = 0) +{ +} + +_LIBCUDACXX_END_NAMESPACE_STD_NOVERSION + +#endif // _LIBCUDACXX_EXCEPTION diff --git a/cuda_toolkit/include/execution b/cuda_toolkit/include/execution new file mode 100644 index 0000000000000000000000000000000000000000..298bb5befe98903f60bbbdfb34f2cb52900c1f26 --- /dev/null +++ b/cuda_toolkit/include/execution @@ -0,0 +1,19 @@ +// -*- C++ -*- +//===------------------------- execution ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_EXECUTION +#define _LIBCUDACXX_EXECUTION + +#include <__config> + +#if defined(_LIBCUDACXX_HAS_PARALLEL_ALGORITHMS) && _LIBCUDACXX_STD_VER >= 17 +# include <__pstl_execution> +#endif + +#endif // _LIBCUDACXX_EXECUTION diff --git a/cuda_toolkit/include/expected b/cuda_toolkit/include/expected new file mode 100644 index 0000000000000000000000000000000000000000..f8ec31acc8bc6122711093b3a52e59920efcf367 --- /dev/null +++ b/cuda_toolkit/include/expected @@ -0,0 +1,43 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_EXPECTED +#define _LIBCUDACXX_EXPECTED + +/* +expected synopsis +namespace std { + +} + +*/ + +#ifndef __cuda_std__ +#include <__config> +#endif // __cuda_std__ + +#ifndef _LIBCUDACXX_NO_EXCEPTIONS +#include "__expected/bad_expected_access.h" +#endif // _LIBCUDACXX_NO_EXCEPTIONS +#include "__expected/expected.h" +#include "__expected/unexpect.h" +#include "__expected/unexpected.h" + +#include "version" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#endif // _LIBCUDACXX_EXPECTED diff --git a/cuda_toolkit/include/fatbinary_section.h b/cuda_toolkit/include/fatbinary_section.h new file mode 100644 index 0000000000000000000000000000000000000000..da811ff2781239102e6d068d4aadc821ff961fd1 --- /dev/null +++ b/cuda_toolkit/include/fatbinary_section.h @@ -0,0 +1,61 @@ +/* + * NVIDIA_COPYRIGHT_BEGIN + * + * Copyright (c) 2010-2020, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + * + * NVIDIA_COPYRIGHT_END + */ + +#ifndef fatbinary_section_INCLUDED +#define fatbinary_section_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * These defines are for the fatbin.c runtime wrapper + */ +#define FATBINC_MAGIC 0x466243B1 +#define FATBINC_VERSION 1 +#define FATBINC_LINK_VERSION 2 + +typedef struct { + int magic; + int version; + const unsigned long long* data; + void *filename_or_fatbins; /* version 1: offline filename, + * version 2: array of prelinked fatbins */ +} __fatBinC_Wrapper_t; + +/* + * The section that contains the fatbin control structure + */ +#ifdef STD_OS_Darwin +/* mach-o sections limited to 15 chars, and want __ prefix else strip complains, * so use a different name */ +#define FATBIN_CONTROL_SECTION_NAME "__fatbin" +#define FATBIN_DATA_SECTION_NAME "__nv_fatbin" +/* only need segment name for mach-o */ +#define FATBIN_SEGMENT_NAME "__NV_CUDA" +#else +#define FATBIN_CONTROL_SECTION_NAME ".nvFatBinSegment" +/* + * The section that contains the fatbin data itself + * (put in separate section so easy to find) + */ +#define FATBIN_DATA_SECTION_NAME ".nv_fatbin" +#endif +/* section for pre-linked relocatable fatbin data */ +#define FATBIN_PRELINK_DATA_SECTION_NAME "__nv_relfatbin" + +#ifdef __cplusplus +} +#endif + +#endif /* fatbinary_section_INCLUDED */ diff --git a/cuda_toolkit/include/fenv.h b/cuda_toolkit/include/fenv.h new file mode 100644 index 0000000000000000000000000000000000000000..030e0e1fa0bbd698d88b3bb0f95a8135351f0bb0 --- /dev/null +++ b/cuda_toolkit/include/fenv.h @@ -0,0 +1,120 @@ +// -*- C++ -*- +//===---------------------------- math.h ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_FENV_H +#define _LIBCUDACXX_FENV_H + + +/* + fenv.h synopsis + +This entire header is C99 / C++0X + +Macros: + + FE_DIVBYZERO + FE_INEXACT + FE_INVALID + FE_OVERFLOW + FE_UNDERFLOW + FE_ALL_EXCEPT + FE_DOWNWARD + FE_TONEAREST + FE_TOWARDZERO + FE_UPWARD + FE_DFL_ENV + +Types: + + fenv_t + fexcept_t + +int feclearexcept(int excepts); +int fegetexceptflag(fexcept_t* flagp, int excepts); +int feraiseexcept(int excepts); +int fesetexceptflag(const fexcept_t* flagp, int excepts); +int fetestexcept(int excepts); +int fegetround(); +int fesetround(int round); +int fegetenv(fenv_t* envp); +int feholdexcept(fenv_t* envp); +int fesetenv(const fenv_t* envp); +int feupdateenv(const fenv_t* envp); + + +*/ + +#include <__config> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include_next + +#ifdef __cplusplus + +extern "C++" { + +#ifdef feclearexcept +#undef feclearexcept +#endif + +#ifdef fegetexceptflag +#undef fegetexceptflag +#endif + + +#ifdef feraiseexcept +#undef feraiseexcept +#endif + +#ifdef fesetexceptflag +#undef fesetexceptflag +#endif + + +#ifdef fetestexcept +#undef fetestexcept +#endif + +#ifdef fegetround +#undef fegetround +#endif + +#ifdef fesetround +#undef fesetround +#endif + +#ifdef fegetenv +#undef fegetenv +#endif + +#ifdef feholdexcept +#undef feholdexcept +#endif + + +#ifdef fesetenv +#undef fesetenv +#endif + +#ifdef feupdateenv +#undef feupdateenv +#endif + +} // extern "C++" + +#endif // defined(__cplusplus) + +#endif // _LIBCUDACXX_FENV_H diff --git a/cuda_toolkit/include/filesystem b/cuda_toolkit/include/filesystem new file mode 100644 index 0000000000000000000000000000000000000000..a3498a7d1390f5497f045190473de35fe3ade67b --- /dev/null +++ b/cuda_toolkit/include/filesystem @@ -0,0 +1,2644 @@ +// -*- C++ -*- +//===--------------------------- filesystem -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef _LIBCUDACXX_FILESYSTEM +#define _LIBCUDACXX_FILESYSTEM +/* + filesystem synopsis + + namespace std { namespace filesystem { + + class path; + + void swap(path& lhs, path& rhs) noexcept; + size_t hash_value(const path& p) noexcept; + + bool operator==(const path& lhs, const path& rhs) noexcept; + bool operator!=(const path& lhs, const path& rhs) noexcept; + bool operator< (const path& lhs, const path& rhs) noexcept; + bool operator<=(const path& lhs, const path& rhs) noexcept; + bool operator> (const path& lhs, const path& rhs) noexcept; + bool operator>=(const path& lhs, const path& rhs) noexcept; + + path operator/ (const path& lhs, const path& rhs); + + // fs.path.io operators are friends of path. + template + friend basic_ostream& + operator<<(basic_ostream& os, const path& p); + + template + friend basic_istream& + operator>>(basic_istream& is, path& p); + + template + path u8path(const Source& source); + template + path u8path(InputIterator first, InputIterator last); + + class filesystem_error; + class directory_entry; + + class directory_iterator; + + // enable directory_iterator range-based for statements + directory_iterator begin(directory_iterator iter) noexcept; + directory_iterator end(const directory_iterator&) noexcept; + + class recursive_directory_iterator; + + // enable recursive_directory_iterator range-based for statements + recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept; + recursive_directory_iterator end(const recursive_directory_iterator&) noexcept; + + class file_status; + + struct space_info + { + uintmax_t capacity; + uintmax_t free; + uintmax_t available; + }; + + enum class file_type; + enum class perms; + enum class perm_options; + enum class copy_options; + enum class directory_options; + + typedef chrono::time_point file_time_type; + + // operational functions + + path absolute(const path& p); + path absolute(const path& p, error_code &ec); + + path canonical(const path& p); + path canonical(const path& p, error_code& ec); + + void copy(const path& from, const path& to); + void copy(const path& from, const path& to, error_code& ec); + void copy(const path& from, const path& to, copy_options options); + void copy(const path& from, const path& to, copy_options options, + error_code& ec); + + bool copy_file(const path& from, const path& to); + bool copy_file(const path& from, const path& to, error_code& ec); + bool copy_file(const path& from, const path& to, copy_options option); + bool copy_file(const path& from, const path& to, copy_options option, + error_code& ec); + + void copy_symlink(const path& existing_symlink, const path& new_symlink); + void copy_symlink(const path& existing_symlink, const path& new_symlink, + error_code& ec) noexcept; + + bool create_directories(const path& p); + bool create_directories(const path& p, error_code& ec); + + bool create_directory(const path& p); + bool create_directory(const path& p, error_code& ec) noexcept; + + bool create_directory(const path& p, const path& attributes); + bool create_directory(const path& p, const path& attributes, + error_code& ec) noexcept; + + void create_directory_symlink(const path& to, const path& new_symlink); + void create_directory_symlink(const path& to, const path& new_symlink, + error_code& ec) noexcept; + + void create_hard_link(const path& to, const path& new_hard_link); + void create_hard_link(const path& to, const path& new_hard_link, + error_code& ec) noexcept; + + void create_symlink(const path& to, const path& new_symlink); + void create_symlink(const path& to, const path& new_symlink, + error_code& ec) noexcept; + + path current_path(); + path current_path(error_code& ec); + void current_path(const path& p); + void current_path(const path& p, error_code& ec) noexcept; + + bool exists(file_status s) noexcept; + bool exists(const path& p); + bool exists(const path& p, error_code& ec) noexcept; + + bool equivalent(const path& p1, const path& p2); + bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept; + + uintmax_t file_size(const path& p); + uintmax_t file_size(const path& p, error_code& ec) noexcept; + + uintmax_t hard_link_count(const path& p); + uintmax_t hard_link_count(const path& p, error_code& ec) noexcept; + + bool is_block_file(file_status s) noexcept; + bool is_block_file(const path& p); + bool is_block_file(const path& p, error_code& ec) noexcept; + + bool is_character_file(file_status s) noexcept; + bool is_character_file(const path& p); + bool is_character_file(const path& p, error_code& ec) noexcept; + + bool is_directory(file_status s) noexcept; + bool is_directory(const path& p); + bool is_directory(const path& p, error_code& ec) noexcept; + + bool is_empty(const path& p); + bool is_empty(const path& p, error_code& ec) noexcept; + + bool is_fifo(file_status s) noexcept; + bool is_fifo(const path& p); + bool is_fifo(const path& p, error_code& ec) noexcept; + + bool is_other(file_status s) noexcept; + bool is_other(const path& p); + bool is_other(const path& p, error_code& ec) noexcept; + + bool is_regular_file(file_status s) noexcept; + bool is_regular_file(const path& p); + bool is_regular_file(const path& p, error_code& ec) noexcept; + + bool is_socket(file_status s) noexcept; + bool is_socket(const path& p); + bool is_socket(const path& p, error_code& ec) noexcept; + + bool is_symlink(file_status s) noexcept; + bool is_symlink(const path& p); + bool is_symlink(const path& p, error_code& ec) noexcept; + + file_time_type last_write_time(const path& p); + file_time_type last_write_time(const path& p, error_code& ec) noexcept; + void last_write_time(const path& p, file_time_type new_time); + void last_write_time(const path& p, file_time_type new_time, + error_code& ec) noexcept; + + void permissions(const path& p, perms prms, + perm_options opts=perm_options::replace); + void permissions(const path& p, perms prms, error_code& ec) noexcept; + void permissions(const path& p, perms prms, perm_options opts, + error_code& ec); + + path proximate(const path& p, error_code& ec); + path proximate(const path& p, const path& base = current_path()); + path proximate(const path& p, const path& base, error_code &ec); + + path read_symlink(const path& p); + path read_symlink(const path& p, error_code& ec); + + path relative(const path& p, error_code& ec); + path relative(const path& p, const path& base=current_path()); + path relative(const path& p, const path& base, error_code& ec); + + bool remove(const path& p); + bool remove(const path& p, error_code& ec) noexcept; + + uintmax_t remove_all(const path& p); + uintmax_t remove_all(const path& p, error_code& ec); + + void rename(const path& from, const path& to); + void rename(const path& from, const path& to, error_code& ec) noexcept; + + void resize_file(const path& p, uintmax_t size); + void resize_file(const path& p, uintmax_t size, error_code& ec) noexcept; + + space_info space(const path& p); + space_info space(const path& p, error_code& ec) noexcept; + + file_status status(const path& p); + file_status status(const path& p, error_code& ec) noexcept; + + bool status_known(file_status s) noexcept; + + file_status symlink_status(const path& p); + file_status symlink_status(const path& p, error_code& ec) noexcept; + + path temp_directory_path(); + path temp_directory_path(error_code& ec); + + path weakly_canonical(path const& p); + path weakly_canonical(path const& p, error_code& ec); + + +} } // namespaces std::filesystem + +*/ + +#include <__config> +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for quoted +#include +#include + +#include <__debug> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + +_LIBCUDACXX_BEGIN_NAMESPACE_FILESYSTEM + +_LIBCUDACXX_AVAILABILITY_FILESYSTEM_PUSH + +typedef chrono::time_point<_FilesystemClock> file_time_type; + +struct _LIBCUDACXX_TYPE_VIS space_info { + uintmax_t capacity; + uintmax_t free; + uintmax_t available; +}; + +enum class _LIBCUDACXX_ENUM_VIS file_type : signed char { + none = 0, + not_found = -1, + regular = 1, + directory = 2, + symlink = 3, + block = 4, + character = 5, + fifo = 6, + socket = 7, + unknown = 8 +}; + +enum class _LIBCUDACXX_ENUM_VIS perms : unsigned { + none = 0, + + owner_read = 0400, + owner_write = 0200, + owner_exec = 0100, + owner_all = 0700, + + group_read = 040, + group_write = 020, + group_exec = 010, + group_all = 070, + + others_read = 04, + others_write = 02, + others_exec = 01, + others_all = 07, + + all = 0777, + + set_uid = 04000, + set_gid = 02000, + sticky_bit = 01000, + mask = 07777, + unknown = 0xFFFF, +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr perms operator&(perms _LHS, perms _RHS) { + return static_cast(static_cast(_LHS) & + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr perms operator|(perms _LHS, perms _RHS) { + return static_cast(static_cast(_LHS) | + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr perms operator^(perms _LHS, perms _RHS) { + return static_cast(static_cast(_LHS) ^ + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr perms operator~(perms _LHS) { + return static_cast(~static_cast(_LHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline perms& operator&=(perms& _LHS, perms _RHS) { return _LHS = _LHS & _RHS; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline perms& operator|=(perms& _LHS, perms _RHS) { return _LHS = _LHS | _RHS; } + +_LIBCUDACXX_INLINE_VISIBILITY +inline perms& operator^=(perms& _LHS, perms _RHS) { return _LHS = _LHS ^ _RHS; } + +enum class _LIBCUDACXX_ENUM_VIS perm_options : unsigned char { + replace = 1, + add = 2, + remove = 4, + nofollow = 8 +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr perm_options operator&(perm_options _LHS, perm_options _RHS) { + return static_cast(static_cast(_LHS) & + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr perm_options operator|(perm_options _LHS, perm_options _RHS) { + return static_cast(static_cast(_LHS) | + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr perm_options operator^(perm_options _LHS, perm_options _RHS) { + return static_cast(static_cast(_LHS) ^ + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr perm_options operator~(perm_options _LHS) { + return static_cast(~static_cast(_LHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline perm_options& operator&=(perm_options& _LHS, perm_options _RHS) { + return _LHS = _LHS & _RHS; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline perm_options& operator|=(perm_options& _LHS, perm_options _RHS) { + return _LHS = _LHS | _RHS; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline perm_options& operator^=(perm_options& _LHS, perm_options _RHS) { + return _LHS = _LHS ^ _RHS; +} + +enum class _LIBCUDACXX_ENUM_VIS copy_options : unsigned short { + none = 0, + skip_existing = 1, + overwrite_existing = 2, + update_existing = 4, + recursive = 8, + copy_symlinks = 16, + skip_symlinks = 32, + directories_only = 64, + create_symlinks = 128, + create_hard_links = 256, + __in_recursive_copy = 512, +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr copy_options operator&(copy_options _LHS, copy_options _RHS) { + return static_cast(static_cast(_LHS) & + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr copy_options operator|(copy_options _LHS, copy_options _RHS) { + return static_cast(static_cast(_LHS) | + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr copy_options operator^(copy_options _LHS, copy_options _RHS) { + return static_cast(static_cast(_LHS) ^ + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr copy_options operator~(copy_options _LHS) { + return static_cast(~static_cast(_LHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline copy_options& operator&=(copy_options& _LHS, copy_options _RHS) { + return _LHS = _LHS & _RHS; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline copy_options& operator|=(copy_options& _LHS, copy_options _RHS) { + return _LHS = _LHS | _RHS; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline copy_options& operator^=(copy_options& _LHS, copy_options _RHS) { + return _LHS = _LHS ^ _RHS; +} + +enum class _LIBCUDACXX_ENUM_VIS directory_options : unsigned char { + none = 0, + follow_directory_symlink = 1, + skip_permission_denied = 2 +}; + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr directory_options operator&(directory_options _LHS, + directory_options _RHS) { + return static_cast(static_cast(_LHS) & + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr directory_options operator|(directory_options _LHS, + directory_options _RHS) { + return static_cast(static_cast(_LHS) | + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr directory_options operator^(directory_options _LHS, + directory_options _RHS) { + return static_cast(static_cast(_LHS) ^ + static_cast(_RHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline constexpr directory_options operator~(directory_options _LHS) { + return static_cast(~static_cast(_LHS)); +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline directory_options& operator&=(directory_options& _LHS, + directory_options _RHS) { + return _LHS = _LHS & _RHS; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline directory_options& operator|=(directory_options& _LHS, + directory_options _RHS) { + return _LHS = _LHS | _RHS; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline directory_options& operator^=(directory_options& _LHS, + directory_options _RHS) { + return _LHS = _LHS ^ _RHS; +} + +class _LIBCUDACXX_TYPE_VIS file_status { +public: + // constructors + _LIBCUDACXX_INLINE_VISIBILITY + file_status() noexcept : file_status(file_type::none) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept + : __ft_(__ft), + __prms_(__prms) {} + + file_status(const file_status&) noexcept = default; + file_status(file_status&&) noexcept = default; + + _LIBCUDACXX_INLINE_VISIBILITY + ~file_status() {} + + file_status& operator=(const file_status&) noexcept = default; + file_status& operator=(file_status&&) noexcept = default; + + // observers + _LIBCUDACXX_INLINE_VISIBILITY + file_type type() const noexcept { return __ft_; } + + _LIBCUDACXX_INLINE_VISIBILITY + perms permissions() const noexcept { return __prms_; } + + // modifiers + _LIBCUDACXX_INLINE_VISIBILITY + void type(file_type __ft) noexcept { __ft_ = __ft; } + + _LIBCUDACXX_INLINE_VISIBILITY + void permissions(perms __p) noexcept { __prms_ = __p; } + +private: + file_type __ft_; + perms __prms_; +}; + +class _LIBCUDACXX_TYPE_VIS directory_entry; + +template +struct __can_convert_char { + static const bool value = false; +}; +template +struct __can_convert_char : public __can_convert_char<_Tp> {}; +template <> +struct __can_convert_char { + static const bool value = true; + using __char_type = char; +}; +template <> +struct __can_convert_char { + static const bool value = true; + using __char_type = wchar_t; +}; +template <> +struct __can_convert_char { + static const bool value = true; + using __char_type = char16_t; +}; +template <> +struct __can_convert_char { + static const bool value = true; + using __char_type = char32_t; +}; + +template +typename enable_if<__can_convert_char<_ECharT>::value, bool>::type +__is_separator(_ECharT __e) { + return __e == _ECharT('/'); +} + +struct _NullSentinal {}; + +template +using _Void = void; + +template +struct __is_pathable_string : public false_type {}; + +template +struct __is_pathable_string< + basic_string<_ECharT, _Traits, _Alloc>, + _Void::__char_type> > + : public __can_convert_char<_ECharT> { + using _Str = basic_string<_ECharT, _Traits, _Alloc>; + using _Base = __can_convert_char<_ECharT>; + static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); } + static _ECharT const* __range_end(_Str const& __s) { + return __s.data() + __s.length(); + } + static _ECharT __first_or_null(_Str const& __s) { + return __s.empty() ? _ECharT{} : __s[0]; + } +}; + +template +struct __is_pathable_string< + basic_string_view<_ECharT, _Traits>, + _Void::__char_type> > + : public __can_convert_char<_ECharT> { + using _Str = basic_string_view<_ECharT, _Traits>; + using _Base = __can_convert_char<_ECharT>; + static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); } + static _ECharT const* __range_end(_Str const& __s) { + return __s.data() + __s.length(); + } + static _ECharT __first_or_null(_Str const& __s) { + return __s.empty() ? _ECharT{} : __s[0]; + } +}; + +template , + class _UnqualPtrType = + typename remove_const::type>::type, + bool _IsCharPtr = is_pointer<_DS>::value&& + __can_convert_char<_UnqualPtrType>::value> +struct __is_pathable_char_array : false_type {}; + +template +struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> + : __can_convert_char<__remove_const_t<_ECharT>> { + using _Base = __can_convert_char<__remove_const_t<_ECharT>>; + + static _ECharT const* __range_begin(const _ECharT* __b) { return __b; } + static _ECharT const* __range_end(const _ECharT* __b) { + using _Iter = const _ECharT*; + const _ECharT __sentinal = _ECharT{}; + _Iter __e = __b; + for (; *__e != __sentinal; ++__e) + ; + return __e; + } + + static _ECharT __first_or_null(const _ECharT* __b) { return *__b; } +}; + +template ::value, + class = void> +struct __is_pathable_iter : false_type {}; + +template +struct __is_pathable_iter< + _Iter, true, + _Void::value_type>::__char_type> > + : __can_convert_char::value_type> { + using _ECharT = typename iterator_traits<_Iter>::value_type; + using _Base = __can_convert_char<_ECharT>; + + static _Iter __range_begin(_Iter __b) { return __b; } + static _NullSentinal __range_end(_Iter) { return _NullSentinal{}; } + + static _ECharT __first_or_null(_Iter __b) { return *__b; } +}; + +template ::value, + bool _IsCharIterT = __is_pathable_char_array<_Tp>::value, + bool _IsIterT = !_IsCharIterT && __is_pathable_iter<_Tp>::value> +struct __is_pathable : false_type { + static_assert(!_IsStringT && !_IsCharIterT && !_IsIterT, "Must all be false"); +}; + +template +struct __is_pathable<_Tp, true, false, false> : __is_pathable_string<_Tp> {}; + +template +struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> { +}; + +template +struct __is_pathable<_Tp, false, false, true> : __is_pathable_iter<_Tp> {}; + +template +struct _PathCVT { + static_assert(__can_convert_char<_ECharT>::value, + "Char type not convertible"); + + typedef __narrow_to_utf8 _Narrower; + + static void __append_range(string& __dest, _ECharT const* __b, + _ECharT const* __e) { + _Narrower()(back_inserter(__dest), __b, __e); + } + + template + static void __append_range(string& __dest, _Iter __b, _Iter __e) { + static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); + if (__b == __e) + return; + basic_string<_ECharT> __tmp(__b, __e); + _Narrower()(back_inserter(__dest), __tmp.data(), + __tmp.data() + __tmp.length()); + } + + template + static void __append_range(string& __dest, _Iter __b, _NullSentinal) { + static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); + const _ECharT __sentinal = _ECharT{}; + if (*__b == __sentinal) + return; + basic_string<_ECharT> __tmp; + for (; *__b != __sentinal; ++__b) + __tmp.push_back(*__b); + _Narrower()(back_inserter(__dest), __tmp.data(), + __tmp.data() + __tmp.length()); + } + + template + static void __append_source(string& __dest, _Source const& __s) { + using _Traits = __is_pathable<_Source>; + __append_range(__dest, _Traits::__range_begin(__s), + _Traits::__range_end(__s)); + } +}; + +template <> +struct _PathCVT { + + template + static typename enable_if<__is_exactly_cpp17_input_iterator<_Iter>::value>::type + __append_range(string& __dest, _Iter __b, _Iter __e) { + for (; __b != __e; ++__b) + __dest.push_back(*__b); + } + + template + static typename enable_if<__is_cpp17_forward_iterator<_Iter>::value>::type + __append_range(string& __dest, _Iter __b, _Iter __e) { + __dest.__append_forward_unsafe(__b, __e); + } + + template + static void __append_range(string& __dest, _Iter __b, _NullSentinal) { + const char __sentinal = char{}; + for (; *__b != __sentinal; ++__b) + __dest.push_back(*__b); + } + + template + static void __append_source(string& __dest, _Source const& __s) { + using _Traits = __is_pathable<_Source>; + __append_range(__dest, _Traits::__range_begin(__s), + _Traits::__range_end(__s)); + } +}; + +class _LIBCUDACXX_TYPE_VIS path { + template + using _EnableIfPathable = + typename enable_if<__is_pathable<_SourceOrIter>::value, _Tp>::type; + + template + using _SourceChar = typename __is_pathable<_Tp>::__char_type; + + template + using _SourceCVT = _PathCVT<_SourceChar<_Tp> >; + +public: + typedef char value_type; + typedef basic_string string_type; + typedef _CUDA_VSTD::string_view __string_view; + static constexpr value_type preferred_separator = '/'; + + enum class _LIBCUDACXX_ENUM_VIS format : unsigned char { + auto_format, + native_format, + generic_format + }; + + // constructors and destructor + _LIBCUDACXX_INLINE_VISIBILITY path() noexcept {} + _LIBCUDACXX_INLINE_VISIBILITY path(const path& __p) : __pn_(__p.__pn_) {} + _LIBCUDACXX_INLINE_VISIBILITY path(path&& __p) noexcept + : __pn_(_CUDA_VSTD::move(__p.__pn_)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + path(string_type&& __s, format = format::auto_format) noexcept + : __pn_(_CUDA_VSTD::move(__s)) {} + + template > + path(const _Source& __src, format = format::auto_format) { + _SourceCVT<_Source>::__append_source(__pn_, __src); + } + + template + path(_InputIt __first, _InputIt __last, format = format::auto_format) { + typedef typename iterator_traits<_InputIt>::value_type _ItVal; + _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); + } + + // TODO Implement locale conversions. + template > + path(const _Source& __src, const locale& __loc, format = format::auto_format); + template + path(_InputIt __first, _InputIt _last, const locale& __loc, + format = format::auto_format); + + _LIBCUDACXX_INLINE_VISIBILITY + ~path() = default; + + // assignments + _LIBCUDACXX_INLINE_VISIBILITY + path& operator=(const path& __p) { + __pn_ = __p.__pn_; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + path& operator=(path&& __p) noexcept { + __pn_ = _CUDA_VSTD::move(__p.__pn_); + return *this; + } + + template + _LIBCUDACXX_INLINE_VISIBILITY path& operator=(string_type&& __s) noexcept { + __pn_ = _CUDA_VSTD::move(__s); + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + path& assign(string_type&& __s) noexcept { + __pn_ = _CUDA_VSTD::move(__s); + return *this; + } + + template + _LIBCUDACXX_INLINE_VISIBILITY _EnableIfPathable<_Source> + operator=(const _Source& __src) { + return this->assign(__src); + } + + template + _EnableIfPathable<_Source> assign(const _Source& __src) { + __pn_.clear(); + _SourceCVT<_Source>::__append_source(__pn_, __src); + return *this; + } + + template + path& assign(_InputIt __first, _InputIt __last) { + typedef typename iterator_traits<_InputIt>::value_type _ItVal; + __pn_.clear(); + _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); + return *this; + } + +private: + template + static bool __source_is_absolute(_ECharT __first_or_null) { + return __is_separator(__first_or_null); + } + +public: + // appends + path& operator/=(const path& __p) { + if (__p.is_absolute()) { + __pn_ = __p.__pn_; + return *this; + } + if (has_filename()) + __pn_ += preferred_separator; + __pn_ += __p.native(); + return *this; + } + + // FIXME: Use _LIBCUDACXX_DIAGNOSE_WARNING to produce a diagnostic when __src + // is known at compile time to be "/' since the user almost certainly intended + // to append a separator instead of overwriting the path with "/" + template + _LIBCUDACXX_INLINE_VISIBILITY _EnableIfPathable<_Source> + operator/=(const _Source& __src) { + return this->append(__src); + } + + template + _EnableIfPathable<_Source> append(const _Source& __src) { + using _Traits = __is_pathable<_Source>; + using _CVT = _PathCVT<_SourceChar<_Source> >; + if (__source_is_absolute(_Traits::__first_or_null(__src))) + __pn_.clear(); + else if (has_filename()) + __pn_ += preferred_separator; + _CVT::__append_source(__pn_, __src); + return *this; + } + + template + path& append(_InputIt __first, _InputIt __last) { + typedef typename iterator_traits<_InputIt>::value_type _ItVal; + static_assert(__can_convert_char<_ItVal>::value, "Must convertible"); + using _CVT = _PathCVT<_ItVal>; + if (__first != __last && __source_is_absolute(*__first)) + __pn_.clear(); + else if (has_filename()) + __pn_ += preferred_separator; + _CVT::__append_range(__pn_, __first, __last); + return *this; + } + + // concatenation + _LIBCUDACXX_INLINE_VISIBILITY + path& operator+=(const path& __x) { + __pn_ += __x.__pn_; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + path& operator+=(const string_type& __x) { + __pn_ += __x; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + path& operator+=(__string_view __x) { + __pn_ += __x; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + path& operator+=(const value_type* __x) { + __pn_ += __x; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + path& operator+=(value_type __x) { + __pn_ += __x; + return *this; + } + + template + typename enable_if<__can_convert_char<_ECharT>::value, path&>::type + operator+=(_ECharT __x) { + basic_string<_ECharT> __tmp; + __tmp += __x; + _PathCVT<_ECharT>::__append_source(__pn_, __tmp); + return *this; + } + + template + _EnableIfPathable<_Source> operator+=(const _Source& __x) { + return this->concat(__x); + } + + template + _EnableIfPathable<_Source> concat(const _Source& __x) { + _SourceCVT<_Source>::__append_source(__pn_, __x); + return *this; + } + + template + path& concat(_InputIt __first, _InputIt __last) { + typedef typename iterator_traits<_InputIt>::value_type _ItVal; + _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); + return *this; + } + + // modifiers + _LIBCUDACXX_INLINE_VISIBILITY + void clear() noexcept { __pn_.clear(); } + + path& make_preferred() { return *this; } + + _LIBCUDACXX_INLINE_VISIBILITY + path& remove_filename() { + auto __fname = __filename(); + if (!__fname.empty()) + __pn_.erase(__fname.data() - __pn_.data()); + return *this; + } + + path& replace_filename(const path& __replacement) { + remove_filename(); + return (*this /= __replacement); + } + + path& replace_extension(const path& __replacement = path()); + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(path& __rhs) noexcept { __pn_.swap(__rhs.__pn_); } + + // private helper to allow reserving memory in the path + _LIBCUDACXX_INLINE_VISIBILITY + void __reserve(size_t __s) { __pn_.reserve(__s); } + + // native format observers + _LIBCUDACXX_INLINE_VISIBILITY + const string_type& native() const noexcept { return __pn_; } + + _LIBCUDACXX_INLINE_VISIBILITY + const value_type* c_str() const noexcept { return __pn_.c_str(); } + + _LIBCUDACXX_INLINE_VISIBILITY operator string_type() const { return __pn_; } + + template , + class _Allocator = allocator<_ECharT> > + basic_string<_ECharT, _Traits, _Allocator> + string(const _Allocator& __a = _Allocator()) const { + using _CVT = __widen_from_utf8; + using _Str = basic_string<_ECharT, _Traits, _Allocator>; + _Str __s(__a); + __s.reserve(__pn_.size()); + _CVT()(back_inserter(__s), __pn_.data(), __pn_.data() + __pn_.size()); + return __s; + } + + _LIBCUDACXX_INLINE_VISIBILITY std::string string() const { return __pn_; } + _LIBCUDACXX_INLINE_VISIBILITY std::wstring wstring() const { + return string(); + } + _LIBCUDACXX_INLINE_VISIBILITY std::string u8string() const { return __pn_; } + _LIBCUDACXX_INLINE_VISIBILITY std::u16string u16string() const { + return string(); + } + _LIBCUDACXX_INLINE_VISIBILITY std::u32string u32string() const { + return string(); + } + + // generic format observers + template , + class _Allocator = allocator<_ECharT> > + basic_string<_ECharT, _Traits, _Allocator> + generic_string(const _Allocator& __a = _Allocator()) const { + return string<_ECharT, _Traits, _Allocator>(__a); + } + + std::string generic_string() const { return __pn_; } + std::wstring generic_wstring() const { return string(); } + std::string generic_u8string() const { return __pn_; } + std::u16string generic_u16string() const { return string(); } + std::u32string generic_u32string() const { return string(); } + +private: + int __compare(__string_view) const; + __string_view __root_name() const; + __string_view __root_directory() const; + __string_view __root_path_raw() const; + __string_view __relative_path() const; + __string_view __parent_path() const; + __string_view __filename() const; + __string_view __stem() const; + __string_view __extension() const; + +public: + // compare + _LIBCUDACXX_INLINE_VISIBILITY int compare(const path& __p) const noexcept { + return __compare(__p.__pn_); + } + _LIBCUDACXX_INLINE_VISIBILITY int compare(const string_type& __s) const { + return __compare(__s); + } + _LIBCUDACXX_INLINE_VISIBILITY int compare(__string_view __s) const { + return __compare(__s); + } + _LIBCUDACXX_INLINE_VISIBILITY int compare(const value_type* __s) const { + return __compare(__s); + } + + // decomposition + _LIBCUDACXX_INLINE_VISIBILITY path root_name() const { + return string_type(__root_name()); + } + _LIBCUDACXX_INLINE_VISIBILITY path root_directory() const { + return string_type(__root_directory()); + } + _LIBCUDACXX_INLINE_VISIBILITY path root_path() const { + return root_name().append(string_type(__root_directory())); + } + _LIBCUDACXX_INLINE_VISIBILITY path relative_path() const { + return string_type(__relative_path()); + } + _LIBCUDACXX_INLINE_VISIBILITY path parent_path() const { + return string_type(__parent_path()); + } + _LIBCUDACXX_INLINE_VISIBILITY path filename() const { + return string_type(__filename()); + } + _LIBCUDACXX_INLINE_VISIBILITY path stem() const { return string_type(__stem()); } + _LIBCUDACXX_INLINE_VISIBILITY path extension() const { + return string_type(__extension()); + } + + // query + _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY bool + empty() const noexcept { + return __pn_.empty(); + } + + _LIBCUDACXX_INLINE_VISIBILITY bool has_root_name() const { + return !__root_name().empty(); + } + _LIBCUDACXX_INLINE_VISIBILITY bool has_root_directory() const { + return !__root_directory().empty(); + } + _LIBCUDACXX_INLINE_VISIBILITY bool has_root_path() const { + return !__root_path_raw().empty(); + } + _LIBCUDACXX_INLINE_VISIBILITY bool has_relative_path() const { + return !__relative_path().empty(); + } + _LIBCUDACXX_INLINE_VISIBILITY bool has_parent_path() const { + return !__parent_path().empty(); + } + _LIBCUDACXX_INLINE_VISIBILITY bool has_filename() const { + return !__filename().empty(); + } + _LIBCUDACXX_INLINE_VISIBILITY bool has_stem() const { return !__stem().empty(); } + _LIBCUDACXX_INLINE_VISIBILITY bool has_extension() const { + return !__extension().empty(); + } + + _LIBCUDACXX_INLINE_VISIBILITY bool is_absolute() const { + return has_root_directory(); + } + _LIBCUDACXX_INLINE_VISIBILITY bool is_relative() const { return !is_absolute(); } + + // relative paths + path lexically_normal() const; + path lexically_relative(const path& __base) const; + + _LIBCUDACXX_INLINE_VISIBILITY path lexically_proximate(const path& __base) const { + path __result = this->lexically_relative(__base); + if (__result.native().empty()) + return *this; + return __result; + } + + // iterators + class _LIBCUDACXX_TYPE_VIS iterator; + typedef iterator const_iterator; + + iterator begin() const; + iterator end() const; + + template + _LIBCUDACXX_INLINE_VISIBILITY friend + typename enable_if::value && + is_same<_Traits, char_traits >::value, + basic_ostream<_CharT, _Traits>&>::type + operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { + __os << std::__quoted(__p.native()); + return __os; + } + + template + _LIBCUDACXX_INLINE_VISIBILITY friend + typename enable_if::value || + !is_same<_Traits, char_traits >::value, + basic_ostream<_CharT, _Traits>&>::type + operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { + __os << std::__quoted(__p.string<_CharT, _Traits>()); + return __os; + } + + template + _LIBCUDACXX_INLINE_VISIBILITY friend basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) { + basic_string<_CharT, _Traits> __tmp; + __is >> __quoted(__tmp); + __p = __tmp; + return __is; + } + + friend _LIBCUDACXX_INLINE_VISIBILITY bool operator==(const path& __lhs, const path& __rhs) noexcept { + return __lhs.compare(__rhs) == 0; + } + friend _LIBCUDACXX_INLINE_VISIBILITY bool operator!=(const path& __lhs, const path& __rhs) noexcept { + return __lhs.compare(__rhs) != 0; + } + friend _LIBCUDACXX_INLINE_VISIBILITY bool operator<(const path& __lhs, const path& __rhs) noexcept { + return __lhs.compare(__rhs) < 0; + } + friend _LIBCUDACXX_INLINE_VISIBILITY bool operator<=(const path& __lhs, const path& __rhs) noexcept { + return __lhs.compare(__rhs) <= 0; + } + friend _LIBCUDACXX_INLINE_VISIBILITY bool operator>(const path& __lhs, const path& __rhs) noexcept { + return __lhs.compare(__rhs) > 0; + } + friend _LIBCUDACXX_INLINE_VISIBILITY bool operator>=(const path& __lhs, const path& __rhs) noexcept { + return __lhs.compare(__rhs) >= 0; + } + + friend _LIBCUDACXX_INLINE_VISIBILITY path operator/(const path& __lhs, + const path& __rhs) { + path __result(__lhs); + __result /= __rhs; + return __result; + } +private: + inline _LIBCUDACXX_INLINE_VISIBILITY path& + __assign_view(__string_view const& __s) noexcept { + __pn_ = string_type(__s); + return *this; + } + string_type __pn_; +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY void swap(path& __lhs, path& __rhs) noexcept { + __lhs.swap(__rhs); +} + +_LIBCUDACXX_FUNC_VIS +size_t hash_value(const path& __p) noexcept; + +template +_LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_pathable<_Source>::value, path>::type + u8path(const _Source& __s) { + static_assert( + is_same::__char_type, char>::value, + "u8path(Source const&) requires Source have a character type of type " + "'char'"); + return path(__s); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_pathable<_InputIt>::value, path>::type + u8path(_InputIt __f, _InputIt __l) { + static_assert( + is_same::__char_type, char>::value, + "u8path(Iter, Iter) requires Iter have a value_type of type 'char'"); + return path(__f, __l); +} + +class _LIBCUDACXX_TYPE_VIS path::iterator { +public: + enum _ParserState : unsigned char { + _Singular, + _BeforeBegin, + _InRootName, + _InRootDir, + _InFilenames, + _InTrailingSep, + _AtEnd + }; + +public: + typedef bidirectional_iterator_tag iterator_category; + + typedef path value_type; + typedef std::ptrdiff_t difference_type; + typedef const path* pointer; + typedef const path& reference; + + typedef void + __stashing_iterator_tag; // See reverse_iterator and __is_cpp17_stashing_iterator + +public: + _LIBCUDACXX_INLINE_VISIBILITY + iterator() + : __stashed_elem_(), __path_ptr_(nullptr), __entry_(), + __state_(_Singular) {} + + iterator(const iterator&) = default; + ~iterator() = default; + + iterator& operator=(const iterator&) = default; + + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const { return __stashed_elem_; } + + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const { return &__stashed_elem_; } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator& operator++() { + _LIBCUDACXX_ASSERT(__state_ != _Singular, + "attempting to increment a singular iterator"); + _LIBCUDACXX_ASSERT(__state_ != _AtEnd, + "attempting to increment the end iterator"); + return __increment(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator operator++(int) { + iterator __it(*this); + this->operator++(); + return __it; + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator& operator--() { + _LIBCUDACXX_ASSERT(__state_ != _Singular, + "attempting to decrement a singular iterator"); + _LIBCUDACXX_ASSERT(__entry_.data() != __path_ptr_->native().data(), + "attempting to decrement the begin iterator"); + return __decrement(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator operator--(int) { + iterator __it(*this); + this->operator--(); + return __it; + } + +private: + friend class path; + + inline _LIBCUDACXX_INLINE_VISIBILITY friend bool operator==(const iterator&, + const iterator&); + + iterator& __increment(); + iterator& __decrement(); + + path __stashed_elem_; + const path* __path_ptr_; + path::__string_view __entry_; + _ParserState __state_; +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY bool operator==(const path::iterator& __lhs, + const path::iterator& __rhs) { + return __lhs.__path_ptr_ == __rhs.__path_ptr_ && + __lhs.__entry_.data() == __rhs.__entry_.data(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool operator!=(const path::iterator& __lhs, + const path::iterator& __rhs) { + return !(__lhs == __rhs); +} + +// TODO(ldionne): We need to pop the pragma and push it again after +// filesystem_error to work around PR41078. +_LIBCUDACXX_AVAILABILITY_FILESYSTEM_POP + +class _LIBCUDACXX_AVAILABILITY_FILESYSTEM _LIBCUDACXX_EXCEPTION_ABI filesystem_error : public system_error { +public: + _LIBCUDACXX_INLINE_VISIBILITY + filesystem_error(const string& __what, error_code __ec) + : system_error(__ec, __what), + __storage_(make_shared<_Storage>(path(), path())) { + __create_what(0); + } + + _LIBCUDACXX_INLINE_VISIBILITY + filesystem_error(const string& __what, const path& __p1, error_code __ec) + : system_error(__ec, __what), + __storage_(make_shared<_Storage>(__p1, path())) { + __create_what(1); + } + + _LIBCUDACXX_INLINE_VISIBILITY + filesystem_error(const string& __what, const path& __p1, const path& __p2, + error_code __ec) + : system_error(__ec, __what), + __storage_(make_shared<_Storage>(__p1, __p2)) { + __create_what(2); + } + + _LIBCUDACXX_INLINE_VISIBILITY + const path& path1() const noexcept { return __storage_->__p1_; } + + _LIBCUDACXX_INLINE_VISIBILITY + const path& path2() const noexcept { return __storage_->__p2_; } + + ~filesystem_error() override; // key function + + _LIBCUDACXX_INLINE_VISIBILITY + const char* what() const noexcept override { + return __storage_->__what_.c_str(); + } + + void __create_what(int __num_paths); + +private: + struct _LIBCUDACXX_HIDDEN _Storage { + _LIBCUDACXX_INLINE_VISIBILITY + _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {} + + path __p1_; + path __p2_; + string __what_; + }; + shared_ptr<_Storage> __storage_; +}; + +_LIBCUDACXX_AVAILABILITY_FILESYSTEM_PUSH + +template +_LIBCUDACXX_NORETURN inline _LIBCUDACXX_INLINE_VISIBILITY +#ifndef _LIBCUDACXX_NO_EXCEPTIONS +void __throw_filesystem_error(_Args&&... __args) { + throw filesystem_error(std::forward<_Args>(__args)...); +} +#else +void __throw_filesystem_error(_Args&&...) { + _CUDA_VSTD::abort(); +} +#endif + +// operational functions + +_LIBCUDACXX_FUNC_VIS +path __absolute(const path&, error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +path __canonical(const path&, error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +void __copy(const path& __from, const path& __to, copy_options __opt, + error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +bool __copy_file(const path& __from, const path& __to, copy_options __opt, + error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +void __copy_symlink(const path& __existing_symlink, const path& __new_symlink, + error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +bool __create_directories(const path& p, error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +bool __create_directory(const path& p, error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +bool __create_directory(const path& p, const path& attributes, + error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +void __create_directory_symlink(const path& __to, const path& __new_symlink, + error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +void __create_hard_link(const path& __to, const path& __new_hard_link, + error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +void __create_symlink(const path& __to, const path& __new_symlink, + error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +path __current_path(error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +void __current_path(const path&, error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +bool __equivalent(const path&, const path&, error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +uintmax_t __file_size(const path&, error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +uintmax_t __hard_link_count(const path&, error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +bool __fs_is_empty(const path& p, error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +file_time_type __last_write_time(const path& p, error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +void __last_write_time(const path& p, file_time_type new_time, + error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +void __permissions(const path&, perms, perm_options, error_code* = nullptr); +_LIBCUDACXX_FUNC_VIS +path __read_symlink(const path& p, error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +bool __remove(const path& p, error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +uintmax_t __remove_all(const path& p, error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +void __rename(const path& from, const path& to, error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +void __resize_file(const path& p, uintmax_t size, error_code* ec = nullptr); +_LIBCUDACXX_FUNC_VIS +space_info __space(const path&, error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +file_status __status(const path&, error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +file_status __symlink_status(const path&, error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +path __system_complete(const path&, error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +path __temp_directory_path(error_code* __ec = nullptr); +_LIBCUDACXX_FUNC_VIS +path __weakly_canonical(path const& __p, error_code* __ec = nullptr); + +inline _LIBCUDACXX_INLINE_VISIBILITY path current_path() { + return __current_path(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path current_path(error_code& __ec) { + return __current_path(&__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void current_path(const path& __p) { + __current_path(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void current_path(const path& __p, + error_code& __ec) noexcept { + __current_path(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path absolute(const path& __p) { + return __absolute(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path absolute(const path& __p, + error_code& __ec) { + return __absolute(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path canonical(const path& __p) { + return __canonical(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path canonical(const path& __p, + error_code& __ec) { + return __canonical(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void copy(const path& __from, + const path& __to) { + __copy(__from, __to, copy_options::none); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void copy(const path& __from, const path& __to, + error_code& __ec) { + __copy(__from, __to, copy_options::none, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void copy(const path& __from, const path& __to, + copy_options __opt) { + __copy(__from, __to, __opt); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void copy(const path& __from, const path& __to, + copy_options __opt, + error_code& __ec) { + __copy(__from, __to, __opt, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool copy_file(const path& __from, + const path& __to) { + return __copy_file(__from, __to, copy_options::none); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +copy_file(const path& __from, const path& __to, error_code& __ec) { + return __copy_file(__from, __to, copy_options::none, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +copy_file(const path& __from, const path& __to, copy_options __opt) { + return __copy_file(__from, __to, __opt); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool copy_file(const path& __from, + const path& __to, + copy_options __opt, + error_code& __ec) { + return __copy_file(__from, __to, __opt, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void copy_symlink(const path& __existing, + const path& __new) { + __copy_symlink(__existing, __new); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void +copy_symlink(const path& __ext, const path& __new, error_code& __ec) noexcept { + __copy_symlink(__ext, __new, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool create_directories(const path& __p) { + return __create_directories(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool create_directories(const path& __p, + error_code& __ec) { + return __create_directories(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool create_directory(const path& __p) { + return __create_directory(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +create_directory(const path& __p, error_code& __ec) noexcept { + return __create_directory(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool create_directory(const path& __p, + const path& __attrs) { + return __create_directory(__p, __attrs); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +create_directory(const path& __p, const path& __attrs, + error_code& __ec) noexcept { + return __create_directory(__p, __attrs, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void +create_directory_symlink(const path& __to, const path& __new) { + __create_directory_symlink(__to, __new); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void +create_directory_symlink(const path& __to, const path& __new, + error_code& __ec) noexcept { + __create_directory_symlink(__to, __new, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void create_hard_link(const path& __to, + const path& __new) { + __create_hard_link(__to, __new); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void +create_hard_link(const path& __to, const path& __new, + error_code& __ec) noexcept { + __create_hard_link(__to, __new, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void create_symlink(const path& __to, + const path& __new) { + __create_symlink(__to, __new); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void +create_symlink(const path& __to, const path& __new, error_code& __ec) noexcept { + return __create_symlink(__to, __new, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool status_known(file_status __s) noexcept { + return __s.type() != file_type::none; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool exists(file_status __s) noexcept { + return status_known(__s) && __s.type() != file_type::not_found; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool exists(const path& __p) { + return exists(__status(__p)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool exists(const path& __p, + error_code& __ec) noexcept { + auto __s = __status(__p, &__ec); + if (status_known(__s)) + __ec.clear(); + return exists(__s); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool equivalent(const path& __p1, + const path& __p2) { + return __equivalent(__p1, __p2); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept { + return __equivalent(__p1, __p2, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY uintmax_t file_size(const path& __p) { + return __file_size(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY uintmax_t +file_size(const path& __p, error_code& __ec) noexcept { + return __file_size(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY uintmax_t hard_link_count(const path& __p) { + return __hard_link_count(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY uintmax_t +hard_link_count(const path& __p, error_code& __ec) noexcept { + return __hard_link_count(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_block_file(file_status __s) noexcept { + return __s.type() == file_type::block; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_block_file(const path& __p) { + return is_block_file(__status(__p)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_block_file(const path& __p, + error_code& __ec) noexcept { + return is_block_file(__status(__p, &__ec)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +is_character_file(file_status __s) noexcept { + return __s.type() == file_type::character; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_character_file(const path& __p) { + return is_character_file(__status(__p)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +is_character_file(const path& __p, error_code& __ec) noexcept { + return is_character_file(__status(__p, &__ec)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_directory(file_status __s) noexcept { + return __s.type() == file_type::directory; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_directory(const path& __p) { + return is_directory(__status(__p)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_directory(const path& __p, + error_code& __ec) noexcept { + return is_directory(__status(__p, &__ec)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_empty(const path& __p) { + return __fs_is_empty(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_empty(const path& __p, + error_code& __ec) { + return __fs_is_empty(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_fifo(file_status __s) noexcept { + return __s.type() == file_type::fifo; +} +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_fifo(const path& __p) { + return is_fifo(__status(__p)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_fifo(const path& __p, + error_code& __ec) noexcept { + return is_fifo(__status(__p, &__ec)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +is_regular_file(file_status __s) noexcept { + return __s.type() == file_type::regular; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_regular_file(const path& __p) { + return is_regular_file(__status(__p)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +is_regular_file(const path& __p, error_code& __ec) noexcept { + return is_regular_file(__status(__p, &__ec)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_socket(file_status __s) noexcept { + return __s.type() == file_type::socket; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_socket(const path& __p) { + return is_socket(__status(__p)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_socket(const path& __p, + error_code& __ec) noexcept { + return is_socket(__status(__p, &__ec)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_symlink(file_status __s) noexcept { + return __s.type() == file_type::symlink; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_symlink(const path& __p) { + return is_symlink(__symlink_status(__p)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_symlink(const path& __p, + error_code& __ec) noexcept { + return is_symlink(__symlink_status(__p, &__ec)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_other(file_status __s) noexcept { + return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && + !is_symlink(__s); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_other(const path& __p) { + return is_other(__status(__p)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool is_other(const path& __p, + error_code& __ec) noexcept { + return is_other(__status(__p, &__ec)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY file_time_type +last_write_time(const path& __p) { + return __last_write_time(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY file_time_type +last_write_time(const path& __p, error_code& __ec) noexcept { + return __last_write_time(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void last_write_time(const path& __p, + file_time_type __t) { + __last_write_time(__p, __t); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void +last_write_time(const path& __p, file_time_type __t, + error_code& __ec) noexcept { + __last_write_time(__p, __t, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void +permissions(const path& __p, perms __prms, + perm_options __opts = perm_options::replace) { + __permissions(__p, __prms, __opts); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void permissions(const path& __p, perms __prms, + error_code& __ec) noexcept { + __permissions(__p, __prms, perm_options::replace, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void permissions(const path& __p, perms __prms, + perm_options __opts, + error_code& __ec) { + __permissions(__p, __prms, __opts, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path proximate(const path& __p, + const path& __base, + error_code& __ec) { + path __tmp = __weakly_canonical(__p, &__ec); + if (__ec) + return {}; + path __tmp_base = __weakly_canonical(__base, &__ec); + if (__ec) + return {}; + return __tmp.lexically_proximate(__tmp_base); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path proximate(const path& __p, + error_code& __ec) { + return proximate(__p, current_path(), __ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path +proximate(const path& __p, const path& __base = current_path()) { + return __weakly_canonical(__p).lexically_proximate( + __weakly_canonical(__base)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path read_symlink(const path& __p) { + return __read_symlink(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path read_symlink(const path& __p, + error_code& __ec) { + return __read_symlink(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path relative(const path& __p, + const path& __base, + error_code& __ec) { + path __tmp = __weakly_canonical(__p, &__ec); + if (__ec) + return path(); + path __tmpbase = __weakly_canonical(__base, &__ec); + if (__ec) + return path(); + return __tmp.lexically_relative(__tmpbase); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path relative(const path& __p, + error_code& __ec) { + return relative(__p, current_path(), __ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path +relative(const path& __p, const path& __base = current_path()) { + return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool remove(const path& __p) { + return __remove(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool remove(const path& __p, + error_code& __ec) noexcept { + return __remove(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY uintmax_t remove_all(const path& __p) { + return __remove_all(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY uintmax_t remove_all(const path& __p, + error_code& __ec) { + return __remove_all(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void rename(const path& __from, + const path& __to) { + return __rename(__from, __to); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void +rename(const path& __from, const path& __to, error_code& __ec) noexcept { + return __rename(__from, __to, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void resize_file(const path& __p, + uintmax_t __ns) { + return __resize_file(__p, __ns); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY void +resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept { + return __resize_file(__p, __ns, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY space_info space(const path& __p) { + return __space(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY space_info space(const path& __p, + error_code& __ec) noexcept { + return __space(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY file_status status(const path& __p) { + return __status(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY file_status status(const path& __p, + error_code& __ec) noexcept { + return __status(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY file_status symlink_status(const path& __p) { + return __symlink_status(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY file_status +symlink_status(const path& __p, error_code& __ec) noexcept { + return __symlink_status(__p, &__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path temp_directory_path() { + return __temp_directory_path(); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path temp_directory_path(error_code& __ec) { + return __temp_directory_path(&__ec); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path weakly_canonical(path const& __p) { + return __weakly_canonical(__p); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY path weakly_canonical(path const& __p, + error_code& __ec) { + return __weakly_canonical(__p, &__ec); +} + +class directory_iterator; +class recursive_directory_iterator; +class _LIBCUDACXX_HIDDEN __dir_stream; + +class directory_entry { + typedef _CUDA_VSTD_FS::path _Path; + +public: + // constructors and destructors + directory_entry() noexcept = default; + directory_entry(directory_entry const&) = default; + directory_entry(directory_entry&&) noexcept = default; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit directory_entry(_Path const& __p) : __p_(__p) { + error_code __ec; + __refresh(&__ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) { + __refresh(&__ec); + } + + ~directory_entry() {} + + directory_entry& operator=(directory_entry const&) = default; + directory_entry& operator=(directory_entry&&) noexcept = default; + + _LIBCUDACXX_INLINE_VISIBILITY + void assign(_Path const& __p) { + __p_ = __p; + error_code __ec; + __refresh(&__ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void assign(_Path const& __p, error_code& __ec) { + __p_ = __p; + __refresh(&__ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void replace_filename(_Path const& __p) { + __p_.replace_filename(__p); + error_code __ec; + __refresh(&__ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void replace_filename(_Path const& __p, error_code& __ec) { + __p_ = __p_.parent_path() / __p; + __refresh(&__ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void refresh() { __refresh(); } + + _LIBCUDACXX_INLINE_VISIBILITY + void refresh(error_code& __ec) noexcept { __refresh(&__ec); } + + _LIBCUDACXX_INLINE_VISIBILITY + _Path const& path() const noexcept { return __p_; } + + _LIBCUDACXX_INLINE_VISIBILITY + operator const _Path&() const noexcept { return __p_; } + + _LIBCUDACXX_INLINE_VISIBILITY + bool exists() const { return _CUDA_VSTD_FS::exists(file_status{__get_ft()}); } + + _LIBCUDACXX_INLINE_VISIBILITY + bool exists(error_code& __ec) const noexcept { + return _CUDA_VSTD_FS::exists(file_status{__get_ft(&__ec)}); + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_block_file() const { return __get_ft() == file_type::block; } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_block_file(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::block; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_character_file() const { return __get_ft() == file_type::character; } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_character_file(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::character; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_directory() const { return __get_ft() == file_type::directory; } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_directory(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::directory; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_fifo() const { return __get_ft() == file_type::fifo; } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_fifo(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::fifo; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_other() const { return _CUDA_VSTD_FS::is_other(file_status{__get_ft()}); } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_other(error_code& __ec) const noexcept { + return _CUDA_VSTD_FS::is_other(file_status{__get_ft(&__ec)}); + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_regular_file() const { return __get_ft() == file_type::regular; } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_regular_file(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::regular; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_socket() const { return __get_ft() == file_type::socket; } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_socket(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::socket; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_symlink() const { return __get_sym_ft() == file_type::symlink; } + + _LIBCUDACXX_INLINE_VISIBILITY + bool is_symlink(error_code& __ec) const noexcept { + return __get_sym_ft(&__ec) == file_type::symlink; + } + _LIBCUDACXX_INLINE_VISIBILITY + uintmax_t file_size() const { return __get_size(); } + + _LIBCUDACXX_INLINE_VISIBILITY + uintmax_t file_size(error_code& __ec) const noexcept { + return __get_size(&__ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + uintmax_t hard_link_count() const { return __get_nlink(); } + + _LIBCUDACXX_INLINE_VISIBILITY + uintmax_t hard_link_count(error_code& __ec) const noexcept { + return __get_nlink(&__ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + file_time_type last_write_time() const { return __get_write_time(); } + + _LIBCUDACXX_INLINE_VISIBILITY + file_time_type last_write_time(error_code& __ec) const noexcept { + return __get_write_time(&__ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + file_status status() const { return __get_status(); } + + _LIBCUDACXX_INLINE_VISIBILITY + file_status status(error_code& __ec) const noexcept { + return __get_status(&__ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + file_status symlink_status() const { return __get_symlink_status(); } + + _LIBCUDACXX_INLINE_VISIBILITY + file_status symlink_status(error_code& __ec) const noexcept { + return __get_symlink_status(&__ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool operator<(directory_entry const& __rhs) const noexcept { + return __p_ < __rhs.__p_; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(directory_entry const& __rhs) const noexcept { + return __p_ == __rhs.__p_; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(directory_entry const& __rhs) const noexcept { + return __p_ != __rhs.__p_; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool operator<=(directory_entry const& __rhs) const noexcept { + return __p_ <= __rhs.__p_; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool operator>(directory_entry const& __rhs) const noexcept { + return __p_ > __rhs.__p_; + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool operator>=(directory_entry const& __rhs) const noexcept { + return __p_ >= __rhs.__p_; + } + +private: + friend class directory_iterator; + friend class recursive_directory_iterator; + friend class __dir_stream; + + enum _CacheType : unsigned char { + _Empty, + _IterSymlink, + _IterNonSymlink, + _RefreshSymlink, + _RefreshSymlinkUnresolved, + _RefreshNonSymlink + }; + + struct __cached_data { + uintmax_t __size_; + uintmax_t __nlink_; + file_time_type __write_time_; + perms __sym_perms_; + perms __non_sym_perms_; + file_type __type_; + _CacheType __cache_type_; + + _LIBCUDACXX_INLINE_VISIBILITY + __cached_data() noexcept { __reset(); } + + _LIBCUDACXX_INLINE_VISIBILITY + void __reset() { + __cache_type_ = _Empty; + __type_ = file_type::none; + __sym_perms_ = __non_sym_perms_ = perms::unknown; + __size_ = __nlink_ = uintmax_t(-1); + __write_time_ = file_time_type::min(); + } + }; + + _LIBCUDACXX_INLINE_VISIBILITY + static __cached_data __create_iter_result(file_type __ft) { + __cached_data __data; + __data.__type_ = __ft; + __data.__cache_type_ = [&]() { + switch (__ft) { + case file_type::none: + return _Empty; + case file_type::symlink: + return _IterSymlink; + default: + return _IterNonSymlink; + } + }(); + return __data; + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __assign_iter_entry(_Path&& __p, __cached_data __dt) { + __p_ = std::move(__p); + __data_ = __dt; + } + + _LIBCUDACXX_FUNC_VIS + error_code __do_refresh() noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + static bool __is_dne_error(error_code const& __ec) { + if (!__ec) + return true; + switch (static_cast(__ec.value())) { + case errc::no_such_file_or_directory: + case errc::not_a_directory: + return true; + default: + return false; + } + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __handle_error(const char* __msg, error_code* __dest_ec, + error_code const& __ec, bool __allow_dne = false) const { + if (__dest_ec) { + *__dest_ec = __ec; + return; + } + if (__ec && (!__allow_dne || !__is_dne_error(__ec))) + __throw_filesystem_error(__msg, __p_, __ec); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __refresh(error_code* __ec = nullptr) { + __handle_error("in directory_entry::refresh", __ec, __do_refresh(), + /*allow_dne*/ true); + } + + _LIBCUDACXX_INLINE_VISIBILITY + file_type __get_sym_ft(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + return __symlink_status(__p_, __ec).type(); + case _IterSymlink: + case _RefreshSymlink: + case _RefreshSymlinkUnresolved: + if (__ec) + __ec->clear(); + return file_type::symlink; + case _IterNonSymlink: + case _RefreshNonSymlink: + file_status __st(__data_.__type_); + if (__ec && !_CUDA_VSTD_FS::exists(__st)) + *__ec = make_error_code(errc::no_such_file_or_directory); + else if (__ec) + __ec->clear(); + return __data_.__type_; + } + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + file_type __get_ft(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterSymlink: + case _RefreshSymlinkUnresolved: + return __status(__p_, __ec).type(); + case _IterNonSymlink: + case _RefreshNonSymlink: + case _RefreshSymlink: { + file_status __st(__data_.__type_); + if (__ec && !_CUDA_VSTD_FS::exists(__st)) + *__ec = make_error_code(errc::no_such_file_or_directory); + else if (__ec) + __ec->clear(); + return __data_.__type_; + } + } + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + file_status __get_status(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterNonSymlink: + case _IterSymlink: + case _RefreshSymlinkUnresolved: + return __status(__p_, __ec); + case _RefreshNonSymlink: + case _RefreshSymlink: + return file_status(__get_ft(__ec), __data_.__non_sym_perms_); + } + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + file_status __get_symlink_status(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterNonSymlink: + case _IterSymlink: + return __symlink_status(__p_, __ec); + case _RefreshNonSymlink: + return file_status(__get_sym_ft(__ec), __data_.__non_sym_perms_); + case _RefreshSymlink: + case _RefreshSymlinkUnresolved: + return file_status(__get_sym_ft(__ec), __data_.__sym_perms_); + } + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + uintmax_t __get_size(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterNonSymlink: + case _IterSymlink: + case _RefreshSymlinkUnresolved: + return _CUDA_VSTD_FS::__file_size(__p_, __ec); + case _RefreshSymlink: + case _RefreshNonSymlink: { + error_code __m_ec; + file_status __st(__get_ft(&__m_ec)); + __handle_error("in directory_entry::file_size", __ec, __m_ec); + if (_CUDA_VSTD_FS::exists(__st) && !_CUDA_VSTD_FS::is_regular_file(__st)) { + errc __err_kind = _CUDA_VSTD_FS::is_directory(__st) ? errc::is_a_directory + : errc::not_supported; + __handle_error("in directory_entry::file_size", __ec, + make_error_code(__err_kind)); + } + return __data_.__size_; + } + } + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + uintmax_t __get_nlink(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterNonSymlink: + case _IterSymlink: + case _RefreshSymlinkUnresolved: + return _CUDA_VSTD_FS::__hard_link_count(__p_, __ec); + case _RefreshSymlink: + case _RefreshNonSymlink: { + error_code __m_ec; + (void)__get_ft(&__m_ec); + __handle_error("in directory_entry::hard_link_count", __ec, __m_ec); + return __data_.__nlink_; + } + } + _LIBCUDACXX_UNREACHABLE(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + file_time_type __get_write_time(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterNonSymlink: + case _IterSymlink: + case _RefreshSymlinkUnresolved: + return _CUDA_VSTD_FS::__last_write_time(__p_, __ec); + case _RefreshSymlink: + case _RefreshNonSymlink: { + error_code __m_ec; + file_status __st(__get_ft(&__m_ec)); + __handle_error("in directory_entry::last_write_time", __ec, __m_ec); + if (_CUDA_VSTD_FS::exists(__st) && + __data_.__write_time_ == file_time_type::min()) + __handle_error("in directory_entry::last_write_time", __ec, + make_error_code(errc::value_too_large)); + return __data_.__write_time_; + } + } + _LIBCUDACXX_UNREACHABLE(); + } + +private: + _Path __p_; + __cached_data __data_; +}; + +class __dir_element_proxy { +public: + inline _LIBCUDACXX_INLINE_VISIBILITY directory_entry operator*() { + return _CUDA_VSTD::move(__elem_); + } + +private: + friend class directory_iterator; + friend class recursive_directory_iterator; + explicit __dir_element_proxy(directory_entry const& __e) : __elem_(__e) {} + __dir_element_proxy(__dir_element_proxy&& __o) + : __elem_(_CUDA_VSTD::move(__o.__elem_)) {} + directory_entry __elem_; +}; + +class directory_iterator { +public: + typedef directory_entry value_type; + typedef ptrdiff_t difference_type; + typedef value_type const* pointer; + typedef value_type const& reference; + typedef input_iterator_tag iterator_category; + +public: + //ctor & dtor + directory_iterator() noexcept {} + + explicit directory_iterator(const path& __p) + : directory_iterator(__p, nullptr) {} + + directory_iterator(const path& __p, directory_options __opts) + : directory_iterator(__p, nullptr, __opts) {} + + directory_iterator(const path& __p, error_code& __ec) + : directory_iterator(__p, &__ec) {} + + directory_iterator(const path& __p, directory_options __opts, + error_code& __ec) + : directory_iterator(__p, &__ec, __opts) {} + + directory_iterator(const directory_iterator&) = default; + directory_iterator(directory_iterator&&) = default; + directory_iterator& operator=(const directory_iterator&) = default; + + directory_iterator& operator=(directory_iterator&& __o) noexcept { + // non-default implementation provided to support self-move assign. + if (this != &__o) { + __imp_ = _CUDA_VSTD::move(__o.__imp_); + } + return *this; + } + + ~directory_iterator() = default; + + const directory_entry& operator*() const { + _LIBCUDACXX_ASSERT(__imp_, "The end iterator cannot be dereferenced"); + return __dereference(); + } + + const directory_entry* operator->() const { return &**this; } + + directory_iterator& operator++() { return __increment(); } + + __dir_element_proxy operator++(int) { + __dir_element_proxy __p(**this); + __increment(); + return __p; + } + + directory_iterator& increment(error_code& __ec) { return __increment(&__ec); } + +private: + inline _LIBCUDACXX_INLINE_VISIBILITY friend bool + operator==(const directory_iterator& __lhs, + const directory_iterator& __rhs) noexcept; + + // construct the dir_stream + _LIBCUDACXX_FUNC_VIS + directory_iterator(const path&, error_code*, + directory_options = directory_options::none); + + _LIBCUDACXX_FUNC_VIS + directory_iterator& __increment(error_code* __ec = nullptr); + + _LIBCUDACXX_FUNC_VIS + const directory_entry& __dereference() const; + +private: + shared_ptr<__dir_stream> __imp_; +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +operator==(const directory_iterator& __lhs, + const directory_iterator& __rhs) noexcept { + return __lhs.__imp_ == __rhs.__imp_; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +operator!=(const directory_iterator& __lhs, + const directory_iterator& __rhs) noexcept { + return !(__lhs == __rhs); +} + +// enable directory_iterator range-based for statements +inline _LIBCUDACXX_INLINE_VISIBILITY directory_iterator +begin(directory_iterator __iter) noexcept { + return __iter; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY directory_iterator +end(const directory_iterator&) noexcept { + return directory_iterator(); +} + +class recursive_directory_iterator { +public: + using value_type = directory_entry; + using difference_type = std::ptrdiff_t; + using pointer = directory_entry const*; + using reference = directory_entry const&; + using iterator_category = std::input_iterator_tag; + +public: + // constructors and destructor + _LIBCUDACXX_INLINE_VISIBILITY + recursive_directory_iterator() noexcept : __rec_(false) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit recursive_directory_iterator( + const path& __p, directory_options __xoptions = directory_options::none) + : recursive_directory_iterator(__p, __xoptions, nullptr) {} + + _LIBCUDACXX_INLINE_VISIBILITY + recursive_directory_iterator(const path& __p, directory_options __xoptions, + error_code& __ec) + : recursive_directory_iterator(__p, __xoptions, &__ec) {} + + _LIBCUDACXX_INLINE_VISIBILITY + recursive_directory_iterator(const path& __p, error_code& __ec) + : recursive_directory_iterator(__p, directory_options::none, &__ec) {} + + recursive_directory_iterator(const recursive_directory_iterator&) = default; + recursive_directory_iterator(recursive_directory_iterator&&) = default; + + recursive_directory_iterator& + operator=(const recursive_directory_iterator&) = default; + + _LIBCUDACXX_INLINE_VISIBILITY + recursive_directory_iterator& + operator=(recursive_directory_iterator&& __o) noexcept { + // non-default implementation provided to support self-move assign. + if (this != &__o) { + __imp_ = _CUDA_VSTD::move(__o.__imp_); + __rec_ = __o.__rec_; + } + return *this; + } + + ~recursive_directory_iterator() = default; + + _LIBCUDACXX_INLINE_VISIBILITY + const directory_entry& operator*() const { return __dereference(); } + + _LIBCUDACXX_INLINE_VISIBILITY + const directory_entry* operator->() const { return &__dereference(); } + + recursive_directory_iterator& operator++() { return __increment(); } + + _LIBCUDACXX_INLINE_VISIBILITY + __dir_element_proxy operator++(int) { + __dir_element_proxy __p(**this); + __increment(); + return __p; + } + + _LIBCUDACXX_INLINE_VISIBILITY + recursive_directory_iterator& increment(error_code& __ec) { + return __increment(&__ec); + } + + _LIBCUDACXX_FUNC_VIS directory_options options() const; + _LIBCUDACXX_FUNC_VIS int depth() const; + + _LIBCUDACXX_INLINE_VISIBILITY + void pop() { __pop(); } + + _LIBCUDACXX_INLINE_VISIBILITY + void pop(error_code& __ec) { __pop(&__ec); } + + _LIBCUDACXX_INLINE_VISIBILITY + bool recursion_pending() const { return __rec_; } + + _LIBCUDACXX_INLINE_VISIBILITY + void disable_recursion_pending() { __rec_ = false; } + +private: + _LIBCUDACXX_FUNC_VIS + recursive_directory_iterator(const path& __p, directory_options __opt, + error_code* __ec); + + _LIBCUDACXX_FUNC_VIS + const directory_entry& __dereference() const; + + _LIBCUDACXX_FUNC_VIS + bool __try_recursion(error_code* __ec); + + _LIBCUDACXX_FUNC_VIS + void __advance(error_code* __ec = nullptr); + + _LIBCUDACXX_FUNC_VIS + recursive_directory_iterator& __increment(error_code* __ec = nullptr); + + _LIBCUDACXX_FUNC_VIS + void __pop(error_code* __ec = nullptr); + + inline _LIBCUDACXX_INLINE_VISIBILITY friend bool + operator==(const recursive_directory_iterator&, + const recursive_directory_iterator&) noexcept; + + struct _LIBCUDACXX_HIDDEN __shared_imp; + shared_ptr<__shared_imp> __imp_; + bool __rec_; +}; // class recursive_directory_iterator + +inline _LIBCUDACXX_INLINE_VISIBILITY bool +operator==(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) noexcept { + return __lhs.__imp_ == __rhs.__imp_; +} + +_LIBCUDACXX_INLINE_VISIBILITY +inline bool operator!=(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) noexcept { + return !(__lhs == __rhs); +} +// enable recursive_directory_iterator range-based for statements +inline _LIBCUDACXX_INLINE_VISIBILITY recursive_directory_iterator +begin(recursive_directory_iterator __iter) noexcept { + return __iter; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY recursive_directory_iterator +end(const recursive_directory_iterator&) noexcept { + return recursive_directory_iterator(); +} + +_LIBCUDACXX_AVAILABILITY_FILESYSTEM_POP + +_LIBCUDACXX_END_NAMESPACE_FILESYSTEM + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX_FILESYSTEM diff --git a/cuda_toolkit/include/float.h b/cuda_toolkit/include/float.h new file mode 100644 index 0000000000000000000000000000000000000000..523fbb09499f7b0afbb5de6c599bb389ebf2f7a2 --- /dev/null +++ b/cuda_toolkit/include/float.h @@ -0,0 +1,101 @@ +// -*- C++ -*- +//===--------------------------- float.h ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_FLOAT_H +#define _LIBCUDACXX_FLOAT_H + +/* + float.h synopsis + +Macros: + + FLT_ROUNDS + FLT_EVAL_METHOD // C99 + FLT_RADIX + + FLT_MANT_DIG + DBL_MANT_DIG + LDBL_MANT_DIG + + FLT_HAS_SUBNORM // C11 + DBL_HAS_SUBNORM // C11 + LDBL_HAS_SUBNORM // C11 + + DECIMAL_DIG // C99 + FLT_DECIMAL_DIG // C11 + DBL_DECIMAL_DIG // C11 + LDBL_DECIMAL_DIG // C11 + + FLT_DIG + DBL_DIG + LDBL_DIG + + FLT_MIN_EXP + DBL_MIN_EXP + LDBL_MIN_EXP + + FLT_MIN_10_EXP + DBL_MIN_10_EXP + LDBL_MIN_10_EXP + + FLT_MAX_EXP + DBL_MAX_EXP + LDBL_MAX_EXP + + FLT_MAX_10_EXP + DBL_MAX_10_EXP + LDBL_MAX_10_EXP + + FLT_MAX + DBL_MAX + LDBL_MAX + + FLT_EPSILON + DBL_EPSILON + LDBL_EPSILON + + FLT_MIN + DBL_MIN + LDBL_MIN + + FLT_TRUE_MIN // C11 + DBL_TRUE_MIN // C11 + LDBL_TRUE_MIN // C11 + +*/ + +#include <__config> + +#include <__pragma_push> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include_next + +#ifdef __cplusplus + +#ifndef FLT_EVAL_METHOD +#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ +#endif + +#ifndef DECIMAL_DIG +#define DECIMAL_DIG __DECIMAL_DIG__ +#endif + +#endif // __cplusplus + +#include <__pragma_pop> + +#endif // _LIBCUDACXX_FLOAT_H diff --git a/cuda_toolkit/include/forward_list b/cuda_toolkit/include/forward_list new file mode 100644 index 0000000000000000000000000000000000000000..90887af0c475517237e5a7ad14b08fa769ad1dec --- /dev/null +++ b/cuda_toolkit/include/forward_list @@ -0,0 +1,1758 @@ +// -*- C++ -*- +//===----------------------- forward_list ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_FORWARD_LIST +#define _LIBCUDACXX_FORWARD_LIST + +/* + forward_list synopsis + +namespace std +{ + +template > +class forward_list +{ +public: + typedef T value_type; + typedef Allocator allocator_type; + + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename allocator_traits::pointer pointer; + typedef typename allocator_traits::const_pointer const_pointer; + typedef typename allocator_traits::size_type size_type; + typedef typename allocator_traits::difference_type difference_type; + + typedef
iterator; + typedef
const_iterator; + + forward_list() + noexcept(is_nothrow_default_constructible::value); + explicit forward_list(const allocator_type& a); + explicit forward_list(size_type n); + explicit forward_list(size_type n, const allocator_type& a); // C++14 + forward_list(size_type n, const value_type& v); + forward_list(size_type n, const value_type& v, const allocator_type& a); + template + forward_list(InputIterator first, InputIterator last); + template + forward_list(InputIterator first, InputIterator last, const allocator_type& a); + forward_list(const forward_list& x); + forward_list(const forward_list& x, const allocator_type& a); + forward_list(forward_list&& x) + noexcept(is_nothrow_move_constructible::value); + forward_list(forward_list&& x, const allocator_type& a); + forward_list(initializer_list il); + forward_list(initializer_list il, const allocator_type& a); + + ~forward_list(); + + forward_list& operator=(const forward_list& x); + forward_list& operator=(forward_list&& x) + noexcept( + allocator_type::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value); + forward_list& operator=(initializer_list il); + + template + void assign(InputIterator first, InputIterator last); + void assign(size_type n, const value_type& v); + void assign(initializer_list il); + + allocator_type get_allocator() const noexcept; + + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; + + const_iterator cbegin() const noexcept; + const_iterator cend() const noexcept; + + iterator before_begin() noexcept; + const_iterator before_begin() const noexcept; + const_iterator cbefore_begin() const noexcept; + + bool empty() const noexcept; + size_type max_size() const noexcept; + + reference front(); + const_reference front() const; + + template reference emplace_front(Args&&... args); // reference in C++17 + void push_front(const value_type& v); + void push_front(value_type&& v); + + void pop_front(); + + template + iterator emplace_after(const_iterator p, Args&&... args); + iterator insert_after(const_iterator p, const value_type& v); + iterator insert_after(const_iterator p, value_type&& v); + iterator insert_after(const_iterator p, size_type n, const value_type& v); + template + iterator insert_after(const_iterator p, + InputIterator first, InputIterator last); + iterator insert_after(const_iterator p, initializer_list il); + + iterator erase_after(const_iterator p); + iterator erase_after(const_iterator first, const_iterator last); + + void swap(forward_list& x) + noexcept(allocator_traits::is_always_equal::value); // C++17 + + void resize(size_type n); + void resize(size_type n, const value_type& v); + void clear() noexcept; + + void splice_after(const_iterator p, forward_list& x); + void splice_after(const_iterator p, forward_list&& x); + void splice_after(const_iterator p, forward_list& x, const_iterator i); + void splice_after(const_iterator p, forward_list&& x, const_iterator i); + void splice_after(const_iterator p, forward_list& x, + const_iterator first, const_iterator last); + void splice_after(const_iterator p, forward_list&& x, + const_iterator first, const_iterator last); + size_type remove(const value_type& v); // void before C++20 + template + size_type remove_if(Predicate pred); // void before C++20 + size_type unique(); // void before C++20 + template + size_type unique(BinaryPredicate binary_pred); // void before C++20 + void merge(forward_list& x); + void merge(forward_list&& x); + template void merge(forward_list& x, Compare comp); + template void merge(forward_list&& x, Compare comp); + void sort(); + template void sort(Compare comp); + void reverse() noexcept; +}; + + +template ::value_type>> + forward_list(InputIterator, InputIterator, Allocator = Allocator()) + -> forward_list::value_type, Allocator>; // C++17 + +template + bool operator==(const forward_list& x, + const forward_list& y); + +template + bool operator< (const forward_list& x, + const forward_list& y); + +template + bool operator!=(const forward_list& x, + const forward_list& y); + +template + bool operator> (const forward_list& x, + const forward_list& y); + +template + bool operator>=(const forward_list& x, + const forward_list& y); + +template + bool operator<=(const forward_list& x, + const forward_list& y); + +template + void swap(forward_list& x, forward_list& y) + noexcept(noexcept(x.swap(y))); + +template + void erase(forward_list& c, const U& value); // C++20 +template + void erase_if(forward_list& c, Predicate pred); // C++20 + +} // std + +*/ + +#include <__config> +#include +#include +#include +#include +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template struct __forward_list_node; +template struct __forward_begin_node; + + +template +struct __forward_list_node_value_type; + +template +struct __forward_list_node_value_type<__forward_list_node<_Tp, _VoidPtr> > { + typedef _Tp type; +}; + +template +struct __forward_node_traits { + + typedef typename remove_cv< + typename pointer_traits<_NodePtr>::element_type>::type __node; + typedef typename __forward_list_node_value_type<__node>::type __node_value_type; + typedef _NodePtr __node_pointer; + typedef __forward_begin_node<_NodePtr> __begin_node; + typedef typename __rebind_pointer<_NodePtr, __begin_node>::type + __begin_node_pointer; + typedef typename __rebind_pointer<_NodePtr, void>::type __void_pointer; + +#if defined(_LIBCUDACXX_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB) + typedef __begin_node_pointer __iter_node_pointer; +#else + typedef typename conditional< + is_pointer<__void_pointer>::value, + __begin_node_pointer, + __node_pointer + >::type __iter_node_pointer; +#endif + + typedef typename conditional< + is_same<__iter_node_pointer, __node_pointer>::value, + __begin_node_pointer, + __node_pointer + >::type __non_iter_node_pointer; + + _LIBCUDACXX_INLINE_VISIBILITY + static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) { + return __p; + } + _LIBCUDACXX_INLINE_VISIBILITY + static __iter_node_pointer __as_iter_node(__non_iter_node_pointer __p) { + return static_cast<__iter_node_pointer>(static_cast<__void_pointer>(__p)); + } +}; + +template +struct __forward_begin_node +{ + typedef _NodePtr pointer; + typedef typename __rebind_pointer<_NodePtr, __forward_begin_node>::type __begin_node_pointer; + + pointer __next_; + + _LIBCUDACXX_INLINE_VISIBILITY __forward_begin_node() : __next_(nullptr) {} + + _LIBCUDACXX_INLINE_VISIBILITY + __begin_node_pointer __next_as_begin() const { + return static_cast<__begin_node_pointer>(__next_); + } +}; + +template +struct _LIBCUDACXX_HIDDEN __begin_node_of +{ + typedef __forward_begin_node< + typename __rebind_pointer<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> >::type + > type; +}; + +template +struct __forward_list_node + : public __begin_node_of<_Tp, _VoidPtr>::type +{ + typedef _Tp value_type; + + value_type __value_; +}; + + +template > class _LIBCUDACXX_TEMPLATE_VIS forward_list; +template class _LIBCUDACXX_TEMPLATE_VIS __forward_list_const_iterator; + +template +class _LIBCUDACXX_TEMPLATE_VIS __forward_list_iterator +{ + typedef __forward_node_traits<_NodePtr> __traits; + typedef typename __traits::__node_pointer __node_pointer; + typedef typename __traits::__begin_node_pointer __begin_node_pointer; + typedef typename __traits::__iter_node_pointer __iter_node_pointer; + typedef typename __traits::__void_pointer __void_pointer; + + __iter_node_pointer __ptr_; + + _LIBCUDACXX_INLINE_VISIBILITY + __begin_node_pointer __get_begin() const { + return static_cast<__begin_node_pointer>( + static_cast<__void_pointer>(__ptr_)); + } + _LIBCUDACXX_INLINE_VISIBILITY + __node_pointer __get_unsafe_node_pointer() const { + return static_cast<__node_pointer>( + static_cast<__void_pointer>(__ptr_)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __forward_list_iterator(nullptr_t) noexcept : __ptr_(nullptr) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __forward_list_iterator(__begin_node_pointer __p) noexcept + : __ptr_(__traits::__as_iter_node(__p)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __forward_list_iterator(__node_pointer __p) noexcept + : __ptr_(__traits::__as_iter_node(__p)) {} + + template friend class _LIBCUDACXX_TEMPLATE_VIS forward_list; + template friend class _LIBCUDACXX_TEMPLATE_VIS __forward_list_const_iterator; + +public: + typedef forward_iterator_tag iterator_category; + typedef typename __traits::__node_value_type value_type; + typedef value_type& reference; + typedef typename pointer_traits<__node_pointer>::difference_type + difference_type; + typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer; + + _LIBCUDACXX_INLINE_VISIBILITY + __forward_list_iterator() noexcept : __ptr_(nullptr) {} + + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const {return __get_unsafe_node_pointer()->__value_;} + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const { + return pointer_traits::pointer_to(__get_unsafe_node_pointer()->__value_); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __forward_list_iterator& operator++() + { + __ptr_ = __traits::__as_iter_node(__ptr_->__next_); + return *this; + } + _LIBCUDACXX_INLINE_VISIBILITY + __forward_list_iterator operator++(int) + { + __forward_list_iterator __t(*this); + ++(*this); + return __t; + } + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __forward_list_iterator& __x, + const __forward_list_iterator& __y) + {return __x.__ptr_ == __y.__ptr_;} + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __forward_list_iterator& __x, + const __forward_list_iterator& __y) + {return !(__x == __y);} +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __forward_list_const_iterator +{ + static_assert((!is_const::element_type>::value), ""); + typedef _NodeConstPtr _NodePtr; + + typedef __forward_node_traits<_NodePtr> __traits; + typedef typename __traits::__node __node; + typedef typename __traits::__node_pointer __node_pointer; + typedef typename __traits::__begin_node_pointer __begin_node_pointer; + typedef typename __traits::__iter_node_pointer __iter_node_pointer; + typedef typename __traits::__void_pointer __void_pointer; + + __iter_node_pointer __ptr_; + + __begin_node_pointer __get_begin() const { + return static_cast<__begin_node_pointer>( + static_cast<__void_pointer>(__ptr_)); + } + __node_pointer __get_unsafe_node_pointer() const { + return static_cast<__node_pointer>( + static_cast<__void_pointer>(__ptr_)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __forward_list_const_iterator(nullptr_t) noexcept + : __ptr_(nullptr) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __forward_list_const_iterator(__begin_node_pointer __p) noexcept + : __ptr_(__traits::__as_iter_node(__p)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __forward_list_const_iterator(__node_pointer __p) noexcept + : __ptr_(__traits::__as_iter_node(__p)) {} + + + template friend class forward_list; + +public: + typedef forward_iterator_tag iterator_category; + typedef typename __traits::__node_value_type value_type; + typedef const value_type& reference; + typedef typename pointer_traits<__node_pointer>::difference_type + difference_type; + typedef typename __rebind_pointer<__node_pointer, const value_type>::type + pointer; + + _LIBCUDACXX_INLINE_VISIBILITY + __forward_list_const_iterator() noexcept : __ptr_(nullptr) {} + _LIBCUDACXX_INLINE_VISIBILITY + __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) noexcept + : __ptr_(__p.__ptr_) {} + + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const {return __get_unsafe_node_pointer()->__value_;} + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const {return pointer_traits::pointer_to( + __get_unsafe_node_pointer()->__value_);} + + _LIBCUDACXX_INLINE_VISIBILITY + __forward_list_const_iterator& operator++() + { + __ptr_ = __traits::__as_iter_node(__ptr_->__next_); + return *this; + } + _LIBCUDACXX_INLINE_VISIBILITY + __forward_list_const_iterator operator++(int) + { + __forward_list_const_iterator __t(*this); + ++(*this); + return __t; + } + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __forward_list_const_iterator& __x, + const __forward_list_const_iterator& __y) + {return __x.__ptr_ == __y.__ptr_;} + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __forward_list_const_iterator& __x, + const __forward_list_const_iterator& __y) + {return !(__x == __y);} +}; + +template +class __forward_list_base +{ +protected: + typedef _Tp value_type; + typedef _Alloc allocator_type; + + typedef typename allocator_traits::void_pointer void_pointer; + typedef __forward_list_node __node; + typedef typename __begin_node_of::type __begin_node; + typedef typename __rebind_alloc_helper, __node>::type __node_allocator; + typedef allocator_traits<__node_allocator> __node_traits; + typedef typename __node_traits::pointer __node_pointer; + + typedef typename __rebind_alloc_helper< + allocator_traits, __begin_node + >::type __begin_node_allocator; + typedef typename allocator_traits<__begin_node_allocator>::pointer + __begin_node_pointer; + + static_assert((!is_same::value), + "internal allocator type must differ from user-specified " + "type; otherwise overload resolution breaks"); + + __compressed_pair<__begin_node, __node_allocator> __before_begin_; + + _LIBCUDACXX_INLINE_VISIBILITY + __begin_node_pointer __before_begin() noexcept + {return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_.first());} + _LIBCUDACXX_INLINE_VISIBILITY + __begin_node_pointer __before_begin() const noexcept + {return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_.first()));} + + _LIBCUDACXX_INLINE_VISIBILITY + __node_allocator& __alloc() noexcept + {return __before_begin_.second();} + _LIBCUDACXX_INLINE_VISIBILITY + const __node_allocator& __alloc() const noexcept + {return __before_begin_.second();} + + typedef __forward_list_iterator<__node_pointer> iterator; + typedef __forward_list_const_iterator<__node_pointer> const_iterator; + + _LIBCUDACXX_INLINE_VISIBILITY + __forward_list_base() + noexcept(is_nothrow_default_constructible<__node_allocator>::value) + : __before_begin_(__begin_node()) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit __forward_list_base(const allocator_type& __a) + : __before_begin_(__begin_node(), __node_allocator(__a)) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit __forward_list_base(const __node_allocator& __a) + : __before_begin_(__begin_node(), __a) {} +public: + _LIBCUDACXX_INLINE_VISIBILITY + __forward_list_base(__forward_list_base&& __x) + noexcept(is_nothrow_move_constructible<__node_allocator>::value); + _LIBCUDACXX_INLINE_VISIBILITY + __forward_list_base(__forward_list_base&& __x, const allocator_type& __a); + +private: + __forward_list_base(const __forward_list_base&); + __forward_list_base& operator=(const __forward_list_base&); + +public: + ~__forward_list_base(); + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __forward_list_base& __x) + {__copy_assign_alloc(__x, integral_constant());} + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__forward_list_base& __x) + noexcept(!__node_traits::propagate_on_container_move_assignment::value || + is_nothrow_move_assignable<__node_allocator>::value) + {__move_assign_alloc(__x, integral_constant());} + +public: + _LIBCUDACXX_INLINE_VISIBILITY + void swap(__forward_list_base& __x) +#if _LIBCUDACXX_STD_VER >= 14 + noexcept; +#else + noexcept(!__node_traits::propagate_on_container_move_assignment::value || + __is_nothrow_swappable<__node_allocator>::value); +#endif +protected: + void clear() noexcept; + +private: + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __forward_list_base&, false_type) {} + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __forward_list_base& __x, true_type) + { + if (__alloc() != __x.__alloc()) + clear(); + __alloc() = __x.__alloc(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__forward_list_base&, false_type) noexcept + {} + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__forward_list_base& __x, true_type) + noexcept(is_nothrow_move_assignable<__node_allocator>::value) + {__alloc() = _CUDA_VSTD::move(__x.__alloc());} +}; + +template +inline +__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x) + noexcept(is_nothrow_move_constructible<__node_allocator>::value) + : __before_begin_(_CUDA_VSTD::move(__x.__before_begin_)) +{ + __x.__before_begin()->__next_ = nullptr; +} + +template +inline +__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x, + const allocator_type& __a) + : __before_begin_(__begin_node(), __node_allocator(__a)) +{ + if (__alloc() == __x.__alloc()) + { + __before_begin()->__next_ = __x.__before_begin()->__next_; + __x.__before_begin()->__next_ = nullptr; + } +} + +template +__forward_list_base<_Tp, _Alloc>::~__forward_list_base() +{ + clear(); +} + +template +inline +void +__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x) +#if _LIBCUDACXX_STD_VER >= 14 + noexcept +#else + noexcept(!__node_traits::propagate_on_container_move_assignment::value || + __is_nothrow_swappable<__node_allocator>::value) +#endif +{ + __swap_allocator(__alloc(), __x.__alloc(), + integral_constant()); + using _CUDA_VSTD::swap; + swap(__before_begin()->__next_, __x.__before_begin()->__next_); +} + +template +void +__forward_list_base<_Tp, _Alloc>::clear() noexcept +{ + __node_allocator& __a = __alloc(); + for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;) + { + __node_pointer __next = __p->__next_; + __node_traits::destroy(__a, _CUDA_VSTD::addressof(__p->__value_)); + __node_traits::deallocate(__a, __p, 1); + __p = __next; + } + __before_begin()->__next_ = nullptr; +} + +template */> +class _LIBCUDACXX_TEMPLATE_VIS forward_list + : private __forward_list_base<_Tp, _Alloc> +{ + typedef __forward_list_base<_Tp, _Alloc> base; + typedef typename base::__node_allocator __node_allocator; + typedef typename base::__node __node; + typedef typename base::__node_traits __node_traits; + typedef typename base::__node_pointer __node_pointer; + typedef typename base::__begin_node_pointer __begin_node_pointer; + +public: + typedef _Tp value_type; + typedef _Alloc allocator_type; + + static_assert((is_same::value), + "Allocator::value_type must be same type as value_type"); + + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename allocator_traits::pointer pointer; + typedef typename allocator_traits::const_pointer const_pointer; + typedef typename allocator_traits::size_type size_type; + typedef typename allocator_traits::difference_type difference_type; + + typedef typename base::iterator iterator; + typedef typename base::const_iterator const_iterator; +#if _LIBCUDACXX_STD_VER > 17 + typedef size_type __remove_return_type; +#else + typedef void __remove_return_type; +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + forward_list() + noexcept(is_nothrow_default_constructible<__node_allocator>::value) + {} // = default; + _LIBCUDACXX_INLINE_VISIBILITY + explicit forward_list(const allocator_type& __a); + explicit forward_list(size_type __n); +#if _LIBCUDACXX_STD_VER > 11 + explicit forward_list(size_type __n, const allocator_type& __a); +#endif + forward_list(size_type __n, const value_type& __v); + forward_list(size_type __n, const value_type& __v, const allocator_type& __a); + template + forward_list(_InputIterator __f, _InputIterator __l, + typename enable_if< + __is_cpp17_input_iterator<_InputIterator>::value + >::type* = nullptr); + template + forward_list(_InputIterator __f, _InputIterator __l, + const allocator_type& __a, + typename enable_if< + __is_cpp17_input_iterator<_InputIterator>::value + >::type* = nullptr); + forward_list(const forward_list& __x); + forward_list(const forward_list& __x, const allocator_type& __a); + + forward_list& operator=(const forward_list& __x); + + _LIBCUDACXX_INLINE_VISIBILITY + forward_list(forward_list&& __x) + noexcept(is_nothrow_move_constructible::value) + : base(_CUDA_VSTD::move(__x)) {} + forward_list(forward_list&& __x, const allocator_type& __a); + + forward_list(initializer_list __il); + forward_list(initializer_list __il, const allocator_type& __a); + + _LIBCUDACXX_INLINE_VISIBILITY + forward_list& operator=(forward_list&& __x) + noexcept( + __node_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value); + + _LIBCUDACXX_INLINE_VISIBILITY + forward_list& operator=(initializer_list __il); + + _LIBCUDACXX_INLINE_VISIBILITY + void assign(initializer_list __il); + + // ~forward_list() = default; + + template + typename enable_if + < + __is_cpp17_input_iterator<_InputIterator>::value, + void + >::type + assign(_InputIterator __f, _InputIterator __l); + void assign(size_type __n, const value_type& __v); + + _LIBCUDACXX_INLINE_VISIBILITY + allocator_type get_allocator() const noexcept + {return allocator_type(base::__alloc());} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator begin() noexcept + {return iterator(base::__before_begin()->__next_);} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator begin() const noexcept + {return const_iterator(base::__before_begin()->__next_);} + _LIBCUDACXX_INLINE_VISIBILITY + iterator end() noexcept + {return iterator(nullptr);} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator end() const noexcept + {return const_iterator(nullptr);} + + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cbegin() const noexcept + {return const_iterator(base::__before_begin()->__next_);} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cend() const noexcept + {return const_iterator(nullptr);} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator before_begin() noexcept + {return iterator(base::__before_begin());} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator before_begin() const noexcept + {return const_iterator(base::__before_begin());} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cbefore_begin() const noexcept + {return const_iterator(base::__before_begin());} + + _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY + bool empty() const noexcept + {return base::__before_begin()->__next_ == nullptr;} + _LIBCUDACXX_INLINE_VISIBILITY + size_type max_size() const noexcept { + return std::min( + __node_traits::max_size(base::__alloc()), + numeric_limits::max()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + reference front() {return base::__before_begin()->__next_->__value_;} + _LIBCUDACXX_INLINE_VISIBILITY + const_reference front() const {return base::__before_begin()->__next_->__value_;} + +#if _LIBCUDACXX_STD_VER > 14 + template reference emplace_front(_Args&&... __args); +#else + template void emplace_front(_Args&&... __args); +#endif + void push_front(value_type&& __v); + void push_front(const value_type& __v); + + void pop_front(); + + template + iterator emplace_after(const_iterator __p, _Args&&... __args); + + iterator insert_after(const_iterator __p, value_type&& __v); + iterator insert_after(const_iterator __p, initializer_list __il) + {return insert_after(__p, __il.begin(), __il.end());} + iterator insert_after(const_iterator __p, const value_type& __v); + iterator insert_after(const_iterator __p, size_type __n, const value_type& __v); + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if + < + __is_cpp17_input_iterator<_InputIterator>::value, + iterator + >::type + insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l); + + iterator erase_after(const_iterator __p); + iterator erase_after(const_iterator __f, const_iterator __l); + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(forward_list& __x) +#if _LIBCUDACXX_STD_VER >= 14 + noexcept +#else + noexcept(!__node_traits::propagate_on_container_swap::value || + __is_nothrow_swappable<__node_allocator>::value) +#endif + {base::swap(__x);} + + void resize(size_type __n); + void resize(size_type __n, const value_type& __v); + _LIBCUDACXX_INLINE_VISIBILITY + void clear() noexcept {base::clear();} + + _LIBCUDACXX_INLINE_VISIBILITY + void splice_after(const_iterator __p, forward_list&& __x); + _LIBCUDACXX_INLINE_VISIBILITY + void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i); + _LIBCUDACXX_INLINE_VISIBILITY + void splice_after(const_iterator __p, forward_list&& __x, + const_iterator __f, const_iterator __l); + void splice_after(const_iterator __p, forward_list& __x); + void splice_after(const_iterator __p, forward_list& __x, const_iterator __i); + void splice_after(const_iterator __p, forward_list& __x, + const_iterator __f, const_iterator __l); + __remove_return_type remove(const value_type& __v); + template __remove_return_type remove_if(_Predicate __pred); + _LIBCUDACXX_INLINE_VISIBILITY + __remove_return_type unique() {return unique(__equal_to());} + template __remove_return_type unique(_BinaryPredicate __binary_pred); + _LIBCUDACXX_INLINE_VISIBILITY + void merge(forward_list&& __x) {merge(__x, __less());} + template + _LIBCUDACXX_INLINE_VISIBILITY + void merge(forward_list&& __x, _Compare __comp) + {merge(__x, _CUDA_VSTD::move(__comp));} + _LIBCUDACXX_INLINE_VISIBILITY + void merge(forward_list& __x) {merge(__x, __less());} + template void merge(forward_list& __x, _Compare __comp); + _LIBCUDACXX_INLINE_VISIBILITY + void sort() {sort(__less());} + template _LIBCUDACXX_INLINE_VISIBILITY void sort(_Compare __comp); + void reverse() noexcept; + +private: + + void __move_assign(forward_list& __x, true_type) + noexcept(is_nothrow_move_assignable::value); + void __move_assign(forward_list& __x, false_type); + + template + static + __node_pointer + __merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp); + + template + static + __node_pointer + __sort(__node_pointer __f, difference_type __sz, _Compare& __comp); +}; + + +#ifndef _LIBCUDACXX_HAS_NO_DEDUCTION_GUIDES +template::value_type>, + class = typename enable_if<__is_allocator<_Alloc>::value, void>::type + > +forward_list(_InputIterator, _InputIterator) + -> forward_list::value_type, _Alloc>; + +template::value, void>::type + > +forward_list(_InputIterator, _InputIterator, _Alloc) + -> forward_list::value_type, _Alloc>; +#endif + +template +inline +forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a) + : base(__a) +{ +} + +template +forward_list<_Tp, _Alloc>::forward_list(size_type __n) +{ + if (__n > 0) + { + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); + for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n, + __p = __p->__next_as_begin()) + { + __h.reset(__node_traits::allocate(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_)); + __h->__next_ = nullptr; + __p->__next_ = __h.release(); + } + } +} + +#if _LIBCUDACXX_STD_VER > 11 +template +forward_list<_Tp, _Alloc>::forward_list(size_type __n, + const allocator_type& __base_alloc) + : base ( __base_alloc ) +{ + if (__n > 0) + { + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); + for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n, + __p = __p->__next_as_begin()) + { + __h.reset(__node_traits::allocate(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_)); + __h->__next_ = nullptr; + __p->__next_ = __h.release(); + } + } +} +#endif + +template +forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) +{ + insert_after(cbefore_begin(), __n, __v); +} + +template +forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v, + const allocator_type& __a) + : base(__a) +{ + insert_after(cbefore_begin(), __n, __v); +} + +template +template +forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l, + typename enable_if< + __is_cpp17_input_iterator<_InputIterator>::value + >::type*) +{ + insert_after(cbefore_begin(), __f, __l); +} + +template +template +forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l, + const allocator_type& __a, + typename enable_if< + __is_cpp17_input_iterator<_InputIterator>::value + >::type*) + : base(__a) +{ + insert_after(cbefore_begin(), __f, __l); +} + +template +forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x) + : base( + __node_traits::select_on_container_copy_construction(__x.__alloc())) { + insert_after(cbefore_begin(), __x.begin(), __x.end()); +} + +template +forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x, + const allocator_type& __a) + : base(__a) +{ + insert_after(cbefore_begin(), __x.begin(), __x.end()); +} + +template +forward_list<_Tp, _Alloc>& +forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) +{ + if (this != &__x) + { + base::__copy_assign_alloc(__x); + assign(__x.begin(), __x.end()); + } + return *this; +} + +template +forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, + const allocator_type& __a) + : base(_CUDA_VSTD::move(__x), __a) +{ + if (base::__alloc() != __x.__alloc()) + { + typedef move_iterator _Ip; + insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end())); + } +} + +template +forward_list<_Tp, _Alloc>::forward_list(initializer_list __il) +{ + insert_after(cbefore_begin(), __il.begin(), __il.end()); +} + +template +forward_list<_Tp, _Alloc>::forward_list(initializer_list __il, + const allocator_type& __a) + : base(__a) +{ + insert_after(cbefore_begin(), __il.begin(), __il.end()); +} + +template +void +forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type) + noexcept(is_nothrow_move_assignable::value) +{ + clear(); + base::__move_assign_alloc(__x); + base::__before_begin()->__next_ = __x.__before_begin()->__next_; + __x.__before_begin()->__next_ = nullptr; +} + +template +void +forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type) +{ + if (base::__alloc() == __x.__alloc()) + __move_assign(__x, true_type()); + else + { + typedef move_iterator _Ip; + assign(_Ip(__x.begin()), _Ip(__x.end())); + } +} + +template +inline +forward_list<_Tp, _Alloc>& +forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) + noexcept( + __node_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value) +{ + __move_assign(__x, integral_constant()); + return *this; +} + +template +inline +forward_list<_Tp, _Alloc>& +forward_list<_Tp, _Alloc>::operator=(initializer_list __il) +{ + assign(__il.begin(), __il.end()); + return *this; +} + +template +template +typename enable_if +< + __is_cpp17_input_iterator<_InputIterator>::value, + void +>::type +forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l) +{ + iterator __i = before_begin(); + iterator __j = _CUDA_VSTD::next(__i); + iterator __e = end(); + for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f) + *__j = *__f; + if (__j == __e) + insert_after(__i, __f, __l); + else + erase_after(__i, __e); +} + +template +void +forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v) +{ + iterator __i = before_begin(); + iterator __j = _CUDA_VSTD::next(__i); + iterator __e = end(); + for (; __j != __e && __n > 0; --__n, ++__i, ++__j) + *__j = __v; + if (__j == __e) + insert_after(__i, __n, __v); + else + erase_after(__i, __e); +} + +template +inline +void +forward_list<_Tp, _Alloc>::assign(initializer_list __il) +{ + assign(__il.begin(), __il.end()); +} + +template +template +#if _LIBCUDACXX_STD_VER > 14 +typename forward_list<_Tp, _Alloc>::reference +#else +void +#endif +forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) +{ + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), + _CUDA_VSTD::forward<_Args>(__args)...); + __h->__next_ = base::__before_begin()->__next_; + base::__before_begin()->__next_ = __h.release(); +#if _LIBCUDACXX_STD_VER > 14 + return base::__before_begin()->__next_->__value_; +#endif +} + +template +void +forward_list<_Tp, _Alloc>::push_front(value_type&& __v) +{ + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), _CUDA_VSTD::move(__v)); + __h->__next_ = base::__before_begin()->__next_; + base::__before_begin()->__next_ = __h.release(); +} + +template +void +forward_list<_Tp, _Alloc>::push_front(const value_type& __v) +{ + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), __v); + __h->__next_ = base::__before_begin()->__next_; + base::__before_begin()->__next_ = __h.release(); +} + +template +void +forward_list<_Tp, _Alloc>::pop_front() +{ + __node_allocator& __a = base::__alloc(); + __node_pointer __p = base::__before_begin()->__next_; + base::__before_begin()->__next_ = __p->__next_; + __node_traits::destroy(__a, _CUDA_VSTD::addressof(__p->__value_)); + __node_traits::deallocate(__a, __p, 1); +} + +template +template +typename forward_list<_Tp, _Alloc>::iterator +forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args) +{ + __begin_node_pointer const __r = __p.__get_begin(); + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), + _CUDA_VSTD::forward<_Args>(__args)...); + __h->__next_ = __r->__next_; + __r->__next_ = __h.release(); + return iterator(__r->__next_); +} + +template +typename forward_list<_Tp, _Alloc>::iterator +forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v) +{ + __begin_node_pointer const __r = __p.__get_begin(); + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), _CUDA_VSTD::move(__v)); + __h->__next_ = __r->__next_; + __r->__next_ = __h.release(); + return iterator(__r->__next_); +} + +template +typename forward_list<_Tp, _Alloc>::iterator +forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v) +{ + __begin_node_pointer const __r = __p.__get_begin(); + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), __v); + __h->__next_ = __r->__next_; + __r->__next_ = __h.release(); + return iterator(__r->__next_); +} + +template +typename forward_list<_Tp, _Alloc>::iterator +forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n, + const value_type& __v) +{ + __begin_node_pointer __r = __p.__get_begin(); + if (__n > 0) + { + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), __v); + __node_pointer __first = __h.release(); + __node_pointer __last = __first; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (--__n; __n != 0; --__n, __last = __last->__next_) + { + __h.reset(__node_traits::allocate(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), __v); + __last->__next_ = __h.release(); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + while (__first != nullptr) + { + __node_pointer __next = __first->__next_; + __node_traits::destroy(__a, _CUDA_VSTD::addressof(__first->__value_)); + __node_traits::deallocate(__a, __first, 1); + __first = __next; + } + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __last->__next_ = __r->__next_; + __r->__next_ = __first; + __r = static_cast<__begin_node_pointer>(__last); + } + return iterator(__r); +} + +template +template +typename enable_if +< + __is_cpp17_input_iterator<_InputIterator>::value, + typename forward_list<_Tp, _Alloc>::iterator +>::type +forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, + _InputIterator __f, _InputIterator __l) +{ + __begin_node_pointer __r = __p.__get_begin(); + if (__f != __l) + { + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), *__f); + __node_pointer __first = __h.release(); + __node_pointer __last = __first; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_))) + { + __h.reset(__node_traits::allocate(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), *__f); + __last->__next_ = __h.release(); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + while (__first != nullptr) + { + __node_pointer __next = __first->__next_; + __node_traits::destroy(__a, _CUDA_VSTD::addressof(__first->__value_)); + __node_traits::deallocate(__a, __first, 1); + __first = __next; + } + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __last->__next_ = __r->__next_; + __r->__next_ = __first; + __r = static_cast<__begin_node_pointer>(__last); + } + return iterator(__r); +} + +template +typename forward_list<_Tp, _Alloc>::iterator +forward_list<_Tp, _Alloc>::erase_after(const_iterator __f) +{ + __begin_node_pointer __p = __f.__get_begin(); + __node_pointer __n = __p->__next_; + __p->__next_ = __n->__next_; + __node_allocator& __a = base::__alloc(); + __node_traits::destroy(__a, _CUDA_VSTD::addressof(__n->__value_)); + __node_traits::deallocate(__a, __n, 1); + return iterator(__p->__next_); +} + +template +typename forward_list<_Tp, _Alloc>::iterator +forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l) +{ + __node_pointer __e = __l.__get_unsafe_node_pointer(); + if (__f != __l) + { + __begin_node_pointer __bp = __f.__get_begin(); + + __node_pointer __n = __bp->__next_; + if (__n != __e) + { + __bp->__next_ = __e; + __node_allocator& __a = base::__alloc(); + do + { + __node_pointer __tmp = __n->__next_; + __node_traits::destroy(__a, _CUDA_VSTD::addressof(__n->__value_)); + __node_traits::deallocate(__a, __n, 1); + __n = __tmp; + } while (__n != __e); + } + } + return iterator(__e); +} + +template +void +forward_list<_Tp, _Alloc>::resize(size_type __n) +{ + size_type __sz = 0; + iterator __p = before_begin(); + iterator __i = begin(); + iterator __e = end(); + for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz) + ; + if (__i != __e) + erase_after(__p, __e); + else + { + __n -= __sz; + if (__n > 0) + { + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); + for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n, + __ptr = __ptr->__next_as_begin()) + { + __h.reset(__node_traits::allocate(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_)); + __h->__next_ = nullptr; + __ptr->__next_ = __h.release(); + } + } + } +} + +template +void +forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v) +{ + size_type __sz = 0; + iterator __p = before_begin(); + iterator __i = begin(); + iterator __e = end(); + for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz) + ; + if (__i != __e) + erase_after(__p, __e); + else + { + __n -= __sz; + if (__n > 0) + { + __node_allocator& __a = base::__alloc(); + typedef __allocator_destructor<__node_allocator> _Dp; + unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); + for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n, + __ptr = __ptr->__next_as_begin()) + { + __h.reset(__node_traits::allocate(__a, 1)); + __node_traits::construct(__a, _CUDA_VSTD::addressof(__h->__value_), __v); + __h->__next_ = nullptr; + __ptr->__next_ = __h.release(); + } + } + } +} + +template +void +forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, + forward_list& __x) +{ + if (!__x.empty()) + { + if (__p.__get_begin()->__next_ != nullptr) + { + const_iterator __lm1 = __x.before_begin(); + while (__lm1.__get_begin()->__next_ != nullptr) + ++__lm1; + __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_; + } + __p.__get_begin()->__next_ = __x.__before_begin()->__next_; + __x.__before_begin()->__next_ = nullptr; + } +} + +template +void +forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, + forward_list& /*__other*/, + const_iterator __i) +{ + const_iterator __lm1 = _CUDA_VSTD::next(__i); + if (__p != __i && __p != __lm1) + { + __i.__get_begin()->__next_ = __lm1.__get_begin()->__next_; + __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_; + __p.__get_begin()->__next_ = __lm1.__get_unsafe_node_pointer(); + } +} + +template +void +forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, + forward_list& /*__other*/, + const_iterator __f, const_iterator __l) +{ + if (__f != __l && __p != __f) + { + const_iterator __lm1 = __f; + while (__lm1.__get_begin()->__next_ != __l.__get_begin()) + ++__lm1; + if (__f != __lm1) + { + __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_; + __p.__get_begin()->__next_ = __f.__get_begin()->__next_; + __f.__get_begin()->__next_ = __l.__get_unsafe_node_pointer(); + } + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, + forward_list&& __x) +{ + splice_after(__p, __x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, + forward_list&& __x, + const_iterator __i) +{ + splice_after(__p, __x, __i); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, + forward_list&& __x, + const_iterator __f, const_iterator __l) +{ + splice_after(__p, __x, __f, __l); +} + +template +typename forward_list<_Tp, _Alloc>::__remove_return_type +forward_list<_Tp, _Alloc>::remove(const value_type& __v) +{ + forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing + typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0; + const iterator __e = end(); + for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) + { + if (__i.__get_begin()->__next_->__value_ == __v) + { + ++__count_removed; + iterator __j = _CUDA_VSTD::next(__i, 2); + for (; __j != __e && *__j == __v; ++__j) + ++__count_removed; + __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); + if (__j == __e) + break; + __i = __j; + } + else + ++__i; + } + + return (__remove_return_type) __count_removed; +} + +template +template +typename forward_list<_Tp, _Alloc>::__remove_return_type +forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred) +{ + forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing + typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0; + const iterator __e = end(); + for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) + { + if (__pred(__i.__get_begin()->__next_->__value_)) + { + ++__count_removed; + iterator __j = _CUDA_VSTD::next(__i, 2); + for (; __j != __e && __pred(*__j); ++__j) + ++__count_removed; + __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); + if (__j == __e) + break; + __i = __j; + } + else + ++__i; + } + + return (__remove_return_type) __count_removed; +} + +template +template +typename forward_list<_Tp, _Alloc>::__remove_return_type +forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred) +{ + forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing + typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0; + for (iterator __i = begin(), __e = end(); __i != __e;) + { + iterator __j = _CUDA_VSTD::next(__i); + for (; __j != __e && __binary_pred(*__i, *__j); ++__j) + ++__count_removed; + if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer()) + __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); + __i = __j; + } + + return (__remove_return_type) __count_removed; +} + +template +template +void +forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp) +{ + if (this != &__x) + { + base::__before_begin()->__next_ = __merge(base::__before_begin()->__next_, + __x.__before_begin()->__next_, + __comp); + __x.__before_begin()->__next_ = nullptr; + } +} + +template +template +typename forward_list<_Tp, _Alloc>::__node_pointer +forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2, + _Compare& __comp) +{ + if (__f1 == nullptr) + return __f2; + if (__f2 == nullptr) + return __f1; + __node_pointer __r; + if (__comp(__f2->__value_, __f1->__value_)) + { + __node_pointer __t = __f2; + while (__t->__next_ != nullptr && + __comp(__t->__next_->__value_, __f1->__value_)) + __t = __t->__next_; + __r = __f2; + __f2 = __t->__next_; + __t->__next_ = __f1; + } + else + __r = __f1; + __node_pointer __p = __f1; + __f1 = __f1->__next_; + while (__f1 != nullptr && __f2 != nullptr) + { + if (__comp(__f2->__value_, __f1->__value_)) + { + __node_pointer __t = __f2; + while (__t->__next_ != nullptr && + __comp(__t->__next_->__value_, __f1->__value_)) + __t = __t->__next_; + __p->__next_ = __f2; + __f2 = __t->__next_; + __t->__next_ = __f1; + } + __p = __f1; + __f1 = __f1->__next_; + } + if (__f2 != nullptr) + __p->__next_ = __f2; + return __r; +} + +template +template +inline +void +forward_list<_Tp, _Alloc>::sort(_Compare __comp) +{ + base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_, + _CUDA_VSTD::distance(begin(), end()), __comp); +} + +template +template +typename forward_list<_Tp, _Alloc>::__node_pointer +forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz, + _Compare& __comp) +{ + switch (__sz) + { + case 0: + case 1: + return __f1; + case 2: + if (__comp(__f1->__next_->__value_, __f1->__value_)) + { + __node_pointer __t = __f1->__next_; + __t->__next_ = __f1; + __f1->__next_ = nullptr; + __f1 = __t; + } + return __f1; + } + difference_type __sz1 = __sz / 2; + difference_type __sz2 = __sz - __sz1; + __node_pointer __t = _CUDA_VSTD::next(iterator(__f1), __sz1 - 1).__get_unsafe_node_pointer(); + __node_pointer __f2 = __t->__next_; + __t->__next_ = nullptr; + return __merge(__sort(__f1, __sz1, __comp), + __sort(__f2, __sz2, __comp), __comp); +} + +template +void +forward_list<_Tp, _Alloc>::reverse() noexcept +{ + __node_pointer __p = base::__before_begin()->__next_; + if (__p != nullptr) + { + __node_pointer __f = __p->__next_; + __p->__next_ = nullptr; + while (__f != nullptr) + { + __node_pointer __t = __f->__next_; + __f->__next_ = __p; + __p = __f; + __f = __t; + } + base::__before_begin()->__next_ = __p; + } +} + +template +bool operator==(const forward_list<_Tp, _Alloc>& __x, + const forward_list<_Tp, _Alloc>& __y) +{ + typedef forward_list<_Tp, _Alloc> _Cp; + typedef typename _Cp::const_iterator _Ip; + _Ip __ix = __x.begin(); + _Ip __ex = __x.end(); + _Ip __iy = __y.begin(); + _Ip __ey = __y.end(); + for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy) + if (!(*__ix == *__iy)) + return false; + return (__ix == __ex) == (__iy == __ey); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool operator!=(const forward_list<_Tp, _Alloc>& __x, + const forward_list<_Tp, _Alloc>& __y) +{ + return !(__x == __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool operator< (const forward_list<_Tp, _Alloc>& __x, + const forward_list<_Tp, _Alloc>& __y) +{ + return _CUDA_VSTD::lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool operator> (const forward_list<_Tp, _Alloc>& __x, + const forward_list<_Tp, _Alloc>& __y) +{ + return __y < __x; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool operator>=(const forward_list<_Tp, _Alloc>& __x, + const forward_list<_Tp, _Alloc>& __y) +{ + return !(__x < __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool operator<=(const forward_list<_Tp, _Alloc>& __x, + const forward_list<_Tp, _Alloc>& __y) +{ + return !(__y < __x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) +{ + __x.swap(__y); +} + +#if _LIBCUDACXX_STD_VER > 17 +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void erase_if(forward_list<_Tp, _Allocator>& __c, _Predicate __pred) +{ __c.remove_if(__pred); } + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void erase(forward_list<_Tp, _Allocator>& __c, const _Up& __v) +{ _CUDA_VSTD::erase_if(__c, [&](auto& __elem) { return __elem == __v; }); } +#endif + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX_FORWARD_LIST diff --git a/cuda_toolkit/include/fstream b/cuda_toolkit/include/fstream new file mode 100644 index 0000000000000000000000000000000000000000..deeae835588ba681717742416b8146087a0af1d5 --- /dev/null +++ b/cuda_toolkit/include/fstream @@ -0,0 +1,1743 @@ +// -*- C++ -*- +//===------------------------- fstream ------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_FSTREAM +#define _LIBCUDACXX_FSTREAM + +/* + fstream synopsis + +template > +class basic_filebuf + : public basic_streambuf +{ +public: + typedef charT char_type; + typedef traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // 27.9.1.2 Constructors/destructor: + basic_filebuf(); + basic_filebuf(basic_filebuf&& rhs); + virtual ~basic_filebuf(); + + // 27.9.1.3 Assign/swap: + basic_filebuf& operator=(basic_filebuf&& rhs); + void swap(basic_filebuf& rhs); + + // 27.9.1.4 Members: + bool is_open() const; + basic_filebuf* open(const char* s, ios_base::openmode mode); + basic_filebuf* open(const string& s, ios_base::openmode mode); + basic_filebuf* open(const filesystem::path& p, ios_base::openmode mode); // C++17 + basic_filebuf* close(); + +protected: + // 27.9.1.5 Overridden virtual functions: + virtual streamsize showmanyc(); + virtual int_type underflow(); + virtual int_type uflow(); + virtual int_type pbackfail(int_type c = traits_type::eof()); + virtual int_type overflow (int_type c = traits_type::eof()); + virtual basic_streambuf* setbuf(char_type* s, streamsize n); + virtual pos_type seekoff(off_type off, ios_base::seekdir way, + ios_base::openmode which = ios_base::in | ios_base::out); + virtual pos_type seekpos(pos_type sp, + ios_base::openmode which = ios_base::in | ios_base::out); + virtual int sync(); + virtual void imbue(const locale& loc); +}; + +template + void + swap(basic_filebuf& x, basic_filebuf& y); + +typedef basic_filebuf filebuf; +typedef basic_filebuf wfilebuf; + +template > +class basic_ifstream + : public basic_istream +{ +public: + typedef charT char_type; + typedef traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + basic_ifstream(); + explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in); + explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in); + explicit basic_ifstream(const filesystem::path& p, + ios_base::openmode mode = ios_base::in); // C++17 + basic_ifstream(basic_ifstream&& rhs); + + basic_ifstream& operator=(basic_ifstream&& rhs); + void swap(basic_ifstream& rhs); + + basic_filebuf* rdbuf() const; + bool is_open() const; + void open(const char* s, ios_base::openmode mode = ios_base::in); + void open(const string& s, ios_base::openmode mode = ios_base::in); + void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in); // C++17 + + void close(); +}; + +template + void + swap(basic_ifstream& x, basic_ifstream& y); + +typedef basic_ifstream ifstream; +typedef basic_ifstream wifstream; + +template > +class basic_ofstream + : public basic_ostream +{ +public: + typedef charT char_type; + typedef traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + basic_ofstream(); + explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out); + explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out); + explicit basic_ofstream(const filesystem::path& p, + ios_base::openmode mode = ios_base::out); // C++17 + basic_ofstream(basic_ofstream&& rhs); + + basic_ofstream& operator=(basic_ofstream&& rhs); + void swap(basic_ofstream& rhs); + + basic_filebuf* rdbuf() const; + bool is_open() const; + void open(const char* s, ios_base::openmode mode = ios_base::out); + void open(const string& s, ios_base::openmode mode = ios_base::out); + void open(const filesystem::path& p, + ios_base::openmode mode = ios_base::out); // C++17 + + void close(); +}; + +template + void + swap(basic_ofstream& x, basic_ofstream& y); + +typedef basic_ofstream ofstream; +typedef basic_ofstream wofstream; + +template > +class basic_fstream + : public basic_iostream +{ +public: + typedef charT char_type; + typedef traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + basic_fstream(); + explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out); + explicit basic_fstream(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out); + explicit basic_fstream(const filesystem::path& p, + ios_base::openmode mode = ios_base::in|ios_base::out); C++17 + basic_fstream(basic_fstream&& rhs); + + basic_fstream& operator=(basic_fstream&& rhs); + void swap(basic_fstream& rhs); + + basic_filebuf* rdbuf() const; + bool is_open() const; + void open(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out); + void open(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out); + void open(const filesystem::path& s, + ios_base::openmode mode = ios_base::in|ios_base::out); // C++17 + + void close(); +}; + +template + void swap(basic_fstream& x, basic_fstream& y); + +typedef basic_fstream fstream; +typedef basic_fstream wfstream; + +} // std + +*/ + +#include <__config> +#include +#include +#include <__locale> +#include +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template +class _LIBCUDACXX_TEMPLATE_VIS basic_filebuf + : public basic_streambuf<_CharT, _Traits> +{ +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + typedef typename traits_type::state_type state_type; + + // 27.9.1.2 Constructors/destructor: + basic_filebuf(); + basic_filebuf(basic_filebuf&& __rhs); + virtual ~basic_filebuf(); + + // 27.9.1.3 Assign/swap: + _LIBCUDACXX_INLINE_VISIBILITY + basic_filebuf& operator=(basic_filebuf&& __rhs); + void swap(basic_filebuf& __rhs); + + // 27.9.1.4 Members: + _LIBCUDACXX_INLINE_VISIBILITY + bool is_open() const; +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE + basic_filebuf* open(const char* __s, ios_base::openmode __mode); +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR + basic_filebuf* open(const wchar_t* __s, ios_base::openmode __mode); +#endif + _LIBCUDACXX_INLINE_VISIBILITY + basic_filebuf* open(const string& __s, ios_base::openmode __mode); + +#if _LIBCUDACXX_STD_VER >= 17 + _LIBCUDACXX_AVAILABILITY_FILESYSTEM _LIBCUDACXX_INLINE_VISIBILITY + basic_filebuf* open(const _CUDA_VSTD_FS::path& __p, ios_base::openmode __mode) { + return open(__p.c_str(), __mode); + } +#endif + _LIBCUDACXX_INLINE_VISIBILITY + basic_filebuf* __open(int __fd, ios_base::openmode __mode); +#endif + basic_filebuf* close(); + + _LIBCUDACXX_INLINE_VISIBILITY + inline static const char* + __make_mdstring(ios_base::openmode __mode) noexcept; + + protected: + // 27.9.1.5 Overridden virtual functions: + virtual int_type underflow(); + virtual int_type pbackfail(int_type __c = traits_type::eof()); + virtual int_type overflow (int_type __c = traits_type::eof()); + virtual basic_streambuf* setbuf(char_type* __s, streamsize __n); + virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __wch = ios_base::in | ios_base::out); + virtual pos_type seekpos(pos_type __sp, + ios_base::openmode __wch = ios_base::in | ios_base::out); + virtual int sync(); + virtual void imbue(const locale& __loc); + +private: + char* __extbuf_; + const char* __extbufnext_; + const char* __extbufend_; + char __extbuf_min_[8]; + size_t __ebs_; + char_type* __intbuf_; + size_t __ibs_; + FILE* __file_; + const codecvt* __cv_; + state_type __st_; + state_type __st_last_; + ios_base::openmode __om_; + ios_base::openmode __cm_; + bool __owns_eb_; + bool __owns_ib_; + bool __always_noconv_; + + bool __read_mode(); + void __write_mode(); +}; + +template +basic_filebuf<_CharT, _Traits>::basic_filebuf() + : __extbuf_(0), + __extbufnext_(0), + __extbufend_(0), + __ebs_(0), + __intbuf_(0), + __ibs_(0), + __file_(0), + __cv_(nullptr), + __st_(), + __st_last_(), + __om_(0), + __cm_(0), + __owns_eb_(false), + __owns_ib_(false), + __always_noconv_(false) +{ + if (has_facet >(this->getloc())) + { + __cv_ = &use_facet >(this->getloc()); + __always_noconv_ = __cv_->always_noconv(); + } + setbuf(0, 4096); +} + +template +basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) + : basic_streambuf<_CharT, _Traits>(__rhs) +{ + if (__rhs.__extbuf_ == __rhs.__extbuf_min_) + { + __extbuf_ = __extbuf_min_; + __extbufnext_ = __extbuf_ + (__rhs.__extbufnext_ - __rhs.__extbuf_); + __extbufend_ = __extbuf_ + (__rhs.__extbufend_ - __rhs.__extbuf_); + } + else + { + __extbuf_ = __rhs.__extbuf_; + __extbufnext_ = __rhs.__extbufnext_; + __extbufend_ = __rhs.__extbufend_; + } + __ebs_ = __rhs.__ebs_; + __intbuf_ = __rhs.__intbuf_; + __ibs_ = __rhs.__ibs_; + __file_ = __rhs.__file_; + __cv_ = __rhs.__cv_; + __st_ = __rhs.__st_; + __st_last_ = __rhs.__st_last_; + __om_ = __rhs.__om_; + __cm_ = __rhs.__cm_; + __owns_eb_ = __rhs.__owns_eb_; + __owns_ib_ = __rhs.__owns_ib_; + __always_noconv_ = __rhs.__always_noconv_; + if (__rhs.pbase()) + { + if (__rhs.pbase() == __rhs.__intbuf_) + this->setp(__intbuf_, __intbuf_ + (__rhs. epptr() - __rhs.pbase())); + else + this->setp((char_type*)__extbuf_, + (char_type*)__extbuf_ + (__rhs. epptr() - __rhs.pbase())); + this->__pbump(__rhs. pptr() - __rhs.pbase()); + } + else if (__rhs.eback()) + { + if (__rhs.eback() == __rhs.__intbuf_) + this->setg(__intbuf_, __intbuf_ + (__rhs.gptr() - __rhs.eback()), + __intbuf_ + (__rhs.egptr() - __rhs.eback())); + else + this->setg((char_type*)__extbuf_, + (char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()), + (char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback())); + } + __rhs.__extbuf_ = 0; + __rhs.__extbufnext_ = 0; + __rhs.__extbufend_ = 0; + __rhs.__ebs_ = 0; + __rhs.__intbuf_ = 0; + __rhs.__ibs_ = 0; + __rhs.__file_ = 0; + __rhs.__st_ = state_type(); + __rhs.__st_last_ = state_type(); + __rhs.__om_ = 0; + __rhs.__cm_ = 0; + __rhs.__owns_eb_ = false; + __rhs.__owns_ib_ = false; + __rhs.setg(0, 0, 0); + __rhs.setp(0, 0); +} + +template +inline +basic_filebuf<_CharT, _Traits>& +basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs) +{ + close(); + swap(__rhs); + return *this; +} + +template +basic_filebuf<_CharT, _Traits>::~basic_filebuf() +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + close(); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + if (__owns_eb_) + delete [] __extbuf_; + if (__owns_ib_) + delete [] __intbuf_; +} + +template +void +basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs) +{ + basic_streambuf::swap(__rhs); + if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_) + { + _CUDA_VSTD::swap(__extbuf_, __rhs.__extbuf_); + _CUDA_VSTD::swap(__extbufnext_, __rhs.__extbufnext_); + _CUDA_VSTD::swap(__extbufend_, __rhs.__extbufend_); + } + else + { + ptrdiff_t __ln = __extbufnext_ - __extbuf_; + ptrdiff_t __le = __extbufend_ - __extbuf_; + ptrdiff_t __rn = __rhs.__extbufnext_ - __rhs.__extbuf_; + ptrdiff_t __re = __rhs.__extbufend_ - __rhs.__extbuf_; + if (__extbuf_ == __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_) + { + __extbuf_ = __rhs.__extbuf_; + __rhs.__extbuf_ = __rhs.__extbuf_min_; + } + else if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ == __rhs.__extbuf_min_) + { + __rhs.__extbuf_ = __extbuf_; + __extbuf_ = __extbuf_min_; + } + __extbufnext_ = __extbuf_ + __rn; + __extbufend_ = __extbuf_ + __re; + __rhs.__extbufnext_ = __rhs.__extbuf_ + __ln; + __rhs.__extbufend_ = __rhs.__extbuf_ + __le; + } + _CUDA_VSTD::swap(__ebs_, __rhs.__ebs_); + _CUDA_VSTD::swap(__intbuf_, __rhs.__intbuf_); + _CUDA_VSTD::swap(__ibs_, __rhs.__ibs_); + _CUDA_VSTD::swap(__file_, __rhs.__file_); + _CUDA_VSTD::swap(__cv_, __rhs.__cv_); + _CUDA_VSTD::swap(__st_, __rhs.__st_); + _CUDA_VSTD::swap(__st_last_, __rhs.__st_last_); + _CUDA_VSTD::swap(__om_, __rhs.__om_); + _CUDA_VSTD::swap(__cm_, __rhs.__cm_); + _CUDA_VSTD::swap(__owns_eb_, __rhs.__owns_eb_); + _CUDA_VSTD::swap(__owns_ib_, __rhs.__owns_ib_); + _CUDA_VSTD::swap(__always_noconv_, __rhs.__always_noconv_); + if (this->eback() == (char_type*)__rhs.__extbuf_min_) + { + ptrdiff_t __n = this->gptr() - this->eback(); + ptrdiff_t __e = this->egptr() - this->eback(); + this->setg((char_type*)__extbuf_min_, + (char_type*)__extbuf_min_ + __n, + (char_type*)__extbuf_min_ + __e); + } + else if (this->pbase() == (char_type*)__rhs.__extbuf_min_) + { + ptrdiff_t __n = this->pptr() - this->pbase(); + ptrdiff_t __e = this->epptr() - this->pbase(); + this->setp((char_type*)__extbuf_min_, + (char_type*)__extbuf_min_ + __e); + this->__pbump(__n); + } + if (__rhs.eback() == (char_type*)__extbuf_min_) + { + ptrdiff_t __n = __rhs.gptr() - __rhs.eback(); + ptrdiff_t __e = __rhs.egptr() - __rhs.eback(); + __rhs.setg((char_type*)__rhs.__extbuf_min_, + (char_type*)__rhs.__extbuf_min_ + __n, + (char_type*)__rhs.__extbuf_min_ + __e); + } + else if (__rhs.pbase() == (char_type*)__extbuf_min_) + { + ptrdiff_t __n = __rhs.pptr() - __rhs.pbase(); + ptrdiff_t __e = __rhs.epptr() - __rhs.pbase(); + __rhs.setp((char_type*)__rhs.__extbuf_min_, + (char_type*)__rhs.__extbuf_min_ + __e); + __rhs.__pbump(__n); + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(basic_filebuf<_CharT, _Traits>& __x, basic_filebuf<_CharT, _Traits>& __y) +{ + __x.swap(__y); +} + +template +inline +bool +basic_filebuf<_CharT, _Traits>::is_open() const +{ + return __file_ != 0; +} + +template +const char* basic_filebuf<_CharT, _Traits>::__make_mdstring( + ios_base::openmode __mode) noexcept { + switch (__mode & ~ios_base::ate) { + case ios_base::out: + case ios_base::out | ios_base::trunc: + return "w" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::out | ios_base::app: + case ios_base::app: + return "a" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::in: + return "r" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::in | ios_base::out: + return "r+" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::in | ios_base::out | ios_base::trunc: + return "w+" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::in | ios_base::out | ios_base::app: + case ios_base::in | ios_base::app: + return "a+" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::out | ios_base::binary: + case ios_base::out | ios_base::trunc | ios_base::binary: + return "wb" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::out | ios_base::app | ios_base::binary: + case ios_base::app | ios_base::binary: + return "ab" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::in | ios_base::binary: + return "rb" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::in | ios_base::out | ios_base::binary: + return "r+b" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary: + return "w+b" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + case ios_base::in | ios_base::out | ios_base::app | ios_base::binary: + case ios_base::in | ios_base::app | ios_base::binary: + return "a+b" _LIBCUDACXX_FOPEN_CLOEXEC_MODE; + default: + return nullptr; + } + _LIBCUDACXX_UNREACHABLE_AFTER_SWITCH(); +} + +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +template +basic_filebuf<_CharT, _Traits>* +basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) +{ + basic_filebuf<_CharT, _Traits>* __rt = 0; + if (__file_ == 0) + { + if (const char* __mdstr = __make_mdstring(__mode)) { + __rt = this; + __file_ = fopen(__s, __mdstr); + if (__file_) { + __om_ = __mode; + if (__mode & ios_base::ate) { + if (fseek(__file_, 0, SEEK_END)) { + fclose(__file_); + __file_ = 0; + __rt = 0; + } + } + } else + __rt = 0; + } + } + return __rt; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY basic_filebuf<_CharT, _Traits>* +basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) { + basic_filebuf<_CharT, _Traits>* __rt = 0; + if (__file_ == 0) { + if (const char* __mdstr = __make_mdstring(__mode)) { + __rt = this; + __file_ = fdopen(__fd, __mdstr); + if (__file_) { + __om_ = __mode; + if (__mode & ios_base::ate) { + if (fseek(__file_, 0, SEEK_END)) { + fclose(__file_); + __file_ = 0; + __rt = 0; + } + } + } else + __rt = 0; + } + } + return __rt; +} + +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR +// This is basically the same as the char* overload except that it uses _wfopen +// and long mode strings. +template +basic_filebuf<_CharT, _Traits>* +basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) +{ + basic_filebuf<_CharT, _Traits>* __rt = 0; + if (__file_ == 0) + { + __rt = this; + const wchar_t* __mdstr; + switch (__mode & ~ios_base::ate) + { + case ios_base::out: + case ios_base::out | ios_base::trunc: + __mdstr = L"w"; + break; + case ios_base::out | ios_base::app: + case ios_base::app: + __mdstr = L"a"; + break; + case ios_base::in: + __mdstr = L"r"; + break; + case ios_base::in | ios_base::out: + __mdstr = L"r+"; + break; + case ios_base::in | ios_base::out | ios_base::trunc: + __mdstr = L"w+"; + break; + case ios_base::in | ios_base::out | ios_base::app: + case ios_base::in | ios_base::app: + __mdstr = L"a+"; + break; + case ios_base::out | ios_base::binary: + case ios_base::out | ios_base::trunc | ios_base::binary: + __mdstr = L"wb"; + break; + case ios_base::out | ios_base::app | ios_base::binary: + case ios_base::app | ios_base::binary: + __mdstr = L"ab"; + break; + case ios_base::in | ios_base::binary: + __mdstr = L"rb"; + break; + case ios_base::in | ios_base::out | ios_base::binary: + __mdstr = L"r+b"; + break; + case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary: + __mdstr = L"w+b"; + break; + case ios_base::in | ios_base::out | ios_base::app | ios_base::binary: + case ios_base::in | ios_base::app | ios_base::binary: + __mdstr = L"a+b"; + break; + default: + __rt = 0; + break; + } + if (__rt) + { + __file_ = _wfopen(__s, __mdstr); + if (__file_) + { + __om_ = __mode; + if (__mode & ios_base::ate) + { + if (fseek(__file_, 0, SEEK_END)) + { + fclose(__file_); + __file_ = 0; + __rt = 0; + } + } + } + else + __rt = 0; + } + } + return __rt; +} +#endif + +template +inline +basic_filebuf<_CharT, _Traits>* +basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) +{ + return open(__s.c_str(), __mode); +} +#endif + +template +basic_filebuf<_CharT, _Traits>* +basic_filebuf<_CharT, _Traits>::close() +{ + basic_filebuf<_CharT, _Traits>* __rt = 0; + if (__file_) + { + __rt = this; + unique_ptr __h(__file_, fclose); + if (sync()) + __rt = 0; + if (fclose(__h.release())) + __rt = 0; + __file_ = 0; + setbuf(0, 0); + } + return __rt; +} + +template +typename basic_filebuf<_CharT, _Traits>::int_type +basic_filebuf<_CharT, _Traits>::underflow() +{ + if (__file_ == 0) + return traits_type::eof(); + bool __initial = __read_mode(); + char_type __1buf; + if (this->gptr() == 0) + this->setg(&__1buf, &__1buf+1, &__1buf+1); + const size_t __unget_sz = __initial ? 0 : min((this->egptr() - this->eback()) / 2, 4); + int_type __c = traits_type::eof(); + if (this->gptr() == this->egptr()) + { + memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type)); + if (__always_noconv_) + { + size_t __nmemb = static_cast(this->egptr() - this->eback() - __unget_sz); + __nmemb = fread(this->eback() + __unget_sz, 1, __nmemb, __file_); + if (__nmemb != 0) + { + this->setg(this->eback(), + this->eback() + __unget_sz, + this->eback() + __unget_sz + __nmemb); + __c = traits_type::to_int_type(*this->gptr()); + } + } + else + { + _LIBCUDACXX_ASSERT ( !(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" ); + if (__extbufend_ != __extbufnext_) + memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); + __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); + __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); + size_t __nmemb = _CUDA_VSTD::min(static_cast(__ibs_ - __unget_sz), + static_cast(__extbufend_ - __extbufnext_)); + codecvt_base::result __r; + __st_last_ = __st_; + size_t __nr = fread((void*) const_cast(__extbufnext_), 1, __nmemb, __file_); + if (__nr != 0) + { + if (!__cv_) + __throw_bad_cast(); + + __extbufend_ = __extbufnext_ + __nr; + char_type* __inext; + __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_, + this->eback() + __unget_sz, + this->eback() + __ibs_, __inext); + if (__r == codecvt_base::noconv) + { + this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, + (char_type*)const_cast(__extbufend_)); + __c = traits_type::to_int_type(*this->gptr()); + } + else if (__inext != this->eback() + __unget_sz) + { + this->setg(this->eback(), this->eback() + __unget_sz, __inext); + __c = traits_type::to_int_type(*this->gptr()); + } + } + } + } + else + __c = traits_type::to_int_type(*this->gptr()); + if (this->eback() == &__1buf) + this->setg(0, 0, 0); + return __c; +} + +template +typename basic_filebuf<_CharT, _Traits>::int_type +basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c) +{ + if (__file_ && this->eback() < this->gptr()) + { + if (traits_type::eq_int_type(__c, traits_type::eof())) + { + this->gbump(-1); + return traits_type::not_eof(__c); + } + if ((__om_ & ios_base::out) || + traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) + { + this->gbump(-1); + *this->gptr() = traits_type::to_char_type(__c); + return __c; + } + } + return traits_type::eof(); +} + +template +typename basic_filebuf<_CharT, _Traits>::int_type +basic_filebuf<_CharT, _Traits>::overflow(int_type __c) +{ + if (__file_ == 0) + return traits_type::eof(); + __write_mode(); + char_type __1buf; + char_type* __pb_save = this->pbase(); + char_type* __epb_save = this->epptr(); + if (!traits_type::eq_int_type(__c, traits_type::eof())) + { + if (this->pptr() == 0) + this->setp(&__1buf, &__1buf+1); + *this->pptr() = traits_type::to_char_type(__c); + this->pbump(1); + } + if (this->pptr() != this->pbase()) + { + if (__always_noconv_) + { + size_t __nmemb = static_cast(this->pptr() - this->pbase()); + if (fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb) + return traits_type::eof(); + } + else + { + char* __extbe = __extbuf_; + codecvt_base::result __r; + do + { + if (!__cv_) + __throw_bad_cast(); + + const char_type* __e; + __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, + __extbuf_, __extbuf_ + __ebs_, __extbe); + if (__e == this->pbase()) + return traits_type::eof(); + if (__r == codecvt_base::noconv) + { + size_t __nmemb = static_cast(this->pptr() - this->pbase()); + if (fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb) + return traits_type::eof(); + } + else if (__r == codecvt_base::ok || __r == codecvt_base::partial) + { + size_t __nmemb = static_cast(__extbe - __extbuf_); + if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb) + return traits_type::eof(); + if (__r == codecvt_base::partial) + { + this->setp(const_cast(__e), this->pptr()); + this->__pbump(this->epptr() - this->pbase()); + } + } + else + return traits_type::eof(); + } while (__r == codecvt_base::partial); + } + this->setp(__pb_save, __epb_save); + } + return traits_type::not_eof(__c); +} + +template +basic_streambuf<_CharT, _Traits>* +basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n) +{ + this->setg(0, 0, 0); + this->setp(0, 0); + if (__owns_eb_) + delete [] __extbuf_; + if (__owns_ib_) + delete [] __intbuf_; + __ebs_ = __n; + if (__ebs_ > sizeof(__extbuf_min_)) + { + if (__always_noconv_ && __s) + { + __extbuf_ = (char*)__s; + __owns_eb_ = false; + } + else + { + __extbuf_ = new char[__ebs_]; + __owns_eb_ = true; + } + } + else + { + __extbuf_ = __extbuf_min_; + __ebs_ = sizeof(__extbuf_min_); + __owns_eb_ = false; + } + if (!__always_noconv_) + { + __ibs_ = max(__n, sizeof(__extbuf_min_)); + if (__s && __ibs_ >= sizeof(__extbuf_min_)) + { + __intbuf_ = __s; + __owns_ib_ = false; + } + else + { + __intbuf_ = new char_type[__ibs_]; + __owns_ib_ = true; + } + } + else + { + __ibs_ = 0; + __intbuf_ = 0; + __owns_ib_ = false; + } + return this; +} + +template +typename basic_filebuf<_CharT, _Traits>::pos_type +basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode) +{ + if (!__cv_) + __throw_bad_cast(); + + int __width = __cv_->encoding(); + if (__file_ == 0 || (__width <= 0 && __off != 0) || sync()) + return pos_type(off_type(-1)); + // __width > 0 || __off == 0 + int __whence; + switch (__way) + { + case ios_base::beg: + __whence = SEEK_SET; + break; + case ios_base::cur: + __whence = SEEK_CUR; + break; + case ios_base::end: + __whence = SEEK_END; + break; + default: + return pos_type(off_type(-1)); + } +#if defined(_LIBCUDACXX_HAS_NO_OFF_T_FUNCTIONS) + if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence)) + return pos_type(off_type(-1)); + pos_type __r = ftell(__file_); +#else + if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence)) + return pos_type(off_type(-1)); + pos_type __r = ftello(__file_); +#endif + __r.state(__st_); + return __r; +} + +template +typename basic_filebuf<_CharT, _Traits>::pos_type +basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) +{ + if (__file_ == 0 || sync()) + return pos_type(off_type(-1)); +#if defined(_LIBCUDACXX_HAS_NO_OFF_T_FUNCTIONS) + if (fseek(__file_, __sp, SEEK_SET)) + return pos_type(off_type(-1)); +#else + if (fseeko(__file_, __sp, SEEK_SET)) + return pos_type(off_type(-1)); +#endif + __st_ = __sp.state(); + return __sp; +} + +template +int +basic_filebuf<_CharT, _Traits>::sync() +{ + if (__file_ == 0) + return 0; + if (!__cv_) + __throw_bad_cast(); + + if (__cm_ & ios_base::out) + { + if (this->pptr() != this->pbase()) + if (overflow() == traits_type::eof()) + return -1; + codecvt_base::result __r; + do + { + char* __extbe; + __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe); + size_t __nmemb = static_cast(__extbe - __extbuf_); + if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb) + return -1; + } while (__r == codecvt_base::partial); + if (__r == codecvt_base::error) + return -1; + if (fflush(__file_)) + return -1; + } + else if (__cm_ & ios_base::in) + { + off_type __c; + state_type __state = __st_last_; + bool __update_st = false; + if (__always_noconv_) + __c = this->egptr() - this->gptr(); + else + { + int __width = __cv_->encoding(); + __c = __extbufend_ - __extbufnext_; + if (__width > 0) + __c += __width * (this->egptr() - this->gptr()); + else + { + if (this->gptr() != this->egptr()) + { + const int __off = __cv_->length(__state, __extbuf_, + __extbufnext_, + this->gptr() - this->eback()); + __c += __extbufnext_ - __extbuf_ - __off; + __update_st = true; + } + } + } +#if defined(_LIBCUDACXX_HAS_NO_OFF_T_FUNCTIONS) + if (fseek(__file_, -__c, SEEK_CUR)) + return -1; +#else + if (fseeko(__file_, -__c, SEEK_CUR)) + return -1; +#endif + if (__update_st) + __st_ = __state; + __extbufnext_ = __extbufend_ = __extbuf_; + this->setg(0, 0, 0); + __cm_ = 0; + } + return 0; +} + +template +void +basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) +{ + sync(); + __cv_ = &use_facet >(__loc); + bool __old_anc = __always_noconv_; + __always_noconv_ = __cv_->always_noconv(); + if (__old_anc != __always_noconv_) + { + this->setg(0, 0, 0); + this->setp(0, 0); + // invariant, char_type is char, else we couldn't get here + if (__always_noconv_) // need to dump __intbuf_ + { + if (__owns_eb_) + delete [] __extbuf_; + __owns_eb_ = __owns_ib_; + __ebs_ = __ibs_; + __extbuf_ = (char*)__intbuf_; + __ibs_ = 0; + __intbuf_ = 0; + __owns_ib_ = false; + } + else // need to obtain an __intbuf_. + { // If __extbuf_ is user-supplied, use it, else new __intbuf_ + if (!__owns_eb_ && __extbuf_ != __extbuf_min_) + { + __ibs_ = __ebs_; + __intbuf_ = (char_type*)__extbuf_; + __owns_ib_ = false; + __extbuf_ = new char[__ebs_]; + __owns_eb_ = true; + } + else + { + __ibs_ = __ebs_; + __intbuf_ = new char_type[__ibs_]; + __owns_ib_ = true; + } + } + } +} + +template +bool +basic_filebuf<_CharT, _Traits>::__read_mode() +{ + if (!(__cm_ & ios_base::in)) + { + this->setp(0, 0); + if (__always_noconv_) + this->setg((char_type*)__extbuf_, + (char_type*)__extbuf_ + __ebs_, + (char_type*)__extbuf_ + __ebs_); + else + this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_); + __cm_ = ios_base::in; + return true; + } + return false; +} + +template +void +basic_filebuf<_CharT, _Traits>::__write_mode() +{ + if (!(__cm_ & ios_base::out)) + { + this->setg(0, 0, 0); + if (__ebs_ > sizeof(__extbuf_min_)) + { + if (__always_noconv_) + this->setp((char_type*)__extbuf_, + (char_type*)__extbuf_ + (__ebs_ - 1)); + else + this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1)); + } + else + this->setp(0, 0); + __cm_ = ios_base::out; + } +} + +// basic_ifstream + +template +class _LIBCUDACXX_TEMPLATE_VIS basic_ifstream + : public basic_istream<_CharT, _Traits> +{ +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + _LIBCUDACXX_INLINE_VISIBILITY + basic_ifstream(); +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE + _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in); +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR + _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_ifstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in); +#endif + _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in); +#if _LIBCUDACXX_STD_VER >= 17 + _LIBCUDACXX_AVAILABILITY_FILESYSTEM _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in) + : basic_ifstream(__p.c_str(), __mode) {} +#endif // _LIBCUDACXX_STD_VER >= 17 +#endif + _LIBCUDACXX_INLINE_VISIBILITY + basic_ifstream(basic_ifstream&& __rhs); + + _LIBCUDACXX_INLINE_VISIBILITY + basic_ifstream& operator=(basic_ifstream&& __rhs); + _LIBCUDACXX_INLINE_VISIBILITY + void swap(basic_ifstream& __rhs); + + _LIBCUDACXX_INLINE_VISIBILITY + basic_filebuf* rdbuf() const; + _LIBCUDACXX_INLINE_VISIBILITY + bool is_open() const; +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE + void open(const char* __s, ios_base::openmode __mode = ios_base::in); +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR + void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in); +#endif + void open(const string& __s, ios_base::openmode __mode = ios_base::in); +#if _LIBCUDACXX_STD_VER >= 17 + _LIBCUDACXX_AVAILABILITY_FILESYSTEM _LIBCUDACXX_INLINE_VISIBILITY + void open(const filesystem::path& __p, + ios_base::openmode __mode = ios_base::in) { + return open(__p.c_str(), __mode); + } +#endif // _LIBCUDACXX_STD_VER >= 17 + + _LIBCUDACXX_INLINE_VISIBILITY + void __open(int __fd, ios_base::openmode __mode); +#endif + _LIBCUDACXX_INLINE_VISIBILITY + void close(); + +private: + basic_filebuf __sb_; +}; + +template +inline +basic_ifstream<_CharT, _Traits>::basic_ifstream() + : basic_istream(&__sb_) +{ +} + +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +template +inline +basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode) + : basic_istream(&__sb_) +{ + if (__sb_.open(__s, __mode | ios_base::in) == 0) + this->setstate(ios_base::failbit); +} + +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR +template +inline +basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode) + : basic_istream(&__sb_) +{ + if (__sb_.open(__s, __mode | ios_base::in) == 0) + this->setstate(ios_base::failbit); +} +#endif + +template +inline +basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode) + : basic_istream(&__sb_) +{ + if (__sb_.open(__s, __mode | ios_base::in) == 0) + this->setstate(ios_base::failbit); +} +#endif + +template +inline +basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs) + : basic_istream(_CUDA_VSTD::move(__rhs)), + __sb_(_CUDA_VSTD::move(__rhs.__sb_)) +{ + this->set_rdbuf(&__sb_); +} + +template +inline +basic_ifstream<_CharT, _Traits>& +basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) +{ + basic_istream::operator=(_CUDA_VSTD::move(__rhs)); + __sb_ = _CUDA_VSTD::move(__rhs.__sb_); + return *this; +} + +template +inline +void +basic_ifstream<_CharT, _Traits>::swap(basic_ifstream& __rhs) +{ + basic_istream::swap(__rhs); + __sb_.swap(__rhs.__sb_); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(basic_ifstream<_CharT, _Traits>& __x, basic_ifstream<_CharT, _Traits>& __y) +{ + __x.swap(__y); +} + +template +inline +basic_filebuf<_CharT, _Traits>* +basic_ifstream<_CharT, _Traits>::rdbuf() const +{ + return const_cast*>(&__sb_); +} + +template +inline +bool +basic_ifstream<_CharT, _Traits>::is_open() const +{ + return __sb_.is_open(); +} + +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +template +void +basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) +{ + if (__sb_.open(__s, __mode | ios_base::in)) + this->clear(); + else + this->setstate(ios_base::failbit); +} + +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR +template +void +basic_ifstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) +{ + if (__sb_.open(__s, __mode | ios_base::in)) + this->clear(); + else + this->setstate(ios_base::failbit); +} +#endif + +template +void +basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) +{ + if (__sb_.open(__s, __mode | ios_base::in)) + this->clear(); + else + this->setstate(ios_base::failbit); +} + +template +void basic_ifstream<_CharT, _Traits>::__open(int __fd, + ios_base::openmode __mode) { + if (__sb_.__open(__fd, __mode | ios_base::in)) + this->clear(); + else + this->setstate(ios_base::failbit); +} +#endif + +template +inline +void +basic_ifstream<_CharT, _Traits>::close() +{ + if (__sb_.close() == 0) + this->setstate(ios_base::failbit); +} + +// basic_ofstream + +template +class _LIBCUDACXX_TEMPLATE_VIS basic_ofstream + : public basic_ostream<_CharT, _Traits> +{ +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + _LIBCUDACXX_INLINE_VISIBILITY + basic_ofstream(); + _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out); +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR + _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_ofstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::out); +#endif + _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out); + +#if _LIBCUDACXX_STD_VER >= 17 + _LIBCUDACXX_AVAILABILITY_FILESYSTEM _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out) + : basic_ofstream(__p.c_str(), __mode) {} +#endif // _LIBCUDACXX_STD_VER >= 17 + + _LIBCUDACXX_INLINE_VISIBILITY + basic_ofstream(basic_ofstream&& __rhs); + + _LIBCUDACXX_INLINE_VISIBILITY + basic_ofstream& operator=(basic_ofstream&& __rhs); + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(basic_ofstream& __rhs); + + _LIBCUDACXX_INLINE_VISIBILITY + basic_filebuf* rdbuf() const; + _LIBCUDACXX_INLINE_VISIBILITY + bool is_open() const; +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE + void open(const char* __s, ios_base::openmode __mode = ios_base::out); +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR + void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::out); +#endif + void open(const string& __s, ios_base::openmode __mode = ios_base::out); + +#if _LIBCUDACXX_STD_VER >= 17 + _LIBCUDACXX_AVAILABILITY_FILESYSTEM _LIBCUDACXX_INLINE_VISIBILITY + void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out) + { return open(__p.c_str(), __mode); } +#endif // _LIBCUDACXX_STD_VER >= 17 + + _LIBCUDACXX_INLINE_VISIBILITY + void __open(int __fd, ios_base::openmode __mode); +#endif + _LIBCUDACXX_INLINE_VISIBILITY + void close(); + +private: + basic_filebuf __sb_; +}; + +template +inline +basic_ofstream<_CharT, _Traits>::basic_ofstream() + : basic_ostream(&__sb_) +{ +} + +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +template +inline +basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode) + : basic_ostream(&__sb_) +{ + if (__sb_.open(__s, __mode | ios_base::out) == 0) + this->setstate(ios_base::failbit); +} + +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR +template +inline +basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode) + : basic_ostream(&__sb_) +{ + if (__sb_.open(__s, __mode | ios_base::out) == 0) + this->setstate(ios_base::failbit); +} +#endif + +template +inline +basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode) + : basic_ostream(&__sb_) +{ + if (__sb_.open(__s, __mode | ios_base::out) == 0) + this->setstate(ios_base::failbit); +} +#endif + +template +inline +basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs) + : basic_ostream(_CUDA_VSTD::move(__rhs)), + __sb_(_CUDA_VSTD::move(__rhs.__sb_)) +{ + this->set_rdbuf(&__sb_); +} + +template +inline +basic_ofstream<_CharT, _Traits>& +basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) +{ + basic_ostream::operator=(_CUDA_VSTD::move(__rhs)); + __sb_ = _CUDA_VSTD::move(__rhs.__sb_); + return *this; +} + +template +inline +void +basic_ofstream<_CharT, _Traits>::swap(basic_ofstream& __rhs) +{ + basic_ostream::swap(__rhs); + __sb_.swap(__rhs.__sb_); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(basic_ofstream<_CharT, _Traits>& __x, basic_ofstream<_CharT, _Traits>& __y) +{ + __x.swap(__y); +} + +template +inline +basic_filebuf<_CharT, _Traits>* +basic_ofstream<_CharT, _Traits>::rdbuf() const +{ + return const_cast*>(&__sb_); +} + +template +inline +bool +basic_ofstream<_CharT, _Traits>::is_open() const +{ + return __sb_.is_open(); +} + +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +template +void +basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) +{ + if (__sb_.open(__s, __mode | ios_base::out)) + this->clear(); + else + this->setstate(ios_base::failbit); +} + +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR +template +void +basic_ofstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) +{ + if (__sb_.open(__s, __mode | ios_base::out)) + this->clear(); + else + this->setstate(ios_base::failbit); +} +#endif + +template +void +basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) +{ + if (__sb_.open(__s, __mode | ios_base::out)) + this->clear(); + else + this->setstate(ios_base::failbit); +} + +template +void basic_ofstream<_CharT, _Traits>::__open(int __fd, + ios_base::openmode __mode) { + if (__sb_.__open(__fd, __mode | ios_base::out)) + this->clear(); + else + this->setstate(ios_base::failbit); +} +#endif + +template +inline +void +basic_ofstream<_CharT, _Traits>::close() +{ + if (__sb_.close() == 0) + this->setstate(ios_base::failbit); +} + +// basic_fstream + +template +class _LIBCUDACXX_TEMPLATE_VIS basic_fstream + : public basic_iostream<_CharT, _Traits> +{ +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + _LIBCUDACXX_INLINE_VISIBILITY + basic_fstream(); +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE + _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR + _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_fstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); +#endif + _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); + +#if _LIBCUDACXX_STD_VER >= 17 + _LIBCUDACXX_AVAILABILITY_FILESYSTEM _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out) + : basic_fstream(__p.c_str(), __mode) {} +#endif // _LIBCUDACXX_STD_VER >= 17 + +#endif + _LIBCUDACXX_INLINE_VISIBILITY + basic_fstream(basic_fstream&& __rhs); + + _LIBCUDACXX_INLINE_VISIBILITY + basic_fstream& operator=(basic_fstream&& __rhs); + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(basic_fstream& __rhs); + + _LIBCUDACXX_INLINE_VISIBILITY + basic_filebuf* rdbuf() const; + _LIBCUDACXX_INLINE_VISIBILITY + bool is_open() const; +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE + void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR + void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); +#endif + void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); + +#if _LIBCUDACXX_STD_VER >= 17 + _LIBCUDACXX_AVAILABILITY_FILESYSTEM _LIBCUDACXX_INLINE_VISIBILITY + void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out) + { return open(__p.c_str(), __mode); } +#endif // _LIBCUDACXX_STD_VER >= 17 + +#endif + _LIBCUDACXX_INLINE_VISIBILITY + void close(); + +private: + basic_filebuf __sb_; +}; + +template +inline +basic_fstream<_CharT, _Traits>::basic_fstream() + : basic_iostream(&__sb_) +{ +} + +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +template +inline +basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode) + : basic_iostream(&__sb_) +{ + if (__sb_.open(__s, __mode) == 0) + this->setstate(ios_base::failbit); +} + +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR +template +inline +basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode) + : basic_iostream(&__sb_) +{ + if (__sb_.open(__s, __mode) == 0) + this->setstate(ios_base::failbit); +} +#endif + +template +inline +basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode) + : basic_iostream(&__sb_) +{ + if (__sb_.open(__s, __mode) == 0) + this->setstate(ios_base::failbit); +} +#endif + +template +inline +basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs) + : basic_iostream(_CUDA_VSTD::move(__rhs)), + __sb_(_CUDA_VSTD::move(__rhs.__sb_)) +{ + this->set_rdbuf(&__sb_); +} + +template +inline +basic_fstream<_CharT, _Traits>& +basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) +{ + basic_iostream::operator=(_CUDA_VSTD::move(__rhs)); + __sb_ = _CUDA_VSTD::move(__rhs.__sb_); + return *this; +} + +template +inline +void +basic_fstream<_CharT, _Traits>::swap(basic_fstream& __rhs) +{ + basic_iostream::swap(__rhs); + __sb_.swap(__rhs.__sb_); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(basic_fstream<_CharT, _Traits>& __x, basic_fstream<_CharT, _Traits>& __y) +{ + __x.swap(__y); +} + +template +inline +basic_filebuf<_CharT, _Traits>* +basic_fstream<_CharT, _Traits>::rdbuf() const +{ + return const_cast*>(&__sb_); +} + +template +inline +bool +basic_fstream<_CharT, _Traits>::is_open() const +{ + return __sb_.is_open(); +} + +#ifndef _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE +template +void +basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) +{ + if (__sb_.open(__s, __mode)) + this->clear(); + else + this->setstate(ios_base::failbit); +} + +#ifdef _LIBCUDACXX_HAS_OPEN_WITH_WCHAR +template +void +basic_fstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) +{ + if (__sb_.open(__s, __mode)) + this->clear(); + else + this->setstate(ios_base::failbit); +} +#endif + +template +void +basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) +{ + if (__sb_.open(__s, __mode)) + this->clear(); + else + this->setstate(ios_base::failbit); +} +#endif + +template +inline +void +basic_fstream<_CharT, _Traits>::close() +{ + if (__sb_.close() == 0) + this->setstate(ios_base::failbit); +} + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX_FSTREAM diff --git a/cuda_toolkit/include/functional b/cuda_toolkit/include/functional new file mode 100644 index 0000000000000000000000000000000000000000..9410a839f539576e7343da10b9f3d1119893a091 --- /dev/null +++ b/cuda_toolkit/include/functional @@ -0,0 +1,552 @@ +// -*- C++ -*- +//===------------------------ functional ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_FUNCTIONAL +#define _LIBCUDACXX_FUNCTIONAL + +/* + functional synopsis + +namespace std +{ + +template +struct unary_function +{ + typedef Arg argument_type; + typedef Result result_type; +}; + +template +struct binary_function +{ + typedef Arg1 first_argument_type; + typedef Arg2 second_argument_type; + typedef Result result_type; +}; + +template +class reference_wrapper + : public unary_function // if wrapping a unary functor + : public binary_function // if wraping a binary functor +{ +public: + // types + typedef T type; + typedef see below result_type; // Not always defined + + // construct/copy/destroy + reference_wrapper(T&) noexcept; + reference_wrapper(T&&) = delete; // do not bind to temps + reference_wrapper(const reference_wrapper& x) noexcept; + + // assignment + reference_wrapper& operator=(const reference_wrapper& x) noexcept; + + // access + operator T& () const noexcept; + T& get() const noexcept; + + // invoke + template + typename result_of::type + operator() (ArgTypes&&...) const; +}; + +template reference_wrapper ref(T& t) noexcept; +template void ref(const T&& t) = delete; +template reference_wrapper ref(reference_wrappert) noexcept; + +template reference_wrapper cref(const T& t) noexcept; +template void cref(const T&& t) = delete; +template reference_wrapper cref(reference_wrapper t) noexcept; + +template struct unwrap_reference; // since C++20 +template struct unwrap_ref_decay : unwrap_reference> { }; // since C++20 +template using unwrap_reference_t = typename unwrap_reference::type; // since C++20 +template using unwrap_ref_decay_t = typename unwrap_ref_decay::type; // since C++20 + +template // in C++14 +struct plus : binary_function +{ + T operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct minus : binary_function +{ + T operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct multiplies : binary_function +{ + T operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct divides : binary_function +{ + T operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct modulus : binary_function +{ + T operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct negate : unary_function +{ + T operator()(const T& x) const; +}; + +template // in C++14 +struct equal_to : binary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct not_equal_to : binary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct greater : binary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct less : binary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct greater_equal : binary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct less_equal : binary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct logical_and : binary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct logical_or : binary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct logical_not : unary_function +{ + bool operator()(const T& x) const; +}; + +template // in C++14 +struct bit_and : unary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct bit_or : unary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // in C++14 +struct bit_xor : unary_function +{ + bool operator()(const T& x, const T& y) const; +}; + +template // C++14 +struct bit_xor : unary_function +{ + bool operator()(const T& x) const; +}; + +template +class unary_negate // deprecated in C++17 + : public unary_function +{ +public: + explicit unary_negate(const Predicate& pred); + bool operator()(const typename Predicate::argument_type& x) const; +}; + +template // deprecated in C++17 +unary_negate not1(const Predicate& pred); + +template +class binary_negate // deprecated in C++17 + : public binary_function +{ +public: + explicit binary_negate(const Predicate& pred); + bool operator()(const typename Predicate::first_argument_type& x, + const typename Predicate::second_argument_type& y) const; +}; + +template // deprecated in C++17 +binary_negate not2(const Predicate& pred); + +template unspecified not_fn(F&& f); // C++17 + +template struct is_bind_expression; +template struct is_placeholder; + + // See C++14 20.9.9, Function object binders +template inline constexpr bool is_bind_expression_v + = is_bind_expression::value; // C++17 +template inline constexpr int is_placeholder_v + = is_placeholder::value; // C++17 + + +template + unspecified bind(Fn&&, BoundArgs&&...); +template + unspecified bind(Fn&&, BoundArgs&&...); + +template + invoke_result_t invoke(F&& f, Args&&... args) // C++17 + noexcept(is_nothrow_invocable_v); + +namespace placeholders { + // M is the implementation-defined number of placeholders + extern unspecified _1; + extern unspecified _2; + . + . + . + extern unspecified _Mp; +} + +template +class binder1st // deprecated in C++11, removed in C++17 + : public unary_function +{ +protected: + Operation op; + typename Operation::first_argument_type value; +public: + binder1st(const Operation& x, const typename Operation::first_argument_type y); + typename Operation::result_type operator()( typename Operation::second_argument_type& x) const; + typename Operation::result_type operator()(const typename Operation::second_argument_type& x) const; +}; + +template +binder1st bind1st(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 + +template +class binder2nd // deprecated in C++11, removed in C++17 + : public unary_function +{ +protected: + Operation op; + typename Operation::second_argument_type value; +public: + binder2nd(const Operation& x, const typename Operation::second_argument_type y); + typename Operation::result_type operator()( typename Operation::first_argument_type& x) const; + typename Operation::result_type operator()(const typename Operation::first_argument_type& x) const; +}; + +template +binder2nd bind2nd(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 + +template // deprecated in C++11, removed in C++17 +class pointer_to_unary_function : public unary_function +{ +public: + explicit pointer_to_unary_function(Result (*f)(Arg)); + Result operator()(Arg x) const; +}; + +template +pointer_to_unary_function ptr_fun(Result (*f)(Arg)); // deprecated in C++11, removed in C++17 + +template // deprecated in C++11, removed in C++17 +class pointer_to_binary_function : public binary_function +{ +public: + explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2)); + Result operator()(Arg1 x, Arg2 y) const; +}; + +template +pointer_to_binary_function ptr_fun(Result (*f)(Arg1,Arg2)); // deprecated in C++11, removed in C++17 + +template // deprecated in C++11, removed in C++17 +class mem_fun_t : public unary_function +{ +public: + explicit mem_fun_t(S (T::*p)()); + S operator()(T* p) const; +}; + +template +class mem_fun1_t : public binary_function // deprecated in C++11, removed in C++17 +{ +public: + explicit mem_fun1_t(S (T::*p)(A)); + S operator()(T* p, A x) const; +}; + +template mem_fun_t mem_fun(S (T::*f)()); // deprecated in C++11, removed in C++17 +template mem_fun1_t mem_fun(S (T::*f)(A)); // deprecated in C++11, removed in C++17 + +template +class mem_fun_ref_t : public unary_function // deprecated in C++11, removed in C++17 +{ +public: + explicit mem_fun_ref_t(S (T::*p)()); + S operator()(T& p) const; +}; + +template +class mem_fun1_ref_t : public binary_function // deprecated in C++11, removed in C++17 +{ +public: + explicit mem_fun1_ref_t(S (T::*p)(A)); + S operator()(T& p, A x) const; +}; + +template mem_fun_ref_t mem_fun_ref(S (T::*f)()); // deprecated in C++11, removed in C++17 +template mem_fun1_ref_t mem_fun_ref(S (T::*f)(A)); // deprecated in C++11, removed in C++17 + +template +class const_mem_fun_t : public unary_function // deprecated in C++11, removed in C++17 +{ +public: + explicit const_mem_fun_t(S (T::*p)() const); + S operator()(const T* p) const; +}; + +template +class const_mem_fun1_t : public binary_function // deprecated in C++11, removed in C++17 +{ +public: + explicit const_mem_fun1_t(S (T::*p)(A) const); + S operator()(const T* p, A x) const; +}; + +template const_mem_fun_t mem_fun(S (T::*f)() const); // deprecated in C++11, removed in C++17 +template const_mem_fun1_t mem_fun(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 + +template +class const_mem_fun_ref_t : public unary_function // deprecated in C++11, removed in C++17 +{ +public: + explicit const_mem_fun_ref_t(S (T::*p)() const); + S operator()(const T& p) const; +}; + +template +class const_mem_fun1_ref_t : public binary_function // deprecated in C++11, removed in C++17 +{ +public: + explicit const_mem_fun1_ref_t(S (T::*p)(A) const); + S operator()(const T& p, A x) const; +}; + +template const_mem_fun_ref_t mem_fun_ref(S (T::*f)() const); // deprecated in C++11, removed in C++17 +template const_mem_fun1_ref_t mem_fun_ref(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 + +template unspecified mem_fn(R T::*); + +class bad_function_call + : public exception +{ +}; + +template class function; // undefined + +template +class function + : public unary_function // iff sizeof...(ArgTypes) == 1 and + // ArgTypes contains T1 + : public binary_function // iff sizeof...(ArgTypes) == 2 and + // ArgTypes contains T1 and T2 +{ +public: + typedef R result_type; + + // construct/copy/destroy: + function() noexcept; + function(nullptr_t) noexcept; + function(const function&); + function(function&&) noexcept; + template + function(F); + template + function(allocator_arg_t, const Alloc&) noexcept; // removed in C++17 + template + function(allocator_arg_t, const Alloc&, nullptr_t) noexcept; // removed in C++17 + template + function(allocator_arg_t, const Alloc&, const function&); // removed in C++17 + template + function(allocator_arg_t, const Alloc&, function&&); // removed in C++17 + template + function(allocator_arg_t, const Alloc&, F); // removed in C++17 + + function& operator=(const function&); + function& operator=(function&&) noexcept; + function& operator=(nullptr_t) noexcept; + template + function& operator=(F&&); + template + function& operator=(reference_wrapper) noexcept; + + ~function(); + + // function modifiers: + void swap(function&) noexcept; + template + void assign(F&&, const Alloc&); // Removed in C++17 + + // function capacity: + explicit operator bool() const noexcept; + + // function invocation: + R operator()(ArgTypes...) const; + + // function target access: + const std::type_info& target_type() const noexcept; + template T* target() noexcept; + template const T* target() const noexcept; +}; + +// Deduction guides +template +function(R(*)(Args...)) -> function; // since C++17 + +template +function(F) -> function; // since C++17 + +// Null pointer comparisons: +template + bool operator==(const function&, nullptr_t) noexcept; + +template + bool operator==(nullptr_t, const function&) noexcept; + +template + bool operator!=(const function&, nullptr_t) noexcept; + +template + bool operator!=(nullptr_t, const function&) noexcept; + +// specialized algorithms: +template + void swap(function&, function&) noexcept; + +template struct hash; + +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; +template <> struct hash; + +template <> struct hash; +template <> struct hash; +template <> struct hash; + +template struct hash; +template <> struct hash; // C++17 + +} // std + +POLICY: For non-variadic implementations, the number of arguments is limited + to 3. It is hoped that the need for non-variadic implementations + will be minimal. + +*/ + +#ifndef __cuda_std__ +#include <__config> +#else +#ifndef _LIBCUDACXX_COMPILER_NVRTC +#include +#endif // _LIBCUDACXX_COMPILER_NVRTC +#endif // __cuda_std__ + + +#include "__functional_base" +#include "__functional/binary_function.h" +#include "__functional/binary_negate.h" +#include "__functional/bind_back.h" +#include "__functional/bind_front.h" +#include "__functional/bind.h" +#include "__functional/binder1st.h" +#include "__functional/binder2nd.h" +#include "__functional/compose.h" +#include "__functional/default_searcher.h" +#include "__functional/function.h" +#include "__functional/hash.h" +#include "__functional/identity.h" +#include "__functional/invoke.h" +#include "__functional/is_transparent.h" +#include "__functional/mem_fn.h" +#include "__functional/mem_fun_ref.h" +#include "__functional/not_fn.h" +#include "__functional/operations.h" +#include "__functional/perfect_forward.h" +#include "__functional/pointer_to_binary_function.h" +#include "__functional/pointer_to_unary_function.h" +#include "__functional/ranges_operations.h" +#include "__functional/reference_wrapper.h" +#include "__functional/unary_function.h" +#include "__functional/unary_negate.h" +#include "__functional/unwrap_ref.h" +#include "__functional/weak_result_type.h" + +#include "chrono" +#include "climits" +#include "iterator" +#include "type_traits" +#include "version" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#endif // _LIBCUDACXX_FUNCTIONAL diff --git a/cuda_toolkit/include/future b/cuda_toolkit/include/future new file mode 100644 index 0000000000000000000000000000000000000000..3e2f4aaf12b1d65d8eafa62ec699fd57876bf3ea --- /dev/null +++ b/cuda_toolkit/include/future @@ -0,0 +1,2608 @@ +// -*- C++ -*- +//===--------------------------- future -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_FUTURE +#define _LIBCUDACXX_FUTURE + +/* + future synopsis + +namespace std +{ + +enum class future_errc +{ + future_already_retrieved = 1, + promise_already_satisfied, + no_state, + broken_promise +}; + +enum class launch +{ + async = 1, + deferred = 2, + any = async | deferred +}; + +enum class future_status +{ + ready, + timeout, + deferred +}; + +template <> struct is_error_code_enum : public true_type { }; +error_code make_error_code(future_errc e) noexcept; +error_condition make_error_condition(future_errc e) noexcept; + +const error_category& future_category() noexcept; + +class future_error + : public logic_error +{ +public: + future_error(error_code ec); // exposition only + explicit future_error(future_errc); // C++17 + const error_code& code() const noexcept; + const char* what() const noexcept; +}; + +template +class promise +{ +public: + promise(); + template + promise(allocator_arg_t, const Allocator& a); + promise(promise&& rhs) noexcept; + promise(const promise& rhs) = delete; + ~promise(); + + // assignment + promise& operator=(promise&& rhs) noexcept; + promise& operator=(const promise& rhs) = delete; + void swap(promise& other) noexcept; + + // retrieving the result + future get_future(); + + // setting the result + void set_value(const R& r); + void set_value(R&& r); + void set_exception(exception_ptr p); + + // setting the result with deferred notification + void set_value_at_thread_exit(const R& r); + void set_value_at_thread_exit(R&& r); + void set_exception_at_thread_exit(exception_ptr p); +}; + +template +class promise +{ +public: + promise(); + template + promise(allocator_arg_t, const Allocator& a); + promise(promise&& rhs) noexcept; + promise(const promise& rhs) = delete; + ~promise(); + + // assignment + promise& operator=(promise&& rhs) noexcept; + promise& operator=(const promise& rhs) = delete; + void swap(promise& other) noexcept; + + // retrieving the result + future get_future(); + + // setting the result + void set_value(R& r); + void set_exception(exception_ptr p); + + // setting the result with deferred notification + void set_value_at_thread_exit(R&); + void set_exception_at_thread_exit(exception_ptr p); +}; + +template <> +class promise +{ +public: + promise(); + template + promise(allocator_arg_t, const Allocator& a); + promise(promise&& rhs) noexcept; + promise(const promise& rhs) = delete; + ~promise(); + + // assignment + promise& operator=(promise&& rhs) noexcept; + promise& operator=(const promise& rhs) = delete; + void swap(promise& other) noexcept; + + // retrieving the result + future get_future(); + + // setting the result + void set_value(); + void set_exception(exception_ptr p); + + // setting the result with deferred notification + void set_value_at_thread_exit(); + void set_exception_at_thread_exit(exception_ptr p); +}; + +template void swap(promise& x, promise& y) noexcept; + +template + struct uses_allocator, Alloc> : public true_type {}; + +template +class future +{ +public: + future() noexcept; + future(future&&) noexcept; + future(const future& rhs) = delete; + ~future(); + future& operator=(const future& rhs) = delete; + future& operator=(future&&) noexcept; + shared_future share() noexcept; + + // retrieving the value + R get(); + + // functions to check state + bool valid() const noexcept; + + void wait() const; + template + future_status + wait_for(const chrono::duration& rel_time) const; + template + future_status + wait_until(const chrono::time_point& abs_time) const; +}; + +template +class future +{ +public: + future() noexcept; + future(future&&) noexcept; + future(const future& rhs) = delete; + ~future(); + future& operator=(const future& rhs) = delete; + future& operator=(future&&) noexcept; + shared_future share() noexcept; + + // retrieving the value + R& get(); + + // functions to check state + bool valid() const noexcept; + + void wait() const; + template + future_status + wait_for(const chrono::duration& rel_time) const; + template + future_status + wait_until(const chrono::time_point& abs_time) const; +}; + +template <> +class future +{ +public: + future() noexcept; + future(future&&) noexcept; + future(const future& rhs) = delete; + ~future(); + future& operator=(const future& rhs) = delete; + future& operator=(future&&) noexcept; + shared_future share() noexcept; + + // retrieving the value + void get(); + + // functions to check state + bool valid() const noexcept; + + void wait() const; + template + future_status + wait_for(const chrono::duration& rel_time) const; + template + future_status + wait_until(const chrono::time_point& abs_time) const; +}; + +template +class shared_future +{ +public: + shared_future() noexcept; + shared_future(const shared_future& rhs); + shared_future(future&&) noexcept; + shared_future(shared_future&& rhs) noexcept; + ~shared_future(); + shared_future& operator=(const shared_future& rhs); + shared_future& operator=(shared_future&& rhs) noexcept; + + // retrieving the value + const R& get() const; + + // functions to check state + bool valid() const noexcept; + + void wait() const; + template + future_status + wait_for(const chrono::duration& rel_time) const; + template + future_status + wait_until(const chrono::time_point& abs_time) const; +}; + +template +class shared_future +{ +public: + shared_future() noexcept; + shared_future(const shared_future& rhs); + shared_future(future&&) noexcept; + shared_future(shared_future&& rhs) noexcept; + ~shared_future(); + shared_future& operator=(const shared_future& rhs); + shared_future& operator=(shared_future&& rhs) noexcept; + + // retrieving the value + R& get() const; + + // functions to check state + bool valid() const noexcept; + + void wait() const; + template + future_status + wait_for(const chrono::duration& rel_time) const; + template + future_status + wait_until(const chrono::time_point& abs_time) const; +}; + +template <> +class shared_future +{ +public: + shared_future() noexcept; + shared_future(const shared_future& rhs); + shared_future(future&&) noexcept; + shared_future(shared_future&& rhs) noexcept; + ~shared_future(); + shared_future& operator=(const shared_future& rhs); + shared_future& operator=(shared_future&& rhs) noexcept; + + // retrieving the value + void get() const; + + // functions to check state + bool valid() const noexcept; + + void wait() const; + template + future_status + wait_for(const chrono::duration& rel_time) const; + template + future_status + wait_until(const chrono::time_point& abs_time) const; +}; + +template + future(__decay_t...)>::type> + async(F&& f, Args&&... args); + +template + future(__decay_t...)>::type> + async(launch policy, F&& f, Args&&... args); + +template class packaged_task; // undefined + +template +class packaged_task +{ +public: + typedef R result_type; // extension + + // construction and destruction + packaged_task() noexcept; + template + explicit packaged_task(F&& f); + template + packaged_task(allocator_arg_t, const Allocator& a, F&& f); + ~packaged_task(); + + // no copy + packaged_task(const packaged_task&) = delete; + packaged_task& operator=(const packaged_task&) = delete; + + // move support + packaged_task(packaged_task&& other) noexcept; + packaged_task& operator=(packaged_task&& other) noexcept; + void swap(packaged_task& other) noexcept; + + bool valid() const noexcept; + + // result retrieval + future get_future(); + + // execution + void operator()(ArgTypes... ); + void make_ready_at_thread_exit(ArgTypes...); + + void reset(); +}; + +template + void swap(packaged_task&) noexcept; + +template struct uses_allocator, Alloc>; + +} // std + +*/ + +#include <__config> +#include +#include +#include +#include +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#ifdef _LIBCUDACXX_HAS_NO_THREADS +#error is not supported on this single threaded system +#else // !_LIBCUDACXX_HAS_NO_THREADS + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +//enum class future_errc +_LIBCUDACXX_DECLARE_STRONG_ENUM(future_errc) +{ + future_already_retrieved = 1, + promise_already_satisfied, + no_state, + broken_promise +}; +_LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(future_errc) + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS is_error_code_enum : public true_type {}; + +#ifdef _LIBCUDACXX_HAS_NO_STRONG_ENUMS +template <> +struct _LIBCUDACXX_TEMPLATE_VIS is_error_code_enum : public true_type { }; +#endif + +//enum class launch +_LIBCUDACXX_DECLARE_STRONG_ENUM(launch) +{ + async = 1, + deferred = 2, + any = async | deferred +}; +_LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(launch) + +#ifndef _LIBCUDACXX_HAS_NO_STRONG_ENUMS + +typedef underlying_type::type __launch_underlying_type; + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr launch +operator&(launch __x, launch __y) +{ + return static_cast(static_cast<__launch_underlying_type>(__x) & + static_cast<__launch_underlying_type>(__y)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr launch +operator|(launch __x, launch __y) +{ + return static_cast(static_cast<__launch_underlying_type>(__x) | + static_cast<__launch_underlying_type>(__y)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr launch +operator^(launch __x, launch __y) +{ + return static_cast(static_cast<__launch_underlying_type>(__x) ^ + static_cast<__launch_underlying_type>(__y)); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +constexpr launch +operator~(launch __x) +{ + return static_cast(~static_cast<__launch_underlying_type>(__x) & 3); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +launch& +operator&=(launch& __x, launch __y) +{ + __x = __x & __y; return __x; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +launch& +operator|=(launch& __x, launch __y) +{ + __x = __x | __y; return __x; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +launch& +operator^=(launch& __x, launch __y) +{ + __x = __x ^ __y; return __x; +} + +#endif // !_LIBCUDACXX_HAS_NO_STRONG_ENUMS + +//enum class future_status +_LIBCUDACXX_DECLARE_STRONG_ENUM(future_status) +{ + ready, + timeout, + deferred +}; +_LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(future_status) + +_LIBCUDACXX_FUNC_VIS +const error_category& future_category() noexcept; + +inline _LIBCUDACXX_INLINE_VISIBILITY +error_code +make_error_code(future_errc __e) noexcept +{ + return error_code(static_cast(__e), future_category()); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +error_condition +make_error_condition(future_errc __e) noexcept +{ + return error_condition(static_cast(__e), future_category()); +} + +class _LIBCUDACXX_EXCEPTION_ABI _LIBCUDACXX_AVAILABILITY_FUTURE_ERROR future_error + : public logic_error +{ + error_code __ec_; +public: + future_error(error_code __ec); +#if _LIBCUDACXX_STD_VERS > 14 + explicit future_error(future_errc _Ev) : logic_error(), __ec_(make_error_code(_Ev)) {} +#endif + _LIBCUDACXX_INLINE_VISIBILITY + const error_code& code() const noexcept {return __ec_;} + + virtual ~future_error() noexcept; +}; + +_LIBCUDACXX_NORETURN inline _LIBCUDACXX_INLINE_VISIBILITY +#ifndef _LIBCUDACXX_NO_EXCEPTIONS +_LIBCUDACXX_AVAILABILITY_FUTURE_ERROR +#endif +void __throw_future_error(future_errc _Ev) +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + throw future_error(make_error_code(_Ev)); +#else + ((void)_Ev); + _CUDA_VSTD::abort(); +#endif +} + +class _LIBCUDACXX_TYPE_VIS _LIBCUDACXX_AVAILABILITY_FUTURE __assoc_sub_state + : public __shared_count +{ +protected: + exception_ptr __exception_; + mutable mutex __mut_; + mutable condition_variable __cv_; + unsigned __state_; + + virtual void __on_zero_shared() noexcept; + void __sub_wait(unique_lock& __lk); +public: + enum + { + __constructed = 1, + __future_attached = 2, + ready = 4, + deferred = 8 + }; + + _LIBCUDACXX_INLINE_VISIBILITY + __assoc_sub_state() : __state_(0) {} + + _LIBCUDACXX_INLINE_VISIBILITY + bool __has_value() const + {return (__state_ & __constructed) || (__exception_ != nullptr);} + + _LIBCUDACXX_INLINE_VISIBILITY + void __attach_future() { + lock_guard __lk(__mut_); + bool __has_future_attached = (__state_ & __future_attached) != 0; + if (__has_future_attached) + __throw_future_error(future_errc::future_already_retrieved); + this->__add_shared(); + __state_ |= __future_attached; + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __set_deferred() {__state_ |= deferred;} + + void __make_ready(); + _LIBCUDACXX_INLINE_VISIBILITY + bool __is_ready() const {return (__state_ & ready) != 0;} + + void set_value(); + void set_value_at_thread_exit(); + + void set_exception(exception_ptr __p); + void set_exception_at_thread_exit(exception_ptr __p); + + void copy(); + + void wait(); + template + future_status + _LIBCUDACXX_INLINE_VISIBILITY + wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const; + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + future_status + wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const; + + virtual void __execute(); +}; + +template +future_status +__assoc_sub_state::wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const +{ + unique_lock __lk(__mut_); + if (__state_ & deferred) + return future_status::deferred; + while (!(__state_ & ready) && _Clock::now() < __abs_time) + __cv_.wait_until(__lk, __abs_time); + if (__state_ & ready) + return future_status::ready; + return future_status::timeout; +} + +template +inline +future_status +__assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const +{ + return wait_until(chrono::steady_clock::now() + __rel_time); +} + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __assoc_state + : public __assoc_sub_state +{ + typedef __assoc_sub_state base; + typedef typename aligned_storage::value>::type _Up; +protected: + _Up __value_; + + virtual void __on_zero_shared() noexcept; +public: + + template +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + void set_value(_Arg&& __arg); +#else + void set_value(_Arg& __arg); +#endif + + template +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + void set_value_at_thread_exit(_Arg&& __arg); +#else + void set_value_at_thread_exit(_Arg& __arg); +#endif + + _Rp move(); + __add_lvalue_reference_t<_Rp> copy(); +}; + +template +void +__assoc_state<_Rp>::__on_zero_shared() noexcept +{ + if (this->__state_ & base::__constructed) + reinterpret_cast<_Rp*>(&__value_)->~_Rp(); + delete this; +} + +template +template +_LIBCUDACXX_AVAILABILITY_FUTURE +void +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +__assoc_state<_Rp>::set_value(_Arg&& __arg) +#else +__assoc_state<_Rp>::set_value(_Arg& __arg) +#endif +{ + unique_lock __lk(this->__mut_); + if (this->__has_value()) + __throw_future_error(future_errc::promise_already_satisfied); + ::new(&__value_) _Rp(_CUDA_VSTD::forward<_Arg>(__arg)); + this->__state_ |= base::__constructed | base::ready; + __cv_.notify_all(); +} + +template +template +void +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +__assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg) +#else +__assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg) +#endif +{ + unique_lock __lk(this->__mut_); + if (this->__has_value()) + __throw_future_error(future_errc::promise_already_satisfied); + ::new(&__value_) _Rp(_CUDA_VSTD::forward<_Arg>(__arg)); + this->__state_ |= base::__constructed; + __thread_local_data()->__make_ready_at_thread_exit(this); +} + +template +_Rp +__assoc_state<_Rp>::move() +{ + unique_lock __lk(this->__mut_); + this->__sub_wait(__lk); + if (this->__exception_ != nullptr) + rethrow_exception(this->__exception_); + return _CUDA_VSTD::move(*reinterpret_cast<_Rp*>(&__value_)); +} + +template +__add_lvalue_reference_t<_Rp> +__assoc_state<_Rp>::copy() +{ + unique_lock __lk(this->__mut_); + this->__sub_wait(__lk); + if (this->__exception_ != nullptr) + rethrow_exception(this->__exception_); + return *reinterpret_cast<_Rp*>(&__value_); +} + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __assoc_state<_Rp&> + : public __assoc_sub_state +{ + typedef __assoc_sub_state base; + typedef _Rp* _Up; +protected: + _Up __value_; + + virtual void __on_zero_shared() noexcept; +public: + + void set_value(_Rp& __arg); + void set_value_at_thread_exit(_Rp& __arg); + + _Rp& copy(); +}; + +template +void +__assoc_state<_Rp&>::__on_zero_shared() noexcept +{ + delete this; +} + +template +void +__assoc_state<_Rp&>::set_value(_Rp& __arg) +{ + unique_lock __lk(this->__mut_); + if (this->__has_value()) + __throw_future_error(future_errc::promise_already_satisfied); + __value_ = _CUDA_VSTD::addressof(__arg); + this->__state_ |= base::__constructed | base::ready; + __cv_.notify_all(); +} + +template +void +__assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg) +{ + unique_lock __lk(this->__mut_); + if (this->__has_value()) + __throw_future_error(future_errc::promise_already_satisfied); + __value_ = _CUDA_VSTD::addressof(__arg); + this->__state_ |= base::__constructed; + __thread_local_data()->__make_ready_at_thread_exit(this); +} + +template +_Rp& +__assoc_state<_Rp&>::copy() +{ + unique_lock __lk(this->__mut_); + this->__sub_wait(__lk); + if (this->__exception_ != nullptr) + rethrow_exception(this->__exception_); + return *__value_; +} + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __assoc_state_alloc + : public __assoc_state<_Rp> +{ + typedef __assoc_state<_Rp> base; + _Alloc __alloc_; + + virtual void __on_zero_shared() noexcept; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __assoc_state_alloc(const _Alloc& __a) + : __alloc_(__a) {} +}; + +template +void +__assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() noexcept +{ + if (this->__state_ & base::__constructed) + reinterpret_cast<_Rp*>(_CUDA_VSTD::addressof(this->__value_))->~_Rp(); + typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al; + typedef allocator_traits<_Al> _ATraits; + typedef pointer_traits _PTraits; + _Al __a(__alloc_); + this->~__assoc_state_alloc(); + __a.deallocate(_PTraits::pointer_to(*this), 1); +} + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __assoc_state_alloc<_Rp&, _Alloc> + : public __assoc_state<_Rp&> +{ + typedef __assoc_state<_Rp&> base; + _Alloc __alloc_; + + virtual void __on_zero_shared() noexcept; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __assoc_state_alloc(const _Alloc& __a) + : __alloc_(__a) {} +}; + +template +void +__assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() noexcept +{ + typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al; + typedef allocator_traits<_Al> _ATraits; + typedef pointer_traits _PTraits; + _Al __a(__alloc_); + this->~__assoc_state_alloc(); + __a.deallocate(_PTraits::pointer_to(*this), 1); +} + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __assoc_sub_state_alloc + : public __assoc_sub_state +{ + typedef __assoc_sub_state base; + _Alloc __alloc_; + + virtual void __on_zero_shared() noexcept; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __assoc_sub_state_alloc(const _Alloc& __a) + : __alloc_(__a) {} +}; + +template +void +__assoc_sub_state_alloc<_Alloc>::__on_zero_shared() noexcept +{ + typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _Al; + typedef allocator_traits<_Al> _ATraits; + typedef pointer_traits _PTraits; + _Al __a(__alloc_); + this->~__assoc_sub_state_alloc(); + __a.deallocate(_PTraits::pointer_to(*this), 1); +} + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __deferred_assoc_state + : public __assoc_state<_Rp> +{ + typedef __assoc_state<_Rp> base; + + _Fp __func_; + +public: +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + explicit __deferred_assoc_state(_Fp&& __f); +#endif + + virtual void __execute(); +}; + +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +inline +__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f) + : __func_(_CUDA_VSTD::forward<_Fp>(__f)) +{ + this->__set_deferred(); +} + +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +void +__deferred_assoc_state<_Rp, _Fp>::__execute() +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + this->set_value(__func_()); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + this->set_exception(current_exception()); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS +} + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __deferred_assoc_state + : public __assoc_sub_state +{ + typedef __assoc_sub_state base; + + _Fp __func_; + +public: +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + explicit __deferred_assoc_state(_Fp&& __f); +#endif + + virtual void __execute(); +}; + +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +inline +__deferred_assoc_state::__deferred_assoc_state(_Fp&& __f) + : __func_(_CUDA_VSTD::forward<_Fp>(__f)) +{ + this->__set_deferred(); +} + +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +void +__deferred_assoc_state::__execute() +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __func_(); + this->set_value(); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + this->set_exception(current_exception()); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS +} + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __async_assoc_state + : public __assoc_state<_Rp> +{ + typedef __assoc_state<_Rp> base; + + _Fp __func_; + + virtual void __on_zero_shared() noexcept; +public: +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + explicit __async_assoc_state(_Fp&& __f); +#endif + + virtual void __execute(); +}; + +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +inline +__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f) + : __func_(_CUDA_VSTD::forward<_Fp>(__f)) +{ +} + +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +void +__async_assoc_state<_Rp, _Fp>::__execute() +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + this->set_value(__func_()); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + this->set_exception(current_exception()); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS +} + +template +void +__async_assoc_state<_Rp, _Fp>::__on_zero_shared() noexcept +{ + this->wait(); + base::__on_zero_shared(); +} + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __async_assoc_state + : public __assoc_sub_state +{ + typedef __assoc_sub_state base; + + _Fp __func_; + + virtual void __on_zero_shared() noexcept; +public: +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + explicit __async_assoc_state(_Fp&& __f); +#endif + + virtual void __execute(); +}; + +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +inline +__async_assoc_state::__async_assoc_state(_Fp&& __f) + : __func_(_CUDA_VSTD::forward<_Fp>(__f)) +{ +} + +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +void +__async_assoc_state::__execute() +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __func_(); + this->set_value(); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + this->set_exception(current_exception()); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS +} + +template +void +__async_assoc_state::__on_zero_shared() noexcept +{ + this->wait(); + base::__on_zero_shared(); +} + +template class _LIBCUDACXX_TEMPLATE_VIS promise; +template class _LIBCUDACXX_TEMPLATE_VIS shared_future; + +// future + +template class _LIBCUDACXX_TEMPLATE_VIS future; + +template +future<_Rp> +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +__make_deferred_assoc_state(_Fp&& __f); +#else +__make_deferred_assoc_state(_Fp __f); +#endif + +template +future<_Rp> +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +__make_async_assoc_state(_Fp&& __f); +#else +__make_async_assoc_state(_Fp __f); +#endif + +template +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_AVAILABILITY_FUTURE future +{ + __assoc_state<_Rp>* __state_; + + explicit future(__assoc_state<_Rp>* __state); + + template friend class promise; + template friend class shared_future; + +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + template + friend future<_R1> __make_deferred_assoc_state(_Fp&& __f); + template + friend future<_R1> __make_async_assoc_state(_Fp&& __f); +#else + template + friend future<_R1> __make_deferred_assoc_state(_Fp __f); + template + friend future<_R1> __make_async_assoc_state(_Fp __f); +#endif + +public: + _LIBCUDACXX_INLINE_VISIBILITY + future() noexcept : __state_(nullptr) {} +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + future(future&& __rhs) noexcept + : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} + future(const future&) = delete; + future& operator=(const future&) = delete; + _LIBCUDACXX_INLINE_VISIBILITY + future& operator=(future&& __rhs) noexcept + { + future(std::move(__rhs)).swap(*this); + return *this; + } +#else // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +private: + future(const future&); + future& operator=(const future&); +public: +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + ~future(); + _LIBCUDACXX_INLINE_VISIBILITY + shared_future<_Rp> share() noexcept; + + // retrieving the value + _Rp get(); + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(future& __rhs) noexcept {_CUDA_VSTD::swap(__state_, __rhs.__state_);} + + // functions to check state + _LIBCUDACXX_INLINE_VISIBILITY + bool valid() const noexcept {return __state_ != nullptr;} + + _LIBCUDACXX_INLINE_VISIBILITY + void wait() const {__state_->wait();} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const + {return __state_->wait_for(__rel_time);} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const + {return __state_->wait_until(__abs_time);} +}; + +template +future<_Rp>::future(__assoc_state<_Rp>* __state) + : __state_(__state) +{ + __state_->__attach_future(); +} + +struct __release_shared_count +{ + void operator()(__shared_count* p) {p->__release_shared();} +}; + +template +future<_Rp>::~future() +{ + if (__state_) + __state_->__release_shared(); +} + +template +_Rp +future<_Rp>::get() +{ + unique_ptr<__shared_count, __release_shared_count> __(__state_); + __assoc_state<_Rp>* __s = __state_; + __state_ = nullptr; + return __s->move(); +} + +template +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_AVAILABILITY_FUTURE future<_Rp&> +{ + __assoc_state<_Rp&>* __state_; + + explicit future(__assoc_state<_Rp&>* __state); + + template friend class promise; + template friend class shared_future; + +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + template + friend future<_R1> __make_deferred_assoc_state(_Fp&& __f); + template + friend future<_R1> __make_async_assoc_state(_Fp&& __f); +#else + template + friend future<_R1> __make_deferred_assoc_state(_Fp __f); + template + friend future<_R1> __make_async_assoc_state(_Fp __f); +#endif + +public: + _LIBCUDACXX_INLINE_VISIBILITY + future() noexcept : __state_(nullptr) {} +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + future(future&& __rhs) noexcept + : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} + future(const future&) = delete; + future& operator=(const future&) = delete; + _LIBCUDACXX_INLINE_VISIBILITY + future& operator=(future&& __rhs) noexcept + { + future(std::move(__rhs)).swap(*this); + return *this; + } +#else // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +private: + future(const future&); + future& operator=(const future&); +public: +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + ~future(); + _LIBCUDACXX_INLINE_VISIBILITY + shared_future<_Rp&> share() noexcept; + + // retrieving the value + _Rp& get(); + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(future& __rhs) noexcept {_CUDA_VSTD::swap(__state_, __rhs.__state_);} + + // functions to check state + _LIBCUDACXX_INLINE_VISIBILITY + bool valid() const noexcept {return __state_ != nullptr;} + + _LIBCUDACXX_INLINE_VISIBILITY + void wait() const {__state_->wait();} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const + {return __state_->wait_for(__rel_time);} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const + {return __state_->wait_until(__abs_time);} +}; + +template +future<_Rp&>::future(__assoc_state<_Rp&>* __state) + : __state_(__state) +{ + __state_->__attach_future(); +} + +template +future<_Rp&>::~future() +{ + if (__state_) + __state_->__release_shared(); +} + +template +_Rp& +future<_Rp&>::get() +{ + unique_ptr<__shared_count, __release_shared_count> __(__state_); + __assoc_state<_Rp&>* __s = __state_; + __state_ = nullptr; + return __s->copy(); +} + +template <> +class _LIBCUDACXX_TYPE_VIS _LIBCUDACXX_AVAILABILITY_FUTURE future +{ + __assoc_sub_state* __state_; + + explicit future(__assoc_sub_state* __state); + + template friend class promise; + template friend class shared_future; + +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + template + friend future<_R1> __make_deferred_assoc_state(_Fp&& __f); + template + friend future<_R1> __make_async_assoc_state(_Fp&& __f); +#else + template + friend future<_R1> __make_deferred_assoc_state(_Fp __f); + template + friend future<_R1> __make_async_assoc_state(_Fp __f); +#endif + +public: + _LIBCUDACXX_INLINE_VISIBILITY + future() noexcept : __state_(nullptr) {} +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + future(future&& __rhs) noexcept + : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} + future(const future&) = delete; + future& operator=(const future&) = delete; + _LIBCUDACXX_INLINE_VISIBILITY + future& operator=(future&& __rhs) noexcept + { + future(std::move(__rhs)).swap(*this); + return *this; + } +#else // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +private: + future(const future&); + future& operator=(const future&); +public: +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + ~future(); + _LIBCUDACXX_INLINE_VISIBILITY + shared_future share() noexcept; + + // retrieving the value + void get(); + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(future& __rhs) noexcept {_CUDA_VSTD::swap(__state_, __rhs.__state_);} + + // functions to check state + _LIBCUDACXX_INLINE_VISIBILITY + bool valid() const noexcept {return __state_ != nullptr;} + + _LIBCUDACXX_INLINE_VISIBILITY + void wait() const {__state_->wait();} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const + {return __state_->wait_for(__rel_time);} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const + {return __state_->wait_until(__abs_time);} +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(future<_Rp>& __x, future<_Rp>& __y) noexcept +{ + __x.swap(__y); +} + +// promise + +template class packaged_task; + +template +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_AVAILABILITY_FUTURE promise +{ + __assoc_state<_Rp>* __state_; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit promise(nullptr_t) noexcept : __state_(nullptr) {} + + template friend class packaged_task; +public: + promise(); + template + promise(allocator_arg_t, const _Alloc& __a); +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + promise(promise&& __rhs) noexcept + : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} + promise(const promise& __rhs) = delete; +#else // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +private: + promise(const promise& __rhs); +public: +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + ~promise(); + + // assignment +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + promise& operator=(promise&& __rhs) noexcept + { + promise(std::move(__rhs)).swap(*this); + return *this; + } + promise& operator=(const promise& __rhs) = delete; +#else // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +private: + promise& operator=(const promise& __rhs); +public: +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + void swap(promise& __rhs) noexcept {_CUDA_VSTD::swap(__state_, __rhs.__state_);} + + // retrieving the result + future<_Rp> get_future(); + + // setting the result + void set_value(const _Rp& __r); +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + void set_value(_Rp&& __r); +#endif + void set_exception(exception_ptr __p); + + // setting the result with deferred notification + void set_value_at_thread_exit(const _Rp& __r); +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + void set_value_at_thread_exit(_Rp&& __r); +#endif + void set_exception_at_thread_exit(exception_ptr __p); +}; + +template +promise<_Rp>::promise() + : __state_(new __assoc_state<_Rp>) +{ +} + +template +template +promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0) +{ + typedef __assoc_state_alloc<_Rp, _Alloc> _State; + typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2; + typedef __allocator_destructor<_A2> _Dest2; + _A2 __a(__a0); + unique_ptr<_State, _Dest2> __hold(__a.allocate(1), _Dest2(__a, 1)); + ::new(static_cast(_CUDA_VSTD::addressof(*__hold.get()))) _State(__a0); + __state_ = _CUDA_VSTD::addressof(*__hold.release()); +} + +template +promise<_Rp>::~promise() +{ + if (__state_) + { + if (!__state_->__has_value() && __state_->use_count() > 1) + __state_->set_exception(make_exception_ptr( + future_error(make_error_code(future_errc::broken_promise)) + )); + __state_->__release_shared(); + } +} + +template +future<_Rp> +promise<_Rp>::get_future() +{ + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + return future<_Rp>(__state_); +} + +template +void +promise<_Rp>::set_value(const _Rp& __r) +{ + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + __state_->set_value(__r); +} + +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +void +promise<_Rp>::set_value(_Rp&& __r) +{ + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + __state_->set_value(_CUDA_VSTD::move(__r)); +} + +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +void +promise<_Rp>::set_exception(exception_ptr __p) +{ + _LIBCUDACXX_ASSERT( __p != nullptr, "promise::set_exception: received nullptr" ); + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + __state_->set_exception(__p); +} + +template +void +promise<_Rp>::set_value_at_thread_exit(const _Rp& __r) +{ + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + __state_->set_value_at_thread_exit(__r); +} + +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +void +promise<_Rp>::set_value_at_thread_exit(_Rp&& __r) +{ + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + __state_->set_value_at_thread_exit(_CUDA_VSTD::move(__r)); +} + +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +template +void +promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p) +{ + _LIBCUDACXX_ASSERT( __p != nullptr, "promise::set_exception_at_thread_exit: received nullptr" ); + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + __state_->set_exception_at_thread_exit(__p); +} + +// promise + +template +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_AVAILABILITY_FUTURE promise<_Rp&> +{ + __assoc_state<_Rp&>* __state_; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit promise(nullptr_t) noexcept : __state_(nullptr) {} + + template friend class packaged_task; + +public: + promise(); + template + promise(allocator_arg_t, const _Allocator& __a); +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + promise(promise&& __rhs) noexcept + : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} + promise(const promise& __rhs) = delete; +#else // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +private: + promise(const promise& __rhs); +public: +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + ~promise(); + + // assignment +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + promise& operator=(promise&& __rhs) noexcept + { + promise(std::move(__rhs)).swap(*this); + return *this; + } + promise& operator=(const promise& __rhs) = delete; +#else // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +private: + promise& operator=(const promise& __rhs); +public: +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + void swap(promise& __rhs) noexcept {_CUDA_VSTD::swap(__state_, __rhs.__state_);} + + // retrieving the result + future<_Rp&> get_future(); + + // setting the result + void set_value(_Rp& __r); + void set_exception(exception_ptr __p); + + // setting the result with deferred notification + void set_value_at_thread_exit(_Rp&); + void set_exception_at_thread_exit(exception_ptr __p); +}; + +template +promise<_Rp&>::promise() + : __state_(new __assoc_state<_Rp&>) +{ +} + +template +template +promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0) +{ + typedef __assoc_state_alloc<_Rp&, _Alloc> _State; + typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2; + typedef __allocator_destructor<_A2> _Dest2; + _A2 __a(__a0); + unique_ptr<_State, _Dest2> __hold(__a.allocate(1), _Dest2(__a, 1)); + ::new(static_cast(_CUDA_VSTD::addressof(*__hold.get()))) _State(__a0); + __state_ = _CUDA_VSTD::addressof(*__hold.release()); +} + +template +promise<_Rp&>::~promise() +{ + if (__state_) + { + if (!__state_->__has_value() && __state_->use_count() > 1) + __state_->set_exception(make_exception_ptr( + future_error(make_error_code(future_errc::broken_promise)) + )); + __state_->__release_shared(); + } +} + +template +future<_Rp&> +promise<_Rp&>::get_future() +{ + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + return future<_Rp&>(__state_); +} + +template +void +promise<_Rp&>::set_value(_Rp& __r) +{ + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + __state_->set_value(__r); +} + +template +void +promise<_Rp&>::set_exception(exception_ptr __p) +{ + _LIBCUDACXX_ASSERT( __p != nullptr, "promise::set_exception: received nullptr" ); + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + __state_->set_exception(__p); +} + +template +void +promise<_Rp&>::set_value_at_thread_exit(_Rp& __r) +{ + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + __state_->set_value_at_thread_exit(__r); +} + +template +void +promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p) +{ + _LIBCUDACXX_ASSERT( __p != nullptr, "promise::set_exception_at_thread_exit: received nullptr" ); + if (__state_ == nullptr) + __throw_future_error(future_errc::no_state); + __state_->set_exception_at_thread_exit(__p); +} + +// promise + +template <> +class _LIBCUDACXX_TYPE_VIS _LIBCUDACXX_AVAILABILITY_FUTURE promise +{ + __assoc_sub_state* __state_; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit promise(nullptr_t) noexcept : __state_(nullptr) {} + + template friend class packaged_task; + +public: + promise(); + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + promise(allocator_arg_t, const _Allocator& __a); +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + promise(promise&& __rhs) noexcept + : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} + promise(const promise& __rhs) = delete; +#else // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +private: + promise(const promise& __rhs); +public: +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + ~promise(); + + // assignment +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + promise& operator=(promise&& __rhs) noexcept + { + promise(std::move(__rhs)).swap(*this); + return *this; + } + promise& operator=(const promise& __rhs) = delete; +#else // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +private: + promise& operator=(const promise& __rhs); +public: +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + void swap(promise& __rhs) noexcept {_CUDA_VSTD::swap(__state_, __rhs.__state_);} + + // retrieving the result + future get_future(); + + // setting the result + void set_value(); + void set_exception(exception_ptr __p); + + // setting the result with deferred notification + void set_value_at_thread_exit(); + void set_exception_at_thread_exit(exception_ptr __p); +}; + +template +promise::promise(allocator_arg_t, const _Alloc& __a0) +{ + typedef __assoc_sub_state_alloc<_Alloc> _State; + typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2; + typedef __allocator_destructor<_A2> _Dest2; + _A2 __a(__a0); + unique_ptr<_State, _Dest2> __hold(__a.allocate(1), _Dest2(__a, 1)); + ::new(static_cast(_CUDA_VSTD::addressof(*__hold.get()))) _State(__a0); + __state_ = _CUDA_VSTD::addressof(*__hold.release()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(promise<_Rp>& __x, promise<_Rp>& __y) noexcept +{ + __x.swap(__y); +} + +template + struct _LIBCUDACXX_TEMPLATE_VIS uses_allocator, _Alloc> + : public true_type {}; + +#ifndef _LIBCUDACXX_HAS_NO_VARIADICS + +// packaged_task + +template class __packaged_task_base; + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __packaged_task_base<_Rp(_ArgTypes...)> +{ + __packaged_task_base(const __packaged_task_base&); + __packaged_task_base& operator=(const __packaged_task_base&); +public: + _LIBCUDACXX_INLINE_VISIBILITY + __packaged_task_base() {} + _LIBCUDACXX_INLINE_VISIBILITY + virtual ~__packaged_task_base() {} + virtual void __move_to(__packaged_task_base*) noexcept = 0; + virtual void destroy() = 0; + virtual void destroy_deallocate() = 0; + virtual _Rp operator()(_ArgTypes&& ...) = 0; +}; + +template class __packaged_task_func; + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> + : public __packaged_task_base<_Rp(_ArgTypes...)> +{ + __compressed_pair<_Fp, _Alloc> __f_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __packaged_task_func(const _Fp& __f) : __f_(__f) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit __packaged_task_func(_Fp&& __f) : __f_(_CUDA_VSTD::move(__f)) {} + _LIBCUDACXX_INLINE_VISIBILITY + __packaged_task_func(const _Fp& __f, const _Alloc& __a) + : __f_(__f, __a) {} + _LIBCUDACXX_INLINE_VISIBILITY + __packaged_task_func(_Fp&& __f, const _Alloc& __a) + : __f_(_CUDA_VSTD::move(__f), __a) {} + virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) noexcept; + virtual void destroy(); + virtual void destroy_deallocate(); + virtual _Rp operator()(_ArgTypes&& ... __args); +}; + +template +void +__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to( + __packaged_task_base<_Rp(_ArgTypes...)>* __p) noexcept +{ + ::new (__p) __packaged_task_func(_CUDA_VSTD::move(__f_.first()), _CUDA_VSTD::move(__f_.second())); +} + +template +void +__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() +{ + __f_.~__compressed_pair<_Fp, _Alloc>(); +} + +template +void +__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() +{ + typedef typename __allocator_traits_rebind<_Alloc, __packaged_task_func>::type _Ap; + typedef allocator_traits<_Ap> _ATraits; + typedef pointer_traits _PTraits; + _Ap __a(__f_.second()); + __f_.~__compressed_pair<_Fp, _Alloc>(); + __a.deallocate(_PTraits::pointer_to(*this), 1); +} + +template +_Rp +__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg) +{ + return __invoke(__f_.first(), _CUDA_VSTD::forward<_ArgTypes>(__arg)...); +} + +template class __packaged_task_function; + +template +class _LIBCUDACXX_AVAILABILITY_FUTURE __packaged_task_function<_Rp(_ArgTypes...)> +{ + typedef __packaged_task_base<_Rp(_ArgTypes...)> __base; + typename aligned_storage<3*sizeof(void*)>::type __buf_; + __base* __f_; + +public: + typedef _Rp result_type; + + // construct/copy/destroy: + _LIBCUDACXX_INLINE_VISIBILITY + __packaged_task_function() noexcept : __f_(nullptr) {} + template + __packaged_task_function(_Fp&& __f); + template + __packaged_task_function(allocator_arg_t, const _Alloc& __a, _Fp&& __f); + + __packaged_task_function(__packaged_task_function&&) noexcept; + __packaged_task_function& operator=(__packaged_task_function&&) noexcept; + + __packaged_task_function(const __packaged_task_function&) = delete; + __packaged_task_function& operator=(const __packaged_task_function&) = delete; + + ~__packaged_task_function(); + + void swap(__packaged_task_function&) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + _Rp operator()(_ArgTypes...) const; +}; + +template +__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) noexcept +{ + if (__f.__f_ == nullptr) + __f_ = nullptr; + else if (__f.__f_ == (__base*)&__f.__buf_) + { + __f_ = (__base*)&__buf_; + __f.__f_->__move_to(__f_); + } + else + { + __f_ = __f.__f_; + __f.__f_ = nullptr; + } +} + +template +template +__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f) + : __f_(nullptr) +{ + typedef typename remove_reference<__decay_t<_Fp>>::type _FR; + typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF; + if (sizeof(_FF) <= sizeof(__buf_)) + { + __f_ = (__base*)&__buf_; + ::new (__f_) _FF(_CUDA_VSTD::forward<_Fp>(__f)); + } + else + { + typedef allocator<_FF> _Ap; + _Ap __a; + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); + ::new (__hold.get()) _FF(_CUDA_VSTD::forward<_Fp>(__f), allocator<_FR>(__a)); + __f_ = __hold.release(); + } +} + +template +template +__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function( + allocator_arg_t, const _Alloc& __a0, _Fp&& __f) + : __f_(nullptr) +{ + typedef typename remove_reference<__decay_t<_Fp>>::type _FR; + typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF; + if (sizeof(_FF) <= sizeof(__buf_)) + { + __f_ = (__base*)&__buf_; + ::new (__f_) _FF(_CUDA_VSTD::forward<_Fp>(__f)); + } + else + { + typedef typename __allocator_traits_rebind<_Alloc, _FF>::type _Ap; + _Ap __a(__a0); + typedef __allocator_destructor<_Ap> _Dp; + unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); + ::new (static_cast(_CUDA_VSTD::addressof(*__hold.get()))) + _FF(_CUDA_VSTD::forward<_Fp>(__f), _Alloc(__a)); + __f_ = _CUDA_VSTD::addressof(*__hold.release()); + } +} + +template +__packaged_task_function<_Rp(_ArgTypes...)>& +__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) noexcept +{ + if (__f_ == (__base*)&__buf_) + __f_->destroy(); + else if (__f_) + __f_->destroy_deallocate(); + __f_ = nullptr; + if (__f.__f_ == nullptr) + __f_ = nullptr; + else if (__f.__f_ == (__base*)&__f.__buf_) + { + __f_ = (__base*)&__buf_; + __f.__f_->__move_to(__f_); + } + else + { + __f_ = __f.__f_; + __f.__f_ = nullptr; + } + return *this; +} + +template +__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function() +{ + if (__f_ == (__base*)&__buf_) + __f_->destroy(); + else if (__f_) + __f_->destroy_deallocate(); +} + +template +void +__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) noexcept +{ + if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) + { + typename aligned_storage::type __tempbuf; + __base* __t = (__base*)&__tempbuf; + __f_->__move_to(__t); + __f_->destroy(); + __f_ = nullptr; + __f.__f_->__move_to((__base*)&__buf_); + __f.__f_->destroy(); + __f.__f_ = nullptr; + __f_ = (__base*)&__buf_; + __t->__move_to((__base*)&__f.__buf_); + __t->destroy(); + __f.__f_ = (__base*)&__f.__buf_; + } + else if (__f_ == (__base*)&__buf_) + { + __f_->__move_to((__base*)&__f.__buf_); + __f_->destroy(); + __f_ = __f.__f_; + __f.__f_ = (__base*)&__f.__buf_; + } + else if (__f.__f_ == (__base*)&__f.__buf_) + { + __f.__f_->__move_to((__base*)&__buf_); + __f.__f_->destroy(); + __f.__f_ = __f_; + __f_ = (__base*)&__buf_; + } + else + _CUDA_VSTD::swap(__f_, __f.__f_); +} + +template +inline +_Rp +__packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const +{ + return (*__f_)(_CUDA_VSTD::forward<_ArgTypes>(__arg)...); +} + +template +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_AVAILABILITY_FUTURE packaged_task<_Rp(_ArgTypes...)> +{ +public: + typedef _Rp result_type; // extension + +private: + __packaged_task_function __f_; + promise __p_; + +public: + // construction and destruction + _LIBCUDACXX_INLINE_VISIBILITY + packaged_task() noexcept : __p_(nullptr) {} + template , + packaged_task + >::value + >::type + > + _LIBCUDACXX_INLINE_VISIBILITY + explicit packaged_task(_Fp&& __f) : __f_(_CUDA_VSTD::forward<_Fp>(__f)) {} + template , + packaged_task + >::value + >::type + > + _LIBCUDACXX_INLINE_VISIBILITY + packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) + : __f_(allocator_arg, __a, _CUDA_VSTD::forward<_Fp>(__f)), + __p_(allocator_arg, __a) {} + // ~packaged_task() = default; + + // no copy + packaged_task(const packaged_task&) = delete; + packaged_task& operator=(const packaged_task&) = delete; + + // move support + _LIBCUDACXX_INLINE_VISIBILITY + packaged_task(packaged_task&& __other) noexcept + : __f_(_CUDA_VSTD::move(__other.__f_)), __p_(_CUDA_VSTD::move(__other.__p_)) {} + _LIBCUDACXX_INLINE_VISIBILITY + packaged_task& operator=(packaged_task&& __other) noexcept + { + __f_ = _CUDA_VSTD::move(__other.__f_); + __p_ = _CUDA_VSTD::move(__other.__p_); + return *this; + } + _LIBCUDACXX_INLINE_VISIBILITY + void swap(packaged_task& __other) noexcept + { + __f_.swap(__other.__f_); + __p_.swap(__other.__p_); + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool valid() const noexcept {return __p_.__state_ != nullptr;} + + // result retrieval + _LIBCUDACXX_INLINE_VISIBILITY + future get_future() {return __p_.get_future();} + + // execution + void operator()(_ArgTypes... __args); + void make_ready_at_thread_exit(_ArgTypes... __args); + + void reset(); +}; + +template +void +packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args) +{ + if (__p_.__state_ == nullptr) + __throw_future_error(future_errc::no_state); + if (__p_.__state_->__has_value()) + __throw_future_error(future_errc::promise_already_satisfied); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __p_.set_value(__f_(_CUDA_VSTD::forward<_ArgTypes>(__args)...)); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __p_.set_exception(current_exception()); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS +} + +template +void +packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) +{ + if (__p_.__state_ == nullptr) + __throw_future_error(future_errc::no_state); + if (__p_.__state_->__has_value()) + __throw_future_error(future_errc::promise_already_satisfied); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __p_.set_value_at_thread_exit(__f_(_CUDA_VSTD::forward<_ArgTypes>(__args)...)); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __p_.set_exception_at_thread_exit(current_exception()); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS +} + +template +void +packaged_task<_Rp(_ArgTypes...)>::reset() +{ + if (!valid()) + __throw_future_error(future_errc::no_state); + __p_ = promise(); +} + +template +class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_AVAILABILITY_FUTURE packaged_task +{ +public: + typedef void result_type; // extension + +private: + __packaged_task_function __f_; + promise __p_; + +public: + // construction and destruction + _LIBCUDACXX_INLINE_VISIBILITY + packaged_task() noexcept : __p_(nullptr) {} + template , + packaged_task + >::value + >::type + > + _LIBCUDACXX_INLINE_VISIBILITY + explicit packaged_task(_Fp&& __f) : __f_(_CUDA_VSTD::forward<_Fp>(__f)) {} + template , + packaged_task + >::value + >::type + > + _LIBCUDACXX_INLINE_VISIBILITY + packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) + : __f_(allocator_arg, __a, _CUDA_VSTD::forward<_Fp>(__f)), + __p_(allocator_arg, __a) {} + // ~packaged_task() = default; + + // no copy + packaged_task(const packaged_task&) = delete; + packaged_task& operator=(const packaged_task&) = delete; + + // move support + _LIBCUDACXX_INLINE_VISIBILITY + packaged_task(packaged_task&& __other) noexcept + : __f_(_CUDA_VSTD::move(__other.__f_)), __p_(_CUDA_VSTD::move(__other.__p_)) {} + _LIBCUDACXX_INLINE_VISIBILITY + packaged_task& operator=(packaged_task&& __other) noexcept + { + __f_ = _CUDA_VSTD::move(__other.__f_); + __p_ = _CUDA_VSTD::move(__other.__p_); + return *this; + } + _LIBCUDACXX_INLINE_VISIBILITY + void swap(packaged_task& __other) noexcept + { + __f_.swap(__other.__f_); + __p_.swap(__other.__p_); + } + + _LIBCUDACXX_INLINE_VISIBILITY + bool valid() const noexcept {return __p_.__state_ != nullptr;} + + // result retrieval + _LIBCUDACXX_INLINE_VISIBILITY + future get_future() {return __p_.get_future();} + + // execution + void operator()(_ArgTypes... __args); + void make_ready_at_thread_exit(_ArgTypes... __args); + + void reset(); +}; + +template +void +packaged_task::operator()(_ArgTypes... __args) +{ + if (__p_.__state_ == nullptr) + __throw_future_error(future_errc::no_state); + if (__p_.__state_->__has_value()) + __throw_future_error(future_errc::promise_already_satisfied); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __f_(_CUDA_VSTD::forward<_ArgTypes>(__args)...); + __p_.set_value(); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __p_.set_exception(current_exception()); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS +} + +template +void +packaged_task::make_ready_at_thread_exit(_ArgTypes... __args) +{ + if (__p_.__state_ == nullptr) + __throw_future_error(future_errc::no_state); + if (__p_.__state_->__has_value()) + __throw_future_error(future_errc::promise_already_satisfied); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __f_(_CUDA_VSTD::forward<_ArgTypes>(__args)...); + __p_.set_value_at_thread_exit(); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __p_.set_exception_at_thread_exit(current_exception()); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS +} + +template +void +packaged_task::reset() +{ + if (!valid()) + __throw_future_error(future_errc::no_state); + __p_ = promise(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(packaged_task<_Callable>& __x, packaged_task<_Callable>& __y) noexcept +{ + __x.swap(__y); +} + +template +struct _LIBCUDACXX_TEMPLATE_VIS uses_allocator, _Alloc> + : public true_type {}; + +template +future<_Rp> +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +__make_deferred_assoc_state(_Fp&& __f) +#else +__make_deferred_assoc_state(_Fp __f) +#endif +{ + unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count> + __h(new __deferred_assoc_state<_Rp, _Fp>(_CUDA_VSTD::forward<_Fp>(__f))); + return future<_Rp>(__h.get()); +} + +template +future<_Rp> +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES +__make_async_assoc_state(_Fp&& __f) +#else +__make_async_assoc_state(_Fp __f) +#endif +{ + unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count> + __h(new __async_assoc_state<_Rp, _Fp>(_CUDA_VSTD::forward<_Fp>(__f))); + _CUDA_VSTD::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach(); + return future<_Rp>(__h.get()); +} + +template +class __async_func +{ + tuple<_Fp, _Args...> __f_; + +public: + typedef typename __invoke_of<_Fp, _Args...>::type _Rp; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __async_func(_Fp&& __f, _Args&&... __args) + : __f_(_CUDA_VSTD::move(__f), _CUDA_VSTD::move(__args)...) {} + + _LIBCUDACXX_INLINE_VISIBILITY + __async_func(__async_func&& __f) : __f_(_CUDA_VSTD::move(__f.__f_)) {} + + _Rp operator()() + { + typedef typename __make_tuple_indices<1+sizeof...(_Args), 1>::type _Index; + return __execute(_Index()); + } +private: + template + _Rp + __execute(__tuple_indices<_Indices...>) + { + return __invoke(_CUDA_VSTD::move(_CUDA_VSTD::get<0>(__f_)), _CUDA_VSTD::move(_CUDA_VSTD::get<_Indices>(__f_))...); + } +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY bool __does_policy_contain(launch __policy, launch __value ) +{ return (int(__policy) & int(__value)) != 0; } + +template +_LIBCUDACXX_NODISCARD_AFTER_CXX17 +future, __decay_t<_Args>...>::type> +async(launch __policy, _Fp&& __f, _Args&&... __args) +{ + typedef __async_func<__decay_t<_Fp>, __decay_t<_Args>...> _BF; + typedef typename _BF::_Rp _Rp; + +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif + if (__does_policy_contain(__policy, launch::async)) + return _CUDA_VSTD::__make_async_assoc_state<_Rp>(_BF(__decay_copy(_CUDA_VSTD::forward<_Fp>(__f)), + __decay_copy(_CUDA_VSTD::forward<_Args>(__args))...)); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch ( ... ) { if (__policy == launch::async) throw ; } +#endif + + if (__does_policy_contain(__policy, launch::deferred)) + return _CUDA_VSTD::__make_deferred_assoc_state<_Rp>(_BF(__decay_copy(_CUDA_VSTD::forward<_Fp>(__f)), + __decay_copy(_CUDA_VSTD::forward<_Args>(__args))...)); + return future<_Rp>{}; +} + +template +_LIBCUDACXX_NODISCARD_AFTER_CXX17 inline _LIBCUDACXX_INLINE_VISIBILITY +future, __decay_t<_Args>...>::type> +async(_Fp&& __f, _Args&&... __args) +{ + return _CUDA_VSTD::async(launch::any, _CUDA_VSTD::forward<_Fp>(__f), + _CUDA_VSTD::forward<_Args>(__args)...); +} + +#endif // _LIBCUDACXX_HAS_NO_VARIADICS + +// shared_future + +template +class _LIBCUDACXX_TEMPLATE_VIS shared_future +{ + __assoc_state<_Rp>* __state_; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + shared_future() noexcept : __state_(nullptr) {} + _LIBCUDACXX_INLINE_VISIBILITY + shared_future(const shared_future& __rhs) noexcept : __state_(__rhs.__state_) + {if (__state_) __state_->__add_shared();} +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + shared_future(future<_Rp>&& __f) noexcept : __state_(__f.__state_) + {__f.__state_ = nullptr;} + _LIBCUDACXX_INLINE_VISIBILITY + shared_future(shared_future&& __rhs) noexcept : __state_(__rhs.__state_) + {__rhs.__state_ = nullptr;} +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + ~shared_future(); + shared_future& operator=(const shared_future& __rhs) noexcept; +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + shared_future& operator=(shared_future&& __rhs) noexcept + { + shared_future(std::move(__rhs)).swap(*this); + return *this; + } +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + + // retrieving the value + _LIBCUDACXX_INLINE_VISIBILITY + const _Rp& get() const {return __state_->copy();} + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(shared_future& __rhs) noexcept {_CUDA_VSTD::swap(__state_, __rhs.__state_);} + + // functions to check state + _LIBCUDACXX_INLINE_VISIBILITY + bool valid() const noexcept {return __state_ != nullptr;} + + _LIBCUDACXX_INLINE_VISIBILITY + void wait() const {__state_->wait();} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const + {return __state_->wait_for(__rel_time);} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const + {return __state_->wait_until(__abs_time);} +}; + +template +shared_future<_Rp>::~shared_future() +{ + if (__state_) + __state_->__release_shared(); +} + +template +shared_future<_Rp>& +shared_future<_Rp>::operator=(const shared_future& __rhs) noexcept +{ + if (__rhs.__state_) + __rhs.__state_->__add_shared(); + if (__state_) + __state_->__release_shared(); + __state_ = __rhs.__state_; + return *this; +} + +template +class _LIBCUDACXX_TEMPLATE_VIS shared_future<_Rp&> +{ + __assoc_state<_Rp&>* __state_; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + shared_future() noexcept : __state_(nullptr) {} + _LIBCUDACXX_INLINE_VISIBILITY + shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) + {if (__state_) __state_->__add_shared();} +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + shared_future(future<_Rp&>&& __f) noexcept : __state_(__f.__state_) + {__f.__state_ = nullptr;} + _LIBCUDACXX_INLINE_VISIBILITY + shared_future(shared_future&& __rhs) noexcept : __state_(__rhs.__state_) + {__rhs.__state_ = nullptr;} +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + ~shared_future(); + shared_future& operator=(const shared_future& __rhs); +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + shared_future& operator=(shared_future&& __rhs) noexcept + { + shared_future(std::move(__rhs)).swap(*this); + return *this; + } +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + + // retrieving the value + _LIBCUDACXX_INLINE_VISIBILITY + _Rp& get() const {return __state_->copy();} + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(shared_future& __rhs) noexcept {_CUDA_VSTD::swap(__state_, __rhs.__state_);} + + // functions to check state + _LIBCUDACXX_INLINE_VISIBILITY + bool valid() const noexcept {return __state_ != nullptr;} + + _LIBCUDACXX_INLINE_VISIBILITY + void wait() const {__state_->wait();} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const + {return __state_->wait_for(__rel_time);} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const + {return __state_->wait_until(__abs_time);} +}; + +template +shared_future<_Rp&>::~shared_future() +{ + if (__state_) + __state_->__release_shared(); +} + +template +shared_future<_Rp&>& +shared_future<_Rp&>::operator=(const shared_future& __rhs) +{ + if (__rhs.__state_) + __rhs.__state_->__add_shared(); + if (__state_) + __state_->__release_shared(); + __state_ = __rhs.__state_; + return *this; +} + +template <> +class _LIBCUDACXX_TYPE_VIS _LIBCUDACXX_AVAILABILITY_FUTURE shared_future +{ + __assoc_sub_state* __state_; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + shared_future() noexcept : __state_(nullptr) {} + _LIBCUDACXX_INLINE_VISIBILITY + shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) + {if (__state_) __state_->__add_shared();} +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + shared_future(future&& __f) noexcept : __state_(__f.__state_) + {__f.__state_ = nullptr;} + _LIBCUDACXX_INLINE_VISIBILITY + shared_future(shared_future&& __rhs) noexcept : __state_(__rhs.__state_) + {__rhs.__state_ = nullptr;} +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + ~shared_future(); + shared_future& operator=(const shared_future& __rhs); +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + _LIBCUDACXX_INLINE_VISIBILITY + shared_future& operator=(shared_future&& __rhs) noexcept + { + shared_future(std::move(__rhs)).swap(*this); + return *this; + } +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + + // retrieving the value + _LIBCUDACXX_INLINE_VISIBILITY + void get() const {__state_->copy();} + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(shared_future& __rhs) noexcept {_CUDA_VSTD::swap(__state_, __rhs.__state_);} + + // functions to check state + _LIBCUDACXX_INLINE_VISIBILITY + bool valid() const noexcept {return __state_ != nullptr;} + + _LIBCUDACXX_INLINE_VISIBILITY + void wait() const {__state_->wait();} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const + {return __state_->wait_for(__rel_time);} + template + _LIBCUDACXX_INLINE_VISIBILITY + future_status + wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const + {return __state_->wait_until(__abs_time);} +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) noexcept +{ + __x.swap(__y); +} + +template +inline +shared_future<_Rp> +future<_Rp>::share() noexcept +{ + return shared_future<_Rp>(_CUDA_VSTD::move(*this)); +} + +template +inline +shared_future<_Rp&> +future<_Rp&>::share() noexcept +{ + return shared_future<_Rp&>(_CUDA_VSTD::move(*this)); +} + +#ifndef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +inline +shared_future +future::share() noexcept +{ + return shared_future(_CUDA_VSTD::move(*this)); +} + +#endif // _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // !_LIBCUDACXX_HAS_NO_THREADS + +#endif // _LIBCUDACXX_FUTURE diff --git a/cuda_toolkit/include/generated_cudaD3D10_meta.h b/cuda_toolkit/include/generated_cudaD3D10_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..977b7af5c15dbd709c0dedfe6bb00458d37ecfa4 --- /dev/null +++ b/cuda_toolkit/include/generated_cudaD3D10_meta.h @@ -0,0 +1,141 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// Dependent includes +#include // XP build fails in D3D10 header unless you include this first +#include + +// CUDA public interface, for type definitions and cu* function prototypes +#include "cudaD3D10.h" + + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +typedef struct cuD3D10GetDevice_params_st { + CUdevice *pCudaDevice; + IDXGIAdapter *pAdapter; +} cuD3D10GetDevice_params; + +typedef struct cuD3D10GetDevices_params_st { + unsigned int *pCudaDeviceCount; + CUdevice *pCudaDevices; + unsigned int cudaDeviceCount; + ID3D10Device *pD3D10Device; + CUd3d10DeviceList deviceList; +} cuD3D10GetDevices_params; + +typedef struct cuGraphicsD3D10RegisterResource_params_st { + CUgraphicsResource *pCudaResource; + ID3D10Resource *pD3DResource; + unsigned int Flags; +} cuGraphicsD3D10RegisterResource_params; + +typedef struct cuD3D10CtxCreate_v2_params_st { + CUcontext *pCtx; + CUdevice *pCudaDevice; + unsigned int Flags; + ID3D10Device *pD3DDevice; +} cuD3D10CtxCreate_v2_params; + +typedef struct cuD3D10CtxCreateOnDevice_params_st { + CUcontext *pCtx; + unsigned int flags; + ID3D10Device *pD3DDevice; + CUdevice cudaDevice; +} cuD3D10CtxCreateOnDevice_params; + +typedef struct cuD3D10GetDirect3DDevice_params_st { + ID3D10Device **ppD3DDevice; +} cuD3D10GetDirect3DDevice_params; + +typedef struct cuD3D10RegisterResource_params_st { + ID3D10Resource *pResource; + unsigned int Flags; +} cuD3D10RegisterResource_params; + +typedef struct cuD3D10UnregisterResource_params_st { + ID3D10Resource *pResource; +} cuD3D10UnregisterResource_params; + +typedef struct cuD3D10MapResources_params_st { + unsigned int count; + ID3D10Resource **ppResources; +} cuD3D10MapResources_params; + +typedef struct cuD3D10UnmapResources_params_st { + unsigned int count; + ID3D10Resource **ppResources; +} cuD3D10UnmapResources_params; + +typedef struct cuD3D10ResourceSetMapFlags_params_st { + ID3D10Resource *pResource; + unsigned int Flags; +} cuD3D10ResourceSetMapFlags_params; + +typedef struct cuD3D10ResourceGetMappedArray_params_st { + CUarray *pArray; + ID3D10Resource *pResource; + unsigned int SubResource; +} cuD3D10ResourceGetMappedArray_params; + +typedef struct cuD3D10ResourceGetMappedPointer_v2_params_st { + CUdeviceptr *pDevPtr; + ID3D10Resource *pResource; + unsigned int SubResource; +} cuD3D10ResourceGetMappedPointer_v2_params; + +typedef struct cuD3D10ResourceGetMappedSize_v2_params_st { + size_t *pSize; + ID3D10Resource *pResource; + unsigned int SubResource; +} cuD3D10ResourceGetMappedSize_v2_params; + +typedef struct cuD3D10ResourceGetMappedPitch_v2_params_st { + size_t *pPitch; + size_t *pPitchSlice; + ID3D10Resource *pResource; + unsigned int SubResource; +} cuD3D10ResourceGetMappedPitch_v2_params; + +typedef struct cuD3D10ResourceGetSurfaceDimensions_v2_params_st { + size_t *pWidth; + size_t *pHeight; + size_t *pDepth; + ID3D10Resource *pResource; + unsigned int SubResource; +} cuD3D10ResourceGetSurfaceDimensions_v2_params; + +typedef struct cuD3D10CtxCreate_params_st { + CUcontext *pCtx; + CUdevice *pCudaDevice; + unsigned int Flags; + ID3D10Device *pD3DDevice; +} cuD3D10CtxCreate_params; + +typedef struct cuD3D10ResourceGetMappedPitch_params_st { + unsigned int *pPitch; + unsigned int *pPitchSlice; + ID3D10Resource *pResource; + unsigned int SubResource; +} cuD3D10ResourceGetMappedPitch_params; + +typedef struct cuD3D10ResourceGetMappedPointer_params_st { + CUdeviceptr_v1 *pDevPtr; + ID3D10Resource *pResource; + unsigned int SubResource; +} cuD3D10ResourceGetMappedPointer_params; + +typedef struct cuD3D10ResourceGetMappedSize_params_st { + unsigned int *pSize; + ID3D10Resource *pResource; + unsigned int SubResource; +} cuD3D10ResourceGetMappedSize_params; + +typedef struct cuD3D10ResourceGetSurfaceDimensions_params_st { + unsigned int *pWidth; + unsigned int *pHeight; + unsigned int *pDepth; + ID3D10Resource *pResource; + unsigned int SubResource; +} cuD3D10ResourceGetSurfaceDimensions_params; diff --git a/cuda_toolkit/include/generated_cudaD3D11_meta.h b/cuda_toolkit/include/generated_cudaD3D11_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..383e45db94a8b35e19d932f65512b5599178ae40 --- /dev/null +++ b/cuda_toolkit/include/generated_cudaD3D11_meta.h @@ -0,0 +1,57 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// Dependent includes +#include // XP build fails in D3D10 header unless you include this first +#include + +// CUDA public interface, for type definitions and cu* function prototypes +#include "cudaD3D11.h" + + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +typedef struct cuD3D11GetDevice_params_st { + CUdevice *pCudaDevice; + IDXGIAdapter *pAdapter; +} cuD3D11GetDevice_params; + +typedef struct cuD3D11GetDevices_params_st { + unsigned int *pCudaDeviceCount; + CUdevice *pCudaDevices; + unsigned int cudaDeviceCount; + ID3D11Device *pD3D11Device; + CUd3d11DeviceList deviceList; +} cuD3D11GetDevices_params; + +typedef struct cuGraphicsD3D11RegisterResource_params_st { + CUgraphicsResource *pCudaResource; + ID3D11Resource *pD3DResource; + unsigned int Flags; +} cuGraphicsD3D11RegisterResource_params; + +typedef struct cuD3D11CtxCreate_v2_params_st { + CUcontext *pCtx; + CUdevice *pCudaDevice; + unsigned int Flags; + ID3D11Device *pD3DDevice; +} cuD3D11CtxCreate_v2_params; + +typedef struct cuD3D11CtxCreateOnDevice_params_st { + CUcontext *pCtx; + unsigned int flags; + ID3D11Device *pD3DDevice; + CUdevice cudaDevice; +} cuD3D11CtxCreateOnDevice_params; + +typedef struct cuD3D11GetDirect3DDevice_params_st { + ID3D11Device **ppD3DDevice; +} cuD3D11GetDirect3DDevice_params; + +typedef struct cuD3D11CtxCreate_params_st { + CUcontext *pCtx; + CUdevice *pCudaDevice; + unsigned int Flags; + ID3D11Device *pD3DDevice; +} cuD3D11CtxCreate_params; diff --git a/cuda_toolkit/include/generated_cudaD3D9_meta.h b/cuda_toolkit/include/generated_cudaD3D9_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..4afa6aba86ca4a80893bcd0c9adcc92dc366e9f4 --- /dev/null +++ b/cuda_toolkit/include/generated_cudaD3D9_meta.h @@ -0,0 +1,177 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// Dependent includes +#include + +// CUDA public interface, for type definitions and cu* function prototypes +#include "cudaD3D9.h" + + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +typedef struct cuD3D9GetDevice_params_st { + CUdevice *pCudaDevice; + const char *pszAdapterName; +} cuD3D9GetDevice_params; + +typedef struct cuD3D9GetDevices_params_st { + unsigned int *pCudaDeviceCount; + CUdevice *pCudaDevices; + unsigned int cudaDeviceCount; + IDirect3DDevice9 *pD3D9Device; + CUd3d9DeviceList deviceList; +} cuD3D9GetDevices_params; + +typedef struct cuD3D9CtxCreate_v2_params_st { + CUcontext *pCtx; + CUdevice *pCudaDevice; + unsigned int Flags; + IDirect3DDevice9 *pD3DDevice; +} cuD3D9CtxCreate_v2_params; + +typedef struct cuD3D9CtxCreateOnDevice_params_st { + CUcontext *pCtx; + unsigned int flags; + IDirect3DDevice9 *pD3DDevice; + CUdevice cudaDevice; +} cuD3D9CtxCreateOnDevice_params; + +typedef struct cuD3D9GetDirect3DDevice_params_st { + IDirect3DDevice9 **ppD3DDevice; +} cuD3D9GetDirect3DDevice_params; + +typedef struct cuGraphicsD3D9RegisterResource_params_st { + CUgraphicsResource *pCudaResource; + IDirect3DResource9 *pD3DResource; + unsigned int Flags; +} cuGraphicsD3D9RegisterResource_params; + +typedef struct cuD3D9RegisterResource_params_st { + IDirect3DResource9 *pResource; + unsigned int Flags; +} cuD3D9RegisterResource_params; + +typedef struct cuD3D9UnregisterResource_params_st { + IDirect3DResource9 *pResource; +} cuD3D9UnregisterResource_params; + +typedef struct cuD3D9MapResources_params_st { + unsigned int count; + IDirect3DResource9 **ppResource; +} cuD3D9MapResources_params; + +typedef struct cuD3D9UnmapResources_params_st { + unsigned int count; + IDirect3DResource9 **ppResource; +} cuD3D9UnmapResources_params; + +typedef struct cuD3D9ResourceSetMapFlags_params_st { + IDirect3DResource9 *pResource; + unsigned int Flags; +} cuD3D9ResourceSetMapFlags_params; + +typedef struct cuD3D9ResourceGetSurfaceDimensions_v2_params_st { + size_t *pWidth; + size_t *pHeight; + size_t *pDepth; + IDirect3DResource9 *pResource; + unsigned int Face; + unsigned int Level; +} cuD3D9ResourceGetSurfaceDimensions_v2_params; + +typedef struct cuD3D9ResourceGetMappedArray_params_st { + CUarray *pArray; + IDirect3DResource9 *pResource; + unsigned int Face; + unsigned int Level; +} cuD3D9ResourceGetMappedArray_params; + +typedef struct cuD3D9ResourceGetMappedPointer_v2_params_st { + CUdeviceptr *pDevPtr; + IDirect3DResource9 *pResource; + unsigned int Face; + unsigned int Level; +} cuD3D9ResourceGetMappedPointer_v2_params; + +typedef struct cuD3D9ResourceGetMappedSize_v2_params_st { + size_t *pSize; + IDirect3DResource9 *pResource; + unsigned int Face; + unsigned int Level; +} cuD3D9ResourceGetMappedSize_v2_params; + +typedef struct cuD3D9ResourceGetMappedPitch_v2_params_st { + size_t *pPitch; + size_t *pPitchSlice; + IDirect3DResource9 *pResource; + unsigned int Face; + unsigned int Level; +} cuD3D9ResourceGetMappedPitch_v2_params; + +typedef struct cuD3D9Begin_params_st { + IDirect3DDevice9 *pDevice; +} cuD3D9Begin_params; + +typedef struct cuD3D9RegisterVertexBuffer_params_st { + IDirect3DVertexBuffer9 *pVB; +} cuD3D9RegisterVertexBuffer_params; + +typedef struct cuD3D9MapVertexBuffer_v2_params_st { + CUdeviceptr *pDevPtr; + size_t *pSize; + IDirect3DVertexBuffer9 *pVB; +} cuD3D9MapVertexBuffer_v2_params; + +typedef struct cuD3D9UnmapVertexBuffer_params_st { + IDirect3DVertexBuffer9 *pVB; +} cuD3D9UnmapVertexBuffer_params; + +typedef struct cuD3D9UnregisterVertexBuffer_params_st { + IDirect3DVertexBuffer9 *pVB; +} cuD3D9UnregisterVertexBuffer_params; + +typedef struct cuD3D9CtxCreate_params_st { + CUcontext *pCtx; + CUdevice *pCudaDevice; + unsigned int Flags; + IDirect3DDevice9 *pD3DDevice; +} cuD3D9CtxCreate_params; + +typedef struct cuD3D9ResourceGetSurfaceDimensions_params_st { + unsigned int *pWidth; + unsigned int *pHeight; + unsigned int *pDepth; + IDirect3DResource9 *pResource; + unsigned int Face; + unsigned int Level; +} cuD3D9ResourceGetSurfaceDimensions_params; + +typedef struct cuD3D9ResourceGetMappedPointer_params_st { + CUdeviceptr_v1 *pDevPtr; + IDirect3DResource9 *pResource; + unsigned int Face; + unsigned int Level; +} cuD3D9ResourceGetMappedPointer_params; + +typedef struct cuD3D9ResourceGetMappedSize_params_st { + unsigned int *pSize; + IDirect3DResource9 *pResource; + unsigned int Face; + unsigned int Level; +} cuD3D9ResourceGetMappedSize_params; + +typedef struct cuD3D9ResourceGetMappedPitch_params_st { + unsigned int *pPitch; + unsigned int *pPitchSlice; + IDirect3DResource9 *pResource; + unsigned int Face; + unsigned int Level; +} cuD3D9ResourceGetMappedPitch_params; + +typedef struct cuD3D9MapVertexBuffer_params_st { + CUdeviceptr_v1 *pDevPtr; + unsigned int *pSize; + IDirect3DVertexBuffer9 *pVB; +} cuD3D9MapVertexBuffer_params; diff --git a/cuda_toolkit/include/generated_cudaGL_meta.h b/cuda_toolkit/include/generated_cudaGL_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..0659b99ad01a7eadb0e8358f9cd6a4639082fd4d --- /dev/null +++ b/cuda_toolkit/include/generated_cudaGL_meta.h @@ -0,0 +1,121 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// Dependent includes +#ifdef __APPLE__ +#include +#else +#include +#endif + +// CUDA public interface, for type definitions and cu* function prototypes +#include "cudaGL.h" + + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +typedef struct cuGraphicsGLRegisterBuffer_params_st { + CUgraphicsResource *pCudaResource; + GLuint buffer; + unsigned int Flags; +} cuGraphicsGLRegisterBuffer_params; + +typedef struct cuGraphicsGLRegisterImage_params_st { + CUgraphicsResource *pCudaResource; + GLuint image; + GLenum target; + unsigned int Flags; +} cuGraphicsGLRegisterImage_params; + +typedef struct cuWGLGetDevice_params_st { + CUdevice *pDevice; + HGPUNV hGpu; +} cuWGLGetDevice_params; + +typedef struct cuGLGetDevices_v2_params_st { + unsigned int *pCudaDeviceCount; + CUdevice *pCudaDevices; + unsigned int cudaDeviceCount; + CUGLDeviceList deviceList; +} cuGLGetDevices_v2_params; + +typedef struct cuGLCtxCreate_v2_params_st { + CUcontext *pCtx; + unsigned int Flags; + CUdevice device; +} cuGLCtxCreate_v2_params; + +typedef struct cuGLRegisterBufferObject_params_st { + GLuint buffer; +} cuGLRegisterBufferObject_params; + +typedef struct cuGLMapBufferObject_v2_ptds_params_st { + CUdeviceptr *dptr; + size_t *size; + GLuint buffer; +} cuGLMapBufferObject_v2_ptds_params; + +typedef struct cuGLUnmapBufferObject_params_st { + GLuint buffer; +} cuGLUnmapBufferObject_params; + +typedef struct cuGLUnregisterBufferObject_params_st { + GLuint buffer; +} cuGLUnregisterBufferObject_params; + +typedef struct cuGLSetBufferObjectMapFlags_params_st { + GLuint buffer; + unsigned int Flags; +} cuGLSetBufferObjectMapFlags_params; + +typedef struct cuGLMapBufferObjectAsync_v2_ptsz_params_st { + CUdeviceptr *dptr; + size_t *size; + GLuint buffer; + CUstream hStream; +} cuGLMapBufferObjectAsync_v2_ptsz_params; + +typedef struct cuGLUnmapBufferObjectAsync_params_st { + GLuint buffer; + CUstream hStream; +} cuGLUnmapBufferObjectAsync_params; + +typedef struct cuGLGetDevices_params_st { + unsigned int *pCudaDeviceCount; + CUdevice *pCudaDevices; + unsigned int cudaDeviceCount; + CUGLDeviceList deviceList; +} cuGLGetDevices_params; + +typedef struct cuGLMapBufferObject_v2_params_st { + CUdeviceptr *dptr; + size_t *size; + GLuint buffer; +} cuGLMapBufferObject_v2_params; + +typedef struct cuGLMapBufferObjectAsync_v2_params_st { + CUdeviceptr *dptr; + size_t *size; + GLuint buffer; + CUstream hStream; +} cuGLMapBufferObjectAsync_v2_params; + +typedef struct cuGLCtxCreate_params_st { + CUcontext *pCtx; + unsigned int Flags; + CUdevice device; +} cuGLCtxCreate_params; + +typedef struct cuGLMapBufferObject_params_st { + CUdeviceptr_v1 *dptr; + unsigned int *size; + GLuint buffer; +} cuGLMapBufferObject_params; + +typedef struct cuGLMapBufferObjectAsync_params_st { + CUdeviceptr_v1 *dptr; + unsigned int *size; + GLuint buffer; + CUstream hStream; +} cuGLMapBufferObjectAsync_params; diff --git a/cuda_toolkit/include/generated_cuda_d3d10_interop_meta.h b/cuda_toolkit/include/generated_cuda_d3d10_interop_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..e7e88067e60eb126dc7c019a61c1bf4d79f71ba7 --- /dev/null +++ b/cuda_toolkit/include/generated_cuda_d3d10_interop_meta.h @@ -0,0 +1,99 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// CUDA public interface, for type definitions and api function prototypes +#include "cuda_d3d10_interop.h" + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +// Currently used parameter trace structures +typedef struct cudaGraphicsD3D10RegisterResource_v3020_params_st { + struct cudaGraphicsResource **resource; + ID3D10Resource *pD3DResource; + unsigned int flags; +} cudaGraphicsD3D10RegisterResource_v3020_params; + +typedef struct cudaD3D10GetDevice_v3020_params_st { + int *device; + IDXGIAdapter *pAdapter; +} cudaD3D10GetDevice_v3020_params; + +typedef struct cudaD3D10GetDevices_v3020_params_st { + unsigned int *pCudaDeviceCount; + int *pCudaDevices; + unsigned int cudaDeviceCount; + ID3D10Device *pD3D10Device; + enum cudaD3D10DeviceList deviceList; +} cudaD3D10GetDevices_v3020_params; + +typedef struct cudaD3D10GetDirect3DDevice_v3020_params_st { + ID3D10Device **ppD3D10Device; +} cudaD3D10GetDirect3DDevice_v3020_params; + +typedef struct cudaD3D10SetDirect3DDevice_v3020_params_st { + ID3D10Device *pD3D10Device; + int device; +} cudaD3D10SetDirect3DDevice_v3020_params; + +typedef struct cudaD3D10RegisterResource_v3020_params_st { + ID3D10Resource *pResource; + unsigned int flags; +} cudaD3D10RegisterResource_v3020_params; + +typedef struct cudaD3D10UnregisterResource_v3020_params_st { + ID3D10Resource *pResource; +} cudaD3D10UnregisterResource_v3020_params; + +typedef struct cudaD3D10MapResources_v3020_params_st { + int count; + ID3D10Resource **ppResources; +} cudaD3D10MapResources_v3020_params; + +typedef struct cudaD3D10UnmapResources_v3020_params_st { + int count; + ID3D10Resource **ppResources; +} cudaD3D10UnmapResources_v3020_params; + +typedef struct cudaD3D10ResourceGetMappedArray_v3020_params_st { + cudaArray **ppArray; + ID3D10Resource *pResource; + unsigned int subResource; +} cudaD3D10ResourceGetMappedArray_v3020_params; + +typedef struct cudaD3D10ResourceSetMapFlags_v3020_params_st { + ID3D10Resource *pResource; + unsigned int flags; +} cudaD3D10ResourceSetMapFlags_v3020_params; + +typedef struct cudaD3D10ResourceGetSurfaceDimensions_v3020_params_st { + size_t *pWidth; + size_t *pHeight; + size_t *pDepth; + ID3D10Resource *pResource; + unsigned int subResource; +} cudaD3D10ResourceGetSurfaceDimensions_v3020_params; + +typedef struct cudaD3D10ResourceGetMappedPointer_v3020_params_st { + void **pPointer; + ID3D10Resource *pResource; + unsigned int subResource; +} cudaD3D10ResourceGetMappedPointer_v3020_params; + +typedef struct cudaD3D10ResourceGetMappedSize_v3020_params_st { + size_t *pSize; + ID3D10Resource *pResource; + unsigned int subResource; +} cudaD3D10ResourceGetMappedSize_v3020_params; + +typedef struct cudaD3D10ResourceGetMappedPitch_v3020_params_st { + size_t *pPitch; + size_t *pPitchSlice; + ID3D10Resource *pResource; + unsigned int subResource; +} cudaD3D10ResourceGetMappedPitch_v3020_params; + +// Parameter trace structures for removed functions + + +// End of parameter trace structures diff --git a/cuda_toolkit/include/generated_cuda_d3d11_interop_meta.h b/cuda_toolkit/include/generated_cuda_d3d11_interop_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..ab88a38c0357b157865ed898a8de2363ee46df69 --- /dev/null +++ b/cuda_toolkit/include/generated_cuda_d3d11_interop_meta.h @@ -0,0 +1,42 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// CUDA public interface, for type definitions and api function prototypes +#include "cuda_d3d11_interop.h" + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +// Currently used parameter trace structures +typedef struct cudaGraphicsD3D11RegisterResource_v3020_params_st { + struct cudaGraphicsResource **resource; + ID3D11Resource *pD3DResource; + unsigned int flags; +} cudaGraphicsD3D11RegisterResource_v3020_params; + +typedef struct cudaD3D11GetDevice_v3020_params_st { + int *device; + IDXGIAdapter *pAdapter; +} cudaD3D11GetDevice_v3020_params; + +typedef struct cudaD3D11GetDevices_v3020_params_st { + unsigned int *pCudaDeviceCount; + int *pCudaDevices; + unsigned int cudaDeviceCount; + ID3D11Device *pD3D11Device; + enum cudaD3D11DeviceList deviceList; +} cudaD3D11GetDevices_v3020_params; + +typedef struct cudaD3D11GetDirect3DDevice_v3020_params_st { + ID3D11Device **ppD3D11Device; +} cudaD3D11GetDirect3DDevice_v3020_params; + +typedef struct cudaD3D11SetDirect3DDevice_v3020_params_st { + ID3D11Device *pD3D11Device; + int device; +} cudaD3D11SetDirect3DDevice_v3020_params; + +// Parameter trace structures for removed functions + + +// End of parameter trace structures diff --git a/cuda_toolkit/include/generated_cuda_d3d9_interop_meta.h b/cuda_toolkit/include/generated_cuda_d3d9_interop_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..b8becb2261c49b0a8bb4323b0534debcc129af27 --- /dev/null +++ b/cuda_toolkit/include/generated_cuda_d3d9_interop_meta.h @@ -0,0 +1,125 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// CUDA public interface, for type definitions and api function prototypes +#include "cuda_d3d9_interop.h" + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +// Currently used parameter trace structures +typedef struct cudaD3D9GetDirect3DDevice_v3020_params_st { + IDirect3DDevice9 **ppD3D9Device; +} cudaD3D9GetDirect3DDevice_v3020_params; + +typedef struct cudaGraphicsD3D9RegisterResource_v3020_params_st { + struct cudaGraphicsResource **resource; + IDirect3DResource9 *pD3DResource; + unsigned int flags; +} cudaGraphicsD3D9RegisterResource_v3020_params; + +typedef struct cudaD3D9GetDevice_v3020_params_st { + int *device; + const char *pszAdapterName; +} cudaD3D9GetDevice_v3020_params; + +typedef struct cudaD3D9GetDevices_v3020_params_st { + unsigned int *pCudaDeviceCount; + int *pCudaDevices; + unsigned int cudaDeviceCount; + IDirect3DDevice9 *pD3D9Device; + enum cudaD3D9DeviceList deviceList; +} cudaD3D9GetDevices_v3020_params; + +typedef struct cudaD3D9SetDirect3DDevice_v3020_params_st { + IDirect3DDevice9 *pD3D9Device; + int device; +} cudaD3D9SetDirect3DDevice_v3020_params; + +typedef struct cudaD3D9RegisterResource_v3020_params_st { + IDirect3DResource9 *pResource; + unsigned int flags; +} cudaD3D9RegisterResource_v3020_params; + +typedef struct cudaD3D9UnregisterResource_v3020_params_st { + IDirect3DResource9 *pResource; +} cudaD3D9UnregisterResource_v3020_params; + +typedef struct cudaD3D9MapResources_v3020_params_st { + int count; + IDirect3DResource9 **ppResources; +} cudaD3D9MapResources_v3020_params; + +typedef struct cudaD3D9UnmapResources_v3020_params_st { + int count; + IDirect3DResource9 **ppResources; +} cudaD3D9UnmapResources_v3020_params; + +typedef struct cudaD3D9ResourceSetMapFlags_v3020_params_st { + IDirect3DResource9 *pResource; + unsigned int flags; +} cudaD3D9ResourceSetMapFlags_v3020_params; + +typedef struct cudaD3D9ResourceGetSurfaceDimensions_v3020_params_st { + size_t *pWidth; + size_t *pHeight; + size_t *pDepth; + IDirect3DResource9 *pResource; + unsigned int face; + unsigned int level; +} cudaD3D9ResourceGetSurfaceDimensions_v3020_params; + +typedef struct cudaD3D9ResourceGetMappedArray_v3020_params_st { + cudaArray **ppArray; + IDirect3DResource9 *pResource; + unsigned int face; + unsigned int level; +} cudaD3D9ResourceGetMappedArray_v3020_params; + +typedef struct cudaD3D9ResourceGetMappedPointer_v3020_params_st { + void **pPointer; + IDirect3DResource9 *pResource; + unsigned int face; + unsigned int level; +} cudaD3D9ResourceGetMappedPointer_v3020_params; + +typedef struct cudaD3D9ResourceGetMappedSize_v3020_params_st { + size_t *pSize; + IDirect3DResource9 *pResource; + unsigned int face; + unsigned int level; +} cudaD3D9ResourceGetMappedSize_v3020_params; + +typedef struct cudaD3D9ResourceGetMappedPitch_v3020_params_st { + size_t *pPitch; + size_t *pPitchSlice; + IDirect3DResource9 *pResource; + unsigned int face; + unsigned int level; +} cudaD3D9ResourceGetMappedPitch_v3020_params; + +typedef struct cudaD3D9Begin_v3020_params_st { + IDirect3DDevice9 *pDevice; +} cudaD3D9Begin_v3020_params; + +typedef struct cudaD3D9RegisterVertexBuffer_v3020_params_st { + IDirect3DVertexBuffer9 *pVB; +} cudaD3D9RegisterVertexBuffer_v3020_params; + +typedef struct cudaD3D9UnregisterVertexBuffer_v3020_params_st { + IDirect3DVertexBuffer9 *pVB; +} cudaD3D9UnregisterVertexBuffer_v3020_params; + +typedef struct cudaD3D9MapVertexBuffer_v3020_params_st { + void **dptr; + IDirect3DVertexBuffer9 *pVB; +} cudaD3D9MapVertexBuffer_v3020_params; + +typedef struct cudaD3D9UnmapVertexBuffer_v3020_params_st { + IDirect3DVertexBuffer9 *pVB; +} cudaD3D9UnmapVertexBuffer_v3020_params; + +// Parameter trace structures for removed functions + + +// End of parameter trace structures diff --git a/cuda_toolkit/include/generated_cuda_gl_interop_meta.h b/cuda_toolkit/include/generated_cuda_gl_interop_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..f9f41a66debd20745ea31e3d9275506c91bb4cfa --- /dev/null +++ b/cuda_toolkit/include/generated_cuda_gl_interop_meta.h @@ -0,0 +1,78 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// CUDA public interface, for type definitions and api function prototypes +#include "cuda_gl_interop.h" + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +// Currently used parameter trace structures +typedef struct cudaGLGetDevices_v4010_params_st { + unsigned int *pCudaDeviceCount; + int *pCudaDevices; + unsigned int cudaDeviceCount; + enum cudaGLDeviceList deviceList; +} cudaGLGetDevices_v4010_params; + +typedef struct cudaGraphicsGLRegisterImage_v3020_params_st { + struct cudaGraphicsResource **resource; + GLuint image; + GLenum target; + unsigned int flags; +} cudaGraphicsGLRegisterImage_v3020_params; + +typedef struct cudaGraphicsGLRegisterBuffer_v3020_params_st { + struct cudaGraphicsResource **resource; + GLuint buffer; + unsigned int flags; +} cudaGraphicsGLRegisterBuffer_v3020_params; + +#if defined(_WIN32) +typedef struct cudaWGLGetDevice_v3020_params_st { + int *device; + HGPUNV hGpu; +} cudaWGLGetDevice_v3020_params; +#endif // defined(_WIN32) + +typedef struct cudaGLSetGLDevice_v3020_params_st { + int device; +} cudaGLSetGLDevice_v3020_params; + +typedef struct cudaGLRegisterBufferObject_v3020_params_st { + GLuint bufObj; +} cudaGLRegisterBufferObject_v3020_params; + +typedef struct cudaGLMapBufferObject_v3020_params_st { + void **devPtr; + GLuint bufObj; +} cudaGLMapBufferObject_v3020_params; + +typedef struct cudaGLUnmapBufferObject_v3020_params_st { + GLuint bufObj; +} cudaGLUnmapBufferObject_v3020_params; + +typedef struct cudaGLUnregisterBufferObject_v3020_params_st { + GLuint bufObj; +} cudaGLUnregisterBufferObject_v3020_params; + +typedef struct cudaGLSetBufferObjectMapFlags_v3020_params_st { + GLuint bufObj; + unsigned int flags; +} cudaGLSetBufferObjectMapFlags_v3020_params; + +typedef struct cudaGLMapBufferObjectAsync_v3020_params_st { + void **devPtr; + GLuint bufObj; + cudaStream_t stream; +} cudaGLMapBufferObjectAsync_v3020_params; + +typedef struct cudaGLUnmapBufferObjectAsync_v3020_params_st { + GLuint bufObj; + cudaStream_t stream; +} cudaGLUnmapBufferObjectAsync_v3020_params; + +// Parameter trace structures for removed functions + + +// End of parameter trace structures diff --git a/cuda_toolkit/include/generated_cuda_meta.h b/cuda_toolkit/include/generated_cuda_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..bdfbc6835f73625b3ae504b800e7f89e9d931741 --- /dev/null +++ b/cuda_toolkit/include/generated_cuda_meta.h @@ -0,0 +1,3181 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// No dependent includes + +// CUDA public interface, for type definitions and cu* function prototypes +#include "cuda.h" + + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +typedef struct cuGetErrorString_params_st { + CUresult error; + const char **pStr; +} cuGetErrorString_params; + +typedef struct cuGetErrorName_params_st { + CUresult error; + const char **pStr; +} cuGetErrorName_params; + +typedef struct cuInit_params_st { + unsigned int Flags; +} cuInit_params; + +typedef struct cuDriverGetVersion_params_st { + int *driverVersion; +} cuDriverGetVersion_params; + +typedef struct cuDeviceGet_params_st { + CUdevice *device; + int ordinal; +} cuDeviceGet_params; + +typedef struct cuDeviceGetCount_params_st { + int *count; +} cuDeviceGetCount_params; + +typedef struct cuDeviceGetName_params_st { + char *name; + int len; + CUdevice dev; +} cuDeviceGetName_params; + +typedef struct cuDeviceGetUuid_params_st { + CUuuid *uuid; + CUdevice dev; +} cuDeviceGetUuid_params; + +typedef struct cuDeviceGetUuid_v2_params_st { + CUuuid *uuid; + CUdevice dev; +} cuDeviceGetUuid_v2_params; + +typedef struct cuDeviceGetLuid_params_st { + char *luid; + unsigned int *deviceNodeMask; + CUdevice dev; +} cuDeviceGetLuid_params; + +typedef struct cuDeviceTotalMem_v2_params_st { + size_t *bytes; + CUdevice dev; +} cuDeviceTotalMem_v2_params; + +typedef struct cuDeviceGetTexture1DLinearMaxWidth_params_st { + size_t *maxWidthInElements; + CUarray_format format; + unsigned numChannels; + CUdevice dev; +} cuDeviceGetTexture1DLinearMaxWidth_params; + +typedef struct cuDeviceGetAttribute_params_st { + int *pi; + CUdevice_attribute attrib; + CUdevice dev; +} cuDeviceGetAttribute_params; + +typedef struct cuDeviceGetNvSciSyncAttributes_params_st { + void *nvSciSyncAttrList; + CUdevice dev; + int flags; +} cuDeviceGetNvSciSyncAttributes_params; + +typedef struct cuDeviceSetMemPool_params_st { + CUdevice dev; + CUmemoryPool pool; +} cuDeviceSetMemPool_params; + +typedef struct cuDeviceGetMemPool_params_st { + CUmemoryPool *pool; + CUdevice dev; +} cuDeviceGetMemPool_params; + +typedef struct cuDeviceGetDefaultMemPool_params_st { + CUmemoryPool *pool_out; + CUdevice dev; +} cuDeviceGetDefaultMemPool_params; + +typedef struct cuDeviceGetExecAffinitySupport_params_st { + int *pi; + CUexecAffinityType type; + CUdevice dev; +} cuDeviceGetExecAffinitySupport_params; + +typedef struct cuFlushGPUDirectRDMAWrites_params_st { + CUflushGPUDirectRDMAWritesTarget target; + CUflushGPUDirectRDMAWritesScope scope; +} cuFlushGPUDirectRDMAWrites_params; + +typedef struct cuDeviceGetProperties_params_st { + CUdevprop *prop; + CUdevice dev; +} cuDeviceGetProperties_params; + +typedef struct cuDeviceComputeCapability_params_st { + int *major; + int *minor; + CUdevice dev; +} cuDeviceComputeCapability_params; + +typedef struct cuDevicePrimaryCtxRetain_params_st { + CUcontext *pctx; + CUdevice dev; +} cuDevicePrimaryCtxRetain_params; + +typedef struct cuDevicePrimaryCtxRelease_v2_params_st { + CUdevice dev; +} cuDevicePrimaryCtxRelease_v2_params; + +typedef struct cuDevicePrimaryCtxSetFlags_v2_params_st { + CUdevice dev; + unsigned int flags; +} cuDevicePrimaryCtxSetFlags_v2_params; + +typedef struct cuDevicePrimaryCtxGetState_params_st { + CUdevice dev; + unsigned int *flags; + int *active; +} cuDevicePrimaryCtxGetState_params; + +typedef struct cuDevicePrimaryCtxReset_v2_params_st { + CUdevice dev; +} cuDevicePrimaryCtxReset_v2_params; + +typedef struct cuCtxCreate_v2_params_st { + CUcontext *pctx; + unsigned int flags; + CUdevice dev; +} cuCtxCreate_v2_params; + +typedef struct cuCtxCreate_v3_params_st { + CUcontext *pctx; + CUexecAffinityParam *paramsArray; + int numParams; + unsigned int flags; + CUdevice dev; +} cuCtxCreate_v3_params; + +typedef struct cuCtxDestroy_v2_params_st { + CUcontext ctx; +} cuCtxDestroy_v2_params; + +typedef struct cuCtxPushCurrent_v2_params_st { + CUcontext ctx; +} cuCtxPushCurrent_v2_params; + +typedef struct cuCtxPopCurrent_v2_params_st { + CUcontext *pctx; +} cuCtxPopCurrent_v2_params; + +typedef struct cuCtxSetCurrent_params_st { + CUcontext ctx; +} cuCtxSetCurrent_params; + +typedef struct cuCtxGetCurrent_params_st { + CUcontext *pctx; +} cuCtxGetCurrent_params; + +typedef struct cuCtxGetDevice_params_st { + CUdevice *device; +} cuCtxGetDevice_params; + +typedef struct cuCtxGetFlags_params_st { + unsigned int *flags; +} cuCtxGetFlags_params; + +typedef struct cuCtxGetId_params_st { + CUcontext ctx; + unsigned long long *ctxId; +} cuCtxGetId_params; + +typedef struct cuCtxSetLimit_params_st { + CUlimit limit; + size_t value; +} cuCtxSetLimit_params; + +typedef struct cuCtxGetLimit_params_st { + size_t *pvalue; + CUlimit limit; +} cuCtxGetLimit_params; + +typedef struct cuCtxGetCacheConfig_params_st { + CUfunc_cache *pconfig; +} cuCtxGetCacheConfig_params; + +typedef struct cuCtxSetCacheConfig_params_st { + CUfunc_cache config; +} cuCtxSetCacheConfig_params; + +typedef struct cuCtxGetSharedMemConfig_params_st { + CUsharedconfig *pConfig; +} cuCtxGetSharedMemConfig_params; + +typedef struct cuCtxSetSharedMemConfig_params_st { + CUsharedconfig config; +} cuCtxSetSharedMemConfig_params; + +typedef struct cuCtxGetApiVersion_params_st { + CUcontext ctx; + unsigned int *version; +} cuCtxGetApiVersion_params; + +typedef struct cuCtxGetStreamPriorityRange_params_st { + int *leastPriority; + int *greatestPriority; +} cuCtxGetStreamPriorityRange_params; + +typedef struct cuCtxGetExecAffinity_params_st { + CUexecAffinityParam *pExecAffinity; + CUexecAffinityType type; +} cuCtxGetExecAffinity_params; + +typedef struct cuCtxAttach_params_st { + CUcontext *pctx; + unsigned int flags; +} cuCtxAttach_params; + +typedef struct cuCtxDetach_params_st { + CUcontext ctx; +} cuCtxDetach_params; + +typedef struct cuModuleLoad_params_st { + CUmodule *module; + const char *fname; +} cuModuleLoad_params; + +typedef struct cuModuleLoadData_params_st { + CUmodule *module; + const void *image; +} cuModuleLoadData_params; + +typedef struct cuModuleLoadDataEx_params_st { + CUmodule *module; + const void *image; + unsigned int numOptions; + CUjit_option *options; + void **optionValues; +} cuModuleLoadDataEx_params; + +typedef struct cuModuleLoadFatBinary_params_st { + CUmodule *module; + const void *fatCubin; +} cuModuleLoadFatBinary_params; + +typedef struct cuModuleUnload_params_st { + CUmodule hmod; +} cuModuleUnload_params; + +typedef struct cuModuleGetLoadingMode_params_st { + CUmoduleLoadingMode *mode; +} cuModuleGetLoadingMode_params; + +typedef struct cuModuleGetFunction_params_st { + CUfunction *hfunc; + CUmodule hmod; + const char *name; +} cuModuleGetFunction_params; + +typedef struct cuModuleGetGlobal_v2_params_st { + CUdeviceptr *dptr; + size_t *bytes; + CUmodule hmod; + const char *name; +} cuModuleGetGlobal_v2_params; + +typedef struct cuLinkCreate_v2_params_st { + unsigned int numOptions; + CUjit_option *options; + void **optionValues; + CUlinkState *stateOut; +} cuLinkCreate_v2_params; + +typedef struct cuLinkAddData_v2_params_st { + CUlinkState state; + CUjitInputType type; + void *data; + size_t size; + const char *name; + unsigned int numOptions; + CUjit_option *options; + void **optionValues; +} cuLinkAddData_v2_params; + +typedef struct cuLinkAddFile_v2_params_st { + CUlinkState state; + CUjitInputType type; + const char *path; + unsigned int numOptions; + CUjit_option *options; + void **optionValues; +} cuLinkAddFile_v2_params; + +typedef struct cuLinkComplete_params_st { + CUlinkState state; + void **cubinOut; + size_t *sizeOut; +} cuLinkComplete_params; + +typedef struct cuLinkDestroy_params_st { + CUlinkState state; +} cuLinkDestroy_params; + +typedef struct cuModuleGetTexRef_params_st { + CUtexref *pTexRef; + CUmodule hmod; + const char *name; +} cuModuleGetTexRef_params; + +typedef struct cuModuleGetSurfRef_params_st { + CUsurfref *pSurfRef; + CUmodule hmod; + const char *name; +} cuModuleGetSurfRef_params; + +typedef struct cuLibraryLoadData_params_st { + CUlibrary *library; + const void *code; + CUjit_option *jitOptions; + void **jitOptionsValues; + unsigned int numJitOptions; + CUlibraryOption *libraryOptions; + void **libraryOptionValues; + unsigned int numLibraryOptions; +} cuLibraryLoadData_params; + +typedef struct cuLibraryLoadFromFile_params_st { + CUlibrary *library; + const char *fileName; + CUjit_option *jitOptions; + void **jitOptionsValues; + unsigned int numJitOptions; + CUlibraryOption *libraryOptions; + void **libraryOptionValues; + unsigned int numLibraryOptions; +} cuLibraryLoadFromFile_params; + +typedef struct cuLibraryUnload_params_st { + CUlibrary library; +} cuLibraryUnload_params; + +typedef struct cuLibraryGetKernel_params_st { + CUkernel *pKernel; + CUlibrary library; + const char *name; +} cuLibraryGetKernel_params; + +typedef struct cuLibraryGetModule_params_st { + CUmodule *pMod; + CUlibrary library; +} cuLibraryGetModule_params; + +typedef struct cuKernelGetFunction_params_st { + CUfunction *pFunc; + CUkernel kernel; +} cuKernelGetFunction_params; + +typedef struct cuLibraryGetGlobal_params_st { + CUdeviceptr *dptr; + size_t *bytes; + CUlibrary library; + const char *name; +} cuLibraryGetGlobal_params; + +typedef struct cuLibraryGetManaged_params_st { + CUdeviceptr *dptr; + size_t *bytes; + CUlibrary library; + const char *name; +} cuLibraryGetManaged_params; + +typedef struct cuLibraryGetUnifiedFunction_params_st { + void **fptr; + CUlibrary library; + const char *symbol; +} cuLibraryGetUnifiedFunction_params; + +typedef struct cuKernelGetAttribute_params_st { + int *pi; + CUfunction_attribute attrib; + CUkernel kernel; + CUdevice dev; +} cuKernelGetAttribute_params; + +typedef struct cuKernelSetAttribute_params_st { + CUfunction_attribute attrib; + int val; + CUkernel kernel; + CUdevice dev; +} cuKernelSetAttribute_params; + +typedef struct cuKernelSetCacheConfig_params_st { + CUkernel kernel; + CUfunc_cache config; + CUdevice dev; +} cuKernelSetCacheConfig_params; + +typedef struct cuMemGetInfo_v2_params_st { + size_t *free; + size_t *total; +} cuMemGetInfo_v2_params; + +typedef struct cuMemAlloc_v2_params_st { + CUdeviceptr *dptr; + size_t bytesize; +} cuMemAlloc_v2_params; + +typedef struct cuMemAllocPitch_v2_params_st { + CUdeviceptr *dptr; + size_t *pPitch; + size_t WidthInBytes; + size_t Height; + unsigned int ElementSizeBytes; +} cuMemAllocPitch_v2_params; + +typedef struct cuMemFree_v2_params_st { + CUdeviceptr dptr; +} cuMemFree_v2_params; + +typedef struct cuMemGetAddressRange_v2_params_st { + CUdeviceptr *pbase; + size_t *psize; + CUdeviceptr dptr; +} cuMemGetAddressRange_v2_params; + +typedef struct cuMemAllocHost_v2_params_st { + void **pp; + size_t bytesize; +} cuMemAllocHost_v2_params; + +typedef struct cuMemFreeHost_params_st { + void *p; +} cuMemFreeHost_params; + +typedef struct cuMemHostAlloc_params_st { + void **pp; + size_t bytesize; + unsigned int Flags; +} cuMemHostAlloc_params; + +typedef struct cuMemHostGetDevicePointer_v2_params_st { + CUdeviceptr *pdptr; + void *p; + unsigned int Flags; +} cuMemHostGetDevicePointer_v2_params; + +typedef struct cuMemHostGetFlags_params_st { + unsigned int *pFlags; + void *p; +} cuMemHostGetFlags_params; + +typedef struct cuMemAllocManaged_params_st { + CUdeviceptr *dptr; + size_t bytesize; + unsigned int flags; +} cuMemAllocManaged_params; + +typedef struct cuDeviceGetByPCIBusId_params_st { + CUdevice *dev; + const char *pciBusId; +} cuDeviceGetByPCIBusId_params; + +typedef struct cuDeviceGetPCIBusId_params_st { + char *pciBusId; + int len; + CUdevice dev; +} cuDeviceGetPCIBusId_params; + +typedef struct cuIpcGetEventHandle_params_st { + CUipcEventHandle *pHandle; + CUevent event; +} cuIpcGetEventHandle_params; + +typedef struct cuIpcOpenEventHandle_params_st { + CUevent *phEvent; + CUipcEventHandle handle; +} cuIpcOpenEventHandle_params; + +typedef struct cuIpcGetMemHandle_params_st { + CUipcMemHandle *pHandle; + CUdeviceptr dptr; +} cuIpcGetMemHandle_params; + +typedef struct cuIpcOpenMemHandle_v2_params_st { + CUdeviceptr *pdptr; + CUipcMemHandle handle; + unsigned int Flags; +} cuIpcOpenMemHandle_v2_params; + +typedef struct cuIpcCloseMemHandle_params_st { + CUdeviceptr dptr; +} cuIpcCloseMemHandle_params; + +typedef struct cuMemHostRegister_v2_params_st { + void *p; + size_t bytesize; + unsigned int Flags; +} cuMemHostRegister_v2_params; + +typedef struct cuMemHostUnregister_params_st { + void *p; +} cuMemHostUnregister_params; + +typedef struct cuMemcpy_ptds_params_st { + CUdeviceptr dst; + CUdeviceptr src; + size_t ByteCount; +} cuMemcpy_ptds_params; + +typedef struct cuMemcpyPeer_ptds_params_st { + CUdeviceptr dstDevice; + CUcontext dstContext; + CUdeviceptr srcDevice; + CUcontext srcContext; + size_t ByteCount; +} cuMemcpyPeer_ptds_params; + +typedef struct cuMemcpyHtoD_v2_ptds_params_st { + CUdeviceptr dstDevice; + const void *srcHost; + size_t ByteCount; +} cuMemcpyHtoD_v2_ptds_params; + +typedef struct cuMemcpyDtoH_v2_ptds_params_st { + void *dstHost; + CUdeviceptr srcDevice; + size_t ByteCount; +} cuMemcpyDtoH_v2_ptds_params; + +typedef struct cuMemcpyDtoD_v2_ptds_params_st { + CUdeviceptr dstDevice; + CUdeviceptr srcDevice; + size_t ByteCount; +} cuMemcpyDtoD_v2_ptds_params; + +typedef struct cuMemcpyDtoA_v2_ptds_params_st { + CUarray dstArray; + size_t dstOffset; + CUdeviceptr srcDevice; + size_t ByteCount; +} cuMemcpyDtoA_v2_ptds_params; + +typedef struct cuMemcpyAtoD_v2_ptds_params_st { + CUdeviceptr dstDevice; + CUarray srcArray; + size_t srcOffset; + size_t ByteCount; +} cuMemcpyAtoD_v2_ptds_params; + +typedef struct cuMemcpyHtoA_v2_ptds_params_st { + CUarray dstArray; + size_t dstOffset; + const void *srcHost; + size_t ByteCount; +} cuMemcpyHtoA_v2_ptds_params; + +typedef struct cuMemcpyAtoH_v2_ptds_params_st { + void *dstHost; + CUarray srcArray; + size_t srcOffset; + size_t ByteCount; +} cuMemcpyAtoH_v2_ptds_params; + +typedef struct cuMemcpyAtoA_v2_ptds_params_st { + CUarray dstArray; + size_t dstOffset; + CUarray srcArray; + size_t srcOffset; + size_t ByteCount; +} cuMemcpyAtoA_v2_ptds_params; + +typedef struct cuMemcpy2D_v2_ptds_params_st { + const CUDA_MEMCPY2D *pCopy; +} cuMemcpy2D_v2_ptds_params; + +typedef struct cuMemcpy2DUnaligned_v2_ptds_params_st { + const CUDA_MEMCPY2D *pCopy; +} cuMemcpy2DUnaligned_v2_ptds_params; + +typedef struct cuMemcpy3D_v2_ptds_params_st { + const CUDA_MEMCPY3D *pCopy; +} cuMemcpy3D_v2_ptds_params; + +typedef struct cuMemcpy3DPeer_ptds_params_st { + const CUDA_MEMCPY3D_PEER *pCopy; +} cuMemcpy3DPeer_ptds_params; + +typedef struct cuMemcpyAsync_ptsz_params_st { + CUdeviceptr dst; + CUdeviceptr src; + size_t ByteCount; + CUstream hStream; +} cuMemcpyAsync_ptsz_params; + +typedef struct cuMemcpyPeerAsync_ptsz_params_st { + CUdeviceptr dstDevice; + CUcontext dstContext; + CUdeviceptr srcDevice; + CUcontext srcContext; + size_t ByteCount; + CUstream hStream; +} cuMemcpyPeerAsync_ptsz_params; + +typedef struct cuMemcpyHtoDAsync_v2_ptsz_params_st { + CUdeviceptr dstDevice; + const void *srcHost; + size_t ByteCount; + CUstream hStream; +} cuMemcpyHtoDAsync_v2_ptsz_params; + +typedef struct cuMemcpyDtoHAsync_v2_ptsz_params_st { + void *dstHost; + CUdeviceptr srcDevice; + size_t ByteCount; + CUstream hStream; +} cuMemcpyDtoHAsync_v2_ptsz_params; + +typedef struct cuMemcpyDtoDAsync_v2_ptsz_params_st { + CUdeviceptr dstDevice; + CUdeviceptr srcDevice; + size_t ByteCount; + CUstream hStream; +} cuMemcpyDtoDAsync_v2_ptsz_params; + +typedef struct cuMemcpyHtoAAsync_v2_ptsz_params_st { + CUarray dstArray; + size_t dstOffset; + const void *srcHost; + size_t ByteCount; + CUstream hStream; +} cuMemcpyHtoAAsync_v2_ptsz_params; + +typedef struct cuMemcpyAtoHAsync_v2_ptsz_params_st { + void *dstHost; + CUarray srcArray; + size_t srcOffset; + size_t ByteCount; + CUstream hStream; +} cuMemcpyAtoHAsync_v2_ptsz_params; + +typedef struct cuMemcpy2DAsync_v2_ptsz_params_st { + const CUDA_MEMCPY2D *pCopy; + CUstream hStream; +} cuMemcpy2DAsync_v2_ptsz_params; + +typedef struct cuMemcpy3DAsync_v2_ptsz_params_st { + const CUDA_MEMCPY3D *pCopy; + CUstream hStream; +} cuMemcpy3DAsync_v2_ptsz_params; + +typedef struct cuMemcpy3DPeerAsync_ptsz_params_st { + const CUDA_MEMCPY3D_PEER *pCopy; + CUstream hStream; +} cuMemcpy3DPeerAsync_ptsz_params; + +typedef struct cuMemsetD8_v2_ptds_params_st { + CUdeviceptr dstDevice; + unsigned char uc; + size_t N; +} cuMemsetD8_v2_ptds_params; + +typedef struct cuMemsetD16_v2_ptds_params_st { + CUdeviceptr dstDevice; + unsigned short us; + size_t N; +} cuMemsetD16_v2_ptds_params; + +typedef struct cuMemsetD32_v2_ptds_params_st { + CUdeviceptr dstDevice; + unsigned int ui; + size_t N; +} cuMemsetD32_v2_ptds_params; + +typedef struct cuMemsetD2D8_v2_ptds_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned char uc; + size_t Width; + size_t Height; +} cuMemsetD2D8_v2_ptds_params; + +typedef struct cuMemsetD2D16_v2_ptds_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned short us; + size_t Width; + size_t Height; +} cuMemsetD2D16_v2_ptds_params; + +typedef struct cuMemsetD2D32_v2_ptds_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned int ui; + size_t Width; + size_t Height; +} cuMemsetD2D32_v2_ptds_params; + +typedef struct cuMemsetD8Async_ptsz_params_st { + CUdeviceptr dstDevice; + unsigned char uc; + size_t N; + CUstream hStream; +} cuMemsetD8Async_ptsz_params; + +typedef struct cuMemsetD16Async_ptsz_params_st { + CUdeviceptr dstDevice; + unsigned short us; + size_t N; + CUstream hStream; +} cuMemsetD16Async_ptsz_params; + +typedef struct cuMemsetD32Async_ptsz_params_st { + CUdeviceptr dstDevice; + unsigned int ui; + size_t N; + CUstream hStream; +} cuMemsetD32Async_ptsz_params; + +typedef struct cuMemsetD2D8Async_ptsz_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned char uc; + size_t Width; + size_t Height; + CUstream hStream; +} cuMemsetD2D8Async_ptsz_params; + +typedef struct cuMemsetD2D16Async_ptsz_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned short us; + size_t Width; + size_t Height; + CUstream hStream; +} cuMemsetD2D16Async_ptsz_params; + +typedef struct cuMemsetD2D32Async_ptsz_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned int ui; + size_t Width; + size_t Height; + CUstream hStream; +} cuMemsetD2D32Async_ptsz_params; + +typedef struct cuArrayCreate_v2_params_st { + CUarray *pHandle; + const CUDA_ARRAY_DESCRIPTOR *pAllocateArray; +} cuArrayCreate_v2_params; + +typedef struct cuArrayGetDescriptor_v2_params_st { + CUDA_ARRAY_DESCRIPTOR *pArrayDescriptor; + CUarray hArray; +} cuArrayGetDescriptor_v2_params; + +typedef struct cuArrayGetSparseProperties_params_st { + CUDA_ARRAY_SPARSE_PROPERTIES *sparseProperties; + CUarray array; +} cuArrayGetSparseProperties_params; + +typedef struct cuMipmappedArrayGetSparseProperties_params_st { + CUDA_ARRAY_SPARSE_PROPERTIES *sparseProperties; + CUmipmappedArray mipmap; +} cuMipmappedArrayGetSparseProperties_params; + +typedef struct cuArrayGetMemoryRequirements_params_st { + CUDA_ARRAY_MEMORY_REQUIREMENTS *memoryRequirements; + CUarray array; + CUdevice device; +} cuArrayGetMemoryRequirements_params; + +typedef struct cuMipmappedArrayGetMemoryRequirements_params_st { + CUDA_ARRAY_MEMORY_REQUIREMENTS *memoryRequirements; + CUmipmappedArray mipmap; + CUdevice device; +} cuMipmappedArrayGetMemoryRequirements_params; + +typedef struct cuArrayGetPlane_params_st { + CUarray *pPlaneArray; + CUarray hArray; + unsigned int planeIdx; +} cuArrayGetPlane_params; + +typedef struct cuArrayDestroy_params_st { + CUarray hArray; +} cuArrayDestroy_params; + +typedef struct cuArray3DCreate_v2_params_st { + CUarray *pHandle; + const CUDA_ARRAY3D_DESCRIPTOR *pAllocateArray; +} cuArray3DCreate_v2_params; + +typedef struct cuArray3DGetDescriptor_v2_params_st { + CUDA_ARRAY3D_DESCRIPTOR *pArrayDescriptor; + CUarray hArray; +} cuArray3DGetDescriptor_v2_params; + +typedef struct cuMipmappedArrayCreate_params_st { + CUmipmappedArray *pHandle; + const CUDA_ARRAY3D_DESCRIPTOR *pMipmappedArrayDesc; + unsigned int numMipmapLevels; +} cuMipmappedArrayCreate_params; + +typedef struct cuMipmappedArrayGetLevel_params_st { + CUarray *pLevelArray; + CUmipmappedArray hMipmappedArray; + unsigned int level; +} cuMipmappedArrayGetLevel_params; + +typedef struct cuMipmappedArrayDestroy_params_st { + CUmipmappedArray hMipmappedArray; +} cuMipmappedArrayDestroy_params; + +typedef struct cuMemGetHandleForAddressRange_params_st { + void *handle; + CUdeviceptr dptr; + size_t size; + CUmemRangeHandleType handleType; + unsigned long long flags; +} cuMemGetHandleForAddressRange_params; + +typedef struct cuMemAddressReserve_params_st { + CUdeviceptr *ptr; + size_t size; + size_t alignment; + CUdeviceptr addr; + unsigned long long flags; +} cuMemAddressReserve_params; + +typedef struct cuMemAddressFree_params_st { + CUdeviceptr ptr; + size_t size; +} cuMemAddressFree_params; + +typedef struct cuMemCreate_params_st { + CUmemGenericAllocationHandle *handle; + size_t size; + const CUmemAllocationProp *prop; + unsigned long long flags; +} cuMemCreate_params; + +typedef struct cuMemRelease_params_st { + CUmemGenericAllocationHandle handle; +} cuMemRelease_params; + +typedef struct cuMemMap_params_st { + CUdeviceptr ptr; + size_t size; + size_t offset; + CUmemGenericAllocationHandle handle; + unsigned long long flags; +} cuMemMap_params; + +typedef struct cuMemMapArrayAsync_ptsz_params_st { + CUarrayMapInfo *mapInfoList; + unsigned int count; + CUstream hStream; +} cuMemMapArrayAsync_ptsz_params; + +typedef struct cuMemUnmap_params_st { + CUdeviceptr ptr; + size_t size; +} cuMemUnmap_params; + +typedef struct cuMemSetAccess_params_st { + CUdeviceptr ptr; + size_t size; + const CUmemAccessDesc *desc; + size_t count; +} cuMemSetAccess_params; + +typedef struct cuMemGetAccess_params_st { + unsigned long long *flags; + const CUmemLocation *location; + CUdeviceptr ptr; +} cuMemGetAccess_params; + +typedef struct cuMemExportToShareableHandle_params_st { + void *shareableHandle; + CUmemGenericAllocationHandle handle; + CUmemAllocationHandleType handleType; + unsigned long long flags; +} cuMemExportToShareableHandle_params; + +typedef struct cuMemImportFromShareableHandle_params_st { + CUmemGenericAllocationHandle *handle; + void *osHandle; + CUmemAllocationHandleType shHandleType; +} cuMemImportFromShareableHandle_params; + +typedef struct cuMemGetAllocationGranularity_params_st { + size_t *granularity; + const CUmemAllocationProp *prop; + CUmemAllocationGranularity_flags option; +} cuMemGetAllocationGranularity_params; + +typedef struct cuMemGetAllocationPropertiesFromHandle_params_st { + CUmemAllocationProp *prop; + CUmemGenericAllocationHandle handle; +} cuMemGetAllocationPropertiesFromHandle_params; + +typedef struct cuMemRetainAllocationHandle_params_st { + CUmemGenericAllocationHandle *handle; + void *addr; +} cuMemRetainAllocationHandle_params; + +typedef struct cuMemFreeAsync_ptsz_params_st { + CUdeviceptr dptr; + CUstream hStream; +} cuMemFreeAsync_ptsz_params; + +typedef struct cuMemAllocAsync_ptsz_params_st { + CUdeviceptr *dptr; + size_t bytesize; + CUstream hStream; +} cuMemAllocAsync_ptsz_params; + +typedef struct cuMemPoolTrimTo_params_st { + CUmemoryPool pool; + size_t minBytesToKeep; +} cuMemPoolTrimTo_params; + +typedef struct cuMemPoolSetAttribute_params_st { + CUmemoryPool pool; + CUmemPool_attribute attr; + void *value; +} cuMemPoolSetAttribute_params; + +typedef struct cuMemPoolGetAttribute_params_st { + CUmemoryPool pool; + CUmemPool_attribute attr; + void *value; +} cuMemPoolGetAttribute_params; + +typedef struct cuMemPoolSetAccess_params_st { + CUmemoryPool pool; + const CUmemAccessDesc *map; + size_t count; +} cuMemPoolSetAccess_params; + +typedef struct cuMemPoolGetAccess_params_st { + CUmemAccess_flags *flags; + CUmemoryPool memPool; + CUmemLocation *location; +} cuMemPoolGetAccess_params; + +typedef struct cuMemPoolCreate_params_st { + CUmemoryPool *pool; + const CUmemPoolProps *poolProps; +} cuMemPoolCreate_params; + +typedef struct cuMemPoolDestroy_params_st { + CUmemoryPool pool; +} cuMemPoolDestroy_params; + +typedef struct cuMemAllocFromPoolAsync_ptsz_params_st { + CUdeviceptr *dptr; + size_t bytesize; + CUmemoryPool pool; + CUstream hStream; +} cuMemAllocFromPoolAsync_ptsz_params; + +typedef struct cuMemPoolExportToShareableHandle_params_st { + void *handle_out; + CUmemoryPool pool; + CUmemAllocationHandleType handleType; + unsigned long long flags; +} cuMemPoolExportToShareableHandle_params; + +typedef struct cuMemPoolImportFromShareableHandle_params_st { + CUmemoryPool *pool_out; + void *handle; + CUmemAllocationHandleType handleType; + unsigned long long flags; +} cuMemPoolImportFromShareableHandle_params; + +typedef struct cuMemPoolExportPointer_params_st { + CUmemPoolPtrExportData *shareData_out; + CUdeviceptr ptr; +} cuMemPoolExportPointer_params; + +typedef struct cuMemPoolImportPointer_params_st { + CUdeviceptr *ptr_out; + CUmemoryPool pool; + CUmemPoolPtrExportData *shareData; +} cuMemPoolImportPointer_params; + +typedef struct cuPointerGetAttribute_params_st { + void *data; + CUpointer_attribute attribute; + CUdeviceptr ptr; +} cuPointerGetAttribute_params; + +typedef struct cuMemPrefetchAsync_ptsz_params_st { + CUdeviceptr devPtr; + size_t count; + CUdevice dstDevice; + CUstream hStream; +} cuMemPrefetchAsync_ptsz_params; + +typedef struct cuMemAdvise_params_st { + CUdeviceptr devPtr; + size_t count; + CUmem_advise advice; + CUdevice device; +} cuMemAdvise_params; + +typedef struct cuMemRangeGetAttribute_params_st { + void *data; + size_t dataSize; + CUmem_range_attribute attribute; + CUdeviceptr devPtr; + size_t count; +} cuMemRangeGetAttribute_params; + +typedef struct cuMemRangeGetAttributes_params_st { + void **data; + size_t *dataSizes; + CUmem_range_attribute *attributes; + size_t numAttributes; + CUdeviceptr devPtr; + size_t count; +} cuMemRangeGetAttributes_params; + +typedef struct cuPointerSetAttribute_params_st { + const void *value; + CUpointer_attribute attribute; + CUdeviceptr ptr; +} cuPointerSetAttribute_params; + +typedef struct cuPointerGetAttributes_params_st { + unsigned int numAttributes; + CUpointer_attribute *attributes; + void **data; + CUdeviceptr ptr; +} cuPointerGetAttributes_params; + +typedef struct cuStreamCreate_params_st { + CUstream *phStream; + unsigned int Flags; +} cuStreamCreate_params; + +typedef struct cuStreamCreateWithPriority_params_st { + CUstream *phStream; + unsigned int flags; + int priority; +} cuStreamCreateWithPriority_params; + +typedef struct cuStreamGetPriority_ptsz_params_st { + CUstream hStream; + int *priority; +} cuStreamGetPriority_ptsz_params; + +typedef struct cuStreamGetFlags_ptsz_params_st { + CUstream hStream; + unsigned int *flags; +} cuStreamGetFlags_ptsz_params; + +typedef struct cuStreamGetId_ptsz_params_st { + CUstream hStream; + unsigned long long *streamId; +} cuStreamGetId_ptsz_params; + +typedef struct cuStreamGetCtx_ptsz_params_st { + CUstream hStream; + CUcontext *pctx; +} cuStreamGetCtx_ptsz_params; + +typedef struct cuStreamWaitEvent_ptsz_params_st { + CUstream hStream; + CUevent hEvent; + unsigned int Flags; +} cuStreamWaitEvent_ptsz_params; + +typedef struct cuStreamAddCallback_ptsz_params_st { + CUstream hStream; + CUstreamCallback callback; + void *userData; + unsigned int flags; +} cuStreamAddCallback_ptsz_params; + +typedef struct cuStreamBeginCapture_v2_ptsz_params_st { + CUstream hStream; + CUstreamCaptureMode mode; +} cuStreamBeginCapture_v2_ptsz_params; + +typedef struct cuThreadExchangeStreamCaptureMode_params_st { + CUstreamCaptureMode *mode; +} cuThreadExchangeStreamCaptureMode_params; + +typedef struct cuStreamEndCapture_ptsz_params_st { + CUstream hStream; + CUgraph *phGraph; +} cuStreamEndCapture_ptsz_params; + +typedef struct cuStreamIsCapturing_ptsz_params_st { + CUstream hStream; + CUstreamCaptureStatus *captureStatus; +} cuStreamIsCapturing_ptsz_params; + +typedef struct cuStreamGetCaptureInfo_ptsz_params_st { + CUstream hStream; + CUstreamCaptureStatus *captureStatus_out; + cuuint64_t *id_out; +} cuStreamGetCaptureInfo_ptsz_params; + +typedef struct cuStreamGetCaptureInfo_v2_ptsz_params_st { + CUstream hStream; + CUstreamCaptureStatus *captureStatus_out; + cuuint64_t *id_out; + CUgraph *graph_out; + const CUgraphNode **dependencies_out; + size_t *numDependencies_out; +} cuStreamGetCaptureInfo_v2_ptsz_params; + +typedef struct cuStreamUpdateCaptureDependencies_ptsz_params_st { + CUstream hStream; + CUgraphNode *dependencies; + size_t numDependencies; + unsigned int flags; +} cuStreamUpdateCaptureDependencies_ptsz_params; + +typedef struct cuStreamAttachMemAsync_ptsz_params_st { + CUstream hStream; + CUdeviceptr dptr; + size_t length; + unsigned int flags; +} cuStreamAttachMemAsync_ptsz_params; + +typedef struct cuStreamQuery_ptsz_params_st { + CUstream hStream; +} cuStreamQuery_ptsz_params; + +typedef struct cuStreamSynchronize_ptsz_params_st { + CUstream hStream; +} cuStreamSynchronize_ptsz_params; + +typedef struct cuStreamDestroy_v2_params_st { + CUstream hStream; +} cuStreamDestroy_v2_params; + +typedef struct cuStreamCopyAttributes_ptsz_params_st { + CUstream dst; + CUstream src; +} cuStreamCopyAttributes_ptsz_params; + +typedef struct cuStreamGetAttribute_ptsz_params_st { + CUstream hStream; + CUstreamAttrID attr; + CUstreamAttrValue *value_out; +} cuStreamGetAttribute_ptsz_params; + +typedef struct cuStreamSetAttribute_ptsz_params_st { + CUstream hStream; + CUstreamAttrID attr; + const CUstreamAttrValue *value; +} cuStreamSetAttribute_ptsz_params; + +typedef struct cuEventCreate_params_st { + CUevent *phEvent; + unsigned int Flags; +} cuEventCreate_params; + +typedef struct cuEventRecord_ptsz_params_st { + CUevent hEvent; + CUstream hStream; +} cuEventRecord_ptsz_params; + +typedef struct cuEventRecordWithFlags_ptsz_params_st { + CUevent hEvent; + CUstream hStream; + unsigned int flags; +} cuEventRecordWithFlags_ptsz_params; + +typedef struct cuEventQuery_params_st { + CUevent hEvent; +} cuEventQuery_params; + +typedef struct cuEventSynchronize_params_st { + CUevent hEvent; +} cuEventSynchronize_params; + +typedef struct cuEventDestroy_v2_params_st { + CUevent hEvent; +} cuEventDestroy_v2_params; + +typedef struct cuEventElapsedTime_params_st { + float *pMilliseconds; + CUevent hStart; + CUevent hEnd; +} cuEventElapsedTime_params; + +typedef struct cuImportExternalMemory_params_st { + CUexternalMemory *extMem_out; + const CUDA_EXTERNAL_MEMORY_HANDLE_DESC *memHandleDesc; +} cuImportExternalMemory_params; + +typedef struct cuExternalMemoryGetMappedBuffer_params_st { + CUdeviceptr *devPtr; + CUexternalMemory extMem; + const CUDA_EXTERNAL_MEMORY_BUFFER_DESC *bufferDesc; +} cuExternalMemoryGetMappedBuffer_params; + +typedef struct cuExternalMemoryGetMappedMipmappedArray_params_st { + CUmipmappedArray *mipmap; + CUexternalMemory extMem; + const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC *mipmapDesc; +} cuExternalMemoryGetMappedMipmappedArray_params; + +typedef struct cuDestroyExternalMemory_params_st { + CUexternalMemory extMem; +} cuDestroyExternalMemory_params; + +typedef struct cuImportExternalSemaphore_params_st { + CUexternalSemaphore *extSem_out; + const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC *semHandleDesc; +} cuImportExternalSemaphore_params; + +typedef struct cuSignalExternalSemaphoresAsync_ptsz_params_st { + const CUexternalSemaphore *extSemArray; + const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS *paramsArray; + unsigned int numExtSems; + CUstream stream; +} cuSignalExternalSemaphoresAsync_ptsz_params; + +typedef struct cuWaitExternalSemaphoresAsync_ptsz_params_st { + const CUexternalSemaphore *extSemArray; + const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS *paramsArray; + unsigned int numExtSems; + CUstream stream; +} cuWaitExternalSemaphoresAsync_ptsz_params; + +typedef struct cuDestroyExternalSemaphore_params_st { + CUexternalSemaphore extSem; +} cuDestroyExternalSemaphore_params; + +typedef struct cuStreamWaitValue32_ptsz_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint32_t value; + unsigned int flags; +} cuStreamWaitValue32_ptsz_params; + +typedef struct cuStreamWaitValue64_ptsz_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint64_t value; + unsigned int flags; +} cuStreamWaitValue64_ptsz_params; + +typedef struct cuStreamWriteValue32_ptsz_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint32_t value; + unsigned int flags; +} cuStreamWriteValue32_ptsz_params; + +typedef struct cuStreamWriteValue64_ptsz_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint64_t value; + unsigned int flags; +} cuStreamWriteValue64_ptsz_params; + +typedef struct cuStreamBatchMemOp_ptsz_params_st { + CUstream stream; + unsigned int count; + CUstreamBatchMemOpParams *paramArray; + unsigned int flags; +} cuStreamBatchMemOp_ptsz_params; + +typedef struct cuStreamWaitValue32_v2_ptsz_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint32_t value; + unsigned int flags; +} cuStreamWaitValue32_v2_ptsz_params; + +typedef struct cuStreamWaitValue64_v2_ptsz_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint64_t value; + unsigned int flags; +} cuStreamWaitValue64_v2_ptsz_params; + +typedef struct cuStreamWriteValue32_v2_ptsz_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint32_t value; + unsigned int flags; +} cuStreamWriteValue32_v2_ptsz_params; + +typedef struct cuStreamWriteValue64_v2_ptsz_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint64_t value; + unsigned int flags; +} cuStreamWriteValue64_v2_ptsz_params; + +typedef struct cuStreamBatchMemOp_v2_ptsz_params_st { + CUstream stream; + unsigned int count; + CUstreamBatchMemOpParams *paramArray; + unsigned int flags; +} cuStreamBatchMemOp_v2_ptsz_params; + +typedef struct cuFuncGetAttribute_params_st { + int *pi; + CUfunction_attribute attrib; + CUfunction hfunc; +} cuFuncGetAttribute_params; + +typedef struct cuFuncSetAttribute_params_st { + CUfunction hfunc; + CUfunction_attribute attrib; + int value; +} cuFuncSetAttribute_params; + +typedef struct cuFuncSetCacheConfig_params_st { + CUfunction hfunc; + CUfunc_cache config; +} cuFuncSetCacheConfig_params; + +typedef struct cuFuncSetSharedMemConfig_params_st { + CUfunction hfunc; + CUsharedconfig config; +} cuFuncSetSharedMemConfig_params; + +typedef struct cuFuncGetModule_params_st { + CUmodule *hmod; + CUfunction hfunc; +} cuFuncGetModule_params; + +typedef struct cuLaunchKernel_ptsz_params_st { + CUfunction f; + unsigned int gridDimX; + unsigned int gridDimY; + unsigned int gridDimZ; + unsigned int blockDimX; + unsigned int blockDimY; + unsigned int blockDimZ; + unsigned int sharedMemBytes; + CUstream hStream; + void **kernelParams; + void **extra; +} cuLaunchKernel_ptsz_params; + +typedef struct cuLaunchKernelEx_ptsz_params_st { + const CUlaunchConfig *config; + CUfunction f; + void **kernelParams; + void **extra; +} cuLaunchKernelEx_ptsz_params; + +typedef struct cuLaunchCooperativeKernel_ptsz_params_st { + CUfunction f; + unsigned int gridDimX; + unsigned int gridDimY; + unsigned int gridDimZ; + unsigned int blockDimX; + unsigned int blockDimY; + unsigned int blockDimZ; + unsigned int sharedMemBytes; + CUstream hStream; + void **kernelParams; +} cuLaunchCooperativeKernel_ptsz_params; + +typedef struct cuLaunchCooperativeKernelMultiDevice_params_st { + CUDA_LAUNCH_PARAMS *launchParamsList; + unsigned int numDevices; + unsigned int flags; +} cuLaunchCooperativeKernelMultiDevice_params; + +typedef struct cuLaunchHostFunc_ptsz_params_st { + CUstream hStream; + CUhostFn fn; + void *userData; +} cuLaunchHostFunc_ptsz_params; + +typedef struct cuFuncSetBlockShape_params_st { + CUfunction hfunc; + int x; + int y; + int z; +} cuFuncSetBlockShape_params; + +typedef struct cuFuncSetSharedSize_params_st { + CUfunction hfunc; + unsigned int bytes; +} cuFuncSetSharedSize_params; + +typedef struct cuParamSetSize_params_st { + CUfunction hfunc; + unsigned int numbytes; +} cuParamSetSize_params; + +typedef struct cuParamSeti_params_st { + CUfunction hfunc; + int offset; + unsigned int value; +} cuParamSeti_params; + +typedef struct cuParamSetf_params_st { + CUfunction hfunc; + int offset; + float value; +} cuParamSetf_params; + +typedef struct cuParamSetv_params_st { + CUfunction hfunc; + int offset; + void *ptr; + unsigned int numbytes; +} cuParamSetv_params; + +typedef struct cuLaunch_params_st { + CUfunction f; +} cuLaunch_params; + +typedef struct cuLaunchGrid_params_st { + CUfunction f; + int grid_width; + int grid_height; +} cuLaunchGrid_params; + +typedef struct cuLaunchGridAsync_params_st { + CUfunction f; + int grid_width; + int grid_height; + CUstream hStream; +} cuLaunchGridAsync_params; + +typedef struct cuParamSetTexRef_params_st { + CUfunction hfunc; + int texunit; + CUtexref hTexRef; +} cuParamSetTexRef_params; + +typedef struct cuGraphCreate_params_st { + CUgraph *phGraph; + unsigned int flags; +} cuGraphCreate_params; + +typedef struct cuGraphAddKernelNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + const CUDA_KERNEL_NODE_PARAMS *nodeParams; +} cuGraphAddKernelNode_params; + +typedef struct cuGraphKernelNodeGetParams_params_st { + CUgraphNode hNode; + CUDA_KERNEL_NODE_PARAMS *nodeParams; +} cuGraphKernelNodeGetParams_params; + +typedef struct cuGraphKernelNodeSetParams_params_st { + CUgraphNode hNode; + const CUDA_KERNEL_NODE_PARAMS *nodeParams; +} cuGraphKernelNodeSetParams_params; + +typedef struct cuGraphAddMemcpyNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + const CUDA_MEMCPY3D *copyParams; + CUcontext ctx; +} cuGraphAddMemcpyNode_params; + +typedef struct cuGraphMemcpyNodeGetParams_params_st { + CUgraphNode hNode; + CUDA_MEMCPY3D *nodeParams; +} cuGraphMemcpyNodeGetParams_params; + +typedef struct cuGraphMemcpyNodeSetParams_params_st { + CUgraphNode hNode; + const CUDA_MEMCPY3D *nodeParams; +} cuGraphMemcpyNodeSetParams_params; + +typedef struct cuGraphAddMemsetNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + const CUDA_MEMSET_NODE_PARAMS *memsetParams; + CUcontext ctx; +} cuGraphAddMemsetNode_params; + +typedef struct cuGraphMemsetNodeGetParams_params_st { + CUgraphNode hNode; + CUDA_MEMSET_NODE_PARAMS *nodeParams; +} cuGraphMemsetNodeGetParams_params; + +typedef struct cuGraphMemsetNodeSetParams_params_st { + CUgraphNode hNode; + const CUDA_MEMSET_NODE_PARAMS *nodeParams; +} cuGraphMemsetNodeSetParams_params; + +typedef struct cuGraphAddHostNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + const CUDA_HOST_NODE_PARAMS *nodeParams; +} cuGraphAddHostNode_params; + +typedef struct cuGraphHostNodeGetParams_params_st { + CUgraphNode hNode; + CUDA_HOST_NODE_PARAMS *nodeParams; +} cuGraphHostNodeGetParams_params; + +typedef struct cuGraphHostNodeSetParams_params_st { + CUgraphNode hNode; + const CUDA_HOST_NODE_PARAMS *nodeParams; +} cuGraphHostNodeSetParams_params; + +typedef struct cuGraphAddChildGraphNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + CUgraph childGraph; +} cuGraphAddChildGraphNode_params; + +typedef struct cuGraphChildGraphNodeGetGraph_params_st { + CUgraphNode hNode; + CUgraph *phGraph; +} cuGraphChildGraphNodeGetGraph_params; + +typedef struct cuGraphAddEmptyNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; +} cuGraphAddEmptyNode_params; + +typedef struct cuGraphAddEventRecordNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + CUevent event; +} cuGraphAddEventRecordNode_params; + +typedef struct cuGraphEventRecordNodeGetEvent_params_st { + CUgraphNode hNode; + CUevent *event_out; +} cuGraphEventRecordNodeGetEvent_params; + +typedef struct cuGraphEventRecordNodeSetEvent_params_st { + CUgraphNode hNode; + CUevent event; +} cuGraphEventRecordNodeSetEvent_params; + +typedef struct cuGraphAddEventWaitNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + CUevent event; +} cuGraphAddEventWaitNode_params; + +typedef struct cuGraphEventWaitNodeGetEvent_params_st { + CUgraphNode hNode; + CUevent *event_out; +} cuGraphEventWaitNodeGetEvent_params; + +typedef struct cuGraphEventWaitNodeSetEvent_params_st { + CUgraphNode hNode; + CUevent event; +} cuGraphEventWaitNodeSetEvent_params; + +typedef struct cuGraphAddExternalSemaphoresSignalNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS *nodeParams; +} cuGraphAddExternalSemaphoresSignalNode_params; + +typedef struct cuGraphExternalSemaphoresSignalNodeGetParams_params_st { + CUgraphNode hNode; + CUDA_EXT_SEM_SIGNAL_NODE_PARAMS *params_out; +} cuGraphExternalSemaphoresSignalNodeGetParams_params; + +typedef struct cuGraphExternalSemaphoresSignalNodeSetParams_params_st { + CUgraphNode hNode; + const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS *nodeParams; +} cuGraphExternalSemaphoresSignalNodeSetParams_params; + +typedef struct cuGraphAddExternalSemaphoresWaitNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + const CUDA_EXT_SEM_WAIT_NODE_PARAMS *nodeParams; +} cuGraphAddExternalSemaphoresWaitNode_params; + +typedef struct cuGraphExternalSemaphoresWaitNodeGetParams_params_st { + CUgraphNode hNode; + CUDA_EXT_SEM_WAIT_NODE_PARAMS *params_out; +} cuGraphExternalSemaphoresWaitNodeGetParams_params; + +typedef struct cuGraphExternalSemaphoresWaitNodeSetParams_params_st { + CUgraphNode hNode; + const CUDA_EXT_SEM_WAIT_NODE_PARAMS *nodeParams; +} cuGraphExternalSemaphoresWaitNodeSetParams_params; + +typedef struct cuGraphAddBatchMemOpNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams; +} cuGraphAddBatchMemOpNode_params; + +typedef struct cuGraphBatchMemOpNodeGetParams_params_st { + CUgraphNode hNode; + CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams_out; +} cuGraphBatchMemOpNodeGetParams_params; + +typedef struct cuGraphBatchMemOpNodeSetParams_params_st { + CUgraphNode hNode; + const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams; +} cuGraphBatchMemOpNodeSetParams_params; + +typedef struct cuGraphExecBatchMemOpNodeSetParams_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams; +} cuGraphExecBatchMemOpNodeSetParams_params; + +typedef struct cuGraphAddMemAllocNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + CUDA_MEM_ALLOC_NODE_PARAMS *nodeParams; +} cuGraphAddMemAllocNode_params; + +typedef struct cuGraphMemAllocNodeGetParams_params_st { + CUgraphNode hNode; + CUDA_MEM_ALLOC_NODE_PARAMS *params_out; +} cuGraphMemAllocNodeGetParams_params; + +typedef struct cuGraphAddMemFreeNode_params_st { + CUgraphNode *phGraphNode; + CUgraph hGraph; + const CUgraphNode *dependencies; + size_t numDependencies; + CUdeviceptr dptr; +} cuGraphAddMemFreeNode_params; + +typedef struct cuGraphMemFreeNodeGetParams_params_st { + CUgraphNode hNode; + CUdeviceptr *dptr_out; +} cuGraphMemFreeNodeGetParams_params; + +typedef struct cuDeviceGraphMemTrim_params_st { + CUdevice device; +} cuDeviceGraphMemTrim_params; + +typedef struct cuDeviceGetGraphMemAttribute_params_st { + CUdevice device; + CUgraphMem_attribute attr; + void *value; +} cuDeviceGetGraphMemAttribute_params; + +typedef struct cuDeviceSetGraphMemAttribute_params_st { + CUdevice device; + CUgraphMem_attribute attr; + void *value; +} cuDeviceSetGraphMemAttribute_params; + +typedef struct cuGraphClone_params_st { + CUgraph *phGraphClone; + CUgraph originalGraph; +} cuGraphClone_params; + +typedef struct cuGraphNodeFindInClone_params_st { + CUgraphNode *phNode; + CUgraphNode hOriginalNode; + CUgraph hClonedGraph; +} cuGraphNodeFindInClone_params; + +typedef struct cuGraphNodeGetType_params_st { + CUgraphNode hNode; + CUgraphNodeType *type; +} cuGraphNodeGetType_params; + +typedef struct cuGraphGetNodes_params_st { + CUgraph hGraph; + CUgraphNode *nodes; + size_t *numNodes; +} cuGraphGetNodes_params; + +typedef struct cuGraphGetRootNodes_params_st { + CUgraph hGraph; + CUgraphNode *rootNodes; + size_t *numRootNodes; +} cuGraphGetRootNodes_params; + +typedef struct cuGraphGetEdges_params_st { + CUgraph hGraph; + CUgraphNode *from; + CUgraphNode *to; + size_t *numEdges; +} cuGraphGetEdges_params; + +typedef struct cuGraphNodeGetDependencies_params_st { + CUgraphNode hNode; + CUgraphNode *dependencies; + size_t *numDependencies; +} cuGraphNodeGetDependencies_params; + +typedef struct cuGraphNodeGetDependentNodes_params_st { + CUgraphNode hNode; + CUgraphNode *dependentNodes; + size_t *numDependentNodes; +} cuGraphNodeGetDependentNodes_params; + +typedef struct cuGraphAddDependencies_params_st { + CUgraph hGraph; + const CUgraphNode *from; + const CUgraphNode *to; + size_t numDependencies; +} cuGraphAddDependencies_params; + +typedef struct cuGraphRemoveDependencies_params_st { + CUgraph hGraph; + const CUgraphNode *from; + const CUgraphNode *to; + size_t numDependencies; +} cuGraphRemoveDependencies_params; + +typedef struct cuGraphDestroyNode_params_st { + CUgraphNode hNode; +} cuGraphDestroyNode_params; + +typedef struct cuGraphInstantiate_v2_params_st { + CUgraphExec *phGraphExec; + CUgraph hGraph; + CUgraphNode *phErrorNode; + char *logBuffer; + size_t bufferSize; +} cuGraphInstantiate_v2_params; + +typedef struct cuGraphInstantiateWithFlags_params_st { + CUgraphExec *phGraphExec; + CUgraph hGraph; + unsigned long long flags; +} cuGraphInstantiateWithFlags_params; + +typedef struct cuGraphInstantiateWithParams_ptsz_params_st { + CUgraphExec *phGraphExec; + CUgraph hGraph; + CUDA_GRAPH_INSTANTIATE_PARAMS *instantiateParams; +} cuGraphInstantiateWithParams_ptsz_params; + +typedef struct cuGraphExecGetFlags_params_st { + CUgraphExec hGraphExec; + cuuint64_t *flags; +} cuGraphExecGetFlags_params; + +typedef struct cuGraphExecKernelNodeSetParams_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + const CUDA_KERNEL_NODE_PARAMS *nodeParams; +} cuGraphExecKernelNodeSetParams_params; + +typedef struct cuGraphExecMemcpyNodeSetParams_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + const CUDA_MEMCPY3D *copyParams; + CUcontext ctx; +} cuGraphExecMemcpyNodeSetParams_params; + +typedef struct cuGraphExecMemsetNodeSetParams_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + const CUDA_MEMSET_NODE_PARAMS *memsetParams; + CUcontext ctx; +} cuGraphExecMemsetNodeSetParams_params; + +typedef struct cuGraphExecHostNodeSetParams_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + const CUDA_HOST_NODE_PARAMS *nodeParams; +} cuGraphExecHostNodeSetParams_params; + +typedef struct cuGraphExecChildGraphNodeSetParams_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + CUgraph childGraph; +} cuGraphExecChildGraphNodeSetParams_params; + +typedef struct cuGraphExecEventRecordNodeSetEvent_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + CUevent event; +} cuGraphExecEventRecordNodeSetEvent_params; + +typedef struct cuGraphExecEventWaitNodeSetEvent_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + CUevent event; +} cuGraphExecEventWaitNodeSetEvent_params; + +typedef struct cuGraphExecExternalSemaphoresSignalNodeSetParams_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS *nodeParams; +} cuGraphExecExternalSemaphoresSignalNodeSetParams_params; + +typedef struct cuGraphExecExternalSemaphoresWaitNodeSetParams_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + const CUDA_EXT_SEM_WAIT_NODE_PARAMS *nodeParams; +} cuGraphExecExternalSemaphoresWaitNodeSetParams_params; + +typedef struct cuGraphNodeSetEnabled_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + unsigned int isEnabled; +} cuGraphNodeSetEnabled_params; + +typedef struct cuGraphNodeGetEnabled_params_st { + CUgraphExec hGraphExec; + CUgraphNode hNode; + unsigned int *isEnabled; +} cuGraphNodeGetEnabled_params; + +typedef struct cuGraphUpload_ptsz_params_st { + CUgraphExec hGraphExec; + CUstream hStream; +} cuGraphUpload_ptsz_params; + +typedef struct cuGraphLaunch_ptsz_params_st { + CUgraphExec hGraphExec; + CUstream hStream; +} cuGraphLaunch_ptsz_params; + +typedef struct cuGraphExecDestroy_params_st { + CUgraphExec hGraphExec; +} cuGraphExecDestroy_params; + +typedef struct cuGraphDestroy_params_st { + CUgraph hGraph; +} cuGraphDestroy_params; + +typedef struct cuGraphExecUpdate_params_st { + CUgraphExec hGraphExec; + CUgraph hGraph; + CUgraphNode *hErrorNode_out; + CUgraphExecUpdateResult *updateResult_out; +} cuGraphExecUpdate_params; + +typedef struct cuGraphKernelNodeCopyAttributes_params_st { + CUgraphNode dst; + CUgraphNode src; +} cuGraphKernelNodeCopyAttributes_params; + +typedef struct cuGraphKernelNodeGetAttribute_params_st { + CUgraphNode hNode; + CUkernelNodeAttrID attr; + CUkernelNodeAttrValue *value_out; +} cuGraphKernelNodeGetAttribute_params; + +typedef struct cuGraphKernelNodeSetAttribute_params_st { + CUgraphNode hNode; + CUkernelNodeAttrID attr; + const CUkernelNodeAttrValue *value; +} cuGraphKernelNodeSetAttribute_params; + +typedef struct cuGraphDebugDotPrint_params_st { + CUgraph hGraph; + const char *path; + unsigned int flags; +} cuGraphDebugDotPrint_params; + +typedef struct cuUserObjectCreate_params_st { + CUuserObject *object_out; + void *ptr; + CUhostFn destroy; + unsigned int initialRefcount; + unsigned int flags; +} cuUserObjectCreate_params; + +typedef struct cuUserObjectRetain_params_st { + CUuserObject object; + unsigned int count; +} cuUserObjectRetain_params; + +typedef struct cuUserObjectRelease_params_st { + CUuserObject object; + unsigned int count; +} cuUserObjectRelease_params; + +typedef struct cuGraphRetainUserObject_params_st { + CUgraph graph; + CUuserObject object; + unsigned int count; + unsigned int flags; +} cuGraphRetainUserObject_params; + +typedef struct cuGraphReleaseUserObject_params_st { + CUgraph graph; + CUuserObject object; + unsigned int count; +} cuGraphReleaseUserObject_params; + +typedef struct cuOccupancyMaxActiveBlocksPerMultiprocessor_params_st { + int *numBlocks; + CUfunction func; + int blockSize; + size_t dynamicSMemSize; +} cuOccupancyMaxActiveBlocksPerMultiprocessor_params; + +typedef struct cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags_params_st { + int *numBlocks; + CUfunction func; + int blockSize; + size_t dynamicSMemSize; + unsigned int flags; +} cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags_params; + +typedef struct cuOccupancyMaxPotentialBlockSize_params_st { + int *minGridSize; + int *blockSize; + CUfunction func; + CUoccupancyB2DSize blockSizeToDynamicSMemSize; + size_t dynamicSMemSize; + int blockSizeLimit; +} cuOccupancyMaxPotentialBlockSize_params; + +typedef struct cuOccupancyMaxPotentialBlockSizeWithFlags_params_st { + int *minGridSize; + int *blockSize; + CUfunction func; + CUoccupancyB2DSize blockSizeToDynamicSMemSize; + size_t dynamicSMemSize; + int blockSizeLimit; + unsigned int flags; +} cuOccupancyMaxPotentialBlockSizeWithFlags_params; + +typedef struct cuOccupancyAvailableDynamicSMemPerBlock_params_st { + size_t *dynamicSmemSize; + CUfunction func; + int numBlocks; + int blockSize; +} cuOccupancyAvailableDynamicSMemPerBlock_params; + +typedef struct cuOccupancyMaxPotentialClusterSize_params_st { + int *clusterSize; + CUfunction func; + const CUlaunchConfig *config; +} cuOccupancyMaxPotentialClusterSize_params; + +typedef struct cuOccupancyMaxActiveClusters_params_st { + int *numClusters; + CUfunction func; + const CUlaunchConfig *config; +} cuOccupancyMaxActiveClusters_params; + +typedef struct cuTexRefSetArray_params_st { + CUtexref hTexRef; + CUarray hArray; + unsigned int Flags; +} cuTexRefSetArray_params; + +typedef struct cuTexRefSetMipmappedArray_params_st { + CUtexref hTexRef; + CUmipmappedArray hMipmappedArray; + unsigned int Flags; +} cuTexRefSetMipmappedArray_params; + +typedef struct cuTexRefSetAddress_v2_params_st { + size_t *ByteOffset; + CUtexref hTexRef; + CUdeviceptr dptr; + size_t bytes; +} cuTexRefSetAddress_v2_params; + +typedef struct cuTexRefSetAddress2D_v3_params_st { + CUtexref hTexRef; + const CUDA_ARRAY_DESCRIPTOR *desc; + CUdeviceptr dptr; + size_t Pitch; +} cuTexRefSetAddress2D_v3_params; + +typedef struct cuTexRefSetFormat_params_st { + CUtexref hTexRef; + CUarray_format fmt; + int NumPackedComponents; +} cuTexRefSetFormat_params; + +typedef struct cuTexRefSetAddressMode_params_st { + CUtexref hTexRef; + int dim; + CUaddress_mode am; +} cuTexRefSetAddressMode_params; + +typedef struct cuTexRefSetFilterMode_params_st { + CUtexref hTexRef; + CUfilter_mode fm; +} cuTexRefSetFilterMode_params; + +typedef struct cuTexRefSetMipmapFilterMode_params_st { + CUtexref hTexRef; + CUfilter_mode fm; +} cuTexRefSetMipmapFilterMode_params; + +typedef struct cuTexRefSetMipmapLevelBias_params_st { + CUtexref hTexRef; + float bias; +} cuTexRefSetMipmapLevelBias_params; + +typedef struct cuTexRefSetMipmapLevelClamp_params_st { + CUtexref hTexRef; + float minMipmapLevelClamp; + float maxMipmapLevelClamp; +} cuTexRefSetMipmapLevelClamp_params; + +typedef struct cuTexRefSetMaxAnisotropy_params_st { + CUtexref hTexRef; + unsigned int maxAniso; +} cuTexRefSetMaxAnisotropy_params; + +typedef struct cuTexRefSetBorderColor_params_st { + CUtexref hTexRef; + float *pBorderColor; +} cuTexRefSetBorderColor_params; + +typedef struct cuTexRefSetFlags_params_st { + CUtexref hTexRef; + unsigned int Flags; +} cuTexRefSetFlags_params; + +typedef struct cuTexRefGetAddress_v2_params_st { + CUdeviceptr *pdptr; + CUtexref hTexRef; +} cuTexRefGetAddress_v2_params; + +typedef struct cuTexRefGetArray_params_st { + CUarray *phArray; + CUtexref hTexRef; +} cuTexRefGetArray_params; + +typedef struct cuTexRefGetMipmappedArray_params_st { + CUmipmappedArray *phMipmappedArray; + CUtexref hTexRef; +} cuTexRefGetMipmappedArray_params; + +typedef struct cuTexRefGetAddressMode_params_st { + CUaddress_mode *pam; + CUtexref hTexRef; + int dim; +} cuTexRefGetAddressMode_params; + +typedef struct cuTexRefGetFilterMode_params_st { + CUfilter_mode *pfm; + CUtexref hTexRef; +} cuTexRefGetFilterMode_params; + +typedef struct cuTexRefGetFormat_params_st { + CUarray_format *pFormat; + int *pNumChannels; + CUtexref hTexRef; +} cuTexRefGetFormat_params; + +typedef struct cuTexRefGetMipmapFilterMode_params_st { + CUfilter_mode *pfm; + CUtexref hTexRef; +} cuTexRefGetMipmapFilterMode_params; + +typedef struct cuTexRefGetMipmapLevelBias_params_st { + float *pbias; + CUtexref hTexRef; +} cuTexRefGetMipmapLevelBias_params; + +typedef struct cuTexRefGetMipmapLevelClamp_params_st { + float *pminMipmapLevelClamp; + float *pmaxMipmapLevelClamp; + CUtexref hTexRef; +} cuTexRefGetMipmapLevelClamp_params; + +typedef struct cuTexRefGetMaxAnisotropy_params_st { + int *pmaxAniso; + CUtexref hTexRef; +} cuTexRefGetMaxAnisotropy_params; + +typedef struct cuTexRefGetBorderColor_params_st { + float *pBorderColor; + CUtexref hTexRef; +} cuTexRefGetBorderColor_params; + +typedef struct cuTexRefGetFlags_params_st { + unsigned int *pFlags; + CUtexref hTexRef; +} cuTexRefGetFlags_params; + +typedef struct cuTexRefCreate_params_st { + CUtexref *pTexRef; +} cuTexRefCreate_params; + +typedef struct cuTexRefDestroy_params_st { + CUtexref hTexRef; +} cuTexRefDestroy_params; + +typedef struct cuSurfRefSetArray_params_st { + CUsurfref hSurfRef; + CUarray hArray; + unsigned int Flags; +} cuSurfRefSetArray_params; + +typedef struct cuSurfRefGetArray_params_st { + CUarray *phArray; + CUsurfref hSurfRef; +} cuSurfRefGetArray_params; + +typedef struct cuTexObjectCreate_params_st { + CUtexObject *pTexObject; + const CUDA_RESOURCE_DESC *pResDesc; + const CUDA_TEXTURE_DESC *pTexDesc; + const CUDA_RESOURCE_VIEW_DESC *pResViewDesc; +} cuTexObjectCreate_params; + +typedef struct cuTexObjectDestroy_params_st { + CUtexObject texObject; +} cuTexObjectDestroy_params; + +typedef struct cuTexObjectGetResourceDesc_params_st { + CUDA_RESOURCE_DESC *pResDesc; + CUtexObject texObject; +} cuTexObjectGetResourceDesc_params; + +typedef struct cuTexObjectGetTextureDesc_params_st { + CUDA_TEXTURE_DESC *pTexDesc; + CUtexObject texObject; +} cuTexObjectGetTextureDesc_params; + +typedef struct cuTexObjectGetResourceViewDesc_params_st { + CUDA_RESOURCE_VIEW_DESC *pResViewDesc; + CUtexObject texObject; +} cuTexObjectGetResourceViewDesc_params; + +typedef struct cuSurfObjectCreate_params_st { + CUsurfObject *pSurfObject; + const CUDA_RESOURCE_DESC *pResDesc; +} cuSurfObjectCreate_params; + +typedef struct cuSurfObjectDestroy_params_st { + CUsurfObject surfObject; +} cuSurfObjectDestroy_params; + +typedef struct cuSurfObjectGetResourceDesc_params_st { + CUDA_RESOURCE_DESC *pResDesc; + CUsurfObject surfObject; +} cuSurfObjectGetResourceDesc_params; + +typedef struct cuDeviceCanAccessPeer_params_st { + int *canAccessPeer; + CUdevice dev; + CUdevice peerDev; +} cuDeviceCanAccessPeer_params; + +typedef struct cuCtxEnablePeerAccess_params_st { + CUcontext peerContext; + unsigned int Flags; +} cuCtxEnablePeerAccess_params; + +typedef struct cuCtxDisablePeerAccess_params_st { + CUcontext peerContext; +} cuCtxDisablePeerAccess_params; + +typedef struct cuDeviceGetP2PAttribute_params_st { + int *value; + CUdevice_P2PAttribute attrib; + CUdevice srcDevice; + CUdevice dstDevice; +} cuDeviceGetP2PAttribute_params; + +typedef struct cuGraphicsUnregisterResource_params_st { + CUgraphicsResource resource; +} cuGraphicsUnregisterResource_params; + +typedef struct cuGraphicsSubResourceGetMappedArray_params_st { + CUarray *pArray; + CUgraphicsResource resource; + unsigned int arrayIndex; + unsigned int mipLevel; +} cuGraphicsSubResourceGetMappedArray_params; + +typedef struct cuGraphicsResourceGetMappedMipmappedArray_params_st { + CUmipmappedArray *pMipmappedArray; + CUgraphicsResource resource; +} cuGraphicsResourceGetMappedMipmappedArray_params; + +typedef struct cuGraphicsResourceGetMappedPointer_v2_params_st { + CUdeviceptr *pDevPtr; + size_t *pSize; + CUgraphicsResource resource; +} cuGraphicsResourceGetMappedPointer_v2_params; + +typedef struct cuGraphicsResourceSetMapFlags_v2_params_st { + CUgraphicsResource resource; + unsigned int flags; +} cuGraphicsResourceSetMapFlags_v2_params; + +typedef struct cuGraphicsMapResources_ptsz_params_st { + unsigned int count; + CUgraphicsResource *resources; + CUstream hStream; +} cuGraphicsMapResources_ptsz_params; + +typedef struct cuGraphicsUnmapResources_ptsz_params_st { + unsigned int count; + CUgraphicsResource *resources; + CUstream hStream; +} cuGraphicsUnmapResources_ptsz_params; + +typedef struct cuGetProcAddress_v2_params_st { + const char *symbol; + void **pfn; + int cudaVersion; + cuuint64_t flags; + CUdriverProcAddressQueryResult *symbolStatus; +} cuGetProcAddress_v2_params; + +typedef struct cuCoredumpGetAttribute_params_st { + CUcoredumpSettings attrib; + void *value; + size_t *size; +} cuCoredumpGetAttribute_params; + +typedef struct cuCoredumpGetAttributeGlobal_params_st { + CUcoredumpSettings attrib; + void *value; + size_t *size; +} cuCoredumpGetAttributeGlobal_params; + +typedef struct cuCoredumpSetAttribute_params_st { + CUcoredumpSettings attrib; + void *value; + size_t *size; +} cuCoredumpSetAttribute_params; + +typedef struct cuCoredumpSetAttributeGlobal_params_st { + CUcoredumpSettings attrib; + void *value; + size_t *size; +} cuCoredumpSetAttributeGlobal_params; + +typedef struct cuGetExportTable_params_st { + const void **ppExportTable; + const CUuuid *pExportTableId; +} cuGetExportTable_params; + +typedef struct cuMemHostRegister_params_st { + void *p; + size_t bytesize; + unsigned int Flags; +} cuMemHostRegister_params; + +typedef struct cuGraphicsResourceSetMapFlags_params_st { + CUgraphicsResource resource; + unsigned int flags; +} cuGraphicsResourceSetMapFlags_params; + +typedef struct cuLinkCreate_params_st { + unsigned int numOptions; + CUjit_option *options; + void **optionValues; + CUlinkState *stateOut; +} cuLinkCreate_params; + +typedef struct cuLinkAddData_params_st { + CUlinkState state; + CUjitInputType type; + void *data; + size_t size; + const char *name; + unsigned int numOptions; + CUjit_option *options; + void **optionValues; +} cuLinkAddData_params; + +typedef struct cuLinkAddFile_params_st { + CUlinkState state; + CUjitInputType type; + const char *path; + unsigned int numOptions; + CUjit_option *options; + void **optionValues; +} cuLinkAddFile_params; + +typedef struct cuTexRefSetAddress2D_v2_params_st { + CUtexref hTexRef; + const CUDA_ARRAY_DESCRIPTOR *desc; + CUdeviceptr dptr; + size_t Pitch; +} cuTexRefSetAddress2D_v2_params; + +typedef struct cuDeviceTotalMem_params_st { + unsigned int *bytes; + CUdevice dev; +} cuDeviceTotalMem_params; + +typedef struct cuCtxCreate_params_st { + CUcontext *pctx; + unsigned int flags; + CUdevice dev; +} cuCtxCreate_params; + +typedef struct cuModuleGetGlobal_params_st { + CUdeviceptr_v1 *dptr; + unsigned int *bytes; + CUmodule hmod; + const char *name; +} cuModuleGetGlobal_params; + +typedef struct cuMemGetInfo_params_st { + unsigned int *free; + unsigned int *total; +} cuMemGetInfo_params; + +typedef struct cuMemAlloc_params_st { + CUdeviceptr_v1 *dptr; + unsigned int bytesize; +} cuMemAlloc_params; + +typedef struct cuMemAllocPitch_params_st { + CUdeviceptr_v1 *dptr; + unsigned int *pPitch; + unsigned int WidthInBytes; + unsigned int Height; + unsigned int ElementSizeBytes; +} cuMemAllocPitch_params; + +typedef struct cuMemFree_params_st { + CUdeviceptr_v1 dptr; +} cuMemFree_params; + +typedef struct cuMemGetAddressRange_params_st { + CUdeviceptr_v1 *pbase; + unsigned int *psize; + CUdeviceptr_v1 dptr; +} cuMemGetAddressRange_params; + +typedef struct cuMemAllocHost_params_st { + void **pp; + unsigned int bytesize; +} cuMemAllocHost_params; + +typedef struct cuMemHostGetDevicePointer_params_st { + CUdeviceptr_v1 *pdptr; + void *p; + unsigned int Flags; +} cuMemHostGetDevicePointer_params; + +typedef struct cuMemcpyHtoD_params_st { + CUdeviceptr_v1 dstDevice; + const void *srcHost; + unsigned int ByteCount; +} cuMemcpyHtoD_params; + +typedef struct cuMemcpyDtoH_params_st { + void *dstHost; + CUdeviceptr_v1 srcDevice; + unsigned int ByteCount; +} cuMemcpyDtoH_params; + +typedef struct cuMemcpyDtoD_params_st { + CUdeviceptr_v1 dstDevice; + CUdeviceptr_v1 srcDevice; + unsigned int ByteCount; +} cuMemcpyDtoD_params; + +typedef struct cuMemcpyDtoA_params_st { + CUarray dstArray; + unsigned int dstOffset; + CUdeviceptr_v1 srcDevice; + unsigned int ByteCount; +} cuMemcpyDtoA_params; + +typedef struct cuMemcpyAtoD_params_st { + CUdeviceptr_v1 dstDevice; + CUarray srcArray; + unsigned int srcOffset; + unsigned int ByteCount; +} cuMemcpyAtoD_params; + +typedef struct cuMemcpyHtoA_params_st { + CUarray dstArray; + unsigned int dstOffset; + const void *srcHost; + unsigned int ByteCount; +} cuMemcpyHtoA_params; + +typedef struct cuMemcpyAtoH_params_st { + void *dstHost; + CUarray srcArray; + unsigned int srcOffset; + unsigned int ByteCount; +} cuMemcpyAtoH_params; + +typedef struct cuMemcpyAtoA_params_st { + CUarray dstArray; + unsigned int dstOffset; + CUarray srcArray; + unsigned int srcOffset; + unsigned int ByteCount; +} cuMemcpyAtoA_params; + +typedef struct cuMemcpyHtoAAsync_params_st { + CUarray dstArray; + unsigned int dstOffset; + const void *srcHost; + unsigned int ByteCount; + CUstream hStream; +} cuMemcpyHtoAAsync_params; + +typedef struct cuMemcpyAtoHAsync_params_st { + void *dstHost; + CUarray srcArray; + unsigned int srcOffset; + unsigned int ByteCount; + CUstream hStream; +} cuMemcpyAtoHAsync_params; + +typedef struct cuMemcpy2D_params_st { + const CUDA_MEMCPY2D_v1 *pCopy; +} cuMemcpy2D_params; + +typedef struct cuMemcpy2DUnaligned_params_st { + const CUDA_MEMCPY2D_v1 *pCopy; +} cuMemcpy2DUnaligned_params; + +typedef struct cuMemcpy3D_params_st { + const CUDA_MEMCPY3D_v1 *pCopy; +} cuMemcpy3D_params; + +typedef struct cuMemcpyHtoDAsync_params_st { + CUdeviceptr_v1 dstDevice; + const void *srcHost; + unsigned int ByteCount; + CUstream hStream; +} cuMemcpyHtoDAsync_params; + +typedef struct cuMemcpyDtoHAsync_params_st { + void *dstHost; + CUdeviceptr_v1 srcDevice; + unsigned int ByteCount; + CUstream hStream; +} cuMemcpyDtoHAsync_params; + +typedef struct cuMemcpyDtoDAsync_params_st { + CUdeviceptr_v1 dstDevice; + CUdeviceptr_v1 srcDevice; + unsigned int ByteCount; + CUstream hStream; +} cuMemcpyDtoDAsync_params; + +typedef struct cuMemcpy2DAsync_params_st { + const CUDA_MEMCPY2D_v1 *pCopy; + CUstream hStream; +} cuMemcpy2DAsync_params; + +typedef struct cuMemcpy3DAsync_params_st { + const CUDA_MEMCPY3D_v1 *pCopy; + CUstream hStream; +} cuMemcpy3DAsync_params; + +typedef struct cuMemsetD8_params_st { + CUdeviceptr_v1 dstDevice; + unsigned char uc; + unsigned int N; +} cuMemsetD8_params; + +typedef struct cuMemsetD16_params_st { + CUdeviceptr_v1 dstDevice; + unsigned short us; + unsigned int N; +} cuMemsetD16_params; + +typedef struct cuMemsetD32_params_st { + CUdeviceptr_v1 dstDevice; + unsigned int ui; + unsigned int N; +} cuMemsetD32_params; + +typedef struct cuMemsetD2D8_params_st { + CUdeviceptr_v1 dstDevice; + unsigned int dstPitch; + unsigned char uc; + unsigned int Width; + unsigned int Height; +} cuMemsetD2D8_params; + +typedef struct cuMemsetD2D16_params_st { + CUdeviceptr_v1 dstDevice; + unsigned int dstPitch; + unsigned short us; + unsigned int Width; + unsigned int Height; +} cuMemsetD2D16_params; + +typedef struct cuMemsetD2D32_params_st { + CUdeviceptr_v1 dstDevice; + unsigned int dstPitch; + unsigned int ui; + unsigned int Width; + unsigned int Height; +} cuMemsetD2D32_params; + +typedef struct cuArrayCreate_params_st { + CUarray *pHandle; + const CUDA_ARRAY_DESCRIPTOR_v1 *pAllocateArray; +} cuArrayCreate_params; + +typedef struct cuArrayGetDescriptor_params_st { + CUDA_ARRAY_DESCRIPTOR_v1 *pArrayDescriptor; + CUarray hArray; +} cuArrayGetDescriptor_params; + +typedef struct cuArray3DCreate_params_st { + CUarray *pHandle; + const CUDA_ARRAY3D_DESCRIPTOR_v1 *pAllocateArray; +} cuArray3DCreate_params; + +typedef struct cuArray3DGetDescriptor_params_st { + CUDA_ARRAY3D_DESCRIPTOR_v1 *pArrayDescriptor; + CUarray hArray; +} cuArray3DGetDescriptor_params; + +typedef struct cuTexRefSetAddress_params_st { + unsigned int *ByteOffset; + CUtexref hTexRef; + CUdeviceptr_v1 dptr; + unsigned int bytes; +} cuTexRefSetAddress_params; + +typedef struct cuTexRefSetAddress2D_params_st { + CUtexref hTexRef; + const CUDA_ARRAY_DESCRIPTOR_v1 *desc; + CUdeviceptr_v1 dptr; + unsigned int Pitch; +} cuTexRefSetAddress2D_params; + +typedef struct cuTexRefGetAddress_params_st { + CUdeviceptr_v1 *pdptr; + CUtexref hTexRef; +} cuTexRefGetAddress_params; + +typedef struct cuGraphicsResourceGetMappedPointer_params_st { + CUdeviceptr_v1 *pDevPtr; + unsigned int *pSize; + CUgraphicsResource resource; +} cuGraphicsResourceGetMappedPointer_params; + +typedef struct cuCtxDestroy_params_st { + CUcontext ctx; +} cuCtxDestroy_params; + +typedef struct cuCtxPopCurrent_params_st { + CUcontext *pctx; +} cuCtxPopCurrent_params; + +typedef struct cuCtxPushCurrent_params_st { + CUcontext ctx; +} cuCtxPushCurrent_params; + +typedef struct cuStreamDestroy_params_st { + CUstream hStream; +} cuStreamDestroy_params; + +typedef struct cuEventDestroy_params_st { + CUevent hEvent; +} cuEventDestroy_params; + +typedef struct cuDevicePrimaryCtxRelease_params_st { + CUdevice dev; +} cuDevicePrimaryCtxRelease_params; + +typedef struct cuDevicePrimaryCtxReset_params_st { + CUdevice dev; +} cuDevicePrimaryCtxReset_params; + +typedef struct cuDevicePrimaryCtxSetFlags_params_st { + CUdevice dev; + unsigned int flags; +} cuDevicePrimaryCtxSetFlags_params; + +typedef struct cuMemcpyHtoD_v2_params_st { + CUdeviceptr dstDevice; + const void *srcHost; + size_t ByteCount; +} cuMemcpyHtoD_v2_params; + +typedef struct cuMemcpyDtoH_v2_params_st { + void *dstHost; + CUdeviceptr srcDevice; + size_t ByteCount; +} cuMemcpyDtoH_v2_params; + +typedef struct cuMemcpyDtoD_v2_params_st { + CUdeviceptr dstDevice; + CUdeviceptr srcDevice; + size_t ByteCount; +} cuMemcpyDtoD_v2_params; + +typedef struct cuMemcpyDtoA_v2_params_st { + CUarray dstArray; + size_t dstOffset; + CUdeviceptr srcDevice; + size_t ByteCount; +} cuMemcpyDtoA_v2_params; + +typedef struct cuMemcpyAtoD_v2_params_st { + CUdeviceptr dstDevice; + CUarray srcArray; + size_t srcOffset; + size_t ByteCount; +} cuMemcpyAtoD_v2_params; + +typedef struct cuMemcpyHtoA_v2_params_st { + CUarray dstArray; + size_t dstOffset; + const void *srcHost; + size_t ByteCount; +} cuMemcpyHtoA_v2_params; + +typedef struct cuMemcpyAtoH_v2_params_st { + void *dstHost; + CUarray srcArray; + size_t srcOffset; + size_t ByteCount; +} cuMemcpyAtoH_v2_params; + +typedef struct cuMemcpyAtoA_v2_params_st { + CUarray dstArray; + size_t dstOffset; + CUarray srcArray; + size_t srcOffset; + size_t ByteCount; +} cuMemcpyAtoA_v2_params; + +typedef struct cuMemcpyHtoAAsync_v2_params_st { + CUarray dstArray; + size_t dstOffset; + const void *srcHost; + size_t ByteCount; + CUstream hStream; +} cuMemcpyHtoAAsync_v2_params; + +typedef struct cuMemcpyAtoHAsync_v2_params_st { + void *dstHost; + CUarray srcArray; + size_t srcOffset; + size_t ByteCount; + CUstream hStream; +} cuMemcpyAtoHAsync_v2_params; + +typedef struct cuMemcpy2D_v2_params_st { + const CUDA_MEMCPY2D *pCopy; +} cuMemcpy2D_v2_params; + +typedef struct cuMemcpy2DUnaligned_v2_params_st { + const CUDA_MEMCPY2D *pCopy; +} cuMemcpy2DUnaligned_v2_params; + +typedef struct cuMemcpy3D_v2_params_st { + const CUDA_MEMCPY3D *pCopy; +} cuMemcpy3D_v2_params; + +typedef struct cuMemcpyHtoDAsync_v2_params_st { + CUdeviceptr dstDevice; + const void *srcHost; + size_t ByteCount; + CUstream hStream; +} cuMemcpyHtoDAsync_v2_params; + +typedef struct cuMemcpyDtoHAsync_v2_params_st { + void *dstHost; + CUdeviceptr srcDevice; + size_t ByteCount; + CUstream hStream; +} cuMemcpyDtoHAsync_v2_params; + +typedef struct cuMemcpyDtoDAsync_v2_params_st { + CUdeviceptr dstDevice; + CUdeviceptr srcDevice; + size_t ByteCount; + CUstream hStream; +} cuMemcpyDtoDAsync_v2_params; + +typedef struct cuMemcpy2DAsync_v2_params_st { + const CUDA_MEMCPY2D *pCopy; + CUstream hStream; +} cuMemcpy2DAsync_v2_params; + +typedef struct cuMemcpy3DAsync_v2_params_st { + const CUDA_MEMCPY3D *pCopy; + CUstream hStream; +} cuMemcpy3DAsync_v2_params; + +typedef struct cuMemsetD8_v2_params_st { + CUdeviceptr dstDevice; + unsigned char uc; + size_t N; +} cuMemsetD8_v2_params; + +typedef struct cuMemsetD16_v2_params_st { + CUdeviceptr dstDevice; + unsigned short us; + size_t N; +} cuMemsetD16_v2_params; + +typedef struct cuMemsetD32_v2_params_st { + CUdeviceptr dstDevice; + unsigned int ui; + size_t N; +} cuMemsetD32_v2_params; + +typedef struct cuMemsetD2D8_v2_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned char uc; + size_t Width; + size_t Height; +} cuMemsetD2D8_v2_params; + +typedef struct cuMemsetD2D16_v2_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned short us; + size_t Width; + size_t Height; +} cuMemsetD2D16_v2_params; + +typedef struct cuMemsetD2D32_v2_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned int ui; + size_t Width; + size_t Height; +} cuMemsetD2D32_v2_params; + +typedef struct cuMemcpy_params_st { + CUdeviceptr dst; + CUdeviceptr src; + size_t ByteCount; +} cuMemcpy_params; + +typedef struct cuMemcpyAsync_params_st { + CUdeviceptr dst; + CUdeviceptr src; + size_t ByteCount; + CUstream hStream; +} cuMemcpyAsync_params; + +typedef struct cuMemcpyPeer_params_st { + CUdeviceptr dstDevice; + CUcontext dstContext; + CUdeviceptr srcDevice; + CUcontext srcContext; + size_t ByteCount; +} cuMemcpyPeer_params; + +typedef struct cuMemcpyPeerAsync_params_st { + CUdeviceptr dstDevice; + CUcontext dstContext; + CUdeviceptr srcDevice; + CUcontext srcContext; + size_t ByteCount; + CUstream hStream; +} cuMemcpyPeerAsync_params; + +typedef struct cuMemcpy3DPeer_params_st { + const CUDA_MEMCPY3D_PEER *pCopy; +} cuMemcpy3DPeer_params; + +typedef struct cuMemcpy3DPeerAsync_params_st { + const CUDA_MEMCPY3D_PEER *pCopy; + CUstream hStream; +} cuMemcpy3DPeerAsync_params; + +typedef struct cuMemsetD8Async_params_st { + CUdeviceptr dstDevice; + unsigned char uc; + size_t N; + CUstream hStream; +} cuMemsetD8Async_params; + +typedef struct cuMemsetD16Async_params_st { + CUdeviceptr dstDevice; + unsigned short us; + size_t N; + CUstream hStream; +} cuMemsetD16Async_params; + +typedef struct cuMemsetD32Async_params_st { + CUdeviceptr dstDevice; + unsigned int ui; + size_t N; + CUstream hStream; +} cuMemsetD32Async_params; + +typedef struct cuMemsetD2D8Async_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned char uc; + size_t Width; + size_t Height; + CUstream hStream; +} cuMemsetD2D8Async_params; + +typedef struct cuMemsetD2D16Async_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned short us; + size_t Width; + size_t Height; + CUstream hStream; +} cuMemsetD2D16Async_params; + +typedef struct cuMemsetD2D32Async_params_st { + CUdeviceptr dstDevice; + size_t dstPitch; + unsigned int ui; + size_t Width; + size_t Height; + CUstream hStream; +} cuMemsetD2D32Async_params; + +typedef struct cuStreamGetPriority_params_st { + CUstream hStream; + int *priority; +} cuStreamGetPriority_params; + +typedef struct cuStreamGetId_params_st { + CUstream hStream; + unsigned long long *streamId; +} cuStreamGetId_params; + +typedef struct cuStreamGetFlags_params_st { + CUstream hStream; + unsigned int *flags; +} cuStreamGetFlags_params; + +typedef struct cuStreamGetCtx_params_st { + CUstream hStream; + CUcontext *pctx; +} cuStreamGetCtx_params; + +typedef struct cuStreamWaitEvent_params_st { + CUstream hStream; + CUevent hEvent; + unsigned int Flags; +} cuStreamWaitEvent_params; + +typedef struct cuStreamAddCallback_params_st { + CUstream hStream; + CUstreamCallback callback; + void *userData; + unsigned int flags; +} cuStreamAddCallback_params; + +typedef struct cuStreamAttachMemAsync_params_st { + CUstream hStream; + CUdeviceptr dptr; + size_t length; + unsigned int flags; +} cuStreamAttachMemAsync_params; + +typedef struct cuStreamQuery_params_st { + CUstream hStream; +} cuStreamQuery_params; + +typedef struct cuStreamSynchronize_params_st { + CUstream hStream; +} cuStreamSynchronize_params; + +typedef struct cuEventRecord_params_st { + CUevent hEvent; + CUstream hStream; +} cuEventRecord_params; + +typedef struct cuEventRecordWithFlags_params_st { + CUevent hEvent; + CUstream hStream; + unsigned int flags; +} cuEventRecordWithFlags_params; + +typedef struct cuLaunchKernel_params_st { + CUfunction f; + unsigned int gridDimX; + unsigned int gridDimY; + unsigned int gridDimZ; + unsigned int blockDimX; + unsigned int blockDimY; + unsigned int blockDimZ; + unsigned int sharedMemBytes; + CUstream hStream; + void **kernelParams; + void **extra; +} cuLaunchKernel_params; + +typedef struct cuLaunchKernelEx_params_st { + const CUlaunchConfig *config; + CUfunction f; + void **kernelParams; + void **extra; +} cuLaunchKernelEx_params; + +typedef struct cuLaunchHostFunc_params_st { + CUstream hStream; + CUhostFn fn; + void *userData; +} cuLaunchHostFunc_params; + +typedef struct cuGraphicsMapResources_params_st { + unsigned int count; + CUgraphicsResource *resources; + CUstream hStream; +} cuGraphicsMapResources_params; + +typedef struct cuGraphicsUnmapResources_params_st { + unsigned int count; + CUgraphicsResource *resources; + CUstream hStream; +} cuGraphicsUnmapResources_params; + +typedef struct cuStreamWriteValue32_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint32_t value; + unsigned int flags; +} cuStreamWriteValue32_params; + +typedef struct cuStreamWaitValue32_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint32_t value; + unsigned int flags; +} cuStreamWaitValue32_params; + +typedef struct cuStreamWriteValue64_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint64_t value; + unsigned int flags; +} cuStreamWriteValue64_params; + +typedef struct cuStreamWaitValue64_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint64_t value; + unsigned int flags; +} cuStreamWaitValue64_params; + +typedef struct cuStreamBatchMemOp_params_st { + CUstream stream; + unsigned int count; + CUstreamBatchMemOpParams *paramArray; + unsigned int flags; +} cuStreamBatchMemOp_params; + +typedef struct cuStreamWriteValue32_v2_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint32_t value; + unsigned int flags; +} cuStreamWriteValue32_v2_params; + +typedef struct cuStreamWaitValue32_v2_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint32_t value; + unsigned int flags; +} cuStreamWaitValue32_v2_params; + +typedef struct cuStreamWriteValue64_v2_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint64_t value; + unsigned int flags; +} cuStreamWriteValue64_v2_params; + +typedef struct cuStreamWaitValue64_v2_params_st { + CUstream stream; + CUdeviceptr addr; + cuuint64_t value; + unsigned int flags; +} cuStreamWaitValue64_v2_params; + +typedef struct cuStreamBatchMemOp_v2_params_st { + CUstream stream; + unsigned int count; + CUstreamBatchMemOpParams *paramArray; + unsigned int flags; +} cuStreamBatchMemOp_v2_params; + +typedef struct cuMemPrefetchAsync_params_st { + CUdeviceptr devPtr; + size_t count; + CUdevice dstDevice; + CUstream hStream; +} cuMemPrefetchAsync_params; + +typedef struct cuLaunchCooperativeKernel_params_st { + CUfunction f; + unsigned int gridDimX; + unsigned int gridDimY; + unsigned int gridDimZ; + unsigned int blockDimX; + unsigned int blockDimY; + unsigned int blockDimZ; + unsigned int sharedMemBytes; + CUstream hStream; + void **kernelParams; +} cuLaunchCooperativeKernel_params; + +typedef struct cuSignalExternalSemaphoresAsync_params_st { + const CUexternalSemaphore *extSemArray; + const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS *paramsArray; + unsigned int numExtSems; + CUstream stream; +} cuSignalExternalSemaphoresAsync_params; + +typedef struct cuWaitExternalSemaphoresAsync_params_st { + const CUexternalSemaphore *extSemArray; + const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS *paramsArray; + unsigned int numExtSems; + CUstream stream; +} cuWaitExternalSemaphoresAsync_params; + +typedef struct cuStreamBeginCapture_params_st { + CUstream hStream; +} cuStreamBeginCapture_params; + +typedef struct cuStreamBeginCapture_ptsz_params_st { + CUstream hStream; +} cuStreamBeginCapture_ptsz_params; + +typedef struct cuStreamBeginCapture_v2_params_st { + CUstream hStream; + CUstreamCaptureMode mode; +} cuStreamBeginCapture_v2_params; + +typedef struct cuStreamEndCapture_params_st { + CUstream hStream; + CUgraph *phGraph; +} cuStreamEndCapture_params; + +typedef struct cuStreamIsCapturing_params_st { + CUstream hStream; + CUstreamCaptureStatus *captureStatus; +} cuStreamIsCapturing_params; + +typedef struct cuStreamGetCaptureInfo_params_st { + CUstream hStream; + CUstreamCaptureStatus *captureStatus_out; + cuuint64_t *id_out; +} cuStreamGetCaptureInfo_params; + +typedef struct cuStreamGetCaptureInfo_v2_params_st { + CUstream hStream; + CUstreamCaptureStatus *captureStatus_out; + cuuint64_t *id_out; + CUgraph *graph_out; + const CUgraphNode **dependencies_out; + size_t *numDependencies_out; +} cuStreamGetCaptureInfo_v2_params; + +typedef struct cuGraphInstantiateWithParams_params_st { + CUgraphExec *phGraphExec; + CUgraph hGraph; + CUDA_GRAPH_INSTANTIATE_PARAMS *instantiateParams; +} cuGraphInstantiateWithParams_params; + +typedef struct cuGraphUpload_params_st { + CUgraphExec hGraph; + CUstream hStream; +} cuGraphUpload_params; + +typedef struct cuGraphLaunch_params_st { + CUgraphExec hGraph; + CUstream hStream; +} cuGraphLaunch_params; + +typedef struct cuStreamCopyAttributes_params_st { + CUstream dstStream; + CUstream srcStream; +} cuStreamCopyAttributes_params; + +typedef struct cuStreamGetAttribute_params_st { + CUstream hStream; + CUstreamAttrID attr; + CUstreamAttrValue *value; +} cuStreamGetAttribute_params; + +typedef struct cuStreamSetAttribute_params_st { + CUstream hStream; + CUstreamAttrID attr; + const CUstreamAttrValue *param; +} cuStreamSetAttribute_params; + +typedef struct cuIpcOpenMemHandle_params_st { + CUdeviceptr *pdptr; + CUipcMemHandle handle; + unsigned int Flags; +} cuIpcOpenMemHandle_params; + +typedef struct cuGraphInstantiate_params_st { + CUgraphExec *phGraphExec; + CUgraph hGraph; + CUgraphNode *phErrorNode; + char *logBuffer; + size_t bufferSize; +} cuGraphInstantiate_params; + +typedef struct cuMemMapArrayAsync_params_st { + CUarrayMapInfo *mapInfoList; + unsigned int count; + CUstream hStream; +} cuMemMapArrayAsync_params; + +typedef struct cuMemFreeAsync_params_st { + CUdeviceptr dptr; + CUstream hStream; +} cuMemFreeAsync_params; + +typedef struct cuMemAllocAsync_params_st { + CUdeviceptr *dptr; + size_t bytesize; + CUstream hStream; +} cuMemAllocAsync_params; + +typedef struct cuMemAllocFromPoolAsync_params_st { + CUdeviceptr *dptr; + size_t bytesize; + CUmemoryPool pool; + CUstream hStream; +} cuMemAllocFromPoolAsync_params; + +typedef struct cuStreamUpdateCaptureDependencies_params_st { + CUstream hStream; + CUgraphNode *dependencies; + size_t numDependencies; + unsigned int flags; +} cuStreamUpdateCaptureDependencies_params; + +typedef struct cuGetProcAddress_params_st { + const char *symbol; + void **pfn; + int cudaVersion; + cuuint64_t flags; +} cuGetProcAddress_params; diff --git a/cuda_toolkit/include/generated_cuda_profiler_api_meta.h b/cuda_toolkit/include/generated_cuda_profiler_api_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..83eea73aac282fad0c43e4967edfa0a6c0c82ecd --- /dev/null +++ b/cuda_toolkit/include/generated_cuda_profiler_api_meta.h @@ -0,0 +1,16 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// CUDA public interface, for type definitions and api function prototypes +#include "cuda_profiler_api.h" + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +// Currently used parameter trace structures + + +// Parameter trace structures for removed functions + + +// End of parameter trace structures diff --git a/cuda_toolkit/include/generated_cuda_runtime_api_meta.h b/cuda_toolkit/include/generated_cuda_runtime_api_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..05b884480e4193c13e78bc0f5ffe26daa06bae58 --- /dev/null +++ b/cuda_toolkit/include/generated_cuda_runtime_api_meta.h @@ -0,0 +1,2192 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// CUDA public interface, for type definitions and api function prototypes +#include "cuda_runtime_api.h" + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +// Currently used parameter trace structures +typedef struct cudaDeviceSetLimit_v3020_params_st { + enum cudaLimit limit; + size_t value; +} cudaDeviceSetLimit_v3020_params; + +typedef struct cudaDeviceGetLimit_v3020_params_st { + size_t *pValue; + enum cudaLimit limit; +} cudaDeviceGetLimit_v3020_params; + +typedef struct cudaDeviceGetTexture1DLinearMaxWidth_v11010_params_st { + size_t *maxWidthInElements; + const struct cudaChannelFormatDesc *fmtDesc; + int device; +} cudaDeviceGetTexture1DLinearMaxWidth_v11010_params; + +typedef struct cudaDeviceGetCacheConfig_v3020_params_st { + enum cudaFuncCache *pCacheConfig; +} cudaDeviceGetCacheConfig_v3020_params; + +typedef struct cudaDeviceGetStreamPriorityRange_v5050_params_st { + int *leastPriority; + int *greatestPriority; +} cudaDeviceGetStreamPriorityRange_v5050_params; + +typedef struct cudaDeviceSetCacheConfig_v3020_params_st { + enum cudaFuncCache cacheConfig; +} cudaDeviceSetCacheConfig_v3020_params; + +typedef struct cudaDeviceGetSharedMemConfig_v4020_params_st { + enum cudaSharedMemConfig *pConfig; +} cudaDeviceGetSharedMemConfig_v4020_params; + +typedef struct cudaDeviceSetSharedMemConfig_v4020_params_st { + enum cudaSharedMemConfig config; +} cudaDeviceSetSharedMemConfig_v4020_params; + +typedef struct cudaDeviceGetByPCIBusId_v4010_params_st { + int *device; + const char *pciBusId; +} cudaDeviceGetByPCIBusId_v4010_params; + +typedef struct cudaDeviceGetPCIBusId_v4010_params_st { + char *pciBusId; + int len; + int device; +} cudaDeviceGetPCIBusId_v4010_params; + +typedef struct cudaIpcGetEventHandle_v4010_params_st { + cudaIpcEventHandle_t *handle; + cudaEvent_t event; +} cudaIpcGetEventHandle_v4010_params; + +typedef struct cudaIpcOpenEventHandle_v4010_params_st { + cudaEvent_t *event; + cudaIpcEventHandle_t handle; +} cudaIpcOpenEventHandle_v4010_params; + +typedef struct cudaIpcGetMemHandle_v4010_params_st { + cudaIpcMemHandle_t *handle; + void *devPtr; +} cudaIpcGetMemHandle_v4010_params; + +typedef struct cudaIpcOpenMemHandle_v4010_params_st { + void **devPtr; + cudaIpcMemHandle_t handle; + unsigned int flags; +} cudaIpcOpenMemHandle_v4010_params; + +typedef struct cudaIpcCloseMemHandle_v4010_params_st { + void *devPtr; +} cudaIpcCloseMemHandle_v4010_params; + +typedef struct cudaDeviceFlushGPUDirectRDMAWrites_v11030_params_st { + enum cudaFlushGPUDirectRDMAWritesTarget target; + enum cudaFlushGPUDirectRDMAWritesScope scope; +} cudaDeviceFlushGPUDirectRDMAWrites_v11030_params; + +typedef struct cudaThreadSetLimit_v3020_params_st { + enum cudaLimit limit; + size_t value; +} cudaThreadSetLimit_v3020_params; + +typedef struct cudaThreadGetLimit_v3020_params_st { + size_t *pValue; + enum cudaLimit limit; +} cudaThreadGetLimit_v3020_params; + +typedef struct cudaThreadGetCacheConfig_v3020_params_st { + enum cudaFuncCache *pCacheConfig; +} cudaThreadGetCacheConfig_v3020_params; + +typedef struct cudaThreadSetCacheConfig_v3020_params_st { + enum cudaFuncCache cacheConfig; +} cudaThreadSetCacheConfig_v3020_params; + +typedef struct cudaGetErrorName_v6050_params_st { + cudaError_t error; +} cudaGetErrorName_v6050_params; + +typedef struct cudaGetErrorString_v3020_params_st { + cudaError_t error; +} cudaGetErrorString_v3020_params; + +typedef struct cudaGetDeviceCount_v3020_params_st { + int *count; +} cudaGetDeviceCount_v3020_params; + +typedef struct cudaGetDeviceProperties_v3020_params_st { + struct cudaDeviceProp *prop; + int device; +} cudaGetDeviceProperties_v3020_params; + +typedef struct cudaDeviceGetAttribute_v5000_params_st { + int *value; + enum cudaDeviceAttr attr; + int device; +} cudaDeviceGetAttribute_v5000_params; + +typedef struct cudaDeviceGetDefaultMemPool_v11020_params_st { + cudaMemPool_t *memPool; + int device; +} cudaDeviceGetDefaultMemPool_v11020_params; + +typedef struct cudaDeviceSetMemPool_v11020_params_st { + int device; + cudaMemPool_t memPool; +} cudaDeviceSetMemPool_v11020_params; + +typedef struct cudaDeviceGetMemPool_v11020_params_st { + cudaMemPool_t *memPool; + int device; +} cudaDeviceGetMemPool_v11020_params; + +typedef struct cudaDeviceGetNvSciSyncAttributes_v10020_params_st { + void *nvSciSyncAttrList; + int device; + int flags; +} cudaDeviceGetNvSciSyncAttributes_v10020_params; + +typedef struct cudaDeviceGetP2PAttribute_v8000_params_st { + int *value; + enum cudaDeviceP2PAttr attr; + int srcDevice; + int dstDevice; +} cudaDeviceGetP2PAttribute_v8000_params; + +typedef struct cudaChooseDevice_v3020_params_st { + int *device; + const struct cudaDeviceProp *prop; +} cudaChooseDevice_v3020_params; + +typedef struct cudaSetDevice_v3020_params_st { + int device; +} cudaSetDevice_v3020_params; + +typedef struct cudaGetDevice_v3020_params_st { + int *device; +} cudaGetDevice_v3020_params; + +typedef struct cudaSetValidDevices_v3020_params_st { + int *device_arr; + int len; +} cudaSetValidDevices_v3020_params; + +typedef struct cudaSetDeviceFlags_v3020_params_st { + unsigned int flags; +} cudaSetDeviceFlags_v3020_params; + +typedef struct cudaGetDeviceFlags_v7000_params_st { + unsigned int *flags; +} cudaGetDeviceFlags_v7000_params; + +typedef struct cudaStreamCreate_v3020_params_st { + cudaStream_t *pStream; +} cudaStreamCreate_v3020_params; + +typedef struct cudaStreamCreateWithFlags_v5000_params_st { + cudaStream_t *pStream; + unsigned int flags; +} cudaStreamCreateWithFlags_v5000_params; + +typedef struct cudaStreamCreateWithPriority_v5050_params_st { + cudaStream_t *pStream; + unsigned int flags; + int priority; +} cudaStreamCreateWithPriority_v5050_params; + +typedef struct cudaStreamGetPriority_ptsz_v7000_params_st { + cudaStream_t hStream; + int *priority; +} cudaStreamGetPriority_ptsz_v7000_params; + +typedef struct cudaStreamGetFlags_ptsz_v7000_params_st { + cudaStream_t hStream; + unsigned int *flags; +} cudaStreamGetFlags_ptsz_v7000_params; + +typedef struct cudaStreamGetId_ptsz_v12000_params_st { + cudaStream_t hStream; + unsigned long long *streamId; +} cudaStreamGetId_ptsz_v12000_params; + +typedef struct cudaStreamCopyAttributes_ptsz_v11000_params_st { + cudaStream_t dst; + cudaStream_t src; +} cudaStreamCopyAttributes_ptsz_v11000_params; + +typedef struct cudaStreamGetAttribute_ptsz_v11000_params_st { + cudaStream_t hStream; + cudaStreamAttrID attr; + cudaStreamAttrValue *value_out; +} cudaStreamGetAttribute_ptsz_v11000_params; + +typedef struct cudaStreamSetAttribute_ptsz_v11000_params_st { + cudaStream_t hStream; + cudaStreamAttrID attr; + const cudaStreamAttrValue *value; +} cudaStreamSetAttribute_ptsz_v11000_params; + +typedef struct cudaStreamDestroy_v5050_params_st { + cudaStream_t stream; +} cudaStreamDestroy_v5050_params; + +typedef struct cudaStreamWaitEvent_ptsz_v7000_params_st { + cudaStream_t stream; + cudaEvent_t event; + unsigned int flags; +} cudaStreamWaitEvent_ptsz_v7000_params; + +typedef struct cudaStreamAddCallback_ptsz_v7000_params_st { + cudaStream_t stream; + cudaStreamCallback_t callback; + void *userData; + unsigned int flags; +} cudaStreamAddCallback_ptsz_v7000_params; + +typedef struct cudaStreamSynchronize_ptsz_v7000_params_st { + cudaStream_t stream; +} cudaStreamSynchronize_ptsz_v7000_params; + +typedef struct cudaStreamQuery_ptsz_v7000_params_st { + cudaStream_t stream; +} cudaStreamQuery_ptsz_v7000_params; + +typedef struct cudaStreamAttachMemAsync_ptsz_v7000_params_st { + cudaStream_t stream; + void *devPtr; + size_t length; + unsigned int flags; +} cudaStreamAttachMemAsync_ptsz_v7000_params; + +typedef struct cudaStreamBeginCapture_ptsz_v10000_params_st { + cudaStream_t stream; + enum cudaStreamCaptureMode mode; +} cudaStreamBeginCapture_ptsz_v10000_params; + +typedef struct cudaThreadExchangeStreamCaptureMode_v10010_params_st { + enum cudaStreamCaptureMode *mode; +} cudaThreadExchangeStreamCaptureMode_v10010_params; + +typedef struct cudaStreamEndCapture_ptsz_v10000_params_st { + cudaStream_t stream; + cudaGraph_t *pGraph; +} cudaStreamEndCapture_ptsz_v10000_params; + +typedef struct cudaStreamIsCapturing_ptsz_v10000_params_st { + cudaStream_t stream; + enum cudaStreamCaptureStatus *pCaptureStatus; +} cudaStreamIsCapturing_ptsz_v10000_params; + +typedef struct cudaStreamGetCaptureInfo_ptsz_v10010_params_st { + cudaStream_t stream; + enum cudaStreamCaptureStatus *pCaptureStatus; + unsigned long long *pId; +} cudaStreamGetCaptureInfo_ptsz_v10010_params; + +typedef struct cudaStreamGetCaptureInfo_v2_ptsz_v11030_params_st { + cudaStream_t stream; + enum cudaStreamCaptureStatus *captureStatus_out; + unsigned long long *id_out; + cudaGraph_t *graph_out; + const cudaGraphNode_t **dependencies_out; + size_t *numDependencies_out; +} cudaStreamGetCaptureInfo_v2_ptsz_v11030_params; + +typedef struct cudaStreamUpdateCaptureDependencies_ptsz_v11030_params_st { + cudaStream_t stream; + cudaGraphNode_t *dependencies; + size_t numDependencies; + unsigned int flags; +} cudaStreamUpdateCaptureDependencies_ptsz_v11030_params; + +typedef struct cudaEventCreate_v3020_params_st { + cudaEvent_t *event; +} cudaEventCreate_v3020_params; + +typedef struct cudaEventCreateWithFlags_v3020_params_st { + cudaEvent_t *event; + unsigned int flags; +} cudaEventCreateWithFlags_v3020_params; + +typedef struct cudaEventRecord_ptsz_v7000_params_st { + cudaEvent_t event; + cudaStream_t stream; +} cudaEventRecord_ptsz_v7000_params; + +typedef struct cudaEventRecordWithFlags_ptsz_v11010_params_st { + cudaEvent_t event; + cudaStream_t stream; + unsigned int flags; +} cudaEventRecordWithFlags_ptsz_v11010_params; + +typedef struct cudaEventQuery_v3020_params_st { + cudaEvent_t event; +} cudaEventQuery_v3020_params; + +typedef struct cudaEventSynchronize_v3020_params_st { + cudaEvent_t event; +} cudaEventSynchronize_v3020_params; + +typedef struct cudaEventDestroy_v3020_params_st { + cudaEvent_t event; +} cudaEventDestroy_v3020_params; + +typedef struct cudaEventElapsedTime_v3020_params_st { + float *ms; + cudaEvent_t start; + cudaEvent_t end; +} cudaEventElapsedTime_v3020_params; + +typedef struct cudaImportExternalMemory_v10000_params_st { + cudaExternalMemory_t *extMem_out; + const struct cudaExternalMemoryHandleDesc *memHandleDesc; +} cudaImportExternalMemory_v10000_params; + +typedef struct cudaExternalMemoryGetMappedBuffer_v10000_params_st { + void **devPtr; + cudaExternalMemory_t extMem; + const struct cudaExternalMemoryBufferDesc *bufferDesc; +} cudaExternalMemoryGetMappedBuffer_v10000_params; + +typedef struct cudaExternalMemoryGetMappedMipmappedArray_v10000_params_st { + cudaMipmappedArray_t *mipmap; + cudaExternalMemory_t extMem; + const struct cudaExternalMemoryMipmappedArrayDesc *mipmapDesc; +} cudaExternalMemoryGetMappedMipmappedArray_v10000_params; + +typedef struct cudaDestroyExternalMemory_v10000_params_st { + cudaExternalMemory_t extMem; +} cudaDestroyExternalMemory_v10000_params; + +typedef struct cudaImportExternalSemaphore_v10000_params_st { + cudaExternalSemaphore_t *extSem_out; + const struct cudaExternalSemaphoreHandleDesc *semHandleDesc; +} cudaImportExternalSemaphore_v10000_params; + +typedef struct cudaSignalExternalSemaphoresAsync_v2_ptsz_v11020_params_st { + const cudaExternalSemaphore_t *extSemArray; + const struct cudaExternalSemaphoreSignalParams *paramsArray; + unsigned int numExtSems; + cudaStream_t stream; +} cudaSignalExternalSemaphoresAsync_v2_ptsz_v11020_params; + +typedef struct cudaWaitExternalSemaphoresAsync_v2_ptsz_v11020_params_st { + const cudaExternalSemaphore_t *extSemArray; + const struct cudaExternalSemaphoreWaitParams *paramsArray; + unsigned int numExtSems; + cudaStream_t stream; +} cudaWaitExternalSemaphoresAsync_v2_ptsz_v11020_params; + +typedef struct cudaDestroyExternalSemaphore_v10000_params_st { + cudaExternalSemaphore_t extSem; +} cudaDestroyExternalSemaphore_v10000_params; + +typedef struct cudaLaunchKernel_ptsz_v7000_params_st { + const void *func; + dim3 gridDim; + dim3 blockDim; + void **args; + size_t sharedMem; + cudaStream_t stream; +} cudaLaunchKernel_ptsz_v7000_params; + +typedef struct cudaLaunchKernelExC_ptsz_v11060_params_st { + const cudaLaunchConfig_t *config; + const void *func; + void **args; +} cudaLaunchKernelExC_ptsz_v11060_params; + +typedef struct cudaLaunchCooperativeKernel_ptsz_v9000_params_st { + const void *func; + dim3 gridDim; + dim3 blockDim; + void **args; + size_t sharedMem; + cudaStream_t stream; +} cudaLaunchCooperativeKernel_ptsz_v9000_params; + +typedef struct cudaLaunchCooperativeKernelMultiDevice_v9000_params_st { + struct cudaLaunchParams *launchParamsList; + unsigned int numDevices; + unsigned int flags; +} cudaLaunchCooperativeKernelMultiDevice_v9000_params; + +typedef struct cudaFuncSetCacheConfig_v3020_params_st { + const void *func; + enum cudaFuncCache cacheConfig; +} cudaFuncSetCacheConfig_v3020_params; + +typedef struct cudaFuncSetSharedMemConfig_v4020_params_st { + const void *func; + enum cudaSharedMemConfig config; +} cudaFuncSetSharedMemConfig_v4020_params; + +typedef struct cudaFuncGetAttributes_v3020_params_st { + struct cudaFuncAttributes *attr; + const void *func; +} cudaFuncGetAttributes_v3020_params; + +typedef struct cudaFuncSetAttribute_v9000_params_st { + const void *func; + enum cudaFuncAttribute attr; + int value; +} cudaFuncSetAttribute_v9000_params; + +typedef struct cudaSetDoubleForDevice_v3020_params_st { + double *d; +} cudaSetDoubleForDevice_v3020_params; + +typedef struct cudaSetDoubleForHost_v3020_params_st { + double *d; +} cudaSetDoubleForHost_v3020_params; + +typedef struct cudaLaunchHostFunc_ptsz_v10000_params_st { + cudaStream_t stream; + cudaHostFn_t fn; + void *userData; +} cudaLaunchHostFunc_ptsz_v10000_params; + +typedef struct cudaOccupancyMaxActiveBlocksPerMultiprocessor_v6050_params_st { + int *numBlocks; + const void *func; + int blockSize; + size_t dynamicSMemSize; +} cudaOccupancyMaxActiveBlocksPerMultiprocessor_v6050_params; + +typedef struct cudaOccupancyAvailableDynamicSMemPerBlock_v10200_params_st { + size_t *dynamicSmemSize; + const void *func; + int numBlocks; + int blockSize; +} cudaOccupancyAvailableDynamicSMemPerBlock_v10200_params; + +typedef struct cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags_v7000_params_st { + int *numBlocks; + const void *func; + int blockSize; + size_t dynamicSMemSize; + unsigned int flags; +} cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags_v7000_params; + +typedef struct cudaOccupancyMaxPotentialClusterSize_v11070_params_st { + int *clusterSize; + const void *func; + const cudaLaunchConfig_t *launchConfig; +} cudaOccupancyMaxPotentialClusterSize_v11070_params; + +typedef struct cudaOccupancyMaxActiveClusters_v11070_params_st { + int *numClusters; + const void *func; + const cudaLaunchConfig_t *launchConfig; +} cudaOccupancyMaxActiveClusters_v11070_params; + +typedef struct cudaMallocManaged_v6000_params_st { + void **devPtr; + size_t size; + unsigned int flags; +} cudaMallocManaged_v6000_params; + +typedef struct cudaMalloc_v3020_params_st { + void **devPtr; + size_t size; +} cudaMalloc_v3020_params; + +typedef struct cudaMallocHost_v3020_params_st { + void **ptr; + size_t size; +} cudaMallocHost_v3020_params; + +typedef struct cudaMallocPitch_v3020_params_st { + void **devPtr; + size_t *pitch; + size_t width; + size_t height; +} cudaMallocPitch_v3020_params; + +typedef struct cudaMallocArray_v3020_params_st { + cudaArray_t *array; + const struct cudaChannelFormatDesc *desc; + size_t width; + size_t height; + unsigned int flags; +} cudaMallocArray_v3020_params; + +typedef struct cudaFree_v3020_params_st { + void *devPtr; +} cudaFree_v3020_params; + +typedef struct cudaFreeHost_v3020_params_st { + void *ptr; +} cudaFreeHost_v3020_params; + +typedef struct cudaFreeArray_v3020_params_st { + cudaArray_t array; +} cudaFreeArray_v3020_params; + +typedef struct cudaFreeMipmappedArray_v5000_params_st { + cudaMipmappedArray_t mipmappedArray; +} cudaFreeMipmappedArray_v5000_params; + +typedef struct cudaHostAlloc_v3020_params_st { + void **pHost; + size_t size; + unsigned int flags; +} cudaHostAlloc_v3020_params; + +typedef struct cudaHostRegister_v4000_params_st { + void *ptr; + size_t size; + unsigned int flags; +} cudaHostRegister_v4000_params; + +typedef struct cudaHostUnregister_v4000_params_st { + void *ptr; +} cudaHostUnregister_v4000_params; + +typedef struct cudaHostGetDevicePointer_v3020_params_st { + void **pDevice; + void *pHost; + unsigned int flags; +} cudaHostGetDevicePointer_v3020_params; + +typedef struct cudaHostGetFlags_v3020_params_st { + unsigned int *pFlags; + void *pHost; +} cudaHostGetFlags_v3020_params; + +typedef struct cudaMalloc3D_v3020_params_st { + struct cudaPitchedPtr *pitchedDevPtr; + struct cudaExtent extent; +} cudaMalloc3D_v3020_params; + +typedef struct cudaMalloc3DArray_v3020_params_st { + cudaArray_t *array; + const struct cudaChannelFormatDesc *desc; + struct cudaExtent extent; + unsigned int flags; +} cudaMalloc3DArray_v3020_params; + +typedef struct cudaMallocMipmappedArray_v5000_params_st { + cudaMipmappedArray_t *mipmappedArray; + const struct cudaChannelFormatDesc *desc; + struct cudaExtent extent; + unsigned int numLevels; + unsigned int flags; +} cudaMallocMipmappedArray_v5000_params; + +typedef struct cudaGetMipmappedArrayLevel_v5000_params_st { + cudaArray_t *levelArray; + cudaMipmappedArray_const_t mipmappedArray; + unsigned int level; +} cudaGetMipmappedArrayLevel_v5000_params; + +typedef struct cudaMemcpy3D_ptds_v7000_params_st { + const struct cudaMemcpy3DParms *p; +} cudaMemcpy3D_ptds_v7000_params; + +typedef struct cudaMemcpy3DPeer_ptds_v7000_params_st { + const struct cudaMemcpy3DPeerParms *p; +} cudaMemcpy3DPeer_ptds_v7000_params; + +typedef struct cudaMemcpy3DAsync_ptsz_v7000_params_st { + const struct cudaMemcpy3DParms *p; + cudaStream_t stream; +} cudaMemcpy3DAsync_ptsz_v7000_params; + +typedef struct cudaMemcpy3DPeerAsync_ptsz_v7000_params_st { + const struct cudaMemcpy3DPeerParms *p; + cudaStream_t stream; +} cudaMemcpy3DPeerAsync_ptsz_v7000_params; + +typedef struct cudaMemGetInfo_v3020_params_st { + size_t *free; + size_t *total; +} cudaMemGetInfo_v3020_params; + +typedef struct cudaArrayGetInfo_v4010_params_st { + struct cudaChannelFormatDesc *desc; + struct cudaExtent *extent; + unsigned int *flags; + cudaArray_t array; +} cudaArrayGetInfo_v4010_params; + +typedef struct cudaArrayGetPlane_v11020_params_st { + cudaArray_t *pPlaneArray; + cudaArray_t hArray; + unsigned int planeIdx; +} cudaArrayGetPlane_v11020_params; + +typedef struct cudaArrayGetMemoryRequirements_v11060_params_st { + struct cudaArrayMemoryRequirements *memoryRequirements; + cudaArray_t array; + int device; +} cudaArrayGetMemoryRequirements_v11060_params; + +typedef struct cudaMipmappedArrayGetMemoryRequirements_v11060_params_st { + struct cudaArrayMemoryRequirements *memoryRequirements; + cudaMipmappedArray_t mipmap; + int device; +} cudaMipmappedArrayGetMemoryRequirements_v11060_params; + +typedef struct cudaArrayGetSparseProperties_v11010_params_st { + struct cudaArraySparseProperties *sparseProperties; + cudaArray_t array; +} cudaArrayGetSparseProperties_v11010_params; + +typedef struct cudaMipmappedArrayGetSparseProperties_v11010_params_st { + struct cudaArraySparseProperties *sparseProperties; + cudaMipmappedArray_t mipmap; +} cudaMipmappedArrayGetSparseProperties_v11010_params; + +typedef struct cudaMemcpy_ptds_v7000_params_st { + void *dst; + const void *src; + size_t count; + enum cudaMemcpyKind kind; +} cudaMemcpy_ptds_v7000_params; + +typedef struct cudaMemcpyPeer_v4000_params_st { + void *dst; + int dstDevice; + const void *src; + int srcDevice; + size_t count; +} cudaMemcpyPeer_v4000_params; + +typedef struct cudaMemcpy2D_ptds_v7000_params_st { + void *dst; + size_t dpitch; + const void *src; + size_t spitch; + size_t width; + size_t height; + enum cudaMemcpyKind kind; +} cudaMemcpy2D_ptds_v7000_params; + +typedef struct cudaMemcpy2DToArray_ptds_v7000_params_st { + cudaArray_t dst; + size_t wOffset; + size_t hOffset; + const void *src; + size_t spitch; + size_t width; + size_t height; + enum cudaMemcpyKind kind; +} cudaMemcpy2DToArray_ptds_v7000_params; + +typedef struct cudaMemcpy2DFromArray_ptds_v7000_params_st { + void *dst; + size_t dpitch; + cudaArray_const_t src; + size_t wOffset; + size_t hOffset; + size_t width; + size_t height; + enum cudaMemcpyKind kind; +} cudaMemcpy2DFromArray_ptds_v7000_params; + +typedef struct cudaMemcpy2DArrayToArray_ptds_v7000_params_st { + cudaArray_t dst; + size_t wOffsetDst; + size_t hOffsetDst; + cudaArray_const_t src; + size_t wOffsetSrc; + size_t hOffsetSrc; + size_t width; + size_t height; + enum cudaMemcpyKind kind; +} cudaMemcpy2DArrayToArray_ptds_v7000_params; + +typedef struct cudaMemcpyToSymbol_ptds_v7000_params_st { + const void *symbol; + const void *src; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; +} cudaMemcpyToSymbol_ptds_v7000_params; + +typedef struct cudaMemcpyFromSymbol_ptds_v7000_params_st { + void *dst; + const void *symbol; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; +} cudaMemcpyFromSymbol_ptds_v7000_params; + +typedef struct cudaMemcpyAsync_ptsz_v7000_params_st { + void *dst; + const void *src; + size_t count; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpyAsync_ptsz_v7000_params; + +typedef struct cudaMemcpyPeerAsync_v4000_params_st { + void *dst; + int dstDevice; + const void *src; + int srcDevice; + size_t count; + cudaStream_t stream; +} cudaMemcpyPeerAsync_v4000_params; + +typedef struct cudaMemcpy2DAsync_ptsz_v7000_params_st { + void *dst; + size_t dpitch; + const void *src; + size_t spitch; + size_t width; + size_t height; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpy2DAsync_ptsz_v7000_params; + +typedef struct cudaMemcpy2DToArrayAsync_ptsz_v7000_params_st { + cudaArray_t dst; + size_t wOffset; + size_t hOffset; + const void *src; + size_t spitch; + size_t width; + size_t height; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpy2DToArrayAsync_ptsz_v7000_params; + +typedef struct cudaMemcpy2DFromArrayAsync_ptsz_v7000_params_st { + void *dst; + size_t dpitch; + cudaArray_const_t src; + size_t wOffset; + size_t hOffset; + size_t width; + size_t height; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpy2DFromArrayAsync_ptsz_v7000_params; + +typedef struct cudaMemcpyToSymbolAsync_ptsz_v7000_params_st { + const void *symbol; + const void *src; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpyToSymbolAsync_ptsz_v7000_params; + +typedef struct cudaMemcpyFromSymbolAsync_ptsz_v7000_params_st { + void *dst; + const void *symbol; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpyFromSymbolAsync_ptsz_v7000_params; + +typedef struct cudaMemset_ptds_v7000_params_st { + void *devPtr; + int value; + size_t count; +} cudaMemset_ptds_v7000_params; + +typedef struct cudaMemset2D_ptds_v7000_params_st { + void *devPtr; + size_t pitch; + int value; + size_t width; + size_t height; +} cudaMemset2D_ptds_v7000_params; + +typedef struct cudaMemset3D_ptds_v7000_params_st { + struct cudaPitchedPtr pitchedDevPtr; + int value; + struct cudaExtent extent; +} cudaMemset3D_ptds_v7000_params; + +typedef struct cudaMemsetAsync_ptsz_v7000_params_st { + void *devPtr; + int value; + size_t count; + cudaStream_t stream; +} cudaMemsetAsync_ptsz_v7000_params; + +typedef struct cudaMemset2DAsync_ptsz_v7000_params_st { + void *devPtr; + size_t pitch; + int value; + size_t width; + size_t height; + cudaStream_t stream; +} cudaMemset2DAsync_ptsz_v7000_params; + +typedef struct cudaMemset3DAsync_ptsz_v7000_params_st { + struct cudaPitchedPtr pitchedDevPtr; + int value; + struct cudaExtent extent; + cudaStream_t stream; +} cudaMemset3DAsync_ptsz_v7000_params; + +typedef struct cudaGetSymbolAddress_v3020_params_st { + void **devPtr; + const void *symbol; +} cudaGetSymbolAddress_v3020_params; + +typedef struct cudaGetSymbolSize_v3020_params_st { + size_t *size; + const void *symbol; +} cudaGetSymbolSize_v3020_params; + +typedef struct cudaMemPrefetchAsync_ptsz_v8000_params_st { + const void *devPtr; + size_t count; + int dstDevice; + cudaStream_t stream; +} cudaMemPrefetchAsync_ptsz_v8000_params; + +typedef struct cudaMemAdvise_v8000_params_st { + const void *devPtr; + size_t count; + enum cudaMemoryAdvise advice; + int device; +} cudaMemAdvise_v8000_params; + +typedef struct cudaMemRangeGetAttribute_v8000_params_st { + void *data; + size_t dataSize; + enum cudaMemRangeAttribute attribute; + const void *devPtr; + size_t count; +} cudaMemRangeGetAttribute_v8000_params; + +typedef struct cudaMemRangeGetAttributes_v8000_params_st { + void **data; + size_t *dataSizes; + enum cudaMemRangeAttribute *attributes; + size_t numAttributes; + const void *devPtr; + size_t count; +} cudaMemRangeGetAttributes_v8000_params; + +typedef struct cudaMemcpyToArray_ptds_v7000_params_st { + cudaArray_t dst; + size_t wOffset; + size_t hOffset; + const void *src; + size_t count; + enum cudaMemcpyKind kind; +} cudaMemcpyToArray_ptds_v7000_params; + +typedef struct cudaMemcpyFromArray_ptds_v7000_params_st { + void *dst; + cudaArray_const_t src; + size_t wOffset; + size_t hOffset; + size_t count; + enum cudaMemcpyKind kind; +} cudaMemcpyFromArray_ptds_v7000_params; + +typedef struct cudaMemcpyArrayToArray_ptds_v7000_params_st { + cudaArray_t dst; + size_t wOffsetDst; + size_t hOffsetDst; + cudaArray_const_t src; + size_t wOffsetSrc; + size_t hOffsetSrc; + size_t count; + enum cudaMemcpyKind kind; +} cudaMemcpyArrayToArray_ptds_v7000_params; + +typedef struct cudaMemcpyToArrayAsync_ptsz_v7000_params_st { + cudaArray_t dst; + size_t wOffset; + size_t hOffset; + const void *src; + size_t count; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpyToArrayAsync_ptsz_v7000_params; + +typedef struct cudaMemcpyFromArrayAsync_ptsz_v7000_params_st { + void *dst; + cudaArray_const_t src; + size_t wOffset; + size_t hOffset; + size_t count; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpyFromArrayAsync_ptsz_v7000_params; + +typedef struct cudaMallocAsync_ptsz_v11020_params_st { + void **devPtr; + size_t size; + cudaStream_t hStream; +} cudaMallocAsync_ptsz_v11020_params; + +typedef struct cudaFreeAsync_ptsz_v11020_params_st { + void *devPtr; + cudaStream_t hStream; +} cudaFreeAsync_ptsz_v11020_params; + +typedef struct cudaMemPoolTrimTo_v11020_params_st { + cudaMemPool_t memPool; + size_t minBytesToKeep; +} cudaMemPoolTrimTo_v11020_params; + +typedef struct cudaMemPoolSetAttribute_v11020_params_st { + cudaMemPool_t memPool; + enum cudaMemPoolAttr attr; + void *value; +} cudaMemPoolSetAttribute_v11020_params; + +typedef struct cudaMemPoolGetAttribute_v11020_params_st { + cudaMemPool_t memPool; + enum cudaMemPoolAttr attr; + void *value; +} cudaMemPoolGetAttribute_v11020_params; + +typedef struct cudaMemPoolSetAccess_v11020_params_st { + cudaMemPool_t memPool; + const struct cudaMemAccessDesc *descList; + size_t count; +} cudaMemPoolSetAccess_v11020_params; + +typedef struct cudaMemPoolGetAccess_v11020_params_st { + enum cudaMemAccessFlags *flags; + cudaMemPool_t memPool; + struct cudaMemLocation *location; +} cudaMemPoolGetAccess_v11020_params; + +typedef struct cudaMemPoolCreate_v11020_params_st { + cudaMemPool_t *memPool; + const struct cudaMemPoolProps *poolProps; +} cudaMemPoolCreate_v11020_params; + +typedef struct cudaMemPoolDestroy_v11020_params_st { + cudaMemPool_t memPool; +} cudaMemPoolDestroy_v11020_params; + +typedef struct cudaMallocFromPoolAsync_ptsz_v11020_params_st { + void **ptr; + size_t size; + cudaMemPool_t memPool; + cudaStream_t stream; +} cudaMallocFromPoolAsync_ptsz_v11020_params; + +typedef struct cudaMemPoolExportToShareableHandle_v11020_params_st { + void *shareableHandle; + cudaMemPool_t memPool; + enum cudaMemAllocationHandleType handleType; + unsigned int flags; +} cudaMemPoolExportToShareableHandle_v11020_params; + +typedef struct cudaMemPoolImportFromShareableHandle_v11020_params_st { + cudaMemPool_t *memPool; + void *shareableHandle; + enum cudaMemAllocationHandleType handleType; + unsigned int flags; +} cudaMemPoolImportFromShareableHandle_v11020_params; + +typedef struct cudaMemPoolExportPointer_v11020_params_st { + struct cudaMemPoolPtrExportData *exportData; + void *ptr; +} cudaMemPoolExportPointer_v11020_params; + +typedef struct cudaMemPoolImportPointer_v11020_params_st { + void **ptr; + cudaMemPool_t memPool; + struct cudaMemPoolPtrExportData *exportData; +} cudaMemPoolImportPointer_v11020_params; + +typedef struct cudaPointerGetAttributes_v4000_params_st { + struct cudaPointerAttributes *attributes; + const void *ptr; +} cudaPointerGetAttributes_v4000_params; + +typedef struct cudaDeviceCanAccessPeer_v4000_params_st { + int *canAccessPeer; + int device; + int peerDevice; +} cudaDeviceCanAccessPeer_v4000_params; + +typedef struct cudaDeviceEnablePeerAccess_v4000_params_st { + int peerDevice; + unsigned int flags; +} cudaDeviceEnablePeerAccess_v4000_params; + +typedef struct cudaDeviceDisablePeerAccess_v4000_params_st { + int peerDevice; +} cudaDeviceDisablePeerAccess_v4000_params; + +typedef struct cudaGraphicsUnregisterResource_v3020_params_st { + cudaGraphicsResource_t resource; +} cudaGraphicsUnregisterResource_v3020_params; + +typedef struct cudaGraphicsResourceSetMapFlags_v3020_params_st { + cudaGraphicsResource_t resource; + unsigned int flags; +} cudaGraphicsResourceSetMapFlags_v3020_params; + +typedef struct cudaGraphicsMapResources_v3020_params_st { + int count; + cudaGraphicsResource_t *resources; + cudaStream_t stream; +} cudaGraphicsMapResources_v3020_params; + +typedef struct cudaGraphicsUnmapResources_v3020_params_st { + int count; + cudaGraphicsResource_t *resources; + cudaStream_t stream; +} cudaGraphicsUnmapResources_v3020_params; + +typedef struct cudaGraphicsResourceGetMappedPointer_v3020_params_st { + void **devPtr; + size_t *size; + cudaGraphicsResource_t resource; +} cudaGraphicsResourceGetMappedPointer_v3020_params; + +typedef struct cudaGraphicsSubResourceGetMappedArray_v3020_params_st { + cudaArray_t *array; + cudaGraphicsResource_t resource; + unsigned int arrayIndex; + unsigned int mipLevel; +} cudaGraphicsSubResourceGetMappedArray_v3020_params; + +typedef struct cudaGraphicsResourceGetMappedMipmappedArray_v5000_params_st { + cudaMipmappedArray_t *mipmappedArray; + cudaGraphicsResource_t resource; +} cudaGraphicsResourceGetMappedMipmappedArray_v5000_params; + +typedef struct cudaBindTexture_v3020_params_st { + size_t *offset; + const struct textureReference *texref; + const void *devPtr; + const struct cudaChannelFormatDesc *desc; + size_t size; +} cudaBindTexture_v3020_params; + +typedef struct cudaBindTexture2D_v3020_params_st { + size_t *offset; + const struct textureReference *texref; + const void *devPtr; + const struct cudaChannelFormatDesc *desc; + size_t width; + size_t height; + size_t pitch; +} cudaBindTexture2D_v3020_params; + +typedef struct cudaBindTextureToArray_v3020_params_st { + const struct textureReference *texref; + cudaArray_const_t array; + const struct cudaChannelFormatDesc *desc; +} cudaBindTextureToArray_v3020_params; + +typedef struct cudaBindTextureToMipmappedArray_v5000_params_st { + const struct textureReference *texref; + cudaMipmappedArray_const_t mipmappedArray; + const struct cudaChannelFormatDesc *desc; +} cudaBindTextureToMipmappedArray_v5000_params; + +typedef struct cudaUnbindTexture_v3020_params_st { + const struct textureReference *texref; +} cudaUnbindTexture_v3020_params; + +typedef struct cudaGetTextureAlignmentOffset_v3020_params_st { + size_t *offset; + const struct textureReference *texref; +} cudaGetTextureAlignmentOffset_v3020_params; + +typedef struct cudaGetTextureReference_v3020_params_st { + const struct textureReference **texref; + const void *symbol; +} cudaGetTextureReference_v3020_params; + +typedef struct cudaBindSurfaceToArray_v3020_params_st { + const struct surfaceReference *surfref; + cudaArray_const_t array; + const struct cudaChannelFormatDesc *desc; +} cudaBindSurfaceToArray_v3020_params; + +typedef struct cudaGetSurfaceReference_v3020_params_st { + const struct surfaceReference **surfref; + const void *symbol; +} cudaGetSurfaceReference_v3020_params; + +typedef struct cudaGetChannelDesc_v3020_params_st { + struct cudaChannelFormatDesc *desc; + cudaArray_const_t array; +} cudaGetChannelDesc_v3020_params; + +typedef struct cudaCreateChannelDesc_v3020_params_st { + int x; + int y; + int z; + int w; + enum cudaChannelFormatKind f; +} cudaCreateChannelDesc_v3020_params; + +typedef struct cudaCreateTextureObject_v5000_params_st { + cudaTextureObject_t *pTexObject; + const struct cudaResourceDesc *pResDesc; + const struct cudaTextureDesc *pTexDesc; + const struct cudaResourceViewDesc *pResViewDesc; +} cudaCreateTextureObject_v5000_params; + +typedef struct cudaDestroyTextureObject_v5000_params_st { + cudaTextureObject_t texObject; +} cudaDestroyTextureObject_v5000_params; + +typedef struct cudaGetTextureObjectResourceDesc_v5000_params_st { + struct cudaResourceDesc *pResDesc; + cudaTextureObject_t texObject; +} cudaGetTextureObjectResourceDesc_v5000_params; + +typedef struct cudaGetTextureObjectTextureDesc_v5000_params_st { + struct cudaTextureDesc *pTexDesc; + cudaTextureObject_t texObject; +} cudaGetTextureObjectTextureDesc_v5000_params; + +typedef struct cudaGetTextureObjectResourceViewDesc_v5000_params_st { + struct cudaResourceViewDesc *pResViewDesc; + cudaTextureObject_t texObject; +} cudaGetTextureObjectResourceViewDesc_v5000_params; + +typedef struct cudaCreateSurfaceObject_v5000_params_st { + cudaSurfaceObject_t *pSurfObject; + const struct cudaResourceDesc *pResDesc; +} cudaCreateSurfaceObject_v5000_params; + +typedef struct cudaDestroySurfaceObject_v5000_params_st { + cudaSurfaceObject_t surfObject; +} cudaDestroySurfaceObject_v5000_params; + +typedef struct cudaGetSurfaceObjectResourceDesc_v5000_params_st { + struct cudaResourceDesc *pResDesc; + cudaSurfaceObject_t surfObject; +} cudaGetSurfaceObjectResourceDesc_v5000_params; + +typedef struct cudaDriverGetVersion_v3020_params_st { + int *driverVersion; +} cudaDriverGetVersion_v3020_params; + +typedef struct cudaRuntimeGetVersion_v3020_params_st { + int *runtimeVersion; +} cudaRuntimeGetVersion_v3020_params; + +typedef struct cudaGraphCreate_v10000_params_st { + cudaGraph_t *pGraph; + unsigned int flags; +} cudaGraphCreate_v10000_params; + +typedef struct cudaGraphAddKernelNode_v10000_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + const struct cudaKernelNodeParams *pNodeParams; +} cudaGraphAddKernelNode_v10000_params; + +typedef struct cudaGraphKernelNodeGetParams_v10000_params_st { + cudaGraphNode_t node; + struct cudaKernelNodeParams *pNodeParams; +} cudaGraphKernelNodeGetParams_v10000_params; + +typedef struct cudaGraphKernelNodeSetParams_v10000_params_st { + cudaGraphNode_t node; + const struct cudaKernelNodeParams *pNodeParams; +} cudaGraphKernelNodeSetParams_v10000_params; + +typedef struct cudaGraphKernelNodeCopyAttributes_v11000_params_st { + cudaGraphNode_t hSrc; + cudaGraphNode_t hDst; +} cudaGraphKernelNodeCopyAttributes_v11000_params; + +typedef struct cudaGraphKernelNodeGetAttribute_v11000_params_st { + cudaGraphNode_t hNode; + cudaKernelNodeAttrID attr; + cudaKernelNodeAttrValue *value_out; +} cudaGraphKernelNodeGetAttribute_v11000_params; + +typedef struct cudaGraphKernelNodeSetAttribute_v11000_params_st { + cudaGraphNode_t hNode; + cudaKernelNodeAttrID attr; + const cudaKernelNodeAttrValue *value; +} cudaGraphKernelNodeSetAttribute_v11000_params; + +typedef struct cudaGraphAddMemcpyNode_v10000_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + const struct cudaMemcpy3DParms *pCopyParams; +} cudaGraphAddMemcpyNode_v10000_params; + +typedef struct cudaGraphAddMemcpyNodeToSymbol_v11010_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + const void *symbol; + const void *src; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; +} cudaGraphAddMemcpyNodeToSymbol_v11010_params; + +typedef struct cudaGraphAddMemcpyNodeFromSymbol_v11010_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + void *dst; + const void *symbol; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; +} cudaGraphAddMemcpyNodeFromSymbol_v11010_params; + +typedef struct cudaGraphAddMemcpyNode1D_v11010_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + void *dst; + const void *src; + size_t count; + enum cudaMemcpyKind kind; +} cudaGraphAddMemcpyNode1D_v11010_params; + +typedef struct cudaGraphMemcpyNodeGetParams_v10000_params_st { + cudaGraphNode_t node; + struct cudaMemcpy3DParms *pNodeParams; +} cudaGraphMemcpyNodeGetParams_v10000_params; + +typedef struct cudaGraphMemcpyNodeSetParams_v10000_params_st { + cudaGraphNode_t node; + const struct cudaMemcpy3DParms *pNodeParams; +} cudaGraphMemcpyNodeSetParams_v10000_params; + +typedef struct cudaGraphMemcpyNodeSetParamsToSymbol_v11010_params_st { + cudaGraphNode_t node; + const void *symbol; + const void *src; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; +} cudaGraphMemcpyNodeSetParamsToSymbol_v11010_params; + +typedef struct cudaGraphMemcpyNodeSetParamsFromSymbol_v11010_params_st { + cudaGraphNode_t node; + void *dst; + const void *symbol; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; +} cudaGraphMemcpyNodeSetParamsFromSymbol_v11010_params; + +typedef struct cudaGraphMemcpyNodeSetParams1D_v11010_params_st { + cudaGraphNode_t node; + void *dst; + const void *src; + size_t count; + enum cudaMemcpyKind kind; +} cudaGraphMemcpyNodeSetParams1D_v11010_params; + +typedef struct cudaGraphAddMemsetNode_v10000_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + const struct cudaMemsetParams *pMemsetParams; +} cudaGraphAddMemsetNode_v10000_params; + +typedef struct cudaGraphMemsetNodeGetParams_v10000_params_st { + cudaGraphNode_t node; + struct cudaMemsetParams *pNodeParams; +} cudaGraphMemsetNodeGetParams_v10000_params; + +typedef struct cudaGraphMemsetNodeSetParams_v10000_params_st { + cudaGraphNode_t node; + const struct cudaMemsetParams *pNodeParams; +} cudaGraphMemsetNodeSetParams_v10000_params; + +typedef struct cudaGraphAddHostNode_v10000_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + const struct cudaHostNodeParams *pNodeParams; +} cudaGraphAddHostNode_v10000_params; + +typedef struct cudaGraphHostNodeGetParams_v10000_params_st { + cudaGraphNode_t node; + struct cudaHostNodeParams *pNodeParams; +} cudaGraphHostNodeGetParams_v10000_params; + +typedef struct cudaGraphHostNodeSetParams_v10000_params_st { + cudaGraphNode_t node; + const struct cudaHostNodeParams *pNodeParams; +} cudaGraphHostNodeSetParams_v10000_params; + +typedef struct cudaGraphAddChildGraphNode_v10000_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + cudaGraph_t childGraph; +} cudaGraphAddChildGraphNode_v10000_params; + +typedef struct cudaGraphChildGraphNodeGetGraph_v10000_params_st { + cudaGraphNode_t node; + cudaGraph_t *pGraph; +} cudaGraphChildGraphNodeGetGraph_v10000_params; + +typedef struct cudaGraphAddEmptyNode_v10000_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; +} cudaGraphAddEmptyNode_v10000_params; + +typedef struct cudaGraphAddEventRecordNode_v11010_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + cudaEvent_t event; +} cudaGraphAddEventRecordNode_v11010_params; + +typedef struct cudaGraphEventRecordNodeGetEvent_v11010_params_st { + cudaGraphNode_t node; + cudaEvent_t *event_out; +} cudaGraphEventRecordNodeGetEvent_v11010_params; + +typedef struct cudaGraphEventRecordNodeSetEvent_v11010_params_st { + cudaGraphNode_t node; + cudaEvent_t event; +} cudaGraphEventRecordNodeSetEvent_v11010_params; + +typedef struct cudaGraphAddEventWaitNode_v11010_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + cudaEvent_t event; +} cudaGraphAddEventWaitNode_v11010_params; + +typedef struct cudaGraphEventWaitNodeGetEvent_v11010_params_st { + cudaGraphNode_t node; + cudaEvent_t *event_out; +} cudaGraphEventWaitNodeGetEvent_v11010_params; + +typedef struct cudaGraphEventWaitNodeSetEvent_v11010_params_st { + cudaGraphNode_t node; + cudaEvent_t event; +} cudaGraphEventWaitNodeSetEvent_v11010_params; + +typedef struct cudaGraphAddExternalSemaphoresSignalNode_v11020_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + const struct cudaExternalSemaphoreSignalNodeParams *nodeParams; +} cudaGraphAddExternalSemaphoresSignalNode_v11020_params; + +typedef struct cudaGraphExternalSemaphoresSignalNodeGetParams_v11020_params_st { + cudaGraphNode_t hNode; + struct cudaExternalSemaphoreSignalNodeParams *params_out; +} cudaGraphExternalSemaphoresSignalNodeGetParams_v11020_params; + +typedef struct cudaGraphExternalSemaphoresSignalNodeSetParams_v11020_params_st { + cudaGraphNode_t hNode; + const struct cudaExternalSemaphoreSignalNodeParams *nodeParams; +} cudaGraphExternalSemaphoresSignalNodeSetParams_v11020_params; + +typedef struct cudaGraphAddExternalSemaphoresWaitNode_v11020_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + const struct cudaExternalSemaphoreWaitNodeParams *nodeParams; +} cudaGraphAddExternalSemaphoresWaitNode_v11020_params; + +typedef struct cudaGraphExternalSemaphoresWaitNodeGetParams_v11020_params_st { + cudaGraphNode_t hNode; + struct cudaExternalSemaphoreWaitNodeParams *params_out; +} cudaGraphExternalSemaphoresWaitNodeGetParams_v11020_params; + +typedef struct cudaGraphExternalSemaphoresWaitNodeSetParams_v11020_params_st { + cudaGraphNode_t hNode; + const struct cudaExternalSemaphoreWaitNodeParams *nodeParams; +} cudaGraphExternalSemaphoresWaitNodeSetParams_v11020_params; + +typedef struct cudaGraphAddMemAllocNode_v11040_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + struct cudaMemAllocNodeParams *nodeParams; +} cudaGraphAddMemAllocNode_v11040_params; + +typedef struct cudaGraphMemAllocNodeGetParams_v11040_params_st { + cudaGraphNode_t node; + struct cudaMemAllocNodeParams *params_out; +} cudaGraphMemAllocNodeGetParams_v11040_params; + +typedef struct cudaGraphAddMemFreeNode_v11040_params_st { + cudaGraphNode_t *pGraphNode; + cudaGraph_t graph; + const cudaGraphNode_t *pDependencies; + size_t numDependencies; + void *dptr; +} cudaGraphAddMemFreeNode_v11040_params; + +typedef struct cudaGraphMemFreeNodeGetParams_v11040_params_st { + cudaGraphNode_t node; + void *dptr_out; +} cudaGraphMemFreeNodeGetParams_v11040_params; + +typedef struct cudaDeviceGraphMemTrim_v11040_params_st { + int device; +} cudaDeviceGraphMemTrim_v11040_params; + +typedef struct cudaDeviceGetGraphMemAttribute_v11040_params_st { + int device; + enum cudaGraphMemAttributeType attr; + void *value; +} cudaDeviceGetGraphMemAttribute_v11040_params; + +typedef struct cudaDeviceSetGraphMemAttribute_v11040_params_st { + int device; + enum cudaGraphMemAttributeType attr; + void *value; +} cudaDeviceSetGraphMemAttribute_v11040_params; + +typedef struct cudaGraphClone_v10000_params_st { + cudaGraph_t *pGraphClone; + cudaGraph_t originalGraph; +} cudaGraphClone_v10000_params; + +typedef struct cudaGraphNodeFindInClone_v10000_params_st { + cudaGraphNode_t *pNode; + cudaGraphNode_t originalNode; + cudaGraph_t clonedGraph; +} cudaGraphNodeFindInClone_v10000_params; + +typedef struct cudaGraphNodeGetType_v10000_params_st { + cudaGraphNode_t node; + enum cudaGraphNodeType *pType; +} cudaGraphNodeGetType_v10000_params; + +typedef struct cudaGraphGetNodes_v10000_params_st { + cudaGraph_t graph; + cudaGraphNode_t *nodes; + size_t *numNodes; +} cudaGraphGetNodes_v10000_params; + +typedef struct cudaGraphGetRootNodes_v10000_params_st { + cudaGraph_t graph; + cudaGraphNode_t *pRootNodes; + size_t *pNumRootNodes; +} cudaGraphGetRootNodes_v10000_params; + +typedef struct cudaGraphGetEdges_v10000_params_st { + cudaGraph_t graph; + cudaGraphNode_t *from; + cudaGraphNode_t *to; + size_t *numEdges; +} cudaGraphGetEdges_v10000_params; + +typedef struct cudaGraphNodeGetDependencies_v10000_params_st { + cudaGraphNode_t node; + cudaGraphNode_t *pDependencies; + size_t *pNumDependencies; +} cudaGraphNodeGetDependencies_v10000_params; + +typedef struct cudaGraphNodeGetDependentNodes_v10000_params_st { + cudaGraphNode_t node; + cudaGraphNode_t *pDependentNodes; + size_t *pNumDependentNodes; +} cudaGraphNodeGetDependentNodes_v10000_params; + +typedef struct cudaGraphAddDependencies_v10000_params_st { + cudaGraph_t graph; + const cudaGraphNode_t *from; + const cudaGraphNode_t *to; + size_t numDependencies; +} cudaGraphAddDependencies_v10000_params; + +typedef struct cudaGraphRemoveDependencies_v10000_params_st { + cudaGraph_t graph; + const cudaGraphNode_t *from; + const cudaGraphNode_t *to; + size_t numDependencies; +} cudaGraphRemoveDependencies_v10000_params; + +typedef struct cudaGraphDestroyNode_v10000_params_st { + cudaGraphNode_t node; +} cudaGraphDestroyNode_v10000_params; + +typedef struct cudaGraphInstantiate_v12000_params_st { + cudaGraphExec_t *pGraphExec; + cudaGraph_t graph; + unsigned long long flags; +} cudaGraphInstantiate_v12000_params; + +typedef struct cudaGraphInstantiateWithFlags_v11040_params_st { + cudaGraphExec_t *pGraphExec; + cudaGraph_t graph; + unsigned long long flags; +} cudaGraphInstantiateWithFlags_v11040_params; + +typedef struct cudaGraphInstantiateWithParams_ptsz_v12000_params_st { + cudaGraphExec_t *pGraphExec; + cudaGraph_t graph; + cudaGraphInstantiateParams *instantiateParams; +} cudaGraphInstantiateWithParams_ptsz_v12000_params; + +typedef struct cudaGraphExecGetFlags_v12000_params_st { + cudaGraphExec_t graphExec; + unsigned long long *flags; +} cudaGraphExecGetFlags_v12000_params; + +typedef struct cudaGraphExecKernelNodeSetParams_v10010_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t node; + const struct cudaKernelNodeParams *pNodeParams; +} cudaGraphExecKernelNodeSetParams_v10010_params; + +typedef struct cudaGraphExecMemcpyNodeSetParams_v10020_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t node; + const struct cudaMemcpy3DParms *pNodeParams; +} cudaGraphExecMemcpyNodeSetParams_v10020_params; + +typedef struct cudaGraphExecMemcpyNodeSetParamsToSymbol_v11010_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t node; + const void *symbol; + const void *src; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; +} cudaGraphExecMemcpyNodeSetParamsToSymbol_v11010_params; + +typedef struct cudaGraphExecMemcpyNodeSetParamsFromSymbol_v11010_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t node; + void *dst; + const void *symbol; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; +} cudaGraphExecMemcpyNodeSetParamsFromSymbol_v11010_params; + +typedef struct cudaGraphExecMemcpyNodeSetParams1D_v11010_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t node; + void *dst; + const void *src; + size_t count; + enum cudaMemcpyKind kind; +} cudaGraphExecMemcpyNodeSetParams1D_v11010_params; + +typedef struct cudaGraphExecMemsetNodeSetParams_v10020_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t node; + const struct cudaMemsetParams *pNodeParams; +} cudaGraphExecMemsetNodeSetParams_v10020_params; + +typedef struct cudaGraphExecHostNodeSetParams_v10020_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t node; + const struct cudaHostNodeParams *pNodeParams; +} cudaGraphExecHostNodeSetParams_v10020_params; + +typedef struct cudaGraphExecChildGraphNodeSetParams_v11010_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t node; + cudaGraph_t childGraph; +} cudaGraphExecChildGraphNodeSetParams_v11010_params; + +typedef struct cudaGraphExecEventRecordNodeSetEvent_v11010_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t hNode; + cudaEvent_t event; +} cudaGraphExecEventRecordNodeSetEvent_v11010_params; + +typedef struct cudaGraphExecEventWaitNodeSetEvent_v11010_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t hNode; + cudaEvent_t event; +} cudaGraphExecEventWaitNodeSetEvent_v11010_params; + +typedef struct cudaGraphExecExternalSemaphoresSignalNodeSetParams_v11020_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t hNode; + const struct cudaExternalSemaphoreSignalNodeParams *nodeParams; +} cudaGraphExecExternalSemaphoresSignalNodeSetParams_v11020_params; + +typedef struct cudaGraphExecExternalSemaphoresWaitNodeSetParams_v11020_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t hNode; + const struct cudaExternalSemaphoreWaitNodeParams *nodeParams; +} cudaGraphExecExternalSemaphoresWaitNodeSetParams_v11020_params; + +typedef struct cudaGraphNodeSetEnabled_v11060_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t hNode; + unsigned int isEnabled; +} cudaGraphNodeSetEnabled_v11060_params; + +typedef struct cudaGraphNodeGetEnabled_v11060_params_st { + cudaGraphExec_t hGraphExec; + cudaGraphNode_t hNode; + unsigned int *isEnabled; +} cudaGraphNodeGetEnabled_v11060_params; + +typedef struct cudaGraphExecUpdate_v10020_params_st { + cudaGraphExec_t hGraphExec; + cudaGraph_t hGraph; + cudaGraphNode_t *hErrorNode_out; + enum cudaGraphExecUpdateResult *updateResult_out; +} cudaGraphExecUpdate_v10020_params; + +typedef struct cudaGraphUpload_ptsz_v10000_params_st { + cudaGraphExec_t graphExec; + cudaStream_t stream; +} cudaGraphUpload_ptsz_v10000_params; + +typedef struct cudaGraphLaunch_ptsz_v10000_params_st { + cudaGraphExec_t graphExec; + cudaStream_t stream; +} cudaGraphLaunch_ptsz_v10000_params; + +typedef struct cudaGraphExecDestroy_v10000_params_st { + cudaGraphExec_t graphExec; +} cudaGraphExecDestroy_v10000_params; + +typedef struct cudaGraphDestroy_v10000_params_st { + cudaGraph_t graph; +} cudaGraphDestroy_v10000_params; + +typedef struct cudaGraphDebugDotPrint_v11030_params_st { + cudaGraph_t graph; + const char *path; + unsigned int flags; +} cudaGraphDebugDotPrint_v11030_params; + +typedef struct cudaUserObjectCreate_v11030_params_st { + cudaUserObject_t *object_out; + void *ptr; + cudaHostFn_t destroy; + unsigned int initialRefcount; + unsigned int flags; +} cudaUserObjectCreate_v11030_params; + +typedef struct cudaUserObjectRetain_v11030_params_st { + cudaUserObject_t object; + unsigned int count; +} cudaUserObjectRetain_v11030_params; + +typedef struct cudaUserObjectRelease_v11030_params_st { + cudaUserObject_t object; + unsigned int count; +} cudaUserObjectRelease_v11030_params; + +typedef struct cudaGraphRetainUserObject_v11030_params_st { + cudaGraph_t graph; + cudaUserObject_t object; + unsigned int count; + unsigned int flags; +} cudaGraphRetainUserObject_v11030_params; + +typedef struct cudaGraphReleaseUserObject_v11030_params_st { + cudaGraph_t graph; + cudaUserObject_t object; + unsigned int count; +} cudaGraphReleaseUserObject_v11030_params; + +typedef struct cudaGetDriverEntryPoint_ptsz_v11030_params_st { + const char *symbol; + void **funcPtr; + unsigned long long flags; + enum cudaDriverEntryPointQueryResult *driverStatus; +} cudaGetDriverEntryPoint_ptsz_v11030_params; + +typedef struct cudaGetFuncBySymbol_v11000_params_st { + cudaFunction_t *functionPtr; + const void *symbolPtr; +} cudaGetFuncBySymbol_v11000_params; + +typedef struct cudaMemcpy_v3020_params_st { + void *dst; + const void *src; + size_t count; + enum cudaMemcpyKind kind; +} cudaMemcpy_v3020_params; + +typedef struct cudaMemcpyToSymbol_v3020_params_st { + const void *symbol; + const void *src; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; +} cudaMemcpyToSymbol_v3020_params; + +typedef struct cudaMemcpyFromSymbol_v3020_params_st { + void *dst; + const void *symbol; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; +} cudaMemcpyFromSymbol_v3020_params; + +typedef struct cudaMemcpy2D_v3020_params_st { + void *dst; + size_t dpitch; + const void *src; + size_t spitch; + size_t width; + size_t height; + enum cudaMemcpyKind kind; +} cudaMemcpy2D_v3020_params; + +typedef struct cudaMemcpyToArray_v3020_params_st { + cudaArray_t dst; + size_t wOffset; + size_t hOffset; + const void *src; + size_t count; + enum cudaMemcpyKind kind; +} cudaMemcpyToArray_v3020_params; + +typedef struct cudaMemcpy2DToArray_v3020_params_st { + cudaArray_t dst; + size_t wOffset; + size_t hOffset; + const void *src; + size_t spitch; + size_t width; + size_t height; + enum cudaMemcpyKind kind; +} cudaMemcpy2DToArray_v3020_params; + +typedef struct cudaMemcpyFromArray_v3020_params_st { + void *dst; + cudaArray_const_t src; + size_t wOffset; + size_t hOffset; + size_t count; + enum cudaMemcpyKind kind; +} cudaMemcpyFromArray_v3020_params; + +typedef struct cudaMemcpy2DFromArray_v3020_params_st { + void *dst; + size_t dpitch; + cudaArray_const_t src; + size_t wOffset; + size_t hOffset; + size_t width; + size_t height; + enum cudaMemcpyKind kind; +} cudaMemcpy2DFromArray_v3020_params; + +typedef struct cudaMemcpyArrayToArray_v3020_params_st { + cudaArray_t dst; + size_t wOffsetDst; + size_t hOffsetDst; + cudaArray_const_t src; + size_t wOffsetSrc; + size_t hOffsetSrc; + size_t count; + enum cudaMemcpyKind kind; +} cudaMemcpyArrayToArray_v3020_params; + +typedef struct cudaMemcpy2DArrayToArray_v3020_params_st { + cudaArray_t dst; + size_t wOffsetDst; + size_t hOffsetDst; + cudaArray_const_t src; + size_t wOffsetSrc; + size_t hOffsetSrc; + size_t width; + size_t height; + enum cudaMemcpyKind kind; +} cudaMemcpy2DArrayToArray_v3020_params; + +typedef struct cudaMemcpy3D_v3020_params_st { + const struct cudaMemcpy3DParms *p; +} cudaMemcpy3D_v3020_params; + +typedef struct cudaMemcpy3DPeer_v4000_params_st { + const struct cudaMemcpy3DPeerParms *p; +} cudaMemcpy3DPeer_v4000_params; + +typedef struct cudaMemset_v3020_params_st { + void *devPtr; + int value; + size_t count; +} cudaMemset_v3020_params; + +typedef struct cudaMemset2D_v3020_params_st { + void *devPtr; + size_t pitch; + int value; + size_t width; + size_t height; +} cudaMemset2D_v3020_params; + +typedef struct cudaMemset3D_v3020_params_st { + struct cudaPitchedPtr pitchedDevPtr; + int value; + struct cudaExtent extent; +} cudaMemset3D_v3020_params; + +typedef struct cudaMemcpyAsync_v3020_params_st { + void *dst; + const void *src; + size_t count; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpyAsync_v3020_params; + +typedef struct cudaMemcpyToSymbolAsync_v3020_params_st { + const void *symbol; + const void *src; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpyToSymbolAsync_v3020_params; + +typedef struct cudaMemcpyFromSymbolAsync_v3020_params_st { + void *dst; + const void *symbol; + size_t count; + size_t offset; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpyFromSymbolAsync_v3020_params; + +typedef struct cudaMemcpy2DAsync_v3020_params_st { + void *dst; + size_t dpitch; + const void *src; + size_t spitch; + size_t width; + size_t height; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpy2DAsync_v3020_params; + +typedef struct cudaMemcpyToArrayAsync_v3020_params_st { + cudaArray_t dst; + size_t wOffset; + size_t hOffset; + const void *src; + size_t count; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpyToArrayAsync_v3020_params; + +typedef struct cudaMemcpy2DToArrayAsync_v3020_params_st { + cudaArray_t dst; + size_t wOffset; + size_t hOffset; + const void *src; + size_t spitch; + size_t width; + size_t height; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpy2DToArrayAsync_v3020_params; + +typedef struct cudaMemcpyFromArrayAsync_v3020_params_st { + void *dst; + cudaArray_const_t src; + size_t wOffset; + size_t hOffset; + size_t count; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpyFromArrayAsync_v3020_params; + +typedef struct cudaMemcpy2DFromArrayAsync_v3020_params_st { + void *dst; + size_t dpitch; + cudaArray_const_t src; + size_t wOffset; + size_t hOffset; + size_t width; + size_t height; + enum cudaMemcpyKind kind; + cudaStream_t stream; +} cudaMemcpy2DFromArrayAsync_v3020_params; + +typedef struct cudaMemcpy3DAsync_v3020_params_st { + const struct cudaMemcpy3DParms *p; + cudaStream_t stream; +} cudaMemcpy3DAsync_v3020_params; + +typedef struct cudaMemcpy3DPeerAsync_v4000_params_st { + const struct cudaMemcpy3DPeerParms *p; + cudaStream_t stream; +} cudaMemcpy3DPeerAsync_v4000_params; + +typedef struct cudaMemsetAsync_v3020_params_st { + void *devPtr; + int value; + size_t count; + cudaStream_t stream; +} cudaMemsetAsync_v3020_params; + +typedef struct cudaMemset2DAsync_v3020_params_st { + void *devPtr; + size_t pitch; + int value; + size_t width; + size_t height; + cudaStream_t stream; +} cudaMemset2DAsync_v3020_params; + +typedef struct cudaMemset3DAsync_v3020_params_st { + struct cudaPitchedPtr pitchedDevPtr; + int value; + struct cudaExtent extent; + cudaStream_t stream; +} cudaMemset3DAsync_v3020_params; + +typedef struct cudaStreamQuery_v3020_params_st { + cudaStream_t stream; +} cudaStreamQuery_v3020_params; + +typedef struct cudaStreamGetFlags_v5050_params_st { + cudaStream_t hStream; + unsigned int *flags; +} cudaStreamGetFlags_v5050_params; + +typedef struct cudaStreamGetId_v12000_params_st { + cudaStream_t hStream; + unsigned long long *streamId; +} cudaStreamGetId_v12000_params; + +typedef struct cudaStreamGetPriority_v5050_params_st { + cudaStream_t hStream; + int *priority; +} cudaStreamGetPriority_v5050_params; + +typedef struct cudaEventRecord_v3020_params_st { + cudaEvent_t event; + cudaStream_t stream; +} cudaEventRecord_v3020_params; + +typedef struct cudaEventRecordWithFlags_v11010_params_st { + cudaEvent_t event; + cudaStream_t stream; + unsigned int flags; +} cudaEventRecordWithFlags_v11010_params; + +typedef struct cudaStreamWaitEvent_v3020_params_st { + cudaStream_t stream; + cudaEvent_t event; + unsigned int flags; +} cudaStreamWaitEvent_v3020_params; + +typedef struct cudaStreamAddCallback_v5000_params_st { + cudaStream_t stream; + cudaStreamCallback_t callback; + void *userData; + unsigned int flags; +} cudaStreamAddCallback_v5000_params; + +typedef struct cudaStreamAttachMemAsync_v6000_params_st { + cudaStream_t stream; + void *devPtr; + size_t length; + unsigned int flags; +} cudaStreamAttachMemAsync_v6000_params; + +typedef struct cudaStreamSynchronize_v3020_params_st { + cudaStream_t stream; +} cudaStreamSynchronize_v3020_params; + +typedef struct cudaLaunchKernel_v7000_params_st { + const void *func; + dim3 gridDim; + dim3 blockDim; + void **args; + size_t sharedMem; + cudaStream_t stream; +} cudaLaunchKernel_v7000_params; + +typedef struct cudaLaunchKernelExC_v11060_params_st { + const cudaLaunchConfig_t *config; + const void *func; + void **args; +} cudaLaunchKernelExC_v11060_params; + +typedef struct cudaLaunchCooperativeKernel_v9000_params_st { + const void *func; + dim3 gridDim; + dim3 blockDim; + void **args; + size_t sharedMem; + cudaStream_t stream; +} cudaLaunchCooperativeKernel_v9000_params; + +typedef struct cudaLaunchHostFunc_v10000_params_st { + cudaStream_t stream; + cudaHostFn_t fn; + void *userData; +} cudaLaunchHostFunc_v10000_params; + +typedef struct cudaMemPrefetchAsync_v8000_params_st { + const void *devPtr; + size_t count; + int dstDevice; + cudaStream_t stream; +} cudaMemPrefetchAsync_v8000_params; + +typedef struct cudaSignalExternalSemaphoresAsync_v10000_params_st { + const cudaExternalSemaphore_t *extSemArray; + const struct cudaExternalSemaphoreSignalParams_v1 *paramsArray; + unsigned int numExtSems; + cudaStream_t stream; +} cudaSignalExternalSemaphoresAsync_v10000_params; + +typedef struct cudaSignalExternalSemaphoresAsync_ptsz_v10000_params_st { + const cudaExternalSemaphore_t *extSemArray; + const struct cudaExternalSemaphoreSignalParams_v1 *paramsArray; + unsigned int numExtSems; + cudaStream_t stream; +} cudaSignalExternalSemaphoresAsync_ptsz_v10000_params; + +typedef struct cudaSignalExternalSemaphoresAsync_v2_v11020_params_st { + const cudaExternalSemaphore_t *extSemArray; + const struct cudaExternalSemaphoreSignalParams *paramsArray; + unsigned int numExtSems; + cudaStream_t stream; +} cudaSignalExternalSemaphoresAsync_v2_v11020_params; + +typedef struct cudaWaitExternalSemaphoresAsync_v10000_params_st { + const cudaExternalSemaphore_t *extSemArray; + const struct cudaExternalSemaphoreWaitParams_v1 *paramsArray; + unsigned int numExtSems; + cudaStream_t stream; +} cudaWaitExternalSemaphoresAsync_v10000_params; + +typedef struct cudaWaitExternalSemaphoresAsync_ptsz_v10000_params_st { + const cudaExternalSemaphore_t *extSemArray; + const struct cudaExternalSemaphoreWaitParams_v1 *paramsArray; + unsigned int numExtSems; + cudaStream_t stream; +} cudaWaitExternalSemaphoresAsync_ptsz_v10000_params; + +typedef struct cudaWaitExternalSemaphoresAsync_v2_v11020_params_st { + const cudaExternalSemaphore_t *extSemArray; + const struct cudaExternalSemaphoreWaitParams *paramsArray; + unsigned int numExtSems; + cudaStream_t stream; +} cudaWaitExternalSemaphoresAsync_v2_v11020_params; + +typedef struct cudaGraphInstantiateWithParams_v12000_params_st { + cudaGraphExec_t *pGraphExec; + cudaGraph_t graph; + cudaGraphInstantiateParams *instantiateParams; +} cudaGraphInstantiateWithParams_v12000_params; + +typedef struct cudaGraphUpload_v10000_params_st { + cudaGraphExec_t graphExec; + cudaStream_t stream; +} cudaGraphUpload_v10000_params; + +typedef struct cudaGraphLaunch_v10000_params_st { + cudaGraphExec_t graphExec; + cudaStream_t stream; +} cudaGraphLaunch_v10000_params; + +typedef struct cudaStreamBeginCapture_v10000_params_st { + cudaStream_t stream; + enum cudaStreamCaptureMode mode; +} cudaStreamBeginCapture_v10000_params; + +typedef struct cudaStreamEndCapture_v10000_params_st { + cudaStream_t stream; + cudaGraph_t *pGraph; +} cudaStreamEndCapture_v10000_params; + +typedef struct cudaStreamIsCapturing_v10000_params_st { + cudaStream_t stream; + enum cudaStreamCaptureStatus *pCaptureStatus; +} cudaStreamIsCapturing_v10000_params; + +typedef struct cudaStreamGetCaptureInfo_v10010_params_st { + cudaStream_t stream; + enum cudaStreamCaptureStatus *captureStatus_out; + unsigned long long *id_out; +} cudaStreamGetCaptureInfo_v10010_params; + +typedef struct cudaStreamGetCaptureInfo_v2_v11030_params_st { + cudaStream_t stream; + enum cudaStreamCaptureStatus *captureStatus_out; + unsigned long long *id_out; + cudaGraph_t *graph_out; + const cudaGraphNode_t **dependencies_out; + size_t *numDependencies_out; +} cudaStreamGetCaptureInfo_v2_v11030_params; + +typedef struct cudaStreamUpdateCaptureDependencies_v11030_params_st { + cudaStream_t stream; + cudaGraphNode_t *dependencies; + size_t numDependencies; + unsigned int flags; +} cudaStreamUpdateCaptureDependencies_v11030_params; + +typedef struct cudaStreamCopyAttributes_v11000_params_st { + cudaStream_t dstStream; + cudaStream_t srcStream; +} cudaStreamCopyAttributes_v11000_params; + +typedef struct cudaStreamGetAttribute_v11000_params_st { + cudaStream_t stream; + cudaStreamAttrID attr; + cudaStreamAttrValue *value; +} cudaStreamGetAttribute_v11000_params; + +typedef struct cudaStreamSetAttribute_v11000_params_st { + cudaStream_t stream; + cudaStreamAttrID attr; + const cudaStreamAttrValue *param; +} cudaStreamSetAttribute_v11000_params; + +typedef struct cudaMallocAsync_v11020_params_st { + void **devPtr; + size_t size; + cudaStream_t hStream; +} cudaMallocAsync_v11020_params; + +typedef struct cudaFreeAsync_v11020_params_st { + void *devPtr; + cudaStream_t hStream; +} cudaFreeAsync_v11020_params; + +typedef struct cudaMallocFromPoolAsync_v11020_params_st { + void **ptr; + size_t size; + cudaMemPool_t memPool; + cudaStream_t stream; +} cudaMallocFromPoolAsync_v11020_params; + +typedef struct cudaGetDriverEntryPoint_v11030_params_st { + const char *symbol; + void **funcPtr; + unsigned long long flags; + enum cudaDriverEntryPointQueryResult *driverStatus; +} cudaGetDriverEntryPoint_v11030_params; + +// Parameter trace structures for removed functions + + +// End of parameter trace structures diff --git a/cuda_toolkit/include/generated_cudart_removed_meta.h b/cuda_toolkit/include/generated_cudart_removed_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..aa713cdfe53e2aff949dfc42e595b71c2d61edc3 --- /dev/null +++ b/cuda_toolkit/include/generated_cudart_removed_meta.h @@ -0,0 +1,162 @@ +// This file is generated. Any changes you make will be lost during the next clean build. + +// CUDA public interface, for type definitions and api function prototypes +#include "cudart_removed.h" + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +// Currently used parameter trace structures +typedef struct cudaStreamDestroy_v3020_params_st { + cudaStream_t stream; +} cudaStreamDestroy_v3020_params; + +typedef struct cudaOccupancyMaxActiveBlocksPerMultiprocessor_v6000_params_st { + int *numBlocks; + const void *func; + size_t numDynamicSmemBytes; +} cudaOccupancyMaxActiveBlocksPerMultiprocessor_v6000_params; + +typedef struct cudaConfigureCall_v3020_params_st { + dim3 gridDim; + dim3 blockDim; + size_t sharedMem __dv; + cudaStream_t stream __dv; +} cudaConfigureCall_v3020_params; + +typedef struct cudaSetupArgument_v3020_params_st { + const void *arg; + size_t size; + size_t offset; +} cudaSetupArgument_v3020_params; + +typedef struct cudaLaunch_v3020_params_st { + const void *func; +} cudaLaunch_v3020_params; + +typedef struct cudaLaunch_ptsz_v7000_params_st { + const void *func; +} cudaLaunch_ptsz_v7000_params; + +typedef struct cudaStreamSetFlags_v10200_params_st { + cudaStream_t hStream; + unsigned int flags; +} cudaStreamSetFlags_v10200_params; + +typedef struct cudaStreamSetFlags_ptsz_v10200_params_st { + cudaStream_t hStream; + unsigned int flags; +} cudaStreamSetFlags_ptsz_v10200_params; + +typedef struct cudaProfilerInitialize_v4000_params_st { + const char *configFile; + const char *outputFile; + cudaOutputMode_t outputMode; +} cudaProfilerInitialize_v4000_params; + +typedef struct cudaThreadSetLimit_v3020_params_st { + enum cudaLimit limit; + size_t value; +} cudaThreadSetLimit_v3020_params; + +typedef struct cudaThreadGetLimit_v3020_params_st { + size_t *pValue; + enum cudaLimit limit; +} cudaThreadGetLimit_v3020_params; + +typedef struct cudaThreadGetCacheConfig_v3020_params_st { + enum cudaFuncCache *pCacheConfig; +} cudaThreadGetCacheConfig_v3020_params; + +typedef struct cudaThreadSetCacheConfig_v3020_params_st { + enum cudaFuncCache cacheConfig; +} cudaThreadSetCacheConfig_v3020_params; + +typedef struct cudaSetDoubleForDevice_v3020_params_st { + double *d; +} cudaSetDoubleForDevice_v3020_params; + +typedef struct cudaSetDoubleForHost_v3020_params_st { + double *d; +} cudaSetDoubleForHost_v3020_params; + +typedef struct cudaCreateTextureObject_v2_v11080_params_st { + cudaTextureObject_t *pTexObject; + const struct cudaResourceDesc *pResDesc; + const struct cudaTextureDesc *pTexDesc; + const struct cudaResourceViewDesc *pResViewDesc; +} cudaCreateTextureObject_v2_v11080_params; + +typedef struct cudaGetTextureObjectTextureDesc_v2_v11080_params_st { + struct cudaTextureDesc *pTexDesc; + cudaTextureObject_t texObject; +} cudaGetTextureObjectTextureDesc_v2_v11080_params; + +typedef struct cudaBindTexture_v3020_params_st { + size_t *offset; + const struct textureReference *texref; + const void *devPtr; + const struct cudaChannelFormatDesc *desc; + size_t size __dv; +} cudaBindTexture_v3020_params; + +typedef struct cudaBindTexture2D_v3020_params_st { + size_t *offset; + const struct textureReference *texref; + const void *devPtr; + const struct cudaChannelFormatDesc *desc; + size_t width; + size_t height; + size_t pitch; +} cudaBindTexture2D_v3020_params; + +typedef struct cudaBindTextureToArray_v3020_params_st { + const struct textureReference *texref; + cudaArray_const_t array; + const struct cudaChannelFormatDesc *desc; +} cudaBindTextureToArray_v3020_params; + +typedef struct cudaBindTextureToMipmappedArray_v5000_params_st { + const struct textureReference *texref; + cudaMipmappedArray_const_t mipmappedArray; + const struct cudaChannelFormatDesc *desc; +} cudaBindTextureToMipmappedArray_v5000_params; + +typedef struct cudaUnbindTexture_v3020_params_st { + const struct textureReference *texref; +} cudaUnbindTexture_v3020_params; + +typedef struct cudaGetTextureAlignmentOffset_v3020_params_st { + size_t *offset; + const struct textureReference *texref; +} cudaGetTextureAlignmentOffset_v3020_params; + +typedef struct cudaGetTextureReference_v3020_params_st { + const struct textureReference **texref; + const void *symbol; +} cudaGetTextureReference_v3020_params; + +typedef struct cudaBindSurfaceToArray_v3020_params_st { + const struct surfaceReference *surfref; + cudaArray_const_t array; + const struct cudaChannelFormatDesc *desc; +} cudaBindSurfaceToArray_v3020_params; + +typedef struct cudaGetSurfaceReference_v3020_params_st { + const struct surfaceReference **surfref; + const void *symbol; +} cudaGetSurfaceReference_v3020_params; + +typedef struct cudaGraphInstantiate_v10000_params_st { + cudaGraphExec_t *pGraphExec; + cudaGraph_t graph; + cudaGraphNode_t *pErrorNode; + char *pLogBuffer; + size_t bufferSize; +} cudaGraphInstantiate_v10000_params; + +// Parameter trace structures for removed functions + + +// End of parameter trace structures diff --git a/cuda_toolkit/include/generated_nvtx_meta.h b/cuda_toolkit/include/generated_nvtx_meta.h new file mode 100644 index 0000000000000000000000000000000000000000..51c9c1355f82e8a19e6f5fa2532e94686ecd35f8 --- /dev/null +++ b/cuda_toolkit/include/generated_nvtx_meta.h @@ -0,0 +1,247 @@ +/* + * Copyright 2013-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility push(default) +#endif + +// ************************************************************************* +// Definitions of structs to hold parameters for each function +// ************************************************************************* + +typedef struct nvtxMarkEx_params_st { + const nvtxEventAttributes_t* eventAttrib; +} nvtxMarkEx_params; + +typedef struct nvtxMarkA_params_st { + const char* message; +} nvtxMarkA_params; + +typedef struct nvtxMarkW_params_st { + const wchar_t* message; +} nvtxMarkW_params; + +typedef struct nvtxRangeStartEx_params_st { + const nvtxEventAttributes_t* eventAttrib; +} nvtxRangeStartEx_params; + +typedef struct nvtxRangeStartA_params_st { + const char* message; +} nvtxRangeStartA_params; + +typedef struct nvtxRangeStartW_params_st { + const wchar_t* message; +} nvtxRangeStartW_params; + +typedef struct nvtxRangeEnd_params_st { + nvtxRangeId_t id; +} nvtxRangeEnd_params; + +typedef struct nvtxRangePushEx_params_st { + const nvtxEventAttributes_t* eventAttrib; +} nvtxRangePushEx_params; + +typedef struct nvtxRangePushA_params_st { + const char* message; +} nvtxRangePushA_params; + +typedef struct nvtxRangePushW_params_st { + const wchar_t* message; +} nvtxRangePushW_params; + +typedef struct nvtxRangePop_params_st { + /* WAR: Windows compiler doesn't allow empty structs */ + /* This field shouldn't be used */ + void *dummy; +} nvtxRangePop_params; + +typedef struct nvtxNameCategoryA_params_st { + uint32_t category; + const char* name; +} nvtxNameCategoryA_params; + +typedef struct nvtxNameCategoryW_params_st { + uint32_t category; + const wchar_t* name; +} nvtxNameCategoryW_params; + +typedef struct nvtxNameOsThreadA_params_st { + uint32_t threadId; + const char* name; +} nvtxNameOsThreadA_params; + +typedef struct nvtxNameOsThreadW_params_st { + uint32_t threadId; + const wchar_t* name; +} nvtxNameOsThreadW_params; + +typedef struct nvtxNameCuDeviceA_params_st { + CUdevice device; + const char* name; +} nvtxNameCuDeviceA_params; + +typedef struct nvtxNameCuDeviceW_params_st { + CUdevice device; + const wchar_t* name; +} nvtxNameCuDeviceW_params; + +typedef struct nvtxNameCuContextA_params_st { + CUcontext context; + const char* name; +} nvtxNameCuContextA_params; + +typedef struct nvtxNameCuContextW_params_st { + CUcontext context; + const wchar_t* name; +} nvtxNameCuContextW_params; + +typedef struct nvtxNameCuStreamA_params_st { + CUstream stream; + const char* name; +} nvtxNameCuStreamA_params; + +typedef struct nvtxNameCuStreamW_params_st { + CUstream stream; + const wchar_t* name; +} nvtxNameCuStreamW_params; + +typedef struct nvtxNameCuEventA_params_st { + CUevent event; + const char* name; +} nvtxNameCuEventA_params; + +typedef struct nvtxNameCuEventW_params_st { + CUevent event; + const wchar_t* name; +} nvtxNameCuEventW_params; + +typedef struct nvtxNameCudaDeviceA_params_st { + int device; + const char* name; +} nvtxNameCudaDeviceA_params; + +typedef struct nvtxNameCudaDeviceW_params_st { + int device; + const wchar_t* name; +} nvtxNameCudaDeviceW_params; + +typedef struct nvtxNameCudaStreamA_params_st { + cudaStream_t stream; + const char* name; +} nvtxNameCudaStreamA_params; + +typedef struct nvtxNameCudaStreamW_params_st { + cudaStream_t stream; + const wchar_t* name; +} nvtxNameCudaStreamW_params; + +typedef struct nvtxNameCudaEventA_params_st { + cudaEvent_t event; + const char* name; +} nvtxNameCudaEventA_params; + +typedef struct nvtxNameCudaEventW_params_st { + cudaEvent_t event; + const wchar_t* name; +} nvtxNameCudaEventW_params; + +typedef struct nvtxDomainCreateA_params_st { + const char* name; +} nvtxDomainCreateA_params; + +typedef struct nvtxDomainDestroy_params_st { + nvtxDomainHandle_t domain; +} nvtxDomainDestroy_params; + +typedef struct nvtxDomainMarkEx_params_st { + nvtxDomainHandle_t domain; + nvtxMarkEx_params core; +} nvtxDomainMarkEx_params; + +typedef struct nvtxDomainRangeStartEx_params_st { + nvtxDomainHandle_t domain; + nvtxRangeStartEx_params core; +} nvtxDomainRangeStartEx_params; + +typedef struct nvtxDomainRangeEnd_params_st { + nvtxDomainHandle_t domain; + nvtxRangeEnd_params core; +} nvtxDomainRangeEnd_params; + +typedef struct nvtxDomainRangePushEx_params_st { + nvtxDomainHandle_t domain; + nvtxRangePushEx_params core; +} nvtxDomainRangePushEx_params; + +typedef struct nvtxDomainRangePop_params_st { + nvtxDomainHandle_t domain; +} nvtxDomainRangePop_params; + +typedef struct nvtxSyncUserCreate_params_st { + nvtxDomainHandle_t domain; + const nvtxSyncUserAttributes_t* attribs; +} nvtxSyncUserCreate_params; + +typedef struct nvtxSyncUserCommon_params_st { + nvtxSyncUser_t handle; +} nvtxSyncUserCommon_params; + +typedef struct nvtxDomainRegisterStringA_params_st { + nvtxDomainHandle_t domain; + const char* string; +} nvtxDomainRegisterStringA_params; + +typedef struct nvtxDomainRegisterStringW_params_st { + nvtxDomainHandle_t domain; + const char* string; +} nvtxDomainRegisterStringW_params; + +#if defined(__GNUC__) && defined(CUPTI_LIB) + #pragma GCC visibility pop +#endif diff --git a/cuda_toolkit/include/host_config.h b/cuda_toolkit/include/host_config.h new file mode 100644 index 0000000000000000000000000000000000000000..34a611ac92e02ea8451ceea0781ea289a935bcf1 --- /dev/null +++ b/cuda_toolkit/include/host_config.h @@ -0,0 +1,65 @@ +/* + * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__) +#if defined(_MSC_VER) +#pragma message("host_config.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.") +#else +#warning "host_config.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead." +#endif +#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_CONFIG_H_WRAPPER__ +#endif + +#include "crt/host_config.h" + +#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_CONFIG_H_WRAPPER__) +#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_CONFIG_H_WRAPPER__ +#endif diff --git a/cuda_toolkit/include/host_defines.h b/cuda_toolkit/include/host_defines.h new file mode 100644 index 0000000000000000000000000000000000000000..b334e67f8c4e730ff24ca75d2f7253a61c6d52ae --- /dev/null +++ b/cuda_toolkit/include/host_defines.h @@ -0,0 +1,65 @@ +/* + * Copyright 1993-2018 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__) +#if defined(_MSC_VER) +#pragma message("host_defines.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.") +#else +#warning "host_defines.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead." +#endif +#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_DEFINES_H_WRAPPER__ +#endif + +#include "crt/host_defines.h" + +#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_DEFINES_H_WRAPPER__) +#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ +#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_DEFINES_H_WRAPPER__ +#endif diff --git a/cuda_toolkit/include/initializer_list b/cuda_toolkit/include/initializer_list new file mode 100644 index 0000000000000000000000000000000000000000..15d456d80aeedaf36e746788abdee3dcac163297 --- /dev/null +++ b/cuda_toolkit/include/initializer_list @@ -0,0 +1,131 @@ +// -*- C++ -*- +//===----------------------- initializer_list -----------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_INITIALIZER_LIST +#define _LIBCUDACXX_INITIALIZER_LIST + +/* + initializer_list synopsis + +namespace std +{ + +template +class initializer_list +{ +public: + typedef E value_type; + typedef const E& reference; + typedef const E& const_reference; + typedef size_t size_type; + + typedef const E* iterator; + typedef const E* const_iterator; + + initializer_list() noexcept; // constexpr in C++14 + + size_t size() const noexcept; // constexpr in C++14 + const E* begin() const noexcept; // constexpr in C++14 + const E* end() const noexcept; // constexpr in C++14 +}; + +template const E* begin(initializer_list il) noexcept; // constexpr in C++14 +template const E* end(initializer_list il) noexcept; // constexpr in C++14 + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> + +#include "cstddef" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +namespace std // purposefully not versioned +{ + +template +class _LIBCUDACXX_TEMPLATE_VIS initializer_list +{ + const _Ep* __begin_; + size_t __size_; + + _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + initializer_list(const _Ep* __b, size_t __s) noexcept + : __begin_(__b), + __size_(__s) + {} +public: + typedef _Ep value_type; + typedef const _Ep& reference; + typedef const _Ep& const_reference; + typedef size_t size_type; + + typedef const _Ep* iterator; + typedef const _Ep* const_iterator; + + _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + initializer_list() noexcept : __begin_(nullptr), __size_(0) {} + + _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + size_t size() const noexcept {return __size_;} + + _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + const _Ep* begin() const noexcept {return __begin_;} + + _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 + const _Ep* end() const noexcept {return __begin_ + __size_;} +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +const _Ep* +begin(initializer_list<_Ep> __il) noexcept +{ + return __il.begin(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_LIBCUDACXX_CONSTEXPR_AFTER_CXX11 +const _Ep* +end(initializer_list<_Ep> __il) noexcept +{ + return __il.end(); +} + +} // std + +#else + +#if !defined(_LIBCUDACXX_COMPILER_NVRTC) +#include +#endif + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + using ::std::initializer_list; +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // __cuda_std__ + +#endif // _LIBCUDACXX_INITIALIZER_LIST diff --git a/cuda_toolkit/include/inttypes.h b/cuda_toolkit/include/inttypes.h new file mode 100644 index 0000000000000000000000000000000000000000..08ba77329975ba5d6e0e0e977facfd3db3615d4e --- /dev/null +++ b/cuda_toolkit/include/inttypes.h @@ -0,0 +1,266 @@ +// -*- C++ -*- +//===--------------------------- inttypes.h -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_INTTYPES_H +// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T +// is defined until an inclusion of it without _STD_TYPES_T occurs, in which +// case the header guard macro is defined. +#if !defined(_AIX) || !defined(_STD_TYPES_T) +#define _LIBCUDACXX_INTTYPES_H +#endif // _STD_TYPES_T + +/* + inttypes.h synopsis + +This entire header is C99 / C++0X + +#include // includes + +Macros: + + PRId8 + PRId16 + PRId32 + PRId64 + + PRIdLEAST8 + PRIdLEAST16 + PRIdLEAST32 + PRIdLEAST64 + + PRIdFAST8 + PRIdFAST16 + PRIdFAST32 + PRIdFAST64 + + PRIdMAX + PRIdPTR + + PRIi8 + PRIi16 + PRIi32 + PRIi64 + + PRIiLEAST8 + PRIiLEAST16 + PRIiLEAST32 + PRIiLEAST64 + + PRIiFAST8 + PRIiFAST16 + PRIiFAST32 + PRIiFAST64 + + PRIiMAX + PRIiPTR + + PRIo8 + PRIo16 + PRIo32 + PRIo64 + + PRIoLEAST8 + PRIoLEAST16 + PRIoLEAST32 + PRIoLEAST64 + + PRIoFAST8 + PRIoFAST16 + PRIoFAST32 + PRIoFAST64 + + PRIoMAX + PRIoPTR + + PRIu8 + PRIu16 + PRIu32 + PRIu64 + + PRIuLEAST8 + PRIuLEAST16 + PRIuLEAST32 + PRIuLEAST64 + + PRIuFAST8 + PRIuFAST16 + PRIuFAST32 + PRIuFAST64 + + PRIuMAX + PRIuPTR + + PRIx8 + PRIx16 + PRIx32 + PRIx64 + + PRIxLEAST8 + PRIxLEAST16 + PRIxLEAST32 + PRIxLEAST64 + + PRIxFAST8 + PRIxFAST16 + PRIxFAST32 + PRIxFAST64 + + PRIxMAX + PRIxPTR + + PRIX8 + PRIX16 + PRIX32 + PRIX64 + + PRIXLEAST8 + PRIXLEAST16 + PRIXLEAST32 + PRIXLEAST64 + + PRIXFAST8 + PRIXFAST16 + PRIXFAST32 + PRIXFAST64 + + PRIXMAX + PRIXPTR + + SCNd8 + SCNd16 + SCNd32 + SCNd64 + + SCNdLEAST8 + SCNdLEAST16 + SCNdLEAST32 + SCNdLEAST64 + + SCNdFAST8 + SCNdFAST16 + SCNdFAST32 + SCNdFAST64 + + SCNdMAX + SCNdPTR + + SCNi8 + SCNi16 + SCNi32 + SCNi64 + + SCNiLEAST8 + SCNiLEAST16 + SCNiLEAST32 + SCNiLEAST64 + + SCNiFAST8 + SCNiFAST16 + SCNiFAST32 + SCNiFAST64 + + SCNiMAX + SCNiPTR + + SCNo8 + SCNo16 + SCNo32 + SCNo64 + + SCNoLEAST8 + SCNoLEAST16 + SCNoLEAST32 + SCNoLEAST64 + + SCNoFAST8 + SCNoFAST16 + SCNoFAST32 + SCNoFAST64 + + SCNoMAX + SCNoPTR + + SCNu8 + SCNu16 + SCNu32 + SCNu64 + + SCNuLEAST8 + SCNuLEAST16 + SCNuLEAST32 + SCNuLEAST64 + + SCNuFAST8 + SCNuFAST16 + SCNuFAST32 + SCNuFAST64 + + SCNuMAX + SCNuPTR + + SCNx8 + SCNx16 + SCNx32 + SCNx64 + + SCNxLEAST8 + SCNxLEAST16 + SCNxLEAST32 + SCNxLEAST64 + + SCNxFAST8 + SCNxFAST16 + SCNxFAST32 + SCNxFAST64 + + SCNxMAX + SCNxPTR + +Types: + + imaxdiv_t + +intmax_t imaxabs(intmax_t j); +imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom); +intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base); +uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base); +intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); +uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); + +*/ + +#include <__config> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +/* C99 stdlib (e.g. glibc < 2.18) does not provide format macros needed + for C++11 unless __STDC_FORMAT_MACROS is defined +*/ +#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) +# define __STDC_FORMAT_MACROS +#endif + +#include_next + +#ifdef __cplusplus + +#include + +#undef imaxabs +#undef imaxdiv + +#endif // __cplusplus + +#endif // _LIBCUDACXX_INTTYPES_H diff --git a/cuda_toolkit/include/iomanip b/cuda_toolkit/include/iomanip new file mode 100644 index 0000000000000000000000000000000000000000..8e131d31a6120091b11fbb973d02155d574f62fe --- /dev/null +++ b/cuda_toolkit/include/iomanip @@ -0,0 +1,674 @@ +// -*- C++ -*- +//===--------------------------- iomanip ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_IOMANIP +#define _LIBCUDACXX_IOMANIP + +/* + iomanip synopsis + +namespace std { + +// types T1, T2, ... are unspecified implementation types +T1 resetiosflags(ios_base::fmtflags mask); +T2 setiosflags (ios_base::fmtflags mask); +T3 setbase(int base); +template T4 setfill(charT c); +T5 setprecision(int n); +T6 setw(int n); +template T7 get_money(moneyT& mon, bool intl = false); +template T8 put_money(const moneyT& mon, bool intl = false); +template T9 get_time(struct tm* tmb, const charT* fmt); +template T10 put_time(const struct tm* tmb, const charT* fmt); + +template + T11 quoted(const charT* s, charT delim=charT('"'), charT escape=charT('\\')); // C++14 + +template + T12 quoted(const basic_string& s, + charT delim=charT('"'), charT escape=charT('\\')); // C++14 + +template + T13 quoted(basic_string& s, + charT delim=charT('"'), charT escape=charT('\\')); // C++14 + +} // std + +*/ + +#include <__config> +#include <__string> +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +// resetiosflags + +class __iom_t1 +{ + ios_base::fmtflags __mask_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {} + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x) + { + __is.unsetf(__x.__mask_); + return __is; + } + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x) + { + __os.unsetf(__x.__mask_); + return __os; + } +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY +__iom_t1 +resetiosflags(ios_base::fmtflags __mask) +{ + return __iom_t1(__mask); +} + +// setiosflags + +class __iom_t2 +{ + ios_base::fmtflags __mask_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {} + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x) + { + __is.setf(__x.__mask_); + return __is; + } + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x) + { + __os.setf(__x.__mask_); + return __os; + } +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY +__iom_t2 +setiosflags(ios_base::fmtflags __mask) +{ + return __iom_t2(__mask); +} + +// setbase + +class __iom_t3 +{ + int __base_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __iom_t3(int __b) : __base_(__b) {} + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x) + { + __is.setf(__x.__base_ == 8 ? ios_base::oct : + __x.__base_ == 10 ? ios_base::dec : + __x.__base_ == 16 ? ios_base::hex : + ios_base::fmtflags(0), ios_base::basefield); + return __is; + } + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x) + { + __os.setf(__x.__base_ == 8 ? ios_base::oct : + __x.__base_ == 10 ? ios_base::dec : + __x.__base_ == 16 ? ios_base::hex : + ios_base::fmtflags(0), ios_base::basefield); + return __os; + } +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY +__iom_t3 +setbase(int __base) +{ + return __iom_t3(__base); +} + +// setfill + +template +class __iom_t4 +{ + _CharT __fill_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __iom_t4(_CharT __c) : __fill_(__c) {} + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x) + { + __os.fill(__x.__fill_); + return __os; + } +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__iom_t4<_CharT> +setfill(_CharT __c) +{ + return __iom_t4<_CharT>(__c); +} + +// setprecision + +class __iom_t5 +{ + int __n_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __iom_t5(int __n) : __n_(__n) {} + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x) + { + __is.precision(__x.__n_); + return __is; + } + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x) + { + __os.precision(__x.__n_); + return __os; + } +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY +__iom_t5 +setprecision(int __n) +{ + return __iom_t5(__n); +} + +// setw + +class __iom_t6 +{ + int __n_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __iom_t6(int __n) : __n_(__n) {} + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x) + { + __is.width(__x.__n_); + return __is; + } + + template + friend + _LIBCUDACXX_INLINE_VISIBILITY + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x) + { + __os.width(__x.__n_); + return __os; + } +}; + +inline _LIBCUDACXX_INLINE_VISIBILITY +__iom_t6 +setw(int __n) +{ + return __iom_t6(__n); +} + +// get_money + +template class __iom_t7; + +template +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x); + +template +class __iom_t7 +{ + _MoneyT& __mon_; + bool __intl_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + __iom_t7(_MoneyT& __mon, bool __intl) + : __mon_(__mon), __intl_(__intl) {} + + template + friend + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x); +}; + +template +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + typename basic_istream<_CharT, _Traits>::sentry __s(__is); + if (__s) + { + typedef istreambuf_iterator<_CharT, _Traits> _Ip; + typedef money_get<_CharT, _Ip> _Fp; + ios_base::iostate __err = ios_base::goodbit; + const _Fp& __mf = use_facet<_Fp>(__is.getloc()); + __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_); + __is.setstate(__err); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __is.__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + return __is; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__iom_t7<_MoneyT> +get_money(_MoneyT& __mon, bool __intl = false) +{ + return __iom_t7<_MoneyT>(__mon, __intl); +} + +// put_money + +template class __iom_t8; + +template +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x); + +template +class __iom_t8 +{ + const _MoneyT& __mon_; + bool __intl_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + __iom_t8(const _MoneyT& __mon, bool __intl) + : __mon_(__mon), __intl_(__intl) {} + + template + friend + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x); +}; + +template +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + typename basic_ostream<_CharT, _Traits>::sentry __s(__os); + if (__s) + { + typedef ostreambuf_iterator<_CharT, _Traits> _Op; + typedef money_put<_CharT, _Op> _Fp; + const _Fp& __mf = use_facet<_Fp>(__os.getloc()); + if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed()) + __os.setstate(ios_base::badbit); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __os.__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + return __os; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__iom_t8<_MoneyT> +put_money(const _MoneyT& __mon, bool __intl = false) +{ + return __iom_t8<_MoneyT>(__mon, __intl); +} + +// get_time + +template class __iom_t9; + +template +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x); + +template +class __iom_t9 +{ + tm* __tm_; + const _CharT* __fmt_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + __iom_t9(tm* __tm, const _CharT* __fmt) + : __tm_(__tm), __fmt_(__fmt) {} + + template + friend + basic_istream<_Cp, _Traits>& + operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x); +}; + +template +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + typename basic_istream<_CharT, _Traits>::sentry __s(__is); + if (__s) + { + typedef istreambuf_iterator<_CharT, _Traits> _Ip; + typedef time_get<_CharT, _Ip> _Fp; + ios_base::iostate __err = ios_base::goodbit; + const _Fp& __tf = use_facet<_Fp>(__is.getloc()); + __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_, + __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)); + __is.setstate(__err); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __is.__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + return __is; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__iom_t9<_CharT> +get_time(tm* __tm, const _CharT* __fmt) +{ + return __iom_t9<_CharT>(__tm, __fmt); +} + +// put_time + +template class __iom_t10; + +template +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x); + +template +class __iom_t10 +{ + const tm* __tm_; + const _CharT* __fmt_; +public: + _LIBCUDACXX_INLINE_VISIBILITY + __iom_t10(const tm* __tm, const _CharT* __fmt) + : __tm_(__tm), __fmt_(__fmt) {} + + template + friend + basic_ostream<_Cp, _Traits>& + operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x); +}; + +template +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) +{ +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + typename basic_ostream<_CharT, _Traits>::sentry __s(__os); + if (__s) + { + typedef ostreambuf_iterator<_CharT, _Traits> _Op; + typedef time_put<_CharT, _Op> _Fp; + const _Fp& __tf = use_facet<_Fp>(__os.getloc()); + if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_, + __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed()) + __os.setstate(ios_base::badbit); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __os.__set_badbit_and_consider_rethrow(); + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + return __os; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +__iom_t10<_CharT> +put_time(const tm* __tm, const _CharT* __fmt) +{ + return __iom_t10<_CharT>(__tm, __fmt); +} + +template +std::basic_ostream<_CharT, _Traits> & +__quoted_output ( basic_ostream<_CharT, _Traits> &__os, + _ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape ) +{ + _CUDA_VSTD::basic_string<_CharT, _Traits> __str; + __str.push_back(__delim); + for ( ; __first != __last; ++ __first ) + { + if (_Traits::eq (*__first, __escape) || _Traits::eq (*__first, __delim)) + __str.push_back(__escape); + __str.push_back(*__first); + } + __str.push_back(__delim); + return __put_character_sequence(__os, __str.data(), __str.size()); +} + +template +basic_istream<_CharT, _Traits> & +__quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _CharT __delim, _CharT __escape ) +{ + __string.clear (); + _CharT __c; + __is >> __c; + if ( __is.fail ()) + return __is; + + if (!_Traits::eq (__c, __delim)) // no delimiter, read the whole string + { + __is.unget (); + __is >> __string; + return __is; + } + + __save_flags<_CharT, _Traits> sf(__is); + noskipws (__is); + while (true) + { + __is >> __c; + if ( __is.fail ()) + break; + if (_Traits::eq (__c, __escape)) + { + __is >> __c; + if ( __is.fail ()) + break; + } + else if (_Traits::eq (__c, __delim)) + break; + __string.push_back ( __c ); + } + return __is; +} + + +template +basic_ostream<_CharT, _Traits>& operator<<( + basic_ostream<_CharT, _Traits>& __os, + const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy) +{ + return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape); +} + +template +struct __quoted_proxy +{ + basic_string<_CharT, _Traits, _Allocator> &__string; + _CharT __delim; + _CharT __escape; + + __quoted_proxy(basic_string<_CharT, _Traits, _Allocator> &__s, _CharT __d, _CharT __e) + : __string(__s), __delim(__d), __escape(__e) {} +}; + +template +_LIBCUDACXX_INLINE_VISIBILITY +basic_ostream<_CharT, _Traits>& operator<<( + basic_ostream<_CharT, _Traits>& __os, + const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy) +{ + return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape); +} + +// extractor for non-const basic_string& proxies +template +_LIBCUDACXX_INLINE_VISIBILITY +basic_istream<_CharT, _Traits>& operator>>( + basic_istream<_CharT, _Traits>& __is, + const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy) +{ + return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape ); +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY +__quoted_output_proxy<_CharT, const _CharT *> +quoted ( const _CharT *__s, _CharT __delim = _CharT('"'), _CharT __escape =_CharT('\\')) +{ + const _CharT *__end = __s; + while ( *__end ) ++__end; + return __quoted_output_proxy<_CharT, const _CharT *> ( __s, __end, __delim, __escape ); +} + + +template +_LIBCUDACXX_INLINE_VISIBILITY +__quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator> +__quoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) +{ + return __quoted_output_proxy<_CharT, + typename basic_string <_CharT, _Traits, _Allocator>::const_iterator> + ( __s.cbegin(), __s.cend (), __delim, __escape ); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__quoted_proxy<_CharT, _Traits, _Allocator> +__quoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) +{ + return __quoted_proxy<_CharT, _Traits, _Allocator>( __s, __delim, __escape ); +} + + +#if _LIBCUDACXX_STD_VER > 11 + +template +_LIBCUDACXX_INLINE_VISIBILITY +__quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator> +quoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) +{ + return __quoted(__s, __delim, __escape); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +__quoted_proxy<_CharT, _Traits, _Allocator> +quoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) +{ + return __quoted(__s, __delim, __escape); +} + +template +__quoted_output_proxy<_CharT, const _CharT *, _Traits> +quoted (basic_string_view <_CharT, _Traits> __sv, + _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) +{ + return __quoted_output_proxy<_CharT, const _CharT *, _Traits> + ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape ); +} +#endif + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_IOMANIP diff --git a/cuda_toolkit/include/ios b/cuda_toolkit/include/ios new file mode 100644 index 0000000000000000000000000000000000000000..96bebb23e9e7357b1c7a76fff9d8364e77a3bf92 --- /dev/null +++ b/cuda_toolkit/include/ios @@ -0,0 +1,1053 @@ +// -*- C++ -*- +//===---------------------------- ios -------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_IOS +#define _LIBCUDACXX_IOS + +/* + ios synopsis + +#include + +namespace std +{ + +typedef OFF_T streamoff; +typedef SZ_T streamsize; +template class fpos; + +class ios_base +{ +public: + class failure; + + typedef T1 fmtflags; + static constexpr fmtflags boolalpha; + static constexpr fmtflags dec; + static constexpr fmtflags fixed; + static constexpr fmtflags hex; + static constexpr fmtflags internal; + static constexpr fmtflags left; + static constexpr fmtflags oct; + static constexpr fmtflags right; + static constexpr fmtflags scientific; + static constexpr fmtflags showbase; + static constexpr fmtflags showpoint; + static constexpr fmtflags showpos; + static constexpr fmtflags skipws; + static constexpr fmtflags unitbuf; + static constexpr fmtflags uppercase; + static constexpr fmtflags adjustfield; + static constexpr fmtflags basefield; + static constexpr fmtflags floatfield; + + typedef T2 iostate; + static constexpr iostate badbit; + static constexpr iostate eofbit; + static constexpr iostate failbit; + static constexpr iostate goodbit; + + typedef T3 openmode; + static constexpr openmode app; + static constexpr openmode ate; + static constexpr openmode binary; + static constexpr openmode in; + static constexpr openmode out; + static constexpr openmode trunc; + + typedef T4 seekdir; + static constexpr seekdir beg; + static constexpr seekdir cur; + static constexpr seekdir end; + + class Init; + + // 27.5.2.2 fmtflags state: + fmtflags flags() const; + fmtflags flags(fmtflags fmtfl); + fmtflags setf(fmtflags fmtfl); + fmtflags setf(fmtflags fmtfl, fmtflags mask); + void unsetf(fmtflags mask); + + streamsize precision() const; + streamsize precision(streamsize prec); + streamsize width() const; + streamsize width(streamsize wide); + + // 27.5.2.3 locales: + locale imbue(const locale& loc); + locale getloc() const; + + // 27.5.2.5 storage: + static int xalloc(); + long& iword(int index); + void*& pword(int index); + + // destructor + virtual ~ios_base(); + + // 27.5.2.6 callbacks; + enum event { erase_event, imbue_event, copyfmt_event }; + typedef void (*event_callback)(event, ios_base&, int index); + void register_callback(event_callback fn, int index); + + ios_base(const ios_base&) = delete; + ios_base& operator=(const ios_base&) = delete; + + static bool sync_with_stdio(bool sync = true); + +protected: + ios_base(); +}; + +template > +class basic_ios + : public ios_base +{ +public: + // types: + typedef charT char_type; + typedef typename traits::int_type int_type; // removed in C++17 + typedef typename traits::pos_type pos_type; // removed in C++17 + typedef typename traits::off_type off_type; // removed in C++17 + typedef traits traits_type; + + operator unspecified-bool-type() const; + bool operator!() const; + iostate rdstate() const; + void clear(iostate state = goodbit); + void setstate(iostate state); + bool good() const; + bool eof() const; + bool fail() const; + bool bad() const; + + iostate exceptions() const; + void exceptions(iostate except); + + // 27.5.4.1 Constructor/destructor: + explicit basic_ios(basic_streambuf* sb); + virtual ~basic_ios(); + + // 27.5.4.2 Members: + basic_ostream* tie() const; + basic_ostream* tie(basic_ostream* tiestr); + + basic_streambuf* rdbuf() const; + basic_streambuf* rdbuf(basic_streambuf* sb); + + basic_ios& copyfmt(const basic_ios& rhs); + + char_type fill() const; + char_type fill(char_type ch); + + locale imbue(const locale& loc); + + char narrow(char_type c, char dfault) const; + char_type widen(char c) const; + + basic_ios(const basic_ios& ) = delete; + basic_ios& operator=(const basic_ios&) = delete; + +protected: + basic_ios(); + void init(basic_streambuf* sb); + void move(basic_ios& rhs); + void swap(basic_ios& rhs) noexcept; + void set_rdbuf(basic_streambuf* sb); +}; + +// 27.5.5, manipulators: +ios_base& boolalpha (ios_base& str); +ios_base& noboolalpha(ios_base& str); +ios_base& showbase (ios_base& str); +ios_base& noshowbase (ios_base& str); +ios_base& showpoint (ios_base& str); +ios_base& noshowpoint(ios_base& str); +ios_base& showpos (ios_base& str); +ios_base& noshowpos (ios_base& str); +ios_base& skipws (ios_base& str); +ios_base& noskipws (ios_base& str); +ios_base& uppercase (ios_base& str); +ios_base& nouppercase(ios_base& str); +ios_base& unitbuf (ios_base& str); +ios_base& nounitbuf (ios_base& str); + +// 27.5.5.2 adjustfield: +ios_base& internal (ios_base& str); +ios_base& left (ios_base& str); +ios_base& right (ios_base& str); + +// 27.5.5.3 basefield: +ios_base& dec (ios_base& str); +ios_base& hex (ios_base& str); +ios_base& oct (ios_base& str); + +// 27.5.5.4 floatfield: +ios_base& fixed (ios_base& str); +ios_base& scientific (ios_base& str); +ios_base& hexfloat (ios_base& str); +ios_base& defaultfloat(ios_base& str); + +// 27.5.5.5 error reporting: +enum class io_errc +{ + stream = 1 +}; + +concept_map ErrorCodeEnum { }; +error_code make_error_code(io_errc e) noexcept; +error_condition make_error_condition(io_errc e) noexcept; +storage-class-specifier const error_category& iostream_category() noexcept; + +} // std + +*/ + +#include <__config> +#include +#include <__locale> +#include + +#if !defined(_LIBCUDACXX_HAS_NO_ATOMIC_HEADER) +#include // for __xindex_ +#endif + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +typedef ptrdiff_t streamsize; + +class _LIBCUDACXX_TYPE_VIS ios_base +{ +public: + class _LIBCUDACXX_EXCEPTION_ABI failure; + + typedef unsigned int fmtflags; + static const fmtflags boolalpha = 0x0001; + static const fmtflags dec = 0x0002; + static const fmtflags fixed = 0x0004; + static const fmtflags hex = 0x0008; + static const fmtflags internal = 0x0010; + static const fmtflags left = 0x0020; + static const fmtflags oct = 0x0040; + static const fmtflags right = 0x0080; + static const fmtflags scientific = 0x0100; + static const fmtflags showbase = 0x0200; + static const fmtflags showpoint = 0x0400; + static const fmtflags showpos = 0x0800; + static const fmtflags skipws = 0x1000; + static const fmtflags unitbuf = 0x2000; + static const fmtflags uppercase = 0x4000; + static const fmtflags adjustfield = left | right | internal; + static const fmtflags basefield = dec | oct | hex; + static const fmtflags floatfield = scientific | fixed; + + typedef unsigned int iostate; + static const iostate badbit = 0x1; + static const iostate eofbit = 0x2; + static const iostate failbit = 0x4; + static const iostate goodbit = 0x0; + + typedef unsigned int openmode; + static const openmode app = 0x01; + static const openmode ate = 0x02; + static const openmode binary = 0x04; + static const openmode in = 0x08; + static const openmode out = 0x10; + static const openmode trunc = 0x20; + + enum seekdir {beg, cur, end}; + +#if _LIBCUDACXX_STD_VER <= 14 + typedef iostate io_state; + typedef openmode open_mode; + typedef seekdir seek_dir; + + typedef _CUDA_VSTD::streamoff streamoff; + typedef _CUDA_VSTD::streampos streampos; +#endif + + class _LIBCUDACXX_TYPE_VIS Init; + + // 27.5.2.2 fmtflags state: + _LIBCUDACXX_INLINE_VISIBILITY fmtflags flags() const; + _LIBCUDACXX_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl); + _LIBCUDACXX_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl); + _LIBCUDACXX_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask); + _LIBCUDACXX_INLINE_VISIBILITY void unsetf(fmtflags __mask); + + _LIBCUDACXX_INLINE_VISIBILITY streamsize precision() const; + _LIBCUDACXX_INLINE_VISIBILITY streamsize precision(streamsize __prec); + _LIBCUDACXX_INLINE_VISIBILITY streamsize width() const; + _LIBCUDACXX_INLINE_VISIBILITY streamsize width(streamsize __wide); + + // 27.5.2.3 locales: + locale imbue(const locale& __loc); + locale getloc() const; + + // 27.5.2.5 storage: + static int xalloc(); + long& iword(int __index); + void*& pword(int __index); + + // destructor + virtual ~ios_base(); + + // 27.5.2.6 callbacks; + enum event { erase_event, imbue_event, copyfmt_event }; + typedef void (*event_callback)(event, ios_base&, int __index); + void register_callback(event_callback __fn, int __index); + +private: + ios_base(const ios_base&); // = delete; + ios_base& operator=(const ios_base&); // = delete; + +public: + static bool sync_with_stdio(bool __sync = true); + + _LIBCUDACXX_INLINE_VISIBILITY iostate rdstate() const; + void clear(iostate __state = goodbit); + _LIBCUDACXX_INLINE_VISIBILITY void setstate(iostate __state); + + _LIBCUDACXX_INLINE_VISIBILITY bool good() const; + _LIBCUDACXX_INLINE_VISIBILITY bool eof() const; + _LIBCUDACXX_INLINE_VISIBILITY bool fail() const; + _LIBCUDACXX_INLINE_VISIBILITY bool bad() const; + + _LIBCUDACXX_INLINE_VISIBILITY iostate exceptions() const; + _LIBCUDACXX_INLINE_VISIBILITY void exceptions(iostate __iostate); + + void __set_badbit_and_consider_rethrow(); + void __set_failbit_and_consider_rethrow(); + + _LIBCUDACXX_INLINE_VISIBILITY + void __setstate_nothrow(iostate __state) + { + if (__rdbuf_) + __rdstate_ |= __state; + else + __rdstate_ |= __state | ios_base::badbit; + } + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ios_base() {// purposefully does no initialization + } + + void init(void* __sb); + _LIBCUDACXX_INLINE_VISIBILITY void* rdbuf() const {return __rdbuf_;} + + _LIBCUDACXX_INLINE_VISIBILITY + void rdbuf(void* __sb) + { + __rdbuf_ = __sb; + clear(); + } + + void __call_callbacks(event); + void copyfmt(const ios_base&); + void move(ios_base&); + void swap(ios_base&) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + void set_rdbuf(void* __sb) + { + __rdbuf_ = __sb; + } + +private: + // All data members must be scalars + fmtflags __fmtflags_; + streamsize __precision_; + streamsize __width_; + iostate __rdstate_; + iostate __exceptions_; + void* __rdbuf_; + void* __loc_; + event_callback* __fn_; + int* __index_; + size_t __event_size_; + size_t __event_cap_; +// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only +// enabled with clang. +#if defined(_LIBCUDACXX_HAS_C_ATOMIC_IMP) && !defined(_LIBCUDACXX_HAS_NO_THREADS) + static atomic __xindex_; +#else + static int __xindex_; +#endif + long* __iarray_; + size_t __iarray_size_; + size_t __iarray_cap_; + void** __parray_; + size_t __parray_size_; + size_t __parray_cap_; +}; + +//enum class io_errc +_LIBCUDACXX_DECLARE_STRONG_ENUM(io_errc) +{ + stream = 1 +}; +_LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(io_errc) + +template <> +struct _LIBCUDACXX_TEMPLATE_VIS is_error_code_enum : public true_type { }; + +#ifdef _LIBCUDACXX_HAS_NO_STRONG_ENUMS +template <> +struct _LIBCUDACXX_TEMPLATE_VIS is_error_code_enum : public true_type { }; +#endif + +_LIBCUDACXX_FUNC_VIS +const error_category& iostream_category() noexcept; + +inline _LIBCUDACXX_INLINE_VISIBILITY +error_code +make_error_code(io_errc __e) noexcept +{ + return error_code(static_cast(__e), iostream_category()); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +error_condition +make_error_condition(io_errc __e) noexcept +{ + return error_condition(static_cast(__e), iostream_category()); +} + +class _LIBCUDACXX_EXCEPTION_ABI ios_base::failure + : public system_error +{ +public: + explicit failure(const string& __msg, const error_code& __ec = io_errc::stream); + explicit failure(const char* __msg, const error_code& __ec = io_errc::stream); + virtual ~failure() throw(); +}; + +_LIBCUDACXX_NORETURN inline _LIBCUDACXX_INLINE_VISIBILITY +void __throw_failure(char const* __msg) { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + throw ios_base::failure(__msg); +#else + ((void)__msg); + _CUDA_VSTD::abort(); +#endif +} + +class _LIBCUDACXX_TYPE_VIS ios_base::Init +{ +public: + Init(); + ~Init(); +}; + +// fmtflags + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base::fmtflags +ios_base::flags() const +{ + return __fmtflags_; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base::fmtflags +ios_base::flags(fmtflags __fmtfl) +{ + fmtflags __r = __fmtflags_; + __fmtflags_ = __fmtfl; + return __r; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base::fmtflags +ios_base::setf(fmtflags __fmtfl) +{ + fmtflags __r = __fmtflags_; + __fmtflags_ |= __fmtfl; + return __r; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +ios_base::unsetf(fmtflags __mask) +{ + __fmtflags_ &= ~__mask; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base::fmtflags +ios_base::setf(fmtflags __fmtfl, fmtflags __mask) +{ + fmtflags __r = __fmtflags_; + unsetf(__mask); + __fmtflags_ |= __fmtfl & __mask; + return __r; +} + +// precision + +inline _LIBCUDACXX_INLINE_VISIBILITY +streamsize +ios_base::precision() const +{ + return __precision_; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +streamsize +ios_base::precision(streamsize __prec) +{ + streamsize __r = __precision_; + __precision_ = __prec; + return __r; +} + +// width + +inline _LIBCUDACXX_INLINE_VISIBILITY +streamsize +ios_base::width() const +{ + return __width_; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +streamsize +ios_base::width(streamsize __wide) +{ + streamsize __r = __width_; + __width_ = __wide; + return __r; +} + +// iostate + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base::iostate +ios_base::rdstate() const +{ + return __rdstate_; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +ios_base::setstate(iostate __state) +{ + clear(__rdstate_ | __state); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +ios_base::good() const +{ + return __rdstate_ == 0; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +ios_base::eof() const +{ + return (__rdstate_ & eofbit) != 0; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +ios_base::fail() const +{ + return (__rdstate_ & (failbit | badbit)) != 0; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +ios_base::bad() const +{ + return (__rdstate_ & badbit) != 0; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base::iostate +ios_base::exceptions() const +{ + return __exceptions_; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +void +ios_base::exceptions(iostate __iostate) +{ + __exceptions_ = __iostate; + clear(__rdstate_); +} + +template +class _LIBCUDACXX_TEMPLATE_VIS basic_ios + : public ios_base +{ +public: + // types: + typedef _CharT char_type; + typedef _Traits traits_type; + + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + static_assert((is_same<_CharT, typename traits_type::char_type>::value), + "traits_type::char_type must be the same type as CharT"); + + // __true_value will generate undefined references when linking unless + // we give it internal linkage. + + _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_EXPLICIT operator bool() const {return !fail();} + _LIBCUDACXX_INLINE_VISIBILITY bool operator!() const {return fail();} + _LIBCUDACXX_INLINE_VISIBILITY iostate rdstate() const {return ios_base::rdstate();} + _LIBCUDACXX_INLINE_VISIBILITY void clear(iostate __state = goodbit) {ios_base::clear(__state);} + _LIBCUDACXX_INLINE_VISIBILITY void setstate(iostate __state) {ios_base::setstate(__state);} + _LIBCUDACXX_INLINE_VISIBILITY bool good() const {return ios_base::good();} + _LIBCUDACXX_INLINE_VISIBILITY bool eof() const {return ios_base::eof();} + _LIBCUDACXX_INLINE_VISIBILITY bool fail() const {return ios_base::fail();} + _LIBCUDACXX_INLINE_VISIBILITY bool bad() const {return ios_base::bad();} + + _LIBCUDACXX_INLINE_VISIBILITY iostate exceptions() const {return ios_base::exceptions();} + _LIBCUDACXX_INLINE_VISIBILITY void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);} + + // 27.5.4.1 Constructor/destructor: + _LIBCUDACXX_INLINE_VISIBILITY + explicit basic_ios(basic_streambuf* __sb); + virtual ~basic_ios(); + + // 27.5.4.2 Members: + _LIBCUDACXX_INLINE_VISIBILITY + basic_ostream* tie() const; + _LIBCUDACXX_INLINE_VISIBILITY + basic_ostream* tie(basic_ostream* __tiestr); + + _LIBCUDACXX_INLINE_VISIBILITY + basic_streambuf* rdbuf() const; + _LIBCUDACXX_INLINE_VISIBILITY + basic_streambuf* rdbuf(basic_streambuf* __sb); + + basic_ios& copyfmt(const basic_ios& __rhs); + + _LIBCUDACXX_INLINE_VISIBILITY + char_type fill() const; + _LIBCUDACXX_INLINE_VISIBILITY + char_type fill(char_type __ch); + + _LIBCUDACXX_INLINE_VISIBILITY + locale imbue(const locale& __loc); + + _LIBCUDACXX_INLINE_VISIBILITY + char narrow(char_type __c, char __dfault) const; + _LIBCUDACXX_INLINE_VISIBILITY + char_type widen(char __c) const; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + basic_ios() {// purposefully does no initialization + } + _LIBCUDACXX_INLINE_VISIBILITY + void init(basic_streambuf* __sb); + + _LIBCUDACXX_INLINE_VISIBILITY + void move(basic_ios& __rhs); + _LIBCUDACXX_INLINE_VISIBILITY + void move(basic_ios&& __rhs) {move(__rhs);} + _LIBCUDACXX_INLINE_VISIBILITY + void swap(basic_ios& __rhs) noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + void set_rdbuf(basic_streambuf* __sb); +private: + basic_ostream* __tie_; + mutable int_type __fill_; +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf* __sb) +{ + init(__sb); +} + +template +basic_ios<_CharT, _Traits>::~basic_ios() +{ +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +basic_ios<_CharT, _Traits>::init(basic_streambuf* __sb) +{ + ios_base::init(__sb); + __tie_ = 0; + __fill_ = traits_type::eof(); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_ostream<_CharT, _Traits>* +basic_ios<_CharT, _Traits>::tie() const +{ + return __tie_; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_ostream<_CharT, _Traits>* +basic_ios<_CharT, _Traits>::tie(basic_ostream* __tiestr) +{ + basic_ostream* __r = __tie_; + __tie_ = __tiestr; + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_streambuf<_CharT, _Traits>* +basic_ios<_CharT, _Traits>::rdbuf() const +{ + return static_cast*>(ios_base::rdbuf()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_streambuf<_CharT, _Traits>* +basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf* __sb) +{ + basic_streambuf* __r = rdbuf(); + ios_base::rdbuf(__sb); + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +locale +basic_ios<_CharT, _Traits>::imbue(const locale& __loc) +{ + locale __r = getloc(); + ios_base::imbue(__loc); + if (rdbuf()) + rdbuf()->pubimbue(__loc); + return __r; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +char +basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const +{ + return use_facet >(getloc()).narrow(__c, __dfault); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_CharT +basic_ios<_CharT, _Traits>::widen(char __c) const +{ + return use_facet >(getloc()).widen(__c); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_CharT +basic_ios<_CharT, _Traits>::fill() const +{ + if (traits_type::eq_int_type(traits_type::eof(), __fill_)) + __fill_ = widen(' '); + return __fill_; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_CharT +basic_ios<_CharT, _Traits>::fill(char_type __ch) +{ + char_type __r = __fill_; + __fill_ = __ch; + return __r; +} + +template +basic_ios<_CharT, _Traits>& +basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) +{ + if (this != &__rhs) + { + __call_callbacks(erase_event); + ios_base::copyfmt(__rhs); + __tie_ = __rhs.__tie_; + __fill_ = __rhs.__fill_; + __call_callbacks(copyfmt_event); + exceptions(__rhs.exceptions()); + } + return *this; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +basic_ios<_CharT, _Traits>::move(basic_ios& __rhs) +{ + ios_base::move(__rhs); + __tie_ = __rhs.__tie_; + __rhs.__tie_ = 0; + __fill_ = __rhs.__fill_; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) noexcept +{ + ios_base::swap(__rhs); + _CUDA_VSTD::swap(__tie_, __rhs.__tie_); + _CUDA_VSTD::swap(__fill_, __rhs.__fill_); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf* __sb) +{ + ios_base::set_rdbuf(__sb); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +boolalpha(ios_base& __str) +{ + __str.setf(ios_base::boolalpha); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +noboolalpha(ios_base& __str) +{ + __str.unsetf(ios_base::boolalpha); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +showbase(ios_base& __str) +{ + __str.setf(ios_base::showbase); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +noshowbase(ios_base& __str) +{ + __str.unsetf(ios_base::showbase); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +showpoint(ios_base& __str) +{ + __str.setf(ios_base::showpoint); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +noshowpoint(ios_base& __str) +{ + __str.unsetf(ios_base::showpoint); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +showpos(ios_base& __str) +{ + __str.setf(ios_base::showpos); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +noshowpos(ios_base& __str) +{ + __str.unsetf(ios_base::showpos); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +skipws(ios_base& __str) +{ + __str.setf(ios_base::skipws); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +noskipws(ios_base& __str) +{ + __str.unsetf(ios_base::skipws); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +uppercase(ios_base& __str) +{ + __str.setf(ios_base::uppercase); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +nouppercase(ios_base& __str) +{ + __str.unsetf(ios_base::uppercase); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +unitbuf(ios_base& __str) +{ + __str.setf(ios_base::unitbuf); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +nounitbuf(ios_base& __str) +{ + __str.unsetf(ios_base::unitbuf); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +internal(ios_base& __str) +{ + __str.setf(ios_base::internal, ios_base::adjustfield); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +left(ios_base& __str) +{ + __str.setf(ios_base::left, ios_base::adjustfield); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +right(ios_base& __str) +{ + __str.setf(ios_base::right, ios_base::adjustfield); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +dec(ios_base& __str) +{ + __str.setf(ios_base::dec, ios_base::basefield); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +hex(ios_base& __str) +{ + __str.setf(ios_base::hex, ios_base::basefield); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +oct(ios_base& __str) +{ + __str.setf(ios_base::oct, ios_base::basefield); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +fixed(ios_base& __str) +{ + __str.setf(ios_base::fixed, ios_base::floatfield); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +scientific(ios_base& __str) +{ + __str.setf(ios_base::scientific, ios_base::floatfield); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +hexfloat(ios_base& __str) +{ + __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield); + return __str; +} + +inline _LIBCUDACXX_INLINE_VISIBILITY +ios_base& +defaultfloat(ios_base& __str) +{ + __str.unsetf(ios_base::floatfield); + return __str; +} + +template +class __save_flags +{ + typedef basic_ios<_CharT, _Traits> __stream_type; + typedef typename __stream_type::fmtflags fmtflags; + + __stream_type& __stream_; + fmtflags __fmtflags_; + _CharT __fill_; + + __save_flags(const __save_flags&); + __save_flags& operator=(const __save_flags&); +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit __save_flags(__stream_type& __stream) + : __stream_(__stream), + __fmtflags_(__stream.flags()), + __fill_(__stream.fill()) + {} + _LIBCUDACXX_INLINE_VISIBILITY + ~__save_flags() + { + __stream_.flags(__fmtflags_); + __stream_.fill(__fill_); + } +}; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_IOS diff --git a/cuda_toolkit/include/iosfwd b/cuda_toolkit/include/iosfwd new file mode 100644 index 0000000000000000000000000000000000000000..7d05057127b3b4f87561f2efcd395231b932f235 --- /dev/null +++ b/cuda_toolkit/include/iosfwd @@ -0,0 +1,213 @@ +// -*- C++ -*- +//===--------------------------- iosfwd -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_IOSFWD +#define _LIBCUDACXX_IOSFWD + +/* + iosfwd synopsis + +namespace std +{ + +template struct char_traits; +template<> struct char_traits; +template<> struct char_traits; // C++20 +template<> struct char_traits; +template<> struct char_traits; +template<> struct char_traits; + +template class allocator; + +class ios_base; +template > class basic_ios; + +template > class basic_streambuf; +template > class basic_istream; +template > class basic_ostream; +template > class basic_iostream; + +template , class Allocator = allocator > + class basic_stringbuf; +template , class Allocator = allocator > + class basic_istringstream; +template , class Allocator = allocator > + class basic_ostringstream; +template , class Allocator = allocator > + class basic_stringstream; + +template > class basic_filebuf; +template > class basic_ifstream; +template > class basic_ofstream; +template > class basic_fstream; + +template > class istreambuf_iterator; +template > class ostreambuf_iterator; + +typedef basic_ios ios; +typedef basic_ios wios; + +typedef basic_streambuf streambuf; +typedef basic_istream istream; +typedef basic_ostream ostream; +typedef basic_iostream iostream; + +typedef basic_stringbuf stringbuf; +typedef basic_istringstream istringstream; +typedef basic_ostringstream ostringstream; +typedef basic_stringstream stringstream; + +typedef basic_filebuf filebuf; +typedef basic_ifstream ifstream; +typedef basic_ofstream ofstream; +typedef basic_fstream fstream; + +typedef basic_streambuf wstreambuf; +typedef basic_istream wistream; +typedef basic_ostream wostream; +typedef basic_iostream wiostream; + +typedef basic_stringbuf wstringbuf; +typedef basic_istringstream wistringstream; +typedef basic_ostringstream wostringstream; +typedef basic_stringstream wstringstream; + +typedef basic_filebuf wfilebuf; +typedef basic_ifstream wifstream; +typedef basic_ofstream wofstream; +typedef basic_fstream wfstream; + +template class fpos; +typedef fpos::state_type> streampos; +typedef fpos::state_type> wstreampos; + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#include // for mbstate_t +#endif //__cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__fwd/string.h" +#include "version" + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +class _LIBCUDACXX_TYPE_VIS ios_base; + +template > + class _LIBCUDACXX_TEMPLATE_VIS basic_ios; + +template > + class _LIBCUDACXX_TEMPLATE_VIS basic_streambuf; +template > + class _LIBCUDACXX_TEMPLATE_VIS basic_istream; +template > + class _LIBCUDACXX_TEMPLATE_VIS basic_ostream; +template > + class _LIBCUDACXX_TEMPLATE_VIS basic_iostream; + +template , + class _Allocator = allocator<_CharT> > + class _LIBCUDACXX_TEMPLATE_VIS basic_stringbuf; +template , + class _Allocator = allocator<_CharT> > + class _LIBCUDACXX_TEMPLATE_VIS basic_istringstream; +template , + class _Allocator = allocator<_CharT> > + class _LIBCUDACXX_TEMPLATE_VIS basic_ostringstream; +template , + class _Allocator = allocator<_CharT> > + class _LIBCUDACXX_TEMPLATE_VIS basic_stringstream; + +template > + class _LIBCUDACXX_TEMPLATE_VIS basic_filebuf; +template > + class _LIBCUDACXX_TEMPLATE_VIS basic_ifstream; +template > + class _LIBCUDACXX_TEMPLATE_VIS basic_ofstream; +template > + class _LIBCUDACXX_TEMPLATE_VIS basic_fstream; + +template > + class _LIBCUDACXX_TEMPLATE_VIS istreambuf_iterator; +template > + class _LIBCUDACXX_TEMPLATE_VIS ostreambuf_iterator; + +typedef basic_ios ios; +typedef basic_ios wios; + +typedef basic_streambuf streambuf; +typedef basic_istream istream; +typedef basic_ostream ostream; +typedef basic_iostream iostream; + +typedef basic_stringbuf stringbuf; +typedef basic_istringstream istringstream; +typedef basic_ostringstream ostringstream; +typedef basic_stringstream stringstream; + +typedef basic_filebuf filebuf; +typedef basic_ifstream ifstream; +typedef basic_ofstream ofstream; +typedef basic_fstream fstream; + +typedef basic_streambuf wstreambuf; +typedef basic_istream wistream; +typedef basic_ostream wostream; +typedef basic_iostream wiostream; + +typedef basic_stringbuf wstringbuf; +typedef basic_istringstream wistringstream; +typedef basic_ostringstream wostringstream; +typedef basic_stringstream wstringstream; + +typedef basic_filebuf wfilebuf; +typedef basic_ifstream wifstream; +typedef basic_ofstream wofstream; +typedef basic_fstream wfstream; + +#if !defined(_LIBCUDACXX_HAS_NO_WCHAR_H) +template class _LIBCUDACXX_TEMPLATE_VIS fpos; +typedef fpos streampos; +typedef fpos wstreampos; +#ifndef _LIBCUDACXX_NO_HAS_CHAR8_T +typedef fpos u8streampos; +#endif +#ifndef _LIBCUDACXX_HAS_NO_UNICODE_CHARS +typedef fpos u16streampos; +typedef fpos u32streampos; +#endif // _LIBCUDACXX_HAS_NO_UNICODE_CHARS +#endif + +#if defined(_NEWLIB_VERSION) +// On newlib, off_t is 'long int' +typedef long int streamoff; // for char_traits in +#else +typedef long long streamoff; // for char_traits in +#endif + +// Include other forward declarations here +template > +class _LIBCUDACXX_TEMPLATE_VIS vector; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_IOSFWD diff --git a/cuda_toolkit/include/iostream b/cuda_toolkit/include/iostream new file mode 100644 index 0000000000000000000000000000000000000000..4ee967179bc3a31e31f57c0f6d7f5b338bf48010 --- /dev/null +++ b/cuda_toolkit/include/iostream @@ -0,0 +1,67 @@ +// -*- C++ -*- +//===--------------------------- iostream ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_IOSTREAM +#define _LIBCUDACXX_IOSTREAM + +/* + iostream synopsis + +#include +#include +#include +#include + +namespace std { + +extern istream cin; +extern ostream cout; +extern ostream cerr; +extern ostream clog; +extern wistream wcin; +extern wostream wcout; +extern wostream wcerr; +extern wostream wclog; + +} // std + +*/ + +#include <__config> +#include +#include +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#ifndef _LIBCUDACXX_HAS_NO_STDIN +extern _LIBCUDACXX_FUNC_VIS istream cin; +extern _LIBCUDACXX_FUNC_VIS wistream wcin; +#endif +#ifndef _LIBCUDACXX_HAS_NO_STDOUT +extern _LIBCUDACXX_FUNC_VIS ostream cout; +extern _LIBCUDACXX_FUNC_VIS wostream wcout; +#endif +extern _LIBCUDACXX_FUNC_VIS ostream cerr; +extern _LIBCUDACXX_FUNC_VIS wostream wcerr; +extern _LIBCUDACXX_FUNC_VIS ostream clog; +extern _LIBCUDACXX_FUNC_VIS wostream wclog; + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_IOSTREAM diff --git a/cuda_toolkit/include/istream b/cuda_toolkit/include/istream new file mode 100644 index 0000000000000000000000000000000000000000..4fbb80742b9be44c59e8f82d30736284f11aab9b --- /dev/null +++ b/cuda_toolkit/include/istream @@ -0,0 +1,1633 @@ +// -*- C++ -*- +//===--------------------------- istream ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_ISTREAM +#define _LIBCUDACXX_ISTREAM + +/* + istream synopsis + +template > +class basic_istream + : virtual public basic_ios +{ +public: + // types (inherited from basic_ios (27.5.4)): + typedef charT char_type; + typedef traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // 27.7.1.1.1 Constructor/destructor: + explicit basic_istream(basic_streambuf* sb); + basic_istream(basic_istream&& rhs); + virtual ~basic_istream(); + + // 27.7.1.1.2 Assign/swap: + basic_istream& operator=(basic_istream&& rhs); + void swap(basic_istream& rhs); + + // 27.7.1.1.3 Prefix/suffix: + class sentry; + + // 27.7.1.2 Formatted input: + basic_istream& operator>>(basic_istream& (*pf)(basic_istream&)); + basic_istream& operator>>(basic_ios& + (*pf)(basic_ios&)); + basic_istream& operator>>(ios_base& (*pf)(ios_base&)); + basic_istream& operator>>(basic_streambuf* sb); + basic_istream& operator>>(bool& n); + basic_istream& operator>>(short& n); + basic_istream& operator>>(unsigned short& n); + basic_istream& operator>>(int& n); + basic_istream& operator>>(unsigned int& n); + basic_istream& operator>>(long& n); + basic_istream& operator>>(unsigned long& n); + basic_istream& operator>>(long long& n); + basic_istream& operator>>(unsigned long long& n); + basic_istream& operator>>(float& f); + basic_istream& operator>>(double& f); + basic_istream& operator>>(long double& f); + basic_istream& operator>>(void*& p); + + // 27.7.1.3 Unformatted input: + streamsize gcount() const; + int_type get(); + basic_istream& get(char_type& c); + basic_istream& get(char_type* s, streamsize n); + basic_istream& get(char_type* s, streamsize n, char_type delim); + basic_istream& get(basic_streambuf& sb); + basic_istream& get(basic_streambuf& sb, char_type delim); + + basic_istream& getline(char_type* s, streamsize n); + basic_istream& getline(char_type* s, streamsize n, char_type delim); + + basic_istream& ignore(streamsize n = 1, int_type delim = traits_type::eof()); + int_type peek(); + basic_istream& read (char_type* s, streamsize n); + streamsize readsome(char_type* s, streamsize n); + + basic_istream& putback(char_type c); + basic_istream& unget(); + int sync(); + + pos_type tellg(); + basic_istream& seekg(pos_type); + basic_istream& seekg(off_type, ios_base::seekdir); +protected: + basic_istream(const basic_istream& rhs) = delete; + basic_istream(basic_istream&& rhs); + // 27.7.2.1.2 Assign/swap: + basic_istream& operator=(const basic_istream& rhs) = delete; + basic_istream& operator=(basic_istream&& rhs); + void swap(basic_istream& rhs); +}; + +// 27.7.1.2.3 character extraction templates: +template + basic_istream& operator>>(basic_istream&, charT&); + +template + basic_istream& operator>>(basic_istream&, unsigned char&); + +template + basic_istream& operator>>(basic_istream&, signed char&); + +template + basic_istream& operator>>(basic_istream&, charT*); + +template + basic_istream& operator>>(basic_istream&, unsigned char*); + +template + basic_istream& operator>>(basic_istream&, signed char*); + +template + void + swap(basic_istream& x, basic_istream& y); + +typedef basic_istream istream; +typedef basic_istream wistream; + +template > +class basic_iostream : + public basic_istream, + public basic_ostream +{ +public: + // types: + typedef charT char_type; + typedef traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // constructor/destructor + explicit basic_iostream(basic_streambuf* sb); + basic_iostream(basic_iostream&& rhs); + virtual ~basic_iostream(); + + // assign/swap + basic_iostream& operator=(basic_iostream&& rhs); + void swap(basic_iostream& rhs); +}; + +template + void + swap(basic_iostream& x, basic_iostream& y); + +typedef basic_iostream iostream; +typedef basic_iostream wiostream; + +template + basic_istream& + ws(basic_istream& is); + +template + basic_istream& + operator>>(basic_istream&& is, T& x); + +} // std + +*/ + +#include <__config> +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template +class _LIBCUDACXX_TEMPLATE_VIS basic_istream + : virtual public basic_ios<_CharT, _Traits> +{ + streamsize __gc_; +public: + // types (inherited from basic_ios (27.5.4)): + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // 27.7.1.1.1 Constructor/destructor: + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + explicit basic_istream(basic_streambuf* __sb) : __gc_(0) + { this->init(__sb); } + virtual ~basic_istream(); +protected: + inline _LIBCUDACXX_INLINE_VISIBILITY + basic_istream(basic_istream&& __rhs); + + // 27.7.1.1.2 Assign/swap: + inline _LIBCUDACXX_INLINE_VISIBILITY + basic_istream& operator=(basic_istream&& __rhs); + + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + void swap(basic_istream& __rhs) { + _CUDA_VSTD::swap(__gc_, __rhs.__gc_); + basic_ios::swap(__rhs); + } + + basic_istream (const basic_istream& __rhs) = delete; + basic_istream& operator=(const basic_istream& __rhs) = delete; +public: + + // 27.7.1.1.3 Prefix/suffix: + class _LIBCUDACXX_TEMPLATE_VIS sentry; + + // 27.7.1.2 Formatted input: + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)) + { return __pf(*this); } + + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + basic_istream& operator>>(basic_ios& + (*__pf)(basic_ios&)) + { __pf(*this); return *this; } + + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + basic_istream& operator>>(ios_base& (*__pf)(ios_base&)) + { __pf(*this); return *this; } + + basic_istream& operator>>(basic_streambuf* __sb); + basic_istream& operator>>(bool& __n); + basic_istream& operator>>(short& __n); + basic_istream& operator>>(unsigned short& __n); + basic_istream& operator>>(int& __n); + basic_istream& operator>>(unsigned int& __n); + basic_istream& operator>>(long& __n); + basic_istream& operator>>(unsigned long& __n); + basic_istream& operator>>(long long& __n); + basic_istream& operator>>(unsigned long long& __n); + basic_istream& operator>>(float& __f); + basic_istream& operator>>(double& __f); + basic_istream& operator>>(long double& __f); + basic_istream& operator>>(void*& __p); + + // 27.7.1.3 Unformatted input: + _LIBCUDACXX_INLINE_VISIBILITY + streamsize gcount() const {return __gc_;} + int_type get(); + + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + basic_istream& get(char_type& __c) { + int_type __ch = get(); + if (__ch != traits_type::eof()) + __c = traits_type::to_char_type(__ch); + return *this; + } + + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + basic_istream& get(char_type* __s, streamsize __n) + { return get(__s, __n, this->widen('\n')); } + + basic_istream& get(char_type* __s, streamsize __n, char_type __dlm); + + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + basic_istream& get(basic_streambuf& __sb) + { return get(__sb, this->widen('\n')); } + + basic_istream& get(basic_streambuf& __sb, char_type __dlm); + + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + basic_istream& getline(char_type* __s, streamsize __n) + { return getline(__s, __n, this->widen('\n')); } + + basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm); + + basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof()); + int_type peek(); + basic_istream& read (char_type* __s, streamsize __n); + streamsize readsome(char_type* __s, streamsize __n); + + basic_istream& putback(char_type __c); + basic_istream& unget(); + int sync(); + + pos_type tellg(); + basic_istream& seekg(pos_type __pos); + basic_istream& seekg(off_type __off, ios_base::seekdir __dir); +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS basic_istream<_CharT, _Traits>::sentry +{ + bool __ok_; + + sentry(const sentry&); // = delete; + sentry& operator=(const sentry&); // = delete; + +public: + explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false); +// ~sentry() = default; + + _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_EXPLICIT + operator bool() const {return __ok_;} +}; + +template +basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is, + bool __noskipws) + : __ok_(false) +{ + if (__is.good()) + { + if (__is.tie()) + __is.tie()->flush(); + if (!__noskipws && (__is.flags() & ios_base::skipws)) + { + typedef istreambuf_iterator<_CharT, _Traits> _Ip; + const ctype<_CharT>& __ct = use_facet >(__is.getloc()); + _Ip __i(__is); + _Ip __eof; + for (; __i != __eof; ++__i) + if (!__ct.is(__ct.space, *__i)) + break; + if (__i == __eof) + __is.setstate(ios_base::failbit | ios_base::eofbit); + } + __ok_ = __is.good(); + } + else + __is.setstate(ios_base::failbit); +} + +template +basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs) + : __gc_(__rhs.__gc_) +{ + __rhs.__gc_ = 0; + this->move(__rhs); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs) +{ + swap(__rhs); + return *this; +} + +template +basic_istream<_CharT, _Traits>::~basic_istream() +{ +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +basic_istream<_CharT, _Traits>& +__input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) { + ios_base::iostate __state = ios_base::goodbit; + typename basic_istream<_CharT, _Traits>::sentry __s(__is); + if (__s) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + typedef istreambuf_iterator<_CharT, _Traits> _Ip; + typedef num_get<_CharT, _Ip> _Fp; + use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + __is.__setstate_nothrow(__state); + if (__is.exceptions() & ios_base::badbit) + { + throw; + } + } +#endif + __is.setstate(__state); + } + return __is; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(long& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(long long& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(float& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(double& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(long double& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(bool& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(void*& __n) +{ + return _CUDA_VSTD::__input_arithmetic(*this, __n); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +basic_istream<_CharT, _Traits>& +__input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp& __n) { + ios_base::iostate __state = ios_base::goodbit; + typename basic_istream<_CharT, _Traits>::sentry __s(__is); + if (__s) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + typedef istreambuf_iterator<_CharT, _Traits> _Ip; + typedef num_get<_CharT, _Ip> _Fp; + long __temp; + use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp); + if (__temp < numeric_limits<_Tp>::min()) + { + __state |= ios_base::failbit; + __n = numeric_limits<_Tp>::min(); + } + else if (__temp > numeric_limits<_Tp>::max()) + { + __state |= ios_base::failbit; + __n = numeric_limits<_Tp>::max(); + } + else + { + __n = static_cast<_Tp>(__temp); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + __is.__setstate_nothrow(__state); + if (__is.exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __is.setstate(__state); + } + return __is; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(short& __n) +{ + return _CUDA_VSTD::__input_arithmetic_with_numeric_limits(*this, __n); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(int& __n) +{ + return _CUDA_VSTD::__input_arithmetic_with_numeric_limits(*this, __n); +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +basic_istream<_CharT, _Traits>& +__input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n) +{ + ios_base::iostate __state = ios_base::goodbit; + typename basic_istream<_CharT, _Traits>::sentry __sen(__is); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif + _CharT* __s = __p; + const ctype<_CharT>& __ct = use_facet >(__is.getloc()); + while (__s != __p + (__n-1)) + { + typename _Traits::int_type __i = __is.rdbuf()->sgetc(); + if (_Traits::eq_int_type(__i, _Traits::eof())) + { + __state |= ios_base::eofbit; + break; + } + _CharT __ch = _Traits::to_char_type(__i); + if (__ct.is(__ct.space, __ch)) + break; + *__s++ = __ch; + __is.rdbuf()->sbumpc(); + } + *__s = _CharT(); + __is.width(0); + if (__s == __p) + __state |= ios_base::failbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + __is.__setstate_nothrow(__state); + if (__is.exceptions() & ios_base::badbit) + { + throw; + } + } +#endif + __is.setstate(__state); + } + return __is; +} + +#if _LIBCUDACXX_STD_VER > 17 + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, _CharT (&__buf)[_Np]) +{ + size_t __n = _Np; + if (__is.width() > 0) + __n = _CUDA_VSTD::min(size_t(__is.width()), _Np); + return _CUDA_VSTD::__input_c_string(__is, __buf, __n); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream& +operator>>(basic_istream& __is, unsigned char (&__buf)[_Np]) +{ + return __is >> (char(&)[_Np])__buf; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream& +operator>>(basic_istream& __is, signed char (&__buf)[_Np]) +{ + return __is >> (char(&)[_Np])__buf; +} + +#else + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s) +{ + streamsize __n = __is.width(); + if (__n <= 0) + __n = numeric_limits::max() / sizeof(_CharT) - 1; + return _CUDA_VSTD::__input_c_string(__is, __s, size_t(__n)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream& +operator>>(basic_istream& __is, unsigned char* __s) +{ + return __is >> (char*)__s; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream& +operator>>(basic_istream& __is, signed char* __s) +{ + return __is >> (char*)__s; +} + +#endif // _LIBCUDACXX_STD_VER > 17 + +template +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c) +{ + ios_base::iostate __state = ios_base::goodbit; + typename basic_istream<_CharT, _Traits>::sentry __sen(__is); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif + typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); + if (_Traits::eq_int_type(__i, _Traits::eof())) + __state |= ios_base::eofbit | ios_base::failbit; + else + __c = _Traits::to_char_type(__i); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + __is.__setstate_nothrow(__state); + if (__is.exceptions() & ios_base::badbit) + { + throw; + } + } +#endif + __is.setstate(__state); + } + return __is; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream& +operator>>(basic_istream& __is, unsigned char& __c) +{ + return __is >> (char&)__c; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream& +operator>>(basic_istream& __is, signed char& __c) +{ + return __is >> (char&)__c; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::operator>>(basic_streambuf* __sb) +{ + ios_base::iostate __state = ios_base::goodbit; + __gc_ = 0; + sentry __s(*this, true); + if (__s) + { + if (__sb) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + while (true) + { + typename traits_type::int_type __i = this->rdbuf()->sgetc(); + if (traits_type::eq_int_type(__i, _Traits::eof())) + { + __state |= ios_base::eofbit; + break; + } + if (traits_type::eq_int_type( + __sb->sputc(traits_type::to_char_type(__i)), + traits_type::eof())) + break; + ++__gc_; + this->rdbuf()->sbumpc(); + } + if (__gc_ == 0) + __state |= ios_base::failbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + if (__gc_ == 0) + __state |= ios_base::failbit; + + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::failbit || this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + } + else + { + __state |= ios_base::failbit; + } + this->setstate(__state); + } + return *this; +} + +template +typename basic_istream<_CharT, _Traits>::int_type +basic_istream<_CharT, _Traits>::get() +{ + ios_base::iostate __state = ios_base::goodbit; + __gc_ = 0; + int_type __r = traits_type::eof(); + sentry __s(*this, true); + if (__s) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif + __r = this->rdbuf()->sbumpc(); + if (traits_type::eq_int_type(__r, traits_type::eof())) + __state |= ios_base::failbit | ios_base::eofbit; + else + __gc_ = 1; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + this->__setstate_nothrow(this->rdstate() | ios_base::badbit); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif + this->setstate(__state); + } + return __r; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm) +{ + ios_base::iostate __state = ios_base::goodbit; + __gc_ = 0; + sentry __sen(*this, true); + if (__sen) + { + if (__n > 0) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif + while (__gc_ < __n-1) + { + int_type __i = this->rdbuf()->sgetc(); + if (traits_type::eq_int_type(__i, traits_type::eof())) + { + __state |= ios_base::eofbit; + break; + } + char_type __ch = traits_type::to_char_type(__i); + if (traits_type::eq(__ch, __dlm)) + break; + *__s++ = __ch; + ++__gc_; + this->rdbuf()->sbumpc(); + } + if (__gc_ == 0) + __state |= ios_base::failbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + if (__n > 0) + *__s = char_type(); + throw; + } + } +#endif + } + else + { + __state |= ios_base::failbit; + } + + if (__n > 0) + *__s = char_type(); + this->setstate(__state); + } + if (__n > 0) + *__s = char_type(); + return *this; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::get(basic_streambuf& __sb, + char_type __dlm) +{ + ios_base::iostate __state = ios_base::goodbit; + __gc_ = 0; + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + while (true) + { + typename traits_type::int_type __i = this->rdbuf()->sgetc(); + if (traits_type::eq_int_type(__i, traits_type::eof())) + { + __state |= ios_base::eofbit; + break; + } + char_type __ch = traits_type::to_char_type(__i); + if (traits_type::eq(__ch, __dlm)) + break; + if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof())) + break; + ++__gc_; + this->rdbuf()->sbumpc(); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + // according to the spec, exceptions here are caught but not rethrown + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + if (__gc_ == 0) + __state |= ios_base::failbit; + this->setstate(__state); + } + return *this; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm) +{ + ios_base::iostate __state = ios_base::goodbit; + __gc_ = 0; + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + while (true) + { + typename traits_type::int_type __i = this->rdbuf()->sgetc(); + if (traits_type::eq_int_type(__i, traits_type::eof())) + { + __state |= ios_base::eofbit; + break; + } + char_type __ch = traits_type::to_char_type(__i); + if (traits_type::eq(__ch, __dlm)) + { + this->rdbuf()->sbumpc(); + ++__gc_; + break; + } + if (__gc_ >= __n-1) + { + __state |= ios_base::failbit; + break; + } + *__s++ = __ch; + this->rdbuf()->sbumpc(); + ++__gc_; + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + if (__n > 0) + *__s = char_type(); + if (__gc_ == 0) + __state |= ios_base::failbit; + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + } + if (__n > 0) + *__s = char_type(); + if (__gc_ == 0) + __state |= ios_base::failbit; + this->setstate(__state); + return *this; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) +{ + ios_base::iostate __state = ios_base::goodbit; + __gc_ = 0; + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + if (__n == numeric_limits::max()) + { + while (true) + { + typename traits_type::int_type __i = this->rdbuf()->sbumpc(); + if (traits_type::eq_int_type(__i, traits_type::eof())) + { + __state |= ios_base::eofbit; + break; + } + ++__gc_; + if (traits_type::eq_int_type(__i, __dlm)) + break; + } + } + else + { + while (__gc_ < __n) + { + typename traits_type::int_type __i = this->rdbuf()->sbumpc(); + if (traits_type::eq_int_type(__i, traits_type::eof())) + { + __state |= ios_base::eofbit; + break; + } + ++__gc_; + if (traits_type::eq_int_type(__i, __dlm)) + break; + } + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + this->setstate(__state); + } + return *this; +} + +template +typename basic_istream<_CharT, _Traits>::int_type +basic_istream<_CharT, _Traits>::peek() +{ + ios_base::iostate __state = ios_base::goodbit; + __gc_ = 0; + int_type __r = traits_type::eof(); + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __r = this->rdbuf()->sgetc(); + if (traits_type::eq_int_type(__r, traits_type::eof())) + __state |= ios_base::eofbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + this->setstate(__state); + } + return __r; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) +{ + ios_base::iostate __state = ios_base::goodbit; + __gc_ = 0; + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __gc_ = this->rdbuf()->sgetn(__s, __n); + if (__gc_ != __n) + __state |= ios_base::failbit | ios_base::eofbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + } + else + { + __state |= ios_base::failbit; + } + this->setstate(__state); + return *this; +} + +template +streamsize +basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) +{ + ios_base::iostate __state = ios_base::goodbit; + __gc_ = 0; + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + streamsize __c = this->rdbuf()->in_avail(); + switch (__c) + { + case -1: + __state |= ios_base::eofbit; + break; + case 0: + break; + default: + __n = _CUDA_VSTD::min(__c, __n); + __gc_ = this->rdbuf()->sgetn(__s, __n); + if (__gc_ != __n) + __state |= ios_base::failbit | ios_base::eofbit; + break; + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + } + else + { + __state |= ios_base::failbit; + } + this->setstate(__state); + return __gc_; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::putback(char_type __c) +{ + ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; + __gc_ = 0; + this->clear(__state); + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof()) + __state |= ios_base::badbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + } + else + { + __state |= ios_base::failbit; + } + this->setstate(__state); + return *this; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::unget() +{ + ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; + __gc_ = 0; + this->clear(__state); + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof()) + __state |= ios_base::badbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + } + else + { + __state |= ios_base::failbit; + } + this->setstate(__state); + return *this; +} + +template +int +basic_istream<_CharT, _Traits>::sync() +{ + ios_base::iostate __state = ios_base::goodbit; + int __r = 0; + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + if (this->rdbuf() == 0) + return -1; + if (this->rdbuf()->pubsync() == -1) + { + __state |= ios_base::badbit; + return -1; + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + this->setstate(__state); + } + return __r; +} + +template +typename basic_istream<_CharT, _Traits>::pos_type +basic_istream<_CharT, _Traits>::tellg() +{ + ios_base::iostate __state = ios_base::goodbit; + pos_type __r(-1); + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + this->setstate(__state); + } + return __r; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::seekg(pos_type __pos) +{ + ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; + this->clear(__state); + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) + __state |= ios_base::failbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + this->setstate(__state); + } + return *this; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) +{ + ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; + this->clear(__state); + sentry __sen(*this, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1)) + __state |= ios_base::failbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + this->__setstate_nothrow(__state); + if (this->exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + this->setstate(__state); + } + return *this; +} + +template +basic_istream<_CharT, _Traits>& +ws(basic_istream<_CharT, _Traits>& __is) +{ + ios_base::iostate __state = ios_base::goodbit; + typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + const ctype<_CharT>& __ct = use_facet >(__is.getloc()); + while (true) + { + typename _Traits::int_type __i = __is.rdbuf()->sgetc(); + if (_Traits::eq_int_type(__i, _Traits::eof())) + { + __state |= ios_base::eofbit; + break; + } + if (!__ct.is(__ct.space, _Traits::to_char_type(__i))) + break; + __is.rdbuf()->sbumpc(); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + __is.__setstate_nothrow(__state); + if (__is.exceptions() & ios_base::badbit) + { + throw; + } + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __is.setstate(__state); + } + return __is; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x) +{ + __is >> _CUDA_VSTD::forward<_Tp>(__x); + return __is; +} + +template +class _LIBCUDACXX_TEMPLATE_VIS basic_iostream + : public basic_istream<_CharT, _Traits>, + public basic_ostream<_CharT, _Traits> +{ +public: + // types: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // constructor/destructor + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + explicit basic_iostream(basic_streambuf* __sb) + : basic_istream<_CharT, _Traits>(__sb) + {} + + virtual ~basic_iostream(); +protected: + inline _LIBCUDACXX_INLINE_VISIBILITY + basic_iostream(basic_iostream&& __rhs); + + // assign/swap + inline _LIBCUDACXX_INLINE_VISIBILITY + basic_iostream& operator=(basic_iostream&& __rhs); + inline _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 + void swap(basic_iostream& __rhs) + { basic_istream::swap(__rhs); } +}; + +template +basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs) + : basic_istream<_CharT, _Traits>(_CUDA_VSTD::move(__rhs)) +{ +} + +template +basic_iostream<_CharT, _Traits>& +basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs) +{ + swap(__rhs); + return *this; +} + +template +basic_iostream<_CharT, _Traits>::~basic_iostream() +{ +} + +template +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT, _Traits, _Allocator>& __str) +{ + ios_base::iostate __state = ios_base::goodbit; + typename basic_istream<_CharT, _Traits>::sentry __sen(__is); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif + __str.clear(); + streamsize __n = __is.width(); + if (__n <= 0) + __n = __str.max_size(); + if (__n <= 0) + __n = numeric_limits::max(); + streamsize __c = 0; + const ctype<_CharT>& __ct = use_facet >(__is.getloc()); + while (__c < __n) + { + typename _Traits::int_type __i = __is.rdbuf()->sgetc(); + if (_Traits::eq_int_type(__i, _Traits::eof())) + { + __state |= ios_base::eofbit; + break; + } + _CharT __ch = _Traits::to_char_type(__i); + if (__ct.is(__ct.space, __ch)) + break; + __str.push_back(__ch); + ++__c; + __is.rdbuf()->sbumpc(); + } + __is.width(0); + if (__c == 0) + __state |= ios_base::failbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + __is.__setstate_nothrow(__state); + if (__is.exceptions() & ios_base::badbit) + { + throw; + } + } +#endif + __is.setstate(__state); + } + return __is; +} + +template +basic_istream<_CharT, _Traits>& +getline(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) +{ + ios_base::iostate __state = ios_base::goodbit; + typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif + __str.clear(); + streamsize __extr = 0; + while (true) + { + typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); + if (_Traits::eq_int_type(__i, _Traits::eof())) + { + __state |= ios_base::eofbit; + break; + } + ++__extr; + _CharT __ch = _Traits::to_char_type(__i); + if (_Traits::eq(__ch, __dlm)) + break; + __str.push_back(__ch); + if (__str.size() == __str.max_size()) + { + __state |= ios_base::failbit; + break; + } + } + if (__extr == 0) + __state |= ios_base::failbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + __is.__setstate_nothrow(__state); + if (__is.exceptions() & ios_base::badbit) + { + throw; + } + } +#endif + __is.setstate(__state); + } + return __is; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream<_CharT, _Traits>& +getline(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT, _Traits, _Allocator>& __str) +{ + return getline(__is, __str, __is.widen('\n')); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream<_CharT, _Traits>& +getline(basic_istream<_CharT, _Traits>&& __is, + basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) +{ + return getline(__is, __str, __dlm); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +basic_istream<_CharT, _Traits>& +getline(basic_istream<_CharT, _Traits>&& __is, + basic_string<_CharT, _Traits, _Allocator>& __str) +{ + return getline(__is, __str, __is.widen('\n')); +} + +template +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) +{ + ios_base::iostate __state = ios_base::goodbit; + typename basic_istream<_CharT, _Traits>::sentry __sen(__is); + if (__sen) + { +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif + basic_string<_CharT, _Traits> __str; + const ctype<_CharT>& __ct = use_facet >(__is.getloc()); + size_t __c = 0; + _CharT __zero = __ct.widen('0'); + _CharT __one = __ct.widen('1'); + while (__c < _Size) + { + typename _Traits::int_type __i = __is.rdbuf()->sgetc(); + if (_Traits::eq_int_type(__i, _Traits::eof())) + { + __state |= ios_base::eofbit; + break; + } + _CharT __ch = _Traits::to_char_type(__i); + if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one)) + break; + __str.push_back(__ch); + ++__c; + __is.rdbuf()->sbumpc(); + } + __x = bitset<_Size>(__str); + if (_Size > 0 && __c == 0) + __state |= ios_base::failbit; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + __state |= ios_base::badbit; + __is.__setstate_nothrow(__state); + if (__is.exceptions() & ios_base::badbit) + { + throw; + } + } +#endif + __is.setstate(__state); + } + return __is; +} + +#ifndef _LIBCUDACXX_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB +_LIBCUDACXX_EXTERN_TEMPLATE(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS basic_istream) +_LIBCUDACXX_EXTERN_TEMPLATE(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS basic_istream) +_LIBCUDACXX_EXTERN_TEMPLATE(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS basic_iostream) +#endif + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX_ISTREAM diff --git a/cuda_toolkit/include/iterator b/cuda_toolkit/include/iterator new file mode 100644 index 0000000000000000000000000000000000000000..2f145b4e8acb6b366f98508d4e754641650ac546 --- /dev/null +++ b/cuda_toolkit/include/iterator @@ -0,0 +1,764 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_ITERATOR +#define _LIBCUDACXX_ITERATOR + +/* + iterator synopsis + +#include + +namespace std +{ +template struct incrementable_traits; // since C++20 +template + using iter_difference_t = see below; // since C++20 + +template struct indirectly_readable_traits; // since C++20 +template + using iter_value_t = see below; // since C++20 + +template +struct iterator_traits; + +template + requires is_object_v // since C++20 +struct iterator_traits; + +template + using iter_reference_t = decltype(*declval()); + +namespace ranges::inline unspecified { + inline constexpr unspecified iter_move = unspecified; // since C++20, nodiscard as an extension +}} + +template + requires ... +using iter_rvalue_reference_t = decltype(ranges::iter_move(declval())); // since C++20 + +// [iterator.concepts], iterator concepts +// [iterator.concept.readable], concept indirectly_readable +template + concept indirectly_readable = see below; // since C++20 + +template + using iter_common_reference_t = + common_reference_t, iter_value_t&>; // since C++20 + +// [iterator.concept.writable], concept indirectly_writable +template + concept indirectly_writable = see below; // since C++20 + +// [iterator.concept.winc], concept weakly_incrementable +template + concept weakly_incrementable = see below; // since C++20 + +// [iterator.concept.inc], concept incrementable +template + concept incrementable = see below; // since C++20 + +// [iterator.concept.iterator], concept input_or_output_iterator + template + concept input_or_output_iterator = see below; // since C++20 + +// [iterator.concept.sentinel], concept sentinel_for +template + concept sentinel_for = see below; // since C++20 + +// [iterator.concept.sizedsentinel], concept sized_sentinel_for +template + inline constexpr bool disable_sized_sentinel_for = false; + +template + concept sized_sentinel_for = see below; + +// [iterator.concept.input], concept input_iterator +template + concept input_iterator = see below; // since C++20 + +// [iterator.concept.output], concept output_iterator +template + concept output_iterator = see below; // since C++20 + +// [iterator.concept.forward], concept forward_iterator +template + concept forward_iterator = see below; // since C++20 + +// [iterator.concept.bidir], concept bidirectional_iterator +template + concept bidirectional_iterator = see below; // since C++20 + +// [iterator.concept.random.access], concept random_access_iterator +template + concept random_access_iterator = see below; // since C++20 + +// [indirectcallable] +// [indirectcallable.indirectinvocable] +template + concept indirectly_unary_invocable = see below; // since C++20 + +template + concept indirectly_regular_unary_invocable = see below; // since C++20 + +template + concept indirect_unary_predicate = see below; // since C++20 + +template + concept indirect_binary_predicate = see below; // since C++20 + +template + concept indirect_equivalence_relation = see below; // since C++20 + +template + concept indirect_strict_weak_order = see below; // since C++20 + +template + using indirect_result_t = see below; // since C++20 + +// [projected], projected +template Proj> + struct projected; // since C++20 + +template Proj> + struct incrementable_traits>; // since C++20 + +// [alg.req.ind.move], concept indirectly_movable +template + concept indirectly_movable = see below; // since C++20 + +template + concept indirectly_movable_storable = see below; // since C++20 + +// [alg.req.ind.copy], concept indirectly_copyable +template + concept indirectly_copyable = see below; // since C++20 + +template + concept indirectly_copyable_storable = see below; // since C++20 + +// [alg.req.ind.swap], concept indirectly_swappable +template + concept indirectly_swappable = see below; // since C++20 + +template + concept indirectly_comparable = + indirect_binary_predicate, projected>; // since C++20 + +// [alg.req.permutable], concept permutable +template + concept permutable = see below; // since C++20 + + // [alg.req.mergeable], concept mergeable +template + concept mergeable = see below; // since C++20 + +// [alg.req.sortable], concept sortable +template + concept sortable = see below; // since C++20 + +template S> + requires (!same_as && copyable) +class common_iterator; // since C++20 + +template +struct iterator // deprecated in C++17 +{ + typedef T value_type; + typedef Distance difference_type; + typedef Pointer pointer; + typedef Reference reference; + typedef Category iterator_category; +}; + +struct input_iterator_tag {}; +struct output_iterator_tag {}; +struct forward_iterator_tag : public input_iterator_tag {}; +struct bidirectional_iterator_tag : public forward_iterator_tag {}; +struct random_access_iterator_tag : public bidirectional_iterator_tag {}; +struct contiguous_iterator_tag : public random_access_iterator_tag {}; + +// 27.4.3, iterator operations +template // constexpr in C++17 + constexpr void advance(InputIterator& i, Distance n); + +template // constexpr in C++17 + constexpr typename iterator_traits::difference_type + distance(InputIterator first, InputIterator last); + +template // constexpr in C++17 + constexpr InputIterator next(InputIterator x, +typename iterator_traits::difference_type n = 1); + +template // constexpr in C++17 + constexpr BidirectionalIterator prev(BidirectionalIterator x, + typename iterator_traits::difference_type n = 1); + +// [range.iter.ops], range iterator operations +namespace ranges { + // [range.iter.op.advance], ranges::advance + template + constexpr void advance(I& i, iter_difference_t n); // since C++20 + template S> + constexpr void advance(I& i, S bound); // since C++20 + template S> + constexpr iter_difference_t advance(I& i, iter_difference_t n, S bound); // since C++20 +} + +template +class reverse_iterator + : public iterator::iterator_category, // until C++17 + typename iterator_traits::value_type, + typename iterator_traits::difference_type, + typename iterator_traits::pointer, + typename iterator_traits::reference> +{ +protected: + Iterator current; +public: + using iterator_type = Iterator; + using iterator_concept = see below; // since C++20 + using iterator_category = typename iterator_traits::iterator_category; // since C++17, until C++20 + using iterator_category = see below; // since C++20 + using value_type = typename iterator_traits::value_type; // since C++17, until C++20 + using value_type = iter_value_t; // since C++20 + using difference_type = typename iterator_traits::difference_type; // until C++20 + using difference_type = iter_difference_t; // since C++20 + using pointer = typename iterator_traits::pointer; + using reference = typename iterator_traits::reference; // until C++20 + using reference = iter_reference_t; // since C++20 + + constexpr reverse_iterator(); + constexpr explicit reverse_iterator(Iterator x); + template constexpr reverse_iterator(const reverse_iterator& u); + template constexpr reverse_iterator& operator=(const reverse_iterator& u); + constexpr Iterator base() const; + constexpr reference operator*() const; + constexpr pointer operator->() const; // until C++20 + constexpr pointer operator->() const requires see below; // since C++20 + constexpr reverse_iterator& operator++(); + constexpr reverse_iterator operator++(int); + constexpr reverse_iterator& operator--(); + constexpr reverse_iterator operator--(int); + constexpr reverse_iterator operator+ (difference_type n) const; + constexpr reverse_iterator& operator+=(difference_type n); + constexpr reverse_iterator operator- (difference_type n) const; + constexpr reverse_iterator& operator-=(difference_type n); + constexpr unspecified operator[](difference_type n) const; + + friend constexpr iter_rvalue_reference_t + iter_move(const reverse_iterator& i) noexcept(see below); + template Iterator2> + friend constexpr void + iter_swap(const reverse_iterator& x, + const reverse_iterator& y) noexcept(see below); +}; + +template +constexpr bool // constexpr in C++17 +operator==(const reverse_iterator& x, const reverse_iterator& y); + +template +constexpr bool // constexpr in C++17 +operator!=(const reverse_iterator& x, const reverse_iterator& y); + +template +constexpr bool // constexpr in C++17 +operator<(const reverse_iterator& x, const reverse_iterator& y); + +template +constexpr bool // constexpr in C++17 +operator>(const reverse_iterator& x, const reverse_iterator& y); + +template +constexpr bool // constexpr in C++17 +operator<=(const reverse_iterator& x, const reverse_iterator& y); + +template +constexpr bool // constexpr in C++17 +operator>=(const reverse_iterator& x, const reverse_iterator& y); + +template Iterator2> + constexpr compare_three_way_result_t + operator<=>(const reverse_iterator& x, + const reverse_iterator& y); + +template +constexpr auto +operator-(const reverse_iterator& x, const reverse_iterator& y) +-> decltype(__y.base() - __x.base()); // constexpr in C++17 + +template +constexpr reverse_iterator +operator+(typename reverse_iterator::difference_type n, + const reverse_iterator& x); // constexpr in C++17 + +template +constexpr reverse_iterator make_reverse_iterator(Iterator i); // C++14, constexpr in C++17 + +template + requires (!sized_sentinel_for) + inline constexpr bool disable_sized_sentinel_for, + reverse_iterator> = true; + +template +class back_insert_iterator + : public iterator // until C++17 +{ +protected: + Container* container; +public: + typedef Container container_type; + typedef void value_type; + typedef void difference_type; // until C++20 + typedef ptrdiff_t difference_type; // since C++20 + typedef void reference; + typedef void pointer; + + explicit back_insert_iterator(Container& x); // constexpr in C++20 + back_insert_iterator& operator=(const typename Container::value_type& value); // constexpr in C++20 + back_insert_iterator& operator*(); // constexpr in C++20 + back_insert_iterator& operator++(); // constexpr in C++20 + back_insert_iterator operator++(int); // constexpr in C++20 +}; + +template back_insert_iterator back_inserter(Container& x); // constexpr in C++20 + +template +class front_insert_iterator + : public iterator // until C++17 +{ +protected: + Container* container; +public: + typedef Container container_type; + typedef void value_type; + typedef void difference_type; // until C++20 + typedef ptrdiff_t difference_type; // since C++20 + typedef void reference; + typedef void pointer; + + explicit front_insert_iterator(Container& x); // constexpr in C++20 + front_insert_iterator& operator=(const typename Container::value_type& value); // constexpr in C++20 + front_insert_iterator& operator*(); // constexpr in C++20 + front_insert_iterator& operator++(); // constexpr in C++20 + front_insert_iterator operator++(int); // constexpr in C++20 +}; + +template front_insert_iterator front_inserter(Container& x); // constexpr in C++20 + +template +class insert_iterator + : public iterator // until C++17 +{ +protected: + Container* container; + typename Container::iterator iter; +public: + typedef Container container_type; + typedef void value_type; + typedef void difference_type; // until C++20 + typedef ptrdiff_t difference_type; // since C++20 + typedef void reference; + typedef void pointer; + + insert_iterator(Container& x, typename Container::iterator i); // constexpr in C++20 + insert_iterator& operator=(const typename Container::value_type& value); // constexpr in C++20 + insert_iterator& operator*(); // constexpr in C++20 + insert_iterator& operator++(); // constexpr in C++20 + insert_iterator& operator++(int); // constexpr in C++20 +}; + +template +insert_iterator inserter(Container& x, typename Container::iterator i); // until C++20 +template +constexpr insert_iterator inserter(Container& x, ranges::iterator_t i); // since C++20 + +template +class move_iterator { +public: + using iterator_type = Iterator; + using iterator_concept = input_iterator_tag; // From C++20 + using iterator_category = see below; // not always present starting from C++20 + using value_type = iter_value_t; // Until C++20, iterator_traits::value_type + using difference_type = iter_difference_t; // Until C++20, iterator_traits::difference_type; + using pointer = Iterator; + using reference = iter_rvalue_reference_t; // Until C++20, value_type&& + + constexpr move_iterator(); // all the constexprs are in C++17 + constexpr explicit move_iterator(Iterator i); + template + constexpr move_iterator(const move_iterator& u); + template + constexpr move_iterator& operator=(const move_iterator& u); + + constexpr iterator_type base() const; // Until C++20 + constexpr const Iterator& base() const & noexcept; // From C++20 + constexpr Iterator base() &&; // From C++20 + + constexpr reference operator*() const; + constexpr pointer operator->() const; // Deprecated in C++20 + constexpr move_iterator& operator++(); + constexpr auto operator++(int); // Return type was move_iterator until C++20 + constexpr move_iterator& operator--(); + constexpr move_iterator operator--(int); + constexpr move_iterator operator+(difference_type n) const; + constexpr move_iterator& operator+=(difference_type n); + constexpr move_iterator operator-(difference_type n) const; + constexpr move_iterator& operator-=(difference_type n); + constexpr reference operator[](difference_type n) const; // Return type unspecified until C++20 + + template S> + friend constexpr bool + operator==(const move_iterator& x, const move_sentinel& y); // Since C++20 + template S> + friend constexpr iter_difference_t + operator-(const move_sentinel& x, const move_iterator& y); // Since C++20 + template S> + friend constexpr iter_difference_t + operator-(const move_iterator& x, const move_sentinel& y); // Since C++20 + friend constexpr iter_rvalue_reference_t + iter_move(const move_iterator& i) + noexcept(noexcept(ranges::iter_move(i.current))); // Since C++20 + template Iterator2> + friend constexpr void + iter_swap(const move_iterator& x, const move_iterator& y) + noexcept(noexcept(ranges::iter_swap(x.current, y.current))); // Since C++20 + +private: + Iterator current; // exposition only +}; + +template +constexpr bool // constexpr in C++17 +operator==(const move_iterator& x, const move_iterator& y); + +template +constexpr bool // constexpr in C++17 +operator!=(const move_iterator& x, const move_iterator& y); + +template +constexpr bool // constexpr in C++17 +operator<(const move_iterator& x, const move_iterator& y); + +template +constexpr bool // constexpr in C++17 +operator<=(const move_iterator& x, const move_iterator& y); + +template +constexpr bool // constexpr in C++17 +operator>(const move_iterator& x, const move_iterator& y); + +template +constexpr bool // constexpr in C++17 +operator>=(const move_iterator& x, const move_iterator& y); + +template +constexpr auto // constexpr in C++17 +operator-(const move_iterator& x, + const move_iterator& y) -> decltype(x.base() - y.base()); + +template +constexpr move_iterator operator+( // constexpr in C++17 + typename move_iterator::difference_type n, + const move_iterator& x); + +template // constexpr in C++17 +constexpr move_iterator make_move_iterator(const Iterator& i); + +template +class move_sentinel { +public: + constexpr move_sentinel(); + constexpr explicit move_sentinel(S s); + template + requires convertible_to + constexpr move_sentinel(const move_sentinel& s); + template + requires assignable_from + constexpr move_sentinel& operator=(const move_sentinel& s); + + constexpr S base() const; +private: + S last; // exposition only +}; + +// [default.sentinel], default sentinel +struct default_sentinel_t; +inline constexpr default_sentinel_t default_sentinel{}; + +// [iterators.counted], counted iterators +template class counted_iterator; + +template + requires see below + struct iterator_traits>; + +// [unreachable.sentinel], unreachable sentinel +struct unreachable_sentinel_t; +inline constexpr unreachable_sentinel_t unreachable_sentinel{}; + +template , class Distance = ptrdiff_t> +class istream_iterator + : public iterator // until C++17 +{ +public: + typedef input_iterator_tag iterator_category; + typedef T value_type; + typedef Distance difference_type; + typedef const T* pointer; + typedef const T& reference; + + typedef charT char_type; + typedef traits traits_type; + typedef basic_istream istream_type; + + istream_iterator(); // constexpr since C++11 + constexpr istream_iterator(default_sentinel_t); // since C++20 + istream_iterator(istream_type& s); + istream_iterator(const istream_iterator& x); + ~istream_iterator(); + + const T& operator*() const; + const T* operator->() const; + istream_iterator& operator++(); + istream_iterator operator++(int); + friend bool operator==(const istream_iterator& i, default_sentinel_t); // since C++20 +}; + +template +bool operator==(const istream_iterator& x, + const istream_iterator& y); +template +bool operator!=(const istream_iterator& x, + const istream_iterator& y); // until C++20 + +template > +class ostream_iterator + : public iterator // until C++17 +{ +public: + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; // until C++20 + typedef ptrdiff_t difference_type; // since C++20 + typedef void pointer; + typedef void reference; + + typedef charT char_type; + typedef traits traits_type; + typedef basic_ostream ostream_type; + + ostream_iterator(ostream_type& s); + ostream_iterator(ostream_type& s, const charT* delimiter); + ostream_iterator(const ostream_iterator& x); + ~ostream_iterator(); + ostream_iterator& operator=(const T& value); + + ostream_iterator& operator*(); + ostream_iterator& operator++(); + ostream_iterator& operator++(int); +}; + +template > +class istreambuf_iterator + : public iterator // until C++17 +{ +public: + typedef input_iterator_tag iterator_category; + typedef charT value_type; + typedef traits::off_type difference_type; + typedef unspecified pointer; + typedef charT reference; + + typedef charT char_type; + typedef traits traits_type; + typedef traits::int_type int_type; + typedef basic_streambuf streambuf_type; + typedef basic_istream istream_type; + + istreambuf_iterator() noexcept; // constexpr since C++11 + constexpr istreambuf_iterator(default_sentinel_t) noexcept; // since C++20 + istreambuf_iterator(istream_type& s) noexcept; + istreambuf_iterator(streambuf_type* s) noexcept; + istreambuf_iterator(a-private-type) noexcept; + + charT operator*() const; + pointer operator->() const; + istreambuf_iterator& operator++(); + a-private-type operator++(int); + + bool equal(const istreambuf_iterator& b) const; + friend bool operator==(const istreambuf_iterator& i, default_sentinel_t s); // since C++20 +}; + +template +bool operator==(const istreambuf_iterator& a, + const istreambuf_iterator& b); +template +bool operator!=(const istreambuf_iterator& a, + const istreambuf_iterator& b); // until C++20 + +template > +class ostreambuf_iterator + : public iterator // until C++17 +{ +public: + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; // until C++20 + typedef ptrdiff_t difference_type; // since C++20 + typedef void pointer; + typedef void reference; + + typedef charT char_type; + typedef traits traits_type; + typedef basic_streambuf streambuf_type; + typedef basic_ostream ostream_type; + + ostreambuf_iterator(ostream_type& s) noexcept; + ostreambuf_iterator(streambuf_type* s) noexcept; + ostreambuf_iterator& operator=(charT c); + ostreambuf_iterator& operator*(); + ostreambuf_iterator& operator++(); + ostreambuf_iterator& operator++(int); + bool failed() const noexcept; +}; + +template constexpr auto begin(C& c) -> decltype(c.begin()); +template constexpr auto begin(const C& c) -> decltype(c.begin()); +template constexpr auto end(C& c) -> decltype(c.end()); +template constexpr auto end(const C& c) -> decltype(c.end()); +template constexpr T* begin(T (&array)[N]); +template constexpr T* end(T (&array)[N]); + +template auto constexpr cbegin(const C& c) -> decltype(std::begin(c)); // C++14 +template auto constexpr cend(const C& c) -> decltype(std::end(c)); // C++14 +template auto constexpr rbegin(C& c) -> decltype(c.rbegin()); // C++14 +template auto constexpr rbegin(const C& c) -> decltype(c.rbegin()); // C++14 +template auto constexpr rend(C& c) -> decltype(c.rend()); // C++14 +template constexpr auto rend(const C& c) -> decltype(c.rend()); // C++14 +template reverse_iterator constexpr rbegin(initializer_list il); // C++14 +template reverse_iterator constexpr rend(initializer_list il); // C++14 +template reverse_iterator constexpr rbegin(T (&array)[N]); // C++14 +template reverse_iterator constexpr rend(T (&array)[N]); // C++14 +template constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c)); // C++14 +template constexpr auto crend(const C& c) -> decltype(std::rend(c)); // C++14 + +// 24.8, container access: +template constexpr auto size(const C& c) -> decltype(c.size()); // C++17 +template constexpr size_t size(const T (&array)[N]) noexcept; // C++17 + +template constexpr auto ssize(const C& c) + -> common_type_t>; // C++20 +template constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; // C++20 + +template constexpr auto empty(const C& c) -> decltype(c.empty()); // C++17 +template constexpr bool empty(const T (&array)[N]) noexcept; // C++17 +template constexpr bool empty(initializer_list il) noexcept; // C++17 +template constexpr auto data(C& c) -> decltype(c.data()); // C++17 +template constexpr auto data(const C& c) -> decltype(c.data()); // C++17 +template constexpr T* data(T (&array)[N]) noexcept; // C++17 +template constexpr const E* data(initializer_list il) noexcept; // C++17 + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#endif //__cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__iterator/access.h" +#include "__iterator/advance.h" +#include "__iterator/back_insert_iterator.h" +#include "__iterator/bounded_iter.h" +#include "__iterator/concepts.h" +#include "__iterator/data.h" +#include "__iterator/default_sentinel.h" +#include "__iterator/distance.h" +#include "__iterator/empty.h" +#include "__iterator/erase_if_container.h" +#include "__iterator/front_insert_iterator.h" +#include "__iterator/incrementable_traits.h" +#include "__iterator/indirectly_comparable.h" +#include "__iterator/insert_iterator.h" +#include "__iterator/istream_iterator.h" +#include "__iterator/istreambuf_iterator.h" +#include "__iterator/iter_move.h" +#include "__iterator/iter_swap.h" +#include "__iterator/iterator.h" +#include "__iterator/iterator_traits.h" +#include "__iterator/mergeable.h" +#include "__iterator/move_iterator.h" +#include "__iterator/move_sentinel.h" +#include "__iterator/next.h" +#include "__iterator/ostream_iterator.h" +#include "__iterator/ostreambuf_iterator.h" +#include "__iterator/permutable.h" +#include "__iterator/prev.h" +#include "__iterator/projected.h" +#include "__iterator/readable_traits.h" +#include "__iterator/reverse_access.h" +#include "__iterator/reverse_iterator.h" +#include "__iterator/size.h" +#include "__iterator/sortable.h" +#include "__iterator/unreachable_sentinel.h" +#include "__iterator/wrap_iter.h" +#include "__memory/addressof.h" +#include "__memory/pointer_traits.h" +#include "__type_traits/is_pointer.h" +#include "cstddef" +#include "initializer_list" +#include "iosfwd" // for forward declarations of vector and string. +#include "type_traits" +#include "version" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif //__cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template +struct __libcpp_is_trivial_iterator + : public _LIBCUDACXX_BOOL_CONSTANT(is_pointer<_Iter>::value) {}; + +template +struct __libcpp_is_trivial_iterator > + : public _LIBCUDACXX_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; + +template +struct __libcpp_is_trivial_iterator > + : public _LIBCUDACXX_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; + +template +struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> > + : public _LIBCUDACXX_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_ITERATOR diff --git a/cuda_toolkit/include/latch b/cuda_toolkit/include/latch new file mode 100644 index 0000000000000000000000000000000000000000..d04356384c1ad45d723c34526e73ee9116cb1ae7 --- /dev/null +++ b/cuda_toolkit/include/latch @@ -0,0 +1,135 @@ +// -*- C++ -*- +//===--------------------------- latch -----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_LATCH +#define _LIBCUDACXX_LATCH + +/* + latch synopsis + +namespace std +{ + + class latch + { + public: + constexpr explicit latch(ptrdiff_t __expected); + ~latch(); + + latch(const latch&) = delete; + latch& operator=(const latch&) = delete; + + void count_down(ptrdiff_t __update = 1); + bool try_wait() const noexcept; + void wait() const; + void arrive_and_wait(ptrdiff_t __update = 1); + + private: + ptrdiff_t __counter; // exposition only + }; + +} + +*/ + +#ifndef __cuda_std__ +#include <__config> +#endif // __cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__debug" +#include "atomic" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif // __cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#ifdef _LIBCUDACXX_HAS_NO_THREADS +# error is not supported on this single threaded system +#endif + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +# if _LIBCUDACXX_CUDA_ABI_VERSION < 3 +# define _LIBCUDACXX_LATCH_ALIGNMENT alignas(64) +# else +# define _LIBCUDACXX_LATCH_ALIGNMENT +# endif + +template +class __latch_base +{ + _LIBCUDACXX_LATCH_ALIGNMENT __atomic_base __counter; +public: + inline _LIBCUDACXX_INLINE_VISIBILITY constexpr + explicit __latch_base(ptrdiff_t __expected) + : __counter(__expected) { } + + ~__latch_base() = default; + __latch_base(const __latch_base&) = delete; + __latch_base& operator=(const __latch_base&) = delete; + + inline _LIBCUDACXX_INLINE_VISIBILITY + void count_down(ptrdiff_t __update = 1) + { + _LIBCUDACXX_ASSERT(__update > 0, ""); + auto const __old = __counter.fetch_sub(__update, memory_order_release); + _LIBCUDACXX_ASSERT(__old >= __update, ""); + if(__old == __update) + __counter.notify_all(); + } + inline _LIBCUDACXX_INLINE_VISIBILITY + bool try_wait() const noexcept + { + return __counter.load(memory_order_acquire) == 0; + } + inline _LIBCUDACXX_INLINE_VISIBILITY + void wait() const + { + while(1) { + auto const __current = __counter.load(memory_order_acquire); + if(__current == 0) + return; + __counter.wait(__current, memory_order_relaxed) + ; + } + } + inline _LIBCUDACXX_INLINE_VISIBILITY + void arrive_and_wait(ptrdiff_t __update = 1) + { + count_down(__update); + wait(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + static constexpr ptrdiff_t max() noexcept + { + return numeric_limits::max(); + } +}; + +using latch = __latch_base<>; + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#else +#include "__cuda/latch.h" +#endif //__cuda_std__ + +#endif //_LIBCUDACXX_LATCH diff --git a/cuda_toolkit/include/library_types.h b/cuda_toolkit/include/library_types.h new file mode 100644 index 0000000000000000000000000000000000000000..bd05b77a1536fb1f300b09c2b561aad83d98b503 --- /dev/null +++ b/cuda_toolkit/include/library_types.h @@ -0,0 +1,106 @@ +/* + * Copyright 1993-2023 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__LIBRARY_TYPES_H__) +#define __LIBRARY_TYPES_H__ + + + +#ifndef __CUDACC_RTC_MINIMAL__ + +typedef enum cudaDataType_t +{ + CUDA_R_16F = 2, /* real as a half */ + CUDA_C_16F = 6, /* complex as a pair of half numbers */ + CUDA_R_16BF = 14, /* real as a nv_bfloat16 */ + CUDA_C_16BF = 15, /* complex as a pair of nv_bfloat16 numbers */ + CUDA_R_32F = 0, /* real as a float */ + CUDA_C_32F = 4, /* complex as a pair of float numbers */ + CUDA_R_64F = 1, /* real as a double */ + CUDA_C_64F = 5, /* complex as a pair of double numbers */ + CUDA_R_4I = 16, /* real as a signed 4-bit int */ + CUDA_C_4I = 17, /* complex as a pair of signed 4-bit int numbers */ + CUDA_R_4U = 18, /* real as a unsigned 4-bit int */ + CUDA_C_4U = 19, /* complex as a pair of unsigned 4-bit int numbers */ + CUDA_R_8I = 3, /* real as a signed 8-bit int */ + CUDA_C_8I = 7, /* complex as a pair of signed 8-bit int numbers */ + CUDA_R_8U = 8, /* real as a unsigned 8-bit int */ + CUDA_C_8U = 9, /* complex as a pair of unsigned 8-bit int numbers */ + CUDA_R_16I = 20, /* real as a signed 16-bit int */ + CUDA_C_16I = 21, /* complex as a pair of signed 16-bit int numbers */ + CUDA_R_16U = 22, /* real as a unsigned 16-bit int */ + CUDA_C_16U = 23, /* complex as a pair of unsigned 16-bit int numbers */ + CUDA_R_32I = 10, /* real as a signed 32-bit int */ + CUDA_C_32I = 11, /* complex as a pair of signed 32-bit int numbers */ + CUDA_R_32U = 12, /* real as a unsigned 32-bit int */ + CUDA_C_32U = 13, /* complex as a pair of unsigned 32-bit int numbers */ + CUDA_R_64I = 24, /* real as a signed 64-bit int */ + CUDA_C_64I = 25, /* complex as a pair of signed 64-bit int numbers */ + CUDA_R_64U = 26, /* real as a unsigned 64-bit int */ + CUDA_C_64U = 27, /* complex as a pair of unsigned 64-bit int numbers */ + CUDA_R_8F_E4M3 = 28, /* real as a nv_fp8_e4m3 */ + CUDA_R_8F_E5M2 = 29, /* real as a nv_fp8_e5m2 */ +} cudaDataType; + + +typedef enum libraryPropertyType_t +{ + MAJOR_VERSION, + MINOR_VERSION, + PATCH_LEVEL +} libraryPropertyType; + + +#ifndef __cplusplus +typedef enum cudaDataType_t cudaDataType_t; +typedef enum libraryPropertyType_t libraryPropertyType_t; +#endif + +#endif /* !__CUDACC_RTC_MINIMAL__ */ +#endif /* !__LIBRARY_TYPES_H__ */ diff --git a/cuda_toolkit/include/limits b/cuda_toolkit/include/limits new file mode 100644 index 0000000000000000000000000000000000000000..4c12ba5cbcc6bc9a7fd7914f1f9d2921923cd082 --- /dev/null +++ b/cuda_toolkit/include/limits @@ -0,0 +1,847 @@ +// -*- C++ -*- +//===---------------------------- limits ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_LIMITS +#define _LIBCUDACXX_LIMITS + +/* + limits synopsis + +namespace std +{ + +template +class numeric_limits +{ +public: + static constexpr bool is_specialized = false; + static constexpr T min() noexcept; + static constexpr T max() noexcept; + static constexpr T lowest() noexcept; + + static constexpr int digits = 0; + static constexpr int digits10 = 0; + static constexpr int max_digits10 = 0; + static constexpr bool is_signed = false; + static constexpr bool is_integer = false; + static constexpr bool is_exact = false; + static constexpr int radix = 0; + static constexpr T epsilon() noexcept; + static constexpr T round_error() noexcept; + + static constexpr int min_exponent = 0; + static constexpr int min_exponent10 = 0; + static constexpr int max_exponent = 0; + static constexpr int max_exponent10 = 0; + + static constexpr bool has_infinity = false; + static constexpr bool has_quiet_NaN = false; + static constexpr bool has_signaling_NaN = false; + static constexpr float_denorm_style has_denorm = denorm_absent; + static constexpr bool has_denorm_loss = false; + static constexpr T infinity() noexcept; + static constexpr T quiet_NaN() noexcept; + static constexpr T signaling_NaN() noexcept; + static constexpr T denorm_min() noexcept; + + static constexpr bool is_iec559 = false; + static constexpr bool is_bounded = false; + static constexpr bool is_modulo = false; + + static constexpr bool traps = false; + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_toward_zero; +}; + +enum float_round_style +{ + round_indeterminate = -1, + round_toward_zero = 0, + round_to_nearest = 1, + round_toward_infinity = 2, + round_toward_neg_infinity = 3 +}; + +enum float_denorm_style +{ + denorm_indeterminate = -1, + denorm_absent = 0, + denorm_present = 1 +}; + +template<> class numeric_limits; + +template<> class numeric_limits; +template<> class numeric_limits; +template<> class numeric_limits; +template<> class numeric_limits; +template<> class numeric_limits; // C++20 +template<> class numeric_limits; +template<> class numeric_limits; + +template<> class numeric_limits; +template<> class numeric_limits; +template<> class numeric_limits; +template<> class numeric_limits; +template<> class numeric_limits; +template<> class numeric_limits; +template<> class numeric_limits; +template<> class numeric_limits; + +template<> class numeric_limits; +template<> class numeric_limits; +template<> class numeric_limits; + +} // std + +*/ + +#ifndef __cuda_std__ +#include <__config> +#else +#ifdef _LIBCUDACXX_COMPILER_NVRTC +#include "climits" +#endif // _LIBCUDACXX_COMPILER_NVRTC +#endif // __cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "type_traits" +#include "version" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif //__cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#if defined(_LIBCUDACXX_COMPILER_MSVC) +#include "support/win32/limits_msvc_win32.h" +#endif // _LIBCUDACXX_MSVCRT + +#if defined(_LIBCUDACXX_COMPILER_IBM) +#include "support/ibm/limits.h" +#endif // _LIBCUDACXX_COMPILER_IBM + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +enum float_round_style +{ + round_indeterminate = -1, + round_toward_zero = 0, + round_to_nearest = 1, + round_toward_infinity = 2, + round_toward_neg_infinity = 3 +}; + +enum float_denorm_style +{ + denorm_indeterminate = -1, + denorm_absent = 0, + denorm_present = 1 +}; + +template ::value> +class __libcpp_numeric_limits +{ +protected: + typedef _Tp type; + + static constexpr bool is_specialized = false; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type min() noexcept {return type();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type max() noexcept {return type();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type lowest() noexcept {return type();} + + static constexpr int digits = 0; + static constexpr int digits10 = 0; + static constexpr int max_digits10 = 0; + static constexpr bool is_signed = false; + static constexpr bool is_integer = false; + static constexpr bool is_exact = false; + static constexpr int radix = 0; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type epsilon() noexcept {return type();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type round_error() noexcept {return type();} + + static constexpr int min_exponent = 0; + static constexpr int min_exponent10 = 0; + static constexpr int max_exponent = 0; + static constexpr int max_exponent10 = 0; + + static constexpr bool has_infinity = false; + static constexpr bool has_quiet_NaN = false; + static constexpr bool has_signaling_NaN = false; + static constexpr float_denorm_style has_denorm = denorm_absent; + static constexpr bool has_denorm_loss = false; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type infinity() noexcept {return type();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type quiet_NaN() noexcept {return type();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type signaling_NaN() noexcept {return type();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type denorm_min() noexcept {return type();} + + static constexpr bool is_iec559 = false; + static constexpr bool is_bounded = false; + static constexpr bool is_modulo = false; + + static constexpr bool traps = false; + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_toward_zero; +}; + +template +struct __libcpp_compute_min +{ + static constexpr _Tp value = static_cast<_Tp>(_Tp(1) << __digits); +}; + +template +struct __libcpp_compute_min<_Tp, __digits, false> +{ + static constexpr _Tp value = _Tp(0); +}; + +template +class __libcpp_numeric_limits<_Tp, true> +{ +protected: + typedef _Tp type; + + static constexpr bool is_specialized = true; + + static constexpr bool is_signed = type(-1) < type(0); + static constexpr int digits = static_cast(sizeof(type) * __CHAR_BIT__ - is_signed); + static constexpr int digits10 = digits * 3 / 10; + static constexpr int max_digits10 = 0; + static constexpr type __min = __libcpp_compute_min::value; + static constexpr type __max = is_signed ? type(type(~0) ^ __min) : type(~0); + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type min() noexcept {return __min;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type max() noexcept {return __max;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type lowest() noexcept {return min();} + + static constexpr bool is_integer = true; + static constexpr bool is_exact = true; + static constexpr int radix = 2; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type epsilon() noexcept {return type(0);} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type round_error() noexcept {return type(0);} + + static constexpr int min_exponent = 0; + static constexpr int min_exponent10 = 0; + static constexpr int max_exponent = 0; + static constexpr int max_exponent10 = 0; + + static constexpr bool has_infinity = false; + static constexpr bool has_quiet_NaN = false; + static constexpr bool has_signaling_NaN = false; + static constexpr float_denorm_style has_denorm = denorm_absent; + static constexpr bool has_denorm_loss = false; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type infinity() noexcept {return type(0);} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type quiet_NaN() noexcept {return type(0);} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type signaling_NaN() noexcept {return type(0);} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type denorm_min() noexcept {return type(0);} + + static constexpr bool is_iec559 = false; + static constexpr bool is_bounded = true; + static constexpr bool is_modulo = !_CUDA_VSTD::is_signed<_Tp>::value; + +#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \ + defined(__wasm__) + static constexpr bool traps = true; +#else + static constexpr bool traps = false; +#endif + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_toward_zero; +}; + +template <> +class __libcpp_numeric_limits +{ +protected: + typedef bool type; + + static constexpr bool is_specialized = true; + + static constexpr bool is_signed = false; + static constexpr int digits = 1; + static constexpr int digits10 = 0; + static constexpr int max_digits10 = 0; + static constexpr type __min = false; + static constexpr type __max = true; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type min() noexcept {return __min;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type max() noexcept {return __max;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type lowest() noexcept {return min();} + + static constexpr bool is_integer = true; + static constexpr bool is_exact = true; + static constexpr int radix = 2; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type epsilon() noexcept {return type(0);} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type round_error() noexcept {return type(0);} + + static constexpr int min_exponent = 0; + static constexpr int min_exponent10 = 0; + static constexpr int max_exponent = 0; + static constexpr int max_exponent10 = 0; + + static constexpr bool has_infinity = false; + static constexpr bool has_quiet_NaN = false; + static constexpr bool has_signaling_NaN = false; + static constexpr float_denorm_style has_denorm = denorm_absent; + static constexpr bool has_denorm_loss = false; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type infinity() noexcept {return type(0);} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type quiet_NaN() noexcept {return type(0);} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type signaling_NaN() noexcept {return type(0);} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type denorm_min() noexcept {return type(0);} + + static constexpr bool is_iec559 = false; + static constexpr bool is_bounded = true; + static constexpr bool is_modulo = false; + + static constexpr bool traps = false; + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_toward_zero; +}; + +template <> +class __libcpp_numeric_limits +{ +protected: + typedef float type; + + static constexpr bool is_specialized = true; + + static constexpr bool is_signed = true; + static constexpr int digits = __FLT_MANT_DIG__; + static constexpr int digits10 = __FLT_DIG__; + static constexpr int max_digits10 = 2+(digits * 30103l)/100000l; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type min() noexcept {return __FLT_MIN__;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type max() noexcept {return __FLT_MAX__;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type lowest() noexcept {return -max();} + + static constexpr bool is_integer = false; + static constexpr bool is_exact = false; + static constexpr int radix = __FLT_RADIX__; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type epsilon() noexcept {return __FLT_EPSILON__;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type round_error() noexcept {return 0.5F;} + + static constexpr int min_exponent = __FLT_MIN_EXP__; + static constexpr int min_exponent10 = __FLT_MIN_10_EXP__; + static constexpr int max_exponent = __FLT_MAX_EXP__; + static constexpr int max_exponent10 = __FLT_MAX_10_EXP__; + + static constexpr bool has_infinity = true; + static constexpr bool has_quiet_NaN = true; + static constexpr bool has_signaling_NaN = true; + static constexpr float_denorm_style has_denorm = denorm_present; + static constexpr bool has_denorm_loss = false; +#ifdef _LIBCUDACXX_COMPILER_NVRTC + _LIBCUDACXX_INLINE_VISIBILITY static type infinity() noexcept {return __builtin_huge_valf();} + _LIBCUDACXX_INLINE_VISIBILITY static type quiet_NaN() noexcept {return __builtin_nanf("");} + _LIBCUDACXX_INLINE_VISIBILITY static type signaling_NaN() noexcept {return __builtin_nansf("");} +#else + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type infinity() noexcept {return __builtin_huge_valf();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type quiet_NaN() noexcept {return __builtin_nanf("");} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type signaling_NaN() noexcept {return __builtin_nansf("");} +#endif + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type denorm_min() noexcept {return __FLT_DENORM_MIN__;} + + static constexpr bool is_iec559 = true; + static constexpr bool is_bounded = true; + static constexpr bool is_modulo = false; + + static constexpr bool traps = false; + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_to_nearest; +}; + +template <> +class __libcpp_numeric_limits +{ +protected: + typedef double type; + + static constexpr bool is_specialized = true; + + static constexpr bool is_signed = true; + static constexpr int digits = __DBL_MANT_DIG__; + static constexpr int digits10 = __DBL_DIG__; + static constexpr int max_digits10 = 2+(digits * 30103l)/100000l; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type min() noexcept {return __DBL_MIN__;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type max() noexcept {return __DBL_MAX__;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type lowest() noexcept {return -max();} + + static constexpr bool is_integer = false; + static constexpr bool is_exact = false; + static constexpr int radix = __FLT_RADIX__; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type epsilon() noexcept {return __DBL_EPSILON__;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type round_error() noexcept {return 0.5;} + + static constexpr int min_exponent = __DBL_MIN_EXP__; + static constexpr int min_exponent10 = __DBL_MIN_10_EXP__; + static constexpr int max_exponent = __DBL_MAX_EXP__; + static constexpr int max_exponent10 = __DBL_MAX_10_EXP__; + + static constexpr bool has_infinity = true; + static constexpr bool has_quiet_NaN = true; + static constexpr bool has_signaling_NaN = true; + static constexpr float_denorm_style has_denorm = denorm_present; + static constexpr bool has_denorm_loss = false; +#ifdef _LIBCUDACXX_COMPILER_NVRTC + _LIBCUDACXX_INLINE_VISIBILITY static type infinity() noexcept {return __builtin_huge_val();} + _LIBCUDACXX_INLINE_VISIBILITY static type quiet_NaN() noexcept {return __builtin_nan("");} + _LIBCUDACXX_INLINE_VISIBILITY static type signaling_NaN() noexcept {return __builtin_nans("");} +#else + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type infinity() noexcept {return __builtin_huge_val();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type quiet_NaN() noexcept {return __builtin_nan("");} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type signaling_NaN() noexcept {return __builtin_nans("");} +#endif + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type denorm_min() noexcept {return __DBL_DENORM_MIN__;} + + static constexpr bool is_iec559 = true; + static constexpr bool is_bounded = true; + static constexpr bool is_modulo = false; + + static constexpr bool traps = false; + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_to_nearest; +}; + +template <> +class __libcpp_numeric_limits +{ +#ifndef _LIBCUDACXX_HAS_NO_LONG_DOUBLE +protected: + typedef long double type; + + static constexpr bool is_specialized = true; + + static constexpr bool is_signed = true; + static constexpr int digits = __LDBL_MANT_DIG__; + static constexpr int digits10 = __LDBL_DIG__; + static constexpr int max_digits10 = 2+(digits * 30103l)/100000l; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type min() noexcept {return __LDBL_MIN__;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type max() noexcept {return __LDBL_MAX__;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type lowest() noexcept {return -max();} + + static constexpr bool is_integer = false; + static constexpr bool is_exact = false; + static constexpr int radix = __FLT_RADIX__; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type epsilon() noexcept {return __LDBL_EPSILON__;} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type round_error() noexcept {return 0.5L;} + + static constexpr int min_exponent = __LDBL_MIN_EXP__; + static constexpr int min_exponent10 = __LDBL_MIN_10_EXP__; + static constexpr int max_exponent = __LDBL_MAX_EXP__; + static constexpr int max_exponent10 = __LDBL_MAX_10_EXP__; + + static constexpr bool has_infinity = true; + static constexpr bool has_quiet_NaN = true; + static constexpr bool has_signaling_NaN = true; + static constexpr float_denorm_style has_denorm = denorm_present; + static constexpr bool has_denorm_loss = false; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type infinity() noexcept {return __builtin_huge_vall();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type quiet_NaN() noexcept {return __builtin_nanl("");} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type signaling_NaN() noexcept {return __builtin_nansl("");} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type denorm_min() noexcept {return __LDBL_DENORM_MIN__;} + +#if (defined(__ppc__) || defined(__ppc64__) || defined(__PPC64__)) + static constexpr bool is_iec559 = false; +#else + static constexpr bool is_iec559 = true; +#endif + static constexpr bool is_bounded = true; + static constexpr bool is_modulo = false; + + static constexpr bool traps = false; + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_to_nearest; +#endif +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS numeric_limits + : private __libcpp_numeric_limits<__remove_cv_t<_Tp>> +{ + typedef __libcpp_numeric_limits<__remove_cv_t<_Tp>> __base; + typedef typename __base::type type; +public: + static constexpr bool is_specialized = __base::is_specialized; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type min() noexcept {return __base::min();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type max() noexcept {return __base::max();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type lowest() noexcept {return __base::lowest();} + + static constexpr int digits = __base::digits; + static constexpr int digits10 = __base::digits10; + static constexpr int max_digits10 = __base::max_digits10; + static constexpr bool is_signed = __base::is_signed; + static constexpr bool is_integer = __base::is_integer; + static constexpr bool is_exact = __base::is_exact; + static constexpr int radix = __base::radix; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type epsilon() noexcept {return __base::epsilon();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type round_error() noexcept {return __base::round_error();} + + static constexpr int min_exponent = __base::min_exponent; + static constexpr int min_exponent10 = __base::min_exponent10; + static constexpr int max_exponent = __base::max_exponent; + static constexpr int max_exponent10 = __base::max_exponent10; + + static constexpr bool has_infinity = __base::has_infinity; + static constexpr bool has_quiet_NaN = __base::has_quiet_NaN; + static constexpr bool has_signaling_NaN = __base::has_signaling_NaN; + static constexpr float_denorm_style has_denorm = __base::has_denorm; + static constexpr bool has_denorm_loss = __base::has_denorm_loss; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type infinity() noexcept {return __base::infinity();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type quiet_NaN() noexcept {return __base::quiet_NaN();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type signaling_NaN() noexcept {return __base::signaling_NaN();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type denorm_min() noexcept {return __base::denorm_min();} + + static constexpr bool is_iec559 = __base::is_iec559; + static constexpr bool is_bounded = __base::is_bounded; + static constexpr bool is_modulo = __base::is_modulo; + + static constexpr bool traps = __base::traps; + static constexpr bool tinyness_before = __base::tinyness_before; + static constexpr float_round_style round_style = __base::round_style; +}; + +template + constexpr bool numeric_limits<_Tp>::is_specialized; +template + constexpr int numeric_limits<_Tp>::digits; +template + constexpr int numeric_limits<_Tp>::digits10; +template + constexpr int numeric_limits<_Tp>::max_digits10; +template + constexpr bool numeric_limits<_Tp>::is_signed; +template + constexpr bool numeric_limits<_Tp>::is_integer; +template + constexpr bool numeric_limits<_Tp>::is_exact; +template + constexpr int numeric_limits<_Tp>::radix; +template + constexpr int numeric_limits<_Tp>::min_exponent; +template + constexpr int numeric_limits<_Tp>::min_exponent10; +template + constexpr int numeric_limits<_Tp>::max_exponent; +template + constexpr int numeric_limits<_Tp>::max_exponent10; +template + constexpr bool numeric_limits<_Tp>::has_infinity; +template + constexpr bool numeric_limits<_Tp>::has_quiet_NaN; +template + constexpr bool numeric_limits<_Tp>::has_signaling_NaN; +template + constexpr float_denorm_style numeric_limits<_Tp>::has_denorm; +template + constexpr bool numeric_limits<_Tp>::has_denorm_loss; +template + constexpr bool numeric_limits<_Tp>::is_iec559; +template + constexpr bool numeric_limits<_Tp>::is_bounded; +template + constexpr bool numeric_limits<_Tp>::is_modulo; +template + constexpr bool numeric_limits<_Tp>::traps; +template + constexpr bool numeric_limits<_Tp>::tinyness_before; +template + constexpr float_round_style numeric_limits<_Tp>::round_style; + +template +class _LIBCUDACXX_TEMPLATE_VIS numeric_limits + : private numeric_limits<_Tp> +{ + typedef numeric_limits<_Tp> __base; + typedef _Tp type; +public: + static constexpr bool is_specialized = __base::is_specialized; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type min() noexcept {return __base::min();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type max() noexcept {return __base::max();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type lowest() noexcept {return __base::lowest();} + + static constexpr int digits = __base::digits; + static constexpr int digits10 = __base::digits10; + static constexpr int max_digits10 = __base::max_digits10; + static constexpr bool is_signed = __base::is_signed; + static constexpr bool is_integer = __base::is_integer; + static constexpr bool is_exact = __base::is_exact; + static constexpr int radix = __base::radix; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type epsilon() noexcept {return __base::epsilon();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type round_error() noexcept {return __base::round_error();} + + static constexpr int min_exponent = __base::min_exponent; + static constexpr int min_exponent10 = __base::min_exponent10; + static constexpr int max_exponent = __base::max_exponent; + static constexpr int max_exponent10 = __base::max_exponent10; + + static constexpr bool has_infinity = __base::has_infinity; + static constexpr bool has_quiet_NaN = __base::has_quiet_NaN; + static constexpr bool has_signaling_NaN = __base::has_signaling_NaN; + static constexpr float_denorm_style has_denorm = __base::has_denorm; + static constexpr bool has_denorm_loss = __base::has_denorm_loss; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type infinity() noexcept {return __base::infinity();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type quiet_NaN() noexcept {return __base::quiet_NaN();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type signaling_NaN() noexcept {return __base::signaling_NaN();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type denorm_min() noexcept {return __base::denorm_min();} + + static constexpr bool is_iec559 = __base::is_iec559; + static constexpr bool is_bounded = __base::is_bounded; + static constexpr bool is_modulo = __base::is_modulo; + + static constexpr bool traps = __base::traps; + static constexpr bool tinyness_before = __base::tinyness_before; + static constexpr float_round_style round_style = __base::round_style; +}; + +template + constexpr bool numeric_limits::is_specialized; +template + constexpr int numeric_limits::digits; +template + constexpr int numeric_limits::digits10; +template + constexpr int numeric_limits::max_digits10; +template + constexpr bool numeric_limits::is_signed; +template + constexpr bool numeric_limits::is_integer; +template + constexpr bool numeric_limits::is_exact; +template + constexpr int numeric_limits::radix; +template + constexpr int numeric_limits::min_exponent; +template + constexpr int numeric_limits::min_exponent10; +template + constexpr int numeric_limits::max_exponent; +template + constexpr int numeric_limits::max_exponent10; +template + constexpr bool numeric_limits::has_infinity; +template + constexpr bool numeric_limits::has_quiet_NaN; +template + constexpr bool numeric_limits::has_signaling_NaN; +template + constexpr float_denorm_style numeric_limits::has_denorm; +template + constexpr bool numeric_limits::has_denorm_loss; +template + constexpr bool numeric_limits::is_iec559; +template + constexpr bool numeric_limits::is_bounded; +template + constexpr bool numeric_limits::is_modulo; +template + constexpr bool numeric_limits::traps; +template + constexpr bool numeric_limits::tinyness_before; +template + constexpr float_round_style numeric_limits::round_style; + +template +class _LIBCUDACXX_TEMPLATE_VIS numeric_limits + : private numeric_limits<_Tp> +{ + typedef numeric_limits<_Tp> __base; + typedef _Tp type; +public: + static constexpr bool is_specialized = __base::is_specialized; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type min() noexcept {return __base::min();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type max() noexcept {return __base::max();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type lowest() noexcept {return __base::lowest();} + + static constexpr int digits = __base::digits; + static constexpr int digits10 = __base::digits10; + static constexpr int max_digits10 = __base::max_digits10; + static constexpr bool is_signed = __base::is_signed; + static constexpr bool is_integer = __base::is_integer; + static constexpr bool is_exact = __base::is_exact; + static constexpr int radix = __base::radix; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type epsilon() noexcept {return __base::epsilon();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type round_error() noexcept {return __base::round_error();} + + static constexpr int min_exponent = __base::min_exponent; + static constexpr int min_exponent10 = __base::min_exponent10; + static constexpr int max_exponent = __base::max_exponent; + static constexpr int max_exponent10 = __base::max_exponent10; + + static constexpr bool has_infinity = __base::has_infinity; + static constexpr bool has_quiet_NaN = __base::has_quiet_NaN; + static constexpr bool has_signaling_NaN = __base::has_signaling_NaN; + static constexpr float_denorm_style has_denorm = __base::has_denorm; + static constexpr bool has_denorm_loss = __base::has_denorm_loss; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type infinity() noexcept {return __base::infinity();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type quiet_NaN() noexcept {return __base::quiet_NaN();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type signaling_NaN() noexcept {return __base::signaling_NaN();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type denorm_min() noexcept {return __base::denorm_min();} + + static constexpr bool is_iec559 = __base::is_iec559; + static constexpr bool is_bounded = __base::is_bounded; + static constexpr bool is_modulo = __base::is_modulo; + + static constexpr bool traps = __base::traps; + static constexpr bool tinyness_before = __base::tinyness_before; + static constexpr float_round_style round_style = __base::round_style; +}; + +template + constexpr bool numeric_limits::is_specialized; +template + constexpr int numeric_limits::digits; +template + constexpr int numeric_limits::digits10; +template + constexpr int numeric_limits::max_digits10; +template + constexpr bool numeric_limits::is_signed; +template + constexpr bool numeric_limits::is_integer; +template + constexpr bool numeric_limits::is_exact; +template + constexpr int numeric_limits::radix; +template + constexpr int numeric_limits::min_exponent; +template + constexpr int numeric_limits::min_exponent10; +template + constexpr int numeric_limits::max_exponent; +template + constexpr int numeric_limits::max_exponent10; +template + constexpr bool numeric_limits::has_infinity; +template + constexpr bool numeric_limits::has_quiet_NaN; +template + constexpr bool numeric_limits::has_signaling_NaN; +template + constexpr float_denorm_style numeric_limits::has_denorm; +template + constexpr bool numeric_limits::has_denorm_loss; +template + constexpr bool numeric_limits::is_iec559; +template + constexpr bool numeric_limits::is_bounded; +template + constexpr bool numeric_limits::is_modulo; +template + constexpr bool numeric_limits::traps; +template + constexpr bool numeric_limits::tinyness_before; +template + constexpr float_round_style numeric_limits::round_style; + +template +class _LIBCUDACXX_TEMPLATE_VIS numeric_limits + : private numeric_limits<_Tp> +{ + typedef numeric_limits<_Tp> __base; + typedef _Tp type; +public: + static constexpr bool is_specialized = __base::is_specialized; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type min() noexcept {return __base::min();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type max() noexcept {return __base::max();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type lowest() noexcept {return __base::lowest();} + + static constexpr int digits = __base::digits; + static constexpr int digits10 = __base::digits10; + static constexpr int max_digits10 = __base::max_digits10; + static constexpr bool is_signed = __base::is_signed; + static constexpr bool is_integer = __base::is_integer; + static constexpr bool is_exact = __base::is_exact; + static constexpr int radix = __base::radix; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type epsilon() noexcept {return __base::epsilon();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type round_error() noexcept {return __base::round_error();} + + static constexpr int min_exponent = __base::min_exponent; + static constexpr int min_exponent10 = __base::min_exponent10; + static constexpr int max_exponent = __base::max_exponent; + static constexpr int max_exponent10 = __base::max_exponent10; + + static constexpr bool has_infinity = __base::has_infinity; + static constexpr bool has_quiet_NaN = __base::has_quiet_NaN; + static constexpr bool has_signaling_NaN = __base::has_signaling_NaN; + static constexpr float_denorm_style has_denorm = __base::has_denorm; + static constexpr bool has_denorm_loss = __base::has_denorm_loss; + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type infinity() noexcept {return __base::infinity();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type quiet_NaN() noexcept {return __base::quiet_NaN();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type signaling_NaN() noexcept {return __base::signaling_NaN();} + _LIBCUDACXX_INLINE_VISIBILITY static constexpr type denorm_min() noexcept {return __base::denorm_min();} + + static constexpr bool is_iec559 = __base::is_iec559; + static constexpr bool is_bounded = __base::is_bounded; + static constexpr bool is_modulo = __base::is_modulo; + + static constexpr bool traps = __base::traps; + static constexpr bool tinyness_before = __base::tinyness_before; + static constexpr float_round_style round_style = __base::round_style; +}; + +template + constexpr bool numeric_limits::is_specialized; +template + constexpr int numeric_limits::digits; +template + constexpr int numeric_limits::digits10; +template + constexpr int numeric_limits::max_digits10; +template + constexpr bool numeric_limits::is_signed; +template + constexpr bool numeric_limits::is_integer; +template + constexpr bool numeric_limits::is_exact; +template + constexpr int numeric_limits::radix; +template + constexpr int numeric_limits::min_exponent; +template + constexpr int numeric_limits::min_exponent10; +template + constexpr int numeric_limits::max_exponent; +template + constexpr int numeric_limits::max_exponent10; +template + constexpr bool numeric_limits::has_infinity; +template + constexpr bool numeric_limits::has_quiet_NaN; +template + constexpr bool numeric_limits::has_signaling_NaN; +template + constexpr float_denorm_style numeric_limits::has_denorm; +template + constexpr bool numeric_limits::has_denorm_loss; +template + constexpr bool numeric_limits::is_iec559; +template + constexpr bool numeric_limits::is_bounded; +template + constexpr bool numeric_limits::is_modulo; +template + constexpr bool numeric_limits::traps; +template + constexpr bool numeric_limits::tinyness_before; +template + constexpr float_round_style numeric_limits::round_style; + +_LIBCUDACXX_END_NAMESPACE_STD + +#ifndef __cuda_std__ +#include <__pragma_pop> +#endif //__cuda_std__ + +#endif // _LIBCUDACXX_LIMITS diff --git a/cuda_toolkit/include/limits.h b/cuda_toolkit/include/limits.h new file mode 100644 index 0000000000000000000000000000000000000000..5221c0d0ef2418e717c2a87558c6ca0e67097209 --- /dev/null +++ b/cuda_toolkit/include/limits.h @@ -0,0 +1,72 @@ +// -*- C++ -*- +//===--------------------------- limits.h ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_LIMITS_H +#define _LIBCUDACXX_LIMITS_H + +/* + limits.h synopsis + +Macros: + + CHAR_BIT + SCHAR_MIN + SCHAR_MAX + UCHAR_MAX + CHAR_MIN + CHAR_MAX + MB_LEN_MAX + SHRT_MIN + SHRT_MAX + USHRT_MAX + INT_MIN + INT_MAX + UINT_MAX + LONG_MIN + LONG_MAX + ULONG_MAX + LLONG_MIN // C99 + LLONG_MAX // C99 + ULLONG_MAX // C99 + +*/ + +#include <__config> + +#include <__pragma_push> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#ifndef __GNUC__ +#include_next +#else +// GCC header limits.h recursively includes itself through another header called +// syslimits.h for some reason. This setup breaks down if we directly +// #include_next GCC's limits.h (reasons not entirely clear to me). Therefore, +// we manually re-create the necessary include sequence below: + +// Get the system limits.h defines (force recurse into the next level) +#define _GCC_LIMITS_H_ +#define _GCC_NEXT_LIMITS_H +#include_next + +// Get the ISO C defines +#undef _GCC_LIMITS_H_ +#include_next +#endif // __GNUC__ + +#include <__pragma_pop> + +#endif // _LIBCUDACXX_LIMITS_H diff --git a/cuda_toolkit/include/list b/cuda_toolkit/include/list new file mode 100644 index 0000000000000000000000000000000000000000..d749b4cc26b1c3ae6e340eacb67632090f81b0d1 --- /dev/null +++ b/cuda_toolkit/include/list @@ -0,0 +1,2463 @@ +// -*- C++ -*- +//===---------------------------- list ------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_LIST +#define _LIBCUDACXX_LIST + +/* + list synopsis + +namespace std +{ + +template > +class list +{ +public: + + // types: + typedef T value_type; + typedef Alloc allocator_type; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef implementation-defined iterator; + typedef implementation-defined const_iterator; + typedef implementation-defined size_type; + typedef implementation-defined difference_type; + typedef reverse_iterator reverse_iterator; + typedef reverse_iterator const_reverse_iterator; + + list() + noexcept(is_nothrow_default_constructible::value); + explicit list(const allocator_type& a); + explicit list(size_type n); + explicit list(size_type n, const allocator_type& a); // C++14 + list(size_type n, const value_type& value); + list(size_type n, const value_type& value, const allocator_type& a); + template + list(Iter first, Iter last); + template + list(Iter first, Iter last, const allocator_type& a); + list(const list& x); + list(const list&, const allocator_type& a); + list(list&& x) + noexcept(is_nothrow_move_constructible::value); + list(list&&, const allocator_type& a); + list(initializer_list); + list(initializer_list, const allocator_type& a); + + ~list(); + + list& operator=(const list& x); + list& operator=(list&& x) + noexcept( + allocator_type::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value); + list& operator=(initializer_list); + template + void assign(Iter first, Iter last); + void assign(size_type n, const value_type& t); + void assign(initializer_list); + + allocator_type get_allocator() const noexcept; + + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; + reverse_iterator rbegin() noexcept; + const_reverse_iterator rbegin() const noexcept; + reverse_iterator rend() noexcept; + const_reverse_iterator rend() const noexcept; + const_iterator cbegin() const noexcept; + const_iterator cend() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator crend() const noexcept; + + reference front(); + const_reference front() const; + reference back(); + const_reference back() const; + + bool empty() const noexcept; + size_type size() const noexcept; + size_type max_size() const noexcept; + + template + reference emplace_front(Args&&... args); // reference in C++17 + void pop_front(); + template + reference emplace_back(Args&&... args); // reference in C++17 + void pop_back(); + void push_front(const value_type& x); + void push_front(value_type&& x); + void push_back(const value_type& x); + void push_back(value_type&& x); + template + iterator emplace(const_iterator position, Args&&... args); + iterator insert(const_iterator position, const value_type& x); + iterator insert(const_iterator position, value_type&& x); + iterator insert(const_iterator position, size_type n, const value_type& x); + template + iterator insert(const_iterator position, Iter first, Iter last); + iterator insert(const_iterator position, initializer_list il); + + iterator erase(const_iterator position); + iterator erase(const_iterator position, const_iterator last); + + void resize(size_type sz); + void resize(size_type sz, const value_type& c); + + void swap(list&) + noexcept(allocator_traits::is_always_equal::value); // C++17 + void clear() noexcept; + + void splice(const_iterator position, list& x); + void splice(const_iterator position, list&& x); + void splice(const_iterator position, list& x, const_iterator i); + void splice(const_iterator position, list&& x, const_iterator i); + void splice(const_iterator position, list& x, const_iterator first, + const_iterator last); + void splice(const_iterator position, list&& x, const_iterator first, + const_iterator last); + + size_type remove(const value_type& value); // void before C++20 + template + size_type remove_if(Pred pred); // void before C++20 + size_type unique(); // void before C++20 + template + size_type unique(BinaryPredicate binary_pred); // void before C++20 + void merge(list& x); + void merge(list&& x); + template + void merge(list& x, Compare comp); + template + void merge(list&& x, Compare comp); + void sort(); + template + void sort(Compare comp); + void reverse() noexcept; +}; + + +template ::value_type>> + list(InputIterator, InputIterator, Allocator = Allocator()) + -> list::value_type, Allocator>; // C++17 + +template + bool operator==(const list& x, const list& y); +template + bool operator< (const list& x, const list& y); +template + bool operator!=(const list& x, const list& y); +template + bool operator> (const list& x, const list& y); +template + bool operator>=(const list& x, const list& y); +template + bool operator<=(const list& x, const list& y); + +template + void swap(list& x, list& y) + noexcept(noexcept(x.swap(y))); + +template + void erase(list& c, const U& value); // C++20 +template + void erase_if(list& c, Predicate pred); // C++20 + +} // std + +*/ + +#include <__config> + +#include +#include +#include +#include +#include +#include +#include + +#include <__debug> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template struct __list_node; +template struct __list_node_base; + +template +struct __list_node_pointer_traits { + typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type + __node_pointer; + typedef typename __rebind_pointer<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >::type + __base_pointer; + +#if defined(_LIBCUDACXX_ABI_LIST_REMOVE_NODE_POINTER_UB) + typedef __base_pointer __link_pointer; +#else + typedef typename conditional< + is_pointer<_VoidPtr>::value, + __base_pointer, + __node_pointer + >::type __link_pointer; +#endif + + typedef typename conditional< + is_same<__link_pointer, __node_pointer>::value, + __base_pointer, + __node_pointer + >::type __non_link_pointer; + + static _LIBCUDACXX_INLINE_VISIBILITY + __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) { + return __p; + } + + static _LIBCUDACXX_INLINE_VISIBILITY + __link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) { + return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p)); + } + +}; + +template +struct __list_node_base +{ + typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; + typedef typename _NodeTraits::__node_pointer __node_pointer; + typedef typename _NodeTraits::__base_pointer __base_pointer; + typedef typename _NodeTraits::__link_pointer __link_pointer; + + __link_pointer __prev_; + __link_pointer __next_; + + _LIBCUDACXX_INLINE_VISIBILITY + __list_node_base() : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())), + __next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {} + + _LIBCUDACXX_INLINE_VISIBILITY + __base_pointer __self() { + return pointer_traits<__base_pointer>::pointer_to(*this); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __node_pointer __as_node() { + return static_cast<__node_pointer>(__self()); + } +}; + +template +struct __list_node + : public __list_node_base<_Tp, _VoidPtr> +{ + _Tp __value_; + + typedef __list_node_base<_Tp, _VoidPtr> __base; + typedef typename __base::__link_pointer __link_pointer; + + _LIBCUDACXX_INLINE_VISIBILITY + __link_pointer __as_link() { + return static_cast<__link_pointer>(__base::__self()); + } +}; + +template > class _LIBCUDACXX_TEMPLATE_VIS list; +template class __list_imp; +template class _LIBCUDACXX_TEMPLATE_VIS __list_const_iterator; + +template +class _LIBCUDACXX_TEMPLATE_VIS __list_iterator +{ + typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; + typedef typename _NodeTraits::__link_pointer __link_pointer; + + __link_pointer __ptr_; + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + explicit __list_iterator(__link_pointer __p, const void* __c) noexcept + : __ptr_(__p) + { + __get_db()->__insert_ic(this, __c); + } +#else + _LIBCUDACXX_INLINE_VISIBILITY + explicit __list_iterator(__link_pointer __p) noexcept : __ptr_(__p) {} +#endif + + + + template friend class list; + template friend class __list_imp; + template friend class __list_const_iterator; +public: + typedef bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef value_type& reference; + typedef typename __rebind_pointer<_VoidPtr, value_type>::type pointer; + typedef typename pointer_traits::difference_type difference_type; + + _LIBCUDACXX_INLINE_VISIBILITY + __list_iterator() noexcept : __ptr_(nullptr) + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_i(this); +#endif + } + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + + _LIBCUDACXX_INLINE_VISIBILITY + __list_iterator(const __list_iterator& __p) + : __ptr_(__p.__ptr_) + { + __get_db()->__iterator_copy(this, &__p); + } + + _LIBCUDACXX_INLINE_VISIBILITY + ~__list_iterator() + { + __get_db()->__erase_i(this); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __list_iterator& operator=(const __list_iterator& __p) + { + if (this != &__p) + { + __get_db()->__iterator_copy(this, &__p); + __ptr_ = __p.__ptr_; + } + return *this; + } + +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable list::iterator"); +#endif + return __ptr_->__as_node()->__value_; + } + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable list::iterator"); +#endif + return pointer_traits::pointer_to(__ptr_->__as_node()->__value_); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __list_iterator& operator++() + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to increment non-incrementable list::iterator"); +#endif + __ptr_ = __ptr_->__next_; + return *this; + } + _LIBCUDACXX_INLINE_VISIBILITY + __list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;} + + _LIBCUDACXX_INLINE_VISIBILITY + __list_iterator& operator--() + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__decrementable(this), + "Attempted to decrement non-decrementable list::iterator"); +#endif + __ptr_ = __ptr_->__prev_; + return *this; + } + _LIBCUDACXX_INLINE_VISIBILITY + __list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;} + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __list_iterator& __x, const __list_iterator& __y) + { + return __x.__ptr_ == __y.__ptr_; + } + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __list_iterator& __x, const __list_iterator& __y) + {return !(__x == __y);} +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __list_const_iterator +{ + typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; + typedef typename _NodeTraits::__link_pointer __link_pointer; + + __link_pointer __ptr_; + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + explicit __list_const_iterator(__link_pointer __p, const void* __c) noexcept + : __ptr_(__p) + { + __get_db()->__insert_ic(this, __c); + } +#else + _LIBCUDACXX_INLINE_VISIBILITY + explicit __list_const_iterator(__link_pointer __p) noexcept : __ptr_(__p) {} +#endif + + template friend class list; + template friend class __list_imp; +public: + typedef bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef const value_type& reference; + typedef typename __rebind_pointer<_VoidPtr, const value_type>::type pointer; + typedef typename pointer_traits::difference_type difference_type; + + _LIBCUDACXX_INLINE_VISIBILITY + __list_const_iterator() noexcept : __ptr_(nullptr) + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_i(this); +#endif + } + _LIBCUDACXX_INLINE_VISIBILITY + __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) noexcept + : __ptr_(__p.__ptr_) + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__iterator_copy(this, &__p); +#endif + } + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + + _LIBCUDACXX_INLINE_VISIBILITY + __list_const_iterator(const __list_const_iterator& __p) + : __ptr_(__p.__ptr_) + { + __get_db()->__iterator_copy(this, &__p); + } + + _LIBCUDACXX_INLINE_VISIBILITY + ~__list_const_iterator() + { + __get_db()->__erase_i(this); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __list_const_iterator& operator=(const __list_const_iterator& __p) + { + if (this != &__p) + { + __get_db()->__iterator_copy(this, &__p); + __ptr_ = __p.__ptr_; + } + return *this; + } + +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable list::const_iterator"); +#endif + return __ptr_->__as_node()->__value_; + } + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to dereference a non-dereferenceable list::const_iterator"); +#endif + return pointer_traits::pointer_to(__ptr_->__as_node()->__value_); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __list_const_iterator& operator++() + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__dereferenceable(this), + "Attempted to increment non-incrementable list::const_iterator"); +#endif + __ptr_ = __ptr_->__next_; + return *this; + } + _LIBCUDACXX_INLINE_VISIBILITY + __list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;} + + _LIBCUDACXX_INLINE_VISIBILITY + __list_const_iterator& operator--() + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__decrementable(this), + "Attempted to decrement non-decrementable list::const_iterator"); +#endif + __ptr_ = __ptr_->__prev_; + return *this; + } + _LIBCUDACXX_INLINE_VISIBILITY + __list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;} + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y) + { + return __x.__ptr_ == __y.__ptr_; + } + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y) + {return !(__x == __y);} +}; + +template +class __list_imp +{ + __list_imp(const __list_imp&); + __list_imp& operator=(const __list_imp&); +public: + typedef _Alloc allocator_type; + typedef allocator_traits __alloc_traits; + typedef typename __alloc_traits::size_type size_type; +protected: + typedef _Tp value_type; + typedef typename __alloc_traits::void_pointer __void_pointer; + typedef __list_iterator iterator; + typedef __list_const_iterator const_iterator; + typedef __list_node_base __node_base; + typedef __list_node __node; + typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; + typedef allocator_traits<__node_allocator> __node_alloc_traits; + typedef typename __node_alloc_traits::pointer __node_pointer; + typedef typename __node_alloc_traits::pointer __node_const_pointer; + typedef __list_node_pointer_traits __node_pointer_traits; + typedef typename __node_pointer_traits::__link_pointer __link_pointer; + typedef __link_pointer __link_const_pointer; + typedef typename __alloc_traits::pointer pointer; + typedef typename __alloc_traits::const_pointer const_pointer; + typedef typename __alloc_traits::difference_type difference_type; + + typedef typename __rebind_alloc_helper<__alloc_traits, __node_base>::type __node_base_allocator; + typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer; + static_assert((!is_same::value), + "internal allocator type must differ from user-specified " + "type; otherwise overload resolution breaks"); + + __node_base __end_; + __compressed_pair __size_alloc_; + + _LIBCUDACXX_INLINE_VISIBILITY + __link_pointer __end_as_link() const noexcept { + return __node_pointer_traits::__unsafe_link_pointer_cast( + const_cast<__node_base&>(__end_).__self()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + size_type& __sz() noexcept {return __size_alloc_.first();} + _LIBCUDACXX_INLINE_VISIBILITY + const size_type& __sz() const noexcept + {return __size_alloc_.first();} + _LIBCUDACXX_INLINE_VISIBILITY + __node_allocator& __node_alloc() noexcept + {return __size_alloc_.second();} + _LIBCUDACXX_INLINE_VISIBILITY + const __node_allocator& __node_alloc() const noexcept + {return __size_alloc_.second();} + + _LIBCUDACXX_INLINE_VISIBILITY + size_type __node_alloc_max_size() const noexcept { + return __node_alloc_traits::max_size(__node_alloc()); + } + _LIBCUDACXX_INLINE_VISIBILITY + static void __unlink_nodes(__link_pointer __f, __link_pointer __l) noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + __list_imp() + noexcept(is_nothrow_default_constructible<__node_allocator>::value); + _LIBCUDACXX_INLINE_VISIBILITY + __list_imp(const allocator_type& __a); + _LIBCUDACXX_INLINE_VISIBILITY + __list_imp(const __node_allocator& __a); + __list_imp(__node_allocator&& __a) noexcept; + ~__list_imp(); + void clear() noexcept; + _LIBCUDACXX_INLINE_VISIBILITY + bool empty() const noexcept {return __sz() == 0;} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator begin() noexcept + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(__end_.__next_, this); +#else + return iterator(__end_.__next_); +#endif + } + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator begin() const noexcept + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return const_iterator(__end_.__next_, this); +#else + return const_iterator(__end_.__next_); +#endif + } + _LIBCUDACXX_INLINE_VISIBILITY + iterator end() noexcept + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(__end_as_link(), this); +#else + return iterator(__end_as_link()); +#endif + } + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator end() const noexcept + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return const_iterator(__end_as_link(), this); +#else + return const_iterator(__end_as_link()); +#endif + } + + void swap(__list_imp& __c) +#if _LIBCUDACXX_STD_VER >= 14 + noexcept; +#else + noexcept(!__alloc_traits::propagate_on_container_swap::value || + __is_nothrow_swappable::value); +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __list_imp& __c) + {__copy_assign_alloc(__c, integral_constant());} + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__list_imp& __c) + noexcept( + !__node_alloc_traits::propagate_on_container_move_assignment::value || + is_nothrow_move_assignable<__node_allocator>::value) + {__move_assign_alloc(__c, integral_constant());} + +private: + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __list_imp& __c, true_type) + { + if (__node_alloc() != __c.__node_alloc()) + clear(); + __node_alloc() = __c.__node_alloc(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __copy_assign_alloc(const __list_imp&, false_type) + {} + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__list_imp& __c, true_type) + noexcept(is_nothrow_move_assignable<__node_allocator>::value) + { + __node_alloc() = _CUDA_VSTD::move(__c.__node_alloc()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void __move_assign_alloc(__list_imp&, false_type) + noexcept + {} + + _LIBCUDACXX_INLINE_VISIBILITY + void __invalidate_all_iterators() { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__invalidate_all(this); +#endif + } +}; + +// Unlink nodes [__f, __l] +template +inline +void +__list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l) + noexcept +{ + __f->__prev_->__next_ = __l->__next_; + __l->__next_->__prev_ = __f->__prev_; +} + +template +inline +__list_imp<_Tp, _Alloc>::__list_imp() + noexcept(is_nothrow_default_constructible<__node_allocator>::value) + : __size_alloc_(0) +{ +} + +template +inline +__list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a) + : __size_alloc_(0, __node_allocator(__a)) +{ +} + +template +inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a) + : __size_alloc_(0, __a) {} + +template +inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) noexcept + : __size_alloc_(0, std::move(__a)) {} + +template +__list_imp<_Tp, _Alloc>::~__list_imp() { + clear(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__erase_c(this); +#endif +} + +template +void +__list_imp<_Tp, _Alloc>::clear() noexcept +{ + if (!empty()) + { + __node_allocator& __na = __node_alloc(); + __link_pointer __f = __end_.__next_; + __link_pointer __l = __end_as_link(); + __unlink_nodes(__f, __l->__prev_); + __sz() = 0; + while (__f != __l) + { + __node_pointer __np = __f->__as_node(); + __f = __f->__next_; + __node_alloc_traits::destroy(__na, _CUDA_VSTD::addressof(__np->__value_)); + __node_alloc_traits::deallocate(__na, __np, 1); + } + __invalidate_all_iterators(); + } +} + +template +void +__list_imp<_Tp, _Alloc>::swap(__list_imp& __c) +#if _LIBCUDACXX_STD_VER >= 14 + noexcept +#else + noexcept(!__alloc_traits::propagate_on_container_swap::value || + __is_nothrow_swappable::value) +#endif +{ + _LIBCUDACXX_ASSERT(__alloc_traits::propagate_on_container_swap::value || + this->__node_alloc() == __c.__node_alloc(), + "list::swap: Either propagate_on_container_swap must be true" + " or the allocators must compare equal"); + using _CUDA_VSTD::swap; + __swap_allocator(__node_alloc(), __c.__node_alloc()); + swap(__sz(), __c.__sz()); + swap(__end_, __c.__end_); + if (__sz() == 0) + __end_.__next_ = __end_.__prev_ = __end_as_link(); + else + __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_as_link(); + if (__c.__sz() == 0) + __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link(); + else + __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link(); + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __libcpp_db* __db = __get_db(); + __c_node* __cn1 = __db->__find_c_and_lock(this); + __c_node* __cn2 = __db->__find_c(&__c); + std::swap(__cn1->beg_, __cn2->beg_); + std::swap(__cn1->end_, __cn2->end_); + std::swap(__cn1->cap_, __cn2->cap_); + for (__i_node** __p = __cn1->end_; __p != __cn1->beg_;) + { + --__p; + const_iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == __c.__end_as_link()) + { + __cn2->__add(*__p); + if (--__cn1->end_ != __p) + memmove(__p, __p+1, (__cn1->end_ - __p)*sizeof(__i_node*)); + } + else + (*__p)->__c_ = __cn1; + } + for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;) + { + --__p; + const_iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == __end_as_link()) + { + __cn1->__add(*__p); + if (--__cn2->end_ != __p) + memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); + } + else + (*__p)->__c_ = __cn2; + } + __db->unlock(); +#endif +} + +template */> +class _LIBCUDACXX_TEMPLATE_VIS list + : private __list_imp<_Tp, _Alloc> +{ + typedef __list_imp<_Tp, _Alloc> base; + typedef typename base::__node __node; + typedef typename base::__node_allocator __node_allocator; + typedef typename base::__node_pointer __node_pointer; + typedef typename base::__node_alloc_traits __node_alloc_traits; + typedef typename base::__node_base __node_base; + typedef typename base::__node_base_pointer __node_base_pointer; + typedef typename base::__link_pointer __link_pointer; + +public: + typedef _Tp value_type; + typedef _Alloc allocator_type; + static_assert((is_same::value), + "Invalid allocator::value_type"); + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename base::pointer pointer; + typedef typename base::const_pointer const_pointer; + typedef typename base::size_type size_type; + typedef typename base::difference_type difference_type; + typedef typename base::iterator iterator; + typedef typename base::const_iterator const_iterator; + typedef _CUDA_VSTD::reverse_iterator reverse_iterator; + typedef _CUDA_VSTD::reverse_iterator const_reverse_iterator; +#if _LIBCUDACXX_STD_VER > 17 + typedef size_type __remove_return_type; +#else + typedef void __remove_return_type; +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + list() + noexcept(is_nothrow_default_constructible<__node_allocator>::value) + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + } + _LIBCUDACXX_INLINE_VISIBILITY + explicit list(const allocator_type& __a) : base(__a) + { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + } + explicit list(size_type __n); +#if _LIBCUDACXX_STD_VER > 11 + explicit list(size_type __n, const allocator_type& __a); +#endif + list(size_type __n, const value_type& __x); + list(size_type __n, const value_type& __x, const allocator_type& __a); + template + list(_InpIter __f, _InpIter __l, + typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); + template + list(_InpIter __f, _InpIter __l, const allocator_type& __a, + typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); + + list(const list& __c); + list(const list& __c, const allocator_type& __a); + _LIBCUDACXX_INLINE_VISIBILITY + list& operator=(const list& __c); + list(initializer_list __il); + list(initializer_list __il, const allocator_type& __a); + + _LIBCUDACXX_INLINE_VISIBILITY + list(list&& __c) + noexcept(is_nothrow_move_constructible<__node_allocator>::value); + _LIBCUDACXX_INLINE_VISIBILITY + list(list&& __c, const allocator_type& __a); + _LIBCUDACXX_INLINE_VISIBILITY + list& operator=(list&& __c) + noexcept( + __node_alloc_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable<__node_allocator>::value); + + _LIBCUDACXX_INLINE_VISIBILITY + list& operator=(initializer_list __il) + {assign(__il.begin(), __il.end()); return *this;} + + _LIBCUDACXX_INLINE_VISIBILITY + void assign(initializer_list __il) + {assign(__il.begin(), __il.end());} + + template + void assign(_InpIter __f, _InpIter __l, + typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); + void assign(size_type __n, const value_type& __x); + + _LIBCUDACXX_INLINE_VISIBILITY + allocator_type get_allocator() const noexcept; + + _LIBCUDACXX_INLINE_VISIBILITY + size_type size() const noexcept {return base::__sz();} + _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY + bool empty() const noexcept {return base::empty();} + _LIBCUDACXX_INLINE_VISIBILITY + size_type max_size() const noexcept + { + return std::min( + base::__node_alloc_max_size(), + numeric_limits::max()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator begin() noexcept {return base::begin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator begin() const noexcept {return base::begin();} + _LIBCUDACXX_INLINE_VISIBILITY + iterator end() noexcept {return base::end();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator end() const noexcept {return base::end();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cbegin() const noexcept {return base::begin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cend() const noexcept {return base::end();} + + _LIBCUDACXX_INLINE_VISIBILITY + reverse_iterator rbegin() noexcept + {return reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator rbegin() const noexcept + {return const_reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY + reverse_iterator rend() noexcept + {return reverse_iterator(begin());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator rend() const noexcept + {return const_reverse_iterator(begin());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator crbegin() const noexcept + {return const_reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator crend() const noexcept + {return const_reverse_iterator(begin());} + + _LIBCUDACXX_INLINE_VISIBILITY + reference front() + { + _LIBCUDACXX_ASSERT(!empty(), "list::front called on empty list"); + return base::__end_.__next_->__as_node()->__value_; + } + _LIBCUDACXX_INLINE_VISIBILITY + const_reference front() const + { + _LIBCUDACXX_ASSERT(!empty(), "list::front called on empty list"); + return base::__end_.__next_->__as_node()->__value_; + } + _LIBCUDACXX_INLINE_VISIBILITY + reference back() + { + _LIBCUDACXX_ASSERT(!empty(), "list::back called on empty list"); + return base::__end_.__prev_->__as_node()->__value_; + } + _LIBCUDACXX_INLINE_VISIBILITY + const_reference back() const + { + _LIBCUDACXX_ASSERT(!empty(), "list::back called on empty list"); + return base::__end_.__prev_->__as_node()->__value_; + } + + void push_front(value_type&& __x); + void push_back(value_type&& __x); + + template +#if _LIBCUDACXX_STD_VER > 14 + reference emplace_front(_Args&&... __args); +#else + void emplace_front(_Args&&... __args); +#endif + template +#if _LIBCUDACXX_STD_VER > 14 + reference emplace_back(_Args&&... __args); +#else + void emplace_back(_Args&&... __args); +#endif + template + iterator emplace(const_iterator __p, _Args&&... __args); + + iterator insert(const_iterator __p, value_type&& __x); + + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(const_iterator __p, initializer_list __il) + {return insert(__p, __il.begin(), __il.end());} + + void push_front(const value_type& __x); + void push_back(const value_type& __x); + + template + _LIBCUDACXX_INLINE_VISIBILITY + void __emplace_back(_Arg&& __arg) { emplace_back(_CUDA_VSTD::forward<_Arg>(__arg)); } + + iterator insert(const_iterator __p, const value_type& __x); + iterator insert(const_iterator __p, size_type __n, const value_type& __x); + template + iterator insert(const_iterator __p, _InpIter __f, _InpIter __l, + typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(list& __c) +#if _LIBCUDACXX_STD_VER >= 14 + noexcept +#else + noexcept(!__node_alloc_traits::propagate_on_container_swap::value || + __is_nothrow_swappable<__node_allocator>::value) +#endif + {base::swap(__c);} + _LIBCUDACXX_INLINE_VISIBILITY + void clear() noexcept {base::clear();} + + void pop_front(); + void pop_back(); + + iterator erase(const_iterator __p); + iterator erase(const_iterator __f, const_iterator __l); + + void resize(size_type __n); + void resize(size_type __n, const value_type& __x); + + void splice(const_iterator __p, list& __c); + _LIBCUDACXX_INLINE_VISIBILITY + void splice(const_iterator __p, list&& __c) {splice(__p, __c);} + _LIBCUDACXX_INLINE_VISIBILITY + void splice(const_iterator __p, list&& __c, const_iterator __i) + {splice(__p, __c, __i);} + _LIBCUDACXX_INLINE_VISIBILITY + void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l) + {splice(__p, __c, __f, __l);} + void splice(const_iterator __p, list& __c, const_iterator __i); + void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l); + + __remove_return_type remove(const value_type& __x); + template __remove_return_type remove_if(_Pred __pred); + _LIBCUDACXX_INLINE_VISIBILITY + __remove_return_type unique() { return unique(__equal_to()); } + template + __remove_return_type unique(_BinaryPred __binary_pred); + _LIBCUDACXX_INLINE_VISIBILITY + void merge(list& __c); + _LIBCUDACXX_INLINE_VISIBILITY + void merge(list&& __c) {merge(__c);} + + template + _LIBCUDACXX_INLINE_VISIBILITY + void merge(list&& __c, _Comp __comp) {merge(__c, __comp);} + template + void merge(list& __c, _Comp __comp); + + _LIBCUDACXX_INLINE_VISIBILITY + void sort(); + template + _LIBCUDACXX_INLINE_VISIBILITY + void sort(_Comp __comp); + + void reverse() noexcept; + + bool __invariants() const; + + typedef __allocator_destructor<__node_allocator> __node_destructor; + typedef unique_ptr<__node, __node_destructor> __hold_pointer; + + _LIBCUDACXX_INLINE_VISIBILITY + __hold_pointer __allocate_node(__node_allocator& __na) { + __node_pointer __p = __node_alloc_traits::allocate(__na, 1); + __p->__prev_ = nullptr; + return __hold_pointer(__p, __node_destructor(__na, 1)); + } + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + + bool __dereferenceable(const const_iterator* __i) const; + bool __decrementable(const const_iterator* __i) const; + bool __addable(const const_iterator* __i, ptrdiff_t __n) const; + bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; + +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + +private: + _LIBCUDACXX_INLINE_VISIBILITY + static void __link_nodes (__link_pointer __p, __link_pointer __f, __link_pointer __l); + _LIBCUDACXX_INLINE_VISIBILITY + void __link_nodes_at_front(__link_pointer __f, __link_pointer __l); + _LIBCUDACXX_INLINE_VISIBILITY + void __link_nodes_at_back (__link_pointer __f, __link_pointer __l); + iterator __iterator(size_type __n); + template + static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp); + + void __move_assign(list& __c, true_type) + noexcept(is_nothrow_move_assignable<__node_allocator>::value); + void __move_assign(list& __c, false_type); +}; + +#ifndef _LIBCUDACXX_HAS_NO_DEDUCTION_GUIDES +template::value_type>, + class = typename enable_if<__is_allocator<_Alloc>::value, void>::type + > +list(_InputIterator, _InputIterator) + -> list::value_type, _Alloc>; + +template::value, void>::type + > +list(_InputIterator, _InputIterator, _Alloc) + -> list::value_type, _Alloc>; +#endif + +// Link in nodes [__f, __l] just prior to __p +template +inline +void +list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l) +{ + __p->__prev_->__next_ = __f; + __f->__prev_ = __p->__prev_; + __p->__prev_ = __l; + __l->__next_ = __p; +} + +// Link in nodes [__f, __l] at the front of the list +template +inline +void +list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l) +{ + __f->__prev_ = base::__end_as_link(); + __l->__next_ = base::__end_.__next_; + __l->__next_->__prev_ = __l; + base::__end_.__next_ = __f; +} + +// Link in nodes [__f, __l] at the back of the list +template +inline +void +list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l) +{ + __l->__next_ = base::__end_as_link(); + __f->__prev_ = base::__end_.__prev_; + __f->__prev_->__next_ = __f; + base::__end_.__prev_ = __l; +} + + +template +inline +typename list<_Tp, _Alloc>::iterator +list<_Tp, _Alloc>::__iterator(size_type __n) +{ + return __n <= base::__sz() / 2 ? _CUDA_VSTD::next(begin(), __n) + : _CUDA_VSTD::prev(end(), base::__sz() - __n); +} + +template +list<_Tp, _Alloc>::list(size_type __n) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + for (; __n > 0; --__n) + emplace_back(); +} + +#if _LIBCUDACXX_STD_VER > 11 +template +list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + for (; __n > 0; --__n) + emplace_back(); +} +#endif + +template +list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + for (; __n > 0; --__n) + push_back(__x); +} + +template +list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_type& __a) + : base(__a) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + for (; __n > 0; --__n) + push_back(__x); +} + +template +template +list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, + typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + for (; __f != __l; ++__f) + __emplace_back(*__f); +} + +template +template +list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a, + typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) + : base(__a) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + for (; __f != __l; ++__f) + __emplace_back(*__f); +} + +template +list<_Tp, _Alloc>::list(const list& __c) + : base(__node_alloc_traits::select_on_container_copy_construction( + __c.__node_alloc())) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) + push_back(*__i); +} + +template +list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a) + : base(__a) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) + push_back(*__i); +} + +template +list<_Tp, _Alloc>::list(initializer_list __il, const allocator_type& __a) + : base(__a) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + for (typename initializer_list::const_iterator __i = __il.begin(), + __e = __il.end(); __i != __e; ++__i) + push_back(*__i); +} + +template +list<_Tp, _Alloc>::list(initializer_list __il) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + for (typename initializer_list::const_iterator __i = __il.begin(), + __e = __il.end(); __i != __e; ++__i) + push_back(*__i); +} + +template +inline list<_Tp, _Alloc>::list(list&& __c) + noexcept(is_nothrow_move_constructible<__node_allocator>::value) + : base(_CUDA_VSTD::move(__c.__node_alloc())) { +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + splice(end(), __c); +} + +template +inline +list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a) + : base(__a) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__insert_c(this); +#endif + if (__a == __c.get_allocator()) + splice(end(), __c); + else + { + typedef move_iterator _Ip; + assign(_Ip(__c.begin()), _Ip(__c.end())); + } +} + +template +inline +list<_Tp, _Alloc>& +list<_Tp, _Alloc>::operator=(list&& __c) + noexcept( + __node_alloc_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable<__node_allocator>::value) +{ + __move_assign(__c, integral_constant()); + return *this; +} + +template +void +list<_Tp, _Alloc>::__move_assign(list& __c, false_type) +{ + if (base::__node_alloc() != __c.__node_alloc()) + { + typedef move_iterator _Ip; + assign(_Ip(__c.begin()), _Ip(__c.end())); + } + else + __move_assign(__c, true_type()); +} + +template +void +list<_Tp, _Alloc>::__move_assign(list& __c, true_type) + noexcept(is_nothrow_move_assignable<__node_allocator>::value) +{ + clear(); + base::__move_assign_alloc(__c); + splice(end(), __c); +} + +template +inline +list<_Tp, _Alloc>& +list<_Tp, _Alloc>::operator=(const list& __c) +{ + if (this != &__c) + { + base::__copy_assign_alloc(__c); + assign(__c.begin(), __c.end()); + } + return *this; +} + +template +template +void +list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l, + typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) +{ + iterator __i = begin(); + iterator __e = end(); + for (; __f != __l && __i != __e; ++__f, (void)++__i) + *__i = *__f; + if (__i == __e) + insert(__e, __f, __l); + else + erase(__i, __e); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__invalidate_all(this); +#endif +} + +template +void +list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x) +{ + iterator __i = begin(); + iterator __e = end(); + for (; __n > 0 && __i != __e; --__n, ++__i) + *__i = __x; + if (__i == __e) + insert(__e, __n, __x); + else + erase(__i, __e); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __get_db()->__invalidate_all(this); +#endif +} + +template +inline +_Alloc +list<_Tp, _Alloc>::get_allocator() const noexcept +{ + return allocator_type(base::__node_alloc()); +} + +template +typename list<_Tp, _Alloc>::iterator +list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::insert(iterator, x) called with an iterator not" + " referring to this list"); +#endif + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), __x); + __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link()); + ++base::__sz(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(__hold.release()->__as_link(), this); +#else + return iterator(__hold.release()->__as_link()); +#endif +} + +template +typename list<_Tp, _Alloc>::iterator +list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::insert(iterator, n, x) called with an iterator not" + " referring to this list"); + iterator __r(__p.__ptr_, this); +#else + iterator __r(__p.__ptr_); +#endif + if (__n > 0) + { + size_type __ds = 0; + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), __x); + ++__ds; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __r = iterator(__hold->__as_link(), this); +#else + __r = iterator(__hold->__as_link()); +#endif + __hold.release(); + iterator __e = __r; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (--__n; __n != 0; --__n, ++__e, ++__ds) + { + __hold.reset(__node_alloc_traits::allocate(__na, 1)); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), __x); + __e.__ptr_->__next_ = __hold->__as_link(); + __hold->__prev_ = __e.__ptr_; + __hold.release(); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + while (true) + { + __node_alloc_traits::destroy(__na, _CUDA_VSTD::addressof(*__e)); + __link_pointer __prev = __e.__ptr_->__prev_; + __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); + if (__prev == 0) + break; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __e = iterator(__prev, this); +#else + __e = iterator(__prev); +#endif + } + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_); + base::__sz() += __ds; + } + return __r; +} + +template +template +typename list<_Tp, _Alloc>::iterator +list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, + typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::insert(iterator, range) called with an iterator not" + " referring to this list"); + iterator __r(__p.__ptr_, this); +#else + iterator __r(__p.__ptr_); +#endif + if (__f != __l) + { + size_type __ds = 0; + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), *__f); + ++__ds; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __r = iterator(__hold.get()->__as_link(), this); +#else + __r = iterator(__hold.get()->__as_link()); +#endif + __hold.release(); + iterator __e = __r; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (++__f; __f != __l; ++__f, (void) ++__e, (void) ++__ds) + { + __hold.reset(__node_alloc_traits::allocate(__na, 1)); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), *__f); + __e.__ptr_->__next_ = __hold.get()->__as_link(); + __hold->__prev_ = __e.__ptr_; + __hold.release(); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + while (true) + { + __node_alloc_traits::destroy(__na, _CUDA_VSTD::addressof(*__e)); + __link_pointer __prev = __e.__ptr_->__prev_; + __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); + if (__prev == 0) + break; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __e = iterator(__prev, this); +#else + __e = iterator(__prev); +#endif + } + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_); + base::__sz() += __ds; + } + return __r; +} + +template +void +list<_Tp, _Alloc>::push_front(const value_type& __x) +{ + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), __x); + __link_pointer __nl = __hold->__as_link(); + __link_nodes_at_front(__nl, __nl); + ++base::__sz(); + __hold.release(); +} + +template +void +list<_Tp, _Alloc>::push_back(const value_type& __x) +{ + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), __x); + __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link()); + ++base::__sz(); + __hold.release(); +} + +template +void +list<_Tp, _Alloc>::push_front(value_type&& __x) +{ + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), _CUDA_VSTD::move(__x)); + __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link()); + ++base::__sz(); + __hold.release(); +} + +template +void +list<_Tp, _Alloc>::push_back(value_type&& __x) +{ + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), _CUDA_VSTD::move(__x)); + __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link()); + ++base::__sz(); + __hold.release(); +} + +template +template +#if _LIBCUDACXX_STD_VER > 14 +typename list<_Tp, _Alloc>::reference +#else +void +#endif +list<_Tp, _Alloc>::emplace_front(_Args&&... __args) +{ + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), _CUDA_VSTD::forward<_Args>(__args)...); + __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link()); + ++base::__sz(); +#if _LIBCUDACXX_STD_VER > 14 + return __hold.release()->__value_; +#else + __hold.release(); +#endif +} + +template +template +#if _LIBCUDACXX_STD_VER > 14 +typename list<_Tp, _Alloc>::reference +#else +void +#endif +list<_Tp, _Alloc>::emplace_back(_Args&&... __args) +{ + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), _CUDA_VSTD::forward<_Args>(__args)...); + __link_pointer __nl = __hold->__as_link(); + __link_nodes_at_back(__nl, __nl); + ++base::__sz(); +#if _LIBCUDACXX_STD_VER > 14 + return __hold.release()->__value_; +#else + __hold.release(); +#endif +} + +template +template +typename list<_Tp, _Alloc>::iterator +list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::emplace(iterator, args...) called with an iterator not" + " referring to this list"); +#endif + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), _CUDA_VSTD::forward<_Args>(__args)...); + __link_pointer __nl = __hold.get()->__as_link(); + __link_nodes(__p.__ptr_, __nl, __nl); + ++base::__sz(); + __hold.release(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(__nl, this); +#else + return iterator(__nl); +#endif +} + +template +typename list<_Tp, _Alloc>::iterator +list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::insert(iterator, x) called with an iterator not" + " referring to this list"); +#endif + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), _CUDA_VSTD::move(__x)); + __link_pointer __nl = __hold->__as_link(); + __link_nodes(__p.__ptr_, __nl, __nl); + ++base::__sz(); + __hold.release(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(__nl, this); +#else + return iterator(__nl); +#endif +} + +template +void +list<_Tp, _Alloc>::pop_front() +{ + _LIBCUDACXX_ASSERT(!empty(), "list::pop_front() called with empty list"); + __node_allocator& __na = base::__node_alloc(); + __link_pointer __n = base::__end_.__next_; + base::__unlink_nodes(__n, __n); + --base::__sz(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __p = __c->end_; __p != __c->beg_; ) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == __n) + { + (*__p)->__c_ = nullptr; + if (--__c->end_ != __p) + memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif + __node_pointer __np = __n->__as_node(); + __node_alloc_traits::destroy(__na, _CUDA_VSTD::addressof(__np->__value_)); + __node_alloc_traits::deallocate(__na, __np, 1); +} + +template +void +list<_Tp, _Alloc>::pop_back() +{ + _LIBCUDACXX_ASSERT(!empty(), "list::pop_back() called with empty list"); + __node_allocator& __na = base::__node_alloc(); + __link_pointer __n = base::__end_.__prev_; + base::__unlink_nodes(__n, __n); + --base::__sz(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __p = __c->end_; __p != __c->beg_; ) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == __n) + { + (*__p)->__c_ = nullptr; + if (--__c->end_ != __p) + memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif + __node_pointer __np = __n->__as_node(); + __node_alloc_traits::destroy(__na, _CUDA_VSTD::addressof(__np->__value_)); + __node_alloc_traits::deallocate(__na, __np, 1); +} + +template +typename list<_Tp, _Alloc>::iterator +list<_Tp, _Alloc>::erase(const_iterator __p) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::erase(iterator) called with an iterator not" + " referring to this list"); +#endif + _LIBCUDACXX_ASSERT(__p != end(), + "list::erase(iterator) called with a non-dereferenceable iterator"); + __node_allocator& __na = base::__node_alloc(); + __link_pointer __n = __p.__ptr_; + __link_pointer __r = __n->__next_; + base::__unlink_nodes(__n, __n); + --base::__sz(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __ip = __c->end_; __ip != __c->beg_; ) + { + --__ip; + iterator* __i = static_cast((*__ip)->__i_); + if (__i->__ptr_ == __n) + { + (*__ip)->__c_ = nullptr; + if (--__c->end_ != __ip) + memmove(__ip, __ip+1, (__c->end_ - __ip)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif + __node_pointer __np = __n->__as_node(); + __node_alloc_traits::destroy(__na, _CUDA_VSTD::addressof(__np->__value_)); + __node_alloc_traits::deallocate(__na, __np, 1); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(__r, this); +#else + return iterator(__r); +#endif +} + +template +typename list<_Tp, _Alloc>::iterator +list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__f) == this, + "list::erase(iterator, iterator) called with an iterator not" + " referring to this list"); + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__l) == this, + "list::erase(iterator, iterator) called with an iterator not" + " referring to this list"); +#endif + if (__f != __l) + { + __node_allocator& __na = base::__node_alloc(); + base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_); + while (__f != __l) + { + __link_pointer __n = __f.__ptr_; + ++__f; + --base::__sz(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __c_node* __c = __get_db()->__find_c_and_lock(this); + for (__i_node** __p = __c->end_; __p != __c->beg_; ) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ == __n) + { + (*__p)->__c_ = nullptr; + if (--__c->end_ != __p) + memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); + } + } + __get_db()->unlock(); +#endif + __node_pointer __np = __n->__as_node(); + __node_alloc_traits::destroy(__na, _CUDA_VSTD::addressof(__np->__value_)); + __node_alloc_traits::deallocate(__na, __np, 1); + } + } +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + return iterator(__l.__ptr_, this); +#else + return iterator(__l.__ptr_); +#endif +} + +template +void +list<_Tp, _Alloc>::resize(size_type __n) +{ + if (__n < base::__sz()) + erase(__iterator(__n), end()); + else if (__n > base::__sz()) + { + __n -= base::__sz(); + size_type __ds = 0; + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_)); + ++__ds; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + iterator __r = iterator(__hold.release()->__as_link(), this); +#else + iterator __r = iterator(__hold.release()->__as_link()); +#endif + iterator __e = __r; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (--__n; __n != 0; --__n, ++__e, ++__ds) + { + __hold.reset(__node_alloc_traits::allocate(__na, 1)); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_)); + __e.__ptr_->__next_ = __hold.get()->__as_link(); + __hold->__prev_ = __e.__ptr_; + __hold.release(); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + while (true) + { + __node_alloc_traits::destroy(__na, _CUDA_VSTD::addressof(*__e)); + __link_pointer __prev = __e.__ptr_->__prev_; + __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); + if (__prev == 0) + break; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __e = iterator(__prev, this); +#else + __e = iterator(__prev); +#endif + } + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __link_nodes_at_back(__r.__ptr_, __e.__ptr_); + base::__sz() += __ds; + } +} + +template +void +list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) +{ + if (__n < base::__sz()) + erase(__iterator(__n), end()); + else if (__n > base::__sz()) + { + __n -= base::__sz(); + size_type __ds = 0; + __node_allocator& __na = base::__node_alloc(); + __hold_pointer __hold = __allocate_node(__na); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), __x); + ++__ds; + __link_pointer __nl = __hold.release()->__as_link(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + iterator __r = iterator(__nl, this); +#else + iterator __r = iterator(__nl); +#endif + iterator __e = __r; +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + try + { +#endif // _LIBCUDACXX_NO_EXCEPTIONS + for (--__n; __n != 0; --__n, ++__e, ++__ds) + { + __hold.reset(__node_alloc_traits::allocate(__na, 1)); + __node_alloc_traits::construct(__na, _CUDA_VSTD::addressof(__hold->__value_), __x); + __e.__ptr_->__next_ = __hold.get()->__as_link(); + __hold->__prev_ = __e.__ptr_; + __hold.release(); + } +#ifndef _LIBCUDACXX_NO_EXCEPTIONS + } + catch (...) + { + while (true) + { + __node_alloc_traits::destroy(__na, _CUDA_VSTD::addressof(*__e)); + __link_pointer __prev = __e.__ptr_->__prev_; + __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); + if (__prev == 0) + break; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __e = iterator(__prev, this); +#else + __e = iterator(__prev); +#endif + } + throw; + } +#endif // _LIBCUDACXX_NO_EXCEPTIONS + __link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_); + base::__sz() += __ds; + } +} + +template +void +list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) +{ + _LIBCUDACXX_ASSERT(this != &__c, + "list::splice(iterator, list) called with this == &list"); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::splice(iterator, list) called with an iterator not" + " referring to this list"); +#endif + if (!__c.empty()) + { + __link_pointer __f = __c.__end_.__next_; + __link_pointer __l = __c.__end_.__prev_; + base::__unlink_nodes(__f, __l); + __link_nodes(__p.__ptr_, __f, __l); + base::__sz() += __c.__sz(); + __c.__sz() = 0; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + if (&__c != this) { + __libcpp_db* __db = __get_db(); + __c_node* __cn1 = __db->__find_c_and_lock(this); + __c_node* __cn2 = __db->__find_c(&__c); + for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;) + { + --__ip; + iterator* __i = static_cast((*__ip)->__i_); + if (__i->__ptr_ != __c.__end_as_link()) + { + __cn1->__add(*__ip); + (*__ip)->__c_ = __cn1; + if (--__cn2->end_ != __ip) + memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); + } + } + __db->unlock(); + } +#endif + } +} + +template +void +list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::splice(iterator, list, iterator) called with first iterator not" + " referring to this list"); + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__i) == &__c, + "list::splice(iterator, list, iterator) called with second iterator not" + " referring to list argument"); + _LIBCUDACXX_ASSERT(__get_const_db()->__dereferenceable(&__i), + "list::splice(iterator, list, iterator) called with second iterator not" + " derefereceable"); +#endif + if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_) + { + __link_pointer __f = __i.__ptr_; + base::__unlink_nodes(__f, __f); + __link_nodes(__p.__ptr_, __f, __f); + --__c.__sz(); + ++base::__sz(); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + if (&__c != this) { + __libcpp_db* __db = __get_db(); + __c_node* __cn1 = __db->__find_c_and_lock(this); + __c_node* __cn2 = __db->__find_c(&__c); + for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;) + { + --__ip; + iterator* __j = static_cast((*__ip)->__i_); + if (__j->__ptr_ == __f) + { + __cn1->__add(*__ip); + (*__ip)->__c_ = __cn1; + if (--__cn2->end_ != __ip) + memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); + } + } + __db->unlock(); + } +#endif + } +} + +template +void +list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l) +{ +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "list::splice(iterator, list, iterator, iterator) called with first iterator not" + " referring to this list"); + _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__f) == &__c, + "list::splice(iterator, list, iterator, iterator) called with second iterator not" + " referring to list argument"); + if (this == &__c) + { + for (const_iterator __i = __f; __i != __l; ++__i) + _LIBCUDACXX_ASSERT(__i != __p, + "list::splice(iterator, list, iterator, iterator)" + " called with the first iterator within the range" + " of the second and third iterators"); + } +#endif + if (__f != __l) + { + __link_pointer __first = __f.__ptr_; + --__l; + __link_pointer __last = __l.__ptr_; + if (this != &__c) + { + size_type __s = _CUDA_VSTD::distance(__f, __l) + 1; + __c.__sz() -= __s; + base::__sz() += __s; + } + base::__unlink_nodes(__first, __last); + __link_nodes(__p.__ptr_, __first, __last); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + if (&__c != this) { + __libcpp_db* __db = __get_db(); + __c_node* __cn1 = __db->__find_c_and_lock(this); + __c_node* __cn2 = __db->__find_c(&__c); + for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;) + { + --__ip; + iterator* __j = static_cast((*__ip)->__i_); + for (__link_pointer __k = __f.__ptr_; + __k != __l.__ptr_; __k = __k->__next_) + { + if (__j->__ptr_ == __k) + { + __cn1->__add(*__ip); + (*__ip)->__c_ = __cn1; + if (--__cn2->end_ != __ip) + memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); + } + } + } + __db->unlock(); + } +#endif + } +} + +template +typename list<_Tp, _Alloc>::__remove_return_type +list<_Tp, _Alloc>::remove(const value_type& __x) +{ + list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing + for (const_iterator __i = begin(), __e = end(); __i != __e;) + { + if (*__i == __x) + { + const_iterator __j = _CUDA_VSTD::next(__i); + for (; __j != __e && *__j == __x; ++__j) + ; + __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j); + __i = __j; + if (__i != __e) + ++__i; + } + else + ++__i; + } + + return (__remove_return_type) __deleted_nodes.size(); +} + +template +template +typename list<_Tp, _Alloc>::__remove_return_type +list<_Tp, _Alloc>::remove_if(_Pred __pred) +{ + list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing + for (iterator __i = begin(), __e = end(); __i != __e;) + { + if (__pred(*__i)) + { + iterator __j = _CUDA_VSTD::next(__i); + for (; __j != __e && __pred(*__j); ++__j) + ; + __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j); + __i = __j; + if (__i != __e) + ++__i; + } + else + ++__i; + } + + return (__remove_return_type) __deleted_nodes.size(); +} + +template +template +typename list<_Tp, _Alloc>::__remove_return_type +list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred) +{ + list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing + for (iterator __i = begin(), __e = end(); __i != __e;) + { + iterator __j = _CUDA_VSTD::next(__i); + for (; __j != __e && __binary_pred(*__i, *__j); ++__j) + ; + if (++__i != __j) { + __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j); + __i = __j; + } + } + + return (__remove_return_type) __deleted_nodes.size(); +} + +template +inline +void +list<_Tp, _Alloc>::merge(list& __c) +{ + merge(__c, __less()); +} + +template +template +void +list<_Tp, _Alloc>::merge(list& __c, _Comp __comp) +{ + if (this != _CUDA_VSTD::addressof(__c)) + { + iterator __f1 = begin(); + iterator __e1 = end(); + iterator __f2 = __c.begin(); + iterator __e2 = __c.end(); + while (__f1 != __e1 && __f2 != __e2) + { + if (__comp(*__f2, *__f1)) + { + size_type __ds = 1; + iterator __m2 = _CUDA_VSTD::next(__f2); + for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, ++__ds) + ; + base::__sz() += __ds; + __c.__sz() -= __ds; + __link_pointer __f = __f2.__ptr_; + __link_pointer __l = __m2.__ptr_->__prev_; + __f2 = __m2; + base::__unlink_nodes(__f, __l); + __m2 = _CUDA_VSTD::next(__f1); + __link_nodes(__f1.__ptr_, __f, __l); + __f1 = __m2; + } + else + ++__f1; + } + splice(__e1, __c); +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + __libcpp_db* __db = __get_db(); + __c_node* __cn1 = __db->__find_c_and_lock(this); + __c_node* __cn2 = __db->__find_c(&__c); + for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;) + { + --__p; + iterator* __i = static_cast((*__p)->__i_); + if (__i->__ptr_ != __c.__end_as_link()) + { + __cn1->__add(*__p); + (*__p)->__c_ = __cn1; + if (--__cn2->end_ != __p) + memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); + } + } + __db->unlock(); +#endif + } +} + +template +inline +void +list<_Tp, _Alloc>::sort() +{ + sort(__less()); +} + +template +template +inline +void +list<_Tp, _Alloc>::sort(_Comp __comp) +{ + __sort(begin(), end(), base::__sz(), __comp); +} + +template +template +typename list<_Tp, _Alloc>::iterator +list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp) +{ + switch (__n) + { + case 0: + case 1: + return __f1; + case 2: + if (__comp(*--__e2, *__f1)) + { + __link_pointer __f = __e2.__ptr_; + base::__unlink_nodes(__f, __f); + __link_nodes(__f1.__ptr_, __f, __f); + return __e2; + } + return __f1; + } + size_type __n2 = __n / 2; + iterator __e1 = _CUDA_VSTD::next(__f1, __n2); + iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp); + iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp); + if (__comp(*__f2, *__f1)) + { + iterator __m2 = _CUDA_VSTD::next(__f2); + for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2) + ; + __link_pointer __f = __f2.__ptr_; + __link_pointer __l = __m2.__ptr_->__prev_; + __r = __f2; + __e1 = __f2 = __m2; + base::__unlink_nodes(__f, __l); + __m2 = _CUDA_VSTD::next(__f1); + __link_nodes(__f1.__ptr_, __f, __l); + __f1 = __m2; + } + else + ++__f1; + while (__f1 != __e1 && __f2 != __e2) + { + if (__comp(*__f2, *__f1)) + { + iterator __m2 = _CUDA_VSTD::next(__f2); + for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2) + ; + __link_pointer __f = __f2.__ptr_; + __link_pointer __l = __m2.__ptr_->__prev_; + if (__e1 == __f2) + __e1 = __m2; + __f2 = __m2; + base::__unlink_nodes(__f, __l); + __m2 = _CUDA_VSTD::next(__f1); + __link_nodes(__f1.__ptr_, __f, __l); + __f1 = __m2; + } + else + ++__f1; + } + return __r; +} + +template +void +list<_Tp, _Alloc>::reverse() noexcept +{ + if (base::__sz() > 1) + { + iterator __e = end(); + for (iterator __i = begin(); __i.__ptr_ != __e.__ptr_;) + { + _CUDA_VSTD::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_); + __i.__ptr_ = __i.__ptr_->__prev_; + } + _CUDA_VSTD::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_); + } +} + +template +bool +list<_Tp, _Alloc>::__invariants() const +{ + return size() == _CUDA_VSTD::distance(begin(), end()); +} + +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + +template +bool +list<_Tp, _Alloc>::__dereferenceable(const const_iterator* __i) const +{ + return __i->__ptr_ != this->__end_as_link(); +} + +template +bool +list<_Tp, _Alloc>::__decrementable(const const_iterator* __i) const +{ + return !empty() && __i->__ptr_ != base::__end_.__next_; +} + +template +bool +list<_Tp, _Alloc>::__addable(const const_iterator*, ptrdiff_t) const +{ + return false; +} + +template +bool +list<_Tp, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const +{ + return false; +} + +#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) +{ + return __x.size() == __y.size() && _CUDA_VSTD::equal(__x.begin(), __x.end(), __y.begin()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) +{ + return _CUDA_VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) +{ + return !(__x == __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) +{ + return __y < __x; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) +{ + return !(__x < __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) +{ + return !(__y < __x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) +{ + __x.swap(__y); +} + +#if _LIBCUDACXX_STD_VER > 17 +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void erase_if(list<_Tp, _Allocator>& __c, _Predicate __pred) +{ __c.remove_if(__pred); } + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void erase(list<_Tp, _Allocator>& __c, const _Up& __v) +{ _CUDA_VSTD::erase_if(__c, [&](auto& __elem) { return __elem == __v; }); } +#endif + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX_LIST diff --git a/cuda_toolkit/include/locale b/cuda_toolkit/include/locale new file mode 100644 index 0000000000000000000000000000000000000000..642c4c253ac7b3a154204e498751823284cdc002 --- /dev/null +++ b/cuda_toolkit/include/locale @@ -0,0 +1,4351 @@ +// -*- C++ -*- +//===-------------------------- locale ------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_LOCALE +#define _LIBCUDACXX_LOCALE + +/* + locale synopsis + +namespace std +{ + +class locale +{ +public: + // types: + class facet; + class id; + + typedef int category; + static const category // values assigned here are for exposition only + none = 0x000, + collate = 0x010, + ctype = 0x020, + monetary = 0x040, + numeric = 0x080, + time = 0x100, + messages = 0x200, + all = collate | ctype | monetary | numeric | time | messages; + + // construct/copy/destroy: + locale() noexcept; + locale(const locale& other) noexcept; + explicit locale(const char* std_name); + explicit locale(const string& std_name); + locale(const locale& other, const char* std_name, category); + locale(const locale& other, const string& std_name, category); + template locale(const locale& other, Facet* f); + locale(const locale& other, const locale& one, category); + + ~locale(); // not virtual + + const locale& operator=(const locale& other) noexcept; + + template locale combine(const locale& other) const; + + // locale operations: + basic_string name() const; + bool operator==(const locale& other) const; + bool operator!=(const locale& other) const; + template + bool operator()(const basic_string& s1, + const basic_string& s2) const; + + // global locale objects: + static locale global(const locale&); + static const locale& classic(); +}; + +template const Facet& use_facet(const locale&); +template bool has_facet(const locale&) noexcept; + +// 22.3.3, convenience interfaces: +template bool isspace (charT c, const locale& loc); +template bool isprint (charT c, const locale& loc); +template bool iscntrl (charT c, const locale& loc); +template bool isupper (charT c, const locale& loc); +template bool islower (charT c, const locale& loc); +template bool isalpha (charT c, const locale& loc); +template bool isdigit (charT c, const locale& loc); +template bool ispunct (charT c, const locale& loc); +template bool isxdigit(charT c, const locale& loc); +template bool isalnum (charT c, const locale& loc); +template bool isgraph (charT c, const locale& loc); +template charT toupper(charT c, const locale& loc); +template charT tolower(charT c, const locale& loc); + +template, + class Byte_alloc = allocator> +class wstring_convert +{ +public: + typedef basic_string, Byte_alloc> byte_string; + typedef basic_string, Wide_alloc> wide_string; + typedef typename Codecvt::state_type state_type; + typedef typename wide_string::traits_type::int_type int_type; + + explicit wstring_convert(Codecvt* pcvt = new Codecvt); // explicit in C++14 + wstring_convert(Codecvt* pcvt, state_type state); + explicit wstring_convert(const byte_string& byte_err, // explicit in C++14 + const wide_string& wide_err = wide_string()); + wstring_convert(const wstring_convert&) = delete; // C++14 + wstring_convert & operator=(const wstring_convert &) = delete; // C++14 + ~wstring_convert(); + + wide_string from_bytes(char byte); + wide_string from_bytes(const char* ptr); + wide_string from_bytes(const byte_string& str); + wide_string from_bytes(const char* first, const char* last); + + byte_string to_bytes(Elem wchar); + byte_string to_bytes(const Elem* wptr); + byte_string to_bytes(const wide_string& wstr); + byte_string to_bytes(const Elem* first, const Elem* last); + + size_t converted() const; // noexcept in C++14 + state_type state() const; +}; + +template > +class wbuffer_convert + : public basic_streambuf +{ +public: + typedef typename Tr::state_type state_type; + + explicit wbuffer_convert(streambuf* bytebuf = 0, Codecvt* pcvt = new Codecvt, + state_type state = state_type()); // explicit in C++14 + wbuffer_convert(const wbuffer_convert&) = delete; // C++14 + wbuffer_convert & operator=(const wbuffer_convert &) = delete; // C++14 + ~wbuffer_convert(); // C++14 + + streambuf* rdbuf() const; + streambuf* rdbuf(streambuf* bytebuf); + + state_type state() const; +}; + +// 22.4.1 and 22.4.1.3, ctype: +class ctype_base; +template class ctype; +template <> class ctype; // specialization +template class ctype_byname; +template <> class ctype_byname; // specialization + +class codecvt_base; +template class codecvt; +template class codecvt_byname; + +// 22.4.2 and 22.4.3, numeric: +template class num_get; +template class num_put; +template class numpunct; +template class numpunct_byname; + +// 22.4.4, col lation: +template class collate; +template class collate_byname; + +// 22.4.5, date and time: +class time_base; +template class time_get; +template class time_get_byname; +template class time_put; +template class time_put_byname; + +// 22.4.6, money: +class money_base; +template class money_get; +template class money_put; +template class moneypunct; +template class moneypunct_byname; + +// 22.4.7, message retrieval: +class messages_base; +template class messages; +template class messages_byname; + +} // std + +*/ + +#include <__config> +#include <__locale> +#include <__debug> +#include +#include +#include +#include +#include +#include +#include +#ifndef __APPLE__ +#include +#endif +#include +#include +#include +#ifdef _LIBCUDACXX_HAS_CATOPEN +#include +#endif + +#ifdef __APPLE__ +#include +#endif + +#ifdef _LIBCUDACXX_LOCALE__L_EXTENSIONS +#include <__bsd_locale_defaults.h> +#else +#include <__bsd_locale_fallbacks.h> +#endif + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_PUSH_MACROS +#include <__undef_macros> + + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +#if defined(__APPLE__) || defined(__FreeBSD__) +# define _LIBCUDACXX_GET_C_LOCALE 0 +#elif defined(__CloudABI__) || defined(__NetBSD__) +# define _LIBCUDACXX_GET_C_LOCALE LC_C_LOCALE +#else +# define _LIBCUDACXX_GET_C_LOCALE __cloc() + // Get the C locale object + _LIBCUDACXX_FUNC_VIS locale_t __cloc(); +#define __cloc_defined +#endif + +// __scan_keyword +// Scans [__b, __e) until a match is found in the basic_strings range +// [__kb, __ke) or until it can be shown that there is no match in [__kb, __ke). +// __b will be incremented (visibly), consuming CharT until a match is found +// or proved to not exist. A keyword may be "", in which will match anything. +// If one keyword is a prefix of another, and the next CharT in the input +// might match another keyword, the algorithm will attempt to find the longest +// matching keyword. If the longer matching keyword ends up not matching, then +// no keyword match is found. If no keyword match is found, __ke is returned +// and failbit is set in __err. +// Else an iterator pointing to the matching keyword is found. If more than +// one keyword matches, an iterator to the first matching keyword is returned. +// If on exit __b == __e, eofbit is set in __err. If __case_sensitive is false, +// __ct is used to force to lower case before comparing characters. +// Examples: +// Keywords: "a", "abb" +// If the input is "a", the first keyword matches and eofbit is set. +// If the input is "abc", no match is found and "ab" are consumed. +template +_LIBCUDACXX_HIDDEN +_ForwardIterator +__scan_keyword(_InputIterator& __b, _InputIterator __e, + _ForwardIterator __kb, _ForwardIterator __ke, + const _Ctype& __ct, ios_base::iostate& __err, + bool __case_sensitive = true) +{ + typedef typename iterator_traits<_InputIterator>::value_type _CharT; + size_t __nkw = static_cast(_CUDA_VSTD::distance(__kb, __ke)); + const unsigned char __doesnt_match = '\0'; + const unsigned char __might_match = '\1'; + const unsigned char __does_match = '\2'; + unsigned char __statbuf[100]; + unsigned char* __status = __statbuf; + unique_ptr __stat_hold(0, free); + if (__nkw > sizeof(__statbuf)) + { + __status = (unsigned char*)malloc(__nkw); + if (__status == 0) + __throw_bad_alloc(); + __stat_hold.reset(__status); + } + size_t __n_might_match = __nkw; // At this point, any keyword might match + size_t __n_does_match = 0; // but none of them definitely do + // Initialize all statuses to __might_match, except for "" keywords are __does_match + unsigned char* __st = __status; + for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st) + { + if (!__ky->empty()) + *__st = __might_match; + else + { + *__st = __does_match; + --__n_might_match; + ++__n_does_match; + } + } + // While there might be a match, test keywords against the next CharT + for (size_t __indx = 0; __b != __e && __n_might_match > 0; ++__indx) + { + // Peek at the next CharT but don't consume it + _CharT __c = *__b; + if (!__case_sensitive) + __c = __ct.toupper(__c); + bool __consume = false; + // For each keyword which might match, see if the __indx character is __c + // If a match if found, consume __c + // If a match is found, and that is the last character in the keyword, + // then that keyword matches. + // If the keyword doesn't match this character, then change the keyword + // to doesn't match + __st = __status; + for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st) + { + if (*__st == __might_match) + { + _CharT __kc = (*__ky)[__indx]; + if (!__case_sensitive) + __kc = __ct.toupper(__kc); + if (__c == __kc) + { + __consume = true; + if (__ky->size() == __indx+1) + { + *__st = __does_match; + --__n_might_match; + ++__n_does_match; + } + } + else + { + *__st = __doesnt_match; + --__n_might_match; + } + } + } + // consume if we matched a character + if (__consume) + { + ++__b; + // If we consumed a character and there might be a matched keyword that + // was marked matched on a previous iteration, then such keywords + // which are now marked as not matching. + if (__n_might_match + __n_does_match > 1) + { + __st = __status; + for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st) + { + if (*__st == __does_match && __ky->size() != __indx+1) + { + *__st = __doesnt_match; + --__n_does_match; + } + } + } + } + } + // We've exited the loop because we hit eof and/or we have no more "might matches". + if (__b == __e) + __err |= ios_base::eofbit; + // Return the first matching result + for (__st = __status; __kb != __ke; ++__kb, (void) ++__st) + if (*__st == __does_match) + break; + if (__kb == __ke) + __err |= ios_base::failbit; + return __kb; +} + +struct _LIBCUDACXX_TYPE_VIS __num_get_base +{ + static const int __num_get_buf_sz = 40; + + static int __get_base(ios_base&); + static const char __src[33]; +}; + +_LIBCUDACXX_FUNC_VIS +void __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, + ios_base::iostate& __err); + +template +struct __num_get + : protected __num_get_base +{ + static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, + _CharT& __thousands_sep); + + static int __stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp, + char* __a, char*& __a_end, + _CharT __decimal_point, _CharT __thousands_sep, + const string& __grouping, unsigned* __g, + unsigned*& __g_end, unsigned& __dc, _CharT* __atoms); +#ifndef _LIBCUDACXX_ABI_OPTIMIZED_LOCALE_NUM_GET + static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep); + static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, + unsigned& __dc, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, _CharT* __atoms); + +#else + static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep) + { + locale __loc = __iob.getloc(); + const numpunct<_CharT>& __np = use_facet >(__loc); + __thousands_sep = __np.thousands_sep(); + return __np.grouping(); + } + + const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const + { + return __do_widen_p(__iob, __atoms); + } + + + static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, + unsigned& __dc, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, const _CharT* __atoms); +private: + template + const T* __do_widen_p(ios_base& __iob, T* __atoms) const + { + locale __loc = __iob.getloc(); + use_facet >(__loc).widen(__src, __src + 26, __atoms); + return __atoms; + } + + const char* __do_widen_p(ios_base& __iob, char* __atoms) const + { + (void)__iob; + (void)__atoms; + return __src; + } +#endif +}; + +#ifndef _LIBCUDACXX_ABI_OPTIMIZED_LOCALE_NUM_GET +template +string +__num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep) +{ + locale __loc = __iob.getloc(); + use_facet >(__loc).widen(__src, __src + 26, __atoms); + const numpunct<_CharT>& __np = use_facet >(__loc); + __thousands_sep = __np.thousands_sep(); + return __np.grouping(); +} +#endif + +template +string +__num_get<_CharT>::__stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, + _CharT& __thousands_sep) +{ + locale __loc = __iob.getloc(); + use_facet >(__loc).widen(__src, __src + 32, __atoms); + const numpunct<_CharT>& __np = use_facet >(__loc); + __decimal_point = __np.decimal_point(); + __thousands_sep = __np.thousands_sep(); + return __np.grouping(); +} + +template +int +#ifndef _LIBCUDACXX_ABI_OPTIMIZED_LOCALE_NUM_GET +__num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, + unsigned& __dc, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, _CharT* __atoms) +#else +__num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, + unsigned& __dc, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, const _CharT* __atoms) + +#endif +{ + if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25])) + { + *__a_end++ = __ct == __atoms[24] ? '+' : '-'; + __dc = 0; + return 0; + } + if (__grouping.size() != 0 && __ct == __thousands_sep) + { + if (__g_end-__g < __num_get_buf_sz) + { + *__g_end++ = __dc; + __dc = 0; + } + return 0; + } + ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms; + if (__f >= 24) + return -1; + switch (__base) + { + case 8: + case 10: + if (__f >= __base) + return -1; + break; + case 16: + if (__f < 22) + break; + if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0') + { + __dc = 0; + *__a_end++ = __src[__f]; + return 0; + } + return -1; + } + *__a_end++ = __src[__f]; + ++__dc; + return 0; +} + +template +int +__num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp, char* __a, char*& __a_end, + _CharT __decimal_point, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, unsigned& __dc, _CharT* __atoms) +{ + if (__ct == __decimal_point) + { + if (!__in_units) + return -1; + __in_units = false; + *__a_end++ = '.'; + if (__grouping.size() != 0 && __g_end-__g < __num_get_buf_sz) + *__g_end++ = __dc; + return 0; + } + if (__ct == __thousands_sep && __grouping.size() != 0) + { + if (!__in_units) + return -1; + if (__g_end-__g < __num_get_buf_sz) + { + *__g_end++ = __dc; + __dc = 0; + } + return 0; + } + ptrdiff_t __f = find(__atoms, __atoms + 32, __ct) - __atoms; + if (__f >= 32) + return -1; + char __x = __src[__f]; + if (__x == '-' || __x == '+') + { + if (__a_end == __a || (__a_end[-1] & 0x5F) == (__exp & 0x7F)) + { + *__a_end++ = __x; + return 0; + } + return -1; + } + if (__x == 'x' || __x == 'X') + __exp = 'P'; + else if ((__x & 0x5F) == __exp) + { + __exp |= (char) 0x80; + if (__in_units) + { + __in_units = false; + if (__grouping.size() != 0 && __g_end-__g < __num_get_buf_sz) + *__g_end++ = __dc; + } + } + *__a_end++ = __x; + if (__f >= 22) + return 0; + ++__dc; + return 0; +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(struct _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS __num_get) +_LIBCUDACXX_EXTERN_TEMPLATE2(struct _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS __num_get) + +template > +class _LIBCUDACXX_TEMPLATE_VIS num_get + : public locale::facet, + private __num_get<_CharT> +{ +public: + typedef _CharT char_type; + typedef _InputIterator iter_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit num_get(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, bool& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, long& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, long long& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, unsigned short& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, unsigned int& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, unsigned long& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, unsigned long long& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, float& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, double& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, long double& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, void*& __v) const + { + return do_get(__b, __e, __iob, __err, __v); + } + + static locale::id id; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~num_get() {} + + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + iter_type __do_get_floating_point + (iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, _Fp& __v) const; + + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + iter_type __do_get_signed + (iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, _Signed& __v) const; + + template + _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + iter_type __do_get_unsigned + (iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, _Unsigned& __v) const; + + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, bool& __v) const; + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, long& __v) const + { return this->__do_get_signed ( __b, __e, __iob, __err, __v ); } + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, long long& __v) const + { return this->__do_get_signed ( __b, __e, __iob, __err, __v ); } + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, unsigned short& __v) const + { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); } + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, unsigned int& __v) const + { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); } + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, unsigned long& __v) const + { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); } + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, unsigned long long& __v) const + { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); } + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, float& __v) const + { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); } + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, double& __v) const + { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); } + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, long double& __v) const + { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); } + + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, void*& __v) const; +}; + +template +locale::id +num_get<_CharT, _InputIterator>::id; + +template +_LIBCUDACXX_HIDDEN _Tp +__num_get_signed_integral(const char* __a, const char* __a_end, + ios_base::iostate& __err, int __base) +{ + if (__a != __a_end) + { + typename remove_reference::type __save_errno = errno; + errno = 0; + char *__p2; + long long __ll = strtoll_l(__a, &__p2, __base, _LIBCUDACXX_GET_C_LOCALE); + typename remove_reference::type __current_errno = errno; + if (__current_errno == 0) + errno = __save_errno; + if (__p2 != __a_end) + { + __err = ios_base::failbit; + return 0; + } + else if (__current_errno == ERANGE || + __ll < numeric_limits<_Tp>::min() || + numeric_limits<_Tp>::max() < __ll) + { + __err = ios_base::failbit; + if (__ll > 0) + return numeric_limits<_Tp>::max(); + else + return numeric_limits<_Tp>::min(); + } + return static_cast<_Tp>(__ll); + } + __err = ios_base::failbit; + return 0; +} + +template +_LIBCUDACXX_HIDDEN _Tp +__num_get_unsigned_integral(const char* __a, const char* __a_end, + ios_base::iostate& __err, int __base) +{ + if (__a != __a_end) + { + const bool __negate = *__a == '-'; + if (__negate && ++__a == __a_end) { + __err = ios_base::failbit; + return 0; + } + typename remove_reference::type __save_errno = errno; + errno = 0; + char *__p2; + unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCUDACXX_GET_C_LOCALE); + typename remove_reference::type __current_errno = errno; + if (__current_errno == 0) + errno = __save_errno; + if (__p2 != __a_end) + { + __err = ios_base::failbit; + return 0; + } + else if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll) + { + __err = ios_base::failbit; + return numeric_limits<_Tp>::max(); + } + _Tp __res = static_cast<_Tp>(__ll); + if (__negate) __res = -__res; + return __res; + } + __err = ios_base::failbit; + return 0; +} + +template +_LIBCUDACXX_INLINE_VISIBILITY +_Tp __do_strtod(const char* __a, char** __p2); + +template <> +inline _LIBCUDACXX_INLINE_VISIBILITY +float __do_strtod(const char* __a, char** __p2) { + return strtof_l(__a, __p2, _LIBCUDACXX_GET_C_LOCALE); +} + +template <> +inline _LIBCUDACXX_INLINE_VISIBILITY +double __do_strtod(const char* __a, char** __p2) { + return strtod_l(__a, __p2, _LIBCUDACXX_GET_C_LOCALE); +} + +template <> +inline _LIBCUDACXX_INLINE_VISIBILITY +long double __do_strtod(const char* __a, char** __p2) { + return strtold_l(__a, __p2, _LIBCUDACXX_GET_C_LOCALE); +} + +template +_LIBCUDACXX_HIDDEN +_Tp +__num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err) +{ + if (__a != __a_end) + { + typename remove_reference::type __save_errno = errno; + errno = 0; + char *__p2; + _Tp __ld = __do_strtod<_Tp>(__a, &__p2); + typename remove_reference::type __current_errno = errno; + if (__current_errno == 0) + errno = __save_errno; + if (__p2 != __a_end) + { + __err = ios_base::failbit; + return 0; + } + else if (__current_errno == ERANGE) + __err = ios_base::failbit; + return __ld; + } + __err = ios_base::failbit; + return 0; +} + +template +_InputIterator +num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, + bool& __v) const +{ + if ((__iob.flags() & ios_base::boolalpha) == 0) + { + long __lv = -1; + __b = do_get(__b, __e, __iob, __err, __lv); + switch (__lv) + { + case 0: + __v = false; + break; + case 1: + __v = true; + break; + default: + __v = true; + __err = ios_base::failbit; + break; + } + return __b; + } + const ctype<_CharT>& __ct = use_facet >(__iob.getloc()); + const numpunct<_CharT>& __np = use_facet >(__iob.getloc()); + typedef typename numpunct<_CharT>::string_type string_type; + const string_type __names[2] = {__np.truename(), __np.falsename()}; + const string_type* __i = __scan_keyword(__b, __e, __names, __names+2, + __ct, __err); + __v = __i == __names; + return __b; +} + +// signed + +template +template +_InputIterator +num_get<_CharT, _InputIterator>::__do_get_signed(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, + _Signed& __v) const +{ + // Stage 1 + int __base = this->__get_base(__iob); + // Stage 2 + char_type __thousands_sep; + const int __atoms_size = 26; +#ifdef _LIBCUDACXX_ABI_OPTIMIZED_LOCALE_NUM_GET + char_type __atoms1[__atoms_size]; + const char_type *__atoms = this->__do_widen(__iob, __atoms1); + string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); +#else + char_type __atoms[__atoms_size]; + string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep); +#endif + string __buf; + __buf.resize(__buf.capacity()); + char* __a = &__buf[0]; + char* __a_end = __a; + unsigned __g[__num_get_base::__num_get_buf_sz]; + unsigned* __g_end = __g; + unsigned __dc = 0; + for (; __b != __e; ++__b) + { + if (__a_end == __a + __buf.size()) + { + size_t __tmp = __buf.size(); + __buf.resize(2*__buf.size()); + __buf.resize(__buf.capacity()); + __a = &__buf[0]; + __a_end = __a + __tmp; + } + if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, + __thousands_sep, __grouping, __g, __g_end, + __atoms)) + break; + } + if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz) + *__g_end++ = __dc; + // Stage 3 + __v = __num_get_signed_integral<_Signed>(__a, __a_end, __err, __base); + // Digit grouping checked + __check_grouping(__grouping, __g, __g_end, __err); + // EOF checked + if (__b == __e) + __err |= ios_base::eofbit; + return __b; +} + +// unsigned + +template +template +_InputIterator +num_get<_CharT, _InputIterator>::__do_get_unsigned(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, + _Unsigned& __v) const +{ + // Stage 1 + int __base = this->__get_base(__iob); + // Stage 2 + char_type __thousands_sep; + const int __atoms_size = 26; +#ifdef _LIBCUDACXX_ABI_OPTIMIZED_LOCALE_NUM_GET + char_type __atoms1[__atoms_size]; + const char_type *__atoms = this->__do_widen(__iob, __atoms1); + string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); +#else + char_type __atoms[__atoms_size]; + string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep); +#endif + string __buf; + __buf.resize(__buf.capacity()); + char* __a = &__buf[0]; + char* __a_end = __a; + unsigned __g[__num_get_base::__num_get_buf_sz]; + unsigned* __g_end = __g; + unsigned __dc = 0; + for (; __b != __e; ++__b) + { + if (__a_end == __a + __buf.size()) + { + size_t __tmp = __buf.size(); + __buf.resize(2*__buf.size()); + __buf.resize(__buf.capacity()); + __a = &__buf[0]; + __a_end = __a + __tmp; + } + if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, + __thousands_sep, __grouping, __g, __g_end, + __atoms)) + break; + } + if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz) + *__g_end++ = __dc; + // Stage 3 + __v = __num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base); + // Digit grouping checked + __check_grouping(__grouping, __g, __g_end, __err); + // EOF checked + if (__b == __e) + __err |= ios_base::eofbit; + return __b; +} + +// floating point + +template +template +_InputIterator +num_get<_CharT, _InputIterator>::__do_get_floating_point(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, + _Fp& __v) const +{ + // Stage 1, nothing to do + // Stage 2 + char_type __atoms[32]; + char_type __decimal_point; + char_type __thousands_sep; + string __grouping = this->__stage2_float_prep(__iob, __atoms, + __decimal_point, + __thousands_sep); + string __buf; + __buf.resize(__buf.capacity()); + char* __a = &__buf[0]; + char* __a_end = __a; + unsigned __g[__num_get_base::__num_get_buf_sz]; + unsigned* __g_end = __g; + unsigned __dc = 0; + bool __in_units = true; + char __exp = 'E'; + for (; __b != __e; ++__b) + { + if (__a_end == __a + __buf.size()) + { + size_t __tmp = __buf.size(); + __buf.resize(2*__buf.size()); + __buf.resize(__buf.capacity()); + __a = &__buf[0]; + __a_end = __a + __tmp; + } + if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end, + __decimal_point, __thousands_sep, + __grouping, __g, __g_end, + __dc, __atoms)) + break; + } + if (__grouping.size() != 0 && __in_units && __g_end-__g < __num_get_base::__num_get_buf_sz) + *__g_end++ = __dc; + // Stage 3 + __v = __num_get_float<_Fp>(__a, __a_end, __err); + // Digit grouping checked + __check_grouping(__grouping, __g, __g_end, __err); + // EOF checked + if (__b == __e) + __err |= ios_base::eofbit; + return __b; +} + +template +_InputIterator +num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, + void*& __v) const +{ + // Stage 1 + int __base = 16; + // Stage 2 + char_type __atoms[26]; + char_type __thousands_sep = 0; + string __grouping; + use_facet >(__iob.getloc()).widen(__num_get_base::__src, + __num_get_base::__src + 26, __atoms); + string __buf; + __buf.resize(__buf.capacity()); + char* __a = &__buf[0]; + char* __a_end = __a; + unsigned __g[__num_get_base::__num_get_buf_sz]; + unsigned* __g_end = __g; + unsigned __dc = 0; + for (; __b != __e; ++__b) + { + if (__a_end == __a + __buf.size()) + { + size_t __tmp = __buf.size(); + __buf.resize(2*__buf.size()); + __buf.resize(__buf.capacity()); + __a = &__buf[0]; + __a_end = __a + __tmp; + } + if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, + __thousands_sep, __grouping, + __g, __g_end, __atoms)) + break; + } + // Stage 3 + __buf.resize(__a_end - __a); + if (__libcpp_sscanf_l(__buf.c_str(), _LIBCUDACXX_GET_C_LOCALE, "%p", &__v) != 1) + __err = ios_base::failbit; + // EOF checked + if (__b == __e) + __err |= ios_base::eofbit; + return __b; +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS num_get) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS num_get) + +struct _LIBCUDACXX_TYPE_VIS __num_put_base +{ +protected: + static void __format_int(char* __fmt, const char* __len, bool __signd, + ios_base::fmtflags __flags); + static bool __format_float(char* __fmt, const char* __len, + ios_base::fmtflags __flags); + static char* __identify_padding(char* __nb, char* __ne, + const ios_base& __iob); +}; + +template +struct __num_put + : protected __num_put_base +{ + static void __widen_and_group_int(char* __nb, char* __np, char* __ne, + _CharT* __ob, _CharT*& __op, _CharT*& __oe, + const locale& __loc); + static void __widen_and_group_float(char* __nb, char* __np, char* __ne, + _CharT* __ob, _CharT*& __op, _CharT*& __oe, + const locale& __loc); +}; + +template +void +__num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne, + _CharT* __ob, _CharT*& __op, _CharT*& __oe, + const locale& __loc) +{ + const ctype<_CharT>& __ct = use_facet > (__loc); + const numpunct<_CharT>& __npt = use_facet >(__loc); + string __grouping = __npt.grouping(); + if (__grouping.empty()) + { + __ct.widen(__nb, __ne, __ob); + __oe = __ob + (__ne - __nb); + } + else + { + __oe = __ob; + char* __nf = __nb; + if (*__nf == '-' || *__nf == '+') + *__oe++ = __ct.widen(*__nf++); + if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' || + __nf[1] == 'X')) + { + *__oe++ = __ct.widen(*__nf++); + *__oe++ = __ct.widen(*__nf++); + } + reverse(__nf, __ne); + _CharT __thousands_sep = __npt.thousands_sep(); + unsigned __dc = 0; + unsigned __dg = 0; + for (char* __p = __nf; __p < __ne; ++__p) + { + if (static_cast(__grouping[__dg]) > 0 && + __dc == static_cast(__grouping[__dg])) + { + *__oe++ = __thousands_sep; + __dc = 0; + if (__dg < __grouping.size()-1) + ++__dg; + } + *__oe++ = __ct.widen(*__p); + ++__dc; + } + reverse(__ob + (__nf - __nb), __oe); + } + if (__np == __ne) + __op = __oe; + else + __op = __ob + (__np - __nb); +} + +template +void +__num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, + _CharT* __ob, _CharT*& __op, _CharT*& __oe, + const locale& __loc) +{ + const ctype<_CharT>& __ct = use_facet > (__loc); + const numpunct<_CharT>& __npt = use_facet >(__loc); + string __grouping = __npt.grouping(); + __oe = __ob; + char* __nf = __nb; + if (*__nf == '-' || *__nf == '+') + *__oe++ = __ct.widen(*__nf++); + char* __ns; + if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' || + __nf[1] == 'X')) + { + *__oe++ = __ct.widen(*__nf++); + *__oe++ = __ct.widen(*__nf++); + for (__ns = __nf; __ns < __ne; ++__ns) + if (!isxdigit_l(*__ns, _LIBCUDACXX_GET_C_LOCALE)) + break; + } + else + { + for (__ns = __nf; __ns < __ne; ++__ns) + if (!isdigit_l(*__ns, _LIBCUDACXX_GET_C_LOCALE)) + break; + } + if (__grouping.empty()) + { + __ct.widen(__nf, __ns, __oe); + __oe += __ns - __nf; + } + else + { + reverse(__nf, __ns); + _CharT __thousands_sep = __npt.thousands_sep(); + unsigned __dc = 0; + unsigned __dg = 0; + for (char* __p = __nf; __p < __ns; ++__p) + { + if (__grouping[__dg] > 0 && __dc == static_cast(__grouping[__dg])) + { + *__oe++ = __thousands_sep; + __dc = 0; + if (__dg < __grouping.size()-1) + ++__dg; + } + *__oe++ = __ct.widen(*__p); + ++__dc; + } + reverse(__ob + (__nf - __nb), __oe); + } + for (__nf = __ns; __nf < __ne; ++__nf) + { + if (*__nf == '.') + { + *__oe++ = __npt.decimal_point(); + ++__nf; + break; + } + else + *__oe++ = __ct.widen(*__nf); + } + __ct.widen(__nf, __ne, __oe); + __oe += __ne - __nf; + if (__np == __ne) + __op = __oe; + else + __op = __ob + (__np - __nb); +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(struct _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS __num_put) +_LIBCUDACXX_EXTERN_TEMPLATE2(struct _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS __num_put) + +template > +class _LIBCUDACXX_TEMPLATE_VIS num_put + : public locale::facet, + private __num_put<_CharT> +{ +public: + typedef _CharT char_type; + typedef _OutputIterator iter_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit num_put(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, ios_base& __iob, char_type __fl, + bool __v) const + { + return do_put(__s, __iob, __fl, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, ios_base& __iob, char_type __fl, + long __v) const + { + return do_put(__s, __iob, __fl, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, ios_base& __iob, char_type __fl, + long long __v) const + { + return do_put(__s, __iob, __fl, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, ios_base& __iob, char_type __fl, + unsigned long __v) const + { + return do_put(__s, __iob, __fl, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, ios_base& __iob, char_type __fl, + unsigned long long __v) const + { + return do_put(__s, __iob, __fl, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, ios_base& __iob, char_type __fl, + double __v) const + { + return do_put(__s, __iob, __fl, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, ios_base& __iob, char_type __fl, + long double __v) const + { + return do_put(__s, __iob, __fl, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, ios_base& __iob, char_type __fl, + const void* __v) const + { + return do_put(__s, __iob, __fl, __v); + } + + static locale::id id; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~num_put() {} + + virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, + bool __v) const; + virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, + long __v) const; + virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, + long long __v) const; + virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, + unsigned long) const; + virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, + unsigned long long) const; + virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, + double __v) const; + virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, + long double __v) const; + virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, + const void* __v) const; +}; + +template +locale::id +num_put<_CharT, _OutputIterator>::id; + +template +_LIBCUDACXX_HIDDEN +_OutputIterator +__pad_and_output(_OutputIterator __s, + const _CharT* __ob, const _CharT* __op, const _CharT* __oe, + ios_base& __iob, _CharT __fl) +{ + streamsize __sz = __oe - __ob; + streamsize __ns = __iob.width(); + if (__ns > __sz) + __ns -= __sz; + else + __ns = 0; + for (;__ob < __op; ++__ob, ++__s) + *__s = *__ob; + for (; __ns; --__ns, ++__s) + *__s = __fl; + for (; __ob < __oe; ++__ob, ++__s) + *__s = *__ob; + __iob.width(0); + return __s; +} + +template +_LIBCUDACXX_HIDDEN +ostreambuf_iterator<_CharT, _Traits> +__pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s, + const _CharT* __ob, const _CharT* __op, const _CharT* __oe, + ios_base& __iob, _CharT __fl) +{ + if (__s.__sbuf_ == nullptr) + return __s; + streamsize __sz = __oe - __ob; + streamsize __ns = __iob.width(); + if (__ns > __sz) + __ns -= __sz; + else + __ns = 0; + streamsize __np = __op - __ob; + if (__np > 0) + { + if (__s.__sbuf_->sputn(__ob, __np) != __np) + { + __s.__sbuf_ = nullptr; + return __s; + } + } + if (__ns > 0) + { + basic_string<_CharT, _Traits> __sp(__ns, __fl); + if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns) + { + __s.__sbuf_ = nullptr; + return __s; + } + } + __np = __oe - __op; + if (__np > 0) + { + if (__s.__sbuf_->sputn(__op, __np) != __np) + { + __s.__sbuf_ = nullptr; + return __s; + } + } + __iob.width(0); + return __s; +} + +template +_OutputIterator +num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + char_type __fl, bool __v) const +{ + if ((__iob.flags() & ios_base::boolalpha) == 0) + return do_put(__s, __iob, __fl, (unsigned long)__v); + const numpunct& __np = use_facet >(__iob.getloc()); + typedef typename numpunct::string_type string_type; +#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE + string_type __tmp(__v ? __np.truename() : __np.falsename()); + string_type __nm = _CUDA_VSTD::move(__tmp); +#else + string_type __nm = __v ? __np.truename() : __np.falsename(); +#endif + for (typename string_type::iterator __i = __nm.begin(); __i != __nm.end(); ++__i, ++__s) + *__s = *__i; + return __s; +} + +template +_OutputIterator +num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + char_type __fl, long __v) const +{ + // Stage 1 - Get number in narrow char + char __fmt[6] = {'%', 0}; + const char* __len = "l"; + this->__format_int(__fmt+1, __len, true, __iob.flags()); + const unsigned __nbuf = (numeric_limits::digits / 3) + + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + + 2; + char __nar[__nbuf]; + int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCUDACXX_GET_C_LOCALE, __fmt, __v); + char* __ne = __nar + __nc; + char* __np = this->__identify_padding(__nar, __ne, __iob); + // Stage 2 - Widen __nar while adding thousands separators + char_type __o[2*(__nbuf-1) - 1]; + char_type* __op; // pad here + char_type* __oe; // end of output + this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); + // [__o, __oe) contains thousands_sep'd wide number + // Stage 3 & 4 + return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); +} + +template +_OutputIterator +num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + char_type __fl, long long __v) const +{ + // Stage 1 - Get number in narrow char + char __fmt[8] = {'%', 0}; + const char* __len = "ll"; + this->__format_int(__fmt+1, __len, true, __iob.flags()); + const unsigned __nbuf = (numeric_limits::digits / 3) + + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + + 2; + char __nar[__nbuf]; + int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCUDACXX_GET_C_LOCALE, __fmt, __v); + char* __ne = __nar + __nc; + char* __np = this->__identify_padding(__nar, __ne, __iob); + // Stage 2 - Widen __nar while adding thousands separators + char_type __o[2*(__nbuf-1) - 1]; + char_type* __op; // pad here + char_type* __oe; // end of output + this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); + // [__o, __oe) contains thousands_sep'd wide number + // Stage 3 & 4 + return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); +} + +template +_OutputIterator +num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + char_type __fl, unsigned long __v) const +{ + // Stage 1 - Get number in narrow char + char __fmt[6] = {'%', 0}; + const char* __len = "l"; + this->__format_int(__fmt+1, __len, false, __iob.flags()); + const unsigned __nbuf = (numeric_limits::digits / 3) + + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + + 1; + char __nar[__nbuf]; + int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCUDACXX_GET_C_LOCALE, __fmt, __v); + char* __ne = __nar + __nc; + char* __np = this->__identify_padding(__nar, __ne, __iob); + // Stage 2 - Widen __nar while adding thousands separators + char_type __o[2*(__nbuf-1) - 1]; + char_type* __op; // pad here + char_type* __oe; // end of output + this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); + // [__o, __oe) contains thousands_sep'd wide number + // Stage 3 & 4 + return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); +} + +template +_OutputIterator +num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + char_type __fl, unsigned long long __v) const +{ + // Stage 1 - Get number in narrow char + char __fmt[8] = {'%', 0}; + const char* __len = "ll"; + this->__format_int(__fmt+1, __len, false, __iob.flags()); + const unsigned __nbuf = (numeric_limits::digits / 3) + + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + + 1; + char __nar[__nbuf]; + int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCUDACXX_GET_C_LOCALE, __fmt, __v); + char* __ne = __nar + __nc; + char* __np = this->__identify_padding(__nar, __ne, __iob); + // Stage 2 - Widen __nar while adding thousands separators + char_type __o[2*(__nbuf-1) - 1]; + char_type* __op; // pad here + char_type* __oe; // end of output + this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); + // [__o, __oe) contains thousands_sep'd wide number + // Stage 3 & 4 + return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); +} + +template +_OutputIterator +num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + char_type __fl, double __v) const +{ + // Stage 1 - Get number in narrow char + char __fmt[8] = {'%', 0}; + const char* __len = ""; + bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags()); + const unsigned __nbuf = 30; + char __nar[__nbuf]; + char* __nb = __nar; + int __nc; + if (__specify_precision) + __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCUDACXX_GET_C_LOCALE, __fmt, + (int)__iob.precision(), __v); + else + __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCUDACXX_GET_C_LOCALE, __fmt, __v); + unique_ptr __nbh(0, free); + if (__nc > static_cast(__nbuf-1)) + { + if (__specify_precision) + __nc = __libcpp_asprintf_l(&__nb, _LIBCUDACXX_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); + else + __nc = __libcpp_asprintf_l(&__nb, _LIBCUDACXX_GET_C_LOCALE, __fmt, __v); + if (__nb == 0) + __throw_bad_alloc(); + __nbh.reset(__nb); + } + char* __ne = __nb + __nc; + char* __np = this->__identify_padding(__nb, __ne, __iob); + // Stage 2 - Widen __nar while adding thousands separators + char_type __o[2*(__nbuf-1) - 1]; + char_type* __ob = __o; + unique_ptr __obh(0, free); + if (__nb != __nar) + { + __ob = (char_type*)malloc(2*static_cast(__nc)*sizeof(char_type)); + if (__ob == 0) + __throw_bad_alloc(); + __obh.reset(__ob); + } + char_type* __op; // pad here + char_type* __oe; // end of output + this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc()); + // [__o, __oe) contains thousands_sep'd wide number + // Stage 3 & 4 + __s = __pad_and_output(__s, __ob, __op, __oe, __iob, __fl); + return __s; +} + +template +_OutputIterator +num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + char_type __fl, long double __v) const +{ + // Stage 1 - Get number in narrow char + char __fmt[8] = {'%', 0}; + const char* __len = "L"; + bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags()); + const unsigned __nbuf = 30; + char __nar[__nbuf]; + char* __nb = __nar; + int __nc; + if (__specify_precision) + __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCUDACXX_GET_C_LOCALE, __fmt, + (int)__iob.precision(), __v); + else + __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCUDACXX_GET_C_LOCALE, __fmt, __v); + unique_ptr __nbh(0, free); + if (__nc > static_cast(__nbuf-1)) + { + if (__specify_precision) + __nc = __libcpp_asprintf_l(&__nb, _LIBCUDACXX_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); + else + __nc = __libcpp_asprintf_l(&__nb, _LIBCUDACXX_GET_C_LOCALE, __fmt, __v); + if (__nb == 0) + __throw_bad_alloc(); + __nbh.reset(__nb); + } + char* __ne = __nb + __nc; + char* __np = this->__identify_padding(__nb, __ne, __iob); + // Stage 2 - Widen __nar while adding thousands separators + char_type __o[2*(__nbuf-1) - 1]; + char_type* __ob = __o; + unique_ptr __obh(0, free); + if (__nb != __nar) + { + __ob = (char_type*)malloc(2*static_cast(__nc)*sizeof(char_type)); + if (__ob == 0) + __throw_bad_alloc(); + __obh.reset(__ob); + } + char_type* __op; // pad here + char_type* __oe; // end of output + this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc()); + // [__o, __oe) contains thousands_sep'd wide number + // Stage 3 & 4 + __s = __pad_and_output(__s, __ob, __op, __oe, __iob, __fl); + return __s; +} + +template +_OutputIterator +num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + char_type __fl, const void* __v) const +{ + // Stage 1 - Get pointer in narrow char + char __fmt[6] = "%p"; + const unsigned __nbuf = 20; + char __nar[__nbuf]; + int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCUDACXX_GET_C_LOCALE, __fmt, __v); + char* __ne = __nar + __nc; + char* __np = this->__identify_padding(__nar, __ne, __iob); + // Stage 2 - Widen __nar + char_type __o[2*(__nbuf-1) - 1]; + char_type* __op; // pad here + char_type* __oe; // end of output + const ctype& __ct = use_facet >(__iob.getloc()); + __ct.widen(__nar, __ne, __o); + __oe = __o + (__ne - __nar); + if (__np == __ne) + __op = __oe; + else + __op = __o + (__np - __nar); + // [__o, __oe) contains wide number + // Stage 3 & 4 + return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS num_put) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS num_put) + +template +_LIBCUDACXX_HIDDEN +int +__get_up_to_n_digits(_InputIterator& __b, _InputIterator __e, + ios_base::iostate& __err, const ctype<_CharT>& __ct, int __n) +{ + // Precondition: __n >= 1 + if (__b == __e) + { + __err |= ios_base::eofbit | ios_base::failbit; + return 0; + } + // get first digit + _CharT __c = *__b; + if (!__ct.is(ctype_base::digit, __c)) + { + __err |= ios_base::failbit; + return 0; + } + int __r = __ct.narrow(__c, 0) - '0'; + for (++__b, (void) --__n; __b != __e && __n > 0; ++__b, (void) --__n) + { + // get next digit + __c = *__b; + if (!__ct.is(ctype_base::digit, __c)) + return __r; + __r = __r * 10 + __ct.narrow(__c, 0) - '0'; + } + if (__b == __e) + __err |= ios_base::eofbit; + return __r; +} + +class _LIBCUDACXX_TYPE_VIS time_base +{ +public: + enum dateorder {no_order, dmy, mdy, ymd, ydm}; +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __time_get_c_storage +{ +protected: + typedef basic_string<_CharT> string_type; + + virtual const string_type* __weeks() const; + virtual const string_type* __months() const; + virtual const string_type* __am_pm() const; + virtual const string_type& __c() const; + virtual const string_type& __r() const; + virtual const string_type& __x() const; + virtual const string_type& __X() const; + + _LIBCUDACXX_INLINE_VISIBILITY + ~__time_get_c_storage() {} +}; + +template <> _LIBCUDACXX_FUNC_VIS const string* __time_get_c_storage::__weeks() const; +template <> _LIBCUDACXX_FUNC_VIS const string* __time_get_c_storage::__months() const; +template <> _LIBCUDACXX_FUNC_VIS const string* __time_get_c_storage::__am_pm() const; +template <> _LIBCUDACXX_FUNC_VIS const string& __time_get_c_storage::__c() const; +template <> _LIBCUDACXX_FUNC_VIS const string& __time_get_c_storage::__r() const; +template <> _LIBCUDACXX_FUNC_VIS const string& __time_get_c_storage::__x() const; +template <> _LIBCUDACXX_FUNC_VIS const string& __time_get_c_storage::__X() const; + +template <> _LIBCUDACXX_FUNC_VIS const wstring* __time_get_c_storage::__weeks() const; +template <> _LIBCUDACXX_FUNC_VIS const wstring* __time_get_c_storage::__months() const; +template <> _LIBCUDACXX_FUNC_VIS const wstring* __time_get_c_storage::__am_pm() const; +template <> _LIBCUDACXX_FUNC_VIS const wstring& __time_get_c_storage::__c() const; +template <> _LIBCUDACXX_FUNC_VIS const wstring& __time_get_c_storage::__r() const; +template <> _LIBCUDACXX_FUNC_VIS const wstring& __time_get_c_storage::__x() const; +template <> _LIBCUDACXX_FUNC_VIS const wstring& __time_get_c_storage::__X() const; + +template > +class _LIBCUDACXX_TEMPLATE_VIS time_get + : public locale::facet, + public time_base, + private __time_get_c_storage<_CharT> +{ +public: + typedef _CharT char_type; + typedef _InputIterator iter_type; + typedef time_base::dateorder dateorder; + typedef basic_string string_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit time_get(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + dateorder date_order() const + { + return this->do_date_order(); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get_time(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm) const + { + return do_get_time(__b, __e, __iob, __err, __tm); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get_date(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm) const + { + return do_get_date(__b, __e, __iob, __err, __tm); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get_weekday(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm) const + { + return do_get_weekday(__b, __e, __iob, __err, __tm); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get_monthname(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm) const + { + return do_get_monthname(__b, __e, __iob, __err, __tm); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get_year(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm) const + { + return do_get_year(__b, __e, __iob, __err, __tm); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm *__tm, + char __fmt, char __mod = 0) const + { + return do_get(__b, __e, __iob, __err, __tm, __fmt, __mod); + } + + iter_type get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm, + const char_type* __fmtb, const char_type* __fmte) const; + + static locale::id id; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~time_get() {} + + virtual dateorder do_date_order() const; + virtual iter_type do_get_time(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm) const; + virtual iter_type do_get_date(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm) const; + virtual iter_type do_get_weekday(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm) const; + virtual iter_type do_get_monthname(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm) const; + virtual iter_type do_get_year(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm) const; + virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, + ios_base::iostate& __err, tm* __tm, + char __fmt, char __mod) const; +private: + void __get_white_space(iter_type& __b, iter_type __e, + ios_base::iostate& __err, const ctype& __ct) const; + void __get_percent(iter_type& __b, iter_type __e, ios_base::iostate& __err, + const ctype& __ct) const; + + void __get_weekdayname(int& __m, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_monthname(int& __m, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_day(int& __d, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_month(int& __m, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_year(int& __y, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_year4(int& __y, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_hour(int& __d, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_12_hour(int& __h, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_am_pm(int& __h, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_minute(int& __m, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_second(int& __s, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_weekday(int& __w, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; + void __get_day_year_num(int& __w, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const; +}; + +template +locale::id +time_get<_CharT, _InputIterator>::id; + +// time_get primitives + +template +void +time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + // Note: ignoring case comes from the POSIX strptime spec + const string_type* __wk = this->__weeks(); + ptrdiff_t __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk; + if (__i < 14) + __w = __i % 7; +} + +template +void +time_get<_CharT, _InputIterator>::__get_monthname(int& __m, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + // Note: ignoring case comes from the POSIX strptime spec + const string_type* __month = this->__months(); + ptrdiff_t __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month; + if (__i < 24) + __m = __i % 12; +} + +template +void +time_get<_CharT, _InputIterator>::__get_day(int& __d, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); + if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 31) + __d = __t; + else + __err |= ios_base::failbit; +} + +template +void +time_get<_CharT, _InputIterator>::__get_month(int& __m, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1; + if (!(__err & ios_base::failbit) && __t <= 11) + __m = __t; + else + __err |= ios_base::failbit; +} + +template +void +time_get<_CharT, _InputIterator>::__get_year(int& __y, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4); + if (!(__err & ios_base::failbit)) + { + if (__t < 69) + __t += 2000; + else if (69 <= __t && __t <= 99) + __t += 1900; + __y = __t - 1900; + } +} + +template +void +time_get<_CharT, _InputIterator>::__get_year4(int& __y, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4); + if (!(__err & ios_base::failbit)) + __y = __t - 1900; +} + +template +void +time_get<_CharT, _InputIterator>::__get_hour(int& __h, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); + if (!(__err & ios_base::failbit) && __t <= 23) + __h = __t; + else + __err |= ios_base::failbit; +} + +template +void +time_get<_CharT, _InputIterator>::__get_12_hour(int& __h, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); + if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 12) + __h = __t; + else + __err |= ios_base::failbit; +} + +template +void +time_get<_CharT, _InputIterator>::__get_minute(int& __m, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); + if (!(__err & ios_base::failbit) && __t <= 59) + __m = __t; + else + __err |= ios_base::failbit; +} + +template +void +time_get<_CharT, _InputIterator>::__get_second(int& __s, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); + if (!(__err & ios_base::failbit) && __t <= 60) + __s = __t; + else + __err |= ios_base::failbit; +} + +template +void +time_get<_CharT, _InputIterator>::__get_weekday(int& __w, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 1); + if (!(__err & ios_base::failbit) && __t <= 6) + __w = __t; + else + __err |= ios_base::failbit; +} + +template +void +time_get<_CharT, _InputIterator>::__get_day_year_num(int& __d, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 3); + if (!(__err & ios_base::failbit) && __t <= 365) + __d = __t; + else + __err |= ios_base::failbit; +} + +template +void +time_get<_CharT, _InputIterator>::__get_white_space(iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + for (; __b != __e && __ct.is(ctype_base::space, *__b); ++__b) + ; + if (__b == __e) + __err |= ios_base::eofbit; +} + +template +void +time_get<_CharT, _InputIterator>::__get_am_pm(int& __h, + iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + const string_type* __ap = this->__am_pm(); + if (__ap[0].size() + __ap[1].size() == 0) + { + __err |= ios_base::failbit; + return; + } + ptrdiff_t __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap; + if (__i == 0 && __h == 12) + __h = 0; + else if (__i == 1 && __h < 12) + __h += 12; +} + +template +void +time_get<_CharT, _InputIterator>::__get_percent(iter_type& __b, iter_type __e, + ios_base::iostate& __err, + const ctype& __ct) const +{ + if (__b == __e) + { + __err |= ios_base::eofbit | ios_base::failbit; + return; + } + if (__ct.narrow(*__b, 0) != '%') + __err |= ios_base::failbit; + else if(++__b == __e) + __err |= ios_base::eofbit; +} + +// time_get end primitives + +template +_InputIterator +time_get<_CharT, _InputIterator>::get(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, tm* __tm, + const char_type* __fmtb, const char_type* __fmte) const +{ + const ctype& __ct = use_facet >(__iob.getloc()); + __err = ios_base::goodbit; + while (__fmtb != __fmte && __err == ios_base::goodbit) + { + if (__b == __e) + { + __err = ios_base::failbit; + break; + } + if (__ct.narrow(*__fmtb, 0) == '%') + { + if (++__fmtb == __fmte) + { + __err = ios_base::failbit; + break; + } + char __cmd = __ct.narrow(*__fmtb, 0); + char __opt = '\0'; + if (__cmd == 'E' || __cmd == '0') + { + if (++__fmtb == __fmte) + { + __err = ios_base::failbit; + break; + } + __opt = __cmd; + __cmd = __ct.narrow(*__fmtb, 0); + } + __b = do_get(__b, __e, __iob, __err, __tm, __cmd, __opt); + ++__fmtb; + } + else if (__ct.is(ctype_base::space, *__fmtb)) + { + for (++__fmtb; __fmtb != __fmte && __ct.is(ctype_base::space, *__fmtb); ++__fmtb) + ; + for ( ; __b != __e && __ct.is(ctype_base::space, *__b); ++__b) + ; + } + else if (__ct.toupper(*__b) == __ct.toupper(*__fmtb)) + { + ++__b; + ++__fmtb; + } + else + __err = ios_base::failbit; + } + if (__b == __e) + __err |= ios_base::eofbit; + return __b; +} + +template +typename time_get<_CharT, _InputIterator>::dateorder +time_get<_CharT, _InputIterator>::do_date_order() const +{ + return mdy; +} + +template +_InputIterator +time_get<_CharT, _InputIterator>::do_get_time(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, + tm* __tm) const +{ + const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'}; + return get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); +} + +template +_InputIterator +time_get<_CharT, _InputIterator>::do_get_date(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, + tm* __tm) const +{ + const string_type& __fmt = this->__x(); + return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size()); +} + +template +_InputIterator +time_get<_CharT, _InputIterator>::do_get_weekday(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, + tm* __tm) const +{ + const ctype& __ct = use_facet >(__iob.getloc()); + __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct); + return __b; +} + +template +_InputIterator +time_get<_CharT, _InputIterator>::do_get_monthname(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, + tm* __tm) const +{ + const ctype& __ct = use_facet >(__iob.getloc()); + __get_monthname(__tm->tm_mon, __b, __e, __err, __ct); + return __b; +} + +template +_InputIterator +time_get<_CharT, _InputIterator>::do_get_year(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, + tm* __tm) const +{ + const ctype& __ct = use_facet >(__iob.getloc()); + __get_year(__tm->tm_year, __b, __e, __err, __ct); + return __b; +} + +template +_InputIterator +time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, + ios_base& __iob, + ios_base::iostate& __err, tm* __tm, + char __fmt, char) const +{ + __err = ios_base::goodbit; + const ctype& __ct = use_facet >(__iob.getloc()); + switch (__fmt) + { + case 'a': + case 'A': + __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct); + break; + case 'b': + case 'B': + case 'h': + __get_monthname(__tm->tm_mon, __b, __e, __err, __ct); + break; + case 'c': + { + const string_type& __fm = this->__c(); + __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size()); + } + break; + case 'd': + case 'e': + __get_day(__tm->tm_mday, __b, __e, __err, __ct); + break; + case 'D': + { + const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'}; + __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); + } + break; + case 'F': + { + const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'}; + __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); + } + break; + case 'H': + __get_hour(__tm->tm_hour, __b, __e, __err, __ct); + break; + case 'I': + __get_12_hour(__tm->tm_hour, __b, __e, __err, __ct); + break; + case 'j': + __get_day_year_num(__tm->tm_yday, __b, __e, __err, __ct); + break; + case 'm': + __get_month(__tm->tm_mon, __b, __e, __err, __ct); + break; + case 'M': + __get_minute(__tm->tm_min, __b, __e, __err, __ct); + break; + case 'n': + case 't': + __get_white_space(__b, __e, __err, __ct); + break; + case 'p': + __get_am_pm(__tm->tm_hour, __b, __e, __err, __ct); + break; + case 'r': + { + const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'}; + __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); + } + break; + case 'R': + { + const char_type __fm[] = {'%', 'H', ':', '%', 'M'}; + __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); + } + break; + case 'S': + __get_second(__tm->tm_sec, __b, __e, __err, __ct); + break; + case 'T': + { + const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'}; + __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); + } + break; + case 'w': + __get_weekday(__tm->tm_wday, __b, __e, __err, __ct); + break; + case 'x': + return do_get_date(__b, __e, __iob, __err, __tm); + case 'X': + { + const string_type& __fm = this->__X(); + __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size()); + } + break; + case 'y': + __get_year(__tm->tm_year, __b, __e, __err, __ct); + break; + case 'Y': + __get_year4(__tm->tm_year, __b, __e, __err, __ct); + break; + case '%': + __get_percent(__b, __e, __err, __ct); + break; + default: + __err |= ios_base::failbit; + } + return __b; +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS time_get) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS time_get) + +class _LIBCUDACXX_TYPE_VIS __time_get +{ +protected: + locale_t __loc_; + + __time_get(const char* __nm); + __time_get(const string& __nm); + ~__time_get(); +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __time_get_storage + : public __time_get +{ +protected: + typedef basic_string<_CharT> string_type; + + string_type __weeks_[14]; + string_type __months_[24]; + string_type __am_pm_[2]; + string_type __c_; + string_type __r_; + string_type __x_; + string_type __X_; + + explicit __time_get_storage(const char* __nm); + explicit __time_get_storage(const string& __nm); + + _LIBCUDACXX_INLINE_VISIBILITY ~__time_get_storage() {} + + time_base::dateorder __do_date_order() const; + +private: + void init(const ctype<_CharT>&); + string_type __analyze(char __fmt, const ctype<_CharT>&); +}; + +#define _LIBCUDACXX_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(_CharT) \ +template <> _LIBCUDACXX_FUNC_VIS time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \ +template <> _LIBCUDACXX_FUNC_VIS __time_get_storage<_CharT>::__time_get_storage(const char*); \ +template <> _LIBCUDACXX_FUNC_VIS __time_get_storage<_CharT>::__time_get_storage(const string&); \ +template <> _LIBCUDACXX_FUNC_VIS void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \ +template <> _LIBCUDACXX_FUNC_VIS __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \ +extern template _LIBCUDACXX_FUNC_VIS time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \ +extern template _LIBCUDACXX_FUNC_VIS __time_get_storage<_CharT>::__time_get_storage(const char*); \ +extern template _LIBCUDACXX_FUNC_VIS __time_get_storage<_CharT>::__time_get_storage(const string&); \ +extern template _LIBCUDACXX_FUNC_VIS void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \ +extern template _LIBCUDACXX_FUNC_VIS __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \ +/**/ + +_LIBCUDACXX_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(char) +_LIBCUDACXX_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(wchar_t) +#undef _LIBCUDACXX_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION + +template > +class _LIBCUDACXX_TEMPLATE_VIS time_get_byname + : public time_get<_CharT, _InputIterator>, + private __time_get_storage<_CharT> +{ +public: + typedef time_base::dateorder dateorder; + typedef _InputIterator iter_type; + typedef _CharT char_type; + typedef basic_string string_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit time_get_byname(const char* __nm, size_t __refs = 0) + : time_get<_CharT, _InputIterator>(__refs), + __time_get_storage<_CharT>(__nm) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit time_get_byname(const string& __nm, size_t __refs = 0) + : time_get<_CharT, _InputIterator>(__refs), + __time_get_storage<_CharT>(__nm) {} + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~time_get_byname() {} + + _LIBCUDACXX_INLINE_VISIBILITY + virtual dateorder do_date_order() const {return this->__do_date_order();} +private: + _LIBCUDACXX_INLINE_VISIBILITY + virtual const string_type* __weeks() const {return this->__weeks_;} + _LIBCUDACXX_INLINE_VISIBILITY + virtual const string_type* __months() const {return this->__months_;} + _LIBCUDACXX_INLINE_VISIBILITY + virtual const string_type* __am_pm() const {return this->__am_pm_;} + _LIBCUDACXX_INLINE_VISIBILITY + virtual const string_type& __c() const {return this->__c_;} + _LIBCUDACXX_INLINE_VISIBILITY + virtual const string_type& __r() const {return this->__r_;} + _LIBCUDACXX_INLINE_VISIBILITY + virtual const string_type& __x() const {return this->__x_;} + _LIBCUDACXX_INLINE_VISIBILITY + virtual const string_type& __X() const {return this->__X_;} +}; + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS time_get_byname) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS time_get_byname) + +class _LIBCUDACXX_TYPE_VIS __time_put +{ + locale_t __loc_; +protected: + _LIBCUDACXX_INLINE_VISIBILITY __time_put() : __loc_(_LIBCUDACXX_GET_C_LOCALE) {} + __time_put(const char* __nm); + __time_put(const string& __nm); + ~__time_put(); + void __do_put(char* __nb, char*& __ne, const tm* __tm, + char __fmt, char __mod) const; + void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, + char __fmt, char __mod) const; +}; + +template > +class _LIBCUDACXX_TEMPLATE_VIS time_put + : public locale::facet, + private __time_put +{ +public: + typedef _CharT char_type; + typedef _OutputIterator iter_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit time_put(size_t __refs = 0) + : locale::facet(__refs) {} + + iter_type put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm, + const char_type* __pb, const char_type* __pe) const; + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, ios_base& __iob, char_type __fl, + const tm* __tm, char __fmt, char __mod = 0) const + { + return do_put(__s, __iob, __fl, __tm, __fmt, __mod); + } + + static locale::id id; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~time_put() {} + virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm, + char __fmt, char __mod) const; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit time_put(const char* __nm, size_t __refs) + : locale::facet(__refs), + __time_put(__nm) {} + _LIBCUDACXX_INLINE_VISIBILITY + explicit time_put(const string& __nm, size_t __refs) + : locale::facet(__refs), + __time_put(__nm) {} +}; + +template +locale::id +time_put<_CharT, _OutputIterator>::id; + +template +_OutputIterator +time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob, + char_type __fl, const tm* __tm, + const char_type* __pb, + const char_type* __pe) const +{ + const ctype& __ct = use_facet >(__iob.getloc()); + for (; __pb != __pe; ++__pb) + { + if (__ct.narrow(*__pb, 0) == '%') + { + if (++__pb == __pe) + { + *__s++ = __pb[-1]; + break; + } + char __mod = 0; + char __fmt = __ct.narrow(*__pb, 0); + if (__fmt == 'E' || __fmt == 'O') + { + if (++__pb == __pe) + { + *__s++ = __pb[-2]; + *__s++ = __pb[-1]; + break; + } + __mod = __fmt; + __fmt = __ct.narrow(*__pb, 0); + } + __s = do_put(__s, __iob, __fl, __tm, __fmt, __mod); + } + else + *__s++ = *__pb; + } + return __s; +} + +template +_OutputIterator +time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&, + char_type, const tm* __tm, + char __fmt, char __mod) const +{ + char_type __nar[100]; + char_type* __nb = __nar; + char_type* __ne = __nb + 100; + __do_put(__nb, __ne, __tm, __fmt, __mod); + return _CUDA_VSTD::copy(__nb, __ne, __s); +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS time_put) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS time_put) + +template > +class _LIBCUDACXX_TEMPLATE_VIS time_put_byname + : public time_put<_CharT, _OutputIterator> +{ +public: + _LIBCUDACXX_INLINE_VISIBILITY + explicit time_put_byname(const char* __nm, size_t __refs = 0) + : time_put<_CharT, _OutputIterator>(__nm, __refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit time_put_byname(const string& __nm, size_t __refs = 0) + : time_put<_CharT, _OutputIterator>(__nm, __refs) {} + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~time_put_byname() {} +}; + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS time_put_byname) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS time_put_byname) + +// money_base + +class _LIBCUDACXX_TYPE_VIS money_base +{ +public: + enum part {none, space, symbol, sign, value}; + struct pattern {char field[4];}; + + _LIBCUDACXX_INLINE_VISIBILITY money_base() {} +}; + +// moneypunct + +template +class _LIBCUDACXX_TEMPLATE_VIS moneypunct + : public locale::facet, + public money_base +{ +public: + typedef _CharT char_type; + typedef basic_string string_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit moneypunct(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();} + _LIBCUDACXX_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();} + _LIBCUDACXX_INLINE_VISIBILITY string grouping() const {return do_grouping();} + _LIBCUDACXX_INLINE_VISIBILITY string_type curr_symbol() const {return do_curr_symbol();} + _LIBCUDACXX_INLINE_VISIBILITY string_type positive_sign() const {return do_positive_sign();} + _LIBCUDACXX_INLINE_VISIBILITY string_type negative_sign() const {return do_negative_sign();} + _LIBCUDACXX_INLINE_VISIBILITY int frac_digits() const {return do_frac_digits();} + _LIBCUDACXX_INLINE_VISIBILITY pattern pos_format() const {return do_pos_format();} + _LIBCUDACXX_INLINE_VISIBILITY pattern neg_format() const {return do_neg_format();} + + static locale::id id; + static const bool intl = _International; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~moneypunct() {} + + virtual char_type do_decimal_point() const {return numeric_limits::max();} + virtual char_type do_thousands_sep() const {return numeric_limits::max();} + virtual string do_grouping() const {return string();} + virtual string_type do_curr_symbol() const {return string_type();} + virtual string_type do_positive_sign() const {return string_type();} + virtual string_type do_negative_sign() const {return string_type(1, '-');} + virtual int do_frac_digits() const {return 0;} + virtual pattern do_pos_format() const + {pattern __p = {{symbol, sign, none, value}}; return __p;} + virtual pattern do_neg_format() const + {pattern __p = {{symbol, sign, none, value}}; return __p;} +}; + +template +locale::id +moneypunct<_CharT, _International>::id; + +template +const bool +moneypunct<_CharT, _International>::intl; + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS moneypunct) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS moneypunct) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS moneypunct) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS moneypunct) + +// moneypunct_byname + +template +class _LIBCUDACXX_TEMPLATE_VIS moneypunct_byname + : public moneypunct<_CharT, _International> +{ +public: + typedef money_base::pattern pattern; + typedef _CharT char_type; + typedef basic_string string_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit moneypunct_byname(const char* __nm, size_t __refs = 0) + : moneypunct<_CharT, _International>(__refs) {init(__nm);} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit moneypunct_byname(const string& __nm, size_t __refs = 0) + : moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());} + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~moneypunct_byname() {} + + virtual char_type do_decimal_point() const {return __decimal_point_;} + virtual char_type do_thousands_sep() const {return __thousands_sep_;} + virtual string do_grouping() const {return __grouping_;} + virtual string_type do_curr_symbol() const {return __curr_symbol_;} + virtual string_type do_positive_sign() const {return __positive_sign_;} + virtual string_type do_negative_sign() const {return __negative_sign_;} + virtual int do_frac_digits() const {return __frac_digits_;} + virtual pattern do_pos_format() const {return __pos_format_;} + virtual pattern do_neg_format() const {return __neg_format_;} + +private: + char_type __decimal_point_; + char_type __thousands_sep_; + string __grouping_; + string_type __curr_symbol_; + string_type __positive_sign_; + string_type __negative_sign_; + int __frac_digits_; + pattern __pos_format_; + pattern __neg_format_; + + void init(const char*); +}; + +template<> _LIBCUDACXX_FUNC_VIS void moneypunct_byname::init(const char*); +template<> _LIBCUDACXX_FUNC_VIS void moneypunct_byname::init(const char*); +template<> _LIBCUDACXX_FUNC_VIS void moneypunct_byname::init(const char*); +template<> _LIBCUDACXX_FUNC_VIS void moneypunct_byname::init(const char*); + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname) + +// money_get + +template +class __money_get +{ +protected: + typedef _CharT char_type; + typedef basic_string string_type; + + _LIBCUDACXX_INLINE_VISIBILITY __money_get() {} + + static void __gather_info(bool __intl, const locale& __loc, + money_base::pattern& __pat, char_type& __dp, + char_type& __ts, string& __grp, + string_type& __sym, string_type& __psn, + string_type& __nsn, int& __fd); +}; + +template +void +__money_get<_CharT>::__gather_info(bool __intl, const locale& __loc, + money_base::pattern& __pat, char_type& __dp, + char_type& __ts, string& __grp, + string_type& __sym, string_type& __psn, + string_type& __nsn, int& __fd) +{ + if (__intl) + { + const moneypunct& __mp = + use_facet >(__loc); + __pat = __mp.neg_format(); + __nsn = __mp.negative_sign(); + __psn = __mp.positive_sign(); + __dp = __mp.decimal_point(); + __ts = __mp.thousands_sep(); + __grp = __mp.grouping(); + __sym = __mp.curr_symbol(); + __fd = __mp.frac_digits(); + } + else + { + const moneypunct& __mp = + use_facet >(__loc); + __pat = __mp.neg_format(); + __nsn = __mp.negative_sign(); + __psn = __mp.positive_sign(); + __dp = __mp.decimal_point(); + __ts = __mp.thousands_sep(); + __grp = __mp.grouping(); + __sym = __mp.curr_symbol(); + __fd = __mp.frac_digits(); + } +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS __money_get) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS __money_get) + +template > +class _LIBCUDACXX_TEMPLATE_VIS money_get + : public locale::facet, + private __money_get<_CharT> +{ +public: + typedef _CharT char_type; + typedef _InputIterator iter_type; + typedef basic_string string_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit money_get(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, + ios_base::iostate& __err, long double& __v) const + { + return do_get(__b, __e, __intl, __iob, __err, __v); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, + ios_base::iostate& __err, string_type& __v) const + { + return do_get(__b, __e, __intl, __iob, __err, __v); + } + + static locale::id id; + +protected: + + _LIBCUDACXX_INLINE_VISIBILITY + ~money_get() {} + + virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl, + ios_base& __iob, ios_base::iostate& __err, + long double& __v) const; + virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl, + ios_base& __iob, ios_base::iostate& __err, + string_type& __v) const; + +private: + static bool __do_get(iter_type& __b, iter_type __e, + bool __intl, const locale& __loc, + ios_base::fmtflags __flags, ios_base::iostate& __err, + bool& __neg, const ctype& __ct, + unique_ptr& __wb, + char_type*& __wn, char_type* __we); +}; + +template +locale::id +money_get<_CharT, _InputIterator>::id; + +_LIBCUDACXX_FUNC_VIS void __do_nothing(void*); + +template +_LIBCUDACXX_HIDDEN +void +__double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e) +{ + bool __owns = __b.get_deleter() != __do_nothing; + size_t __cur_cap = static_cast(__e-__b.get()) * sizeof(_Tp); + size_t __new_cap = __cur_cap < numeric_limits::max() / 2 ? + 2 * __cur_cap : numeric_limits::max(); + if (__new_cap == 0) + __new_cap = sizeof(_Tp); + size_t __n_off = static_cast(__n - __b.get()); + _Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap); + if (__t == 0) + __throw_bad_alloc(); + if (__owns) + __b.release(); + __b = unique_ptr<_Tp, void(*)(void*)>(__t, free); + __new_cap /= sizeof(_Tp); + __n = __b.get() + __n_off; + __e = __b.get() + __new_cap; +} + +// true == success +template +bool +money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, + bool __intl, const locale& __loc, + ios_base::fmtflags __flags, + ios_base::iostate& __err, + bool& __neg, + const ctype& __ct, + unique_ptr& __wb, + char_type*& __wn, char_type* __we) +{ + const unsigned __bz = 100; + unsigned __gbuf[__bz]; + unique_ptr __gb(__gbuf, __do_nothing); + unsigned* __gn = __gb.get(); + unsigned* __ge = __gn + __bz; + money_base::pattern __pat; + char_type __dp; + char_type __ts; + string __grp; + string_type __sym; + string_type __psn; + string_type __nsn; + // Capture the spaces read into money_base::{space,none} so they + // can be compared to initial spaces in __sym. + string_type __spaces; + int __fd; + __money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp, + __sym, __psn, __nsn, __fd); + const string_type* __trailing_sign = 0; + __wn = __wb.get(); + for (unsigned __p = 0; __p < 4 && __b != __e; ++__p) + { + switch (__pat.field[__p]) + { + case money_base::space: + if (__p != 3) + { + if (__ct.is(ctype_base::space, *__b)) + __spaces.push_back(*__b++); + else + { + __err |= ios_base::failbit; + return false; + } + } + _LIBCUDACXX_FALLTHROUGH(); + case money_base::none: + if (__p != 3) + { + while (__b != __e && __ct.is(ctype_base::space, *__b)) + __spaces.push_back(*__b++); + } + break; + case money_base::sign: + if (__psn.size() + __nsn.size() > 0) + { + if (__psn.size() == 0 || __nsn.size() == 0) + { // sign is optional + if (__psn.size() > 0) + { // __nsn.size() == 0 + if (*__b == __psn[0]) + { + ++__b; + if (__psn.size() > 1) + __trailing_sign = &__psn; + } + else + __neg = true; + } + else if (*__b == __nsn[0]) // __nsn.size() > 0 && __psn.size() == 0 + { + ++__b; + __neg = true; + if (__nsn.size() > 1) + __trailing_sign = &__nsn; + } + } + else // sign is required + { + if (*__b == __psn[0]) + { + ++__b; + if (__psn.size() > 1) + __trailing_sign = &__psn; + } + else if (*__b == __nsn[0]) + { + ++__b; + __neg = true; + if (__nsn.size() > 1) + __trailing_sign = &__nsn; + } + else + { + __err |= ios_base::failbit; + return false; + } + } + } + break; + case money_base::symbol: + { + bool __more_needed = __trailing_sign || + (__p < 2) || + (__p == 2 && __pat.field[3] != static_cast(money_base::none)); + bool __sb = (__flags & ios_base::showbase) != 0; + if (__sb || __more_needed) + { + typename string_type::const_iterator __sym_space_end = __sym.begin(); + if (__p > 0 && (__pat.field[__p - 1] == money_base::none || + __pat.field[__p - 1] == money_base::space)) { + // Match spaces we've already read against spaces at + // the beginning of __sym. + while (__sym_space_end != __sym.end() && + __ct.is(ctype_base::space, *__sym_space_end)) + ++__sym_space_end; + const size_t __num_spaces = __sym_space_end - __sym.begin(); + if (__num_spaces > __spaces.size() || + !equal(__spaces.end() - __num_spaces, __spaces.end(), + __sym.begin())) { + // No match. Put __sym_space_end back at the + // beginning of __sym, which will prevent a + // match in the next loop. + __sym_space_end = __sym.begin(); + } + } + typename string_type::const_iterator __sym_curr_char = __sym_space_end; + while (__sym_curr_char != __sym.end() && __b != __e && + *__b == *__sym_curr_char) { + ++__b; + ++__sym_curr_char; + } + if (__sb && __sym_curr_char != __sym.end()) + { + __err |= ios_base::failbit; + return false; + } + } + } + break; + case money_base::value: + { + unsigned __ng = 0; + for (; __b != __e; ++__b) + { + char_type __c = *__b; + if (__ct.is(ctype_base::digit, __c)) + { + if (__wn == __we) + __double_or_nothing(__wb, __wn, __we); + *__wn++ = __c; + ++__ng; + } + else if (__grp.size() > 0 && __ng > 0 && __c == __ts) + { + if (__gn == __ge) + __double_or_nothing(__gb, __gn, __ge); + *__gn++ = __ng; + __ng = 0; + } + else + break; + } + if (__gb.get() != __gn && __ng > 0) + { + if (__gn == __ge) + __double_or_nothing(__gb, __gn, __ge); + *__gn++ = __ng; + } + if (__fd > 0) + { + if (__b == __e || *__b != __dp) + { + __err |= ios_base::failbit; + return false; + } + for (++__b; __fd > 0; --__fd, ++__b) + { + if (__b == __e || !__ct.is(ctype_base::digit, *__b)) + { + __err |= ios_base::failbit; + return false; + } + if (__wn == __we) + __double_or_nothing(__wb, __wn, __we); + *__wn++ = *__b; + } + } + if (__wn == __wb.get()) + { + __err |= ios_base::failbit; + return false; + } + } + break; + } + } + if (__trailing_sign) + { + for (unsigned __i = 1; __i < __trailing_sign->size(); ++__i, ++__b) + { + if (__b == __e || *__b != (*__trailing_sign)[__i]) + { + __err |= ios_base::failbit; + return false; + } + } + } + if (__gb.get() != __gn) + { + ios_base::iostate __et = ios_base::goodbit; + __check_grouping(__grp, __gb.get(), __gn, __et); + if (__et) + { + __err |= ios_base::failbit; + return false; + } + } + return true; +} + +template +_InputIterator +money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, + bool __intl, ios_base& __iob, + ios_base::iostate& __err, + long double& __v) const +{ + const int __bz = 100; + char_type __wbuf[__bz]; + unique_ptr __wb(__wbuf, __do_nothing); + char_type* __wn; + char_type* __we = __wbuf + __bz; + locale __loc = __iob.getloc(); + const ctype& __ct = use_facet >(__loc); + bool __neg = false; + if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, + __wb, __wn, __we)) + { + const char __src[] = "0123456789"; + char_type __atoms[sizeof(__src)-1]; + __ct.widen(__src, __src + (sizeof(__src)-1), __atoms); + char __nbuf[__bz]; + char* __nc = __nbuf; + unique_ptr __h(0, free); + if (__wn - __wb.get() > __bz-2) + { + __h.reset((char*)malloc(static_cast(__wn - __wb.get() + 2))); + if (__h.get() == 0) + __throw_bad_alloc(); + __nc = __h.get(); + } + if (__neg) + *__nc++ = '-'; + for (const char_type* __w = __wb.get(); __w < __wn; ++__w, ++__nc) + *__nc = __src[find(__atoms, _CUDA_VSTD::end(__atoms), *__w) - __atoms]; + *__nc = char(); + if (sscanf(__nbuf, "%Lf", &__v) != 1) + __throw_runtime_error("money_get error"); + } + if (__b == __e) + __err |= ios_base::eofbit; + return __b; +} + +template +_InputIterator +money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, + bool __intl, ios_base& __iob, + ios_base::iostate& __err, + string_type& __v) const +{ + const int __bz = 100; + char_type __wbuf[__bz]; + unique_ptr __wb(__wbuf, __do_nothing); + char_type* __wn; + char_type* __we = __wbuf + __bz; + locale __loc = __iob.getloc(); + const ctype& __ct = use_facet >(__loc); + bool __neg = false; + if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, + __wb, __wn, __we)) + { + __v.clear(); + if (__neg) + __v.push_back(__ct.widen('-')); + char_type __z = __ct.widen('0'); + char_type* __w; + for (__w = __wb.get(); __w < __wn-1; ++__w) + if (*__w != __z) + break; + __v.append(__w, __wn); + } + if (__b == __e) + __err |= ios_base::eofbit; + return __b; +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS money_get) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS money_get) + +// money_put + +template +class __money_put +{ +protected: + typedef _CharT char_type; + typedef basic_string string_type; + + _LIBCUDACXX_INLINE_VISIBILITY __money_put() {} + + static void __gather_info(bool __intl, bool __neg, const locale& __loc, + money_base::pattern& __pat, char_type& __dp, + char_type& __ts, string& __grp, + string_type& __sym, string_type& __sn, + int& __fd); + static void __format(char_type* __mb, char_type*& __mi, char_type*& __me, + ios_base::fmtflags __flags, + const char_type* __db, const char_type* __de, + const ctype& __ct, bool __neg, + const money_base::pattern& __pat, char_type __dp, + char_type __ts, const string& __grp, + const string_type& __sym, const string_type& __sn, + int __fd); +}; + +template +void +__money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc, + money_base::pattern& __pat, char_type& __dp, + char_type& __ts, string& __grp, + string_type& __sym, string_type& __sn, + int& __fd) +{ + if (__intl) + { + const moneypunct& __mp = + use_facet >(__loc); + if (__neg) + { + __pat = __mp.neg_format(); + __sn = __mp.negative_sign(); + } + else + { + __pat = __mp.pos_format(); + __sn = __mp.positive_sign(); + } + __dp = __mp.decimal_point(); + __ts = __mp.thousands_sep(); + __grp = __mp.grouping(); + __sym = __mp.curr_symbol(); + __fd = __mp.frac_digits(); + } + else + { + const moneypunct& __mp = + use_facet >(__loc); + if (__neg) + { + __pat = __mp.neg_format(); + __sn = __mp.negative_sign(); + } + else + { + __pat = __mp.pos_format(); + __sn = __mp.positive_sign(); + } + __dp = __mp.decimal_point(); + __ts = __mp.thousands_sep(); + __grp = __mp.grouping(); + __sym = __mp.curr_symbol(); + __fd = __mp.frac_digits(); + } +} + +template +void +__money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __me, + ios_base::fmtflags __flags, + const char_type* __db, const char_type* __de, + const ctype& __ct, bool __neg, + const money_base::pattern& __pat, char_type __dp, + char_type __ts, const string& __grp, + const string_type& __sym, const string_type& __sn, + int __fd) +{ + __me = __mb; + for (unsigned __p = 0; __p < 4; ++__p) + { + switch (__pat.field[__p]) + { + case money_base::none: + __mi = __me; + break; + case money_base::space: + __mi = __me; + *__me++ = __ct.widen(' '); + break; + case money_base::sign: + if (!__sn.empty()) + *__me++ = __sn[0]; + break; + case money_base::symbol: + if (!__sym.empty() && (__flags & ios_base::showbase)) + __me = _CUDA_VSTD::copy(__sym.begin(), __sym.end(), __me); + break; + case money_base::value: + { + // remember start of value so we can reverse it + char_type* __t = __me; + // find beginning of digits + if (__neg) + ++__db; + // find end of digits + const char_type* __d; + for (__d = __db; __d < __de; ++__d) + if (!__ct.is(ctype_base::digit, *__d)) + break; + // print fractional part + if (__fd > 0) + { + int __f; + for (__f = __fd; __d > __db && __f > 0; --__f) + *__me++ = *--__d; + char_type __z = __f > 0 ? __ct.widen('0') : char_type(); + for (; __f > 0; --__f) + *__me++ = __z; + *__me++ = __dp; + } + // print units part + if (__d == __db) + { + *__me++ = __ct.widen('0'); + } + else + { + unsigned __ng = 0; + unsigned __ig = 0; + unsigned __gl = __grp.empty() ? numeric_limits::max() + : static_cast(__grp[__ig]); + while (__d != __db) + { + if (__ng == __gl) + { + *__me++ = __ts; + __ng = 0; + if (++__ig < __grp.size()) + __gl = __grp[__ig] == numeric_limits::max() ? + numeric_limits::max() : + static_cast(__grp[__ig]); + } + *__me++ = *--__d; + ++__ng; + } + } + // reverse it + reverse(__t, __me); + } + break; + } + } + // print rest of sign, if any + if (__sn.size() > 1) + __me = _CUDA_VSTD::copy(__sn.begin()+1, __sn.end(), __me); + // set alignment + if ((__flags & ios_base::adjustfield) == ios_base::left) + __mi = __me; + else if ((__flags & ios_base::adjustfield) != ios_base::internal) + __mi = __mb; +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS __money_put) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS __money_put) + +template > +class _LIBCUDACXX_TEMPLATE_VIS money_put + : public locale::facet, + private __money_put<_CharT> +{ +public: + typedef _CharT char_type; + typedef _OutputIterator iter_type; + typedef basic_string string_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit money_put(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, + long double __units) const + { + return do_put(__s, __intl, __iob, __fl, __units); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, + const string_type& __digits) const + { + return do_put(__s, __intl, __iob, __fl, __digits); + } + + static locale::id id; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~money_put() {} + + virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob, + char_type __fl, long double __units) const; + virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob, + char_type __fl, const string_type& __digits) const; +}; + +template +locale::id +money_put<_CharT, _OutputIterator>::id; + +template +_OutputIterator +money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, + ios_base& __iob, char_type __fl, + long double __units) const +{ + // convert to char + const size_t __bs = 100; + char __buf[__bs]; + char* __bb = __buf; + char_type __digits[__bs]; + char_type* __db = __digits; + size_t __n = static_cast(snprintf(__bb, __bs, "%.0Lf", __units)); + unique_ptr __hn(0, free); + unique_ptr __hd(0, free); + // secure memory for digit storage + if (__n > __bs-1) + { + __n = static_cast(__libcpp_asprintf_l(&__bb, _LIBCUDACXX_GET_C_LOCALE, "%.0Lf", __units)); + if (__bb == 0) + __throw_bad_alloc(); + __hn.reset(__bb); + __hd.reset((char_type*)malloc(__n * sizeof(char_type))); + if (__hd == nullptr) + __throw_bad_alloc(); + __db = __hd.get(); + } + // gather info + locale __loc = __iob.getloc(); + const ctype& __ct = use_facet >(__loc); + __ct.widen(__bb, __bb + __n, __db); + bool __neg = __n > 0 && __bb[0] == '-'; + money_base::pattern __pat; + char_type __dp; + char_type __ts; + string __grp; + string_type __sym; + string_type __sn; + int __fd; + this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd); + // secure memory for formatting + char_type __mbuf[__bs]; + char_type* __mb = __mbuf; + unique_ptr __hw(0, free); + size_t __exn = static_cast(__n) > __fd ? + (__n - static_cast(__fd)) * 2 + __sn.size() + + __sym.size() + static_cast(__fd) + 1 + : __sn.size() + __sym.size() + static_cast(__fd) + 2; + if (__exn > __bs) + { + __hw.reset((char_type*)malloc(__exn * sizeof(char_type))); + __mb = __hw.get(); + if (__mb == 0) + __throw_bad_alloc(); + } + // format + char_type* __mi; + char_type* __me; + this->__format(__mb, __mi, __me, __iob.flags(), + __db, __db + __n, __ct, + __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd); + return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); +} + +template +_OutputIterator +money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, + ios_base& __iob, char_type __fl, + const string_type& __digits) const +{ + // gather info + locale __loc = __iob.getloc(); + const ctype& __ct = use_facet >(__loc); + bool __neg = __digits.size() > 0 && __digits[0] == __ct.widen('-'); + money_base::pattern __pat; + char_type __dp; + char_type __ts; + string __grp; + string_type __sym; + string_type __sn; + int __fd; + this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd); + // secure memory for formatting + char_type __mbuf[100]; + char_type* __mb = __mbuf; + unique_ptr __h(0, free); + size_t __exn = static_cast(__digits.size()) > __fd ? + (__digits.size() - static_cast(__fd)) * 2 + + __sn.size() + __sym.size() + static_cast(__fd) + 1 + : __sn.size() + __sym.size() + static_cast(__fd) + 2; + if (__exn > 100) + { + __h.reset((char_type*)malloc(__exn * sizeof(char_type))); + __mb = __h.get(); + if (__mb == 0) + __throw_bad_alloc(); + } + // format + char_type* __mi; + char_type* __me; + this->__format(__mb, __mi, __me, __iob.flags(), + __digits.data(), __digits.data() + __digits.size(), __ct, + __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd); + return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS money_put) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS money_put) + +// messages + +class _LIBCUDACXX_TYPE_VIS messages_base +{ +public: + typedef ptrdiff_t catalog; + + _LIBCUDACXX_INLINE_VISIBILITY messages_base() {} +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS messages + : public locale::facet, + public messages_base +{ +public: + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit messages(size_t __refs = 0) + : locale::facet(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + catalog open(const basic_string& __nm, const locale& __loc) const + { + return do_open(__nm, __loc); + } + + _LIBCUDACXX_INLINE_VISIBILITY + string_type get(catalog __c, int __set, int __msgid, + const string_type& __dflt) const + { + return do_get(__c, __set, __msgid, __dflt); + } + + _LIBCUDACXX_INLINE_VISIBILITY + void close(catalog __c) const + { + do_close(__c); + } + + static locale::id id; + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~messages() {} + + virtual catalog do_open(const basic_string&, const locale&) const; + virtual string_type do_get(catalog, int __set, int __msgid, + const string_type& __dflt) const; + virtual void do_close(catalog) const; +}; + +template +locale::id +messages<_CharT>::id; + +template +typename messages<_CharT>::catalog +messages<_CharT>::do_open(const basic_string& __nm, const locale&) const +{ +#ifdef _LIBCUDACXX_HAS_CATOPEN + catalog __cat = (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE); + if (__cat != -1) + __cat = static_cast((static_cast(__cat) >> 1)); + return __cat; +#else // !_LIBCUDACXX_HAS_CATOPEN + _LIBCUDACXX_UNUSED_VAR(__nm); + return -1; +#endif // _LIBCUDACXX_HAS_CATOPEN +} + +template +typename messages<_CharT>::string_type +messages<_CharT>::do_get(catalog __c, int __set, int __msgid, + const string_type& __dflt) const +{ +#ifdef _LIBCUDACXX_HAS_CATOPEN + string __ndflt; + __narrow_to_utf8()(back_inserter(__ndflt), + __dflt.c_str(), + __dflt.c_str() + __dflt.size()); + if (__c != -1) + __c <<= 1; + nl_catd __cat = (nl_catd)__c; + char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str()); + string_type __w; + __widen_from_utf8()(back_inserter(__w), + __n, __n + strlen(__n)); + return __w; +#else // !_LIBCUDACXX_HAS_CATOPEN + _LIBCUDACXX_UNUSED_VAR(__c); + _LIBCUDACXX_UNUSED_VAR(__set); + _LIBCUDACXX_UNUSED_VAR(__msgid); + return __dflt; +#endif // _LIBCUDACXX_HAS_CATOPEN +} + +template +void +messages<_CharT>::do_close(catalog __c) const +{ +#ifdef _LIBCUDACXX_HAS_CATOPEN + if (__c != -1) + __c <<= 1; + nl_catd __cat = (nl_catd)__c; + catclose(__cat); +#else // !_LIBCUDACXX_HAS_CATOPEN + _LIBCUDACXX_UNUSED_VAR(__c); +#endif // _LIBCUDACXX_HAS_CATOPEN +} + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS messages) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS messages) + +template +class _LIBCUDACXX_TEMPLATE_VIS messages_byname + : public messages<_CharT> +{ +public: + typedef messages_base::catalog catalog; + typedef basic_string<_CharT> string_type; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit messages_byname(const char*, size_t __refs = 0) + : messages<_CharT>(__refs) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit messages_byname(const string&, size_t __refs = 0) + : messages<_CharT>(__refs) {} + +protected: + _LIBCUDACXX_INLINE_VISIBILITY + ~messages_byname() {} +}; + +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS messages_byname) +_LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS messages_byname) + +template, + class _Byte_alloc = allocator > +class _LIBCUDACXX_TEMPLATE_VIS wstring_convert +{ +public: + typedef basic_string, _Byte_alloc> byte_string; + typedef basic_string<_Elem, char_traits<_Elem>, _Wide_alloc> wide_string; + typedef typename _Codecvt::state_type state_type; + typedef typename wide_string::traits_type::int_type int_type; + +private: + byte_string __byte_err_string_; + wide_string __wide_err_string_; + _Codecvt* __cvtptr_; + state_type __cvtstate_; + size_t __cvtcount_; + + wstring_convert(const wstring_convert& __wc); + wstring_convert& operator=(const wstring_convert& __wc); +public: + _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_EXPLICIT_AFTER_CXX11 wstring_convert(_Codecvt* __pcvt = new _Codecvt); + _LIBCUDACXX_INLINE_VISIBILITY + wstring_convert(_Codecvt* __pcvt, state_type __state); + _LIBCUDACXX_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err, + const wide_string& __wide_err = wide_string()); + _LIBCUDACXX_INLINE_VISIBILITY + wstring_convert(wstring_convert&& __wc); + ~wstring_convert(); + + _LIBCUDACXX_INLINE_VISIBILITY + wide_string from_bytes(char __byte) + {return from_bytes(&__byte, &__byte+1);} + _LIBCUDACXX_INLINE_VISIBILITY + wide_string from_bytes(const char* __ptr) + {return from_bytes(__ptr, __ptr + char_traits::length(__ptr));} + _LIBCUDACXX_INLINE_VISIBILITY + wide_string from_bytes(const byte_string& __str) + {return from_bytes(__str.data(), __str.data() + __str.size());} + wide_string from_bytes(const char* __first, const char* __last); + + _LIBCUDACXX_INLINE_VISIBILITY + byte_string to_bytes(_Elem __wchar) + {return to_bytes(&__wchar, &__wchar+1);} + _LIBCUDACXX_INLINE_VISIBILITY + byte_string to_bytes(const _Elem* __wptr) + {return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));} + _LIBCUDACXX_INLINE_VISIBILITY + byte_string to_bytes(const wide_string& __wstr) + {return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());} + byte_string to_bytes(const _Elem* __first, const _Elem* __last); + + _LIBCUDACXX_INLINE_VISIBILITY + size_t converted() const noexcept {return __cvtcount_;} + _LIBCUDACXX_INLINE_VISIBILITY + state_type state() const {return __cvtstate_;} +}; + +template +inline +wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: + wstring_convert(_Codecvt* __pcvt) + : __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0) +{ +} + +template +inline +wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: + wstring_convert(_Codecvt* __pcvt, state_type __state) + : __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0) +{ +} + +template +wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: + wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err) + : __byte_err_string_(__byte_err), __wide_err_string_(__wide_err), + __cvtstate_(), __cvtcount_(0) +{ + __cvtptr_ = new _Codecvt; +} + +template +inline +wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: + wstring_convert(wstring_convert&& __wc) + : __byte_err_string_(_CUDA_VSTD::move(__wc.__byte_err_string_)), + __wide_err_string_(_CUDA_VSTD::move(__wc.__wide_err_string_)), + __cvtptr_(__wc.__cvtptr_), + __cvtstate_(__wc.__cvtstate_), __cvtcount_(__wc.__cvtcount_) +{ + __wc.__cvtptr_ = nullptr; +} + +template +wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert() +{ + delete __cvtptr_; +} + +template +typename wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::wide_string +wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: + from_bytes(const char* __frm, const char* __frm_end) +{ + __cvtcount_ = 0; + if (__cvtptr_ != nullptr) + { + wide_string __ws(2*(__frm_end - __frm), _Elem()); + if (__frm != __frm_end) + __ws.resize(__ws.capacity()); + codecvt_base::result __r = codecvt_base::ok; + state_type __st = __cvtstate_; + if (__frm != __frm_end) + { + _Elem* __to = &__ws[0]; + _Elem* __to_end = __to + __ws.size(); + const char* __frm_nxt; + do + { + _Elem* __to_nxt; + __r = __cvtptr_->in(__st, __frm, __frm_end, __frm_nxt, + __to, __to_end, __to_nxt); + __cvtcount_ += __frm_nxt - __frm; + if (__frm_nxt == __frm) + { + __r = codecvt_base::error; + } + else if (__r == codecvt_base::noconv) + { + __ws.resize(__to - &__ws[0]); + // This only gets executed if _Elem is char + __ws.append((const _Elem*)__frm, (const _Elem*)__frm_end); + __frm = __frm_nxt; + __r = codecvt_base::ok; + } + else if (__r == codecvt_base::ok) + { + __ws.resize(__to_nxt - &__ws[0]); + __frm = __frm_nxt; + } + else if (__r == codecvt_base::partial) + { + ptrdiff_t __s = __to_nxt - &__ws[0]; + __ws.resize(2 * __s); + __to = &__ws[0] + __s; + __to_end = &__ws[0] + __ws.size(); + __frm = __frm_nxt; + } + } while (__r == codecvt_base::partial && __frm_nxt < __frm_end); + } + if (__r == codecvt_base::ok) + return __ws; + } + + if (__wide_err_string_.empty()) + __throw_range_error("wstring_convert: from_bytes error"); + + return __wide_err_string_; +} + +template +typename wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::byte_string +wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: + to_bytes(const _Elem* __frm, const _Elem* __frm_end) +{ + __cvtcount_ = 0; + if (__cvtptr_ != nullptr) + { + byte_string __bs(2*(__frm_end - __frm), char()); + if (__frm != __frm_end) + __bs.resize(__bs.capacity()); + codecvt_base::result __r = codecvt_base::ok; + state_type __st = __cvtstate_; + if (__frm != __frm_end) + { + char* __to = &__bs[0]; + char* __to_end = __to + __bs.size(); + const _Elem* __frm_nxt; + do + { + char* __to_nxt; + __r = __cvtptr_->out(__st, __frm, __frm_end, __frm_nxt, + __to, __to_end, __to_nxt); + __cvtcount_ += __frm_nxt - __frm; + if (__frm_nxt == __frm) + { + __r = codecvt_base::error; + } + else if (__r == codecvt_base::noconv) + { + __bs.resize(__to - &__bs[0]); + // This only gets executed if _Elem is char + __bs.append((const char*)__frm, (const char*)__frm_end); + __frm = __frm_nxt; + __r = codecvt_base::ok; + } + else if (__r == codecvt_base::ok) + { + __bs.resize(__to_nxt - &__bs[0]); + __frm = __frm_nxt; + } + else if (__r == codecvt_base::partial) + { + ptrdiff_t __s = __to_nxt - &__bs[0]; + __bs.resize(2 * __s); + __to = &__bs[0] + __s; + __to_end = &__bs[0] + __bs.size(); + __frm = __frm_nxt; + } + } while (__r == codecvt_base::partial && __frm_nxt < __frm_end); + } + if (__r == codecvt_base::ok) + { + size_t __s = __bs.size(); + __bs.resize(__bs.capacity()); + char* __to = &__bs[0] + __s; + char* __to_end = __to + __bs.size(); + do + { + char* __to_nxt; + __r = __cvtptr_->unshift(__st, __to, __to_end, __to_nxt); + if (__r == codecvt_base::noconv) + { + __bs.resize(__to - &__bs[0]); + __r = codecvt_base::ok; + } + else if (__r == codecvt_base::ok) + { + __bs.resize(__to_nxt - &__bs[0]); + } + else if (__r == codecvt_base::partial) + { + ptrdiff_t __sp = __to_nxt - &__bs[0]; + __bs.resize(2 * __sp); + __to = &__bs[0] + __sp; + __to_end = &__bs[0] + __bs.size(); + } + } while (__r == codecvt_base::partial); + if (__r == codecvt_base::ok) + return __bs; + } + } + + if (__byte_err_string_.empty()) + __throw_range_error("wstring_convert: to_bytes error"); + + return __byte_err_string_; +} + +template > +class _LIBCUDACXX_TEMPLATE_VIS wbuffer_convert + : public basic_streambuf<_Elem, _Tr> +{ +public: + // types: + typedef _Elem char_type; + typedef _Tr traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + typedef typename _Codecvt::state_type state_type; + +private: + char* __extbuf_; + const char* __extbufnext_; + const char* __extbufend_; + char __extbuf_min_[8]; + size_t __ebs_; + char_type* __intbuf_; + size_t __ibs_; + streambuf* __bufptr_; + _Codecvt* __cv_; + state_type __st_; + ios_base::openmode __cm_; + bool __owns_eb_; + bool __owns_ib_; + bool __always_noconv_; + + wbuffer_convert(const wbuffer_convert&); + wbuffer_convert& operator=(const wbuffer_convert&); +public: + _LIBCUDACXX_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0, + _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type()); + ~wbuffer_convert(); + + _LIBCUDACXX_INLINE_VISIBILITY + streambuf* rdbuf() const {return __bufptr_;} + _LIBCUDACXX_INLINE_VISIBILITY + streambuf* rdbuf(streambuf* __bytebuf) + { + streambuf* __r = __bufptr_; + __bufptr_ = __bytebuf; + return __r; + } + + _LIBCUDACXX_INLINE_VISIBILITY + state_type state() const {return __st_;} + +protected: + virtual int_type underflow(); + virtual int_type pbackfail(int_type __c = traits_type::eof()); + virtual int_type overflow (int_type __c = traits_type::eof()); + virtual basic_streambuf* setbuf(char_type* __s, + streamsize __n); + virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __wch = ios_base::in | ios_base::out); + virtual pos_type seekpos(pos_type __sp, + ios_base::openmode __wch = ios_base::in | ios_base::out); + virtual int sync(); + +private: + bool __read_mode(); + void __write_mode(); + wbuffer_convert* __close(); +}; + +template +wbuffer_convert<_Codecvt, _Elem, _Tr>:: + wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state) + : __extbuf_(0), + __extbufnext_(0), + __extbufend_(0), + __ebs_(0), + __intbuf_(0), + __ibs_(0), + __bufptr_(__bytebuf), + __cv_(__pcvt), + __st_(__state), + __cm_(0), + __owns_eb_(false), + __owns_ib_(false), + __always_noconv_(__cv_ ? __cv_->always_noconv() : false) +{ + setbuf(0, 4096); +} + +template +wbuffer_convert<_Codecvt, _Elem, _Tr>::~wbuffer_convert() +{ + __close(); + delete __cv_; + if (__owns_eb_) + delete [] __extbuf_; + if (__owns_ib_) + delete [] __intbuf_; +} + +template +typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type +wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() +{ + if (__cv_ == 0 || __bufptr_ == 0) + return traits_type::eof(); + bool __initial = __read_mode(); + char_type __1buf; + if (this->gptr() == 0) + this->setg(&__1buf, &__1buf+1, &__1buf+1); + const size_t __unget_sz = __initial ? 0 : min((this->egptr() - this->eback()) / 2, 4); + int_type __c = traits_type::eof(); + if (this->gptr() == this->egptr()) + { + memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type)); + if (__always_noconv_) + { + streamsize __nmemb = static_cast(this->egptr() - this->eback() - __unget_sz); + __nmemb = __bufptr_->sgetn((char*)this->eback() + __unget_sz, __nmemb); + if (__nmemb != 0) + { + this->setg(this->eback(), + this->eback() + __unget_sz, + this->eback() + __unget_sz + __nmemb); + __c = *this->gptr(); + } + } + else + { + _LIBCUDACXX_ASSERT(!(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" ); + if (__extbufend_ != __extbufnext_) + memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); + __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); + __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); + streamsize __nmemb = _CUDA_VSTD::min(static_cast(this->egptr() - this->eback() - __unget_sz), + static_cast(__extbufend_ - __extbufnext_)); + codecvt_base::result __r; + // FIXME: Do we ever need to restore the state here? + //state_type __svs = __st_; + streamsize __nr = __bufptr_->sgetn(const_cast(__extbufnext_), __nmemb); + if (__nr != 0) + { + __extbufend_ = __extbufnext_ + __nr; + char_type* __inext; + __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_, + this->eback() + __unget_sz, + this->egptr(), __inext); + if (__r == codecvt_base::noconv) + { + this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, + (char_type*) const_cast(__extbufend_)); + __c = *this->gptr(); + } + else if (__inext != this->eback() + __unget_sz) + { + this->setg(this->eback(), this->eback() + __unget_sz, __inext); + __c = *this->gptr(); + } + } + } + } + else + __c = *this->gptr(); + if (this->eback() == &__1buf) + this->setg(0, 0, 0); + return __c; +} + +template +typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type +wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c) +{ + if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr()) + { + if (traits_type::eq_int_type(__c, traits_type::eof())) + { + this->gbump(-1); + return traits_type::not_eof(__c); + } + if (traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) + { + this->gbump(-1); + *this->gptr() = traits_type::to_char_type(__c); + return __c; + } + } + return traits_type::eof(); +} + +template +typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type +wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c) +{ + if (__cv_ == 0 || __bufptr_ == 0) + return traits_type::eof(); + __write_mode(); + char_type __1buf; + char_type* __pb_save = this->pbase(); + char_type* __epb_save = this->epptr(); + if (!traits_type::eq_int_type(__c, traits_type::eof())) + { + if (this->pptr() == 0) + this->setp(&__1buf, &__1buf+1); + *this->pptr() = traits_type::to_char_type(__c); + this->pbump(1); + } + if (this->pptr() != this->pbase()) + { + if (__always_noconv_) + { + streamsize __nmemb = static_cast(this->pptr() - this->pbase()); + if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb) + return traits_type::eof(); + } + else + { + char* __extbe = __extbuf_; + codecvt_base::result __r; + do + { + const char_type* __e; + __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, + __extbuf_, __extbuf_ + __ebs_, __extbe); + if (__e == this->pbase()) + return traits_type::eof(); + if (__r == codecvt_base::noconv) + { + streamsize __nmemb = static_cast(this->pptr() - this->pbase()); + if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb) + return traits_type::eof(); + } + else if (__r == codecvt_base::ok || __r == codecvt_base::partial) + { + streamsize __nmemb = static_cast(__extbe - __extbuf_); + if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb) + return traits_type::eof(); + if (__r == codecvt_base::partial) + { + this->setp(const_cast(__e), this->pptr()); + this->__pbump(this->epptr() - this->pbase()); + } + } + else + return traits_type::eof(); + } while (__r == codecvt_base::partial); + } + this->setp(__pb_save, __epb_save); + } + return traits_type::not_eof(__c); +} + +template +basic_streambuf<_Elem, _Tr>* +wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n) +{ + this->setg(0, 0, 0); + this->setp(0, 0); + if (__owns_eb_) + delete [] __extbuf_; + if (__owns_ib_) + delete [] __intbuf_; + __ebs_ = __n; + if (__ebs_ > sizeof(__extbuf_min_)) + { + if (__always_noconv_ && __s) + { + __extbuf_ = (char*)__s; + __owns_eb_ = false; + } + else + { + __extbuf_ = new char[__ebs_]; + __owns_eb_ = true; + } + } + else + { + __extbuf_ = __extbuf_min_; + __ebs_ = sizeof(__extbuf_min_); + __owns_eb_ = false; + } + if (!__always_noconv_) + { + __ibs_ = max(__n, sizeof(__extbuf_min_)); + if (__s && __ibs_ >= sizeof(__extbuf_min_)) + { + __intbuf_ = __s; + __owns_ib_ = false; + } + else + { + __intbuf_ = new char_type[__ibs_]; + __owns_ib_ = true; + } + } + else + { + __ibs_ = 0; + __intbuf_ = 0; + __owns_ib_ = false; + } + return this; +} + +template +typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type +wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __om) +{ + int __width = __cv_->encoding(); + if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync()) + return pos_type(off_type(-1)); + // __width > 0 || __off == 0, now check __way + if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end) + return pos_type(off_type(-1)); + pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om); + __r.state(__st_); + return __r; +} + +template +typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type +wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode __wch) +{ + if (__cv_ == 0 || __bufptr_ == 0 || sync()) + return pos_type(off_type(-1)); + if (__bufptr_->pubseekpos(__sp, __wch) == pos_type(off_type(-1))) + return pos_type(off_type(-1)); + return __sp; +} + +template +int +wbuffer_convert<_Codecvt, _Elem, _Tr>::sync() +{ + if (__cv_ == 0 || __bufptr_ == 0) + return 0; + if (__cm_ & ios_base::out) + { + if (this->pptr() != this->pbase()) + if (overflow() == traits_type::eof()) + return -1; + codecvt_base::result __r; + do + { + char* __extbe; + __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe); + streamsize __nmemb = static_cast(__extbe - __extbuf_); + if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb) + return -1; + } while (__r == codecvt_base::partial); + if (__r == codecvt_base::error) + return -1; + if (__bufptr_->pubsync()) + return -1; + } + else if (__cm_ & ios_base::in) + { + off_type __c; + if (__always_noconv_) + __c = this->egptr() - this->gptr(); + else + { + int __width = __cv_->encoding(); + __c = __extbufend_ - __extbufnext_; + if (__width > 0) + __c += __width * (this->egptr() - this->gptr()); + else + { + if (this->gptr() != this->egptr()) + { + reverse(this->gptr(), this->egptr()); + codecvt_base::result __r; + const char_type* __e = this->gptr(); + char* __extbe; + do + { + __r = __cv_->out(__st_, __e, this->egptr(), __e, + __extbuf_, __extbuf_ + __ebs_, __extbe); + switch (__r) + { + case codecvt_base::noconv: + __c += this->egptr() - this->gptr(); + break; + case codecvt_base::ok: + case codecvt_base::partial: + __c += __extbe - __extbuf_; + break; + default: + return -1; + } + } while (__r == codecvt_base::partial); + } + } + } + if (__bufptr_->pubseekoff(-__c, ios_base::cur, __cm_) == pos_type(off_type(-1))) + return -1; + this->setg(0, 0, 0); + __cm_ = 0; + } + return 0; +} + +template +bool +wbuffer_convert<_Codecvt, _Elem, _Tr>::__read_mode() +{ + if (!(__cm_ & ios_base::in)) + { + this->setp(0, 0); + if (__always_noconv_) + this->setg((char_type*)__extbuf_, + (char_type*)__extbuf_ + __ebs_, + (char_type*)__extbuf_ + __ebs_); + else + this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_); + __cm_ = ios_base::in; + return true; + } + return false; +} + +template +void +wbuffer_convert<_Codecvt, _Elem, _Tr>::__write_mode() +{ + if (!(__cm_ & ios_base::out)) + { + this->setg(0, 0, 0); + if (__ebs_ > sizeof(__extbuf_min_)) + { + if (__always_noconv_) + this->setp((char_type*)__extbuf_, + (char_type*)__extbuf_ + (__ebs_ - 1)); + else + this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1)); + } + else + this->setp(0, 0); + __cm_ = ios_base::out; + } +} + +template +wbuffer_convert<_Codecvt, _Elem, _Tr>* +wbuffer_convert<_Codecvt, _Elem, _Tr>::__close() +{ + wbuffer_convert* __rt = 0; + if (__cv_ != 0 && __bufptr_ != 0) + { + __rt = this; + if ((__cm_ & ios_base::out) && sync()) + __rt = 0; + } + return __rt; +} + +_LIBCUDACXX_END_NAMESPACE_STD + +_LIBCUDACXX_POP_MACROS + +#endif // _LIBCUDACXX_LOCALE diff --git a/cuda_toolkit/include/locale.h b/cuda_toolkit/include/locale.h new file mode 100644 index 0000000000000000000000000000000000000000..ab481d75651a8f18ad0c0a02ddd789459840dc5d --- /dev/null +++ b/cuda_toolkit/include/locale.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +//===---------------------------- locale.h --------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_LOCALE_H +#define _LIBCUDACXX_LOCALE_H + +/* + locale.h synopsis + +Macros: + + LC_ALL + LC_COLLATE + LC_CTYPE + LC_MONETARY + LC_NUMERIC + LC_TIME + +Types: + + lconv + +Functions: + + setlocale + localeconv + +*/ + +#include <__config> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include_next + +#endif // _LIBCUDACXX_LOCALE_H diff --git a/cuda_toolkit/include/map b/cuda_toolkit/include/map new file mode 100644 index 0000000000000000000000000000000000000000..857ad90be35578d2112baf95b47da5e2e9c18128 --- /dev/null +++ b/cuda_toolkit/include/map @@ -0,0 +1,2167 @@ +// -*- C++ -*- +//===----------------------------- map ------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_MAP +#define _LIBCUDACXX_MAP + +/* + + map synopsis + +namespace std +{ + +template , + class Allocator = allocator>> +class map +{ +public: + // types: + typedef Key key_type; + typedef T mapped_type; + typedef pair value_type; + typedef Compare key_compare; + typedef Allocator allocator_type; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename allocator_type::size_type size_type; + typedef typename allocator_type::difference_type difference_type; + + typedef implementation-defined iterator; + typedef implementation-defined const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef unspecified node_type; // C++17 + typedef INSERT_RETURN_TYPE insert_return_type; // C++17 + + class value_compare + : public __binary_function + { + friend class map; + protected: + key_compare comp; + + value_compare(key_compare c); + public: + bool operator()(const value_type& x, const value_type& y) const; + }; + + // construct/copy/destroy: + map() + noexcept( + is_nothrow_default_constructible::value && + is_nothrow_default_constructible::value && + is_nothrow_copy_constructible::value); + explicit map(const key_compare& comp); + map(const key_compare& comp, const allocator_type& a); + template + map(InputIterator first, InputIterator last, + const key_compare& comp = key_compare()); + template + map(InputIterator first, InputIterator last, + const key_compare& comp, const allocator_type& a); + map(const map& m); + map(map&& m) + noexcept( + is_nothrow_move_constructible::value && + is_nothrow_move_constructible::value); + explicit map(const allocator_type& a); + map(const map& m, const allocator_type& a); + map(map&& m, const allocator_type& a); + map(initializer_list il, const key_compare& comp = key_compare()); + map(initializer_list il, const key_compare& comp, const allocator_type& a); + template + map(InputIterator first, InputIterator last, const allocator_type& a) + : map(first, last, Compare(), a) {} // C++14 + map(initializer_list il, const allocator_type& a) + : map(il, Compare(), a) {} // C++14 + ~map(); + + map& operator=(const map& m); + map& operator=(map&& m) + noexcept( + allocator_type::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value && + is_nothrow_move_assignable::value); + map& operator=(initializer_list il); + + // iterators: + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; + + reverse_iterator rbegin() noexcept; + const_reverse_iterator rbegin() const noexcept; + reverse_iterator rend() noexcept; + const_reverse_iterator rend() const noexcept; + + const_iterator cbegin() const noexcept; + const_iterator cend() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator crend() const noexcept; + + // capacity: + bool empty() const noexcept; + size_type size() const noexcept; + size_type max_size() const noexcept; + + // element access: + mapped_type& operator[](const key_type& k); + mapped_type& operator[](key_type&& k); + + mapped_type& at(const key_type& k); + const mapped_type& at(const key_type& k) const; + + // modifiers: + template + pair emplace(Args&&... args); + template + iterator emplace_hint(const_iterator position, Args&&... args); + pair insert(const value_type& v); + pair insert( value_type&& v); // C++17 + template + pair insert(P&& p); + iterator insert(const_iterator position, const value_type& v); + iterator insert(const_iterator position, value_type&& v); // C++17 + template + iterator insert(const_iterator position, P&& p); + template + void insert(InputIterator first, InputIterator last); + void insert(initializer_list il); + + node_type extract(const_iterator position); // C++17 + node_type extract(const key_type& x); // C++17 + insert_return_type insert(node_type&& nh); // C++17 + iterator insert(const_iterator hint, node_type&& nh); // C++17 + + template + pair try_emplace(const key_type& k, Args&&... args); // C++17 + template + pair try_emplace(key_type&& k, Args&&... args); // C++17 + template + iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17 + template + iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17 + template + pair insert_or_assign(const key_type& k, M&& obj); // C++17 + template + pair insert_or_assign(key_type&& k, M&& obj); // C++17 + template + iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17 + template + iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17 + + iterator erase(const_iterator position); + iterator erase(iterator position); // C++14 + size_type erase(const key_type& k); + iterator erase(const_iterator first, const_iterator last); + void clear() noexcept; + + template + void merge(map& source); // C++17 + template + void merge(map&& source); // C++17 + template + void merge(multimap& source); // C++17 + template + void merge(multimap&& source); // C++17 + + void swap(map& m) + noexcept(allocator_traits::is_always_equal::value && + is_nothrow_swappable::value); // C++17 + + // observers: + allocator_type get_allocator() const noexcept; + key_compare key_comp() const; + value_compare value_comp() const; + + // map operations: + iterator find(const key_type& k); + const_iterator find(const key_type& k) const; + template + iterator find(const K& x); // C++14 + template + const_iterator find(const K& x) const; // C++14 + template + size_type count(const K& x) const; // C++14 + size_type count(const key_type& k) const; + bool contains(const key_type& x) const; // C++20 + iterator lower_bound(const key_type& k); + const_iterator lower_bound(const key_type& k) const; + template + iterator lower_bound(const K& x); // C++14 + template + const_iterator lower_bound(const K& x) const; // C++14 + + iterator upper_bound(const key_type& k); + const_iterator upper_bound(const key_type& k) const; + template + iterator upper_bound(const K& x); // C++14 + template + const_iterator upper_bound(const K& x) const; // C++14 + + pair equal_range(const key_type& k); + pair equal_range(const key_type& k) const; + template + pair equal_range(const K& x); // C++14 + template + pair equal_range(const K& x) const; // C++14 +}; + +template +bool +operator==(const map& x, + const map& y); + +template +bool +operator< (const map& x, + const map& y); + +template +bool +operator!=(const map& x, + const map& y); + +template +bool +operator> (const map& x, + const map& y); + +template +bool +operator>=(const map& x, + const map& y); + +template +bool +operator<=(const map& x, + const map& y); + +// specialized algorithms: +template +void +swap(map& x, map& y) + noexcept(noexcept(x.swap(y))); + +template + void erase_if(map& c, Predicate pred); // C++20 + + +template , + class Allocator = allocator>> +class multimap +{ +public: + // types: + typedef Key key_type; + typedef T mapped_type; + typedef pair value_type; + typedef Compare key_compare; + typedef Allocator allocator_type; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + typedef typename allocator_type::size_type size_type; + typedef typename allocator_type::difference_type difference_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + + typedef implementation-defined iterator; + typedef implementation-defined const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef unspecified node_type; // C++17 + + class value_compare + : public __binary_function + { + friend class multimap; + protected: + key_compare comp; + value_compare(key_compare c); + public: + bool operator()(const value_type& x, const value_type& y) const; + }; + + // construct/copy/destroy: + multimap() + noexcept( + is_nothrow_default_constructible::value && + is_nothrow_default_constructible::value && + is_nothrow_copy_constructible::value); + explicit multimap(const key_compare& comp); + multimap(const key_compare& comp, const allocator_type& a); + template + multimap(InputIterator first, InputIterator last, const key_compare& comp); + template + multimap(InputIterator first, InputIterator last, const key_compare& comp, + const allocator_type& a); + multimap(const multimap& m); + multimap(multimap&& m) + noexcept( + is_nothrow_move_constructible::value && + is_nothrow_move_constructible::value); + explicit multimap(const allocator_type& a); + multimap(const multimap& m, const allocator_type& a); + multimap(multimap&& m, const allocator_type& a); + multimap(initializer_list il, const key_compare& comp = key_compare()); + multimap(initializer_list il, const key_compare& comp, + const allocator_type& a); + template + multimap(InputIterator first, InputIterator last, const allocator_type& a) + : multimap(first, last, Compare(), a) {} // C++14 + multimap(initializer_list il, const allocator_type& a) + : multimap(il, Compare(), a) {} // C++14 + ~multimap(); + + multimap& operator=(const multimap& m); + multimap& operator=(multimap&& m) + noexcept( + allocator_type::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable::value && + is_nothrow_move_assignable::value); + multimap& operator=(initializer_list il); + + // iterators: + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; + + reverse_iterator rbegin() noexcept; + const_reverse_iterator rbegin() const noexcept; + reverse_iterator rend() noexcept; + const_reverse_iterator rend() const noexcept; + + const_iterator cbegin() const noexcept; + const_iterator cend() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator crend() const noexcept; + + // capacity: + bool empty() const noexcept; + size_type size() const noexcept; + size_type max_size() const noexcept; + + // modifiers: + template + iterator emplace(Args&&... args); + template + iterator emplace_hint(const_iterator position, Args&&... args); + iterator insert(const value_type& v); + iterator insert( value_type&& v); // C++17 + template + iterator insert(P&& p); + iterator insert(const_iterator position, const value_type& v); + iterator insert(const_iterator position, value_type&& v); // C++17 + template + iterator insert(const_iterator position, P&& p); + template + void insert(InputIterator first, InputIterator last); + void insert(initializer_list il); + + node_type extract(const_iterator position); // C++17 + node_type extract(const key_type& x); // C++17 + iterator insert(node_type&& nh); // C++17 + iterator insert(const_iterator hint, node_type&& nh); // C++17 + + iterator erase(const_iterator position); + iterator erase(iterator position); // C++14 + size_type erase(const key_type& k); + iterator erase(const_iterator first, const_iterator last); + void clear() noexcept; + + template + void merge(multimap& source); // C++17 + template + void merge(multimap&& source); // C++17 + template + void merge(map& source); // C++17 + template + void merge(map&& source); // C++17 + + void swap(multimap& m) + noexcept(allocator_traits::is_always_equal::value && + is_nothrow_swappable::value); // C++17 + + // observers: + allocator_type get_allocator() const noexcept; + key_compare key_comp() const; + value_compare value_comp() const; + + // map operations: + iterator find(const key_type& k); + const_iterator find(const key_type& k) const; + template + iterator find(const K& x); // C++14 + template + const_iterator find(const K& x) const; // C++14 + template + size_type count(const K& x) const; // C++14 + size_type count(const key_type& k) const; + bool contains(const key_type& x) const; // C++20 + iterator lower_bound(const key_type& k); + const_iterator lower_bound(const key_type& k) const; + template + iterator lower_bound(const K& x); // C++14 + template + const_iterator lower_bound(const K& x) const; // C++14 + + iterator upper_bound(const key_type& k); + const_iterator upper_bound(const key_type& k) const; + template + iterator upper_bound(const K& x); // C++14 + template + const_iterator upper_bound(const K& x) const; // C++14 + + pair equal_range(const key_type& k); + pair equal_range(const key_type& k) const; + template + pair equal_range(const K& x); // C++14 + template + pair equal_range(const K& x) const; // C++14 +}; + +template +bool +operator==(const multimap& x, + const multimap& y); + +template +bool +operator< (const multimap& x, + const multimap& y); + +template +bool +operator!=(const multimap& x, + const multimap& y); + +template +bool +operator> (const multimap& x, + const multimap& y); + +template +bool +operator>=(const multimap& x, + const multimap& y); + +template +bool +operator<=(const multimap& x, + const multimap& y); + +// specialized algorithms: +template +void +swap(multimap& x, + multimap& y) + noexcept(noexcept(x.swap(y))); + +template + void erase_if(multimap& c, Predicate pred); // C++20 + +} // std + +*/ + +#include <__config> +#include <__tree> +#include <__node_handle> +#include +#include +#include +#include +#include +#include +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template ::value && !__libcpp_is_final<_Compare>::value> +class __map_value_compare + : private _Compare +{ +public: + _LIBCUDACXX_INLINE_VISIBILITY + __map_value_compare() + noexcept(is_nothrow_default_constructible<_Compare>::value) + : _Compare() {} + _LIBCUDACXX_INLINE_VISIBILITY + __map_value_compare(_Compare c) + noexcept(is_nothrow_copy_constructible<_Compare>::value) + : _Compare(c) {} + _LIBCUDACXX_INLINE_VISIBILITY + const _Compare& key_comp() const noexcept {return *this;} + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()(const _CP& __x, const _CP& __y) const + {return static_cast(*this)(__x.__get_value().first, __y.__get_value().first);} + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()(const _CP& __x, const _Key& __y) const + {return static_cast(*this)(__x.__get_value().first, __y);} + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()(const _Key& __x, const _CP& __y) const + {return static_cast(*this)(__x, __y.__get_value().first);} + void swap(__map_value_compare&__y) + noexcept(__is_nothrow_swappable<_Compare>::value) + { + using _CUDA_VSTD::swap; + swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y)); + } + +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type + operator () ( const _K2& __x, const _CP& __y ) const + {return static_cast(*this) (__x, __y.__get_value().first);} + + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type + operator () (const _CP& __x, const _K2& __y) const + {return static_cast(*this) (__x.__get_value().first, __y);} +#endif +}; + +template +class __map_value_compare<_Key, _CP, _Compare, false> +{ + _Compare comp; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + __map_value_compare() + noexcept(is_nothrow_default_constructible<_Compare>::value) + : comp() {} + _LIBCUDACXX_INLINE_VISIBILITY + __map_value_compare(_Compare c) + noexcept(is_nothrow_copy_constructible<_Compare>::value) + : comp(c) {} + _LIBCUDACXX_INLINE_VISIBILITY + const _Compare& key_comp() const noexcept {return comp;} + + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()(const _CP& __x, const _CP& __y) const + {return comp(__x.__get_value().first, __y.__get_value().first);} + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()(const _CP& __x, const _Key& __y) const + {return comp(__x.__get_value().first, __y);} + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()(const _Key& __x, const _CP& __y) const + {return comp(__x, __y.__get_value().first);} + void swap(__map_value_compare&__y) + noexcept(__is_nothrow_swappable<_Compare>::value) + { + using _CUDA_VSTD::swap; + swap(comp, __y.comp); + } + +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type + operator () ( const _K2& __x, const _CP& __y ) const + {return comp (__x, __y.__get_value().first);} + + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type + operator () (const _CP& __x, const _K2& __y) const + {return comp (__x.__get_value().first, __y);} +#endif +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(__map_value_compare<_Key, _CP, _Compare, __b>& __x, + __map_value_compare<_Key, _CP, _Compare, __b>& __y) + noexcept(noexcept(__x.swap(__y))) +{ + __x.swap(__y); +} + +template +class __map_node_destructor +{ + typedef _Allocator allocator_type; + typedef allocator_traits __alloc_traits; + +public: + typedef typename __alloc_traits::pointer pointer; + +private: + allocator_type& __na_; + + __map_node_destructor& operator=(const __map_node_destructor&); + +public: + bool __first_constructed; + bool __second_constructed; + + _LIBCUDACXX_INLINE_VISIBILITY + explicit __map_node_destructor(allocator_type& __na) noexcept + : __na_(__na), + __first_constructed(false), + __second_constructed(false) + {} + + _LIBCUDACXX_INLINE_VISIBILITY + __map_node_destructor(__tree_node_destructor&& __x) noexcept + : __na_(__x.__na_), + __first_constructed(__x.__value_constructed), + __second_constructed(__x.__value_constructed) + { + __x.__value_constructed = false; + } + + _LIBCUDACXX_INLINE_VISIBILITY + void operator()(pointer __p) noexcept + { + if (__second_constructed) + __alloc_traits::destroy(__na_, _CUDA_VSTD::addressof(__p->__value_.__get_value().second)); + if (__first_constructed) + __alloc_traits::destroy(__na_, _CUDA_VSTD::addressof(__p->__value_.__get_value().first)); + if (__p) + __alloc_traits::deallocate(__na_, __p, 1); + } +}; + +template + class map; +template + class multimap; +template class __map_const_iterator; + +template +struct __value_type +{ + typedef _Key key_type; + typedef _Tp mapped_type; + typedef pair value_type; + typedef pair __nc_ref_pair_type; + typedef pair __nc_rref_pair_type; + +private: + value_type __cc; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + value_type& __get_value() + { +#if _LIBCUDACXX_STD_VER > 14 + return *_CUDA_VSTD::launder(_CUDA_VSTD::addressof(__cc)); +#else + return __cc; +#endif + } + + _LIBCUDACXX_INLINE_VISIBILITY + const value_type& __get_value() const + { +#if _LIBCUDACXX_STD_VER > 14 + return *_CUDA_VSTD::launder(_CUDA_VSTD::addressof(__cc)); +#else + return __cc; +#endif + } + + _LIBCUDACXX_INLINE_VISIBILITY + __nc_ref_pair_type __ref() + { + value_type& __v = __get_value(); + return __nc_ref_pair_type(const_cast(__v.first), __v.second); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __nc_rref_pair_type __move() + { + value_type& __v = __get_value(); + return __nc_rref_pair_type( + _CUDA_VSTD::move(const_cast(__v.first)), + _CUDA_VSTD::move(__v.second)); + } + + _LIBCUDACXX_INLINE_VISIBILITY + __value_type& operator=(const __value_type& __v) + { + __ref() = __v.__get_value(); + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __value_type& operator=(__value_type&& __v) + { + __ref() = __v.__move(); + return *this; + } + + template ::value + >::type + > + _LIBCUDACXX_INLINE_VISIBILITY + __value_type& operator=(_ValueTp&& __v) + { + __ref() = _CUDA_VSTD::forward<_ValueTp>(__v); + return *this; + } + +private: + __value_type() = delete; + ~__value_type() = delete; + __value_type(const __value_type& __v) = delete; + __value_type(__value_type&& __v) = delete; +}; + +#else + +template +struct __value_type +{ + typedef _Key key_type; + typedef _Tp mapped_type; + typedef pair value_type; + +private: + value_type __cc; + +public: + _LIBCUDACXX_INLINE_VISIBILITY + value_type& __get_value() { return __cc; } + _LIBCUDACXX_INLINE_VISIBILITY + const value_type& __get_value() const { return __cc; } + +private: + __value_type(); + __value_type(__value_type const&); + __value_type& operator=(__value_type const&); + ~__value_type(); +}; + +template +struct __extract_key_value_types; + +template +struct __extract_key_value_types<__value_type<_Key, _Tp> > +{ + typedef _Key const __key_type; + typedef _Tp __mapped_type; +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __map_iterator +{ + typedef typename _TreeIterator::_NodeTypes _NodeTypes; + typedef typename _TreeIterator::__pointer_traits __pointer_traits; + + _TreeIterator __i_; + +public: + typedef bidirectional_iterator_tag iterator_category; + typedef typename _NodeTypes::__map_value_type value_type; + typedef typename _TreeIterator::difference_type difference_type; + typedef value_type& reference; + typedef typename _NodeTypes::__map_value_type_pointer pointer; + + _LIBCUDACXX_INLINE_VISIBILITY + __map_iterator() noexcept {} + + _LIBCUDACXX_INLINE_VISIBILITY + __map_iterator(_TreeIterator __i) noexcept : __i_(__i) {} + + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const {return __i_->__get_value();} + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const {return pointer_traits::pointer_to(__i_->__get_value());} + + _LIBCUDACXX_INLINE_VISIBILITY + __map_iterator& operator++() {++__i_; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY + __map_iterator operator++(int) + { + __map_iterator __t(*this); + ++(*this); + return __t; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __map_iterator& operator--() {--__i_; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY + __map_iterator operator--(int) + { + __map_iterator __t(*this); + --(*this); + return __t; + } + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __map_iterator& __x, const __map_iterator& __y) + {return __x.__i_ == __y.__i_;} + friend + _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __map_iterator& __x, const __map_iterator& __y) + {return __x.__i_ != __y.__i_;} + + template friend class _LIBCUDACXX_TEMPLATE_VIS map; + template friend class _LIBCUDACXX_TEMPLATE_VIS multimap; + template friend class _LIBCUDACXX_TEMPLATE_VIS __map_const_iterator; +}; + +template +class _LIBCUDACXX_TEMPLATE_VIS __map_const_iterator +{ + typedef typename _TreeIterator::_NodeTypes _NodeTypes; + typedef typename _TreeIterator::__pointer_traits __pointer_traits; + + _TreeIterator __i_; + +public: + typedef bidirectional_iterator_tag iterator_category; + typedef typename _NodeTypes::__map_value_type value_type; + typedef typename _TreeIterator::difference_type difference_type; + typedef const value_type& reference; + typedef typename _NodeTypes::__const_map_value_type_pointer pointer; + + _LIBCUDACXX_INLINE_VISIBILITY + __map_const_iterator() noexcept {} + + _LIBCUDACXX_INLINE_VISIBILITY + __map_const_iterator(_TreeIterator __i) noexcept : __i_(__i) {} + _LIBCUDACXX_INLINE_VISIBILITY + __map_const_iterator(__map_iterator< + typename _TreeIterator::__non_const_iterator> __i) noexcept + : __i_(__i.__i_) {} + + _LIBCUDACXX_INLINE_VISIBILITY + reference operator*() const {return __i_->__get_value();} + _LIBCUDACXX_INLINE_VISIBILITY + pointer operator->() const {return pointer_traits::pointer_to(__i_->__get_value());} + + _LIBCUDACXX_INLINE_VISIBILITY + __map_const_iterator& operator++() {++__i_; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY + __map_const_iterator operator++(int) + { + __map_const_iterator __t(*this); + ++(*this); + return __t; + } + + _LIBCUDACXX_INLINE_VISIBILITY + __map_const_iterator& operator--() {--__i_; return *this;} + _LIBCUDACXX_INLINE_VISIBILITY + __map_const_iterator operator--(int) + { + __map_const_iterator __t(*this); + --(*this); + return __t; + } + + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y) + {return __x.__i_ == __y.__i_;} + friend _LIBCUDACXX_INLINE_VISIBILITY + bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) + {return __x.__i_ != __y.__i_;} + + template friend class _LIBCUDACXX_TEMPLATE_VIS map; + template friend class _LIBCUDACXX_TEMPLATE_VIS multimap; + template friend class _LIBCUDACXX_TEMPLATE_VIS __tree_const_iterator; +}; + +template , + class _Allocator = allocator > > +class _LIBCUDACXX_TEMPLATE_VIS map +{ +public: + // types: + typedef _Key key_type; + typedef _Tp mapped_type; + typedef pair value_type; + typedef __type_identity_t<_Compare> key_compare; + typedef __type_identity_t<_Allocator> allocator_type; + typedef value_type& reference; + typedef const value_type& const_reference; + + static_assert((is_same::value), + "Allocator::value_type must be same type as value_type"); + + class _LIBCUDACXX_TEMPLATE_VIS value_compare + : public __binary_function + { + friend class map; + protected: + key_compare comp; + + _LIBCUDACXX_INLINE_VISIBILITY value_compare(key_compare c) : comp(c) {} + public: + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()(const value_type& __x, const value_type& __y) const + {return comp(__x.first, __y.first);} + }; + +private: + + typedef _CUDA_VSTD::__value_type __value_type; + typedef __map_value_compare __vc; + typedef typename __rebind_alloc_helper, + __value_type>::type __allocator_type; + typedef __tree<__value_type, __vc, __allocator_type> __base; + typedef typename __base::__node_traits __node_traits; + typedef allocator_traits __alloc_traits; + + __base __tree_; + +public: + typedef typename __alloc_traits::pointer pointer; + typedef typename __alloc_traits::const_pointer const_pointer; + typedef typename __alloc_traits::size_type size_type; + typedef typename __alloc_traits::difference_type difference_type; + typedef __map_iterator iterator; + typedef __map_const_iterator const_iterator; + typedef _CUDA_VSTD::reverse_iterator reverse_iterator; + typedef _CUDA_VSTD::reverse_iterator const_reverse_iterator; + +#if _LIBCUDACXX_STD_VER > 14 + typedef __map_node_handle node_type; + typedef __insert_return_type insert_return_type; +#endif + + template + friend class _LIBCUDACXX_TEMPLATE_VIS map; + template + friend class _LIBCUDACXX_TEMPLATE_VIS multimap; + + _LIBCUDACXX_INLINE_VISIBILITY + map() + noexcept( + is_nothrow_default_constructible::value && + is_nothrow_default_constructible::value && + is_nothrow_copy_constructible::value) + : __tree_(__vc(key_compare())) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit map(const key_compare& __comp) + noexcept( + is_nothrow_default_constructible::value && + is_nothrow_copy_constructible::value) + : __tree_(__vc(__comp)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit map(const key_compare& __comp, const allocator_type& __a) + : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {} + + template + _LIBCUDACXX_INLINE_VISIBILITY + map(_InputIterator __f, _InputIterator __l, + const key_compare& __comp = key_compare()) + : __tree_(__vc(__comp)) + { + insert(__f, __l); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + map(_InputIterator __f, _InputIterator __l, + const key_compare& __comp, const allocator_type& __a) + : __tree_(__vc(__comp), typename __base::allocator_type(__a)) + { + insert(__f, __l); + } + +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + map(_InputIterator __f, _InputIterator __l, const allocator_type& __a) + : map(__f, __l, key_compare(), __a) {} +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + map(const map& __m) + : __tree_(__m.__tree_) + { + insert(__m.begin(), __m.end()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + map& operator=(const map& __m) + { + __tree_ = __m.__tree_; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + map(map&& __m) + noexcept(is_nothrow_move_constructible<__base>::value) + : __tree_(_CUDA_VSTD::move(__m.__tree_)) + { + } + + map(map&& __m, const allocator_type& __a); + + _LIBCUDACXX_INLINE_VISIBILITY + map& operator=(map&& __m) + noexcept(is_nothrow_move_assignable<__base>::value) + { + __tree_ = _CUDA_VSTD::move(__m.__tree_); + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + map(initializer_list __il, const key_compare& __comp = key_compare()) + : __tree_(__vc(__comp)) + { + insert(__il.begin(), __il.end()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + map(initializer_list __il, const key_compare& __comp, const allocator_type& __a) + : __tree_(__vc(__comp), typename __base::allocator_type(__a)) + { + insert(__il.begin(), __il.end()); + } + +#if _LIBCUDACXX_STD_VER > 11 + _LIBCUDACXX_INLINE_VISIBILITY + map(initializer_list __il, const allocator_type& __a) + : map(__il, key_compare(), __a) {} +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + map& operator=(initializer_list __il) + { + __tree_.__assign_unique(__il.begin(), __il.end()); + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + explicit map(const allocator_type& __a) + : __tree_(typename __base::allocator_type(__a)) + { + } + + _LIBCUDACXX_INLINE_VISIBILITY + map(const map& __m, const allocator_type& __a) + : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) + { + insert(__m.begin(), __m.end()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + ~map() { + static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator begin() noexcept {return __tree_.begin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator begin() const noexcept {return __tree_.begin();} + _LIBCUDACXX_INLINE_VISIBILITY + iterator end() noexcept {return __tree_.end();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator end() const noexcept {return __tree_.end();} + + _LIBCUDACXX_INLINE_VISIBILITY + reverse_iterator rbegin() noexcept {return reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator rbegin() const noexcept + {return const_reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY + reverse_iterator rend() noexcept + {return reverse_iterator(begin());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator rend() const noexcept + {return const_reverse_iterator(begin());} + + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cbegin() const noexcept {return begin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cend() const noexcept {return end();} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator crbegin() const noexcept {return rbegin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator crend() const noexcept {return rend();} + + _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY + bool empty() const noexcept {return __tree_.size() == 0;} + _LIBCUDACXX_INLINE_VISIBILITY + size_type size() const noexcept {return __tree_.size();} + _LIBCUDACXX_INLINE_VISIBILITY + size_type max_size() const noexcept {return __tree_.max_size();} + + mapped_type& operator[](const key_type& __k); + mapped_type& operator[](key_type&& __k); + + mapped_type& at(const key_type& __k); + const mapped_type& at(const key_type& __k) const; + + _LIBCUDACXX_INLINE_VISIBILITY + allocator_type get_allocator() const noexcept {return allocator_type(__tree_.__alloc());} + _LIBCUDACXX_INLINE_VISIBILITY + key_compare key_comp() const {return __tree_.value_comp().key_comp();} + _LIBCUDACXX_INLINE_VISIBILITY + value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());} + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair emplace(_Args&& ...__args) { + return __tree_.__emplace_unique(_CUDA_VSTD::forward<_Args>(__args)...); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator emplace_hint(const_iterator __p, _Args&& ...__args) { + return __tree_.__emplace_hint_unique(__p.__i_, _CUDA_VSTD::forward<_Args>(__args)...); + } + + template ::value>::type> + _LIBCUDACXX_INLINE_VISIBILITY + pair insert(_Pp&& __p) + {return __tree_.__insert_unique(_CUDA_VSTD::forward<_Pp>(__p));} + + template ::value>::type> + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(const_iterator __pos, _Pp&& __p) + {return __tree_.__insert_unique(__pos.__i_, _CUDA_VSTD::forward<_Pp>(__p));} + + _LIBCUDACXX_INLINE_VISIBILITY + pair + insert(const value_type& __v) {return __tree_.__insert_unique(__v);} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator + insert(const_iterator __p, const value_type& __v) + {return __tree_.__insert_unique(__p.__i_, __v);} + + _LIBCUDACXX_INLINE_VISIBILITY + pair + insert(value_type&& __v) {return __tree_.__insert_unique(_CUDA_VSTD::move(__v));} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(const_iterator __p, value_type&& __v) + {return __tree_.__insert_unique(__p.__i_, _CUDA_VSTD::move(__v));} + + _LIBCUDACXX_INLINE_VISIBILITY + void insert(initializer_list __il) + {insert(__il.begin(), __il.end());} + + template + _LIBCUDACXX_INLINE_VISIBILITY + void insert(_InputIterator __f, _InputIterator __l) + { + for (const_iterator __e = cend(); __f != __l; ++__f) + insert(__e.__i_, *__f); + } + +#if _LIBCUDACXX_STD_VER > 14 + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair try_emplace(const key_type& __k, _Args&&... __args) + { + return __tree_.__emplace_unique_key_args(__k, + _CUDA_VSTD::piecewise_construct, + _CUDA_VSTD::forward_as_tuple(__k), + _CUDA_VSTD::forward_as_tuple(_CUDA_VSTD::forward<_Args>(__args)...)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair try_emplace(key_type&& __k, _Args&&... __args) + { + return __tree_.__emplace_unique_key_args(__k, + _CUDA_VSTD::piecewise_construct, + _CUDA_VSTD::forward_as_tuple(_CUDA_VSTD::move(__k)), + _CUDA_VSTD::forward_as_tuple(_CUDA_VSTD::forward<_Args>(__args)...)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) + { + return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k, + _CUDA_VSTD::piecewise_construct, + _CUDA_VSTD::forward_as_tuple(__k), + _CUDA_VSTD::forward_as_tuple(_CUDA_VSTD::forward<_Args>(__args)...)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) + { + return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k, + _CUDA_VSTD::piecewise_construct, + _CUDA_VSTD::forward_as_tuple(_CUDA_VSTD::move(__k)), + _CUDA_VSTD::forward_as_tuple(_CUDA_VSTD::forward<_Args>(__args)...)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair insert_or_assign(const key_type& __k, _Vp&& __v) + { + iterator __p = lower_bound(__k); + if ( __p != end() && !key_comp()(__k, __p->first)) + { + __p->second = _CUDA_VSTD::forward<_Vp>(__v); + return _CUDA_VSTD::make_pair(__p, false); + } + return _CUDA_VSTD::make_pair(emplace_hint(__p, __k, _CUDA_VSTD::forward<_Vp>(__v)), true); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + pair insert_or_assign(key_type&& __k, _Vp&& __v) + { + iterator __p = lower_bound(__k); + if ( __p != end() && !key_comp()(__k, __p->first)) + { + __p->second = _CUDA_VSTD::forward<_Vp>(__v); + return _CUDA_VSTD::make_pair(__p, false); + } + return _CUDA_VSTD::make_pair(emplace_hint(__p, _CUDA_VSTD::move(__k), _CUDA_VSTD::forward<_Vp>(__v)), true); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) + { + iterator __p = lower_bound(__k); + if ( __p != end() && !key_comp()(__k, __p->first)) + { + __p->second = _CUDA_VSTD::forward<_Vp>(__v); + return __p; + } + return emplace_hint(__h, __k, _CUDA_VSTD::forward<_Vp>(__v)); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) + { + iterator __p = lower_bound(__k); + if ( __p != end() && !key_comp()(__k, __p->first)) + { + __p->second = _CUDA_VSTD::forward<_Vp>(__v); + return __p; + } + return emplace_hint(__h, _CUDA_VSTD::move(__k), _CUDA_VSTD::forward<_Vp>(__v)); + } + +#endif // _LIBCUDACXX_STD_VER > 14 + + _LIBCUDACXX_INLINE_VISIBILITY + iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} + _LIBCUDACXX_INLINE_VISIBILITY + iterator erase(iterator __p) {return __tree_.erase(__p.__i_);} + _LIBCUDACXX_INLINE_VISIBILITY + size_type erase(const key_type& __k) + {return __tree_.__erase_unique(__k);} + _LIBCUDACXX_INLINE_VISIBILITY + iterator erase(const_iterator __f, const_iterator __l) + {return __tree_.erase(__f.__i_, __l.__i_);} + _LIBCUDACXX_INLINE_VISIBILITY + void clear() noexcept {__tree_.clear();} + +#if _LIBCUDACXX_STD_VER > 14 + _LIBCUDACXX_INLINE_VISIBILITY + insert_return_type insert(node_type&& __nh) + { + _LIBCUDACXX_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + "node_type with incompatible allocator passed to map::insert()"); + return __tree_.template __node_handle_insert_unique< + node_type, insert_return_type>(_CUDA_VSTD::move(__nh)); + } + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(const_iterator __hint, node_type&& __nh) + { + _LIBCUDACXX_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + "node_type with incompatible allocator passed to map::insert()"); + return __tree_.template __node_handle_insert_unique( + __hint.__i_, _CUDA_VSTD::move(__nh)); + } + _LIBCUDACXX_INLINE_VISIBILITY + node_type extract(key_type const& __key) + { + return __tree_.template __node_handle_extract(__key); + } + _LIBCUDACXX_INLINE_VISIBILITY + node_type extract(const_iterator __it) + { + return __tree_.template __node_handle_extract(__it.__i_); + } + template + _LIBCUDACXX_INLINE_VISIBILITY + void merge(map& __source) + { + _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); + __tree_.__node_handle_merge_unique(__source.__tree_); + } + template + _LIBCUDACXX_INLINE_VISIBILITY + void merge(map&& __source) + { + _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); + __tree_.__node_handle_merge_unique(__source.__tree_); + } + template + _LIBCUDACXX_INLINE_VISIBILITY + void merge(multimap& __source) + { + _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); + __tree_.__node_handle_merge_unique(__source.__tree_); + } + template + _LIBCUDACXX_INLINE_VISIBILITY + void merge(multimap&& __source) + { + _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); + __tree_.__node_handle_merge_unique(__source.__tree_); + } +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(map& __m) + noexcept(__is_nothrow_swappable<__base>::value) + {__tree_.swap(__m.__tree_);} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator find(const key_type& __k) {return __tree_.find(__k);} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator find(const key_type& __k) const {return __tree_.find(__k);} +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type + find(const _K2& __k) {return __tree_.find(__k);} + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type + find(const _K2& __k) const {return __tree_.find(__k);} +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + size_type count(const key_type& __k) const + {return __tree_.__count_unique(__k);} +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type + count(const _K2& __k) const {return __tree_.__count_multi(__k);} +#endif + +#if _LIBCUDACXX_STD_VER > 17 + _LIBCUDACXX_INLINE_VISIBILITY + bool contains(const key_type& __k) const {return find(__k) != end();} +#endif // _LIBCUDACXX_STD_VER > 17 + + _LIBCUDACXX_INLINE_VISIBILITY + iterator lower_bound(const key_type& __k) + {return __tree_.lower_bound(__k);} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator lower_bound(const key_type& __k) const + {return __tree_.lower_bound(__k);} +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type + lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} + + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type + lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + iterator upper_bound(const key_type& __k) + {return __tree_.upper_bound(__k);} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator upper_bound(const key_type& __k) const + {return __tree_.upper_bound(__k);} +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type + upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type + upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + pair equal_range(const key_type& __k) + {return __tree_.__equal_range_unique(__k);} + _LIBCUDACXX_INLINE_VISIBILITY + pair equal_range(const key_type& __k) const + {return __tree_.__equal_range_unique(__k);} +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type + equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type + equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} +#endif + +private: + typedef typename __base::__node __node; + typedef typename __base::__node_allocator __node_allocator; + typedef typename __base::__node_pointer __node_pointer; + typedef typename __base::__node_base_pointer __node_base_pointer; + typedef typename __base::__parent_pointer __parent_pointer; + + typedef __map_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; +}; + +#ifndef _LIBCUDACXX_HAS_NO_DEDUCTION_GUIDES +template>, + class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>, + class = _EnableIf::value, void>, + class = _EnableIf<__is_allocator<_Allocator>::value, void>> +map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) + -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>; + +template>, + class _Allocator = allocator>, + class = _EnableIf::value, void>, + class = _EnableIf<__is_allocator<_Allocator>::value, void>> +map(initializer_list>, _Compare = _Compare(), _Allocator = _Allocator()) + -> map, _Tp, _Compare, _Allocator>; + +template::value, void>> +map(_InputIterator, _InputIterator, _Allocator) + -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, + less<__iter_key_type<_InputIterator>>, _Allocator>; + +template::value, void>> +map(initializer_list>, _Allocator) + -> map, _Tp, less>, _Allocator>; +#endif + +template +map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a) + : __tree_(_CUDA_VSTD::move(__m.__tree_), typename __base::allocator_type(__a)) +{ + if (__a != __m.get_allocator()) + { + const_iterator __e = cend(); + while (!__m.empty()) + __tree_.__insert_unique(__e.__i_, + __m.__tree_.remove(__m.begin().__i_)->__value_.__move()); + } +} + +template +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) +{ + return __tree_.__emplace_unique_key_args(__k, + _CUDA_VSTD::piecewise_construct, + _CUDA_VSTD::forward_as_tuple(__k), + _CUDA_VSTD::forward_as_tuple()).first->__get_value().second; +} + +template +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) +{ + return __tree_.__emplace_unique_key_args(__k, + _CUDA_VSTD::piecewise_construct, + _CUDA_VSTD::forward_as_tuple(_CUDA_VSTD::move(__k)), + _CUDA_VSTD::forward_as_tuple()).first->__get_value().second; +} + +template +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) +{ + __parent_pointer __parent; + __node_base_pointer& __child = __tree_.__find_equal(__parent, __k); + if (__child == nullptr) + __throw_out_of_range("map::at: key not found"); + return static_cast<__node_pointer>(__child)->__value_.__get_value().second; +} + +template +const _Tp& +map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const +{ + __parent_pointer __parent; + __node_base_pointer __child = __tree_.__find_equal(__parent, __k); + if (__child == nullptr) + __throw_out_of_range("map::at: key not found"); + return static_cast<__node_pointer>(__child)->__value_.__get_value().second; +} + + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, + const map<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return __x.size() == __y.size() && _CUDA_VSTD::equal(__x.begin(), __x.end(), __y.begin()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x, + const map<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return _CUDA_VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x, + const map<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return !(__x == __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x, + const map<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return __y < __x; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x, + const map<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return !(__x < __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, + const map<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return !(__y < __x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(map<_Key, _Tp, _Compare, _Allocator>& __x, + map<_Key, _Tp, _Compare, _Allocator>& __y) + noexcept(noexcept(__x.swap(__y))) +{ + __x.swap(__y); +} + +#if _LIBCUDACXX_STD_VER > 17 +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) +{ __libcpp_erase_if_container(__c, __pred); } +#endif + + +template , + class _Allocator = allocator > > +class _LIBCUDACXX_TEMPLATE_VIS multimap +{ +public: + // types: + typedef _Key key_type; + typedef _Tp mapped_type; + typedef pair value_type; + typedef __type_identity_t<_Compare> key_compare; + typedef __type_identity_t<_Allocator> allocator_type; + typedef value_type& reference; + typedef const value_type& const_reference; + + static_assert((is_same::value), + "Allocator::value_type must be same type as value_type"); + + class _LIBCUDACXX_TEMPLATE_VIS value_compare + : public __binary_function + { + friend class multimap; + protected: + key_compare comp; + + _LIBCUDACXX_INLINE_VISIBILITY + value_compare(key_compare c) : comp(c) {} + public: + _LIBCUDACXX_INLINE_VISIBILITY + bool operator()(const value_type& __x, const value_type& __y) const + {return comp(__x.first, __y.first);} + }; + +private: + + typedef _CUDA_VSTD::__value_type __value_type; + typedef __map_value_compare __vc; + typedef typename __rebind_alloc_helper, + __value_type>::type __allocator_type; + typedef __tree<__value_type, __vc, __allocator_type> __base; + typedef typename __base::__node_traits __node_traits; + typedef allocator_traits __alloc_traits; + + __base __tree_; + +public: + typedef typename __alloc_traits::pointer pointer; + typedef typename __alloc_traits::const_pointer const_pointer; + typedef typename __alloc_traits::size_type size_type; + typedef typename __alloc_traits::difference_type difference_type; + typedef __map_iterator iterator; + typedef __map_const_iterator const_iterator; + typedef _CUDA_VSTD::reverse_iterator reverse_iterator; + typedef _CUDA_VSTD::reverse_iterator const_reverse_iterator; + +#if _LIBCUDACXX_STD_VER > 14 + typedef __map_node_handle node_type; +#endif + + template + friend class _LIBCUDACXX_TEMPLATE_VIS map; + template + friend class _LIBCUDACXX_TEMPLATE_VIS multimap; + + _LIBCUDACXX_INLINE_VISIBILITY + multimap() + noexcept( + is_nothrow_default_constructible::value && + is_nothrow_default_constructible::value && + is_nothrow_copy_constructible::value) + : __tree_(__vc(key_compare())) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit multimap(const key_compare& __comp) + noexcept( + is_nothrow_default_constructible::value && + is_nothrow_copy_constructible::value) + : __tree_(__vc(__comp)) {} + + _LIBCUDACXX_INLINE_VISIBILITY + explicit multimap(const key_compare& __comp, const allocator_type& __a) + : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {} + + template + _LIBCUDACXX_INLINE_VISIBILITY + multimap(_InputIterator __f, _InputIterator __l, + const key_compare& __comp = key_compare()) + : __tree_(__vc(__comp)) + { + insert(__f, __l); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + multimap(_InputIterator __f, _InputIterator __l, + const key_compare& __comp, const allocator_type& __a) + : __tree_(__vc(__comp), typename __base::allocator_type(__a)) + { + insert(__f, __l); + } + +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a) + : multimap(__f, __l, key_compare(), __a) {} +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + multimap(const multimap& __m) + : __tree_(__m.__tree_.value_comp(), + __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc())) + { + insert(__m.begin(), __m.end()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + multimap& operator=(const multimap& __m) + { + __tree_ = __m.__tree_; + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + multimap(multimap&& __m) + noexcept(is_nothrow_move_constructible<__base>::value) + : __tree_(_CUDA_VSTD::move(__m.__tree_)) + { + } + + multimap(multimap&& __m, const allocator_type& __a); + + _LIBCUDACXX_INLINE_VISIBILITY + multimap& operator=(multimap&& __m) + noexcept(is_nothrow_move_assignable<__base>::value) + { + __tree_ = _CUDA_VSTD::move(__m.__tree_); + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + multimap(initializer_list __il, const key_compare& __comp = key_compare()) + : __tree_(__vc(__comp)) + { + insert(__il.begin(), __il.end()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + multimap(initializer_list __il, const key_compare& __comp, const allocator_type& __a) + : __tree_(__vc(__comp), typename __base::allocator_type(__a)) + { + insert(__il.begin(), __il.end()); + } + +#if _LIBCUDACXX_STD_VER > 11 + _LIBCUDACXX_INLINE_VISIBILITY + multimap(initializer_list __il, const allocator_type& __a) + : multimap(__il, key_compare(), __a) {} +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + multimap& operator=(initializer_list __il) + { + __tree_.__assign_multi(__il.begin(), __il.end()); + return *this; + } + + _LIBCUDACXX_INLINE_VISIBILITY + explicit multimap(const allocator_type& __a) + : __tree_(typename __base::allocator_type(__a)) + { + } + + _LIBCUDACXX_INLINE_VISIBILITY + multimap(const multimap& __m, const allocator_type& __a) + : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) + { + insert(__m.begin(), __m.end()); + } + + _LIBCUDACXX_INLINE_VISIBILITY + ~multimap() { + static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator begin() noexcept {return __tree_.begin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator begin() const noexcept {return __tree_.begin();} + _LIBCUDACXX_INLINE_VISIBILITY + iterator end() noexcept {return __tree_.end();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator end() const noexcept {return __tree_.end();} + + _LIBCUDACXX_INLINE_VISIBILITY + reverse_iterator rbegin() noexcept {return reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator rbegin() const noexcept + {return const_reverse_iterator(end());} + _LIBCUDACXX_INLINE_VISIBILITY + reverse_iterator rend() noexcept {return reverse_iterator(begin());} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator rend() const noexcept + {return const_reverse_iterator(begin());} + + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cbegin() const noexcept {return begin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator cend() const noexcept {return end();} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator crbegin() const noexcept {return rbegin();} + _LIBCUDACXX_INLINE_VISIBILITY + const_reverse_iterator crend() const noexcept {return rend();} + + _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY + bool empty() const noexcept {return __tree_.size() == 0;} + _LIBCUDACXX_INLINE_VISIBILITY + size_type size() const noexcept {return __tree_.size();} + _LIBCUDACXX_INLINE_VISIBILITY + size_type max_size() const noexcept {return __tree_.max_size();} + + _LIBCUDACXX_INLINE_VISIBILITY + allocator_type get_allocator() const noexcept {return allocator_type(__tree_.__alloc());} + _LIBCUDACXX_INLINE_VISIBILITY + key_compare key_comp() const {return __tree_.value_comp().key_comp();} + _LIBCUDACXX_INLINE_VISIBILITY + value_compare value_comp() const + {return value_compare(__tree_.value_comp().key_comp());} + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator emplace(_Args&& ...__args) { + return __tree_.__emplace_multi(_CUDA_VSTD::forward<_Args>(__args)...); + } + + template + _LIBCUDACXX_INLINE_VISIBILITY + iterator emplace_hint(const_iterator __p, _Args&& ...__args) { + return __tree_.__emplace_hint_multi(__p.__i_, _CUDA_VSTD::forward<_Args>(__args)...); + } + + template ::value>::type> + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(_Pp&& __p) + {return __tree_.__insert_multi(_CUDA_VSTD::forward<_Pp>(__p));} + + template ::value>::type> + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(const_iterator __pos, _Pp&& __p) + {return __tree_.__insert_multi(__pos.__i_, _CUDA_VSTD::forward<_Pp>(__p));} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(value_type&& __v) + {return __tree_.__insert_multi(_CUDA_VSTD::move(__v));} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(const_iterator __p, value_type&& __v) + {return __tree_.__insert_multi(__p.__i_, _CUDA_VSTD::move(__v));} + + + _LIBCUDACXX_INLINE_VISIBILITY + void insert(initializer_list __il) + {insert(__il.begin(), __il.end());} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(const_iterator __p, const value_type& __v) + {return __tree_.__insert_multi(__p.__i_, __v);} + + template + _LIBCUDACXX_INLINE_VISIBILITY + void insert(_InputIterator __f, _InputIterator __l) + { + for (const_iterator __e = cend(); __f != __l; ++__f) + __tree_.__insert_multi(__e.__i_, *__f); + } + + _LIBCUDACXX_INLINE_VISIBILITY + iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} + _LIBCUDACXX_INLINE_VISIBILITY + iterator erase(iterator __p) {return __tree_.erase(__p.__i_);} + _LIBCUDACXX_INLINE_VISIBILITY + size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);} + _LIBCUDACXX_INLINE_VISIBILITY + iterator erase(const_iterator __f, const_iterator __l) + {return __tree_.erase(__f.__i_, __l.__i_);} + +#if _LIBCUDACXX_STD_VER > 14 + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(node_type&& __nh) + { + _LIBCUDACXX_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + "node_type with incompatible allocator passed to multimap::insert()"); + return __tree_.template __node_handle_insert_multi( + _CUDA_VSTD::move(__nh)); + } + _LIBCUDACXX_INLINE_VISIBILITY + iterator insert(const_iterator __hint, node_type&& __nh) + { + _LIBCUDACXX_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + "node_type with incompatible allocator passed to multimap::insert()"); + return __tree_.template __node_handle_insert_multi( + __hint.__i_, _CUDA_VSTD::move(__nh)); + } + _LIBCUDACXX_INLINE_VISIBILITY + node_type extract(key_type const& __key) + { + return __tree_.template __node_handle_extract(__key); + } + _LIBCUDACXX_INLINE_VISIBILITY + node_type extract(const_iterator __it) + { + return __tree_.template __node_handle_extract( + __it.__i_); + } + template + _LIBCUDACXX_INLINE_VISIBILITY + void merge(multimap& __source) + { + _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); + return __tree_.__node_handle_merge_multi(__source.__tree_); + } + template + _LIBCUDACXX_INLINE_VISIBILITY + void merge(multimap&& __source) + { + _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); + return __tree_.__node_handle_merge_multi(__source.__tree_); + } + template + _LIBCUDACXX_INLINE_VISIBILITY + void merge(map& __source) + { + _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); + return __tree_.__node_handle_merge_multi(__source.__tree_); + } + template + _LIBCUDACXX_INLINE_VISIBILITY + void merge(map&& __source) + { + _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); + return __tree_.__node_handle_merge_multi(__source.__tree_); + } +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + void clear() noexcept {__tree_.clear();} + + _LIBCUDACXX_INLINE_VISIBILITY + void swap(multimap& __m) + noexcept(__is_nothrow_swappable<__base>::value) + {__tree_.swap(__m.__tree_);} + + _LIBCUDACXX_INLINE_VISIBILITY + iterator find(const key_type& __k) {return __tree_.find(__k);} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator find(const key_type& __k) const {return __tree_.find(__k);} +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type + find(const _K2& __k) {return __tree_.find(__k);} + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type + find(const _K2& __k) const {return __tree_.find(__k);} +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + size_type count(const key_type& __k) const + {return __tree_.__count_multi(__k);} +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type + count(const _K2& __k) const {return __tree_.__count_multi(__k);} +#endif + +#if _LIBCUDACXX_STD_VER > 17 + _LIBCUDACXX_INLINE_VISIBILITY + bool contains(const key_type& __k) const {return find(__k) != end();} +#endif // _LIBCUDACXX_STD_VER > 17 + + _LIBCUDACXX_INLINE_VISIBILITY + iterator lower_bound(const key_type& __k) + {return __tree_.lower_bound(__k);} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator lower_bound(const key_type& __k) const + {return __tree_.lower_bound(__k);} +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type + lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} + + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type + lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + iterator upper_bound(const key_type& __k) + {return __tree_.upper_bound(__k);} + _LIBCUDACXX_INLINE_VISIBILITY + const_iterator upper_bound(const key_type& __k) const + {return __tree_.upper_bound(__k);} +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type + upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type + upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} +#endif + + _LIBCUDACXX_INLINE_VISIBILITY + pair equal_range(const key_type& __k) + {return __tree_.__equal_range_multi(__k);} + _LIBCUDACXX_INLINE_VISIBILITY + pair equal_range(const key_type& __k) const + {return __tree_.__equal_range_multi(__k);} +#if _LIBCUDACXX_STD_VER > 11 + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type + equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} + template + _LIBCUDACXX_INLINE_VISIBILITY + typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type + equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} +#endif + +private: + typedef typename __base::__node __node; + typedef typename __base::__node_allocator __node_allocator; + typedef typename __base::__node_pointer __node_pointer; + + typedef __map_node_destructor<__node_allocator> _Dp; + typedef unique_ptr<__node, _Dp> __node_holder; +}; + +#ifndef _LIBCUDACXX_HAS_NO_DEDUCTION_GUIDES +template>, + class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>, + class = _EnableIf::value, void>, + class = _EnableIf<__is_allocator<_Allocator>::value, void>> +multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) + -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>; + +template>, + class _Allocator = allocator>, + class = _EnableIf::value, void>, + class = _EnableIf<__is_allocator<_Allocator>::value, void>> +multimap(initializer_list>, _Compare = _Compare(), _Allocator = _Allocator()) + -> multimap, _Tp, _Compare, _Allocator>; + +template::value, void>> +multimap(_InputIterator, _InputIterator, _Allocator) + -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, + less<__iter_key_type<_InputIterator>>, _Allocator>; + +template::value, void>> +multimap(initializer_list>, _Allocator) + -> multimap, _Tp, less>, _Allocator>; +#endif + +template +multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a) + : __tree_(_CUDA_VSTD::move(__m.__tree_), typename __base::allocator_type(__a)) +{ + if (__a != __m.get_allocator()) + { + const_iterator __e = cend(); + while (!__m.empty()) + __tree_.__insert_multi(__e.__i_, + _CUDA_VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__move())); + } +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, + const multimap<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return __x.size() == __y.size() && _CUDA_VSTD::equal(__x.begin(), __x.end(), __y.begin()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x, + const multimap<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return _CUDA_VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, + const multimap<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return !(__x == __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x, + const multimap<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return __y < __x; +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, + const multimap<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return !(__x < __y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, + const multimap<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return !(__y < __x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void +swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, + multimap<_Key, _Tp, _Compare, _Allocator>& __y) + noexcept(noexcept(__x.swap(__y))) +{ + __x.swap(__y); +} + +#if _LIBCUDACXX_STD_VER > 17 +template +inline _LIBCUDACXX_INLINE_VISIBILITY +void erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) +{ __libcpp_erase_if_container(__c, __pred); } +#endif + +_LIBCUDACXX_END_NAMESPACE_STD + +#endif // _LIBCUDACXX_MAP diff --git a/cuda_toolkit/include/math.h b/cuda_toolkit/include/math.h new file mode 100644 index 0000000000000000000000000000000000000000..1593af9a2ba63a57fefa7dd9d117845c32272f7b --- /dev/null +++ b/cuda_toolkit/include/math.h @@ -0,0 +1,1578 @@ +// -*- C++ -*- +//===---------------------------- math.h ----------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_MATH_H +#define _LIBCUDACXX_MATH_H + +/* + math.h synopsis + +Macros: + + HUGE_VAL + HUGE_VALF // C99 + HUGE_VALL // C99 + INFINITY // C99 + NAN // C99 + FP_INFINITE // C99 + FP_NAN // C99 + FP_NORMAL // C99 + FP_SUBNORMAL // C99 + FP_ZERO // C99 + FP_FAST_FMA // C99 + FP_FAST_FMAF // C99 + FP_FAST_FMAL // C99 + FP_ILOGB0 // C99 + FP_ILOGBNAN // C99 + MATH_ERRNO // C99 + MATH_ERREXCEPT // C99 + math_errhandling // C99 + +Types: + + float_t // C99 + double_t // C99 + +// C90 + +floating_point abs(floating_point x); + +floating_point acos (arithmetic x); +float acosf(float x); +long double acosl(long double x); + +floating_point asin (arithmetic x); +float asinf(float x); +long double asinl(long double x); + +floating_point atan (arithmetic x); +float atanf(float x); +long double atanl(long double x); + +floating_point atan2 (arithmetic y, arithmetic x); +float atan2f(float y, float x); +long double atan2l(long double y, long double x); + +floating_point ceil (arithmetic x); +float ceilf(float x); +long double ceill(long double x); + +floating_point cos (arithmetic x); +float cosf(float x); +long double cosl(long double x); + +floating_point cosh (arithmetic x); +float coshf(float x); +long double coshl(long double x); + +floating_point exp (arithmetic x); +float expf(float x); +long double expl(long double x); + +floating_point fabs (arithmetic x); +float fabsf(float x); +long double fabsl(long double x); + +floating_point floor (arithmetic x); +float floorf(float x); +long double floorl(long double x); + +floating_point fmod (arithmetic x, arithmetic y); +float fmodf(float x, float y); +long double fmodl(long double x, long double y); + +floating_point frexp (arithmetic value, int* exp); +float frexpf(float value, int* exp); +long double frexpl(long double value, int* exp); + +floating_point ldexp (arithmetic value, int exp); +float ldexpf(float value, int exp); +long double ldexpl(long double value, int exp); + +floating_point log (arithmetic x); +float logf(float x); +long double logl(long double x); + +floating_point log10 (arithmetic x); +float log10f(float x); +long double log10l(long double x); + +floating_point modf (floating_point value, floating_point* iptr); +float modff(float value, float* iptr); +long double modfl(long double value, long double* iptr); + +floating_point pow (arithmetic x, arithmetic y); +float powf(float x, float y); +long double powl(long double x, long double y); + +floating_point sin (arithmetic x); +float sinf(float x); +long double sinl(long double x); + +floating_point sinh (arithmetic x); +float sinhf(float x); +long double sinhl(long double x); + +floating_point sqrt (arithmetic x); +float sqrtf(float x); +long double sqrtl(long double x); + +floating_point tan (arithmetic x); +float tanf(float x); +long double tanl(long double x); + +floating_point tanh (arithmetic x); +float tanhf(float x); +long double tanhl(long double x); + +// C99 + +bool signbit(arithmetic x); + +int fpclassify(arithmetic x); + +bool isfinite(arithmetic x); +bool isinf(arithmetic x); +bool isnan(arithmetic x); +bool isnormal(arithmetic x); + +bool isgreater(arithmetic x, arithmetic y); +bool isgreaterequal(arithmetic x, arithmetic y); +bool isless(arithmetic x, arithmetic y); +bool islessequal(arithmetic x, arithmetic y); +bool islessgreater(arithmetic x, arithmetic y); +bool isunordered(arithmetic x, arithmetic y); + +floating_point acosh (arithmetic x); +float acoshf(float x); +long double acoshl(long double x); + +floating_point asinh (arithmetic x); +float asinhf(float x); +long double asinhl(long double x); + +floating_point atanh (arithmetic x); +float atanhf(float x); +long double atanhl(long double x); + +floating_point cbrt (arithmetic x); +float cbrtf(float x); +long double cbrtl(long double x); + +floating_point copysign (arithmetic x, arithmetic y); +float copysignf(float x, float y); +long double copysignl(long double x, long double y); + +floating_point erf (arithmetic x); +float erff(float x); +long double erfl(long double x); + +floating_point erfc (arithmetic x); +float erfcf(float x); +long double erfcl(long double x); + +floating_point exp2 (arithmetic x); +float exp2f(float x); +long double exp2l(long double x); + +floating_point expm1 (arithmetic x); +float expm1f(float x); +long double expm1l(long double x); + +floating_point fdim (arithmetic x, arithmetic y); +float fdimf(float x, float y); +long double fdiml(long double x, long double y); + +floating_point fma (arithmetic x, arithmetic y, arithmetic z); +float fmaf(float x, float y, float z); +long double fmal(long double x, long double y, long double z); + +floating_point fmax (arithmetic x, arithmetic y); +float fmaxf(float x, float y); +long double fmaxl(long double x, long double y); + +floating_point fmin (arithmetic x, arithmetic y); +float fminf(float x, float y); +long double fminl(long double x, long double y); + +floating_point hypot (arithmetic x, arithmetic y); +float hypotf(float x, float y); +long double hypotl(long double x, long double y); + +int ilogb (arithmetic x); +int ilogbf(float x); +int ilogbl(long double x); + +floating_point lgamma (arithmetic x); +float lgammaf(float x); +long double lgammal(long double x); + +long long llrint (arithmetic x); +long long llrintf(float x); +long long llrintl(long double x); + +long long llround (arithmetic x); +long long llroundf(float x); +long long llroundl(long double x); + +floating_point log1p (arithmetic x); +float log1pf(float x); +long double log1pl(long double x); + +floating_point log2 (arithmetic x); +float log2f(float x); +long double log2l(long double x); + +floating_point logb (arithmetic x); +float logbf(float x); +long double logbl(long double x); + +long lrint (arithmetic x); +long lrintf(float x); +long lrintl(long double x); + +long lround (arithmetic x); +long lroundf(float x); +long lroundl(long double x); + +double nan (const char* str); +float nanf(const char* str); +long double nanl(const char* str); + +floating_point nearbyint (arithmetic x); +float nearbyintf(float x); +long double nearbyintl(long double x); + +floating_point nextafter (arithmetic x, arithmetic y); +float nextafterf(float x, float y); +long double nextafterl(long double x, long double y); + +floating_point nexttoward (arithmetic x, long double y); +float nexttowardf(float x, long double y); +long double nexttowardl(long double x, long double y); + +floating_point remainder (arithmetic x, arithmetic y); +float remainderf(float x, float y); +long double remainderl(long double x, long double y); + +floating_point remquo (arithmetic x, arithmetic y, int* pquo); +float remquof(float x, float y, int* pquo); +long double remquol(long double x, long double y, int* pquo); + +floating_point rint (arithmetic x); +float rintf(float x); +long double rintl(long double x); + +floating_point round (arithmetic x); +float roundf(float x); +long double roundl(long double x); + +floating_point scalbln (arithmetic x, long ex); +float scalblnf(float x, long ex); +long double scalblnl(long double x, long ex); + +floating_point scalbn (arithmetic x, int ex); +float scalbnf(float x, int ex); +long double scalbnl(long double x, int ex); + +floating_point tgamma (arithmetic x); +float tgammaf(float x); +long double tgammal(long double x); + +floating_point trunc (arithmetic x); +float truncf(float x); +long double truncl(long double x); + +*/ + +#include <__config> + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#define _LIBCUDACXX_STDLIB_INCLUDE_NEXT +#include + +#include_next + +#ifdef __cplusplus + +// We support including .h headers inside 'extern "C"' contexts, so switch +// back to C++ linkage before including these C++ headers. +extern "C++" { + +#include +#include + +// signbit + +#ifdef signbit + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_signbit(_A1 __lcpp_x) noexcept +{ + return signbit(__lcpp_x); +} + +#undef signbit + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +signbit(_A1 __lcpp_x) noexcept +{ + return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type +signbit(_A1 __lcpp_x) noexcept +{ return __lcpp_x < 0; } + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type +signbit(_A1) noexcept +{ return false; } + +#elif defined(_LIBCUDACXX_MSVCRT) + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +signbit(_A1 __lcpp_x) noexcept +{ + return ::signbit(static_cast::type>(__lcpp_x)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type +signbit(_A1 __lcpp_x) noexcept +{ return __lcpp_x < 0; } + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type +signbit(_A1) noexcept +{ return false; } + +#endif // signbit + +// fpclassify + +#ifdef fpclassify + +template +_LIBCUDACXX_INLINE_VISIBILITY +int +__libcpp_fpclassify(_A1 __lcpp_x) noexcept +{ + return fpclassify(__lcpp_x); +} + +#undef fpclassify + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) noexcept +{ + return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) noexcept +{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } + +#elif defined(_LIBCUDACXX_MSVCRT) + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +fpclassify(_A1 __lcpp_x) noexcept +{ + return ::fpclassify(static_cast::type>(__lcpp_x)); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) noexcept +{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } + +#endif // fpclassify + +// isfinite + +#ifdef isfinite + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_isfinite(_A1 __lcpp_x) noexcept +{ + return isfinite(__lcpp_x); +} + +#undef isfinite + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, + bool>::type +isfinite(_A1 __lcpp_x) noexcept +{ + return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, + bool>::type +isfinite(_A1) noexcept +{ return true; } + +#endif // isfinite + +// isinf + +#ifdef isinf + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_isinf(_A1 __lcpp_x) noexcept +{ + return isinf(__lcpp_x); +} + +#undef isinf + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, + bool>::type +isinf(_A1 __lcpp_x) noexcept +{ + return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, + bool>::type +isinf(_A1) noexcept +{ return false; } + +#ifdef _LIBCUDACXX_PREFERRED_OVERLOAD +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isinf(float __lcpp_x) noexcept { return __libcpp_isinf(__lcpp_x); } + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_PREFERRED_OVERLOAD +bool +isinf(double __lcpp_x) noexcept { return __libcpp_isinf(__lcpp_x); } + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isinf(long double __lcpp_x) noexcept { return __libcpp_isinf(__lcpp_x); } +#endif + +#endif // isinf + +// isnan + +#ifdef isnan + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_isnan(_A1 __lcpp_x) noexcept +{ + return isnan(__lcpp_x); +} + +#undef isnan + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnan(_A1 __lcpp_x) noexcept +{ + return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnan(_A1) noexcept +{ return false; } + +#ifdef _LIBCUDACXX_PREFERRED_OVERLOAD +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isnan(float __lcpp_x) noexcept { return __libcpp_isnan(__lcpp_x); } + +inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_PREFERRED_OVERLOAD +bool +isnan(double __lcpp_x) noexcept { return __libcpp_isnan(__lcpp_x); } + +inline _LIBCUDACXX_INLINE_VISIBILITY +bool +isnan(long double __lcpp_x) noexcept { return __libcpp_isnan(__lcpp_x); } +#endif + +#endif // isnan + +// isnormal + +#ifdef isnormal + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_isnormal(_A1 __lcpp_x) noexcept +{ + return isnormal(__lcpp_x); +} + +#undef isnormal + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnormal(_A1 __lcpp_x) noexcept +{ + return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnormal(_A1 __lcpp_x) noexcept +{ return __lcpp_x != 0; } + +#endif // isnormal + +// isgreater + +#ifdef isgreater + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + return isgreater(__lcpp_x, __lcpp_y); +} + +#undef isgreater + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +isgreater(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // isgreater + +// isgreaterequal + +#ifdef isgreaterequal + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + return isgreaterequal(__lcpp_x, __lcpp_y); +} + +#undef isgreaterequal + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // isgreaterequal + +// isless + +#ifdef isless + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + return isless(__lcpp_x, __lcpp_y); +} + +#undef isless + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +isless(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // isless + +// islessequal + +#ifdef islessequal + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + return islessequal(__lcpp_x, __lcpp_y); +} + +#undef islessequal + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +islessequal(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // islessequal + +// islessgreater + +#ifdef islessgreater + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + return islessgreater(__lcpp_x, __lcpp_y); +} + +#undef islessgreater + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // islessgreater + +// isunordered + +#ifdef isunordered + +template +_LIBCUDACXX_INLINE_VISIBILITY +bool +__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + return isunordered(__lcpp_x, __lcpp_y); +} + +#undef isunordered + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +isunordered(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // isunordered + +// abs + +#undef abs +#undef labs +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +#undef llabs +#endif + +// MSVCRT already has the correct prototype in if __cplusplus is defined +#if !defined(_LIBCUDACXX_MSVCRT) && !defined(__sun__) && !defined(_AIX) +inline _LIBCUDACXX_INLINE_VISIBILITY long abs(long __x) noexcept { + return ::labs(__x); +} +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +inline _LIBCUDACXX_INLINE_VISIBILITY long long abs(long long __x) noexcept { + return ::llabs(__x); +} +#endif // _LIBCUDACXX_HAS_NO_LONG_LONG +#endif // !defined(_LIBCUDACXX_MSVCRT) && !defined(__sun__) && !defined(_AIX) + + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float abs(float __lcpp_x) noexcept { + return ::fabsf(__lcpp_x); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY double abs(double __lcpp_x) noexcept { + return ::fabs(__lcpp_x); +} + +inline _LIBCUDACXX_INLINE_VISIBILITY long double +abs(long double __lcpp_x) noexcept { + return ::fabsl(__lcpp_x); +} +#endif // !(defined(_AIX) || defined(__sun__)) + +// div + +#undef div +#undef ldiv +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +#undef lldiv +#endif + +// MSVCRT already has the correct prototype in if __cplusplus is defined +#if !defined(_LIBCUDACXX_MSVCRT) && !defined(__sun__) && !defined(_AIX) +inline _LIBCUDACXX_INLINE_VISIBILITY ldiv_t div(long __x, long __y) noexcept { + return ::ldiv(__x, __y); +} +#ifndef _LIBCUDACXX_HAS_NO_LONG_LONG +inline _LIBCUDACXX_INLINE_VISIBILITY lldiv_t div(long long __x, + long long __y) noexcept { + return ::lldiv(__x, __y); +} +#endif // _LIBCUDACXX_HAS_NO_LONG_LONG +#endif // _LIBCUDACXX_MSVCRT / __sun__ / _AIX + +// acos + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float acos(float __lcpp_x) noexcept {return ::acosf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double acos(long double __lcpp_x) noexcept {return ::acosl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +acos(_A1 __lcpp_x) noexcept {return ::acos((double)__lcpp_x);} + +// asin + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float asin(float __lcpp_x) noexcept {return ::asinf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double asin(long double __lcpp_x) noexcept {return ::asinl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +asin(_A1 __lcpp_x) noexcept {return ::asin((double)__lcpp_x);} + +// atan + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float atan(float __lcpp_x) noexcept {return ::atanf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double atan(long double __lcpp_x) noexcept {return ::atanl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +atan(_A1 __lcpp_x) noexcept {return ::atan((double)__lcpp_x);} + +// atan2 + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) noexcept {return ::atan2f(__lcpp_y, __lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) noexcept {return ::atan2l(__lcpp_y, __lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +atan2(_A1 __lcpp_y, _A2 __lcpp_x) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x); +} + +// ceil + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float ceil(float __lcpp_x) noexcept {return ::ceilf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double ceil(long double __lcpp_x) noexcept {return ::ceill(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +ceil(_A1 __lcpp_x) noexcept {return ::ceil((double)__lcpp_x);} + +// cos + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float cos(float __lcpp_x) noexcept {return ::cosf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double cos(long double __lcpp_x) noexcept {return ::cosl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +cos(_A1 __lcpp_x) noexcept {return ::cos((double)__lcpp_x);} + +// cosh + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float cosh(float __lcpp_x) noexcept {return ::coshf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double cosh(long double __lcpp_x) noexcept {return ::coshl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +cosh(_A1 __lcpp_x) noexcept {return ::cosh((double)__lcpp_x);} + +// exp + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float exp(float __lcpp_x) noexcept {return ::expf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double exp(long double __lcpp_x) noexcept {return ::expl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +exp(_A1 __lcpp_x) noexcept {return ::exp((double)__lcpp_x);} + +// fabs + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float fabs(float __lcpp_x) noexcept {return ::fabsf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double fabs(long double __lcpp_x) noexcept {return ::fabsl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +fabs(_A1 __lcpp_x) noexcept {return ::fabs((double)__lcpp_x);} + +// floor + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float floor(float __lcpp_x) noexcept {return ::floorf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double floor(long double __lcpp_x) noexcept {return ::floorl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +floor(_A1 __lcpp_x) noexcept {return ::floor((double)__lcpp_x);} + +// fmod + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) noexcept {return ::fmodf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) noexcept {return ::fmodl(__lcpp_x, __lcpp_y);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +fmod(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y); +} + +// frexp + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) noexcept {return ::frexpf(__lcpp_x, __lcpp_e);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) noexcept {return ::frexpl(__lcpp_x, __lcpp_e);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +frexp(_A1 __lcpp_x, int* __lcpp_e) noexcept {return ::frexp((double)__lcpp_x, __lcpp_e);} + +// ldexp + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) noexcept {return ::ldexpf(__lcpp_x, __lcpp_e);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) noexcept {return ::ldexpl(__lcpp_x, __lcpp_e);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +ldexp(_A1 __lcpp_x, int __lcpp_e) noexcept {return ::ldexp((double)__lcpp_x, __lcpp_e);} + +// log + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float log(float __lcpp_x) noexcept {return ::logf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double log(long double __lcpp_x) noexcept {return ::logl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +log(_A1 __lcpp_x) noexcept {return ::log((double)__lcpp_x);} + +// log10 + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float log10(float __lcpp_x) noexcept {return ::log10f(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double log10(long double __lcpp_x) noexcept {return ::log10l(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +log10(_A1 __lcpp_x) noexcept {return ::log10((double)__lcpp_x);} + +// modf + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) noexcept {return ::modff(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) noexcept {return ::modfl(__lcpp_x, __lcpp_y);} +#endif + +// pow + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) noexcept {return ::powf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) noexcept {return ::powl(__lcpp_x, __lcpp_y);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +pow(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y); +} + +// sin + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float sin(float __lcpp_x) noexcept {return ::sinf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double sin(long double __lcpp_x) noexcept {return ::sinl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +sin(_A1 __lcpp_x) noexcept {return ::sin((double)__lcpp_x);} + +// sinh + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float sinh(float __lcpp_x) noexcept {return ::sinhf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double sinh(long double __lcpp_x) noexcept {return ::sinhl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +sinh(_A1 __lcpp_x) noexcept {return ::sinh((double)__lcpp_x);} + +// sqrt + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float sqrt(float __lcpp_x) noexcept {return ::sqrtf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) noexcept {return ::sqrtl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +sqrt(_A1 __lcpp_x) noexcept {return ::sqrt((double)__lcpp_x);} + +// tan + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float tan(float __lcpp_x) noexcept {return ::tanf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double tan(long double __lcpp_x) noexcept {return ::tanl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +tan(_A1 __lcpp_x) noexcept {return ::tan((double)__lcpp_x);} + +// tanh + +#if !(defined(_AIX) || defined(__sun__)) +inline _LIBCUDACXX_INLINE_VISIBILITY float tanh(float __lcpp_x) noexcept {return ::tanhf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double tanh(long double __lcpp_x) noexcept {return ::tanhl(__lcpp_x);} +#endif + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +tanh(_A1 __lcpp_x) noexcept {return ::tanh((double)__lcpp_x);} + +// acosh + +inline _LIBCUDACXX_INLINE_VISIBILITY float acosh(float __lcpp_x) noexcept {return ::acoshf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double acosh(long double __lcpp_x) noexcept {return ::acoshl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +acosh(_A1 __lcpp_x) noexcept {return ::acosh((double)__lcpp_x);} + +// asinh + +inline _LIBCUDACXX_INLINE_VISIBILITY float asinh(float __lcpp_x) noexcept {return ::asinhf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double asinh(long double __lcpp_x) noexcept {return ::asinhl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +asinh(_A1 __lcpp_x) noexcept {return ::asinh((double)__lcpp_x);} + +// atanh + +inline _LIBCUDACXX_INLINE_VISIBILITY float atanh(float __lcpp_x) noexcept {return ::atanhf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double atanh(long double __lcpp_x) noexcept {return ::atanhl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +atanh(_A1 __lcpp_x) noexcept {return ::atanh((double)__lcpp_x);} + +// cbrt + +inline _LIBCUDACXX_INLINE_VISIBILITY float cbrt(float __lcpp_x) noexcept {return ::cbrtf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) noexcept {return ::cbrtl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +cbrt(_A1 __lcpp_x) noexcept {return ::cbrt((double)__lcpp_x);} + +// copysign + +inline _LIBCUDACXX_INLINE_VISIBILITY float copysign(float __lcpp_x, + float __lcpp_y) noexcept { + return ::copysignf(__lcpp_x, __lcpp_y); +} +inline _LIBCUDACXX_INLINE_VISIBILITY long double +copysign(long double __lcpp_x, long double __lcpp_y) noexcept { + return ::copysignl(__lcpp_x, __lcpp_y); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +copysign(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); +} + +// erf + +inline _LIBCUDACXX_INLINE_VISIBILITY float erf(float __lcpp_x) noexcept {return ::erff(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double erf(long double __lcpp_x) noexcept {return ::erfl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +erf(_A1 __lcpp_x) noexcept {return ::erf((double)__lcpp_x);} + +// erfc + +inline _LIBCUDACXX_INLINE_VISIBILITY float erfc(float __lcpp_x) noexcept {return ::erfcf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double erfc(long double __lcpp_x) noexcept {return ::erfcl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +erfc(_A1 __lcpp_x) noexcept {return ::erfc((double)__lcpp_x);} + +// exp2 + +inline _LIBCUDACXX_INLINE_VISIBILITY float exp2(float __lcpp_x) noexcept {return ::exp2f(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double exp2(long double __lcpp_x) noexcept {return ::exp2l(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +exp2(_A1 __lcpp_x) noexcept {return ::exp2((double)__lcpp_x);} + +// expm1 + +inline _LIBCUDACXX_INLINE_VISIBILITY float expm1(float __lcpp_x) noexcept {return ::expm1f(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double expm1(long double __lcpp_x) noexcept {return ::expm1l(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +expm1(_A1 __lcpp_x) noexcept {return ::expm1((double)__lcpp_x);} + +// fdim + +inline _LIBCUDACXX_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) noexcept {return ::fdimf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) noexcept {return ::fdiml(__lcpp_x, __lcpp_y);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +fdim(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y); +} + +// fma + +inline _LIBCUDACXX_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) noexcept {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) noexcept {return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value && + std::is_arithmetic<_A3>::value, + std::__promote<_A1, _A2, _A3> +>::type +fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) noexcept +{ + typedef typename std::__promote<_A1, _A2, _A3>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value && + std::_IsSame<_A3, __result_type>::value)), ""); + return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); +} + +// fmax + +inline _LIBCUDACXX_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) noexcept {return ::fmaxf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) noexcept {return ::fmaxl(__lcpp_x, __lcpp_y);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +fmax(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y); +} + +// fmin + +inline _LIBCUDACXX_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) noexcept {return ::fminf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) noexcept {return ::fminl(__lcpp_x, __lcpp_y);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +fmin(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y); +} + +// hypot + +inline _LIBCUDACXX_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) noexcept {return ::hypotf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) noexcept {return ::hypotl(__lcpp_x, __lcpp_y);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +hypot(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y); +} + +// ilogb + +inline _LIBCUDACXX_INLINE_VISIBILITY int ilogb(float __lcpp_x) noexcept {return ::ilogbf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY int ilogb(long double __lcpp_x) noexcept {return ::ilogbl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +ilogb(_A1 __lcpp_x) noexcept {return ::ilogb((double)__lcpp_x);} + +// lgamma + +inline _LIBCUDACXX_INLINE_VISIBILITY float lgamma(float __lcpp_x) noexcept {return ::lgammaf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) noexcept {return ::lgammal(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +lgamma(_A1 __lcpp_x) noexcept {return ::lgamma((double)__lcpp_x);} + +// llrint + +inline _LIBCUDACXX_INLINE_VISIBILITY long long llrint(float __lcpp_x) noexcept {return ::llrintf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long long llrint(long double __lcpp_x) noexcept {return ::llrintl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, long long>::type +llrint(_A1 __lcpp_x) noexcept {return ::llrint((double)__lcpp_x);} + +// llround + +inline _LIBCUDACXX_INLINE_VISIBILITY long long llround(float __lcpp_x) noexcept {return ::llroundf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long long llround(long double __lcpp_x) noexcept {return ::llroundl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, long long>::type +llround(_A1 __lcpp_x) noexcept {return ::llround((double)__lcpp_x);} + +// log1p + +inline _LIBCUDACXX_INLINE_VISIBILITY float log1p(float __lcpp_x) noexcept {return ::log1pf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double log1p(long double __lcpp_x) noexcept {return ::log1pl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +log1p(_A1 __lcpp_x) noexcept {return ::log1p((double)__lcpp_x);} + +// log2 + +inline _LIBCUDACXX_INLINE_VISIBILITY float log2(float __lcpp_x) noexcept {return ::log2f(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double log2(long double __lcpp_x) noexcept {return ::log2l(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +log2(_A1 __lcpp_x) noexcept {return ::log2((double)__lcpp_x);} + +// logb + +inline _LIBCUDACXX_INLINE_VISIBILITY float logb(float __lcpp_x) noexcept {return ::logbf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double logb(long double __lcpp_x) noexcept {return ::logbl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +logb(_A1 __lcpp_x) noexcept {return ::logb((double)__lcpp_x);} + +// lrint + +inline _LIBCUDACXX_INLINE_VISIBILITY long lrint(float __lcpp_x) noexcept {return ::lrintf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long lrint(long double __lcpp_x) noexcept {return ::lrintl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, long>::type +lrint(_A1 __lcpp_x) noexcept {return ::lrint((double)__lcpp_x);} + +// lround + +inline _LIBCUDACXX_INLINE_VISIBILITY long lround(float __lcpp_x) noexcept {return ::lroundf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long lround(long double __lcpp_x) noexcept {return ::lroundl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, long>::type +lround(_A1 __lcpp_x) noexcept {return ::lround((double)__lcpp_x);} + +// nan + +// nearbyint + +inline _LIBCUDACXX_INLINE_VISIBILITY float nearbyint(float __lcpp_x) noexcept {return ::nearbyintf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) noexcept {return ::nearbyintl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +nearbyint(_A1 __lcpp_x) noexcept {return ::nearbyint((double)__lcpp_x);} + +// nextafter + +inline _LIBCUDACXX_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) noexcept {return ::nextafterf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) noexcept {return ::nextafterl(__lcpp_x, __lcpp_y);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +nextafter(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y); +} + +// nexttoward + +inline _LIBCUDACXX_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) noexcept {return ::nexttowardf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) noexcept {return ::nexttowardl(__lcpp_x, __lcpp_y);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +nexttoward(_A1 __lcpp_x, long double __lcpp_y) noexcept {return ::nexttoward((double)__lcpp_x, __lcpp_y);} + +// remainder + +inline _LIBCUDACXX_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) noexcept {return ::remainderf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) noexcept {return ::remainderl(__lcpp_x, __lcpp_y);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +remainder(_A1 __lcpp_x, _A2 __lcpp_y) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y); +} + +// remquo + +inline _LIBCUDACXX_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) noexcept {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) noexcept {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::_EnableIf +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + std::__promote<_A1, _A2> +>::type +remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) noexcept +{ + typedef typename std::__promote<_A1, _A2>::type __result_type; + static_assert((!(std::_IsSame<_A1, __result_type>::value && + std::_IsSame<_A2, __result_type>::value)), ""); + return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z); +} + +// rint + +inline _LIBCUDACXX_INLINE_VISIBILITY float rint(float __lcpp_x) noexcept {return ::rintf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double rint(long double __lcpp_x) noexcept {return ::rintl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +rint(_A1 __lcpp_x) noexcept {return ::rint((double)__lcpp_x);} + +// round + +inline _LIBCUDACXX_INLINE_VISIBILITY float round(float __lcpp_x) noexcept {return ::roundf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double round(long double __lcpp_x) noexcept {return ::roundl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +round(_A1 __lcpp_x) noexcept {return ::round((double)__lcpp_x);} + +// scalbln + +inline _LIBCUDACXX_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) noexcept {return ::scalblnf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) noexcept {return ::scalblnl(__lcpp_x, __lcpp_y);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +scalbln(_A1 __lcpp_x, long __lcpp_y) noexcept {return ::scalbln((double)__lcpp_x, __lcpp_y);} + +// scalbn + +inline _LIBCUDACXX_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) noexcept {return ::scalbnf(__lcpp_x, __lcpp_y);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) noexcept {return ::scalbnl(__lcpp_x, __lcpp_y);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +scalbn(_A1 __lcpp_x, int __lcpp_y) noexcept {return ::scalbn((double)__lcpp_x, __lcpp_y);} + +// tgamma + +inline _LIBCUDACXX_INLINE_VISIBILITY float tgamma(float __lcpp_x) noexcept {return ::tgammaf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) noexcept {return ::tgammal(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +tgamma(_A1 __lcpp_x) noexcept {return ::tgamma((double)__lcpp_x);} + +// trunc + +inline _LIBCUDACXX_INLINE_VISIBILITY float trunc(float __lcpp_x) noexcept {return ::truncf(__lcpp_x);} +inline _LIBCUDACXX_INLINE_VISIBILITY long double trunc(long double __lcpp_x) noexcept {return ::truncl(__lcpp_x);} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename std::enable_if::value, double>::type +trunc(_A1 __lcpp_x) noexcept {return ::trunc((double)__lcpp_x);} + +} // extern "C++" + +#endif // __cplusplus + +#else // _LIBCUDACXX_MATH_H + +// This include lives outside the header guard in order to support an MSVC +// extension which allows users to do: +// +// #define _USE_MATH_DEFINES +// #include +// +// and receive the definitions of mathematical constants, even if +// has previously been included. +#if defined(_LIBCUDACXX_MSVCRT) && defined(_USE_MATH_DEFINES) +#include_next +#endif + +#endif // _LIBCUDACXX_MATH_H diff --git a/cuda_toolkit/include/math_constants.h b/cuda_toolkit/include/math_constants.h new file mode 100644 index 0000000000000000000000000000000000000000..9a9dee98290978e8d62d48c4fc3a8b5c5b91277d --- /dev/null +++ b/cuda_toolkit/include/math_constants.h @@ -0,0 +1,152 @@ +/* + * Copyright 1993-2021 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO LICENSEE: + * + * This source code and/or documentation ("Licensed Deliverables") are + * subject to NVIDIA intellectual property rights under U.S. and + * international Copyright laws. + * + * These Licensed Deliverables contained herein is PROPRIETARY and + * CONFIDENTIAL to NVIDIA and is being provided under the terms and + * conditions of a form of NVIDIA software license agreement by and + * between NVIDIA and Licensee ("License Agreement") or electronically + * accepted by Licensee. Notwithstanding any terms or conditions to + * the contrary in the License Agreement, reproduction or disclosure + * of the Licensed Deliverables to any third party without the express + * written consent of NVIDIA is prohibited. + * + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE + * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS + * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. + * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED + * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, + * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE + * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY + * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THESE LICENSED DELIVERABLES. + * + * U.S. Government End Users. These Licensed Deliverables are a + * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT + * 1995), consisting of "commercial computer software" and "commercial + * computer software documentation" as such terms are used in 48 + * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government + * only as a commercial end item. Consistent with 48 C.F.R.12.212 and + * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all + * U.S. Government End Users acquire the Licensed Deliverables with + * only those rights set forth herein. + * + * Any use of the Licensed Deliverables in individual and commercial + * software must include, in the user documentation and internal + * comments to the code, the above Disclaimer and U.S. Government End + * Users Notice. + */ + +#if !defined(__MATH_CONSTANTS_H__) +#define __MATH_CONSTANTS_H__ + +/* single precision constants */ +#define CUDART_INF_F __int_as_float(0x7f800000U) +#define CUDART_NAN_F __int_as_float(0x7fffffffU) +#define CUDART_MIN_DENORM_F __int_as_float(0x00000001U) +#define CUDART_MAX_NORMAL_F __int_as_float(0x7f7fffffU) +#define CUDART_NEG_ZERO_F __int_as_float(0x80000000U) +#define CUDART_ZERO_F 0.0F +#define CUDART_ONE_F 1.0F +#define CUDART_SQRT_HALF_F 0.707106781F +#define CUDART_SQRT_HALF_HI_F 0.707106781F +#define CUDART_SQRT_HALF_LO_F 1.210161749e-08F +#define CUDART_SQRT_TWO_F 1.414213562F +#define CUDART_THIRD_F 0.333333333F +#define CUDART_PIO4_F 0.785398163F +#define CUDART_PIO2_F 1.570796327F +#define CUDART_3PIO4_F 2.356194490F +#define CUDART_2_OVER_PI_F 0.636619772F +#define CUDART_SQRT_2_OVER_PI_F 0.797884561F +#define CUDART_PI_F 3.141592654F +#define CUDART_L2E_F 1.442695041F +#define CUDART_L2T_F 3.321928094F +#define CUDART_LG2_F 0.301029996F +#define CUDART_LGE_F 0.434294482F +#define CUDART_LN2_F 0.693147181F +#define CUDART_LNT_F 2.302585093F +#define CUDART_LNPI_F 1.144729886F +#define CUDART_TWO_TO_M126_F 1.175494351e-38F +#define CUDART_TWO_TO_126_F 8.507059173e37F +#define CUDART_NORM_HUGE_F 3.402823466e38F +#define CUDART_TWO_TO_23_F 8388608.0F +#define CUDART_TWO_TO_24_F 16777216.0F +#define CUDART_TWO_TO_31_F 2147483648.0F +#define CUDART_TWO_TO_32_F 4294967296.0F +#define CUDART_REMQUO_BITS_F 3U +#define CUDART_REMQUO_MASK_F (~((~0U)< +#endif //__cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__mdspan/default_accessor.h" +#include "__mdspan/full_extent_t.h" +#include "__mdspan/mdspan.h" +#include "__mdspan/dynamic_extent.h" +#include "__mdspan/extents.h" +#include "__mdspan/layout_stride.h" +#include "__mdspan/layout_left.h" +#include "__mdspan/layout_right.h" +#include "__mdspan/macros.h" +#include "__mdspan/static_array.h" +#include "__mdspan/submdspan.h" + +#include "version" + +#endif // _LIBCUDACXX_MDSPAN diff --git a/cuda_toolkit/include/memory b/cuda_toolkit/include/memory new file mode 100644 index 0000000000000000000000000000000000000000..29a252aa16947b9370bca956806330fb67225554 --- /dev/null +++ b/cuda_toolkit/include/memory @@ -0,0 +1,5036 @@ +// -*- C++ -*- +//===-------------------------- memory ------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCUDACXX_MEMORY +#define _LIBCUDACXX_MEMORY + +/* + memory synopsis + +namespace std +{ + +struct allocator_arg_t { }; +inline constexpr allocator_arg_t allocator_arg = allocator_arg_t(); + +template struct uses_allocator; + +template +struct pointer_traits +{ + typedef Ptr pointer; + typedef
element_type; + typedef
difference_type; + + template using rebind =
; + + static pointer pointer_to(
); +}; + +template +struct pointer_traits +{ + typedef T* pointer; + typedef T element_type; + typedef ptrdiff_t difference_type; + + template using rebind = U*; + + static pointer pointer_to(
) noexcept; // constexpr in C++20 +}; + +template constexpr T* to_address(T* p) noexcept; // C++20 +template auto to_address(const Ptr& p) noexcept; // C++20 + +template +struct allocator_traits +{ + typedef Alloc allocator_type; + typedef typename allocator_type::value_type + value_type; + + typedef Alloc::pointer | value_type* pointer; + typedef Alloc::const_pointer + | pointer_traits::rebind + const_pointer; + typedef Alloc::void_pointer + | pointer_traits::rebind + void_pointer; + typedef Alloc::const_void_pointer + | pointer_traits::rebind + const_void_pointer; + typedef Alloc::difference_type + | pointer_traits::difference_type + difference_type; + typedef Alloc::size_type + | make_unsigned::type + size_type; + typedef Alloc::propagate_on_container_copy_assignment + | false_type propagate_on_container_copy_assignment; + typedef Alloc::propagate_on_container_move_assignment + | false_type propagate_on_container_move_assignment; + typedef Alloc::propagate_on_container_swap + | false_type propagate_on_container_swap; + typedef Alloc::is_always_equal + | is_empty is_always_equal; + + template using rebind_alloc = Alloc::rebind::other | Alloc; + template using rebind_traits = allocator_traits>; + + static pointer allocate(allocator_type& a, size_type n); // [[nodiscard]] in C++20 + static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint); // [[nodiscard]] in C++20 + + static void deallocate(allocator_type& a, pointer p, size_type n) noexcept; + + template + static void construct(allocator_type& a, T* p, Args&&... args); + + template + static void destroy(allocator_type& a, T* p); + + static size_type max_size(const allocator_type& a); // noexcept in C++14 + + static allocator_type + select_on_container_copy_construction(const allocator_type& a); +}; + +template <> +class allocator +{ +public: + typedef void* pointer; + typedef const void* const_pointer; + typedef void value_type; + + template struct rebind {typedef allocator<_Up> other;}; +}; + +template +class allocator +{ +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef typename add_lvalue_reference::type reference; + typedef typename add_lvalue_reference::type const_reference; + typedef T value_type; + + template struct rebind {typedef allocator other;}; + + constexpr allocator() noexcept; // constexpr in C++20 + constexpr allocator(const allocator&) noexcept; // constexpr in C++20 + template + constexpr allocator(const allocator&) noexcept; // constexpr in C++20 + ~allocator(); + pointer address(reference x) const noexcept; + const_pointer address(const_reference x) const noexcept; + pointer allocate(size_type, allocator::const_pointer hint = 0); + void deallocate(pointer p, size_type n) noexcept; + size_type max_size() const noexcept; + template + void construct(U* p, Args&&... args); + template + void destroy(U* p); +}; + +template +bool operator==(const allocator&, const allocator&) noexcept; + +template +bool operator!=(const allocator&, const allocator&) noexcept; + +template +class raw_storage_iterator + : public iterator // purposefully not C++03 +{ +public: + explicit raw_storage_iterator(OutputIterator x); + raw_storage_iterator& operator*(); + raw_storage_iterator& operator=(const T& element); + raw_storage_iterator& operator++(); + raw_storage_iterator operator++(int); +}; + +template pair get_temporary_buffer(ptrdiff_t n) noexcept; +template void return_temporary_buffer(T* p) noexcept; + +template T* addressof(T& r) noexcept; +template T* addressof(const T&& r) noexcept = delete; + +template +ForwardIterator +uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator result); + +template +ForwardIterator +uninitialized_copy_n(InputIterator first, Size n, ForwardIterator result); + +template +void uninitialized_fill(ForwardIterator first, ForwardIterator last, const T& x); + +template +ForwardIterator +uninitialized_fill_n(ForwardIterator first, Size n, const T& x); + +template +void destroy_at(T* location); + +template + void destroy(ForwardIterator first, ForwardIterator last); + +template + ForwardIterator destroy_n(ForwardIterator first, Size n); + +template + ForwardIterator uninitialized_move(InputIterator first, InputIterator last, ForwardIterator result); + +template + pair uninitialized_move_n(InputIterator first, Size n, ForwardIterator result); + +template + void uninitialized_value_construct(ForwardIterator first, ForwardIterator last); + +template + ForwardIterator uninitialized_value_construct_n(ForwardIterator first, Size n); + +template + void uninitialized_default_construct(ForwardIterator first, ForwardIterator last); + +template + ForwardIterator uninitialized_default_construct_n(ForwardIterator first, Size n); + +template struct auto_ptr_ref {}; // deprecated in C++11, removed in C++17 + +template +class auto_ptr // deprecated in C++11, removed in C++17 +{ +public: + typedef X element_type; + + explicit auto_ptr(X* p =0) throw(); + auto_ptr(auto_ptr&) throw(); + template auto_ptr(auto_ptr&) throw(); + auto_ptr& operator=(auto_ptr&) throw(); + template auto_ptr& operator=(auto_ptr&) throw(); + auto_ptr& operator=(auto_ptr_ref r) throw(); + ~auto_ptr() throw(); + + typename add_lvalue_reference::type operator*() const throw(); + X* operator->() const throw(); + X* get() const throw(); + X* release() throw(); + void reset(X* p =0) throw(); + + auto_ptr(auto_ptr_ref) throw(); + template operator auto_ptr_ref() throw(); + template operator auto_ptr() throw(); +}; + +template +struct default_delete +{ + constexpr default_delete() noexcept = default; + template default_delete(const default_delete&) noexcept; + + void operator()(T*) const noexcept; +}; + +template +struct default_delete +{ + constexpr default_delete() noexcept = default; + void operator()(T*) const noexcept; + template void operator()(U*) const = delete; +}; + +template > +class unique_ptr +{ +public: + typedef see below pointer; + typedef T element_type; + typedef D deleter_type; + + // constructors + constexpr unique_ptr() noexcept; + explicit unique_ptr(pointer p) noexcept; + unique_ptr(pointer p, see below d1) noexcept; + unique_ptr(pointer p, see below d2) noexcept; + unique_ptr(unique_ptr&& u) noexcept; + unique_ptr(nullptr_t) noexcept : unique_ptr() { } + template + unique_ptr(unique_ptr&& u) noexcept; + template + unique_ptr(auto_ptr&& u) noexcept; // removed in C++17 + + // destructor + ~unique_ptr(); + + // assignment + unique_ptr& operator=(unique_ptr&& u) noexcept; + template unique_ptr& operator=(unique_ptr&& u) noexcept; + unique_ptr& operator=(nullptr_t) noexcept; + + // observers + typename add_lvalue_reference::type operator*() const; + pointer operator->() const noexcept; + pointer get() const noexcept; + deleter_type& get_deleter() noexcept; + const deleter_type& get_deleter() const noexcept; + explicit operator bool() const noexcept; + + // modifiers + pointer release() noexcept; + void reset(pointer p = pointer()) noexcept; + void swap(unique_ptr& u) noexcept; +}; + +template +class unique_ptr +{ +public: + typedef implementation-defined pointer; + typedef T element_type; + typedef D deleter_type; + + // constructors + constexpr unique_ptr() noexcept; + explicit unique_ptr(pointer p) noexcept; + unique_ptr(pointer p, see below d) noexcept; + unique_ptr(pointer p, see below d) noexcept; + unique_ptr(unique_ptr&& u) noexcept; + unique_ptr(nullptr_t) noexcept : unique_ptr() { } + + // destructor + ~unique_ptr(); + + // assignment + unique_ptr& operator=(unique_ptr&& u) noexcept; + unique_ptr& operator=(nullptr_t) noexcept; + + // observers + T& operator[](size_t i) const; + pointer get() const noexcept; + deleter_type& get_deleter() noexcept; + const deleter_type& get_deleter() const noexcept; + explicit operator bool() const noexcept; + + // modifiers + pointer release() noexcept; + void reset(pointer p = pointer()) noexcept; + void reset(nullptr_t) noexcept; + template void reset(U) = delete; + void swap(unique_ptr& u) noexcept; +}; + +template + void swap(unique_ptr& x, unique_ptr& y) noexcept; + +template + bool operator==(const unique_ptr& x, const unique_ptr& y); +template + bool operator!=(const unique_ptr& x, const unique_ptr& y); +template + bool operator<(const unique_ptr& x, const unique_ptr& y); +template + bool operator<=(const unique_ptr& x, const unique_ptr& y); +template + bool operator>(const unique_ptr& x, const unique_ptr& y); +template + bool operator>=(const unique_ptr& x, const unique_ptr& y); + +template + bool operator==(const unique_ptr& x, nullptr_t) noexcept; +template + bool operator==(nullptr_t, const unique_ptr& y) noexcept; +template + bool operator!=(const unique_ptr& x, nullptr_t) noexcept; +template + bool operator!=(nullptr_t, const unique_ptr& y) noexcept; + +template + bool operator<(const unique_ptr& x, nullptr_t); +template + bool operator<(nullptr_t, const unique_ptr& y); +template + bool operator<=(const unique_ptr& x, nullptr_t); +template + bool operator<=(nullptr_t, const unique_ptr& y); +template + bool operator>(const unique_ptr& x, nullptr_t); +template + bool operator>(nullptr_t, const unique_ptr& y); +template + bool operator>=(const unique_ptr& x, nullptr_t); +template + bool operator>=(nullptr_t, const unique_ptr& y); + +class bad_weak_ptr + : public std::exception +{ + bad_weak_ptr() noexcept; +}; + +template unique_ptr make_unique(Args&&... args); // C++14 +template unique_ptr make_unique(size_t n); // C++14 +template unspecified make_unique(Args&&...) = delete; // C++14, T == U[N] + +template + basic_ostream& operator<< (basic_ostream& os, unique_ptr const& p); + +template +class shared_ptr +{ +public: + typedef T element_type; + typedef weak_ptr weak_type; // C++17 + + // constructors: + constexpr shared_ptr() noexcept; + template explicit shared_ptr(Y* p); + template shared_ptr(Y* p, D d); + template shared_ptr(Y* p, D d, A a); + template shared_ptr(nullptr_t p, D d); + template shared_ptr(nullptr_t p, D d, A a); + template shared_ptr(const shared_ptr& r, T *p) noexcept; + shared_ptr(const shared_ptr& r) noexcept; + template shared_ptr(const shared_ptr& r) noexcept; + shared_ptr(shared_ptr&& r) noexcept; + template shared_ptr(shared_ptr&& r) noexcept; + template explicit shared_ptr(const weak_ptr& r); + template shared_ptr(auto_ptr&& r); // removed in C++17 + template shared_ptr(unique_ptr&& r); + shared_ptr(nullptr_t) : shared_ptr() { } + + // destructor: + ~shared_ptr(); + + // assignment: + shared_ptr& operator=(const shared_ptr& r) noexcept; + template shared_ptr& operator=(const shared_ptr& r) noexcept; + shared_ptr& operator=(shared_ptr&& r) noexcept; + template shared_ptr& operator=(shared_ptr&& r); + template shared_ptr& operator=(auto_ptr&& r); // removed in C++17 + template shared_ptr& operator=(unique_ptr&& r); + + // modifiers: + void swap(shared_ptr& r) noexcept; + void reset() noexcept; + template void reset(Y* p); + template void reset(Y* p, D d); + template void reset(Y* p, D d, A a); + + // observers: + T* get() const noexcept; + T& operator*() const noexcept; + T* operator->() const noexcept; + long use_count() const noexcept; + bool unique() const noexcept; + explicit operator bool() const noexcept; + template bool owner_before(shared_ptr const& b) const noexcept; + template bool owner_before(weak_ptr const& b) const noexcept; +}; + +// shared_ptr comparisons: +template + bool operator==(shared_ptr const& a, shared_ptr const& b) noexcept; +template + bool operator!=(shared_ptr const& a, shared_ptr const& b) noexcept; +template + bool operator<(shared_ptr const& a, shared_ptr const& b) noexcept; +template + bool operator>(shared_ptr const& a, shared_ptr const& b) noexcept; +template + bool operator<=(shared_ptr const& a, shared_ptr const& b) noexcept; +template + bool operator>=(shared_ptr const& a, shared_ptr const& b) noexcept; + +template + bool operator==(const shared_ptr& x, nullptr_t) noexcept; +template + bool operator==(nullptr_t, const shared_ptr& y) noexcept; +template + bool operator!=(const shared_ptr& x, nullptr_t) noexcept; +template + bool operator!=(nullptr_t, const shared_ptr& y) noexcept; +template + bool operator<(const shared_ptr& x, nullptr_t) noexcept; +template +bool operator<(nullptr_t, const shared_ptr& y) noexcept; +template + bool operator<=(const shared_ptr& x, nullptr_t) noexcept; +template + bool operator<=(nullptr_t, const shared_ptr& y) noexcept; +template + bool operator>(const shared_ptr& x, nullptr_t) noexcept; +template + bool operator>(nullptr_t, const shared_ptr& y) noexcept; +template + bool operator>=(const shared_ptr& x, nullptr_t) noexcept; +template + bool operator>=(nullptr_t, const shared_ptr& y) noexcept; + +// shared_ptr specialized algorithms: +template void swap(shared_ptr& a, shared_ptr& b) noexcept; + +// shared_ptr casts: +template + shared_ptr static_pointer_cast(shared_ptr const& r) noexcept; +template + shared_ptr dynamic_pointer_cast(shared_ptr const& r) noexcept; +template + shared_ptr const_pointer_cast(shared_ptr const& r) noexcept; + +// shared_ptr I/O: +template + basic_ostream& operator<< (basic_ostream& os, shared_ptr const& p); + +// shared_ptr get_deleter: +template D* get_deleter(shared_ptr const& p) noexcept; + +template + shared_ptr make_shared(Args&&... args); +template + shared_ptr allocate_shared(const A& a, Args&&... args); + +template +class weak_ptr +{ +public: + typedef T element_type; + + // constructors + constexpr weak_ptr() noexcept; + template weak_ptr(shared_ptr const& r) noexcept; + weak_ptr(weak_ptr const& r) noexcept; + template weak_ptr(weak_ptr const& r) noexcept; + weak_ptr(weak_ptr&& r) noexcept; // C++14 + template weak_ptr(weak_ptr&& r) noexcept; // C++14 + + // destructor + ~weak_ptr(); + + // assignment + weak_ptr& operator=(weak_ptr const& r) noexcept; + template weak_ptr& operator=(weak_ptr const& r) noexcept; + template weak_ptr& operator=(shared_ptr const& r) noexcept; + weak_ptr& operator=(weak_ptr&& r) noexcept; // C++14 + template weak_ptr& operator=(weak_ptr&& r) noexcept; // C++14 + + // modifiers + void swap(weak_ptr& r) noexcept; + void reset() noexcept; + + // observers + long use_count() const noexcept; + bool expired() const noexcept; + shared_ptr lock() const noexcept; + template bool owner_before(shared_ptr const& b) const noexcept; + template bool owner_before(weak_ptr const& b) const noexcept; +}; + +// weak_ptr specialized algorithms: +template void swap(weak_ptr& a, weak_ptr& b) noexcept; + +// class owner_less: +template struct owner_less; + +template +struct owner_less > + : __binary_function, shared_ptr, bool> +{ + typedef bool result_type; + bool operator()(shared_ptr const&, shared_ptr const&) const noexcept; + bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; + bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; +}; + +template +struct owner_less > + : __binary_function, weak_ptr, bool> +{ + typedef bool result_type; + bool operator()(weak_ptr const&, weak_ptr const&) const noexcept; + bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; + bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; +}; + +template <> // Added in C++14 +struct owner_less +{ + template + bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept; + template + bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept; + template + bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept; + template + bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept; + + typedef void is_transparent; +}; + +template +class enable_shared_from_this +{ +protected: + constexpr enable_shared_from_this() noexcept; + enable_shared_from_this(enable_shared_from_this const&) noexcept; + enable_shared_from_this& operator=(enable_shared_from_this const&) noexcept; + ~enable_shared_from_this(); +public: + shared_ptr shared_from_this(); + shared_ptr shared_from_this() const; +}; + +template + bool atomic_is_lock_free(const shared_ptr* p); +template + shared_ptr atomic_load(const shared_ptr* p); +template + shared_ptr atomic_load_explicit(const shared_ptr* p, memory_order mo); +template + void atomic_store(shared_ptr* p, shared_ptr r); +template + void atomic_store_explicit(shared_ptr* p, shared_ptr r, memory_order mo); +template + shared_ptr atomic_exchange(shared_ptr* p, shared_ptr r); +template + shared_ptr + atomic_exchange_explicit(shared_ptr* p, shared_ptr r, memory_order mo); +template + bool + atomic_compare_exchange_weak(shared_ptr* p, shared_ptr* v, shared_ptr w); +template + bool + atomic_compare_exchange_strong( shared_ptr* p, shared_ptr* v, shared_ptr w); +template + bool + atomic_compare_exchange_weak_explicit(shared_ptr* p, shared_ptr* v, + shared_ptr w, memory_order success, + memory_order failure); +template + bool + atomic_compare_exchange_strong_explicit(shared_ptr* p, shared_ptr* v, + shared_ptr w, memory_order success, + memory_order failure); +// Hash support +template struct hash; +template struct hash >; +template struct hash >; + +template + inline constexpr bool uses_allocator_v = uses_allocator::value; + +// Pointer safety +enum class pointer_safety { relaxed, preferred, strict }; +void declare_reachable(void *p); +template T *undeclare_reachable(T *p); +void declare_no_pointers(char *p, size_t n); +void undeclare_no_pointers(char *p, size_t n); +pointer_safety get_pointer_safety() noexcept; + +void* align(size_t alignment, size_t size, void*& ptr, size_t& space); + +} // std + +*/ +#ifndef __cuda_std__ +#include <__config> +#include +#include +#include +#include +#if !defined(_LIBCUDACXX_HAS_NO_ATOMIC_HEADER) +# include +#endif +#endif //__cuda_std__ + +#include "__assert" // all public C++ headers provide the assertion handler +#include "__functional_base" +#include "__iterator/iterator_traits.h" +#include "__iterator/iterator.h" +#include "__memory/addressof.h" +#include "__memory/construct_at.h" +#include "__memory/pointer_traits.h" +#include "__memory/voidify.h" +#include "__tuple_dir/tuple_indices.h" +#include "__type_traits/decay.h" +#include "__type_traits/enable_if.h" +#include "__type_traits/integral_constant.h" +#include "__type_traits/is_array.h" +#include "__type_traits/is_assignable.h" +#include "__type_traits/is_copy_constructible.h" +#include "__type_traits/is_constructible.h" +#include "__type_traits/is_convertible.h" +#include "__type_traits/is_default_constructible.h" +#include "__type_traits/is_move_constructible.h" +#include "__type_traits/is_reference.h" +#include "__type_traits/is_same.h" +#include "__type_traits/is_trivially_destructible.h" +#include "__type_traits/is_trivially_move_constructible.h" +#include "__type_traits/is_void.h" +#include "__type_traits/remove_const.h" +#include "__type_traits/remove_cv.h" +#include "__type_traits/remove_extent.h" +#include "__type_traits/remove_reference.h" +#include "__type_traits/void_t.h" +#include "__utility/declval.h" +#include "__utility/forward.h" +#include "__utility/piecewise_construct.h" +#include "cstddef" +#include "cstdint" +#include "iosfwd" +#include "limits" +#include "tuple" +#include "type_traits" + +// standard-mandated includes +#include "version" + +#ifndef __cuda_std__ +#include <__pragma_push> +#endif //__cuda_std__ + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +_LIBCUDACXX_BEGIN_NAMESPACE_STD + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_ValueType __libcpp_relaxed_load(_ValueType const* __value) { +#if !defined(_LIBCUDACXX_HAS_NO_THREADS) && \ + defined(__ATOMIC_RELAXED) && \ + (__has_builtin(__atomic_load_n) || defined(_LIBCUDACXX_COMPILER_GCC)) + return __atomic_load_n(__value, __ATOMIC_RELAXED); +#else + return *__value; +#endif +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +_ValueType __libcpp_acquire_load(_ValueType const* __value) { +#if !defined(_LIBCUDACXX_HAS_NO_THREADS) && \ + defined(__ATOMIC_ACQUIRE) && \ + (__has_builtin(__atomic_load_n) || defined(_LIBCUDACXX_COMPILER_GCC)) + return __atomic_load_n(__value, __ATOMIC_ACQUIRE); +#else + return *__value; +#endif +} + +// addressof moved to + +template class allocator; + +template <> +class _LIBCUDACXX_TEMPLATE_VIS allocator +{ +public: + typedef void* pointer; + typedef const void* const_pointer; + typedef void value_type; + + template struct rebind {typedef allocator<_Up> other;}; +}; + +template <> +class _LIBCUDACXX_TEMPLATE_VIS allocator +{ +public: + typedef const void* pointer; + typedef const void* const_pointer; + typedef const void value_type; + + template struct rebind {typedef allocator<_Up> other;}; +}; + +// allocator_traits + +template +struct __has_pointer_type : false_type {}; + +template +struct __has_pointer_type<_Tp, + __void_t> : true_type {}; + +namespace __pointer_type_imp +{ + +template ::value> +struct __pointer_type +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _Dp::pointer type; +}; + +template +struct __pointer_type<_Tp, _Dp, false> +{ + typedef _LIBCUDACXX_NODEBUG_TYPE _Tp* type; +}; + +} // __pointer_type_imp + +template +struct __pointer_type +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, __libcpp_remove_reference_t<_Dp>>::type type; +}; + +template +struct __has_const_pointer : false_type {}; + +template +struct __has_const_pointer<_Tp, + __void_t> : true_type {}; + +template ::value> +struct __const_pointer +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _Alloc::const_pointer type; +}; + +template +struct __const_pointer<_Tp, _Ptr, _Alloc, false> +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind type; +}; + +template +struct __has_void_pointer : false_type {}; + +template +struct __has_void_pointer<_Tp, + __void_t> : true_type {}; + +template ::value> +struct __void_pointer +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _Alloc::void_pointer type; +}; + +template +struct __void_pointer<_Ptr, _Alloc, false> +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind type; +}; + +template +struct __has_const_void_pointer : false_type {}; + +template +struct __has_const_void_pointer<_Tp, + __void_t> : true_type {}; + +template ::value> +struct __const_void_pointer +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _Alloc::const_void_pointer type; +}; + +template +struct __const_void_pointer<_Ptr, _Alloc, false> +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind type; +}; + +template +inline _LIBCUDACXX_INLINE_VISIBILITY constexpr +_Tp* +__to_raw_pointer(_Tp* __p) noexcept +{ + return __p; +} + +#if _LIBCUDACXX_STD_VER <= 17 +template +inline _LIBCUDACXX_INLINE_VISIBILITY +typename pointer_traits<_Pointer>::element_type* +__to_raw_pointer(_Pointer __p) noexcept +{ + return _CUDA_VSTD::__to_raw_pointer(__p.operator->()); +} +#else +template +inline _LIBCUDACXX_INLINE_VISIBILITY +auto +__to_raw_pointer(const _Pointer& __p) noexcept +-> decltype(pointer_traits<_Pointer>::to_address(__p)) +{ + return pointer_traits<_Pointer>::to_address(__p); +} + +template +inline _LIBCUDACXX_INLINE_VISIBILITY +auto +__to_raw_pointer(const _Pointer& __p, _None...) noexcept +{ + return _CUDA_VSTD::__to_raw_pointer(__p.operator->()); +} +#endif + +template +struct __has_size_type : false_type {}; + +template +struct __has_size_type<_Tp, + __void_t> : true_type {}; + +template ::value> +struct __size_type +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type; +}; + +template +struct __size_type<_Alloc, _DiffType, true> +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _Alloc::size_type type; +}; + +template +struct __has_propagate_on_container_copy_assignment : false_type {}; + +template +struct __has_propagate_on_container_copy_assignment<_Tp, + __void_t> + : true_type {}; + +template ::value> +struct __propagate_on_container_copy_assignment +{ + typedef _LIBCUDACXX_NODEBUG_TYPE false_type type; +}; + +template +struct __propagate_on_container_copy_assignment<_Alloc, true> +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _Alloc::propagate_on_container_copy_assignment type; +}; + +template +struct __has_propagate_on_container_move_assignment : false_type {}; + +template +struct __has_propagate_on_container_move_assignment<_Tp, + __void_t> + : true_type {}; + +template ::value> +struct __propagate_on_container_move_assignment +{ + typedef false_type type; +}; + +template +struct __propagate_on_container_move_assignment<_Alloc, true> +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type; +}; + +template +struct __has_propagate_on_container_swap : false_type {}; + +template +struct __has_propagate_on_container_swap<_Tp, + __void_t> + : true_type {}; + +template ::value> +struct __propagate_on_container_swap +{ + typedef false_type type; +}; + +template +struct __propagate_on_container_swap<_Alloc, true> +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type; +}; + +template +struct __has_is_always_equal : false_type {}; + +template +struct __has_is_always_equal<_Tp, + __void_t> + : true_type {}; + +template ::value> +struct __is_always_equal +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _CUDA_VSTD::is_empty<_Alloc>::type type; +}; + +template +struct __is_always_equal<_Alloc, true> +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _Alloc::is_always_equal type; +}; + +template ::value> +struct __has_rebind_other +{ +private: + struct __two {char __lx; char __lxx;}; + template static __two __test(...); + template static char __test(typename _Xp::template rebind<_Up>::other* = 0); +public: + static const bool value = sizeof(__test<_Tp>(0)) == 1; +}; + +template +struct __has_rebind_other<_Tp, _Up, false> +{ + static const bool value = false; +}; + +template ::value> +struct __allocator_traits_rebind +{ + typedef _LIBCUDACXX_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type; +}; + +#ifndef _LIBCUDACXX_HAS_NO_VARIADICS + +template