Method, device and computer program product for reading database data into GPU video memory

By directly copying database data to GPU video memory in CPU memory and continuously merging data sets, the problems of low data transmission efficiency and high memory usage in the prior art are solved, and fast and efficient database data reading to The process of GPU video memory.

CN119149646BActive Publication Date: 2025-02-07HARVEST VISION TECH (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411649404.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-02-07
Estimated Expiration
2044-11-19

AI Technical Summary

Technical Problem

When reading data from a database to GPU video memory, the data needs to be read into the CPU memory first and then copied to the GPU video memory, resulting in high CPU memory footprint, long data transmission time, and a risk of memory overflow.

Method used

By continuously reading the target data from the database into the CPU memory, and when reading the data in the CPU memory, the data is directly copied to the GPU video memory to form the first data set. Then continue to copy the data from the CPU memory to the GPU video memory, form the second data set, and merge it with the first data set, and repeat the process until the data is read.

Benefits of technology

It realizes the rapid transmission of database data to GPU video memory without occupying too much CPU memory, which improves data transmission efficiency, reduces system performance overhead, and avoids the risk of memory overflow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149646B_ABST
    Figure CN119149646B_ABST
Patent Text Reader

Abstract

The purpose of each embodiment of the present disclosure is to provide a method, apparatus, device, computer program product and computer program storage medium for reading database data into GPU video memory. The computer device continuously reads target data from the database into the memory of the CPU; when a part of the target data begins to be read into the memory of the CPU, the computer device copies the read data in the memory of the CPU to the GPU video memory to obtain a first data set; the computer device continues to copy subsequent parts of the target data from the memory of the CPU to the GPU video memory to obtain a second data set, and merges the second data set into the first data set; the aforementioned operations are repeated until the target data is completely read from the database. Each embodiment of the present disclosure provides a solution for quickly reading database data into GPU video memory based on Rapids‑CUDF, which can support different types of databases, and can transfer data in the database to the GPU video memory via CPU serialization-free.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of GPU (Graphics Processing Unit) video memory technology, and more particularly to a technology for quickly reading database data into GPU video memory. Background Art

[0002] Currently, Nvidia GPUs are able to provide high data parallel computing capabilities. GPU Direct Storage enables the GPU to read files directly without going through the CPU. This direct access greatly reduces data transmission latency, improves data reading speed and overall system performance. However, when faced with the need to retrieve data from a database, GPU Direct Storage does not provide a corresponding solution.

[0003] As an open source library, Rapids CUDF provides a wealth of data processing functions and can efficiently process data on the GPU. CUDF supports reading multiple file formats, including CSV, Parquet, JSON, ORC, and AVRO. These files can be directly loaded into the GPU memory to form a DataFrame, thereby utilizing the parallel computing capabilities of the GPU for data processing.

[0004] However, CUDF currently does not support reading data directly from the database. Users need to first read the data from the database into the CPU memory, and then use CUDF to copy the data to the GPU memory. This process often occupies too much CPU memory, which not only limits the amount of data that can be processed, but also may cause problems such as memory overflow. In addition, the CPU transmits the data after reading it, resulting in low processing and transmission performance. At the same time, the transmission process will also bring additional overhead, reduce the overall performance of the system, and increase processing time. Summary of the invention

[0005] The purpose of each embodiment of the present disclosure is to provide a method, apparatus, device, computer program product and computer program storage medium for reading database data into GPU video memory.

[0006] According to one aspect of the present disclosure, a method for reading database data into a GPU memory is provided, wherein the method comprises the following steps:

[0007] Continuously read target data from the database into the CPU's memory;

[0008] The method further comprises the following steps:

[0009] When a portion of the target data begins to be read in the memory of the CPU, the read data in the memory of the CPU is copied to the GPU memory to obtain a first data set;

[0010] Continue to copy subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set, and merge the second data set into the first data set; repeat the above operation until the target data is completely read from the database.

[0011] According to some embodiments, the step of obtaining the first data set specifically includes: when a portion of the target data begins to be read in the CPU's memory, calling the data input interface corresponding to the connection method supported by the database, and copying the read data in the CPU's memory to the GPU memory to obtain the first data set.

[0012] In some examples, the database is a row-based database that supports a JDBC connection mode, and a corresponding data input interface is used to create a CUDF DataFrame object.

[0013] In some examples, the database is a column-store database that supports an ADBC ​​connection mode, and a corresponding data input interface is used to convert an Arrow Table object into a CUDF DataFrame object.

[0014] According to some embodiments, the step of merging the second data set into the first data set specifically includes: calling a data merging interface to merge the second data set into the first data set, and the data merging interface is used to splice multiple objects by row or column to generate a new merged object.

[0015] According to some embodiments, the memory of the CPU stores the target data read from the database in a non-serialized manner.

[0016] According to one aspect of the present disclosure, there is also provided a device for reading database data into a GPU display memory, wherein the device comprises:

[0017] means for continuously reading target data from a database into a memory of a CPU;

[0018] When a portion of the target data begins to be read in the memory of the CPU, the device copies the read data in the memory of the CPU to the display memory of the GPU to obtain a first data set;

[0019] A device for continuing to copy subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set; a device for merging the second data set into the first data set; the above two devices repeatedly perform their respective operations until the target data is read from the database.

[0020] According to one aspect of the present disclosure, a device for reading database data into a GPU display memory is also provided, wherein the device includes a processor and a memory, the memory includes computer executable instructions, and when the computer executable instructions are executed by the processor, the device is configured to perform the following operations:

[0021] Continuously read target data from the database into the CPU's memory;

[0022] Among other things, the device is further configured to perform the following operations:

[0023] When a portion of the target data begins to be read in the memory of the CPU, the read data in the memory of the CPU is copied to the GPU memory to obtain a first data set;

[0024] Continue to copy subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set, and merge the second data set into the first data set; repeat the above operation until the target data is completely read from the database.

[0025] According to one aspect of the present disclosure, a computer program product for reading database data into a GPU display memory is also provided, comprising computer program instructions, wherein when the computer program instructions are executed by a computer device, the computer device is configured to perform the following operations:

[0026] Continuously read target data from the database into the CPU's memory;

[0027] The computer device is further configured to perform the following operations:

[0028] When a portion of the target data begins to be read in the memory of the CPU, the read data in the memory of the CPU is copied to the GPU memory to obtain a first data set;

[0029] Continue to copy subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set, and merge the second data set into the first data set; repeat the above operation until the target data is completely read from the database.

[0030] According to one aspect of the present disclosure, a computer program storage medium is further provided, wherein a computer executable instruction for reading database data into a GPU display memory is stored. When the computer executable instruction is executed by a computer device, the computer device is configured to perform the following operations:

[0031] Continuously read target data from the database into the CPU's memory;

[0032] The computer device is further configured to perform the following operations:

[0033] When a portion of the target data begins to be read in the memory of the CPU, the read data in the memory of the CPU is copied to the GPU memory to obtain a first data set;

[0034] Continue to copy subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set, and merge the second data set into the first data set; repeat the above operation until the target data is completely read from the database.

[0035] The embodiments of the present disclosure provide a solution for quickly reading database data into GPU memory based on Rapids-CUDF, which can support different types of databases and transfer the data in the database to GPU memory via CPU serialization-free. This allows data from various types of databases to be quickly read into NVIDIA GPU memory without serialization and formed into Rapids-CUDF DataFrame or Series format, thus preparing for subsequent CUDF data science computing and CUML library machine learning development. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0037] Figure 1 A flow chart of a method for reading database data into GPU display memory according to an embodiment of the present disclosure is shown;

