Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Invalid Suffix on Literal with PRId in C++11 #63

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dict_custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ Valgrind
variadic
subclasses
oneAPI
Cuda
getter
setter
bitwise
datatyping
datatypes
indexable
traceback
GPUs
2 changes: 1 addition & 1 deletion .github/actions/coverage_install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
- name: Directory Creation
run: |
INSTALL_DIR=$(cd tests; python -c "import pyccel; print(pyccel.__path__[0])")
SITE_DIR=$(python -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')
SITE_DIR=$(dirname ${INSTALL_DIR})
echo -e "import coverage; coverage.process_startup()" > ${SITE_DIR}/pyccel_cov.pth
echo -e "[run]\nparallel = True\nsource = ${INSTALL_DIR}\ndata_file = $(pwd)/.coverage\n[report]\ninclude = ${INSTALL_DIR}/*\n[xml]\noutput = cobertura.xml" > .coveragerc
echo "SITE_DIR=${SITE_DIR}" >> $GITHUB_ENV
Expand Down
10 changes: 5 additions & 5 deletions .github/actions/linux_install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ runs:
shell: bash
- name: Install fortran
run:
sudo apt-get install gfortran
sudo apt-get install -y gfortran
shell: bash
- name: Install LaPack
run:
sudo apt-get install libblas-dev liblapack-dev
sudo apt-get install -y libblas-dev liblapack-dev
shell: bash
- name: Install MPI
run: |
sudo apt-get install libopenmpi-dev openmpi-bin
sudo apt-get install -y libopenmpi-dev openmpi-bin
echo "MPI_OPTS=--oversubscribe" >> $GITHUB_ENV
shell: bash
- name: Install OpenMP
run:
sudo apt-get install libomp-dev libomp5
sudo apt-get install -y libomp-dev libomp5
shell: bash
- name: Install Valgrind
run:
sudo apt-get install valgrind
sudo apt-get install -y valgrind
shell: bash
4 changes: 2 additions & 2 deletions .github/actions/pytest_parallel/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ runs:
steps:
- name: Test with pytest
run: |
mpiexec -n 4 ${MPI_OPTS} python -m pytest epyccel/test_parallel_epyccel.py -v -m parallel -rXx
#mpiexec -n 4 ${MPI_OPTS} python -m pytest epyccel -v -m parallel -rXx
mpiexec -n 4 ${MPI_OPTS} python -m pytest epyccel/test_parallel_epyccel.py -v -m "parallel and not cuda" -rXx
#mpiexec -n 4 ${MPI_OPTS} python -m pytest epyccel -v -m "parallel and not cuda" -rXx
shell: ${{ inputs.shell_cmd }}
working-directory: ./tests

4 changes: 2 additions & 2 deletions .github/actions/pytest_run/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ runs:
working-directory: ./tests
id: pytest_3
- name: Test Fortran translations
run: python -m pytest -n auto -rX ${FLAGS} -m "not (parallel or xdist_incompatible) and not (c or python) ${{ inputs.pytest_mark }}" --ignore=ndarrays 2>&1 | tee s4_outfile.out
run: python -m pytest -n auto -rX ${FLAGS} -m "not (parallel or xdist_incompatible) and not (c or python or cuda) ${{ inputs.pytest_mark }}" --ignore=ndarrays 2>&1 | tee s4_outfile.out
shell: ${{ inputs.shell_cmd }}
working-directory: ./tests
id: pytest_4
- name: Test multi-file Fortran translations
run: |
python -m pytest -rX ${FLAGS} -m "xdist_incompatible and not parallel and not (c or python) ${{ inputs.pytest_mark }}" --ignore=ndarrays 2>&1 | tee s5_outfile.out
python -m pytest -rX ${FLAGS} -m "xdist_incompatible and not parallel and not (c or python or cuda) ${{ inputs.pytest_mark }}" --ignore=ndarrays 2>&1 | tee s5_outfile.out
pyccel-clean
shell: ${{ inputs.shell_cmd }}
working-directory: ./tests
Expand Down
24 changes: 24 additions & 0 deletions .github/actions/pytest_run_cuda/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Pyccel pytest commands generating Cuda'
inputs:
shell_cmd:
description: 'Specifies the shell command (different for anaconda)'
required: false
default: "bash"

runs:
using: "composite"
steps:
- name: Ccuda tests with pytest
run: |
# Catch exit 5 (no tests found)
python -m pytest -rX ${FLAGS} -m "not (xdist_incompatible or parallel) and cuda ${{ inputs.pytest_mark }}" --ignore=symbolic --ignore=ndarrays 2>&1 | tee s1_outfile.out
pyccel-clean
shell: ${{ inputs.shell_cmd }}
working-directory: ./tests
- name: Final step
if: always()
id: status
run:
python ci_tools/json_pytest_output.py -t "Cuda Test Summary" --tests "Cuda tests:${{ steps.pytest_1.outcome }}:tests/s1_outfile.out"

shell: ${{ inputs.shell_cmd }}
17 changes: 17 additions & 0 deletions .github/actions/python_install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Python installation commands'

runs:
using: "composite"
steps:
- name: Install python
run:
sudo apt-get -y install python3-dev
shell: bash
- name: python as python3
run:
sudo apt-get -y install python-is-python3
shell: bash
- name: Install Pip
run:
sudo apt-get -y install python3-pip
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/anaconda_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
jobs:
Python_version_picker:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel'
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel-cuda'
outputs:
python_version: ${{ steps.set-python_version.outputs.python_version }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/anaconda_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
jobs:
Python_version_picker:
runs-on: windows-latest
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel'
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel-cuda'
outputs:
python_version: ${{ steps.set-python_version.outputs.python_version }}
steps:
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Cuda unit tests

on:
workflow_dispatch:
inputs:
python_version:
required: false
type: string
ref:
required: false
type: string
check_run_id:
required: false
type: string
pr_repo:
required: false
type: string
push:
branches: [devel, main]

env:
COMMIT: ${{ inputs.ref || github.event.ref }}
PEM: ${{ secrets.BOT_PEM }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_CHECK_RUN_ID: ${{ inputs.check_run_id }}
PR_REPO: ${{ inputs.pr_repo || github.repository }}

jobs:
Cuda:

runs-on: ubuntu-20.04
name: Unit tests

container: nvidia/cuda:11.7.1-devel-ubuntu20.04
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.COMMIT }}
repository: ${{ env.PR_REPO }}
- name: Prepare docker
run: |
apt update && apt install sudo
TZ=Europe/France
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
shell: bash
- name: Install python (setup-python action doesn't work with containers)
uses: ./.github/actions/python_install
- name: "Setup"
id: token
run: |
pip install jwt requests
python ci_tools/setup_check_run.py cuda
- name: CUDA Version
run: nvcc --version # cuda install check
- name: Install dependencies
uses: ./.github/actions/linux_install
- name: Install Pyccel with tests
run: |
PATH=${PATH}:$HOME/.local/bin
echo "PATH=${PATH}" >> $GITHUB_ENV
python -m pip install --upgrade pip
python -m pip install --user .[test]
shell: bash
- name: Coverage install
uses: ./.github/actions/coverage_install
- name: Ccuda tests with pytest
id: cuda_pytest
uses: ./.github/actions/pytest_run_cuda
- name: Collect coverage information
continue-on-error: True
uses: ./.github/actions/coverage_collection
- name: Save code coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-artifact
path: .coverage
retention-days: 1
- name: "Post completed"
if: always()
run:
python ci_tools/complete_check_run.py ${{ steps.cuda_pytest.outcome }}

2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
waitForWorklows:
name: Wait for workflows
runs-on: ubuntu-latest
if: github.event.workflow_run.head_branch == 'main'
if: github.event.workflow_run.head_branch == 'main' && github.repository == 'pyccel/pyccel'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ env:
jobs:
Python_version_picker:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel'
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel-cuda'
outputs:
python_version: ${{ steps.set-python_version.outputs.python_version }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
jobs:
matrix_prep:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel'
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel-cuda'
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macosx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
jobs:
Python_version_picker:
runs-on: macos-latest
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel'
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel-cuda'
outputs:
python_version: ${{ steps.set-python_version.outputs.python_version }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pickle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ env:
jobs:
Python_version_picker:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel'
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel-cuda'
outputs:
python_version: ${{ steps.set-matrix.outputs.python_version }}
matrix: ${{ steps.set-matrix.outputs.matrix }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pickle_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
jobs:
Python_version_picker:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel'
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel-cuda'
outputs:
python_version: ${{ steps.set-python_version.outputs.python_version }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
jobs:
Python_version_picker:
runs-on: windows-latest
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel'
if: github.event_name != 'push' || github.repository == 'pyccel/pyccel-cuda'
outputs:
python_version: ${{ steps.set-python_version.outputs.python_version }}
steps:
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ Contributors
* Farouk Ech-Charef
* Mustapha Belbiad
* Varadarajan Rengaraj
* Said Mazouz
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Change Log
All notable changes to this project will be documented in this file.

## \[Cuda - UNRELEASED\]

### Added

- #32 : Add support for `nvcc` Compiler and `cuda` language as a possible option.
- #48 : Fix incorrect handling of imports in `cuda`.
- #42 : Add support for custom kernel in`cuda`.
- #42 : Add Cuda module to Pyccel. Add support for `cuda.synchronize` function.
- #62 : Fix Invalid Suffix on Literal with PRId64/PRId16/PRId8 in C++11

## \[UNRELEASED\]

### Added
Expand Down
1 change: 1 addition & 0 deletions ci_tools/bot_messages/show_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ The following is a list of keywords which can be used to run tests. Tests in bol
- **linux** : Runs the unit tests on a Linux system.
- **windows** : Runs the unit tests on a Windows system.
- **macosx** : Runs the unit tests on a MacOS X system.
- **cuda** : Runs the cuda unit tests on a Linux system.
- **coverage** : Runs the unit tests on a Linux system and checks the coverage of the tests.
- **docs** : Checks if the documentation follows the numpydoc format.
- **pylint** : Runs pylint on files which are too big to be handled by codacy.
Expand Down
12 changes: 7 additions & 5 deletions ci_tools/bot_tools/bot_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
'pyccel_lint': '3.8',
'pylint': '3.8',
'spelling': '3.8',
'windows': '3.8'
'windows': '3.8',
'cuda': '-'
}

test_names = {
Expand All @@ -40,15 +41,16 @@
'pyccel_lint': "Pyccel best practices",
'pylint': "Python linting",
'spelling': "Spelling verification",
'windows': "Unit tests on Windows"
'windows': "Unit tests on Windows",
'cuda': "Unit tests on Linux with cuda"
}

test_dependencies = {'coverage':['linux']}
test_dependencies = {'coverage':['linux', 'cuda']}

tests_with_base = ('coverage', 'docs', 'pyccel_lint', 'pylint')

pr_test_keys = ('linux', 'windows', 'macosx', 'coverage', 'docs', 'pylint',
'pyccel_lint', 'spelling')
'pyccel_lint', 'spelling', 'cuda')

review_stage_labels = ["needs_initial_review", "Ready_for_review", "Ready_to_merge"]

Expand Down Expand Up @@ -420,7 +422,7 @@ def is_test_required(self, commit_log, name, key, state):
True if the test should be run, False otherwise.
"""
print("Checking : ", name, key)
if key in ('linux', 'windows', 'macosx', 'anaconda_linux', 'anaconda_windows', 'intel'):
if key in ('linux', 'windows', 'macosx', 'anaconda_linux', 'anaconda_windows', 'intel', 'cuda'):
has_relevant_change = lambda diff: any((f.startswith('pyccel/') or f.startswith('tests/')) #pylint: disable=unnecessary-lambda-assignment
and f.endswith('.py') and f != 'pyccel/version.py'
for f in diff)
Expand Down
1 change: 1 addition & 0 deletions ci_tools/devel_branch_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
bot.run_tests(['anaconda_linux'], '3.10', force_run = True)
bot.run_tests(['anaconda_windows'], '3.10', force_run = True)
bot.run_tests(['intel'], '3.9', force_run = True)
bot.run_tests(['cuda'], '-', force_run = True)
2 changes: 1 addition & 1 deletion ci_tools/json_pytest_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def mini_md_summary(title, outcome, failed_tests):
summary = ""

failed_pattern = re.compile(r".*FAILED.*")
languages = ('c', 'fortran', 'python')
languages = ('c', 'fortran', 'python', 'cuda')
pattern = {lang: re.compile(r".*\["+lang+r"\]\ \_.*") for lang in languages}

for i in p_args.tests:
Expand Down
23 changes: 23 additions & 0 deletions docs/cuda.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Getting started GPU

Pyccel now supports NVIDIA CUDA, empowering users to accelerate numerical computations on GPUs seamlessly. With Pyccel's high-level syntax and automatic code generation, harnessing the power of CUDA becomes effortless. This documentation provides a quick guide to enabling CUDA in Pyccel

## Cuda Decorator

### kernel

The kernel decorator allows the user to declare a CUDA kernel. The kernel can be defined in Python, and the syntax is similar to that of Numba.

```python
from pyccel.decorators import kernel

@kernel
def my_kernel():
pass

blockspergrid = 1
threadsperblock = 1
# Call your kernel function
my_kernel[blockspergrid, threadsperblock]()

```
Loading