[SCore-users-jp] Re: [SCore-users] unformatted io bug gnu mpif77 score 5.8.x
Nick Birkett
nick @ streamline-computing.com
2005年 2月 25日 (金) 19:59:38 JST
kameyama @ pccluster.org wrote:
> In article <4219E993.7010108 @ streamline-computing.com> Nick Birkett <nick @ streamline-computing.com> wrotes:
>>Platforms: RedHat 7.3,9 Score 5.8.2
>> SuSE Linux 9 64bit Score 5.8.1
>>
>>When using unformatted IO in fortran, the files
>>produced are incorrect when compiling with
>>
>>mpif77 -compiler gnu
>>
>>However
>>
>>mpif77 -compiler intel8
>>
>>mpif77 -compiler pgi
>>
>>give the correct answer.
>>
>>
>>Some test programs attached.
>>
>>Under Score 5.6.1 all compilers give correct answer.
>
> Sorry, this is bug on scwrap.
> Please apply this patch on the following file:
> score-src/SCore/sclib/scwrap/lib/scwrap.c
>
> from Kameyama Toyohisa
> ---------------------------------------cut here---------------------------------
> Index: scwrap.c
> ===================================================================
> RCS file: /develop/cvsroot/score-src/SCore/sclib/scwrap/lib/scwrap.c,v
> retrieving revision 1.28
> retrieving revision 1.32
> diff -u -r1.28 -r1.32
> --- scwrap.c 18 Nov 2004 08:05:54 -0000 1.28
> +++ scwrap.c 23 Dec 2004 23:36:43 -0000 1.32
> @@ -239,7 +239,7 @@
> int whence = va_arg(args, int);
>
> *(int*)retp = syscall(SYS__llseek, fd,
> - offset_high, offset_low, &result, whence);
> + offset_high, offset_low, result, whence);
> }
> #endif
>
> @@ -1208,29 +1208,31 @@
> }
>
> #if ULONG_MAX < 0xffffffffffffffffULL
> -int ___llseek(int fd, u_long offset_high, u_long offset_low, loff_t *result, int whence) {
> +loff_t __llseek(int fd, loff_t offset, int whence) {
> int ret;
> + off_t offset_high = (off_t)(offset >> 32);
> + off_t offset_low = (off_t) (offset & 0xffffffff);
> + loff_t result;
>
> - if (score_syscall(get_handle(SYS__llseek), &ret, fd, offset_high, offset_low, result, whence) == -1) {
> + if (score_syscall(get_handle(SYS__llseek), &ret, fd, offset_high, offset_low,
> + &result, whence) == -1) {
> ret = -1;
> }
> - return ret;
> -}
> -
> -int _llseek(int fd, u_long offset_high, u_long offset_low, loff_t *result, int whence) {
> - return ___llseek(fd, offset_high, offset_low, result, whence);
> + if(ret != 0)
> + return (loff_t)ret;
> + return result;
> }
>
> -int llseek(int fd, u_long offset_high, u_long offset_low, loff_t *result, int whence) {
> - return ___llseek(fd, offset_high, offset_low, result, whence);
> +loff_t llseek(int fd, loff_t offset, int whence) {
> + return __llseek(fd, offset, whence);
> }
>
> -int __lseek64(int fd, u_long offset_high, u_long offset_low, loff_t *result, int whence) {
> - return ___llseek(fd, offset_high, offset_low, result, whence);
> +loff_t __lseek64(int fd, loff_t offset, int whence) {
> + return __llseek(fd, offset, whence);
> }
>
> -int lseek64(int fd, u_long offset_high, u_long offset_low, loff_t *result, int whence) {
> - return ___llseek(fd, offset_high, offset_low, result, whence);
> +loff_t lseek64(int fd, loff_t offset, int whence) {
> + return __llseek(fd, offset, whence);
> }
> #endif
>
> ---------------------------------------cut here---------------------------------
>
>
Many thanks, this fixed the problem on Score 5.8.2 under
RedHat 7.3, 9 (32 bit).
However there is still seems to be a bug on Suse 9.0 64bit (Opteron).
The code output.f produces an incorrect file parallelout 528 bytes
when compiled with the gnu compiler (mpif77 -compiler gnu)
but produces the correct file 520 bytes when compiled with
intel8, absoft and pgi.
-rw--w-r-- 1 nick users 520 2005-02-25 09:18 parallelout.absoft
-rw----r-- 1 nick users 528 2005-02-25 08:20 parallelout.g77 <= wrong
-rw--w-r-- 1 nick users 520 2005-02-25 09:19 parallelout.intel8
-rw----r-- 1 nick users 520 2005-02-25 09:22 parallelout.pgi
-------------- next part --------------
テキスト形式以外の添付ファイルを保管しました...
ファイル名: output.f
型: text/x-fortran
サイズ: 546 バイト
説明: 無し
URL: <http://new1.pccluster.org/pipermail/score-users-jp/attachments/20050225/162f01d5/attachment.bin>
SCore-users-jp メーリングリストの案内