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

CN114153433APending Publication Date: 2022-03-08NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Publication Date
2022-03-08

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
  • Figure 3
    Figure 3
Patent Text Reader

Abstract

The invention discloses a method for carrying out operator acceleration by calling a GPU (Graphics Processing Unit) through an OCaml functional language. Comprising the following steps: compiling a required operator by using a CUDA code and generating a dynamic link library capable of being called by a C language; calling a CUDA kernel function in the CUDA dynamic link library by using a C function capable of being called by an OCaml functional language, and generating a C dynamic link library capable of being called by the OCaml; and calling the C function which has called the CUDA kernel function by the OCAML, and linking the C function with the C dynamic link library and other required libraries to realize the calling of the GPU by the OCAML. According to the method, from the perspective of creating and calling the dynamic link library, the OCaml functional language calls the GPU to accelerate the operator, the problem that the OCaml is too low in operator calculation speed for a large amount of data is solved, cross-order-of-magnitude calculation efficiency is improved, and meanwhile the problem that the OCaml calls the GPU to conduct parallel calculation is solved.
Need to check novelty before this filing date? Find Prior Art

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...