[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN112364053B - Search optimization method and device, electronic equipment and storage medium - Google Patents

Search optimization method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112364053B
CN112364053B CN202011342743.9A CN202011342743A CN112364053B CN 112364053 B CN112364053 B CN 112364053B CN 202011342743 A CN202011342743 A CN 202011342743A CN 112364053 B CN112364053 B CN 112364053B
Authority
CN
China
Prior art keywords
queried
statement
code
compiling
compiler
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011342743.9A
Other languages
Chinese (zh)
Other versions
CN112364053A (en
Inventor
周宝舟
廖强
黄志龙
王耀华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Jiahua Chain Cloud Technology Co ltd
Original Assignee
Chengdu Jiahua Chain Cloud Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Jiahua Chain Cloud Technology Co ltd filed Critical Chengdu Jiahua Chain Cloud Technology Co ltd
Priority to CN202011342743.9A priority Critical patent/CN112364053B/en
Publication of CN112364053A publication Critical patent/CN112364053A/en
Application granted granted Critical
Publication of CN112364053B publication Critical patent/CN112364053B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a search optimization method, a search optimization device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a statement to be queried; analyzing and compiling a pre-parsed data structure and sentences to be queried by using a domain specific language DSL compiler to obtain a target language code; compiling the target language code by using a Compute Unified Device Architecture (CUDA) compiler to obtain an executable program; and running the executable program by using the graphic processing unit, and searching the query result corresponding to the statement to be queried. In the implementation process, by utilizing the technical principle that the GPU can accelerate media data operation, and then analyzing and compiling the input statement to be queried into an executable program which can be executed by the GPU through the DSL compiler and the CUDA compiler, the speed and instantaneity of media data operation and search by the GPU are effectively improved, and therefore media data search in real time is realized.

Description

Search optimization method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical fields of search optimization, image video processing and code compiling, in particular to a search optimization method, a search optimization device, electronic equipment and a storage medium.
Background
In the current search industry, a traditional search engine can search massive texts and pictures associated with the texts by segmenting the texts and then establishing an inverted index according to the segmentation result; the conventional search engine herein includes: elastiscearch and Lucene, and the like; the elastiscearch is a distributed, high-expansion, high-real-time search and data analysis engine, and is also a distributed multi-user full-text search engine. In a particular course of practice, it has been found that it is difficult for conventional search engines to search for media data in direct real-time, where the media data includes: pictures, video and audio, etc.
Disclosure of Invention
The embodiment of the application aims to provide a search optimization method, a search optimization device, electronic equipment and a storage medium, which are used for solving the problem that a traditional search engine is difficult to search media data directly in real time.
The embodiment of the application provides a search optimization method, which comprises the following steps: acquiring a statement to be queried; analyzing and compiling a pre-parsed data structure and sentences to be queried by using a domain specific language DSL compiler to obtain a target language code; compiling the target language code by using a Compute Unified Device Architecture (CUDA) compiler to obtain an executable program; and running the executable program by using the graphic processing unit, and searching the query result corresponding to the statement to be queried. In the implementation process, firstly, a domain-specific language DSL compiler is used for analyzing and compiling a pre-analyzed data structure and sentences to be queried to obtain a target language code; compiling the target language code by using a CUDA compiler of a computing unified device architecture which is introduced by a display card manufacturer to obtain an executable program; running an executable program by using a Graphic Processing Unit (GPU), and searching a query result corresponding to a statement to be queried; that is, by utilizing the technical principle that the GPU can accelerate the operation of media data, and then analyzing and compiling the input statement to be queried into an executable program which can be executed by the GPU through the DSL compiler and the CUDA compiler, the speed and instantaneity of performing the operation and search of media data by using the GPU are effectively improved, so that the real-time search of media data is realized.
Optionally, in an embodiment of the present application, acquiring a statement to be queried includes: acquiring query parameters and media data; and generating a statement to be queried according to the query parameters and the media data. In the implementation process, query parameters and media data are acquired; generating a statement to be queried according to the query parameters and the media data; therefore, the situation that a professional GPU engineer writes CUDA codes to realize face image retrieval or vehicle feature retrieval is avoided, the speed of retrieving face images or vehicle features by a common user is higher, and retrieval difficulty in scenes such as face image retrieval or vehicle feature retrieval is effectively reduced.
Optionally, in the embodiment of the present application, searching the query result corresponding to the statement to be queried includes: acquiring media data from a sentence to be queried, and converting the media data into a vector to be queried; searching media data with highest similarity of vectors to be queried in a media vector database; and generating a query result according to the query parameters and the media data with the highest similarity. In the implementation process, the media data is acquired from the statement to be queried and is converted into the vector to be queried; searching media data with highest similarity of vectors to be queried in a media vector database; generating a query result according to the query parameters and the media data with the highest similarity; therefore, the speed of searching the face image or the vehicle characteristic of the common user is higher, and the searching difficulty in the scenes such as the face image searching or the vehicle characteristic searching is effectively reduced.
Optionally, in an embodiment of the present application, before analyzing and compiling the pre-parsed data structure and the sentence to be queried using the domain-specific language DSL compiler, the method further includes: acquiring a first intermediate representation code corresponding to the data model; the first intermediate representation code is loaded and parsed using a DSL compiler to obtain a data structure. In the implementation process, a first intermediate representation code corresponding to the data model is obtained; loading and analyzing the first intermediate representation code by using a DSL compiler to obtain a data structure; because the layout of the data structure in the GPU memory has great influence on the performance of GPU calculation, even tens of times of performance difference between using the data structure and not using the data model, loading and analyzing the first intermediate representation code through the DSL compiler to obtain the data structure; therefore, the business personnel only need to describe the data model, and do not need to pay attention to the layout of a specific data structure, and the DSL compiler can calculate the layout of the optimal data structure according to the data model; therefore, service personnel do not need to pay attention to the layout of a specific data structure, and the retrieval difficulty in scenes such as face image retrieval or vehicle feature retrieval is effectively reduced.
Optionally, in an embodiment of the present application, analyzing and compiling the pre-parsed data structure and the statement to be queried using a domain-specific language DSL compiler includes: acquiring a second intermediate representation code corresponding to the statement to be queried; analyzing and compiling the first intermediate representation code by using a DSL compiler to obtain a target language code of the data model; and analyzing and compiling the first intermediate representation code and the second intermediate representation code by using a DSL compiler to obtain the target language code of the sentence to be queried. In the implementation process, a second intermediate representation code corresponding to the statement to be queried is obtained; analyzing and compiling the first intermediate representation code by using a DSL compiler to obtain a target language code of the data model; analyzing and compiling the first intermediate representation code and the second intermediate representation code by using a DSL compiler to obtain a target language code of the sentence to be queried; therefore, service personnel do not need to pay attention to the layout of a specific data structure, and the retrieval difficulty in scenes such as face image retrieval or vehicle feature retrieval is effectively reduced.
Optionally, in an embodiment of the present application, compiling the target language code using a compute unified device architecture CUDA compiler includes: and compiling the target language codes of the data model and the target language codes of the sentences to be queried by using a Compute Unified Device Architecture (CUDA) compiler. In the implementation process, compiling the target language code of the data model and the target language code of the statement to be queried by using a Compute Unified Device Architecture (CUDA) compiler; therefore, the situation that a professional GPU engineer writes CUDA codes to realize face image retrieval or vehicle feature retrieval is avoided, the speed of retrieving face images or vehicle features by a common user is higher, and retrieval difficulty in scenes such as face image retrieval or vehicle feature retrieval is effectively reduced.
Optionally, in an embodiment of the present application, acquiring a statement to be queried includes: acquiring a statement to be queried sent by terminal equipment; after searching the query result corresponding to the statement to be queried, the method further comprises the following steps: and sending a query result corresponding to the statement to be queried to the terminal equipment. In the implementation process, the statement to be queried sent by the terminal equipment is obtained; after searching the query results corresponding to the sentences to be queried, the query results corresponding to the sentences to be queried are also sent to the terminal equipment; therefore, the query function in scenes such as face image retrieval or vehicle feature retrieval is realized, and the terminal equipment can obtain the query result corresponding to the statement to be queried more quickly.
The embodiment of the application also provides a search optimizing device, which comprises: the query sentence acquisition module is used for acquiring sentences to be queried; the target code obtaining module is used for analyzing and compiling a pre-analyzed data structure and sentences to be queried by using a domain specific language DSL compiler to obtain a target language code; the executable program obtaining module is used for compiling the target language code by using a Compute Unified Device Architecture (CUDA) compiler to obtain an executable program; and the query result searching module is used for running the executable program by using the graphic processing unit and searching the query result corresponding to the statement to be queried. In the implementation process, firstly, a domain-specific language DSL compiler is used for analyzing and compiling a pre-analyzed data structure and sentences to be queried to obtain a target language code; compiling the target language code by using a CUDA compiler of a computing unified device architecture which is introduced by a display card manufacturer to obtain an executable program; running an executable program by using a Graphic Processing Unit (GPU), and searching a query result corresponding to a statement to be queried; that is, by utilizing the technical principle that the GPU can accelerate the operation of media data, and then analyzing and compiling the input statement to be queried into an executable program which can be executed by the GPU through the DSL compiler and the CUDA compiler, the speed and instantaneity of performing the operation and search of media data by using the GPU are effectively improved, so that the real-time search of media data is realized.
Optionally, in an embodiment of the present application, the query statement obtaining module includes: the parameter data acquisition module is used for acquiring query parameters and media data; and the query statement generation module is used for generating a statement to be queried according to the query parameters and the media data.
Optionally, in an embodiment of the present application, the query result search module includes: the query vector conversion module is used for acquiring media data from the statement to be queried and converting the media data into a vector to be queried; the media data searching module is used for searching media data with highest similarity of the vector to be queried in the media vector database; and the query result generation module is used for generating a query result according to the query parameters and the media data with the highest similarity.
Optionally, in an embodiment of the present application, the search optimization device further includes: the first representation code acquisition module is used for acquiring a first intermediate representation code corresponding to the data model; and the data structure obtaining module is used for loading and analyzing the first intermediate representation code by using the DSL compiler to obtain the data structure.
Optionally, in an embodiment of the present application, the object code obtaining module includes: the second representation code acquisition module is used for acquiring a second intermediate representation code corresponding to the statement to be queried; the first code obtaining module is used for analyzing and compiling the first intermediate representation code by using the DSL compiler to obtain the target language code of the data model; and the second code obtaining module is used for analyzing and compiling the first intermediate representation code and the second intermediate representation code by using the DSL compiler to obtain the target language code of the statement to be queried.
Optionally, in an embodiment of the present application, the executing the program obtaining module includes: and the target code compiling module is used for compiling the target language codes of the data model and the target language codes of the sentences to be queried by using the CUDA compiler of the computing unified equipment architecture.
Optionally, in an embodiment of the present application, the search optimization device further includes: the query sentence acquisition module is used for acquiring a sentence to be queried sent by the terminal equipment; the query result sending module is used for sending a query result corresponding to the statement to be queried to the terminal equipment.
The embodiment of the application also provides electronic equipment, which comprises: a processor and a memory storing machine-readable instructions executable by the processor to perform the method as described above when executed by the processor.
The embodiments of the present application also provide a storage medium having stored thereon a computer program which, when executed by a processor, performs a method as described above.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a search optimization method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a data compiling process according to an embodiment of the present application;
FIG. 3 is a schematic flow chart of a process for providing a media data search service according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a search optimization device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
Before introducing the search optimization method provided by the embodiment of the application, some concepts related in the embodiment of the application are introduced:
Domain-Specific Language (DSL), which is translated into a Domain specific language, refers to a computer language that is focused on a particular application Domain.
Graphics processing units (Graphics Processing Unit, GPU), also known as video processing units (Video Processing Unit, VPU), display cores, vision processors, display chips, are a special type of processor, with hundreds or thousands of cores, optimized to run a large number of computations in parallel; the GPU may accelerate vector operations such as running analysis, deep learning, and machine learning algorithms, allowing some computations to be 10 to 100 times faster than running the same computation on a conventional CPU.
The unified computing architecture (Compute Unified Device Architecture, CUDA) is an integrated technology proposed by NVIDIA; CUDA is a general-purpose parallel computing architecture that enables GPUs to solve complex computing problems, and includes the CUDA Instruction Set Architecture (ISA) and a parallel computing engine internal to the GPU.
A relational database refers to a database that employs a relational model to organize data, the relational database storing data in rows and columns for ease of user understanding, the series of rows and columns of the relational database being referred to as a table.
The structured query language (Structured Query Language, SQL) is a special purpose programming language, also a database query and programming language, for accessing data and querying, updating and managing a relational database management system (Relational Database Management System, RDBMS) or processing in a relational stream data management system (RDSMS).
The non-relational database, also called NoSQL (Not Only SQL), means not only structured query language (Structured Query Language, SQL), but mainly divided into: three non-relational databases for column-oriented storage, document-oriented storage, and key-value pair storage.
It should be noted that, the search optimization method provided by the embodiment of the present application may be executed by an electronic device, where the electronic device refers to a device terminal or a server having a function of executing a computer program, where the device terminal is for example: smart phones, personal computers (personal computer, PCs), tablet computers, personal digital assistants (personal digital assistant, PDAs), mobile internet appliances (mobile Internet device, MIDs), network switches or network routers, and the like.
Before introducing the search optimization method provided by the embodiment of the application, application scenes suitable for the search optimization method are introduced, wherein the application scenes include but are not limited to: the search optimization method is used for optimizing the function of a traditional search engine for searching the media data or is used for enhancing the online search service function of the media data, wherein the search comprises but is not limited to searching image data or video data, and can also search audio data.
Please refer to fig. 1, which illustrates a flowchart of a search optimization method provided by an embodiment of the present application; the main idea of the search optimization method is that by utilizing the technical principle that the GPU can accelerate the operation of media data, and then analyzing and compiling the input statement to be queried into an executable program which can be executed by the GPU by a DSL compiler and a CUDA compiler, the speed and instantaneity of the operation and search of the media data by the GPU are effectively improved, and thus the real-time search of the media data is realized; the search optimization method may include:
step S110: and acquiring the statement to be queried.
The statement to be queried refers to a statement to be executed for querying the needed media data, where the statement to be executed may adopt a syntax structure similar to SQL (i.e. SQL-Like), specifically for example: SELECT faces, dot (query face_vec, face AS score FROM faces ORDER BY score DESC LIMIT; the SQL sentence represents the face identification of the top 10 rank of the vector similarity score of the face (namely query. Face_vec) which is inquired from the face vector data table named face. Of course, in a specific practical process, the sentence to be queried may also adopt a custom grammar structure.
The above-mentioned implementation of step S110 is very various, including but not limited to the following:
in a first embodiment, for a general user who does not understand SQL, a webpage application interface in a webpage client may be used to generate a statement to be queried, or an application program interface of a desktop application client may be used to generate a statement to be queried, where the embodiment may include:
step S111: and acquiring the query parameters and the media data through the webpage client or the desktop application client.
A web client refers to a client that accesses a server through a web page format, for example: a browser is a general-purpose software tool that accesses the internet, and may be used including: microsoft Edge browser, google Chrome browser, mozilla Firefox browser, opera browser, safari browser, firefox browser, etc.
The embodiment of step S111 described above is, for example: assuming that a general user uses a web client or a desktop application client to input query parameters and media data, after clicking a submit button, the electronic device may receive the query parameters and media data sent by the web client or the desktop application client, where the query parameters may include: the list of fields to be queried, the ordered fields (represented using the field names after the ORDER BY), and the ranking LIMITs (represented using the numbers after LIMIT), etc., in other words, any character in the statement to be queried can be changed to a query parameter according to the requirement, where the media data includes: pictures, video and audio, etc.
Step S112: and generating a statement to be queried according to the query parameters and the media data.
The embodiment of step S112 described above is, for example: if the media data to be queried is a face picture or a face video, the face picture or the face video can be converted into a face vector, and then the query is performed according to the face vector. The field list to be queried in the above query parameters is faces.id, dots (query.face_vec, faces.vec); the face_vec represents the face vector to be queried in the library. The sorting field in the above-mentioned query parameters is score, and the value obtained by multiplication of similarity can be determined as the sorting field, that is, the sorting field is represented by dot (query. Face_vec, face. Vec) as score; and, the ranking in the above query parameters is limited to 10, and is represented by LIMIT 10, then the sentence to be queried generated by using the SQL-like grammar structure is selected face. Id, dot (query. Face_vec, face. Vec) AS score FROM faces ORDER BY score DESC LIMIT; of course, other query conditions may be added according to the specific situation, specifically for example: the where clause in the SQL language is used as the other query condition in the high-level query.
In a second embodiment, for a business person who understands SQL, the statement to be queried may be submitted directly through a web page client or a desktop application client, where the embodiment may include:
step S113: and receiving the statement to be queried sent by the webpage client or the desktop application client.
The embodiment of step S113 described above is, for example: business personnel input a sentence to be queried with a SQL-like grammar structure on a webpage client or a desktop application client, and after a submit button (submit button) on the webpage client or the desktop application client is pressed, the webpage client or the desktop application client can send the sentence to be queried to the electronic equipment through an application program interface (Application Programming Interface, API); the electronic equipment receives a statement to be queried sent by a webpage client through a hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP) or a hypertext transfer security protocol (Hyper Text Transfer Protocol Secure, HTTPS); alternatively, the statement to be queried sent by the web client or desktop application client is received via a transmission control protocol (Transmission Control Protocol, TCP) or user datagram protocol (User Datagram Protocol, UDP).
After step S110, step S120 is performed: and analyzing and compiling the pre-parsed data structure and the statement to be queried by using a DSL compiler to obtain the target language code.
Target language code refers to code compiled from a target language supported by an electronic device, specifically for example: c language or c++ language, etc., then the target language code herein may refer to code written in C language or c++ language.
It will be appreciated that the required data structures may also be obtained prior to analysis and compilation using the DSL compiler, and that embodiments of obtaining the required data structures may include:
step S121: and obtaining a data model and analyzing a first intermediate representation code corresponding to the data model.
A Data Model (Data Model), which is used to define the storage structure of Data in the GPU, may be defined using a syntax structure of a SQL-like structure, and specifically, the Data Model defined using the SQL-like structure is as follows: CREATE TABLE faces { int32 id; vec [ int16] face_vec; int32status; -a }; wherein CREATE TABLE faces in the sentence represents creating a face data table named "faces", int32 id represents that the face identification number (id) is stored using an integer of 32 bits, vec [ int16] face_vec represents that the face image is stored using an integer vector of 16 bits, and int32status represents that the state of the face image is stored using an integer of 32 bits.
Intermediate representation (Intermediate Representation, IR) codes refer to intermediate bytecodes generated during data conversion, where IR can be understood as a language similar to bytecodes, e.g., in image IR, various operations can be defined on face image vectors, e.g., defining two face image vectors for dot product operations, etc.
The embodiment of step S121 described above is, for example: the electronic equipment obtains SQL-like sentences submitted by business personnel through a webpage client or a desktop application client; after the SQL-like sentences are obtained, converting the SQL-like sentences according to a syntax structure definition structure of the SQL-like pre-defined by the electronic equipment and the terminal equipment to obtain a data model; and then analyzing the data model by using a DSL compiler to obtain the analyzed first IR code.
Please refer to fig. 2, which is a schematic diagram illustrating a data compiling process flow according to an embodiment of the present application; the embodiment of step S120 may include:
step S122: and acquiring a second IR code corresponding to the statement to be queried.
The embodiment of step S122 described above is, for example: assuming that the statement to be queried is also an SQL-like statement, after the statement to be queried in the form of the SQL-like statement is obtained, analyzing the statement to be queried by using a DSL compiler to obtain an analyzed second IR code.
Step S123: and analyzing and compiling the first IR code and the second IR code by using a DSL compiler to obtain the target language code of the statement to be queried.
The embodiment of step S123 described above is, for example: and loading the first IR code and the second IR code by using a DSL compiler, and analyzing and compiling the loaded first IR code and second IR code to obtain the target language code of the statement to be queried, wherein the target language code of the statement to be queried comprises specific data model information.
Step S124: the first IR code is analyzed and compiled using a DSL compiler to obtain target language code for the data model.
The embodiment of step S124 described above is, for example: loading a first IR code by using a DSL compiler, and analyzing the loaded first IR code to obtain an analyzed data structure; and then, using a DSL compiler to load and compile the analyzed data structure to obtain the target language code corresponding to the data model.
After step S120, step S130 is performed: and compiling the target language code by using a CUDA compiler to obtain the executable program.
The embodiment of step S130 described above is, for example: because the CUDA compiler is a parallel computing engine inside the GPU, the executable program executed by the GPU can be obtained by compiling the target language code of the data model and the target language code of the statement to be queried using the CUDA compiler.
After step S130, step S140 is performed: and running the executable program by using the graphic processing unit, and searching the query result corresponding to the statement to be queried.
The above-mentioned implementation of step S140 is very various, including but not limited to the following:
in a first implementation, a GPU produced by NVIDIA is used to run an executable program and search for a query result corresponding to a statement to be queried; this embodiment is, for example: designating a GPU of a preset number by using NVIDIA-smi commands in GPUs produced by NVIDIA, and running the executable program by using the GPU of the preset number; the preset number can be set according to specific situations, and the specific function of the executable program can be to search the media vector database for the face image with the most similar face vector corresponding to the submitted face image, so that the most similar face image is used as a query result corresponding to a query statement to be searched. The media vector database can adopt a relational database or a non-relational database; among these, relational databases such as: mysql, postgreSQL, oracle and SQLSever, et al; non-relational databases that may be used include: grakn database, neo4j graph database, hadoop subsystem HBase, mongoDB, couchDB, etc.
In a second embodiment, the GPU produced by other manufacturers is used to run the executable program and search the query result corresponding to the sentence to be queried; this embodiment is, for example: the GPU produced by other manufacturers is used for running an executable program, and the specific function of the executable program is to acquire media data from sentences to be queried and convert the media data into vectors to be queried; searching media data with highest similarity of vectors to be queried in a media vector database; and generating a query result according to the query parameters and the media data with the highest similarity.
In the implementation process, firstly, a domain-specific language DSL compiler is used for analyzing and compiling a pre-analyzed data structure and sentences to be queried to obtain a target language code; compiling the target language code by using a CUDA compiler of a computing unified device architecture which is introduced by a display card manufacturer to obtain an executable program; running an executable program by using a Graphic Processing Unit (GPU), and searching a query result corresponding to a statement to be queried; that is, by utilizing the technical principle that the GPU can accelerate the operation of media data, and then analyzing and compiling the input statement to be queried into an executable program which can be executed by the GPU through the DSL compiler and the CUDA compiler, the speed and instantaneity of performing media data operation and search by using the GPU are effectively improved, so that the electronic device can realize more media data searching tasks, and can support scenes such as face image search or vehicle feature search of tens of millions to billions of data, thereby realizing real-time media data searching.
Referring to fig. 3, a flowchart of a process for providing a media data search service according to an embodiment of the present application is shown; optionally, in the embodiment of the present application, the electronic device may further provide a media data search service for a terminal device, and the specific process may include:
step S210: and the electronic equipment receives the statement to be queried sent by the terminal equipment.
The embodiment of step S210 described above is, for example: the electronic equipment receives a statement to be queried sent by terminal equipment of a business person who understands SQL through a TCP protocol or a UDP protocol; or the electronic equipment receives the query parameters and the media data sent by the common user through the HTTP protocol or the HTTPS protocol by using the browser, and then generates a statement to be queried according to the query parameters and the media data after receiving the query parameters and the media data.
Step S220: and the electronic equipment analyzes and compiles the pre-parsed data structure and the statement to be queried by using the DSL compiler to obtain the target language code.
Step S230: the electronic device compiles the target language code using a CUDA compiler to obtain an executable program.
Step S240: the electronic equipment uses the graphic processing unit to run the executable program and searches the query result corresponding to the statement to be queried.
The implementation principle and implementation of the steps S220 to S240 are similar to those of the steps S120 to S140, and thus, the implementation principle and implementation of the steps are not described herein, and reference may be made to the descriptions of the steps S120 to S140 if not clear.
Step S250: and the electronic equipment sends a query result corresponding to the statement to be queried to the terminal equipment.
The embodiment of step S250 described above is, for example: the electronic equipment sends a query result corresponding to the statement to be queried to terminal equipment of a business person who understands SQL or a browser of a common user. In the implementation process, the statement to be queried sent by the terminal equipment is obtained; after searching the query results corresponding to the sentences to be queried, the query results corresponding to the sentences to be queried are also sent to the terminal equipment; therefore, the query function in scenes such as face image retrieval or vehicle feature retrieval is realized, and the terminal equipment can obtain the query result corresponding to the statement to be queried more quickly.
Please refer to fig. 4, which illustrates a schematic structural diagram of a search optimization device according to an embodiment of the present application; the embodiment of the application provides a search optimization device 300, which comprises:
the query sentence acquisition module 310 is configured to acquire a sentence to be queried.
The target code obtaining module 320 is configured to analyze and compile the pre-parsed data structure and the sentence to be queried using the domain-specific language DSL compiler to obtain the target language code.
The executable program obtaining module 330 is configured to compile the target language code using a compute unified device architecture CUDA compiler to obtain an executable program.
The query result searching module 340 is configured to run an executable program using the graphics processing unit, and search for a query result corresponding to the sentence to be queried.
Optionally, in an embodiment of the present application, the query statement obtaining module includes:
and the parameter data acquisition module is used for acquiring the query parameters and the media data.
And the query statement generation module is used for generating a statement to be queried according to the query parameters and the media data.
Optionally, in an embodiment of the present application, the query result search module includes:
the query vector conversion module is used for acquiring media data from the statement to be queried and converting the media data into a vector to be queried.
And the media data searching module is used for searching the media data with the highest similarity of the vectors to be queried in the media vector database.
And the query result generation module is used for generating a query result according to the query parameters and the media data with the highest similarity.
Optionally, in an embodiment of the present application, the search optimization device further includes:
the first representation code acquisition module is used for acquiring a first intermediate representation code corresponding to the data model.
And the data structure obtaining module is used for loading and analyzing the first intermediate representation code by using the DSL compiler to obtain the data structure.
Optionally, in an embodiment of the present application, the object code obtaining module includes:
the second representation code acquisition module is used for acquiring a second intermediate representation code corresponding to the statement to be queried.
And the first code obtaining module is used for analyzing and compiling the first intermediate representation code by using the DSL compiler to obtain the target language code of the data model.
And the second code obtaining module is used for analyzing and compiling the first intermediate representation code and the second intermediate representation code by using the DSL compiler to obtain the target language code of the statement to be queried.
Optionally, in an embodiment of the present application, the executing the program obtaining module includes:
and the target code compiling module is used for compiling the target language codes of the data model and the target language codes of the sentences to be queried by using the CUDA compiler of the computing unified equipment architecture.
Optionally, in an embodiment of the present application, the search optimization device may further include:
the query statement acquisition module is used for acquiring the statement to be queried sent by the terminal equipment.
The query result sending module is used for sending a query result corresponding to the statement to be queried to the terminal equipment.
It should be understood that, corresponding to the above-mentioned search optimization method embodiment, the apparatus can perform the steps related to the above-mentioned method embodiment, and specific functions of the apparatus may be referred to the above description, and detailed descriptions are omitted herein as appropriate to avoid repetition. The device includes at least one software functional module that can be stored in memory in the form of software or firmware (firmware) or cured in an Operating System (OS) of the device.
Please refer to fig. 5, which illustrates a schematic structural diagram of an electronic device according to an embodiment of the present application. An electronic device 400 provided in an embodiment of the present application includes: a processor 410 and a memory 420, the memory 420 storing machine-readable instructions executable by the processor 410, which when executed by the processor 410 perform the method as described above.
The embodiment of the present application also provides a storage medium 430, on which storage medium 430 a computer program is stored which, when executed by the processor 410, performs a method as above.
The storage medium 430 may be implemented by any type or combination of volatile or nonvolatile Memory devices, such as a static random access Memory (Static Random Access Memory, SRAM), an electrically erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), an erasable Programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), a Programmable Read-Only Memory (PROM), a Read-Only Memory (ROM), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.
In the embodiments of the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, of the flowcharts and block diagrams in the figures that illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules of the embodiments of the present application may be integrated together to form a single part, or the modules may exist separately, or two or more modules may be integrated to form a single part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The foregoing description is merely an optional implementation of the embodiment of the present application, but the scope of the embodiment of the present application is not limited thereto, and any person skilled in the art may easily think about changes or substitutions within the technical scope of the embodiment of the present application, and the changes or substitutions are covered by the scope of the embodiment of the present application.