[0038] Figure 2 A schematic diagram of an architecture for reading database data into GPU display memory according to an embodiment of the present disclosure is shown;

[0039] Figure 3 A schematic diagram of a device for reading database data into GPU display memory according to an embodiment of the present disclosure is shown.

[0040] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0041] The specific embodiments of the present disclosure will be further described below in conjunction with the accompanying drawings.

[0042] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments of the present disclosure are described as devices represented by block diagrams and processes or methods represented by flow charts. Although the flow charts describe the operating processes of the various embodiments of the present disclosure as sequential processing, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. The processes of the various embodiments of the present disclosure can be terminated when their operations are completed, but can also include additional steps not shown in the flow charts. The processes of the various embodiments of the present disclosure can correspond to methods, functions, procedures, subroutines, subprograms, etc.

[0043] The methods illustrated by the flow charts and the devices illustrated by the block diagrams discussed below may be implemented by hardware, software, firmware, middleware, microcode, hardware description language, or any combination thereof. When implemented in software, firmware, middleware, or microcode, the program code or code segments that perform the necessary tasks may be stored in a machine or computer readable medium such as a storage medium. (One or more) processors may perform the necessary tasks.

[0044] Similarly, it will also be understood that any flow charts, flow diagrams, state transition diagrams, and the like represent various processes that can be fully described as program code stored in a computer readable medium and thereby executed by a computer device or processor, whether or not such computer device or processor is explicitly shown.

