Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Switch a gcc-{4.5,4.6,4.7,4.8,4.9,5.x,6.x,7.x,8.x,9.x}
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian)
View previous topic :: View next topic  
Author Message
ago
Developer
Developer


Joined: 01 Mar 2008
Posts: 1527
Location: Milan, Italy

PostPosted: Mon Jul 25, 2011 1:31 pm    Post subject: Switch a gcc-{4.5,4.6,4.7,4.8,4.9,5.x,6.x,7.x,8.x,9.x} Reply with quote

Questo topic vuole raccogliere l'attenzione di tutti coloro che non usano -march=native ma preferiscono specificare manualmente evitando tutte le ottimizzazioni che native include.

Mi sono accorto che con il passaggio a gcc-4.5.3 e gcc-4.6.2 il mio -march sul portatile è passato da prescott a pentium-m e sul fisso da core2 a corei7. Quindi onde evitare di affidarvi a documentazione/i poco aggiornate, potete controllare il vostro con:

Code:
gcc -march=native -E -v - </dev/null 2>&1 | sed -n 's/.* -v - //p'


ovviamente dopo aver fatto lo switch di gcc da gcc-config e aver lanciato source /etc/profile come il relativo warning suggerisce ;)

P.S. Aprirò un bug per vedere se inseriscono una cosa simile nella doc ufficiale.


Last edited by ago on Wed May 29, 2019 8:16 am; edited 6 times in total
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Mon Jul 25, 2011 1:39 pm    Post subject: Reply with quote

Quindi ora sparisce la march core2 e la si può sostituire tranquillamente con corei7 se non ho capito male.
Questa modifica quando va fatta?
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
ago
Developer
Developer


Joined: 01 Mar 2008
Posts: 1527
Location: Milan, Italy

PostPosted: Mon Jul 25, 2011 1:46 pm    Post subject: Reply with quote

Quando aggiorni il tuo gcc fai un controllo, e inserisci quello che fa per te.
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4831
Location: somewhere in L.O.S.

PostPosted: Mon Jul 25, 2011 5:20 pm    Post subject: Reply with quote

march core2 non sparisce (almeno per il momento), solo che invece di -march=core2 -msse4 etc. (non ho voglia di andarmi a vedere quali sono le flag implicite) basterà scrivere solo -march=corei7.
Il risultato in linea di massima non cambia quindi non c'è da andare a ricompilare il sistema ma è meglio tenere i parametri aggiornati.

@ago: del bug di gcc -Q --help=target -march=native che non riporta le sse attivate (per dirne una) si sa qualcosa?
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Sun Aug 07, 2011 11:37 pm    Post subject: Reply with quote

Non so come funziona per gcc-4.6 (che è hardmasked) ma per il 4.5 pare che valga ancora questa cosa:
http://en.gentoo-wiki.com/wiki/Hardware_CFLAGS
Ovvero che -mtune=generic funzioni meglio di -mtune=core2, e quindi anche di -march=native quando applicata ad un processore core2
Non penso che cambi il mondo eh... ma visto che passavo di qui per controllare cosa succedeva col gcc nuovo ho pensato di far notare come non sempre una brand new option in gcc si traduca sempre in un vantaggio :wink:
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
ago
Developer
Developer


Joined: 01 Mar 2008
Posts: 1527
Location: Milan, Italy

PostPosted: Tue Sep 13, 2011 10:35 pm    Post subject: Reply with quote

@djinnz

da me funzia =) gcc 4.4.5. Ti riferisci a bug in versioni maggiori o uguali di 4.5?

Cazzantonio wrote:
Ovvero che -mtune=generic funzioni meglio di -mtune=core2, e quindi anche di -march=native quando applicata ad un processore core2Non penso che cambi il mondo eh... ma visto che passavo di qui per controllare cosa succedeva col gcc nuovo ho pensato di far notare come non sempre una brand new option in gcc si traduca sempre in un vantaggio :wink:


