Skip to content

Commit f4ec466

Browse files
authored
Merge pull request #456 from ThePortlandGroup/nv_stage
Pull 2018-04-30T21-38 Recent NVIDIA Changes
2 parents 02505f4 + 3f0696e commit f4ec466

File tree

37 files changed

+1012
-496
lines changed

37 files changed

+1012
-496
lines changed

lib/scutil/lockfile.h

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
2+
* Copyright (c) 2006-2018, NVIDIA CORPORATION. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,36 +15,54 @@
1515
*
1616
*/
1717

18-
/*
19-
* Four routines to be able to lock access to a file in the Linux
20-
* approved manner. This seems to be the only method that works
21-
* over NFS:
22-
*
23-
* __pg_make_lock_file()
24-
* Creates a uniquely-named file in the current directory.
25-
* To work, this must be created on the same filesystem
26-
* as the file which we are attempting to lock.
27-
* If there are multiple processes running each competing for the
28-
* same lock, each gets a unique file here.
29-
* __pg_get_lock( char* lname )
30-
* The argument is the name of the lock.
31-
* Each process tries to create a hard link with this name
32-
* to its own uniquely-named file from __pg_make_lock_file().
33-
* The one that succeeds is the new lock owner. The others
34-
* fail and try again. There is a fail-over to handle the case
35-
* where the process with the lock dies, which is inherently unsafe,
36-
* but we haven't come up with a better solution.
37-
* __pg_release_lock( char* lname )
38-
* The argument is the same name for the lock.
39-
* The lock is released by deleting (calling unlink) for the
40-
* hard link we had just created.
41-
* __pg_delete_lock_file()
42-
* Clean up by deleting the uniquely named file we had created earlier.
43-
* These routines only allow one lock to be managed at a time.
44-
* They dynamically allocate and free memory.
18+
/**
19+
\file
20+
21+
Four routines to be able to lock access to a file in the Linux
22+
approved manner. This seems to be the only method that works
23+
over NFS.
24+
*/
25+
26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
30+
/**
31+
\brief Creates a uniquely-named file in the current directory.
32+
33+
To work, this must be created on the same filesystem as the file which we are
34+
attempting to lock. If there are multiple processes running each competing
35+
for the same lock, each gets a unique file here.
36+
*/
37+
int __pg_make_lock_file(char *dir);
38+
39+
/**
40+
\brief The argument is the name of the lock.
41+
42+
Each process tries to create a hard link with this name to its own
43+
uniquely-named file from __pg_make_lock_file(). The one that succeeds is the
44+
new lock owner. The others fail and try again. There is a fail-over to
45+
handle the case where the process with the lock dies, which is inherently
46+
unsafe, but we haven't come up with a better solution.
47+
*/
48+
void __pg_get_lock(char *lname);
49+
50+
/**
51+
\brief The argument is the same name for the lock.
52+
53+
The lock is released by deleting (calling unlink) for the hard link we had
54+
just created.
55+
*/
56+
void __pg_release_lock(char *lname);
57+
58+
/**
59+
\brief Clean up by deleting the uniquely named file we had created earlier.
60+
61+
These routines only allow one lock to be managed at a time. They dynamically
62+
allocate and free memory.
4563
*/
64+
void __pg_delete_lock_file(void);
4665

47-
extern int __pg_make_lock_file(char *dir);
48-
extern void __pg_get_lock(char *lname);
49-
extern void __pg_release_lock(char *lname);
50-
extern void __pg_delete_lock_file(void);
66+
#ifdef __cplusplus
67+
}
68+
#endif

test/f90_correct/inc/oop723.mk

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
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+
########## Make rule for test oop723 ########
17+
18+
19+
oop723: run
20+
21+
22+
build: $(SRC)/oop723.f90
23+
-$(RM) oop723.$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
24+
@echo ------------------------------------ building test $@
25+
-$(CC) -c $(CFLAGS) $(SRC)/check.c -o check.$(OBJX)
26+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/oop723.f90 -o oop723.$(OBJX)
27+
-$(FC) $(FFLAGS) $(LDFLAGS) oop723.$(OBJX) check.$(OBJX) $(LIBS) -o oop723.$(EXESUFFIX)
28+
29+
30+
run:
31+
@echo ------------------------------------ executing test oop723
32+
oop723.$(EXESUFFIX)
33+
34+
verify: ;
35+

test/f90_correct/inc/oop724.mk

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
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+
########## Make rule for test oop724 ########
17+
18+
19+
oop724: run
20+
21+
22+
build: $(SRC)/oop724.f90
23+
-$(RM) oop724.$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
24+
@echo ------------------------------------ building test $@
25+
-$(CC) -c $(CFLAGS) $(SRC)/check.c -o check.$(OBJX)
26+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/oop724.f90 -o oop724.$(OBJX)
27+
-$(FC) $(FFLAGS) $(LDFLAGS) oop724.$(OBJX) check.$(OBJX) $(LIBS) -o oop724.$(EXESUFFIX)
28+
29+
30+
run:
31+
@echo ------------------------------------ executing test oop724
32+
oop724.$(EXESUFFIX)
33+
34+
verify: ;
35+

test/f90_correct/inc/oop725.mk

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
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+
########## Make rule for test oop725 ########
17+
18+
19+
oop725: run
20+
21+
22+
build: $(SRC)/oop725.f90
23+
-$(RM) oop725.$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
24+
@echo ------------------------------------ building test $@
25+
-$(CC) -c $(CFLAGS) $(SRC)/check.c -o check.$(OBJX)
26+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/oop725.f90 -o oop725.$(OBJX)
27+
-$(FC) $(FFLAGS) $(LDFLAGS) oop725.$(OBJX) check.$(OBJX) $(LIBS) -o oop725.$(EXESUFFIX)
28+
29+
30+
run:
31+
@echo ------------------------------------ executing test oop725
32+
oop725.$(EXESUFFIX)
33+
34+
verify: ;
35+

test/f90_correct/lit/oop723.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
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+
# Shared lit script for each tests. Run bash commands that run tests with make.
17+
18+
# RUN: KEEP_FILES=%keep FLAGS=%flags TEST_SRC=%s MAKE_FILE_DIR=%S/.. bash %S/runmake | tee %t
19+
# RUN: cat %t | FileCheck %S/runmake

test/f90_correct/lit/oop724.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
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+
# Shared lit script for each tests. Run bash commands that run tests with make.
17+
18+
# RUN: KEEP_FILES=%keep FLAGS=%flags TEST_SRC=%s MAKE_FILE_DIR=%S/.. bash %S/runmake | tee %t
19+
# RUN: cat %t | FileCheck %S/runmake

test/f90_correct/lit/oop725.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
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+
# Shared lit script for each tests. Run bash commands that run tests with make.
17+
18+
# RUN: KEEP_FILES=%keep FLAGS=%flags TEST_SRC=%s MAKE_FILE_DIR=%S/.. bash %S/runmake | tee %t
19+
# RUN: cat %t | FileCheck %S/runmake

test/f90_correct/src/oop723.f90

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
! Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
2+
!
3+
! Licensed under the Apache License, Version 2.0 (the "License");
4+
! you may not use this file except in compliance with the License.
5+
! You may obtain a copy of the License at
6+
!
7+
! http://www.apache.org/licenses/LICENSE-2.0
8+
!
9+
! Unless required by applicable law or agreed to in writing, software
10+
! distributed under the License is distributed on an "AS IS" BASIS,
11+
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
! See the License for the specific language governing permissions and
13+
! limitations under the License.
14+
15+
! tests internal procedure as a pointer target
16+
17+
module mod
18+
logical rslt(2), expect(2)
19+
20+
contains
21+
22+
subroutine foo()
23+
procedure(bar), pointer :: p
24+
integer a
25+
p=>bar
26+
a = 0
27+
call bar()
28+
!print *, a
29+
rslt(1) = a .eq. -99
30+
a = 1
31+
call p()
32+
!print *, a
33+
rslt(2) = a .eq. -99
34+
35+
contains
36+
37+
subroutine bar()
38+
a=-99
39+
end subroutine bar
40+
end subroutine foo
41+
end module mod
42+
43+
use mod
44+
expect = .true.
45+
rslt = .false.
46+
call foo()
47+
call check(rslt, expect, 2)
48+
end program

test/f90_correct/src/oop724.f90

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
! Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
2+
!
3+
! Licensed under the Apache License, Version 2.0 (the "License");
4+
! you may not use this file except in compliance with the License.
5+
! You may obtain a copy of the License at
6+
!
7+
! http://www.apache.org/licenses/LICENSE-2.0
8+
!
9+
! Unless required by applicable law or agreed to in writing, software
10+
! distributed under the License is distributed on an "AS IS" BASIS,
11+
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
! See the License for the specific language governing permissions and
13+
! limitations under the License.
14+
15+
module mod
16+
logical rslt(2), expect(2)
17+
integer y
18+
abstract interface
19+
subroutine bak(x)
20+
integer x
21+
end subroutine bak
22+
end interface
23+
contains
24+
subroutine foo()
25+
procedure(bar), pointer :: p
26+
integer a
27+
p=>bar
28+
a = 0
29+
call bar(200)
30+
rslt(1) = a .eq. 200
31+
! print *, a
32+
a = 1
33+
call p(300)
34+
rslt(2) = a .eq. 300
35+
! print *, a
36+
37+
contains
38+
39+
subroutine bar(x)
40+
integer x
41+
a = x
42+
! print *, a
43+
end subroutine bar
44+
end subroutine foo
45+
end module mod
46+
47+
use mod
48+
expect = .true.
49+
rslt = .false.
50+
call foo()
51+
call check(rslt, expect, 2)
52+
53+
end program

0 commit comments

Comments
 (0)