[0045] As used herein, the term "storage medium" may refer to one or more devices for storing data, including read-only memory (ROM), random access memory (RAM), magnetic RAM, kernel memory, magnetic disk storage media, optical storage media, flash memory devices and / or other machine-readable media for storing information. The term "computer-readable medium" may include, but is not limited to, portable or fixed storage devices, optical storage devices, and various other media capable of storing and / or containing instructions and / or data.

[0046] A code segment may represent a procedure, function, subprogram, program, routine, subroutine, module, software package, class, or any combination of instructions, data structures, or program descriptions. A code segment may be coupled to another code segment or hardware circuit by passing and / or receiving information, data, arguments, parameters, or storage contents. Information, arguments, parameters, data, etc. may be passed, forwarded, or transmitted via any suitable means including storage sharing, information passing, token passing, network transmission, etc.

[0047] The "computer device" referred to in this context refers to an electronic device that can perform predetermined processing procedures such as numerical calculations and / or logical calculations by running predetermined programs or instructions, and may include at least a processor and a memory, wherein the processor executes program instructions pre-stored in the memory to perform the predetermined processing process, or the predetermined processing process is performed by hardware such as ASIC, FPGA, DSP, or a combination of the above two.

[0048] The above-mentioned "computer device" is usually expressed in the form of a general-purpose computer device, and its components may include but are not limited to: one or more processors or processing units, system memory. The system memory may include a computer-readable medium in the form of a volatile memory, such as a random access memory (RAM) and / or a cache memory. The "computer device" may further include other removable / non-removable, volatile / non-volatile computer-readable storage media. The memory may include at least one computer program product having a set (e.g., at least one) of program modules that are configured to perform the functions and / or methods of the various embodiments of the present disclosure. The processor executes various functional applications and data processing by running the program stored in the memory.

[0049] For example, a computer program for executing various functions and processes of multiple embodiments of the present disclosure is stored in the memory, and when the processor executes the corresponding computer program, multiple embodiments of the present disclosure are implemented.

[0050] Typically, a computer device may be, for example, a user device or a network device, or even a combination of the two. The user device includes, but is not limited to, a personal computer (PC), a laptop, a mobile terminal, etc. The mobile terminal includes, but is not limited to, a smart phone, a tablet computer, etc. The network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of computers or network servers based on cloud computing (Cloud Computing), wherein cloud computing is a type of distributed computing, a super virtual computer consisting of a group of loosely coupled computer sets. The computer device may be run alone to implement the various embodiments of the present disclosure, or may be connected to a network and implement the various embodiments of the present disclosure through interactive operations with other computer devices in the network. The network in which the computer device is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a VPN network, etc.

[0051] It should be noted that the user equipment, network equipment and network are only examples. Other existing or future computing devices or networks that are applicable to the embodiments of the present disclosure should also be included in the scope of protection of the present disclosure and are included here by reference.

[0052] The specific structural and functional details disclosed herein are merely representative and are for the purpose of describing exemplary embodiments of the present disclosure. However, the various embodiments of the present disclosure may be implemented in many alternative forms and should not be interpreted as being limited to only the embodiments set forth herein.

[0053] It should be understood that, although the terms "first", "second", etc. may be used herein to describe various units, these units should not be limited by these terms. These terms are used only to distinguish one unit from another unit. For example, without departing from the scope of the exemplary embodiments, the first unit may be referred to as the second unit, and similarly the second unit may be referred to as the first unit. The term "and / or" used herein includes any and all combinations of one or more of the listed associated items.

