CN110018831A - Program processing method, device and Related product - Google Patents
Program processing method, device and Related product Download PDFInfo
- Publication number
- CN110018831A CN110018831A CN201910271311.4A CN201910271311A CN110018831A CN 110018831 A CN110018831 A CN 110018831A CN 201910271311 A CN201910271311 A CN 201910271311A CN 110018831 A CN110018831 A CN 110018831A
- Authority
- CN
- China
- Prior art keywords
- processor
- program
- file
- executable file
- run
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
- Stored Programmes (AREA)
Abstract
This application discloses a kind of program processing method, device and Related product, the second executable file, the first executable file and default run-time library can be linked the file destination for generating second processor and being able to carry out by program processing method.In this way second processor performance objective file when, pass through preset interface call first processor and make first processor execute the first executable file, thus allow user pass through second processor call first processor carry out operation.
Description
Technical field
This application involves field of computer technology, more particularly to a kind of program processing method, device and Related product.
Background technique
In the related art, the program that can be run on general processor (such as CPU) that user writes is in certain scenes
Process performance under (such as machine learning) is poor.Based on this, general processor (such as CPU) and other coprocessors can be constituted isomery
Computer system accelerates operation by coprocessor, to solve single general processor in some scenarios, process performance
The problem of difference.
Further, since operably certain special instructions tend not to instruct in fact by arithmetical logic on coprocessor
It is existing, therefore, it will usually it is used in the corresponding programming mode of the coprocessor and is programmed, obtain the corresponding program of coprocessor,
To realize the function of special instruction.And in traditional technology, user can not call directly coprocessor and run corresponding coprocessor
Corresponding program realizes the function of special instruction.
Summary of the invention
The embodiment of the present application provides a kind of program processing method, device and Related product.
In a first aspect, the embodiment of the present application provides a kind of program processing method, comprising:
Obtain the first executable file that first processor is able to carry out;
The second program that can be run in second processor is obtained, second program can be called in default run-time library
Preset interface, the preset interface is for calling the first processor;
Second program is compiled, corresponding second executable file of second program is obtained;
It will be described in second executable file, first executable file and the default run-time library link generation
The file destination that second processor is able to carry out.
Optionally, in second program include principal function identification information corresponding with first program, described second
When processor executes the file destination, first processor is called by the preset interface, and make first processor according to institute
It states principal function identification information and executes first executable file.
It optionally, also include the processor flag information of first processor, the second processor in second program
When executing the file destination, first processor corresponding with the processor flag is called by the preset interface, and make
The first processor executes first executable file.
Optionally, second program includes execution parameter information needed for operation first program, at described second
When managing the device execution file destination, first processor is called by the preset interface, and make first processor according to
It executes parameter information and executes first executable file.
Optionally, the file destination is the target executable file or dynamic link that the second processor is able to carry out
Library file.
Optionally, the file destination is dynamic link library file, and described program processing method includes:
The file destination is linked into the first frame, so as to first frame can be run in the second processor
When, first frame is made described in first processor execution by calling the file destination to call the first processor
First executable file.
Optionally, described the file destination is linked into the first preset frame to include:
The file destination is added in the default file folder of first frame;
The parameter preset in first frame is modified according to the link interface of the file destination, and described in recompility
First frame, so that the file destination links to first frame.
Optionally, second program includes the second frame that can be run by the second processor.
Second aspect, the embodiment of the present application provide a kind of program processing apparatus, comprising:
First executable file obtains module, the first executable file being able to carry out for obtaining first processor;
Second program obtains module, for obtaining the second program that can be run in second processor, second program
The preset interface in default run-time library can be called, the preset interface is for calling the first processor;
Second executable file obtains module, for being compiled to second program, obtains second program pair
The second executable file answered;
File destination generation module, for by second executable file, first executable file and described pre-
If run-time library link generates the file destination that the second processor is able to carry out.
Optionally, in second program include principal function identification information corresponding with first program, described second
When processor executes the file destination, first processor is called by the preset interface, and make first processor according to institute
It states principal function identification information and executes first executable file.
It optionally, also include the processor flag information of first processor, the second processor in second program
When executing the file destination, first processor corresponding with the processor flag is called by the preset interface, and make
The first processor executes first executable file.
Optionally, second program includes execution parameter information needed for operation first program, at described second
When managing the device execution file destination, first processor is called by the preset interface, and make first processor according to
It executes parameter information and executes first executable file.
Optionally, the file destination is the executable file or dynamic link library text that the second processor is able to carry out
Part.
Optionally, the file destination is dynamic link library file, and described program processing unit includes:
Link module, for the file destination to be linked to the first frame, so as to can be transported in the second processor
When row first frame, first frame makes first by calling the file destination to call the first processor
Processor executes first executable file.
Optionally, the link module includes:
File adding unit, for being added to the file destination in the default file folder of first frame;
Link unit modifies the default ginseng in first frame for the link interface function according to the file destination
Number, and first frame is recompilated, so that the file destination links to first frame.
Optionally, second program includes the second frame that can be run by the second processor.
The third aspect, the embodiment of the present application provide a kind of second processor, the second processor and first processor structure
At heterogeneous computer system, the step of second processor is for realizing program processing method described in above-mentioned embodiment.
Fourth aspect, the embodiment of the present application provide a kind of mainboard, the mainboard include above-mentioned first processor, with it is described
First memory, above-mentioned second processor and the second storage being connect with the second processor of first processor connection
Device;
Input data and output data needed for the first memory is used to store the first processor, described second
Memory is executing the file destination for storing file destination described in any of the above-described embodiment, the second processor
When, first processor is called by the preset interface and makes first processor according to the input data and the output data
Execute first executable file.
5th aspect, the application provides a kind of electronic equipment, including described in above-mentioned mainboard or any of the above-described embodiment
Program processing apparatus.
In the technical solution of the embodiment of the present application, second processor obtains first processor is able to carry out first and can hold
Style of writing part;The second program that can be run in second processor is obtained, second program can be called in default run-time library
Preset interface, the preset interface is for calling the first processor;Second program is compiled, described in acquisition
Corresponding second executable file of second program;By second executable file, first executable file and described pre-
If run-time library link generates the file destination that the second processor is able to carry out.Second processor executes the target in this way
When file, first processor is called by the preset interface and first processor is made to execute first executable file, from
And user is allow to call first processor to carry out operation by second processor.
Detailed description of the invention
Below by the invention relates to some attached drawings be illustrated.
Fig. 1 is the structural schematic diagram of the heterogeneous computer system being related to of the embodiment of the present application;
Fig. 2 is the flow diagram of the program processing method of the embodiment of the present application;
Fig. 3 is the flow chart of data processing schematic diagram that the program processing method of the embodiment of the present application is related to;
Fig. 4 is another flow chart of data processing schematic diagram that the program processing method of the embodiment of the present application is related to;
Fig. 5 is the structural schematic diagram of the program processing apparatus of the embodiment of the present application;
Fig. 6 is the structural schematic diagram of the mainboard of the embodiment of the present application.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood
The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not
For limiting the application.
Referring to Fig. 1, Fig. 1 be the invention relates to heterogeneous computer system structural schematic diagram.The isomery meter
Calculation machine system may include at least one first processor 11 and at least one second processor 12.Wherein, second processor 12
It can be used for realizing the program processing method of following any embodiment.Second processor 12 can be the main process task of heterogeneous computer system
Device, first processor 11 can be the coprocessor of agency computer system.User can directly utilize the operation fortune of second processor 12
It calculates.For example, first processor 11 can be but not limited to central processing unit (CPU), second processor 12 can be but not limited to
Artificial intelligence process device.
For performances such as the operation efficiencies that improves the heterogeneous computer system, user can be write based on specific programming rule
The first program for executing on first processor 11, first program can be realized the function of Special operator, the special calculation
Son can be the operator for completing high performance computation.For example, user can be based on application development program, which can be with
Including the first program and the second program, which can be the program that can be run in second processor 12, such as CPU
Program.It is executable to obtain can execute on first processor 11 first after the compiling of the first compiler for first program
File, first executable file can be the binary instruction that can be run on first processor 11, be also possible to centre
Expression instruction.After the compiling of the second compiler, obtaining can run on first processor 11 second can hold second program
Style of writing part, second executable file are also possible to binary instruction.
Further, the method, apparatus of the embodiment of the present application and Related product can be by the first above-mentioned executable files
It is linked with the second executable file, generates file destination, so that the file destination that second processor 12 is above-mentioned by operation,
First processor 11 can be called to run the first executable file, to pass through the association of first processor 11 and second processor 12
With work, specific processing task is completed.In compared to the prior art, the first processor 11 that user can not call directly is run
The process of first executable file improves the operation efficiency and performance of computer system.
Referring to Fig. 2, the embodiment of the present application provides a kind of program processing method, including but not limited to following steps:
01, second processor 12 obtains the first executable file that first processor 11 is able to carry out;
The program processing method of the embodiment of the present application can be realized by the second processor 12 of the embodiment of the present application.That is,
Second processor 12 obtains the first executable file that first processor 11 is able to carry out.Specifically, second processor 12 can be first
The first program to be executed is obtained, the first compiler is then run and compiles the first program, obtaining can be by first processor 11
The first executable file executed.It is appreciated that first processor 11 is coprocessor, second in heterogeneous computer system
When processor 12 is primary processor, compiler is run using second processor 12, so as to transport using second processor 12
The first compiler of row compiles the first program, obtains the first executable file that can be executed by first processor 11.First program is
The first program write using first language corresponding with first processor 11, the first compiler are volume corresponding with first language
Translate device.For example, the first program can be write by neural network language when first processor 11 is artificial intelligent processor
Artificial intelligence process device program, the first compiler are the compiler for compiling artificial intelligence process device program, and first is executable
File is the command file that can be executed by artificial intelligence process device.
02, second processor 12 obtains the second program that can be run in second processor 12, and the second program can be called
The preset interface of default run-time library;
Second program can be understood as the program that can be run by second processor 12, for example, second processor 12 is CPU
When, the second program is the CPU program that can be run by CPU, and the second program is specifically as follows by C language, JAVA language, C Plus Plus
Etc. high level languages program, the second program can be used in calling the preset interface of default run-time library, which uses
In calling first processor 11.Wherein, default run-time library provides pre- for the one or more towards first processor 11
If interface, the interaction between first processor 11 and second processor 12 can be completed by preset interface.Default run-time library master
Wanting function includes equipment management, memory management, execution flow management, time management etc..
03, second processor 12 is compiled the second program, obtains corresponding second executable file of the second program;
Second processor 12 runs the second compiler corresponding with the second program and is compiled to the second program, obtains second
Executable file.When second processor 12 is CPU, the second program is the CPU program that can be run by CPU, and the second program is specific
When can be for by the program of the high level languages such as C language, JAVA language, C Plus Plus, second processor 12 can run and write
Corresponding second compiler of the language of second program is compiled the second compiler to the second program.
04, the second executable file, the first executable file and default run-time library are linked and are generated by second processor 12
The file destination that second processor 12 is able to carry out.
Optionally, when second processor 12 is CPU, file destination is CPU executable file or can be by CPU routine call
And the dynamic link library file executed.Second processor 12 can call directly and run the file destination, run the target
It, can be by presetting the preset interface in run-time library during file, calling directly the operation of first processor 11 first can
File is executed, so that second processor 12 be allow to call directly the function that first processor 11 realizes Special operator.At one
In alternative embodiment, second processor 12 can be by running linker, by the second executable file, the first executable file and pre-
If run-time library link generates the file destination that second processor 12 is able to carry out.
In the program processing method of the embodiment of the present application, second processor 12 obtains what first processor 11 was able to carry out
First executable file;The second program that can be run in second processor 12 is obtained, the second program can call default operation
Preset interface in Shi Ku, preset interface is for calling first processor 11;Second program is compiled, the second program is obtained
Corresponding second executable file;The link of second executable file, the first executable file and default run-time library is generated the
The file destination that two processors 12 are able to carry out.In this way 12 performance objective file of second processor when, called by preset interface
First processor 11 simultaneously makes first processor 11 execute the first executable file, so that user be allow to pass through second processor 12
First processor 11 is called to carry out operation.
It based on the above embodiment, in certain embodiments, include principal function mark corresponding with the first program in the second program
Know information, when such 12 performance objective file of second processor, first processor 11 is called by preset interface and is made at first
It manages device 11 and first executable file is executed according to principal function identification information.
In the present embodiment, principal function identification information is the title of the corresponding principal function of the first program, and the first program is corresponding
Principal function be the first executable file entrance function.It, can be according to principal function mark when 12 performance objective file of second processor
Know information and find corresponding first executable file, and according to principal function identification information, the first processing is called by preset interface
Device 11 executes the first executable file using principal function as entrance.
It in certain embodiments, include the processor flag information of first processor 11, second processor in the second program
When 12 performance objective file, first processor 11 corresponding with processor flag is called by preset interface and makes first processing
Device 11 executes the first executable file.
In heterogeneous computer system, including a primary processor and at least one coprocessor, in other words, association's processing
The quantity of device may be one be also likely to be it is multiple, when the quantity of coprocessor be it is multiple when, set first in the second program
The processor flag information of processor 11 can be according to processor flag in this way when 12 performance objective file of second processor
The first processor 11 that information is called needed for finding, then calls corresponding with processor flag information first by preset interface
Processor 11 simultaneously makes the target processor execute the first executable file.Optionally, include and the first program pair in the second program
The processor flag information of the principal function identification information and first processor 11 answered, the second program are led to pre- in default run-time library
If interface calls first processor 11 corresponding with processor flag information, first processor 11 is held according to principal function identification information
The first executable file of row.
In certain embodiments, the second program includes execution parameter information needed for the first program of operation, second processor
When 12 performance objective file, first processor 11 is called by preset interface and makes first processor 11 according to execution parameter information
Execute the first executable file.Wherein, executing parameter information includes input, output parameter information needed for the first program of execution,
It can also include parametric variable.When 12 operational objective file of second processor, will execute parameter information from second processor 12
The second memory 14 of connection copies the first processor 11 connecting with first processor 11 to, is called in this way by preset interface
First processor 11, first processor 11 is extracted from first memory 13 again executes parameter information, and believes according to parameter is executed
Breath executes the first executable file.It still optionally further, include principal function mark letter corresponding with the first program in the second program
Execution parameter information needed for the first program of breath and operation, the second program call the by the preset interface preset in run-time library
One processor 11, first processor 11 is according to principal function identification information and executes parameter information the first executable file of execution.
In one embodiment, file destination is the executable file that second processor 12 can directly be run, this can hold
Style of writing part can be the binary instruction file that second processor 12 is able to carry out.Optionally, the acquisition pattern of the file destination
It can be there are many different modes.For example, as shown in figure 3, the second program can be compiled to obtain second and can held by second processor 12
The for composing a piece of writing after part, the first executable file being linked into the second executable file, and will be linked with the first executable file
Two executable files link the executable file for generating second processor 12 and being able to carry out with default run-time library.Alternatively, such as Fig. 4
Shown, the first executable file, the second executable file and default run-time library can be directly linked to target text by linker
In part.When second processor 12 executes the second file in this way, first processor 11 can be called by preset interface, and make at first
It manages device 11 and executes the first executable file, so as to realize that user calls first processor 11 to carry out at 12 end of second processor
Operation.
In another example, file destination is the dynamic link library file that second processor 12 is able to carry out.At second
The second executable file, the first executable file and default run-time library can be linked generation dynamic link library file by managing device 12.
Alternatively, linker can also link to first executable file in default run-time library, and by this preset run-time library with
Second executable file linked, and generates dynamic link library file.It in this way can be in other programs by calling this dynamic
State links library file and realizes that the calling execution of first processor 11 the first executable file corresponding to the first program is corresponding to realize
Function.
In the embodiment of the present application, second processor 12 by the second executable file, the first executable file and presets fortune
Library links to obtain file destination when row, when 12 operational objective file of second processor, can pass through default in default run-time library
Interface calls first processor 11, and first processor 11 is made to execute the first executable file, passes through second processor to realize
12 calling first processors 11 are calculated.
In other embodiments, second processor 12 can link to the first executable file in machine learning library, into
One step, the machine learning library and the second executable file can link generation file destination, as machine learning library and second can
It executes file dynamic link and generates dynamic link library.It include multiple operators relevant to machine learning in machine learning library and right
The interface function answered, to allow user by calling some operator therein or multiple operators to splice, needed for realizing
The function of realization.Second processor 12 can be sent by the interface function in machine learning library to artificial intelligence process device artificial
Data needed for intelligent processor, so that artificial intelligence process device can execute the specified artificial intelligence process of second processor 12
Device program.Still optionally further, second processor 12 can be by calling the specific fusion operator in machine learning library, this is specific
Fusion operator can be realized above-mentioned interface function function, and second processor 12 is made to pass through above-mentioned machine learning library calling the
One processor 11 runs the first above-mentioned executable file.Alternatively, second processor 12 can also be by the first executable file,
Two executable files and machine learning library three, which link, generates file destination.For example, the first executable file, the second executable text
Part and the link of machine learning library generate dynamic link library.
Still optionally further, dynamic link library file can also be linked to upper layer frame, upper layer frame by second processor 12
It can be but not limited to the machine learning frame such as caffe, MXNet, tensorflow, adjusted in the frame of upper layer so as to realize
Calculate with the function in the dynamic link library file and realizes corresponding function.Specifically, when file destination is dynamic link
When library file, file destination can be linked to the first frame so that can second processor 12 run the first frame when, first
Frame calls first processor 11 to execute the first executable file by invocation target file.Certainly, file destination is not dynamic
When linking library file, such as the executable file that other library files either second processor 12 can be executed directly when file destination
When, file destination can also be linked in the frame of upper layer.
As an alternative embodiment, file destination can be added to the default text of the first frame by second processor 12
In part folder, the parameter preset in the first frame is then modified according to the link interface of file destination, and recompilate the first frame,
So that file destination links to the first frame.It is appreciated that file destination is added in the default file folder of the first frame, and
The link function interface of the dynamic link library is added in the first frame, is then modified in the first frame according to link function interface
Relevant parameter, the dynamic link library is called in the first frame, then recompilate the first frame, realization file destination is linked
To the first frame, it is executable to call first processor 11 to execute first that the first frame can be run by second processor 12 in this way
File realizes corresponding function in the first frame.First frame can for example be but not limited to caffe, MXNet,
Tensorflow etc..
In further carrying out example, the second program includes the second frame that can be run by second processor 12.It can be with
Understanding, the second program includes the second framing program, thus pass through the link of the first executable file and the second executable file, it can
The first executable file is integrated in the second frame with realizing, so as to call first processor 11 to hold in the second frame
The first executable file of row.Second frame can for example be but not limited to the machine learning frame such as caffe, MXNet, tensorflow
Frame.
It is appreciated that according to the application the various embodiments described above, under heterogeneous computer system scene, user needs to call the
When one processor 11 runs the first program, the first compiler corresponding with the first program can be run first with second processor 12 and compiled
It translates the first program and obtains the first executable file, obtain the corresponding principal function of the first program, and using principal function as the first processing
Device 11 executes the entrance function of the first executable file.Then, second processor 12 (namely primary processor) can run second
Program, in the second program comprising principal function identification information, the first processor 11 to be called processor flag information and hold
Execution parameter information needed for the first program of row, wherein principal function identification information can be the title of principal function, recycle at second
Reason device 12 runs the second program and obtains the second executable file, and by the second executable file, the first executable file and presets
Run-time library link generates the file destination that second processor 12 is able to carry out.When 12 operational objective file of second processor, root
The first executable file to be executed is determined according to principal function identification information, is copied to by preset interface by parameter information is executed
The first memory 13 being connect with the first program, and pass through the preset interface application and processor flag information pair in run-time library
The first processor 11 answered makes first processor 11 execute the first executable file.So as to reality now with second processing
Device 12 calls first processor 11 to execute corresponding first executable file of the first program.
Referring to Fig. 5, the embodiment of the present application provides a kind of program processing apparatus 20, program processing apparatus 20 includes:
First executable file obtains module 21, the first executable text being able to carry out for obtaining first processor 11
Part;
Second program obtains module 22, for obtaining the second program that can be run in second processor 12, the second program
The preset interface in default run-time library can be called, preset interface is for calling first processor 11;
Second executable file obtains module 23, for being compiled to the second program, obtains the second program corresponding the
Two executable files;
File destination generation module 24 is used for the second executable file, the first executable file and default run-time library
Link generates the file destination that second processor 12 is able to carry out.
The program processor method of the embodiment of the present application can also be realized by the program processing apparatus 20 of the embodiment of the present application.
It is appreciated that the first executable file, which obtains module 21, obtains module 22 for executing step for executing step 01, the second program
Rapid 02, the second executable file obtains module 23 for executing step 03, and file destination generation module 24 is for executing step 04.
The program processing apparatus 20 of the embodiment of the present application can realize the function of above-mentioned each functional module by second processor 12
Energy namely the first executable file module can be obtained first processor 11 be able to carry out first by second processor 12 and can held
Style of writing part;Second program obtains module 22 and obtains the second program that can be run in second processor 12;Second executable file
It obtains module 23 to be compiled the second program, obtains corresponding second executable file of the second program;File destination generates mould
Second executable file, the first executable file and default run-time library are linked generation second processor 12 and are able to carry out by block 24
File destination.
Optionally, obtaining using operation the first program of the first compiler compiling of second processor 12 can be by first processor
11 the first executable files executed.First program is the first journey write using first language corresponding with first processor 11
Sequence, the first compiler are compiler corresponding with first language.For example, when second processor 12 is artificial intelligent processor, the
One program can be the artificial intelligence process device program write by neural network language, and the first compiler is artificial for compiling
The compiler of intelligent processor program, the first executable file are the command file that can be executed by artificial intelligence process device.
Second program can be understood as the program that can be run by second processor 12, for example, second processor 12 is CPU
When, the second program is the CPU program that can be run by CPU, and the second program is specifically as follows by C language, JAVA language, C Plus Plus
Etc. high level languages program, the second program can be used in calling the preset interface of default run-time library, which uses
In calling first processor 11.Wherein, default run-time library provides pre- for the one or more towards first processor 11
If interface, the interaction between first processor 11 and second processor 12 can be completed by preset interface.Default run-time library master
Wanting function includes equipment management, memory management, execution flow management, time management etc..
Second processor 12 runs the second compiler corresponding with the second program and is compiled to the second program, obtains second
Executable file.When second processor 12 is CPU, the second program is the CPU program that can be run by CPU, and the second program is specific
When can be for by the program of the high level languages such as C language, JAVA language, C Plus Plus, second processor 12 can run and write
Corresponding second compiler of the language of second program is compiled the second compiler to the second program.
Optionally, when second processor 12 is CPU, file destination is CPU executable file or can be by CPU routine call
And the dynamic link library file executed.Second processor 12 can call directly and run the file destination, run the target
It, can be by presetting the preset interface in run-time library during file, calling directly the operation of first processor 11 first can
File is executed, so that second processor 12 be allow to call directly the function that first processor 11 realizes Special operator.At one
In alternative embodiment, second processor 12 can be by running linker, by the second executable file, the first executable file and pre-
If run-time library link generates the file destination that second processor 12 is able to carry out.
In the program processing method of the embodiment of the present application, second processor 12 obtains what first processor 11 was able to carry out
First executable file;The second program that can be run in second processor 12 is obtained, the second program can call default operation
Preset interface in Shi Ku, preset interface is for calling first processor 11;Second program is compiled, the second program is obtained
Corresponding second executable file;The link of second executable file, the first executable file and default run-time library is generated the
The file destination that two processors 12 are able to carry out.In this way 12 performance objective file of second processor when, called by preset interface
First processor 11 simultaneously makes first processor 11 execute the first executable file, so that user be allow to pass through second processor 12
First processor 11 is called to carry out operation.
It based on the above embodiment, in certain embodiments, include principal function mark corresponding with the first program in the second program
Know information, when such 12 performance objective file of second processor, first processor 11 is called by preset interface and is made at first
It manages device 11 and first executable file is executed according to principal function identification information.
In the present embodiment, principal function identification information is the title of the corresponding principal function of the first program, and the first program is corresponding
Principal function be the first executable file entrance function.It, can be according to principal function mark when 12 performance objective file of second processor
Know information and find corresponding first executable file, and according to principal function identification information, the first processing is called by preset interface
Device 11 executes the first executable file using principal function as entrance.
It in certain embodiments, include the processor flag information of first processor 11, second processor in the second program
When 12 performance objective file, first processor 11 corresponding with processor flag is called by preset interface and makes first processing
Device 11 executes the first executable file.
In heterogeneous computer system, including a primary processor and at least one coprocessor, in other words, association's processing
The quantity of device may be one be also likely to be it is multiple, when the quantity of coprocessor be it is multiple when, set first in the second program
The processor flag information of processor 11 can be according to processor flag in this way when 12 performance objective file of second processor
The first processor 11 that information is called needed for finding, then calls corresponding with processor flag information first by preset interface
Processor 11 simultaneously makes the target processor execute the first executable file.Optionally, include and the first program pair in the second program
The processor flag information of the principal function identification information and first processor 11 answered, the second program are led to pre- in default run-time library
If interface calls first processor 11 corresponding with processor flag information, first processor 11 is held according to principal function identification information
The first executable file of row.
In certain embodiments, the second program includes execution parameter information needed for the first program of operation, second processor
When 12 performance objective file, first processor 11 is called by preset interface and makes first processor 11 according to execution parameter information
Execute the first executable file.Wherein, executing parameter information includes input, output parameter information needed for the first program of execution,
It can also include parametric variable.When 12 operational objective file of second processor, will execute parameter information from second processor 12
The second memory 14 of connection copies the first processor 11 connecting with first processor 11 to, is called in this way by preset interface
First processor 11, first processor 11 is extracted from first memory 13 again executes parameter information, and believes according to parameter is executed
Breath executes the first executable file.It still optionally further, include principal function mark letter corresponding with the first program in the second program
Execution parameter information needed for the first program of breath and operation, the second program call the by the preset interface preset in run-time library
One processor 11, first processor 11 is according to principal function identification information and executes parameter information the first executable file of execution.
In one embodiment, file destination is the executable file that second processor 12 can directly be run, this can hold
Style of writing part can be the binary instruction file that second processor 12 is able to carry out.Optionally, the acquisition pattern of the file destination
It can be there are many different modes.For example, as shown in figure 3, the second program can be compiled to obtain second and can held by second processor 12
The for composing a piece of writing after part, the first executable file being linked into the second executable file, and will be linked with the first executable file
Two executable files link the executable file for generating second processor 12 and being able to carry out with default run-time library.Alternatively, such as Fig. 4
Shown, the first executable file, the second executable file and default run-time library can be directly linked to target text by linker
In part.When second processor 12 executes the second file in this way, first processor 11 can be called by preset interface, and make at first
It manages device 11 and executes the first executable file, so as to realize that user calls first processor 11 to carry out at 12 end of second processor
Operation.
In another example, file destination is the dynamic link library file that second processor 12 is able to carry out.At second
The second executable file, the first executable file and default run-time library can be linked generation dynamic link library file by managing device 12.
Alternatively, linker can also link to first executable file in default run-time library, and by this preset run-time library with
Second executable file linked, and generates dynamic link library file.It in this way can be in other programs by calling this dynamic
State links library file and realizes that the calling execution of first processor 11 the first executable file corresponding to the first program is corresponding to realize
Function.
In the embodiment of the present application, second processor 12 by the second executable file, the first executable file and presets fortune
Library links to obtain file destination when row, when 12 operational objective file of second processor, can pass through default in default run-time library
Interface calls first processor 11, and first processor 11 is made to execute the first executable file, passes through second processor to realize
12 calling first processors 11 are calculated.
In other embodiments, second processor 12 can link to the first executable file in machine learning library, into
One step, the machine learning library and the second executable file can link generation file destination, as machine learning library and second can
It executes file dynamic link and generates dynamic link library.It include multiple operators relevant to machine learning in machine learning library and right
The interface function answered, to allow user by calling some operator therein or multiple operators to splice, needed for realizing
The function of realization.Second processor 12 can be sent by the interface function in machine learning library to artificial intelligence process device artificial
Data needed for intelligent processor, so that artificial intelligence process device can execute the specified artificial intelligence process of second processor 12
Device program.Still optionally further, second processor 12 can be by calling the specific fusion operator in machine learning library, this is specific
Fusion operator can be realized above-mentioned interface function function, and second processor 12 is made to pass through above-mentioned machine learning library calling the
One processor 11 runs the first above-mentioned executable file.Alternatively, second processor 12 can also be by the first executable file,
Two executable files and machine learning library three, which link, generates file destination.For example, the first executable file, the second executable text
Part and the link of machine learning library generate dynamic link library.
Still optionally further, dynamic link library file can also be linked to upper layer frame, upper layer frame by second processor 12
It can be but not limited to the machine learning frame such as caffe, MXNet, tensorflow, adjusted in the frame of upper layer so as to realize
Calculate with the function in the dynamic link library file and realizes corresponding function.Specifically, when file destination is dynamic link
When library file, file destination can be linked to the first frame so that can second processor 12 run the first frame when, first
Frame calls first processor 11 to execute the first executable file by invocation target file.Certainly, file destination is not dynamic
When linking library file, such as the executable file that other library files either second processor 12 can be executed directly when file destination
When, file destination can also be linked in the frame of upper layer.
As an alternative embodiment, file destination can be added to the default text of the first frame by second processor 12
In part folder, the parameter preset in the first frame is then modified according to the link interface of file destination, and recompilate the first frame,
So that file destination links to the first frame.It is appreciated that file destination is added in the default file folder of the first frame, and
The link function interface of the dynamic link library is added in the first frame, is then modified in the first frame according to link function interface
Relevant parameter, the dynamic link library is called in the first frame, then recompilate the first frame, realization file destination is linked
To the first frame, it is executable to call first processor 11 to execute first that the first frame can be run by second processor 12 in this way
File realizes corresponding function in the first frame.First frame can for example be but not limited to caffe, MXNet,
Tensorflow etc..
In further carrying out example, the second program includes the second frame that can be run by second processor 12.It can be with
Understanding, the second program includes the second framing program, thus pass through the link of the first executable file and the second executable file, it can
The first executable file is integrated in the second frame with realizing, so as to call first processor 11 to hold in the second frame
The first executable file of row.Second frame can for example be but not limited to the machine learning frame such as caffe, MXNet, tensorflow
Frame.
It is appreciated that according to the application the various embodiments described above, under heterogeneous computer system scene, user needs to call the
When one processor 11 runs the first program, the first compiler corresponding with the first program can be run first with second processor 12 and compiled
It translates the first program and obtains the first executable file, obtain the corresponding principal function of the first program, and using principal function as the first processing
Device 11 executes the entrance function of the first executable file.Then, second processor 12 (namely primary processor) can run second
Program, in the second program comprising principal function identification information, the first processor 11 to be called processor flag information and hold
Execution parameter information needed for the first program of row, wherein principal function identification information can be the title of principal function, recycle at second
Reason device 12 runs the second program and obtains the second executable file, and by the second executable file, the first executable file and presets
Run-time library link generates the file destination that second processor 12 is able to carry out.When 12 operational objective file of second processor, root
The first executable file to be executed is determined according to principal function identification information, is copied to by preset interface by parameter information is executed
The first memory 13 being connect with the first program, and pass through the preset interface application and processor flag information pair in run-time library
The first processor 11 answered makes first processor 11 execute the first executable file.So as to reality now with second processing
Device 12 calls first processor 11 to execute corresponding first executable file of the first program.
Referring to Fig. 6, the embodiment of the present application also provides a kind of mainboard 10, including first processor 11 and first processor
The first memory 13 of 11 connections, the second processor 12 of above-described embodiment and the second memory being connect with second processor 12
14, first memory 13 is for input data and output data needed for storing first processor 11, such as executes parameter information
Be used to store the file destination of any of the above-described embodiment Deng, second memory 14, second processor 12 in performance objective file,
Calling first processor 11 by preset interface and first processor 11 is made to execute first according to input data and output data can
Execute file.
The mainboard 10 of the embodiment of the present application, it is executable that second processor 12 obtains first processor 11 is able to carry out first
File;The second program that can be run in second processor 12 is obtained, the second program can be called pre- in default run-time library
If interface, preset interface is for calling first processor 11;Second program is compiled, the second program corresponding second is obtained
Executable file;Second executable file, the first executable file and default run-time library are linked and generate second processor 12
The file destination being able to carry out.In this way 12 performance objective file of second processor when, first processor is called by preset interface
11 and make first processor 11 execute the first executable file, thus allow user by second processor 12 call first at
It manages device 11 and carries out operation.
It should be noted that also being fitted in above-described embodiment to the explanation of program processing method or program processing apparatus 20
For the mainboard 10 of the present embodiment, to avoid redundancy, details are not described herein.
The embodiment of the present application also provides a kind of electronic equipment, the journey of mainboard 10 or above-described embodiment including above-described embodiment
Order processing apparatus 20.It is appreciated that the program processing method of any of the above-described embodiment, it can be by the master of the electronic equipment of the present embodiment
Plate 10 or program processing apparatus 20 are realized.
Wherein, electronic equipment includes but is not limited to mobile phone, laptop, tablet computer, desktop computer, server, intelligence
Energy bracelet etc..
In the electronic equipment of the embodiment of the present application, second processor 12 obtains first that first processor 11 is able to carry out
Executable file;The second program that can be run in second processor 12 is obtained, the second program can call default run-time library
In preset interface, preset interface is for calling first processor 11;Second program is compiled, it is corresponding to obtain the second program
The second executable file;The link of second executable file, the first executable file and default run-time library is generated at second
The file destination that reason device 12 is able to carry out.In this way 12 performance objective file of second processor when, pass through preset interface call first
Processor 11 simultaneously makes first processor 11 execute the first executable file, so that user be allow to call by second processor 12
First processor 11 carries out operation.
It should be noted that also being fitted in above-described embodiment to the explanation of program processing method or program processing apparatus 20
For the electronic equipment of the present embodiment, to avoid redundancy, details are not described herein.
In the above-described embodiments, can wholly or partly by software, hardware, firmware, or any combination thereof realize.When
When using software realization, can entirely or partly it realize in the form of a computer program product.Computer program product includes
One or more computer instructions.When loading on computers and executing computer program instructions, entirely or partly generates and press
According to the process or function of the embodiment of the present application.Computer can be general purpose computer, special purpose computer, computer network or
Other programmable devices.Computer instruction may be stored in a computer readable storage medium, or computer-readable from one
Storage medium is transmitted to another computer readable storage medium, for example, computer instruction can be from a web-site, calculating
Machine, server or data center pass through wired (such as coaxial cable, optical fiber, Digital Subscriber Line) or wireless (such as infrared, nothing
Line, microwave etc.) mode transmitted to another web-site, computer, server or data center.Computer-readable storage
Medium can be any usable medium that computer can access or include the integrated service of one or more usable mediums
The data storage devices such as device, data center.Usable medium can be magnetic medium (such as floppy disk, hard disk, tape), optical medium
(such as CD) or semiconductor medium (such as solid state hard disk) etc..In the above-described embodiments, all to the description of each embodiment
It emphasizes particularly on different fields, there is no the part being described in detail in some embodiment, reference can be made to the related descriptions of other embodiments.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment
Point, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed device can also pass through others
Mode is realized.Such as the apparatus embodiments described above are merely exemplary, such as the division of unit, only one kind is patrolled
Function division is collected, there may be another division manner in actual implementation, such as multiple units or components are combinable or can collect
At another system is arrived, or some features can be ignored or does not execute.Another point, it is shown or discussed mutual indirect
Coupling or direct-coupling or communication connection can be through some interfaces, the indirect coupling or communication connection of device or unit,
It can be electrical or other forms.
Unit may or may not be physically separated as illustrated by the separation member, shown as a unit
Component may or may not be physical unit, it can and it is in one place, alternatively, may be distributed over multiple networks
On unit.It can select some or all of unit therein according to the actual needs to realize the mesh of the scheme of the present embodiment
's.
In addition, each functional unit in each embodiment of the application can be integrated in a processing unit, it is also possible to each
Unit physically exists alone, can also two or more units be integrated in one unit.Above-mentioned integrated unit both can be with
Using formal implementation of hardware, or can also realize in the form of software functional units.
It, can if integrated unit is realized in the form of SFU software functional unit and when sold or used as an independent product
To be stored in a computer readable storage medium.Based on this understanding, technical scheme is substantially in other words
The all or part of the part that contributes to existing technology or the technical solution can embody in the form of software products
Come, which is stored in a storage medium, including some instructions are to make a computer equipment (can be
Personal computer, server or network equipment etc.) execute each embodiment method of the application all or part of the steps.And it is preceding
The storage medium stated is for example can include: USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), arbitrary access
The medium of the various program storage codes such as memory (RAM, Random Access Memory), magnetic disk or CD.
Claims (10)
1. a kind of program processing method characterized by comprising
Obtain the first executable file that first processor is able to carry out;
The second program that can be run in second processor is obtained, second program can be called pre- in default run-time library
If interface, the preset interface is for calling the first processor;
Second program is compiled, corresponding second executable file of second program is obtained;
Second executable file, first executable file and the default run-time library link are generated described second
The file destination that processor is able to carry out.
2. program processing method according to claim 1, which is characterized in that include and described first in second program
Program corresponding principal function identification information passes through the preset interface tune when second processor executes the file destination
With first processor, and first processor is made to execute first executable file according to the principal function identification information.
3. program processing method according to claim 1, which is characterized in that also comprising the first processing in second program
The processor flag information of device when the second processor executes the file destination, is called and institute by the preset interface
The corresponding first processor of processor flag is stated, and the first processor is made to execute first executable file.
4. program processing method according to claim 1, which is characterized in that second program includes operation described first
Execution parameter information needed for program is called when the second processor executes the file destination by the preset interface
First processor, and first processor is made to execute first executable file according to the execution parameter information.
5. program processing method according to claim 1-4, which is characterized in that the file destination is described the
The target executable file or dynamic link library file that two processors are able to carry out;The file destination is dynamic link library file
When, described program processing method includes:
The file destination is linked into the first frame so that can the second processor run first frame when,
First frame calls the first processor by the file destination, and hold first processor execution described first can
Style of writing part.
6. program processing method according to claim 1-4, which is characterized in that second program further includes energy
Enough the second frames run by the second processor.
7. a kind of program processing apparatus characterized by comprising
First executable file obtains module, the first executable file being able to carry out for obtaining first processor;
Second program obtains module, and for obtaining the second program that can be run in second processor, second program can
The preset interface in default run-time library is called, the preset interface is for calling the first processor;
Second executable file obtains module, and for being compiled to second program, it is corresponding to obtain second program
Second executable file;
File destination generation module is used for second executable file, first executable file and the default fortune
Library link generates the file destination that the second processor is able to carry out when row.
8. a kind of second processor, which is characterized in that the second processor and first processor constitute heterogeneous computer system,
The step of second processor is for realizing program processing method as claimed in any one of claims 1 to 6.
9. a kind of mainboard, which is characterized in that the mainboard include first processor according to any one of claims 8 and second processor,
The first memory being connect with the first processor and the second memory being connect with the second processor;
The first memory is for input data and output data needed for storing the first processor, second storage
Device is executing the target text for storing the file destination described in any one of claims 1-6, the second processor
When part, first processor is called by the preset interface, enables first processor according to the input data and described defeated
Data execute first executable file out.
10. a kind of electronic equipment, which is characterized in that including described in program processing apparatus as claimed in claim 7 or claim 9
Mainboard.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910271311.4A CN110018831B (en) | 2019-04-04 | 2019-04-04 | Program processing method, program processing apparatus, and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910271311.4A CN110018831B (en) | 2019-04-04 | 2019-04-04 | Program processing method, program processing apparatus, and computer-readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110018831A true CN110018831A (en) | 2019-07-16 |
CN110018831B CN110018831B (en) | 2022-11-08 |
Family
ID=67190626
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910271311.4A Active CN110018831B (en) | 2019-04-04 | 2019-04-04 | Program processing method, program processing apparatus, and computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110018831B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021036893A1 (en) * | 2019-08-23 | 2021-03-04 | 中科寒武纪科技股份有限公司 | Data processing method and apparatus, computer device, and storage medium |
CN113031956A (en) * | 2019-12-25 | 2021-06-25 | 中科寒武纪科技股份有限公司 | Program compiling method and device and program running method and device |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103744682A (en) * | 2014-01-24 | 2014-04-23 | 中国科学院自动化研究所 | System and method for separate compilation of heterogeneous mixed programs |
CN103744684A (en) * | 2014-01-24 | 2014-04-23 | 中国科学院自动化研究所 | Heterogeneous hardware and software collaborative developing method and system |
US20140149969A1 (en) * | 2012-11-12 | 2014-05-29 | Signalogic | Source code separation and generation for heterogeneous central processing unit (CPU) computational devices |
CN107111663A (en) * | 2014-11-12 | 2017-08-29 | 赛灵思公司 | Target compiles for the heterogeneous multiprocessor program of programmable integrated circuit |
CN107239315A (en) * | 2017-04-11 | 2017-10-10 | 北京深鉴智能科技有限公司 | Towards the programming model of neutral net heterogeneous computing platforms |
CN108885546A (en) * | 2016-04-08 | 2018-11-23 | 华为技术有限公司 | A kind of program processing method and device based on heterogeneous system |
CN109522111A (en) * | 2018-11-29 | 2019-03-26 | 北京元心科技有限公司 | Call method, device, electronic equipment and the storage medium of the isomery ecosystem |
CN109656566A (en) * | 2018-12-14 | 2019-04-19 | 北京中科寒武纪科技有限公司 | Heterogeneous computing system executable file acquisition methods, operation method and Related product |
-
2019
- 2019-04-04 CN CN201910271311.4A patent/CN110018831B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140149969A1 (en) * | 2012-11-12 | 2014-05-29 | Signalogic | Source code separation and generation for heterogeneous central processing unit (CPU) computational devices |
CN103744682A (en) * | 2014-01-24 | 2014-04-23 | 中国科学院自动化研究所 | System and method for separate compilation of heterogeneous mixed programs |
CN103744684A (en) * | 2014-01-24 | 2014-04-23 | 中国科学院自动化研究所 | Heterogeneous hardware and software collaborative developing method and system |
CN107111663A (en) * | 2014-11-12 | 2017-08-29 | 赛灵思公司 | Target compiles for the heterogeneous multiprocessor program of programmable integrated circuit |
CN108885546A (en) * | 2016-04-08 | 2018-11-23 | 华为技术有限公司 | A kind of program processing method and device based on heterogeneous system |
CN107239315A (en) * | 2017-04-11 | 2017-10-10 | 北京深鉴智能科技有限公司 | Towards the programming model of neutral net heterogeneous computing platforms |
CN109522111A (en) * | 2018-11-29 | 2019-03-26 | 北京元心科技有限公司 | Call method, device, electronic equipment and the storage medium of the isomery ecosystem |
CN109656566A (en) * | 2018-12-14 | 2019-04-19 | 北京中科寒武纪科技有限公司 | Heterogeneous computing system executable file acquisition methods, operation method and Related product |
Non-Patent Citations (1)
Title |
---|
翟岩龙等: "基于Hadoop的高性能海量数据处理平台研究", 《计算机科学》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021036893A1 (en) * | 2019-08-23 | 2021-03-04 | 中科寒武纪科技股份有限公司 | Data processing method and apparatus, computer device, and storage medium |
CN113031956A (en) * | 2019-12-25 | 2021-06-25 | 中科寒武纪科技股份有限公司 | Program compiling method and device and program running method and device |
Also Published As
Publication number | Publication date |
---|---|
CN110018831B (en) | 2022-11-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108830720B (en) | Intelligent contract running method, device, system and computer readable storage medium | |
CN107431651B (en) | Life cycle management method and equipment for network service | |
CN111831287B (en) | Method, apparatus and program product for determining resources required to execute a code segment | |
CN105022630B (en) | A kind of assembly management system and assembly management method | |
US11699073B2 (en) | Network off-line model processing method, artificial intelligence processing device and related products | |
CN106775744B (en) | Method and device for generating static library | |
KR20170003578A (en) | Code service for language-independent dispatch | |
CN111176629A (en) | Application development method and device | |
CN113805882A (en) | Method and device for developing application program, electronic equipment and storage medium | |
CN114841323A (en) | Processing method and processing device of neural network computation graph | |
CN116149797B (en) | Heterogeneous scene-oriented AI unified computing method, device, equipment and medium | |
CN114841322A (en) | Processing method and processing device of neural network computation graph | |
CN110018831A (en) | Program processing method, device and Related product | |
CN112000334A (en) | Page development method, device, server and storage medium | |
Fortier et al. | Dyninka: a FaaS framework for distributed dataflow applications | |
CN110209565A (en) | A kind of metadata schema adjustment method and its device | |
CN112631563A (en) | System development method and device based on framework, computer equipment and storage medium | |
CN112465112A (en) | nGraph-based GPU (graphics processing Unit) rear-end distributed training method and system | |
CN114449063B (en) | Message processing method, device and equipment | |
CN113626035B (en) | Neural network compiling method facing RISC-V equipment based on TVM | |
CN113703339A (en) | Automatic driving simulation method, device, equipment and storage medium | |
CN113971019A (en) | Data type creating method, device, server and medium | |
CN112612481A (en) | System architecture of intelligent middle station | |
CN111078230A (en) | Code generation method and device | |
CN117591104B (en) | Model generation method and device, electronic equipment and 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 | ||
CB02 | Change of applicant information |
Address after: 100000 room 644, No. 6, No. 6, South Road, Beijing Academy of Sciences Applicant after: Zhongke Cambrian Technology Co.,Ltd. Address before: 100000 room 644, No. 6, No. 6, South Road, Beijing Academy of Sciences Applicant before: Beijing Zhongke Cambrian Technology Co.,Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |