~ubuntu-branches/ubuntu/saucy/nwchem/saucy

« back to all changes in this revision

Viewing changes to src/util/util_file_copy.c

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2012-02-09 20:02:41 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120209200241-jgk03qfsphal4ug2
Tags: 6.1-1
* New upstream release.

[ Michael Banck ]
* debian/patches/02_makefile_flags.patch: Updated.
* debian/patches/02_makefile_flags.patch: Use internal blas and lapack code.
* debian/patches/02_makefile_flags.patch: Define GCC4 for LINUX and LINUX64
  (Closes: #632611 and LP: #791308).
* debian/control (Build-Depends): Added openssh-client.
* debian/rules (USE_SCALAPACK, SCALAPACK): Removed variables (Closes:
  #654658).
* debian/rules (LIBDIR, USE_MPIF4, ARMCI_NETWORK): New variables.
* debian/TODO: New file.
* debian/control (Build-Depends): Removed libblas-dev, liblapack-dev and
  libscalapack-mpi-dev.
* debian/patches/04_show_testsuite_diff_output.patch: New patch, shows the
  diff output for failed tests.
* debian/patches/series: Adjusted.
* debian/testsuite: Optionally run all tests if "all" is passed as option.
* debian/rules: Run debian/testsuite with "all" if DEB_BUILD_OPTIONS
  contains "checkall".

[ Daniel Leidert ]
* debian/control: Used wrap-and-sort. Added Vcs-Svn and Vcs-Browser fields.
  (Priority): Moved to extra according to policy section 2.5.
  (Standards-Version): Bumped to 3.9.2.
  (Description): Fixed a typo.
* debian/watch: Added.
* debian/patches/03_hurd-i386_define_path_max.patch: Added.
  - Define MAX_PATH if not defines to fix FTBFS on hurd.
* debian/patches/series: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 $Id: util_file_copy.c,v 1.12 2003-08-13 18:06:11 edo Exp $
 
2
 $Id: util_file_copy.c 20277 2011-05-05 16:59:07Z d3p852 $
3
3
 */
4
4
 
5
5
#include <stdio.h>
 
6
#include <string.h>
6
7
#if defined(CRAY) && !defined(__crayx1)
7
8
#include <fortran.h>
8
9
#define FATR
9
10
#endif
10
 
#include "global.h"
 
11
#include "ga.h"
11
12
#include "typesf2c.h"
12
13
 
13
14
#if defined(USE_FCD)
30
31
 
31
32
    if (!fin) {
32
33
        fprintf(stderr,"util_file_copy: unable to open %s\n", input);
33
 
        ga_error("util_file_copy",0);
 
34
        GA_Error("util_file_copy",0);
34
35
    }
35
36
    if (!fout) {
36
37
        fprintf(stderr,"util_file_copy: unable to open %s\n", output);
37
 
        ga_error("util_file_copy",0);
 
38
        GA_Error("util_file_copy",0);
38
39
    }
39
40
    while ((nread = fread(buf, 1, sizeof(buf), fin)) > 0)
40
41
        if (fwrite(buf, 1, nread, fout) != nread) {
41
42
            fprintf(stderr,"util_file_copy: failed writing %s\n", output);
42
 
            ga_error("util_file_copy",0);
 
43
            GA_Error("util_file_copy",0);
43
44
        }
44
45
 
45
46
    if (!feof(fin)) {
46
47
        fprintf(stderr,"util_file_copy: failed reading %s\n", input);
47
 
        ga_error("util_file_copy",0);
 
48
        GA_Error("util_file_copy",0);
48
49
    }
49
50
        
50
51
    (void) fclose(fin);
63
64
    FILE *fin=0, *fout=0;
64
65
    Integer differ = strcmp(input,output);
65
66
 
66
 
    if (ga_nodeid_() == 0) {
 
67
    if (GA_Nodeid() == 0) {
67
68
      if (!(fin = fopen(input, "rb"))) {
68
69
        fprintf(stderr,"util_file_copy: unable to open input %s\n", input);
69
 
        ga_error("util_file_parallel_copy",0);
 
70
        GA_Error("util_file_parallel_copy",0);
70
71
      }
71
72
      if (differ) {
72
73
        if (!(fout = fopen(output, "w+b"))) {
73
74
          fprintf(stderr,"util_file_copy: unable to open output %s\n", input);
74
 
          ga_error("util_file_parallel_copy",0);
 
75
          GA_Error("util_file_parallel_copy",0);
75
76
        }
76
77
      }
77
78
    }
78
79
    else if (!(fout = fopen(output, "w+b"))) {
79
80
      fprintf(stderr,"util_file_copy: unable to open output %s\n", input);
80
 
      ga_error("util_file_parallel_copy",0);
 
81
      GA_Error("util_file_parallel_copy",0);
81
82
    }
82
83
 
83
84
    while (1) {
84
85
      char buf[8192];
85
86
      Integer nread, msgnread=44,msgbuf=45,msglen=sizeof(Integer),node0=0;
86
 
      if (ga_nodeid_() == 0)
 
87
      if (GA_Nodeid() == 0)
87
88
        nread = fread(buf, 1, sizeof(buf), fin);
88
 
      ga_brdcst_(&msgnread, &nread, &msglen, &node0);
 
89
      GA_Brdcst(&nread, msglen, node0);
89
90
      if (nread > 0) {
90
 
        ga_brdcst_(&msgbuf, buf, &nread, &node0);
91
 
        if ((ga_nodeid_() != 0) || (differ != 0)) {
 
91
        GA_Brdcst(buf, nread, node0);
 
92
        if ((GA_Nodeid() != 0) || (differ != 0)) {
92
93
          if (fwrite(buf, 1, nread, fout) != nread) {
93
94
            fprintf(stderr,"util_file_parallel_copy: failed writing %s\n", output);
94
 
            ga_error("util_file_parallel_copy",0);
 
95
            GA_Error("util_file_parallel_copy",0);
95
96
          }
96
97
        }
97
98
      }
99
100
        break;
100
101
    }
101
102
        
102
 
    if (ga_nodeid_() == 0) {
 
103
    if (GA_Nodeid() == 0) {
103
104
      if (!feof(fin)) {
104
105
        fprintf(stderr,"util_file_parallel_copy: failed reading %s\n", input);
105
 
        ga_error("util_file_parallel_copy",0);
 
106
        GA_Error("util_file_parallel_copy",0);
106
107
      }
107
108
    }
108
109
        
121
122
#endif
122
123
    char in[255], out[255];
123
124
    if (!fortchar_to_string(input, lin, in, sizeof(in)))
124
 
        ga_error("util_file_copy: fortchar_to_string failed for in",0);
 
125
        GA_Error("util_file_copy: fortchar_to_string failed for in",0);
125
126
    if (!fortchar_to_string(output, lout, out, sizeof(out)))
126
 
        ga_error("util_file_copy: fortchar_to_string failed for out",0);
 
127
        GA_Error("util_file_copy: fortchar_to_string failed for out",0);
127
128
    util_file_copy(in, out);
128
129
}
129
130