Simple GPU 1.0
Fortran GPU Computing Library with transparent CPU/GPU support
Loading...
Searching...
No Matches
gpu_nvidia.c File Reference
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <cublas_v2.h>
#include <cuda_runtime.h>
Include dependency graph for gpu_nvidia.c:

Go to the source code of this file.

Functions

int gpu_ndevices ()
void gpu_set_device (int32_t igpu)
void gpu_get_memory (size_t *free, size_t *total)
void gpu_allocate (void **ptr, const int64_t size)
void gpu_deallocate (void **ptr)
void gpu_free (void **ptr)
void gpu_upload (const void *cpu_ptr, void *gpu_ptr, const int64_t n)
void gpu_download (const void *gpu_ptr, void *cpu_ptr, const int64_t n)
void gpu_copy (const void *gpu_ptr_src, void *gpu_ptr_dest, const int64_t n)
void gpu_stream_create (cudaStream_t *ptr)
void gpu_stream_destroy (cudaStream_t *ptr)
void gpu_set_stream (cublasHandle_t handle, cudaStream_t stream)
void gpu_synchronize ()
void gpu_stream_synchronize (void *stream)
void gpu_blas_create (cublasHandle_t *ptr)
void gpu_blas_destroy (cublasHandle_t *ptr)
void gpu_ddot (cublasHandle_t handle, const int64_t n, const double *x, const int64_t incx, const double *y, const int64_t incy, double *result)
void gpu_sdot (cublasHandle_t handle, const int64_t n, const float *x, const int64_t incx, const float *y, const int64_t incy, float *result)
void gpu_dgemv (cublasHandle_t handle, const char *transa, const int64_t m, const int64_t n, const double *alpha, const double *a, const int64_t lda, const double *x, const int64_t incx, const double *beta, double *y, const int64_t incy)
void gpu_sgemv (cublasHandle_t handle, const char *transa, const int64_t m, const int64_t n, const float *alpha, const float *a, const int64_t lda, const float *x, const int64_t incx, const float *beta, float *y, const int64_t incy)
void gpu_dgemm (cublasHandle_t handle, const char *transa, const char *transb, const int64_t m, const int64_t n, const int64_t k, const double *alpha, const double *a, const int64_t lda, const double *b, const int64_t ldb, const double *beta, double *c, const int64_t ldc)
void gpu_sgemm (cublasHandle_t handle, const char *transa, const char *transb, const int64_t m, const int64_t n, const int64_t k, const float *alpha, const float *a, const int64_t lda, const float *b, const int64_t ldb, const float *beta, float *c, const int64_t ldc)
void gpu_dgeam (cublasHandle_t handle, const char *transa, const char *transb, const int64_t m, const int64_t n, const double *alpha, const double *a, const int64_t lda, const double *beta, const double *b, const int64_t ldb, double *c, const int64_t ldc)
void gpu_sgeam (cublasHandle_t handle, const char *transa, const char *transb, const int64_t m, const int64_t n, const float *alpha, const float *a, const int64_t lda, const float *beta, const float *b, const int64_t ldb, float *c, const int64_t ldc)

Function Documentation

◆ gpu_allocate()

void gpu_allocate ( void ** ptr,
const int64_t size )

Definition at line 47 of file gpu_nvidia.c.

◆ gpu_blas_create()

void gpu_blas_create ( cublasHandle_t * ptr)

Definition at line 166 of file gpu_nvidia.c.

◆ gpu_blas_destroy()

void gpu_blas_destroy ( cublasHandle_t * ptr)

Definition at line 172 of file gpu_nvidia.c.

◆ gpu_copy()

void gpu_copy ( const void * gpu_ptr_src,
void * gpu_ptr_dest,
const int64_t n )

Definition at line 106 of file gpu_nvidia.c.

◆ gpu_ddot()

void gpu_ddot ( cublasHandle_t handle,
const int64_t n,
const double * x,
const int64_t incx,
const double * y,
const int64_t incy,
double * result )

Definition at line 180 of file gpu_nvidia.c.

◆ gpu_deallocate()

void gpu_deallocate ( void ** ptr)

Definition at line 67 of file gpu_nvidia.c.

Here is the caller graph for this function:

◆ gpu_dgeam()

void gpu_dgeam ( cublasHandle_t handle,
const char * transa,
const char * transb,
const int64_t m,
const int64_t n,
const double * alpha,
const double * a,
const int64_t lda,
const double * beta,
const double * b,
const int64_t ldb,
double * c,
const int64_t ldc )

Definition at line 344 of file gpu_nvidia.c.

◆ gpu_dgemm()

void gpu_dgemm ( cublasHandle_t handle,
const char * transa,
const char * transb,
const int64_t m,
const int64_t n,
const int64_t k,
const double * alpha,
const double * a,
const int64_t lda,
const double * b,
const int64_t ldb,
const double * beta,
double * c,
const int64_t ldc )

Definition at line 279 of file gpu_nvidia.c.

◆ gpu_dgemv()

void gpu_dgemv ( cublasHandle_t handle,
const char * transa,
const int64_t m,
const int64_t n,
const double * alpha,
const double * a,
const int64_t lda,
const double * x,
const int64_t incx,
const double * beta,
double * y,
const int64_t incy )

Definition at line 222 of file gpu_nvidia.c.

◆ gpu_download()

void gpu_download ( const void * gpu_ptr,
void * cpu_ptr,
const int64_t n )

Definition at line 94 of file gpu_nvidia.c.

◆ gpu_free()

void gpu_free ( void ** ptr)

Definition at line 75 of file gpu_nvidia.c.

Here is the call graph for this function:

◆ gpu_get_memory()

void gpu_get_memory ( size_t * free,
size_t * total )

Definition at line 37 of file gpu_nvidia.c.

◆ gpu_ndevices()

int gpu_ndevices ( )

Definition at line 14 of file gpu_nvidia.c.

Here is the caller graph for this function:

◆ gpu_sdot()

void gpu_sdot ( cublasHandle_t handle,
const int64_t n,
const float * x,
const int64_t incx,
const float * y,
const int64_t incy,
float * result )

Definition at line 199 of file gpu_nvidia.c.

◆ gpu_set_device()

void gpu_set_device ( int32_t igpu)

Definition at line 20 of file gpu_nvidia.c.

Here is the call graph for this function:

◆ gpu_set_stream()

void gpu_set_stream ( cublasHandle_t handle,
cudaStream_t stream )

Definition at line 139 of file gpu_nvidia.c.

◆ gpu_sgeam()

void gpu_sgeam ( cublasHandle_t handle,
const char * transa,
const char * transb,
const int64_t m,
const int64_t n,
const float * alpha,
const float * a,
const int64_t lda,
const float * beta,
const float * b,
const int64_t ldb,
float * c,
const int64_t ldc )

Definition at line 374 of file gpu_nvidia.c.

◆ gpu_sgemm()

void gpu_sgemm ( cublasHandle_t handle,
const char * transa,
const char * transb,
const int64_t m,
const int64_t n,
const int64_t k,
const float * alpha,
const float * a,
const int64_t lda,
const float * b,
const int64_t ldb,
const float * beta,
float * c,
const int64_t ldc )

Definition at line 312 of file gpu_nvidia.c.

◆ gpu_sgemv()

void gpu_sgemv ( cublasHandle_t handle,
const char * transa,
const int64_t m,
const int64_t n,
const float * alpha,
const float * a,
const int64_t lda,
const float * x,
const int64_t incx,
const float * beta,
float * y,
const int64_t incy )

Definition at line 251 of file gpu_nvidia.c.

◆ gpu_stream_create()

void gpu_stream_create ( cudaStream_t * ptr)

Definition at line 121 of file gpu_nvidia.c.

◆ gpu_stream_destroy()

void gpu_stream_destroy ( cudaStream_t * ptr)

Definition at line 129 of file gpu_nvidia.c.

◆ gpu_stream_synchronize()

void gpu_stream_synchronize ( void * stream)

Definition at line 155 of file gpu_nvidia.c.

◆ gpu_synchronize()

void gpu_synchronize ( )

Definition at line 147 of file gpu_nvidia.c.

◆ gpu_upload()

void gpu_upload ( const void * cpu_ptr,
void * gpu_ptr,
const int64_t n )

Definition at line 82 of file gpu_nvidia.c.