[0054] The terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments. Unless the context clearly indicates otherwise, the singular forms "one", "one" and "item" used herein are also intended to include plural numbers. It should also be understood that the terms "include" and / or "comprise" used herein specify the existence of stated features, integers, steps, operations, units and / or components, without excluding the existence or addition of one or more other features, integers, steps, operations, units, components and / or combinations thereof.

[0055] It should also be noted that, in some alternative implementations, the functions / actions mentioned may occur in a different order than that indicated in the accompanying drawings. For example, depending on the functions / actions involved, two figures shown in succession may actually be performed substantially simultaneously or may sometimes be performed in the reverse order.

[0056] The following is an explanation of the relevant terms involved in this disclosure:

[0057] Rapids-CUDF: Rapids is an open source computing framework provided by NVIDIA that uses NVIDIA GPUs for high-speed data science computing and machine learning. CUDF is a data science computing library under the Rapids framework, and its interface is similar to the pandas API.

[0058] Rapids CUDF is a GPU-based open source library designed to provide high-performance data processing capabilities. It uses the parallel computing capabilities of NVIDIA GPUs to accelerate data operations on large data sets and supports multiple data formats such as CSV, Parquet, JSON, ORC, and AVRO. CUDF's goal is to provide an API similar to Pandas, allowing data scientists and engineers to easily port data processing tasks to the GPU, thereby significantly improving data processing speed.

[0059] Arrow: Apache Arrow defines a columnar format for representing tabular data in memory. Apache Arrow is a cross-platform in-memory data format designed for high-performance analytical applications that can efficiently represent tabular data. Its main feature is the use of a columnar format, which has significant advantages in the fields of data science and big data processing.

[0060] Some interface information of CUDF is as follows:

[0061] The DataFrame constructor implementation of CUDF supports the method of passing memory data. Constructor interface:

[0062] Data input interface 1:

[0063] class cudf.DataFrame(data=None, index=None, columns=None, dtype=None,nan_as_null=True)

[0064] A GPU Dataframe object.

[0065] Data: array-like, Iterable, dict, or DataFrame.

[0066] Dict can contain Series, arrays, constants, or list-like objects.

[0067] The first parameter Data can pass a python list object.

[0068] cudf.DataFrame is a class for creating and manipulating data frame objects on the GPU, similar to PandasDataFrame, but designed for GPU acceleration.

[0069] The parameter Data is the main source of data input and can be a variety of data structures.

[0070] array-like: objects similar to NumPy arrays or other objects supporting the array interface.

[0071] Iterable: Any data structure that can be iterated, such as lists, tuples, etc.

[0072] dict: A dictionary where the keys are column names and the values ​​are column data. Values ​​can be Series, arrays, constants, or list-like objects.

[0073] DataFrame: You can directly pass another cudf.DataFrame or pandas.DataFrame to convert.

[0074] Data input interface 2:

[0075] Classmethod DataFrame.from_arrow(table)

[0076] Convert from PyArrow Table to DataFrame.

[0077] Parameters:

[0078] Table: PyArrow Table Object

[0079] PyArrow Table Object which has to be converted to cudf DataFrame.

[0080] Returns:

[0081] cudf DataFrame

[0082] cudf.DataFrame.from_arrow is a class method used to convert a PyArrow table object to a CUDF DataFrame object. PyArrow is a cross-language in-memory data format that is widely used for high-performance data analysis. Using this interface, you can easily transfer data that already exists in a PyArrow table to a CUDFDataFrame for accelerated computing on the GPU.

[0083] The only parameter table must be a PyArrow Table object. PyArrow Table is a format for representing column-stored table data in memory, with efficient storage and access characteristics.

[0084] Return value cudf.DataFrame: This method returns a CUDF DataFrame object containing the data converted from the PyArrow table. The converted data can be efficiently processed and calculated on the GPU.

[0085] Data merging interface 3:

[0086] cudf.concat(objs, axis=0, join='outer',ignore_index=False, sort=None)

[0087] Concatenate DataFrames, Series, or Indices row-wise.

[0088] Parameters:

[0089] Objs: list of DataFrame, Series, or Index

