~ubuntu-branches/ubuntu/vivid/atlas/vivid

« back to all changes in this revision

Viewing changes to tune/sysinfo/findNT.c

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2002-04-13 10:07:52 UTC
  • Revision ID: james.westby@ubuntu.com-20020413100752-va9zm0rd4gpurdkq
Tags: upstream-3.2.1ln
ImportĀ upstreamĀ versionĀ 3.2.1ln

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifdef ATL_NCPU
 
2
 
 
3
#include "atlas_misc.h"
 
4
#include "assert.h"
 
5
 
 
6
void PrintUsage(char *nam)
 
7
{
 
8
   fprintf(stderr, "\nUSAGE: %s [-o <outfile>]\n", nam);
 
9
   exit(-1);
 
10
}
 
11
 
 
12
void GetFlags(int nargs, char **args, FILE **fpout)
 
13
{
 
14
   int i;
 
15
 
 
16
   *fpout=stdout;
 
17
   for (i=1; i < nargs; i++)
 
18
   {
 
19
      if (args[i][0] != '-') PrintUsage(args[0]);
 
20
      switch(args[i][1])
 
21
      {
 
22
      case 'o':
 
23
         *fpout = fopen(args[++i], "w");
 
24
         assert(*fpout);
 
25
         break;
 
26
      default:
 
27
         PrintUsage(args[0]);
 
28
      }
 
29
   }
 
30
}
 
31
 
 
32
main(int nargs, char **args)
 
33
{
 
34
   FILE *fpout;
 
35
   GetFlags(nargs, args, &fpout);
 
36
 
 
37
   fprintf(fpout, "#ifndef ATLAS_NTHREADS_H\n   #define ATLAS_NTHREADS_H\n\n");
 
38
   fprintf(fpout, "   #include \"pthread.h\"\n");
 
39
   #if ATL_NCPU != 0
 
40
      fprintf(fpout, "   #define ATL_NTHREADS %d\n", ATL_NCPU);
 
41
   #else
 
42
      fprintf(fpout, "   #define ATL_NTHREADS 4\n");
 
43
   #endif
 
44
   fprintf(fpout, "\n#endif\n");
 
45
   fclose(fpout);
 
46
}
 
47
#endif