Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gvec_to_python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gvec-group
gvec_to_python
Commits
1b1317c7
Commit
1b1317c7
authored
1 year ago
by
Stefan Possanner
Browse files
Options
Downloads
Patches
Plain Diff
Compile with language C by default, added console options
parent
28535464
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!18
Compile with language C by default
Pipeline
#183991
passed
1 year ago
Stage: startup
Stage: build
Stage: install_and_test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+5
-2
5 additions, 2 deletions
CHANGELOG.md
pyproject.toml
+8
-7
8 additions, 7 deletions
pyproject.toml
src/gvec_to_python/Makefile
+4
-2
4 additions, 2 deletions
src/gvec_to_python/Makefile
src/gvec_to_python/console/compile.py
+77
-15
77 additions, 15 deletions
src/gvec_to_python/console/compile.py
with
94 additions
and
26 deletions
CHANGELOG.md
+
5
−
2
View file @
1b1317c7
## Version 1.
1.3
## Version 1.
2.0
*
Add compile flag
`--conda-warnings off`
only if pyccel version is 1.8.0 or greater.
*
Compile with language C by default.
\ No newline at end of file
*
Added command line options, seen with
`compile-gvec-tp -h`
*
The "--compiler" option can now take the four compilers available in pyccel ("GNU" is the default, "intel", "PGI", "nvidia").
Moreover, a JSON file can be specified to define a custom compiler (see pyccel doc).
\ No newline at end of file
This diff is collapsed.
Click to expand it.
pyproject.toml
+
8
−
7
View file @
1b1317c7
...
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
...
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
[project]
name
=
"gvec-to-python"
name
=
"gvec-to-python"
version
=
"1.
1.3
"
version
=
"1.
2.0
"
readme
=
"README.md"
readme
=
"README.md"
requires-python
=
">
=
3.7
"
requires-python
=
">
=
3.7
"
license
=
{
file
=
"LICENSE"
}
license
=
{
file
=
"LICENSE"
}
...
@@ -21,13 +21,14 @@ classifiers = [
...
@@ -21,13 +21,14 @@ classifiers = [
"Programming Language :: Python :: 3"
,
"Programming Language :: Python :: 3"
,
]
]
dependencies
=
[
dependencies
=
[
'matplotlib
>
=
3.3
.
3
',
'matplotlib'
,
'numpy
>
=
1.19
.
5
',
'numpy'
,
'pandas
>
=
1.2
.
1
',
'pandas'
,
'pyccel'
,
'pyccel'
,
'scipy>
=
1.6
.
0
',
'scipy'
,
'tqdm>
=
4.56
.
0
',
'tqdm'
,
'vtk>
=
9.0
.
3
',
'vtk'
,
'argcomplete'
,
]
]
[project.urls]
[project.urls]
...
...
This diff is collapsed.
Click to expand it.
src/gvec_to_python/Makefile
+
4
−
2
View file @
1b1317c7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
PYTHON
:=
python3
PYTHON
:=
python3
SO_EXT
:=
$(
shell
$(
PYTHON
)
-c
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'
)
)"
)
SO_EXT
:=
$(
shell
$(
PYTHON
)
-c
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'
)
)"
)
LIBDIR
:=
$(
shell
$(
PYTHON
)
-c
"import sysconfig; print(sysconfig.get_config_var('LIBDIR'
)
)"
)
LIBDIR
:=
$(
shell
$(
PYTHON
)
-c
"import sysconfig; print(sysconfig.get_config_var('LIBDIR'
)
)"
)
install_path
:=
$(
shell
$(
PYTHON
)
-c
"import gvec_to_python as _; print(_.__path__[0]
)
"
)
FLAGS
:=
--libdir
$(
LIBDIR
)
$(
flags
)
FLAGS
:=
--libdir
$(
LIBDIR
)
$(
flags
)
#--------------------------------------
#--------------------------------------
...
@@ -28,10 +30,10 @@ OUTPUTS := $(SOURCES:.py=$(SO_EXT))
...
@@ -28,10 +30,10 @@ OUTPUTS := $(SOURCES:.py=$(SO_EXT))
all
:
$(OUTPUTS)
all
:
$(OUTPUTS)
$(BK)$(SO_EXT)
:
$(BK).py
$(BK)$(SO_EXT)
:
$(BK).py
pyccel
$<
$(
FLAGS
)
pyccel
$(
FLAGS
)
$<
$(BEV1)$(SO_EXT)
:
$(BEV1).py $(BK)$(SO_EXT)
$(BEV1)$(SO_EXT)
:
$(BEV1).py $(BK)$(SO_EXT)
pyccel
$<
$(
FLAGS
)
pyccel
$(
FLAGS
)
$<
#--------------------------------------
#--------------------------------------
...
...
This diff is collapsed.
Click to expand it.
src/gvec_to_python/console/compile.py
+
77
−
15
View file @
1b1317c7
...
@@ -4,23 +4,85 @@ def compile_gvec_to_python():
...
@@ -4,23 +4,85 @@ def compile_gvec_to_python():
import
os
import
os
import
gvec_to_python
import
gvec_to_python
import
pyccel
import
pyccel
import
argparse
import
importlib.metadata
import
argcomplete
libpath
=
gvec_to_python
.
__path__
[
0
]
# setup argument parser
parser
=
argparse
.
ArgumentParser
(
prog
=
'
gvec_to_python
'
,
description
=
'
3D MHD equilibria from GVEC in Python.
'
)
# version message
__version__
=
importlib
.
metadata
.
version
(
"
gvec_to_python
"
)
version_message
=
f
'
gvec_to_python
{
__version__
}
\n
'
version_message
+=
'
Copyright 2022 (c) T.K. Cheng, F. Hindenlang, S. Possanner | Max Planck Institute for Plasma Physics
\n
'
version_message
+=
'
MIT license
\n
'
# arguments
parser
.
add_argument
(
'
-v
'
,
'
--version
'
,
action
=
'
version
'
,
version
=
version_message
)
# pyccel flags
parser
.
add_argument
(
'
--language
'
,
flags
=
''
type
=
str
,
metavar
=
'
LANGUAGE
'
,
help
=
'
either
"
c
"
(default) or
"
fortran
"'
,
default
=
'
c
'
)
parser
.
add_argument
(
'
--compiler
'
,
type
=
str
,
metavar
=
'
COMPILER
'
,
help
=
'
either
"
GNU
"
(default),
"
intel
"
,
"
PGI
"
,
"
nvidia
"
or the path to a JSON compiler file.
'
,
default
=
'
GNU
'
)
parser
.
add_argument
(
'
-d
'
,
'
--delete
'
,
help
=
'
remove .f90/.c and .so files (for running pure Python code)
'
,
action
=
'
store_true
'
)
parser
.
add_argument
(
'
--verbose
'
,
help
=
'
call pyccel with --verbose compiler option
'
,
action
=
'
store_true
'
)
_li
=
pyccel
.
__version__
.
split
(
'
.
'
)
# parse argument
_num
=
int
(
_li
[
0
])
*
100
+
int
(
_li
[
1
])
*
10
+
int
(
_li
[
2
])
argcomplete
.
autocomplete
(
parser
)
if
_num
>=
180
:
args
=
parser
.
parse_args
()
flags
+=
'
--conda-warnings off
'
kwargs
=
vars
(
args
)
libpath
=
gvec_to_python
.
__path__
[
0
]
if
any
([
s
==
'
'
for
s
in
libpath
]):
raise
NameError
(
f
'
gvec-to.python installation path MUST NOT contain blank spaces. Please rename
"
{
libpath
}
"
.
'
)
if
kwargs
[
'
delete
'
]:
# (change dir not to be in source path)
print
(
'
\n
Deleting .f90/.c and .so files ...
'
)
subprocess
.
run
([
'
make
'
,
'
clean
'
,
'
-f
'
,
os
.
path
.
join
(
libpath
,
'
Makefile
'
),
],
check
=
True
,
cwd
=
libpath
)
print
(
'
Done.
'
)
print
(
'
\n
Compiling gvec-to-python kernels ...
'
)
else
:
subprocess
.
run
([
'
make
'
,
# pyccel flags
'
-f
'
,
flags
=
'
--language=
'
+
kwargs
[
'
language
'
]
os
.
path
.
join
(
libpath
,
'
Makefile
'
),
flags
+=
'
--compiler=
'
+
kwargs
[
'
compiler
'
]
'
flags=
'
+
flags
,
'
install_path=
'
+
libpath
,
_li
=
pyccel
.
__version__
.
split
(
'
.
'
)
],
check
=
True
,
cwd
=
libpath
)
_num
=
int
(
_li
[
0
])
*
100
+
int
(
_li
[
1
])
*
10
+
int
(
_li
[
2
])
print
(
'
Done.
'
)
if
_num
>=
180
:
flags
+=
'
--conda-warnings off
'
if
kwargs
[
'
verbose
'
]:
flags
+=
'
--verbose
'
print
(
'
\n
Compiling gvec-to-python kernels ...
'
)
subprocess
.
run
([
'
make
'
,
'
-f
'
,
os
.
path
.
join
(
libpath
,
'
Makefile
'
),
'
flags=
'
+
flags
,
'
install_path=
'
+
libpath
,
],
check
=
True
,
cwd
=
libpath
)
print
(
'
Done.
'
)
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