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

« back to all changes in this revision

Viewing changes to tune/sysinfo/findNT.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-06-11 15:58:16 UTC
  • mfrom: (1.1.3 upstream)
  • mto: (2.2.21 experimental)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: package-import@ubuntu.com-20130611155816-b72z8f621tuhbzn0
Tags: upstream-3.10.1
Import upstream version 3.10.1

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
 
   exit(0);
47
 
}
48
 
#endif