[Nauty-list] Multithreading

Susanne Niess niess at ma.tum.de
Thu Jan 12 23:17:52 EST 2012


Hi,

Can I use the function nauty in a programme with multithreading? When I tried it, there seemed to be a problem but maybe I just tried the wrong way. I tested my programme with Valgrind that monitors the computer's memory and it produced the error messages below. It might have to do with static variables, as they are not compatible with multithreading. I saw the keyword "static" in the source code of nauty several times but used in a way that I do not know. As a comment mentioned that local functions have been made static, I suppose there is an alternative although I do not know how because I have never worked with local functions. Is there a nauty version that I can use with multithreading?

The lines mentioned in the error messages below are the following:
512: lab=(int*)malloc(lm*sizeof(int));
520: ptn=(int*)malloc(lm*sizeof(int));
539: DYNALLOC1(setword,workspace,workspace_sz,50*m,"malloc");
1193: nauty(an,lab,ptn,NULL,orbits,&options,&stats,workspace,50*m,m,lm,en);

==1860== Invalid write of size 4
==1860==    at 0x40EF9B: breakout (in /home/susanne/h/hre)
==1860==    by 0x40C637: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40C674: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40C674: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40D4AA: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40D4AA: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x2e888dd4 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403B8E: aaa (hre.c:512)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid write of size 4
==1860==    at 0x40EFA9: breakout (in /home/susanne/h/hre)
==1860==    by 0x40C637: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40C674: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40C674: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40D4AA: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40D4AA: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x2e888e74 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403BE7: aaa (hre.c:520)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Thread 5:
==1860== Invalid read of size 4
==1860==    at 0x40EFA7: breakout (in /home/susanne/h/hre)
==1860==    by 0x40D24A: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x54d1964 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403B8E: aaa (hre.c:512)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid write of size 4
==1860==    at 0x40EF9B: breakout (in /home/susanne/h/hre)
==1860==    by 0x40D24A: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x54d1964 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403B8E: aaa (hre.c:512)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid read of size 4
==1860==    at 0x40EF98: breakout (in /home/susanne/h/hre)
==1860==    by 0x40D24A: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x54d1968 is 4 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403B8E: aaa (hre.c:512)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Thread 2:
==1860== Conditional jump or move depends on uninitialised value(s)
==1860==    at 0x40EFA7: breakout (in /home/susanne/h/hre)
==1860==    by 0x40D24A: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Uninitialised value was created by a heap allocation
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403D1A: aaa (hre.c:539)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid read of size 4
==1860==    at 0x413DD8: targetcell (in /home/susanne/h/hre)
==1860==    by 0x40EDCB: maketargetcell (in /home/susanne/h/hre)
==1860==    by 0x40C966: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x53aa314 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403BE7: aaa (hre.c:520)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid read of size 4
==1860==    at 0x413EA8: targetcell (in /home/susanne/h/hre)
==1860==    by 0x40EDCB: maketargetcell (in /home/susanne/h/hre)
==1860==    by 0x40C966: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x53aa274 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403B8E: aaa (hre.c:512)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid read of size 4
==1860==    at 0x413EC5: targetcell (in /home/susanne/h/hre)
==1860==    by 0x40EDCB: maketargetcell (in /home/susanne/h/hre)
==1860==    by 0x40C966: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x53aa314 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403BE7: aaa (hre.c:520)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid read of size 4
==1860==    at 0x413B00: cheapautom (in /home/susanne/h/hre)
==1860==    by 0x40C5BF: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x53aa314 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403BE7: aaa (hre.c:520)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid read of size 4
==1860==    at 0x414870: refine1 (in /home/susanne/h/hre)
==1860==    by 0x40F561: doref (in /home/susanne/h/hre)
==1860==    by 0x40C346: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40C674: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x53aa314 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403BE7: aaa (hre.c:520)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid read of size 4
==1860==    at 0x4148CB: refine1 (in /home/susanne/h/hre)
==1860==    by 0x40F561: doref (in /home/susanne/h/hre)
==1860==    by 0x40C346: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40C674: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x53aa274 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403B8E: aaa (hre.c:512)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid write of size 4
==1860==    at 0x4148D1: refine1 (in /home/susanne/h/hre)
==1860==    by 0x40F561: doref (in /home/susanne/h/hre)
==1860==    by 0x40C346: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40C674: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x53aa274 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403B8E: aaa (hre.c:512)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid read of size 4
==1860==    at 0x41416B: refine1 (in /home/susanne/h/hre)
==1860==    by 0x40F561: doref (in /home/susanne/h/hre)
==1860==    by 0x40C346: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40C674: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x53aa314 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403BE7: aaa (hre.c:520)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==
==1860== Invalid read of size 4
==1860==    at 0x414829: refine1 (in /home/susanne/h/hre)
==1860==    by 0x40F561: doref (in /home/susanne/h/hre)
==1860==    by 0x40C346: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40C674: othernode0 (in /home/susanne/h/hre)
==1860==    by 0x40D2B6: firstpathnode0 (in /home/susanne/h/hre)
==1860==    by 0x40E326: nauty (in /home/susanne/h/hre)
==1860==    by 0x408C14: aaa (hre.c:1193)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==  Address 0x53aa274 is 0 bytes after a block of size 84 alloc'd
==1860==    at 0x4C24838: malloc (vg_replace_malloc.c:236)
==1860==    by 0x403B8E: aaa (hre.c:512)
==1860==    by 0x4E308B9: start_thread (pthread_create.c:300)
==1860==









More information about the Nauty mailing list