ProgramParameters.h
上传用户:chinafayin
上传日期:2022-04-05
资源大小:153k
文件大小:3k
源码类别:

并行计算

开发平台:

Visual C++

  1. /*
  2.     FastGrid (formerly AutoGrid)
  3.     Copyright (C) 2009 The Scripps Research Institute. All rights reserved.
  4.     Copyright (C) 2009 Masaryk University. All rights reserved.
  5.     AutoGrid is a Trade Mark of The Scripps Research Institute.
  6.     This program is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU General Public License
  8.     as published by the Free Software Foundation; either version 2
  9.     of the License, or (at your option) any later version.
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.     You should have received a copy of the GNU General Public License
  15.     along with this program; if not, write to the Free Software
  16.     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  17. */
  18. #pragma once
  19. #include "autogrid.h"
  20. #include "electrostatics/CudaUtils.h"
  21. enum ExtendedBool
  22. {
  23.     False = 0,
  24.     True = 1,
  25.     Unassigned = -1
  26. };
  27. class ProgramParameters
  28. {
  29. public:
  30.     ProgramParameters(int argc, char **argv);
  31.     const char *getProgramName() const              { return programName; }
  32.     const char *getGridParameterFilename() const    { return gridParameterFilename; }
  33.     const char *getLogFilename() const              { return logFilename; }
  34.     int getDebugLevel() const                       { return debug; }
  35.     bool benchmarkEnabled() const                   { return benchmark; }
  36.     bool useNNS() const                             { return nns; }
  37.     bool useCutoffGrid() const                      { return cutoffGrid; }
  38.     bool useCUDA() const                            { return cuda; }
  39.     bool useCUDAThread() const                      { return cudaThread; }
  40.     bool calcSlicesSeparatelyCUDA() const           { return calcSlicesSeparately; }
  41.     ExtendedBool unrollLoopCUDA() const             { return cudaUnroll; }
  42.     int getDeviceIDCUDA() const                     { return deviceID; }
  43.     DielectricKind getDDDKindCUDA() const           { return cudaDDDKind; }
  44.     bool useVersion4() const                        { return v4; }
  45.     int getCutoffGridMemoryLimit() const            { return cutoffGridMem; }
  46. private:
  47.     char programName[MAX_CHARS];
  48.     char gridParameterFilename[MAX_CHARS];
  49.     char logFilename[MAX_CHARS];
  50.     int debug, deviceID, cutoffGridMem;
  51.     bool benchmark, nns, cutoffGrid, cuda, cudaThread, calcSlicesSeparately, v4;
  52.     ExtendedBool cudaUnroll;
  53.     DielectricKind cudaDDDKind;
  54.     void parse(int argc, char **argv);
  55.     void cudaEnumDevicesAndExit();
  56.     void readParamString(int *argc, char ***argv, char *out);
  57.     int readParamInt(int *argc, char ***argv);
  58.     void printHelpAndExit();
  59.     void setTimeout(int seconds);
  60.     bool cmp(const char *s1, const char *s2);
  61.     bool cmp2(const char *s1, const char *s2, const char *s3);
  62. };