1. Field of the Invention
The present invention relates to computer processing systems and, more specifically, to a processing system that directs central processing unit instructions to be executed on a graphics processing unit.
2.Description of the Prior Art
The majority of current software programs are designed to utilize the processing power of the central processing unit (CPU). Traditionally, most CPUs operated in a sequential fashion, meaning they executed one instruction on one or two pieces of data at a time. While technical innovations in the CPU field have allowed for computations to be performed more quickly, the sequential nature of CPUs has resulted in a significant degree of inefficiency. Because the CPU can only perform one instruction at a time, the CPU must wait for a first instruction to complete before beginning to execute a second instruction. This creates a bottleneck which results in slower computational times. Recent developments in CPU technology have addressed this limitation by increasing clock speed. While this does speed up computation time, increasing the clock speed does not address the root problem of the inherent sequential nature of CPUs.
More recently, CPU designers have recognized this serial limitation and have begun to implement improvements to execute instructions in parallel rather than in series. A simple method to accomplish parallel computation is called instruction level parallelism. Instruction level parallelism allows for more than one instruction to be performed at a time by segmenting the execution pathway into multiple stages. Another approach taken towards increasing the parallel computing power of the CPU is thread level parallelism. Thread level parallelism involves the use of multiple CPUs to obtain faster results. While both of these approaches address the problems of serial computations on a CPU, they are both disfavored as they do not solve the underlying hardware limitations of CPUs.
In addition to a CPU, more and more personal computers now contain a graphics processing unit (GPU). GPUs were originally developed by companies such as 3DFX and SGI, and later purchased by NVIDIA® and ATI® to support the growing video game market. Computer graphic computations, particularly those of video games, are highly parallel and demand very high computational speeds. As a result of this demand, processor manufacturers developed GPUs which were optimized for high throughput. This was a departure from CPUs which are optimized for low latency.
The GPU can execute many parallel computations because of its architecture. The architecture of the GPU, which allowed it to be used in graphics intensive applications, has also allowed it to be adapted for use as a general computational engine, similar to a CPU. The parallel nature of GPUs means that programs, which are parallelizable, can be performed by the GPU at significantly higher speeds than CPUs. GPUs can produce speedups of five to more than one hundred times that of a CPU, provided that the software is well suited to the parallel computation of the GPU.
Currently many programs perform the majority of their calculations on a CPU even though such calculations could be performed more quickly on a GPU. One such program is MATLAB®, a product of The Mathworks, Inc. MATLAB® is a premium numerical computing environment and programming language. MATLAB® is known for allowing users to easily manipulate matrices or arrays, and to create complex algorithms and user interfaces. MATLAB® is very popular among engineers and scientists, particularly those involved in linear algebra, numerical analysis and image processing.
MATLAB® is unique among many programming languages because it is an interpreted language rather than a compiled language. Interpreted languages use an interpreter to translate higher level programming languages into an intermediate form which is then executed. Many other higher level languages, including C++, use a compiler to translate source code to object code and the object code is then passed to a linker which ultimately produces machine code. A practical difference between compiled and interpreted languages is compiled languages are generally more difficult to program because the complete code must be written before any testing can be performed. Interpreted languages however, can be tested line by line as the interpreter can execute the code without a complete program.
The core environment of MATLAB® can be extended by means of “toolboxes.” Each toolbox is a program and contains a collection of functions that pertain to specific application areas. MATLAB® also includes a facility for object oriented programming. This facility allows a developer or user to extend the MATLAB® language by creating new classes of objects, or data types, which can be manipulated using defined methods, or rules. These new objects adhere to established and accepted principles of object oriented programming, including encapsulation, polymorphism, overloading, inheritance, and aggregation as known by those skilled in the art. Because MATLAB® objects adhere to these principles, a developer or user can more rapidly build new applications that are feature-rich, reliable, and easy to use effectively.
While MATLAB® traditionally runs on the CPU, attempts have been made to execute MATLAB® instructions on the GPU. Currently a MATLAB® user wanting to access the computational power of the GPU must be intimately familiar with several programming languages including C or C++, CUDA, C for Graphics, GLSL, HLSL, Open GL, and DirectX.
In one example, a programmer, wanting to execute computations on a GPU through MATLAB®, must create a C or C++ script which can call the GPU by way of CUDA. CUDA, short for Compute, Unified Device Architecture, was created by NVIDIA and interfaces to NVIDIA brand GPUs. CUDA allows programmers to use to code algorithms for execution on NVIDIA GPUs by way of the C or C++ programming languages. A programmer would first create a C or C++ code that can properly perform computations on the GPU through CUDA. Next, the programmer must create a MATLAB® function that calls the C or C++ program that interfaces with CUDA. Therefore under this approach, a programmer must have a significant working knowledge of MATLAB, C or C++, and CUDA.
Alternatively, a programmer unfamiliar with CUDA can create a C or C++ code which interfaces with OpenGL and CG. Open GL, short for Open Graphics Library, is a lower level API, which stands for application-programmer interface which is used for creating applications that produce both two dimensional and three dimensional computer graphics. CG, short for C for Graphics, is a high level shading language developed by NVIDIA. CG is based roughly on the C programming language which allows a programmer to create complex graphics without having to learn a GPU assembly language. Under this approach, a programmer wishing to execute MATLAB® commands on the GPU must write a C or C++ program to interface with CG. Then the programmer must create a CG program to communicate with a GPU as well as an Open GL program to further communicate with the GPU. These programs are in addition to the MATLAB® code which must call the C or C++ application. In this case, a programmer would have to have knowledge of MATLAB®, C or C++, CG, and Open GL. A programmer has the option of creating code on GLSL instead of CG. GLSL, short for OpenGL shading language, is a high level shading language based on C and was created by OpenGL developers to give programmers more control of the graphics without having to learn an assembly language. In this case, a programmer would have to have knowledge of MATLAB®, C or C++, GLSL, and Open GL.
A third option involves creating code for HLSL and DirectX. DirectX is a collection of lower level application programming interfaces related to graphics programming. HLSL, short for Higher Level Shader Language, is a shading language, developed by Microsoft, and is used for creating code in DirectX. A programmer wishing to execute MATLAB® instructions on a GPU must create a MATLAB® function which calls a C or C++ command which in turn calls on HLSL and then DirectX. Consequently, a programmer must have knowledge of MATLAB®, C or C++, HLSL, and DirectX.
These three alternatives present two distinct, yet related problems. First, a user wishing to execute MATLAB® instructions on a GPU must understand and create applications in several programming languages. Second, by relying on these other programming languages, the primary benefit of using MATLAB® is negated. MATLAB® owes some of its popularity to the fact that it is an interpreted, rather than compiled language. Interpreted languages are inherently easier to program in because a programmer can test the program after each command whereas compiled language require the program to be complete before executing.
Therefore, there is a need for a system that facilitates execution of CPU-based instructions on a GPU.