The user-space API presented in this project aims to simplify the process of utilizing multiple GPUs as a single, powerful computing resource. By abstracting the complexities associated with multi-GPU programming and CUDA, this API allows developers to leverage the benefits of parallel computing without the need for extensive knowledge in these areas.
The primary goal of this project is to demonstrate the potential advantages of a generalizable API for parallelism, making it more accessible to developers. By providing a proof of concept, this project encourages future researchers to further develop and refine user-space APIs that streamline multi-GPU programming.
The API is designed to be user-friendly and intuitive, enabling developers to harness the power of multiple GPUs with minimal effort. This approach can lead to improved performance in applications without the need for developers to delve into the intricacies of traditional multi-GPU programming or CUDA.
-
Vector Operations: The
computeDotProduct
function in the GigaAPI allows you to compute the dot product of two vectors using multiple GPUs in parallel. It takes the input vectors, the result variable, and the size of the vectors as parameters. ThecomputeL2Norm
function enables you to calculate the L2 norm of a vector using multiple GPUs concurrently. It accepts the input vector, the result variable, and the size of the vector as arguments. -
Fast Fourier Transform: The
performFFT
function in the GigaAPI is used to perform the Fast Fourier Transform (FFT) on input data using multiple GPUs. It requires the input data array, the output FFT data array, the dimensions of the FFT, and the number of GPUs to use for the computation as parameters. -
Matrix Multiplication: The
performMatrixMultiplication
function performs matrix multiplication using multiple GPUs. It takes the input matrices A and B, the output matrix C, and their respective dimensions as parameters.
-
RGB to Grayscale Conversion: The
convertToGrayscale
function converts an RGB image to grayscale using multiple GPUs. It requires the input RGB image data, the output grayscale image data, and the dimensions of the image as parameters. -
Image Upsampling: The
upsampleImage
function performs image upsampling using multiple GPUs. It takes the input image data, the output upsampled image data, the dimensions of the image, and the upsampling scale factor as arguments. Additionally, theupsampleAllImages
function allows you to upsample multiple images using multiple GPUs. -
Image Sharpening: The
sharpenImage
function applies image sharpening using multiple GPUs. It accepts the input image data, the output sharpened image data, and the dimensions of the image as parameters.
- Parallel Mining: The
parallelMining
function in the GigaAPI enables parallel mining using multiple GPUs. It accepts the block data to be mined and the target hash value as parameters, and returns the mined result as a string.
To use the GigaAPI, follow these steps:
- Clone the GigaAPI repository.
- Set the appropriate paths for OpenCV and CUDA in the Makefile.
- Run
make
to build the GigaAPI library ingiga-api/common
. - Include the
MegaGPU.h
header file in your C++ code and create a relevant Makefile. - Instantiate the MegaGPU object and call the desired functions based on your requirements.
Please refer to the API documentation for detailed information on each function's parameters and usage (see the README
inside giga-api/common
).
The provided Makefile in common
is used to build the GigaAPI library. It specifies the necessary compiler flags, include directories, and library directories for OpenCV and CUDA.
To build the library, simply run make
in the project directory. This will compile the source files and generate the libmegagpu.a
library file.
To clean the build artifacts, run make clean
.
Note: If any changes are made to the CUDA kernels or the GigaAPI source files, you need to run make
again to rebuild the library.