Claims (8)

1. A search optimization method, comprising:
acquiring a statement to be queried;
analyzing and compiling a pre-parsed data structure and the statement to be queried by using a domain specific language DSL compiler to obtain a target language code;
compiling the target language code by using a Computational Unified Device Architecture (CUDA) compiler to obtain an executable program;
using a graphic processing unit to run the executable program and searching for a query result corresponding to the statement to be queried;
before the DSL compiler of the domain-specific language analyzes and compiles the pre-parsed data structure and the statement to be queried, the method further includes: acquiring a first intermediate representation code corresponding to the data model; loading and parsing the first intermediate representation code using the DSL compiler to obtain the data structure;
the analyzing and compiling the pre-parsed data structure and the statement to be queried by using the domain specific language DSL compiler comprises the following steps: acquiring a second intermediate representation code corresponding to the statement to be queried; analyzing and compiling the first intermediate representation code by using the DSL compiler to obtain a target language code of the data model; and analyzing and compiling the first intermediate representation code and the second intermediate representation code by using the DSL compiler to obtain the target language code of the statement to be queried.
2. The method of claim 1, wherein the obtaining the statement to be queried comprises:
acquiring query parameters and media data;
and generating the statement to be queried according to the query parameters and the media data.
3. The method of claim 2, wherein the searching for the query result corresponding to the statement to be queried comprises:
acquiring the media data from the statement to be queried, and converting the media data into a vector to be queried;
searching media data with highest similarity of the vector to be queried in a media vector database;
and generating the query result according to the query parameters and the media data with the highest similarity.
4. The method of claim 1, wherein compiling the target language code using a compute unified device architecture, CUDA, compiler comprises:
and compiling the target language codes of the data model and the target language codes of the sentences to be queried by using a Compute Unified Device Architecture (CUDA) compiler.
5. The method of claim 1, wherein the obtaining the statement to be queried comprises:
acquiring the statement to be queried sent by terminal equipment;
after searching the query result corresponding to the statement to be queried, the method further comprises the following steps:
and sending the query result corresponding to the statement to be queried to the terminal equipment.
6. A search optimizing apparatus, comprising:
the query sentence acquisition module is used for acquiring sentences to be queried;
the target code obtaining module is used for analyzing and compiling a pre-analyzed data structure and the statement to be queried by using a domain specific language DSL compiler to obtain a target language code;
the executable program obtaining module is used for compiling the target language code by using a Computational Unified Device Architecture (CUDA) compiler to obtain an executable program;
the query result searching module is used for running the executable program by using the graphic processing unit and searching the query result corresponding to the statement to be queried;
before the DSL compiler of the domain-specific language analyzes and compiles the pre-parsed data structure and the statement to be queried, the method further includes: acquiring a first intermediate representation code corresponding to the data model; loading and parsing the first intermediate representation code using the DSL compiler to obtain the data structure;
the analyzing and compiling the pre-parsed data structure and the statement to be queried by using the domain specific language DSL compiler comprises the following steps: acquiring a second intermediate representation code corresponding to the statement to be queried; analyzing and compiling the first intermediate representation code by using the DSL compiler to obtain a target language code of the data model; and analyzing and compiling the first intermediate representation code and the second intermediate representation code by using the DSL compiler to obtain the target language code of the statement to be queried.
7. An electronic device, comprising: a processor and a memory storing machine-readable instructions executable by the processor to perform the method of any one of claims 1 to 5 when executed by the processor.
8. A storage medium having stored thereon a computer program which, when executed by a processor, performs the method of any of claims 1 to 5.
CN202011342743.9A 2020-11-25 2020-11-25 Search optimization method and device, electronic equipment and storage medium Active CN112364053B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011342743.9A CN112364053B (en) 2020-11-25 2020-11-25 Search optimization method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011342743.9A CN112364053B (en) 2020-11-25 2020-11-25 Search optimization method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112364053A CN112364053A (en) 2021-02-12
CN112364053B true CN112364053B (en) 2023-09-05