[0090] Axis: {0 / 'index', 1 / 'columns'}, default 0

[0091] The axis to concatenate along.

[0092] Join: {'inner', 'outer'}, default 'outer'

[0093] How to handle indexes on other axis (or axes).

[0094] ignore_index:bool, default False

[0095] Set True to ignore the index of the objs and provide a default rangeindex instead.

[0096] Sort: bool, default False

[0097] Sortnon-concatenation axis if it is not already aligned.

[0098] Returns:

[0099] A new object of like type with rows from each object inobjs.

[0100] cudf.concat is a function used to merge multiple DataFrame, Series, or Index objects by row (or column). This interface is similar to the concat method of Pandas and is designed to provide efficient data concatenation operations on the GPU.

[0101] Explanation of relevant parameters:

[0102] objs:

[0103] Type: List

[0104] The list contains the objects to be merged, which can be DataFrame, Series or Index.

[0105] axis: {0 / 'index', 1 / 'columns'}, default value is 0

[0106] The merged axis.

[0107] 0 or 'index': merge by rows (vertical concatenation).

[0108] 1 or 'columns': merge by columns (horizontally concatenate).

[0109] join: {'inner', 'outer'}, default value is 'outer'

[0110] How to handle indexes when merging.

[0111] 'outer': outer join, keep all indexes.

[0112] 'inner': Inner join, only common indexes are retained.

[0113] ignore_index: bool, default value is False

[0114] Whether to ignore the index of the input object.

[0115] True: Ignore the index and generate a default RangeIndex.

[0116] False: Preserve the index of the input object.

[0117] sort: bool, default value is False

[0118] Whether to sort non-tie axes (only applies if the tie axes are not aligned).

[0119] True: sort the non-joined axes.

[0120] False: Do not sort.

[0121] Return Value

[0122] Return type: A new merged object of the same type as the input objects. Contains the data for each object in the objs list.

[0123] The CUDF interface supports the method of transferring files from Python CPU memory to GPU memory. However, there are the following problems:

[0124] When using the data input interface 1, it is often necessary to read the complete amount of database data in the CPU memory before transferring it to the GPU memory, which not only wastes CPU memory but also takes too long to get to the GPU memory.

[0125] When using data input interface 2, in addition to the above-mentioned problems of using data input interface 1, if the read database data is serialized into Arrow format in the CPU, the CPU resources consumed will also be very serious.

[0126] See also Figure 1 , which shows a process for reading database data into GPU display memory according to an embodiment of the present disclosure.

[0127] Related References Figure 1 and Figure 2 In step S10, the computer device continuously reads the target data from the database into the memory of the CPU; in step S21, when the computer device has read a part of the target data into the memory of the CPU, the computer device copies the read data in the memory of the CPU to the GPU memory to obtain a first data set; in step S31, the computer device continues to copy the subsequent part of the target data from the memory of the CPU to the GPU memory to obtain a second data set, and merges the second data set into the first data set; in step S32, the computer device repeats the operation of the aforementioned step S31 until the target data is completely read from the database.

[0128] Here, each embodiment of the present disclosure is executed by a computer device or a data reading module deployed in the computer device.

[0129] Specifically, in step S10, the computer device continuously reads target data from the database into the memory of the CPU.

[0130] When the upstream database is a traditional row-based database, it supports JDBC connection. The computer device continuously reads DB data to the CPU and stores it in a circular queue. No serialization occurs in this process.

[0131] When the upstream database is a column-based database, it supports ADBC ​​connection mode. The computer device continuously reads DB data to the CPU and stores it in the Arrow Table. This process also does not involve serialization.

[0132] Here, the memory uses appropriate data structures to store the data read from the database without serialization.

[0133] It should be noted that those skilled in the art should understand that step S10 is independent of step S21 and steps S31 - S32 , and the CPU will continue to read data from the DB until all target data is read.

[0134] In step S21, when a portion of the target data begins to be read from the memory of the CPU, the computer device copies the read data in the memory of the CPU to the GPU memory to obtain a first data set.

