.. meta::
   :description: Tools to automatically translate CUDA source code into portable HIP C++
   :keywords: HIPIFY, ROCm, library, tool, CUDA, CUDA2HIP, hipify-clang, hipify-perl

.. _hipify-perl:

===================
hipify-perl
===================

``hipify-perl`` is an autogenerated perl-based script that heavily uses regular expressions.

**Advantages:**

- Ease of use

- No checks for input source NVIDIA CUDA code for correctness required

- No dependency on third party tools, including CUDA

**Disadvantages:**

- Inability or difficulty in implementing the following constructs:

    - Macros expansion

    - Namespaces:

        - Redefinition of CUDA entities in user namespaces

        - Using directive

    - Templates (some cases)

    - Device or host function calls differentiation

    - Correct injection of header files

    - Parsing complicated argument lists

Usage
-----------

.. code-block:: shell

    perl hipify-perl square.cu > square.cu.hip

Building hipify-perl
---------------------

To generate ``hipify-perl``, run 

.. code-block:: shell
    
    hipify-clang --perl
    
You can choose to specify the output directory for the generated ``hipify-perl`` file using ``--o-hipify-perl-dir`` option.
