read_input.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // Copyright 2010 Intel Corporation
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. #include <stdio.h>
  17. #include "applu_share.h"
  18. void read_input() {
  19. int root;
  20. //c---------------------------------------------------------------------
  21. //c only root does initializtion, it uses defaults
  22. //c ipr = 1 for detailed progress output
  23. //c inorm = how often the norm is printed (once every inorm iterations)
  24. //c itmax = number of pseudo time steps
  25. //c dt = time step
  26. //c omega 1 over-relaxation factor for SSOR
  27. //c tolrsd = steady state residual tolerance levels
  28. //c nx, ny, nz = number of grid points in x, y, z directions
  29. //c---------------------------------------------------------------------
  30. root = 0;
  31. ipr = ipr_default;
  32. inorm = inorm_default;
  33. itmax = itmax_default;
  34. dt = dt_default;
  35. omega = omega_default;
  36. tolrsd[0] = tolrsd1_def;
  37. tolrsd[1] = tolrsd2_def;
  38. tolrsd[2] = tolrsd3_def;
  39. tolrsd[3] = tolrsd4_def;
  40. tolrsd[4] = tolrsd5_def;
  41. nx0 = isiz01;
  42. ny0 = isiz02;
  43. nz0 = isiz03;
  44. if (id == root) {
  45. //c---------------------------------------------------------------------
  46. //c check problem size
  47. //c---------------------------------------------------------------------
  48. if (num != nnodes_compiled) {
  49. printf("Warning: program is running on %d processors ", num);
  50. printf("but was compiled for %d\n", nnodes_compiled);
  51. }
  52. if ( nx0 < 4 || ny0 < 4 || nz0 < 4 ) {
  53. printf("PROBLEM SIZE IS TOO SMALL\n");
  54. }
  55. if (nx0 > isiz01 || ny0 > isiz02 || nz0 > isiz03 ) {
  56. printf("PROBLEM SIZE IS TOO LARGE\n");
  57. }
  58. printf("\nNAS Parallel Benchmarks 3.3 -- LU Benchmark\n");
  59. printf("Size: %d %d %d\n", nx0, ny0, nz0);
  60. printf("Iterations: %d\n", itmax);
  61. printf("Number of processes: %d\n", num);
  62. }
  63. return;
  64. }