[0135] For the data in the row storage database, the CPU creates a circular queue and directly puts the data read from the DB into the circular queue. When there is data in the initial circular queue, the computer device calls the data input interface 1, which is used to create a CUDF DataFrame object, thereby copying the data currently read by the CPU (that is, the data in the initial circular queue) from the memory to the GPU memory, forming the first data set in the GPU memory, marked as DataFrame1.

[0136] For data in the column-stored database, the CPU creates an Arrow Table and directly puts the data read from the DB into the Arrow Table. When there is data in the initial Arrow Table, the computer device calls data input interface 2, which is used to convert the Arrow Table object into a CUDF DataFrame object, thereby copying the data currently read by the CPU (that is, the data in the initial Arrow Table) from the memory to the GPU memory, forming the first data set in the GPU memory, marked as DataFrame1.

[0137] In step S31, the computer device continues to copy subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set, and merges the second data set into the first data set; in step S32, the computer device repeats the operation of the aforementioned step S31 until the target data is read from the database. At this point, the GPU obtains the final first data set after multiple mergers.

[0138] For a row-stored database, the CPU continuously reads data from the DB through a JDBC connection and writes it into a circular queue. Therefore, after obtaining the first data set DataFrame1 in step S21, the computer device continues to call the data input interface 1 in step S31 to copy the newly added data in the circular queue from the memory to the GPU memory, forming a second data set in the GPU memory, which is marked as DataFrame2.

[0139] Next, the computer device calls the data merging interface 3 to merge the second data set DataFrame2 into the first data set DataFrame1. The interface 3 is used to concatenate multiple DataFrame and Series objects by row or column to generate a new merged object. DataFrame1 = cudf.concat([DataFrame1, DataFrame2]).

[0140] After the merging operation is completed, the process returns to step S31, and the computer device continues to call the data input interface 1 to copy the newly added data in the circular queue from the CPU memory to the GPU memory, forming a new second data set DataFrame2 in the GPU memory. Then, the computer device calls the data merging interface 3 to merge the new DataFrame2 into DataFrame1. This process is repeated until the target data is read from the row storage database.

[0141] For a column-based database, the CPU continuously reads data from the DB through an ADBC ​​connection and writes it into the Arrow Table. Therefore, after obtaining the first data set DataFrame1 in step S21, the computer device continues to call the data input interface 2 in step S31 to copy the newly added data in the Arrow Table from the memory to the GPU memory, forming a second data set in the GPU memory, which is marked as DataFrame2.

[0142] Next, the computer device calls the data merging interface 3 to merge the second data set DataFrame2 into the first data set DataFrame1, DataFrame1 = cudf.concat([DataFrame1, DataFrame2]).

[0143] After the merging operation is completed, the process returns to step S31, and the computer device continues to call data input interface 2 to copy the newly added data in Arrow Table from CPU memory to GPU memory, forming a new second data set DataFrame2 in GPU memory. Then, the computer device calls data merging interface 3 to merge the new DataFrame2 into DataFrame1. This process is repeated until the target data is read from the column storage database.

[0144] It should be noted that those skilled in the art should be able to understand that step S21 is independent of steps S31-S32, and the first data set DataFrame1 generated by step S21 is used as a parent data set, and is updated by continuously merging with the new second data set DataFrame2 newly generated each time by S31 until all the target data are read, thereby obtaining the final first data set DataFrame1.

[0145] In the above steps S21 and S31-S32, the CPU is only involved in memory copying, that is, from CPU memory to GPU memory, and serialization occurs in the GPU, provided by the CUDF operator. Therefore, the CPU can transfer DB data to the GPU memory without serialization. The method of reading, transmitting and serializing (occurring in the GPU) greatly improves the transmission efficiency compared to reading in the CPU memory and then transferring to the GPU memory.

[0146] See also Figure 2 , which shows a schematic diagram of an apparatus for reading database data according to an embodiment of the present disclosure.

[0147] Figure 2 The data reading device 20 shown can be arranged in a computer device, and can be an independent functional module. Figure 2 As shown, the data reading device 20 includes a memory reading device 21 , a first GPU copying device 22 , a second GPU copying device 23 and a data merging device 24 .

