Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fmpi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
raphael.bach
fmpi
Commits
34ba269a
Verified
Commit
34ba269a
authored
3 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Remove `gen_futhark.py`
parent
a65fc29d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tool/gen_futhark.py
+0
-89
0 additions, 89 deletions
tool/gen_futhark.py
with
0 additions
and
89 deletions
tool/gen_futhark.py
deleted
100644 → 0
+
0
−
89
View file @
a65fc29d
#!/usr/bin/env python
# SPDX-License-Identifier: 0BSD
#
# @file
# @license{
# BSD Zero Clause License
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# }
LICENSE_STR
=
"""
\
-- SPDX-License-Identifier: 0BSD
--
-- @license{
-- BSD Zero Clause License
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted.
--
-- THE SOFTWARE IS PROVIDED
"
AS IS
"
AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
-- }
"""
OUTPUT_PATH
=
'
./
'
INPUT_PATH
=
OUTPUT_PATH
DIM_MAX
=
3
FUTHARK_TYPE_LIST
=
[
'
i8
'
,
'
i16
'
,
'
i32
'
,
'
i64
'
,
'
u8
'
,
'
u16
'
,
'
u32
'
,
'
u64
'
,
'
f32
'
,
'
f64
'
,
'
bool
'
]
C_TYPE_LIST
=
[
'
int8_t
'
,
'
int16_t
'
,
'
int32_t
'
,
'
int64_t
'
,
'
uint8_t
'
,
'
uint16_t
'
,
'
uint32_t
'
,
'
uint64_t
'
,
'
float
'
,
'
double
'
,
'
_Bool
'
]
TYPE_LIST_LENGTH
=
len
(
FUTHARK_TYPE_LIST
)
def
futharkmpi_c_types
():
str
=
''
for
type
in
TYPE_LIST
:
for
i
in
range
(
1
,
DIM_MAX
+
1
):
str
+=
'
entry make_futhark_{type}_{dim}d (xs: {array}{type}): {type} = 0
\n
'
.
format
(
type
=
type
,
dim
=
i
,
array
=
i
*
"
[]
"
)
return
str
def
futharkmpi_reduce
():
str
=
'
import
"
{path}
"
\n\n
'
.
format
(
path
=
INPUT_PATH
+
'
futharkmpi_module_reduce
'
)
func_list
=
[
'
sum
'
,
'
prod
'
,
'
min
'
,
'
max
'
]
for
i
in
range
(
TYPE_LIST_LENGTH
):
str
+=
'
module reduce_{type} = module_reduce {type}
\n
'
.
format
(
type
=
FUTHARK_TYPE_LIST
[
i
])
for
func
in
func_list
:
str
+=
'
entry reduce_{func}_{ctype} = reduce_{ftype}.{func}
\n
'
.
format
(
func
=
func
,
ctype
=
C_TYPE_LIST
[
i
],
ftype
=
FUTHARK_TYPE_LIST
[
i
])
return
str
##
# Create a file and write generated code to it.
#
# @param generator : A function returning a string containing the generated
# code. Its name is used as a prefix for the file name.
def
generate_file
(
generator
):
file_name
=
generator
.
__name__
+
'
.fut
'
with
open
(
OUTPUT_PATH
+
file_name
,
'
w
'
)
as
fd
:
fd
.
write
(
LICENSE_STR
)
fd
.
write
(
generator
())
def
main
(
args
):
generator_list
=
[
futharkmpi_reduce
]
for
generator
in
generator_list
:
generate_file
(
generator
)
return
0
if
__name__
==
'
__main__
'
:
import
sys
sys
.
exit
(
main
(
sys
.
argv
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment