Running single function with multple inputs on each different core.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Parth Patel
am 25 Jun. 2020
Bearbeitet: Parth Patel
am 27 Jun. 2020
Hello everyone, i am new to matlab and want to exceute my function for multiple input data to get faster results by using multiple cores.
Here is an abstract interpretation of my code:
parfor i=1:7
Result(:,i)= Func(i);
end
PROBLEM:
Func(): is madeup of several small functions , and they are executed in random order, which is not intended.
GOAL:
Execute Func(i) , such that:
Func(1): runs on Core-1
Func(2):runs on Core-2
........ so on upto 4 core.(I have 4-core i7-7700HQ).
QUESTION:
is it possicle to do so?.If yes, could any one please expalin with help of small example ?
Thanks in adavnce.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 27 Jun. 2020
Func(): is madeup of several small functions , and they are executed in random order, which is not intended.
The order that parfor iterations are executed in is deliberately unspecified, and can vary. However, the last iteration is one of the first started, so as to be able to initialize any output arrays to their full size.
Func(1): runs on Core-1
MATLAB does not provide any way to lock a process to a particular core. If you are using MS Windows then there are several ways that you can set a processor affinity; see a summary at http://smallvoid.com/article/winnt-process-affinity.html
Setting a processor affinity typically only helps when there is hardware attached to one particular node that you need to be able to interrupt faster -- you bind the interrupt handling process to a core on the board the hardware is most closely attached to. In other cases, setting processor affinity can reduce performance, as an affinity-bound process cannot switch to another available core when it is not in control of the core it set bound to. Remember that operating system activities, firewalls, anti-virus, browsers, user interfaces, and so on all need access to a core, so you cannot just bind one compute process per core and expect everything to go smoothly.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!