Ci sono sul fatto che: "feature nuova" = non sempre beneficio e miglioramento, ma non capito in che modo è legato a questo caso/esempio
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Wed Sep 14, 2011 7:12 am    Post subject: Reply with quote

Mi riferisco a quella pagina dello wiki che ho linkato. Non ho fatto test estensivi, ma in alcune simulazioni numeriche della durata di qualche ora pare ci sia un leggero vantaggio nell'usare mtune=generic
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
table
Apprentice
Apprentice


Joined: 17 Feb 2007
Posts: 279
Location: Gazzaniga (BG) Italy

PostPosted: Tue Sep 20, 2011 7:21 am    Post subject: Reply with quote

Ho una CPU sandy bridge (core i5-2410).
Il gcc 4.52 me lo riconosce ancora come "core2" , devo aspettare il 4.6 ? :cry:
_________________
Pulisci l'html con:
Code:
sed 's/<[Bb][Rr][ \t]*\/*>/\n/g;s/<\/*[^>]\+\/*>//g'

skype: matteopinguino
Back to top
View user's profile Send private message
ago
Developer
Developer


Joined: 01 Mar 2008
Posts: 1527
Location: Milan, Italy

PostPosted: Tue Sep 20, 2011 12:21 pm    Post subject: Reply with quote

table wrote:
Ho una CPU sandy bridge (core i5-2410).
Il gcc 4.52 me lo riconosce ancora come "core2" , devo aspettare il 4.6 ? :cry:


L'importante è usare il -march corretto. Ad ogni modo sta per essere stabilizzato gcc-4.5.3-r1
Back to top
View user's profile Send private message
ChemMir
n00b
n00b


Joined: 03 Mar 2005
Posts: 28
Location: Italy

PostPosted: Fri Oct 14, 2011 6:36 am    Post subject: Reply with quote

Ciao!
per ragioni computazionali dovrei provare ad usare gcc 4.6.1-r1 (l'ultimo uscito), su Opteron 6168.
Mi serve il compilatore gfortran. Pare infatti che le librerie ACML 5.0.0 si possano usare solo con gcc > 4.6

Ho due domande:
1) una volta modificati /etc/portage/package.keywords e /etc/portage/package.unmask basta fare 'emerge gcc'. Scusate l'ignoranza, ma come posso selezionare gcc 4.6 per i miei test dicompilazione e tornare al 4.5.3 per le normali operazioni? uso gcc-config?

2) quali opt sono meglio per Opteron 6168?
Per ora uso -march=native -msse4a

Grazie!

Edit: in effetti gli switch che uso con gcc 4.5.3 sono: -march=native -m64 -msse4a -O3 -mveclibabi=acml
_________________
Tyan Tiger K8W (S2875) - dual Opteron 248 - Sil3114 SATA RAID - 2 Gb RAM - Radeon 9200SE-T
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4831
Location: somewhere in L.O.S.

PostPosted: Fri Oct 14, 2011 11:36 am    Post subject: Reply with quote

ChemMir wrote:
uso gcc-config?
si, puoi anche pensare di creare un utente dedicato e lasciare il gcc di sistema com'è.
Se vuo mantenere il vecchio gcc senza rischiare che un depclean te lo pialli ricorda di dare un emerge -n =sys-devel/gcc-versione o sys-devel/gcc:slot (come si dovrebbe fare con i kernel)
ChemMir wrote:
Per ora uso -march=native -msse4a
ago ha postato un comando, vedi cosa riporta e vai a vedere sulla documentazione ufficiale di gcc cosa implica -march (ci sarebbe un altro metodo con --help= ma attualmente non funziona molto bene, potresti provare a vedere se hanno risolto)
ChemMir wrote:
-march=native -m64 -msse4a -O3 -mveclibabi=acml
tutte altamente sconsigliate in make.conf
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
Onip
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2912
Location: Parma (Italy)

