├── .gitignore ├── README.md ├── cublas.f90 ├── cublas_core.f90 ├── cublas_v2.f90 ├── cublasxt.f90 ├── cufft.f90 └── openacc_cublas.f90 /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Set of Fortran interfaces to CUDA libraries for GCC/OpenACC. 2 | Modules include cublas, cublas_v2, cublasxt, openacc_cublas, cufft. 3 | 4 | cublas_core is an internal module of shared definitions used by some of the 5 | above listed modules. 6 | 7 | To compile and .mod file: gfortran -c -O2 -g .f90 8 | -------------------------------------------------------------------------------- /cublas.f90: -------------------------------------------------------------------------------- 1 | !! Fortran CUDA Library interface -- CUBLAS (Legacy) module 2 | !! 3 | !! Copyright (C) 2017-2018 Mentor, A Siemens Business 4 | !! 5 | !! This software is provided 'as-is', without any express or implied 6 | !! warranty. In no event will the authors be held liable for any damages 7 | !! arising from the use of this software. 8 | !! 9 | !! Permission is granted to anyone to use this software for any purpose, 10 | !! including commercial applications, and to alter it and redistribute it 11 | !! freely, subject to the following restrictions: 12 | !! 13 | !! 1. The origin of this software must not be misrepresented; you must not 14 | !! claim that you wrote the original software. If you use this software 15 | !! in a product, an acknowledgment in the product documentation would be 16 | !! appreciated but is not required. 17 | !! 2. Altered source versions must be plainly marked as such, and must not be 18 | !! misrepresented as being the original software. 19 | !! 3. This notice may not be removed or altered from any source distribution. 20 | 21 | module cublas 22 | use iso_c_binding 23 | 24 | enum, bind(c) 25 | enumerator :: CUBLAS_STATUS_SUCCESS = 0 26 | enumerator :: CUBLAS_STATUS_NOT_INITIALIZED = 1 27 | enumerator :: CUBLAS_STATUS_ALLOC_FAILED = 3 28 | enumerator :: CUBLAS_STATUS_INVALID_VALUE = 7 29 | enumerator :: CUBLAS_STATUS_ARCH_MISMATCH = 8 30 | enumerator :: CUBLAS_STATUS_MAPPING_ERROR = 11 31 | enumerator :: CUBLAS_STATUS_EXECUTION_FAILED = 13 32 | enumerator :: CUBLAS_STATUS_INTERNAL_ERROR = 14 33 | enumerator :: CUBLAS_STATUS_NOT_SUPPORTED = 15 34 | enumerator :: CUBLAS_STATUS_LICENSE_ERROR = 16 35 | end enum 36 | 37 | interface 38 | integer(c_int) function cublasInit () & 39 | bind (c, name="cublasInit") 40 | import 41 | end function cublasInit 42 | 43 | integer(c_int) function cublasShutdown () & 44 | bind (c, name="cublasShutdown") 45 | import 46 | end function cublasShutdown 47 | 48 | integer(c_int) function cublasGetError () & 49 | bind (c, name="cublasGetError") 50 | import 51 | end function cublasGetError 52 | 53 | integer(c_int) function cublasGetVersion (version) & 54 | bind (c, name="cublasGetVersion") 55 | import 56 | integer(c_int) :: version 57 | end function cublasGetVersion 58 | 59 | integer(c_int) function cublasSetKernelStream (stream) & 60 | bind (c, name="cublasSetKernelStream") 61 | import 62 | type(c_ptr), value :: stream 63 | end function cublasSetKernelStream 64 | 65 | real(c_float) function cublasSnrm2 (n, x, incx) & 66 | bind (c, name="cublasSnrm2") 67 | import 68 | integer(c_int), value :: n, incx 69 | real(c_float), dimension(*) :: x 70 | end function cublasSnrm2 71 | 72 | real(c_double) function cublasDnrm2 (n, x, incx) & 73 | bind (c, name="cublasDnrm2") 74 | import 75 | real(c_double), dimension(*) :: x 76 | integer(c_int), value :: n, incx 77 | end function cublasDnrm2 78 | 79 | real(c_float) function cublasScnrm2 (n, x, incx) & 80 | bind (c, name="cublasScnrm2") 81 | import 82 | complex(c_float), dimension(*) :: x 83 | integer(c_int), value :: n, incx 84 | end function cublasScnrm2 85 | 86 | real(c_double) function cublasDznrm2 (n, x, incx) & 87 | bind (c, name="cublasDznrm2") 88 | import 89 | integer(c_int), value :: n, incx 90 | complex(c_double), dimension(*) :: x 91 | end function cublasDznrm2 92 | 93 | real(c_float) function cublasSdot (n, x, incx, y, incy) & 94 | bind (c, name="cublasSdot") 95 | import 96 | integer(c_int), value :: n, incx, incy 97 | real(c_float), dimension(*) :: x, y 98 | end function cublasSdot 99 | 100 | real(c_double) function cublasDdot (n, x, incx, y, incy) & 101 | bind (c, name="cublasDdot") 102 | import 103 | real(c_double), dimension(*) :: x, y 104 | integer(c_int), value :: n, incx, incy 105 | end function cublasDdot 106 | 107 | complex(c_float) function cublasCdotu (n, x, incx, y, incy) & 108 | bind (c, name="cublasCdotu") 109 | import 110 | complex(c_float), dimension(*) :: x, y 111 | integer(c_int), value :: n, incx, incy 112 | end function cublasCdotu 113 | 114 | complex(c_double) function cublasZdotu (n, x, incx, y, incy) & 115 | bind (c, name="cublasZdotu") 116 | import 117 | integer(c_int), value :: n, incx, incy 118 | complex(c_double), dimension(*) :: x, y 119 | end function cublasZdotu 120 | 121 | complex(c_float) function cublasCdotc (n, x, incx, y, incy) & 122 | bind (c, name="cublasCdotc") 123 | import 124 | complex(c_float), dimension(*) :: x, y 125 | integer(c_int), value :: n, incx, incy 126 | end function cublasCdotc 127 | 128 | complex(c_double) function cublasZdotc (n, x, incx, y, incy) & 129 | bind (c, name="cublasZdotc") 130 | import 131 | integer(c_int), value :: n, incx, incy 132 | complex(c_double), dimension(*) :: x, y 133 | end function cublasZdotc 134 | 135 | subroutine cublasSscal (n, alpha, x, incx) & 136 | bind (c, name="cublasSscal") 137 | import 138 | integer(c_int), value :: n, incx 139 | real(c_float), value :: alpha 140 | real(c_float), dimension(*) :: x 141 | end subroutine cublasSscal 142 | 143 | subroutine cublasDscal (n, alpha, x, incx) & 144 | bind (c, name="cublasDscal") 145 | import 146 | real(c_double), dimension(*) :: x 147 | integer(c_int), value :: n, incx 148 | real(c_double), value :: alpha 149 | end subroutine cublasDscal 150 | 151 | subroutine cublasCscal (n, alpha, x, incx) & 152 | bind (c, name="cublasCscal") 153 | import 154 | complex(c_float), dimension(*) :: x 155 | integer(c_int), value :: n, incx 156 | complex(c_float), value :: alpha 157 | end subroutine cublasCscal 158 | 159 | subroutine cublasZscal (n, alpha, x, incx) & 160 | bind (c, name="cublasZscal") 161 | import 162 | complex(c_double), value :: alpha 163 | integer(c_int), value :: n, incx 164 | complex(c_double), dimension(*) :: x 165 | end subroutine cublasZscal 166 | 167 | subroutine cublasCsscal (n, alpha, x, incx) & 168 | bind (c, name="cublasCsscal") 169 | import 170 | complex(c_float), dimension(*) :: x 171 | integer(c_int), value :: n, incx 172 | real(c_float), value :: alpha 173 | end subroutine cublasCsscal 174 | 175 | subroutine cublasZdscal (n, alpha, x, incx) & 176 | bind (c, name="cublasZdscal") 177 | import 178 | integer(c_int), value :: n, incx 179 | real(c_double), value :: alpha 180 | complex(c_double), dimension(*) :: x 181 | end subroutine cublasZdscal 182 | 183 | subroutine cublasSaxpy (n, alpha, x, incx, y, incy) & 184 | bind (c, name="cublasSaxpy") 185 | import 186 | integer(c_int), value :: n, incx, incy 187 | real(c_float), value :: alpha 188 | real(c_float), dimension(*) :: x, y 189 | end subroutine cublasSaxpy 190 | 191 | subroutine cublasDaxpy (n, alpha, x, incx, y, incy) & 192 | bind (c, name="cublasDaxpy") 193 | import 194 | real(c_double), dimension(*) :: x, y 195 | integer(c_int), value :: n, incx, incy 196 | real(c_double), value :: alpha 197 | end subroutine cublasDaxpy 198 | 199 | subroutine cublasCaxpy (n, alpha, x, incx, y, incy) & 200 | bind (c, name="cublasCaxpy") 201 | import 202 | complex(c_float), dimension(*) :: x, y 203 | integer(c_int), value :: n, incx, incy 204 | complex(c_float), value :: alpha 205 | end subroutine cublasCaxpy 206 | 207 | subroutine cublasZaxpy (n, alpha, x, incx, y, incy) & 208 | bind (c, name="cublasZaxpy") 209 | import 210 | complex(c_double), value :: alpha 211 | integer(c_int), value :: n, incx, incy 212 | complex(c_double), dimension(*) :: x, y 213 | end subroutine cublasZaxpy 214 | 215 | subroutine cublasScopy (n, x, incx, y, incy) & 216 | bind (c, name="cublasScopy") 217 | import 218 | integer(c_int), value :: n, incx, incy 219 | real(c_float), dimension(*) :: x, y 220 | end subroutine cublasScopy 221 | 222 | subroutine cublasDcopy (n, x, incx, y, incy) & 223 | bind (c, name="cublasDcopy") 224 | import 225 | real(c_double), dimension(*) :: x, y 226 | integer(c_int), value :: n, incx, incy 227 | end subroutine cublasDcopy 228 | 229 | subroutine cublasCcopy (n, x, incx, y, incy) & 230 | bind (c, name="cublasCcopy") 231 | import 232 | complex(c_float), dimension(*) :: x, y 233 | integer(c_int), value :: n, incx, incy 234 | end subroutine cublasCcopy 235 | 236 | subroutine cublasZcopy (n, x, incx, y, incy) & 237 | bind (c, name="cublasZcopy") 238 | import 239 | integer(c_int), value :: n, incx, incy 240 | complex(c_double), dimension(*) :: x, y 241 | end subroutine cublasZcopy 242 | 243 | subroutine cublasSswap (n, x, incx, y, incy) & 244 | bind (c, name="cublasSswap") 245 | import 246 | integer(c_int), value :: n, incx, incy 247 | real(c_float), dimension(*) :: x, y 248 | end subroutine cublasSswap 249 | 250 | subroutine cublasDswap (n, x, incx, y, incy) & 251 | bind (c, name="cublasDswap") 252 | import 253 | real(c_double), dimension(*) :: x, y 254 | integer(c_int), value :: n, incx, incy 255 | end subroutine cublasDswap 256 | 257 | subroutine cublasCswap (n, x, incx, y, incy) & 258 | bind (c, name="cublasCswap") 259 | import 260 | complex(c_float), dimension(*) :: x, y 261 | integer(c_int), value :: n, incx, incy 262 | end subroutine cublasCswap 263 | 264 | subroutine cublasZswap (n, x, incx, y, incy) & 265 | bind (c, name="cublasZswap") 266 | import 267 | integer(c_int), value :: n, incx, incy 268 | complex(c_double), dimension(*) :: x, y 269 | end subroutine cublasZswap 270 | 271 | integer(c_int) function cublasIsamax (n, x, incx) & 272 | bind (c, name="cublasIsamax") 273 | import 274 | integer(c_int), value :: n, incx 275 | real(c_float), dimension(*) :: x 276 | end function cublasIsamax 277 | 278 | integer(c_int) function cublasIdamax (n, x, incx) & 279 | bind (c, name="cublasIdamax") 280 | import 281 | real(c_double), dimension(*) :: x 282 | integer(c_int), value :: n, incx 283 | end function cublasIdamax 284 | 285 | integer(c_int) function cublasIcamax (n, x, incx) & 286 | bind (c, name="cublasIcamax") 287 | import 288 | complex(c_float), dimension(*) :: x 289 | integer(c_int), value :: n, incx 290 | end function cublasIcamax 291 | 292 | integer(c_int) function cublasIzamax (n, x, incx) & 293 | bind (c, name="cublasIzamax") 294 | import 295 | integer(c_int), value :: n, incx 296 | complex(c_double), dimension(*) :: x 297 | end function cublasIzamax 298 | 299 | integer(c_int) function cublasIsamin (n, x, incx) & 300 | bind (c, name="cublasIsamin") 301 | import 302 | integer(c_int), value :: n, incx 303 | real(c_float), dimension(*) :: x 304 | end function cublasIsamin 305 | 306 | integer(c_int) function cublasIdamin (n, x, incx) & 307 | bind (c, name="cublasIdamin") 308 | import 309 | real(c_double), dimension(*) :: x 310 | integer(c_int), value :: n, incx 311 | end function cublasIdamin 312 | 313 | integer(c_int) function cublasIcamin (n, x, incx) & 314 | bind (c, name="cublasIcamin") 315 | import 316 | complex(c_float), dimension(*) :: x 317 | integer(c_int), value :: n, incx 318 | end function cublasIcamin 319 | 320 | integer(c_int) function cublasIzamin (n, x, incx) & 321 | bind (c, name="cublasIzamin") 322 | import 323 | integer(c_int), value :: n, incx 324 | complex(c_double), dimension(*) :: x 325 | end function cublasIzamin 326 | 327 | real(c_float) function cublasSasum (n, x, incx) & 328 | bind (c, name="cublasSasum") 329 | import 330 | integer(c_int), value :: n, incx 331 | real(c_float), dimension(*) :: x 332 | end function cublasSasum 333 | 334 | real(c_double) function cublasDasum (n, x, incx) & 335 | bind (c, name="cublasDasum") 336 | import 337 | real(c_double), dimension(*) :: x 338 | integer(c_int), value :: n, incx 339 | end function cublasDasum 340 | 341 | real(c_float) function cublasScasum (n, x, incx) & 342 | bind (c, name="cublasScasum") 343 | import 344 | complex(c_float), dimension(*) :: x 345 | integer(c_int), value :: n, incx 346 | end function cublasScasum 347 | 348 | real(c_double) function cublasDzasum (n, x, incx) & 349 | bind (c, name="cublasDzasum") 350 | import 351 | integer(c_int), value :: n, incx 352 | complex(c_double), dimension(*) :: x 353 | end function cublasDzasum 354 | 355 | subroutine cublasSrot (n, x, incx, y, incy, sc, ss) & 356 | bind (c, name="cublasSrot") 357 | import 358 | integer(c_int), value :: n, incx, incy 359 | real(c_float), value :: sc, ss 360 | real(c_float), dimension(*) :: x, y 361 | end subroutine cublasSrot 362 | 363 | subroutine cublasDrot (n, x, incx, y, incy, sc, ss) & 364 | bind (c, name="cublasDrot") 365 | import 366 | real(c_double), dimension(*) :: x, y 367 | integer(c_int), value :: n, incx, incy 368 | real(c_double), value :: sc, ss 369 | end subroutine cublasDrot 370 | 371 | subroutine cublasCrot (n, x, incx, y, incy, sc, ss) & 372 | bind (c, name="cublasCrot") 373 | import 374 | complex(c_float), dimension(*) :: x, y 375 | integer(c_int), value :: n, incx, incy 376 | complex(c_float), value :: sc, ss 377 | end subroutine cublasCrot 378 | 379 | subroutine cublasZrot (n, x, incx, y, incy, sc, ss) & 380 | bind (c, name="cublasZrot") 381 | import 382 | complex(c_double), value :: sc, ss 383 | integer(c_int), value :: n, incx, incy 384 | complex(c_double), dimension(*) :: x, y 385 | end subroutine cublasZrot 386 | 387 | subroutine cublasCsrot (n, x, incx, y, incy, c, s) & 388 | bind (c, name="cublasCsrot") 389 | import 390 | complex(c_float), dimension(*) :: x, y 391 | integer(c_int), value :: n, incx, incy 392 | real(c_float), value :: c, s 393 | end subroutine cublasCsrot 394 | 395 | subroutine cublasZdrot (n, x, incx, y, incy, c, s) & 396 | bind (c, name="cublasZdrot") 397 | import 398 | integer(c_int), value :: n, incx, incy 399 | real(c_double), value :: c, s 400 | complex(c_double), dimension(*) :: x, y 401 | end subroutine cublasZdrot 402 | 403 | subroutine cublasSrotg (sa, sb, sc, ss) & 404 | bind (c, name="cublasSrotg") 405 | import 406 | real(c_float) :: sa, sb, sc, ss 407 | end subroutine cublasSrotg 408 | 409 | subroutine cublasDrotg (sa, sb, sc, ss) & 410 | bind (c, name="cublasDrotg") 411 | import 412 | real(c_double) :: sa, sb, sc, ss 413 | end subroutine cublasDrotg 414 | 415 | subroutine cublasCrotg (sa, sb, sc, ss) & 416 | bind (c, name="cublasCrotg") 417 | import 418 | complex(c_float) :: sa, sb, sc, ss 419 | end subroutine cublasCrotg 420 | 421 | subroutine cublasZrotg (sa, sb, sc, ss) & 422 | bind (c, name="cublasZrotg") 423 | import 424 | complex(c_double) :: sa, sb, sc, ss 425 | end subroutine cublasZrotg 426 | 427 | subroutine cublasSrotm (n, x, incx, y, incy, param) & 428 | bind (c, name="cublasSrotm") 429 | import 430 | integer(c_int), value :: n, incx, incy 431 | real(c_float), dimension(*) :: x, y, param 432 | end subroutine cublasSrotm 433 | 434 | subroutine cublasDrotm (n, x, incx, y, incy, param) & 435 | bind (c, name="cublasDrotm") 436 | import 437 | real(c_double), dimension(*) :: x, y, param 438 | integer(c_int), value :: n, incx, incy 439 | end subroutine cublasDrotm 440 | 441 | subroutine cublasSrotmg (d1, d2, x1, y1, param) & 442 | bind (c, name="cublasSrotmg") 443 | import 444 | real(c_float) :: d1, d2, x1, y1 445 | real(c_float), dimension(*) :: param 446 | end subroutine cublasSrotmg 447 | 448 | subroutine cublasDrotmg (d1, d2, x1, y1, param) & 449 | bind (c, name="cublasDrotmg") 450 | import 451 | real(c_double), dimension(*) :: param 452 | real(c_double) :: d1, d2, x1, y1 453 | end subroutine cublasDrotmg 454 | 455 | subroutine cublasSgemv (trans, m, n, alpha, A, lda, x, incx, beta, y, incy) & 456 | bind (c, name="cublasSgemv") 457 | import 458 | integer(c_int), value :: m, n, lda, incx, incy 459 | real(c_float), dimension(*) :: x, y 460 | real(c_float), value :: alpha, beta 461 | character(c_char), value :: trans 462 | real(c_float), dimension(lda, *) :: A 463 | end subroutine cublasSgemv 464 | 465 | subroutine cublasDgemv (trans, m, n, alpha, A, lda, x, incx, beta, y, incy) & 466 | bind (c, name="cublasDgemv") 467 | import 468 | integer(c_int), value :: m, n, lda, incx, incy 469 | real(c_double), dimension(lda, *) :: A 470 | real(c_double), value :: alpha, beta 471 | character(c_char), value :: trans 472 | real(c_double), dimension(*) :: x, y 473 | end subroutine cublasDgemv 474 | 475 | subroutine cublasCgemv (trans, m, n, alpha, A, lda, x, incx, beta, y, incy) & 476 | bind (c, name="cublasCgemv") 477 | import 478 | integer(c_int), value :: m, n, lda, incx, incy 479 | complex(c_float), dimension(*) :: x, y 480 | character(c_char), value :: trans 481 | complex(c_float), dimension(lda, *) :: A 482 | complex(c_float), value :: alpha, beta 483 | end subroutine cublasCgemv 484 | 485 | subroutine cublasZgemv (trans, m, n, alpha, A, lda, x, incx, beta, y, incy) & 486 | bind (c, name="cublasZgemv") 487 | import 488 | integer(c_int), value :: m, n, lda, incx, incy 489 | complex(c_double), dimension(*) :: x, y 490 | complex(c_double), value :: alpha, beta 491 | complex(c_double), dimension(lda, *) :: A 492 | character(c_char), value :: trans 493 | end subroutine cublasZgemv 494 | 495 | subroutine cublasSgbmv & 496 | (trans, m, n, kl, ku, alpha, A, lda, x, incx, beta, y, incy) & 497 | bind (c, name="cublasSgbmv") 498 | import 499 | integer(c_int), value :: m, n, kl, ku, lda, incx, incy 500 | real(c_float), dimension(*) :: x, y 501 | real(c_float), value :: alpha, beta 502 | character(c_char), value :: trans 503 | real(c_float), dimension(lda, *) :: A 504 | end subroutine cublasSgbmv 505 | 506 | subroutine cublasDgbmv & 507 | (trans, m, n, kl, ku, alpha, A, lda, x, incx, beta, y, incy) & 508 | bind (c, name="cublasDgbmv") 509 | import 510 | integer(c_int), value :: m, n, kl, ku, lda, incx, incy 511 | real(c_double), dimension(lda, *) :: A 512 | real(c_double), value :: alpha, beta 513 | character(c_char), value :: trans 514 | real(c_double), dimension(*) :: x, y 515 | end subroutine cublasDgbmv 516 | 517 | subroutine cublasCgbmv & 518 | (trans, m, n, kl, ku, alpha, A, lda, x, incx, beta, y, incy) & 519 | bind (c, name="cublasCgbmv") 520 | import 521 | integer(c_int), value :: m, n, kl, ku, lda, incx, incy 522 | complex(c_float), dimension(*) :: x, y 523 | character(c_char), value :: trans 524 | complex(c_float), dimension(lda, *) :: A 525 | complex(c_float), value :: alpha, beta 526 | end subroutine cublasCgbmv 527 | 528 | subroutine cublasZgbmv & 529 | (trans, m, n, kl, ku, alpha, A, lda, x, incx, beta, y, incy) & 530 | bind (c, name="cublasZgbmv") 531 | import 532 | integer(c_int), value :: m, n, kl, ku, lda, incx, incy 533 | complex(c_double), dimension(*) :: x, y 534 | complex(c_double), value :: alpha, beta 535 | complex(c_double), dimension(lda, *) :: A 536 | character(c_char), value :: trans 537 | end subroutine cublasZgbmv 538 | 539 | subroutine cublasStrmv (uplo, trans, diag, n, A, lda, x, incx) & 540 | bind (c, name="cublasStrmv") 541 | import 542 | integer(c_int), value :: n, lda, incx 543 | real(c_float), dimension(*) :: x 544 | character(c_char), value :: uplo, trans, diag 545 | real(c_float), dimension(lda, *) :: A 546 | end subroutine cublasStrmv 547 | 548 | subroutine cublasDtrmv (uplo, trans, diag, n, A, lda, x, incx) & 549 | bind (c, name="cublasDtrmv") 550 | import 551 | integer(c_int), value :: n, lda, incx 552 | real(c_double), dimension(lda, *) :: A 553 | character(c_char), value :: uplo, trans, diag 554 | real(c_double), dimension(*) :: x 555 | end subroutine cublasDtrmv 556 | 557 | subroutine cublasCtrmv (uplo, trans, diag, n, A, lda, x, incx) & 558 | bind (c, name="cublasCtrmv") 559 | import 560 | integer(c_int), value :: n, lda, incx 561 | complex(c_float), dimension(*) :: x 562 | character(c_char), value :: uplo, trans, diag 563 | complex(c_float), dimension(lda, *) :: A 564 | end subroutine cublasCtrmv 565 | 566 | subroutine cublasZtrmv (uplo, trans, diag, n, A, lda, x, incx) & 567 | bind (c, name="cublasZtrmv") 568 | import 569 | integer(c_int), value :: n, lda, incx 570 | complex(c_double), dimension(*) :: x 571 | complex(c_double), dimension(lda, *) :: A 572 | character(c_char), value :: uplo, trans, diag 573 | end subroutine cublasZtrmv 574 | 575 | subroutine cublasStbmv (uplo, trans, diag, n, k, A, lda, x, incx) & 576 | bind (c, name="cublasStbmv") 577 | import 578 | integer(c_int), value :: n, k, lda, incx 579 | real(c_float), dimension(*) :: x 580 | character(c_char), value :: uplo, trans, diag 581 | real(c_float), dimension(lda, *) :: A 582 | end subroutine cublasStbmv 583 | 584 | subroutine cublasDtbmv (uplo, trans, diag, n, k, A, lda, x, incx) & 585 | bind (c, name="cublasDtbmv") 586 | import 587 | integer(c_int), value :: n, k, lda, incx 588 | real(c_double), dimension(lda, *) :: A 589 | character(c_char), value :: uplo, trans, diag 590 | real(c_double), dimension(*) :: x 591 | end subroutine cublasDtbmv 592 | 593 | subroutine cublasCtbmv (uplo, trans, diag, n, k, A, lda, x, incx) & 594 | bind (c, name="cublasCtbmv") 595 | import 596 | integer(c_int), value :: n, k, lda, incx 597 | complex(c_float), dimension(*) :: x 598 | character(c_char), value :: uplo, trans, diag 599 | complex(c_float), dimension(lda, *) :: A 600 | end subroutine cublasCtbmv 601 | 602 | subroutine cublasZtbmv (uplo, trans, diag, n, k, A, lda, x, incx) & 603 | bind (c, name="cublasZtbmv") 604 | import 605 | integer(c_int), value :: n, k, lda, incx 606 | complex(c_double), dimension(*) :: x 607 | complex(c_double), dimension(lda, *) :: A 608 | character(c_char), value :: uplo, trans, diag 609 | end subroutine cublasZtbmv 610 | 611 | subroutine cublasStpmv (uplo, trans, diag, n, AP, x, incx) & 612 | bind (c, name="cublasStpmv") 613 | import 614 | integer(c_int), value :: n, incx 615 | character(c_char), value :: uplo, trans, diag 616 | real(c_float), dimension(*) :: AP, x 617 | end subroutine cublasStpmv 618 | 619 | subroutine cublasDtpmv (uplo, trans, diag, n, AP, x, incx) & 620 | bind (c, name="cublasDtpmv") 621 | import 622 | real(c_double), dimension(*) :: AP, x 623 | integer(c_int), value :: n, incx 624 | character(c_char), value :: uplo, trans, diag 625 | end subroutine cublasDtpmv 626 | 627 | subroutine cublasCtpmv (uplo, trans, diag, n, AP, x, incx) & 628 | bind (c, name="cublasCtpmv") 629 | import 630 | complex(c_float), dimension(*) :: AP, x 631 | integer(c_int), value :: n, incx 632 | character(c_char), value :: uplo, trans, diag 633 | end subroutine cublasCtpmv 634 | 635 | subroutine cublasZtpmv (uplo, trans, diag, n, AP, x, incx) & 636 | bind (c, name="cublasZtpmv") 637 | import 638 | integer(c_int), value :: n, incx 639 | complex(c_double), dimension(*) :: AP, x 640 | character(c_char), value :: uplo, trans, diag 641 | end subroutine cublasZtpmv 642 | 643 | subroutine cublasStrsv (uplo, trans, diag, n, A, lda, x, incx) & 644 | bind (c, name="cublasStrsv") 645 | import 646 | integer(c_int), value :: n, lda, incx 647 | real(c_float), dimension(*) :: x 648 | character(c_char), value :: uplo, trans, diag 649 | real(c_float), dimension(lda, *) :: A 650 | end subroutine cublasStrsv 651 | 652 | subroutine cublasDtrsv (uplo, trans, diag, n, A, lda, x, incx) & 653 | bind (c, name="cublasDtrsv") 654 | import 655 | integer(c_int), value :: n, lda, incx 656 | real(c_double), dimension(lda, *) :: A 657 | character(c_char), value :: uplo, trans, diag 658 | real(c_double), dimension(*) :: x 659 | end subroutine cublasDtrsv 660 | 661 | subroutine cublasCtrsv (uplo, trans, diag, n, A, lda, x, incx) & 662 | bind (c, name="cublasCtrsv") 663 | import 664 | integer(c_int), value :: n, lda, incx 665 | complex(c_float), dimension(*) :: x 666 | character(c_char), value :: uplo, trans, diag 667 | complex(c_float), dimension(lda, *) :: A 668 | end subroutine cublasCtrsv 669 | 670 | subroutine cublasZtrsv (uplo, trans, diag, n, A, lda, x, incx) & 671 | bind (c, name="cublasZtrsv") 672 | import 673 | integer(c_int), value :: n, lda, incx 674 | complex(c_double), dimension(*) :: x 675 | complex(c_double), dimension(lda, *) :: A 676 | character(c_char), value :: uplo, trans, diag 677 | end subroutine cublasZtrsv 678 | 679 | subroutine cublasStpsv (uplo, trans, diag, n, AP, x, incx) & 680 | bind (c, name="cublasStpsv") 681 | import 682 | integer(c_int), value :: n, incx 683 | character(c_char), value :: uplo, trans, diag 684 | real(c_float), dimension(*) :: AP, x 685 | end subroutine cublasStpsv 686 | 687 | subroutine cublasDtpsv (uplo, trans, diag, n, AP, x, incx) & 688 | bind (c, name="cublasDtpsv") 689 | import 690 | real(c_double), dimension(*) :: AP, x 691 | integer(c_int), value :: n, incx 692 | character(c_char), value :: uplo, trans, diag 693 | end subroutine cublasDtpsv 694 | 695 | subroutine cublasCtpsv (uplo, trans, diag, n, AP, x, incx) & 696 | bind (c, name="cublasCtpsv") 697 | import 698 | complex(c_float), dimension(*) :: AP, x 699 | integer(c_int), value :: n, incx 700 | character(c_char), value :: uplo, trans, diag 701 | end subroutine cublasCtpsv 702 | 703 | subroutine cublasZtpsv (uplo, trans, diag, n, AP, x, incx) & 704 | bind (c, name="cublasZtpsv") 705 | import 706 | integer(c_int), value :: n, incx 707 | complex(c_double), dimension(*) :: AP, x 708 | character(c_char), value :: uplo, trans, diag 709 | end subroutine cublasZtpsv 710 | 711 | subroutine cublasStbsv (uplo, trans, diag, n, k, A, lda, x, incx) & 712 | bind (c, name="cublasStbsv") 713 | import 714 | integer(c_int), value :: n, k, lda, incx 715 | real(c_float), dimension(*) :: x 716 | character(c_char), value :: uplo, trans, diag 717 | real(c_float), dimension(lda, *) :: A 718 | end subroutine cublasStbsv 719 | 720 | subroutine cublasDtbsv (uplo, trans, diag, n, k, A, lda, x, incx) & 721 | bind (c, name="cublasDtbsv") 722 | import 723 | integer(c_int), value :: n, k, lda, incx 724 | real(c_double), dimension(lda, *) :: A 725 | character(c_char), value :: uplo, trans, diag 726 | real(c_double), dimension(*) :: x 727 | end subroutine cublasDtbsv 728 | 729 | subroutine cublasCtbsv (uplo, trans, diag, n, k, A, lda, x, incx) & 730 | bind (c, name="cublasCtbsv") 731 | import 732 | integer(c_int), value :: n, k, lda, incx 733 | complex(c_float), dimension(*) :: x 734 | character(c_char), value :: uplo, trans, diag 735 | complex(c_float), dimension(lda, *) :: A 736 | end subroutine cublasCtbsv 737 | 738 | subroutine cublasZtbsv (uplo, trans, diag, n, k, A, lda, x, incx) & 739 | bind (c, name="cublasZtbsv") 740 | import 741 | integer(c_int), value :: n, k, lda, incx 742 | complex(c_double), dimension(*) :: x 743 | complex(c_double), dimension(lda, *) :: A 744 | character(c_char), value :: uplo, trans, diag 745 | end subroutine cublasZtbsv 746 | 747 | subroutine cublasSsymv (uplo, n, alpha, A, lda, x, incx, beta, y, incy) & 748 | bind (c, name="cublasSsymv") 749 | import 750 | integer(c_int), value :: n, lda, incx, incy 751 | real(c_float), dimension(*) :: x, y 752 | real(c_float), value :: alpha, beta 753 | character(c_char), value :: uplo 754 | real(c_float), dimension(lda, *) :: A 755 | end subroutine cublasSsymv 756 | 757 | subroutine cublasDsymv (uplo, n, alpha, A, lda, x, incx, beta, y, incy) & 758 | bind (c, name="cublasDsymv") 759 | import 760 | integer(c_int), value :: n, lda, incx, incy 761 | real(c_double), dimension(lda, *) :: A 762 | real(c_double), value :: alpha, beta 763 | character(c_char), value :: uplo 764 | real(c_double), dimension(*) :: x, y 765 | end subroutine cublasDsymv 766 | 767 | subroutine cublasChemv (uplo, n, alpha, A, lda, x, incx, beta, y, incy) & 768 | bind (c, name="cublasChemv") 769 | import 770 | integer(c_int), value :: n, lda, incx, incy 771 | complex(c_float), dimension(*) :: x, y 772 | character(c_char), value :: uplo 773 | complex(c_float), dimension(lda, *) :: A 774 | complex(c_float), value :: alpha, beta 775 | end subroutine cublasChemv 776 | 777 | subroutine cublasZhemv (uplo, n, alpha, A, lda, x, incx, beta, y, incy) & 778 | bind (c, name="cublasZhemv") 779 | import 780 | integer(c_int), value :: n, lda, incx, incy 781 | complex(c_double), dimension(*) :: x, y 782 | complex(c_double), value :: alpha, beta 783 | complex(c_double), dimension(lda, *) :: A 784 | character(c_char), value :: uplo 785 | end subroutine cublasZhemv 786 | 787 | subroutine cublasSsbmv (uplo, n, k, alpha, A, lda, x, incx, beta, y, incy) & 788 | bind (c, name="cublasSsbmv") 789 | import 790 | integer(c_int), value :: n, k, lda, incx, incy 791 | real(c_float), dimension(*) :: x, y 792 | real(c_float), value :: alpha, beta 793 | character(c_char), value :: uplo 794 | real(c_float), dimension(lda, *) :: A 795 | end subroutine cublasSsbmv 796 | 797 | subroutine cublasDsbmv (uplo, n, k, alpha, A, lda, x, incx, beta, y, incy) & 798 | bind (c, name="cublasDsbmv") 799 | import 800 | integer(c_int), value :: n, k, lda, incx, incy 801 | real(c_double), dimension(lda, *) :: A 802 | real(c_double), value :: alpha, beta 803 | character(c_char), value :: uplo 804 | real(c_double), dimension(*) :: x, y 805 | end subroutine cublasDsbmv 806 | 807 | subroutine cublasChbmv (uplo, n, k, alpha, A, lda, x, incx, beta, y, incy) & 808 | bind (c, name="cublasChbmv") 809 | import 810 | integer(c_int), value :: n, k, lda, incx, incy 811 | complex(c_float), dimension(*) :: x, y 812 | character(c_char), value :: uplo 813 | complex(c_float), dimension(lda, *) :: A 814 | complex(c_float), value :: alpha, beta 815 | end subroutine cublasChbmv 816 | 817 | subroutine cublasZhbmv (uplo, n, k, alpha, A, lda, x, incx, beta, y, incy) & 818 | bind (c, name="cublasZhbmv") 819 | import 820 | integer(c_int), value :: n, k, lda, incx, incy 821 | complex(c_double), dimension(*) :: x, y 822 | complex(c_double), value :: alpha, beta 823 | complex(c_double), dimension(lda, *) :: A 824 | character(c_char), value :: uplo 825 | end subroutine cublasZhbmv 826 | 827 | subroutine cublasSspmv (uplo, n, alpha, AP, x, incx, beta, y, incy) & 828 | bind (c, name="cublasSspmv") 829 | import 830 | integer(c_int), value :: n, incx, incy 831 | real(c_float), value :: alpha, beta 832 | character(c_char), value :: uplo 833 | real(c_float), dimension(*) :: AP, x, y 834 | end subroutine cublasSspmv 835 | 836 | subroutine cublasDspmv (uplo, n, alpha, AP, x, incx, beta, y, incy) & 837 | bind (c, name="cublasDspmv") 838 | import 839 | real(c_double), dimension(*) :: AP, x, y 840 | integer(c_int), value :: n, incx, incy 841 | real(c_double), value :: alpha, beta 842 | character(c_char), value :: uplo 843 | end subroutine cublasDspmv 844 | 845 | subroutine cublasChpmv (uplo, n, alpha, AP, x, incx, beta, y, incy) & 846 | bind (c, name="cublasChpmv") 847 | import 848 | complex(c_float), dimension(*) :: AP, x, y 849 | integer(c_int), value :: n, incx, incy 850 | character(c_char), value :: uplo 851 | complex(c_float), value :: alpha, beta 852 | end subroutine cublasChpmv 853 | 854 | subroutine cublasZhpmv (uplo, n, alpha, AP, x, incx, beta, y, incy) & 855 | bind (c, name="cublasZhpmv") 856 | import 857 | complex(c_double), value :: alpha, beta 858 | integer(c_int), value :: n, incx, incy 859 | complex(c_double), dimension(*) :: AP, x, y 860 | character(c_char), value :: uplo 861 | end subroutine cublasZhpmv 862 | 863 | subroutine cublasSger (m, n, alpha, x, incx, y, incy, A, lda) & 864 | bind (c, name="cublasSger") 865 | import 866 | integer(c_int), value :: m, n, incx, incy, lda 867 | real(c_float), value :: alpha 868 | real(c_float), dimension(*) :: x, y 869 | real(c_float), dimension(lda, *) :: A 870 | end subroutine cublasSger 871 | 872 | subroutine cublasDger (m, n, alpha, x, incx, y, incy, A, lda) & 873 | bind (c, name="cublasDger") 874 | import 875 | integer(c_int), value :: m, n, incx, incy, lda 876 | real(c_double), dimension(*) :: x, y 877 | real(c_double), value :: alpha 878 | real(c_double), dimension(lda, *) :: A 879 | end subroutine cublasDger 880 | 881 | subroutine cublasCgeru (m, n, alpha, x, incx, y, incy, A, lda) & 882 | bind (c, name="cublasCgeru") 883 | import 884 | integer(c_int), value :: m, n, incx, incy, lda 885 | complex(c_float), dimension(*) :: x, y 886 | complex(c_float), dimension(lda, *) :: A 887 | complex(c_float), value :: alpha 888 | end subroutine cublasCgeru 889 | 890 | subroutine cublasZgeru (m, n, alpha, x, incx, y, incy, A, lda) & 891 | bind (c, name="cublasZgeru") 892 | import 893 | integer(c_int), value :: m, n, incx, incy, lda 894 | complex(c_double), value :: alpha 895 | complex(c_double), dimension(lda, *) :: A 896 | complex(c_double), dimension(*) :: x, y 897 | end subroutine cublasZgeru 898 | 899 | subroutine cublasCgerc (m, n, alpha, x, incx, y, incy, A, lda) & 900 | bind (c, name="cublasCgerc") 901 | import 902 | integer(c_int), value :: m, n, incx, incy, lda 903 | complex(c_float), dimension(*) :: x, y 904 | complex(c_float), dimension(lda, *) :: A 905 | complex(c_float), value :: alpha 906 | end subroutine cublasCgerc 907 | 908 | subroutine cublasZgerc (m, n, alpha, x, incx, y, incy, A, lda) & 909 | bind (c, name="cublasZgerc") 910 | import 911 | integer(c_int), value :: m, n, incx, incy, lda 912 | complex(c_double), value :: alpha 913 | complex(c_double), dimension(lda, *) :: A 914 | complex(c_double), dimension(*) :: x, y 915 | end subroutine cublasZgerc 916 | 917 | subroutine cublasSsyr (uplo, n, alpha, x, incx, A, lda) & 918 | bind (c, name="cublasSsyr") 919 | import 920 | integer(c_int), value :: n, incx, lda 921 | real(c_float), dimension(lda, *) :: A 922 | real(c_float), value :: alpha 923 | character(c_char), value :: uplo 924 | real(c_float), dimension(*) :: x 925 | end subroutine cublasSsyr 926 | 927 | subroutine cublasDsyr (uplo, n, alpha, x, incx, A, lda) & 928 | bind (c, name="cublasDsyr") 929 | import 930 | integer(c_int), value :: n, incx, lda 931 | real(c_double), dimension(*) :: x 932 | real(c_double), value :: alpha 933 | character(c_char), value :: uplo 934 | real(c_double), dimension(lda, *) :: A 935 | end subroutine cublasDsyr 936 | 937 | subroutine cublasCher (uplo, n, alpha, x, incx, A, lda) & 938 | bind (c, name="cublasCher") 939 | import 940 | integer(c_int), value :: n, incx, lda 941 | complex(c_float), dimension(*) :: x 942 | character(c_char), value :: uplo 943 | complex(c_float), dimension(lda, *) :: A 944 | complex(c_float), value :: alpha 945 | end subroutine cublasCher 946 | 947 | subroutine cublasZher (uplo, n, alpha, x, incx, A, lda) & 948 | bind (c, name="cublasZher") 949 | import 950 | integer(c_int), value :: n, incx, lda 951 | complex(c_double), value :: alpha 952 | complex(c_double), dimension(*) :: x 953 | character(c_char), value :: uplo 954 | complex(c_double), dimension(lda, *) :: A 955 | end subroutine cublasZher 956 | 957 | subroutine cublasSspr (uplo, n, alpha, x, incx, AP) & 958 | bind (c, name="cublasSspr") 959 | import 960 | integer(c_int), value :: n, incx 961 | real(c_float), value :: alpha 962 | character(c_char), value :: uplo 963 | real(c_float), dimension(*) :: x, AP 964 | end subroutine cublasSspr 965 | 966 | subroutine cublasDspr (uplo, n, alpha, x, incx, AP) & 967 | bind (c, name="cublasDspr") 968 | import 969 | real(c_double), dimension(*) :: x, AP 970 | integer(c_int), value :: n, incx 971 | real(c_double), value :: alpha 972 | character(c_char), value :: uplo 973 | end subroutine cublasDspr 974 | 975 | subroutine cublasChpr (uplo, n, alpha, x, incx, AP) & 976 | bind (c, name="cublasChpr") 977 | import 978 | complex(c_float), dimension(*) :: x, AP 979 | integer(c_int), value :: n, incx 980 | character(c_char), value :: uplo 981 | complex(c_float), value :: alpha 982 | end subroutine cublasChpr 983 | 984 | subroutine cublasZhpr (uplo, n, alpha, x, incx, AP) & 985 | bind (c, name="cublasZhpr") 986 | import 987 | complex(c_double), value :: alpha 988 | integer(c_int), value :: n, incx 989 | complex(c_double), dimension(*) :: x, AP 990 | character(c_char), value :: uplo 991 | end subroutine cublasZhpr 992 | 993 | subroutine cublasSsyr2 (uplo, n, alpha, x, incx, y, incy, A, lda) & 994 | bind (c, name="cublasSsyr2") 995 | import 996 | integer(c_int), value :: n, incx, incy, lda 997 | real(c_float), dimension(lda, *) :: A 998 | real(c_float), value :: alpha 999 | character(c_char), value :: uplo 1000 | real(c_float), dimension(*) :: x, y 1001 | end subroutine cublasSsyr2 1002 | 1003 | subroutine cublasDsyr2 (uplo, n, alpha, x, incx, y, incy, A, lda) & 1004 | bind (c, name="cublasDsyr2") 1005 | import 1006 | integer(c_int), value :: n, incx, incy, lda 1007 | real(c_double), dimension(*) :: x, y 1008 | real(c_double), value :: alpha 1009 | character(c_char), value :: uplo 1010 | real(c_double), dimension(lda, *) :: A 1011 | end subroutine cublasDsyr2 1012 | 1013 | subroutine cublasCher2 (uplo, n, alpha, x, incx, y, incy, A, lda) & 1014 | bind (c, name="cublasCher2") 1015 | import 1016 | integer(c_int), value :: n, incx, incy, lda 1017 | complex(c_float), dimension(*) :: x, y 1018 | character(c_char), value :: uplo 1019 | complex(c_float), dimension(lda, *) :: A 1020 | complex(c_float), value :: alpha 1021 | end subroutine cublasCher2 1022 | 1023 | subroutine cublasZher2 (uplo, n, alpha, x, incx, y, incy, A, lda) & 1024 | bind (c, name="cublasZher2") 1025 | import 1026 | integer(c_int), value :: n, incx, incy, lda 1027 | complex(c_double), value :: alpha 1028 | complex(c_double), dimension(*) :: x, y 1029 | character(c_char), value :: uplo 1030 | complex(c_double), dimension(lda, *) :: A 1031 | end subroutine cublasZher2 1032 | 1033 | subroutine cublasSspr2 (uplo, n, alpha, x, incx, y, incy, AP) & 1034 | bind (c, name="cublasSspr2") 1035 | import 1036 | integer(c_int), value :: n, incx, incy 1037 | real(c_float), value :: alpha 1038 | character(c_char), value :: uplo 1039 | real(c_float), dimension(*) :: x, y, AP 1040 | end subroutine cublasSspr2 1041 | 1042 | subroutine cublasDspr2 (uplo, n, alpha, x, incx, y, incy, AP) & 1043 | bind (c, name="cublasDspr2") 1044 | import 1045 | real(c_double), dimension(*) :: x, y, AP 1046 | integer(c_int), value :: n, incx, incy 1047 | real(c_double), value :: alpha 1048 | character(c_char), value :: uplo 1049 | end subroutine cublasDspr2 1050 | 1051 | subroutine cublasChpr2 (uplo, n, alpha, x, incx, y, incy, AP) & 1052 | bind (c, name="cublasChpr2") 1053 | import 1054 | complex(c_float), dimension(*) :: x, y, AP 1055 | integer(c_int), value :: n, incx, incy 1056 | character(c_char), value :: uplo 1057 | complex(c_float), value :: alpha 1058 | end subroutine cublasChpr2 1059 | 1060 | subroutine cublasZhpr2 (uplo, n, alpha, x, incx, y, incy, AP) & 1061 | bind (c, name="cublasZhpr2") 1062 | import 1063 | complex(c_double), value :: alpha 1064 | integer(c_int), value :: n, incx, incy 1065 | complex(c_double), dimension(*) :: x, y, AP 1066 | character(c_char), value :: uplo 1067 | end subroutine cublasZhpr2 1068 | 1069 | subroutine cublasSgemm & 1070 | (transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 1071 | bind (c, name="cublasSgemm") 1072 | import 1073 | integer(c_int), value :: m, n, k, lda, ldb, ldc 1074 | real(c_float), dimension(lda, *) :: A 1075 | character(c_char), value :: transa, transb 1076 | real(c_float), dimension(ldc, *) :: C 1077 | real(c_float), dimension(ldb, *) :: B 1078 | real(c_float), value :: alpha, beta 1079 | end subroutine cublasSgemm 1080 | 1081 | subroutine cublasDgemm & 1082 | (transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 1083 | bind (c, name="cublasDgemm") 1084 | import 1085 | integer(c_int), value :: m, n, k, lda, ldb, ldc 1086 | real(c_double), dimension(ldb, *) :: B 1087 | real(c_double), dimension(ldc, *) :: C 1088 | character(c_char), value :: transa, transb 1089 | real(c_double), value :: alpha, beta 1090 | real(c_double), dimension(lda, *) :: A 1091 | end subroutine cublasDgemm 1092 | 1093 | subroutine cublasCgemm & 1094 | (transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 1095 | bind (c, name="cublasCgemm") 1096 | import 1097 | integer(c_int), value :: m, n, k, lda, ldb, ldc 1098 | complex(c_float), dimension(ldc, *) :: C 1099 | complex(c_float), dimension(ldb, *) :: B 1100 | character(c_char), value :: transa, transb 1101 | complex(c_float), value :: alpha, beta 1102 | complex(c_float), dimension(lda, *) :: A 1103 | end subroutine cublasCgemm 1104 | 1105 | subroutine cublasZgemm & 1106 | (transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 1107 | bind (c, name="cublasZgemm") 1108 | import 1109 | integer(c_int), value :: m, n, k, lda, ldb, ldc 1110 | complex(c_double), value :: alpha, beta 1111 | complex(c_double), dimension(lda, *) :: A 1112 | character(c_char), value :: transa, transb 1113 | complex(c_double), dimension(ldb, *) :: B 1114 | complex(c_double), dimension(ldc, *) :: C 1115 | end subroutine cublasZgemm 1116 | 1117 | subroutine cublasSsyrk (uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 1118 | bind (c, name="cublasSsyrk") 1119 | import 1120 | integer(c_int), value :: n, k, lda, ldc 1121 | real(c_float), dimension(ldc, *) :: C 1122 | real(c_float), value :: alpha, beta 1123 | character(c_char), value :: uplo, trans 1124 | real(c_float), dimension(lda, *) :: A 1125 | end subroutine cublasSsyrk 1126 | 1127 | subroutine cublasDsyrk (uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 1128 | bind (c, name="cublasDsyrk") 1129 | import 1130 | integer(c_int), value :: n, k, lda, ldc 1131 | real(c_double), dimension(lda, *) :: A 1132 | real(c_double), dimension(ldc, *) :: C 1133 | real(c_double), value :: alpha, beta 1134 | character(c_char), value :: uplo, trans 1135 | end subroutine cublasDsyrk 1136 | 1137 | subroutine cublasCsyrk (uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 1138 | bind (c, name="cublasCsyrk") 1139 | import 1140 | integer(c_int), value :: n, k, lda, ldc 1141 | complex(c_float), dimension(ldc, *) :: C 1142 | character(c_char), value :: uplo, trans 1143 | complex(c_float), dimension(lda, *) :: A 1144 | complex(c_float), value :: alpha, beta 1145 | end subroutine cublasCsyrk 1146 | 1147 | subroutine cublasZsyrk (uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 1148 | bind (c, name="cublasZsyrk") 1149 | import 1150 | integer(c_int), value :: n, k, lda, ldc 1151 | complex(c_double), value :: alpha, beta 1152 | complex(c_double), dimension(lda, *) :: A 1153 | character(c_char), value :: uplo, trans 1154 | complex(c_double), dimension(ldc, *) :: C 1155 | end subroutine cublasZsyrk 1156 | 1157 | subroutine cublasCherk (uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 1158 | bind (c, name="cublasCherk") 1159 | import 1160 | integer(c_int), value :: n, k, lda, ldc 1161 | complex(c_float), dimension(ldc, *) :: C 1162 | character(c_char), value :: uplo, trans 1163 | complex(c_float), dimension(lda, *) :: A 1164 | complex(c_float), value :: alpha, beta 1165 | end subroutine cublasCherk 1166 | 1167 | subroutine cublasZherk (uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 1168 | bind (c, name="cublasZherk") 1169 | import 1170 | integer(c_int), value :: n, k, lda, ldc 1171 | complex(c_double), value :: alpha, beta 1172 | complex(c_double), dimension(lda, *) :: A 1173 | character(c_char), value :: uplo, trans 1174 | complex(c_double), dimension(ldc, *) :: C 1175 | end subroutine cublasZherk 1176 | 1177 | subroutine cublasSsyr2k (uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 1178 | bind (c, name="cublasSsyr2k") 1179 | import 1180 | integer(c_int), value :: n, k, lda, ldb, ldc 1181 | real(c_float), dimension(lda, *) :: A 1182 | character(c_char), value :: uplo, trans 1183 | real(c_float), dimension(ldc, *) :: C 1184 | real(c_float), dimension(ldb, *) :: B 1185 | real(c_float), value :: alpha, beta 1186 | end subroutine cublasSsyr2k 1187 | 1188 | subroutine cublasDsyr2k (uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 1189 | bind (c, name="cublasDsyr2k") 1190 | import 1191 | integer(c_int), value :: n, k, lda, ldb, ldc 1192 | real(c_double), dimension(ldb, *) :: B 1193 | real(c_double), dimension(ldc, *) :: C 1194 | character(c_char), value :: uplo, trans 1195 | real(c_double), value :: alpha, beta 1196 | real(c_double), dimension(lda, *) :: A 1197 | end subroutine cublasDsyr2k 1198 | 1199 | subroutine cublasCsyr2k (uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 1200 | bind (c, name="cublasCsyr2k") 1201 | import 1202 | integer(c_int), value :: n, k, lda, ldb, ldc 1203 | complex(c_float), dimension(ldc, *) :: C 1204 | complex(c_float), dimension(ldb, *) :: B 1205 | character(c_char), value :: uplo, trans 1206 | complex(c_float), value :: alpha, beta 1207 | complex(c_float), dimension(lda, *) :: A 1208 | end subroutine cublasCsyr2k 1209 | 1210 | subroutine cublasZsyr2k (uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 1211 | bind (c, name="cublasZsyr2k") 1212 | import 1213 | integer(c_int), value :: n, k, lda, ldb, ldc 1214 | complex(c_double), value :: alpha, beta 1215 | complex(c_double), dimension(lda, *) :: A 1216 | character(c_char), value :: uplo, trans 1217 | complex(c_double), dimension(ldb, *) :: B 1218 | complex(c_double), dimension(ldc, *) :: C 1219 | end subroutine cublasZsyr2k 1220 | 1221 | subroutine cublasCher2k (uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 1222 | bind (c, name="cublasCher2k") 1223 | import 1224 | integer(c_int), value :: n, k, lda, ldb, ldc 1225 | complex(c_float), dimension(ldc, *) :: C 1226 | complex(c_float), dimension(ldb, *) :: B 1227 | character(c_char), value :: uplo, trans 1228 | complex(c_float), value :: alpha, beta 1229 | complex(c_float), dimension(lda, *) :: A 1230 | end subroutine cublasCher2k 1231 | 1232 | subroutine cublasZher2k (uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 1233 | bind (c, name="cublasZher2k") 1234 | import 1235 | integer(c_int), value :: n, k, lda, ldb, ldc 1236 | complex(c_double), value :: alpha, beta 1237 | complex(c_double), dimension(lda, *) :: A 1238 | character(c_char), value :: uplo, trans 1239 | complex(c_double), dimension(ldb, *) :: B 1240 | complex(c_double), dimension(ldc, *) :: C 1241 | end subroutine cublasZher2k 1242 | 1243 | subroutine cublasSsymm (side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 1244 | bind (c, name="cublasSsymm") 1245 | import 1246 | integer(c_int), value :: m, n, lda, ldb, ldc 1247 | real(c_float), dimension(lda, *) :: A 1248 | character(c_char), value :: side, uplo 1249 | real(c_float), dimension(ldc, *) :: C 1250 | real(c_float), dimension(ldb, *) :: B 1251 | real(c_float), value :: alpha, beta 1252 | end subroutine cublasSsymm 1253 | 1254 | subroutine cublasDsymm (side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 1255 | bind (c, name="cublasDsymm") 1256 | import 1257 | integer(c_int), value :: m, n, lda, ldb, ldc 1258 | real(c_double), dimension(ldb, *) :: B 1259 | real(c_double), dimension(ldc, *) :: C 1260 | character(c_char), value :: side, uplo 1261 | real(c_double), value :: alpha, beta 1262 | real(c_double), dimension(lda, *) :: A 1263 | end subroutine cublasDsymm 1264 | 1265 | subroutine cublasCsymm (side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 1266 | bind (c, name="cublasCsymm") 1267 | import 1268 | integer(c_int), value :: m, n, lda, ldb, ldc 1269 | complex(c_float), dimension(ldc, *) :: C 1270 | complex(c_float), dimension(ldb, *) :: B 1271 | character(c_char), value :: side, uplo 1272 | complex(c_float), value :: alpha, beta 1273 | complex(c_float), dimension(lda, *) :: A 1274 | end subroutine cublasCsymm 1275 | 1276 | subroutine cublasZsymm (side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 1277 | bind (c, name="cublasZsymm") 1278 | import 1279 | integer(c_int), value :: m, n, lda, ldb, ldc 1280 | complex(c_double), value :: alpha, beta 1281 | complex(c_double), dimension(lda, *) :: A 1282 | character(c_char), value :: side, uplo 1283 | complex(c_double), dimension(ldb, *) :: B 1284 | complex(c_double), dimension(ldc, *) :: C 1285 | end subroutine cublasZsymm 1286 | 1287 | subroutine cublasChemm (side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 1288 | bind (c, name="cublasChemm") 1289 | import 1290 | integer(c_int), value :: m, n, lda, ldb, ldc 1291 | complex(c_float), dimension(ldc, *) :: C 1292 | complex(c_float), dimension(ldb, *) :: B 1293 | character(c_char), value :: side, uplo 1294 | complex(c_float), value :: alpha, beta 1295 | complex(c_float), dimension(lda, *) :: A 1296 | end subroutine cublasChemm 1297 | 1298 | subroutine cublasZhemm (side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 1299 | bind (c, name="cublasZhemm") 1300 | import 1301 | integer(c_int), value :: m, n, lda, ldb, ldc 1302 | complex(c_double), value :: alpha, beta 1303 | complex(c_double), dimension(lda, *) :: A 1304 | character(c_char), value :: side, uplo 1305 | complex(c_double), dimension(ldb, *) :: B 1306 | complex(c_double), dimension(ldc, *) :: C 1307 | end subroutine cublasZhemm 1308 | 1309 | subroutine cublasStrsm (side, uplo, transa, diag, m, n, alpha, A, lda, B, ldb) & 1310 | bind (c, name="cublasStrsm") 1311 | import 1312 | integer(c_int), value :: m, n, lda, ldb 1313 | real(c_float), dimension(ldb, *) :: B 1314 | real(c_float), value :: alpha 1315 | character(c_char), value :: side, uplo, transa, diag 1316 | real(c_float), dimension(lda, *) :: A 1317 | end subroutine cublasStrsm 1318 | 1319 | subroutine cublasDtrsm (side, uplo, transa, diag, m, n, alpha, A, lda, B, ldb) & 1320 | bind (c, name="cublasDtrsm") 1321 | import 1322 | integer(c_int), value :: m, n, lda, ldb 1323 | real(c_double), dimension(lda, *) :: A 1324 | real(c_double), value :: alpha 1325 | character(c_char), value :: side, uplo, transa, diag 1326 | real(c_double), dimension(ldb, *) :: B 1327 | end subroutine cublasDtrsm 1328 | 1329 | subroutine cublasCtrsm (side, uplo, transa, diag, m, n, alpha, A, lda, B, ldb) & 1330 | bind (c, name="cublasCtrsm") 1331 | import 1332 | integer(c_int), value :: m, n, lda, ldb 1333 | complex(c_float), dimension(ldb, *) :: B 1334 | character(c_char), value :: side, uplo, transa, diag 1335 | complex(c_float), dimension(lda, *) :: A 1336 | complex(c_float), value :: alpha 1337 | end subroutine cublasCtrsm 1338 | 1339 | subroutine cublasZtrsm (side, uplo, transa, diag, m, n, alpha, A, lda, B, ldb) & 1340 | bind (c, name="cublasZtrsm") 1341 | import 1342 | integer(c_int), value :: m, n, lda, ldb 1343 | complex(c_double), value :: alpha 1344 | complex(c_double), dimension(ldb, *) :: B 1345 | complex(c_double), dimension(lda, *) :: A 1346 | character(c_char), value :: side, uplo, transa, diag 1347 | end subroutine cublasZtrsm 1348 | 1349 | subroutine cublasStrmm (side, uplo, transa, diag, m, n, alpha, A, lda, B, ldb) & 1350 | bind (c, name="cublasStrmm") 1351 | import 1352 | integer(c_int), value :: m, n, lda, ldb 1353 | real(c_float), dimension(ldb, *) :: B 1354 | real(c_float), value :: alpha 1355 | character(c_char), value :: side, uplo, transa, diag 1356 | real(c_float), dimension(lda, *) :: A 1357 | end subroutine cublasStrmm 1358 | 1359 | subroutine cublasDtrmm (side, uplo, transa, diag, m, n, alpha, A, lda, B, ldb) & 1360 | bind (c, name="cublasDtrmm") 1361 | import 1362 | integer(c_int), value :: m, n, lda, ldb 1363 | real(c_double), dimension(lda, *) :: A 1364 | real(c_double), value :: alpha 1365 | character(c_char), value :: side, uplo, transa, diag 1366 | real(c_double), dimension(ldb, *) :: B 1367 | end subroutine cublasDtrmm 1368 | 1369 | subroutine cublasCtrmm (side, uplo, transa, diag, m, n, alpha, A, lda, B, ldb) & 1370 | bind (c, name="cublasCtrmm") 1371 | import 1372 | integer(c_int), value :: m, n, lda, ldb 1373 | complex(c_float), dimension(ldb, *) :: B 1374 | character(c_char), value :: side, uplo, transa, diag 1375 | complex(c_float), dimension(lda, *) :: A 1376 | complex(c_float), value :: alpha 1377 | end subroutine cublasCtrmm 1378 | 1379 | subroutine cublasZtrmm (side, uplo, transa, diag, m, n, alpha, A, lda, B, ldb) & 1380 | bind (c, name="cublasZtrmm") 1381 | import 1382 | integer(c_int), value :: m, n, lda, ldb 1383 | complex(c_double), value :: alpha 1384 | complex(c_double), dimension(ldb, *) :: B 1385 | complex(c_double), dimension(lda, *) :: A 1386 | character(c_char), value :: side, uplo, transa, diag 1387 | end subroutine cublasZtrmm 1388 | 1389 | end interface 1390 | end module 1391 | -------------------------------------------------------------------------------- /cublas_core.f90: -------------------------------------------------------------------------------- 1 | !! Fortran CUDA Library interface -- Module for Core CUBLAS definitions 2 | !! 3 | !! Copyright (C) 2017-2018 Mentor, A Siemens Business 4 | !! 5 | !! This software is provided 'as-is', without any express or implied 6 | !! warranty. In no event will the authors be held liable for any damages 7 | !! arising from the use of this software. 8 | !! 9 | !! Permission is granted to anyone to use this software for any purpose, 10 | !! including commercial applications, and to alter it and redistribute it 11 | !! freely, subject to the following restrictions: 12 | !! 13 | !! 1. The origin of this software must not be misrepresented; you must not 14 | !! claim that you wrote the original software. If you use this software 15 | !! in a product, an acknowledgment in the product documentation would be 16 | !! appreciated but is not required. 17 | !! 2. Altered source versions must be plainly marked as such, and must not be 18 | !! misrepresented as being the original software. 19 | !! 3. This notice may not be removed or altered from any source distribution. 20 | 21 | module cublas_core 22 | use iso_c_binding 23 | 24 | type, bind(c) :: cuBlasHandle 25 | type(c_ptr) :: handle 26 | end type cuBlasHandle 27 | 28 | enum, bind(c) 29 | enumerator :: CUBLAS_STATUS_SUCCESS = 0 30 | enumerator :: CUBLAS_STATUS_NOT_INITIALIZED = 1 31 | enumerator :: CUBLAS_STATUS_ALLOC_FAILED = 3 32 | enumerator :: CUBLAS_STATUS_INVALID_VALUE = 7 33 | enumerator :: CUBLAS_STATUS_ARCH_MISMATCH = 8 34 | enumerator :: CUBLAS_STATUS_MAPPING_ERROR = 11 35 | enumerator :: CUBLAS_STATUS_EXECUTION_FAILED = 13 36 | enumerator :: CUBLAS_STATUS_INTERNAL_ERROR = 14 37 | enumerator :: CUBLAS_STATUS_NOT_SUPPORTED = 15 38 | enumerator :: CUBLAS_STATUS_LICENSE_ERROR = 16 39 | end enum 40 | 41 | enum, bind(c) 42 | enumerator :: CUBLAS_FILL_MODE_LOWER = 0 43 | enumerator :: CUBLAS_FILL_MODE_UPPER = 1 44 | end enum 45 | 46 | enum, bind(c) 47 | enumerator :: CUBLAS_DIAG_NON_UNIT = 0 48 | enumerator :: CUBLAS_DIAG_UNIT = 1 49 | end enum 50 | 51 | enum, bind(c) 52 | enumerator :: CUBLAS_SIDE_LEFT = 0 53 | enumerator :: CUBLAS_SIDE_RIGHT = 1 54 | end enum 55 | 56 | enum, bind(c) 57 | enumerator :: CUBLAS_OP_N = 0 58 | enumerator :: CUBLAS_OP_T = 1 59 | enumerator :: CUBLAS_OP_C = 2 60 | end enum 61 | 62 | enum, bind(c) 63 | enumerator :: CUBLAS_POINTER_MODE_HOST = 0 64 | enumerator :: CUBLAS_POINTER_MODE_DEVICE = 1 65 | end enum 66 | 67 | interface 68 | integer(c_int) function cublasCreate (handle) & 69 | bind (c, name="cublasCreate_v2") 70 | import 71 | type(cublasHandle) :: handle 72 | end function cublasCreate 73 | 74 | integer(c_int) function cublasDestroy (handle) & 75 | bind (c, name="cublasDestroy_v2") 76 | import 77 | type(cublasHandle), value :: handle 78 | end function cublasDestroy 79 | 80 | integer(c_int) function cublasGetVersion (handle, version) & 81 | bind (c, name="cublasGetVersion_v2") 82 | import 83 | type(cublasHandle), value :: handle 84 | integer(c_int) :: version 85 | end function cublasGetVersion 86 | 87 | integer(c_int) function cublasSetStream (handle, streamId) & 88 | bind (c, name="cublasSetStream_v2") 89 | import 90 | type(c_ptr), value :: streamId 91 | type(cublasHandle), value :: handle 92 | end function cublasSetStream 93 | 94 | integer(c_int) function cublasGetStream (handle, streamId) & 95 | bind (c, name="cublasGetStream_v2") 96 | import 97 | type(cublasHandle), value :: handle 98 | type(c_ptr) :: streamId 99 | end function cublasGetStream 100 | 101 | integer(c_int) function cublasGetPointerMode (handle, mode) & 102 | bind (c, name="cublasGetPointerMode_v2") 103 | import 104 | type(cublasHandle), value :: handle 105 | integer(c_int) :: mode 106 | end function cublasGetPointerMode 107 | 108 | integer(c_int) function cublasSetPointerMode (handle, mode) & 109 | bind (c, name="cublasSetPointerMode_v2") 110 | import 111 | integer(c_int), value :: mode 112 | type(cublasHandle), value :: handle 113 | end function cublasSetPointerMode 114 | 115 | integer(c_int) function cublasGetAtomicsMode (handle, mode) & 116 | bind (c, name="cublasGetAtomicsMode_v2") 117 | import 118 | type(cublasHandle), value :: handle 119 | integer(c_int) :: mode 120 | end function cublasGetAtomicsMode 121 | 122 | integer(c_int) function cublasSetAtomicsMode (handle, mode) & 123 | bind (c, name="cublasSetAtomicsMode_v2") 124 | import 125 | integer(c_int), value :: mode 126 | type(cublasHandle), value :: handle 127 | end function cublasSetAtomicsMode 128 | 129 | integer(c_int) function cublasSetVector (n, elemSize, x, incx, y, incy) & 130 | bind (c, name="cublasSetVector_v2") 131 | import 132 | integer(c_int), value :: n, elemSize, incx, incy 133 | integer(c_signed_char), dimension(*) :: x, y 134 | end function cublasSetVector 135 | 136 | integer(c_int) function cublasGetVector (n, elemSize, x, incx, y, incy) & 137 | bind (c, name="cublasGetVector_v2") 138 | import 139 | integer(c_int), value :: n, elemSize, incx, incy 140 | integer(c_signed_char), dimension(*) :: x, y 141 | end function cublasGetVector 142 | 143 | integer(c_int) function cublasSetMatrix (rows, cols, elemSize, A, lda, B, ldb) & 144 | bind (c, name="cublasSetMatrix_v2") 145 | import 146 | integer(c_int), value :: rows, cols, elemSize, lda, ldb 147 | integer(c_signed_char), dimension(lda, *) :: A 148 | integer(c_signed_char), dimension(ldb, *) :: B 149 | end function cublasSetMatrix 150 | 151 | integer(c_int) function cublasGetMatrix (rows, cols, elemSize, A, lda, B, ldb) & 152 | bind (c, name="cublasGetMatrix_v2") 153 | import 154 | integer(c_int), value :: rows, cols, elemSize, lda, ldb 155 | integer(c_signed_char), dimension(lda, *) :: A 156 | integer(c_signed_char), dimension(ldb, *) :: B 157 | end function cublasGetMatrix 158 | 159 | integer(c_int) function cublasSetVectorAsync (n, elemSize, hostPtr, incx, devicePtr, incy, stream) & 160 | bind (c, name="cublasSetVectorAsync_v2") 161 | import 162 | integer(c_int), value :: n, elemSize, incx, incy 163 | type(c_ptr), value :: stream 164 | integer(c_signed_char), dimension(*) :: hostPtr, devicePtr 165 | end function cublasSetVectorAsync 166 | 167 | integer(c_int) function cublasGetVectorAsync (n, elemSize, devicePtr, incx, hostPtr, incy, stream) & 168 | bind (c, name="cublasGetVectorAsync_v2") 169 | import 170 | integer(c_int), value :: n, elemSize, incx, incy 171 | type(c_ptr), value :: stream 172 | integer(c_signed_char), dimension(*) :: devicePtr, hostPtr 173 | end function cublasGetVectorAsync 174 | 175 | integer(c_int) function cublasSetMatrixAsync (rows, cols, elemSize, A, lda, B, ldb, stream) & 176 | bind (c, name="cublasSetMatrixAsync_v2") 177 | import 178 | integer(c_int), value :: rows, cols, elemSize, lda, ldb 179 | integer(c_signed_char), dimension(lda, *) :: A 180 | integer(c_signed_char), dimension(ldb, *) :: B 181 | type(c_ptr), value :: stream 182 | end function cublasSetMatrixAsync 183 | 184 | integer(c_int) function cublasGetMatrixAsync (rows, cols, elemSize, A, lda, B, ldb, stream) & 185 | bind (c, name="cublasGetMatrixAsync_v2") 186 | import 187 | integer(c_int), value :: rows, cols, elemSize, lda, ldb 188 | integer(c_signed_char), dimension(lda, *) :: A 189 | integer(c_signed_char), dimension(ldb, *) :: B 190 | type(c_ptr), value :: stream 191 | end function cublasGetMatrixAsync 192 | 193 | end interface 194 | end module 195 | -------------------------------------------------------------------------------- /cublasxt.f90: -------------------------------------------------------------------------------- 1 | !! Fortran CUDA Library interface -- CUBLAS XT module 2 | !! 3 | !! Copyright (C) 2017-2018 Mentor, A Siemens Business 4 | !! 5 | !! This software is provided 'as-is', without any express or implied 6 | !! warranty. In no event will the authors be held liable for any damages 7 | !! arising from the use of this software. 8 | !! 9 | !! Permission is granted to anyone to use this software for any purpose, 10 | !! including commercial applications, and to alter it and redistribute it 11 | !! freely, subject to the following restrictions: 12 | !! 13 | !! 1. The origin of this software must not be misrepresented; you must not 14 | !! claim that you wrote the original software. If you use this software 15 | !! in a product, an acknowledgment in the product documentation would be 16 | !! appreciated but is not required. 17 | !! 2. Altered source versions must be plainly marked as such, and must not be 18 | !! misrepresented as being the original software. 19 | !! 3. This notice may not be removed or altered from any source distribution. 20 | 21 | module cublasxt 22 | use iso_c_binding 23 | use cublas_core 24 | 25 | type, bind(c) :: cublasXtHandle 26 | type(c_ptr) :: handle 27 | end type cublasXtHandle 28 | 29 | ! Pinned memory mode 30 | enum, bind(c) 31 | enumerator :: CUBLASXT_PINNING_DISABLED=0 32 | enumerator :: CUBLASXT_PINNING_ENABLED=1 33 | end enum 34 | 35 | ! cublasXtOpType 36 | enum, bind(c) 37 | enumerator :: CUBLASXT_FLOAT=0 38 | enumerator :: CUBLASXT_DOUBLE=1 39 | enumerator :: CUBLASXT_COMPLEX=2 40 | enumerator :: CUBLASXT_DOUBLECOMPLEX=3 41 | end enum 42 | 43 | ! cublasXtBlasOp 44 | enum, bind(c) 45 | enumerator :: CUBLASXT_GEMM=0 46 | enumerator :: CUBLASXT_SYRK=1 47 | enumerator :: CUBLASXT_HERK=2 48 | enumerator :: CUBLASXT_SYMM=3 49 | enumerator :: CUBLASXT_HEMM=4 50 | enumerator :: CUBLASXT_TRSM=5 51 | enumerator :: CUBLASXT_SYR2K=6 52 | enumerator :: CUBLASXT_HER2K=7 53 | enumerator :: CUBLASXT_SPMM=8 54 | enumerator :: CUBLASXT_SYRKX=9 55 | enumerator :: CUBLASXT_HERKX=10 56 | enumerator :: CUBLASXT_TRMM=11 57 | enumerator :: CUBLASXT_ROUTINE_MAX=12 58 | end enum 59 | 60 | interface 61 | integer(c_int) function cublasXtCreate (handle) & 62 | bind (c, name="cublasXtCreate") 63 | import 64 | type(cublasXtHandle) :: handle 65 | end function cublasXtCreate 66 | 67 | integer(c_int) function cublasXtDestroy (handle) & 68 | bind (c, name="cublasXtDestroy") 69 | import 70 | type(cublasXtHandle), value :: handle 71 | end function cublasXtDestroy 72 | 73 | integer(c_int) function cublasXtDeviceSelect (handle, nbDevices, deviceId) & 74 | bind (c, name="cublasXtDeviceSelect") 75 | import 76 | integer(c_int), dimension(*) :: deviceId 77 | integer(c_int), value :: nbDevices 78 | type(cublasXtHandle), value :: handle 79 | end function cublasXtDeviceSelect 80 | 81 | integer(c_int) function cublasXtSetBlockDim (handle, blockDim) & 82 | bind (c, name="cublasXtSetBlockDim") 83 | import 84 | integer(c_int), value :: blockDim 85 | type(cublasXtHandle), value :: handle 86 | end function cublasXtSetBlockDim 87 | 88 | integer(c_int) function cublasXtGetBlockDim (handle, blockDim) & 89 | bind (c, name="cublasXtGetBlockDim") 90 | import 91 | type(cublasXtHandle), value :: handle 92 | integer(c_int) :: blockDim 93 | end function cublasXtGetBlockDim 94 | 95 | integer(c_int) function cublasXtSetCpuRoutine (handle, blasOp, type, blasFunctor) & 96 | bind (c, name="cublasXtSetCpuRoutine") 97 | import 98 | integer(c_int), value :: blasOp, type, blasFunctor 99 | type(cublasXtHandle), value :: handle 100 | end function cublasXtSetCpuRoutine 101 | 102 | integer(c_int) function cublasXtSetCpuRatio (handle, blasOp, type, ratio) & 103 | bind (c, name="cublasXtSetCpuRatio") 104 | import 105 | integer(c_int), value :: blasOp, type 106 | type(cublasXtHandle), value :: handle 107 | real(c_float), value :: ratio 108 | end function cublasXtSetCpuRatio 109 | 110 | integer(c_int) function cublasXtSetPinningMemMode (handle, mode) & 111 | bind (c, name="cublasXtSetPinningMemMode") 112 | import 113 | integer(c_int), value :: mode 114 | type(cublasXtHandle), value :: handle 115 | end function cublasXtSetPinningMemMode 116 | 117 | integer(c_int) function cublasXtGetPinningMemMode (handle, mode) & 118 | bind (c, name="cublasXtGetPinningMemMode") 119 | import 120 | type(cublasXtHandle), value :: handle 121 | integer(c_int) :: mode 122 | end function cublasXtGetPinningMemMode 123 | 124 | integer(c_int) function cublasXtSgemm & 125 | (handle, transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 126 | bind (c, name="cublasXtSgemm") 127 | import 128 | integer(c_int), value :: transa, transb, m, n, k, lda, ldb, ldc 129 | real(c_float), dimension(lda, *) :: A 130 | real(c_float) :: alpha, beta 131 | real(c_float), dimension(ldc, *) :: C 132 | real(c_float), dimension(ldb, *) :: B 133 | type(cublasXtHandle), value :: handle 134 | end function cublasXtSgemm 135 | 136 | integer(c_int) function cublasXtDgemm & 137 | (handle, transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 138 | bind (c, name="cublasXtDgemm") 139 | import 140 | integer(c_int), value :: transa, transb, m, n, k, lda, ldb, ldc 141 | real(c_double), dimension(ldb, *) :: B 142 | real(c_double), dimension(ldc, *) :: C 143 | real(c_double), dimension(lda, *) :: A 144 | type(cublasXtHandle), value :: handle 145 | real(c_double) :: alpha, beta 146 | end function cublasXtDgemm 147 | 148 | integer(c_int) function cublasXtCgemm & 149 | (handle, transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 150 | bind (c, name="cublasXtCgemm") 151 | import 152 | integer(c_int), value :: transa, transb, m, n, k, lda, ldb, ldc 153 | complex(c_float), dimension(ldc, *) :: C 154 | complex(c_float) :: alpha, beta 155 | complex(c_float), dimension(ldb, *) :: B 156 | complex(c_float), dimension(lda, *) :: A 157 | type(cublasXtHandle), value :: handle 158 | end function cublasXtCgemm 159 | 160 | integer(c_int) function cublasXtZgemm & 161 | (handle, transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 162 | bind (c, name="cublasXtZgemm") 163 | import 164 | integer(c_int), value :: transa, transb, m, n, k, lda, ldb, ldc 165 | complex(c_double), dimension(lda, *) :: A 166 | complex(c_double) :: alpha, beta 167 | complex(c_double), dimension(ldb, *) :: B 168 | type(cublasXtHandle), value :: handle 169 | complex(c_double), dimension(ldc, *) :: C 170 | end function cublasXtZgemm 171 | 172 | integer(c_int) function cublasXtChemm & 173 | (handle, side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 174 | bind (c, name="cublasXtChemm") 175 | import 176 | integer(c_size_t), value :: m, n, lda, ldb, ldc 177 | complex(c_float), dimension(ldc, *) :: C 178 | complex(c_float) :: alpha, beta 179 | complex(c_float), dimension(ldb, *) :: B 180 | integer(c_int), value :: side, uplo 181 | complex(c_float), dimension(lda, *) :: A 182 | type(cublasXtHandle), value :: handle 183 | end function cublasXtChemm 184 | 185 | integer(c_int) function cublasXtZhemm & 186 | (handle, side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 187 | bind (c, name="cublasXtZhemm") 188 | import 189 | integer(c_size_t), value :: m, n, lda, ldb, ldc 190 | integer(c_int), value :: side, uplo 191 | complex(c_double), dimension(lda, *) :: A 192 | complex(c_double) :: alpha, beta 193 | complex(c_double), dimension(ldb, *) :: B 194 | type(cublasXtHandle), value :: handle 195 | complex(c_double), dimension(ldc, *) :: C 196 | end function cublasXtZhemm 197 | 198 | integer(c_int) function cublasXtSsymm & 199 | (handle, side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 200 | bind (c, name="cublasXtSsymm") 201 | import 202 | integer(c_size_t), value :: m, n, lda, ldb, ldc 203 | real(c_float), dimension(lda, *) :: A 204 | real(c_float) :: alpha, beta 205 | integer(c_int), value :: side, uplo 206 | real(c_float), dimension(ldc, *) :: C 207 | real(c_float), dimension(ldb, *) :: B 208 | type(cublasXtHandle), value :: handle 209 | end function cublasXtSsymm 210 | 211 | integer(c_int) function cublasXtDsymm & 212 | (handle, side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 213 | bind (c, name="cublasXtDsymm") 214 | import 215 | integer(c_size_t), value :: m, n, lda, ldb, ldc 216 | real(c_double), dimension(ldb, *) :: B 217 | integer(c_int), value :: side, uplo 218 | real(c_double), dimension(ldc, *) :: C 219 | real(c_double), dimension(lda, *) :: A 220 | type(cublasXtHandle), value :: handle 221 | real(c_double) :: alpha, beta 222 | end function cublasXtDsymm 223 | 224 | integer(c_int) function cublasXtCsymm & 225 | (handle, side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 226 | bind (c, name="cublasXtCsymm") 227 | import 228 | integer(c_size_t), value :: m, n, lda, ldb, ldc 229 | complex(c_float), dimension(ldc, *) :: C 230 | complex(c_float) :: alpha, beta 231 | complex(c_float), dimension(ldb, *) :: B 232 | integer(c_int), value :: side, uplo 233 | complex(c_float), dimension(lda, *) :: A 234 | type(cublasXtHandle), value :: handle 235 | end function cublasXtCsymm 236 | 237 | integer(c_int) function cublasXtZsymm & 238 | (handle, side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) & 239 | bind (c, name="cublasXtZsymm") 240 | import 241 | integer(c_size_t), value :: m, n, lda, ldb, ldc 242 | integer(c_int), value :: side, uplo 243 | complex(c_double), dimension(lda, *) :: A 244 | complex(c_double) :: alpha, beta 245 | complex(c_double), dimension(ldb, *) :: B 246 | type(cublasXtHandle), value :: handle 247 | complex(c_double), dimension(ldc, *) :: C 248 | end function cublasXtZsymm 249 | 250 | integer(c_int) function cublasXtSsyrk (handle, uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 251 | bind (c, name="cublasXtSsyrk") 252 | import 253 | integer(c_int), value :: uplo, trans, n, k, lda, ldc 254 | real(c_float) :: alpha, beta 255 | type(cublasXtHandle), value :: handle 256 | real(c_float), dimension(lda, *) :: A 257 | real(c_float), dimension(ldc, *) :: C 258 | end function cublasXtSsyrk 259 | 260 | integer(c_int) function cublasXtDsyrk (handle, uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 261 | bind (c, name="cublasXtDsyrk") 262 | import 263 | integer(c_int), value :: uplo, trans, n, k, lda, ldc 264 | real(c_double), dimension(ldc, *) :: C 265 | real(c_double), dimension(lda, *) :: A 266 | type(cublasXtHandle), value :: handle 267 | real(c_double) :: alpha, beta 268 | end function cublasXtDsyrk 269 | 270 | integer(c_int) function cublasXtCsyrk (handle, uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 271 | bind (c, name="cublasXtCsyrk") 272 | import 273 | integer(c_int), value :: uplo, trans, n, k, lda, ldc 274 | type(cublasXtHandle), value :: handle 275 | complex(c_float), dimension(ldc, *) :: C 276 | complex(c_float) :: alpha, beta 277 | complex(c_float), dimension(lda, *) :: A 278 | end function cublasXtCsyrk 279 | 280 | integer(c_int) function cublasXtZsyrk (handle, uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 281 | bind (c, name="cublasXtZsyrk") 282 | import 283 | integer(c_int), value :: uplo, trans, n, k, lda, ldc 284 | complex(c_double), dimension(lda, *) :: A 285 | type(cublasXtHandle), value :: handle 286 | complex(c_double) :: alpha, beta 287 | complex(c_double), dimension(ldc, *) :: C 288 | end function cublasXtZsyrk 289 | 290 | integer(c_int) function cublasXtSsyr2k & 291 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 292 | bind (c, name="cublasXtSsyr2k") 293 | import 294 | integer(c_size_t), value :: n, k, lda, ldb, ldc 295 | real(c_float), dimension(lda, *) :: A 296 | real(c_float) :: alpha, beta 297 | integer(c_int), value :: uplo, trans 298 | real(c_float), dimension(ldc, *) :: C 299 | real(c_float), dimension(ldb, *) :: B 300 | type(cublasXtHandle), value :: handle 301 | end function cublasXtSsyr2k 302 | 303 | integer(c_int) function cublasXtDsyr2k & 304 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 305 | bind (c, name="cublasXtDsyr2k") 306 | import 307 | integer(c_size_t), value :: n, k, lda, ldb, ldc 308 | real(c_double), dimension(ldb, *) :: B 309 | integer(c_int), value :: uplo, trans 310 | real(c_double), dimension(ldc, *) :: C 311 | real(c_double), dimension(lda, *) :: A 312 | type(cublasXtHandle), value :: handle 313 | real(c_double) :: alpha, beta 314 | end function cublasXtDsyr2k 315 | 316 | integer(c_int) function cublasXtCsyr2k & 317 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 318 | bind (c, name="cublasXtCsyr2k") 319 | import 320 | integer(c_size_t), value :: n, k, lda, ldb, ldc 321 | complex(c_float), dimension(ldc, *) :: C 322 | complex(c_float) :: alpha, beta 323 | complex(c_float), dimension(ldb, *) :: B 324 | integer(c_int), value :: uplo, trans 325 | complex(c_float), dimension(lda, *) :: A 326 | type(cublasXtHandle), value :: handle 327 | end function cublasXtCsyr2k 328 | 329 | integer(c_int) function cublasXtZsyr2k & 330 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 331 | bind (c, name="cublasXtZsyr2k") 332 | import 333 | integer(c_size_t), value :: n, k, lda, ldb, ldc 334 | integer(c_int), value :: uplo, trans 335 | complex(c_double), dimension(lda, *) :: A 336 | complex(c_double) :: alpha, beta 337 | complex(c_double), dimension(ldb, *) :: B 338 | type(cublasXtHandle), value :: handle 339 | complex(c_double), dimension(ldc, *) :: C 340 | end function cublasXtZsyr2k 341 | 342 | integer(c_int) function cublasXtSsyrkx & 343 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 344 | bind (c, name="cublasXtSsyrkx") 345 | import 346 | integer(c_size_t), value :: n, k, lda, ldb, ldc 347 | real(c_float), dimension(lda, *) :: A 348 | real(c_float) :: alpha, beta 349 | integer(c_int), value :: uplo, trans 350 | real(c_float), dimension(ldc, *) :: C 351 | real(c_float), dimension(ldb, *) :: B 352 | type(cublasXtHandle), value :: handle 353 | end function cublasXtSsyrkx 354 | 355 | integer(c_int) function cublasXtDsyrkx & 356 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 357 | bind (c, name="cublasXtDsyrkx") 358 | import 359 | integer(c_size_t), value :: n, k, lda, ldb, ldc 360 | real(c_double), dimension(ldb, *) :: B 361 | integer(c_int), value :: uplo, trans 362 | real(c_double), dimension(ldc, *) :: C 363 | real(c_double), dimension(lda, *) :: A 364 | type(cublasXtHandle), value :: handle 365 | real(c_double) :: alpha, beta 366 | end function cublasXtDsyrkx 367 | 368 | integer(c_int) function cublasXtCsyrkx & 369 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 370 | bind (c, name="cublasXtCsyrkx") 371 | import 372 | integer(c_size_t), value :: n, k, lda, ldb, ldc 373 | complex(c_float), dimension(ldc, *) :: C 374 | complex(c_float) :: alpha, beta 375 | complex(c_float), dimension(ldb, *) :: B 376 | integer(c_int), value :: uplo, trans 377 | complex(c_float), dimension(lda, *) :: A 378 | type(cublasXtHandle), value :: handle 379 | end function cublasXtCsyrkx 380 | 381 | integer(c_int) function cublasXtZsyrkx & 382 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 383 | bind (c, name="cublasXtZsyrkx") 384 | import 385 | integer(c_size_t), value :: n, k, lda, ldb, ldc 386 | integer(c_int), value :: uplo, trans 387 | complex(c_double), dimension(lda, *) :: A 388 | complex(c_double) :: alpha, beta 389 | complex(c_double), dimension(ldb, *) :: B 390 | type(cublasXtHandle), value :: handle 391 | complex(c_double), dimension(ldc, *) :: C 392 | end function cublasXtZsyrkx 393 | 394 | integer(c_int) function cublasXtCherk (handle, uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 395 | bind (c, name="cublasXtCherk") 396 | import 397 | integer(c_int), value :: uplo, trans, n, k, lda, ldc 398 | real(c_float) :: alpha, beta 399 | type(cublasXtHandle), value :: handle 400 | complex(c_float), dimension(ldc, *) :: C 401 | complex(c_float), dimension(lda, *) :: A 402 | end function cublasXtCherk 403 | 404 | integer(c_int) function cublasXtZherk (handle, uplo, trans, n, k, alpha, A, lda, beta, C, ldc) & 405 | bind (c, name="cublasXtZherk") 406 | import 407 | integer(c_int), value :: uplo, trans, n, k, lda, ldc 408 | complex(c_double), dimension(lda, *) :: A 409 | type(cublasXtHandle), value :: handle 410 | real(c_double) :: alpha, beta 411 | complex(c_double), dimension(ldc, *) :: C 412 | end function cublasXtZherk 413 | 414 | integer(c_int) function cublasXtCher2k & 415 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 416 | bind (c, name="cublasXtCher2k") 417 | import 418 | integer(c_size_t), value :: n, k, lda, ldb, ldc 419 | complex(c_float), dimension(ldc, *) :: C 420 | complex(c_float) :: alpha 421 | real(c_float) :: beta 422 | complex(c_float), dimension(ldb, *) :: B 423 | integer(c_int), value :: uplo, trans 424 | complex(c_float), dimension(lda, *) :: A 425 | type(cublasXtHandle), value :: handle 426 | end function cublasXtCher2k 427 | 428 | integer(c_int) function cublasXtZher2k & 429 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 430 | bind (c, name="cublasXtZher2k") 431 | import 432 | integer(c_size_t), value :: n, k, lda, ldb, ldc 433 | integer(c_int), value :: uplo, trans 434 | complex(c_double), dimension(lda, *) :: A 435 | complex(c_double) :: alpha 436 | complex(c_double), dimension(ldb, *) :: B 437 | type(cublasXtHandle), value :: handle 438 | real(c_double) :: beta 439 | complex(c_double), dimension(ldc, *) :: C 440 | end function cublasXtZher2k 441 | 442 | integer(c_int) function cublasXtCherkx & 443 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 444 | bind (c, name="cublasXtCherkx") 445 | import 446 | integer(c_size_t), value :: n, k, lda, ldb, ldc 447 | complex(c_float), dimension(ldc, *) :: C 448 | complex(c_float) :: alpha 449 | real(c_float) :: beta 450 | complex(c_float), dimension(ldb, *) :: B 451 | integer(c_int), value :: uplo, trans 452 | complex(c_float), dimension(lda, *) :: A 453 | type(cublasXtHandle), value :: handle 454 | end function cublasXtCherkx 455 | 456 | integer(c_int) function cublasXtZherkx & 457 | (handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc) & 458 | bind (c, name="cublasXtZherkx") 459 | import 460 | integer(c_size_t), value :: n, k, lda, ldb, ldc 461 | integer(c_int), value :: uplo, trans 462 | complex(c_double), dimension(lda, *) :: A 463 | complex(c_double) :: alpha 464 | complex(c_double), dimension(ldb, *) :: B 465 | type(cublasXtHandle), value :: handle 466 | real(c_double) :: beta 467 | complex(c_double), dimension(ldc, *) :: C 468 | end function cublasXtZherkx 469 | 470 | integer(c_int) function cublasXtStrsm & 471 | (handle, side, uplo, trans, diag, m, n, alpha, A, lda, B, ldb) & 472 | bind (c, name="cublasXtStrsm") 473 | import 474 | integer(c_size_t), value :: m, n, lda, ldb 475 | real(c_float), dimension(lda, *) :: A 476 | real(c_float) :: alpha 477 | integer(c_int), value :: side, uplo, trans, diag 478 | real(c_float), dimension(ldb, *) :: B 479 | type(cublasXtHandle), value :: handle 480 | end function cublasXtStrsm 481 | 482 | integer(c_int) function cublasXtDtrsm & 483 | (handle, side, uplo, trans, diag, m, n, alpha, A, lda, B, ldb) & 484 | bind (c, name="cublasXtDtrsm") 485 | import 486 | integer(c_size_t), value :: m, n, lda, ldb 487 | real(c_double), dimension(ldb, *) :: B 488 | integer(c_int), value :: side, uplo, trans, diag 489 | real(c_double), dimension(lda, *) :: A 490 | type(cublasXtHandle), value :: handle 491 | real(c_double) :: alpha 492 | end function cublasXtDtrsm 493 | 494 | integer(c_int) function cublasXtCtrsm & 495 | (handle, side, uplo, trans, diag, m, n, alpha, A, lda, B, ldb) & 496 | bind (c, name="cublasXtCtrsm") 497 | import 498 | integer(c_size_t), value :: m, n, lda, ldb 499 | complex(c_float) :: alpha 500 | complex(c_float), dimension(ldb, *) :: B 501 | integer(c_int), value :: side, uplo, trans, diag 502 | complex(c_float), dimension(lda, *) :: A 503 | type(cublasXtHandle), value :: handle 504 | end function cublasXtCtrsm 505 | 506 | integer(c_int) function cublasXtZtrsm & 507 | (handle, side, uplo, trans, diag, m, n, alpha, A, lda, B, ldb) & 508 | bind (c, name="cublasXtZtrsm") 509 | import 510 | integer(c_size_t), value :: m, n, lda, ldb 511 | integer(c_int), value :: side, uplo, trans, diag 512 | complex(c_double), dimension(lda, *) :: A 513 | complex(c_double) :: alpha 514 | complex(c_double), dimension(ldb, *) :: B 515 | type(cublasXtHandle), value :: handle 516 | end function cublasXtZtrsm 517 | 518 | integer(c_int) function cublasXtStrmm & 519 | (handle, side, uplo, trans, diag, m, n, alpha, A, lda, B, ldb, C, ldc) & 520 | bind (c, name="cublasXtStrmm") 521 | import 522 | integer(c_size_t), value :: m, n, lda, ldb, ldc 523 | real(c_float), dimension(lda, *) :: A 524 | real(c_float) :: alpha 525 | integer(c_int), value :: side, uplo, trans, diag 526 | real(c_float), dimension(ldc, *) :: C 527 | real(c_float), dimension(ldb, *) :: B 528 | type(cublasXtHandle), value :: handle 529 | end function cublasXtStrmm 530 | 531 | integer(c_int) function cublasXtDtrmm & 532 | (handle, side, uplo, trans, diag, m, n, alpha, A, lda, B, ldb, C, ldc) & 533 | bind (c, name="cublasXtDtrmm") 534 | import 535 | integer(c_size_t), value :: m, n, lda, ldb, ldc 536 | real(c_double), dimension(ldb, *) :: B 537 | integer(c_int), value :: side, uplo, trans, diag 538 | real(c_double), dimension(ldc, *) :: C 539 | real(c_double), dimension(lda, *) :: A 540 | type(cublasXtHandle), value :: handle 541 | real(c_double) :: alpha 542 | end function cublasXtDtrmm 543 | 544 | integer(c_int) function cublasXtCtrmm & 545 | (handle, side, uplo, trans, diag, m, n, alpha, A, lda, B, ldb, C, ldc) & 546 | bind (c, name="cublasXtCtrmm") 547 | import 548 | integer(c_size_t), value :: m, n, lda, ldb, ldc 549 | complex(c_float), dimension(ldc, *) :: C 550 | complex(c_float) :: alpha 551 | complex(c_float), dimension(ldb, *) :: B 552 | integer(c_int), value :: side, uplo, trans, diag 553 | complex(c_float), dimension(lda, *) :: A 554 | type(cublasXtHandle), value :: handle 555 | end function cublasXtCtrmm 556 | 557 | integer(c_int) function cublasXtZtrmm & 558 | (handle, side, uplo, trans, diag, m, n, alpha, A, lda, B, ldb, C, ldc) & 559 | bind (c, name="cublasXtZtrmm") 560 | import 561 | integer(c_size_t), value :: m, n, lda, ldb, ldc 562 | integer(c_int), value :: side, uplo, trans, diag 563 | complex(c_double), dimension(lda, *) :: A 564 | complex(c_double) :: alpha 565 | complex(c_double), dimension(ldb, *) :: B 566 | type(cublasXtHandle), value :: handle 567 | complex(c_double), dimension(ldc, *) :: C 568 | end function cublasXtZtrmm 569 | 570 | integer(c_int) function cublasXtSspmm (handle, side, uplo, m, n, alpha, AP, B, ldb, beta, C, ldc) & 571 | bind (c, name="cublasXtSspmm") 572 | import 573 | integer(c_size_t), value :: m, n, ldb, ldc 574 | real(c_float) :: alpha, beta 575 | integer(c_int), value :: side, uplo 576 | real(c_float), dimension(ldc, *) :: C 577 | real(c_float), dimension(ldb, *) :: B 578 | type(cublasXtHandle), value :: handle 579 | real(c_float), dimension(*) :: AP 580 | end function cublasXtSspmm 581 | 582 | integer(c_int) function cublasXtDspmm (handle, side, uplo, m, n, alpha, AP, B, ldb, beta, C, ldc) & 583 | bind (c, name="cublasXtDspmm") 584 | import 585 | integer(c_size_t), value :: m, n, ldb, ldc 586 | real(c_double), dimension(ldb, *) :: B 587 | real(c_double), dimension(*) :: AP 588 | integer(c_int), value :: side, uplo 589 | real(c_double), dimension(ldc, *) :: C 590 | type(cublasXtHandle), value :: handle 591 | real(c_double) :: alpha, beta 592 | end function cublasXtDspmm 593 | 594 | integer(c_int) function cublasXtCspmm (handle, side, uplo, m, n, alpha, AP, B, ldb, beta, C, ldc) & 595 | bind (c, name="cublasXtCspmm") 596 | import 597 | integer(c_size_t), value :: m, n, ldb, ldc 598 | complex(c_float), dimension(ldc, *) :: C 599 | complex(c_float) :: alpha, beta 600 | complex(c_float), dimension(*) :: AP 601 | complex(c_float), dimension(ldb, *) :: B 602 | integer(c_int), value :: side, uplo 603 | type(cublasXtHandle), value :: handle 604 | end function cublasXtCspmm 605 | 606 | integer(c_int) function cublasXtZspmm (handle, side, uplo, m, n, alpha, AP, B, ldb, beta, C, ldc) & 607 | bind (c, name="cublasXtZspmm") 608 | import 609 | integer(c_size_t), value :: m, n, ldb, ldc 610 | integer(c_int), value :: side, uplo 611 | complex(c_double) :: alpha, beta 612 | complex(c_double), dimension(ldb, *) :: B 613 | complex(c_double), dimension(*) :: AP 614 | type(cublasXtHandle), value :: handle 615 | complex(c_double), dimension(ldc, *) :: C 616 | end function cublasXtZspmm 617 | 618 | end interface 619 | end module 620 | -------------------------------------------------------------------------------- /cufft.f90: -------------------------------------------------------------------------------- 1 | !! Fortran CUDA Library interface -- CUFFT module 2 | !! 3 | !! Copyright (C) 2017-2018 Mentor, A Siemens Business 4 | !! 5 | !! This software is provided 'as-is', without any express or implied 6 | !! warranty. In no event will the authors be held liable for any damages 7 | !! arising from the use of this software. 8 | !! 9 | !! Permission is granted to anyone to use this software for any purpose, 10 | !! including commercial applications, and to alter it and redistribute it 11 | !! freely, subject to the following restrictions: 12 | !! 13 | !! 1. The origin of this software must not be misrepresented; you must not 14 | !! claim that you wrote the original software. If you use this software 15 | !! in a product, an acknowledgment in the product documentation would be 16 | !! appreciated but is not required. 17 | !! 2. Altered source versions must be plainly marked as such, and must not be 18 | !! misrepresented as being the original software. 19 | !! 3. This notice may not be removed or altered from any source distribution. 20 | 21 | module cufft 22 | use iso_c_binding 23 | 24 | integer, parameter :: CUFFT_FORWARD = -1 25 | integer, parameter :: CUFFT_INVERSE = 1 26 | 27 | ! CUFFT Status 28 | enum, bind(C) 29 | enumerator :: CUFFT_SUCCESS = 0 30 | enumerator :: CUFFT_INVALID_PLAN = 1 31 | enumerator :: CUFFT_ALLOC_FAILED = 2 32 | enumerator :: CUFFT_INVALID_TYPE = 3 33 | enumerator :: CUFFT_INVALID_VALUE = 4 34 | enumerator :: CUFFT_INTERNAL_ERROR = 5 35 | enumerator :: CUFFT_EXEC_FAILED = 6 36 | enumerator :: CUFFT_SETUP_FAILED = 7 37 | enumerator :: CUFFT_INVALID_SIZE = 8 38 | enumerator :: CUFFT_UNALIGNED_DATA = 9 39 | end enum 40 | 41 | ! CUFFT Transform Types 42 | enum, bind(C) 43 | enumerator :: CUFFT_R2C = int(z'2a') ! Real to Complex (interleaved) 44 | enumerator :: CUFFT_C2R = int(z'2c') ! Complex (interleaved) to Real 45 | enumerator :: CUFFT_C2C = int(z'29') ! Complex to Complex, interleaved 46 | enumerator :: CUFFT_D2Z = int(z'6a') ! Double to Double-Complex 47 | enumerator :: CUFFT_Z2D = int(z'6c') ! Double-Complex to Double 48 | enumerator :: CUFFT_Z2Z = int(z'69') ! Double-Complex to Double-Complex 49 | end enum 50 | 51 | ! CUFFT Data Layouts 52 | enum, bind(C) 53 | enumerator :: CUFFT_COMPATIBILITY_NATIVE = 0 54 | enumerator :: CUFFT_COMPATIBILITY_FFTW_PADDING = 1 55 | enumerator :: CUFFT_COMPATIBILITY_FFTW_ASYMMETRIC = 2 56 | enumerator :: CUFFT_COMPATIBILITY_FFTW_ALL = 3 57 | end enum 58 | 59 | integer, parameter :: CUFFT_COMPATIBILITY_DEFAULT = CUFFT_COMPATIBILITY_FFTW_PADDING 60 | 61 | interface 62 | integer(c_int) function cufftSetCompatibilityMode (plan, mode) & 63 | bind (c, name="cufftSetCompatibilityMode") 64 | import 65 | integer(c_int), value :: plan, mode 66 | end function cufftSetCompatibilityMode 67 | 68 | integer(c_int) function cufftSetStream (plan, stream) & 69 | bind (c, name="cufftSetStream") 70 | import 71 | integer(c_int), value :: plan 72 | type(c_ptr), value :: stream 73 | end function cufftSetStream 74 | 75 | integer(c_int) function cufftGetVersion (version) & 76 | bind (c, name="cufftGetVersion") 77 | import 78 | integer(c_int) :: version 79 | end function cufftGetVersion 80 | 81 | integer(c_int) function cufftSetAutoAllocation (plan, autoAllocate) & 82 | bind (c, name="cufftSetAutoAllocation") 83 | import 84 | integer(c_int), value :: plan, autoAllocate 85 | end function cufftSetAutoAllocation 86 | 87 | integer(c_int) function cufftSetWorkArea (plan, workArea) & 88 | bind (c, name="cufftSetWorkArea") 89 | import 90 | integer(c_int), value :: plan 91 | integer(c_signed_char), dimension(*) :: workArea 92 | end function cufftSetWorkArea 93 | 94 | integer(c_int) function cufftDestroy (plan) & 95 | bind (c, name="cufftDestroy") 96 | import 97 | integer(c_int), value :: plan 98 | end function cufftDestroy 99 | 100 | integer(c_int) function cufftPlan1d (plan, nx, type, batch) & 101 | bind (c, name="cufftPlan1d") 102 | import 103 | integer(c_int), value :: nx, type, batch 104 | integer(c_int) :: plan 105 | end function cufftPlan1d 106 | 107 | integer(c_int) function cufftPlan2d (plan, nx, ny, type) & 108 | bind (c, name="cufftPlan2d") 109 | import 110 | integer(c_int), value :: nx, ny, type 111 | integer(c_int) :: plan 112 | end function cufftPlan2d 113 | 114 | integer(c_int) function cufftPlan3d (plan, nx, ny, nz, type) & 115 | bind (c, name="cufftPlan3d") 116 | import 117 | integer(c_int), value :: nx, ny, nz, type 118 | integer(c_int) :: plan 119 | end function cufftPlan3d 120 | 121 | integer(c_int) function cufftPlanMany & 122 | (plan, rank, n, inembed, istride, idist, onembed, ostride, odist, type, batch) & 123 | bind (c, name="cufftPlanMany") 124 | import 125 | integer(c_int), value :: rank, istride, idist, ostride, odist, type, batch 126 | integer(c_int), dimension(*) :: n, inembed, onembed 127 | integer(c_int) :: plan 128 | end function cufftPlanMany 129 | 130 | integer(c_int) function cufftCreate (plan) & 131 | bind (c, name="cufftCreate") 132 | import 133 | integer(c_int) :: plan 134 | end function cufftCreate 135 | 136 | integer(c_int) function cufftMakePlan1d (plan, nx, type, batch, workSize) & 137 | bind (c, name="cufftMakePlan1d") 138 | import 139 | integer(c_int), value :: plan, nx, type, batch 140 | integer(c_size_t) :: workSize 141 | end function cufftMakePlan1d 142 | 143 | integer(c_int) function cufftMakePlan2d (plan, nx, ny, type, workSize) & 144 | bind (c, name="cufftMakePlan2d") 145 | import 146 | integer(c_int), value :: plan, nx, ny, type 147 | integer(c_size_t) :: workSize 148 | end function cufftMakePlan2d 149 | 150 | integer(c_int) function cufftMakePlan3d (plan, nx, ny, nz, type, workSize) & 151 | bind (c, name="cufftMakePlan3d") 152 | import 153 | integer(c_int), value :: plan, nx, ny, nz, type 154 | integer(c_size_t) :: workSize 155 | end function cufftMakePlan3d 156 | 157 | integer(c_int) function cufftMakePlanMany & 158 | (plan, rank, n, inembed, istride, idist, onembed, ostride, odist, type, batch, workSize) & 159 | bind (c, name="cufftMakePlanMany") 160 | import 161 | integer(c_int), value :: plan, rank, istride, idist, ostride, odist, type, batch 162 | integer(c_int), dimension(*) :: n, inembed, onembed 163 | integer(c_size_t) :: workSize 164 | end function cufftMakePlanMany 165 | 166 | integer(c_int) function cufftMakePlanMany64 & 167 | (plan, rank, n, inembed, istride, idist, onembed, ostride, odist, type, batch, workSize) & 168 | bind (c, name="cufftMakePlanMany64") 169 | import 170 | integer(c_long_long), value :: istride, idist, ostride, odist, batch 171 | integer(c_long_long), dimension(*) :: n, inembed, onembed 172 | integer(c_int), value :: plan, rank, type 173 | integer(c_size_t) :: workSize 174 | end function cufftMakePlanMany64 175 | 176 | integer(c_int) function cufftEstimate1d (nx, type, batch, workSize) & 177 | bind (c, name="cufftEstimate1d") 178 | import 179 | integer(c_int), value :: nx, type, batch 180 | integer(c_size_t) :: workSize 181 | end function cufftEstimate1d 182 | 183 | integer(c_int) function cufftEstimate2d (nx, ny, type, workSize) & 184 | bind (c, name="cufftEstimate2d") 185 | import 186 | integer(c_int), value :: nx, ny, type 187 | integer(c_size_t) :: workSize 188 | end function cufftEstimate2d 189 | 190 | integer(c_int) function cufftEstimate3d (nx, ny, nz, type, workSize) & 191 | bind (c, name="cufftEstimate3d") 192 | import 193 | integer(c_int), value :: nx, ny, nz, type 194 | integer(c_size_t) :: workSize 195 | end function cufftEstimate3d 196 | 197 | integer(c_int) function cufftEstimateMany & 198 | (rank, n, inembed, istride, idist, onembed, ostride, odist, type, batch, workSize) & 199 | bind (c, name="cufftEstimateMany") 200 | import 201 | integer(c_int), value :: rank, istride, idist, ostride, odist, type, batch 202 | integer(c_size_t) :: workSize 203 | integer(c_int) :: n, inembed, onembed 204 | end function cufftEstimateMany 205 | 206 | integer(c_int) function cufftGetSize1d (plan, nx, type, batch, workSize) & 207 | bind (c, name="cufftGetSize1d") 208 | import 209 | integer(c_int), value :: plan, nx, type, batch 210 | integer(c_size_t) :: workSize 211 | end function cufftGetSize1d 212 | 213 | integer(c_int) function cufftGetSize2d (plan, nx, ny, type, workSize) & 214 | bind (c, name="cufftGetSize2d") 215 | import 216 | integer(c_int), value :: plan, nx, ny, type 217 | integer(c_size_t) :: workSize 218 | end function cufftGetSize2d 219 | 220 | integer(c_int) function cufftGetSize3d (plan, nx, ny, nz, type, workSize) & 221 | bind (c, name="cufftGetSize3d") 222 | import 223 | integer(c_int), value :: plan, nx, ny, nz, type 224 | integer(c_size_t) :: workSize 225 | end function cufftGetSize3d 226 | 227 | integer(c_int) function cufftGetSizeMany & 228 | (plan, rank, n, inembed, istride, idist, onembed, ostride, odist, type, batch, workSize) & 229 | bind (c, name="cufftGetSizeMany") 230 | import 231 | integer(c_int), value :: plan, rank, istride, idist, ostride, odist, type, batch 232 | integer(c_int), dimension(*) :: n, inembed, onembed 233 | integer(c_size_t) :: workSize 234 | end function cufftGetSizeMany 235 | 236 | integer(c_int) function cufftGetSizeMany64 & 237 | (plan, rank, n, inembed, istride, idist, onembed, ostride, odist, type, batch, workSize) & 238 | bind (c, name="cufftGetSizeMany64") 239 | import 240 | integer(c_long_long), value :: istride, idist, ostride, odist, batch 241 | integer(c_long_long), dimension(*) :: n, inembed, onembed 242 | integer(c_int), value :: plan, rank, type 243 | integer(c_size_t) :: workSize 244 | end function cufftGetSizeMany64 245 | 246 | integer(c_int) function cufftGetSize (plan, workSize) & 247 | bind (c, name="cufftGetSize") 248 | import 249 | integer(c_int), value :: plan 250 | integer(c_size_t) :: workSize 251 | end function cufftGetSize 252 | 253 | integer(c_int) function cufftExecC2C (plan, idata, odata, direction) & 254 | bind (c, name="cufftExecC2C") 255 | import 256 | complex(c_float), dimension(*) :: idata, odata 257 | integer(c_int), value :: plan, direction 258 | end function cufftExecC2C 259 | 260 | integer(c_int) function cufftExecR2C (plan, idata, odata) & 261 | bind (c, name="cufftExecR2C") 262 | import 263 | complex(c_float), dimension(*) :: odata 264 | integer(c_int), value :: plan 265 | real(c_float), dimension(*) :: idata 266 | end function cufftExecR2C 267 | 268 | integer(c_int) function cufftExecC2R (plan, idata, odata) & 269 | bind (c, name="cufftExecC2R") 270 | import 271 | complex(c_float), dimension(*) :: idata 272 | integer(c_int), value :: plan 273 | real(c_float), dimension(*) :: odata 274 | end function cufftExecC2R 275 | 276 | integer(c_int) function cufftExecZ2Z (plan, idata, odata, direction) & 277 | bind (c, name="cufftExecZ2Z") 278 | import 279 | integer(c_int), value :: plan, direction 280 | complex(c_double), dimension(*) :: idata, odata 281 | end function cufftExecZ2Z 282 | 283 | integer(c_int) function cufftExecD2Z (plan, idata, odata) & 284 | bind (c, name="cufftExecD2Z") 285 | import 286 | real(c_double), dimension(*) :: idata 287 | integer(c_int), value :: plan 288 | complex(c_double), dimension(*) :: odata 289 | end function cufftExecD2Z 290 | 291 | integer(c_int) function cufftExecZ2D (plan, idata, odata) & 292 | bind (c, name="cufftExecZ2D") 293 | import 294 | complex(c_float), dimension(*) :: idata 295 | integer(c_int), value :: plan 296 | real(c_float), dimension(*) :: odata 297 | end function cufftExecZ2D 298 | 299 | end interface 300 | end module 301 | --------------------------------------------------------------------------------