[0148] like Figure 2As shown, the memory reading device 21 continuously reads the target data from the database into the memory of the CPU; when a part of the target data begins to be read in the memory of the CPU, the first GPU copying device 22 copies the read data in the memory of the CPU to the GPU video memory to obtain a first data set; the second GPU copying device 23 continues to copy the subsequent part of the target data from the memory of the CPU to the GPU video memory to obtain a second data set, and the data merging device 24 merges the second data set into the first data set; the second GPU copying device 23 and the data merging device 24 repeatedly perform their respective aforementioned operations until the target data is completely read from the database.

[0149] It should be noted that the various embodiments of the present disclosure may be implemented in software and / or a combination of software and hardware, for example, may be implemented using an application specific integrated circuit (ASIC), a general purpose computer, or any other similar hardware device. In one embodiment, the software program of the various embodiments of the present disclosure may be executed by a processor to implement the steps or functions described above. Similarly, the software program of the various embodiments of the present disclosure (including related data structures) may be stored in a computer-readable recording medium, such as a RAM memory, a magnetic or optical drive, or a floppy disk and the like. In addition, some steps or functions of the various embodiments of the present disclosure may be implemented using hardware, for example, as a circuit that cooperates with a processor to perform various steps or functions.

[0150] In addition, at least a portion of the embodiments of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computing device, can call or provide the method and / or technical solution according to the embodiments of the present disclosure through the operation of the computing device. The program instruction for calling / providing the method of the embodiments of the present disclosure may be stored in a fixed or removable recording medium, and / or transmitted through a data stream in a broadcast or other signal-bearing medium, and / or stored in a working memory of a computing device that runs according to the program instruction.

[0151] For those skilled in the art, it is obvious that the embodiments of the present disclosure are not limited to the details of the above exemplary embodiments, and the embodiments of the present disclosure can be implemented in other specific forms without departing from the spirit or basic features of the embodiments of the present disclosure. Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the embodiments of the present disclosure is limited by the attached claims rather than the above description, so it is intended to include all changes within the meaning and scope of the equivalent elements of the claims in the embodiments of the present disclosure. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "including" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.

Claims

1. A method for reading database data into GPU memory, wherein: The method comprises the following steps: Continuously read target data from the database into the CPU's memory; Wherein, when the database is a row-stored database, the target data is continuously read to the CPU and stored in a circular queue without serialization; Wherein, when the database is a column-stored database, the target data is continuously read to the CPU and stored in the Arrow table without serialization; The method further comprises the following steps: When a portion of the target data begins to be read in the memory of the CPU, the read data in the memory of the CPU is copied to the GPU memory to obtain a first data set; Continue to copy subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set, and merge the second data set into the first data set; repeat the operation of obtaining the second data set and merging it into the first data set until the target data is completely read from the database; Wherein, for the target data in the row storage database, the target data is copied from the CPU memory to the GPU memory through a first interface, and the first interface is used to create a CUDF DataFrame object; Among them, for the target data in the column storage database, the target data is copied from the CPU memory to the GPU video memory through the second interface, and the second interface is used to convert the Arrow table object into a CUDF DataFrame object.

2. The method according to claim 1, wherein: The step of obtaining the first data set specifically includes: When a portion of the target data begins to be read into the CPU memory, the data input interface corresponding to the connection method supported by the database is called to copy the read data in the CPU memory to the GPU memory to obtain the first data set.

3. The method according to claim 2, wherein: The database is a row-based database that supports JDBC connection mode, and the corresponding data input interface is used to create a CUDF DataFrame object.

4. The method according to claim 2, wherein: The database is a column-store database that supports ADBC ​​connection mode. The corresponding data input interface is used to convert Arrow Table objects into CUDF DataFrame objects.

5. The method according to claim 1, wherein: The step of merging the second data set into the first data set specifically includes: A data merging interface is called to merge the second data set into the first data set, wherein the data merging interface is used to splice multiple objects by row or by column to generate a new merged object.