PostPosted: Fri Oct 14, 2011 11:38 am    Post subject: Reply with quote


  1. proprio ieri è stata aggiornata la guida all'aggiornamento di gcc. Per gestirlo ti basta entrare in una shell di root e cambiare il profilo con gcc-config e riaggiornare l'environment (vedi comandi nella guida). Dopo basta entrare in una nuova shell di login e vedrai che gcc -v ti darà la nuova versione. Per degli esperimenti e delle compilazioni "private" di tuoi progetti probabilmente puoi evitarti la ricompilazione di libtool che è spiegata nella guida.
    Per tornare indietro ti basta semplicemente ripetere gcc-config e env-update.

    A quello che so non è, purtroppo, possibile impostare un gcc specifico per ogni utente (a meno di giocare con ~/.bashrc e le variabili d'ambiente credo) come è, invece, possibile fare con java-config.

_________________
Linux Registered User n. 373835

Titus Lucretius Carus, De Rerum Natura - Tantum religio potuit suadere malorum
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4831
Location: somewhere in L.O.S.

PostPosted: Fri Oct 14, 2011 12:00 pm    Post subject: Reply with quote

gcc-config -E :roll:
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
ChemMir
n00b
n00b


Joined: 03 Mar 2005
Posts: 28
Location: Italy

PostPosted: Fri Oct 14, 2011 12:57 pm    Post subject: Reply with quote

Grazie per le risposte. Appena ho un attimo di tempo provo con la guida nella speranza di non piallare tutto sulla macchina che sta facendo calcoli...
djinnZ wrote:
ChemMir wrote:
-march=native -m64 -msse4a -O3 -mveclibabi=acml
tutte altamente sconsigliate in make.conf

Non sono in make.conf, ma nel Makefile del pacchetto sorgente che devo compilare. Per quale motivo non vanno bene? Solo nel make.conf o in generale? A me serve la massima velocità di esecuzione per questo eseguibile, e mi serve poter sfruttare al max l'opteron (quindi con librerie vettoriali...).

Ho eseguito il comando
Code:
gcc -march=native -E -v - </dev/null 2>&1 | sed -n 's/.* -v - //p'

ed ecco il risultato:
Code:
-D_FORTIFY_SOURCE=2 -march=amdfam10 -mcx16 -msahf -mpopcnt -mabm --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=amdfam10


Sembra che qui tutto quasi normale... o no?
_________________
Tyan Tiger K8W (S2875) - dual Opteron 248 - Sil3114 SATA RAID - 2 Gb RAM - Radeon 9200SE-T
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4831
Location: somewhere in L.O.S.

PostPosted: Fri Oct 14, 2011 2:28 pm    Post subject: Reply with quote

dopo aver installato l'altro gcc (dopo) prova a vedere con quello native cosa implica. Potrebbe essere che con il 4.6 -march=native renda ridondante -msse4a per dirne una.

-m64 è sconsigliato come impostazione globale sui sistemi "multilib" per ovvie ragioni, -mveclibabi è da utilizzare solo per un singolo pacchetto, -O3 su gcc > 3.6 in genere è controproducente per le prestazioni se non dannoso su molti pacchetti e librerie di base (e mai compilare gcc libc e non ricordo quali altri con quella opzione).

Da evitare in make.conf non in una singola linea di comando od in un singolo pacchetto, se sai quel che stai facendo può essere utile.

Nota che appartengo alla scuola di quelli che non vogliono saperne di usare native se non per verifica una tantum.
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
ChemMir
n00b
n00b


Joined: 03 Mar 2005
Posts: 28
Location: Italy

PostPosted: Fri Oct 14, 2011 4:01 pm    Post subject: Reply with quote

Grazie ancora. Appena la macchina finisce di far calcoli (forse ci va l'intero week-end) provo a ricompilare (Quantum Espresso) e fare test di velocità. Per me è fondamentale sfruttare al max l'hardware (48 core) e far andare al max il software (OpenMP e/o OpenMPI). Bei tempi in cui programmavo in assembler 6502... ora non saprei da dove cominciare...
_________________
Tyan Tiger K8W (S2875) - dual Opteron 248 - Sil3114 SATA RAID - 2 Gb RAM - Radeon 9200SE-T
Back to top
View user's profile Send private message
ago
Developer
Developer


Joined: 01 Mar 2008
Posts: 1527
Location: Milan, Italy

PostPosted: Fri Oct 14, 2011 4:12 pm    Post subject: Reply with quote

@ChemMir

Anche se non sembra sei un pochino off-topic. Questo thread voleva informare gli utenti che i parametri cambiano con le nuove versioni di gcc. Se ti serve maggiore supporto apri un thread nuovo.
Back to top
View user's profile Send private message
bandreabis
Advocate
Advocate


Joined: 18 Feb 2005
Posts: 2489
Location: イタリアのロディで

PostPosted: Tue Nov 08, 2011 1:12 pm    Post subject: Reply with quote

Con gcc-4.5.3-r1 posso già provare il comando?
Ho un Turio64 e per ora ho
Code:
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -msse3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Andrea
_________________
Il numero di post non fa di me un esperto! Anzi!
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Tue Nov 08, 2011 1:20 pm    Post subject: Reply with quote

Sì, funziona! Funzionava anche in qualche versione precedente.
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
bandreabis
Advocate
Advocate


Joined: 18 Feb 2005
Posts: 2489
Location: イタリアのロディで

PostPosted: Tue Nov 08, 2011 6:38 pm    Post subject: Reply with quote

bandreabis wrote:
Con gcc-4.5.3-r1 posso già provare il comando?
Ho un Turio64 e per ora ho
Code:
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -msse3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Andrea


Ecco il responso:
Code:
-D_FORTIFY_SOURCE=2 -march=k8-sse3 -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=1024 -mtune=k8

_________________
Il numero di post non fa di me un esperto! Anzi!
Back to top
View user's profile Send private message
fbcyborg
Advocate
Advocate


Joined: 16 Oct 2005
Posts: 3056
Location: ROMA

PostPosted: Tue Nov 08, 2011 6:40 pm    Post subject: Reply with quote

OK, nel mio caso esce core2.
_________________
[HOWTO] Come criptare la /home usando cryptsetup e luks
[HOWTO] Abilitare il supporto al dom0 XEN su kernel 3.X
Help answer the unanswered
Back to top
View user's profile Send private message
ago
Developer
Developer


Joined: 01 Mar 2008
Posts: 1527
Location: Milan, Italy

PostPosted: Tue Nov 08, 2011 6:53 pm    Post subject: Reply with quote

bandreabis wrote:
Ecco il responso:
Code:
-D_FORTIFY_SOURCE=2 -march=k8-sse3 -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=1024 -mtune=k8


Bene, cambia impostazioni =)
Back to top
View user's profile Send private message
bandreabis
Advocate
Advocate


Joined: 18 Feb 2005
Posts: 2489
Location: イタリアのロディで

PostPosted: Tue Nov 08, 2011 7:28 pm    Post subject: Reply with quote

ago wrote:
bandreabis wrote:
Ecco il responso:
Code:
-D_FORTIFY_SOURCE=2 -march=k8-sse3 -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=1024 -mtune=k8


Bene, cambia impostazioni =)


Quindi
Code:
CFLAGS="-march=k8-sse3 -O2 -pipe -fomit-frame-pointer"
:?:
_________________
Il numero di post non fa di me un esperto! Anzi!
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4831
Location: somewhere in L.O.S.

PostPosted: Tue Nov 08, 2011 7:58 pm    Post subject: Reply with quote

no
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
bandreabis
Advocate
Advocate


Joined: 18 Feb 2005
Posts: 2489
Location: イタリアのロディで

PostPosted: Tue Nov 08, 2011 10:16 pm    Post subject: Reply with quote

djinnZ wrote:
no

Lo sapevo.
Come funziona allora?
_________________
Il numero di post non fa di me un esperto! Anzi!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum