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 */
17
18 #include "stdioInterf.h"
19 #include "fioMacros.h"
20 /** \file
21 * Routines to test array conformance
22 */
23 #include "fort_vars.h"
24
25 /** \brief
26 * Compare rank and shape of objects s and t. Return true if s and t
27 * are conformable under the axis mappings smap and tmap. Scalars are
28 * conformable with arrays. conform(A,B) implies conform(B,A).
29 */
30
I8(__fort_conform)31 int I8(__fort_conform)(F90_Desc *s, __INT_T *smap, F90_Desc *t, __INT_T *tmap)
32 {
33 DECL_DIM_PTRS(sd);
34 DECL_DIM_PTRS(td);
35 __INT_T dim;
36
37 if (s == NULL || t == NULL)
38 return 0;
39 if (s == t || F90_TAG_G(s) != __DESC || F90_TAG_G(t) != __DESC)
40 return 1;
41 if (F90_GSIZE_G(s) == 0 && F90_GSIZE_G(t) == 0)
42 return 1;
43 if (F90_RANK_G(s) != F90_RANK_G(t))
44 return 0;
45 for (dim = F90_RANK_G(s); --dim >= 0;) {
46 SET_DIM_PTRS(sd, s, smap[dim] - 1);
47 SET_DIM_PTRS(td, t, tmap[dim] - 1);
48 if (F90_DPTR_EXTENT_G(sd) != F90_DPTR_EXTENT_G(sd))
49 return 0;
50 }
51 return 1;
52 }
53
I8(__fort_covers_procs)54 int I8(__fort_covers_procs)(F90_Desc *s, F90_Desc *t)
55 {
56 return 1;
57 }
58
59
60 /* TODO: delete? */
61
62 /** \brief
63 * Leftover from HPF Fortran
64 */
I8(__fort_aligned)65 int I8(__fort_aligned)(F90_Desc *t, __INT_T *tmap, F90_Desc *u, __INT_T *umap)
66 {
67 return 1;
68 }
69
70 /* Same as aligned(), except examine only the corresponding axes tx
71 and ux, and assume that t's processor set is covered by u's
72 processor set. */
73
74 /* TODO: delete? */
75
76 /** \brief
77 * Leftover from HPF Fortran
78 */
I8(__fort_aligned_axes)79 int I8(__fort_aligned_axes)(F90_Desc *t, int tx, F90_Desc *u, int ux)
80 {
81 return 1;
82 }
83
84