Method for accelerating operator by calling GPU (Graphics Processing Unit) through OCaml functional language
A technology of language calling and function calling, which is applied in computing, electrical digital data processing, resource allocation, etc., can solve the problem of slow computing speed of operators, and achieve the effect of improving computing speed
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Publication Date
- 2022-03-08
Smart Images

Figure 1 
Figure 2 
Figure 3
Abstract
Description
technical field
[0001] The invention belongs to the field of computer software, and in particular relates to a method for OCaml functional language calling GPU to perform operator acceleration. Background technique
[0002] With the rapid development of the OCaml functional language, the parameter data required by many OCaml operators has become larger and larger. OCaml's traditional CPU-based calculation method can no longer meet the needs of intelligent computing. The traditional OCaml operator calculation is performed on the CPU. The CPU is mainly designed for general-purpose computing, which contains fewer arithmetic logic units ALU, and the computing goal of the CPU is to execute dozens of threads in parallel, while the goal of the GPU is to execute thousands of threads in parallel. Therefore, the CPU often struggles when faced with operations with large data. Usually, the data structures that OCaml faces are usually very large, and the calculation time on the CPU will...
Examples
Embodiment Construction
[0029] The present invention will be described in detail below in conjunction with the accompanying drawings and specific examples.
[0030] Such as figure 1 As shown, the present invention is a kind of OCaml functional language call GPU to carry out the method for operator acceleration, is divided into three steps: write required operator with CUDA code and generate the dynamic link library (*.so that can be called by C language file); use the C function that can be called by OCaml to call the CUDA kernel function in the CUDA dynamic link library, and generate the C dynamic link library (*.so file) that can be called by the OCaml functional language from the C file that contains this C function ; OCaml calls the C function that has called the CUDA kernel function, and links with the C dynamic link library (*.so file) and other required libraries to realize the call of OCaml to the GPU.
[0031] A kind of OCaml functional language of the present invention calls GPU to carry o...