6. A device for reading database data into GPU memory, wherein: The device includes: means for continuously reading target data from a database into a memory of a CPU; Wherein, when the database is a row-stored database, the target data is continuously read to the CPU and stored in a circular queue without serialization; Wherein, when the database is a column-stored database, the target data is continuously read to the CPU and stored in the Arrow table without serialization; When a portion of the target data begins to be read in the memory of the CPU, the device copies the read data in the memory of the CPU to the display memory of the GPU to obtain a first data set; A device for continuously copying subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set; a device for merging the second data set into the first data set; the two devices repeatedly perform the operations of obtaining the second data set and merging it into the first data set until the target data is completely read from the database; Wherein, for the target data in the row storage database, the target data is copied from the CPU memory to the GPU memory through a first interface, and the first interface is used to create a CUDF DataFrame object; Among them, for the target data in the column storage database, the target data is copied from the CPU memory to the GPU video memory through the second interface, and the second interface is used to convert the Arrow table object into a CUDF DataFrame object.

7. A device for reading database data into GPU memory, wherein: The device comprises a processor and a memory, the memory comprising computer executable instructions, and when the computer executable instructions are executed by the processor, the device is configured to perform the following operations: Continuously read target data from the database into the CPU's memory; Wherein, when the database is a row-stored database, the target data is continuously read to the CPU and stored in a circular queue without serialization; Wherein, when the database is a column-stored database, the target data is continuously read to the CPU and stored in the Arrow table without serialization; Among other things, the device is further configured to perform the following operations: When a portion of the target data begins to be read in the memory of the CPU, the read data in the memory of the CPU is copied to the GPU memory to obtain a first data set; Continue to copy subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set, and merge the second data set into the first data set; repeat the operation of obtaining the second data set and merging it into the first data set until the target data is completely read from the database; Wherein, for the target data in the row storage database, the target data is copied from the CPU memory to the GPU memory through a first interface, and the first interface is used to create a CUDF DataFrame object; Among them, for the target data in the column storage database, the target data is copied from the CPU memory to the GPU video memory through the second interface, and the second interface is used to convert the Arrow table object into a CUDF DataFrame object.

8. A computer program product for reading database data into GPU memory, comprising computer program instructions, wherein: When the computer program instructions are executed by a computer device, the computer device is configured to perform the following operations: Continuously read target data from the database into the CPU's memory; Wherein, when the database is a row-stored database, the target data is continuously read to the CPU and stored in a circular queue without serialization; Wherein, when the database is a column-stored database, the target data is continuously read to the CPU and stored in the Arrow table without serialization; The computer device is further configured to perform the following operations: When a portion of the target data begins to be read in the memory of the CPU, the read data in the memory of the CPU is copied to the GPU memory to obtain a first data set; Continue to copy subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set, and merge the second data set into the first data set; repeat the operation of obtaining the second data set and merging it into the first data set until the target data is completely read from the database; Wherein, for the target data in the row storage database, the target data is copied from the CPU memory to the GPU memory through a first interface, and the first interface is used to create a CUDF DataFrame object; Among them, for the target data in the column storage database, the target data is copied from the CPU memory to the GPU video memory through the second interface, and the second interface is used to convert the Arrow table object into a CUDF DataFrame object.

9. A computer program storage medium storing computer executable instructions for reading database data into GPU memory, wherein when the computer executable instructions are executed by a computer device, the computer device is configured to perform the following operations: Continuously read target data from the database into the CPU's memory; in, When the database is a row-stored database, the target data is continuously read to the CPU and stored in a circular queue without serialization; Wherein, when the database is a column-stored database, the target data is continuously read to the CPU and stored in the Arrow table without serialization; The computer device is further configured to perform the following operations: When a portion of the target data begins to be read in the memory of the CPU, the read data in the memory of the CPU is copied to the GPU memory to obtain a first data set; Continue to copy subsequent parts of the target data from the CPU memory to the GPU memory to obtain a second data set, and merge the second data set into the first data set; repeat the operation of obtaining the second data set and merging it into the first data set until the target data is completely read from the database; Wherein, for the target data in the row storage database, the target data is copied from the CPU memory to the GPU memory through a first interface, and the first interface is used to create a CUDF DataFrame object; Among them, for the target data in the column storage database, the target data is copied from the CPU memory to the GPU video memory through the second interface, and the second interface is used to convert the Arrow table object into a CUDF DataFrame object.

Citation Information

Patent Citations

  • Parallel time sequence mining method based on GPU

    CN103995690A

  • Data processing acceleration apparatus

    KR102691864B1