[MATLAB] alternativa a maxNumCompThreads()

Strumenti informatici per la matematica applicata, le simulazioni, il disegno: Mathcad, Matlab, Scilab, Microcap, PSpice, AutoCad ...

Moderatori: Foto Utenteg.schgor, Foto Utentedimaios

Avatar utente
Foto UtenteDanteCpp
4.730 3 9 13
Master EY
Master EY
Messaggi: 1106
Iscritto il: 15 dic 2011, 17:51
0
voti

[1] [MATLAB] alternativa a maxNumCompThreads()

Messaggioda Foto UtenteDanteCpp » 3 gen 2016, 16:25

Vorrei limitare il numero di threads a disposizione di una script matlab. Ci sono riuscito con successo, grazie alla funzione maxNumCompThreads(#threads).
Tuttavia all'esecuzione, l'interprete mi avvisa che:

Codice: Seleziona tutto

Warning: maxNumCompThreads will be removed in a future release. Please remove any instances of this function from your code.


qualcuno è a conoscenza di un'alternativa long time support?

Grazie.

Avatar utente
Foto Utentesimo85
30,9k 7 12 13
Disattivato su sua richiesta
Messaggi: 9927
Iscritto il: 30 ago 2010, 4:59
0
voti

[2] Re: [MATLAB] alternativa a maxNumCompThreads()

Messaggioda Foto Utentesimo85 » 5 gen 2016, 0:42

Ciao Foto UtenteDanteCpp, non conosco questo warning ma effettuando una ricerca all'interno della documentazione offline la pagina relativa a maxNumCompThreads riporta:

maxNumCompThreads

Control maximum number of computational threads

Note: maxNumCompThreads will be removed in a future version. You can set the -singleCompThread option when starting MATLAB® to limit MATLAB to a single computational thread. By default, MATLAB makes use of the multithreading capabilities of the computer on which it is running.

Syntax
N = maxNumCompThreads
LASTN = maxNumCompThreads(N)
LASTN = maxNumCompThreads('automatic')

Description

N = maxNumCompThreads returns the current maximum number of computational threads N.

LASTN = maxNumCompThreads(N) sets the maximum number of computational threads to N, and returns the previous maximum number of computational threads, LASTN.

LASTN = maxNumCompThreads('automatic') sets the maximum number of computational threads using what the MATLAB software determines to be the most desirable. It additionally returns the previous maximum number of computational threads, LASTN.

Currently, the maximum number of computational threads is equal to the number of computational cores on your machine.

Note: Setting the maximum number of computational threads using maxNumCompThreads does not propagate to your next MATLAB session.

La versione è la R2015b.

O_/

Avatar utente
Foto UtenteDanteCpp
4.730 3 9 13
Master EY
Master EY
Messaggi: 1106
Iscritto il: 15 dic 2011, 17:51
0
voti

[3] Re: [MATLAB] alternativa a maxNumCompThreads()

Messaggioda Foto UtenteDanteCpp » 5 gen 2016, 9:16

Si, è per questo:

simo85 ha scritto: maxNumCompThreads will be removed in a future version.

che cerco un'alternativa! :mrgreen:

Avatar utente
Foto Utentesimo85
30,9k 7 12 13
Disattivato su sua richiesta
Messaggi: 9927
Iscritto il: 30 ago 2010, 4:59
2
voti

[4] Re: [MATLAB] alternativa a maxNumCompThreads()

Messaggioda Foto Utentesimo85 » 5 gen 2016, 9:31

Sospetto che la alternativa non sia ancora stata definitivamente elaborata. Altrimenti la avrebbero già consigliata, come spesso accade.

Avatar utente
Foto UtenteDanteCpp
4.730 3 9 13
Master EY
Master EY
Messaggi: 1106
Iscritto il: 15 dic 2011, 17:51
1
voti

[5] Re: [MATLAB] alternativa a maxNumCompThreads()

Messaggioda Foto UtenteDanteCpp » 5 gen 2016, 9:37

mi sembra un sospetto fondato, grazie!
:D O_/

Avatar utente
Foto Utentedimaios
30,2k 7 10 12
G.Master EY
G.Master EY
Messaggi: 3381
Iscritto il: 24 ago 2010, 14:12
Località: Behind the scenes
1
voti

[6] Re: [MATLAB] alternativa a maxNumCompThreads()

Messaggioda Foto Utentedimaios » 27 gen 2016, 9:21

Per l'alternativa leggi questo thread sul sito della Mathworks.
Link

Purtroppo la selezione dell'affinità è OS dependent.
Ingegneria : alternativa intelligente alla droga.

Avatar utente
Foto UtenteDanteCpp
4.730 3 9 13
Master EY
Master EY
Messaggi: 1106
Iscritto il: 15 dic 2011, 17:51
0
voti

[7] Re: [MATLAB] alternativa a maxNumCompThreads()

Messaggioda Foto UtenteDanteCpp » 27 gen 2016, 10:10

Grazie Foto Utentedimaios, la soluzione proposta è di scavalcare l'applicazione ordinando all'os il numero di cpu da dedicargli.

Tuttavia questo approccio si rivela poco pratico, se il numero delle unità di calcolo, deve cambiare durante l'esecuzione dello stesso script.

Avatar utente
Foto Utentedimaios
30,2k 7 10 12
G.Master EY
G.Master EY
Messaggi: 3381
Iscritto il: 24 ago 2010, 14:12
Località: Behind the scenes
0
voti

[8] Re: [MATLAB] alternativa a maxNumCompThreads()

Messaggioda Foto Utentedimaios » 27 gen 2016, 12:12

Se devi cambiarlo al volo si. Pensavo si trattasse di riservare al calcolo alcuni thread e al resto gli altri in modo statico.
Ingegneria : alternativa intelligente alla droga.

Avatar utente
Foto UtenteDanteCpp
4.730 3 9 13
Master EY
Master EY
Messaggi: 1106
Iscritto il: 15 dic 2011, 17:51
0
voti

[9] Re: [MATLAB] alternativa a maxNumCompThreads()

Messaggioda Foto UtenteDanteCpp » 27 gen 2016, 12:22

:ok: per gioco ho scritto un PA=LU e volevo confrontarlo con l'algoritmo di matlab al variare dell'ordine di A e dei cores. Ma sono lontano anni luce! :mrgreen:

Devo disassemblare prima tutto il sandy bridge prima di sperare di competere con matlab. :mrgreen:

Grazie comunque per l'interesse.

Avatar utente
Foto Utentedimaios
30,2k 7 10 12
G.Master EY
G.Master EY
Messaggi: 3381
Iscritto il: 24 ago 2010, 14:12
Località: Behind the scenes
0
voti

[10] Re: [MATLAB] alternativa a maxNumCompThreads()

Messaggioda Foto Utentedimaios » 27 gen 2016, 14:30

Auguri! Devo dire che Matlab è criticabile in diverse sezioni di alcuni toolbox ma per quanto riguarda il calcolo matriciale e le fattorizzazioni il lavoro è eccellente.
Nel tempo hanno migliorato gli algoritmi anche per matrici di dimensioni notevoli e sparse.
Siccome le fattorizzazioni sono presenti fin dalle prime versioni è piuttosto difficile riuscire a migliorare le performance all'interno del sistema di sviluppo stesso.
Se esci dall'ambiente Matlab invece puoi fare molte ottimizzazioni ma questo è un altro discorso.
Ingegneria : alternativa intelligente alla droga.


Torna a “Programmi applicativi: simulatori, CAD ed altro”