/* This is a sample of how to call geng as a procedure in multiple threads. *Usage:callgeng2[-N#]geng_args *Theargumentof-Nisthenumberofthreads(default10,maximum100). *Itmustbelinkedwithaversionofgengandnautythathasbeencompiled *withthethread-localattribute. *ThewaytocompilethisprogramperthePosixstandardandrecentgcccompilers *islikethis: gcc-ocallgeng2-O3-march=native-pthread-DMAXN=WORDSIZE-DWORDSIZE=32\ -DUSE_TLS-DGENG_MAIN=geng_main-DSUMMARY=geng_summary\ callgeng2.cgeng.cnautyW1.a *Youmightalsoneedtoadd-lpthreador-lpthreadstothecompilation. *Onsomesystemstheseinstructionswillneedmodification. * *Ifoutputisnotturnedoffusing-u,graphsarewrittentostdout.Eachgraph *iswrittenusingasinglefwrite()call,whichisatomiconLinuxforsuch *shortstringsbutthereisnoguaranteethattheoutputwon'tgetmixedtogether *onothersystems.Sincethisisonlyashortdemonstration,Iwon'ttryto *fixthat,butifyouknowthreadprogrammingyoucanfigureoutawaytohave *asinglethreaddoallthewriting(usethehookOUTPROC,seecallgeng.c). *Meanwhile,ifyoujustwanttocountandnotwrite,youdon'tneedtoworry *aboutthat.
*/
static nauty_counter count[MAXTHREADS]; /* Thread i only writes to count[i]. */ static TLS_ATTR int threadnumber; typedefstruct params { int res,mod; char **args; } params;
void SUMMARY(nauty_counter num, double cpu) /* This will be called from each geng thread as it finishes. */
{
count[threadnumber] = num;
}
/* Declare the main procedure of geng (usually main()) */ int GENG_MAIN(int argc, char *argv[]);
staticvoid*
runit(void *threadarg) /* Main routine for one thread */
{
params *par; int geng_argc; char resmod[30]; /* string to put res/mod into */ char *geng_argv[MAXGENGARGS+2]; /* At least one bigger than geng_argc. */ char **args;
par = (params*)(threadarg);
threadnumber = par->res;
args = par->args;
/* Set up geng argument list. The 0-th argument is the command name.
* There must be a NULL at the end. */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.