diff --git a/.dict_custom.txt b/.dict_custom.txt index b25b47f277..1ad66b6914 100644 --- a/.dict_custom.txt +++ b/.dict_custom.txt @@ -106,5 +106,6 @@ Valgrind variadic subclasses oneAPI +Cuda getter setter diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..63440e5f3b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,6 @@ +# These owners will be the default owners for everything in +# the repo. Unless a later match takes precedence, +# @global-owner1 and @global-owner2 will be requested for +# review when someone opens a pull request. +* @EmilyBourne @bauom + diff --git a/.github/actions/coverage_install/action.yml b/.github/actions/coverage_install/action.yml index ac5294e542..5732baee34 100644 --- a/.github/actions/coverage_install/action.yml +++ b/.github/actions/coverage_install/action.yml @@ -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 diff --git a/.github/actions/linux_install/action.yml b/.github/actions/linux_install/action.yml index 8fb5cd8505..0ef9a69b8e 100644 --- a/.github/actions/linux_install/action.yml +++ b/.github/actions/linux_install/action.yml @@ -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 diff --git a/.github/actions/pytest_parallel/action.yml b/.github/actions/pytest_parallel/action.yml index c7c77d99c7..f91d84915b 100644 --- a/.github/actions/pytest_parallel/action.yml +++ b/.github/actions/pytest_parallel/action.yml @@ -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 diff --git a/.github/actions/pytest_run/action.yml b/.github/actions/pytest_run/action.yml index 8d300bd87c..c2849e011c 100644 --- a/.github/actions/pytest_run/action.yml +++ b/.github/actions/pytest_run/action.yml @@ -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=symbolic --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=symbolic --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=symbolic --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=symbolic --ignore=ndarrays 2>&1 | tee s5_outfile.out pyccel-clean shell: ${{ inputs.shell_cmd }} working-directory: ./tests diff --git a/.github/actions/pytest_run_cuda/action.yml b/.github/actions/pytest_run_cuda/action.yml new file mode 100644 index 0000000000..46f90552ed --- /dev/null +++ b/.github/actions/pytest_run_cuda/action.yml @@ -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 }} diff --git a/.github/actions/python_install/action.yml b/.github/actions/python_install/action.yml new file mode 100644 index 0000000000..f9b720e3e1 --- /dev/null +++ b/.github/actions/python_install/action.yml @@ -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 diff --git a/.github/workflows/anaconda_linux.yml b/.github/workflows/anaconda_linux.yml index c7e04a37da..8173b4f7a4 100644 --- a/.github/workflows/anaconda_linux.yml +++ b/.github/workflows/anaconda_linux.yml @@ -16,7 +16,7 @@ on: required: false type: string push: - branches: devel + branches: [devel, main] env: COMMIT: ${{ inputs.ref || github.event.ref }} @@ -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: diff --git a/.github/workflows/anaconda_windows.yml b/.github/workflows/anaconda_windows.yml index 70bf150b1a..5cd222511d 100644 --- a/.github/workflows/anaconda_windows.yml +++ b/.github/workflows/anaconda_windows.yml @@ -16,7 +16,7 @@ on: required: false type: string push: - branches: devel + branches: [devel, main] env: COMMIT: ${{ inputs.ref || github.event.ref }} @@ -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: diff --git a/.github/workflows/coverage_collect.yml b/.github/workflows/coverage_collect.yml new file mode 100644 index 0000000000..e0c4a0c3bc --- /dev/null +++ b/.github/workflows/coverage_collect.yml @@ -0,0 +1,67 @@ +name: Unit test coverage collection + +on: + workflow_call: + inputs: + python_version: + required: true + type: string + ref: + required: false + type: string + cuda_result: + required: true + type: string + +jobs: + CoverageChecker: + + runs-on: ubuntu-latest + name: Unit tests + + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref }} + - name: Set up Python ${{ inputs.python_version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python_version }} + - name: Install dependencies + uses: ./.github/actions/linux_install + - name: Install coverage + run: | + python -m pip install --upgrade pip + python -m pip install coverage + shell: bash + - name: Collect coverage information + uses: actions/download-artifact@v3 + with: + name: coverage-artifact + - name: Rename coverage file + run: mv .coverage .coverage.linux + - name: Collect coverage information + uses: actions/download-artifact@v3 + if: ${{ inputs.cuda_result }} == 'success' + with: + name: cuda-coverage-artifact + - name: Rename coverage file + if: ${{ inputs.cuda_result }} == 'success' + run: mv .coverage .coverage.cuda + - name: Generate coverage report + run: | + echo -e "[paths]\nsource =\n $(pwd)/pyccel\n */site-packages/pyccel\n[xml]\noutput = cobertura.xml" > .coveragerc + coverage combine + coverage xml + - name: Run codacy-coverage-reporter + uses: codacy/codacy-coverage-reporter-action@master + continue-on-error: True + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: cobertura.xml + - name: Save code coverage xml report + uses: actions/upload-artifact@v3 + with: + name: coverage-artifact-xml + path: cobertura.xml + retention-days: 1 diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml new file mode 100644 index 0000000000..833ebf5d85 --- /dev/null +++ b/.github/workflows/cuda.yml @@ -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 }} + diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml index d45beb3d8b..96b614f0fb 100644 --- a/.github/workflows/intel.yml +++ b/.github/workflows/intel.yml @@ -16,7 +16,7 @@ on: required: false type: string push: - branches: devel + branches: [devel, main] env: COMMIT: ${{ inputs.ref || github.event.ref }} @@ -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: diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 29239db9b6..3fbf76d70a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -16,7 +16,7 @@ on: required: false type: string push: - branches: devel + branches: [devel, main] env: COMMIT: ${{ inputs.ref || github.event.ref }} @@ -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: diff --git a/.github/workflows/macosx.yml b/.github/workflows/macosx.yml index 1d4d4fd562..c5396fbe7c 100644 --- a/.github/workflows/macosx.yml +++ b/.github/workflows/macosx.yml @@ -16,7 +16,7 @@ on: required: false type: string push: - branches: devel + branches: [devel, main] env: COMMIT: ${{ inputs.ref || github.event.ref }} @@ -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: diff --git a/.github/workflows/pickle.yml b/.github/workflows/pickle.yml index b20fe1a93f..47663b6b2f 100644 --- a/.github/workflows/pickle.yml +++ b/.github/workflows/pickle.yml @@ -19,7 +19,7 @@ on: required: false type: string push: - branches: devel + branches: [devel, main] env: COMMIT: ${{ inputs.ref || github.event.ref }} @@ -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 }} diff --git a/.github/workflows/pickle_wheel.yml b/.github/workflows/pickle_wheel.yml index ce530a238f..450cb250be 100644 --- a/.github/workflows/pickle_wheel.yml +++ b/.github/workflows/pickle_wheel.yml @@ -16,7 +16,7 @@ on: required: false type: string push: - branches: devel + branches: [devel, main] env: COMMIT: ${{ inputs.ref || github.event.ref }} @@ -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: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 03cecaab64..14ba9ddf31 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -16,7 +16,7 @@ on: required: false type: string push: - branches: devel + branches: [devel, main] env: COMMIT: ${{ inputs.ref || github.event.ref }} @@ -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: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ceaee09f9..66fcfe8f5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # 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. + ## \[UNRELEASED\] ### Added diff --git a/ci_tools/bot_comment_react.py b/ci_tools/bot_comment_react.py index 1f26c05e49..2d1b058d42 100644 --- a/ci_tools/bot_comment_react.py +++ b/ci_tools/bot_comment_react.py @@ -29,6 +29,7 @@ def get_unique_test_list(keys): tests.discard('pr_tests') if 'coverage' in tests: tests.add('linux') + tests.add('cuda') # Ensure coverage is last in case dependencies are ready tests.discard('coverage') result = list(tests) diff --git a/ci_tools/bot_messages/show_tests.txt b/ci_tools/bot_messages/show_tests.txt index adc07e8431..eb15492d2e 100644 --- a/ci_tools/bot_messages/show_tests.txt +++ b/ci_tools/bot_messages/show_tests.txt @@ -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. diff --git a/ci_tools/bot_tools/bot_funcs.py b/ci_tools/bot_tools/bot_funcs.py index 7084a01bb9..1621d1d089 100644 --- a/ci_tools/bot_tools/bot_funcs.py +++ b/ci_tools/bot_tools/bot_funcs.py @@ -23,7 +23,8 @@ 'pyccel_lint': '3.8', 'pylint': '3.8', 'spelling': '3.8', - 'windows': '3.8' + 'windows': '3.8', + 'cuda': '-' } test_names = { @@ -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"] @@ -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) diff --git a/ci_tools/devel_branch_tests.py b/ci_tools/devel_branch_tests.py index 1102ef9e92..ec67b6c49a 100644 --- a/ci_tools/devel_branch_tests.py +++ b/ci_tools/devel_branch_tests.py @@ -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) diff --git a/ci_tools/json_pytest_output.py b/ci_tools/json_pytest_output.py index 409ae76d72..b84f4a4c09 100644 --- a/ci_tools/json_pytest_output.py +++ b/ci_tools/json_pytest_output.py @@ -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: diff --git a/pyccel/codegen/codegen.py b/pyccel/codegen/codegen.py index 01303cc393..7c8b210136 100644 --- a/pyccel/codegen/codegen.py +++ b/pyccel/codegen/codegen.py @@ -9,34 +9,41 @@ from pyccel.codegen.printing.fcode import FCodePrinter from pyccel.codegen.printing.ccode import CCodePrinter from pyccel.codegen.printing.pycode import PythonCodePrinter +from pyccel.codegen.printing.cucode import CudaCodePrinter from pyccel.ast.core import FunctionDef, Interface, ModuleHeader from pyccel.errors.errors import Errors from pyccel.utilities.stage import PyccelStage -_extension_registry = {'fortran': 'f90', 'c':'c', 'python':'py'} -_header_extension_registry = {'fortran': None, 'c':'h', 'python':None} +_extension_registry = {'fortran': 'f90', 'c':'c', 'python':'py', 'cuda':'cu'} +_header_extension_registry = {'fortran': None, 'c':'h', 'python':None, 'cuda':'h'} printer_registry = { 'fortran':FCodePrinter, 'c':CCodePrinter, - 'python':PythonCodePrinter + 'python':PythonCodePrinter, + 'cuda':CudaCodePrinter } pyccel_stage = PyccelStage() class Codegen(object): - """Abstract class for code generator.""" + """ + Class which handles the generation of code. - def __init__(self, parser, name): - """Constructor for Codegen. - - parser: pyccel parser + The class which handles the generation of code. This is done by creating an appropriate class + inheriting from `CodePrinter` and using it to create strings describing the code that should + be printed. This class then takes care of creating the necessary files. + Parameters + ---------- + parser : SemanticParser + The Pyccel Semantic parser node. + name : str + Name of the generated module or program. + """ - name: str - name of the generated module or program. - """ + def __init__(self, parser, name): pyccel_stage.set_stage('codegen') self._parser = parser self._ast = parser.ast @@ -135,12 +142,22 @@ def language(self): return self._language def set_printer(self, **settings): - """ Set the current codeprinter instance""" + """ + Set the current codeprinter instance. + + Getting the language that will be used (default language used is fortran), + Then instantiating the codePrinter with the corresponding language. + + Parameters + ---------- + **settings : dict + Any additional arguments which are necessary for CCodePrinter. + """ # Get language used (default language used is fortran) language = settings.pop('language', 'fortran') # Set language - if not language in ['fortran', 'c', 'python']: + if not language in ['fortran', 'c', 'python', 'cuda']: raise ValueError('{} language is not available'.format(language)) self._language = language diff --git a/pyccel/codegen/compiling/compilers.py b/pyccel/codegen/compiling/compilers.py index feafa4bea8..48e225cb83 100644 --- a/pyccel/codegen/compiling/compilers.py +++ b/pyccel/codegen/compiling/compilers.py @@ -441,7 +441,10 @@ def compile_shared_library(self, compile_obj, output_folder, verbose = False, sh # Collect compile information exec_cmd, includes, libs_flags, libdirs_flags, m_code = \ self._get_compile_components(compile_obj, accelerators) - linker_libdirs_flags = ['-Wl,-rpath' if l == '-L' else l for l in libdirs_flags] + if self._info['exec'] == 'nvcc': + linker_libdirs_flags = ['-Xcompiler' if l == '-L' else f'"-Wl,-rpath,{l}"' for l in libdirs_flags] + else: + linker_libdirs_flags = ['-Wl,-rpath' if l == '-L' else l for l in libdirs_flags] flags.insert(0,"-shared") diff --git a/pyccel/codegen/pipeline.py b/pyccel/codegen/pipeline.py index 4d4770a491..6730b9bb21 100644 --- a/pyccel/codegen/pipeline.py +++ b/pyccel/codegen/pipeline.py @@ -179,9 +179,10 @@ def handle_error(stage): if language is None: language = 'fortran' - # Choose Fortran compiler + # Choose Default compiler if compiler is None: - compiler = os.environ.get('PYCCEL_DEFAULT_COMPILER', 'GNU') + default_compiler_family = 'nvidia' if language == 'cuda' else 'GNU' + compiler = os.environ.get('PYCCEL_DEFAULT_COMPILER', default_compiler_family) fflags = [] if fflags is None else fflags.split() wrapper_flags = [] if wrapper_flags is None else wrapper_flags.split() diff --git a/pyccel/codegen/printing/ccode.py b/pyccel/codegen/printing/ccode.py index e071b0f429..8bbc95fe7d 100644 --- a/pyccel/codegen/printing/ccode.py +++ b/pyccel/codegen/printing/ccode.py @@ -484,12 +484,14 @@ def arrayFill(self, expr): lhs = expr.lhs code_init = '' declare_dtype = self.find_in_dtype_registry(rhs.dtype, rhs.precision) - + dtype = self.find_in_ndarray_type_registry(rhs.dtype, rhs.precision) + dtype = dtype[3:] if rhs.fill_value is not None: + fill_value = self._print(rhs.fill_value) if isinstance(rhs.fill_value, Literal): - code_init += 'array_fill(({0}){1}, {2});\n'.format(declare_dtype, self._print(rhs.fill_value), self._print(lhs)) + code_init += f'_array_fill_{dtype}(({declare_dtype}){fill_value}, {self._print(lhs)});\n' else: - code_init += 'array_fill({0}, {1});\n'.format(self._print(rhs.fill_value), self._print(lhs)) + code_init += f'_array_fill_{dtype}({fill_value}, {self._print(lhs)});\n' return code_init def _init_stack_array(self, expr): diff --git a/pyccel/codegen/printing/cucode.py b/pyccel/codegen/printing/cucode.py new file mode 100644 index 0000000000..90a77f73ad --- /dev/null +++ b/pyccel/codegen/printing/cucode.py @@ -0,0 +1,182 @@ +# coding: utf-8 +#------------------------------------------------------------------------------------------# +# This file is part of Pyccel which is released under MIT License. See the LICENSE file or # +# go to https://github.com/pyccel/pyccel/blob/master/LICENSE for full license details. # +#------------------------------------------------------------------------------------------# +""" +Provide tools for generating and handling CUDA code. +This module is designed to interface Pyccel's Abstract Syntax Tree (AST) with CUDA, +enabling the direct translation of high-level Pyccel expressions into CUDA code. +""" + +import functools + +from pyccel.codegen.printing.ccode import CCodePrinter, c_library_headers, c_imports +from pyccel.ast.datatypes import NativeInteger, NativeVoid + +from pyccel.ast.core import Deallocate +from pyccel.ast.variable import DottedVariable + +from pyccel.ast.c_concepts import ObjectAddress +from pyccel.ast.core import Import, Module, Declare +from pyccel.ast.operators import PyccelMul + +from pyccel.errors.errors import Errors + + +errors = Errors() + +__all__ = ["CudaCodePrinter"] + +class CudaCodePrinter(CCodePrinter): + """ + Print code in CUDA format. + + This printer converts Pyccel's Abstract Syntax Tree (AST) into strings of CUDA code. + Navigation through this file utilizes _print_X functions, + as is common with all printers. + + Parameters + ---------- + filename : str + The name of the file being pyccelised. + prefix_module : str + A prefix to be added to the name of the module. + """ + language = "cuda" + + def __init__(self, filename, prefix_module = None): + + errors.set_target(filename, 'file') + + super().__init__(filename) + + def _print_Program(self, expr): + self.set_scope(expr.scope) + body = self._print(expr.body) + variables = self.scope.variables.values() + decs = ''.join(self._print(Declare(v)) for v in variables) + + imports = [*expr.imports, *self._additional_imports.values()] + c_headers_imports = '' + local_imports = '' + + for imp in imports: + if imp.source in c_library_headers: + c_headers_imports += self._print(imp) + else: + local_imports += self._print(imp) + + imports = f'{c_headers_imports}\ + extern "C"{{\n\ + {local_imports}\ + }}' + # imports = ''.join(self._print(i) for i in imports) + + self.exit_scope() + return f'{imports}\n\ + int main()\n{{\n\ + {decs}\n\ + {body}\n\ + return 0;\n\ + }}\n' + + def _print_Module(self, expr): + self.set_scope(expr.scope) + self._current_module = expr.name + body = ''.join(self._print(i) for i in expr.body) + + global_variables = ''.join(self._print(d) for d in expr.declarations) + + # Print imports last to be sure that all additional_imports have been collected + imports = [Import(expr.name, Module(expr.name,(),())), *self._additional_imports.values()] + c_headers_imports = '' + local_imports = '' + + for imp in imports: + if imp.source in c_library_headers: + c_headers_imports += self._print(imp) + else: + local_imports += self._print(imp) + + imports = f'{c_headers_imports}\ + extern "C"{{\n\ + {local_imports}\ + }}' + + code = f'{imports}\n\ + {global_variables}\n\ + {body}\n' + + self.exit_scope() + return code + + def _init_stack_array(self, expr): + """ + Return a string which handles the assignment of a stack ndarray. + + Print the code necessary to initialise a ndarray on the stack. + + Parameters + ---------- + expr : TypedAstNode + The Assign Node used to get the lhs and rhs. + + Returns + ------- + buffer_array : str + String initialising the stack (C) array which stores the data. + array_init : str + String containing the rhs of the initialization of a stack array. + """ + var = expr + dtype = self.find_in_dtype_registry(var.dtype, var.precision) + np_dtype = self.find_in_ndarray_type_registry(var.dtype, var.precision) + shape = ", ".join(self._print(i) for i in var.alloc_shape) + tot_shape = self._print(functools.reduce( + lambda x,y: PyccelMul(x,y,simplify=True), var.alloc_shape)) + declare_dtype = self.find_in_dtype_registry(NativeInteger(), 8) + + dummy_array_name = self.scope.get_new_name('array_dummy') + buffer_array = f'{dtype} {dummy_array_name}[{tot_shape}];\n' + tmp_shape = self.scope.get_new_name(f'tmp_shape_{var.name}') + shape_init = f'{declare_dtype} {tmp_shape}[] = {{{shape}}};\n' + tmp_strides = self.scope.get_new_name(f'tmp_strides_{var.name}') + strides_init = f'{declare_dtype} {tmp_strides}[{var.rank}] = {{0}};\n' + array_init = f' = (t_ndarray){{\n.{np_dtype}={dummy_array_name},\n .nd={var.rank},\n ' + array_init += f'.shape={tmp_shape},\n .strides={tmp_strides},\n .type={np_dtype},\n .is_view=false\n}};\n' + array_init += f'stack_array_init(&{self._print(var)})' + preface = buffer_array + shape_init + strides_init + self.add_import(c_imports['ndarrays']) + return preface, array_init + + def _print_Allocate(self, expr): + free_code = '' + variable = expr.variable + if variable.rank > 0: + #free the array if its already allocated and checking if its not null if the status is unknown + if (expr.status == 'unknown'): + shape_var = DottedVariable(NativeVoid(), 'shape', lhs = variable) + free_code = f'if ({self._print(shape_var)} != NULL)\n' + free_code += f'{{\n{self._print(Deallocate(variable))}}}\n' + elif (expr.status == 'allocated'): + free_code += self._print(Deallocate(variable)) + self.add_import(c_imports['ndarrays']) + shape = ", ".join(self._print(i) for i in expr.shape) + dtype = self.find_in_ndarray_type_registry(variable.dtype, variable.precision) + shape_dtype = self.find_in_dtype_registry(NativeInteger(), 8) + tmp_shape = self.scope.get_new_name(f'tmp_shape_{self._print(variable)}') + shape_Assign = f'{shape_dtype} {tmp_shape}[] = {{{shape}}};\n' + is_view = 'false' if variable.on_heap else 'true' + order = "order_f" if expr.order == "F" else "order_c" + alloc_code = f"{self._print(variable)} = array_create({variable.rank}, {tmp_shape}, {dtype}, {is_view}, {order});\n" + return f'{free_code}{shape_Assign}{alloc_code}' + elif variable.is_alias: + var_code = self._print(ObjectAddress(variable)) + if expr.like: + declaration_type = self.get_declare_type(expr.like) + return f'{var_code} = malloc(sizeof({declaration_type}));\n' + else: + raise NotImplementedError(f"Allocate not implemented for {variable}") + else: + raise NotImplementedError(f"Allocate not implemented for {variable}") diff --git a/pyccel/commands/console.py b/pyccel/commands/console.py index aa9c1aadc5..ea23dd6f8b 100644 --- a/pyccel/commands/console.py +++ b/pyccel/commands/console.py @@ -80,7 +80,7 @@ def pyccel(files=None, mpi=None, openmp=None, openacc=None, output_dir=None, com # ... backend compiler options group = parser.add_argument_group('Backend compiler options') - group.add_argument('--language', choices=('fortran', 'c', 'python'), help='Generated language') + group.add_argument('--language', choices=('fortran', 'c', 'python', 'cuda'), help='Generated language') group.add_argument('--compiler', help='Compiler family or json file containing a compiler description {GNU,intel,PGI}') diff --git a/pyccel/compilers/default_compilers.py b/pyccel/compilers/default_compilers.py index 166085d22e..d47856773c 100644 --- a/pyccel/compilers/default_compilers.py +++ b/pyccel/compilers/default_compilers.py @@ -185,6 +185,15 @@ }, 'family': 'nvidia', } +#------------------------------------------------------------ +nvcc_info = {'exec' : 'nvcc', + 'language' : 'cuda', + 'debug_flags' : ("-g",), + 'release_flags': ("-O3",), + 'general_flags': ('--compiler-options', '-fPIC',), + 'family' : 'nvidia' + } + #------------------------------------------------------------ def change_to_lib_flag(lib): @@ -288,6 +297,7 @@ def change_to_lib_flag(lib): pgfortran_info.update(python_info) nvc_info.update(python_info) nvfort_info.update(python_info) +nvcc_info.update(python_info) available_compilers = {('GNU', 'c') : gcc_info, ('GNU', 'fortran') : gfort_info, @@ -296,6 +306,7 @@ def change_to_lib_flag(lib): ('PGI', 'c') : pgcc_info, ('PGI', 'fortran') : pgfortran_info, ('nvidia', 'c') : nvc_info, - ('nvidia', 'fortran') : nvfort_info} + ('nvidia', 'fortran') : nvfort_info, + ('nvidia', 'cuda'): nvcc_info} vendors = ('GNU','intel','PGI','nvidia') diff --git a/pyccel/naming/__init__.py b/pyccel/naming/__init__.py index a71d841c8e..1b8514703b 100644 --- a/pyccel/naming/__init__.py +++ b/pyccel/naming/__init__.py @@ -10,7 +10,9 @@ from .fortrannameclashchecker import FortranNameClashChecker from .cnameclashchecker import CNameClashChecker from .pythonnameclashchecker import PythonNameClashChecker +from .cudanameclashchecker import CudaNameClashChecker name_clash_checkers = {'fortran':FortranNameClashChecker(), 'c':CNameClashChecker(), - 'python':PythonNameClashChecker()} + 'python':PythonNameClashChecker(), + 'cuda':CudaNameClashChecker()} diff --git a/pyccel/naming/cudanameclashchecker.py b/pyccel/naming/cudanameclashchecker.py new file mode 100644 index 0000000000..971204e912 --- /dev/null +++ b/pyccel/naming/cudanameclashchecker.py @@ -0,0 +1,92 @@ +# coding: utf-8 +#------------------------------------------------------------------------------------------# +# This file is part of Pyccel which is released under MIT License. See the LICENSE file or # +# go to https://github.com/pyccel/pyccel/blob/master/LICENSE for full license details. # +#------------------------------------------------------------------------------------------# +""" +Handles name clash problems in Cuda +""" +from .languagenameclashchecker import LanguageNameClashChecker + +class CudaNameClashChecker(LanguageNameClashChecker): + """ + Class containing functions to help avoid problematic names in Cuda. + + A class which provides functionalities to check or propose variable names and + verify that they do not cause name clashes. Name clashes may be due to + new variables, or due to the use of reserved keywords. + """ + # Keywords as mentioned on https://en.cppreference.com/w/c/keyword + keywords = set(['isign', 'fsign', 'csign', 'auto', 'break', 'case', 'char', 'const', + 'continue', 'default', 'do', 'double', 'else', 'enum', + 'extern', 'float', 'for', 'goto', 'if', 'inline', 'int', + 'long', 'register', 'restrict', 'return', 'short', 'signed', + 'sizeof', 'static', 'struct', 'switch', 'typedef', 'union', + 'unsigned', 'void', 'volatile', 'whie', '_Alignas', + '_Alignof', '_Atomic', '_Bool', '_Complex', 'Decimal128', + '_Decimal32', '_Decimal64', '_Generic', '_Imaginary', + '_Noreturn', '_Static_assert', '_Thread_local', 't_ndarray', + 'array_create', 'new_slice', 'array_slicing', 'alias_assign', + 'transpose_alias_assign', 'array_fill', 't_slice', + 'GET_INDEX_EXP1', 'GET_INDEX_EXP2', 'GET_INDEX_EXP2', + 'GET_INDEX_EXP3', 'GET_INDEX_EXP4', 'GET_INDEX_EXP5', + 'GET_INDEX_EXP6', 'GET_INDEX_EXP7', 'GET_INDEX_EXP8', + 'GET_INDEX_EXP9', 'GET_INDEX_EXP10', 'GET_INDEX_EXP11', + 'GET_INDEX_EXP12', 'GET_INDEX_EXP13', 'GET_INDEX_EXP14', + 'GET_INDEX_EXP15', 'NUM_ARGS_H1', 'NUM_ARGS', + 'GET_INDEX_FUNC_H2', 'GET_INDEX_FUNC', 'GET_INDEX', + 'INDEX', 'GET_ELEMENT', 'free_array', 'free_pointer', + 'get_index', 'numpy_to_ndarray_strides', + 'numpy_to_ndarray_shape', 'get_size', 'order_f', 'order_c', 'array_copy_data']) + + def has_clash(self, name, symbols): + """ + Indicate whether the proposed name causes any clashes. + + Checks if a suggested name conflicts with predefined + keywords or specified symbols,returning true for a clash. + This method is crucial for maintaining namespace integrity and + preventing naming conflicts in code generation processes. + + Parameters + ---------- + name : str + The suggested name. + symbols : set + Symbols which should be considered as collisions. + + Returns + ------- + bool + True if the name is a collision. + False if the name is collision free. + """ + return any(name == k for k in self.keywords) or \ + any(name == s for s in symbols) + + def get_collisionless_name(self, name, symbols): + """ + Get a valid name which doesn't collision with symbols or Cuda keywords. + + Find a new name based on the suggested name which will not cause + conflicts with Cuda keywords, does not appear in the provided symbols, + and is a valid name in Cuda code. + + Parameters + ---------- + name : str + The suggested name. + symbols : set + Symbols which should be considered as collisions. + + Returns + ------- + str + A new name which is collision free. + """ + if len(name)>4 and all(name[i] == '_' for i in (0,1,-1,-2)): + # Ignore magic methods + return name + if name[0] == '_': + name = 'private'+name + return self._get_collisionless_name(name, symbols) diff --git a/pyccel/stdlib/ndarrays/ndarrays.h b/pyccel/stdlib/ndarrays/ndarrays.h index fa113c1811..23817129ca 100644 --- a/pyccel/stdlib/ndarrays/ndarrays.h +++ b/pyccel/stdlib/ndarrays/ndarrays.h @@ -11,17 +11,6 @@ # include # include -/* mapping the function array_fill to the correct type */ -# define array_fill(c, arr) _Generic((c), int64_t : _array_fill_int64,\ - int32_t : _array_fill_int32,\ - int16_t : _array_fill_int16,\ - int8_t : _array_fill_int8,\ - float : _array_fill_float,\ - double : _array_fill_double,\ - bool : _array_fill_bool,\ - float complex : _array_fill_cfloat,\ - double complex : _array_fill_cdouble)(c, arr) - typedef enum e_slice_type { ELEMENT, RANGE } t_slice_type; typedef struct s_slice @@ -92,8 +81,10 @@ typedef struct s_ndarray float *nd_float; double *nd_double; bool *nd_bool; + #ifndef __cplusplus double complex *nd_cdouble; float complex *nd_cfloat; + #endif }; /* number of dimensions */ int32_t nd; @@ -128,8 +119,10 @@ void _array_fill_int64(int64_t c, t_ndarray arr); void _array_fill_float(float c, t_ndarray arr); void _array_fill_double(double c, t_ndarray arr); void _array_fill_bool(bool c, t_ndarray arr); +#ifndef __cplusplus void _array_fill_cfloat(float complex c, t_ndarray arr); void _array_fill_cdouble(double complex c, t_ndarray arr); +#endif /* slicing */ /* creating a Slice object */ @@ -164,8 +157,10 @@ int64_t numpy_sum_int32(t_ndarray arr); int64_t numpy_sum_int64(t_ndarray arr); float numpy_sum_float32(t_ndarray arr); double numpy_sum_float64(t_ndarray arr); +#ifndef __cplusplus float complex numpy_sum_complex64(t_ndarray arr); double complex numpy_sum_complex128(t_ndarray arr); +#endif /*numpy max/amax */ @@ -176,8 +171,10 @@ int64_t numpy_amax_int32(t_ndarray arr); int64_t numpy_amax_int64(t_ndarray arr); float numpy_amax_float32(t_ndarray arr); double numpy_amax_float64(t_ndarray arr); +#ifndef __cplusplus float complex numpy_amax_complex64(t_ndarray arr); double complex numpy_amax_complex128(t_ndarray arr); +#endif /* numpy min/amin */ @@ -188,7 +185,9 @@ int64_t numpy_amin_int32(t_ndarray arr); int64_t numpy_amin_int64(t_ndarray arr); float numpy_amin_float32(t_ndarray arr); double numpy_amin_float64(t_ndarray arr); +#ifndef __cplusplus float complex numpy_amin_complex64(t_ndarray arr); double complex numpy_amin_complex128(t_ndarray arr); +#endif #endif diff --git a/pyccel/stdlib/numpy/numpy_c.c b/pyccel/stdlib/numpy/numpy_c.c index 36e4a205ec..1b5a1bf017 100644 --- a/pyccel/stdlib/numpy/numpy_c.c +++ b/pyccel/stdlib/numpy/numpy_c.c @@ -17,8 +17,10 @@ double fsign(double x) return SIGN(x); } +#ifndef __NVCC__ /* numpy.sign for complex */ double complex csign(double complex x) { return x ? ((!creal(x) && cimag(x) < 0) || (creal(x) < 0) ? -1 : 1) : 0; } +#endif diff --git a/pyccel/stdlib/numpy/numpy_c.h b/pyccel/stdlib/numpy/numpy_c.h index 4133e9dbe9..326ec3a549 100644 --- a/pyccel/stdlib/numpy/numpy_c.h +++ b/pyccel/stdlib/numpy/numpy_c.h @@ -15,6 +15,8 @@ long long int isign(long long int x); double fsign(double x); +#ifndef __NVCC__ double complex csign(double complex x); +#endif #endif diff --git a/pytest.ini b/pytest.ini index 42eb0d72ba..3792ab65f9 100644 --- a/pytest.ini +++ b/pytest.ini @@ -9,3 +9,4 @@ markers = python: test to generate python code xdist_incompatible: test which compiles a file also compiled by another test external: test using an external dll (problematic with conda on Windows) + cuda: test to generate cuda code diff --git a/tests/conftest.py b/tests/conftest.py index 79144b6978..a5082ef6e8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,6 +21,17 @@ def language(request): return request.param +@pytest.fixture( params=[ + pytest.param("fortran", marks = pytest.mark.fortran), + pytest.param("c", marks = pytest.mark.c), + pytest.param("python", marks = pytest.mark.python), + pytest.param("cuda", marks = pytest.mark.cuda) + ], + scope = "session" +) +def language_with_cuda(request): + return request.param + def move_coverage(path_dir): for root, _, files in os.walk(path_dir): for name in files: diff --git a/tests/epyccel/test_array_as_func_args.py b/tests/epyccel/test_array_as_func_args.py index 194d269dba..b8990300af 100644 --- a/tests/epyccel/test_array_as_func_args.py +++ b/tests/epyccel/test_array_as_func_args.py @@ -12,13 +12,13 @@ int_types = ['int8', 'int16', 'int32', 'int64'] float_types = ['float32', 'float64'] -def test_array_int_1d_scalar_add(language): +def test_array_int_1d_scalar_add(language_with_cuda): @template('T', ['int8', 'int16', 'int32', 'int64']) def array_int_1d_scalar_add(x : 'T[:]', a : 'T', x_len : int): for i in range(x_len): x[i] += a f1 = array_int_1d_scalar_add - f2 = epyccel(f1, language=language) + f2 = epyccel(f1, language=language_with_cuda) for t in int_types: size = randint(1, 30) @@ -31,13 +31,13 @@ def array_int_1d_scalar_add(x : 'T[:]', a : 'T', x_len : int): assert np.array_equal( x1, x2 ) -def test_array_real_1d_scalar_add(language): +def test_array_real_1d_scalar_add(language_with_cuda): @template('T', ['float32', 'double']) def array_real_1d_scalar_add(x : 'T[:]', a : 'T', x_len : int): for i in range(x_len): x[i] += a f1 = array_real_1d_scalar_add - f2 = epyccel(f1, language=language) + f2 = epyccel(f1, language=language_with_cuda) for t in float_types: size = randint(1, 30) @@ -71,14 +71,14 @@ def array_complex_1d_scalar_add(x : 'T[:]', a : 'T', x_len : int): assert np.array_equal( x1, x2 ) -def test_array_int_2d_scalar_add(language): +def test_array_int_2d_scalar_add(language_with_cuda): @template('T', ['int8', 'int16', 'int32', 'int64']) def array_int_2d_scalar_add( x : 'T[:,:]', a : 'T', d1 : int, d2 : int): for i in range(d1): for j in range(d2): x[i, j] += a f1 = array_int_2d_scalar_add - f2 = epyccel(f1, language=language) + f2 = epyccel(f1, language=language_with_cuda) for t in int_types: d1 = randint(1, 15) @@ -92,14 +92,14 @@ def array_int_2d_scalar_add( x : 'T[:,:]', a : 'T', d1 : int, d2 : int): assert np.array_equal( x1, x2 ) -def test_array_real_2d_scalar_add(language): +def test_array_real_2d_scalar_add(language_with_cuda): @template('T', ['float32', 'double']) def array_real_2d_scalar_add(x : 'T[:,:]', a : 'T', d1 : int, d2 : int): for i in range(d1): for j in range(d2): x[i, j] += a f1 = array_real_2d_scalar_add - f2 = epyccel(f1, language=language) + f2 = epyccel(f1, language=language_with_cuda) for t in float_types: d1 = randint(1, 15) diff --git a/tests/epyccel/test_arrays.py b/tests/epyccel/test_arrays.py index f279137ff0..e22744c4bd 100644 --- a/tests/epyccel/test_arrays.py +++ b/tests/epyccel/test_arrays.py @@ -85,10 +85,10 @@ def test_array_assigned_dtype(language): # TEST: 1D ARRAYS OF INT-32 #============================================================================== -def test_array_int32_1d_scalar_add(language): +def test_array_int32_1d_scalar_add(language_with_cuda): f1 = arrays.array_int32_1d_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -99,10 +99,10 @@ def test_array_int32_1d_scalar_add(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_scalar_add_stride(language): +def test_array_int32_1d_scalar_add_stride(language_with_cuda): f1 = arrays.array_int32_1d_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3,4,5,6,7,8], dtype=np.int32 ) x2 = np.copy(x1) @@ -113,10 +113,10 @@ def test_array_int32_1d_scalar_add_stride(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_scalar_sub(language): +def test_array_int32_1d_scalar_sub(language_with_cuda): f1 = arrays.array_int32_1d_scalar_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -127,10 +127,10 @@ def test_array_int32_1d_scalar_sub(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_scalar_sub_stride(language): +def test_array_int32_1d_scalar_sub_stride(language_with_cuda): f1 = arrays.array_int32_1d_scalar_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3,4,5,6,7,8,9], dtype=np.int32 ) x2 = np.copy(x1) @@ -141,10 +141,10 @@ def test_array_int32_1d_scalar_sub_stride(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_scalar_mul(language): +def test_array_int32_1d_scalar_mul(language_with_cuda): f1 = arrays.array_int32_1d_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -155,10 +155,10 @@ def test_array_int32_1d_scalar_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_scalar_mul_stride(language): +def test_array_int32_1d_scalar_mul_stride(language_with_cuda): f1 = arrays.array_int32_1d_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3,4,5,6,7,8,9], dtype=np.int32 ) x2 = np.copy(x1) @@ -169,10 +169,10 @@ def test_array_int32_1d_scalar_mul_stride(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_scalar_div(language): +def test_array_int32_1d_scalar_div(language_with_cuda): f1 = arrays.array_int32_1d_scalar_div - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -183,10 +183,10 @@ def test_array_int32_1d_scalar_div(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_scalar_idiv(language): +def test_array_int32_1d_scalar_idiv(language_with_cuda): f1 = arrays.array_int32_1d_scalar_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -197,10 +197,10 @@ def test_array_int32_1d_scalar_idiv(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_scalar_idiv_stride(language): +def test_array_int32_1d_scalar_idiv_stride(language_with_cuda): f1 = arrays.array_int32_1d_scalar_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3,4,5,6,7,8,9], dtype=np.int32 ) x2 = np.copy(x1) @@ -211,10 +211,10 @@ def test_array_int32_1d_scalar_idiv_stride(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_add(language): +def test_array_int32_1d_add(language_with_cuda): f1 = arrays.array_int32_1d_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -225,10 +225,10 @@ def test_array_int32_1d_add(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_sub(language): +def test_array_int32_1d_sub(language_with_cuda): f1 = arrays.array_int32_1d_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -239,10 +239,10 @@ def test_array_int32_1d_sub(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_mul(language): +def test_array_int32_1d_mul(language_with_cuda): f1 = arrays.array_int32_1d_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -253,10 +253,10 @@ def test_array_int32_1d_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_idiv(language): +def test_array_int32_1d_idiv(language_with_cuda): f1 = arrays.array_int32_1d_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -267,10 +267,10 @@ def test_array_int32_1d_idiv(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_add_augassign(language): +def test_array_int32_1d_add_augassign(language_with_cuda): f1 = arrays.array_int32_1d_add_augassign - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -281,10 +281,10 @@ def test_array_int32_1d_add_augassign(language): assert np.array_equal( x1, x2 ) -def test_array_int32_1d_sub_augassign(language): +def test_array_int32_1d_sub_augassign(language_with_cuda): f1 = arrays.array_int32_1d_sub_augassign - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3], dtype=np.int32 ) x2 = np.copy(x1) @@ -295,10 +295,10 @@ def test_array_int32_1d_sub_augassign(language): assert np.array_equal( x1, x2 ) -def test_array_int_1d_initialization_1(language): +def test_array_int_1d_initialization_1(language_with_cuda): f1 = arrays.array_int_1d_initialization_1 - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) assert f1() == f2() @@ -318,10 +318,10 @@ def test_array_int_1d_initialization_2(language): assert f1() == f2() -def test_array_int_1d_initialization_3(language): +def test_array_int_1d_initialization_3(language_with_cuda): f1 = arrays.array_int_1d_initialization_3 - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) assert f1() == f2() @@ -329,10 +329,10 @@ def test_array_int_1d_initialization_3(language): # TEST: 2D ARRAYS OF INT-32 WITH C ORDERING #============================================================================== -def test_array_int32_2d_C_scalar_add(language): +def test_array_int32_2d_C_scalar_add(language_with_cuda): f1 = arrays.array_int32_2d_C_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32 ) x2 = np.copy(x1) @@ -343,10 +343,10 @@ def test_array_int32_2d_C_scalar_add(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_C_scalar_add_stride(language): +def test_array_int32_2d_C_scalar_add_stride(language_with_cuda): f1 = arrays.array_int32_2d_C_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32 ) x2 = np.copy(x1) @@ -357,10 +357,10 @@ def test_array_int32_2d_C_scalar_add_stride(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_C_scalar_sub(language): +def test_array_int32_2d_C_scalar_sub(language_with_cuda): f1 = arrays.array_int32_2d_C_scalar_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32 ) x2 = np.copy(x1) @@ -395,10 +395,10 @@ def test_array_int32_2d_C_scalar_sub_stride(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_C_scalar_mul(language): +def test_array_int32_2d_C_scalar_mul(language_with_cuda): f1 = arrays.array_int32_2d_C_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32 ) x2 = np.copy(x1) @@ -409,10 +409,10 @@ def test_array_int32_2d_C_scalar_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_C_scalar_mul_stride(language): +def test_array_int32_2d_C_scalar_mul_stride(language_with_cuda): f1 = arrays.array_int32_2d_C_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32 ) x2 = np.copy(x1) @@ -423,10 +423,10 @@ def test_array_int32_2d_C_scalar_mul_stride(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_C_scalar_idiv(language): +def test_array_int32_2d_C_scalar_idiv(language_with_cuda): f1 = arrays.array_int32_2d_C_scalar_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32 ) x2 = np.copy(x1) @@ -461,10 +461,10 @@ def test_array_int32_2d_C_scalar_idiv_stride(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_C_add(language): +def test_array_int32_2d_C_add(language_with_cuda): f1 = arrays.array_int32_2d_C_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32 ) x2 = np.copy(x1) @@ -475,10 +475,10 @@ def test_array_int32_2d_C_add(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_C_sub(language): +def test_array_int32_2d_C_sub(language_with_cuda): f1 = arrays.array_int32_2d_C_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32 ) x2 = np.copy(x1) @@ -489,10 +489,10 @@ def test_array_int32_2d_C_sub(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_C_mul(language): +def test_array_int32_2d_C_mul(language_with_cuda): f1 = arrays.array_int32_2d_C_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32 ) x2 = np.copy(x1) @@ -503,10 +503,10 @@ def test_array_int32_2d_C_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_C_idiv(language): +def test_array_int32_2d_C_idiv(language_with_cuda): f1 = arrays.array_int32_2d_C_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32 ) x2 = np.copy(x1) @@ -521,10 +521,10 @@ def test_array_int32_2d_C_idiv(language): # TEST: 2D ARRAYS OF INT-32 WITH F ORDERING #============================================================================== -def test_array_int32_2d_F_scalar_add(language): +def test_array_int32_2d_F_scalar_add(language_with_cuda): f1 = arrays.array_int32_2d_F_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32, order='F' ) x2 = np.copy(x1) @@ -559,10 +559,10 @@ def test_array_int32_2d_F_scalar_add_stride(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_F_scalar_sub(language): +def test_array_int32_2d_F_scalar_sub(language_with_cuda): f1 = arrays.array_int32_2d_F_scalar_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32, order='F' ) x2 = np.copy(x1) @@ -597,10 +597,10 @@ def test_array_int32_2d_F_scalar_sub_stride(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_F_scalar_mul(language): +def test_array_int32_2d_F_scalar_mul(language_with_cuda): f1 = arrays.array_int32_2d_F_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32, order='F' ) x2 = np.copy(x1) @@ -611,10 +611,10 @@ def test_array_int32_2d_F_scalar_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_F_scalar_idiv(language): +def test_array_int32_2d_F_scalar_idiv(language_with_cuda): f1 = arrays.array_int32_2d_F_scalar_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32, order='F' ) x2 = np.copy(x1) @@ -625,10 +625,10 @@ def test_array_int32_2d_F_scalar_idiv(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_F_add(language): +def test_array_int32_2d_F_add(language_with_cuda): f1 = arrays.array_int32_2d_F_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32, order='F' ) x2 = np.copy(x1) @@ -639,10 +639,10 @@ def test_array_int32_2d_F_add(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_F_sub(language): +def test_array_int32_2d_F_sub(language_with_cuda): f1 = arrays.array_int32_2d_F_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32, order='F' ) x2 = np.copy(x1) @@ -653,10 +653,10 @@ def test_array_int32_2d_F_sub(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_F_mul(language): +def test_array_int32_2d_F_mul(language_with_cuda): f1 = arrays.array_int32_2d_F_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32, order='F' ) x2 = np.copy(x1) @@ -667,10 +667,10 @@ def test_array_int32_2d_F_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int32_2d_F_idiv(language): +def test_array_int32_2d_F_idiv(language_with_cuda): f1 = arrays.array_int32_2d_F_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], dtype=np.int32, order='F' ) x2 = np.copy(x1) @@ -686,10 +686,10 @@ def test_array_int32_2d_F_idiv(language): # TEST: 1D ARRAYS OF INT-64 #============================================================================== -def test_array_int_1d_scalar_add(language): +def test_array_int_1d_scalar_add(language_with_cuda): f1 = arrays.array_int_1d_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3] ) x2 = np.copy(x1) @@ -700,10 +700,10 @@ def test_array_int_1d_scalar_add(language): assert np.array_equal( x1, x2 ) -def test_array_int_1d_scalar_sub(language): +def test_array_int_1d_scalar_sub(language_with_cuda): f1 = arrays.array_int_1d_scalar_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3] ) x2 = np.copy(x1) @@ -714,10 +714,10 @@ def test_array_int_1d_scalar_sub(language): assert np.array_equal( x1, x2 ) -def test_array_int_1d_scalar_mul(language): +def test_array_int_1d_scalar_mul(language_with_cuda): f1 = arrays.array_int_1d_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3] ) x2 = np.copy(x1) @@ -728,10 +728,10 @@ def test_array_int_1d_scalar_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int_1d_scalar_idiv(language): +def test_array_int_1d_scalar_idiv(language_with_cuda): f1 = arrays.array_int_1d_scalar_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3] ) x2 = np.copy(x1) @@ -742,10 +742,10 @@ def test_array_int_1d_scalar_idiv(language): assert np.array_equal( x1, x2 ) -def test_array_int_1d_add(language): +def test_array_int_1d_add(language_with_cuda): f1 = arrays.array_int_1d_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3] ) x2 = np.copy(x1) @@ -756,10 +756,10 @@ def test_array_int_1d_add(language): assert np.array_equal( x1, x2 ) -def test_array_int_1d_sub(language): +def test_array_int_1d_sub(language_with_cuda): f1 = arrays.array_int_1d_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3] ) x2 = np.copy(x1) @@ -770,10 +770,10 @@ def test_array_int_1d_sub(language): assert np.array_equal( x1, x2 ) -def test_array_int_1d_mul(language): +def test_array_int_1d_mul(language_with_cuda): f1 = arrays.array_int_1d_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3] ) x2 = np.copy(x1) @@ -784,10 +784,10 @@ def test_array_int_1d_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int_1d_idiv(language): +def test_array_int_1d_idiv(language_with_cuda): f1 = arrays.array_int_1d_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1,2,3] ) x2 = np.copy(x1) @@ -802,10 +802,10 @@ def test_array_int_1d_idiv(language): # TEST: 2D ARRAYS OF INT-64 WITH C ORDERING #============================================================================== -def test_array_int_2d_C_scalar_add(language): +def test_array_int_2d_C_scalar_add(language_with_cuda): f1 = arrays.array_int_2d_C_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]] ) x2 = np.copy(x1) @@ -816,10 +816,10 @@ def test_array_int_2d_C_scalar_add(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_C_scalar_sub(language): +def test_array_int_2d_C_scalar_sub(language_with_cuda): f1 = arrays.array_int_2d_C_scalar_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]] ) x2 = np.copy(x1) @@ -830,10 +830,10 @@ def test_array_int_2d_C_scalar_sub(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_C_scalar_mul(language): +def test_array_int_2d_C_scalar_mul(language_with_cuda): f1 = arrays.array_int_2d_C_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]] ) x2 = np.copy(x1) @@ -844,10 +844,10 @@ def test_array_int_2d_C_scalar_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_C_scalar_idiv(language): +def test_array_int_2d_C_scalar_idiv(language_with_cuda): f1 = arrays.array_int_2d_C_scalar_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]] ) x2 = np.copy(x1) @@ -858,10 +858,10 @@ def test_array_int_2d_C_scalar_idiv(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_C_add(language): +def test_array_int_2d_C_add(language_with_cuda): f1 = arrays.array_int_2d_C_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]] ) x2 = np.copy(x1) @@ -872,10 +872,10 @@ def test_array_int_2d_C_add(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_C_sub(language): +def test_array_int_2d_C_sub(language_with_cuda): f1 = arrays.array_int_2d_C_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]] ) x2 = np.copy(x1) @@ -886,10 +886,10 @@ def test_array_int_2d_C_sub(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_C_mul(language): +def test_array_int_2d_C_mul(language_with_cuda): f1 = arrays.array_int_2d_C_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]] ) x2 = np.copy(x1) @@ -900,10 +900,10 @@ def test_array_int_2d_C_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_C_idiv(language): +def test_array_int_2d_C_idiv(language_with_cuda): f1 = arrays.array_int_2d_C_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]] ) x2 = np.copy(x1) @@ -914,10 +914,10 @@ def test_array_int_2d_C_idiv(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_C_initialization(language): +def test_array_int_2d_C_initialization(language_with_cuda): f1 = arrays.array_int_2d_C_initialization - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) x1 = np.zeros((2, 3), dtype=int) x2 = np.ones_like(x1) @@ -931,10 +931,10 @@ def test_array_int_2d_C_initialization(language): # TEST: 2D ARRAYS OF INT-64 WITH F ORDERING #============================================================================== -def test_array_int_2d_F_scalar_add(language): +def test_array_int_2d_F_scalar_add(language_with_cuda): f1 = arrays.array_int_2d_F_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], order='F' ) x2 = np.copy(x1) @@ -945,10 +945,10 @@ def test_array_int_2d_F_scalar_add(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_F_scalar_sub(language): +def test_array_int_2d_F_scalar_sub(language_with_cuda): f1 = arrays.array_int_2d_F_scalar_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], order='F' ) x2 = np.copy(x1) @@ -959,10 +959,10 @@ def test_array_int_2d_F_scalar_sub(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_F_scalar_mul(language): +def test_array_int_2d_F_scalar_mul(language_with_cuda): f1 = arrays.array_int_2d_F_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], order='F' ) x2 = np.copy(x1) @@ -973,10 +973,10 @@ def test_array_int_2d_F_scalar_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_F_scalar_idiv(language): +def test_array_int_2d_F_scalar_idiv(language_with_cuda): f1 = arrays.array_int_2d_F_scalar_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], order='F' ) x2 = np.copy(x1) @@ -987,10 +987,10 @@ def test_array_int_2d_F_scalar_idiv(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_F_add(language): +def test_array_int_2d_F_add(language_with_cuda): f1 = arrays.array_int_2d_F_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], order='F' ) x2 = np.copy(x1) @@ -1001,10 +1001,10 @@ def test_array_int_2d_F_add(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_F_sub(language): +def test_array_int_2d_F_sub(language_with_cuda): f1 = arrays.array_int_2d_F_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], order='F' ) x2 = np.copy(x1) @@ -1015,10 +1015,10 @@ def test_array_int_2d_F_sub(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_F_mul(language): +def test_array_int_2d_F_mul(language_with_cuda): f1 = arrays.array_int_2d_F_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], order='F' ) x2 = np.copy(x1) @@ -1029,10 +1029,10 @@ def test_array_int_2d_F_mul(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_F_idiv(language): +def test_array_int_2d_F_idiv(language_with_cuda): f1 = arrays.array_int_2d_F_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1,2,3], [4,5,6]], order='F' ) x2 = np.copy(x1) @@ -1043,10 +1043,10 @@ def test_array_int_2d_F_idiv(language): assert np.array_equal( x1, x2 ) -def test_array_int_2d_F_initialization(language): +def test_array_int_2d_F_initialization(language_with_cuda): f1 = arrays.array_int_2d_F_initialization - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) x1 = np.zeros((2, 3), dtype=int, order='F') x2 = np.ones_like(x1) @@ -1060,10 +1060,10 @@ def test_array_int_2d_F_initialization(language): # TEST: 1D ARRAYS OF REAL #============================================================================== -def test_array_float_1d_scalar_add(language): +def test_array_float_1d_scalar_add(language_with_cuda): f1 = arrays.array_float_1d_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1074,10 +1074,10 @@ def test_array_float_1d_scalar_add(language): assert np.array_equal( x1, x2 ) -def test_array_float_1d_scalar_sub(language): +def test_array_float_1d_scalar_sub(language_with_cuda): f1 = arrays.array_float_1d_scalar_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1088,10 +1088,10 @@ def test_array_float_1d_scalar_sub(language): assert np.array_equal( x1, x2 ) -def test_array_float_1d_scalar_mul(language): +def test_array_float_1d_scalar_mul(language_with_cuda): f1 = arrays.array_float_1d_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1102,10 +1102,10 @@ def test_array_float_1d_scalar_mul(language): assert np.array_equal( x1, x2 ) -def test_array_float_1d_scalar_div(language): +def test_array_float_1d_scalar_div(language_with_cuda): f1 = arrays.array_float_1d_scalar_div - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1116,9 +1116,9 @@ def test_array_float_1d_scalar_div(language): assert np.allclose(x1, x2, rtol=RTOL, atol=ATOL) -def test_array_float_1d_scalar_mod(language): +def test_array_float_1d_scalar_mod(language_with_cuda): f1 = arrays.array_float_1d_scalar_mod - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1129,10 +1129,10 @@ def test_array_float_1d_scalar_mod(language): assert np.array_equal( x1, x2 ) -def test_array_float_1d_scalar_idiv(language): +def test_array_float_1d_scalar_idiv(language_with_cuda): f1 = arrays.array_float_1d_scalar_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1143,10 +1143,10 @@ def test_array_float_1d_scalar_idiv(language): assert np.array_equal( x1, x2 ) -def test_array_float_1d_add(language): +def test_array_float_1d_add(language_with_cuda): f1 = arrays.array_float_1d_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1157,10 +1157,10 @@ def test_array_float_1d_add(language): assert np.array_equal( x1, x2 ) -def test_array_float_1d_sub(language): +def test_array_float_1d_sub(language_with_cuda): f1 = arrays.array_float_1d_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1171,10 +1171,10 @@ def test_array_float_1d_sub(language): assert np.array_equal( x1, x2 ) -def test_array_float_1d_mul(language): +def test_array_float_1d_mul(language_with_cuda): f1 = arrays.array_float_1d_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1185,10 +1185,10 @@ def test_array_float_1d_mul(language): assert np.array_equal( x1, x2 ) -def test_array_float_1d_div(language): +def test_array_float_1d_div(language_with_cuda): f1 = arrays.array_float_1d_div - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1199,10 +1199,10 @@ def test_array_float_1d_div(language): assert np.array_equal( x1, x2 ) -def test_array_float_1d_mod(language): +def test_array_float_1d_mod(language_with_cuda): f1 = arrays.array_float_1d_mod - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1213,10 +1213,10 @@ def test_array_float_1d_mod(language): assert np.array_equal( x1, x2) -def test_array_float_1d_idiv(language): +def test_array_float_1d_idiv(language_with_cuda): f1 = arrays.array_float_1d_idiv - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [1.,2.,3.] ) x2 = np.copy(x1) @@ -1231,10 +1231,10 @@ def test_array_float_1d_idiv(language): # TEST: 2D ARRAYS OF REAL WITH C ORDERING #============================================================================== -def test_array_float_2d_C_scalar_add(language): +def test_array_float_2d_C_scalar_add(language_with_cuda): f1 = arrays.array_float_2d_C_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]] ) x2 = np.copy(x1) @@ -1245,10 +1245,10 @@ def test_array_float_2d_C_scalar_add(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_C_scalar_sub(language): +def test_array_float_2d_C_scalar_sub(language_with_cuda): f1 = arrays.array_float_2d_C_scalar_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]] ) x2 = np.copy(x1) @@ -1259,10 +1259,10 @@ def test_array_float_2d_C_scalar_sub(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_C_scalar_mul(language): +def test_array_float_2d_C_scalar_mul(language_with_cuda): f1 = arrays.array_float_2d_C_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]] ) x2 = np.copy(x1) @@ -1273,10 +1273,10 @@ def test_array_float_2d_C_scalar_mul(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_C_scalar_div(language): +def test_array_float_2d_C_scalar_div(language_with_cuda): f1 = arrays.array_float_2d_C_scalar_div - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]] ) x2 = np.copy(x1) @@ -1287,10 +1287,10 @@ def test_array_float_2d_C_scalar_div(language): assert np.allclose(x1, x2, rtol=RTOL, atol=ATOL) -def test_array_float_2d_C_scalar_mod(language): +def test_array_float_2d_C_scalar_mod(language_with_cuda): f1 = arrays.array_float_2d_C_scalar_mod - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]] ) x2 = np.copy(x1) @@ -1301,10 +1301,10 @@ def test_array_float_2d_C_scalar_mod(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_C_add(language): +def test_array_float_2d_C_add(language_with_cuda): f1 = arrays.array_float_2d_C_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]] ) x2 = np.copy(x1) @@ -1315,10 +1315,10 @@ def test_array_float_2d_C_add(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_C_sub(language): +def test_array_float_2d_C_sub(language_with_cuda): f1 = arrays.array_float_2d_C_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]] ) x2 = np.copy(x1) @@ -1329,10 +1329,10 @@ def test_array_float_2d_C_sub(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_C_mul(language): +def test_array_float_2d_C_mul(language_with_cuda): f1 = arrays.array_float_2d_C_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]] ) x2 = np.copy(x1) @@ -1343,10 +1343,10 @@ def test_array_float_2d_C_mul(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_C_div(language): +def test_array_float_2d_C_div(language_with_cuda): f1 = arrays.array_float_2d_C_div - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]] ) x2 = np.copy(x1) @@ -1357,10 +1357,10 @@ def test_array_float_2d_C_div(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_C_mod(language): +def test_array_float_2d_C_mod(language_with_cuda): f1 = arrays.array_float_2d_C_mod - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]] ) x2 = np.copy(x1) @@ -1371,10 +1371,10 @@ def test_array_float_2d_C_mod(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_C_array_initialization(language): +def test_array_float_2d_C_array_initialization(language_with_cuda): f1 = arrays.array_float_2d_C_array_initialization - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) x1 = np.zeros((2, 3), dtype=float ) x2 = np.ones_like(x1) @@ -1384,10 +1384,10 @@ def test_array_float_2d_C_array_initialization(language): assert np.array_equal(x1, x2) -def test_array_float_3d_C_array_initialization_1(language): +def test_array_float_3d_C_array_initialization_1(language_with_cuda): f1 = arrays.array_float_3d_C_array_initialization_1 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) x = np.random.random((3,2)) y = np.random.random((3,2)) @@ -1401,10 +1401,10 @@ def test_array_float_3d_C_array_initialization_1(language): assert np.array_equal(x1, x2) -def test_array_float_3d_C_array_initialization_2(language): +def test_array_float_3d_C_array_initialization_2(language_with_cuda): f1 = arrays.array_float_3d_C_array_initialization_2 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) x1 = np.zeros((2,3,4)) x2 = np.zeros((2,3,4)) @@ -1414,10 +1414,10 @@ def test_array_float_3d_C_array_initialization_2(language): assert np.array_equal(x1, x2) -def test_array_float_4d_C_array_initialization(language): +def test_array_float_4d_C_array_initialization(language_with_cuda): f1 = arrays.array_float_4d_C_array_initialization - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) x = np.random.random((3,2,4)) y = np.random.random((3,2,4)) @@ -1434,10 +1434,10 @@ def test_array_float_4d_C_array_initialization(language): # TEST: 2D ARRAYS OF REAL WITH F ORDERING #============================================================================== -def test_array_float_2d_F_scalar_add(language): +def test_array_float_2d_F_scalar_add(language_with_cuda): f1 = arrays.array_float_2d_F_scalar_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' ) x2 = np.copy(x1) @@ -1448,10 +1448,10 @@ def test_array_float_2d_F_scalar_add(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_F_scalar_sub(language): +def test_array_float_2d_F_scalar_sub(language_with_cuda): f1 = arrays.array_float_2d_F_scalar_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' ) x2 = np.copy(x1) @@ -1462,10 +1462,10 @@ def test_array_float_2d_F_scalar_sub(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_F_scalar_mul(language): +def test_array_float_2d_F_scalar_mul(language_with_cuda): f1 = arrays.array_float_2d_F_scalar_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' ) x2 = np.copy(x1) @@ -1476,10 +1476,10 @@ def test_array_float_2d_F_scalar_mul(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_F_scalar_div(language): +def test_array_float_2d_F_scalar_div(language_with_cuda): f1 = arrays.array_float_2d_F_scalar_div - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' ) x2 = np.copy(x1) @@ -1490,10 +1490,10 @@ def test_array_float_2d_F_scalar_div(language): assert np.allclose(x1, x2, rtol=RTOL, atol=ATOL) -def test_array_float_2d_F_scalar_mod(language): +def test_array_float_2d_F_scalar_mod(language_with_cuda): f1 = arrays.array_float_2d_F_scalar_mod - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' ) x2 = np.copy(x1) @@ -1504,10 +1504,10 @@ def test_array_float_2d_F_scalar_mod(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_F_add(language): +def test_array_float_2d_F_add(language_with_cuda): f1 = arrays.array_float_2d_F_add - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' ) x2 = np.copy(x1) @@ -1518,10 +1518,10 @@ def test_array_float_2d_F_add(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_F_sub(language): +def test_array_float_2d_F_sub(language_with_cuda): f1 = arrays.array_float_2d_F_sub - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' ) x2 = np.copy(x1) @@ -1532,10 +1532,10 @@ def test_array_float_2d_F_sub(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_F_mul(language): +def test_array_float_2d_F_mul(language_with_cuda): f1 = arrays.array_float_2d_F_mul - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' ) x2 = np.copy(x1) @@ -1546,10 +1546,10 @@ def test_array_float_2d_F_mul(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_F_div(language): +def test_array_float_2d_F_div(language_with_cuda): f1 = arrays.array_float_2d_F_div - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' ) x2 = np.copy(x1) @@ -1560,10 +1560,10 @@ def test_array_float_2d_F_div(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_F_mod(language): +def test_array_float_2d_F_mod(language_with_cuda): f1 = arrays.array_float_2d_F_mod - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' ) x2 = np.copy(x1) @@ -1574,10 +1574,10 @@ def test_array_float_2d_F_mod(language): assert np.array_equal( x1, x2 ) -def test_array_float_2d_F_array_initialization(language): +def test_array_float_2d_F_array_initialization(language_with_cuda): f1 = arrays.array_float_2d_F_array_initialization - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) x1 = np.zeros((2, 3), dtype=float, order='F') x2 = np.ones_like(x1) @@ -1587,10 +1587,10 @@ def test_array_float_2d_F_array_initialization(language): assert np.array_equal(x1, x2) -def test_array_float_3d_F_array_initialization_1(language): +def test_array_float_3d_F_array_initialization_1(language_with_cuda): f1 = arrays.array_float_3d_F_array_initialization_1 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) x = np.random.random((3,2)).copy(order='F') y = np.random.random((3,2)).copy(order='F') @@ -1604,10 +1604,10 @@ def test_array_float_3d_F_array_initialization_1(language): assert np.array_equal(x1, x2) -def test_array_float_3d_F_array_initialization_2(language): +def test_array_float_3d_F_array_initialization_2(language_with_cuda): f1 = arrays.array_float_3d_F_array_initialization_2 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) x1 = np.zeros((2,3,4), order='F') x2 = np.zeros((2,3,4), order='F') @@ -1617,10 +1617,10 @@ def test_array_float_3d_F_array_initialization_2(language): assert np.array_equal(x1, x2) -def test_array_float_4d_F_array_initialization(language): +def test_array_float_4d_F_array_initialization(language_with_cuda): f1 = arrays.array_float_4d_F_array_initialization - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) x = np.random.random((3,2,4)).copy(order='F') y = np.random.random((3,2,4)).copy(order='F') @@ -1794,64 +1794,64 @@ def test_array_float_2d_F_complex_3d_expr(language): # TEST: 1D Stack ARRAYS OF REAL #============================================================================== -def test_array_float_sum_stack_array(language): +def test_array_float_sum_stack_array(language_with_cuda): f1 = arrays.array_float_1d_sum_stack_array - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = f1() x2 = f2() assert np.equal( x1, x2 ) -def test_array_float_div_stack_array(language): +def test_array_float_div_stack_array(language_with_cuda): f1 = arrays.array_float_1d_div_stack_array - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = f1() x2 = f2() assert np.equal( x1, x2 ) -def test_multiple_stack_array_1(language): +def test_multiple_stack_array_1(language_with_cuda): f1 = arrays.multiple_stack_array_1 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert np.allclose(f1(), f2(), rtol=RTOL, atol=ATOL) -def test_multiple_stack_array_2(language): +def test_multiple_stack_array_2(language_with_cuda): f1 = arrays.multiple_stack_array_2 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert np.allclose(f1(), f2(), rtol=RTOL, atol=ATOL) #============================================================================== # TEST: 2D Stack ARRAYS OF REAL #============================================================================== -def test_array_float_sum_2d_stack_array(language): +def test_array_float_sum_2d_stack_array(language_with_cuda): f1 = arrays.array_float_2d_sum_stack_array - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = f1() x2 = f2() assert np.equal( x1, x2 ) -def test_array_float_div_2d_stack_array(language): +def test_array_float_div_2d_stack_array(language_with_cuda): f1 = arrays.array_float_2d_div_stack_array - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = f1() x2 = f2() assert np.equal( x1, x2 ) -def test_multiple_2d_stack_array_1(language): +def test_multiple_2d_stack_array_1(language_with_cuda): f1 = arrays.multiple_2d_stack_array_1 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert np.allclose(f1(), f2(), rtol=RTOL, atol=ATOL) -def test_multiple_2d_stack_array_2(language): +def test_multiple_2d_stack_array_2(language_with_cuda): f1 = arrays.multiple_2d_stack_array_2 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert np.allclose(f1(), f2(), rtol=RTOL, atol=ATOL) #============================================================================== @@ -2031,9 +2031,9 @@ def test_array_float_2d_2d_matmul_operator(language): f2(A2, B2, C2) assert np.array_equal(C1, C2) -def test_array_float_loopdiff(language): +def test_array_float_loopdiff(language_with_cuda): f1 = arrays.array_float_loopdiff - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) x1 = np.ones(5) y1 = np.zeros(5) x2 = np.copy(x1) @@ -2061,81 +2061,81 @@ def test_array_kwargs_ones(language): # TEST: Negative indexes #============================================================================== -def test_constant_negative_index(language): +def test_constant_negative_index(language_with_cuda): from numpy.random import randint n = randint(2, 10) f1 = arrays.constant_negative_index - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) assert f1(n) == f2(n) -def test_almost_negative_index(language): +def test_almost_negative_index(language_with_cuda): from numpy.random import randint n = randint(2, 10) f1 = arrays.constant_negative_index - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) assert f1(n) == f2(n) -def test_var_negative_index(language): +def test_var_negative_index(language_with_cuda): from numpy.random import randint n = randint(2, 10) idx = randint(-n,0) f1 = arrays.var_negative_index - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) assert f1(n,idx) == f2(n,idx) -def test_expr_negative_index(language): +def test_expr_negative_index(language_with_cuda): from numpy.random import randint n = randint(2, 10) idx1 = randint(-n,2*n) idx2 = randint(idx1,idx1+n+1) f1 = arrays.expr_negative_index - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) assert f1(n,idx1,idx2) == f2(n,idx1,idx2) -def test_multiple_negative_index(language): +def test_multiple_negative_index(language_with_cuda): f1 = arrays.test_multiple_negative_index - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(-2, -1) == f2(-2, -1) -def test_multiple_negative_index_2(language): +def test_multiple_negative_index_2(language_with_cuda): f1 = arrays.test_multiple_negative_index_2 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(-4, -2) == f2(-4, -2) -def test_multiple_negative_index_3(language): +def test_multiple_negative_index_3(language_with_cuda): f1 = arrays.test_multiple_negative_index_3 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(-1, -1, -3) == f2(-1, -1, -3) -def test_argument_negative_index_1(language): +def test_argument_negative_index_1(language_with_cuda): a = arrays.a_1d f1 = arrays.test_argument_negative_index_1 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a) == f2(a) -def test_argument_negative_index_2(language): +def test_argument_negative_index_2(language_with_cuda): a = arrays.a_1d f1 = arrays.test_argument_negative_index_2 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a, a) == f2(a, a) -def test_c_order_argument_negative_index(language): +def test_c_order_argument_negative_index(language_with_cuda): a = np.random.randint(20, size=(3,4)) f1 = arrays.test_c_order_argument_negative_index - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a, a) == f2(a, a) -def test_f_order_argument_negative_index(language): +def test_f_order_argument_negative_index(language_with_cuda): a = np.array(np.random.randint(20, size=(3,4)), order='F') f1 = arrays.test_f_order_argument_negative_index - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a, a) == f2(a, a) #============================================================================== @@ -2155,9 +2155,9 @@ def test_array_random_size(language): s1, s2 = f2() assert s1 == s2 -def test_array_variable_size(language): +def test_array_variable_size(language_with_cuda): f1 = arrays.array_variable_size - f2 = epyccel( f1 , language = language) + f2 = epyccel( f1 , language = language_with_cuda) from numpy.random import randint n = randint(1, 10) m = randint(11,20) @@ -2168,75 +2168,75 @@ def test_array_variable_size(language): # TEST : 1d array slices #============================================================================== -def test_array_1d_slice_1(language): +def test_array_1d_slice_1(language_with_cuda): a = arrays.a_1d f1 = arrays.array_1d_slice_1 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a) == f2(a) -def test_array_1d_slice_2(language): +def test_array_1d_slice_2(language_with_cuda): a = arrays.a_1d f1 = arrays.array_1d_slice_2 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a) == f2(a) -def test_array_1d_slice_3(language): +def test_array_1d_slice_3(language_with_cuda): a = arrays.a_1d f1 = arrays.array_1d_slice_3 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a) == f2(a) -def test_array_1d_slice_4(language): +def test_array_1d_slice_4(language_with_cuda): a = arrays.a_1d f1 = arrays.array_1d_slice_4 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a) == f2(a) -def test_array_1d_slice_5(language): +def test_array_1d_slice_5(language_with_cuda): a = arrays.a_1d f1 = arrays.array_1d_slice_5 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a) == f2(a) -def test_array_1d_slice_6(language): +def test_array_1d_slice_6(language_with_cuda): a = arrays.a_1d f1 = arrays.array_1d_slice_6 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a) == f2(a) -def test_array_1d_slice_7(language): +def test_array_1d_slice_7(language_with_cuda): a = arrays.a_1d f1 = arrays.array_1d_slice_7 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a) == f2(a) -def test_array_1d_slice_8(language): +def test_array_1d_slice_8(language_with_cuda): a = arrays.a_1d f1 = arrays.array_1d_slice_8 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a) == f2(a) -def test_array_1d_slice_9(language): +def test_array_1d_slice_9(language_with_cuda): a = arrays.a_1d f1 = arrays.array_1d_slice_9 - f2 = epyccel(f1, language = language) + f2 = epyccel(f1, language = language_with_cuda) assert f1(a) == f2(a) diff --git a/tests/epyccel/test_arrays_multiple_assignments.py b/tests/epyccel/test_arrays_multiple_assignments.py index b7be052a85..004b7675e0 100644 --- a/tests/epyccel/test_arrays_multiple_assignments.py +++ b/tests/epyccel/test_arrays_multiple_assignments.py @@ -15,7 +15,7 @@ STACK_ARRAY_UNKNOWN_SHAPE) #============================================================================== -def test_no_reallocation(language): +def test_no_reallocation(language_with_cuda): @stack_array('y') def f(): @@ -30,13 +30,13 @@ def f(): return x.sum() + y.sum() # TODO: check that we don't get any Pyccel warnings - g = epyccel(f, language=language) + g = epyccel(f, language=language_with_cuda) # Check result of pyccelized function assert f() == g() #============================================================================== -def test_reallocation_heap(language): +def test_reallocation_heap(language_with_cuda): def f(): import numpy as np @@ -48,7 +48,7 @@ def f(): errors = Errors() # TODO: check if we get the correct Pyccel warning - g = epyccel(f, language=language) + g = epyccel(f, language=language_with_cuda) # Check result of pyccelized function assert f() == g() @@ -63,7 +63,7 @@ def f(): assert warning_info.message == ARRAY_REALLOCATION #============================================================================== -def test_reallocation_stack(language): +def test_reallocation_stack(language_with_cuda): @stack_array('x') def f(): @@ -77,7 +77,7 @@ def f(): # epyccel should raise an Exception with pytest.raises(PyccelSemanticError): - epyccel(f, language=language) + epyccel(f, language=language_with_cuda) # Check that we got exactly 1 Pyccel error assert errors.has_errors() @@ -89,7 +89,7 @@ def f(): assert error_info.message == INCOMPATIBLE_REDEFINITION_STACK_ARRAY #============================================================================== -def test_creation_in_loop_heap(language): +def test_creation_in_loop_heap(language_with_cuda): def f(): import numpy as np @@ -101,7 +101,7 @@ def f(): errors = Errors() # TODO: check if we get the correct Pyccel warning - g = epyccel(f, language=language) + g = epyccel(f, language=language_with_cuda) # Check result of pyccelized function assert f() == g() @@ -116,7 +116,7 @@ def f(): assert warning_info.message == ARRAY_DEFINITION_IN_LOOP #============================================================================== -def test_creation_in_loop_stack(language): +def test_creation_in_loop_stack(language_with_cuda): @stack_array('x') def f(): @@ -130,7 +130,7 @@ def f(): # epyccel should raise an Exception with pytest.raises(PyccelSemanticError): - epyccel(f, language=language) + epyccel(f, language=language_with_cuda) # Check that we got exactly 2 Pyccel errors assert errors.has_errors() @@ -149,7 +149,7 @@ def f(): assert error_info.message == STACK_ARRAY_DEFINITION_IN_LOOP #============================================================================== -def test_creation_in_if_heap(language): +def test_creation_in_if_heap(language_with_cuda): def f(c : 'float'): import numpy as np @@ -160,7 +160,7 @@ def f(c : 'float'): return x.sum() # TODO: check if we get the correct Pyccel warning - g = epyccel(f, language=language) + g = epyccel(f, language=language_with_cuda) # Check result of pyccelized function import numpy as np @@ -168,7 +168,7 @@ def f(c : 'float'): assert f(c) == g(c) #============================================================================== -def test_Reassign_to_Target(): +def test_Reassign_to_Target(language_with_cuda): def f(): import numpy as np @@ -182,7 +182,7 @@ def f(): # epyccel should raise an Exception with pytest.raises(PyccelSemanticError): - epyccel(f) + epyccel(f, language=language_with_cuda) # Check that we got exactly 1 Pyccel error assert errors.has_errors() == 1 @@ -195,7 +195,7 @@ def f(): #============================================================================== -def test_Assign_Between_Allocatables(): +def test_Assign_Between_Allocatables(language_with_cuda): def f(): import numpy as np @@ -210,7 +210,7 @@ def f(): # epyccel should raise an Exception with pytest.raises(PyccelSemanticError): - epyccel(f) + epyccel(f, language=language_with_cuda) # Check that we got exactly 1 Pyccel error assert errors.has_errors() == 1 @@ -223,7 +223,7 @@ def f(): #============================================================================== -def test_Assign_after_If(): +def test_Assign_after_If(language_with_cuda): def f(b : bool): import numpy as np @@ -240,7 +240,7 @@ def f(b : bool): errors = Errors() # epyccel should raise an Exception - f2 = epyccel(f) + f2 = epyccel(f, language=language_with_cuda) # Check that we got exactly 1 Pyccel warning assert errors.has_warnings() @@ -255,7 +255,7 @@ def f(b : bool): assert f(False) == f2(False) #============================================================================== -def test_stack_array_if(language): +def test_stack_array_if(language_with_cuda): @stack_array('x') def f(b : bool): @@ -267,18 +267,15 @@ def f(b : bool): return x[0] # Initialize singleton that stores Pyccel errors - f2 = epyccel(f, language=language) + f2 = epyccel(f, language=language_with_cuda) assert f(True) == f2(True) assert f(False) == f2(False) #============================================================================== -@pytest.mark.parametrize('lang',[ - pytest.param('fortran', marks = pytest.mark.fortran), - pytest.param('python', marks = pytest.mark.python), - pytest.param('c' , marks = pytest.mark.c)]) -def test_Assign_between_nested_If(lang): + +def test_Assign_between_nested_If(language_with_cuda): def f(b1 : bool, b2 : bool): import numpy as np @@ -297,7 +294,7 @@ def f(b1 : bool, b2 : bool): errors = Errors() # epyccel should raise an Exception - f2 = epyccel(f, language=lang) + f2 = epyccel(f, language=language_with_cuda) # Check that we don't get a Pyccel warning assert not errors.has_warnings() diff --git a/tests/epyccel/test_base.py b/tests/epyccel/test_base.py index c22064d321..413f79eef1 100644 --- a/tests/epyccel/test_base.py +++ b/tests/epyccel/test_base.py @@ -7,128 +7,128 @@ from utilities import epyccel_test -def test_is_false(language): - test = epyccel_test(base.is_false, lang=language) +def test_is_false(language_with_cuda): + test = epyccel_test(base.is_false, lang=language_with_cuda) test.compare_epyccel( True ) test.compare_epyccel( False ) -def test_is_true(language): - test = epyccel_test(base.is_true, lang=language) +def test_is_true(language_with_cuda): + test = epyccel_test(base.is_true, lang=language_with_cuda) test.compare_epyccel( True ) test.compare_epyccel( False ) -def test_compare_is(language): - test = epyccel_test(base.compare_is, lang=language) +def test_compare_is(language_with_cuda): + test = epyccel_test(base.compare_is, lang=language_with_cuda) test.compare_epyccel( True, True ) test.compare_epyccel( True, False ) test.compare_epyccel( False, True ) test.compare_epyccel( False, False ) -def test_compare_is_not(language): - test = epyccel_test(base.compare_is_not, lang=language) +def test_compare_is_not(language_with_cuda): + test = epyccel_test(base.compare_is_not, lang=language_with_cuda) test.compare_epyccel( True, True ) test.compare_epyccel( True, False ) test.compare_epyccel( False, True ) test.compare_epyccel( False, False ) -def test_compare_is_int(language): - test = epyccel_test(base.compare_is_int, lang=language) +def test_compare_is_int(language_with_cuda): + test = epyccel_test(base.compare_is_int, lang=language_with_cuda) test.compare_epyccel( True, 1 ) test.compare_epyccel( True, 0 ) test.compare_epyccel( False, 1 ) test.compare_epyccel( False, 0 ) -def test_compare_is_not_int(language): - test = epyccel_test(base.compare_is_not_int, lang=language) +def test_compare_is_not_int(language_with_cuda): + test = epyccel_test(base.compare_is_not_int, lang=language_with_cuda) test.compare_epyccel( True, 1 ) test.compare_epyccel( True, 0 ) test.compare_epyccel( False, 1 ) test.compare_epyccel( False, 0 ) -def test_not_false(language): - test = epyccel_test(base.not_false, lang=language) +def test_not_false(language_with_cuda): + test = epyccel_test(base.not_false, lang=language_with_cuda) test.compare_epyccel( True ) test.compare_epyccel( False ) -def test_not_true(language): - test = epyccel_test(base.not_true, lang=language) +def test_not_true(language_with_cuda): + test = epyccel_test(base.not_true, lang=language_with_cuda) test.compare_epyccel( True ) test.compare_epyccel( False ) -def test_eq_false(language): - test = epyccel_test(base.eq_false, lang=language) +def test_eq_false(language_with_cuda): + test = epyccel_test(base.eq_false, lang=language_with_cuda) test.compare_epyccel( True ) test.compare_epyccel( False ) -def test_eq_true(language): - test = epyccel_test(base.eq_true, lang=language) +def test_eq_true(language_with_cuda): + test = epyccel_test(base.eq_true, lang=language_with_cuda) test.compare_epyccel( True ) test.compare_epyccel( False ) -def test_neq_false(language): - test = epyccel_test(base.eq_false, lang=language) +def test_neq_false(language_with_cuda): + test = epyccel_test(base.eq_false, lang=language_with_cuda) test.compare_epyccel( True ) test.compare_epyccel( False ) -def test_neq_true(language): - test = epyccel_test(base.eq_true, lang=language) +def test_neq_true(language_with_cuda): + test = epyccel_test(base.eq_true, lang=language_with_cuda) test.compare_epyccel( True ) test.compare_epyccel( False ) -def test_not(language): - test = epyccel_test(base.not_val, lang=language) +def test_not(language_with_cuda): + test = epyccel_test(base.not_val, lang=language_with_cuda) test.compare_epyccel( True ) test.compare_epyccel( False ) -def test_not_int(language): - test = epyccel_test(base.not_int, lang=language) +def test_not_int(language_with_cuda): + test = epyccel_test(base.not_int, lang=language_with_cuda) test.compare_epyccel( 0 ) test.compare_epyccel( 4 ) -def test_compare_is_nil(language): - test = epyccel_test(base.is_nil, lang=language) +def test_compare_is_nil(language_with_cuda): + test = epyccel_test(base.is_nil, lang=language_with_cuda) test.compare_epyccel( None ) -def test_compare_is_not_nil(language): - test = epyccel_test(base.is_not_nil, lang=language) +def test_compare_is_not_nil(language_with_cuda): + test = epyccel_test(base.is_not_nil, lang=language_with_cuda) test.compare_epyccel( None ) -def test_cast_int(language): - test = epyccel_test(base.cast_int, lang=language) +def test_cast_int(language_with_cuda): + test = epyccel_test(base.cast_int, lang=language_with_cuda) test.compare_epyccel( 4 ) - test = epyccel_test(base.cast_float_to_int, lang=language) + test = epyccel_test(base.cast_float_to_int, lang=language_with_cuda) test.compare_epyccel( 4.5 ) -def test_cast_bool(language): - test = epyccel_test(base.cast_bool, lang=language) +def test_cast_bool(language_with_cuda): + test = epyccel_test(base.cast_bool, lang=language_with_cuda) test.compare_epyccel( True ) -def test_cast_float(language): - test = epyccel_test(base.cast_float, lang=language) +def test_cast_float(language_with_cuda): + test = epyccel_test(base.cast_float, lang=language_with_cuda) test.compare_epyccel( 4.5 ) - test = epyccel_test(base.cast_int_to_float, lang=language) + test = epyccel_test(base.cast_int_to_float, lang=language_with_cuda) test.compare_epyccel( 4 ) -def test_if_0_int(language): - test = epyccel_test(base.if_0_int, lang=language) +def test_if_0_int(language_with_cuda): + test = epyccel_test(base.if_0_int, lang=language_with_cuda) test.compare_epyccel( 22 ) test.compare_epyccel( 0 ) -def test_if_0_real(language): - test = epyccel_test(base.if_0_real, lang=language) +def test_if_0_real(language_with_cuda): + test = epyccel_test(base.if_0_real, lang=language_with_cuda) test.compare_epyccel( 22.3 ) test.compare_epyccel( 0.0 ) -def test_same_int(language): - test = epyccel_test(base.is_same_int, lang=language) +def test_same_int(language_with_cuda): + test = epyccel_test(base.is_same_int, lang=language_with_cuda) test.compare_epyccel( 22 ) - test = epyccel_test(base.isnot_same_int, lang=language) + test = epyccel_test(base.isnot_same_int, lang=language_with_cuda) test.compare_epyccel( 22 ) -def test_same_float(language): - test = epyccel_test(base.is_same_float, lang=language) +def test_same_float(language_with_cuda): + test = epyccel_test(base.is_same_float, lang=language_with_cuda) test.compare_epyccel( 22.2 ) - test = epyccel_test(base.isnot_same_float, lang=language) + test = epyccel_test(base.isnot_same_float, lang=language_with_cuda) test.compare_epyccel( 22.2 ) @pytest.mark.parametrize( 'language', [ @@ -150,28 +150,28 @@ def test_same_complex(language): test = epyccel_test(base.isnot_same_complex, lang=language) test.compare_epyccel( complex(2,3) ) -def test_is_types(language): - test = epyccel_test(base.is_types, lang=language) +def test_is_types(language_with_cuda): + test = epyccel_test(base.is_types, lang=language_with_cuda) test.compare_epyccel( 1, 1.0 ) -def test_isnot_types(language): - test = epyccel_test(base.isnot_types, lang=language) +def test_isnot_types(language_with_cuda): + test = epyccel_test(base.isnot_types, lang=language_with_cuda) test.compare_epyccel( 1, 1.0 ) -def test_none_is_none(language): - test = epyccel_test(base.none_is_none, lang=language) +def test_none_is_none(language_with_cuda): + test = epyccel_test(base.none_is_none, lang=language_with_cuda) test.compare_epyccel() -def test_none_isnot_none(language): - test = epyccel_test(base.none_isnot_none, lang=language) +def test_none_isnot_none(language_with_cuda): + test = epyccel_test(base.none_isnot_none, lang=language_with_cuda) test.compare_epyccel() -def test_pass_if(language): - test = epyccel_test(base.pass_if, lang=language) +def test_pass_if(language_with_cuda): + test = epyccel_test(base.pass_if, lang=language_with_cuda) test.compare_epyccel(2) -def test_pass2_if(language): - test = epyccel_test(base.pass2_if, lang=language) +def test_pass2_if(language_with_cuda): + test = epyccel_test(base.pass2_if, lang=language_with_cuda) test.compare_epyccel(0.2) test.compare_epyccel(0.0) @@ -192,15 +192,15 @@ def test_use_optional(language): test.compare_epyccel() test.compare_epyccel(6) -def test_none_equality(language): - test = epyccel_test(base.none_equality, lang=language) +def test_none_equality(language_with_cuda): + test = epyccel_test(base.none_equality, lang=language_with_cuda) test.compare_epyccel() test.compare_epyccel(6) -def test_none_none_equality(language): - test = epyccel_test(base.none_none_equality, lang=language) +def test_none_none_equality(language_with_cuda): + test = epyccel_test(base.none_none_equality, lang=language_with_cuda) test.compare_epyccel() -def test_none_literal_equality(language): - test = epyccel_test(base.none_literal_equality, lang=language) +def test_none_literal_equality(language_with_cuda): + test = epyccel_test(base.none_literal_equality, lang=language_with_cuda) test.compare_epyccel()