Family

ID=74533403

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011342743.9A Active CN112364053B (en) 2020-11-25 2020-11-25 Search optimization method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112364053B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115809063B (en) * 2022-12-05 2023-08-22 星环信息科技(上海)股份有限公司 Storage process compiling method, system, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095588A (en) * 2016-06-28 2016-11-09 北京大学深圳研究生院 CDVS based on GPGPU platform extracts process accelerated method
CN106919658A (en) * 2017-02-08 2017-07-04 华中科技大学 A kind of large-scale image words tree search method and system accelerated based on GPU
CN110383247A (en) * 2017-04-28 2019-10-25 伊纽迈茨有限公司 Method, computer-readable medium and heterogeneous computing system performed by computer
CN110476151A (en) * 2017-01-31 2019-11-19 脸谱公司 It is selected using the K of parallel processing

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8595701B2 (en) * 2011-02-04 2013-11-26 Fujitsu Limited Symbolic execution and test generation for GPU programs
US20170293670A1 (en) * 2016-04-07 2017-10-12 University Of Virginia Patent Foundation Sequential pattern mining with the micron automata processor

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095588A (en) * 2016-06-28 2016-11-09 北京大学深圳研究生院 CDVS based on GPGPU platform extracts process accelerated method
CN110476151A (en) * 2017-01-31 2019-11-19 脸谱公司 It is selected using the K of parallel processing
CN106919658A (en) * 2017-02-08 2017-07-04 华中科技大学 A kind of large-scale image words tree search method and system accelerated based on GPU
CN110383247A (en) * 2017-04-28 2019-10-25 伊纽迈茨有限公司 Method, computer-readable medium and heterogeneous computing system performed by computer

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
卢兴敬 等.ParaC:面向GPU平台的图像处理领域的编程框架.《软件学报》.2016,第28卷(第7期),第1655-1656页. *

