/* UPC nqueens Copyright(C) 2000-2001 Sebastien Chauvin, Tarek El-Ghazawi. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #include "defs.h" /* ITERATION_NUM: number of iterations of the N-Queens algorithm. Running * the algorithm several times allows to get a more accurate execution time. */ #define ITERATION_NUM 40.0 shared int init_ok; shared int number_sols[THREADS]; shared int n,l; shared int method; int main(int argc, char** argv) { int i; int nsols; clock_t clk; /* * Due to current implementation of mask, sizeof(msk_t) has to be 8 bytes! */ assert(sizeof(msk_t)==8); init_ok=1; setbuf(stdout,NULL); if (MYTHREAD==0) { if ((argc!=2) && (argc!=4)) { fprintf(stderr, "Usage: %s n [level job_distribution]\n", argv[0]); fprintf(stderr, "\tn chessboard edge size, 0 < n <=16\n" "\tlevel job distribution depth level\n" "\tjob_distribution one of `chunking' or `round_robin'\n"); init_ok = 0; exit(1); } n=atoi(argv[1]); if ((n<=0) || (n>16)) { fprintf(stderr,"0=n)) { fprintf(stderr,"0<=l