DPLACE(3) DPLACE(3) NAME dplace_file, dplace_line, libdplace - a library interface to dplace C SYNOPSIS void dplace_file( char *filename); void dplace_line( char *line); FORTRAN SYNOPSIS CHARACTER*n string CALL dplace_file( string) CALL dplace_line( string) DESCRIPTION These library routines provide high level access to a subset of the memory management and control mechanisms of IRIX. Dynamic dplace(1) functionality is provided from within a user's program. The first form takes a filename as an argument and all commands within the file are processed. The second form operates on a single command. Errors are handled in the same way as dplace(1); the program exits and a diagnostic message is printed to standard error. The library can be used with or without using dplace(1). EXAMPLE CODE Here is a fragment of FORTRAN code CHARACTER*128 s np = mp_numthreads() WRITE(s,*) 'memories ',np,' in cube' CALL dplace_line(s) WRITE(s,*) 'threads ',np CALL dplace_line(s) DO i=0, np-1 WRITE(s,*) 'run thread',i,' on memory',i CALL dplace_line(s) head = %loc( a( 1+i*(n/np) ) ) tail = %loc( a( (i+1)*(n/np) ) ) WRITE(s,*) 'place range',head,' to',tail,' on memory',i CALL dplace_line(s) END DO DO i=0, np-1 WRITE(s,*) 'move thread',i,' to memory',np-1-i CALL dplace_line(s) END DO DO i=0, np-1 head = %loc( a( 1+i*(n/np) ) ) tail = %loc( a( (i+1)*(n/np) ) ) WRITE(s,*) 'migrate range',head,' to',tail,' to memory',np-1-i CALL dplace_line(s) END DO and here is a C language code fragment: main(){ /* C example code */ ... dplace_file("initial_placement_file"); ... ... data initialization,sprocs etc. ... for(i=0;i<nthreads;i++){ sprintf(cmd,"run thread %d on memory %d\n",i,i/2); dplace_line(cmd); ... sprintf(cmd,"migrate range %d to %d to memory %d\n" ,&a[i*size],&a[(i+1)size-1],i/2); dplace_line(cmd); ... } } When linking C or FORTRAN programs, the flag -ldplace will automatically invokes the correct libdplace library. FILES /usr/lib/libdplace.so /usr/lib64/libdplace.so /usr/lib32/libdplace.so DEPENDENCIES These procedures are only available on NUMA systems. In order to avoid conflicts with Fortran's libmp, it is advisable to set the environment variable _DSM_OFF to disable libmp's NUMA functionality before running programs that are linked with libdplace. BUGS Operations on the default policy module, such as the setting of default page sizes, should be done prior to an exec call to take effect. For example, setting the data page size with dplace_line or dplace_file from the program in question will not have the desired effect. SEE ALSO Page 3