Also Published As

Publication number Publication date
CN112364053A (en) 2021-02-12

Similar Documents

Publication Publication Date Title
US10963794B2 (en) Concept analysis operations utilizing accelerators
US11900064B2 (en) Neural network-based semantic information retrieval
US11232140B2 (en) Method and apparatus for processing information
US11468342B2 (en) Systems and methods for generating and using knowledge graphs
US20160259826A1 (en) Parallelized Hybrid Sparse Matrix Representations for Performing Personalized Content Ranking
US11651015B2 (en) Method and apparatus for presenting information
US9684726B2 (en) Realtime ingestion via multi-corpus knowledge base with weighting
US11144569B2 (en) Operations to transform dataset to intent
US20230096118A1 (en) Smart dataset collection system
US11797281B2 (en) Multi-language source code search engine
CN112328621B (en) SQL conversion method, SQL conversion device, SQL conversion computer equipment and SQL conversion computer readable storage medium
Bazaga et al. Translating synthetic natural language to database queries with a polyglot deep learning framework
CN112364053B (en) Search optimization method and device, electronic equipment and storage medium
CN111831624A (en) Data table creating method and device, computer equipment and storage medium
US9904674B2 (en) Augmented text search with syntactic information
CN117891930B (en) Book knowledge question-answering method based on knowledge graph enhanced large language model
CN117472693A (en) Buried point data processing method, system, equipment and storage medium based on data lake
JP6868062B2 (en) Methods and devices for updating information
CN114691850A (en) Method for generating question-answer pairs, training method and device of neural network model
WO2021237082A1 (en) Neural network-based semantic information retrieval
US11636391B2 (en) Automatic combinatoric feature generation for enhanced machine learning
CN118394334B (en) Similar interface recommendation method, device, equipment, storage medium and program product
US20240028646A1 (en) Textual similarity model for graph-based metadata
Dinov Specialized Machine Learning Topics
CN118227736A (en) Text processing method, text processing device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant